Change repo layout

This commit is contained in:
Andrew Glaze 2023-12-14 10:42:19 -05:00
parent 78aab8ab5e
commit 5a87bfb681
52 changed files with 477 additions and 5480 deletions

5
.gitignore vendored
View File

@ -1 +1,6 @@
target
input/
# Added by cargo
/target

269
Cargo.lock generated Normal file
View File

@ -0,0 +1,269 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "advent-of-code-2023"
version = "0.1.0"
dependencies = [
"aoc-runner",
"aoc-runner-derive",
"itertools",
"rust-crypto",
]
[[package]]
name = "aoc-runner"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d21ef9204ad206a5a3e918e9920da04e1118ad91ce4f23570be964b9d6b9dfcb"
[[package]]
name = "aoc-runner-derive"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba8b944269d3fee645d281b1335e1797044db497bb02d0098cc3fdb8900069cc"
dependencies = [
"aoc-runner-internal",
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]]
name = "aoc-runner-internal"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "274b0ba7f3669a45ec0aaacf94eb032a749de880ab776091576cca94037c9982"
dependencies = [
"serde",
"serde_derive",
"serde_json",
]
[[package]]
name = "either"
version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
[[package]]
name = "fuchsia-cprng"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
[[package]]
name = "gcc"
version = "0.3.55"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2"
[[package]]
name = "itertools"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0"
dependencies = [
"either",
]
[[package]]
name = "itoa"
version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c"
[[package]]
name = "libc"
version = "0.2.151"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4"
[[package]]
name = "proc-macro2"
version = "1.0.70"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
dependencies = [
"proc-macro2",
]
[[package]]
name = "rand"
version = "0.3.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64ac302d8f83c0c1974bf758f6b041c6c8ada916fbb44a609158ca8b064cc76c"
dependencies = [
"libc",
"rand 0.4.6",
]
[[package]]
name = "rand"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293"
dependencies = [
"fuchsia-cprng",
"libc",
"rand_core 0.3.1",
"rdrand",
"winapi",
]
[[package]]
name = "rand_core"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
dependencies = [
"rand_core 0.4.2",
]
[[package]]
name = "rand_core"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
[[package]]
name = "rdrand"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
dependencies = [
"rand_core 0.3.1",
]
[[package]]
name = "rust-crypto"
version = "0.2.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f76d05d3993fd5f4af9434e8e436db163a12a9d40e1a58a726f27a01dfd12a2a"
dependencies = [
"gcc",
"libc",
"rand 0.3.23",
"rustc-serialize",
"time",
]
[[package]]
name = "rustc-serialize"
version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe834bc780604f4674073badbad26d7219cadfb4a2275802db12cbae17498401"
[[package]]
name = "ryu"
version = "1.0.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c"
[[package]]
name = "serde"
version = "1.0.193"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.193"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.41",
]
[[package]]
name = "serde_json"
version = "1.0.108"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b"
dependencies = [
"itoa",
"ryu",
"serde",
]
[[package]]
name = "syn"
version = "1.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "syn"
version = "2.0.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44c8b28c477cc3bf0e7966561e3460130e1255f7a1cf71931075f1c5e7a7e269"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "time"
version = "0.1.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a"
dependencies = [
"libc",
"wasi",
"winapi",
]
[[package]]
name = "unicode-ident"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
[[package]]
name = "wasi"
version = "0.10.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"

13
Cargo.toml Normal file
View File

@ -0,0 +1,13 @@
[package]
name = "advent-of-code-2023"
version = "0.1.0"
edition = "2021"
[lib]
bench = false
[dependencies]
rust-crypto = "0.2.36"
aoc-runner = "0.3.0"
aoc-runner-derive = "0.3.0"
itertools = "0.12.0"

7
day01/Cargo.lock generated
View File

@ -1,7 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "day1"
version = "0.1.0"

View File

@ -1,8 +0,0 @@
[package]
name = "day1"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

File diff suppressed because it is too large Load Diff

7
day02/Cargo.lock generated
View File

@ -1,7 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "day2"
version = "0.1.0"

View File

@ -1,8 +0,0 @@
[package]
name = "day2"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

View File

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

View File

@ -1,83 +0,0 @@
use std::{fs, cmp::max};
fn main() {
let input = fs::read_to_string("input.txt").unwrap();
let input: Vec<_> = input.split('\n').collect();
let mut sum = 0;
for line in input {
let split:Vec<_> = line.split(':').collect();
let rounds: Vec<_> = split.last().unwrap().split(';').collect();
let rounds: Vec<_> = rounds.iter()
.map(|x| {
x.split(',').collect::<Vec<_>>()
}).collect();
let rounds: Vec<_> = rounds.iter()
.map(|x| {
x.iter().map(|x| {
x.trim().split(' ').collect::<Vec<_>>()
}).collect::<Vec<_>>()
}).collect();
let (mut r_max, mut g_max, mut b_max) = (0, 0, 0);
for round in rounds {
for set in round {
let color = set.last().unwrap();
let num: i32 = set.first().unwrap().parse().unwrap();
match *color {
"red" => r_max = max(num, r_max),
"blue" => b_max = max(num, b_max),
"green" => g_max = max(num, g_max),
&_ => todo!()
}
}
}
//println!("{}", r_max);
sum += r_max * g_max * b_max;
}
println!("{}", sum);
}
// use std::fs;
// fn main() {
// let input = fs::read_to_string("input.txt").unwrap();
// let input: Vec<_> = input.split('\n').collect();
// let mut game_id = 0;
// let (r_max, g_max, b_max) = (12, 13, 14);
// let mut sum = 0;
// for line in input {
// game_id += 1;
// let split:Vec<_> = line.split(':').collect();
// let rounds: Vec<_> = split.last().unwrap().split(';').collect();
// let rounds: Vec<_> = rounds.iter().map(|x| x.split(',').collect::<Vec<_>>()).collect();
// let rounds: Vec<_> = rounds.iter().map(|x| x.iter().map(|x| x.trim().split(' ').collect::<Vec<_>>()).collect::<Vec<_>>()).collect();
// let mut sad = false;
// for round in rounds {
// let (mut r_cur, mut g_cur, mut b_cur) = (0, 0, 0);
// for set in round {
// let color = set.last().unwrap();
// let num: i32 = set.first().unwrap().parse().unwrap();
// match *color {
// "red" => r_cur += num,
// "blue" => b_cur += num,
// "green" => g_cur += num,
// &_ => todo!()
// }
// }
// if r_cur > r_max || b_cur > b_max || g_cur > g_max {
// sad = true;
// }
// }
// if !sad {
// sum += game_id;
// }
// }
// println!("{}", sum);
// }

16
day03/Cargo.lock generated
View File

@ -1,16 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "array2d"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79093d31d0a9c7832c71ad74dd945b7861f721e6f242aa67be253a5eecbac937"
[[package]]
name = "day3"
version = "0.1.0"
dependencies = [
"array2d",
]

View File

@ -1,9 +0,0 @@
[package]
name = "day3"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
array2d = "0.3.0"

View File

@ -1,140 +0,0 @@
.......................661.........................485..565.......344.......325.....................................841.....725.............
....*609..131................512.......................*................536*..............462/..-...60..424.........@....$.*................
.316.........*.......39..................@.630......377........919...........98................789..*..*..............788..2.......=..564...
...........431...535...*...............622.-..../.................*..........*.......682...........108.116....@...-...............299.......
.....................428.....378...844.........416...............586.537=..27..........*......$..............871...331..................492.
...878....390....%..............*.*...................739.496=.................867......867..867.........................344......487.../...
...../.....*...558........@..535...644..................+.........404..605.......*................................%.....*...................
........................381............729..726....578........10...*..........818..............................929....934..........119......
.53....31..........734-..........847*.................#.........*...........#............217............/..321....................*.........
.......=.............................509.315.654.................60.........925.747*559..*.....430....226..*...................290...848=...
..........=.......546......664..507......../....#.......337.............................94........=.........359....528*996..................
.....351...638.......*.............*433............337.....................226...859........../............................378..............
.......*..........648.........183.........126........*...........208.954......=....*.......626........499*..........803.../....642.235......
.518*...813..990..............*..............*......699...133....+...............68...............79......838.447...*..........*...*........
................+.696*.........586.6......243.............*..........$224.............392...275.....-.........*...699...#177..230.593.&.....
...........$326.......683.-761.......491......./.........26...........................*.....=.........56.305.262.......................150..
....=.......................................41.908.........................819.785.....276.....&.................%..........................
.618......401$...............-......................599..124......34+.........*..............676..................342...........473.........
....................889......888..454....723/.........*.................141*.....958.......................................416.....*94......
....212.............-................%.........826=....552..................569....*............................728........=............143.
...*......287...................=60.............................872.....886.......171....437......815..680.........*.............633....+...
..234....*.....687..........432........203/.....*...275.65.........*341.@...........................*....%.246......272.....922*..../.......
........967.........495.......*....161.......474.97...*..*..84.400.........*295....805......................@...................915.........
...419.................*.979...932....*.............729.215.#....*.......81........*......554.263*567..........812..........................
.....*..............458....$.........682......................179................348..906.................428.../............798............
...668..................-.........................552............./..................=.......+...........@..........99........*..85.4.......
........29......938..594......107........*171.98.....*..896....$..491...........+..........412..12.............326.*.....705..4....*........
..........*....................+......332......@....949..*...750.......$..974....342.............*....558......#............*..........794..
.......459....342*.........637...........................273.....658..601....*................735....*...............%....627....889...*....
.697..............131....................718.................689.............450....390............994.............793.............*..241...
..............991........89..........14.......*.................*912.............39.+...698.............................953*240...87........
..324.............618.....*...328......*....538.%.....307.920.........515...............*...................................................
.....*386...........*...780..*.......475.........719...*...*...................910...410................384.....999........*756.............
....................268.......701.............72........63.43...193.....+..................674...670$....*........*......95.......893.......
...16.........................................*....663........../....407.....................*........258....264=.298........202*..../......
...&......574................187.......88...53.........931........@......&759....$..672....385..............................................
.....938........192......297....*.723...*.................%......930...........692................283.....................=349.........&981.
......*....................&.207....*...843.736.........................260..........677..389........*..............954..........&..........
......603........713.............745..................411.359.922.......*.............*......*.......718..888..561..=.........182..206......
............896....*.....173*383.......%...145...943...*.....*.........622..382*.......180.141............*...........................*.....
.....89........*...238.............+.714....*........575../.........................@...............$.....539.......114*721.645........471..
.......*307....968..............250......836.....498......59....909..601*..........117...........435../........944..........................
............*...............56*.................+....498..........-......730.882..........975..........680........*...95......152....$517...
...........150.......142.......473.713.+262...........=...577.266...736..........668..$.........70*111......811.165..@......................
.......741.............*.97.......................=.........*.......*....-654..........428..157................................748*823......
.........*............48...*.....772....892.....350....$.....760.148.............................440...........731*563......................
........260..............227...............*..........795..................649.....27.107...219.@.....23@...............226......369........
...41............&...................+...136.....546.......$.920...................+...*...&....../.........981...........@.......*.....454.
...*......635%....782...............560............*....896...........854..+...........694......340...@.498*....................41..959*....
...486..........................63..................810......641....+....*..532....642.......$.......90.....................76=.............
..........325.....................@..............@...........-....539.407.............$......9...........550................................
...787..$....*.$105.126.+810.........497.576...538.............................718.......................*...+....317..519..................
.......303.493...........................................-...........462..647..*...........%..+875....641..644.....*......*.....154.588.....
................./.....-......44.........%...@140.......228...43......*....*..132.794...628.......................669....110....*.....*.....
....579...........348..32.491*.......#...646.......506..........*708......74........#........117..............24*............698....532.....
......*.........................902.722............=....=........................................700....610......878....*...................
.../..885.../..351.............*.........................799.....814*238......*339....428*825......./................965.862......125.......
.723......243.@........852..........757...784.472..814.......603...........151........................279.617....849........................
........................*......./............*.......*.........*....#.............91.......246...384.....*........%.........................
.218.659....113+........128....691...................972......571....934............*......*...................................442..236.....
....*...............455.............868......&379.........................594.......80....654.....................421.456...................
............2*535......*410...553........409......235.173..779......116.....*.................&........*646.418*.....*.................596..
.70#.361......................./....493....$..........*...-.....440.........317...865...323....696..202..........952.......187.....%....#...
..........%...767......318............*................1.............../...........*......*................241......@.147...*.....389.......
..921.....301..*........*............67.540.../....149.........=........827.....=.347....956..........980...............$...204.............
...*............341......154.............*..695.....$.....20.183..............177..................$...$...66......699..........495......296
.460........&.......+............%.......4......+........*.......................................347.........*36...*....912.......*..765....
............142..163......885..480...............805.%...587...........289.310*389........$843..........-..........417....*.....628....*....
.............................*............434........803........482......-.........556.........&.........294...33$.........79........358....
.......................407@...873...............+..................*542....../.41....$./758....176.................*........................
.........842......................442*766.......284.........842...........856...*......................647......422.94..............@.......
....$........799............................&.......433.318*.....576..........111....................................................788....
.720...168.....%........840..............989....................*.......=............468..419...........198.................................
......*..................+..392..............282.......&...............591..........&....*....101.340....-.....187.....-....................
.....746...........................499...779...*....456...........@....................346....*......%...........*..693.......94..72........
.........970..671..696./....................&..999......124..246.434...........................173........@.....165.......925*.../..........
..628.............*....608.....827-.......*..............#....*........634...../418......185.......311...808.........372*............824....
..........694...360.....................43.645.................935........*516...........*....555.....*..................33.........-.......
............*............+........576#.........810*592..740.....................#665..968........*499.775..882+..............998............
....=303.....433.280......147..82.........................*..............................................................751*...............
.................$......................608...560..827...227....................448*..@......................@529.376...........@...........
...........465.....#.............554.....#.......#..#.......................401.......714...../.192.999..................466...28.161....351
..............&....706..157.679.@..........741..............818.811=..............412.......376...&..*.......=..............................
.441.....955....63.........*........=........+.............*..............#..........*..............399.......613.......444........*972.....
........@......*..................697..........600.&965...354.#.....392...827..665....326.................323...........&.......483.........
................381........972..........373*..*................9...&...........................289.........*................................
...........................*....+.............239......................863....................*..........341.....*329...................$...
801..+...638.659........358...29..695.....@........241...680.....863..........................310.#...........941........@216........311....
...*.358.*...*....................@....786....*330................&.........842........11..........279...................................686
.932..........666....533..712..............801.............64.544.....*972.....*353....-..809...........524...........397...............*...
.........795+.......*.......*......394=................586......*.........................................&...........................562...
...................629.......184........796..............=................-946.348.../670............63.........%...........................
.....428-................918.........@..............#.............850.889.........*..............673..#..110.221..........337.560...-.......
.....................926*.........809.........=......627.............*..........344..........343.*........*.......832.......*....*...216....
.....624.....+................................78............915..701.....876.........734.402.....181.193.460.639.....*...558...138..........
.../...*...91....804..324..985......#429......................*..*.............892....................*......*...321.727...........134......
...991............*.........*.............39...........%.633.213.623..........&...........601.919.....378.318...*............@34............
........183.....#.399...+..297..973...622..*........855../......................+684../......*................335.................733.......
..........@..576......597........*.....*....686....................371..98..23$......119................................=.777......*........
.................901%......*...412......102...........754...332.47*......*......861+......539................495@....801...*..404...777.....
.........577..........577..978.................990......*...#............236.............@..............339............../......*........534
..169.....*..687........*..........598..........*..349@.723.....864..........972............196.....491*........$........335.372............
.........339..=......633........29...*.........4............251*.....$..........*.250.........$.908..............356.230...........324.386..
.................943.............-.....=............................325...726.690.*................/.......646........*...214.......=.......
.........&468.......*..................999.......944.........751..........*.......219.837.107..............*...=....271..*..............283.
......*..........210.....*390.....917*.....996*.....+..790...-.........128...............*................905.277.......320....936..835.....
...640.581....*.......167.............392......29......*..........885............................369..................&...........*.$...#...
..............708..........106.223...................817.........*............277.........&.........@..795.-296....172..........633......229
.......82..........@679.......*....*806.................../....10.............*.........456...........*.................95...........3......
..........536....................12........=914..458.......214..........995..97.-735........370.......334..876=.........*.......950#........
.........*.............=.....10.......837...........+..518.................*...................*........................761.................
......414..=.........794.............=................*...................813.394...815.718....759........403...............738.............
............463...........-..238.419............810.41...........452..2=..................&..............&........435.................468...
........................103....*..........................+...11.&....................927...........%.......282...*...234.....229......*....
......301+....................678............100.......954.....*...@....182....@.........*....737...916....-....890....@..118*.......625....
............67...312..865+.............910.....*...382.......516....973....*..874.500..153.....*............................................
.....373+...*.....*...............979..........469....*375..............765...................99....................733................897..
..........828.....669......=.....*...........................................284.189...$..371......*168..............%.......762............
..........................4..565.226........562@....190......281....257.......*.......889./......57........./...#.......210..*..............
......47.......120.............#...................*...........&....*.....169.549............%............414..744......%....503.#208.......
........*.................643.........397...........350..........289....&...*........&.....323.....+..................................856...
.....*...............458....#........................................104.....931..855..............89..469.....882...........=.........*....
..594.777......390...*...........422........355..............654............................81........*...........*......282..630....195....
..................*.568.912........*........*.....377..........*......*877.............419..*.....148.768.......471....+....*...............
.......393......163..........298.820............@..................582.......823......=...........*....................952..................
..........*268.......*733.59...@.............403..........................................14&...502...............481.........$.....231.....
........#.........970.....*......#....981...........711.261=.................=.......................701..244................323.....*......
.396....993.............557.......46.....*...........+..........714*659.....134........623..........*............677.730..............846...
......#......91...405........296..........295..............@..*.......................#..............740............*........%..............
.......345..=........-.792....*..834................100.891....764...697........570......*....620*.@.....................508..295...........
...*13................../...340...#..134..............#................*..........*.......247......660....607....705.....=...........165....
.........521..824...222.............*......372..290.....844.825-.......867..820...627...........................*............128...../...777
...629...*....#..................788...535....*..-.......*.........361......................*......805.......732....914....../...-......@...
...*.....743...........853..................637.......880...-..849*........425............946..590....*302...........*.........748..........
...120.%.......271..............862.....70................207................=......233.......*..................443..263...................
........680....../.825.....&793...........*....................-720.............555........184..509.......22......*.............811.........
..........................................772.272......................134.........*..374.........*............573........*.......*.........
934..231.....*....821...230.....981..............%........707..370....*.....634%..787..*..........93..909..70..........199.59...490.........
.......*....525.........-........*...747...676=..../.......*..........829...............324..952.........%...*..........................%...
.....189.........................791.............236........687.868........................................505..............713......777....

View File

@ -1,193 +0,0 @@
use std::collections::HashMap;
use std::fs;
use array2d::Array2D;
// pub fn main() {
// let input = fs::read_to_string("input.txt").unwrap();
// let array_2d = get_map(&input);
// // let mut r = Vec::new();
// let mut stars_count: HashMap<(usize, usize), Vec<u32>> = HashMap::new();
// for (y, row_iter) in array_2d.rows_iter().enumerate() {
// let mut checked = false;
// for (x, element) in row_iter.enumerate() {
// let d: char = element.clone();
// if d.is_digit(10) && !checked {
// let star_vec = get_neighboring_star(x, y, &array_2d);
// if !star_vec.is_empty() {
// let (x_star, y_star, _) = star_vec.first().unwrap().clone();
// let key = (x_star, y_star);
// let gear = get_number(x, y, &array_2d);
// if stars_count.contains_key(&key) {
// let mut v: Vec<u32> = stars_count.get(&(x_star, y_star)).unwrap().clone();
// v.push(gear);
// stars_count.insert(key, v);
// } else {
// stars_count.insert(key, vec![gear]);
// }
// checked = true
// }
// } else if !d.is_digit(10) {
// checked = false;
// }
// }
// }
// let r = stars_count.iter().fold(0u32, |acc, (_, gears)| {
// if gears.len() == 2 {
// acc + gears.first().unwrap() * gears.last().unwrap()
// } else {
// acc
// }
// });
// println!("{}", r);
// }
pub fn main() {
let input = fs::read_to_string("input.txt").unwrap();
let array_2d = get_map(&input);
let mut r = 0;
for (y, row_iter) in array_2d.rows_iter().enumerate() {
let mut checked = false;
for (x, element) in row_iter.enumerate() {
let d: char = element.clone();
if d.is_digit(10) && !checked {
if !get_neighbors(x, y, &array_2d).is_empty() {
checked = true;
r += get_number(x, y, &array_2d)
}
} else if !d.is_digit(10) {
checked = false;
}
}
}
println!("{}", r);
}
fn get_map(input: &str) -> Array2D<char> {
let rows: Vec<&str> = input.split("\n").collect();
let mut array = Vec::new();
for row in rows {
let row_vec: Vec<char> = row.chars().collect();
array.push(row_vec);
}
Array2D::from_rows(&array).unwrap()
}
fn get_number(x: usize, y: usize, array2d: &Array2D<char>) -> u32 {
// We're dealing with only 3 digits numbers
let mut i = x.clone();
let mut j = x.clone() - 1;
let mut next_neighbors = Vec::new();
let mut prev_neighbors = Vec::new();
while array2d.get(y, i).is_some() && array2d.get(y, i).unwrap().is_digit(10) {
next_neighbors.push(array2d.get(y, i).unwrap());
i += 1
}
while array2d.get(y, j).is_some() && array2d.get(y, j).unwrap().is_digit(10) {
prev_neighbors.push(array2d.get(y, j).unwrap());
if j > 0 {
j -= 1
} else {
break;
}
}
let mut prev: Vec<&char> = prev_neighbors.clone().into_iter().rev().collect();
prev.append(&mut next_neighbors);
prev
.into_iter()
.fold(String::new(), |a, b| a + &b.to_string())
.parse()
.unwrap()
}
fn get_neighbors(x: usize, y: usize, array2d: &Array2D<char>) -> Vec<&char> {
let mut neighbors = Vec::new();
neighbors.push(array2d.get(y, x.checked_add(1).unwrap()));
if x > 0 {
neighbors.push(array2d.get(y, x.checked_sub(1).unwrap()));
neighbors.push(array2d.get(y.checked_add(1).unwrap(), x.checked_sub(1).unwrap()));
}
if y > 0 {
neighbors.push(array2d.get(y.checked_sub(1).unwrap(), x));
neighbors.push(array2d.get(y.checked_sub(1).unwrap(), x.checked_add(1).unwrap()));
}
if x > 0 && y > 0 {
neighbors.push(array2d.get(y.checked_sub(1).unwrap(), x.checked_sub(1).unwrap()));
}
neighbors.push(array2d.get(y.checked_add(1).unwrap(), x));
neighbors.push(array2d.get(y.checked_add(1).unwrap(), x.checked_add(1).unwrap()));
neighbors
.into_iter()
.flatten()
.filter(|c| !c.is_digit(10) && **c != '.')
.collect()
}
fn get_neighboring_star(x: usize, y: usize, array2d: &Array2D<char>) -> Vec<(usize, usize, Option<&char>)> {
let mut neighbors: Vec<(usize, usize, Option<&char>)> = Vec::new();
neighbors.push((x.checked_add(1).unwrap(), y, array2d.get(y, x.checked_add(1).unwrap())));
if x > 0 {
neighbors.push((x.checked_sub(1).unwrap(), y, array2d.get(y, x.checked_sub(1).unwrap())));
neighbors.push((x.checked_sub(1).unwrap(), y.checked_add(1).unwrap(), array2d.get(y.checked_add(1).unwrap(), x.checked_sub(1).unwrap())));
}
if y > 0 {
neighbors.push((x, y.checked_sub(1).unwrap(), array2d.get(y.checked_sub(1).unwrap(), x)));
neighbors.push((x.checked_add(1).unwrap(), y.checked_sub(1).unwrap(), array2d.get(y.checked_sub(1).unwrap(), x.checked_add(1).unwrap())));
}
if x > 0 && y > 0 {
neighbors.push((x.checked_sub(1).unwrap(), y.checked_sub(1).unwrap(), array2d.get(y.checked_sub(1).unwrap(), x.checked_sub(1).unwrap())));
}
neighbors.push((x, y.checked_add(1).unwrap(), array2d.get(y.checked_add(1).unwrap(), x)));
neighbors.push((x.checked_add(1).unwrap(), y.checked_add(1).unwrap(), array2d.get(y.checked_add(1).unwrap(), x.checked_add(1).unwrap())));
neighbors
.into_iter()
.filter(|(_, _, c)| c.is_some() && c.unwrap() == &'*')
.collect::<Vec<(usize, usize, Option<&char>)>>()
}
pub fn part_two(input: &str) -> Option<u32> {
let array_2d = get_map(input);
// let mut r = Vec::new();
let mut stars_count: HashMap<(usize, usize), Vec<u32>> = HashMap::new();
for (y, row_iter) in array_2d.rows_iter().enumerate() {
let mut checked = false;
for (x, element) in row_iter.enumerate() {
let d: char = element.clone();
if d.is_digit(10) && !checked {
let star_vec = get_neighboring_star(x, y, &array_2d);
if !star_vec.is_empty() {
let (x_star, y_star, _) = star_vec.first().unwrap().clone();
let key = (x_star, y_star);
let gear = get_number(x, y, &array_2d);
if stars_count.contains_key(&key) {
let mut v: Vec<u32> = stars_count.get(&(x_star, y_star)).unwrap().clone();
v.push(gear);
stars_count.insert(key, v);
} else {
stars_count.insert(key, vec![gear]);
}
checked = true
}
} else if !d.is_digit(10) {
checked = false;
}
}
}
let r = stars_count.iter().fold(0u32, |acc, (_, gears)| {
if gears.len() == 2 {
acc + gears.first().unwrap() * gears.last().unwrap()
} else {
acc
}
});
Some(r)
}

7
day04/Cargo.lock generated
View File

@ -1,7 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "day4"
version = "0.1.0"

View File

@ -1,8 +0,0 @@
[package]
name = "day4"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

View File

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

View File

@ -1,99 +0,0 @@
use std::fs;
use std::collections::VecDeque;
fn main() {
let input = fs::read_to_string("input.txt").unwrap();
// an array in this format [[card 1: [winning nums][ our nums]]]
let input: Vec<_> = input.split('\n') // split days
.map(|card| &card[(card.find(':').unwrap() + 1)..]) // remove day numbers
.map(|card| card.trim()) // trim extra whitespace
.map(|card| {
card.split('|') // split winning/own numbers
.map(|numbers| {
numbers.trim() // trim whitespace
.split(' ') // split into individual nums
.filter(|x| !x.is_empty()) // remove empty strings
.map(|x| {return x.parse::<i32>().unwrap()}) // convert to i32
.collect::<Vec<_>>()
})
.collect::<Vec<_>>()
})
.collect();
let mut queue = VecDeque::from((0..input.len()).collect::<Vec<usize>>());
let mut total_cards = 0;
while !queue.is_empty() {
let card_num = queue.pop_front().unwrap();
let card = input.get(card_num).unwrap();
total_cards += 1;
let mut dup_cards = 0;
let winning_nums = card.first().unwrap();
let our_nums = card.last().unwrap();
//dp would kill here, but im lazy
for num in our_nums {
if winning_nums.contains(num) {
dup_cards += 1;
}
}
for card in (card_num + 1)..=(card_num + dup_cards) {
if card < input.len() {
queue.push_back(card);
}
}
}
println!("{:?}", total_cards);
}
// use std::fs;
// fn main() {
// let input = fs::read_to_string("input.txt").unwrap();
// // an array in this format [[card 1: [winning nums][ our nums]]]
// let input: Vec<_> = input.split('\n') // split days
// .map(|card| &card[(card.find(':').unwrap() + 1)..]) // remove day numbers
// .map(|card| card.trim()) // trim extra whitespace
// .map(|card| {
// card.split('|') // split winning/own numbers
// .map(|numbers| {
// numbers.trim() // trim whitespace
// .split(' ') // split into individual nums
// .filter(|x| !x.is_empty()) // remove empty strings
// .map(|x| {return x.parse::<i32>().unwrap()}) // convert to i32
// .collect::<Vec<_>>()
// })
// .collect::<Vec<_>>()
// })
// .collect();
// let mut total_pts = 0;
// for card in input {
// let mut card_pts = 0;
// let winning_nums = card.first().unwrap();
// let our_nums = card.last().unwrap();
// for num in our_nums {
// if winning_nums.contains(num) {
// if card_pts == 0 {
// card_pts = 1;
// } else {
// card_pts *= 2;
// }
// }
// }
// //println!("{}", card_pts);
// total_pts += card_pts;
// }
// println!("{:?}", total_pts);
// }

7
day05/Cargo.lock generated
View File

@ -1,7 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "day5"
version = "0.1.0"

View File

@ -1,8 +0,0 @@
[package]
name = "day5"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

View File

@ -1,238 +0,0 @@
seeds: 3943078016 158366385 481035699 103909769 3553279107 15651230 3322093486 189601966 2957349913 359478652 924423181 691197498 2578953067 27362630 124747783 108079254 1992340665 437203822 2681092979 110901631
seed-to-soil map:
2702707184 1771488746 32408643
1838704579 89787943 256129587
3308305769 3945110092 140077818
3628160213 4264964536 30002760
3481822196 4118626519 146338017
2314039806 0 23017018
2094834166 23017018 66770925
13529560 2374830476 266694587
1360948085 2280951884 93878592
2337056824 1405838386 365650360
2735115827 1389537903 16300483
2161605091 1122407194 152434715
2944685788 3581490111 363619981
3448383587 4085187910 33438609
293095451 1923371965 152989927
555976625 1361056107 28481796
0 2076361892 13529560
4055868219 3342391034 239099077
3658162973 2944685788 397705246
446085378 2641525063 109891247
584458421 685760755 436646439
1647644147 2089891452 191060432
1528169571 1832460171 90911794
1619081365 1803897389 28562782
280224147 1348184803 12871304
1021104860 345917530 339843225
1454826677 1274841909 73342894
soil-to-fertilizer map:
370579153 1660655546 474809840
1390384163 3890794774 29044725
3933903064 3062217622 43562309
2579648014 2135465386 381757066
3905615715 3862507425 28287349
4053211235 382332912 208377334
3718132574 4107484155 187483141
3977465373 306587050 75745862
1866333065 230994048 75593002
1268904151 2940737610 121480012
3646057320 3790432171 72075254
845388993 2517222452 423515158
2291172026 769577840 288475988
4261588569 3919839499 33378727
2112304432 590710246 178867594
1419428888 1213751369 446904177
2961405080 3105779931 684652240
230994048 3967899050 139585105
2097623608 3953218226 14680824
1941926067 1058053828 155697541
fertilizer-to-water map:
0 1551952886 33233684
961721436 932763195 63696624
2767354703 3875238046 18117484
3717194106 2676555200 188038931
799543557 483022915 162177879
2428347038 3081230279 28566103
2872288153 3519235797 218585862
215425000 1162608123 279396952
1473270503 411403786 71619129
2762028477 2930057227 5326226
3263853515 2169144956 62130350
3330983617 2935383453 10086546
2522376237 2231275306 106924906
2757818051 2103190872 4210426
3090874015 3187643516 172979500
2785472187 2530367956 37190043
1365587214 49710602 107683289
554985341 330919476 80484310
3639346972 3109796382 77847134
1964878739 1442005075 21531118
2098191120 3737821659 137416387
1832452033 298110266 32809210
2456913141 2864594131 65463096
1025418060 1606654056 340169154
2277580887 2475812485 29651215
2416229303 2107401298 12117735
33233684 176973083 62797441
157085258 239770524 58339742
2307232102 2567557999 108997201
1915168137 0 49710602
2235607507 3893355530 41973380
1865261243 1502045992 49906894
3905233037 3935328910 231121478
494821952 157393891 19579192
514401144 996459819 40584197
4136354515 3360623016 158612781
3503586692 2945469999 135760280
635469651 1463536193 38509799
2629301143 4166450388 128516908
2822662230 2119519033 49625923
3325983865 2098191120 4999752
3341070163 2338200212 137612273
3478682436 2505463700 24904256
96031125 1971548655 36328688
1986409857 1585186570 21467486
673979450 1037044016 125564107
1544889632 645200794 287562401
132359813 1946823210 24725445
water-to-light map:
3326310943 1150412752 87200223
4257088620 4233111242 37878676
3994159838 4060724644 54228568
3876001808 4114953212 90976210
2886658207 1485800780 134153427
3966978018 4205929422 27181820
4048388406 3874470488 149045901
528406865 502600485 237825862
111547576 1241598488 111964267
3068561383 1485461466 339314
3168255879 3056441319 158055064
3504257503 1453325844 32135622
2109734789 3372472386 240074722
3068900697 403245303 99355182
2027101388 740426347 82633401
1219093087 1970502974 808008301
3643122008 1951548756 18954218
2603944924 279757237 123488066
766232727 0 10960493
3712182589 4270989918 1531320
3536393125 2778511275 106728883
3482397575 1237612975 3985513
777193220 1763962961 71462615
1117452579 1680930659 83032302
3413511166 3214496383 46428427
2432743763 2885240158 171201161
0 3260924810 111547576
3486383088 1835425576 17874415
3672475952 3703073187 39706637
848655835 10960493 268796744
4197434307 4023516389 37208255
3459939593 823059748 22457982
2727432990 1853299991 98248765
4234642562 4272521238 22446058
3713713909 3672475952 30597235
2351588880 1353562755 81154883
223511843 845517730 304895022
3744311144 3742779824 131690664
1200484881 1434717638 18608206
3020811634 3612547108 47749749
2349809511 3660296857 1779369
2825681755 1619954207 60976452
light-to-temperature map:
252460180 3718023854 80580651
3778113118 1519654737 306188725
333040831 2573805517 96168275
4084301843 3798604505 210665453
1694244932 1825843462 379128459
1487313708 2669973792 206931224
429209106 2876905016 268167573
3133421217 3610326681 107697173
1486370741 3145072589 942967
697376679 3146015556 464311125
2152115592 836439718 249469053
3241118390 214400336 17576418
214400336 1164650972 38059844
2073373391 1085908771 78742201
1161687804 2248952614 324682937
3258694808 231976754 268511965
3527206773 1312729085 206925652
3133251251 2573635551 169966
2930227394 4091943439 203023857
2484258126 790765872 45673846
2639950241 500488719 290277153
2529931972 1202710816 110018269
2401584645 4009269958 82673481
3734132425 2204971921 43980693
temperature-to-humidity map:
168091833 268406932 76258451
3449803430 2843367435 19310453
2007621581 1615073306 528954706
1947960540 798304921 59661041
3469113883 3441273912 247683303
3980335429 3688957215 155495519
1382488646 1289756018 231480201
1613968847 2144028012 203484286
3030343754 2862677888 310561319
311459258 1257812898 31943120
3716797186 4024477040 263538243
743249314 734822904 63482017
2843367435 4288015283 6952013
244350284 201297958 67108974
806731331 549427536 185395368
33679712 344665383 134412121
1817453133 1521236219 93837087
2850319448 3844452734 180024306
1193424657 2347512298 189063989
992126699 0 201297958
3340905073 3173239207 108898357
343402378 857965962 399846936
0 479077504 33679712
4135830948 3282137564 159136348
1911290220 512757216 36670320
humidity-to-location map:
1586270647 2666237958 31388199
1639118951 2401662894 243114959
673413244 1218441073 9004417
4189219561 4197782169 97185127
339701505 993997384 224443689
2088925654 1227445490 16145987
3048450614 2034241441 196558736
3245009350 3057456069 37064056
1990947272 217743214 23964128
755791330 433456361 436687719
3750378482 1243591477 29460651
1347952933 3094520125 238317714
682417661 3593572644 73373669
1891967948 3494593320 98979324
2746577216 1325573050 27089148
90823161 3346797254 147796066
238619227 1933159163 101082278
2884769306 269775053 163681308
564145194 0 109268050
2014911400 1273052128 12916400
2773666364 1295702566 29870484
0 903174223 90823161
4286404688 3841991082 8562608
1617658846 2644777853 21460105
2714916854 3748178771 31660362
2275934358 3332837839 13959415
2027827800 870144080 33030143
3841991082 4158641967 39140202
3881131284 3850553690 308088277
3390548570 2697626157 359829912
1882233910 1285968528 9734038
2105071641 2230800177 170862717
1192479049 1777685279 155473884
2803536848 3666946313 81232458
2289893773 1352662198 425023081
2060857943 241707342 28067711
3282073406 109268050 108475164

View File

@ -1,93 +0,0 @@
use std::fs;
fn main() {
let input = fs::read_to_string("input.txt").unwrap();
let mut mappers: Vec<_> = input.split("\n\n")
.map(|maps| &maps[(maps.find(':').unwrap() + 1)..])
.map(|maps| maps.trim())
.map(|maps| {
maps.split('\n')
.map(|range| {
range.split(' ')
.map(|num| num.parse::<i64>().unwrap())
.collect::<Vec<_>>()
})
.collect::<Vec<_>>()
})
.collect();
let seeds = mappers.first().unwrap().first().unwrap().clone();
let mappers: &mut [Vec<Vec<i64>>] = mappers.get_mut(1..).unwrap();
for mapper in mappers.into_iter() {
for range in mapper {
range[2] = range[1] + range[2] - 1;
}
}
let mut cur_vals: Vec<_> = Vec::new();
for i in 0..seeds.len() / 2 {
let end = seeds[i * 2] + seeds[(i * 2) + 1];
let mut range: Vec<_> = (seeds[i * 2]..end).collect();
cur_vals.append(&mut range);
}
println!("{}", cur_vals.len());
for mapper in mappers {
for val in cur_vals.iter_mut() {
println!("{}", val);
for range in mapper.into_iter() {
if range[1] <= *val && *val <= range[2] {
let diff = *val - range[1];
*val = range[0] + diff;
break;
}
}
}
}
println!("{:?}", cur_vals.into_iter().min().unwrap())
}
// use std::fs;
// fn main() {
// let input = fs::read_to_string("input.txt").unwrap();
// let mut mappers: Vec<_> = input.split("\n\n")
// .map(|maps| &maps[(maps.find(':').unwrap() + 1)..])
// .map(|maps| maps.trim())
// .map(|maps| {
// maps.split('\n')
// .map(|range| {
// range.split(' ')
// .map(|num| num.parse::<i64>().unwrap())
// .collect::<Vec<_>>()
// })
// .collect::<Vec<_>>()
// })
// .collect();
// let seeds = mappers.first().unwrap().first().unwrap().clone();
// let mappers: &mut [Vec<Vec<i64>>] = mappers.get_mut(1..).unwrap();
// for mapper in mappers.into_iter() {
// for range in mapper {
// range[2] = range[1] + range[2] - 1;
// }
// }
// let mut cur_vals: Vec<_> = seeds;
// for mapper in mappers {
// for val in cur_vals.iter_mut() {
// for range in mapper.into_iter() {
// if range[1] <= *val && *val <= range[2] {
// let diff = *val - range[1];
// *val = range[0] + diff;
// break;
// }
// }
// }
// }
// println!("{:?}", cur_vals.into_iter().min().unwrap())
// }

7
day06/Cargo.lock generated
View File

@ -1,7 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "day6"
version = "0.1.0"

View File

@ -1,8 +0,0 @@
[package]
name = "day6"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

View File

@ -1,2 +0,0 @@
Time: 63 78 94 68
Distance: 411 1274 2047 1035

View File

@ -1,56 +0,0 @@
use std::fs;
fn main() {
let input = fs::read_to_string("input.txt").unwrap();
let input: Vec<_> = input.split('\n') // Separate the Time and Distance lines
.map(|line| {
line[line.find(':').unwrap() + 1..] // Drop "Time:" and "Distance:"
.split_whitespace() // Split the numbers into their own elements
.flat_map(|s| s.chars()).collect::<String>() // Combine the strings into a single one
.parse::<i64>().expect("Couldn't parse number") // Parse numbers into i32
}).collect(); // Collect into Vec
let time = input[0];
let dist = input[1];
let mut valid = 0;
for remaining_time in 0..time {
if (time - remaining_time) * remaining_time > dist {
valid += 1;
}
}
println!("{}", valid);
}
// use std::fs;
// fn main() {
// let input = fs::read_to_string("input.txt").unwrap();
// let input: Vec<_> = input.split('\n') // Separate the Time and Distance lines
// .map(|line| {
// line[line.find(':').unwrap() + 1..] // Drop "Time:" and "Distance:"
// .split_whitespace() // Split the numbers into their own elements.
// .map(|num| num.parse::<i32>().expect("Couldn't parse number")) // Parse numbers into i32
// .collect::<Vec<_>>()
// }).collect(); // collect into Vec
// let mut valid_total = 1;
// for round in 0..input.first().unwrap().len() {
// let time = input[0][round];
// let dist = input[1][round];
// let mut valid = 0;
// for remaining_time in 0..time {
// if (time - remaining_time) * remaining_time > dist {
// valid += 1;
// }
// }
// valid_total *= valid;
// }
// println!("{}", valid_total);
// }

7
day07/Cargo.lock generated
View File

@ -1,7 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "day07"
version = "0.1.0"

View File

@ -1,8 +0,0 @@
[package]
name = "day07"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

File diff suppressed because it is too large Load Diff

View File

@ -1,183 +0,0 @@
use std::{fs, collections::HashMap};
fn main() {
let input = fs::read_to_string("input.txt").unwrap();
let mut input: Vec<_> = input.split('\n')
.map(|line| line.split(' ').collect::<Vec<_>>())
.collect();
for line in 0..input.len() {
let hand = input[line][0];
if hand == "JJJJJ" {
input[line].push("7");
continue;
}
let mut card_freq: HashMap<char, i16> = HashMap::new();
let joker_count: i16 = hand.chars().filter(|c| c == &'J').count().try_into().unwrap();
for card in hand.chars().filter(|c| c != &'J') {
card_freq.entry(card)
.and_modify(|count| *count += 1)
.or_insert(1);
}
// The most helpful place for the jokers will always be with the max card count
let max = card_freq.clone().into_iter().max_by(|a, b| a.1.cmp(&b.1)).unwrap();
card_freq.entry(max.0)
.and_modify(|count| *count += joker_count);
let mut set_count: HashMap<i16, i16> = HashMap::new();
for i in 1..=5 {
let card_count = card_freq.values().filter(|x| **x == i).count().try_into().unwrap();
if card_count != 0 {
set_count.insert(i, card_count);
}
}
let power = match set_count {
x if x.contains_key(&5) => "7",
x if x.contains_key(&4) => "6",
x if x.contains_key(&3) && x.contains_key(&2) => "5",
x if x.contains_key(&3) => "4",
x if x.get(&2).unwrap_or(&0) >= &2 => "3",
x if x.get(&2).unwrap_or(&0) == &1 => "2",
HashMap { .. } => "1"
};
input[line].push(power);
}
input.sort_by(|lhs, rhs| {
let lhs_power: i32 = lhs[2].parse().unwrap();
let rhs_power: i32 = rhs[2].parse().unwrap();
if lhs_power != rhs_power {
return lhs_power.cmp(&rhs_power);
}
let lhs_hand: Vec<i32> = lhs[0].chars().map(card_value).collect();
let rhs_hand: Vec<i32> = rhs[0].chars().map(card_value).collect();
for i in 0..5 {
if lhs_hand[i] == rhs_hand[i] { continue; }
return lhs_hand[i].cmp(&rhs_hand[i]);
}
panic!("Should not be reachable");
});
let mut total_winnings = 0;
for i in 0..input.len() {
let bid: usize = input[i][1].parse().unwrap();
total_winnings += (i + 1) * bid;
}
println!("{}", total_winnings);
}
fn card_value(card: char) -> i32 {
match card {
'A' => 13,
'K' => 12,
'Q' => 11,
'T' => 10,
'9' => 9,
'8' => 8,
'7' => 7,
'6' => 6,
'5' => 5,
'4' => 4,
'3' => 3,
'2' => 2,
'J' => 1,
_ => panic!("invalid card")
}
}
// use std::{fs, collections::HashMap};
// fn main() {
// let input = fs::read_to_string("input.txt").unwrap();
// let mut input: Vec<_> = input.split('\n')
// .map(|line| line.split(' ').collect::<Vec<_>>())
// .collect();
// for line in 0..input.len() {
// let hand = input[line][0];
// let mut card_freq: HashMap<char, i16> = HashMap::new();
// for card in hand.chars() {
// card_freq.entry(card)
// .and_modify(|count| *count += 1)
// .or_insert(1);
// }
// let mut set_count: HashMap<i16, i16> = HashMap::new();
// for i in 1..=5 {
// let card_count = card_freq.values().filter(|x| **x == i).count().try_into().unwrap();
// if card_count != 0 {
// set_count.insert(i, card_count);
// }
// }
// let power = match set_count {
// x if x.contains_key(&5) => "7",
// x if x.contains_key(&4) => "6",
// x if x.contains_key(&3) && x.contains_key(&2) => "5",
// x if x.contains_key(&3) => "4",
// x if x.get(&2).unwrap_or(&0) >= &2 => "3",
// x if x.get(&2).unwrap_or(&0) == &1 => "2",
// HashMap { .. } => "1"
// };
// input[line].push(power);
// }
// input.sort_by(|lhs, rhs| {
// let lhs_power: i32 = lhs[2].parse().unwrap();
// let rhs_power: i32 = rhs[2].parse().unwrap();
// if lhs_power != rhs_power {
// return lhs_power.cmp(&rhs_power);
// }
// let lhs_hand: Vec<i32> = lhs[0].chars().map(card_value).collect();
// let rhs_hand: Vec<i32> = rhs[0].chars().map(card_value).collect();
// for i in 0..5 {
// if lhs_hand[i] == rhs_hand[i] { continue; }
// return lhs_hand[i].cmp(&rhs_hand[i]);
// }
// panic!("Should not be reachable");
// });
// let mut total_winnings = 0;
// for i in 0..input.len() {
// let bid: usize = input[i][1].parse().unwrap();
// total_winnings += (i + 1) * bid;
// }
// println!("{}", total_winnings);
// }
// fn card_value(card: char) -> i32 {
// match card {
// 'A' => 13,
// 'K' => 12,
// 'Q' => 11,
// 'J' => 10,
// 'T' => 9,
// '9' => 8,
// '8' => 7,
// '7' => 6,
// '6' => 5,
// '5' => 4,
// '4' => 3,
// '3' => 2,
// '2' => 1,
// _ => panic!("invalid card")
// }
// }

7
day08/Cargo.lock generated
View File

@ -1,7 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "day08"
version = "0.1.0"

View File

@ -1,8 +0,0 @@
[package]
name = "day08"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

View File

@ -1,776 +0,0 @@
LRLRRRLRLLRRLRLRRRLRLRRLRRLLRLRRLRRLRRRLRRRLRLRRRLRLRRLRRLLRLRLLLLLRLRLRRLLRRRLLLRLLLRRLLLLLRLLLRLRRLRRLRRRLRRRLRRLRRLRRRLRLRLRRLRLRLRLRRLRRRLLRLLRRLRLRRRLRLRRRLRLRRRLRRRLRRLRLLLLRLRRRLRLRRLRLRRLRRLRRLLRRRLLLLLLRLRRRLRRLLRRRLRRLLLRLRLRLRRRLRRLRLRRRLRRLRRRLLRRLRRLLLRRRR
QSF = (JQX, GGN)
VBT = (XTD, KGR)
SMK = (SNK, LBX)
LSJ = (JMQ, TJJ)
QFG = (XLT, TVF)
BTF = (SLQ, DJX)
XDF = (JKG, XFH)
PFR = (JGJ, SPB)
QVS = (PXH, PXH)
HVA = (NMF, CTG)
FRS = (GSX, JQK)
GJX = (BRV, LVQ)
NDD = (XMG, PTS)
RDJ = (GHT, TPR)
PJG = (KMR, GCV)
SQM = (KFD, VPC)
DTN = (NCL, HHT)
TRX = (NGH, BBT)
DVR = (JGL, VBL)
FSH = (HVL, XXL)
NSK = (NCX, QHD)
HKC = (XNV, MHL)
QRV = (QNS, FQH)
BVQ = (KHF, VLM)
DXS = (TNK, PVV)
SNL = (DMG, NFH)
DTM = (XMF, BTF)
QHD = (CXS, KXX)
STP = (QNH, FGM)
CMJ = (KCD, LGF)
SDM = (XXT, GKQ)
MXN = (KKH, DXG)
DCS = (HND, MBD)
BKV = (VBT, TNH)
JNS = (QSF, PRS)
BDB = (JXM, NMH)
KQC = (PQS, BJV)
CVC = (JNS, NDN)
FSJ = (RPS, SDM)
LHG = (VMQ, LBF)
KKN = (LPC, MJQ)
CXL = (VKM, QPC)
LNL = (GRQ, DXM)
DFV = (SDM, RPS)
JHQ = (VNF, GBS)
XXT = (BSF, QJX)
NRL = (BJV, PQS)
PVD = (GFK, NVN)
DXM = (LQX, KTN)
JGL = (HSC, CTT)
LLH = (NCV, NKL)
KLN = (HQM, JPV)
TTG = (GJX, QRT)
BFB = (LXC, HNR)
QBX = (CLB, XLR)
DBV = (SSL, CXV)
MBB = (THC, LDK)
JVJ = (VHF, CNL)
GJB = (NGH, BBT)
CNT = (CTS, SKH)
KBX = (LNS, BTN)
VJF = (PXQ, QMF)
CVH = (BGQ, XBL)
TKD = (MFV, PPF)
XLG = (XJK, XBH)
XRK = (RLQ, PDX)
TCS = (SCM, KCB)
DLD = (VPV, BKD)
RNK = (TMJ, MVH)
JJG = (TBT, HGC)
MRV = (KQL, XDB)
JFN = (BTS, DCB)
TMR = (KRR, DKC)
XXL = (VMC, FNR)
LSB = (QRB, TFM)
SRH = (FXT, JQN)
FDS = (LMM, PRM)
QVB = (DQX, LDD)
NSQ = (CMP, MBB)
JMC = (JQK, GSX)
VXF = (BKV, KTH)
NJF = (MFV, PPF)
KMG = (KXD, GNB)
VPV = (VDP, GRG)
HSC = (RBP, TBQ)
RSR = (DLD, MBC)
JGF = (TDM, LSB)
KGP = (CHX, XDR)
DHQ = (BXX, FKB)
VDP = (HCX, RGB)
XLX = (NQX, CLR)
VPB = (LNJ, KDH)
TML = (HMS, NHC)
KLT = (MDQ, NFK)
SHV = (GDL, MKV)
VVX = (DGT, QPK)
VMC = (FRQ, BVH)
MPN = (XHB, DXS)
QGF = (STF, XSH)
HBM = (JDQ, RKC)
RRR = (LLD, HPK)
LVG = (SDF, QVT)
PMR = (BHP, VVQ)
LNP = (MCN, HXT)
XBX = (HRJ, CNH)
LBL = (RKV, FVM)
KFP = (NLX, HCG)
KBM = (QQV, FKL)
HVL = (VMC, FNR)
FKL = (FLX, GHH)
LCB = (SGN, CDX)
RKC = (MQR, DPM)
HLV = (GBS, VNF)
RXD = (SJJ, CXL)
HFK = (QRT, GJX)
GRV = (CRT, BNZ)
LJB = (LCN, CKX)
RMQ = (RBV, RBK)
BGQ = (LSJ, LLK)
HDH = (XFK, LQV)
KXS = (DBV, FVV)
JDQ = (MQR, DPM)
QXP = (FQH, QNS)
MJD = (TDM, LSB)
PKC = (DPN, DQL)
DLJ = (NCK, SSN)
TTK = (VVK, GHD)
MDF = (CDP, NJL)
FQH = (QJT, FGK)
JGJ = (FDS, DFL)
SKH = (FTN, HBT)
PGP = (TLX, QMX)
NDN = (QSF, PRS)
RBK = (HBM, JGV)
FTM = (PBK, TJQ)
DLG = (DPN, DQL)
SDF = (JGF, MJD)
SBV = (MLH, LNL)
MLH = (DXM, GRQ)
NKN = (MVS, NRR)
MLX = (VLK, KTD)
HDJ = (LVG, TKC)
SDP = (CFH, FBJ)
QQV = (FLX, FLX)
KBF = (HBP, PVD)
XJS = (MSK, TTK)
JFC = (LLH, XMJ)
HBT = (TSF, DJJ)
SRS = (JCT, CLN)
KGR = (LJB, BXQ)
TMP = (PVG, PVG)
PXC = (DTM, MXH)
KMJ = (TXV, FJT)
VRP = (BSV, RBF)
VLK = (PMR, MQQ)
GJG = (CLC, JVM)
CPF = (NNP, DCS)
CMP = (LDK, THC)
PTB = (XTL, DVH)
PVG = (DKP, DKP)
KCB = (VGS, NSQ)
THC = (TNN, TLG)
RBV = (HBM, JGV)
NRX = (CSF, DLK)
XTD = (BXQ, LJB)
TXV = (JPT, BFB)
CKB = (FGM, QNH)
VVR = (SJG, KXS)
HMS = (FRG, NNM)
DXG = (KGB, LSV)
XKB = (KHF, VLM)
GKG = (DXS, XHB)
GSC = (XNT, SBV)
RGN = (DBF, RFT)
LXR = (XBX, LGT)
SCM = (VGS, NSQ)
PXM = (TMP, LBG)
BXX = (DVR, MQV)
SJH = (TKD, NJF)
JPT = (HNR, LXC)
XHC = (NRL, KQC)
LQX = (NDT, MNM)
HHT = (TPT, TKK)
KFD = (SFF, RCP)
GSK = (GFB, DLJ)
DVN = (HCG, NLX)
SXF = (CSD, TQJ)
KRR = (TGF, DMC)
QRB = (JHQ, HLV)
LBA = (TBT, HGC)
SBN = (FMH, SNL)
BBK = (CTS, SKH)
HQM = (GXM, KJV)
HVN = (FSJ, DFV)
GXM = (TTG, HFK)
MVS = (BGS, DHQ)
RDS = (VXP, SRS)
MFX = (XQX, FSH)
KQL = (VQM, BFP)
CHF = (RFD, BBQ)
VFS = (TCM, HXD)
CSD = (CMJ, PRT)
GQF = (KTD, VLK)
CXV = (KRD, RRR)
LMF = (LQL, QLJ)
JJC = (SRH, HQG)
HGS = (JBR, TBH)
SHJ = (HBP, PVD)
PKM = (FVM, RKV)
CMV = (NMF, CTG)
JKS = (KJC, LLN)
XLR = (PLQ, DLN)
CTG = (BJM, BHH)
HJB = (TTK, MSK)
QJT = (NCC, SFB)
BFP = (JSG, KJJ)
CHX = (VGP, SRT)
HCX = (DMB, FPG)
LTN = (GBK, XMH)
KTH = (TNH, VBT)
JBC = (LBX, SNK)
MDL = (NTS, KFJ)
JPQ = (NJF, TKD)
GHM = (SSD, XTX)
CLR = (RMT, TLR)
GNT = (NFK, MDQ)
QNV = (RDS, XGC)
NVN = (TJG, TCS)
TPR = (TQT, GRJ)
GTQ = (BLJ, DGL)
LMM = (NXN, RXH)
CTB = (LRS, NDD)
MCN = (KCJ, NVD)
JGV = (RKC, JDQ)
NRR = (BGS, DHQ)
DJQ = (SXF, CQG)
MNC = (CHX, XDR)
MFV = (JNK, JBJ)
JBJ = (KLQ, SQM)
DCB = (PXX, RJR)
FXA = (MQX, NDF)
FVJ = (DLK, CSF)
PXH = (JJG, JJG)
CBT = (HQP, NDS)
NKC = (BLJ, DGL)
TFM = (JHQ, HLV)
LSF = (LRS, NDD)
XNV = (GDJ, KBX)
TXQ = (MHQ, VXT)
PNV = (VDD, FKH)
MSK = (VVK, GHD)
SRL = (GNS, BKJ)
XXC = (CKR, DCJ)
FBJ = (LFK, TJR)
FRL = (KMJ, NMT)
JQN = (BRL, NMG)
RVQ = (TML, KNH)
CMQ = (FMH, SNL)
NDF = (PPK, VPB)
HRJ = (TVL, CPX)
XTR = (HPT, JFM)
XNT = (MLH, LNL)
LBG = (PVG, MNS)
QRF = (XCG, XCG)
NXN = (LNP, QGG)
SLQ = (GSK, NDG)
TNN = (DPL, CKF)
PQS = (JBC, SMK)
TJR = (KMG, KHR)
CGL = (LXR, XRG)
GGN = (TDT, RXD)
PQP = (NKN, KNK)
KRJ = (CTB, LSF)
FGK = (NCC, SFB)
RCP = (GKG, MPN)
HTP = (LBF, VMQ)
VMQ = (HBQ, JBB)
NDM = (CMV, NMZ)
PJF = (QMF, PXQ)
CFX = (JGJ, SPB)
TLF = (TKC, LVG)
HVK = (PXH, QFQ)
CHB = (JPQ, SJH)
MVH = (HBC, DJQ)
FPG = (TBJ, RVQ)
JCT = (FKM, MRV)
DLK = (NSK, SFN)
GRQ = (KTN, LQX)
PRQ = (RDJ, CGP)
LBJ = (CMV, CMV)
RJR = (SXG, QNK)
RBP = (JMP, TMR)
RNV = (QKN, KRJ)
SJJ = (QPC, VKM)
GDJ = (BTN, LNS)
XHJ = (CVH, FSG)
GKQ = (BSF, QJX)
SSD = (CKB, STP)
KPT = (FHX, DTN)
TKC = (QVT, SDF)
SFN = (QHD, NCX)
JQX = (RXD, TDT)
SSC = (BKB, VQQ)
TBH = (PFR, CFX)
SRT = (GLQ, CPF)
MDQ = (HDJ, TLF)
RFT = (QXP, QRV)
QHG = (LDD, DQX)
SFF = (GKG, MPN)
RDQ = (DQQ, XLM)
QDS = (KTH, BKV)
JHC = (DFV, FSJ)
TGF = (FTM, XSD)
XDB = (VQM, BFP)
SGD = (KJC, LLN)
TDM = (QRB, TFM)
CFH = (TJR, LFK)
VDD = (FRR, CBT)
PTS = (PTB, LVB)
RLX = (GDL, MKV)
SFB = (HJM, SRD)
CGP = (TPR, GHT)
GBL = (TMP, LBG)
JSG = (QVS, QVS)
LSM = (TMJ, MVH)
BKD = (GRG, VDP)
NJL = (RSR, TNZ)
PSS = (STF, XSH)
PLQ = (NRX, FVJ)
CPX = (PSK, XRK)
JLK = (GSC, CKL)
BHH = (DRV, HQH)
GBK = (FDD, FDD)
KFJ = (HFG, BCR)
KMV = (NRL, KQC)
TNK = (RDQ, DKS)
HCG = (CXN, JLR)
LVQ = (MFX, CPJ)
RGX = (CHT, TTX)
TVF = (VKL, CLT)
FVT = (JMC, FRS)
SMT = (KVV, NFL)
DMG = (PSV, HGD)
MDS = (KDR, JMT)
DFK = (TXQ, HTM)
HBC = (SXF, CQG)
NFK = (TLF, HDJ)
BNZ = (HHG, MLN)
HGD = (CHB, MHT)
QNK = (VFS, BVV)
KNH = (HMS, NHC)
RMT = (XKB, BVQ)
KKH = (LSV, KGB)
MXH = (XMF, BTF)
HHG = (NKC, GTQ)
XFH = (DFK, CPS)
FDD = (CRT, CRT)
GBS = (FHF, HDB)
PRS = (GGN, JQX)
GXR = (KXS, SJG)
XSH = (KSB, RKF)
KTD = (MQQ, PMR)
FRR = (HQP, NDS)
VQQ = (FKQ, TRM)
HBP = (NVN, GFK)
FCH = (PVP, QFG)
DFF = (BKJ, GNS)
FKM = (KQL, XDB)
PXQ = (BQV, DMV)
GHA = (DLD, MBC)
RLQ = (GJG, FGQ)
PVP = (TVF, XLT)
RBF = (XCX, MDS)
BGS = (BXX, FKB)
CHT = (JCG, XTR)
MNK = (BKB, VQQ)
NNM = (MXN, QTC)
LVB = (DVH, XTL)
CKR = (TGL, SFJ)
FXT = (NMG, BRL)
PCP = (RQK, KNF)
HFB = (XHP, LTN)
TJQ = (NTM, PXC)
CXH = (PQP, GRL)
LDK = (TLG, TNN)
GSX = (KBM, RCT)
ZZZ = (XLR, CLB)
GND = (NPS, JVJ)
DQQ = (KPT, FVC)
JVM = (KMV, XHC)
KVV = (HQQ, RNV)
XHP = (GBK, GBK)
HGF = (XCG, CJF)
VKL = (XLX, DPD)
SPB = (FDS, DFL)
VHF = (NLM, LGX)
TDT = (SJJ, CXL)
JQK = (KBM, RCT)
QKN = (CTB, LSF)
NTM = (DTM, MXH)
PPF = (JNK, JBJ)
QMF = (DMV, BQV)
LSV = (QBL, VVX)
NMT = (TXV, FJT)
NHC = (NNM, FRG)
GNB = (GQF, MLX)
GHD = (DFF, SRL)
TRM = (LGL, RGX)
FJC = (DCJ, CKR)
DRV = (HDR, PJG)
MHL = (GDJ, KBX)
HRF = (XHP, LTN)
LNS = (KBF, SHJ)
JGX = (FSG, CVH)
TVL = (PSK, XRK)
DQX = (BBK, CNT)
VLM = (TRX, GJB)
BVH = (QFP, JFN)
JPV = (GXM, KJV)
HPB = (XBH, XJK)
RQK = (JKS, SGD)
JBB = (FCH, NJB)
KJC = (CXH, QFN)
NFL = (HQQ, RNV)
NVL = (NPS, JVJ)
XHB = (PVV, TNK)
QRT = (LVQ, BRV)
KNF = (JKS, SGD)
PRN = (NTS, KFJ)
BVV = (HXD, TCM)
HXM = (VJF, PJF)
BTS = (RJR, PXX)
TJG = (KCB, SCM)
LXC = (RGD, QCR)
HJM = (KLM, KKN)
JCG = (HPT, JFM)
LBX = (GTV, CHF)
NPQ = (CSP, KHM)
NLM = (HPQ, VRP)
MQV = (JGL, VBL)
DJJ = (HGS, LJJ)
JLR = (SDP, GJC)
LDD = (CNT, BBK)
RGD = (HMN, CVC)
HNR = (RGD, QCR)
CKX = (DLG, PKC)
TLG = (DPL, CKF)
BKB = (FKQ, TRM)
TNZ = (MBC, DLD)
CLC = (KMV, XHC)
BQS = (KHH, RBR)
KHH = (QTR, PNV)
NCX = (CXS, KXX)
SDK = (RBK, RBV)
QTR = (VDD, FKH)
VPC = (SFF, RCP)
SRD = (KLM, KKN)
BDJ = (CDX, SGN)
LRS = (PTS, XMG)
RJP = (GSC, CKL)
SJT = (JMC, FRS)
JXM = (BPQ, QNV)
XMH = (FDD, GRV)
BBT = (DDV, SCH)
FJT = (JPT, BFB)
NLX = (JLR, CXN)
PPH = (XDF, VLV)
BHP = (CMQ, SBN)
PBK = (NTM, PXC)
CRT = (MLN, HHG)
HQG = (FXT, JQN)
LBF = (JBB, HBQ)
HDB = (HLT, RCX)
NNP = (HND, MBD)
PSA = (MLN, HHG)
CSF = (SFN, NSK)
CJF = (MHV, GNZ)
BQV = (QRQ, GHV)
JPJ = (QRF, HGF)
VQM = (JSG, KJJ)
SFS = (QRF, QRF)
DCN = (KVV, NFL)
SGN = (BQS, CKP)
FLX = (LBJ, LBJ)
BJV = (SMK, JBC)
NQX = (TLR, RMT)
CTT = (TBQ, RBP)
BCR = (GXR, VVR)
HQH = (PJG, HDR)
VJP = (SRH, HQG)
LGT = (HRJ, CNH)
LLD = (BDB, XDT)
QMX = (HKC, MCP)
HBH = (XVX, TBP)
XMF = (SLQ, DJX)
TPT = (NRN, TSK)
CKF = (XJS, HJB)
QTC = (DXG, KKH)
KDR = (CXR, PRQ)
RCX = (CGL, GFM)
KCD = (QDS, VXF)
LNJ = (QGF, PSS)
KNK = (NRR, MVS)
FKQ = (RGX, LGL)
VXG = (QMX, TLX)
JMQ = (BLT, PRD)
RCT = (QQV, FKL)
SNK = (GTV, CHF)
FMH = (NFH, DMG)
TJJ = (BLT, PRD)
LGF = (VXF, QDS)
XCG = (MHV, MHV)
MNS = (DKP, MSD)
CXN = (SDP, GJC)
QCR = (CVC, HMN)
VBL = (HSC, CTT)
GCV = (NVL, GND)
DFL = (LMM, PRM)
CQG = (CSD, TQJ)
NCV = (CLJ, PPH)
GTV = (RFD, BBQ)
NCK = (JGX, XHJ)
XLT = (CLT, VKL)
KCJ = (JJS, JJS)
LLN = (QFN, CXH)
TQJ = (PRT, CMJ)
VTT = (KHM, CSP)
SJZ = (HGC, TBT)
NCL = (TPT, TKK)
CNL = (NLM, LGX)
FKH = (CBT, FRR)
GRG = (RGB, HCX)
FSG = (BGQ, XBL)
HXT = (KCJ, NVD)
DLN = (FVJ, NRX)
MQR = (VJP, JJC)
HCS = (KMJ, NMT)
LQV = (QHG, QVB)
KLM = (LPC, MJQ)
CGD = (DBF, RFT)
SKX = (XVX, TBP)
SSN = (XHJ, JGX)
SXG = (BVV, VFS)
MCP = (XNV, MHL)
DPD = (NQX, CLR)
JMP = (KRR, DKC)
QRQ = (RGN, CGD)
VGP = (GLQ, CPF)
CLT = (DPD, XLX)
TNH = (XTD, KGR)
DGL = (RLX, SHV)
VVK = (DFF, SRL)
HTM = (MHQ, VXT)
GHH = (LBJ, NDM)
GRJ = (KGP, MNC)
QVT = (MJD, JGF)
QNS = (FGK, QJT)
NMG = (PKM, LBL)
FVV = (SSL, CXV)
HXK = (RQK, KNF)
GNZ = (NDF, MQX)
KSB = (QXN, SCD)
RFD = (JHC, HVN)
CXR = (RDJ, CGP)
KML = (QLJ, LQL)
DCJ = (TGL, SFJ)
VGN = (LQV, XFK)
DGT = (HXK, PCP)
KDH = (PSS, QGF)
TKK = (NRN, TSK)
DQL = (HCS, FRL)
VNF = (FHF, HDB)
TBT = (FJC, XXC)
FTN = (DJJ, TSF)
FGQ = (CLC, JVM)
FVC = (DTN, FHX)
QJX = (PXM, GBL)
CLN = (MRV, FKM)
NTS = (BCR, HFG)
JFM = (SSX, KLN)
BRV = (MFX, CPJ)
CTS = (FTN, HBT)
JKG = (DFK, CPS)
KGB = (VVX, QBL)
DPN = (HCS, FRL)
LCN = (DLG, PKC)
MLN = (GTQ, NKC)
KHM = (HXM, LBN)
TCM = (RKN, GHM)
NMZ = (CTG, NMF)
RXH = (LNP, QGG)
NDT = (PRN, MDL)
QFP = (BTS, DCB)
KJV = (HFK, TTG)
RKN = (SSD, XTX)
QNH = (DCN, SMT)
KMR = (NVL, GND)
PSV = (CHB, MHT)
GHV = (RGN, CGD)
HND = (LSM, RNK)
NCC = (HJM, SRD)
BTN = (KBF, SHJ)
XGC = (VXP, SRS)
DDV = (PRX, VXJ)
CLJ = (VLV, XDF)
SSX = (HQM, JPV)
NMF = (BJM, BHH)
DBF = (QRV, QXP)
DKS = (DQQ, XLM)
FHX = (HHT, NCL)
CKL = (SBV, XNT)
DPL = (XJS, HJB)
TTX = (XTR, JCG)
NJB = (QFG, PVP)
XBH = (DVN, KFP)
DKC = (DMC, TGF)
SSL = (RRR, KRD)
FVM = (HTP, LHG)
MNM = (MDL, PRN)
NFH = (HGD, PSV)
MQQ = (VVQ, BHP)
VXJ = (RJP, JLK)
GFM = (LXR, XRG)
HBQ = (FCH, NJB)
XFK = (QHG, QVB)
JBR = (CFX, PFR)
RHN = (SDK, RMQ)
HPT = (SSX, KLN)
GDL = (MNK, SSC)
DJX = (GSK, NDG)
LQL = (VTT, NPQ)
SFJ = (RHN, GDT)
BLT = (VGN, HDH)
DVH = (HFB, HRF)
VLV = (XFH, JKG)
BSV = (MDS, XCX)
BBQ = (JHC, HVN)
JMT = (PRQ, CXR)
HPK = (XDT, BDB)
CPJ = (FSH, XQX)
QFQ = (JJG, SJZ)
TSK = (SKX, HBH)
HFG = (VVR, GXR)
PRX = (JLK, RJP)
MKV = (SSC, MNK)
XTL = (HFB, HRF)
KHR = (KXD, GNB)
SJG = (DBV, FVV)
TLR = (BVQ, XKB)
CNH = (CPX, TVL)
LGX = (VRP, HPQ)
QGG = (MCN, HXT)
BXQ = (CKX, LCN)
PPK = (LNJ, KDH)
XVX = (JFC, PBJ)
NKL = (CLJ, PPH)
XLM = (KPT, FVC)
XDT = (NMH, JXM)
PRM = (RXH, NXN)
XBL = (LLK, LSJ)
BLJ = (SHV, RLX)
RPS = (GKQ, XXT)
NMH = (QNV, BPQ)
MHT = (SJH, JPQ)
TBQ = (JMP, TMR)
CDX = (BQS, CKP)
HDR = (KMR, GCV)
CKP = (RBR, KHH)
TBJ = (TML, KNH)
XRG = (LGT, XBX)
NDS = (GNT, KLT)
KLQ = (VPC, KFD)
GHT = (TQT, GRJ)
MBD = (RNK, LSM)
XSD = (PBK, TJQ)
PVV = (DKS, RDQ)
KRD = (LLD, HPK)
VKM = (SJT, FVT)
FNR = (FRQ, BVH)
HMN = (NDN, JNS)
NGH = (SCH, DDV)
PRD = (VGN, HDH)
BKJ = (HPB, XLG)
GDT = (RMQ, SDK)
FGM = (SMT, DCN)
MHQ = (SFS, JPJ)
VXT = (SFS, JPJ)
CXS = (LMF, KML)
DMV = (QRQ, GHV)
AAA = (CLB, XLR)
QPC = (SJT, FVT)
PRT = (LGF, KCD)
PSK = (RLQ, PDX)
LJJ = (JBR, TBH)
LBN = (VJF, PJF)
QFN = (GRL, PQP)
SCD = (VXG, PGP)
GJC = (CFH, FBJ)
MQX = (VPB, PPK)
QLJ = (VTT, NPQ)
RKF = (QXN, SCD)
PBJ = (LLH, XMJ)
SCH = (PRX, VXJ)
VVQ = (CMQ, SBN)
KTN = (MNM, NDT)
FRG = (QTC, MXN)
XCX = (JMT, KDR)
CDP = (RSR, RSR)
XMG = (PTB, LVB)
PXX = (SXG, QNK)
MBC = (BKD, VPV)
PDX = (GJG, FGQ)
DPM = (JJC, VJP)
BPQ = (RDS, XGC)
XJK = (KFP, DVN)
NVD = (JJS, MDF)
GLQ = (DCS, NNP)
MHV = (MQX, NDF)
CPS = (TXQ, HTM)
BRL = (LBL, PKM)
VGS = (MBB, CMP)
HQQ = (KRJ, QKN)
LGL = (CHT, TTX)
KJJ = (QVS, HVK)
KXD = (MLX, GQF)
KHF = (TRX, GJB)
GFB = (NCK, SSN)
BSF = (PXM, GBL)
TMJ = (DJQ, HBC)
MSD = (QBX, ZZZ)
TGL = (GDT, RHN)
XQX = (XXL, HVL)
NPS = (VHF, CNL)
LFK = (KMG, KHR)
LPC = (BDJ, LCB)
CLB = (DLN, PLQ)
QBL = (DGT, QPK)
GRL = (NKN, KNK)
MJQ = (LCB, BDJ)
HQP = (KLT, GNT)
NRN = (HBH, SKX)
JNK = (KLQ, SQM)
JJS = (CDP, CDP)
TBP = (PBJ, JFC)
TSF = (HGS, LJJ)
STF = (RKF, KSB)
NDG = (GFB, DLJ)
DMC = (FTM, XSD)
GFK = (TJG, TCS)
GNS = (XLG, HPB)
FHF = (HLT, RCX)
FRQ = (JFN, QFP)
BJM = (HQH, DRV)
RKV = (LHG, HTP)
HGC = (XXC, FJC)
XTX = (STP, CKB)
FKB = (DVR, MQV)
XDR = (SRT, VGP)
RGB = (FPG, DMB)
VXP = (CLN, JCT)
TQT = (MNC, KGP)
LLK = (TJJ, JMQ)
DKP = (QBX, QBX)
XMJ = (NCV, NKL)
HXD = (GHM, RKN)
QXN = (VXG, PGP)
CSP = (LBN, HXM)
HPQ = (RBF, BSV)
DMB = (TBJ, RVQ)
QPK = (PCP, HXK)
KXX = (LMF, KML)
TLX = (MCP, HKC)
RBR = (PNV, QTR)
HLT = (GFM, CGL)

