Add 2023 solutions

This commit is contained in:
Sven Weidauer 2024-12-25 12:52:38 +01:00
parent 7f8a4ebb89
commit 10f30eb274
48 changed files with 7418 additions and 0 deletions

2
2023/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
target/
.vscode/

101
2023/Cargo.lock generated Normal file
View file

@ -0,0 +1,101 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "aho-corasick"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0"
dependencies = [
"memchr",
]
[[package]]
name = "aoc"
version = "0.1.0"
dependencies = [
"array2d",
"itertools",
"linked-hash-map",
"nom",
"regex",
]
[[package]]
name = "array2d"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8b39cb2c1bf5a7c0dd097aa95ab859cf87dab5a4328900f5388942dc1889f74"
[[package]]
name = "either"
version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
[[package]]
name = "itertools"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0"
dependencies = [
"either",
]
[[package]]
name = "linked-hash-map"
version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
[[package]]
name = "memchr"
version = "2.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167"
[[package]]
name = "minimal-lexical"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]]
name = "nom"
version = "7.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
dependencies = [
"memchr",
"minimal-lexical",
]
[[package]]
name = "regex"
version = "1.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343"
dependencies = [
"aho-corasick",
"memchr",
"regex-automata",
"regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"

12
2023/Cargo.toml Normal file
View file

@ -0,0 +1,12 @@
[package]
name = "aoc"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
regex = "1.10.2"
nom = "7"
itertools = "0.12.0"
linked-hash-map = "0.5.6"
array2d = "0.3.2"

140
2023/day10.input Normal file
View file

@ -0,0 +1,140 @@
FF--7-|7F--7F--|7F77-.FJF7F-7-F|7.77.FF7-F7---7-FJ7.|J--FJJ-FF-.JJ7LF7.J7F-7-F77L7.7-7.7FF77FF7..F--L7JF--.FF.7F|JFL7.7FL77.-7|7.F7-7FJ.FJ.-
FL-JF-L-JJFFJJ.7-JLL.7JF-J---7JLF7|LLF--.LJ.F7.LJL7--JJLJJJ.||JF|.F7LJ7.JJL7-FJ7L|-JL..LJJF-FJJ-|7|||F.|7.F-J7|FJF-JF--7L|7L---7-FL7FJ-FJ7.|
F7.||.7--7-LJ.FJ.|7..J-J7J|F.LFFJ7F7J|LJFL7.FJ7.|FJ..J|.|.F-LL-7..|F|J|7.FF77|F77J.F-JJ-J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F7||F7|F-JFJ||||||F-7L7FJ||||||L7|FJ||L-7F7|L7|LJ|L-7||||LJ||FJFJL--JL7|LJLJFJLJL--7L7|||L7F||.L
LLJ|F|7|.F-JFJF7F-7L7FJ|F7LJ|JFJL-J|JF7L7|||||||||||F7|FJ||||LJ7|FJL7|||||F7||L7||F-J||L7||F-JF7||||L7FJ||FJF-7F-7LJF---JF7F7F7L-JLJL7|-LJ7.
L7F|J.FF-JF7L7||L7|7|L7LJL-7|FJF7F7L7|L7|||||||LJ|||||||FJ||L7F7|L7FJ|||||||||FJ||L7FJ|FJ||L7FJ||LJ|FJL7|LJFJJLJFJF7L----J||LJL-----7||7||F7
F77.|F-L-7|L7LJL-JL7|FJF---J||FJLJL7LJLLJ|||||L-7|||||||L7|L7||||FJ|FJ|LJLJLJ||JLJ||L7|L7||FJL7|||FJL7.LJF-JF7F7L-J|F7F--7LJF--7F7F-J||J7LFJ
LJLF-JL|LLJJL-7F--7LJL7L---7|LJF7F7L----7LJ|||F7|||||||L7||FJ||LJ|FJL7|JF7LF-JL7F--JFJL-J|||F7|||FJF7|F--JF7|LJL--7|||L-7L-7L-7LJLJ.LLJJLFJ|
LL.7.||LF-----J|F-JF-7L7F7FJ|F7||||F---7|F7||||LJ||||||FJ||L7|L7FJ|F-JL-JL7L7F7|L7F7L---7LJLJ|||||FJLJL---JLJF7F7FJLJ|F7L7L|F7L---7-JL|F||JL
FF-L7-J-L---7F7||F7L7L7LJ|L7||||||LJF-7LJ|LJ||L-7LJLJLJL7||FJ|FJL7|L-7F---JFJ|||FJ|L7F--JJF7-LJLJ||F7F7F----7|||LJF-7LJL7L7|||F---J7FJL7J.7J
7J--F7||F|7FJ|||LJL-JF|F7L-JLJLJ|L--JFJF7L7FJ|F-J.F7F-7FJ|||FJL-7||F-JL---7L7|LJL7|FJL----J|F---7|||LJLJF--7|||L-7|FJF-7|FJLJ|L--7J-L7J||-|.
LLF7JFLLLJFJFJLJF-----J|L7F7F7F7L---7L-J|FJ|-|L---J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7L-JLJF7FJF-J|-L-JL--------7F7JLJ|F-JL7F----JF7||-|..|-FJLJ-L-L7|L-7F7|LJLJL-7L-7FJF-7F7F7LJ7F-JF-JF7FJL-J||F-J|L---------7-7|
.L|JFL-7L||F-7L-7F7FJ||7L--JF7.F--7F7F7F7LJL7F-JL--7|L7F7F-JLJL7F7--.LJ-|.FLLLJF7LJ||F-----JF7LJFJ.||LJL---JF7L--JLJF-7FJ|L7LL7F-7F-7F--JF7|
7.JFJLF|LF7L7L7FJ||L7||F----JL-JF7LJLJLJL---J|F7F7FJL-J|LJF7F7FJ||LL7L7FF-----FJL7|LJL--7F7FJL7FJF-J|F7F7F7FJL7F7F--JJLJ-|FJF7|L7LJFJL-7.|JF
F.FFJFLJL|L7L7|L7||FJLJL--------JL-----7-F7F7||LJ||F7F7|F-JLJLJ-|||.L|F|7-|-|.|F7L7F7F-7LJLJ-FJ|FJF7||LJLJLJF7|||L------7LJF||L-JF7L--7|777|
LFJF-L-|FL7L-JL7LJLJF------------------JFJ||||L-7LJ|||LJL-7F7JF-J|77.|-|LF--|FLJL7|||L7L----7L-JL-JLJL------J|||L7F--7F-JJF-JL---JL-7|||7.7J
F|LJ7-FJFLL--7FJF7F7L----7F-7F7F7F--7|F7L7LJLJF7L-7|LJF---J||7L7FJJL|J-|F|..|F7F-J||L7L7F--7|F-7F-----7F7F7F-JLJFJL-7|L7-FJF7F-7F---JF|L7-7|
-JF.|-J.F7F--JL7||||F7LF-JL7LJLJLJFFJFJL-JF7F7||F-J|F7L----JL--JL77-LLFJ-.--FJ|L-7||FJFJ|F-JLJFJL----7LJLJLJF7F7L---JL-JFJFJLJ|LJ-J-L-L-J7.L
LF-7||LF||L---7LJLJLJL7L7F-J|F-----J7|F---JLJ|||L--J||F7F7F7F7F7FJ7J7|FJL77FL7|F7|||||L7|L7F-7|7F--7LL------JLJ|F7F7F7F7|FJF7|F-7F|77.L.F|7.
F||FF|-FJL7|F7L------7L-J|F-7L-------JL7F---7LJ|F-7FJLJ||LJLJLJ||JJ-L-J||F||FJLJLJ||L77LJLLJFJL7L-7|F-----7F7F-J|LJLJLJ||L7|L7|FJF77F777FF--
.J.L-J7L-7L-JL----7-FJF7FJL7L-7F-------J|F--JF7LJ7|L-77|L---7|FJ|.|F|7|FFFF7L----7||FJF7JF7FJF7|F7||L----7||||F7|F-----JL7||FJ||L|L7F7FL7L|J
FLJF--JJFL-------7|FJFJLJF7L-7LJF-------JL---JL--7|F7|FJF-7FJFL-JFFF7LF-F-JL7F---J||L7||FJLJFJ|LJLJ|F7F7FJLJLJ|||L--7F-7FJLJL-JL-JFJ|L7JJFJ.
F.L||FFFLF------7||L-JFF-J|F7L--JF---7F-7F7F7F-7FJ||LJL7L7|L7F-7-L-LJLJLL--7LJF--7|L7|||L-7FJFJF7F7LJLJ|L7-F7J|||F--J|FJ|F--------JJ|FJ.F--|
FJ-L7-F7JL-7F7F7LJL7F-7L-7LJL--7.L--7|L7||LJ|L7|L7|L-7FJFJL7|L7|.L7||-7LLF7L--JFFJL7|LJL--J|FL7|LJL7F-7L-JFJL-JLJ|-F-JL-JL---7F7F7F7||F7J-||
F-77JJF----J|||L7F7|L7|F7L----7|F---J|FJLJF7L-J|FJL7FJL7|J-LJL|L7J7FJ|-LL||F-7F7L-7LJF--7F-JF7LJJF7LJ7L---JF-7F-7L-JF7F---7F7LJLJLJLJLJ|F-J7
-7F7|.L-7F7FJLJFLJ|L-J|||F----J|L---7|L--7|L--7|L-7|L-7LJF-77L|FJ-F-7F7..||L7LJ|F-JF7|F7||LFJL7F7|L--7F---7L7|L7L--7||||F7LJL--7F------J7|||
FLF-77LLLJLJF7F7F-JF-7|||L--7F7L7F--JL7F-J|F--JL7FJL--J||L7|F7|L-7L7|||F7|L7|F7||F7|LJ|LJ|FJF7LJ|L--7LJF-7|FJL7L--7LJ|L-JL7F--7LJLF7F7||.-F-
F--JL|F7|JJFJLJLJF-JFJLJ|F7LLJL7|L---7LJ-FJL---7|L-7F---7FJ||LJF-JFJLJ||LJFJLJ||LJLJF-JF7|L-JL-7|F7JL-7|FJLJF7L---JF7|F--7LJF7L--7|LJL777L|J
|.L|7F-JJ|-L7F7F7|F-JF-7LJ|F---JL----JF-7|F----JL-7|L-7FJ|FJL7FJ.FJF--JL-7|F7FJL7FF7L--JLJFF-7FJLJL---J|L---JL--7F7||LJF7|F-JL--7LJF--JL7FL7
.JLFFF7.LFF-J|||LJL--JFL-7|L---7F--7F7|FJ|L-7F--7-LJF-J|FJL7FJL-7L7L-7LLFJ|||L7FJFJ|F--7LF7L7|L7F-7F-7FJF------7LJLJL-7||LJF7F7FL--JF-7.F--J
..F-FJL7||L--JLJFF-------JL-7F-J|F-J|LJL-JF-J|F-JF-7L-7||F-JL7F-JJ|F7L7FJFJ||FJL7|FJL7FJFJL-JL-J|FJ|FJL7L--7F7.L--7F-7LJL7FJLJL-7F7FJFJ-LJ.L
--LJL7FJF----7JF7L-7F-7F-7F7|L--JL--JF7F-7L--JL--JFJF-J||L7LFJL7F7LJ|FJL7L-J|L7FJ||F7|L-JF7F---7|L-JL--J|F7LJL---7|L7|F-7LJF---7LJLJFJF7JFJ7
|.|||||-L---7|FJL7FJ|FJL7||||F7F-----JLJFJF--7F---JLL-7|L7L-JF7|||F7||F7L--7L7|L-JLJLJF-7||||F-J|F--7F---JL-7F---JL-J|L7|F7L--7L7F7FJL||.|-7
|7.-FJL7..F7||L-7|L7||F-JLJ||||L------7.L7L-7|L---7.F7||FJF--JLJ|||LJ|||F7FJFJL---7F7FJFJ||L7|F-JL-7|L-----7|L------7|FJ|||F7FJLLJLJ||||-7||
L-7-L-7L--JLJL7FJL7LJ||F-7FJLJ|F7F---7L-7|F7||F---JFJ|||L7L7F7F-J|L-7LJ|||L7|F7F-7|||L7L7|L7|LJF---JL-7F---JL-------JLJ-LJLJLJF7F-7F7FJ|-JF7
.LLFJJL7F-7F-7LJF7L-7LJL7LJF-7LJ|L--7|F7||||||L---7L7|||FJFJ|||F-JF-JF-J||FJ||LJFJLJL-JFJ|FJ|F7L-----7|L----7F-7F7F-----------J|L7LJLJFJ7F-L
L.L.L7LLJFLJLL7FJ|F-JF7FJF-JLL-7L---JLJLJLJ|||F7F-JFJ|||L7L7|LJL-7L-7L-7||L7||F-JF7JF-7L-JL7|||LF----JL-----JL7||||F--7F-------JFJF7F-JJJLJJ
|7.FLF7F---7F7LJFJL--JLJFJJF-7FJF7F-------7|||||L-7L7LJ|7L7LJF7F7|F7L7FJ||FJLJ|F7|L7L7|F7F7LJ|L7L--7F7F7F7F---JLJLJL-7|L--------JFJ|L--7|FL7
LL-F7|LL7F7LJL-7L---7F-7L-7L7LJFJLJF------JLJLJL--JFJF7|F7|F-JLJLJ|L-JL-J||F--J|LJFJ-||||||F7L7|.F7LJLJLJLJF7F7F--7F-JL-7F7F7F--7|-L7F7|JJ-|
77--JJ-LLJ|F7F7L----J|FJF7|7L7FJJF-JF7F7F--7F7F7F7LL-J|LJLJL7|F7F7L-----7||L7F7|F-JF-J||LJLJL7||FJL--------J|||L7FJL---7LJ|||L-7|L7LLJLJ7LF-
|-7JL|.F|JLJLJL7F7F7FJL7|LJF7LJF-JF-JLJLJF-J|||LJL-7F-JF7F7FJFJLJ|F-7F--JLJFJ||||F7L7FJL--7F-J||L----------7LJ|FJL--7F7L-7|||F-JL7|.LLL-|.|J
JJF7JFLJ||F----J|LJ||F7||F-JL-7L7FJF----7L-7|||F---JL--JLJ|L-JF--JL7|L--7F-JFJ||||L-J|F-7FJ|F7||F7F7F-----7L-7||F--7LJL-7||||L7LLLJ--7|F-7L.
||L7.|7|FFL-----JF7LJ|||||F--7L7LJFL---7|F7LJLJ|F-7.F7F7F7|F-7|F7F7||F7FJL7-|FJ||L--7||FJL7|||||||||L----7L--JLJ|F-JJF-7|||||FJ77-JF|77|LJ7J
7-FJFF-LLF-------JL--J|LJLJF7L7|F7F----JLJL----JL7L7|||||||L7|LJ||LJ|||L-7|FJL7||FF7|LJ|F7||||||||||F---7L--7F7FJL---JFJLJ||||F-77.JJL|7LJ7.
L7|F-F--LL7F-7F-7F-7F7|F7JFJL-J|||L----7F7F7F-7F7L7LJ||||LJFJL--JL-7|||F7|LJF-J||FJ||F-J|||LJ||LJLJ|L--7L---J|||F---7FJ7LFJ||LJFJ7FL7L||7JL-
|FL.L|.F-|LJLLJFJ|FJ||LJL-JF--7LJL-----J|||||FJ|L7|F-J|||F-JF7F7F7FJ||LJ||F-JJFJ|L7||L--J||F7|L---7L7F7L---7-|LJL--7LJF7LL-JL7FJJ.LFFF-JL...
FJJ77LF--7F|LLLL-JL-JL-7F--JF-JF--------J||LJ|FJFJ||F7|||L-7||||||L7|L-7LJL7F7|FJ7|||F---JLJ||.F77|FJ|L---7L-JF7F-7L--JL-7-LL||L|7F-|LLL7..F
LJJ||JJLJ|F7.|F-------7LJF7FJF7|F--------JL-7|L7L7|||||||F-J|||LJ|FJL-7L-7FJ||||F7|||L7F7F7FJ|FJL7|L7|F7F7L---JLJJ|F7F---J7.F||F|LF-|7JF---7
.|LFJJFLF|-|7LL--7F7F7L--J|L-JLJL--7F7F-7F7FJL-JFJ||||||||F7||L-7|L--7|F7||FJ||LJ||||FJ||||L7LJF-J|FJLJLJL-------7LJLJ7FF---7|L7|F|-FJL|JF||
F-L|J7F--|F77-|F7LJ||L7F-7L7JF7F7F7|||L7|||L---7|FJ|||||||||||F7||F--J||||||FJL-7||LJL7|||L7L-7|F-J|F7F7F-7F-----JF7F7F7|F--JL-JF---L7|.||F7
|F7-7F|L|L-L7-FJL7-LJLLJ.L7L-JLJLJLJ||-||||F7F7||L7|||||||||||||||L-7FJ||||||F7J||L--7||||FJF7||L-7|||||L7|L------JLJLJLJ|LL|FL--.F-L-|-LJ|J
.||F-||-FJ7L--|F7L--7F--7FL7F7F-7F-7||FJ||LJ|||||FJ||LJ|||||||||||F7||FJLJ||||L7|L7F-J|||||FJ|||F7|LJ|||FJL7F------7F7F-7L7.L|F-FJ-|LLLFJ-.J
F|F--F7F|-J.|7LJL7F7|L-7|F7||||FJ|7||||-LJF7||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FF.L7F-F7L-7FJ77|.LJ.FJ77LJ-L7L7.LL--J.|7F7L.FJ||.|L7-L.JFJ77|LJL--L.L
|F-|FFL7-.|F7-7.LL|-J|LLJ-F-FJ7-LJJF-7FL7.FL7F-7---J--.LLL-7F7L||.|JFLJJ.|--.|L7.LJF--J-7.FF--7.L|FL-J7.LLL-FLL--7F7LLL-JFJ7|.|FLLJ7|LLJJJ..
|JJ|LL7JF--LJ7LF7|L|||JJ|-7J|7L.LJ-7.-7FL-LJ-7JJ.LFJ.LL-|FF|LJF---JF-7.7JJ..7-.J-FL|J-J.FJ--7JJ-7||-JJ---L|.LJ|.F|L77J||LJ.FL--J.FJLF7.|F7FF
L|L|.LLL-JL|.|-777-L77J.L-LL|7L|.L7J-L.FL-J.LJL7J-7J-L.LL-77.7-JFJL--|7L|J.--J.LJL-JJ.F7LJ.LJ.L----JLJJ.FJ|...7J-L-L7L|-7L7-LFJJ-|J--|7JLL-L

140
2023/day11.input Normal file
View file

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

1000
2023/day12.input Normal file

File diff suppressed because it is too large Load diff

1420
2023/day13.input Normal file

File diff suppressed because it is too large Load diff

15
2023/day13.test Normal file
View file

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

100
2023/day14.input Normal file
View file

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

10
2023/day14.test Normal file
View file

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

1
2023/day15.input Normal file

File diff suppressed because one or more lines are too long

110
2023/day16.input Normal file
View file

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

10
2023/day16.test Normal file
View file

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

141
2023/day17.input Normal file
View file

@ -0,0 +1,141 @@
112211323123313231221322424444241114332223124451424553135231525524415314331423354424151142512532322133331244112344412431332132122133112212211
122223123113132112231214112341424142422134142231351412332345532123322123241131151432434144322125551312414133341314131233422322322132111232121
221122112112311332233321231113341442341431433433123255542341432521344514231533554131332544154431243333341241244434322431231213223221323312122
122311112332123113214214443411114431243245541442442314425124453113434525224551243115454313325131424435543442211434142111214432312313213111231
221131232332113113124214432212132144441514344335332253221455141515253422334534111522444433122415241343353534244432442321124124232132131123331
123131223112232321314232231314122241534352424515445222251215213441353512511514442325231214135114551233123312331211414122342233321331312323112
122321323122232121231114233242221411123453351115411115521555542134333144112252155243544542352114554341151155313414313131212242123231133131131
122323331323211212211232114341143323514135243431225323132111341433662544454663353424334313125555454251424133451423232441231332132331131212231
222312113122222242431121412432545314512223332313345534235644563566325643465425426634331434523532122242223524444413123334241424332411231113231
122111111332321341242222431344331155241453421311115451244562222343566245662244532443532552311451453221331553512532222443312121122131221331131
211112131321313111213243243115514145143125122211515433365535622426654345624525525234333246354433551121522213135512524142431133421223331222332
332221332241423422413324423251414212133134121523644263544446664256365263643446536566245642362633154125433441135234311423242224312232212322313
322323122114334111322321112133243524454254222442253662263536542553533455632423423662562465342346232155314152412341311443243332433123212111222
223123214141212134414231144425414224513354165255424433646234654556464344256336654362234463335364654652233143453553512525243111124344232322323
213211243341111323431154353411543152544114566356254543323665266522655544252426533335633356252633326332225111121341255122114112331311114431132
321111133133423124333523224122255151152362664366345662554442255265462634225563346243426326635555345552621535241451231321214222432412334233122
322131122243433432334245413421243332514636532444226456652223656624236423653254266363654464224665633425665432331215551141241132331333234321313
322142131414211441452131422143253154442444526635535325223465364425322255626656553255652356556532442226522643425453345144534132232413243413232
323313332322212432215521523322422333566252326463452625452252265477455474744736554443552364566256366243652242243433452552113321114441412444132
211241313133333345251225251344243266223462444332326222455444336333345357774335456467633423225336224664332536563552244433523421214314321222312
331131434221313455323134414424214223363223442425266545535435664754373537566677646563343633245645342326343263243515333332211422522413423213342
141423344331424434352345424543126636633355225645544377767764545645563546446436677657467757725226534444623542456614522433111114322324412223333
211143233223222215413143353434536626545433623235365343334536533643743767466434567767457566466463445632565435222345522144324535233222233213434
134331321433255133242124133522423443624562335224465333374447475665356644645334736456367773363437356365455332264662335132313344324222334442124
113431331144311133155213431642246556524244635646437466637656636743753537333345464443734355565447766443455623653426452442155134534142322433113
144321334314413325242124246436432632623464223355644544536344567743756353746447773774344745746545655424465655566542336311535153443112232331112
442113343112442234143334142456454633225564436443353363374763377664567374467766334757563464567736666766242546524645246622112155431244114311323
334121314222313521523432434232425625426254744464373777736653635463447756663433364565635635543755463465242452522335542563532412215323133113212
332243241225152422452326666555664342644734757467474663356536756745456385576374375575673565365765474675546462234555662246554132131252431313424
241434234133454125134424432562436334325737464475635676335437655754644488676447657743633644654664776446763552252322355365453131115532513323143
232412224422454121522224455353232363277737555633364564334748574665565857774556865588766774746675573473745522345444343326515425342113535242213
212212431113325533545245444652334426337553477677437353436874785658686576746456678685858774733363344333766363645462245346265115142215543321242
342231211352533113535232636332643364434746636346544648784588756665757845678656754477847668655577567734377375735652334322264441331234152322223
413221534254544111345265534543323644734777344646547874685858478467768454666848475886678848843474373544536547446645244563355452341212121311214
442324445331341151356453424233425446347566777443738764877674687688477845668857688866556456644753457374537655767435644454424441513455332152331
213342321411224345463464324633427347473336336767665777486586858885774576444574757446766465465477343535457435465554566635553552513153454453112
123315124111152146326446662353377776474755676666686876566554875884745788588656678884784486657658733334366577334445336436542232532322552354323
441113215251343153426426355634374537755334545776467446786774455866885557577884656487867578876758653433747433376574454365556365112245152344444
211255332155135545632653625633463755635755457578648685888484885588755888477675457788665447658445576756663537345535643662623424655345213323433
331353445441324556525523564467444337544653767465556784487474846556898587558767778878655456644666488437677667435555444526244334231424451445221
123333154152451252534543252573566753575635545458687876848857466786858675656567767488888844674688657546536753636757726232236245343151233513334
142423552143344564523236363644376756674538658774548874866855686597579656756556966678676578867845878565456553335376553233423364463352251415113
335421224353356425542355567644454434343347888886454557764659788777578578588798675757867585778576587657745656475645636265226556256135234222443
235215225545235654446222343773445476466874647586557558596989765968898988568669669867867865654576667467476637433566656535452243344623134515423
414452445555465634242634666746365536577848667457766745575596958689779988579598689878668986466746687557858537446677363535246652563433411122352
135212532214534364622663665744565654456844586754747598698866959597756766968585679786589577977665755868878664567336466552236556343421141214335
444325512232245254452324463436535374558485686757754785756767557765779666699675577786699659766667465658485565663476674445422633535423525414331
424342423225534235262333733646577777478846477467659555887858957756878889585955786785695768976687578786765775346545645435522535654632234232535
245353153523564566552333477364357554777646776448785965576789868677979559556996898895796865676958787678686747674356434473352554632245434523444
344345313213624544332334765537566355648844668574958989597776999558797656775875875799668596975574567546884646536436456563644253623633252111222
121445142165245656355263636557463464646886547689666556677887878587987767989977779595857889896757875456645574847657764756456564635625215123433
314313354554255363333554565377367877777885554759755859657958868999787997686896868595598785699585984555864648787645536545645625546266541445542
531232355253524565246657747555433867475457478965959876997886999897788689978678898999785968779798665748455846753565754367333656434253453314411
511314543156362655424674334736635885475887786787686667957676869689766969999696998898559776756787877468477877846376467663346534642263241214111
313522211662634443664765565675634566656646756988767768567787898686697687768687667687688759668785865844658844855656676563577536252656525533242
414225114645642253554576663335367644765867686566666955966798899896999699986878768988869989799776686965675846647647656776767636424636222433535
214434515256533563364667747733476876475687495668595977766697679678866968886769966877887777878858889586548666656464476545444325453342531314313
224543454656536553343777767656458566655464859566965669579779868986998796669779868686867856786758786784686556886544573473457556426433626215424
334411416624456532666353546663685777878766996696969657766769767696868668969688789988886897886889855954647667676453364455446365456524654552354
132542354442364222464337356374664556466576685659859769788879899979788678878886976667887786667879856896568448876576634333767562242335446522333
345543315626333265573536777536455856686877896786669858996878897789867788789988776666997866557676668978784854568674637445436722234622665545515
145132224446323562245565734463864447486547796578577796977786696986878779798988767697677697965678899559555776576853343473474345456534424145554
441343216322662453437635733647755656847877968558855789786679998787979988778778796768986999879656587657475765445785344543366662452345232222444
552253142442342424355557676445587448565486656769586677679977699687987979888888966678877698667577759688977455456775657634546665333543426433312
112153336343643463353474737736567475458895678887967996776866799798799997788778887997686897695978675768558665775867676446564464433426632345155
353433555265552343563746656548788557764576879775586798786696667998799978777889896686997899775699766556757777857885433367737743245656535653131
221321126366552432647653655558566564884886557959897699879967687999799779887997897886988966995868867966765846666878573673365544644436334351351
232532436265523532546744767758477885654797999896666879987666767798777798789778998986869889668959875958866855775774766557746436464365653633333
414411446354244635556474336377766678746599685896597668678968798778879799979888978797767789988797579597676477878477556544467436635225646452355
114213465232332525737676445445675747745888567659566989797979778987899997877999888899966676996679795795565555756887643777745774225365464344154
352154442653636535653537747467465675778867985597897877867688798878899778889789978879969767887589567577858457678845476547656536353534253334111
352443126524636554745637345445847845645877856665679986967799678879977898898778798987979769868858688968784586754445743436463365256622435451243
252322546342242363373346764376674475766779755789868788978986697797799779787878897986877987696666766655975888855478576534774476456253325441443
143143144533345326575754566455886447775757758788676889779688689989877977878978899999698667878859767959567685776486547743737375435236424232522
331432126625563465644337534674565647546858578695577898878989797878877877889878898768966768996669665795654466884484445777337754436264553413543
244112533533634355775437376565475754548599666667557686976889867787899998779777899979668978787997969969574686676747457674666545232242233222441
214541243424626343573546465465756585454797785889989988889687798779778898998989889999879979988595757897946657864875365356564366626556624645413
522121434542522663645546346367586645865568956766685977999697977989878778879997776788788788968667686678855657854765757644457633223325535341451
154255452664246252753354676566685657854469789987968776689788698879988979899797777776978979668956689897945586585548774434574644245634665445112
222512466225335446335467647544876884476685569759978768968696969887999797787999896978898967677767887875547854687775755437676732433354525643143
524552212452546532667656346446658585674579585857786887868686998896989987778898976686899766765775567898885674564477654645435436245444655234222
442121455443625662475466664444665654585549686889885867897998668787879788997997766696989778968665768765487576444475467735773354233352524425215
531525326234354266667366737535576648756876959668756789676868799767986678887696868988796886859965695877785784884555776745346433662365443454113
352334515336352543363455645347586744887554687798569555866677697869987897977678998899896976779686986558458548868775766665377444345663345224453
231332234556653334256766635664776647565586878877959595698787976776999878988678866867989798675987677878846645576563366637754722253233646454442
553552145444452646336457677653554755664555579569865699976889996986698889969678777779878986985698778654568584866673333376665232233452244421134
213522351235464554255367674744445657575585779697776789977977976766789769689897997786987698696575565944587644558875765474375446333632232541321
352241334544262333325476574573337754585765499657858895785878996779668686996689986676998569859668987845446484868357544366675664663442351324222
514534332326346534266533337563667585755748446756667958857768998668688896966968767666669875579687859688676665648463444444655543653332324131414
254524451566362624264564375565767478686858467669698865865575898766676897869866776978655896585895587577464548666357647444773363626463543525243
442535342553232452324766737733766654766586446599998558759986696789999986888979678786958675767587564885768644685773746647744236523263621123125
132353435163463253362437347555447775466875668878957699895866896696797688776976755665688979767558946855664655664647735673646363642224332234215
544411434126645644532365346776547476665575484447675858959657969557988666686658885687985675696697687857447885537753747464443555663264411513321
522453242522424234536564676343337437448477676655965589955877786885599977869999665667978558896778875578745485357756766665654466243252135245544
311335321514544526266363346373737468584456447588878588685665585898775698968888765776865665965888544465544676463675653766545262336263313434353
133114532551333246364267774777533335788744547488889779897798969997956687865758995966597998666867484456657666377665464544455365522251421334541
543235341241342556255363464437454673848747446558646966696685696976969767677589995959577868565644886875665443466763455644344563523234552524551
124253533423343324646465344644577745458576568445854899956987975689676666958758576897696678575874846744586776577557457564345354245232215514132
123143222524245222633563334735767547575674654484855864999669757599766759857965656665985687448677855645867737777776457354422332365545121333544
423115121112156626223535444734444774644747477768864568759997695997867587779776568686866655585748544565864665554445445436443243222421555334113
114345315331322553245525633333373437445658478555657477547688959889675898769769878567964654785448784678557655545377433534366336533152321333352
311443411311433243325364245765545746633764647646756486667774868867685966669656888787654468488788775874573777563346754326542566466122433122511
422123135533133553456244366573345664356457566685766674576746644799659898679788957654544874654678577675363664574364725332664243435455345311154
441112341151122365536244345353477645756577787867666748456648444888558766678677848578778864764845674756665556547533365266255225464531323122554
421225214342535246262445462245765754636566578574845768874576474465746868576468556774664867757766568564665363465675453563455536622122214423113
211124134315442145434426353534573777474747637754887466754544854648854655877548467866875455745586786656463737565434663332553464253311444551311
431231522213423432666636546645345667667457576646647845646466877447487867868654568488575447757888633355455676356533342226426463135342132232122
344243535312553554443366352244624563434477356763555684665765665665848758657685574545666448587576336737653566343242432654566244125323551452123
413311554351521241146336335653527357444467566664344664887755576574868664646875566474877578746467445675633656455366365353545515141153325531321
141214542545313421156663465566426547465676337347737478888676885866665848556558585874585485686667473676667645573236365346443553151232552252223
241431141325215323114446553553536575354367375343756535886854864675444767488847886874488688757477335774536743446335662645654352352232152224112
124221344354514445151456322242526533465366443367436753335674866464677676476774564485466633475566774535665345262245346356444221534212523223221
214322331253522525123243526253225233676444553736454745676756847655776777748657565455634667735737743367653732242362362546325541512135524412122
412323211532344125133335623443325453244655577737666343377347356486484665665554868374347735564643443677374626536624433542223454132545131444142
434231124424232443512526324336442433264335557347457634645666653644364484674567677455465746536647777334545636656256644566213512215152432344324
243242421244311354452343336566646463264466634646344465377454457777767455337336334334764766764544375566352356626663655324435242314231312443322
113213443233242433321325343642243354654623563375554363434333555373363377757337663544734573443647757474243343445242536552145322235531344233312
123332214422533544122215455432323635324654423776733766656475344773367444673343634345563335564654373424435355525252265224454311451252314123121
124313431134252125531353523523245644652634365564553377577637465354777365334336443466765665773334564336326623334552442254153411121524342241413
234324143433241545353443255346223552364424226666356436536574356757435656577764476764767655344767565446532332225665214342552442555433211341334
312323144344311435133532221324563665456456432563447547763577536643763673653447437573345475675425245254323343426355554132351435222144312134143
121422144423412521223324215122265633635454566364565366535446467655573535564477446465776433626445633352226455435321523344433455334333411441331
314242331324342255423255531333125246365225326434654462357545643457646364647344546457633444443566652235426422623514332245521311342141442241144
232121214231313214141313552531551622645436432453333462365646543644544575564345743543646232564226455462445552332451224145554321413222422244223
321134421122441142331552453113433245545536443344642626462242456346465377456744344364433365625322665533563423135253323142212454233342323411323
323113142331114413254321222442532254465336243522542465624423346344232362254433243566535333235255455332222464445122544135354412214323124144123
323224442342133212211313422153542511212223664434646665244366332354456255443634334664354626453543454553562315512455242352344244241323224212223
333332321114241114232313332525141254343352435424534465566442432343346324266622262544442366366252544222624112152112221532453242132424111221312
331223141441442234231351151535553122255526435235552466364462556554426336544663344333632324566254654234533214425312432431111324123422311132312
311212323441413234411113254244521541242425323664645246422464562665623562334624345445342423555662444633532122253435515321141333322143221211132
131133332423142222222424415341342113531412455456522426335443654265423455265256553532642356464446455235143343544414251434424231431443112113313
312322333111142211432122312512144535525154421251523223243462524664363534663652224565534434532261322212114514555142512413112214342234122211323
312231123221323441121422312345231312323511521515234233634432652526242262364425625265355633444445555532444122531325211422221412224242232112332
121221233233443134434313212343514235445545412523315111355342546665463562226345365663452363315453325253332242122143141112144432112112122331112
122312212122221312121144212412252142515541124225512344425352646354324644536324534363624535325155523143223355344253144132434413211333332131322
331331223321132222224243414122234453551313424323342524314344151224542263353555352114221425341344144112114234133143411324124441234231312111122
311221211232312141311314241344442343511534523112424323233522342355244225144235541441233133323142435355554122222431124331123323443223111223323
112232332313233332344411211212423432212423143212112153351353325435413125241111535125131514325342342215225323143134422244142323223211322321113
121332333321322114144121241334314444222424354411224234121555221211444345144332155324325554514442234213151142132114321321231324212212332232331
212332332122311233232144222314232411222234524534114233421351225511124345212225254141552443333145115143533131314323233434442412333333132123221
211212322131311231132322134223411213222122134314131213545541433115144333341122311253343145513421442314131434121434213141443133322212211323122

13
2023/day17.test Normal file
View file

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

140
2023/day3.input Normal file
View file

@ -0,0 +1,140 @@
........897.......839...........651.399.............236...............................343...986...........308...............................
........*................*404......*............134.....953..508=.....................*....*..........325*..........744......392............
...350..847..403...-..541.....622.................*....................356.......%..95...793....................830...........*.....163.....
.....&.......@...105.............$..745............42...785.............*..443.412............922..............*...........663........*.....
.253....../..........696.............*..................*..............817.$.....................*...........62........................373..
...........244...419....*189....=........*...871.74...797...353.737................227..626.....429.726%...9......*956...803/.......*.......
.793...........=.....-...........119..683.18.*...............@......+.....182..372....$.&...................*..756...............945.610....
....*.........496.....395.....................929.746................76..*.....*..............673-...*.....47........591..271...............
.....964..................241...........*............+.....+....590.......129.6....$.....@...........680....................*...............
..........523*448...........&....136.759.356............789.......*.................367.330..397.............483....354......354...869......
...488................920........*...........................652...802....$.......*............*..............-.....................*.......
..../.........986....*......*....550.995......376...............+......641.....567.315.........887..66...863....552.936..........277........
.................*.800...354.464.......*.533......................20.......704..........918........*.....*...........*....214........&434...
........%.....589...................596..*.......373...-..........*....785.@......941......*....521.......908...897..610....................
........384..........827*101....698......978....*......947.614.571....*..........@.....+...1.......................=......#73...734.........
122%..........*...................*..........993............./.....260.........+.....466...............%........................*...........
...........938.992........246......305...449......335...739................588..681.........920.....164.........................431.........
..558....$........................................@.....*.....................=............-............847.....879..51................624..
.....*.104....*818.......505.785.10...................161....210....................723..........55......*..424..&.....*.........723..*.....
...44......542.....975..................437...............51....*686.....*....../..*.........990*......708.....@....715...&....#.......997..
...............801..@.............-....*.....702....&....*............238.236.706.183..+................................842.545.............
...........202*...................906..204...*...990......212....380%..................208...................66.............................
......./........../....878............................266.......................278...............920...................144.........423.....
....494..*.....976........@.....&.......*287...553-..*.............731...................649..247*........703......@....%....817....*.......
.........856.......592...........708.404............707.......274...*........-............#.....................%.567.........*......431.761
.............663.........974...............%...446.............*............751....793..........811....225.&...48.....860..887..............
................&...........*.......673..536......-.........447.....@...............@...$..................816..........*...................
....822................@....251....$............................413..306.164.............540.....313..476..........@...586./65....840.......
.....*......@.950.....266............$.........1...+...............*..........373..................*.............885.................*......
......157.529....*.........341.....480.............60......765....122...633....+............$182....963.....................587..976.824....
................172............685.....480....#........831*................*......747......................262..................-...........
....*......+438.....@......332./.......=...739..815...............356.....119.273.&.....317*674.......=...*....561..........192..........89.
....867..-........179..............319........../....74@..952*374...*.........*....................125....578...*...........*......652......
..........549.............873.........*...=........*...............695.*.....126.........821.....................697.$......806.52....*54...
....792...........-...646*....770.....163.637....941........884.........744..............................#............800...................
.......*.......181............@.............../........92..#...................518...654.......421*995.310....450...............771.........
...+................./48...........968.........269................904.......=...../.....................................266.....*...........
.211....636.................630.17*.....%581........./843.....%..*.......878...............829.....119.33........211.........247............
.......*......................-...................%..........559..873.............*138.439*....687*..........130....*681....................
....522.................792........896.........471...480*321...................125..............................*...................291.....
........616.......818.....$..858.............................659*826.....109.....................................10.564=.331...156...+......
........*.......@...*..29....*...@......546.............907.............*.....965.......217.808.....802..212...............*................
....607.976..641..852.@...330...158....../.......630........247.......503........$.335+....*.........*..*....618...423&.335...803...........
......=..............................502........#........-..*.....923......664....................421...395.-..................#............
........*.................625....646..@...99............901.59......*.....*..........517.$747.*....................315..............79...922
.....289.789..............%......*.........*......................762....388..189.....*........277.........*222...*.................$.......
.................................738....406.....462...........................*.....915..............505/.......61.....+.......202*......646
..749..............163............................*.....963..........907.......979....................................223..716.....265......
.......&....741............362.......117.......837..96../.................#..............786.256.....942..=970...983........*...............
......133......*486.725.......*....../...............%................930.310...................*733.-.............$.....198.........189....
....................*........256........68.......267...873........418*.....................573.................................219..*.......
......+.....439..525..187........495..............*...=.......923..........327..988..300........447*59..702../..840......40.....*...........
......731....*........*..........*..............547.......453.....6.$.........*.......*................-....447....@.......*.737............
.907#.......375........195.....707..17.................9..........%..119...147..594.22.......81.........................485......446........
.....................................*....#............*.....62...................*...........*....569...935.868....-...............*528....
...#..........209........229.......787.470..............403........892.........816.....923..811...$.........*......104.907.849....*.........
..154.346.....*...361.........................10/...237................-................*.............600..............*.......998.606......
.........%...216..*.......*.........*368.869.........#................6..98...........53.............*.....850@...102...751.................
....550............727...383.....818.....*...913.............879...........*.....420.....150.........708....................................
705*.......@688.......................289.....*.........................431........*...+....*50.....................698...668*144...........
..................501..70.520....$32......562..458....170......279$............504......883............/...44........*......................
..450..107@........*..................586*...........*.........................*....510............788.274............589...-26......&......
...................342.........&.551+.................302...............286.....931....&....-649..$.............575................185...199
............602..............470.........243*......@............818.690*.......................................*....863..793*...............
......934.....*......200.936.....46..........137.72.........377*......................443*372........498....320..#...........553......598...
........-...451./952..*...*....*.......................804..............305......700............675...&.........611.........................
......................393.......708....957........*697......808.....138*.........%......186....*....%...162*...........624........244.%.....
.....220*.........872......*...........*.........7.........................................=..6....391......562...880.....*......#....120...
...+.....608.........*...74.568........193.........379.........$682......933.927&.....&............................./..984..................
93..553........*768.739...........421.........880.....*....737.............*.........69.....................................................
.........334...............................40*........910.................................+465..682.............141*.......248..80..........
.........=..................323...172.............506..............503........568....785+.......%.......940*734.......#573....*...*.....130.
...163@........%17..42..108*.......*...$......700..*..81...../...............+....%.............................#285.........499.523....*...
.............-........*..........305.706.....*....942.....843........*.............378.861.......573.859.173............522............544..
..........974.......517.756..762.............480.....................289................*...........*......*.228%..........*......628.......
....567........&274......+..../..........................................926.............391............214.............270...230..-........
...........=...............52...../......155*150.......180&..*......482..&...884................-125...........................@............
..........332..................318............................123......%......*...............=........................310..................
....................856.154........@............161....192..................=..387.............384..*827................*..&400......588....
.......283.............*....@.......12.....309...*...$...........643.......885..........862................210.......449....................
.......*......937.........98.....&........*....560....884.......$.................866#.../.............622..*..901.............462..........
.....279............273......896..17.661..880...............138...632......66...%.............93......*....349...*........./......=.........
..............430....*....+.....*.....*............350...............*..........226.......621*......312........=..266....574..111...........
..339........../.....770.451....122........990.....................811...780........*448.................325.249...............+...$...441..
......................................$......%...........793..............@..787.766....................................64..+......252.*....
.........556........../.....256/...267...336.....897..........524*417.........................950...930$.452........164......713.......592..
....759....*...........672.................-.868....*....613......................401.....742..*..............560........=.........939......
.....$...780.......195......578...............*...%...+....*.....=.....&.............*......#...645...636.797..........652...........*......
......................*......................77...97.988.821...882...977.......127.609.914...............*..................................
..........+...195&.....930.....872.......................................79..............&.....14...................-.......150..274........
..........473................9*.............951&................./...827*.............46......-...13....751.........640.......*.....*504....
898................-.............56*....378..............291..310..........58............937.....$.......*.../.............840..714.........
............-321.128.157............549..-....130....478*.........*.....................................123...164..............*....631.....
..516..989@..........*.........*670............................204..577.......&817....@514........790...............816.........148.*.......
.....*................233...........*838.....*951.....-954..........$.......&.................110.........99...........*..@187.......671.467
224...205.....552................823......343................490*...........377..................*.......$...........779.......408..........
............./..../.....................................166*..........120...........452.........148...=.......................*.............
.562..............768.........#.267.29...806*......476......214.........*....*......*...............867.211....248.$870....@...829...*......
...*..826@...................1.....*.........251....+.....#...........211.893.403....702.......44.......*........+..........75......977.....
..368.........861$......867....=.......................834.....................................=.........507................................
.......721*............*.......912.#497....................87-.....231...894.......968..........................659$.......@..........564...
...........690.......432....@..................332................*.........*756..*................302..214*.........803..855...............
..................26.......943...........633...*.....299.150....639.................796.....440.............428......+...........538.647....
........31........*............................260.....-................=..261.............*............................644.303..%.....-....
227..........#.161....*....&.....305...............345........328....639...*........$.......802....612.185................%../..............
.......683.953.....224....58.....*.................*....799...............944.964....245.............*.%................@......28.19.242.97.
....93*........../.............908.........$249..480.......*......978..............................58........=209......373.802*.........*...
467...........201..........932.....997......................548................/.....-904.....796.....3+............................915.....
...................#......@.......*......748*965.................922......451..169..............$.945....372#..979........%..436...*........
........&.....880&..789........14.805..............571....222/.....*.70......*........./958..........%.........&.../....61.....*...73.......
.......280.................................=.861......-.........144...........950................%.......907......910.......396.............
.....+.........592*149.820*511...........298....&.......*264..........-..527..............-.....679.......*...............@......50*270.....
...901......=....................@483.............$..936......625%...619....%..........748...............785...860......26..181.........747.
.........85..640...#........=.=.......49.......216.............................268*.............................#...........#.....53....*...
...........+.......744...933...766....*.................%...............*714.......909................................999...........*...311.
.............783....................947.................352...765..............897.....+430..869.................121.%............236.......
...45....*......*..752......617..................332...........*...236...........*..........*....@.528..........&......530..................
..../.134.713.871..*.............*...........#.....%.930...........*....323....377........678.544..*........542.........$.......470.629*786.
..................259...&.....959.225......177.......*.....912*..........$.........................306..996.*....*.........*681...*.........
..........250*768......598.........................850.........598..............3*.........904*648........=.372...197...410......152...=....
............................................507@.......960..............362.164...131...................................................115.
.....746.......117..678=........952...303*.......+......................./..*...........$636../...597......37................351...=........
.......*.281...@...................*......337.258..814...687.....#922.=....772..611.153.......573....*.......*..............*.......518.....
....144.....*.......396...........240................+......*.........45.......+.......*...........479.&293..126.....784-...783.............
...........843...@....*..918*.............................986.....542...................117.....................................578.707.....
..984.............251........258....597$.650.........................*..................................928.409.684...547.......*....%......
....&..489....931...........................$....356........................489..............302...............*............./...259.../996.
......./........*.................................*......385........63*911...*.........%........*578...633.175.........@804..421............
..98...........188..........226....+...............909....*...................535.....798................$....*.796.........................
....*.....%...................+....531...563...........426......617*202.........................929-.......439....%..332.....+.23&.347......
...364..149..............425............*.....662.481.......................788..$844..................506..........@.....693......&........
..........................*....408...772....+.......-.......232*......*......*.............#.+294.....*.....706................435..........
......566*972........631=.425.*...........14............984.....667..7.236....195..9.....222........757......*.....865..604&..*....344.&....
.................439..........710..............477*714..............................*544........368............395*...........435...*..204..
..........229......+..596.179........../................165.542*47........147..............653..*...................466...........119.......
.....690...@............@.......467..626........&......*.................*....=42.....724....+.816....262*.....237.@....549.383.............
......*.........750..............*..............202....967.914......279..................*........./......147.@...............*........480..
...444.......84...#....+..........527......*351..............*......*................225..888.......806.............7......#...518.....*....
.............*........628...............749......*976.200.....852..354...23....=........*...............................138............833..
..........964.................................211...............................578.....986.............879......59.........................

10
2023/day3.test Normal file
View file

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

204
2023/day4.input Normal file
View file

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

6
2023/day4.test Normal file
View file

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

224
2023/day5.input Normal file
View file

@ -0,0 +1,224 @@
seeds: 3136945476 509728956 1904897211 495273540 1186343315 66026055 1381149926 11379441 4060485949 190301545 444541979 351779229 1076140984 104902451 264807001 60556152 3676523418 44140882 3895155702 111080695
seed-to-soil map:
2122609492 2788703865 117293332
751770532 1940296486 410787026
2652142963 2905997197 464992562
3442443139 3721315963 573651333
3117135525 2356966701 133002244
742051533 3370989759 9718999
2239902824 720032349 393589935
1162557558 58715335 661317014
1823874572 2489968945 298734920
2633492759 2351083512 5883189
4016094472 3442443139 278872824
58715335 1256960288 683336198
3250137769 1126389299 130570989
2639375948 1113622284 12767015
soil-to-fertilizer map:
1839905294 2992775329 34548650
266781855 3027323979 163164353
1874453944 1681649719 388228515
671359508 847997583 161400465
0 2547368955 266781855
3203005759 3207454799 385245393
832759973 813886658 34110925
3671840261 3598096086 304246395
1377823717 351805081 65559824
1443383541 417364905 396521753
3985931590 3902342481 309035706
2954410911 2069878234 236077421
2262682459 2814150810 19476781
429946208 2305955655 241413300
3981482550 3203005759 4449040
3976086656 3592700192 5395894
1026018636 0 351805081
2282159240 1009398048 672251671
866870898 2833627591 159147738
3588251152 4211378187 83589109
fertilizer-to-water map:
2408925737 4214441342 80525954
1405678964 176700146 234310964
2103148712 0 114754845
289811242 411011110 140151672
19025194 1085844786 2698717
2799367899 3104502118 25793488
3686730518 3130295606 74796096
628099810 1273935988 19704264
1112219380 661022482 39037869
467844674 876473087 160255136
1356562401 1036728223 49116563
0 2195479548 19025194
1778400105 1801270370 10408868
3201290155 3772851666 86331548
1795901930 1713284032 67001953
1151257249 1907547144 205305152
4156855349 4121566803 26796069
160254887 2112852296 19696655
1788808973 114754845 7092957
1639989928 1780285985 20984385
3990635607 2938282376 166219742
2864292987 3316407580 74613579
3761526614 4148362872 26946870
2048296368 121847802 54852344
3054903767 3975180415 146386388
21723911 737942111 138530976
647804074 1811679238 95867906
3580274539 3391021159 106455979
2489451691 2628366168 309916208
1049288783 2132548951 62930597
4183651418 3205091702 111315878
3360834108 2408925737 219440431
743671980 1293640252 305616803
3287621703 3699639261 73212405
2938906566 3859183214 115997201
429962914 700060351 37881760
1775001290 2214504742 3398815
3788473484 3497477138 202162123
2825161387 4175309742 39131600
1660974313 1599257055 114026977
1862903883 1088543503 185392485
179951542 551162782 109859700
water-to-light map:
2182426048 2230942562 75597875
3871195410 3518497934 102047632
2258023923 1068663414 38503018
1376483871 1748535271 120845081
3267723970 3442138354 23090394
3687599530 4146748183 69194895
1687874044 1117179928 229976398
1024656105 0 9213951
2036492700 1503963494 145933348
1339060619 127856209 37423252
3600067928 3079307704 87531602
3778928632 3171781100 38997592
485121354 165279461 136305184
1266011073 1649896842 73049546
1917850442 9213951 118642258
2296526941 1107166432 10013496
3973243042 2847069441 75895604
3177917323 2989501057 89806647
136410837 1347156326 156807168
4049138646 3166839306 4941794
3817926224 3465228748 53269186
2631950731 2587548926 259520515
478937106 2064525337 6184248
3756794425 2922965045 22134207
621426538 487303746 242996590
3299937194 3372641330 69497024
1240422190 1722946388 25588883
1497328952 1873980245 190545092
2587548926 2945099252 44401805
864423128 2070709585 160232977
1033870056 1869380352 4599893
2891471246 3629668396 286446077
1158126414 866711173 82295776
4054080440 3210778692 62083789
1038469949 949006949 119656465
0 730300336 136410837
4116164229 3272862481 99778849
3290814364 3620545566 9122830
3369434218 3916114473 230633710
293218005 301584645 185719101
light-to-temperature map:
2047881931 2133163196 61773729
2768352591 2658645540 147815435
663892205 789634091 62723057
962320572 2260439344 13990400
4174477469 3668516433 35699725
3949428604 3175207948 225048865
2918680909 3704216158 118365848
976310972 47881164 71382440
736841121 215530327 84565848
1481137268 593966122 45807826
3406939292 2891251077 174249820
2916168026 3907788997 2512883
854252812 1457767969 108067760
2658645540 3065500897 109707051
0 1842095595 291067601
821406969 119263604 32845843
2182554848 897903253 121629531
1047693412 1565835729 166620621
3847603798 3400256813 16617815
1259860138 152109447 53195021
3581189112 3424865230 243651203
1470195525 1364566318 10941743
653613314 30205504 10278891
1430142037 1324512830 40053488
291067601 1773419829 68675766
2109655660 2194936925 65502419
1856219803 2274429744 191662128
359743367 300096175 293869947
3398948690 3416874628 7990602
3864221613 3822582006 85206991
2609164425 1750403060 23016769
1707010741 2466091872 49002444
1756013185 1732456350 17946710
1214314033 852357148 45546105
1313055159 2515094316 117086878
2175158079 40484395 7396769
3824840315 3910301880 22763483
1526945094 639773948 149860143
2304184379 1019532784 304980046
3037046757 3933065363 361901933
1773959895 1375508061 82259908
726615262 205304468 10225859
1676805237 0 30205504
4210177194 2806460975 84790102
temperature-to-humidity map:
2704404081 3383155981 190240562
3678765766 3078657339 304498642
2894644643 2740175301 304339717
3375985319 2704404081 35771220
3198984360 3840405770 142858638
3341842998 3044515018 34142321
3411756539 3573396543 267009227
humidity-to-location map:
3843755612 3461421206 53203349
3797023193 2837279508 46732419
1328442859 1820435049 165058603
2358032500 2069263501 110029787
776537476 129658954 20092280
2041812400 3514624555 271685061
4004991793 2179293288 239800545
1813819309 1372459189 171674343
890079235 609776153 19282104
129748073 629058257 107944033
2472688430 2519585064 209661612
1039983756 866750363 166281406
3896958961 2729246676 108032832
1004757286 149751234 35226470
850718450 90298169 39360785
3150066893 4231246292 63721004
0 737002290 129748073
909361339 1154885545 95395947
2682350042 2911243637 44822034
318816223 1586615093 233819956
796629756 531466240 54088694
705961941 460890705 70575535
3669300252 2884011927 27231710
4244792338 3015820858 50174958
3352063456 3786309616 317236796
552636179 0 75876832
3213787897 4103546412 55695414
294595004 585554934 24221219
2799176542 3110530855 350890351
1691965533 1033031769 121853776
2468062287 2956065671 4626143
2727172076 4159241826 72004466
1493501462 262426634 198464071
280173667 75876832 14421337
1986683356 2960691814 55129044
628513011 184977704 77448930
2313497461 3065995816 44535039
1206265162 1250281492 122177697
3269483311 1986683356 82580145
237692106 1544133532 42481561
3696531962 2419093833 100491231

36
2023/day5.test Normal file
View file

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

2
2023/day6.input Normal file
View file

@ -0,0 +1,2 @@
Time: 48 87 69 81
Distance: 255 1288 1117 1623

1000
2023/day7.input Normal file

File diff suppressed because it is too large Load diff

6
2023/day7.test Normal file
View file

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

716
2023/day8.input Normal file
View file

@ -0,0 +1,716 @@
LRRLRRLLRRRLRRLRLRRRLRRLRRRLRLLRRRLRRRLRLRRRLRRLRRLRLRLLLRRRLRRRLRRLRRLRLRRRLRRLLRRLRRLRLLRLRLRRLRLLRLRLRRRLRRLRLLRLRLLRRLRLRRLLLRLRRLRRRLLLRRLRLRRRLLRRLLLRRRLRRRLLLRRLLRLRRLRLRRLLLRLRRLLLLRRLLRRRLRRLRRLRLRLLRLRRRLLRRLLRRLRRLRRLRRLRLLRRLRRRLRLRLLLRRRLLRRRLRRLRRLLLLRRRR
VRN = (CSM, GPD)
XDT = (QBK, PJR)
HVC = (MKM, TJS)
KRH = (BHN, PXB)
GTX = (VFD, TXR)
BQB = (MQV, PFQ)
TDV = (VSG, MJX)
VJM = (QHP, XMB)
KLG = (QLJ, HCV)
TSM = (JPG, DNP)
KHS = (QNR, DXJ)
FXM = (PHF, PHF)
RMV = (BMM, KHS)
QXL = (BKG, TLP)
MHS = (QXL, CFQ)
TBT = (TVT, BRD)
QXS = (GPP, RND)
XLL = (JHQ, LDV)
PBQ = (VXK, RJR)
FXB = (HMN, THX)
DPF = (GLX, GNC)
HVG = (HJF, SCH)
QMN = (DQJ, GMN)
MBS = (PFX, JHG)
VGL = (FHX, CCK)
QLV = (BLT, FDR)
MNS = (BDB, BMJ)
MMT = (TSM, SFR)
NRP = (FKB, QPH)
XFQ = (GTS, CCQ)
XFF = (HKG, NVL)
TXR = (VHQ, CKP)
VPL = (GHC, VMT)
SGC = (BGM, MJV)
SMS = (GJV, LSC)
BVC = (PRH, FJJ)
JHQ = (VJQ, XTX)
RJF = (GKK, NKX)
RJR = (JJQ, JTK)
VHQ = (JPS, JPS)
SFR = (JPG, DNP)
RDP = (GPD, CSM)
GGQ = (MVX, XBP)
XGK = (GBB, VPH)
XBH = (PTH, GSL)
MKG = (RBP, MGG)
FSG = (KFC, RMB)
NHC = (RQG, CVF)
SSV = (MVF, QFP)
RLP = (FXC, HCP)
FBZ = (FJF, CRJ)
HFL = (FKB, QPH)
NBM = (QBD, XGK)
NSP = (QKG, NDN)
TQF = (RMH, TDB)
RBB = (QTC, HPT)
CVF = (BSV, VTR)
XQG = (LFJ, JXD)
KXF = (CRJ, FJF)
MQC = (MQL, BSL)
RCC = (NHC, QLC)
TNT = (VKQ, NSX)
TVN = (NDN, QKG)
SCH = (FXB, NTM)
CVD = (XLJ, XDT)
QVF = (MQR, RDB)
GXS = (HCK, SHD)
KBD = (JHG, PFX)
KXV = (HVQ, QCJ)
MQR = (RNQ, SVC)
CBC = (SXB, BVC)
GKK = (HDR, LTF)
FRT = (CFQ, QXL)
VMT = (SQQ, DBB)
QPV = (NVQ, VVV)
XGD = (MPL, PMQ)
MNT = (JDD, NQC)
RGT = (QHD, SQP)
HXV = (RQD, RRX)
LGR = (FHX, CCK)
PHF = (CBV, TMC)
BTP = (JSC, QMN)
CXS = (SCH, HJF)
MQV = (FGJ, QPD)
HRZ = (CCX, BCF)
DDB = (DJK, CVD)
XNL = (QLJ, HCV)
GLX = (MGN, CFV)
QCJ = (NDK, XBR)
XBX = (CQM, VKD)
QPH = (XBH, CFG)
NSL = (LFJ, JXD)
DJQ = (VMN, STS)
RNV = (XFF, KSR)
JTR = (QLG, XRD)
VVV = (MDH, KHK)
TLR = (DMH, NXC)
GBH = (GLS, XLK)
LRN = (QRM, FMC)
BRM = (DCK, DSK)
GQS = (FXV, QPV)
XMT = (NHF, RXG)
KLR = (HFN, KDR)
SVH = (RMR, JLC)
QSG = (KQC, CMH)
VVX = (XGM, FNX)
BCF = (LNR, MTS)
RPJ = (RCC, CKG)
JJD = (NRP, HFL)
FGP = (MFS, RBB)
BJX = (BTD, KSC)
PQC = (VMN, STS)
JPG = (RQL, CSQ)
SLK = (JJC, BPJ)
JTK = (XHN, BFH)
HCV = (BRF, VPT)
VPH = (BVS, RRT)
MSH = (JQF, XFJ)
JHL = (QPF, QPF)
FGD = (MPC, TVB)
DCB = (JBC, XFB)
RKN = (TSL, VQG)
QBQ = (QLV, NRT)
MQX = (JSX, MCV)
XHX = (FNX, XGM)
DTL = (JDM, BDX)
LST = (JHL, CQN)
VGR = (HQV, HRZ)
CTQ = (XCF, TJK)
SQP = (HHB, NBM)
RRL = (TSL, VQG)
NNM = (DDS, XSF)
KHK = (HSG, NDF)
MGN = (VXT, VGV)
TLB = (DPK, MLV)
NMM = (TRR, XJH)
SJG = (XRJ, XBX)
GSC = (RRL, RKN)
KDR = (PSJ, TBM)
LRP = (SQP, QHD)
DKF = (MVR, QQB)
FHC = (BPT, BKC)
PLT = (JGG, GGQ)
XRD = (HMH, PBQ)
RHP = (JPD, XVL)
MXF = (MQR, RDB)
DML = (BRD, TVT)
CKP = (JPS, RBS)
BFK = (BCL, TLK)
KSR = (NVL, HKG)
XQF = (BMM, KHS)
BVJ = (CBL, PLC)
BCS = (RQF, GTB)
JCC = (VTT, VPQ)
BCL = (BNV, PDB)
HCK = (DDB, CBX)
SVG = (FGD, VQL)
BLT = (XNK, LHM)
MVQ = (LRG, NPB)
RND = (QCK, QRN)
HFR = (FBT, CLS)
KNK = (XDS, BCK)
XBB = (BRM, FDC)
XGM = (FFC, GJX)
PTN = (TQF, QKP)
RNQ = (GSC, XKH)
TPT = (CMK, KXT)
HPL = (CKB, QLR)
MVX = (QSG, TKJ)
QFP = (RLP, RSF)
GXF = (LNB, VNJ)
QHD = (NBM, HHB)
KSS = (LLH, PFK)
MFD = (XGJ, GGS)
JJQ = (XHN, BFH)
JDD = (HXV, FVH)
CFR = (FXM, FXM)
FDR = (XNK, LHM)
DHG = (BRS, TLR)
TDB = (SBS, XBB)
BVS = (GQH, BFS)
DGZ = (TMC, CBV)
HQD = (JSC, QMN)
TMZ = (XFB, JBC)
BRF = (MBF, KGJ)
RQG = (VTR, BSV)
CSQ = (FTS, RHR)
FFJ = (QCL, CTQ)
XKH = (RRL, RKN)
VJQ = (BTL, GQS)
NGK = (JGG, GGQ)
RQN = (GVG, SJN)
GRR = (RNV, FHF)
LSR = (VBL, SLK)
VQG = (QBV, NJV)
BHK = (BVJ, LJR)
BRS = (DMH, NXC)
NKX = (LTF, HDR)
QBD = (GBB, VPH)
RGQ = (CLM, FHK)
VXX = (KRH, VGN)
KRF = (VFQ, SMN)
XFR = (XGD, RMM)
JGC = (JGM, PFR)
SHD = (DDB, CBX)
QKG = (QTS, GXP)
CDL = (GLX, GNC)
RBP = (HKK, CMN)
CLN = (HDG, BHM)
XFX = (RNV, FHF)
AAA = (DXX, SVG)
FXC = (MMT, KLS)
PTF = (SKF, SDF)
QPF = (RQF, RQF)
DTB = (HQV, HQV)
RRF = (FNV, MKG)
MGG = (HKK, CMN)
NDF = (KMD, FFH)
DVL = (RKL, CLC)
JRQ = (BXV, BRB)
HVM = (DRT, SSV)
BHM = (KNK, BPP)
TDT = (DPS, VCP)
JPC = (DCH, FHD)
RSF = (FXC, HCP)
KSX = (BVJ, LJR)
NLT = (LTB, QBQ)
SBD = (NKX, GKK)
VQL = (MPC, TVB)
JXD = (MLK, LHN)
XNN = (TNT, LPQ)
HMH = (RJR, VXK)
JGG = (MVX, XBP)
PTP = (MVQ, NPS)
FQC = (XQF, RMV)
FXT = (TDH, JGD)
RGP = (CPN, KGF)
BTD = (NKN, NTQ)
BGM = (NRJ, CJN)
RMM = (PMQ, MPL)
DQJ = (DPF, CDL)
TVT = (TFJ, VJM)
TGL = (CGS, SJG)
NHF = (HVC, LVM)
NMK = (GRR, XFX)
QRN = (MMP, XSL)
FFH = (DJQ, PQC)
PDJ = (NQC, JDD)
CGS = (XBX, XRJ)
NTQ = (RXX, FLX)
CFB = (TVC, PTP)
GXK = (FLC, GXS)
RBS = (DCB, TMZ)
CFQ = (TLP, BKG)
QHP = (KVX, GSG)
HDJ = (RPH, QPK)
VXT = (GXF, JKM)
NCM = (NJL, TGL)
HFN = (TBM, PSJ)
JGF = (CFB, NMC)
JDM = (CLN, PHJ)
DJS = (RMR, JLC)
RDB = (RNQ, SVC)
RRX = (HQD, BTP)
HHS = (MXF, QVF)
MMP = (GTX, HKC)
JRK = (KKP, PTN)
TRR = (VGD, HGC)
JKM = (LNB, VNJ)
BRD = (TFJ, VJM)
TLK = (BNV, PDB)
QTS = (CHL, LSR)
BPP = (XDS, BCK)
RXX = (BKP, TLS)
VFD = (VHQ, VHQ)
BQF = (DHG, DQC)
XDL = (QVF, MXF)
ZZZ = (SVG, DXX)
GGB = (LTB, QBQ)
QTN = (JHL, CQN)
BVK = (BHQ, SSG)
VGB = (BXV, BRB)
QLR = (XFR, KNM)
QBK = (KNC, VJX)
BMJ = (JLK, TDV)
FDC = (DSK, DCK)
XDS = (SMS, TVR)
GBC = (NGK, PLT)
HPT = (XHQ, SXT)
FHK = (JCC, FJS)
KNM = (RMM, XGD)
GTB = (KLR, JVZ)
VCT = (PTN, KKP)
LDV = (XTX, VJQ)
KTK = (MQV, PFQ)
TVC = (MVQ, NPS)
BXV = (XLL, KDL)
BFA = (BCF, CCX)
CCF = (CLM, FHK)
JGS = (VCP, DPS)
RVK = (MKJ, QLH)
FNX = (FFC, GJX)
XBP = (QSG, TKJ)
LMJ = (FPH, JVL)
HKG = (VXX, RNX)
KMD = (DJQ, PQC)
BRB = (XLL, KDL)
NDK = (DJS, SVH)
BSV = (XVC, QXS)
TLS = (FSJ, MNS)
CRJ = (SGC, RNH)
BNV = (QSF, FSG)
SMN = (MNK, QGN)
JVV = (TRN, DVL)
JJC = (HBT, RPJ)
KSB = (XVL, JPD)
JJT = (TLB, DTJ)
TSL = (QBV, NJV)
GNV = (GCS, JLR)
HJF = (FXB, NTM)
VMN = (CFR, CFR)
GVG = (XDL, HHS)
LNB = (HMP, XMP)
RTL = (FXT, RCT)
XVC = (RND, GPP)
GNS = (MFS, RBB)
XTG = (LRM, DKQ)
JVZ = (KDR, HFN)
QQB = (XTG, GFG)
HMN = (FHC, FMN)
XLC = (FXT, RCT)
CKG = (QLC, NHC)
NJB = (DVL, TRN)
VCP = (LRF, HPL)
KQJ = (MXH, MXH)
GJV = (TPT, QNJ)
CCX = (LNR, MTS)
DTJ = (MLV, DPK)
HDX = (JSX, MCV)
XRJ = (VKD, CQM)
DMH = (RGP, KPR)
QGN = (VRF, QDL)
JSC = (DQJ, GMN)
BPT = (LLB, XNN)
CJN = (JJT, PGM)
XDV = (XVD, HJH)
JHG = (LLF, MLJ)
NKN = (FLX, RXX)
TGP = (XJH, TRR)
TLP = (XLC, RTL)
HQT = (SSN, BPS)
BKP = (MNS, FSJ)
VPT = (KGJ, MBF)
JSJ = (PFK, LLH)
CBX = (DJK, CVD)
TJK = (VGL, LGR)
THP = (TGL, NJL)
NSX = (SQL, GNV)
JQF = (VDM, JJD)
SDF = (JPC, KRV)
XNK = (HDJ, MQJ)
DSD = (SJN, GVG)
SBS = (FDC, BRM)
FPH = (NCM, THP)
LMR = (KQJ, BGV)
VKQ = (SQL, GNV)
FMC = (CPV, GBC)
HHB = (QBD, XGK)
HVQ = (NDK, XBR)
KXT = (JKG, NLS)
GJX = (TVP, JTR)
JLT = (MHM, MSH)
VNJ = (HMP, XMP)
TDH = (JGF, GGD)
VPQ = (HDX, MQX)
SKF = (JPC, KRV)
NXT = (RXG, NHF)
TRN = (CLC, RKL)
RRT = (BFS, GQH)
JFJ = (SXB, BVC)
KBR = (CGD, JGC)
PGG = (HFR, TJJ)
CMK = (JKG, NLS)
CBV = (FCX, KBR)
GMN = (DPF, CDL)
BTL = (QPV, FXV)
PFX = (MLJ, LLF)
DCT = (XLK, GLS)
PGM = (DTJ, TLB)
NVL = (VXX, RNX)
RPD = (TLK, BCL)
QDL = (FFJ, SFH)
JVL = (THP, NCM)
NVQ = (MDH, KHK)
TMC = (FCX, KBR)
LPQ = (NSX, VKQ)
RHR = (PPL, LCD)
JSX = (DHM, PMS)
DPK = (KBD, MBS)
LTF = (PGG, QPN)
BPS = (GXK, HCM)
HKC = (VFD, TXR)
PXB = (RPN, BQF)
FLX = (TLS, BKP)
PJR = (VJX, KNC)
PDB = (QSF, FSG)
NMC = (TVC, PTP)
MLP = (MSH, MHM)
PMQ = (KXV, QFJ)
FKB = (XBH, CFG)
JRV = (SMN, VFQ)
SQL = (GCS, JLR)
DXX = (FGD, VQL)
XMM = (GMG, LRN)
PFK = (HDL, XFQ)
XSL = (GTX, HKC)
CLC = (JRQ, VGB)
LMH = (KXF, FBZ)
NMX = (KSC, BTD)
GTJ = (KLG, XNL)
THX = (FMN, FHC)
RMH = (XBB, SBS)
SSG = (MFD, KFP)
QNR = (RBG, HNG)
DSK = (LMJ, FRP)
GQP = (FXM, XVT)
MFS = (QTC, HPT)
VHX = (VBD, RDD)
SQS = (GTJ, MSR)
LJR = (CBL, PLC)
QSF = (KFC, KFC)
DHM = (VFJ, DTL)
MDH = (NDF, HSG)
SSN = (HCM, GXK)
HCM = (FLC, GXS)
PQX = (FGG, BXR)
DQC = (BRS, TLR)
KRV = (DCH, FHD)
FNH = (SKF, SDF)
LFJ = (LHN, MLK)
MVR = (GFG, XTG)
HBT = (RCC, CKG)
VKD = (NMK, PFV)
TKJ = (KQC, CMH)
MRH = (RHV, ZZZ)
CKB = (XFR, KNM)
BMM = (DXJ, QNR)
KDL = (JHQ, LDV)
VFJ = (BDX, JDM)
PLC = (PND, GNP)
MNK = (QDL, VRF)
MXT = (RMV, XQF)
TJS = (PTF, FNH)
PHJ = (BHM, HDG)
FSJ = (BDB, BMJ)
CFV = (VGV, VXT)
XVD = (CBF, SQS)
TFJ = (QHP, XMB)
CPV = (PLT, NGK)
VTR = (XVC, QXS)
BKC = (XNN, LLB)
NPS = (NPB, LRG)
FXV = (NVQ, VVV)
FTS = (PPL, LCD)
HMP = (QMD, SNX)
VBD = (DTB, DTB)
VFQ = (QGN, MNK)
KFP = (GGS, XGJ)
BHN = (RPN, BQF)
PFV = (GRR, XFX)
QMD = (MGK, XDV)
MLK = (RPD, BFK)
GFG = (DKQ, LRM)
NLS = (BQB, KTK)
XLK = (HVG, CXS)
LSC = (QNJ, TPT)
FNV = (RBP, MGG)
HKK = (RCX, MQC)
GPD = (NSL, XQG)
RQL = (RHR, FTS)
HDB = (GHC, VMT)
HJH = (SQS, CBF)
QTC = (SXT, XHQ)
TRS = (BXR, FGG)
MTS = (DML, TBT)
RHV = (DXX, SVG)
XVL = (FGP, GNS)
GSG = (RRF, CSP)
VBL = (JJC, BPJ)
CCK = (RJF, SBD)
QPN = (TJJ, HFR)
PRH = (TGP, NMM)
PQT = (TRS, PQX)
QKP = (RMH, TDB)
XMP = (SNX, QMD)
QPD = (KRF, JRV)
RQD = (HQD, BTP)
XVT = (PHF, DGZ)
GXP = (CHL, LSR)
LHM = (MQJ, HDJ)
STS = (CFR, GQP)
FJJ = (NMM, TGP)
MPC = (CCF, RGQ)
MKM = (PTF, FNH)
QVH = (VBD, VBD)
XMB = (KVX, GSG)
CHL = (VBL, SLK)
XBR = (DJS, SVH)
KPR = (CPN, KGF)
MQL = (KSB, RHP)
CQM = (PFV, NMK)
XHQ = (HCR, HVM)
FFC = (JTR, TVP)
FMN = (BPT, BKC)
SNX = (MGK, XDV)
KNC = (QVJ, NNM)
DPS = (LRF, HPL)
GBB = (BVS, RRT)
BFH = (XMM, XQL)
GLS = (HVG, CXS)
RXG = (LVM, HVC)
MPL = (QFJ, KXV)
NXC = (KPR, RGP)
NJV = (TVN, NSP)
LLB = (LPQ, TNT)
SXT = (HVM, HCR)
LLH = (HDL, XFQ)
MLV = (KBD, MBS)
CBF = (GTJ, MSR)
JBC = (KTX, QQG)
FLC = (SHD, HCK)
FRP = (FPH, JVL)
BHQ = (MFD, KFP)
LNR = (DML, TBT)
CSP = (MKG, FNV)
GHC = (SQQ, DBB)
NRT = (BLT, FDR)
VTT = (HDX, MQX)
HSG = (FFH, KMD)
VGA = (CBV, TMC)
KLS = (TSM, SFR)
PFQ = (FGJ, QPD)
MKJ = (JLT, MLP)
MFX = (RVK, NSF)
QNJ = (KXT, CMK)
QBV = (NSP, TVN)
MSR = (KLG, XNL)
NSF = (QLH, MKJ)
DKQ = (JDR, DQQ)
PLH = (RVK, NSF)
JKG = (BQB, KTK)
LVM = (MKM, TJS)
QLJ = (VPT, BRF)
FVH = (RRX, RQD)
MJX = (DCT, GBH)
QLH = (MLP, JLT)
NPB = (XMT, NXT)
HDL = (CCQ, GTS)
JPS = (DCB, DCB)
CQN = (QPF, BCS)
GNP = (DSD, RQN)
JLK = (MJX, VSG)
PMS = (DTL, VFJ)
BFS = (JGS, TDT)
XJH = (VGD, HGC)
VRF = (SFH, FFJ)
BCK = (SMS, TVR)
DRT = (QFP, MVF)
PND = (DSD, RQN)
VSG = (GBH, DCT)
VGV = (JKM, GXF)
FHD = (MXT, FQC)
GPP = (QRN, QCK)
BDX = (CLN, PHJ)
LLF = (HQT, DCL)
DXA = (HFN, KDR)
MCV = (DHM, PMS)
NTM = (HMN, THX)
JLC = (RDP, VRN)
HQV = (BCF, CCX)
NDN = (QTS, GXP)
QVJ = (DDS, XSF)
MQJ = (RPH, QPK)
FGJ = (KRF, JRV)
LHN = (BFK, RPD)
MXH = (RHV, RHV)
HGC = (DNN, PQT)
MHM = (XFJ, JQF)
JGD = (JGF, GGD)
FCX = (JGC, CGD)
GCS = (LST, QTN)
RCX = (BSL, MQL)
XGJ = (VCT, JRK)
SXB = (FJJ, PRH)
LRG = (XMT, NXT)
XSF = (LRP, RGT)
DNP = (CSQ, RQL)
RKL = (VGB, JRQ)
KVX = (CSP, RRF)
JPD = (FGP, GNS)
GNC = (MGN, CFV)
PFR = (MHS, FRT)
DCK = (LMJ, FRP)
KKP = (TQF, QKP)
XQL = (GMG, LRN)
QCL = (TJK, XCF)
TVP = (XRD, QLG)
HDR = (QPN, PGG)
HLN = (BHQ, SSG)
GGS = (VCT, JRK)
SJN = (HHS, XDL)
DBB = (BHK, KSX)
QPK = (MFX, PLH)
MBF = (NLT, GGB)
BDB = (TDV, JLK)
KSC = (NKN, NTQ)
CPN = (HDB, VPL)
TVB = (RGQ, CCF)
VJX = (NNM, QVJ)
FBT = (JLL, LMR)
TVR = (GJV, LSC)
RNX = (KRH, VGN)
RPH = (MFX, PLH)
VJA = (JBC, XFB)
CLS = (JLL, LMR)
PSJ = (DKF, MSL)
QLG = (PBQ, HMH)
DXJ = (HNG, RBG)
XFB = (KTX, QQG)
TJJ = (FBT, CLS)
KFC = (JRF, JRF)
XFJ = (JJD, VDM)
RCT = (TDH, JGD)
RNH = (BGM, MJV)
VGD = (PQT, DNN)
KQC = (JFJ, CBC)
PPL = (JSJ, KSS)
HCR = (DRT, SSV)
XLJ = (PJR, QBK)
PTH = (QVH, VHX)
RQF = (KLR, KLR)
MSL = (MVR, QQB)
NRJ = (PGM, JJT)
JLL = (KQJ, KQJ)
DCL = (BPS, SSN)
GTS = (MNT, PDJ)
BXR = (NMX, BJX)
CBL = (PND, GNP)
VXK = (JJQ, JTK)
BSL = (RHP, KSB)
NJL = (SJG, CGS)
DQQ = (XHX, VVX)
SQQ = (BHK, KSX)
KTX = (BVK, HLN)
QCK = (XSL, MMP)
SVC = (GSC, XKH)
BGV = (MXH, MRH)
GMG = (QRM, FMC)
KGJ = (NLT, GGB)
LRF = (QLR, CKB)
CMN = (RCX, MQC)
CGD = (JGM, PFR)
LCD = (JSJ, KSS)
HDG = (BPP, KNK)
DDS = (LRP, RGT)
LRM = (DQQ, JDR)
CMH = (CBC, JFJ)
GQH = (TDT, JGS)
BKG = (RTL, XLC)
RMR = (VRN, RDP)
MGK = (XVD, HJH)
FJS = (VTT, VPQ)
SFH = (CTQ, QCL)
XHN = (XQL, XMM)
BPA = (CRJ, FJF)
XCF = (VGL, LGR)
TBM = (MSL, DKF)
JLR = (LST, QTN)
QFJ = (HVQ, QCJ)
CCQ = (MNT, PDJ)
VGN = (PXB, BHN)
LTB = (QLV, NRT)
DCH = (MXT, FQC)
CFG = (PTH, GSL)
JRF = (KXF, KXF)
QRM = (CPV, GBC)
XTX = (BTL, GQS)
FHX = (SBD, RJF)
FHF = (KSR, XFF)
CSM = (NSL, XQG)
HCP = (MMT, KLS)
DJK = (XDT, XLJ)
QLC = (CVF, RQG)
MLJ = (HQT, DCL)
CLM = (JCC, FJS)
NQC = (HXV, FVH)
RDD = (DTB, VGR)
RPN = (DQC, DHG)
GSL = (QVH, VHX)
FGG = (NMX, BJX)
BPJ = (RPJ, HBT)
RBG = (NJB, JVV)
FJF = (SGC, RNH)
GGD = (CFB, NMC)
QQG = (HLN, BVK)
MVF = (RLP, RSF)
JGM = (MHS, FRT)
RMB = (JRF, LMH)
VDM = (HFL, NRP)
HNG = (NJB, JVV)
MJV = (CJN, NRJ)
DNN = (PQX, TRS)
JDR = (XHX, VVX)
KGF = (HDB, VPL)

10
2023/day8.test Normal file
View file

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

200
2023/day9.input Normal file
View file

@ -0,0 +1,200 @@
8 10 9 -2 -17 8 190 771 2208 5345 11753 24409 49063 97014 190779 375658 743112 1477240 2945141 5868120 11637263
-9 -16 -26 -42 -67 -89 -41 278 1345 4163 10710 24787 53710 111805 227699 459451 925644 1868703 3782952 7672020 15562542
28 51 96 170 284 469 798 1415 2573 4692 8485 15300 28049 53554 108059 229471 503402 1116673 2463878 5353430 11394522
10 16 22 28 34 40 46 52 58 64 70 76 82 88 94 100 106 112 118 124 130
8 24 56 121 238 431 742 1256 2137 3671 6309 10700 17701 28348 43769 65017 92798 127066 166454 207507 243680
3 13 33 61 105 197 418 951 2204 5084 11556 25688 55464 115742 232843 451380 844073 1525447 2670475 4539407 7510219
15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55
4 5 21 57 125 255 506 977 1818 3241 5531 9057 14283 21779 32232 46457 65408 90189 122065 162473 213033
5 12 36 95 219 453 862 1541 2644 4472 7720 14109 27863 58876 128976 283411 610443 1272472 2551916 4913291 9078231
2 19 48 88 142 226 378 659 1139 1866 2825 3907 4925 5735 6545 8524 14856 32421 74326 163554 338048
3 2 -4 -12 -13 15 119 394 1027 2386 5231 11268 24599 55319 127898 299662 699808 1609223 3620339 7952681 17068804
9 19 41 88 184 362 655 1088 1698 2633 4409 8432 17912 39299 84354 172945 336675 623603 1104781 1884372 3117140
11 10 7 2 -5 -14 -25 -38 -53 -70 -89 -110 -133 -158 -185 -214 -245 -278 -313 -350 -389
19 24 24 19 9 -6 -26 -51 -81 -116 -156 -201 -251 -306 -366 -431 -501 -576 -656 -741 -831
9 32 76 155 293 539 990 1835 3446 6555 12569 24088 45704 85172 155057 274974 474551 797258 1305258 2085449 3256879
4 22 61 126 216 323 429 496 442 104 -778 -2444 -4602 -5001 3844 41336 151368 424562 1035747 2304666 4791100
0 0 9 40 118 299 697 1509 3030 5661 9946 16758 27950 48215 89776 183216 400828 904162 2036175 4492208 9625134
13 25 39 60 106 222 501 1112 2341 4666 8915 16616 30800 57904 112321 227047 477565 1032763 2257999 4913736 10521598
6 22 40 69 146 357 871 2004 4337 8920 17613 33667 62784 115219 210184 385179 715340 1352050 2596670 5035253 9774610
2 9 16 23 30 37 44 51 58 65 72 79 86 93 100 107 114 121 128 135 142
-1 -2 -8 -29 -74 -137 -160 57 1057 4150 12265 31578 74476 164761 346652 700523 1371301 2621840 4937055 9232612 17279510
7 3 -1 -5 -9 -13 -17 -21 -25 -29 -33 -37 -41 -45 -49 -53 -57 -61 -65 -69 -73
18 35 77 152 275 474 797 1337 2301 4165 8004 16198 33941 72398 155095 330403 695128 1437759 2915603 5788900 11248491
7 28 76 166 310 512 772 1122 1725 3072 6312 13746 29508 60444 117184 215382 377075 632084 1019348 1588046 2398322
-3 10 34 68 126 257 565 1229 2528 4882 8928 15661 26685 44639 73889 121610 199423 325802 529526 854522 1366528
6 4 15 51 125 266 551 1157 2441 5079 10347 20719 41097 81174 159640 311114 596708 1118810 2039715 3601703 6142457
12 35 71 120 182 257 345 446 560 687 827 980 1146 1325 1517 1722 1940 2171 2415 2672 2942
-2 4 33 113 285 614 1209 2261 4127 7519 13909 26350 51070 100480 198753 392053 767092 1484370 2836777 5350987 9959291
-6 -2 3 9 20 44 93 183 334 570 919 1413 2088 2984 4145 5619 7458 9718 12459 15745 19644
12 25 49 95 174 290 437 612 857 1353 2630 6055 14955 37103 90000 211717 482514 1066813 2292543 4797075 9788236
-4 4 16 26 29 26 31 88 318 1047 3127 8672 22628 55944 131699 296469 640572 1332626 2675974 5196610 9773547
14 20 26 42 100 265 654 1485 3185 6596 13338 26437 51445 98542 186642 351540 662034 1251569 2380155 4556366 8781478
17 28 52 116 263 555 1079 1958 3381 5702 9728 17440 33609 69151 147721 318136 676961 1408280 2851676 5615220 10758379
27 38 47 50 36 -21 -161 -409 -683 -567 1192 7716 25976 70370 168856 372991 773719 1525352 2880909 5242830 9234076
9 24 52 89 130 174 242 430 1026 2727 7008 16735 37199 77905 155712 300326 563743 1036074 1871316 3328125 5832568
18 30 58 130 290 604 1169 2128 3710 6351 11024 20036 38775 79266 167002 353463 738166 1506184 2990058 5769178 10825356
23 37 62 108 193 352 660 1280 2553 5166 10476 21162 42594 85792 173866 355862 735855 1532471 3197482 6646280 13695427
-7 -9 1 33 93 192 372 760 1668 3760 8302 17494 34850 65539 116523 196223 313307 474021 677271 906407 1116355
4 13 35 70 118 179 253 340 440 553 679 818 970 1135 1313 1504 1708 1925 2155 2398 2654
13 32 68 135 266 535 1087 2173 4187 7702 13502 22607 36288 56069 83713 121189 170617 234188 314056 412199 530246
15 39 72 119 196 333 580 1029 1874 3542 6945 13932 28069 55954 109395 208956 389625 709697 1264414 2206485 3776346
23 48 100 198 372 668 1150 1905 3070 4928 8170 14508 27993 57733 123378 265976 568880 1196482 2462432 4942379 9645683
22 37 58 84 123 216 478 1175 2866 6656 14639 30679 61822 120915 231510 436964 817030 1517731 2805360 5166426 9499429
9 38 78 125 175 224 268 303 325 330 314 273 203 100 -40 -221 -447 -722 -1050 -1435 -1881
10 28 69 152 306 570 993 1634 2562 3856 5605 7908 10874 14622 19281 24990 31898 40164 49957 61456 74850
10 30 66 140 289 566 1040 1795 2928 4546 6762 9690 13439 18106 23768 30473 38230 46998 56674 67080 77949
10 33 71 120 172 215 233 206 110 -83 -405 -892 -1584 -2525 -3763 -5350 -7342 -9799 -12785 -16368 -20620
10 22 42 79 147 285 585 1232 2574 5271 10644 21490 43883 90886 189731 395088 813105 1645355 3271757 6413156 12459158
10 22 42 75 127 213 369 668 1240 2296 4156 7281 12309 20095 31755 48714 72758 106090 151390 211879 291387
-4 -11 -10 7 44 101 174 255 332 389 406 359 220 -43 -466 -1089 -1956 -3115 -4618 -6521 -8884
6 13 27 55 126 305 707 1511 2974 5445 9379 15351 24070 36393 53339 76103 106070 144829 194187 256183 333102
20 33 58 101 165 248 350 501 838 1791 4500 11709 29625 71674 165847 368562 789903 1638140 3296401 6452952 12322160
23 39 62 92 129 173 224 282 347 419 498 584 677 777 884 998 1119 1247 1382 1524 1673
8 23 43 75 141 283 577 1166 2326 4597 9059 17933 35875 72670 148631 305041 623716 1262615 2518947 4938203 9498009
5 6 14 50 148 354 723 1323 2267 3805 6514 11618 21442 39941 73131 129065 216721 342776 504702 677906 793712
17 39 77 145 271 506 944 1760 3284 6161 11714 22748 45250 91860 188860 390266 806371 1661427 3408743 6955423 14089337
8 11 17 19 16 30 134 493 1416 3421 7337 14514 27296 50072 91574 169956 324336 641639 1319313 2809709 6143224
20 40 82 157 276 450 690 1007 1412 1916 2530 3265 4132 5142 6306 7635 9140 10832 12722 14821 17140
26 51 92 152 243 410 767 1551 3215 6604 13286 26131 50219 94068 170936 299469 502108 798261 1187076 1611454 1890399
5 4 -3 -16 -37 -71 -118 -146 -26 614 2709 8433 22564 55138 126495 276803 584082 1198534 2408270 4765262 9325584
16 24 24 20 20 33 68 136 256 466 840 1512 2708 4787 8292 14012 23056 36940 57688 87948 131124
2 4 17 50 116 232 419 702 1110 1676 2437 3434 4712 6320 8311 10742 13674 17172 21305 26146 31772
9 21 50 100 171 262 381 562 889 1527 2760 5036 9019 15648 26203 42378 66361 100921 149502 216324 306491
13 19 47 108 224 444 870 1714 3432 7027 14700 31188 66405 140452 292753 598086 1193703 2323675 4409173 8156732 14720782
9 14 24 54 143 367 864 1895 3980 8163 16475 32679 63396 119726 219493 390258 673259 1128452 1840842 2928308 4551141
2 1 4 10 10 -19 -107 -262 -420 -378 302 2477 7844 19892 45891 100715 213678 440047 879496 1704492 3202470
23 51 106 201 353 596 998 1681 2859 4937 8750 16060 30476 59057 115120 223470 430907 828331 1597490 3107587 6107791
20 41 78 134 207 294 404 583 954 1767 3431 6461 11241 17567 24329 30972 45742 113631 394186 1354910 4215913
24 44 85 162 305 572 1065 1962 3594 6612 12299 23081 43291 80299 146385 262490 466732 834112 1520337 2853824 5518005
13 25 53 116 249 517 1041 2041 3906 7306 13366 23927 41924 71916 120808 198810 320683 507327 787771 1201630 1802099
21 36 51 65 78 93 132 286 825 2400 6393 15550 35227 75980 158961 326806 664625 1338584 2663715 5218371 10030592
-2 10 41 111 263 574 1177 2302 4346 7998 14498 26240 48213 91352 180004 367865 770694 1631114 3442799 7181181 14719595
18 37 69 128 236 416 695 1128 1861 3265 6203 12558 26282 55463 116296 240439 488096 970361 1885949 3579504 6631284
16 22 39 87 214 510 1121 2263 4236 7438 12379 19695 30162 44710 64437 90623 124744 168486 223759 292711 377742
9 12 25 49 89 160 301 608 1312 2951 6717 15102 33027 69744 142059 280147 539226 1025523 1957432 3810972 7658912
20 23 28 51 127 324 759 1624 3256 6337 12400 24960 51801 109240 229543 473023 946556 1830019 3410988 6125145 10594043
13 41 81 141 250 464 868 1574 2715 4435 6875 10155 14352 19474 25430 31996 38777 45165 50293 52985 51702
9 25 60 119 218 394 712 1273 2236 3882 6772 12095 22397 43107 85819 175561 367114 781429 1685305 3661271 7960379
4 -3 -16 -36 -64 -101 -148 -206 -276 -359 -456 -568 -696 -841 -1004 -1186 -1388 -1611 -1856 -2124 -2416
12 22 40 66 101 159 289 616 1428 3364 7800 17594 38458 81425 167274 334550 654272 1257026 2382572 4469306 8312199
16 36 62 92 124 156 186 212 232 244 246 236 212 172 114 36 -64 -188 -338 -516 -724
-7 -6 1 14 33 58 89 126 169 218 273 334 401 474 553 638 729 826 929 1038 1153
21 41 85 171 323 570 943 1470 2169 3039 4049 5125 6135 6872 7035 6208 3837 -795 -8595 -20689 -38453
0 2 3 7 42 189 631 1728 4124 8892 17723 33165 58918 100191 164127 260302 401304 603398 887283 1278947 1810626
6 27 66 133 252 474 900 1733 3392 6747 13590 27567 55991 113275 227215 450074 877438 1679215 3149022 5780661 10383546
9 31 60 105 196 390 771 1445 2548 4325 7416 13619 27615 60490 136517 305923 669051 1423011 2953492 6016853 12099022
10 10 21 57 143 333 754 1693 3747 8052 16589 32520 60419 106134 175917 274623 403748 562914 764993 1088463 1815555
0 11 47 123 250 438 717 1186 2100 4005 7931 15653 30030 55432 98265 167604 275944 440079 682119 1030655 1522082
4 2 5 13 19 5 -59 -207 -444 -647 -311 2028 9979 31542 83085 196006 427388 876388 1708621 3191415 5743531
21 28 30 24 16 36 154 489 1199 2436 4246 6390 8058 7444 1146 -16649 -55239 -128788 -258066 -472604 -813324
2 1 3 8 31 126 434 1265 3232 7490 16224 33728 68807 139949 285947 586660 1201702 2439383 4874513 9541916 18242623
11 15 11 0 -8 20 173 655 1882 4654 10510 22528 47110 97732 202274 416411 846705 1688621 3286965 6229712 11491728
22 34 53 83 132 217 384 759 1656 3781 8578 18756 39018 77011 144606 259984 452078 771652 1319659 2317357 4271044
-1 10 40 92 174 315 592 1169 2349 4640 8836 16114 28148 47241 76476 119887 182651 271302 393968 560632 783418
11 27 70 166 357 711 1348 2493 4581 8479 15978 30885 61394 125101 259370 542362 1135062 2364307 4885498 10000015 20273388
16 34 71 142 262 448 727 1148 1805 2912 5045 9795 21275 49208 114707 260357 566838 1179102 2346051 4478772 8233684
-1 3 10 20 33 49 68 90 115 143 174 208 245 285 328 374 423 475 530 588 649
8 19 45 96 187 347 635 1155 2072 3652 6373 11169 19859 35758 64343 113626 193536 313097 473469 653950 786771
16 27 57 113 198 323 534 953 1841 3719 7634 15727 32332 65876 131823 256818 484209 881806 1555374 2678560 4566449
6 15 32 61 113 206 365 622 1016 1593 2406 3515 4987 6896 9323 12356 16090 20627 26076 32553 40181
12 22 41 78 161 360 818 1788 3675 7089 12934 22598 38391 64551 109515 190999 347381 663416 1328773 2771447 5959410
20 37 57 82 120 202 409 905 1974 4070 7921 14798 27191 50372 95791 188266 381292 790377 1667237 3566548 7718806
13 31 51 84 169 384 851 1731 3207 5457 8622 12766 17791 23206 27605 27891 19281 389 -3571 134438 850205
12 30 69 155 343 727 1450 2720 4851 8376 14327 24862 44585 83254 161329 321456 652505 1340181 2773452 5766664 12017378
7 33 73 127 195 277 373 483 607 745 897 1063 1243 1437 1645 1867 2103 2353 2617 2895 3187
14 28 57 126 266 511 910 1580 2847 5550 11627 25187 54445 115233 237408 476507 934644 1797152 3395149 6309420 11538196
12 20 31 64 149 337 730 1545 3236 6713 13717 27432 53431 101047 185216 328782 565363 943750 1538049 2477213 4031782
4 9 15 22 30 39 49 60 72 85 99 114 130 147 165 184 204 225 247 270 294
8 16 40 86 162 281 478 850 1629 3313 6920 14505 30198 62187 126285 251980 492162 938034 1741020 3143748 5522366
16 27 42 65 100 151 222 317 440 595 786 1017 1292 1615 1990 2421 2912 3467 4090 4785 5556
6 20 54 122 238 416 670 1014 1462 2028 2726 3570 4574 5752 7118 8686 10470 12484 14742 17258 20046
9 24 58 124 248 479 909 1713 3230 6126 11716 22596 43907 85957 169853 339829 690242 1423895 2975313 6264575 13205537
10 30 69 129 215 346 572 997 1808 3310 5967 10449 17685 28922 45790 70373 105286 153758 219721 307905 423939
5 6 12 44 147 410 1009 2300 5014 10641 22129 45070 89636 173785 328969 611348 1125520 2076190 3879935 7401246 14436738
4 23 58 126 255 497 955 1823 3438 6343 11360 19672 32913 53265 83561 127393 189224 274503 389782 542834 742771
-3 3 14 23 25 25 43 111 257 471 648 503 -547 -3539 -10163 -23009 -45867 -84085 -144990 -238377 -377071
24 32 45 77 159 360 827 1863 4068 8584 17521 34717 67143 127585 239871 449153 842175 1587195 3012500 5760444 11088242
-1 -10 -11 17 100 263 524 900 1447 2377 4337 9008 20296 46552 104484 225721 467367 928352 1773957 3271571 5841540
7 9 21 54 125 261 505 927 1647 2882 5033 8829 15541 27268 47277 80348 133031 213663 331917 497560 717981
10 25 59 126 244 435 733 1209 2021 3494 6227 11208 19891 34148 55951 86561 124900 164655 189507 165690 30862
17 39 65 91 129 232 527 1254 2820 5913 11798 23063 45363 91274 188528 397238 845276 1799567 3807034 7968541 16464470
10 5 8 41 136 332 666 1164 1850 2805 4324 7237 13480 27024 55294 111236 216218 403981 725888 1257753 2108568
23 28 45 103 240 500 936 1633 2784 4889 9214 18760 40184 87465 188797 399575 827065 1677498 3345611 6582649 12805268
16 36 75 162 343 693 1348 2572 4878 9227 17344 32245 59237 108076 197887 368248 703127 1380167 2768016 5612597 11386394
9 25 48 72 98 137 208 331 515 741 940 966 564 -667 -3316 -8207 -16451 -29503 -49224 -77948 -118554
8 11 19 51 147 387 916 1974 3939 7405 13332 23309 39939 67244 110732 176273 266070 368619 437421 350083 -164985
1 18 58 126 237 431 788 1443 2601 4552 7686 12508 19653 29901 44192 63641 89553 123438 167026 222282 291421
6 14 44 113 249 499 946 1753 3263 6207 12115 24099 48316 96714 192312 379634 745628 1461428 2864106 5612169 10971811
3 -1 -4 15 107 376 1022 2428 5329 11117 22350 43537 82253 150582 266772 456790 755159 1204011 1848664 2727187 3850311
-2 11 36 86 184 371 731 1440 2846 5587 10754 20106 36344 63451 107105 175172 278286 430523 650176 960638 1391400
2 12 49 136 307 612 1119 1915 3118 4931 7803 12816 22494 42330 83446 166930 330518 638386 1194857 2162772 3787073
14 23 56 129 259 471 826 1484 2816 5579 11168 21959 41757 76363 134274 227530 372722 592175 915320 1380269 2035607
-3 10 37 93 208 427 810 1432 2383 3768 5707 8335 11802 16273 21928 28962 37585 48022 60513 75313 92692
14 26 51 89 140 204 281 371 474 590 719 861 1016 1184 1365 1559 1766 1986 2219 2465 2724
13 18 22 22 18 15 24 62 151 316 582 970 1492 2145 2904 3714 4481 5062 5254 4782 3286
2 9 33 96 243 556 1172 2313 4353 7978 14545 26820 50378 96085 184258 351319 660028 1214703 2183217 3828008 6548853
16 14 18 44 112 244 468 833 1440 2494 4382 7782 13808 24196 41536 69555 113456 180318 279562 423488 627888
26 51 102 207 421 842 1643 3133 5872 10895 20161 37455 70161 132626 252290 480413 910142 1705891 3149624 5711711 10156653
-8 -9 -5 6 26 57 101 160 236 331 447 586 750 941 1161 1412 1696 2015 2371 2766 3202
6 11 36 109 272 579 1093 1890 3099 5048 8652 16275 33429 71844 154659 324750 657532 1279953 2397844 4334305 7582398
12 13 19 49 142 372 874 1886 3822 7408 13943 25807 47456 87359 161694 301190 563352 1053519 1959875 3609765 6557578
3 11 30 60 101 153 216 290 375 471 578 696 825 965 1116 1278 1451 1635 1830 2036 2253
2 5 14 38 86 167 290 464 698 1001 1382 1850 2414 3083 3866 4772 5810 6989 8318 9806 11462
12 14 25 57 123 242 448 813 1520 3071 6796 15951 37865 87827 195703 416649 847748 1652956 3099403 5608869 9829151
11 19 46 109 234 461 861 1576 2893 5363 9976 18403 33316 58797 100847 168006 272095 429091 660146 992761 1462126
12 23 46 76 103 123 168 360 988 2610 6216 13584 28159 57134 115970 237426 488356 999153 2012874 3963868 7599263
10 27 58 116 238 503 1059 2170 4308 8331 15813 29644 55142 102218 189816 355285 674142 1300799 2549636 5050248 10033414
-1 -4 -11 -23 -41 -66 -99 -141 -193 -256 -331 -419 -521 -638 -771 -921 -1089 -1276 -1483 -1711 -1961
25 51 96 173 317 600 1159 2245 4300 8080 14874 26942 48463 87669 161677 307220 603675 1220565 2511928 5198007 10707121
6 28 60 95 122 126 88 -15 -210 -528 -1004 -1677 -2590 -3790 -5328 -7259 -9642 -12540 -16020 -20153 -25014
14 27 46 83 176 401 886 1840 3627 6937 13133 24885 47239 89311 166843 305910 548124 957743 1631160 2709319 4393682
16 28 49 81 128 208 369 702 1349 2526 4627 8552 16517 33764 71801 154073 325302 666144 1315301 2501803 4590846
28 43 66 110 191 336 602 1103 2052 3863 7434 14852 30927 66172 142094 299937 614308 1213403 2307810 4230074 7487335
17 21 36 76 171 394 901 1991 4208 8544 16875 32885 63920 124479 242406 469310 897323 1685023 3096214 5556282 9732049
20 27 37 61 114 218 416 815 1700 3806 8912 21041 48724 109025 234339 483377 958252 1830189 3377111 6037213 10483638
0 13 36 73 134 248 489 1018 2144 4402 8643 16149 28862 50022 85992 151103 279532 552483 1156778 2504561 5466066
7 5 0 -5 0 33 133 396 1045 2545 5774 12261 24502 46365 83595 144430 240339 386893 604780 920975 1370076
13 9 9 34 128 365 862 1820 3630 7095 13832 26934 52012 98876 184552 339505 621668 1148550 2168444 4210603 8385165
-5 -12 -23 -30 -18 35 158 387 765 1342 2175 3328 4872 6885 9452 12665 16623 21432 27205 34062 42130
5 9 17 39 105 283 715 1694 3815 8241 17147 34472 67267 128237 240613 447347 827905 1527761 2808205 5127421 9268133
25 37 57 106 230 518 1137 2397 4859 9508 18054 33532 61594 113281 210702 398013 761477 1464303 2804527 5307542 9869150
11 17 46 114 241 455 798 1334 2159 3413 5294 8074 12117 17899 26030 37278 52595 73145 100334 135842 181657
4 -1 -4 12 78 257 677 1583 3423 7014 13911 27274 53877 108552 223482 466589 976170 2023577 4123518 8225636 16048444
0 1 0 -3 -8 -15 -24 -35 -48 -63 -80 -99 -120 -143 -168 -195 -224 -255 -288 -323 -360
11 18 29 49 92 206 522 1339 3257 7370 15531 30701 57394 102230 174608 287511 458455 710594 1073993 1587081 2298296
13 15 9 -12 -48 -79 -45 193 934 2793 6973 15712 33032 66133 128347 245886 473338 927958 1861532 3802331 7819427
2 6 10 14 18 22 26 30 34 38 42 46 50 54 58 62 66 70 74 78 82
11 27 52 97 186 362 709 1407 2852 5898 12324 25725 53226 108808 219736 438752 866576 1692276 3264166 6213201 11668991
4 13 42 103 207 362 569 822 1123 1528 2245 3810 7372 15123 30914 61103 115686 209767 365428 614065 999261
15 21 37 86 203 434 831 1439 2272 3276 4278 4921 4586 2303 -3346 -14328 -33259 -63497 -109221 -175488 -268259
11 16 28 64 160 393 913 1979 3985 7464 13083 21703 34688 54819 88416 149606 268111 502480 961366 1836266 3450112
19 28 52 114 257 565 1198 2452 4861 9361 17538 31985 56799 98260 165752 273013 439839 694418 1076536 1641980 2468565
15 15 13 12 12 1 -45 -137 -191 184 2178 8829 27103 71775 172317 384631 810367 1627833 3140255 5849526 10566770
12 11 5 -6 -22 -43 -69 -100 -136 -177 -223 -274 -330 -391 -457 -528 -604 -685 -771 -862 -958
14 26 38 50 62 74 86 98 110 122 134 146 158 170 182 194 206 218 230 242 254
13 19 31 63 138 294 607 1239 2530 5172 10540 21334 42843 85426 169298 333601 653532 1273267 2471552 4797589 9360217
11 3 -4 4 47 149 343 691 1325 2507 4689 8539 14934 25131 41979 74636 152691 362315 929342 2395398 5968245
18 22 40 91 193 361 613 998 1668 3038 6128 13283 29669 66335 146381 317205 674569 1409654 2901085 5895585 11864268
11 37 82 161 309 586 1087 1974 3560 6490 12081 22905 43732 83003 155088 283716 507161 886051 1515060 2540273 4184711
25 39 52 67 92 144 269 587 1366 3134 6880 14520 30088 62684 133303 289715 637379 1401437 3047748 6514061 13642856
4 -4 -20 -50 -102 -185 -302 -435 -512 -331 602 3393 10381 26381 61265 135375 290656 612718 1272684 2603156 5230544
16 37 62 103 197 413 863 1725 3295 6108 11215 20791 39404 76543 151493 302640 605473 1208410 2406047 4790866 9565986
18 28 36 48 72 117 192 305 462 666 916 1206 1524 1851 2160 2415 2570 2568 2340 1804 864
6 31 75 155 307 590 1091 1932 3290 5463 9049 15351 27179 50290 95789 183908 349686 651191 1181055 2082235 3569067
13 24 44 80 152 311 679 1524 3380 7215 14639 28129 51229 88660 146248 230547 347999 503434 697670 923926 1162710
10 22 32 51 114 303 788 1898 4249 8981 18195 35742 68605 129235 239371 436181 782284 1383028 2418714 4208909 7345156
7 30 81 174 320 532 841 1335 2242 4084 7930 15770 31017 59118 108216 189751 318817 514002 796327 1186766 1701670
14 27 59 134 293 607 1198 2270 4163 7468 13293 23865 43815 82762 160259 314926 620952 1217673 2362755 4528740 8580085
8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88
8 0 -4 18 98 273 583 1076 1829 3005 4987 8667 16029 31260 62764 126655 252582 493110 938366 1738280 3135532
-3 4 19 42 73 112 159 214 277 348 427 514 609 712 823 942 1069 1204 1347 1498 1657
14 24 32 37 53 130 397 1139 2922 6787 14546 29230 55761 101947 179931 308262 514798 840698 1345812 2115835 3271653
7 23 56 112 206 369 661 1190 2131 3727 6237 9780 14024 17718 18228 11631 -5265 -28077 -27602 87844 547546
23 36 62 118 231 444 832 1544 2899 5581 11011 22063 44521 90194 183657 376560 777027 1608138 3321360 6812948 13832967
8 0 -5 4 43 136 319 644 1176 1961 2930 3727 3573 1607 -1170 4025 48104 214582 698717 1914790 4680631
6 17 37 64 93 116 122 97 24 -117 -349 -698 -1193 -1866 -2752 -3889 -5318 -7083 -9231 -11812 -14879
-2 -7 -2 33 136 369 821 1608 2870 4765 7460 11119 15888 21877 29139 37646 47262 57713 68554 79133 88552
18 20 30 66 151 310 570 972 1603 2653 4499 7817 13726 23977 41217 69385 114336 184842 294188 462668 721393
3 0 -3 -6 -9 -12 -15 -18 -21 -24 -27 -30 -33 -36 -39 -42 -45 -48 -51 -54 -57
16 28 38 46 52 56 58 58 56 52 46 38 28 16 2 -14 -32 -52 -74 -98 -124

60
2023/src/bin/day1.rs Normal file
View file

@ -0,0 +1,60 @@
use std::io;
use std::collections::HashMap;
use std::str::FromStr;
use regex::Regex;
fn main() {
let mut sum = 0u32;
let mut sum2: u32 = 0;
let digit_names: HashMap<&str, u32> = HashMap::from([
("one", 1),
("two", 2),
("three", 3),
("four", 4),
("five", 5),
("six", 6),
("seven", 7),
("eight", 8),
("nine", 9)
]);
let regex_string = digit_names.keys()
.fold("\\d".to_owned(), |a,b| a + "|" + b);
println!("Regex: {regex_string}");
let regex = Regex::from_str(&regex_string).expect("Invalid regex");
let get_digit = |m: regex::Match<'_>| {
let digit = m.as_str();
digit.parse::<u32>()
.map_or(None, |x| Some(x))
.or(digit_names.get(digit).copied())
.expect("Regex doesnt work")
};
for line in io::stdin().lines() {
let line = line.unwrap();
let line = line.trim();
let digits: Vec<_> = line.chars()
.flat_map(|digit| digit.to_digit(10))
.collect();
if let (Some(first), Some(last)) = (digits.first(), digits.last()) {
sum += first * 10 + last
}
let match1 = regex.find(line)
.map(get_digit);
let match2 = (0..line.len()).rev().filter_map(|pos| regex.find_at(line, pos)).next()
.map(get_digit);
if let (Some(first), Some(last)) = (match1, match2) {
sum2 += first * 10 + last
}
}
println!("Part 1: {sum}");
println!("Part 2: {sum2}");
}

