├── README.md ├── .gitignore ├── day2-rock-paper-scissors ├── test-input ├── project.clj ├── spec │ └── day2_rock_paper_scissors │ │ └── core_spec.clj └── src │ └── day2_rock_paper_scissors │ └── core.clj ├── day8-treetop-tree-house ├── test-input ├── project.clj ├── spec │ └── day8_treetop_tree_house │ │ └── core_spec.clj ├── src │ └── day8_treetop_tree_house │ │ └── core.clj └── input ├── day9-rope-bridge ├── test-input ├── test-input-2 ├── project.clj ├── spec │ └── day9_rope_bridge │ │ └── core_spec.clj ├── src │ └── day9_rope_bridge │ │ └── core.clj └── input ├── day14-regolith-reservoir ├── test-input ├── project.clj ├── spec │ └── day14_regolith_reservoir │ │ └── core_spec.clj └── src │ └── day14_regolith_reservoir │ └── core.clj ├── day4-camp-cleanup ├── test-input ├── project.clj ├── src │ └── day4_camp_cleanup │ │ └── core.clj ├── spec │ └── day4_camp_cleanup │ │ └── core_spec.clj └── input ├── day12-hill-climing-algorithm ├── test-input ├── project.clj ├── spec │ └── day12_hill_climing_algorithm │ │ └── core_spec.clj ├── input └── src │ └── day12_hill_climing_algorithm │ └── core.clj ├── day1 ├── test-input ├── project.clj ├── src │ └── day1 │ │ └── core.clj └── spec │ └── day1 │ └── core_spec.clj ├── day5-supply-stacks ├── test-input ├── project.clj ├── spec │ └── day5_supply_stacks │ │ └── core_spec.clj ├── src │ └── day5_supply_stacks │ │ └── core.clj └── input ├── day3-rucksack-reorganization ├── test-input ├── project.clj ├── src │ └── day3_rucksack_reorganization │ │ └── core.clj ├── spec │ └── day3_rucksack_reorganization │ │ └── core_spec.clj └── input ├── day13-distress-signal ├── test-input ├── project.clj ├── src │ └── day13_distress_signal │ │ └── core.clj ├── spec │ └── day13_distress_signal │ │ └── core_spec.clj └── input ├── day7-no-space-left-on-device ├── test-input ├── project.clj ├── spec │ └── day7_no_space_left_on_device │ │ └── core_spec.clj ├── src │ └── day7_no_space_left_on_device │ │ └── core.clj └── input ├── day6-tuning-trouble ├── project.clj ├── src │ └── day6_tuning_trouble │ │ └── core.clj ├── spec │ └── day6_tuning_trouble │ │ └── core_spec.clj └── input ├── day10-cathode-ray-tube ├── project.clj ├── spec │ └── day10_cathode_ray_tube │ │ └── core_spec.clj ├── input ├── test-input └── src │ └── day10_cathode_ray_tube │ └── core.clj ├── day11-monkey-in-the-middle ├── project.clj ├── test-input ├── input ├── src │ └── day11_monkey_in_the_middle │ │ └── core.clj └── spec │ └── day11_monkey_in_the_middle │ └── core_spec.clj └── day10-crt-java ├── test └── crt │ └── CrtTest.java └── src └── crt └── Crt.java /README.md: -------------------------------------------------------------------------------- 1 | # AdventOfCode2022 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .idea/* 3 | **/.idea 4 | -------------------------------------------------------------------------------- /day2-rock-paper-scissors/test-input: -------------------------------------------------------------------------------- 1 | A Y 2 | B X 3 | C Z -------------------------------------------------------------------------------- /day8-treetop-tree-house/test-input: -------------------------------------------------------------------------------- 1 | 30373 2 | 25512 3 | 65332 4 | 33549 5 | 35390 -------------------------------------------------------------------------------- /day9-rope-bridge/test-input: -------------------------------------------------------------------------------- 1 | R 4 2 | U 4 3 | L 3 4 | D 1 5 | R 4 6 | D 1 7 | L 5 8 | R 2 -------------------------------------------------------------------------------- /day9-rope-bridge/test-input-2: -------------------------------------------------------------------------------- 1 | R 5 2 | U 8 3 | L 8 4 | D 3 5 | R 17 6 | D 10 7 | L 25 8 | U 20 -------------------------------------------------------------------------------- /day14-regolith-reservoir/test-input: -------------------------------------------------------------------------------- 1 | 498,4 -> 498,6 -> 496,6 2 | 503,4 -> 502,4 -> 502,9 -> 494,9 -------------------------------------------------------------------------------- /day4-camp-cleanup/test-input: -------------------------------------------------------------------------------- 1 | 2-4,6-8 2 | 2-3,4-5 3 | 5-7,7-9 4 | 2-8,3-7 5 | 6-6,4-6 6 | 2-6,4-8 -------------------------------------------------------------------------------- /day12-hill-climing-algorithm/test-input: -------------------------------------------------------------------------------- 1 | Sabqponm 2 | abcryxxl 3 | accszExk 4 | acctuvwj 5 | abdefghi -------------------------------------------------------------------------------- /day1/test-input: -------------------------------------------------------------------------------- 1 | 1000 2 | 2000 3 | 3000 4 | 5 | 4000 6 | 7 | 5000 8 | 6000 9 | 10 | 7000 11 | 8000 12 | 9000 13 | 14 | 10000 -------------------------------------------------------------------------------- /day5-supply-stacks/test-input: -------------------------------------------------------------------------------- 1 | [D] 2 | [N] [C] 3 | [Z] [M] [P] 4 | 1 2 3 5 | 6 | move 1 from 2 to 1 7 | move 3 from 1 to 3 8 | move 2 from 2 to 1 9 | move 1 from 1 to 2 -------------------------------------------------------------------------------- /day3-rucksack-reorganization/test-input: -------------------------------------------------------------------------------- 1 | vJrwpWtwJgWrhcsFMMfFFhFp 2 | jqHRNqRjqzjGDLGLrsFMfFZSrLrFZsSL 3 | PmmdzqPrVvPwwTWBwg 4 | wMqvLMZHhHMvwLHjbvcjnnSBnvTQFn 5 | ttgJtRGJQctTZtZT 6 | CrZsJsPPZsGzwwsLwLmpwMDw -------------------------------------------------------------------------------- /day13-distress-signal/test-input: -------------------------------------------------------------------------------- 1 | [1,1,3,1,1] 2 | [1,1,5,1,1] 3 | 4 | [[1],[2,3,4]] 5 | [[1],4] 6 | 7 | [9] 8 | [[8,7,6]] 9 | 10 | [[4,4],4,4] 11 | [[4,4],4,4,4] 12 | 13 | [7,7,7,7] 14 | [7,7,7] 15 | 16 | [] 17 | [3] 18 | 19 | [[[]]] 20 | [[]] 21 | 22 | [1,[2,[3,[4,[5,6,7]]]],8,9] 23 | [1,[2,[3,[4,[5,6,0]]]],8,9] -------------------------------------------------------------------------------- /day7-no-space-left-on-device/test-input: -------------------------------------------------------------------------------- 1 | $ cd / 2 | $ ls 3 | dir a 4 | 14848514 b.txt 5 | 8504156 c.dat 6 | dir d 7 | $ cd a 8 | $ ls 9 | dir e 10 | 29116 f 11 | 2557 g 12 | 62596 h.lst 13 | $ cd e 14 | $ ls 15 | 584 i 16 | $ cd .. 17 | $ cd .. 18 | $ cd d 19 | $ ls 20 | 4060174 j 21 | 8033020 d.log 22 | 5626152 d.ext 23 | 7214296 k -------------------------------------------------------------------------------- /day1/project.clj: -------------------------------------------------------------------------------- 1 | (defproject day1 "0.1.0-SNAPSHOT" 2 | :description "FIXME: write description" 3 | :url "http://example.com/FIXME" 4 | :license {:name "Eclipse Public License" 5 | :url "http://www.eclipse.org/legal/epl-v10.html"} 6 | :main day1.core 7 | :dependencies [[org.clojure/clojure "1.8.0"]] 8 | :profiles {:dev {:dependencies [[speclj "3.3.2"]]}} 9 | :plugins [[speclj "3.3.2"]] 10 | :test-paths ["spec"]) 11 | -------------------------------------------------------------------------------- /day9-rope-bridge/project.clj: -------------------------------------------------------------------------------- 1 | (defproject day9-rope-bridge "0.1.0-SNAPSHOT" 2 | :description "FIXME: write description" 3 | :url "http://example.com/FIXME" 4 | :license {:name "Eclipse Public License" 5 | :url "http://www.eclipse.org/legal/epl-v10.html"} 6 | :main day9-rope-bridge.core 7 | :dependencies [[org.clojure/clojure "1.8.0"]] 8 | :profiles {:dev {:dependencies [[speclj "3.3.2"]]}} 9 | :plugins [[speclj "3.3.2"]] 10 | :test-paths ["spec"]) 11 | -------------------------------------------------------------------------------- /day4-camp-cleanup/project.clj: -------------------------------------------------------------------------------- 1 | (defproject day4-camp-cleanup "0.1.0-SNAPSHOT" 2 | :description "FIXME: write description" 3 | :url "http://example.com/FIXME" 4 | :license {:name "Eclipse Public License" 5 | :url "http://www.eclipse.org/legal/epl-v10.html"} 6 | :main day4-camp-cleanup.core 7 | :dependencies [[org.clojure/clojure "1.8.0"]] 8 | :profiles {:dev {:dependencies [[speclj "3.3.2"]]}} 9 | :plugins [[speclj "3.3.2"]] 10 | :test-paths ["spec"]) 11 | -------------------------------------------------------------------------------- /day5-supply-stacks/project.clj: -------------------------------------------------------------------------------- 1 | (defproject day5-supply-stacks "0.1.0-SNAPSHOT" 2 | :description "FIXME: write description" 3 | :url "http://example.com/FIXME" 4 | :license {:name "Eclipse Public License" 5 | :url "http://www.eclipse.org/legal/epl-v10.html"} 6 | :main day5-supply-stacks.core 7 | :dependencies [[org.clojure/clojure "1.8.0"]] 8 | :profiles {:dev {:dependencies [[speclj "3.3.2"]]}} 9 | :plugins [[speclj "3.3.2"]] 10 | :test-paths ["spec"]) 11 | -------------------------------------------------------------------------------- /day6-tuning-trouble/project.clj: -------------------------------------------------------------------------------- 1 | (defproject day6-tuning-trouble "0.1.0-SNAPSHOT" 2 | :description "FIXME: write description" 3 | :url "http://example.com/FIXME" 4 | :license {:name "Eclipse Public License" 5 | :url "http://www.eclipse.org/legal/epl-v10.html"} 6 | :main day6-tuning-trouble.core 7 | :dependencies [[org.clojure/clojure "1.8.0"]] 8 | :profiles {:dev {:dependencies [[speclj "3.3.2"]]}} 9 | :plugins [[speclj "3.3.2"]] 10 | :test-paths ["spec"]) 11 | -------------------------------------------------------------------------------- /day13-distress-signal/project.clj: -------------------------------------------------------------------------------- 1 | (defproject day13-distress-signal "0.1.0-SNAPSHOT" 2 | :description "FIXME: write description" 3 | :url "http://example.com/FIXME" 4 | :license {:name "Eclipse Public License" 5 | :url "http://www.eclipse.org/legal/epl-v10.html"} 6 | :main day13-distress-signal.core 7 | :dependencies [[org.clojure/clojure "1.8.0"]] 8 | :profiles {:dev {:dependencies [[speclj "3.3.2"]]}} 9 | :plugins [[speclj "3.3.2"]] 10 | :test-paths ["spec"]) 11 | -------------------------------------------------------------------------------- /day10-cathode-ray-tube/project.clj: -------------------------------------------------------------------------------- 1 | (defproject day10-cathode-ray-tube "0.1.0-SNAPSHOT" 2 | :description "FIXME: write description" 3 | :url "http://example.com/FIXME" 4 | :license {:name "Eclipse Public License" 5 | :url "http://www.eclipse.org/legal/epl-v10.html"} 6 | :main day10-cathode-ray-tube.core 7 | :dependencies [[org.clojure/clojure "1.8.0"]] 8 | :profiles {:dev {:dependencies [[speclj "3.3.2"]]}} 9 | :plugins [[speclj "3.3.2"]] 10 | :test-paths ["spec"]) 11 | -------------------------------------------------------------------------------- /day8-treetop-tree-house/project.clj: -------------------------------------------------------------------------------- 1 | (defproject day8-treetop-tree-house "0.1.0-SNAPSHOT" 2 | :description "FIXME: write description" 3 | :url "http://example.com/FIXME" 4 | :license {:name "Eclipse Public License" 5 | :url "http://www.eclipse.org/legal/epl-v10.html"} 6 | :main day8-treetop-tree-house.core 7 | :dependencies [[org.clojure/clojure "1.8.0"]] 8 | :profiles {:dev {:dependencies [[speclj "3.3.2"]]}} 9 | :plugins [[speclj "3.3.2"]] 10 | :test-paths ["spec"]) 11 | -------------------------------------------------------------------------------- /day14-regolith-reservoir/project.clj: -------------------------------------------------------------------------------- 1 | (defproject day14-regolith-reservoir "0.1.0-SNAPSHOT" 2 | :description "FIXME: write description" 3 | :url "http://example.com/FIXME" 4 | :license {:name "Eclipse Public License" 5 | :url "http://www.eclipse.org/legal/epl-v10.html"} 6 | :main day14-regolith-reservoir.core 7 | :dependencies [[org.clojure/clojure "1.8.0"]] 8 | :profiles {:dev {:dependencies [[speclj "3.3.2"]]}} 9 | :plugins [[speclj "3.3.2"]] 10 | :test-paths ["spec"]) 11 | -------------------------------------------------------------------------------- /day2-rock-paper-scissors/project.clj: -------------------------------------------------------------------------------- 1 | (defproject day2-rock-paper-scissors "0.1.0-SNAPSHOT" 2 | :description "FIXME: write description" 3 | :url "http://example.com/FIXME" 4 | :license {:name "Eclipse Public License" 5 | :url "http://www.eclipse.org/legal/epl-v10.html"} 6 | :main day2-rock-paper-scissors.core 7 | :dependencies [[org.clojure/clojure "1.8.0"]] 8 | :profiles {:dev {:dependencies [[speclj "3.3.2"]]}} 9 | :plugins [[speclj "3.3.2"]] 10 | :test-paths ["spec"]) 11 | -------------------------------------------------------------------------------- /day11-monkey-in-the-middle/project.clj: -------------------------------------------------------------------------------- 1 | (defproject day11-monkey-in-the-middle "0.1.0-SNAPSHOT" 2 | :description "FIXME: write description" 3 | :url "http://example.com/FIXME" 4 | :license {:name "Eclipse Public License" 5 | :url "http://www.eclipse.org/legal/epl-v10.html"} 6 | :main day11-monkey-in-the-middle.core 7 | :dependencies [[org.clojure/clojure "1.8.0"]] 8 | :profiles {:dev {:dependencies [[speclj "3.3.2"]]}} 9 | :plugins [[speclj "3.3.2"]] 10 | :test-paths ["spec"]) 11 | -------------------------------------------------------------------------------- /day12-hill-climing-algorithm/project.clj: -------------------------------------------------------------------------------- 1 | (defproject day12-hill-climing-algorithm "0.1.0-SNAPSHOT" 2 | :description "FIXME: write description" 3 | :url "http://example.com/FIXME" 4 | :license {:name "Eclipse Public License" 5 | :url "http://www.eclipse.org/legal/epl-v10.html"} 6 | :main day12-hill-climing-algorithm.core 7 | :dependencies [[org.clojure/clojure "1.8.0"]] 8 | :profiles {:dev {:dependencies [[speclj "3.3.2"]]}} 9 | :plugins [[speclj "3.3.2"]] 10 | :test-paths ["spec"]) 11 | -------------------------------------------------------------------------------- /day3-rucksack-reorganization/project.clj: -------------------------------------------------------------------------------- 1 | (defproject day3-rucksack-reorganization "0.1.0-SNAPSHOT" 2 | :description "FIXME: write description" 3 | :url "http://example.com/FIXME" 4 | :license {:name "Eclipse Public License" 5 | :url "http://www.eclipse.org/legal/epl-v10.html"} 6 | :main day3-rucksack-reorganization.core 7 | :dependencies [[org.clojure/clojure "1.8.0"]] 8 | :profiles {:dev {:dependencies [[speclj "3.3.2"]]}} 9 | :plugins [[speclj "3.3.2"]] 10 | :test-paths ["spec"]) 11 | -------------------------------------------------------------------------------- /day7-no-space-left-on-device/project.clj: -------------------------------------------------------------------------------- 1 | (defproject day7-no-space-left-on-device "0.1.0-SNAPSHOT" 2 | :description "FIXME: write description" 3 | :url "http://example.com/FIXME" 4 | :license {:name "Eclipse Public License" 5 | :url "http://www.eclipse.org/legal/epl-v10.html"} 6 | :main day7-no-space-left-on-device.core 7 | :dependencies [[org.clojure/clojure "1.8.0"]] 8 | :profiles {:dev {:dependencies [[speclj "3.3.2"]]}} 9 | :plugins [[speclj "3.3.2"]] 10 | :test-paths ["spec"]) 11 | -------------------------------------------------------------------------------- /day11-monkey-in-the-middle/test-input: -------------------------------------------------------------------------------- 1 | Monkey 0: 2 | Starting items: 79, 98 3 | Operation: new = old * 19 4 | Test: divisible by 23 5 | If true: throw to monkey 2 6 | If false: throw to monkey 3 7 | 8 | Monkey 1: 9 | Starting items: 54, 65, 75, 74 10 | Operation: new = old + 6 11 | Test: divisible by 19 12 | If true: throw to monkey 2 13 | If false: throw to monkey 0 14 | 15 | Monkey 2: 16 | Starting items: 79, 60, 97 17 | Operation: new = old * old 18 | Test: divisible by 13 19 | If true: throw to monkey 1 20 | If false: throw to monkey 3 21 | 22 | Monkey 3: 23 | Starting items: 74 24 | Operation: new = old + 3 25 | Test: divisible by 17 26 | If true: throw to monkey 0 27 | If false: throw to monkey 1 -------------------------------------------------------------------------------- /day10-crt-java/test/crt/CrtTest.java: -------------------------------------------------------------------------------- 1 | package crt; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.assertEquals; 6 | 7 | public class CrtTest { 8 | @Test 9 | public void threeNoopsInWindow() throws Exception { 10 | Crt crt = new Crt(1); 11 | crt.doCycles(3,"noop\nnoop\nnoop"); 12 | assertEquals("###", crt.getPixels()); 13 | } 14 | 15 | @Test 16 | public void threeNoopsNotInWindow() throws Exception { 17 | Crt crt = new Crt(10); 18 | crt.doCycles(3,"noop\nnoop\nnoop"); 19 | assertEquals("...", crt.getPixels()); 20 | } 21 | 22 | @Test 23 | public void addxPositionsXAfterExecution() throws Exception { 24 | Crt crt = new Crt(1); 25 | crt.doCycles(5, "addx 4\nnoop\nnoop\nnoop"); 26 | assertEquals("##..#", crt.getPixels()); 27 | assertEquals(5, crt.getX()); 28 | } 29 | 30 | @Test 31 | public void fullScreen() throws Exception { 32 | Crt crt = new Crt(1); 33 | crt.doCycles(240, "noop\n".repeat(240)); 34 | assertEquals( 35 | "###.....................................".repeat(6), 36 | crt.getPixels()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /day1/src/day1/core.clj: -------------------------------------------------------------------------------- 1 | (ns day1.core 2 | (:require [clojure.string :as string])) 3 | 4 | (defn parse-inventory [file-name] 5 | (loop [lines (string/split-lines (slurp file-name)) 6 | input [[]] 7 | elf 0] 8 | (if (empty? lines) 9 | input 10 | (let [line (first lines)] 11 | (if (empty? line) 12 | (recur (rest lines) (conj input []) (inc elf)) 13 | (let [calories (Integer/parseInt line)] 14 | (recur (rest lines) (update-in input [elf] conj calories) elf))))))) 15 | 16 | (defn sum-calories [inventory] 17 | (map #(reduce + %) inventory)) 18 | 19 | (defn max-calories [calorie-sums] 20 | (apply max calorie-sums)) 21 | 22 | (defn find-max-calories [input-file] 23 | (let [inventory (parse-inventory input-file) 24 | calorie-sums (sum-calories inventory)] 25 | (max-calories calorie-sums))) 26 | 27 | (defn find-calories-in-top-three-elves [input-file] 28 | (let [inventory (parse-inventory input-file) 29 | sorted-calorie-sums (sort (sum-calories inventory)) 30 | three-greatest (take-last 3 sorted-calorie-sums)] 31 | (reduce + three-greatest))) -------------------------------------------------------------------------------- /day2-rock-paper-scissors/spec/day2_rock_paper_scissors/core_spec.clj: -------------------------------------------------------------------------------- 1 | (ns day2-rock-paper-scissors.core-spec 2 | (:require [speclj.core :refer :all] 3 | [day2-rock-paper-scissors.core :refer :all])) 4 | 5 | (describe "parsing input" 6 | (it "should read assumed trategy" 7 | (should= [[:rock :paper] [:paper :rock] [:scissors :scissors]] 8 | (read-assumed-strategy "test-input"))) 9 | 10 | (it "should read actual strategy" 11 | (should= [[:rock :rock] [:paper :rock] [:scissors :rock]] 12 | (read-actual-strategy "test-input")))) 13 | 14 | (describe "Playing the assumed game" 15 | (it "should score the test game" 16 | (should= 15 (score-of-strategy [[:rock :paper] [:paper :rock] [:scissors :scissors]])))) 17 | 18 | (describe "Playing the actual game" 19 | (it "should score the test game" 20 | (should= 12 (score-of-strategy [[:rock :rock] [:paper :rock] [:scissors :rock]])))) 21 | 22 | (describe "solutions" 23 | (it "solves the assumed strategy (part 1)" 24 | (should= 10994 (play-assumed-strategy "input"))) 25 | 26 | (it "solves the actual strategy (part 2)" 27 | (should= 12526 (play-actual-strategy "input")))) -------------------------------------------------------------------------------- /day1/spec/day1/core_spec.clj: -------------------------------------------------------------------------------- 1 | (ns day1.core-spec 2 | (:require [speclj.core :refer :all] 3 | [day1.core :refer :all] 4 | [clojure.string :as string])) 5 | 6 | (describe "Parse Input" 7 | (it "reads file" 8 | (should= "1000\n2000\n3000\n\n4000\n\n5000\n6000\n\n7000\n8000\n9000\n\n10000" 9 | (slurp "test-input"))) 10 | 11 | (it "breaks input into lines" 12 | (should= ["this" "that" "" "the other"] (string/split-lines "this\nthat\n\nthe other"))) 13 | 14 | (it "Parses input" 15 | (should= [[1000 2000 3000] [4000] [5000 6000] [7000 8000 9000] [10000]] 16 | (parse-inventory "test-input")))) 17 | 18 | (describe "finding elf with maximum calories" 19 | (it "should sum up calories" 20 | (should= [6000 4000 11000 24000 10000] 21 | (sum-calories [[1000 2000 3000] [4000] [5000 6000] [7000 8000 9000] [10000]]))) 22 | 23 | (it "finds maximum calories" 24 | (should= 24000 (max-calories [1000 24000 19000])))) 25 | 26 | (describe "solutions" 27 | (it "solves part 1 finding the maximum calories" 28 | (should= 66306 (find-max-calories "input"))) 29 | 30 | (it "solves part 2 finding sum of top three elves" 31 | (should= 195292 (find-calories-in-top-three-elves "input")))) 32 | 33 | -------------------------------------------------------------------------------- /day10-crt-java/src/crt/Crt.java: -------------------------------------------------------------------------------- 1 | package crt; 2 | 3 | public class Crt { 4 | private int x; 5 | private String pixels = ""; 6 | private int extraCycles = 0; 7 | private int cycle = 0; 8 | private int ic; 9 | private String[] instructions; 10 | 11 | public Crt(int x) { 12 | this.x = x; 13 | } 14 | 15 | public void doCycles(int n, String instructionsLines) { 16 | instructions = instructionsLines.split("\n"); 17 | ic = 0; 18 | for (cycle = 0; cycle < n; cycle++) { 19 | setPixel(); 20 | execute(); 21 | } 22 | } 23 | 24 | private void execute() { 25 | if (instructions[ic].equals("noop")) 26 | ic++; 27 | else if (instructions[ic].startsWith("addx ") && extraCycles == 0) { 28 | extraCycles = 1; 29 | } 30 | else if (instructions[ic].startsWith("addx ") && extraCycles == 1) { 31 | extraCycles = 0; 32 | x += Integer.parseInt(instructions[ic].substring(5)); 33 | ic++; 34 | } else 35 | System.out.println("TILT"); 36 | } 37 | 38 | private void setPixel() { 39 | int pos = cycle % 40; 40 | int offset = pos - x; 41 | if (offset >= -1 && 1 >= offset) 42 | pixels += "#"; 43 | else 44 | pixels += "."; 45 | } 46 | 47 | public String getPixels() { 48 | return pixels; 49 | } 50 | 51 | public int getX() { 52 | return x; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /day4-camp-cleanup/src/day4_camp_cleanup/core.clj: -------------------------------------------------------------------------------- 1 | (ns day4-camp-cleanup.core 2 | (:require [clojure.string :as string] 3 | [clojure.set :as set])) 4 | 5 | (defn range-to-sections [range-string] 6 | (let [[from to] (map #(Integer/parseInt %) (string/split range-string #"-"))] 7 | (set (range from (inc to))))) 8 | 9 | (defn line-to-assignment [line] 10 | (let [ranges (string/split line #",")] 11 | (map range-to-sections ranges))) 12 | 13 | (defn create-pair-assignments [file-content] 14 | (map line-to-assignment (string/split-lines file-content))) 15 | 16 | (defn find-overlap [pair-assignment] 17 | (let [[e1 e2] pair-assignment] 18 | (set/intersection e1 e2))) 19 | 20 | (defn is-full-overlap? [pair-assignment] 21 | (let [[e1 e2] pair-assignment 22 | overlap (find-overlap pair-assignment) 23 | overlap-count (count overlap)] 24 | (or (= overlap-count (count e1)) 25 | (= overlap-count (count e2))))) 26 | 27 | (defn count-full-overlaps [file-name] 28 | (let [pair-assignments (create-pair-assignments (slurp file-name))] 29 | (count (filter is-full-overlap? pair-assignments)))) 30 | 31 | (defn overlaps? [pair-assignment] 32 | (seq (find-overlap pair-assignment))) 33 | 34 | (defn count-overlapping-pairs [file-name] 35 | (let [pair-assignments (create-pair-assignments (slurp file-name))] 36 | (count (filter overlaps? pair-assignments)))) 37 | 38 | -------------------------------------------------------------------------------- /day10-cathode-ray-tube/spec/day10_cathode_ray_tube/core_spec.clj: -------------------------------------------------------------------------------- 1 | (ns day10-cathode-ray-tube.core-spec 2 | (:require [speclj.core :refer :all] 3 | [day10-cathode-ray-tube.core :refer :all])) 4 | 5 | (describe "instruction execution" 6 | (it "adds a cycle for a nop" 7 | (should= {:x 1 :cycles [{:x 1}]} (noop {:x 1 :cycles []})) 8 | (should= {:x 2 :cycles [{:x 2} {:x 2}]} (noop {:x 2 :cycles [{:x 2}]}))) 9 | 10 | (it "adds two cycles for an addx" 11 | (should= {:x 4 :cycles [{:x 2} {:x 2}]} 12 | (addx 2 {:x 2 :cycles []}))) 13 | ) 14 | 15 | (describe "executing a program part 1" 16 | (it "executes a sequence of lines" 17 | (should= {:x 5 :cycles [{:x 7} {:x 7} {:x 7}]} 18 | (execute {:x 7 :cycles []} ["noop" "addx -2"])))) 19 | 20 | (describe "part 1 solution, signal strength" 21 | (it "solves test data" 22 | (should= 13140 (signal-strength "test-input"))) 23 | (it "solves input" 24 | (should= 14620 (signal-strength "input")))) 25 | 26 | (describe "part 2 solution, rendering the screen" 27 | (it "renders state" 28 | (should= [".........###............................" 29 | ".........###............................"] 30 | (render (repeat 80 {:x 10})))) 31 | 32 | (it "renders test-input" 33 | (should 34 | (print-screen 35 | (render (execution-of "test-input"))))) 36 | 37 | (it "renders input" 38 | (should 39 | (print-screen 40 | (render (execution-of "input")))))) 41 | -------------------------------------------------------------------------------- /day11-monkey-in-the-middle/input: -------------------------------------------------------------------------------- 1 | Monkey 0: 2 | Starting items: 91, 58, 52, 69, 95, 54 3 | Operation: new = old * 13 4 | Test: divisible by 7 5 | If true: throw to monkey 1 6 | If false: throw to monkey 5 7 | 8 | Monkey 1: 9 | Starting items: 80, 80, 97, 84 10 | Operation: new = old * old 11 | Test: divisible by 3 12 | If true: throw to monkey 3 13 | If false: throw to monkey 5 14 | 15 | Monkey 2: 16 | Starting items: 86, 92, 71 17 | Operation: new = old + 7 18 | Test: divisible by 2 19 | If true: throw to monkey 0 20 | If false: throw to monkey 4 21 | 22 | Monkey 3: 23 | Starting items: 96, 90, 99, 76, 79, 85, 98, 61 24 | Operation: new = old + 4 25 | Test: divisible by 11 26 | If true: throw to monkey 7 27 | If false: throw to monkey 6 28 | 29 | Monkey 4: 30 | Starting items: 60, 83, 68, 64, 73 31 | Operation: new = old * 19 32 | Test: divisible by 17 33 | If true: throw to monkey 1 34 | If false: throw to monkey 0 35 | 36 | Monkey 5: 37 | Starting items: 96, 52, 52, 94, 76, 51, 57 38 | Operation: new = old + 3 39 | Test: divisible by 5 40 | If true: throw to monkey 7 41 | If false: throw to monkey 3 42 | 43 | Monkey 6: 44 | Starting items: 75 45 | Operation: new = old + 5 46 | Test: divisible by 13 47 | If true: throw to monkey 4 48 | If false: throw to monkey 2 49 | 50 | Monkey 7: 51 | Starting items: 83, 75 52 | Operation: new = old + 1 53 | Test: divisible by 19 54 | If true: throw to monkey 2 55 | If false: throw to monkey 6 -------------------------------------------------------------------------------- /day4-camp-cleanup/spec/day4_camp_cleanup/core_spec.clj: -------------------------------------------------------------------------------- 1 | (ns day4-camp-cleanup.core-spec 2 | (:require [speclj.core :refer :all] 3 | [day4-camp-cleanup.core :refer :all])) 4 | 5 | (describe "parsing input" 6 | (it "creates a section set from a range" 7 | (should= #{3 4 5} (range-to-sections "3-5"))) 8 | 9 | (it "creates a pair assignment from a line" 10 | (should= [#{5 6 7 8} #{2 3 4}] 11 | (line-to-assignment "5-8,2-4"))) 12 | 13 | (it "creates list of pair assignments" 14 | (should= [[#{1 2 3} #{4 5 6}] 15 | [#{7 8 9} #{10 11 12}]] 16 | (create-pair-assignments "1-3,4-6\n7-9,10-12")))) 17 | 18 | (describe "part 1 utilities" 19 | (it "finds overlap of pair assignment" 20 | (should= #{3 4} (find-overlap [#{1 2 3 4} #{3 4 5 6}]))) 21 | 22 | (it "detects full overlap" 23 | (should (is-full-overlap? [#{1 2 3 4} #{2 3}])) 24 | (should-not (is-full-overlap? [#{1 2 3 4} #{3 4 5 6}])))) 25 | 26 | (describe "part 1 solution, count full overlaps in assignment pairs" 27 | (it "passes test data" 28 | (should= 2 (count-full-overlaps "test-input"))) 29 | 30 | (it "solves input" 31 | (should= 487 (count-full-overlaps "input")))) 32 | 33 | (describe "part 2 utilties" 34 | (it "finds any overlap" 35 | (should (overlaps? [#{1 2 3} #{3 4 5}])) 36 | (should-not (overlaps? [#{1 2 3} #{4 5 6}])))) 37 | 38 | (describe "part 2 solution, count all overlapping pairs" 39 | (it "solves test data" 40 | (should= 4 (count-overlapping-pairs "test-input"))) 41 | 42 | (it "solves input" 43 | (should= 849 (count-overlapping-pairs "input")))) 44 | -------------------------------------------------------------------------------- /day3-rucksack-reorganization/src/day3_rucksack_reorganization/core.clj: -------------------------------------------------------------------------------- 1 | (ns day3-rucksack-reorganization.core 2 | (:require [clojure.string :as string] 3 | [clojure.set :as set])) 4 | 5 | (defn priority [c] 6 | (if (Character/isUpperCase ^char c) 7 | (+ 27 (- (int c) (int \A))) 8 | (+ 1 (- (int c) (int \a)))) 9 | ) 10 | 11 | (defn parse-rucksack [line] 12 | (let [priorities (map priority line)] 13 | (partition (/ (count priorities) 2) priorities))) 14 | 15 | (defn parse-rucksack-file [file-name] 16 | (let [rucksacks (slurp file-name) 17 | lines (string/split-lines rucksacks)] 18 | (map parse-rucksack lines))) 19 | 20 | (defn prioritize-rucksack-line [rucksack-line] 21 | (map priority rucksack-line)) 22 | 23 | (defn parse-groups [rucksack-lines] 24 | (let [groups (map prioritize-rucksack-line rucksack-lines)] 25 | (partition 3 groups))) 26 | 27 | (defn common-item [rucksack] 28 | (let [[c1 c2] rucksack] 29 | (first (set/intersection (set c1) (set c2))))) 30 | 31 | (defn common-items [rucksacks] 32 | (map common-item rucksacks)) 33 | 34 | (defn sum-of-common-items [file-name] 35 | (reduce + (common-items (parse-rucksack-file file-name)))) 36 | 37 | (defn find-badge [group] 38 | (let [[s1 s2 s3] (map set group)] 39 | (first (set/intersection s3 (set/intersection s1 s2)))) 40 | ) 41 | 42 | (defn find-badges [groups] 43 | (map find-badge groups)) 44 | 45 | (defn sum-of-badges [file-name] 46 | (let [lines (string/split-lines (slurp file-name)) 47 | groups (parse-groups lines) 48 | badges (find-badges groups)] 49 | (reduce + badges))) 50 | 51 | -------------------------------------------------------------------------------- /day6-tuning-trouble/src/day6_tuning_trouble/core.clj: -------------------------------------------------------------------------------- 1 | (ns day6-tuning-trouble.core 2 | (:require [clojure.string :as string])) 3 | 4 | (defn extract-frames [stream] 5 | (let [s1 stream 6 | s2 (drop 1 stream) 7 | s3 (drop 1 s2) 8 | s4 (drop 1 s3)] 9 | (map str s1 s2 s3 s4)) 10 | ) 11 | 12 | (defn is-packet-start? [frame] 13 | (= 4 (count (set frame)))) 14 | 15 | (defn get-first-packet-start [stream] 16 | (let [frames (extract-frames stream) 17 | starts (filter is-packet-start? frames)] 18 | (first starts))) 19 | 20 | (defn get-packet-start-position [stream] 21 | (let [first-start (get-first-packet-start stream)] 22 | (+ 4 (string/index-of stream first-start)))) 23 | 24 | (defn extract-message-frames [stream] 25 | (let [s1 stream 26 | s2 (drop 1 stream) 27 | s3 (drop 1 s2) 28 | s4 (drop 1 s3) 29 | s5 (drop 1 s4) 30 | s6 (drop 1 s5) 31 | s7 (drop 1 s6) 32 | s8 (drop 1 s7) 33 | s9 (drop 1 s8) 34 | s10 (drop 1 s9) 35 | s11 (drop 1 s10) 36 | s12 (drop 1 s11) 37 | s13 (drop 1 s12) 38 | s14 (drop 1 s13)] 39 | (map str s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 s11 s12 s13 s14)) 40 | ) 41 | 42 | (defn is-message-start? [message-frame] 43 | (= 14 (count (set message-frame)))) 44 | 45 | (defn get-first-message-start [stream] 46 | (let [frames (extract-message-frames stream) 47 | starts (filter is-message-start? frames)] 48 | (first starts))) 49 | 50 | (defn get-message-start-position [stream] 51 | (let [first-start (get-first-message-start stream)] 52 | (+ 14 (string/index-of stream first-start)))) -------------------------------------------------------------------------------- /day10-cathode-ray-tube/input: -------------------------------------------------------------------------------- 1 | noop 2 | addx 25 3 | addx -5 4 | addx -14 5 | addx 4 6 | noop 7 | addx 2 8 | addx 3 9 | noop 10 | noop 11 | noop 12 | noop 13 | addx 3 14 | addx 5 15 | addx 2 16 | noop 17 | noop 18 | addx 5 19 | noop 20 | noop 21 | noop 22 | addx 1 23 | addx 2 24 | addx 5 25 | addx -40 26 | addx 5 27 | noop 28 | addx 26 29 | addx -20 30 | addx -3 31 | addx 2 32 | noop 33 | addx -4 34 | addx 9 35 | addx 5 36 | addx 2 37 | addx 11 38 | addx -10 39 | addx 2 40 | addx 5 41 | addx 2 42 | addx 5 43 | noop 44 | noop 45 | noop 46 | addx -31 47 | addx 32 48 | addx -37 49 | addx 1 50 | addx 8 51 | addx 13 52 | addx -15 53 | addx 4 54 | noop 55 | addx 5 56 | noop 57 | addx 3 58 | addx -2 59 | addx 4 60 | addx 1 61 | addx 4 62 | addx -14 63 | addx 15 64 | addx 4 65 | noop 66 | noop 67 | noop 68 | addx 3 69 | addx 5 70 | addx -40 71 | noop 72 | addx 5 73 | addx 8 74 | addx -3 75 | noop 76 | addx 2 77 | addx 9 78 | addx -4 79 | noop 80 | noop 81 | noop 82 | noop 83 | addx 5 84 | addx -9 85 | addx 10 86 | addx 4 87 | noop 88 | noop 89 | addx 5 90 | addx -19 91 | addx 24 92 | addx -2 93 | addx 5 94 | addx -40 95 | addx 22 96 | addx -19 97 | addx 2 98 | addx 5 99 | addx 2 100 | addx 5 101 | noop 102 | noop 103 | addx -2 104 | addx 2 105 | addx 5 106 | addx 3 107 | noop 108 | addx 2 109 | addx 2 110 | addx 3 111 | addx -2 112 | addx 10 113 | addx -3 114 | addx 3 115 | noop 116 | addx -40 117 | addx 2 118 | addx 11 119 | addx -5 120 | addx -1 121 | noop 122 | addx 3 123 | addx 7 124 | noop 125 | addx -2 126 | addx 5 127 | addx 2 128 | addx 3 129 | noop 130 | addx 2 131 | addx 6 132 | addx -5 133 | addx 2 134 | addx -18 135 | addx 26 136 | addx -1 137 | noop 138 | noop 139 | noop 140 | noop -------------------------------------------------------------------------------- /day6-tuning-trouble/spec/day6_tuning_trouble/core_spec.clj: -------------------------------------------------------------------------------- 1 | (ns day6-tuning-trouble.core-spec 2 | (:require [speclj.core :refer :all] 3 | [day6-tuning-trouble.core :refer :all])) 4 | 5 | (describe "frames" 6 | (it "extract frames from a stream" 7 | (should= ["abcd" "bcde" "cdef"] 8 | (extract-frames "abcdef"))) 9 | 10 | (it "should idenfity start of packet" 11 | (should-not (is-packet-start? "abab")) 12 | (should (is-packet-start? "abcd"))) 13 | 14 | (it "should find first start of packet frame" 15 | (should= "jpqm" (get-first-packet-start "mjqjpqmgbljsphdztnvjfqwrcgsmlb"))) 16 | 17 | (it "should find location of first packet start" 18 | (should= 7 (get-packet-start-position "mjqjpqmgbljsphdztnvjfqwrcgsmlb")) 19 | (should= 5 (get-packet-start-position "bvwbjplbgvbhsrlpgdmjqwftvncz")) 20 | (should= 6 (get-packet-start-position "nppdvjthqldpwncqszvftbrmjlhg")) 21 | (should= 10 (get-packet-start-position "nznrnfrfntjfmvfwmzdfjlvtqnbhcprsg")) 22 | (should= 11 (get-packet-start-position "zcfzfwzzqfrljwzlrfnpqdbhtmscgvjw")) 23 | ) 24 | ) 25 | 26 | (describe "part 1 solution" 27 | (it "solves input" 28 | (should= 1757 (get-packet-start-position (slurp "input"))))) 29 | 30 | (describe "part 2 solution" 31 | (it "solves test samples" 32 | (should= 19 (get-message-start-position "mjqjpqmgbljsphdztnvjfqwrcgsmlb")) 33 | (should= 23 (get-message-start-position "bvwbjplbgvbhsrlpgdmjqwftvncz")) 34 | (should= 23 (get-message-start-position "nppdvjthqldpwncqszvftbrmjlhg")) 35 | (should= 29 (get-message-start-position "nznrnfrfntjfmvfwmzdfjlvtqnbhcprsg")) 36 | (should= 26 (get-message-start-position "zcfzfwzzqfrljwzlrfnpqdbhtmscgvjw"))) 37 | 38 | (it "sovles input" 39 | (should= 2950 (get-message-start-position (slurp "input")))) 40 | ) -------------------------------------------------------------------------------- /day10-cathode-ray-tube/test-input: -------------------------------------------------------------------------------- 1 | addx 15 2 | addx -11 3 | addx 6 4 | addx -3 5 | addx 5 6 | addx -1 7 | addx -8 8 | addx 13 9 | addx 4 10 | noop 11 | addx -1 12 | addx 5 13 | addx -1 14 | addx 5 15 | addx -1 16 | addx 5 17 | addx -1 18 | addx 5 19 | addx -1 20 | addx -35 21 | addx 1 22 | addx 24 23 | addx -19 24 | addx 1 25 | addx 16 26 | addx -11 27 | noop 28 | noop 29 | addx 21 30 | addx -15 31 | noop 32 | noop 33 | addx -3 34 | addx 9 35 | addx 1 36 | addx -3 37 | addx 8 38 | addx 1 39 | addx 5 40 | noop 41 | noop 42 | noop 43 | noop 44 | noop 45 | addx -36 46 | noop 47 | addx 1 48 | addx 7 49 | noop 50 | noop 51 | noop 52 | addx 2 53 | addx 6 54 | noop 55 | noop 56 | noop 57 | noop 58 | noop 59 | addx 1 60 | noop 61 | noop 62 | addx 7 63 | addx 1 64 | noop 65 | addx -13 66 | addx 13 67 | addx 7 68 | noop 69 | addx 1 70 | addx -33 71 | noop 72 | noop 73 | noop 74 | addx 2 75 | noop 76 | noop 77 | noop 78 | addx 8 79 | noop 80 | addx -1 81 | addx 2 82 | addx 1 83 | noop 84 | addx 17 85 | addx -9 86 | addx 1 87 | addx 1 88 | addx -3 89 | addx 11 90 | noop 91 | noop 92 | addx 1 93 | noop 94 | addx 1 95 | noop 96 | noop 97 | addx -13 98 | addx -19 99 | addx 1 100 | addx 3 101 | addx 26 102 | addx -30 103 | addx 12 104 | addx -1 105 | addx 3 106 | addx 1 107 | noop 108 | noop 109 | noop 110 | addx -9 111 | addx 18 112 | addx 1 113 | addx 2 114 | noop 115 | noop 116 | addx 9 117 | noop 118 | noop 119 | noop 120 | addx -1 121 | addx 2 122 | addx -37 123 | addx 1 124 | addx 3 125 | noop 126 | addx 15 127 | addx -21 128 | addx 22 129 | addx -6 130 | addx 1 131 | noop 132 | addx 2 133 | addx 1 134 | noop 135 | addx -10 136 | noop 137 | noop 138 | addx 20 139 | addx 1 140 | addx 2 141 | addx 2 142 | addx -6 143 | addx -11 144 | noop 145 | noop 146 | noop -------------------------------------------------------------------------------- /day9-rope-bridge/spec/day9_rope_bridge/core_spec.clj: -------------------------------------------------------------------------------- 1 | (ns day9-rope-bridge.core-spec 2 | (:require [speclj.core :refer :all] 3 | [day9-rope-bridge.core :refer :all])) 4 | 5 | (describe "parse move directions" 6 | (it "does it" 7 | (should= [:right :right :right :right] (parse-move "R 4")) 8 | (should= [:left :left] (parse-move "L 2")) 9 | (should= [:up] (parse-move "U 1")) 10 | (should= [:down :down :down] (parse-move "D 3")))) 11 | 12 | (describe "move pairs of knots" 13 | (it "moves right" 14 | (should= [[3 2] [2 2]] (move-pair [1 0] [2 2] [1 1]))) 15 | (it "moves left" 16 | (should= [[1 2] [2 2]] (move-pair [-1 0] [2 2] [2 2]))) 17 | (it "moves up" 18 | (should= [[2 3] [2 2]] (move-pair [0 1] [2 2] [2 2]))) 19 | (it "moves down" 20 | (should= [[2 1] [2 2]] (move-pair [0 -1] [2 2] [2 2]))) 21 | (it "moves up-right" 22 | (should= [[1 2] [1 1]] (move-pair [1 1] [0 1] [0 0])))) 23 | 24 | (describe "move a rope" 25 | (it "should unroll" 26 | (should= [[1 0] [0 0] [0 0]] (move-rope [1 0] [[0 0] [0 0] [0 0]])) 27 | (should= [[2 0] [1 0] [0 0]] (move-rope [1 0] [[1 0] [0 0] [0 0]])) 28 | (should= [[3 0] [2 0] [1 0]] (move-rope [1 0] [[2 0] [1 0] [0 0]])) 29 | (should= [[3 1] [2 0] [1 0]] (move-rope [0 1] [[3 0] [2 0] [1 0]])) 30 | (should= [[3 2] [3 1] [2 1] [1 1]] (move-rope [0 1] [[3 1] [2 0] [1 0] [0 0]])))) 31 | 32 | (describe "part 1 solution" 33 | (it "solves test input" 34 | (should= 13 (count (track-tail-of-rope "test-input" 2)))) 35 | (it "solves input" 36 | (should= 6081 (count (track-tail-of-rope "input" 2))))) 37 | 38 | (describe "Part 2 solution, a rope of 9 knots" 39 | (it "solves the test input" 40 | (should= 36 (count (track-tail-of-rope "test-input-2" 10)))) 41 | 42 | (it "solves the test input" 43 | (should= 2487 (count (track-tail-of-rope "input" 10))))) 44 | -------------------------------------------------------------------------------- /day10-cathode-ray-tube/src/day10_cathode_ray_tube/core.clj: -------------------------------------------------------------------------------- 1 | (ns day10-cathode-ray-tube.core 2 | (:require [clojure.string :as string])) 3 | 4 | 5 | (defn noop [state] 6 | (let [{:keys [x cycles]} state 7 | cycles (conj cycles {:x x})] 8 | {:x x :cycles cycles}) 9 | ) 10 | 11 | (defn addx [n state] 12 | (let [{:keys [x cycles]} state 13 | cycles (conj cycles {:x x}) 14 | cycles (conj cycles {:x x})] 15 | {:x (+ x n) :cycles cycles})) 16 | 17 | (defn execute [state lines] 18 | (if (empty? lines) 19 | state 20 | (let [line (first lines) 21 | state (cond (re-matches #"noop" line) 22 | (noop state) 23 | 24 | (re-matches #"addx (-?\d+)" line) 25 | (let [[_ n] (re-matches #"addx (-?\d+)" line) 26 | n (Integer/parseInt n)] 27 | (addx n state)) 28 | 29 | :else 30 | "TILT")] 31 | (recur state (rest lines))))) 32 | 33 | 34 | (defn signal-strength [file-name] 35 | (let [lines (string/split-lines (slurp file-name)) 36 | state (execute {:x 1 :cycles []} lines) 37 | {:keys [x cycles]} state 38 | strengths (for [cycle [20 60 100 140 180 220]] 39 | (* cycle (:x (nth cycles (dec cycle)))))] 40 | (reduce + strengths))) 41 | 42 | (defn render [cycles] 43 | (loop [cycles cycles 44 | screen "" 45 | t 0] 46 | (if (empty? cycles) 47 | (map #(apply str %) (partition 40 40 "" screen)) 48 | (let [cycle (first cycles) 49 | offset (- t (:x cycle)) 50 | pixel? (<= -1 offset 1) 51 | screen (str screen (if pixel? "#" ".")) 52 | t (mod (inc t) 40)] 53 | (recur (rest cycles) screen t))))) 54 | 55 | (defn execution-of [file-name] 56 | (let [lines (string/split-lines (slurp file-name)) 57 | {:keys [cycles]} (execute {:x 1 :cycles []} lines)] 58 | cycles)) 59 | 60 | (defn print-screen [lines] 61 | (doseq [line lines] 62 | (println line)) 63 | true) -------------------------------------------------------------------------------- /day2-rock-paper-scissors/src/day2_rock_paper_scissors/core.clj: -------------------------------------------------------------------------------- 1 | (ns day2-rock-paper-scissors.core 2 | (:require [clojure.string :as string])) 3 | 4 | (def assumed-translation 5 | { 6 | "A" :rock 7 | "B" :paper 8 | "C" :scissors 9 | "X" :rock 10 | "Y" :paper 11 | "Z" :scissors 12 | }) 13 | 14 | (def actual-translation 15 | { 16 | "A" :rock 17 | "B" :paper 18 | "C" :scissors 19 | "X" :lose 20 | "Y" :draw 21 | "Z" :win 22 | }) 23 | 24 | (def score 25 | {:rock 1 26 | :paper 2 27 | :scissors 3}) 28 | 29 | (def wins 30 | #{[:rock :paper] 31 | [:paper :scissors] 32 | [:scissors :rock] 33 | }) 34 | 35 | (def to-lose 36 | {:rock :scissors 37 | :paper :rock 38 | :scissors :paper}) 39 | 40 | (def to-win 41 | {:rock :paper 42 | :paper :scissors 43 | :scissors :rock}) 44 | 45 | (defn read-strategy [file-name translation] 46 | (let [input (slurp file-name) 47 | lines (string/split-lines input)] 48 | (for [line lines] 49 | (let [[opponent player] (string/split line #" ")] 50 | (map translation [opponent player]))))) 51 | 52 | (defn read-assumed-strategy [file-name] 53 | (read-strategy file-name assumed-translation)) 54 | 55 | (defn choose-response [[opponent outcome]] 56 | (condp = outcome 57 | :win [opponent (to-win opponent)] 58 | :draw [opponent opponent] 59 | :lose [opponent (to-lose opponent)])) 60 | 61 | (defn read-actual-strategy [file-name] 62 | (let [strategy (read-strategy file-name actual-translation)] 63 | (map choose-response strategy))) 64 | 65 | (defn outcome-score [round] 66 | (cond 67 | (wins round) 6 68 | (apply = round) 3 69 | :else 0)) 70 | 71 | (defn score-of-round [round] 72 | (let [choice-score (score (second round))] 73 | (+ choice-score (outcome-score round)))) 74 | 75 | (defn score-of-strategy [rounds] 76 | (let [scores (map score-of-round rounds)] 77 | (reduce + scores))) 78 | 79 | (defn play-assumed-strategy [file-name] 80 | (score-of-strategy (read-assumed-strategy file-name))) 81 | 82 | (defn play-actual-strategy [file-name] 83 | (score-of-strategy (read-actual-strategy file-name))) 84 | 85 | 86 | -------------------------------------------------------------------------------- /day9-rope-bridge/src/day9_rope_bridge/core.clj: -------------------------------------------------------------------------------- 1 | (ns day9-rope-bridge.core 2 | (:require [clojure.string :as string])) 3 | 4 | (def directions 5 | {"R" :right 6 | "U" :up 7 | "L" :left 8 | "D" :down}) 9 | 10 | (defn parse-move [move-line] 11 | (let [[_ direction amount] (re-matches #"([LRUD]) (\d+)$" move-line)] 12 | (repeat (Integer/parseInt amount) (directions direction)))) 13 | 14 | (defn calculate-direction [[x1 y1] [x2 y2]] 15 | [(- x2 x1) (- y2 y1)]) 16 | 17 | (defn close? [[ox oy]] 18 | (and 19 | (<= (Math/abs ^int ox) 1) 20 | (<= (Math/abs ^int oy) 1))) 21 | 22 | (defn sign-of [x] 23 | (cond 24 | (zero? x) 0 25 | (neg? x) -1 26 | :else 1)) 27 | 28 | (defn move-closer [[ox oy] [tx ty]] 29 | (let [ox (sign-of ox) 30 | oy (sign-of oy)] 31 | [(+ tx ox) (+ ty oy)])) 32 | 33 | (defn move-pair [[dx dy] [hx hy] [tx ty :as tail]] 34 | (let [new-head [(+ hx dx) (+ hy dy)] 35 | [nhx nhy] new-head 36 | offset [(- nhx tx) (- nhy ty)] 37 | new-tail (if (close? offset) 38 | tail 39 | (move-closer offset tail))] 40 | [new-head new-tail])) 41 | 42 | (defn move-rope [direction rope] 43 | (loop [rope (conj rope [0 0]) 44 | direction direction 45 | new-rope []] 46 | (if (= 1 (count rope)) 47 | new-rope 48 | (let [[head tail] (take 2 rope) 49 | [new-head new-tail] (move-pair direction head tail) 50 | new-direction (calculate-direction tail new-tail)] 51 | (recur (rest rope) new-direction (conj new-rope new-head)))))) 52 | 53 | (def direction-deltas 54 | { 55 | :right [1 0] 56 | :left [-1 0] 57 | :up [0 1] 58 | :down [0 -1]}) 59 | 60 | (defn track-tail-of-rope [file-name n] 61 | (let [lines (string/split-lines (slurp file-name)) 62 | moves (map direction-deltas (flatten (map parse-move lines)))] 63 | (loop [moves moves 64 | rope (repeat n [0 0]) 65 | tails #{[0 0]}] 66 | (if (empty? moves) 67 | tails 68 | (let [new-rope (move-rope (first moves) rope)] 69 | (recur (rest moves) new-rope (conj tails (last new-rope)))))))) 70 | 71 | 72 | -------------------------------------------------------------------------------- /day3-rucksack-reorganization/spec/day3_rucksack_reorganization/core_spec.clj: -------------------------------------------------------------------------------- 1 | (ns day3-rucksack-reorganization.core-spec 2 | (:require [speclj.core :refer :all] 3 | [day3-rucksack-reorganization.core :refer :all] 4 | [clojure.string :as string])) 5 | 6 | (describe "Parsing Rucksacks" 7 | (it "parses a rucksack" 8 | (should= [[1 26] [27 52]] 9 | (parse-rucksack "azAZ"))) 10 | 11 | (it "parses many rucksacks" 12 | (should= (quote (((22 36 18 23 16 49 20 23 36 7 49 18) (8 3 19 32 39 39 6 32 32 8 32 16)) ((10 17 34 44 40 17 44 10 17 26 10 33 30 38 33 38) (18 19 32 39 6 32 52 45 18 38 18 32 52 19 45 38)) ((42 13 13 4 26 17 42 18 48) (22 42 23 23 46 49 28 23 7)) ((23 39 17 22 38 39 52 34 8 34 39 22 23 38 34) (10 2 22 3 10 14 14 45 28 14 22 46 43 32 14)) ((20 20 7 36 20 44 33 36) (43 3 20 46 52 20 52 46)) ((29 18 52 19 36 19 42 42 52 19 33 26) (23 23 19 38 23 38 13 16 23 39 30 23)))) 13 | (parse-rucksack-file "test-input")))) 14 | 15 | (describe "part 1 utilities" 16 | (it "should find the common item in a rucksack" 17 | (should= 1 (common-item [[1 2] [4 1]]))) 18 | 19 | (it "should find all common items in test input" 20 | (should= [16 38 42 22 20 19] 21 | (common-items (parse-rucksack-file "test-input"))))) 22 | 23 | (describe "part 1 solutions" 24 | (it "should solve test data" 25 | (should= 157 (sum-of-common-items "test-input"))) 26 | 27 | (it "should solve input" 28 | (should= 8109 (sum-of-common-items "input")))) 29 | 30 | (describe "Parsing groups" 31 | (it "parses groups" 32 | (should= [[[1 2] [3 4] [5 6]] [[7 8] [9 10] [11 12]]] 33 | (parse-groups ["ab" "cd" "ef" "gh" "ij" "kl"])))) 34 | 35 | (describe "Part 2 utilities" 36 | (it "finds badge in group" 37 | (should= 3 (find-badge [[3 1 2] [4 6 3] [12 14 3]]))) 38 | 39 | (it "finds badges in test-input" 40 | (should= [18 52] (find-badges (parse-groups (string/split-lines (slurp "test-input"))))))) 41 | 42 | (describe "Part 2 solution -- the badges" 43 | (it "should solve test-data" 44 | (should= 70 (sum-of-badges "test-input"))) 45 | 46 | (it "should solve input" 47 | (should= 2738 (sum-of-badges "input"))) 48 | 49 | ) 50 | -------------------------------------------------------------------------------- /day5-supply-stacks/spec/day5_supply_stacks/core_spec.clj: -------------------------------------------------------------------------------- 1 | (ns day5-supply-stacks.core-spec 2 | (:require [speclj.core :refer :all] 3 | [day5-supply-stacks.core :refer :all])) 4 | 5 | (describe "parsing input" 6 | (it "separates stack map from moves" 7 | (should= [["stack" "map"] ["move" "directions"]] 8 | (separate-stacks-and-moves "stack\nmap\n\nmove\ndirections"))) 9 | 10 | (it "determines number of stacks by counting last line" 11 | (should= 3 (determine-number-of-stacks ["one two" " 1 2 3 "]))) 12 | 13 | (it "extracts stack names" 14 | (should= [[" " "A" " "] ["B" "C" "D"]] 15 | (extract-stack-names 16 | [" [A]" 17 | "[B] [C] [D]" 18 | " 1 2 3"]))) 19 | 20 | (it "creates stacks from stack lines" 21 | (should= [["B"] ["A" "C"] ["D"]] 22 | (build-stacks [" [A]" 23 | "[B] [C] [D]" 24 | " 1 2 3"]))) 25 | 26 | (it "parses a move" 27 | (should= [1 2 3] (parse-move "move 1 from 2 to 3"))) 28 | 29 | (it "parses moves" 30 | (should= [[1 2 3] [4 5 6]] (parse-moves ["move 1 from 2 to 3" 31 | "move 4 from 5 to 6"])))) 32 | 33 | (describe "Part one utilties" 34 | (it "moves one item" 35 | (should= [["B"] ["A" "C"]] (move-1 [["A" "B"] ["C"]] [1 2]))) 36 | 37 | (it "executes one true move" 38 | (should= [[] ["B" "A" "C"]] (cm9000-mover [["A" "B"] ["C"]] [2 1 2]))) 39 | 40 | (it "returns top of stacks" 41 | (should= "CMZ" (tops-of-stacks [["C" "A"] ["M"] ["Z" "S"]]))) 42 | ) 43 | 44 | (describe "Solution of part one" 45 | (it "should solve test input" 46 | (should= "CMZ" (solve cm9000-mover "test-input"))) 47 | 48 | (it "should solve input" 49 | (should= "NTWZZWHFV" (solve cm9000-mover "input")))) 50 | 51 | (describe "Part 2 utilities" 52 | (it "executes a Cratemover 9001 move" 53 | (should= [[] ["A" "B" "C"]] (cm9001-mover [["A" "B"] ["C"]] [2 1 2])))) 54 | 55 | (describe "Solution of part 2" 56 | (it "solves test input" 57 | (should= "MCD" (solve cm9001-mover "test-input"))) 58 | 59 | (it "solves input" 60 | (should= "" (solve cm9001-mover "input")))) -------------------------------------------------------------------------------- /day14-regolith-reservoir/spec/day14_regolith_reservoir/core_spec.clj: -------------------------------------------------------------------------------- 1 | (ns day14-regolith-reservoir.core-spec 2 | (:require [speclj.core :refer :all] 3 | [day14-regolith-reservoir.core :refer :all])) 4 | 5 | ;right and down are positive. 6 | 7 | (describe "Day 14 regolith reservoir" 8 | (context "Sand mechanics" 9 | (it "falls down if nothing in the way" 10 | (should= [0 1] (sand-falls-one-step #{} [0 0]))) 11 | (it "falls diagonally left if blocked below" 12 | (should= [-1 1] (sand-falls-one-step #{[0 1]} [0 0]))) 13 | (it "falls diagonally right if blocked below and left" 14 | (should= [1 1] (sand-falls-one-step #{[0 1] [-1 1]} [0 0]))) 15 | (it "does not fall if blocked below, left, and right" 16 | (should= nil (sand-falls-one-step #{[0 1] [-1 1] [1 1]} [0 0]))) 17 | (it "falls until stopped" 18 | (should= [0 2] (drop-sand #{[-1 3] [0 3] [1 3]} [0 0])) 19 | (should= [-1 3] (drop-sand #{[0 3] [1 3] [-2 4] [-1 4] [0 4]} [0 0]))) 20 | (it "falls into the void" 21 | (should= :void (drop-sand #{[0 3]} [0 0]))) 22 | (it "adds sand to cave" 23 | (should= [[0 1] #{[-1 2] [0 2] [1 2] [0 1]}] 24 | (add-sand #{[-1 2] [0 2] [1 2]} [0 0]))) 25 | (it "drops until void" 26 | (should= [4 #{[-2 3] [2 3] [-1 3] [-1 2] [1 3] [0 3] [0 2] [1 2] [0 1]}] 27 | (drop-til-target #{[-2 3] [-1 3] [0 3] [1 3] [2 3]} [0 0] :void)))) 28 | 29 | (context "parsing the input" 30 | (it "parses a coordinate" 31 | (should= [2 3] (parse-coord "2,3"))) 32 | (it "parses the wall vertices" 33 | (should= [[1 2] [3 4] [5 6]] 34 | (parse-wall-vertices "1,2 -> 3,4 -> 5,6")))) 35 | 36 | (context "building walls" 37 | (it "builds one wall segement" 38 | (should= #{[1 1] [1 2] [1 3]} (build-segment [1 1] [1 3])) 39 | (should= #{[1 1] [1 2] [1 3]} (build-segment [1 3] [1 1])) 40 | (should= #{[1 1] [2 1] [3 1]} (build-segment [1 1] [3 1])) 41 | (should= #{[1 1] [2 1] [3 1]} (build-segment [3 1] [1 1]))) 42 | 43 | (it "builds a whole wall" 44 | (should= #{[1 1] [1 2] [1 3] [2 3] [3 3]} 45 | (build-wall [[1 1] [1 3] [3 3]])))) 46 | 47 | (context "Part 1 solution" 48 | (it "solves test-input" 49 | (should= 24 (count-remaining-sand "test-input"))) 50 | (it "solves input" 51 | (should= 698 (count-remaining-sand "input")))) 52 | 53 | (context "Part 2 solution" 54 | (it "solves test input" 55 | (should= 93 (count-til-blocked "test-input"))) 56 | (it "solves input" 57 | (should= 28594 (count-til-blocked "input")))) 58 | ) 59 | -------------------------------------------------------------------------------- /day13-distress-signal/src/day13_distress_signal/core.clj: -------------------------------------------------------------------------------- 1 | (ns day13-distress-signal.core 2 | (:require [clojure.string :as string])) 3 | 4 | (defn compare-signal [a b] 5 | (cond 6 | (and (coll? a) (coll? b)) 7 | (cond 8 | (and (empty? a) (empty? b)) 9 | :equal 10 | 11 | (empty? a) 12 | :right-order 13 | 14 | (empty? b) 15 | :wrong-order 16 | 17 | :else 18 | (let [result (compare-signal (first a) (first b))] 19 | (if (= result :equal) 20 | (recur (rest a) (rest b)) 21 | result))) 22 | 23 | (and (integer? a) (integer? b)) 24 | (cond 25 | (< a b) :right-order 26 | (> a b) :wrong-order 27 | :else :equal) 28 | 29 | (and (integer? a) (coll? b)) 30 | (compare-signal (vector a) b) 31 | 32 | (and (integer? b) (coll? a)) 33 | (compare-signal a (vector b)))) 34 | 35 | (defn parse-pair [line1 line2] 36 | [(read-string line1) (read-string line2)]) 37 | 38 | (defn make-pair-map [lines] 39 | (loop [lines (remove empty? lines) 40 | pair-map {} 41 | index 1] 42 | (if (empty? lines) 43 | pair-map 44 | (let [pair (parse-pair (first lines) (second lines))] 45 | (recur (drop 2 lines) (assoc pair-map index pair) (inc index)))))) 46 | 47 | (defn sum-right-indices [file-name] 48 | (let [lines (string/split-lines (slurp file-name)) 49 | pair-map (make-pair-map lines)] 50 | (loop [indices (keys pair-map) 51 | sum 0] 52 | (if (empty? indices) 53 | sum 54 | (let [index (first indices)] 55 | (if (= :right-order (apply compare-signal (pair-map index))) 56 | (recur (rest indices) (+ sum index)) 57 | (recur (rest indices) sum))))))) 58 | 59 | (defn order-comparator [a b] 60 | (let [order (compare-signal a b)] 61 | (condp = order 62 | :right-order -1 63 | :wrong-order 1 64 | :equal 0 65 | nil))) 66 | 67 | (defn sort-packets [packets] 68 | (sort order-comparator packets)) 69 | 70 | (defn decoder-key-of [file-name] 71 | (let [lines (string/split-lines (slurp file-name)) 72 | pair-map (make-pair-map lines) 73 | pairs (vals pair-map) 74 | packets (concat (map first pairs) (map second pairs) [[[2]] [[6]]])] 75 | (loop [packets (sort-packets packets) 76 | product 1 77 | index 1] 78 | (if (empty? packets) 79 | product 80 | (if (or (= (first packets) [[2]]) 81 | (= (first packets) [[6]])) 82 | (recur (rest packets) (* index product) (inc index)) 83 | (recur (rest packets) product (inc index))))))) -------------------------------------------------------------------------------- /day7-no-space-left-on-device/spec/day7_no_space_left_on_device/core_spec.clj: -------------------------------------------------------------------------------- 1 | (ns day7-no-space-left-on-device.core-spec 2 | (:require [speclj.core :refer :all] 3 | [day7-no-space-left-on-device.core :refer :all])) 4 | 5 | (describe "building directories" 6 | (it "moves to /" 7 | (should= [["/"] :directory] (exec-command :path :directory "$ cd /"))) 8 | 9 | (it "moves down a directory" 10 | (should= [["/" "d"] :directory] (exec-command ["/"] :directory "$ cd d"))) 11 | 12 | (it "moves up a directory" 13 | (should= [["/"] :directory] (exec-command ["/" "d"] :directory "$ cd .."))) 14 | 15 | (it "adds a directory" 16 | (should= [["/"] {"/" {"a" {}}}] 17 | (exec-command ["/"] {"/" {}} "dir a"))) 18 | 19 | (it "adds a file" 20 | (should= [["/"] {"/" {"f" 99}}] 21 | (exec-command ["/"] {"/" {}} "99 f"))) 22 | 23 | (it "ignores ls" 24 | (should= [:path :directory] (exec-command :path :directory "$ ls"))) 25 | 26 | (it "builds the test directory" 27 | (should= {"/" {"a" {"e" {"i" 584}, "f" 29116, "g" 2557, "h.lst" 62596}, "b.txt" 14848514, "c.dat" 8504156, "d" {"j" 4060174, "d.log" 8033020, "d.ext" 5626152, "k" 7214296}}} 28 | (exec-command-file "test-input"))) 29 | ) 30 | 31 | (describe "directory size calculation" 32 | (it "calculates degenerate directory" 33 | (should= 0 (dir-size {}))) 34 | 35 | (it "calculates a directory with only files" 36 | (should= 100 (dir-size {"f" 99 "g" 1}))) 37 | 38 | (it "calculates a directory with files and directories" 39 | (should= 110 (dir-size {"f" 99 "g" 1 "d" {"k" 10}}))) 40 | 41 | (it "maps a simple directory" 42 | (should= {["/"] 99} (map-directories [] {"/" {"f" 99}}))) 43 | 44 | (it "maps a hierarchy" 45 | (should= {["/"] 99 46 | ["/" "d"] 88} 47 | (map-directories [] {"/" {"f" 11 48 | "d" {"h" 88}}}))) 49 | 50 | (it "maps a deep hierarchy" 51 | (should= {["/"] 108 52 | ["/" "d"] 97 53 | ["/" "d" "dd"] 9} 54 | (map-directories [] {"/" {"f" 11 55 | "d" {"h" 88 56 | "dd" {"k" 9}}}}))) 57 | ) 58 | 59 | (describe "Part 1" 60 | (it "solves test input" 61 | (should= 95437 (total-small-directories "test-input"))) 62 | 63 | (it "solves input" 64 | (should= 1611443 (total-small-directories "input")))) 65 | 66 | (describe "Part 2 - find best directory to delete" 67 | (it "solves test-input" 68 | (should= 24933642 (find-best-to-delete "test-input"))) 69 | 70 | (it "solves input" 71 | (should= 2086088 (find-best-to-delete "input"))) 72 | ) 73 | 74 | -------------------------------------------------------------------------------- /day5-supply-stacks/src/day5_supply_stacks/core.clj: -------------------------------------------------------------------------------- 1 | (ns day5-supply-stacks.core 2 | (:require [clojure.string :as string])) 3 | 4 | (defn separate-stacks-and-moves [input] 5 | (loop [lines (string/split-lines input) 6 | stacks [] 7 | moves [] 8 | type :stacks] 9 | (if (empty? lines) 10 | [stacks moves] 11 | (let [line (first lines)] 12 | (cond 13 | (empty? line) (recur (rest lines) stacks moves :moves) 14 | (= type :stacks) (recur (rest lines) (conj stacks line) moves :stacks) 15 | :else (recur (rest lines) stacks (conj moves line) :moves)))))) 16 | 17 | (defn determine-number-of-stacks [stack-lines] 18 | (dec (count (string/split (last stack-lines) #"\s+")))) 19 | 20 | (defn break-into-columns [n-columns stack-line] 21 | (let [groups-of-4-chars (partition 4 4 " " stack-line) 22 | partial-columns (map #(str (nth % 1)) groups-of-4-chars) 23 | column-pad (repeat n-columns " ")] 24 | (take n-columns (concat partial-columns column-pad)))) 25 | 26 | (defn extract-stack-names [stack-lines] 27 | (let [n-stacks (determine-number-of-stacks stack-lines) 28 | stack-lines (drop-last stack-lines) 29 | columns (map (partial break-into-columns n-stacks) stack-lines)] 30 | columns)) 31 | 32 | (defn remove-spaces [stack-with-spaces] 33 | (remove #(= " " %) stack-with-spaces)) 34 | 35 | (defn build-stacks [stack-lines] 36 | (let [n-rows (dec (count stack-lines)) 37 | stack-rows (extract-stack-names stack-lines) 38 | stacks-with-spaces (partition n-rows (apply interleave stack-rows))] 39 | (map remove-spaces stacks-with-spaces))) 40 | 41 | (defn parse-move [move] 42 | (let [matches (re-matches #"move (\d+) from (\d+) to (\d+)" move)] 43 | (map #(Integer/parseInt %) (rest matches)))) 44 | 45 | (defn parse-moves [moves] 46 | (map parse-move moves)) 47 | 48 | (defn move-1 [stacks [from to]] 49 | (let [stacks (vec stacks) 50 | from-index (dec from) 51 | to-index (dec to) 52 | item (first (nth stacks from-index)) 53 | stacks (update-in stacks [from-index] rest) 54 | stacks (update-in stacks [to-index] (partial concat [item]))] 55 | stacks)) 56 | 57 | (defn cm9000-mover [stacks move] 58 | (let [[n from to] move] 59 | (reduce move-1 stacks (repeat n [from to])))) 60 | 61 | (defn execute-moves [mover stacks moves] 62 | (reduce mover stacks moves)) 63 | 64 | (defn tops-of-stacks [stacks] 65 | (apply str (map first stacks))) 66 | 67 | (defn solve [mover file-name] 68 | (let [input (slurp file-name) 69 | [stack-lines move-lines] (separate-stacks-and-moves input) 70 | stacks (build-stacks stack-lines) 71 | moves (parse-moves move-lines) 72 | stacks (execute-moves mover stacks moves)] 73 | (tops-of-stacks stacks))) 74 | 75 | (defn cm9001-mover [stacks [n from to]] 76 | (let [stacks (vec stacks) 77 | from-index (dec from) 78 | to-index (dec to) 79 | items (take n (nth stacks from-index)) 80 | stacks (update-in stacks [from-index] (partial drop n)) 81 | stacks (update-in stacks [to-index] (partial concat items))] 82 | stacks)) 83 | -------------------------------------------------------------------------------- /day12-hill-climing-algorithm/spec/day12_hill_climing_algorithm/core_spec.clj: -------------------------------------------------------------------------------- 1 | (ns day12-hill-climing-algorithm.core-spec 2 | (:require [speclj.core :refer :all] 3 | [day12-hill-climing-algorithm.core :refer :all])) 4 | 5 | (declare grid) 6 | (declare hm start end) 7 | 8 | (describe "day 12 Hill Climbing Algorithm" 9 | (context "grid manipulations" 10 | (with grid [[1 2 3 -1] 11 | [4 5 6 -2] 12 | [7 8 9 -3]]) 13 | 14 | (it "translates coordinates to heights" 15 | (should= 1 (get-cell @grid [0 0])) 16 | (should= 2 (get-cell @grid [1 0])) 17 | (should= 9 (get-cell @grid [2 2])) 18 | (should= "TILT" (get-cell @grid [3 3]))) 19 | 20 | (it "gets bounds of grid" 21 | (should= [4 3] (get-bounds @grid))) 22 | 23 | (it "gets orthogonal steps" 24 | (should= #{[1 0] [2 1] [1 2] [0 1]} 25 | (ortho-from @grid [1 1])) 26 | (should= #{[1 0] [0 1]} 27 | (ortho-from @grid [0 0])) 28 | (should= #{[3 1] [2 2]} 29 | (ortho-from @grid [3 2])))) 30 | 31 | (context "parsing input" 32 | (it "creates the heightmap from lines" 33 | (should= [[2 0] [2 1] 34 | [[0 1 0 3] 35 | [2 1 25 5] 36 | [16 17 18 19]]] 37 | (parse-lines ["abSd" 38 | "cbEf" 39 | "qrst"]))) 40 | (it "parses a file" 41 | (let [hm (make-height-map "test-input")] 42 | (should= [[0 0] [5 2] 43 | '((0 0 1 16 15 14 13 12) 44 | (0 1 2 17 24 23 23 11) 45 | (0 2 2 18 25 25 23 10) 46 | (0 2 2 19 20 21 22 9) 47 | (0 1 3 4 5 6 7 8))] 48 | hm)))) 49 | 50 | ;test-input 51 | ;Sabqponm 52 | ;abcryxxl 53 | ;accszExk 54 | ;acctuvwj 55 | ;abdefghi 56 | 57 | (context "path manipulations" 58 | (with hm (make-height-map "test-input")) 59 | (with grid (nth @hm 2)) 60 | (with start (first @hm)) 61 | (with end (second @hm)) 62 | (it "finds possible steps" 63 | (should= #{[1 0] [0 1]} 64 | (possible-steps-while-climbing @grid @start)) 65 | (should= #{[4 2] [5 1] [3 1] [4 0]} 66 | (possible-steps-while-climbing @grid [4 1])) 67 | (should= #{[4 3] [5 4] [6 3]} 68 | (possible-steps-while-climbing @grid [5 3]))) 69 | 70 | (it "calculates orthogonal distance" 71 | (should= 0 (distance [1 1] [1 1])) 72 | (should= 1 (distance [1 1] [1 0])) 73 | (should= 1 (distance [0 1] [1 1])) 74 | (should= 2 (distance [0 0] [1 1]))) 75 | 76 | (it "makes shortest map" 77 | (should= {[0 0] 1000, [1 0] 1000, [1 1] 1000, [0 1] 1000} 78 | (make-shortest-map [[1 2] [3 4]] 1000)))) 79 | 80 | (context "part 1 solution" 81 | (it "solves test data" 82 | (should= 31 (shortest-path-length "test-input"))) 83 | 84 | (it "solves input" 85 | (should= 408 (shortest-path-length "input")))) 86 | 87 | (context "part 2 solution" 88 | (it "solves test data" 89 | (should= 29 (shortest-scenic-path "test-input"))) 90 | 91 | (it "solves input" 92 | (should= 399 (shortest-scenic-path "input"))))) 93 | -------------------------------------------------------------------------------- /day7-no-space-left-on-device/src/day7_no_space_left_on_device/core.clj: -------------------------------------------------------------------------------- 1 | (ns day7-no-space-left-on-device.core 2 | (:require [clojure.string :as string])) 3 | 4 | (defn add-directory [path directory dir-name] 5 | (let [new-path (conj path dir-name)] 6 | (assoc-in directory new-path {}))) 7 | 8 | (defn add-file [path directory size name] 9 | (let [new-path (conj path name)] 10 | (assoc-in directory new-path size))) 11 | 12 | (defn exec-command [path directories command] 13 | (cond 14 | (= command "$ cd /") 15 | [["/"] directories] 16 | 17 | (= command "$ cd ..") 18 | [(drop-last path) directories] 19 | 20 | (= command "$ ls") 21 | [path directories] 22 | 23 | (re-matches #"\$ cd (.+)$" command) 24 | (let [directory (second (re-matches #"\$ cd (.+)$" command))] 25 | [(conj (vec path) directory) directories]) 26 | 27 | (re-matches #"dir (.+)$" command) 28 | [path (add-directory path directories (second (re-matches #"dir (.+)$" command)))] 29 | 30 | (re-matches #"(\d+) (.+)$" command) 31 | (let [[_ size name] (re-matches #"(\d+) (.+)$" command) 32 | size (Integer/parseInt size)] 33 | [path (add-file path directories size name)]) 34 | 35 | :else 36 | "TILT" 37 | )) 38 | 39 | (defn exec-commands [path directories commands] 40 | (if (empty? commands) 41 | directories 42 | (let [command (first commands) 43 | [path directories] (exec-command path directories command)] 44 | (recur path directories (rest commands))))) 45 | 46 | (defn exec-command-file [file-name] 47 | (let [input (slurp file-name) 48 | commands (string/split-lines input)] 49 | (exec-commands ["/"] {"/" {}} commands))) 50 | 51 | (defn dir-size [directory] 52 | (loop [names (keys directory) 53 | size 0] 54 | (if (empty? names) 55 | size 56 | (let [name (first names) 57 | file (directory name)] 58 | (if (integer? file) 59 | (recur (rest names) (+ size file)) 60 | (recur (rest names) (+ size (dir-size file)))))))) 61 | 62 | (defn map-directories [path directories] 63 | (loop [names (keys directories) 64 | sizes {}] 65 | (if (empty? names) 66 | sizes 67 | (let [name (first names) 68 | file (directories name)] 69 | (if (integer? file) 70 | (recur (rest names) sizes) 71 | (recur (rest names) (merge (assoc sizes (conj path name) (dir-size file)) 72 | (map-directories (conj path name) file)))))))) 73 | 74 | (defn total-small-directories [file-name] 75 | (let [directories (exec-command-file file-name) 76 | directory-map (map-directories [] directories) 77 | sizes (vals directory-map) 78 | small-sizes (filter #(<= % 100000) sizes)] 79 | (reduce + small-sizes))) 80 | 81 | (defn find-best-to-delete [file-name] 82 | (let [directories (exec-command-file file-name) 83 | directory-map (map-directories [] directories) 84 | sizes (sort (vals directory-map)) 85 | total-used (directory-map ["/"]) 86 | free-space (- 70000000 total-used) 87 | needed-space (- 30000000 free-space) 88 | sufficient-sizes (filter #(>= % needed-space) sizes)] 89 | (first sufficient-sizes))) 90 | 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /day8-treetop-tree-house/spec/day8_treetop_tree_house/core_spec.clj: -------------------------------------------------------------------------------- 1 | (ns day8-treetop-tree-house.core-spec 2 | (:require [speclj.core :refer :all] 3 | [day8-treetop-tree-house.core :refer :all])) 4 | 5 | (describe "parsing the forest file" 6 | (it "parses nothing" 7 | (should= [[]] (parse-forest ""))) 8 | 9 | (it "parses a simple forest" 10 | (should= [[1 2] [3 4]] (parse-forest "12\n34"))) 11 | ) 12 | 13 | (describe "part 1 utilities -- finding hidden trees" 14 | (it "counts trees" 15 | (should= 9 (count-trees [[1 1 1] [1 1 1] [1 1 1]]))) 16 | (it "rotates the forest" 17 | (should= [[1 3] 18 | [2 4]] (rotate-forest [[1 2] 19 | [3 4]]))) 20 | 21 | (it "finds hidden trees in a row" 22 | (should= #{1 2} (hidden-from-left [3 2 3 5])) 23 | (should= #{0 1 2} (hidden-from-right [3 1 2 5])) 24 | (should= #{1 2} (hidden-in-row [3 1 2 5])) 25 | (should= #{} (hidden-in-row [1 5 1]))) 26 | 27 | (it "finds hidden trees" 28 | (should= #{[1 0] [1 1] [1 2]} 29 | (find-hidden-trees-by-row [[1 1 1] 30 | [1 0 1] 31 | [1 1 1]])) 32 | (should= #{[0 1] [1 1] [2 1]} 33 | (find-hidden-trees-by-column [[1 1 1] 34 | [1 0 1] 35 | [1 1 1]])) 36 | 37 | (should= #{[1 1]} (find-hidden-trees [[1 1 1] 38 | [1 0 1] 39 | [1 1 1]])))) 40 | 41 | (describe "part 1 solution" 42 | (it "should solve test-input" 43 | (should= 21 (count-visible-trees "test-input"))) 44 | 45 | (it "should solve input" 46 | (should= 1803 (count-visible-trees "input")))) 47 | 48 | (describe "Part 2 utilities, measuring visibility" 49 | (it "creates four rays" 50 | (should= #{[[2 1] [2 2] [2 3] [2 4]] 51 | [[2 1] [2 0]] 52 | [[2 1] [3 1] [4 1]] 53 | [[2 1] [1 1] [0 1]]} (create-rays [5 5] [2 1])) 54 | (should= #{[[0 0]] 55 | [[0 0] [1 0] [2 0] [3 0] [4 0]] 56 | [[0 0] [0 1] [0 2] [0 3] [0 4]]} 57 | (create-rays [5 5] [0 0])) 58 | (should= #{[[4 4]] 59 | [[4 4] [3 4] [2 4] [1 4] [0 4]] 60 | [[4 4] [4 3] [4 2] [4 1] [4 0]]} 61 | (create-rays [5 5] [4 4]))) 62 | 63 | (it "gets a tree from a coordinate" 64 | (let [forest [[1 2 3] 65 | [4 5 6] 66 | [7 8 9]]] 67 | (should= 1 (get-tree forest [0 0])) 68 | (should= 5 (get-tree forest [1 1])) 69 | (should= 9 (get-tree forest [2 2])))) 70 | 71 | (it "calculates scenic score of ray" 72 | (let [forest (parse-forest (slurp "test-input"))] 73 | (should= 2 (get-scenic-score-of-ray forest [[2 3] [2 2] [2 1] [2 0]])) 74 | (should= 2 (get-scenic-score-of-ray forest [[2 3] [1 3] [0 3]])) 75 | (should= 1 (get-scenic-score-of-ray forest [[2 3] [2 4]])) 76 | (should= 2 (get-scenic-score-of-ray forest [[2 3] [3 3] [4 3]])))) 77 | 78 | (it "calculates scenic score of tree" 79 | (let [forest (parse-forest (slurp "test-input"))] 80 | (should= 8 (get-scenic-score-of-tree forest [2 3]))))) 81 | 82 | (describe "Part 2 solution" 83 | (it "solves test data" 84 | (should= 8 (find-best-scenic-score "test-input"))) 85 | 86 | (it "solves input" 87 | (should= 268912 (find-best-scenic-score "input")))) 88 | 89 | 90 | -------------------------------------------------------------------------------- /day14-regolith-reservoir/src/day14_regolith_reservoir/core.clj: -------------------------------------------------------------------------------- 1 | (ns day14-regolith-reservoir.core 2 | (:require [clojure.string :as string] 3 | [clojure.set :as set])) 4 | 5 | (defn sand-falls-one-step [cave sand-position] 6 | (let [[sx sy] sand-position 7 | straight-down [sx (inc sy)]] 8 | (if (contains? cave straight-down) 9 | (let [diagonally-left [(dec sx) (inc sy)]] 10 | (if (contains? cave diagonally-left) 11 | (let [diagonally-right [(inc sx) (inc sy)]] 12 | (if (contains? cave diagonally-right) 13 | nil 14 | diagonally-right)) 15 | diagonally-left)) 16 | straight-down))) 17 | 18 | (defn drop-sand 19 | ([cave sand-position] 20 | (drop-sand cave sand-position (apply max (map second cave)))) 21 | ([cave sand-position limit] 22 | (if (> (second sand-position) limit) 23 | :void 24 | (let [new-pos (sand-falls-one-step cave sand-position)] 25 | (if (nil? new-pos) 26 | sand-position 27 | (recur cave new-pos limit)))))) 28 | 29 | (defn add-sand [cave sand-position] 30 | (let [new-pos (drop-sand cave sand-position)] 31 | (if (= :void new-pos) 32 | [:void cave] 33 | [new-pos (conj cave new-pos)]))) 34 | 35 | (defn drop-til-target 36 | ([cave pos target] 37 | (drop-til-target cave pos target 0)) 38 | 39 | ([cave pos target n] 40 | (let [[new-sand cave-with-drop] (add-sand cave pos)] 41 | (prn new-sand) 42 | (if (= target new-sand) 43 | [n cave-with-drop] 44 | (recur cave-with-drop pos target (inc n)))))) 45 | 46 | (defn parse-coord [s] 47 | (let [coords (string/split s #",")] 48 | (map #(Integer/parseInt %) coords))) 49 | 50 | (defn parse-wall-vertices [line] 51 | (let [coords (string/split line #" -> ")] 52 | (map parse-coord coords))) 53 | 54 | (defn build-segment [[x1 y1] [x2 y2]] 55 | (cond 56 | (= x1 x2) 57 | (let [maxy (max y1 y2) 58 | miny (min y1 y2) 59 | ys (range miny (inc maxy))] 60 | (set (map #(vector x1 %) ys))) 61 | 62 | (= y1 y2) 63 | (let [maxx (max x1 x2) 64 | minx (min x1 x2) 65 | xs (range minx (inc maxx))] 66 | (set (map #(vector % y1) xs))) 67 | 68 | :else 69 | "TILT")) 70 | 71 | (defn build-wall 72 | ([vertices] 73 | (build-wall vertices #{})) 74 | 75 | ([vertices wall] 76 | (if (= 1 (count vertices)) 77 | wall 78 | (let [segment-vertices (take 2 vertices) 79 | segment (apply build-segment segment-vertices) 80 | new-wall (set/union wall segment)] 81 | (recur (rest vertices) new-wall))))) 82 | 83 | (defn count-remaining-sand [file-name] 84 | (let [lines (string/split-lines (slurp file-name)) 85 | segments (map parse-wall-vertices lines) 86 | walls (map build-wall segments) 87 | cave (apply set/union walls) 88 | [n cave] (drop-til-target cave [500 0] :void)] 89 | n)) 90 | 91 | (defn count-til-blocked [file-name] 92 | (let [lines (string/split-lines (slurp file-name)) 93 | segments (map parse-wall-vertices lines) 94 | walls (map build-wall segments) 95 | cave (apply set/union walls) 96 | limit (apply max (map second cave)) 97 | floor (set (map #(vector % (+ 2 limit)) (range -1000 1000))) 98 | cave (set/union cave floor) 99 | [n cave] (drop-til-target cave [500 0] [500 0])] 100 | (inc n))) 101 | -------------------------------------------------------------------------------- /day12-hill-climing-algorithm/input: -------------------------------------------------------------------------------- 1 | abaaaaaccccccccccccccccccaaaaaaaaaaaaaccccaaaaaaaccccccccccccccccccccccccccccaaaaaa 2 | abaaaaaaccaaaacccccccccccaaaaaaaaacaaaacaaaaaaaaaacccccccccccccccccccccccccccaaaaaa 3 | abaaaaaacaaaaaccccccccccaaaaaaaaaaaaaaacaaaaaaaaaacccccccccccccaacccccccccccccaaaaa 4 | abaaaaaacaaaaaacccccccccaaaaaaaaaaaaaaccaaacaaaccccccccccccccccaacccccccccccccccaaa 5 | abccaaaccaaaaaacccaaaaccaaaaaaaaaaaaaccccaacaaacccccccccaacaccccacccccccccccccccaaa 6 | abcccccccaaaaaccccaaaacccccaaaaacccaaaccaaaaaaccccccccccaaaaccccccccccccccccccccaac 7 | abcccccccccaaaccccaaaacccccaaaaacccccccccaaaaaccccccccccklllllccccccccccccccccccccc 8 | abcccccccccccccccccaaccccccccaaccccccccaaaaaaaccccccccckklllllllcccccddccccaacccccc 9 | abaccccccccccccccccccccccccccaaccccccccaaaaaaaaccccccckkkklslllllcccddddddaaacccccc 10 | abacccccccccccccccccccccccccccccccaaaccaaaaaaaaccccccckkkssssslllllcddddddddacccccc 11 | abaccccccccccccccccccccccccccccccccaaaaccaaacaccccccckkksssssssslllmmmmmdddddaacccc 12 | abcccccccccccccccaaacccccccccccccaaaaaaccaacccccccccckkkssssusssslmmmmmmmdddddacccc 13 | abcccccccaaccccaaaaacccccccccccccaaaaaccccccaaaaaccckkkrssuuuussssqmmmmmmmmdddccccc 14 | abcccccccaaccccaaaaaacccccccaaccccaaaaacccccaaaaacckkkkrruuuuuussqqqqqqmmmmdddccccc 15 | abccccaaaaaaaacaaaaaacccccccaaaaccaaccaccccaaaaaacjkkkrrruuuxuuusqqqqqqqmmmmeeccccc 16 | abcaaaaaaaaaaacaaaaaccccccaaaaaacccccaaccccaaaaajjjjrrrrruuuxxuvvvvvvvqqqmmmeeccccc 17 | abcaacccaaaaccccaaaaaaacccaaaaacccacaaaccccaaaajjjjrrrrruuuxxxxvvvvvvvqqqmmeeeccccc 18 | abaaaaccaaaaacccccccaaaccccaaaaacaaaaaaaacccaajjjjrrrrtuuuuxxxyvyyyvvvqqqnneeeccccc 19 | abaaaaaaaaaaacccaaaaaaaccccaacaacaaaaaaaacccccjjjrrrttttuxxxxxyyyyyvvvqqnnneeeccccc 20 | abaaaaaaaccaacccaaaaaaaaacccccccccaaaaaaccccccjjjrrrtttxxxxxxxyyyyyvvvqqnnneeeccccc 21 | SbaaaaaacccccccccaaaaaaaaaccccccccaaaaacccccccjjjrrrtttxxxEzzzzyyyvvrrrnnneeecccccc 22 | abaaaaacccccccccccaaaaaaacccccccccaaaaaaccccccjjjqqqtttxxxxxyyyyyvvvrrrnnneeecccccc 23 | abaaacccccccccccaaaaaaaccaaccccccccccaaccaaaaajjjqqqttttxxxxyyyyyyvvrrrnnneeecccccc 24 | abaaacccccccccccaaaaaaaccaaacaaacccccccccaaaaajjjjqqqtttttxxyywyyyywvrrnnnfeecccccc 25 | abcaaacccccccaaaaaaaaaaacaaaaaaaccccccccaaaaaaciiiiqqqqtttxwyywwyywwwrrrnnfffcccccc 26 | abcccccccccccaaaaaaaaaaccaaaaaacccccccccaaaaaacciiiiqqqqttwwywwwwwwwwrrrnnfffcccccc 27 | abccccccccccccaaaaaacccaaaaaaaacccccccccaaaaaaccciiiiqqqttwwwwwswwwwrrrrnnfffcccccc 28 | abccccccccccccaaaaaacccaaaaaaaaacccccccccaaacccccciiiqqqtswwwwssssrrrrrroofffcccccc 29 | abccccccaaaaacaaaaaacccaaaaaaaaaaccccccccccccccccciiiqqqssswsssssssrrrrooofffaccccc 30 | abccccccaaaaacaaccaaccccccaaacaaacccccccccccccccccciiiqqssssssspoorrrooooofffaacccc 31 | abcccccaaaaaacccccccccccccaaacccccccccccccccccccccciiiqppssssspppooooooooffffaacccc 32 | abcccccaaaaaacccccccccccccaacccccccccccccccccccccccciipppppppppppoooooooffffaaccccc 33 | abcccccaaaaaaccccccccccccccccccccccccccccccccccccccciihppppppppgggggggggfffaaaccccc 34 | abccccccaaacccccccccccccccccccccccaccccccccccccccccchhhhpppppphggggggggggfaaaaccccc 35 | abaaaccccccccccccccccccccccaccccaaacccccccccccccccccchhhhhhhhhhgggggggggcaacccccccc 36 | abaaccaaaccaccccccccccccccaaacccaaacaacccaaaaacccccccchhhhhhhhhgaaccccccccccccccccc 37 | abaaacaaacaacccccccccaaaccaaaacaaaaaaaaccaaaaaccccccccchhhhhhaaaaacccccccccccccccca 38 | abaaaccaaaaaccccccccccaaacaaaaaaaacaaaaccaaaaaaccccccccccaaacccaaaacccccccccccaccca 39 | abcccaaaaaaccccccccccaaaaaaaaaaaaacaaaaccaaaaaaccccccccccaaaccccaaaccccccccccaaaaaa 40 | abcccaaaaaaaacccccccaaaaaaaaaaaaaaaaaccccaaaaaacccccccccccccccccccccccccccccccaaaaa 41 | abcccaacaaaaaccccccaaaaaaaaaaaaaaaaaaacccccaacccccccccccccccccccccccccccccccccaaaaa -------------------------------------------------------------------------------- /day11-monkey-in-the-middle/src/day11_monkey_in_the_middle/core.clj: -------------------------------------------------------------------------------- 1 | (ns day11-monkey-in-the-middle.core 2 | (:require [clojure.string :as string])) 3 | 4 | (defn replace-old [old rule-token] 5 | (if (= rule-token :old) old rule-token)) 6 | 7 | (defn inspect [item worry-reduction rule] 8 | (let [rule (map (partial replace-old item) rule)] 9 | (worry-reduction (apply (first rule) (rest rule))))) 10 | 11 | (defn decide-where-to-throw [item monkey] 12 | (let [[divisor a b] (:decision monkey)] 13 | (if (= 0 (rem item divisor)) a b))) 14 | 15 | (defn throw-one-item [monkeys worry-reduction monkey-id] 16 | (let [monkey (monkeys monkey-id) 17 | items (:items monkey) 18 | monkey (assoc monkey :items (vec (rest items))) 19 | monkey (update monkey :inspections inc) 20 | item (first items) 21 | item (inspect item worry-reduction (:rule monkey)) 22 | recipient-id (decide-where-to-throw item monkey) 23 | monkeys (assoc monkeys monkey-id monkey)] 24 | (update-in monkeys [recipient-id :items] conj item))) 25 | 26 | (defn do-one-monkey [worry-reduction monkeys monkey-id] 27 | (let [monkey (monkeys monkey-id)] 28 | (if (empty? (:items monkey)) 29 | monkeys 30 | (recur worry-reduction (throw-one-item monkeys worry-reduction monkey-id) monkey-id)))) 31 | 32 | (defn do-one-round [monkeys worry-reduction] 33 | (reduce (partial do-one-monkey worry-reduction) monkeys (sort (keys monkeys)))) 34 | 35 | (defn parse-monkey [monkey-batch] 36 | (let [[_ id] (re-matches #"Monkey (\d+):" (first monkey-batch)) 37 | id (Integer/parseInt id) 38 | [_ items] (re-matches #".*Starting items: (.*)$" (nth monkey-batch 1)) 39 | items (string/split items #", ") 40 | items (vec (map #(Integer/parseInt %) items)) 41 | [_ operation] (re-matches #".*Operation: new = (.*)$" (nth monkey-batch 2)) 42 | [a op b] (string/split operation #" ") 43 | a (if (= a "old") :old (Integer/parseInt a)) 44 | b (if (= b "old") :old (Integer/parseInt b)) 45 | op (condp = op "*" * "+" + "TILT") 46 | [_ divisor] (re-matches #".*Test: divisible by (\d+)$" (nth monkey-batch 3)) 47 | divisor (Integer/parseInt divisor) 48 | [_ m-true] (re-matches #".*If true: throw to monkey (\d+)$" (nth monkey-batch 4)) 49 | m-true (Integer/parseInt m-true) 50 | [_ m-false] (re-matches #".*If false: throw to monkey (\d+)$" (nth monkey-batch 5)) 51 | m-false (Integer/parseInt m-false)] 52 | [id {:items items 53 | :rule [op a b] 54 | :decision [divisor m-true m-false] 55 | :inspections 0}])) 56 | 57 | (defn parse-monkeys [file-name] 58 | (let [lines (string/split-lines (slurp file-name))] 59 | (loop [batches (partition 7 7 "" lines) 60 | monkeys {}] 61 | (if (empty? batches) 62 | monkeys 63 | (let [[id monkey] (parse-monkey (first batches))] 64 | (recur (rest batches) (assoc monkeys id monkey))))))) 65 | 66 | (defn do-n-rounds [monkeys n worry-reduction] 67 | (let [monkeys (reduce (fn [monkeys _] (do-one-round monkeys worry-reduction)) monkeys (range n))] 68 | monkeys)) 69 | 70 | (defn find-mode [monkeys] 71 | (let [divisors (map #(first (:decision %)) (vals monkeys))] 72 | (reduce * divisors))) 73 | 74 | (defn monkey-business [file-name worry-reduction rounds] 75 | (let [monkeys (parse-monkeys file-name) 76 | final-monkeys (do-n-rounds monkeys rounds worry-reduction) 77 | inspections (sort (map :inspections (vals final-monkeys)))] 78 | (apply * (take-last 2 inspections)))) 79 | 80 | -------------------------------------------------------------------------------- /day8-treetop-tree-house/src/day8_treetop_tree_house/core.clj: -------------------------------------------------------------------------------- 1 | (ns day8-treetop-tree-house.core 2 | (:require [clojure.string :as string] 3 | [clojure.set :as set])) 4 | 5 | (defn to-row [line] 6 | (map #(Integer/parseInt (str %)) line)) 7 | 8 | (defn parse-forest [forest-input] 9 | (let [tree-rows (string/split-lines forest-input)] 10 | (map to-row tree-rows))) 11 | 12 | (defn count-trees [forest] 13 | (* (count forest) (count (first forest)))) 14 | 15 | (defn bounds-of [forest] 16 | [(count (first forest)) (count forest)]) 17 | 18 | (defn rotate-forest [forest] 19 | (apply mapv vector forest)) 20 | 21 | (defn hidden-from-left [row] 22 | (loop [row row 23 | hidden #{} 24 | current-max -1 25 | pos 0] 26 | (if (empty? row) 27 | hidden 28 | (let [tree (first row)] 29 | (if (> tree current-max) 30 | (recur (rest row) hidden tree (inc pos)) 31 | (recur (rest row) (conj hidden pos) current-max (inc pos))))))) 32 | 33 | (defn hidden-from-right [row] 34 | (let [n (count row) 35 | reversed-positions (hidden-from-left (reverse row))] 36 | (set (map #(- (dec n) %) reversed-positions)))) 37 | 38 | (defn hidden-in-row [row] 39 | (set/intersection (hidden-from-left row) (hidden-from-right row))) 40 | 41 | (defn find-hidden-trees-by-row [forest] 42 | (loop [forest forest 43 | hidden #{} 44 | row-coord 0] 45 | (if (empty? forest) 46 | hidden 47 | (let [row (first forest) 48 | hidden-this-row (hidden-in-row row) 49 | hidden-coords (set (map #(vector % row-coord) hidden-this-row))] 50 | (recur (rest forest) (set/union hidden hidden-coords) (inc row-coord)))))) 51 | 52 | (defn find-hidden-trees-by-column [forest] 53 | (let [rotated-forest (rotate-forest forest) 54 | rotated-hidden (find-hidden-trees-by-row rotated-forest)] 55 | (set (map reverse rotated-hidden)))) 56 | 57 | (defn find-hidden-trees [forest] 58 | (let [hidden-by-row (find-hidden-trees-by-row forest) 59 | hidden-by-column (find-hidden-trees-by-column forest)] 60 | (set/intersection hidden-by-row hidden-by-column))) 61 | 62 | (defn count-visible-trees [file-name] 63 | (let [input (slurp file-name) 64 | forest (parse-forest input) 65 | hidden-trees (find-hidden-trees forest) 66 | total-trees (count-trees forest)] 67 | (- total-trees (count hidden-trees)))) 68 | 69 | (defn create-rays [bounds start] 70 | (let [[w h] bounds 71 | [x y] start] 72 | (set 73 | [(for [rx (range x w)] [rx y]) 74 | (for [rx (range x -1 -1)] [rx y]) 75 | (for [ry (range y h)] [x ry]) 76 | (for [ry (range y -1 -1)] [x ry])]))) 77 | 78 | (defn get-tree [forest coord] 79 | (let [[x y] coord 80 | row (nth forest y)] 81 | (nth row x))) 82 | 83 | (defn get-scenic-score-of-ray [forest ray] 84 | (let [trees-in-ray (map #(get-tree forest %) ray) 85 | target-tree (first trees-in-ray)] 86 | (loop [distant-trees (rest trees-in-ray) 87 | distance 0] 88 | (if (empty? distant-trees) 89 | distance 90 | (let [tree (first distant-trees)] 91 | (if (>= tree target-tree) 92 | (inc distance) 93 | (recur (rest distant-trees) (inc distance)))))))) 94 | 95 | (defn get-scenic-score-of-tree [forest tree-coord] 96 | (let [rays (create-rays (bounds-of forest) tree-coord)] 97 | (reduce * (map #(get-scenic-score-of-ray forest %) rays)))) 98 | 99 | (defn find-best-scenic-score [file-name] 100 | (let [forest (parse-forest (slurp file-name)) 101 | [w h] (bounds-of forest) 102 | scores (for [x (range w) y (range h)] 103 | (get-scenic-score-of-tree forest [x y]))] 104 | (apply max scores))) -------------------------------------------------------------------------------- /day6-tuning-trouble/input: -------------------------------------------------------------------------------- 1 | bjbffsfnsnppzpphvhjvjtjmjwjrjdjffwrfrvvrqrrqwrrqpqhqnnddvccrbbwcwbcbclclhlzlznntrrzffctcggzqgqtgqtgtrgttlhttgstgtsgsfsnsddsvdsvddrzrvrnvnrvnrnmrrvfvbfbnbmmtbbgpgtptjptpctpccmccgbccqbcqczqccdssfqfzzjgzzvcvgggrjggncgctgtjjpttqtrrvmrvmmzzfcffpgfgfqggbwgghcctllfhlffbbcffspfpcplpjjlwldwldlpddwzzlqzqfzzcwcmwwcddhgddstsnsjsvjsvvndndsnnclcvcpvpwpqwpqwqllcjcsjjbppfdftfrrpwwqtqtvtllrsrhhczzgllsbsvsttbsszzgwgjwjqwjwvvcmcbczbbgppghghgshhvmhmvvvflllllsrsqsbbfsshhrhddcncbnnrfnnbtbftfltftdtndtdtcdcbdcbchhtddhhvbvsbstsjsjppmpjpttmjjvtjvvdcctcbbbbqzzssfdsdrdwdpplspllphpnhnshnncwnnhlnhhvvpttfftwfwjfjzjsjddjldjlddvzzfzczrzjrzrhzhshslhsllmcllhhthrttfssnqnjnbbzfbbmpmlplhlttmzzwrwjrjppzmpmrprcprplrprmrvrvqrrnlnccswwvggvgcgddlrlrccqhhgvgnvvmlmmcqqhrqrwqwsswgssfjjgvjvppfffhjhrhfhhlphpmpzmpmlppcspcpgpnpddcmcllwvvqfqbbpbcchjjpzpzbbhbzhhrrzrhzhphqphhqvqttmhhbvbcbcmbbfgbbmnmncmnmvnvffgdfggvhvthvhqqdwwvmvlmljjjvsjswjwzwjjqmqrmqmlljqqjvqvtvlldjjfbbpbvbttqhhgrrcssfdsdccrncrncnmnvvmccnrrrtctjtsjttrmrhhvdhdrdjdpdhphsppnttnhhvdvvztvtftsfsrfrppsggfbgbbvbmmjgjrjttfnngttscclzcztctcltcllsmllggbfbhffjljhhbjjjgddzdvdvrvzrrgqgllnvllnccqjqhhwrhhtfttfpfsfvfqvqgvgpppjjhzzcszczbcbtblltlffdfwddfsspgprgpgjgdgsgcccrllbzbqzbzwbwwtmwwvpvlpljlsjssfnfqfzqffthtjtptvptvvmlvlzzdnznwnddjtjpptnpnccbsccjmjqqcfcdddwtdtftntzzpbbbhcbblglttrmmclcdchhzttjwtwztwzwzczfccmrmcrmrsrnsrnrsnrrfmmmcpmmjtjrrwssvdssrvrqvrvcrchrhfhpprwprwpwtttvrtvrvffdcfcssfrfbbvsslvvhphrrwggssjtjbttqtllnmlnljlmmtllfjjtjtpjttbwbswsnwnnjdjbblfbfmmblmmwnmnncjcwwhzzdffvppvmmtzzrhrchhtjhttcssvnsnvnhvvdgvvvgtvtqtgqqzrzbzqzgqgmqmtqqztqqgllchlclwwbwrrwprwprrlgrgwggjhggtgmtggjddfhdddnzztrtjrjprpwrwttqzqnzzfnfcnfcftflfttvbvpbpllrtltslttlddbzdbzzfjfrjfjcjhjssbcsczcnznlzzggdccllhbhpbhbjbwjbwjwtwffptpqqqmssrlrddwqwqdqfqjqwqtqhtsrgvsdtrjmhtgrwvwrbfqtgvjbwphbrszdcgtcpqqrcqtzvzjstzpbmwrqlrcsmlnqpsprsfnpqqsdzbfglcshtjpphmchdzggrcjwttwlzdffgpswzfjdcgzntgzsqvjdnwwwwmtjvpqjgmltmstzztpzflfdhbhhljgdmthnrdzhmtwcmpsjnlgwcvnwdbdrbhcsscgwtptzrmqcwdcmsssmqjpnvclhhbgsjrmqgvvqhgmhzmnpqtczqwmnpvvpdhdtdpdsrmzwtsfchzmdlggrnvwcfbfmrgffssdjjlwbdvjqqwddgmgfwvbzldccwnwrnltcrmblwqswjslnsjtfqvssdrdtpwptdtvtdwhgtgqnmhqfljjjsdgwmptbctjtpdhzmtshgdwnnhfjthmhdrqqqprrdwhvsfwfbvwtfvhgglfphzwjqffwcclbpmtcqzmtjmswscngtbmbdsvfzfbgwvhwlhtgdsnscnrssdqzvhmhplqppzrgdncfvvpnzhgnjrvcmhrqmzvzmdhhpjmrrnwfrhdgqdhvvstbldrgdcwbgjvcwhfrpbgrnvgcszhpbbgvqnvvrrcgprtsftjqtnrbqrzspmzpnchbrbbbpnjdllhnnbcfdsjjhhjcrvvtsgnnfvczvqgvbgphzzjcczsgtlvfrddzlvwdfhprnsvrnzdcfqsbfhcmnrgmrfqwcblbzgrpnvbtrqqnnfslfllfsmrrfsthfzgrwswdprzcswgrjcpzwfhzbhpmsjjtsgcqpnhtwpvpcbpttdpcftrqsbtgtspdhlvmphvnglsdntqfzcrwvvzsmjftjpgjglnnjhnpbhpcmwshdrfbczwtmtslcpmnpngvhlccvtwrsglrrfcmngshtjlnvrtqpfngrrtvhhvmnbwpjtwplfnmfqrbzzqzwchthjbbrpgdppmsjlbljrzqvhmsbrtwglgwnhmmdwpmvmjqqrhtmjjmcnbgtpbbqbnphzhwfhzddqbhqhtmwvffjdcfjmwjjdrqwsfzfrrwlmhndhdvrsdqtmccdqgppwpfrtcgzzwczfblvtjhhdjmdlldbtwthfdpjhpsgbcjjznmwdgnczbnfdfslhsjcjnthgsjlslbcvvqgqbstdwlqllpmmtqlqrbtnvphvwhbshhpdzfbclsqgdmhrnjmbwjzwzdtqswzgmnmwcqcmtpnjzzcrqftvnrdqghszchhmnvlvmcmblpcqnspsjthgqrdpbrzvwtfmnfdcfgwtlvpvwjdwzdvqvgdrcqvzwlbmcwmbsqfhzmwfqmjvgjtsprwbbsrldnwmvhrtsmcdsbftpvcsmpnlmlggmlrgjfvljmpfldftqhjmqqhwfpjtzrrhtlrmmstjphtmldslnnmfhnccrpgjmrbffcvgvmghhnpqhpvdqmdzqcjtcjplhlffwgslpsfzpwqsfpngscdlszlpctpqgdmvwfdfgpwrpltvlwrzrgjjjnjtrwctjsnbtpbfbgqzftmjhfrzrtmtnztlhwwgqnvmfnrshfcdswbqnlrqvtgjdzmqqcdgpwjlgfwnnnjsmmtfbvpwqvnjdjphclnvjntqlfwdppjgcvlcjmfdsbtgngcglmdgsgzwdvsqlvgwcrjtttgdmrlthhwhnnrvvrjgqzqmbcbmhdwmndhjstlmbtwjbgmlrqqcmqzjzcbbfrqrqlmvvgfrdtrwrpgcfsrnjdbfddwgwqrlpvfjgnjjnrlzpbtnjphlqzmdwnqhvblmwzvtnsvbcgqdpmgvchqmgjmbvrfwmmzlchhbqrfmvdffczcsjlhjrmmlmdztmltszrjlrgjwrlfwvlgqtqznnscbqgdzbvdnnjbfmcztjvbgbfmdhvrjgjcngtpzndpnpwwldlfrtqhwpfwphrgdzjvslnbpmrvjpcjpbbsmpwvzmldrspmrlbsptzfdngcscsllswzccjzlmbglsrthvbzznzpjdswhqncmrpnqhzggzzfvhlgqbvlmfsqglpphhswhjbpqnqfpzltmhndmmzclwfmlqztvrqdzfqjpdhttgshjwffdcchmvrwmblpzffbgwrgnqhhvvsvlwnzmmhjwrszpfdsncjwllrnzrsfjsrdgnrbjqlrvpmzbstlqdznhjgbslzmplnqprwqgddjlwzbtrmfsfdlggddqrccztjffvbnsmfdzdhrgsflffmmjtjlbtnfcwhwzdsnbbphbjlrfrddbpncjrtglsnrppdbznrbjqqzdswnhvssffhjzrwnmlvmwmljnhtsnplpjdjpqzbbmzzfcmpm -------------------------------------------------------------------------------- /day13-distress-signal/spec/day13_distress_signal/core_spec.clj: -------------------------------------------------------------------------------- 1 | (ns day13-distress-signal.core-spec 2 | (:require [speclj.core :refer :all] 3 | [day13-distress-signal.core :refer :all])) 4 | 5 | (describe "distress signal" 6 | (context "comparisons" 7 | (it "compares two integers" 8 | (should= :right-order (compare-signal 1 2)) 9 | (should= :wrong-order (compare-signal 2 1)) 10 | (should= :equal (compare-signal 1 1))) 11 | 12 | (it "compares two lists" 13 | (should= :equal (compare-signal [1] [1])) 14 | (should= :right-order (compare-signal [1] [2])) 15 | (should= :right-order (compare-signal [1] [1 1])) 16 | (should= :right-order (compare-signal [1 1] [1 2])) 17 | (should= :right-order (compare-signal [1 [2 1]] [1 [2 3]])) 18 | (should= :right-order (compare-signal [1 [2 1]] [1 [2 1 1]])) 19 | (should= :right-order (compare-signal [] [[] []])) 20 | (should= :right-order (compare-signal [[]] [[] []])) 21 | 22 | 23 | (should= :wrong-order (compare-signal [2] [1])) 24 | (should= :wrong-order (compare-signal [1 1] [1])) 25 | (should= :wrong-order (compare-signal [1 [2 3]] [1 [2 1]])) 26 | (should= :wrong-order (compare-signal [1 [2 1 1]] [1 [2 1]]))) 27 | 28 | (it "compares and integer and a list" 29 | (should= :right-order (compare-signal 1 [2])) 30 | (should= :wrong-order (compare-signal [2] 1))) 31 | 32 | (it "compares sample data correctly" 33 | (should= :right-order (compare-signal [1, 1, 3, 1, 1] [1, 1, 5, 1, 1])) 34 | (should= :right-order (compare-signal [[1], [2, 3, 4]] [[1], 4])) 35 | (should= :right-order (compare-signal [[4, 4], 4, 4] [[4, 4], 4, 4, 4])) 36 | (should= :right-order (compare-signal [] [3])) 37 | 38 | (should= :wrong-order (compare-signal [9] [[8, 7, 6]])) 39 | (should= :wrong-order (compare-signal [7, 7, 7, 7] [7, 7, 7])) 40 | (should= :wrong-order (compare-signal [[[]]] [[]])) 41 | (should= :wrong-order (compare-signal [1, [2, [3, [4, [5, 6, 7]]]], 8, 9] [1, [2, [3, [4, [5, 6, 0]]]], 8, 9])))) 42 | 43 | (context "parsing data" 44 | (it "parses pairs" 45 | (should= [1 2] (parse-pair "1" "2")) 46 | (should= [[1] [2]] (parse-pair "[1]" "[2]")) 47 | (should= [[1, [2, [3, [4, [5, 6, 7]]]], 8, 9] 48 | [1, [2, [3, [4, [5, 6, 0]]]], 8, 9]] 49 | (parse-pair "[1,[2,[3,[4,[5,6,7]]]],8,9]" 50 | "[1,[2,[3,[4,[5,6,0]]]],8,9]"))) 51 | 52 | (it "creates pair map" 53 | (should= {1 [1 2] 54 | 2 [3 4]} 55 | (make-pair-map ["1" "2" "" "3" "4"])))) 56 | 57 | (context "part 1 solution" 58 | (it "solves test data" 59 | (should= 13 (sum-right-indices "test-input"))) 60 | 61 | (it "solves input" 62 | (should= 6187 (sum-right-indices "input")))) 63 | 64 | (context "part 2 solution" 65 | (it "sorts all the packets" 66 | (should= [ 67 | [] 68 | [[]] 69 | [[[]]] 70 | [1, 1, 3, 1, 1] 71 | [1, 1, 5, 1, 1] 72 | [[1], [2, 3, 4]] 73 | [1, [2, [3, [4, [5, 6, 0]]]], 8, 9] 74 | [1, [2, [3, [4, [5, 6, 7]]]], 8, 9] 75 | [[1], 4] 76 | [[2]] 77 | [3] 78 | [[4, 4], 4, 4] 79 | [[4, 4], 4, 4, 4] 80 | [[6]] 81 | [7, 7, 7] 82 | [7, 7, 7, 7] 83 | [[8, 7, 6]] 84 | [9] 85 | ] (sort-packets [ 86 | [1, 1, 3, 1, 1] 87 | [1, 1, 5, 1, 1] 88 | [[1], [2, 3, 4]] 89 | [[1], 4] 90 | [9] 91 | [[8, 7, 6]] 92 | [[4, 4], 4, 4] 93 | [[4, 4], 4, 4, 4] 94 | [7, 7, 7, 7] 95 | [7, 7, 7] 96 | [] 97 | [3] 98 | [[[]]] 99 | [[]] 100 | [1, [2, [3, [4, [5, 6, 7]]]], 8, 9] 101 | [1, [2, [3, [4, [5, 6, 0]]]], 8, 9] 102 | [[2]] 103 | [[6]] 104 | ]))) 105 | ) 106 | 107 | (it "solves test-input" 108 | (should= 140 (decoder-key-of "test-input"))) 109 | 110 | (it "solves input data" 111 | (should= 23520 (decoder-key-of "input")))) 112 | 113 | 114 | -------------------------------------------------------------------------------- /day11-monkey-in-the-middle/spec/day11_monkey_in_the_middle/core_spec.clj: -------------------------------------------------------------------------------- 1 | (ns day11-monkey-in-the-middle.core-spec 2 | (:require [speclj.core :refer :all] 3 | [day11-monkey-in-the-middle.core :refer :all])) 4 | 5 | (defn div3 [worry] (quot worry 3)) 6 | 7 | (declare m0-rule m1-rule m2-rule m3-rule 8 | monkey0 monkey1 monkey2 monkey3 9 | monkeys) 10 | (describe "how monkeys work" 11 | (with m0-rule [* :old 19]) 12 | (with m1-rule [+ :old 6]) 13 | (with m2-rule [* :old :old]) 14 | (with m3-rule [+ :old 3]) 15 | (with monkey0 {:rule @m0-rule :decision [23 2 3] 16 | :items [79 98] :inspections 0}) 17 | (with monkey1 {:rule @m1-rule :decision [19 2 0] 18 | :items [54 65 75 74] :inspections 0}) 19 | (with monkey2 {:rule @m2-rule :decision [13 1 3] 20 | :items [79 60 97] :inspections 0}) 21 | (with monkey3 {:rule @m3-rule :decision [17 0 1] 22 | :items [74] :inspections 0}) 23 | (with monkeys {0 @monkey0 24 | 1 @monkey1 25 | 2 @monkey2 26 | 3 @monkey3}) 27 | 28 | (it "inspects and computes worry" 29 | (should= 500 (inspect 79 div3 @m0-rule)) 30 | (should= 20 (inspect 54 div3 @m1-rule)) 31 | (should= 2080 (inspect 79 div3 @m2-rule))) 32 | 33 | (it "decides where to throw" 34 | (should= 3 (decide-where-to-throw (inspect 79 div3 @m0-rule) @monkey0)) 35 | (should= 1 (decide-where-to-throw (inspect 79 div3 @m2-rule) @monkey2)) 36 | (should= 3 (decide-where-to-throw (inspect 60 div3 @m2-rule) @monkey2))) 37 | 38 | (it "throws between monkeys" 39 | (let [new-monkeys (throw-one-item @monkeys div3 0) 40 | new-monkey-0 (new-monkeys 0) 41 | new-monkey-3 (new-monkeys 3)] 42 | (should= [98] (:items new-monkey-0)) 43 | (should= 1 (:inspections new-monkey-0)) 44 | (should= [74 500] (:items new-monkey-3)))) 45 | 46 | (it "executes a round for one monkey" 47 | (let [new-monkeys (do-one-monkey div3 @monkeys 2) 48 | monkey1 (new-monkeys 1) 49 | monkey2 (new-monkeys 2) 50 | monkey3 (new-monkeys 3)] 51 | (should= 3 (:inspections monkey2)) 52 | (should= [] (:items monkey2)) 53 | (should= [54 65 75 74 2080] (:items monkey1)) 54 | (should= [74 1200 3136] (:items monkey3)))) 55 | 56 | (it "does one round" 57 | (let [new-monkeys (do-one-round @monkeys div3 )] 58 | (let [monkey0 (new-monkeys 0) 59 | monkey1 (new-monkeys 1) 60 | monkey2 (new-monkeys 2) 61 | monkey3 (new-monkeys 3)] 62 | (should= [20 23 27 26] (:items monkey0)) 63 | (should= [2080 25 167 207 401 1046] (:items monkey1)) 64 | (should= [] (:items monkey2)) 65 | (should= [] (:items monkey3))))) 66 | 67 | (context "parse the monkeys" 68 | (it "should parse a monkey" 69 | (should= [0 @monkey0] (parse-monkey 70 | ["Monkey 0:" 71 | "Starting items: 79, 98" 72 | "Operation: new = old * 19" 73 | "Test: divisible by 23" 74 | "If true: throw to monkey 2" 75 | "If false: throw to monkey 3"]))) 76 | (it "should parse test input" 77 | (should= @monkeys (parse-monkeys "test-input"))))) 78 | 79 | (defn new-worry-reduction [n] (mod n 9699690)) 80 | (defn test-worry-reduction [n] (mod n 96577)) 81 | 82 | (describe "Solutions" 83 | (context "part 1" 84 | (it "solves test input" 85 | (should= 10605 (monkey-business "test-input" div3 20))) 86 | 87 | (it "solves input" 88 | (should= 57348 (monkey-business "input" div3 20)))) 89 | 90 | (context "part 2 with new worry reduction" 91 | (it "finds mode for test data" 92 | (should= 96577 (find-mode (parse-monkeys "test-input")))) 93 | 94 | (it "finds mode for input" 95 | (should= 9699690 (find-mode (parse-monkeys "input")))) 96 | 97 | (it "tries one round" 98 | (let [monkeys (parse-monkeys "test-input") 99 | monkeys (do-n-rounds monkeys 1 test-worry-reduction) 100 | inspections (map :inspections (vals monkeys))] 101 | (should= [2 4 3 6] inspections))) 102 | 103 | (it "tries 20 rounds" 104 | (let [monkeys (parse-monkeys "test-input") 105 | monkeys (do-n-rounds monkeys 20 test-worry-reduction) 106 | inspections (map :inspections (vals monkeys))] 107 | (should= [99 97 8 103] inspections))) 108 | 109 | (it "tries 1000 rounds" 110 | (let [monkeys (parse-monkeys "test-input") 111 | monkeys (do-n-rounds monkeys 1000 test-worry-reduction) 112 | inspections (map :inspections (vals monkeys))] 113 | (should= [5204 4792 199 5192] inspections))) 114 | 115 | (it "solves test-input" 116 | (should= 2713310158 (monkey-business "test-input" test-worry-reduction 10000))) 117 | 118 | (it "solves input" 119 | (should= 14106266886 (monkey-business "input" new-worry-reduction 10000))))) 120 | 121 | -------------------------------------------------------------------------------- /day12-hill-climing-algorithm/src/day12_hill_climing_algorithm/core.clj: -------------------------------------------------------------------------------- 1 | (ns day12-hill-climing-algorithm.core 2 | (:require [clojure.string :as string])) 3 | 4 | (defn get-cell [grid [x y]] 5 | (try 6 | (-> grid (nth y) (nth x)) 7 | (catch Exception _e 8 | "TILT"))) 9 | 10 | (defn get-bounds [grid] 11 | [(count (first grid)) (count grid)]) 12 | 13 | (defn in-bounds [grid [x y]] 14 | (let [[bx by] (get-bounds grid)] 15 | (and 16 | (< -1 x bx) 17 | (< -1 y by)))) 18 | 19 | (defn ortho-from [grid [x y]] 20 | (let [orthos [[x (dec y)] 21 | [(inc x) y] 22 | [x (inc y)] 23 | [(dec x) y]] 24 | orthos (filter (partial in-bounds grid) orthos)] 25 | (set orthos))) 26 | 27 | (defn parse-line [line] 28 | (let [line (replace {\S \a \E \z} line) 29 | line (map int line) 30 | line (map #(- % (int \a)) line)] 31 | line)) 32 | 33 | (defn find-in-lines [lines target] 34 | (let [found (for [y (range (count lines)) x (range (count (first lines)))] 35 | (if (= target (-> lines (nth y) (nth x))) 36 | [x y] 37 | nil))] 38 | (first (remove nil? found))) 39 | ) 40 | 41 | (defn parse-lines [lines] 42 | (let [grid (map parse-line lines) 43 | start (find-in-lines lines \S) 44 | end (find-in-lines lines \E)] 45 | [start end grid]) 46 | ) 47 | 48 | (defn make-height-map [file-name] 49 | (let [lines (string/split-lines (slurp file-name))] 50 | (parse-lines lines))) 51 | 52 | (defn valid-climbing-step? [grid height pos] 53 | (let [pos-height (get-cell grid pos) 54 | diff (- pos-height height)] 55 | (<= diff 1))) 56 | 57 | (defn valid-descending-step? [grid height pos] 58 | (let [pos-height (get-cell grid pos) 59 | diff (- pos-height height)] 60 | (>= diff -1))) 61 | 62 | (defn possible-steps-while-climbing [grid pos] 63 | (let [orthos (ortho-from grid pos) 64 | height (get-cell grid pos) 65 | steps (filter (partial valid-climbing-step? grid height) orthos)] 66 | (set steps))) 67 | 68 | (defn possible-steps-while-descending [grid pos] 69 | (let [orthos (ortho-from grid pos) 70 | height (get-cell grid pos) 71 | steps (filter (partial valid-descending-step? grid height) orthos)] 72 | (set steps))) 73 | 74 | (defn distance [p1 p2] 75 | (reduce + (map #(Math/abs ^int %) (map - p1 p2)))) 76 | 77 | (defn distance-3d [grid end step] 78 | (let [distance-to-end (distance step end) 79 | remaining-height (- 25 (get-cell grid step))] 80 | (if (>= distance-to-end remaining-height) 81 | distance-to-end 82 | (+ distance-to-end (- remaining-height distance-to-end))))) 83 | 84 | (defn prune-and-prioritize [end grid path shortest steps] 85 | (let [steps (remove #(contains? (set path) %) steps) 86 | max-distance (- (count shortest) (count path)) 87 | steps (remove #(> (distance % end) max-distance) steps) 88 | distance-and-steps (map #(vector (distance-3d grid end %) %) steps) 89 | sorted-by-distance (sort-by first distance-and-steps)] 90 | (map second sorted-by-distance))) 91 | 92 | (defn prune-path [path steps] 93 | (let [steps (remove #(contains? (set path) %) steps)] 94 | steps)) 95 | 96 | (defn make-shortest-map [grid max-path-length] 97 | (let [[bx by] (get-bounds grid) 98 | cell-positions (for [x (range bx) y (range by)] [x y]) 99 | shortest-map (apply hash-map (interleave cell-positions (repeat (* bx by) max-path-length)))] 100 | shortest-map)) 101 | 102 | (defn find-shortest-path 103 | ([[start end grid]] 104 | (let [shortest (atom (repeat 1000 0)) 105 | shortest-map (atom (make-shortest-map grid 1000))] 106 | (find-shortest-path start end grid [start] shortest shortest-map) 107 | @shortest)) 108 | 109 | ([pos end grid path shortest shortest-map] 110 | (let [path-length (count path)] 111 | (when (< path-length (get @shortest-map pos)) 112 | (swap! shortest-map assoc pos path-length) 113 | (cond 114 | (= pos end) 115 | (do 116 | (prn path-length path) 117 | (reset! shortest path)) 118 | 119 | (< path-length (count @shortest)) 120 | (let [steps (possible-steps-while-climbing grid pos) 121 | prioritized-steps (prune-and-prioritize end grid path @shortest steps)] 122 | (doseq [step prioritized-steps] 123 | (find-shortest-path step end grid (conj path step) shortest shortest-map))) 124 | 125 | :else 126 | nil))))) 127 | 128 | (defn shortest-path-length [file-name] 129 | (let [height-map (parse-lines (string/split-lines (slurp file-name))) 130 | shortest (find-shortest-path height-map)] 131 | (dec (count shortest)))) 132 | 133 | (defn find-shortest-path-to-low-ground 134 | ([start grid] 135 | (let [shortest (atom (repeat 1000 0)) 136 | shortest-map (atom (make-shortest-map grid 1000))] 137 | (find-shortest-path-to-low-ground start grid [start] shortest shortest-map) 138 | @shortest)) 139 | 140 | ([pos grid path shortest shortest-map] 141 | (let [path-length (count path)] 142 | (when (< path-length (get @shortest-map pos)) 143 | (swap! shortest-map assoc pos path-length) 144 | (cond 145 | (zero? (get-cell grid pos)) 146 | (do 147 | (prn path-length path) 148 | (reset! shortest path)) 149 | 150 | (< path-length (count @shortest)) 151 | (let [steps (possible-steps-while-descending grid pos) 152 | prioritized-steps (prune-path path steps)] 153 | (doseq [step prioritized-steps] 154 | (find-shortest-path-to-low-ground step grid (conj path step) shortest shortest-map))) 155 | 156 | :else 157 | nil))))) 158 | 159 | (defn shortest-scenic-path [file-name] 160 | (let [[_ end grid] (parse-lines (string/split-lines (slurp file-name))) 161 | shortest (find-shortest-path-to-low-ground end grid)] 162 | (dec (count shortest)))) 163 | -------------------------------------------------------------------------------- /day8-treetop-tree-house/input: -------------------------------------------------------------------------------- 1 | 201111211202111301212201403141040230323033312212134523125000140404300230341330300221220012110101011 2 | 011220103113221111202122124010033421404432343233535151335133353340034134034332440001110102010010220 3 | 122121120300202230411332402004044235424325455343231124521355323541403402031010313440121321321322221 4 | 200021211323122312440342411331012332252341254144425451345233324423152201041200212200331121111210011 5 | 022213121203213301221100041021415245132424534145512125411151335224315551123141404223410032032000022 6 | 101131310332214402243114310442325141344331525541232153453225442351235123130234413214313330121121101 7 | 101102011001014411302320032155533351421345311554341111544153414344211242545240114004311012303003230 8 | 101023122212322231421422241433315213542415532226334465642351151321144451152132311230002433230001110 9 | 101102012000130221414322332331245251153242654525425363234533655232423135443124134230202313201000123 10 | 113023100223214000232555442143243135556634652423636245645335623323351235221252344243002420033131123 11 | 021023012400222133115232154155255455226363244263663662564362455342612241224452135301204334403311211 12 | 011011120014313211333124154235235522553465256455435352362343343356452125515224121432404101240133203 13 | 011310103034221123212123555245622666563625344356454344325522453265262433154414231333142413311331323 14 | 303301320412010454251154421242542562366466364652264364325544554624545256254413534434331434344310311 15 | 211332131030004243315521542363644424356453643345544752562524552255353324654134525543231434112230100 16 | 002102403432244535421254566353326346446265345654366646566543552562536326635315453214125414141214102 17 | 331140031313041444123423526426422252527375577546753455777737547626364645566461554234123523430311313 18 | 330401323101512253253516526653653542734767336644345445665364743533364355534236521342413154132413122 19 | 330411204212311445244535522655343573747374364345564574375763553465534526662642244443311121403103124 20 | 023332003431144254543626226245566455744465356337347475347374637637653442626233624414255134423423042 21 | 244210400021232153266652252325756653575474576355747475663555354556777566436342344532415443212134234 22 | 243022342335541213565253544236755753776564447733743446775775654547533666422423326624134345443023202 23 | 400214112533143341263455565263566576767643378645664845674353474533736575624522664521123334133420203 24 | 314412035353435253634446462463763443376476847467648547566465453356757464475343435464134531133123324 25 | 210413325433315134452365563547564744658868746684566644877466576346553654766362254362221413424430422 26 | 440400434542543525543663633667763537556667668747746756785587458767563547637623326226661151144334010 27 | 203031334152125642466635547657766584664687848767577545486757587488654373354446324524564152231113112 28 | 241001452244343336664255646743677756848545865758665674685886656454447657464556245442364333553250131 29 | 014023224515325454455574567445744885857785756585855854887668646555746475564455722536445351532451133 30 | 240034522142434662453346666663547675448567854897757695674874464454475574464737776424553231541143102 31 | 202432344512662423437374345345446848546655697769865799957684557848684543374647545532223321334341333 32 | 123325111441445225523673536445447568774877677796777678697975965546774547536673437544656344512135444 33 | 310254211535525232233446556788846647746897588857688579889788855477655648566666635426236522424112342 34 | 034313254213653456477557533774786647669769587699976668986696667747555648883667447465462526444143342 35 | 143141533334542466354344755484874754698685556789559989587957999587645467546553365742323424612353420 36 | 023355513126235334753777564744657489776767789956675687857787669856547584455737646446352333233414322 37 | 223531421366552557666573477756875578695968796778976887859959556598778688876655735777332545512434212 38 | 324553233365452565557437476777687565788999986896686778796755558896856684686773556344634525262453452 39 | 213242455253625376773454787557859959899988899999978889797885876979769647857487767764545335245255213 40 | 153212131552226337374543645684765767796896876966989866686867979876788867784675754744525622655431425 41 | 043231154325334367553646774578457959887979898666866967789799775569887978674668454463732263426513135 42 | 335542344226645477333775676444769565755967887779666696689698896656597875884556557743462633443124152 43 | 335323556552426765767775874764689686976988996666779796996969887796587577847457535454643262525413534 44 | 031342356243536356663654658854697858887697788666879779897996867856867654685767655656766443625531132 45 | 335345116666525747477647458845785958767699688899778878776776988777668657478884857465753336533142152 46 | 431315146645532647447566887678656986686996889897797878877768979656986556466744563333546332255135135 47 | 345455244545432335674458658587555587989897879999798888988976986779787768754855836367363664566413353 48 | 512151454564534653477764765466595799679979878789789879998767887865797755765458674344355656253343334 49 | 223351266325633575663774564489796879687898688978997788798999779796767956656764647364636656442223522 50 | 453333263535357446366584455459557799968998879988898977978787696768578657875454473547567326532334111 51 | 522431356454444356554374544846975859978878977879979897898976787967789578746656874774547443245541214 52 | 524451243233255555453685476745875568898798878799987879899778979895889689545784464464664644546653534 53 | 351343243662255667567757864679695778779676778997998897779866887675677768667848643753754363345434313 54 | 422125253344236737334386654576687898997799677887987777887686867895579866465457665345774366464351334 55 | 421312154235324535653777678786976887577869769887898799897698686878966689468464555357752255363554413 56 | 134231353356532647544747466746997955968966989988799777786898667996595997676454734577542423644111423 57 | 254152156456563434474788846574786769698798686897989989968667786695865858667776755455566654264132134 58 | 325554124554345334573567875686789766777879789968978788797868997657598864755765764646452636426312235 59 | 054421142246245654657458647846877765696688798786967788769769989568865887586878654537663362654432212 60 | 313445116364256444775744655676857696698998799776867668888686999587568854476648764345346236246232241 61 | 143114554233652245375455887678668996669686996999796887877777686757966588885786556444465552442533324 62 | 251331534446564265464364486744686986675876988887767766688896987878765756544754746565355566534235144 63 | 043312335432626344536643484678579666899596766779666899678676979556965588747766665377565544465543531 64 | 242445211324566636637644588748444588767957766968968978786788586989657745475556775355542555362121442 65 | 243253334442556446446767754567476657566957796656988796979699968699856846446535677455225423345132114 66 | 431231245536522344674653635685865849787997986689665576586668667768645854645567336572252526524445114 67 | 431352413545636624334373564776844687557987796967657766857786797968874766656443453336264564435235253 68 | 320554134146445446354475753477858558775599755977987865757897668588588666485457344365453335234122310 69 | 333244132156433233245637373688448784459857795676588655998585696485786865554473364636554335355224153 70 | 113345451542245623453737457745456844757575897756758966757557585554868888643374344325656234154414322 71 | 444045515145356432335647545655765786587886758778866688968984877775888576477747477332355221552413204 72 | 111132223523345626324747765577376687656748476986565687576768448558884573773436752362454612221523223 73 | 022004333435234546566255554533348546676766478456868467444674448586545655467537436553554433123421120 74 | 333231125332152663266433667535537778555667876464765456758647764446877656465367323254523253352510413 75 | 122420553331452433333353464676537646864677748867574756565588454444657764464332235454635225432522004 76 | 120442052444321222226423365375645435468656658447866466574856466886677654746522644365264535531343440 77 | 421404315233111265423463525657764565658784687768567656464684688763534555373553346542234345145442244 78 | 331231242152133344456244633655545655745345664668565885467456447677744435752654334432232553354400240 79 | 203040023155425242246555225235473556554656638646764676455766756555576576336522336454124215215404311 80 | 020211430251454452662234222644467675755747776474545447746753537773655567623542436262213453434423110 81 | 121222320253353333233652252225333343646436546477634345533376676557363636362664225322253234514301234 82 | 131331122021145511555626563643364773337345554777664437674344775376757362452454652245212143131222333 83 | 333033033132243135213222343542265476344656453763774355443644566737723253264252451243142121312244244 84 | 002204430244435144434515354453332632665637375363445456667774576662453443646454532431524140202312242 85 | 121314024424022223215424644426642356264655357667436346735353466356245254264535315425323522230030301 86 | 021012030013043135124451434556465446663353754754774574457663344656553456246613524313152023413220330 87 | 323211122442404125421353336334324324563564625653556556652432462453235325362525324531133444231304313 88 | 221212242244240214314234323556334553353656452662622464552256465443444565421332134313540102100220131 89 | 003121311143322334241133533143446663652225433332652353542523664466644655215235421122322101243201202 90 | 302132313044423014553344334444135543546462343625633335635554425246463354552555544450021401441212013 91 | 211320002042341321404351332421424422345645623225243263532425463422453534224512413420003024103010003 92 | 121321233203044310220544225434555523322652465244626362265436622244421244514121221412000233313302001 93 | 033330113222134212123014455534453323452146635634333522662322621122442141151325121244124021100331010 94 | 003211203200004004334013134312421412135211541122652523655533352215155345414442033214440410020130131 95 | 000310132331000133341101412343222324131145425545545422415232421245514432554132410203120223330322031 96 | 010222121001201110014203011212115523421525414334222144411533424243442552424243301203331330320011211 97 | 202210333132013102411304342331452231412212555243242135532222244343234442033031110220213320300213112 98 | 021110333231201113044040042034211335553321154444412432243122252145522223420412102042311030021122200 99 | 212222233011232310420321434331332422434543133323345512355241515513414041433311311240302022331021120 -------------------------------------------------------------------------------- /day3-rucksack-reorganization/input: -------------------------------------------------------------------------------- 1 | jVTBgVbgJQVrTLRRsLvRzWcZvnDs 2 | dhtmhfdfNlNNldfqmPCflqGbNZDHsDWcRzvczWsczZNzHz 3 | tmwwwCCfbJSMbwMb 4 | hsrZZhHlhrHmPPbMbDFDQdnQgLfMFDdDQQ 5 | GpBtwtqrcCcjgnLgqfgDDgRn 6 | cJwVwpCpGJctJtBcCrSCGrVJhlsbvSvTvbmHmmsWmHslmsHm 7 | gCtWJvmfmGGwVVMhJw 8 | nzRSpZbSVFFRDFSDzcplddqplqMhQMclMp 9 | zFLszzRTDnZnbTZTRZsVNgCjrvfvgtvNmtfvLW 10 | glRQRpQQtQtGtQws 11 | TnmbLqvBFRFFLPBFnPbvRBhshTtHWhwzdwtHdsdzWhws 12 | qmCLPNmCFnLBnmPPqVbFLRrJjVggDgJjlZVVDjDlDD 13 | vRRgpWvPQFdTFDDNQs 14 | bqtCmltmlbwqLVLZqwtmLBBTMcGBddTTBgFNGcZGMD 15 | bbtmJmjlVlwblwwbwzbbvrrznvzShgRhRvhfWrWn 16 | ZMhThfNcpbbMNNjsHpmpsRqsPmRs 17 | wQjDgggQDPqqDlsD 18 | SCwSzvLVCSVtQVgLnrccfdGdTdZfcZMtjJhG 19 | wNnNmNHnNPPwwPGCrLSZZvdVVZvBtMMvdm 20 | WQzlhzjzbBtMMlBrMl 21 | szbgWhJjTTcsWTqgzsqcsGHfwNcwfwnHHrCGCPPGwr 22 | CNsbpFCMSrmDhQHNNGmH 23 | fQPPPcqvljQzjVDDgRBhGGqDgqqD 24 | ZctlcVzcfltQtnrndbQMCM 25 | NQjQjQvZvZjcvrrrNjgTQgBQwTJsJswJlbGstqqtmGhmwhqw 26 | PWpHRzRnPHHSCnPFwlqhbtqGZClJqGqG 27 | ZzVpMpWPHnVzzpWzDRzSZrcdDQdrQNrcQgQfjcNfjf 28 | BSZMtdtZBzMFvhCbBJDbhDDC 29 | qcqVVmccrmVcjrlHqTrjDJRPQhWvPWWfPvblffDf 30 | cHTrbGwpmGwVjdFMnzpLznMztd 31 | DGDGGbNgTgJQQLMRMMTNVzvPsPbdsfPVsdVVZfPf 32 | lcCmmlpwwnwSjCHtFpCpHzCrZsVrBZZzdvDfVrsfZd 33 | lSHwnjpFmppHqppttttcFmnhMLGNRLhTMDqJLQNLLQNLhJ 34 | WqWfDWBjBjLbfcbbqGbWqQsrFFztsppMFCzgCJzJCrFpCM 35 | VRlhdHZTZVRRmZwlmFrJwFpMMDDrrrtJwg 36 | PPVddvvDZmRmHvndTHmLcbcjSjLQBGWGGQWSqP 37 | HHvgvwHMPMwHwmcRfJNFchFGNNCm 38 | BsTDsjzBCCBJGffN 39 | jznSnSdqzqnQTbdDljQjQSMHWWvvgWvtZlrWpPfWwtPr 40 | DJCJJCNjCDRfDfDRhDnNhfjFPgbGbddBTjFdTFTPbgGSdF 41 | cmMcMVqBZVcwsGFgGqgWdFqb 42 | vcZVzwmHVcrtrwMMvvmBHwNNCDpQRfhLhrNJNfJDDDRC 43 | VWSSScsncpDRdnsWsVncVzTwMMMHtMTrLTLMMVHM 44 | fjJvQqBCQNhfQlZZnqmFHLFMTFTzwzLzrHMB 45 | CqfjjQZJPjjvpRppDPgbnSnP 46 | tLnjNwjRWttdCwRLsfGzfzPbzbWbQQPT 47 | cvvBvlBrFrlTffsbfTqZ 48 | vmrFpsrvFMMMNwhtDwhN 49 | wzgRNqwtgzMWtqGwCssBBSBZnSRsrQQS 50 | bbjLTmpjpHcpVncVdmffPCDrjZDSDsZffDQC 51 | pbVFncvvbpbbHJJHVdvqMGMJNwWlNlJMwqzlNM 52 | TdszlzFsRQqFdRzqwwQGlFsGmmSBBdmdVVmgSZdSPZBBBmSD 53 | HMCCMbJHJJLHSmSvZLBcSDBP 54 | NWbhPjfrbbNfWCPjhNnGsNzsqpQszTQGRwGQzR 55 | ppQpTNCPBTlNBVmNQTNrrrrtqsrWbGrVFWqhZb 56 | DMvDHnjRvMDLghhhgbqZWbqFSS 57 | vWvMRRJDLMnHLJjDwWnnndcllNTzBmClQBpBBzQQzCBzCJ 58 | VsNZfPMnrCnlCnWtbvBbvwtTbZwT 59 | JhJQdQhmRHDRdLmHJhljhphgGwtttmcvbwwTWtvtbGBttc 60 | jqLpjSLDHlhnffCMzsqCPP 61 | JzJdLRmmzJwrLLwLJwLTWwBrMrpHlFnScVVqccrBHSlc 62 | tvQDQhjhvbqFqFSpjHSV 63 | QbgZtsgfbNNQbgbsbQRfmWRJwJGWWTPRwqzR 64 | MwvDgpwszSpSJPsssMccTQfTDfTQRTljfRfT 65 | PmGbWhbVtZWPTqRrcTrrjTrt 66 | NbZbWHBmVGmLbZVBVNLPsMBzwSSzMJMCsCzvnvSp 67 | cTpgTnpzbZlJHTZm 68 | jRrLVtqtvtrjqsHZhvpmBfJHmhhp 69 | FqDsFLCwCVRDqwgNQcQMwnncnMpg 70 | sCCtssdZdZJmMbNJDmtmJzLSrcGfHGLTHDHnGLrHTSSn 71 | gQwRRWqwqgpggFWPjPpFnSTSnHNfLLQrccrLGHLL 72 | qqlpqhjFwPgPwvvRgFlPdslZCzMZtVdtVdVMtJlN 73 | BWVmPtRVRRWDNtZBVQzCfdscmfjcfdfzzSfz 74 | MhgJLbGggHbqpGgpgJbrFJdjwsCChCzllzCdjDSszCCD 75 | grpDLFrbgpJnqJrHGFHGqMHBBPRWQTPWZBQVTQWnPNVvBt 76 | gJfggdmHDgfJJWzCcbqvcqcmTG 77 | hLZlRBZNlBlrpprzrWqvtHvvGtbvHT 78 | sNLRjHZLNVnZZVLppnhNsMFJSjFPPQMjwgMPPfDMfS 79 | mDDzHfrPBvJRJhpBRg 80 | SsTSTwJwcbCtwssGFVWppgZRbLpLRNhpLhbLvg 81 | ttVCGjTGrfJJMfjD 82 | ffhcsTjnfqHLqvZSHvHB 83 | CsgmPVmstsQVpRbHBvFbHBDMvZLZGB 84 | ppgpmmRVpVPwPrrrTNlcrwrlWs 85 | NDtssPNBjQtCtCcT 86 | ZZqncfqhZqhJZFTJTllCGVljSl 87 | ndrWbfZwWhngwbqbZnMZcwWhDmmLDmzvHPvzNLdmzsvBBHHP 88 | FQtptwMppSFQRRQfSfvTrTJJJTrvLjMMJbgJ 89 | CcDqWBWzbldcchDGCWBCBhdGrvhnrsrjjsJvLvghrjjnnjsJ 90 | GDBldPDGqPGWVBBcwHFmSmbpSpNRwHFV 91 | CwHwCFwtCmdCDflHDpwFnnvzhhNJhJNzmhzhhNMM 92 | sTbZssPqScTrqSWSShdMvgMRRzdRRQ 93 | brBrsWPTrdrWsPcBcTcGqDLDDHjFfDClwLLBfFlFlw 94 | lNptNFWpbVMjlBgQgvdNBRQLrd 95 | TsDCDfSCQqqQQqDq 96 | TwTmwPPPzZSCccScJwpWZHljtbWMFFQVHpnj 97 | fhFmwbrgnCcSnwtS 98 | vZVVZvQZVPZsMnNSccMHPN 99 | ddzvQJvQzBzWRTJzdRVSWGqbRbgmfbFFbmbgmpmlff 100 | wdslVdQtdlBVHDrHBcBc 101 | TJWvpncCcJzCWcRfWvJRRpfZHBDZZHmDZPBjZHjZrSfb 102 | TRJFvvWpTRRWCpCgGtgtGQdlcNtsGlwg 103 | rCHvRLJtCjpbRCLpptHMVCQgGlMndVlQGNcCMc 104 | zZfzSmsfSsMzMccQMVcN 105 | ssSmPmSmhwVhZBZsTBRJrtRjtbDvjvrTHLtJ 106 | wswRCNHHhsrWFsGfGWFBGb 107 | lLtngDPLgLJPttgWzQWlbCfBlmBFCW 108 | DcDnVpcnnJPngjjcdpRhwNZSCZNdNdvr 109 | NWNzWpfMRHfwsRNznPdjtdjJtPVPHVdJ 110 | CSLTZBrGbSmClvBVdGzFVVcFdjjjnV 111 | SrZhZbTvmmbbLvwQzMhsfhqqWwQR 112 | vvZqwFBZvzZzrqltPsQstrGGpMcbbR 113 | bhJdjJJmTRQMTMMPPM 114 | mCmgLbdVVVLhVnJmLgJhBWZFDlqFvwZDlZBnBvWB 115 | sMrcmQcHHsLLrSHZhvdCddvtJJFl 116 | jzjjWplWpPRPDzPzfRGjqvdJqqqCtqdqDvdDqtwC 117 | pPNWVpGGVVffPlnSMnMsTmgsQVLr 118 | zGMMRbpGmqqqNRmmzbNfbzPRPlvThCTrHPnrHSVPlTHR 119 | LSjjwgsjtTjhPhHhvC 120 | dJZtJwFgtBLDZZbmNMGzMMqS 121 | ZrnstppPWccnsFWpnZnRdjRtjbCtSSRjjjLLbG 122 | JgBQPJvPgHHJvmmzwGGLdjHGSjShGHqdHL 123 | wTJvPzmTJvzJQBfwNmTmlPsrVfnVFpcMVZprDpFrsrVc 124 | ssGCtltsSdJJtQjPdvHvfbfvqLHqZtBfVb 125 | pzRwwDwDTgzbqVTVvHqVWB 126 | grzHnRpmFpDMnmzFhplJCjlsPdGJSjsFCdFs 127 | CTGBBGCBlSTTSsnTMrQbNrBMtpVzNddWHWzVpHVtdHmwhphm 128 | JqPZgMRFFvFZvDZMDFcFFfDchdtdPWpzpWhtHWwwhVzWpddW 129 | ZfLZMcgqRDjgjcLccDRDLsbbrSBBlQGQBCTrCBnT 130 | VjVGVqSqFLFVSqCjFJSsbfPprHbCCRRPccRWPW 131 | wwnQmtwlvNmpZRsPsWWNbZ 132 | DBhhhznhddldnvjMqJMTqDMGPSjF 133 | TTJbsJPPBDsBVbJJGJBGWLfmWzgmDmzmLqmmLddQ 134 | jHwVZZjwFZlzLzWZLMdLqM 135 | HHHhjHplrHSpcCSvjlsNPbNRbRnVTrRsNNNJ 136 | NzMMLZtwRmbwFnVDhnqD 137 | SlsJsSdSJdNJnFphVHFjph 138 | vlrsTlGPTgvvSBScGcBvfzmmLLCtMWNZRBQMzftf 139 | tRFLmZZRLrtRvtvvrvvGgvtLNfwzMzNwgdznMpwwpnMpqHdz 140 | hcsBsWTcQJhjbHMncNwzMqnzwl 141 | VWSWWTJhWBVDTJsTVWQWTVVbZtCPSvrrGSLCRFRGtRZLPmmq 142 | hbdFhdShGsFSGBlQhNhQMLLLlLJCvLLDtVJDLlwtwD 143 | WcqWsmcWrmqcmtDHJjVHrJCjjt 144 | WPWcnggssmzqzzzgfzZnWRqqdGpSNFdMSFdBMSFZhSFBZZhh 145 | GNFNtRQMGjDjwfgDZjmz 146 | bqDsPWWbsqVsdvvBJvBfmgfLLzSwzLcmzmfB 147 | WPWrrVrrVJhVWJDVsqnPdRQllRQRNhQGMlFQFMplGl 148 | mChChmSQGSGJrjPHCpPFtwgsFZjtFVZfgVwtdV 149 | MBMqvDWMlTbzlRWzllDzblZfsrgdZffgrtwrswZfdZTd 150 | DlcMvBbBMnqMDqcRqDBMWvLmCGrGLSJhnLHCCHHnPmSQ 151 | tscfGqftGfDnnppJGDGCZLbzMVMwPPhsblzbjzzMMz 152 | TWPTWWmHTmFRSBSvgBPwwwlVzhMdwblhbVjRLL 153 | TTQNNWWgHWQHPBWTNPWNcqJtGCnfqfpQZJCZpQZn 154 | CqzCGDQJCzzftfRqRzzMdvFpFpccdZFvFMtMbd 155 | rNHwmHVmswsHVsPTLnbFSTbZZpFcpvSZZgpg 156 | vPLhLLwHLhVVNVvQhBqDCBfhDzCffG 157 | WsBbBbsWNhsPsCNssRWLPLpmLDDQHlJlnlzFnDDnzF 158 | gcGfqggMqfjjGwrdDZzQFmpJQzZlFDMF 159 | qdwqvjdTrwfvvBCPtpVvtR 160 | RQdbbRHtHRvqZtwVcmwVwV 161 | WnLNnqFDlDWzzNLLrjClwCZCGZcglGCccZ 162 | LnTFfWBpffrfrhBqdsSBqhBJHb 163 | sqsgJpDMrNQgGsFMsPCfjCPChPWjqSWSjh 164 | RBnRnZVcwZllLwbwwLbZVLclhpjRttSdtjPhjWShWdphjCPd 165 | HwHwVVwVnBVBmmGppNFzrrsgJJ 166 | WpmDFlQlzmmgMMLMLQVTvTTSwNbmTVwTtHHw 167 | jrhPDnDnnZfjPTNtHSVTcjccwt 168 | CJqPfGnhGZCBfnPJCrBCqdLqMlQqDLlLRgLQFFRW 169 | vZVvDZsvhDZhZvzgVcgVqPqmwWMqcw 170 | bdTbdBBFQcdCdcGmcP 171 | bmjQpHfbpzDJRjNhJZ 172 | twRrwjFptprQjjjtQRdWCmNJTlNSCmZQcNlmlSST 173 | VVDzMWDnDHMzLZDNNJSqqCJZZD 174 | HHhhsfVHGbnwgjfrgdpgWj 175 | GmszZGMrLmnmsfGVRcVlwtwccc 176 | SSCgbNqSTgCCJMHCJtlVcwVbVljlclVfwf 177 | HTCgHSgHQThMqWQQSgDnvBdsFDvrzdZsLdmLZZ 178 | PRlMlBPPctVBlstzVLhsdwCqCdCNDjSDdWmMqdNw 179 | fZrQQHFffgGFprSJSgvZrfnqjmWdnndCNGWmWDwNNDCG 180 | rTvvpJZZrfpFSbQQvrrsssLRVPPtlRtRPThzTR 181 | FqgHFFMRTRjRFRpRRjFtNdCtJCMnNNdrdMLdrQ 182 | VhWSmwGwWVbGbvlwwlLZJLZSdJZtNCtnTSCJ 183 | BmWwWWzhvVfwWhmhwlmvwlRqHpscHRTpTDRFfTsjDPjD 184 | MJMgGqMFLPGgWVjpcmjZTpmZjZpJ 185 | hdSzzlCtzNdtWSdndttflBmjpBRmvvpjnjcvBjmvHj 186 | zdhCrfztrDSzfWzdChrhlhgPPPGDgqFFLGGFVVqqPVQw 187 | ZQZNQRZzFdCCgfLcCGDfScjDcG 188 | vsmwVHTmTfGcSHjcDS 189 | tMsmMVlSWWzdWNnQNJ 190 | GPRcQnwwQWwFFnrnnldSqzMfSCdfdldrJf 191 | LpTsjmZTsBZjpmzhLLMdSJJSMhCC 192 | ZsZBssBsDpDmmVBjCmDZHgnVNWvPQPNPGvNQncQPcRWn 193 | pznzpzlGFrvGHGrnnMvDmBMfgfTmsBsTTghDsg 194 | LJtWVCWLCNPcSbdcShWBgBThgTfjzwfhhz 195 | VZZCdLCVNNCVbCLzFnRqGqlHprQZHRqr 196 | dFTsQPdMFsMnWFPdSnwBltftttvlflNN 197 | VLZhZLqghCgzqgrLrcgVgbCvtDDtwpqNpDtlBRflDwNqDpNw 198 | cLmVhVcgbZrVhrhCLhczhQdJHTmPJJTjvTJsPFWFTW 199 | SSwNPNHldNJSngHqBssQvBfccB 200 | mMppmDprWpFGRGWmWrDrtGzQfcvvQZBBzzczqRQgRqRT 201 | WtFtFvhvpLphNJJVSCbSNP 202 | chpGMMzcwSSGnQFRQQFWcFWn 203 | sgddTfjLqsWrRtLvQnJr 204 | CsmlZgssbRdMhzCHDGpGGG 205 | vHBrTzpMPTHMtbBRRJGtDsNB 206 | QJWWVwnCZmQlWQWlLWCCmmLwRgtDdDbgngqtRdRGbDNDGtGq 207 | LwmWQLJcWmwPrpvpjjrcjT 208 | fcsWnWzhWcWgcbfbvtbHTRvpvHttmLtR 209 | lNSjwjrDFjlFhlZlQTpLHvSHptvTSRtLmJ 210 | NwjwrQDwFCZBCfWzqhqqzc 211 | fgNJNRcvvWRfWRrZFldlwlFwfFllflDH 212 | spQshQhpqhJsLpnQVLqBqlFwddHSdBFFjSFmwlFmwl 213 | hppLsqPVLnpnzJPtqtPPJTCgNcrcNbrrGNcgRNrzcZbG 214 | PWFdgDGCFPGhMtQqHBrpJqqW 215 | nlllLNmnVNNLllVbVRLRsQMqqpccQQJcJtqcJcnBrc 216 | NmvZLsNrbZNjNZVNGvdFFfwdDhPFdDzC 217 | LpZpwgLsLSzDdjVGpS 218 | bWBlHqqBhNJWNbJQFzGtCtDtGGjNGDgtGC 219 | RBRbJggbWRRmhWqTcnnfnmZMTTsTcP 220 | JJgzvfzpdzzJjJhgdfhvqfdScNsLwwGsrRbwRLbcbVrVRp 221 | WDFBTTDtHTntltnCnnntCDwGlGGbSwNVSssrbwGVsVLs 222 | nCHMDtCWWTCCHmmPDnZQgvfQgZNJJdvdMZQg 223 | lFDgvlsGvvZGDsFZWgGvWrPqnmwwtqmMVSWrSqMM 224 | hRpJhLQHhdTTVPmVSrqwtHmV 225 | ctJJJfjLpjglZDGCGljF 226 | CnnVMbhVRbQQZjBP 227 | rlfsLFLtmLSJscttFfsdjZwZNNwBPWRjRNZBZBfQ 228 | tFrmDFlDtmcltFvqVzDqQzGvCVCG 229 | JzzJzVrmzJpCCmTFmjZS 230 | HtDDtggWssqWfDgwDWvsfDBBchZjSnGGpCFjSFZjpGjFShZg 231 | sbvbvfbbDblWtrNVNRzRlJPCzM 232 | nlFnFWsWhrctWVdJPDPTnTNJPJQJ 233 | fHqvHSqRqSHjBmqvmqqHCtJSTZGdMQJDPQDPPMdNTMZN 234 | jzqmbtRRztmbLHcFpgWVsFphpcLV 235 | PHZFZFVZZfHgpwjFtmgjtq 236 | rpTrTNzzNdrTJwgMwqCBJzJz 237 | vsTWbvccRcdRbrRnRRbRrcvVpGlGHZPspSVhSPPQGGZVHV 238 | HWnDDjfPFccDPhfchnMMVWGzzpvGszCCGWWV 239 | JNBtBTQJNwJQjTpRVRMvpLsQzsRR 240 | JltNSrBjmrHfdPHnDlHg 241 | ldCJHlZFspjzHMnp 242 | zvcLQBQcQvhBwmcDppqbNpjMLnLDDn 243 | BvcmQhWWRzPJJzWWWg 244 | ggSTPZBwTPTPSTRwZPBnwPMLdVvBqzsqLzqqtVzqtzBszN 245 | QRmhQhffCQhJcDfmpChQWJmJNNtzvqtLdvNsGtLqNGzvWqvG 246 | HQFCDhDFCCQJQmZTZwTSSwrZnRFS 247 | QbFlsMbgPWPlJWzsJsJZntvnvZtctHBfZvBZlD 248 | VTqpTqmSrhVLqrpjNppgntfBgfjddHffZBdtcB 249 | VCwpqqqNVgNVgMJJwbsWWGMGFR 250 | GCwRjQlsCQrPrGMQPsRvpdvgnjgmVVmSStptgJ 251 | DzNcZNHZZhzzHhDzDTLWhDzSdJSSpnnVSTSvJJmgvSdmmn 252 | pfLNDppNWHqDWfWbzcHPRslCGbwRCPwQrGQPCF 253 | hVLnDgCmbhltrmDlhbhVmcgFBWdSBSZZBFPwBLBPfWdPWZ 254 | TNTjJNpjqGMTRRsTTCZddfWwFHFWHSSJSFPS 255 | CGQqvQRTNzTpQsDtmcrgDQllhnQl 256 | SWrtcHWjcWrPcwWrBwSPffnJNsqfMNCNqNfJFfSq 257 | QLQvhBpbbvdvTdvpTdGDbDQqqqslsNMJlMMCqMfQnlfC 258 | gThhpmDLbzBmGLptrmRZcwHWHZjVrW 259 | gQvzQRvSSbvvJvQgfRrfbSpGqBPGwqwVjPBBwwjpRmjB 260 | TcNHHVVtNsDHcMcdMBjqpBnGnwlGTwlPBl 261 | MHsMDHFMdDtZddZdFdFrhhgbFFVvffrzzffrrS 262 | QSFmrDSSQrqlfmDDHPRTdrrTPRbsTPTsNN 263 | wBcclhhgwgMhWLLtVMgVvzRTNNjvbszzTdjNdsRbjp 264 | nJgVMtBhwLBctmQHQlnCGqmQZZ 265 | sggtjzzggfGmPbCMvRCMvTmT 266 | RDqqhdQdDlcDpqVlLbSbZFSTTPllbCMv 267 | hqpQWRhhdncDQcBsrwzjnfgtgGfgHs 268 | MTrzlgMNQNggrrrPlzQDPCsFRfscTfFVhVftRsFFsScS 269 | nWWHZHhZWJjjwjLjwbLbwHGSFppVfFVcGcFLfFSVttpf 270 | jWhZZBhqBbwvZvBjZNNQrQQQzPMlzzglPB 271 | jLVhJZQjwFCLRjQhPRZFLDzrGDHpDGsGqztGHststC 272 | SBNlNmWnfvdLmlnvfNSbzrDTTzprdqrDpGqqpHrG 273 | bNmSBnBmcfMmcmnlfcnNSnLhZPVVJhwjZRJPwjZMPjMZ 274 | VpzBDgGTGVNNpSGzppMdTQwcvFdFMQdcdFwc 275 | ZDsqfRftWtllmlWbLLtjFFMwMrjCcwfvMFvwcC 276 | PHbDLHZtZJSJPpVgnV 277 | bRvTdswLLSTvwswSbDhsDTvFmmGRVmJGZJnRcGGfFVJcqn 278 | MWllQMllWHrjWPNplrllQMPZJmnnVmqJcNmVFFnJNFqVGC 279 | PgpQrQjjzQWHzpBdvtwhwdSShBZTsT 280 | MhTwjMTsTRFStjmSMqqppBrHpDrzHtPqbD 281 | dllNcZWgldLvcsvvvvgvWddlHffqBHBBfPzbbqBpPHrpHNbq 282 | VddvgWWdCZhnhsCSSCGT 283 | LPjqHnDNqqHNllqLpqPCZCGRCssGdGrGFrPrgr 284 | WVBztWTQSQMBQrGgRwwwCGgtwg 285 | QJMTgvbTTWSzWWvSbVJTzJllJlHHhLpNqpHqjNjNHpjq 286 | PCHCbPPPHPlTThBhjGTTNhMNTh 287 | FrmfLqdqgfmfttqtWqfrqdhshchDBshDllDBcGDhGDWs 288 | mqgdpvFmmdLdqqQCPHZZblvwZQZl 289 | bQGqmngwwgSNrBWJWdHZmjfZWB 290 | FlpRLCptFLMlLPRLlCCcCCMpjJZJHShWdWvBHHdcZdBWZvSv 291 | FRPCDTTtFptVTnQnrGbwbS 292 | LsdmnDMTLbzsbNtqcb 293 | lJjCnHSvQRRwQQjRRHQbgWbqctNJPbcWrcPPgc 294 | RhGSQGwBvvGShnGlHClwjmfpmfdmVmfFDBLDDZpmMf 295 | ppDnPmwvNDjTjjcssT 296 | qqfRHzdCPHWfhHHtTjjbbLLGZr 297 | MhzqWdJCzqJWSJnpnpvvPSPP 298 | NGWdQgDDHGJgQLznzzsJFFzvzB 299 | twRCpZVjVWqVSqVwwjtZfrrfntfvznBssBncfLrc 300 | jRRwCqwCZhlhZRpSZpjSqWwqmDMQdMmHPQQMHGdlHdTldNGd -------------------------------------------------------------------------------- /day5-supply-stacks/input: -------------------------------------------------------------------------------- 1 | [M] [W] [M] 2 | [L] [Q] [S] [C] [R] 3 | [Q] [F] [F] [T] [N] [S] 4 | [N] [V] [V] [H] [L] [J] [D] 5 | [D] [D] [W] [P] [G] [R] [D] [F] 6 | [T] [T] [M] [G] [G] [Q] [N] [W] [L] 7 | [Z] [H] [F] [J] [D] [Z] [S] [H] [Q] 8 | [B] [V] [B] [T] [W] [V] [Z] [Z] [M] 9 | 1 2 3 4 5 6 7 8 9 10 | 11 | move 1 from 7 to 4 12 | move 1 from 6 to 2 13 | move 5 from 9 to 4 14 | move 2 from 2 to 8 15 | move 2 from 2 to 6 16 | move 3 from 3 to 7 17 | move 3 from 7 to 1 18 | move 1 from 9 to 4 19 | move 4 from 7 to 3 20 | move 5 from 1 to 8 21 | move 1 from 1 to 2 22 | move 1 from 4 to 9 23 | move 4 from 5 to 6 24 | move 1 from 5 to 8 25 | move 3 from 2 to 4 26 | move 3 from 6 to 4 27 | move 3 from 5 to 9 28 | move 1 from 9 to 7 29 | move 1 from 9 to 8 30 | move 2 from 7 to 9 31 | move 1 from 7 to 9 32 | move 1 from 7 to 8 33 | move 2 from 9 to 8 34 | move 13 from 4 to 2 35 | move 2 from 6 to 1 36 | move 3 from 3 to 2 37 | move 9 from 2 to 7 38 | move 1 from 9 to 7 39 | move 5 from 7 to 8 40 | move 9 from 8 to 4 41 | move 2 from 7 to 1 42 | move 1 from 1 to 7 43 | move 2 from 3 to 2 44 | move 14 from 4 to 5 45 | move 3 from 8 to 4 46 | move 13 from 8 to 3 47 | move 2 from 7 to 1 48 | move 6 from 6 to 5 49 | move 1 from 6 to 9 50 | move 3 from 2 to 8 51 | move 1 from 7 to 8 52 | move 5 from 2 to 8 53 | move 4 from 4 to 8 54 | move 1 from 9 to 8 55 | move 1 from 7 to 1 56 | move 1 from 1 to 2 57 | move 7 from 3 to 2 58 | move 4 from 3 to 2 59 | move 2 from 5 to 3 60 | move 2 from 1 to 5 61 | move 5 from 8 to 7 62 | move 6 from 8 to 3 63 | move 11 from 5 to 8 64 | move 8 from 8 to 9 65 | move 5 from 7 to 8 66 | move 3 from 1 to 8 67 | move 5 from 3 to 8 68 | move 11 from 2 to 9 69 | move 1 from 3 to 5 70 | move 1 from 2 to 1 71 | move 1 from 2 to 7 72 | move 6 from 5 to 7 73 | move 19 from 9 to 7 74 | move 3 from 5 to 3 75 | move 1 from 5 to 4 76 | move 1 from 1 to 4 77 | move 1 from 9 to 8 78 | move 25 from 7 to 9 79 | move 2 from 4 to 1 80 | move 2 from 1 to 4 81 | move 2 from 4 to 7 82 | move 2 from 7 to 9 83 | move 5 from 3 to 1 84 | move 1 from 7 to 1 85 | move 9 from 9 to 5 86 | move 3 from 5 to 6 87 | move 9 from 9 to 1 88 | move 7 from 1 to 3 89 | move 6 from 8 to 9 90 | move 1 from 5 to 2 91 | move 10 from 9 to 2 92 | move 1 from 2 to 7 93 | move 5 from 9 to 8 94 | move 1 from 5 to 8 95 | move 5 from 3 to 8 96 | move 1 from 9 to 4 97 | move 4 from 3 to 6 98 | move 4 from 6 to 3 99 | move 3 from 1 to 4 100 | move 3 from 2 to 4 101 | move 3 from 5 to 8 102 | move 3 from 4 to 9 103 | move 1 from 7 to 3 104 | move 2 from 9 to 8 105 | move 4 from 2 to 5 106 | move 1 from 3 to 4 107 | move 1 from 9 to 3 108 | move 5 from 5 to 6 109 | move 7 from 8 to 5 110 | move 3 from 1 to 7 111 | move 6 from 5 to 8 112 | move 5 from 4 to 5 113 | move 3 from 3 to 2 114 | move 1 from 1 to 4 115 | move 19 from 8 to 1 116 | move 3 from 7 to 3 117 | move 4 from 2 to 9 118 | move 1 from 2 to 6 119 | move 7 from 6 to 4 120 | move 1 from 6 to 2 121 | move 2 from 1 to 3 122 | move 5 from 4 to 1 123 | move 1 from 6 to 2 124 | move 3 from 3 to 6 125 | move 12 from 1 to 2 126 | move 2 from 8 to 1 127 | move 14 from 2 to 4 128 | move 7 from 1 to 5 129 | move 10 from 4 to 6 130 | move 3 from 6 to 4 131 | move 1 from 8 to 4 132 | move 4 from 3 to 5 133 | move 1 from 2 to 3 134 | move 2 from 1 to 4 135 | move 17 from 5 to 3 136 | move 7 from 4 to 1 137 | move 1 from 9 to 4 138 | move 4 from 6 to 3 139 | move 5 from 4 to 8 140 | move 12 from 3 to 1 141 | move 6 from 3 to 5 142 | move 17 from 1 to 5 143 | move 2 from 1 to 9 144 | move 3 from 1 to 4 145 | move 7 from 8 to 2 146 | move 4 from 3 to 7 147 | move 1 from 1 to 8 148 | move 17 from 5 to 2 149 | move 11 from 2 to 8 150 | move 11 from 8 to 4 151 | move 11 from 2 to 4 152 | move 4 from 6 to 1 153 | move 4 from 1 to 3 154 | move 2 from 6 to 9 155 | move 3 from 7 to 8 156 | move 3 from 5 to 3 157 | move 23 from 4 to 3 158 | move 4 from 4 to 8 159 | move 1 from 7 to 4 160 | move 2 from 2 to 3 161 | move 6 from 3 to 2 162 | move 16 from 3 to 9 163 | move 2 from 5 to 8 164 | move 1 from 4 to 5 165 | move 2 from 5 to 9 166 | move 1 from 2 to 3 167 | move 1 from 3 to 8 168 | move 9 from 9 to 1 169 | move 6 from 3 to 8 170 | move 3 from 3 to 1 171 | move 18 from 8 to 9 172 | move 1 from 3 to 5 173 | move 5 from 1 to 4 174 | move 5 from 1 to 8 175 | move 3 from 4 to 1 176 | move 1 from 5 to 2 177 | move 2 from 4 to 8 178 | move 1 from 1 to 2 179 | move 5 from 2 to 7 180 | move 2 from 8 to 1 181 | move 2 from 2 to 6 182 | move 3 from 1 to 6 183 | move 3 from 9 to 6 184 | move 31 from 9 to 7 185 | move 26 from 7 to 8 186 | move 3 from 1 to 6 187 | move 22 from 8 to 4 188 | move 2 from 4 to 5 189 | move 4 from 6 to 5 190 | move 11 from 4 to 3 191 | move 9 from 4 to 6 192 | move 2 from 5 to 9 193 | move 4 from 7 to 1 194 | move 2 from 6 to 1 195 | move 1 from 5 to 3 196 | move 6 from 8 to 6 197 | move 8 from 6 to 2 198 | move 1 from 1 to 6 199 | move 3 from 1 to 3 200 | move 1 from 5 to 3 201 | move 1 from 5 to 9 202 | move 5 from 7 to 2 203 | move 2 from 9 to 6 204 | move 4 from 8 to 6 205 | move 1 from 7 to 2 206 | move 1 from 5 to 4 207 | move 12 from 3 to 4 208 | move 3 from 3 to 1 209 | move 3 from 6 to 8 210 | move 1 from 9 to 3 211 | move 6 from 2 to 6 212 | move 2 from 3 to 2 213 | move 10 from 2 to 7 214 | move 2 from 1 to 9 215 | move 2 from 1 to 6 216 | move 1 from 1 to 4 217 | move 9 from 7 to 9 218 | move 3 from 8 to 7 219 | move 7 from 4 to 8 220 | move 2 from 7 to 4 221 | move 4 from 8 to 1 222 | move 5 from 8 to 2 223 | move 3 from 1 to 3 224 | move 1 from 8 to 7 225 | move 3 from 3 to 7 226 | move 4 from 2 to 6 227 | move 8 from 4 to 2 228 | move 5 from 2 to 5 229 | move 11 from 9 to 7 230 | move 2 from 5 to 7 231 | move 16 from 7 to 8 232 | move 5 from 8 to 7 233 | move 1 from 4 to 3 234 | move 3 from 5 to 1 235 | move 11 from 6 to 5 236 | move 7 from 5 to 4 237 | move 5 from 7 to 4 238 | move 1 from 3 to 7 239 | move 2 from 5 to 4 240 | move 10 from 4 to 8 241 | move 14 from 6 to 3 242 | move 1 from 5 to 9 243 | move 1 from 6 to 5 244 | move 2 from 2 to 9 245 | move 2 from 1 to 3 246 | move 2 from 5 to 3 247 | move 2 from 7 to 6 248 | move 2 from 1 to 4 249 | move 1 from 2 to 3 250 | move 19 from 3 to 6 251 | move 3 from 9 to 2 252 | move 4 from 2 to 6 253 | move 6 from 6 to 7 254 | move 13 from 6 to 2 255 | move 14 from 8 to 1 256 | move 6 from 4 to 3 257 | move 5 from 7 to 8 258 | move 3 from 6 to 3 259 | move 2 from 8 to 2 260 | move 2 from 6 to 8 261 | move 4 from 1 to 8 262 | move 13 from 8 to 4 263 | move 10 from 4 to 7 264 | move 1 from 4 to 5 265 | move 1 from 5 to 1 266 | move 3 from 6 to 5 267 | move 3 from 8 to 9 268 | move 9 from 3 to 1 269 | move 3 from 5 to 8 270 | move 3 from 9 to 6 271 | move 3 from 8 to 7 272 | move 1 from 6 to 9 273 | move 1 from 9 to 4 274 | move 9 from 2 to 8 275 | move 2 from 2 to 6 276 | move 14 from 7 to 1 277 | move 31 from 1 to 5 278 | move 3 from 1 to 7 279 | move 4 from 6 to 8 280 | move 24 from 5 to 3 281 | move 2 from 8 to 1 282 | move 1 from 8 to 5 283 | move 2 from 1 to 7 284 | move 3 from 7 to 6 285 | move 6 from 8 to 6 286 | move 2 from 4 to 2 287 | move 1 from 4 to 3 288 | move 2 from 2 to 7 289 | move 6 from 6 to 7 290 | move 4 from 8 to 6 291 | move 7 from 6 to 2 292 | move 12 from 7 to 5 293 | move 4 from 2 to 8 294 | move 1 from 2 to 4 295 | move 1 from 4 to 6 296 | move 1 from 6 to 7 297 | move 1 from 7 to 3 298 | move 3 from 3 to 8 299 | move 17 from 3 to 5 300 | move 4 from 3 to 6 301 | move 35 from 5 to 3 302 | move 2 from 2 to 6 303 | move 1 from 5 to 9 304 | move 9 from 3 to 7 305 | move 6 from 8 to 1 306 | move 4 from 2 to 6 307 | move 4 from 6 to 9 308 | move 20 from 3 to 9 309 | move 22 from 9 to 7 310 | move 1 from 8 to 6 311 | move 29 from 7 to 5 312 | move 4 from 6 to 8 313 | move 6 from 1 to 8 314 | move 2 from 7 to 3 315 | move 1 from 6 to 5 316 | move 2 from 3 to 9 317 | move 1 from 9 to 3 318 | move 4 from 5 to 6 319 | move 18 from 5 to 1 320 | move 7 from 3 to 1 321 | move 1 from 3 to 6 322 | move 3 from 5 to 1 323 | move 1 from 3 to 9 324 | move 4 from 5 to 2 325 | move 10 from 8 to 7 326 | move 2 from 9 to 3 327 | move 1 from 3 to 5 328 | move 21 from 1 to 9 329 | move 1 from 3 to 2 330 | move 1 from 2 to 9 331 | move 15 from 9 to 3 332 | move 4 from 7 to 1 333 | move 2 from 6 to 1 334 | move 7 from 9 to 1 335 | move 1 from 5 to 4 336 | move 1 from 4 to 6 337 | move 6 from 3 to 9 338 | move 3 from 6 to 5 339 | move 19 from 1 to 6 340 | move 8 from 3 to 6 341 | move 1 from 3 to 7 342 | move 20 from 6 to 7 343 | move 1 from 2 to 6 344 | move 6 from 9 to 8 345 | move 2 from 9 to 4 346 | move 1 from 1 to 3 347 | move 1 from 2 to 9 348 | move 3 from 5 to 6 349 | move 2 from 7 to 3 350 | move 2 from 9 to 7 351 | move 1 from 4 to 8 352 | move 4 from 8 to 9 353 | move 4 from 7 to 1 354 | move 2 from 1 to 7 355 | move 1 from 3 to 2 356 | move 2 from 8 to 9 357 | move 6 from 6 to 2 358 | move 1 from 8 to 1 359 | move 1 from 5 to 7 360 | move 4 from 2 to 9 361 | move 1 from 3 to 5 362 | move 5 from 6 to 1 363 | move 1 from 4 to 2 364 | move 1 from 9 to 6 365 | move 1 from 9 to 6 366 | move 4 from 6 to 3 367 | move 7 from 9 to 7 368 | move 8 from 7 to 2 369 | move 1 from 5 to 8 370 | move 5 from 2 to 9 371 | move 3 from 2 to 5 372 | move 6 from 1 to 3 373 | move 17 from 7 to 6 374 | move 1 from 8 to 2 375 | move 2 from 1 to 7 376 | move 5 from 9 to 4 377 | move 4 from 3 to 8 378 | move 3 from 4 to 1 379 | move 1 from 9 to 2 380 | move 4 from 2 to 1 381 | move 1 from 8 to 4 382 | move 1 from 5 to 9 383 | move 1 from 2 to 3 384 | move 3 from 3 to 2 385 | move 10 from 7 to 6 386 | move 3 from 4 to 1 387 | move 5 from 3 to 2 388 | move 4 from 1 to 5 389 | move 3 from 8 to 6 390 | move 12 from 6 to 4 391 | move 1 from 9 to 3 392 | move 1 from 5 to 2 393 | move 3 from 1 to 6 394 | move 12 from 6 to 8 395 | move 3 from 1 to 5 396 | move 2 from 4 to 3 397 | move 5 from 8 to 7 398 | move 7 from 5 to 3 399 | move 3 from 7 to 9 400 | move 1 from 5 to 8 401 | move 5 from 3 to 7 402 | move 10 from 6 to 5 403 | move 2 from 7 to 5 404 | move 8 from 2 to 9 405 | move 5 from 3 to 9 406 | move 9 from 5 to 1 407 | move 5 from 7 to 4 408 | move 15 from 9 to 5 409 | move 1 from 2 to 5 410 | move 1 from 8 to 5 411 | move 6 from 4 to 1 412 | move 2 from 2 to 9 413 | move 18 from 5 to 8 414 | move 18 from 8 to 3 415 | move 16 from 3 to 4 416 | move 3 from 5 to 8 417 | move 1 from 9 to 2 418 | move 3 from 1 to 7 419 | move 3 from 8 to 2 420 | move 3 from 7 to 9 421 | move 2 from 3 to 4 422 | move 3 from 9 to 8 423 | move 11 from 1 to 6 424 | move 2 from 9 to 4 425 | move 3 from 6 to 9 426 | move 8 from 6 to 4 427 | move 26 from 4 to 7 428 | move 1 from 2 to 5 429 | move 1 from 5 to 2 430 | move 3 from 9 to 3 431 | move 21 from 7 to 6 432 | move 4 from 2 to 4 433 | move 1 from 2 to 3 434 | move 5 from 7 to 6 435 | move 8 from 8 to 1 436 | move 1 from 3 to 7 437 | move 9 from 1 to 4 438 | move 1 from 7 to 4 439 | move 20 from 4 to 7 440 | move 1 from 8 to 5 441 | move 2 from 4 to 8 442 | move 1 from 4 to 9 443 | move 3 from 8 to 9 444 | move 1 from 5 to 8 445 | move 2 from 3 to 1 446 | move 4 from 7 to 8 447 | move 3 from 7 to 5 448 | move 1 from 1 to 7 449 | move 4 from 8 to 3 450 | move 3 from 5 to 6 451 | move 1 from 8 to 4 452 | move 1 from 1 to 8 453 | move 28 from 6 to 4 454 | move 1 from 6 to 1 455 | move 2 from 7 to 8 456 | move 1 from 8 to 7 457 | move 1 from 8 to 1 458 | move 2 from 1 to 9 459 | move 3 from 9 to 3 460 | move 12 from 7 to 5 461 | move 7 from 3 to 1 462 | move 1 from 3 to 6 463 | move 26 from 4 to 9 464 | move 1 from 6 to 3 465 | move 1 from 3 to 6 466 | move 1 from 8 to 6 467 | move 1 from 7 to 8 468 | move 1 from 6 to 3 469 | move 3 from 1 to 3 470 | move 5 from 4 to 3 471 | move 28 from 9 to 4 472 | move 2 from 1 to 5 473 | move 22 from 4 to 1 474 | move 3 from 5 to 3 475 | move 5 from 5 to 7 476 | move 10 from 1 to 6 477 | move 1 from 5 to 2 478 | move 3 from 5 to 3 479 | move 2 from 5 to 9 480 | move 3 from 9 to 7 481 | move 2 from 4 to 5 482 | move 1 from 5 to 4 483 | move 4 from 3 to 8 484 | move 1 from 5 to 7 485 | move 9 from 6 to 5 486 | move 1 from 7 to 6 487 | move 1 from 6 to 5 488 | move 2 from 6 to 9 489 | move 3 from 5 to 1 490 | move 13 from 1 to 3 491 | move 7 from 7 to 5 492 | move 1 from 2 to 9 493 | move 3 from 8 to 2 494 | move 1 from 7 to 2 495 | move 3 from 4 to 3 496 | move 19 from 3 to 8 497 | move 5 from 3 to 7 498 | move 1 from 7 to 1 499 | move 19 from 8 to 6 500 | move 5 from 1 to 4 501 | move 5 from 5 to 2 502 | move 2 from 2 to 7 503 | move 3 from 4 to 1 504 | move 6 from 5 to 7 505 | move 2 from 8 to 7 506 | move 2 from 2 to 7 507 | move 3 from 3 to 5 508 | move 5 from 7 to 6 509 | move 6 from 6 to 1 510 | move 2 from 5 to 1 511 | move 2 from 4 to 3 512 | move 1 from 5 to 8 -------------------------------------------------------------------------------- /day4-camp-cleanup/input: -------------------------------------------------------------------------------- 1 | 51-88,52-87 2 | 41-55,22-56 3 | 6-74,74-86 4 | 51-98,52-86 5 | 8-77,3-94 6 | 76-76,77-97 7 | 29-42,29-35 8 | 59-97,60-60 9 | 9-86,27-86 10 | 58-85,59-85 11 | 23-41,26-39 12 | 87-91,74-93 13 | 13-83,83-84 14 | 16-82,15-82 15 | 15-95,14-96 16 | 1-1,2-93 17 | 3-87,2-74 18 | 6-47,7-78 19 | 47-68,47-92 20 | 4-64,5-68 21 | 14-14,8-45 22 | 38-52,52-53 23 | 8-19,25-85 24 | 34-80,35-81 25 | 64-64,64-80 26 | 28-54,53-64 27 | 10-97,16-98 28 | 9-94,93-95 29 | 15-67,16-67 30 | 7-83,8-83 31 | 6-95,90-99 32 | 2-4,3-52 33 | 21-50,20-50 34 | 47-49,15-47 35 | 4-38,7-38 36 | 5-72,13-59 37 | 7-82,2-7 38 | 3-85,4-91 39 | 11-79,6-9 40 | 87-94,77-88 41 | 10-10,8-12 42 | 44-59,58-60 43 | 94-97,5-90 44 | 30-73,29-30 45 | 1-87,10-78 46 | 16-53,6-9 47 | 26-88,27-53 48 | 21-68,67-69 49 | 49-62,50-61 50 | 20-32,10-34 51 | 28-29,21-31 52 | 47-55,89-98 53 | 84-85,23-85 54 | 10-54,11-54 55 | 52-92,19-51 56 | 66-85,48-98 57 | 43-44,44-85 58 | 44-97,43-58 59 | 24-76,68-70 60 | 35-52,13-53 61 | 46-62,43-80 62 | 2-99,21-58 63 | 29-73,28-29 64 | 56-71,56-71 65 | 16-80,14-81 66 | 22-64,16-63 67 | 42-59,42-74 68 | 39-79,39-79 69 | 21-98,20-98 70 | 48-49,49-97 71 | 9-88,10-88 72 | 72-73,51-72 73 | 7-81,6-82 74 | 68-70,15-69 75 | 98-99,70-75 76 | 82-82,16-82 77 | 38-42,38-80 78 | 96-99,1-95 79 | 46-92,45-45 80 | 38-44,37-45 81 | 94-97,93-96 82 | 7-59,43-58 83 | 2-86,85-87 84 | 17-26,22-26 85 | 6-68,5-10 86 | 8-91,91-99 87 | 7-93,13-93 88 | 61-92,61-81 89 | 40-67,30-68 90 | 25-53,38-50 91 | 2-64,3-98 92 | 58-70,58-68 93 | 57-89,57-89 94 | 32-69,31-76 95 | 14-90,4-90 96 | 58-82,32-86 97 | 47-70,46-69 98 | 5-82,3-5 99 | 7-47,42-43 100 | 98-98,1-99 101 | 60-84,60-83 102 | 10-38,9-91 103 | 12-98,10-99 104 | 57-74,56-56 105 | 11-96,10-11 106 | 25-92,24-24 107 | 61-82,99-99 108 | 52-67,54-56 109 | 2-81,1-81 110 | 48-49,1-47 111 | 22-68,36-69 112 | 2-90,7-89 113 | 24-57,31-56 114 | 1-65,46-63 115 | 1-87,39-86 116 | 78-82,80-99 117 | 66-68,35-74 118 | 13-92,14-93 119 | 32-80,32-40 120 | 98-98,4-99 121 | 98-98,2-7 122 | 28-28,28-81 123 | 27-53,15-54 124 | 3-84,1-1 125 | 3-34,9-31 126 | 40-97,19-96 127 | 13-60,7-60 128 | 24-76,40-75 129 | 91-92,5-91 130 | 40-42,8-41 131 | 73-75,28-74 132 | 95-95,44-96 133 | 13-16,16-74 134 | 22-71,21-71 135 | 7-7,5-15 136 | 1-80,4-81 137 | 36-71,37-72 138 | 84-85,68-85 139 | 16-63,12-12 140 | 11-50,4-49 141 | 30-94,10-95 142 | 2-73,2-98 143 | 10-85,10-85 144 | 49-58,30-59 145 | 48-67,15-32 146 | 31-69,32-68 147 | 71-94,70-98 148 | 10-93,9-93 149 | 5-5,6-95 150 | 71-89,70-71 151 | 41-66,6-42 152 | 7-90,6-90 153 | 78-79,17-78 154 | 83-84,2-84 155 | 2-99,1-99 156 | 65-86,66-82 157 | 44-49,44-46 158 | 58-90,90-91 159 | 7-38,8-97 160 | 14-74,88-99 161 | 54-91,53-88 162 | 34-56,34-76 163 | 13-55,14-55 164 | 64-64,63-76 165 | 24-89,4-92 166 | 69-83,68-70 167 | 11-92,10-95 168 | 41-63,35-63 169 | 42-65,43-64 170 | 26-64,64-78 171 | 25-47,16-20 172 | 14-54,13-55 173 | 77-77,76-93 174 | 15-15,16-85 175 | 67-71,66-70 176 | 9-17,12-18 177 | 12-95,12-95 178 | 70-76,29-70 179 | 6-13,7-12 180 | 9-77,8-12 181 | 57-94,7-57 182 | 86-87,87-90 183 | 45-89,63-98 184 | 45-55,63-93 185 | 81-82,7-81 186 | 7-77,76-78 187 | 19-58,9-19 188 | 1-93,2-92 189 | 57-83,56-58 190 | 2-98,4-98 191 | 1-18,1-9 192 | 39-74,27-44 193 | 5-73,3-95 194 | 36-62,94-95 195 | 62-73,61-81 196 | 33-63,53-62 197 | 34-45,33-33 198 | 13-25,12-12 199 | 91-92,25-91 200 | 19-23,41-85 201 | 4-10,24-92 202 | 29-35,35-80 203 | 19-23,22-76 204 | 4-70,5-52 205 | 4-90,3-89 206 | 49-84,19-85 207 | 7-65,6-6 208 | 37-81,31-37 209 | 18-77,76-76 210 | 20-88,87-89 211 | 16-91,79-90 212 | 82-84,39-83 213 | 3-23,39-47 214 | 26-94,95-99 215 | 8-98,7-9 216 | 4-54,21-27 217 | 5-78,20-79 218 | 21-52,22-35 219 | 4-53,2-77 220 | 26-71,18-71 221 | 11-71,12-12 222 | 10-77,9-9 223 | 88-97,41-87 224 | 60-97,96-98 225 | 2-7,8-60 226 | 59-63,60-63 227 | 81-82,31-81 228 | 92-92,86-93 229 | 75-82,16-75 230 | 32-76,33-33 231 | 69-93,70-93 232 | 25-59,24-57 233 | 56-57,41-69 234 | 56-94,55-74 235 | 6-94,28-58 236 | 44-93,45-92 237 | 44-44,44-92 238 | 33-45,46-56 239 | 4-55,11-54 240 | 11-98,12-99 241 | 35-61,37-61 242 | 2-3,8-99 243 | 2-2,4-29 244 | 29-49,21-49 245 | 4-17,19-85 246 | 47-75,47-92 247 | 11-12,11-98 248 | 84-85,21-84 249 | 55-99,54-96 250 | 24-28,4-32 251 | 22-88,21-23 252 | 12-93,11-92 253 | 13-80,13-79 254 | 89-91,3-90 255 | 16-72,57-59 256 | 16-82,82-82 257 | 26-39,13-19 258 | 72-78,73-77 259 | 18-87,96-98 260 | 73-90,60-73 261 | 44-44,3-95 262 | 5-94,4-95 263 | 28-68,29-49 264 | 13-72,14-73 265 | 10-99,5-98 266 | 25-38,11-48 267 | 30-98,97-99 268 | 12-91,13-92 269 | 1-85,2-20 270 | 6-6,8-98 271 | 16-86,86-94 272 | 6-99,3-99 273 | 77-81,3-76 274 | 1-30,9-14 275 | 43-74,42-43 276 | 33-93,32-92 277 | 3-68,4-69 278 | 2-96,2-21 279 | 65-81,80-88 280 | 19-19,20-93 281 | 14-41,32-34 282 | 34-80,34-82 283 | 3-81,9-82 284 | 72-96,72-99 285 | 16-43,42-60 286 | 8-88,54-60 287 | 92-94,93-95 288 | 80-95,80-95 289 | 81-82,29-81 290 | 12-85,13-43 291 | 5-93,91-92 292 | 34-78,51-65 293 | 10-75,9-75 294 | 61-65,33-77 295 | 18-18,19-97 296 | 69-80,70-81 297 | 90-92,68-91 298 | 4-29,5-30 299 | 71-80,70-83 300 | 4-85,5-84 301 | 99-99,26-87 302 | 8-35,35-97 303 | 64-66,30-65 304 | 24-85,21-86 305 | 4-9,10-92 306 | 4-29,3-5 307 | 11-72,11-72 308 | 76-78,62-80 309 | 38-80,48-79 310 | 30-86,2-90 311 | 14-98,15-87 312 | 11-39,7-39 313 | 6-99,7-7 314 | 45-87,13-18 315 | 13-84,12-12 316 | 79-80,79-94 317 | 22-81,23-29 318 | 6-7,7-54 319 | 8-75,9-19 320 | 62-89,62-76 321 | 54-99,53-99 322 | 21-74,5-75 323 | 44-44,46-81 324 | 34-92,34-92 325 | 94-94,11-95 326 | 4-95,13-94 327 | 65-68,67-97 328 | 13-52,12-13 329 | 3-17,17-18 330 | 24-94,67-95 331 | 57-74,56-56 332 | 31-58,18-41 333 | 71-78,70-71 334 | 80-90,80-89 335 | 64-75,4-65 336 | 19-70,46-69 337 | 2-5,4-79 338 | 52-95,73-96 339 | 28-57,15-90 340 | 21-59,53-58 341 | 10-27,6-10 342 | 21-98,58-97 343 | 81-93,82-93 344 | 81-84,50-82 345 | 19-29,20-25 346 | 95-97,1-96 347 | 3-65,38-39 348 | 24-98,25-97 349 | 42-69,15-43 350 | 50-51,37-50 351 | 17-97,16-84 352 | 26-58,41-57 353 | 25-66,24-24 354 | 21-61,57-69 355 | 7-83,6-84 356 | 43-76,51-75 357 | 26-30,32-87 358 | 55-55,56-56 359 | 41-58,57-87 360 | 49-82,48-83 361 | 25-46,45-45 362 | 7-88,1-94 363 | 8-89,7-8 364 | 9-18,11-12 365 | 19-94,94-97 366 | 2-98,1-1 367 | 40-60,41-85 368 | 13-14,13-99 369 | 30-34,29-33 370 | 22-22,21-21 371 | 27-28,25-27 372 | 5-23,16-22 373 | 37-54,54-72 374 | 16-21,25-42 375 | 33-70,47-70 376 | 57-65,57-64 377 | 78-78,15-79 378 | 44-49,44-98 379 | 27-56,20-33 380 | 81-85,71-95 381 | 91-92,1-92 382 | 52-76,50-51 383 | 21-94,21-94 384 | 20-94,21-28 385 | 57-60,59-98 386 | 21-42,22-62 387 | 48-48,42-52 388 | 27-86,21-94 389 | 63-96,63-96 390 | 1-71,1-71 391 | 5-48,47-80 392 | 90-91,28-90 393 | 13-67,13-65 394 | 97-97,13-98 395 | 6-20,7-55 396 | 1-65,2-65 397 | 83-98,98-99 398 | 11-46,45-69 399 | 6-68,6-55 400 | 52-73,53-74 401 | 77-82,77-80 402 | 89-98,6-98 403 | 63-65,17-64 404 | 8-26,1-8 405 | 11-79,3-12 406 | 7-95,2-99 407 | 92-99,50-93 408 | 14-84,83-83 409 | 1-99,1-99 410 | 47-76,46-77 411 | 3-55,2-56 412 | 43-79,79-94 413 | 14-64,43-65 414 | 58-63,59-62 415 | 5-99,2-5 416 | 64-66,6-65 417 | 17-91,16-90 418 | 82-92,91-93 419 | 15-77,16-47 420 | 27-98,59-91 421 | 18-93,17-90 422 | 11-26,17-82 423 | 75-83,66-83 424 | 14-66,2-8 425 | 21-73,74-89 426 | 21-88,22-89 427 | 40-40,60-84 428 | 6-61,13-62 429 | 9-96,7-7 430 | 12-84,7-99 431 | 14-70,9-17 432 | 44-44,15-43 433 | 1-55,2-56 434 | 26-91,25-92 435 | 76-87,36-86 436 | 1-52,52-93 437 | 28-41,27-40 438 | 51-95,67-71 439 | 49-78,34-79 440 | 30-38,30-31 441 | 7-99,6-6 442 | 49-80,14-50 443 | 7-98,9-92 444 | 15-80,14-80 445 | 10-86,8-11 446 | 28-35,27-74 447 | 1-9,10-60 448 | 4-63,9-62 449 | 36-37,36-36 450 | 54-73,54-94 451 | 24-91,92-92 452 | 48-50,16-49 453 | 26-41,26-41 454 | 18-20,19-46 455 | 11-16,16-88 456 | 40-79,27-40 457 | 4-53,4-53 458 | 30-40,56-59 459 | 97-99,2-98 460 | 92-94,10-93 461 | 12-64,12-64 462 | 78-84,13-67 463 | 25-27,26-65 464 | 50-87,27-88 465 | 32-57,18-33 466 | 92-93,24-93 467 | 1-12,12-33 468 | 7-99,6-97 469 | 14-58,3-57 470 | 17-45,18-90 471 | 9-35,29-34 472 | 2-78,46-77 473 | 3-39,23-39 474 | 82-87,10-94 475 | 64-75,64-74 476 | 26-99,25-99 477 | 15-97,96-98 478 | 44-45,26-44 479 | 52-97,34-38 480 | 19-42,7-20 481 | 9-72,31-73 482 | 12-12,11-53 483 | 4-4,6-90 484 | 76-99,98-98 485 | 53-55,54-95 486 | 64-69,8-73 487 | 11-97,14-98 488 | 43-82,83-83 489 | 14-47,13-47 490 | 60-64,59-78 491 | 87-88,1-87 492 | 3-82,5-65 493 | 4-4,5-98 494 | 10-85,84-86 495 | 37-99,37-99 496 | 15-89,16-88 497 | 10-97,9-99 498 | 35-92,97-97 499 | 77-97,78-98 500 | 1-79,5-80 501 | 26-35,27-65 502 | 3-98,4-98 503 | 63-63,1-64 504 | 63-97,67-84 505 | 5-7,9-69 506 | 16-32,17-44 507 | 12-98,13-13 508 | 6-87,49-86 509 | 91-91,24-92 510 | 23-87,23-87 511 | 10-26,16-26 512 | 48-72,3-73 513 | 38-39,38-61 514 | 79-79,54-80 515 | 42-42,43-48 516 | 4-99,11-96 517 | 17-70,18-49 518 | 46-96,85-95 519 | 13-77,14-14 520 | 33-35,34-37 521 | 38-43,42-43 522 | 19-94,5-94 523 | 24-26,25-91 524 | 4-90,4-90 525 | 94-99,30-40 526 | 29-89,30-93 527 | 63-95,20-96 528 | 5-71,4-4 529 | 31-54,21-54 530 | 88-89,4-88 531 | 5-88,2-98 532 | 6-98,19-46 533 | 2-63,96-98 534 | 61-95,61-95 535 | 22-79,21-65 536 | 44-87,43-86 537 | 18-93,34-92 538 | 35-42,41-43 539 | 5-73,16-72 540 | 76-80,52-76 541 | 11-20,7-75 542 | 1-92,9-92 543 | 81-83,45-82 544 | 56-86,55-56 545 | 27-62,18-22 546 | 13-13,12-80 547 | 30-69,31-87 548 | 8-96,1-3 549 | 53-53,52-78 550 | 59-99,58-94 551 | 48-71,5-48 552 | 21-40,40-41 553 | 37-64,40-65 554 | 5-84,6-83 555 | 4-98,12-99 556 | 73-85,69-87 557 | 46-79,21-47 558 | 25-27,26-26 559 | 9-17,8-90 560 | 19-19,20-34 561 | 59-98,58-58 562 | 1-9,9-78 563 | 3-3,4-92 564 | 88-89,46-88 565 | 3-91,2-91 566 | 34-44,45-84 567 | 1-88,2-89 568 | 18-96,6-99 569 | 48-79,39-83 570 | 73-88,41-73 571 | 3-93,6-60 572 | 15-94,93-93 573 | 12-80,11-79 574 | 14-23,51-77 575 | 23-24,3-28 576 | 36-60,6-60 577 | 43-48,44-57 578 | 13-96,6-92 579 | 54-91,53-92 580 | 6-76,5-64 581 | 5-28,26-29 582 | 3-63,5-64 583 | 20-49,30-49 584 | 8-97,6-9 585 | 4-72,8-71 586 | 57-67,56-88 587 | 51-65,25-65 588 | 1-8,3-9 589 | 64-91,64-99 590 | 82-93,92-94 591 | 53-74,4-96 592 | 40-40,41-76 593 | 11-85,52-84 594 | 33-44,44-89 595 | 3-95,95-96 596 | 15-49,48-90 597 | 17-96,95-97 598 | 94-96,3-95 599 | 2-92,3-93 600 | 66-70,65-66 601 | 6-82,53-82 602 | 1-36,3-37 603 | 78-84,71-85 604 | 21-74,15-21 605 | 21-68,42-89 606 | 36-92,65-92 607 | 59-83,59-81 608 | 8-80,93-93 609 | 16-93,5-13 610 | 6-40,5-41 611 | 2-13,13-98 612 | 59-73,25-60 613 | 52-75,68-74 614 | 31-43,32-67 615 | 22-71,22-70 616 | 26-26,27-79 617 | 21-22,23-87 618 | 56-98,17-57 619 | 48-49,13-48 620 | 19-54,19-92 621 | 11-38,10-11 622 | 39-51,46-71 623 | 2-58,57-57 624 | 20-87,45-84 625 | 25-37,21-26 626 | 82-83,4-82 627 | 72-96,73-96 628 | 28-90,27-95 629 | 1-4,3-98 630 | 57-77,1-78 631 | 27-88,21-88 632 | 11-51,51-81 633 | 40-94,79-93 634 | 6-52,52-53 635 | 17-98,18-77 636 | 33-33,4-34 637 | 15-38,8-8 638 | 2-16,22-42 639 | 1-95,96-96 640 | 90-95,13-90 641 | 10-63,9-97 642 | 5-7,5-11 643 | 6-94,93-93 644 | 19-46,46-99 645 | 19-72,20-73 646 | 54-55,55-64 647 | 10-96,7-7 648 | 2-80,1-80 649 | 8-96,6-9 650 | 3-27,1-2 651 | 6-77,5-76 652 | 22-42,3-18 653 | 4-5,3-4 654 | 28-67,66-68 655 | 1-94,99-99 656 | 11-13,10-12 657 | 79-80,74-79 658 | 31-83,35-84 659 | 63-63,59-67 660 | 86-88,45-87 661 | 2-93,2-52 662 | 1-6,6-39 663 | 16-70,27-37 664 | 72-95,94-98 665 | 3-82,3-81 666 | 8-77,7-78 667 | 7-8,9-96 668 | 64-65,64-65 669 | 35-88,34-89 670 | 8-97,7-98 671 | 2-94,4-95 672 | 50-51,4-50 673 | 5-98,1-4 674 | 56-93,1-92 675 | 33-33,34-98 676 | 46-88,66-87 677 | 35-97,34-97 678 | 4-96,1-4 679 | 68-72,69-72 680 | 58-85,59-95 681 | 18-96,72-97 682 | 19-32,20-94 683 | 16-63,15-63 684 | 47-47,9-46 685 | 96-97,18-97 686 | 21-89,5-21 687 | 9-42,20-41 688 | 34-94,19-93 689 | 60-76,59-80 690 | 76-80,77-78 691 | 13-94,23-94 692 | 30-88,22-89 693 | 34-34,35-87 694 | 92-98,40-93 695 | 20-99,20-99 696 | 5-90,6-29 697 | 6-78,40-79 698 | 46-73,44-74 699 | 1-96,37-95 700 | 21-91,91-95 701 | 6-85,3-85 702 | 13-64,79-89 703 | 41-82,81-90 704 | 7-84,8-36 705 | 23-30,23-30 706 | 28-29,29-55 707 | 98-99,13-98 708 | 28-89,88-98 709 | 95-98,94-94 710 | 78-78,79-97 711 | 81-81,81-82 712 | 2-89,1-90 713 | 27-29,28-62 714 | 17-95,36-86 715 | 1-99,3-97 716 | 10-99,11-46 717 | 24-53,23-83 718 | 34-47,17-33 719 | 7-66,7-89 720 | 24-55,20-32 721 | 40-41,18-40 722 | 17-59,33-60 723 | 59-82,60-62 724 | 4-4,3-60 725 | 25-94,24-94 726 | 30-42,41-43 727 | 69-69,5-68 728 | 23-84,24-83 729 | 13-71,13-76 730 | 10-84,7-7 731 | 57-86,51-61 732 | 66-68,62-67 733 | 9-85,10-86 734 | 29-97,4-98 735 | 95-96,46-95 736 | 2-50,1-3 737 | 24-72,6-24 738 | 61-61,29-60 739 | 24-28,24-72 740 | 5-97,2-98 741 | 1-88,16-72 742 | 38-38,37-38 743 | 18-94,66-93 744 | 35-36,36-48 745 | 45-98,45-99 746 | 17-84,85-98 747 | 26-26,25-34 748 | 78-80,29-79 749 | 31-43,30-30 750 | 25-35,29-73 751 | 20-93,27-92 752 | 28-90,29-91 753 | 17-32,31-32 754 | 14-56,7-55 755 | 39-96,3-12 756 | 97-97,35-98 757 | 18-34,35-51 758 | 32-79,9-84 759 | 30-32,13-31 760 | 27-95,31-96 761 | 30-30,31-44 762 | 37-82,38-81 763 | 8-85,7-62 764 | 4-99,5-5 765 | 11-13,12-64 766 | 20-96,19-79 767 | 52-72,29-53 768 | 40-74,73-74 769 | 15-54,16-36 770 | 3-96,4-95 771 | 13-14,16-87 772 | 22-41,39-42 773 | 60-65,59-59 774 | 74-80,15-74 775 | 61-61,4-60 776 | 38-84,39-84 777 | 6-16,6-6 778 | 1-96,96-97 779 | 1-98,97-98 780 | 2-99,1-99 781 | 25-96,12-24 782 | 30-62,30-63 783 | 4-88,5-89 784 | 8-86,7-7 785 | 12-97,4-97 786 | 81-88,80-88 787 | 8-82,6-6 788 | 94-96,3-95 789 | 2-98,1-99 790 | 53-92,75-85 791 | 18-18,19-95 792 | 23-39,23-39 793 | 5-94,93-93 794 | 62-96,26-97 795 | 1-98,35-97 796 | 39-53,8-53 797 | 10-67,9-66 798 | 85-90,14-81 799 | 10-69,11-39 800 | 69-74,39-96 801 | 12-35,12-35 802 | 25-56,24-64 803 | 20-76,75-77 804 | 13-78,10-13 805 | 3-43,43-80 806 | 52-71,21-84 807 | 40-48,33-96 808 | 3-98,9-98 809 | 29-38,37-39 810 | 18-27,26-26 811 | 6-82,4-89 812 | 18-56,19-57 813 | 28-76,6-77 814 | 12-73,11-46 815 | 10-40,11-41 816 | 99-99,34-91 817 | 32-91,91-94 818 | 38-53,27-60 819 | 36-88,35-89 820 | 3-68,2-53 821 | 6-85,6-85 822 | 47-49,6-56 823 | 31-92,30-92 824 | 6-42,11-43 825 | 1-1,9-64 826 | 48-65,24-47 827 | 18-65,2-5 828 | 28-86,1-27 829 | 4-26,5-94 830 | 15-75,14-15 831 | 11-48,10-19 832 | 13-75,14-75 833 | 51-90,47-89 834 | 60-92,13-95 835 | 14-57,14-57 836 | 5-96,4-5 837 | 27-33,20-32 838 | 15-49,1-48 839 | 44-70,43-56 840 | 62-90,88-88 841 | 38-58,13-80 842 | 9-94,8-93 843 | 42-88,42-52 844 | 39-91,42-92 845 | 4-74,75-81 846 | 73-75,72-77 847 | 49-78,50-67 848 | 22-64,9-23 849 | 3-89,55-60 850 | 64-88,76-87 851 | 29-60,60-92 852 | 56-99,98-98 853 | 45-96,19-95 854 | 48-65,49-66 855 | 59-88,90-91 856 | 43-78,20-20 857 | 24-65,15-24 858 | 70-76,67-70 859 | 24-99,25-98 860 | 76-98,75-77 861 | 34-56,34-56 862 | 70-86,85-86 863 | 33-98,32-99 864 | 27-30,28-29 865 | 72-99,72-97 866 | 4-33,1-33 867 | 22-95,21-96 868 | 13-19,22-59 869 | 59-77,6-59 870 | 5-59,3-5 871 | 20-61,60-62 872 | 9-98,10-99 873 | 11-91,19-86 874 | 2-93,4-42 875 | 33-41,61-65 876 | 4-98,4-72 877 | 50-68,13-51 878 | 97-98,21-97 879 | 21-72,22-71 880 | 37-84,2-85 881 | 2-85,18-85 882 | 42-96,41-97 883 | 29-84,52-66 884 | 20-98,57-89 885 | 3-91,3-91 886 | 38-80,39-79 887 | 89-89,11-88 888 | 10-40,40-70 889 | 39-80,38-87 890 | 62-63,52-62 891 | 1-52,2-52 892 | 97-97,2-97 893 | 5-59,58-58 894 | 31-59,28-70 895 | 27-88,21-24 896 | 13-41,13-84 897 | 3-42,3-42 898 | 70-94,69-93 899 | 16-53,15-52 900 | 90-96,13-57 901 | 63-75,60-76 902 | 87-87,4-55 903 | 3-44,4-85 904 | 7-98,10-87 905 | 2-65,3-65 906 | 27-93,27-92 907 | 35-54,34-53 908 | 40-75,98-99 909 | 14-14,13-53 910 | 16-16,17-97 911 | 39-96,41-96 912 | 70-72,71-97 913 | 35-35,32-36 914 | 48-84,85-95 915 | 7-81,11-81 916 | 31-94,31-94 917 | 1-2,4-72 918 | 3-99,3-99 919 | 92-94,21-28 920 | 39-73,38-83 921 | 6-57,6-57 922 | 68-90,67-98 923 | 9-81,10-82 924 | 57-81,57-81 925 | 16-59,57-60 926 | 10-42,2-43 927 | 14-77,12-15 928 | 88-88,3-87 929 | 88-89,13-89 930 | 68-69,7-69 931 | 63-92,92-98 932 | 37-87,85-86 933 | 4-56,5-22 934 | 15-52,51-51 935 | 92-93,74-92 936 | 9-98,7-10 937 | 17-17,18-53 938 | 55-88,61-72 939 | 38-81,65-78 940 | 98-99,59-73 941 | 17-22,18-22 942 | 69-94,68-69 943 | 84-85,6-84 944 | 12-12,13-95 945 | 8-34,7-8 946 | 2-38,3-38 947 | 20-29,28-80 948 | 21-52,22-52 949 | 36-91,90-92 950 | 5-90,4-91 951 | 1-41,1-36 952 | 3-76,10-98 953 | 14-41,2-14 954 | 18-64,19-64 955 | 37-93,83-92 956 | 31-36,32-60 957 | 53-83,47-84 958 | 2-89,70-77 959 | 28-83,84-84 960 | 31-59,58-71 961 | 10-98,10-87 962 | 19-80,20-81 963 | 11-17,9-18 964 | 29-76,48-52 965 | 10-33,33-65 966 | 20-83,68-99 967 | 14-43,13-13 968 | 44-71,62-70 969 | 59-63,49-64 970 | 14-94,94-95 971 | 5-89,2-2 972 | 83-95,84-95 973 | 2-9,8-93 974 | 63-69,68-68 975 | 73-75,5-74 976 | 82-92,91-93 977 | 5-5,4-57 978 | 35-39,35-83 979 | 71-83,56-83 980 | 87-87,8-88 981 | 95-98,2-30 982 | 10-60,59-89 983 | 13-23,25-93 984 | 73-86,22-85 985 | 32-47,46-90 986 | 5-79,3-16 987 | 20-92,28-69 988 | 30-31,19-31 989 | 41-70,9-36 990 | 1-49,2-98 991 | 1-96,41-96 992 | 44-50,44-71 993 | 1-28,2-27 994 | 13-93,74-92 995 | 37-38,31-37 996 | 4-79,3-80 997 | 14-50,37-37 998 | 5-68,46-68 999 | 23-63,22-63 1000 | 3-94,1-3 -------------------------------------------------------------------------------- /day7-no-space-left-on-device/input: -------------------------------------------------------------------------------- 1 | $ cd / 2 | $ ls 3 | dir fwbjchs 4 | dir hmnpr 5 | dir jtrbrcjl 6 | dir lcgv 7 | dir ldqc 8 | dir vrvl 9 | $ cd fwbjchs 10 | $ ls 11 | 154619 wqdlv.mdw 12 | 21648 wvbnz 13 | $ cd .. 14 | $ cd hmnpr 15 | $ ls 16 | 178623 rftqqsrp.bfm 17 | $ cd .. 18 | $ cd jtrbrcjl 19 | $ ls 20 | dir nmbfwc 21 | dir whqb 22 | $ cd nmbfwc 23 | $ ls 24 | 242645 lcgv 25 | 256365 wdzw.drg 26 | $ cd .. 27 | $ cd whqb 28 | $ ls 29 | 161522 mrqgpv.gsm 30 | 48062 vpsgcl.gfh 31 | $ cd .. 32 | $ cd .. 33 | $ cd lcgv 34 | $ ls 35 | dir cthtlwds 36 | dir grldv 37 | dir lnztfr 38 | dir vwhf 39 | dir znmzg 40 | $ cd cthtlwds 41 | $ ls 42 | dir dghvw 43 | dir tfwgg 44 | $ cd dghvw 45 | $ ls 46 | 107090 jmj.lzh 47 | $ cd .. 48 | $ cd tfwgg 49 | $ ls 50 | dir ddnfmsjc 51 | 252616 fvj 52 | dir gng 53 | dir lcgv 54 | 234528 mpb 55 | 181198 pzqgf.cjd 56 | dir svvz 57 | $ cd ddnfmsjc 58 | $ ls 59 | dir hwmcsdvt 60 | dir lcgv 61 | $ cd hwmcsdvt 62 | $ ls 63 | 208912 wdzw.drg 64 | $ cd .. 65 | $ cd lcgv 66 | $ ls 67 | 47252 tnd.ztd 68 | $ cd .. 69 | $ cd .. 70 | $ cd gng 71 | $ ls 72 | 44313 pzqgf.cjd 73 | $ cd .. 74 | $ cd lcgv 75 | $ ls 76 | 182616 wdzw.drg 77 | $ cd .. 78 | $ cd svvz 79 | $ ls 80 | 86968 sqtggfv 81 | 33927 vfmltgs 82 | $ cd .. 83 | $ cd .. 84 | $ cd .. 85 | $ cd grldv 86 | $ ls 87 | 145761 mrqgpv.gsm 88 | dir wqdlv 89 | $ cd wqdlv 90 | $ ls 91 | 96902 jhmsp 92 | 157064 mrqgpv.gsm 93 | $ cd .. 94 | $ cd .. 95 | $ cd lnztfr 96 | $ ls 97 | 137978 bpq 98 | 180941 fvpfmwn 99 | 148685 hsg.qgj 100 | 865 mrqgpv.gsm 101 | $ cd .. 102 | $ cd vwhf 103 | $ ls 104 | dir bgtgqzz 105 | dir fcwzw 106 | dir lcgv 107 | dir mrlvtb 108 | 116134 mrqgpv.gsm 109 | dir wszvqd 110 | $ cd bgtgqzz 111 | $ ls 112 | dir dzpjg 113 | 283411 nmbfwc 114 | dir smhhzq 115 | 240602 ttlbcssq 116 | $ cd dzpjg 117 | $ ls 118 | 75545 cmfw.gsj 119 | 189219 lcgv.chq 120 | 255580 lqndrsh.szf 121 | 175733 mrqgpv.gsm 122 | $ cd .. 123 | $ cd smhhzq 124 | $ ls 125 | 137259 thjwcz.qhn 126 | $ cd .. 127 | $ cd .. 128 | $ cd fcwzw 129 | $ ls 130 | 59717 tpljg 131 | $ cd .. 132 | $ cd lcgv 133 | $ ls 134 | 148881 mrzcdzd.gjt 135 | 68671 pzqgf.cjd 136 | 242866 slpftp 137 | 89945 vpsgcl.gfh 138 | 196497 wdzw.drg 139 | $ cd .. 140 | $ cd mrlvtb 141 | $ ls 142 | 40003 rfzrwc.zjn 143 | $ cd .. 144 | $ cd wszvqd 145 | $ ls 146 | dir bhhtbv 147 | dir lcpvwdq 148 | $ cd bhhtbv 149 | $ ls 150 | dir fbh 151 | 248604 ldscpjmp 152 | dir nmbfwc 153 | $ cd fbh 154 | $ ls 155 | 256295 vpsgcl.gfh 156 | $ cd .. 157 | $ cd nmbfwc 158 | $ ls 159 | 83799 lcgv.vfc 160 | $ cd .. 161 | $ cd .. 162 | $ cd lcpvwdq 163 | $ ls 164 | dir lwhq 165 | 212569 rfzrwc.clp 166 | 23957 wdzw.drg 167 | $ cd lwhq 168 | $ ls 169 | 240867 fzrwpl.hqd 170 | 68771 mzsqgswh 171 | 88777 pqtqv.qwz 172 | $ cd .. 173 | $ cd .. 174 | $ cd .. 175 | $ cd .. 176 | $ cd znmzg 177 | $ ls 178 | 30277 gltpwzg.gjd 179 | 211983 wdzw.drg 180 | $ cd .. 181 | $ cd .. 182 | $ cd ldqc 183 | $ ls 184 | dir dnzfqzwv 185 | dir dvshtm 186 | 97119 gdnlwmbf 187 | dir gqb 188 | dir jclb 189 | dir jgbsw 190 | 115989 lcgv.hlf 191 | 255836 lchqqdh.wrn 192 | dir qtdlb 193 | dir rmljszcj 194 | dir tqwpmw 195 | dir vhdgcsw 196 | $ cd dnzfqzwv 197 | $ ls 198 | dir tqv 199 | $ cd tqv 200 | $ ls 201 | 139984 dwhz.nhz 202 | 240411 pzqgf.cjd 203 | 129386 rnnr 204 | 190691 svgwt.mql 205 | $ cd .. 206 | $ cd .. 207 | $ cd dvshtm 208 | $ ls 209 | dir lcgv 210 | 96767 mrqgpv.gsm 211 | dir qdmmpq 212 | $ cd lcgv 213 | $ ls 214 | 82949 bldf.hwn 215 | $ cd .. 216 | $ cd qdmmpq 217 | $ ls 218 | dir lzgwflt 219 | dir vgrdpbg 220 | $ cd lzgwflt 221 | $ ls 222 | 148651 tndbwbh 223 | $ cd .. 224 | $ cd vgrdpbg 225 | $ ls 226 | dir wqdlv 227 | $ cd wqdlv 228 | $ ls 229 | 130393 rqjc.dnr 230 | $ cd .. 231 | $ cd .. 232 | $ cd .. 233 | $ cd .. 234 | $ cd gqb 235 | $ ls 236 | dir jtf 237 | dir lvwpqs 238 | 212592 mrzcdzd.gjt 239 | 70051 tqpwdwm.nzz 240 | dir vznbng 241 | 52226 wbsdrsfh.tfw 242 | $ cd jtf 243 | $ ls 244 | 232635 lvpccb.dmm 245 | 105086 wdzw.drg 246 | $ cd .. 247 | $ cd lvwpqs 248 | $ ls 249 | 124821 dmhqlt 250 | 265915 mrqgpv.gsm 251 | 45481 pzqgf.cjd 252 | $ cd .. 253 | $ cd vznbng 254 | $ ls 255 | 42179 nrzcpgvl.jft 256 | 17752 tld.ghn 257 | 174859 zvqglbw.ppl 258 | $ cd .. 259 | $ cd .. 260 | $ cd jclb 261 | $ ls 262 | dir bnz 263 | dir dtmtvbw 264 | dir hnlrtpbz 265 | dir pbb 266 | dir vhjwtq 267 | dir vpfggv 268 | dir zmflq 269 | $ cd bnz 270 | $ ls 271 | 199447 mrzcdzd.gjt 272 | $ cd .. 273 | $ cd dtmtvbw 274 | $ ls 275 | dir bjthn 276 | dir hzlhz 277 | dir zmflq 278 | $ cd bjthn 279 | $ ls 280 | 272777 pgqfn.tdd 281 | $ cd .. 282 | $ cd hzlhz 283 | $ ls 284 | 50958 lcgv.gvq 285 | $ cd .. 286 | $ cd zmflq 287 | $ ls 288 | 207442 rrnwns.zpf 289 | 15759 wdzw.drg 290 | $ cd .. 291 | $ cd .. 292 | $ cd hnlrtpbz 293 | $ ls 294 | 69788 jhqjs.sdj 295 | 219666 jljzp.mhf 296 | 137518 jqnfg 297 | 108183 shfjz.vnr 298 | 130164 vpsgcl.gfh 299 | $ cd .. 300 | $ cd pbb 301 | $ ls 302 | dir wqdlv 303 | dir zmflq 304 | $ cd wqdlv 305 | $ ls 306 | dir fgggwt 307 | dir hrghbhj 308 | dir nmbfwc 309 | dir tgmqnq 310 | 146479 vpsgcl.gfh 311 | dir wqdlv 312 | $ cd fgggwt 313 | $ ls 314 | 264892 wqdlv.zsp 315 | $ cd .. 316 | $ cd hrghbhj 317 | $ ls 318 | 116698 bfwtbg 319 | dir lcgv 320 | 92758 pzqgf.cjd 321 | dir tsdjgt 322 | 284427 vpsgcl.gfh 323 | 229621 wqdlv.pml 324 | dir zfjjncvd 325 | $ cd lcgv 326 | $ ls 327 | 30459 mrzcdzd.gjt 328 | dir wqdlv 329 | $ cd wqdlv 330 | $ ls 331 | 78475 wdzw.drg 332 | $ cd .. 333 | $ cd .. 334 | $ cd tsdjgt 335 | $ ls 336 | 166330 jpfms 337 | 16410 tjswm.bqv 338 | $ cd .. 339 | $ cd zfjjncvd 340 | $ ls 341 | 59841 mrqgpv.gsm 342 | $ cd .. 343 | $ cd .. 344 | $ cd nmbfwc 345 | $ ls 346 | dir jtn 347 | 151403 mmjm 348 | 240129 mmsb 349 | 206021 nmbfwc.sds 350 | 84439 vpsgcl.gfh 351 | dir wqdlv 352 | dir zvnrwfhn 353 | $ cd jtn 354 | $ ls 355 | 23555 hmmt.gbb 356 | $ cd .. 357 | $ cd wqdlv 358 | $ ls 359 | 69742 jppj.vvg 360 | $ cd .. 361 | $ cd zvnrwfhn 362 | $ ls 363 | 242009 lcgv.bds 364 | $ cd .. 365 | $ cd .. 366 | $ cd tgmqnq 367 | $ ls 368 | 259985 bzqjt 369 | 46410 flsm.szr 370 | dir lcgv 371 | 89561 npfmc.vqs 372 | 17503 vpsgcl.gfh 373 | 73719 wqdlv.gjn 374 | $ cd lcgv 375 | $ ls 376 | dir dzfglmz 377 | 177553 ffvzsgz 378 | dir ljt 379 | 216443 mrzcdzd.gjt 380 | 255381 nmbfwc 381 | dir rplqnt 382 | 84061 zmflq.vlw 383 | $ cd dzfglmz 384 | $ ls 385 | 220883 dqbcfgfd 386 | $ cd .. 387 | $ cd ljt 388 | $ ls 389 | 11842 rfzrwc.hpn 390 | $ cd .. 391 | $ cd rplqnt 392 | $ ls 393 | 119893 lszmvzst.zng 394 | $ cd .. 395 | $ cd .. 396 | $ cd .. 397 | $ cd wqdlv 398 | $ ls 399 | dir chnpddzn 400 | 272999 hbhwqt.fsl 401 | 144546 jvhjnsz 402 | dir ppsm 403 | 102615 pzqgf.cjd 404 | dir swdnss 405 | $ cd chnpddzn 406 | $ ls 407 | 256977 pzqgf.cjd 408 | dir wqdlv 409 | $ cd wqdlv 410 | $ ls 411 | 6565 hlcqgmj 412 | $ cd .. 413 | $ cd .. 414 | $ cd ppsm 415 | $ ls 416 | 238358 fvw.bzw 417 | dir ggjnl 418 | 265010 mrzcdzd.gjt 419 | 201818 rfzrwc 420 | dir ssggblm 421 | $ cd ggjnl 422 | $ ls 423 | 45841 nlnrrqf.fwn 424 | $ cd .. 425 | $ cd ssggblm 426 | $ ls 427 | 276584 djqb.ngq 428 | 18926 lcgv 429 | $ cd .. 430 | $ cd .. 431 | $ cd swdnss 432 | $ ls 433 | dir bmrzhjs 434 | $ cd bmrzhjs 435 | $ ls 436 | 269825 mrqgpv.gsm 437 | 3162 rdmbdwq.bmv 438 | $ cd .. 439 | $ cd .. 440 | $ cd .. 441 | $ cd .. 442 | $ cd zmflq 443 | $ ls 444 | dir hnrnldw 445 | dir lcgv 446 | dir mpmcghz 447 | dir nbbv 448 | dir qsnfzp 449 | dir tntnjg 450 | dir wqdlv 451 | $ cd hnrnldw 452 | $ ls 453 | 102631 wjbbjwtm.vvz 454 | $ cd .. 455 | $ cd lcgv 456 | $ ls 457 | dir dzz 458 | dir hbzzf 459 | dir jncrbhc 460 | 205204 lqnrp 461 | dir mzzpfnr 462 | dir nmbfwc 463 | dir rfzrwc 464 | dir rnrmhfz 465 | dir zmflq 466 | $ cd dzz 467 | $ ls 468 | dir cvvdv 469 | 226221 nggtqdzn 470 | 94641 npmpjnjm.bzg 471 | dir rsdw 472 | dir sjrb 473 | 41983 vfdz.ngz 474 | 271561 zmflq.zsc 475 | $ cd cvvdv 476 | $ ls 477 | 64260 hhqv.tsg 478 | 31245 pzqgf.cjd 479 | 280268 znjjp 480 | $ cd .. 481 | $ cd rsdw 482 | $ ls 483 | dir lcgv 484 | $ cd lcgv 485 | $ ls 486 | 37080 nmbfwc 487 | $ cd .. 488 | $ cd .. 489 | $ cd sjrb 490 | $ ls 491 | 233530 mrqgpv.gsm 492 | $ cd .. 493 | $ cd .. 494 | $ cd hbzzf 495 | $ ls 496 | 36018 mrqgpv.gsm 497 | $ cd .. 498 | $ cd jncrbhc 499 | $ ls 500 | 205345 mrqgpv.gsm 501 | 244683 nqpcpt 502 | $ cd .. 503 | $ cd mzzpfnr 504 | $ ls 505 | dir hmjzlr 506 | dir lcgv 507 | dir mczs 508 | dir wqdlv 509 | 90391 wqdlv.pdr 510 | 144119 zmflq 511 | $ cd hmjzlr 512 | $ ls 513 | 268342 svsd.jcd 514 | $ cd .. 515 | $ cd lcgv 516 | $ ls 517 | dir pwhl 518 | dir rfzrwc 519 | $ cd pwhl 520 | $ ls 521 | 42795 gvmt 522 | 82576 wdzw.drg 523 | $ cd .. 524 | $ cd rfzrwc 525 | $ ls 526 | dir jjl 527 | dir mqp 528 | 156985 mrqgpv.gsm 529 | dir wptr 530 | dir wqdlv 531 | $ cd jjl 532 | $ ls 533 | dir jrjjr 534 | 104785 nmbfwc 535 | 20108 wdzw.drg 536 | $ cd jrjjr 537 | $ ls 538 | 243753 hgndlcrv.wbc 539 | $ cd .. 540 | $ cd .. 541 | $ cd mqp 542 | $ ls 543 | 142621 cljnbs 544 | $ cd .. 545 | $ cd wptr 546 | $ ls 547 | 46279 vjqlvhrh.njr 548 | $ cd .. 549 | $ cd wqdlv 550 | $ ls 551 | 104474 vpsgcl.gfh 552 | $ cd .. 553 | $ cd .. 554 | $ cd .. 555 | $ cd mczs 556 | $ ls 557 | 186843 mrqgpv.gsm 558 | dir pjm 559 | dir thbwb 560 | $ cd pjm 561 | $ ls 562 | dir wqdlv 563 | $ cd wqdlv 564 | $ ls 565 | 201647 sgtt 566 | $ cd .. 567 | $ cd .. 568 | $ cd thbwb 569 | $ ls 570 | 146494 mrqgpv.gsm 571 | $ cd .. 572 | $ cd .. 573 | $ cd wqdlv 574 | $ ls 575 | 103876 mrqgpv.gsm 576 | $ cd .. 577 | $ cd .. 578 | $ cd nmbfwc 579 | $ ls 580 | dir fgctdds 581 | dir rwgscjbv 582 | $ cd fgctdds 583 | $ ls 584 | 205015 bwvshdcz.dpp 585 | $ cd .. 586 | $ cd rwgscjbv 587 | $ ls 588 | 242899 rbmtfdhp 589 | $ cd .. 590 | $ cd .. 591 | $ cd rfzrwc 592 | $ ls 593 | dir bnsgzwhn 594 | 228624 ffj 595 | dir lcgv 596 | dir rcvwcbfd 597 | 268775 vbhsh.nnz 598 | 129373 vpsgcl.gfh 599 | 68919 wqdlv 600 | dir wqmdw 601 | dir zmflq 602 | 153277 zmflq.frv 603 | $ cd bnsgzwhn 604 | $ ls 605 | 9892 ltcrrzhb.njc 606 | dir wpwmflr 607 | dir zmflq 608 | $ cd wpwmflr 609 | $ ls 610 | 274142 bfj.fbw 611 | dir rfzrwc 612 | dir srnm 613 | $ cd rfzrwc 614 | $ ls 615 | 161517 mrqgpv.gsm 616 | dir zbhgwsd 617 | $ cd zbhgwsd 618 | $ ls 619 | 43750 vbqmpbcr.zwz 620 | $ cd .. 621 | $ cd .. 622 | $ cd srnm 623 | $ ls 624 | dir rvvtgr 625 | $ cd rvvtgr 626 | $ ls 627 | 164604 wzgbzbn 628 | $ cd .. 629 | $ cd .. 630 | $ cd .. 631 | $ cd zmflq 632 | $ ls 633 | 184482 mrqgpv.gsm 634 | 80280 pzqgf.cjd 635 | 183303 zln.tbm 636 | $ cd .. 637 | $ cd .. 638 | $ cd lcgv 639 | $ ls 640 | dir lcgv 641 | dir pqttlp 642 | $ cd lcgv 643 | $ ls 644 | dir bpjzg 645 | $ cd bpjzg 646 | $ ls 647 | 99853 wdzw.drg 648 | $ cd .. 649 | $ cd .. 650 | $ cd pqttlp 651 | $ ls 652 | dir bgvhcgfn 653 | 45115 mrzcdzd.gjt 654 | 248058 qnvhgpw.ddw 655 | 112129 rfzrwc 656 | $ cd bgvhcgfn 657 | $ ls 658 | 228291 nmbfwc.gqj 659 | $ cd .. 660 | $ cd .. 661 | $ cd .. 662 | $ cd rcvwcbfd 663 | $ ls 664 | dir vtrtt 665 | dir wgp 666 | $ cd vtrtt 667 | $ ls 668 | 138009 pzqgf.cjd 669 | dir ztsvzpn 670 | $ cd ztsvzpn 671 | $ ls 672 | 51632 vpsgcl.gfh 673 | $ cd .. 674 | $ cd .. 675 | $ cd wgp 676 | $ ls 677 | 81030 lcgv.zhv 678 | $ cd .. 679 | $ cd .. 680 | $ cd wqmdw 681 | $ ls 682 | dir zmrdf 683 | $ cd zmrdf 684 | $ ls 685 | dir qqgw 686 | $ cd qqgw 687 | $ ls 688 | 58554 gqpqvplc.zvr 689 | $ cd .. 690 | $ cd .. 691 | $ cd .. 692 | $ cd zmflq 693 | $ ls 694 | 224544 mrzcdzd.gjt 695 | 254976 pzqgf.cjd 696 | $ cd .. 697 | $ cd .. 698 | $ cd rnrmhfz 699 | $ ls 700 | 19759 lcgv.stz 701 | $ cd .. 702 | $ cd zmflq 703 | $ ls 704 | 22390 nftzlqg.qmp 705 | 80148 wqdlv 706 | $ cd .. 707 | $ cd .. 708 | $ cd mpmcghz 709 | $ ls 710 | 169324 mrqgpv.gsm 711 | 65924 wdzw.drg 712 | $ cd .. 713 | $ cd nbbv 714 | $ ls 715 | 115297 bqcrc.prw 716 | 58148 pvzv.qwf 717 | dir wqdlv 718 | $ cd wqdlv 719 | $ ls 720 | 145268 mrzcdzd.gjt 721 | 35745 nmbfwc.hgv 722 | 112142 wqdlv 723 | $ cd .. 724 | $ cd .. 725 | $ cd qsnfzp 726 | $ ls 727 | 241308 nmbfwc.hmg 728 | $ cd .. 729 | $ cd tntnjg 730 | $ ls 731 | 19543 mrqgpv.gsm 732 | 667 wqdlv 733 | $ cd .. 734 | $ cd wqdlv 735 | $ ls 736 | dir dqpgtmdl 737 | dir jrqsqrv 738 | 189727 mrzcdzd.gjt 739 | dir rfzrwc 740 | 208280 vpsgcl.gfh 741 | 281557 vwsljgn.mwd 742 | 119829 zmflq.hgd 743 | $ cd dqpgtmdl 744 | $ ls 745 | 268413 qcw.slb 746 | $ cd .. 747 | $ cd jrqsqrv 748 | $ ls 749 | 238387 mvllmjc.wvm 750 | 213020 nqp.gdr 751 | 157257 nzdmplg.zqh 752 | dir ppwcgc 753 | 24914 pzqgf.cjd 754 | dir zjr 755 | dir zmflq 756 | $ cd ppwcgc 757 | $ ls 758 | 249714 bsrnnhrr.spq 759 | dir cvnd 760 | $ cd cvnd 761 | $ ls 762 | 248610 pzqgf.cjd 763 | $ cd .. 764 | $ cd .. 765 | $ cd zjr 766 | $ ls 767 | 224145 smwb.mmz 768 | $ cd .. 769 | $ cd zmflq 770 | $ ls 771 | 250519 ftggp 772 | 147304 vpsgcl.gfh 773 | 238706 wdzw.drg 774 | 258323 wqdlv.bjp 775 | dir wqgngf 776 | $ cd wqgngf 777 | $ ls 778 | 14302 bdz.jdw 779 | dir jpgfsgd 780 | dir ldwgr 781 | 22718 nwfh.nzf 782 | $ cd jpgfsgd 783 | $ ls 784 | dir lcgv 785 | dir qbrwz 786 | $ cd lcgv 787 | $ ls 788 | 284229 qhwc.zpq 789 | dir wsjs 790 | $ cd wsjs 791 | $ ls 792 | 111635 lcgv 793 | $ cd .. 794 | $ cd .. 795 | $ cd qbrwz 796 | $ ls 797 | 199057 gpssftw.wdb 798 | $ cd .. 799 | $ cd .. 800 | $ cd ldwgr 801 | $ ls 802 | 260404 gdnpg.vjb 803 | $ cd .. 804 | $ cd .. 805 | $ cd .. 806 | $ cd .. 807 | $ cd rfzrwc 808 | $ ls 809 | dir lmcg 810 | $ cd lmcg 811 | $ ls 812 | 32819 sjjztgr.rfj 813 | $ cd .. 814 | $ cd .. 815 | $ cd .. 816 | $ cd .. 817 | $ cd .. 818 | $ cd vhjwtq 819 | $ ls 820 | dir qgqbrv 821 | $ cd qgqbrv 822 | $ ls 823 | 176900 gwbnqtn.rnj 824 | $ cd .. 825 | $ cd .. 826 | $ cd vpfggv 827 | $ ls 828 | 144809 cmc.srv 829 | 117565 nhddq.bqn 830 | dir scw 831 | dir tpmnhdc 832 | dir vvp 833 | 71774 wqdlv.gdm 834 | 61647 zmflq 835 | 174026 zmflq.wzn 836 | $ cd scw 837 | $ ls 838 | 2295 bqbsrj.gnc 839 | 243386 mfmdqhh.mzl 840 | $ cd .. 841 | $ cd tpmnhdc 842 | $ ls 843 | dir fjwr 844 | dir lcllz 845 | dir nmbfwc 846 | $ cd fjwr 847 | $ ls 848 | 133256 pwgtqz.dpm 849 | 159987 vpsgcl.gfh 850 | $ cd .. 851 | $ cd lcllz 852 | $ ls 853 | dir flwws 854 | 210654 qmbfw.bsv 855 | dir zmflq 856 | $ cd flwws 857 | $ ls 858 | 222222 nmbfwc.vhj 859 | $ cd .. 860 | $ cd zmflq 861 | $ ls 862 | 235011 jlzfbt.wlb 863 | 49525 rfzrwc.fnc 864 | $ cd .. 865 | $ cd .. 866 | $ cd nmbfwc 867 | $ ls 868 | 133730 dqdqhvm 869 | dir lcgv 870 | 188291 nmbfwc.qhv 871 | 110039 wdzw.drg 872 | 249996 wqdlv 873 | dir zmflq 874 | dir zppcvq 875 | $ cd lcgv 876 | $ ls 877 | dir wths 878 | $ cd wths 879 | $ ls 880 | 120313 jdbtlf.rrn 881 | $ cd .. 882 | $ cd .. 883 | $ cd zmflq 884 | $ ls 885 | 124906 dqdcpzh 886 | $ cd .. 887 | $ cd zppcvq 888 | $ ls 889 | 112537 mrzcdzd.gjt 890 | $ cd .. 891 | $ cd .. 892 | $ cd .. 893 | $ cd vvp 894 | $ ls 895 | dir fsw 896 | 194927 hvlm.pbd 897 | dir nmbfwc 898 | 230376 pgsq 899 | $ cd fsw 900 | $ ls 901 | 111889 nmbfwc.smt 902 | dir rfzrwc 903 | $ cd rfzrwc 904 | $ ls 905 | 282718 gbvss 906 | $ cd .. 907 | $ cd .. 908 | $ cd nmbfwc 909 | $ ls 910 | dir fvh 911 | 160971 ngqvztv.hfg 912 | dir rfzrwc 913 | $ cd fvh 914 | $ ls 915 | 256956 mrqgpv.gsm 916 | 14363 vbvsncs.jjw 917 | 172959 wdzw.drg 918 | $ cd .. 919 | $ cd rfzrwc 920 | $ ls 921 | 257264 vpsgcl.gfh 922 | $ cd .. 923 | $ cd .. 924 | $ cd .. 925 | $ cd .. 926 | $ cd zmflq 927 | $ ls 928 | 10486 lbdtpnps.jhq 929 | 118145 rlgjvn.nvf 930 | 176390 wdzw.drg 931 | $ cd .. 932 | $ cd .. 933 | $ cd jgbsw 934 | $ ls 935 | dir cfdljgh 936 | 214846 dwqdqv.ftq 937 | dir rfzrwc 938 | 147094 vpsgcl.gfh 939 | $ cd cfdljgh 940 | $ ls 941 | 261471 mrqgpv.gsm 942 | $ cd .. 943 | $ cd rfzrwc 944 | $ ls 945 | dir fcvfw 946 | dir gvqrwgrs 947 | 57417 zfqrqv.fvp 948 | $ cd fcvfw 949 | $ ls 950 | 279614 wdzw.drg 951 | $ cd .. 952 | $ cd gvqrwgrs 953 | $ ls 954 | dir sgfltf 955 | $ cd sgfltf 956 | $ ls 957 | 204207 mstlc.wtj 958 | $ cd .. 959 | $ cd .. 960 | $ cd .. 961 | $ cd .. 962 | $ cd qtdlb 963 | $ ls 964 | dir gjpmcvwp 965 | dir nsjlcmfz 966 | dir wqdlv 967 | $ cd gjpmcvwp 968 | $ ls 969 | dir cjjdzcwm 970 | $ cd cjjdzcwm 971 | $ ls 972 | 233873 pdnsrz.vfp 973 | $ cd .. 974 | $ cd .. 975 | $ cd nsjlcmfz 976 | $ ls 977 | 53472 nmbfwc 978 | dir qvpj 979 | $ cd qvpj 980 | $ ls 981 | 150929 mrzcdzd.gjt 982 | $ cd .. 983 | $ cd .. 984 | $ cd wqdlv 985 | $ ls 986 | dir qccsnjd 987 | $ cd qccsnjd 988 | $ ls 989 | 65908 hsrqhn.hjr 990 | 267802 zmflq.jdt 991 | $ cd .. 992 | $ cd .. 993 | $ cd .. 994 | $ cd rmljszcj 995 | $ ls 996 | dir jnstrbj 997 | 172566 nbtszsgl 998 | dir wqdlv 999 | $ cd jnstrbj 1000 | $ ls 1001 | 232158 fgccmchh.wqg 1002 | 236339 mrqgpv.gsm 1003 | 281875 rfzrwc.sfd 1004 | $ cd .. 1005 | $ cd wqdlv 1006 | $ ls 1007 | 58492 wdzw.drg 1008 | 213853 wqdlv.zlz 1009 | $ cd .. 1010 | $ cd .. 1011 | $ cd tqwpmw 1012 | $ ls 1013 | 92747 pzqgf.cjd 1014 | $ cd .. 1015 | $ cd vhdgcsw 1016 | $ ls 1017 | 125104 crfw.sfv 1018 | dir flhbhzlt 1019 | 139949 mrqgpv.gsm 1020 | dir rfzrwc 1021 | dir rnz 1022 | 97174 zmflq.vpn 1023 | $ cd flhbhzlt 1024 | $ ls 1025 | 282258 mrzcdzd.gjt 1026 | $ cd .. 1027 | $ cd rfzrwc 1028 | $ ls 1029 | dir lcgv 1030 | $ cd lcgv 1031 | $ ls 1032 | dir dlpng 1033 | dir glqrj 1034 | 178245 lcgv 1035 | 106863 nmbfwc.fgr 1036 | $ cd dlpng 1037 | $ ls 1038 | 195950 rfzrwc 1039 | $ cd .. 1040 | $ cd glqrj 1041 | $ ls 1042 | 248909 pzqgf.cjd 1043 | 34214 vpsgcl.gfh 1044 | $ cd .. 1045 | $ cd .. 1046 | $ cd .. 1047 | $ cd rnz 1048 | $ ls 1049 | dir chfccv 1050 | dir cmsccq 1051 | dir zmflq 1052 | $ cd chfccv 1053 | $ ls 1054 | 13688 mrqgpv.gsm 1055 | 162142 vpsgcl.gfh 1056 | $ cd .. 1057 | $ cd cmsccq 1058 | $ ls 1059 | 94122 dzpsltth 1060 | 190025 rfzrwc 1061 | dir twqt 1062 | 12230 wgghbcz.tph 1063 | 60111 wqdlv 1064 | $ cd twqt 1065 | $ ls 1066 | 109250 wdzw.drg 1067 | $ cd .. 1068 | $ cd .. 1069 | $ cd zmflq 1070 | $ ls 1071 | 174075 wdzw.drg 1072 | $ cd .. 1073 | $ cd .. 1074 | $ cd .. 1075 | $ cd .. 1076 | $ cd vrvl 1077 | $ ls 1078 | dir pnfv 1079 | 210089 rfzrwc 1080 | dir stcfmz 1081 | $ cd pnfv 1082 | $ ls 1083 | 183315 rhmztnnh 1084 | $ cd .. 1085 | $ cd stcfmz 1086 | $ ls 1087 | 115637 lcgv -------------------------------------------------------------------------------- /day9-rope-bridge/input: -------------------------------------------------------------------------------- 1 | U 1 2 | L 2 3 | U 2 4 | D 2 5 | L 2 6 | U 1 7 | D 1 8 | U 2 9 | D 1 10 | U 2 11 | D 1 12 | R 2 13 | U 2 14 | L 1 15 | U 2 16 | D 2 17 | R 1 18 | U 1 19 | R 2 20 | L 1 21 | R 2 22 | D 2 23 | R 2 24 | D 2 25 | U 1 26 | R 1 27 | D 2 28 | L 2 29 | D 1 30 | R 2 31 | D 2 32 | R 1 33 | L 2 34 | R 1 35 | L 2 36 | R 1 37 | U 1 38 | D 2 39 | L 1 40 | D 1 41 | R 1 42 | U 1 43 | D 2 44 | L 1 45 | U 1 46 | L 2 47 | R 1 48 | D 2 49 | U 1 50 | L 1 51 | D 1 52 | L 1 53 | R 2 54 | D 1 55 | L 1 56 | R 1 57 | L 2 58 | D 2 59 | U 2 60 | D 1 61 | R 2 62 | U 1 63 | L 1 64 | U 2 65 | L 1 66 | U 2 67 | R 2 68 | U 1 69 | D 1 70 | L 2 71 | R 2 72 | D 2 73 | L 1 74 | D 2 75 | R 2 76 | D 1 77 | L 1 78 | D 2 79 | L 1 80 | R 1 81 | L 1 82 | R 2 83 | U 1 84 | R 1 85 | D 1 86 | R 1 87 | D 2 88 | R 2 89 | D 2 90 | U 1 91 | L 1 92 | D 1 93 | R 1 94 | L 2 95 | D 1 96 | U 2 97 | D 1 98 | R 1 99 | D 2 100 | U 2 101 | D 1 102 | R 1 103 | D 1 104 | R 1 105 | U 2 106 | L 1 107 | U 1 108 | R 1 109 | L 2 110 | R 1 111 | L 1 112 | D 2 113 | L 2 114 | R 1 115 | D 3 116 | L 3 117 | U 1 118 | R 2 119 | U 1 120 | R 2 121 | L 1 122 | D 1 123 | L 3 124 | U 2 125 | L 3 126 | D 1 127 | U 2 128 | L 3 129 | U 1 130 | R 2 131 | L 1 132 | R 1 133 | L 2 134 | D 2 135 | R 3 136 | L 1 137 | U 1 138 | L 1 139 | R 1 140 | U 1 141 | D 3 142 | L 3 143 | D 2 144 | R 2 145 | L 2 146 | D 1 147 | U 2 148 | L 2 149 | U 1 150 | R 3 151 | D 3 152 | L 3 153 | R 2 154 | D 3 155 | L 3 156 | U 1 157 | D 3 158 | L 2 159 | R 2 160 | D 3 161 | R 2 162 | L 1 163 | U 3 164 | D 2 165 | R 2 166 | D 3 167 | U 1 168 | D 3 169 | R 3 170 | D 2 171 | U 1 172 | L 2 173 | D 2 174 | U 2 175 | R 1 176 | L 3 177 | U 2 178 | R 2 179 | U 1 180 | R 2 181 | D 1 182 | R 2 183 | D 3 184 | U 1 185 | L 1 186 | U 2 187 | L 1 188 | D 2 189 | R 1 190 | U 1 191 | D 1 192 | R 3 193 | U 3 194 | R 1 195 | U 1 196 | L 3 197 | D 2 198 | R 2 199 | U 1 200 | R 2 201 | D 2 202 | R 3 203 | L 2 204 | U 2 205 | R 1 206 | L 3 207 | U 2 208 | R 1 209 | D 3 210 | L 2 211 | U 2 212 | R 3 213 | U 3 214 | L 1 215 | R 3 216 | D 3 217 | L 2 218 | R 3 219 | D 2 220 | R 3 221 | U 3 222 | R 1 223 | U 2 224 | D 4 225 | L 3 226 | D 2 227 | L 4 228 | R 2 229 | D 4 230 | L 1 231 | R 3 232 | L 1 233 | D 4 234 | U 4 235 | D 1 236 | R 4 237 | U 2 238 | D 2 239 | R 1 240 | U 2 241 | D 1 242 | L 3 243 | D 2 244 | U 2 245 | L 1 246 | R 3 247 | L 3 248 | U 3 249 | L 2 250 | R 1 251 | D 2 252 | R 3 253 | L 2 254 | D 4 255 | U 2 256 | L 3 257 | R 3 258 | L 3 259 | U 4 260 | D 4 261 | L 1 262 | U 3 263 | R 4 264 | L 4 265 | D 4 266 | U 3 267 | R 4 268 | L 2 269 | D 1 270 | U 1 271 | L 4 272 | D 3 273 | U 3 274 | R 2 275 | D 3 276 | U 4 277 | L 2 278 | R 1 279 | L 2 280 | R 2 281 | U 3 282 | L 1 283 | D 4 284 | U 1 285 | L 4 286 | R 3 287 | L 3 288 | R 2 289 | D 4 290 | U 4 291 | L 4 292 | D 3 293 | R 1 294 | D 3 295 | R 4 296 | L 4 297 | R 2 298 | L 2 299 | D 2 300 | R 2 301 | L 2 302 | U 3 303 | R 3 304 | D 2 305 | R 4 306 | L 1 307 | R 2 308 | U 4 309 | L 2 310 | R 1 311 | U 2 312 | R 3 313 | D 2 314 | U 1 315 | R 4 316 | L 3 317 | U 3 318 | D 4 319 | U 1 320 | L 1 321 | R 1 322 | D 2 323 | R 1 324 | D 1 325 | L 2 326 | D 4 327 | U 4 328 | L 4 329 | U 3 330 | D 4 331 | U 4 332 | D 3 333 | U 3 334 | L 5 335 | U 4 336 | L 4 337 | U 5 338 | D 1 339 | L 5 340 | U 2 341 | D 4 342 | U 5 343 | L 4 344 | U 2 345 | D 4 346 | R 3 347 | L 5 348 | U 2 349 | L 1 350 | U 5 351 | L 4 352 | D 2 353 | U 5 354 | R 3 355 | D 2 356 | U 3 357 | L 3 358 | R 3 359 | D 5 360 | U 4 361 | D 5 362 | U 4 363 | R 1 364 | L 1 365 | U 3 366 | L 3 367 | R 4 368 | L 1 369 | U 2 370 | D 3 371 | U 5 372 | L 3 373 | R 5 374 | D 3 375 | U 4 376 | L 1 377 | U 3 378 | R 2 379 | L 2 380 | U 5 381 | D 3 382 | L 5 383 | D 1 384 | R 3 385 | L 5 386 | R 1 387 | D 2 388 | U 3 389 | D 2 390 | L 4 391 | D 4 392 | R 5 393 | L 5 394 | U 1 395 | L 5 396 | R 3 397 | L 3 398 | U 4 399 | R 3 400 | L 3 401 | R 1 402 | L 2 403 | D 1 404 | U 3 405 | L 5 406 | R 1 407 | L 5 408 | U 3 409 | R 4 410 | U 4 411 | D 3 412 | U 2 413 | L 5 414 | D 3 415 | L 3 416 | R 2 417 | D 2 418 | U 3 419 | D 3 420 | R 2 421 | D 3 422 | L 1 423 | R 1 424 | U 1 425 | L 3 426 | R 2 427 | U 3 428 | R 1 429 | D 5 430 | U 5 431 | L 5 432 | D 2 433 | U 4 434 | D 3 435 | U 3 436 | L 4 437 | D 3 438 | U 2 439 | R 1 440 | D 4 441 | L 3 442 | U 5 443 | D 2 444 | L 5 445 | R 4 446 | D 3 447 | L 4 448 | D 3 449 | R 4 450 | D 5 451 | R 2 452 | L 3 453 | D 5 454 | U 3 455 | R 4 456 | U 6 457 | L 5 458 | D 3 459 | U 4 460 | L 1 461 | U 5 462 | R 5 463 | D 3 464 | U 5 465 | D 5 466 | R 2 467 | D 2 468 | U 4 469 | D 2 470 | U 3 471 | R 6 472 | U 4 473 | L 2 474 | R 2 475 | U 3 476 | L 1 477 | U 5 478 | R 6 479 | L 1 480 | D 5 481 | R 5 482 | D 5 483 | L 2 484 | U 3 485 | L 4 486 | R 2 487 | U 3 488 | L 2 489 | U 2 490 | D 4 491 | L 4 492 | R 5 493 | L 6 494 | D 2 495 | L 4 496 | R 2 497 | D 4 498 | L 1 499 | D 6 500 | R 2 501 | U 5 502 | D 2 503 | L 6 504 | U 5 505 | L 4 506 | U 1 507 | D 3 508 | U 1 509 | L 5 510 | U 2 511 | R 6 512 | D 5 513 | U 4 514 | L 5 515 | U 1 516 | L 5 517 | U 2 518 | R 5 519 | U 2 520 | R 4 521 | D 4 522 | R 1 523 | D 6 524 | R 5 525 | L 5 526 | U 6 527 | D 2 528 | R 1 529 | L 4 530 | U 3 531 | D 6 532 | R 4 533 | L 3 534 | R 6 535 | U 2 536 | R 1 537 | U 4 538 | R 5 539 | U 1 540 | D 4 541 | U 1 542 | L 3 543 | D 2 544 | L 2 545 | D 2 546 | L 2 547 | U 6 548 | D 4 549 | L 5 550 | D 2 551 | U 1 552 | L 5 553 | D 2 554 | R 3 555 | L 2 556 | D 2 557 | U 4 558 | L 4 559 | U 6 560 | L 1 561 | R 7 562 | L 4 563 | U 1 564 | L 1 565 | U 6 566 | L 1 567 | D 2 568 | L 5 569 | R 3 570 | U 6 571 | L 6 572 | U 2 573 | D 4 574 | L 2 575 | R 6 576 | L 3 577 | D 4 578 | L 1 579 | R 6 580 | D 4 581 | U 2 582 | D 4 583 | R 2 584 | D 1 585 | U 3 586 | R 6 587 | U 4 588 | D 2 589 | L 6 590 | R 5 591 | L 3 592 | U 1 593 | L 3 594 | U 3 595 | L 7 596 | R 1 597 | L 4 598 | D 5 599 | U 6 600 | L 3 601 | U 2 602 | L 1 603 | D 2 604 | R 4 605 | D 7 606 | R 1 607 | D 5 608 | L 1 609 | D 2 610 | U 2 611 | R 1 612 | L 1 613 | U 2 614 | D 2 615 | R 4 616 | D 7 617 | L 7 618 | D 1 619 | L 4 620 | R 7 621 | U 3 622 | L 4 623 | R 3 624 | U 2 625 | R 5 626 | U 5 627 | L 5 628 | U 2 629 | L 7 630 | R 4 631 | U 2 632 | L 5 633 | R 4 634 | U 7 635 | L 7 636 | R 5 637 | L 6 638 | D 4 639 | L 1 640 | D 6 641 | L 5 642 | R 5 643 | L 7 644 | R 5 645 | D 4 646 | U 4 647 | L 5 648 | U 7 649 | D 6 650 | U 3 651 | L 5 652 | U 4 653 | D 1 654 | L 1 655 | D 7 656 | R 3 657 | D 7 658 | U 3 659 | D 7 660 | R 4 661 | U 5 662 | L 7 663 | R 4 664 | L 5 665 | R 1 666 | D 4 667 | L 3 668 | U 1 669 | R 3 670 | L 1 671 | U 4 672 | R 3 673 | L 5 674 | D 2 675 | R 2 676 | L 4 677 | D 4 678 | L 7 679 | R 7 680 | U 2 681 | D 7 682 | L 5 683 | U 3 684 | L 4 685 | U 7 686 | R 6 687 | D 3 688 | L 2 689 | R 7 690 | L 5 691 | U 6 692 | D 6 693 | L 2 694 | D 2 695 | L 5 696 | D 7 697 | U 5 698 | L 3 699 | D 4 700 | U 4 701 | L 4 702 | R 2 703 | D 8 704 | L 3 705 | R 2 706 | D 4 707 | L 4 708 | U 7 709 | R 8 710 | D 6 711 | R 7 712 | U 1 713 | R 6 714 | U 6 715 | R 4 716 | D 8 717 | L 3 718 | R 3 719 | D 2 720 | U 5 721 | D 8 722 | L 3 723 | D 5 724 | L 7 725 | R 5 726 | L 1 727 | D 4 728 | L 7 729 | U 7 730 | L 8 731 | D 7 732 | L 5 733 | U 3 734 | R 4 735 | U 3 736 | L 7 737 | R 8 738 | D 6 739 | R 2 740 | D 3 741 | R 1 742 | D 6 743 | U 8 744 | D 6 745 | L 2 746 | R 8 747 | D 4 748 | U 3 749 | D 5 750 | U 2 751 | L 3 752 | U 1 753 | R 7 754 | U 6 755 | D 5 756 | R 5 757 | U 4 758 | L 1 759 | D 3 760 | U 7 761 | L 8 762 | U 5 763 | D 5 764 | U 4 765 | D 3 766 | L 5 767 | D 5 768 | R 5 769 | D 3 770 | R 4 771 | U 4 772 | R 8 773 | L 4 774 | D 4 775 | L 2 776 | D 4 777 | R 7 778 | L 8 779 | R 7 780 | L 1 781 | D 3 782 | U 6 783 | R 5 784 | D 1 785 | U 4 786 | R 7 787 | U 1 788 | R 2 789 | L 8 790 | U 8 791 | D 2 792 | L 9 793 | U 9 794 | D 4 795 | U 8 796 | D 3 797 | R 1 798 | U 3 799 | D 1 800 | R 7 801 | L 2 802 | U 4 803 | L 4 804 | U 9 805 | L 7 806 | U 2 807 | L 4 808 | D 5 809 | R 8 810 | L 5 811 | R 4 812 | U 2 813 | L 5 814 | U 2 815 | D 1 816 | L 9 817 | R 5 818 | D 6 819 | U 3 820 | D 5 821 | U 2 822 | L 1 823 | R 7 824 | U 1 825 | L 7 826 | U 1 827 | L 5 828 | D 6 829 | R 6 830 | D 7 831 | U 6 832 | D 7 833 | L 7 834 | D 2 835 | L 6 836 | D 4 837 | U 7 838 | D 4 839 | L 8 840 | D 5 841 | R 7 842 | L 9 843 | D 9 844 | U 3 845 | D 2 846 | U 9 847 | R 4 848 | D 3 849 | U 9 850 | R 4 851 | D 6 852 | L 2 853 | D 1 854 | L 5 855 | U 2 856 | L 5 857 | D 1 858 | R 7 859 | L 9 860 | R 6 861 | D 8 862 | L 2 863 | R 5 864 | D 6 865 | L 9 866 | U 8 867 | R 2 868 | D 4 869 | R 5 870 | U 3 871 | D 4 872 | R 6 873 | D 5 874 | U 9 875 | D 6 876 | L 3 877 | D 6 878 | R 6 879 | D 5 880 | R 7 881 | U 5 882 | L 2 883 | U 2 884 | D 5 885 | U 4 886 | D 8 887 | R 6 888 | U 8 889 | D 2 890 | R 9 891 | U 6 892 | L 1 893 | U 6 894 | L 5 895 | U 10 896 | D 2 897 | U 6 898 | R 10 899 | L 7 900 | U 4 901 | R 2 902 | D 1 903 | U 3 904 | D 6 905 | L 10 906 | U 4 907 | L 5 908 | D 10 909 | R 1 910 | L 5 911 | R 5 912 | U 6 913 | R 1 914 | D 7 915 | L 7 916 | D 4 917 | L 4 918 | D 10 919 | U 1 920 | R 9 921 | L 7 922 | D 7 923 | L 6 924 | D 7 925 | U 7 926 | R 5 927 | L 6 928 | U 3 929 | L 1 930 | D 4 931 | L 1 932 | D 3 933 | U 10 934 | D 10 935 | L 3 936 | R 6 937 | U 4 938 | D 2 939 | L 4 940 | U 1 941 | R 9 942 | D 8 943 | U 7 944 | R 10 945 | U 10 946 | L 4 947 | U 1 948 | L 9 949 | R 7 950 | L 8 951 | R 10 952 | D 6 953 | U 1 954 | R 1 955 | D 10 956 | R 4 957 | L 6 958 | D 2 959 | U 9 960 | R 6 961 | L 4 962 | U 10 963 | R 10 964 | U 4 965 | D 8 966 | U 8 967 | L 9 968 | R 9 969 | D 7 970 | L 1 971 | D 6 972 | L 7 973 | U 4 974 | L 6 975 | R 9 976 | D 6 977 | L 5 978 | D 5 979 | L 5 980 | U 6 981 | R 1 982 | D 4 983 | R 6 984 | L 5 985 | U 9 986 | R 3 987 | D 3 988 | L 10 989 | D 6 990 | U 5 991 | D 6 992 | R 6 993 | D 7 994 | R 3 995 | D 2 996 | L 2 997 | D 9 998 | U 1 999 | D 1 1000 | L 1 1001 | D 3 1002 | U 3 1003 | R 4 1004 | U 1 1005 | L 9 1006 | U 9 1007 | R 4 1008 | D 10 1009 | U 2 1010 | L 4 1011 | U 3 1012 | D 1 1013 | R 10 1014 | U 7 1015 | R 5 1016 | D 6 1017 | L 2 1018 | U 5 1019 | L 5 1020 | U 5 1021 | L 4 1022 | D 8 1023 | R 7 1024 | L 5 1025 | R 6 1026 | U 4 1027 | L 7 1028 | D 4 1029 | R 9 1030 | D 7 1031 | R 7 1032 | L 2 1033 | D 8 1034 | L 9 1035 | D 2 1036 | L 7 1037 | U 10 1038 | R 3 1039 | U 5 1040 | R 3 1041 | D 9 1042 | U 9 1043 | D 11 1044 | U 6 1045 | R 3 1046 | U 11 1047 | D 11 1048 | L 11 1049 | U 6 1050 | D 10 1051 | R 9 1052 | U 11 1053 | R 6 1054 | L 4 1055 | R 5 1056 | L 11 1057 | D 9 1058 | L 10 1059 | R 4 1060 | D 11 1061 | R 2 1062 | L 6 1063 | R 3 1064 | U 4 1065 | L 10 1066 | U 6 1067 | D 9 1068 | L 5 1069 | U 3 1070 | R 2 1071 | U 5 1072 | L 7 1073 | U 1 1074 | L 10 1075 | U 9 1076 | R 3 1077 | D 5 1078 | R 9 1079 | U 6 1080 | D 9 1081 | L 6 1082 | R 10 1083 | D 10 1084 | R 8 1085 | D 7 1086 | L 3 1087 | D 4 1088 | L 6 1089 | R 2 1090 | D 11 1091 | U 5 1092 | D 7 1093 | L 1 1094 | U 11 1095 | L 11 1096 | U 3 1097 | D 2 1098 | L 9 1099 | R 8 1100 | L 11 1101 | R 2 1102 | D 9 1103 | U 3 1104 | L 9 1105 | U 6 1106 | D 2 1107 | L 10 1108 | U 8 1109 | L 5 1110 | R 3 1111 | U 3 1112 | R 1 1113 | L 7 1114 | R 10 1115 | L 2 1116 | R 7 1117 | U 5 1118 | D 12 1119 | L 11 1120 | R 2 1121 | L 10 1122 | U 2 1123 | D 3 1124 | R 3 1125 | U 6 1126 | D 1 1127 | L 8 1128 | R 4 1129 | L 5 1130 | U 10 1131 | R 12 1132 | U 9 1133 | R 12 1134 | L 12 1135 | R 6 1136 | U 11 1137 | D 1 1138 | R 9 1139 | U 2 1140 | R 11 1141 | L 1 1142 | R 12 1143 | U 10 1144 | L 9 1145 | U 12 1146 | R 10 1147 | U 12 1148 | D 12 1149 | U 2 1150 | D 11 1151 | L 12 1152 | R 9 1153 | U 3 1154 | D 4 1155 | L 6 1156 | U 3 1157 | R 10 1158 | D 2 1159 | U 11 1160 | L 4 1161 | R 11 1162 | U 11 1163 | R 1 1164 | D 10 1165 | R 6 1166 | U 8 1167 | L 3 1168 | D 6 1169 | R 1 1170 | U 9 1171 | L 3 1172 | U 5 1173 | D 4 1174 | R 12 1175 | U 11 1176 | D 2 1177 | U 10 1178 | L 4 1179 | D 9 1180 | L 4 1181 | U 10 1182 | D 1 1183 | R 1 1184 | L 5 1185 | R 2 1186 | D 12 1187 | R 5 1188 | U 3 1189 | L 11 1190 | D 10 1191 | L 11 1192 | R 7 1193 | L 10 1194 | U 6 1195 | R 12 1196 | D 3 1197 | R 10 1198 | U 1 1199 | L 2 1200 | D 1 1201 | R 1 1202 | L 12 1203 | U 4 1204 | L 3 1205 | R 6 1206 | L 3 1207 | D 6 1208 | U 7 1209 | R 10 1210 | U 6 1211 | D 6 1212 | R 5 1213 | D 10 1214 | R 10 1215 | D 8 1216 | L 10 1217 | U 11 1218 | R 9 1219 | L 4 1220 | R 8 1221 | U 1 1222 | D 3 1223 | U 7 1224 | L 3 1225 | U 10 1226 | R 12 1227 | U 10 1228 | D 10 1229 | U 9 1230 | D 7 1231 | R 4 1232 | D 2 1233 | R 9 1234 | U 13 1235 | R 6 1236 | L 4 1237 | R 9 1238 | L 11 1239 | U 6 1240 | L 12 1241 | D 9 1242 | R 13 1243 | L 2 1244 | U 7 1245 | D 10 1246 | L 13 1247 | D 4 1248 | U 6 1249 | L 8 1250 | U 13 1251 | R 3 1252 | D 2 1253 | L 3 1254 | R 1 1255 | U 1 1256 | D 7 1257 | L 5 1258 | D 6 1259 | R 1 1260 | D 3 1261 | R 5 1262 | L 1 1263 | D 3 1264 | U 11 1265 | L 1 1266 | D 13 1267 | R 5 1268 | D 2 1269 | L 8 1270 | D 10 1271 | R 1 1272 | L 2 1273 | D 2 1274 | L 12 1275 | R 11 1276 | D 13 1277 | R 7 1278 | D 12 1279 | L 2 1280 | D 5 1281 | L 9 1282 | D 8 1283 | L 3 1284 | D 2 1285 | U 4 1286 | D 8 1287 | R 7 1288 | D 8 1289 | U 8 1290 | R 2 1291 | U 10 1292 | D 7 1293 | L 9 1294 | U 1 1295 | L 10 1296 | R 4 1297 | U 1 1298 | L 5 1299 | R 5 1300 | D 10 1301 | R 2 1302 | L 6 1303 | R 4 1304 | D 10 1305 | L 7 1306 | R 11 1307 | L 11 1308 | U 7 1309 | L 1 1310 | D 5 1311 | U 4 1312 | D 6 1313 | R 4 1314 | U 6 1315 | D 7 1316 | L 2 1317 | D 1 1318 | R 11 1319 | U 11 1320 | D 12 1321 | U 4 1322 | D 13 1323 | R 3 1324 | L 4 1325 | R 3 1326 | L 8 1327 | R 4 1328 | U 7 1329 | L 2 1330 | R 8 1331 | L 13 1332 | D 6 1333 | U 11 1334 | L 12 1335 | U 1 1336 | D 3 1337 | U 7 1338 | L 4 1339 | R 5 1340 | U 7 1341 | D 1 1342 | L 9 1343 | U 2 1344 | R 4 1345 | D 9 1346 | U 8 1347 | R 2 1348 | D 9 1349 | L 8 1350 | D 13 1351 | U 13 1352 | D 1 1353 | U 9 1354 | D 5 1355 | L 1 1356 | U 12 1357 | D 2 1358 | R 9 1359 | L 7 1360 | R 1 1361 | L 3 1362 | R 2 1363 | D 12 1364 | L 11 1365 | D 4 1366 | R 11 1367 | U 5 1368 | L 13 1369 | R 2 1370 | U 12 1371 | L 9 1372 | R 10 1373 | U 3 1374 | D 10 1375 | R 8 1376 | D 12 1377 | U 6 1378 | R 7 1379 | D 11 1380 | L 10 1381 | U 14 1382 | L 9 1383 | U 12 1384 | D 4 1385 | U 3 1386 | D 10 1387 | R 6 1388 | D 5 1389 | R 1 1390 | D 10 1391 | U 13 1392 | L 9 1393 | R 7 1394 | U 14 1395 | D 10 1396 | U 7 1397 | D 13 1398 | L 14 1399 | D 14 1400 | U 6 1401 | D 14 1402 | L 8 1403 | R 2 1404 | D 7 1405 | U 14 1406 | R 6 1407 | L 14 1408 | U 14 1409 | R 6 1410 | D 7 1411 | R 7 1412 | D 3 1413 | U 10 1414 | D 10 1415 | R 7 1416 | U 11 1417 | R 3 1418 | L 2 1419 | R 12 1420 | L 13 1421 | R 3 1422 | U 4 1423 | D 1 1424 | L 7 1425 | U 9 1426 | R 9 1427 | U 9 1428 | L 11 1429 | U 7 1430 | D 6 1431 | R 7 1432 | L 3 1433 | D 5 1434 | U 14 1435 | R 8 1436 | D 7 1437 | L 6 1438 | U 6 1439 | R 11 1440 | D 9 1441 | R 6 1442 | D 5 1443 | L 5 1444 | D 1 1445 | L 10 1446 | R 8 1447 | L 15 1448 | U 1 1449 | D 14 1450 | L 1 1451 | R 5 1452 | D 5 1453 | L 3 1454 | U 6 1455 | R 6 1456 | L 4 1457 | D 3 1458 | L 3 1459 | D 4 1460 | U 7 1461 | L 10 1462 | D 8 1463 | R 13 1464 | D 9 1465 | R 15 1466 | D 6 1467 | U 10 1468 | D 14 1469 | L 10 1470 | U 12 1471 | D 13 1472 | U 8 1473 | L 13 1474 | U 11 1475 | D 13 1476 | L 8 1477 | R 12 1478 | U 12 1479 | D 14 1480 | U 15 1481 | L 1 1482 | R 14 1483 | U 15 1484 | L 14 1485 | U 4 1486 | D 2 1487 | L 2 1488 | R 6 1489 | D 15 1490 | U 2 1491 | R 5 1492 | L 7 1493 | U 8 1494 | D 12 1495 | R 2 1496 | U 2 1497 | R 11 1498 | L 3 1499 | U 15 1500 | R 15 1501 | D 1 1502 | U 9 1503 | R 5 1504 | U 1 1505 | R 15 1506 | U 7 1507 | D 8 1508 | R 6 1509 | U 7 1510 | R 1 1511 | U 5 1512 | R 15 1513 | U 9 1514 | L 6 1515 | U 10 1516 | R 10 1517 | D 2 1518 | U 14 1519 | D 13 1520 | R 11 1521 | L 14 1522 | D 6 1523 | U 6 1524 | D 6 1525 | U 10 1526 | D 1 1527 | U 10 1528 | L 11 1529 | D 13 1530 | U 2 1531 | L 14 1532 | D 9 1533 | R 14 1534 | U 9 1535 | L 8 1536 | D 11 1537 | U 3 1538 | L 5 1539 | U 8 1540 | L 1 1541 | U 12 1542 | L 6 1543 | R 5 1544 | D 8 1545 | R 5 1546 | D 9 1547 | U 14 1548 | R 13 1549 | U 6 1550 | L 9 1551 | R 7 1552 | L 5 1553 | U 9 1554 | L 8 1555 | D 9 1556 | L 3 1557 | R 4 1558 | L 8 1559 | D 1 1560 | L 4 1561 | R 6 1562 | U 8 1563 | L 5 1564 | R 12 1565 | U 7 1566 | R 5 1567 | D 8 1568 | U 6 1569 | R 11 1570 | U 1 1571 | D 9 1572 | L 7 1573 | R 10 1574 | L 4 1575 | R 1 1576 | D 11 1577 | R 1 1578 | U 16 1579 | L 6 1580 | R 7 1581 | D 3 1582 | R 4 1583 | U 13 1584 | R 12 1585 | D 1 1586 | L 5 1587 | D 2 1588 | U 4 1589 | D 11 1590 | L 13 1591 | D 4 1592 | U 2 1593 | D 14 1594 | L 3 1595 | U 1 1596 | D 13 1597 | R 14 1598 | U 6 1599 | R 8 1600 | L 16 1601 | U 9 1602 | D 7 1603 | U 15 1604 | D 15 1605 | L 11 1606 | R 15 1607 | L 4 1608 | D 5 1609 | U 3 1610 | L 3 1611 | D 8 1612 | L 6 1613 | U 15 1614 | L 11 1615 | R 14 1616 | D 8 1617 | U 10 1618 | D 6 1619 | R 1 1620 | L 16 1621 | D 16 1622 | L 3 1623 | U 10 1624 | R 5 1625 | L 16 1626 | R 2 1627 | U 15 1628 | R 10 1629 | U 11 1630 | R 15 1631 | D 16 1632 | L 3 1633 | U 15 1634 | L 10 1635 | R 12 1636 | U 13 1637 | R 3 1638 | L 13 1639 | D 15 1640 | U 4 1641 | R 8 1642 | U 6 1643 | L 10 1644 | R 12 1645 | U 1 1646 | L 15 1647 | D 5 1648 | L 1 1649 | U 9 1650 | D 1 1651 | R 16 1652 | L 7 1653 | U 13 1654 | L 13 1655 | U 6 1656 | L 1 1657 | R 14 1658 | L 11 1659 | U 16 1660 | R 15 1661 | L 10 1662 | D 9 1663 | R 9 1664 | D 6 1665 | U 16 1666 | R 4 1667 | U 1 1668 | L 3 1669 | R 16 1670 | L 3 1671 | U 6 1672 | D 15 1673 | R 13 1674 | D 11 1675 | U 15 1676 | R 3 1677 | L 15 1678 | D 14 1679 | U 10 1680 | R 7 1681 | U 4 1682 | R 13 1683 | L 11 1684 | R 13 1685 | L 11 1686 | R 3 1687 | L 5 1688 | U 12 1689 | L 9 1690 | U 8 1691 | D 2 1692 | U 17 1693 | D 3 1694 | R 17 1695 | U 14 1696 | L 9 1697 | R 10 1698 | D 6 1699 | L 5 1700 | R 14 1701 | L 8 1702 | U 2 1703 | D 16 1704 | R 15 1705 | D 12 1706 | U 3 1707 | L 4 1708 | R 12 1709 | U 16 1710 | D 14 1711 | L 12 1712 | R 8 1713 | D 4 1714 | R 9 1715 | U 12 1716 | R 15 1717 | U 6 1718 | L 3 1719 | D 17 1720 | R 3 1721 | U 6 1722 | L 2 1723 | R 2 1724 | U 2 1725 | D 17 1726 | L 4 1727 | R 8 1728 | U 17 1729 | R 16 1730 | L 17 1731 | U 5 1732 | D 11 1733 | U 8 1734 | L 7 1735 | U 3 1736 | R 1 1737 | D 15 1738 | U 14 1739 | L 4 1740 | D 9 1741 | U 15 1742 | R 13 1743 | L 2 1744 | U 4 1745 | R 17 1746 | U 2 1747 | L 13 1748 | R 4 1749 | U 8 1750 | R 15 1751 | U 8 1752 | D 13 1753 | U 10 1754 | D 7 1755 | U 7 1756 | D 17 1757 | R 16 1758 | L 10 1759 | U 10 1760 | L 8 1761 | R 9 1762 | L 8 1763 | R 1 1764 | D 10 1765 | U 17 1766 | D 13 1767 | U 10 1768 | D 13 1769 | L 14 1770 | R 17 1771 | D 5 1772 | L 1 1773 | U 17 1774 | D 17 1775 | L 13 1776 | U 12 1777 | R 10 1778 | D 12 1779 | R 15 1780 | L 15 1781 | U 11 1782 | L 14 1783 | D 15 1784 | U 12 1785 | D 7 1786 | U 15 1787 | L 1 1788 | U 2 1789 | R 18 1790 | L 15 1791 | U 7 1792 | L 8 1793 | R 3 1794 | D 14 1795 | R 7 1796 | D 7 1797 | U 6 1798 | R 10 1799 | L 9 1800 | R 9 1801 | D 17 1802 | R 11 1803 | D 4 1804 | L 16 1805 | U 12 1806 | R 10 1807 | L 4 1808 | D 7 1809 | U 18 1810 | L 11 1811 | U 3 1812 | L 13 1813 | U 5 1814 | R 11 1815 | D 16 1816 | U 14 1817 | D 1 1818 | R 18 1819 | D 4 1820 | L 7 1821 | U 2 1822 | D 9 1823 | L 5 1824 | R 14 1825 | U 18 1826 | R 2 1827 | U 7 1828 | R 8 1829 | U 9 1830 | L 6 1831 | R 12 1832 | U 15 1833 | R 1 1834 | L 7 1835 | D 3 1836 | U 10 1837 | R 5 1838 | U 2 1839 | L 8 1840 | R 13 1841 | L 14 1842 | D 10 1843 | L 10 1844 | U 12 1845 | R 5 1846 | L 13 1847 | D 8 1848 | U 5 1849 | D 17 1850 | L 8 1851 | D 8 1852 | L 7 1853 | U 5 1854 | D 16 1855 | R 9 1856 | D 6 1857 | U 11 1858 | D 16 1859 | U 15 1860 | D 6 1861 | L 4 1862 | R 16 1863 | D 8 1864 | L 11 1865 | U 13 1866 | R 14 1867 | L 12 1868 | D 2 1869 | U 16 1870 | D 1 1871 | L 12 1872 | D 10 1873 | R 1 1874 | D 17 1875 | L 8 1876 | U 13 1877 | R 10 1878 | U 9 1879 | D 4 1880 | R 1 1881 | U 17 1882 | L 5 1883 | D 15 1884 | U 9 1885 | R 15 1886 | U 18 1887 | L 15 1888 | D 18 1889 | U 15 1890 | D 1 1891 | L 9 1892 | R 6 1893 | L 15 1894 | R 3 1895 | D 19 1896 | L 5 1897 | D 10 1898 | L 18 1899 | D 11 1900 | L 14 1901 | D 11 1902 | U 19 1903 | D 5 1904 | R 9 1905 | L 18 1906 | R 11 1907 | D 3 1908 | L 7 1909 | R 4 1910 | D 13 1911 | L 9 1912 | R 14 1913 | D 14 1914 | L 8 1915 | U 10 1916 | L 11 1917 | U 4 1918 | D 13 1919 | R 13 1920 | L 7 1921 | R 7 1922 | D 18 1923 | U 2 1924 | L 17 1925 | D 16 1926 | R 3 1927 | U 12 1928 | L 13 1929 | U 5 1930 | L 1 1931 | U 9 1932 | R 6 1933 | D 14 1934 | U 6 1935 | R 3 1936 | U 6 1937 | R 7 1938 | D 8 1939 | U 11 1940 | L 11 1941 | R 7 1942 | U 17 1943 | D 2 1944 | L 12 1945 | U 18 1946 | L 3 1947 | U 14 1948 | L 6 1949 | R 10 1950 | L 16 1951 | U 19 1952 | D 9 1953 | R 13 1954 | U 5 1955 | R 5 1956 | D 15 1957 | R 1 1958 | L 1 1959 | U 5 1960 | D 16 1961 | L 5 1962 | R 15 1963 | L 14 1964 | D 5 1965 | R 9 1966 | U 12 1967 | L 9 1968 | U 7 1969 | R 16 1970 | D 16 1971 | R 10 1972 | D 15 1973 | R 16 1974 | L 2 1975 | U 13 1976 | L 5 1977 | D 19 1978 | R 18 1979 | D 19 1980 | R 16 1981 | D 12 1982 | R 15 1983 | D 12 1984 | U 5 1985 | L 3 1986 | R 14 1987 | D 7 1988 | U 11 1989 | R 10 1990 | L 18 1991 | D 9 1992 | U 2 1993 | D 19 1994 | U 8 1995 | D 19 1996 | U 18 1997 | R 11 1998 | D 2 1999 | R 8 2000 | D 14 -------------------------------------------------------------------------------- /day13-distress-signal/input: -------------------------------------------------------------------------------- 1 | [[[[],[0,2,4]],7,5,0]] 2 | [[[],8,[4,2,0,[7,9,9]]],[[[]],[[2,0,6,4,7],[5]],[[10,5],[5,7,7]],9],[7,5,[10,7,7,[9,7]],[[]],[[1],10,9,[9,1],[5,1]]],[[[],[9,10],7],3],[]] 3 | 4 | [[1,[[4,6,1,8,3]]]] 5 | [[9,[[],10,[6,5,4,1,5],1],[3],[7,3,7,10,0],[[9,6],[1],0,[]]],[0,2,2],[[[2,7,4,7,6]]],[],[[[4,10,1],4,7,[],[4,6]]]] 6 | 7 | [[[7,[10,8],1,2],[[8,6,8,0,5],1,[4,5]],1,4,4],[0,[],[],[],[8,2,[],[4],[10,8]]]] 8 | [[3,7,[2,0,[9,2,1,10,8],0],[3,9,[9,3],[1],[2,5,5,6,10]]],[[[10,1,8,8],[1,2,8,3,6]]],[]] 9 | 10 | [[[]],[0,[0,[4,3]],4,[10]],[3,9,9]] 11 | [[[9,[1,5,0],[10]],[[9,1],[9,7,3,4,5],[],[0,0,3,1,2],2],6],[[[5,7,0,4,0],[9],[],[4,1,0],4],6],[]] 12 | 13 | [[7,8,6,10],[8,[]]] 14 | [[7,[8],10],[5,4,[]]] 15 | 16 | [[6,1,[]],[1,0,10,[0]]] 17 | [[[[3,9,5],[4,0,3],[1,2,0],0],9],[[],[[0,0,5]]],[2,[[6,3,4],[10,9]],3,4,8],[]] 18 | 19 | [[[[5,2]],[10,10,[0,6,6],4],[[],4,[4,7,7,10]],2,[[2,1,4,8],[],[7,4,2],[7,0,8]]]] 20 | [[[9,0,6],[0],9,[[],5],[3,10,0,[0,5]]],[[],[[1],[],[3,8]],8]] 21 | 22 | [[],[[9,0,4],10,2,6,[[6,10]]]] 23 | [[[0,[],10,2],[[],[],[7,7,3,6],[9,2,6,7],[9,9,4,2,8]],[[]],[[3],[4,0,1],4,10,1],[[7,9],4,[7,0]]],[[[2,3,3],[4,2,4],[4,5,5,6,4],[6,5,8,3,8]],[5,8],[],9,1]] 24 | 25 | [[]] 26 | [[6,6,6,[[0,1,7,10],8,9]],[],[[[8],[],[],2],4,6,5]] 27 | 28 | [[],[1,[7]]] 29 | [[2,4,6,[[4]],0]] 30 | 31 | [[[1,[],0],[]],[8,[[3,5,3],[0,10,1],[7,7,10],1],[],[[8,4,10],[7,2,4],3,3]],[8,9,3],[5,0,3,6],[0,[[0,0,4,3,2],6,5,[]]]] 32 | [[1,5,[9,5,[4,0,6,3]]],[[10,[4,3,6],1,[6],[1,1,8]],7,[[]],[[10,1,2,4,5],[4,2],[2]]],[[[6,2,9,9,0],7],10,[]],[],[10,[[7,5,7],[5,6,7,4,6],[10,1],[7],[2,2,2,9]]]] 33 | 34 | [[[],[[2,10,7,2,0],9,8],3,[[]],[9]],[4,[0,10,4,2]]] 35 | [[[[9],8,[6,0],[7,8]],[10,0,6,0],[6],[4,0,[5,8,6]]],[],[],[[[8,10],[6],[10,6]],2,[5,2,4,[1],[7,2,2,6]],[1,1,[2],0],[0,[],0,[6],[]]],[8,[[],[2,2,2,6],[],[9,4,10,5,8]],8,2]] 36 | 37 | [[2,[[0],9],[]]] 38 | [[[[10,5,3,9],6,[10,4,10,3],3,[0,1,4,2]],5,[9,0],3,[9]],[5,10,6,5]] 39 | 40 | [[1,[0,6,[],3,[6]],1],[1,[[0],8,1,[1,1,4],[5,1,0]]],[[[],7,[5,6,2,0],[1,8,10,9,0]]],[8,[5,3,0],[4,[0,2],[10,10,9,8],[0,9]],0]] 41 | [[9,3,[[9],[0,1,8],[1,8,6,8],[8,7,2,6]],[6]],[[2,5,3,[3,3,9,6]],[[7,3,10],[2],[],4],5],[[[5,9,2,10],[7,0,7,3],2,[6]],9,4,[[2,10,2,1,0],4,9,[6],[3,0,6,5]],[8]]] 42 | 43 | [[10,3,[2,5,9],7,8],[[0,[]]],[[3]],[1,6,[],3,[1,1,6,[1]]],[5]] 44 | [[8,[],[[0,7,8,2],1,[]],[],[3,[6],[3,6,6,4,7],[2,3,5,9,0],[6,3,8,1]]],[[10,8,3,3,[2,4,3]],[[5,8,0],10]]] 45 | 46 | [[10,[[]],2,[[6]],1],[[],3,8,7],[4],[8,[[8,9,6],[]],[[0],7,[3,7,7,0,6],[4,4,3],[7,1,3,2,2]],[10,6,10],1]] 47 | [[],[8,[[7],[8,3,5]],[],[7]],[10,[[10,7],[]],[[],[1,0],[0],9]]] 48 | 49 | [[[[0,8],2],[2,[],[7,3],9,3],8,[2,2,[5,8],4,[9,1]]],[],[],[[2,8],9,[0,7,[3,0,5],1,4],8]] 50 | [[5,[],1,8],[[7,1,[8,10,7,8]],3,[8,7,4],[10,10,2,6]]] 51 | 52 | [[10,9,[2],[10],9],[4,4,5,3,[[3,7]]],[8,8]] 53 | [[2,[]],[],[[[7],9,5]]] 54 | 55 | [[4,[[1,3,0,6],[7],6],2,[[10,10,10,9,5]]],[7,8,[],0,8]] 56 | [[[]],[[3,[0,9],2,[2,8],[7,3,5]]],[8,[2,[],[7,1,4],1,[2,7,1,7,2]]],[10,[],5]] 57 | 58 | [[[7,[10,5],8],[5],3],[[[],[7,0,9,1],[6,7,7,6,2],2,8],5],[],[],[[10,[6,0,3,4,0],[1,7],7,[10,4,7,4,8]],4,3,[]]] 59 | [[],[7,1,4,6,[[6,3,8,5,6]]]] 60 | 61 | [[[2,7,[],[2,8,9],[0]],[0,[],[]],[1,3,[3,7,5,9],[6,9]],[[4],[0,9]]],[4,3,[4,[10,6,10,3],[9,2,0]]]] 62 | [[],[[],[6,[1,7,4],5,[0,9,6,6,3],4],4,8,[6,10]],[2,[[],[],0,[],[5,5,3,4]],[[9,6,10,10,9],[6,7,1,8,6],[7,1,2,4]],3,2]] 63 | 64 | [[[],7,[[],6,[5,2]],7],[],[],[]] 65 | [[],[[[4],9,[1],9,0],6,7,10],[9,7,[8,[10,5,1,5,1],[10,6,0,6,10]]],[[[3],[7,9],[9,10,6,5],[3,5,3],9],[[6,2,2,2],8,4,[7]],[[2],1,9],[[8,3],1],[[0,9,0],[8,6,2],[10]]]] 66 | 67 | [[[[3,0,8,8],1],8,9],[5,10,10,[],[7,[9]]],[[[0,9,0,1]],4,[[7,6,4,7],2,2,0],[4,[0,0]]],[[2]],[1]] 68 | [[1,8,3]] 69 | 70 | [[[[]],[[0,4],8,3,1,[4,8,1,6]],[[4],4,0],[[]]]] 71 | [[9,[[10,0,1,7,4],6],7,1],[5,9],[6,0,1,[[5,10]]],[1]] 72 | 73 | [[[],5,[[0],1]],[[3,[8,8,3,7,4]],8,0],[8,[[0,5,2],4],1,[3,9,[7,0,10]]],[0],[[[6],[8,5,7,9]],[[10,8,3,8],[10,8,7,4]]]] 74 | [[[[2,3,4,8],[]],[8,[7],[0,1,3],[10,4,0,9]],7,3],[3,9,[]]] 75 | 76 | [[],[9,2,5,[],0]] 77 | [[7,[],9],[]] 78 | 79 | [[[],[[0],[7,5,5,3],[],9,8],[[3],[10,9,3],1]],[[3]],[[8,3,[7,2,10,5]],6,4,1,10],[1,[[6],[],[10,5,3]],1]] 80 | [[1,[[9,1,1,5],7],7,[],[3,8,[6,3,9,9]]]] 81 | 82 | [[[[9,9,3,5,3],6]],[2,[4,[8,1,5,7]],4],[7],[[8]],[1]] 83 | [[[[3,3,0,0],[8],8,5,0]],[4,2],[8,[[5,1,3,2,9],[1,10,9,8],[9,7]],[[9,10],5],[[],[10,0,3,4]]],[[9,[1,7],8,[5,0,2,1,8]],[2,[7,6]]]] 84 | 85 | [[9,2,1,9,[[4,10,8,1],[0,8,5],[5]]],[],[[[1,0,8,8,0],10,5,[]],6,8],[[2,7,[7,0,9,4,7],3]]] 86 | [[4,[[8,7,9],5,2],[7,3,[6,5,5],6],6],[[[10,2]],9,[[],4],9,9],[[[3,4],7,10,[1,3],10],8,9,6,[[7,4,3],[3,6]]],[6,[7,0,[7,4],[]],9,1]] 87 | 88 | [[],[[[7,3,3,5],5,9],[10,[2],[],1]],[6,[0]],[[[8,10,6,9],3],1],[5,3]] 89 | [[1,[[2,7,0],[4,10,9,7]],[[3,7,9]],6],[10,3,6,3]] 90 | 91 | [[[3],[4],[8,[],10]]] 92 | [[[[7,0,8,6,2]],[9,[8,6],6,5,[9]],6],[5,[[4,2],4,[],[2]],[[5,3,0,2,9],4,[10,7,8]],7,10],[],[10,9],[[10,[4],0],[]]] 93 | 94 | [[[],[7,[5,0,8,0,0],6,[2,10,2,4]],0,[6],[[10,10,9]]],[[[9,1,3,1],10],[[4,6]],[[0],[5,1,5,6],[3],[5],[9]]],[[8,0,[7,4]],10],[6,0,[5,[],[5,4,5]]],[[9],1,5]] 95 | [[[[],2],[0,3]],[[6,[6,1,2,3,2]],0,3,[6]],[[9,[10],8,[3,7,10,8]],[],10,5,8],[],[[0,[8]],5,[[],[0,0,1],3],[[5,4,8,10,6],[6,1,4,0],[0],[2,1,8,4,10]]]] 96 | 97 | [[6],[[[2,7,7],[],[1,3,4]],2,6],[[0,[6,3,5,7],[10]],[5,[3,3,10,6,2],8,[0,2,3]]],[[6,10,[2,7]],[5,2,3,0],[[5,2,2],[5,7,5]],[]],[6]] 98 | [[9,[[4,10,1,3],[7],[7],7],[8],[[8,2,2],6,2,[],[6,5]],[2,[3,2],[2,3],[],3]],[2],[[[2,3,0,2,8],5],[5]],[0]] 99 | 100 | [[],[[[8,5]],[8,[],5,[6,6,10,0,9]],0,3,1],[]] 101 | [[9,4],[],[7,6,[7,3],[[4,7,4,8],[7,9],5]],[],[]] 102 | 103 | [[1,1,7],[],[[[1,5,10,2,5],[8,8,3],[9,8,0,10],[4],4],9]] 104 | [[1],[],[9,[1,2,10,4],3],[10,9,10,[3,[1,5,6],9]],[5,6]] 105 | 106 | [[[[4,7],[6],1,[1,7]],7,0],[[[3,1,8,9],3,1,[10]],8],[5,6,5,[7],0],[[0],[10],[[1,6,6,10,6]],[[7,3],2]],[[]]] 107 | [[10,8,[8,[2,2,1,6,3],2],[[9,4,5,10]],[[2,5,10,6],6,0,6]],[[[1,8,1],[9,5,6],2],[[5,8,2,5]],2],[[1],9,[[8,0,7],4],1,8]] 108 | 109 | [[5,[1,8,7],9,1]] 110 | [[],[[4,6,[7,9],0,4],[9,9,[9,0,2,2]],8,5]] 111 | 112 | [[7,[3,0,[2]],6,4,10]] 113 | [[],[[0,[6,9],5,0]],[],[[[5,4,4],[],[],4],[[1,5,9,6,7],3,[2,3,9,1,5],3]]] 114 | 115 | [[],[2,6,[8,[7]],2],[3,0]] 116 | [[[[],5],3,[],[[10,5,4,2,5],[10]],6],[10,0,[],[[9,3]],3],[[[4,6,0],4,[]],[[9,7,9,7],[9,4,3,4,7],[8]]],[6,0,5,[[4,0,2],7,8,[],3]],[]] 117 | 118 | [[7,[8,3,[],[10,6,4]]]] 119 | [[[[0,6],9],8,6],[10,6,[7,[9]],5,[[1,1,2]]],[4,[[1,5,2,3,0]],[0],[6,[2,2,7,9],2,3,7],4]] 120 | 121 | [[6,2,4],[7,[[]]],[4,[[],[1,4,2,0],[0,5,0,2]],8],[],[0,[[5,5,4,2]],1,[7,3,2,[],5],[7,[8],1,8,[3]]]] 122 | [[[[7,3,1,1,6],[4,1,0,0],2,0,[8,6,2,1,9]],8,5,3,[9,4,9]],[[0,[10],[2,9,3],5],[7,[3,7,7,10,0]],0,10],[[8,[9]],9,[10,6,2],[1]],[]] 123 | 124 | [[8,10,10,[5,[2,2,1,2],[],[3,10]]]] 125 | [[8],[1,[[7]],4],[3],[[7,[4,1,10,3,5]],2],[0,[1],7]] 126 | 127 | [[8,0],[2,[[1,9,10,7,9],7,[2,3],[5,5,5]],1]] 128 | [[[10,10,10],4,3,8],[1,[],[5,6,3,[7,10]],9,[[2,6,4,1,1],[2,10,5,10],[4,9],[6,2]]]] 129 | 130 | [[[3],8,3,[[7],7,2],0],[7]] 131 | [[[[3],7,[1,3,5,1],[1,1],[4,3,3,4]],1,[],7,[[1,9,10],[],[4]]],[1,[[6],[]],[[],[0]],4],[[],[]],[3,[[],4,1],9]] 132 | 133 | [[],[]] 134 | [[8,2,[[9,2,8],[9,5,0,0,7],7,7]]] 135 | 136 | [[[0,[6]],[[9],[9],10,9,[]],[2,[9],9,[],10],8,4],[],[],[]] 137 | [[4,[]]] 138 | 139 | [[[],[]],[3,9],[2],[2,2,7]] 140 | [[[7,8,[7],7,[3,8,5]],[]],[[[],[6,10,7,8]]],[[2],8]] 141 | 142 | [[[[6]],[1,[1,8,4],1],[[3,2,8,5,0],10],3,[[10],1,[10,8,5,0],7,[2,10,5]]],[9],[[1,2,[7,4,7,4,5],7,[1,8,1,6,5]],[[4,10,1],[1,1,0],[6],4]],[6],[8,[10],5]] 143 | [[0],[4,7,[[2,5,4],[],[3,3,8,5,8],7,[9,1,4]]],[4,[[],[9,4],6],5],[[],[[8],3,2,[5,3]]]] 144 | 145 | [[3,8,8]] 146 | [[4,[3],[10]],[5,[2,[7,5,10,2],10]],[8,[4],[]],[[9]]] 147 | 148 | [[[[3,0,2],[7,8]],[[],10,3],[9,[8],[1]]]] 149 | [[4,[[],4],2],[5,4],[1],[[7,[8,3,0,6,6]],[[6]],4,[9,1,10,[],7],6]] 150 | 151 | [[[9,[8],[10,2]],[5,[0],2]]] 152 | [[[[9,10,1,8,8],10,0,[8,9,7,9]],[[10,1],2]],[0,[[7,8],1,[]],[[5,8],[5,8,8,9],[4,2,9,4,8],9,[]]],[[1,5,[2,4,5,5,10],[10,3,3,8]]]] 153 | 154 | [[[],10,[[6,9,7,2,1],9,0]],[[6,[4,2]],[]],[]] 155 | [[[[2,2,10,1]],7,[[0],8,10],[[1,4,0,10,2],[4,0,8],0],[1]],[8,3,[[1,4,1,6]],[7,1,[4]],8],[7],[[1,[],10,[8,8,6,0,1],[]],9,3],[[1,[2,5,7,5]]]] 156 | 157 | [[[2,[4,5]]],[],[[[4,3,7],[8,0,5],10,4]],[4],[[[7,1],9,3,[6,5,1,1,9],6],5,6,[3],[4,7,1]]] 158 | [[[3,3],[[8,2,3],1,[3,5,10,7,0],9,[6]],[4,2]],[2,2,[9,[1,1],[7,8,2,2],[3,9,10]],4]] 159 | 160 | [[[[6,2,1,2],9,5,[8,2],[2,2,0,3,7]],[[],2,[4],10]],[],[8,8,[2,6,4,[1,3]],[6,[10,8,10],6,[2,9,4]]]] 161 | [[[],4,0,0],[[5,[6,6,7],5,9,[0,1,9,3]],[]],[],[],[[[2],[10,3,10,4],7,[8,10,2,10,9],[1,7]],2,[8]]] 162 | 163 | [[4],[3,[[3,0],1,[3],[]]]] 164 | [[3,10,4,10],[[[],5,[],[8,7,6]],4,[[3]],[[6],9,6],[[5,8,7,8],3,[4]]],[5,[],4,[8],[3,[3,10,7,5,7],2,[]]],[[[10,7],5,10,10,[]],[]],[[1,8,0,0,4],9]] 165 | 166 | [[[7,2],7,2]] 167 | [[9,9],[5,[[9,1]],[[],[5,7,4],9,[3,3,9,3]],9]] 168 | 169 | [[],[[[9,1],1,9,2],9,[],10,[[7],[4,0,9,6,7]]],[[[],3,[0],10],[[4,0,8,9,4],[5,7,9,0]],[[5],[0,10,6],[5]],[[0],[3,1],[],[0,9,8,1]],[[],[7],[0]]]] 170 | [[4,[[8],2,[8,0]],8,[9],[[7,0,0,4,0],[1,1,6],4]]] 171 | 172 | [[[0,[3,1,0],5]],[5,0,[1,[8,6,7]],[[7,8,5,7,4],[8,5,6,1],0,[8,7],[1,10,8]],[2,[2,6,2,6],6,4,3]]] 173 | [[],[[[2],[5,2,5],7],[3,[],[0],2,[3]],[[9,8,3],[],1,[0,7,1,4,6],3],[4,[0,10],[6,7,9,7,10],[9,8,0,3,9]]]] 174 | 175 | [[[[8,10,4,2,2],5,[4,9,4,2],1],[[2],[3,6,1]],2,[0,1]]] 176 | [[8,[[10,7,10,1,1]]],[],[],[4,8,10,[0],[]],[[[6,5],[5,5,4,6,2],[9]],10,6,[[3,7],9,[3,1,6,4],[2,4]]]] 177 | 178 | [[[[4,0,9,8,0],9,[4,10],[8,8],[1]],[[]],[9,[0,1],[]]],[]] 179 | [[[],9,5,8,0]] 180 | 181 | [[5,5],[0,[3,4,[6,7,6]]]] 182 | [[],[],[[6,[],9],[[3,2,7,1,10],[10,3,5,2,7],2],[]],[[[6,0,5,2,7],[9,9]],0,8,[[0],[],[6,6,8],1],5],[[7,[5,8,8],[5,7,3],10,[1]],2]] 183 | 184 | [[2,[7,[9],5],[]],[[[3,8],[5,10,3,8,1]],[6,0,0],1,10],[],[4,7,3,5]] 185 | [[],[6,6,8,8],[1,[[],1,1,0,[4,5,2]],0,4,[]],[9,5,1,[8,3,[3,1,5,3,8],[2,6]],10]] 186 | 187 | [[4,0],[],[6,1,6,8],[[6]],[[10,[],[6],7,[]],9]] 188 | [[[3]],[[[],7,0,[4]],0],[[]],[]] 189 | 190 | [[9,6,5]] 191 | [[1,8,3,2,[5,[10,1,3,3],[3,7]]],[0,[[6,4,6,9],8,2],[],[1,[1,4,8,7,10]]],[[[6,2,2],[5,8,3,0,10],[],8],7,7,[8,2]],[[8],[],[],[[]]],[[[3,10,2,4,2],5,10,[1,4,10,9]],1]] 192 | 193 | [[9,[3,2],[]],[],[[],8],[[[6,2],4,9,4],5]] 194 | [[[[3,3,7,8,1],[]]],[4,2],[]] 195 | 196 | [[5,[[3,5,6,2,7],10,0,[2,3,1]]],[6,3,[[7,2,0],[],[],8,0],[[2,5,0,0],[1,8,8,9,7],[0],[],0]],[],[10,[[0,2,0,6,3],2,[],8,7],[[4],[4],[5,2]]]] 197 | [[[[0,10,6,5],[],[1,7,7,4,6],[2,2,10],[10,4,0]]]] 198 | 199 | [[],[[[],4,[9],[3,2]],[1,[0,0,6,4,2]],10],[[1],0,[9,9,[9,2,8,10,5]]],[]] 200 | [[[[2,6,3],[9,0,10],0,[9,5]],0,5,2,[0,5]]] 201 | 202 | [[],[[[5,3,9],[1,4,2,8,5],7],8],[[[6],9,5],3,[],2,3],[0,4],[7,2]] 203 | [[[7,9,[0,2,2,5,9]],6,5,[8,[5,7,7]],10],[9,5],[8,4,6,5,[2]],[[[2,10,0],6,9,[]],3,[6,[1,4,4,5,4],[2,8],[],0],[0,3,7,10,[3,3,1,3,9]],7]] 204 | 205 | [[8,10,[[5,9,3,3],5,[8,10,8,9]],4,6],[],[],[[[4,4],7,[4,9,3,10]]],[]] 206 | [[[[10,5,6,5],1,6,4,10],10,8,[8,1],5]] 207 | 208 | [[],[[],6,0,[]]] 209 | [[2,[[3,4,6,2,2],[],6],7],[7],[],[[[],[3,8,3,1,7],[3]],8,10,9]] 210 | 211 | [[],[1,[[1,2,8,4],6,1,[9,1]],[[6,0,5]],[[8,6,3],3,6,[8,0,9,5],7]],[[],9]] 212 | [[3,[[1,3,0],0,[0],3,[1,1,6,10]],[],[1,7,[2,1,8,1]],1]] 213 | 214 | [[6,2,3],[5,5,[[7,4,2,10,7],0,6,[3,2,9,3,0]]],[[9,[8,9,5],[8,2,0,0],7,[]]],[[[],4]]] 215 | [[],[[9,2,[0,2,9],10,[]],10,[3,9],4],[0],[9,1,[[3,7,6,10,7],[7,7,5],[4,3],10]],[[[5,3,0,2],10,[]],[[3],10],2,9]] 216 | 217 | [[2,[4,[10],3,[],5],6,[[5,4,1,5],[4,0,7],[5]]],[[[8,9,3,6,5],[1,6],[9,0,7],1]],[2,[7,8,[0,10,6,0,0]],[8,[],[1,10],7,[]]],[9],[5,0]] 218 | [[3,[7,4,10,9,[7,10,2]]],[[[0,8,4],[10],2,[1,5,9,10,8],4]],[[4,5,[4,10],[2,7,0,0]]]] 219 | 220 | [[[[],5,[5,7]]]] 221 | [[[[5,3,3,10,4],[10],6,6,4],[5,[2]]]] 222 | 223 | [[[[0,0,6],3,[6]]],[],[8,8,[[],[8,3],1,[5,0,2,4]],[1,9],[10,[],[6]]],[3,6]] 224 | [[],[[7,10,2,1,2],[[8,5,5],[],[],[10,7,6]],8,2],[4,6,[[]]]] 225 | 226 | [[2,10,8,10],[9],[[[6],[2,2,2,10,4],4]],[[[3,2]],3,1,[6,3,[10,6,7],10,8],[10,[8,9,2,9]]],[[5],[4,[7,5,6,3],2],[5,8,1,[],[1,1]]]] 227 | [[9,6,[[8,6,4,6,2]],[[0,6,10],[]]]] 228 | 229 | [[[[10,0,6,1,2],[7,8,2,0,0]],3,5,[[10,9],[8]],1],[9,[[6,6],10,3,2]],[0],[2,[1,3],9,7,[[0],[1,4,4],4]]] 230 | [[[[8,6,5,2],[1,6,3,1]],2,[9,6]],[],[[6,5,6,1,[10,1,7,4]],9,0,4,[[6,8],0,9,9,[6,6,9]]]] 231 | 232 | [[1,[[],[3,4,5],5,[],[0,1,4,8]],[[0,5,3],[5,7,8,7,0],5],6,7],[2,9,[[0],[10,9,8,2]],10,4],[]] 233 | [[],[[],[6,[2,6,8,0,2],2]],[[[3],[],[10,8,1,0,10],5],[3,[0,0,5],6,[9,8],[5]]]] 234 | 235 | [[2,0,9],[5,2]] 236 | [[[7,[7,7,3]],4,[],1],[0,[[6,4],8,[9,6,0],[2]],3,[1,[5,9],9,[]]],[[[5,7],8],[[6,6,5],[],9],2],[[],1]] 237 | 238 | [[[8,[9]],[1,8,[5,0,1,4]]]] 239 | [[[],[6,[9,3,1,9],[4,0,8],8,9],[[9,4,7,4,9],[],3,[0,8,10,2,7]]],[3]] 240 | 241 | [[3,[2],[9,[8,4,5,7],0,10],[],[[9],2]],[0,0,[[0]]],[0,9,7,[],[[0],0,[4]]],[[5,[3,8,6,1,7],[3,0]]],[[[4],[]]]] 242 | [[2,[1],9],[],[6,4,[9,9,0],3,[]],[[[4],7],2,[[7,8,5],4,[6,4,4,2],8,[10,3,7,1,6]],2,[5]]] 243 | 244 | [[[[3],[6,3],7],[7],[[7],[6,3,6,1],[7,3],[7,4,4]]],[10,10,2,[0,4,[3,1,8,10],0],[[9,4],[8,4,9,10,8],6,[],8]],[3,[0]]] 245 | [[[],10,6,6,3]] 246 | 247 | [[[1,9,[5,3]],6],[[[7,0,3,3,6],4,4,7,[7]],3,6,3]] 248 | [[[[4,4,7],0,7,[10,4,3]],[3,[6,10,5,9,8],[],3],6,0],[[2],9],[[[8,1,0],[1],9,[4]]]] 249 | 250 | [[],[[[4],[5,3,8,5,8]],2],[9,6,10],[[[],0,2,[9,0,7,2]],[9,8],[],10,5],[5,[3]]] 251 | [[],[[[1,9,10],0]]] 252 | 253 | [[7],[],[1],[10,2,9,[]]] 254 | [[10,2,[[9],1]],[0,[[0,10,10],0],2,3],[9,3],[5,2,[[1,3,7,2,2]]]] 255 | 256 | [[[7,8,7]],[4,9,7],[2,[[6,8,2],2,3],3],[]] 257 | [[6,[]],[[[2],[0,2,3,0],1,4,8]],[[9,4,[1,1],10],[6,7],9]] 258 | 259 | [[1,10,[[5],2,[3]],[[1],4]],[[3,[5,1],[4]],[7,2,[10,7,0],[2,2,9,7],[6,6]],3,10,[9,[5,8],6]],[],[[4,7,10,7],4,9,[0,[7,4,7,1],5,1,1],10],[1,10,0]] 260 | [] 261 | 262 | [[6,1],[],[[8,10],[],5,5]] 263 | [[],[[[4,9,6,0],[3,6,8]],4,10],[[],1,[10,4,[3,10],3,[5]],9,8],[[],10,[[9,1]],9],[4]] 264 | 265 | [[[],2,1,[8,9],[1,4,0,[2,5],[]]],[4,[2,5,[4,4,2,9,8]]],[4,7,6],[[[9,9,8],7],4],[[10,[4,4,4],[10,10,9,8],5,3]]] 266 | [[],[0,[[7,6,2,3,3],5],2,[],[[]]],[[2,6],[1,4],[5,8,9,4,[5,1,9,4]]],[]] 267 | 268 | [[[],[[0,8],0,[3,7],[0,4]],5,3],[1,5,7,[7,[4,9,9],10,2]],[0,5,[]],[]] 269 | [[[[3,3,10,5],[]],[0,1,7,[2,5,1,0],[0,9,8,2]]],[[3],[[9,6,3,10,4],7,[7],6],[[6,0]],[1,[7,2]]],[1,[[4,6,0,7],9,10,[2,8,4,9,2],[7,3,4]],[[7,9,1],3,0,4,[]],[]],[],[9,5]] 270 | 271 | [[6,[8,5,[4,2,6,0,10],[8,9,5,10],[4,9,6]],0],[[6],9,8,0],[[8,[5,3],[5,0,9,6,3],6],[[2,0]]]] 272 | [[3,[],7,8]] 273 | 274 | [[6],[9],[5,1],[1,[[0,2,1],7],0,[4,0,2],1],[[10]]] 275 | [[[0,0,9,[1,4,2,2]],5,0,4],[[[9,9,4,0,7]],7,0,10]] 276 | 277 | [[10,9,2],[7,7,9,[3,2]],[7,[6,8],8]] 278 | [[[1,3,8],5,[[4,7],[4,5,0],[],[5,2]],5],[7,[[2,0,0,10,6],8,[9],6],[],1,10],[[]],[[[4,10],[5],[8,6,3,10],6,[10,0,0]],0,[9],[[2,8,0],[0],5,[10,8,2,10]]]] 279 | 280 | [[4,8,1],[],[8]] 281 | [[1,[2,4],9,[]],[[[9,2,1,4,2]],[],[[],[]],2,[]],[],[],[[]]] 282 | 283 | [[[],[[2,5,10],[2,9,3,6,8],6],[[]]],[9],[10,3,2,[[],2]],[[9,[10,5,9,7],[9]],9,[[8],7,2,[6,4],[6,8,8,0]],[8,4,[],10],[0,[9,0,7,9,8],0,[5,0,5,4,10],1]],[[1,10,3,3,3],[1,0,1,[]],[9,8,[9,8,7,2,9],8],7]] 284 | [[10,1]] 285 | 286 | [[[],[],[[0],[2],5,[],1],[],[]],[[],[],3],[[[5,10,8],3,2,4,[0,8,0]],1,[5,5,[10]],[],[8,[5,10],4]],[8,7,0,2],[1]] 287 | [[8],[]] 288 | 289 | [[10,5,[[7]],[0],3],[[],1,2,8],[[7]]] 290 | [[7]] 291 | 292 | [[[[10,9,2,4],[10]],[[],[],2,[0,7]],1,[1,7]]] 293 | [[[8,9,[9],[6,1,10,6,8],[3,10,3]],9,[[4,6,5],3,[8,9],10,3],[10,1,10,1]],[4,[[8,5,10,2,7],8,[9,6,0],[10,3,5,1]],[[3],0,1,[4],[7,8]]],[5,[[8,1,2,7,7],[10,9,0,9,5],8,[0,4],[7,7,8,0,5]]],[1,4,3,[],[[1,8,10,10],1,[1,5,7],[9,6,10,7],2]],[[3,[],[0,0,6,9]],6,3,[[],10],[[7,6],[1,2],8]]] 294 | 295 | [[[[8,3,5],5],[6,4],[4,1]],[[],4],[],[4,7,2,[[9,9],[]],[]]] 296 | [[[[],[2,8,7,5],[8,2,6,5]],[[],[],10,5,[10]]]] 297 | 298 | [[0,4,[4,[3,4]],4],[[]],[[6,10,[8,1],10,[6,6,7,10]],[[8,10],[1,1,7]],[3,[6],1,7],10,[[4,10]]],[5,7,2,[8,9,[3,4,10],2,[]]]] 299 | [[[[1],[5,0,8,5,1],4,[]],[6,10,[7,2,1],[1,10,5],0],9,2,6],[7,9,[2],5,6],[0,[[2],7,8],8],[[[],[],[1,9,9],4,[]],[8,9,8],7]] 300 | 301 | [[[[0,6,5,8],[5,5,3,10],0,[9],[9,0,3,0,1]],6,10,4,[[6,2],[10],[4,4,10]]],[10,10,10,10]] 302 | [[10,10,0],[[[5],8],[[2],[8,8],1,[0,3,10,6],[4,6,2]],[9,6,0],1],[],[[[],[9,2,0,9]],3,[9,[0,5],7],[[],1]],[[[10,1,7,8],[5],[1,6,7,9],6],6,2,2,[[7,4,5,0,8],0,4,8]]] 303 | 304 | [[[],8,8,[]],[10,[10,[8,7],1,[5,9,9,1,7],4],5],[1,8,[5,1,[9,7,10,5],7],[[6,7],[8],[9],0,6],4]] 305 | [[[]],[[8,4],7,3,[]],[[],10,[5,[1],[8,3,2,1]]],[[[2,3,10,2]],4,1,4],[9,2]] 306 | 307 | [[8,[6]],[],[],[],[2,1]] 308 | [[3],[[9,[2],5,3,[]]],[8,3,[[5,5,9],[]]],[[3,4,[10],[2]],8],[3]] 309 | 310 | [[[[8,7,7],[9,5,10,7]],[],[],5],[7,[9,[1]],2,6],[[]],[[6,1],[6,2]],[]] 311 | [[9,2,0,[[6],4],[6,[1],[6,8,10,5],9,4]]] 312 | 313 | [[5,[[6,4,7],4,[],[1,10]]],[[2],[[0,7],[10],[6,7,1,3,5],[7]],9,6,7],[9,9,2],[[1,[3,10,5,0,3],7,3],[7],4,[[5,8],[2]],[0,6]]] 314 | [[0,[[6,10,3,2],[7,0,2,10]],10],[1,1,0],[[],1,[7],[5,1]]] 315 | 316 | [[[[10],0,[7,9,0,7,7]]],[],[[[7,8],2],[[4,2]]],[[[2,7,2,3],[0]],9,1,[[8,4,5],[4,10,0,0,4],[]],[3,[6,4,9,5],4]]] 317 | [[[6,[9,6,9,1],9],[[0,0],8,[1,7,3,1],4,[]]]] 318 | 319 | [[[2,3],3],[10,4,[[10,8,4,6,9],5],[8,[0,9,5,5,4],3]]] 320 | [[0],[[[1]]],[1,9,2,2,[[4],4,8]],[]] 321 | 322 | [[[[8,0],[10,7],[9,2],[4]],[3,[2,10,2],7,4],[8,[],[0,5,7],3,[5,10,1,7,4]],[6,3,8,[0]],[3]],[[5,[],[7,9],[8,5,10,2]],[]]] 323 | [[10,6,[9,[2,6,5],1,0,[5,0,3,3,10]],[[10,1]],5],[1,[10,[1,2,6,6],[],[5,6,3]],10,5],[1,[2,[9,0,5,7],5]],[[3,[4,10,9],[7,6,3],[9],10],10],[[7,[10,10,7]],8,[4,7,7,6],[[1,0,4],[3]],4]] 324 | 325 | [[[0,[5,8]],4,[1],[1,4,7,[]]],[4,2,[[4,0,4,8]],[4,[],[],3,[3,0]]],[]] 326 | [[1,[7,6,5,7,[7]],4],[6]] 327 | 328 | [[[[7,9]],[[8,4,10],2,7,9,2]],[7,7,[[7,9,1],4,[0],0],7,[8,[6,1,2,5],4,4,10]],[7,3,4,6,1]] 329 | [[[8,0,[2],0],0],[[]],[6,4],[6,10]] 330 | 331 | [[],[[[7,10,10,1],7],0,8],[9],[0,2]] 332 | [[8,[[0,2,5],[6,10,1],3,0],[[10,7]],[[3,3,2,9,3],4,[8,6,2],5,0],[8,[],4]],[7],[[]],[]] 333 | 334 | [[6,[],[[6,9,7,5],[7,4,5,9,10],10,[],[0,5,3,7,5]],[[0,9,5],10]],[[3,5],[10,3],10],[2],[[[5,7],[8,6],5],[[0,9,8,3],[1,8],9,[0,6,0,7,1],3]],[[[]],2,1,[],5]] 335 | [[[[3,8,10,5],6,3],[4,2,0,2],[9,[],3]],[],[1],[8,0,10,[]],[[7,[],[8,5,7,3,2]],9,1,1,[[9,3,5],[],3]]] 336 | 337 | [[10,6],[5,[2],[1,4],1],[[],[],[8,6,[0,4],9,[9,10,0,1,6]]],[10,3],[]] 338 | [[],[[2,[10],[5],0],[9,9,6,1],0,[[10,1,8]]],[],[]] 339 | 340 | [[4],[0,9,9,[3,7,[0,3,6,2],5]],[[],[9,0,2],10],[0,0,[[4],3,10,5],4,5],[]] 341 | [[8],[10,2,[5,[6,10,4,7],[]],7,0]] 342 | 343 | [[[],9,2,5,0],[[[10,6,6],10,[1,3]],1,10,[]],[9,4],[[[5,6],8,[2,7,8,3,8],10,[4,2]],6,4,[[4],2],[[10],1,10,[],6]]] 344 | [[0,[]]] 345 | 346 | [[0,[[5],10,5,8,2],[6],10,8],[0,3,9,2],[[0,[]]],[[[1],9,6,[8,1,8]],8]] 347 | [[[9,[10,0],9,[]],[[8,5],2,[],0,6],[3,2,9],[3,[5],7,10,6],5],[[],[8,9],[4],[[7,6,9,6,9],[1,6,3],[7,3,6,1,6],[5]],[[6,7,4,5],5]]] 348 | 349 | [[6,[[3,8,10,5]],2],[],[[],9]] 350 | [[1,[[7,2,5,1,7],7,8,9],[6,[4,9,9,9,7],0],5]] 351 | 352 | [[],[[1,8,[8],8],10],[],[2,[],[[0,5],6,[2,0],[1,3],[5,7,9,8]],2]] 353 | [[[[6,7,5],[5,0,10,3],[8,10,8],[1]],1,[6,[8,4,3],[5]],[0,[6,10,2,7,1],[7,10],1,[8,1,10]],[2,2,[10,6,7,9,10]]],[9,1],[4,3]] 354 | 355 | [[8],[[5,[],[],[5,5,2,1]],4,2,4],[10]] 356 | [[[[0,6,0,9,3],5,3],[[],0,[9,9,0,6],7,2],[[10],10,[9,5,6,10],6],[6,8,9]],[[[3,0],[],10],7],[[],3]] 357 | 358 | [9,7,7,7] 359 | [9,7,7,7,2] 360 | 361 | [[[2,[]],7,[1]]] 362 | [[3,[0,[8,10,1,9,7],[]],7],[[[2,10,0,8,4],0,10,[]],[[1,1,3,5],3,[1,7],2,0],10,6,[6,[4],10,[9,9,1,4,2],[6]]],[[5,[9,6,2]],3]] 363 | 364 | [[0,[8,[5,3,1,10,3],[7,3,5],[5,5,3]],3],[7,1]] 365 | [[9],[[],9,9,[9,[],[1,1,7,4,1],[9,1,7]]]] 366 | 367 | [[[[]],[10,[6,10,5,1,1],8,[2,3,1,7]],[6]]] 368 | [[[[5,6,4,8,4],10]]] 369 | 370 | [[],[],[3,3,[[2,5,6],0,[6,6,9],[],4],[]],[[2],1,[[3,10,3,2,7],[5],[9],[3,5,1],10],5,7],[[[6,3,6],7],2,4]] 371 | [[3],[[10],10,[[1,5],6,0],[[6],3,[2]]],[5,7,8,9,[[3,4,3,5,9]]],[[6,[5,1],10,8],2,8,[8,[10,0,5,4,0],5,1,10],6]] 372 | 373 | [[],[9],[3,2],[[[6,2,1,7,3],[7],[5,6,6]],[0,[]]]] 374 | [[2,[7]],[]] 375 | 376 | [[1,[7,4,3,7,[9,1,10,6]],6],[7],[],[]] 377 | [[3,[1,9,[3,1]],[[],[10]],10],[8],[3],[[6,8,6],1,8]] 378 | 379 | [[[6],[2,2,3,[5,8,9,0,0],2],3,[]],[5,[1]],[],[9,[[0],[6,3]],[2],3,8]] 380 | [[],[[[0,7,2,3],[10,0],0,9,5],5,[]],[],[3],[[3,8],2]] 381 | 382 | [[],[[[6,7]],9,[4,3,[7,4,4,3,10],[9,4]],7]] 383 | [[[10,7],[[],2,[],1,4],[9,8],[[1],[7,1,3,1,1],[8,1,1,0,5],[]]],[[[2,10,6,5]]],[],[[6,[2]],0,7],[[6,2,[10,5,9,8]]]] 384 | 385 | [[1,3,[4],10,[[9,1,5,8,3],[7,7,10,0,2],[10,4],[0,0,1]]],[8,7,2,[[9],3],[[6,9]]]] 386 | [[1,4,[]],[],[9]] 387 | 388 | [[[6,[],[3,2,3,5,6],[]]],[[2,[5,1],1]],[0,[],[[3],7,1,0],[]]] 389 | [[[]],[[8,7,7,[6]]],[0]] 390 | 391 | [[],[0],[],[7,1,1,5]] 392 | [[[],[[],[9,3,5,4,7],[6],[8],6],[7,2,[3,9],[4,0,7],[8,10]],[0,[8,3,8,10,7],[5]],1],[1,[],[],[]],[[[5],[],[2,2,2,1,9]],9,[[2],6],10],[7,4,[3,5]]] 393 | 394 | [[10,[],[7]],[[10]],[[[],1,[0,8,3],3,0],5,[],[],4]] 395 | [[6,[],3],[[],[[6],[4,9,10]],[[],3,[],8,[1,8]],[[10,2,10]],9]] 396 | 397 | [[[1,[2,6,5,9,0],1,2],[0,4,9],[[6,1,4,6,0],[5,9,5,8],[2,7,7,2],[1],[9,7,0]]]] 398 | [[5,7,[[9,6,2,0,8]]],[[[],5,[5,8,10,8,5],[10,4,1],5],[2,3],3,0],[3,[9,[10,0,5,9,2],3,[],9]],[7,8,2,3,10],[[4,[5,10],[2],[]],[[7],2,1,1]]] 399 | 400 | [[6,[4,[0,8],9],[[3,7,1],[10,9],[7,0,1],6,3],4],[0,2],[[]],[[6,5,[]],[9,10],[],0,[5]]] 401 | [[[],[0,2],[],9],[6]] 402 | 403 | [[4],[3,2,2],[[[9,5,5,2,2],[10,4],3,7,7],3]] 404 | [[[5,8,[2,6,2,3],[8,10,0]]]] 405 | 406 | [[4,10,[[4],6]]] 407 | [[3],[0,[9,7,[4,4,3]],10],[[[],4,[3,5,8],[0]],[[1,0],0,[1,6,8],[5,3,9,6]],[9,[2],2,8,[]],[[3,0],[2,5],9,0]],[6,[7,0],[[2,0,5,3,6],[],[9,8,0,8,1],[1]]]] 408 | 409 | [[5,2,2,[],[2,[],3]]] 410 | [[1,2,[[8,3],2,[8,10,4,5,9],[7,0],3],3,[[],[10,5,8,9],6,6]],[2],[[1],[5,[4,7,10],8,7,9]],[8,4,[[],7],0,8],[]] 411 | 412 | [[2,[],[4,[8,4,3,4,8],[9,2,2],[7,5,5,10]]]] 413 | [[[[6],[0,10]]]] 414 | 415 | [[3],[],[]] 416 | [[[],[1,[],6,[2,6],2],4,[1]],[7,[0],7,[5,[4,6,4,6],5,[],[10,6]],0],[[9,[0,9,3,7],5],[[2,1,9,10,2],[4,6],0],[],8],[],[]] 417 | 418 | [[[[10,7],[0,9,9,4],4,[3,8,7,10,4],7],[[7]]],[4,[9,[]]],[0,[4,[6,7],[10,8,3,4]],[7,6,[7,9,5,9,6],[6],[7,8,8]],4,1],[[[7,5,9,3],9],[[],[0,4,3],[10,10]]]] 419 | [[[6,[6,0,0,1],2,4],7,4,[8,10,8,7,[0,9,0,10]],7],[10,1,0,6],[],[[],9,[4,[5,10,10,5,6],[6,1,5],8]],[]] 420 | 421 | [[],[2,[[10,6],4,[6]],[[3,5,8],[4,8,9]],0,8]] 422 | [[],[[6,9,[10,8,0,0]],[8]],[4,7,[[6],[4],[3],[]],2,[0,7,[6,6],[6,3,0,7],[5,4,3,3]]],[4,[[4,10,7],[],[9,10,6,3,10],9],0]] 423 | 424 | [[4]] 425 | [[[10,10,[1],[7,2,8,6,3]],[0,9,[2,1,7],2,[5,5,4]]],[[],0,[8,6,[10],7,[10,5,4]],5,6]] 426 | 427 | [[],[],[1],[[[10,1,1,3,7],[],[9,8,2,10],[],[9,7,9]],[[6,6,7],6],2,5,[9,0,[1,1,3,10],[0,6,7,2]]]] 428 | [[[10],[10,[4,5,8,6,3]]],[[[2,9],9,10],[],[9,7]],[],[[[8,4,3,10,5],9,7,3],4,10,4,5],[]] 429 | 430 | [[],[[]]] 431 | [[5,6,[[2,8,7,7,9],6,7,[6]]],[],[3,10,[9,[0,1,7],[9,3,0]],6,4],[10,[[],[1,0,6]],[],[[],[4,2,3,8,4]],8],[[],[4,8,[5,5,3],9],10,[10,4],3]] 432 | 433 | [[5,[5,[3,10,4],1,[10,8,6,1,10]],[[9],[0,8,0],8,[7,6,4],[]]]] 434 | [[[[6,7,5,3,3],[3,7,8]]],[5,7,[[],[8,3,0],[2,10],3,[5,3,10,1]],[[3,6,5],7],2],[[3]],[10],[[[9,9],5,1],7,[[5,0,1],2,[]],10,8]] 435 | 436 | [[[[1,7],5,2,[4,8]],[[10,1],[1,6],1,[6,10,4,5,0],[0,0,6,4,3]],[],[]],[[],[],[1,[],[4,0,9,10]]],[0,[]],[2,3],[[3,[]]]] 437 | [[8,[7,4,6]]] 438 | 439 | [[5,10],[],[[5,8,6,1],[[0,10],1,[1,5,5,6]],8,[[10],[10,0,2,1,2],[10,2,10]]],[2,2,[],10],[0,10,2]] 440 | [[0,10,[],[5,4,[5,7,8],2,6]]] 441 | 442 | [[],[[]],[]] 443 | [[[[8,1,7],[2]],[[],[9,3]]],[],[[1,[7,0,2,5],[10],[8,4],4],[[10],[1,4],7,[1,2,10,10,2]]],[[[9],[8,2,7,3]],[[],7,[1],6]],[[2,[6,3],10,6,[9,2,0,0]],6,9,4,[[3,6,5],[8,2,5,4]]]] 444 | 445 | [[[[0]]],[[[],[1],[3,1,10]],[[],[],[4,4,5],8,4],[[0,5,0],4],[[0,1],1,6],7],[6,[]]] 446 | [[3,[6,[7,3]],[[4,7],8,[10],7]],[6],[[[8,9,5],[1,0,4,2],1,[8,8]],[3,[1]],[7,7,[0,7],[5,10,1,9],3],[[0,9,4,10],5]]] 447 | 448 | [9,1,3,2,3] 449 | [9,1,3,2] --------------------------------------------------------------------------------