View File

@ -1,122 +0,0 @@
use std::{fs, collections::{HashMap, VecDeque}};
fn main() {
let input = fs::read_to_string("input.txt").unwrap();
let input: Vec<_> = input.split("\n\n").collect();
let (directions, nodes) = (input[0], input[1]);
let directions: Vec<_> = directions.chars().map(|char| {
match char {
'L' => Direction::Left,
'R' => Direction::Right,
_ => panic!("Invalid direction!")
}
}).collect();
let nodes: HashMap<&str, (&str, &str)> = nodes.split('\n')
.map(|line| {
let line = line.split('=').map(|x| x.trim()).collect::<Vec<_>>();
let children: Vec<_> = line[1].trim_matches(|c| c == '(' || c == ')').split(", ").collect();
(line[0], (children[0], children[1]))
}).collect();
let starts: Vec<_> = nodes.keys().filter(|x| x.ends_with('A')).collect();
let dists: Vec<_> = starts.iter().map(|start| dist(&start, &directions, &nodes)).collect();
let gcf = gcf(&dists);
let step_count = gcf * dists.iter().map(|value| value / gcf).product::<i64>();
println!("{:?}", step_count);
}
fn gcf(values: &Vec<i64>) -> i64 {
let mut gcf = values[0];
for val in values {
gcf = find_gcf(gcf, *val);
if gcf == 1 {
return 1;
}
}
gcf
}
fn find_gcf(a: i64, b: i64) -> i64 {
if a == 0 {
return b;
}
find_gcf(b % a, a)
}
fn dist(cur_node: &str, directions: &Vec<Direction>, nodes: &HashMap<&str, (&str, &str)>) -> i64 {
let mut cur_node = cur_node;
let mut step_queue: VecDeque<Direction> = VecDeque::from(directions.clone());
let mut step_count = 0;
while !cur_node.ends_with('Z') {
step_count += 1;
let cur_step = step_queue.pop_front().unwrap();
match cur_step {
Direction::Left => cur_node = nodes[cur_node].0,
Direction::Right => cur_node = nodes[cur_node].1,
}
step_queue.push_back(cur_step);
}
return step_count;
}
#[derive(Clone)]
#[derive(Debug)]
enum Direction {
Left,
Right
}
// use std::{fs, collections::{HashMap, VecDeque}};
// fn main() {
// let input = fs::read_to_string("input.txt").unwrap();
// let input: Vec<_> = input.split("\n\n").collect();
// let (directions, nodes) = (input[0], input[1]);
// let directions: Vec<_> = directions.chars().map(|char| {
// match char {
// 'L' => Direction::Left,
// 'R' => Direction::Right,
// _ => panic!("Invalid direction!")
// }
// }).collect();
// let nodes: HashMap<&str, (&str, &str)> = nodes.split('\n')
// .map(|line| {
// let line = line.split('=').map(|x| x.trim()).collect::<Vec<_>>();
// let children: Vec<_> = line[1].trim_matches(|c| c == '(' || c == ')').split(", ").collect();
// (line[0], (children[0], children[1]))
// }).collect();
// let mut cur_node = "AAA";
// let mut step_queue = VecDeque::from(directions);
// let mut step_count = 0;
// while cur_node != "ZZZ" {
// step_count += 1;
// let cur_step = step_queue.pop_front().unwrap();
// match cur_step {
// Direction::Left => cur_node = nodes[cur_node].0,
// Direction::Right => cur_node = nodes[cur_node].1,
// }
// step_queue.push_back(cur_step);
// }
// println!("{:?}", step_count);
// }
// #[derive(Debug)]
// enum Direction {
// Left,
// Right
// }

7
day09/Cargo.lock generated
View File

@ -1,7 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "day09"
version = "0.1.0"

View File

@ -1,8 +0,0 @@
[package]
name = "day09"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

View File