100
2023/src/bin/day10.rs Normal file
View file

@ -0,0 +1,100 @@
use aoc::grid::{Grid, GridVec};
use std::iter::Iterator;
trait MoreGrid: Grid {
fn trace(&self, start: (usize, usize), start_direction: Direction) -> Option<usize> {
let mut position = start;
let mut direction = start_direction;
let mut count: usize = 0;
while let Some(new_position) = self.next_position(position, direction) {
count += 1;
let (x, y) = new_position;
position = new_position;
if start == position {
return Some(count);
}
if let Some(dir) = next_direction(direction.opposite(), self.char_at(x, y)) {
direction = dir;
} else {
return None
}
}
None
}
fn longest_loop(&self) -> Option<usize> {
if let Some(start) = self.find('S') {
vec![Direction::Top, Direction::Right, Direction::Bottom, Direction::Left]
.iter()
.filter_map(|dir| self.trace(start, *dir))
.max()
} else {
None
}
}
fn next_position(&self, current: (usize, usize), direction: Direction) -> Option<(usize, usize)> {
let (x, y) = current;
match direction {
Direction::Left => if x > 0 { Some((x - 1, y)) } else { None },
Direction::Right => if x + 1 < self.width() { Some((x + 1, y))} else { None },
Direction::Top => if y > 0 { Some((x, y - 1)) } else { None },
Direction::Bottom => if y + 1 < self.height() { Some((x, y + 1)) } else { None }
}
}
}
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
enum Direction {
Top,
Left,
Right,
Bottom
}
fn connections(ch: char) -> Option<(Direction, Direction)> {
match ch {
'|' => Some((Direction::Top, Direction::Bottom)),
'-' => Some((Direction::Left, Direction::Right)),
'L' => Some((Direction::Top, Direction::Right)),
'J' => Some((Direction::Left, Direction::Top)),
'7' => Some((Direction::Left, Direction::Bottom)),
'F' => Some((Direction::Bottom, Direction::Right)),
'.' => None,
_ => panic!("Invalid direction")
}
}
fn next_direction(from: Direction, ch: char) -> Option<Direction> {
if let Some(pair) = connections(ch) {
match pair {
(f, result) if f == from => Some(result),
(result, f) if f == from => Some(result),
_ => None
}
} else {
None
}
}
impl Direction {
fn opposite(self) -> Direction {
match self {
Self::Top => Self::Bottom,
Self::Bottom => Self::Top,
Self::Left => Self::Right,
Self::Right => Self::Left
}
}
}
impl <T: Grid> MoreGrid for T {}
fn main() {
let grid = GridVec::read();
println!("Part 1: {}", grid.longest_loop().expect("No solution") / 2);
}

