Solutions for Advent of Code 2024 in Rust.
Day | Part 1 | Part 2 |
---|---|---|
Day 1 | β | β |
Day 2 | β | β |
Day 3 | β | β |
Day 4 | β | β |
Day 5 | β |
Day | Part 1 | Part 2 |
---|---|---|
Day 1 | 317.1Β΅s |
317.9Β΅s |
Day 2 | 114.8Β΅s |
160.5Β΅s |
Day 3 | 233.9Β΅s |
286.0Β΅s |
Day 4 | 2.4ms |
161.3Β΅s |
Day 5 | 1.4ms |
- |
Total: 5.39ms
- Install the Rust toolchain
- Install
aoc-cli
via Cargo:cargo install aoc-cli
- Create the file
<home_directory>/.adventofcode.session
and paste your AoC session cookie into it
# example: `cargo scaffold 1`
cargo scaffold <day>
# output:
# Created module file "src/bin/01.rs"
# Created empty input file "data/inputs/01.txt"
# Created empty example file "data/examples/01.txt"
# ---
# π Type `cargo solve 01` to run your solution.
# example: `cargo download 1`
# alternative: `cargo scaffold 1 --download`
cargo download <day>
# output:
# [INFO aoc] π aoc-cli - Advent of Code command-line tool
# [INFO aoc_client] π
Saved puzzle to 'data/puzzles/01.md'
# [INFO aoc_client] π
Saved input to 'data/inputs/01.txt'
# ---
# π Successfully wrote input to "data/inputs/01.txt".
# π Successfully wrote puzzle to "data/puzzles/01.md".
# example: `cargo solve 01`
# alternative: `cargo solve 01 --release`
cargo solve <day>
# output:
# Finished dev [unoptimized + debuginfo] target(s) in 0.13s
# Running `target/debug/01`
# Part 1: 42 (166.0ns)
# Part 2: 42 (41.0ns)
# example: `cargo solve 01 --submit 1`
cargo solve <day> --submit <part>
# alternative: `cargo all --release`
cargo all
# output:
# Running `target/release/advent_of_code`
# ----------
# | Day 01 |
# ----------
# Part 1: 42 (19.0ns)
# Part 2: 42 (19.0ns)
# <...other days...>
# Total: 0.20ms
# example: `cargo time 8 --store`
cargo time <day> [--all] [--store]
# output:
# Day 08
# ------
# Part 1: 1 (39.0ns @ 10000 samples)
# Part 2: 2 (39.0ns @ 10000 samples)
#
# Total (Run): 0.00ms
#
# Stored updated benchmarks.
# example: `cargo read 1`
cargo read <day>
# output:
# Loaded session cookie from "/Users/<snip>/.adventofcode.session".
# Fetching puzzle for day 1, 2022...
# ...the input...
# example: `cargo today` on December 1st
cargo today
# output:
# Created module file "src/bin/01.rs"
# Created empty input file "data/inputs/01.txt"
# Created empty example file "data/examples/01.txt"
# ---
# π Type `cargo solve 01` to run your solution.
# [INFO aoc] π aoc-cli - Advent of Code command-line tool
# [INFO aoc_client] π
Saved puzzle to 'data/puzzles/01.md'
# [INFO aoc_client] π
Saved input to 'data/inputs/01.txt'
# ---
# π Successfully wrote input to "data/inputs/01.txt".
# π Successfully wrote puzzle to "data/puzzles/01.md".
#
# Loaded session cookie from "/Users/<snip>/.adventofcode.session".
# Fetching puzzle for day 1, 2022...
# ...the input...
cargo test
cargo fmt
cargo clippy
# example: `cargo solve 1 --dhat`
cargo solve <day> --dhat