@ -1,200 +0,0 @@
10 13 27 64 140 281 549 1101 2294 4858 10201 21027 42709 86382 175728 361360 750462 1566611 3268603 6783010 13951998
19 34 52 73 97 124 154 187 223 262 304 349 397 448 502 559 619 682 748 817 889
17 26 44 90 198 421 827 1483 2426 3639 5103 7110 11251 22954 57394 152565 397364 990709 2363587 5425543 12050149
23 34 55 94 159 267 456 809 1511 2974 6087 12696 26528 54998 112755 228528 457939 906582 1769955 3399902 6411185
13 27 44 66 106 212 497 1166 2538 5079 9491 16942 29573 51480 90442 160750 287587 513515 907742 1578970 2692764
1 8 28 76 172 354 716 1490 3198 6915 14720 30485 61283 119915 229408 430889 797095 1455082 2623652 4673906 8225526
-3 5 16 26 37 58 110 243 573 1347 3044 6520 13205 25360 46402 81305 137085 223377 353112 543302 815941
20 44 95 198 403 806 1585 3064 5819 10840 19770 35271 61655 106168 181980 315548 564578 1060004 2098881 4338784 9183751
11 17 29 64 153 350 754 1553 3099 6023 11399 20966 37417 64764 108788 177583 282203 437421 662609 982748 1429577
15 23 43 95 224 524 1173 2494 5085 10107 19900 39256 78000 156163 314217 632971 1271436 2537313 5015496 9797973 18888265
-3 -6 -10 -3 44 181 485 1069 2097 3823 6706 11715 21054 39774 79253 164654 350909 756900 1637990 3538025 7603072
15 24 39 60 85 117 188 413 1095 2925 7376 17500 39539 86134 182650 379673 778035 1579706 3192165 6441832 13004669
6 18 40 82 177 389 822 1635 3067 5473 9380 15629 25852 43976 80372 162060 355758 816973 1890831 4315400 9629275
0 -9 -23 -29 0 101 310 655 1177 2023 3701 7704 17986 44363 110077 267928 633224 1448352 3204545 6863560 14248490
12 38 85 159 263 397 558 740 934 1128 1307 1453 1545 1559 1468 1242 848 250 -591 -1717 -3173
11 23 53 116 248 519 1041 1963 3448 5650 8761 13288 20862 36099 70366 148812 322789 690925 1433769 2869296 5539872
8 26 56 112 230 481 987 1939 3625 6508 11475 20557 38782 78504 168755 374185 831386 1815370 3856374 7937866 15821706
13 10 11 17 25 35 61 149 409 1085 2731 6646 15861 37180 85069 188576 402965 828372 1638555 3123727 5752545
9 6 11 34 97 250 604 1397 3129 6850 14770 31483 66259 137080 277451 547674 1053553 1977942 3634997 6564680 11697717
10 23 53 115 238 476 937 1850 3695 7426 14822 29006 55177 101605 180944 311923 521480 847409 1341595 2073917 3136904
5 17 52 132 288 568 1063 1960 3637 6820 12825 23910 43766 78187 135984 230256 380213 613875 972162 1515160 2331716
-3 5 23 69 176 392 780 1418 2399 3831 5837 8555 12138 16754 22586 29832 38705 49433 62259 77441 95252
13 23 36 69 156 357 771 1566 3045 5782 10898 20613 39315 75556 145710 280790 539833 1037897 2007196 3931949 7840962
13 33 72 142 264 476 847 1512 2768 5305 10692 22314 47112 98827 204221 415374 834390 1662953 3300286 6532935 12895485
3 2 -4 -7 13 102 361 994 2396 5340 11385 23712 48683 98459 194909 374637 694045 1231738 2083182 3339595 5040493
24 37 47 45 29 16 54 234 702 1671 3433 6371 10971 17834 27688 41400 59988 84633 116691 157705 209417
7 9 24 70 168 340 608 1002 1608 2736 5382 12318 30388 74926 177641 399813 853169 1731287 3354704 6232938 11146188
13 19 40 84 171 353 740 1531 3047 5761 10318 17536 28377 43875 65006 92483 126457 166103 209068 250756 283423
21 38 72 129 215 336 498 707 969 1290 1676 2133 2667 3284 3990 4791 5693 6702 7824 9065 10431
-2 15 47 94 156 233 325 432 554 691 843 1010 1192 1389 1601 1828 2070 2327 2599 2886 3188
28 41 54 81 162 373 841 1771 3487 6485 11506 19691 33041 55803 98311 186795 386856 856817 1963836 4527177 10310638
-5 7 33 73 127 195 277 373 483 607 745 897 1063 1243 1437 1645 1867 2103 2353 2617 2895
14 29 42 48 48 56 119 366 1104 2996 7403 17064 37440 79275 163244 327980 643314 1231239 2297936 4181192 7418712
22 36 66 125 242 472 911 1740 3342 6559 13177 26736 53745 105331 199283 362432 633466 1066806 1739272 2763059 4310832
2 0 -2 -4 -6 -8 -10 -12 -14 -16 -18 -20 -22 -24 -26 -28 -30 -32 -34 -36 -38
18 25 43 101 251 576 1198 2286 4064 6819 10909 16771 24929 36002 50712 69892 94494 125597 164415 212305 270775
24 41 62 89 137 245 493 1033 2146 4346 8583 16683 32370 63687 128687 268561 577177 1265569 2797915 6167557 13435492
10 23 59 142 319 664 1287 2355 4126 6987 11474 18238 27920 40958 57585 78915 111446 180159 360593 849158 2105337
5 0 -3 -5 -15 -47 -106 -146 40 1067 4438 13380 34212 78563 167101 336150 649903 1223206 2263499 4145957 7543779
16 38 69 109 158 216 283 359 444 538 641 753 874 1004 1143 1291 1448 1614 1789 1973 2166
16 30 55 90 128 156 159 130 90 140 615 2498 8391 24556 64904 158512 363744 795381 1678545 3459099 7033146
0 17 56 133 268 479 772 1138 1582 2223 3518 6677 14350 31681 67838 138142 266932 491317 865980 1469213 2410376
9 14 18 23 44 138 451 1290 3237 7336 15399 30489 57642 104880 184536 314852 521713 840234 1315712 2003179 2964432
11 10 18 56 159 387 844 1703 3235 5840 10078 16698 26663 41169 61656 89809 127547 176998 240458 320332 419055
12 22 46 111 273 640 1418 2991 6045 11748 22003 39799 69696 118494 196153 317051 501690 778986 1189308 1788463 2652859
9 20 46 93 169 298 556 1147 2553 5815 13032 28202 58573 116723 223646 413186 738233 1279174 2155178 3538987 5675985
17 27 31 26 8 -28 -88 -179 -309 -487 -723 -1028 -1414 -1894 -2482 -3193 -4043 -5049 -6229 -7602 -9188
3 10 17 23 29 45 101 260 633 1406 2914 5844 11725 23975 49930 104485 216239 437362 858799 1632901 3006133
10 8 8 28 102 295 731 1632 3366 6511 11973 21266 37189 65337 117179 215849 406358 772694 1465306 2743876 5042228
10 24 52 108 211 389 690 1212 2176 4085 8041 16334 33475 67922 134847 260416 488206 888566 1571946 2707472 4548339
23 46 74 102 132 190 360 846 2086 4965 11207 24069 49513 98095 187883 348799 628873 1103000 1884904 3143136 5122066
-1 6 32 102 264 611 1309 2632 5004 9057 15753 26720 45185 78396 143498 281002 584247 1261461 2762805 6035330 13028230
23 40 75 153 321 670 1385 2844 5793 11630 22837 43605 80703 144648 251239 423524 694275 1109052 1729943 2640073 3948981
15 25 33 46 80 167 367 787 1614 3183 6133 11763 22795 44891 89465 178588 353113 685557 1299777 2400076 4313082
13 32 58 102 196 405 841 1677 3159 5614 9452 15160 23286 34411 49107 67879 91089 118860 150958 186650 224536
10 21 51 112 231 474 985 2040 4116 7975 14763 26124 44329 72420 114369 175252 261438 380793 542899 759288 1043691
12 33 57 95 176 359 763 1632 3463 7247 14924 30272 60710 121017 240939 480350 958458 1908109 3773455 7380505 14227480
17 26 49 105 238 534 1144 2317 4455 8221 14772 26271 46982 85505 159107 301701 577877 1106564 2099475 3921541 7183166
-7 0 20 61 139 279 523 962 1815 3588 7363 15297 31469 63337 124349 238908 452432 852898 1618891 3129293 6215242
30 60 106 166 244 363 592 1102 2271 4874 10429 21829 44475 88235 170685 322233 593876 1068480 1876588 3217832 5389030
25 34 38 29 -6 -85 -231 -472 -841 -1376 -2120 -3121 -4432 -6111 -8221 -10830 -14011 -17842 -22406 -27791 -34090
14 27 64 140 270 469 752 1134 1630 2255 3024 3952 5054 6345 7840 9554 11502 13699 16160 18900 21934
3 3 2 -2 -10 -23 -34 18 380 1774 5941 16569 40769 91302 189803 371295 690337 1229205 2108564 3501152 5649064
11 27 63 132 250 436 723 1190 2024 3624 6767 12869 24390 45446 82694 146534 252605 423413 689683 1090630 1671742
10 21 43 84 174 383 853 1859 3938 8162 16688 33820 68032 135885 269855 534392 1059114 2106599 4207317 8419480 16811962
4 8 20 39 64 94 128 165 204 244 284 323 360 394 424 449 468 480 484 479 464
14 32 62 100 152 246 451 914 1930 4064 8348 16580 31756 58670 104721 180970 303494 495088 787370 1223348 1860512
24 36 57 108 225 475 977 1923 3594 6366 10701 17118 26139 38205 53557 72077 93084 115080 135441 150048 152853
8 30 64 111 189 360 771 1716 3739 7818 15697 30467 57538 106192 191962 340144 590818 1005830 1678270 2745071 4403451
19 26 41 67 115 229 536 1331 3207 7240 15239 30071 56071 99547 169390 277799 441131 680886 1024837 1508315 2175659
12 31 72 154 300 536 888 1386 2103 3281 5625 10880 22845 49022 103147 208904 405182 753299 1346686 2323598 3883498
14 33 55 75 87 84 58 0 -100 -253 -471 -767 -1155 -1650 -2268 -3026 -3942 -5035 -6325 -7833 -9581
18 18 14 9 5 10 67 329 1226 3800 10322 25351 57449 121828 244275 466779 855370 1510774 2582590 4287805 6934581
11 26 67 162 365 774 1563 3031 5671 10277 18150 31560 54814 96640 175240 328510 634023 1247352 2475005 4913050 9710375
10 12 21 49 125 306 694 1465 2935 5720 11101 21812 43698 89177 184454 384515 804128 1681341 3505647 7271462 14966863
3 7 8 7 5 3 2 3 7 15 28 47 73 107 150 203 267 343 432 535 653
7 22 61 136 259 442 697 1036 1471 2014 2677 3472 4411 5506 6769 8212 9847 11686 13741 16024 18547
2 9 21 39 72 152 353 825 1866 4069 8597 17657 35264 68408 128761 235087 416546 717113 1201365 1961923 3128872
-1 -9 -21 -43 -89 -180 -326 -472 -384 561 3748 11992 30761 70471 150894 309768 619705 1221143 2385397 4632275 8943215
23 52 99 163 235 306 400 654 1471 3780 9454 21971 47481 96644 188123 355863 665091 1247984 2382457 4663003 9363499
-5 -8 -13 -23 -40 -64 -92 -111 -72 193 1206 4443 13762 38657 101444 252655 602917 1386566 3083809 6646613 13901608
-1 -5 3 40 139 377 928 2149 4706 9750 19171 36016 65299 115731 203485 360222 649705 1201404 2277721 4408645 8664071
22 29 51 104 202 350 529 676 665 294 -722 -2761 -6329 -12159 -21434 -36219 -60216 -99989 -166843 -279582 -468416
12 31 57 90 149 301 705 1683 3848 8355 17405 35234 69972 136982 264623 503889 944168 1738619 3144657 5588178 9765043
3 6 17 54 145 328 651 1172 1959 3090 4653 6746 9477 12964 17335 22728 29291 37182 46569 57630 70553
20 47 88 143 212 295 392 503 628 767 920 1087 1268 1463 1672 1895 2132 2383 2648 2927 3220
11 14 24 51 99 172 295 560 1216 2832 6583 14759 31696 65486 131013 254962 483123 888785 1576642 2666148 4215487
5 28 69 136 250 453 812 1413 2334 3583 5005 6234 6941 7983 14726 45075 147219 437194 1177122 2937595 6934002
-3 -1 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37
23 47 92 168 290 484 790 1270 2052 3476 6455 13223 28713 62891 134467 276511 544621 1028421 1867310 3271538 5549852
5 8 25 63 129 230 373 565 813 1124 1505 1963 2505 3138 3869 4705 5653 6720 7913 9239 10705
7 4 -4 -18 -39 -68 -106 -154 -213 -284 -368 -466 -579 -708 -854 -1018 -1201 -1404 -1628 -1874 -2143
8 22 47 86 140 213 338 647 1519 3852 9518 22074 47817 97287 187339 343923 605730 1028882 1692865 2707926 4224178
8 7 20 67 186 446 975 2011 3989 7695 14557 27226 50783 95304 181324 351286 692830 1384471 2781802 5574133 11059128
0 17 56 127 240 405 632 931 1312 1785 2360 3047 3856 4797 5880 7115 8512 10081 11832 13775 15920
9 7 5 3 1 -1 -3 -5 -7 -9 -11 -13 -15 -17 -19 -21 -23 -25 -27 -29 -31
18 27 50 102 215 449 903 1726 3128 5391 8880 14054 21477 31829 45917 64686 89230 120803 160830 210918 272867
2 6 24 80 226 564 1280 2708 5456 10649 20394 38681 73153 138584 263617 503538 963971 1844077 3514433 6656595 12512437
21 31 38 50 89 195 439 964 2083 4473 9514 19832 40115 78281 147087 266278 465385 787291 1292694 2065606 3220037
27 44 68 103 157 254 450 847 1602 2948 5302 9667 18798 40080 91876 216401 504165 1137956 2468512 5139831 10289931
12 16 15 10 8 26 103 329 914 2351 5782 13764 31764 70901 152714 317085 634904 1227650 2296801 4166902 7347240
24 40 66 108 186 352 726 1577 3503 7817 17343 37986 81677 171612 351112 698024 1347788 2531473 4643823 8378986 15025772
18 24 33 60 146 376 917 2087 4466 9061 17542 32590 58476 102196 175971 302974 530317 957661 1798344 3506829 7040265
26 54 90 124 146 164 233 506 1327 3392 8018 17601 36452 72475 140829 272293 532468 1064838 2183738 4566562 9634194
2 12 36 85 187 410 895 1906 3927 7876 15570 30669 60453 118946 232119 446279 841554 1554212 2815554 5023317 8877249
11 38 85 165 304 547 972 1729 3140 5939 11821 24642 52934 114998 248951 532138 1117933 2304140 4657409 9234315 17964728
19 31 43 55 67 79 91 103 115 127 139 151 163 175 187 199 211 223 235 247 259
13 26 59 122 223 375 619 1082 2112 4569 10405 23745 52808 113245 233970 467633 910119 1737872 3280091 6157476 11543989
9 23 59 125 224 354 511 698 943 1328 2029 3364 5842 10201 17417 28659 45157 67941 97399 132591 170244
18 33 50 65 85 140 299 710 1707 4075 9657 22645 52146 117004 254495 535614 1091707 2161171 4173032 7901130 14758416
9 20 40 84 183 394 810 1570 2869 4968 8204 13000 19875 29454 42478 59814 82465 111580 148464 194588 251599
19 30 47 75 111 153 223 409 933 2265 5347 12093 26525 57232 122347 258981 540095 1103200 2197127 4255487 8008435
2 -1 -7 -20 -48 -107 -210 -317 -212 745 4082 13075 34379 81200 179516 380139 781514 1571431 3100731 6009170 11433534
27 53 97 166 267 415 665 1188 2416 5280 11555 24318 48566 92259 168738 303202 549777 1033491 2046105 4250726 9094061
26 39 52 65 78 91 104 117 130 143 156 169 182 195 208 221 234 247 260 273 286
23 28 30 29 28 40 113 386 1196 3278 8149 18863 41505 88134 182530 371286 744869 1476728 2893904 5600425 10685362
-3 10 52 137 290 559 1027 1829 3186 5487 9496 16849 31158 60316 121168 248972 516815 1075808 2237856 4642837 9586726
14 28 52 96 173 311 577 1118 2238 4549 9257 18670 37043 71904 136034 250302 447582 778002 1315794 2168028 3485521
12 10 19 69 218 566 1268 2541 4663 7985 13046 21042 35235 64539 131731 290932 662942 1504036 3336277 7189251 15040904
21 40 75 145 291 595 1212 2420 4707 8937 16660 30642 55676 99679 174968 299426 497005 796658 1228341 1814179 2552253
5 -1 -9 -10 7 57 170 418 964 2142 4591 9507 19185 38292 76948 158114 334787 728489 1611871 3578712 7879983
15 30 54 91 156 290 575 1149 2221 4086 7140 11895 18994 29226 43541 63065 89115 123214 167106 222771 292440
26 36 60 112 205 351 561 845 1212 1670 2226 2886 3655 4537 5535 6651 7886 9240 10712 12300 14001
2 7 25 83 215 469 935 1803 3460 6635 12601 23443 42401 74297 126055 207323 331206 515119 781769 1160275 1687435
17 39 74 124 191 277 384 514 669 851 1062 1304 1579 1889 2236 2622 3049 3519 4034 4596 5207
-3 -9 -11 7 67 194 414 759 1296 2216 4046 8082 17184 37125 78745 161228 316895 597989 1086019 1904329 3234665
8 16 23 27 22 -2 -59 -167 -348 -628 -1037 -1609 -2382 -3398 -4703 -6347 -8384 -10872 -13873 -17453 -21682
19 41 88 184 364 671 1148 1819 2652 3500 4020 3570 1086 -5013 -16635 -34647 -53835 -48048 68522 534603 1954552
17 35 62 94 123 145 181 319 796 2164 5632 13759 31806 70256 149301 306498 609339 1175193 2201994 4014204 7130013
13 20 27 34 41 48 55 62 69 76 83 90 97 104 111 118 125 132 139 146 153
7 -3 -15 -19 2 72 222 490 921 1567 2487 3747 5420 7586 10332 13752 17947 23025 29101 36297 44742
16 24 32 51 122 332 835 1897 4000 8054 15770 30238 56744 103886 185183 321730 547208 917948 1533084 2573509 4373862
-7 3 40 115 232 388 578 804 1097 1595 2790 6175 15700 40696 101260 237524 524769 1097003 2182412 4155027 7608040
-1 16 47 92 164 316 689 1594 3644 7967 16584 33176 64775 125542 245009 485472 977581 1991294 4074185 8315444 16839374
23 38 62 115 228 453 880 1663 3063 5522 9788 17117 29584 50541 85266 141853 232399 374550 593474 924335 1415348
21 43 84 161 309 589 1103 2028 3681 6627 11842 20943 36497 62421 104485 170930 273213 426891 652656 977533 1436253
-1 0 22 77 169 303 511 910 1829 4073 9445 21749 48689 105416 221026 450160 893099 1729494 3273248 6059213 10976433
-9 -12 -16 -21 -26 -25 13 196 824 2622 7193 17896 41579 92080 197440 414961 862813 1786164 3693918 7636129 15753420
15 19 18 5 -35 -133 -334 -656 -953 -581 2306 12127 38432 100587 236346 517687 1080427 2180027 4296650 8331021 15963515
15 31 54 79 116 218 529 1357 3275 7265 14970 29255 55600 105551 204889 411927 856335 1817519 3875878 8193119 17013220
17 38 86 173 311 512 788 1151 1613 2186 2882 3713 4691 5828 7136 8627 10313 12206 14318 16661 19247
15 29 65 148 318 630 1167 2088 3740 6868 12960 24765 47021 87427 157888 276055 467173 766239 1220459 1891978 2860840
13 20 40 94 216 459 901 1657 2924 5130 9334 18141 37563 80483 172673 362688 737415 1445608 2732396 4988520 8818946
10 14 40 102 214 390 644 990 1442 2014 2720 3574 4590 5782 7164 8750 10554 12590 14872 17414 20230
-2 2 18 69 188 421 841 1589 2968 5626 10874 21195 41010 77777 143509 256807 445514 750106 1227946 1958537 3049920
5 14 32 74 162 325 599 1027 1659 2552 3770 5384 7472 10119 13417 17465 22369 28242 35204 43382 52910
-3 -3 12 62 189 478 1087 2286 4500 8343 14633 24427 39268 62169 100447 172395 320864 637864 1304863 2653271 5249412
18 37 78 157 301 564 1062 2032 3928 7589 14553 27650 52089 97362 180425 330785 598326 1064949 1861384 3190859 5361685
24 49 85 135 203 294 426 663 1178 2355 4939 10243 20421 38816 70392 122259 204300 329909 516849 788239 1173679
-6 6 27 49 55 28 -24 -23 259 1359 4471 12225 30376 71273 160582 349623 736928 1504324 2975091 5704649 10617909
22 34 46 58 70 82 94 106 118 130 142 154 166 178 190 202 214 226 238 250 262
-1 11 38 85 175 375 843 1901 4147 8641 17247 33319 63167 119310 227777 444324 889598 1823128 3794302 7941695 16571260
14 21 44 93 193 395 795 1581 3146 6327 12848 26059 52098 101731 193492 359603 657898 1196185 2180968 4011313 7452315
12 14 25 58 144 353 838 1924 4272 9156 18899 37522 71668 131871 234248 402700 671716 1089882 1724205 2665370 4034056
-7 -4 2 8 24 88 285 785 1940 4520 10226 22707 49462 105293 218500 441937 872607 1685968 3194942 5949254 10898776
9 15 27 45 69 99 135 177 225 279 339 405 477 555 639 729 825 927 1035 1149 1269
1 7 18 33 56 109 254 618 1427 3089 6443 13441 28783 63396 141114 310383 663073 1362143 2678340 5032341 9031334
8 30 62 96 130 188 356 843 2075 4824 10363 20622 38299 66854 110283 172533 256378 361530 481708 600332 684448
16 33 68 127 220 368 624 1130 2258 4917 11148 25171 55086 115463 231105 442406 813124 1442381 2484872 4187559 6958992
19 46 82 129 190 262 327 341 221 -170 -1040 -2687 -5520 -10082 -17075 -27387 -42121 -62626 -90530 -127775 -176654
10 24 54 110 204 349 564 899 1500 2745 5512 11728 25576 56253 124229 275003 608250 1337779 2912588 6259085 13264076
17 23 29 41 78 187 464 1081 2324 4661 8898 16588 31128 60596 124667 270430 606415 1371815 3070427 6718531 14285838
22 32 42 52 62 72 82 92 102 112 122 132 142 152 162 172 182 192 202 212 222
-5 -2 14 47 110 246 558 1248 2665 5362 10162 18233 31172 51098 80754 123618 184023 267286 379846 529411 725114
11 14 14 12 17 45 109 196 228 5 -871 -3091 -7752 -16486 -31602 -56237 -94511 -151680 -234280 -350254 -509053
8 25 62 147 337 733 1495 2857 5142 8777 14308 22415 33927 49837 71317 99733 136660 183897 243482 317707 409133
-1 2 22 77 206 494 1107 2337 4657 8786 15764 27037 44552 70862 109241 163809 239667 343042 481442 663821 900754
24 50 87 141 235 417 780 1509 2981 5974 12102 24700 50566 103297 209592 421173 837594 1650633 3232271 6311824 12336389
3 4 0 -11 -31 -62 -106 -165 -241 -336 -452 -591 -755 -946 -1166 -1417 -1701 -2020 -2376 -2771 -3207
26 56 103 171 263 374 481 535 462 192 -233 -348 1536 10273 38409 116432 315337 794905 1904134 4384770 9774416
6 11 29 74 169 361 747 1512 2977 5651 10278 17870 29722 47417 72850 108332 156880 222859 313219 439666 622223
23 48 87 144 228 356 556 870 1357 2096 3189 4764 6978 10020 14114 19522 26547 35536 46883 61032 78480
7 15 30 59 118 247 531 1134 2358 4744 9237 17442 32003 57142 99400 168627 279273 452037 715936 1110861 1690692
10 20 35 72 171 399 849 1634 2876 4690 7163 10328 14133 18405 22809 26802 29582 30032 26659 17528 191
17 24 41 86 185 378 726 1315 2257 3693 5819 9007 14216 24133 45917 97130 217557 491334 1086409 2322292 4782951
28 50 92 173 315 552 963 1749 3391 6963 14740 31356 65972 136277 275762 546694 1062683 2026717 3792870 6961951 12521696
19 33 62 123 238 445 831 1611 3295 7007 15059 31967 66268 133815 263764 509311 966491 1806133 3326508 6037459 10791026
10 33 62 103 170 279 432 598 711 726 824 1981 7389 25746 78354 213440 533320 1243135 2734058 5719219 11447172
14 38 84 172 346 686 1315 2398 4130 6710 10298 14952 20542 26638 32369 36250 35974 28166 8096 -30652 -96558
-4 -7 4 44 142 351 756 1480 2700 4708 8097 14248 26490 52673 110540 238385 515388 1099471 2297118 4692616 9389926
0 6 25 74 182 400 827 1669 3375 6951 14655 31438 67733 144521 302035 614015 1210114 2309892 4272837 7670034 13384480
4 4 19 61 137 257 453 819 1604 3423 7695 17472 38889 83542 172189 340268 645836 1180654 2085275 3569135 5936801
23 35 63 126 262 545 1119 2269 4556 9053 17729 34038 63788 116413 206897 358912 610506 1025617 1719513 2917815 5094961
-2 2 18 53 121 253 507 978 1808 3196 5408 8787 13763 20863 30721 44088 61842 84998 114718 152321 199293
7 30 82 181 345 604 1027 1764 3103 5542 9876 17299 29521 48900 78589 122698 186471 276478 400822 569361 793945
2 1 0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18
9 27 62 117 209 384 732 1402 2617 4689 8034 13187 20817 31742 46944 67584 95017 130807 176742 234849 307409
14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54
4 -2 2 38 132 311 614 1135 2124 4178 8555 17641 35601 69268 129400 232611 404624 686090 1143180 1886628 3105054
23 43 65 96 152 251 408 637 979 1607 3116 7197 18033 44964 107278 242436 519683 1061911 2079959 3925518 7171954
19 30 48 82 149 279 533 1042 2082 4223 8630 17649 35876 71974 141561 271527 506133 915180 1604388 2727868 4502175
-2 10 28 49 82 163 379 902 2034 4263 8331 15326 26840 45287 74538 121073 195819 316657 511115 817796 1283175
-1 6 21 56 143 340 732 1425 2531 4142 6291 8898 11699 14156 15346 13827 7479 -6682 -32719 -76020 -143577
-2 5 31 87 183 346 655 1303 2709 5736 12147 25576 53541 111459 230443 472374 959476 1933664 3877553 7761688 15543715
17 21 35 67 125 217 351 535 777 1085 1467 1931 2485 3137 3895 4767 5761 6885 8147 9555 11117
3 -3 -10 -3 61 271 784 1851 3847 7305 12954 21761 34977 54187 81364 118927 169803 237493 326142 440613 586565
9 14 23 31 27 -4 -60 -59 296 1760 5938 15871 36864 77606 151633 279185 489507 823642 1337761 2107071 3230337
2 -3 -6 -2 32 164 541 1440 3358 7187 14584 28795 56492 111724 223987 453837 921594 1857745 3687926 7171172 13617848
11 12 28 74 163 318 608 1232 2687 6079 13683 29941 63217 128815 254019 486241 905771 1645118 2917518 5057868 8580127
6 10 30 80 170 314 561 1060 2170 4641 9947 20986 43640 90222 186816 388245 807350 1670120 3415956 6874320 13566998

