My Advent of Code 2023 solutions in the Rust programming language.

Overview

Advent of Code 2023 in Rust

My Advent of Code 2023 solutions in the Rust programming language. This repository holds a separate Rust project for each day and part.

I attempt to develop a standalone, elegant, compact and fast solution for each problem (two each day).

Two years ago I did the same, solving everything in under a second:

Timings

Here is how long each solution runs with my input. All solutions are measured (non scientifically) in bench.rs on an AMD Ryzen 9 5900X (24) @ 3.7GHz machine running Linux.

part A part B
day 1 0.016 ms 0.028 ms
day 2 0.011 ms 0.016 ms
day 3 0.019 ms 0.018 ms
day 4 0.017 ms 0.017 ms
day 5 0.015 ms 0.034 ms
day 6 0.001 ms 0.001 ms
day 7 0.065 ms 0.066 ms
day 8 0.028 ms 0.122 ms
day 9 0.042 ms 0.042 ms
day 10 0.048 ms 0.095 ms
day 11 0.012 ms 0.008 ms
one-by-one (1 CPU core) parallel
everything 0.77 ms 0.32 ms

Run solutions

Each Rust project needs a input.txt file to run, holding the puzzle input. Simply create this file with your input and run the project to see the solution appear.

# Switch to day 1a, add input, and run it
cd day01a
nano input.txt
cargo +nightly run --release

# or run everything in parallel
cd ../runner
cargo +nightly run --release --bin runner-par

# or benchmark every day
cd ../runner
cargo +nightly run --release --bin bench

Some solutions require Rust Nightly, that's why +nightly is included.

Sadly I cannot include my puzzle input anymore to make each solution easily runnable as per Advent of Code FAQ:

If you're posting a code repository somewhere, please don't include parts of Advent of Code like the puzzle text or your inputs.

Other years

License

This project is released under the GNU GPL-3.0 license. Check out the LICENSE file for more information.

You might also like...
My solutions for Advent of Code 2021, in Rust

Advent of Code 2021 These are my solutions. I have decided to use Rust for now. I'm new to Rust, so it might be some of the worst Rust code you've see

My solutions for the 2021 edition of the Advent of Code, using Rust and SOM (Simple Object Machine)

