2020/python/day09-a.py

23 lines
408 B
Python

import fileinput
import itertools
N = 25
numbers = []
for line in fileinput.input():
numbers.append(int(line))
for i in range(N, len(numbers)):
found = False
for j in numbers[i - N:i]:
for k in numbers[i - N:i]:
if j == k:
continue
if j + k == numbers[i]:
found = True
if not found:
print(numbers[i])
break