View File

@ -1,70 +0,0 @@
use std::fs;
fn main() {
let input = fs::read_to_string("input.txt").unwrap();
let input: Vec<_> = input.split('\n')
.map(|line| {
line.split_whitespace()
.map(|num| num.parse::<i64>().unwrap())
.collect::<Vec<_>>()
}).collect();
let mut total = 0;
for line in input {
let mut line_starters: Vec<i64> = vec![*line.first().unwrap()];
let mut cur_line: Vec<i64> = line;
while !cur_line.iter().all(|x| *x == 0) {
let mut next_line: Vec<i64> = vec![];
for i in 1..cur_line.len() {
let diff = cur_line[i] - cur_line[i-1];
next_line.push(diff)
}
line_starters.push(*next_line.first().unwrap());
cur_line = next_line;
}
let mut sum = 0;
for i in (1..line_starters.len()).rev() {
sum = line_starters[i - 1] - sum;
}
total += sum;
}
println!("{:?}", total)
}
// use std::fs;
// fn main() {
// let input = fs::read_to_string("input.txt").unwrap();
// let input: Vec<_> = input.split('\n')
// .map(|line| {
// line.split_whitespace()
// .map(|num| num.parse::<i64>().unwrap())
// .collect::<Vec<_>>()
// }).collect();
// let mut total = 0;
// for line in input {
// let mut line_enders: Vec<i64> = vec![*line.last().unwrap()];
// let mut cur_line: Vec<i64> = line;
// while !cur_line.iter().all(|x| *x == 0) {
// let mut next_line: Vec<i64> = vec![];
// for i in 1..cur_line.len() {
// let diff = cur_line[i] - cur_line[i-1];
// next_line.push(diff)
// }
// line_enders.push(*next_line.last().unwrap());
// cur_line = next_line;
// }
// let mut sum = 0;
// for i in (1..line_enders.len()).rev() {
// sum = sum + line_enders[i - 1];
// }
// total += sum;
// }
// println!("{:?}", total)
// }

77
day10/Cargo.lock generated
View File

@ -1,77 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "day10"
version = "0.1.0"
dependencies = [
"strum",
"strum_macros",
]
[[package]]
name = "heck"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
[[package]]
name = "proc-macro2"
version = "1.0.70"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
dependencies = [
"proc-macro2",
]
[[package]]
name = "rustversion"
version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4"
[[package]]
name = "strum"
version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125"
[[package]]
name = "strum_macros"
version = "0.25.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0"
dependencies = [
"heck",
"proc-macro2",
"quote",
"rustversion",
"syn",
]
[[package]]
name = "syn"
version = "2.0.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44c8b28c477cc3bf0e7966561e3460130e1255f7a1cf71931075f1c5e7a7e269"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "unicode-ident"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"

View File

@ -1,10 +0,0 @@
[package]
name = "day10"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
strum = "0.25.0"
strum_macros = "0.25"

View File