Advent of Code 2021 These are my solutions for the 2021 edition of the Advent of Code. The solutions are all implemented using both Rust and SOM (Simp

Solutions to Advent of Code 2021, coded in rust

Advent of Code 2021 (aoc-2021-rust) Solutions to Advent of Code 2021 (https://adventofcode.com/2021), coded as part of my efforts to learn Rust Run co

Advent of Code 2022 Solutions (in Rust)

Advent of Code 2022 My solutions for Advent of Code 2022, written in Rust. This repository provides a good template for anyone interested in writing t

My solutions for Advent of Code 2022, written in Rust

Template largely copied from RikvanToor/aoc-rust-template, upgraded for clap v4. This template can be forked/cloned from beeb/aoc-rust. Usage First, f

  🦀 Rust solutions for Advent of Code 2022
🦀 Rust solutions for Advent of Code 2022

🎄 Advent of Code 2022 Solutions for Advent of Code in Rust. 2022 Results Day Part 1 Part 2 Day 1 ⭐ ⭐ Day 2 ⭐ ⭐ Day 3 ⭐ ⭐ Day 4 ⭐ ⭐ Day 5 ⭐ ⭐ Day 6 ⭐

Solutions to Advent of Code 2022 in Rust  🦀

AdventOfCode2022 🎄 Solutions to AoC 2022 in Rust 🦀 Usage cargo run --release --bin DAY # run a specific day cargo run --release # run all

🎄 My Advent of Code solutions in Rust. http://adventofcode.com/2022

Advent of Code 2022 in Rust My Advent of Code 2022 solutions in the Rust programming language. This repository holds a separate Rust project for each

My Advent of Code 2022 solutions, in Rust.

AoC 2022 My solutions for the 2022 edition of Advent of Code in Rust. Simply run cargo run --release --bin dayXX to solve. Some days require z3, insta

Comments
  • day 4 - did you use map for performance?

    day 4 - did you use map for performance?

    Hi!

    mapping is not necessary:

    -                    .map(|n| &n[1..])
    -                    .filter(|n| win_seq.chunks_exact(3).map(|n| &n[1..]).any(|c| &c == n))
    +                    .filter(|n| win_seq.chunks_exact(3).any(|c| &c == n))
    

    Did you do that for performance?

    Maybe you could enable "Discussion" for this project :smile:

    opened by tivrfoa 1
  • day 5 b - wrong answer for my puzzle input.

    day 5 b - wrong answer for my puzzle input.

    my input I get an output of 100644325, but the expected correct answer should be 37806486.

    Originally posted by @TonyMarsh31 in https://github.com/timvisee/advent-of-code-2023/discussions/4

    opened by TonyMarsh31 0
Owner
Tim Visée
On GitLab: https://gitlab.com/timvisee
Tim Visée
Solutions to Advent of Code 2023 in Rust 🎄

Advent of Code 2023 Solutions to Advent of Code 2023 in Rust ?? Day Part 1 Part 2 Thoughts 1 ⭐ ⭐ As with most early advent of code challenges, it's mo

Pedro Godinho 6 Dec 6, 2023
Solutions to Advent of Code 2023 in Rust! :crab:

AdventOfCode2023 ?? Solutions to AoC 2023 in Rust ?? Usage # to be able to download inputs (see fetch.sh) export AOC_SESSION=[value from session cooki

Axel Lindeberg 27 Dec 17, 2023
🎄Solutions for Advent of Code 2023

?? Advent of Code 2023 Solutions for Advent of Code in Rust. 2023 Results Day Part 1 Part 2 Day 1 ⭐ ⭐ Day 2 ⭐ ⭐ Day 3 ⭐ ⭐ Day 4 ⭐ ⭐ Day 5 ⭐ ⭐ Day 6 ⭐

Felix Spöttel 3 Dec 4, 2023
My solutions for the Advent of Code 2023.

?? Advent Of Code 2023 Hi! These are my Rust solutions for the Advent of Code 2023. Day Name Source Part 1 Part 2 Time 1 Time 2 1 Trebuchet?! 01.rs ⭐

Marcus Cemes 3 Dec 7, 2023
🎄🎅 My Advent of Code 2023 solutions 🎁⛄

???? My AOC 2023 solutions ??⛄ ?? Table of contents ?? Table of the days ?? Goals ⛄ Quickstart ?? Table of the days Day Part 1 Part 2 Language 01 Toki

rei 6 Dec 11, 2023
Advent of Code 2023 solutions - #15 on global leaderboard

My solutions for Advent of Code 2023, written in Rust. The code requires Rust nightly to run. Sample inputs from each day are provided. To run with ac

Daniel Huang 28 Dec 17, 2023
🎄My Advent of Code 2021 solutions in the Rust programming language

Advent of Code 2021 in Rust My Advent of Code 2021 solutions in the Rust programming language. This repository holds a separate Rust project for each

Tim Visée 227 Dec 16, 2022
Advent of Code 2021 puzzles & solutions in Rust

Advent of Code 2021 These are puzzles for the Advent of Code 2021 challenge, written and solved in the Rust programming language. The puzzle for each

Chevy Ray Johnston 8 Dec 19, 2021
My solutions to Advent of Code 2021 (mostly in rust)

Advent of Code 2021 Small code to solve problems at https://adventofcode.com/2021. Most of the code are written in Rust. How to run solutions For exam

“Plane” Abhabongse  Janthong 3 Apr 22, 2022
My solutions for the Advent of Code 2021 in Scala, Python, Haskell and Rust.

Advent of Code 2021 These are my Advent of Code 2021 solutions written in Scala 3, Haskell, Python and Rust. Day Title L1 L2 L3 L4 01 Sonar Sweep Scal

Axel Suárez 2 Oct 14, 2022