My solutions to the Advent of Code 2025 challenges.
My goal was to refresh and improve my C++ knowledge. Therefore, all solutions are written in C++ using only the standard library (except day 10, part 2).
The repository is organized with each day in its own directory:
dayXX/
├── input
├── part1/
│ └── solution.cpp
└── part2/
└── solution.cpp
Each solution reads its input from the file at ../input.
Here is what topics, techniques and concepts I repeated/learned about on each day:
| Day | Progress (max. ⭐⭐) | Topics |
| 1-3 | ⭐⭐ | File reading, parsing, substr, structs |
| 4 | ⭐⭐ | Templates, iterators |
| 5 | ⭐⭐ | Classes, static methods, std::set |
| 6 | ⭐⭐ | Exception throwing |
| 7 | ⭐⭐ | Memoization, std::map, typedef |
| 8 | ⭐⭐ | Pointers and references, reference invalidation, operator overloading |
| 9 | ⭐⭐ | Lambdas, std::queue, Flood Fill Algorithm |
| 10 | ⭐⭐ | BFS, A* Algorithm, std::priority_queue, Z3 library, Linking |
| 11 | ⭐⭐ | Reference invalidation, Dynamic Programming |
| 12 | ⭐⭐ | Analyzing input data, primary school math ;) |
This challenge improved my C++ by a lot. I repeated core concepts so that I became able to fluently type out the algorithms quicker and quicker as the days progressed. Compared to Python, my main programming language, I realized again how low level standard C++ is, especially for parsing, which is a ton easier and quicker to write in Python. One thing I got caught off guard by twice (days 8 and 11) is reference invalidation, which I wasn't really aware of before. What I mean by that is that storing objects in containers such as vectors or maps, adding or removing elements might change the addresses of these objects, which causes references/pointers to them to become invalid. I learned to be very careful here, and how to circumvent the problem e.g. by avoiding unnecessary container updates or using fixed references (such as the keys of a map) instead.
The solutions were tested using C++17. They can be compiled (on Linux) by simply running
g++ solution.cppexcept for day 10, part 2, which uses the Z3 library which can be installed (on Ubuntu) with
sudo apt install libz3-dev z3and then the solution can be compiled with
g++ solution.cpp -lz3