64
2023/src/bin/day11.rs Normal file
View file

@ -0,0 +1,64 @@
use aoc::grid::{Grid, GridVec};
use itertools::Itertools;
fn find_galaxies(grid: &GridVec, empty_columns: &Vec<usize>, empty_rows: &Vec<usize>, expansion_factor: usize) -> Vec<(usize, usize)> {
let mut offset_y: usize = 0;
let mut empty_rows = empty_rows.iter();
let mut next_empty_row = empty_rows.next();
let mut galaxies: Vec<(usize, usize)> = Vec::new();
for y in 0..grid.height() {
if Some(&y) == next_empty_row {
offset_y += expansion_factor;
next_empty_row = empty_rows.next();
}
let mut offset_x: usize = 0;
let mut empty_columns = empty_columns.iter();
let mut next_empty_column = empty_columns.next();
for x in 0..grid.width() {
if Some(&x) == next_empty_column {
offset_x += expansion_factor;
next_empty_column = empty_columns.next();
}
if grid.char_at(x, y) == '#' {
galaxies.insert(galaxies.len(), (x + offset_x, y + offset_y));
}
}
}
galaxies
}
fn sum_galaxy_distances(galaxies: &Vec<(usize, usize)>) -> usize {
let mut sum: usize = 0;
for i in 0..galaxies.len() {
for j in 0..i {
let (ax, ay) = galaxies[i];
let (bx, by) = galaxies[j];
sum += if ax < bx { bx - ax } else { ax - bx };
sum += if ay < by { by - ay } else { ay - by };
}
}
sum
}
fn main() {
let grid = GridVec::read();
let empty_columns: Vec<_> = (0..grid.width()).filter(|x| grid.column(*x).all(|ch| ch == '.')).collect();
let empty_rows: Vec<_> = (0..grid.height()).filter(|y| grid.row(*y).all(|ch| ch == '.')).collect();
let galaxies = find_galaxies(&grid, &empty_columns, &empty_rows, 1);
let part1 = sum_galaxy_distances(&galaxies);
println!("Part 1: {part1}");
let galaxies = find_galaxies(&grid, &empty_columns, &empty_rows, 1000000 - 1);
let part2 = sum_galaxy_distances(&galaxies);
println!("Part 2: {part2}");
}

