Skip to content

Instantly share code, notes, and snippets.

@rtt
Created December 1, 2020 20:14
Show Gist options
  • Save rtt/0896a65030311ce825001c77882dca08 to your computer and use it in GitHub Desktop.
Save rtt/0896a65030311ce825001c77882dca08 to your computer and use it in GitHub Desktop.
from itertools import combinations
from functools import reduce
from operator import mul
def get_input():
with open('1.txt') as f:
inp = f.readlines()
return list(map(int, map(str.strip, filter(None, inp))))
nums = list([c for c in combinations(get_input(), 3) if sum(c) == 2020][0])
print(reduce(mul, nums), nums)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment