Compare commits

...

54 Commits

Author SHA1 Message Date
1378857995 Added image of completion
All checks were successful
Continuous integration / Check (push) Successful in 54s
Continuous integration / Test Suite (push) Successful in 59s
Continuous integration / Rustfmt (push) Successful in 37s
Continuous integration / build (push) Successful in 56s
2025-03-12 15:20:08 +00:00
2cb37f6cfe Removed uneeded nightly test
All checks were successful
Continuous integration / Check (push) Successful in 49s
Continuous integration / Test Suite (push) Successful in 56s
Continuous integration / Rustfmt (push) Successful in 36s
Continuous integration / build (push) Successful in 55s
2025-02-20 19:31:00 +00:00
dc40bbbc24 Created nightly tests
Some checks failed
Continuous integration / Check (push) Successful in 53s
Continuous integration / Test Suite (push) Successful in 59s
Continuous integration / Rustfmt (push) Successful in 38s
Continuous integration / build (push) Successful in 59s
/ Check (push) Successful in 51s
/ Test Suite (push) Successful in 56s
/ Rustfmt (push) Successful in 35s
/ Clippy (push) Failing after 52s
/ build (push) Successful in 55s
2024-11-20 22:59:23 +00:00
5146230f1f Completely changed pipeline
All checks were successful
Continuous integration / Check (push) Successful in 54s
Continuous integration / Test Suite (push) Successful in 59s
Continuous integration / Rustfmt (push) Successful in 38s
Continuous integration / build (push) Successful in 58s
2024-11-20 20:16:20 +00:00
33a50cc85f Updated dependencies + pipelines
Some checks failed
Continuous integration / Rustfmt (push) Waiting to run
Continuous integration / build (push) Waiting to run
Continuous integration / Check (push) Successful in 52s
Continuous integration / Test Suite (push) Has been cancelled
2024-11-20 20:13:28 +00:00
0ba3fcd8de Added Nightly Build
Some checks failed
Continuous integration / Check (push) Successful in 10m5s
Continuous integration / Test Suite (push) Successful in 10m14s
Continuous integration / Rustfmt (push) Successful in 9m54s
Continuous integration / build (push) Successful in 10m14s
/ Check (push) Successful in 10m15s
/ Test Suite (push) Successful in 10m22s
/ Rustfmt (push) Successful in 9m57s
/ Clippy (push) Failing after 10m14s
/ build (push) Successful in 10m22s
2024-10-07 09:34:05 +01:00
42664687a1 Fixed rustfmt warnings
Some checks failed
Continuous integration / Check (push) Successful in 10m8s
Continuous integration / Test Suite (push) Successful in 10m14s
Continuous integration / Rustfmt (push) Successful in 9m54s
Continuous integration / Clippy (push) Failing after 10m10s
Continuous integration / build (push) Successful in 10m14s
2024-10-05 15:06:25 +01:00
966963b6d3 Updated readme to state completion
Some checks failed
Continuous integration / Check (push) Successful in 11m5s
Continuous integration / Test Suite (push) Successful in 10m14s
Continuous integration / Rustfmt (push) Failing after 9m54s
Continuous integration / Clippy (push) Failing after 10m10s
Continuous integration / build (push) Successful in 10m14s
2024-10-05 13:32:02 +01:00
34fbb412d3 Created Test config 2024-10-05 13:25:59 +01:00
9609c69c9e Applied clippy suggestions 2024-01-12 14:26:05 +00:00
760881cbc3 Day 17 Complete -> Love a bit of dijkstra :) 2023-12-17 21:27:18 +00:00
7d9f472948 Day 16 Complete :) More readable now as well 2023-12-17 19:41:29 +00:00
cfec497112 Day 16 Part 1 Complete -> Made it nice and easy for day 2 :) 2023-12-17 19:15:40 +00:00
0bead087c3 Day 15 Complete -> Nice and easy :) 2023-12-15 08:45:08 +00:00
505ea3771a Day 14 Part 2 Complete -> First solution took agest to run but added the hashmap to detect cycles in the rotations. Thanks reddit :) 2023-12-14 18:19:21 +00:00
a3b2847d6b Day 14 Part 1 Complete -> Really happy with my solution here 2023-12-14 17:38:01 +00:00
9fb69c573b Day 13 Complete 0 -> Initially implemented with a hashmap however this was not viable for the second part so followed AxlLinds solution to adapt it for the second part of the challenge. 2023-12-14 16:50:33 +00:00
f287d5a7ee Day 12 Complete. Thanks Reddit. The cache was a godsend! 2023-12-12 21:12:35 +00:00
23b27a2a8a Pretty much there with Day 12... just need an eternity to let it run :) 2023-12-12 21:02:08 +00:00
4082df6be8 Day 11 Complete 2023-12-11 16:54:27 +00:00
5c46e12269 Day 10 Part 2 Complete 2023-12-11 11:30:54 +00:00
075f7e39c7 Day 10 Part 1 complete 2023-12-10 23:21:24 +00:00
a4c8d73439 Day 09 Part 2 Complete 2023-12-09 14:07:04 +00:00
5627684494 Day 08 Part 2 complete :) Very efficient solution 2023-12-08 16:23:24 +00:00
4a095e2a74 Attempted part 2 but have made a mistake in how I simulatneously traverse them 2023-12-08 13:50:47 +00:00
f76c9794bb Day 8 Part 1 complete 2023-12-08 13:20:58 +00:00
f2ec4b3ba9 Day 07 Part 2 complete (Ignore the messy code!) 2023-12-07 20:45:35 +00:00
cbfc3a4dfc Day 7 Part 1 complete -> Didn't realise that sorting the hands of the same type required using an unsorted list :) 2023-12-07 18:57:05 +00:00
12fe856e43 Day 7 Part 1 Attempt :( 2023-12-07 07:11:33 +00:00
c4c423871e Day 6 Complete :) Super easy day! 2023-12-06 12:40:36 +00:00
c1668c8397 Added all of the days 2023-12-06 00:07:08 +00:00
7057d3006b Added day 7 2023-12-05 23:00:18 +00:00
43e3a8ac35 Parallelised the execution of each day 2023-12-05 19:33:10 +00:00
ed05221dff Day 5 Part 2 complete 2023-12-05 07:30:26 +00:00
916e52783a Day 5 Part 1 complete 2023-12-05 07:25:39 +00:00
1f8afe5af0 Added day 6 2023-12-04 21:21:47 +00:00
6d512470de Fixed compiler warnings 2023-12-04 19:02:39 +00:00
34c8099720 Day 2 Part 2 Complete :) 2023-12-04 18:52:58 +00:00
6bd170cbde Got slightly confused on part 2... nearly there 2023-12-04 07:40:07 +00:00
f3c2f6cfd8 Day 4 Part 1 complete 2023-12-04 06:03:29 +00:00
27a646f88f Day 3 part 2... My struggle in the first half made the second half bliss! 2023-12-03 08:39:30 +00:00
0837967a6b Day 3 Part 1... WOW!!! 2023-12-03 08:32:49 +00:00
0e225f4b04 Added day 4.. early I know! And i fixed unit tests not compiling 2023-12-02 23:50:10 +00:00
554319e068 Cleaned up runner 2023-12-02 13:42:55 +00:00
cb4b54e130 Changed number on day 3 2023-12-02 12:46:10 +00:00
13a891400a Day 2 Part 2 Complete 2023-12-02 11:48:22 +00:00
2634f487e2 Day 2 Part 1 2023-12-02 10:57:05 +00:00
308c456fa4 Added benchmarking for each day 2023-12-01 17:55:07 +00:00
4267b68253 Created a set of unit tests each day 2023-12-01 16:33:40 +00:00
5a677ea222 Cleaned up AoC libs and main runner 2023-12-01 16:13:54 +00:00
acb8170222 Cleaned up Day 1 2023-12-01 11:25:59 +00:00
3ff45cae13 Cleaned up runner to use 2 test inputs and prepared for day 2 2023-12-01 11:09:24 +00:00
b08290c70c Day 1 Part 2 Super janky solution. Just could not get to grips with the regex engine 2023-12-01 10:51:24 +00:00
9c26f1ce02 Day 1 Part 2... Feeling in agony as I can't seem to use regex to save my life. Lookahead current does not work :( 2023-12-01 10:38:18 +00:00
108 changed files with 9265 additions and 43 deletions

View File

@@ -0,0 +1,45 @@
on: [push, pull_request]
name: Continuous integration
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: false
- run: cargo check
test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: false
- run: cargo test
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: false
- run: rustup component add rustfmt
- run: cargo fmt --all -- --check
build:
name: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: false
- run: cargo build

45
.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,45 @@
{
// 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 executable 'advent_of_code_2023'",
"cargo": {
"args": [
"build",
"--bin=advent_of_code_2023",
"--package=advent_of_code_2023"
],
"filter": {
"name": "advent_of_code_2023",
"kind": "bin"
}
},
"args": [],
"cwd": "${workspaceFolder}"
},
{
"type": "lldb",
"request": "launch",
"name": "Debug unit tests in executable 'advent_of_code_2023'",
"cargo": {
"args": [
"test",
"--no-run",
"--bin=advent_of_code_2023",
"--package=advent_of_code_2023"
],
"filter": {
"name": "advent_of_code_2023",
"kind": "bin"
}
},
"args": [],
"cwd": "${workspaceFolder}"
}
]
}

View File

@@ -3,7 +3,11 @@ name = "advent_of_code_2023"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
regex = "1.10.2"
async-trait = "0.1.74"
fancy-regex = "0.14.0"
hashbrown = "0.15.1"
itertools = "0.13.0"
strum = "0.26.3"
strum_macros = "0.26.4"
tokio = {version = "1.41.1", features = ["full"]}

View File

@@ -1,3 +1,5 @@
# AdventOfCode2023
My Advent Of Code attempt in rust!
My Advent Of Code attempt in rust!
Made it to day 17 this year... not to bad.

BIN
assets/images/main.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

7
src/input/day01_test2 Normal file
View File

@@ -0,0 +1,7 @@
two1nine
eightwothree
abcone2threexyz
xtwone3four
4nineeightseven2
zoneight234
7pqrstsixteen

100
src/input/day02 Normal file
View File

@@ -0,0 +1,100 @@
Game 1: 1 blue, 2 green, 3 red; 7 red, 8 green; 1 green, 2 red, 1 blue; 2 green, 3 red, 1 blue; 8 green, 1 blue
Game 2: 12 blue, 3 green, 5 red; 1 green, 1 blue, 8 red; 2 green, 12 blue, 5 red; 7 red, 2 green, 13 blue
Game 3: 7 red, 4 blue, 13 green; 14 green, 1 blue, 1 red; 1 red, 11 green, 5 blue; 10 green, 3 blue, 3 red; 5 red, 5 blue, 3 green
Game 4: 3 red, 1 green, 17 blue; 11 red, 6 green, 18 blue; 4 red, 9 blue, 5 green; 2 blue, 2 green, 1 red; 1 red, 2 green; 7 green, 9 red, 2 blue
Game 5: 1 blue, 9 green, 5 red; 12 green, 1 blue, 15 red; 17 green, 8 red, 4 blue; 7 green, 12 red
Game 6: 4 blue, 9 green, 7 red; 1 red, 7 green, 4 blue; 4 blue, 8 green, 3 red; 2 green, 1 red, 2 blue
Game 7: 3 green, 1 blue; 11 red, 2 blue; 2 red, 3 blue, 6 green
Game 8: 8 blue, 1 red, 11 green; 11 blue, 10 red, 7 green; 4 blue, 6 green, 4 red; 3 blue, 2 green, 6 red; 4 green, 4 red, 1 blue; 5 blue, 12 red, 9 green
Game 9: 2 green, 20 blue, 4 red; 3 green, 7 red, 2 blue; 3 green, 17 blue; 20 blue, 7 red, 2 green; 4 green, 6 red, 1 blue; 7 red, 5 green, 19 blue
Game 10: 2 red, 9 green, 8 blue; 16 green, 1 red, 7 blue; 3 blue, 5 red, 9 green; 5 blue, 2 red, 11 green
Game 11: 6 blue, 3 green, 8 red; 6 blue, 4 green; 1 red, 3 green, 4 blue
Game 12: 18 red, 16 blue, 9 green; 10 green, 6 blue; 12 blue, 5 green, 15 red; 16 blue, 4 red, 8 green
Game 13: 2 green; 1 blue, 4 green; 1 green, 3 blue, 6 red; 2 red, 2 blue; 3 red, 2 green; 8 red, 2 blue, 5 green
Game 14: 8 red, 3 blue, 3 green; 3 green; 4 red, 7 blue, 5 green; 10 blue, 15 red, 1 green; 4 green, 14 red, 7 blue
Game 15: 8 red, 9 blue; 1 green, 4 red, 3 blue; 15 red, 3 blue, 1 green; 17 red, 6 blue
Game 16: 1 green, 10 blue, 13 red; 16 red, 1 green; 7 red; 9 blue, 12 red, 1 green; 6 red, 13 blue, 1 green
Game 17: 6 green, 1 blue, 1 red; 2 blue, 9 green, 1 red; 6 green, 1 blue, 2 red
Game 18: 5 red, 4 green, 1 blue; 5 blue, 6 red, 6 green; 12 red, 16 blue, 11 green
Game 19: 6 red, 9 green; 1 blue, 4 red; 12 green; 5 green, 2 blue, 9 red
Game 20: 15 blue, 15 red, 1 green; 2 green, 5 red, 13 blue; 15 red, 2 green, 15 blue; 3 green, 3 red, 13 blue; 6 blue, 1 green, 8 red
Game 21: 3 red, 3 blue; 4 blue, 3 red; 4 red, 8 blue, 1 green; 1 blue, 2 red, 7 green; 3 green, 3 blue; 3 blue
Game 22: 5 green, 3 blue, 7 red; 7 green, 1 blue, 5 red; 5 red, 3 blue, 3 green; 12 green, 7 red, 1 blue; 2 red, 3 blue; 7 green, 11 red, 1 blue
Game 23: 9 blue, 8 red; 9 blue, 9 green, 8 red; 3 red, 6 blue, 14 green; 3 blue, 4 red; 5 red, 14 green, 9 blue; 12 blue, 8 red, 8 green
Game 24: 15 green, 1 red, 1 blue; 6 red, 2 green, 7 blue; 7 blue, 2 green, 4 red; 8 blue, 5 red, 8 green; 5 blue, 3 red, 7 green; 6 blue, 12 green
Game 25: 7 blue, 16 green, 1 red; 13 green; 4 red, 9 green, 2 blue; 11 green, 1 red, 1 blue; 3 blue, 5 green, 5 red
Game 26: 2 blue, 11 red, 10 green; 5 green, 1 blue, 2 red; 7 green, 5 red, 14 blue; 11 green, 1 blue, 10 red
Game 27: 2 green, 8 blue, 2 red; 1 blue, 1 red, 5 green; 3 green, 7 blue
Game 28: 9 green, 15 red, 1 blue; 3 blue, 3 green; 18 green, 15 red, 7 blue; 3 red, 10 blue, 7 green; 6 red, 5 green, 8 blue; 2 blue, 7 red, 3 green
Game 29: 5 blue, 3 red, 7 green; 17 blue, 8 red, 11 green; 6 red, 5 blue, 12 green; 3 red, 10 blue, 10 green; 4 blue, 10 green; 6 red, 2 blue, 9 green
Game 30: 4 green, 5 blue, 1 red; 19 red, 18 blue, 3 green; 18 red, 18 blue, 1 green; 5 green, 14 blue, 4 red; 4 red, 3 green, 18 blue; 6 blue, 3 green, 17 red
Game 31: 2 red, 2 green; 13 red, 9 blue; 4 blue, 3 green, 1 red; 12 blue, 12 red, 4 green; 9 red, 6 blue; 12 red, 1 green, 2 blue
Game 32: 11 red, 5 blue, 9 green; 3 blue, 8 red, 15 green; 3 green, 7 blue, 17 red; 2 green, 9 red, 1 blue; 2 blue, 6 green, 2 red
Game 33: 13 blue, 2 green; 1 green, 1 red, 14 blue; 3 green, 6 blue, 1 red; 12 blue, 1 green; 9 blue, 2 green; 4 blue, 1 red
Game 34: 15 green, 2 red, 13 blue; 1 green, 6 blue; 2 red, 1 green, 7 blue
Game 35: 1 green, 12 red, 2 blue; 3 red, 5 blue; 6 red; 3 red, 3 blue; 4 red
Game 36: 6 blue, 8 red, 1 green; 7 green, 6 blue, 10 red; 7 blue, 9 green, 5 red; 7 green, 1 red, 1 blue
Game 37: 6 blue, 2 green, 4 red; 2 green, 3 blue, 6 red; 1 green, 17 red, 14 blue; 10 red, 2 blue; 19 red, 1 green, 8 blue; 2 red, 2 green
Game 38: 6 red, 1 green, 5 blue; 2 blue, 15 green, 6 red; 10 green, 3 blue, 6 red; 5 blue, 8 green, 2 red
Game 39: 8 blue, 5 green, 5 red; 4 green, 5 blue; 2 red, 7 blue; 3 green, 15 blue, 4 red
Game 40: 8 green, 12 red, 10 blue; 8 blue, 8 red, 9 green; 1 green, 10 blue, 9 red; 17 red, 7 green, 2 blue; 6 green, 11 red; 2 green, 2 blue, 8 red
Game 41: 11 red, 5 green, 1 blue; 5 green; 3 green; 2 red
Game 42: 8 blue, 11 red, 1 green; 12 red, 10 green, 6 blue; 2 red, 6 blue, 16 green; 18 blue, 2 red, 4 green; 10 blue, 10 green, 3 red
Game 43: 4 red, 3 blue; 2 blue, 10 red, 4 green; 3 blue, 7 red, 5 green; 2 green, 8 red; 1 green, 3 blue; 10 red, 1 green
Game 44: 1 red, 9 blue; 2 red, 19 blue; 2 green, 6 red, 15 blue; 11 blue, 8 red, 4 green
Game 45: 7 green, 4 blue, 1 red; 5 blue, 8 green; 5 blue, 8 green; 5 blue, 6 green; 6 green, 3 blue
Game 46: 2 red, 2 green; 6 red, 5 blue, 2 green; 13 green, 8 blue, 2 red
Game 47: 1 red, 5 green; 1 blue, 15 red, 5 green; 6 red, 6 green, 3 blue; 5 blue, 4 red; 4 blue, 7 red
Game 48: 16 blue, 16 red; 11 blue, 16 red; 15 red, 1 green; 6 blue, 1 green, 2 red
Game 49: 9 green, 20 blue, 7 red; 16 blue, 6 red; 9 green, 1 blue, 1 red; 8 red, 12 green, 15 blue; 3 blue, 2 green, 8 red
Game 50: 9 red, 6 green, 9 blue; 6 blue, 2 red, 6 green; 7 green, 4 red, 6 blue; 2 red, 7 blue, 9 green; 4 red, 8 green, 9 blue
Game 51: 1 blue, 2 red, 6 green; 1 blue, 4 red; 6 red, 2 green; 6 red, 8 green, 2 blue; 2 blue, 8 green, 4 red
Game 52: 10 green, 1 blue; 5 blue, 5 green; 5 blue, 2 red, 4 green; 2 blue, 12 green
Game 53: 3 blue, 8 red, 7 green; 7 blue, 7 red, 12 green; 8 blue, 9 green, 7 red; 7 red, 10 blue, 1 green
Game 54: 3 green, 4 blue; 1 blue, 5 red, 4 green; 7 red, 4 blue; 2 green, 4 blue; 1 red, 4 blue; 1 blue, 6 red, 5 green
Game 55: 7 red, 13 blue; 7 blue, 1 red, 1 green; 3 red, 5 blue
Game 56: 6 red, 3 green, 1 blue; 7 blue, 2 green, 5 red; 4 green, 4 red; 8 blue, 1 green; 6 green, 6 blue, 4 red
Game 57: 14 blue, 12 green, 8 red; 1 red, 20 blue, 10 green; 4 red, 16 green, 15 blue
Game 58: 3 blue, 12 red; 9 red, 3 blue, 2 green; 2 blue, 2 red; 7 red, 4 green, 5 blue; 10 red, 1 blue
Game 59: 7 red, 11 blue, 17 green; 5 red, 4 green, 7 blue; 8 red, 6 blue, 17 green; 16 green, 7 red, 6 blue; 5 blue, 12 green, 9 red; 7 blue, 3 red, 9 green
Game 60: 4 red, 5 green, 4 blue; 15 green, 4 red, 18 blue; 6 blue, 1 red, 1 green; 14 blue, 12 green, 1 red; 2 green, 5 red, 4 blue; 2 green, 1 blue, 5 red
Game 61: 3 green, 2 blue; 4 green, 6 blue; 2 red, 12 green, 11 blue; 1 red, 9 green, 7 blue; 2 red, 11 green, 19 blue; 9 blue, 1 red, 2 green
Game 62: 17 green; 3 blue, 14 red, 14 green; 17 red, 16 green, 5 blue; 17 green, 5 blue, 1 red; 4 blue, 17 red, 13 green
Game 63: 4 green, 2 red, 2 blue; 10 green, 15 blue, 3 red; 5 green, 5 blue, 5 red
Game 64: 9 red, 10 blue, 2 green; 1 green, 4 red, 1 blue; 5 green, 2 blue, 11 red
Game 65: 1 blue, 10 red, 5 green; 1 blue, 4 green, 2 red; 3 blue, 1 green; 11 red, 2 blue, 5 green; 9 green, 11 red, 3 blue
Game 66: 6 blue, 13 green, 2 red; 5 green, 1 red, 7 blue; 11 green, 3 red; 5 blue, 1 red, 2 green
Game 67: 1 red, 10 green, 4 blue; 5 blue, 3 red, 9 green; 4 blue, 3 red, 1 green; 14 red, 4 blue, 10 green
Game 68: 12 green, 3 red, 3 blue; 2 green, 1 red, 2 blue; 1 blue, 3 green, 3 red; 1 green, 1 red, 6 blue
Game 69: 3 blue, 10 red, 4 green; 4 green, 1 blue, 6 red; 1 blue, 1 red, 6 green; 4 red, 3 blue, 5 green
Game 70: 9 blue, 3 green; 1 red, 2 green, 6 blue; 9 blue, 2 green; 6 blue, 1 red; 6 green, 1 red, 6 blue; 3 blue, 1 red, 2 green
Game 71: 2 blue; 2 red, 3 blue; 12 blue, 3 red, 1 green; 1 green; 1 red, 7 blue; 1 red, 9 blue
Game 72: 1 red, 1 green, 5 blue; 19 blue, 1 red, 3 green; 3 green, 1 red; 1 red, 13 blue, 1 green; 1 red, 1 green, 19 blue; 6 blue
Game 73: 12 blue, 5 red, 5 green; 12 blue, 1 red, 4 green; 7 green, 4 red, 6 blue; 1 green, 4 blue, 10 red; 9 blue, 14 green
Game 74: 9 blue, 1 green, 2 red; 7 blue, 15 red; 5 red, 2 green, 17 blue
Game 75: 8 red; 1 green, 14 red; 2 blue, 3 green, 10 red; 2 blue, 4 green
Game 76: 2 red, 3 blue; 6 blue, 8 red; 6 blue, 9 red; 7 blue; 7 red, 1 green, 5 blue
Game 77: 6 green, 5 red, 12 blue; 16 blue, 5 red, 11 green; 4 blue, 5 green; 10 blue, 4 red, 9 green
Game 78: 7 blue, 2 red; 1 green, 5 red; 4 blue
Game 79: 3 green, 4 blue; 4 blue, 1 green, 2 red; 8 blue, 3 green
Game 80: 10 red, 8 green; 4 red, 1 blue; 7 red, 4 green, 4 blue; 6 green, 1 red, 3 blue; 9 red, 3 blue; 4 green, 8 blue, 13 red
Game 81: 3 red, 6 green, 9 blue; 9 red, 1 blue, 3 green; 5 red, 11 green, 1 blue
Game 82: 6 green, 11 blue, 8 red; 16 green, 9 red, 7 blue; 6 blue, 17 green, 4 red
Game 83: 6 blue, 1 green, 8 red; 3 green, 5 blue; 4 red, 2 green, 8 blue
Game 84: 2 green, 1 red, 5 blue; 1 red, 2 green, 5 blue; 2 blue; 9 blue
Game 85: 9 blue, 2 red; 7 green, 13 blue, 3 red; 11 green, 17 blue
Game 86: 2 green, 15 red; 12 red, 1 blue, 3 green; 2 blue, 4 red, 3 green; 5 red; 6 green, 2 blue
Game 87: 17 blue, 3 red; 3 red, 4 green, 10 blue; 3 red, 14 blue, 4 green
Game 88: 13 green, 10 blue, 10 red; 14 green, 3 red, 4 blue; 13 blue, 7 red, 16 green; 10 blue, 6 green, 1 red; 9 red, 4 green, 14 blue
Game 89: 3 green, 16 blue, 14 red; 4 green, 13 red, 1 blue; 6 red, 17 blue, 1 green; 4 red, 7 blue
Game 90: 2 blue, 2 red; 5 blue, 10 red, 6 green; 10 red, 3 green, 1 blue; 10 blue, 6 green, 7 red
Game 91: 15 green, 5 blue, 12 red; 9 red, 1 green, 4 blue; 2 red, 15 green, 3 blue; 18 green, 5 blue, 2 red
Game 92: 7 green, 7 blue, 12 red; 7 blue, 9 red, 2 green; 11 blue, 10 red, 10 green; 2 green, 4 red, 11 blue; 12 red, 4 blue; 2 red, 6 green
Game 93: 2 green, 8 blue; 2 blue, 1 red, 3 green; 4 blue, 8 green, 1 red; 8 blue, 5 green; 3 green
Game 94: 16 red, 1 green, 5 blue; 11 red, 9 blue; 5 red, 2 green, 6 blue
Game 95: 4 blue, 7 red; 7 red, 10 green; 11 green; 2 red, 10 green; 6 blue, 8 red; 8 red, 2 green, 6 blue
Game 96: 9 blue, 12 green; 6 green, 9 blue, 11 red; 7 blue, 5 green, 10 red
Game 97: 1 green, 6 red, 1 blue; 6 red, 3 green, 6 blue; 9 green, 5 blue, 9 red; 13 red, 7 green
Game 98: 9 red, 12 green, 2 blue; 1 blue, 11 green, 10 red; 10 red, 2 green
Game 99: 4 red, 13 blue, 7 green; 7 green, 5 blue, 6 red; 7 green, 11 blue; 10 green, 2 red, 8 blue
Game 100: 2 green, 1 blue; 9 red, 8 green, 1 blue; 4 red, 10 green, 1 blue; 17 green, 8 red; 5 green, 1 blue, 7 red; 14 red, 12 green

5
src/input/day02_test1 Normal file
View File

@@ -0,0 +1,5 @@
Game 1: 3 blue, 4 red; 1 red, 2 green, 6 blue; 2 green
Game 2: 1 blue, 2 green; 3 green, 4 blue, 1 red; 1 green, 1 blue
Game 3: 8 green, 6 blue, 20 red; 5 blue, 4 red, 13 green; 5 green, 1 red
Game 4: 1 green, 3 red, 6 blue; 3 green, 6 red; 3 green, 15 blue, 14 red
Game 5: 6 red, 1 blue, 3 green; 2 blue, 1 red, 2 green

5
src/input/day02_test2 Normal file
View File

@@ -0,0 +1,5 @@
Game 1: 3 blue, 4 red; 1 red, 2 green, 6 blue; 2 green
Game 2: 1 blue, 2 green; 3 green, 4 blue, 1 red; 1 green, 1 blue
Game 3: 8 green, 6 blue, 20 red; 5 blue, 4 red, 13 green; 5 green, 1 red
Game 4: 1 green, 3 red, 6 blue; 3 green, 6 red; 3 green, 15 blue, 14 red
Game 5: 6 red, 1 blue, 3 green; 2 blue, 1 red, 2 green

140
src/input/day03 Normal file
View File

@@ -0,0 +1,140 @@
............................................411.....................363..134.........463.775..........................506...................
......429...836..$............../..960........*.............+..........*...=....381.....*........67......426.....=..../...304...............
.........*...&...641..........924..*.........855....492..495.......476.927.......*.........680...../.&....*.....713......*..................
.........900......................239.325..............*.............*.....953%.771...........#......808...329..........214........846%.....
.............707...233...................*.....*........774...445.....107.........................................@927......775.............
........721........*...17................790...670.............$..........893.93&../...129$.651.696.......131*99.............=......446*781.
...........*717.868...+.............252....................................*......461.........*......................350....................
....911..................*...454.............161.........875........209....695..............926.983.........758.592....*..........$.562.....
...*............569#..496........888.............227......*..67......*..................877........*...#.......*.......716......975....@....
...730........................$...#..112............*..509..*.......858..710.......@567..%..610..821...918..................................
.........794.....701@..456-...505.....*............884.....298...............................&...............742=.....95....................
............+........................891.165.......................=.............175...............$..693.............+...........127.......
....*..........554...855.................*...............505.262.110..764............953@...+.....343.../..............................817..
..449.464.148.........*.............1=.853.......232.356*....../.......&....................217................992..935.527............*....
..........*........931...44.........................................&..........553*..............*....945......$.......*............655.....
........735..718............16.....650.....944...................525.....*........................491.+...662..................27.......397.
...273........*.........563...+.......*418.%.......-.....#265..........43.92.....791*211..+................*..&...507@....84...*..543.......
..............562...=...........................627....*.....................*............492..*86......456..837............*........*181...
.....829.233.........454..................351.......232..........47........44.401.............8....876...........965*151..284...............
........*....................647..........*.....$.................#................................*....+788...*.....................-......
...49.....588........174......*....111....604....358......863..61.........................663.......549......442.271&.................493...
...........+..446.......*...638.......*..........................*..881................#.*....*.........................720....168%.........
.....504.........*..43..245........975.................91........28..*.....966......600..18...245.......480............*....................
.......*....+...57..*....................@412......812...*............729......61...................268*.............706...#................
.......307..107......937.108..................453......50......778........&......*440....................4......361.........888.=256........
..........................*..889*....89............675..........%.......29..427...................508..&........&...641..................455
..........897...960......403.....971...*......806.....@.363................*......9+..............*.....464...................586....282*...
.....316...*...............................9...#........./.............317..614........362..905..27................670.............$........
......*...606....................+...........................-............*........292.*.....@..........%.........=.......164.470.902..549..
..473.603.........733..482*423....276...419...../166.........297........401.......$....313......306/.353.....................*..........*...
...*....................................%...............291......997.........385..............................617%..470...............618...
....577...*903...%.-343.....790.................143.....*.........*...30........*................/759..$.....................@..............
...............387.........*.......$.............*.....210....417.482..........86.....760...............626........503.+990..299..137..-....
....*14....896.....=...922..937...188........553..63....................*150..........*........*...208...............@................338...
.........#....*..774..*.......................*......................987..........737.959......665.#....329...+.../....#.....966............
.......221....8........629...........521.94....706.....356...+............636........................=...*..253.655..505..............613...
............................649............................270....468.......*.....................420...848..................846.....-......
....43..718..678.............=.....*906....593.-26.....268...................810...401......+.........$.........842.........@..........&....
826*...*......*...430+..572.....436..........*.................954.....732........*.......391..999..348.662......*.....................771..
.....61.....535............*........977.......34....672.......*.........*.........693............*.............=.860.....*790.....611.......
........930.......&................*................=.......596.........590....*................903.....985.639.......984...........@.......
.......*.......691...379.......226..971.....549*............................438.466........./.......307.*.........75......151..594....631...
........761..........*..........................236....................534..........611......835..%...............&.........*.*.........*...
...275.........58.970............660-..605..........689.191...32...+..*....287$......%...........160........*625..........413......*133.885.
....*..................................*...........*......*.......873........................./.............................................
.....388..518.........313*820...666/.321.520...392..12....455.................165=...+.#....345........557..........293............+........
.............*.........................../......*..................................267..841...........@........49......*762.863...123.......
.............41......301.....247*37..........836........631*32..241&..........999.................+.....476&.....*.896.........*............
.../..................*..................794...........................950...*.....................436.......$.240.+.........108............
.917....$..+........72.....&....333.8*2...-.............35...809..416..-...654...750...166.................419.......=................884...
.....442..537...........865..................927*114.$........*...=...............*....*...725.....................228......385...214*......
..................@.........701.501..204.............320................/.......+..820.514....*.......520...../.............................
................121....$....*...+......@...725...@.....................305....698..........287..877......*....7................$.%..........
....920..790........468.......=............*.....584..........-546...............................*.....870............954....811.407........
....*.....*....................405..........724...............................143.................256.......668.............................
..877......381..........=.................................4.........../...........=495......617..................519........................
..................855....59..............$63..............*............73..773.=...........*.......595.......353*....937.......226..........
.....456.............@............966..........990....282..19.749....=....../..273.......860.......$...233..........*....+........*.464.....
......*..........*.......206..131.$...110.861.*........*...........159....................................&............624......566.........
...181...349......198....................*.....484.....989.....181............457...........................................................
........*...............942@..345....................+........................*......142..86..............282...........73..................
.....319..804*656.............*....................330..261......236.......263......*.............158.......*...........*........551..314...
...................343.......957.175=.....492.245*.....*............*306.......745.90.........165*..........910.......818..201..*...........
.............%....-.........................*.....186.188......306........*96..+......................837.......945.........@..129..........
..............742..........+.....619.........889..............#...................465.....542%..44....*.../418...*..........................
..................753-....973....*...$575.................883...../.....*....242..&.............*....63...........72..........*732....702...
.........640....................724.........63*844...........*...234.690.48....*.....+........612..............*.......483.............$....
...225.......@......................452..89........435.....754.................886....514...................209.282...*.....................
.....*.....346........................=.*..........................................................357*88............473...........712..+...
...84..&.......%.....616.......605&......380.....773..865.254.433......*...1*..-............33+.............283...................$......538
........416.....408.......744......................&.....*....*......595........586.....428..........523......*..............901............
.820@.......59*...................%625.....................560..........................*......705....*.....713..../.745........&...........
.......%.......849...$.......................*...........*.....574.....#526..............304......@..241.........241..../..........975..635.
....754.............269........327$..906/.133.33........400.....*...-.........540.........................299..................451*.....=...
...........409............589.......................533.........564.211........*.....592.....%..............*...............................
.............*...............*..915......321.........+......................938......#....809............756..396.......980.403..813.725*200
...916=.%223.354...227....488...*...........%.....@.....907.659...192.$866.......874.............737.........*...............*....*.........
.....................*...........966.257.......515.........*......*..........645....*..169......#.....*792...369......909....36..172.%119...
..779.................669............$...318......../.309+.....546..........*....817......*........755............634*......................
......441........%..........*40....6.............514.......323............464............501.84........*379....*........+.....339......$....
............641...735....355........&................14...*...........*.............53.......$..............386.577....697..............520.
................................................929+....288........408................*..417...192...............................899$.......
.....871..................736............749*.......................................24......*.*.....$67...............616.765.........@783..
......*........24........*.....$.............147...258*605.65*807......253.............450.....912......454.895.............*..#............
...612....957.*........245..790.....................................@.....*............*............@....@...=..91*..554....60.15...........
..........@....229..........................481.......542*650....779................520..........139..................*.....................
....*304.............815....................*...................................16.................................@.772......*506....%.....
.975........+....794.#........773*.......292..........708*......475............-............*100................600........862........439...
.........500......................884...............#.....477...........+...........*894.368.....480..-..552*...............................
.......................912..=............../......227............199..822........478.............*...742.....572.......625..................
.117.........*146..529...*.718.........121..974.....................*....................201.....47........+..............*.500.............
.......296.97......@...345................*......................976.......-..............%................851..........196.*....383....$...
...182......................39.....#600...973....*606.................950...448...............&.....&9.215...................849........303.
.......824...864*973.....%....................973......................*...........581...772..167.......+.......598.........................
..829+....*..............953.............................764..424......200....788....*....@........169......280....*..........373...711.....
.......147.........348.......#..744.730........355*..............=...............*..183.&...............808..*......147..........-.*........
....*........836...*......807..*....$...815........235.172/...............640..93........900..............=...291...................249.....
.452.213........*....698......569......%.......................320.......-.........%................................./......................
..........522....406.*............959...........383.......533.......706....47&......33.960......960....&...241.....620.......-764....906#...
..........*..........932............*..594.......*...711.&.....+794....................-..............487...............285.................
..139...737.....*541......658.248.79...........589.....-...460...........................-..145............696.........+......645.....=640..
.....*........24..........*....+......971*.................................397..&86.....95..*.................*..................*..........
...55...75.............258..4.....+.......183..........349.....&...169=....@................207..187.....929..601.746.....$...269...-.......
........*.......%577.........*543..149.71........337....*.....40.....................434..........%.........+......-.....277......43...638..
...230%..609......................................./.580.......................+.......*....+...........640............................*....
..............269..999................618...636..............311....109...314.586.....162...747..........*........56..967...............291.
...../...........#.=......217............*......................*..*........*......%......................596........%......629..901$.......
....103...................*....157.......427.................101..686..134.909....550...@.........911........./..579....167.............*...
.............181......-.822.......*................623...................*.............39..644.......*.....841.........&.............562.45.
.....+469...........89.........190...653...939.89..*......................898..............*......660..........272..@........%..614.........
............&.......................*.........*...563....215....................612*882..740.&................*......173...834....$....182..
......437...856........626..159...266.299...............*.............830$...................268.......467-.738.............................
.........%............*................$....@...........891..291................649.................................387...938.850*..........
...............922.610....*....676...........494.161%............%.................*154..741....*............326.....*............88........
....702.................223........+......$.......................224.......133.............@....648..890....../..540..745*............573..
.........&842....$..849........513..210.288............35.....758........../........................./................................./....
..............135..+............*...........607.........*........*...............790..#.....552/.............374......*496.....253..........
..........*..............804/.369....419..............22..576.....335..723.686........347..............-327...*....180......................
.......685.829.790@...................*....437............................*....................392.............352...............599........
.......................944..........667....*...321..764@.746.665.......+......890.......104................./..........746..668.-...........
96.+....=.............#.................662....*..........*...@..961...877...*.....942+..*......290...655.303.....467.....*..*........57....
....927.857........+................791........545..67......................152...........345..*.....*...............*...541..846...........
................325....966....480..................@...............462..468.....352.............96.371...............593................220.
........=.970.........*......*..........943.....+......*875..362.%....*....*...-.......................550*25...%191.........462............
.....984...+......&..618.39.493.289..21....*....379.600...........16.642..162....256........................................*....403........
...............168........*........*...*....326...............*...............*...+..............413.*.....+293.769*620....674..............
647.................949..........502...748..............692...208.......271..903..................=..132.........................506$..832..
..............&.........983....+................503....#.........................*350..239.....................581.......372...........*....
.....45........693.........*...192.....7./......+.............774.............338....................@81...337*...................249..105..
.........................598.......905....899......#..........*......-.............*31..........+......................751#......*..........
...../...............56..............*..............110....594.....517..300.679.150.......64.919......287.........................5...801...
....783....498..321.&...297.514.......8.......+18..........................*...............*....../.....*.....&.............................
..............$..*......*....-....................*................=...961.....534*791......526....499.648.....349..&.......................
........767......48....40.............524.28...369.417..432.......421..$...........................................748......40..............
..........%..........+............820....*.................#...................707.....378.........801.................52..*.....102%.......
..............822...364.551/......./.................118&.....922.....785........./.......*610........$..........%268..=...529..............
........820..*.........................../......753.......................................................499...................435.........
..232......&.676...738....#......839....876.45........866...555...664......+..68.......941.........51*585..............937.......*...917*691
.........@........*.......8...31*...........+.....577*.........*....*...399....*.=....@......./...................................59........
.......740.......781..........................................105.353........791.579...........900.463..............909.....................

10
src/input/day03_test1 Normal file
View File

@@ -0,0 +1,10 @@
467..114..
...*......
..35..633.
......#...
617*......
.....+.58.
..592.....
......755.
...$.*....
.664.598..

10
src/input/day03_test2 Normal file
View File

@@ -0,0 +1,10 @@
467..114..
...*......
..35..633.
......#...
617*......
.....+.58.
..592.....
......755.
...$.*....
.664.598..

196
src/input/day04 Normal file
View File

@@ -0,0 +1,196 @@
Card 1: 69 72 87 33 61 15 8 78 43 50 | 96 33 86 53 15 82 50 85 61 8 98 72 43 63 45 78 87 69 10 34 73 88 65 27 19
Card 2: 79 46 10 30 20 56 34 45 85 94 | 10 20 86 65 34 82 92 48 85 63 55 99 58 26 94 46 30 72 56 23 62 8 45 79 87
Card 3: 87 17 54 56 4 53 14 76 63 11 | 96 53 52 90 50 91 17 24 99 5 83 44 97 63 66 54 35 37 84 11 73 34 7 79 12
Card 4: 62 25 96 26 23 17 16 59 15 20 | 58 16 88 35 85 59 62 39 25 75 6 2 18 57 43 15 44 70 20 10 83 46 26 17 96
Card 5: 64 17 55 49 31 70 83 60 28 24 | 23 76 96 20 84 61 63 39 81 7 41 65 75 22 31 85 28 47 99 52 68 66 59 4 3
Card 6: 30 39 83 14 6 2 57 68 94 5 | 94 16 68 77 71 14 97 62 2 34 83 69 64 46 39 57 80 66 59 98 73 6 25 30 70
Card 7: 36 81 27 87 25 94 13 59 45 64 | 68 19 95 12 27 45 70 16 42 80 36 87 64 78 63 21 81 35 57 25 54 59 94 52 38
Card 8: 11 48 2 61 97 24 84 58 59 53 | 75 5 15 66 10 16 37 73 70 85 4 3 72 77 39 41 69 14 56 81 19 23 21 30 36
Card 9: 30 43 26 97 91 11 79 61 45 84 | 59 33 3 43 61 30 91 95 73 78 11 89 97 75 26 87 31 88 83 45 29 79 84 40 53
Card 10: 72 93 53 32 96 37 74 54 58 89 | 19 60 6 11 20 88 58 71 17 43 51 83 33 21 62 86 67 39 73 18 76 3 79 31 28
Card 11: 24 48 84 11 37 14 26 41 27 35 | 11 15 40 24 84 80 94 66 57 25 89 96 31 85 26 41 61 14 55 86 22 60 73 48 37
Card 12: 71 54 56 44 62 57 31 80 65 99 | 99 62 27 94 7 57 9 86 73 82 65 74 39 54 1 41 80 44 79 67 31 14 91 60 56
Card 13: 98 22 33 85 28 62 90 36 52 86 | 93 10 6 83 12 35 26 91 46 23 49 32 66 21 33 25 40 73 88 5 30 92 43 58 84
Card 14: 23 63 65 28 24 26 32 73 85 60 | 80 18 55 35 6 66 53 94 2 49 17 45 38 83 22 70 31 93 27 75 30 98 56 37 68
Card 15: 10 74 58 65 95 28 72 96 12 33 | 27 32 79 78 4 73 88 52 8 42 45 29 84 15 77 11 68 5 26 58 56 54 2 69 99
Card 16: 84 37 15 81 41 86 18 71 40 90 | 12 85 45 18 24 63 42 71 10 62 80 23 47 90 91 56 40 75 1 68 54 46 93 78 61
Card 17: 87 78 39 3 40 45 35 42 49 29 | 81 52 37 17 43 67 80 85 46 96 88 89 62 12 68 83 4 77 86 64 32 94 98 90 26
Card 18: 38 4 21 14 12 72 18 98 96 63 | 35 64 79 9 45 90 13 63 7 12 93 73 74 87 3 48 2 22 84 32 26 57 17 30 28
Card 19: 36 47 26 69 11 35 83 13 53 37 | 53 21 57 78 79 48 97 44 99 45 31 12 51 38 30 17 56 84 43 8 83 49 80 77 2
Card 20: 72 10 14 75 22 63 64 69 2 57 | 98 41 35 96 52 5 21 93 71 4 99 27 17 62 7 58 60 34 22 94 49 44 61 25 33
Card 21: 74 90 3 45 43 80 57 17 42 22 | 14 65 69 97 4 41 70 20 64 15 39 58 83 8 87 88 66 16 36 37 49 23 27 95 33
Card 22: 20 6 1 7 35 34 26 58 50 44 | 29 69 27 87 36 44 93 35 6 47 34 57 26 1 18 20 58 7 86 99 12 78 53 96 50
Card 23: 7 9 18 16 61 12 95 4 49 81 | 72 92 24 79 2 18 94 4 31 83 12 20 8 70 81 11 95 1 53 16 9 46 61 7 49
Card 24: 53 96 52 84 32 20 34 7 49 97 | 20 32 92 49 85 97 35 53 3 84 41 15 51 91 96 72 48 83 45 89 73 52 7 34 25
Card 25: 96 45 6 89 4 25 18 62 98 90 | 36 52 24 39 84 67 6 16 3 22 42 13 19 2 87 82 54 64 47 55 88 27 63 35 12
Card 26: 10 85 2 94 40 39 56 74 60 33 | 2 33 6 35 21 94 57 83 31 56 10 17 65 54 74 28 40 73 45 90 39 91 60 85 78
Card 27: 73 33 55 51 19 28 81 32 8 17 | 48 39 99 8 51 73 19 28 65 1 97 14 91 25 17 70 32 22 33 10 82 55 81 67 3
Card 28: 91 7 63 85 32 77 24 28 25 60 | 63 7 25 42 91 32 85 13 21 31 40 80 6 30 57 28 60 81 65 45 77 87 24 62 76
Card 29: 87 77 76 34 30 68 10 67 62 79 | 77 41 87 20 29 56 95 73 83 30 67 7 31 24 84 25 42 90 69 34 62 46 76 68 19
Card 30: 36 56 47 52 72 37 86 77 71 81 | 80 43 34 28 94 86 90 24 12 51 36 31 68 55 71 96 77 37 33 47 72 52 81 97 56
Card 31: 32 47 35 94 53 70 75 28 27 16 | 63 10 38 27 5 56 53 18 90 24 28 52 32 13 19 36 16 35 70 84 94 77 9 34 98
Card 32: 33 41 88 80 87 51 63 40 86 97 | 24 90 87 63 58 96 83 86 46 22 97 89 79 17 40 75 33 51 41 53 45 43 71 88 12
Card 33: 71 26 96 22 5 74 12 93 55 89 | 71 13 96 3 97 10 83 89 16 74 79 26 58 93 78 4 22 41 5 43 24 9 56 34 84
Card 34: 53 45 17 58 96 18 76 35 89 71 | 57 91 51 98 63 21 40 37 23 93 6 11 55 69 68 61 29 44 20 82 74 13 73 42 90
Card 35: 88 66 58 37 11 8 29 73 5 94 | 37 6 90 94 7 54 52 51 58 47 95 23 62 97 15 85 42 22 71 57 86 79 30 31 98
Card 36: 78 36 92 86 62 96 19 98 47 68 | 13 41 57 49 92 46 90 86 24 95 52 42 19 98 61 89 55 25 75 85 66 83 96 47 2
Card 37: 42 80 19 55 29 12 33 93 87 84 | 5 52 9 29 95 19 86 83 26 97 96 67 6 84 73 62 49 27 33 68 37 93 55 17 76
Card 38: 36 8 64 45 30 17 51 77 93 91 | 98 53 78 38 22 37 57 3 11 97 31 19 34 20 70 21 82 90 46 93 28 36 40 77 64
Card 39: 5 29 76 93 48 20 98 36 18 49 | 79 55 33 94 98 85 46 6 73 2 81 66 9 13 74 25 77 96 45 57 40 75 89 84 60
Card 40: 87 99 38 37 75 11 36 22 61 42 | 23 2 31 21 44 78 51 18 54 5 6 8 33 94 76 74 35 26 20 3 9 25 12 91 4
Card 41: 29 81 79 71 76 45 32 75 88 56 | 19 4 51 50 92 67 42 27 59 77 93 99 94 26 96 38 35 17 52 90 72 10 18 83 30
Card 42: 56 30 34 62 84 42 96 5 95 16 | 28 14 66 20 76 38 9 19 1 22 96 60 49 43 72 30 77 78 89 69 86 51 8 44 99
Card 43: 46 27 99 48 98 73 96 65 34 30 | 37 14 19 16 78 30 58 11 33 88 26 43 31 36 62 35 3 89 44 71 63 45 32 68 4
Card 44: 56 89 88 41 26 18 7 70 82 86 | 81 32 27 76 98 53 48 51 61 30 52 94 5 74 71 57 54 17 66 34 31 43 80 9 55
Card 45: 2 30 43 60 44 21 49 5 55 22 | 43 4 13 75 49 44 35 5 55 87 47 67 46 30 22 45 18 70 84 60 56 17 52 74 2
Card 46: 53 49 7 15 21 65 11 2 29 96 | 42 26 34 52 89 76 37 16 68 53 8 98 6 2 91 17 72 31 57 7 29 30 18 23 96
Card 47: 17 66 99 56 78 65 1 39 93 9 | 65 89 93 9 17 48 78 99 2 12 47 56 82 62 35 55 1 66 81 8 6 58 68 32 39
Card 48: 50 15 28 12 46 71 32 58 24 70 | 79 84 57 50 92 58 70 6 24 3 28 64 40 71 5 66 32 44 15 12 96 60 54 74 46
Card 49: 56 39 85 64 66 43 38 31 1 74 | 3 64 18 24 75 27 57 39 56 74 88 66 60 31 43 49 92 35 53 7 16 80 91 85 21
Card 50: 8 19 40 4 70 56 18 82 14 76 | 82 98 23 31 83 6 64 44 24 70 3 74 18 36 32 8 33 55 19 84 76 17 91 20 5
Card 51: 77 30 50 59 46 33 3 2 8 36 | 76 75 86 64 73 72 74 22 97 90 4 51 87 3 55 63 85 14 99 94 19 62 18 88 50
Card 52: 81 39 90 30 57 97 70 75 23 73 | 24 88 62 86 94 82 90 67 26 75 97 68 18 21 60 27 36 49 9 89 71 40 98 56 85
Card 53: 78 67 80 64 35 38 10 77 74 5 | 96 45 74 82 63 20 24 88 2 25 12 87 95 29 4 30 54 77 41 22 85 3 21 28 14
Card 54: 66 81 2 28 23 62 92 6 91 75 | 73 56 64 29 36 94 79 76 48 11 31 63 12 65 17 98 38 44 35 80 61 84 4 85 13
Card 55: 69 27 91 46 57 68 13 66 61 26 | 73 47 94 48 49 39 31 52 62 78 83 96 22 57 66 26 50 25 79 74 99 82 88 42 32
Card 56: 73 56 59 72 90 68 60 80 6 17 | 90 14 97 73 1 3 38 62 26 44 54 36 59 92 82 20 15 40 60 71 6 56 30 76 64
Card 57: 27 33 41 42 60 25 50 72 59 84 | 3 2 88 79 33 25 34 17 77 92 65 50 63 85 1 45 89 97 20 55 75 41 36 68 13
Card 58: 55 49 59 45 73 15 12 39 52 2 | 20 5 67 8 7 14 29 26 90 81 96 93 53 33 68 36 98 75 19 79 27 65 13 76 11
Card 59: 34 10 2 41 88 7 60 35 93 6 | 55 35 72 24 47 62 9 31 5 43 57 61 4 87 30 77 68 58 75 71 20 48 18 79 89
Card 60: 69 15 80 53 21 26 56 28 14 48 | 70 63 40 58 26 98 44 71 78 72 85 29 46 47 36 65 55 97 4 88 18 50 76 64 67
Card 61: 87 15 68 54 99 18 11 44 56 86 | 65 1 21 94 58 33 29 98 84 71 74 6 39 91 22 45 95 31 72 26 85 76 16 17 27
Card 62: 77 62 52 83 70 35 66 20 43 54 | 93 8 72 86 12 59 81 87 33 71 73 63 50 6 4 18 11 75 7 69 39 85 41 99 55
Card 63: 4 46 22 37 80 60 85 6 54 15 | 94 48 82 62 25 52 92 76 28 23 81 97 57 44 41 93 10 63 65 88 68 90 14 32 56
Card 64: 75 35 59 17 4 79 53 12 44 10 | 15 81 75 79 35 44 36 21 4 97 56 12 59 53 68 64 17 32 96 22 82 10 76 2 60
Card 65: 62 60 52 97 51 47 70 15 98 2 | 47 97 2 95 70 46 67 98 26 60 51 28 62 68 63 40 91 73 71 19 15 90 52 86 94
Card 66: 25 46 82 4 97 22 47 23 90 79 | 49 77 33 64 97 25 6 66 29 2 22 13 73 8 23 48 7 9 60 87 30 38 1 55 62
Card 67: 56 52 59 90 82 29 20 41 2 81 | 60 16 52 41 29 31 90 82 10 2 20 6 76 19 53 34 39 36 35 59 81 17 56 69 77
Card 68: 47 24 50 60 63 56 52 93 95 6 | 92 60 82 45 16 56 51 46 61 54 6 19 7 17 79 93 78 71 3 24 29 44 47 63 81
Card 69: 34 74 57 49 61 16 51 70 79 24 | 64 84 58 49 15 35 97 39 63 20 67 22 44 26 72 74 78 68 92 77 80 5 99 60 70
Card 70: 69 49 20 16 39 54 65 93 5 96 | 51 92 58 21 48 8 18 64 20 14 36 2 81 44 23 75 73 25 96 3 39 38 12 88 74
Card 71: 24 56 51 76 14 35 62 82 64 95 | 73 34 21 93 58 77 54 70 45 68 39 72 5 61 32 85 23 65 2 52 8 48 90 50 25
Card 72: 97 8 62 59 67 31 15 82 36 76 | 43 42 91 51 79 32 8 76 77 54 40 69 67 78 36 5 1 59 19 62 74 3 99 10 82
Card 73: 34 97 93 10 21 53 94 70 48 44 | 40 76 95 49 57 89 20 4 96 15 71 11 12 64 61 74 80 65 97 7 34 67 77 82 44
Card 74: 94 27 3 83 11 73 36 91 55 62 | 11 82 85 69 64 75 28 72 45 44 63 47 39 15 9 8 89 23 36 43 67 59 91 16 13
Card 75: 39 82 17 34 50 75 26 18 92 7 | 79 76 91 66 19 58 23 70 64 28 48 59 85 78 8 74 37 13 40 63 94 1 89 52 38
Card 76: 3 93 63 90 70 86 52 41 4 29 | 6 14 53 34 24 74 77 49 46 98 35 78 55 57 87 18 8 50 97 42 31 38 11 76 56
Card 77: 98 10 80 25 63 1 26 73 81 14 | 35 82 26 53 42 43 24 54 66 99 29 16 98 6 68 33 41 61 4 34 84 2 19 90 7
Card 78: 98 51 78 96 61 58 82 63 24 62 | 8 7 66 83 1 79 49 27 72 31 86 50 25 34 22 71 13 9 42 54 99 68 17 2 91
Card 79: 70 54 67 98 71 66 80 35 8 97 | 85 14 30 31 79 57 28 6 93 39 47 3 52 5 72 9 25 26 42 84 36 76 15 50 13
Card 80: 71 24 52 10 8 67 31 22 2 83 | 71 72 24 20 83 45 4 74 49 29 17 8 21 81 91 69 58 10 31 78 22 64 67 2 52
Card 81: 94 18 15 11 16 53 96 69 58 32 | 73 30 46 94 12 71 1 15 69 11 53 5 96 58 40 89 32 29 67 81 18 90 16 44 33
Card 82: 2 13 66 17 28 24 1 26 43 87 | 33 1 96 18 25 13 26 99 24 56 79 66 22 38 17 28 85 87 61 50 75 6 5 43 2
Card 83: 74 43 57 68 88 25 21 26 4 80 | 34 58 25 74 28 35 16 9 54 59 48 26 82 4 62 72 57 96 14 68 86 43 21 88 80
Card 84: 15 6 81 11 1 88 56 90 86 40 | 88 1 11 64 93 6 14 56 27 54 40 80 30 20 60 86 90 45 44 81 15 36 22 79 63
Card 85: 53 88 8 81 90 41 73 66 89 31 | 41 50 80 89 90 72 73 13 99 88 27 31 29 61 8 24 84 23 83 91 81 82 66 98 53
Card 86: 68 27 37 99 40 21 5 47 14 32 | 99 37 21 50 35 42 11 29 32 69 60 49 19 98 54 66 80 77 14 81 5 25 18 40 86
Card 87: 32 26 69 9 67 72 85 8 36 96 | 96 50 32 17 9 8 85 63 39 26 28 27 99 89 69 12 54 78 2 25 64 72 24 67 36
Card 88: 21 65 97 18 44 71 6 14 85 31 | 73 97 18 31 12 44 34 21 16 78 41 28 85 15 64 65 68 94 98 71 83 79 6 43 37
Card 89: 62 23 4 51 3 64 82 1 81 25 | 37 64 51 41 3 44 12 23 28 89 31 82 6 81 43 25 22 29 16 21 62 1 32 80 4
Card 90: 59 3 92 51 46 52 1 43 70 62 | 4 9 66 96 32 93 1 56 25 15 92 95 33 70 5 97 78 3 64 80 63 87 2 94 61
Card 91: 52 87 82 57 59 15 33 2 18 65 | 37 90 89 58 73 99 17 47 1 11 31 82 98 45 61 52 27 80 97 34 94 19 79 88 76
Card 92: 58 11 89 23 49 6 35 40 52 38 | 86 27 85 72 35 61 95 3 84 23 28 10 93 52 40 44 62 18 56 89 58 41 11 96 83
Card 93: 50 62 39 9 43 38 86 94 92 64 | 51 10 38 20 93 45 16 4 36 50 53 84 29 49 11 47 95 99 92 15 7 12 80 61 44
Card 94: 25 12 70 26 64 79 34 46 23 15 | 12 2 96 57 92 46 16 89 54 51 98 27 18 35 65 85 31 1 87 22 14 20 13 11 33
Card 95: 11 67 93 66 38 73 60 61 92 4 | 28 11 12 88 68 3 61 70 99 60 50 73 38 16 40 4 67 66 97 92 49 20 7 63 35
Card 96: 65 43 47 77 12 17 67 30 53 91 | 27 89 81 66 58 4 59 13 6 11 50 61 93 56 28 63 90 98 36 47 3 75 86 87 71
Card 97: 66 50 68 65 30 90 78 59 39 77 | 77 59 79 11 31 69 39 23 3 82 50 66 16 6 53 71 70 64 72 2 1 97 87 18 96
Card 98: 25 13 74 5 45 73 26 78 72 90 | 41 29 90 27 33 68 24 78 64 70 66 53 65 28 92 72 16 4 73 52 93 98 37 45 18
Card 99: 95 6 94 72 33 98 3 80 83 11 | 68 27 9 50 67 29 73 71 92 75 51 76 21 14 42 34 56 5 44 85 20 25 90 78 3
Card 100: 81 93 84 48 36 19 95 55 24 15 | 99 69 76 65 9 39 98 84 42 48 62 88 6 74 22 93 17 85 95 14 20 92 38 50 72
Card 101: 65 79 29 88 89 64 56 28 43 53 | 17 61 54 44 85 7 86 8 38 36 89 32 52 23 84 48 43 19 12 62 72 40 74 50 58
Card 102: 33 39 12 88 27 17 78 29 87 41 | 96 38 24 86 46 18 25 27 63 76 60 21 40 33 90 82 45 80 48 6 74 56 91 19 85
Card 103: 12 70 58 49 25 32 7 54 82 6 | 24 90 91 83 31 77 33 59 80 6 85 56 40 63 72 89 20 61 78 51 42 45 84 86 87
Card 104: 27 62 86 87 41 42 76 89 14 63 | 20 25 28 24 12 26 59 23 90 88 11 38 1 61 70 16 31 29 57 71 47 30 36 94 50
Card 105: 41 69 76 42 24 5 92 83 67 57 | 16 17 50 6 73 15 88 69 92 63 70 31 79 65 85 56 60 66 52 33 5 22 44 49 38
Card 106: 70 1 48 14 52 5 24 6 19 36 | 43 53 88 33 78 85 76 13 22 8 41 59 38 46 39 42 5 24 84 20 1 68 71 9 17
Card 107: 68 84 4 41 24 57 79 87 59 28 | 97 86 57 87 68 63 5 9 11 14 13 12 88 67 2 89 49 4 6 65 19 84 10 18 28
Card 108: 95 10 62 92 15 16 33 93 91 2 | 51 45 55 5 53 83 71 72 73 4 6 86 68 39 50 47 79 56 54 64 29 67 14 32 99
Card 109: 42 64 74 23 93 94 33 67 46 87 | 64 57 63 18 32 60 61 38 67 99 46 93 43 87 74 53 42 10 90 1 82 19 33 14 94
Card 110: 26 82 95 42 51 4 54 83 7 17 | 73 72 10 93 87 53 70 9 74 42 55 23 67 77 82 95 25 32 24 41 83 17 46 76 86
Card 111: 75 35 29 9 76 87 1 54 65 42 | 41 38 82 48 59 87 40 18 29 94 63 46 75 23 42 26 54 65 9 1 78 32 72 49 71
Card 112: 90 97 21 17 99 73 9 93 89 54 | 59 35 62 33 13 28 9 56 67 51 96 90 17 21 3 54 71 93 97 99 52 73 78 89 20
Card 113: 2 13 16 91 31 20 57 80 81 35 | 52 61 13 2 25 81 57 31 94 35 28 16 20 10 79 38 8 11 91 44 19 37 80 50 60
Card 114: 92 81 6 91 50 71 83 61 1 68 | 1 34 33 89 68 52 46 91 29 38 24 82 4 40 92 70 81 42 80 61 36 44 17 35 9
Card 115: 50 42 69 99 45 24 68 49 35 46 | 51 76 35 99 65 22 68 49 30 26 73 21 24 16 94 52 71 4 48 57 72 50 45 10 44
Card 116: 40 78 62 73 29 55 93 60 69 57 | 95 46 14 7 48 6 30 28 47 25 77 73 3 65 31 92 87 89 60 17 59 29 12 66 23
Card 117: 33 13 95 84 25 68 32 10 4 45 | 69 44 36 64 17 24 66 16 80 83 99 90 86 96 28 52 26 27 7 37 93 65 21 72 18
Card 118: 77 8 72 30 88 81 44 9 10 51 | 5 80 98 60 95 94 32 58 73 28 14 8 46 3 7 33 70 55 12 97 78 64 16 18 1
Card 119: 99 69 64 81 86 27 49 91 80 16 | 7 89 33 86 27 31 25 38 22 92 23 36 58 74 9 80 63 30 91 44 32 40 97 53 26
Card 120: 11 51 67 55 89 32 59 64 8 7 | 2 47 36 28 9 96 15 69 30 14 66 55 16 6 87 86 93 89 45 81 59 80 51 25 60
Card 121: 96 38 23 48 31 11 97 7 76 15 | 62 22 67 50 87 64 82 83 56 18 69 73 74 1 6 20 44 97 17 59 78 55 72 30 27
Card 122: 55 43 37 61 6 59 92 17 78 7 | 46 31 72 23 54 56 26 2 95 30 35 97 84 45 48 98 29 68 14 90 67 64 74 47 57
Card 123: 90 91 13 79 18 49 73 70 37 92 | 36 84 57 12 39 45 1 53 48 87 23 26 21 59 72 44 63 89 24 86 96 42 14 28 62
Card 124: 96 83 3 56 43 18 63 22 49 45 | 34 70 1 27 95 19 97 14 77 17 86 9 92 48 13 99 67 59 54 5 58 65 81 82 4
Card 125: 49 29 9 11 54 81 60 5 34 45 | 34 86 5 45 11 8 51 29 49 99 60 2 91 4 12 20 68 92 40 54 81 77 84 9 7
Card 126: 56 4 97 50 80 68 75 25 23 10 | 97 44 29 90 27 19 43 21 51 45 10 82 74 57 3 89 83 95 46 52 63 32 30 4 69
Card 127: 79 65 28 15 10 93 17 68 51 81 | 5 85 44 96 65 16 89 43 55 35 52 36 54 38 50 19 66 13 84 31 97 30 99 95 78
Card 128: 7 20 64 96 15 88 31 26 51 34 | 58 23 91 31 65 67 47 50 85 57 5 76 24 89 6 81 62 48 70 86 22 41 28 78 84
Card 129: 25 89 21 39 69 64 55 46 87 81 | 37 72 33 71 18 96 91 15 81 39 27 25 64 21 32 77 13 55 1 89 69 87 30 34 46
Card 130: 39 48 75 9 13 5 67 33 17 22 | 57 91 75 71 50 77 79 38 8 72 92 51 35 86 7 60 82 87 15 70 80 88 76 36 24
Card 131: 52 11 10 25 68 5 1 20 89 42 | 77 89 93 3 26 91 81 9 84 55 71 30 78 68 6 99 53 46 75 25 36 45 64 20 1
Card 132: 63 48 60 19 54 37 12 24 33 43 | 89 82 94 22 23 72 57 54 41 81 95 37 60 65 61 4 67 48 18 27 86 7 97 80 6
Card 133: 46 40 37 89 44 91 95 52 28 90 | 46 95 37 83 4 91 43 32 40 52 44 27 69 28 1 22 88 50 90 45 94 7 2 98 89
Card 134: 34 84 32 55 27 90 19 28 78 57 | 15 80 93 83 55 20 12 35 51 37 26 48 10 44 52 41 66 43 8 1 57 85 77 32 38
Card 135: 75 50 3 4 80 14 38 98 96 19 | 50 96 40 98 97 30 36 75 38 80 49 74 41 47 43 19 60 3 62 14 4 18 70 57 76
Card 136: 92 24 50 69 5 81 16 63 34 75 | 43 58 2 6 4 12 76 30 94 18 22 84 37 36 95 5 62 52 1 61 78 65 54 72 29
Card 137: 92 81 79 86 28 47 42 31 12 38 | 58 13 35 2 79 9 37 16 53 21 71 25 20 86 97 15 33 34 59 64 45 27 44 63 55
Card 138: 9 99 76 70 33 80 58 66 98 50 | 72 36 87 76 59 56 54 43 29 77 81 32 49 44 39 60 93 90 18 62 99 20 57 41 31
Card 139: 56 10 65 86 13 27 97 94 61 90 | 18 10 5 65 73 2 91 32 51 41 57 13 26 94 19 27 56 61 43 82 68 90 11 14 15
Card 140: 69 31 88 14 57 61 95 29 44 28 | 57 10 73 44 88 40 8 15 25 59 62 95 32 94 63 34 84 14 17 69 13 80 66 61 56
Card 141: 3 91 42 83 69 74 20 25 31 9 | 21 4 68 82 84 62 12 94 7 72 75 57 6 73 91 53 5 13 98 81 40 2 63 64 38
Card 142: 98 61 12 18 44 62 55 45 65 33 | 87 76 53 61 65 62 86 60 97 68 17 44 1 79 23 52 75 33 5 16 80 57 73 34 46
Card 143: 50 68 63 45 51 16 43 32 23 29 | 11 73 62 20 18 43 87 64 90 96 93 89 78 15 66 24 39 49 61 13 7 32 25 14 60
Card 144: 68 3 55 19 21 18 49 90 82 77 | 22 34 51 47 80 87 12 64 65 99 44 90 75 33 92 55 40 3 28 60 35 67 83 62 71
Card 145: 38 47 7 35 9 30 69 77 6 75 | 67 91 21 83 76 65 29 55 25 33 99 18 95 88 52 39 87 70 56 80 44 17 75 31 26
Card 146: 49 25 82 80 21 36 48 77 43 55 | 38 8 39 59 35 86 50 27 11 29 34 52 15 51 6 45 26 75 16 36 13 95 33 18 84
Card 147: 61 76 12 44 75 14 1 51 20 58 | 86 4 52 28 65 11 87 74 8 84 27 54 7 59 50 43 35 85 62 32 77 72 33 9 73
Card 148: 23 19 42 17 66 81 24 84 63 12 | 90 54 38 69 99 56 42 72 43 68 4 13 74 66 27 85 92 77 50 5 18 98 11 95 14
Card 149: 6 62 32 85 29 14 59 83 8 64 | 83 84 77 32 72 51 54 28 14 59 62 8 73 34 53 64 75 40 16 85 26 9 29 6 4
Card 150: 54 10 90 97 63 65 75 37 7 14 | 20 27 34 82 61 90 91 10 52 45 83 74 49 73 50 57 84 54 30 77 87 76 70 2 56
Card 151: 84 54 21 35 6 18 37 10 92 96 | 77 10 9 54 24 17 29 19 75 41 71 33 96 30 16 61 79 83 49 58 37 92 18 90 65
Card 152: 63 54 15 25 28 57 95 76 39 32 | 89 1 34 20 6 29 87 77 40 59 68 9 66 24 71 42 19 79 80 83 21 58 25 91 98
Card 153: 13 65 79 30 86 10 37 6 76 23 | 23 65 70 58 13 50 10 27 78 24 79 7 80 92 76 54 94 71 37 64 18 35 6 51 67
Card 154: 78 73 95 27 33 12 53 45 3 30 | 46 55 29 53 74 99 41 21 51 94 34 82 76 65 14 62 28 9 88 73 59 98 86 91 32
Card 155: 52 5 3 41 44 83 24 55 30 26 | 83 34 10 20 30 43 61 92 51 50 24 8 80 85 23 21 64 26 48 89 35 59 77 3 86
Card 156: 33 69 20 28 34 65 25 43 29 8 | 75 34 14 69 43 92 2 78 5 10 62 28 65 24 20 77 81 66 25 48 27 19 33 56 60
Card 157: 46 98 48 76 6 39 70 64 29 91 | 85 32 26 63 27 15 2 1 59 11 3 96 7 55 17 34 29 8 39 56 92 91 21 58 49
Card 158: 54 48 39 52 68 85 81 7 18 19 | 22 50 70 21 67 61 56 16 29 88 49 46 97 13 77 83 69 87 59 20 31 43 9 37 63
Card 159: 74 92 91 89 87 88 44 47 61 8 | 43 27 69 85 90 75 66 31 42 30 79 24 32 82 86 62 17 45 84 21 6 25 70 83 81
Card 160: 94 5 4 18 27 63 15 40 65 82 | 33 19 26 8 72 57 24 65 42 92 34 66 70 78 67 56 43 28 73 60 46 61 15 96 54
Card 161: 41 58 72 86 59 47 37 42 35 23 | 9 94 47 89 12 23 77 44 54 97 49 13 90 56 48 43 4 61 18 39 34 82 30 51 41
Card 162: 42 89 41 24 28 5 9 94 19 72 | 21 34 7 98 90 67 58 77 87 40 65 23 81 4 88 30 48 22 1 59 95 75 53 14 35
Card 163: 52 88 85 4 6 56 16 32 8 39 | 2 12 65 20 47 15 70 59 45 1 69 64 94 73 38 44 53 28 46 18 8 33 87 82 7
Card 164: 27 6 45 25 66 55 41 72 86 68 | 47 37 77 13 88 15 10 53 80 71 82 7 87 74 23 67 99 28 63 21 59 56 5 2 81
Card 165: 36 98 92 66 23 70 58 12 52 9 | 76 31 25 46 88 74 55 93 38 50 63 6 4 83 96 86 11 94 10 43 42 57 29 26 89
Card 166: 23 5 8 55 86 36 18 82 74 83 | 58 27 93 2 44 13 75 62 40 43 95 84 65 38 85 25 73 14 67 57 66 33 26 42 28
Card 167: 89 13 70 15 43 33 71 20 88 74 | 84 81 33 83 70 37 47 77 32 73 71 98 36 13 89 43 74 97 59 2 44 7 79 20 91
Card 168: 67 34 96 36 45 75 58 64 12 57 | 4 41 67 21 12 61 5 31 42 69 71 1 45 96 51 6 46 93 58 89 83 27 65 98 34
Card 169: 68 96 58 37 13 54 98 62 72 47 | 96 29 78 53 22 6 51 7 77 18 21 38 5 81 33 99 14 41 89 42 32 73 10 19 95
Card 170: 26 56 34 50 67 90 98 38 92 84 | 90 26 39 58 67 92 53 72 34 56 59 4 55 47 87 21 93 89 62 14 84 33 43 98 78
Card 171: 77 31 95 28 55 80 39 58 70 63 | 49 85 71 90 50 21 70 95 77 46 72 36 31 39 61 55 86 38 1 18 97 63 34 28 78
Card 172: 75 42 65 62 12 4 52 39 16 70 | 58 48 44 8 39 89 57 97 15 27 61 33 56 18 76 66 60 9 80 40 32 24 65 94 42
Card 173: 90 43 15 5 49 6 77 78 75 48 | 59 66 68 5 72 10 35 51 58 73 39 27 1 3 85 9 41 78 82 79 56 67 43 74 89
Card 174: 13 67 25 93 58 35 84 20 57 60 | 43 61 80 68 81 58 15 1 37 12 18 71 34 3 11 6 22 89 27 29 76 79 7 30 54
Card 175: 98 52 9 42 48 96 16 3 83 88 | 59 16 25 5 88 53 9 1 57 14 86 11 93 68 36 23 71 48 75 10 72 89 47 30 24
Card 176: 37 7 4 12 66 55 18 89 86 67 | 91 66 13 88 64 89 7 83 41 43 3 79 82 17 80 96 39 72 90 65 60 54 74 22 45
Card 177: 35 66 6 82 39 19 83 84 15 90 | 90 5 34 88 71 37 43 84 2 49 12 30 25 56 51 80 31 4 55 82 23 96 38 94 95
Card 178: 46 75 56 60 63 88 21 7 47 34 | 70 17 53 1 95 84 47 15 19 93 59 33 61 76 41 16 14 87 89 13 99 81 79 85 25
Card 179: 73 43 9 40 72 71 76 97 49 90 | 47 17 74 40 60 2 5 19 52 26 23 24 20 27 70 15 55 81 66 79 65 22 33 53 92
Card 180: 21 81 83 98 58 74 1 68 61 59 | 28 22 80 87 6 67 41 45 13 70 72 2 48 44 18 84 55 8 4 39 64 50 36 62 49
Card 181: 81 82 34 45 30 55 35 78 31 79 | 43 80 82 18 29 61 87 32 79 54 11 89 35 45 34 86 60 27 91 50 85 75 1 78 30
Card 182: 69 64 85 73 12 30 4 15 25 61 | 91 23 46 30 11 48 42 74 73 69 79 85 4 92 31 66 12 35 25 75 61 37 8 15 64
Card 183: 46 73 91 69 96 68 25 50 83 81 | 80 46 5 69 81 50 25 38 98 23 91 90 36 74 96 12 32 43 89 57 87 4 73 6 85
Card 184: 5 28 57 86 65 74 34 3 20 17 | 74 20 79 65 54 5 86 99 7 34 60 57 28 19 93 40 85 50 44 26 70 3 39 17 77
Card 185: 46 97 73 40 44 82 70 12 76 41 | 13 70 6 88 40 36 55 51 84 32 98 12 46 81 73 71 76 65 64 2 49 44 39 21 29
Card 186: 9 53 64 55 49 56 93 88 6 65 | 78 81 5 66 40 49 99 70 67 16 88 93 55 24 9 83 51 32 12 56 54 60 53 84 85
Card 187: 90 23 44 48 52 34 93 14 26 43 | 6 14 79 22 45 99 52 42 4 34 62 61 93 38 75 39 17 94 49 77 51 68 8 86 88
Card 188: 16 90 95 42 85 14 63 13 58 98 | 72 77 98 5 89 7 76 29 74 14 45 23 24 99 61 58 60 13 95 21 44 3 10 26 15
Card 189: 39 72 84 65 92 58 10 26 33 90 | 68 53 70 46 42 35 4 58 29 97 27 21 43 26 37 93 82 22 66 20 89 41 79 47 15
Card 190: 98 2 57 3 94 88 13 69 38 82 | 47 96 29 14 16 75 91 74 88 31 77 25 89 95 54 57 33 20 18 10 17 93 37 9 71
Card 191: 2 91 57 68 69 13 51 55 9 60 | 32 95 41 67 38 83 58 61 18 63 7 89 21 81 29 28 80 43 64 14 85 78 50 70 92
Card 192: 90 58 30 43 78 54 32 70 45 17 | 28 92 5 42 97 34 80 60 71 69 38 67 7 87 6 70 36 85 12 18 32 86 29 98 68
Card 193: 89 3 79 67 84 59 65 35 88 92 | 69 75 61 47 11 22 43 33 70 74 78 23 86 19 30 14 15 62 8 13 56 48 80 1 51
Card 194: 53 6 40 19 13 38 47 7 26 90 | 72 64 10 92 46 65 58 99 81 40 50 61 36 62 71 95 73 79 18 87 2 66 86 80 42
Card 195: 78 33 64 30 10 68 18 86 83 42 | 44 9 74 99 67 40 90 55 38 73 69 88 4 15 2 27 77 72 71 48 94 60 65 84 98
Card 196: 51 64 16 76 21 48 58 99 46 69 | 79 26 55 70 20 71 44 80 97 63 29 25 1 50 8 10 78 68 61 13 36 49 84 81 6

