Blazing fast Rust solutions for every Advent of Code puzzle from 2015 to 2024, taking 501 milliseconds to solve all 500 stars. Each solution is carefully optimized for performance while ensuring the code remains concise, readable, and idiomatic.
- Minimal - Depends only on the standard library.
- High Quality - Formatted with
rustfmt
, linted byclippy
and continuously tested via GitHub Actions. Nounsafe
code. - Well Documented - Every solution is comprehensively commented with rustdoc-generated documentation also available online.
Show details
Input
Place input files in input/yearYYYY/dayDD.txt
including leading zeroes. For example:
input/year2015/day23.txt
input/year2023/day02.txt
Run
- Everything
cargo run
- Specific year
cargo run year2023
- Specific day
cargo run year2023::day01
- Release profile (faster)
cargo run --release
- Optimized for current CPU architecture (fastest)
RUSTFLAGS="-C target-cpu=native" cargo run --release
Test
- Everything
cargo test
- Specific year
cargo test year2023
- Specific day
cargo test year2023::day01
- Show STDOUT for debugging
cargo test -- --nocapture
Benchmark
- Everything
cargo bench
- Specific year
cargo bench year2023
- Specific day
cargo bench year2023::day01
Document
- Build docs including private items
cargo doc --document-private-items
- Build docs then open HTML landing page
cargo doc --document-private-items --open
Miscellaneous
- Code quality lints
cargo clippy
- Consistent code formatting
cargo fmt
Improvements to solutions are always appreciated. Please see the detailed instructions on how to get started.
Benchmarks are measured using the built-in cargo bench
tool run on an Apple M2 Max.
Interestingly 86% of the total time is spent on just 9 solutions.
Performance is reasonable even on older hardware, for example a 2011 MacBook Pro with an
Intel i7-2720QM processor takes 3.5 seconds to run the same 250 solutions.
Year | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 2024 |
---|---|---|---|---|---|---|---|---|---|---|
Benchmark (ms) | 15 | 111 | 82 | 35 | 15 | 220 | 8 | 6 | 5 | 4 |
Day | Problem | Solution | Benchmark (μs) |
---|---|---|---|
1 | Historian Hysteria | Source | 21 |
2 | Red-Nosed Reports | Source | 40 |
3 | Mull It Over | Source | 8 |
4 | Ceres Search | Source | 77 |
5 | Print Queue | Source | 18 |
6 | Guard Gallivant | Source | 439 |
7 | Bridge Repair | Source | 136 |
8 | Resonant Collinearity | Source | 8 |
9 | Disk Fragmenter | Source | 106 |
10 | Hoof It | Source | 38 |
11 | Plutonian Pebbles | Source | 227 |
12 | Garden Groups | Source | 289 |
13 | Claw Contraption | Source | 14 |
14 | Restroom Redoubt | Source | 74 |
15 | Warehouse Woes | Source | 303 |
16 | Reindeer Maze | Source | 350 |
17 | Chronospatial Computer | Source | 2 |
18 | RAM Run | Source | 42 |
19 | Linen Layout | Source | 110 |
20 | Race Condition | Source | 1113 |
21 | Keypad Conundrum | Source | 19 |
22 | Monkey Market | Source | 688 |
23 | LAN Party | Source | 43 |
24 | Crossed Wires | Source | 23 |
25 | Code Chronicle | Source | 8 |
Day | Problem | Solution | Benchmark (μs) |
---|---|---|---|
1 | Trebuchet?! | Source | 37 |
2 | Cube Conundrum | Source | 9 |
3 | Gear Ratios | Source | 53 |
4 | Scratchcards | Source | 20 |
5 | If You Give A Seed A Fertilizer | Source | 18 |
6 | Wait For It | Source | 1 |
7 | Camel Cards | Source | 71 |
8 | Haunted Wasteland | Source | 34 |
9 | Mirage Maintenance | Source | 18 |
10 | Pipe Maze | Source | 35 |
11 | Cosmic Expansion | Source | 12 |
12 | Hot Springs | Source | 455 |
13 | Point of Incidence | Source | 66 |
14 | Parabolic Reflector Dish | Source | 632 |
15 | Lens Library | Source | 84 |
16 | The Floor Will Be Lava | Source | 160 |
17 | Clumsy Crucible | Source | 2379 |
18 | Lavaduct Lagoon | Source | 11 |
19 | Aplenty | Source | 100 |
20 | Pulse Propagation | Source | 6 |
21 | Step Counter | Source | 182 |
22 | Sand Slabs | Source | 40 |
23 | A Long Walk | Source | 68 |
24 | Never Tell Me The Odds | Source | 95 |
25 | Snowverload | Source | 179 |
Day | Problem | Solution | Benchmark (μs) |
---|---|---|---|
1 | Calorie Counting | Source | 14 |
2 | Rock Paper Scissors | Source | 3 |
3 | Rucksack Reorganization | Source | 13 |
4 | Camp Cleanup | Source | 8 |
5 | Supply Stacks | Source | 13 |
6 | Tuning Trouble | Source | 3 |
7 | No Space Left On Device | Source | 11 |
8 | Treetop Tree House | Source | 51 |
9 | Rope Bridge | Source | 107 |
10 | Cathode-Ray Tube | Source | 2 |
11 | Monkey in the Middle | Source | 244 |
12 | Hill Climbing Algorithm | Source | 57 |
13 | Distress Signal | Source | 15 |
14 | Regolith Reservoir | Source | 146 |
15 | Beacon Exclusion Zone | Source | 2 |
16 | Proboscidea Volcanium | Source | 59 |
17 | Pyroclastic Flow | Source | 71 |
18 | Boiling Boulders | Source | 52 |
19 | Not Enough Minerals | Source | 74 |
20 | Grove Positioning System | Source | 2685 |
21 | Monkey Math | Source | 64 |
22 | Monkey Map | Source | 61 |
23 | Unstable Diffusion | Source | 1521 |
24 | Blizzard Basin | Source | 62 |
25 | Full of Hot Air | Source | 3 |
Day | Problem | Solution | Benchmark (μs) |
---|---|---|---|
1 | Sonar Sweep | Source | 6 |
2 | Dive! | Source | 12 |
3 | Binary Diagnostic | Source | 22 |
4 | Giant Squid | Source | 8 |
5 | Hydrothermal Venture | Source | 158 |
6 | Lanternfish | Source | 1 |
7 | The Treachery of Whales | Source | 8 |
8 | Seven Segment Search | Source | 14 |
9 | Smoke Basin | Source | 64 |
10 | Syntax Scoring | Source | 14 |
11 | Dumbo Octopus | Source | 55 |
12 | Passage Pathing | Source | 25 |
13 | Transparent Origami | Source | 22 |
14 | Extended Polymerization | Source | 11 |
15 | Chiton | Source | 2403 |
16 | Packet Decoder | Source | 6 |
17 | Trick Shot | Source | 7 |
18 | Snailfish | Source | 476 |
19 | Beacon Scanner | Source | 615 |
20 | Trench Map | Source | 511 |
21 | Dirac Dice | Source | 278 |
22 | Reactor Reboot | Source | 378 |
23 | Amphipod | Source | 1714 |
24 | Arithmetic Logic Unit | Source | 4 |
25 | Sea Cucumber | Source | 551 |
Day | Problem | Solution | Benchmark (μs) |
---|---|---|---|
1 | Report Repair | Source | 12 |
2 | Password Philosophy | Source | 35 |
3 | Toboggan Trajectory | Source | 8 |
4 | Passport Processing | Source | 38 |
5 | Binary Boarding | Source | 11 |
6 | Custom Customs | Source | 35 |
7 | Handy Haversacks | Source | 58 |
8 | Handheld Halting | Source | 8 |
9 | Encoding Error | Source | 9 |
10 | Adapter Array | Source | 1 |
11 | Seating System | Source | 831 |
12 | Rain Risk | Source | 12 |
13 | Shuttle Search | Source | 1 |
14 | Docking Data | Source | 83 |
15 | Rambunctious Recitation | Source | 103000 |
16 | Ticket Translation | Source | 120 |
17 | Conway Cubes | Source | 102 |
18 | Operation Order | Source | 24 |
19 | Monster Messages | Source | 362 |
20 | Jurassic Jigsaw | Source | 42 |
21 | Allergen Assessment | Source | 45 |
22 | Crab Combat | Source | 5911 |
23 | Crab Cups | Source | 109000 |
24 | Lobby Layout | Source | 330 |
25 | Combo Breaker | Source | 20 |
Day | Problem | Solution | Benchmark (μs) |
---|---|---|---|
1 | The Tyranny of the Rocket Equation | Source | 1 |
2 | 1202 Program Alarm | Source | 1 |
3 | Crossed Wires | Source | 17 |
4 | Secure Container | Source | 7 |
5 | Sunny with a Chance of Asteroids | Source | 3 |
6 | Universal Orbit Map | Source | 29 |
7 | Amplification Circuit | Source | 79 |
8 | Space Image Format | Source | 4 |
9 | Sensor Boost | Source | 1008 |
10 | Monitoring Station | Source | 404 |
11 | Space Police | Source | 320 |
12 | The N-Body Problem | Source | 838 |
13 | Care Package | Source | 2527 |
14 | Space Stoichiometry | Source | 17 |
15 | Oxygen System | Source | 291 |
16 | Flawed Frequency Transmission | Source | 1956 |
17 | Set and Forget | Source | 338 |
18 | Many-Worlds Interpretation | Source | 1039 |
19 | Tractor Beam | Source | 688 |
20 | Donut Maze | Source | 189 |
21 | Springdroid Adventure | Source | 1785 |
22 | Slam Shuffle | Source | 12 |
23 | Category Six | Source | 670 |
24 | Planet of Discord | Source | 232 |
25 | Cryostasis | Source | 2047 |
Day | Problem | Solution | Benchmark (μs) |
---|---|---|---|
1 | Chronal Calibration | Source | 11 |
2 | Inventory Management System | Source | 59 |
3 | No Matter How You Slice It | Source | 55 |
4 | Repose Record | Source | 46 |
5 | Alchemical Reduction | Source | 390 |
6 | Chronal Coordinates | Source | 41 |
7 | The Sum of Its Parts | Source | 8 |
8 | Memory Maneuver | Source | 24 |
9 | Marble Mania | Source | 909 |
10 | The Stars Align | Source | 11 |
11 | Chronal Charge | Source | 542 |
12 | Subterranean Sustainability | Source | 77 |
13 | Mine Cart Madness | Source | 349 |
14 | Chocolate Charts | Source | 24000 |
15 | Beverage Bandits | Source | 563 |
16 | Chronal Classification | Source | 37 |
17 | Reservoir Research | Source | 151 |
18 | Settlers of The North Pole | Source | 384 |
19 | Go With The Flow | Source | 1 |
20 | A Regular Map | Source | 24 |
21 | Chronal Conversion | Source | 66 |
22 | Mode Maze | Source | 3197 |
23 | Experimental Emergency Teleportation | Source | 506 |
24 | Immune System Simulator 20XX | Source | 1943 |
25 | Four-Dimensional Adventure | Source | 323 |
Day | Problem | Solution | Benchmark (μs) |
---|---|---|---|
1 | Inverse Captcha | Source | 1 |
2 | Corruption Checksum | Source | 2 |
3 | Spiral Memory | Source | 2 |
4 | High-Entropy Passphrases | Source | 86 |
5 | A Maze of Twisty Trampolines, All Alike | Source | 22000 |
6 | Memory Reallocation | Source | 81 |
7 | Recursive Circus | Source | 93 |
8 | I Heard You Like Registers | Source | 47 |
9 | Stream Processing | Source | 23 |
10 | Knot Hash | Source | 66 |
11 | Hex Ed | Source | 15 |
12 | Digital Plumber | Source | 61 |
13 | Packet Scanners | Source | 1 |
14 | Disk Defragmentation | Source | 488 |
15 | Dueling Generators | Source | 20000 |
16 | Permutation Promenade | Source | 68 |
17 | Spinlock | Source | 85 |
18 | Duet | Source | 7 |
19 | A Series of Tubes | Source | 19 |
20 | Particle Swarm | Source | 245 |
21 | Fractal Art | Source | 5 |
22 | Sporifica Virus | Source | 36000 |
23 | Coprocessor Conflagration | Source | 16 |
24 | Electromagnetic Moat | Source | 275 |
25 | The Halting Problem | Source | 3698 |
Day | Problem | Solution | Benchmark (μs) |
---|---|---|---|
1 | No Time for a Taxicab | Source | 3 |
2 | Bathroom Security | Source | 29 |
3 | Squares With Three Sides | Source | 24 |
4 | Security Through Obscurity | Source | 79 |
5 | How About a Nice Game of Chess? | Source | 34000 |
6 | Signals and Noise | Source | 3 |
7 | Internet Protocol Version 7 | Source | 364 |
8 | Two-Factor Authentication | Source | 9 |
9 | Explosives in Cyberspace | Source | 7 |
10 | Balance Bots | Source | 16 |
11 | Radioisotope Thermoelectric Generators | Source | 719 |
12 | Leonardo's Monorail | Source | 1 |
13 | A Maze of Twisty Little Cubicles | Source | 3 |
14 | One-Time Pad | Source | 72000 |
15 | Timing is Everything | Source | 1 |
16 | Dragon Checksum | Source | 1 |
17 | Two Steps Forward | Source | 3606 |
18 | Like a Rogue | Source | 400 |
19 | An Elephant Named Joseph | Source | 1 |
20 | Firewall Rules | Source | 21 |
21 | Scrambled Letters and Hash | Source | 10 |
22 | Grid Computing | Source | 28 |
23 | Safe Cracking | Source | 1 |
24 | Air Duct Spelunking | Source | 316 |
25 | Clock Signal | Source | 1 |
Day | Problem | Solution | Benchmark (μs) |
---|---|---|---|
1 | Not Quite Lisp | Source | 2 |
2 | I Was Told There Would Be No Math | Source | 8 |
3 | Perfectly Spherical Houses in a Vacuum | Source | 95 |
4 | The Ideal Stocking Stuffer | Source | 13000 |
5 | Doesn't He Have Intern-Elves For This? | Source | 38 |
6 | Probably a Fire Hazard | Source | 454 |
7 | Some Assembly Required | Source | 27 |
8 | Matchsticks | Source | 5 |
9 | All in a Single Night | Source | 34 |
10 | Elves Look, Elves Say | Source | 17 |
11 | Corporate Policy | Source | 1 |
12 | JSAbacusFramework.io | Source | 71 |
13 | Knights of the Dinner Table | Source | 37 |
14 | Reindeer Olympics | Source | 24 |
15 | Science for Hungry People | Source | 43 |
16 | Aunt Sue | Source | 20 |
17 | No Such Thing as Too Much | Source | 45 |
18 | Like a GIF For Your Yard | Source | 154 |
19 | Medicine for Rudolph | Source | 23 |
20 | Infinite Elves and Infinite Houses | Source | 368 |
21 | RPG Simulator 20XX | Source | 2 |
22 | Wizard Simulator 20XX | Source | 235 |
23 | Opening the Turing Lock | Source | 6 |
24 | It Hangs in the Balance | Source | 237 |
25 | Let It Snow | Source | 1 |