This repository contains solutions for Advent of Code, written in Rust and organized per year.
A custom CLI tool, aocctl, automates day creation, template selection, input downloading, running, and submissions.
Warning
This repository contains reckless amounts of premature optimizations, (and the not-so optimizations) and consequentially may be occassionally (fine, frequently π) overly verbose than any reasonable human would willingly write. This is not a cry for help. That's just me exploring how far I can push boundaries with Rust.
I do try to implement the algorithms in a simpler form first, but they are in a private repo, so you're just gonna take my word for it. (like the wizard who said "I totally tested this spell")
What youβll find here is the after version, where I poke at Rustβs type system with a stick, try unnecessary abstractions, add micro-optimizations no one asked for, and then refuse to delete any of it just because "it might be useful later." Yep, it's my very own Advent of Fun
crates/aoc[year]/
βββ Cargo.toml
βββ src/
βββ lib.rs # Shared utilities
βββ bin/
βββ d01.rs # Day 1 solution
βββ d02.rs # Day 2 solution
βββ ...Additional generated folders:
inputs/[year]/ # Downloaded puzzle inputs
answers/[year]/ # Submission records curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shcargo install justFind your session token for the AoC. You'll need to visit adventofcode.com. Open the devtools of your browser, then:
- Firefox: "Storage" tab, "Cookies" folder, and copy the "Value" field of the "session" cookie.
- Google Chrome / Chromium: "Application" tab, "Cookies" folder, and copy the "Value" field of the "session" cookie.
Then store the session cookie in any of these locations:
- SESSION variable in .env
- in a .session file in the working dir
- at $HOME/.config/aoc/.session
- env var SESSION on the command line
To have more control and access to more options, you may decide to install the cli tool.
just installThis lets you run the tool directly via its name aocctl instead of prepending cargo run everytime.
just init 2025
# or
aocctl init 2025just new 1
# or with a specific template:
aocctl new 1 --template fastjust solve 1just buildβ Build workspacejust testβ Run all testsjust releaseβ Build optimized binaries
just run-day 1 puzzleβ Run day 1 with puzzle inputjust runβ Run latest dayjust solve 1β Download, run, and optionally submit
just input 1β Download inputjust solve 1β Execute and submitjust open 1β Open problem in browserjust templatesβ List templates
just watch 1β Auto rebuildjust lintβ Clippy + fmt checksjust fmtβ Format code
Templates define the structure of generated day solutions.
| Template | Description |
|---|---|
| minimal | Simple, small, stdin-based |
| buffered | Efficient file/stdin input via BufReader |
| streaming | Iterator-based, no full allocation |
| fast | Zero-copy &str parsing |
List available templates:
aocctl list-templatesExample:
aocctl new 5 --template streamingjust new 7
just input 7
just run-day 7 puzzle
just solve 7Dry-run submission:
aocctl solve 7 --dry-runuse aoc2025::*;
fn solve(input: &str) {
let lines = lines(input);
let nums = parse_numbers(input);
// grid helpers, coordinate math, iter utils, etc.
}echo "<your_cookie>" > .sessionjust input <day>aocctl new <day>Use streaming or fast template:
aocctl new <day> --template fastPRs improving templates, utilities, workflow, or documentation are welcome.
MIT