57
2023/src/bin/day12.rs Normal file
View file

@ -0,0 +1,57 @@
use std::iter::zip;
use aoc::{parsing, read_input};
use nom::{character::complete::{space1, newline}, Parser, bytes::complete::{take_while1, tag}, sequence::{tuple, terminated}, multi::{separated_list0, many0}};
use aoc::parsing::number;
fn matches(string: &str, groups: &Vec<usize>) -> bool {
let parts = string.split('.')
.filter(|s| !s.is_empty())
.map(|s| s.chars().filter(|ch| *ch == '#').count());
let group_iter = groups.iter();
let all_equal = zip(parts.clone(), group_iter).all(|(a, b)| a == *b);
parts.count() == groups.len() && all_equal
}
fn combinations(string: &str, groups: &Vec<usize>) -> usize {
if let Some(index) = string.find('?') {
let first = &string[..index];
let rest = &string[(index + 1)..];
let mut a = first.to_owned();
a.push('.');
a.push_str(rest);
let mut b = first.to_owned();
b.push('#');
b.push_str(rest);
combinations(&a, groups) + combinations(&b, groups)
} else if matches(string, groups) {
1
} else {
0
}
}
fn springs<'a>(input: &'a str) -> parsing::Result<'a, &'a str> {
take_while1(|ch| ch == '#' || ch == '.' || ch == '?').parse(input)
}
fn line<'a>(input: &'a str) -> parsing::Result<'a, (&'a str, Vec<usize>)> {
tuple((
terminated(springs, space1),
separated_list0(tag(","), number)
)).parse(input)
}
fn main() {
let input = read_input();
let (_, input) = separated_list0(newline, line).parse(&input).expect("Cannot parse input");
let mut sum: usize = 0;
for (str, groups) in input {
sum += combinations(&str, &groups);
}
println!("Part 1: {sum}");
}

