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.
24 lines
391 B
24 lines
391 B
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)
|
|
|