6
src/input/day04_test1 Normal file
View File

@@ -0,0 +1,6 @@
Card 1: 41 48 83 86 17 | 83 86 6 31 17 9 48 53
Card 2: 13 32 20 16 61 | 61 30 68 82 17 32 24 19
Card 3: 1 21 53 59 44 | 69 82 63 72 16 21 14 1
Card 4: 41 92 73 84 69 | 59 84 76 51 58 5 54 83
Card 5: 87 83 26 28 32 | 88 30 70 12 93 22 82 36
Card 6: 31 18 13 56 72 | 74 77 10 23 35 67 36 11

6
src/input/day04_test2 Normal file
View File

@@ -0,0 +1,6 @@
Card 1: 41 48 83 86 17 | 83 86 6 31 17 9 48 53
Card 2: 13 32 20 16 61 | 61 30 68 82 17 32 24 19
Card 3: 1 21 53 59 44 | 69 82 63 72 16 21 14 1
Card 4: 41 92 73 84 69 | 59 84 76 51 58 5 54 83
Card 5: 87 83 26 28 32 | 88 30 70 12 93 22 82 36
Card 6: 31 18 13 56 72 | 74 77 10 23 35 67 36 11

239
src/input/day05 Normal file
View File

@@ -0,0 +1,239 @@
seeds: 91926764 235794528 3279509610 325625103 2781720183 218217413 1315129829 102999617 3995609239 143268116 358337926 185836835 1543999077 241888600 1795811745 806228439 2616560939 56204204 869828854 224520829
seed-to-soil map:
2076625497 3385713231 258448094
933162806 1124446801 128749435
744984268 625015359 188178538
551924411 211563684 96582495
2664738738 2072311374 297142807
1406760174 813193897 14102104
0 1274151473 331435427
403777493 976299883 148146918
1987639580 2783535044 88985917
4074594902 3332858447 52854784
1484055780 86124597 125439087
331435427 371339681 72342066
1146768491 1605586900 152911849
3283022369 2992105862 70998045
648506906 528537997 96477362
1609494867 827296001 149003882
3685297224 3111036616 121638972
1420862278 308146179 63193502
2961881545 3644161325 321140824
1061912241 443681747 56957522
4127449686 2872520961 119584901
3806936196 2497318144 139794743
3585114365 3232675588 100182859
1118869763 500639269 27898728
2335073591 3965302149 329665147
3984585308 2407308550 90009594
1320635577 0 86124597
1841217423 2637112887 146422157
4247034587 3063103907 47932709
1299680340 1253196236 20955237
3354020414 1841217423 231093951
3946730939 2369454181 37854369
soil-to-fertilizer map:
3384134166 1995234330 176305237
1155226403 855999534 411447090
2208613005 3459130785 737289315
3115190977 2188772380 56379264
3046023331 2245151644 69167646
3287350250 3362346869 96783916
0 688893976 167105558
199962926 1300303992 576627555
1566673493 0 380943110
1995234330 2314319290 213378675
776590481 380943110 307950866
3560439403 2527697965 734527893
2945902320 3262225858 100121011
1084541347 1876931547 70685056
3229639031 4196420100 40478406
3270117437 2171539567 17232813
167105558 1267446624 32857368
3171570241 4236898506 58068790
fertilizer-to-water map:
2261570026 3454758517 88568015
1802864872 1796719466 196521844
1029796290 924285105 94936250
1502956048 1019221355 34573577
1675836952 4234138393 33837263
383249040 0 273576862
1124732540 457794332 53985776
2350138041 2091507351 48912742
1674136750 1795019264 1700202
3859927050 2781536522 163983633
90982234 273576862 129799649
1537529625 511780108 260859
2488789087 1993241310 98266041
2196492990 3543326532 49319261
2254009624 2694827028 7560402
2587055128 3111811340 69748037
2002799677 4168500219 65638174
840643879 512040967 108011574
1390364751 688875858 8559931
1398924682 721632529 104031366
656825902 620052541 68823317
1709674215 3189756750 73094246
2068437851 1671843595 123175669
73501861 906804732 17480373
2656803165 3853597757 225164158
3592079857 3612742204 240855553
2191613520 2945520155 4879470
2881967323 2950399625 161411715
0 1085334645 69517503
725649219 697435789 24196740
2245812251 3181559377 8197373
220781883 1375323327 162467157
3270779999 2140420093 321299858
2399050783 4078761915 89738304
4023910683 2702387430 79149092
69517503 1053794932 3984358
1782768461 3592645793 20096411
1308391575 1057779290 27555355
749845959 1154852148 61727890
1671843595 2692533873 2293155
1335946930 403376511 54417821
3832935410 4267975656 26991640
3043379038 2461719951 227400961
948655453 825663895 81140837
4103059775 3262850996 191907521
1999386716 2689120912 3412961
1178718316 1216580038 129673259
811573849 1346253297 29070030
water-to-light map:
12536522 803922375 381092756
1034093555 2274122448 375903462
4046347183 3727145496 30218294
1644177017 1468743601 210972620
2033158562 0 65899273
3918690677 4044943223 48984895
3252369528 2650025910 46811980
3846317697 4159436488 72372980
825337225 701230416 92775221
708443948 3110054761 116893277
4281152040 4231809468 13815256
4076565477 3945094008 99849215
467053271 262914333 56912139
457136533 794005637 9916738
4176414692 3757363790 104737348
1960807084 319826472 72351478
3983208893 4096298198 63138290
2099057835 2696837890 179036871
3400708401 4093928118 2370080
393629278 2210615193 63507255
2278094706 1723463860 487151333
3351365829 4245624724 49342572
523965410 65899273 184478538
1855149637 595572969 105657447
2765246039 1185015131 283728470
961860085 3226948038 72233470
3967675572 3711612175 15533321
3486071351 3351365829 360246346
3403078481 3862101138 82992870
918112446 1679716221 43747639
1409997017 2875874761 234180000
0 250377811 12536522
3048974509 392177950 203395019
light-to-temperature map:
3663115998 2273256818 16619810
1779396221 3140211126 35421643
1671064478 2289876628 5675989
2459496143 2164474153 65282060
1676740467 3228344832 68171740
3108268812 3396614149 34367621
0 1247024027 117995309
3142636433 2302123739 520479565
3914906966 3296516572 48028032
1451315146 20271696 29756177
3962934998 1685507004 235533336
3679735808 3872604190 235171158
201522431 0 20271696
2606764356 2257434699 15822119
1095940165 930151315 235007724
2092197835 2032400258 15603728
1814817864 4107775348 187191948
2107801563 3430981770 351694580
221794127 50027873 874146038
2524778203 2082488000 81986153
4205039456 3811944039 60660151
2622586475 1921040340 111359918
3051554215 3344544604 52069545
1605883623 1648004635 37502369
3103623760 1643359583 4645052
1412812877 1442569054 38502269
2039485772 3175632769 52712063
123972713 1365019336 77549718
1744912207 2048003986 34484014
4198468334 2295552617 6571122
2733946393 2822603304 317607822
117995309 924173911 5977404
1330947889 1165159039 81864988
2002009812 1605883623 37475960
4265699607 3782676350 29267689
1643385992 2229756213 27678486
temperature-to-humidity map:
1358631653 987873070 147949589
2413964705 2097965649 70341317
816457527 972386794 15486276
2080824412 2168306966 250363611
958855341 2055074721 42890928
1948315905 1968747613 86327108
1810667112 2669632213 137648793
2484306022 857156868 115229926
1001746269 1523646763 356885384
1641013697 687503453 169653415
2698691839 0 56146061
4138641394 2975929973 156325902
831943803 2418670577 38696072
3039761928 4068116224 226851072
870639875 1880532147 88215466
2975929973 3132255875 63831955
3839900820 3497181952 298740574
3567707122 3795922526 272193698
3266613000 3203991608 293190344
83162889 56146061 361318942
1506581242 553070998 134432455
2754837900 500627892 52443106
2034643013 1135822659 46181399
786124536 2556522540 30332991
2599535948 2457366649 99155891
3559803344 3196087830 7903778
0 417465003 83162889
444481831 1182004058 341642705
2331188023 2586855531 82776682
humidity-to-location map:
1050996268 1532072704 311260544
3180071790 2724566227 289337188
4221284312 3899164493 35309413
3807278034 2656088631 16719113
1362256812 2203016881 453071750
338253566 1843333248 359683633
697937199 1009396889 40111814
2970507299 3589172780 195028044
2338906915 3808103383 1357317
1879134746 3052743004 5325923
1815328562 346829408 63806184
3899164493 3972847477 185700981
2340264232 0 83356697
2610350026 3013903415 38839589
0 671143323 338253566
2423620929 3402443683 186729097
738049013 1049508703 312947255
1884460669 561071833 110071490
3714686766 254238140 92591268
3469408978 1362455958 169616746
2799625856 83356697 170881443
3639025724 3784200824 23902559
4084865474 4158548458 136418838
1994532159 3058068927 344374756
4256593725 3934473906 38373571
3165535343 3809460700 14536447
2649189615 410635592 150436241
3662928283 2672807744 51758483

33
src/input/day05_test1 Normal file
View File

@@ -0,0 +1,33 @@
seeds: 79 14 55 13
seed-to-soil map:
50 98 2
52 50 48
soil-to-fertilizer map:
0 15 37
37 52 2
39 0 15
fertilizer-to-water map:
49 53 8
0 11 42
42 0 7
57 7 4
water-to-light map:
88 18 7
18 25 70
light-to-temperature map:
45 77 23
81 45 19
68 64 13
temperature-to-humidity map:
0 69 1
1 0 69
humidity-to-location map:
60 56 37
56 93 4

33
src/input/day05_test2 Normal file
View File

@@ -0,0 +1,33 @@
seeds: 79 14 55 13
seed-to-soil map:
50 98 2
52 50 48
soil-to-fertilizer map:
0 15 37
37 52 2
39 0 15
fertilizer-to-water map:
49 53 8
0 11 42
42 0 7
57 7 4
water-to-light map:
88 18 7
18 25 70
light-to-temperature map:
45 77 23
81 45 19
68 64 13
temperature-to-humidity map:
0 69 1
1 0 69
humidity-to-location map:
60 56 37
56 93 4

2
src/input/day06 Normal file
View File

@@ -0,0 +1,2 @@
Time: 59 70 78 78
Distance: 430 1218 1213 1276

2
src/input/day06_test1 Normal file
View File

@@ -0,0 +1,2 @@
Time: 7 15 30
Distance: 9 40 200

2
src/input/day06_test2 Normal file
View File

@@ -0,0 +1,2 @@
Time: 7 15 30
Distance: 9 40 200

1000
src/input/day07 Normal file

File diff suppressed because it is too large Load Diff

5
src/input/day07_test1 Normal file
View File

@@ -0,0 +1,5 @@
32T3K 765
T55J5 684
KK677 28
KTJJT 220
QQQJA 483

5
src/input/day07_test2 Normal file
View File

@@ -0,0 +1,5 @@
32T3K 765
T55J5 684
KK677 28
KTJJT 220
QQQJA 483

716
src/input/day08 Normal file
View File

@@ -0,0 +1,716 @@
LRRRLRRRLRRLRLRRLLRRLLRLRRRLRRLRRRLRRLLRLRLRRRLRLLRRRLLRLRRRLRLRRRLRRRLRRRLRRRLRLLLRRRLRRLRRLRRRLRLRLRRLRLRRRLRLRLRLRRRLRRLRLRRRLRRLRRRLRRLLRRRLLRLLRLRRRLRLLRRLLRRRLRLLRRLRLRRLRRRLRLRLRLLRLRRRLRRRLRLLLRRRLRLRRRLRRLRRLLLLRLRRRLRLRRRLLRRRLRRRLRRRLLLRLRLRLLLLRRRLRRLRRRLRLRLRLRRRLRLRRRR
VJN = (LNC, RRK)
MJD = (HFS, VBQ)
GHK = (BDH, QGD)
GQG = (JVH, RGR)
RDL = (QPQ, CNG)
BDV = (JGN, RGX)
TFD = (XLG, NQT)
CVF = (DJM, PPL)
PSD = (BCF, RRX)
BLZ = (LPN, XVJ)
BFJ = (TGL, BXH)
PQM = (PDV, FPS)
BKF = (KMG, SGP)
RDF = (MJD, DKQ)
DCF = (BHS, QLT)
KCP = (JCM, MNP)
CDG = (HHP, GRD)
XDB = (XVQ, VHN)
ZZZ = (MTL, KNJ)
MPK = (SXH, GFC)
GLV = (HMD, QTM)
HMD = (QDQ, RKK)
TTS = (XGQ, TFD)
NHD = (BDV, XQJ)
RRL = (SNF, GQG)
PHN = (TDJ, JSG)
NXP = (GVF, FHP)
SFX = (KSN, MXH)
XQL = (MDH, GHK)
PBA = (RVX, RFP)
LLN = (KKM, DMV)
LLK = (XXH, HRX)
LQF = (TXG, GXX)
JGD = (NHQ, FHM)
VMH = (NMK, KVC)
SVD = (TTS, FTS)
VMS = (FMF, CDD)
RGR = (XQB, XVC)
VTF = (MMF, FVC)
HVC = (RDT, LJH)
MXG = (KGF, NST)
GQN = (NGC, RSC)
RKN = (KXL, CCR)
DDD = (NKM, JKX)
DGF = (NNJ, NLC)
TFV = (FGC, JTQ)
CFK = (LSC, JFX)
HPG = (JHQ, PLV)
RSL = (RFJ, FCJ)
JSG = (DRM, KHD)
XBK = (NST, KGF)
QQD = (RND, LCX)
DJD = (QHF, KQJ)
LFP = (QVN, CVF)
TRB = (KTH, DDD)
KJX = (KLJ, HCS)
FPR = (SVC, NXM)
RDR = (TSN, BPL)
LNC = (TXR, LGB)
SKV = (MCX, PTV)
KCF = (NGC, RSC)
SFH = (MRD, TNL)
RPR = (KKM, DMV)
HXH = (LLN, RPR)
JLS = (LFT, PNR)
LCX = (QVG, MCT)
KGV = (NMB, KJN)
KKM = (JLC, SKV)
GXX = (QXJ, QNJ)
CTH = (JRH, GHR)
QVN = (PPL, DJM)
NGM = (TMK, VNN)
TJF = (LSS, LPS)
NNJ = (NKJ, VHH)
GNS = (PVJ, LMF)
SPP = (NQM, NQM)
FCV = (XHF, QPD)
HJX = (VLV, XQF)
SVC = (DPK, QVV)
KHD = (TMN, LCB)
NQM = (NRS, NRS)
MHD = (XGH, DJD)
NVG = (KVM, KPJ)
DJM = (FNG, HXS)
TVJ = (KCV, QFK)
CMV = (VPV, NNM)
DQR = (KNX, FJM)
XXH = (JPV, XLP)
GQQ = (LHB, BTF)
JPM = (SNM, DDX)
GFS = (VCL, QCN)
JMH = (RMP, BFJ)
VBQ = (HMV, XNS)
RPQ = (JFP, JKF)
GQV = (MRT, LMQ)
HGX = (JRR, LDL)
VRC = (FXJ, VNK)
XHF = (JMJ, DTV)
KFD = (BTM, PQT)
NKM = (MXJ, MMR)
CXX = (VRC, XBJ)
SXK = (KTM, DSB)
NQF = (TSV, DTT)
RND = (MCT, QVG)
LFX = (TMF, VTF)
SXS = (PCC, RVJ)
MKF = (SHQ, VSG)
PFQ = (SJX, GLV)
SGT = (NVV, QPT)
NXM = (DPK, QVV)
DGL = (NFM, TPX)
JTQ = (LMM, HSM)
DFL = (DQC, DJG)
MXH = (NXL, THH)
HPV = (GFX, CTH)
LSC = (PNB, HXX)
VFQ = (PTM, KGC)
GLP = (BQF, NKQ)
DDX = (QQD, QKV)
HRX = (XLP, JPV)
KJL = (GSH, HHF)
HJN = (PKS, ZZZ)
FPS = (QBL, GNG)
HLS = (PDT, HGT)
XHT = (LFB, FDC)
RCC = (VKG, TJF)
NXL = (XNH, XNH)
PDX = (FHR, SSC)
JPL = (SSC, FHR)
CNH = (DTM, TTT)
CJB = (KPJ, KVM)
GHX = (QLD, GHQ)
MSG = (MXG, XBK)
PQQ = (QPT, NVV)
QGG = (MQR, MQR)
QBL = (SPP, JHH)
FQQ = (VQD, KJX)
QRD = (LQD, RKN)
JKD = (FVD, BXL)
DJX = (XVK, JJH)
LCV = (RRL, CHK)
BCF = (NRG, MRL)
TXR = (XQK, PGF)
BDH = (KMK, BVK)
GTK = (KSN, MXH)
HHP = (PMP, PFQ)
QLD = (PTH, RDF)
RFJ = (MHD, SPL)
KFR = (SHF, SHF)
VBD = (JCC, LDD)
MVL = (HST, GRL)
SHK = (XHT, RLT)
XQB = (MVJ, QQM)
LQD = (KXL, CCR)
DMS = (LMK, LSK)
FXQ = (GRL, HST)
MXJ = (HGX, FVB)
FHM = (SPN, HQJ)
MKB = (FCD, FCD)
QDD = (VLN, HCB)
PTF = (DQC, DJG)
RFH = (JHJ, PHN)
GRD = (PMP, PFQ)
DMD = (MMP, GLP)
HCQ = (JQG, FLR)
VPV = (TRG, BQQ)
PDV = (QBL, GNG)
CCT = (GMX, KCP)
BCV = (DJX, DKC)
VKG = (LSS, LPS)
NGH = (TDQ, PHM)
JVM = (KJK, GQQ)
KMG = (MFS, QST)
MPD = (LLF, PQN)
QHK = (PNR, LFT)
HHK = (RCC, HGD)
MTL = (MVX, PJX)
PJM = (NFM, TPX)
BTM = (QKX, FRC)
QKM = (NHQ, FHM)
XVF = (PQN, LLF)
NHG = (BSG, VBD)
KQJ = (XDB, BVX)
XKL = (QLC, LFP)
VXX = (QLT, BHS)
MVJ = (DLL, JTX)
SJP = (BTM, PQT)
QRT = (HHP, GRD)
XFM = (LSC, JFX)
RQH = (NGH, RPH)
QDG = (TQS, MJR)
PQT = (FRC, QKX)
FHR = (SCF, FCV)
DTV = (XHV, HXM)
RGX = (RXQ, NGM)
XVM = (RKN, LQD)
KPV = (RLJ, LVJ)
NRG = (JLM, SJG)
NPD = (RCP, HJN)
KLJ = (DXV, PMS)
LSJ = (GXX, TXG)
QLJ = (KXS, DSS)
SGP = (MFS, QST)
PSB = (HMX, JNQ)
VNK = (JTK, QLJ)
JVH = (XQB, XVC)
GHR = (CRS, TLK)
FCD = (VMX, VMX)
JTX = (MCC, NPT)
TDJ = (DRM, KHD)
MFR = (HHC, BLZ)
SNF = (JVH, RGR)
JVQ = (RSQ, RFB)
BHL = (BNM, GNS)
QGB = (KJN, NMB)
KTM = (GPC, MCH)
TJP = (MRT, LMQ)
MRD = (BMJ, NDV)
LKS = (SXN, XBX)
QHT = (NHD, KBM)
VSN = (CNH, RHC)
SKG = (BCP, JLJ)
JMB = (PDV, FPS)
DSS = (FPP, HDH)
JRH = (CRS, TLK)
LSA = (VRQ, RDR)
FRC = (KPV, MTN)
JMJ = (XHV, HXM)
RRX = (MRL, NRG)
FTS = (XGQ, TFD)
QTS = (FMP, QDD)
RQK = (JFP, JKF)
XTS = (JCT, VGN)
KKZ = (GDB, LRB)
NDV = (LMX, VSH)
PNB = (QGG, QGG)
FPF = (XLQ, RSL)
QFK = (RXL, GHD)
MRS = (NVG, CJB)
RCP = (PKS, PKS)
HDH = (HBB, PGM)
TMF = (FVC, MMF)
PKS = (KNJ, MTL)
FVB = (LDL, JRR)
VSA = (XVJ, LPN)
BTD = (TQS, MJR)
FPP = (PGM, HBB)
NMB = (BQR, LLK)
SXM = (QQG, VMS)
LDL = (CDG, QRT)
HQJ = (RBL, TMD)
QFG = (RHJ, MKF)
CPX = (NRS, GFH)
QQF = (SKG, RKL)
SSC = (FCV, SCF)
KXH = (VDQ, RFN)
KVM = (DMS, NXK)
DBJ = (GQN, KCF)
VDQ = (BDL, JBM)
LSK = (CHB, JMH)
KBM = (BDV, XQJ)
QVA = (QRD, XVM)
PLV = (PQQ, SGT)
FVG = (FXQ, MVL)
QXJ = (FMJ, KBH)
VQD = (HCS, KLJ)
PCC = (BGT, HFQ)
JTK = (KXS, DSS)
QHF = (BVX, XDB)
MRL = (SJG, JLM)
NMK = (PXS, QQF)
LMX = (HPV, TVR)
PTV = (CCT, SBB)
MHV = (TJP, GQV)
GTX = (GQV, TJP)
KCT = (SRH, GFS)
SNS = (FPF, SLF)
BCP = (RQH, PCB)
RRK = (TXR, LGB)
DQM = (SXH, GFC)
VLJ = (CMR, BDX)
QLT = (KVJ, SNS)
QTM = (RKK, QDQ)
QQG = (FMF, CDD)
DST = (BKF, FJD)
RGZ = (RFP, RVX)
SBB = (GMX, KCP)
DTT = (PTF, DFL)
FHP = (LNF, FSK)
FCH = (FQQ, LXM)
LMQ = (XTB, HGC)
HHF = (SDS, NPD)
HXX = (QGG, BBB)
PGM = (PGC, KTS)
FXJ = (JTK, QLJ)
RBQ = (LDJ, NKP)
XTQ = (SLN, LTR)
NGK = (KBJ, MSD)
RVR = (RTX, MRS)
JCT = (MDX, HFB)
LHB = (CTX, JBL)
RSQ = (CJF, TVJ)
BQF = (XKL, NKK)
HXM = (BQB, GLF)
KDJ = (DMD, GHC)
MQB = (FDF, VJN)
AAA = (KNJ, MTL)
XVC = (QQM, MVJ)
PMP = (SJX, GLV)
XPQ = (RLS, HJX)
LMF = (TCQ, FQT)
CNG = (GTX, MHV)
LDJ = (THB, RDL)
XVQ = (PFM, NHG)
DKQ = (VBQ, HFS)
SJV = (FHP, GVF)
HMX = (HVC, NBN)
SJX = (HMD, QTM)
QVG = (FHJ, LFX)
NVK = (QHT, PTS)
KPJ = (NXK, DMS)
RBX = (VJN, FDF)
MRT = (HGC, XTB)
FMF = (LSJ, LQF)
JRR = (CDG, QRT)
RTX = (NVG, CJB)
HST = (NVX, SBC)
TDQ = (SMT, FCK)
KTS = (CKV, MTP)
TMD = (KGV, QGB)
MDL = (XHT, RLT)
PTH = (MJD, DKQ)
RFB = (CJF, TVJ)
CDD = (LSJ, LQF)
PTS = (NHD, KBM)
NPX = (KCF, GQN)
KBH = (DST, HTK)
QPQ = (MHV, GTX)
NXK = (LMK, LSK)
THF = (MSD, KBJ)
KJN = (LLK, BQR)
LXC = (RFB, RSQ)
KGC = (RXC, PFX)
RLT = (FDC, LFB)
DPK = (SCC, XCG)
NST = (VHJ, XPQ)
FNG = (DDL, CPP)
XQK = (JCJ, BCV)
JCC = (DQR, GPL)
TJB = (SHF, KPB)
GMX = (MNP, JCM)
SXH = (VSN, KGL)
KFB = (MDD, XDH)
QVV = (XCG, SCC)
RXQ = (VNN, TMK)
NXN = (SJP, KFD)
DXV = (KCB, BPN)
KVC = (QQF, PXS)
TMN = (FKX, GLJ)
BQQ = (HHK, QBC)
RVX = (RNG, KXH)
NQT = (KFB, QBQ)
XGH = (KQJ, QHF)
VQZ = (RDR, VRQ)
LPN = (SPT, XKD)
JNQ = (NBN, HVC)
RRN = (KJL, TFJ)
HHG = (CMV, PHV)
VHJ = (RLS, HJX)
KPB = (NSL, KKZ)
KMK = (LCV, TPV)
TPX = (SQK, RFH)
KTH = (JKX, NKM)
VMX = (QRD, XVM)
RBL = (QGB, KGV)
NBN = (LJH, RDT)
RLJ = (SGG, RRN)
HMV = (DBJ, NPX)
FJM = (SGM, SQV)
XVK = (RQJ, QPF)
DDN = (DSB, KTM)
PFM = (VBD, BSG)
HFS = (XNS, HMV)
BVX = (VHN, XVQ)
HFB = (VFQ, HBS)
MTP = (GHX, MFF)
GLF = (SLD, NQF)
MSD = (MPK, DQM)
LLB = (GHC, DMD)
KFV = (JCT, VGN)
FJD = (SGP, KMG)
PGC = (CKV, MTP)
KCB = (THF, NGK)
GFC = (KGL, VSN)
SLN = (BHL, SPG)
LFT = (LLB, KDJ)
PFX = (DMH, NXJ)
GRL = (NVX, SBC)
XLQ = (FCJ, RFJ)
DKD = (FXQ, MVL)
SLF = (RSL, XLQ)
BXH = (GFK, QXX)
LLF = (JKD, LNN)
TSN = (TTM, JPM)
RFQ = (QHT, PTS)
KSK = (XFB, PSD)
TCQ = (MKB, MKB)
SLD = (DTT, TSV)
VRQ = (BPL, TSN)
GBB = (XBK, MXG)
THH = (XNH, PDM)
QCN = (QHK, JLS)
TQS = (MSG, GBB)
QNJ = (KBH, FMJ)
MCX = (CCT, SBB)
NKK = (LFP, QLC)
QKX = (KPV, MTN)
XSZ = (XVM, QRD)
TMK = (XTQ, VCR)
LDD = (DQR, GPL)
GHC = (GLP, MMP)
QXX = (KCM, QTS)
JLJ = (RQH, PCB)
LJH = (GFN, VLJ)
PKG = (PDT, HGT)
KGF = (XPQ, VHJ)
FBC = (NXM, SVC)
DDL = (VCX, VXC)
CMR = (XTS, KFV)
NGC = (FPR, FBC)
PCL = (RVX, RFP)
THB = (CNG, QPQ)
LMM = (KCH, VMH)
PXS = (SKG, RKL)
LXM = (VQD, KJX)
TXG = (QNJ, QXJ)
JLM = (RBQ, CLX)
PJX = (GXH, SVD)
DJG = (DCF, VXX)
CKV = (MFF, GHX)
CTX = (MQB, RBX)
SHF = (NSL, NSL)
GDB = (PDX, JPL)
QPT = (NJH, QFG)
GPC = (SJV, NXP)
XNH = (QXN, QXN)
JLC = (MCX, PTV)
NJH = (MKF, RHJ)
RQJ = (SFX, GTK)
SNM = (QKV, QQD)
LNN = (FVD, BXL)
MFS = (HLS, PKG)
PHV = (VPV, NNM)
XNS = (DBJ, NPX)
VCG = (VMS, QQG)
KJJ = (FLR, JQG)
LCB = (FKX, GLJ)
BTF = (CTX, JBL)
RKK = (DGL, PJM)
GFH = (PCL, RGZ)
VHH = (SXM, VCG)
RFP = (RNG, KXH)
BNM = (PVJ, LMF)
BPH = (MDL, SHK)
JFP = (TRB, KGQ)
NLR = (NNJ, NLC)
TRG = (QBC, HHK)
BMJ = (LMX, VSH)
HBB = (KTS, PGC)
KSN = (NXL, NXL)
FCK = (LQL, LKS)
LSS = (JJD, VRT)
TSV = (DFL, PTF)
RFN = (BDL, JBM)
XKD = (SFH, SVJ)
QBQ = (MDD, XDH)
SQV = (VBL, MTD)
MMF = (HHG, GLS)
FCJ = (SPL, MHD)
XQJ = (RGX, JGN)
BRB = (KJK, GQQ)
JGN = (RXQ, NGM)
SHQ = (FBN, XQL)
RQG = (LBQ, SXS)
PCB = (RPH, NGH)
KBJ = (DQM, MPK)
JPV = (BFS, CXX)
CRS = (QKM, JGD)
LNF = (SST, BPH)
JCM = (XVF, MPD)
KXN = (KJJ, HCQ)
RSC = (FPR, FBC)
KGQ = (DDD, KTH)
RDT = (GFN, VLJ)
RXL = (JVM, BRB)
PHM = (SMT, FCK)
QQM = (JTX, DLL)
CHK = (GQG, SNF)
GVF = (FSK, LNF)
PDM = (QXN, VQZ)
FVD = (KFR, KFR)
MTN = (RLJ, LVJ)
NFM = (RFH, SQK)
BXL = (KFR, TJB)
LGB = (PGF, XQK)
BHS = (SNS, KVJ)
SPN = (TMD, RBL)
XBX = (FVG, DKD)
KCV = (RXL, GHD)
HCB = (DGF, NLR)
HCS = (PMS, DXV)
PQL = (PLV, JHQ)
MCH = (SJV, NXP)
CHB = (RMP, BFJ)
LMK = (JMH, CHB)
XLP = (CXX, BFS)
TVR = (CTH, GFX)
BQB = (SLD, NQF)
DSB = (GPC, MCH)
BPL = (TTM, JPM)
DKC = (JJH, XVK)
TPV = (CHK, RRL)
TCD = (FQQ, LXM)
SCC = (XFM, CFK)
RNG = (VDQ, RFN)
GFX = (GHR, JRH)
HBS = (PTM, KGC)
HSM = (VMH, KCH)
KCH = (NMK, KVC)
MQR = (HHC, HHC)
JBM = (LXS, RVR)
TFJ = (GSH, HHF)
JKX = (MXJ, MMR)
NVX = (PHK, VPX)
MJR = (MSG, GBB)
XLG = (QBQ, KFB)
GFN = (CMR, BDX)
NRS = (PCL, PCL)
JFX = (PNB, HXX)
VNN = (XTQ, VCR)
PDT = (QDG, BTD)
BVK = (LCV, TPV)
VGN = (HFB, MDX)
PTM = (RXC, PFX)
RKL = (JLJ, BCP)
VLN = (DGF, NLR)
FKX = (TFV, VPR)
RHJ = (SHQ, VSG)
VXC = (HXH, LNB)
RPH = (TDQ, PHM)
GNC = (SJP, KFD)
PMS = (KCB, BPN)
BDL = (LXS, RVR)
XTB = (KXN, RCS)
BGT = (TGX, KSK)
GXH = (TTS, FTS)
NSL = (LRB, GDB)
MTD = (KCT, FXH)
SST = (SHK, MDL)
CCQ = (JVQ, LXC)
MVX = (SVD, GXH)
KCM = (FMP, QDD)
GFK = (QTS, KCM)
XBJ = (FXJ, VNK)
VCX = (HXH, LNB)
HGD = (VKG, TJF)
SPT = (SVJ, SFH)
CJF = (QFK, KCV)
RCS = (KJJ, HCQ)
FDC = (PQM, JMB)
BFS = (VRC, XBJ)
JJH = (QPF, RQJ)
DRM = (TMN, LCB)
QXN = (VRQ, RDR)
FMP = (VLN, HCB)
QLC = (QVN, CVF)
SQK = (PHN, JHJ)
BPN = (THF, NGK)
VCL = (QHK, JLS)
DTM = (SXK, DDN)
VPR = (JTQ, FGC)
NXJ = (NVK, RFQ)
XGQ = (XLG, NQT)
XDH = (XJV, RQG)
MDX = (HBS, VFQ)
QKV = (LCX, RND)
DMV = (SKV, JLC)
SBC = (VPX, PHK)
DQC = (VXX, DCF)
VSH = (HPV, TVR)
NKJ = (VCG, SXM)
QST = (PKG, HLS)
KXS = (HDH, FPP)
RMP = (BXH, TGL)
QDQ = (PJM, DGL)
PHK = (PCQ, PSB)
PCQ = (JNQ, HMX)
QBC = (RCC, HGD)
SPL = (DJD, XGH)
PQN = (JKD, LNN)
LXS = (RTX, MRS)
PGF = (BCV, JCJ)
LFB = (JMB, PQM)
FHH = (VMX, XSZ)
TTM = (SNM, DDX)
GNG = (SPP, JHH)
MCT = (FHJ, LFX)
JHH = (NQM, CPX)
SXN = (FVG, DKD)
XQF = (FCH, TCD)
BSG = (LDD, JCC)
MMP = (BQF, NKQ)
VHN = (NHG, PFM)
MDD = (RQG, XJV)
BDX = (KFV, XTS)
KJK = (LHB, BTF)
KNJ = (PJX, MVX)
PPL = (FNG, HXS)
JJD = (TDK, CCQ)
JHQ = (SGT, PQQ)
RHC = (DTM, TTT)
GLS = (PHV, CMV)
GLJ = (VPR, TFV)
VCR = (LTR, SLN)
CCR = (RPQ, RQK)
PVJ = (TCQ, FQT)
SGG = (KJL, TFJ)
CLX = (LDJ, NKP)
XCG = (XFM, CFK)
GHD = (BRB, JVM)
NKQ = (NKK, XKL)
TLK = (QKM, JGD)
CPP = (VCX, VXC)
TGX = (XFB, PSD)
LLJ = (FCD, FHH)
LQL = (XBX, SXN)
MDH = (BDH, QGD)
SJG = (CLX, RBQ)
NKP = (RDL, THB)
FDF = (RRK, LNC)
HFQ = (KSK, TGX)
FLR = (HPG, PQL)
PNR = (LLB, KDJ)
QPD = (DTV, JMJ)
NLC = (NKJ, VHH)
HXS = (CPP, DDL)
DMH = (NVK, RFQ)
NHQ = (SPN, HQJ)
LBQ = (PCC, RVJ)
BQR = (HRX, XXH)
LVJ = (RRN, SGG)
QGD = (BVK, KMK)
HGC = (RCS, KXN)
KNX = (SQV, SGM)
KXL = (RPQ, RQK)
FBN = (MDH, GHK)
LPS = (VRT, JJD)
XHV = (BQB, GLF)
SRH = (QCN, VCL)
GPL = (KNX, FJM)
HHC = (XVJ, LPN)
FGC = (HSM, LMM)
TTT = (DDN, SXK)
MMR = (FVB, HGX)
VRT = (TDK, CCQ)
BBB = (MQR, MFR)
VKA = (LRB, GDB)
GSH = (SDS, SDS)
MFF = (GHQ, QLD)
TDK = (JVQ, LXC)
KVJ = (FPF, SLF)
SGM = (MTD, VBL)
JHJ = (JSG, TDJ)
JQG = (PQL, HPG)
VPX = (PSB, PCQ)
SCF = (XHF, QPD)
FVC = (GLS, HHG)
VBL = (KCT, FXH)
JKF = (KGQ, TRB)
FXH = (GFS, SRH)
GHQ = (RDF, PTH)
SPG = (BNM, GNS)
JCJ = (DKC, DJX)
TNL = (NDV, BMJ)
SMT = (LQL, LKS)
NPT = (NXN, GNC)
MNP = (MPD, XVF)
SDS = (RCP, RCP)
LTR = (BHL, SPG)
RVJ = (HFQ, BGT)
SVJ = (MRD, TNL)
HTK = (FJD, BKF)
FHJ = (TMF, VTF)
LNB = (LLN, RPR)
TGL = (GFK, QXX)
XFB = (RRX, BCF)
XJV = (LBQ, SXS)
QPF = (SFX, GTK)
NNM = (TRG, BQQ)
JBL = (MQB, RBX)
MCC = (NXN, GNC)
RXC = (DMH, NXJ)
NVV = (QFG, NJH)
DLL = (MCC, NPT)
VSG = (FBN, XQL)
VLV = (TCD, FCH)
KGL = (RHC, CNH)
LRB = (PDX, JPL)
HGT = (QDG, BTD)
FMJ = (HTK, DST)
FSK = (BPH, SST)
RLS = (XQF, VLV)
FQT = (MKB, LLJ)
XVJ = (XKD, SPT)

