Mercurial > lbo > hg > aoc22
changeset 66:2746741a49f6
Day 13 Part 1
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Sat, 23 Dec 2023 19:58:38 +0100 |
parents | f2fb41098579 |
children | b4d590e70ccd |
files | 2023/day13.ml 2023/dune 2023/input/13.txt 2023/input/13_test.txt |
diffstat | 4 files changed, 1477 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/2023/day13.ml Sat Dec 23 19:58:38 2023 +0100 @@ -0,0 +1,112 @@ +open Angstrom +open Base +open Core + +type tile = Ash | Rocks [@@deriving sexp, show, eq] + +(* A field consists of a tile array of size rows * cols *) +type field = { rows : int; cols : int; tiles : tile array } +[@@deriving sexp, show] + +(* convert indices and access field. *) + +let ix_of_rc field r c = (r * field.cols) + c +let rc_of_ix field ix = (ix / field.cols, ix mod field.cols) +let tile_at field r c = field.tiles.(ix_of_rc field r c) + +module Parse = struct + let maybe p = p >>| (fun _ -> ()) <|> return () + let parse_tile = char '.' >>| (fun _ -> Rocks) <|> (char '#' >>| fun _ -> Ash) + + let parse_field = + let parse_row = many1 parse_tile in + let parse_rows = sep_by1 (char '\n') parse_row in + let parse_field rows = + let cols = List.hd_exn rows |> List.length in + let tiles = List.concat rows |> Array.of_list in + { rows = List.length rows; cols; tiles } + in + parse_rows >>| parse_field + + let parse_fields = sep_by1 (string "\n\n") parse_field <* maybe (char '\n') +end + +module Part1 = struct + let get_column field c = Array.init field.rows ~f:(fun r -> tile_at field r c) + let get_row field r = Array.init field.cols ~f:(fun c -> tile_at field r c) + + (* check if mirror axis exists between columns c and c+1 (one-based) *) + let check_mirror_v field c = + let rec check_with_off field c off = + if c - off - 1 < 0 || c + off >= field.cols then + off > 0 && off < field.cols + else + let left = get_column field (c - off - 1) + and right = get_column field (c + off) in + Array.equal equal_tile left right && check_with_off field c (off + 1) + in + check_with_off field c 0 + + (* check if mirror axis exists between rows r and r+1 (one-based) *) + let check_mirror_h field r = + let rec check_with_off field r off = + if r - off - 1 < 0 || r + off >= field.rows then + off > 0 && off < field.rows + else + let top = get_row field (r - off - 1) + and bottom = get_row field (r + off) in + Array.equal equal_tile top bottom && check_with_off field r (off + 1) + in + check_with_off field r 0 + + (* check if mirror axis exists between any rows r and r+1 (one-based), + and return r. *) + let check_any_h field = + let rows = List.range 1 (field.rows + 1) in + List.find rows ~f:(fun r -> check_mirror_h field r) + + (* check if mirror axis exists between any columns c and c+1 (one-based), + and return c. *) + let check_any_v field = + let cols = List.range 1 (field.cols + 1) in + List.find cols ~f:(fun c -> check_mirror_v field c) + + (* a symmetry may be either horizontal or vertical or both. + The integer signifies the row/column to the left/top of the + symmetry line. *) + type symmetry = { horizontal : int option; vertical : int option } + [@@deriving sexp, show] + + let check field = + let horizontal = check_any_h field in + let vertical = check_any_v field in + { horizontal; vertical } + + (* check symmetry for all fields *) + let check_all fields = List.map fields ~f:check + + (* calculate score for a single symmetry according to the puzzle rules. *) + let symmetry_to_score { horizontal; vertical } = + let h = Option.value ~default:0 horizontal in + let v = Option.value ~default:0 vertical in + v + (100 * h) + + (* calculate score for each symmetry and sum them up *) + let symmetries_to_score symmetries = + List.map symmetries ~f:symmetry_to_score |> List.fold ~init:0 ~f:( + ) +end + +let () = + let inp = In_channel.(input_all stdin) in + let fields = + Angstrom.parse_string ~consume:All Parse.parse_fields inp + |> Result.ok_or_failwith + in + (* let fields_str = List.map fields ~f:show_field |> String.concat ~sep:"\n\n" in *) + let symmetries = Part1.check_all fields in + (* let symmetries_str = + List.map symmetries ~f:Part1.show_symmetry |> String.concat ~sep:"\n" *) + let score = Part1.symmetries_to_score symmetries in + Out_channel.((*printf "field: %s\n" fields_str;*) + printf "score = %d\n" score) +
--- a/2023/dune Sat Dec 23 17:29:13 2023 +0100 +++ b/2023/dune Sat Dec 23 19:58:38 2023 +0100 @@ -93,3 +93,10 @@ (libraries base core angstrom) (preprocess (pps ppx_let ppx_sexp_conv ppx_compare ppx_deriving.show ppx_deriving.eq))) + +(executable + (name day13) + (modules day13) + (libraries base core angstrom) + (preprocess + (pps ppx_let ppx_sexp_conv ppx_compare ppx_deriving.show ppx_deriving.eq)))
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/2023/input/13.txt Sat Dec 23 19:58:38 2023 +0100 @@ -0,0 +1,1343 @@ +##.#.#####..... +##...##.###.### +##...##.###.### +##.#.#####..... +.##...#.#...#.. +##..#...#..##.. +###.######....# +.##.######..### +#...#...###.... +..#.....#.##... +....#......#.## + +.#.###.#. +.##.#..## +...##.... +...##.... +.##.#..## +.#.###.#. +#.##..#.. +#..#..#.. +#.###.### +#.###.### +#..#..... +#.##..#.. +.#.###.#. +.##.#..## +...##.... + +.##.#.##. +....###.. +.##.####. +........# +....##.## +.....#..# +......#.. +#..##.#.# +....##### +####..### +.##.#.### +....###.. +....###.. +.##.#.### +#####.### +....##### +#..##.#.# + +#...##.##.. +#...##.##.. +.#.#..###.. +##.#.#.##.. +.#.####..## +.##.##.#..# +#.#####.##. +.#.#.#..#.# +..#...#.#.. +.#####..#.. +##...#.#... +##...#.#... +.#####..#.. +..##..#.#.. +.#.#.#..#.# +#.#####.##. +.##.##.#..# + +.#.#####..#####.# +..####.#..#.####. +#.##############. +..#.#######.##.#. +...#.#.####.#.#.. +..##..#....#..##. +..#....#..#....#. +#.##..........##. +#..#.#......#.#.. +#.###.######.###. +.##..###..###..## +..#.#.##..##.#.#. +###..##.##.##..## +##...##.##.##...# +##...##.##.##...# + +.........##..##.. +........#..##..#. +.######..######.. +..#..#..##.##.##. +.###.##..#.##.#.. +###..####.####.## +##....##.#....#.# + +#...###.#.##.#. +...#...#.#..#.# +.#.#.#.##.##.## +.##.###.######. +...###...####.. +....#.#........ +###.#.#.#....#. +...#.#......... +#....#..#.##.#. +#..#.#..#.##.#. +...#.#......... +###.#.#.#....#. +....#.#........ + +.###.#..#.###...# +.###......###..#. +....######....##. +##.###..###.##.## +###.##..##.###.#. +###.##..##.###.#. +##.###..###.##.## +....######....##. +.###......###.##. +.###.#..#.###...# +##.#.####.#.##.#. + +.###### +#....## +.....## +.###### +#..#### +##..### +.##.##. +..###.# +.##..## +..#.#.# +#.###.. +#..#.## +#..#.## + +.##..##..##.###.. +#..###.###..#.### +.######..#.###... +#.####.###.#....# +........#.....#.# +#.#..#.#....#.#.# +#.#..#.#....#.#.# + +...##.. +#.##... +#.##... +...##.. +#...### +.#.#..# +###.#.. + +...##..##...### +..#..##..#...## +..########...#. +.#........#.### +############.## +..###..###..### +##.#....#.##..# +##.#.##.#.##### +...######...##. +##..#..#..###.. +##..#..#..###.# +###.#..#.#####. +###.#..#.###... +..##....##...## +..#..##..#..... +##...##...##..# +##........##### + +..#..#....#..#..# +.....######.....# +#..####..####..## +##...#.##.#...##. +##...#.##.#...##. +#..####..####..## +.....######.....# +..#..#....#..#..# +#....######....#. +.####.#..#.####.# +......####....... +#.#..........#.## +.#.#.#....#.###.. + +....#....#. +#..######## +####.#..#.# +#..###..### +#..###..### +.#...#..#.. +####..##..# +######..### +....######. + +..##.##.##. +..##.##.##. +########... +.#.#..##### +...#.#.#..# +#..######## +#.#####.##. +###....#### +##...#.#### +.###.#..##. +.####.##..# +..#.##.#..# +###...##### + +####.....#. +...####.##. +#.#.##.#..# +##..##.#..# +.####.#.##. +#######.##. +.#.###..... +..####.#..# +..####.#..# + +...#....#.... +####.##.##### +...######.... +.###.##.###.. +##.##..##.### +.##.####..#.. +###......#### +...#.##.#.... +#.###..###.## +....#..#..... +..##....##... +#.##....##.## +#...#..#...## +.##..##..##.. +#..........## +...#.##.#.... +..#.####.#... + +.#.#.##....## +....#.#.##.#. +###....####.. +#####..#..#.. +#.###..#..#.. +###....####.. +....#.#.##.#. +.#.#.##....## +#.#.#.#.##.#. +#...##......# +..#.####..### +.#.....#..#.. +##..##.####.# +#.#.###....## +.##.##......# +.##.#.#....#. +##..###....## + +####.##..##.#.# +####.##..##.#.# +.#.#.#..##.#... +.#...#######.#. +.#.#..##...#..# +.#.#####...##.# +.##.######.##.. +.....##.#..###. +..###.#..####.. +#####.#.#.#..## +#####.#.#.#...# +..###.#..####.. +.....##.#..###. + +##.#...#.##.#.### +#.#.#..##.#.#.### +#.#.#..##.#.#.### +##.#...#.##.#.### +.#...#..##..###.. +..#.#....#.####.# +#..#..##.#.#.#### +#.#...##....####. +#....##.###.###.. +#...##..#..###### +###.....##.##...# +###.....##.##...# +....##..#..###### + +####...##..#### +#..#....#..#### +......#..###..# +#..#...#.###### +#..#...#.###### +......#..###..# +#..#....#..#### +####...###.#### +.##.##.#.#..##. +#..#.#..##....# +.##..###..#.### +.##.#..##.#..## +#####..#.#..##. +######.#..#.... +#..#.######.#.# + +.#.##.....#.#.. +##..####..#.### +##..####..#.### +.#.##.....#.#.. +.##########.... +.#.#####.###.## +##..#..#..#.... +#..#..#....#### +#.#.#.#.....#.. +#....#.##..#.## +.#.##..#..#.#.. +.#.###.##.#..## +....#....##..## +........##.#... +.##.####.#.##.. +####.####....## +####.#.#.....#. + +######.## +.#..#.#.. +.#..#.#.. +######.## +..##..#.# +######..# +.####.... +#.##.#... +##..##.## +.#..#.... +#.####..# +######..# +.####..#. + +#.######. +#.####.#. +#.####.#. +#.######. +.##..#..# +.#.#.###. +###....#. + +.##..#.###.#. +...###.#.##.. +#..#...#####. +#..#...#####. +...###.#.##.. +.##..#.###.#. +#.#####.###.# +#.#.##..####. +#....#####... +.#.#.##...##. +#.#......#..# +.##.###..###. +....#..##.#.. +#.######..#.. +....#...#..## +....#...#..## +#.######..... + +.....#.#### +#......###. +.####.#..#. +#.###..#..# +#.###..#..# +.####.#..#. +#......##.. +.....#.#### +.....#.#### +#......##.. +.####.#..#. + +....#.#..## +#..#.###... +#####.##### +....##.#.#. +........##. +.##...#.##. +.##.##..### +#..#.#..##. +.##.##.#### +.##..#..... +.#..##...## +#..#.###... +.....#..### +.##....#... +....####### +....####### +.##....#... + +#.###...#.....##. +##.##.###...#..## +###..###..#####.# +###..###..#.###.# +##.##.###...#..## +#.###...#.....##. +##..##..#....#... +..#......#.##..#. +..#......#.##..#. +##..##..#....#... +#.###...#.....##. +##.##.###...#..## +###..###..#.###.# +###..###..#####.# +##.##.###...#..## +#.###...#.....##. +##....##..####... + +.##.#.#.####.#. +....#...#..#... +####..#.####.#. +####.#...##...# +######.#.##.#.# +#########..#### +#..###..####... +#..#.#.##..##.# +#..####......## +.....##......## +.....########## + +...###.######.### +#..###...##...### +#.#..###....###.. +####..########... +##.#.#...##...#.# +.#.#.....##.....# +..############### +###.###.####.###. +##.#.##########.# +#.......#..#..... +..##.#..####..#.# +###..#.##..##.#.. +####.####..####.# +####.####..####.# +###..#.##..##.#.. + +...#.#.## +#..###..# +##..####. +.....#### +.....#### +##..####. +#..###..# +...#.#.#. +.#..##..# +#.#.#.### +.####.#.# +.####.#.# +#.#.#.### +.#..##..# +...#.#.#. + +##..... +##..... +##..##. +##..... +..##..# +.#.#... +.##.##. +#...... +#..#### +###.... +..#.... +...#### +#...##. +##.#### +....##. + +#...#.. +#...#.. +.....#. +###.### +.#.#..# +.#.#... +###.### +.....#. +#...#.. + +##..#.#..##.#.# +#.#.###..##.#.. +##.....#..###.. +..#.#...#.#..## +###.#.....##... +#.##......#.#.. +.#..##.#...#### +.#..##.#...#### +#.##......#.#.. +###.#.....##... +..#.#...#.#..## +##.....#..###.. +#.#.###..##.#.. + +#..#.#..#.# +....#....#. +###..#..#.. +#..##.##.## +####.#..#.# +.##.#.##.#. +####.#..#.# + +##.###.#..# +#####.##### +#####.##### +##.#.#.#..# +#.#..#..... +#.####.#### +.#...#..... +#..#.##.##. +#..#..#.... +..###.##### +###..#..... + +##....#.. +###.##... +.#..##... +..##.#.## +..##.#... +..##.#... +.###.#.## +.#..##... +###.##... +##....#.. +.##...#.. +###.#.#.. +.####.### +###..#### +..#.###.. + +#..#...## +.....##.. +#..###... +######... +####..... +......#.# +.....##.. + +##....######.###. +.##..##.####..... +.##..##.####..... +##....######.###. +..#..#..####.##.. +..........###..## +###..###.#...#... +..........#.###.. +#.#..#.#....##... +...##...#.#....#. +#..##..##..##.### +...##.#.#.#.##... +#..##..##.##.###. + +.#.#..# +.#.#..# +#....#. +#..#.## +##.#..# +..#...# +#.#.#.# +#....## +##..#.# +##..#.# +#.#..## + +....#.### +#..###### +#..###### +....#.### +#..#..... +#..#.#### +.##..#.#. +.##.##.#. +#..#####. +.##.#.##. +#..###### +.##.##.#. +.##..#.## +#######.# +###.###.# +....###.. +####.#... + +.##...... +#.##...## +....#.#.. +.##..##.# +####..### +.##...... +.....#.#. +####.##.. +.##..##.# +.##..##.# +####.##.. +.....#.#. +.##...... + +.#.##...# +##.###... +##..##... +.#.##...# +..#..#### +#...##.## +#.#.##..# +#.#..###. +####...#. +###.#.##. +##...#### +###.#...# +.#.#....# +.#.#....# +###.#...# +##...#### +###.#.##. + +####..###..##.. +.##....##.####. +.##....##..##.. +....#..#..#..#. +#..##.###.####. +#..#........... +.##.#...#..##.. +.......#....... +######.###....# +......#..#.##.# +#..#..#.#...... +....#..##.#..#. +.##.######.##.# +.###.#.###.##.# +.##..####.####. + +####.##..##.... +.....#.##...... +.....#.#.....## +........####.#. +######...#....# +......#..#..### +.##.#.#..##.#.# + +###.######.#### +##.###..###.### +#.##.#..#.##.## +.#..######..#.. +....#.##.#..#.. +####..##..##### +.#.#..##..#.#.. +......##....... +..###.##.###... +##.#..##..#.### +.####.##.####.. +#.#..####..#.## +.#...#..#...#.. +...########.... +#...######...## +..#........#... +#.#.#....#.#.## + +....#..#.#... +#..#.#.#.#.## +.#.#.#.###... +.#.#.#.#.#... +#..#.#.#.#.## +....#..#.#... +##.#.##.#.### +#..#..#..#.## +#.####..#..## +#.#.#.###.... +..###.#.#.... + +#.##..##..# +#.##.##.... +##..####..# +.......#..# +.####.#.##. +##..####### +..##..#.... +#.##.###### +#....#..... +#....#.#### +########..# +......##### +........##. +#.##.#.#### +.#..#.##..# +......#.##. +......##### + +.##....#.##.#.... +#..##.#......#.## +####.##########.# +#..####.####.#### +....#.########.#. +.##....#.##.#.... +#..#.#.#....#.#.# +#..###.#.##.#.### +.##.###.####.###. +....###......###. +.##..###....###.. +....#..........#. +####.#.#.##.#.#.# +#..#...#.##.#...# +....#...#..#.#.#. +....###......###. +.##...##.##.##... + +#..######## +#######.... +.##..##...# +#..#...#..# +#..##...... +#..#...#### +#..####.... + +#.######. +#...##... +....##... +.##.##.## +#........ +#..###... +.#.####.# +##.#..#.# +#.#....#. +#.#....#. +.##....## +.##....## +#.#....#. + +#####.. +####... +..##... +...#... +...#... +.###... +.###### +....### +.##.... +#..#... +#.###.. +.#.#... +.##..## + +.#..#.### +#.##.#### +#....#.## +#....#### +##.####.. +######.## +..##..... + +..######### +..##.###..# +##.#..#.... +##..###.##. +.#.....#### +....#...... +##.#####..# +####.#..... +####..#.... +##......##. +##.#.#..##. +##.#..#.##. +....#.#.##. +#######.##. +####...#### + +.##.#.....##. +....##.#.#..# +#..#..##.#... +#..#.##...#.. +....#.#.#.### +#######.#..## +.##..######.# +#..###.##...# +#..###.##...# +.##..######.# +#######.#..## +....#.#.#.#.# +#..#.##...#.. + +....#....#.## +#....#.#..##. +.#.##..#.###. +.#.#..####..# +.#.#..####..# +.#.##....###. +#....#.#..##. +....#....#.## +.###.###.#.## +....#.####..# +....#.####..# + +####.#....... +#.#.###.####. +.#..##.####.. +.....#.#....# +.#.#...##...# +.#.#...##...# +.....#.#....# +.#..##.####.. +#.#.###.####. +####.#....... +..#.....#.#.. +#.#..#.##...# +#...#......#. +##.#..####.## +.#.#..####.## + +....#.#.#...... +#..##......##.. +.##..#####.##.# +.##..###...##.. +####...#....... +########..#..#. +#####.#....##.. +.......#.##..## +####....#..#... +####...##...... +.##..##..#.##.# +#..#..###.####. +.##....###.##.# +#..#...##..##.. +.##.#.#..#....# + +######..#.#.### +...##..#....##. +.#...#...##..#. +#....#.##..#..# +#....#.##..#..# +.#...#...##..#. +...##..#....##. +######.##.#.### +#####.#.###...# +.####.#....#.## +####.#..##.#..# +#######.#.#.#.# +#######.#.#.#.# + +##..#######.... +#.######....... +#####...##...## +..#.#.#.#..#... +##..#..#..##... +...#.....##.#.. +###.#.#.#..#... +...#..#...##.## +####.###.###... + +#.###.. +#.###.# +##..##. +......# +..##... +#....#. +#....#. + +#.#.##.#.#.#.##.# +...##.##.##..##.. +...##.##.##..##.. +#.#.##.#.#.#.##.# +###.###...##.##.# +.#..##...######## +###.###.......... +.#.###.##...##.#. +.#.##.##.#..#..#. +....###..###.##.# +..##.#...#..####. +.##.####.#.#....# +##..#.##.##...... + +######.###### +###...####### +###...####### +###.##.###### +###..#.##.##. +.#.##.##..... +..#..####.... +....###...... +..#..######## +###.####.#..# +.#.#.##.#.... + +.#...###### +.#.#.###### +#...#..##.. +#..##.####. +#####...... +#.#..###### +#.....####. +...##.#..#. +#.##.##..## +.###...##.. +###.##.##.# +..###.####. +#.#####..## + +.#.######.#...# +.#.######.#...# +#.##.#..##.###. +..##....##..#.. +#.#......#.#### +###.####.####.# +...#.##.#...... + +.##........## +##.#.####.#.# +##.#.#..#.#.# +##.###..###.# +##.###..###.# +##.#.#..#.#.# +##.#.####.#.# +.##........## +##....##....# +.##.######.## +######..##### +.###......### +....#.##.#... +#####....#### +#..##.##.##.. +..##.....###. +#.#..#..#..#. + +.#..#....#. +.##...##... +.##...##... +##..#....#. +...##....## +.##........ +#####....## +#####.##.## +####.####.# +..####..### +.#####..### +.#......... +.#.#......# + +..##### +#..##.. +###.#.. +..##.## +##.#### +...#... +..#.#.. +##..#.# +#..##.. +.####.. +.####.. + +...#.#.##..#.#### +###.#.#######.##. +.##.###..##....#. +##....###...###.# +.#.#.##..##....## +##..#...#.#.#...# +##..#...#.#.#...# +.#.#.##..##....## +##....###...###.# +.##.###..##....#. +###.#.#######..#. +...#.#.##..#.#### +...#.#.##..#.#### + +######.##.#.#.. +..##.....#.#..# +######.#..###.# +.####.##.#...#. +.#..#........## +..##.....#.#... +.#..#.#.##.#..# +.####....#.###. +######....##### +.#..#..######.# +##..##.#######. +##..##.#######. +.#..#..######.# +######....##### +.####....#.###. +.#..#.#.##.#..# +..##.....#.#.#. + +####..####..#.### +#.######.###..#.. +##.#..#..#...#### +.##....##..###.## +.#......#..###### +.##....##.####.## +#...##...###.#### +##.#..#.##.#...## +..#....#......... +#........#...#.## +.###..###..#.##.. +#..####..#.###... +###....###.##.#.. +..######....##... +##.#..#.#####.... + +###..#..... +#####.##### +###..###... +.....##.##. +..##...#### +......##### +##..#...#.. +####.....## +##.....##.. +###..#.#... +....###.... +##..####... +..##.#.#.## +####.#.#... +..#.#..##.. + +#.##.#.##.#.# +.......##.... +######.##.### +######.##.##. +.####......## +.#..#.####.#. +......####... + +#..#...##.. +##.#..####. +.##.#..##.. +.##...#..#. +....#.####. +.##.##.##.# +######.##.# +.##....##.. +.##.##.##.# + +..####...#..#...# +#..##..#..##..#.. +#########....#### +...##............ +#....#.##....##.# +.#....#...##...#. +#.#..#.#......#.# + +.#....#..#. +.######..## +.#.##...... +..#..#....# +#......##.. +##.##.####. +#..##..##.. + +..#####..#..#..## +...##.####..####. +##...#...####...# +....###........## +##.####.##..##.## +##..####......### +###..#..#.##.#..# +...######....#### +##...#.#.#..#.#.# +...####..####...# +....#.#...##...#. +###.###.#....#.## +..#..#....##....# +..####.#..##..#.# +##..#............ + +####.#. +##..#.# +###..#. +..##.## +..#.#.. +..##.#. +##.#.#. +.....#. +##..##. +##..##. +.....#. +##.#.#. +..##.#. +..#.... +..##.## + +###.#...#.#.##. +##....###.##### +....########### +###........#### +##.#.#..####### +####.#.#.#..... +###.######.#..# +..##.....#..... +..#.##.#...#..# +...###.###..##. +.#......####### + +#.####. +####..# +#####.. +....##. +#..###. +####..# +####..# + +.##.#..#.##.# +.##..##..##.. +....#..#..... +####....####. +#..######..#. +####....####. +.##......##.. +.##.#..#.##.. +#..#....#..## +#..######..#. +............# +...#....#.... +.##.#..#.##.. +#..#....#..## +#..##..##..#. + +...#####.##.##. +##....#.#..#.#. +####.##..##..## +##.#..#..##..#. +##..####....### +..####........# +...#.#...##...# +##...##.####.## +..#.#.########. +##...#..####..# +####.#........# + +..###....#. +.....#####. +#.#.###..#. +####....### +####.###.## +#...#....#. +.#..##....# +.#..##....# +#...#....#. +####.###.## +####....### +#.#.###..#. +.....#####. +..##.....#. +.##....##.# +######..### +######..### + +##...#......#...# +#...##......##... +###...##..##...## +#.#..########..#. +#.#..########..#. +###...##..##...## +#...##......##... +##...#......#...# +#####..####..#### +####..##..##..### +##..##......##..# +.#.#....##....#.# +#.#.#.######.###. +#.#...#....#...#. +..#...##..##...#. +..#.#..####..#.#. +...#...#..#...#.. + +#.#.##.#.## +#...##...## +#########.. +.#.####.#.. +..######... +#.#.##.#.## +#..#..#..## +....##..... +.#.####.#.. + +#.#.#..##..#.#. +.##..#.##.#..## +.##..#.##.#..## +#.#.#..##..#.#. +.#.#..#####.#.# +##.#........#.# +.#.###....###.# +#..#........#.. +...#..#..#..#.. + +#..#..####.#.## +.#....#.###...# +##..##.######.. +.##..####..#.## +##...###.#....# +##...###.#....# +.##..####..#.## +##..##.######.. +.#....#.###...# +#..#..####.#.## +###.....#..#.#. +###.....#..#.#. +#..#..#.##.#.## +.#....#.###...# +##..##.######.. + +######.##.### +....#.####.#. +..##.#.##.#.# +##.##.####.## +..####....### +####........# +..##........# +....#.#..#.#. +##.###.##.### +..#...####... +..##.#....#.# +....#.#.##.#. +###..#.##.#.. + +#..#.#.#.##.#.# +#..#.#.#.##.#.# +####..#..#####. +...#.##.##.##.. +.##....#####.## +.....####.#..## +#####..#.#..... + +#....#.#... +#######...# +######....# +#....#.#... +#######..## +........#.. +.####....#. + +##.#..#.### +....##..... +...####.... +..#.##.#... +.#.###..#.. +#.#.##.#.## +.##.##.##.. +.###..###.. +.##....##.. +####..##### +###.##.#### +.#.####.#.. +.#.#..#.#.. +#..####..## +###.##.#### +.##.##.##.. +#.#....#.## + +##..##..### +...#..#.... +...#..#.... +.###..###.. +.#......#.. +.#......#.. +##..##..### +..#.##.#... +.##....##.. +.###..##... +.########.. + +##..####. +#####..## +#####..## +##..####. +.#...##.. +##.###### +#.##.##.. +#..###..# +##...#.#. +.##.###.# +##.#.##.# +####.##.# +#.##.##.# + +##.###..###.#.. +..###.#.####..# +#.##.##...#.##. +..#..#..#...#.. +..###.#.##..#.. +..###.#.##..##. +..#..#..#...#.. +#.##.##...#.##. +..###.#.####..# +##.###..###.#.. +..#.....###.### +###.#.......### +...#..#..#.#.#. +#..#..###.#.#.# +#..#..###.#.#.# + +.#......#.##.#... +#..##..#.####.#.. +#.####.##.##.##.# +#.#..#.##....##.# +###..###.####.### +.##..##.#....#.## +#.#..#.#..##..#.# +#..##..#.#..#.#.. +........######... + +....### +#..#..# +#..#..# +....### +.####.# +#.##... +####.## +.#####. +.#####. +####.## +#.##... +.####.# +#...### + +.#.###.## +.#.###.## +.#.#.##.# +##..#.### +.##..##.# +.#.##.#.. +#.###.#.# +#.###.#.# +.#.##.#.. +.##..#### +##..#.### + +#..##..#..##. +#.####.##.##. +.#.##.#.#.... +.#.##.#..#### +###..#.#..... +..#..#..##..# +.#.##.#..#..# + +###.#....#. +#..######## +...##.##.## +.#..#....#. +.###..##..# +.#.#.#..#.# +.#.#.#..#.# +.###..##..# +.#..#....#. +...##.##.## +#..######## +#.#.#....#. +##.#......# +#.....##... +##.##....## + +##...## +##...## +##.##.. +.##.##. +.###.## +#####.. +...#### +#.#.### +.###... +#...### +#.##.##