import aocd import re def mul(a, b): return int(a)*int(b) def solve(data): return sum(mul(*match) for match in re.findall(r'mul\((\d+),(\d+)\)', data)) if __name__ == '__main__': solution = solve(aocd.get_data(year=2024, day=3)) print(solution) aocd.submit(solution, year=2024, day=3, part='a')