41
2023/src/bin/day13.rs Normal file
View file

@ -0,0 +1,41 @@
use std::{io::stdin, cmp::min};
use aoc::grid::{Grid, GridVec};
fn main() {
let mut input = stdin().lines().map(|x| x.expect("Cannot read line"));
let mut sum: usize = 0;
while let Some(grid) = GridVec::read_one(&mut input) {
'outer: for i in 1..grid.width() {
let left = i;
let right = grid.width() - i;
let compare = min(left, right);
for k in 1..=compare {
if !grid.column(i - k).zip(grid.column(i + k - 1)).all(|(a,b)| a == b) {
continue 'outer;
}
}
sum += i;
}
'outer: for i in 1..grid.height() {
let top = i;
let bottom = grid.height() - i;
let compare = min(top, bottom);
for k in 1..=compare {
if !grid.row(i - k).zip(grid.row(i + k - 1)).all(|(a,b)| a == b) {
continue 'outer;
}
}
sum += 100 * i;
}
}
println!("Part 1: {sum}");
}

45
2023/src/bin/day14.rs Normal file
View file

@ -0,0 +1,45 @@
use aoc::grid::{GridVec, Grid};
fn main() {
let mut grid = GridVec::read();
for y in 0..grid.height() {
for x in 0..grid.width() {
if grid.char_at(x, y) != 'O' {
continue;
}
if let Some(open_y) = find_open_spot(&grid, x, y) {
grid.set_char_at(x, open_y, 'O');
grid.set_char_at(x, y, '.');
}
}
}
grid.print();
let mut sum = 0;
for y in 0..grid.height() {
let rocks = grid.line_at(y).chars().filter(|ch| *ch == 'O').count();
let weight = grid.height() - y;
sum += weight * rocks;
}
println!("Part 1: {sum}");
}
fn find_open_spot(grid: &GridVec, x: usize, y: usize) -> Option<usize> {
if y == 0 {
return None;
}
let mut new_y = y;
while new_y > 0 && grid.char_at(x, new_y - 1) == '.' {
new_y -= 1;
}
if new_y != y {
Some(new_y)
} else {
None
}
}

