Skip to content

Instantly share code, notes, and snippets.

@albertein
Created December 1, 2022 17:26
Show Gist options
  • Save albertein/868922bd95012b846e6496abfc54e354 to your computer and use it in GitHub Desktop.
Save albertein/868922bd95012b846e6496abfc54e354 to your computer and use it in GitHub Desktop.
elves = []
current_elf = 0
with open('input.txt', encoding="utf-8") as file:
for line in file.readlines():
line = line.strip()
if line == '':
elves.append(current_elf)
current_elf = 0
continue
current_elf += int(line)
elves.append(current_elf)
print(sum(sorted(elves)[-3:]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment