import os
import aocd
import pandas as pd

os.environ["AOC_SESSION"]='53616c7465645f5fde65f3dbf32f917afa58e3e337ef5b813300ee2768c7c808ba404009fe240d8c2ed2f84b9d0799b0ea54c934f5533a0555f920ca0d59c46b'
puzzle_input = aocd.get_data(day=1, year=2022)

puzzle_input_list = str(puzzle_input).split('\n')
elf_df = pd.DataFrame(columns=['Name','Total Calories'])

reindeer_total = 0
elf_id = 0

for calorie_count in puzzle_input_list:
    try:
        reindeer_total = reindeer_total + int(calorie_count)
    except:
        elf_id = elf_id + 1
        elf_name = f'elf_{elf_id}'
        elf_df.loc[len(elf_df.index)] = elf_name,reindeer_total
        reindeer_total = 0

top_3_chonkers = elf_df['Total Calories'].nlargest(3).sum(numeric_only=True)

print(f'The three chonkiest elves ate {top_3_chonkers:,} calories, what heccin chonkers.')