Files
python-aoc-2020/day09/part1.py
Sebastian Seedorf 671787d627 Day 9 (added print)
2020-12-12 15:33:59 +01:00

16 lines
355 B
Python

from collections import deque
from itertools import combinations
lines = (int(x.strip()) for x in open("input.txt"))
L = 25
buffer = deque(maxlen=L)
for line in lines:
if len(buffer) == L:
found = any(a + b == line for a, b in combinations(buffer, 2))
if not found:
print(line)
break
buffer.append(line)