Advent of Code puzzle solutions in Elixir. It's work in progress and starting year 2015 to 2022, random days are attempted.
All solution modules reside in lib/<year>/day_<day>.ex and associated tests have the same structure in test/ folder. Input files are in lib/data/inputs/<year>_<day>.txt.
To make the experience boilerplate-free and give all solutions uniform (more or less) structure, type mix gen --year <year> --day <day> or mix gen <year> <day> to have the structure and stub generated. Optionally, if you have AOC_SESSION_KEY environment variable storing your cookie then it will download the input file and add the title on the moduledocs for you. Type mix help gen for more.
To solve the problem for a particular year/day, type in mix solve --year <year> --day <day> or mix solve <year> <day> and you will see the result of the mentioned year/day if it is valid and has been solved. Type mix help solve for more.
During December 1 of a new year (if Advent of Code is happening that year), the following steps should be taken (this should be more streamlined in future):
- Create a new folder
XXXX(in year format) under/libor/test - Update the
@latest_yearattribute onadvent_of_code.ex - Double check your session cookie
AOC_SESSION_KEY(in case you're using it)
All commands should work from then on.
run mix test to ensure all solutions are working okay. To run test for a particular year and day, type mix test --only y<last-two-digits-of-year><zero-padded-day>. For example: mix test --only y1501 tests for 2015 as year and 1 as day.
To benchmark solutions and update the Benchmarks report, use the provided script:
scripts/gen_benchmark.py: Runs all solved problems across all years.scripts/gen_benchmark.py <year>: Benchmarks all days for a specific year.scripts/gen_benchmark.py <year> <day>: Benchmarks a single problem (useful after a new solve).
The script saves results to a persistent JSON file at priv/data/benchmark.json, allowing you to update specific results without re-running everything.
If you want to update the README.md (i.e. this file) please do not update README.me directly, instead update the static content (not stats related) on priv/partials/readme_content.md and then run mix readme to regenerate this file.
Note: All files mentioned above are autogenerated and are created by running python3 scripts/gen_wiki.py.
191 problems solved across 11 years — Tags · Difficulty · Benchmarks
Years: 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 2024 | 2025
| Day | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 2024 | 2025 |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ |
| 2 | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ |
| 3 | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ |
| 4 | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ |
| 5 | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ |
| 6 | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ |
| 7 | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | |
| 8 | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | |
| 9 | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ||
| 10 | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | |||
| 11 | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ||||
| 12 | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ||
| 13 | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | |||||
| 14 | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ||||||
| 15 | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | |||||
| 16 | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | |||||
| 17 | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ||||
| 18 | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ||||
| 19 | ⭐ | ⭐ | ⭐ | ⭐ | |||||||
| 20 | ⭐ | ⭐ | ⭐ | ⭐ | |||||||
| 21 | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ||||||
| 22 | ⭐ | ⭐ | ⭐ | ⭐ | |||||||
| 23 | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | |||||
| 24 | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ||||||
| 25 | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ | ⭐ |
grid 37 graph 35 sequence 33 math 17 set 17 simulation 17 geometry 15 op-code 12 optimization 12 parsing 12 dynamic-programming 10 recursion 9 reduction 8 walk 8 bitwise 7 validation 6 count 5 pathfinding 5 ranges 5 slow 5 dijkstra 4 implicit-graph 4 map 4 matrix 4 sliding-window 4 annoying 3 combinatorics 3 connectivity 3 hash 3 md5 3 measurement 3 parallel 3 random-access 3 rotation 3 sort 3 stack 3 traversal 3 visual-result 3 a-star 2 assembunny 2 atomics 2 bfs 2 calculation 2 checksum 2 cycle-detection 2 cycles 2 data-modelling 2 emulation 2 enumeration 2 flood-fill 2 fsm 2 hexagon 2 int-code 2 interval-merging 2 json 2 large-number 2 pattern-matching 2 routing 2 state-space 2 state-space-search 2 string 2 string-encoding 2 table-lookup 2 topological-sort 2 union-find 2 vector 2 ambiguous-solution 1 binary 1 binary-search 1 binary-space 1 bron-kerbosch 1 clique 1 constellation 1 dataflow 1 date-time 1 floyd-warshall 1 game 1 gb-tree 1 generation 1 greedy 1 inline-input 1 lan-party 1 logic-circuit 1 logic-gates 1 longest-path 1 maximum-clique 1 min-cut 1 palindrome 1 partitioning 1 physics 1 quadratic-time 1 refactor 1 safe-dial 1 search 1 sieve 1 spiral 1 strategy 1 string-manipulation 1 string-result 1 tetris 1 tree 1 tsp 1 unfold 1 zipper 1