5
src/input/day08_test1 Normal file
View File

@@ -0,0 +1,5 @@
LLR
AAA = (BBB, BBB)
BBB = (AAA, ZZZ)
ZZZ = (ZZZ, ZZZ)

10
src/input/day08_test2 Normal file
View File

@@ -0,0 +1,10 @@
LR
11A = (11B, XXX)
11B = (XXX, 11Z)
11Z = (11B, XXX)
22A = (22B, XXX)
22B = (22C, 22C)
22C = (22Z, 22Z)
22Z = (22B, 22B)
XXX = (XXX, XXX)

200
src/input/day09 Normal file
View File

@@ -0,0 +1,200 @@
8 27 61 121 232 446 858 1625 2988 5297 9039 14869 23644 36460 54692 80037 114560 160743 221537 300417 401440
8 8 3 -9 -26 -26 63 410 1348 3464 7715 15573 29202 51670 87199 141456 221888 338104 502307 729779 1039422
7 20 43 80 131 192 255 308 335 316 227 40 -277 -760 -1449 -2388 -3625 -5212 -7205 -9664 -12653
1 11 33 75 142 243 413 770 1657 3978 9939 24564 58586 133628 291003 605989 1210089 2324581 4309613 7734217 13473918
7 8 8 18 62 184 460 1013 2029 3772 6596 10952 17388 26540 39112 55843 77459 104608 137776 177182 222650
9 31 75 150 263 424 660 1045 1753 3141 5869 11064 20535 37046 64654 109119 178393 283195 437679 660202 974199
4 7 19 62 177 445 1034 2302 5014 10768 22769 47137 94972 185401 349778 637136 1121123 1909658 3162034 5127705 8243746
11 19 27 35 43 51 59 67 75 83 91 99 107 115 123 131 139 147 155 163 171
-3 -2 0 3 7 12 18 25 33 42 52 63 75 88 102 117 133 150 168 187 207
16 28 60 120 221 394 706 1295 2444 4734 9352 18704 37635 75858 152752 306665 612472 1213680 2379212 4600600 8753233
21 36 58 101 195 405 867 1858 3940 8257 17135 35267 72013 145829 292823 583461 1155531 2279398 4486268 8816173 17286483
11 15 30 65 125 208 302 382 407 317 30 -561 -1591 -3226 -5666 -9148 -13949 -20389 -28834 -39699 -53451
22 44 82 146 245 380 528 613 460 -272 -2182 -6248 -13981 -27616 -50344 -86589 -142334 -225500 -346382 -518146 -757391
19 45 90 160 261 399 580 810 1095 1441 1854 2340 2905 3555 4296 5134 6075 7125 8290 9576 10989
8 7 19 68 192 440 881 1641 2996 5574 10757 21433 43363 87695 175797 349068 689707 1365587 2727387 5516639 11303487
25 45 83 153 274 474 793 1280 1986 2984 4525 7610 15598 38113 99693 257747 638165 1503651 3381938 7303150 15236734
15 30 73 169 364 736 1417 2646 4892 9119 17317 33499 65469 127805 246679 467358 865501 1563692 2755033 4736069 7951834
9 16 39 93 197 379 696 1288 2496 5091 10702 22627 47406 97886 199085 399048 788179 1532338 2927433 5486449 10073987
16 25 38 66 146 350 804 1736 3586 7243 14542 29286 59292 120344 243528 488292 964796 1870781 3550390 6585226 11931550
7 21 51 100 173 277 421 616 875 1213 1647 2196 2881 3725 4753 5992 7471 9221 11275 13668 16437
10 14 30 69 135 232 385 676 1299 2647 5459 11076 21882 42039 78664 143641 256312 447348 764164 1278311 2095353
6 16 22 36 81 187 386 715 1256 2273 4547 10070 23370 53970 120956 261531 547038 1112622 2210968 4307040 8240259
3 24 57 108 192 336 599 1120 2207 4497 9263 19037 38875 78824 158472 314879 615703 1179922 2209089 4032202 7166254
11 10 9 4 -12 -38 -45 49 406 1298 3150 6622 12781 23450 41870 73875 129861 227930 398711 692504 1189562
4 22 62 147 314 632 1237 2385 4533 8487 15722 29120 54661 105161 208165 421834 865466 1775620 3605246 7192473 14038628
1 1 5 13 25 51 128 353 963 2541 6528 16414 40328 96357 222999 499077 1080929 2271065 4644095 9276599 18164343
11 8 0 -15 -29 -12 100 417 1107 2408 4640 8217 13659 21604 32820 48217 68859 95976 130976 175457 231219
-2 5 23 65 172 437 1039 2287 4674 8941 16151 27773 45776 72733 111935 167515 244582 349365 489367 673529 912404
-3 13 45 94 161 247 353 480 629 801 997 1218 1465 1739 2041 2372 2733 3125 3549 4006 4497
12 16 26 51 103 202 405 870 1965 4434 9640 19935 39296 74578 138165 253576 466866 868644 1634430 3095131 5854885
9 6 14 44 107 214 376 604 909 1302 1794 2396 3119 3974 4972 6124 7441 8934 10614 12492 14579
23 31 36 38 37 33 26 16 3 -13 -32 -54 -79 -107 -138 -172 -209 -249 -292 -338 -387
20 30 37 49 93 236 618 1497 3306 6722 12747 22801 38827 63408 99896 152553 226704 328902 467105 650865 891529
15 22 19 4 -10 32 278 1049 2963 7144 15599 31916 62582 119574 225741 426501 815770 1593226 3188564 6524862 13563153
-1 4 18 53 133 297 614 1238 2550 5463 12010 26399 56808 118312 237488 459438 858209 1551878 2723914 4652833 7752631
17 27 49 107 239 500 965 1732 2925 4697 7233 10753 15515 21818 30005 40466 53641 70023 90161 114663 144199
11 33 71 137 252 464 874 1666 3142 5780 10383 18514 33688 64313 130245 276161 596940 1283361 2702081 5535642 11034321
-1 -1 8 43 125 290 622 1325 2857 6155 12986 26465 51787 97226 175460 305287 513803 839119 1333700 2068415 3137393
1 3 11 31 74 162 348 758 1664 3598 7518 15038 28735 52547 92277 156219 255923 407117 630805 954561 1414040
19 31 44 65 116 241 520 1109 2336 4892 10165 20791 41584 81243 155758 295456 559429 1064049 2036886 3914209 7510104
-5 -3 16 64 153 295 502 786 1159 1633 2220 2932 3781 4779 5938 7270 8787 10501 12424 14568 16945
17 43 91 178 329 579 975 1578 2465 3731 5491 7882 11065 15227 20583 27378 35889 46427 59339 75010 93865
12 22 42 71 108 152 202 257 316 378 442 507 572 636 698 757 812 862 906 943 972
9 17 36 66 107 159 222 296 381 477 584 702 831 971 1122 1284 1457 1641 1836 2042 2259
-8 -4 8 38 118 310 719 1514 2964 5509 9908 17537 30950 54865 97795 174611 310400 546066 946216 1609976 2685494
15 39 72 114 165 225 294 372 459 555 660 774 897 1029 1170 1320 1479 1647 1824 2010 2205
17 30 57 116 239 486 977 1956 3906 7735 15062 28676 53381 97817 178780 331735 635984 1272841 2654580 5698117 12381760
11 20 29 38 47 56 65 74 83 92 101 110 119 128 137 146 155 164 173 182 191
23 31 43 78 163 331 620 1070 1721 2641 4080 6998 14541 35712 93820 244839 615515 1479569 3405609 7537760 16119327
-2 -4 -12 -13 24 156 485 1195 2629 5473 11209 23182 48965 105312 228041 491002 1041486 2165356 4406665 8789322 17233490
1 10 28 52 79 106 130 148 157 154 136 100 43 -38 -146 -284 -455 -662 -908 -1196 -1529
26 50 100 200 394 756 1412 2587 4690 8450 15116 26734 46514 79300 132156 215081 341866 531106 807380 1202612 1757626
17 32 56 97 167 294 559 1185 2713 6313 14306 31027 64265 127742 245589 460825 851908 1565171 2877195 5310650 9840018
29 57 105 177 287 471 799 1387 2409 4109 6813 10941 17019 25691 37731 54055 75733 104001 140273 186153 243447
16 15 12 12 21 41 66 88 140 442 1781 6363 19573 53489 133872 314165 703559 1522604 3210805 6628261 13420152
20 40 68 107 160 230 320 433 572 740 940 1175 1448 1762 2120 2525 2980 3488 4052 4675 5360
7 22 57 129 268 539 1085 2213 4558 9383 19132 38501 76634 151785 301268 602352 1214945 2466051 5011629 10137742 20306500
11 13 25 51 103 211 439 909 1842 3645 7119 13957 27875 57019 118784 248965 518377 1061933 2127937 4159415 7925179
26 55 101 176 309 552 985 1720 2904 4721 7393 11180 16379 23322 32373 43924 58390 76203 97805 123640 154145
9 12 13 14 36 147 502 1395 3326 7091 13918 25713 45571 78888 135761 236052 419855 768766 1448395 2791736 5459054
19 34 44 44 29 -6 -66 -156 -281 -446 -656 -916 -1231 -1606 -2046 -2556 -3141 -3806 -4556 -5396 -6331
9 14 21 30 41 54 69 86 105 126 149 174 201 230 261 294 329 366 405 446 489
14 29 56 107 213 436 882 1714 3169 5593 9529 15949 26878 47062 88264 179732 392224 890112 2038800 4616520 10215759
-8 -1 32 114 281 601 1223 2470 5004 10115 20215 39647 75943 141679 257074 453459 777696 1297551 2107914 3337608 5156333
19 29 54 119 254 502 951 1801 3477 6799 13220 25143 46328 82400 141469 234873 378055 591585 902338 1344839 1962786
5 4 3 22 105 343 913 2134 4539 8956 16578 28979 47997 75353 111804 155535 199377 226292 202389 66524 -284711
1 4 15 43 97 186 319 505 753 1072 1471 1959 2545 3238 4047 4981 6049 7260 8623 10147 11841
19 40 88 171 302 507 837 1390 2362 4176 7787 15332 31409 65498 136531 281635 572981 1149916 2278550 4457913 8600352
-4 -5 -10 -15 -13 9 77 251 682 1739 4252 9929 22017 46289 92451 176075 321176 563563 955106 1569073 2506703
11 24 42 63 85 106 124 137 143 140 126 99 57 -2 -80 -179 -301 -448 -622 -825 -1059
10 29 65 141 307 655 1336 2588 4789 8549 14850 25249 42228 70021 116879 201090 365668 711205 1463967 3108277 6630345
20 35 53 69 76 69 56 89 344 1306 4157 11531 28909 67113 146675 305384 611160 1183713 2230401 4104533 7398350
-1 -7 -12 -14 -1 57 221 606 1432 3162 6874 15169 34157 77398 173088 376175 787172 1578466 3025279 5528847 9597710
4 11 19 43 121 321 751 1572 3004 5315 8818 14021 22371 38650 77224 176275 427156 1030391 2395821 5312043 11219397
17 20 16 -2 -37 -76 -68 114 731 2268 5603 12379 25828 52457 105162 208404 405921 770848 1416766 2505680 4244677
25 44 86 164 286 463 742 1274 2425 4934 10122 20175 38584 70953 126621 221975 387207 680246 1216224 2231404 4223440
30 58 110 199 351 616 1079 1871 3180 5262 8452 13175 19957 29436 42373 59663 82346 111618 148842 195559 253499
24 34 48 68 94 137 237 496 1148 2692 6114 13244 27402 54840 108412 217037 449032 966338 2143496 4815536 10771438
-3 -8 -13 -18 -23 -28 -33 -38 -43 -48 -53 -58 -63 -68 -73 -78 -83 -88 -93 -98 -103
21 40 83 180 379 744 1358 2347 3949 6676 11669 21442 41386 82749 168542 345411 707857 1447860 2955575 6019392 12212385
-5 -8 -11 -14 -17 -20 -23 -26 -29 -32 -35 -38 -41 -44 -47 -50 -53 -56 -59 -62 -65
23 35 62 110 185 298 470 737 1155 1805 2798 4280 6437 9500 13750 19523 27215 37287 50270 66770 87473
11 33 84 184 364 684 1263 2321 4233 7595 13302 22638 37378 59902 93321 141615 209783 304005 431816 602292 826248
22 42 88 187 395 821 1662 3256 6165 11305 20145 35002 59464 98978 161645 259269 408712 633612 966526 1451565 2147593
19 38 71 130 242 452 821 1431 2434 4214 7766 15434 32207 67899 140848 284466 559397 1076714 2042265 3840014 7184432
12 25 47 84 141 220 318 425 522 579 553 386 3 -690 -1808 -3489 -5896 -9219 -13677 -19520 -27031
12 23 40 86 197 422 823 1475 2466 3897 5882 8548 12035 16496 22097 29017 37448 47595 59676 73922 90577
19 49 94 150 218 328 577 1181 2546 5372 10817 20765 38263 68217 118466 201386 336213 552315 893688 1425000 2239560
18 39 75 124 188 287 478 888 1786 3736 7890 16499 33746 67046 129025 240497 434922 765069 1312949 2204550 3631528
11 10 16 45 124 288 576 1027 1684 2643 4263 7832 17352 43821 114725 293860 720797 1686360 3771970 8098799 16760328
10 15 29 71 168 364 753 1561 3318 7185 15537 32965 67982 135964 264331 501829 935226 1719067 3127709 5644131 10107540
19 20 21 25 34 49 70 96 125 154 179 195 196 175 124 34 -105 -304 -575 -931 -1386
9 12 25 55 109 194 317 485 705 984 1329 1747 2245 2830 3509 4289 5177 6180 7305 8559 9949
20 28 34 48 87 175 343 629 1078 1742 2680 3958 5649 7833 10597 14035 18248 23344 29438 36652 45115
7 14 21 28 35 42 49 56 63 70 77 84 91 98 105 112 119 126 133 140 147
2 9 34 82 155 253 392 656 1302 2938 6805 15232 32417 65833 128769 244761 454842 828395 1477428 2571386 4343599
11 21 56 130 269 523 976 1751 3013 4992 8100 13349 23590 46765 103687 245277 588315 1385443 3155476 6915384 14577239
13 22 31 40 49 58 67 76 85 94 103 112 121 130 139 148 157 166 175 184 193
27 56 100 156 232 361 623 1188 2399 4919 9976 19769 38168 71982 133319 243967 443339 802410 1447300 2597802 4628304
8 16 31 54 98 210 504 1205 2704 5624 10897 19852 34314 56714 90210 138819 207560 302608 431459 603106 828226
-5 -7 -8 -8 -7 -5 -2 2 7 13 20 28 37 47 58 70 83 97 112 128 145
-8 -6 5 27 71 177 451 1127 2662 5872 12117 23543 43389 76367 129123 210787 333620 513766 772117 1135299 1636787
7 2 0 8 43 142 376 879 1927 4134 8867 19015 40273 83116 165635 317382 584319 1034882 1767050 2916146 4662887
6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66
-3 9 46 137 328 693 1367 2628 5068 9906 19509 38200 73445 137524 249804 439745 750783 1245247 2010480 3166347 4874326
11 5 6 32 108 264 533 949 1545 2351 3392 4686 6242 8058 10119 12395 14839 17385 19946 22412 24648
15 25 36 59 116 247 520 1058 2111 4215 8494 17175 34400 67433 128374 236506 421415 727037 1216800 1980043 3139908
19 41 83 150 251 413 710 1327 2699 5799 12704 27657 59001 122686 248786 494160 968204 1886862 3687014 7266797 14480644
5 9 23 57 126 254 486 917 1751 3414 6768 13528 27117 54488 110028 223727 457605 937283 1909993 3846783 7615836
1 13 38 77 131 201 288 393 517 661 826 1013 1223 1457 1716 2001 2313 2653 3022 3421 3851
16 24 51 106 210 406 779 1513 3032 6304 13443 28841 61218 127219 257586 507721 976288 1840042 3424195 6353730 11889274
3 16 46 96 170 284 484 866 1598 2951 5353 9495 16569 28879 51518 96965 197239 434540 1014814 2436316 5859350
15 36 78 156 289 500 816 1268 1891 2724 3810 5196 6933 9076 11684 14820 18551 22948 28086 34044 40905
5 15 40 91 189 367 670 1152 1877 2938 4516 7034 11589 21232 44657 106136 270398 701042 1790570 4437721 10619096
2 5 8 11 23 81 278 800 1972 4313 8600 15941 27857 46373 74118 114434 171494 250429 357464 500063 687083
17 36 69 123 205 322 481 689 953 1280 1677 2151 2709 3358 4105 4957 5921 7004 8213 9555 11037
11 20 27 43 103 289 775 1906 4341 9334 19308 39006 77691 153125 298396 573093 1080863 1996032 3602745 6350989 10934919
8 3 -10 -24 -8 117 516 1495 3580 7636 15056 28069 50240 87264 148190 247250 406512 659625 1056978 1672654 2613624
16 33 64 118 227 458 920 1758 3117 5043 7262 8739 6864 -3962 -34664 -105197 -250210 -527443 -1029844 -1902644 -3366919
5 16 31 49 81 174 445 1124 2603 5495 10727 19738 34972 61151 108483 200344 390605 800450 1692383 3611715 7645255
9 22 60 140 278 488 791 1245 2021 3576 7022 14889 32687 72090 157376 338266 714973 1485687 3033414 6078033 11929020
11 9 14 48 141 329 654 1162 1904 2981 4760 8558 18387 44821 112735 275634 640621 1409889 2947214 5881708 11266781
20 44 81 129 184 240 289 321 324 284 185 9 -264 -656 -1191 -1895 -2796 -3924 -5311 -6991 -9000
12 17 24 35 59 120 270 603 1278 2598 5266 11062 24387 55457 126494 283190 615208 1291791 2622012 5154237 9836507
7 24 62 139 293 591 1148 2170 4036 7435 13575 24482 43408 75368 127827 211559 341701 539026 831460 1255869 1860143
11 12 28 72 157 296 502 788 1167 1652 2256 2992 3873 4912 6122 7516 9107 10908 12932 15192 17701
6 16 23 33 73 205 550 1334 2981 6296 12796 25248 48455 90317 163278 286701 492071 836502 1438618 2570383 4880812
15 37 82 171 337 625 1092 1807 2851 4317 6310 8947 12357 16681 22072 28695 36727 46357 57786 71227 86905
19 31 57 117 249 527 1092 2207 4359 8443 16087 30243 56337 104653 195437 369876 713488 1405188 2818342 5724586 11695386
6 16 44 111 246 491 912 1616 2774 4650 7636 12293 19398 29997 45464 67566 98534 141140 198780 275563 376406
-3 -11 -21 -36 -62 -103 -152 -183 -154 -23 269 1030 3758 13932 48049 149608 422775 1099217 2664467 6087084 13219334
12 18 40 84 167 339 727 1623 3660 8155 17746 37511 76831 152346 292453 543908 981220 1719664 2932892 4876286 7917375
13 15 17 19 26 57 172 539 1570 4168 10156 23019 49202 100390 197443 376892 700908 1271018 2243896 3843428 6356047
11 14 19 32 76 199 493 1142 2519 5363 11112 22587 45475 91551 185520 379175 780071 1608568 3309353 6765322 13698938
10 3 1 13 57 164 375 725 1218 1823 2577 4001 8279 22119 63097 172962 444637 1076046 2476380 5474328 11722452
20 30 46 83 162 324 673 1473 3340 7602 16958 36655 76510 154204 300330 565689 1031483 1824069 3139777 5296498 8856709
11 21 26 26 21 11 -4 -24 -49 -79 -114 -154 -199 -249 -304 -364 -429 -499 -574 -654 -739
14 26 42 76 152 310 620 1204 2266 4130 7286 12444 20596 33086 51688 78692 116998 170218 242786 340076 468528
7 20 34 55 110 266 656 1512 3205 6292 11570 20137 33460 53450 82544 123794 180963 258628 362290 498491 674938
2 13 39 80 136 207 293 394 510 641 787 948 1124 1315 1521 1742 1978 2229 2495 2776 3072
5 5 3 -1 -7 -15 -25 -37 -51 -67 -85 -105 -127 -151 -177 -205 -235 -267 -301 -337 -375
11 22 41 82 175 375 772 1499 2748 4830 8357 14688 26877 51504 101981 204232 406085 792330 1508245 2795538 5046175
20 45 83 142 240 405 675 1098 1732 2645 3915 5630 7888 10797 14475 19050 24660 31453 39587 49230 60560
5 18 38 65 99 140 188 243 305 374 450 533 623 720 824 935 1053 1178 1310 1449 1595
9 9 7 11 54 205 578 1339 2727 5144 9442 17666 34748 72066 154497 333750 712533 1486659 3015673 5937053 11344434
11 16 17 23 71 249 729 1816 4037 8323 16370 31291 58671 108075 194868 341769 578687 937782 1437927 2048211 2612991
3 17 59 142 277 487 850 1583 3175 6582 13528 27036 52471 99648 186983 349291 651715 1213463 2246601 4117170 7438441
14 35 82 173 345 679 1348 2705 5434 10796 21028 40028 74638 137216 250957 460990 857520 1624007 3137096 6172221 12320889
18 40 82 156 274 448 690 1012 1426 1944 2578 3340 4242 5296 6514 7908 9490 11272 13266 15484 17938
2 10 20 32 46 62 80 100 122 146 172 200 230 262 296 332 370 410 452 496 542
6 11 17 24 32 41 51 62 74 87 101 116 132 149 167 186 206 227 249 272 296
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
18 26 47 107 254 577 1244 2573 5163 10135 19572 37314 70391 131642 244633 453148 839776 1562216 2922989 5499853 10382500
10 2 -10 -20 -20 -6 13 3 -110 -458 -1252 -2806 -5564 -10130 -17301 -28103 -43830 -66086 -96830 -138424 -193684
19 27 33 36 34 29 48 198 791 2596 7300 18308 42132 90902 187123 372912 727867 1402825 2681539 5089340 9577870
1 -2 -13 -31 -40 0 174 666 1879 4666 10729 23257 47904 94303 178592 328133 591157 1057146 1899391 3460813 6419832
-1 12 37 71 117 203 424 1016 2475 5758 12668 26658 54533 109981 220754 443156 891322 1796624 3628200 7335823 14832704
-1 12 37 88 190 382 726 1332 2433 4579 9071 18841 40135 85649 180388 372895 757551 1520190 3032625 6047566 12093208
5 5 -2 -12 -12 20 115 313 663 1223 2060 3250 4878 7038 9833 13375 17785 23193 29738 37568 46840
4 1 -7 -20 -38 -61 -89 -122 -160 -203 -251 -304 -362 -425 -493 -566 -644 -727 -815 -908 -1006
19 34 65 123 227 424 821 1628 3222 6269 11997 22828 43822 85910 172982 357075 750120 1588635 3362328 7063820 14662980
13 40 79 134 220 371 648 1153 2074 3828 7460 15637 34903 80405 185147 417080 909107 1909504 3863477 7540752 14229406
15 39 73 125 227 451 927 1863 3567 6471 11157 18385 29123 44579 66235 95883 135663 188103 256161 343269 453379
13 18 35 67 110 150 160 97 -101 -518 -1263 -2473 -4316 -6994 -10746 -15851 -22631 -31454 -42737 -56949 -74614
4 0 -4 -8 -12 -16 -20 -24 -28 -32 -36 -40 -44 -48 -52 -56 -60 -64 -68 -72 -76
14 36 63 91 116 134 141 133 106 56 -21 -129 -272 -454 -679 -951 -1274 -1652 -2089 -2589 -3156
23 28 43 89 188 372 710 1357 2629 5108 9781 18217 32786 56924 95448 154925 244099 374380 560399 820633 1178104
26 50 83 125 190 318 599 1218 2529 5166 10200 19353 35283 61958 105142 173022 277012 432778 661537 991693 1460884
4 10 31 86 215 508 1144 2435 4870 9154 16237 27328 43889 67604 100318 143941 200312 271018 357163 459082 575995
-3 2 17 54 147 369 868 1945 4215 8916 18453 37271 73125 138733 253632 445774 751961 1215582 1879233 2768620 3862607
20 23 26 36 70 171 440 1097 2593 5821 12533 26179 53571 108095 215757 426377 834186 1615819 3100908 5904194 11173524
10 20 42 76 122 180 250 332 426 532 650 780 922 1076 1242 1420 1610 1812 2026 2252 2490
12 20 28 36 44 52 60 68 76 84 92 100 108 116 124 132 140 148 156 164 172
6 23 45 69 107 196 416 934 2099 4622 9886 20444 40778 78409 145467 260851 453132 764377 1255099 2010567 3148741
26 36 53 91 163 289 511 909 1622 2900 5258 9893 19693 41457 90412 198823 431522 912620 1869611 3703639 7097999
14 15 19 39 98 241 569 1304 2899 6234 13006 26559 53672 108364 219866 449102 922329 1898779 3904168 7988507 16212107
19 28 36 39 30 -1 -67 -184 -371 -650 -1046 -1587 -2304 -3231 -4405 -5866 -7657 -9824 -12416 -15485 -19086
10 23 36 49 62 75 88 101 114 127 140 153 166 179 192 205 218 231 244 257 270
12 21 35 61 126 285 637 1370 2868 5929 12171 24755 49646 97785 188781 357080 662060 1204173 2150147 3771417 6501422
9 6 2 -3 -9 -16 -24 -33 -43 -54 -66 -79 -93 -108 -124 -141 -159 -178 -198 -219 -241
7 8 22 69 176 386 788 1577 3152 6261 12211 23206 43021 78589 143912 269497 524285 1064876 2242897 4833512 10510884
12 25 38 51 64 77 90 103 116 129 142 155 168 181 194 207 220 233 246 259 272
8 22 41 78 164 356 751 1511 2908 5413 9899 18142 34057 66633 136587 290821 632724 1383808 3005877 6437550 13542006
0 -3 -2 24 119 354 837 1752 3476 6871 13933 29137 62113 132839 281539 587258 1202215 2414497 4761306 9232575 17638400
17 42 92 188 376 751 1488 2892 5504 10333 19328 36267 68344 128934 242423 452813 839399 1545708 2832888 5176966 9442396
17 21 38 82 169 317 546 878 1337 1949 2742 3746 4993 6517 8354 10542 13121 16133 19622 23634 28217
21 29 37 45 53 61 69 77 85 93 101 109 117 125 133 141 149 157 165 173 181
7 8 13 26 57 122 243 448 771 1252 1937 2878 4133 5766 7847 10452 13663 17568 22261 27842 34417
-5 -5 2 19 42 55 20 -144 -597 -1621 -3634 -7089 -12094 -17477 -18868 -5172 47443 185227 491754 1110051 2274466
23 44 72 106 161 283 572 1232 2681 5771 12194 25194 50779 99746 191014 357026 652355 1167158 2047796 3527810 5973549
9 30 73 159 318 589 1020 1668 2599 3888 5619 7885 10788 14439 18958 24474 31125 39058 48429 59403 72154
14 11 18 49 122 275 601 1312 2848 6066 12592 25513 50747 99691 194178 375523 720847 1372745 2594617 4877979 9159341
-7 -6 10 51 127 250 451 833 1702 3859 9215 22033 51334 115355 249438 519373 1043015 2023928 3801840 6925759 12256609
8 16 35 75 165 367 801 1701 3535 7235 14596 28916 55962 105360 192520 341220 586986 981418 1597625 2536945 3937139
8 9 22 53 110 213 423 913 2130 5147 12394 29110 66104 144789 306003 624906 1235300 2368125 4410710 7995683 14131354
12 24 51 109 222 429 805 1504 2832 5358 10071 18591 33442 58395 98889 162538 259732 404340 614523 913665 1331430
2 -6 -7 20 111 320 734 1509 2946 5661 10970 21713 43891 89725 183161 369632 733386 1428444 2734087 5153866 9590111
15 25 52 115 256 559 1173 2333 4373 7726 12917 20602 31835 49021 78509 136544 261287 534563 1117214 2299965 4564870
7 27 76 181 394 805 1556 2856 4997 8371 13488 20995 31696 46573 66808 93806 129219 174971 233284 306705 398134
8 17 43 101 206 373 617 953 1396 1961 2663 3517 4538 5741 7141 8753 10592 12673 15011 17621 20518

3
src/input/day09_test1 Normal file
View File

@@ -0,0 +1,3 @@
0 3 6 9 12 15
1 3 6 10 15 21
10 13 16 21 30 45

3
src/input/day09_test2 Normal file
View File

@@ -0,0 +1,3 @@
0 3 6 9 12 15
1 3 6 10 15 21
10 13 16 21 30 45

140
src/input/day10 Normal file
View File