@ -1,140 +0,0 @@
-J.|..|7F-J7.J7F7.-77LJ-FL-F77F77F7|F-FLF7.F.FL7F-J.|.FF7-|-F7F7F7.FF-F7LL7FF-J7.----77-FF-..JF7.L-.FF|-F7--|7F77L7FF77F77.FL-7-L.FL7.FF-7..
|-JF7.J7F.LL7F7LL-7F-L7|||.-J7.L-J7.J.L|.|7L-L-|7JFFF-F77JLF|LJ|||.LFJLJ7LL-JL-|77|.FJF7LJJ-7|FF.|.F.|||LF-7|FJL|||||F-LJ|7JF|JJF7----JJ.L7-
|F|-L7L-7JLL-|J7||-|7LLJJ.7..J7F77J.F77-7LF77L7JF-L.|||L77LLL-7LJ|7||77FF7JFF.|.FJ-|L-7L7J|FJJF---7|.FLJ-||L-L7.|FL7JJ|L7|7--FJ.-J7FJFJ.FJ..
|7|F7J.LL7F7FJ-LJL.-|||7FF|-FJ.F|F--7.|.|LF77F|.|7FJ.LL7L7-LLFJF-J7-F7|L.--F7F|.7--|--|F--F|J|LL|LFJ77||FJ-|-||7L-|JL.7JLL7J.|-7L-JJ7J.FFJ-|
LJ||L.L.LJL-L|||.||JFJLL7-F-J---|J||7.F|J.||LJJFLJF|-LL|FJ.LLL7|J7|.||77|77||7LFJ|LL|-JJ|-7L-J7||7|F|.-J|.FF7LJ-.F77|F-F--7..|LF-7JFF777|-L.
L7L-.FJ.--F-|JFL7|7-L||.J7|FJ.|||.|L77F|-FJL7JF-.|FF7JFJL7J7JFJ|7F-7||J-LF-JL777F|.-J7-L--JL|JF-LF7-77J.|-F--7J-J7|7L7J||7.|F7FF.J--JJL7|.||
LJJFL-7-L-J-L.L.7|F-F77L.FJJFFF7FF|L||LLLL-7|F|7F-7|L-JF-J.FFL7L7L7LJ|-7FL7F7L-77-J.||.L|7L.|.LJ.||JF---7.|..|J||7LL-J7F--J.|7J-J.F||L-JJ-|7
F|J-LJ-7FLL-JF|7LFJF-77|7JF7FFJL7F7LF7|F|.FJL77-L7|L7F-J-F7LF7L7L7|F-JF-7FLJ|F-J|J|FJJL-JJ7.FJLFF|L7|F-7|-J7.L7-L7J7L-7J|J--J.||.-|--F..J..7
FF--.L7J7F.FF7|F||LF-LLLJ-FFF77.FJ|7.J-FL-L-7L77L|L-J|F7FJL7||J|FJ||F7|FJ-F-JL-7J.FFJ7||J-F-77FF7L7LJL7LJ.L7--|.LJF-JLF....FLF7J..|JLJJ7LF--
7J-...L.-L-LF7-FJ7FL-7.L-77L||JF|FJ-JJFF7.FL|FJF7L--7||LJF-J||FJ|FJ||||||.L-7F-J|L-JF-77F-L7L--J|F|F-7|F7-L77FL|7F7J.LJLJ7.F.LJFLFL7..L---||
...L--7||FJFJJLL|L|LJ-F-7.F-JL7FJL77|FFJL-7FJL7|L---JLJF-JF-J||FJL7||LJ|--FFJL7F7.FL|-FJLLLL---7L7||7LJ||77F7J.--7-77.-JLL7FFJF7||.L.F|.|-FJ
FFJJ7F-JJL-J7LFLJ.|7|J|F|FL-7FJL-7L--7L--7|L7FJL7F7F-7FJF7L-7LJL7FJLJF-J-F7L-7|||77-F77J7FFJF7FJFJ||-F7||F7||||7FFJLL7|.|-7JL77L-7J||7|FF-JJ
FFJ.LLJ..77.7-J..|77FF-7|F77||FF7|F--J|F7|L-J|F7LJLJFJL-J|F7L-7FJL7F-J7F-JL-7|LJL7-F||F-|-JF|LJFJFJ|FJLJLJ|||F-7J|7LF77-J7|L-F7|F|FJ|F7L.-7.
F7F-7-FJFF7.|.L|-LF7JL7|FJL-J|FJLJL-7F7||L7F7|||F7F7L--7FJ||F7||F-JL--7L-7F-J|F--JF7|L7JLLF-JF7L7L7LJF----J|||FJ-|7LF7JJF7J|FJL7-|J-|||77-7.
--|L--7-FFJ-|-.F7L|LF7||L---7|L-7F--J|||L7LJ|LJ||LJ|JF7||7|||||||F----JF7||F-J||F7|||FJ77LL7FJL7L7L-7|F7F7L||||F7F7FJL7.F.FFJF-J.L.F-7J7|FLJ
L7JLLL.F.|-7|J7||-F7|LJL7F--J|F7||-F7||L7L7FJF7LJF7L-JLJL-J|||||||FF7F7|||LJF7|FJLJ||L-7F7.LJF7L7L7FJLJ||L7|LJ||||||F-JFLF7|FJ7|-7|7F-7F--LJ
|J|.|-7.7|.-F-7||.||L-7FJL--7||LJL7|||L7L7|L-JL7FJL-7F--7F-J|LJ||L-J||||||F7|||L7F-J|F-J||-F7|L7|FJL7F-J|FJ|F-J|||LJL-7FF|||L--7FLJF7|FF-7.7
F7-LFFJ|L77|L7LJL-J|F7|L-7F7||L7F-J||L7|FJL--7FJ|F--J|F-JL7FJF-J|F7FJ|LJLJ|LJLJFJ|F-J|F-JL7||L7|||F-JL7FJ|J||F7|||F---J-FJ||F--J7JFJL77|FL7|
||JL|L-7JJFF.L7F7F7LJ|L-7||LJL-JL7FJ|.|||F---JL-JL-7FJL7F7LJFJF-J|LJFJF--7|F-7LL7||F-JL--7||L-J|||L-7FJ|FJFJLJ||||L7F7.FJFJ||F7F7F|F-JL|-FLJ
-.FFL7F|.F|J.LLJLJ|F-JF-J|L----7FJL7L-JLJL7F7F7FF7|LJLLLJL-7|LL-7L7JL7L-7LJ|FJF7|||L7F7F7||L--7|||F7||7|L7L7F7||||FJ|L7L7|FJ|||||FJL7JJJLJF|
LLFJ-J-L--JF7.LF-7||F7L-7L7|F7FJ|F7L---7F-J|LJL7|L7|F77F7F-JL7JFJFJF-JF-JF7||F|||||FJ||||||F7FJ||LJ||L7L7L7||LJ||||FJFJFJ||FJ|||||F-J..FFJ|-
.L--7JFJ7LLJLJ7L7LJLJ|F7|FJFJ|L7LJ|F7F-JL-7|F-7|L7|FJ|FJ|L7F7L-JFJJL-7|F-JLJ|FJLJLJL7||||||||L7|L-7||FJFJFJ|L7FJ|||L7L7L7|||FJLJLJL--77|L-J|
LF77J|7LJ-FLFJFLL---7LJLJ|FJFJ-|F-J||L-7F-J|L7LJJ||L7|L7L7|||F-7L7FF7|||F---JL--7F--J|LJ||LJ|7||F7|||L7|FJ.|FJL7||L7L7L-JLJLJF-7F7F--J-777|7
LL|F-77-LF|JLJFF----JF--7|L7|F7||-FJ|F7||F7|FJF7FJ|FJL-JFJLJLJ7L7L7|LJLJL7FF7F7FJL--7L-7|L-7L7|||||||FJ|L-7|L7FJ|L7L7|F------J7|||L7JL--JFFJ
.||JJL7---|-J-|L-----JF-JL-JLJLJL7L7||||||LJL7||L7|L---7L7F----7L7LJF7F--JFJ|||L-7F-JF-JL-7|FJ|LJ||LJL-JF7LJFJL7|FJFJ|L-------7LJ|FJ|..J.JJ|
FF|7FJJ|FL|-JLFF7F--7-L---------7L7|||LJ||F--J||FJ|F-7FJFJL---7|F|F7|LJF77L7LJ|-FJ|F7L---7LJL-JF-JL-7F--JL--JF7||L7|FJF7F7F7F-JF7|L--7.|FL|L
-L.FL.---7|..|FJLJF7L------7F7F-JFJ||L-7|||F7-|||FJ|FJL7L---7FJL7||LJF7|L7-L-7L7L7||L-7F7L--7F-JF7F-JL-----7FJLJL7|LJFJLJ|||L7|||L---J-F--|J
|.F|.7|||LJ-7FL---J|F-----7LJLJF7L7|L--J||LJ|FJ||||||JFJF---J|F7||L7FJ|L7L7F7|FJFJ||F-J||LF-JL7FJ|L-7F----7|L--7FJ|F-JF-7LJL7L-JL-7|||L||.J7
|-|J7L-F|JLLF7F--7FJ|LF7F-JF---J|FJL--7FJ|F-JL7|||FJ|FJFJF-7|LJ|LJFJ|FJFJFJ|LJL7L7LJL7FJL7L-7FJL7|-FJL---7LJFF7|L7|L--JFJ7F7|F-7F7L7FF7JLFF7
F---7F|LJ-FF||L7FJL7|FJ||F-JF---JL-7F7|L-JL7F7||||L7LJFJ|L7|F-7L7FJL||FJFJ|L7F7L-JF--J|F-JF-JL7FJL7L7F---JFF-J||FJ|F---JF-J|LJLLJL7L-77|LLLL
.F|-|-F.-7-FJL7||F7LJL7|LJF7L-----7||||F7F-J|||LJL7L-7L7F7|||FJFJ|F7||L7|F-7LJ|F7FJ-F7|L-7L7F-JL7FJFJL7F77FJF7||L7|L--77L-7|-F7F7-L--JJL.F|J
FL.FLJL-LL.L-7LJLJL---JL7FJ|F----7|LJ|||LJF-J||F--JF-JFJ|||||L7L7LJ|||FJLJFJF7LJ|L-7|||F-JFJ|F7FJL7L7FJ|L7L-J|||FJ|F--JF7FJL7|||L---7-F.FFJ.
FJ.7|-.|L|.|.L--7F-----7LJFJL---7|L-7LJ|F7L-7|||F7FL-7L7||||L7|FJF-J||L7F-JF||F7|F-J||||F7L7|||L-7|FJL7|FJF7.|LJL-JL-7FJLJF7LJLJF7F7|--77|L7
|-FJ77FJ7|FF7F7-LJ7F---JF7L7F7F7|L77L7FJ||F-J||||L7F-JFJ|||L7||L7|F7||FJL7F7||||||F7|LJ|||FJ|||F7|LJF-J|L7||FJF7F7F-7LJF7FJL7F7FJ||LJJ--J|7|
JL|.FJ.LLFFJLJ|.F7FJF---JL7|||||L7|F7||J||L-7||||FJL7FJ7|||FJ||F||||||L7FJ|||||||||||F-J||L7|||||L-7|F7L7||||FJLJLJFL7FJLJF7LJLJF||JLJ-L7J-L
|.L-|LFL||L--7L-JLJFJF----JLJLJL-JLJ||L7||F7|||||L7FJ|F7||||FJ|FJ|||||FJL7|||||||LJ|||F-J|FJ|||||F7||||FJLJLJ||F----7|L---JL----7LJ7F.F7...|
JFF.J---F|JLL|F7F-7|7L------7F7F7F-7|L7||||||||||FJ|F||LJ||LJFJL7|||||L-7||LJ||||F-J||L7FJL7||||||LJ||||F---7L-JF---JL7F---7F7F-JJ7L|-J7---7
LLFJ.L|JL|J.LLJLJFJ|F-------J|||||FJ|FJLJLJ||||||L7|FJL-7|L7FJF7|||||L7FJ|L7FJ|LJL7FJL-JL-7||||||L-7||||L--7L---JF7F7.|L--7||LJ||J|-7FLL.J7|
|F|J7LJ..J--|F---JFJL7F7F7F-7|LJLJL7|L---7FJ|||LJ|LJL7F7|L7|L7|||||LJF||FJFJL7|F--JL--7F--J|||||L7FJ||LJ|F7L--7F-JLJL7L-7FJ|L-7J7-F-L-JL7.|-
JJ.|L--7777LL|F7F7|F-J|||LJFJ|F----JL7F-7|L7||L-7F---J|LJFJL7||LJ|L--7||L7|F7LJL7F-7F7|L7F7|LJ||7|L7LJF--JL--7LJF----JF7LJJL--J|..F77JFLL7L7
LF-77-7J-L--LLJLJLJL--JLJF7L-JL--7F77LJ.|L7LJ|F7||F--7L-7L7FJLJF7|F7FJLJFJ||L---JL7||||FJ||L7FJL7|FJF7L-----7L-7L-----J|F------7-FJ|.FJ.L|LL
FL7|--|LJ.L7.L|F7F7JF7F7FJL--77F7LJL---7L7L7FJ|||LJF7|F-J||L-7FJLJ||L--7|FJ|F---7FJLJ|||FJ|FJL-7|||FJL-7F---JF7L--7F---JL7F--7FJFJFJ.|.7-J.J
7.F.|.J---FL-JF||||FJ|||L--7FJFJ|F7F---J|L7|L7|LJF-JLJL--7|F-JL7F7|L-7FJLJFJ|F-7|L-7FJ|LJ7|L7F-J|||L--7|L----JL7F7LJF7LLFJL-7LJ.|FJJ7J-J.J7|
|-L|JFJJ7.7-|F-J|||L7||L---J|.L7||LJF----7LJ-||F-JF-7F7F-JLJF--J||L-7|L--7L7|L7LJF-JL7L7.FJFJ|F-JLJF-7||7F7F7F7LJL-7|L7FJF--JLF-J|FL|---7.|7
-7LLLJJ-77|.FL-7|||J||L----7|F7||L--JF7F-JF7FJ|L7FJFJ||L---7|F-7|L7FJL7F-J.LJF|F7L--7L7L7|FJFJ|F--7L7LJL-JLJLJ|F-7FJ|FJ|FJF7JFL-7|F7JFJL-.L7
L|-.F.L7LLJJ.LFJLJL-JL-----JLJLJL7JF-JLJF-J|L7L7LJ|L7||F7F-JLJ||L7||F-JL--7F--J||F--J||FJLJ7L-JL-7|FJF-------7|L7|L-JL-JL7|L7JF7|LJ|L||FJ7F|
FJ|.F----L|L--L------7F--7F7F---7L-J|F7FJF7||L7L-7F-J||||L-7FF7L7|||L-7F--JL--7||L--7FJL--7F7F---JLJFJF------J|FJ|F--7F-7LJFJFJLJF7L-7F7|LL|
|LL-7JJLF7-LJF7|F----J|F7LJLJF--JF---JLJFJLJF7L7FJ|F7||||F7L-JL7|||L-7|L-7.F--J||F7FJ|F--7||LJF-----J7L------7LJFJ|F7|L7|F7L-JF--JL--J-J|.||
|.L-LJF.|.L|-||FJF7F--J||F7|FJF-7|F-----JF7F|L-J|.||LJ||LJL7F7FJ||L7FJ|F-JFJF-7||||L7|L-7||L7FJF-----7LF---7FJF7L7LJ||FJ|||F-7L----7.LJ-7-FL
|.L|J.FJ|FF-FJ|L7|LJF7FJ||L-JFJ|LJL------JL7L7F7|FJL-7LJ|F-J||L7LJFJ|FJL7LL7|FJ||||FJ|F7|||FLJFL---7FJFJF-7|L7||-L--JLJL||LJ-|F----J7FL--7J|
--FF.JJL|7F7|FJJLJLFJLJFJL--7|JF-----7F7F7FJLLJLJ|F-7L7F-JF7||FJFFJFJL7FJF-J|L7|||||L||LJ|L7F-7F-7FJL7L7|FJ|FJ|L------7FJL--7|L-7F---7.FF--7
|-7.F7|LJ-|LJ|-F7F-JF-7L----J|FJF7F-7LJ||LJF----7|L7|FJ|F7||||L-7L7L-7|L7|F-JFJ|||||FJL-7L-JL7|L7|L-7L7LJL7LJFJF-7F--7||F-7FJ|F7LJF7FJ--|J-.
|FLLJ7L7|||F7L-J|L-7L7L7F--7FJ|FJ||FJF7LJF-JF---JL7|||L||||LJ|F-JFJF7|L7|LJF-JFJ|||||F7FJLF--JL-JL-7L7|F--JF7L7L7|L-7||||J|L7LJ|F-J|L7.|.||.
LL7.L7-F7-LJL--7|F7L7L7||F7||FJ|LLJL-JL-7|F-JF-7F-J||L7||||F-JL-7|FJLJFJ|F-JF7|FJ||||||L-7L-------7L-J|L---JL-JFJL--JLJ||FJFJF-JL-7L-J--JLLF
77LF-7|LJ.|LLF-JLJ|JL-JLJ|LJ|L7|F-------J||F-JFJL--J|FJ||||L-7F7|LJF7JL7|L7FJLJL7|LJ||L7FJF------7L--7|F---7F-7L---7F77LJ|FJ|L-7F-JF77-J..L|
LJJ.-J7JFLJJFJF7F7L7F7F-7|F7|JLJL--------JLJF-J-FF-7|L7LJLJJFJ||L--JL-7LJL|L--7FJ|F-JL7LJ-L-----7L---JLJF-7|L7L7F-7LJL7F7LJF---JL--JL777F7.|
LL.FJLF.|||-L-JLJL7LJ|L7|LJLJF7F7F7F7F------JF-7FJFJ|FJF7-F-JFJL7F-7F7L7F-JF7FJL7|L---JF-7F-7F--JF7F7F-7|FJL-JFJL7|F7FJ|L-7L-7F7F7F-7|-LFL7|
.LL-.FJFLF---7JF7FJF7L-J|F-7FJLJLJLJ||F--7F7F|FJ|FJ-|L-JL7L-7|F-J|JLJL7|L7FJ||LFJ|F---7L7|L7|L-7FJ|||L7LJL--7-L7FJLJ|L-JF-JF7LJ||LJLLJJ.|-|J
LF|J.J.|LL--7|FJLJFJL--7|L7|L----7F7LJ|F-J|L7|L-JL-7L----JJ||||F-J|LLJLJF|L7LJ-|FJL7F7L-JL-JL--J|FJ|L7|F----JF7LJJF7L--7L--JL7JLJ||LL.F-J-J.
|F-J..FF-7F-JLJF--JF---J|FJ|F7F--J|L--JL-7|FJ|F----J-F7|FF-7LJ|L-77F|||J-L-JF7FLJF7LJL7F-------7|L7L7LJL--7F7||F-7||JF7L----7L--7777..77LL7.
L77L|7JL7|L---7L7F-JF--7|L7|||L---JF7F7F7||L-JL-----7|L--JFJF-JF-J-JJ7.|L|JL|L-7FJL--7LJF------J|FJFJF----J||||L7||L-JL----7L---J--7J-LF.||7
F-7J|J.FJL7F--JFJL7FJF7|L-JLJ|FF7F-JLJLJLJ|F7F7F7F--J|F--7L7L--JJ.FJFF7|.|7F|F7LJF--7|F7L7F-7F7FJL-J|L-----JLJ|F|||F7F7F7F7L--7FLJ.J|.L-.JFJ
LJLFL7-L-7||F-7L-7||FJLJF---7L-JLJF----7F7||LJLJLJF7FJL-7L-J|7L7FJJF|L|7F77LLJ|F7|F-JLJL-JL7LJ||F-----7F7F7F7FJFJLJ|LJLJLJ|F--J-J..|FF7-J.LJ
LF-FF7-F7||||FJF-JLJL7F-JF7FJF7F--JF7F7LJLJL7F7F-7|||F--JF7F77JL|..-F7LJ||F.J.LJ|||F7F-7F7FJF7LJL----7||LJ|||L-JF-7L-7F--7|L-77|FF-7-LJ7.7JF
FF-FJL7||||LJL-JF-7F7||F-JLJFJLJLF-JLJ|F-7F7LJLJFJ|||L---J||L777LLJL|L7FL-77.LF-J|LJ||7LJ||FJ|7F-----JLJF7LJL---J|L-7LJF7|L-7L7-L|FJJJ-77LFJ
F|FL-7LJLJL7LF7FL7LJ|LJL----JF---JF--7LJJLJL-7F-JFJLJF7F7FJ|FJ7-LJJFJJ--..L77LL-7|F-JL7F7LJL7L7L7F-7F7F7|L---7LF-7F7L--JLJF7L-JFL|L-77FJ|-LJ
FFJJLL7F7F7L7||F7L-7L-7F7F7F7L----JF-JF-77F-7LJF7L-7FJ|||L-JL-7-JJ.FFJLF-L-7-LJJLJL7F-J||F7L|FJ|LJ7LJLJLJF7F7L7|FJ|L--7F7FJL-7LJ.|F-J-7J|J|7
L-J.|FJ|LJL7|||||F7L-7LJLJLJL------JF7|FJFJFJF-JL--JL7LJ|F--7FJ||.77J|-FJ-LJL-|JF||LJF-JLJ|FJL7F7F7F7F---JLJL7LJL-JF-7LJ||F--J..F||...LF7|L|
|L-F-L-JF-7|||||LJ|F7L--7F----------J||L7|FJFJF---7F7L-7|L7|LJ|-J-LF.LJF7.|7...LF-F--JF7F7LJF7LJ||LJLJF---7F7|F7F7FJL|F7LJL7F7F7FJL--7-||7-J
|LL|7|LLL7LJLJ|L-7LJ|F--J|F----7F7F--JL7LJL7L7L7F7|||F7|L-JF--7-.LF|J7.J-L|7F-7.|.L---JLJL--JL-7|L----JF--J||LJLJ|L-7LJL--7LJ|||L7F--JF||.LJ
FJLJ-JF|L|F--7L-7L-7||F7FJL---7|||L--7FJF-7L7|FJ||LJLJLJF7FJF-J.|.JJFJ-|JL7.7L|--F7F-7F-7F-----JL---7F7L-7J|L---7L--J-F--7|F-J|L7|L-7JF||7F|
L-7LF-77-LJFFJF7L--JLJ||L-7F-7|LJL7F-J|FJFJFJ||FJL7F7F7||LJFJ||-F.LLL7F|||J|-7LJL|LJFJL7|L---------7|||F7L7|F---JF7F7FJF7|LJF7L7LJF-J.FJL--7
LFJ.F--7FF--JFJL--7F--J|F7|L7|L--7|L--JL7L7L-J||F-J|LJL7L-7L--7L-7J..FJ.LFF-J7FF-JF7L7FJL----------JLJLJL-J|L---7|||LJFJLJF-JL7|F-JF7FJF--7|
F|L-L-7L7L7F7|F---J|F-7LJLJFJL---J|F-7F7L7L--7LJL7FJF7FJF7|F--JLJ7F7-FJFLJ|J|--L--JL7|L------7F7F--7F7F----JF---J|||F-JF77L7F-J||F7|LJFJJLLJ
FL.L|LL7||LJLJL7F-7|L7L7|F7L-7F7F7LJLLJL7L--7L7F7LJFJ||FJ||L-7F7JF7F7JF-JJLF7.LJ|LF-JL7F--7F7LJLJ-FJ|||F----J-F7FJLJL7FJL7FJ|F-JLJLJF7L7.|L|
L-F-|-L||F-7F-7LJ7LJJL7L-JL--J|LJL--7F77|F7FJ|||L-7L7LJL7||F-J|L-JLJ|J|L77F-JFF|||L--7|L-7LJ|F-7F7L-JLJL-7F7F7|||F---JL7FJ|FJ|F-7F-7||FJ.F-L
JFJLF--J||FJL7|F7F77F7L-------J7F7F-J|L7|||L-7|L-7L7L7F7||||F7|F--7FJLJ|LLFJJLF-7F7F-JL7JL-7|L7|||JF7F7F7LJLJLJLJL----7||FJ|FJL7|L7LJ|L--7.J
||-FL--7LJL7FJLJLJL-JL7F--7F--7FJ|L7F|FJLJL--JL-7L7L7||||LJLJLJL-7LJJJJF77|L7.L7LJ|L7F7L---JL-JLJL-JLJLJ|F7F7F7F7F-7F-J|||FJ|F-JL-JF7|F--J-|
|.F|JJLL7F7LJF7F7F---7|L-7|L-7|L7L7L-JL---7F---7L-J||LJLJF7F-7F--JF-7FL|FF--7F7L-7L-J|L--7F7F7F-----7F-7LJLJ||||||J|L--JLJL-JL-7F--J|||J||J.
F7.|J.|LLJL7FJLJ|||F-J|F7||.FJL7|FJF------J|F--JF--7|F--7|LJ|||JF-JFJJ-LLL-7LJ|7.|F7FJF--J|||||F-7F-J|L|F--7LJLJ|L7L7F-7F--7F--J|F-7|LJ.-|F|
||FF7LJ-LL-LJ-F7||FJF7LJLJL-JF7LJL-JF--7F--JL7F7L7FJ|L-7|L--7||FJF7|FJ.|.|LL-7|FFJ|LJFJF-7|||LJL7LJF7L7LJF7L---7|FJFJ|F|L-7|L---JL7||JL|FL||
7-F7-J..LLF---JLJ|L-JL------7|L7F7F7L7FJ|F---J|L-JL7L-7|L7F-JLJ|FJ||J.F7F7FF7||FJFJF7L7L7|||L7F7L7FJL-JF-JL----J||LL7L7L7FJL7F-7F-JLJ..|7FJJ
--FL7F-7FFL-7F7F7|F-7.F-----JL7||LJL-J|||L---7|F--7L-7LJFJL--7FJ|JLJ-F||||FJLJ|L7|FJL-JFJLJL7||L-J|F---JF7F-7F7|LJF7L7|FLJF7LJ-LJF7-F-||--..
FFFJLJ..||LFJ|LJLJL7L7L----7F7|LJF---7L-JF---J|L-7L7FJ-FJF7F-J|FJ77.F7||||L7F-J|LJL7F-7L-7F-J||F--JL-7F-JLJFJ||F7||L7|L---JL--7F-JL7--7J7|-|
JJJFL77LL7LL-JF---7L7L-----J|LJF-JF7-|F-7L7F--JF7|7LJ||L-J|L7FJ|F77FJ|||||-||LF---7LJFJF-J|F-JLJF----J|F---JFJLJL-JFJL-7F7F7F7LJF--J|LJL-|-7
JJ.|FLJ|L|.FLFJF-7L-JF-7F7F7|F-JF-JL7|L7L7LJF--JLJF7F7FF7F|FJL7||L7L7|||||FJL7L7F-J7FJFJF7LJF7F-JF----JL---7|F-----JF7FLJ|||||F7L-7-J7L-.F-J
.|7.F7|7.77--|FJJL--7|FJ|LJLJL--JF7FJ|FJF|F7L----7|||L-JL7LJF-JLJFJFJ||LJLJF-JFJL7F7L-JL|L--JLJF7|FF---7-F-J||F7F---JL-7FJ|LJ||L7FJ-F7.|7|L-
777FJF|7-J7JF||F-7F-J|L-JFF--7F7FJ|L7|L-7LJL7F---J|||F---JF7L-7F-J7L7|L-7F7L--JF7LJL7F--JF--7F7|LJFJF-7L-J7FJLJLJF-----JL7L-7|L7LJ7.F-.--J-J
L|-7-7JL.L-7-LJL7LJF-JF--7L-7|||L7L-JL--JF-7|L--7||||L--77||JFJL--7.|L7L||L--7FJL-7FJL---JF7LJ||F-JFJFJF---JF----JF7F---7L--JL-J-|-F-7|J7L7L
||7.7J7|FLL||7F7L-7L7FJF7L7FJLJL-JF7F7F7-|FJ|F7FJFJ||F--JFJ|FJF--7L7L7L7LJF77|L--7LJ.F--7FJ|F7|||F-JFJFJ-F--JF---7|LJF-7L7F-----7F7.FF|F|.|7
FJF7L7FL7|7|FF|L7LL-JL-JL7LJF-7F--JLJLJL-J||LJLJ-L7||L7F7|FJL7L-7L-J-|FJF7|L-JF--JF-7L-7|L7|||LJLJF7L7L7FJF7F|F-7LJF-J-L-J|F---7LJL7FL.FLF-F
J7|7F|7.|L|JF7|FJF-7F--7LL--JJLJFF7F------JF77F7F7|||FJ||||F7|F-JF7LFJL7||L--7L7F7L7|F7||FJLJ|F-7L|||L-JL-JL-JL7L-7L7F--7|||7F7L---J7|F|FJF|
.FJ||J.FJJ|FJLJL7L7|L-7L------7F-JLJF7F----JL7|LJ||||L-J||||||L7FJL7L7FJ||F-7L7LJL-J||||||F7FJ|FJFJL--7F7F-----JF7L-JL-7L-J|FJL7F7F7LF77-JFJ
77-FJ7FLJJFL---7|FJ|F7L--7F7F7LJF7F7|LJF7F-7FJL-7||LJF7FJ|LJLJFJL7FJFJL7|||FJFJF----J||||LJ||FJL-JF7F7LJLJF--7F-J|F7F77|F7FJ|F7LJLJL-JL7.FFJ
7-F|L7JJL-FF-7FJLJFJ||F7FJ|LJL7FJLJLJF7|LJ|||F7FJ||F-JLJFL-7F7L--J|FJF7LJ||L7|FJF7F7FJ|||-FJ|L7F7FJLJ|F---JF-JL-7LJLJL-J|LJ7||L-7F-7F--J7FF-
--JJ|||.F.FL7LJF-7|FJLJLJFJFF-J|F----JLJF-7LJ||L7LJL7F77F--J|L----JL-JL-7|L7LJL7|LJ|L7|||FJFJ.LJLJF7||L7F-7|F7F-JF7F7F-7L---JL-7LJFJL-7.LF|.
JLL.FJ77|7F7L-7|FJLJF----JF7L--JL-------JFJ|FJL-JF--J|L7L--7L7F7F-7F7F7FJ|L|F--J|F-JFJLJLJFJF7F7F7|L7S-JL7LJ||L7FJ||LJFJF7F-7F7L7FL-7FJ7||L|
L7..||L-F-JL--J|L7F7|F----JL--7F7F7F-----JF7L---7|LF-JFJF-7|FJ||L7||LJ|L7L7|L7F7||F7L-7F-7|7|||||||FJF7F-J-FJL-JL7|L-7L-J|L7LJL-JF-7LJ-F77.7
||7-LLJFL--7F7FJJLJ||L-7F7F7F7LJLJLJF---7FJL7F--JL7|F7L7L7LJL-JL7||L-7|FJFJ|FJ||||||F7LJJ||FJ|||||||F||L---JF7F7FJL-7|F7-L-JF7.F7|FJJ-FJL-.J
J.|L||FFFL.LJLJF---JL77LJLJLJL-----7|F-7LJF7|L--7FJ||L-JJ|F7F---J||F7||L7|FJ|FJ||||LJL7-FJ||FJ|||||L-J|F7F-7||||L--7|LJL----JL-JLJL7|7.|||F|
.7|LFJ-|JL|||L7L---7FJF7F-------7F7LJ||L--JLJF7||L7||F7F7LJ|L7F-7||||||-|||FJ|FJ||L--7L7|FJ|L7|||LJF--J|LJJ|||||F7FJL-7F--7F7F--7F-JF7F-7-LJ
-77-L|F7JF777.FF---J|FJLJF7F7F-7LJL-7L--7F7F7|L7L7|||||||F7L7||FJ|LJ|||FJLJL7|L7||F7JL7||L7L7||||F-J|F7L--7||||LJLJF7FJL-7||||F7LJF7|LJFJ-|J
|L|7--L|-7.LF--JF-7FJL7F7|LJLJJL---7L7F-J||||L7L7|LJ||||||L7||||FJF-J||L--7FJ|FJ|||L-7||L7|-|||||L--7||F--JLJLJF--7||L7F7||||LJL7.||L7FJJ-F-
|FL7-L7L---JL--7L7||F7LJLJF7F7JF--7|JLJF7|||L7|FJ|F-J|||||FJ|||||FJ-FJ|F7FJ|FJL7|||F-J|L-J|FJ||||F--J||L-7JF---JF-J|||LJLJ||L7F7L-JL-JL7|L7|
FL-|.LLL7|7|L7.L-JLJ||F---JLJL-JF7LJF7L||||L7|||J||F7||||||J||||||F7|FJ||L7|L7FJ||||F7L7F-JL7|||||FF7||F7L-JF7F7L7FJL---7FJL7|||F--7F7FJ7.77
7LF-JJLFF|--LJ7LF7F-J|L---7F7F-7|L-7|L7|LJ|FJ||L7|||||||||L7|||||LJ||L7|L7||FJL7||||||FJL7F7|||||L7||||||F--JLJ|FJ|F----J|F7||||L-7LJLJJJFL7
||.||F.FJ|JJ|7FFJLJF7L---7LJLJFJ|F-JL7||-FJ|FJL7LJ||||LJ||FJ|||||F-J|F||FJ||L-7LJ||||||F-J|||LJLJ-LJ|||||L----7|L-JL----7||LJ|||F7L-77JJ.LJ|
FFJ-JJ|J.F7-L-FJF7FJ|F-7FJF7F-JFJL-7FJ|L7L-J|F-JF-J||L-7||L7|||||L-7L7||L7|L7FJF-J|||||L--J|L7F-----J|LJL7F7F7|L7F-7F---J||F7||LJL7FJ7J.F7-J
|LF7.L|7F--7J.L-J|L7LJFJL-JLJF7|F--JL7L7|F--JL-7L-7||F-JLJ-LJ|||L-7|FJ||.LJFJL7L7FJ||||F---JFJL---7F7L--7||||LJJLJFJL-7F7|||LJL7-L|L7J-7-FJ|
|F-L7-L-J7J|7L.LFL-JF-JF-----J||L-7F7L7|||F-7F7|F-J||L-----7|||L7FJ||FJL--7|F-JLLJFJ|||L7F7FJ7F--7LJ|F7FJLJ|L----7|F7FJ||LJL-7FJ|F|FJ7L|.7-|
.|JLJ.L|-77||7-F7|F7L-7|F-7F--J|F-J||FJ||LJFJ|LJ|F7|L7F----JFJL7|L7|||F7F-J|L---7FJFJLJFJ||L-7L-7L--J|LJF7.L7F7F7|||LJL||F7F7|L-7FJL---7J|.J
7LFJ..FF--|J.FF|L-JL7|LJL7LJF-7||F7|||FJ|7FJFJF7LJLJFJL-7F7|L-7||FJ||LJ|L-7L7F7FJL7|F--JFJ|F7L-7L---7L--JL7FJ|LJ|||L7LFJLJLJ||F-JL-7F--JJ-F7
L-77-L-L-|.L7--L7F-7|F7F-JF7|F||||||||L7L7L7L7||F7-FJF-7LJL--7LJ||||L-7|F7L7||||F-J|L7F7L7|||F-JF---JF----JL-JF-J|L7L-JF7F-7|||.LJF||JJ.|-J7
F-J|J|FJ|.|.LJ|F||FJLJLJF-J|L7||LJ||||LL7L7|FJ|LJL-JFJFJF-7F7|F-JL7L7FJ|||FJLJ||L-7|7LJL7|LJ||F7L-7F7L-------7L7FJLL7F7|LJFJ|LJJ-L-LJJ.F|7||
JF-|F7|.-|LL-F-FLJ|F7F7FJ7FJFJ|||FJ|||F7L7|LJ|L-7F-7L7|FJL||LJL7F7||||FJ||L-7-|L7FJ|F---JL7JLJ|L--J||F7F-7F7FJFJL-77LJ|L-7|FJ.||.LJ.||7FL-7F
FL.J-L77J.|7.FFLJFLJ||||F-JFJFJL7|FJLJ||FLJF7F--JL7|FJ||F-JL7F7|||L7||L-J|F7L7|FJL7|L7F7F7L7F-JF7F7|LJ|L7LJ||FL7F7L--7L--JLJ|.|---JF-JLL-LJ|
L7.LF|J77-F7F7JJ7FF-J|||L7FJFJF7|||F--JL---JLJF-7FJ||FLJL-7FJ|LJ|L-J|L7F7LJL-J|L-7||FJ|LJL7||F7||||L-7L7L-7||F-J||F-7L7F--7J7.|FF.F||FJ|||-J
|-|FL|-LF-LL|LL.L7L-7|LJ-|L7L7|||LJL7F7F-7F-7FJFJ|FJL--7F7||FJF7L--7L7LJL----7L-7|||L7||F-J|||||||L7FJJ|F-JLJL-7||L7L7LJF-J7F7||LL-J-F7||L-J
7LLFL||.L7.|L7LF7FF-J|7F-JFJL||||F7LLJLJ7|L7LJFJFJ|F7F-J|LJ|L7||F7FJL|F7F-7F7L-7LJ||FJL7L7FJ||||||FJ|F-JL7F7-F7LJ|FJJ|F7L-77|-FLF7||.L7-|7L7
-77FF|-7J|L|JF--7|L--JFJF7L-7|||LJL7F----JFJF-JFJ|LJ|L7FJF7|FJ|LJ||F7|||L7|||F7L7-LJL7FJFJL7LJ||LJ|FJL7F7LJL7|L-7||FFJ||F7|77.LLJFL.F-L7JF.-
L-J-|LLJJFJJ7||LF7J|JLL-JL7FJLJ|F7FJL7F7F7L7L7FJF---JFJL7||||FJF-JLJ|LJ|FJLJ||L7L77|FJ|L|F7|LFJL-7||F-J||F-7LJF-J|L7|FJLJ|L-7J.|.FJFF.||FJFJ
.|||J..-J|L|FLJ-|J|L--F---JL--7|||L-7LJLJL7|.LJFJF--7L-7||||||7L-7F-JF7|L-7FJ|-L7L7-L7|FJ||L7L7F7|LJL7FJLJFJF7L7LL7|LJLLJL--J-FL.L7-|7L77.77
--J----|.-F|||7.|-L7|LL--7F7F7||||F7L7F---JL--7L7L-7L7FJ||LJ|L-7FJL--J|L--JL7L-7L7L7FJ||FJ|FJFJ||L--7|L-7.L7|L7L-7||.J7L|J-LL.-.7F7||L7.LL.7
L|L|7J.-7.J.FJJ-|..-JLL-FJ|||LJLJ||L-JL-7F-7F-J-L7FJFJ|FJ|F-JF-JL7F7F7L--7F-JF7L7|FJ|FJ||FJ|FJFJ|F-7|L7FJF7LJ|L7FJLJF|JFL--F|L|FJ-|J7FFF.F|J
FJ-LF.-JFJLLJJJ7L|7|LL.-L7||L-7FFJL7F---J|FJL7F--JL7L7|L7|L-7|F7L||||L7F7||F7||FJ|L7||LLJL7||FJFJL7||FJL-JL--7FJ|-L|77-|FF.-JFLJLFJL77LJFFL7
|J7FJ7.||||..J.--LFJ-7|7FLJ|F7L7L7FJL7F7FJL7FJL-7F7|FJ|FJ|F-JLJL7|||L7||||||||||||FJ|L7F--J||L7L7FJLJ|F7F-7F7|L7L7.LF|J|7JJ.JFL-FJJJL7.|L|L|
-JF|.F77L7F-LJ.FL7L|F---F-LLJL-JLLJ7L||LJF-J|-F-J|LJL7|L7|L7F7F7||||FJ||||LJ|||L7||FJFJ|F-7||FJFJ|F7FJ|||FJ|LJLL7L77...LL7-|7|.FFJ.FFF-7JJ|J
|7L-F-J-.L|.FF.FL|FFLJ-7J.||-|7|F7F--J|..L-7L7|F7L-7FJ|FJL7|||||||||L7||||F-J||FJLJL-JFJL7|||L7L7LJ||FJ||L7L7J-LL7L7--L.F--LJJJ|J|-FLJLFJFF7
.L|F|||L..|F-JFLJLJJJ.L7-|F|F|FF|-L7F7|7|7FJFJLJ|F-JL7|L7FJ||LJ||LJL-J|||||F7|||F7FF7LL--J||L-J|L7FJ||LLJJL-JL-J|L7||-|-|.FF|J||FJ.-F7J|F|.|
|.L-JL-|7F7.LFFL7JFJF7.J|.FLJLLL||FLJ|L-77|FJJFFJL7|JLJ.|L7||F-JL----7||||LJLJ|LJL-JL--7JLLJL|||JLJJLJ7L|-J.J|.||-||J|F-L-L7LFJ.L..|LJLFJ|7J
|-L-7-L7F|J.FF--F-J.||LFF-L7|-7LJLJ|LL-7|FJ|JJFJF7L7|F--JFJLJL7F--7F-JLJLJ7F--JF7F-7F7FJ-LJFLLF77L.F|J7FJFL---.-J-LJJ-J|--LJF|JF.FFJ-FFF-J.|
7FJ-|FF|7|FL-J.F7J.7J7L7|FJL7-F-J-L7-L7LJL-JJFL7|L7L7|F-7L7F--JL-7|L7F7|F-7L-7FJ|L7||||F-7JF7FL---7.F-L||LJ|7L7J|.|.LJL|-7LJ7F--F-7L---FJLF-
J-.||L7JL7LJF---.--FJ||.LJ||J-L7LF.|7FF||L|J7|FLJFJFJ||FJFJL7F7F-JL7LJL-JFJF-JL7L-JLJLJ-L7-|JLLJFLL7|7-|F--L7FL-JFF|FFL|FJ-J|LF.L7JL.FJLF-||
L|.L7JL7FFJ7F7JFJ|FL-|7.|L|.|..||LLL7-F-J.JJL|-L7L7L7||L7|F-J|||F77L-7F7FJ-L--7L--7F|FJ.LL7-J||.JJF---.F77LLJ.L7F--J-|7|7|LF|.|7JL..F7J-LF-7
||-J||FL|J-|L|L77FL.FJFL|J.FF-J7-7..|F7-|F|FJL|-J7L7|LJ-||L7FJ|LJL--7||LJ7LLF-JF-7L7L-J..-.LLJJ7..F-7..|LF--L|FFLJ7|.-LL|JFFJ.JL7.FFLLJF-J|J
FF7FJFFJ|F--J|7L-7-7-J||.F7J.--F.|-7-F|.7--F7L|.|-L||LF-J|FJL7L7F---JLJJLJ.LL-7L7L-J-7|7L..-7||JFF77..-FJLJ-FJFJ..-|7.JJ.|7FJJ7LJFL-7LF7J7|.
FJLL-7JLLF-|7L7.|L||..F|7-JJ7.FJFJ.L7.L77L||L7JF|7.LJ.L7FJL7FJFJL7F7-J7.F.F7-|L-J.LL-|.JJFFL77J.F7J|77L|-7J-FF7L77LFJJ.LFJFL.FF7||-|7|LJ7-|7
L7||.|.-JLJ|.F|-.FFJ..||.7J7-JJFL7|LJ-.LJ.L|L--J||.|.FL||F-J|FJF7LJL7-L.LF.F-J-|J.LL-JFJLFLJF-7F-F-L--FJF|7-L.|--FF-JJL7J-|LJF7F7JLJ--LLJF|J
FFF7J|.|.LF|.7JJ--LJF-|LFJFJJ7F|LFL7J|FJ|.F|-|JF|L-L77FLJ|F-JL7|L7F7L7FJL|.F.J.||FF7LF|F7LL7FFJJ7L-7J|||7.F-|.J.F-J.|.LF-F-JL|L7|L.FLFJJ.FJ.
7.LJL---7.LL--7J-JLLJ.|LLL-J-7--..JL-JLJ--FJ-|----LLL--JLLJ-LLLJLLJL-JJJ.L-.|JFLJJ.LJ..F.7--LL.JJ-LLJF-JL-JJF-JFJJ.F-7L--|J.LL.-JL-L.|-----L

