Compare commits

...

18 Commits

Author SHA1 Message Date
7f398eed00 2023 - Day 25 2023-12-25 17:05:00 +01:00
7951f60e7f Improved day 24 solution 2023-12-25 01:01:29 +01:00
6233ade178 Fixed formatting 2023-12-25 00:41:27 +01:00
fbd9e84f5f 2023 - Day 24 2023-12-24 23:53:36 +01:00
72e4c18b31 2023 - Day 23 2023-12-24 16:26:54 +01:00
e1d2a785f5 2023 - Day 22 2023-12-23 03:53:04 +01:00
295bfed6b4 Optimzed the solution for day 21 and actually calculate the answer for part 2 in code 2023-12-22 01:59:35 +01:00
6aaca41194 Kinda did part 2 2023-12-21 16:21:24 +01:00
6195d1579a 2023 - Day 21 [Part 1] 2023-12-21 15:24:47 +01:00
7320181194 Properly solve day 20 part 2 2023-12-20 17:36:34 +01:00
fbceb13123 2023 - Day 20 [Part 2 works with manual help] 2023-12-20 15:26:09 +01:00
bd741d38d4 2023 - Day 19 2023-12-19 14:26:49 +01:00
800325b518 2023 - Day 18 2023-12-18 13:38:33 +01:00
6a69dd2a8f 2023 - Day 17 2023-12-18 00:03:45 +01:00
002c7ad007 2023 - Day 16 2023-12-17 23:42:27 +01:00
9004a8c891 2023 - Day 15 2023-12-15 11:34:00 +01:00
6416c98c73 2023 - Day 14 2023-12-15 10:24:10 +01:00
a9fe2fa9be 2023 - Day 13 2023-12-14 01:15:27 +01:00
43 changed files with 9653 additions and 4 deletions

View File

@@ -8,6 +8,8 @@ edition = "2021"
[dependencies]
anyhow = "1.0.75"
lazy_static = "1.4.0"
nalgebra = "0.32.3"
petgraph = "0.6.4"
regex = "1.10.2"
[features]

1385
2023/input/13/input Normal file

File diff suppressed because it is too large Load Diff

15
2023/input/13/test-1 Normal file
View File

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

100
2023/input/14/input Normal file
View File

@@ -0,0 +1,100 @@
...#.O.#.#.O.O....#...O....#..#........OO.O#...O..O#O#.......O.O....O.....#...OO#.O....OOO..OO#..#..
.##.....#.OOO.OO#...O.......O#..O.##OO.O.......O##....O....#O..O..#.#....#OO..#...O.O#.#...#....#O.O
O...##.O.O.O.O..#.#.....#O....#..#O..O...O..OO..O...##.......OO#..OOO..#O..#.O#.O......#..#O..O..O.O
..OO....OOO....O.O..OOO.....O........#...O.O.O.O..O#.O...O..#.#O........O.....#O...##....#...#.#....
##.O.O#..O..##O.....O.#.....O.O#O.O..#...#...OO.##OOO...OO#...O...O........O.#.O.........#O.#...#.#.
.#.O.O.....#..O###..O#.#..O....O.O....#...##.O..O.OOO..O.O..O#.O..O....#.#.O..#..##O...O....#O#.....
.......O...##..O..O##..##...O....###.O.#.#.O......O...O.O......#O.....#..O..O#..##O.O#O##O....O#....
.#O..#....##.##..O#..#..#..O........OO....#..##.O.#.O.O..OO.O.O#..#O##O......OO...O...OO...#....OO..
#.....O#......O#.....#..O...#O..OO..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....O
O.O..O..#......O.O.OO...OO..##.....OO.....#.O...O.#.#...OO..OO.O.........#O..#.O...O#.#..O..OO.##O..
..#.......O....#...#....##..O.O......O....O#.O..O..#.#.O#O.O.#...#.##.....O...O.O...O.#...O...O.#...
.O...#..O.....O.O.....OO.O.O.......O..O..........#...O..O..O......O....#OOO...O#O...#.O#........O...
.OO#....#.....O...#.###..#..O..O.....#O..#..OO...OOO#.O#..O#O........#..#.O..OOO#O#..O..OO........#.
..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.#...#O.O.OO...#.#OOO.#...O#....#.O.#
.....O.O...#OO#.OO#......#..O.O..#.OO.......#...#.O.O#.O.#O.O#..#O##..OO...#......#.O....#.....O.#O.
.O#OOOO...#.#..........O#.#.#.#.O....O..O...O...OOO.O.O.O..OO..O..O#.#...#....#...#O#.OO.O..#.O#....
OO#OO..#.O.#....#..#.#..#O#.O#O#.#..O.O....#..O...OO..O..#........#.O...O#.#.....#....O.....#.O.....
.O.....#...OO...#..O..#..O..O##..OO...O....#.O.#............###.O.#..O..O.........O..#.O..O.#OO.#...
.##O.#.O.#....O..O..#..O.#.O..##O..O......OO...#...O..OO#....O..O#O.##.OO#...O#...#.......O.O#.#OO..
.OO#O#...O..##.O......O..O.O....O...OOO.O..#...O#.#.O.OOO..#...#.##..OO..................OOOOO...###
.#..##...####.O#...O........O...#O..O..O....O##O..O..OO..#.....#...O.....OO......OOO.#..O.##OO##...#
....O#........O##.O...O#..#.O#O...O...O.O........#..#.#.O......O..#.....#.O..#.#..#..#O....O##...#..
.O..OO.O##..O...O.OO....O.OOO..#O#.O##......O.O#....O#O.O......#.O..#O..#O.........#..OO....#.OO..O.
.#OO..#OO.###........#...#..#.O..#O.O#O...O.#.....O...#......O.......#.O.#.##.O..#O.O###OOOO...#..O.
##...OOO.#..........O#...O#.....OO...O#..OO.OO.#.OOO..OO....O..OOO...##O...O.........##O...#.#O.....
.#....O.....#OO.O.OO..O......#.OO..#O...O..##O.#O....#O.OO..#O.OO...O..O.#..##...O......#O##OO.#.O..
.#..O....O....#......#.O.##...OO.O.O...O.OO.O....#...#..O....O#O..#...#.#..#...OO......OOO...O..#...
#.#OO.#....O.#.OO....#........O.O.##...O.#.................OOOO....O..#......O..#.#...O....#.O#OO.#O
....O.O.......##..O.........OO#O..O.O#.#.#.O....#..OO.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.#.....OO.O.O....OO......O#O.O..
OOOO.OO..O....O.O...O..#.........O#.##OOO#.O..O.O.O......O..#..O..#..#.O..O....O#O.#OO..O.O...O#.##.
##.O.#O.#OO#..........OO#.OO.#..#.#......#.OO...#.O.O.......O##....O..O..#.#.#O....O..##.#OO.O..O..O
#O...OO..#.#....##.O#.#...##OO#........O#.O..O#.........O.O.#....O.#.O.......O..OOO......O#O.###.O..
....O#....#..O...#.#.....O.O#O..#O....O...O.OO#...O..O#.##.O.....O...#..#.O.....O...O#..O.#...#.#O..
O.OO......#..O...O.O....#...OO..O#.O..OO..#.##.....#....O.O#O#.O....O..#..OOO..O....O.O..#..O.O..O..
.#..#..##O..O.....O#.#.O.O..O..OO..O.O..OO.##.O...O..O#........O.............#.OO..#......O..#O#OOO.
.#..##...O.#..OO...O..#..#O#..#..##.O#.#.....#....O.O..O.........#.###...#.O##..O...#.O.OO..........
........#O.......O...O#.#....#.O#....#..O.....OO........O...#.........##.....O...O#.O...O.O..#OO.O.#
.#..#.O##..##.O#.#.......OO...OO#...#O#............#.#...#...O...#.O..#O.#.O.........O..OO.O...O.#..
#.O#OO...OO.O.#...##........#....O.#.O.....##.#.O.O.O.#..O#...O..#......#..O...###O..OO..##..OO.#OOO
.OO...#O....O##.O...O.#....O...#O.......O.....OO.O...O..#...OO.OO.O#...O##.....O..#.#...#OO......O..
..O..#...O...##..O...O..OO.O.O.O.....#.....O.....O..#OOO.....OOOO#.#.O..O..#........O.#O#.#O..O.##..
.....##.....O.....O#...##.OOO....O.O..O.#.#O........OO.....#...##...#.#......#....OO.O.....#O....#.#
..O.OO#....O..O.#O.#OO#..#.O.##.#..#.OO##....O#...#..O.#..#...#.#....OOOO.#...OOOO..O.........##O.O.
O.O.#......O#...O..#.......#O.O..OOOO..#....#.#.OO.O..#O......#.#....#...#..O....#O.OO..O.......#.#.
...O.O....O#......#.O.O....O#.#..#O.#.....#...#...#.O#.........O.OO..O###...O....O.#.O.#.....##..O..
.#.OO...O#O.....O#....O......OO...OO.OOOOOO##....#..#..#O.#.OO....O#..OO.#O........O#..O.O#.#.......
#OO#.#.....O#OOO#...O.........#......O#.......O.....O#.#O...O........#....O...O.....#.......##.OOO#.
..#.O##..#OO..#....#O....#....#..........#O...#...O.#.O.O###O..O..#...#.OO....##..O.O.O.....O..O....
....OOO#.#......#..O.O......##O.#.O.#.O.OO....#..O.......#.....#O.O...##O###.##.##..#.O.#.O#..#..O#.
......O#OO......#.#..#.O#OO#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
..O#OOO#.#.....O.....O..##.#..OOO.O..#..O#...##O..OO...#....#..#...#...OO.....##OO#.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.OO.....OO#O.....OO..OOO#O.O.O.O...#...#.........OO..O#.O...#.##..#
..O...#O#.......#OO..........OO#..#.....OO#...#OO.O#....OO....O..O..#....#OO......O#O...#......O..O.
O.......O..O..#O.....O#O.........O##.O#.#.O.O....##....O.#....O....OOO..#O#...#...O.O#.O.....O.O#.O.
O.#O....O..##....O.........##.OO###....O...O...O..O#O#...#O.O.O....#..O..#..#.O.......###..#....#..O
.........O..#O...O..OO.....#...O..#O#.....O....#O#....##...#.OOOO.O..O#...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..#.....#.O..O.O.O..#.#O.....O#.O...#.#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..O.#....
O#..#.#..#..#...#.O...O.###.##.OO.O.#.OOO..O..#O.#.O...OO...O.OOO....#.....#OO.O##.O.#.#O...#.#.....
.#.....#.........O.#.........#...OO..O.#.O...O##O...#..O.O.OO#....###.OO.....#..........#.#OO...O.O.
........OO..O.O.#..O.#.......#.#O.OOO...OO.O............O#O#...O...#.O.....#...........O...#..OO.O#O
..#.#.#...O....#O.......#...#...O###.O.....O.O.OO....#O...OO.O.O........O.O.#O.O....OO.....OO.....#.
#..OOO#......O.#.O#...#..#..O..O.O.O.#...O#OOO.#...O.#.OO.#O..#....#..#O....O.#.O...O...O#OO...#....
.....#.....##...O....#..O..O.....O#OO.#O#.....O...O.##.#........O..O........#.#......##......#..#..O
O..O....O.##..#.#O##.#.....OO....O.##O......#...#..OO.O.....#...#........O..O#O##.O.......#..##O..##
#.....#O....O...#OOO#..O#.O.....O..OO.#..#.#.O#..O..O#.O###....O......O.#.O..#O.....#.......##O.O..O
O.O.#..#....O....O.......#.O..O#O#.O..........#O.....#OO.O...#.OO.....#...O....OO....#...O....O.#..O
..#...OO....OO......O....#..#..........##..##..#.....##...#..#O.....#OO......#........O.....O..O...#
.OO#...O#.O....#.........OO#...O#..O.#..O.O.O.#O......##.O.......O...O...###.O......O....O...#.OO#..
..O..O#O.#..O.#O...OOO#O.#.O....O.#......O....#....###....OO......O...#...OO.#....O........O#..#..OO
#..OO..O......#...##..O#.O........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
.O.O...O.#..O.O....#.#.O.O.##.##..O..#OOOO.###...#O...#...O.....O...#.##.OO..O.#..#.O.#.......O....#
#....#....OOOOOOO.#...OO....##O.#..#......O..#..........O......##..O..###..#.O....O.......OO......#.
.O.O..##.O.#O.#...#....O..O.....#..##......O.......O..O#.O##.#........O..#.O.#.O.O..##..###..##.#...
..OOO..O##..OOOO.O.....OO##..O..O.#....#.....OO......O.OOO#...#O.OO...O.O......O#..O.##....###...#.O
....O...O.O....#..O#.O.....O.O.#.......O##...O#..OO.O.O##...#.....O#.###....O....#O.........OO..O.O.
O#.O......##..#.#..............#......#.#.OO#......##O#OO..OOO..##.O##....#..O...#......##O.O##...OO
...#OO....OO...O#.#..##....OO.#..#O......O#....#.O.....O.#O..OO.#..OO...O#.O#....O.#.OO.O.O#..O.....
#..O.OO#O...O..O..........#..#.#..#..#O.....#O#..O....#..O...O.#.#O#.#OO.....OOO.#..#.........O...O#
....O......#..........O...#.....OOOO........#.#OO.O............O...#....O........#....#....#........
...O.......###...O.O...#O.##O.OOO.........O.###.O.......O....O.O...O.#.....#..#O..#..OO..O.O...O....
O.O#....##.O.O.....O....#............OO.#O...O..#...##.#.#O#O.#.....O......O....#.OO#.O#....#.....O.
..O####.O.........O...........OO..OO.#.....O.......#..O#.O....O#...##.......#.#....O..O..O#..##.....
.#..#......O.##.O.OOO.O.OO....O.......#......#.O...OOOO...O..#..#.O.#......O...O#.#.O.#.O....O....O.
##....O.O..O..O.#...O##.......O....#...#OOO.O..##.....#....O.......#O..#.#O..O.#.......O..#.O.O#.O##
...O....O#O.#...#......#..O.O.O.O...O.....O..O.#..#.....O#...OO...#.O.O....#..OOO...#.....OO.OO..O..
O##.O.##.O#OO...OO...OO..O....OO#O.#O..O.O....OO..........O..#.O.#O#.......O.O..#O#....#..#...#O..#.
.#.#..........#.......#..OO#....O.#.#.O.....OO.#.O..#.#.O....#..O....#..#..O.#O#O.....#.O.O.#O.O.#O.
.O.#....##O...#..OOO.#......#...#.O.......OO....#.......#..#.OOO........OO..O..###O##..O.....O##....
OO##..O#....O.##.......O...#........O.O...#O#.#.OOO....#......#.#O.O.O..O..O...#.#.O.O.OOO.O#O......
#O...#....OOO.O...#O....O...O..........O..#..O#.O..#O.....#......#.#..#.OO..#....#O#....O...O....##.
.OOOO......##.#O.#O...#......O..#..O..#.O...O.OO...............#O...O..##..#.#....O...O..O.##..O.O..

10
2023/input/14/test-1 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/input/15/input Normal file

File diff suppressed because one or more lines are too long

1
2023/input/15/test-1 Normal file
View File

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

110
2023/input/16/input Normal file
View File

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

10
2023/input/16/test-1 Normal file
View File

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

141
2023/input/17/input Normal file
View File

@@ -0,0 +1,141 @@
314412134515235343233533333536633455653353226524463545367577644655564375735567774443767545555476326253354625332434443364224465621314212153555
541151354452244522426632553456444465355436252633745744545656765664467373344353475666347765767443443552326263264235346622346265464551153535535
331313213153324653452333663333462335265624455475544677337533645646454544573377667566554353775343377532656434266344566626434262245532313441542
231231134242452536244266236256525426355273354474573763575656667355645557536446754366667563657447367737456645352222534556245645343351335322223
251433112552564352445455233433553362245337533756634643733533466354356373567633334767437674677465346746774546242625352644324265246422513313355
413125324132545243423242425355265226355444733776744656536465355674555733753474534534433566567674774473567333452433553242344623352255235253434
532355354346566256462226323353453233574773645645433345534463465454533556537575575577754774536656666577567366323533434336553634632645651225243
455311523432626356642246453352635354666745454767466646743434437774334444766744753773634355543363377575473337333424664332326565454236653544323
424523363662246263654465624464655447744774567556775663763465367677374675753355374345346677343654333775353543635753655256634466626335324551131
312234524445243642435564344443643546563334674463666677677375666374376637677377675656367674677655374445445436364656344562424423465563566224112
115435666634232345425362663436566563773563533376643646553453766464636476757674637467374456676436444363454454565354445236442434463546522456311
154534345264644332453643233644775666573434664657335643647354474373543563433577357373746663547554745737536477775465743462232356456544633335612
451266255244444535322452434645573365766537743665343557476666464758667467776574476764465334655477443443745655654457677624263534623665264555224
353335563222253235535444636573356337445367344474777333557878464768444788856675585565465366454733456455674536433473654575346243664464634353361
133423654653562566524555363736665736664674537436557377575766444544774854555847644678448674465647577673665776754454646667262236226252353332253
133244534342626454662664766673363454654775367333568448688558578768686448546868444748457676856473435435676655374655443447465552545633333543332
243466552334262456344733345534573753356536657446767756788575445478764548775685776647768646456856765643745556543743664466543662642344456546633
225656624252654654257373356646344537466547455766887558787658686656447855868447485884684656856578745535456436454746473564736542642544625222354
263225332334642334675643644754654536773763445878468566857854558584444644768557757487854646584847654777756335644546467463376674663436535646452
462346565445343656664446656746533643745447844866758554785454458448648877657447474444486777886656567775334434446577467565433575636665445223642
363266453445466566556667366355434346533355777566657774487686846454565466845574688847467448668876766446676776475563644443566363242625262335623
325363664656255465436433336773567347537767485744446565664446855866487664586568787776655755686868765886664344557456735673467475426333444333354
622523453334652767737546677766537644476465885765644778876688488446747664448447488668445647744766848776656844776733757447477443333425525625425
333623242525533576376533574476577337665748887566464644665446655885548856787747865488577777487546544876644587367343333376355575457243464345323
543454255433367553446637345433677465656546447845788656747548755757888785557588445647856758456654456888685858475473564764673634765655244332245
623536555425575563774673767455733665777686666786545674684485686454886457575558854685585754647856666454488644483445777757775736767455653333323
335365452534347455445473435765736686586454476877577676868665648588444785645788688755665567847847585545847774845545765767665374567754666353346
465462453636344566675354655574674445647778775756448777556676575896785898598558875578854754655544448684755674768743663367375367764556356656544
363442635343777335564633673354845878587776886578665748646577867786688655765785766556946866764484465548878588568456776747534365377563626244552
232634453453763747553644733568475457767854754657478566598876656677877858987888958665955775887757458758846446485486633766635574537637743535463
522344452575745446776443535457848555475857457855478488988789876956765857655568587967855966667854884755868658474447474543647465737337736454553
663552627334333773546633445548767755868645584584477759875859697897758656889957568796889865757587657865664687876775763343644433447356576623322
445264645556337754376544665585466787575557454745756756569865889888669678579697997988759885795864747457454586846847864776454355655747776434462
622455277467655667357753578774565877584888457466786879796679896785676566558958878758687656579956856668584545646457888846333776555447355326455
332544567353564566667655876454688564476674785685585555898896589897779866986569586598987767875687986855654688558578465866465363654354575635354
362352774453665775437766846688756656644468774687855675597596697959675558598777586676566558856799988477458485845764474846545665733565465642235
653443463447775343644765866587748864448654759898689676566898666986677759957898699679989767966696878566674676885568556746354374333576755645346
233457756564473374745676786648657667555644559576795697887955798889695765895777795769767775857776555687668866577657748875665546353337347453544
544435543735775756436586648877447574576649986595589858785976896678788775858975897998958798577699775668576788768487847776466567574473543737433
552254545736366367557746645875766864684655876967787578968965796566679766856567978896897569787898896679846454688458564765474667745344575656652
446576536675377537777877667464484755588965569999587859678868658589679797766778779556888989997779955859977746666655578676475336765356674466355
664473477475337634746565456787867874856975589795859955596796869957859878755688955799686898799975987695678655645557444554578533555356365636576
465574733563457536788876484884757745657879799597655969996679655767876986677677885995975575988689878558975568885475654565747543764777545434764
655353564364767347457778866577575747857576977959767669999755887968768679988668899777968856587559585695675755788768567745454887754734566654776
367447364467773735858756877784568848579768578757989966677688997788886686879996878778959688959859779665977976845865465575445443764647473556443
575575376547735375465674555454756677556699558557789786866688889777886986677798966766867857656867689689857999565775845768554668773553355667455
234337435764637437477847577878544788568595659969575976666789796968969867888879989998669978798695996588697968856484458578564864454363357443746
757374646667343374658776784548485699556687968567959887878767769896667677769799977697998887555798975859969987654847844667488486337577646667436
746675344636443355447847877775585975688786658585856976688798979766676667669777869966786696985578695567558879587875686667857658435634537537574
565477576353557754765856675584756757758869688899685888866867969967789996777977696786786799899578969989676858577478878648884558444634344565534
545776547376457656484767664474675785787867996876586886969967867667968766667869896988688866988899565575789556889485458685687857857634755536555
556547536534744464666677768654665678867877599566799896796696767679697779667679787798778776868867566879877875598887644644556565875437573346464
475674567766655748846675487577896855868786656856889676967777888896899798696668996799767868967695859567789998779678567645654866474475575474564
575776574667667488585664655566878858856696985666978969677996768866897769698998978797769697696678578875896978895756568847474676767653445435775
654337754774366757587856446454599578896669889566879786768967788796796669876779987979768676978667976655798586598867767646745874485743333475573
654535367644768656654887558678576586959758878969989678877897997899999966989878689799986869688867799655667586798667456578885664544463374435766
373454367345364747845477877778675566899885865996967677867679667777788676989889796668969976888798995987599977865979678558884576658675654335775
445765373433585588645685488858679558587596589669677997776969767976999889898898766997786967866698797999857865789796785754485546845444454775674
337734475564468456565466675695986676969896699869686898678978677788879779787799996887768688996869667576965976777685546448666856777733574373737
644734774466757856744886858488965696559799868986877886989867976897888778788788798986886797677969698965795977998975557467585758586844655756455
554577373345575856457564758579875559586586796866798868679677697988989997977997877768988676689966886665767569769698685685548846746574457776477
667557463566744755788558777855777886587799679787686877796677897998989989988989787886668788678666969975976669795676556888447866647567743646364
477373654454748646848578744889989655567667976978866867686997789989879798778898999797966898766997896877988557566598698448764657467667475673343
547767744463684588776576646599966657599868977798867767969869998988789788779979999878667887668677976995895669795776694454475565788475343635657
575346733753567857486747775687658558698895999787897796978778979899978798987797778998888699888676688686959695889576575786886446768854464455437
473546446375756484756475658876679886997566686887666679669897979779788997978979778799998867676769798987567787967859975765844867475587534537454
776453776365684567446656644967786587775958996676668967679898799998788799879898877877989898977976777678699685585766764777775447488756354556446
736736635634666666775484566586558589788997989786967767799887998789888988797899987888989886989697987667599676976788787665844667557685574343647
573544375367857645884646554755995555778899999998889786688779888888989988897997798979897867888697867777955555886985854554867878658455476654776
547366346654785856677675467857768875867789767867687996698877797797899878799797879777887699877699896968665989587996796455854847576445446464566
553774575776675458645746458988598759889577967677669966899798979999979999789878997799789966699879979775697777599869796745465885585456345737663
353767574665657756756574574787569598778898766697776969787797997797878998797878779887779986689876898989659798867989978566746888666457646435435
653737743445665787556877448595787969666796786787697768767778799999788897889878889979979888788689777869688958985877955585488544558456364563435
763637337773885888664576787665577575587575866776988989688778799898797888889889798798876887679867876995756675876698764657588677588473535647734
637644466754745688456758488895558797777587677768679999666877988788777879979897997898778676778876797665975669889776876777657444686464667776673
666575766736756646478667475789986767858855969986999798899899997877987998799899899987896677686676868779995578576986677485854676545866776337365
766455377434588788655477784898599856578797767798869686878899988797778797777877899788897777699996979975569757859898676546748776486667636474556
545447346666475474465466565586969777578988877798779686777788998788798997877998897979899997796697788985669755797567897486874854548465473567557
444655447566445854654474455756878599795979666889787989699799799788789899798878779887786786978766799797798756556977755677546455687663556373733
457756474767867685745767766688656959868969669698696779769987889977889997879978988997869666968688686686667595765685954465848754645545676346656
577777634634784475566585487766898679766857589876666797878786899778877977888988789997897987777866866875865657958858898886558674477546645373733
375564455343464778546576465699596776656969768977898766987868978799797977799899998977676887796966769685566567875598986866656546864673577335644
764536374744688766576577885877665755778667698767767896866976678787887997777989979797997897886879998588785565797599856764646476874865657375337
543643663577445575575746865856699797886966697787689988987898997887889778799878876968676879669667867865969569598866786777478684447473535476464
636376576444445784685557667858867858989886768887678798987997786899978898979778799676976968699687687696799958596989878545477776884836466676544
763557453467756688577756587779998976955765595888976888986678666799789998989886898897796979988899965969688858788595854765644557856563554676536
577357635456488886845878554769765556955985655979997878697999677778688978698787966866789866976999769896799668958869464854575446585434637564676
364747645336576587565657758877675688959786977998788886798766997696767666867669986699686998698989755758698855876979464485786565446476634357363
764673654455638867657864677868688686876669689896868776679986866978666986986777787686788676788988756558765565677587548746675558674337566464735
467553475334767444466644884457796887977895865685877786688968766788798869987667677976979679776875687896785677785585464887785478847566336676367
754553573564374878888686745468795559998559558576899666976769996769969687868797787688689676689897687688897755999976676746558645464445673675377
654645755747464485667558574456877887787569867679887798667687868677876778669689666779886968896876685659976676658686566557864768873645664376734
445544646666653788765567845564557669976567696868566987669896966988769778889996997766998998877788995567766676565676856665458647445467373676373
335345454544774365576884545776447679769795858986755876876678877988676979788677979897688799775658967569577968775874488767645745846353477357637
366377754753734477674448744864875789898856866979656686786676967688978696879889689678998668967576985558585659776884567855454458533567566333343
634577374346476446555445785448644766995595858979896666888979689876778998787897688787799698888955955598989698964778556874557885545653374555466
677556475565736667777484485656567599957978799986798886767978668896669897777678898796786667657569787669575865654655784846475888734563453447733
436473576775565774677876476556488659989779567768788785959799789889869898668776868679767999878696597975756768458548448585844656454736734654746
547357337753544344646667465664866846685869885977886995876969889768689977867696698867687576899598699757796587666875856478644854555674435777546
347756377665473476788767458886747667756788579676986758786598768688666796797777766975688995896569669597986656644477885868658863643356336436767
435655633356663457687474657867868586557857757898656955676959979987699988668797969575679668986989599968778575744456465555448545746745553656636
232735335633336435364776478856564678779895856986785956779795856697686755768967786866756967879579989575999767445845658488464367745456563766652
365534555754666343356858854544586845478695766698595578657657699589559657775566978578796968698978756676686864564748787854774355466336575533356
332456745574334636435755766547766858677477558867578676869797997655556578565658577689657675777885779856545854766587588785885553755574346447734
642637766374645667576784676645584544887786985679965689779986669967558768898687899778796895789897896869675566888667844764866335475676646746344
446266775465654344746545588648865455558567795956557678858587988789596567768697587755599776658585659584746544448586656576843675434737573434342
224663653636375747635334754667777785765845587767875669699965575665656696965569779879659798977576858957685655475765764488774657635437473366356
625426436574367576377455445457768877844667877696677657787998676675855585695556989557695768975657585787668568586645766544775754777736377573643
254365447437365344543734686478587446577464478577858696676989769786995956675995686669859566789766667744858454484774566846375675636477476676335
422222654656766733456576778578576885587687484547879668859979585659755658767565669789967569955759486556587466846657846867463337773463345653456
222663564645657663455455778578554485465786786857688856768877956578786888557568998985866787655554855578544846755487777674735775777464734622546
254425667467346335477743536684857855446886765847878588867978695556586758898799875967867665697587665575484878864786575464647575364434365244232
545624253753775647574566377467768786547854476484446767697887679959597569976686666989776986887485646865745586658564643373645345733746736652366
445252323737357543544335573665464678448566785686457785666686788888585959758897989777867765544747588555474847478855647656665644764466453436244
624334552663634667443673377457587668454844544466745588644789865859879759688676686967574556546474878564576746445776434547637734437356426553336
646342663527575634777653454344647768685555578668685585747484849669788588997988769574756864788445847464484765785557365333564764664464523466625
433646226555554733443535333646458856474776865656467548576566554476676858654688585874478857475648667678875678885646635637756557467755533632524
524224632242777744344347444334366578578575877467887886555676854678445574565875655468577574858767577688754564753666644467764676465333565552463
332524536526246557754755777633656654474784458587665548686487884874566865658745654485687757788578847456445876553653343573443456766725335256642
232554544665423736756756355734633455656467675747788778876765845585468587877455867666855787577686557854444777576433354455347456475525443524464
442536554246245356477665466553537546467888677788466877467686486657667685476657657467447667888766845477874466347633375765374567555252355555234
466244246525246247457757744364447343554644867457546676778874586655685744567645544464686645886845556867444547446577475333544476334534663633245
256564536546536663747336555334445355353685446444654655484676486875548856554568564566857447765885764477666734375743576475547457262563335256256
422666323232323265733677534764557654535733767547847748648476454756566877767566745674454856755477854786445654433454543465347365665232624666552
424322552553422235336774436334655656753464566788846587546678666644787566484885754665684866448466644745643776645476477537765745622326366565354
345543454253666434265365537663576573436433745778877446564777478457575846747454774548745457745447684757344355355745445557775262543464556444634
336332264656464436433635346557737336357437635546658478488856868457865746755647874844656478545747333465337573563736436377474556263642424323626
522645624243565434556446456664775367336437757757366675878887787775687654585666655745655846458333674745667336355753654677662464322345536366444
555355255625526523556533365744375654336575555355636447444755865586587665788476558447664564566644433656467374766543333653256234262433543666243
352442235334564446432432343454456456335337663466436474364547647547857775677445776846844647434465354643576547346346673562543352236432233355555
513442263654563562566354553554666563746565354466655433636643784876456456474465676577343673465465554337444354653537646325625464335245434545645
412166442223555666442324255746337746664773367543767373733737677365555364633674664745736555765655345666573457674453644222662456622244462436234
335154546633442632244453333547453533644646357535376775746533656673644367657346633466673535437637674353457475533764463643233554553226563253531
344355262636555362325466655254444447336435574534775754465675544754737373636474353733766573766355474364665466456367352423244564562442343664431
311413135435554264436263252552354346437465375467563776374733477357475637647547553646677354774353547337664736454445366643346246333553342424441
535433415243554224545433322662227453333764757337343766763564757456745673733566554346344364757363656755345357754222664244523544535662564243331
134111534364445323222623622364552434633767676433737455655363547774354473747466434563657563745543347455674446543443655424426366324335634323325
351255341465626465234256523662254632653447333533467334465363354667336765477454734657366335356637333466453444525332662564422333455463641114144
552341443344524565642265436465366522436473534654637564453564353534556774457633576376544536465446545333744663365656323344662535233245324445313
221252532115466236652623632522433654526676365575647434775344354564367573777346436744774454673664564335344245253635255564364626663532252232132
144524115433215643653323636235532663522464736374347774777656443757553555345734367444567773663755546434263345354363654655245244254515334312415