@@ -0,0 +1,140 @@
7.LJFFF7F77.----7F7777F|-F-7-7F77LL77J77F|.|JFF7-F|77.FF77|F77F-L|-L7FFL7L7--.L|--7L7.J-F7-|-F|7FJ.FJJ7F7-7-7JFL|7-|-7FJJ7FFF7LL--L7.-JJ-F-F
J7LL-J||FLJ-|J.F|-L|FJ7J|.LL-L7F|LF||JFJ7L-JLF.||FL.FF.--F77|J7|L|.|LF7-|||J|7L|7L77|-..|JJLFJ|||JF|L|F|JF--77LFLF7JJL-JLL-JLL7L.-L-|FJ.LLFF
L|-7LFLL7J|..|F-7-7L|-7.L--L-JL|..FFJ.|7||F7F----JJ..|||L||L|.L|L|.|F--7|L-7F|FL7JLJLL-7J7|.||-LJ---7-L-J|FFL|FF7.|7F7..|L-7|F7J-7|.||-JJL7J
||||-JJL|-7F|-|LLLL.FF|-J|F-7.LF7-7L|FFFFFJF|J|LF--LLL--77.-J-.|----JJFFL-LL7|LF-J.|.FLJLL-F|7JFLJF|77.L7|FJJ.FLL-JLF--77J.FF|J.LF|77L7L7|L-
-J---|-J..-LF-7.L7J-|LJ.F-77F-7LLJ|FF7FF7|.F.-F.J..|.|7-LF7LJF7JJ.||.---J.FFJJFL|.FF77L|7L-JLL-7|FF7-7-F.|||7F7-J..-L.J|J.F|LF.|F7J.F|--7--L
|FJ-||-7|-FJ|||-FJJLF-7.|.|LJFF77-F7|L-J|-F.F-F7L|-L-FJ|FF|LF|7L-FJ--J7.FJJFJF|77-F-FJFF-7JF-|-F7F7J.--L-|7F-LFJ.F7J-7||-77F7|-FFJF-FF.|||7J
FJ-FJJL|..FJL.FF.|FLJL-7L-|JFFFL-FJLJF--JL|7.F||J|77LJFL7FJ7JLJ-JJ7||L7-|.FFFLJFJ7||LFFL7|F--7FJLJ|7-|L.FLFJ||L7-JL7F.|L--F7LL-7L---LJFL-L77
7JL|L|F777|7J.F|-LJ7..|||FF-F7J.LL--7L7F7LF7F7|L-7-|.L|7FJJJ.FJ-JFL-F7L---L-|J7L7F7|.FJFJ||F-JL7F-J7LJ--FJ.LFF-J77.J--J7.JLJ-|LL7.F-.J--J.77
||.F.JJL7-7|.LJ.LL7|7F7-|7JFF7FF7FL|L7||L-J||||F-JF77-|-|7LF-7J7.-|-J7J|.|.-J-L7F-L-7L.L7LJL7F7||F7-FJ7|L-7L-|FF7--LJ.LLJJ77.|-FJ--.FFL.FFJ|
L-..J|.LF-J77F|7JLJJ-FJFJ|FFJLLF7FFF7|||F--J|LJL7FJL-7-F.F.L..|L-J|LLJ.F-F-J.LLL|L|7-LFFJF-7LJLJLJ|7|.LL-||J.F7-|77-F7LJ7.|----|JF||.-J.JJJ|
.L|7L-|L|-L7JFL|.|7.FJ.|.L|J||JF7-FJLJLJL7F7L--7||F--J-|7L7LF-L.LFJ7LFJ|FFJ-7.7JLF7J7.FL7|FJF-----JF7-7.L77.-|J|L||FL-F-77L7||-|.J7L-J|.F||L
LFJJ7.L..F7||F7|F-F--.-|-JL-J7F||FL--7F--J||F--J|||7F7|F7F|-L-|7L|.F.J7F-|.|F|J||||-FFF7LJL7|F7|F-7||77.-.77JL-7J.F|F|LFF7.--L7|JJFJ|7FF-F-L
FJ-LLJ-|-LFFL7JFJJJ7LFJL.FJFFF7||F7F-JL7F7||L--7||L-JL-JL77.LJLF---L7JLJF|7F7JF7FJL-77|L7F-J||L7L7LJL-7JJ|.|.|.L-.L-F--L7L-|--FJF7|-L7FJF|7L
7.77F|FF-7-F7LLJJJ.JF7--77F-.||||||L-7FJ||||7F7|LJF7F----JLF7F---L-J7F7L-F7||FJ||F--JFJFJL-7LJFJFJF---J-7--7-|7.L--LLF7L|-7JFL|-JLFFJFL.L|7J
|7L7---|J...--J|JJFJ-|FF7L-JFJLJLJL7FJL-JLJL7|||F-JLJF7F7J77-|FL7F77F7F7L||||L7||||F7L7|F--JF-JJL7L-7J.-|-LF7LF.7L7FF|7JLF|FLLL7|FJJ.|7F7L77
|FL7FJ.|J7.F|LFJ7.|J.L-F77.FL-----7|L---7F--J|||L-7F-J|||-L|L7J7|L77||-7-|||L-J||L7|L7|LJF--JF--7|F-J777FJL||-7-JFJ-F-JFJ|L-|.F7L|7F-J7|7L|L
LJ||J|-|7---7F77|.|LFLFJL-7J.F-7F7|L7F7FJL-7FJ||F-J|F-J|||LF7L|JF|F7||-F-J|L--7|L7LJFJL-7L7F7L-7LJL---7F77|||7.-LL--LJJL-|7FLJ.L-LLFJLL-.F|J
L7-L---7-7--L-JLLFJF7.L7F-JF7L7|||L7||||F--JL7||L-7|L7L|L7FJL7F7F7|LJL7L-7|F7FJL7L-7|F7FJFJ||F7L7F----J||-FJL-7.|LL--JJ..|J-J-F.|-|J.|LF-F77
LFJLLLJLFL--J|||LJ-F7F7|L7FJ|FJLJ|FJ||||L7F--J||F-J|FJFJFJL-7|||||L--7L7FJLJ|L7FJF-JLJLJFJFJ||L7||F-7F7|L7L-7FJ-L7JF||-J-L-J|FL-7F|.LJ.|.|J7
.777||..J|FJ.LF|-JL||||L7|L7||F-7|L7LJLJFJL--7||L7-|L7L7|LF7||||||F7|L7|L-7FJFJL7L-7F--7L7|FJ|FJ|||FJ|||FJF7|L-7FF7-F7-LJJF7F-.||FFJ7|F7F7-|
FLL-7.FL7|JJ.F7.F|.|LJL-JL7||LJFJL7L-7F-JF7FFJ||FJFJFJFJL7||||||||||F7||F-JL7L7FJF7LJF-JFJ||FJ|FJLJL7|LJL7|LJF-JF-7F7J|F|F-J|--L-JL-|-LJ7F-F
LF-LJ-F7L.|FFL|-||FL-----7||L-7L-7L--JL7L|L7L7||L-JFJFJF7LJ||||||LJ||LJ|L-7FJFJL7||F7|F7L7||L7||F---J|F--JL7FJF7L7LJ|7.LF7.LFF7.|.L.J7FF-J-|
.L-F-7JL7FJ-L-77LFJF7F---J||F-JF7L--7F-JFJFJFJ|L7F7L7|FJL--J|||||F-J|F7|F-JL7L7FJ||||LJ|FJ|L-JLJL-7F7|L7F7.||L|L7L7FJFFJ|JFFJ.L--JJ.F7-JJ|F7
F|J|F|-L-7-F.F|F7J7|LJF--7||L7FJ|F7FJ|F7L7L7L7L7||L-J|L----7|LJ|||F7LJ||L--7L7|L7|LJ|F7|L7L----7F-J|||FJ|L7||FJFJFJ|F7LF7-JJ-7F|JF-7-L|J.F|J
F7F--J|.|JFL.FF-77-L--JF-JLJFJL7|||L7|||FJFJFJFJ|L-7FL7F---JL7FJ|||L--JL---JFJL7||F-J|||FJF-7F-JL-7||||J|FJ||L7L7L7|||FF7.|.FLL7FJ7LJFF.FLF7
JJ|F--7F77JFFLL7L-7-F7|L---7L--JLJL-J|||L7|FJFJ||F-JF-JL7F7F7|L7||L--------7|LFJ|||LFJ||L7L7|L7F--J|LJL7||FJL7L7L7|LJL7|L---7J7.JJ|JFJJFF.|J
|7|-JF|--JL77-||F-JFJ|F7F7FJF7F-----7LJL7|LJFJF7||F7L7F-J|||LJFJ||F7JF7F7F7|L7L7||L-JFJ|FJF|L7|L7F7L7F-J|||F-JFJFJ|F--JL7F--J--F|7|FJ|FLL|7J
|J||FFJ7FL7|FF-JL7FL7||LJ||FJ||F---7|F--J|F7|FJ||LJL7|L--J|L-7L-J|||FJ|||||L7L7|LJF-7|FJL-7|FJL7||L-JL7FJLJL-7L7|F|L-7|FJL7J|.|F|L--L|JJ|L-7
.F7JLJFL-.FF7L-7FJF-J|L-7|LJLLJL--7LJL7F7LJ|||FJ|F7FJL7F--JF-JF--J||L7|||||LL7|L-7|FLJL--7||L7FJLJF---JL-7F--JFJL-JF-JFJF-J7|.FL|.|FJL|-FF|7
J-77|-JJ7L-||F-JL7L-7L-7||F7F7LF--JF-7|||LFJ||L7LJ||F7||F7FL7FJ.F-J|FJ||LJ|F7||JFJL7F--7FJ||FJL--7|F7F--7||7F-JF7F-JF7|FJ-F7F7----7|LF7LF77.
|.L-|7|FJ.L||L--7|F7L-7||||LJL7L---JFJLJL7L7LJFJ|FJLJ||||L7FJ|F7L-7||FJL-7||||L7|F-J|F7|L7||L--7FJ|||L7FJ||FJF-J|L--JLJL7FJLJ|7F|..J7.F-LL77
|.LLJ-J|--F||F-7|LJ|F7|LJ|L--7|FF7F7L7F7FJ-L-7|F7L7F-J|||FJL7LJ|F7||||F7FJ|||L7LJL7FJ|LJFJLJF7FJL7|||FJL7|LJFJF7L--7F7F7LJF7FJF77--JLF||L7J|
J7|FLJ-L-LFJ|L7|L-7|||L-7|F7FJL7||||FJ|LJF7F7||||F||F7||||F7L-7||||||LJ|L7LJL7|F--JL7L7FJF--JLJF-J||LJF-J|F7|FJ|F7LLJLJ|F-JLJ7|||-J.77L7-LF.
||7FFJLL.|L7L-J|F7|LJL--JLJ|L-7|||||L7L7FJ|||||||FJLJ||||||L7FJ|||||L-7L7L--7||L7F7FJFJL7L7F7F7|F7|L-7L7FJ|LJ|FJ|L----7||F7F7FJ|-JLF--7|77|.
7JJF|.FL7-FJF-7LJ|L-------7|FFJLJLJL7L7|L7|||||||L7F-J|||||FJ|FJ||||F7|FJ.F7|||FJ|||FJF7|FJ||||LJ||F7|FJL7L-7||FJF----JLJ|||||FJ|7FF7-|-L-J-
L-LL|F-J|7L7L7L-7L----7F--JL-JF7F7F7L7|L7||||||||FJL-7|||||L7|L7|||||||L7FJ||LJL7|||L7||||FJ|||F7|||||L7FJF7LJLJFJ-F7F-7FJ|||||F-7F7JJ|-L7L7
F-7L-J.F-7.L-JF7L----7LJF-----JLJLJL7||FJ|LJ|||||L-7FJ|||||LLJJLJ||LJ||FJL7|L--7LJLJFJ|||||FJ|||LJ|||L7||FJ|F---JF7|||FJ|FJ|||LJFJ||.FJ77|-F
F7|-|JL-LFF---JL-----JF7|F-------7F-JLJL7L-7|||||F7||FJ|||L--7F--JL-7LJL7FJ|F--JF---JFJ||||L7||L-7||L7|LJL7LJ-F--JLJLJL7|L-J||F-JFJL7J-7-J7|
LJ7J|-|JJFL7F----7F7F7|LJL---7F-7|L---7FJF-J||||||LJ|L7|||F7FJ|F-7F-JF-7|L7|L-7FL-7F7||||||LLJL7FJLJ7LJF--JF--JF7F-7F7FJ|F-7LJL--JF-JJ7.L.L|
.L-JF77J.|7LJF---J|LJ||F-----J|FJL----JL7|LFJ|LJLJ-FJFJ||LJ|L7||FJL-7L7LJFJL-7L--7|||L7|||L-7F7||F7F--7L-7FJF--JLJ.||LJFJL7L7F7F-7L-7-77|-7.
J7L-7JFJ.F---JF7F7L7FJ||F--7F7|L-----7F-JL7L7L7|7F7L7L7||F-JFJLJ|F7FJFJF7L7F-JF-7|LJL7|||L7FJ|LJLJ||F-JF7LJFJLF---7|L--JF7L7LJLJF|F-JFJF7F77
|7J||FJ7.L----JLJL7|L7|LJF7LJLJF-----JL--7L7L7L7FJL-JFJLJL7FJ7F7LJ|L7|FJ|FJL-7L7LJLF7LJ|L7|||L-7F-J|L7FJL-7L7FJF7FJ|F-7FJL7L----7LJ|L-7-|-L-
L..F|J|J.||F--7F7LLJ-LJ-FJL---7L-----7F-7L7L7|FJL7F-7L-7F-JL7FJL-7L7||L7|L7F-JFJ-F-J|LFJFJ|L-7FJ|F7L7|L--7L-J|FJLJ|LJ.LJ7JL7F7F-JLJJJFJ7LL|7
.FFL77FFF.FJF7LJ|F7LF7F7L----7L------J|FJFJFJ||F7LJFJF7|L7F7LJF--JFLJ|FJL7||F7L-7L-7L-JFJFL7FJL7|||FJ|F7JL--7||F7FF7F7F7-F7LJ|L7|F|||L|JLF-L
7-|F|7-7-FL-JL-7LJL-JLJL---7.L--------JL7L7|7|LJ|F-JFJ|L7LJL7FJF7-F7FJL7FJ||||F7|F-JF-7|7F7|L-7LJ||L7LJL---7LJLJL7|||||L-JL-7L-JF|-JJJLJFJ7|
|-|F.|JL7.LF7F7L----7F7F--7L------7F----JJ||FJF7|L7FJ-L7|F--JL-JL7|LJF7|L7|||||LJ|F7|FJL7||L--JF-JL-JF7F-7F|F-7F-J|LJLJF7F--JF7F-7J||F7-F.L7
|7|--J7LLJ7||||F----J|||F-JF7F-7F7LJF----7||L7|LJF|L-7FJ|L--7F---JL-7||L7LJLJ||F7||LJL-7LJL---7L7F-7FJLJFL7LJ7LJF7|F-7FJ|L7F7|LJFJJL7.F-|-L|
||JLFJ.7J7FJLJ|L-----JLJL--JLJ-LJL-7|F---JLJFJL--7|F-JL-J.F7|L-----7|||FJF---JLJ|||F7F-JF7F7F-JFJ|FLJF7F--JF----JLJL7LJJL-J|||F-J7FL|7L7J.L7
F7LLJFFJ.FJF7FJF-----7|F----7F7F--7LJL-----7L7F7FJ|L--7-F7|LJF7F---J|||L7|F7F7F-J|||LJF7||||L-7L7|F--JLJF--JF7F--7F-J7F----JLJL--7F--|.|.-F7
-J7777.7-L-J||JL7F7F7L7L7F-7LJLJF7L-7F-7F--J-LJLJ-L7F-JFJLJF-J|L---7||L-J||||||F7LJL--J||LJ|F-JLLJL-7F--JF--JLJF-JL--7|F7F-7F7F7FJ7.||FL7.-J
LFJ.7LJ7JF--JL7FLJLJ|FJJLJ|L7F--JL-7LJFLJ.F7FF7F7-FJL-7|F-7L-7L7F7FJ|L--7LJLJLJ|L7F--7FJL-7LJ-F7JF7FLJF-7L-7F7FL-----J||LJFJ|||||F-7-F.|7-L.
|.F-J--7-L-7F7L7F7F-JL7F7.F7LJF7F-7L--7-F7|L-JLJL7L---JLJFJF-JFJ|LJJ|F-7L-7F-7|L7LJF7LJF--JF7FJ|FJL7F7L7L-7LJL7F------JL-7L-JLJLJ|FJL77J.|-L
LFJ7|.F|7F7LJL7|||L--7|||FJL--J|L7|F-7L-JLJF7F--7L7F7F7F7L7L-7|FJF--J|FJF-JL7L7F|F7|L--J|F7||L7|L-7|||FL-7L---JL7F--7F---JF7F7LF7|L---7--F7|
||.-7-|F-JL---J|||F7FJLJ|L----7L-JLJ7L--7F7||L-7L7LJLJLJ|L|F7||L7L7F7|L7L-7FJFJFJ|LJJF7F7||||FJL--JLJL7F7L------JL-7LJF-7||||L-JLJF7F-JJ---J
-7..|L-|F7F---7|||||L--7L---7-L--------7||||L7FJ7|F--7F-JFJ||||FJFJ||L7L--JL7L-JFJFF7|LJLJLJLJF7F-7F-7LJL-7F7F-----JF7L7L-JLJF7F7FJLJF|-77||
LJ|-|L|LJ||F--J|||||F--JF7F7|F----7F---JLJLJFJ|F7|L-7|L-7L7|||||FJFJL7L--7F7L7F-J-FJLJF7F7F7F7|||FJL7L---7||LJF77F7FJ|FJF7F7FJ||LJJ.J-JFJFF|
|LJ-.FLLFJ|L--7LJLJ||F-7|LJ|LJF--7LJF7F7F--7L7LJ|L7FJ|F-J7||||LJL7|FFJF-7|||7LJLF7L--7|||LJ||||LJL7FJF---JLJF7|L-JLJFJ|FJLJLJJLJFF-7|L77.F..
JF|.F-JLL-JF7FJF7F7LJ|F||7FJF7|F7|F-JLJLJF7L7L7FJFJL7|L-7FJ||L7J-||FJFJJ|||L----JL---J|||F-J|||F--J|FJF7F7F7|LJF7F-7L7|L---------JFJJ-J7.||7
FFF|-|.FLF7|||FJ||L-7L7||FJFJLJ|LJ|F-----JL7L7|L7|F7||F-JL-JL7L7FLJL7|LFJ||F-7F7F----7|||L--JLJ|F-7|L-JLJLJLJF-JLJJL7LJF7F-7F--7F-J7-|-F7|J.
FFJJF77-L|LJLJL7LJ|FJFJLJL7|F77L--JL----7F7L-JL7|LJ||||F7F--7|FJJJLFLJ-L-JLJFLJLJF---J|LJF7F---J|FJ|F7F------JF7F--7L--JLJ.LJF-J|7J-F--JJJ.7
||J.-L.F7L----7L-7FJFJF7F7|||L--7F--7F-7LJL--7FJL-7|||LJLJF-JLJ-|.FL.L-LJF-------JF7F7L7-||L--7FJL-J||L---77F-JLJF7L--------7|F7L7J||-LLFL--
LJ7F|FFJL7F--7L--JL-J.||||LJL--7LJF7LJLL--7F-JL---JLJL-7F7L--7.L-7J|-LJLLL------7FJ||L7|FJL--7LJJFF7||F7JFJFJF7F-J|F--------JLJ|FJ-FF7.FJ7.|
-J|F|-L-7LJF-JF7F7F7F7|LJL7-F-7L--JL-----7|L7|F7F7F7F7-LJL7F-J-7-7J|J.F7-L|F----JL7||FJ||F--7L7F7FJ||LJL-J||FJ|L-7|L------7F77|LJ|.|.-|JF-J|
|7|JL|-|L-7|F-J|||||||L--7L7L7L----------JL-JFJ||LJLJ|F-7J||||LF7|.|JLF-7FFJF-7F-7|||L7|LJF-JFJ||L7|L------JL7|F7|L7F7F--7LJL7F7J-F7-|JFJJ7|
FJJJ--FF--J|L-7LJ|||||F77L7L7|F-7F-7-F-7F-7F7L7||F---J|FJFJL-7-F-7777.L7LFL-JJLJ7LJ|L7LJF-JF7L7||FJ|F-----7F-JLJ|L7LJLJF7L---J||J|LF7|J|.LF-
|F||7LLL--7|F7L7FJ|||LJ|F7L7|LJFLJ|L-JFJL7|||L|LJL----JL7L---JF|L--7.-LJL|F----7F77L-JF7L--JL7|||L7LJF---7|L---7L7L7.F-JL-7F7FJL7-.F7.F|JL-|
77.L7-FF7FJLJL-JL-J|L-7|||FJ|JF--7F---JF7||||FJF-----7F7L777F77L-J-L7FL|FFL---7LJL7F7FJ|F7|F-JLJL-JF-JF--JL----JFL7L-JF7F7LJLJF7|LJF-.7J.7.7
7|7|LF-J|L-7F-7F--7L--JLJ|L7L7L-7|L7F--J||||||FJF7JF7LJL7L7FJ|J.LL77LJ7-F7J|F7L--7|||L7|||FJF7F-7F-JF7L---7F7.F7F7L---JLJL7F7FJLJ7-F|7|F7.7|
|FL-7L-7L--J|FJ|F-JF----7|FJFJJFJL7LJF-7LJLJLJL-JL-JL--7L7LJFJF|.F-JF|FF|J|FJL---JLJL-J||LJFJ||FJ|F-JL----J|L-JLJL----77F7LJLJ.|-JF-JFL7L7|7
FF.F7J||F7F7||FJ|F7|F---J|L7|F-JF7L--J.L---7F7F-7F-----J||F-J-F-.F|JFL|7|L-|F---7F--7F7LJF7|FJ|L-JL--------JF7F7F----7L-JL----7JLLL--J|J.FJ.
.L77L7LLJ|||||L7LJLJL-7F7L-J|L--J|F-------7LJ|L7|L------7|L7.F7J7J|---J.J7.LJF-7LJF-J|L7FJLJ|FJF-----------7||||L-7F7L-7F7F7F7L7F7L7.FJ.LJ7.
FL|F7L-F-J||||FJF7F7F7LJL--7|F--7LJF--7F7FJF7L7||F-7F7F-JL7L7||F7.L..FLJJ|-L|L7|F7L--J-LJF--JL7L7F----7F-7|LJLJL--J||F7LJLJLJL7L-77JL7||7.7.
J--J|-LL-7|LJLJJ|LJLJL-----J|L7FJF7L-7LJLJFJL7LJLJFLJLJF7JL7LJL7||JL--.|.7-|F-JLJL--7-F--JF-7FJFJ|F---J|FJF7F------JLJL-7F--7.L--JJ-FLFJF7L|
.||-F-7|.LJF7LF7L-------7F-7L-J|FJL--JF-7FJF7L----7F7F-JL-7L7F-J7--JL|7.F---JF-----7L-JF-7L7||JL7|L---7|L-JLJF-------7F-J|F-JF7F77..77||LJ.7
FF77|FJJ7F-JL7||F------7|L7L7F7LJF---7L7|L7|L----7LJLJF7F-J-LJJ.L|7|.--FL-7F-J7F---JF-7L7L7||L-7LJF7F7LJ.F7F-JF7F7F-7||F7|L--JLJ|F7---|--L||
LLF-JL---L--7LJ|L-7F--7LJFJFJ|L7FJF-7L-JL-JL7JF7|L--7FJLJFLFJ.|J-7-77|F---JL7F-JF-7FJFJFJ-LJL--J-FJLJL7F-JLJF-JLJLJFJLJ|LJF-----J||JFFJ-7.LJ
|.|F7FL|-F--JF7L-7||F-JFSL7L7|FJ|LL7L-7F7F-7L-JL--77LJF7F7.|LJ7J7|-JFLL--7F7|L--JFJL7L7||F-7|F7F7L---7|L----JF7F---JF7FJF7L------JL-7J|F-7-7
-7LL7JJLFL---JL-7LJ|L7FJL7|FJ|L-JF7L-7LJ||LL---7F7L---JLJL-7FFJ.L|.|77|77||LJF7F-JF7|FJL7L7L-J|||F---JL---7F-J|L--77|||FJL---7F7F-7FJ|FL7.L|
LL.JJ.F7-F7F----JF-J.LJF7LJL-J-F7|L--JF7|L----7LJL---------J7LJF|LF-7-7JFLJ7FJLJF7|LJL--JFJF-7LJLJF------7LJF7L---JFJLJL---7JLJLJJLJ-|7L--F-
|-F.J-FLJ||L-----JF77F-JL-7F-7FJ|L----J|L--7F7L--7F7|F7F7F--7FF77|L7|F7FJJF7L-7FJ||F---7-L7L7L7F--JF----7L--JL-----JF-7F7F7L7LF---7LLJ|LJ.|J
|FL7.L7-FJ|F------JL7L---7|L7|L7|F-----J-F7LJL-7FJ|L7|LJLJF-JFJL-7FJLJ|7LF|L-7LJLLJL-7FJF7|FJ.LJF7|L---7|F7F------7FJF||||L7L-JF--J-L.L-7.L7
L|JFF-|LL7|L-7F----7L7.F-JL-J|FJLJF------JL7F77LJFJFJ|F--7L-7|F--JL-7FJJFFL-7L--7F---JL7|||||F7FJL7F7F-JLJ|L7F--7FJL-7LJLJ7L7F7L7.L7F|.|F|L|
||FF|--F-JL-7LJF---JFJFJF---7LJF-7|F---7F-7LJL7F7L7L-JL7JL--J|L7F7F7||F7F7|FJF7FJL----7|||LJFJLJF7LJLJF7F7L7LJF7|L---JLF--7FLJL-J-|LFLL7-7-F
FF7LJJLL---7|F7L7F-7L7|FJF7FJF7L7LJL--7||FJF-7LJL-JF--7L7F-7.|FJ|||||LJ|||FJFJLJF7F-7FJ||L7FJF--JL----JLJ||L7FJLJF--7F7L7FJF7F7F77J.-J-|-|7.
F7|.|..F7F7||||7LJF|FJLJFJ|L7||FJF----JLJL-J|L7F--7L-7L-JL7L7||FJ|||L-7||LJFJF-7||L7|L7LJFJL7|F----------JF7|L-7-L7FJ||FJL7|LJLJL7LL7|L--LF.
7JJFFF7|LJLJLJL--7FJ|F7FJFJ-LJLJ-L-----------7|L-7L--JF-7LL7||||FJ||F7||L-7L7|FJ|L7|L-JF-JF7LJ|F7F7F-7F---J||F7L--JL-JLJF7||F----J7.FJFL.L|7
7JLLFJ|L----7F--7|L7|||L7|F-7.F7-F7F---7F----J|F7L---7L7L--JLJ||L7|||||L--JFJ|L7L7|L--7L7FJL7FJ|LJLJ-LJF7F-JLJL7F7F-7F--JLJ|L---7L7..FFJL.L|
|7L|L7L-----J|F-J|J||||FJLJFJFJL-J|L--7|L----7|||F7F7L7L---7F-J|FJ||||L7F--J-|FJFJ|LF7L7LJF7|L-JF7F-7F-JLJF7F7L||LJFLJF7|F7|F---J7J-|7F-F-J.
LFF--JF7F7F7FJL-7|FJLJLJF-7L7L---7L---J|F----J||||LJL-JF77FJL-7|L-J||L-J|F7F7|L7|FJFJL7L7FJLJF7FJ|L7LJF7F7|LJL7|L-7F7FJL7|||L---7F7JLLLJJ|7.
F-L7F7|LJ||||F--JLJF7F-7|LL7L-7F-JF---7|L----7LJLJF--7FJ|FJF--J|F--JL--7LJ|||L7||L7L-7|-||F7FJ|L7|FJF-JLJLJF--J|F7LJ|L-7||LJF7F-J||.LJ-J--7F
.L.LJLJJFJ|||L---7FJLJJ||F-JF7|L7FJF--JL--7F7L7F7FJF-JL7|L7|F7F||F7F--7L7FJ|L7||L7L7FJ|FJLJ|L7|7||L-JF7F7F-J7F7LJL--JF7|||F-JLJF7|L-7.F7F|-7
-7FFL|..L-J||F---J|F---J||F-J|L-J|FL-----7LJL-J||L7|-F7||7|||L-JLJ|L-7|J|L7L7LJ|FJFJL7LJF7FJFJL7||F7FJLJLJF--JL-----7|LJLJL--7J||L7FJ77-LJ|7
L--|L|.7LF-J|L7F7FJL7F-7|||F-JF7FJF------JF--7FJ|FJL7||||FJLJF-7F7|F-JL7|FJFJF-JL7|F7|F7||L7|F7LJLJ|L--7F-JF--------JL--7F---JFJ|FJL--7.|.LJ
F|..FFJ7.L7FJ|LJ||F-J|FJ|LJL7FJ||.L------7L7FJ|FJL-7||LJLJF--J.LJ||L--7LJ|FJFJF-7||||||LJL-JLJL---7L---J|F-JF7F7JF-7F-7FJL-7F7L7||F---JF7FFJ
|.---7LFFFJ|F7-FJ|L7FJL7|F--JL7||F--7F---JFJ|L|L7F-J|L---7L7F7-F7LJF-7L-7||FJFJFJ|LJ|||F7JF77F7F--JF----JL--J||L7|FJ|FJL7F-J|L-JLJ|F-7-F|7J.
|-|-||.||L-J|L-JFJFJ|F7LJL-7F7|LJL-7LJF7F7L7L-JFJL7FJF7F-JFJ|L7|L7FJFJF7||||FL7L7|F7LJLJL7||FJLJF-7|F--------J|FJ||L|L--JL7J|F--7FJ|FJF-7J.-
FFFJ|7-J-LL-L-7FJ-L-J|L----J|LJF7F-JF7||||.|F--JF-JL7||L-7L-JFJL7||FJFJ||LJL7||FJ||L--7F-J||L---JFJ|L---------JL-JL-JF-7F7L-JL-7LJ7||7|FJ-F7
F7LLLF7-F7LF--JL7F7F-JF----7L7FJ|L--JLJ|||FJL7F-JF--J||F-JF--JF7|LJL7L7|L7F-JFJL7LJF-7|L7.|L7F--7L-J-F----------7F7F-JFJ|L-----JF7FJL-JL--7J
F-.F7JLFJL7L--7FJ||L--JF7-FJFJL7L---7F7||LJF-J|F-JF7FJ||F7|F-7|LJF-7|FJ|FJL7FJF7L7FJFJL7L7|FJL-7L-7F7L---------7LJ|L-7L-JF----7F|LJF----7FJ.
|7-|.F-L-7L7F7LJL|L----JL-JFJF7L7F-7||LJL-7L7|||F7|||FJLJ||L7|L7FJ7LJL7||F-JL7|L-J|FJF-JFJ||F-7L-7||L7FF---7F--JLFJF-JF7FJF-7FJFJF-JF7|L||F|
.L..J|.F7L7|||F77L---7F7F-7|FJL-J|FJLJJF7||FJFJ||LJ|||F7FJL-J|FJ|F7F7.||||F7FJL7F-JL7L-7L-JLJFJF7|||FJFJF-7|L---7L-J|FJLJFJL|L-JFJF-J|F7LJF7
|LF7.|F|L-JLJLJL7-F7JLJ|L7||L----JL-7F7|L-JL7L7||F-J||||L-7F-JL7|||||FJ||LJ|L7FJL7F7L7FJF----JFJ||||L7|FJFJ|F7F-JF7F7|F7FJF-JF-7L-JF-J||-FJ|
.FJ|7LFL7F7F7F-7L-JL---JFJLJF7F-----J||L-7F-J||LJ|F-JLJ|F-J|7F7||||||L7|L-7L-J|F7LJ|FJL7L7-F-7L7LJ||FJLJFJ.LJ|L--JLJLJ|LJ7L-7L7|F-7L--JL7L7|
LL7JJ7|.||LJ||FJF-7F-7F7|F--JLJF----7|L-7||F7FJF-JL7F-7|L-7|FJ||||||L7|L-7L--7||L7FJ|F7L7L7|FJ7L-7|||F-7L7F7-L7F-7F7F7L----7|FJ||JL--7F7L-J|
|J|.FL7-LJF7LJL-JFLJFJ|LJL----7|F---JL7FJ||||L7|F7-||FLJF7||L7|||||L7||F-J|F7|||FJL7|||-|FJ||J-F7||||L7||LJL-7||L|||||F7F7FJLJ-LJF--7LJ|F-7|
|7F-J-|-LFJL-------7L-JF7F---7LJL7F7F-JL7|LJL7||||FJ|F7FJLJ|FJ||||L7||||F7FJLJ||L7FJ||L7|L7|L7FJ|||||FJL7F7F7||L7LJLJ||LJLJF7F7F-JF-JF7LJFLJ
LLJJ|FJJFL---7F---7|F7FJ|L--7|JF7LJ|L7F-JL7F-J|LJ||FJ||L-7FJL7||||JLJ||LJ||F--J|FJ|FJ|FJ|FJ|-||-LJ||||F-J|||LJ|FJF7JFJL---7|LJLJF7L--JL--7J7
|.F7FL---LJF-J|F-7|LJ|L7||F-JL-JL--JFJL7F7||F7L-7||L-J|F-JL7FJ|||L-7FJL7FJ||F--JL7||FJ|FJL7|FJL-7FJ||||F7||L-7|L-J|FJF7F--JL-7F7||F------JJJ
-LFL7-J-.J7L7FJL7|L-7|7||FJF7F7F-7F7|F7|||||||F-JLJ.F-JL--7LJ.|||F7||F-J|FJ||F---J||L7|L-7||L7F-JL-J||LJ|||F-JL---JL7||L--7F7||LJLJF7F--7.||
|.|LL-J.F-FLLJF-JL--JL-J|L-J||||L|||LJ|||||||||FF---JF7F-7L7F7LJ|||||L7F||.LJL7F7FJL7|L7FJ||FJL---7FJL-7|||L-------7|||F-7LJLJL7F--JLJF-J7LJ
FL-77JL|JFL-|LL----7F7F7L---J|||FJ|L7FJ|||||||L7L---7|||FL7LJL-7LJLJL7L7|L-7F-J|||FFJL7||FJ|L-7F-7|L7F-J||L---7F7F7||||L7|F7F-7LJF--7FJ|F7-|
FJJ.L.FJ.FJ-LF-----J|||L-7F-7|||L7|FJ|FJ|LJLJL7L7F--J||L7.|F7F7L---7FJFJ|F7|L7FJ|L7L7FJ|||FJ7FJ|L||FJL-7LJF7F7LJ||||LJ|FJLJ|L7|F7L-7|L--JL77
|JF-JFFJ.L7-LL--7F-7|||F-J|F|||L7LJL7|L7|.F---JFJL7F7||FJFJ|LJ|F-7FJ|FJ|||LJJ||FJFJFJL7LJ|||FJFJFJ|L7F7L--JLJL-7|||L7FJL-7FJFJLJL7FJL-7F--J-
|L|.L|JLFF77F7F7||JLJ|||F7L7||L7|F--J|FJL7L7F7FJF-J|LJ|L7L7L-7LJFJL7||F-JL--7LJL7L7|F7L7FJ|FJFJLL7|-|||F7F-7F-7|LJ|FJ|F-7|L7|F7F7|L--7LJ|L7L
FF7J.||FFJL-JLJLJL7F-J|LJL7||L7LJL-7FJL7FJFJ|||7L-7L-7L7|FJF7L-7|F7|LJL7F-7FJF--JFJ|||FJ|FJ|FJFF-JL7|||||||LJ7|L-7||FJL7|L7|LJLJ||F-7L7FJ||.
F7|-J-7-L--7F7F7F-J|F7|F--J|L-JFF--J|F-JL7L7|||F--JF-JFLJL7||F-J|||L7F-J|JLJFJF7FJL||||FJ|FJL-7|F-7||||||L---7L--JLJL7FJ|FJL7F-7|||7|FJ7.JJJ
LJ-7|F-J.|.LJLJ|L-7||||L---JF7F-JF7FJ|F-7|FLJ||L7F7L---7-FJ||L-7||L-J|F7L--7L-J|L-7LJ||L7|L7F-J|L7LJLJ||L-7F7L-----7FJ|FJL-7||FJ|LJ-||LF77F|
|LL-7JJ|FFJJLJFL7FJLJLJF----JLJF-J|L7|L7LJF--JL7||L7F7FJFJFJL7FJ||-F-J|L7F-JLF-JF-JF7LJJ||FJL7J|FJF---JL7FJ||F-7F--JL7|L-7FJ||L7L7JFLJ-L|FFL
|.|-L7.F7-JF7LL-LJ.LF7FJF-7F7F7L-7L7|L7|F-JF--7||L7|||L7L7|F7LJ|LJFJF7|FJ|7F7L-7L--J|-F-J||F7L7|L7L---7FJL7||L7|L--7-LJF-J|FJL7L-JL|L|.F|F-7
|.J.LF-JJLFFJ7.FJ||.||L7L7LJ|||F-JFJ|J||L--JF-J||FJLJL-J||LJL---7JL7|LJL7|FJL--JF--7|FJF7|LJ|FJL-JF---JL-7LJ|FJ|F--J7F-JF7|L-7L7|LFJ||F7JJ.L
-7..FJ||.-7JL--J-F--JL-JFJF-J||L7FJFJFJ|F---JF7||L----7F-JF7F7F7|F7||F--J|L---7FJJFJ|L7|LJLFJ|F7F7L---7F7L-7|L7|L---7L-7||L7FL7|7|L77J|JLLJ|
F|7F7-7-7F-7.L7J|L---7F7|-L-7||FJ|FJFL7|L7F7FJ||L-----JL-7|LJ||LJ||LJL--7L7F--J|F7L-J7LJ|F7L7LJLJL7F--J|L7FJ|FJ|F7F-J|LLJL-J7-|L7-7LL---7JFL
LJ|LJFLJL77|F.JL7JF--J|||F--J||L7||F--JL7||LJ||L---7FF7F-JL-7||F-JL7LF--JFJL--7LJL---7F--JL-JF7F7FJ|F7FJFJL7|L7|||||L7J|.JLJ..L-J.JJ7JF|L-7.
||7J-||7F7-|JFJ-7JL7F7|LJL7F-J|FJ||L7F7FJ||F--JF-7FJFJLJF-7FJLJ|F-7L7L7F7L7F--JF7F---JL--7F7FJLJLJFJ|||7L7FJL-JLJ|L7|L7|-|FL-7FJ--.L7.777FJ-
F-7FFJF-J.|L7|JJ|F7LJ|L--7||F-JL7||J|||L7||L7F7L7|L7L7F7|FJL---JL7|FJL||L7|L-7FJ|L-7F7FF7LJ|L----7L-J||F-JL-----7|FJ77FL.J7|LFL-7.FFLJF--7.|
L.||J-|LF.L7FJ..7.FJL|F7FJLJ|F7FJLJFJ|L7|LJFJ||FJ|FJ|LJ||L-7F--7FJLJ7JLJJ||.FJL7L-7||L-JL--JF---7|F77LJ|F7F7F-7FJ|L7J77JFJ-J.LLLJLFJ.LJF|||7
F-7JJ7L7|--JJF-LJ.|L-|||L7F-J|LJ7F-JFJFJL7FJFJ||FJL---7LJF7|L-7|L-7F77F7FJ|FJF7|F7LJL--7F7F7L--7|LJL--7LJ|||L7LJLL-JL-JFJJ.LFJ..|L|FJ..77--7
|LF7.LJ|||FJ|L7|LL7-FLJ|FJ|F7|F--JF7|-|F-JL7|L||L7F-7FJF-JLJF7|L7FJ|L-JLJFJL7||LJL-7F--J||||F7FJ|F-7F7L7FJ|L7|-LF|.|-L-7F77.F77-FF--J-|L7J-J
L7JLF.F-LJ|F|F|L-L--J-L|||LJLJL7F-J|L7||F--J|FJ|.|L7|L7|F7F7|LJ|||JL7F7F7|F-J|L7F-7||F-7||||||||||FJ|L-JL7L7LJ.FL7JJ---L7JF-JJ7J.|.JLLF7|--7
.-7J.F7.|LLJL7|..-JJ|7|LJ7LLJ.F||F-JFJLJ|F-7|L7|FJFJ|FJLJ|||L--7||F-J|LJ|||F7L7|L7LJ||FJ|||||||FJ|L7L---7L-JJJ7F||F-.JJ|F7J.LFF7.LL...LL--J7
7LF-7LL7|7|LFLL.F|--L.|.LJ777FLLJ|F7L-7L|L7|L7LJL7L7|L-7FJ||F--JLJ|F7|F-J|||L7|L7L7LLJ|FJ||||||L7|-L-7F7L-7||F|J7|L-J.FL|JF7-7JL777L-|||JLFJ
|.|7.FJ-L-F-7L|JJ.7||7|F7L|-7J.|LLJ|F-J-L7|L-JLF7|FJ|F-JL7||L-7-FLLJLJL7FJ||FJ|FJFJF--JL7||||||FJL--7||L7FJ7JJJ|FL..J-F.|LLF-LJLJJ7.L||-77|J
.F|7F77F|FJ--7J|.LFJ-JF-7-7F7.FJJL-LJF|LLLJFLFFJLJ|FJL--7LJ|F7L7--LLF--JL7|||FJL7|JL-7F7|||||LJ|F7F-JLJLLJJ.|.7L||FFJ7L-J|FJ.L-FL-77F|.LF-J7
-L|LLL77.|JF|L-F-.LJ|||L|..--J-7LJ-|-|||7.|7|LL7F-J|F7F7|-FJ|L7||LL.L-7F-J|||L7FJL-7-LJ||LJ||F-J||L77LJ.|L-7|F|.|77L.FLJ.|.F7L-7.-7F-J.L7J.7
|.|JLFL77|-J7.F|.FF-7-LJL77..|F777J.FL7-J-|.|7||L7FJ|||LJ7L7L7LJ77LF7|||.FJ||FJL7F7L--7LJF-J|L-7||FJ7777|.FL|.F7|LJ-L-7F-|.--7F77..|7.||.|7|
77LJ-J|.L7.L|-F7F7|J|7.F7J7-J-L-.-.7-F-.|LL7L7FJFJL7|LJJL|-L-JJ.L-FJL-J|FJFJ||F-J||F--J7LL-7|LL||||LF7J-F7LL-7JF|J|LL7LJ-7JF|-JJ|.FJ|.LF--J|
F7.|7.LL.JJFLJ.|7LLF-J-||L.F.FL.J|LJJF.F.F-||FL7L7LLJF|F-JF|LFL--LL-7F7||FJJ||L-7||L77LJL||LJ-J||LJ7L-J|LJ-L|7-JJF7.LJJ7F-7F7-|L|-|FJ7-L7L7|
|LFFFJJL|7-J...7|F7LJ7.|7.JFF7.F|7|F-JF.F--LJ7LL7|-L.F7JLLJ7.F-J.||FJ|||LJ||LJ|LLJL-J-.|L--..|LLJ|J.F|LF7L----7L--77.|F7-.-J|F|.LF7-L--JJFJ7
J-FJ--F7J|-J-F-.|.|FFJ7JF.FL|-|JF7-|J7.-J|J|LL-LLJ||FFJ.F|LF7F-LF--L7|LJJFJJ.LL-J.LJ||F7FL|..|7.LLF.7--.F.F|.J77|F-J.|J|-F|F|---F7.FF..L.F7|
L.LL|77J-|.L7LJ-7-J|JLJ.J-|-LJ.-LL-L.L..L..F-JJLLJ--J|-L-7.L-L7.-L-LLJLJLFJ|-JJ-J-L-L7-LJ-LJ-L7J-LL-L--J..LJ-J.7--JJ-F----J-J.J.LL7JJ--J7LL.