View File

@ -1,234 +0,0 @@
use std::fs;
use strum::IntoEnumIterator;
use strum_macros::EnumIter;
fn main() {
let input = fs::read_to_string("input.txt").unwrap();
let input = parse_input(&input);
let start = find_start(&input);
let mut start_dirs: Vec<Direction> = vec![];
for dir in Direction::iter().filter(|x| x != &Direction::Start) {
let (x, y) = ((start.0 as i32 + dir.to_ind().1), (start.1 as i32 + dir.to_ind().0));
if x < 0 || y < 0 {
continue;
}
let neibhor = &input[x as usize][y as usize];
if neibhor.contains(&dir.reverse()) {
start_dirs.push(dir);
}
}
let mut finished = false;
let mut pre = start_dirs[0].reverse();
let mut pos = ((start.0 as i32 + start_dirs[0].to_ind().1) as usize, (start.1 as i32 + start_dirs[0].to_ind().0) as usize);
let mut the_loop = vec![start, pos];
let mut area = 0;
while !finished {
let first_next = &input[pos.0][pos.1].iter().filter(|x| x != &&pre).next().unwrap();
pos = ((pos.0 as i32 + first_next.to_ind().1) as usize, (pos.1 as i32 + first_next.to_ind().0) as usize);
pre = first_next.reverse();
finished = pos == start;
the_loop.push(pos);
}
for win in the_loop.windows(2) {
area += (win[0].1 * win[1].0) as i64;
area -= (win[0].0 * win[1].1) as i64;
}
let area = i64::abs(area) / 2;
let spaces = area - (the_loop.len() as i64 / 2) + 1;
println!("{}", spaces)
}
fn parse_input(input: &String) -> Vec<Vec<Vec<Direction>>> {
let input: Vec<_> = input.split('\n')
.map(|line| {
line.chars()
.map(|char| {
match char {
'|' => vec![Direction::North, Direction::South],
'-' => vec![Direction::East, Direction::West],
'L' => vec![Direction::North, Direction::East],
'J' => vec![Direction::North, Direction::West],
'7' => vec![Direction::South, Direction::West],
'F' => vec![Direction::South, Direction::East],
'.' => vec![],
'S' => vec![Direction::Start],
_ => panic!("Invalid pipe char")
}
}).collect::<Vec<_>>()
}).collect();
return input;
}
fn find_start(input: &Vec<Vec<Vec<Direction>>>) -> (usize, usize) {
let mut start_point: Option<(usize, usize)> = None;
for i in 0..input.len() {
for j in 0..input[0].len() {
if input[i][j].contains(&Direction::Start) {
start_point = Some((i,j));
}
}
}
match start_point {
Some(x) => x,
None => panic!("No start point found! AHHHHH")
}
}
#[derive(Debug, PartialEq, EnumIter)]
enum Direction {
North,
South,
East,
West,
Start
}
impl Direction {
pub fn to_ind(&self) -> (i32, i32) {
match self {
Direction::North => (0,-1),
Direction::South => (0,1),
Direction::East => (1,0),
Direction::West => (-1,0),
Direction::Start => panic!("Start should never be converted to an index. AHH"),
}
}
pub fn reverse(&self) -> Direction {
match self {
Direction::North => Direction::South,
Direction::South => Direction::North,
Direction::East => Direction::West,
Direction::West => Direction::East,
Direction::Start => panic!("Start should never be reversed. AHH"),
}
}
}
// use std::fs;
// use strum::IntoEnumIterator;
// use strum_macros::EnumIter;
// fn main() {
// let input = fs::read_to_string("input.txt").unwrap();
// let input = parse_input(&input);
// let start = find_start(&input);
// let mut start_dirs: Vec<Direction> = vec![];
// for dir in Direction::iter().filter(|x| x != &Direction::Start) {
// let (x, y) = ((start.0 as i32 + dir.to_ind().1), (start.1 as i32 + dir.to_ind().0));
// if x < 0 || y < 0 {
// continue;
// }
// let neibhor = &input[x as usize][y as usize];
// if neibhor.contains(&dir.reverse()) {
// start_dirs.push(dir);
// }
// }
// let mut finished = false;
// let mut count = 1;
// let mut first_pre = start_dirs[0].reverse();
// let mut second_pre = start_dirs[1].reverse();
// let mut first_pos = ((start.0 as i32 + start_dirs[0].to_ind().1) as usize, (start.1 as i32 + start_dirs[0].to_ind().0) as usize);
// let mut second_pos = ((start.0 as i32 + start_dirs[1].to_ind().1) as usize, (start.1 as i32 + start_dirs[1].to_ind().0) as usize);
// while !finished {
// let first_next = &input[first_pos.0][first_pos.1].iter().filter(|x| x != &&first_pre).next().unwrap();
// first_pos = ((first_pos.0 as i32 + first_next.to_ind().1) as usize, (first_pos.1 as i32 + first_next.to_ind().0) as usize);
// first_pre = first_next.reverse();
// let second_next = &input[second_pos.0][second_pos.1].iter().filter(|x| x != &&second_pre).next().unwrap();
// second_pos = ((second_pos.0 as i32 + second_next.to_ind().1) as usize, (second_pos.1 as i32 + second_next.to_ind().0) as usize);
// second_pre = second_next.reverse();
// count += 1;
// finished = first_pos == second_pos;
// }
// println!("{:?}", count)
// }
// fn parse_input(input: &String) -> Vec<Vec<Vec<Direction>>> {
// let input: Vec<_> = input.split('\n')
// .map(|line| {
// line.chars()
// .map(|char| {
// match char {
// '|' => vec![Direction::North, Direction::South],
// '-' => vec![Direction::East, Direction::West],
// 'L' => vec![Direction::North, Direction::East],
// 'J' => vec![Direction::North, Direction::West],
// '7' => vec![Direction::South, Direction::West],
// 'F' => vec![Direction::South, Direction::East],
// '.' => vec![],
// 'S' => vec![Direction::Start],
// _ => panic!("Invalid pipe char")
// }
// }).collect::<Vec<_>>()
// }).collect();
// return input;
// }
// fn find_start(input: &Vec<Vec<Vec<Direction>>>) -> (usize, usize) {
// let mut start_point: Option<(usize, usize)> = None;
// for i in 0..input.len() {
// for j in 0..input[0].len() {
// if input[i][j].contains(&Direction::Start) {
// start_point = Some((i,j));
// }
// }
// }
// match start_point {
// Some(x) => x,
// None => panic!("No start point found! AHHHHH")
// }
// }
// #[derive(Debug, PartialEq, EnumIter)]
// enum Direction {
// North,
// South,
// East,
// West,
// Start
// }
// impl Direction {
// pub fn to_ind(&self) -> (i32, i32) {
// match self {
// Direction::North => (0,-1),
// Direction::South => (0,1),
// Direction::East => (1,0),
// Direction::West => (-1,0),
// Direction::Start => panic!("Start should never be converted to an index. AHH"),
// }
// }
// pub fn reverse(&self) -> Direction {
// match self {
// Direction::North => Direction::South,
// Direction::South => Direction::North,
// Direction::East => Direction::West,
// Direction::West => Direction::East,
// Direction::Start => panic!("Start should never be reversed. AHH"),
// }
// }
// }

7
day11/Cargo.lock generated
View File

@ -1,7 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "day11"
version = "0.1.0"

View File

@ -1,8 +0,0 @@
[package]
name = "day11"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

View File

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

View File

@ -1,121 +0,0 @@
use std::fs;
fn main() {
let input = fs::read_to_string("input.txt").unwrap();
let input: Vec<_> = input.split('\n')
.map(|x| x.chars().collect::<Vec<char>>())
.collect();
let mut y_expand: Vec<i32> = vec![];
for line in &input {
if line.iter().all(|char| char == &'.') {
y_expand.push(1);
} else {
y_expand.push(0);
}
}
let mut x_expand: Vec<i32> = vec![];
for j in 0..input[0].len() {
let mut is_empty = true;
for i in 0..input.len() {
if input[i][j] != '.' {
is_empty = false;
}
}
if is_empty {
x_expand.push(1);
} else {
x_expand.push(0);
}
}
// println!("{:?}", x_expand);
let mut galaxies: Vec<(i64, i64)> = vec![];
let mut y_offset: i64 = 0;
for (i, line) in input.iter().enumerate() {
if y_expand[i] == 1 {
y_offset += 1000000 - 1;
}
let mut x_offset: i64 = 0;
for (j, char) in line.iter().enumerate() {
if x_expand[j] == 1 {
x_offset += 1000000 - 1;
}
if char == &'#' {
galaxies.push((i as i64 + y_offset, j as i64 + x_offset));
}
}
}
let dist_total = galaxies.clone().into_iter().enumerate()
.fold(0, |mut acc, (i, gal)| {
for next in &galaxies[i + 1..] {
acc += gal.0.abs_diff(next.0) + gal.1.abs_diff(next.1);
}
acc
});
println!("{:?}", dist_total);
}
// use std::fs;
// fn main() {
// let input = fs::read_to_string("input.txt").unwrap();
// let input: Vec<_> = input.split('\n')
// .map(|x| x.chars().collect::<Vec<char>>())
// .collect();
// let mut rotate: Vec<Vec<char>> = vec![];
// for j in 0..input[0].len() {
// let mut tmp: Vec<char> = vec![];
// for i in 0..input.len() {
// tmp.push(input[i][j]);
// }
// if tmp.iter().all(|x| x == &'.') {
// rotate.push(tmp.clone());
// }
// rotate.push(tmp);
// }
// let mut expanded: Vec<Vec<char>> = vec![];
// for j in 0..rotate[0].len() {
// let mut tmp: Vec<char> = vec![];
// for i in 0..rotate.len() {
// tmp.push(rotate[i][j]);
// }
// if tmp.iter().all(|x| x == &'.') {
// expanded.push(tmp.clone());
// }
// expanded.push(tmp);
// }
// let mut galaxies: Vec<(i32, i32)> = vec![];
// for (i, line) in expanded.iter().enumerate() {
// for (j, char) in line.iter().enumerate() {
// if char == &'#' {
// galaxies.push((i as i32,j as i32));
// }
// }
// }
// let dist_total = galaxies.clone().into_iter().enumerate()
// .fold(0, |mut acc, (i, gal)| {
// for next in &galaxies[i + 1..] {
// acc += gal.0.abs_diff(next.0) + gal.1.abs_diff(next.1);
// }
// acc
// });
// println!("{:?}", dist_total);
// }

1
old/AdventOfCode2023 Submodule

@ -0,0 +1 @@
Subproject commit 78aab8ab5ed7c65461663bf6a4c1b31fcdda6cca

View File

@ -1,9 +1,28 @@
use std::fs;
fn main() {
let input = fs::read_to_string("input.txt").unwrap();
let input = input.split('\n');
let mut sum = 0;
#[aoc_generator(day1)]
pub fn parse_input(input: &str) -> Vec<String> {
input.split('\n')
.map(|line| line.into())
.collect()
}
#[aoc(day1, part1)]
fn solve_part1(input: &[String]) -> u32 {
let mut sum: u32 = 0;
for line in input {
let chars: Vec<_> = line.chars().filter(|char| char.is_numeric()).collect();
let num = chars.first().unwrap().to_string() + &chars.last().unwrap().to_string();
let num: u32 = num.parse().unwrap();
sum += num;
}
sum
}
#[aoc(day1, part2)]
fn solve_part2(input: &[String]) -> u32 {
let mut sum: u32 = 0;
for line in input {
let str_nums: Vec<(&str, &str)> = vec![("one", "1"), ("two", "2"), ("three", "3"), ("four", "4"), ("five", "5"), ("six", "6"), ("seven", "7"), ("eight", "8"), ("nine", "9")];
let mut matches: Vec<(usize, &str)> = vec![];
@ -20,29 +39,8 @@ fn main() {
// sort by index
matches.sort_by(|lhs, rhs| lhs.cmp(rhs));
let num = (matches.first().unwrap().1).to_owned() + (matches.last().unwrap().1);
sum += num.parse::<i32>().unwrap();
sum += num.parse::<u32>().unwrap();
}
println!("{}", sum);
sum
}
// use std::fs;
// fn main() {
// let input = fs::read_to_string("input.txt").unwrap();
// let input = input.split('\n');
// let mut sum = 0;
// for line in input {
// let chars: Vec<char>= line.chars().filter(|x| x.is_numeric()).collect();
// let mut num = chars.first().unwrap().to_string();
// num += &chars.last().unwrap().to_string();
// let num: u32 = num.parse().unwrap();
// sum += num;
// }
// println!("{}", sum);
// }

114
src/day2.rs Normal file
View File

@ -0,0 +1,114 @@
use itertools::Itertools;
use std::cmp::max;
#[aoc_generator(day2)]
fn parse_input(input: &str) -> Vec<Vec<Vec<(i32, Color)>>> {
input.split('\n')
.map(|line| {
let rounds = &line[line.find(':').unwrap() + 1..];
rounds.split(';')
.map(|game| {
game.split(',')
.map(|round| {
let (number, color) = round.split_whitespace().collect_tuple().unwrap();
let number = number.parse::<i32>().unwrap();
(number, color.into_color())
}).collect::<Vec<_>>()
}).collect::<Vec<_>>()
}).collect::<Vec<_>>()
}
#[aoc(day2, part1)]
fn solve_part1(input: &Vec<Vec<Vec<(i32, Color)>>>) -> usize {
let (r_max, g_max, b_max) = (12, 13, 14);
let mut sum: usize = 0;
for (game_id, rounds) in input.iter().enumerate() {
let mut sad = false;
for round in rounds {
let (mut r_cur, mut g_cur, mut b_cur) = (0, 0, 0);
for (num, color) in round {
match color {
Color::Red => r_cur += num,
Color::Blue => b_cur += num,
Color::Green => g_cur += num
}
}
if r_cur > r_max || b_cur > b_max || g_cur > g_max {
sad = true;
}
}
if !sad {
sum += game_id + 1;
}
}
return sum;
}
#[aoc(day2, part2)]
fn solve_part2(input: &Vec<Vec<Vec<(i32, Color)>>>) -> usize {
let mut sum: usize = 0;
for rounds in input {
let (mut r_max, mut g_max, mut b_max) = (0, 0, 0);
for round in rounds {
for (num, color) in round {
match color {
Color::Red => r_max = max(*num, r_max),
Color::Blue => b_max = max(*num, b_max),
Color::Green => g_max = max(*num, g_max),
}
}
}
sum += (r_max * g_max * b_max) as usize;
}
sum
}
#[derive(Debug)]
enum Color {
Red,
Blue,
Green
}
trait ColorConvertable {
fn into_color(&self) -> Color;
}
impl ColorConvertable for str {
fn into_color(&self) -> Color {
match self {
"red" => Color::Red,
"blue" => Color::Blue,
"green" => Color::Green,
_ => panic!("Invalid Color")
}
}
}
#[cfg(test)]
mod tests {
use super::*;
static TEST_INPUT: &str = r"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";
#[test]
fn part1_example() {
assert_eq!(solve_part1(&parse_input(TEST_INPUT)), 8);
}
#[test]
fn part2_example() {
assert_eq!(solve_part2(&parse_input(TEST_INPUT)), 2286);
}
}

31
src/day4.rs Normal file
View File

@ -0,0 +1,31 @@
use aoc_runner_derive::{aoc, aoc_generator};
#[aoc_generator(day4)]
fn parse(input: &str) -> String {
todo!()
}
#[aoc(day4, part1)]
fn part1(input: &str) -> String {
todo!()
}
#[aoc(day4, part2)]
fn part2(input: &str) -> String {
todo!()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part1_example() {
assert_eq!(part1(&parse("<EXAMPLE>")), "<RESULT>");
}
#[test]
fn part2_example() {
assert_eq!(part2(&parse("<EXAMPLE>")), "<RESULT>");
}
}

11
src/lib.rs Normal file
View File

@ -0,0 +1,11 @@
mod day4;
mod day2;
mod day1;
extern crate aoc_runner;
#[macro_use]
extern crate aoc_runner_derive;
extern crate crypto;
aoc_lib!{ year = 2023 }

7
src/main.rs Normal file
View File

@ -0,0 +1,7 @@
extern crate advent_of_code_2023;
extern crate aoc_runner_derive;
extern crate aoc_runner;
use aoc_runner_derive::aoc_main;
aoc_main! { lib = advent_of_code_2023 }