67
2023/src/bin/day15.rs Normal file
View file

@ -0,0 +1,67 @@
use std::collections::HashMap;
use aoc::read_input;
use itertools::Itertools;
use linked_hash_map::LinkedHashMap;
fn hash_hash(string: &str) -> usize {
let mut current = 0;
for ch in string.bytes() {
current += ch as usize;
current *= 17;
current = current % 256;
}
current
}
struct LensBox<'a> {
content: LinkedHashMap<&'a str, usize>
}
impl <'a> LensBox<'a> {
fn new() -> LensBox<'a> {
LensBox {
content: LinkedHashMap::new()
}
}
fn remove(&mut self, label: &str) {
self.content.remove(label);
}
fn add(&mut self, label: &'a str, power: usize) {
*self.content.entry(label).or_insert(power) = power;
}
fn focus_power(&self, box_index: usize) -> usize {
self.content.iter().enumerate().fold(0, |a, (lens_index, (_, focus))| a + (box_index + 1) * (lens_index + 1) * *focus)
}
}
fn main() {
let input = read_input();
let input = input.split(',').collect_vec();
let result = input.iter().map(|str| hash_hash(str)).fold(0, |a,b| a+ b);
println!("Part 1: {result}");
let mut boxes = HashMap::new();
for instruction in input.iter() {
let index = instruction.find(|ch| ch == '=' || ch == '-').expect("Invalid instruction");
let label = &instruction[..index];
let box_index = hash_hash(label);
let lens_box = boxes.entry(box_index).or_insert_with(|| LensBox::new());
if &instruction[index..=index] == "-" {
lens_box.remove(label)
} else {
let power = instruction[(index + 1)..].parse().expect("Invalid instruction");
lens_box.add(label, power)
}
}
let part2 = (0..=256)
.filter_map(|n| Some(boxes.get(&n)?.focus_power(n)) )
.fold(0, |a, b| a + b);
println!("Part 2: {part2}");
}