5
src/input/day10_test1 Normal file
View File

@@ -0,0 +1,5 @@
..F7.
.FJ|.
SJ.L7
|F--J
LJ...

10
src/input/day10_test2 Normal file
View File

@@ -0,0 +1,10 @@
.F----7F7F7F7F-7....
.|F--7||||||||FJ....
.||.FJ||||||||L7....
FJL7L7LJLJ||LJ.L-7..
L--J.L7...LJS7F-7L7.
....F-J..F7FJ|L7L7L7
....L7.F7||L7|.L7L7|
.....|FJLJ|FJ|F7|.LJ
....FJL-7.||.||||...
....L---J.LJ.LJLJ...

140
src/input/day11 Normal file
View File

@@ -0,0 +1,140 @@
...................#.....#...............#......................#......................#...................#...........................#....
..................................................#................................................#..............#.........................
......#.....#.................#..............................................................#..............................................
......................................................#..................#.....#............................................................
.....................................................................................#.....................................#................
.#............................................................................................................#.............................
..................#......................#............................#..............................................................#.....#
......................................................................................................#.............#.......................
..............................................#........#........................#................................................#..........
.....#......................#......................................#.....#...................#..............................................
.........................................................................................................#..................................
......................#...............#............#........................................................................................
..................................................................................................#.........................................
..........#..................................................................................................#..............#..........#....
....#...........................#..........................#..............................#.................................................
........................................#............................................#.................................#.........#..........
...................................................................#...........#..........................#.................................
............................................................................................................................................
............................................#...............................................................................................
....................#.................................#................................................................................#....
............................................................................................#...............................................
............................................................................#........#.........................................#............
...#...................#..........................#...............#......................................................#..................
..............................#........#....................................................................................................
................#................................................................................#.......................................#..
......#..............................................................#...................#..................................................
.#.........................................#..........#.........#..............#........................#............#......................
............................................................................................................................................
...........#...................................#...............................................................#.............#..............
........................#........#........................................#..........#..................................................#...
....#.....................................................#.................................#......................................#........
...............................................................#...................................#....................#...................
#.............................................................................#..................................#.............#............
.............................#..........#.............................#...................................#.................................
........................................................#...................................................................................
.............#........................................................................................................#................#....
...#.............................................#..................................#......#.....#..........................................
................................#..............................#............................................................................
...................#........................................................#...............................................................
#..........................#.........................................................................#......#...........#...................
.......#...........................#.....#..............#.................................................................................#.
......................#.........................#...........................................................................................
.....................................................................................................................#.......#......#.......
.............................................................#....................#...............#.........................................
.........#..................................................................................................................................
...............................#............#....................#.....#...............#..................#.................................
....#...........#.........#.........................#..............................................................#..................#.....
.....................#.......................................................................#..............................................
....................................................................................................#.......................................
.....................................#..........#...............................#...........................#..........#..........#.......#.
..........................................................................................#.................................................
.#..........................................#.............................#.................................................................
.................#...........#............................#.............................................#......................#............
.........#...........................................................#..............#.......................................................
..................................................................................................#.............#.......#...................
.............................................................................#.......................................................#......
......#.............#...........#..........#........#...........#...........................................#...............................
.........................................................................#..................................................................
........................................................#...........#...........#................................................#..........
........................................#....................#..........................................#.............#.....................
..........#...................#................................................................#..........................................#.
..................#.................................................................................#..........#............................
..........................................................................................#.................................................
..........................................................#...............#.................................................................
............#................................#......................#..........#.........................................#......#...........
..#.......................#..................................................................................#.....#........................
.................................................#...........................................#..............................................
.........#........#..................#...........................#.....................#...............#.............................#......
......................................................................#..........................#.....................#....................
............................................................................................................................................
........................#.....................................................................................#............#............#...
..............#............................#.................................#......#.......................................................
........#..........#........................................................................................................................
............................#............................................#..........................#.......................................
.......................................................#......#.........................................................#......#............
.........................................................................................#.....#..................#.........................
.......................#................#.......................................#............................#.......................#......
............................................................................................................................................
.........#.......................................................................................................................#..........
...#..........#................................#...........#......#.....................................................................#...
....................................................................................#.......................................................
.............................#.....................................................................................#.....#..................
...................................#.....................................................#.............#....................................
.....#.............#................................#......................................................................................#
.............#............................................#...................#.................#.....................#.....#......#........
#...............................#.........#..........................................#......................................................
.........................#...............................................#..................................................................
.................................................................................#......................................................#...
....#...........#..................................#......................................................#.................................
..............................................#.....................#.......................#...........................#...................
..............................#.........................#.............................................#.........#...........................
.........................................#.....................................#...............................................#............
.#.........#..................................................#..........................#...........................#......................
............................................................................................................................................
.........................................................................................................................................#..
.......#..........................................#.......................#................................................#........#.......
............................................................................................................................................
.................#.........#.........................................#.........................#.....#......#...............................
............................................#..........#......................#......#......................................................
....................................#.............................................................................#.........................
...........................................................#................................................................................
.................................................................................#........#...............#..............................#..
.......#...........#..............................#.........................................................................................
..#...............................................................................................#.................#............#..........
..............................................#..........#...............#..................................................................
..................................#.....#.....................#.......................#...............#......#.............#................
..........................#.................................................................................................................
....................................................#..................................................................#....................
...........................................................................#..............#.....#...........................................
#...................#...........................................................#...........................................................
...........................................#....................#....................................................................#......
.......#.....#........................................#....................................................#................................
..............................#...................................................................#.........................................
.............................................................................#.......................................#......................
.....................#....................................................................................................................#.
.................................#....................................#........................#............................................
......#...........................................#.........................................................................................
...........................................#................................................................................#......#........
..........#...............#.........................................................#.......................................................
..................#...........................................................#.............................................................
...............................................................#............................................#.......#.......................
....#........#...................................................................................#..........................................
......................#...................................................#...........#................#....................................
........#..............................................#...................................#....................#...........................
..................................................#.......................................................................#..........#......
.#...................................#..........................................................................................#...........
..........................................#........................................#...............#........................................
..........................#.....#........................................................................................................#..
..................#...........................#..........#...........................................................#......................
...................................................#......................#...................................................#.............
.........#................................................................................#.................................................
..............#................................................................#............................................................
...........................#.........#..............................#...................................#..........#....................#...
..................................................................................................#.............................#...........
..#..............................................#..........................................................................................
.................#.....................................................#.................#..................................................
.................................#.........#...................................................#......#.........#...........................
..........#.........................................#.....#......................#..........................................................
....................#..........................#................#...........................................................#......#........
#........................#.............#..................................#.................................#...............................

10
src/input/day11_test1 Normal file
View File

@@ -0,0 +1,10 @@
...#......
.......#..
#.........
..........
......#...
.#........
.........#
..........
.......#..
#...#.....

10
src/input/day11_test2 Normal file
View File

@@ -0,0 +1,10 @@
...#......
.......#..
#.........
..........
......#...
.#........
.........#
..........
.......#..
#...#.....

1000
src/input/day12 Normal file

File diff suppressed because it is too large Load Diff

6
src/input/day12_test1 Normal file
View File

@@ -0,0 +1,6 @@
???.### 1,1,3
.??..??...?##. 1,1,3
?#?#?#?#?#?#?#? 1,3,1,6
????.#...#... 4,1,1
????.######..#####. 1,6,5
?###???????? 3,2,1

6
src/input/day12_test2 Normal file
View File

@@ -0,0 +1,6 @@
???.### 1,1,3
.??..??...?##. 1,1,3
?#?#?#?#?#?#?#? 1,3,1,6
????.#...#... 4,1,1
????.######..#####. 1,6,5
?###???????? 3,2,1

1365
src/input/day13 Normal file

File diff suppressed because it is too large Load Diff

15
src/input/day13_test1 Normal file
View File

@@ -0,0 +1,15 @@
#.##..##.
..#.##.#.
##......#
##......#
..#.##.#.
..##..##.
#.#.##.#.
#...##..#
#....#..#
..##..###
#####.##.
#####.##.
..##..###
#....#..#

15
src/input/day13_test2 Normal file
View File

@@ -0,0 +1,15 @@
#.##..##.
..#.##.#.
##......#
##......#
..#.##.#.
..##..##.
#.#.##.#.
#...##..#
#....#..#
..##..###
#####.##.
#####.##.
..##..###
#....#..#

100
src/input/day14 Normal file
View File

@@ -0,0 +1,100 @@
#....#O##.....O.#...##...#OO.....##...#O...O..........OO......#..OO..O.O...O.O#O#..O...#.......O...#
O.....O#..O#O...OO.#.....O#.....O.O..O.O..O.O#.O.#...#...O.#.........#..#O.#......#O.O...#..#.##.##.
......##..#.O#..#.O.O......#.O#..O....#.#..#...#.O.#....#....O.#...#O#OOO.##...O............OO#.#..#
.OO.................#.#.O.#O.O.#...#..........##.O..#.O##..##O......#O...#.#...O...#......O.........
#.......O#...#.OO.##.O.......#...O......O#......#..#.#..O...##..O#..#O.O.....#..OO..O.O.....O.....O#
.O..O.OO...#...#O####...##.O.#..O......#O.O..O......O.......O....O....#..O...O.....OOO..#...O.....OO
OO.#O.....#.O.#O.#OOO...OO#.........#..O.#O.#O..##O...#.##..#.....#...#.....O...O...............O.OO
...OO..#....O.#O.....#.#.#..O...O.#....#....#O...O.........O..##O....O#.O.......OO#.O.O..O......OO..
...O....#....#.....O...O.#.O.O...O..#..#.O.....O.#....O#O#.##O....O...#....#......#.....#..O....#..O
OOOO#..##...##.....OO..O##.O.OOO#..O...O.#....O..OO##......O..#.O.#.....O.O#.#.#.O....#..........#O.
#.OO#O.O..#.O....#..O.OO#..OO...O.O...O.#.O...##.O.....O..OO.#O..#...O.##..#......O#O#OO#...##O.....
..#..##...O#.OO#.O.O....###O.O......#....#O..O..O.....O#O.#.....O#....O...#OO.....O###O.....O.OOO.O#
O.........OO..O...#.O.#O.#..O...O#.....O#.O...O.OO#.#.#...#...##...O#.OO.OO....O.OOO........#..OO.##
.....O..O........OO...OO#O..O.................#...#..#....#.O..#..O#..O..#....O##..#...#O.O.OO#O...#
....OO.#OO...O.O.OO.##..OO....O#....O......O..O....O......O...OOO.OO...#.......O.OO....O...OOO#...#.
....O......##..O.#O...O.O.O#.##..O.....OO.#..O..O..#.#.O..OO#..#O..#..O##.##..O#.O.O#.O#O#.O.#....O.
..O#.O.O#.##....##.O#..O....#O.O#...O....O..O###..#..OO.O..O.....O##..#...#.##.............OOO...OO.
O....##.#OOO...#....#...#....#.OO..#.O....O....O.....O##..O.....#....O.OO.O#.O.O.#.#.O#..##.O.O...O.
..#.O......#..O.....O.O.......O...O#O.O...O..O......#......##..##....OO......OO..#..O#.O#O#O.#..#...
...#O...O..O......O.#......OO..O..#O..#O#O...O.......OO#.#OO..#O....O.......#O.....#....OO....O....#
...O.OOOOO..#..O.O.O#..#....O#...##.#..#.O.O.O.......O.....#....#O.O.#O......#.OO...OOO...#....##O..
.#.......#.O...##..O.OO....O..#.#..#..O..O...##O.OO#.#.........O........O#.#..#O.....OOO##.#..O...OO
...O.....#..O#..##OOO....O.#..O.....OO.##..#OO.#...#O#..O#.OO..#.O....#OO.......O.OO.O.#O##..O.O.O#.
...#...###..#..#....#O#..#O......##.O.####.#.....O.O.......O#.#.O#.O..#..#.#...O...#...#O.OO...O....
#OO.#O..........#.OOO.....O...##..O.O..O#O.O##O...#...#....#....O.O.#.#O...O.#..O#.OOO..#..#.O...O..
.O....#OOO..O..#.#.O.#OOO.......O.#..#...#OO.##.#..OOOO...#.#..#....#..#....O.....#.#.OO....O.......
.OO...O#..#............O...#.#.OO.O#OO....#O..#....O.#O.OO......O.O.....O...O.#.....OO.##..#...#O.O.
..O..O#O.#OOO....#.OO....O....O..#.#.......#...............O...O....OO.O..#O...OO...#OO........OO...
#OO.O...O#.O.O.O#O.#...O.O......O#.O....#O.....O..#O#..O...O.OO.O.#O...O..O..#...O.##.O...OO..O.#O..
#..O...#O...OO..O..O.O.O...#.......#.....O.O....#...#..O....#.......##..O.O#.....O........#.....#..O
.#....O..O.........#..O...#....#O#..#...O.O.OOO...O...#.....##...##.#...OO#O..O....O..O...O#........
...O...O.O..#.#..#O........#####.O#....#O##OOO.O..O.O#.O.......OOOOO....#.##O..#...#.........O..O.OO
..#..#...OO#.OO..O....##.O..OO.O.O.#.#O#.O#...O...O.O.#O......OO..O.#.#..O.OO.......###OO.##O....O..
........##.O##O#..#......#.....O.O...#..#O#.........#....O...#..O..#....#..#.....O...O.O.O.#..##O.O.
.....O...O##...#.#...#O#....OO.....#O.O.O.#.#.#.#.....O..#..O.O.#..#.OOO....OO#...OO.O..O#O...O.#.#O
###....O.O..#O......OO.#.OO.##.O...#O.#...O.#.O....O....O....#..#...O..##.#..O.O...O...#.#.#.#.O#...
....O#..OO#..#...#.O.OO.O##.O..O...O...#..#.OO.O.O....##....O..O.O.OO...##O..O.#O...O#..#....O#O....
#....#....O.#.O...OO....O....#......#O###O##.......O..OO#O...#O#..O...O....##...#..###.O.#..........
#O#.#.#.....O.....#.#.O....O....OO#O......O#.#.OO#.....#.OO.O...OO##.O....O.O##...#.............#O..
..#.#..###.....O.O..O......O....O....#O.OO.O....OO..#.#O#......O..#..O.##.#.##..O.OO...O......##...#
...#.O..#.OO.........O..O.#O......#O..#..O#.O#......O#..OOO.O##....O....#.##O...O.........#O.##...O.
.....#O..O.#OO.O....#..OO..O#..O..O#..#.OO.#..O.O...O.....#.#O....O....O##.O.O..##O.O.O..O....#.O#..
##.O.O...##..O..O..#O..#.#..O#.#.O.....#..O.##.....O##..#O.#.....O....O....#.OOO#.....O...O....O..#.
.....#.O#.O#.O....O.#...#....#.#.....#..#O..#.O......O.O.O...##..OO..O.#..#..#.#...#.#...........OO.
....O#.#.O..#....O....#O.O.OO##O.........##O..#O.OO.OO..#....O.O#..###.O......##.O..#.#O..#.....#...
....O.O.#.O....#O.....##....#.O......O.......#..#.O.#..#O.#.OO.#.OO..##..O..#O...O.O.OO......O#O....
OO..O..O...#.......##OO.........#....O.#.OOO.O..OO..O.....#...O..#..O.....O..#...O.OO.....O#.O.O.O.#
.OO#......#O.#......O....#.#..#O..O...#.#.........OO..........O..O.....O.O..O##.O...O.O...#.........
..#.#OO.OO........#O..O...#O#OO...#..O..#.##.OO.#.....O..O.OOO..#..#.#....OO...##.OO..O#....O....O.O
.#.#.#..O.OO..O......O...O#O.OO.......#...O...O.#O...OO..O#.O.#.##............##.OOO#.OOO..#O.O#...O
......O...##OO.....#.##O#....#OO.O....#.#....#.....O.O......#...O.O#.##...O#............#....O#O.O.O
.O....#...O....#.##O.....O##.......#...O.....#....O.#O#.O..OO#O...#.........#...OO.O##..#..##....#.#
##O.#O......O..#.#...##.##.O##.#.....#OO#..#.........#O.O...#......#..O..O.O##..O.OO......O#O#O#..#.
......#.O#O.O...#O.OO.....O...O##.#.OO#..OO....#O..#....#.....O.#O.O.#O#..OO..O..#O.#.....O#......##
....###.......OO#O...O..#..#.#.....#.#...O..OO#.O..#OO#.O..O....OO.O.#.##O..#..O...OO.#.O.#......#..
#O.O....#...#.O..O..####....O#........O....O#..O..O..OO..OO...OOO..O..OOO......#.#....O..##.O#..#O##
..........O.#.O.O#..#.O..O#.#....#...#.##OO..OOO.....O##O#....#O.#....#.O...#O#.O.#.##..#O.O#.......
.....#...#O#......O#.O..........#O.O.OO..O..OO.#.............O#.#........O#.OOO##O...O.O#.#...#.....
O..O..O.........OO#...O.O...O....#.#.#...OO#...OOO...O........#.#O.OO#.O.....O.O..O#.OOO.O...O.OO...
OO#....#..O.#.O.O##O##.........#..O..#.O.##..O.##.#.OO..O.....##..#......OO..#...#...O..O..#.OO.#.O.
#.O....#..#.....#.##.#...O.O...O.O...O#...#...O..O...#...#..O.#.O#.OO.#....O....O#..#.O##...#...#..#
##...O..#.#......#O.O...#O.....#......OO...#OO..O......#.#..........O#..O..O..O.O.O....O...O...#O..#
..##.#O.#.OOO..O...O..O.O..O...##.....OOO#..O......#..O...........#O......O..#OO#..O.O.##....OO..O#.
.#..............O#..#..O#O...OO###.##....O.#.##..###.#O.#....#...#.OO.O#....O..OO..#OO#.O..........O
...#.#...#OO........#.O..#.O...#.O.O.#.....#......O#......#....#.##O.###.O....##.....O#OO.O....O##..
.O.O......O..#.....O......##O#..#..OO..#.#..O...#.O..#O.O#OO..#..O#.O....#...#O..O..#..O#.O.....O.OO
O.#.O.OO.OO.O......O..#.O...O#O..OO......O...#......O..O#O..##O.#OO....O......OO......#O......#...O.
.#O..O.#O..O.O#..O.#...#...O##O....#O.O##..#OO.....O..OO#.O##...#....#..##..OO.OO#..O...OO.....#.#.#
O#.OOO.#O..O.O#.O#O......OO...#O....O............#..#........#.O##..#O.O###.OO..#...#.....O........O
O......O.OO..#.#..#.......OOO.#.#........................O#O.#..O..........##.#..O#.......#.#....O..
O.#O...O#.#O.......O##O..#..O.#.#O.O.O...#OO..O.O##O.....O....OOO...##..OO....#.#..##...#..O.#.O.#.O
#..#.#O.#..##....OOO.....O......O.#O..#O..O.#O.O.#....O...O#.OO##..#...O###....###..#..O.#.O...#....
...O.......O.O.......#.#OOO....O.......#..O...O.........##..#.O.#O.O......#..OO.O.O......#.....OO...
O.....#O.#.#....#..#.O.OOO...#.O###......OO...O.O.O.###...O.O.......##..#......#..OO.O.....OO...O.OO
O.O.....#.#.#....O#OOO.....O.....#O...##O..#OO.O.......O.O.......#.O.#.........#..........O...#.OOO.
O....OO.#.#O##.O....#O#.OO..O...OO.#.#O.#.#.O...O#O...OO.#.O...##...OO..#OO.#......#O......#....O.O.
O...O......O..#..#.#...##..O..#.O.O......#....#.....O#O.O....O.#..O..............#.O...#...OO.....O#
....OO.......O...##O..#.O#..O#..O..O#.#.O#.#..O.O..#.......#O..OO.O.#....#..#.......OO..OOO.#O#...O.
.#.....O......O..O...O....#...OOO#...O#.#.#.#.OO.O.O...#..O..O#......#.O.....O.O.O....#...O#.....#.O
...O#........O......OOO..#.OO#.O.#.O..##......#.#O...O.O...O.#O.OO.OO..#..O...O.........#.O##..OO##.
..O..O.#O..#O..##....O.O.#O...O#.O.....##.....O......#...#.....OOO..O##.O#..#.#.O.......#O...O#...##
...O.OO..O.#.OO#....#.O#O..O...#O.O.###...##...O.O..#..O..#.O....#........#...#....O...O....#O#O.O.#
...OO.#...O...OOO..O.....#..#.O.#OO...O...O..#..O..O.O...O..#.#O.#OO.O.....O.O..#...O..O..O#.O#O...#
O...#...##.OO..OO.......#..O.O..OO.OO.O#......#.O#O.O.#..O.#.O.O.O#OO...#.....##O.OO.#OO....O...###.
O.............#.#..#.O....#....O...#..O..O#.O...OO.O.O........O#.O........OO..#....O...#O#O#.O.#OO.O
OO.........O...#.O.O...#.....O...#.OO#O.##............#....O....##.##..#.O..O....OO...OOO..O........
O.....#....O.#O..OO.O#.......#.....#....#.....##OO#..O..#OO.....#.....#..OO#..O#..O.O#OO.O.O...O.OO.
OO#....O....O#....#O#.....#.....O.#O#..OO.OO.O..#..O....#O..O#.#O#..OOO...##...#..#...O..O...O#..O#.
O......O#...O.#......O.O..#..O.#.....O...O...OO###...#.OO......O..O....#..O#.O....#..#.#..#.OO..O...
...#...#O#O.......#.O#.O....OOO.O..OO#.O.O..O#....O....#OO..O.......O.#..#...#.....O...O.O..O..O.#..
.O#..#.O#.#O#.O#..O..#....#O#..#.O.##.O.OOOO.#O..O#....O..OOO.......OO.#...O..O#O..O#...#O...O.#....
O.#.O.#.O...O.#.......#O.O#O.##..#...#...O#...O#O#O.#O...O..O.....#.O.##OO.O...O#.#...O.O#...#..O###
O.......O#..#......#....OO.O.#O..##O...OOO.O....O..#O....#.#..##OOO.OO#.....#..O.O...#O...O..O.O..OO
...O..O#O.O..O...##.....O.O.#O........O.###O#..#...#.OO.#.O.....OOO.#.......O..O.OO..O#...O.....O#..
........#..O#..#O.#OO.O.O..#.##..#O..#.O......O.O.#O.O.......#O#..O..##..O#.......O.#..O.#.O.O.O#O..
#..O....O.....#.O....O..##....O...O........#O....#...#..O....#....#..#O.O.......O.OOO..#...OO...#.#.
.O.O..#OO..O..O.O.........##..O...........OO..O.O.....OO...O#.#.......#...O#O...#..O.O...O.O#...#...
O.....#O.......O#..O..O..##O..#.......#...#.O......O...O..#...O..O..OO.#O..O..O.#......OO...#...OO#O
..###O.........O..#.#.#.#.O..O.#....#...#..O##O#..#O#.O#OO.O.O....O.....#O...#..O..#O..O....#.....#.
....O#.O..#......#..OOO..#.O.O...O.#O.......O.O.#####..#.....#.#.#....#...O#..O.O.O.O...O..#.......O

10
src/input/day14_test1 Normal file
View File

@@ -0,0 +1,10 @@
O....#....
O.OO#....#
.....##...
OO.#O....O
.O.....O#.
O.#..O.#.#
..O..#O..O
.......O..
#....###..
#OO..#....

10
src/input/day14_test2 Normal file
View File

@@ -0,0 +1,10 @@
O....#....
O.OO#....#
.....##...
OO.#O....O
.O.....O#.
O.#..O.#.#
..O..#O..O
.......O..
#....###..
#OO..#....

1
src/input/day15 Normal file

File diff suppressed because one or more lines are too long

1
src/input/day15_test1 Normal file
View File

@@ -0,0 +1 @@
rn=1,cm-,qp=3,cm=2,qp-,pc=4,ot=9,ab=5,pc-,pc=6,ot=7

1
src/input/day15_test2 Normal file
View File

@@ -0,0 +1 @@
rn=1,cm-,qp=3,cm=2,qp-,pc=4,ot=9,ab=5,pc-,pc=6,ot=7

110
src/input/day16 Normal file
View File

@@ -0,0 +1,110 @@
\...\............................../...\....-..../...|....../.......-...........................|.............
.............|/.../............................-....|......../...........|.|................/\-..|....\...../.
....\......-.....||-\........................|/........|............/.......................|\...|............
|.....-....\.|......-.\....\-......|.........../|......../\...\.-..........-.........\...-..\........./.......
............../.|..........|.......|.......\.\...............|../......................\......................
.-.-...|....-.-.......\...\..../....../.......-..................\......./....................-........-......
..........\.....|.....\.....\..................................................................|..............
...../..................../...........-..-.........................-...................................../-...
......\......\.............|..../..........\.........................\..\../....../...........-...........-...
.....|./..........-....\....|........./..........-..............-./........../..............-...\...../.......
...../...../.......-..............|......\\../......../........../............../......\......\...../........-
..\................|......\.............\|............./..../...-...........................|-../|...|......./
....|.........-.|....-....-.....|.......................................-...../.\.............\.........-.....
.........-........././................\../...........\.......\......./.....\................\...\.............
.............|........\....|........\........................././\............-............./............/....
................./...-..........|..............--../.|\............./.........................................
.|../.....|................|........../.......-.......-.............\.........................................
.............\..................\......../.......\/................\....\......../...././....................|
.................\................................../..........................................|..............
................|..................../..................\...........................|./..........-.........-..
...|.............\.....-..||...-......../.........................../......................-..-|.........-....
.\...........................-../................|.../............/....-......\............................../
.........................|...............|...........|.|.............\....\...../........-.--/................
./...|.........-.............|..-../..........\........./../...........................|.....................\
.|.....-......\..-..................\..|.../................................/\......-.........../...../..../..
...\...............\....\../.........|\................-......................................\...............
....../..-|...................................\.........|...-....|..../.......................|/..............
.........|.|..............-...................../.................|./-....|../..........\..............|......
.......\..|...\...........|....................|.-......................\..-.../.......\|..........\.../.|.\.|
-.............................|....................|.....|.........-.........|..-........./.......|\.|.../....
.-.......\...................\.....\../......|..............|...................-............./.....-.........
...|..................../..|\....\..-............\................\..................................|....-...
...............\....................\.|\....-.............|....../.................\..........\....../.....\..
......|..\......................-........\.......\.../.|......-...............|......./\../........../........
.........-..../........-\.........-.......-.....|.|....\.\........\.-.......|.........-....|...--.-..|........
.....|..|.|....-./.....|.....|...........|/\...../.............\/....|-........./..-.................../......
.|....../..............-...-............-.......-....................\..-...-.|...............................
|.............|............................|.............................-....................................
....../....-../..........\...|......-.|...........\..|..................-...../../-..\.........\.....|........
......\../..................-..............-.../.......-.............................\..-....\/...............
............\......................./..................|....-....................-........../.....-.......-...
...............|...........-./.......\...-..../....|....-........./..-.........-...........-.\................
/..................../.................\.....-................./\/........../............./..|................
....................../.............../\..........|.....\|../...-..\............|........./...................
......................-../.|...............................................-......./..\......|................
.......\...............|..............|.../............................\........./....|.....|................|
....\......../....-...|.................-..........-...|/./...................../.\...........................
.........|......./.............|../..-.......................-|...........\.........|...|.....................
..\............../.......................-....\.................-.....|.........-.............................
.....-/...............|......|..../......-...|..../...........-................................-.....\...\...\
......................../.......\................./..\..........\............|...................\............
-....................../...........\......./...|...........\|./........-..................\...-......../......
.......|./..........|...\................/..............|.\.............\.\..................................\
.|............\.......\..........\./..........-...................../..|............................../.......
........................../....../...|......-..\..............|-.|....\-...|../.........\......-.\./..........
....../.........../.........../..\......./......../-...\...........\............/.....................|...\...
...-....../.../.....\....-...........\..................../.........-......................\..................
/............|../.......................-.........|....../......|.......|............/-..../..../............|
../..|...............|../-................/.........................................|.........................
.....-..........-\-...........|....../\....................|......................-.....-..........\..........
.-.....\......./.....\............../...|...|............-...|...../.............\...\../|...../...|......../.
.../......-..|...................\-...../..-..|.......|..-..../........|....-.../.......|........|......|.....
.-....../............/........-/..........\........\...........................\..........................|...
.....|...|........................................../...........................-|.......|..-.................
|...........|.\..............|......................-|./.......|../....\-.|\.../...-.......|.......|..........
.|.........\.|../.....-.........\......\..\...........|...................\.........../......|.......-..../...
...............|.....................|......|.................../.............|.....-..|..........-...........
|.............|...........|............../......................\..........-.............|.....-..............
.\............-../\.................-.......|.-............../........\.......|.............\.....\...........
.../.\.....\|..-.............\.....................................|.................-............/..........|
.../../.............................-...|.......|..............-............................-.................
......................\-\............-......|.-............|.\...............-.../......\.........-...........
............................|..\.-.............../.\.../.......-..................\...........................
..../..\........-........\......../..\......../......\./..-|....|........\............|...................|\..
..................................................|...\..../........................................-.........
...\......-............\.......-...\...\............|\..../\....../.||........................................
...............-................-......-....../.../............................-.|....|................./..\..
......././../....-...................................................\..............................||........
|/.....\........./....................\......-.-.....|......|................../............................\.
................./..\...................\......\.........\..............-.....-....................\..-..../.\
...\......|..-.........-.....|.........-........|.............|..............\............-...................
.\..........|.............-............../../......../........................................................
....\....................................................-......../..-........|.....\..........\..............
.......-..\....................-..|.....-..../.-......../............\.............|..............|../........
...|/....-.............-......../\...........|................/..................\.....|....................-.
.....-................./.|......../..........-......|...\.....-..............-...-..|.......................|.
.........\..../...........-........|--......-.........-.........\...-.......|.\........-.........|.........../
........-...|../......../........\.....|.....|.....\................/.......-.....-.........../..|........\...
.-....\................||.......|...\..\......./.....-............|../...............|........./......-...-...
.......\......\............../.|.......................................|.......................|........./|...
............|../........-............................/.........-.........-..\..\..../.../.\...\.\.............
....................\...|.....\/...|\.|.................\.|...............................................\-..
.................\|...-........./\.......|.......................................-.........\..................
.......-.......|.............\....|...\.....-.\./.....-..................\\........-..\......-....../.........
............-...../....................|...-....../..............-..../................|...........-..........
............../\..........|........|./\\..|.....|../....-......../..............-............\......./...\....
............./....../......-...............\|..\............../......\.......................-.......|..-.....
.....-........./....\......................\...../...|./..\.../\...../.......\...............\............../.
...................................|..../../.-....................-.....-.......-...................-....-....
..................................................-......|-............|-...\.\...............\...............
.............../...........\................/.....\...........-.....|......................-............-.....
.............|.....|......................./.......|.............................\.|..........\../........\...
........................|..............\............................/...................-..|.......\.\........
.......|....../............/...............-..........|\.........|.......\.....|.............\/../...-...-....
......\.\.....-..||...-.\........\....|...../\/....\........../........|......|...............................
..\........-../....\/.....................-...........................|.......................................
..............|../.|...............\...\.........|..\............../......./.-.....\......-..../..............
....|....-............../......-.\........-............|.|..|.........................../.......|.............
........\............./...................|......../....|..-.....................|./.......\..................
............./.|...........\.............................../.....\....|/.......|.|........./.........|........

10
src/input/day16_test1 Normal file
View File

@@ -0,0 +1,10 @@
.|...\....
|.-.\.....
.....|-...
........|.
..........
.........\
..../.\\..
.-.-/..|..
.|....-|.\
..//.|....

10
src/input/day16_test2 Normal file
View File

@@ -0,0 +1,10 @@
.|...\....
|.-.\.....
.....|-...
........|.
..........
.........\
..../.\\..
.-.-/..|..
.|....-|.\
..//.|....

141
src/input/day17 Normal file
View File

