summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2023-12-12 03:30:24 -0500
committerJesse Luehrs <doy@tozt.net>2023-12-12 03:30:24 -0500
commit747edc0066c138718c86ed7cdb9d1685b2ca81a7 (patch)
tree0b3bb28482760bda87eb8da56f887cc8f9e21e25
parent2b5ae9dd435758aa6af7f19f83191b9c6601d636 (diff)
downloadadvent-of-code-747edc0066c138718c86ed7cdb9d1685b2ca81a7.tar.gz
advent-of-code-747edc0066c138718c86ed7cdb9d1685b2ca81a7.zip
day 12
-rw-r--r--benches/2023.rs5
-rw-r--r--data/2023/12.txt1000
-rw-r--r--src/bin/2023/day12.rs188
-rw-r--r--src/bin/2023/main.rs2
4 files changed, 1195 insertions, 0 deletions
diff --git a/benches/2023.rs b/benches/2023.rs
index fd48120..d6daad9 100644
--- a/benches/2023.rs
+++ b/benches/2023.rs
@@ -23,6 +23,8 @@ mod day9;
mod day10;
#[path = "../src/bin/2023/day11.rs"]
mod day11;
+#[path = "../src/bin/2023/day12.rs"]
+mod day12;
// NEXT MOD
day!(2023, 1, day1);
@@ -36,6 +38,7 @@ day!(2023, 8, day8);
day!(2023, 9, day9);
day!(2023, 10, day10);
day!(2023, 11, day11);
+day!(2023, 12, day12);
// NEXT DAY
fn bench_2023(c: &mut criterion::Criterion) {
@@ -52,6 +55,7 @@ fn bench_2023(c: &mut criterion::Criterion) {
day_combined!(2023, 9, day9);
day_combined!(2023, 10, day10);
day_combined!(2023, 11, day11);
+ day_combined!(2023, 12, day12);
// NEXT DAY COMBINED
})
});
@@ -71,5 +75,6 @@ criterion::criterion_main!(
bench_2023day9,
bench_2023day10,
bench_2023day11,
+ bench_2023day12,
// NEXT GROUP
);
diff --git a/data/2023/12.txt b/data/2023/12.txt
new file mode 100644
index 0000000..4ceebe2
--- /dev/null
+++ b/data/2023/12.txt
@@ -0,0 +1,1000 @@
+???#?????? 4,4
+??..#??#??.???? 5,1
+?.?.???????##????? 1,2,8
+.#????.????#?????? 2,1,1,2,1,1
+??????#????...#?... 9,1
+.???.?????. 3,1,1
+??..?..???. 1,1
+??.??.#..?..??###?? 2,1,1,1,6
+????.???## 3,1,3
+???#?###?#?#.??? 1,1,7,1,1
+??.#?#???#.????????? 7,6
+???#?#.??##?????? 3,1,6
+????##???#????#?#?? 6,8,1
+??#????#?? 5,1
+?##?#??#??????##?.#? 10,5,2
+..???..?##???..?? 1,5,1
+.?.#???.??? 3,2
+?????#?#.???.?.?###? 1,4,1,5
+?##.??#..?????????? 3,3,3,1,1
+?#???.#?????##??? 2,1,2,4,1
+.???.?????.? 1,2
+??.?????????#?#?#?#. 2,3,2,4,3
+??#??##????#?.??#. 7,1,2,2
+??##???..????#????#. 5,4,4
+.##?.?????????? 2,6,2
+????##??.??. 4,1,1
+?.#??#??.#??.##?? 5,1,1,2,1
+??#?##???..??? 8,1,1
+???????.?#?????.?? 6,6
+?#????#?.? 1,3
+??.???.?.?? 2,1
+????#????...??#?..?. 4,2
+?.?#????#??## 1,2,7
+?.???##??#?#?#??#?? 1,1,6,1,5
+?????#???#?. 6,1
+??#????..?? 4,1
+?.?#?#??.?#.???? 1,1,3,1,2
+??##??????#???.?? 5,1,1,1,1
+#???###??#???????#?# 1,6,2,3,1
+?.#????###???.??# 1,10,2
+?????.?.??????##?#?# 1,1,11
+?#??.?????? 1,4
+.???#???.#?? 5,2
+.??.??#??### 1,2,4
+???#?????#???#???#?? 12,3
+????#????.?#?? 7,2
+.?.??#?#?#.????. 1,5,1
+??.????????.??.????# 1,2,1,1,2,4
+?.??.#??#???# 1,1,6
+?.?.???##???.?#.. 1,7,1
+..#.??#??#?...? 1,1,1,2,1
+??..?.##???#??. 1,1,2,4
+#?????#??.#???? 1,1,1,2,4
+?#?#???????? 5,1,1
+#?#..????.# 3,4,1
+??#???.???.?.?????.# 5,1,1,1,5,1
+#??.?.????#?????#? 1,1,1,1,4,2
+????##?#??????????#. 10,4
+???#???#?#.?????## 1,1,3,1,4
+????#?#.????###?#.?? 2,3,9,1
+?.???????.#??#? 7,1,1
+?#?##??##??.??#?#?. 10,5
+???#???.#??#.?#?? 1,3,1,2,4
+?#???.?.??????? 2,2,2,1
+.#???????##?? 2,6
+?.#????????#. 2,1,1,1
+.#.???#.?..#?##??? 1,1,2,1,7
+.????.?#????????# 1,11
+?.#?.#???# 1,1,1
+?.???????#?. 1,8
+??#?.#????#?#??.?. 1,2,4,1
+????#.????#????#. 1,1,2,4,1
+????#??????#?.? 9,1,1
+.???#.#?.#..#?.??#? 2,1,2,1,2,2
+?.#??????##? 1,3,4
+#.???#???.???. 1,3,2,1
+???#???..??.??#??#. 2,1,2,5
+???##??.#?# 4,3
+?..?.???.???.?#??? 1,1,2,3,3,1
+.???##?.#????#?# 5,1,1,1,1
+.??###.??.?? 1,3,2,2
+?????#?##???#?###??? 1,15
+??#.??.???.??#?? 1,1,2,2,1
+?.?#.??..?#?? 1,1,1,2
+?#?????#?#????.??. 10,1,1
+??#.#.??#.?? 1,1,1,1
+.??##???#??#?#??.?#? 12,1
+?????????????#?#?? 1,1,4,1,1,1
+.?.##.?###??? 2,5
+..?.??.??? 1,1,3
+.?????????????#??. 1,9
+.##?##???? 5,1
+.#?..?????? 2,1,3
+?????##?.. 1,6
+##??????##? 5,2
+?????.#.?#??.?? 1,1,1,1,2
+#..?##?.?.###... 1,4,3
+??##?#?????.#??? 8,1,3
+????.?#?.??#?#?# 2,3,5
+??.????????????.???? 1,1,3,1,1,4
+?#?????.?????? 7,2,1
+????#.?.?????###?. 3,1,1,2,1,4
+?#????###??? 2,6
+#???.?.#??#????# 1,1,1,5,3
+#.??#????.. 1,5
+??#???.??#???##???. 4,1,2,4,1
+??#??????. 3,1
+????..#?##????## 3,10
+.##??.???????? 2,1,7
+???.?.?#?#.?..#?.? 4,2
+????#???#??#? 1,1,3,1
+?.??#...???#?????? 3,4,3
+????#??#?? 2,1,1
+?.??????#?????.? 8,3
+??.??.?#??????# 1,1,1,4,1
+.??.???.#??? 1,2,1,1
+??????.?.?#? 4,1,2
+?.#??..?#.#? 1,1,1,1
+??#??.???????#?.?? 2,1,1,1,2,1
+??...##??.????? 4,3
+??##?#?##????? 1,7,1
+.?##???.?.# 5,1,1
+??..?#?#.. 1,4
+???##???.???##??### 1,2,1,9
+.?????#??? 3,2
+??#.???..??????##??? 2,1,11
+???#?????#?#????? 1,7,1,1
+.??.?.#?#.??#??##?#? 1,1,1,1,7
+#???#??.?# 1,3,1
+???##???.????????.?# 1,4,1,1,1,2
+???#?????#####?? 1,13
+????#??????.?? 6,2
+??????#?.???????#.?? 3,5
+?#??.??##??.?.? 3,4,1
+????????##?.. 7,3
+???###.??. 6,1
+.?#??????#??#??#?? 1,10,3
+?.?..????.??..?#?#.. 1,4
+.??????#??##??? 1,2,7
+????#??.#??##?#? 2,3,8
+?#???.?.?. 1,1,1
+.??##??#????? 3,1,1,1
+.?????#??#??#???? 2,3,5,1,1
+?#?...?###???? 2,5,1
+?##?.?..?.?? 3,1,1,2
+?##????.?????##? 2,2,2,4
+??#????#?#? 3,4
+#.??#?##?.?.?.#? 1,7,1,1,1
+?##?#??.?????.?? 5,2,1,1
+?.??#????#????#??#. 1,1,1,3,1,4
+?????.?#???#?? 1,1,3,2
+###?????????.??????? 5,1,1,1,2,1
+?????###???#????.?. 1,7,1,1,1
+???.?????#.?. 1,5,1
+#???###???#?#???#?? 2,4,5,2
+??????#???#?#?#?.?# 1,1,5,1,4,1
+???.#?##????#??.#? 1,1,9,2
+?.?????????.?? 1,5,2,1
+???????#?##??.?.?? 11,1
+????..####???? 2,8
+.?##?.??##???#. 3,4,1
+????????.?? 3,1
+???.#.?????#?#?..? 1,1,2,1,4,1
+.???????#?? 3,1
+???#??##?????##??? 4,2,7
+??#?##????.. 1,1,3,1
+.????????????.???.?. 1,5,4,1,1
+....?#????.?????#??? 2,6
+?.??#????.??????.# 1,2,1,1,6,1
+??..?##?..#????.?? 2,5
+#??##??#?###?#??.?? 5,9,1
+??##??#????#??? 5,1,4,1
+?.?#.?#.?.#????????? 1,1,2,1,6,1
+.?#??#?#?#?#?? 3,8
+#???????#?.?...??? 2,6,1
+?????????#.?????..?? 3,1,1,5,1
+??##?##.?????#? 3,2,1,1,1
+??.???###???.???. 1,5,2,1,1
+????##?????#?. 1,10
+.???..##?#??#? 1,8
+???????#?#??..??? 1,1,4,1,3
+?#???????????. 5,1,1
+??#?.#???? 1,1,2
+??????????. 5,1,1
+.????????????#?#. 1,13
+??????#??#.?#?? 9,4
+???????.#? 5,1
+???###???.???#?...? 3,1,5,1
+?.?????????? 1,4,1
+?.???????????. 1,5
+?????###?? 1,6
+#??????##????????.? 1,1,10
+?##????????# 9,1
+..?????#??#???# 7,2
+..?#..??????. 2,5
+???#?##???. 6,2
+.?????#???.???????# 1,3,2,1,4
+???.?????? 2,1
+??#?#?????????#??? 3,4,2,3
+....??#?????.?# 3,3,2
+?#?#??###?.????????. 1,1,5,2,2,1
+??#.?..??? 3,1
+?#???????.? 3,1
+.?????.??.?.??# 3,1,1,1,1
+??#????.?? 3,2,1
+???.?#??.?#.???. 2,2,1,2,2
+####??.????????#?? 6,1,5
+?##????##??#?#????? 9,4,3
+#.???#?#?.#??????# 1,6,1,2,1
+??#.???##???..?? 3,6
+.??.??????????#?.?? 1,5,1,2,1
+..???#??????? 3,3
+????##???. 3,1
+##?##?#?#?.? 9,1
+??????.??###??? 2,6
+???..??#??????#. 2,5,2
+???.??#????????. 2,4,5
+??..???.??.?..??.? 1,1
+??????.#?## 1,4
+.?##??????. 4,2
+???##?????#??.. 4,3
+.#?##.?.???? 4,1
+?#??#.?#??#???#?? 2,1,9
+.??##???????? 7,1
+??#??#.???#. 5,1,1
+?.?#?.??.?????#?? 1,2,1,1,5
+?#??.????#??###?#?? 4,1,9
+.??####??.?#?#?###? 6,8
+???????#..??#??#? 2,2,7
+.??????#???. 1,5,1
+??#.?#???.?? 1,2,1,1
+?##?????##??#.#??? 3,5,1,1,1
+????.??##?.?. 2,1,4
+.??????????##??????. 2,1,6,4
+?#.????.??#?? 2,2,2
+????#??#????????. 2,9
+???.??..???? 2,1,1,1
+??.??????#??#???#? 1,1,4,1,2
+##??????#???#????? 5,4,2,2
+#???#???????##.?#?. 9,1,2,3
+?.?.????.? 1,2
+?#??#???????. 5,1,1
+??###?#.???.####?## 5,1,7
+?????##???#?????#? 1,4,1,2,2
+#??.???????.? 3,1,2,1
+???#????#??#?#? 4,1,4
+??.??..??..? 2,2,1,1
+???????##?. 1,4
+.?????????????????. 1,5,2,3,1
+???????#??#???????? 6,5,1,1
+??#.?.?????.?.? 1,4,1
+.?????#.??#???..?.?? 1,1,1,5,1,1
+?#?##???#???????? 5,1,1,1,4
+????#?.#?#????.#?#?? 1,1,3,2,4
+#???#????.#????? 8,4
+?.????????.?#?#?? 1,3,4,1
+#???#???###?#?.##??? 1,11,4
+.?.???#??????? 1,7,1
+???##??.????#? 4,6
+????#.?#??.??.?#.??? 5,2,1,1,2,3
+#.#???????#??#. 1,1,2,1,1
+#.???#?#??#? 1,1,4,1
+.?#.????##?##????? 2,10
+.??.??.?.. 2,1,1
+.?#?#??????????????? 3,13
+?#????#.?????#? 2,1,1,3,2
+#?????.???#???#?.#? 1,1,7,2
+????.?.???.?.. 1,1,1
+#????#????????# 1,1,1,5,2
+?..??????.#?##??? 5,5
+..?##??????#. 4,4
+??##?#??#? 5,2
+???.??????#?.? 1,1,5,1
+#?#?#????#..?? 1,4,1,1
+???.??#.## 1,3,2
+?????#.?#??#??..?#.? 1,4,7,2,1
+##.???.#??##?##??#?? 2,2,11
+.#??.???.?##???#???? 1,1,1,3,5
+????.?????? 3,1,2
+???..#???. 2,1,1
+?.??.???##?#?#??#?# 1,1,1,8,1,1
+...????.?? 1,1,1
+#.#.??????#?? 1,1,1,5
+.?#???..????#? 4,2,1
+??.???.??????#??.? 1,1,8,1
+???#.?????.#?#? 1,3,1,1
+???????#????...??#. 11,3
+?#?##?##?. 2,5
+.???????.??? 5,1
+?????????????#??##. 3,10
+.??????#????#????##? 2,2,1,1,8
+.??#???????????##?? 2,9
+?#?#??.??.???# 5,2,4
+.???#???.??. 2,2
+????##??#????#?????? 1,4,2,2,4
+????????.?.?#????? 8,1,1,4
+.???...##???????.? 2,7
+???..??.??.###?? 1,5
+???.???#?? 2,1,1
+##?..??.?#. 2,1,1
+??????..?##??????# 1,1,2,10
+?????##??? 2,2,1
+?.??###??..?# 1,7,1
+#???#?#????#?????? 1,1,3,2,1,4
+??????#?##???#?#?. 1,2,2,2,6
+??.#....?#.??? 1,1
+#####?#?...?#?. 7,2
+.??.????????. 2,2,1,2
+?..#..??????? 1,4
+?##???#...?##??? 2,1,3
+??????#??# 1,2,1
+??????#????? 1,1,2,1
+??#???#???##????#??? 11,6
+.?..???#???. 1,3,2
+?#??##?.??. 7,1
+#????????.?# 2,2,1,1
+?..?#?????.??? 4,2
+?????#?#?????#?? 1,5,1,4
+?.??#?.#?##???#?.?? 4,8
+##?#???#??? 4,1,3
+.?.?????#?????. 2,4
+#??????#???#..##? 1,1,3,1,2
+???.???????##????? 2,1,7
+???#.?.#???#??? 4,1,2,2,1
+.##..?#??.?????#?# 2,3,1,4,1
+?#?????#?##???? 1,11
+???????#.?.?#.. 6,1,2
+.???????.#.?.????? 4,1,1,1,3
+.?.#..??.?#????#?## 1,1,1,10
+#?.??#??#??????###?# 1,3,3,3,5
+??#???#???#.???#?? 11,1,3
+??#?#.?????? 3,5
+?.?????..????##?##?? 2,1,1,6,1
+??????#??###? 1,1,7
+.???#????.??? 7,1
+.????##??#??#???# 1,5,1,5
+??#????#??#??#??#?#? 1,1,7,1,2,1
+?.??????????? 1,1,1
+?.#?#.??##????.?? 1,3,1,5,1
+.????.#.?????#?. 3,1,5
+?#?#??.???#? 1,1,1
+.#?#??.#??#???#.# 3,1,8,1
+?.????#.??????? 1,2,6
+??##??.?#?. 4,3
+#?#?##????#? 9,1
+?##???##???##?.?. 3,1,8,1
+????????#?.? 1,1,1,1
+???#??????# 2,2
+?#?..?#..???.?? 2,2,1,1,1
+#????.?#?? 3,3
+.?????.?.???#?. 2,1,1,2,2
+.????.?.#??. 1,1
+#??.?????#.??????.? 2,4,1,4
+?.?...????????. 3,2
+.##??.#??#?#??? 2,7
+.???.?????? 2,1,2
+?#???#?#????#??#??? 3,9,2
+??????????.???.?? 3,5,2,1
+????.??.???## 2,2,1,2
+??###.???# 4,1,1
+?????#???????. 3,7,1
+.??????#?????#???? 1,4,4,1
+.???#?.????## 4,3
+##..?????. 2,2
+???##???#? 3,1
+???##???.?????#.. 1,6,1,1,1
+?????##????? 2,5,1
+?.????????#?? 1,1,2,2
+.?.??????? 1,2
+??##..#??.?.???#?#? 4,1,1,1,4
+?.?#?#??#?.## 4,1,2
+?????????#.????#??. 8,1,3
+?##??#?.?.?????? 6,1,3,1
+??#?????#?#?#?.?#? 11,1
+#???...?#???.#???? 2,1,5,1,1,1
+?#????.?#???#??? 1,1,9
+.?????????# 1,3,2
+.?.??#?#?????.?..?? 10,1
+?.??#??#?.??.?.?#?? 1,6,1,3
+?????.??##??#?##??? 2,11
+?#?#???#??.#?# 1,6,1,1
+.??#??????##?#???# 5,1,5,1
+?#??????#?#???.#? 2,9,2
+???.?#?.????#????? 1,3,1,3,1
+.???.?????.??..?. 2,5,1,1
+?.???###?.?#????#?#? 1,4,3,2,1
+##??.?#..?.##?.?? 4,1,1,2,1
+?.???????????#?? 2,1,6
+??#?.???????? 4,4
+?#???##?.???? 4,2,2
+.?????##..?.?? 6,1
+????#?#?????#.?? 7,1
+#??#?#??????#????#?? 1,8,1,1,1,1
+.??#?????.. 3,1
+????.???#?????? 2,1,1,2,1
+??.???.?#????##??? 1,1,3,5
+??#?#?#.##?? 6,4
+??#??#????.???? 1,6,1,1,1
+?????..##??????. 2,1,6
+?#.?#?.???#.?..# 2,2,2,1,1
+???.#????.?#?#??? 1,5,4
+?????##..??????? 1,3,1,3
+.???.?..??. 1,1,2
+?.??#??#.#?.??## 2,1,1,1,2
+??#.????#.??? 2,1,1,3
+.#?.??.??? 2,1,2
+?????????##?? 3,4
+??????#????. 1,2,1,3
+.#.?????##???#?????# 1,4,3,4,2
+#??#???????? 1,4,3
+?#??.??#?? 2,1,3
+.???#?##????.?. 7,1
+.?#?#.?#??.? 2,1,2,1
+?.#?#??#?? 4,2
+??.???#??#?.?????.? 7,4
+?.?...#???????#? 1,1,2,2
+??.????...#? 3,1
+..#?.??????..?###? 1,4,4
+?..###???.??.?. 1,4,1,1
+??.?.??#?????.# 2,7,1
+.??.???????#? 1,5,2
+?####??..???#???.? 5,1,2,1,1,1
+?.?#????#???? 1,4,1,1
+??????????.??.?? 1,5,1,1
+?.#?..????#??## 1,1,6
+?????..?.?? 3,1,1
+.?.?#????????#.???? 1,3,1,5,1,2
+????#?.??#?. 3,1
+.##??#.??????#?#?. 5,7
+????????##?#???##..? 4,11,1
+.?.?#?#?##??#?? 1,4,5,1
+##.??????..#. 2,1,1,1
+?????.?.???#?.?????? 1,3,2
+##.???????.?.?# 2,3,1,1
+?##??####??..?? 3,4,1,1
+?????????#?##???##?? 3,6,4
+..??#??.?#.?#?.?.##. 3,1,2,2
+????#??????? 3,4
+.#????..?????????? 1,1,1,1,5
+????..???#??#.?#?? 3,1,1,1,3
+?????#???#??#? 4,2,1
+?????##???#???????? 2,6,1,2
+.?#??.?..????#? 2,1,1,1,3
+.???.?##???? 1,4,1
+.##?..#.????? 3,1,1,1
+#?#.?.????..#??? 3,3,1,1
+?#..#?#.#??#?????? 1,3,1,1,1,1
+?????????#????.????? 5,3
+???#??????.? 7,1,1
+..????.???#..??# 2,3,1
+?.?.??..##? 1,2
+.#?????.?#????.? 5,3,1
+?#???.?????#?.#? 1,1,5,1
+?????.?.?#????# 1,1,1,1,4
+?.???????..# 1,1,2,1
+?????##??? 1,4,1
+??????.??# 1,1,1
+???#????.#?#?? 6,1,2
+????.??????.? 1,1,1,2
+..?.????#..???? 4,4
+???#.??##?..?#??. 2,3,3
+??.#??.?.?#???.??..? 1,1,2
+????.?.???? 1,1,2
+.????????..# 2,2,1
+?????????# 3,3
+#??#??#??##????? 1,2,6,1,1
+.??#???.#??#?#???? 1,2,1,1,4,1
+??###???##???#????? 5,8
+??.?.#???#????? 1,5,2
+?????.#?##???? 1,1,3,1
+#????#???#??? 2,3,3
+?.??.??????? 1,1,1,3
+.??#??#?????.?.??? 7,1,1,2
+??#???????#???##???? 7,9,1
+?????#??????.??.. 11,1
+??#??????#??.?.##? 3,4,3,3
+?..???..??##? 1,1,1,2
+????#???#?##??.???#. 8,3,4
+?##.??#.????##?# 2,2,5
+#???.???#?#?.?#? 1,1,5,2
+?????.??.#? 3,2,1
+?.#?#??.?#?????#. 1,1,1,1,8
+#????????.#??? 5,3,1,1
+?..#???##?.??#???? 1,1,1,3,6
+?##?#..??.#.?.? 3,1,1,1,1
+?.??????#.?#??#????. 5,1,7
+????#?.?#?.??#. 1,2,1,2
+?#?##??#??.?? 7,1,1
+#??#??#??????????## 1,2,3,7
+???##.?????#??#.#? 1,2,3,3,1,1
+??##?.???#?##?#?? 3,8
+??.?#?.??.. 1,2,1
+???####??.?.?#?.?# 1,4,1,1,2
+????###????????# 13,1
+#????##??###?.# 1,1,8,1
+??????#????##?? 1,1,2,1,2
+?.??.???#?#????..#. 1,2,1,5,1
+????#??#??#??.??.?? 8,1,1,2
+.???.??.??#?? 3,1,5
+??.#.??#.??? 1,1,3,2
+?#??.????????. 3,4,3
+???#??#?.?#?? 6,2
+??#???###. 1,2,4
+#..?#????????? 1,2,7
+.???????????##??? 2,1,7
+.##??????? 3,1,1
+?.#??????.?# 1,1,2,2
+?###??#???#??? 4,3,1,1
+?####?????#?##?# 13,1
+.#?.???????. 1,1,1,2
+?.????#??? 1,2,1
+???#??.??###????##?# 3,10,1
+??..????????##?#? 1,2,1,7
+?..?????##?.??##?? 7,5
+.???..???## 1,5
+?????.??#???????.?? 2,5,4,2
+.???????????? 1,1,1,6
+?..?????????#?#?. 1,2,1,8
+??#????.?????##?? 4,1,8
+???#.?##?????#?.# 1,1,6,1,1
+..??###??#?.#???#??? 7,1,6
+????????#??. 3,3
+??#??#????????????. 9,6
+???????????.?? 6,4
+????#?#?#???#? 5,7
+.#?##????#.#???#? 1,7,1,4
+?????#?.???#? 5,3
+?##???#??#??.?..?. 10,1,1
+?#????#?#????.#??# 7,1,1,1,1
+#?#?.??????.???????? 1,1,1,3,1,4
+?#??????#.???.?#?? 9,1,1
+#????????. 4,2
+??.??.#???.###? 1,1,1,1,4
+?#???#????##??#?? 3,2,1,2,4
+??#?#??????.??.?.??? 8,1,1
+???????#??.. 1,4
+.??.???#????.?????.? 5,2
+??#??.?.###?#??. 1,2,1,5,1
+?#??.??.??????? 4,1,1,2,2
+.?#??..??? 1,1
+?.??#.????.?# 1,1,2,1
+.??##??.#? 2,1
+?#???.?#????????# 1,2,4,1,2
+.?###????? 5,1
+..??.??#?????? 1,2,2
+??#?#?.#?.??? 6,1,1,1
+#?????????...#? 1,4,1,1
+.???????##??.?..? 1,6,1
+?.????.?????#?#??.?? 1,3,10
+?#?#???#?????#? 3,7
+#?????.?#???????? 5,3,1,3
+.#?#??.?????#?#? 3,9
+.#???????.? 1,1,4
+???.?#?????###????? 2,9
+?.##???#????#???? 6,2
+??.?#?#?#??.?#?? 1,8,1,1
+??????#??#??.?.#. 1,10,1,1
+#???.#???#. 3,1,2
+???????.#. 3,1,1
+###????.?.????.?#?.# 5,1,3,1,1
+.##?#???#?#????#??? 5,1,1,1,5
+.??????????.. 2,2
+?????????. 1,2,1
+?.??#???.???.?. 1,5,1,1
+???????.#.??.??#.#? 3,3,1,1,3,1
+#?.??.#??. 2,1,3
+???#?????????????. 6,7,1
+?.??.?#??????#???? 2,3,5
+???????.?????##???? 1,2,2,3,2
+##????#?.??.???? 5,1,1,1
+?.???.???? 2,2
+.#?#???..# 1,3,1
+??.?#???#????? 3,3
+.##????.??#.?? 3,1,2
+????.#??..???#?? 1,3,2,3
+???.?????? 3,1
+.?????##??# 2,7
+??????????? 1,3,1
+?.#??#?..##?. 1,2,2
+??#??.??.?.#?..? 2,2,2
+?????#?..#???##?? 4,7
+??.???#.???. 1,1,1,1
+??##??..???#???#. 5,1,3,1
+?.?#.????#?#?????? 1,11
+??#???..#???#???#? 1,1,1,1,3,1
+?.?#?.?.#???#???## 2,1,8
+##?.#??.?. 2,1,1
+#.?##.?.?# 1,3,2
+?.?##??????#?# 3,6
+#???..??.?. 1,1,1
+.?#.?.?.?.#? 1,1,1,1
+?#??????.?? 7,1
+#???#?#??# 3,3,1
+#??????####???????? 1,10,2
+????.??##????##..# 1,1,3,5,1
+#.##??#?#????#? 1,7,4
+????##??#?#?.?#. 7,4,2
+??#??..#??##?. 1,3,5
+??#.?????.? 3,1,1
+????????..????#??#? 6,1,4,3
+.????..????#???? 2,1,2,2
+.??##??#?. 1,6
+.#????.????#? 1,5
+??#?###????#????.? 8,3
+???.????..?.???.?. 3,1
+..?????.?##?#?? 1,5
+.?#??????.????#??. 7,5
+?.?.???????#??###??. 1,5,4
+????..????#??.? 1,3
+?####???????.? 5,3
+?????.#??.#? 1,3,1
+?.??.?###????? 1,6
+????..?#?#. 2,1,4
+##?.?????????#?? 3,10
+.?#??#?#??..?????? 2,1,3,2
+?#?#?.?.???## 4,1,5
+??..???????. 1,1
+...????.??.????.?. 1,2,4
+.#?????.???.??. 6,1,1,1
+##?.?.??.? 2,1,1
+??.#????#?# 1,1,5
+????#.?.?##.??. 3,1,1,3,1
+??..??##??????? 4,5
+???.#?????? 1,5,1
+??##..##..?????#??? 4,2,3,2,1
+?##???.?#??#?????#? 3,1,4,2,2
+???????.??? 6,1
+#?#???????#?#?? 1,7,1,1
+?????#???#?.??. 1,3,4
+..?#??.??##?#. 4,4
+?.????????#?#??.?#? 2,2,5,2
+???.?.???????? 1,1,1,1
+??..????.??????? 1,3,1,2
+?#?.?##????.??#???.? 1,4,6
+????.#????#?????.?? 1,1,2,5,1,1
+..?#.#?#?.?##??###? 1,1,2,8
+?#????????? 2,4
+?????#???? 1,1,2
+????.????... 1,1
+?????????#????? 5,8
+????..???.?..?#?. 1,1
+.?????????.#?? 2,1,2,3
+.??.??#?#????.?? 1,3,1,1,1
+?.??.???#??###?#?#?? 1,11
+?##????..??#????.?? 3,3
+?.?#???#???#??? 1,6
+??#?###??.???.? 6,1,1
+?#?##?##?.##?..? 5,2,3,1
+?????.?????. 3,2
+??????????#???? 1,8,1
+????.??#??. 1,5
+?.##???.??##??##?# 1,2,1,4,2,1
+??#???.??????#.#?? 1,1,1,5,1
+????####..?..? 8,1
+..?????????#?. 4,4
+?#????????? 1,1,4
+???????.????#??? 5,5
+#??.?#.?????..#?#??? 1,1,1,2,1,4
+##??#??#?.?????? 5,1,1,2
+.????##????##### 5,7
+?#.??#???#.??.? 2,7,1
+.????????##?..?? 2,2,1
+.??????#?????????.? 4,3,4,1,1
+??????#??.#?.???.??? 7,1,1,2
+?.#?#.?????##?#?#??? 1,1,1,1,1,7
+???????####?##?###. 1,15
+?????????#?.??#? 3,1,3,3
+##?????#???#?#?? 3,1,2,4,1
+.??.????.?#??#?#??# 2,1,2,4,1
+???#?????????#??. 3,8
+?.???#???#.????.???? 1,5,2,3,1,1
+???.??????#?? 1,2,5
+??#??#?#?????..?.??? 8,3,1,1,1
+???###??????? 7,2
+??????#..?..?.? 1,4,1,1,1
+????#??????? 1,2,2
+?????.?##?? 1,2
+??#?##????.??##???? 7,3
+?#???????.# 4,3,1
+.?????#?#?#????#?#?? 10,3
+.??#.???.? 2,1,1
+???..????.?#???#?##? 2,4,10
+??..??????.????.. 3,2
+?#???##??..????? 6,2
+???????##?? 1,2
+???#????##??# 1,3,6
+??.??#???????? 1,1,3,2
+???..?.?????.? 2,3
+.??.#??????..? 3,1
+?#???#??????#.?# 1,2,5,1
+??..#?#?.#?.#??????. 1,1,2,1,2,4
+??##????#.. 2,1,1
+??????????????.? 1,1,1,5
+??#.??.??#?#?????. 1,1,6,2
+.?.??..#??..? 2,3
+.????.???? 1,1
+#??..????##?.?#.# 2,7,1,1
+??.??.#.?.#???????# 1,1,4,3
+??#??#..?#????#???? 1,4,2,1,1,2
+???#???????# 9,1
+???#???#?#???#..##? 8,3,2
+?.##?##???#????#?#? 1,10,1,1,1
+?????#??#??##?.???? 6,1,4,1
+..###.???#? 3,3
+??.??.#?#?##?# 2,1,8
+??.#????#????.???#? 1,1,3,1,1,1
+??.?????#?#?????#?? 2,1,12
+??#.????#??##???#??? 1,13,1
+##??????.#??????? 6,7
+??????##?#?#?#?.??#? 1,10,1,2
+?.??#?#.??????#?# 1,3,1,2,4
+????????##. 2,1,3
+.?????.?#???#? 3,1,2
+????.#?#.?? 2,3
+??????#????##?????? 13,1,1
+?.???????.?? 3,2
+..?#?.#???? 2,1,1
+??.?????.??#?#??##?? 1,3,11
+?#????????#? 2,3,1
+????#?.?.###?? 4,1,5
+?.?#????????.?## 1,7,2
+.??.??????.???.. 1,3,1,1,1
+##.?#?#?#???? 2,7,1
+?#?.????#...??? 2,5,1
+.????.#.#?#?# 1,1,5
+.?.##?#??? 1,2,3
+##????#?????????#?#? 3,1,1,1,6
+.?????????.?? 2,4,1
+#????..?#?.?#.????#? 1,1,1,2,1,5
+??#??#??..# 7,1
+?###?.??..? 4,1,1
+??.??????#?#?#??..? 1,8
+???.?????? 2,4,1
+??????#??#??? 1,2,1,1
+??.?#??.?#???? 1,3,4
+#??????????? 6,1,1
+??#?.#?#.#??#???? 1,1,1,1,8
+?..???#.???##??#?. 3,7
+?...??????#?#?. 2,4
+????.??.?. 4,1
+#.??##??###?.?###. 1,1,8,4
+????.?..?#.??????? 3,1,1,1,3
+#.???.????#?.?.?.?# 1,2,1,3,1,2
+????.?.#???.???# 2,1,4,1,1
+???#??????????? 2,5
+??#?#???.#????? 4,1,1,2
+???#??.????.??? 5,1,2,1
+.????????#.???#?? 1,7,6
+?.??..??#?# 2,3
+#?????.##??.?????#? 4,1,4,1,1
+?#?#####?##???#????? 11,1,1,1
+???.##???#?. 2,6
+?????#?##??.?.????#. 9,5
+?####??..#???.? 6,2
+?##??#?.###?#??.??. 6,7,1
+?#.??.?.?#??# 1,1,1,4
+#?#?#???..?? 7,1
+??#?#??????? 5,1,1,1
+.?##?#?????..???.??? 10,3,1,1
+...?#??..??.????? 3,2
+??.????.??? 3,3
+#??#??#?#.??.#. 1,6,1,1
+?.??????..???#?.?.. 1,2
+.??.#?.?##?#??#???? 2,8,1
+?##?#???????##?? 2,1,3,3
+?#?.?????###?#????? 1,2,1,5,1
+?#??###????.##.? 2,7,2,1
+#??????..#???# 3,1,2,1
+??#.?????#..#???? 3,1,1,5
+??????#????. 8,1
+??????.#??. 6,1,1
+??#??.#??#??. 5,1,2,1
+?#???#?????. 5,1
+###?????.#?? 5,1,2
+..?????#.? 1,1,1
+?????...#??? 3,1,1
+????.????? 3,1
+.?#??#??.???? 2,2,2
+#??.??.??#.????.?? 3,1,1,1,4,1
+????#?????? 1,6
+?#??##????#??. 1,8
+????#.?.??.??##??# 1,1,2,6
+?????.?.????###?##? 1,1,1,1,1,7
+.??..#.??.?#? 1,1,2,2
+?##??#?.#????. 6,1,1,1
+??????.?#? 6,1
+.#??#???#??????# 2,1,1,2,1
+##?#??####.???#?#??. 10,6
+??.???????.???#. 1,2,3,1,1
+??#?????#?#????????? 5,9
+?##?#???#?.#?????? 3,1,1,1,1,2
+?#???#?#??#?#???.#?? 12,2,3
+.??#??#?.?#????.#??? 5,3,1
+?##??.?#??. 4,3
+?.##?##?.?????#?? 1,5,2,5
+.?..?#.?.? 1,1,1
+.#????#?????#??? 2,6,4
+..#???????.? 3,4
+?###??#????..?.? 7,2,1,1
+?#??????.#?????..?. 7,5,1
+?.#?#??.#??.#.??? 1,5,1,1,2
+.??#?#??##?#?.?#?? 12,1
+????##????##?????.#? 12,2
+#?????##??.?.#?? 1,1,4,1,1
+.#?#????.???? 4,1
+??.?.??.??????##? 1,1,1,1,5
+.?.#?????##???? 1,1,1,3,1
+#???.????# 1,1,4
+?????#?.???#??????? 5,9
+??#.?.??#???? 1,4,1
+?????#??.. 2,3
+??##???????#.??#???? 3,6,2
+?.?.????????? 1,7
+.??#..?.?#. 2,1,2
+????????#??#??.??#?? 4,8,3
+??.?????#??#????. 1,2,9
+?????#??.???.? 5,1
+?.?#??#??.????? 1,1,4,5
+????.??????# 1,4,1
+#?.??#?????##????#?# 2,2,8,3
+.?#????.##.???#?#? 2,2,1,4
+?.??#?#???#..??#.?# 1,3,5,3,2
+?##.???##??. 2,1,5
+?.??...?????.?. 1,3,1,1
+????#???##. 2,3,2
+????????.#?#?? 1,1,4
+??.????#???? 1,1,1,1
+?#?#?##??#?.?##. 10,3
+???#?.??#???????.? 3,10
+?.##????.#?.?#?? 6,1,3
+???#.??#?#? 1,1,4
+.#??????..?#??####?? 4,1,2,6
+???????#?..? 4,4
+.##?????.?.. 4,1
+??#??.???????.???? 1,3,1,2,1,2
+????#?.?????? 1,1
+??#?#?.?#??.?.?? 5,3,1
+.?#??#?#?.???###???. 2,4,9
+#?????.???.#?.##?# 1,1,2,1,1,4
+?#???.?#?.?#.?? 4,2,1,1
+????.???#?#?##??? 3,9
+.?????.?##??? 2,1,6
+?.#?????.?????? 6,5
+????...???.?? 2,2
+?.??.??.#?#??????#?? 1,1,1,1,2,7
+??.??#?#????. 1,5
+??#?#???.?#??? 2,1,1,4
+#?.??.##?????? 1,1,2,5
+.??#??##??? 1,6,1
+.???##??.??#?. 6,1
+????#?#?#?.??#?? 9,4
+??#??????#?????.# 2,2,3,1,1
+#?????????#?####?. 8,8
+???????.?.#??? 1,4,1,4
+.???#?.???#?#?#?. 3,8
+??.#??.??##??#?#?# 1,3,1,7,1
+#.#??#??#???? 1,1,1,4
+??..#???.??? 2,3,1
+?#?..????? 1,4
+????#??####??..? 1,9,1
+#???????##?? 2,2,5
+.?.????#??.????##?. 1,2,4,6
+?#..#.???#. 1,1,3
+?.?#????#??...?###? 8,4
+??.????##????##????. 1,1,1,8,1
+??..?#??????#???? 1,4,2,5
+#?????????..??#.?? 2,1,4,3,1
+.#.??.?.#????.?.??#? 1,2,3,1,1,2
+??#?##?.#?#?? 5,1,1,1
+??#???.?#???? 5,2,1
+?????.?##..? 3,2
+??.?.?#???? 1,1,2
+#???#?????????? 1,1,1,1,4
+??#?.##???..??????? 1,4,4
+???????#?.?.#???? 1,1,2,4
+.?.?##??#.#?? 1,3,1,1
+???????#.#??#.?#? 1,6,1,1,3
+??.???#?#.? 1,3,1
+????????...??????? 4,2
+?#??.??#?#? 2,5
+???.##??????. 1,3,1
+????#?.?.?? 5,1,1
+#??#.?#??#..?? 4,1,1,1
+???.?#..?# 1,1,2
+.#??????.????????## 6,6,2
+????????.??????#? 7,1,2,2
+???#????#???#??? 3,2,4
+?...????#.??. 1,1,1,2
+.?????.????#. 2,3
+????..?????? 1,1,1,1
+?#####??.?.#??? 5,1,1
+.?#?.??...??# 2,1,3
+??###?#??. 3,3
+????.#??????#??# 1,1,1,1,6
+.??#?###?#?#?? 1,7,1
+??#.???#.##.?? 1,1,2,2
+??#?.????.? 3,1,1
+????????##?????#? 1,3,2,2,1
+?#????#?#??.##? 7,1,2
+?.#?????#.??# 1,2,4,2
+?????.#???????.?? 5,1
+????#?##.???#? 7,4
+?#??????#?#???#??? 5,6,1,1
+?#?#??????.?#. 6,1,1
+.?###????????#?#??.? 4,9
+?#?#?.?#?#??#?? 3,7
+??#???.?????. 1,1,1,5
+?.##?..????.?.??# 3,1,1,1,1
+.#?????#???? 7,2
+.??.???##????#?.??. 1,1,8,2
+#?.?##????##?. 1,2,4
+#?#..?.??###???.? 1,1,1,5,1
+??#?#??????#??#???# 11,5
+????????????#? 1,1,5
+????#?#?.#???#. 1,6,1,1,1
+?#?#?##????#?..?#?? 12,4
+??????#.???.???.? 1,3,2,2
+?.?#???#?.?.?#??# 7,1,1,2
+#?#.?#?.?#?##???.? 3,3,6,1
+???.??##?.?. 1,4,1
+??..?#??????. 2,2,3
+???.?????# 3,2,1
+?#?#??#?.?.#?#?????? 5,2,9
+?.?#.??#?.?#??##??? 1,1,1,1,2,6
+#????#?#???????????? 8,1,1,1,1
+??????#?#?? 2,2,2
+???#??#.????..#?. 5,1,1,1,2
+??#?????????.#? 4,1,1,1,1
+?#..??##??#???. 1,10
+.?#????#?. 2,1,1
+?.????.##?#??.#? 2,6,1
+?##??#?..#??#????# 2,1,9
+?????..????##????? 4,7,1
+?.##??..???.?#. 1,2,1,3,1
+?#????#?#???? 2,1,3,1
+??##???.?# 4,2
+.?????.?.?.#? 3,1,1,1
+.#?##???.??####??#? 7,8
+??????#???.?#?..## 7,3,2
+?#???#?.??#?#? 3,1,5
+???#?.???..??? 4,3
+...?.?????? 2,1
+.#?.??#??#???#???##? 1,16
+?????#?????.???.??? 5,1
+#?.?..?#?#??? 2,1,6
+???#?????.???? 8,1
+.???#?????????.#?.? 10,2,2,1
+#?#?..##?????????? 4,3,1,2,1,1
+???#?###.???? 1,1,3,2
+????#???#??#?? 5,5
+?.????#????##? 1,6,4
+??????##????..???#?? 7,5
+#????????????? 1,8,1
+.????.??????#??? 2,1,2,5,1
+???#???..?#?? 3,4
+##???#???# 4,1,2
+??????#???????..???? 1,5,5,1
+.???????#. 1,1,1
+?..?#?#??#??. 1,6
+#?#????##?##??#..??? 4,1,8,2
+.?????????###?##??? 1,14,1
+????????#?.???.??.. 10,1,1
+????????#?????.# 1,8,1,1
+?.#?###?????#?????# 5,1,2,1,1,1
+????????#?? 1,2,2
+.#..??#??.?.# 1,5,1
+???.??????#.??..# 1,1,5,1,1
+?#.?????.???#?#????# 2,1,2,6,3
+.?#??.??.???#.?#.?? 3,2,1,1,2,1
+???#?#????.??? 6,2,1,1
+?????##???.??#? 1,2,2,1,4
+#???????#????? 1,1,6,1
+.#???###????????.? 2,3,1,2,1
+???????????????? 1,3,1,1,3
+..#???#?????#?. 1,3,1,2
+#?.?????##?. 1,6
+????.#???#?????. 3,1,3,1,1
+.#???.?#..#???# 2,1,1,3
+??.?###?????.. 1,7
+?#?.??#.????## 2,2,1,3
+?????.##??.. 1,1,3
+????####??#????? 13,1
+?.??##??.?.??#???? 6,6
+????#.??##??. 3,5
+???#??????????#??. 4,11
+????..#?#?.??#??# 2,3,1,2,1
+?#?????.?#??????.. 6,8
+??..#.??????#? 1,1,1,4
+.?#?????.???????? 5,6
+??.????????.#? 2,1,1
+??????##?? 3,4
+??????????? 8,1
+?#??.?.?###??##?? 1,1,8
+?????#?#?????????.?? 2,9,3
+...#???.???.. 2,1,2
+#??.#?#??..??????.. 2,1,2,6
+?.?#??.?#? 4,2
+?#?????..? 1,2,1
+#?.#?.??#??.? 2,1,3,1
+????.#.#??????#?## 2,1,1,3,6
diff --git a/src/bin/2023/day12.rs b/src/bin/2023/day12.rs
new file mode 100644
index 0000000..adb152a
--- /dev/null
+++ b/src/bin/2023/day12.rs
@@ -0,0 +1,188 @@
+#![allow(dead_code)]
+#![allow(unused_variables)]
+
+use advent_of_code::prelude::*;
+
+#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)]
+pub enum Condition {
+ Good,
+ Bad,
+ Unknown,
+}
+
+impl TryFrom<char> for Condition {
+ type Error = anyhow::Error;
+
+ fn try_from(value: char) -> std::result::Result<Self, Self::Error> {
+ Ok(match value {
+ '.' => Condition::Good,
+ '#' => Condition::Bad,
+ '?' => Condition::Unknown,
+ _ => bail!("unknown condition {value}"),
+ })
+ }
+}
+
+pub struct Record {
+ condition: Vec<Condition>,
+ lengths: Vec<usize>,
+}
+
+impl Record {
+ fn arrangements(&self) -> usize {
+ arrangements(&self.condition, &self.lengths)
+ }
+
+ fn unfold(self) -> Self {
+ let mut condition = vec![];
+ condition.extend_from_slice(&self.condition);
+ for _ in 0..4 {
+ condition.push(Condition::Unknown);
+ condition.extend_from_slice(&self.condition);
+ }
+ Self {
+ condition,
+ lengths: self.lengths.repeat(5),
+ }
+ }
+}
+
+fn arrangements(conditions: &[Condition], chunks: &[usize]) -> usize {
+ let mut memo = HashMap::new();
+ arrangements_memo(conditions, chunks, &mut memo)
+}
+
+fn arrangements_memo<'a, 'b>(
+ conditions: &'a [Condition],
+ chunks: &'b [usize],
+ memo: &mut HashMap<(&'a [Condition], &'b [usize]), usize>,
+) -> usize {
+ if let Some(count) = memo.get(&(conditions, chunks)) {
+ return *count;
+ }
+ let count = _arrangements(conditions, chunks, memo);
+ memo.insert((conditions, chunks), count);
+ count
+}
+
+fn _arrangements<'a, 'b>(
+ conditions: &'a [Condition],
+ chunks: &'b [usize],
+ memo: &mut HashMap<(&'a [Condition], &'b [usize]), usize>,
+) -> usize {
+ let good_prefix = conditions
+ .iter()
+ .copied()
+ .take_while(|condition| *condition == Condition::Good)
+ .count();
+ if good_prefix > 0 {
+ return arrangements_memo(&conditions[good_prefix..], chunks, memo);
+ }
+
+ if conditions.is_empty() {
+ if chunks.is_empty() {
+ return 1;
+ } else {
+ return 0;
+ }
+ } else if chunks.is_empty() {
+ if conditions.contains(&Condition::Bad) {
+ return 0;
+ } else {
+ return 1;
+ }
+ } else if chunks.iter().sum::<usize>() + chunks.len() - 1
+ > conditions.len()
+ {
+ return 0;
+ }
+
+ let next = conditions
+ .iter()
+ .copied()
+ .take_while(|condition| *condition != Condition::Good)
+ .take(chunks[0])
+ .count();
+ if next < chunks[0] {
+ if conditions
+ .iter()
+ .copied()
+ .take(next)
+ .all(|condition| condition == Condition::Unknown)
+ {
+ return arrangements_memo(&conditions[next..], chunks, memo);
+ } else {
+ return 0;
+ }
+ }
+
+ let mut total = 0;
+ if conditions[0] == Condition::Unknown {
+ total += arrangements_memo(&conditions[1..], chunks, memo);
+ }
+ if next == conditions.len() || conditions[next] != Condition::Bad {
+ total += arrangements_memo(
+ &conditions[(next + 1).min(conditions.len())..],
+ &chunks[1..],
+ memo,
+ );
+ }
+
+ total
+}
+
+impl std::str::FromStr for Record {
+ type Err = anyhow::Error;
+
+ fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
+ let mut parts = s.split_whitespace();
+ Ok(Record {
+ condition: parts
+ .next()
+ .unwrap()
+ .chars()
+ .map(|c| c.try_into().unwrap())
+ .collect(),
+ lengths: parts
+ .next()
+ .unwrap()
+ .split(',')
+ .map(|s| s.parse().unwrap())
+ .collect(),
+ })
+ }
+}
+
+pub fn parse(fh: File) -> Result<Vec<Record>> {
+ Ok(parse::lines(fh).collect())
+}
+
+pub fn part1(records: Vec<Record>) -> Result<i64> {
+ Ok(records
+ .into_iter()
+ .map(|record| record.arrangements())
+ .sum::<usize>()
+ .try_into()
+ .unwrap())
+}
+
+pub fn part2(records: Vec<Record>) -> Result<i64> {
+ Ok(records
+ .into_iter()
+ .map(|record| record.unfold().arrangements())
+ .sum::<usize>()
+ .try_into()
+ .unwrap())
+}
+
+#[test]
+fn test() {
+ assert_eq!(
+ part1(parse(parse::data(2023, 12).unwrap()).unwrap()).unwrap(),
+ 7407
+ );
+ assert_eq!(
+ part2(parse(parse::data(2023, 12).unwrap()).unwrap()).unwrap(),
+ 30568243604962
+ );
+}
diff --git a/src/bin/2023/main.rs b/src/bin/2023/main.rs
index 44c0ff0..591fdc8 100644
--- a/src/bin/2023/main.rs
+++ b/src/bin/2023/main.rs
@@ -22,6 +22,7 @@ mod day8;
mod day9;
mod day10;
mod day11;
+mod day12;
// NEXT MOD
#[paw::main]
@@ -39,6 +40,7 @@ fn main(opt: Opt) -> Result<()> {
9 => advent_of_code::day!(2023, opt.day, opt.puzzle, day9),
10 => advent_of_code::day!(2023, opt.day, opt.puzzle, day10),
11 => advent_of_code::day!(2023, opt.day, opt.puzzle, day11),
+ 12 => advent_of_code::day!(2023, opt.day, opt.puzzle, day12),
// NEXT PART
_ => panic!("unknown day {}", opt.day),
}