diff --git a/.assets/banner.png b/.assets/banner.png
new file mode 100644
index 0000000..36ca006
Binary files /dev/null and b/.assets/banner.png differ
diff --git a/.assets/christmas_ferris.png b/.assets/christmas_ferris.png
new file mode 100644
index 0000000..365527a
Binary files /dev/null and b/.assets/christmas_ferris.png differ
diff --git a/.cargo/config.toml b/.cargo/config.toml
new file mode 100644
index 0000000..66b873e
--- /dev/null
+++ b/.cargo/config.toml
@@ -0,0 +1,12 @@
+[alias]
+today = "run --quiet --release --features today -- today"
+scaffold = "run --quiet --release -- scaffold"
+download = "run --quiet --release -- download"
+read = "run --quiet --release -- read"
+
+solve = "run --quiet --release -- solve"
+all = "run --quiet --release -- all"
+time = "run --quiet --release -- time"
+
+[env]
+AOC_YEAR = "2023"
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
new file mode 100644
index 0000000..6043626
--- /dev/null
+++ b/.devcontainer/devcontainer.json
@@ -0,0 +1,6 @@
+{
+ "name": "rust-devcontainer",
+ "image": "mcr.microsoft.com/devcontainers/rust:latest",
+ "postCreateCommand": "rustc --version",
+ "remoteUser": "vscode"
+}
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..560e94b
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,17 @@
+# EditorConfig is awesome: http://EditorConfig.org
+root = true
+
+[*]
+indent_size = 4
+indent_style = space
+end_of_line = lf
+charset = utf-8
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[*.txt]
+insert_final_newline = false
+trim_trailing_whitespace = false
+
+[*.md]
+trim_trailing_whitespace = false
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..9eef218
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,33 @@
+name: Continuous Integration
+
+on: push
+
+env:
+ CARGO_TERM_COLOR: always
+
+jobs:
+ test:
+ runs-on: ubuntu-latest
+ name: CI
+ steps:
+ - uses: actions/checkout@v3
+ - name: Set up cargo cache
+ uses: actions/cache@v3
+ continue-on-error: false
+ with:
+ path: |
+ ~/.cargo/bin/
+ ~/.cargo/registry/index/
+ ~/.cargo/registry/cache/
+ ~/.cargo/git/db/
+ target/
+ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
+ restore-keys: ${{ runner.os }}-cargo-
+ - name: cargo test
+ run: cargo test
+ # uncomment to enable clippy linter
+ # - name: cargo clippy
+ # run: cargo clippy -- -D warnings
+ # uncomment to enable format linter
+ # - name: cargo fmt
+ # run: cargo fmt --check
diff --git a/.github/workflows/readme-stars.yml b/.github/workflows/readme-stars.yml
new file mode 100644
index 0000000..3de260e
--- /dev/null
+++ b/.github/workflows/readme-stars.yml
@@ -0,0 +1,24 @@
+name: Update readme βοΈ progress
+
+on:
+ # !Please set a different minute than 51 if you enable this!
+ # schedule:
+ # - cron: "51 */6 * * *" # Every 6 hours
+ workflow_dispatch:
+
+jobs:
+ update-readme:
+ runs-on: ubuntu-latest
+ if: ${{ vars.AOC_ENABLED == 'true' }}
+ permissions:
+ contents: write
+ steps:
+ - uses: actions/checkout@v4
+ - uses: k2bd/advent-readme-stars@v1
+ with:
+ userId: ${{ secrets.AOC_USER_ID }}
+ sessionCookie: ${{ secrets.AOC_SESSION }}
+ year: ${{ secrets.AOC_YEAR }}
+ - uses: stefanzweifel/git-auto-commit-action@v5
+ with:
+ commit_message: "update readme progress"
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..216820d
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,30 @@
+# Generated by Cargo
+# will have compiled files and executables
+debug/
+target/
+
+# These are backup files generated by rustfmt
+**/*.rs.bk
+
+# MSVC Windows builds of rustc generate these, which store debugging information
+*.pdb
+
+
+# Added by cargo
+
+/target
+
+# Advent of Code
+# @see https://old.reddit.com/r/adventofcode/comments/k99rod/sharing_input_data_were_we_requested_not_to/gf2ukkf/?context=3
+
+data/inputs/*
+!data/inputs/.keep
+data/puzzles/*
+!data/puzzles/.keep
+
+# Dhat
+dhat-heap.json
+
+# Benchmarks
+
+data/timings.json
diff --git a/.vscode/extensions.json b/.vscode/extensions.json
new file mode 100644
index 0000000..4ce7b67
--- /dev/null
+++ b/.vscode/extensions.json
@@ -0,0 +1,8 @@
+{
+ "recommendations": [
+ "vadimcn.vscode-lldb",
+ "rust-lang.rust-analyzer",
+ "serayuzgur.crates",
+ "editorConfig.editorConfig"
+ ]
+}
diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 0000000..8f244cf
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,58 @@
+{
+ // Use IntelliSense to learn about possible attributes.
+ // Hover to view descriptions of existing attributes.
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "type": "lldb",
+ "request": "launch",
+ "name": "Debug unit tests for a solution",
+ "cargo": {
+ "args": [
+ "test",
+ "--no-run",
+ // replace `01` here with the solution you like to debug.
+ "--bin=01",
+ "--package=advent_of_code"
+ ],
+ },
+ "args": [],
+ "cwd": "${workspaceFolder}"
+ },
+ {
+ "type": "lldb",
+ "request": "launch",
+ "name": "Debug a solution",
+ "cargo": {
+ "args": [
+ "build",
+ // replace `01` here with the solution you like to debug.
+ "--bin=01",
+ "--package=advent_of_code"
+ ],
+ },
+ "cwd": "${workspaceFolder}"
+ },
+ {
+ "type": "lldb",
+ "request": "launch",
+ "name": "Debug unit tests in library 'advent_of_code'",
+ "cargo": {
+ "args": [
+ "test",
+ "--no-run",
+ "--lib",
+ "--features=test_lib",
+ "--package=advent_of_code"
+ ],
+ "filter": {
+ "name": "advent_of_code",
+ "kind": "lib"
+ }
+ },
+ "args": [],
+ "cwd": "${workspaceFolder}"
+ }
+ ]
+}
diff --git a/Cargo.lock b/Cargo.lock
new file mode 100644
index 0000000..1ae9464
--- /dev/null
+++ b/Cargo.lock
@@ -0,0 +1,524 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "addr2line"
+version = "0.21.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb"
+dependencies = [
+ "gimli",
+]
+
+[[package]]
+name = "adler"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
+
+[[package]]
+name = "advent_of_code"
+version = "0.11.0"
+dependencies = [
+ "chrono",
+ "dhat",
+ "pico-args",
+ "tinyjson",
+]
+
+[[package]]
+name = "android-tzdata"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0"
+
+[[package]]
+name = "android_system_properties"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "autocfg"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
+
+[[package]]
+name = "backtrace"
+version = "0.3.69"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837"
+dependencies = [
+ "addr2line",
+ "cc",
+ "cfg-if",
+ "libc",
+ "miniz_oxide",
+ "object",
+ "rustc-demangle",
+]
+
+[[package]]
+name = "bitflags"
+version = "1.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
+
+[[package]]
+name = "bumpalo"
+version = "3.14.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec"
+
+[[package]]
+name = "cc"
+version = "1.0.83"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "cfg-if"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+
+[[package]]
+name = "chrono"
+version = "0.4.31"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38"
+dependencies = [
+ "android-tzdata",
+ "iana-time-zone",
+ "js-sys",
+ "num-traits",
+ "wasm-bindgen",
+ "windows-targets",
+]
+
+[[package]]
+name = "core-foundation-sys"
+version = "0.8.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f"
+
+[[package]]
+name = "dhat"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4f2aaf837aaf456f6706cb46386ba8dffd4013a757e36f4ea05c20dd46b209a3"
+dependencies = [
+ "backtrace",
+ "lazy_static",
+ "mintex",
+ "parking_lot",
+ "rustc-hash",
+ "serde",
+ "serde_json",
+ "thousands",
+]
+
+[[package]]
+name = "gimli"
+version = "0.28.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253"
+
+[[package]]
+name = "iana-time-zone"
+version = "0.1.58"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20"
+dependencies = [
+ "android_system_properties",
+ "core-foundation-sys",
+ "iana-time-zone-haiku",
+ "js-sys",
+ "wasm-bindgen",
+ "windows-core",
+]
+
+[[package]]
+name = "iana-time-zone-haiku"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
+dependencies = [
+ "cc",
+]
+
+[[package]]
+name = "itoa"
+version = "1.0.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
+
+[[package]]
+name = "js-sys"
+version = "0.3.66"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca"
+dependencies = [
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "lazy_static"
+version = "1.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
+
+[[package]]
+name = "libc"
+version = "0.2.150"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c"
+
+[[package]]
+name = "lock_api"
+version = "0.4.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45"
+dependencies = [
+ "autocfg",
+ "scopeguard",
+]
+
+[[package]]
+name = "log"
+version = "0.4.20"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
+
+[[package]]
+name = "memchr"
+version = "2.6.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167"
+
+[[package]]
+name = "miniz_oxide"
+version = "0.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7"
+dependencies = [
+ "adler",
+]
+
+[[package]]
+name = "mintex"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fd7c5ba1c3b5a23418d7bbf98c71c3d4946a0125002129231da8d6b723d559cb"
+dependencies = [
+ "once_cell",
+ "sys-info",
+]
+
+[[package]]
+name = "num-traits"
+version = "0.2.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c"
+dependencies = [
+ "autocfg",
+]
+
+[[package]]
+name = "object"
+version = "0.32.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "once_cell"
+version = "1.19.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
+
+[[package]]
+name = "parking_lot"
+version = "0.12.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
+dependencies = [
+ "lock_api",
+ "parking_lot_core",
+]
+
+[[package]]
+name = "parking_lot_core"
+version = "0.9.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e"
+dependencies = [
+ "cfg-if",
+ "libc",
+ "redox_syscall",
+ "smallvec",
+ "windows-targets",
+]
+
+[[package]]
+name = "pico-args"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315"
+
+[[package]]
+name = "proc-macro2"
+version = "1.0.70"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b"
+dependencies = [
+ "unicode-ident",
+]
+
+[[package]]
+name = "quote"
+version = "1.0.33"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
+dependencies = [
+ "proc-macro2",
+]
+
+[[package]]
+name = "redox_syscall"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa"
+dependencies = [
+ "bitflags",
+]
+
+[[package]]
+name = "rustc-demangle"
+version = "0.1.23"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76"
+
+[[package]]
+name = "rustc-hash"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
+
+[[package]]
+name = "ryu"
+version = "1.0.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741"
+
+[[package]]
+name = "scopeguard"
+version = "1.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
+
+[[package]]
+name = "serde"
+version = "1.0.193"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89"
+dependencies = [
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_derive"
+version = "1.0.193"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "serde_json"
+version = "1.0.108"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b"
+dependencies = [
+ "itoa",
+ "ryu",
+ "serde",
+]
+
+[[package]]
+name = "smallvec"
+version = "1.11.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970"
+
+[[package]]
+name = "syn"
+version = "2.0.39"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
+name = "sys-info"
+version = "0.9.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b3a0d0aba8bf96a0e1ddfdc352fc53b3df7f39318c71854910c3c4b024ae52c"
+dependencies = [
+ "cc",
+ "libc",
+]
+
+[[package]]
+name = "thousands"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3bf63baf9f5039dadc247375c29eb13706706cfde997d0330d05aa63a77d8820"
+
+[[package]]
+name = "tinyjson"
+version = "2.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9ab95735ea2c8fd51154d01e39cf13912a78071c2d89abc49a7ef102a7dd725a"
+
+[[package]]
+name = "unicode-ident"
+version = "1.0.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
+
+[[package]]
+name = "wasm-bindgen"
+version = "0.2.89"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e"
+dependencies = [
+ "cfg-if",
+ "wasm-bindgen-macro",
+]
+
+[[package]]
+name = "wasm-bindgen-backend"
+version = "0.2.89"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826"
+dependencies = [
+ "bumpalo",
+ "log",
+ "once_cell",
+ "proc-macro2",
+ "quote",
+ "syn",
+ "wasm-bindgen-shared",
+]
+
+[[package]]
+name = "wasm-bindgen-macro"
+version = "0.2.89"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2"
+dependencies = [
+ "quote",
+ "wasm-bindgen-macro-support",
+]
+
+[[package]]
+name = "wasm-bindgen-macro-support"
+version = "0.2.89"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+ "wasm-bindgen-backend",
+ "wasm-bindgen-shared",
+]
+
+[[package]]
+name = "wasm-bindgen-shared"
+version = "0.2.89"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f"
+
+[[package]]
+name = "windows-core"
+version = "0.51.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64"
+dependencies = [
+ "windows-targets",
+]
+
+[[package]]
+name = "windows-targets"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
+dependencies = [
+ "windows_aarch64_gnullvm",
+ "windows_aarch64_msvc",
+ "windows_i686_gnu",
+ "windows_i686_msvc",
+ "windows_x86_64_gnu",
+ "windows_x86_64_gnullvm",
+ "windows_x86_64_msvc",
+]
+
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
+
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
+
+[[package]]
+name = "windows_i686_gnu"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
+
+[[package]]
+name = "windows_i686_msvc"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
+
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
+
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
+
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
diff --git a/Cargo.toml b/Cargo.toml
new file mode 100644
index 0000000..3396495
--- /dev/null
+++ b/Cargo.toml
@@ -0,0 +1,30 @@
+[package]
+name = "advent_of_code"
+version = "0.11.0"
+authors = ["Felix SpΓΆttel <1682504+fspoettel@users.noreply.github.com>"]
+edition = "2021"
+default-run = "advent_of_code"
+publish = false
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+[lib]
+doctest = false
+
+[profile.dhat]
+inherits = "release"
+debug = 1
+
+[features]
+dhat-heap = ["dhat"]
+today = ["chrono"]
+test_lib = []
+
+[dependencies]
+
+# Template dependencies
+chrono = { version = "0.4.31", optional = true }
+dhat = { version = "0.3.2", optional = true }
+pico-args = "0.5.0"
+tinyjson = "2.5.1"
+
+# Solution dependencies
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..b97fd05
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2021 Felix Spoettel
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..a155efa
--- /dev/null
+++ b/README.md
@@ -0,0 +1,304 @@
+
+
+# π Advent of Code {year}
+
+Solutions for [Advent of Code](https://adventofcode.com/) in [Rust](https://www.rust-lang.org/).
+
+
+
+
+
+---
+
+## Template setup
+
+This template supports all major OS (macOS, Linux, Windows).
+
+### π Create your repository
+
+1. Open [the template repository](https://github.com/fspoettel/advent-of-code-rust) on Github.
+2. Click [Use this template](https://github.com/fspoettel/advent-of-code-rust/generate) and create your repository.
+3. Clone your repository to your computer.
+4. If you are solving a previous year's advent of code, change the `AOC_YEAR` variable in `.cargo/config.toml` to reflect the year you are solving.
+
+### π» Setup rust
+
+1. Install the [Rust toolchain](https://www.rust-lang.org/tools/install).
+2. (recommended) Install the [rust-analyzer](https://rust-analyzer.github.io/manual.html) extension for your code editor.
+3. (optional) Install a native debugger. If you are using VS Code, [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb) is a good option.
+
+---
+
+β¨ You can start solving puzzles now! Head to the [Usage section](#usage) to see how to use this template. If you like, you can configure [some optional features](#optional-template-features).
+
+## Usage
+
+### β‘οΈ Scaffold a day
+
+```sh
+# example: `cargo scaffold 1`
+cargo scaffold
+
+# 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.
+```
+
+Individual solutions live in the `./src/bin/` directory as separate binaries. _Inputs_ and _examples_ live in the the `./data` directory.
+
+Every [solution](https://github.com/fspoettel/advent-of-code-rust/blob/main/src/template.txt) has _tests_ referencing its _example_ file in `./data/examples`. Use these tests to develop and debug your solutions against the example input. In VS Code, `rust-analyzer` will display buttons for running / debugging these unit tests above the unit test blocks.
+
+> [!TIP]
+> If a day has multiple example inputs, you can use the `read_file_part()` helper in your tests instead of `read_file()`. If this e.g. applies to day 1, you can create a second example file `01-2.txt` and invoke the helper like `let result = part_two(&advent_of_code::template::read_file_part("examples", DAY, 2));`. This supports an arbitrary number of example files.
+
+### β‘οΈ Download input for a day
+
+> [!IMPORTANT]
+> This requires [installing the aoc-cli crate](#configure-aoc-cli-integration).
+
+You can automatically download puzzle input and description by either appending the `--download` flag to `scaffold` (e.g. `cargo scaffold 4 --download`) or with the separate `download` command:
+
+```sh
+# example: `cargo download 1`
+cargo download
+
+# 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".
+```
+
+### β‘οΈ Run solutions for a day
+
+```sh
+# example: `cargo solve 01`
+cargo solve
+
+# output:
+# Finished dev [unoptimized + debuginfo] target(s) in 0.13s
+# Running `target/debug/01`
+# Part 1: 42 (166.0ns)
+# Part 2: 42 (41.0ns)
+```
+
+The `solve` command runs your solution against real puzzle inputs. To run an optimized build of your code, append the `--release` flag as with any other rust program.
+
+#### Submitting solutions
+
+> [!IMPORTANT]
+> This requires [installing the aoc-cli crate](#configure-aoc-cli-integration).
+
+Append the `--submit ` option to the `solve` command to submit your solution for checking.
+
+### β‘οΈ Run all solutions
+
+```sh
+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
+```
+
+This runs all solutions sequentially and prints output to the command-line. Same as for the `solve` command, the `--release` flag runs an optimized build.
+
+### β‘οΈ Benchmark your solutions
+
+```sh
+# example: `cargo time 8 --store`
+cargo time [--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.
+```
+
+The `cargo time` command allows you to benchmark your code and store timings in the readme. When benching, the runner will run your code between `10` and `10.000` times, depending on execution time of first execution, and print the average execution time.
+
+`cargo time` has three modes of execution:
+
+ 1. `cargo time` without arguments incrementally benches solutions that do not have been stored in the readme yet and skips the rest.
+ 2. `cargo time ` benches a single solution.
+ 3. `cargo time --all` benches all solutions.
+
+By default, `cargo time` does not write to the readme. In order to do so, append the `--store` flag: `cargo time --store`.
+
+> Please note that these are not _scientific_ benchmarks, understand them as a fun approximation. π Timings, especially in the microseconds range, might change a bit between invocations.
+
+### β‘οΈ Run all tests
+
+```sh
+cargo test
+```
+
+To run tests for a specific day, append `--bin `, e.g. `cargo test --bin 01`. You can further scope it down to a specific part, e.g. `cargo test --bin 01 part_one`.
+
+### β‘οΈ Read puzzle description
+
+> [!IMPORTANT]
+> This command requires [installing the aoc-cli crate](#configure-aoc-cli-integration).
+
+```sh
+# example: `cargo read 1`
+cargo read
+
+# output:
+# Loaded session cookie from "/Users//.adventofcode.session".
+# Fetching puzzle for day 1, 2022...
+# ...the input...
+```
+
+### β‘οΈ Scaffold, download & read the current aoc day
+
+> [!IMPORTANT]
+> This command requires [installing the aoc-cli crate](#configure-aoc-cli-integration).
+
+During december, the `today` shorthand command can be used to:
+
+ - scaffold a solution for the current day
+ - download its input
+ - and read the puzzle
+
+in one go.
+
+```sh
+# 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//.adventofcode.session".
+# Fetching puzzle for day 1, 2022...
+# ...the input...
+```
+
+### β‘οΈ Format code
+
+```sh
+cargo fmt
+```
+
+### β‘οΈ Lint code
+
+```sh
+cargo clippy
+```
+
+## Optional template features
+
+### Configure aoc-cli integration
+
+1. Install [`aoc-cli`](https://github.com/scarvalhojr/aoc-cli/) via cargo: `cargo install aoc-cli --version 0.12.0`
+2. Create the file `/.adventofcode.session` and paste your session cookie into it. To retrieve the session cookie, press F12 anywhere on the Advent of Code website to open your browser developer tools. Look in _Cookies_ under the _Application_ or _Storage_ tab, and copy out the `session` cookie value. [^1]
+
+Once installed, you can use the [download command](#download-input--description-for-a-day), the read command, and automatically submit solutions via the [`--submit` flag](#submitting-solutions).
+
+### Automatically track βοΈ progress in the readme
+
+This template includes [a Github action](https://github.com/k2bd/advent-readme-stars) that automatically updates the readme with your advent of code progress.
+
+To enable it, complete the following steps:
+
+#### 1. Create a private leaderboard
+
+Go to the leaderboard page of the year you want to track and click _Private Leaderboard_. If you have not created a leaderboard yet, create one by clicking _Create It_. Your leaderboard should be accessible under `https://adventofcode.com/{year}/leaderboard/private/view/{aoc_user_id}`.
+
+#### 2. Set repository secrets
+
+Go to the _Secrets_ tab in your repository settings and create the following secrets:
+
+- `AOC_USER_ID`: Go to [this page](https://adventofcode.com/settings) and copy your user id. It's the number behind the `#` symbol in the first name option. Example: `3031`.
+- `AOC_YEAR`: the year you want to track. Example: `2021`.
+- `AOC_SESSION`: an active session[^2] for the advent of code website. To get this, press F12 anywhere on the Advent of Code website to open your browser developer tools. Look in your Cookies under the Application or Storage tab, and copy out the `session` cookie.
+
+Go to the _Variables_ tab in your repository settings and create the following variable:
+
+- `AOC_ENABLED`: This variable controls whether the workflow is enabled. Set it to `true` to enable the progress tracker. After you complete AoC or no longer work on it, you can set this to `false` to disable the CI.
+
+β¨ You can now run this action manually via the _Run workflow_ button on the workflow page. If you want the workflow to run automatically, uncomment the `schedule` section in the `readme-stars.yml` workflow file or add a `push` trigger.
+
+### Enable code formatting / clippy checks in the CI
+
+Uncomment the respective sections in the `ci.yml` workflow.
+
+### Use DHAT to profile heap allocations
+
+If you are not only interested in the runtime of your solution, but also its memory allocation profile, you can use the template's [DHAT](https://valgrind.org/docs/manual/dh-manual.html) integration to analyze it. In order to activate DHAT, call the `solve` command with the `--dhat` flag.
+
+```sh
+cargo solve 1 --dhat
+
+# output:
+# Running `target/dhat/1`
+# dhat: Total: 276 bytes in 3 blocks
+# dhat: At t-gmax: 232 bytes in 2 blocks
+# dhat: At t-end: 0 bytes in 0 blocks
+# dhat: The data has been saved to dhat-heap.json, and is viewable with dhat/dh_view.html
+# Part 1: 9001 (4.1ms)
+```
+
+The command will output some basic stats to the command-line and generate a `dhat-heap.json` report in the repo root directory.
+
+You can pass the report a tool like [dh-view](https://nnethercote.github.io/dh_view/dh_view.html) to view a detailed breakdown of heap allocations.
+
+### Use VS Code to debug your code
+
+1. Install [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer) and [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb).
+2. Set breakpoints in your code. [^3]
+3. Click _Debug_ next to the unit test or the _main_ function. [^4]
+4. The debugger will halt your program at the specific line and allow you to inspect the local stack. [^5]
+
+## Useful crates
+
+- [itertools](https://crates.io/crates/itertools): Extends iterators with extra methods and adaptors. Frequently useful for aoc puzzles.
+- [regex](https://crates.io/crates/regex): Official regular expressions implementation for Rust.
+
+A curated list of popular crates can be found on [blessred.rs](https://blessed.rs/crates).
+
+Do you have aoc-specific crate recommendations? [Share them!](https://github.com/fspoettel/advent-of-code-rust/edit/main/README.md)
+
+## Common pitfalls
+
+- **Integer overflows:** This template uses 32-bit integers by default because it is generally faster - for example when packed in large arrays or structs - than using 64-bit integers everywhere. For some problems, solutions for real input might exceed 32-bit integer space. While this is checked and panics in `debug` mode, integers [wrap](https://doc.rust-lang.org/book/ch03-02-data-types.html#integer-overflow) in `release` mode, leading to wrong output when running your solution.
+
+## Footnotes
+
+[^1]: The session cookie might expire after a while (~1 month) which causes the downloads to fail. To fix this issue, refresh the `.adventofcode.session` file.
+[^2]: The session cookie might expire after a while (~1 month) which causes the automated workflow to fail. To fix this issue, refresh the AOC_SESSION secret.
+[^3]:
+
+
+[^4]:
+
+
+[^5]:
+
diff --git a/data/examples/.keep b/data/examples/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/data/inputs/.keep b/data/inputs/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/data/puzzles/.keep b/data/puzzles/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/src/bin/.keep b/src/bin/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/src/lib.rs b/src/lib.rs
new file mode 100644
index 0000000..27d7df8
--- /dev/null
+++ b/src/lib.rs
@@ -0,0 +1,3 @@
+pub mod template;
+
+// Use this file to add helper functions and additional modules.
diff --git a/src/main.rs b/src/main.rs
new file mode 100644
index 0000000..9322423
--- /dev/null
+++ b/src/main.rs
@@ -0,0 +1,138 @@
+use advent_of_code::template::commands::{all, download, read, scaffold, solve, time};
+use args::{parse, AppArguments};
+
+#[cfg(feature = "today")]
+use advent_of_code::template::Day;
+#[cfg(feature = "today")]
+use std::process;
+
+mod args {
+ use advent_of_code::template::Day;
+ use std::process;
+
+ pub enum AppArguments {
+ Download {
+ day: Day,
+ },
+ Read {
+ day: Day,
+ },
+ Scaffold {
+ day: Day,
+ download: bool,
+ },
+ Solve {
+ day: Day,
+ release: bool,
+ dhat: bool,
+ submit: Option,
+ },
+ All {
+ release: bool,
+ },
+ Time {
+ all: bool,
+ day: Option,
+ store: bool,
+ },
+ #[cfg(feature = "today")]
+ Today,
+ }
+
+ pub fn parse() -> Result> {
+ let mut args = pico_args::Arguments::from_env();
+
+ let app_args = match args.subcommand()?.as_deref() {
+ Some("all") => AppArguments::All {
+ release: args.contains("--release"),
+ },
+ Some("time") => {
+ let all = args.contains("--all");
+ let store = args.contains("--store");
+
+ AppArguments::Time {
+ all,
+ day: args.opt_free_from_str()?,
+ store,
+ }
+ }
+ Some("download") => AppArguments::Download {
+ day: args.free_from_str()?,
+ },
+ Some("read") => AppArguments::Read {
+ day: args.free_from_str()?,
+ },
+ Some("scaffold") => AppArguments::Scaffold {
+ day: args.free_from_str()?,
+ download: args.contains("--download"),
+ },
+ Some("solve") => AppArguments::Solve {
+ day: args.free_from_str()?,
+ release: args.contains("--release"),
+ submit: args.opt_value_from_str("--submit")?,
+ dhat: args.contains("--dhat"),
+ },
+ #[cfg(feature = "today")]
+ Some("today") => AppArguments::Today,
+ Some(x) => {
+ eprintln!("Unknown command: {x}");
+ process::exit(1);
+ }
+ None => {
+ eprintln!("No command specified.");
+ process::exit(1);
+ }
+ };
+
+ let remaining = args.finish();
+ if !remaining.is_empty() {
+ eprintln!("Warning: unknown argument(s): {remaining:?}.");
+ }
+
+ Ok(app_args)
+ }
+}
+
+fn main() {
+ match parse() {
+ Err(err) => {
+ eprintln!("Error: {err}");
+ std::process::exit(1);
+ }
+ Ok(args) => match args {
+ AppArguments::All { release } => all::handle(release),
+ AppArguments::Time { day, all, store } => time::handle(day, all, store),
+ AppArguments::Download { day } => download::handle(day),
+ AppArguments::Read { day } => read::handle(day),
+ AppArguments::Scaffold { day, download } => {
+ scaffold::handle(day);
+ if download {
+ download::handle(day);
+ }
+ }
+ AppArguments::Solve {
+ day,
+ release,
+ dhat,
+ submit,
+ } => solve::handle(day, release, dhat, submit),
+ #[cfg(feature = "today")]
+ AppArguments::Today => {
+ match Day::today() {
+ Some(day) => {
+ scaffold::handle(day);
+ download::handle(day);
+ read::handle(day)
+ }
+ None => {
+ eprintln!(
+ "`today` command can only be run between the 1st and \
+ the 25th of december. Please use `scaffold` with a specific day."
+ );
+ process::exit(1)
+ }
+ };
+ }
+ },
+ };
+}
diff --git a/src/template.txt b/src/template.txt
new file mode 100644
index 0000000..11344df
--- /dev/null
+++ b/src/template.txt
@@ -0,0 +1,26 @@
+advent_of_code::solution!(%DAY_NUMBER%);
+
+pub fn part_one(input: &str) -> Option {
+ None
+}
+
+pub fn part_two(input: &str) -> Option {
+ None
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn test_part_one() {
+ let result = part_one(&advent_of_code::template::read_file("examples", DAY));
+ assert_eq!(result, None);
+ }
+
+ #[test]
+ fn test_part_two() {
+ let result = part_two(&advent_of_code::template::read_file("examples", DAY));
+ assert_eq!(result, None);
+ }
+}
diff --git a/src/template/aoc_cli.rs b/src/template/aoc_cli.rs
new file mode 100644
index 0000000..2d3300d
--- /dev/null
+++ b/src/template/aoc_cli.rs
@@ -0,0 +1,125 @@
+/// Wrapper module around the "aoc-cli" command-line.
+use std::{
+ fmt::Display,
+ process::{Command, Output, Stdio},
+};
+
+use crate::template::Day;
+
+#[derive(Debug)]
+pub enum AocCommandError {
+ CommandNotFound,
+ CommandNotCallable,
+ BadExitStatus(Output),
+}
+
+impl Display for AocCommandError {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ match self {
+ AocCommandError::CommandNotFound => write!(f, "aoc-cli is not present in environment."),
+ AocCommandError::CommandNotCallable => write!(f, "aoc-cli could not be called."),
+ AocCommandError::BadExitStatus(_) => {
+ write!(f, "aoc-cli exited with a non-zero status.")
+ }
+ }
+ }
+}
+
+pub fn check() -> Result<(), AocCommandError> {
+ Command::new("aoc")
+ .arg("-V")
+ .output()
+ .map_err(|_| AocCommandError::CommandNotFound)?;
+ Ok(())
+}
+
+pub fn read(day: Day) -> Result