@@ -0,0 +1,141 @@
112222221323213113333323322444342424324235235513233424441521421241545143411145334442432543231425554512423123113114232422242322323132322123322
112131321311322131441423422433434243225123132352335324453212345444231322442352145135542552454212421113553344423244123342442124331123113111113
223121133222231141414442234343234443245521353512543323315242154222243251314332452411341515252321341252252352412443224334334423431311331233132
133112222131222314441334144443223232435425542512121331552541522242524442232241453321512312523525314513351154532323413141343411122222321112113
322223332322123343222431144122111132424322253553532251352141344412415524331232153525524452112552433423233331423314432421441433324223121332321
312131333112441323343144232223412255122131134231531222121445422642255246544344351542431215224223522125434152553131142332211443134312222231222
211211333321123342334144132241233125151214321445224333231666326363643365422544542253625335334412231343533453513253132434122214434413233322212
322212232222212211422412332251353342454542231312144243545346225253223636324233543632334462331141244415524124153133313132412224312222312331223
322113211223113212213314342153433525433231555553242434356463363265563563645342336263523343224234524225243335241315411121134133421334443112231
333131212121412343141114435445224133135245342435446335634363353522253334334325533246432443233534232533451511221534433232211341144331442123133
233121313211411344244133551335321151454244115435646626433463222346345336345563626454252442243263621312153524415454353452143344333231232312131
232232213113312132313315315212344412523141424345323355233264433452535644442424523432345335464524334555424255155321443253342432143244233443221
222312133141411241134354244325155122343355365362644533322246255263355522354533563443355326646646264224131252312153525411224323444133232224333
111244131344141222413414145434311435455622444665232334443532362335566323622352345532434556256524446255655425132232533115524333143121243132233
111244311324141411414353111524355312152244242424233562353222623365626223436624662663526623323346624635656242241331544213244531411322111321212
121424341321422213253122452544151441266334352453236555222246466353633533663225535523525353526632362352264321242524154533123152333422233411413
214234314114323314314113432131313366255232425525656542422233234633675447633376624644353253553454655364562265441352535145552134124131432133133
332424433411233341444552444214425242344536442265562456663425666554773446347346677757322356235433365252453666562542223545254213234341442413224
224324313224121122231213334354554464222243262245563446443457534436665553377347573536453754242646426644353462646354224534444454111443421424223
344113323141223424312532325552433532226426525244252545567446457377467376776453446546455346324422243324355266242461231132521221421334244122132
121143243442251514121142215433466252326566252463554376575564647554466444643663736743735467656325234634366624462435225541155451213542412123321
144144141413521534533235234243446622523424443543366754775333444667747447575555647346575553475442432323322363533534442254251333554224321322412
133134234431121245414221455544552355254533333554765767646635755346377456576745633435554465565446753562643346625663554454551533413451121411332
421312141414151251534535145545334635454544355454537445775735777476335374453663376445743543376477537535536333666253254644241451115445221211442
214221242454533512544542256445353534624666364447645454474464366777664554366343344656674345645533773656334632346233242444145331553411113233212
334433322134135114521523436665566232456236775457364736647343457564436443366747573543346756667346554433432625455645563443212442225353141432132
414243144525445132532252446445235642322545533565647777645656674454736444665656347675347444337755333633734244653456533533542525542355122224112
143433235535325323514555652344336622663673333376467736757366664764488787546574753344663735335476637633573446363332324444531212212313224243124
233241124442243342213456255656564436473537636467545543637434558584544455845477658673347754347766475535563665626236564655445414511114453531231
122413431433152134134564353264624256377643443645443356354755477477464754574766768774754774457343446345773673563325242632444445145241315521422
444312155313125142555226522564323545655757443647535433658788465575486755656545676476875673454545753454675776324224234622254632245552231332241
412315422413422234626446663654536753546573463454737467446466876468567577575758846484447444874336553567564657772425335653334653113522255423321
321153543234545221364664522445565745475535455445777484645858586885856446845646587785657668865545453463765545366662426263665424333352132235312
343333453445435345642254343233244467557455636777477667788648478884457487868658844576875548665767473445373444736746656464542536352221113114241
341253351244311554666363623465443773334565554654657584758574446865455758468854764677665687585678646675377744747475523236366532643224332224132
344411335532124555324434522354736737343764736657764444844874845687784647454874576766784678446644654643667667447774422566532425225453355452534
335114112251353562263552553356673377666433457758767754655756747844667745777466447655544468855548654754473737743747666234326455632232214442144
225222425444416653643232666446467743675765358546585488658774865746464678468857578676487567565468775655664634567643732532643543645445522444252
221255251443542444423662624434743655647647485755544664645558854665855956758744886447777544574446664753567664347436446423353325652523452455435
212553341123245524653233356344465547467357844646488645867475658779695667557996865565887876875848758555665345676567653345354543456553242425211
124324252454252354346666635555463356466366764765564874466577697988975997976596879775875785557748456786436363464536777534565566666415253122423
325111152445523442355232556376357645446586854565545874487796699987869778898789789758796467676847647687674374754666446655266222342222512121453
422455452455632236346335347563767755665865664864458577856687697697897757575876756975777785766686667467465453645675354336442536246544213311553
152431153324634643246634634574537534484787765688676758867558678897769985796587985868567587844664676845854866536343764366223224355552413433533
455225414512433464335335554663376546777756858575857696858895899995956775869658676989888796556684445857454545543366637447263623326536514243141
524115342224323436366656644773636343546686555477778786687586657565875696796775787557759768554777664886776547534776477347433234244365333451111
215421333526242353653636465465357547566845467548755577777977975755678656957696899555969955788858768884546477536443756377733456462466513124145
453343353526463442543557773466473748788746547586678875958676769698799659999768879799765585569898888576564856535336575675425634662626651252524
253412222242626222432346567563634477887454588479765758656676778675685677967575678658786557595758658646657856867375547544646264635345664312123
555512245345353565334333554535755475454656658475955558765596999697659889686775666956766657687698888564546674855535355576535662632423563514352
452155524642465255567337367636637568458754776657699979565958998997688697897669678659885685585577665678484556547576343653353623364236355342114
251134115535345254646474773557574754667855574897588975769766698986877969996889996798555695987767765456474685856753434536637534365446546512524
313234422435246652257534377665385687648665645596788569696786789978786697996679987795559598588796966846754675786557357475557342553432222432235
513131443646224422574544654546745887444758657899677778786859698688967688698899668788865595556967568456774646675464566566563565465344345254345
425125562464224254466637537343365546548668599688675897685696699869799969676788969876779977789779687665687584686536777347563423253545665611435
345451266444536222376475754743554648687454696595769789668789768977899967996966968676969576965995986698566866588446465347463675654666324235435
451335564564336426355565754567747765474654777658589876896768999867979697679676878696679769696986599685888778787446443344556555455335666511243
431112634665335644734656445467555484658575796976986567877688978866769989766996667677998695589967789886865766456575464745767465445354254533555
512433632236422233776664544337856564786655959898796968679978969688866666876789969976769966596887996859656746868474343474555433522552365631223
411221632443326333353345355538785468788457759675657968899779969977968978967766967698786999959959586566666855866545536435345655225424564333435
125553244225343663554546647668554777488497895977977977989879976889886699798769789866786966768689855869648544654476666754667546332352656242232
224355554426226427543567755487476465685779895867885986776697769877977788779899876877696866699898577596667865786755446366656764525345346652214
543353654443226563375653756685788855864976688677656786798678878968897888877788787766767677667999799788777566658554736376453746656236265643521
333454542665465244564546543385875577484956879587989997976867878688779877779997867998896676779588599977986446846457857575453375222324526534133
434423626556545553466446475455488856664559988679798669679776696977988889799798779898769886668685688567568867666455766733573375324254424424333
533225466264523655453666547787757785688796959979698979796876798987899788779899877998899786768966859997774474747556755453774466746452244254133
233236435436355253673373463578478745456869858986757697679796869799978879987997889769887987869577565596997487848475864337675756432243623633531
445443645256346277544755436848467557768969758685688896676868978787989887899889787997687789898558998998759547884884863344635566465645554432354
124155465565526266556563654686677668556868898599757776778797887888988977897779988999686788676895975665899884754748675746476666446366566434122
311322632636455664545565356654586555459659758788888769778889878778989888889879977768787868689659588787568645657844856674376747333534522446543
524415343336265273534645664487885774877899958977789878799887987999778979989898899778678779769976887767897486768856865666347536432242456664542
252235255524462643653563335787488774465758755559966788767688888799777989978789988799689669766798657798896668866556647757454363523233452432141
554143266442623573465776464864468677779678896788767696997998798878978888989787987789877668977695698668769775476667456764644553534342535266444
455413536263265454754374665847578657465756887596786796998797979999999888879788798976888688779769986569696858754764553336674566736535245655151
512114234634634573767444646846458576775777999777987768878789699989887887989897788796676878897867796888566884847756544464756535425534226455315
251156443463246365364555474875454467479655999887576896968768978899998788779887897789889979989657699786956644467567774435633753363336532323342
141445426456345265535356746554548684745767559885568779778776768799879777888789989989668769966686595795575865744764765734475776446243665665312
255313332435652474564576376656756744686675669655557676666679698877997977989998789697979798797968689787957447875468666344755353652563622632155
224116423563545324743733743365788745646698588756789896999878687998797899999988899798788669896659858787568855455865464643565533564255544546532
221516236634252257644567373678456477746958667867869687797688788679787789789998988796696699996767866797867748675884834535654553562232462446444
222111335644233545747443657487587784678587675977665966796988869888777989989898699667968869699867555599766476745664645666775635552226635533431
241152326523236647636365537758576574785686665687979566967789886979989789789999979697678878765757779675564544876778754766557633432263335432511
452223665243224356754333346474474678677576675785985599688668677799798698998996677899997797955699567757685668857564347474546464442225462343142
423515353434446536474447535756864467675796567988858996897968776977898767879978776999866889875659796568976567787558564335566653354235265322524
424351365564252244474735573334647754865559586567858786889698899876966797798786877779998665988798657599446747744777353735666344633653366633443
454144532463464222765445754444565446664875987986567866796969889878799879989896887889676866687857579687846848686587656737543663254363266523324
331243324542246263764737537754874877567844787886598656877688968766898868666676679898686677588986579575675875455856366535446674342646656345133
522321542452233626434565356637848767848544675968869858758769778767787777697696689977777857969959787976545865565865465336346655334223624541112
114331336626665542353463356774785875587465466585655765656796669877699989689897868896886595898867759985887768874677765363433443254336656344332
532434544636522322376363476457655864656568487987665885799596699786688688769896699999558576757757888564444674457475554463333463564635325254234
124123254356322652374367365435367755646457565868966797857755878988869898778676899889996578895679979747465484577746366674577562655552665354451
355345424663263264544445543664667585455685786595786779565869857888798889686986766559566865596859874668875885786376666576364542563332653314542
325314554354552336545637736754754776744876584485778875668658679979997779896976785597858967597985685845674676484745335436656336624544354211412
425414121655523344243575357763653747765444854467696766899955596658589979895566586798588797797556785654784457786766733553775344335552245323245
321544144325652343334575753536347564556577486666588986855888695796688659778786685995788887556958887766558666576735457565562453342546642134133
233224244454245562454544567466375464478684468664878689799895787598577866567558998656655957865877684666685656557544654575652253325644325245452
223253325222626422232344673743536775484847887564746977799768676589955866865598778776977777898654875857658564566565663763455236326342652254352
155252422533226225634556656344354654464548688886765789889959975988897978898976859996899559995865644767458876575545536564442453242363535453552
153151534534626342354465665744754474644684754445886465878699957799687876669595855957865598785658456874788777337375336333556425554625213551524
114131451313553442645435336474563565464846784747667764766877599656867686898598866888669594748747557867644446754575776643342566446456354515545
341445155413444265442333676464335657464657465576446677768796997589788878566978557586958648788844587858746674657357537556434652546423525233113
145555453252246666354553464435564354555574754444686748488899567775759856599667996866868645877786666486875457454653577562363344343353254313251
143522431434132223562456236436453466574664556457854457784587698566798687887857966579455846478558567867734776443433564663645232333432153533433
215322345321224335635562467377454444547736774447848748685756479895588579586889995685457756468565465686547776773475577554245422325222111541441
341322153154514433556244432436566644465665747645578576487455785788898555578675846854548778777465446786763336667574642346555656344514521212431
211411151325556343533222434533637444454335645656474784747848585745568857858857586746545487766766747654736763544346624246343635345312442334513
332121414344532346433322666546554556647353675587785568474748578865644484548648855868467678744684584637444373533334343524243655231512424415224
411524544331513352322333546664576374474473653477646577688768554444786477486457545666878757754774535354377435745536263264224334353132254241153
422211332253552135663623352665455534446547756657668474757847555474767757448784477787467885884668463377464774543773322646356226324142454115544
431332122243114415654234442342364454375577436734766474846574566767468866458556744747578844486837345647756635665625464262633224523334511522341
224251132223221313453424254225224554354467533673735745545644556487888454588447577457458774746447435534547557657555442633434462324134522544331
424111421545541554645653335265444456575347757673576457844645675546487464587674555767765667574773374336533537762544524643353364111515335224142
223234224455241252363466635222362536376655666633577657645755565564687447466785887788764433664575544537646477666565263426556245422143414551114
233332452421231352335626354345244256743777467745433457776474466468687755585566566647444755553777776556436777656425255542455334512253244152412
422112411545554131124444622334525554545646447374565554535566388477546575685584468734376566346747454644555546562335642323543314133325522324241
413442321241543521354365362526422436656465774657774354765753344464456467766744635674434544657564573463535455526336266353232123151224155411344
242422423415151112523146354525226366645673535545673375435674565354736655476666475464746664643334676575555355355232463523215233452253211124213
111143333432524413523436454324432264544544735574336367535553357366667456753344674646463476344445756576624653253446454635325453235235252223333
332333142443531535113424432366223346242652573755667573455376754446553553657745475456557634557655643365263544656433326353222124154251511343123
242134112312545355525535253554536455434525565747777346444335464356647647753474356773646733654433665663546244642563345314421211224122331322323
412433132142141334132434543252622264425454662573753773655373564475543446637637735373477366634444666525263445424664645423315312343452144244311
344332114244241351525142214566224356456452462326344354764475363746334746646337333637737763345332536642426666635663354355254312322132131323131
131122332241242144224432125432263364233255422242226745577455737735337775364433433366454374736353664344646633533423434332335151212214413243223
234242214234112333232155555512323532255465263462233466676735734343577734764766366647564433344543423333456355223241544213123541311212142221331
141441132112224233454451555413534354322564665444243625534333444434643766364477757477656655464463335535563452453345443233435353224242123124343
144331231314331344132242232413551365336335442534566254452555534665767376357467637446622223646365466462446552542232412554553522134322422114312
134214113434441242441523343323532134326253624355324322446664554225677656353747222453535646643544355352452322613134131514514525142433223323211
323134243341144411245145214232341245635335566666345653633536443645465225362662534525445362323226632632245641512241442214122313344131411414343
212343323343433323221422422313553433425452324663245554536655554326624422435443626436552256464424624352636413242143535411323321222212134414313
222324211434321334233532534143131311242353465646253224554652653653422435642254245663622245433355456445562454412533254545222221344143341311122
322212341224344341433245241234425555552453423346256624666222456636325563532446545362553526364423256422345114245213224541344314433124323411131
111312132413122144323135414215543225153444362322356525452452452356345555632553532222235354333665362624225212425414412334544114331333221143211
122332344243113114144314534123511252331523132652452542663432643565426622464544366423233522464666352534215412214222541334342311424433423333321
211223224243324444224441431521434131252451135224333623265442642225653523535653324236342424534552252111413255122212415314111112313322241221222
212113121424143212343224342212325341112231455145336543333365466455536246252462365264643466655354352314115541222243143143414144342122431213211
312323312132421232244144211445241435551135245234253243242342262455222645633446444243345655121234353431542515144235524141411311421233123132122
131232212122341312221232341344525554312435154254534131334556526542542653426346455252353331523443244421444242555313322312124434113321333111133
131133221312324313412312432243212515351341414545433521154451412333542424643536635512413124341333222141133451421242143433422134122332233323331
231113221233222341232124132321211451441554134441534455422411151422513425131244433145554542343113552114533523252113111343313323213211121131123
322213212211112222114333144342114324353155512533222525434225114221442421414253341433251532554455214224244211311142212433411431311232111313131
212312221113133244413331343342212424534414254421312155554511123444113433511542332121333125153343511524122121333132411431123332413332322311213

13
src/input/day17_test1 Normal file
View File

@@ -0,0 +1,13 @@
2413432311323
3215453535623
3255245654254
3446585845452
4546657867536
1438598798454
4457876987766
3637877979653
4654967986887
4564679986453
1224686865563
2546548887735
4322674655533

13
src/input/day17_test2 Normal file
View File

@@ -0,0 +1,13 @@
2413432311323
3215453535623
3255245654254
3446585845452
4546657867536
1438598798454
4457876987766
3637877979653
4654967986887
4564679986453
1224686865563
2546548887735
4322674655533

0
src/input/day18 Normal file
View File

0
src/input/day18_test1 Normal file
View File

0
src/input/day18_test2 Normal file
View File

0
src/input/day19 Normal file
View File

0
src/input/day19_test1 Normal file
View File

0
src/input/day19_test2 Normal file
View File

0
src/input/day20 Normal file
View File

0
src/input/day20_test1 Normal file
View File

0
src/input/day20_test2 Normal file
View File

0
src/input/day21 Normal file
View File

0
src/input/day21_test1 Normal file
View File

0
src/input/day21_test2 Normal file
View File

0
src/input/day22 Normal file
View File

0
src/input/day22_test1 Normal file
View File

0
src/input/day22_test2 Normal file
View File

0
src/input/day23 Normal file
View File

0
src/input/day23_test1 Normal file
View File

0
src/input/day23_test2 Normal file
View File

0
src/input/day24 Normal file
View File

0
src/input/day24_test1 Normal file
View File

0
src/input/day24_test2 Normal file
View File

0
src/input/day25 Normal file
View File

0
src/input/day25_test1 Normal file
View File

0
src/input/day25_test2 Normal file
View File

View File

@@ -1,20 +1,65 @@
mod utils;
mod solutions;
mod utils;
use std::error::Error;
use std::{error::Error, time::SystemTime};
use solutions::{
dayxx::Solution,
day01
};
use solutions::*;
use crate::utils::get_input;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let days: Vec<Box<dyn Solution + Sync>> = vec![
Box::new(day01::Day01 {}),
Box::new(day02::Day02 {}),
Box::new(day03::Day03 {}),
Box::new(day04::Day04 {}),
Box::new(day05::Day05 {}),
Box::new(day06::Day06 {}),
Box::new(day07::Day07 {}),
Box::new(day08::Day08 {}),
Box::new(day09::Day09 {}),
Box::new(day10::Day10 {}),
Box::new(day11::Day11 {}),
Box::new(day12::Day12 {}),
Box::new(day13::Day13 {}),
Box::new(day14::Day14 {}),
Box::new(day15::Day15 {}),
Box::new(day16::Day16 {}),
Box::new(day17::Day17 {}),
// Box::new(day18::Day18 {}),
// Box::new(day19::Day19 {}),
// Box::new(day20::Day20 {}),
// Box::new(day21::Day21 {}),
// Box::new(day22::Day22 {}),
// Box::new(day23::Day23 {}),
// Box::new(day24::Day24 {}),
// Box::new(day25::Day25 {}),
];
fn main() -> Result<(), Box<dyn Error>>{
// Day 1
let day01 = day01::Day01{};
println!("Day01 Part1 Test: {}", day01.part1(get_input(day01.get_day(), utils::InputType::Test)?.as_mut())?);
println!("Day01 Part1 Result: {}", day01.part1(get_input(day01.get_day(), utils::InputType::Actual)?.as_mut())?);
let mut t = vec![];
// Run through and generate solutions
for day in days.leak() {
let task = tokio::spawn(async { day.run().unwrap() });
t.push(task);
}
let start_time = SystemTime::now();
let mut days = vec![];
for thread in t {
days.push(thread.await?);
}
for day in days {
println!("========= Day {} ==========", day.day);
println!("Part1 Result: {}", day.part1);
println!("Part2 Result: {}", day.part2);
println!("========= {}ms =========\n", day.time.as_millis());
}
println!(
"Ran AoC 2023 in {}ms",
SystemTime::now().duration_since(start_time)?.as_millis()
);
Ok(())
}

View File