13
2023/input/17/test-1 Normal file
View File

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

5
2023/input/17/test-2 Normal file
View File

@@ -0,0 +1,5 @@
111111111111
999999999991
999999999991
999999999991
999999999991

794
2023/input/18/input Normal file
View File

@@ -0,0 +1,794 @@
R 4 (#4b18e0)
U 4 (#0b4f93)
R 4 (#6d70b0)
U 12 (#86edc3)
R 4 (#435460)
U 3 (#07f023)
R 8 (#33dd00)
U 5 (#599aa3)
L 11 (#83c702)
U 5 (#3f0501)
L 7 (#4bf232)
U 9 (#3f0503)
L 2 (#4955d2)
U 5 (#24f2e3)
L 9 (#16abf2)
U 6 (#60f753)
L 3 (#678dd2)
U 3 (#736093)
L 3 (#007482)
D 7 (#446e11)
L 6 (#0482a2)
D 8 (#997fd1)
L 4 (#4891e2)
D 6 (#2547b1)
L 5 (#501bf2)
D 8 (#7ed033)
L 8 (#0dabe2)
U 8 (#7184d3)
L 2 (#748a42)
U 5 (#12e093)
L 7 (#672432)
D 7 (#19c6a3)
L 4 (#1c5c22)
D 2 (#6e8a23)
L 10 (#5cd602)
U 9 (#1d8ff3)
L 7 (#359ce2)
U 6 (#333143)
R 11 (#0422f2)
D 10 (#235323)
R 6 (#64bc72)
U 10 (#6ea5f3)
R 11 (#68df60)
U 10 (#0952c3)
L 4 (#5206d2)
U 6 (#09c2a3)
L 5 (#45f7e0)
U 6 (#6d15e3)
L 6 (#271740)
D 6 (#6d15e1)
L 7 (#2e6a20)
U 9 (#178883)
L 9 (#430370)
U 4 (#2ee7e3)
L 7 (#8bdcf0)
D 9 (#5cebd3)
L 3 (#3d5a50)
D 4 (#5ecc23)
L 8 (#095b52)
U 9 (#3b7121)
L 10 (#8061b2)
U 4 (#3b7123)
L 7 (#209272)
U 4 (#493833)
L 9 (#7d9b02)
U 5 (#283633)
L 3 (#0db702)
U 3 (#437d73)
L 14 (#721282)
U 4 (#059a63)
L 2 (#4630d2)
U 5 (#6c5f43)
L 13 (#2949c2)
U 3 (#590a93)
R 5 (#4f5650)
U 5 (#71c3e3)
L 8 (#308540)
D 15 (#4fbc53)
L 2 (#4fa760)
U 15 (#41d523)
L 8 (#6bd380)
U 6 (#5cb553)
R 6 (#76acc0)
U 10 (#6be3a3)
R 6 (#5d61b0)
D 10 (#6dd101)
R 4 (#04f600)
U 4 (#4ea101)
R 2 (#6c2630)
U 5 (#498ac1)
R 5 (#0667a0)
U 5 (#120ef3)
R 3 (#31c080)
U 5 (#861cd3)
R 11 (#364e90)
D 5 (#6dd103)
R 9 (#6fe5b0)
D 11 (#119d43)
R 6 (#111310)
D 14 (#2ff323)
R 7 (#177432)
U 12 (#0ccbd3)
R 2 (#77c592)
U 9 (#6eee43)
R 10 (#21e622)
U 8 (#0bc513)
L 8 (#5398a0)
U 2 (#53cca3)
L 10 (#463c20)
U 5 (#53cca1)
R 8 (#174b20)
U 11 (#09ddc3)
R 6 (#20c940)
U 11 (#2fc6c3)
R 8 (#7ab1b0)
U 6 (#7ab291)
R 3 (#057160)
U 6 (#008331)
R 11 (#62c440)
U 12 (#3233a1)
R 2 (#1ceaa0)
U 4 (#4ef663)
R 3 (#7e5670)
U 2 (#4ef661)
R 5 (#3ccc40)
U 8 (#6e3531)
L 13 (#3964a0)
U 5 (#68b801)
R 13 (#83d220)
U 5 (#459901)
R 2 (#053a70)
U 6 (#4d18d3)
R 11 (#8a23d0)
U 8 (#4d18d1)
R 9 (#2cce90)
D 14 (#48af61)
L 6 (#045500)
D 6 (#0b4971)
L 8 (#18fa70)
D 7 (#7d8d03)
L 3 (#6ba530)
D 9 (#061783)
R 9 (#2c9c30)
D 13 (#402993)
R 8 (#18e9c0)
D 7 (#51e7a3)
R 15 (#18e9c2)
D 3 (#0ae133)
R 5 (#4929f0)
D 3 (#8d4623)
R 4 (#277680)
U 11 (#034583)
R 7 (#1ea1a0)
D 11 (#6cc5e3)
R 8 (#8894e0)
U 5 (#2fc6c1)
R 6 (#4dd6d0)
U 3 (#7f5b21)
R 11 (#219440)
U 4 (#2db8a1)
R 6 (#4053a0)
U 6 (#2df7e1)
R 12 (#086710)
U 8 (#47c7c1)
R 4 (#41ee90)
U 3 (#1dfa61)
R 3 (#5c3610)
U 7 (#483023)
R 10 (#2b6060)
D 3 (#327133)
R 8 (#2e4b30)
D 14 (#212321)
R 8 (#4bfd00)
D 5 (#5f0b81)
R 4 (#718450)
D 14 (#320dd1)
R 5 (#103630)
D 6 (#911953)
R 4 (#3f6190)
D 7 (#212323)
L 4 (#7f84b0)
D 10 (#2816a1)
R 5 (#026f80)
D 2 (#528ab1)
R 8 (#04e160)
D 11 (#655ca3)
R 2 (#0a1bf0)
D 3 (#6872c3)
R 12 (#7ad510)
D 8 (#72fe63)
R 7 (#109a50)
D 9 (#66ae31)
R 3 (#0828a2)
D 12 (#039eb1)
R 8 (#6f2c60)
D 6 (#46dae1)
R 12 (#76c900)
D 8 (#724711)
L 10 (#0a41a0)
D 8 (#73f301)
L 2 (#029092)
D 5 (#2ee5b3)
R 9 (#794702)
U 9 (#2ee5b1)
R 9 (#745f72)
U 2 (#108e61)
R 4 (#30e792)
U 10 (#099281)
R 11 (#347f32)
U 4 (#319ab1)
L 5 (#44a712)
U 9 (#623681)
L 6 (#3b5002)
U 10 (#25e431)
R 6 (#4f3f22)
U 4 (#226f51)
R 5 (#26f7b2)
U 8 (#588341)
R 4 (#09de02)
D 11 (#423f21)
L 6 (#6c9ee2)
D 10 (#423f23)
R 6 (#3badf2)
D 4 (#2c0a93)
R 4 (#521a32)
U 7 (#4ee803)
R 15 (#47f6d2)
U 2 (#673651)
R 4 (#5c10b2)
U 9 (#4dc641)
L 11 (#4d7032)
U 6 (#299111)
L 8 (#8d06b2)
U 8 (#22e4d1)
L 7 (#7dac02)
U 4 (#58e171)
L 7 (#17e332)
D 12 (#211931)
L 4 (#7e1732)
D 5 (#502911)
L 4 (#88c6c2)
D 5 (#430ba1)
L 3 (#3e4de0)
D 13 (#481b11)
L 5 (#5925e0)
U 4 (#1cecb1)
L 7 (#11ecf0)
U 7 (#634bc1)
R 7 (#6218d2)
U 7 (#7990f3)
L 5 (#576b42)
U 4 (#7990f1)
L 10 (#145832)
U 9 (#609ef1)
L 3 (#0d8822)
U 4 (#2b1f83)
L 3 (#77a562)
U 5 (#2b1f81)
L 6 (#3d05c2)
U 7 (#4b56d1)
L 5 (#1f6272)
U 8 (#916891)
R 6 (#087ce0)
U 6 (#2cf203)
R 12 (#285e60)
U 9 (#6ae623)
R 9 (#8a34a0)
U 9 (#6ae621)
L 9 (#15b200)
U 11 (#40c541)
R 5 (#0c7fc0)
D 7 (#2d5ad3)
R 9 (#42f280)
D 7 (#8140a3)
R 3 (#255770)
D 10 (#8140a1)
R 12 (#4ac260)
D 5 (#2d5ad1)
R 8 (#083780)
U 15 (#40c543)
R 7 (#028ab0)
U 13 (#2cf201)
R 5 (#1461d0)
U 2 (#23bff1)
R 4 (#1a4992)
U 3 (#355fc1)
R 7 (#6cafd2)
U 5 (#355fc3)
R 6 (#226752)
D 6 (#5af021)
R 11 (#526e82)
D 6 (#055ac1)
R 4 (#460a42)
D 3 (#055ac3)
R 6 (#565542)
D 3 (#3cd6a1)
L 7 (#2da922)
D 10 (#708ea3)
R 7 (#687472)
D 4 (#4ec333)
R 4 (#58d602)
U 7 (#4dd3e3)
R 3 (#23a7c0)
U 10 (#51fa83)
R 5 (#23a7c2)
D 5 (#188363)
R 14 (#5bc432)
U 4 (#3f0d23)
R 8 (#27a940)
U 3 (#62a3a3)
R 10 (#27a942)
U 6 (#0ceab3)
R 2 (#4479c2)
U 12 (#8beb63)
L 2 (#0b84a2)
U 3 (#3aa313)
L 7 (#270672)
U 15 (#4bd563)
L 5 (#4d8072)
U 6 (#045183)
R 12 (#08fed2)
U 11 (#52d323)
R 2 (#050992)
U 9 (#618533)
R 4 (#17a282)
D 7 (#08e921)
R 3 (#1a0d22)
D 6 (#0e8541)
R 11 (#61b232)
D 7 (#6635f1)
R 5 (#617832)
D 5 (#08f4f3)
R 2 (#490c22)
D 3 (#234821)
R 3 (#476942)
D 12 (#234823)
R 11 (#31b6d2)
D 4 (#08f4f1)
L 6 (#129582)
D 6 (#507ed1)
R 6 (#1e7010)
D 8 (#5490e1)
R 10 (#093bb0)
D 4 (#7cefc1)
R 9 (#6fe430)
D 3 (#0160b1)
L 8 (#1a8570)
D 2 (#2722f3)
L 4 (#2eb860)
D 12 (#572d83)
L 7 (#556c20)
U 12 (#50d5c1)
L 6 (#3a0932)
D 3 (#0a1701)
L 6 (#2294f0)
D 4 (#5f04e1)
L 13 (#62c590)
D 7 (#5f04e3)
R 6 (#1660e0)
D 2 (#34e001)
R 6 (#23b340)
D 12 (#1e92e1)
R 6 (#786d10)
U 12 (#44f8d1)
R 4 (#786d12)
D 3 (#3f6cf1)
R 3 (#2e2812)
D 3 (#185ac3)
R 3 (#7976e2)
D 14 (#0a5201)
R 4 (#15e3e2)
D 3 (#825221)
R 3 (#699e12)
U 3 (#8ca423)
R 14 (#04ffb2)
U 3 (#185ac1)
R 2 (#0a3482)
U 4 (#59d541)
L 10 (#5b8ab2)
U 4 (#59d543)
L 6 (#395af2)
U 3 (#2fdcb1)
R 7 (#1d5670)
U 3 (#3801c1)
R 6 (#65de30)
U 7 (#522db1)
R 11 (#9a9020)
U 12 (#382413)
R 11 (#55b6c0)
U 8 (#382411)
L 4 (#4549e0)
U 7 (#2f1091)
L 7 (#127550)
U 7 (#3e2ee1)
R 7 (#1b7ba0)
U 5 (#0177e1)
L 10 (#581e30)
U 4 (#0177e3)
L 8 (#287b30)
U 5 (#4667a1)
R 6 (#3a6730)
U 6 (#7575e1)
R 6 (#4d8f90)
U 8 (#06a251)
R 2 (#32a980)
U 5 (#92bbf3)
R 3 (#465200)
D 4 (#1e82a3)
R 7 (#5e49b0)
U 4 (#282471)
R 6 (#95ba62)
U 3 (#3fc1e1)
R 3 (#95ba60)
U 9 (#495841)
R 3 (#3bece0)
D 13 (#06a253)
R 3 (#58ed10)
D 4 (#3c4df3)
R 7 (#830800)
D 10 (#3c4df1)
R 4 (#39bca0)
D 4 (#0e26a1)
R 6 (#09cd40)
D 6 (#725971)
R 10 (#624800)
D 11 (#49ae11)
R 11 (#3ed060)
D 7 (#49ae13)
L 12 (#3e0b20)
D 4 (#569191)
L 3 (#1bb070)
D 7 (#0b1803)
L 10 (#045fa0)
U 6 (#8cb0a3)
L 7 (#57ca40)
D 6 (#146f43)
L 9 (#5ad0b0)
D 3 (#22f873)
R 10 (#249e42)
D 5 (#429003)
R 11 (#35bf52)
D 7 (#162bc1)
R 7 (#5689a2)
D 10 (#162bc3)
R 12 (#286a32)
D 9 (#54b443)
R 10 (#505c32)
D 3 (#831903)
R 7 (#003ab0)
D 11 (#6a9af3)
R 10 (#39f710)
U 11 (#1f31b3)
R 5 (#6fc5c0)
D 4 (#071b73)
R 7 (#3fe110)
D 9 (#5fd6e3)
R 9 (#3fd500)
D 3 (#2fc9b3)
R 6 (#727a40)
D 7 (#531d23)
R 14 (#02afc0)
D 6 (#1e5cb1)
R 4 (#717490)
D 12 (#6efba1)
R 11 (#5996f0)
U 5 (#763861)
L 5 (#444cf0)
U 8 (#763863)
R 7 (#2e2c60)
U 7 (#543fa1)
L 7 (#95e230)
U 3 (#543fa3)
R 5 (#41fd20)
U 3 (#19bf61)
R 5 (#656540)
D 7 (#391283)
R 4 (#33ebc0)
D 13 (#391281)
R 9 (#709320)
D 6 (#498291)
R 3 (#03c942)
D 6 (#3391a1)
R 6 (#5a83e2)
D 5 (#4eaff1)
R 7 (#2ca112)
D 4 (#2de1c1)
L 6 (#8724f0)
D 9 (#4b7fc1)
L 5 (#005232)
U 9 (#322291)
L 7 (#6a7682)
D 4 (#5d2381)
L 5 (#6e5312)
U 13 (#5d2383)
L 8 (#4a5e52)
D 13 (#61a5a1)
L 3 (#2adb12)
D 6 (#1056e3)
L 3 (#74eb12)
U 10 (#1056e1)
L 12 (#4c3122)
D 9 (#02d251)
R 9 (#30a702)
D 7 (#7cd9f1)
R 10 (#56a522)
D 6 (#25e4f1)
R 7 (#720682)
D 3 (#11a711)
R 10 (#4810c0)
U 9 (#7233d1)
R 13 (#47d8b0)
D 5 (#222c51)
R 6 (#270630)
U 9 (#6c2991)
R 5 (#251ce0)
D 9 (#0ce373)
R 5 (#0f3af0)
D 4 (#234033)
L 13 (#399410)
D 3 (#1091f3)
L 11 (#12ab92)
D 3 (#2c05c3)
L 9 (#53cc00)
D 5 (#662eb3)
R 3 (#53cc02)
D 3 (#19fbf3)
R 8 (#12ab90)
D 11 (#13a3c3)
R 10 (#6b7ed0)
D 7 (#480071)
L 10 (#39ba10)
D 12 (#414181)
L 11 (#6be3c0)
D 4 (#308403)
L 4 (#5081d2)
U 3 (#4a1c33)
L 6 (#412360)
U 11 (#5cad03)
L 4 (#412362)
U 11 (#1670a3)
L 8 (#5081d0)
U 7 (#36b3f3)
L 8 (#4a86c0)
D 7 (#1903f1)
L 11 (#5aa690)
U 9 (#88cd01)
L 3 (#3843d0)
U 14 (#4c44d1)
L 8 (#92ea62)
D 5 (#205b31)
L 14 (#2d2130)
D 4 (#1600d1)
L 2 (#5eed20)
D 8 (#504601)
L 9 (#4238f2)
D 10 (#8a3821)
L 3 (#524dd2)
D 6 (#8a3823)
L 3 (#106f82)
U 8 (#3d0d81)
L 6 (#1ec032)
U 6 (#040993)
L 4 (#1ff1d2)
D 14 (#17b973)
L 3 (#3c2ae2)
D 7 (#7c2501)
L 7 (#633cd2)
D 4 (#6530d3)
L 3 (#082de2)
D 7 (#16f433)
L 13 (#89eb52)
D 5 (#17b971)
L 3 (#252512)
U 15 (#040991)
L 2 (#90d092)
U 10 (#0a1021)
L 8 (#1cd900)
U 6 (#4a13d1)
R 10 (#7a6bf2)
U 4 (#4683c1)
R 7 (#7a6bf0)
D 11 (#3a66f1)
R 8 (#488f20)
U 11 (#7135a1)
R 5 (#4cc380)
U 5 (#0bf121)
R 3 (#4c2e80)
U 2 (#7908a1)
R 3 (#259e00)
U 10 (#6bafe3)
L 5 (#52e6d0)
U 4 (#506603)
L 6 (#1fec10)
D 7 (#3a1983)
R 6 (#389e30)
D 2 (#2f7281)
L 6 (#55f170)
D 7 (#4cb8e1)
L 5 (#389e30)
U 6 (#2642e1)
L 10 (#7394e0)
U 3 (#642bf1)
R 10 (#7394e2)
U 7 (#132c01)
L 6 (#3c4a80)
D 4 (#3e4d21)
L 4 (#989ad0)
U 7 (#473211)
L 8 (#0aa900)
D 6 (#3a8a11)
L 12 (#4307a2)
D 9 (#13b0c1)
L 6 (#7e59a2)
D 11 (#00a041)
L 3 (#44b0d2)
D 6 (#0efc51)
L 6 (#8a1302)
D 9 (#160fa1)
L 4 (#4afa62)
D 2 (#68e871)
L 14 (#5ecd60)
D 5 (#6a51d1)
L 5 (#764000)
D 8 (#1a6d61)
L 4 (#713042)
D 14 (#0b92e1)
L 5 (#5b77e2)
D 3 (#0a0581)
R 10 (#212752)
D 3 (#0a0583)
R 14 (#3f0ca2)
D 8 (#13d911)
R 3 (#307832)
D 4 (#72d201)
R 6 (#133522)
U 13 (#6e4581)
R 4 (#70fe22)
D 13 (#082221)
R 7 (#44fff2)
D 4 (#731171)
R 3 (#10eda2)
D 9 (#0e5d31)
L 14 (#37bc32)
D 6 (#3852c3)
L 7 (#5f43c2)
U 13 (#8c7593)
L 9 (#2ff4f2)
U 10 (#1787b3)
L 13 (#68b4a2)
U 3 (#15fd23)
L 3 (#515622)
U 3 (#618313)
L 11 (#2d09d2)
U 10 (#6bb2f3)
L 5 (#1f22a2)
U 10 (#4d8e33)
L 6 (#1cb690)
U 3 (#09c3b3)
L 9 (#214c20)
U 9 (#5bfe23)
L 9 (#848910)
U 10 (#1a73e3)
L 10 (#3d9252)
U 3 (#089003)
R 11 (#7ddbb2)
U 8 (#20c473)
R 15 (#071dc2)
U 7 (#554823)
R 13 (#0cfb42)
U 7 (#1ccaa1)
L 15 (#847822)
U 8 (#5f0271)
L 4 (#03cdd2)
U 10 (#4f69b1)
L 3 (#4b1902)
U 8 (#8129b1)
L 4 (#5e69f2)
D 5 (#1f33b3)
L 5 (#2e2582)
D 13 (#67aea3)
L 4 (#54aba2)
U 3 (#08d7a3)
L 4 (#4eebe0)
D 8 (#030763)
L 9 (#2d4760)
D 14 (#79e223)
L 9 (#7c3342)
D 3 (#334c93)
L 4 (#2b0202)
D 9 (#04d053)
L 2 (#1475a2)
D 7 (#8aed93)
L 8 (#62b4f2)
D 5 (#14c931)
R 11 (#29bc82)
D 3 (#65a951)
R 12 (#656f62)
D 3 (#7a7283)
L 8 (#2bec52)
D 7 (#1a75a3)
L 8 (#988402)
D 4 (#1a75a1)
L 3 (#1aad22)
D 9 (#373923)
L 10 (#7e3ef0)
U 7 (#3e1c93)
L 11 (#3f89d0)
U 6 (#3e1c91)
L 3 (#652e40)
D 9 (#35acc3)
L 7 (#5b0fa0)
U 4 (#46ca63)
L 10 (#079fa0)
U 7 (#391523)
L 3 (#079fa2)
U 3 (#585573)
L 8 (#1f43e0)
D 2 (#403c21)
L 9 (#144b10)
D 5 (#8fa921)
L 5 (#144b12)
U 7 (#084fb1)
L 4 (#661600)
D 6 (#5e06f3)
L 13 (#3f87a0)
D 8 (#3ca8a1)
L 13 (#4214e0)
D 10 (#567b51)
R 4 (#7a3080)
D 8 (#17de11)
R 8 (#644090)
D 12 (#55ba83)
R 3 (#025e60)
D 8 (#554783)
R 6 (#0d2eb0)
D 10 (#552813)
L 6 (#61a7d0)
D 10 (#272cb3)
L 7 (#34d6a0)
D 3 (#36cf03)
R 11 (#14be00)
D 3 (#52b543)
R 4 (#1fa362)
D 11 (#713693)
L 3 (#652112)
D 8 (#5c8463)
L 12 (#4c1362)
D 4 (#66e201)
L 8 (#07caa2)
D 9 (#6ccbd1)
L 3 (#3b9ee2)
D 5 (#5798b1)
L 13 (#4fb342)
U 6 (#231223)
L 2 (#33e3b2)
U 5 (#022ea3)
L 6 (#3f1112)
U 6 (#3dde83)
L 6 (#2732a0)
U 8 (#1e6bc3)
L 8 (#10f4e0)
U 15 (#45e363)
L 3 (#10f4e2)
U 4 (#4c9523)
R 11 (#2732a2)
U 12 (#174303)
L 10 (#5b4532)
U 13 (#6195e1)
L 8 (#7fab60)
U 2 (#1e7dd1)
L 2 (#7fab62)
U 12 (#4da741)
L 4 (#09efc2)
D 5 (#3d0d83)
L 5 (#47d532)
U 6 (#1f7441)
L 12 (#558832)
D 6 (#24e093)
L 4 (#20bfc2)
U 6 (#606283)
L 11 (#639142)
U 2 (#854311)
L 5 (#318ff2)
D 8 (#7037c1)
L 12 (#1ee752)
U 5 (#6bad43)
L 5 (#662cd2)
U 6 (#23fec3)
L 6 (#11cec2)
U 9 (#0c5b23)
L 8 (#91c052)
U 3 (#62e783)
L 6 (#08ee02)
U 11 (#11a283)

14
2023/input/18/test-1 Normal file
View File

@@ -0,0 +1,14 @@
R 6 (#70c710)
D 5 (#0dc571)
L 2 (#5713f0)
D 2 (#d2c081)
R 2 (#59c680)
D 2 (#411b91)
L 5 (#8ceee2)
U 2 (#caa173)
L 1 (#1b58a2)
U 2 (#caa171)
R 2 (#7807d2)
U 3 (#a77fa3)
L 2 (#015232)
U 2 (#7a21e3)

744
2023/input/19/input Normal file
View File

@@ -0,0 +1,744 @@
btl{m>2179:hzd,a>965:js,x<3167:bc,crx}
ktc{x<2922:A,s<469:R,R}
ctl{m<420:A,s>2487:R,A}
mcm{x>3761:A,x>3654:A,a<829:A,R}
bj{x<1257:xc,sr}
mfq{x<3188:rr,x<3650:R,A}
tlh{a>738:R,A}
zn{x>3618:ph,hvb}
rb{s<892:R,a<2337:A,A}
ms{x<3783:A,x>3900:R,A}
prn{m>2248:R,A}
qtq{a>3468:A,m>2263:A,jt}
dx{a<3314:R,m<3567:R,a<3330:R,R}
vt{x>3136:tcz,x>2504:csv,x>2299:smz,kjt}
xt{x<2452:A,R}
xkc{x<2342:A,A}
st{s<3506:R,A}
zz{s<1239:lxb,s>1671:qgb,m>2346:ts,rbp}
lsh{m>2358:A,s>1491:R,R}
cq{m<2723:R,A}
xll{s<586:A,x<2806:A,x<2947:R,R}
csn{m<2108:R,s>714:A,a<760:R,A}
fr{a<1242:R,R}
dvh{m>1842:gt,s>3457:jhg,jgd}
gxq{a>2315:R,a<2256:A,m>3786:A,R}
vc{x<1484:zlf,x>1814:A,s<520:jsc,R}
hxh{a<3821:gpz,s>1853:mtg,mfq}
pbz{a>2928:xtm,x<2843:vz,m<1108:dv,zg}
xr{m>182:A,s>1810:A,x<3330:A,R}
ps{x>2127:hnp,dgb}
lqg{a<3277:zb,m<1525:mdd,qsz}
jn{x>683:A,m>1020:A,R}
fhk{a<543:R,R}
gvp{m>2630:A,m<1098:R,x>1224:A,A}
ptm{x>1764:A,tj}
sq{m>3289:A,a<312:xt,x>2449:A,fxr}
khp{m>3526:A,A}
dc{x<2210:A,m<1269:bqk,A}
qt{s>278:R,m>2866:R,s>172:R,R}
gm{x<363:A,m>3188:A,A}
shn{m<2469:R,s<3668:mbz,R}
vhg{x<608:A,m<1535:R,m<1981:R,R}
hds{s>2670:xv,blj}
ffr{a>2824:mk,s>3257:br,pl}
td{m<3587:R,s>3340:A,a<3441:zv,hdq}
sgx{s>2973:fm,cvm}
tbm{a<3447:R,x<2836:A,x>2953:A,R}
mk{m>2029:mls,s>3309:sx,tnr}
kfx{s>1999:R,s<1809:A,s<1887:A,A}
tl{s<3243:A,m>724:R,s>3595:A,A}
cdm{a<1934:R,x>1474:A,R}
ksc{x>2830:zj,R}
ngp{m<639:A,m<931:R,A}
jmb{a>414:A,R}
kb{a<3227:A,a<3254:R,s>1475:bvm,dd}
sm{x>1966:A,s>3208:A,fhk}
br{a>2604:zr,x<1844:nj,bn}
szc{x>2026:cmt,nl}
ptb{x>3345:A,A}
hfr{s>3267:R,s>3108:A,x>898:R,A}
qzt{a>452:A,A}
bvb{x>3335:A,m>726:R,R}
gh{s>2919:R,A}
frb{x<2808:A,s>2187:R,x>3086:A,R}
nj{s<3562:fj,zdd}
gfn{x>1559:lzh,a<3447:pj,s<2150:pcz,mm}
kpv{s>1913:A,A}
bd{x>3053:zn,s<719:pqb,a>2965:mkc,vr}
dv{s>1488:R,R}
vr{a<2767:rbh,a<2894:pb,m<2321:pbz,xd}
xff{a>3469:R,A}
rl{a<2707:R,x>1355:bpn,A}
nq{m<1201:mmc,m<1568:nmf,x<1120:dtq,sck}
xgx{m<574:R,x>1164:A,a>3805:R,A}
qcm{x>2564:A,x<2198:R,m>1241:R,A}
tb{m>551:R,m>206:R,m>71:A,A}
nrr{x<2955:A,m>2499:R,m<1664:R,A}
fv{s>3065:R,m>744:R,A}
mf{s>695:dls,a<3530:pp,cmk}
gp{m>1636:A,a>2986:A,A}
fdg{a<3799:A,R}
xjp{m<978:bjn,x>755:rx,dq}
dbc{s>340:R,a>3588:R,A}
qsz{s>1368:ch,m>2826:zd,dm}
bs{x>938:A,A}
pjs{s>3520:mh,s>3245:sg,m>2522:A,A}
mfm{m>687:A,m<414:A,a>815:R,R}
jkr{s>3843:R,mzq}
tlq{a>711:npd,qqk}
qq{a<3021:dmg,m<1998:R,a>3061:ln,frq}
mxm{s>2536:A,s<1125:tpx,fr}
dz{x>3321:A,a<3383:R,A}
sqn{m<1108:A,x<2454:R,A}
bbv{x>1695:R,A}
fzb{a>2748:R,m>727:A,A}
tj{x>994:A,x<569:R,A}
rd{m>3082:vx,a>2081:vn,xn}
tq{x>2808:tb,trq}
lp{s<651:A,m<1731:R,x>3723:R,R}
pb{a>2809:R,a<2785:R,x>2882:nrr,lxx}
ndx{x>3705:pkl,m<2521:R,m<3214:R,xjr}
khh{m>569:A,s>941:R,s<347:A,R}
xc{a>3210:A,m<987:R,s<1171:R,A}
vl{m<2436:R,m>2674:A,A}
mbr{a<376:A,R}
ffv{x>1742:R,a<3619:A,s<529:R,A}
lvr{x>331:R,m>3324:klk,s<3015:A,sgg}
sqp{s<3137:jqr,a>130:pgh,s<3505:A,frs}
lbd{a<2568:lsh,x<1405:A,ffs}
qh{a>3400:gfn,nh}
xj{x>2810:A,m<1464:R,qt}
jz{x>3349:R,x>2888:R,x>2581:R,R}
jgd{s>3243:zzg,R}
vbr{a<3686:R,R}
hk{m>1142:R,m>991:A,A}
vx{a<1949:R,s>1360:A,kc}
tnr{m<1182:A,x<2322:gp,a>3057:R,hr}
ffs{m<1701:A,a>2635:R,A}
klj{x<766:R,a<671:A,x>1199:R,A}
zb{s>2131:ffr,x<2574:kdf,bd}
jhg{m>629:gvv,A}
dj{m>789:A,a>3518:A,A}
krn{m>739:ntr,s>2564:bsz,hzs}
cmk{a<3817:jf,s<378:A,R}
xq{a>813:A,a<773:svl,mz}
mzq{s>3727:R,a>992:A,x<888:A,A}
vqn{x>2380:R,R}
mrf{x<3017:ksc,s<1043:rc,m<319:txc,kbk}
qd{x<859:R,a>3387:tx,A}
cnx{a<3613:A,R}
fgb{x>3100:R,R}
zjq{s<306:R,x>1811:A,R}
qjv{s>1035:qf,tn}
xg{s>2609:A,R}
xv{x<1079:tjh,s<2851:xl,sgx}
lzh{x<1978:ktb,m<937:A,A}
smz{a>534:zdt,x<2415:mv,m<2096:sqn,sq}
lxb{m<1590:mnn,s>488:R,x<3338:bpr,R}
szr{a>292:R,A}
nf{m>2081:R,a>3524:R,m>1915:R,A}
zxh{x<743:A,A}
bjn{s>1703:xgx,m>502:jjx,a>3863:bx,R}
ts{s<1467:A,A}
zfb{a>904:fsj,a>768:R,m<871:qpq,zxh}
tzl{m<2629:dlk,s>2581:R,m>3179:R,prb}
bzf{x>762:R,m<3473:R,R}
zm{x<3028:rzl,s>1458:dg,R}
gmq{m>981:xg,x>3655:A,A}
lbn{s<2515:A,A}
lh{a<504:A,a<885:A,A}
nl{x<1314:R,a>3420:hzr,a<3349:dx,R}
ksm{m<3204:R,A}
rpz{a>3225:ds,x<1030:gm,A}
xb{s<1673:R,s>2816:R,a>1439:A,A}
msc{x<3802:cc,hc}
vk{s>374:R,a>3515:A,A}
md{x<3062:tq,s>2920:ks,gmq}
ntr{s>2551:A,jn}
pl{a<2619:lt,m<1624:hgl,vmx}
cv{s>3403:R,x>3119:R,a<3335:A,A}
pc{a<3417:ptb,x<3314:vdk,s<2948:pv,R}
qhk{m>795:A,s>1386:R,x>1037:A,A}
sn{s<3526:R,a>1248:R,A}
mm{s>3019:st,x<576:A,mzt}
dd{x<2832:A,x<2929:R,A}
tqn{m<3439:A,s<964:R,A}
nkc{x<2397:R,A}
cb{x<1584:gfj,a>3337:nb,R}
bv{m<152:A,a<3361:R,m<260:R,A}
qmm{m>2633:ljk,s<1313:A,fpr}
sx{x<1719:chx,a>3124:qcm,m>770:R,A}
tx{m<2136:R,m>2482:R,a<3464:R,R}
pqb{s>462:jnh,xj}
nzc{a>654:A,s>780:R,R}
rx{s<2123:A,x>1457:A,R}
sls{a>3386:R,s<1305:A,x>3157:kh,A}
fvr{m<3311:A,A}
npd{x<2000:bfv,s>2894:qcz,a>981:tzl,xq}
kf{x<3407:R,x<3652:A,R}
ss{x>2893:R,x<2690:A,a>3086:R,kj}
qk{a>1375:jz,x>2829:lq,a<1229:R,pm}
fqr{s>3038:qtq,x<2313:qd,a<3435:rds,msz}
xd{x>2842:A,s>1412:R,m<3387:R,R}
dg{x>3300:A,x<3173:A,A}
mbz{x<1950:A,A}
zj{s<1270:R,x>2952:A,x>2894:A,A}
ztn{x<2399:vmm,a<666:zjj,btl}
dq{a>3833:R,m<1170:tp,x<323:R,cf}
kk{x>2848:plf,jmb}
cqc{m<1984:R,a<3746:R,m>2346:bbv,R}
cvm{x<1361:A,x>1476:A,R}
nmf{s<1827:sk,qqx}
vbc{a>517:ng,mnb}
kg{s<1832:A,a<3398:A,R}
trq{s<2938:A,R}
nbr{s<3428:A,R}
nb{s>1037:R,x>2105:A,s<410:A,R}
bzs{s>3439:klj,s>3231:A,hcn}
prb{m>2901:A,s<2356:A,m>2759:A,R}
gz{a<3504:qn,qmv}
sf{x>3584:R,a>673:drv,a>384:A,A}
sh{m>1711:A,A}
hr{x<3120:A,m>1725:R,s<2538:R,A}
mlz{x>1121:A,R}
zr{x>2228:ff,A}
bvx{m<3203:A,R}
dtq{x>669:lsk,A}
jf{s<434:R,x>2922:R,m<2086:R,R}
ff{a<2720:R,s>3716:A,s>3513:R,R}
mhh{s<731:prf,kgj}
ljt{a>3420:A,s<1675:A,A}
ktb{a>3433:R,a>3412:A,R}
mzl{m>2308:sz,x>505:vhg,m<1383:A,A}
pt{m<3534:jct,x>1132:R,a<3434:A,A}
pxs{a<888:jc,x<1590:R,s>630:A,R}
fxd{x>1746:R,s>2931:A,x<1473:A,R}
vz{m>1081:A,m<520:A,s<1514:R,R}
pqg{m<341:R,a>492:R,m<513:A,R}
jqr{s<2665:A,A}
mdq{m>1424:R,a<497:ngp,A}
fdn{s<506:rfj,s<789:qrg,A}
dmm{m<274:A,A}
fsx{m<1699:R,x<1215:lh,m>1802:R,lbn}
lc{x>842:bs,x<785:mmg,A}
jx{x>2421:R,a>3815:R,A}
lq{s>817:A,R}
qlj{a>904:A,R}
qrg{a>896:R,R}
tcz{s>648:sf,ndx}
jjp{s>1084:R,A}
hp{x<1315:nbq,s>596:cqc,m>2358:cnx,qns}
lm{a<1592:R,s<2691:A,x<2735:A,R}
rdr{x>1537:zmh,m>3053:dpb,qxp}
vbg{x<2936:nzq,m>2444:nmb,x>3372:dl,fgb}
xp{a<3416:A,tz}
pgh{x<1953:R,a<271:A,R}
rvv{s<3490:A,A}
zdt{a<879:csn,a>1039:R,A}
mx{s<602:kpq,nzc}
bq{m>3798:R,s>401:zpf,lsf}
tr{a>1619:A,x<1673:R,s>1749:A,R}
zzg{s>3380:A,R}
cgx{m<528:A,m>1173:R,x<1284:dj,A}
qxp{x>765:A,x>393:A,R}
nc{a>3563:A,s>1570:R,khh}
tbc{x>353:gqg,nbr}
njp{a>351:R,m>2453:ktc,x>2811:R,dht}
ds{x>883:A,A}
lfc{x>1832:R,s>3439:A,s>3169:R,R}
mt{m>1399:R,m>763:A,A}
vbt{s<3558:A,x<594:R,R}
fg{m>3746:R,a>2323:A,A}
ctp{m>2809:R,m<2504:R,a<1765:R,R}
vv{m>2151:R,A}
rh{s>3304:R,s<3095:A,m<140:R,A}
kdf{a<2917:mp,xsq}
qn{x<1183:R,a<3486:A,a>3496:R,A}
tz{x<3141:R,m>1397:R,s>937:A,R}
nls{m<2817:R,R}
xjl{s<1978:R,x>939:A,R}
lnz{s>3386:mlz,x<1526:vd,m>864:A,A}
mn{x>1476:td,x>743:pt,lvr}
hlm{x>3684:A,s>1106:R,m>1014:A,R}
mtg{m>565:zh,x<3078:R,rt}
hcn{m<3119:R,m>3624:A,A}
hzs{x<1009:R,s<2420:A,a>616:ctl,R}
rmc{m<3127:A,x>3366:R,A}
hzd{m>3173:R,m>2552:qlj,kf}
jbc{x<1179:A,m<647:A,a>3418:A,A}
nvr{m<1005:sls,a<3380:zm,m>1305:xp,jvd}
fpr{m<1187:A,a<472:A,a>860:A,A}
df{s>2631:A,A}
gqg{a>232:R,R}
qns{m>1809:nf,a>3526:zjq,m<1690:msm,R}
cp{m<755:A,a<1604:R,a<2017:R,A}
qmv{x<846:A,R}
bc{m>889:R,s<1465:R,hvg}
ht{a>685:pxs,vc}
hpt{x<2157:dbc,a<3716:vk,s>281:A,A}
xrh{x>3051:ld,x<2974:A,s<625:R,R}
tp{s<1858:A,A}
tcx{s<3127:R,x<705:A,m<1138:A,A}
vmx{x<2184:A,a>2696:zx,a<2659:A,R}
mg{m>2756:R,A}
zh{a<3910:R,A}
kbk{m>444:A,s<1576:R,m>387:dz,kfx}
nzq{a<2309:R,nkc}
pm{a<1302:A,A}
gfj{s>1127:A,m>840:R,m>406:A,A}
pq{s>2315:prd,x>3516:msc,m>638:nvr,mrf}
vg{a>92:A,A}
lsk{x>883:A,R}
xjr{m>3705:A,m<3445:A,A}
mdp{s>2716:R,m>2326:A,R}
ng{a<902:bzs,s>3611:jkr,m>3139:bzf,mxr}
mkc{a>3147:kb,ss}
vn{x>1404:A,m>2663:nls,s>2069:A,A}
mnb{x<657:tbc,x<1083:hzn,x<1315:rvv,bvx}
gr{a<2816:A,gvp}
kpt{x<2223:R,x>2355:R,m>826:A,R}
kq{m<686:A,x<1726:A,A}
krq{a>3559:R,A}
vrc{x>1988:kpt,x<1867:kq,A}
lr{a>877:R,a<672:R,s<1840:A,R}
kpq{x<2274:A,m<1226:A,R}
lz{m>410:A,s<3265:R,A}
gq{s<734:A,A}
kgj{s<940:R,R}
jzf{a<494:szr,dxx}
dxl{a<240:A,s<3664:R,a>393:A,R}
kj{m>1586:A,s<1432:A,A}
zv{s<2784:R,m<3845:A,R}
mmc{m<489:A,x>800:cp,x<492:A,lv}
rfj{x<2731:R,a<932:R,R}
gt{a>535:A,m>2660:R,dxl}
xz{s<919:A,a>3375:R,a<3323:R,R}
msm{x<1902:A,x>2051:R,R}
kv{x<3257:mdp,pz}
hc{m<981:R,m>1233:vcc,A}
svl{m>2596:R,m<1427:A,s<2457:R,R}
jbk{x>2665:R,fdg}
mnn{x>3181:R,a<2055:R,R}
pp{s>379:R,prn}
zd{s>838:qjv,vj}
bqk{a<659:A,R}
lxx{s>1514:R,s<1107:R,A}
rr{m>917:A,A}
qb{m<866:A,x<3264:A,A}
gpz{m<586:A,x<2959:vbr,psk}
nmb{m<3444:R,x<3463:gxq,fg}
dh{s>1463:R,m<1939:R,x<2802:A,R}
dl{x>3628:ms,a<2300:R,m>972:R,rb}
qqk{a>342:sm,m<1336:vrc,m>3048:sqp,xgf}
hl{a<1602:qk,hb}
bx{x>1180:R,x>778:A,a>3924:R,A}
zmh{a>426:A,a>282:A,s>1983:R,R}
zjp{s<2722:R,a<528:R,A}
tpx{m>3219:R,m<2950:A,a<1253:R,R}
klk{m>3694:A,x<183:R,A}
rz{a<3506:lnz,cgx}
bl{s<1061:A,R}
rzl{x>2887:A,s<1195:A,a>3315:A,R}
gjm{s>1424:A,R}
qvp{m<250:R,x<3365:cv,lz}
ll{m>1291:km,x>1101:R,tcx}
zdd{x>950:A,s<3747:R,s>3895:R,R}
pk{s>2497:R,A}
jbq{a>150:R,x<1869:A,s>3035:A,A}
jbg{m>1413:fpl,m>832:bgs,jxk}
xsq{a<3129:qq,m<1811:bj,rpz}
bk{m<801:R,s<1388:R,x>3521:A,A}
vh{m>1098:R,qb}
cf{x>588:R,m<1337:A,x>456:R,R}
cm{x<3470:R,a<767:R,a<841:R,R}
hgl{a<2694:A,x>2481:fzb,s<2721:nvl,R}
ln{s>1320:R,s>587:R,A}
fxr{x>2433:R,a<402:R,x>2425:R,R}
jxk{x>2962:A,A}
hjx{a<1824:A,a>2071:R,A}
ph{s>1228:R,x<3787:lp,m<1465:gq,tv}
gqt{m>3165:gjm,x>1383:xb,m>2542:R,pbs}
dht{a>227:A,A}
txc{x<3296:bv,x<3371:xr,kg}
prd{a>3385:pc,m<586:qvp,vh}
lv{s<2096:R,s>3093:R,a<1943:R,A}
in{a>2381:lqg,kt}
nnc{x<768:R,a<909:A,R}
jck{x>3539:R,A}
kmr{a<534:A,x>695:R,a>784:A,R}
km{x<1307:A,R}
lnb{x<1064:btd,ht}
fvf{x<1348:R,a>622:R,np}
nt{s<3461:R,s>3804:A,A}
rnf{m<3315:A,m>3648:R,R}
rbp{m>1386:dh,x<2829:A,a<2063:xbm,bk}
mh{a<3931:A,a<3977:A,R}
gxx{s>2790:A,m>3143:R,A}
mdd{a>3604:jhm,a>3476:lf,x<2639:qh,pq}
vnz{a>3562:gh,m<899:tc,ll}
hdq{s<2919:A,R}
czc{a<3340:R,A}
hsz{s>1716:R,m<3459:R,R}
sk{m<1435:A,m>1514:A,A}
rlm{s>2276:A,x<3215:R,A}
fm{s<3035:A,a<721:A,A}
qc{x>1032:R,s>3491:A,x<472:R,R}
ks{m>878:hxf,a>3523:xkl,m<331:rh,R}
pbs{a<1399:A,x>611:R,R}
pz{s>2498:zns,x>3535:R,m>2357:qzt,R}
kn{a<2476:R,a>2568:A,R}
jjx{s<1082:A,x>1394:R,a<3796:R,A}
bpr{x<2816:A,a<2100:R,a>2147:R,R}
nbq{s>827:R,x<811:A,R}
jvd{a<3414:A,x<3179:tbm,s<1179:rtb,A}
jfh{x>2953:jck,rf}
xbm{a<2003:R,m>805:R,A}
mxr{m<2849:A,s<3388:R,qc}
qf{s<1147:khp,m>3428:A,a<3755:A,cvb}
kc{x>1142:R,s>808:A,A}
mz{x>2329:A,A}
jtq{a>3533:nc,x<2279:gz,tmn}
xkl{s<3498:R,x<3655:R,m>579:A,R}
dk{m<2597:msd,s>3101:vbc,hds}
pmg{x<982:R,x<1279:A,x>1466:A,R}
sxq{x<522:R,R}
xtm{x<2736:A,m>1180:A,R}
jhm{x>2234:hxh,xjp}
dkd{a<3547:R,s>3418:R,m<205:A,A}
prf{x>104:R,s<361:R,a<175:R,R}
rtb{a>3441:A,x<3362:A,R}
xk{x<2496:tlq,dxt}
tmn{m<683:R,A}
ddg{s<3705:A,s>3809:R,A}
tn{a>3545:jx,x>1940:R,a<3426:xz,tqn}
jc{s>401:A,A}
zns{m>1441:A,R}
sd{x>1272:R,m>3566:R,A}
hvg{m<504:A,s>1752:A,A}
hzr{s<1668:A,R}
lk{a>356:vbt,s>3501:A,hfr}
dpb{m>3385:A,x>666:A,R}
hgt{a>433:jdh,sd}
rf{x>2598:lm,m<2430:xkc,hjx}
mls{a<3004:pr,a>3113:R,a>3043:A,A}
dmg{a>2964:R,s<1321:A,x>964:A,R}
dn{s>1740:A,m>3131:R,A}
js{m>950:cg,m<324:A,bvb}
np{m<3013:R,m>3155:R,R}
kp{s<3049:jbk,a<3841:shn,x>1423:cq,pjs}
vmm{s<1649:qmm,m<2417:gsr,rdr}
kh{s<1884:A,m>825:A,a>3341:A,A}
jnh{a>2750:R,a>2615:R,xll}
pj{x>623:jbc,x>325:R,x>190:zhz,ljt}
sr{m>754:R,R}
xgf{x<2091:jbq,m<2015:R,s>3106:A,R}
bfv{s<2825:R,m<2639:A,a<866:lfc,A}
cmt{x<3271:A,a>3416:hsz,s<1910:czc,A}
sz{m>2962:A,x<403:R,s<608:R,A}
mzt{x>1079:R,m>748:R,x<883:A,A}
mfx{s>2396:A,x<2183:R,R}
bpn{m<1985:A,A}
sgg{s>3658:A,A}
rt{s<3055:R,x<3432:A,x>3756:R,R}
mmg{a>437:R,x<716:R,a>227:R,A}
fsj{a<1063:R,m<1035:R,a>1107:A,A}
pv{m>746:A,x>3612:R,a>3447:A,R}
pkl{x>3867:A,x<3785:A,x>3823:A,A}
rds{m>2024:rlm,x<3330:frb,A}
frq{m<3236:A,R}
qgb{m<2650:A,s<1803:dn,s<1901:A,rmc}
tv{a<2788:R,s>752:A,x<3927:R,A}
dxt{s>3004:dvh,kv}
fj{x>1215:A,x>565:R,R}
vcc{m<1348:A,x<3921:R,A}
drv{s<819:R,A}
lf{s<2369:jtq,x>2551:md,a<3528:rz,vnz}
gsr{a<494:A,x>1443:lr,m>1606:nnc,xjl}
vdk{x<3083:A,A}
lsf{m<3737:A,s<141:A,A}
hb{m<2003:kbz,ctp}
cc{m>736:hlm,R}
xrk{m>425:R,s>2668:A,A}
sck{m>1720:R,s>2392:fxd,sb}
sb{x<1612:R,m<1648:R,R}
bsz{s<2798:xrk,x<559:pqg,dmm}
msd{s>2998:ljz,m<1357:krn,m<1917:kbn,jzf}
ljk{x>1194:R,x<662:R,R}
jsc{a<349:R,s>319:A,m>1497:A,A}
hnp{s>1977:jfh,a<1962:hl,a<2222:zz,vbg}
zx{m<2818:R,R}
zlf{a<446:R,x>1241:R,R}
vj{m<3222:hpt,m<3705:ffv,m<3883:bq,ptm}
cvb{m<3215:R,A}
hzn{m>3285:R,m<2851:mg,a>245:mbr,nt}
pr{m>2749:A,s<3353:R,R}
zjj{s<1735:jbg,a<236:kxv,s>1917:mdq,mt}
kbz{m>1072:R,R}
frs{m<3639:A,A}
qpq{s>3340:A,A}
zhz{s>2384:A,a<3425:A,R}
vp{a<1494:gqt,x<1390:xfs,bh}
xn{x>1056:cdm,A}
kxv{m>2357:A,s<1937:A,A}
jct{m<3233:A,a>3464:R,A}
pcz{a<3458:A,x>684:qhk,xff}
tfm{s<3188:R,s>3536:ddg,m<769:A,hk}
plf{s>603:A,a>529:A,m<873:R,R}
cl{a<672:A,m>3434:R,R}
dm{x>2258:mf,hp}
tc{m<571:dkd,x>1248:tl,a<3550:fv,R}
cg{s<1749:R,m>1649:A,R}
nh{s>2067:tfm,cb}
gd{m>2813:mxm,s<1973:clg,zlv}
zpf{s>611:A,x>2005:A,a>3586:R,R}
crx{m>1372:cm,x>3544:mcm,s<1761:mfm,R}
pvx{x>412:sxq,tlh}
hxf{m<1165:R,s<3478:R,x<3387:R,A}
ld{s<541:R,R}
hvb{m>2487:xf,R}
bgs{m>1139:A,s<1410:R,a<247:R,A}
csv{m<1406:kk,a<727:njp,x>2888:xrh,fdn}
vd{x<712:R,s>3036:R,R}
bvm{m<1633:A,a>3264:R,R}
xfs{s<1729:jjp,s>3009:R,a<1591:rnf,R}
lt{a<2497:df,s>2781:vv,m<1694:mfx,ct}
rbh{x<2891:A,s>1660:A,a<2615:kn,A}
mp{s<885:rl,a>2713:gr,lbd}
knn{s>1107:ztn,x<2166:lnb,vt}
dlk{x>2261:A,x>2129:R,x>2072:R,A}
dgb{m<1995:nq,a>1664:rd,a<1348:gd,vp}
mv{a<268:vg,x<2362:A,s>559:R,vqn}
kt{a>1146:ps,s<2172:knn,x>1653:xk,dk}
kjt{m>2495:cl,x<2239:dc,mx}
nvl{x>1280:R,s>2377:R,R}
bn{a>2486:R,x<2690:sh,A}
jdh{a>842:A,x>1214:A,m>3586:R,A}
qcz{s>3420:R,A}
clg{s<688:R,vl}
chx{m>848:A,A}
sg{x>651:A,A}
zlv{s<2655:A,s>3252:sn,s<2901:A,R}
bh{a>1576:tr,a<1546:R,x<1711:fvr,kpv}
fkf{x>546:A,ksm}
dxx{a>905:A,A}
jt{x>1660:R,R}
gvv{x<3220:A,A}
blj{s>2421:pmg,x<842:fkf,m<3248:fvf,hgt}
xf{x<3424:R,x<3546:A,s>839:R,A}
kbn{x<963:pk,fsx}
ljz{a>575:zfb,lk}
qqx{a<1756:R,s<2864:A,a<2156:A,R}
dls{a<3555:A,x<3232:A,m<1998:bl,R}
msz{a<3499:qnq,s>2353:krq,a>3546:A,A}
btd{x>678:lc,a>482:pvx,x<257:mhh,mzl}
tjh{s<2953:gxx,kmr}
psk{x<3637:R,R}
xl{s>2768:R,m>3161:R,zjp}
zg{a<2914:R,a<2920:A,R}
ch{a>3595:kp,m<2854:fqr,s<2250:szc,mn}
qnq{x<3299:A,m<1979:R,a>3470:R,R}
fpl{m<2606:R,a<272:A,x>3396:R,A}
ct{s>2351:A,R}
rc{s<587:A,R}
{x=30,m=1468,a=2095,s=832}
{x=291,m=42,a=1683,s=2618}
{x=304,m=174,a=1204,s=1552}
{x=519,m=19,a=8,s=2512}
{x=351,m=650,a=1814,s=479}
{x=1888,m=2669,a=304,s=1144}
{x=1577,m=787,a=449,s=2384}
{x=439,m=189,a=468,s=1163}
{x=1735,m=1839,a=514,s=978}
{x=677,m=2379,a=279,s=3588}
{x=2535,m=864,a=1,s=144}
{x=2201,m=13,a=384,s=184}
{x=661,m=609,a=223,s=1274}
{x=1253,m=2548,a=106,s=2549}
{x=357,m=184,a=491,s=828}
{x=288,m=1049,a=256,s=2296}
{x=1995,m=2523,a=1487,s=659}
{x=2028,m=445,a=1788,s=1788}
{x=1387,m=2372,a=273,s=22}
{x=48,m=2361,a=2070,s=2}
{x=2091,m=45,a=222,s=3005}
{x=1460,m=105,a=1024,s=1152}
{x=176,m=2650,a=462,s=320}
{x=2020,m=185,a=47,s=987}
{x=1624,m=564,a=252,s=42}
{x=2440,m=177,a=1593,s=445}
{x=78,m=504,a=3709,s=2}
{x=405,m=457,a=1543,s=732}
{x=1098,m=450,a=176,s=331}
{x=270,m=2383,a=1434,s=561}
{x=732,m=245,a=2194,s=157}
{x=437,m=1041,a=345,s=969}
{x=889,m=1480,a=2534,s=1197}
{x=1096,m=310,a=1996,s=18}
{x=1627,m=61,a=472,s=260}
{x=20,m=51,a=135,s=565}
{x=1800,m=894,a=194,s=708}
{x=12,m=2267,a=2116,s=299}
{x=3053,m=311,a=9,s=90}
{x=1139,m=1033,a=373,s=1042}
{x=873,m=997,a=1511,s=581}
{x=1888,m=435,a=325,s=1121}
{x=2255,m=634,a=1674,s=521}
{x=109,m=344,a=370,s=1376}
{x=37,m=1166,a=876,s=342}
{x=491,m=55,a=1324,s=313}
{x=435,m=125,a=1458,s=2500}
{x=270,m=1685,a=2144,s=133}
{x=2206,m=601,a=1892,s=2193}
{x=2000,m=33,a=1963,s=146}
{x=582,m=556,a=67,s=203}
{x=473,m=2514,a=1622,s=645}
{x=3233,m=100,a=301,s=1136}
{x=3125,m=1441,a=116,s=2545}
{x=60,m=1107,a=1346,s=120}
{x=1799,m=310,a=486,s=2576}
{x=614,m=3421,a=233,s=742}
{x=374,m=171,a=636,s=1310}
{x=1578,m=106,a=2625,s=2158}
{x=1584,m=3382,a=35,s=24}
{x=342,m=2716,a=639,s=107}
{x=1060,m=430,a=1286,s=857}
{x=21,m=1364,a=3339,s=505}
{x=94,m=733,a=1353,s=103}
{x=867,m=103,a=705,s=1848}
{x=1903,m=12,a=1022,s=690}
{x=656,m=1527,a=1847,s=400}
{x=1992,m=2053,a=188,s=1163}
{x=1499,m=122,a=575,s=799}
{x=132,m=556,a=1274,s=623}
{x=215,m=1,a=985,s=905}
{x=863,m=3,a=2174,s=588}
{x=483,m=40,a=1438,s=604}
{x=282,m=479,a=331,s=441}
{x=335,m=55,a=552,s=832}
{x=972,m=1415,a=2113,s=72}
{x=1218,m=1772,a=1019,s=3715}
{x=2111,m=1344,a=175,s=1745}
{x=1938,m=1538,a=846,s=2248}
{x=12,m=49,a=1178,s=256}
{x=3341,m=558,a=257,s=2343}
{x=1134,m=579,a=530,s=929}
{x=2490,m=3368,a=1767,s=2483}
{x=2770,m=2724,a=48,s=1316}
{x=404,m=81,a=2311,s=1219}
{x=3758,m=1010,a=247,s=2868}
{x=1036,m=818,a=34,s=1522}
{x=1567,m=916,a=3743,s=1340}
{x=56,m=197,a=2229,s=449}
{x=1362,m=933,a=399,s=168}
{x=64,m=1299,a=133,s=276}
{x=400,m=2046,a=2616,s=604}
{x=76,m=1689,a=1694,s=1157}
{x=3495,m=421,a=318,s=141}
{x=1946,m=1287,a=1537,s=781}
{x=3455,m=116,a=1096,s=2497}
{x=340,m=28,a=1653,s=756}
{x=835,m=1199,a=2735,s=3386}
{x=1360,m=331,a=1525,s=447}
{x=1897,m=54,a=1499,s=785}
{x=1397,m=137,a=3133,s=73}
{x=404,m=618,a=110,s=2929}
{x=2181,m=1486,a=200,s=267}
{x=1393,m=459,a=978,s=3242}
{x=20,m=732,a=717,s=901}
{x=122,m=1659,a=1380,s=1062}
{x=88,m=280,a=830,s=3223}
{x=1849,m=299,a=914,s=469}
{x=332,m=1083,a=69,s=101}
{x=29,m=73,a=294,s=122}
{x=643,m=50,a=1870,s=542}
{x=432,m=3087,a=1676,s=540}
{x=1076,m=133,a=488,s=75}
{x=928,m=590,a=41,s=1120}
{x=2118,m=433,a=15,s=108}
{x=503,m=850,a=936,s=454}
{x=1413,m=2695,a=2012,s=302}
{x=605,m=1234,a=3678,s=1865}
{x=486,m=265,a=1297,s=567}
{x=339,m=1762,a=2151,s=301}
{x=1791,m=1541,a=649,s=433}
{x=1544,m=232,a=168,s=1350}
{x=1341,m=727,a=333,s=2885}
{x=1886,m=193,a=1203,s=1036}
{x=68,m=82,a=429,s=2446}
{x=495,m=1587,a=677,s=859}
{x=1343,m=197,a=24,s=3101}
{x=349,m=292,a=711,s=1088}
{x=104,m=320,a=143,s=2128}
{x=963,m=771,a=69,s=668}
{x=1064,m=661,a=1968,s=1494}
{x=1014,m=678,a=2934,s=801}
{x=2602,m=347,a=1408,s=205}
{x=864,m=1564,a=1397,s=102}
{x=1619,m=1208,a=948,s=83}
{x=809,m=7,a=60,s=1191}
{x=2038,m=114,a=3360,s=1076}
{x=95,m=2987,a=426,s=6}
{x=381,m=1444,a=761,s=2737}
{x=1015,m=1787,a=234,s=1468}
{x=278,m=553,a=1181,s=560}
{x=320,m=1392,a=1290,s=477}
{x=319,m=2859,a=222,s=1168}
{x=1,m=877,a=1309,s=707}
{x=1955,m=1966,a=708,s=1380}
{x=73,m=57,a=395,s=130}
{x=1976,m=3300,a=1230,s=3208}
{x=1936,m=1835,a=189,s=1643}
{x=1870,m=23,a=105,s=3217}
{x=934,m=1711,a=356,s=1080}
{x=89,m=509,a=177,s=2545}
{x=1482,m=294,a=354,s=53}
{x=584,m=1489,a=473,s=2022}
{x=1763,m=41,a=868,s=540}
{x=41,m=1101,a=1061,s=1343}
{x=1482,m=497,a=1497,s=1471}
{x=2955,m=25,a=1569,s=1167}
{x=238,m=875,a=1452,s=169}
{x=228,m=1486,a=7,s=1355}
{x=803,m=3175,a=1845,s=882}
{x=2991,m=1441,a=1185,s=939}
{x=1005,m=2013,a=711,s=1203}
{x=759,m=548,a=1201,s=1640}
{x=1868,m=935,a=1333,s=1135}
{x=503,m=710,a=34,s=611}
{x=595,m=865,a=2702,s=2969}
{x=10,m=1488,a=616,s=341}
{x=2304,m=1845,a=72,s=1269}
{x=2233,m=804,a=2966,s=1606}
{x=30,m=803,a=353,s=937}
{x=313,m=1348,a=2274,s=648}
{x=1250,m=632,a=222,s=595}
{x=696,m=1498,a=314,s=497}
{x=910,m=602,a=3207,s=2059}
{x=1026,m=1378,a=355,s=910}
{x=2862,m=3299,a=1324,s=1437}
{x=136,m=10,a=7,s=1813}
{x=388,m=1008,a=583,s=1480}
{x=439,m=44,a=2516,s=427}
{x=242,m=1041,a=2178,s=408}
{x=2245,m=291,a=1358,s=694}
{x=198,m=2155,a=365,s=327}
{x=271,m=24,a=332,s=3150}
{x=3419,m=1641,a=48,s=2530}
{x=1248,m=166,a=2678,s=99}
{x=286,m=139,a=2293,s=356}
{x=1201,m=35,a=612,s=1236}
{x=549,m=115,a=175,s=241}
{x=991,m=1606,a=718,s=2651}
{x=93,m=2205,a=835,s=206}
{x=719,m=64,a=2252,s=2722}
{x=2468,m=1167,a=92,s=674}
{x=202,m=92,a=1905,s=1400}
{x=128,m=526,a=385,s=666}
{x=102,m=1285,a=166,s=687}
{x=650,m=2611,a=2686,s=10}
{x=1307,m=2221,a=489,s=884}
{x=902,m=961,a=9,s=309}
{x=629,m=1339,a=174,s=3762}
{x=282,m=69,a=3507,s=119}

17
2023/input/19/test-1 Normal file
View File

@@ -0,0 +1,17 @@
px{a<2006:qkq,m>2090:A,rfg}
pv{a>1716:R,A}
lnx{m>1548:A,A}
rfg{s<537:gd,x>2440:R,A}
qs{s>3448:A,lnx}
qkq{x<1416:A,crn}
crn{x>2662:A,R}
in{s<1351:px,qqz}
qqz{s>2770:qs,m<1801:hdj,R}
gd{a>3333:R,R}
hdj{m>838:A,pv}
{x=787,m=2655,a=1222,s=2876}
{x=1679,m=44,a=2067,s=496}
{x=2036,m=264,a=79,s=2244}
{x=2461,m=1339,a=466,s=291}
{x=2127,m=1623,a=2188,s=1013}

58
2023/input/20/input Normal file
View File

@@ -0,0 +1,58 @@
%rq -> ch, sj
%nf -> sm, rg
%pc -> rz, zp
%xt -> bc
%nt -> kq, sj
%hc -> kb, zp
%rd -> lk
%ml -> pp, xt
%sq -> kl, sj
%jg -> fl, rg
&xl -> df
%kl -> mb, sj
%nd -> rg, jg
&rg -> cs, zb, cp, vz, gp
%mf -> zp
%rz -> zp, fr
%kk -> rg, bj
%nb -> qj
%pr -> pp
&zp -> vl, lk, rd, kb, xl
%fl -> nf, rg
%tb -> pk, pp
%bh -> pp, pr
%nh -> sj, rq
%lk -> hc
%cp -> kk
&ln -> df
&xp -> df
%bc -> nb, pp
%lj -> rg
%vz -> nd
%vl -> lv, zp
&gp -> df
%hd -> pp, bq
%fq -> pp, bh
%pk -> fq, pp
%cs -> zb, rg
%sn -> fd
%kq -> sj, qq
%zb -> vz
%lv -> zp, rd
%qj -> pp, hd
%fd -> nt
&df -> rx
broadcaster -> vl, cs, cn, ml
%bq -> tb
%kb -> pc
%cn -> sn, sj
%qq -> sq
%mb -> sj, nh
%jd -> zp, mf
&sj -> xp, qq, cn, fd, sn
&pp -> ln, ml, xt, bq, nb
%sm -> rg, cp
%ch -> sj
%bj -> lj, rg
%fr -> zp, mr
%mr -> zp, jd

5
2023/input/20/test-1 Normal file
View File

@@ -0,0 +1,5 @@
broadcaster -> a, b, c
%a -> b
%b -> c
%c -> inv
&inv -> a

5
2023/input/20/test-2 Normal file
View File

@@ -0,0 +1,5 @@
broadcaster -> a
%a -> inv, con
&inv -> b
%b -> con
&con -> output

131
2023/input/21/input Normal file
View File

@@ -0,0 +1,131 @@
...................................................................................................................................
.#....#......#.#......#...#...##.....#.#.#....#.##....#...#.............#.#......##..#.......#.............#......#...#..#...##....
..#...#.#.#....####.....##.........................##.#..#...............##.......#....#.....#........#...#.....#.......#..........
.#.......#......#.#.#....#..............###...#................................................#....#.#..............#.............
................#....#....#..........#........#....................................##....##........#.....#.#....................#..
.................#..........#...........##...#......#.#.#..................#......#.........##....#...#.....#.#........#..#........
..##...#..........#...#..##..#.............#................................##......#.....#.........#..........#.#.....##.#.#......
.#.......##.....#....#...............#....##.......................#..................................#..#.........................
..#.#.....#........#.........................#................#..............#.................#.......#...#....#.#..#....#..#.....
.......##.........#..............#.........##..#..............#.....#....................#.#..........#..#.#.#....#.......#......#.
.#......##..............#..........#..........#.....................#.##..........##.....#...#...#......#...#......#..#..........#.
....#.........##......#.#.#...#................#.............#..........................#..............#...............#........#..
........##......#..##.....#..#..#.............##.........................#.......#.###....#..#................#....................
...#..#.#..........##...#..#....#...........#........................#...#...............#....#.....#......#....#....#....#........
.........#.......................#.....#..##............##.#.#.#...#.....#.#...........#.#............#..##...##..............#....
.#.#..#.#......#.........#...#..#.......#.#..............##.......##...................#....#........##....##..........#.........#.
...................#.....#..#.....#....###...............#........#......#..#.........#.##.#.#......##..#.....#.#...............##.
.#..#.........##....#...#..........##...#..............#...#........##...#...............#...............##.....#..................
....#.......#...................#...................................#..#...#..#..................#.##..###.......#..#........##....
.#.......................###.....#......................#.#.....#...#..##...#.#...........#.....###............####...........#.#..
...#.........#........................#..............#..#.#..............#................#......#..#.##...............##..........
.....#..........#......#....#....................#.#..........#.#...........#.#.##.............#..#......#..#......#...##...#......
...#..........#.............#.....................#......................#.......................#.............#.....#.............
..............................#..##...................#...#...............#.#....#....................#.......#..............##....
.#...##.....#.....#..#...#........#..............#.#...#.....#.......#..##..#.................#......................#..##.........
....#....................#......#...#...........#.........#.......#..#.#...........#......................................#...#....
..#.#.........##.....#........#...............#.##......##...........#........#.......................#..#.....#...............#...
..##............#........#.....#..#.......#......##...#.#......#......##.............#..........#..#........#..#...............#...
........#...##.......#....#...............##....#.....#.#...#....................#...#...........#...#.....##..........#...........
.#.#.....................##...#.........#............#..#.......#.#....#....#...#..#....#.............#.#.........#................
...........#..........#..#.#...#....................#.................#.##...#.......#.#......................#..#..#.....##.......
...#...#.......##.....#...##...........#............#..................#..#...#.#...#......................#....#...#..........#...
....#..#.....................#.......##.###......#............##....#..#.......##..........##...............##....#...#.........#..
.................#...#.....#..........#...........#..#............#..#...#..#..#....#.#.......#..............#.#......##...........
...#.....................#.........#.#..............#....#....###....##......#......##..................#...........#......#.......
..#..#............#.#..#..........#...#....#.............#......#......#...#........#.#.###..##..........#.#.........#...#..#....#.
.........#............................#.....#.....#...#...#...##......#.......#.#.#....##.#....#.#.......#...#..#.#.......###.#....
.#....#.#......#.......#........##....#....#..#..#.##........#....#.........##............#......#..............##...#..........#..
..#..#..#....#.......#.#.......#...........#..........#.......##..#..........#............#.......................#...#............
........#.#........#...............##..#....##...##....#..#....#........#.................#..................#.##.#.......##.......
..........#....###.##.............#.#.#......#........#........#....#.............#.##........#......................#.#.......##..
........#........#.#..........##..#.#....#.........##..........#..........#..........#....#.#.........#.......#.....#...##......#..
...............#..................#.#.##......#..#..##....#..........#...#......#..#..#.....#...##...............##............#...
............#.................#.........#....#......#.............#........#.......#.#...#........#..............##.........#....#.
...#....#..#...............#...........#.#.....#.......#.................#.#........#..#.#....#.......................###..........
............#.............#......#...#..#..#.......#.###..###...............#...........#...........##....................##.##..#.
........................#.#..#..#..##.#.#....#......#..#..#.....#.#..............#......#..........................................
.#.#.....................#..#...##..........##.#..#..#.##..#................#..##....#........#....#.#.#.........................#.
...#.....................#.....#...#...#....##....#...............................#...#.#................#..#...........#..........
...#....#............#.#.........#.......##.......#....................#.........#......#...........#....#...#.............#..##...
..#......................#.......#....#.#....##....#......#..........#....#.#.##..#.#.....#...##...#.##..###...........#...#....#..
..................#..........#.........#........................#.##...............#...#...#.#............#........................
........#.................#.....#..#.............#...#.#.##.......#.............#.#........#...#..#...........#..................#.
...#................#.#.#.........#.......#....#.........##........##...###.............#..#.#...#.................................
.....#.............##.##...##.............#.......#.#........##......#...#.......##.#.....................#......#.#.......#..##...
.........................#.............#...................##...#.......#.....#.........#..#......#.#.#........#.#..............##.
.............#......#..................#...............#...........#...#..........#.....#.....##....#.#...#...#.#.............#....
..............#....#............##...##....................#............#....#.##....#.##..#.#....#............#..#...........##...
........................#..................##..#.......#......#....#..............###........##.........#...#.....#.#............#.
..........#.............#..#.............#...........#..##........#........#..#................#......................#.........##.
.............#..#.....#..#....#...#.....#....#.#.....##...............#......................#.............#......#...#............
..........#...................#.......#............#....#.........#.............#..............#.#..........##.#........#..........
.............................#...........#...........##..#.#......#....#.....#....#..#...............##.#.....#...........#........
........................#.#.#.......#.##.....##......#....#..........##.........#...............#.#..#.##.....#....#..#............
......#....##...............#..#....#...#.....#......#....#.............#.#........#.#.....#.#.....###.#.........#...#...#...#.....
.................................................................S.................................................................
.....#.#...#...............#.....##......#..........#....#...............#.......#..............#.#.................#..............
................##.#..#..........#.#...#......................#..............#...........#...#..#.....##.........#.................
.......#.#........#.#...........#........#...........#..#.#.............#............#..........#.....#...................#........
..............#..#.................#..#........###..#.......................##.##..........#....#..#...#.##..#.#.###....#..........
.............#.....#.....#.........#..#.......#.......#......#..........#.........#............................#.....#.............
..#.......#....##.......#................#.#...........#...#..###.#........#........#.#...#............#.......#.#...#.............
............#.........#..#....#........#...#.........#...#............#............#....#..#.................#.#......#........#...
...#.............#....................#.............#..............#..#..................#...#...#.#....#...#.##....##..........#..
....#........#..##..........##.....#.....#....................#..........#...........#.#......##................##...........#.....
......#.......#..#..#...##...#................#.#.......#......##.#......#..#..............#....#.....#..#....#.#...#...........#..
.....#.......................#..#..........#..........#........#......#...#..#..#...........................#......#..........#..#.
.....##...........#....#.........#.........##...................#.#..##.#..#..##.#..##...........#......#....#...##.............#..
.#......................#.#..##..#...#.........#.........##.......##.....##.............#.........#.......#...................##.#.
...................#....#..###..#...#.....#......#..............#.........#..................##.##.................................
......#....#.............#..#...#..##.#...#...#......#....#...........#....#...........##....#..#...#.....#......................#.
...#...#............#....#..#.#....................................#..#.....................#....#.........................#.......
.......#.............................#............#......................#...#......#.......###.........#...................#.#....
.......#................##...#...........##........#..#..#..............#.....#..............#.....#......#..........#...#.........
......#.....#.................#....#...........#..........................#..#.##.#.##.............##.#............#....##..#......
....#.....#.......................#..............#......#..........#.....##..#.....#.........#..........................#.#..#...#.
...#...........#.........#......##...#......#......#....#....#..#......#..#........#..#......................................#.#...
.....#...##.....................#.............##..#....#.#..#...#...#....#.........#.......#.....#.............................#...
..............###.##...........#..#.##.....#.#..#....#..............#..#..........................#.##.#...........#...............
.......#.........................#................##.#.....##........#.....#.#......#..........................#...........#...#...
........##...#..#....#...........#....#.........#......#..##..#...........................#...#..............#........#......#.....
...#.....#...#.......#..................#.....#...........#................#......#........#.#.#.......................#...........
.#..#..#.............###........................#.......#....#.........#.....#........#..#.#....#..........#...#...................
......................#...........###........#........#...#.........#..................#...#.....##.........#.............#..#.#...
...#.##.............####.........##..#...#........................................#..........#...................#.##..............
......#...#.....#..................##........#...........#.#...#....##.......#......#.....#..#.............#..#.#.##....##.........
.......#..................#........#........#.........##.#............#.....#....#....#..##..............#.......#.#....#..#.......
..........#...........#..................#...........#.....#......##........##.......#.........................................##..
...#......#................#...........###..#.........#.....##..#.#...............#....#.##.#........#...................#.........
........#...#..##...#.................#......##.......##.....#..#.........#.#....#.......#...........#..#...................#...##.
........#...........#.##..............................................##...#..............##...........#..#...###........#.....#...
....#.......#....#......................#.#.#......................#....#.........#.......................#....#.#.##...........#..
.#................#.#.#.#.................#.......................##.#......#.....#..#..............#....#...#.#...#..#........#...
..#.........#.......#.....#.....##.............#.....................#...........#...#.................##.........#....#.........#.
....#..#..............#.#...................#...#......#.##..........#.........#..#.......................#..##....................
........#..#.#.........#...##.................#......#...#..............#.....................#...#.....#..........#....#...#.#....
.#.....#...#..##.......#...#.......#...............................#..#.....#................##..##.......#.......#..#..#........#.
..............................###..............................#....#..#....#.#..#.............#...#..........#.#.#.........##.....
.......#........#.#................#...#.........#.##.#....................#...................#..#....#...#.....###.....#.#.......
.........#.#............#......#......#.#.........###.#.#..#..#.#....#...###....#............#.....................#......#....#...
..##...#...#.#...........#.....#...#.......................................#..........................#.........#..##.........#.#..
.....#.....#..............#.......................#.........#...#..#.....##................#.#.......#..#...#.#.#..............#.#.
.........#....#.#...#.....#......#.#.................#...#...#.........................#..#....#...#.........#...#...#......###....
.....#.#..#........#.....##..#.##.....##............................#..#.....#.........#.....##.#..##...#.#.....#.............#....
.....#..................#....###.#.#.....#........................#...##....#.........#..........................#....##.#....#..#.
...###........##....#....#...#.......#....#..#.........##................#..........#........##.##.................#......#........
....#.......##..#.......##...#.........###....#........................#.#.#..................#...#.#.........................#....
..##..................#..#........##...#...#..#..............#.......#..............##.......#.........#..#.....................#..
.......#.................#....#.#........###..##..................#...............#......#.#............#...#.............#........
.#.#..........###.......##..#.#......#..#..#.#...#.............##.#.#...............##..#....#..#..............#.............#.....
.....#.#.....#..#..................###...............................................##............##..............................
...........#......#..##.#..#...#...#.#.....##.#.....#........##.................#..#..#....#.....#.....#......#.#..................
....#....................#...........#.......#..#.............#...#...................##............#..............##..............
.........#.#........#..#....#..........#.....#........................................#........#...#..#....#.......#.........#.....
...#............#.....#....#....#.....#....#....#..#................................#..#....#.........#.........#.#...........#....
.............#.......#...........#..#.....#.....................................#.#...#...#........#..##..#.....#.........#........
......#.......#.................#.................#.#.#.................................#........#...........#....#.#..............
.##.##....................#...#.#.............###........#.................#..#.....#..#.......#..............#..#.....#.##........
........#........#.............#..#...#.#........#..#.....#.............#.....#...#....#...###....##..#.....#..#.....#.............
..#.#...........##.....#.................#....#.....##....................#......#..........##....#..#..#...#..#.............#.....
...................................................................................................................................

11
2023/input/21/test-1 Normal file
View File

@@ -0,0 +1,11 @@
...........
.....###.#.
.###.##..#.
..#.#...#..
....#.#....
.##..S####.
.##..#...#.
.......##..
.##.#.####.
.##..##.##.
...........

1446
2023/input/22/input Normal file

File diff suppressed because it is too large Load Diff

7
2023/input/22/test-1 Normal file
View File

@@ -0,0 +1,7 @@
1,0,1~1,2,1
0,0,2~2,0,2
0,2,3~2,2,3
0,0,4~0,2,4
2,0,5~2,2,5
0,1,6~2,1,6
1,1,8~1,1,9

141
2023/input/23/input Normal file
View File

@@ -0,0 +1,141 @@
#.###########################################################################################################################################
#.#####...###...#####...#...###.......#.....#...#####...#...###...#.........###...#...#.......#...#...#...###.............###...###...###...#
#.#####.#.###.#.#####.#.#.#.###.#####.#.###.#.#.#####.#.#.#.###.#.#.#######.###.#.#.#.#.#####.#.#.#.#.#.#.###.###########.###.#.###.#.###.#.#
#...#...#...#.#.###...#...#...#.....#.#.#...#.#...#...#.#.#...#.#.#.......#...#.#.#.#.#.....#.#.#.#.#.#.#...#...........#.#...#.....#.#...#.#
###.#.#####.#.#v###.#########.#####.#.#.#.###.###.#.###.#.###.#.#.#######.###.#.#.#.#.#####.#.#.#.#.#.#.###.###########.#.#.#########.#.###.#
###.#...###.#.#.>.#.#.......#.....#.#.#.#.#...#...#...#...#...#.#.#.....#.#...#.#.#.#...###.#.#.#.#.#.#.#...#...#.....#.#...#.........#.#...#
###.###.###.#.#v#.#.#.#####.#####.#.#.#.#.#.###.#####.#####.###.#.#.###.#.#.###.#.#.###.###.#.#.#.#.#.#.#.###.#.#.###.#.#####.#########.#.###
###.#...#...#.#.#...#.#...#.#.....#.#.#.#.#.#...#...#.....#...#.#.#...#.#.#.#...#.#.#...#...#...#.#.#.#.#...#.#.#...#.#.#...#...........#...#
###.#.###.###.#.#####.#.#.#.#.#####.#.#.#.#.#.###.#.#####.###.#.#.###.#.#.#.#.###.#.#.###.#######.#.#.#.###.#.#.###.#.#.#.#.###############.#
###...###.....#...###.#.#.#...#...#.#.#.#...#...#.#.....#...#.#.#.###.#.#.#.#...#...#...#.......#.#.#.#.#...#.#...#.#.#...#.#.........#...#.#
#################.###.#.#.#####.#.#.#.#.#######.#.#####.###.#.#.#.###.#.#.#.###.#######.#######.#.#.#.#.#.###.###.#.#.#####.#.#######.#.#.#.#
#...#...#...#...#...#.#.#.#.>.>.#...#.#.#.......#.#.....###.#.#.#.###.#.#.#.###.....#...#...#...#.#.#.#.#...#.#...#.#.#...#.#.......#.#.#.#.#
#.#.#.#.#.#.#.#.###.#.#.#.#.#v#######.#.#.#######.#.#######.#.#.#.###.#.#.#.#######.#.###.#.#.###.#.#.#.###.#.#.###.#.#.#.#.#######.#.#.#.#.#
#.#...#...#...#.....#...#...#.......#.#.#.#.....#.#...>.>...#.#.#.#...#.#.#.#.>.>...#...#.#.#...#.#.#.#.#...#.#.....#...#...#.......#...#...#
#.#################################.#.#.#.#.###.#.#####v#####.#.#.#.###.#.#.#.#v#######.#.#.###.#.#.#.#.#.###.###############.###############
#.#.........#...#.........###.......#...#...#...#.#.....#...#...#.#...#.#.#.#.#.....#...#.#.###.#.#.#.#.#.###.........#...#...###...###...###
#.#.#######.#.#.#.#######.###.###############.###.#.#####.#.#####.###.#.#.#.#.#####.#.###.#.###.#.#.#.#.#.###########.#.#.#.#####.#.###.#.###
#...###...#...#...#.......#...#.......#.....#.#...#.......#.....#...#.#.#.#.#.#.....#...#.#.#...#.#.#.#.#...#...>.>.#.#.#...#.....#.....#...#
#######.#.#########.#######.###.#####.#.###.#.#.###############.###.#.#.#.#.#.#.#######.#.#.#.###.#.#.#.###.#.###v#.#.#.#####.#############.#
#.......#...#.......#...###...#.#.....#.#...#...###.............#...#.#.#.#.#.#.......#.#.#.#...#.#.#.#...#.#...#.#...#.......#...#...#...#.#
#.#########.#.#######.#.#####.#.#.#####.#.#########.#############.###.#.#.#.#.#######.#.#.#.###.#.#.#.###.#.###.#.#############.#.#.#.#.#.#.#
#.#...#...#...#.......#.#...#...#...#...#...#.....#.....#.....###.....#.#.#.#.#.......#.#.#.#...#.#.#.#...#.....#...#...........#...#.#.#...#
#.#.#.#.#.#####.#######.#.#.#######.#.#####.#.###.#####.#.###.#########.#.#.#.#.#######.#.#.#.###.#.#.#.###########.#.###############.#.#####
#...#...#...#...#.......#.#.###...#...#.....#.#...#.....#.#...#...#...#.#.#.#.#.......#.#.#.#.#...#.#.#.#...........#...............#.#.....#
###########.#.###.#######.#.###.#.#####.#####.#.###.#####.#.###.#.#.#.#.#.#.#.#######.#.#.#.#.#.###.#.#.#.#########################.#.#####.#
###...#...#...###.......#.#.#...#.#...#.....#.#...#.......#...#.#.#.#.#.#.#...#...#...#...#...#...#.#...#.........#.................#.......#
###.#.#.#.#############.#.#.#.###.#.#.#####.#.###.###########.#.#.#.#.#.#.#####.#.#.#############.#.#############.#.#########################
#...#...#.............#.#.#.#...#.#.#.#.....#.#...#...#.......#.#.#.#.#...#.....#...#...#...#...#...#...#.........#...#.....#...#...###...###
#.###################.#.#.#.###.#.#.#.#v#####.#.###.#.#.#######.#.#.#.#####.#########.#.#.#.#.#.#####.#.#.###########.#.###.#.#.#.#.###.#.###
#...................#...#.#...#.#.#.#.>.>.#...#...#.#.#.###...#.#.#.#.#...#.....###...#.#.#.#.#.#...#.#.#...........#...###...#...#.#...#...#
###################.#####.###.#.#.#.###v#.#.#####.#.#.#.###.#.#.#.#.#.#.#.#####v###.###.#.#.#.#.#.#.#.#.###########.###############.#.#####.#
#.................#.....#...#...#.#.#...#...#...#...#.#...#.#.#.#.#.#.#.#.#...>.>.#.#...#.#.#.#.#.#.#.#.#...#.......#.....#...#.....#...#...#
#.###############.#####.###.#####.#.#.#######.#.#####.###.#.#.#.#.#.#.#.#.#.###v#.#.#.###.#.#.#.#.#.#.#.#.#.#v#######.###.#.#.#.#######.#.###
#.#.....#...#...#.......#...#.....#.#.......#.#.......#...#.#...#.#.#...#.#.#...#.#.#...#.#.#.#.#.#.#.#.#.#.>.>.#...#.#...#.#...#.......#...#
#.#.###.#.#.#.#.#########.###.#####.#######.#.#########.###.#####.#.#####.#.#.###.#.###.#.#.#.#.#.#.#.#.#.###v#.#.#.#.#.###v#####.#########.#
#.#.###...#...#.....#.....###.....#.#.......#.#...#...#.###.....#.#.....#...#...#...###.#.#...#.#.#.#.#.#.#...#...#.#.#.#.>.#.....#.........#
#.#.###############.#.###########.#.#.#######.#.#.#.#.#v#######.#.#####.#######.#######.#.#####.#.#.#.#.#.#.#######.#.#.#.#v#.#####.#########
#.#.#...............#.........#...#.#...#...#...#...#.>.>.....#.#.#.....###...#.......#.#...#...#.#.#.#...#.......#.#.#.#.#.#.#.....#.......#
#.#.#.#######################.#.###.###.#.#.###########v#####.#.#.#.#######.#.#######.#.###.#.###.#.#.###########.#.#.#.#.#.#.#.#####.#####.#
#...#...........#...#.........#.....###...#...#...#...#.....#.#.#.#.....#...#.........#.....#...#.#...#...###...#.#.#.#...#.#.#.......#.....#
###############.#.#.#.#######################.#.#.#.#.#####.#.#.#.#####.#.#####################.#.#####.#.###.#.#.#.#.#####.#.#########.#####
###...#.........#.#.#.......#.................#.#...#.......#...#...#...#...#.........#...#...#.#...###.#.....#...#...#.....#.#.......#.....#
###.#.#.#########.#v#######.#.#################.###################.#.#####.#.#######.#.#.#.#.#.###.###.###############.#####.#.#####.#####.#
###.#.#...........#.>.#.....#.................#...#.......#.......#...#.....#.#.......#.#.#.#.#.#...#...#...........###.....#.#.....#.#...#.#
###.#.#############v#.#.#####################.###.#.#####.#.#####.#####.#####.#.#######.#.#.#.#.#.###.###.#########.#######.#.#####.#.#.#.#.#
###.#.###...#...#...#.#.......###.............###...#.....#.#.....#...#.......#...#...#.#...#.#.#...#...#...#.....#.....###...#...#.#.#.#.#.#
###.#.###.#.#.#.#.###.#######.###.###################.#####.#.#####.#.###########.#.#.#.#####.#.###.###.###.#.###.#####.#######.#.#.#.#.#.#.#
#...#.....#...#...#...#...#...#...#.............#...#...#...#...#...#...#####...#...#.#.#.....#...#.###...#.#...#.......#.......#...#...#...#
#.#################.###.#.#.###.###.###########.#.#.###.#.#####.#.#####.#####.#.#####.#.#.#######.#.#####.#.###.#########.###################
#.#...............#...#.#.#...#.....#.......#...#.#.#...#.#.....#.#.....#.....#.......#.#...#...#...#...#...###.........#...#...#...#...#...#
#.#.#############.###.#.#.###.#######.#####.#.###.#.#.###.#.#####.#.#####.#############.###.#.#.#####.#.###############.###.#.#.#.#.#.#.#.#.#
#...###.........#...#...#.....###...#.....#...#...#.#...#.#.#.....#.....#.............#.#...#.#.#...#.#.....###.........###...#...#...#...#.#
#######.#######.###.#############.#.#####.#####.###.###.#.#.#.#########.#############v#.#.###.#.#.#.#.#####.###.###########################.#
###...#.#.....#.....###...#...#...#.....#...###...#...#...#...#.......#.#...#.......>.>.#.###.#.#.#.#...#...#...#...#...###...#...#.......#.#
###.#.#.#.###.#########.#.#.#.#.#######.###.#####.###.#########.#####.#.#.#.#.#######v###.###.#.#.#.###.#.###.###.#.#.#.###.#.#v#.#.#####.#.#
#...#...#.###.......#...#.#.#.#.......#.....#...#.#...###...#...#...#...#.#.#...#.....#...#...#...#.#...#.###...#.#.#.#.#...#.>.#.#...###...#
#.#######.#########.#.###.#.#.#######.#######.#.#.#.#####.#.#.###.#.#####.#.###.#.#####.###.#######.#.###.#####.#.#.#.#.#.#####v#.###.#######
#...#.....###.......#...#.#.#.........#...###.#.#.#.#...#.#.#...#.#...#...#...#.#.....#...#...#.....#...#.#...#.#.#.#.#...###...#.....#...###
###.#.#######.#########.#.#.###########.#.###.#.#.#.#.#.#.#.###v#.###.#.#####.#.#####.###.###.#.#######.#.#.#.#v#.#.#.#######.#########.#.###
###.#.#.......#...#...#.#.#.............#...#.#...#.#.#...#.#.>.>.###...#...#...#.....###...#.#.#...#...#...#.>.>.#.#.#.......#...#...#.#.###
###.#.#.#######.#.#.#.#.#.#################.#.#####.#.#####.#.#v#########.#.#####.#########.#.#.#.#.#.#########v###.#.#.#######.#.#.#.#.#.###
#...#.#.#.....#.#.#.#.#.#.#...#...###...#...#.....#.#.....#...#...#...###.#.#...#.....#.....#.#.#.#.#.....#.....###.#.#.....#...#...#...#...#
#.###.#.#.###v#.#.#.#.#.#.#.#.#.#.###.#.#v#######.#.#####.#######.#.#.###.#.#.#.#####.#.#####.#.#.#.#####.#.#######.#.#####.#.#############.#
#.....#...###.>.#.#.#.#.#...#.#.#.#...#.>.>...#...#.......#...###...#...#.#...#.......#...#...#.#.#.#...#.#.#.....#...###...#.#.......#...#.#
#############v###.#.#.#.#####.#.#.#.#####v###.#.###########.#.#########.#.###############.#.###.#.#.#.#.#.#.#.###.#######.###.#.#####.#.#.#.#
#.........#...#...#.#.#...#...#.#.#.#.....###.#...........#.#...........#...............#...###.#.#.#.#.#.#...###.......#...#.#.....#.#.#.#.#
#.#######.#.###.###.#.###.#.###.#.#.#.#######.###########.#.###########################.#######.#.#.#.#.#.#############.###.#.#####.#.#.#.#.#
#...#...#...###.#...#.#...#...#.#.#.#.....###.....#...#...#.................###.........#.....#...#...#...#.............#...#.#.....#.#.#.#.#
###.#.#.#######.#.###.#.#####.#.#.#.#####.#######.#.#.#.###################.###.#########.###.#############.#############.###.#.#####.#.#.#.#
###...#.......#...###...#...#...#...#####.......#...#.#.#...................#...#...#...#...#.....###...###.............#.#...#...###...#.#.#
#############.###########.#.###################.#####.#.#.###################.###.#.#.#.###.#####.###.#.###############.#.#.#####.#######.#.#
#####...#.....#...#...#...#...#...#...#.......#...###...#.................###...#.#...#.....#.....#...#...#.............#...#####...#...#.#.#
#####.#.#.#####.#.#.#.#.#####.#.#.#.#.#.#####.###.#######################.#####.#.###########.#####.#####.#.#######################.#.#.#.#.#
#.....#...#.....#.#.#.#.#.....#.#.#.#.#.....#.....#...#...#.............#...###...#...#.....#...###...#...#.................#.......#.#.#...#
#.#########.#####.#.#.#.#.#####.#.#.#.#####v#######.#.#.#.#.###########.###.#######.#.#.###.###.#####.#.###################.#.#######.#.#####
#...#.....#.....#.#.#.#.#.....#.#.#.#.....>.>.###...#.#.#.#...#.......#.#...#...#...#...###.....#...#.#.###.................#.........#...###
###.#.###.#####.#.#.#.#.#####.#.#.#.#######v#.###.###.#.#.###.#.#####.#.#.###.#.#.###############.#.#.#.###.#############################.###
###...#...###...#.#.#.#.#.....#.#...#...#...#...#...#...#...#.#.#.....#...#...#.#.........###...#.#.#.#...#.......#.....#...#...#...#...#...#
#######.#####.###.#.#.#.#.#####.#####.#.#.#####.###.#######.#.#.#.#########.###.#########.###.#.#.#.#.###.#######.#.###.#.#.#.#.#v#.#.#.###.#
#.....#...#...###.#.#.#.#.#...#.#.....#.#.....#...#.#...#...#...#.........#...#...........#...#.#.#.#...#.#...###.#...#.#.#.#.#.>.#...#...#.#
#.###.###v#.#####.#.#.#.#.#.#.#.#.#####.#####.###.#.#.#.#.###############.###.#############.###.#.#.###.#.#.#.###v###.#.#.#.#.###v#######.#.#
#...#.###.>.#...#...#.#.#...#...#.....#.......#...#.#.#...#####...#.......###.........#...#...#.#.#...#.#.#.#...>.>.#.#.#.#.#...#.......#.#.#
###.#.###v###.#.#####.#.#############.#########.###.#.#########.#.#.#################.#.#.###.#.#.###.#.#.#.#####v#.#.#.#.#.###.#######.#.#.#
#...#.....###.#.....#...#...#.......#.........#.#...#.###...###.#.#.#.....#.....#.....#.#.#...#.#.###.#.#.#.#.....#...#...#.#...#.......#...#
#.###########.#####.#####.#.#.#####.#########.#.#.###.###.#.###.#.#v#.###.#.###.#.#####.#.#.###.#.###.#.#.#.#.#############.#.###.###########
#...#.........#...#.#.....#.#.....#.#...#...#.#...#...#...#...#.#.>.>.#...#.#...#...###.#.#...#.#...#.#.#.#.#.........#.....#.#...###...#...#
###.#.#########.#.#.#.#####.#####.#.#.#.#.#.#.#####.###.#####.#.###v###.###.#.#####v###.#.###.#.###.#.#.#.#.#########.#.#####.#.#####.#.#.#.#
###...#...#...#.#...#.....#...###.#.#.#...#.#...#...#...#####...###...#...#.#...#.>.>...#...#.#.....#.#.#...#.........#.#...#.#.......#...#.#
#######.#.#.#.#.#########.###.###.#.#.#####.###.#.###.###############.###.#.###.#.#v#######.#.#######.#.#####.#########.#.#.#.#############.#
#.......#...#...###.......#...#...#...#...#.....#.....#...#####...#...#...#.###...#...#.....#...#...#.#.#...#.........#.#.#...#...........#.#
#.#################.#######.###.#######.#.#############.#.#####.#.#.###.###.#########.#.#######.#.#.#.#.#.#.#########.#.#.#####.#########.#.#
#.............#...#.......#...#.........#...#.....#...#.#.###...#.#...#...#.#...###...#...#.....#.#.#...#.#.#.........#...#...#.........#.#.#
#############.#.#.#######.###.#############.#.###.#.#.#.#.###.###.###.###.#.#.#.###.#####.#.#####.#.#####.#.#.#############.#.#########.#.#.#
#####...#.....#.#.#...###...#...............#...#.#.#...#...#...#.....###...#.#...#.....#...#.....#.###...#...###...#...#...#.#.........#.#.#
#####.#.#.#####.#.#.#.#####.###################.#.#.#######.###.#############.###.#####.#####.#####.###.#########.#.#.#.#.###.#.#########.#.#
#.....#.#.....#.#...#.#...#...........###...#...#.#...#...#.....#...#.........###.#.....#...#.....#...#.......#...#...#.#...#.#.....#####...#
#.#####.#####.#.#####.#.#.###########.###.#.#.###.###.#.#.#######.#.#.###########.#.#####.#.#####.###.#######.#.#######.###.#.#####.#########
#.....#.......#.#.....#.#.............#...#.#...#.###.#.#.###.....#.#...........#...#...#.#.#...#.#...###...#.#...#.....#...#.....#.........#
#####.#########.#.#####.###############.###.###.#.###v#.#.###.#####.###########.#####.#.#.#.#.#.#.#.#####.#.#v###.#.#####.#######.#########.#
#.....#.........#.....#...............#...#.#...#...>.>.#...#.#.....#...........#...#.#.#.#.#.#.#.#.#...#.#.>.>.#.#.#...#.....#...#.........#
#.#####.#############.###############.###.#.#.#######v#####.#.#.#####.###########.#.#.#.#.#.#.#.#.#.#.#.#.###v#.#.#.#.#.#####.#.###v#########
#.......###...........###.............#...#.#.#.......#.....#.#.#...#...........#.#...#...#...#.#.#.#.#...###.#.#.#.#.#...#...#.#.>.#...#...#
###########.#############.#############.###.#.#.#######.#####.#.#.#.###########.#.#############.#.#.#.#######.#.#.#.#.###.#.###.#.#v#.#.#.#.#
###...#.....#.......#...#.........###...###.#.#...#...#.....#.#.#.#...#...#.....#...#.........#.#.#.#.#.......#...#.#.###.#.###...#.#.#.#.#.#
###.#.#.#####.#####.#.#.#########.###.#####.#.###.#.#.#####.#.#.#.###.#.#.#.#######.#.#######.#.#.#.#.#.###########.#.###.#.#######.#.#.#.#.#
###.#.#.......#.....#.#.#.........#...#.....#...#...#.....#.#.#.#.#...#.#.#...#...#...#.....#.#.#.#.#.#.....#...###...#...#...#.....#.#.#.#.#
###.#.#########.#####.#.#.#########.###.#######.#########.#.#.#.#.#.###.#.###.#.#.#####.###.#.#.#.#.#.#####.#.#.#######.#####.#.#####.#.#.#.#
#...#.........#.....#.#.#.......###...#.#...#...#.........#...#.#.#.###.#.#...#.#.#.....###...#.#.#...#...#...#.......#.#...#.#...#...#...#.#
#.###########.#####.#.#.#######.#####.#.#.#.#.###.#############.#.#.###.#.#.###.#.#.###########.#.#####.#.###########.#.#.#.#.###.#.#######.#
#...........#.......#.#.....#...#...#.#...#...###.............#.#.#...#.#.#...#.#.#.......#.....#...#...#...#.........#...#.#.#...#.#.....#.#
###########v#########.#####.#.###.#.#.#######################.#.#.###.#.#.###v#.#.#######.#.#######.#.#####.#.#############.#.#.###.#.###.#.#
#.......###.>...#...#.#.....#...#.#.#.........###.......#.....#.#.###...#.#.>.>.#.........#...#.....#.....#.#.#...........#.#.#...#.#...#.#.#
#.#####.###v###.#.#.#.#.#######v#.#.#########.###.#####.#.#####.#.#######.#.#v###############.#.#########.#.#.#.#########.#.#.###.#.###.#.#.#
#.....#.....###.#.#.#.#.#...#.>.>.#...#.......#...#...#...#...#...#.....#...#.#...#...#...###...###...#...#.#...#.....#...#...#...#.#...#...#
#####.#########.#.#.#.#.#.#.#.#v#####.#.#######.###.#.#####.#.#####.###.#####.#.#.#.#.#.#.#########.#.#.###.#####.###.#.#######.###.#.#######
#.....#.......#...#.#.#.#.#.#.#.#...#.#.......#...#.#...#...#.#...#.#...#.....#.#...#...#.....#...#.#.#...#.#.....###...#.....#.....#.......#
#.#####.#####.#####.#.#.#.#.#.#.#.#.#.#######.###.#.###.#.###.#.#.#.#.###.#####.#############.#.#.#.#.###.#.#.###########.###.#############.#
#.....#.#.....#...#.#.#...#...#...#.#.........###.#.#...#.#...#.#...#...#.......#.............#.#.#.#.....#.#...........#...#.#...........#.#
#####.#.#.#####.#.#.#.#############.#############.#.#.###.#.###.#######.#########.#############.#.#.#######.###########.###.#.#.#########.#.#
#.....#.#.......#.#...###...........###...###...#...#.#...#...#.#.......#.........#.........#...#.#.#.....#.....#.....#.#...#.#.........#...#
#.#####.#########.#######.#############.#.###.#.#####.#.#####.#.#.#######.#########.#######.#.###.#.#.###.#####.#.###.#.#.###.#########.#####
#.....#.#.........#.......#.......#.....#...#.#.#...#.#.#.....#.#.#...###...#.......#.......#...#.#...#...#...#...###...#.#...#.......#.....#
#####.#.#.#########.#######.#####.#.#######.#.#.#.#.#.#.#.#####.#.#.#.#####.#.#######.#########.#.#####.###.#.###########.#.###.#####.#####.#
#...#...#.....#...#.........#.....#...#.....#.#.#.#.#...#.......#...#.....#...#.......#...#...#.#.....#.#...#...........#.#.....#...#.......#
#.#.#########.#.#.###########.#######.#.#####.#.#.#.#####################.#####.#######.#.#.#.#.#####.#.#.#############.#.#######.#.#########
#.#...#.......#.#.....#...###.......#.#.###...#.#.#...###...#.............#...#.....#...#...#...#.....#...#.....#.......#.........#.........#
#.###.#.#######.#####.#.#.#########.#.#.###.###.#.###.###.#.#.#############.#.#####.#.###########.#########.###.#.#########################.#
#...#.#.......#.....#.#.#.#...#...#...#...#.#...#...#.#...#.#...........#...#.#...#...#.........#.....#...#...#.#.....#...###...#...###.....#
###.#.#######.#####.#.#.#.#.#.#.#.#######v#.#.#####.#.#.###.###########.#.###.#.#.#####.#######.#####.#.#.###.#.#####.#.#.###.#.#.#.###v#####
#...#.....#...#...#.#.#.#.#.#.#.#.#...#.>.>.#.....#.#.#...#...#...#...#.#...#.#.#.....#.......#.......#.#.....#.......#.#.#...#.#.#.#.>.#...#
#.#######.#.###.#.#.#.#.#.#.#.#.#.#.#.#.#########.#.#.###.###.#.#.#.#.#.###.#.#.#####.#######.#########.###############.#.#.###.#.#.#.#v#.#.#
#.......#.#...#.#.#.#.#.#.#.#.#.#...#.#.....#.....#.#.#...#...#.#.#.#...#...#...#.....#.......#...#...#...........#.....#.#...#.#.#.#.#.#.#.#
#######.#.###.#.#.#.#.#.#.#.#.#.#####.#####.#.#####.#.#.###.###.#.#v#####.#######.#####.#######.#.#.#.###########.#.#####.###.#.#.#.#.#.#.#.#
#.......#.....#.#...#...#...#.#...###.#.....#.#...#.#.#.#...#...#.>.>.###.......#.#...#...#...#.#.#.#.#...#...#...#.#.....#...#.#.#.#.#.#.#.#
#.#############.#############.###.###.#.#####.#.#.#.#.#.#.###.#######.#########.#.#.#.###v#.#.#.#.#.#.#.#.#.#.#.###.#.#####.###.#.#.#.#.#.#.#
#.#.......#...#...........#...#...#...#...###.#.#.#.#.#.#...#...#####...#.....#.#.#.#.#.>.>.#.#.#.#.#.#.#.#.#.#...#.#.#...#.#...#.#...#...#.#
#.#.#####.#.#.###########.#.###.###.#####.###.#.#.#.#.#.###.###.#######.#.###.#.#.#.#.#.#####.#.#.#.#.#.#.#.#.###v#.#.#.#.#.#.###.#########.#
#.#...#...#.#...#.....#...#...#...#...#...#...#.#.#.#.#...#...#...#.....#...#.#.#.#.#.#.#.....#.#.#.#.#.#.#.#.#.>.>.#.#.#.#.#...#.....#.....#
#.###.#.###.###.#.###.#.#####.###.###.#.###.###.#.#.#.###.###.###.#.#######.#.#.#.#.#.#.#.#####.#.#.#.#.#.#.#.#.#####.#.#.#.###.#####.#.#####
#.....#.....###...###...#####.....###...###.....#...#.....###.....#.........#...#...#...#.......#...#...#...#...#####...#...###.......#.....#
###########################################################################################################################################.#

23
2023/input/23/test-1 Normal file
View File

@@ -0,0 +1,23 @@
#.#####################
#.......#########...###
#######.#########.#.###
###.....#.>.>.###.#.###
###v#####.#v#.###.#.###
###.>...#.#.#.....#...#
###v###.#.#.#########.#
###...#.#.#.......#...#
#####.#.#.#######.#.###
#.....#.#.#.......#...#
#.#####.#.#.#########v#
#.#...#...#...###...>.#
#.#.#v#######v###.###v#
#...#.>.#...>.>.#.###.#
#####v#.#.###v#.#.###.#
#.....#...#...#.#.#...#
#.#########.###.#.#.###
#...###...#...#...#.###
###.###.#.###v#####v###
#...#...#.#.>.>.#.>.###
#.###.###.#.###.#.#v###
#.....###...###...#...#
#####################.#

300
2023/input/24/input Normal file
View File

@@ -0,0 +1,300 @@
225004689740965, 150875733412640, 116049940893518 @ 275, 389, 375
338282582546422, 191340608518886, 340003210160681 @ -162, 84, -46
276063330011297, 506267063607948, 451688278442130 @ -9, -360, -275
184895220833040, 346432574551322, 295370687370609 @ 190, -100, -32
191652244794317, 228752744289266, 232281189081226 @ -31, 21, 81
243836903069805, 200950090690864, 278486291904150 @ -28, 88, 22
99537538414359, 156839976263080, 330139497485318 @ 130, 130, -37
326389764039501, 504331313318919, 418345965619340 @ -131, -307, -163
148876210640065, 290152398181516, 301374612836089 @ 33, -38, 6
142515087922560, 255308120704690, 257170878718743 @ 68, 8, 52
295642841582982, 242101259588587, 104022418418097 @ -64, 55, 272
212300793229561, 261391853816696, 365490993544222 @ 18, 12, -93
165229346379582, 248276965460071, 161312784455361 @ 228, 79, 212
146531979069180, 97089275376773, 332003690930340 @ 22, 161, -23
120800899092132, 184913721524842, 473900231780358 @ 46, 68, -169
245193974976343, 210971062189687, 268026939360343 @ -33, 73, 36
442753793796843, 328612846899973, 283609914942486 @ -197, 51, -361
386255632768587, 458845472549101, 186183322563756 @ -53, -509, 253
31284818403777, 378560063574625, 130525938014247 @ 121, -131, 182
215792555249349, 255251601506749, 291132823173402 @ 53, 35, -5
440576428992381, 341794624061173, 283489603116870 @ -195, -71, -297
406821058032927, 358552748013016, 243495622599474 @ -84, -158, 37
333985935471117, 348387381803596, 196037336476056 @ 173, -110, 229
194315236713487, 480470439040782, 378290083309208 @ 51, -280, -115
423624567819357, 338961555301801, 243582531901236 @ 61, -23, -31
94275761968037, 416415875088596, 405203801734006 @ 101, -177, -111
182423650573104, 175953021338356, 485228050020492 @ 54, 122, -247
132946860128942, 343413209165262, 326300668034478 @ 36, -96, -17
372535536228591, 339775824243596, 291460134306860 @ -5, -78, -127
234895872588063, 62247228662200, 328601789968998 @ -48, 226, -29
219739080638176, 286527796435798, 280981600608968 @ 12, -20, 17
189527420319587, 44893660278076, 188459541975566 @ 71, 322, 143
380267121502632, 171933783462296, 62327709907551 @ -50, 486, 658
147002248372043, 129217307469322, 20610734515794 @ 72, 163, 337
378116309343993, 323069130988612, 248918730482046 @ 12, -7, 19
319333653031698, 278859269969079, 223866268814703 @ 52, 75, 106
236992756588085, 304463145397792, 340194522655246 @ -12, -44, -61
361033750565555, 283496102799226, 443655113595562 @ -186, -23, -175
235897203512717, 294114281232674, 253551760349992 @ -39, -37, 56
408102536955573, 333380318039952, 224743862672053 @ 133, 14, 168
293102890051939, 344678920502642, 319027665541226 @ -52, -97, -51
314560583563263, 247853680623604, 53638099642518 @ 168, 228, 683
358957968197762, 345732142415154, 247473914297280 @ 176, -100, 13
97749293379345, 58712595993126, 391620120825632 @ 43, 177, -72
322867629724035, 340590948643122, 203289896708124 @ 172, -81, 190
80125950337563, 291162150272609, 183137679036856 @ 67, -45, 129
258374458616771, 177916772961046, 144952832827550 @ -106, 67, 167
278357116203837, 305712540709126, 313477667351106 @ 25, -25, -67
264809045616867, 264739862065576, 262895162556366 @ 124, 82, 15
336748098976080, 273218710413310, 322060564461324 @ 30, 104, -167
429928385950838, 314414397421203, 244915322264740 @ -58, 209, -27
372274398572112, 231105491529412, 287140067936409 @ -124, 146, -34
300041946642210, 361805878294414, 348779219055194 @ 94, -140, -213
82333630198830, 239193100253797, 257911560955197 @ 188, 41, 48
226279166994495, 154940662484512, 108839076271560 @ -50, 110, 216
236988945746136, 219126354714877, 501245149354293 @ -46, 49, -232
290809399876260, 49865784333280, 261940365787665 @ 108, 638, 10
192479192269869, 89960784106480, 410601225475806 @ 72, 264, -171
154572048488187, 298722566659266, 216167781614996 @ 16, -49, 98
61402524224229, 314643942049666, 423478145912151 @ 85, -68, -106
358766524042277, 346694443835744, 276844061172806 @ -19, -102, -46
256397938412229, 266514037892864, 308510441425550 @ -38, 6, -19
111247170663991, 233159373163332, 468697849329816 @ 74, 24, -176
344810608922213, 303615399145216, 281518317463374 @ -63, -8, -23
362788311911379, 251466951828550, 193750060069434 @ -150, 55, 145
399463771643109, 390830800397568, 348214912693582 @ -56, -300, -427
410955878203009, 271492271760398, 451677568130560 @ -193, 83, -454
295197906839637, 437418987102341, 193165330189036 @ -59, -237, 141
154537540976799, 195927505433626, 181308919987650 @ 52, 77, 141
325985149258473, 250194915217672, 334102012662690 @ 108, 204, -238
124543315501773, 231620946800590, 338561758249206 @ 17, 11, -21
335269288780847, 561799450130906, 273598366143466 @ -160, -351, 33
406349536830357, 371696898098416, 244982099083326 @ -5, -260, 13
429820668866290, 271277644477337, 428343413274584 @ -246, 63, -343
285494082255787, 310483982523226, 238112394898756 @ 6, -35, 72
427654917316453, 283119550914376, 289816166586310 @ -171, 202, -189
183305780754531, 169697372808382, 507117795342356 @ -26, 79, -196
297993284172727, 148019247408016, 478413943821759 @ -109, 142, -218
448790421243093, 337156090194256, 245685544768734 @ -213, 32, -103
148786447967448, 318009921450292, 479155605119109 @ 14, -70, -172
179096144122083, 244536042632162, 235756205266522 @ 64, 35, 77
244534188760433, 150524896619640, 152520925860732 @ -45, 138, 178
292496348928869, 340309322862336, 330659178034254 @ -138, -93, -17
238428943280004, 398422698354598, 128738013198711 @ 18, -176, 234
313779278881410, 287246060199107, 290633760886106 @ -50, 5, -21
343288891378891, 429120523686379, 473870061316574 @ -25, -305, -513
446216226005587, 312289649316651, 248176797177231 @ -177, 407, -134
163307384848257, 225448720602800, 322389319780406 @ 31, 38, -21
311268063816389, 463933000929952, 394657123402262 @ -111, -254, -132
399765834273075, 254798002778062, 319132923186840 @ -106, 223, -222
349356303383841, 65751874037920, 238304141643426 @ 88, 934, 64
426197942876982, 275075125500838, 175524119141824 @ -134, 316, 425
244846911821769, 323674066198300, 382631479290586 @ -38, -71, -106
385903898932938, 293744669483637, 303997079396164 @ 28, 149, -255
122406691475152, 265274118970726, 228903355635336 @ 74, -8, 85
428147883934287, 336265506735295, 236428743456129 @ -49, -11, 58
155366097136407, 212516717519496, 138064536136086 @ 223, 134, 247
290272064856077, 53447685751876, 200629668873066 @ -21, 397, 136
289398699960341, 335225479948172, 258338577180554 @ -87, -85, 48
246644560074906, 346069755754627, 184752533814789 @ -18, -99, 146
325161489522083, 312478142191119, 272239125652590 @ 27, -15, -17
302526838060353, 250137788997644, 293451658437046 @ 34, 111, -51
381454405428627, 309591627716605, 247524198319020 @ -69, 15, 37
126242659748529, 415333404708478, 502742367002526 @ 43, -171, -201
391122049921137, 340901601859651, 268790805641181 @ 57, -73, -116
408757147462249, 380607987804743, 399264436774194 @ -223, -157, -197
447450951270780, 284852883292954, 255232938787050 @ -218, 628, -173
406627106978321, 345331129547776, 278775433455838 @ -252, -98, 35
102526860990768, 109719841541566, 426220057678866 @ 104, 172, -141
271417363832745, 226632607078180, 157778251273146 @ -48, 65, 184
380523128506570, 154723202351541, 260313283860234 @ 74, 867, -53
238921206316929, 132829025707360, 47904689664486 @ 244, 438, 549
307266763229071, 270719901259624, 186135881961708 @ 150, 130, 226
230319046492045, 395641124538336, 193363618743976 @ 57, -178, 144
392920766921985, 250496505188886, 306460703608653 @ -215, 32, -20
175231757780249, 44786823183916, 276624943135376 @ 63, 292, 24
313832948811675, 318445186003239, 306518285955873 @ 103, -21, -128
306551125497277, 524521381609762, 241622859608944 @ -79, -365, 68
400554436289624, 347460919638512, 297202409231189 @ 104, -114, -394
389736340819305, 335315093086228, 265059063401646 @ -48, -59, -41
59503995507231, 201984360420538, 424714963719588 @ 103, 48, -115
297143002633785, 96825557449276, 268699929004798 @ -62, 277, 27
390931858919397, 287914464138976, 302923821502446 @ -7, 167, -238
214729565570253, 278072872648670, 319237187952896 @ 25, -7, -36
96351544542113, 114755362054564, 394569159543638 @ 134, 181, -115
253200235356037, 258399369622746, 348809514314886 @ 101, 75, -149
382994713688163, 275642293727644, 356448448140994 @ -158, 40, -163
148649354883135, 340481142733222, 248790450117468 @ 142, -91, 58
134854692785701, 187209426614464, 175332404267278 @ 113, 106, 155
382031589203352, 338688148083646, 244506915572916 @ -60, -76, 45
369770189029605, 317508155457520, 250790362193010 @ 53, 18, 10
372683763999567, 414017337323254, 290899929550854 @ 6, -355, -133
147854567396103, 296200494966013, 360438786344609 @ 19, -47, -52
176792353279606, 312467680727934, 476850067726169 @ -12, -64, -172
302158177857665, 261529363847256, 256986683221090 @ -45, 42, 41
249078363310055, 282217233889320, 271610559471576 @ -52, -22, 34
221596566426841, 219861193819496, 360675578753842 @ -58, 32, -52
179819260650432, 199340653470439, 329496686830650 @ -34, 43, -13
276958462187159, 486380812406192, 159075856045308 @ -108, -250, 160
144557079593697, 131195974673911, 166883422178271 @ 9, 115, 146
490712615276709, 481688438412223, 460171428210714 @ -363, -337, -317
284673415638495, 320722646046907, 349991504659375 @ -113, -71, -48
184676509506952, 270068378274990, 290179021025201 @ -34, -24, 24
345990299479461, 297990031232524, 222968799598746 @ -107, -14, 99
233819171964981, 152061935722588, 108309431253774 @ -47, 123, 223
285477411975405, 291008044172421, 261721579922515 @ -35, -13, 36
407602868256117, 224700153604072, 183502997645982 @ -119, 368, 275
291327574782249, 286013931920310, 431294230944710 @ -137, -39, -117
443300983193571, 324683157114472, 251351540903257 @ -185, 118, -100
189572883657070, 462200497610916, 280153455698611 @ 18, -238, 24
308690692200416, 333877160265007, 236361595096541 @ 44, -71, 74
418654017001235, 348182837861720, 229046306673408 @ 50, -126, 130
378681238387569, 296901565820215, 156807910380587 @ -23, 79, 362
409371660135117, 326653269520726, 231465493326930 @ 121, 77, 105
426752119836365, 343370672093228, 244558686803006 @ -33, -79, -21
375852403443021, 293233964850016, 265899535913214 @ 92, 162, -79
326707607783589, 316318773568392, 309836065113046 @ 13, -27, -106
142911217221157, 261672665797202, 40658695646315 @ 21, -12, 278
244255603614037, 327276038377380, 279588160520382 @ 201, -55, -29
365680112763191, 94848689754348, 298094328264472 @ 24, 816, -154
330900038715639, 333095401980622, 263888598778833 @ -37, -72, 16
233128904088757, 257737506484816, 140807291739982 @ -34, 7, 191
296148164930181, 562101587574141, 250704068764416 @ -11, -493, 49
194944987544711, 293883929666758, 290731532680414 @ -42, -47, 23
322305098222037, 370061146918651, 477144215849956 @ -59, -143, -363
182728803240756, 281103277585801, 285622771243386 @ 18, -23, 19
383519700815905, 345082260451353, 403471475241446 @ -15, -97, -601
321303031096657, 382801663317526, 207761312476516 @ -33, -173, 132
82652246408061, 397368423356176, 12561618050022 @ 58, -148, 292
386132571381159, 290050051464719, 201828131188626 @ 79, 209, 259
179334089326071, 197614868629114, 332406359271651 @ -5, 60, -26
262093968892863, 107075329722362, 414807233851420 @ 34, 315, -234
229016437887321, 253800281514190, 442412418387360 @ -21, 15, -178
435464268415533, 304740242014684, 308396918820801 @ -83, 370, -776
434507208806365, 509232372383340, 444474239318010 @ -265, -381, -284
268752689610051, 291591481519324, 295468449312780 @ 122, 24, -60
388988596465428, 462487948867582, 429870272877633 @ -122, -416, -452
66784011152624, 361184408854064, 406644902129688 @ 92, -114, -95
417437370920109, 239344427883568, 200940613813092 @ 9, 790, 358
258122981051685, 455818141956768, 500343012517998 @ -47, -240, -263
428885056879621, 395958064188608, 336285404809233 @ -267, -162, -50
371904496065333, 505347295365256, 482265546690900 @ -83, -518, -572
268921212718412, 421249637667076, 105902059281656 @ -94, -182, 221
245666370615068, 296820628562753, 359611784427307 @ 32, -21, -120
266636285971089, 251550010433302, 261367259665596 @ -57, 23, 44
381991540551663, 283471564116926, 250211504748680 @ 22, 177, 8
107026635297788, 445380665254476, 456350458942680 @ 48, -198, -143
436947285540239, 350951442595312, 282325390191614 @ -78, -170, -537
145398660803727, 195609983658656, 242158434889096 @ 130, 110, 68
297475449394982, 131750381092515, 165719703479968 @ -84, 195, 173
382981082215082, 318082716962228, 217519872859947 @ -184, -54, 106
274508569926281, 337480597564942, 249069272308048 @ 113, -80, 45
409006873082037, 404306234256766, 306773089718196 @ 101, -620, -563
304326995325327, 252632813540085, 317502450159756 @ -29, 69, -71
335336102392062, 349032727458751, 147869871751056 @ -10, -107, 289
224490789327707, 138112263823786, 214964316118086 @ -13, 160, 103
257483144012212, 310616650691101, 220817557849225 @ 126, -23, 108
378616249658565, 487631090875856, 211845741661518 @ -137, -403, 127
256962996060820, 363038059754788, 382290100571323 @ 102, -134, -222
376113767407764, 419697564588036, 503311772819474 @ -68, -318, -717
411690063697784, 334901544443134, 250358939380980 @ -30, -32, -23
378730592174173, 292937924939892, 216595109883586 @ -21, 95, 144
386233907852537, 102017803023726, 148605073075956 @ -49, 797, 394
401023678402335, 326392143373252, 250508593182692 @ -80, -20, 12
187386788876757, 222440010076216, 5544716539566 @ 107, 89, 427
211506671096437, 295843684641176, 394227297865006 @ 59, -25, -157
170237159382989, 228511580730636, 335783635953320 @ 17, 32, -34
293589456751485, 294178241627518, 249641359155174 @ -7, -5, 51
439854842455119, 383935112515580, 293031876578902 @ -218, -316, -253
295518506383932, 200374788948199, 229951840543641 @ -114, 71, 84
394189872421409, 331448531001974, 256407864771135 @ -31, -36, -20
311925984995885, 332357949681136, 293917117060350 @ 30, -68, -59
389447608973881, 380513707763144, 244720406589022 @ -126, -192, 51
366016540138437, 277293281705376, 413687743953006 @ 130, 233, -794
298178291530224, 268217681216719, 304180593974067 @ -38, 31, -38
308018243676123, 296892693397840, 274894177156788 @ -130, -42, 32
60232254901961, 170686288518732, 262671045190162 @ 89, 74, 51
124745624448567, 151652758178730, 163358199121217 @ 31, 96, 150
321860786503481, 302448169248892, 261445808573098 @ -12, -5, 20
205692521446297, 89407037159596, 410049214010034 @ 36, 247, -158
239982788772333, 137286217774368, 174295345603502 @ -56, 138, 147
86731844681439, 259688488792764, 210340217835198 @ 70, -12, 103
170808423768189, 228588666791260, 293948466808818 @ 19, 33, 12
441057939686395, 343398690648711, 549228030221401 @ -265, -93, -736
302443946246812, 240143840858176, 379420862083931 @ -22, 94, -186
345088720716403, 315552253051151, 268545755397918 @ 159, 27, -65
423724795313077, 308659354107536, 180782338151766 @ -63, 186, 493
406798864217260, 293663253737166, 320278735045387 @ -88, 132, -304
195154781190237, 364862205409626, 254799516896806 @ -47, -117, 59
178932977335797, 251708835992206, 247843728908376 @ 45, 19, 62
253349271834117, 283691186580304, 303498852558606 @ -9, -9, -21
376761673051257, 285602705599686, 270257629743006 @ -41, 101, -41
300882491178039, 290243550583162, 189772203039720 @ -68, -15, 146
235369194657157, 421562658281976, 408227743490686 @ -55, -183, -115
188646633711105, 318918710332479, 369157982422215 @ 73, -61, -110
395512774201357, 315616825750976, 285497663723286 @ 96, 102, -266
421677117457729, 302462002478370, 260176983480688 @ -57, 221, -114
177175197731565, 341281080915196, 331441656855726 @ 43, -93, -41
325478665927397, 441871023252256, 224988749860460 @ 21, -338, 102
402136003642932, 333799366036756, 296817265196841 @ 8, -30, -290
182104997730129, 336028786762480, 74550271859558 @ 52, -86, 285
292043981673693, 259010054670568, 310880696340486 @ -98, 9, -16
327463887597202, 275386444030262, 281725872502210 @ 96, 120, -69
180350572694521, 204046517624548, 270869833505754 @ 15, 64, 37
261796476524925, 143723242270984, 124690998413814 @ -90, 121, 198
382022380467301, 363084132643328, 342504705272910 @ -51, -159, -293
359686755049611, 309851948068594, 254216163279732 @ 18, 21, 12
432383902550757, 325288945907500, 237103658765274 @ -139, 49, 58
199141995287962, 12205123960005, 135322914113123 @ 276, 653, 302
388209037680334, 326840502219633, 280212599819923 @ 90, 11, -192
398309490013959, 467459019065502, 435027019897864 @ -245, -216, -115
438077885264229, 338437435266016, 251421696960654 @ -147, -33, -83
142623030672997, 313922309635776, 172051026248046 @ 197, -48, 178
211793103082053, 258637524078497, 413519499042315 @ -11, 5, -134
316227539793914, 330807868031342, 320059762270916 @ -90, -76, -51
363745515105897, 308033947226491, 241876133298636 @ 9, 29, 53
229073101043463, 182441744874760, 375616182031518 @ -6, 114, -105
311663766702322, 293169473612442, 266993157354132 @ -64, -12, 25
165743821901955, 245775966807730, 293803407552466 @ 40, 19, 9
349142785799508, 280261145006550, 287389255673128 @ 124, 164, -135
299220074031339, 172470550513459, 207086145840829 @ -65, 163, 120
51599932704531, 110067755093612, 120750763264579 @ 187, 186, 216
362339688007455, 128526862135900, 213561367782111 @ 123, 898, 174
318235966547318, 236743583502987, 172190463362498 @ -150, 21, 147
243218064862137, 146112647037076, 312898709705706 @ -12, 173, -28
248532762868587, 127913038997386, 306713186523936 @ -89, 124, 5
356833591049452, 288318963368346, 175747488009196 @ -36, 56, 237
429258217460035, 281264286545936, 199918966637106 @ -81, 462, 379
288595615758281, 286112367984743, 301320148789454 @ 17, 15, -49
434137829300957, 385164566787576, 251517643175406 @ -90, -513, -101
226684015769909, 393228920796224, 237234101626834 @ 5, -162, 75
277608974085399, 484613028229744, 346163443971816 @ -86, -266, -56
439564663355742, 339477585210058, 360927913554417 @ -264, -84, -224
243540738730971, 359735080690960, 250444934709888 @ -65, -114, 61
414936626664123, 309300663907822, 216629185840824 @ -56, 125, 188
397872703252389, 212898395772056, 240610671804790 @ -131, 297, 60
123154693229737, 203455201989076, 290045021180228 @ 51, 52, 20
268437039198703, 312957758717668, 372983507517126 @ -58, -56, -101
290041101495914, 452525408726809, 261168521158394 @ 18, -305, 27
94022340218020, 214444823962799, 233285115180485 @ 78, 39, 80
187758784146701, 308231925236552, 42842321977264 @ 17, -54, 306
298993330355122, 276052686620461, 298685552862006 @ -10, 31, -41
332169842700025, 298970888104540, 302981537331018 @ -70, -11, -50
194328822595255, 76283873425353, 136668594275728 @ 239, 459, 281
120250832193905, 241032280181964, 229456138785466 @ 50, 11, 84
151422919814977, 301022504515816, 378981998111542 @ 111, -38, -117
96990387183037, 372867516983776, 14714289836806 @ 168, -134, 366
274942199061477, 481640626788556, 14527007819946 @ -11, -317, 432
224838145952262, 313821556817251, 263551720120806 @ 14, -55, 39
403167845873627, 244787413886076, 196299464895806 @ -30, 432, 279
423651938100112, 435225368641841, 336353363207841 @ -264, -201, -38
289166585859768, 74894176976193, 138452721266517 @ 130, 605, 328
431669875459573, 325370084156409, 252462190860946 @ -27, 143, -141
390448274978984, 338265610742420, 231189470189675 @ 98, -54, 98
237855310336712, 79275006966921, 512264534723696 @ -64, 191, -223
430777549022346, 301130642558299, 294289756858713 @ -166, 153, -262
222272412127973, 253877615323776, 267895382908238 @ 18, 27, 33
165432519670262, 95007658128776, 226194378092481 @ 24, 182, 88
281007118242885, 330242484331812, 296563154696266 @ -35, -75, -16
359290360054469, 394969290711776, 300557072988910 @ -60, -223, -88

5
2023/input/24/test-1 Normal file
View File

@@ -0,0 +1,5 @@
19, 13, 30 @ -2, 1, -2
18, 19, 22 @ -1, -1, -2
20, 25, 34 @ -2, -2, -4
12, 31, 28 @ -1, -2, -1
20, 19, 15 @ 1, -5, -3

1211
2023/input/25/input Normal file

File diff suppressed because it is too large Load Diff

13
2023/input/25/test-1 Normal file
View File

@@ -0,0 +1,13 @@
jqt: rhn xhk nvd
rsh: frs pzl lsr
xhk: hfx
cmg: qnr nvd lhk bvb
rhn: xhk bvb hfx
bvb: xhk hfx
pzl: lsr hfx nvd
qnr: nvd
ntq: jqt hfx bvb xhk
nvd: lhk
lsr: lhk
rzs: qnr cmg lsr rsh
frs: qnr lhk lsr

View File

@@ -1,9 +1,6 @@
#![feature(iter_map_windows)]
#![feature(test)]
use std::{
cmp::max,
collections::VecDeque,
};
use std::{cmp::max, collections::VecDeque};
use anyhow::Result;
use aoc::Solver;

197
2023/src/bin/day13.rs Normal file
View File

@@ -0,0 +1,197 @@
#![feature(test)]
use anyhow::Result;
use aoc::Solver;
// -- Runners --
fn main() -> Result<()> {
Day::solve()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part1_test1() -> Result<()> {
Day::test(Day::part1, "test-1", 405)
}
#[test]
fn part1_solution() -> Result<()> {
Day::test(Day::part1, "input", 36448)
}
#[test]
fn part2_test1() -> Result<()> {
Day::test(Day::part2, "test-1", 400)
}
#[test]
fn part2_solution() -> Result<()> {
Day::test(Day::part2, "input", 35799)
}
// Benchmarks
extern crate test;
#[bench]
#[ignore]
fn part1_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part1, b)
}
#[bench]
#[ignore]
fn part2_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part2, b)
}
}
#[derive(Debug, PartialEq, Eq)]
enum Ground {
Ash,
Rocks,
}
impl Ground {
fn flip(&self) -> Self {
match self {
Ground::Ash => Ground::Rocks,
Ground::Rocks => Ground::Ash,
}
}
}
impl From<char> for Ground {
fn from(c: char) -> Self {
match c {
'.' => Self::Ash,
'#' => Self::Rocks,
_ => unreachable!("Invalid input"),
}
}
}
// -- Solution --
pub struct Day;
impl aoc::Solver for Day {
type Output1 = usize;
type Output2 = usize;
fn day() -> u8 {
13
}
fn part1(input: &str) -> Self::Output1 {
input
.split("\n\n")
.map(|block| {
block
.lines()
.map(|line| line.chars().map(|c| c.into()).collect::<Vec<Ground>>())
.collect::<Vec<Vec<_>>>()
})
.map(|block| {
let height = block.len();
let width = block[0].len();
if let Some(y) = (1..height).find(|&y| {
let top = block[0..y].iter().rev();
let bottom = block[y..height].iter();
top.zip(bottom).all(|(a, b)| a == b)
}) {
100 * y
} else if let Some(x) = (1..width).find(|&x| {
block.iter().all(|line| {
let left = line[0..x].iter().rev();
let right = line[x..width].iter();
left.zip(right).all(|(a, b)| a == b)
})
}) {
x
} else {
unreachable!("Their is always a mirror line")
}
})
.sum()
}
fn part2(input: &str) -> Self::Output2 {
input
.split("\n\n")
.map(|block| {
block
.lines()
.map(|line| line.chars().map(|c| c.into()).collect::<Vec<Ground>>())
.collect::<Vec<Vec<_>>>()
})
.map(|mut block| {
let height = block.len();
let width = block[0].len();
// Get the row/column of the old mirror line
let (x_old, y_old) = if let Some(y) = (1..height).find(|&y| {
let top = block[0..y].iter().rev();
let bottom = block[y..height].iter();
top.zip(bottom).all(|(a, b)| a == b)
}) {
(None, Some(y))
} else if let Some(x) = (1..width).find(|&x| {
block.iter().all(|line| {
let left = line[0..x].iter().rev();
let right = line[x..width].iter();
left.zip(right).all(|(a, b)| a == b)
})
}) {
(Some(x), None)
} else {
unreachable!("Their is always a mirror line")
};
// Try every possible smudge location
for j in 0..width {
for i in 0..height {
// Flip one
block[i][j] = block[i][j].flip();
if let Some(y) = (1..height).find(|&y| {
// The mirror line can not be the old one
if y_old == Some(y) {
return false;
}
let top = block[0..y].iter().rev();
let bottom = block[y..height].iter();
top.zip(bottom).all(|(a, b)| a == b)
}) {
return 100 * y;
} else if let Some(x) = (1..width).find(|&x| {
// The mirror line can not be the old one
if x_old == Some(x) {
return false;
}
block.iter().all(|line| {
let left = line[0..x].iter().rev();
let right = line[x..width].iter();
left.zip(right).all(|(a, b)| a == b)
})
}) {
return x;
} else {
// Revert flip
block[i][j] = block[i][j].flip();
continue;
}
}
}
unreachable!("Their should always be a mirror line")
})
.sum()
}
}

265
2023/src/bin/day14.rs Normal file
View File

@@ -0,0 +1,265 @@
#![feature(test)]
use std::{
collections::{hash_map::DefaultHasher, HashMap},
fmt::Display,
hash::{Hash, Hasher},
};
use anyhow::Result;
use aoc::Solver;
// -- Runners --
fn main() -> Result<()> {
Day::solve()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part1_test1() -> Result<()> {
Day::test(Day::part1, "test-1", 136)
}
#[test]
fn part1_solution() -> Result<()> {
Day::test(Day::part1, "input", 110407)
}
#[test]
fn part2_test1() -> Result<()> {
Day::test(Day::part2, "test-1", 64)
}
#[test]
fn part2_solution() -> Result<()> {
Day::test(Day::part2, "input", 87273)
}
// Benchmarks
extern crate test;
#[bench]
#[ignore]
fn part1_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part1, b)
}
#[bench]
#[ignore]
fn part2_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part2, b)
}
}
#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)]
enum Space {
Empty,
Cube,
Round,
}
impl Display for Space {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Space::Empty => write!(f, "."),
Space::Cube => write!(f, "#"),
Space::Round => write!(f, "O"),
}
}
}
impl From<char> for Space {
fn from(c: char) -> Self {
match c {
'.' => Self::Empty,
'#' => Self::Cube,
'O' => Self::Round,
_ => unreachable!("Invalid input"),
}
}
}
fn print_grid(grid: &[Vec<Space>]) {
for line in grid {
for space in line {
print!("{space}");
}
println!();
}
}
fn tilt_north(grid: &mut Vec<Vec<Space>>) {
let width = grid[0].len();
let height = grid.len();
for y in 0..height {
for x in 0..width {
if grid[y][x] == Space::Round {
let mut new_y = y;
for yy in (0..y).rev() {
if grid[yy][x] == Space::Empty {
new_y = yy
} else {
break;
}
}
if new_y < y {
grid[y][x] = Space::Empty;
grid[new_y][x] = Space::Round;
}
}
}
}
}
fn tilt_east(grid: &mut [Vec<Space>]) {
let width = grid[0].len();
for x in (0..width).rev() {
for line in grid.iter_mut() {
if line[x] == Space::Round {
let mut new_x = x;
for (xx, space) in line.iter().enumerate().skip(x + 1) {
if space == &Space::Empty {
new_x = xx
} else {
break;
}
}
if new_x > x {
line[x] = Space::Empty;
line[new_x] = Space::Round;
}
}
}
}
}
fn tilt_south(grid: &mut Vec<Vec<Space>>) {
let width = grid[0].len();
let height = grid.len();
for y in (0..height).rev() {
for x in 0..width {
if grid[y][x] == Space::Round {
let mut new_y = y;
for (yy, line) in grid.iter().enumerate().skip(y + 1) {
if line[x] == Space::Empty {
new_y = yy
} else {
break;
}
}
if new_y > y {
grid[y][x] = Space::Empty;
grid[new_y][x] = Space::Round;
}
}
}
}
}
fn tilt_west(grid: &mut [Vec<Space>]) {
let width = grid[0].len();
for x in 0..width {
for line in grid.iter_mut() {
if line[x] == Space::Round {
let mut new_x = x;
for xx in (0..x).rev() {
if line[xx] == Space::Empty {
new_x = xx
} else {
break;
}
}
if new_x < x {
line[x] = Space::Empty;
line[new_x] = Space::Round;
}
}
}
}
}
fn calculate_load(grid: &Vec<Vec<Space>>) -> usize {
grid.iter()
.enumerate()
.map(|(y, line)| {
line.iter()
.filter_map(|space| {
if space == &Space::Round {
Some(grid.len() - y)
} else {
None
}
})
.sum::<usize>()
})
.sum()
}
fn cycle(grid: &mut Vec<Vec<Space>>) {
tilt_north(grid);
tilt_west(grid);
tilt_south(grid);
tilt_east(grid);
}
// -- Solution --
pub struct Day;
impl aoc::Solver for Day {
type Output1 = usize;
type Output2 = usize;
fn day() -> u8 {
14
}
fn part1(input: &str) -> Self::Output1 {
let mut grid: Vec<Vec<Space>> = input
.lines()
.map(|line| line.chars().map(|c| c.into()).collect())
.collect();
tilt_north(&mut grid);
calculate_load(&grid)
}
fn part2(input: &str) -> Self::Output2 {
let mut grid: Vec<Vec<Space>> = input
.lines()
.map(|line| line.chars().map(|c| c.into()).collect())
.collect();
let mut cache = HashMap::new();
let mut cycles = 0;
let loop_length = loop {
cycle(&mut grid);
cycles += 1;
// Calculate the hash of the current state
let mut hash = DefaultHasher::new();
grid.hash(&mut hash);
let hash = hash.finish();
// Check if we have encountered this state before
if let Some(c) = cache.get(&hash) {
break cycles - c;
}
// Insert the state in the map
cache.insert(hash, cycles);
};
let remaining = (1000000000 - cycles) % loop_length;
for _ in 0..remaining {
cycle(&mut grid);
}
calculate_load(&grid)
}
}

159
2023/src/bin/day15.rs Normal file
View File

@@ -0,0 +1,159 @@
#![feature(test)]
use std::cmp::Ordering;
use anyhow::Result;
use aoc::Solver;
// -- Runners --
fn main() -> Result<()> {
Day::solve()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part1_test1() -> Result<()> {
Day::test(Day::part1, "test-1", 1320)
}
#[test]
fn part1_solution() -> Result<()> {
Day::test(Day::part1, "input", 511416)
}
#[test]
fn part2_test1() -> Result<()> {
Day::test(Day::part2, "test-1", 145)
}
#[test]
fn part2_solution() -> Result<()> {
Day::test(Day::part2, "input", 290779)
}
// Benchmarks
extern crate test;
#[bench]
#[ignore]
fn part1_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part1, b)
}
#[bench]
#[ignore]
fn part2_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part2, b)
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
enum Action<'a> {
Add { label: &'a str, focal_length: usize },
Remove { label: &'a str },
}
impl<'a> Action<'a> {
fn index(&self) -> usize {
match self {
Action::Add { label, .. } | Action::Remove { label } => label
.chars()
.map(|c| c as usize)
.fold(0, |acc, num| ((acc + num) * 17) % 256),
}
}
}
// -- Solution --
pub struct Day;
impl aoc::Solver for Day {
type Output1 = usize;
type Output2 = usize;
fn day() -> u8 {
15
}
fn part1(input: &str) -> Self::Output1 {
input
.trim()
.split(',')
.map(|sequence| {
sequence
.chars()
.map(|c| c as usize)
.fold(0, |acc, num| ((acc + num) * 17) % 256)
})
.sum()
}
fn part2(input: &str) -> Self::Output2 {
let actions: Vec<_> = input
.trim()
.split(',')
.map(|sequence| {
if sequence.ends_with('-') {
let label = sequence.split_once('-').unwrap().0;
Action::Remove { label }
} else {
let (label, focal_length) = sequence.split_once('=').unwrap();
let focal_length = focal_length.parse().unwrap();
Action::Add {
label,
focal_length,
}
}
})
.collect();
let mut boxes: [Vec<(&str, usize)>; 256] = std::array::from_fn(|_| Vec::new());
for action in &actions {
let index = action.index();
match action {
Action::Add {
label,
focal_length,
} => {
// NOTE: Using a library like OrderedMap would make this trivially easy
if let Some(position) = boxes[index]
.iter()
.position(|lens| lens.0.cmp(label) == Ordering::Equal)
{
// If a lens with this label is already in the box, replace it
boxes[index][position].1 = *focal_length;
} else {
// Otherwise add it to the end of the box
boxes[index].push((label, *focal_length));
}
}
Action::Remove { label } => {
if let Some(position) = boxes[index]
.iter()
.position(|lens| lens.0.cmp(label) == Ordering::Equal)
{
// A lens with the label exists, remove it
boxes[index].remove(position);
}
}
}
}
boxes
.iter()
.enumerate()
.map(|(index, b)| {
b.iter()
.enumerate()
.map(|(position, (_, focal_length))| {
(1 + index) * (1 + position) * focal_length
})
.sum::<usize>()
})
.sum()
}
}

200
2023/src/bin/day16.rs Normal file
View File

@@ -0,0 +1,200 @@
#![feature(test)]
use std::collections::{HashMap, HashSet};
use anyhow::Result;
use aoc::Solver;
// -- Runners --
fn main() -> Result<()> {
Day::solve()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part1_test1() -> Result<()> {
Day::test(Day::part1, "test-1", 46)
}
#[test]
fn part1_solution() -> Result<()> {
Day::test(Day::part1, "input", 8021)
}
#[test]
fn part2_test1() -> Result<()> {
Day::test(Day::part2, "test-1", 51)
}
#[test]
fn part2_solution() -> Result<()> {
Day::test(Day::part2, "input", 8216)
}
// Benchmarks
extern crate test;
#[bench]
#[ignore]
fn part1_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part1, b)
}
#[bench]
#[ignore]
fn part2_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part2, b)
}
}
fn energize(
mut position: (isize, isize),
mut direction: (isize, isize),
size: (isize, isize),
map: &HashMap<(isize, isize), char>,
energized: &mut HashSet<((isize, isize), (isize, isize))>,
) {
while position.0 >= 0 && position.0 < size.0 && position.1 >= 0 && position.1 < size.1 {
if !energized.insert((position, direction)) {
// We already proccessed this path before
break;
}
if let Some(c) = map.get(&position) {
direction = match (c, direction) {
('\\', (1, 0)) => (0, 1),
('\\', (-1, 0)) => (0, -1),
('\\', (0, 1)) => (1, 0),
('\\', (0, -1)) => (-1, 0),
('/', (1, 0)) => (0, -1),
('/', (-1, 0)) => (0, 1),
('/', (0, 1)) => (-1, 0),
('/', (0, -1)) => (1, 0),
('-', (1 | -1, 0)) => direction,
('-', (0, 1 | -1)) => {
energize((position.0 - 1, position.1), (-1, 0), size, map, energized);
energize((position.0 + 1, position.1), (1, 0), size, map, energized);
break;
}
('|', (1 | -1, 0)) => {
energize((position.0, position.1 - 1), (0, -1), size, map, energized);
energize((position.0, position.1 + 1), (0, 1), size, map, energized);
break;
}
('|', (0, 1 | -1)) => direction,
_ => unreachable!("Invalid state"),
};
}
position.0 += direction.0;
position.1 += direction.1;
}
}
fn energized(
start: (isize, isize),
direction: (isize, isize),
size: (isize, isize),
map: &HashMap<(isize, isize), char>,
) -> usize {
let mut energized = HashSet::new();
energize(start, direction, size, &map, &mut energized);
energized
.iter()
.map(|(position, _)| position)
.collect::<HashSet<_>>()
.len()
}
// -- Solution --
pub struct Day;
impl aoc::Solver for Day {
type Output1 = usize;
type Output2 = usize;
fn day() -> u8 {
16
}
fn part1(input: &str) -> Self::Output1 {
let mut width = 0;
let mut height = 0;
let map = input
.lines()
.enumerate()
.flat_map(|(y, line)| {
let y = y as isize;
if y + 1 > height {
height = y + 1;
}
line.chars()
.enumerate()
.filter_map(|(x, c)| {
let x = x as isize;
if x + 1 > width {
width = x + 1;
}
match c {
'.' => None,
'\\' | '/' | '|' | '-' => Some(((x, y), c)),
_ => unreachable!(),
}
})
.collect::<Vec<_>>()
})
.collect::<HashMap<_, _>>();
energized((0, 0), (1, 0), (width, height), &map)
}
fn part2(input: &str) -> Self::Output2 {
let mut width = 0;
let mut height = 0;
let map = input
.lines()
.enumerate()
.flat_map(|(y, line)| {
let y = y as isize;
if y + 1 > height {
height = y + 1;
}
line.chars()
.enumerate()
.filter_map(|(x, c)| {
let x = x as isize;
if x + 1 > width {
width = x + 1;
}
match c {
'.' => None,
'\\' | '/' | '|' | '-' => Some(((x, y), c)),
_ => unreachable!(),
}
})
.collect::<Vec<_>>()
})
.collect::<HashMap<_, _>>();
let mut max = 0;
for x in 0..width {
let a = energized((x, 0), (0, 1), (width, height), &map);
let b = energized((x, height - 1), (0, -1), (width, height), &map);
max = std::cmp::max(max, std::cmp::max(a, b));
}
for y in 0..height {
let a = energized((0, y), (1, 0), (width, height), &map);
let b = energized((width - 1, y), (-1, 0), (width, height), &map);
max = std::cmp::max(max, std::cmp::max(a, b));
}
max
}
}

341
2023/src/bin/day17.rs Normal file
View File

@@ -0,0 +1,341 @@
#![feature(test)]
#![feature(let_chains)]
use std::collections::{HashMap, HashSet};
use anyhow::Result;
use aoc::Solver;
// -- Runners --
fn main() -> Result<()> {
Day::solve()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part1_test1() -> Result<()> {
Day::test(Day::part1, "test-1", 102)
}
#[test]
fn part1_solution() -> Result<()> {
Day::test(Day::part1, "input", 1256)
}
#[test]
fn part2_test1() -> Result<()> {
Day::test(Day::part2, "test-1", 94)
}
#[test]
fn part2_test2() -> Result<()> {
Day::test(Day::part2, "test-2", 71)
}
#[test]
fn part2_solution() -> Result<()> {
Day::test(Day::part2, "input", 1382)
}
// Benchmarks
extern crate test;
#[bench]
#[ignore]
fn part1_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part1, b)
}
#[bench]
#[ignore]
fn part2_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part2, b)
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
struct Key {
pos_x: usize,
pos_y: usize,
dir_x: isize,
dir_y: isize,
}
// -- Solution --
pub struct Day;
impl aoc::Solver for Day {
type Output1 = usize;
type Output2 = usize;
fn day() -> u8 {
17
}
fn part1(input: &str) -> Self::Output1 {
let map: Vec<Vec<_>> = input
.lines()
.map(|line| {
line.chars()
.map(|c| c.to_digit(10).unwrap() as usize)
.collect()
})
.collect();
let size = (map[0].len(), map.len());
let destination = (size.0 - 1, size.1 - 1);
let mut unvisited = HashMap::new();
unvisited.insert(
Key {
pos_x: 0,
pos_y: 0,
dir_x: 0,
dir_y: 0,
},
0,
);
let mut seen = HashSet::new();
loop {
let current = unvisited
.iter()
.min_by_key(|(_key, cost)| *cost)
.map(|(key, cost)| (*key, *cost))
.unwrap();
if current.0.pos_x == destination.0 && current.0.pos_y == destination.1 {
return current.1;
}
// Check above
if current.0.dir_y > -3
&& current.0.dir_y <= 0
&& let Some(y) = current.0.pos_y.checked_sub(1)
{
let x = current.0.pos_x;
let cost = current.1 + map[y][x];
let key = Key {
pos_x: x,
pos_y: y,
dir_x: 0,
dir_y: current.0.dir_y - 1,
};
if let Some(next) = unvisited.get_mut(&key) {
*next = std::cmp::min(*next, cost);
} else if !seen.contains(&key) {
unvisited.insert(key, cost);
}
}
// Check below
let y = current.0.pos_y + 1;
if current.0.dir_y < 3 && current.0.dir_y >= 0 && y < size.1 {
let x = current.0.pos_x;
let cost = current.1 + map[y][x];
let key = Key {
pos_x: x,
pos_y: y,
dir_x: 0,
dir_y: current.0.dir_y + 1,
};
if let Some(next) = unvisited.get_mut(&key) {
*next = std::cmp::min(*next, cost);
} else if !seen.contains(&key) {
unvisited.insert(key, cost);
}
}
// Check left
if current.0.dir_x > -3
&& current.0.dir_x <= 0
&& let Some(x) = current.0.pos_x.checked_sub(1)
{
let y = current.0.pos_y;
let cost = current.1 + map[y][x];
let key = Key {
pos_x: x,
pos_y: y,
dir_x: current.0.dir_x - 1,
dir_y: 0,
};
if let Some(next) = unvisited.get_mut(&key) {
*next = std::cmp::min(*next, cost);
} else if !seen.contains(&key) {
unvisited.insert(key, cost);
}
}
// Check right
let x = current.0.pos_x + 1;
if current.0.dir_x < 3 && current.0.dir_x >= 0 && x < size.0 {
let y = current.0.pos_y;
let cost = current.1 + map[y][x];
let key = Key {
pos_x: x,
pos_y: y,
dir_x: current.0.dir_x + 1,
dir_y: 0,
};
if let Some(next) = unvisited.get_mut(&key) {
*next = std::cmp::min(*next, cost);
} else if !seen.contains(&key) {
unvisited.insert(key, cost);
}
}
// Mark the current node as visited
unvisited.remove(&current.0);
seen.insert(current.0);
}
}
fn part2(input: &str) -> Self::Output2 {
let map: Vec<Vec<_>> = input
.lines()
.map(|line| {
line.chars()
.map(|c| c.to_digit(10).unwrap() as usize)
.collect()
})
.collect();
let size = (map[0].len(), map.len());
let destination = (size.0 - 1, size.1 - 1);
let mut unvisited = HashMap::new();
unvisited.insert(
Key {
pos_x: 0,
pos_y: 0,
dir_x: 0,
dir_y: 0,
},
0,
);
let mut seen = HashSet::new();
loop {
let current = unvisited
.iter()
.min_by_key(|(_key, cost)| *cost)
.map(|(key, cost)| (*key, *cost))
.unwrap();
if current.0.pos_x == destination.0
&& current.0.pos_y == destination.1
&& (current.0.dir_x >= 4 || current.0.dir_y >= 4)
{
return current.1;
}
// Check above
if current.0.dir_y > -10
&& current.0.dir_y <= 0
&& (current.0.dir_x == 0 || current.0.dir_x >= 4 || current.0.dir_x <= -4)
&& let Some(y) = current.0.pos_y.checked_sub(1)
{
let x = current.0.pos_x;
let cost = current.1 + map[y][x];
let key = Key {
pos_x: x,
pos_y: y,
dir_x: 0,
dir_y: current.0.dir_y - 1,
};
if let Some(next) = unvisited.get_mut(&key) {
*next = std::cmp::min(*next, cost);
} else if !seen.contains(&key) {
unvisited.insert(key, cost);
}
}
// Check below
let y = current.0.pos_y + 1;
if current.0.dir_y < 10
&& current.0.dir_y >= 0
&& (current.0.dir_x == 0 || current.0.dir_x >= 4 || current.0.dir_x <= -4)
&& y < size.1
{
let x = current.0.pos_x;
let cost = current.1 + map[y][x];
let key = Key {
pos_x: x,
pos_y: y,
dir_x: 0,
dir_y: current.0.dir_y + 1,
};
if let Some(next) = unvisited.get_mut(&key) {
*next = std::cmp::min(*next, cost);
} else if !seen.contains(&key) {
unvisited.insert(key, cost);
}
}
// Check left
if current.0.dir_x > -10
&& current.0.dir_x <= 0
&& (current.0.dir_y == 0 || current.0.dir_y >= 4 || current.0.dir_y <= -4)
&& let Some(x) = current.0.pos_x.checked_sub(1)
{
let y = current.0.pos_y;
let cost = current.1 + map[y][x];
let key = Key {
pos_x: x,
pos_y: y,
dir_x: current.0.dir_x - 1,
dir_y: 0,
};
if let Some(next) = unvisited.get_mut(&key) {
*next = std::cmp::min(*next, cost);
} else if !seen.contains(&key) {
unvisited.insert(key, cost);
}
}
// Check right
let x = current.0.pos_x + 1;
if current.0.dir_x < 10
&& current.0.dir_x >= 0
&& (current.0.dir_y == 0 || current.0.dir_y >= 4 || current.0.dir_y <= -4)
&& x < size.0
{
let y = current.0.pos_y;
let cost = current.1 + map[y][x];
let key = Key {
pos_x: x,
pos_y: y,
dir_x: current.0.dir_x + 1,
dir_y: 0,
};
if let Some(next) = unvisited.get_mut(&key) {
*next = std::cmp::min(*next, cost);
} else if !seen.contains(&key) {
unvisited.insert(key, cost);
}
}
// Mark the current node as visited
unvisited.remove(&current.0);
seen.insert(current.0);
}
}
}

151
2023/src/bin/day18.rs Normal file
View File

@@ -0,0 +1,151 @@
#![feature(test)]
use std::{
collections::{HashSet, VecDeque},
fmt::Pointer,
};
use anyhow::Result;
use aoc::Solver;
// -- Runners --
fn main() -> Result<()> {
Day::solve()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part1_test1() -> Result<()> {
Day::test(Day::part1, "test-1", 62)
}
#[test]
fn part1_solution() -> Result<()> {
Day::test(Day::part1, "input", 95356)
}
#[test]
fn part2_test1() -> Result<()> {
Day::test(Day::part2, "test-1", 952408144115)
}
#[test]
fn part2_solution() -> Result<()> {
Day::test(Day::part2, "input", 92291468914147)
}
// Benchmarks
extern crate test;
#[bench]
#[ignore]
fn part1_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part1, b)
}
#[bench]
#[ignore]
fn part2_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part2, b)
}
}
// -- Solution --
pub struct Day;
impl aoc::Solver for Day {
type Output1 = usize;
type Output2 = usize;
fn day() -> u8 {
18
}
fn part1(input: &str) -> Self::Output1 {
let instructions: Vec<_> = input
.lines()
.map(|line| {
let (direction, rest) = line.split_once(' ').unwrap();
let direction = direction.chars().next().unwrap();
let (distance, _) = rest.split_once(" (#").unwrap();
let distance: usize = distance.parse().unwrap();
(direction, distance)
})
.collect();
let mut location = (0_isize, 0_isize);
let mut points = Vec::new();
let mut boundary = 0;
for (direction, distance) in &instructions {
for _ in 0..*distance {
match direction {
'U' => location.1 -= 1,
'D' => location.1 += 1,
'L' => location.0 -= 1,
'R' => location.0 += 1,
_ => unreachable!("Invalid input"),
}
}
boundary += distance;
points.push(location);
}
let mut area = 0;
for i in 0..points.len() as isize {
let n_min = (i - 1).rem_euclid(points.len() as isize);
let n_plus = (i + 1).rem_euclid(points.len() as isize);
area += points[i as usize].1 * (points[n_min as usize].0 - points[n_plus as usize].0);
}
let area = area as usize / 2;
let interior = area - boundary / 2 + 1;
interior + boundary
}
fn part2(input: &str) -> Self::Output2 {
let instructions: Vec<_> = input
.lines()
.map(|line| {
let (_, rest) = line.split_once(' ').unwrap();
let (_, rest) = rest.split_once(" (#").unwrap();
let (distance, direction) = rest.split_at(5);
let distance = usize::from_str_radix(distance, 16).unwrap();
let direction = direction.chars().next().unwrap();
(direction, distance)
})
.collect();
let mut location = (0_isize, 0_isize);
let mut points = Vec::new();
let mut boundary = 0;
for (direction, distance) in &instructions {
for _ in 0..*distance {
match direction {
'3' => location.1 -= 1,
'1' => location.1 += 1,
'2' => location.0 -= 1,
'0' => location.0 += 1,
_ => unreachable!("Invalid input"),
}
}
boundary += distance;
points.push(location);
}
let mut area = 0;
for i in 0..points.len() as isize {
let n_min = (i - 1).rem_euclid(points.len() as isize);
let n_plus = (i + 1).rem_euclid(points.len() as isize);
area += points[i as usize].1 * (points[n_min as usize].0 - points[n_plus as usize].0);
}
let area = area as usize / 2;
area + boundary / 2 + 1
}
}

368
2023/src/bin/day19.rs Normal file
View File

@@ -0,0 +1,368 @@
#![feature(test)]
use std::collections::{HashMap, VecDeque};
use anyhow::Result;
use aoc::Solver;
// -- Runners --
fn main() -> Result<()> {
Day::solve()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part1_test1() -> Result<()> {
Day::test(Day::part1, "test-1", 19114)
}
#[test]
fn part1_solution() -> Result<()> {
Day::test(Day::part1, "input", 480738)
}
#[test]
fn part2_test1() -> Result<()> {
Day::test(Day::part2, "test-1", 167409079868000)
}
#[test]
fn part2_solution() -> Result<()> {
Day::test(Day::part2, "input", 131550418841958)
}
// Benchmarks
extern crate test;
#[bench]
#[ignore]
fn part1_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part1, b)
}
#[bench]
#[ignore]
fn part2_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part2, b)
}
}
#[derive(Debug, Clone, Copy)]
enum Next<'a> {
Step(&'a str),
Accept,
Reject,
}
#[derive(Debug, Clone, Copy)]
struct Part {
x: usize,
m: usize,
a: usize,
s: usize,
}
impl Part {
fn sum(&self) -> usize {
self.x + self.m + self.a + self.s
}
}
#[derive(Debug, Clone, Copy)]
struct Part2 {
x: (usize, usize),
m: (usize, usize),
a: (usize, usize),
s: (usize, usize),
}
impl Part2 {
fn split(&self, category: Category, value: usize) -> (Option<Part2>, Option<Part2>) {
let range = match category {
Category::Cool => self.x,
Category::Musical => self.m,
Category::Aerodynamic => self.a,
Category::Shiny => self.s,
};
let ranges = if range.0 > value {
(None, Some(range))
} else if range.1 < value {
(Some(range), None)
} else {
(Some((range.0, value - 1)), Some((value, range.1)))
};
(
self.replace(category, ranges.0),
self.replace(category, ranges.1),
)
}
fn replace(&self, category: Category, range: Option<(usize, usize)>) -> Option<Part2> {
range.map(|range| match category {
Category::Cool => Part2 {
x: range,
m: self.m,
a: self.a,
s: self.s,
},
Category::Musical => Part2 {
x: self.x,
m: range,
a: self.a,
s: self.s,
},
Category::Aerodynamic => Part2 {
x: self.x,
m: self.m,
a: range,
s: self.s,
},
Category::Shiny => Part2 {
x: self.x,
m: self.m,
a: self.a,
s: range,
},
})
}
fn combinations(&self) -> usize {
(self.x.1 - self.x.0 + 1)
* (self.m.1 - self.m.0 + 1)
* (self.a.1 - self.a.0 + 1)
* (self.s.1 - self.s.0 + 1)
}
}
#[derive(Debug, Clone, Copy)]
enum Operator {
GreaterThan(Category, usize),
LessThan(Category, usize),
Otherwise,
}
#[derive(Debug, Clone, Copy)]
enum Category {
Cool,
Musical,
Aerodynamic,
Shiny,
}
#[derive(Debug, Clone, Copy)]
struct Step<'a> {
op: Operator,
next: Next<'a>,
}
impl<'a> Step<'a> {
fn process(&self, part: &Part) -> Option<Next<'a>> {
let ok = match self.op {
Operator::GreaterThan(Category::Cool, value) => part.x > value,
Operator::GreaterThan(Category::Musical, value) => part.m > value,
Operator::GreaterThan(Category::Aerodynamic, value) => part.a > value,
Operator::GreaterThan(Category::Shiny, value) => part.s > value,
Operator::LessThan(Category::Cool, value) => part.x < value,
Operator::LessThan(Category::Musical, value) => part.m < value,
Operator::LessThan(Category::Aerodynamic, value) => part.a < value,
Operator::LessThan(Category::Shiny, value) => part.s < value,
Operator::Otherwise => true,
};
if ok {
Some(self.next)
} else {
None
}
}
}
fn process_step(step: &str) -> Step {
if let Some((instruction, next)) = step.split_once(':') {
let next = match next {
"A" => Next::Accept,
"R" => Next::Reject,
n => Next::Step(n),
};
let (category, value) = instruction.split_once(['<', '>']).unwrap();
let category = match category {
"x" => Category::Cool,
"m" => Category::Musical,
"a" => Category::Aerodynamic,
"s" => Category::Shiny,
_ => unreachable!("Invalid input"),
};
let value = value.parse().unwrap();
let op = if instruction.contains('<') {
Operator::LessThan(category, value)
} else {
Operator::GreaterThan(category, value)
};
Step { op, next }
} else {
let next = match step {
"A" => Next::Accept,
"R" => Next::Reject,
n => Next::Step(n),
};
Step {
op: Operator::Otherwise,
next,
}
}
}
// -- Solution --
pub struct Day;
impl aoc::Solver for Day {
type Output1 = usize;
type Output2 = usize;
fn day() -> u8 {
19
}
fn part1(input: &str) -> Self::Output1 {
let (workflows, parts) = input.split_once("\n\n").unwrap();
let workflows = workflows
.lines()
.map(|workflow| {
let (name, mut rest) = workflow.split_once('{').unwrap();
let mut steps = Vec::new();
while let Some((step, remaining)) = rest.split_once(',') {
rest = remaining;
steps.push(process_step(step));
}
steps.push(process_step(rest.split_once('}').unwrap().0));
(name, steps)
})
.collect::<HashMap<_, _>>();
let parts = parts
.lines()
.map(|part| {
let part: Vec<usize> = part
.split_once('{')
.unwrap()
.1
.split_once('}')
.unwrap()
.0
.splitn(4, ',')
.map(|category| category.split_once('=').unwrap().1.parse().unwrap())
.collect();
if let [x, m, a, s] = part.as_slice() {
Part {
x: *x,
m: *m,
a: *a,
s: *s,
}
} else {
unreachable!("Invalid input");
}
})
.collect::<Vec<_>>();
parts
.iter()
.map(|part| {
let mut workflow = workflows.get("in").unwrap();
while let Some(next) = workflow.iter().find_map(|step| step.process(part)) {
match next {
Next::Step(name) => workflow = workflows.get(name).unwrap(),
Next::Accept => return part.sum(),
Next::Reject => return 0,
}
}
0
})
.sum()
}
fn part2(input: &str) -> Self::Output2 {
let (workflows, _) = input.split_once("\n\n").unwrap();
let workflows = workflows
.lines()
.map(|workflow| {
let (name, mut rest) = workflow.split_once('{').unwrap();
let mut steps = Vec::new();
while let Some((step, remaining)) = rest.split_once(',') {
rest = remaining;
steps.push(process_step(step));
}
steps.push(process_step(rest.split_once('}').unwrap().0));
(name, steps)
})
.collect::<HashMap<_, _>>();
let part = Part2 {
x: (1, 4000),
m: (1, 4000),
a: (1, 4000),
s: (1, 4000),
};
let mut queue = VecDeque::new();
queue.push_back((part, "in"));
let mut combinations = 0;
while let Some((mut part, name)) = queue.pop_front() {
let workflow = workflows.get(name).unwrap();
for step in workflow {
let (ok, fail) = match step.op {
Operator::GreaterThan(category, value) => {
let (a, b) = part.split(category, value + 1);
(b, a)
}
Operator::LessThan(category, value) => {
let (a, b) = part.split(category, value);
(a, b)
}
Operator::Otherwise => (Some(part), None),
};
// The part that matches goes to the next workflow
if let Some(ok) = ok {
match step.next {
Next::Step(name) => queue.push_back((ok, name)),
Next::Accept => {
let a = ok.combinations();
combinations += a;
}
Next::Reject => {}
}
}
// The part that failed goes to the next step
if let Some(fail) = fail {
part = fail;
}
}
}
combinations
}
}

274
2023/src/bin/day20.rs Normal file
View File

@@ -0,0 +1,274 @@
#![feature(test)]
use std::collections::{HashMap, VecDeque};
use anyhow::Result;
use aoc::Solver;
// -- Runners --
fn main() -> Result<()> {
Day::solve()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part1_test1() -> Result<()> {
Day::test(Day::part1, "test-1", 32000000)
}
#[test]
fn part1_test2() -> Result<()> {
Day::test(Day::part1, "test-2", 11687500)
}
#[test]
fn part1_solution() -> Result<()> {
Day::test(Day::part1, "input", 666795063)
}
#[test]
fn part2_solution() -> Result<()> {
Day::test(Day::part2, "input", 253302889093151)
}
// Benchmarks
extern crate test;
#[bench]
#[ignore]
fn part1_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part1, b)
}
#[bench]
#[ignore]
fn part2_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part2, b)
}
}
#[derive(Debug, Clone)]
enum ModuleType<'a> {
Broadcaster,
FlipFlop(bool),
Conjunction(HashMap<&'a str, bool>),
}
#[derive(Debug, Clone)]
struct Module<'a> {
module_type: ModuleType<'a>,
destinations: Vec<&'a str>,
}
impl<'a> Module<'a> {
fn process(&mut self, source: &'a str, high: bool) -> Option<bool> {
match &mut self.module_type {
ModuleType::Broadcaster => Some(high),
ModuleType::FlipFlop(current) => {
if high {
None
} else {
*current = !*current;
Some(*current)
}
}
ModuleType::Conjunction(inputs) => {
let input = inputs.get_mut(source).unwrap();
*input = high;
Some(!inputs.iter().all(|(_, prev)| *prev))
}
}
}
}
#[derive(Debug, Clone)]
struct Pulse<'a> {
source: &'a str,
destination: &'a str,
high: bool,
}
// Copied from day 8
fn gcd(a: usize, b: usize) -> usize {
if b == 0 {
return a;
}
gcd(b, a % b)
}
// Copied from day 8
fn lcm(a: usize, b: usize) -> usize {
if a > b {
(a / gcd(a, b)) * b
} else {
(b / gcd(a, b)) * a
}
}
// -- Solution --
pub struct Day;
impl aoc::Solver for Day {
type Output1 = usize;
type Output2 = usize;
fn day() -> u8 {
20
}
fn part1(input: &str) -> Self::Output1 {
let mut modules: HashMap<_, _> = input
.lines()
.map(|line| {
let (name, destinations) = line.split_once(" -> ").unwrap();
let destinations: Vec<_> = destinations.split(", ").collect();
let (name, module_type) = if name.starts_with('%') {
(name.split_at(1).1, ModuleType::FlipFlop(false))
} else if name.starts_with('&') {
(name.split_at(1).1, ModuleType::Conjunction(HashMap::new()))
} else if name == "broadcaster" {
(name, ModuleType::Broadcaster)
} else {
unreachable!("Invalid input");
};
(
name,
Module {
module_type,
destinations,
},
)
})
.collect();
// TODO: Because of the borrow check we have to create a clone of modules here
for (name, module) in modules.clone() {
for destination in &module.destinations {
if let Some(module) = modules.get_mut(destination) {
if let ModuleType::Conjunction(inputs) = &mut module.module_type {
inputs.insert(name, false);
}
}
}
}
let mut count = (0, 0);
let mut pulses = VecDeque::new();
for _ in 0..1000 {
pulses.push_back(Pulse {
source: "button",
destination: "broadcaster",
high: false,
});
while let Some(pulse) = pulses.pop_front() {
if pulse.high {
count.1 += 1;
} else {
count.0 += 1;
}
if let Some(module) = modules.get_mut(pulse.destination) {
if let Some(high) = module.process(pulse.source, pulse.high) {
for destination in &module.destinations {
pulses.push_back(Pulse {
source: pulse.destination,
destination,
high,
});
}
}
}
}
}
count.0 * count.1
}
fn part2(input: &str) -> Self::Output2 {
let mut modules: HashMap<_, _> = input
.lines()
.map(|line| {
let (name, destinations) = line.split_once(" -> ").unwrap();
let destinations: Vec<_> = destinations.split(", ").collect();
let (name, module_type) = if name.starts_with('%') {
(name.split_at(1).1, ModuleType::FlipFlop(false))
} else if name.starts_with('&') {
(name.split_at(1).1, ModuleType::Conjunction(HashMap::new()))
} else if name == "broadcaster" {
(name, ModuleType::Broadcaster)
} else {
unreachable!("Invalid input");
};
(
name,
Module {
module_type,
destinations,
},
)
})
.collect();
// TODO: Because of the borrow check we have to create a clone of modules here
for (name, module) in modules.clone() {
for destination in &module.destinations {
if let Some(module) = modules.get_mut(destination) {
if let ModuleType::Conjunction(inputs) = &mut module.module_type {
inputs.insert(name, false);
}
}
}
}
let r#final = modules
.iter()
.find(|(_, module)| module.destinations.contains(&"rx"))
.unwrap();
let final_name = r#final.0.to_owned();
let final_module = r#final.1.clone();
let mut frequencies = HashMap::new();
println!("{final_name}: {final_module:?}");
let mut pulses = VecDeque::new();
for i in 0..10000 {
pulses.push_back(Pulse {
source: "button",
destination: "broadcaster",
high: false,
});
while let Some(pulse) = pulses.pop_front() {
if let Some(module) = modules.get_mut(pulse.destination) {
if pulse.destination == final_name && pulse.high {
frequencies.insert(pulse.source, i + 1);
if let ModuleType::Conjunction(ref inputs) = final_module.module_type {
if frequencies.len() == inputs.len() {
return frequencies.values().copied().fold(1, lcm);
}
}
}
if let Some(high) = module.process(pulse.source, pulse.high) {
for destination in &module.destinations {
pulses.push_back(Pulse {
source: pulse.destination,
destination,
high,
});
}
}
}
}
}
unreachable!("No solution found");
}
}

174
2023/src/bin/day21.rs Normal file
View File

@@ -0,0 +1,174 @@
#![feature(test)]
use std::collections::{HashMap, HashSet, VecDeque};
use anyhow::Result;
use aoc::Solver;
// -- Runners --
fn main() -> Result<()> {
Day::solve()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part1_test1() -> Result<()> {
// The example only provides an answer for 6 steps. (16)
// This should be the correct answer for running the example with 64 steps
Day::test(Day::part1, "test-1", 42)
}
#[test]
fn part1_solution() -> Result<()> {
Day::test(Day::part1, "input", 3642)
}
// There is no test case for part 2
#[test]
fn part2_solution() -> Result<()> {
Day::test(Day::part2, "input", 608603023105276)
}
// Benchmarks
extern crate test;
#[bench]
#[ignore]
fn part1_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part1, b)
}
#[bench]
#[ignore]
fn part2_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part2, b)
}
}
// -- Solution --
pub struct Day;
impl aoc::Solver for Day {
type Output1 = usize;
type Output2 = isize;
fn day() -> u8 {
21
}
fn part1(input: &str) -> Self::Output1 {
let mut queue = Vec::new();
let map: HashMap<(isize, isize), char> = input
.lines()
.enumerate()
.flat_map(|(y, line)| {
line.chars()
.enumerate()
.map(|(x, mut c)| {
if c == 'S' {
queue.push((x as isize, y as isize));
c = '.';
}
((x as isize, y as isize), c)
})
.collect::<Vec<_>>()
})
.collect();
let mut set = HashSet::new();
let directions = [(-1, 0), (1, 0), (0, -1), (0, 1)];
for _ in 0..64 {
while let Some(step) = queue.pop() {
for direction in directions {
let next = (step.0 + direction.0, step.1 + direction.1);
// If the tile is free add it to the queue
if let Some(&tile) = map.get(&next) {
if tile == '.' {
set.insert(next);
}
}
}
}
queue = set.into_iter().collect();
set = HashSet::new();
}
queue.len()
}
fn part2(input: &str) -> Self::Output2 {
// All maps are square
let size = input.lines().count();
// Map is square: 131 x 131 => size = 131
// !!! Others have observed 26501365 = 202300 * size + size/2 !!!
// Is there a pattern for i * size + size/2?
// i = 0 => 3776
// i = 1 => 33652
// i = 2 => 93270
// Is there a function of i that can fit to this?
// Yes => Quadratic equation will fit this
// 3642 - 14737 x + 14871 x^2
// i = 202300 => 608603023105276
// Could not have done this without a hint from Reddit...
let i: isize = 202300;
let mut queue = Vec::new();
let map: HashMap<(isize, isize), char> = input
.lines()
.enumerate()
.flat_map(|(y, line)| {
line.chars()
.enumerate()
.map(|(x, mut c)| {
if c == 'S' {
queue.push((x as isize, y as isize));
c = '.';
}
((x as isize, y as isize), c)
})
.collect::<Vec<_>>()
})
.collect();
let mut nums = Vec::new();
let mut set = HashSet::new();
let directions = [(-1, 0), (1, 0), (0, -1), (0, 1)];
for n in 0..(2 * size + size / 2) {
while let Some(step) = queue.pop() {
for direction in directions {
let next = (step.0 + direction.0, step.1 + direction.1);
let next_wrapped = (
next.0.rem_euclid(size as isize),
next.1.rem_euclid(size as isize),
);
// If the tile is free add it to the queue
if let Some(&tile) = map.get(&next_wrapped) {
if tile == '.' {
set.insert(next);
}
}
}
}
queue = set.into_iter().collect();
set = HashSet::new();
if n + 1 == nums.len() * size + size / 2 {
nums.push(queue.len() as isize);
}
}
// Using linear algebra these solutions can be found
let a = (nums[0] - 2 * nums[1] + nums[2]) / 2;
let b = (4 * nums[1] - 3 * nums[0] - nums[2]) / 2;
let c = nums[0];
a * i.pow(2) + b * i + c
}
}

229
2023/src/bin/day22.rs Normal file
View File

@@ -0,0 +1,229 @@
#![feature(test)]
use std::collections::{HashMap, HashSet};
use anyhow::Result;
use aoc::Solver;
// -- Runners --
fn main() -> Result<()> {
Day::solve()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part1_test1() -> Result<()> {
Day::test(Day::part1, "test-1", 5)
}
#[test]
fn part1_solution() -> Result<()> {
Day::test(Day::part1, "input", 488)
}
#[test]
fn part2_test1() -> Result<()> {
Day::test(Day::part2, "test-1", 7)
}
#[test]
fn part2_solution() -> Result<()> {
Day::test(Day::part2, "input", 79465)
}
// Benchmarks
extern crate test;
#[bench]
#[ignore]
fn part1_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part1, b)
}
#[bench]
#[ignore]
fn part2_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part2, b)
}
}
#[derive(Debug, Hash, Clone, Copy, PartialEq, Eq)]
struct Brick {
start: (isize, isize, isize),
end: (isize, isize, isize),
}
impl Brick {
fn fall(
&self,
index: usize,
grid: &mut HashMap<(isize, isize, isize), usize>,
) -> HashSet<usize> {
let mut down = 0;
// Keep track of all the unique bricks supporting the current brick
let mut supports = HashSet::new();
for o in 1..self.start.2 {
for x in self.start.0..=self.end.0 {
for y in self.start.1..=self.end.1 {
for z in self.start.2..=self.end.2 {
if let Some(&support) = grid.get(&(x, y, z - o)) {
supports.insert(support);
}
}
}
}
// We have landed on a support
if !supports.is_empty() {
break;
}
down += 1;
}
// Occupy the space in the grid
for x in self.start.0..=self.end.0 {
for y in self.start.1..=self.end.1 {
for z in self.start.2..=self.end.2 {
grid.insert((x, y, z - down), index);
}
}
}
// Return all the unique supports
supports
}
}
// -- Solution --
pub struct Day;
impl aoc::Solver for Day {
type Output1 = usize;
type Output2 = usize;
fn day() -> u8 {
22
}
fn part1(input: &str) -> Self::Output1 {
let mut bricks: Vec<_> = input
.lines()
.map(|line| {
let (start, end) = line.split_once('~').unwrap();
let start: Vec<_> = start
.splitn(3, ',')
.map(|num| num.parse::<isize>().unwrap())
.collect();
let start = (start[0], start[1], start[2]);
let end: Vec<_> = end
.splitn(3, ',')
.map(|num| num.parse::<isize>().unwrap())
.collect();
let end = (end[0], end[1], end[2]);
Brick { start, end }
})
.collect();
// Sort the bricks from top to bottom
bricks.sort_by(|a, b| a.start.2.cmp(&b.start.2));
// Figure out which bricks are essential and can not be disintegrated
let mut grid = HashMap::new();
let essential_bricks: HashSet<_> = bricks
.iter()
.enumerate()
// Drop down each brick and get all the supporting bricks
.map(|(index, brick)| brick.fall(index, &mut grid))
// Only keep bricks that are supported by one other brick
// If that other brick is disintegrated this brick will fall
.filter(|supports| supports.len() == 1)
// Flatten out and collect to take out duplicate entries
.flatten()
.collect();
bricks.len() - essential_bricks.len()
}
fn part2(input: &str) -> Self::Output2 {
let mut bricks: Vec<_> = input
.lines()
.map(|line| {
let (start, end) = line.split_once('~').unwrap();
let start: Vec<_> = start
.splitn(3, ',')
.map(|num| num.parse::<isize>().unwrap())
.collect();
let start = (start[0], start[1], start[2]);
let end: Vec<_> = end
.splitn(3, ',')
.map(|num| num.parse::<isize>().unwrap())
.collect();
let end = (end[0], end[1], end[2]);
Brick { start, end }
})
.collect();
// Sort the bricks from top to bottom
bricks.sort_by(|a, b| a.start.2.cmp(&b.start.2));
// Figure out which bricks are essential and can not be disintegrated
let mut grid = HashMap::new();
let supports: Vec<_> = bricks
.iter()
.enumerate()
// Drop down each brick and get all the supporting bricks
.map(|(index, brick)| brick.fall(index, &mut grid))
.collect();
let essential_bricks: HashSet<_> = supports
.iter()
.filter(|supports| supports.len() == 1)
// Flatten out and collect to take out duplicate entries
.flatten()
.collect();
let mut sum = 0;
for eliminate in essential_bricks {
let mut falling = HashSet::new();
falling.insert(*eliminate);
let mut previous = 0;
while previous != falling.len() {
previous = falling.len();
let new: HashSet<_> = supports
.iter()
.enumerate()
.filter(|(_, supports)| {
if supports.is_empty() {
return false;
}
for support in *supports {
if !falling.contains(support) {
return false;
}
}
true
})
.map(|(index, _)| index)
.collect();
falling.extend(new);
}
if !falling.is_empty() {
sum += falling.len() - 1;
}
}
sum
}
}

169
2023/src/bin/day23.rs Normal file
View File

@@ -0,0 +1,169 @@
#![feature(test)]
use std::collections::HashSet;
use anyhow::Result;
use aoc::Solver;
// -- Runners --
fn main() -> Result<()> {
Day::solve()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part1_test1() -> Result<()> {
Day::test(Day::part1, "test-1", 94)
}
#[test]
fn part1_solution() -> Result<()> {
Day::test(Day::part1, "input", 2130)
}
#[test]
fn part2_test1() -> Result<()> {
Day::test(Day::part2, "test-1", 154)
}
#[test]
fn part2_solution() -> Result<()> {
Day::test(Day::part2, "input", 6710)
}
// Benchmarks
extern crate test;
#[bench]
#[ignore]
fn part1_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part1, b)
}
#[bench]
#[ignore]
fn part2_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part2, b)
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
enum Tile {
Path,
Forest,
Up,
Down,
Left,
Right,
}
fn find_path(
position: (isize, isize),
end: (isize, isize),
map: &Vec<Vec<Tile>>,
visited: &mut Vec<Vec<bool>>,
slippery: bool,
) -> (usize, (isize, isize)) {
visited[position.1 as usize][position.0 as usize] = true;
let size = (map[0].len() as isize, map.len() as isize);
let mut final_position = position;
let directions = [(0, -1), (0, 1), (-1, 0), (1, 0)];
let mut steps = 0;
for direction in directions {
let next_position = (position.0 + direction.0, position.1 + direction.1);
if next_position.0 < 0
|| next_position.1 < 0
|| next_position.0 >= size.0
|| next_position.1 >= size.1
|| visited[next_position.1 as usize][next_position.0 as usize]
{
continue;
}
let tile = map[next_position.1 as usize][next_position.0 as usize];
if tile == Tile::Forest {
continue;
}
if slippery
&& (tile == Tile::Up && direction != (0, -1)
|| tile == Tile::Down && direction != (0, 1)
|| tile == Tile::Left && direction != (-1, 0)
|| tile == Tile::Right && direction != (1, 0))
{
continue;
}
let (mut a, b) = find_path(next_position, end, map, visited, slippery);
a += 1;
if a > steps && b == end {
steps = a;
final_position = b;
}
}
visited[position.1 as usize][position.0 as usize] = false;
(steps, final_position)
}
// -- Solution --
pub struct Day;
impl aoc::Solver for Day {
type Output1 = usize;
type Output2 = usize;
fn day() -> u8 {
23
}
fn part1(input: &str) -> Self::Output1 {
let map: Vec<Vec<_>> = input
.lines()
.map(|line| {
line.chars()
.map(|c| match c {
'.' => Tile::Path,
'#' => Tile::Forest,
'^' => Tile::Up,
'v' => Tile::Down,
'<' => Tile::Left,
'>' => Tile::Right,
_ => unreachable!("Invalid input"),
})
.collect()
})
.collect();
let size = (map[0].len() as isize, map.len() as isize);
let mut visited = vec![vec![false; size.0 as usize]; size.1 as usize];
find_path((1, 0), (size.0 - 2, size.1 - 1), &map, &mut visited, true).0
}
fn part2(input: &str) -> Self::Output2 {
let map: Vec<Vec<_>> = input
.lines()
.map(|line| {
line.chars()
.map(|c| match c {
'.' => Tile::Path,
'#' => Tile::Forest,
'^' => Tile::Up,
'v' => Tile::Down,
'<' => Tile::Left,
'>' => Tile::Right,
_ => unreachable!("Invalid input"),
})
.collect()
})
.collect();
let size = (map[0].len() as isize, map.len() as isize);
let mut visited = vec![vec![false; size.0 as usize]; size.1 as usize];
find_path((1, 0), (size.0 - 2, size.1 - 1), &map, &mut visited, false).0
}
}

235
2023/src/bin/day24.rs Normal file
View File

@@ -0,0 +1,235 @@
#![feature(test)]
extern crate nalgebra as na;
use std::{collections::HashMap, convert::Infallible, str::FromStr};
use anyhow::Result;
use aoc::Solver;
use na::{Matrix6, Vector6};
// -- Runners --
fn main() -> Result<()> {
Day::solve()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part1_test1() -> Result<()> {
Day::test(Day::part1, "test-1", 2)
}
#[test]
fn part1_solution() -> Result<()> {
Day::test(Day::part1, "input", 13149)
}
#[test]
fn part2_test1() -> Result<()> {
Day::test(Day::part2, "test-1", 47)
}
#[test]
fn part2_solution() -> Result<()> {
Day::test(Day::part2, "input", 1033770143421619)
}
// Benchmarks
extern crate test;
#[bench]
#[ignore]
fn part1_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part1, b)
}
#[bench]
#[ignore]
fn part2_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part2, b)
}
}
#[derive(Debug, Clone, Copy)]
struct Hailstone {
px: f64,
py: f64,
pz: f64,
vx: f64,
vy: f64,
vz: f64,
}
impl Hailstone {
fn intersect_2d(&self, other: &Hailstone) -> Option<(f64, f64)> {
let dx = self.px - other.px;
let dy = self.py - other.py;
let d = self.vy * other.vx - self.vx * other.vy;
let t1 = (other.vy * dx - other.vx * dy) / d;
let t2 = (self.vy * dx - self.vx * dy) / d;
if t1.is_sign_negative() || t2.is_sign_negative() {
// Intersection is in the past
return None;
}
let x = self.px + self.vx * t1;
let y = self.py + self.vy * t1;
if x.is_infinite() || y.is_infinite() {
// Paths are parallel
return None;
}
Some((x, y))
}
}
impl FromStr for Hailstone {
type Err = Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
let parts: Vec<f64> = s
.split([',', '@'])
.map(|part| part.trim().parse().unwrap())
.collect();
Ok(Hailstone {
px: parts[0],
py: parts[1],
pz: parts[2],
vx: parts[3],
vy: parts[4],
vz: parts[5],
})
}
}
fn mode(numbers: &[usize]) -> usize {
let mut occurrences = HashMap::<_, usize>::new();
for &value in numbers {
*occurrences.entry(value).or_insert(0) += 1;
}
occurrences
.into_iter()
.max_by_key(|&(_, count)| count)
.map(|(value, _)| value)
.unwrap()
}
// -- Solution --
pub struct Day;
impl aoc::Solver for Day {
type Output1 = usize;
type Output2 = usize;
fn day() -> u8 {
24
}
fn part1(input: &str) -> Self::Output1 {
let hailstones: Vec<_> = input.lines().flat_map(Hailstone::from_str).collect();
let range = if hailstones.len() == 5 {
7.0..=27.0
} else {
200000000000000.0..=400000000000000.0
};
hailstones
.iter()
.enumerate()
.flat_map(|(index_a, a)| {
hailstones
.iter()
.enumerate()
.filter(|(index_b, _)| index_b < &index_a)
.filter_map(|(_, b)| a.intersect_2d(b))
.collect::<Vec<_>>()
})
.filter(|&(x, y)| range.contains(&x) && range.contains(&y))
.count()
}
fn part2(input: &str) -> Self::Output2 {
let h: Vec<_> = input.lines().flat_map(Hailstone::from_str).collect();
// Key insight for part 2 is
// p_rock + v_rock * t_i = p_i + v_i * t_i
// for every hailstone i
//
// This can be rewritten as
// p_rock - p_i = t_i * (v_i - v_rock)
// and since t_i is a scalar this means that
// (p_rock - p_i) is parallel to (v_i - v_rock)
// and therefore
// c_i = (p_rock - p_i) x (v_i - v_rock) = 0
// This holds true for every hailstone i, so
// c_i = c_j
// c_i = c_k
// with i != j != k
// Writing out these equations leads to a set of six linear equations
// And can therefore be written in matrix form
// A * solution = constant
// And the solution can now be found using
// solution = A^-1 * constant
let i = 0;
let j = 1;
// Due to numerical instability we run this with several different options for the third
// hailstone
let solutions: Vec<_> = (2..h.len())
.map(|k| {
// Constant in the matrix
let c1 = h[i].vz - h[j].vz;
let c2 = h[i].py - h[j].py;
let c3 = h[j].vy - h[i].vy;
let c4 = h[j].pz - h[i].pz;
let c5 = h[i].vx - h[j].vx;
let c6 = h[j].px - h[i].px;
let c7 = h[i].vz - h[k].vz;
let c8 = h[i].py - h[k].py;
let c9 = h[k].vy - h[i].vy;
let c10 = h[k].pz - h[i].pz;
let c11 = h[i].vx - h[k].vx;
let c12 = h[k].px - h[i].px;
// Setup the matrix
let matrix = Matrix6::new(
0.0, c1, c3, 0.0, c4, c2, -c1, 0.0, c5, -c4, 0.0, c6, -c3, -c5, 0.0, -c2, -c6,
0.0, 0.0, c7, c9, 0.0, c10, c8, -c7, 0.0, c11, -c10, 0.0, c12, -c9, -c11, 0.0,
-c8, -c12, 0.0,
);
// Constant on the rhs
let k1 =
h[i].py * h[i].vz - h[j].py * h[j].vz + h[j].pz * h[j].vy - h[i].pz * h[i].vy;
let k2 =
h[i].pz * h[i].vx - h[j].pz * h[j].vx + h[j].px * h[j].vz - h[i].px * h[i].vz;
let k3 =
h[i].px * h[i].vy - h[j].px * h[j].vy + h[j].py * h[j].vx - h[i].py * h[i].vx;
let k4 =
h[i].py * h[i].vz - h[k].py * h[k].vz + h[k].pz * h[k].vy - h[i].pz * h[i].vy;
let k5 =
h[i].pz * h[i].vx - h[k].pz * h[k].vx + h[k].px * h[k].vz - h[i].px * h[i].vz;
let k6 =
h[i].px * h[i].vy - h[k].px * h[k].vy + h[k].py * h[k].vx - h[i].py * h[i].vx;
// Put them into a vector
let k = Vector6::new(k1, k2, k3, k4, k5, k6);
let solution = matrix.lu().solve(&k).unwrap();
// The sum of all elements of the starting position is the answer
(solution[0] + solution[1] + solution[2]).round() as usize
})
.collect();
// The most common solution is the actual solution
mode(&solutions)
}
}

172
2023/src/bin/day25.rs Normal file
View File

@@ -0,0 +1,172 @@
#![feature(test)]
#![feature(iter_map_windows)]
use std::collections::{HashMap, HashSet, VecDeque};
use anyhow::Result;
use aoc::Solver;
use petgraph::{
algo::{condensation, has_path_connecting},
graphmap::{GraphMap, UnGraphMap},
visit::IntoNodeReferences,
Undirected,
};
// -- Runners --
fn main() -> Result<()> {
Day::solve()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part1_test1() -> Result<()> {
Day::test(Day::part1, "test-1", 54)
}
#[test]
fn part1_solution() -> Result<()> {
Day::test(Day::part1, "input", 552695)
}
// Benchmarks
extern crate test;
#[bench]
#[ignore]
fn part1_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part1, b)
}
#[bench]
#[ignore]
fn part2_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part2, b)
}
}
// Totally copied this from: https://github.com/Zemogus/AOC-2023/blob/328dc6618f3a360c3d3851ad1b10513a6c133336/src/day25.rs
// For some reason the graph library has no dijkstra that returns the actual path
fn find_shortest_path<'a>(
graph: &GraphMap<&'a str, (), Undirected>,
start: &'a str,
end: &'a str,
) -> Option<Vec<&'a str>> {
let mut queue = VecDeque::new();
let mut visited = HashSet::new();
let mut parents = HashMap::new();
queue.push_back(start);
while let Some(node) = queue.pop_front() {
// Already visited this node
if !visited.insert(node) {
continue;
}
// Reached the destination
if node == end {
break;
}
for neighbour in graph.neighbors(node) {
if !visited.contains(neighbour) {
parents.insert(neighbour, node);
queue.push_back(neighbour);
}
}
}
let mut path = Vec::new();
let mut node = end;
while node != start {
path.push(node);
if let Some(parent) = parents.get(&node) {
node = parent;
} else {
return None;
}
}
path.push(start);
Some(path)
}
// -- Solution --
pub struct Day;
impl aoc::Solver for Day {
type Output1 = usize;
type Output2 = usize;
fn day() -> u8 {
25
}
fn part1(input: &str) -> Self::Output1 {
// Create a list of all edges
let edges: Vec<_> = input
.lines()
.flat_map(|line| {
let (a, rest) = line.split_once(": ").unwrap();
rest.split(' ').map(|b| (a, b)).collect::<Vec<_>>()
})
.collect();
// Create a graph from all the edges
let graph = UnGraphMap::<_, ()>::from_edges(edges);
// Take a node as the starting point
let start = graph.nodes().next().unwrap();
// Loop over all other nodes
for end in graph.nodes() {
// Make a copy of the graph so we can modify it and undo changes later
let mut graph = graph.clone();
if start == end {
continue;
}
// If the two nodes are on the same side there should be more then three paths
// connecting the nodes together
// At least I think???
// This solution worked, so ¯\_(ツ)_/¯
for _ in 0..3 {
// Find the current shortest path
let path = find_shortest_path(&graph, start, end).unwrap();
// Remove the path
for slice in path.windows(2) {
match slice {
[a, b] => graph.remove_edge(a, b),
_ => unreachable!(
"There should be three paths connecting all the nodes together"
),
};
}
}
// If there is no path connecting the two nodes we have removed the three edges
// connecting the two halves
if !has_path_connecting(&graph, start, end, None) {
// Condense the graph, creates a new graph where each node contains all nodes that
// where connected in the input node
let condensed = condensation(graph.into_graph::<usize>(), false);
// The should give us two nodes each containing all the nodes in their respective
// half if we split the graph
if condensed.node_count() != 2 {
continue;
}
// Multiply the size of each of the halves together giving the final solution
return condensed
.node_references()
.fold(1, |acc, (_, nodes)| acc * nodes.len());
}
}
unreachable!("No solution found");
}
fn part2(_input: &str) -> Self::Output2 {
0
}
}