summaryrefslogtreecommitdiff
path: root/2023/day13
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2023-12-15 21:47:10 +0100
committerSanto Cariotti <santo@dcariotti.me>2023-12-15 21:47:10 +0100
commit67dff579e91c13ef40ecb17d14497d145861c5e7 (patch)
tree3ec7cccea75ba25aa0da34f528811d28f6c9b21a /2023/day13
parent49ecb2db619bb32c712e619ec66833a917b5ffc3 (diff)
add day15 pt1
Diffstat (limited to '2023/day13')
-rw-r--r--2023/day13/Cargo.toml8
-rw-r--r--2023/day13/example.txt15
-rw-r--r--2023/day13/input.txt1361
-rw-r--r--2023/day13/src/lib.rs146
4 files changed, 1530 insertions, 0 deletions
diff --git a/2023/day13/Cargo.toml b/2023/day13/Cargo.toml
new file mode 100644
index 0000000..36c9510
--- /dev/null
+++ b/2023/day13/Cargo.toml
@@ -0,0 +1,8 @@
+[package]
+name = "day13"
+version = "0.1.0"
+edition = "2021"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
diff --git a/2023/day13/example.txt b/2023/day13/example.txt
new file mode 100644
index 0000000..3b6b5cc
--- /dev/null
+++ b/2023/day13/example.txt
@@ -0,0 +1,15 @@
+#.##..##.
+..#.##.#.
+##......#
+##......#
+..#.##.#.
+..##..##.
+#.#.##.#.
+
+#...##..#
+#....#..#
+..##..###
+#####.##.
+#####.##.
+..##..###
+#....#..#
diff --git a/2023/day13/input.txt b/2023/day13/input.txt
new file mode 100644
index 0000000..023748d
--- /dev/null
+++ b/2023/day13/input.txt
@@ -0,0 +1,1361 @@
+######....#######
+..#...####...#..#
+.###.#....#.###.#
+....##.##.##....#
+.##....##....##..
+.####...#..####.#
+##..#..##..#..###
+..#.########.#...
+#..#.######.#..#.
+.##..#.##.#..##..
+###.#.####.#.###.
+###.#.####.#.###.
+.##..#.##.#..##..
+#..#.######.#..#.
+..#.########.#...
+
+......##....#
+.#.#.##...#.#
+.##.#..#..#.#
+.##.#..#..#.#
+.#.#.##...#.#
+......##..#.#
+....#.#....#.
+...#.###...##
+.#.##.#.###..
+###.....##.##
+#.##..##...#.
+###.#..##.##.
+#..#######..#
+#..#######..#
+###.#..##.##.
+
+#.#.#.#..
+#.#.#.##.
+#.#.#.##.
+#.#.#.#..
+...#.....
+#..#.##..
+....#...#
+####....#
+#####....
+.###.#.##
+####...##
+.#.#...#.
+#....#.#.
+
+.########..##
+.###..###.#.#
+###....###.##
+#...##...##.#
+.########.#..
+#...##..#####
+#.##..##.#...
+....##....#..
+....##....#..
+
+.........##..#..#
+.#....#.######.##
+.#....#.######.##
+.........##.....#
+.######.#..#.#..#
+##.##.###.##..#.#
+#########...#..#.
+###..###...#.####
+#......#....#..#.
+##....##.....###.
+..####..##.#....#
+.............#.#.
+..#..#...####....
+
+##......##.
+....##.....
+##..##..##.
+..#.##.#...
+..........#
+..##..##...
+####..####.
+####..####.
+#.##..##.#.
+
+......#..######
+######.#.......
+.####.###..##..
+..##..##.#....#
+.####.#...#..#.
+..##..#.##....#
+#.##.##..#....#
+##..####.......
+.####..#.######
+##..##..#.....#
+......####.##.#
+#....#.........
+######..##....#
+######....#..#.
+#....#####....#
+
+##...........
+..###########
+##..###..###.
+##.##########
+..#..........
+##...#....#..
+..###..##..##
+##.##.#..#.##
+..#.###.####.
+###.###..###.
+....#..##..#.
+##.#.#....#.#
+...####..####
+....#.####.#.
+##.##......##
+
+#.#....##..
+#..##...#.#
+#.###..##.#
+#.###..##.#
+#..##...#.#
+#.#....##..
+.#..####.#.
+..#..######
+#..###.#.#.
+.#.########
+.#.########
+#..###.#.#.
+..#...#####
+
+....###.#.##..#
+....###.#.##..#
+#.##..####.....
+#.##.....##..##
+.#..##....#.##.
+.#......##.#.#.
+....#.#...###.#
+....#.#...###.#
+.#......##.#.#.
+.#..##....#.##.
+#.##......#..##
+#.##..####.....
+....###.#.##..#
+
+#..#..#..##..
+#.##.........
+#.##.........
+...#..#..##..
+##..#.#.###..
+#.#.#########
+...#.##....##
+
+..########..#.###
+....####....#.#..
+........#...###..
+..##....##...##..
+####....####.#.##
+###..##..###.#.##
+#....##....###.##
+###......####.#..
+#.##.##.##.##..##
+
+.####.##.
+......##.
+..##.....
+..##..##.
+#....#..#
+##..##..#
+#....###.
+##..##..#
+##..#####
+
+####..#######
+.##....##..##
+..######....#
+..##..##....#
+#...##...##..
+#.#....#.##.#
+#.######.##.#
+###....######
+###.##.######
+.#..##..#..#.
+##....#.####.
+
+###.#.#..#.#.##
+##..##....##..#
+..#.########.#.
+##.#..#..#..#.#
+###..##..##..##
+##.#.#....#.#.#
+..#.#......#.#.
+####.######.###
+##.##.#..#.####
+..##.#....#.##.
+..#.##.##.##.#.
+..#.#.#..#.#.#.
+###.########.##
+###.#......#.##
+##...#.##.#...#
+
+#......
+##..###
+##..##.
+#..#...
+..##...
+###.#..
+.##.###
+..#....
+#....##
+#....##
+..#....
+
+.#####....##.#...
+..####....##.#...
+##.#.####..#.###.
+##...##...#..#.#.
+##...##...#..#.#.
+##.#.####..#.###.
+..####....##.#...
+.#####....##.#...
+.#..##......###..
+#.#####...###.##.
+....#..#.#..#####
+..###....##......
+.#...###...#.##.#
+#...#.....#..##.#
+#..##.###.#..#.#.
+.#...#....###.#..
+##..#..###......#
+
+###.##.##
+##.####.#
+##.#..#.#
+####..###
+....##...
+##.#..#.#
+...#..#..
+##..###.#
+##......#
+##......#
+..#.##.#.
+...#..#..
+##.####.#
+....##...
+...####..
+....##...
+##.####.#
+
+###..##.#
+#####....
+.##.#.##.
+#.#.###..
+##...#..#
+#.#.##.#.
+#####.##.
+###.#....
+###.#.#..
+###.#.#..
+###.#....
+
+..#...#
+..#...#
+.....#.
+#.#.#.#
+.###.#.
+###.#..
+##....#
+#.#.#.#
+###..#.
+.###..#
+.###..#
+###..#.
+###.#.#
+##....#
+###.#..
+.###.#.
+#.#.#.#
+
+.###.....
+...###..#
+....##.#.
+#.#..###.
+#.#..###.
+....##...
+...###..#
+.###.....
+.###.....
+...###..#
+....##...
+
+########...##.#
+########.#.#...
+##.##.####.####
+########.##...#
+#......##..####
+##....##.###..#
+##.##.##.##..##
+##....###..####
+###..#####..##.
+..####...#####.
+..####...#####.
+..####......#.#
+#########.##..#
+..........##.#.
+..#..#...###..#
+
+###.#.###....
+####...##..#.
+..#..##...##.
+..##.#######.
+###.#.####..#
+##.....####..
+...####..#..#
+..###.#.#.##.
+##....###...#
+..##..##.####
+###.##.####.#
+..####.....##
+...#.#..#.#..
+...#.#....#..
+..####.....##
+
+#..#...
+.##...#
+.##..#.
+.##..##
+.##.#.#
+.##.#.#
+.##..##
+.##..#.
+.##....
+#..#...
+....#.#
+.##....
+####.##
+####.#.
+....###
+
+#.#..#.#.#.....#.
+...##...#.#.#.#.#
+.######.#.......#
+..#.##..#..###.##
+###..####.##.#..#
+#......######....
+############.#.##
+.#.##.#...#.#####
+.#.##.#.##..#.#..
+.........#.#.#.##
+........#.#.#..##
+###..####.##.#..#
+.##..##..#.###..#
+.##..##..#.###..#
+###..####.##.#..#
+........#.#.#..##
+.........#.#.#.##
+
+###.####.######
+....#.......##.
+.#..####..#.##.
+#.##.##.##.####
+.#..#..#..#....
+..#..##..#..##.
+#...####...#..#
+
+....###
+#...#.#
+.######
+..#####
+....#..
+.###.##
+.##.#..
+..#....
+....#..
+..#####
+.#...##
+#...###
+#...###
+.#...##
+..#####
+
+####.###..###.#
+#.##.########.#
+....##......##.
+...##..#.##..##
+....##.#..#.##.
+##..#.#....#.#.
+......##..##...
+#..##........##
+..#...#....#...
+.##...#.##.#...
+.##...#.##.#...
+..#...#....#...
+#..##........##
+
+.###.#.....
+.##.##.####
+.####..#.##
+#.##..#.##.
+.#####.....
+..##...####
+...#..#.##.
+...#..#....
+...#..#....
+...#..#.##.
+..##...####
+
+.....#..#..
+...###..##.
+#####.#.#.#
+.##..#.#.##
+#..#..#.#.#
+#..######.#
+....##..##.
+....##..##.
+#..######.#
+
+##.###.##.#
+.##.#####..
+.#..#.##.##
+.#..#.#..##
+.##.#####..
+##.###.##.#
+.#....#.###
+.#....#.###
+##.###.##.#
+.##.#####..
+.#..#.#..##
+.#..#.##.##
+.##.#####..
+##.###.##.#
+#..#..#.#.#
+
+###..###.#.##
+.##..###.#.##
+..###.#.#..#.
+.#......####.
+#...#...###..
+.#.#####.##.#
+.#.#####.##.#
+#...#...###..
+.#......####.
+
+.##.##...##...##.
+#####..##..##..##
+.....##..##..##..
+.##.#.#.####.#.#.
+.##...#.#..#.#...
+....#..........#.
+#..#..#......#..#
+....###.....####.
+.##...#.#..#.#...
+.....#..####..#..
+#..#...##..##...#
+....#...#..#...#.
+#..#.##########.#
+#..##...####...##
+#####.##.##.##.##
+
+...##...#######
+.##..#..##.....
+.#....#....#..#
+.##..##.....##.
+###..####.#....
+##.##.##.###..#
+########.###..#
+.#....#.###....
+#.#..#.##..#..#
+..........##..#
+########.##.##.
+
+..##.....
+...###..#
+#...##..#
+.###.####
+##...####
+##.......
+...##.##.
+#..#..##.
+...#.....
+...#.....
+#..#..##.
+...##.##.
+##.......
+##...####
+.###.####
+#.#.##..#
+...###..#
+
+.#..##..#.##...
+..#.##.#..#####
+.##.##..#..#.#.
+.########.###.#
+..#....#..#.##.
+##..##..###....
+##..##..###....
+..#....#..#.##.
+.########.###.#
+
+#####..###.#.##
+###....##.#..##
+##....####.....
+...#.#..##.#.#.
+..#.#..#.#.....
+...#..###..#..#
+..##..###..#..#
+..#.#..#.#.....
+...#.#..##.#.#.
+##....####.....
+###....##.#..##
+#####..###.#.##
+..###...#....#.
+##.#...#..##...
+###.#...##.#.#.
+..###.#....#.#.
+..#####...###.#
+
+..##.####..#..#
+..#.###..##.##.
+##.#..##.###..#
+##.#.#.####....
+###..#.#.##....
+####.#.##.##..#
+##.##....###..#
+###########....
+..#.##..####..#
+...##..#.#.#..#
+....####.######
+..#...#.#.#.##.
+###...##..##..#
+##.#...#.#.#..#
+##.#.#.....####
+..##..###.##..#
+##.#.#....####.
+
+#..#..##...
+#..#..##...
+.#..#.#...#
+#...##..###
+###.###.###
+##...##.###
+..##...##..
+##....#.#..
+#.#...###..
+###.#...#..
+......##...
+
+#....###.
+#....###.
+.#..#.###
+#....##..
+.......#.
+#.#..###.
+#.##.#.#.
+.......#.
+.####.##.
+##..##.##
+.####.#.#
+
+....#.#####
+..#.#......
+###.##..##.
+..#.#......
+.....#.#..#
+.#...#.##.#
+..###......
+#..#####..#
+#.##...####
+##.###..##.
+.#.##..#..#
+..####.#..#
+#......####
+##....#....
+#####..####
+#####..####
+##....#....
+
+....#........
+#..#.#.#...#.
+....#.......#
+.##..#.##....
+....##...####
+#..#.##..###.
+####.##....#.
+####.#.#..##.
+......#....##
+....###..##.#
+.##..#.#....#
+.##..#.##...#
+....###..##.#
+......#....##
+####.#.#..##.
+
+....###
+.#.####
+..####.
+##.#.##
+##.#.##
+..####.
+.#.####
+....###
+###...#
+###...#
+.....##
+
+.#...###...
+..#.#######
+#..#.##.###
+....##.....
+..#.##..###
+...#.##.###
+.#.##.#....
+.##.#..##..
+#.####...##
+#.##.......
+#.##...#...
+#.####...##
+.##.#..##..
+.#.##.#....
+...#.##.###
+
+.#..#.###
+#....#...
+######...
+#....##..
+.########
+######...
+##..#####
+.#..#.#..
+.......##
+
+##....#.##..##.
+#...#####.####.
+.#.##.#....#..#
+#.....#####....
+.#...#....####.
+#.#..#...#..#.#
+#.#..#...#..#.#
+.#...#....####.
+#.....#####....
+.#.##.#....#..#
+##..#####.####.
+##....#.##..##.
+.##...#..#...##
+#.######..##.##
+........#####..
+........#####..
+#.######..##.##
+
+.#..#.#...##.#.
+..#..#....#.###
+#.#.#..#.#.##..
+#....##....####
+#.###.#.##.##.#
+##..#...###...#
+##..#...###...#
+#.###.#.##.##.#
+#....#.....####
+#.#.#..#.#.##..
+..#..#....#.###
+.#..#.#...##.#.
+.#....##.####..
+#.#.#####.#...#
+#.#.#####.#...#
+
+.#.####.####.##
+.#.#.#........#
+###.#...#..#...
+###.#...#..#...
+.#.#.#........#
+.#.####.####.##
+..##..##.##.#..
+
+#..####.#.##...##
+.....###.#####..#
+......##.#..##.##
+....#.#.#.##.#..#
+....#.#.#.##.#..#
+......##.#..##.##
+.....###.#####..#
+#..##.#.#.##...##
+#..####.#.#.####.
+.##.####.#.#...#.
+.##.###...##..##.
+####.#.#...#.#..#
+####.#.###.#..###
+#..#####....##.#.
+#..#####.#..##..#
+
+#.####.####
+##....##..#
+#......####
+.#.##.#....
+..####..##.
+..####..##.
+.#.##.#....
+.#.##.##..#
+.##..##.##.
+..####.....
+#.####.#..#
+
+..#.#..#.###....#
+.#.######.##...##
+#.#.###..##..###.
+.#...#####.#..#..
+#.##.#.#..#.#..##
+#.##.#.#..#.#..##
+.#...###.#.#..#..
+#.#.###..##..###.
+.#.######.##...##
+..#.#..#.###....#
+..#.#..#.###....#
+
+....#.##...
+.#.#..#..##
+.#.#..#..##
+....#.###..
+.......#.##
+..##.#...##
+...#.#.....
+####..#...#
+#..#.#...#.
+#..#.#...#.
+####..#...#
+...#.#.....
+..##.#...##
+
+..######...
+..#.##.#..#
+#.##..##.##
+#.##..##.#.
+..#.##.#..#
+..######...
+##..##..##.
+.#..##..#..
+.#..##..#.#
+###....####
+..#.##.#...
+
+#......####..
+..#..#......#
+.##..##.##.##
+.#.##.#....#.
+..#..#..##..#
+#..##..####..
+##.##.######.
+########..###
+#..##..##.#..
+.##..##....##
+.##..##....##
+.######....##
+...##...##...
+
+.####..##
+..#######
+.#......#
+##..#.#..
+####..#..
+..#....#.
+..#....#.
+####..#..
+##..#.#..
+.#......#
+..#######
+.####.###
+#..#.##..
+#..#.##..
+.####.###
+
+#.#..#..#......
+##...####..#.##
+####..#.#..#.##
+.##..###.#.#..#
+..#.##.####....
+.#..##..##.##..
+##.###.##.#.###
+#..#.#..#.##.##
+##..#####....##
+####..#.####..#
+#.....#.####.##
+......###....##
+..#...###....##
+.##.##.###..###
+.##.##.###..###
+..#...###....##
+......###....##
+
+####..#..
+.....##.#
+...###...
+.....#.##
+....##.#.
+##.#.#.##
+##.#.#.##
+....##.#.
+.....#.##
+...###..#
+.....##.#
+
+######...###...
+#.##.#.##....##
+......##..###.#
+#....##....#.#.
+.......##...#.#
+#######.#...#.#
+#######.#...#.#
+.......##...#.#
+#....##....###.
+......##..###.#
+#.##.#.##....##
+######...###...
+.####.##..####.
+#.##.#..###....
+..##.....##.#.#
+
+#.######.##.#.#
+#..####..#.###.
+..........#.#..
+..#.##.#.......
+..#.##.#.......
+..........#.##.
+#..####..#.###.
+#.######.##.#.#
+###....#######.
+...#..#.....#.#
+.#..##..#.###.#
+.##.##.##.#..##
+.#.####.#...##.
+
+##.#..#..##..#..#
+##.#..##....##..#
+#.#....#.##.#....
+....##.##..##.##.
+###.##..#..#..##.
+.#####...##...###
+...#####.##.#####
+
+###..####..
+##...#.....
+##...#.....
+###..####..
+#.#......##
+.##....#.##
+.###.#....#
+#..##....##
+.##......##
+
+........#..##
+........#.###
+........#..#.
+#######.#..#.
+.#..#...####.
+##..###.###.#
+#.##.#....###
+########.....
+#....##.....#
+##..###..###.
+.#..#.#.####.
+......####..#
+..##..##.#...
+
+....#.#..##.#.#.#
+....#.#..##.#.#.#
+..#####.##...#.#.
+###..#..##....#.#
+###.#....#...####
+#..#..#.#...###..
+#....###.#.######
+..#..##.#..#..##.
+..#..##.#..#..##.
+#....#.#.#.######
+#..#..#.#...###..
+###.#....#...####
+###..#..##....#.#
+..#####.##...#.#.
+....#.#..##.#.#.#
+
+...#.##...###
+...#.##...###
+...##.###..##
+.##..#.##...#
+#..#..#.#..##
+.#....##.#.##
+..#.#.###..#.
+..#.#.###..#.
+.#....##.#.##
+#..#..#.#..##
+.##....##...#
+...##.###..##
+...#.##...###
+
+###.######.
+##.#.####.#
+..#.#.##.#.
+..#.#.##.#.
+...#.#..#.#
+..##.#..#.#
+##...####..
+..###....##
+###.#.##.#.
+##.#.#..#.#
+##.........
+####.####.#
+###..#..#..
+..#......#.
+....#....#.
+
+#..###.##..##.#
+.##...#......#.
+##.###.##..##.#
+##.#.##########
+###.##.######.#
+#.#...#......#.
+..#..#........#
+..#..#........#
+###...#......#.
+
+..#.####.
+..##.##.#
+###.#..#.
+#.#......
+.....##..
+.#.######
+.########
+
+..#..#..###...##.
+#####.#...#..#...
+.......#.#.#.##.#
+#...#.........##.
+.#.##.#.....#....
+.#.##.#.....#....
+#...#.........##.
+.......#.###.##.#
+#####.#...#..#...
+..#..#..###...##.
+#..#..#...#...###
+#.#.#.###.#...#..
+#.#.#.###.#...#..
+
+....#..#.....
+##........###
+#....##....#.
+##........##.
+...#.##.#....
+####....####.
+.....##......
+....#..#.....
+..##.##.##...
+..##.##.##...
+...##..##....
+.....##......
+####....####.
+
+...........#.
+.........#.#.
+##.##.##..###
+.........##.#
+#..##..######
+#.#..#.#..#.#
+..####..#.#..
+..#..#..#.###
+#.#..#.#...#.
+.##..##....#.
+########.#.##
+
+.##......##..##.#
+.##......##..#..#
+.#...##...#.#....
+...#....#...#...#
+.#.##..##.#..#.#.
+..##.##.##......#
+###..##..###..###
+.####..####.#.#.#
+............##.##
+
+...##....##....
+.####.##.####..
+.####.##.####..
+##..##..##..###
+.#.#.#..#...#..
+##.#.####.#.###
+#..#..##..#..##
+#.#........#.##
+#...##..##...##
+#....#..#....##
+...#.#..#.#....
+##.###..###.###
+####.####.#####
+
+..#...##...#.
+#.##.####.##.
+##.#..##..#.#
+....######...
+....##..##...
+...#.#..#.#..
+##.#.####.#.#
+..###.##.###.
+###.#.##.#.##
+..#..####..#.
+....#.##.#...
+
+#......##..##..
+#.####.#.######
+...##....##..##
+...##...#.#..#.
+##....##.##..##
+..#..#.###.##.#
+#.####.#.#....#
+##....##.##..##
+.#....#...#..#.
+...##...#.####.
+#.#..#.#.#.##.#
+..####..#.#..#.
+#########.#..#.
+...##..........
+.##..##....##..
+.######..######
+###..###.......
+
+#..#......#.#
+#####.#..#.##
+....###..###.
+#..##.####.##
+.##..#....#..
+#..##.####.##
+.##..######..
+#..##..##..##
+####..#..#..#
+.......##....
+.....##..##..
+######.##.###
+.##.########.
+
+######.#.
+##..#.#..
+##..###.#
+##.##.#..
+.##...##.
+#....####
+#....####
+.##...##.
+##.##.##.
+##..###.#
+##..#.#..
+######.#.
+######.#.
+
+.##..####
+.###.##.#
+.####....
+..#.###..
+.#..#....
+.########
+.##.##...
+.###..###
+.##..####
+##.#.....
+##.#.....
+
+#..#.#....#......
+######.######.##.
+####..####...##.#
+.##...##.####.#..
+.##...##.####.#..
+####..####...##.#
+######.######.##.
+#..#.#....#......
+###.#######.....#
+
+#..##.###.#####
+#..######.#####
+.####.##.#.##.#
+..#.##...#.#.##
+#..######...#..
+#..######...#..
+..#.##...#.#.##
+.####.##.#.##.#
+#..######.#####
+#..##.###.#####
+####.####.#..#.
+
+.........####.##.
+#####.#.#..#.##.#
+.##.##...#...#.#.
+#..#...#.#.....#.
+#..#...#.#.....#.
+.##.##...#.#.#.#.
+#####.#.#..#.##.#
+
+.##..######
+#####.####.
+#..##.#..#.
+.###.######
+.##.##....#
+#####......
+.##.#......
+.##........
+####...##..
+####.......
+#..##..##..
+.##..######
+####.##..##
+......#..#.
+.##.#.####.
+....#######
+#####.#..#.
+
+#.##.#..##..#.#
+.#..#..####..#.
+.#..###....###.
+#######....####
+.####.##..##.##
+.#..#........#.
+##..####..####.
+#.##.###..###.#
+#.##.##.##.##.#
+.#..#..####..#.
+.####..####..##
+.#..#.######.#.
+......#.##.#...
+##..##.#..#.##.
+.####.##..##.##
+
+###.####..#
+##.#......#
+...#..#...#
+...#..#...#
+##.#......#
+##..####..#
+##.#.#.#..#
+..###.###.#
+####.#.###.
+##..#.#.###
+...#....#..
+
+.###..##..###
+..#.##..###..
+##..#.#####..
+##..#.#####..
+..#.###.###..
+.###..##..###
+..###....#.#.
+...###..##..#
+..#..#..#..#.
+.##..##.....#
+.##..##.....#
+
+...#.#..#
+###..##..
+...#.##..
+##......#
+##......#
+...#.##..
+###..##..
+.....#..#
+##.##.###
+######.#.
+.....####
+
+.##...#######
+....##.#.##.#
+.##...##.....
+.##..#..####.
+######..####.
+.##..##..##..
+.##.#..#....#
+####..#..##..
+....#...####.
+....#....##..
+#..#.##......
+
+..##..#
+.#.#..#
+.#..##.
+..##..#
+..##..#
+.#..##.
+.#.#..#
+..##..#
+##.####
+.#.#..#
+#.#.##.
+.##.##.
+#..####
+#.##...
+#......
+
+###.##....##.####
+###..######..####
+.....#.##.#......
+.#.###.##.###.#..
+..#.##....##.#...
+###..#.##.#..####
+###..#....#...###
+.#.#........#.#..
+.#..#.#..#.#..#..
+
+.##.#.##.....
+#.##.#.###...
+#....##...#..
+....##.#..###
+#.#.#.#...###
+.#..###...#..
+##.....#...##
+......#..#...
+.##.#..###.##
+#.###.#.#..##
+#.#####...###
+..#.#....##..
+..#.#..#.##..
+#.#####...###
+#.###.#.#..##
+
+...##.#######....
+.....#..#..######
+##..#..###....#..
+##.#.#..##.###.##
+..#.#.#..##.###..
+..#..#..##.##.#..
+.##..#..#..#.#.##
+##...##..###.....
+.......#.#.######
+####.##.#...#..##
+###.#.#.##..##.##
+
+##.#.#.....
+.#..###.#..
+####.#..###
+##.....#...
+.#.#.#...##
+##...#.####
+..###...###
+####..#....
+####.##....
+..###...###
+##...#.####
+
+###.#..#.##
+..#......#.
+...#.##.#..
+##..#..#.##
+####.##.###
+..###..###.
+##.#....#.#
+###......##
+...#.##.#..
+####.##.###
+###..##..##
+##.##..##.#
+...#....#..
+
+#..###...####..
+#.####...####..
+##.###...####..
+...#..#..#..#..
+##...###..##..#
+.##.##..#.##.#.
+.#.#.#.###..###
+#####.#.######.
+.###.####....##
+####...########
+.#..#.###....##
+#........#..#..
+#..#.#.########
+
+#...#..######.#
+#.#...#....##..
+#.#...#....##..
+#...#..######.#
+###.####.###...
+.#.#..#..#..#..
+.#.#.###...#..#
+######..#..#.#.
+.#.####..#....#
+#.....#..#.#.##
+.##...#.#.....#
+##...###..#.##.
+...#...##.#..#.
+#.#.#..#.##.#..
+#.#.#..#.##.#..
+...#...##.#..#.
+##..####..#.##.
+
+#.#.##..#..
+...###..###
+.####.##.##
+##..##..##.
+##.########
+.###.####.#
+####......#
+.#...#..#..
+###...##...
+##...#..#..
+##.#.#..#.#
+##.#.#..#.#
+##...#..#..
+
+..#.##.###.
+..#.##.###.
+#.######.##
+.#..#..###.
+.#.#.......
+.#.#.......
+.#..#..#.#.
+#.######.##
+..#.##.###.
+
+###........######
+..#.#....#.#....#
+.#.##....##.#..#.
+###.##..##.######
+...##.##.##......
+..##......###..##
+.#.########.#..#.
+.##..#..#..##..##
+##..#....#..####.
+.##.#.##.#.##..##
+.###..##..###..##
+##.#......#.####.
+###........######
+.#.########.#..#.
+.##...##...##..##
+
+#.#.#.#..#.###.
+##....##.#.#...
+#.#.###.#.....#
+..##.##..###.##
+..#############
+..#######....##
+..#....##.####.
+..#....##.####.
+..#######....##
+..#############
+..##..#..###.##
+#.#.###.#.....#
+##....##.#.#...
+#.#.#.#..#.###.
+#.#.#.#..#.###.
+
+........###.###.#
+........###.###.#
+.#.##.#..##..#.#.
+###..###.#.#.##.#
+##..#.##.#####...
+..#..#..#..###.##
+...##....#.##..##
+##....##.####....
+#.#..#.##.#.##..#
+
+....#.#.###.#..
+.##........####
+.##.##..#.##.##
+####.#...#..#..
+.......##.##.##
+####..##.#..###
+.##..###..##.##
+...#.##.#....##
+....####.#.#...
+#..#######..#..
+#..###....#.###
+.....#..#.#.###
+.##...#.###..##
+.......#..##.##
+#..#..##...####
+.##.##.###.....
+#..#.##.#.#....
diff --git a/2023/day13/src/lib.rs b/2023/day13/src/lib.rs
new file mode 100644
index 0000000..03af2b8
--- /dev/null
+++ b/2023/day13/src/lib.rs
@@ -0,0 +1,146 @@
+pub fn part1(input: &str) -> u32 {
+ let mut res: u32 = 0;
+
+ let m: Vec<Vec<String>> = input
+ .trim_end()
+ .split("\n\n")
+ .map(|x| {
+ x.split('\n')
+ .map(|y| y.chars().collect::<String>())
+ .collect()
+ })
+ .collect();
+
+ for s in m {
+ let n = s.len();
+
+ // Search by column
+ // 012345678
+ // ><
+ // #.##..##.
+ // ..#.##.#.
+ // ##......#
+ // ##......#
+ // ..#.##.#.
+ // ..##..##.
+ // #.#.##.#.
+ // ><
+ // 012345678
+ //
+ let m = s[0].len();
+ let mut mc = 0;
+ for i in 0..m {
+ let mut j = m - 1;
+ while j > i {
+ let mut s1 = String::new();
+ let mut s2 = String::new();
+ for k in 0..n {
+ s1.push(s[k].chars().nth(i).unwrap());
+ s2.push(s[k].chars().nth(j).unwrap());
+ }
+ if s1 == s2 {
+ mc = std::cmp::max(mc, i);
+ }
+ j -= 1;
+ }
+ }
+
+ let mut check = true;
+
+ let mut i = mc;
+ let mut j = mc + 1;
+
+ while i > 0 && j < n {
+ let mut s1 = String::new();
+ let mut s2 = String::new();
+ for k in 0..n {
+ s1.push(s[k].chars().nth(i).unwrap());
+ if j >= s[k].len() {
+ break;
+ }
+ s2.push(s[k].chars().nth(j).unwrap());
+ }
+ if s1 != s2 {
+ check = false;
+ break;
+ }
+ i -= 1;
+ j += 1;
+ }
+
+ if check {
+ res += (mc + 1) as u32;
+ continue;
+ }
+
+ // Search by row
+ let mut mc = 0;
+ for i in 0..(n / 2) + 1 {
+ for j in ((n / 2)..n).rev() {
+ if s[i] == s[j] {
+ mc = std::cmp::max(mc, i);
+ }
+ }
+ }
+
+ let mut check = true;
+
+ let mut i = mc;
+ let mut j = mc + 1;
+
+ while i > 0 && j < n {
+ if s[i] != s[j] {
+ check = false;
+ break;
+ }
+ i -= 1;
+ j += 1;
+ }
+
+ if check {
+ res += (mc + 1) as u32 * 100;
+ continue;
+ }
+ }
+
+ res
+}
+
+// pub fn part2(input: &str) -> u32 {
+// let mut res: u32 = 0;
+//
+// res
+// }
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn example_part1() {
+ let input = include_str!("../example.txt");
+ let result = part1(input);
+ assert_eq!(result, 405);
+ }
+
+ #[test]
+ fn input_part1() {
+ let input = include_str!("../input.txt");
+ let result = part1(input);
+ assert_eq!(result, 2331);
+ }
+ //
+ // #[test]
+ // fn example_part2() {
+ // let input = include_str!("../example.txt");
+ // let result = part2(input);
+ // assert_eq!(result, 2286);
+ // }
+ //
+ // #[test]
+ // fn input_part2() {
+ // let input = include_str!("../input.txt");
+ // let result = part2(input);
+ // assert_eq!(result, 71585);
+ // }
+}