Advent of Code in C

January 13, 2026 · View on GitHub

CMake

Testing all solutions on Linux, FreeBSD, OpenBSD and Windows/MinGW64. Target is to make the code platform independent which has turned out to be pretty difficult sometimes.

Possible to build using CMake. Builds with pre-defined custom targets for each day. To build run cmake -B build .

To run a specific day, for example Day 1 2021 run:

cd build
make run_2021_01

Or to run a specific year, for example 2021, run:

cd build
make run_2021

Replace make above with whatever build system you choose to use in CMake

2024 (Year of the plain C)

DayStarsTiming Part 1Timing Part 2Comment
1⭐⭐Pretty fun
2⭐⭐Probably not the most efficient...
3⭐⭐Plain C almost. Using regex
4⭐⭐Simpler solution but not faster
5⭐⭐Messy.
6⭐⭐
12Loop mania.
13⭐⭐Simple, yet nice
14⭐⭐Pretty nice

2023

DayStarsTiming Part 1Timing Part 2
1⭐⭐
2⭐⭐
3⭐⭐
4⭐⭐
6⭐⭐
:---::-------------------------------:--------------:

2022

DayStarsTiming Part 1Timing Part 2
1⭐⭐0.029 ms0.009 ms
2⭐⭐0.004 ms0.027 ms
3⭐⭐
4⭐⭐
5
6⭐⭐0.371 ms0.678 ms
12&#11088

2021

DayStarsTiming Part 1Timing Part 2
1⭐⭐0.029 ms0.009 ms
2⭐⭐
3⭐⭐
4⭐⭐
5⭐⭐
6⭐⭐
7⭐⭐
8⭐⭐
10⭐⭐
18⭐⭐

2020

DayStarsTiming Part 1Timing Part 2Comment
1⭐⭐
2⭐⭐
3⭐⭐
4⭐⭐
5⭐⭐
6⭐⭐
7⭐⭐
8⭐⭐
9⭐⭐
10⭐⭐
11⭐⭐
12⭐⭐
13⭐⭐
14⭐⭐
15⭐⭐
16⭐⭐
17⭐⭐

2019

DayStarsTiming Part 1Timing Part 2
1⭐⭐0.029 ms0.009 ms
2⭐⭐0.004 ms0.027 ms
3⭐⭐0.881 ms0.545 s
4⭐⭐0.016 s0.016 s
5⭐⭐
6⭐⭐

2018:

DayStarsTiming Part 1Timing Part 2Comment
1⭐⭐

2017:

DayStarsTiming Part 1Timing Part 2Comment
1⭐⭐
2⭐⭐
3⭐⭐0.266 ms0.035 ms

2016

DayStarsTiming Part 1Timing Part 2
1⭐⭐
2⭐⭐
3⭐⭐
5⭐⭐
6⭐⭐
7⭐⭐
8⭐⭐

2015

DayStarsTiming Part 1Timing Part 2
1⭐⭐0.030 ms0.009 ms
2⭐⭐
3⭐⭐
4⭐⭐
5⭐⭐
6⭐⭐
11⭐⭐