Description
Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like. People use them as a speed contest, interview prep, company training, university coursework, practice problems, or to challenge each other.
Calendar
M | T | W | T | F | S | S |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 |
|
Benchmark
Performance benchmarked on AMD Ryzen 9 3900X (24) @ 4.0GHz
, GCC 11.1.0
, and with flags -O3 -march=native
. Memory usage profiled using valgrind
.
Day | Problem | Runtime (Ξs) | Memory (kB) |
---|---|---|---|
01 |
Sonar Sweep | 229 | 138 |
02 |
Dive! | 285 | 364 |
03 |
Binary Diagnostic | 302 | 685 |
04 |
Giant Squid | 1021 | 697 |
05 |
Hydrothermal Venture | 3185 | 11096 |
06 |
Lanternfish | 95 | 126 |
07 |
The Treachery of Whales | 177 | 137 |
08 |
Seven Segment Search | 1483 | 363 |
09 |
Smoke Basin | 359 | 201 |
10 |
Syntax Scoring | 218 | 255 |
Build
Docker
Run directly from the docker image
docker run --rm mrlento234/advent2021:latest
From source
-
Build using
cmake
in thebuild
directory:make build
-
Run all the days:
make run
-
Optional: make and run a specific day
xx
:cd dayxx make build cd build && ./dayxx
Install dependencies
Ubuntu:
apt install build-essential cmake libfmt-dev curl pandoc valgrind
Arch Linux:
pacman -S base-devel cmake curl pandoc fmt
MacOS:
brew install cmake curl pandoc fmt