96
2023/src/bin/day16.rs Normal file
View file

@ -0,0 +1,96 @@
use std::{collections::{HashMap, HashSet}, cmp::max};
use aoc::grid::{GridVec, Grid};
use array2d::Array2D;
fn grid_position(grid: &GridVec, x: isize, y: isize) -> Option<(usize, usize)> {
if x < 0 || y < 0 {
return None;
}
let cur_x: usize = x.try_into().unwrap();
let cur_y: usize = y.try_into().unwrap();
if cur_x >= grid.width() || cur_y >= grid.height() {
return None;
}
return Some((cur_x, cur_y));
}
fn trace(grid: &GridVec, energized: &mut Array2D<bool>, cache: &mut HashMap<(isize, isize, isize, isize), ()>, mut x: isize, mut y: isize, mut dx: isize, mut dy: isize) {
let key = (x, y, dx, dy);
if let Some(cached) = cache.get(&key) {
println!("Cached result found for {:?}", key);
return *cached;
}
cache.insert(key, ());
let mut steps = HashSet::new();
while let Some((cur_x, cur_y)) = grid_position(grid, x, y) {
energized[(cur_y, cur_x)] = true;
let cur_ch = grid.char_at(cur_x, cur_y);
// println!("{x},{y} ({dx},{dy}) {cur_ch} ");
match cur_ch {
'/' => (dx, dy) = (-dy, -dx),
'\\' => (dx, dy) = (dy, dx),
'|' if dy == 0 => {
trace(grid, energized, cache, x, y - 1, 0, -1);
(dx, dy) = (0, 1);
}
'-' if dx == 0 => {
trace(grid, energized, cache, x - 1, y, -1, 0);
(dx, dy) = (1, 0);
},
'-' | '|' | '.' => {},
_ => panic!("Unknown character")
};
assert!(dx == 0 || dy == 0);
x += dx;
y += dy;
if !steps.insert((x, y, dx, dy)) {
println!("Loop detected, stopping");
break;
}
}
}
fn energized(grid: &GridVec, x: isize, y: isize, dx: isize, dy: isize) -> usize {
let mut energized = Array2D::filled_with(false, grid.height(), grid.width());
let mut cache = HashMap::new();
trace(&grid, &mut energized, &mut cache, x, y, dx, dy);
energized.elements_row_major_iter().filter(|energized| **energized).count()
}
fn main() {
let grid = GridVec::read();
let part1 = energized(&grid, 0, 0, 1, 0);
println!("Part 1: {part1}");
let mut part2 = 0;
let x_max: isize = grid.width().try_into().unwrap();
let y_max: isize = grid.height().try_into().unwrap();
for y in 0..y_max {
let a = energized(&grid, 0, y, 1, 0);
let b = energized(&grid, x_max - 1, y, -1, 0);
part2 = max(part2, max(a, b));
}
for x in 0..x_max {
let a = energized(&grid, x, 0, 0, 1);
let b = energized(&grid, x, y_max - 1, 0, -1);
part2 = max(part2, max(a, b));
}
println!("Part 2: {part2}");
}

3
2023/src/bin/day17.rs Normal file
View file

@ -0,0 +1,3 @@
fn main() {
}

163
2023/src/bin/day2.rs Normal file
View file

@ -0,0 +1,163 @@
use std::{io, cmp::max};
use std::io::Read;
use nom::{
branch::alt,
bytes::complete::tag,
IResult,
Parser,
multi::separated_list0,
sequence::{separated_pair, tuple},
combinator::map_res,
character::{streaming::digit1, complete::line_ending},
};
#[derive(Debug)]
struct Reveal {
red: usize,
green: usize,
blue: usize
}
#[derive(Debug)]
struct Game {
id: usize,
reveals: Vec<Reveal>
}
impl Game {
fn new(id: usize, reveals: Vec<Reveal>) -> Game {
Game { id, reveals }
}
fn is_valid(&self) -> bool {
self.reveals.iter().all(|reveal| reveal.is_valid())
}
fn min_cubes(&self) -> Reveal {
self.reveals.iter().fold(Reveal::new(), |acc, reveal| {
Reveal {
red: max(acc.red, reveal.red),
green: max(acc.green, reveal.green),
blue: max(acc.blue, reveal.blue)
}
})
}
}
impl Reveal {
fn new() -> Reveal {
Reveal { red: 0, green: 0, blue: 0 }
}
fn with_red(&self, red: usize) -> Reveal {
Reveal { red: self.red + red, green: self.green, blue: self.blue }
}
fn with_green(&self, green: usize) -> Reveal {
Reveal { red: self.red, green: self.green + green, blue: self.blue }
}
fn with_blue(&self, blue: usize) -> Reveal {
Reveal { red: self.red, green: self.green, blue: self.blue + blue }
}
fn with(&self, color: Color, count: usize) -> Reveal {
match color {
Color::Red => self.with_red(count),
Color::Green => self.with_green(count),
Color::Blue => self.with_blue(count),
}
}
fn is_valid(&self) -> bool {
self.red <= 12 && self.green <= 13 && self.blue <= 14
}
fn power(&self) -> usize {
self.red * self.green * self.blue
}
}
#[derive(Clone, Copy)]
enum Color {
Red,
Green,
Blue
}
impl From<&str> for Color {
fn from(value: &str) -> Self {
match value {
"red" => Color::Red,
"blue" => Color::Blue,
"green" => Color::Green,
_ => panic!("Invalid color")
}
}
}
fn color(input: &str) -> IResult<&str, Color> {
Parser::into(alt((
tag("red"),
tag("green"),
tag("blue")
))).parse(input)
}
fn number(input: &str) -> IResult<&str, usize> {
map_res(digit1, str::parse).parse(input)
}
fn color_count(input: &str) -> IResult<&str, (usize, Color)> {
separated_pair(
number,
tag(" "),
color
).parse(input)
}
fn reveal(input: &str) -> IResult<&str, Reveal> {
separated_list0(tag(", "), color_count)
.map(|list| {
list.iter().fold(Reveal::new(), |acc, (count, color)| {
acc.with(*color, *count)
})
})
.parse(input)
}
fn reveals(input: &str) -> IResult<&str, Vec<Reveal>> {
separated_list0(tag("; "), reveal).parse(input)
}
fn game(input: &str) -> IResult<&str, Game> {
tuple((
tag("Game "),
number,
tag(": "),
reveals,
))
.map(|(_, id, _, reveals)| Game::new(id, reveals))
.parse(input)
}
fn input_file(input: &str) -> IResult<&str, Vec<Game>> {
separated_list0(line_ending, game).parse(input)
}
fn main() {
let mut input = String::new();
io::stdin().read_to_string(&mut input).expect("Reading failed");
let (_, games) = input_file(input.as_str()).expect("Parsing failed");
let part1 = games.iter().filter(|game| game.is_valid()).fold(0, |acc, game| acc + game.id);
println!("Part 1: {part1}");
let part2 = games.iter().fold(0, |acc, game| acc + game.min_cubes().power());
println!("Part 2: {part2}");
}

81
2023/src/bin/day3.rs Normal file
View file

@ -0,0 +1,81 @@
use std::{io, cmp::min};
use regex::Regex;
#[derive(Debug)]
struct Grid {
lines: Vec<String>,
width: usize
}
impl Grid {
fn read() -> Grid {
let lines: Vec<String> = io::stdin().lines().map(|line| line.expect("Cannot read line")).collect();
let width = lines.first().map_or(0, |l| l.len());
let ok = lines.iter().skip(1).all(|line| line.len() == width);
if !ok {
panic!("Not all lines same length");
}
Grid { lines, width }
}
fn char_at(&self, x: usize, y: usize) -> char {
self.lines[y].chars().nth(x).expect("Invalid index")
}
fn height(&self) -> usize { self.lines.len() }
fn numbers<'a>(&'a self, line: usize) -> Vec<(usize, usize, usize)> {
let regex: Regex = Regex::new("\\d+").unwrap();
regex.find_iter(&self.lines[line])
.map(|x| {
let index = x.start();
let str = x.as_str();
let result = (index, index + str.len() - 1, str.parse::<usize>().expect("Must be numeric"));
result
})
.filter(move |(start, end, _)| self.has_adjacent_symbol(line, *start, *end))
.collect::<Vec<(usize, usize, usize)>>()
}
fn all_numbers<'a>(&'a self)-> impl Iterator<Item = usize> + 'a {
(0..self.height())
.flat_map(|l| self.numbers(l))
.map(|(_, _, num)| num)
}
fn has_adjacent_symbol(&self, line: usize, start: usize, end: usize) -> bool {
if start > 0 && is_symbol(self.char_at(start - 1, line)) {
return true;
}
if end + 1 < self.width && is_symbol(self.char_at(end + 1, line)) {
return true;
}
let xmin = if start > 0 { start - 1 } else { start };
let xmax = min(end + 1, self.width - 1);
if line > 0 && self.lines[line - 1][xmin..=xmax].contains(is_symbol) {
return true;
}
if line + 1 < self.height() && self.lines[line + 1][xmin..=xmax].contains(is_symbol) {
return true;
}
false
}
}
fn is_symbol(ch: char) -> bool {
ch != '.' && !ch.is_numeric()
}
fn main() {
let grid = Grid::read();
let part1 = grid.all_numbers().fold(0, |a, b| a + b);
println!("Part 1: {part1}");
}

68
2023/src/bin/day4.rs Normal file
View file

@ -0,0 +1,68 @@
use std::collections::HashSet;
#[derive(Debug)]
struct Card {
number: usize,
winning: HashSet<usize>,
numbers: Vec<usize>
}
impl Card {
fn new(number: usize, winning: HashSet<usize>, numbers: Vec<usize>) -> Self { Self { number, winning, numbers } }
fn winning_numbers(&self) -> usize {
self.numbers.iter().filter(|x| self.winning.contains(x)).count()
}
fn score(&self) -> usize {
let winners = self.winning_numbers();
if winners > 0 {
2usize.pow((winners - 1).try_into().unwrap())
} else {
0
}
}
}
mod parser {
use std::collections::{HashSet, hash_map::RandomState};
use nom::{IResult, multi::{many0, separated_list0}, Parser, sequence::{tuple, preceded}, bytes::complete::tag, character::complete::{multispace0, digit1}, combinator::map_res};
use nom::character::complete::multispace1;
use crate::Card;
fn number(input: &str) -> IResult<&str, usize> {
map_res(digit1, str::parse)(input)
}
fn list(input: &str) -> IResult<&str, Vec<usize>> {
preceded(multispace0, separated_list0(multispace1, number)).parse(input)
}
fn card(input: &str) -> IResult<&str, Card> {
tuple((
tag("Card"),
preceded(multispace1, number),
tag(":"),
list
.map(|list| HashSet::<usize, RandomState>::from_iter(list.iter().map(|x| *x))),
preceded(multispace0, tag("|")),
list,
multispace0
)).map(|(_, card_index, _, winning, _, given, _)| Card::new(card_index, winning, given))
.parse(input)
}
pub fn input(input: &str) -> IResult<&str, Vec<Card>> {
many0(card).parse(input)
}
}
fn main() {
let data = aoc::read_input();
let cards = parser::input(&data).expect("Parsing failed").1;
let part1 = cards.into_iter().fold(0, |a, b| a + b.score());
println!("Part 1: {part1}");
}

100
2023/src/bin/day5.rs Normal file
View file

@ -0,0 +1,100 @@
use aoc::read_input;
#[derive(Debug)]
struct MapEntry {
destination: usize,
source: usize,
length: usize,
}
impl MapEntry {
fn map(&self, input: usize) -> Option<usize> {
if input < self.source || self.source + self.length <= input {
return None
}
return Some(self.destination + ( input - self.source))
}
}
#[derive(Debug)]
struct Map {
entries: Vec<MapEntry>
}
impl Map {
fn map(&self, input: usize) -> usize {
self.entries.iter()
.find_map( |e| e.map(input))
.unwrap_or(input)
}
}
mod parser {
use aoc::parsing::number;
use nom::{IResult, sequence::{tuple, preceded, terminated}, character::complete::{newline, multispace1}, multi::{separated_list0, count}, error::Error, bytes::complete::tag};
use nom::Parser;
use crate::MapEntry;
fn map_entry(input: &str) -> IResult<&str, MapEntry> {
tuple((
number,
preceded(multispace1, number),
preceded(multispace1, number),
))
.map(|(a, b, c)| MapEntry{destination: a, source: b, length: c})
.parse(input)
}
fn map(input: &str) -> IResult<&str, crate::Map> {
terminated(separated_list0(newline, map_entry),newlines)
.map(|x| crate::Map{entries: x})
.parse(input)
}
fn map_with_title(title: &str) -> impl Parser<&str, crate::Map, Error<&str>>{
preceded(tuple((tag(title), tag(":"), newline)), map)
}
fn newlines(input: &str) -> IResult<&str, ()> {
count(newline, 2).map(|_| ()).parse(input)
}
fn seeds(input: &str) -> IResult<&str, Vec<usize>> {
terminated(preceded(tag("seeds: "), separated_list0(multispace1, number)), newlines)
.parse(input)
}
pub fn input(input: &str) -> IResult<&str, (Vec<usize>, crate::Map, crate::Map, crate::Map, crate::Map, crate::Map, crate::Map, crate::Map)> {
tuple((
seeds,
map_with_title("seed-to-soil map"),
map_with_title("soil-to-fertilizer map"),
map_with_title("fertilizer-to-water map"),
map_with_title("water-to-light map"),
map_with_title("light-to-temperature map"),
map_with_title("temperature-to-humidity map"),
map_with_title("humidity-to-location map")
))
.parse(input)
}
}
fn main() {
let data = read_input();
let (_, input) = parser::input(&data).expect("Stuff");
let (seeds, seed_soil, soil_fertilizer, fertilizer_water, water_light, light_temp, temp_humid, humid_location) = input;
let x = seeds.iter()
.map(|seed| seed_soil.map(*seed) )
.map(|soil| soil_fertilizer.map(soil) )
.map(|fert| fertilizer_water.map(fert) )
.map(|water| water_light.map(water) )
.map(|light| light_temp.map(light) )
.map(|temp| temp_humid.map(temp) )
.map(|humid| humid_location.map(humid) )
.min()
.expect("Need a solution");
println!("Part 1: {x}");
}

