You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
391 B
25 lines
391 B
2 years ago
|
import aoclib
|
||
|
|
||
|
|
||
|
inp = aoclib.get_input(1, parser=aoclib.group_on_empty_line(casting_func=int))
|
||
|
|
||
|
|
||
|
def part1():
|
||
|
lorge = 0
|
||
|
for group in inp:
|
||
|
c = sum(group)
|
||
|
if c > lorge:
|
||
|
lorge = c
|
||
|
|
||
|
return lorge
|
||
|
|
||
|
|
||
|
def part2():
|
||
|
sums = []
|
||
|
for group in inp:
|
||
|
sums.append(sum(group))
|
||
|
return sum(list(reversed(sorted(sums)))[:3])
|
||
|
|
||
|
|
||
|
aoclib.main(part1, part2)
|