This is ugly, but the problem is small enough that it works just fine.
My solutions to Advent of Code 2024.