@@ -1,7 +1,22 @@
use super::dayxx::Solution;
use regex::Regex;
use super::Solution;
use fancy_regex::Regex;
use std::str::FromStr;
use strum_macros::EnumString;
const REG: &str = r#"[0-9]"#;
#[allow(non_camel_case_types)]
#[derive(EnumString)]
enum WrittenNumbers {
zero = 0,
one = 1,
two = 2,
three = 3,
four = 4,
five = 5,
six = 6,
seven = 7,
eight = 8,
nine = 9,
}
pub struct Day01 {}
@@ -9,10 +24,11 @@ impl Solution for Day01 {
fn part1(
&self,
input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display>, Box<dyn std::error::Error>> {
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
const REG: &str = r#"[0-9]"#;
let mut total: u32 = 0;
for line in input {
total += self.regex_get_num(line);
total += self.regex_get_num(REG, line)?;
}
Ok(Box::new(total))
@@ -21,8 +37,14 @@ impl Solution for Day01 {
fn part2(
&self,
input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display>, Box<dyn std::error::Error>> {
Ok(Box::new(0))
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
const REG: &str = r#"[0-9]|one|two|three|four|five|six|seven|eight|nine"#;
let mut total: u32 = 0;
for line in input {
total += self.regex_get_num(REG, line)?;
}
Ok(Box::new(total))
}
fn get_day(&self) -> u8 {
@@ -31,18 +53,86 @@ impl Solution for Day01 {
}
impl Day01 {
fn regex_get_num(&self, input: &mut String) -> u32 {
let re = Regex::new(REG).unwrap();
fn regex_get_num(
&self,
regex: &str,
input: &mut String,
) -> Result<u32, Box<dyn std::error::Error>> {
let re = Regex::new(regex).unwrap();
// Really don't like this :(
let input = input.replace("oneight", "oneeight");
let input = input.replace("threeight", "threeeight");
let input = input.replace("fiveight", "fiveeight");
let input = input.replace("nineight", "nineeight");
let input = input.replace("twone", "twoone");
let input = input.replace("sevenine", "sevennine");
let input = input.replace("eightwo", "eighttwo");
// Get all single digits out of string
let matches: Vec<u32> = re
.find_iter(input)
.map(|m| m.as_str().parse::<u32>().unwrap_or_default())
.collect();
let matches: Vec<&str> = re.find_iter(&input).map(|m| m.unwrap().as_str()).collect();
let mut num: u32 = matches.first().unwrap_or(&0) * 10;
num += matches.last().unwrap_or(&0);
// Convert everything to a number
let mut nums: Vec<u32> = vec![];
for m in matches.clone() {
match Day01::convert_written_number(m) {
Some(n) => nums.push(n),
None => nums.push(m.parse::<u32>()?),
}
}
num
// First number represents the tens, second represents the ones
let mut num: u32 = nums.first().unwrap_or(&0) * 10;
num += nums.last().unwrap_or(&0);
Ok(num)
}
fn convert_written_number(number_str: &str) -> Option<u32> {
match WrittenNumbers::from_str(number_str) {
Ok(number) => Some(number as u32),
Err(_) => None,
}
}
}
/// Test from puzzle input
#[cfg(test)]
mod test {
use super::*;
use crate::*;
#[test]
fn part1() {
let challenge = day01::Day01 {};
//Complete the Challenge
let answer = challenge
.part1(
utils::get_input(challenge.get_day(), utils::InputType::Test1)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "142");
}
#[test]
fn part2() {
let challenge = day01::Day01 {};
//Complete the Challenge
let answer = challenge
.part2(
utils::get_input(challenge.get_day(), utils::InputType::Test2)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "281");
}
}

144
src/solutions/day02.rs Normal file
View File

@@ -0,0 +1,144 @@
use std::collections::HashMap;
use super::Solution;
use fancy_regex::Regex;
pub struct Day02 {}
impl Solution for Day02 {
fn part1(
&self,
input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
// Read games
// Parse into regex with colour to get the number of colours for each game
// Create an is Game Valid function
let colour_max: HashMap<&str, u32> =
HashMap::from([("red", 12), ("green", 13), ("blue", 14)]);
let mut ans = 0;
for game in input.iter().enumerate() {
if self.is_game_valid(game.1, &colour_max)? {
ans += game.0 + 1
}
}
Ok(Box::new(ans))
}
fn part2(
&self,
input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
let mut power = 0u32;
for game in input.iter().enumerate() {
let mut min_count: HashMap<&str, u32> =
HashMap::from([("red", 0), ("green", 0), ("blue", 0)]);
let hands = game.1.split(';');
// Look at each time a handful is pulled out
for run in hands {
// Find the max number of instances of a given colour in a run
for colour in &mut min_count {
let num_cubes = self.get_num_cubes(run, colour.0)?;
if !num_cubes.is_empty() && num_cubes[0] > *colour.1 {
//Update with the new max
*colour.1 = num_cubes[0];
}
}
}
// Calculate the power for this given game
let mut game_power = 1u32;
for colour in &min_count {
game_power *= *colour.1;
}
// Combine to formt he total power
power += game_power;
}
Ok(Box::new(power))
}
fn get_day(&self) -> u8 {
2
}
}
impl Day02 {
fn is_game_valid(
&self,
input: &str,
colour_max: &HashMap<&'static str, u32>,
) -> Result<bool, Box<dyn std::error::Error>> {
for colour in colour_max {
let nums = self.get_num_cubes(input, colour.0)?;
for num in nums {
if num > *colour.1 {
return Ok(false);
}
}
}
Ok(true)
}
fn get_num_cubes(
&self,
input: &str,
colour: &str,
) -> Result<Vec<u32>, Box<dyn std::error::Error>> {
let re = Regex::new(format!("[0-9]+(?= {})", colour).as_str())?;
// Get the numbers correlating to a given colour and combine
let nums: Vec<u32> = re
.find_iter(input)
.map(|c| c.unwrap().as_str().parse::<u32>().unwrap_or(0))
.collect();
Ok(nums)
}
}
/// Test from puzzle input
#[cfg(test)]
mod test {
use super::*;
use crate::*;
#[test]
fn part1() {
let challenge = day02::Day02 {};
//Complete the Challenge
let answer = challenge
.part1(
utils::get_input(challenge.get_day(), utils::InputType::Test1)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "8");
}
#[test]
fn part2() {
let challenge = day02::Day02 {};
//Complete the Challenge
let answer = challenge
.part2(
utils::get_input(challenge.get_day(), utils::InputType::Test2)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "2286");
}
}

141
src/solutions/day03.rs Normal file
View File

@@ -0,0 +1,141 @@
use std::collections::HashMap;
use super::Solution;
pub struct Day03 {}
impl Solution for Day03 {
fn part1(
&self,
input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
// Get data into a byte array
let lines = input.iter().map(|s| s.as_bytes()).collect::<Vec<_>>();
let mut symbols: HashMap<(usize, usize, char), Vec<usize>> = HashMap::new();
// Get the valid numbers from the input
self.map_valid_nums(&lines, &mut symbols)?;
let ans: usize = symbols.values().flatten().sum();
Ok(Box::new(ans))
}
fn part2(
&self,
input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
// Get data into a byte array
let lines = input.iter().map(|s| s.as_bytes()).collect::<Vec<_>>();
let mut symbols: HashMap<(usize, usize, char), Vec<usize>> = HashMap::new();
// Get the valid numbers from the input
self.map_valid_nums(&lines, &mut symbols)?;
let ans: usize = symbols
.iter()
.filter(|(&(_, _, s), v)| s == '*' && v.len() == 2)
.map(|(_, v)| v[0] * v[1])
.sum();
Ok(Box::new(ans))
}
fn get_day(&self) -> u8 {
3
}
}
impl Day03 {
fn map_valid_nums(
&self,
lines: &Vec<&[u8]>,
symbols: &mut HashMap<(usize, usize, char), Vec<usize>>,
) -> Result<(), Box<dyn std::error::Error>> {
for (i, line) in lines.iter().enumerate() {
let mut c = 0;
while c < line.len() {
let (start, mut symbol) = (c, None);
while c < line.len() && line[c].is_ascii_digit() {
// Coordinate deltas for adjacent checks
for (drow, dcol) in [
(-1, -1),
(-1, 0),
(-1, 1),
(0, -1),
(0, 1),
(1, -1),
(1, 0),
(1, 1),
] {
let (row, column) =
((i as i32 + drow) as usize, (c as i32 + dcol) as usize);
// Get symbol at adjacent row
let Some(&s) = lines.get(row).and_then(|l| l.get(column)) else {
continue;
};
if s != b'.' && !s.is_ascii_digit() {
symbol = Some((column, row, s as char));
break;
}
}
c += 1;
}
if start < c {
if let Some(symbol) = symbol {
let num = line[start..c]
.iter()
.fold(0, |n, c| n * 10 + (c - b'0') as usize);
symbols.entry(symbol).or_default().push(num)
}
}
c += 1;
}
}
Ok(())
}
}
/// Test from puzzle input
#[cfg(test)]
mod test {
use super::*;
use crate::*;
#[test]
fn part1() {
let challenge = day03::Day03 {};
//Complete the Challenge
let answer = challenge
.part1(
utils::get_input(challenge.get_day(), utils::InputType::Test1)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "4361");
}
#[test]
fn part2() {
let challenge = day03::Day03 {};
//Complete the Challenge
let answer = challenge
.part2(
utils::get_input(challenge.get_day(), utils::InputType::Test2)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "467835");
}
}

127
src/solutions/day04.rs Normal file
View File

@@ -0,0 +1,127 @@
use std::collections::HashMap;
use super::Solution;
pub struct Day04 {}
impl Solution for Day04 {
fn part1(
&self,
input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
// Remove Card XXX: at start
let cards: Vec<&str> = input.iter().map(|c| c.split(':').last().unwrap()).collect();
let mut ans = 0;
for card in cards {
let winning_nums = self.get_count_winning_numbers(card)?;
if winning_nums > 0 {
ans += 2u32.pow((winning_nums - 1) as u32);
}
}
Ok(Box::new(ans))
}
fn part2(
&self,
input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
// Remove Card XXX: at start and append card index
let cards: Vec<(usize, &str)> = input
.iter()
.map(|c| c.split(':').last().unwrap())
.enumerate()
.collect();
let mut copy_counts: Vec<u32> = vec![1; cards.len()];
for (i, card) in cards.iter() {
// Create a container for the cards
// Check if we are looking at a winning card
let winning_nums = self.get_count_winning_numbers(card)?;
if winning_nums == 0 {
continue;
}
// We have a winning card... add the next cards resulting * num of current card
for j in 0..winning_nums {
// Don't let us add cards that aren't available
copy_counts[*i + j + 1] += copy_counts[*i];
}
}
Ok(Box::new(copy_counts.iter().sum::<u32>()))
}
fn get_day(&self) -> u8 {
4
}
}
impl Day04 {
fn get_count_winning_numbers(&self, card: &str) -> Result<usize, Box<dyn std::error::Error>> {
let mut winning_numbers: HashMap<u32, bool> = HashMap::new();
let mut sep_found = false;
let mut card_nums = vec![];
for num in card.split_whitespace() {
// Are we after the |
if num == "|" {
sep_found = true;
continue;
}
let num = num.parse::<u32>()?;
if sep_found {
if winning_numbers.contains_key(&num) {
card_nums.push(num);
}
} else {
winning_numbers.insert(num, true);
}
}
Ok(card_nums.len())
}
}
/// Test from puzzle input
#[cfg(test)]
mod test {
use super::*;
use crate::*;
#[test]
fn part1() {
let challenge = day04::Day04 {};
//Complete the Challenge
let answer = challenge
.part1(
utils::get_input(challenge.get_day(), utils::InputType::Test1)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "13");
}
#[test]
fn part2() {
let challenge = day04::Day04 {};
//Complete the Challenge
let answer = challenge
.part2(
utils::get_input(challenge.get_day(), utils::InputType::Test2)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "30");
}
}

145
src/solutions/day05.rs Normal file
View File

@@ -0,0 +1,145 @@
use super::Solution;
use itertools::Itertools;
pub struct Day05 {}
impl Solution for Day05 {
fn part1(
&self,
input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
let (seeds, maps) = self.get_mappings(input)?;
let locations = maps.iter().fold(seeds, |seeds, mappings| {
seeds
.iter()
.map(|&seed| {
mappings
.iter()
.find(|&&(_, src, range)| (src..src + range).contains(&seed))
.map(|(dst, src, _)| dst + seed - src)
.unwrap_or(seed)
})
.collect()
});
Ok(Box::new(*locations.iter().min().unwrap()))
}
fn part2(
&self,
input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
let (seeds, maps) = self.get_mappings(input)?;
let seeds = seeds
.iter()
.tuples()
.map(|(&a, len)| (a, a + len))
.collect::<Vec<_>>();
let locations = maps.iter().fold(seeds, |seeds, mappings| {
seeds
.iter()
.flat_map(|&(start, end)| {
let mut mapped = Vec::new();
let mut unmapped = vec![(start, end)];
for &(dst, src, len) in mappings {
let mut m = Vec::new();
for (start, end) in unmapped {
let a = (start, end.min(src));
let b = (start.max(src), (src + len).min(end));
let c = ((src + len).max(start), end);
if a.0 < a.1 {
m.push(a);
}
if b.0 < b.1 {
mapped.push((b.0 - src + dst, b.1 - src + dst));
}
if c.0 < c.1 {
m.push(c);
}
}
unmapped = m;
}
mapped.extend(unmapped);
mapped
})
.collect()
});
Ok(Box::new(locations.iter().map(|&(s, _)| s).min().unwrap()))
}
fn get_day(&self) -> u8 {
5
}
}
impl Day05 {
fn get_mappings(
&self,
input: &Vec<String>,
) -> Result<(Vec<usize>, Vec<Vec<(usize, usize, usize)>>), Box<dyn std::error::Error>> {
let seeds: Vec<usize> = input[0]
.split_whitespace()
.skip(1)
.map(|s| s.parse().unwrap())
.collect::<Vec<_>>();
let maps: Vec<Vec<(usize, usize, usize)>> = input[2..input.len()]
.join("\n")
.split("\n\n")
.map(|s| {
s.split('\n')
.skip(1)
.map(|l| {
l.split_whitespace()
.map(|s| s.parse().unwrap())
.collect_tuple()
.unwrap()
})
.collect::<Vec<_>>()
})
.collect::<Vec<_>>();
Ok((seeds, maps))
}
}
/// Test from puzzle input
#[cfg(test)]
mod test {
use super::*;
use crate::*;
#[test]
fn part1() {
let challenge = day05::Day05 {};
//Complete the Challenge
let answer = challenge
.part1(
utils::get_input(challenge.get_day(), utils::InputType::Test1)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "35");
}
#[test]
fn part2() {
let challenge = day05::Day05 {};
//Complete the Challenge
let answer = challenge
.part2(
utils::get_input(challenge.get_day(), utils::InputType::Test2)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "46");
}
}

112
src/solutions/day06.rs Normal file
View File

@@ -0,0 +1,112 @@
use super::Solution;
pub struct Day06 {}
impl Solution for Day06 {
fn part1(
&self,
input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
let times: Vec<u64> = input[0]
.split_whitespace()
.skip(1)
.map(|t| t.parse().unwrap())
.collect();
let distances: Vec<u64> = input[1]
.split_whitespace()
.skip(1)
.map(|d| d.parse().unwrap())
.collect();
Ok(Box::new(self.num_winning_races(&times, &distances)?))
}
fn part2(
&self,
input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
let times = vec![input[0]
.split(':')
.nth(1)
.unwrap()
.replace(' ', "")
.parse::<u64>()?];
let distances = vec![input[1]
.split(':')
.nth(1)
.unwrap()
.replace(' ', "")
.parse::<u64>()?];
Ok(Box::new(self.num_winning_races(&times, &distances)?))
}
fn get_day(&self) -> u8 {
6
}
}
impl Day06 {
fn num_winning_races(
&self,
times: &Vec<u64>,
distances: &Vec<u64>,
) -> Result<u32, Box<dyn std::error::Error>> {
let mut beats = vec![];
for (time, record) in times.iter().zip(distances.iter()) {
let mut count: u32 = 0;
for hold in 0..*time {
let dist = (hold) * (time - hold);
if dist > *record {
count += 1;
}
}
beats.push(count);
}
Ok(beats.iter().product::<u32>())
}
}
/// Test from puzzle input
#[cfg(test)]
mod test {
use super::*;
use crate::*;
#[test]
fn part1() {
let challenge = day06::Day06 {};
//Complete the Challenge
let answer = challenge
.part1(
utils::get_input(challenge.get_day(), utils::InputType::Test1)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "288");
}
#[test]
fn part2() {
let challenge = day06::Day06 {};
//Complete the Challenge
let answer = challenge
.part2(
utils::get_input(challenge.get_day(), utils::InputType::Test2)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "71503");
}
}

245
src/solutions/day07.rs Normal file
View File

@@ -0,0 +1,245 @@
use std::collections::HashMap;
use super::Solution;
pub struct Day07 {}
#[derive(Debug, Eq, PartialEq)]
enum Hands {
HC = 1,
OP,
TP,
ThreeOAK,
FH,
FourOAK,
FiveOAK,
}
impl Solution for Day07 {
fn part1(
&self,
input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
let hands = self.get_hands_from_string(input, false)?;
let mut totals = vec![];
for hand in hands.iter() {
totals.push((hand.0.clone(), hand.1, self.get_hand_type(&hand.0)? as u32));
}
totals.sort_by(|a, b| {
if a.2 == b.2 {
a.0.partial_cmp(&b.0).unwrap()
} else {
a.2.cmp(&{ b.2 })
}
});
let mut score: u64 = 0;
for (i, cards) in totals.iter().enumerate() {
score += (cards.1 * (i + 1) as u32) as u64;
}
Ok(Box::new(score))
}
fn part2(
&self,
input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
let hands = self.get_hands_from_string(input, true)?;
let mut totals = vec![];
for hand in hands.iter() {
let adapted_hand = self.replace_wildcard(&hand.0)?;
totals.push((
hand.0.clone(),
hand.1,
self.get_hand_type(&adapted_hand)? as u32,
));
}
totals.sort_by(|a, b| {
if a.2 == b.2 {
a.0.partial_cmp(&b.0).unwrap()
} else {
a.2.cmp(&{ b.2 })
}
});
let mut score: u64 = 0;
for (i, cards) in totals.iter().enumerate() {
score += (cards.1 * (i + 1) as u32) as u64;
}
Ok(Box::new(score))
}
fn get_day(&self) -> u8 {
7
}
}
impl Day07 {
fn get_hands_from_string(
&self,
input: &mut Vec<String>,
wildcard: bool,
) -> Result<Vec<(Vec<u32>, u32)>, Box<dyn std::error::Error>> {
let mut hands = vec![];
// Get the string from each line and split into hand and stake
for hand in input {
let (card, mut stake) = hand.split_at(5);
stake = stake.trim();
let mut hand = vec![];
for i in card.chars() {
hand.push(match i {
'T' => 10,
'J' => {
if wildcard {
0
} else {
11
}
}
'Q' => 12,
'K' => 13,
'A' => 14,
_ => i.to_digit(10).unwrap(),
});
}
hands.push((hand, stake.parse()?));
// hands.push((hand.iter().rev().map(|c| *c).collect(), stake.parse()?));
}
Ok(hands)
}
fn get_hand_type(&self, hand: &Vec<u32>) -> Result<Hands, Box<dyn std::error::Error>> {
let mut map_cards = HashMap::new();
for c in hand {
map_cards.entry(c).and_modify(|c| *c += 1).or_insert(1u32);
}
let mut counts: Vec<&u32> = map_cards.values().collect();
counts.sort();
// If there is a single key in the map we have 5OAK
if map_cards.len() == 1 {
return Ok(Hands::FiveOAK);
}
// 4OAK
// Full House
if map_cards.len() == 2 {
// 4OAK
if *counts[1] == 4u32 {
return Ok(Hands::FourOAK);
}
return Ok(Hands::FH);
}
if map_cards.len() == 3 {
// 3OAK
if *counts[2] == 3 {
return Ok(Hands::ThreeOAK);
}
// Two Pair
return Ok(Hands::TP);
}
// One Pair
if map_cards.len() == 4 {
return Ok(Hands::OP);
}
// High Card
Ok(Hands::HC)
}
fn replace_wildcard<'a>(
&self,
input: &Vec<u32>,
) -> Result<Vec<u32>, Box<dyn std::error::Error>> {
let mut map_cards = HashMap::new();
for c in input.iter() {
map_cards.entry(c).and_modify(|c| *c += 1).or_insert(1u32);
}
// Get the wildcard count from the map and replace with the most common card
let wc_count = *map_cards.get(&0).unwrap_or(&0);
// Remove wildcards as we have already
map_cards.remove_entry(&0);
// Find the maximum frequency
let max_frequency = map_cards.values().cloned().max().unwrap_or(0);
// Filter numbers with the maximum frequency
let most_frequenct_cards: Vec<u32> = map_cards
.clone()
.into_iter()
.filter(|&(_, frequency)| frequency == max_frequency)
.map(|(number, _)| *number)
.collect::<Vec<u32>>();
if most_frequenct_cards.is_empty() {
return Ok(input.clone());
}
map_cards.entry(&most_frequenct_cards[0]).and_modify(|v| {
*v += wc_count;
});
let result: Vec<u32> = map_cards
.into_iter()
.flat_map(|(key, count)| vec![*key; count as usize])
.collect();
Ok(result)
}
}
/// Test from puzzle input
#[cfg(test)]
mod test {
use super::*;
use crate::*;
#[test]
fn part1() {
let challenge = day07::Day07 {};
//Complete the Challenge
let answer = challenge
.part1(
utils::get_input(challenge.get_day(), utils::InputType::Test1)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "6440");
}
#[test]
fn part2() {
let challenge = day07::Day07 {};
//Complete the Challenge
let answer = challenge
.part2(
utils::get_input(challenge.get_day(), utils::InputType::Test2)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "5905");
}
}

160
src/solutions/day08.rs Normal file
View File

@@ -0,0 +1,160 @@
use std::collections::HashMap;
use crate::utils::{self};
use super::Solution;
pub struct Day08 {}
impl Solution for Day08 {
fn part1(
&self,
input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
let instructions: String = input[0].clone();
let mut map: HashMap<String, (String, String)> = HashMap::new();
self.populate_map(&input[2..input.len()], &mut map)?;
Ok(Box::new(self.traverse_to_end(
&"AAA".to_owned(),
&"ZZZ".to_owned(),
&instructions,
&map,
)?))
}
fn part2(
&self,
input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
let instructions: String = input[0].clone();
let mut map: HashMap<String, (String, String)> = HashMap::new();
self.populate_map(&input[2..input.len()], &mut map)?;
let mut start_points = vec![];
for route in &input[2..input.len()] {
if route.as_bytes()[2] as char == 'A' {
start_points.push(route.split_at(3).0.to_owned());
}
}
let mut count = vec![];
for start in start_points {
count.push(self.traverse_to_end(&start, &"Z".to_owned(), &instructions, &map)?);
}
let lcm = count
.iter()
.fold(1u64, |acc, x| -> u64 { utils::lcm(acc, *x as u64) });
Ok(Box::new(lcm))
}
fn get_day(&self) -> u8 {
8
}
}
impl Day08 {
/// Given a string in the format XXX = (XXX, XXX), will populate a map witht he Xs
/// To create a way of traversing the route
fn populate_map<'a>(
&self,
input: &[String],
map: &mut HashMap<String, (String, String)>,
) -> Result<(), Box<dyn std::error::Error>> {
for p in input {
let mut x = p.split('=');
let key = x.nth(0).unwrap().trim().to_owned();
let (l, r) = x.nth(0).unwrap().split_at(6);
map.insert(
key,
(
l.to_owned().replace([',', '('], "").trim().to_owned(),
r.trim().to_owned().replace(')', ""),
),
);
}
Ok(())
}
/// Function to traverse the map going left and right based on given instructions
fn traverse_to_end(
&self,
start: &String,
end: &String,
// detect_cycles: bool,
instructions: &String,
map: &HashMap<String, (String, String)>,
) -> Result<u32, Box<dyn std::error::Error>> {
let mut count = 0u32;
let mut current = map.get(start).unwrap();
let mut found = false;
while !found {
for i in instructions.chars() {
count += 1;
let next: &String;
match i {
'L' => next = &current.0,
'R' => next = &current.1,
_ => {
continue;
}
}
if next.ends_with(end) {
found = true;
break;
}
current = map.get(next).unwrap();
}
}
Ok(count)
}
}
/// Test from puzzle input
#[cfg(test)]
mod test {
use super::*;
use crate::*;
#[test]
fn part1() {
let challenge = day08::Day08 {};
//Complete the Challenge
let answer = challenge
.part1(
utils::get_input(challenge.get_day(), utils::InputType::Test1)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "6");
}
#[test]
fn part2() {
let challenge = day08::Day08 {};
//Complete the Challenge
let answer = challenge
.part2(
utils::get_input(challenge.get_day(), utils::InputType::Test2)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "6");
}
}

138
src/solutions/day09.rs Normal file
View File

@@ -0,0 +1,138 @@
use super::Solution;
pub struct Day09 {}
impl Solution for Day09 {
fn part1(
&self,
input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
let series_collection = self.get_series(input)?;
Ok(Box::new(self.sum_extrapolated(&series_collection, true)?))
}
fn part2(
&self,
input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
let series_collection = self.get_series(input)?;
Ok(Box::new(self.sum_extrapolated(&series_collection, false)?))
}
fn get_day(&self) -> u8 {
9
}
}
impl Day09 {
/// Takes a vec of strings and returns a Vec of series of numbers
fn get_series(&self, input: &Vec<String>) -> Result<Vec<Vec<i32>>, Box<dyn std::error::Error>> {
let mut series = vec![];
for s in input.iter() {
series.push(
s.split_whitespace()
.map(|n| n.parse::<i32>().unwrap())
.collect(),
);
}
Ok(series)
}
/// Returns the sum ov extrapolated values either to the left or the right of the initial series
fn sum_extrapolated(
&self,
series_collection: &Vec<Vec<i32>>,
forwards: bool,
) -> Result<i32, Box<dyn std::error::Error>> {
let mut ans = 0i32;
for series in series_collection {
let mut differences = vec![series.clone()];
// Keep finding differences until we have a consistent difference of 0
while differences
.last()
.unwrap()
.iter()
.map(|v| v.abs())
.sum::<i32>()
!= 0i32
{
differences.push(
differences
.last()
.unwrap()
.windows(2)
.map(|w| w[1] - w[0])
.collect::<Vec<i32>>(),
);
}
if forwards {
// Sum all of the last values in each row to get next num
ans += differences
.iter()
.map(|s| *s.last().unwrap())
.collect::<Vec<i32>>()
.iter()
.sum::<i32>();
} else {
// Scale backwards down the heap to find the previous number in each sequence
let mut next = 0i32;
differences
.iter()
.rev()
.map(|s| *s.first().unwrap())
.collect::<Vec<i32>>()
.iter()
.for_each(|v| {
next = v - next;
});
ans += next;
}
}
Ok(ans)
}
}
/// Test from puzzle input
#[cfg(test)]
mod test {
use super::*;
use crate::*;
#[test]
fn part1() {
let challenge = day09::Day09 {};
//Complete the Challenge
let answer = challenge
.part1(
utils::get_input(challenge.get_day(), utils::InputType::Test1)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "114");
}
#[test]
fn part2() {
let challenge = day09::Day09 {};
//Complete the Challenge
let answer = challenge
.part2(
utils::get_input(challenge.get_day(), utils::InputType::Test2)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "2");
}
}

177
src/solutions/day10.rs Normal file
View File

@@ -0,0 +1,177 @@
use super::Solution;
use hashbrown::HashSet;
pub struct Day10 {}
impl Solution for Day10 {
fn part1(
&self,
input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
let (start, mut graph) = self.generate_graph(input);
let pipe_loop = self.generate_loop(start, &mut graph)?;
Ok(Box::new(pipe_loop.len() / 2))
}
fn part2(
&self,
input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
let mut ans = 0usize;
let (start, mut graph) = self.generate_graph(input);
let pipe_loop = self.generate_loop(start, &mut graph)?;
for r in 0..graph.len() {
let mut inside = false;
for c in 0..graph[0].len() {
if !pipe_loop.contains(&(r, c)) {
ans += inside as usize;
} else if graph[r][c][0] {
inside = !inside;
}
}
}
Ok(Box::new(ans))
}
fn get_day(&self) -> u8 {
10
}
}
impl Day10 {
/// Traces the graph and populates a hashset with
/// loops present within the connections
fn find_loop(
&self,
graph: &[Vec<[bool; 4]>],
start: (usize, usize),
) -> Option<HashSet<(usize, usize)>> {
let (mut r, mut c) = start;
let mut d = graph[r][c].iter().position(|&d| d).unwrap();
let mut seen = HashSet::new();
loop {
if !seen.insert((r, c)) {
break Some(seen);
}
let came_from = match d {
0 => {
r -= 1;
2
}
1 => {
c += 1;
3
}
2 => {
r += 1;
0
}
3 => {
c -= 1;
1
}
_ => unreachable!(),
};
if !graph[r][c][came_from] {
break None;
}
d = (0..4).find(|&i| i != came_from && graph[r][c][i]).unwrap();
}
}
/// Retruns all of the connections around a given tile
fn connections(&self, tile: u8) -> [bool; 4] {
match tile {
// [ up, right, down, left]
b'|' => [true, false, true, false],
b'-' => [false, true, false, true],
b'L' => [true, true, false, false],
b'J' => [true, false, false, true],
b'7' => [false, false, true, true],
b'F' => [false, true, true, false],
_ => [false, false, false, false],
}
}
/// Fucntion to generate a graph of all of the connections of the the nodes
fn generate_graph(&self, input: &mut Vec<String>) -> ((usize, usize), Vec<Vec<[bool; 4]>>) {
let mut start = (0, 0);
let graph = input
.iter()
.enumerate()
.map(|(r, line)| {
line.bytes()
.enumerate()
.map(|(c, tile)| {
if tile == b'S' {
start = (r, c);
}
self.connections(tile)
})
.collect::<Vec<_>>()
})
.collect::<Vec<_>>();
(start, graph)
}
/// Function that generates the a hashset of the loops in the graph
fn generate_loop(
&self,
start: (usize, usize),
graph: &mut [Vec<[bool; 4]>],
) -> Result<HashSet<(usize, usize)>, Box<dyn std::error::Error>> {
let pipe_loop = "J|-L7F"
.bytes()
.find_map(|start_tile| {
graph[start.0][start.1] = self.connections(start_tile);
self.find_loop(graph, start)
})
.unwrap();
Ok(pipe_loop)
}
}
/// Test from puzzle input
#[cfg(test)]
mod test {
use super::*;
use crate::*;
#[test]
fn part1() {
let challenge = day10::Day10 {};
//Complete the Challenge
let answer = challenge
.part1(
utils::get_input(challenge.get_day(), utils::InputType::Test1)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "8");
}
#[test]
fn part2() {
let challenge = day10::Day10 {};
//Complete the Challenge
let answer = challenge
.part2(
utils::get_input(challenge.get_day(), utils::InputType::Test2)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "8");
}
}

125
src/solutions/day11.rs Normal file
View File

@@ -0,0 +1,125 @@
use super::Solution;
use itertools::Itertools;
pub struct Day11 {}
impl Solution for Day11 {
fn part1(
&self,
input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
let (universe, mut galaxy) = self.get_universe(input);
Ok(Box::new(self.get_distance(&universe, &mut galaxy, 2)))
}
fn part2(
&self,
input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
let (universe, mut galaxy) = self.get_universe(input);
Ok(Box::new(self.get_distance(
&universe,
&mut galaxy,
1_000_000,
)))
}
fn get_day(&self) -> u8 {
11
}
}
impl Day11 {
fn get_universe<'a>(&'a self, input: &'a Vec<String>) -> (Vec<&'a [u8]>, Vec<(usize, usize)>) {
let universes = input.iter().map(|r| r.as_bytes()).collect::<Vec<_>>();
// Use the cartesian product between X and Y, (Y, X), to plot coords of galaxies
let galaxies = (0..universes.len())
.cartesian_product(0..universes[0].len())
.filter(|(y, x)| universes[*y][*x] == b'#')
.collect::<Vec<_>>();
(universes, galaxies)
}
fn get_distance(
&self,
universe: &Vec<&[u8]>,
galaxies: &mut Vec<(usize, usize)>,
expansion: usize,
) -> usize {
let (rows, cols) = (universe.len(), universe[0].len());
let empty_rows = (0..rows).filter(|row| universe[*row].iter().all(|p| *p == b'.'));
let empty_cols = (0..cols).filter(|col| (0..rows).all(|row| universe[row][*col] == b'.'));
for row in empty_rows.rev() {
for galaxy in galaxies.iter_mut() {
// Increase distance between galaxies by 1 for each empty row they cross
if galaxy.0 > row {
galaxy.0 += expansion - 1;
}
}
}
for col in empty_cols.rev() {
for galaxy in galaxies.iter_mut() {
// Increase distance between galaxies by 1 for each empty column they cross
if galaxy.1 > col {
galaxy.1 += expansion - 1;
}
}
}
// get a vector of x, y distances between each galaxy
galaxies
.iter()
.tuple_combinations()
.map(|(g1, g2)| g1.0.abs_diff(g2.0) + g1.1.abs_diff(g2.1))
.sum()
}
}
/// Test from puzzle input
#[cfg(test)]
mod test {
use super::*;
use crate::*;
#[test]
fn part1() {
let challenge = day11::Day11 {};
//Complete the Challenge
let answer = challenge
.part1(
utils::get_input(challenge.get_day(), utils::InputType::Test1)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "374");
}
#[test]
fn part2() {
let challenge = day11::Day11 {};
//Complete the Challenge
let answer = challenge
.part2(
utils::get_input(challenge.get_day(), utils::InputType::Test2)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "82000210");
}
}

147
src/solutions/day12.rs Normal file
View File

@@ -0,0 +1,147 @@
use std::collections::HashMap;
use super::Solution;
pub struct Day12 {}
impl Solution for Day12 {
fn part1(
&self,
input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
let mut ans = 0usize;
for s in input {
let springs = s.split_whitespace().nth(0).unwrap().to_owned();
let nums = s
.split_whitespace()
.nth(1)
.unwrap()
.split(',')
.map(|n| n.parse::<usize>().unwrap())
.collect::<Vec<_>>();
ans += self.solve(springs.as_bytes(), None, &nums, &mut HashMap::new());
}
Ok(Box::new(ans))
}
fn part2(
&self,
input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
for l in input.iter_mut() {
let (s, n) = l.split_once(' ').unwrap();
*l = format!("{s}?{s}?{s}?{s}?{s} {n},{n},{n},{n},{n}\n");
}
let mut ans = 0usize;
for s in input {
let springs = s.split_whitespace().nth(0).unwrap().to_owned();
let nums = s
.split_whitespace()
.nth(1)
.unwrap()
.split(',')
.map(|n| n.parse::<usize>().unwrap())
.collect::<Vec<_>>();
ans += self.solve(springs.as_bytes(), None, &nums, &mut HashMap::new());
}
Ok(Box::new(ans))
}
fn get_day(&self) -> u8 {
12
}
}
impl Day12 {
/// recursively counts the number of permutations of spring we could get from
/// the splits specified in 'nums'
fn solve<'a, 'b>(
&self,
s: &'a [u8],
in_group: Option<usize>,
cons: &'b [usize],
map: &mut HashMap<(&'a [u8], Option<usize>, &'b [usize]), usize>,
) -> usize {
if s.is_empty() {
return match in_group {
Some(n) if cons == &[n] => 1,
None if cons.is_empty() => 1,
_ => 0,
};
}
// Check for a cache hit
if s[0] == b'?' {
if let Some(result) = map.get(&(s, in_group, cons)) {
return *result;
}
}
// Resursively match based on the whether we are in a block and/or we have spaces left to fill
let ans = match (s[0], in_group, cons) {
(b'.', None, _) | (b'?', None, []) => self.solve(&s[1..], None, cons, map),
(b'.' | b'?', Some(n), [e, ..]) if n == *e => {
self.solve(&s[1..], None, &cons[1..], map)
}
(b'#' | b'?', Some(n), [e, ..]) if n < *e => {
self.solve(&s[1..], Some(n + 1), cons, map)
}
(b'#', None, [_, ..]) => self.solve(&s[1..], Some(1), cons, map),
(b'?', None, _) => {
self.solve(&s[1..], None, cons, map) + self.solve(&s[1..], Some(1), cons, map)
}
_ => 0,
};
// Store in cache
if s[0] == b'?' {
map.insert((s, in_group, cons), ans);
}
ans
}
}
/// Test from puzzle input
#[cfg(test)]
mod test {
use super::*;
use crate::*;
#[test]
fn part1() {
let challenge = day12::Day12 {};
//Complete the Challenge
let answer = challenge
.part1(
utils::get_input(challenge.get_day(), utils::InputType::Test1)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "21");
}
#[test]
fn part2() {
let challenge = day12::Day12 {};
//Complete the Challenge
let answer = challenge
.part2(
utils::get_input(challenge.get_day(), utils::InputType::Test2)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "525152");
}
}

126
src/solutions/day13.rs Normal file
View File

@@ -0,0 +1,126 @@
use itertools::Itertools;
use super::Solution;
pub struct Day13 {}
impl Solution for Day13 {
fn part1(
&self,
input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
let binding = input.clone().iter().join("\n");
let grids = binding
.split("\n\n")
.map(|s| s.split('\n').map(|l| l.as_bytes()).collect::<Vec<_>>())
.collect::<Vec<_>>();
Ok(Box::new(self.solve(&grids, 0)))
}
fn part2(
&self,
input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
let binding = input.clone().iter().join("\n");
let grids = binding
.split("\n\n")
.map(|s| s.split('\n').map(|l| l.as_bytes()).collect::<Vec<_>>())
.collect::<Vec<_>>();
Ok(Box::new(self.solve(&grids, 1)))
}
fn get_day(&self) -> u8 {
13
}
}
impl Day13 {
// Finds the index of the column where the reflection is located
fn find_col_reflection(&self, grid: &[&[u8]], limit: usize) -> Option<usize> {
(0..grid[0].len() - 1).find(|&c| {
let incorrect = (0..=c.min(grid[0].len() - c - 2))
.map(|dc| {
let a = c - dc;
let b = c + 1 + dc;
(0..grid.len())
.filter(|&r| grid[r][a] != grid[r][b])
.count()
})
.sum::<usize>();
incorrect == limit
})
}
// Finds the index of the row where the reflection is located
fn find_row_reflection(&self, grid: &[&[u8]], limit: usize) -> Option<usize> {
(0..grid.len() - 1).find(|&r| {
let incorrect = (0..=r.min(grid.len() - r - 2))
.map(|dr| {
let a = r - dr;
let b = r + 1 + dr;
(0..grid[0].len())
.filter(|&c| grid[a][c] != grid[b][c])
.count()
})
.sum::<usize>();
incorrect == limit
})
}
// Gets the given score for a reflection
// where limit is the index of the reflection you want to find in each image
fn solve(&self, grids: &[Vec<&[u8]>], limit: usize) -> usize {
grids
.iter()
.map(|grid| {
self.find_row_reflection(grid, limit)
.map(|r| (r + 1) * 100)
.or_else(|| self.find_col_reflection(grid, limit).map(|c| c + 1))
.unwrap()
})
.sum()
}
}
/// Test from puzzle input
#[cfg(test)]
mod test {
use super::*;
use crate::*;
#[test]
fn part1() {
let challenge = day13::Day13 {};
//Complete the Challenge
let answer = challenge
.part1(
utils::get_input(challenge.get_day(), utils::InputType::Test1)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "405");
}
#[test]
fn part2() {
let challenge = day13::Day13 {};
//Complete the Challenge
let answer = challenge
.part2(
utils::get_input(challenge.get_day(), utils::InputType::Test2)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "400");
}
}

154
src/solutions/day14.rs Normal file
View File

@@ -0,0 +1,154 @@
use std::collections::HashMap;
use super::Solution;
pub struct Day14 {}
impl Solution for Day14 {
fn part1(
&self,
input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
let mut rock_formation = input
.iter()
.map(|r| r.chars().collect::<Vec<_>>())
.collect::<Vec<_>>();
self.pull_north(&mut rock_formation);
Ok(Box::new(self.get_load(&rock_formation)))
}
fn part2(
&self,
input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
let mut rock_formation = input
.iter()
.map(|r| r.chars().collect::<Vec<_>>())
.collect::<Vec<_>>();
let mut rotations: HashMap<Vec<Vec<char>>, usize> = HashMap::new();
for i in 1..=1_000_000_000 {
for _ in 0..4 {
self.pull_north(&mut rock_formation);
rock_formation = self.rotate(&rock_formation);
}
if let Some(rotation) = rotations.insert(rock_formation.clone(), i) {
if (1_000_000_000 - i) % (i - rotation) == 0 {
break;
}
}
}
Ok(Box::new(self.get_load(&rock_formation)))
}
fn get_day(&self) -> u8 {
14
}
}
impl Day14 {
// Function that pulls all of the 'O's as far north as they will go
fn pull_north(&self, cave: &mut Vec<Vec<char>>) {
let mut complete = false;
while !complete {
complete = true;
for row in 1..cave.len() {
for col in 0..cave[0].len() {
if cave[row][col] == 'O' && cave[row - 1][col] == '.' {
cave[row][col] = '.';
cave[row - 1][col] = 'O';
complete = false;
}
}
}
}
}
// Function that calculates the load on the north beams of the cave
fn get_load(&self, cave: &Vec<Vec<char>>) -> u32 {
(0..cave.len())
.map(|row| {
(0..cave[0].len())
.filter(|col| cave[row][*col] == 'O')
.map(|_| cave.len() - row)
.sum::<usize>()
})
.sum::<usize>() as u32
}
// Function that rotates the given vector through 90 degrees clockwise
fn rotate(&self, cave: &Vec<Vec<char>>) -> Vec<Vec<char>> {
let mut new_cave = vec![vec![' '; cave.len()]; cave[0].len()];
for row in 0..cave.len() {
for col in 0..cave[0].len() {
new_cave[col][cave.len() - row - 1] = cave[row][col];
}
}
new_cave
}
}
/// Test from puzzle input
#[cfg(test)]
mod test {
use super::*;
use crate::*;
#[test]
fn part1() {
let challenge = day14::Day14 {};
//Complete the Challenge
let answer = challenge
.part1(
utils::get_input(challenge.get_day(), utils::InputType::Test1)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "136");
}
#[test]
fn part2() {
let challenge = day14::Day14 {};
//Complete the Challenge
let answer = challenge
.part2(
utils::get_input(challenge.get_day(), utils::InputType::Test2)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "64");
}
#[test]
fn rotation_test() {
let challenge = day14::Day14 {};
let mut arr = vec![
vec!['a', 'b', 'c', 'd'],
vec!['d', 'e', 'f', 'g'],
vec!['h', 'i', 'j', 'k'],
vec!['l', 'm', 'n', 'o'],
];
let ans = arr.clone();
for _ in 0..4 {
arr = challenge.rotate(&arr);
}
assert_eq!(arr, ans);
}
}

148
src/solutions/day15.rs Normal file
View File

@@ -0,0 +1,148 @@
use std::str;
use super::Solution;
pub struct Day15 {}
impl Solution for Day15 {
fn part1(
&self,
input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
let pre_hashes = input[0].split(',').collect::<Vec<_>>();
let ans = pre_hashes
.iter()
.map(|h| self.hash(h, 17, 256))
.sum::<u32>();
Ok(Box::new(ans))
}
fn part2(
&self,
input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
let pre_hashes = input[0].split(',').collect::<Vec<_>>();
let mut boxes: Vec<Vec<(String, u32)>> = vec![vec![]; 256];
pre_hashes
.iter()
.for_each(|ins| self.sort_lenses(&mut boxes, ins));
let ans = boxes
.iter()
.enumerate()
.map(|(box_num, lenses)| {
lenses
.iter()
.enumerate()
.map(|(lens_num, (_, focal_length))| {
self.get_focussing_power(box_num + 1, lens_num + 1, *focal_length)
})
.sum::<u32>()
})
.sum::<u32>();
Ok(Box::new(ans))
}
fn get_day(&self) -> u8 {
15
}
}
impl Day15 {
/// function to generate the predefined hash outlined in the challenge
fn hash(&self, input: &str, seed: u32, divisor: u32) -> u32 {
let mut hash = 0u32;
for c in input.bytes() {
hash += c as u32;
hash *= seed;
hash %= divisor;
}
hash
}
/// Sort the lenses in the boxes based in instructions given
fn sort_lenses(&self, boxes: &mut Vec<Vec<(String, u32)>>, instruction: &str) {
let bytes = instruction.as_bytes();
// '-' Logic or '=' Logic
if bytes[bytes.len() - 1] == b'-' {
let label = str::from_utf8(&bytes[..bytes.len() - 1_usize]).unwrap();
let hash = self.hash(label, 17, 256);
boxes[hash as usize].retain(|(lens, _)| lens != label);
} else {
let mut parts = instruction.split('=');
let label = parts.next().unwrap();
let focal_length = parts.next().unwrap().parse::<u32>().unwrap();
let hash = self.hash(label, 17, 256);
let old_position = boxes[hash as usize]
.iter()
.position(|(existing_label, _)| existing_label == label);
if let Some(old_position) = old_position {
boxes[hash as usize][old_position] = (label.to_string(), focal_length);
} else {
boxes[hash as usize].push((label.to_string(), focal_length));
}
}
}
/// Function that determines the focussing power of a lens given its box,
/// position and focal length
fn get_focussing_power(&self, box_num: usize, slot_num: usize, focal_length: u32) -> u32 {
box_num as u32 * slot_num as u32 * focal_length
}
}
/// Test from puzzle input
#[cfg(test)]
mod test {
use super::*;
use crate::*;
#[test]
fn part1() {
let challenge = day15::Day15 {};
//Complete the Challenge
let answer = challenge
.part1(
utils::get_input(challenge.get_day(), utils::InputType::Test1)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "1320");
}
#[test]
fn part2() {
let challenge = day15::Day15 {};
//Complete the Challenge
let answer = challenge
.part2(
utils::get_input(challenge.get_day(), utils::InputType::Test2)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "145");
}
#[test]
fn hash_test() {
let challenge = day15::Day15 {};
// Test the hash
assert_eq!(challenge.hash("HASH", 17, 256), 52);
}
}

156
src/solutions/day16.rs Normal file
View File

@@ -0,0 +1,156 @@
use super::Solution;
use crate::utils::Direction;
pub struct Day16 {}
impl Solution for Day16 {
fn part1(
&self,
input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
let grid = input.iter().map(|l| l.as_bytes()).collect::<Vec<_>>();
Ok(Box::new(
self.traverse_grid(&grid, (0, 0, Direction::Right)),
))
}
fn part2(
&self,
input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
let grid = input.iter().map(|l| l.as_bytes()).collect::<Vec<_>>();
// Itterate through every edge piece and record the max energy from a list of all of the combinations
// O(n^2) :( Can't think of a better way of processing this
// r: row, c: col
let ans = (0..grid.len())
.flat_map(|r| {
[
(r, 0, Direction::Right),
(r, grid[0].len() - 1, Direction::Left),
]
})
.chain(
(0..grid[0].len())
.flat_map(|c| [(0, c, Direction::Down), (grid.len() - 1, c, Direction::Up)]),
)
.map(|start| self.traverse_grid(&grid, start))
.max()
.unwrap();
Ok(Box::new(ans))
}
fn get_day(&self) -> u8 {
16
}
}
impl Day16 {
/// Returns the next coordinate after taking a step in the given direction
fn step(&self, r: usize, c: usize, d: Direction) -> (usize, usize, Direction) {
let (dr, dc) = [(-1, 0), (0, 1), (1, 0), (0, -1)][d as usize];
((r as isize + dr) as _, (c as isize + dc) as _, d)
}
/// Function which traverses through the grid and returns the number of tiles that are energised
/// in the process
fn traverse_grid(&self, grid: &[&[u8]], start: (usize, usize, Direction)) -> usize {
let mut energised = vec![vec![[false; 4]; grid[0].len()]; grid.len()];
let mut beams = vec![start];
// Direction change given the current direction as an index
let right_lean = [
Direction::Right,
Direction::Up,
Direction::Left,
Direction::Down,
];
let left_lean = [
Direction::Left,
Direction::Down,
Direction::Right,
Direction::Up,
];
// Trace all of the beams present in the list
while !beams.is_empty() {
let mut new_beams = Vec::with_capacity(beams.capacity());
// Row, col and direction
for (r, c, d) in beams {
if r >= grid.len() || c >= grid[0].len() {
continue;
}
if energised[r][c][d as usize] {
continue;
}
energised[r][c][d as usize] = true;
// Trace the new path in a given direction and draw all of the new beams that come from it.
match (grid[r][c], d) {
(b'/', _) => new_beams.push(self.step(r, c, right_lean[d as usize])),
(b'\\', _) => new_beams.push(self.step(r, c, left_lean[d as usize])),
(b'|', Direction::Left | Direction::Right) => new_beams.extend([
self.step(r, c, Direction::Up),
self.step(r, c, Direction::Down),
]),
(b'-', Direction::Up | Direction::Down) => new_beams.extend([
self.step(r, c, Direction::Left),
self.step(r, c, Direction::Right),
]),
_ => new_beams.push(self.step(r, c, d)),
}
}
beams = new_beams;
}
// Get the number of 'energised' tiles now that we have finished processing every beam
energised
.iter()
.flatten()
.filter(|x| x.iter().any(|&b| b))
.count()
}
}
/// Test from puzzle input
#[cfg(test)]
mod test {
use super::*;
use crate::*;
#[test]
fn part1() {
let challenge = day16::Day16 {};
//Complete the Challenge
let answer = challenge
.part1(
utils::get_input(challenge.get_day(), utils::InputType::Test1)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "46");
}
#[test]
fn part2() {
let challenge = day16::Day16 {};
//Complete the Challenge
let answer = challenge
.part2(
utils::get_input(challenge.get_day(), utils::InputType::Test2)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "51");
}
}

240
src/solutions/day17.rs Normal file
View File

@@ -0,0 +1,240 @@
use super::Solution;
use crate::utils::Direction;
use std::collections::{BinaryHeap, HashMap};
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
struct State {
cost: u32,
pos: (usize, usize),
dir: Direction,
steps: u8,
}
impl Ord for State {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
other
.cost
.cmp(&self.cost)
.then_with(|| self.pos.cmp(&other.pos))
}
}
impl PartialOrd for State {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
struct StateKey {
pos: (usize, usize),
dir: Direction,
steps: u8,
}
impl From<State> for StateKey {
fn from(value: State) -> Self {
Self {
pos: value.pos,
dir: value.dir,
steps: value.steps,
}
}
}
pub struct Day17 {}
impl Solution for Day17 {
fn part1(
&self,
input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
let mut grid: HashMap<(usize, usize), u32> = HashMap::new();
for (y, row) in input.iter().enumerate() {
for (x, col) in row.chars().enumerate() {
grid.insert((x, y), col.to_digit(10).unwrap());
}
}
Ok(Box::new(
self.dijkstra(
(0, 0),
(input[0].len() - 1, input.len() - 1),
(input[0].len(), input.len()),
1,
3,
grid,
)
.unwrap(),
))
}
fn part2(
&self,
input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
let mut grid: HashMap<(usize, usize), u32> = HashMap::new();
for (y, row) in input.iter().enumerate() {
for (x, col) in row.chars().enumerate() {
grid.insert((x, y), col.to_digit(10).unwrap());
}
}
Ok(Box::new(
self.dijkstra(
(0, 0),
(input[0].len() - 1, input.len() - 1),
(input[0].len(), input.len()),
4,
10,
grid,
)
.unwrap(),
))
}
fn get_day(&self) -> u8 {
17
}
}
impl Day17 {
fn dijkstra(
&self,
start: (usize, usize),
end: (usize, usize),
lens: (usize, usize),
min_step: u8,
max_step: u8,
grid: HashMap<(usize, usize), u32>,
) -> Option<u32> {
let mut dist = HashMap::<StateKey, u32>::new();
let mut heap = BinaryHeap::new();
let st1 = State {
cost: 0,
pos: start,
dir: Direction::Right,
steps: 0,
};
let st2 = State {
cost: 0,
pos: start,
dir: Direction::Down,
steps: 0,
};
dist.insert(st1.into(), 0);
dist.insert(st2.into(), 0);
heap.push(st1);
heap.push(st2);
while let Some(
state @ State {
cost,
pos,
dir,
steps,
},
) = heap.pop()
{
if pos == end && steps >= min_step {
return Some(cost);
}
if dist.get(&state.into()).is_some_and(|&c| c < cost) {
continue;
}
for (n, d) in self.neighbours(pos, dir, lens) {
let next = State {
cost: cost + grid[&n],
pos: n,
dir: d,
steps: if d == dir { steps + 1 } else { 1 },
};
if next.steps > max_step || dist.get(&next.into()).is_some_and(|&c| c <= next.cost)
{
// For p1 and p2
// Streak gets too long
// Or a better solution/path already exists
continue;
}
if next.dir != dir && steps < min_step {
// For p2
// Making a turn but previous streak is too short
continue;
}
heap.push(next);
dist.insert(next.into(), next.cost);
}
}
None
}
fn neighbours(
&self,
(x, y): (usize, usize),
dir: Direction,
(x_len, y_len): (usize, usize),
) -> Vec<((usize, usize), Direction)> {
const fn deltas(x: usize, y: usize) -> [((usize, usize), Direction); 4] {
[
((x, y.saturating_sub(1)), Direction::Up),
((x, y + 1), Direction::Down),
((x.saturating_sub(1), y), Direction::Left),
((x + 1, y), Direction::Right),
]
}
deltas(x, y)
.into_iter()
.filter_map(|(n, d)| {
if n == (x, y) || n.0 > x_len - 1 || n.1 > y_len - 1 || d == dir.flip() {
None
} else {
Some((n, d))
}
})
.collect()
}
}
/// Test from puzzle input
#[cfg(test)]
mod test {
use super::*;
use crate::*;
#[test]
fn part1() {
let challenge = day17::Day17 {};
//Complete the Challenge
let answer = challenge
.part1(
utils::get_input(challenge.get_day(), utils::InputType::Test1)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "102");
}
#[test]
fn part2() {
let challenge = day17::Day17 {};
//Complete the Challenge
let answer = challenge
.part2(
utils::get_input(challenge.get_day(), utils::InputType::Test2)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "94");
}
}

66
src/solutions/day18.rs Normal file
View File

@@ -0,0 +1,66 @@
use super::Solution;
pub struct Day18 {}
impl Solution for Day18 {
fn part1(
&self,
_input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
Ok(Box::new("Ready"))
}
fn part2(
&self,
_input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
Ok(Box::new("Ready"))
}
fn get_day(&self) -> u8 {
18
}
}
impl Day18 {}
/// Test from puzzle input
#[cfg(test)]
mod test {
use super::*;
use crate::*;
#[test]
fn part1() {
let challenge = day18::Day18 {};
//Complete the Challenge
let answer = challenge
.part1(
utils::get_input(challenge.get_day(), utils::InputType::Test1)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "Ready");
}
#[test]
fn part2() {
let challenge = day18::Day18 {};
//Complete the Challenge
let answer = challenge
.part2(
utils::get_input(challenge.get_day(), utils::InputType::Test2)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "Ready");
}
}

66
src/solutions/day19.rs Normal file
View File

@@ -0,0 +1,66 @@
use super::Solution;
pub struct Day19 {}
impl Solution for Day19 {
fn part1(
&self,
_input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
Ok(Box::new("Ready"))
}
fn part2(
&self,
_input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
Ok(Box::new("Ready"))
}
fn get_day(&self) -> u8 {
19
}
}
impl Day19 {}
/// Test from puzzle input
#[cfg(test)]
mod test {
use super::*;
use crate::*;
#[test]
fn part1() {
let challenge = day19::Day19 {};
//Complete the Challenge
let answer = challenge
.part1(
utils::get_input(challenge.get_day(), utils::InputType::Test1)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "Ready");
}
#[test]
fn part2() {
let challenge = day19::Day19 {};
//Complete the Challenge
let answer = challenge
.part2(
utils::get_input(challenge.get_day(), utils::InputType::Test2)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "Ready");
}
}

66
src/solutions/day20.rs Normal file
View File

@@ -0,0 +1,66 @@
use super::Solution;
pub struct Day20 {}
impl Solution for Day20 {
fn part1(
&self,
_input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
Ok(Box::new("Ready"))
}
fn part2(
&self,
_input: &mut Vec<String>,
) -> Result<Box<dyn std::fmt::Display + Sync>, Box<dyn std::error::Error>> {
Ok(Box::new("Ready"))
}
fn get_day(&self) -> u8 {
20
}
}
impl Day20 {}
/// Test from puzzle input
#[cfg(test)]
mod test {
use super::*;
use crate::*;
#[test]
fn part1() {
let challenge = day20::Day20 {};
//Complete the Challenge
let answer = challenge
.part1(
utils::get_input(challenge.get_day(), utils::InputType::Test1)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "Ready");
}
#[test]
fn part2() {
let challenge = day20::Day20 {};
//Complete the Challenge
let answer = challenge
.part2(
utils::get_input(challenge.get_day(), utils::InputType::Test2)
.unwrap()
.as_mut(),
)
.unwrap()
.to_string();
assert_eq!(answer, "Ready");
}
}

Some files were not shown because too many files have changed in this diff Show More