aoc2020/09/1.py
2020-12-09 09:05:18 +00:00

6 lines
246 B
Python

nums = [int(l) for l in open("input", "r").read().split("\n") if l]
msg = nums[25:]
withpre = [(n, nums[i:i+25]) for (i, n) in enumerate(msg)]
invalid = [n for (n, pre) in withpre if not any([True for x in pre if (n - x) in pre])]
print(invalid)