This repository contains my personal solutions for Advent of Code, implemented in C++ and Rust. It is designed as a scalable engine to manage multiple years of puzzles with automated setup and downloading.
The project is structured as a monorepo. Root-level scripts manage generation and downloading, while year-specific folders contain the code.
advent-of-code/
├── .env # Session cookie (IGNORED by Git)
├── get_input.sh # Script to download Inputs & Puzzles
├── new_day.sh # Script to generate boilerplate code & download
├── README.md
├── aoc-2025/ # Year 2025
│ ├── input/ # Puzzle inputs (IGNORED by Git)
│ ├── puzzles/ # Puzzle descriptions (IGNORED by Git)
│ ├── cpp/ # C++ Project (CMake)
│ └── rust/ # Rust Project (Cargo)
└── aoc-2024/ # Year 2024 (Created automatically)
└── ...
This repository includes scripts to automate the boring stuff.
To download inputs automatically, you need your Advent of Code session cookie.
- Log in to Advent of Code.
- Open Browser DevTools (F12) -> Application -> Cookies.
- Copy the value of the
sessioncookie. - Create a file named
.envin the root directory:SESSION=53616c74...your_cookie_here...
Use the generator script to create files for C++ and Rust, update build configurations, and download the input/puzzle text in one go.
# Make scripts executable (first time only)
chmod +x new_day.sh get_input.sh
# Download today's puzzle (Defaults to 2025) and create a structure for running programs in C++ and Rust
./new_day.sh 1
# Downlaod a specific year and day
./new_day.sh 2024 2If you only need to fetch the data without generating code:
# Download Day 5 for 2025
./get_input.sh 5
# Download Day 5 for 2024
./get_input.sh 2024 5- Rust Toolchain: Install via rustup.rs.
Rust solutions are located in aoc-YYYY/rust/src/bin/. Each day is a separate binary.
-
Navigate to the specific year:
cd aoc-2025/rust -
Run a solution:
# Run Day 1 (Uses default input: ../input/day01.txt) cargo run --bin day01 # Run with a custom input file cargo run --bin day01 ../input/test.txt
- C++ Compiler: GCC, Clang, or MSVC (Must support C++20).
- CMake: Version 3.10 or higher.
C++ solutions use CMake for building.
-
Navigate to the specific year:
cd aoc-2025/cpp -
Build the project (only needed once or when adding new days):
mkdir -p build cd build cmake .. make -
Run a solution: Note: Run from the
cpproot folder so relative paths work.# Go back to the cpp source root cd .. # Run Day 1 ./build/day01 # Run with custom input ./build/day01 ../input/test.txt
This repository is for educational purposes.
- Puzzle Inputs: Not included in the repository.
- Puzzle Text: Not republished in the repository.
(These inputs can be directly downloaded to your local repositories using the shell scripts mentioned above or visit the official website directly.)
Please visit Advent of Code to support the creator, Eric Wastl.