1
0
Files
AdventOfCode2025/README.md
T
2026-02-05 09:58:16 +01:00

4.7 KiB

AdventOfCode2025

Solver for Advent of Code 2025 puzzles. https://adventofcode.com/2025/

This is a single command line application for the puzzles written in Rust.

Puzzle Input

This project does not contain the puzzle or example inputs as per the copyright notice of Advent of Code. In order to run the compiled application, the puzzle inputs have to be downloaded from the Advent of Code 2025 puzzle pages, and placed as text files into the AdventOfCode2025\data directory, e.g. AdventOfCode2025\data\secret_entrance.txt, or AdventOfCode2025\data\example\secret_entrance.txt for the unit tests. The application will output an error message with details if it cannot find an input file.

Solutions

Day 1: Secret Entrance

🔎 Puzzle: https://adventofcode.com/2025/day/1, Solver: SecretEntrance

For this one, we are moving around a dial with some not too complicated modulo calculations.

Day 2: Gift Shop

🔎 Puzzle: https://adventofcode.com/2025/day/2, Solver: GiftShop

Firstly, we calculate directly the sum of invalid IDs composed of two identical sequences of digits for part 1. This can easily be generalized for any number of repetitions of sequences. However, the problem is to avoid adding certain invalid IDs to the sum multiple times. Therefore we only check prime numbers of repetitions, and take care that invalid IDs that are composed of a repetition of a single digit are only counted once.

On top of that we use a cache to avoid recalculating prime factors and certain helper variables for given ID lengths and repetition counts.

Day 3: Lobby

🔎 Puzzle: https://adventofcode.com/2025/day/3, Solver: Lobby

With a continuously updated tally of the current best joltage initialized at zero, we go once through each digit string from left to right and try to maximize the digit with the highest posiible significance in our joltage as we go, as long as the less significant digits in the joltage are not more than what remains in the string. If a better digit was encountered, all less significant digits are reset to zero.

Day 4: Printing Department

🔎 Puzzle: https://adventofcode.com/2025/day/4, Solver: PrintingDepartment

For part 1, we create a two-dimensional grid to track location and neighbor counts for each paper roll. Parsing the input data row by row, for each location we only have to check the four neighbors that were not yet encountered, i.e. right in the same row, and the three neighbors in the next row, to handle all pairs of locations. This means that we know whether a location is accessible or not immediately before moving on to the next.

For part 2, the accessible locations are tracked, and removed individually from the grid. After each removal, the neighbor counts of the neighbors are updated. Any of the neighbors that now fall under the threshold are counted as well and added to the removal list.

Day 5: Cafeteria

🔎 Puzzle: https://adventofcode.com/2025/day/5, Solver: Cafeteria

Day 6: Trash Compactor

🔎 Puzzle: https://adventofcode.com/2025/day/6, Solver: TrashCompactor

Day 8: Playground

🔎 Puzzle: https://adventofcode.com/2025/day/8, Solver: Playground

Day 9: Movie Theater

🔎 Puzzle: https://adventofcode.com/2025/day/9, Solver: MovieTheater

Tests

The package contains unit tests for each solver to help troubleshoot issues and prevent regressions. These tests cover the solutions for provided examples and full data inputs. The solutions used within the tests are user-specific.

License

Copyright (C) 2025-2026 Stefan Müller

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.