aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandre Jesus <adbjesus@gmail.com>2024-01-03 00:35:18 +0000
committerAlexandre Jesus <adbjesus@gmail.com>2024-01-03 00:35:18 +0000
commitcaf416319e8807e0648b3e8ad12fdbfa813f669a (patch)
treea387fa198117833e00c9e94d6c92c32cb3b55307
parent81798f0ec7a09106bc81a11dd59b908866e5fe09 (diff)
downloadaoc2023-caf416319e8807e0648b3e8ad12fdbfa813f669a.tar.gz
aoc2023-caf416319e8807e0648b3e8ad12fdbfa813f669a.zip
day12
-rw-r--r--data/12/example.txt6
-rw-r--r--data/12/input.txt1000
-rw-r--r--day12.lisp70
3 files changed, 1076 insertions, 0 deletions
diff --git a/data/12/example.txt b/data/12/example.txt
new file mode 100644
index 0000000..e925935
--- /dev/null
+++ b/data/12/example.txt
@@ -0,0 +1,6 @@
+???.### 1,1,3
+.??..??...?##. 1,1,3
+?#?#?#?#?#?#?#? 1,3,1,6
+????.#...#... 4,1,1
+????.######..#####. 1,6,5
+?###???????? 3,2,1
diff --git a/data/12/input.txt b/data/12/input.txt
new file mode 100644
index 0000000..6336d44
--- /dev/null
+++ b/data/12/input.txt
@@ -0,0 +1,1000 @@
+#???#?#?.?##?#?.#. 7,5,1
+??#?#?#????.????#? 6,2,1,1
+.#????????.??? 5,1,1,1
+?#.??.??????? 1,1,1,2
+#.???#?##.??.????. 1,1,1,2,2,1
+?????????.??? 7,1
+?#?.?#????# 1,2,3
+.????..??#?. 3,2
+???..?#?.##???##.?#? 2,2,3,2,2
+??#?.#..???? 3,1,2
+??##?#???????? 5,1,1
+#????????#??#?? 1,10
+.?????????? 4,1
+.??#?##???#???## 6,1,1,4
+?#?#?.?#??.??????#? 4,1,4,2
+?##?#??#???? 7,1
+##???.?????. 2,1,1,1
+.???....??#?. 1,4
+??#.#??.#.??#??? 1,2,1,5
+.???##?#?#???.#. 1,8,1
+?.??#?..#?.?? 1,2,1,1
+..??#????????##? 5,4
+?#?#???#?#? 4,1,2
+??#??????## 3,2,2
+.??##??????#?????? 3,5
+?##.?.????????.?.?#. 2,1,1,4,1,2
+.?#?#?.???? 4,4
+???.??#??????##? 3,4,6
+????#??????#? 3,1
+##?????#?#???.?. 11,1,1
+#?#??.???#?#??.?#??? 1,2,1,3,1,5
+???#??#?????????? 1,1,1,8
+#???#??.#??? 1,1,1,4
+?????.?.?? 1,2,1
+#??#?#?????????#. 6,1,1,3
+????.#?.?#.. 1,2,1
+???????.#.### 1,3,1,3
+???#??.??#? 5,1
+#?.?##?#??#??? 1,7,2
+??????#.?????.?. 5,1,2,1
+??#????????????# 1,2,1,2,1
+????#?#?????#? 1,4,2,2
+.##?.??#?#. 2,1,1
+?.###.???# 3,1
+?#.?????#??.??? 1,8,1
+?##?.??#???? 4,5
+?#?.??.?#??. 1,2,3
+?#????.?#???????#?? 2,1,4,1,1,3
+.??##???????#?.??? 12,1
+?#??.????.#??#..? 4,1,1,1,1
+?????????#?#?.# 2,1,2,1,1
+#??#??#.?#?#???? 5,1,4,2
+?####???????..?. 11,1
+????#?#??#. 2,3,2
+???????#??????#?? 3,7,2
+?????##?##.???? 10,2
+???????#????#?#?#### 1,1,1,1,10
+???????.??#???#? 2,1,1,1,3
+???#.?#??????. 1,6
+??##?##??????????.?? 14,1
+?#?##????#?.? 4,2
+?????.#?#?. 2,4
+..???#??.??????.? 4,2
+#??##??#?.#.?..# 1,5,1,1,1
+?#..???????.?## 2,1,1,3,3
+#?.????#?##? 1,7
+.??.?##????##?????? 2,5
+??????.###?##??? 3,7
+????#??????#?.???? 1,11,1,1
+?#?#?###?##???#.???. 12,1,1
+.#????#?.??????? 1,1,3,2,1
+.?#???#####??.#???? 10,1,1,1
+??#?.#.?#??#??# 1,1,1,5,1
+#??#?????? 1,4,2
+????.??.??##?#?.?#? 1,2,1,4,2,1
+?.???.??.? 3,1
+???##????.???.?? 1,3,1,1,2
+??.??#????.?.??# 2,1,2,1,3
+.??????#?. 1,2
+?..?????#????? 8,1
+.??#????????????.? 6,5
+??#?.????#? 2,2,1
+??#??.#?.??? 1,1,1,1
+??#??#??###??? 4,7
+??.??#????#?#?.. 8,1
+?..???????.?#??? 1,1,2,5
+???????.??.#??? 4,1,2,1,1
+????????#??.#? 7,1
+??#.?????? 2,2
+??#????.???## 2,1,5
+??.??#?#.##?? 2,4,2
+.???.####?#?? 1,7
+?.#?????#????## 1,1,10
+?#??.###?###???..#? 3,8,1,1
+#.?##?????#?##?? 1,4,6
+?#.?###???#?#????#? 1,11,1
+?##?#????.???. 9,3
+???#???????#.?.? 1,1,1,3,1
+??????.????#????## 3,1,1,4,1,2
+.?#?#?.#???#? 1,1,2,2
+?.???.?#?#?????????# 1,1,1,5,1,1
+??#.??????? 1,2,3
+#?#??.??.?.??#?#?? 3,1,1,6
+.?#??#?#??????#?# 5,4,5
+.#????##???? 7,1
+???##???.?#?.?? 8,2
+?#???????.?# 4,1,1
+#?#?????.??#???? 1,1,1,1,6
+?#??#?????? 4,1
+?????#???????#.#? 1,9,1,1
+#????.???#???#?#???# 1,1,9,1
+??.#??#.?? 1,4
+.????.?.??.?.?.#??#? 2,1,1,1,1
+?????.?##. 2,3
+?.#???##??? 1,4
+.#??#???#?? 1,7
+?????#?.?.??#???.?.? 6,4
+????.?#.?#????? 2,1,3,1
+??##?#????#??? 6,3
+??????.?#.?.?.?? 1,3,1,1,1
+.#??.#?#.. 3,1,1
+#?.?#???.????? 1,2,1,2
+.??.?.?.?? 1,1,1
+??????#??#??..?.? 6,1
+?????.??...#?#??#? 2,6
+??..???..??.???#???? 2,6
+?.????#?????..???? 1,7,1
+.?####??#?#??.?#.. 10,2
+?.??##.?#? 1,4,2
+?#?.??.?????.?. 3,1
+?#???###???. 2,4,1
+#????#???.#??##???.? 2,5,5,1,1
+.??#??????#? 3,3,2
+??#.##?#?#? 2,7
+?#?.?.???? 2,1,2
+??#??.##??????? 1,5,1
+?#..??#??#?#?#?..#?? 1,1,9,1
+?#??.?????#?#? 3,1,5
+??.???#????#..?? 1,9
+???????#####?.??. 2,2,6,2
+????#???????.? 2,1,1,1
+????????#.?#. 1,1,1,2
+???.????###?####???? 2,2,8,1
+???.#..??#??###? 1,1,1,7
+?#???..?.??. 4,1,1
+?#?..?????##?#???.?# 2,1,9,1
+?.????.?????? 2,3
+??#?????????##. 1,5,5
+???..??.?.?? 2,1,1,1
+#.?#?.#?##???? 1,1,5,1
+?#????##.?.???.#??# 5,2,1,2,1,1
+?.#.?..?.? 1,1
+?#??#?????##?? 2,1,6,1
+.#???.?????.. 4,4
+.?##??#?#???? 3,2,1,1
+#.#.?###???.#?#.?. 1,1,6,1,1,1
+???#.##?#????#.?# 2,1,4,4,1
+?#???#????.????#?#.? 1,4,1,2,3,1
+#??????#??#?.??.##.? 12,2
+???#?????.?##??#??? 5,7
+.???##????????.#?. 7,4,2
+#??.?????.???.?? 2,3,1,1,1
+????.??#???? 2,5
+?????#??.#.???? 1,2,2,1,4
+???#?.???????#? 4,1,3
+??.???#???.?#??.? 1,5,1,1
+...?##?????.?#???. 3,2
+.??##??????#?. 5,3,2
+.??##?????????? 3,4,1
+#???????.?? 1,4,1
+#.???##????.??#??? 1,1,7,1,1,1
+???????.#?# 1,3,3
+??.?#?#?#.?? 2,1,1,1
+????#???##?#?? 4,7
+?.##??.?###?#?#? 4,9
+????#????#??????# 1,2,8,1
+????..???? 2,2
+???#?###?.?? 7,1
+?#?.??.????# 2,1,2
+.??###?#.?.???? 5,1,1,1,1
+?#.???????## 1,1,7
+#??.??#???#?.?? 2,2,1,2,2
+???.???#???????# 2,4,1,2
+#?#..?.???????##. 1,1,1,1,6
+???.???..? 2,3
+.??..???????.??#??.? 6,4
+.?#????????#?.?? 1,5
+??#??????##?#?#?#.? 3,1,9
+?.??#???????#?# 2,9
+?????????? 1,7
+??##..?.?#??#?#???? 3,1,1,2,1,2
+??????.#??? 3,1
+#?.??#??#???.??.?#. 2,8,1
+??.????#.????#??#? 2,8
+???#?#????#?.????? 1,7,2,1,1
+????.?.??.??#??. 1,1,2,4
+????#?.??? 3,2
+..??#?##??.??? 6,1,1,1
+??????.????##.?? 3,6
+?##?????????#?#?? 4,2,6
+??.?#?????????? 2,1
+?.???.??.?????#??? 1,2,1,7
+.????#????.???#??# 1,7,2,2,1
+????.?#?#. 2,1,4
+.??.????..??#?#????? 2,7
+?.?##?###??#????# 11,2
+?#???#?#?????????#? 8,3,1,2
+?????.?????##??????? 1,2,7,1
+???#????#?.??? 5,1,1,1
+?.?????.???##??# 5,2,2,2
+?###?????.??????#. 9,1,1,1,1
+.???????..##? 5,3
+?#??????#..? 1,6
+??.#??????.?. 1,1,5,1
+.?????.?#??? 1,1,1,1
+?#???????????? 1,1,9
+#?##???#????????? 1,2,3,1,2
+#?.?##????##??# 1,11
+?.????.?#????#??? 1,2,8,1
+?#.???#??# 1,2,2
+.??.????????#??#.? 1,1,2,1,4,1
+????.?#.????#.?. 1,1,3
+.#?#?.?#??? 4,3,1
+?.?????#?? 1,2,2
+?????.??????#?? 3,9
+???#?#?##??##????.? 7,7
+##?#.???.?. 4,2,1
+??#??##??#? 1,1,6
+##??????#??????#??.# 3,3,4,3,1
+??.?#??.#?????????? 4,2,1,2
+.?#??##??.?# 1,5,1
+??.??#???#???.?.??? 1,7,1,1,2
+??.#.?..#?.?#??????? 1,1,1,2,1,4
+.#????###?#?.#?.??# 2,8,1,3
+.##??#?????.?# 3,3,1,1
+##???#???????.? 10,1,1
+??????#??.#?..# 7,2,1
+#?..??#??????#?#??? 2,15
+???????.?#? 1,1,3
+.?.?#..?#?##? 1,5
+?#??#?.??#???#.????? 1,1,4,2,1,2
+???.?#?????# 1,1,3,1
+??.????##??.??? 2,3
+????.????#??#?#? 2,1,7
+#??#????.???#.?? 1,3,1,1,1
+?#????????# 3,2,1
+.???.?#?.#?.?#. 3,1,2,1
+?#??#????. 2,2,2
+??.????????#. 1,5,3
+.??????????.. 2,4
+???.???..#??. 2,2,3
+.#????##??# 1,6,1
+##???#???????? 2,4,2,2
+??????#??##?. 6,4
+.?#?##.???#??? 4,2
+#.#.#???#..?##? 1,1,1,3,4
+?#??..????#? 1,1,2,2
+??##????#?##???????# 2,11,2
+.?#??.?..?. 3,1
+??#???????#?..?.# 1,1,8,1,1
+#???##??#?#??.?.? 1,10,1,1
+?#??.???.???? 2,1,1,2
+???????#??#..???? 6,1,2,1
+??????.#?#?##??.#? 1,1,7,1
+????#???#?#???#??. 1,1,13
+.?????????#?? 1,6
+??.?#?.?## 2,2
+..?.??##?... 1,3
+?.#??.????. 3,3
+.?###????#?.????? 9,1
+????.###.?? 1,3
+.#??????.#?? 5,1
+????.?.???.. 2,1,2
+?.#????.?#... 4,1
+???#??###? 1,1,4
+???####?.?? 1,5,2
+?.??###?###??#?..#? 5,3,3,2
+..?#.????. 2,2
+???..??#???? 1,3,1,1
+??.???#?.?.????#.?? 5,4
+.???????#?##????#?? 1,12
+?#?.?##???.?#???? 3,3,3
+#?##?#?#?#??.?#.?? 1,6,3,2,1
+?####?.?.#??????#?? 5,8
+..???????##??.???#?. 11,1,1
+??.?##??..????#? 1,3,1,1,3
+#???#?...# 1,2,1
+#????????. 3,4
+?.??.??.##??? 2,4
+???.?.##?# 1,4
+??????#?#?. 1,4
+????????.#?#?..?#??? 6,4,5
+??.???#??#???#?? 1,9,1,1
+?#?#????.?#?##. 6,4
+??#?#?.????#???? 2,2,6,1
+?.?.?????#?????#.?? 1,1,1,5,1,1
+????.?????????????? 2,1,2,1,1,4
+??.?.???.. 1,1,1
+.#?.?#???.#?.??? 2,3,1,1
+?.??#??#????.??.?? 1,10,1,1
+.#.?#???#??.??#??#?? 1,2,1,1,1,3
+?.?#???#?? 1,1,4
+????#??#.?#?????##?? 5,2,7
+?????#?.???#?????? 6,4,1
+?.?????.???#????. 1,5
+????#????? 3,1
+?#.#????#..#?##??#?? 1,6,7,1
+?#??#?.??????? 5,1,2,1
+??#.?????????#??#.?? 1,1,10,2
+?????????.#?..???? 3,1,3
+.???..??.??? 1,1,2,1
+#??#???.#??.??##?? 4,3,4
+#.##??????#???#???? 1,5,7,1
+?#??.??.?.?#? 3,1,1,1
+#?????#####???? 1,2,9
+??#???#?.#???#?????? 3,2,6,3
+#????##?.?##???? 1,1,4,3
+??..#.#??#. 1,1,4
+.?.?##?????????????? 1,8,4
+?##???????#?##?#. 4,1,6,1
+?#?#????#?##? 8,2
+????##????# 4,1,1
+????##..?#??????.??? 3,4,2,1
+???#?#.?????#?#?.? 4,1,1,4,1
+.#?#?????.??#?#??. 7,1,1,1
+?.????????.#.?.???? 8,1,1,1
+?????????##??? 1,7
+???.#??#???#?????? 1,8,3
+?#???????????????? 9,1,1
+?##?????????.???? 4,1,1,1,1
+??????#?#?## 1,1,1,4
+?????.#?#??#.?#? 5,6,2
+?#?#.?.??# 3,3
+????#???.?#?? 3,3
+.????#????#.?????. 6,2,1,1
+???.?#???.??.?. 1,4
+???#?.???.#??.?? 4,1,1,2
+??????#?.?.?#?#???? 4,5
+.?????????.#??#??. 1,1,2,1,2,1
+?#????#???#???????# 8,1,1,3
+??..#???#?????????? 1,3,9,1
+??#.???????? 1,1,1,2
+?????..??##?#???? 2,1,5,1
+???#?#???##??#? 1,1,1,4,1
+??#?.????? 4,1
+????.????????#?. 1,9
+?.??##???.??..???.?? 7,1,2,2
+.??.??????? 1,1,2
+??????#?#?? 8,1
+.??????##????? 2,5
+?#?.????.?? 2,1
+???#???#?? 4,2
+.???.?..###??####??? 1,1,10
+?#?????????? 4,2
+.??#?.??##? 2,3
+??####??.??????. 5,2
+?.?##?.?.???#? 1,3,5
+#?????.?##??.?? 1,4,3,1,1
+..?#??#?.????? 4,1
+?#????#?.?#?### 1,1,6
+??#..#??.? 2,3
+?#???##.??#???.# 6,5,1
+??#????#?? 3,1
+.??.????#????##??? 1,1,2,7
+????.#??.?.? 1,1,1,1
+.#?##?.???.?#????#?? 1,3,3,2,2
+..#..??#??.?##. 1,5,2
+?#.???????????.? 1,1,1,4,1
+.?##?????#?? 3,6
+??..????#.? 1,2,1
+????#??#?? 1,2,1
+???##??##.? 1,2,2
+??????#????.?? 1,3,2
+??.?????.??.. 2,3,1
+?..#?????????.???? 5,2,1
+#.?????#???#?????? 1,5,1,1,1
+?????#?.?.#??? 6,3
+????.#?.?.?.?###? 1,1,1,1,3
+????.?#???.??.???# 1,1,1,1,1,4
+.#???.????#??##????? 2,1,10
+?.?????#??? 1,6
+#??.?#..#???#?? 1,2,1,1,1
+???#.?????????##. 4,11
+???#.???#???.?.??? 4,2,1,1,2
+??#????#??????#??? 6,1,2,2
+?.#?#??????? 4,5
+.#.?.????? 1,1,1
+?##??#?????????..??? 3,7,1,1
+????????.?###??#???? 3,3,11
+??###??.??? 5,3
+????.???????##?#? 1,1,4,3,2
+??#.???.????? 1,1,2,1
+??#?????#.? 3,2
+??#??#???#????....?? 14,2
+???##??????##?#. 6,3,1
+..???????.??# 4,3
+??#?.?.?..???#? 1,2,1,3
+..?.????#?.? 1,1,1,2
+?????#?????????#? 2,2,7
+?#????.#??#? 2,1,2,1
+?#?#????.?..??#?#?? 6,6
+.??##.????.?#??#?#? 4,3,8
+?.#??.?.?. 1,1,1
+??#?.??????? 3,6
+.#?#?..???###????# 4,11
+???#.??#.#???# 3,3,1,1
+??????#?????? 1,1,8
+#..?????.?##?#??? 1,5,5
+##????.??.? 5,2
+??##.???????#? 1,2,2,4
+?#??.?.??#?. 2,1,1
+?????.??#?#????#??. 4,11
+??????...??.?#?? 2,1,3
+..?##?????????. 3,4
+.#??#???..#??.#?.?. 4,3,2,1
+??#???#????#?#?????? 1,1,5,3,1,1
+#??.???#.#????????? 1,1,1,6,1
+????##?????#???#.? 5,8
+??#???#?#???# 2,7
+??????#?#??? 3,1,1,1
+??????.#??##?.????? 2,2,5,2,1
+??#?#???#?#??#???.. 10,3
+????##??##.????.? 8,1
+.?#.??#??. 2,4
+#.???###??#???? 1,1,10
+???.#?#??..? 2,3,1
+.???#???..?.?.?? 7,1,1
+??????#???? 1,1,5
+?##???##???#????##?? 7,3,3
+??#????.?????#????? 1,2,1,1,6,1
+???????#.??.???#???? 1,6,1,1,1,3
+??????#??#.?.?? 9,1,2
+??#.???.#?##? 2,2,5
+.??##??????#???? 6,5
+.???###.???##??#. 6,1,3,1
+??.?.?????? 1,2
+??#??.?.#??????? 4,1,1,5
+?#????#.?????.??. 7,5,1
+?.??#??.?. 1,1,1
+??#???#????.?? 8,1
+#.???.????.???##?? 1,1,1,1,1,5
+.#?#?????????..?##.# 1,1,1,4,2,1
+?##.??.?.?#? 3,2,1,2
+#.??.?????# 1,6
+.?#?#??????##???? 5,3
+?.?#?????##? 4,3
+?.?.?.?##????????#? 1,12
+??.??..??###?. 2,1,4
+?..###????#?.?????? 9,1
+?????????##????#??# 14,2
+?...#?##?.????????.. 1,4,5,2
+.??????#?.? 1,4,1
+?..???###??.???.## 1,8,1,2
+????#?##?#??#????# 1,10,1,1
+??????#??##?#??.???. 9,3
+?..?#????#?.#?.#? 1,8,2,2
+???????.#? 4,1
+????##???.? 1,2,2
+.##?..#???.?? 3,4,1
+???.???????#???????? 1,1,3,3,1,2
+?????#??#??#??.???? 1,10,2
+..???.?#???.??????? 2,1,2,1,1,3
+???#????##??##?? 1,8,4
+???#??#???.?????? 9,3
+?????.??##?# 1,1,3,1
+??#??#???.????. 6,1,4
+???##???#?#?? 1,4,4
+??#??##??.????#? 6,5
+?#??#???##????#?? 5,5,1
+???#??#??? 4,1,1
+???##???###?.?..??? 5,5,1,1,1
+?#?.???.???? 1,1,1,1
+#????????. 1,4
+#?????.?????###? 3,1,3,5
+#???.?#???#??#.#???? 4,3,1,1,5
+??.??????#???#?.?? 2,1,1,1,1,2
+???#??#??#?? 5,1
+???.??...????##?.? 3,2,1,1,2,1
+?.???#?????#??? 1,4,1
+?.???#?..?? 1,3,1
+.?...???.##??? 1,2,2,1
+?????#?#.?.# 7,1,1
+?????#?????????#??.. 10,3
+??????.#???#.????#. 6,5,1,3
+??.?????.. 1,2
+?????????? 1,1,1
+#?#?.??.??.?##??# 3,2,5
+#???##??###.???.?.?? 11,3,1,1
+??#??#?##?..#?? 1,8,1,1
+.?????????#?? 1,1,2,2
+?.??#?#?#???#.?.?. 1,8,1,1,1
+?????#??##??## 1,11
+#.?????#???#..?##.? 1,9,3
+?.#???.?#?#?##?#???? 1,1,11
+.????#?#?.??#??##.# 6,7,1
+.?...??#??.??#??? 5,2
+?.?.??.??? 1,1,1
+????.?.#?#????.. 3,5
+?.?#?.?#??? 2,2,1
+.?????#??.?????#?. 2,4,6
+????#????????????#? 1,2,6,4
+#??#????.?.???. 8,2
+??.?#?##?#?# 1,6,1
+???#????????? 2,1,1,1
+.?#??..???. 3,3
+.???.?.?????? 1,1,1,1
+?????????#?. 1,2,2
+??.?#??.#??? 3,4
+???#??#??..? 1,1,2,1
+????#??##???.???.?? 9,2
+?#?#..#??#? 4,5
+???#???#??#?? 5,2,2
+#???##?##.#??????.? 3,2,2,4,1
+??#??#??#.?.#?##???? 1,4,1,1,7
+#??????.??. 1,3,1
+#???????.???..????. 8,1,1,1,1
+?#?.??#?.??#???#??? 1,1,1,2,4
+?##??.?.???# 3,1,1,1
+#??###.?????.? 6,2,1,1
+.#?.??#?.? 2,3,1
+..?#?????????.? 3,7
+??.???????#???#? 1,4,8
+???##?.????# 1,4,3
+.??#?##.#??????#. 2,2,1,3,1
+??#??.?#.?##. 5,2,3
+??####??.?.?##?.. 6,4
+??#????????#?.??# 11,2
+??..??..#? 1,1,2
+????##????.?..?.#.? 5,2,1,1
+?.?#?.#?.? 1,1,1
+?.?#?#?#?.?###?? 7,3
+?#??##?????# 6,2
+?#????????#. 3,2,1,1
+???##??#???#?.. 1,2,7
+??.??#????#? 1,8
+??#??..??? 2,1
+?#???????.??.#? 1,1,1,1,2
+.????#?????????????# 1,17
+????????.?? 1,2,1
+?.?##?#?#??.###?. 3,4,3
+????..???????? 3,1,1,1
+?#????.?.??? 3,1,1,2
+???????#????#?????? 2,2,1,1,4,2
+.??????.??.??? 3,2,3
+.?##??#?.?.#?.?##??. 2,2,2,3
+??#?#??#?? 3,2
+?#?.?.#?.?##?#?#? 3,1,1,8
+#?.#.?##?.???????? 1,1,4,1,6
+????????.????#??? 6,6
+???????#?#??#? 6,1
+.??.##??.??? 1,3,1
+??.????#?#???? 8,1
+?#?.?#????####????? 1,10
+?#..???#?????? 2,1,2,2
+.#?#?####??#?.#?#?. 12,3
+.?#?.?#.#?# 3,1,3
+.#??##?#?#?#???#???# 11,1,1,1,1
+.????##?#..??#?.? 8,3
+?..???.?#??#?#???. 1,3,6,1
+?##.?????? 3,2
+??#?????###?? 6,3
+?????????#???##?#?? 7,6,2
+#????##??##??#??.# 1,1,2,7,1
+???#???#????????? 4,8,1
+?.??.??.?? 1,1,2
+.??#??#?#?????????? 11,1
+.##?#?????# 5,1,2
+#???????.? 2,4,1
+??????.???#??? 1,1,3,2
+????????#?. 2,1,3
+????##??#??.### 1,8,3
+??.?#??###? 1,7
+?.?.?.??#??????.? 1,7
+#.??.???#? 1,2,1
+??.#????????? 1,4,1,1
+????????????.#?##??? 9,5
+#?#??.??.#.? 1,2,1,1
+??###????.????#???? 9,6
+???#?????????#?????? 7,4,1
+#?.??.?????#. 1,2,3
+#??????.?? 5,1,1
+?.?#?#?.?#.?.? 1,4,1,1
+??.?###?#??#????#? 1,11,2
+??.?????.# 1,1,1
+???.??#?#?.?????#?#? 1,1,1,1,7
+?.??.????#?#??? 1,8
+#?..???.???. 2,2,1,1
+#???#??#.?.???? 8,3
+?.???????.??#???. 5,6
+??##?..?.? 5,1,1
+..?#?.?##??##????## 1,8,3
+?????.?.#??##. 2,5
+?#?###..???##????#? 6,5,3
+?#???????? 1,1,3
+?.?.?.?#?. 1,1,2
+???.?.?.??#??.??? 1,3
+??.??#???#??#. 2,3,5
+??.?#??????.#?.?#.? 2,1,1,3,1,2
+#????#??#????. 1,1,7,1
+?#?##.?#??????????# 4,2,4,2,1
+???.#?????##?###??? 1,1,13
+.?#??#?.??#??. 6,2
+##??##?..?#??#??. 6,7
+#?.?.?????? 1,4
+.?.#??.?#? 1,1,1
+??#?.#?#?????.. 3,1,3,1
+???#.?.?.?##??#?.? 1,1,1,3,1,1
+?????#??#? 1,1,2
+??##.????. 2,1,2
+..##???#?? 2,4
+####??#?#??#?#?. 4,1,7
+?##?##????#??? 5,4
+???#??????#?#?. 6,7
+????.?#??#?#.?#??# 1,1,2,3,2,1
+????.#????#? 1,1,1,2
+?.##...?.????? 2,3
+.???#.??#?##?????##. 1,1,1,6,4
+..?#????????##?. 5,6
+?.#?.#??#? 1,5
+.?????.???##??###?. 1,1,11
+?.#??#?.?.???#? 1,5,1,1,1
+?#??#????.?? 1,1,1,1
+????.?#?????##? 4,1,6
+???.??#.#? 3,1
+??.#??...?.???..? 3,1,2
+???????#??#?#?#?? 4,6
+??#?#??#?#?##?.?? 7,4
+?##??.??#? 3,1,1
+?#.?.#?????##??#? 2,1,6,3
+#.#????#??#?????? 1,1,1,6,1
+??????#??..??????? 2,1
+????#?#?..??#??.#. 1,6,1,1,1,1
+?#?????.?.?????.##. 5,1,1,1,1,2
+??#?#?#????#?#?????? 15,1
+.??????.#?? 1,1,1
+??????.?????##?.??. 2,5
+???#?#..#?#. 3,1,3
+.?#??..#?##??. 4,6
+???##??.??#?.?????.? 6,3,5
+????????????###???? 4,10
+?????.#?.?# 4,2,1
+??????.##? 2,1,2
+.???.???.? 1,1
+.??#??#???????#.. 7,2
+.?????#??.??????? 8,2,1
+?.####?##?? 7,1
+..????.???? 2,1,1
+??.????????? 1,2,2,3
+?.?..?????????? 1,1,3,2
+?#??????#.#.?#? 5,1,1,1
+??.?.?#???# 1,1,3
+?????#.?#?????#?.? 4,8
+?#??##?????.?? 2,2,2
+?#..?????..?????#?? 2,4,2,1,1,1
+.??.??#??#?? 2,5
+?????..#..??##. 3,1,3
+??##???#?#?.?#???.?? 1,6,2,1,1,1
+???#?????#??. 5,1
+.????#?#??????? 7,1,3
+???#???##.##??.?? 5,2,3,1
+.???#?#?#?#??????# 13,2
+?#?????????##??? 1,2,3,3,2
+??????.?.???### 1,1,1,1,6
+.?.????#?#...??#?#? 1,6,1,3
+????#??????? 1,4,1
+???.??#??.? 1,2,1
+.?#??#???.#??# 7,4
+??#.?..?##?.?..? 1,4
+???.??.#???????? 3,1,1
+..?????#?.?.???? 5,3
+????###??????#????? 7,10
+##??#?#..#?????#?#?? 7,11
+????.?#?#???#???#? 2,11
+?????#?#?#????#??. 1,9,1,1
+.#.?.#??#??#?#?? 1,1,9
+???#????.?..?????.. 1,3,1,1,1,2
+?????????#?#?.? 1,1,5,1
+??#?.??.????..??. 4,1,4,1
+.#?#??##???#?# 1,11
+.??#??##??#????# 11,2
+.?..#??#??.????# 1,1,1,1,3
+?#?#????..???. 6,2
+?.????????#?##????? 1,2,6,2,3
+???..????? 2,1
+?#???##???#?#?.? 1,8
+???????.?#?#?? 4,3
+??#.??.?#??#?? 1,1,5
+??#..#???.???????. 1,1,1,1,1,4
+??.???.?#??#???. 1,2,6
+?????.?#?.## 3,2,2
+.?#??????.??.? 6,1
+..????#?###???????# 1,14
+??#????#?. 4,1
+????????.??# 1,1,2
+..?.??????????#??#. 1,2,1,1,6
+?.?#????.?#????#.? 1,5,6,1
+.?..????#???.??.?.? 6,2
+?.#???#..#????#??? 1,1,1,6
+.??.?.#??????#??? 1,1,1,3,4
+?#####???.?#?? 7,2
+??.????#?#.????? 1,6,2
+????.??##?? 1,5
+#???#?#?.#???..##? 1,1,1,2,4,3
+?#?#??.#?? 1,2,3
+????????.???? 8,1
+.#????#??#. 1,6
+?????..???#?#????.? 2,1,10
+???????????#??.# 2,1,7,1
+???#???.??#??##??.?? 4,8,1
+??#????????? 3,1,2
+#?.?#????##?????? 1,3,9
+.????###?....#?. 7,1
+#?#?####??#?#.? 9,1,1
+.??#??#?###?????? 3,6,1
+???#??####????????#. 2,7,1,1,1
+????.#??#??.???? 2,1,4,1,1
+?.?.?#?..#? 1,1,2
+.#?.?#???? 2,4
+???.#????#??.?# 1,1,1,3,1
+#??#????#???..# 1,3,1,4,1
+###.??.##???#??????? 3,1,2,10
+????#?###???? 1,7
+?#?#.?#????. 3,2,1
+.???####??# 1,5,1
+.?#??#??.#?? 2,4,3
+???..#?#?#??#??.. 1,10
+#??.###...#.?#??## 1,3,1,5
+???#?.??#???# 3,5
+?#??.?#?#.??. 1,1,3,1
+???#???.????#?????? 1,4,5,3
+.#.#???.??##?#???# 1,1,1,2,2,1
+?.???????????# 3,6
+??...##.?.?? 1,2,1,1
+?#??..#??#?.???#. 1,1,2,1,4
+???.???#??. 1,4
+????##?????? 7,3
+###.#???##.#?#??.? 3,6,3,1
+??????????? 2,3
+????#.??#? 5,3
+???..????#????##??#? 2,1,1,10
+??..#.?????? 2,1,3,1
+#?????????.?????. 3,1,3,2,1
+??.#?#????#??#???? 4,5
+????#..??.?#??#? 1,2,1,2,2
+?.????????????? 1,8,1
+#???#?..????#?#?? 1,1,2,8
+.#???###???????#?? 2,11,1
+??????.?????##? 3,1,8
+?.#???.#?. 2,1,2
+???.##???#. 1,2,1
+?#?.?#???#? 2,1,3
+???.?#?###..?? 1,5,1
+????????#?.#? 1,7,1
+#??.#?????#. 2,2,4
+??????.???# 5,1,1
+#.???.??????? 1,2,1,1
+????#?????#? 1,5,3
+.?#????#.?? 1,1,2
+?.#?#??.???#?#? 1,1,1,1,6
+?#.????????#???#???? 1,1,3,4,1,1
+???#????##?????.##.? 1,2,6,1,2
+????#?#.?????.. 5,1
+.???????.??## 1,1,2,4
+.?.?##?#?.?? 4,1
+#????????.?#?#?.?. 1,2,1,2,1,1
+?.???????.# 1,5,1
+??.??###?##?.?? 1,7,1
+??????..?.?? 1,1,1
+.?.#.#??.??.??? 1,1,3,1,1
+??#???#???#?#??.?# 1,1,6,1
+??.?#?#?#??# 7,1
+.?..?.#???#??#????. 1,12
+?????.##?? 3,4
+?????????? 1,2
+#?.#??????????#?? 1,1,12
+??????????????????? 1,8,1,4
+????#???????????.??? 1,1,6,2,1,1
+?.#???#????.??.? 6,1,1,1
+??#???##?????#?## 3,3,1,5
+??????????????.?# 1,4,1,2,2
+?..??#???????? 1,11
+?.#??.?.??? 1,1,2
+?#??#####???#???.??? 16,1
+?#????????????.??? 6,4,3
+?.???##???###? 4,4
+?.?.?????#???? 1,10
+??#?..?... 1,2,1
+.###?.?#?????? 3,4
+??#.???#.?###??? 1,1,4,4,1
+?????.##????#.?????# 3,7,2,2
+?????###?.?? 3,5,1
+???????#????#.?.???# 1,1,9,1,3
+#??.?????.##?.?# 3,3,3,2
+?.?.??#?.? 1,1,1
+?#??#??##?#??????#?? 1,7,1,1,1
+?????#.?#?????#.#?#? 1,3,8,4
+#?.??.#???????#???#? 1,1,1,1,2,6
+.#?.#?.?#.????? 2,1,2,3
+??..?#???.???? 1,3,1
+##???.?#?#. 3,3
+.??#???..?? 2,1,1
+..#??..#?. 2,1
+?#??#?#?????..?# 2,3,1,1,2
+?????#.#??? 3,1,4
+??????.?.#??##?.?? 4,5
+???#?????#?.?##.?? 1,3,1,2,3,1
+???#?.??..?# 1,1,1,1
+.#??.?.?????.?.??#?? 3,3,1,5
+#?#????#????..#? 4,5,1
+????.???????##?? 1,1,7
+?????????#????????# 1,1,1,7,2,1
+..??#??##??.. 3,4
+???????.?.#?.#.? 6,1,1,1,1
+.???##.#.#??# 1,3,1,4
+.??..??.?..?#?#? 1,2,1,3
+???..#?.??##??? 1,2,4
+?...??#??#???. 6,1
+.???#??..???.???#??? 3,2,5
+??????..?.???#??? 1,1,1,1,5
+#???.?..?.??? 4,1,2
+#???#??.?.???? 1,3,1,3
+??????????.?.?# 7,1,1,1
+?##???.#???????#?... 5,10
+???.???##?????#? 1,1,4,1,1
+?.????.???? 4,2
+?.????##??.??? 1,5
+????.?#??????##?### 1,2,9
+?????#?.?????#?? 5,1,4
+.?.#?.#?#?.???## 1,2,4,5
+##??#??##?? 2,7
+??#?###???#???? 7,5
+?#???#?#.???????# 3,1,1,6,1
+?#?.??????#?????? 3,2,7
+????????????....?? 9,1,1
+#?.?#?##??## 1,9
+????#??###????.?? 1,9,1
+??#???????..?? 8,1
+?.?#?????#?.? 2,4
+??.?.#?.?#?#??#??..? 1,1,1,9,1
+??#???????? 4,1
+??????????#??.???# 3,6,1,1,2
+?????.???? 1,1,2
+??#????.#????##??.? 1,1,1,8,1
+?..#.#...? 1,1,1
+?#?##??#?.????##???# 8,1,4,1
+#????#?#?.#??#???? 1,1,5,1,1,2
+#?#????.???#.? 1,2,1,2
+??????????..? 1,2,4,1
+.?##??.?????..??.? 2,4
+#??#??????.?.##?.??? 8,1,2,2
+#?.???#.##???###?# 2,2,1,2,6
+##?#??????..? 4,1,1
+?#????????#.#.??.?? 1,1,5,1,1,1
+#????.?#....?. 5,2,1
+.?#?#???#??? 6,1
+?????#??#??? 1,4,4
+.??????.????? 3,2
+???#.??????. 1,1,1,3
+.????#??#???###???? 1,4,4,2
+.?##.#????.?# 3,1,1,1
+?????#?#??#? 1,9
+.???????????.##? 4,2,2
+..???#??.?##?#??###? 6,4,3
+??#????#.???#?#?##?? 6,1,1,8
+..??#?????????? 1,3
+?.?#???????? 4,2,1
+.?.?#??.#?..?#?#?? 1,4,1,5
+??????.#????.#?.? 3,4,2,1
+??#??#??.###?. 5,3
+..?..??#?#??#??. 1,8
+..??..?#???#??.? 2,3,3
+??.#???###??.???. 1,3,4,1
+??????#?##????#??#?? 11,2
+?#?.???##?.#??#? 3,6,2,1
+.#?####?.#?#?# 6,1,3
+?#.?.????? 1,1,3
+??#??#?...???? 5,2
+?.?##??##????.? 1,11
+?##?????#??#.?? 11,2
+??.???#..?#?#???? 1,1,2,2,5
+?##??#???##?????#. 2,2,7,1
+??#????##?.?. 3,4
+??.??#.??.???#?#?? 2,1,1,1,1,6
+???#..?#?. 2,1,1
+??????####??###???# 1,12,3
+????#?##??#.##? 1,1,4,1,2
+#.??#??##??#?..?.?# 1,9,1,1
+?#???????.??.#?????? 1,2,1,1,7
+????.#?????????##? 2,2,7
+???.###???#?#?# 1,3,5
+???#..???##????? 2,2,2,1,2
+.??#???#.. 1,1,1
+#?????#????? 1,1,2,1
+?.????..?????#? 1,3,3,1
+?.???.?#????#??#.#?# 2,9,3
+?##.??.##.??.??? 2,2
+???#???.?? 2,1,1
+?????.?..??#?? 1,1
+.???????#..???# 2,2,2
+?????##??##? 1,7
+???#????##????. 1,2,6
+.#?.??.??? 1,1,2
+??????.??#?? 1,1,4
+#.?????????????##?? 1,2,10
+.??????##??.?###??? 7,4
+.??##??#??#.?????? 4,4,1,1,1
+#??????.?? 1,3,2
+??##???#?????#?. 4,2,5
+???????..??? 4,3
+??#??#??#?? 1,1,2
+???.????#?? 2,5,1
+??##?????.?. 4,2
+????#??#?.#? 4,2,2
+?????#??.??. 2,3,1
+?.?#?#?#??#???#???.? 13,1
+#??#?#??#??.????? 11,2,1
+?????#??.? 1,4
+?????#..??????#????? 2,2,6,1,1
+??#?.?.??????? 4,1,2
+?#?????#??????#???? 1,1,4,3,3
+?????##.??.??##?? 4,4
+.##?.?.#?#?.?#??#??. 3,1,4,6
+#???#.#?#?.???#??? 1,3,4,1,4
+???.??##?#?#?? 1,9
+.#?????.?.?????## 6,1,1,1,3
+#?#?????##.#?#??? 1,8,1,1,1
+?..#??.?????? 3,1
+.#?##??????. 1,4,2
+?.???????. 1,2
+????..??.????. 3,1,3
+#.?##???#????.??.? 1,4,1,2,2,1
+??.??.??#????.??? 1,1,5,2
+?.??#?.#?. 2,2
+??##??.#.??.????? 5,1,2,1,2
+#?.?.#??#???#.?.?? 2,1,1,2,2
+??#?.?#?.??????? 3,2,3
+##?##????????#?. 6,5
+?.???#?????.??? 1,5,1,2
+????#???.???#?#?.? 6,1,5,1
+??#???#.??#?????##? 5,1,10
+????.?#??#?????? 1,1,5,1,1
+??????####???? 1,8
+?.????..?? 1,3,1
+??.??##??###?..? 4,5
+???#????????? 4,3
+.#???.??#. 4,2
+????#?.#?????##??? 1,1,1,1,5
+?.???.??#??.???? 1,2,3,1,1
+.?#?.??##.?? 3,4
+??.#.??#.? 1,3,1
+???????#..?? 7,2
+???????##???.??????? 8,5
+?##?##?????.?#?# 7,1,1,1,1
+?.??..?.?.?. 1,1,1,1
+??????#??.??? 2,4,1
+..???#?.##?# 2,2,4
+???#???#.??????#?#. 8,1,3
+.###????.????. 6,2
+????###??#???????? 7,5,3
+.#????.???#???????? 5,1,3,3
+.???#?#??#?. 1,7
+????????#???#..#?? 11,1
+#??#.??.#?#?.?? 4,1,1,1,1
+???????????????? 6,2
+??.#?????. 2,6
+?##????#??##? 2,1,2,2
+?.#.??##??????#??? 1,4,7
+#??.#?????? 2,1,3
+??##.???#?? 3,2,1
+??#???????..??#. 2,4,3
+?..?#.???#???? 2,1,2,1
+??.?#??.??#?..??.# 1,1,1,2,2,1
+#..???#??? 1,6
+?????.?.??.??#?????. 2,1,1,1,3,4
+?????????.#? 3,1,1
+??#????#?..#.???.??? 3,5,1,1,1,1
+???.?#..???#?? 1,2,5
+??#??#??#?.#?# 7,3
+??#????????#????#??? 1,11,1,1
+??#.???????#? 2,4,1
+??.?????????# 5,1
+.?#?##??#?.#?????? 5,1,1,1,1
+??????###??# 1,1,5,1
+..????#?.??.??? 5,1,1
+???.????### 1,4
+???...?#???###???#?? 1,14
+????????????#??.#? 1,7,1,1,1,1
+????##??.???..#. 1,5,1,1,1
+..##??.??##?? 4,6
+????#?##???.?? 2,5,1
+#??..?#???????????? 2,2,6,2
+.?#???#??????? 2,7
+??.#.#..????###.? 1,1,1,7,1
+.??#.???###.?? 3,4,2
+??????#?#.??? 4,3,2
+????#?..???##.? 2,2,1,2,1
+.?????#?#?? 2,4
+#??.????#? 2,4
+???..#???#??? 2,7
+..????????##. 1,3
diff --git a/day12.lisp b/day12.lisp
new file mode 100644
index 0000000..e2b1801
--- /dev/null
+++ b/day12.lisp
@@ -0,0 +1,70 @@
+(defun read-lines (filespec)
+ (with-open-file (stream filespec)
+ (loop for line = (read-line stream nil)
+ while line
+ collect line)))
+
+(defun parse-integers (string &key (start 0))
+ (loop for i = start then (1+ (cadr o))
+ while (< i (length string))
+ as o = (multiple-value-list (parse-integer string :start i :junk-allowed t))
+ as n = (car o)
+ while n
+ collect n))
+
+(defun repeat-string (n string &optional sep)
+ (with-output-to-string (stream)
+ (loop for i from 1 upto n
+ do (write-string string stream)
+ if (and sep (< i n))
+ do (write-string sep stream))))
+
+(defun repeat-groups (n groups)
+ (loop repeat n append groups))
+
+(defun solve-line (line &key (nfolds 1))
+ (let* ((p (position #\Space line))
+ (springs (subseq line 0 p))
+ (groups (parse-integers line :start (1+ p)))
+ (dptab (make-hash-table :test #'equalp)))
+ (labels ((f (springs groups &optional (start 0) group)
+ (let ((dpkey (list start group (length groups))))
+ (multiple-value-bind (val found-p)
+ (gethash dpkey dptab)
+ (if found-p val
+ (setf (gethash dpkey dptab)
+ (if (>= start (length springs))
+ (if (or groups (and group (/= group 0))) 0 1)
+ (let ((c (aref springs start)))
+ (cond ((equal c #\.)
+ (if (and group (> group 0)) 0
+ (f springs groups (1+ start))))
+ ((equal c #\#)
+ (if group
+ (if (= group 0) 0
+ (f springs groups (1+ start) (1- group)))
+ (if (not groups) 0
+ (f springs (cdr groups) (1+ start) (1- (car groups))))))
+ ((equal c #\?)
+ (if group
+ (if (= group 0)
+ (f springs groups (1+ start))
+ (f springs groups (1+ start) (1- group)))
+ (if groups
+ (+ (f springs (cdr groups) (1+ start) (1- (car groups)))
+ (f springs groups (1+ start)))
+ (f springs groups (1+ start))))))))))))))
+ (f (repeat-string nfolds springs "?") (repeat-groups nfolds groups)))))
+
+(defun solve1 (filespec)
+ (let ((lines (read-lines filespec)))
+ (reduce #'+ (mapcar #'solve-line lines))))
+
+(defun solve2 (filespec)
+ (let ((lines (read-lines filespec)))
+ (loop for line in lines sum (solve-line line :nfolds 5))))
+
+(print (solve1 "data/12/example.txt")) ;; 21
+(print (solve1 "data/12/input.txt")) ;; 6871
+(print (solve2 "data/12/example.txt")) ;; 525152
+(print (solve2 "data/12/input.txt")) ;; 2043098029844