Advent of Code 2025, solved in C

This year I took part in Advent of Code and solved each of the 12 puzzles in C. A few brief insights into the tasks and my thoughts on AoC 2025.

Just a very short note and a bit of promotion for the coming year, shortly after Christmas:

This year I took part in Advent of Code and solved each of the 12 puzzles in C.

Collected all the stars, the ASCII art village is fully lit up.

Of course, I also published my solutions as open source on GitHub: https://github.com/PaulGoldschmidt/advent-of-code-2025

I can absolutely recommend taking part in AoC in the future as well: it tells a small story through several puzzles (in previous years always 24 puzzles, now 12 with two parts). The tasks are comparable to many Leetcode ideas, ranging from sorting algorithms to linear algebra and glorified matrix mathematics.

I found the second part of day ten particularly difficult, where a complex system of equations had to be solved: I first tried brute forcing, but after three days of maxing out exactly one CPU core on my server and making no progress after machine 10, I was pointed toward the solution via Z3 (an SMT solver), which implements a Gaussian solver for the system of equations. I implemented such a Gaussian solver myself without having to integrate Z3, and after quite a lot of work and a gigantic amount of debugging, I managed to bring the runtime down to 1500 ms.

That said, with a bit more optimization and actual integration of Z3, a solution in at least 250 milliseconds is also possible, as can be seen in Lukas Kollmer's solution.

The second part of day 11 was also a debugging challenge, which I was only really able to visualize and solve through a post on AoC 2025 Reddit. At first, I hadn't understood that there could also be loops in the structure. The solution then suddenly became obvious, as is so often the case, and not all that difficult anymore :).