33 lines
666 B
Python
Executable file
33 lines
666 B
Python
Executable file
#!/usr/bin/env python
|
|
|
|
|
|
import itertools
|
|
import sys
|
|
from typing import List
|
|
|
|
|
|
def find_invalid(nums: List[int]) -> int:
|
|
for i in range(25, len(nums)):
|
|
num = nums[i]
|
|
found = False
|
|
for lhs, rhs in itertools.combinations(nums[i - 25 : i], 2):
|
|
if lhs + rhs == num:
|
|
found = True
|
|
break
|
|
if not found:
|
|
return num
|
|
assert False # Sanity check
|
|
|
|
|
|
def solve(raw: List[str]) -> int:
|
|
return find_invalid([int(line) for line in raw])
|
|
|
|
|
|
def main() -> None:
|
|
input = [line.strip() for line in sys.stdin.readlines()]
|
|
print(solve(input))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|