36
2023/src/bin/day6.rs Normal file
View file

@ -0,0 +1,36 @@
struct Race {
time: usize,
distance: usize,
}
impl Race {
fn calculate_distance(&self, charge: usize) -> usize {
let speed = charge;
let move_time = self.time - charge;
move_time * speed
}
fn ways_to_win(&self) -> usize {
(1..self.time).filter(|charge| self.calculate_distance(*charge) > self.distance).count()
}
}
/*
Time: 48 87 69 81
Distance: 255 1288 1117 1623
*/
fn main() {
let input = vec![
Race { time: 48, distance: 255 },
Race { time: 87, distance: 1288 },
Race { time: 69, distance: 1117 },
Race { time: 81, distance: 1623 },
];
let part1 = input.iter().map(Race::ways_to_win).fold(1, |a,b| a * b);
println!("Part 1: {part1}");
let input2 = Race { time: 48876981, distance: 255128811171623 };
println!("Part 2: {}", input2.ways_to_win());
}

172
2023/src/bin/day7-2.rs Normal file
View file

@ -0,0 +1,172 @@
use std::{error::Error, collections::HashMap, cmp::Ordering};
#[derive(PartialEq, Eq, PartialOrd, Ord, Debug, Clone, Copy, Hash)]
enum Label {
J,
Two,
Three,
Four,
Five,
Six,
Seven,
Eight,
Nine,
T,
Q,
K,
A
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd)]
struct Hand {
cards: [Label; 5]
}
struct WrongCardCount;
impl TryFrom<Vec<Label>> for Hand {
type Error = WrongCardCount;
fn try_from(value: Vec<Label>) -> Result<Self, Self::Error> {
let cards: [Label; 5] = value.try_into().map_err(|_| WrongCardCount)?;
Ok(Hand { cards })
}
}
mod parser {
use nom::{character::complete::{one_of, multispace1, newline}, Parser, combinator::{map_opt, map_res}, multi::{count, separated_list0}, sequence::{preceded, tuple}};
use aoc::parsing::number;
fn label(input: &str) -> aoc::parsing::Result<crate::Label> {
map_opt(one_of("23456789TJQKA"), crate::Label::from_char).parse(input)
}
fn hand(input: &str) -> aoc::parsing::Result<crate::Hand> {
map_res(count(label, 5), |vec| vec.try_into()).parse(input)
}
fn line(input: &str) -> aoc::parsing::Result<(crate::Hand, usize)> {
tuple((
hand,
preceded(multispace1, number)
)).parse(input)
}
pub fn input(input: &str) -> aoc::parsing::Result<Vec<(crate::Hand, usize)>> {
separated_list0(newline, line).parse(input)
}
}
impl Label {
fn from_char(ch: char) -> Option<Label> {
Some(match ch {
'2' => Label::Two,
'3' => Label::Three,
'4' => Label::Four,
'5' => Label::Five,
'6' => Label::Six,
'7' => Label::Seven,
'8' => Label::Eight,
'9' => Label::Nine,
'T' => Label::T,
'J' => Label::J,
'Q' => Label::Q,
'K' => Label::K,
'A' => Label::A,
_ => return None
})
}
}
impl Hand {
fn counts(&self) -> (Vec<usize>, usize) {
let mut result: HashMap<Label, usize> = HashMap::new();
for card in self.cards {
*result.entry(card).or_insert(0) += 1;
}
let jokers = result.remove(&Label::J).unwrap_or(0);
let mut values: Vec<usize> = result.values().map(|x| *x).collect();
values.sort_by(|a, b| b.cmp(a));
return (values, jokers);
}
fn value(&self) -> Value {
let (counts, mut jokers) = self.counts();
let mut counts = counts.iter();
let first = counts.next().unwrap_or(&0);
if first + jokers >= 5 {
return Value::Five;
}
if first + jokers >= 4 {
return Value::Four;
}
if first + jokers >= 3 {
jokers -= 3 - first;
let next = *counts.next().unwrap_or(&0);
if next + jokers >= 2 {
return Value::FullHouse;
}
return Value::Three;
}
if first + jokers >= 2 {
jokers -= 2 - first;
let next = *counts.next().unwrap_or(&0);
if next + jokers >= 2 {
return Value::TwoPair;
}
return Value::OnePair;
}
Value::HighCard
}
}
#[derive(PartialEq, Eq, PartialOrd, Ord, Debug)]
enum Value {
HighCard,
OnePair,
TwoPair,
Three,
FullHouse,
Four,
Five,
}
impl Ord for Hand {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
let value = self.value().cmp(&other.value());
if value == Ordering::Equal {
self.cards.cmp(&other.cards)
} else {
value
}
}
}
fn main() {
let input = aoc::read_input();
let (_, mut result) = parser::input(&input).expect("Parse error");
result.sort_by(|a,b| a.0.cmp(&b.0));
for (rank, (hand, _)) in result.iter().enumerate() {
println!("{}: {:?} {:?}", rank + 1, hand, hand.value());
}
let part1 = result.iter()
.enumerate()
.map(|(rank, (_, value))| (rank + 1) * value)
.fold(0, |a, b| a + b);
println!("Part 1: {part1}");
}

152
2023/src/bin/day7.rs Normal file
View file

@ -0,0 +1,152 @@
use std::{error::Error, collections::HashMap, cmp::Ordering};
#[derive(PartialEq, Eq, PartialOrd, Ord, Debug, Clone, Copy, Hash)]
enum Label {
Two,
Three,
Four,
Five,
Six,
Seven,
Eight,
Nine,
T,
J,
Q,
K,
A
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd)]
struct Hand {
cards: [Label; 5]
}
struct WrongCardCount;
impl TryFrom<Vec<Label>> for Hand {
type Error = WrongCardCount;
fn try_from(value: Vec<Label>) -> Result<Self, Self::Error> {
let cards: [Label; 5] = value.try_into().map_err(|_| WrongCardCount)?;
Ok(Hand { cards })
}
}
mod parser {
use nom::{character::complete::{one_of, multispace1, newline}, Parser, combinator::{map_opt, map_res}, multi::{count, separated_list0}, sequence::{preceded, tuple}};
use aoc::parsing::number;
fn label(input: &str) -> aoc::parsing::Result<crate::Label> {
map_opt(one_of("23456789TJQKA"), crate::Label::from_char).parse(input)
}
fn hand(input: &str) -> aoc::parsing::Result<crate::Hand> {
map_res(count(label, 5), |vec| vec.try_into()).parse(input)
}
fn line(input: &str) -> aoc::parsing::Result<(crate::Hand, usize)> {
tuple((
hand,
preceded(multispace1, number)
)).parse(input)
}
pub fn input(input: &str) -> aoc::parsing::Result<Vec<(crate::Hand, usize)>> {
separated_list0(newline, line).parse(input)
}
}
impl Label {
fn from_char(ch: char) -> Option<Label> {
Some(match ch {
'2' => Label::Two,
'3' => Label::Three,
'4' => Label::Four,
'5' => Label::Five,
'6' => Label::Six,
'7' => Label::Seven,
'8' => Label::Eight,
'9' => Label::Nine,
'T' => Label::T,
'J' => Label::J,
'Q' => Label::Q,
'K' => Label::K,
'A' => Label::A,
_ => return None
})
}
}
impl Hand {
fn counts(&self) -> Vec<usize> {
let mut result: HashMap<Label, usize> = HashMap::new();
for card in self.cards {
*result.entry(card).or_insert(0) += 1;
}
let mut values: Vec<usize> = result.values().map(|x| *x).collect();
values.sort_by(|a, b| b.cmp(a));
return values;
}
fn value(&self) -> Value {
let counts = self.counts();
let mut counts = counts.iter();
let first = counts.next().expect("Cannot be empty");
match first {
5 => Value::Five,
4 => Value::Four,
3 => {
let next = counts.next().expect("Cannot be empty");
if *next == 2 { Value::FullHouse } else { Value::Three }
}
2 => {
let next = counts.next().expect("Cannot be empty");
if *next == 2 { Value::TwoPair } else { Value::OnePair }
}
_ => Value::HighCard
}
}
}
#[derive(PartialEq, Eq, PartialOrd, Ord, Debug)]
enum Value {
HighCard,
OnePair,
TwoPair,
Three,
FullHouse,
Four,
Five,
}
impl Ord for Hand {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
let value = self.value().cmp(&other.value());
if value == Ordering::Equal {
self.cards.cmp(&other.cards)
} else {
value
}
}
}
fn main() {
let input = aoc::read_input();
let (_, mut result) = parser::input(&input).expect("Parse error");
result.sort_by(|a,b| a.0.cmp(&b.0));
for (rank, (hand, _)) in result.iter().enumerate() {
println!("{}: {:?} {:?}", rank + 1, hand, hand.value());
}
let part1 = result.iter()
.enumerate()
.map(|(rank, (_, value))| (rank + 1) * value)
.fold(0, |a, b| a + b);
println!("Part 1: {part1}");
}

107
2023/src/bin/day8.rs Normal file
View file

@ -0,0 +1,107 @@
use std::collections::HashMap;
mod parsing {
use nom::{Parser, sequence::{tuple, terminated}, character::complete::{newline, one_of}, multi::{many_till, separated_list0}, combinator::{map}, bytes::complete::{take, tag}};
use std::collections::HashMap;
fn instructions(input: &str) -> aoc::parsing::Result<Vec<char>> {
map(many_till(one_of("LR"), newline), |(result,_)| result).parse(input)
}
fn node(input: &str) -> aoc::parsing::Result<&str> {
take(3usize).parse(input)
}
fn map_line(input: &str) -> aoc::parsing::Result<(&str, &str, &str)> {
tuple((
terminated(node, tag(" = (")),
terminated(node, tag(", ")),
terminated(node, tag(")"))
)).parse(input)
}
fn parse_map(input: &str) -> aoc::parsing::Result<HashMap<&str, (&str, &str)>> {
map(separated_list0(newline, map_line), |list| {
let mut result = HashMap::with_capacity(list.len());
for (node, left, right) in list {
result.insert(node, (left, right));
}
result
}).parse(input)
}
pub fn input(input: &str) -> aoc::parsing::Result<(Vec<char>, HashMap<&str, (&str, &str)>)> {
tuple((
terminated(instructions, newline),
parse_map
)).parse(input)
}
}
type Map<'a> = HashMap<&'a str, (&'a str, &'a str)>;
struct Camel<'a> {
position: &'a str,
map: &'a Map<'a>
}
impl Camel<'_> {
fn new<'a>(position: &'a str, map: &'a Map) -> Camel<'a> {
assert!(position.len() == 3);
Camel { position, map }
}
fn go(&mut self, direction: char) {
let (left, right) = self.map.get(self.position).expect(&format!("Position {} not in map", self.position));
self.position = match direction {
'L' => left,
'R' => right,
_ => panic!("Invalid direction {direction}")
}
}
fn at_goal(&self) -> bool {
self.position.chars().nth(2).unwrap() == 'Z'
}
}
fn main() {
let input = aoc::read_input();
let (_, (instructions, map)) = parsing::input(&input).expect("Failed to parse");
let mut iter = instructions.iter().cycle();
let mut camel = Camel::new("AAA", &map);
let mut steps = 0;
while camel.position != "ZZZ" {
camel.go(*iter.next().unwrap());
steps += 1;
}
println!("Part 1: {steps}");
let mut camels: Vec<_> = map.keys().filter_map(|key| if key.chars().last().unwrap() == 'A' {
Some(Camel::new(key, &map))
} else {
None
}).collect();
println!("{:?}", camels.iter().map(|x| x.position).collect::<Vec<_>>());
let mut iter = instructions.iter().cycle();
let mut steps = 0;
while !camels.iter().all(Camel::at_goal) {
let direction = *iter.next().unwrap();
for camel in camels.iter_mut() {
camel.go(direction);
}
steps += 1;
}
println!("Part 2: {steps}");
}

42
2023/src/bin/day9.rs Normal file
View file

@ -0,0 +1,42 @@
use aoc::read_input;
use aoc::{parse_input, parsing::numbers};
use nom::multi::many0;
use nom::Parser;
fn next_element(list: &Vec<isize>) -> isize
{
if list.iter().all(|x| *x == 0) {
0
} else {
let last = list.last().expect("Cannot use with empty list");
last + next_element(&differences(&list))
}
}
fn previous_element(list: &Vec<isize>) -> isize
{
if list.iter().all(|x| *x == 0) {
0
} else {
let first = list.first().expect("Cannot use with empty list");
first - previous_element(&differences(&list))
}
}
fn differences(list: &Vec<isize>) -> Vec<isize>
{
use itertools::Itertools;
list.iter().tuple_windows().map(|(a, b)| b - a).collect()
}
fn main() {
let input = read_input();
let (_, lists) = many0(numbers).parse(&input).unwrap();
let part1 = lists.iter().fold(0, |a, b| a + next_element(b));
println!("Part 1: {part1}");
let part2 = lists.iter().fold(0, |a, b| a + previous_element(b));
println!("Part 2: {part2}");
}

150
2023/src/grid.rs Normal file
View file

@ -0,0 +1,150 @@
use std::{io, str::Chars, iter::FusedIterator};
use itertools::Itertools;
#[derive(Debug)]
pub struct GridVec {
lines: Vec<String>,
width: usize,
}
pub struct Column<'a> {
grid: &'a GridVec,
x: usize,
y: usize
}
impl <'a> Column<'a> {
fn new(grid: &'a GridVec, x: usize) -> Column<'a> {
Column { grid, x, y: 0 }
}
}
impl <'a> Iterator for Column<'a> {
type Item = char;
fn next(&mut self) -> Option<Self::Item> {
if self.y < self.grid.height() {
let result = self.grid.char_at(self.x, self.y);
self.y += 1;
Some(result)
} else {
None
}
}
fn size_hint(&self) -> (usize, Option<usize>) {
let len = self.len();
(len, Some(len))
}
}
impl ExactSizeIterator for Column<'_> {
fn len(&self) -> usize {
self.grid.height() - self.y
}
}
impl FusedIterator for Column<'_> {}
pub trait Grid where Self: Sized {
type ColumnIter<'a>: ExactSizeIterator<Item = char> + 'a where Self: 'a;
type RowIter<'a>: Iterator<Item = char> + 'a where Self: 'a;
fn new(lines: Vec<String>) -> Self;
fn read() -> Self {
let lines: Vec<String> = io::stdin().lines().map(|line| line.expect("Cannot read line")).collect();
Self::new(lines)
}
fn read_one<I>(input: &mut I) -> Option<Self>
where I: Iterator<Item = String>
{
let lines = input.take_while(|l| !l.is_empty()).collect_vec();
if lines.is_empty() {
None
} else {
Some(Self::new(lines))
}
}
fn char_at(&self, x: usize, y: usize) -> char {
self.line_at(y).chars().nth(x).expect("Invalid index")
}
fn set_char_at(&mut self, x: usize, y: usize, ch: char);
fn height(&self) -> usize;
fn width(&self) -> usize;
fn line_at(&self, y: usize) -> &str;
fn find(&self, ch: char) -> Option<(usize, usize)> {
for y in 0..self.height() {
if let Some(pos) = self.line_at(y).find(ch) {
return Some((pos, y));
}
}
None
}
fn column<'a>(&'a self, x: usize) -> Self::ColumnIter<'a>;
fn row<'a>(&'a self, y: usize) -> Self::RowIter<'a>;
}
impl Grid for GridVec {
type ColumnIter<'a> = Column<'a>;
type RowIter<'a> = Chars<'a>;
fn column<'a>(&'a self, x: usize) -> Self::ColumnIter<'a> {
Column::new(self, x)
}
fn row<'a>(&'a self, y: usize) -> Self::RowIter<'a> {
self.line_at(y).chars()
}
fn new(lines: Vec<String>) -> Self {
let width = lines.first().map_or(0, |l| l.len());
let ok = lines.iter().skip(1).all(|line| line.len() == width);
if !ok {
println!("Read lines: {:?}", lines);
panic!("Not all lines same length");
}
GridVec {lines, width }
}
fn char_at(&self, x: usize, y: usize) -> char {
self.lines[y].chars().nth(x).expect("Invalid index")
}
fn set_char_at(&mut self, x: usize, y: usize, ch: char) {
let line = &mut self.lines[y];
line.replace_range(x..=x, &ch.to_string());
}
fn height(&self) -> usize { self.lines.len() }
fn width(&self) -> usize { self.width }
fn line_at(&self, y: usize) -> &str {
&self.lines[y]
}
}
impl GridVec {
pub fn print(&self) {
for line in self.lines.iter() {
println!("{line}");
}
}
}

22
2023/src/lib.rs Normal file
View file

@ -0,0 +1,22 @@
pub mod parsing;
pub mod grid;
use std::io::{self, Read};
pub fn read_input() -> String
{
let mut input = String::new();
io::stdin().read_to_string(&mut input).expect("Reading failed");
input
}
pub fn parse_input<T, P>(parser: P) -> T
where for<'a> P: parsing::Parser<'a, T>
{
let mut parser = parser;
let input = read_input();
parser.result(&input).expect("Could not parse input")
}

23
2023/src/parsing.rs Normal file
View file

@ -0,0 +1,23 @@
use nom::{IResult, character::complete::{i64, u64, newline, space1}, combinator::map, error::Error, sequence::terminated, multi::separated_list0};
pub fn number(input: &str) -> Result<usize> {
map(u64, |x| x as usize)(input)
}
pub fn signed_number(input: &str) -> Result<isize> {
map(i64, |x| x as isize)(input)
}
pub fn numbers(input: &str) -> Result<Vec<isize>> {
use nom::Parser;
terminated(separated_list0(space1, signed_number), newline).parse(input)
}
pub type Result<'a, T> = IResult<&'a str, T>;
pub trait Parser<'a, T>: nom::Parser<&'a str, T, Error<&'a str>> {
fn result(&mut self, input: &'a str) -> std::result::Result<T, nom::Err<Error<&'a str>>> {
self.parse(input).map(|(_, result)| result)
}
}