diff options
| author | Louis Burda <quent.burda@gmail.com> | 2023-04-07 17:18:18 -0400 |
|---|---|---|
| committer | Louis Burda <quent.burda@gmail.com> | 2023-04-07 17:19:39 -0400 |
| commit | 87ab487d59fa85dbe2afa55cc841b02805ae42ca (patch) | |
| tree | cd90ab715e1b5b5803674045dbafd6d51d27ac90 /src | |
| parent | 1bcc82c5bfbde87edd03c01ffdf9ee5934681592 (diff) | |
| download | aoc2018-python-87ab487d59fa85dbe2afa55cc841b02805ae42ca.tar.gz aoc2018-python-87ab487d59fa85dbe2afa55cc841b02805ae42ca.zip | |
Reorder days into src
Diffstat (limited to 'src')
| -rw-r--r-- | src/.gitignore | 1 | ||||
| -rw-r--r-- | src/01/input | 963 | ||||
| -rw-r--r-- | src/01/part1 | 55 | ||||
| -rw-r--r-- | src/01/part2 | 34 | ||||
| -rw-r--r-- | src/01/solve.py | 48 | ||||
| -rw-r--r-- | src/02/input | 250 | ||||
| -rw-r--r-- | src/02/part1 | 50 | ||||
| -rw-r--r-- | src/02/part2 | 41 | ||||
| -rw-r--r-- | src/02/solve.py | 40 | ||||
| -rw-r--r-- | src/03/input | 1347 | ||||
| -rw-r--r-- | src/03/part1 | 63 | ||||
| -rw-r--r-- | src/03/part2 | 44 | ||||
| -rw-r--r-- | src/03/solve.py | 65 | ||||
| -rw-r--r-- | src/04/input | 986 | ||||
| -rw-r--r-- | src/04/part1 | 76 | ||||
| -rw-r--r-- | src/04/part2 | 20 | ||||
| -rw-r--r-- | src/04/solve.py | 92 | ||||
| -rw-r--r-- | src/05/input | 1 | ||||
| -rw-r--r-- | src/05/part1 | 40 | ||||
| -rw-r--r-- | src/05/part2 | 75 | ||||
| -rw-r--r-- | src/05/solve.py | 30 | ||||
| -rw-r--r-- | src/06/input | 50 | ||||
| -rw-r--r-- | src/06/part1 | 65 | ||||
| -rw-r--r-- | src/06/part2 | 61 | ||||
| -rw-r--r-- | src/06/solve.py | 76 | ||||
| -rw-r--r-- | src/07/input | 101 | ||||
| -rw-r--r-- | src/07/part1 | 65 | ||||
| -rw-r--r-- | src/07/part2 | 54 | ||||
| -rw-r--r-- | src/07/solve.py | 105 | ||||
| -rw-r--r-- | src/08/input | 1 | ||||
| -rw-r--r-- | src/08/part1 | 58 | ||||
| -rw-r--r-- | src/08/part2 | 46 | ||||
| -rw-r--r-- | src/08/solve.py | 43 | ||||
| -rw-r--r-- | src/09/input | 1 | ||||
| -rw-r--r-- | src/09/part1 | 78 | ||||
| -rw-r--r-- | src/09/part2 | 15 | ||||
| -rw-r--r-- | src/09/solve.py | 43 | ||||
| -rw-r--r-- | src/10/input | 337 | ||||
| -rw-r--r-- | src/10/part1 | 160 | ||||
| -rw-r--r-- | src/10/part2 | 92 | ||||
| -rw-r--r-- | src/10/solve.py | 105 | ||||
| -rw-r--r-- | src/10/test-input.txt | 31 | ||||
| -rw-r--r-- | src/11/input | 1 | ||||
| -rw-r--r-- | src/11/part1 | 88 | ||||
| -rw-r--r-- | src/11/part2 | 14 | ||||
| -rw-r--r-- | src/11/solve.py | 76 | ||||
| -rw-r--r-- | src/12/input | 34 | ||||
| -rw-r--r-- | src/12/part1 | 99 | ||||
| -rw-r--r-- | src/12/part2 | 49 | ||||
| -rw-r--r-- | src/12/solve.py | 53 | ||||
| -rw-r--r-- | src/13/input | 150 | ||||
| -rw-r--r-- | src/13/part1 | 188 | ||||
| -rw-r--r-- | src/13/part2 | 26 | ||||
| -rw-r--r-- | src/13/solve.py | 148 | ||||
| -rw-r--r-- | src/13/test1 | 7 | ||||
| -rw-r--r-- | src/14/input | 1 | ||||
| -rw-r--r-- | src/14/part1 | 70 | ||||
| -rw-r--r-- | src/14/part2 | 18 | ||||
| -rw-r--r-- | src/14/solve.py | 37 | ||||
| -rw-r--r-- | src/15/input | 32 | ||||
| -rw-r--r-- | src/15/part1 | 343 | ||||
| -rw-r--r-- | src/15/part2 | 57 | ||||
| -rw-r--r-- | src/15/solve.py | 229 | ||||
| -rw-r--r-- | src/15/test1 | 7 | ||||
| -rw-r--r-- | src/15/test2 | 7 | ||||
| -rw-r--r-- | src/15/test3 | 7 | ||||
| -rw-r--r-- | src/15/test4 | 7 | ||||
| -rw-r--r-- | src/15/test5 | 9 | ||||
| -rw-r--r-- | src/15/test6 | 7 | ||||
| -rw-r--r-- | src/16/input | 4148 | ||||
| -rw-r--r-- | src/16/part1 | 136 | ||||
| -rw-r--r-- | src/16/part2 | 32 | ||||
| -rw-r--r-- | src/16/solve.py | 109 | ||||
| -rw-r--r-- | src/17/.gitignore | 1 | ||||
| -rw-r--r-- | src/17/input | 1884 | ||||
| -rw-r--r-- | src/17/part1 | 177 | ||||
| -rw-r--r-- | src/17/part2 | 105 | ||||
| -rw-r--r-- | src/17/solve.py | 183 | ||||
| -rw-r--r-- | src/17/test1 | 8 | ||||
| -rw-r--r-- | src/18/input | 50 | ||||
| -rw-r--r-- | src/18/part1 | 175 | ||||
| -rw-r--r-- | src/18/part2 | 184 | ||||
| -rw-r--r-- | src/18/solve.py | 81 | ||||
| -rw-r--r-- | src/18/test1 | 10 | ||||
| -rw-r--r-- | src/19/input | 37 | ||||
| -rw-r--r-- | src/19/part1 | 92 | ||||
| -rw-r--r-- | src/19/part2 | 58 | ||||
| -rw-r--r-- | src/19/solve.py | 109 | ||||
| -rw-r--r-- | src/19/test1 | 8 | ||||
| -rw-r--r-- | src/20/.gitignore | 1 | ||||
| -rw-r--r-- | src/20/input | 1 | ||||
| -rw-r--r-- | src/20/part1 | 187 | ||||
| -rw-r--r-- | src/20/part2 | 207 | ||||
| -rw-r--r-- | src/20/solve.py | 151 | ||||
| -rw-r--r-- | src/20/test1 | 1 | ||||
| -rw-r--r-- | src/21/input | 32 | ||||
| -rw-r--r-- | src/21/part1 | 41 | ||||
| -rw-r--r-- | src/21/part2 | 27 | ||||
| -rw-r--r-- | src/21/solve.py | 112 | ||||
| -rw-r--r-- | src/21/test1 | 8 | ||||
| -rw-r--r-- | src/22/input | 2 | ||||
| -rw-r--r-- | src/22/part1 | 106 | ||||
| -rw-r--r-- | src/22/part2 | 22 | ||||
| -rw-r--r-- | src/22/solve.py | 93 | ||||
| -rw-r--r-- | src/23/input | 1000 | ||||
| -rw-r--r-- | src/23/part1 | 64 | ||||
| -rw-r--r-- | src/23/part2 | 22 | ||||
| -rw-r--r-- | src/23/solve.py | 108 | ||||
| -rw-r--r-- | src/24/input | 23 | ||||
| -rw-r--r-- | src/24/part1 | 199 | ||||
| -rw-r--r-- | src/24/part2 | 186 | ||||
| -rw-r--r-- | src/24/solve.py | 127 | ||||
| -rw-r--r-- | src/25/input | 1248 | ||||
| -rw-r--r-- | src/25/part1 | 108 | ||||
| -rw-r--r-- | src/25/part2 | 17 | ||||
| -rw-r--r-- | src/25/solve.py | 50 | ||||
| -rw-r--r-- | src/25/test1 | 10 | ||||
| -rw-r--r-- | src/25/test2 | 10 | ||||
| -rw-r--r-- | src/25/test3 | 8 | ||||
| -rw-r--r-- | src/25/test4 | 10 | ||||
| -rw-r--r-- | src/Makefile | 15 | ||||
| -rw-r--r-- | src/common/aoc.py | 35 |
122 files changed, 19490 insertions, 0 deletions
diff --git a/src/.gitignore b/src/.gitignore new file mode 100644 index 0000000..bee8a64 --- /dev/null +++ b/src/.gitignore @@ -0,0 +1 @@ +__pycache__ diff --git a/src/01/input b/src/01/input new file mode 100644 index 0000000..419087f --- /dev/null +++ b/src/01/input @@ -0,0 +1,963 @@ ++11
++16
++2
+-16
+-6
++13
+-6
+-8
+-17
++15
+-11
+-14
++17
+-9
++4
++1
+-15
+-17
+-8
++16
++6
+-11
+-15
+-2
++3
+-6
+-2
+-4
+-2
+-18
+-6
+-2
++18
+-4
++7
++15
+-11
++8
+-4
+-17
+-19
+-15
+-17
+-7
++12
+-2
+-5
+-13
+-4
+-13
+-18
++16
++12
++10
++14
+-19
++13
++10
++8
+-10
++3
+-16
+-7
+-9
+-19
+-15
+-19
++2
++7
+-1
++7
++1
+-20
+-5
+-10
++14
++10
++5
++13
++10
++15
++3
+-16
+-17
++19
++15
++2
++14
+-11
++3
+-11
+-17
+-8
++16
+-13
+-1
++16
++1
++12
+-5
++20
++16
++10
+-9
+-8
++15
+-4
++3
++5
++7
++1
+-2
++19
++14
+-5
+-10
+-4
++3
++18
+-15
++17
+-7
++10
+-8
+-10
++4
++10
++12
++11
+-4
+-4
+-8
++11
++16
+-4
++14
++2
++3
+-16
++19
+-9
++5
++17
++19
+-17
+-4
++13
++15
+-6
++20
++12
++15
+-17
++13
+-7
+-14
++11
++12
+-10
++16
+-10
++8
++11
+-8
++16
++5
++3
+-4
++15
+-16
++4
++2
++5
++8
++12
++7
++8
++4
++19
+-14
++2
++8
++12
+-14
++19
++15
+-14
+-17
+-5
++7
+-20
+-5
+-4
++14
+-21
++4
+-8
+-7
++14
+-18
+-7
+-18
+-13
+-19
+-8
++16
++3
+-8
++14
++10
++9
++18
+-15
++14
+-1
++18
++15
++17
++11
++16
+-11
++7
+-13
+-14
+-6
+-11
++13
+-12
+-2
++9
+-12
++10
+-18
+-6
+-8
++9
++3
++6
++11
++15
++15
++5
++19
++15
++8
+-12
+-17
+-8
++19
++2
++9
++2
++6
+-10
+-22
+-9
++19
+-5
+-4
++3
++14
+-1
+-20
++15
++17
+-1
++19
+-8
++11
+-13
++17
++9
++9
++18
++7
+-8
++11
++16
++9
+-1
++15
++19
+-25
++1
+-6
++8
+-4
++13
+-23
++15
++3
+-14
++1
++25
++51
+-11
++5
++5
+-13
++17
++13
++16
++17
++17
++18
++16
++16
+-5
+-20
+-19
++15
+-14
+-15
+-6
++9
+-1
+-5
+-13
+-24
++13
+-18
+-29
++3
++10
+-14
++29
+-21
++11
++13
++24
++23
+-17
++19
+-1
+-7
+-5
++20
++5
+-11
++3
+-20
+-13
++5
+-12
+-8
++4
+-23
+-31
++18
+-50
+-27
+-16
++15
+-21
+-26
+-11
+-46
+-11
+-12
+-5
+-1
+-6
++3
++19
++7
++33
++9
++11
++14
++32
++36
++15
+-92
++22
+-19
+-18
+-8
+-24
++28
+-72
++15
+-19
+-34
+-4
+-11
+-4
++17
++14
+-26
+-23
+-18
+-10
+-1
++39
+-5
++19
++16
++26
+-25
+-40
+-11
++19
+-11
++1
++7
+-55
+-21
++73
++503
++843
++54936
++14
+-12
++13
+-7
+-11
++8
++11
++11
++7
++13
++12
++9
++12
++1
++7
+-19
+-3
+-5
+-1
+-20
++12
++11
+-10
+-8
+-6
++17
++19
++1
++10
+-19
++4
++19
++6
++4
++3
++6
++4
++12
++3
++2
+-9
++3
++9
+-15
+-10
+-9
+-10
++4
++19
++11
++19
++2
++5
++9
+-15
++12
++5
++9
++18
+-12
+-4
++7
++13
+-6
++16
++16
++12
+-7
++18
++3
++15
+-12
++8
+-19
++3
++3
++11
+-3
++17
+-10
++3
+-20
++6
+-17
++9
++16
++18
++8
+-10
+-12
++13
++7
+-2
+-11
++10
+-2
++1
+-5
++10
++13
+-7
++14
++17
+-1
+-1
++8
+-4
++16
+-3
++16
++17
++4
++13
+-3
++8
+-15
+-12
++14
++16
+-5
+-7
++14
+-12
+-17
+-21
+-1
+-16
++4
++7
+-14
+-12
++16
+-12
+-12
+-8
+-3
+-2
+-4
++16
+-14
++8
++18
+-8
+-2
+-13
++2
++17
++15
++13
++12
+-4
++19
+-8
+-6
++5
+-16
++14
+-15
+-18
++13
++19
+-9
++23
+-5
+-7
++5
++12
++18
+-1
++20
+-7
+-6
+-9
+-11
++6
+-5
++1
++7
++14
+-2
++7
++2
++14
+-3
+-9
++15
+-2
++12
++4
+-5
++8
++9
+-4
++2
++13
+-4
+-4
+-10
++4
+-2
++13
+-2
+-12
++26
++2
++17
++20
++20
++5
+-21
++12
+-5
+-14
++4
++12
++9
+-14
+-1
++10
+-5
+-14
+-5
+-17
+-12
+-8
++12
++11
+-9
++18
++2
+-12
++7
++6
+-8
++6
+-18
+-21
+-8
++1
++12
+-25
+-11
++4
+-16
+-10
++19
++12
+-10
+-1
+-24
+-7
++4
++9
+-4
+-19
++28
++1
++5
+-8
+-18
++8
+-29
+-26
+-17
++4
+-19
+-8
+-6
++8
++15
++36
+-6
+-5
+-18
++6
+-4
+-19
+-4
+-11
++3
+-16
+-1
++2
++13
++21
+-10
++32
++28
++5
++21
+-36
+-11
+-90
+-11
++17
+-11
++10
++3
++2
++11
+-25
+-17
+-9
+-9
++20
+-17
+-19
+-17
+-1
++6
+-2
++10
+-12
++5
+-9
++12
++16
++3
+-18
++1
++15
+-3
+-8
++15
++18
++11
++5
+-20
+-12
++6
+-3
+-13
++19
+-17
++19
+-23
++1
+-14
++20
++13
++7
++3
+-21
+-17
+-23
+-8
+-18
++16
++5
++7
+-6
+-9
+-19
+-18
++17
++17
+-22
++17
++15
+-12
+-9
+-9
++14
+-9
+-9
++3
+-8
+-7
+-23
++7
++22
++37
++14
++22
+-20
+-9
+-23
++18
+-8
+-5
++9
+-13
++25
++8
+-28
++23
+-39
+-8
+-51
+-30
++3
+-31
++1
++4
++172
++17
++18
+-30
++18
++47
++19
+-24
+-14
++117
+-5
++168
++14
+-16
+-61
++1728
++54439
+-8
++15
++5
+-2
+-1
+-12
+-3
++10
++15
++10
+-14
++15
+-8
++11
++10
+-12
++11
++12
++17
+-10
+-6
+-19
+-19
++18
+-12
+-3
+-7
+-11
+-13
+-10
++9
+-13
++9
+-15
++16
++2
++16
++13
+-17
++19
++16
++16
+-10
+-12
+-7
++5
+-15
++14
++19
+-12
++17
++8
+-18
++17
+-4
++1
++6
+-13
+-5
++23
+-19
+-8
+-13
+-31
+-12
+-3
++5
+-3
++11
+-1
+-20
+-8
++5
+-2
+-2
+-18
++1
+-19
+-5
+-3
++13
++15
++10
+-8
+-14
++16
+-14
++18
+-11
++6
+-10
+-4
++5
+-15
++8
+-17
+-7
+-12
+-12
++10
++6
+-12
+-17
++1
++8
++17
++17
+-11
++19
+-18
++1
+-14
+-2
+-15
+-6
+-1
+-16
++1
+-3
++6
+-18
++1
+-17
++8
++19
++18
+-5
++12
++6
+-15
++19
+-8
+-16
++18
++15
+-6
++1
+-17
+-10
+-4
+-112437
diff --git a/src/01/part1 b/src/01/part1 new file mode 100644 index 0000000..d5f5e36 --- /dev/null +++ b/src/01/part1 @@ -0,0 +1,55 @@ +--- Day 1: Chronal Calibration --- + +"We've detected some temporal anomalies," one of Santa's Elves at the Temporal Anomaly Research and +Detection Instrument Station tells you. She sounded pretty worried when she called you down here. +"At 500-year intervals into the past, someone has been changing Santa's history!" + +"The good news is that the changes won't propagate to our time stream for another 25 days, and we +have a device" - she attaches something to your wrist - "that will let you fix the changes with no +such propagation delay. It's configured to send you 500 years further into the past every few days; +that was the best we could do on such short notice." + +"The bad news is that we are detecting roughly [1m[97mfifty[0m anomalies throughout time; the device will +indicate fixed anomalies with [1m[33mstars[0m. The other bad news is that we only have one device and you're +the best person for the job! Good lu--" She taps a button on the device and you suddenly feel like +you're falling. To save Christmas, you need to get all [1m[33mfifty stars[0m by December 25th. + +Collect stars by solving puzzles. Two puzzles will be made available on each day in the Advent +calendar; the second puzzle is unlocked when you complete the first. Each puzzle grants +[1m[33mone star[0m. Good luck! + +After feeling like you've been falling for a few minutes, you look at the device's tiny screen. +"Error: Device must be calibrated before first use. Frequency drift detected. Cannot maintain +destination lock." Below the message, the device shows a sequence of changes in frequency (your +puzzle input). A value like +6 means the current frequency increases by 6; a value like -3 means the +current frequency decreases by 3. + +For example, if the device displays frequency changes of +1, -2, +3, +1, then starting from a +frequency of zero, the following changes would occur: + + + - Current frequency  0, change of +1; resulting frequency  1. + + - Current frequency  1, change of -2; resulting frequency -1. + + - Current frequency -1, change of +3; resulting frequency  2. + + - Current frequency  2, change of +1; resulting frequency  3. + + +In this example, the resulting frequency is 3. + +Here are other example situations: + + + - +1, +1, +1 results in  3 + + - +1, +1, -2 results in  0 + + - -1, -2, -3 results in -6 + + +Starting with a frequency of zero, [1m[97mwhat is the resulting frequency[0m after all of the changes in +frequency have been applied? + + diff --git a/src/01/part2 b/src/01/part2 new file mode 100644 index 0000000..87d732d --- /dev/null +++ b/src/01/part2 @@ -0,0 +1,34 @@ +--- Part Two --- + +During the second Go / No Go poll, the Elf in charge of the Rocket Equation Double-Checker stops the +launch sequence. Apparently, you forgot to include additional fuel for the fuel you just added. + +Fuel itself requires fuel just like a module - take its mass, divide by three, round down, and +subtract 2. However, that fuel [1m[97malso[0m requires fuel, and [1m[97mthat[0m fuel requires fuel, and so on. Any +mass that would require [1m[97mnegative fuel[0m should instead be treated as if it requires [1m[97mzero fuel[0m; the +remaining mass, if any, is instead handled by [1m[97mwishing really hard[0m, which has no mass and is outside +the scope of this calculation. + +So, for each module mass, calculate its fuel and add it to the total. Then, treat the fuel amount +you just calculated as the input mass and repeat the process, continuing until a fuel requirement is +zero or negative. For example: + + + - A module of mass 14 requires 2 fuel. This fuel requires no further fuel (2 divided by 3 and +rounded down is 0, which would call for a negative fuel), so the total fuel required is still just +2. + + - At first, a module of mass 1969 requires 654 fuel. Then, this fuel requires 216 more fuel (654 / +3 - 2). 216 then requires 70 more fuel, which requires 21 fuel, which requires 5 fuel, which +requires no further fuel. So, the total fuel required for a module of mass 1969 is 654 + 216 + 70 + +21 + 5 = 966. + + - The fuel required by a module of mass 100756 and its fuel is: 33583 + 11192 + 3728 + 1240 + 411 + +135 + 43 + 12 + 2 = 50346. + + +[1m[97mWhat is the sum of the fuel requirements[0m for all of the modules on your spacecraft when also taking +into account the mass of the added fuel? (Calculate the fuel requirements for each module +separately, then add them all up at the end.) + + diff --git a/src/01/solve.py b/src/01/solve.py new file mode 100644 index 0000000..d23d8d5 --- /dev/null +++ b/src/01/solve.py @@ -0,0 +1,48 @@ +import sys
+sys.path.append("../common")
+import aoc
+
+data = [int(l) for l in aoc.data.split("\n")]
+
+def solve1(args):
+ return sum(data)
+
+def solve2(args):
+ totshift = 0
+ fvals = list()
+ for c in data:
+ fvals.append(totshift)
+ totshift += c
+ aoc.debug("total shift: " + str(totshift))
+
+ doubles = list()
+
+ if totshift == 0:
+ doubles.append([len(data), 0])
+
+ i = 0
+ while i < len(fvals):
+ for j in range(len(fvals)):
+ if i == j:
+ continue
+ dif = fvals[j] - fvals[i]
+ if dif % totshift == 0:
+ inds = list([i, j])
+ if j > i:
+ inds = inds[::-1]
+ if totshift > 0: #ends on c
+ if fvals[inds[0]] > fvals[inds[1]]:
+ inds = inds[::-1]
+ else:
+ if fvals[inds[0]] < fvals[inds[1]]:
+ inds = inds[::-1]
+
+ pos = (abs(dif) // totshift) * len(data) + inds[0]
+ doubles.append([pos, fvals[inds[1]]])
+ i += 1
+
+ assert(len(doubles) != 0)
+
+ return min(doubles, key = lambda x: x[0])[1]
+
+aoc.run(solve1, solve2, sols=[411, 56360])
diff --git a/src/02/input b/src/02/input new file mode 100644 index 0000000..0bb005f --- /dev/null +++ b/src/02/input @@ -0,0 +1,250 @@ +vtnihorkulbfvjcyzmsjgdxplw
+vtnihorvujbfejcyzmsqgdlpaw
+vtnihoriulbzejcyzmsrgdxpaw
+vtsihowkulbfejcyzmszgdxpaw
+vtnizorkunbfejcyzmsqgdypaw
+vtnihorkdlbfojcyzmsqgdfpaw
+vtpioorkulbfejcysmsqgdxpaw
+vtnvhorkulbfhjcyzmsqgdipaw
+vtrihorkylbaejcyzmsqgdxpaw
+vtnigorkulbfejcyzmszgjxpaw
+rtnihorkklbfejcyzmslgdxpaw
+vtnihorkqlbfejcyzmsqgmppaw
+vgnisorkulbfejcyzmsqgdkpaw
+atnihorkulbfejcyzmdbgdxpaw
+vtnihorkulbfejcezmsqqixpaw
+vtnihorkucbfejcxzmsqgdypaw
+vtnihorkulxfajcyzmsqgyxpaw
+vbnihorkulbfescyzmsqgdxpae
+vanshorkulbfejcyzjsqgdxpaw
+vtnihoukulbfejcyzmwqgdxpbw
+vtndhorkulbfejcyxmgqgdxpaw
+ztnihlrkupbfejcyzmsqgdxpaw
+vtoihkrkulbfejhyzmsqgdxpaw
+vtnihorkalbiejcyzmsqgdxeaw
+vtnihorhulcfejcyzqsqgdxpaw
+vtnshotkulbfejcyzmsqvdxpaw
+vtnihoryulbfejcyzmsqgpspaw
+vtnihorkukbfmjcyzmsqgdxpcw
+vtnihorkulbfejcybmsqgdupxw
+vlnihorkulbfejcyzmsqgdmpac
+vtnihorkulbfejcezmfqgdkpaw
+vpnihorkulbfejcyzmsqfdxyaw
+vtnihorkulbjejcysmcqgdxpaw
+vdnihorkulffejcyzisqgdxpaw
+vtnihorkulkfsjcyzrsqgdxpaw
+vtnihorkulqfegoyzmsqgdxpaw
+vtnihorkulbfeyhyzgsqgdxpaw
+vnnihorkulbfejcyzmdqgdxpfw
+vtnihorkulstejcyzmsqgdxpak
+vtnphorkujbfejcczmsqgdxpaw
+vtpihorkulbfejcyzmskgdxiaw
+vtnihorkulbfejcdzmxqsdxpaw
+vtnihorgulbfticyzmsqgdxpaw
+veniuorkulbfejcyzmsqgdmpaw
+vhnihorkclbfejyyzmsqgdxpaw
+vtnihorkulbfejcyzmrqgsrpaw
+dtnihorkzlhfejcyzmsqgdxpaw
+vtnizorkulbfejcyzhsqgdxdaw
+vtnihohkulbfejcybmpqgdxpaw
+vtnihbrzulbfejcyzmsqgdppaw
+stnihorkulmfejcyzmsqgdxeaw
+vtnihorkulbfejmgzwsqgdxpaw
+vtnihcrkulbfnjdyzmsqgdxpaw
+vxxihorkulbfejcyzmsqddxpaw
+vtnhhorkulbfejcyzmsqgdpiaw
+vtnihoakulbfvjcyzmmqgdxpaw
+vtbbhorkulbfejcyqmsqgdxpaw
+vtnihnukulbfejcxzmsqgdxpaw
+vteihorgulkfejcyzmsqgdxpaw
+vbnihorkulbfejcyzmsqgdxpmt
+itnihorkulbuejcyzmsqgdxpxw
+vtnfhqrkulbfejcwzmsqgdxpaw
+vtnihorkubbfedcyzmsqpdxpaw
+rtnihorkulhfejcyzmsqgdxpah
+vtnihorzulbfejcyqmsqqdxpaw
+vtnihorkulbfeecyzmsqgdcgaw
+vtniuorkulbfejpyzmsqxdxpaw
+vtnicorkilbfajcyzmsqgdxpaw
+vtzihorkulbfejcyzmsqgaxpkw
+vtnihomkulbfejcyzmsqgvmpaw
+vznihockulbfejcyzmsqgdjpaw
+vtqmhorkulhfejcyzmsqgdxpaw
+ptnihorkulbfsjcyzbsqgdxpaw
+ftnihorkulbfejcepmsqgdxpaw
+vtnhhorkulbfejyyzxsqgdxpaw
+vtnihorkulbfejcyzmsiwdxpxw
+vtnikorkulbfejvyzmnqgdxpaw
+vtnihorkulbgejoyzmsqhdxpaw
+vtnihorkulbwejqylmsqgdxpaw
+vtnihorkdlbfejcyzwsqgdrpaw
+vtnihorkulbfojcyzmtugdxpaw
+vtnihonkulbtejcyzxsqgdxpaw
+vtnihorkulrfevcyzmsqgdxpcw
+vtnioorkulbfejcynmsqgdxpad
+vtnihorkudffejcyzhsqgdxpaw
+vtnihorkelbfejcqzmsqgdxbaw
+jtnihokkulbfejcyzmsqgdrpaw
+ztnihorrulbfejcyzlsqgdxpaw
+vtwiforkulbfejcyzmsqpdxpaw
+vtnihopvulbfejcyzmsqgzxpaw
+vtnihzrkulafejcyzmsqgdxpaj
+vtnixoekulbfejcyzmsqgdxpak
+vtnihorkulbfejxyzmsqgdxhlw
+vtnihorkulbfwjcyzmmqcdxpaw
+vtnihorkulbfejcywmsdgdxzaw
+vtnihorkulbfejfyzmsqggxuaw
+vtnihnrkurbfejcyzmsqggxpaw
+vtuihorkulbkejcyzmsqgdxpww
+vtnihoriuljfejcyzssqgdxpaw
+vtnihorkulyftjcezmsqgdxpaw
+vtnihorkklbfeccyzmsqgdppaw
+vtnihorkulbfdpcyzmsqgdxpcw
+vtnihqrkulgfejcyzmeqgdxpaw
+vtnihorktlbfejdyzmswgdxpaw
+vinihzrkulbfeacyzmsqgdxpaw
+vtuihorkupbfejcyzmsqgdxplw
+vtnihorkulbfcjcyzmlqgdxpsw
+vtnihorkllbfejcyzmsqgdxvak
+qtnihorkulbfdjcyzusqgdxpaw
+vtniherkulbhejcyzmsqgzxpaw
+vtnzhorgulbfejcyzmsqgdxpew
+vtnihoykulhfjjcyzmsqgdxpaw
+vtnihookulyfejcyzmsqgdxqaw
+jtnihorkulbfejcyzmssgdxpaq
+vtnicorkulwfejcyzmsxgdxpaw
+wtnihorkuubfejcyzmsqgdxpam
+vtnihorkuggfejcyzmsdgdxpaw
+vtnihurkulbfgjcyzmsqrdxpaw
+ptnihorkuabfejcyzmsqgqxpaw
+vtrihoykulbfejcyzmsqgdxpam
+otnihorkulbfejcyzmpqgdxpjw
+vtyihorkulbfejdyznsqgdxpaw
+vtnihornulbfrjcizmsqgdxpaw
+vtnihfrlulbfejcyzmsqgdxpah
+atnihorkulbfejcyossqgdxpaw
+vtnihorkuljfejcyzysqgdxpow
+vtniyorkulbfejcyzmsqgdxbaz
+venihorkulbfejctzmqqgdxpaw
+vtrihorkulbfejcyjmsqgdxpfw
+venitorkulbfexcyzmsqgdxpaw
+vtbihorkulbfejcyzmwqgdxpyw
+vtnihorkuubfejxyzmsqgdxkaw
+vtqihorkulbnejcyzmsqgdxnaw
+vteihorkurbfejcyzmsqwdxpaw
+vtgjhorkxlbfejcyzmsqgdxpaw
+ytniworkulbfejcyzmsqgdxptw
+vtnihorkulbfejcyzmsvgixhaw
+dtnihorkusbfejcyzmsqidxpaw
+vtnihurkulbfejcdzmkqgdxpaw
+vtgihorkulbfejcyzhsqgdxpaf
+vtniudrkulbfeacyzmsqgdxpaw
+vtnihorkulbfejcyemsokdxpaw
+vtnihorkulbfejcyjmwqgdxpag
+vtnihorpulbfetcpzmsqgdxpaw
+ctnzhorkulbfejcyzmfqgdxpaw
+vanihorkuhbwejcyzmsqgdxpaw
+vtnihonkurbfejcyzvsqgdxpaw
+vtnihgrkulbcejcbzmsqgdxpaw
+vtnihorkutbfeacyzmsqcdxpaw
+vtniaorkuhbfqjcyzmsqgdxpaw
+vtnihorkylbfozcyzmsqgdxpaw
+vtnihorkulbfejcypmfqgdxpbw
+vtrphonkulbfejcyzmsqgdxpaw
+vtnihorkulbdejcywmsqydxpaw
+vtnikorkulbfejvyzknqgdxpaw
+vznihorkulbfejcyzmsqbdxpam
+vtmghorkulbfejcyzmsqghxpaw
+vtnihorkulbfejcyzmshglxpfw
+vtiihorkulbfejcjzmsqgdxoaw
+rtnihorkulbfejcuzmsqgdxpow
+vtnthoikulbuejcyzmsqgdxpaw
+vtniholkulbfcjcyzmsqgdxpvw
+vdnihorkulbbejcyzmsqgdxdaw
+ntnihorkulbfojcyzmsqgdxzaw
+vtniqorkulbfejcyzklqgdxpaw
+vtnihorkulhfejcpzmsqgdxprw
+vhnihorkulqfejcyzmsqgdapaw
+vtnihorkolafejcyzmsqadxpaw
+vtnihorkulbpejcyzasqgtxpaw
+vtnihgiyulbfejcyzmsqgdxpaw
+dtnihorkulbffjcyzmsqgdfpaw
+vtnvhorhulbfejcyzmpqgdxpaw
+vtniholkulbfebcyzmsqgnxpaw
+vunihorkulbbejcyznsqgdxpaw
+vtnihorkulbfehcyomsqgaxpaw
+vtnihorkllboejcyzmsigdxpaw
+vtnihwrkulbfejcywmsqgdxiaw
+vtnoherkulbfbjcyzmsqgdxpaw
+vtnbhorkulbfejcyzmsqgkxpaa
+vtnihorkilbfdjxyzmsqgdxpaw
+vtnfhorkuvbfejcyzmsqgixpaw
+vtnyhorkulbpejcyzmsqgdxjaw
+vtnihomkalbfejcyzmqqgdxpaw
+vtnihorkulbfejcybmsqgjxvaw
+vtnihorkulbfgjcnzmsqbdxpaw
+vtnihorkulbfejcyzmpqgsxpap
+lmnihorkulbfejcizmsqgdxpaw
+vtmahkrkulbfejcyzmsqgdxpaw
+vtnihorkulbfujcyrcsqgdxpaw
+vtnzhorkulbfejcyzjvqgdxpaw
+vtnicorkulbfejmyzmsqgdxvaw
+vtnyhojkulbfejcyzmsngdxpaw
+vtnuhorkulbfejcyzlsqgdxpmw
+vtnihorkulufejcgzmtqgdxpaw
+vtnihfrkulbfejnyzmsigdxpaw
+vtnzhorkulbdejnyzmsqgdxpaw
+vttihorkulbfejcyzmyqgdxwaw
+vknihorkulbfejnylmsqgdxpaw
+vtnihorkulbfejcfrmsqgdxpaz
+vtnchormulbfejcyzmsqgdopaw
+vtnihorkulbfebcyzusqgdxpam
+jtnihorwulbfejcyzksqgdxpaw
+ctnihodkutbfejcyzmsqgdxpaw
+vonihorkultfejcyzmsqgixpaw
+vtnihorkulbqejcyzmsqgdypcw
+vfnihorkulbfbjcyzmsqcdxpaw
+utnihorkulbfejcyqmsqgdxraw
+vtnihorkjllfejcyzmskgdxpaw
+vtnihorkulbfejcyvisqgdapaw
+vtnihorkclzfejcyzmsqvdxpaw
+vtnihwrkvlffejcyzmsqgdxpaw
+vtnihlrkulbfejcrzmsqydxpaw
+vtnihorkulbfbjtysmsqgdxpaw
+vtnihorkulbfxjcepmsqgdxpaw
+ttnihorkulbfejpyzmsqgdxpaz
+vtnwhorkolbfejcdzmsqgdxpaw
+vtnihorkulbfejcyzdsqgdxppn
+vtnwporkulbfercyzmsqgdxpaw
+vtnshorxuvbfejcyzmsqgdxpaw
+vtnihxrkulbfejcyomsqfdxpaw
+vtnwhorkrljfejcyzmsqgdxpaw
+vqnihorkulbfejcyzmtqgdxpuw
+vtnnhorkulbfhrcyzmsqgdxpaw
+vtuihwrkulbfedcyzmsqgdxpaw
+vtgbhorkucbfejcyzmsqgdxpaw
+vtnitorkulbfejcozmsqgdkpaw
+otnihomkulbfejcyzmsqgdxhaw
+vtnihgrkulbfrjcyzmsqxdxpaw
+vtnihorkulbfujcyzmsqghxpzw
+vsnihopkhlbfejcyzmsqgdxpaw
+vtniherkulbfejcyzmpzgdxpaw
+vtnxhorkulbfejcszmsqgdxcaw
+vtnihorkulbfejctzmsxadxpaw
+vtnihorkslbmejcyzmsqgnxpaw
+vtnwhorgulbfegcyzmsqgdxpaw
+vtnihorkulbfsjcyzmsqgdxiau
+vtnihorkulbfejcyzmsqldxpbj
+vtnghorkulbfmjcyzmsqgdxpaa
+vtnihorkulbfetcyzmpqudxpaw
+vtnbhorkulbfejcyzmsqgdupyw
+ntnihorhulbfejwyzmsqgdxpaw
+vjnihorkulbfejcyqosqgdxpaw
+vtiihorbulbfejcbzmsqgdxpaw
+vtnihorkulbfejxlzmpqgdxpaw
+vtnihorkolbfejcyfmsqgdxraw
+vtnihqrrulbfedcyzmsqgdxpaw
+ctnihorkulbfejcyzmsqgdxpsy
+vtnihorkulbfkjcezmspgdxpaw
+ztnihorkulbmcjcyzmsqgdxpaw
+vinihorkulbfedcyzmsqgdxpau
diff --git a/src/02/part1 b/src/02/part1 new file mode 100644 index 0000000..43358f4 --- /dev/null +++ b/src/02/part1 @@ -0,0 +1,50 @@ +--- Day 2: Inventory Management System --- + +You stop falling through time, catch your breath, and check the screen on the device. "Destination +reached. Current Year: 1518. Current Location: North Pole Utility Closet 83N10." You made it! Now, +to find those anomalies. + +Outside the utility closet, you hear footsteps and a voice. "...I'm not sure either. But now that so +many people have chimneys, maybe he could sneak in that way?" Another voice responds, "Actually, +we've been working on a new kind of [1m[97msuit[0m that would let him fit through tight spaces like that. But, +I heard that a few days ago, they lost the prototype fabric, the design plans, everything! Nobody on +the team can even seem to remember important details of the project!" + +"Wouldn't they have had enough fabric to fill several boxes in the warehouse? They'd be stored +together, so the box IDs should be similar. Too bad it would take forever to search the warehouse +for [1m[97mtwo similar box IDs[0m..." They walk too far away to hear any more. + +Late at night, you sneak to the warehouse - who knows what kinds of paradoxes you could cause if you +were discovered - and use your fancy wrist device to quickly scan every box and produce a list of +the likely candidates (your puzzle input). + +To make sure you didn't miss any, you scan the likely candidate boxes again, counting the number +that have an ID containing [1m[97mexactly two of any letter[0m and then separately counting those with +[1m[97mexactly three of any letter[0m. You can multiply those two counts together to get a rudimentary +checksum and compare it to what your device predicts. + +For example, if you see the following box IDs: + + + - abcdef contains no letters that appear exactly two or three times. + + - bababc contains two a and three b, so it counts for both. + + - abbcde contains two b, but no letter appears exactly three times. + + - abcccd contains three c, but no letter appears exactly two times. + + - aabcdd contains two a and two d, but it only counts once. + + - abcdee contains two e. + + - ababab contains three a and three b, but it only counts once. + + +Of these box IDs, four of them contain a letter which appears exactly twice, and three of them +contain a letter which appears exactly three times. Multiplying these together produces a checksum +of 4 * 3 = 12. + +[1m[97mWhat is the checksum[0m for your list of box IDs? + + diff --git a/src/02/part2 b/src/02/part2 new file mode 100644 index 0000000..cf1b625 --- /dev/null +++ b/src/02/part2 @@ -0,0 +1,41 @@ +--- Part Two --- + +"Good, the new computer seems to be working correctly! [1m[97mKeep it nearby[0m during this mission - you'll +probably use it again. Real Intcode computers support many more features than your new one, but +we'll let you know what they are as you need them." + +"However, your current priority should be to complete your gravity assist around the Moon. For this +mission to succeed, we should settle on some terminology for the parts you've already built." + +Intcode programs are given as a list of integers; these values are used as the initial state for the +computer's [1m[97mmemory[0m. When you run an Intcode program, make sure to start by initializing memory to the +program's values. A position in memory is called an [1m[97maddress[0m (for example, the first value in memory +is at "address 0"). + +Opcodes (like 1, 2, or 99) mark the beginning of an [1m[97minstruction[0m. The values used immediately after +an opcode, if any, are called the instruction's [1m[97mparameters[0m. For example, in the instruction +1,2,3,4, 1 is the opcode; 2, 3, and 4 are the parameters. The instruction 99 contains only an opcode +and has no parameters. + +The address of the current instruction is called the [1m[97minstruction pointer[0m; it starts at 0. After an +instruction finishes, the instruction pointer increases by [1m[97mthe number of values in the +instruction[0m; until you add more instructions to the computer, this is always 4 (1 opcode + 3 +parameters) for the add and multiply instructions. (The halt instruction would increase the +instruction pointer by 1, but it halts the program instead.) + +"With terminology out of the way, we're ready to proceed. To complete the gravity assist, you need +to [1m[97mdetermine what pair of inputs produces the output 19690720[0m." + +The inputs should still be provided to the program by replacing the values at addresses 1 and 2, +just like before. In this program, the value placed in address 1 is called the [1m[97mnoun[0m, and the value +placed in address 2 is called the [1m[97mverb[0m. Each of the two input values will be between 0 and 99, +inclusive. + +Once the program has halted, its output is available at address 0, also just like before. Each time +you try a pair of inputs, make sure you first [1m[97mreset the computer's memory to the values in the +program[0m (your puzzle input) - in other words, don't reuse memory from a previous attempt. + +Find the input [1m[97mnoun[0m and [1m[97mverb[0m that cause the program to produce the output 19690720. [1m[97mWhat is 100 * +noun + verb?[0m (For example, if noun=12 and verb=2, the answer would be 1202.) + + diff --git a/src/02/solve.py b/src/02/solve.py new file mode 100644 index 0000000..6b3594f --- /dev/null +++ b/src/02/solve.py @@ -0,0 +1,40 @@ +import sys
+sys.path.append("../common")
+import aoc
+
+data = aoc.data.split("\n")
+
+def solve1(args):
+ doubles = 0
+ triples = 0
+ for s in data:
+ counts = list((0,) * 26)
+ for c in s:
+ counts[ord(c[0])-97] += 1
+ if 2 in counts:
+ doubles += 1
+ if 3 in counts:
+ triples += 1
+ return doubles * triples
+
+def compare(s1, s2):
+ dif = 0
+ same = list()
+ for i in range(len(s1)):
+ if s1[i] != s2[i]:
+ dif += 1
+ else:
+ same.append(s1[i])
+ return (dif, same)
+
+def solve2(args):
+ for i in range(len(data)):
+ for j in range(i, len(data)):
+ if i == j:
+ continue
+ res = compare(data[i], data[j])
+ if res[0] == 1:
+ return "".join(res[1])
+
+
+aoc.run(solve1, solve2, sols=[3952, "vtnikorkulbfejvyznqgdxpaw"])
diff --git a/src/03/input b/src/03/input new file mode 100644 index 0000000..2947617 --- /dev/null +++ b/src/03/input @@ -0,0 +1,1347 @@ +#1 @ 916,616: 21x29
+#2 @ 182,253: 29x10
+#3 @ 5,24: 16x17
+#4 @ 369,697: 17x19
+#5 @ 268,954: 28x23
+#6 @ 974,162: 22x14
+#7 @ 178,904: 18x14
+#8 @ 304,923: 29x28
+#9 @ 597,714: 11x24
+#10 @ 453,481: 22x13
+#11 @ 152,717: 22x18
+#12 @ 637,836: 18x14
+#13 @ 248,522: 12x22
+#14 @ 378,677: 14x18
+#15 @ 136,571: 10x17
+#16 @ 928,358: 21x13
+#17 @ 627,767: 10x20
+#18 @ 347,955: 15x28
+#19 @ 241,629: 12x11
+#20 @ 545,53: 14x12
+#21 @ 70,931: 18x19
+#22 @ 723,235: 22x21
+#23 @ 770,799: 12x12
+#24 @ 177,775: 10x19
+#25 @ 968,858: 20x28
+#26 @ 761,321: 17x24
+#27 @ 664,421: 10x23
+#28 @ 353,417: 29x27
+#29 @ 219,243: 26x22
+#30 @ 132,378: 10x10
+#31 @ 275,648: 19x20
+#32 @ 285,88: 29x22
+#33 @ 595,862: 18x22
+#34 @ 101,955: 12x28
+#35 @ 390,824: 11x28
+#36 @ 803,340: 19x27
+#37 @ 240,447: 22x10
+#38 @ 962,943: 19x29
+#39 @ 489,195: 18x19
+#40 @ 870,841: 22x28
+#41 @ 717,945: 28x26
+#42 @ 173,784: 12x14
+#43 @ 40,909: 10x19
+#44 @ 220,541: 16x25
+#45 @ 248,213: 25x23
+#46 @ 584,900: 11x23
+#47 @ 722,486: 11x15
+#48 @ 682,976: 20x10
+#49 @ 284,838: 23x25
+#50 @ 486,646: 19x15
+#51 @ 434,698: 18x28
+#52 @ 515,922: 23x16
+#53 @ 99,370: 24x16
+#54 @ 694,316: 15x14
+#55 @ 599,409: 20x26
+#56 @ 540,465: 21x25
+#57 @ 227,616: 29x17
+#58 @ 134,620: 17x13
+#59 @ 749,156: 24x10
+#60 @ 240,665: 12x10
+#61 @ 96,364: 25x26
+#62 @ 465,565: 25x12
+#63 @ 833,983: 24x10
+#64 @ 683,226: 18x17
+#65 @ 152,372: 15x21
+#66 @ 782,831: 28x11
+#67 @ 320,948: 24x16
+#68 @ 144,821: 12x11
+#69 @ 737,677: 24x13
+#70 @ 155,926: 12x25
+#71 @ 757,418: 19x15
+#72 @ 418,712: 29x10
+#73 @ 475,607: 21x26
+#74 @ 646,202: 23x10
+#75 @ 276,595: 22x14
+#76 @ 943,801: 10x17
+#77 @ 674,186: 29x21
+#78 @ 69,284: 28x20
+#79 @ 921,772: 11x17
+#80 @ 477,722: 18x23
+#81 @ 159,379: 23x10
+#82 @ 594,159: 23x17
+#83 @ 804,559: 29x18
+#84 @ 257,113: 28x26
+#85 @ 554,655: 19x27
+#86 @ 33,468: 28x29
+#87 @ 274,156: 13x11
+#88 @ 589,365: 22x17
+#89 @ 609,736: 10x8
+#90 @ 263,820: 16x14
+#91 @ 403,279: 14x19
+#92 @ 838,782: 19x26
+#93 @ 354,731: 28x24
+#94 @ 215,969: 28x13
+#95 @ 644,715: 22x16
+#96 @ 612,784: 16x21
+#97 @ 685,811: 25x13
+#98 @ 377,236: 18x19
+#99 @ 563,425: 18x15
+#100 @ 609,342: 29x24
+#101 @ 801,427: 26x18
+#102 @ 675,371: 12x26
+#103 @ 270,80: 26x11
+#104 @ 757,608: 22x22
+#105 @ 916,752: 29x25
+#106 @ 317,767: 22x15
+#107 @ 844,222: 17x21
+#108 @ 811,664: 26x15
+#109 @ 822,257: 26x13
+#110 @ 694,340: 17x12
+#111 @ 795,423: 26x23
+#112 @ 177,311: 4x10
+#113 @ 151,820: 12x18
+#114 @ 841,608: 27x29
+#115 @ 170,435: 17x21
+#116 @ 200,626: 28x20
+#117 @ 944,767: 15x11
+#118 @ 870,192: 12x18
+#119 @ 497,203: 27x23
+#120 @ 391,247: 13x22
+#121 @ 161,724: 15x22
+#122 @ 244,947: 10x17
+#123 @ 663,289: 21x26
+#124 @ 58,460: 17x16
+#125 @ 566,398: 19x18
+#126 @ 412,651: 19x11
+#127 @ 555,658: 28x27
+#128 @ 807,444: 10x18
+#129 @ 780,5: 14x16
+#130 @ 990,472: 3x4
+#131 @ 642,593: 20x29
+#132 @ 44,340: 26x11
+#133 @ 372,183: 23x17
+#134 @ 474,771: 21x25
+#135 @ 570,313: 26x28
+#136 @ 390,104: 15x11
+#137 @ 234,113: 19x11
+#138 @ 95,862: 21x23
+#139 @ 481,700: 17x25
+#140 @ 570,310: 18x23
+#141 @ 582,447: 10x11
+#142 @ 25,831: 14x15
+#143 @ 582,323: 17x23
+#144 @ 478,281: 29x14
+#145 @ 935,274: 15x13
+#146 @ 664,967: 15x11
+#147 @ 473,567: 14x29
+#148 @ 682,331: 15x13
+#149 @ 859,734: 20x19
+#150 @ 456,668: 15x16
+#151 @ 346,674: 29x28
+#152 @ 588,117: 20x22
+#153 @ 405,808: 11x25
+#154 @ 486,248: 20x18
+#155 @ 57,745: 21x10
+#156 @ 93,840: 17x15
+#157 @ 62,396: 23x14
+#158 @ 897,817: 14x28
+#159 @ 192,178: 23x28
+#160 @ 619,213: 16x18
+#161 @ 502,559: 14x11
+#162 @ 758,672: 25x15
+#163 @ 459,886: 22x18
+#164 @ 87,723: 28x11
+#165 @ 119,465: 22x11
+#166 @ 956,943: 23x21
+#167 @ 119,812: 25x15
+#168 @ 916,3: 14x16
+#169 @ 323,750: 14x25
+#170 @ 930,48: 28x10
+#171 @ 342,956: 25x17
+#172 @ 145,125: 10x16
+#173 @ 852,80: 28x14
+#174 @ 143,704: 26x19
+#175 @ 142,350: 15x20
+#176 @ 965,7: 16x19
+#177 @ 363,672: 24x18
+#178 @ 256,766: 23x24
+#179 @ 590,883: 24x26
+#180 @ 35,32: 14x25
+#181 @ 383,215: 10x21
+#182 @ 453,875: 12x25
+#183 @ 632,30: 12x26
+#184 @ 234,584: 21x28
+#185 @ 689,859: 14x27
+#186 @ 157,83: 19x24
+#187 @ 906,331: 15x27
+#188 @ 633,35: 13x13
+#189 @ 772,685: 20x16
+#190 @ 904,382: 12x21
+#191 @ 273,110: 17x29
+#192 @ 919,361: 16x14
+#193 @ 562,281: 13x10
+#194 @ 480,641: 14x27
+#195 @ 504,778: 17x21
+#196 @ 694,464: 27x21
+#197 @ 625,282: 10x25
+#198 @ 812,986: 22x10
+#199 @ 141,317: 27x13
+#200 @ 742,805: 18x12
+#201 @ 681,596: 20x27
+#202 @ 752,170: 26x11
+#203 @ 405,548: 25x15
+#204 @ 7,11: 14x27
+#205 @ 103,686: 21x21
+#206 @ 664,580: 13x29
+#207 @ 348,310: 20x28
+#208 @ 926,95: 12x13
+#209 @ 755,694: 20x29
+#210 @ 258,435: 20x21
+#211 @ 814,669: 14x22
+#212 @ 582,41: 29x18
+#213 @ 587,983: 3x3
+#214 @ 739,359: 18x27
+#215 @ 738,156: 21x29
+#216 @ 230,651: 21x28
+#217 @ 144,597: 25x22
+#218 @ 472,196: 12x29
+#219 @ 748,532: 22x14
+#220 @ 16,717: 20x11
+#221 @ 833,370: 22x12
+#222 @ 972,81: 18x19
+#223 @ 828,239: 13x10
+#224 @ 610,839: 23x23
+#225 @ 869,228: 21x12
+#226 @ 281,645: 25x21
+#227 @ 0,533: 18x27
+#228 @ 533,725: 27x17
+#229 @ 10,973: 29x25
+#230 @ 973,819: 24x20
+#231 @ 35,42: 26x28
+#232 @ 631,601: 26x29
+#233 @ 923,573: 19x21
+#234 @ 743,526: 20x24
+#235 @ 381,765: 17x15
+#236 @ 811,589: 12x28
+#237 @ 578,307: 24x20
+#238 @ 562,368: 28x13
+#239 @ 641,615: 16x28
+#240 @ 912,235: 29x20
+#241 @ 762,804: 13x13
+#242 @ 591,165: 25x25
+#243 @ 588,19: 28x12
+#244 @ 371,699: 12x13
+#245 @ 136,460: 22x13
+#246 @ 680,828: 20x14
+#247 @ 651,318: 26x17
+#248 @ 829,500: 27x13
+#249 @ 552,469: 10x29
+#250 @ 983,686: 15x16
+#251 @ 428,442: 25x11
+#252 @ 819,114: 24x12
+#253 @ 762,632: 11x12
+#254 @ 618,843: 25x12
+#255 @ 38,380: 20x25
+#256 @ 349,24: 29x25
+#257 @ 107,172: 28x19
+#258 @ 751,349: 18x20
+#259 @ 150,419: 20x16
+#260 @ 205,579: 17x17
+#261 @ 190,456: 29x12
+#262 @ 126,722: 14x19
+#263 @ 658,936: 22x12
+#264 @ 835,3: 26x28
+#265 @ 268,604: 24x15
+#266 @ 753,737: 15x19
+#267 @ 142,934: 19x28
+#268 @ 908,166: 12x16
+#269 @ 471,923: 16x13
+#270 @ 42,777: 16x16
+#271 @ 145,310: 11x19
+#272 @ 301,629: 28x18
+#273 @ 206,976: 21x22
+#274 @ 482,567: 10x26
+#275 @ 724,515: 23x11
+#276 @ 290,735: 24x19
+#277 @ 33,157: 20x14
+#278 @ 89,591: 13x23
+#279 @ 194,608: 20x17
+#280 @ 297,914: 17x28
+#281 @ 13,320: 21x20
+#282 @ 652,204: 11x5
+#283 @ 374,476: 20x13
+#284 @ 224,580: 26x18
+#285 @ 482,633: 26x26
+#286 @ 779,921: 15x13
+#287 @ 693,963: 25x25
+#288 @ 907,136: 28x19
+#289 @ 605,942: 14x29
+#290 @ 212,633: 10x18
+#291 @ 466,652: 15x21
+#292 @ 217,692: 12x20
+#293 @ 445,13: 11x21
+#294 @ 628,907: 18x20
+#295 @ 713,214: 11x11
+#296 @ 172,604: 11x16
+#297 @ 87,187: 21x26
+#298 @ 107,845: 14x25
+#299 @ 387,555: 22x11
+#300 @ 581,710: 29x29
+#301 @ 142,293: 12x25
+#302 @ 663,830: 28x15
+#303 @ 529,914: 10x21
+#304 @ 809,90: 15x14
+#305 @ 50,510: 29x19
+#306 @ 588,457: 15x21
+#307 @ 272,224: 20x26
+#308 @ 84,138: 15x25
+#309 @ 484,429: 12x23
+#310 @ 777,15: 22x23
+#311 @ 520,510: 13x24
+#312 @ 931,156: 18x23
+#313 @ 834,30: 27x12
+#314 @ 797,920: 23x24
+#315 @ 466,319: 21x10
+#316 @ 723,786: 13x27
+#317 @ 319,629: 10x24
+#318 @ 143,429: 10x18
+#319 @ 260,188: 11x16
+#320 @ 75,270: 21x13
+#321 @ 99,84: 18x13
+#322 @ 836,570: 19x20
+#323 @ 920,513: 25x16
+#324 @ 460,852: 15x27
+#325 @ 77,910: 11x22
+#326 @ 738,281: 19x24
+#327 @ 884,183: 23x29
+#328 @ 945,302: 16x10
+#329 @ 169,38: 12x29
+#330 @ 748,165: 11x17
+#331 @ 895,719: 10x6
+#332 @ 570,524: 13x16
+#333 @ 55,742: 22x11
+#334 @ 616,34: 14x17
+#335 @ 662,596: 10x19
+#336 @ 441,205: 27x15
+#337 @ 286,9: 12x23
+#338 @ 481,954: 10x24
+#339 @ 825,83: 22x21
+#340 @ 949,943: 11x13
+#341 @ 765,258: 24x28
+#342 @ 762,600: 13x14
+#343 @ 616,72: 18x15
+#344 @ 513,54: 10x25
+#345 @ 612,226: 21x28
+#346 @ 836,73: 13x15
+#347 @ 226,422: 18x18
+#348 @ 433,794: 12x15
+#349 @ 256,47: 23x18
+#350 @ 106,210: 13x13
+#351 @ 721,614: 14x29
+#352 @ 12,616: 29x16
+#353 @ 151,253: 21x16
+#354 @ 565,673: 11x18
+#355 @ 135,826: 25x29
+#356 @ 755,770: 19x17
+#357 @ 520,125: 23x18
+#358 @ 139,78: 17x11
+#359 @ 753,793: 15x29
+#360 @ 730,108: 14x15
+#361 @ 755,827: 23x28
+#362 @ 613,122: 29x16
+#363 @ 152,252: 18x29
+#364 @ 715,763: 19x22
+#365 @ 822,215: 10x18
+#366 @ 730,725: 13x21
+#367 @ 842,289: 14x11
+#368 @ 704,636: 29x10
+#369 @ 451,486: 20x16
+#370 @ 767,389: 12x12
+#371 @ 621,29: 14x18
+#372 @ 407,335: 10x20
+#373 @ 55,762: 23x19
+#374 @ 393,794: 20x29
+#375 @ 545,494: 14x10
+#376 @ 585,411: 22x11
+#377 @ 93,698: 29x14
+#378 @ 792,523: 17x25
+#379 @ 249,36: 18x12
+#380 @ 220,141: 4x3
+#381 @ 576,826: 9x3
+#382 @ 9,531: 12x24
+#383 @ 381,332: 13x25
+#384 @ 960,810: 23x11
+#385 @ 470,925: 10x12
+#386 @ 76,36: 18x12
+#387 @ 376,690: 13x24
+#388 @ 913,707: 15x26
+#389 @ 881,192: 29x10
+#390 @ 255,462: 15x14
+#391 @ 609,854: 11x18
+#392 @ 607,163: 27x27
+#393 @ 823,570: 28x20
+#394 @ 888,532: 10x25
+#395 @ 835,452: 26x27
+#396 @ 95,359: 29x20
+#397 @ 89,363: 17x26
+#398 @ 348,966: 12x15
+#399 @ 848,657: 14x24
+#400 @ 916,45: 15x10
+#401 @ 720,729: 27x29
+#402 @ 859,743: 18x14
+#403 @ 236,661: 28x12
+#404 @ 158,726: 22x20
+#405 @ 42,981: 22x18
+#406 @ 396,112: 21x28
+#407 @ 249,679: 18x19
+#408 @ 573,663: 25x10
+#409 @ 65,355: 11x12
+#410 @ 688,530: 15x23
+#411 @ 539,110: 24x21
+#412 @ 852,491: 18x27
+#413 @ 565,979: 29x14
+#414 @ 897,530: 18x13
+#415 @ 331,654: 19x25
+#416 @ 726,395: 23x14
+#417 @ 22,639: 27x15
+#418 @ 647,913: 19x29
+#419 @ 961,955: 24x26
+#420 @ 927,324: 19x15
+#421 @ 689,336: 24x23
+#422 @ 817,648: 21x12
+#423 @ 663,283: 19x23
+#424 @ 454,960: 20x14
+#425 @ 276,158: 10x11
+#426 @ 766,736: 23x24
+#427 @ 102,726: 29x15
+#428 @ 116,668: 14x24
+#429 @ 915,97: 15x18
+#430 @ 349,423: 24x17
+#431 @ 381,91: 18x23
+#432 @ 115,110: 29x21
+#433 @ 559,220: 23x17
+#434 @ 150,659: 15x27
+#435 @ 675,590: 16x15
+#436 @ 624,340: 27x13
+#437 @ 564,677: 23x10
+#438 @ 78,278: 14x18
+#439 @ 163,606: 29x11
+#440 @ 360,356: 15x15
+#441 @ 927,300: 26x26
+#442 @ 104,585: 22x21
+#443 @ 512,352: 11x13
+#444 @ 688,506: 16x21
+#445 @ 406,402: 24x16
+#446 @ 612,157: 13x14
+#447 @ 217,693: 21x20
+#448 @ 822,247: 27x23
+#449 @ 761,412: 22x18
+#450 @ 744,247: 24x16
+#451 @ 656,432: 24x11
+#452 @ 441,854: 12x20
+#453 @ 532,106: 27x12
+#454 @ 128,248: 28x25
+#455 @ 502,769: 24x16
+#456 @ 552,231: 14x29
+#457 @ 108,882: 19x26
+#458 @ 897,0: 24x22
+#459 @ 69,783: 12x12
+#460 @ 854,181: 20x20
+#461 @ 177,46: 29x29
+#462 @ 200,696: 17x20
+#463 @ 164,202: 23x17
+#464 @ 760,630: 17x18
+#465 @ 889,779: 11x21
+#466 @ 667,525: 24x12
+#467 @ 500,188: 13x14
+#468 @ 942,650: 23x23
+#469 @ 331,395: 24x26
+#470 @ 564,41: 18x16
+#471 @ 122,154: 29x28
+#472 @ 931,865: 15x11
+#473 @ 532,441: 12x28
+#474 @ 286,0: 18x18
+#475 @ 208,641: 16x14
+#476 @ 423,490: 26x26
+#477 @ 643,185: 12x29
+#478 @ 323,159: 24x13
+#479 @ 848,642: 26x14
+#480 @ 311,890: 24x16
+#481 @ 174,444: 8x8
+#482 @ 14,24: 16x20
+#483 @ 805,931: 15x19
+#484 @ 117,327: 19x20
+#485 @ 821,503: 19x28
+#486 @ 477,926: 20x10
+#487 @ 631,637: 18x12
+#488 @ 889,558: 11x17
+#489 @ 732,750: 17x18
+#490 @ 265,10: 28x15
+#491 @ 444,3: 21x28
+#492 @ 109,867: 27x24
+#493 @ 15,327: 23x24
+#494 @ 409,550: 16x10
+#495 @ 178,205: 24x23
+#496 @ 380,492: 22x16
+#497 @ 772,228: 11x20
+#498 @ 416,279: 14x26
+#499 @ 911,563: 22x11
+#500 @ 144,916: 25x27
+#501 @ 575,425: 21x25
+#502 @ 356,780: 11x28
+#503 @ 226,897: 29x13
+#504 @ 594,317: 23x19
+#505 @ 289,121: 12x12
+#506 @ 574,926: 29x13
+#507 @ 754,882: 13x10
+#508 @ 614,709: 12x27
+#509 @ 835,680: 17x12
+#510 @ 720,475: 29x11
+#511 @ 808,311: 10x16
+#512 @ 812,944: 10x11
+#513 @ 113,83: 10x16
+#514 @ 541,246: 18x21
+#515 @ 729,339: 17x25
+#516 @ 862,853: 17x24
+#517 @ 303,423: 26x22
+#518 @ 61,469: 16x17
+#519 @ 567,234: 10x23
+#520 @ 868,92: 15x13
+#521 @ 619,809: 12x20
+#522 @ 799,619: 23x27
+#523 @ 552,422: 26x27
+#524 @ 860,662: 23x12
+#525 @ 425,556: 15x17
+#526 @ 566,565: 29x10
+#527 @ 437,494: 26x10
+#528 @ 554,116: 23x10
+#529 @ 52,386: 11x17
+#530 @ 475,702: 29x20
+#531 @ 853,874: 10x21
+#532 @ 761,245: 11x25
+#533 @ 646,88: 12x21
+#534 @ 79,578: 12x23
+#535 @ 544,88: 16x29
+#536 @ 328,160: 29x17
+#537 @ 357,331: 26x22
+#538 @ 590,922: 23x19
+#539 @ 975,86: 17x14
+#540 @ 546,104: 26x26
+#541 @ 36,665: 25x25
+#542 @ 310,778: 16x21
+#543 @ 145,420: 20x10
+#544 @ 948,246: 16x28
+#545 @ 157,839: 15x24
+#546 @ 596,169: 23x19
+#547 @ 489,134: 25x14
+#548 @ 932,265: 22x20
+#549 @ 370,740: 27x14
+#550 @ 496,426: 28x11
+#551 @ 104,881: 26x16
+#552 @ 550,356: 17x23
+#553 @ 423,426: 24x22
+#554 @ 888,936: 25x25
+#555 @ 732,843: 27x27
+#556 @ 622,537: 17x23
+#557 @ 617,31: 25x16
+#558 @ 501,434: 10x17
+#559 @ 401,611: 27x16
+#560 @ 862,751: 21x20
+#561 @ 254,131: 11x19
+#562 @ 573,129: 19x21
+#563 @ 211,159: 20x17
+#564 @ 225,906: 21x19
+#565 @ 321,244: 14x18
+#566 @ 767,433: 23x23
+#567 @ 949,799: 12x14
+#568 @ 445,198: 26x24
+#569 @ 41,658: 29x19
+#570 @ 256,318: 19x25
+#571 @ 574,153: 18x29
+#572 @ 62,323: 3x8
+#573 @ 817,653: 28x12
+#574 @ 959,266: 19x27
+#575 @ 575,747: 29x19
+#576 @ 103,359: 19x27
+#577 @ 848,228: 12x28
+#578 @ 5,591: 29x29
+#579 @ 161,409: 10x24
+#580 @ 247,297: 10x28
+#581 @ 725,483: 17x21
+#582 @ 236,966: 14x22
+#583 @ 831,111: 19x11
+#584 @ 192,587: 22x26
+#585 @ 156,603: 14x20
+#586 @ 565,809: 29x25
+#587 @ 394,22: 25x27
+#588 @ 941,870: 16x16
+#589 @ 568,740: 12x16
+#590 @ 773,912: 22x12
+#591 @ 799,405: 13x16
+#592 @ 30,967: 28x19
+#593 @ 776,272: 22x17
+#594 @ 276,801: 15x18
+#595 @ 89,71: 23x26
+#596 @ 902,943: 19x25
+#597 @ 948,146: 28x14
+#598 @ 413,776: 17x12
+#599 @ 799,467: 23x29
+#600 @ 938,243: 23x28
+#601 @ 483,952: 17x29
+#602 @ 6,595: 26x28
+#603 @ 69,516: 13x20
+#604 @ 478,829: 27x29
+#605 @ 382,229: 11x22
+#606 @ 947,201: 12x11
+#607 @ 568,639: 16x25
+#608 @ 475,876: 11x27
+#609 @ 710,216: 10x19
+#610 @ 655,584: 25x14
+#611 @ 482,665: 27x17
+#612 @ 1,189: 17x27
+#613 @ 199,679: 22x29
+#614 @ 439,375: 14x28
+#615 @ 128,321: 24x16
+#616 @ 896,390: 15x15
+#617 @ 945,791: 12x21
+#618 @ 267,84: 18x20
+#619 @ 550,210: 18x15
+#620 @ 667,613: 29x28
+#621 @ 196,311: 25x29
+#622 @ 798,215: 29x23
+#623 @ 939,496: 17x23
+#624 @ 38,232: 25x17
+#625 @ 295,751: 27x15
+#626 @ 766,159: 10x14
+#627 @ 640,902: 15x21
+#628 @ 498,419: 15x27
+#629 @ 795,403: 24x24
+#630 @ 710,367: 29x29
+#631 @ 593,714: 25x29
+#632 @ 821,97: 13x29
+#633 @ 519,500: 28x26
+#634 @ 616,770: 27x22
+#635 @ 354,121: 24x23
+#636 @ 969,32: 11x12
+#637 @ 401,344: 18x24
+#638 @ 588,918: 20x16
+#639 @ 173,907: 16x29
+#640 @ 771,372: 15x23
+#641 @ 799,783: 22x27
+#642 @ 737,98: 28x20
+#643 @ 781,341: 27x29
+#644 @ 35,236: 11x13
+#645 @ 297,935: 26x11
+#646 @ 648,95: 7x4
+#647 @ 28,26: 15x14
+#648 @ 637,828: 13x26
+#649 @ 154,947: 22x19
+#650 @ 302,852: 17x17
+#651 @ 934,150: 20x25
+#652 @ 964,269: 17x21
+#653 @ 503,824: 12x12
+#654 @ 79,70: 25x25
+#655 @ 233,668: 26x24
+#656 @ 479,672: 15x17
+#657 @ 881,161: 28x29
+#658 @ 91,588: 16x27
+#659 @ 138,60: 17x16
+#660 @ 924,626: 22x12
+#661 @ 728,395: 14x17
+#662 @ 840,819: 28x14
+#663 @ 883,215: 12x15
+#664 @ 105,624: 25x13
+#665 @ 752,741: 26x17
+#666 @ 890,572: 23x25
+#667 @ 510,904: 23x28
+#668 @ 220,431: 20x14
+#669 @ 706,806: 20x16
+#670 @ 523,860: 17x18
+#671 @ 818,608: 11x28
+#672 @ 113,727: 18x27
+#673 @ 550,513: 22x13
+#674 @ 163,468: 11x28
+#675 @ 750,629: 17x12
+#676 @ 921,681: 8x10
+#677 @ 687,78: 15x10
+#678 @ 117,637: 27x23
+#679 @ 20,483: 14x28
+#680 @ 413,261: 12x29
+#681 @ 932,258: 17x20
+#682 @ 501,822: 18x18
+#683 @ 368,91: 19x22
+#684 @ 280,684: 15x28
+#685 @ 848,611: 15x12
+#686 @ 48,121: 10x11
+#687 @ 964,881: 28x11
+#688 @ 317,431: 8x3
+#689 @ 771,426: 10x22
+#690 @ 861,373: 14x24
+#691 @ 372,433: 15x10
+#692 @ 788,713: 15x15
+#693 @ 727,796: 21x18
+#694 @ 106,366: 6x21
+#695 @ 172,364: 29x15
+#696 @ 212,878: 19x14
+#697 @ 20,2: 27x12
+#698 @ 741,577: 11x25
+#699 @ 200,229: 24x22
+#700 @ 596,24: 17x18
+#701 @ 282,934: 22x12
+#702 @ 55,615: 28x26
+#703 @ 4,600: 16x19
+#704 @ 387,817: 24x12
+#705 @ 955,100: 17x29
+#706 @ 286,526: 28x23
+#707 @ 144,62: 7x10
+#708 @ 477,231: 15x27
+#709 @ 521,678: 20x20
+#710 @ 279,249: 18x14
+#711 @ 471,336: 20x28
+#712 @ 18,507: 27x14
+#713 @ 576,221: 14x10
+#714 @ 646,705: 12x27
+#715 @ 631,211: 15x28
+#716 @ 680,79: 15x27
+#717 @ 682,360: 14x25
+#718 @ 268,2: 24x19
+#719 @ 469,235: 20x15
+#720 @ 977,373: 13x15
+#721 @ 352,842: 16x19
+#722 @ 310,91: 15x14
+#723 @ 394,539: 20x28
+#724 @ 366,841: 22x10
+#725 @ 644,573: 14x26
+#726 @ 252,815: 19x15
+#727 @ 575,714: 28x21
+#728 @ 23,706: 14x16
+#729 @ 208,607: 25x25
+#730 @ 506,183: 10x13
+#731 @ 641,852: 20x19
+#732 @ 820,533: 10x20
+#733 @ 381,851: 22x11
+#734 @ 799,908: 21x15
+#735 @ 597,96: 24x29
+#736 @ 592,876: 16x11
+#737 @ 945,807: 10x14
+#738 @ 407,578: 27x27
+#739 @ 150,649: 17x25
+#740 @ 615,596: 17x18
+#741 @ 893,717: 16x12
+#742 @ 153,252: 29x10
+#743 @ 186,626: 17x26
+#744 @ 2,596: 10x19
+#745 @ 704,113: 16x29
+#746 @ 716,221: 17x22
+#747 @ 132,912: 21x19
+#748 @ 428,562: 13x12
+#749 @ 528,946: 17x13
+#750 @ 110,213: 14x12
+#751 @ 836,597: 27x22
+#752 @ 786,842: 14x28
+#753 @ 299,769: 26x14
+#754 @ 958,24: 11x15
+#755 @ 93,306: 12x20
+#756 @ 201,803: 23x28
+#757 @ 79,70: 18x19
+#758 @ 52,393: 15x16
+#759 @ 237,320: 16x15
+#760 @ 430,564: 8x7
+#761 @ 566,236: 15x16
+#762 @ 156,829: 18x13
+#763 @ 581,239: 11x23
+#764 @ 307,358: 25x22
+#765 @ 76,841: 13x10
+#766 @ 384,830: 17x26
+#767 @ 901,827: 12x15
+#768 @ 426,653: 14x16
+#769 @ 804,519: 17x26
+#770 @ 45,495: 22x20
+#771 @ 320,948: 22x15
+#772 @ 518,635: 17x20
+#773 @ 886,848: 13x15
+#774 @ 726,546: 18x13
+#775 @ 359,190: 22x28
+#776 @ 705,371: 20x17
+#777 @ 818,518: 28x16
+#778 @ 606,733: 18x27
+#779 @ 639,119: 13x21
+#780 @ 429,788: 18x22
+#781 @ 299,744: 11x20
+#782 @ 189,655: 27x20
+#783 @ 513,665: 12x18
+#784 @ 494,443: 23x25
+#785 @ 75,297: 21x15
+#786 @ 356,679: 29x23
+#787 @ 482,218: 26x25
+#788 @ 500,212: 10x12
+#789 @ 94,661: 23x13
+#790 @ 283,708: 13x26
+#791 @ 597,936: 22x12
+#792 @ 77,94: 21x24
+#793 @ 750,403: 20x13
+#794 @ 368,102: 28x25
+#795 @ 601,88: 23x19
+#796 @ 96,163: 29x26
+#797 @ 326,601: 15x29
+#798 @ 434,289: 9x6
+#799 @ 10,4: 21x28
+#800 @ 42,622: 23x16
+#801 @ 693,221: 11x12
+#802 @ 807,618: 17x12
+#803 @ 763,875: 21x18
+#804 @ 615,641: 22x15
+#805 @ 625,78: 12x20
+#806 @ 591,237: 17x28
+#807 @ 744,585: 10x22
+#808 @ 56,623: 12x11
+#809 @ 606,776: 21x11
+#810 @ 579,25: 15x24
+#811 @ 729,209: 11x25
+#812 @ 667,505: 26x24
+#813 @ 439,18: 18x20
+#814 @ 464,880: 22x11
+#815 @ 757,638: 17x17
+#816 @ 844,272: 16x21
+#817 @ 153,774: 27x22
+#818 @ 267,531: 20x21
+#819 @ 45,783: 6x5
+#820 @ 864,643: 18x25
+#821 @ 162,922: 18x19
+#822 @ 58,319: 11x21
+#823 @ 971,840: 22x24
+#824 @ 87,590: 19x14
+#825 @ 354,419: 13x10
+#826 @ 729,396: 25x12
+#827 @ 660,971: 27x16
+#828 @ 830,777: 11x14
+#829 @ 862,818: 14x25
+#830 @ 142,706: 27x21
+#831 @ 488,335: 11x11
+#832 @ 652,173: 29x29
+#833 @ 482,243: 19x28
+#834 @ 774,434: 22x12
+#835 @ 486,192: 16x14
+#836 @ 6,526: 26x18
+#837 @ 672,75: 16x18
+#838 @ 323,719: 19x23
+#839 @ 693,816: 10x25
+#840 @ 567,123: 19x17
+#841 @ 427,32: 27x29
+#842 @ 549,436: 18x10
+#843 @ 102,496: 27x19
+#844 @ 410,557: 14x26
+#845 @ 935,803: 22x20
+#846 @ 775,233: 27x23
+#847 @ 357,79: 14x22
+#848 @ 771,743: 15x17
+#849 @ 30,613: 27x29
+#850 @ 580,213: 13x19
+#851 @ 933,939: 16x23
+#852 @ 151,309: 11x24
+#853 @ 925,10: 29x15
+#854 @ 97,83: 12x12
+#855 @ 474,479: 16x26
+#856 @ 246,331: 11x17
+#857 @ 972,116: 22x19
+#858 @ 959,104: 22x23
+#859 @ 225,489: 25x29
+#860 @ 428,187: 28x12
+#861 @ 458,883: 28x26
+#862 @ 778,919: 20x20
+#863 @ 785,532: 22x26
+#864 @ 37,496: 10x25
+#865 @ 550,798: 28x19
+#866 @ 634,886: 14x24
+#867 @ 400,762: 18x20
+#868 @ 753,180: 15x12
+#869 @ 403,254: 11x26
+#870 @ 620,696: 19x18
+#871 @ 903,706: 21x16
+#872 @ 31,927: 29x26
+#873 @ 281,816: 23x28
+#874 @ 462,860: 6x6
+#875 @ 131,138: 22x12
+#876 @ 720,92: 20x14
+#877 @ 252,174: 27x13
+#878 @ 243,539: 18x11
+#879 @ 389,39: 17x24
+#880 @ 133,104: 17x18
+#881 @ 182,254: 16x12
+#882 @ 417,374: 20x21
+#883 @ 489,849: 16x19
+#884 @ 354,429: 15x13
+#885 @ 60,345: 19x11
+#886 @ 277,949: 10x10
+#887 @ 517,888: 27x13
+#888 @ 12,930: 20x18
+#889 @ 810,307: 18x17
+#890 @ 78,960: 25x25
+#891 @ 788,206: 12x26
+#892 @ 253,600: 13x20
+#893 @ 459,495: 25x14
+#894 @ 539,785: 11x25
+#895 @ 567,411: 12x21
+#896 @ 531,240: 25x20
+#897 @ 532,922: 15x27
+#898 @ 633,924: 22x20
+#899 @ 791,842: 13x12
+#900 @ 210,666: 13x19
+#901 @ 506,564: 22x17
+#902 @ 278,965: 21x28
+#903 @ 454,968: 15x22
+#904 @ 363,643: 20x10
+#905 @ 468,875: 27x23
+#906 @ 743,759: 18x12
+#907 @ 76,30: 12x20
+#908 @ 607,803: 25x21
+#909 @ 365,751: 21x28
+#910 @ 69,34: 29x17
+#911 @ 70,341: 19x16
+#912 @ 959,681: 28x10
+#913 @ 881,560: 13x14
+#914 @ 315,721: 28x25
+#915 @ 555,737: 29x23
+#916 @ 838,442: 17x23
+#917 @ 5,533: 24x25
+#918 @ 702,547: 17x19
+#919 @ 378,249: 28x22
+#920 @ 72,755: 11x29
+#921 @ 562,805: 27x26
+#922 @ 89,66: 24x23
+#923 @ 404,921: 18x25
+#924 @ 730,369: 14x10
+#925 @ 784,759: 10x15
+#926 @ 641,616: 15x15
+#927 @ 733,523: 26x24
+#928 @ 811,687: 28x28
+#929 @ 905,514: 26x17
+#930 @ 937,5: 19x18
+#931 @ 345,639: 28x18
+#932 @ 253,659: 10x29
+#933 @ 56,614: 15x27
+#934 @ 288,673: 16x27
+#935 @ 779,863: 22x23
+#936 @ 761,819: 15x20
+#937 @ 900,386: 16x26
+#938 @ 921,946: 21x28
+#939 @ 404,152: 11x23
+#940 @ 542,362: 14x23
+#941 @ 873,137: 20x11
+#942 @ 311,897: 14x29
+#943 @ 99,575: 17x20
+#944 @ 352,792: 10x19
+#945 @ 969,120: 27x16
+#946 @ 733,963: 28x23
+#947 @ 437,950: 20x24
+#948 @ 355,367: 14x14
+#949 @ 242,362: 18x21
+#950 @ 618,823: 23x19
+#951 @ 191,398: 16x22
+#952 @ 576,28: 27x16
+#953 @ 247,975: 17x17
+#954 @ 504,937: 19x13
+#955 @ 84,869: 27x27
+#956 @ 35,635: 16x10
+#957 @ 952,979: 19x17
+#958 @ 122,313: 11x29
+#959 @ 219,512: 27x10
+#960 @ 170,943: 26x16
+#961 @ 141,380: 23x12
+#962 @ 364,335: 22x29
+#963 @ 241,220: 12x12
+#964 @ 836,8: 19x24
+#965 @ 121,497: 18x27
+#966 @ 716,106: 19x12
+#967 @ 797,574: 22x16
+#968 @ 464,315: 28x29
+#969 @ 494,702: 22x18
+#970 @ 418,505: 12x28
+#971 @ 169,835: 12x24
+#972 @ 575,689: 17x24
+#973 @ 102,357: 24x25
+#974 @ 199,942: 13x11
+#975 @ 745,743: 12x18
+#976 @ 837,32: 21x15
+#977 @ 700,488: 19x29
+#978 @ 770,644: 29x18
+#979 @ 847,467: 14x28
+#980 @ 673,575: 19x28
+#981 @ 258,475: 27x12
+#982 @ 405,632: 16x13
+#983 @ 591,82: 17x18
+#984 @ 820,376: 21x29
+#985 @ 895,761: 29x23
+#986 @ 111,328: 12x22
+#987 @ 799,299: 21x14
+#988 @ 912,164: 19x12
+#989 @ 110,648: 10x26
+#990 @ 366,40: 10x26
+#991 @ 162,758: 24x13
+#992 @ 645,973: 24x11
+#993 @ 680,812: 20x22
+#994 @ 13,159: 17x14
+#995 @ 724,803: 27x11
+#996 @ 860,745: 12x18
+#997 @ 140,939: 16x26
+#998 @ 237,377: 26x20
+#999 @ 163,935: 23x29
+#1000 @ 578,96: 21x16
+#1001 @ 277,794: 14x12
+#1002 @ 626,261: 10x25
+#1003 @ 735,160: 26x24
+#1004 @ 460,483: 25x14
+#1005 @ 765,257: 16x27
+#1006 @ 888,838: 12x17
+#1007 @ 949,269: 14x14
+#1008 @ 535,771: 21x17
+#1009 @ 620,429: 14x26
+#1010 @ 592,33: 28x24
+#1011 @ 942,163: 22x15
+#1012 @ 132,624: 19x22
+#1013 @ 143,332: 10x21
+#1014 @ 932,652: 15x29
+#1015 @ 358,754: 10x16
+#1016 @ 244,203: 29x16
+#1017 @ 194,406: 6x8
+#1018 @ 524,932: 21x13
+#1019 @ 957,642: 14x24
+#1020 @ 388,626: 19x11
+#1021 @ 730,215: 13x13
+#1022 @ 100,618: 24x10
+#1023 @ 141,568: 17x17
+#1024 @ 902,141: 28x27
+#1025 @ 205,319: 14x12
+#1026 @ 133,380: 14x22
+#1027 @ 784,840: 17x20
+#1028 @ 854,365: 13x27
+#1029 @ 167,465: 14x21
+#1030 @ 366,739: 13x12
+#1031 @ 609,804: 19x11
+#1032 @ 370,257: 25x26
+#1033 @ 150,696: 28x24
+#1034 @ 79,174: 10x22
+#1035 @ 575,878: 28x26
+#1036 @ 200,323: 29x10
+#1037 @ 915,335: 16x11
+#1038 @ 296,718: 24x29
+#1039 @ 402,564: 10x17
+#1040 @ 962,649: 20x12
+#1041 @ 38,126: 14x13
+#1042 @ 677,482: 26x26
+#1043 @ 474,884: 19x10
+#1044 @ 325,962: 29x28
+#1045 @ 405,545: 28x28
+#1046 @ 740,173: 15x26
+#1047 @ 86,34: 24x22
+#1048 @ 802,459: 26x24
+#1049 @ 428,192: 23x14
+#1050 @ 180,613: 28x26
+#1051 @ 984,723: 15x17
+#1052 @ 317,430: 17x10
+#1053 @ 789,835: 12x11
+#1054 @ 675,775: 29x28
+#1055 @ 971,35: 5x3
+#1056 @ 756,272: 13x19
+#1057 @ 665,333: 21x19
+#1058 @ 597,54: 17x26
+#1059 @ 501,867: 28x28
+#1060 @ 392,937: 20x20
+#1061 @ 151,383: 26x26
+#1062 @ 403,372: 12x26
+#1063 @ 471,877: 27x18
+#1064 @ 987,468: 10x22
+#1065 @ 850,612: 14x17
+#1066 @ 686,879: 17x24
+#1067 @ 794,549: 15x10
+#1068 @ 749,45: 22x25
+#1069 @ 636,231: 20x14
+#1070 @ 966,94: 19x15
+#1071 @ 860,486: 14x28
+#1072 @ 599,698: 11x28
+#1073 @ 2,154: 29x27
+#1074 @ 308,404: 28x26
+#1075 @ 207,457: 12x11
+#1076 @ 399,850: 11x13
+#1077 @ 815,81: 11x28
+#1078 @ 491,152: 26x11
+#1079 @ 670,561: 10x18
+#1080 @ 430,472: 18x29
+#1081 @ 240,702: 12x10
+#1082 @ 879,93: 16x19
+#1083 @ 250,108: 23x16
+#1084 @ 459,248: 25x15
+#1085 @ 795,706: 19x26
+#1086 @ 590,102: 23x27
+#1087 @ 874,931: 24x24
+#1088 @ 714,396: 26x14
+#1089 @ 132,176: 19x29
+#1090 @ 171,99: 12x16
+#1091 @ 170,618: 27x17
+#1092 @ 974,634: 17x28
+#1093 @ 507,137: 15x16
+#1094 @ 74,253: 25x28
+#1095 @ 612,947: 18x11
+#1096 @ 573,711: 17x19
+#1097 @ 144,957: 24x29
+#1098 @ 721,807: 24x10
+#1099 @ 288,370: 22x14
+#1100 @ 452,59: 26x29
+#1101 @ 935,312: 18x18
+#1102 @ 474,925: 11x12
+#1103 @ 606,59: 10x26
+#1104 @ 466,622: 14x21
+#1105 @ 248,938: 13x21
+#1106 @ 53,371: 29x26
+#1107 @ 867,90: 20x20
+#1108 @ 290,787: 23x16
+#1109 @ 764,58: 20x25
+#1110 @ 308,946: 20x19
+#1111 @ 31,140: 16x11
+#1112 @ 392,144: 19x25
+#1113 @ 948,836: 25x23
+#1114 @ 459,866: 21x22
+#1115 @ 488,562: 18x27
+#1116 @ 429,286: 20x21
+#1117 @ 68,311: 29x27
+#1118 @ 197,830: 13x11
+#1119 @ 218,525: 10x25
+#1120 @ 436,9: 16x12
+#1121 @ 32,824: 13x10
+#1122 @ 889,147: 27x11
+#1123 @ 312,388: 14x22
+#1124 @ 626,333: 26x14
+#1125 @ 729,751: 29x21
+#1126 @ 638,724: 25x16
+#1127 @ 353,741: 20x20
+#1128 @ 288,659: 12x11
+#1129 @ 76,95: 26x20
+#1130 @ 131,920: 23x11
+#1131 @ 129,385: 15x16
+#1132 @ 166,588: 15x25
+#1133 @ 761,338: 21x19
+#1134 @ 698,323: 16x18
+#1135 @ 558,79: 29x25
+#1136 @ 704,478: 20x14
+#1137 @ 785,276: 28x29
+#1138 @ 281,940: 19x14
+#1139 @ 519,631: 14x24
+#1140 @ 565,283: 6x3
+#1141 @ 131,952: 15x29
+#1142 @ 599,934: 28x23
+#1143 @ 376,562: 12x14
+#1144 @ 935,414: 12x16
+#1145 @ 845,792: 17x25
+#1146 @ 524,105: 25x28
+#1147 @ 816,199: 16x17
+#1148 @ 791,933: 23x22
+#1149 @ 70,84: 23x14
+#1150 @ 934,427: 14x11
+#1151 @ 890,552: 28x10
+#1152 @ 101,91: 19x21
+#1153 @ 611,596: 17x11
+#1154 @ 684,960: 17x29
+#1155 @ 80,151: 26x15
+#1156 @ 908,809: 11x27
+#1157 @ 262,730: 19x17
+#1158 @ 946,794: 21x25
+#1159 @ 55,296: 19x19
+#1160 @ 4,601: 16x25
+#1161 @ 632,708: 12x24
+#1162 @ 799,549: 13x28
+#1163 @ 913,374: 23x13
+#1164 @ 593,82: 18x27
+#1165 @ 784,721: 12x17
+#1166 @ 503,436: 20x11
+#1167 @ 470,655: 23x14
+#1168 @ 969,383: 13x12
+#1169 @ 397,491: 25x21
+#1170 @ 327,251: 26x10
+#1171 @ 534,232: 14x24
+#1172 @ 171,581: 16x17
+#1173 @ 520,149: 28x11
+#1174 @ 590,571: 11x24
+#1175 @ 297,907: 22x17
+#1176 @ 450,5: 23x11
+#1177 @ 570,641: 11x20
+#1178 @ 565,655: 17x21
+#1179 @ 969,654: 28x21
+#1180 @ 263,124: 12x22
+#1181 @ 606,95: 22x28
+#1182 @ 123,170: 12x16
+#1183 @ 250,692: 16x13
+#1184 @ 214,131: 22x25
+#1185 @ 25,981: 21x14
+#1186 @ 28,580: 24x11
+#1187 @ 256,589: 22x23
+#1188 @ 151,898: 28x16
+#1189 @ 387,597: 20x26
+#1190 @ 983,142: 14x23
+#1191 @ 922,516: 20x12
+#1192 @ 506,132: 13x20
+#1193 @ 410,407: 16x17
+#1194 @ 326,750: 12x10
+#1195 @ 838,19: 7x7
+#1196 @ 395,772: 26x22
+#1197 @ 561,709: 19x16
+#1198 @ 555,43: 29x21
+#1199 @ 684,77: 29x29
+#1200 @ 616,80: 21x22
+#1201 @ 188,871: 27x14
+#1202 @ 808,409: 20x25
+#1203 @ 65,141: 29x16
+#1204 @ 514,525: 11x14
+#1205 @ 258,977: 23x23
+#1206 @ 337,506: 13x26
+#1207 @ 662,592: 16x20
+#1208 @ 520,331: 25x22
+#1209 @ 571,859: 10x24
+#1210 @ 843,807: 13x17
+#1211 @ 3,199: 9x13
+#1212 @ 286,624: 10x25
+#1213 @ 259,754: 26x17
+#1214 @ 779,797: 24x16
+#1215 @ 117,685: 14x22
+#1216 @ 428,494: 25x27
+#1217 @ 695,39: 28x12
+#1218 @ 784,848: 28x29
+#1219 @ 142,742: 29x26
+#1220 @ 983,101: 11x24
+#1221 @ 582,892: 14x17
+#1222 @ 709,774: 25x17
+#1223 @ 96,65: 17x19
+#1224 @ 437,861: 24x19
+#1225 @ 105,956: 25x23
+#1226 @ 913,954: 22x17
+#1227 @ 940,233: 15x11
+#1228 @ 925,46: 12x23
+#1229 @ 6,524: 14x12
+#1230 @ 288,620: 26x28
+#1231 @ 442,13: 10x27
+#1232 @ 132,645: 20x12
+#1233 @ 820,229: 23x22
+#1234 @ 203,306: 10x12
+#1235 @ 192,167: 28x22
+#1236 @ 621,121: 13x22
+#1237 @ 820,103: 21x26
+#1238 @ 459,864: 25x20
+#1239 @ 542,709: 13x26
+#1240 @ 904,807: 26x11
+#1241 @ 67,837: 25x23
+#1242 @ 573,316: 12x21
+#1243 @ 638,125: 14x29
+#1244 @ 163,347: 15x28
+#1245 @ 454,786: 28x10
+#1246 @ 12,170: 26x13
+#1247 @ 720,350: 11x29
+#1248 @ 349,849: 10x17
+#1249 @ 304,833: 15x26
+#1250 @ 766,447: 21x16
+#1251 @ 972,658: 27x10
+#1252 @ 309,921: 22x28
+#1253 @ 127,615: 12x27
+#1254 @ 515,900: 23x26
+#1255 @ 480,228: 14x19
+#1256 @ 478,729: 17x12
+#1257 @ 391,221: 23x19
+#1258 @ 197,358: 21x11
+#1259 @ 138,630: 15x11
+#1260 @ 700,325: 17x22
+#1261 @ 958,140: 13x23
+#1262 @ 379,48: 27x25
+#1263 @ 623,409: 27x21
+#1264 @ 59,540: 29x22
+#1265 @ 697,129: 22x11
+#1266 @ 919,677: 21x18
+#1267 @ 205,197: 19x11
+#1268 @ 137,193: 25x25
+#1269 @ 621,540: 15x15
+#1270 @ 936,676: 10x20
+#1271 @ 0,929: 24x23
+#1272 @ 913,33: 27x26
+#1273 @ 110,361: 21x11
+#1274 @ 795,680: 22x19
+#1275 @ 61,624: 5x13
+#1276 @ 756,807: 13x26
+#1277 @ 299,154: 23x15
+#1278 @ 300,148: 21x24
+#1279 @ 132,64: 23x15
+#1280 @ 953,803: 26x22
+#1281 @ 534,104: 11x16
+#1282 @ 703,29: 10x15
+#1283 @ 486,707: 13x25
+#1284 @ 264,721: 23x26
+#1285 @ 84,256: 21x13
+#1286 @ 743,401: 15x18
+#1287 @ 293,431: 26x27
+#1288 @ 727,338: 20x18
+#1289 @ 12,573: 29x22
+#1290 @ 625,180: 17x26
+#1291 @ 62,291: 14x26
+#1292 @ 477,286: 18x11
+#1293 @ 267,734: 10x6
+#1294 @ 389,218: 16x19
+#1295 @ 965,933: 10x15
+#1296 @ 36,766: 28x14
+#1297 @ 574,728: 12x20
+#1298 @ 85,873: 25x13
+#1299 @ 441,393: 26x21
+#1300 @ 56,534: 29x23
+#1301 @ 412,371: 26x21
+#1302 @ 274,985: 12x13
+#1303 @ 940,199: 22x26
+#1304 @ 145,70: 21x12
+#1305 @ 388,5: 25x29
+#1306 @ 83,953: 11x11
+#1307 @ 802,833: 21x14
+#1308 @ 83,188: 15x24
+#1309 @ 564,130: 26x26
+#1310 @ 324,506: 21x25
+#1311 @ 618,333: 27x14
+#1312 @ 662,796: 14x22
+#1313 @ 463,490: 15x10
+#1314 @ 736,527: 23x13
+#1315 @ 385,116: 23x21
+#1316 @ 840,649: 21x15
+#1317 @ 514,32: 18x28
+#1318 @ 771,245: 25x18
+#1319 @ 199,950: 25x24
+#1320 @ 459,954: 17x11
+#1321 @ 516,148: 24x11
+#1322 @ 38,488: 23x11
+#1323 @ 960,611: 25x29
+#1324 @ 138,56: 19x19
+#1325 @ 979,715: 20x26
+#1326 @ 370,474: 20x11
+#1327 @ 552,497: 10x16
+#1328 @ 805,684: 16x23
+#1329 @ 633,208: 12x27
+#1330 @ 879,830: 15x28
+#1331 @ 413,499: 13x10
+#1332 @ 174,309: 13x19
+#1333 @ 133,767: 24x23
+#1334 @ 152,823: 11x11
+#1335 @ 516,935: 11x18
+#1336 @ 39,367: 17x29
+#1337 @ 262,138: 27x27
+#1338 @ 959,790: 20x18
+#1339 @ 150,916: 17x10
+#1340 @ 836,23: 21x24
+#1341 @ 405,391: 21x16
+#1342 @ 317,869: 20x28
+#1343 @ 935,692: 16x17
+#1344 @ 923,788: 26x21
+#1345 @ 3,555: 22x10
+#1346 @ 749,627: 14x12
+#1347 @ 32,136: 21x24
diff --git a/src/03/part1 b/src/03/part1 new file mode 100644 index 0000000..c1b2e67 --- /dev/null +++ b/src/03/part1 @@ -0,0 +1,63 @@ +--- Day 3: No Matter How You Slice It --- + +The Elves managed to locate the chimney-squeeze prototype fabric for Santa's suit (thanks to someone +who helpfully wrote its box IDs on the wall of the warehouse in the middle of the night). +Unfortunately, anomalies are still affecting them - nobody can even agree on how to [1m[97mcut[0m the fabric. + +The whole piece of fabric they're working on is a very large square - at least 1000 inches on each +side. + +Each Elf has made a [1m[97mclaim[0m about which area of fabric would be ideal for Santa's suit. All claims +have an ID and consist of a single rectangle with edges parallel to the edges of the fabric. Each +claim's rectangle is defined as follows: + + + - The number of inches between the left edge of the fabric and the left edge of the rectangle. + + - The number of inches between the top edge of the fabric and the top edge of the rectangle. + + - The width of the rectangle in inches. + + - The height of the rectangle in inches. + + +A claim like #123 @ 3,2: 5x4 means that claim ID 123 specifies a rectangle 3 inches from the left +edge, 2 inches from the top edge, 5 inches wide, and 4 inches tall. Visually, it claims the square +inches of fabric represented by # (and ignores the square inches of fabric represented by .) in the +diagram below: + +........... +........... +...#####... +...#####... +...#####... +...#####... +........... +........... +........... + +The problem is that many of the claims [1m[97moverlap[0m, causing two or more claims to cover part of the same +areas. For example, consider the following claims: + +#1 @ 1,3: 4x4 +#2 @ 3,1: 4x4 +#3 @ 5,5: 2x2 + +Visually, these claim the following areas: + +........ +...2222. +...2222. +.11XX22. +.11XX22. +.111133. +.111133. +........ + +The four square inches marked with X are claimed by [1m[97mboth 1 and 2[0m. (Claim 3, while adjacent to the +others, does not overlap either of them.) + +If the Elves all proceed with their own plans, none of them will have enough fabric. [1m[97mHow many square +inches of fabric are within two or more claims?[0m + + diff --git a/src/03/part2 b/src/03/part2 new file mode 100644 index 0000000..5764b53 --- /dev/null +++ b/src/03/part2 @@ -0,0 +1,44 @@ +--- Part Two --- + +It turns out that this circuit is very timing-sensitive; you actually need to [1m[97mminimize the signal +delay[0m. + +To do this, calculate the [1m[97mnumber of steps[0m each wire takes to reach each intersection; choose the +intersection where the [1m[97msum of both wires' steps[0m is lowest. If a wire visits a position on the grid +multiple times, use the steps value from the [1m[97mfirst[0m time it visits that position when calculating the +total value of a specific intersection. + +The number of steps a wire takes is the total number of grid squares the wire has entered to get to +that location, including the intersection being considered. Again consider the example from above: + +........... +.+-----+... +.|.....|... +.|..+--X-+. +.|..|..|.|. +.|.-X--+.|. +.|..|....|. +.|.......|. +.o-------+. +........... + +In the above example, the intersection closest to the central port is reached after 8+5+5+2 = +[1m[97m20[0m steps by the first wire and 7+6+4+3 = [1m[97m20[0m steps by the second wire for a total of 20+20 = +[1m[97m40[0m steps. + +However, the top-right intersection is better: the first wire takes only 8+5+2 = [1m[97m15[0m and the second +wire takes only 7+6+2 = [1m[97m15[0m, a total of 15+15 = [1m[97m30[0m steps. + +Here are the best steps for the extra examples from above: + + + - R75,D30,R83,U83,L12,D49,R71,U7,L72 +U62,R66,U55,R34,D71,R55,D58,R83 = 610 steps + + - R98,U47,R26,D63,R33,U87,L62,D20,R33,U53,R51 +U98,R91,D20,R16,D67,R40,U7,R15,U6,R7 = 410 steps + + +[1m[97mWhat is the fewest combined steps the wires must take to reach an intersection?[0m + + diff --git a/src/03/solve.py b/src/03/solve.py new file mode 100644 index 0000000..766b00e --- /dev/null +++ b/src/03/solve.py @@ -0,0 +1,65 @@ +import sys
+sys.path.append("../common")
+import aoc
+
+data = aoc.data.split("\n")
+
+#data = "#1 @ 1,3: 4x4","#2 @ 3,1: 4x4","#3 @ 5,5: 2x2"
+
+def parse_rect(l):
+ split = l.split("@")
+ id = int(split[0].replace("#",""))
+ split = split[1].split(":")
+ pos = [int(x) for x in split[0].split(",")]
+ size = [int(x) for x in split[1].split("x")]
+ return pos, size, id
+
+def create_map():
+ global rectdata
+ rectdata = [parse_rect(l) for l in data]
+ msize = list([0,0])
+ for i in range(len(rectdata)):
+ r = rectdata[i]
+ xm = r[0][0] + r[1][0]
+ ym = r[0][1] + r[1][1]
+ if i == 0 or xm > msize[0]:
+ msize[0] = xm
+ if i == 0 or ym > msize[1]:
+ msize[1] = ym
+
+ map = [[list() for y in range(msize[1])] for x in range(msize[0])]
+ for r in rectdata:
+ sx = r[0][0]
+ sy = r[0][1]
+ for x in range(sx, sx + r[1][0]):
+ for y in range(sy, sy + r[1][1]):
+ map[x][y].append(r[2])
+
+ return map
+
+def solve1(args):
+ map = create_map()
+
+ overlap = 0
+ for x in range(len(map)):
+ for y in range(len(map[0])):
+ if len(map[x][y]) > 1:
+ overlap += 1
+
+ return overlap
+
+def solve2(args):
+ map = create_map()
+
+ overlap = set()
+ for x in range(len(map)):
+ for y in range(len(map[0])):
+ if len(map[x][y]) > 1:
+ for id in map[x][y]:
+ overlap.add(id)
+
+ for i in range(1, len(rectdata)):
+ if i not in overlap:
+ return i
+
+aoc.run(solve1, solve2, sols=[114946, 877])
diff --git a/src/04/input b/src/04/input new file mode 100644 index 0000000..c92ca08 --- /dev/null +++ b/src/04/input @@ -0,0 +1,986 @@ +[1518-08-29 00:24] falls asleep
+[1518-08-06 00:20] falls asleep
+[1518-03-12 00:21] falls asleep
+[1518-06-17 00:45] wakes up
+[1518-06-27 00:46] falls asleep
+[1518-09-07 00:36] falls asleep
+[1518-07-22 00:23] wakes up
+[1518-05-18 00:35] falls asleep
+[1518-09-27 00:40] wakes up
+[1518-04-10 23:52] Guard #3559 begins shift
+[1518-03-16 00:44] wakes up
+[1518-05-16 00:23] wakes up
+[1518-06-18 00:00] Guard #1499 begins shift
+[1518-11-21 00:48] wakes up
+[1518-05-19 00:29] falls asleep
+[1518-03-20 23:58] Guard #73 begins shift
+[1518-09-28 00:18] falls asleep
+[1518-10-21 00:00] Guard #983 begins shift
+[1518-05-19 00:57] wakes up
+[1518-10-08 00:47] wakes up
+[1518-05-04 00:19] falls asleep
+[1518-07-30 00:30] falls asleep
+[1518-05-04 00:22] wakes up
+[1518-10-01 00:20] wakes up
+[1518-03-24 23:47] Guard #2411 begins shift
+[1518-06-19 00:00] Guard #1499 begins shift
+[1518-09-15 00:38] falls asleep
+[1518-07-26 00:50] falls asleep
+[1518-06-13 00:00] Guard #3499 begins shift
+[1518-08-30 00:03] Guard #983 begins shift
+[1518-04-18 00:44] wakes up
+[1518-07-09 00:53] falls asleep
+[1518-06-09 00:02] falls asleep
+[1518-10-09 23:56] Guard #3559 begins shift
+[1518-04-15 23:46] Guard #313 begins shift
+[1518-10-06 00:03] Guard #3499 begins shift
+[1518-10-27 23:59] Guard #2617 begins shift
+[1518-10-21 00:33] wakes up
+[1518-03-23 00:47] falls asleep
+[1518-07-21 00:31] wakes up
+[1518-06-05 00:21] falls asleep
+[1518-03-11 00:54] wakes up
+[1518-05-06 00:11] wakes up
+[1518-04-09 00:39] wakes up
+[1518-06-10 00:00] Guard #919 begins shift
+[1518-11-10 00:57] falls asleep
+[1518-09-27 00:27] falls asleep
+[1518-07-29 00:53] falls asleep
+[1518-07-26 00:38] falls asleep
+[1518-08-05 00:01] falls asleep
+[1518-06-07 00:59] wakes up
+[1518-11-22 00:39] falls asleep
+[1518-11-17 00:58] wakes up
+[1518-11-04 00:22] falls asleep
+[1518-09-10 00:34] wakes up
+[1518-04-11 00:25] wakes up
+[1518-04-14 23:58] Guard #3203 begins shift
+[1518-06-22 00:22] falls asleep
+[1518-04-07 00:48] falls asleep
+[1518-11-15 00:57] wakes up
+[1518-05-24 23:56] Guard #983 begins shift
+[1518-07-29 00:59] wakes up
+[1518-11-15 00:05] falls asleep
+[1518-11-22 00:02] Guard #3499 begins shift
+[1518-11-01 00:46] wakes up
+[1518-08-31 00:01] Guard #2411 begins shift
+[1518-06-30 00:39] falls asleep
+[1518-04-29 00:24] wakes up
+[1518-04-12 23:54] Guard #2099 begins shift
+[1518-05-04 00:48] falls asleep
+[1518-09-25 00:49] falls asleep
+[1518-09-21 00:28] falls asleep
+[1518-04-25 00:44] falls asleep
+[1518-04-13 00:43] falls asleep
+[1518-08-24 00:16] falls asleep
+[1518-07-02 00:43] wakes up
+[1518-04-26 00:00] Guard #241 begins shift
+[1518-06-26 00:29] falls asleep
+[1518-04-17 00:47] wakes up
+[1518-11-23 00:28] falls asleep
+[1518-10-04 00:53] wakes up
+[1518-11-20 00:46] falls asleep
+[1518-06-28 00:37] wakes up
+[1518-09-12 00:21] falls asleep
+[1518-04-20 23:54] Guard #73 begins shift
+[1518-03-21 23:57] Guard #1811 begins shift
+[1518-07-04 00:48] wakes up
+[1518-09-25 00:34] wakes up
+[1518-04-13 00:35] wakes up
+[1518-08-29 00:02] Guard #2657 begins shift
+[1518-03-30 00:03] Guard #1811 begins shift
+[1518-11-16 00:22] falls asleep
+[1518-08-16 00:29] falls asleep
+[1518-08-07 00:27] falls asleep
+[1518-03-26 23:57] Guard #1091 begins shift
+[1518-09-13 00:21] falls asleep
+[1518-11-12 00:42] wakes up
+[1518-05-14 00:01] Guard #1291 begins shift
+[1518-03-21 00:39] falls asleep
+[1518-04-23 00:22] falls asleep
+[1518-09-19 00:05] falls asleep
+[1518-04-02 00:42] falls asleep
+[1518-04-27 00:39] wakes up
+[1518-03-24 00:02] Guard #1033 begins shift
+[1518-03-16 00:59] wakes up
+[1518-05-11 23:50] Guard #3109 begins shift
+[1518-04-18 00:06] falls asleep
+[1518-08-31 00:33] wakes up
+[1518-09-18 23:48] Guard #3559 begins shift
+[1518-04-21 00:30] wakes up
+[1518-10-07 00:44] wakes up
+[1518-09-30 00:57] falls asleep
+[1518-10-08 00:56] wakes up
+[1518-06-19 00:37] wakes up
+[1518-10-22 00:33] falls asleep
+[1518-10-20 00:52] falls asleep
+[1518-11-13 00:27] wakes up
+[1518-07-05 00:11] falls asleep
+[1518-08-17 00:48] wakes up
+[1518-07-25 00:45] wakes up
+[1518-05-01 23:59] Guard #3109 begins shift
+[1518-07-31 00:10] falls asleep
+[1518-05-26 00:54] falls asleep
+[1518-08-10 23:57] Guard #3203 begins shift
+[1518-06-26 00:06] falls asleep
+[1518-09-24 00:12] falls asleep
+[1518-04-11 00:01] falls asleep
+[1518-06-01 00:02] Guard #2657 begins shift
+[1518-06-30 23:49] Guard #241 begins shift
+[1518-10-29 00:49] wakes up
+[1518-06-12 00:44] wakes up
+[1518-04-16 00:01] falls asleep
+[1518-10-13 00:55] wakes up
+[1518-05-21 00:28] falls asleep
+[1518-06-21 00:17] falls asleep
+[1518-06-05 00:47] falls asleep
+[1518-05-10 00:19] falls asleep
+[1518-09-05 00:04] falls asleep
+[1518-04-23 00:12] falls asleep
+[1518-07-16 00:56] wakes up
+[1518-07-26 00:00] Guard #3499 begins shift
+[1518-08-27 00:47] falls asleep
+[1518-09-24 00:32] falls asleep
+[1518-09-15 00:03] Guard #313 begins shift
+[1518-11-21 00:04] Guard #3499 begins shift
+[1518-07-11 00:49] wakes up
+[1518-06-27 00:35] falls asleep
+[1518-07-17 00:59] wakes up
+[1518-05-13 00:10] falls asleep
+[1518-09-28 00:04] Guard #3559 begins shift
+[1518-10-03 00:00] Guard #313 begins shift
+[1518-06-15 00:27] falls asleep
+[1518-09-24 00:59] wakes up
+[1518-10-29 23:50] Guard #983 begins shift
+[1518-06-17 00:48] falls asleep
+[1518-09-24 00:01] Guard #241 begins shift
+[1518-05-28 23:56] Guard #2657 begins shift
+[1518-04-17 00:00] Guard #1291 begins shift
+[1518-05-29 00:34] wakes up
+[1518-03-16 00:48] falls asleep
+[1518-05-25 00:59] wakes up
+[1518-04-11 00:42] falls asleep
+[1518-06-02 23:59] Guard #241 begins shift
+[1518-04-13 00:00] falls asleep
+[1518-07-22 00:35] falls asleep
+[1518-09-19 23:56] Guard #3109 begins shift
+[1518-08-05 23:52] Guard #3449 begins shift
+[1518-08-25 00:18] wakes up
+[1518-07-14 23:57] Guard #2617 begins shift
+[1518-05-08 00:19] falls asleep
+[1518-10-11 00:02] Guard #2657 begins shift
+[1518-03-21 00:22] falls asleep
+[1518-06-23 00:10] falls asleep
+[1518-05-28 00:41] falls asleep
+[1518-09-01 00:02] Guard #3109 begins shift
+[1518-09-13 00:43] wakes up
+[1518-05-19 00:16] wakes up
+[1518-10-03 00:59] wakes up
+[1518-05-04 00:59] wakes up
+[1518-06-15 00:53] falls asleep
+[1518-07-16 00:09] falls asleep
+[1518-08-11 00:48] falls asleep
+[1518-08-15 00:00] Guard #823 begins shift
+[1518-07-31 00:44] wakes up
+[1518-04-28 23:51] Guard #73 begins shift
+[1518-04-21 00:46] falls asleep
+[1518-09-21 00:42] wakes up
+[1518-05-27 00:26] falls asleep
+[1518-08-23 00:04] Guard #3203 begins shift
+[1518-07-13 00:01] falls asleep
+[1518-08-14 00:01] falls asleep
+[1518-07-10 00:50] wakes up
+[1518-11-05 00:37] wakes up
+[1518-08-12 00:58] wakes up
+[1518-03-11 00:33] falls asleep
+[1518-09-20 00:32] falls asleep
+[1518-09-03 00:56] wakes up
+[1518-03-21 00:40] wakes up
+[1518-07-03 00:22] falls asleep
+[1518-08-16 23:46] Guard #313 begins shift
+[1518-10-31 00:00] Guard #919 begins shift
+[1518-08-11 00:32] wakes up
+[1518-08-25 23:58] Guard #1033 begins shift
+[1518-09-01 23:57] Guard #2617 begins shift
+[1518-06-17 00:53] wakes up
+[1518-10-18 00:42] falls asleep
+[1518-07-11 00:14] falls asleep
+[1518-03-13 00:27] falls asleep
+[1518-10-28 00:58] wakes up
+[1518-07-31 00:01] Guard #3499 begins shift
+[1518-04-22 00:49] wakes up
+[1518-10-17 00:42] wakes up
+[1518-03-14 00:02] Guard #1033 begins shift
+[1518-08-09 00:38] falls asleep
+[1518-04-26 23:58] Guard #3109 begins shift
+[1518-05-09 00:34] falls asleep
+[1518-11-09 23:57] Guard #2099 begins shift
+[1518-05-22 00:28] falls asleep
+[1518-08-08 00:28] wakes up
+[1518-11-23 00:42] wakes up
+[1518-09-16 00:19] falls asleep
+[1518-04-08 00:12] falls asleep
+[1518-10-03 00:47] wakes up
+[1518-04-10 00:22] falls asleep
+[1518-07-30 00:37] wakes up
+[1518-11-16 00:47] wakes up
+[1518-08-12 00:13] falls asleep
+[1518-08-04 00:33] falls asleep
+[1518-09-24 00:14] wakes up
+[1518-09-13 00:56] wakes up
+[1518-10-10 00:25] falls asleep
+[1518-04-14 00:01] Guard #3559 begins shift
+[1518-06-25 23:59] Guard #241 begins shift
+[1518-07-19 00:02] falls asleep
+[1518-03-15 00:01] Guard #1033 begins shift
+[1518-09-18 00:15] falls asleep
+[1518-11-09 00:35] falls asleep
+[1518-08-22 00:11] falls asleep
+[1518-10-07 23:59] Guard #2411 begins shift
+[1518-08-02 23:59] Guard #3361 begins shift
+[1518-06-26 00:53] wakes up
+[1518-04-01 00:16] falls asleep
+[1518-11-08 23:58] Guard #2617 begins shift
+[1518-09-02 00:57] wakes up
+[1518-07-06 00:46] falls asleep
+[1518-07-21 00:17] falls asleep
+[1518-05-01 00:58] wakes up
+[1518-06-21 00:23] wakes up
+[1518-07-01 00:47] wakes up
+[1518-09-07 00:41] wakes up
+[1518-05-05 00:34] wakes up
+[1518-04-02 00:01] Guard #2099 begins shift
+[1518-07-03 00:19] wakes up
+[1518-06-01 00:39] falls asleep
+[1518-04-06 00:08] falls asleep
+[1518-08-24 00:01] Guard #2657 begins shift
+[1518-07-01 23:51] Guard #3109 begins shift
+[1518-08-13 00:04] Guard #2099 begins shift
+[1518-08-09 00:34] wakes up
+[1518-05-31 00:40] wakes up
+[1518-06-26 00:45] falls asleep
+[1518-06-26 23:59] Guard #983 begins shift
+[1518-07-01 00:36] wakes up
+[1518-03-24 00:26] falls asleep
+[1518-04-19 00:55] falls asleep
+[1518-04-06 00:09] wakes up
+[1518-10-15 00:24] falls asleep
+[1518-04-30 00:47] falls asleep
+[1518-05-08 00:08] falls asleep
+[1518-09-24 00:56] falls asleep
+[1518-04-24 00:04] Guard #3361 begins shift
+[1518-07-06 00:59] wakes up
+[1518-06-24 00:28] wakes up
+[1518-08-11 00:19] falls asleep
+[1518-04-19 23:58] Guard #1291 begins shift
+[1518-03-18 00:32] wakes up
+[1518-10-23 00:04] falls asleep
+[1518-10-19 00:04] Guard #3203 begins shift
+[1518-04-05 00:31] wakes up
+[1518-03-13 00:04] Guard #3449 begins shift
+[1518-06-15 00:22] wakes up
+[1518-03-26 00:10] falls asleep
+[1518-07-07 00:34] wakes up
+[1518-04-27 00:24] falls asleep
+[1518-04-30 00:49] wakes up
+[1518-04-17 00:18] falls asleep
+[1518-09-11 00:20] falls asleep
+[1518-05-07 00:56] wakes up
+[1518-05-23 00:24] wakes up
+[1518-03-28 00:44] wakes up
+[1518-08-10 00:12] falls asleep
+[1518-06-12 00:13] falls asleep
+[1518-09-23 00:58] wakes up
+[1518-08-29 00:59] wakes up
+[1518-09-04 00:33] falls asleep
+[1518-05-29 00:09] falls asleep
+[1518-04-25 00:00] Guard #3203 begins shift
+[1518-07-30 00:55] wakes up
+[1518-10-31 23:57] Guard #983 begins shift
+[1518-11-05 00:29] falls asleep
+[1518-06-06 00:12] falls asleep
+[1518-03-18 00:29] falls asleep
+[1518-08-30 00:58] wakes up
+[1518-11-08 00:13] wakes up
+[1518-08-08 00:11] falls asleep
+[1518-07-12 23:50] Guard #2099 begins shift
+[1518-03-15 00:56] wakes up
+[1518-06-07 00:39] falls asleep
+[1518-11-02 00:29] wakes up
+[1518-06-13 00:43] wakes up
+[1518-07-21 23:47] Guard #2099 begins shift
+[1518-10-12 00:38] wakes up
+[1518-08-23 00:36] falls asleep
+[1518-08-04 23:53] Guard #1091 begins shift
+[1518-06-29 00:51] wakes up
+[1518-03-28 00:10] falls asleep
+[1518-10-20 00:23] falls asleep
+[1518-11-12 00:04] Guard #2411 begins shift
+[1518-04-17 00:59] wakes up
+[1518-10-07 00:32] falls asleep
+[1518-09-06 00:39] wakes up
+[1518-03-27 00:34] falls asleep
+[1518-05-27 00:53] wakes up
+[1518-10-05 00:15] falls asleep
+[1518-10-02 00:15] falls asleep
+[1518-07-12 00:37] wakes up
+[1518-07-16 23:57] Guard #983 begins shift
+[1518-09-03 00:20] falls asleep
+[1518-04-13 00:46] wakes up
+[1518-06-14 23:50] Guard #983 begins shift
+[1518-09-12 00:48] falls asleep
+[1518-09-11 23:57] Guard #73 begins shift
+[1518-07-26 00:51] wakes up
+[1518-09-01 00:45] falls asleep
+[1518-05-30 00:53] wakes up
+[1518-08-09 00:28] falls asleep
+[1518-10-03 00:29] falls asleep
+[1518-09-02 00:49] wakes up
+[1518-09-06 00:03] falls asleep
+[1518-03-18 23:49] Guard #3449 begins shift
+[1518-07-04 00:03] Guard #2411 begins shift
+[1518-08-01 00:21] falls asleep
+[1518-06-15 00:44] wakes up
+[1518-11-22 23:56] Guard #3499 begins shift
+[1518-06-14 00:08] falls asleep
+[1518-08-01 00:03] Guard #1291 begins shift
+[1518-05-26 00:56] wakes up
+[1518-07-17 23:47] Guard #1091 begins shift
+[1518-11-02 00:03] Guard #3559 begins shift
+[1518-04-07 00:51] wakes up
+[1518-06-03 00:56] wakes up
+[1518-10-15 00:40] wakes up
+[1518-07-29 00:40] falls asleep
+[1518-06-25 00:18] falls asleep
+[1518-08-06 00:51] falls asleep
+[1518-05-23 00:11] falls asleep
+[1518-09-10 23:59] Guard #2411 begins shift
+[1518-08-23 00:59] wakes up
+[1518-03-15 00:29] falls asleep
+[1518-06-25 00:00] Guard #3499 begins shift
+[1518-06-02 00:38] wakes up
+[1518-07-25 00:29] falls asleep
+[1518-04-19 00:49] wakes up
+[1518-04-01 00:46] wakes up
+[1518-11-10 23:49] Guard #241 begins shift
+[1518-06-06 00:24] wakes up
+[1518-07-04 00:22] falls asleep
+[1518-05-28 00:54] wakes up
+[1518-07-25 00:57] wakes up
+[1518-03-30 00:54] falls asleep
+[1518-11-10 00:58] wakes up
+[1518-06-15 00:58] wakes up
+[1518-03-25 23:58] Guard #1033 begins shift
+[1518-08-10 00:00] Guard #3109 begins shift
+[1518-11-05 23:48] Guard #73 begins shift
+[1518-10-25 00:08] falls asleep
+[1518-08-25 00:35] falls asleep
+[1518-04-25 00:52] wakes up
+[1518-04-05 23:57] Guard #2617 begins shift
+[1518-09-20 00:55] falls asleep
+[1518-08-11 00:52] wakes up
+[1518-05-09 00:49] wakes up
+[1518-08-02 00:38] wakes up
+[1518-07-07 23:57] Guard #983 begins shift
+[1518-09-29 00:42] wakes up
+[1518-05-31 00:50] falls asleep
+[1518-08-04 00:57] falls asleep
+[1518-08-20 00:42] wakes up
+[1518-10-28 00:57] falls asleep
+[1518-11-20 00:54] wakes up
+[1518-10-08 00:13] falls asleep
+[1518-09-30 00:58] wakes up
+[1518-07-18 23:53] Guard #3499 begins shift
+[1518-03-15 23:50] Guard #1811 begins shift
+[1518-07-23 00:33] falls asleep
+[1518-08-26 00:35] wakes up
+[1518-11-07 00:17] falls asleep
+[1518-07-20 00:30] wakes up
+[1518-10-13 23:52] Guard #2657 begins shift
+[1518-05-21 00:31] wakes up
+[1518-11-01 00:21] falls asleep
+[1518-10-24 00:26] falls asleep
+[1518-04-28 00:02] Guard #1811 begins shift
+[1518-08-02 00:18] falls asleep
+[1518-10-26 00:09] falls asleep
+[1518-06-26 00:21] wakes up
+[1518-11-17 00:48] falls asleep
+[1518-08-28 00:45] falls asleep
+[1518-09-08 00:26] wakes up
+[1518-09-30 00:00] Guard #3499 begins shift
+[1518-09-25 00:00] Guard #1091 begins shift
+[1518-09-17 00:03] Guard #313 begins shift
+[1518-05-11 00:10] falls asleep
+[1518-11-18 00:32] wakes up
+[1518-06-08 00:48] wakes up
+[1518-08-06 00:00] falls asleep
+[1518-09-23 00:06] falls asleep
+[1518-05-25 00:29] falls asleep
+[1518-08-31 00:22] falls asleep
+[1518-07-11 00:55] falls asleep
+[1518-11-10 00:50] falls asleep
+[1518-04-28 00:33] falls asleep
+[1518-11-13 00:05] falls asleep
+[1518-07-25 00:49] falls asleep
+[1518-04-07 00:14] falls asleep
+[1518-09-05 23:50] Guard #3559 begins shift
+[1518-03-31 23:58] Guard #3203 begins shift
+[1518-07-24 00:03] Guard #823 begins shift
+[1518-06-07 00:34] wakes up
+[1518-05-15 00:19] falls asleep
+[1518-04-09 00:05] falls asleep
+[1518-07-30 00:06] falls asleep
+[1518-10-17 00:01] Guard #3203 begins shift
+[1518-06-19 00:45] falls asleep
+[1518-05-16 00:20] falls asleep
+[1518-08-22 00:33] wakes up
+[1518-06-08 00:14] falls asleep
+[1518-11-10 00:35] wakes up
+[1518-08-19 00:50] wakes up
+[1518-03-28 00:03] Guard #241 begins shift
+[1518-07-23 00:04] Guard #2617 begins shift
+[1518-06-13 00:26] falls asleep
+[1518-05-08 23:56] Guard #2099 begins shift
+[1518-03-22 23:50] Guard #3361 begins shift
+[1518-08-21 23:58] Guard #313 begins shift
+[1518-05-18 00:40] wakes up
+[1518-04-29 00:01] falls asleep
+[1518-08-08 00:54] wakes up
+[1518-11-01 00:53] falls asleep
+[1518-10-06 00:36] falls asleep
+[1518-03-19 00:19] wakes up
+[1518-05-28 00:11] falls asleep
+[1518-04-03 00:04] Guard #313 begins shift
+[1518-11-02 23:59] Guard #73 begins shift
+[1518-03-24 00:42] wakes up
+[1518-05-31 00:33] falls asleep
+[1518-05-17 00:23] wakes up
+[1518-08-08 00:41] falls asleep
+[1518-09-22 00:08] falls asleep
+[1518-11-01 00:31] wakes up
+[1518-11-06 00:22] wakes up
+[1518-04-08 23:51] Guard #3559 begins shift
+[1518-11-11 00:39] wakes up
+[1518-08-01 23:56] Guard #1033 begins shift
+[1518-05-05 23:58] Guard #3499 begins shift
+[1518-10-11 23:58] Guard #2099 begins shift
+[1518-06-08 00:54] wakes up
+[1518-05-23 00:21] falls asleep
+[1518-04-04 00:22] falls asleep
+[1518-05-26 00:02] Guard #919 begins shift
+[1518-04-14 00:51] wakes up
+[1518-07-20 00:13] falls asleep
+[1518-07-07 00:02] Guard #2099 begins shift
+[1518-10-18 00:15] falls asleep
+[1518-09-09 23:58] Guard #241 begins shift
+[1518-07-31 00:41] falls asleep
+[1518-05-26 00:46] wakes up
+[1518-11-09 00:39] wakes up
+[1518-09-02 00:27] falls asleep
+[1518-10-31 00:49] falls asleep
+[1518-06-30 00:56] falls asleep
+[1518-08-07 00:55] wakes up
+[1518-06-06 23:59] Guard #3499 begins shift
+[1518-03-24 00:58] wakes up
+[1518-06-11 00:02] Guard #919 begins shift
+[1518-06-11 00:14] falls asleep
+[1518-07-17 00:41] wakes up
+[1518-05-27 00:00] Guard #3499 begins shift
+[1518-11-19 00:02] Guard #3109 begins shift
+[1518-09-17 00:21] falls asleep
+[1518-11-03 00:53] falls asleep
+[1518-03-24 00:51] falls asleep
+[1518-04-30 00:02] Guard #1499 begins shift
+[1518-07-22 00:01] falls asleep
+[1518-03-25 00:00] falls asleep
+[1518-06-05 00:43] wakes up
+[1518-06-05 00:56] falls asleep
+[1518-08-24 00:35] wakes up
+[1518-06-22 00:02] Guard #2411 begins shift
+[1518-09-22 23:59] Guard #2657 begins shift
+[1518-06-14 00:48] wakes up
+[1518-07-09 00:00] Guard #3361 begins shift
+[1518-10-20 00:53] wakes up
+[1518-05-03 23:56] Guard #3559 begins shift
+[1518-10-09 00:10] falls asleep
+[1518-08-25 00:31] wakes up
+[1518-06-10 00:57] wakes up
+[1518-07-05 23:58] Guard #3361 begins shift
+[1518-04-05 00:26] falls asleep
+[1518-10-07 00:00] Guard #1811 begins shift
+[1518-05-16 00:58] wakes up
+[1518-08-25 00:11] falls asleep
+[1518-04-24 00:58] wakes up
+[1518-03-12 00:29] wakes up
+[1518-05-07 00:35] wakes up
+[1518-08-14 00:39] wakes up
+[1518-08-16 00:36] wakes up
+[1518-07-10 00:22] falls asleep
+[1518-10-31 00:09] falls asleep
+[1518-04-08 00:03] Guard #2411 begins shift
+[1518-10-01 00:05] falls asleep
+[1518-10-15 00:46] falls asleep
+[1518-09-09 00:30] wakes up
+[1518-03-14 00:50] wakes up
+[1518-08-17 00:02] falls asleep
+[1518-08-03 00:59] wakes up
+[1518-03-26 00:56] wakes up
+[1518-10-28 00:08] falls asleep
+[1518-07-23 00:52] wakes up
+[1518-05-15 00:49] wakes up
+[1518-10-21 00:15] falls asleep
+[1518-06-17 00:00] Guard #983 begins shift
+[1518-05-07 00:52] falls asleep
+[1518-08-31 00:58] wakes up
+[1518-07-04 23:59] Guard #2099 begins shift
+[1518-04-09 00:46] wakes up
+[1518-06-03 00:36] falls asleep
+[1518-05-06 00:06] falls asleep
+[1518-04-07 00:01] Guard #1291 begins shift
+[1518-06-17 00:15] falls asleep
+[1518-09-24 00:53] wakes up
+[1518-09-13 00:01] Guard #2099 begins shift
+[1518-07-14 00:04] Guard #2579 begins shift
+[1518-06-28 00:20] falls asleep
+[1518-06-27 00:58] wakes up
+[1518-05-02 00:19] falls asleep
+[1518-04-19 00:44] falls asleep
+[1518-08-09 00:45] wakes up
+[1518-04-27 00:44] wakes up
+[1518-07-15 00:53] wakes up
+[1518-10-06 00:55] wakes up
+[1518-09-08 00:25] falls asleep
+[1518-06-03 00:55] falls asleep
+[1518-05-28 00:43] wakes up
+[1518-07-11 00:04] Guard #3559 begins shift
+[1518-07-09 23:59] Guard #3499 begins shift
+[1518-09-18 00:57] wakes up
+[1518-11-14 00:01] falls asleep
+[1518-10-08 23:58] Guard #1811 begins shift
+[1518-04-12 00:50] wakes up
+[1518-04-08 00:28] wakes up
+[1518-04-10 00:59] wakes up
+[1518-10-29 00:16] falls asleep
+[1518-11-07 00:29] wakes up
+[1518-08-13 23:50] Guard #2099 begins shift
+[1518-10-10 00:49] wakes up
+[1518-06-02 00:09] falls asleep
+[1518-03-25 00:30] wakes up
+[1518-09-04 23:46] Guard #2657 begins shift
+[1518-03-30 23:58] Guard #1867 begins shift
+[1518-05-03 00:04] falls asleep
+[1518-11-19 00:50] falls asleep
+[1518-07-08 00:37] wakes up
+[1518-07-16 00:20] wakes up
+[1518-08-27 00:31] falls asleep
+[1518-04-15 00:23] wakes up
+[1518-08-05 00:27] wakes up
+[1518-07-05 00:13] wakes up
+[1518-08-06 00:42] wakes up
+[1518-05-28 00:03] Guard #3449 begins shift
+[1518-04-14 00:13] falls asleep
+[1518-10-16 00:45] falls asleep
+[1518-07-29 00:00] Guard #1811 begins shift
+[1518-05-24 00:57] wakes up
+[1518-06-01 00:48] wakes up
+[1518-09-12 00:29] wakes up
+[1518-04-06 00:15] falls asleep
+[1518-06-06 00:03] Guard #2657 begins shift
+[1518-07-28 00:41] wakes up
+[1518-09-30 00:39] falls asleep
+[1518-06-30 00:59] wakes up
+[1518-09-01 00:51] wakes up
+[1518-08-04 00:59] wakes up
+[1518-03-22 00:46] falls asleep
+[1518-05-13 00:00] Guard #1499 begins shift
+[1518-07-08 00:36] falls asleep
+[1518-04-09 00:45] falls asleep
+[1518-05-01 00:01] Guard #1499 begins shift
+[1518-09-22 00:03] Guard #3559 begins shift
+[1518-05-12 00:54] wakes up
+[1518-11-04 00:57] wakes up
+[1518-04-21 00:00] falls asleep
+[1518-11-19 23:56] Guard #2617 begins shift
+[1518-07-16 00:42] falls asleep
+[1518-04-10 00:00] Guard #1811 begins shift
+[1518-11-10 00:34] falls asleep
+[1518-08-18 00:01] Guard #241 begins shift
+[1518-08-04 00:45] wakes up
+[1518-11-21 00:36] falls asleep
+[1518-06-07 00:15] falls asleep
+[1518-10-28 00:36] wakes up
+[1518-07-15 23:57] Guard #2657 begins shift
+[1518-06-29 00:46] falls asleep
+[1518-03-17 00:54] wakes up
+[1518-08-22 00:12] wakes up
+[1518-11-20 00:26] wakes up
+[1518-10-02 00:23] wakes up
+[1518-07-26 00:43] wakes up
+[1518-04-23 00:57] wakes up
+[1518-04-22 23:57] Guard #2099 begins shift
+[1518-03-21 00:46] falls asleep
+[1518-04-04 00:30] wakes up
+[1518-04-20 00:45] wakes up
+[1518-08-31 00:47] falls asleep
+[1518-09-16 00:34] wakes up
+[1518-10-05 00:03] Guard #3499 begins shift
+[1518-04-11 23:57] Guard #3499 begins shift
+[1518-08-29 00:29] wakes up
+[1518-10-13 00:43] falls asleep
+[1518-07-12 00:29] falls asleep
+[1518-05-08 00:55] wakes up
+[1518-03-29 00:01] Guard #2579 begins shift
+[1518-10-31 00:56] wakes up
+[1518-11-17 00:49] wakes up
+[1518-06-03 23:46] Guard #313 begins shift
+[1518-05-02 00:48] wakes up
+[1518-05-17 23:58] Guard #3499 begins shift
+[1518-03-27 00:30] wakes up
+[1518-09-21 00:02] Guard #2099 begins shift
+[1518-05-22 00:30] wakes up
+[1518-10-04 00:40] wakes up
+[1518-03-23 00:49] wakes up
+[1518-08-16 00:00] Guard #3361 begins shift
+[1518-10-09 00:59] wakes up
+[1518-03-30 00:48] wakes up
+[1518-11-13 23:49] Guard #1811 begins shift
+[1518-06-28 23:59] Guard #2657 begins shift
+[1518-04-22 00:11] falls asleep
+[1518-05-17 00:15] falls asleep
+[1518-09-28 23:56] Guard #1811 begins shift
+[1518-07-15 00:59] wakes up
+[1518-09-26 23:59] Guard #3109 begins shift
+[1518-03-14 00:56] falls asleep
+[1518-08-06 00:11] wakes up
+[1518-03-23 00:28] wakes up
+[1518-11-07 23:52] Guard #3559 begins shift
+[1518-10-14 00:44] wakes up
+[1518-04-16 00:59] wakes up
+[1518-07-20 00:00] Guard #241 begins shift
+[1518-09-20 00:58] wakes up
+[1518-05-01 00:49] falls asleep
+[1518-05-15 00:03] Guard #241 begins shift
+[1518-10-24 00:29] wakes up
+[1518-10-03 23:59] Guard #2657 begins shift
+[1518-10-24 00:47] wakes up
+[1518-03-23 00:00] falls asleep
+[1518-10-11 00:41] wakes up
+[1518-08-28 00:03] Guard #983 begins shift
+[1518-10-04 00:49] falls asleep
+[1518-09-05 00:51] wakes up
+[1518-04-03 00:58] wakes up
+[1518-05-24 00:17] falls asleep
+[1518-06-16 00:56] wakes up
+[1518-06-20 23:57] Guard #3361 begins shift
+[1518-06-27 00:37] wakes up
+[1518-04-11 00:53] wakes up
+[1518-03-24 00:41] falls asleep
+[1518-04-05 00:01] Guard #2099 begins shift
+[1518-06-14 00:00] Guard #3499 begins shift
+[1518-03-27 00:44] wakes up
+[1518-11-07 00:01] Guard #73 begins shift
+[1518-09-25 00:55] wakes up
+[1518-04-24 00:34] falls asleep
+[1518-06-15 00:03] falls asleep
+[1518-08-25 00:22] falls asleep
+[1518-04-20 00:28] falls asleep
+[1518-10-30 00:05] falls asleep
+[1518-10-19 00:21] falls asleep
+[1518-10-03 00:39] falls asleep
+[1518-07-01 00:05] falls asleep
+[1518-06-30 00:52] wakes up
+[1518-04-26 00:40] wakes up
+[1518-10-20 00:04] Guard #3203 begins shift
+[1518-03-19 00:04] falls asleep
+[1518-04-07 00:40] wakes up
+[1518-05-05 00:55] wakes up
+[1518-05-22 00:04] Guard #313 begins shift
+[1518-06-08 23:47] Guard #241 begins shift
+[1518-08-17 00:28] wakes up
+[1518-06-17 00:25] wakes up
+[1518-03-12 00:35] falls asleep
+[1518-07-30 00:04] Guard #3109 begins shift
+[1518-03-14 00:57] wakes up
+[1518-07-11 00:56] wakes up
+[1518-04-21 23:56] Guard #1811 begins shift
+[1518-08-27 00:36] wakes up
+[1518-06-09 00:53] wakes up
+[1518-08-08 00:04] Guard #241 begins shift
+[1518-03-22 00:58] wakes up
+[1518-04-19 00:58] wakes up
+[1518-04-18 00:00] Guard #1091 begins shift
+[1518-09-28 00:48] wakes up
+[1518-08-01 00:52] wakes up
+[1518-03-19 00:29] falls asleep
+[1518-04-04 00:02] Guard #983 begins shift
+[1518-09-22 00:19] wakes up
+[1518-06-15 23:59] Guard #1499 begins shift
+[1518-05-10 00:29] wakes up
+[1518-06-18 00:28] falls asleep
+[1518-03-20 00:59] wakes up
+[1518-08-26 00:15] falls asleep
+[1518-10-24 00:01] Guard #3109 begins shift
+[1518-07-15 00:57] falls asleep
+[1518-06-05 00:59] wakes up
+[1518-11-02 00:14] falls asleep
+[1518-05-26 00:11] wakes up
+[1518-11-04 23:56] Guard #3499 begins shift
+[1518-10-08 00:53] falls asleep
+[1518-09-25 00:25] falls asleep
+[1518-09-25 23:56] Guard #3361 begins shift
+[1518-06-24 00:04] Guard #1033 begins shift
+[1518-05-07 00:04] Guard #1091 begins shift
+[1518-08-18 00:29] falls asleep
+[1518-09-13 00:47] falls asleep
+[1518-04-02 00:53] wakes up
+[1518-11-08 00:51] wakes up
+[1518-09-02 23:56] Guard #3203 begins shift
+[1518-08-06 00:55] wakes up
+[1518-10-01 23:58] Guard #2411 begins shift
+[1518-06-29 23:59] Guard #1811 begins shift
+[1518-05-07 00:48] wakes up
+[1518-11-12 00:37] falls asleep
+[1518-10-16 00:00] Guard #2657 begins shift
+[1518-07-07 00:29] falls asleep
+[1518-07-17 00:45] falls asleep
+[1518-11-01 00:57] wakes up
+[1518-10-26 00:02] Guard #1291 begins shift
+[1518-11-06 00:04] falls asleep
+[1518-09-29 00:22] falls asleep
+[1518-08-20 00:03] Guard #3499 begins shift
+[1518-07-03 00:47] wakes up
+[1518-05-01 00:25] wakes up
+[1518-08-10 00:49] wakes up
+[1518-03-13 00:55] wakes up
+[1518-08-13 00:59] wakes up
+[1518-06-08 00:53] falls asleep
+[1518-07-17 00:06] falls asleep
+[1518-06-25 00:41] wakes up
+[1518-10-31 00:11] wakes up
+[1518-05-05 00:32] falls asleep
+[1518-06-23 00:40] wakes up
+[1518-05-13 00:33] wakes up
+[1518-04-17 00:53] falls asleep
+[1518-05-01 00:09] falls asleep
+[1518-03-14 00:22] falls asleep
+[1518-10-27 00:01] Guard #1291 begins shift
+[1518-06-04 00:01] falls asleep
+[1518-10-16 00:50] wakes up
+[1518-07-08 00:45] falls asleep
+[1518-04-12 00:37] falls asleep
+[1518-10-18 00:38] wakes up
+[1518-09-14 00:10] falls asleep
+[1518-07-01 00:40] falls asleep
+[1518-11-08 00:20] falls asleep
+[1518-03-30 00:59] wakes up
+[1518-06-12 00:00] Guard #3499 begins shift
+[1518-08-27 00:00] Guard #1291 begins shift
+[1518-03-20 00:37] falls asleep
+[1518-09-30 00:44] wakes up
+[1518-09-20 00:43] wakes up
+[1518-10-27 00:08] falls asleep
+[1518-09-09 00:02] Guard #1091 begins shift
+[1518-08-13 00:21] falls asleep
+[1518-04-21 00:49] wakes up
+[1518-11-16 23:56] Guard #919 begins shift
+[1518-07-22 00:47] wakes up
+[1518-10-03 00:50] falls asleep
+[1518-09-26 00:50] wakes up
+[1518-06-08 00:02] Guard #1811 begins shift
+[1518-05-22 23:59] Guard #2617 begins shift
+[1518-07-31 00:34] wakes up
+[1518-10-22 23:52] Guard #313 begins shift
+[1518-08-03 00:49] falls asleep
+[1518-10-24 00:43] falls asleep
+[1518-05-08 00:01] Guard #1033 begins shift
+[1518-10-19 00:48] wakes up
+[1518-10-13 00:04] Guard #1091 begins shift
+[1518-07-18 00:18] wakes up
+[1518-10-20 00:36] wakes up
+[1518-10-04 00:33] falls asleep
+[1518-05-08 00:11] wakes up
+[1518-05-19 00:04] falls asleep
+[1518-04-06 00:55] wakes up
+[1518-08-10 00:38] wakes up
+[1518-06-10 00:34] falls asleep
+[1518-07-15 00:38] falls asleep
+[1518-08-18 00:35] wakes up
+[1518-03-27 00:18] falls asleep
+[1518-08-10 00:45] falls asleep
+[1518-07-30 00:22] wakes up
+[1518-06-22 23:59] Guard #2657 begins shift
+[1518-07-11 23:57] Guard #2617 begins shift
+[1518-10-15 00:47] wakes up
+[1518-08-25 00:02] Guard #1291 begins shift
+[1518-06-24 00:12] falls asleep
+[1518-03-16 23:57] Guard #2657 begins shift
+[1518-10-18 00:02] Guard #2657 begins shift
+[1518-05-11 00:58] wakes up
+[1518-03-30 00:37] falls asleep
+[1518-08-21 00:53] wakes up
+[1518-07-09 00:57] wakes up
+[1518-08-07 00:00] Guard #1499 begins shift
+[1518-09-02 00:56] falls asleep
+[1518-10-14 23:56] Guard #2099 begins shift
+[1518-09-19 00:48] wakes up
+[1518-05-30 00:04] Guard #1499 begins shift
+[1518-11-11 00:04] falls asleep
+[1518-03-21 00:57] wakes up
+[1518-05-20 23:57] Guard #1811 begins shift
+[1518-10-23 00:08] wakes up
+[1518-07-02 23:57] Guard #1811 begins shift
+[1518-10-28 23:58] Guard #241 begins shift
+[1518-05-12 00:05] falls asleep
+[1518-11-18 00:26] falls asleep
+[1518-03-21 00:27] wakes up
+[1518-07-29 00:50] wakes up
+[1518-10-24 23:56] Guard #2657 begins shift
+[1518-05-14 00:37] wakes up
+[1518-08-04 00:00] Guard #1033 begins shift
+[1518-06-20 00:52] wakes up
+[1518-05-10 00:00] Guard #73 begins shift
+[1518-08-19 00:02] Guard #1033 begins shift
+[1518-03-16 00:03] falls asleep
+[1518-03-12 00:03] Guard #2657 begins shift
+[1518-06-22 00:48] wakes up
+[1518-08-22 00:31] falls asleep
+[1518-05-11 00:02] Guard #1811 begins shift
+[1518-03-19 23:58] Guard #241 begins shift
+[1518-04-10 00:53] falls asleep
+[1518-10-21 23:57] Guard #919 begins shift
+[1518-06-28 00:04] Guard #2657 begins shift
+[1518-11-17 00:56] falls asleep
+[1518-07-09 00:45] wakes up
+[1518-06-11 00:44] wakes up
+[1518-04-10 00:48] wakes up
+[1518-11-01 00:37] falls asleep
+[1518-05-20 00:36] falls asleep
+[1518-05-23 23:56] Guard #1811 begins shift
+[1518-04-18 23:56] Guard #3109 begins shift
+[1518-05-31 00:02] Guard #2657 begins shift
+[1518-05-17 00:00] Guard #241 begins shift
+[1518-05-28 00:52] falls asleep
+[1518-10-30 00:07] wakes up
+[1518-08-30 00:26] falls asleep
+[1518-03-17 23:57] Guard #241 begins shift
+[1518-07-19 00:43] wakes up
+[1518-08-09 00:03] Guard #3109 begins shift
+[1518-09-11 00:41] wakes up
+[1518-07-27 23:50] Guard #2099 begins shift
+[1518-10-17 00:26] falls asleep
+[1518-05-30 00:14] falls asleep
+[1518-10-12 00:26] falls asleep
+[1518-06-16 00:44] falls asleep
+[1518-05-20 00:02] Guard #1033 begins shift
+[1518-06-16 00:24] falls asleep
+[1518-06-19 23:57] Guard #2411 begins shift
+[1518-10-27 00:53] wakes up
+[1518-06-10 00:53] falls asleep
+[1518-05-05 00:43] falls asleep
+[1518-09-04 00:03] Guard #2099 begins shift
+[1518-05-23 00:14] wakes up
+[1518-09-08 00:04] Guard #1291 begins shift
+[1518-05-03 00:52] wakes up
+[1518-07-25 00:03] Guard #1033 begins shift
+[1518-07-08 00:59] wakes up
+[1518-10-25 00:54] wakes up
+[1518-11-08 00:00] falls asleep
+[1518-06-20 00:47] falls asleep
+[1518-05-08 00:49] wakes up
+[1518-11-15 23:59] Guard #3109 begins shift
+[1518-06-18 00:55] wakes up
+[1518-03-11 00:04] Guard #1499 begins shift
+[1518-08-29 00:44] falls asleep
+[1518-05-16 00:28] falls asleep
+[1518-11-03 23:56] Guard #1291 begins shift
+[1518-04-26 00:18] falls asleep
+[1518-07-21 00:00] Guard #919 begins shift
+[1518-08-21 00:04] falls asleep
+[1518-10-14 00:05] falls asleep
+[1518-06-19 00:57] wakes up
+[1518-08-27 00:54] wakes up
+[1518-09-13 23:56] Guard #1499 begins shift
+[1518-08-20 23:48] Guard #3559 begins shift
+[1518-09-30 23:50] Guard #313 begins shift
+[1518-08-20 00:37] falls asleep
+[1518-07-18 00:03] falls asleep
+[1518-04-23 00:17] wakes up
+[1518-05-14 00:17] falls asleep
+[1518-06-20 00:27] falls asleep
+[1518-06-01 23:59] Guard #241 begins shift
+[1518-06-05 00:52] wakes up
+[1518-06-26 00:37] wakes up
+[1518-05-28 00:14] wakes up
+[1518-11-12 23:49] Guard #3449 begins shift
+[1518-11-10 00:53] wakes up
+[1518-06-05 00:00] Guard #983 begins shift
+[1518-10-26 00:45] wakes up
+[1518-11-03 00:55] wakes up
+[1518-09-10 00:31] falls asleep
+[1518-05-31 00:56] wakes up
+[1518-11-14 00:31] wakes up
+[1518-06-20 00:43] wakes up
+[1518-06-09 00:45] falls asleep
+[1518-10-18 00:48] wakes up
+[1518-07-30 00:43] falls asleep
+[1518-08-12 00:04] Guard #2657 begins shift
+[1518-09-15 00:59] wakes up
+[1518-05-07 00:16] falls asleep
+[1518-09-14 00:56] wakes up
+[1518-08-25 00:45] wakes up
+[1518-04-07 00:55] falls asleep
+[1518-07-13 00:32] wakes up
+[1518-03-24 00:28] wakes up
+[1518-11-22 00:40] wakes up
+[1518-09-12 00:59] wakes up
+[1518-03-12 00:47] wakes up
+[1518-09-17 23:59] Guard #1291 begins shift
+[1518-05-26 00:40] falls asleep
+[1518-04-07 00:57] wakes up
+[1518-03-17 00:48] falls asleep
+[1518-09-10 00:56] wakes up
+[1518-06-16 00:29] wakes up
+[1518-09-04 00:41] wakes up
+[1518-05-02 23:53] Guard #241 begins shift
+[1518-08-17 00:43] falls asleep
+[1518-09-17 00:59] wakes up
+[1518-09-07 00:01] Guard #3499 begins shift
+[1518-10-11 00:29] falls asleep
+[1518-05-18 23:53] Guard #3109 begins shift
+[1518-07-02 00:00] falls asleep
+[1518-04-03 00:06] falls asleep
+[1518-05-04 23:58] Guard #2657 begins shift
+[1518-06-03 00:48] wakes up
+[1518-06-10 00:48] wakes up
+[1518-09-09 00:06] falls asleep
+[1518-06-04 00:32] wakes up
+[1518-08-19 00:32] falls asleep
+[1518-06-17 00:31] falls asleep
+[1518-11-17 23:59] Guard #1811 begins shift
+[1518-04-27 00:43] falls asleep
+[1518-05-26 00:06] falls asleep
+[1518-07-03 00:07] falls asleep
+[1518-05-16 00:00] Guard #983 begins shift
+[1518-07-26 23:57] Guard #1867 begins shift
+[1518-10-22 00:36] wakes up
+[1518-09-10 00:39] falls asleep
+[1518-05-20 00:59] wakes up
+[1518-09-26 00:20] falls asleep
+[1518-05-07 00:38] falls asleep
+[1518-10-05 00:53] wakes up
+[1518-07-05 00:39] falls asleep
+[1518-11-20 00:09] falls asleep
+[1518-03-19 00:34] wakes up
+[1518-11-14 23:47] Guard #1291 begins shift
+[1518-06-19 00:14] falls asleep
+[1518-09-15 23:58] Guard #2617 begins shift
+[1518-08-28 00:46] wakes up
+[1518-07-28 00:04] falls asleep
+[1518-11-19 00:57] wakes up
+[1518-04-15 00:17] falls asleep
+[1518-05-08 00:52] falls asleep
+[1518-10-03 00:32] wakes up
+[1518-07-05 00:51] wakes up
+[1518-06-09 00:16] wakes up
+[1518-04-28 00:43] wakes up
+[1518-07-09 00:38] falls asleep
diff --git a/src/04/part1 b/src/04/part1 new file mode 100644 index 0000000..f304657 --- /dev/null +++ b/src/04/part1 @@ -0,0 +1,76 @@ +--- Day 4: Repose Record --- + +You've sneaked into another supply closet - this time, it's across from the prototype suit +manufacturing lab. You need to sneak inside and fix the issues with the suit, but there's a guard +stationed outside the lab, so this is as close as you can safely get. + +As you search the closet for anything that might help, you discover that you're not the first person +to want to sneak in. Covering the walls, someone has spent an hour starting every midnight for the +past few months secretly observing this guard post! They've been writing down the ID of +[1m[97mthe one guard on duty that night[0m - the Elves seem to have decided that one guard was enough for the +overnight shift - as well as when they fall asleep or wake up while at their post (your puzzle +input). + +For example, consider the following records, which have already been organized into chronological +order: + +[1518-11-01 00:00] Guard #10 begins shift +[1518-11-01 00:05] falls asleep +[1518-11-01 00:25] wakes up +[1518-11-01 00:30] falls asleep +[1518-11-01 00:55] wakes up +[1518-11-01 23:58] Guard #99 begins shift +[1518-11-02 00:40] falls asleep +[1518-11-02 00:50] wakes up +[1518-11-03 00:05] Guard #10 begins shift +[1518-11-03 00:24] falls asleep +[1518-11-03 00:29] wakes up +[1518-11-04 00:02] Guard #99 begins shift +[1518-11-04 00:36] falls asleep +[1518-11-04 00:46] wakes up +[1518-11-05 00:03] Guard #99 begins shift +[1518-11-05 00:45] falls asleep +[1518-11-05 00:55] wakes up + +Timestamps are written using year-month-day hour:minute format. The guard falling asleep or waking +up is always the one whose shift most recently started. Because all asleep/awake times are during +the midnight hour (00:00 - 00:59), only the minute portion (00 - 59) is relevant for those events. + +Visually, these records show that the guards are asleep at these times: + +Date ID Minute + 000000000011111111112222222222333333333344444444445555555555 + 012345678901234567890123456789012345678901234567890123456789 +11-01 #10 .....####################.....#########################..... +11-02 #99 ........................................##########.......... +11-03 #10 ........................#####............................... +11-04 #99 ....................................##########.............. +11-05 #99 .............................................##########..... + +The columns are Date, which shows the month-day portion of the relevant day; ID, which shows the +guard on duty that day; and Minute, which shows the minutes during which the guard was asleep within +the midnight hour. (The Minute column's header shows the minute's ten's digit in the first row and +the one's digit in the second row.) Awake is shown as ., and asleep is shown as #. + +Note that guards count as asleep on the minute they fall asleep, and they count as awake on the +minute they wake up. For example, because Guard #10 wakes up at 00:25 on 1518-11-01, minute 25 is +marked as awake. + +If you can figure out the guard most likely to be asleep at a specific time, you might be able to +trick that guard into working tonight so you can have the best chance of sneaking in. You have two +strategies for choosing the best guard/minute combination. + +[1m[97mStrategy 1:[0m Find the guard that has the most minutes asleep. What minute does that guard spend +asleep the most? + +In the example above, Guard #10 spent the most minutes asleep, a total of 50 minutes (20+25+5), +while Guard #99 only slept for a total of 30 minutes (10+10+10). Guard #[1m[97m10[0m was asleep most during +minute [1m[97m24[0m (on two days, whereas any other minute the guard was asleep was only seen on one day). + +While this example listed the entries in chronological order, your entries are in the order you +found them. You'll need to organize them before they can be analyzed. + +[1m[97mWhat is the ID of the guard you chose multiplied by the minute you chose?[0m (In the above example, the +answer would be 10 * 24 = 240.) + + diff --git a/src/04/part2 b/src/04/part2 new file mode 100644 index 0000000..1f6a3ed --- /dev/null +++ b/src/04/part2 @@ -0,0 +1,20 @@ +--- Part Two --- + +An Elf just remembered one more important detail: the two adjacent matching digits [1m[97mare not part of a +larger group of matching digits[0m. + +Given this additional criterion, but still ignoring the range rule, the following are now true: + + + - 112233 meets these criteria because the digits never decrease and all repeated digits are exactly +two digits long. + + - 123[1m[97m444[0m no longer meets the criteria (the repeated 44 is part of a larger group of 444). + + - 111122 meets the criteria (even though 1 is repeated more than twice, it still contains a double +22). + + +[1m[97mHow many different passwords[0m within the range given in your puzzle input meet all of the criteria? + + diff --git a/src/04/solve.py b/src/04/solve.py new file mode 100644 index 0000000..0783b9b --- /dev/null +++ b/src/04/solve.py @@ -0,0 +1,92 @@ +import sys
+sys.path.append("../common")
+import aoc
+
+data = aoc.data.split("\n")
+
+def parse_entry(l):
+ split = l.split(" ")
+ date = " ".join(split[:2])
+ time = int(split[1].split(":")[1].replace("]",""))
+ if split[2] == "Guard":
+ awake = None
+ id = int(split[3].replace("#",""))
+ else:
+ id = 0
+ awake = (True if split[2] == "wakes" else False)
+ return time, id, awake, date
+
+class guard:
+ def __init__(self, _id):
+ self.shifts = list()
+ self.id = _id
+ self.awake = None
+
+def gen_shiftmap():
+ shiftdata = [parse_entry(l) for l in data]
+ shiftdata = sorted(shiftdata, key=lambda x: x[3]) # sort by date
+
+ shiftmap = dict()
+ ltime = shiftdata[0][0]
+ cgid = shiftdata[0][1]
+ for i in range(len(shiftdata)):
+ entry = shiftdata[i]
+ ctime = entry[0]
+ gid = entry[1]
+ cawake = entry[2]
+
+ if gid != 0:
+ if gid not in shiftmap:
+ shiftmap[gid] = guard(gid)
+ cgid = gid
+ else:
+ g = shiftmap[cgid]
+ if cawake:
+ if not g.awake:
+ shiftmap[cgid].shifts.append((ltime, ctime - ltime))
+ else:
+ ltime = ctime
+ g.awake = cawake
+
+ return shiftmap
+
+def solve1(args):
+ shiftmap = gen_shiftmap()
+
+ maxsleep = None
+ mg = None
+ for g in shiftmap.values():
+ minslept = 0
+ for t in g.shifts:
+ minslept += t[1]
+ if not maxsleep or minslept > maxsleep:
+ maxsleep = minslept
+ mg = g
+
+
+ timel = [0 for x in range(60)]
+
+ for t in mg.shifts:
+ for i in range(t[0], t[0] + t[1]):
+ timel[(i-1)%60] += 1
+
+ minute = timel.index(max(timel))+1
+
+ return minute * mg.id
+
+def solve2(args):
+ shiftmap = gen_shiftmap()
+ timetables = dict()
+
+ for g in shiftmap.values():
+ timetables[g.id] = [0 for x in range(60)]
+ for t in g.shifts:
+ for i in range(t[0], t[0] + t[1]):
+ timetables[g.id][i] += 1
+
+ mgid, mmin = max(((gid, i) for gid in timetables for i in range(60)),
+ key = lambda x: timetables[x[0]][x[1]])
+
+ return mgid * mmin
+
+aoc.run(solve1, solve2, sols=[87681, 136461])
diff --git a/src/05/input b/src/05/input new file mode 100644 index 0000000..1b4b16c --- /dev/null +++ b/src/05/input @@ -0,0 +1 @@ +HKkOohaAXxHrjUbByYuFfJMmOoZdDWVGgvwzZzUuUrRueERkIiKhnNpPdDXTtxMmwLlWGBbgTtoOmHOofSsFhrwWRWwytTwgGrRWYdcCUYyuqQHhpPiILPaApeElEeaAjJVvoiICIicdDOmnNMNZznoOgJmMFfjcCCcxXAaWiIwyYWwaAakBbLlJRrBbbBQqXrRNnHhcvVCxZzjKnrRNsSgGvVMmrqQWaAXxwRaAbHhBLlfkKCmMchiIHwRZJUujVvMmzrPsSpWZ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cGgGVvCcVvYaWwBBbNnbBmMXxbeEXxWwlZaAtTzLAyRrSBoOqiIuUQwxXWCcMgQqeEKkPWwpGmyYkmCcRrMKaTyYSsBbtMPQqpcbBCmdDzZwWOWwoKOoXxklLAIUuCcGgiNnUBwWcCrRrRbuBPDdrRRrpiaAIGgrOoRbWwvVxxXXbyxXYaUGgLllLuHzZKkWwhAhZcCJoOjXxxwWCwWBbcuUeEzPpZJjsCcSCcXRFRiIruUiIEeUBbSsQquZLUuUulHVvhwWHhVvPSspZBxXbbBzzMxDdXmZlLyYXAaIiTtKkxWJqQjcCwOoOjJdDlLSsNYQqyqUQquQhHJlLjnrRJBWjkKqQJwbNnhHlQqLiIYyOojbBTzZtwWoOLqQlTkKRrWwDMUSsumrRdtTtISszZJAOoHhaKkjitTJjZaeEAPaXxFfAfFhHUEethHTuKkLuxXUHBbhwWDtThHdJjAaJjhfFnNnNXxHaAAalUuZzeCcvVxXEhTtHQqCsSIEePpizKkuUGgnWwTtCcNWwzjJFfydDYtOogGTtmaAMTUuIiZZcinhHNiIJjTfFFfFftTtbBfSsFImbjJsnNRrSOovbBVQYUusSysQqSPpqPpHBnNblLyJjYyIiDdYTtgGhOoazZAsrRSdoODBDedDEdYnmMNUkKIiVQqrRrMmRvDduYyTVvtfFBbwrREeZzdDhHviIVbBfFQmMoOLlAayCcyYyYYqQNMRrmirRTtTtInwWySeEsYNuUpPnCWwGLlgcZAazoOALlWwanYyNloOLZzoOhFfgGHhtBnNbTqQHiqoOQCcInNFAoFfdAayVvYKCcaKkVvAOoRrkxyYXTzsSZcmMCtDyYpPOPpZvbBKkVzGDwGgPpoOJjLlWtTfFM
diff --git a/src/05/part1 b/src/05/part1 new file mode 100644 index 0000000..969c1a7 --- /dev/null +++ b/src/05/part1 @@ -0,0 +1,40 @@ +--- Day 5: Alchemical Reduction --- + +You've managed to sneak in to the prototype suit manufacturing lab. The Elves are making decent +progress, but are still struggling with the suit's size reduction capabilities. + +While the very latest in 1518 alchemical technology might have solved their problem eventually, you +can do better. You scan the chemical composition of the suit's material and discover that it is +formed by extremely long polymers (one of which is available as your puzzle input). + +The polymer is formed by smaller [1m[97munits[0m which, when triggered, react with each other such that two +adjacent units of the same type and opposite polarity are destroyed. Units' types are represented by +letters; units' polarity is represented by capitalization. For instance, r and R are units with the +same type but opposite polarity, whereas r and s are entirely different types and do not react. + +For example: + + + - In aA, a and A react, leaving nothing behind. + + - In abBA, bB destroys itself, leaving aA. As above, this then destroys itself, leaving nothing. + + - In abAB, no two adjacent units are of the same type, and so nothing happens. + + - In aabAAB, even though aa and AA are of the same type, their polarities match, and so nothing +happens. + + +Now, consider a larger example, dabAcCaCBAcCcaDA: + +dabA[1m[97mcC[0maCBAcCcaDA The first 'cC' is removed. +dab[1m[97mAa[0mCBAcCcaDA This creates 'Aa', which is removed. +dabCBA[1m[97mcCc[0maDA Either 'cC' or 'Cc' are removed (the result is the same). +dabCBAcaDA No further actions can be taken. + +After all possible reactions, the resulting polymer contains [1m[97m10 units[0m. + +[1m[97mHow many units remain after fully reacting the polymer you scanned?[0m (Note: in this puzzle and +others, the input is large; if you copy/paste your input, make sure you get the whole thing.) + + diff --git a/src/05/part2 b/src/05/part2 new file mode 100644 index 0000000..fce9042 --- /dev/null +++ b/src/05/part2 @@ -0,0 +1,75 @@ +--- Part Two --- + +The air conditioner comes online! Its cold air feels good for a while, but then the TEST alarms +start to go off. Since the air conditioner can't vent its heat anywhere but back into the +spacecraft, it's actually making the air inside the ship [1m[97mwarmer[0m. + +Instead, you'll need to use the TEST to extend the thermal radiators. Fortunately, the diagnostic +program (your puzzle input) is already equipped for this. Unfortunately, your Intcode computer is +not. + +Your computer is only missing a few opcodes: + + + - Opcode 5 is [1m[97mjump-if-true[0m: if the first parameter is [1m[97mnon-zero[0m, it sets the instruction pointer to +the value from the second parameter. Otherwise, it does nothing. + + - Opcode 6 is [1m[97mjump-if-false[0m: if the first parameter [1m[97mis zero[0m, it sets the instruction pointer to the +value from the second parameter. Otherwise, it does nothing. + + - Opcode 7 is [1m[97mless than[0m: if the first parameter is [1m[97mless than[0m the second parameter, it stores 1 in +the position given by the third parameter. Otherwise, it stores 0. + + - Opcode 8 is [1m[97mequals[0m: if the first parameter is [1m[97mequal to[0m the second parameter, it stores 1 in the +position given by the third parameter. Otherwise, it stores 0. + + +Like all instructions, these instructions need to support [1m[97mparameter modes[0m as described above. + +Normally, after an instruction is finished, the instruction pointer increases by the number of +values in that instruction. [1m[97mHowever[0m, if the instruction modifies the instruction pointer, that value +is used and the instruction pointer is [1m[97mnot automatically increased[0m. + +For example, here are several programs that take one input, compare it to the value 8, and then +produce one output: + + + - 3,9,8,9,10,9,4,9,99,-1,8 - Using [1m[97mposition mode[0m, consider whether the input is [1m[97mequal to[0m 8; output +1 (if it is) or 0 (if it is not). + + - 3,9,7,9,10,9,4,9,99,-1,8 - Using [1m[97mposition mode[0m, consider whether the input is [1m[97mless than[0m 8; output +1 (if it is) or 0 (if it is not). + + - 3,3,1108,-1,8,3,4,3,99 - Using [1m[97mimmediate mode[0m, consider whether the input is [1m[97mequal to[0m 8; output 1 +(if it is) or 0 (if it is not). + + - 3,3,1107,-1,8,3,4,3,99 - Using [1m[97mimmediate mode[0m, consider whether the input is [1m[97mless than [0m8; output +1 (if it is) or 0 (if it is not). + + +Here are some jump tests that take an input, then output 0 if the input was zero or 1 if the input +was non-zero: + + + - 3,12,6,12,15,1,13,14,13,4,13,99,-1,0,1,9 (using [1m[97mposition mode[0m) + + - 3,3,1105,-1,9,1101,0,0,12,4,12,99,1 (using [1m[97mimmediate mode[0m) + + +Here's a larger example: + +3,21,1008,21,8,20,1005,20,22,107,8,21,20,1006,20,31, +1106,0,36,98,0,0,1002,21,125,20,4,20,1105,1,46,104, +999,1105,1,46,1101,1000,1,20,4,20,1105,1,46,98,99 + +The above example program uses an input instruction to ask for a single number. The program will +then output 999 if the input value is below 8, output 1000 if the input value is equal to 8, or +output 1001 if the input value is greater than 8. + +This time, when the TEST diagnostic program runs its input instruction to get the ID of the system +to test, [1m[97mprovide it 5[0m, the ID for the ship's thermal radiator controller. This diagnostic test suite +only outputs one number, the [1m[97mdiagnostic code[0m. + +[1m[97mWhat is the diagnostic code for system ID 5?[0m + + diff --git a/src/05/solve.py b/src/05/solve.py new file mode 100644 index 0000000..263f9fd --- /dev/null +++ b/src/05/solve.py @@ -0,0 +1,30 @@ +import sys
+sys.path.append("../common")
+import aoc
+
+data = aoc.data
+
+def react(s):
+ i = 0
+ while i < len(s)-1:
+ cs = "".join(s[i:i+2])
+ csl = cs.lower()
+ if csl[0] == csl[1] and cs[0] != cs[1]:
+ s.pop(i)
+ s.pop(i)
+ if i > 0:
+ i -= 1
+ else:
+ i += 1
+
+ return len(s)
+
+def solve1(args):
+ return react(list(data))
+
+def solve2(args):
+ react_wo = lambda x : react(list(data.replace(x, "").replace(x.upper(), "")))
+ alph = "abcdefghijklmnopqrstuvwxyz"
+ return min((react_wo(c) for c in alph))
+
+aoc.run(solve1, solve2, sols=[11364, 4212])
diff --git a/src/06/input b/src/06/input new file mode 100644 index 0000000..233e279 --- /dev/null +++ b/src/06/input @@ -0,0 +1,50 @@ +69, 102
+118, 274
+150, 269
+331, 284
+128, 302
+307, 192
+238, 52
+240, 339
+111, 127
+180, 156
+248, 265
+160, 69
+58, 136
+43, 235
+154, 202
+262, 189
+309, 53
+292, 67
+335, 198
+99, 199
+224, 120
+206, 313
+359, 352
+101, 147
+301, 47
+255, 347
+121, 153
+264, 343
+252, 225
+48, 90
+312, 139
+90, 277
+203, 227
+315, 328
+330, 81
+190, 191
+89, 296
+312, 255
+218, 181
+299, 149
+151, 254
+209, 212
+42, 76
+348, 183
+333, 227
+44, 210
+293, 356
+44, 132
+175, 77
+215, 109
\ No newline at end of file diff --git a/src/06/part1 b/src/06/part1 new file mode 100644 index 0000000..e34879f --- /dev/null +++ b/src/06/part1 @@ -0,0 +1,65 @@ +--- Day 6: Chronal Coordinates --- + +The device on your wrist beeps several times, and once again you feel like you're falling. + +"Situation critical," the device announces. "Destination indeterminate. Chronal interference +detected. Please specify new target coordinates." + +The device then produces a list of coordinates (your puzzle input). Are they places it thinks are +safe or dangerous? It recommends you check manual page 729. The Elves did not give you a manual. + +[1m[97mIf they're dangerous,[0m maybe you can minimize the danger by finding the coordinate that gives the +largest distance from the other points. + +Using only the Manhattan distance, determine the [1m[97marea[0m around each coordinate by counting the number +of integer X,Y locations that are [1m[97mclosest[0m to that coordinate (and aren't [1m[97mtied in distance[0m to any +other coordinate). + +Your goal is to find the size of the [1m[97mlargest area[0m that isn't infinite. For example, consider the +following list of coordinates: + +1, 1 +1, 6 +8, 3 +3, 4 +5, 5 +8, 9 + +If we name these coordinates A through F, we can draw them on a grid, putting 0,0 at the top left: + +.......... +.A........ +.......... +........C. +...D...... +.....E.... +.B........ +.......... +.......... +........F. + +This view is partial - the actual grid extends infinitely in all directions. Using the Manhattan +distance, each location's closest coordinate can be determined, shown here in lowercase: + +aaaaa.cccc +a[1m[97mA[0maaa.cccc +aaaddecccc +aadddecc[1m[97mC[0mc +..d[1m[97mD[0mdeeccc +bb.de[1m[97mE[0meecc +b[1m[97mB[0mb.eeee.. +bbb.eeefff +bbb.eeffff +bbb.ffff[1m[97mF[0mf + +Locations shown as . are equally far from two or more coordinates, and so they don't count as being +closest to any. + +In this example, the areas of coordinates A, B, C, and F are infinite - while not shown here, their +areas extend forever outside the visible grid. However, the areas of coordinates D and E are finite: +D is closest to 9 locations, and E is closest to 17 (both including the coordinate's location +itself). Therefore, in this example, the size of the largest area is [1m[97m17[0m. + +[1m[97mWhat is the size of the largest area[0m that isn't infinite? + + diff --git a/src/06/part2 b/src/06/part2 new file mode 100644 index 0000000..1088955 --- /dev/null +++ b/src/06/part2 @@ -0,0 +1,61 @@ +--- Part Two --- + +Now, you just need to figure out how many [1m[97morbital transfers[0m you (YOU) need to take to get to Santa +(SAN). + +You start at the object YOU are orbiting; your destination is the object SAN is orbiting. An orbital +transfer lets you move from any object to an object orbiting or orbited by that object. + +For example, suppose you have the following map: + +COM)B +B)C +C)D +D)E +E)F +B)G +G)H +D)I +E)J +J)K +K)L +K)YOU +I)SAN + +Visually, the above map of orbits looks like this: + + [1m[97mYOU[0m + [1m[97m/[0m + G - H [1m[97mJ - K[0m - L + / [1m[97m/[0m +COM - B - C - [1m[97mD - E[0m - F + [1m[97m\[0m + [1m[97mI - SAN[0m + +In this example, YOU are in orbit around K, and SAN is in orbit around I. To move from K to I, a +minimum of 4 orbital transfers are required: + + + - K to J + + - J to E + + - E to D + + - D to I + + +Afterward, the map of orbits looks like this: + + G - H J - K - L + / / +COM - B - C - D - E - F + \ + I - SAN + [1m[97m\[0m + [1m[97mYOU[0m + +[1m[97mWhat is the minimum number of orbital transfers required[0m to move from the object YOU are orbiting to +the object SAN is orbiting? (Between the objects they are orbiting - [1m[97mnot[0m between YOU and SAN.) + + diff --git a/src/06/solve.py b/src/06/solve.py new file mode 100644 index 0000000..f0627fe --- /dev/null +++ b/src/06/solve.py @@ -0,0 +1,76 @@ +import sys
+sys.path.append("../common")
+import aoc
+
+data = [[int(v) for v in l.split(",")] for l in aoc.data.split("\n")]
+
+minx = min(data, key = lambda x: x[0])[0]
+maxx = max(data, key = lambda x: x[0])[0]
+miny = min(data, key = lambda x: x[1])[1]
+maxy = max(data, key = lambda x: x[1])[1]
+
+def closest(x, y):
+ mc = None
+ md = None
+ ad = None
+ for i in range(len(data)):
+ c = data[i]
+ dist = abs(c[0] - x) + abs(c[1] - y)
+ if md == None or dist < md:
+ md = dist
+ mc = i
+ ad = None
+ elif dist == md:
+ ad = dist
+ return mc, ad
+
+def combined_dist(x, y):
+ dist = 0
+ for i in range(len(data)):
+ c = data[i]
+ dist += abs(c[0] - x) + abs(c[1] - y)
+ return dist
+
+def solve1(args):
+ areas = dict()
+ for x in range(minx, maxx):
+ for y in range(miny, maxy):
+ mc, ad = closest(x, y)
+ if ad == None:
+ if mc not in areas:
+ areas[mc] = 1
+ else:
+ areas[mc] += 1
+
+ # remove outside points
+ for i in range(len(data)):
+ c = data[i]
+ mc, ac = closest(minx, c[1])
+ if mc == i:
+ areas.pop(i)
+ continue
+ mc, ac = closest(maxx, c[1])
+ if mc == i:
+ areas.pop(i)
+ continue
+ mc, ac = closest(c[0], miny)
+ if mc == i:
+ areas.pop(i)
+ continue
+ mc, ac = closest(c[0], maxy)
+ if mc == i:
+ areas.pop(i)
+ continue
+
+ return max(areas.values())
+
+def solve2(args):
+ safezone = 0
+ for x in range(minx, maxx):
+ for y in range(miny, maxy):
+ dist = combined_dist(x,y)
+ if dist < 10000:
+ safezone += 1
+ return safezone
+
+aoc.run(solve1, solve2, sols=[3276, 38380])
diff --git a/src/07/input b/src/07/input new file mode 100644 index 0000000..77b5f0c --- /dev/null +++ b/src/07/input @@ -0,0 +1,101 @@ +Step S must be finished before step V can begin.
+Step J must be finished before step T can begin.
+Step N must be finished before step Q can begin.
+Step O must be finished before step H can begin.
+Step I must be finished before step C can begin.
+Step Y must be finished before step R can begin.
+Step K must be finished before step B can begin.
+Step A must be finished before step C can begin.
+Step B must be finished before step D can begin.
+Step W must be finished before step T can begin.
+Step E must be finished before step V can begin.
+Step Q must be finished before step L can begin.
+Step U must be finished before step P can begin.
+Step R must be finished before step C can begin.
+Step V must be finished before step M can begin.
+Step X must be finished before step P can begin.
+Step G must be finished before step T can begin.
+Step T must be finished before step Z can begin.
+Step Z must be finished before step M can begin.
+Step F must be finished before step C can begin.
+Step M must be finished before step L can begin.
+Step D must be finished before step C can begin.
+Step H must be finished before step L can begin.
+Step L must be finished before step P can begin.
+Step P must be finished before step C can begin.
+Step S must be finished before step Q can begin.
+Step M must be finished before step P can begin.
+Step S must be finished before step T can begin.
+Step U must be finished before step T can begin.
+Step X must be finished before step H can begin.
+Step Q must be finished before step G can begin.
+Step Y must be finished before step U can begin.
+Step H must be finished before step C can begin.
+Step O must be finished before step F can begin.
+Step S must be finished before step P can begin.
+Step B must be finished before step E can begin.
+Step S must be finished before step D can begin.
+Step R must be finished before step X can begin.
+Step Z must be finished before step D can begin.
+Step J must be finished before step C can begin.
+Step Z must be finished before step F can begin.
+Step K must be finished before step T can begin.
+Step T must be finished before step H can begin.
+Step E must be finished before step H can begin.
+Step D must be finished before step L can begin.
+Step O must be finished before step A can begin.
+Step V must be finished before step T can begin.
+Step V must be finished before step X can begin.
+Step Q must be finished before step X can begin.
+Step O must be finished before step K can begin.
+Step L must be finished before step C can begin.
+Step W must be finished before step H can begin.
+Step I must be finished before step T can begin.
+Step M must be finished before step H can begin.
+Step V must be finished before step G can begin.
+Step K must be finished before step P can begin.
+Step E must be finished before step X can begin.
+Step V must be finished before step C can begin.
+Step Y must be finished before step W can begin.
+Step J must be finished before step G can begin.
+Step B must be finished before step C can begin.
+Step B must be finished before step Z can begin.
+Step K must be finished before step R can begin.
+Step Y must be finished before step V can begin.
+Step X must be finished before step G can begin.
+Step J must be finished before step K can begin.
+Step A must be finished before step M can begin.
+Step T must be finished before step M can begin.
+Step W must be finished before step D can begin.
+Step G must be finished before step F can begin.
+Step A must be finished before step B can begin.
+Step W must be finished before step F can begin.
+Step Y must be finished before step P can begin.
+Step B must be finished before step V can begin.
+Step N must be finished before step G can begin.
+Step J must be finished before step H can begin.
+Step S must be finished before step L can begin.
+Step A must be finished before step R can begin.
+Step X must be finished before step D can begin.
+Step Y must be finished before step M can begin.
+Step H must be finished before step P can begin.
+Step F must be finished before step D can begin.
+Step S must be finished before step G can begin.
+Step K must be finished before step C can begin.
+Step W must be finished before step Z can begin.
+Step A must be finished before step Z can begin.
+Step O must be finished before step Y can begin.
+Step U must be finished before step C can begin.
+Step X must be finished before step M can begin.
+Step Y must be finished before step A can begin.
+Step F must be finished before step P can begin.
+Step J must be finished before step Y can begin.
+Step R must be finished before step G can begin.
+Step Y must be finished before step Q can begin.
+Step D must be finished before step P can begin.
+Step O must be finished before step U can begin.
+Step O must be finished before step I can begin.
+Step E must be finished before step L can begin.
+Step G must be finished before step Z can begin.
+Step T must be finished before step F can begin.
+Step Q must be finished before step F can begin.
diff --git a/src/07/part1 b/src/07/part1 new file mode 100644 index 0000000..2006578 --- /dev/null +++ b/src/07/part1 @@ -0,0 +1,65 @@ +--- Day 7: The Sum of Its Parts --- + +You find yourself standing on a snow-covered coastline; apparently, you landed a little off course. +The region is too hilly to see the North Pole from here, but you do spot some Elves that seem to be +trying to unpack something that washed ashore. It's quite cold out, so you decide to risk creating a +paradox by asking them for directions. + +"Oh, are you the search party?" Somehow, you can understand whatever Elves from the year 1018 speak; +you assume it's Ancient Nordic Elvish. Could the device on your wrist also be a translator? "Those +clothes don't look very warm; take this." They hand you a heavy coat. + +"We do need to find our way back to the North Pole, but we have higher priorities at the moment. You +see, believe it or not, this box contains something that will solve all of Santa's transportation +problems - at least, that's what it looks like from the pictures in the instructions." It doesn't +seem like they can read whatever language it's in, but you can: "Sleigh kit. Some assembly +required." + +"'Sleigh'? What a wonderful name! You must help us assemble this 'sleigh' at once!" They start +excitedly pulling more parts out of the box. + +The instructions specify a series of [1m[97msteps[0m and requirements about which steps must be finished +before others can begin (your puzzle input). Each step is designated by a single letter. For +example, suppose you have the following instructions: + +Step C must be finished before step A can begin. +Step C must be finished before step F can begin. +Step A must be finished before step B can begin. +Step A must be finished before step D can begin. +Step B must be finished before step E can begin. +Step D must be finished before step E can begin. +Step F must be finished before step E can begin. + +Visually, these requirements look like this: + + -->A--->B-- + / \ \ +C -->D----->E + \ / + ---->F----- + +Your first goal is to determine the order in which the steps should be completed. If more than one +step is ready, choose the step which is first alphabetically. In this example, the steps would be +completed as follows: + + + - Only [1m[97mC[0m is available, and so it is done first. + + - Next, both A and F are available. [1m[97mA[0m is first alphabetically, so it is done next. + + - Then, even though F was available earlier, steps B and D are now also available, and +[1m[97mB[0m is the first alphabetically of the three. + + - After that, only D and F are available. E is not available because only some of its prerequisites +are complete. Therefore, [1m[97mD[0m is completed next. + + - [1m[97mF[0m is the only choice, so it is done next. + + - Finally, [1m[97mE[0m is completed. + + +So, in this example, the correct order is [1m[97mCABDFE[0m. + +[1m[97mIn what order should the steps in your instructions be completed?[0m + + diff --git a/src/07/part2 b/src/07/part2 new file mode 100644 index 0000000..d79d8a1 --- /dev/null +++ b/src/07/part2 @@ -0,0 +1,54 @@ +--- Part Two --- + +It's no good - in this configuration, the amplifiers can't generate a large enough output signal to +produce the thrust you'll need. The Elves quickly talk you through rewiring the amplifiers into a +[1m[97mfeedback loop[0m: + + O-------O O-------O O-------O O-------O O-------O +0 -+->| Amp A |->| Amp B |->| Amp C |->| Amp D |->| Amp E |-. + | O-------O O-------O O-------O O-------O O-------O | + | | + '--------------------------------------------------------+ + | + v + (to thrusters) + +Most of the amplifiers are connected as they were before; amplifier A's output is connected to +amplifier B's input, and so on. [1m[97mHowever,[0m the output from amplifier E is now connected into amplifier +A's input. This creates the feedback loop: the signal will be sent through the amplifiers +[1m[97mmany times[0m. + +In feedback loop mode, the amplifiers need [1m[97mtotally different phase settings[0m: integers from 5 to 9, +again each used exactly once. These settings will cause the Amplifier Controller Software to +repeatedly take input and produce output many times before halting. Provide each amplifier its phase +setting at its first input instruction; all further input/output instructions are for signals. + +Don't restart the Amplifier Controller Software on any amplifier during this process. Each one +should continue receiving and sending signals until it halts. + +All signals sent or received in this process will be between pairs of amplifiers except the very +first signal and the very last signal. To start the process, a 0 signal is sent to amplifier A's +input [1m[97mexactly once[0m. + +Eventually, the software on the amplifiers will halt after they have processed the final loop. When +this happens, the last output signal from amplifier E is sent to the thrusters. Your job is to +[1m[97mfind the largest output signal that can be sent to the thrusters[0m using the new phase settings and +feedback loop arrangement. + +Here are some example programs: + + + - Max thruster signal [1m[97m139629729[0m (from phase setting sequence 9,8,7,6,5): +3,26,1001,26,-4,26,3,27,1002,27,2,27,1,27,26, +27,4,27,1001,28,-1,28,1005,28,6,99,0,0,5 + + - Max thruster signal [1m[97m18216[0m (from phase setting sequence 9,7,8,5,6): +3,52,1001,52,-5,52,3,53,1,52,56,54,1007,54,5,55,1005,55,26,1001,54, +-5,54,1105,1,12,1,53,54,53,1008,54,0,55,1001,55,1,55,2,53,55,53,4, +53,1001,56,-1,56,1005,56,6,99,0,0,0,0,10 + + +Try every combination of the new phase settings on the amplifier feedback loop. [1m[97mWhat is the highest +signal that can be sent to the thrusters?[0m + + diff --git a/src/07/solve.py b/src/07/solve.py new file mode 100644 index 0000000..8d7c708 --- /dev/null +++ b/src/07/solve.py @@ -0,0 +1,105 @@ +import sys
+sys.path.append("../common")
+import aoc
+
+data = aoc.data.split("\n")
+
+def remove_reqs(req, insts):
+ for res in insts:
+ if req in insts[res]:
+ insts[res].remove(req)
+
+def parse_entry(l):
+ split = l.split(" ")
+ firstl = split[1]
+ nextl = split[-3]
+ return firstl, nextl
+
+def gen_insts():
+ global data
+ data = [parse_entry(l) for l in data if len(l) != 0]
+
+ insts = dict()
+
+ for ins in data:
+ req = ins[0]
+ res = ins[1]
+ if res not in insts:
+ insts[res] = [ req ]
+ else:
+ insts[res].append(req)
+
+ values = list(insts.values())[:]
+ for reslist in values:
+ for res in reslist:
+ if res not in insts:
+ insts[res] = []
+
+ return insts
+
+def overlap(arr1, arr2):
+ for a1 in arr1:
+ if a1 in arr2:
+ return True
+ return False
+
+def checkfail(workers):
+ done = True
+ for w in workers:
+ if w[2]:
+ done = False
+ break
+ return done
+
+def solve1(args):
+ insts = gen_insts()
+
+ i = 0
+ plan = list()
+ while i < len(insts):
+ res = sorted(insts.keys())[i] # alphabetically
+ if len(insts[res]) == 0:
+ plan.append(res)
+ insts.pop(res, None)
+ remove_reqs(res, insts)
+ i = 0
+ else:
+ i += 1
+
+ return "".join(plan)
+
+def solve2(args):
+ insts = gen_insts()
+
+ # worker: (task, time, done)
+ workers = [["", 0, False] for x in range(5)]
+
+ time = -1
+ stop = False
+ while not stop:
+ time += 1
+ for i in range(len(workers)):
+ w = workers[i]
+ if time >= w[1]:
+ if w[2]:
+ remove_reqs(w[0], insts)
+ aoc.debug("end : " + str(i) + " - " + str((w[0], w[1])))
+ w[2] = False
+ if len(insts) == 0 and checkfail(workers):
+ stop = True
+ break
+
+ for i in range(len(workers)):
+ w = workers[i]
+ if time >= w[1]:
+ for res in sorted(insts.keys()):
+ if len(insts[res]) == 0:
+ wtime = time + ord(res)-65+1 + 60
+ aoc.debug("start : " + str(i) + " - " + str((res, time)))
+ w[:] = (res, wtime, True)
+ insts.pop(res, None)
+ break
+
+ return time
+
+aoc.run(solve1, solve2, sols=["JNOIKSYABEQRUVWXGTZFDMHLPC", 1099])
diff --git a/src/08/input b/src/08/input new file mode 100644 index 0000000..bbf272c --- /dev/null +++ b/src/08/input @@ -0,0 +1 @@ +7 11 6 3 5 5 3 6 1 7 0 10 1 7 4 5 1 3 1 5 9 1 1 3 2 1 3 1 2 1 6 0 9 2 5 9 4 1 1 2 7 2 3 1 3 3 1 3 1 9 0 9 1 7 9 9 1 7 9 5 8 2 1 3 3 3 2 1 2 2 5 2 1 3 2 1 3 6 1 6 0 7 1 2 6 4 4 3 4 1 2 2 1 2 3 1 9 0 11 9 2 3 2 6 7 1 4 5 3 4 1 1 3 1 3 3 2 3 1 1 8 0 7 1 3 6 8 8 3 8 1 3 1 1 2 2 3 3 3 1 5 2 2 1 3 6 1 8 0 10 7 3 1 4 9 5 4 4 8 6 2 1 1 1 1 3 3 3 1 9 0 10 7 9 1 2 2 1 3 9 2 3 2 1 3 2 2 1 1 2 1 1 9 0 8 1 6 1 8 5 1 1 1 1 1 3 1 3 3 3 1 1 2 4 4 4 2 1 3 5 1 6 0 6 1 8 5 2 1 9 3 3 1 1 1 3 1 7 0 10 2 6 9 7 8 1 1 3 2 1 3 1 2 2 1 2 3 1 8 0 6 1 9 6 1 9 5 1 2 1 1 3 3 1 2 4 2 2 2 5 3 7 1 9 0 8 5 9 3 1 4 3 1 5 1 2 1 1 3 1 2 1 2 1 5 0 8 5 1 3 6 3 1 3 9 3 1 3 3 2 1 7 0 11 7 8 5 4 9 6 2 8 7 1 9 3 1 2 2 1 3 1 5 5 5 5 5 1 4 1 3 5 5 2 5 3 3 7 1 7 0 11 3 1 4 9 2 7 7 9 5 5 9 2 3 1 2 3 3 3 1 9 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1 2 1 2 3 2 1 5 3 2 2 1 3 5 1 9 0 7 9 3 5 1 1 9 4 1 3 1 3 1 3 1 3 3 1 5 0 10 6 1 3 8 3 1 5 8 9 4 2 1 2 2 2 1 8 0 8 9 5 8 5 5 7 4 1 3 3 1 1 3 2 1 3 2 4 4 3 4 1 1 3 4 1 5 4 3 7 1 9 0 11 5 7 9 9 9 7 4 7 2 1 6 1 1 3 2 2 3 1 2 2 1 5 0 6 2 2 6 1 9 4 2 3 3 1 2 1 7 0 6 4 1 5 1 2 5 2 3 1 3 1 1 2 1 5 5 1 2 1 4 3 5 1 9 0 7 7 6 7 1 4 3 1 3 1 3 1 3 3 1 1 2 1 7 0 9 1 2 8 8 2 1 5 9 8 3 2 2 2 3 1 1 1 9 0 6 7 1 1 4 4 4 2 2 2 1 1 2 1 1 3 5 5 5 2 2 3 7 1 5 0 7 1 1 5 1 9 1 4 1 3 2 1 1 1 8 0 11 5 1 8 3 6 8 6 3 2 4 4 3 3 3 1 1 2 2 1 1 7 0 10 8 1 3 1 6 8 1 3 1 1 3 3 2 1 1 2 1 1 2 2 2 1 2 3 3 4 1 8 0 7 9 9 5 1 6 1 2 2 2 2 2 2 1 3 1 1 6 0 9 1 4 2 5 9 7 8 7 6 3 1 3 1 3 1 1 6 0 6 8 2 1 7 9 1 1 2 1 3 1 1 1 5 3 3 3 5 1 8 0 9 5 3 6 3 1 3 1 7 8 1 1 3 1 1 1 1 2 1 5 0 7 2 3 3 4 8 1 7 2 1 1 3 1 1 8 0 7 3 8 3 8 2 1 3 1 2 1 1 1 2 2 1 4 3 1 5 3 2 1 5 6 2 6 4 5 7 9 3 8 1 8 8 4 6 1
diff --git a/src/08/part1 b/src/08/part1 new file mode 100644 index 0000000..8a95507 --- /dev/null +++ b/src/08/part1 @@ -0,0 +1,58 @@ +--- Day 8: Memory Maneuver --- + +The sleigh is much easier to pull than you'd expect for something its weight. Unfortunately, neither +you nor the Elves know which way the North Pole is from here. + +You check your wrist device for anything that might help. It seems to have some kind of navigation +system! Activating the navigation system produces more bad news: "Failed to start navigation +system. Could not read software license file." + +The navigation system's license file consists of a list of numbers (your puzzle input). The numbers +define a data structure which, when processed, produces some kind of tree that can be used to +calculate the license number. + +The [1m[97mtree[0m is made up of [1m[97mnodes[0m; a single, outermost node forms the tree's [1m[97mroot[0m, and it contains all +other nodes in the tree (or contains nodes that contain nodes, and so on). + +Specifically, a node consists of: + + + - A [1m[97mheader[0m, which is always exactly two numbers: + + - The quantity of child nodes. + + - The quantity of metadata entries. + + + - Zero or more [1m[97mchild nodes[0m (as specified in the header). + + - One or more [1m[97mmetadata entries[0m (as specified in the header). + + + +Each child node is itself a node that has its own header, child nodes, and metadata. For example: + +2 3 0 3 10 11 12 1 1 0 1 99 2 1 1 2 +A---------------------------------- + B----------- C----------- + D----- + +In this example, each node of the tree is also marked with an underline starting with a letter for +easier identification. In it, there are four nodes: + + + - A, which has 2 child nodes (B, C) and 3 metadata entries (1, 1, 2). + + - B, which has 0 child nodes and 3 metadata entries (10, 11, 12). + + - C, which has 1 child node (D) and 1 metadata entry (2). + + - D, which has 0 child nodes and 1 metadata entry (99). + + +The first check done on the license file is to simply add up all of the metadata entries. In this +example, that sum is 1+1+2+10+11+12+2+99=[1m[97m138[0m. + +[1m[97mWhat is the sum of all metadata entries?[0m + + diff --git a/src/08/part2 b/src/08/part2 new file mode 100644 index 0000000..7c88e38 --- /dev/null +++ b/src/08/part2 @@ -0,0 +1,46 @@ +--- Part Two --- + +Now you're ready to decode the image. The image is rendered by stacking the layers and aligning the +pixels with the same positions in each layer. The digits indicate the color of the corresponding +pixel: 0 is black, 1 is white, and 2 is transparent. + +The layers are rendered with the first layer in front and the last layer in back. So, if a given +position has a transparent pixel in the first and second layers, a black pixel in the third layer, +and a white pixel in the fourth layer, the final image would have a [1m[97mblack[0m pixel at that position. + +For example, given an image 2 pixels wide and 2 pixels tall, the image data 0222112222120000 +corresponds to the following image layers: + +Layer 1: [1m[97m0[0m2 + 22 + +Layer 2: 1[1m[97m1[0m + 22 + +Layer 3: 22 + [1m[97m1[0m2 + +Layer 4: 00 + 0[1m[97m0[0m + +Then, the full image can be found by determining the top visible pixel in each position: + + + - The top-left pixel is [1m[97mblack[0m because the top layer is 0. + + - The top-right pixel is [1m[97mwhite[0m because the top layer is 2 (transparent), but the second layer is 1. + + - The bottom-left pixel is [1m[97mwhite[0m because the top two layers are 2, but the third layer is 1. + + - The bottom-right pixel is [1m[97mblack[0m because the only visible pixel in that position is 0 (from layer +4). + + +So, the final image looks like this: + +01 +10 + +[1m[97mWhat message is produced after decoding your image?[0m + + diff --git a/src/08/solve.py b/src/08/solve.py new file mode 100644 index 0000000..bc999d8 --- /dev/null +++ b/src/08/solve.py @@ -0,0 +1,43 @@ +import sys
+sys.path.append("../common")
+import aoc
+
+data = [int(v) for v in aoc.data.split(" ")]
+
+def get_nodes(nsize, index):
+ nodes = list()
+ for i in range(nsize):
+ cnsize = data[index + 0]
+ mdsize = data[index + 1]
+ cnodes, index = get_nodes(cnsize, index + 2)
+ metadata = data[index:index + mdsize]
+ nodes.append([cnodes, metadata])
+ index = index + mdsize
+ return nodes, index
+
+def node_sum(nodes):
+ metadata = 0
+ for n in nodes:
+ metadata += sum(n[1]) + node_sum(n[0])
+ return metadata
+
+def nodeValue(n):
+ if len(n[0]) == 0:
+ return sum(n[1])
+ else:
+ value = 0
+ for i in range(len(n[1])):
+ ni = n[1][i]-1
+ if ni < len(n[0]):
+ value += nodeValue(n[0][ni])
+ return value
+
+def solve1(args):
+ nodes, index = get_nodes(1, 0)
+ return node_sum(nodes)
+
+def solve2(args):
+ nodes, index = get_nodes(1, 0)
+ return nodeValue(nodes[0])
+
+aoc.run(solve1, solve2, sols=[36307, 25154])
diff --git a/src/09/input b/src/09/input new file mode 100644 index 0000000..29b93ef --- /dev/null +++ b/src/09/input @@ -0,0 +1 @@ +418 players; last marble is worth 71339 points diff --git a/src/09/part1 b/src/09/part1 new file mode 100644 index 0000000..d9bccb0 --- /dev/null +++ b/src/09/part1 @@ -0,0 +1,78 @@ +--- Day 9: Marble Mania --- + +You talk to the Elves while you wait for your navigation system to initialize. To pass the time, +they introduce you to their favorite marble game. + +The Elves play this game by taking turns arranging the marbles in a [1m[97mcircle[0m according to very +particular rules. The marbles are numbered starting with 0 and increasing by 1 until every marble +has a number. + +First, the marble numbered 0 is placed in the circle. At this point, while it contains only a single +marble, it is still a circle: the marble is both clockwise from itself and counter-clockwise from +itself. This marble is designated the [1m[97mcurrent marble[0m. + +Then, each Elf takes a turn placing the [1m[97mlowest-numbered remaining marble[0m into the circle between the +marbles that are 1 and 2 marbles [1m[97mclockwise[0m of the current marble. (When the circle is large enough, +this means that there is one marble between the marble that was just placed and the current marble.) +The marble that was just placed then becomes the [1m[97mcurrent marble[0m. + +However, if the marble that is about to be placed has a number which is a multiple of 23, +[1m[97msomething entirely different happens[0m. First, the current player keeps the marble they would have +placed, adding it to their [1m[97mscore[0m. In addition, the marble 7 marbles [1m[97mcounter-clockwise[0m from the +current marble is [1m[97mremoved[0m from the circle and [1m[97malso[0m added to the current player's score. The marble +located immediately [1m[97mclockwise[0m of the marble that was removed becomes the new [1m[97mcurrent marble[0m. + +For example, suppose there are 9 players. After the marble with value 0 is placed in the middle, +each player (shown in square brackets) takes a turn. The result of each of those turns would produce +circles of marbles like this, where clockwise is to the right and the resulting current marble is in +parentheses: + +[-] [1m[97m(0)[0m +[1] 0[1m[97m (1)[0m +[2] 0[1m[97m (2)[0m 1 +[3] 0 2 1[1m[97m (3)[0m +[4] 0[1m[97m (4)[0m 2 1 3 +[5] 0 4 2[1m[97m (5)[0m 1 3 +[6] 0 4 2 5 1[1m[97m (6)[0m 3 +[7] 0 4 2 5 1 6 3[1m[97m (7)[0m +[8] 0[1m[97m (8)[0m 4 2 5 1 6 3 7 +[9] 0 8 4[1m[97m (9)[0m 2 5 1 6 3 7 +[1] 0 8 4 9 2[1m[97m(10)[0m 5 1 6 3 7 +[2] 0 8 4 9 2 10 5[1m[97m(11)[0m 1 6 3 7 +[3] 0 8 4 9 2 10 5 11 1[1m[97m(12)[0m 6 3 7 +[4] 0 8 4 9 2 10 5 11 1 12 6[1m[97m(13)[0m 3 7 +[5] 0 8 4 9 2 10 5 11 1 12 6 13 3[1m[97m(14)[0m 7 +[6] 0 8 4 9 2 10 5 11 1 12 6 13 3 14 7[1m[97m(15)[0m +[7] 0[1m[97m(16)[0m 8 4 9 2 10 5 11 1 12 6 13 3 14 7 15 +[8] 0 16 8[1m[97m(17)[0m 4 9 2 10 5 11 1 12 6 13 3 14 7 15 +[9] 0 16 8 17 4[1m[97m(18)[0m 9 2 10 5 11 1 12 6 13 3 14 7 15 +[1] 0 16 8 17 4 18 9[1m[97m(19)[0m 2 10 5 11 1 12 6 13 3 14 7 15 +[2] 0 16 8 17 4 18 9 19 2[1m[97m(20)[0m10 5 11 1 12 6 13 3 14 7 15 +[3] 0 16 8 17 4 18 9 19 2 20 10[1m[97m(21)[0m 5 11 1 12 6 13 3 14 7 15 +[4] 0 16 8 17 4 18 9 19 2 20 10 21 5[1m[97m(22)[0m11 1 12 6 13 3 14 7 15 +[5] 0 16 8 17 4 18[1m[97m(19)[0m 2 20 10 21 5 22 11 1 12 6 13 3 14 7 15 +[6] 0 16 8 17 4 18 19 2[1m[97m(24)[0m20 10 21 5 22 11 1 12 6 13 3 14 7 15 +[7] 0 16 8 17 4 18 19 2 24 20[1m[97m(25)[0m10 21 5 22 11 1 12 6 13 3 14 7 15 + +The goal is to be the [1m[97mplayer with the highest score[0m after the last marble is used up. Assuming the +example above ends after the marble numbered 25, the winning score is 23+9=[1m[97m32[0m (because player 5 kept +marble 23 and removed marble 9, while no other player got any points in this very short example +game). + +Here are a few more examples: + + + - 10 players; last marble is worth 1618 points: high score is [1m[97m8317[0m + + - 13 players; last marble is worth 7999 points: high score is [1m[97m146373[0m + + - 17 players; last marble is worth 1104 points: high score is [1m[97m2764[0m + + - 21 players; last marble is worth 6111 points: high score is [1m[97m54718[0m + + - 30 players; last marble is worth 5807 points: high score is [1m[97m37305[0m + + +[1m[97mWhat is the winning Elf's score?[0m + + diff --git a/src/09/part2 b/src/09/part2 new file mode 100644 index 0000000..f521c4d --- /dev/null +++ b/src/09/part2 @@ -0,0 +1,15 @@ +--- Part Two --- + +[1m[97mYou now have a complete Intcode computer.[0m + +Finally, you can lock on to the Ceres distress signal! You just need to boost your sensors using the +BOOST program. + +The program runs in sensor boost mode by providing the input instruction the value 2. Once run, it +will boost the sensors automatically, but it might take a few seconds to complete the operation on +slower hardware. In sensor boost mode, the program will output a single value: [1m[97mthe coordinates of +the distress signal[0m. + +Run the BOOST program in sensor boost mode. [1m[97mWhat are the coordinates of the distress signal?[0m + + diff --git a/src/09/solve.py b/src/09/solve.py new file mode 100644 index 0000000..f0aa4bf --- /dev/null +++ b/src/09/solve.py @@ -0,0 +1,43 @@ +import sys
+sys.path.append("../common")
+import aoc
+
+from collections import deque
+
+words = aoc.data.split(" ")
+playercount = int(words[0])
+lastworth = int(words[6])
+
+def highscore(playercount, lastworth):
+ lastworth = lastworth - lastworth % 23
+
+ players = [0 for x in range(playercount)]
+ marbles = deque([0])
+ pos = 0
+ for i in range(1, lastworth+1):
+ if i % 23 == 0:
+ cp = (i-1) % playercount
+ players[cp] += i + marbles[(len(marbles) + pos - 7) % len(marbles)]
+ marbles.rotate((len(marbles) - 1 - pos) + 7)
+ marbles.pop()
+ pos = 0
+ else:
+ if i < 3:
+ pos = 1
+ marbles.rotate(1)
+ marbles.append(i)
+ else:
+ marbles.rotate((len(marbles)- 1 -pos) - 1)
+ marbles.append(i)
+ pos = len(marbles)-1
+
+ return max(players)
+
+
+def solve1(args):
+ return highscore(playercount, lastworth)
+
+def solve2(args):
+ return highscore(playercount, lastworth * 100)
+
+aoc.run(solve1, solve2, sols=[412127, 3482394794])
diff --git a/src/10/input b/src/10/input new file mode 100644 index 0000000..2b803f1 --- /dev/null +++ b/src/10/input @@ -0,0 +1,337 @@ +position=< 21518, -21209> velocity=<-2, 2>
+position=< 10842, 21423> velocity=<-1, -2>
+position=< 32189, -21209> velocity=<-3, 2>
+position=<-21158, -21218> velocity=< 2, 2>
+position=<-31794, -53194> velocity=< 3, 5>
+position=<-42469, 42743> velocity=< 4, -4>
+position=<-53120, -31873> velocity=< 5, 3>
+position=< 32177, -42536> velocity=<-3, 4>
+position=< 53505, 32084> velocity=<-5, -3>
+position=<-53091, 10764> velocity=< 5, -1>
+position=<-53141, -21211> velocity=< 5, 2>
+position=<-42429, 10764> velocity=< 4, -1>
+position=<-10492, -31873> velocity=< 1, 3>
+position=< 42819, -10550> velocity=<-4, 1>
+position=<-53096, -10551> velocity=< 5, 1>
+position=<-10492, -42536> velocity=< 1, 4>
+position=<-10508, 42739> velocity=< 1, -4>
+position=<-10471, -42533> velocity=< 1, 4>
+position=< 53446, 32086> velocity=<-5, -3>
+position=< 10820, -53195> velocity=<-1, 5>
+position=< 10858, 21423> velocity=<-1, -2>
+position=<-31810, -10553> velocity=< 3, 1>
+position=<-10492, 32077> velocity=< 1, -3>
+position=<-31799, -42527> velocity=< 3, 4>
+position=<-10484, 42738> velocity=< 1, -4>
+position=< 10862, 10767> velocity=<-1, -1>
+position=<-10503, 10759> velocity=< 1, -1>
+position=<-21130, 32081> velocity=< 2, -3>
+position=<-42477, -31877> velocity=< 4, 3>
+position=<-10452, -42530> velocity=< 1, 4>
+position=<-10452, 53399> velocity=< 1, -5>
+position=<-31826, 42744> velocity=< 3, -4>
+position=<-42444, -10556> velocity=< 4, 1>
+position=< 42824, -31873> velocity=<-4, 3>
+position=<-10492, 32082> velocity=< 1, -3>
+position=<-53092, 10759> velocity=< 5, -1>
+position=< 21522, 42745> velocity=<-2, -4>
+position=< 53474, -42532> velocity=<-5, 4>
+position=<-31822, 42737> velocity=< 3, -4>
+position=< 32131, -42529> velocity=<-3, 4>
+position=<-10476, -53193> velocity=< 1, 5>
+position=< 21473, -10551> velocity=<-2, 1>
+position=<-10497, 21422> velocity=< 1, -2>
+position=< 21469, 42741> velocity=<-2, -4>
+position=< 21470, 10763> velocity=<-2, -1>
+position=<-31807, 32086> velocity=< 3, -3>
+position=< 32144, 32078> velocity=<-3, -3>
+position=<-53120, -42531> velocity=< 5, 4>
+position=<-31773, -31871> velocity=< 3, 3>
+position=<-31800, -21218> velocity=< 3, 2>
+position=< 53478, -21213> velocity=<-5, 2>
+position=< 21498, 21424> velocity=<-2, -2>
+position=< 42798, 32081> velocity=<-4, -3>
+position=< 42790, 10761> velocity=<-4, -1>
+position=<-31778, -10558> velocity=< 3, 1>
+position=<-21106, 21418> velocity=< 2, -2>
+position=<-31785, 53401> velocity=< 3, -5>
+position=< 53497, -42536> velocity=<-5, 4>
+position=< 53491, -42535> velocity=<-5, 4>
+position=<-21115, -21218> velocity=< 2, 2>
+position=< 53478, 53401> velocity=<-5, -5>
+position=< 10835, 32077> velocity=<-1, -3>
+position=<-10500, 21421> velocity=< 1, -2>
+position=<-53142, -21212> velocity=< 5, 2>
+position=<-10490, -31868> velocity=< 1, 3>
+position=< 53506, 21419> velocity=<-5, -2>
+position=< 21517, 10764> velocity=<-2, -1>
+position=< 32136, 32082> velocity=<-3, -3>
+position=<-42485, -42536> velocity=< 4, 4>
+position=< 10821, -53195> velocity=<-1, 5>
+position=<-42445, -10551> velocity=< 4, 1>
+position=<-10473, -21214> velocity=< 1, 2>
+position=< 42806, -53186> velocity=<-4, 5>
+position=< 42791, 10767> velocity=<-4, -1>
+position=<-53144, 32083> velocity=< 5, -3>
+position=<-53096, 53402> velocity=< 5, -5>
+position=<-21119, 42738> velocity=< 2, -4>
+position=< 42824, 53404> velocity=<-4, -5>
+position=< 21495, 32081> velocity=<-2, -3>
+position=<-31782, 21421> velocity=< 3, -2>
+position=<-21157, -31873> velocity=< 2, 3>
+position=< 53478, 32083> velocity=<-5, -3>
+position=< 53470, 53398> velocity=<-5, -5>
+position=< 42797, 21422> velocity=<-4, -2>
+position=<-21143, -31877> velocity=< 2, 3>
+position=< 32144, -21216> velocity=<-3, 2>
+position=<-10482, 32086> velocity=< 1, -3>
+position=< 42831, -21216> velocity=<-4, 2>
+position=<-42448, 53397> velocity=< 4, -5>
+position=<-21135, -21213> velocity=< 2, 2>
+position=< 42806, 32086> velocity=<-4, -3>
+position=< 42805, 53404> velocity=<-4, -5>
+position=<-53096, 32080> velocity=< 5, -3>
+position=< 32155, 32077> velocity=<-3, -3>
+position=< 53463, -10550> velocity=<-5, 1>
+position=< 53475, 42737> velocity=<-5, -4>
+position=< 21470, -31873> velocity=<-2, 3>
+position=<-10452, -10550> velocity=< 1, 1>
+position=< 10850, 21427> velocity=<-1, -2>
+position=< 10854, 53398> velocity=<-1, -5>
+position=<-10500, 53395> velocity=< 1, -5>
+position=< 21497, 10759> velocity=<-2, -1>
+position=< 32155, -42527> velocity=<-3, 4>
+position=< 53505, -42534> velocity=<-5, 4>
+position=<-21142, 53404> velocity=< 2, -5>
+position=< 32176, -53193> velocity=<-3, 5>
+position=<-42437, -53193> velocity=< 4, 5>
+position=<-21163, 53396> velocity=< 2, -5>
+position=< 32128, -42531> velocity=<-3, 4>
+position=< 42798, -53195> velocity=<-4, 5>
+position=< 42829, 32081> velocity=<-4, -3>
+position=< 21510, -53192> velocity=<-2, 5>
+position=<-53108, -21214> velocity=< 5, 2>
+position=<-21124, 53399> velocity=< 2, -5>
+position=<-21108, -31875> velocity=< 2, 3>
+position=<-31794, 10768> velocity=< 3, -1>
+position=< 10842, 21426> velocity=<-1, -2>
+position=<-53142, 21424> velocity=< 5, -2>
+position=<-42476, 53399> velocity=< 4, -5>
+position=< 42816, -10554> velocity=<-4, 1>
+position=< 32179, 42741> velocity=<-3, -4>
+position=< 32171, 32081> velocity=<-3, -3>
+position=<-10503, 32077> velocity=< 1, -3>
+position=< 42813, 42745> velocity=<-4, -4>
+position=< 21485, 42736> velocity=<-2, -4>
+position=<-42444, 10762> velocity=< 4, -1>
+position=<-31789, -53187> velocity=< 3, 5>
+position=<-10480, 32077> velocity=< 1, -3>
+position=< 32128, -10556> velocity=<-3, 1>
+position=< 10858, -31869> velocity=<-1, 3>
+position=<-53144, -42532> velocity=< 5, 4>
+position=<-42461, -21215> velocity=< 4, 2>
+position=<-42457, -10550> velocity=< 4, 1>
+position=< 32186, 32083> velocity=<-3, -3>
+position=<-42440, 53403> velocity=< 4, -5>
+position=<-21130, 21419> velocity=< 2, -2>
+position=< 42819, -21216> velocity=<-4, 2>
+position=<-31810, -31874> velocity=< 3, 3>
+position=<-53120, 32080> velocity=< 5, -3>
+position=< 32178, -42536> velocity=<-3, 4>
+position=< 21509, -31876> velocity=<-2, 3>
+position=<-42436, -31868> velocity=< 4, 3>
+position=<-42432, -21211> velocity=< 4, 2>
+position=<-21155, 21422> velocity=< 2, -2>
+position=<-53111, -42532> velocity=< 5, 4>
+position=< 42819, -53188> velocity=<-4, 5>
+position=<-21147, -21209> velocity=< 2, 2>
+position=< 42840, 42741> velocity=<-4, -4>
+position=<-31782, 32079> velocity=< 3, -3>
+position=<-42448, -31871> velocity=< 4, 3>
+position=< 21501, 53398> velocity=<-2, -5>
+position=<-31797, 21426> velocity=< 3, -2>
+position=<-42448, 53402> velocity=< 4, -5>
+position=<-53110, -21214> velocity=< 5, 2>
+position=< 32179, 32086> velocity=<-3, -3>
+position=<-21138, 32080> velocity=< 2, -3>
+position=< 10871, 32086> velocity=<-1, -3>
+position=< 53470, 32082> velocity=<-5, -3>
+position=<-53141, -53193> velocity=< 5, 5>
+position=< 53462, -31868> velocity=<-5, 3>
+position=<-21116, -42531> velocity=< 2, 4>
+position=<-31782, -21212> velocity=< 3, 2>
+position=<-42477, -31874> velocity=< 4, 3>
+position=< 42836, -21218> velocity=<-4, 2>
+position=<-31826, -53193> velocity=< 3, 5>
+position=< 10818, 42740> velocity=<-1, -4>
+position=< 53503, 10763> velocity=<-5, -1>
+position=<-21109, -21215> velocity=< 2, 2>
+position=<-21143, 53403> velocity=< 2, -5>
+position=<-53120, 32078> velocity=< 5, -3>
+position=<-31794, -10550> velocity=< 3, 1>
+position=<-42473, 42740> velocity=< 4, -4>
+position=<-31782, 53398> velocity=< 3, -5>
+position=<-53120, -21218> velocity=< 5, 2>
+position=<-53119, 53399> velocity=< 5, -5>
+position=<-10500, 53404> velocity=< 1, -5>
+position=< 53503, 53399> velocity=<-5, -5>
+position=< 21498, 53396> velocity=<-2, -5>
+position=<-31766, 42737> velocity=< 3, -4>
+position=< 32138, -42532> velocity=<-3, 4>
+position=< 32133, -10559> velocity=<-3, 1>
+position=< 53505, 42738> velocity=<-5, -4>
+position=< 21518, 21418> velocity=<-2, -2>
+position=<-53144, 53399> velocity=< 5, -5>
+position=<-31810, -42535> velocity=< 3, 4>
+position=<-53099, -53187> velocity=< 5, 5>
+position=<-31805, -42527> velocity=< 3, 4>
+position=< 21478, 42740> velocity=<-2, -4>
+position=< 53506, 53403> velocity=<-5, -5>
+position=<-21165, -42533> velocity=< 2, 4>
+position=< 10850, -21217> velocity=<-1, 2>
+position=<-21143, -42528> velocity=< 2, 4>
+position=<-31769, 42740> velocity=< 3, -4>
+position=<-53088, -21211> velocity=< 5, 2>
+position=<-53119, -31868> velocity=< 5, 3>
+position=<-42448, 32084> velocity=< 4, -3>
+position=<-53096, -31872> velocity=< 5, 3>
+position=<-53091, -53186> velocity=< 5, 5>
+position=< 42787, 10760> velocity=<-4, -1>
+position=< 10861, 21427> velocity=<-1, -2>
+position=< 53446, 53402> velocity=<-5, -5>
+position=< 42832, 10759> velocity=<-4, -1>
+position=< 21485, -42535> velocity=<-2, 4>
+position=<-10482, -42532> velocity=< 1, 4>
+position=< 53483, -53194> velocity=<-5, 5>
+position=< 10835, -31868> velocity=<-1, 3>
+position=< 53507, -10550> velocity=<-5, 1>
+position=< 42815, 32077> velocity=<-4, -3>
+position=< 10847, -42533> velocity=<-1, 4>
+position=<-42448, 32084> velocity=< 4, -3>
+position=<-21117, 32086> velocity=< 2, -3>
+position=<-21167, 42742> velocity=< 2, -4>
+position=<-31826, 21427> velocity=< 3, -2>
+position=< 32181, 42745> velocity=<-3, -4>
+position=< 32136, 10766> velocity=<-3, -1>
+position=<-21138, 32085> velocity=< 2, -3>
+position=< 21501, -21218> velocity=<-2, 2>
+position=< 21510, -10557> velocity=<-2, 1>
+position=<-31777, 21427> velocity=< 3, -2>
+position=<-53084, 21426> velocity=< 5, -2>
+position=<-31810, 21426> velocity=< 3, -2>
+position=<-31797, -10556> velocity=< 3, 1>
+position=<-31794, 42744> velocity=< 3, -4>
+position=<-31773, -42529> velocity=< 3, 4>
+position=< 10818, 32084> velocity=<-1, -3>
+position=<-21149, -21209> velocity=< 2, 2>
+position=< 10855, 32078> velocity=<-1, -3>
+position=< 32186, -21215> velocity=<-3, 2>
+position=< 53454, 42743> velocity=<-5, -4>
+position=< 21530, 10759> velocity=<-2, -1>
+position=< 42795, 53404> velocity=<-4, -5>
+position=< 21522, 32078> velocity=<-2, -3>
+position=<-21111, -42535> velocity=< 2, 4>
+position=<-31826, 32079> velocity=< 3, -3>
+position=<-21133, 10763> velocity=< 2, -1>
+position=<-10499, 32077> velocity=< 1, -3>
+position=< 32170, -21213> velocity=<-3, 2>
+position=<-53096, 10765> velocity=< 5, -1>
+position=< 42839, -10554> velocity=<-4, 1>
+position=<-53101, 53400> velocity=< 5, -5>
+position=<-31782, -21212> velocity=< 3, 2>
+position=<-10508, -10556> velocity=< 1, 1>
+position=<-53142, -31874> velocity=< 5, 3>
+position=< 53479, 53399> velocity=<-5, -5>
+position=<-31818, -31871> velocity=< 3, 3>
+position=<-31789, -21217> velocity=< 3, 2>
+position=< 32186, 10765> velocity=<-3, -1>
+position=<-42427, -21215> velocity=< 4, 2>
+position=<-21157, 10759> velocity=< 2, -1>
+position=<-10448, 42737> velocity=< 1, -4>
+position=< 21493, -10550> velocity=<-2, 1>
+position=< 42819, -10557> velocity=<-4, 1>
+position=< 42830, 10764> velocity=<-4, -1>
+position=<-31794, -21211> velocity=< 3, 2>
+position=<-21139, -10555> velocity=< 2, 1>
+position=<-42441, 10766> velocity=< 4, -1>
+position=< 32176, 42740> velocity=<-3, -4>
+position=< 32136, 53401> velocity=<-3, -5>
+position=<-10484, 42737> velocity=< 1, -4>
+position=<-21138, 32079> velocity=< 2, -3>
+position=<-10508, 10759> velocity=< 1, -1>
+position=< 21522, 53396> velocity=<-2, -5>
+position=<-31818, 21419> velocity=< 3, -2>
+position=< 10867, -21213> velocity=<-1, 2>
+position=< 21469, 21424> velocity=<-2, -2>
+position=< 32139, -53191> velocity=<-3, 5>
+position=< 42819, -21214> velocity=<-4, 2>
+position=< 42803, -42534> velocity=<-4, 4>
+position=< 10847, 53398> velocity=<-1, -5>
+position=<-42437, -42528> velocity=< 4, 4>
+position=< 21521, -42531> velocity=<-2, 4>
+position=< 42835, 32080> velocity=<-4, -3>
+position=<-10503, 21427> velocity=< 1, -2>
+position=<-21167, -42527> velocity=< 2, 4>
+position=< 21521, 32077> velocity=<-2, -3>
+position=<-10484, -10553> velocity=< 1, 1>
+position=<-10452, -42529> velocity=< 1, 4>
+position=< 10847, -21213> velocity=<-1, 2>
+position=< 53470, 21419> velocity=<-5, -2>
+position=< 10862, -10551> velocity=<-1, 1>
+position=<-42469, -31868> velocity=< 4, 3>
+position=< 10838, -10550> velocity=<-1, 1>
+position=< 32152, -42527> velocity=<-3, 4>
+position=< 32176, 53401> velocity=<-3, -5>
+position=<-31825, -10554> velocity=< 3, 1>
+position=<-21167, -42528> velocity=< 2, 4>
+position=<-21115, -31872> velocity=< 2, 3>
+position=< 10866, -21217> velocity=<-1, 2>
+position=< 21506, -10555> velocity=<-2, 1>
+position=<-21143, 53399> velocity=< 2, -5>
+position=<-10471, -31877> velocity=< 1, 3>
+position=<-10508, 32085> velocity=< 1, -3>
+position=< 10866, -10550> velocity=<-1, 1>
+position=<-53088, -31877> velocity=< 5, 3>
+position=<-10495, 10759> velocity=< 1, -1>
+position=< 10847, 21418> velocity=<-1, -2>
+position=<-10484, 42743> velocity=< 1, -4>
+position=< 10818, 10764> velocity=<-1, -1>
+position=< 32155, 42740> velocity=<-3, -4>
+position=< 42787, 21423> velocity=<-4, -2>
+position=< 53490, 21425> velocity=<-5, -2>
+position=<-42448, 10764> velocity=< 4, -1>
+position=<-21119, 53396> velocity=< 2, -5>
+position=< 21528, -21211> velocity=<-2, 2>
+position=< 53502, 10762> velocity=<-5, -1>
+position=< 42820, -31873> velocity=<-4, 3>
+position=< 21481, 53395> velocity=<-2, -5>
+position=<-10468, -42527> velocity=< 1, 4>
+position=< 32130, -21212> velocity=<-3, 2>
+position=< 32181, -10554> velocity=<-3, 1>
+position=< 32184, 53395> velocity=<-3, -5>
+position=< 10851, -53188> velocity=<-1, 5>
+position=< 21477, 42736> velocity=<-2, -4>
+position=<-21159, 21426> velocity=< 2, -2>
+position=<-31773, 10767> velocity=< 3, -1>
+position=< 42827, 32077> velocity=<-4, -3>
+position=<-31818, -21210> velocity=< 3, 2>
+position=< 53458, -21218> velocity=<-5, 2>
+position=<-10452, 42740> velocity=< 1, -4>
+position=<-53142, -21215> velocity=< 5, 2>
+position=< 10826, 53398> velocity=<-1, -5>
+position=<-21166, 42741> velocity=< 2, -4>
+position=<-42469, -53187> velocity=< 4, 5>
+position=< 32173, 10768> velocity=<-3, -1>
+position=< 53497, 10759> velocity=<-5, -1>
+position=< 53449, -10557> velocity=<-5, 1>
+position=< 32170, -53190> velocity=<-3, 5>
+position=< 42843, -53187> velocity=<-4, 5>
+position=< 10852, 32081> velocity=<-1, -3>
+position=<-10499, 53395> velocity=< 1, -5>
+position=< 21496, -53195> velocity=<-2, 5>
+position=< 32157, 32084> velocity=<-3, -3>
+position=< 42831, 10765> velocity=<-4, -1>
+position=< 21498, -10556> velocity=<-2, 1>
+position=< 42843, -53193> velocity=<-4, 5>
+position=< 42811, -53189> velocity=<-4, 5>
+position=<-42477, 53397> velocity=< 4, -5>
diff --git a/src/10/part1 b/src/10/part1 new file mode 100644 index 0000000..df615e5 --- /dev/null +++ b/src/10/part1 @@ -0,0 +1,160 @@ +--- Day 10: The Stars Align --- + +It's no use; your navigation system simply isn't capable of providing walking directions in the +arctic circle, and certainly not in 1018. + +The Elves suggest an alternative. In times like these, North Pole rescue operations will arrange +points of light in the sky to guide missing Elves back to base. Unfortunately, the message is easy +to miss: the points move slowly enough that it takes hours to align them, but have so much momentum +that they only stay aligned for a second. If you blink at the wrong time, it might be hours before +another message appears. + +You can see these points of light floating in the distance, and record their position in the sky and +their velocity, the relative change in position per second (your puzzle input). The coordinates are +all given from your perspective; given enough time, those positions and velocities will move the +points into a cohesive message! + +Rather than wait, you decide to fast-forward the process and calculate what the points will +eventually spell. + +For example, suppose you note the following points: + +position=< 9, 1> velocity=< 0, 2> +position=< 7, 0> velocity=<-1, 0> +position=< 3, -2> velocity=<-1, 1> +position=< 6, 10> velocity=<-2, -1> +position=< 2, -4> velocity=< 2, 2> +position=<-6, 10> velocity=< 2, -2> +position=< 1, 8> velocity=< 1, -1> +position=< 1, 7> velocity=< 1, 0> +position=<-3, 11> velocity=< 1, -2> +position=< 7, 6> velocity=<-1, -1> +position=<-2, 3> velocity=< 1, 0> +position=<-4, 3> velocity=< 2, 0> +position=<10, -3> velocity=<-1, 1> +position=< 5, 11> velocity=< 1, -2> +position=< 4, 7> velocity=< 0, -1> +position=< 8, -2> velocity=< 0, 1> +position=<15, 0> velocity=<-2, 0> +position=< 1, 6> velocity=< 1, 0> +position=< 8, 9> velocity=< 0, -1> +position=< 3, 3> velocity=<-1, 1> +position=< 0, 5> velocity=< 0, -1> +position=<-2, 2> velocity=< 2, 0> +position=< 5, -2> velocity=< 1, 2> +position=< 1, 4> velocity=< 2, 1> +position=<-2, 7> velocity=< 2, -2> +position=< 3, 6> velocity=<-1, -1> +position=< 5, 0> velocity=< 1, 0> +position=<-6, 0> velocity=< 2, 0> +position=< 5, 9> velocity=< 1, -2> +position=<14, 7> velocity=<-2, 0> +position=<-3, 6> velocity=< 2, -1> + +Each line represents one point. Positions are given as <X, Y> pairs: X represents how far left +(negative) or right (positive) the point appears, while Y represents how far up (negative) or down +(positive) the point appears. + +At 0 seconds, each point has the position given. Each second, each point's velocity is added to its +position. So, a point with velocity <1, -2> is moving to the right, but is moving upward twice as +quickly. If this point's initial position were <3, 9>, after 3 seconds, its position would become +<6, 3>. + +Over time, the points listed above would move like this: + +Initially: +........#............. +................#..... +.........#.#..#....... +...................... +#..........#.#.......# +...............#...... +....#................. +..#.#....#............ +.......#.............. +......#............... +...#...#.#...#........ +....#..#..#.........#. +.......#.............. +...........#..#....... +#...........#......... +...#.......#.......... + +After 1 second: +...................... +...................... +..........#....#...... +........#.....#....... +..#.........#......#.. +...................... +......#............... +....##.........#...... +......#.#............. +.....##.##..#......... +........#.#........... +........#...#.....#... +..#...........#....... +....#.....#.#......... +...................... +...................... + +After 2 seconds: +...................... +...................... +...................... +..............#....... +....#..#...####..#.... +...................... +........#....#........ +......#.#............. +.......#...#.......... +.......#..#..#.#...... +....#....#.#.......... +.....#...#...##.#..... +........#............. +...................... +...................... +...................... + +After 3 seconds: +...................... +...................... +...................... +...................... +......#...#..###...... +......#...#...#....... +......#...#...#....... +......#####...#....... +......#...#...#....... +......#...#...#....... +......#...#...#....... +......#...#..###...... +...................... +...................... +...................... +...................... + +After 4 seconds: +...................... +...................... +...................... +............#......... +........##...#.#...... +......#.....#..#...... +.....#..##.##.#....... +.......##.#....#...... +...........#....#..... +..............#....... +....#......#...#...... +.....#.....##......... +...............#...... +...............#...... +...................... +...................... + +After 3 seconds, the message appeared briefly: [1m[97mHI[0m. Of course, your message will be much longer and +will take many more seconds to appear. + +[1m[97mWhat message will eventually appear in the sky?[0m + + diff --git a/src/10/part2 b/src/10/part2 new file mode 100644 index 0000000..09dce44 --- /dev/null +++ b/src/10/part2 @@ -0,0 +1,92 @@ +--- Part Two --- + +Once you give them the coordinates, the Elves quickly deploy an Instant Monitoring Station to the +location and discover the worst: there are simply too many asteroids. + +The only solution is [1m[97mcomplete vaporization by giant laser[0m. + +Fortunately, in addition to an asteroid scanner, the new monitoring station also comes equipped with +a giant rotating laser perfect for vaporizing asteroids. The laser starts by pointing +[1m[97mup[0m and always rotates [1m[97mclockwise[0m, vaporizing any asteroid it hits. + +If multiple asteroids are [1m[97mexactly[0m in line with the station, the laser only has enough power to +vaporize [1m[97mone[0m of them before continuing its rotation. In other words, the same asteroids that can be +[1m[97mdetected[0m can be vaporized, but if vaporizing one asteroid makes another one detectable, the +newly-detected asteroid won't be vaporized until the laser has returned to the same position by +rotating a full 360 degrees. + +For example, consider the following map, where the asteroid with the new monitoring station (and +laser) is marked X: + +.#....#####...#.. +##...##.#####..## +##...#...#.#####. +..#.....X...###.. +..#.#.....#....## + +The first nine asteroids to get vaporized, in order, would be: + +.#....###[1m[97m2[0m[1m[97m4[0m...#.. +##...##.[1m[97m1[0m[1m[97m3[0m#[1m[97m6[0m[1m[97m7[0m..[1m[97m9[0m# +##...#...[1m[97m5[0m.[1m[97m8[0m####. +..#.....X...###.. +..#.#.....#....## + +Note that some asteroids (the ones behind the asteroids marked 1, 5, and 7) won't have a chance to +be vaporized until the next full rotation. The laser continues rotating; the next nine to be +vaporized are: + +.#....###.....#.. +##...##...#.....# +##...#......[1m[97m1[0m[1m[97m2[0m[1m[97m3[0m[1m[97m4[0m. +..#.....X...[1m[97m5[0m##.. +..#.[1m[97m9[0m.....[1m[97m8[0m....[1m[97m7[0m[1m[97m6[0m + +The next nine to be vaporized are then: + +.[1m[97m8[0m....###.....#.. +[1m[97m5[0m[1m[97m6[0m...[1m[97m9[0m#...#.....# +[1m[97m3[0m[1m[97m4[0m...[1m[97m7[0m........... +..[1m[97m2[0m.....X....##.. +..[1m[97m1[0m.............. + +Finally, the laser completes its first full rotation (1 through 3), a second rotation (4 through 8), +and vaporizes the last asteroid (9) partway through its third rotation: + +......[1m[97m2[0m[1m[97m3[0m[1m[97m4[0m.....[1m[97m6[0m.. +......[1m[97m1[0m...[1m[97m5[0m.....[1m[97m7[0m +................. +........X....[1m[97m8[0m[1m[97m9[0m.. +................. + +In the large example above (the one with the best monitoring station location at 11,13): + + + - The 1st asteroid to be vaporized is at 11,12. + + - The 2nd asteroid to be vaporized is at 12,1. + + - The 3rd asteroid to be vaporized is at 12,2. + + - The 10th asteroid to be vaporized is at 12,8. + + - The 20th asteroid to be vaporized is at 16,0. + + - The 50th asteroid to be vaporized is at 16,9. + + - The 100th asteroid to be vaporized is at 10,16. + + - The 199th asteroid to be vaporized is at 9,6. + + - [1m[97mThe 200th asteroid to be vaporized is at 8,2.[0m + + - The 201st asteroid to be vaporized is at 10,9. + + - The 299th and final asteroid to be vaporized is at 11,1. + + +The Elves are placing bets on which will be the [1m[97m200th[0m asteroid to be vaporized. Win the bet by +determining which asteroid that will be; [1m[97mwhat do you get if you multiply its X coordinate by 100 and +then add its Y coordinate?[0m (For example, 8,2 becomes [1m[97m802[0m.) + + diff --git a/src/10/solve.py b/src/10/solve.py new file mode 100644 index 0000000..7800379 --- /dev/null +++ b/src/10/solve.py @@ -0,0 +1,105 @@ +import sys
+sys.path.append("../common")
+import aoc
+
+def parse_line(l):
+ s = l.split(">")
+ vals = list()
+ for ss in s:
+ if len(ss) == 0:
+ continue
+ ss = ss.split("<",1)[1]
+ vals.append([int(x) for x in ss.split(",")])
+ return vals
+
+data = [parse_line(l) for l in aoc.data.split("\n") if len(l) != 0]
+posdata = [x[0] for x in data]
+veldata = [x[1] for x in data]
+
+def check_adj(pi):
+ for p in posdata:
+ if abs(p[0] - pi[0]) + abs(p[1] - pi[1]) == 1:
+ return True
+ return False
+
+def check_data():
+ for p in posdata:
+ if not check_adj(p):
+ return False
+ return True
+
+def bounds():
+ minx = None
+ maxx = None
+ miny = None
+ maxy = None
+ for p in posdata:
+ if minx is None or p[0] < minx:
+ minx = p[0]
+ if maxx is None or p[0] > maxx:
+ maxx = p[0]
+ if miny is None or p[1] < miny:
+ miny = p[1]
+ if maxy is None or p[1] > maxy:
+ maxy = p[1]
+ return minx, maxx, miny, maxy
+
+def solve(part, args):
+ count = 0
+ distx = None
+ disty = None
+ while True:
+ for i in range(len(data)):
+ posdata[i][0] += veldata[i][0]
+ posdata[i][1] += veldata[i][1]
+ count += 1
+
+ minx, maxx, miny, maxy = bounds()
+ if distx == None:
+ distx = maxx - minx
+ disty = maxy - miny
+ else:
+ cdistx = maxx - minx
+ cdisty = maxy - miny
+ if cdistx > distx or cdisty > disty:
+ for i in range(len(data)):
+ posdata[i][0] -= veldata[i][0]
+ posdata[i][1] -= veldata[i][1]
+ count -= 1
+ break
+ else:
+ distx = cdistx
+ disty = cdisty
+
+ if count % 100 == 0:
+ aoc.debug("\r" + " " * 50, end="")
+ aoc.debug(f"\rcluster size: {distx}, {disty}", end="")
+
+ if part == 1:
+ return count
+ elif part == 2:
+ answer = ""
+ minx, maxx, miny, maxy = bounds()
+ for y in range(maxy - miny + 1):
+ f = lambda x: "#" if list([x + minx, y + miny]) in posdata else " "
+ answer += "".join([f(x) for x in range(maxx - minx + 1)]) + "\n"
+ print(repr(answer))
+ print(repr(sol2))
+ return answer
+ else:
+ assert(False)
+
+sol2 = """\
+# # ###### # ##### # # # # #### # #
+# # # # # # # # # # # # # #
+# # # # # # # # # # # # #
+# # # # # # # # # # # # #
+## ##### # ##### ###### ## # ##
+## # # # # # # ## # ### ##
+# # # # # # # # # # # # # #
+# # # # # # # # # # # # # #
+# # # # # # # # # # # ## # #
+# # # ###### ##### # # # # ### # # #
+"""
+
+aoc.run(lambda args: solve(1, args), lambda args: solve(2, args), sols=[10659, sol2])
diff --git a/src/10/test-input.txt b/src/10/test-input.txt new file mode 100644 index 0000000..e499c03 --- /dev/null +++ b/src/10/test-input.txt @@ -0,0 +1,31 @@ +position=< 9, 1> velocity=< 0, 2> +position=< 7, 0> velocity=<-1, 0> +position=< 3, -2> velocity=<-1, 1> +position=< 6, 10> velocity=<-2, -1> +position=< 2, -4> velocity=< 2, 2> +position=<-6, 10> velocity=< 2, -2> +position=< 1, 8> velocity=< 1, -1> +position=< 1, 7> velocity=< 1, 0> +position=<-3, 11> velocity=< 1, -2> +position=< 7, 6> velocity=<-1, -1> +position=<-2, 3> velocity=< 1, 0> +position=<-4, 3> velocity=< 2, 0> +position=<10, -3> velocity=<-1, 1> +position=< 5, 11> velocity=< 1, -2> +position=< 4, 7> velocity=< 0, -1> +position=< 8, -2> velocity=< 0, 1> +position=<15, 0> velocity=<-2, 0> +position=< 1, 6> velocity=< 1, 0> +position=< 8, 9> velocity=< 0, -1> +position=< 3, 3> velocity=<-1, 1> +position=< 0, 5> velocity=< 0, -1> +position=<-2, 2> velocity=< 2, 0> +position=< 5, -2> velocity=< 1, 2> +position=< 1, 4> velocity=< 2, 1> +position=<-2, 7> velocity=< 2, -2> +position=< 3, 6> velocity=<-1, -1> +position=< 5, 0> velocity=< 1, 0> +position=<-6, 0> velocity=< 2, 0> +position=< 5, 9> velocity=< 1, -2> +position=<14, 7> velocity=<-2, 0> +position=<-3, 6> velocity=< 2, -1> diff --git a/src/11/input b/src/11/input new file mode 100644 index 0000000..141d29f --- /dev/null +++ b/src/11/input @@ -0,0 +1 @@ +1955 diff --git a/src/11/part1 b/src/11/part1 new file mode 100644 index 0000000..a14a37f --- /dev/null +++ b/src/11/part1 @@ -0,0 +1,88 @@ +--- Day 11: Chronal Charge --- + +You watch the Elves and their sleigh fade into the distance as they head toward the North Pole. + +Actually, you're the one fading. The falling sensation returns. + +The low fuel warning light is illuminated on your wrist-mounted device. Tapping it once causes it to +project a hologram of the situation: a [1m[97m300x300[0m grid of fuel cells and their current power levels, +some negative. You're not sure what negative power means in the context of time travel, but it can't +be good. + +Each fuel cell has a coordinate ranging [1m[97mfrom 1 to 300[0m in both the X (horizontal) and Y (vertical) +direction. In X,Y notation, the top-left cell is 1,1, and the top-right cell is 300,1. + +The interface lets you select [1m[97many 3x3 square[0m of fuel cells. To increase your chances of getting to +your destination, you decide to choose the 3x3 square with the [1m[97mlargest total power[0m. + +The power level in a given fuel cell can be found through the following process: + + + - Find the fuel cell's [1m[97mrack ID[0m, which is its [1m[97mX coordinate plus 10[0m. + + - Begin with a power level of the [1m[97mrack ID[0m times the [1m[97mY coordinate[0m. + + - Increase the power level by the value of the [1m[97mgrid serial number[0m (your puzzle input). + + - Set the power level to itself multiplied by the [1m[97mrack ID[0m. + + - Keep only the [1m[97mhundreds digit[0m of the power level (so 12[1m[97m3[0m45 becomes 3; numbers with no hundreds +digit become 0). + + - [1m[97mSubtract 5[0m from the power level. + + +For example, to find the power level of the fuel cell at 3,5 in a grid with serial number 8: + + + - The rack ID is 3 + 10 = [1m[97m13[0m. + + - The power level starts at 13 * 5 = [1m[97m65[0m. + + - Adding the serial number produces 65 + 8 = [1m[97m73[0m. + + - Multiplying by the rack ID produces 73 * 13 = [1m[97m949[0m. + + - The hundreds digit of [1m[97m9[0m49 is [1m[97m9[0m. + + - Subtracting 5 produces 9 - 5 = [1m[97m4[0m. + + +So, the power level of this fuel cell is [1m[97m4[0m. + +Here are some more example power levels: + + + - Fuel cell at  122,79, grid serial number 57: power level -5. + + - Fuel cell at 217,196, grid serial number 39: power level  0. + + - Fuel cell at 101,153, grid serial number 71: power level  4. + + +Your goal is to find the 3x3 square which has the largest total power. The square must be entirely +within the 300x300 grid. Identify this square using the X,Y coordinate of its [1m[97mtop-left fuel +cell[0m. For example: + +For grid serial number 18, the largest total 3x3 square has a top-left corner of [1m[97m33,45[0m (with a total +power of 29); these fuel cells appear in the middle of this 5x5 region: + +-2 -4 4 4 4 +-4 [1m[97m 4 4 4 [0m-5 + 4 [1m[97m 3 3 4 [0m-4 + 1 [1m[97m 1 2 4 [0m-3 +-1 0 2 -5 -2 + +For grid serial number 42, the largest 3x3 square's top-left is [1m[97m21,61[0m (with a total power of 30); +they are in the middle of this region: + +-3 4 2 2 2 +-4 [1m[97m 4 3 3 [0m 4 +-5 [1m[97m 3 3 4 [0m-4 + 4 [1m[97m 3 3 4 [0m-3 + 3 3 3 -5 -1 + +[1m[97mWhat is the X,Y coordinate of the top-left fuel cell of the 3x3 square with the largest total +power?[0m + + diff --git a/src/11/part2 b/src/11/part2 new file mode 100644 index 0000000..8be7709 --- /dev/null +++ b/src/11/part2 @@ -0,0 +1,14 @@ +--- Part Two --- + +You're not sure what it's trying to paint, but it's definitely not a [1m[97mregistration identifier[0m. The +Space Police are getting impatient. + +Checking your external ship cameras again, you notice a white panel marked "emergency hull painting +robot starting panel". The rest of the panels are [1m[97mstill black[0m, but it looks like the robot was +expecting to [1m[97mstart on a white panel[0m, not a black one. + +Based on the Space Law Space Brochure that the Space Police attached to one of your windows, a valid +registration identifier is always [1m[97meight capital letters[0m. After starting the robot on a single +[1m[97mwhite panel[0m instead, [1m[97mwhat registration identifier does it paint[0m on your hull? + + diff --git a/src/11/solve.py b/src/11/solve.py new file mode 100644 index 0000000..66fc956 --- /dev/null +++ b/src/11/solve.py @@ -0,0 +1,76 @@ +import sys
+sys.path.append("../common")
+import aoc
+
+gridserial = int(aoc.data)
+
+# rack ID = x + 10
+# intial power = rackID * y
+# power += gridserial
+# power *= rackID
+# power = str(power)[2]
+# power -= 5
+
+def get_power(x,y):
+ id = x + 10
+ power = id * y
+ power += gridserial
+ power *= id
+ spower = str(power)
+ if len(spower) > 2:
+ power = int(spower[-3])
+ else:
+ power = 0
+ power -= 5
+ return power
+
+def solve1(args):
+ maxpower = None
+ coords = None
+ for x in range(300-2):
+ for y in range(300-2):
+ power = 0;
+ for i in range(3):
+ for j in range(3):
+ power += get_power(x+i,y+j)
+ if maxpower == None or power > maxpower:
+ maxpower = power
+ coords = (x, y)
+
+ return f"{coords[0]},{coords[1]}"
+
+def gen_map():
+ vmap = [[0 for y in range(300)] for x in range(300)]
+ for x in range(300):
+ for y in range(300):
+ vmap[x][y] = get_power(x,y)
+ return vmap
+
+def solve2(args):
+ maxpower = None
+ res = None
+ pmap = gen_map()
+ vmap = [[list() for y in range(300)] for x in range(300)]
+ for s in range(1, 301):
+ aoc.debug(f"\rTrying: {s}", end="")
+ cmaxpower = None
+ cres = None
+ for x in range(300-(s-1)):
+ for y in range(300-(s-1)):
+ vmap[x][y] += [pmap[x+(s-1)][y+i] for i in range(s)]
+ vmap[x][y] += [pmap[x+i][y+(s-1)] for i in range(s-1)]
+ power = sum(vmap[x][y]);
+ if cmaxpower == None or power > cmaxpower:
+ cmaxpower = power
+ cres = (x, y, s)
+ if maxpower == None or cmaxpower > maxpower:
+ maxpower = cmaxpower
+ res = cres
+ elif cmaxpower < maxpower:
+ break
+
+ aoc.debug("\r" + " " * 50 + "\r", end="")
+
+ return f"{res[0]},{res[1]},{res[2]}"
+
+aoc.run(solve1, solve2, sols=["21,93", "231,108,14"])
diff --git a/src/12/input b/src/12/input new file mode 100644 index 0000000..6dcf208 --- /dev/null +++ b/src/12/input @@ -0,0 +1,34 @@ +initial state: ##..#.#.#..##..#..##..##..#.#....#.....##.#########...#.#..#..#....#.###.###....#..........###.#.#.. + +..##. => . +..... => . +##..# => . +...#. => . +#.... => . +...## => # +.#.#. => . +#..#. => # +##.#. => . +#..## => . +..#.. => . +#.#.# => . +###.# => . +###.. => . +.#... => # +.##.# => . +##... => # +..### => . +####. => . +#...# => # +.#..# => # +##### => # +..#.# => # +.#.## => # +#.### => . +....# => . +.###. => . +.#### => # +.##.. => . +##.## => # +#.##. => # +#.#.. => # diff --git a/src/12/part1 b/src/12/part1 new file mode 100644 index 0000000..ad06d34 --- /dev/null +++ b/src/12/part1 @@ -0,0 +1,99 @@ +--- Day 12: Subterranean Sustainability --- + +The year 518 is significantly more underground than your history books implied. Either that, or +you've arrived in a vast cavern network under the North Pole. + +After exploring a little, you discover a long tunnel that contains a row of small pots as far as you +can see to your left and right. A few of them contain plants - someone is trying to grow things in +these geothermally-heated caves. + +The pots are numbered, with 0 in front of you. To the left, the pots are numbered -1, -2, -3, and +so on; to the right, 1, 2, 3.... Your puzzle input contains a list of pots from 0 to the right and +whether they do (#) or do not (.) currently contain a plant, the [1m[97minitial state[0m. (No other pots +currently contain plants.) For example, an initial state of #..##.... indicates that pots 0, 3, and +4 currently contain plants. + +Your puzzle input also contains some notes you find on a nearby table: someone has been trying to +figure out how these plants [1m[97mspread[0m to nearby pots. Based on the notes, for each generation of +plants, a given pot has or does not have a plant based on whether that pot (and the two pots on +either side of it) had a plant in the last generation. These are written as LLCRR => N, where L are +pots to the left, C is the current pot being considered, R are the pots to the right, and N is +whether the current pot will have a plant in the next generation. For example: + + + - A note like ..#.. => . means that a pot that contains a plant but with no plants within two pots +of it will not have a plant in it during the next generation. + + - A note like ##.## => . means that an empty pot with two plants on each side of it will remain +empty in the next generation. + + - A note like .##.# => # means that a pot has a plant in a given generation if, in the previous +generation, there were plants in that pot, the one immediately to the left, and the one two pots to +the right, but not in the ones immediately to the right and two to the left. + + +It's not clear what these plants are for, but you're sure it's important, so you'd like to make sure +the current configuration of plants is sustainable by determining what will happen after [1m[97m20 +generations[0m. + +For example, given the following input: + +initial state: #..#.#..##......###...### + +...## => # +..#.. => # +.#... => # +.#.#. => # +.#.## => # +.##.. => # +.#### => # +#.#.# => # +#.### => # +##.#. => # +##.## => # +###.. => # +###.# => # +####. => # + +For brevity, in this example, only the combinations which do produce a plant are listed. (Your input +includes all possible combinations.) Then, the next 20 generations will look like this: + + 1 2 3 + 0 0 0 0 + 0: ...#..#.#..##......###...###........... + 1: ...#...#....#.....#..#..#..#........... + 2: ...##..##...##....#..#..#..##.......... + 3: ..#.#...#..#.#....#..#..#...#.......... + 4: ...#.#..#...#.#...#..#..##..##......... + 5: ....#...##...#.#..#..#...#...#......... + 6: ....##.#.#....#...#..##..##..##........ + 7: ...#..###.#...##..#...#...#...#........ + 8: ...#....##.#.#.#..##..##..##..##....... + 9: ...##..#..#####....#...#...#...#....... +10: ..#.#..#...#.##....##..##..##..##...... +11: ...#...##...#.#...#.#...#...#...#...... +12: ...##.#.#....#.#...#.#..##..##..##..... +13: ..#..###.#....#.#...#....#...#...#..... +14: ..#....##.#....#.#..##...##..##..##.... +15: ..##..#..#.#....#....#..#.#...#...#.... +16: .#.#..#...#.#...##...#...#.#..##..##... +17: ..#...##...#.#.#.#...##...#....#...#... +18: ..##.#.#....#####.#.#.#...##...##..##.. +19: .#..###.#..#.#.#######.#.#.#..#.#...#.. +20: .#....##....#####...#######....#.#..##. + +The generation is shown along the left, where 0 is the initial state. The pot numbers are shown +along the top, where 0 labels the center pot, negative-numbered pots extend to the left, and +positive pots extend toward the right. Remember, the initial state begins at pot 0, which is not the +leftmost pot used in this example. + +After one generation, only seven plants remain. The one in pot 0 matched the rule looking for +..#.., the one in pot 4 matched the rule looking for .#.#., pot 9 matched .##.., and so on. + +In this example, after 20 generations, the pots shown as # contain plants, the furthest left of +which is pot -2, and the furthest right of which is pot 34. Adding up all the numbers of +plant-containing pots after the 20th generation produces [1m[97m325[0m. + +[1m[97mAfter 20 generations, what is the sum of the numbers of all pots which contain a plant?[0m + + diff --git a/src/12/part2 b/src/12/part2 new file mode 100644 index 0000000..1fec84f --- /dev/null +++ b/src/12/part2 @@ -0,0 +1,49 @@ +--- Part Two --- + +All this drifting around in space makes you wonder about the nature of the universe. Does history +really repeat itself? You're curious whether the moons will ever return to a previous state. + +Determine [1m[97mthe number of steps[0m that must occur before all of the moons' [1m[97mpositions and velocities[0m +exactly match a previous point in time. + +For example, the first example above takes 2772 steps before they exactly match a previous point in +time; it eventually returns to the initial state: + +After 0 steps: +pos=<x= -1, y= 0, z= 2>, vel=<x= 0, y= 0, z= 0> +pos=<x= 2, y=-10, z= -7>, vel=<x= 0, y= 0, z= 0> +pos=<x= 4, y= -8, z= 8>, vel=<x= 0, y= 0, z= 0> +pos=<x= 3, y= 5, z= -1>, vel=<x= 0, y= 0, z= 0> + +After 2770 steps: +pos=<x= 2, y= -1, z= 1>, vel=<x= -3, y= 2, z= 2> +pos=<x= 3, y= -7, z= -4>, vel=<x= 2, y= -5, z= -6> +pos=<x= 1, y= -7, z= 5>, vel=<x= 0, y= -3, z= 6> +pos=<x= 2, y= 2, z= 0>, vel=<x= 1, y= 6, z= -2> + +After 2771 steps: +pos=<x= -1, y= 0, z= 2>, vel=<x= -3, y= 1, z= 1> +pos=<x= 2, y=-10, z= -7>, vel=<x= -1, y= -3, z= -3> +pos=<x= 4, y= -8, z= 8>, vel=<x= 3, y= -1, z= 3> +pos=<x= 3, y= 5, z= -1>, vel=<x= 1, y= 3, z= -1> + +After 2772 steps: +pos=<x= -1, y= 0, z= 2>, vel=<x= 0, y= 0, z= 0> +pos=<x= 2, y=-10, z= -7>, vel=<x= 0, y= 0, z= 0> +pos=<x= 4, y= -8, z= 8>, vel=<x= 0, y= 0, z= 0> +pos=<x= 3, y= 5, z= -1>, vel=<x= 0, y= 0, z= 0> + +Of course, the universe might last for a [1m[97mvery long time[0m before repeating. Here's a copy of the +second example from above: + +<x=-8, y=-10, z=0> +<x=5, y=5, z=10> +<x=2, y=-7, z=3> +<x=9, y=-8, z=-3> + +This set of initial positions takes 4686774924 steps before it repeats a previous state! Clearly, +you might need to [1m[97mfind a more efficient way to simulate the universe[0m. + +[1m[97mHow many steps does it take[0m to reach the first state that exactly matches a previous state? + + diff --git a/src/12/solve.py b/src/12/solve.py new file mode 100644 index 0000000..a688376 --- /dev/null +++ b/src/12/solve.py @@ -0,0 +1,53 @@ +import sys
+sys.path.append("../common")
+import aoc
+
+lines = aoc.data.split("\n")
+istate = lines[0].split(": ")[1]
+rules = [l.split(" => ") for l in lines[2:] if l != ""]
+rules = [r[0] for r in rules if r[1] == "#"]
+
+def next_gen(pots):
+ pmin = min(pots)
+ pmax = max(pots)
+ npots = list()
+ for i in range(pmin-4, pmax+1):
+ for r in rules:
+ match = True
+ for j in range(5):
+ if (r[j] == "#") != ((i+j) in pots):
+ match = False
+ break
+ if match:
+ npots.append(i+2)
+ break
+ return npots
+
+def get_pots():
+ pots = list()
+ for i in range(len(istate)):
+ if istate[i] == "#":
+ pots.append(i)
+ return pots
+
+def solve1(args):
+ pots = get_pots()
+ for i in range(20):
+ pots = next_gen(pots)
+ return sum(pots)
+
+def solve2(args):
+ pots = get_pots()
+ psum = sum(pots)
+ pdif = None
+ i = 0
+ while (True):
+ pots = next_gen(pots)
+ i += 1
+ csum = sum(pots)
+ if pdif == csum - psum:
+ return csum + pdif * (50000000000 - 164)
+ pdif = csum - psum
+ psum = csum
+
+aoc.run(solve1, solve2, sols=[1987, 1150000000358])
diff --git a/src/13/input b/src/13/input new file mode 100644 index 0000000..f970d12 --- /dev/null +++ b/src/13/input @@ -0,0 +1,150 @@ + /----------------------------------------------------------------------------------------------\
+ /------------+-----\ /--------------------+-----------------\
+ | | | /-------------------->-------+<-------------------+------\ /+-------------\
+ | | | /---+------\ | | | || |
+ | | | /--+---+------+---------------------+--------------------+------+---------++---\ /------+----\
+ | | | | | | | /-----------+--------------------+------+---------++\ | | | |
+ | | | /----------------\ | | | | | | /----+------+---------+++--+--+------+----+\
+ | | | | /-------------+---------+--+---+------+---------+-----------+-----\ | | | ||| | | | ||
+ | | | | | | | | | /----+---------+-----------+-----+---------+----+----->+----\ ||| | | | ||
+ | | | | | | | | | | | /----+-----------+-----+---------+----+------+----+----+++--+\ | | ||
+ | | | | | | /---+--+---+-+----+\ | | | | | | | | ||| || | | ||
+ | | | | | | | | | | |/---++---+----+-----------+-----+---------+--\ | | | ||| || | | ||
+ | | | | | | | | | | || || | | | | | | | | | ||| || | | ||
+ | | /-+----+--+-------------+---\ | | | | || ||/--+----+-----------+-----+---------+--+-+----\ | | ||| || | | ||
+ | /----------+---+-+----+--+-------------+---+-+---+--+---+-++---+++--+----+-----------+-----+------\ | | | | | | ||| || | | ||
+ | | | | | | | | | | | | | || ||| | | | | | | | | | | | ||| || \------+----/|
+ | | | | | | | |/--+-+---+--+---+-++---+++--+----+-----------+-----+------+--+--+-+----+-+<---+----+++\ || | |
+ | | /+---+-+----+--+-------------++-\| | | | | || ||| | | /-------+-----+------+--+<-+-+-\ | | | |||| || | |
+ | | || | | | | || || | | | | || ||| | | | | | | | | | | | |/---+----++++-++----\ | |
+ |/+--------\|| | | | /+-----------\ || || | | | | || ||| | | | | /-+------+--+--+-+-+--+-++---+----++++-++----+---+--\ |
+ ||| ||| | | | || | || || | | | | || ||| | | | /---+---+-+------+--+--+-+-+--+-++---+----++++-++----+-\ | | |
+ ||| ||| | | | || /--+-++-++-+---+\ | /+-++---+++--+----+---+---+---+---+>+------+--+--+-+-+--+-++---+-\ |||| || | | | | |
+ ||| /-+++---+-+\ | || | | || || \---++-+--++-++---+/| | | | | | | | | | | | | | || | | |||| || | | | | |
+ ||| | ||| | || |/++--------+--+-++-++-----++-+--++-++---+-+--+----+---+---+---+---+-+\ | | | | | | || | | |||| || | | | | |
+ ||| | ||| | || |||| | | || || || | |\-++---+-+--+----+---+---+---+---+-++-----+--+--+-+-+--+-/| | | |||| || | | | | |
+ ||| | ||| \-++---++++--------+--+-++-+/ || | | || | | | | | | | | || | | | | | | | /-+-+--++++-++----+-+-+--+\ |
+ ||| | ||| || |||| | | || | /-++-+--+--++---+-+--+----+---+---+---+---+-++-\ | | | | | | | | | | |||| || | | | || |
+ ||| /+-+++-----++---++++--------+--+-++-+----+-++-+--+--++---+-+--+----+---+---+---+---+-++-+---+--+\ | | | | | | | | \+++-++----+-+-/ || |
+ ||| || ||\-----++---++++--------+--+-++-+----+-++-+--+--++---+-+--+----+---+---+---+---+-++-+---+--++-+-/ | | | | | | ||| || | | || |
+ ||| || || /-++---++++--------+--+-++-+----+-++-+--+--++---+-+--+----+---+---+---+---+-++-+---+--++-+---+--+--+-+-+-+--\||| || | | || |
+ ||| || || | || |||| | | || | | || | | || | | | | /+---+---+---+-++-+---+--++-+---+--+--+-+-+-+--++++-++----+-+----++\|
+ ||| || || | || |||| | | || | | ||/+--+--++---+-+--+----+\ || | | | || | | || | | | | | | | |||| || | | ||||
+ ||| || || | || /-++++--------+--+-++-+----+-++++--+--++---+-+--+----++-++---+---+---+-++\| | || | | | | | | | |||| || | | ||||
+ ||| |\-++----+-+/ | |||| /---+--+-++-+----+-++++--+--++---+-+--+----++-++---+---+---+-++++---+\ || | | | | | | | |||| || | | ||||
+ ||| | || | | | |||| | | | || | | |||| | || | | | || || | | | |||| || || | | /+--+-+-+\| |||| || | | ||||
+ ||| | || | | | |||| | | | || | | |||| | || | | | || || | | | |||| || || | | || | | ||| |||| || | | ||||
+ ||| | || /--+-+--+-++++----+---+--+-++-+----+-++++--+--++---+-+--+----++-++---+---+---+-++++---++-++-+---+-++\ | | ||| |||| || | | ||||
+/--+++-----+--++-+--+-+--+-++++----+---+--+-++-+----+-++++--+--++---+-+--+--\ || || | | /-+-++++---++-++-+---+-+++-+-+-+++--++++-++---\| | ||||
+| ||| | || | \-+--+-++++----+---+--+-++-+----+-++++--+--++---+-+--+--+-++-++---+---+-+-+-++++---++-++-+---+-+++-+-+-+++--/||| || || | ||||
+| ||| | || | /-+--+-++++----+---+--+-++-+----+-++++--+--++-\ | | | | || || | |/+-+-++++---++-++-+---+\||| | | ||| ||| || || | ||||
+| ||| | || | | | | |||| | |/-+-++-+----+-++++--+--++-+-+-+--+--+-++-++---+---+++-+-++++---++-++-+\ ||||| | | ||| ||| || || | ||||
+| /+++-----+--++-+--+-+--+-++++----+---++-+-++-+----+-++++--+--++-+-+-+--+--+-++-++---+---+++-+-++++---++\|| || ||||| | | ||| ||| || || | ||||
+| |||| | || | | | | |||| | || | || | | \+++--+--++-+-+-+--+--+-++-++---+---+++-+-++++---+++++-++--+++++-+-+-+++---+++-/| || | ||||
+| |||| \--++-+--+-+--+-++++----+---++-+-++-+----+--+++--+--++-+-+-+--+--+-++-++---+---+++-+-++++---++++/ || ||||| | | ||| ||| | || | ||||
+| |||| || | | | | |||| | || | ||/+----+--+++-\| || | | | | | || || |/--+++-+-++++\ |||| || ||||| | | ||| ||| | || | ||||
+| |||| || | | | | |||| | || | ||||/---+--+++-++--++-+>+-+--+--+-++-++---++-\||| | ||||| |||| || ||||| | | ||| ||| | || | ||||
+| |||| || | | | | |||| | || | ||||| | ||| |\--++-+-+-+--+--+-++-++---++-++++-+-+++++--++++--++--+++++-+-+-++/ ||| | || | ||||
+| |||| || | | | | |||| | || | ||||| | ||| | || |/+-+--+--+-++-++---++-++++-+-+++++--++++--++--+++++-+-+-++\ ||| | || | ||||
+| |||| /++-+--+-+--+-++++----+---++-+-+++++---+-\||| | || ||| | | | || || || |||| | ||||| |||| || ||||| | | ||| ||| | || v ||||
+| |||| /----+++-+--+-+--+-++++----+---++-+-+++++---+-++++-+---++-+++\| | | \+-++---++-++++-+-+++++--++++--++--+++++-+-+-+++---+/| | || | ||||
+| |||| |/---+++-+--+-+--+-++++----+---++-+-+++++---+-++++-+---++-+++++--+--+--+\|| || |||| | ||||| |||| || ||||| | | ||| | | | || | ||||
+| |||| || ||| | | | | |||| | || | |||||/--+-++++-+---++-+++++--+--+--++++---++-++++-+-+++++--++++-\|| ||\++-+-+-+/| | | | || | ||||
+| |\++--++---+++-+--+-/ | |||| | \+-+-++++++--+-+/|| |/--++-+++++--+--+--++++---++-++++-+-+++++--++++-+++--++-++-+-+-+-+---+-+--+-\ || | ||||
+| | || || ||| | | | |||| | | | |||||| | | || || || ||||| | | |||| || ||\+-+-+++++--++++-+++--+/ || | | | | | | | | || | ||||
+| | || ||/--+++-+--+----+-++++----+----+-+-++++++--+-+-++-++--++-+++++--+--+-\|||| || || | | ||||| |||| ||| | || | | | | | | | | || | ||||
+| | || ||| ||| | | | |||| | | | |||||| | | || || || ||||\--+--+-+++++---++-++-+-+-+++++--++++-+++--+--/| | | | | | | | | || | ||||
+| | \+--+++--+/| | | | |||| | | | |||||| | | || || || |||| | | ||||| || |\-+-+-+++++--++++-+++--+---+-+-+-+-+---/ | | | || | ||||
+| | | ||| | | | | | |||| | | | ||||||/-+-+-++-++--++-++++---+--+-+++++---++-+--+-+-+++++--++++-+++--+---+-+\| | | | | | || | ||||
+| | | ||| | | | \----+-++++----+----+-+-+++++++-+-+-++-++--++-/||| | | ||||| ||/+--+-+-+++++--++++-+++\ | | ||| | | | | | || | ||||
+| | | ||| | | | | |||| | | | ||\++++-+-+-++-/|/-++--+++---+--+-+++++-\ |||| /+-+-+++++--++++-++++-+---+-+++\| | | | | || | ||||
+| | | /+++--+-+-+-------+-++++----+----+-+-++-++++-+-+-++--++\|| ||| | | ||||| | |||| || | ||||| |||| |||| | | ||||| | | |/+-++-+---\||||
+| | | |||| | | | | |||| | | | || |||| | | || ||||| ||| | | ||||| | |||| || | ||||| |||| |||| | | ||||| | | ||| || | |||||
+| | | |||| | | | | |||| | | | || |||| | | || ||||| ||| | | ||||\-+-++++-++-+-+++++--++++-++++-/ | ||||| | | ||| || | |||||
+| | | |||| | | | | |||| | | | || |||| | | || ||||| ||| | | |||| | ||||/++-+-+++++--++++-++++-----+-+++++-+--\/-+--+++-++-+--\|||||
+| | | |||| | | | | |||| | | | || |||| | | || ||||| ||| | | |||| | |\+++++-+-++++/ |||\-++++-----+-+++++-+--++-+--+++-++-+--+++++/
+| | | |||| | | | /-+-++++----+--\ | | || |||| | | || ||||| ||| |/-+-++++--+-+-+++++-+\|||| ||| |||| | ||||| | || | ||| || | |||||
+| | | |||| | | | | | |||| | | | | || |||| | | || ||||| ||| || | |||| | | ||||| |||||| ||| |||| | ||||| | || | ||| || | |||||
+| | | |||| | | | | | \+++----+--+-+-+-/| |||| | | || ||||| ||| || | |||| | | ||||| |||||| ||| |||| | ||||| | || | ||| || | |||||
+| | | |||\--+-+-+-----+-+--+++----+--+-+-+--+-++++-+-+-++--+++++--+++---++-+-/||| |/+-+++++-++++++---+++\ |||| | ||||v | || | ||| || | |||||
+| | | ||| | | | | | ||| | | |/+--+-++++-+-+\|| ||||| ||| || | ||| ||| |||||/++++++---++++-++++-----+-+++++-+--++-+-\||| || | |||||
+| | | ||| | | |/----+-+--+++\ | | ||| | ||\+-+-++++--+++++--+++---++-+--+++--+++-++++++++++++---++++-/||| /+-+++++-+--++-+-++++-++-+-\|||||
+| | | ||| | | || | | |\++---+--+-++/ | || | | |||| ||||\--+++---++-+--+++--+++-++++++++++++---++++--/|| || ||||| | || | |||| || | ||||||
+|/+--+-+++---+-+-++----+-+--+-++---+--+-++---+-++-+-+-++++--++++---+++---++-+--+++--+++-++++++++++++-\ |||| || || ||||| | || | |||| || | ||||||
+||| | ||| | | || /-+-+--+-++---+--+-++---+-++-+-+-++++--++++-\ ||| || | |||/-+++-++++++++++++-+-++++---++----++-+++++-+--++-+\|||| || | ||||||
+^|| | ||| | | || | | | | || | | || \-++-+-+-++++--++++-+-+++---++-+--++++-+++-++++++++++++-+-++++---++----++-+++++-+--++-/||||| || | ||||||
+||| | ||| | | || | | | | || |/-+-++-----++-+-+-++++--++++-+-+++---++-+--++++-+++>++++++++++++-+-++++---++----++-+++++-+\ || ||||| || | ||||||
+||| | \++---+-+-++--+-+-+--+-++---++-+-++-----++-+-+-++++--++/| | ||| || | |||| ||| \+++++++++++-+-++++---+/ || ||||| || |\--+++++-++-+-+/||||
+||| | || | | || | | | | || || | || || | | |||| || | |/+++---++-+--++++-+++--+++++++++++-+-++++\ | || ||||| || | ||||| || | | ||||
+||| | || | | || | | | | || || | || /++-+-+-++++--++-+-+++++--\|| | |||| ||| ||||||||||| | ||||| | /---++-+++++-++-+---+++++\|| | | ||||
+||| | || | | || | | | | || || | || ||| | | |||| || | ||||| ||| | |||| ||\--+++++++++++-+-+++++--+-+---++-+++++-++-+---++++++++-/ | ||||
+||| | || | | || /+-+-+--+-++---++-+-++----+++\| | |||| || | ||||| |\+-+--++++-++---+++++++++++-+-+++++--+-+---++-+++++-++-+---++/||||| | ||||
+||| | || |/+-++-++-+-+--+-++---++-+-++----+++++\| |||| || | ||||| | | | |||| || ||||||||||| | ||||| | | || ||||| || | || ||||| | ||||
+||| | || ||| || || | | | || || | || ||||||| |||| |\-+-+++++--+-+-+--++++-/| ||||||||||| | ||||| | | || ||||| || | || ||||| | ||||
+||| | || |||/++-++-+-+--+-++---++-+-++----+++++++-++++--+--+-+++++--+-+-+--++++--+---+++++++++++\| ||||| | | || ||||| || | || ||||| | ||||
+||| | || |||||| || |/+--+-++---++-+-++----+++++++-++++--+--+-+++++--+-+-+--++++--+-\ v|||||||||||| ||||| | | || ||||| || | || ||||| | ||||
+||| | || |||||| || ||| | || || | || ||||||| |||| | | ||||| | | | |||| | | |||||||||||||/+++++--+-+---++-+++++-++-+---++-+++++---+-++++\
+||| | || |||||| || |||/-+-++---++\| || ||||||| |||| | \-+++++--+-+-+--++++--+-+-+++++++++++++++++++--+-+---++-++++/ || | || ||||| | |||||
+||| | || |||||| || |||| | || |||| || ||||||\-++++--+----+++++--+-+-+--++++--+-+-++++++++++/|||||||| | | || |||| || | || ||||| | |||||
+||| | || |||||| || |||| | || |||| || |||||| |||| | ||||| | | | |||v \-+-++++++++++-++++++/| | | || |||| || | || ||||| | |||||
+||| | || /++++++-++\|||| |/++---++++-++----++++++--++++--+----+++++--+-+-+--++++----+-++++++++++-++++++-+--+-+---++-++++--++-+\ || ||||| | |||||
+||| | || |\+++++-+++++++-++++---++++-++----++++++--/||\--+----+++/| | | | |||| | |||||\++++-++++++-+--+-+---++-++++--++-++--++-+++++---+-+/|||
+||| | || | ||||| ||||||| |||| |||| || /-++++++---++---+----+++-+--+-+-+--++++----+-+++++-++++-++++++-+--+-+---++-++++--++\|| || ||||| | | |||
+||| | || | ||||| ||||||| |||| |||| || | |||||| || | ||| | | | | |||| | ||||\-++++-++++++-+--+-+---++-++++--+++++--+/ ||||| | | |||
+||| \--++--+-+++++-+++++++-++++---++++-++--+-++++++---++---+----+++-+--+-+-+--++++----+-++++--++++-+++/|| | | | || |||| ||||| | ||||| | | |||
+||| /---++--+-+++++-+++++++-++++---++++-++--+-++++++---++---+----+++-+--+-+-+--++++----+-++++-\|||| ||| || | | | || |||| ||||| | ||||| | | |||
+||| | || | ||||| ||||||| |||| |||| || | |||||| || | ||| | | | | |||| | |||| ||||| ||| || | | | || \+++--+++++--+--++++/ | | |||
+||| | || | ||||| ||||||| |||| |\++-++--+-++++++---++---+----+++-+--+-+-+--++++----+-++++-+++++-+++-++-+--+-+---++--+++--+/||| | |||| | | |||
+||| | || | ||||| ||||||| ||||/--+-++-++--+-++++++---++---+---\||| | | | | /++++----+-++++-+++++-+++-++-+\ | | || ||| | ||| | |||| | | |||
+|\+-+---++--+-+++++-+++++++-+++++--+-++-++--+-++++++---++---+---++++-+--+-+-+-+++++----+-++++-+++++-+/| || || | | || ||| | ||| | |||| | | |||
+| | | || | ||||| ||||||| |\+++--+-++-++--+-++++++---++---+---++++-+--+-+-+-+++++----+-++++-+++++-+-+-++-++-+-+--<++--+++--+-++/ | |||| | | |||
+| | | || | ||||| |||\+++-+-+++--+-+/ || | |||||| || \---++++-+--+-+-+-+++++----+-++++-+++++-+-+-++-++-+-+---++--+++--+-++---+--+/|| | | |||
+| | | \+--+-+++++-+++-+++-+-+++--+-+--++--+-++++++---++-------++++-/ | | | |||\+----+-++++-+++++-+-+-++-++-+-+---++--+++--+-++---+--+-++----+-+-+/|
+| | | | | ||||| ||| ||| \-+++--+-+--++--+-++++++---++-------++++----+-+-+-+++-+----+-++++-+++/| | | || || | | || ||| | || | | || | | | |
+| | | | | ||||| ||| ||| ||| | |/-++--+-++++++---++-------++++----+-+-+-+++-+----+-++++-+++-+-+-+-++-++-+-+---++--+++--+-++---+--+\|| | | | |
+| | | | | ||||| ||| ||| ||| | || ||/-+-++++++---++-------++++----+-+-+-+++-+\ | |||| ||| | | | || || | | || ||| | || | |||| | | | |
+| | | | |/+++++-+++-+++---+++--+\|| ||| | |||||| || /-++++----+-+-+-+++-++---+-++++-+++-+-+-+-++-++-+-+---++--+++--+-++---+--++++\ | | | |
+| | | | ||||||| ||| ||| ||| |||| ||| | |||||| || /--+-++++----+-+-+-+++-++---+-++++-+++-+-+-+-++-++-+-+>\ || ||| | || | ||||| | | | |
+| | | | ||||||| ||| ||| ||| |||| ||| | |||||| || | | |||| | \-+-+++-++---+-++++-+/| | | | || || | | | || ||| | || | ||||| | | | |
+| | | | ||||||| ||| ||| |||/-++++-+++-+-++++++---++--+--+-++++----+---+-+++-++---+-++++-+-+-+-+-+-++-++-+-+-+-++--+++--+-++---+-\||||| | | | |
+| | | | ||||||| ||| ||| \+++-++++-+++-+-++++++---++--+--+-++++----+---+-+++-++---+-++++-+-/ | | | || || | | | || ||| | || | |||||| | | | |
+| | | | ||||||| ||| ||| ||| |||| \++-+-++++++---++--+--+-++++----+---+-+++-++---+-++++-+---+-+-+-++-++-/ | | || ||| | || | |||||| | | | |
+| | | /-+--+++++++-+++-+++----+++-++++--++-+-++++++---++--+--+-++++----+---+-+++-++---+-++++-+---+-+-+-++-++---+-+\|| ||| | || | |||||| | | | |
+| | | | | ||||||| ||| ||| ||| |||| || | ||\+++---++--+--+-++++----+---+-+++-++---+-/||| | | | | || || | |||| ||| | || | |||||| | | | |
+| | | | | ||||||| ||| ||| ||| |||| || | || ||| || | | |||| | | ||| || | ||| | | | | || || | |||| ||| | || | |||||| | | | |
+| | | | | |||\+++-+++-+++----+++-++++--++-+-+/ ||| || | | ||\+----+---+-+++-++---+--+++-+---+-+-+-++-/| | |||| ||| | || | |||||| | | | |
+| | | | | ||| ||| ||| ||| ||| |||| || | | ||| || | | || | | | ||| || | ||| | | | | || | \-++++--+++--+-++---+-+++/|| | | | |
+| | | | | ||| ||| |\+-+++----+++-++++--++-+-+--+++---++--+--+-+/ | | | ||| || | ||| | | | | || | |||| ||| | || | ||| || | | | |
+| | | | | ||| ||| | | ||| ||| |||| || | | ||| || | | | | | | ||| || | ||| | | | | || | |||| ||| | || | ||| || | | | |
+| \-+--+-+--+++-+++-+-+-+++----+++-++++--++-+-+--+++---++--+--+-+--+----+---+-+++-++---+--+++-+---+-+-+-+/ | |||| ||| | || | ||| || | | | |
+| | | | ||| ||| | | ||| ||| |||| || | | ||| || | | | | | | ||| || | ||| | | | | | | |||| ||| | || | ||| || | | | |
+| | | | ||| ||| | | ||| ||| |||| || | \--+++---++--+--+-+--+----/ | ||| || | ||| | | | | | | ||\+--+++--+-++---+-+++-++---/ | | |
+\---+--+-+--+++-+++-+-+-+++----+++-++++--++-+----+++---++--+--+-+--+--------/ ||| || | ||| | | | | | | || | ||| | || | ||| || | | |
+ | | | ||| ||| | | ||| ||| |||| || | ||| || | \-+--+----------+++-++---+--+++-+---+-+-+-+---+-----++-+--+++--+-++---+-+++-+/ | | |
+ | | | ||| ||| | | \++----+++-++++--++-+----+++---++--+----+--+----------+++-++---/ ||| | | | | | | || | ||| | || | |\+-+------/ | |
+ | | | ||| ||| | | || ||| |||| || | ||| || | |/-+----------+++-++--\ ||| | | | | | | || | ||| | || | | | | | |
+ | | | ||| ||| | | || ||| |||| || | ||| || | || | ||| || | ||| | /+-+-+-+---+-----++-+--+++--+-++---+-+-+\| | |
+ | | | ||| ||| | | || ||| |||| || | ||| || | || \----------+++-++--+---+++-+--++-+-+-+---+-----++-+--+++--/ || | | ||| | |
+ | | | ||| ||| | | \+----+++-++++--++-+----+++---++--+----++------------+++-++--+---+++-+--+/ | | | | || | ||| || | | ||| | |
+ | | | |\+-+++-+-+---+----+++-+/|| || | ||| || | || ||| || | \++-+--+--+-+-+---+-----++-+--+++----+/ | | ||| | |
+ | | | | | ||| \-+---+----+++-+-++--++-+----/|| || | || ||| || | || | | | | | | || | ||| | | | ||| | |
+ | | | | \-+++---+---+----+++-+-++--++-+-----+/ || | || \++-++--+----++-+--+--+-+-+---/ || | |\+----+----+-+-+++--------/ |
+ | | | | ||| | v ||| \-++--++-+-----+----++--+----++-------------++-++--+----++-+--+--+-+-/ || | | | | | | ||| |
+ | | | | ||| | | |\+---++--++-+-----+----++--+----/| || || /+----++-+--+--+-+-----------++-+--+-+----+---\| | ||| |
+ | \-+--+---+++---+---+----+-+---++--++-+-----+----++--+-----+-------------++-++-++----++-+--+--+-+-----------+/ | | | | || | ||| |
+ | | | ||| | | | | || || | | |\--+-----+-------------/| || || || | | | | | | | | | || | ||| |
+ | | | ||| | | | | || || \-----+----+---+-----+--------------+-++-++----++-+--+--+-+-----------+--+--+-+----/ || | ||| |
+ | | | ||| | | | | || || | | | \--------------+-++-+/ \+-+--+--+-+-----------+--+--+-/ || | ||| |
+ | | | ||| | | | | || \+-------+----/ | | || | | | | | \-----------+--+--+----------++-+-+++----------/
+ | | | |\+---+---+----+-+---++---+-------+--------+--------------------+-++-+------+-+--+--+-------------+--/ | || | |||
+ | \--+---+-+---+---+----+-+---++---+-------+--------+--------------------/ || | | | | | | | || | |||
+ | | | | | | | | || | | \----------------------++-+------+-+--+--+-------------/ | || | |||
+ | | | | | | | | || | | || \------+-+--+--+-------------------+----------/| | |||
+ | | | | | | | \---++---+-------+-------------------------------++--------+-+--+--+-------------------+-----------+-/ |||
+ | | | | | | | || | | || \-+--+--+-------------------+-----------+---++/
+ | \---+-+---/ | | || | | \+----------+--+--+-------------------+-----------/ ||
+ \-----------+<+-------+----+-----++---+-------+--------------------------------+----------/ | | | ||
+ \-+-------+----+-----++---+-------+--------------------------------+-------------+--/ | ||
+ | \----+-----/\---+-------+--------------------------------+-------------+----------------------+---------------/|
+ \------------/ | \--------------------------------+-------------+----------------------/ |
+ \----------------------------------------/ \---------------------------------------/
diff --git a/src/13/part1 b/src/13/part1 new file mode 100644 index 0000000..22fe267 --- /dev/null +++ b/src/13/part1 @@ -0,0 +1,188 @@ +--- Day 13: Mine Cart Madness --- + +A crop of this size requires significant logistics to transport produce, soil, fertilizer, and so +on. The Elves are very busy pushing things around in [1m[97mcarts[0m on some kind of rudimentary system of +tracks they've come up with. + +Seeing as how cart-and-track systems don't appear in recorded history for another 1000 years, the +Elves seem to be making this up as they go along. They haven't even figured out how to avoid +collisions yet. + +You map out the tracks (your puzzle input) and see where you can help. + +Tracks consist of straight paths (| and -), curves (/ and \), and intersections (+). Curves connect +exactly two perpendicular pieces of track; for example, this is a closed loop: + +/----\ +| | +| | +\----/ + +Intersections occur when two perpendicular paths cross. At an intersection, a cart is capable of +turning left, turning right, or continuing straight. Here are two loops connected by two +intersections: + +/-----\ +| | +| /--+--\ +| | | | +\--+--/ | + | | + \-----/ + +Several [1m[97mcarts[0m are also on the tracks. Carts always face either up (^), down (v), left (<), or right +(>). (On your initial map, the track under each cart is a straight path matching the direction the +cart is facing.) + +Each time a cart has the option to turn (by arriving at any intersection), it turns +[1m[97mleft[0m the first time, goes [1m[97mstraight[0m the second time, turns [1m[97mright[0m the third time, and then repeats +those directions starting again with [1m[97mleft[0m the fourth time, [1m[97mstraight[0m the fifth time, and so on. This +process is independent of the particular intersection at which the cart has arrived - that is, the +cart has no per-intersection memory. + +Carts all move at the same speed; they take turns moving a single step at a time. They do this based +on their [1m[97mcurrent location[0m: carts on the top row move first (acting from left to right), then carts +on the second row move (again from left to right), then carts on the third row, and so on. Once +each cart has moved one step, the process repeats; each of these loops is called a +[1m[97mtick[0m. + +For example, suppose there are two carts on a straight track: + +| | | | | +v | | | | +| v v | | +| | | v X +| | ^ ^ | +^ ^ | | | +| | | | | + +First, the top cart moves. It is facing down (v), so it moves down one square. Second, the bottom +cart moves. It is facing up (^), so it moves up one square. Because all carts have moved, the first +tick ends. Then, the process repeats, starting with the first cart. The first cart moves down, +then the second cart moves up - right into the first cart, colliding with it! (The location of the +crash is marked with an X.) This ends the second and last tick. +Here is a longer example: + +/->-\ +| | /----\ +| /-+--+-\ | +| | | | v | +\-+-/ \-+--/ + \------/ + +/-->\ +| | /----\ +| /-+--+-\ | +| | | | | | +\-+-/ \->--/ + \------/ + +/---v +| | /----\ +| /-+--+-\ | +| | | | | | +\-+-/ \-+>-/ + \------/ + +/---\ +| v /----\ +| /-+--+-\ | +| | | | | | +\-+-/ \-+->/ + \------/ + +/---\ +| | /----\ +| /->--+-\ | +| | | | | | +\-+-/ \-+--^ + \------/ + +/---\ +| | /----\ +| /-+>-+-\ | +| | | | | ^ +\-+-/ \-+--/ + \------/ + +/---\ +| | /----\ +| /-+->+-\ ^ +| | | | | | +\-+-/ \-+--/ + \------/ + +/---\ +| | /----< +| /-+-->-\ | +| | | | | | +\-+-/ \-+--/ + \------/ + +/---\ +| | /---<\ +| /-+--+>\ | +| | | | | | +\-+-/ \-+--/ + \------/ + +/---\ +| | /--<-\ +| /-+--+-v | +| | | | | | +\-+-/ \-+--/ + \------/ + +/---\ +| | /-<--\ +| /-+--+-\ | +| | | | v | +\-+-/ \-+--/ + \------/ + +/---\ +| | /<---\ +| /-+--+-\ | +| | | | | | +\-+-/ \-<--/ + \------/ + +/---\ +| | v----\ +| /-+--+-\ | +| | | | | | +\-+-/ \<+--/ + \------/ + +/---\ +| | /----\ +| /-+--v-\ | +| | | | | | +\-+-/ ^-+--/ + \------/ + +/---\ +| | /----\ +| /-+--+-\ | +| | | X | | +\-+-/ \-+--/ + \------/ + +After following their respective paths for a while, the carts eventually crash. To help prevent +crashes, you'd like to know [1m[97mthe location of the first crash[0m. Locations are given in X,Y coordinates, +where the furthest left column is X=0 and the furthest top row is Y=0: + + 111 + 0123456789012 +0/---\ +1| | /----\ +2| /-+--+-\ | +3| | | X | | +4\-+-/ \-+--/ +5 \------/ + +In this example, the location of the first crash is [1m[97m7,3[0m. + + + + diff --git a/src/13/part2 b/src/13/part2 new file mode 100644 index 0000000..e7ccee4 --- /dev/null +++ b/src/13/part2 @@ -0,0 +1,26 @@ +--- Part Two --- + +The game didn't run because you didn't put in any quarters. Unfortunately, you did not bring any +quarters. Memory address 0 represents the number of quarters that have been inserted; set it to 2 to +play for free. + +The arcade cabinet has a joystick that can move left and right. The software reads the position of +the joystick with input instructions: + + + - If the joystick is in the [1m[97mneutral position[0m, provide 0. + + - If the joystick is [1m[97mtilted to the left[0m, provide -1. + + - If the joystick is [1m[97mtilted to the right[0m, provide 1. + + +The arcade cabinet also has a segment display capable of showing a single number that represents the +player's current score. When three output instructions specify X=-1, Y=0, the third output +instruction is not a tile; the value instead specifies the new score to show in the segment display. + For example, a sequence of output values like -1,0,12345 would show 12345 as the player's current +score. + +Beat the game by breaking all the blocks. [1m[97mWhat is your score after the last block is broken?[0m + + diff --git a/src/13/solve.py b/src/13/solve.py new file mode 100644 index 0000000..e89466c --- /dev/null +++ b/src/13/solve.py @@ -0,0 +1,148 @@ +import sys
+sys.path.append("../common")
+import aoc
+
+tmap = [list(l) for l in aoc.data.split("\n") if len(l) != 0]
+xlen, ylen = len(tmap[0]), len(tmap)
+
+arrows = dict()
+arrows["<"] = (-1, 0)
+arrows[">"] = (1, 0)
+arrows["^"] = (0, -1)
+arrows["v"] = (0, 1)
+
+directions = [(-1,0), (0,-1), (1, 0), (0, 1)] # l - u - r - d
+
+def check_pos(x, y):
+ if x < xlen and x >= 0 and y < ylen and y >= 0:
+ return tmap[y][x]
+ return " "
+
+def correct(x, y):
+ cr = check_pos(x+1, y)
+ cl = check_pos(x-1, y)
+ cu = check_pos(x, y-1)
+ cd = check_pos(x, y+1)
+
+ if cr == "|": cr = " "
+ if cl == "|": cl = " "
+ if cu == "-": cu = " "
+ if cd == "-": cd = " "
+
+ r = cr != " "
+ l = cl != " "
+ u = cu != " "
+ d = cd != " "
+
+ vsum = r + l + u + d
+ if vsum > 2:
+ return "+"
+
+ # 2 around
+ if r:
+ if l:
+ return "-"
+ elif u:
+ return "/"
+ else:
+ return "\\"
+ else:
+ if not l:
+ return "|"
+ elif u:
+ return "/"
+ else:
+ return "\\"
+
+carts = list()
+for y in range(ylen):
+ for x in range(xlen):
+ if tmap[y][x] in arrows:
+ carts.append([x, y, arrows[tmap[y][x]], 0, 0])
+ tmap[y][x] = correct(x,y)
+
+def cart_at(x, y):
+ global carts
+ for i in range(len(carts)):
+ c = carts[i]
+ if c[0] == x and c[1] == y and not c[4]:
+ return i
+ return None
+
+def draw_map():
+ for y in range(ylen):
+ f = lambda x : "".join(["#" if cart_at(x,y) != None else tmap[y][x]])
+ aoc.debug([f(x) for x in range(len(tmap[y]))])
+
+def advance(cart):
+ ncart = [0 for x in range(5)]
+ ncart[0] = cart[0]+cart[2][0]
+ ncart[1] = cart[1]+cart[2][1]
+ col = cart_at(ncart[0], ncart[1])
+ if col != None:
+ return ncart[0], ncart[1], col
+
+ c = tmap[ncart[1]][ncart[0]]
+ d = directions.index(cart[2])
+
+ if c == "+":
+ d = (d + len(directions)-1 + cart[3]) % len(directions)
+ ncart[2] = directions[d]
+ ncart[3] = (cart[3] + 1) % 3
+ else: # dont need to change direction for '-' and '|'
+ if c == "/":
+ ncart[2] = directions[3-d]
+ elif c == "\\":
+ if d == 0: #l
+ ncart[2] = directions[1]
+ elif d == 1: #u
+ ncart[2] = directions[0]
+ elif d == 2: #r
+ ncart[2] = directions[3]
+ elif d == 3: #d
+ ncart[2] = directions[2]
+ else:
+ ncart[2] = cart[2]
+ ncart[3] = cart[3]
+ return ncart
+
+
+def solve1(args):
+ global carts
+
+ crash = None
+ while not crash:
+ carts = sorted(carts, key=lambda x:(x[0], x[1]))
+ for c in range(len(carts)):
+ nc = advance(carts[c])
+ if len(nc) == 3:
+ crash = nc
+ break
+ else:
+ carts[c] = nc
+
+ return f"{crash[0]},{crash[1]}"
+
+def solve2(args):
+ global carts
+
+ while len(carts) > 1:
+ carts = sorted(carts, key=lambda x:(x[0], x[1]))
+ rcarts = list()
+ for c in range(len(carts)):
+ if carts[c][4]: continue;
+ nc = advance(carts[c])
+ if len(nc) == 3:
+ carts[c][4] = 1
+ carts[nc[2]][4] = 1
+ rcarts.append(carts[c])
+ rcarts.append(carts[nc[2]])
+ else:
+ carts[c] = nc
+ for c in rcarts:
+ if c in carts: # prevent doubles
+ carts.remove(c)
+
+ return f"{carts[0][0]},{carts[0][1]}"
+
+aoc.run(solve1, solve2)
diff --git a/src/13/test1 b/src/13/test1 new file mode 100644 index 0000000..30bc010 --- /dev/null +++ b/src/13/test1 @@ -0,0 +1,7 @@ +/>-<\ +| | +| /<+-\ +| | | v +\>+</ | + | ^ + \<->/ diff --git a/src/14/input b/src/14/input new file mode 100644 index 0000000..1c93252 --- /dev/null +++ b/src/14/input @@ -0,0 +1 @@ +110201 diff --git a/src/14/part1 b/src/14/part1 new file mode 100644 index 0000000..912c55a --- /dev/null +++ b/src/14/part1 @@ -0,0 +1,70 @@ +--- Day 14: Chocolate Charts --- + +You finally have a chance to look at all of the produce moving around. Chocolate, cinnamon, mint, +chili peppers, nutmeg, vanilla... the Elves must be growing these plants to make [1m[97mhot chocolate[0m! As +you realize this, you hear a conversation in the distance. When you go to investigate, you discover +two Elves in what appears to be a makeshift underground kitchen/laboratory. + +The Elves are trying to come up with the ultimate hot chocolate recipe; they're even maintaining a +scoreboard which tracks the quality [1m[97mscore[0m (0-9) of each recipe. + +Only two recipes are on the board: the first recipe got a score of 3, the second, 7. Each of the two +Elves has a [1m[97mcurrent recipe[0m: the first Elf starts with the first recipe, and the second Elf starts +with the second recipe. + +To create new recipes, the two Elves combine their current recipes. This creates new recipes from +the [1m[97mdigits of the sum[0m of the current recipes' scores. With the current recipes' scores of 3 and 7, +their sum is 10, and so two new recipes would be created: the first with score 1 and the second with +score 0. If the current recipes' scores were 2 and 3, the sum, 5, would only create one recipe (with +a score of 5) with its single digit. + +The new recipes are added to the end of the scoreboard in the order they are created. So, after the +first round, the scoreboard is 3, 7, 1, 0. + +After all new recipes are added to the scoreboard, each Elf picks a new current recipe. To do this, +the Elf steps forward through the scoreboard a number of recipes equal to [1m[97m1 plus the score of their +current recipe[0m. So, after the first round, the first Elf moves forward 1 + 3 = 4 times, while the +second Elf moves forward 1 + 7 = 8 times. If they run out of recipes, they loop back around to the +beginning. After the first round, both Elves happen to loop around until they land on the same +recipe that they had in the beginning; in general, they will move to different recipes. + +Drawing the first Elf as parentheses and the second Elf as square brackets, they continue this +process: + +(3)[7] +(3)[7] 1 0 + 3 7 1 [0](1) 0 + 3 7 1 0 [1] 0 (1) +(3) 7 1 0 1 0 [1] 2 + 3 7 1 0 (1) 0 1 2 [4] + 3 7 1 [0] 1 0 (1) 2 4 5 + 3 7 1 0 [1] 0 1 2 (4) 5 1 + 3 (7) 1 0 1 0 [1] 2 4 5 1 5 + 3 7 1 0 1 0 1 2 [4](5) 1 5 8 + 3 (7) 1 0 1 0 1 2 4 5 1 5 8 [9] + 3 7 1 0 1 0 1 [2] 4 (5) 1 5 8 9 1 6 + 3 7 1 0 1 0 1 2 4 5 [1] 5 8 9 1 (6) 7 + 3 7 1 0 (1) 0 1 2 4 5 1 5 [8] 9 1 6 7 7 + 3 7 [1] 0 1 0 (1) 2 4 5 1 5 8 9 1 6 7 7 9 + 3 7 1 0 [1] 0 1 2 (4) [1m[97m5 1 5 8 9 1 6 7 7 9[0m 2 + +The Elves think their skill will improve after making a few recipes (your puzzle input). However, +that could take ages; you can speed this up considerably by identifying [1m[97mthe scores of the ten +recipes[0m after that. For example: + + + - If the Elves think their skill will improve after making 9 recipes, the scores of the ten recipes +[1m[97mafter[0m the first nine on the scoreboard would be 5158916779 (highlighted in the last line of the +diagram). + + - After 5 recipes, the scores of the next ten would be 0124515891. + + - After 18 recipes, the scores of the next ten would be 9251071085. + + - After 2018 recipes, the scores of the next ten would be 5941429882. + + +[1m[97mWhat are the scores of the ten recipes immediately after the number of recipes in your puzzle +input?[0m + + diff --git a/src/14/part2 b/src/14/part2 new file mode 100644 index 0000000..1fc54ca --- /dev/null +++ b/src/14/part2 @@ -0,0 +1,18 @@ +--- Part Two --- + +After collecting ORE for a while, you check your cargo hold: [1m[97m1 trillion[0m ([1m[97m1000000000000[0m) units of +ORE. + +[1m[97mWith that much ore[0m, given the examples above: + + + - The 13312 ORE-per-FUEL example could produce [1m[97m82892753[0m FUEL. + + - The 180697 ORE-per-FUEL example could produce [1m[97m5586022[0m FUEL. + + - The 2210736 ORE-per-FUEL example could produce [1m[97m460664[0m FUEL. + + +Given 1 trillion ORE, [1m[97mwhat is the maximum amount of FUEL you can produce?[0m + + diff --git a/src/14/solve.py b/src/14/solve.py new file mode 100644 index 0000000..a6c63a3 --- /dev/null +++ b/src/14/solve.py @@ -0,0 +1,37 @@ +import sys
+sys.path.append("../common")
+import aoc
+
+data = aoc.data
+recipes = [3, 7]
+
+def solve1(args):
+ global recipes, data
+
+ end = int(data)
+ workers = [i for i in range(2)]
+ while len(recipes) < end + 10:
+ recipes += [int(c) for c in str(sum(recipes[workers[i]] for i in range(len(workers))))]
+ for i in range(len(workers)):
+ workers[i] = (workers[i] + recipes[workers[i]]+1) % len(recipes)
+ return "".join([str(x) for x in recipes[end:]])
+
+def solve2(args):
+ global recipes, data
+
+ ilen = len(data)
+ data = [int(c) for c in data]
+ workers = [i for i in range(2)]
+ stop = False
+ counter = 0
+ while not stop:
+ for v in [int(c) for c in str(sum(recipes[workers[i]] for i in range(len(workers))))]:
+ if recipes[-ilen:] == data:
+ stop = True
+ break
+ recipes.append(v)
+ for i in range(len(workers)):
+ workers[i] = (workers[i] + recipes[workers[i]]+1) % len(recipes)
+ return len(recipes) - ilen
+
+aoc.run(solve1, solve2, sols=["6107101544", 20291131])
diff --git a/src/15/input b/src/15/input new file mode 100644 index 0000000..c6ec342 --- /dev/null +++ b/src/15/input @@ -0,0 +1,32 @@ +################################
+###############.##...###########
+##############..#...G.#..#######
+##############.............#####
+###############....G....G......#
+##########..........#..........#
+##########................##..##
+######...##..G...G.......####..#
+####..G..#G...............####.#
+#######......G....G.....G#####E#
+#######.................E.######
+########..G...............######
+######....G...#####E...G....####
+######..G..G.#######........####
+###.........#########.......E.##
+###..#..#...#########...E.....##
+######......#########.......####
+#####...G...#########.....######
+#####G......#########.....######
+#...#G..G....#######......######
+###...##......#####.......######
+####..##..G........E...E..######
+#####.####.....######...########
+###########..#...####...E.######
+###############...####..#...####
+###############...###...#.E.####
+#####################.#E....####
+#####################.#...######
+###################...##.#######
+##################..############
+##################...###########
+################################
diff --git a/src/15/part1 b/src/15/part1 new file mode 100644 index 0000000..34c087d --- /dev/null +++ b/src/15/part1 @@ -0,0 +1,343 @@ +--- Day 15: Beverage Bandits --- + +Having perfected their hot chocolate, the Elves have a new problem: the Goblins that live in these +caves will do anything to steal it. Looks like they're here for a fight. + +You scan the area, generating a map of the walls (#), open cavern (.), and starting position of +every Goblin (G) and Elf (E) (your puzzle input). + +Combat proceeds in [1m[97mrounds[0m; in each round, each unit that is still alive takes a [1m[97mturn[0m, resolving all +of its actions before the next unit's turn begins. On each unit's turn, it tries to +[1m[97mmove[0m into range of an enemy (if it isn't already) and then [1m[97mattack[0m (if it is in range). + +All units are very disciplined and always follow very strict combat rules. Units never move or +attack diagonally, as doing so would be dishonorable. When multiple choices are equally valid, ties +are broken in [1m[97mreading order[0m: top-to-bottom, then left-to-right. For instance, the order in which +units take their turns within a round is the [1m[97mreading order of their starting positions[0m in that +round, regardless of the type of unit or whether other units have moved after the round started. +For example: + + would take their +These units: turns in this order: + ####### ####### + #.G.E.# #.1.2.# + #E.G.E# #3.4.5# + #.G.E.# #.6.7.# + ####### ####### + +Each unit begins its turn by identifying all possible [1m[97mtargets[0m (enemy units). If no targets remain, +combat ends. + +Then, the unit identifies all of the open squares (.) that are [1m[97min range[0m of each target; these are +the squares which are [1m[97madjacent[0m (immediately up, down, left, or right) to any target and which aren't +already occupied by a wall or another unit. Alternatively, the unit might [1m[97malready[0m be in range of a +target. If the unit is not already in range of a target, and there are no open squares which are in +range of a target, the unit ends its turn. + +If the unit is already in range of a target, it does not [1m[97mmove[0m, but continues its turn with an +[1m[97mattack[0m. Otherwise, since it is not in range of a target, it [1m[97mmoves[0m. + +To [1m[97mmove[0m, the unit first considers the squares that are [1m[97min range[0m and determines [1m[97mwhich of those +squares it could reach in the fewest steps[0m. A [1m[97mstep[0m is a single movement to any [1m[97madjacent[0m (immediately +up, down, left, or right) open (.) square. Units cannot move into walls or other units. The unit +does this while considering the [1m[97mcurrent positions of units[0m and does [1m[97mnot[0m do any prediction about +where units will be later. If the unit cannot reach (find an open path to) any of the squares that +are in range, it ends its turn. If multiple squares are in range and [1m[97mtied[0m for being reachable in the +fewest steps, the square which is first in [1m[97mreading order[0m is chosen. For example: + +Targets: In range: Reachable: Nearest: Chosen: +####### ####### ####### ####### ####### +#E..G.# #E.?G?# #E.@G.# #E.!G.# #E.+G.# +#...#.# --> #.?.#?# --> #.@.#.# --> #.!.#.# --> #...#.# +#.G.#G# #?G?#G# #@G@#G# #!G.#G# #.G.#G# +####### ####### ####### ####### ####### + +In the above scenario, the Elf has three targets (the three Goblins): + + + - Each of the Goblins has open, adjacent squares which are [1m[97min range[0m (marked with a ? on the map). + + - Of those squares, four are [1m[97mreachable[0m (marked @); the other two (on the right) would require +moving through a wall or unit to reach. + + - Three of these reachable squares are [1m[97mnearest[0m, requiring the fewest steps (only 2) to reach +(marked !). + + - Of those, the square which is first in reading order is [1m[97mchosen[0m (+). + + +The unit then takes a single [1m[97mstep[0m toward the chosen square along the [1m[97mshortest path[0m to that square. +If multiple steps would put the unit equally closer to its destination, the unit chooses the step +which is first in reading order. (This requires knowing when there is [1m[97mmore than one shortest +path[0m so that you can consider the first step of each such path.) For example: + +In range: Nearest: Chosen: Distance: Step: +####### ####### ####### ####### ####### +#.E...# #.E...# #.E...# #4E[1m[97m2[0m12# #..E..# +#...?.# --> #...!.# --> #...+.# --> #3[1m[97m2[0m101# --> #.....# +#..?G?# #..!G.# #...G.# #432G2# #...G.# +####### ####### ####### ####### ####### + +The Elf sees three squares in range of a target (?), two of which are nearest (!), and so the first +in reading order is chosen (+). Under "Distance", each open square is marked with its distance from +the destination square; the two squares to which the Elf could move on this turn (down and to the +right) are both equally good moves and would leave the Elf 2 steps from being in range of the +Goblin. Because the step which is first in reading order is chosen, the Elf moves [1m[97mright[0m one square. + +Here's a larger example of movement: + +Initially: +######### +#G..G..G# +#.......# +#.......# +#G..E..G# +#.......# +#.......# +#G..G..G# +######### + +After 1 round: +######### +#.G...G.# +#...G...# +#...E..G# +#.G.....# +#.......# +#G..G..G# +#.......# +######### + +After 2 rounds: +######### +#..G.G..# +#...G...# +#.G.E.G.# +#.......# +#G..G..G# +#.......# +#.......# +######### + +After 3 rounds: +######### +#.......# +#..GGG..# +#..GEG..# +#G..G...# +#......G# +#.......# +#.......# +######### + +Once the Goblins and Elf reach the positions above, they all are either in range of a target or +cannot find any square in range of a target, and so none of the units can move until a unit dies. + +After moving (or if the unit began its turn in range of a target), the unit [1m[97mattacks[0m. + +To [1m[97mattack[0m, the unit first determines [1m[97mall[0m of the targets that are [1m[97min range[0m of it by being immediately +[1m[97madjacent[0m to it. If there are no such targets, the unit ends its turn. Otherwise, the adjacent target +with the [1m[97mfewest hit points[0m is selected; in a tie, the adjacent target with the fewest hit points +which is first in reading order is selected. + +The unit deals damage equal to its [1m[97mattack power[0m to the selected target, reducing its hit points by +that amount. If this reduces its hit points to 0 or fewer, the selected target [1m[97mdies[0m: its square +becomes . and it takes no further turns. + +Each [1m[97munit[0m, either Goblin or Elf, has 3 [1m[97mattack power[0m and starts with 200 [1m[97mhit points[0m. + +For example, suppose the only Elf is about to attack: + + HP: HP: +G.... 9 G.... 9 +..G.. 4 ..G.. 4 +..E[1m[97mG[0m. 2 --> ..E.. +..G.. 2 ..G.. 2 +...G. 1 ...G. 1 + +The "HP" column shows the hit points of the Goblin to the left in the corresponding row. The Elf is +in range of three targets: the Goblin above it (with 4 hit points), the Goblin to its right (with 2 +hit points), and the Goblin below it (also with 2 hit points). Because three targets are in range, +the ones with the lowest hit points are selected: the two Goblins with 2 hit points each (one to the +right of the Elf and one below the Elf). Of those, the Goblin first in reading order (the one to the +right of the Elf) is selected. The selected Goblin's hit points (2) are reduced by the Elf's attack +power (3), reducing its hit points to -1, killing it. + +After attacking, the unit's turn ends. Regardless of how the unit's turn ends, the next unit in the +round takes its turn. If all units have taken turns in this round, the round ends, and a new round +begins. + +The Elves look quite outnumbered. You need to determine the [1m[97moutcome[0m of the battle: the +[1m[97mnumber of full rounds that were completed[0m (not counting the round in which combat ends) multiplied +by [1m[97mthe sum of the hit points of all remaining units[0m at the moment combat ends. (Combat only ends +when a unit finds no targets during its turn.) + +Below is an entire sample combat. Next to each map, each row's units' hit points are listed from +left to right. + +Initially: +####### +#.G...# G(200) +#...EG# E(200), G(200) +#.#.#G# G(200) +#..G#E# G(200), E(200) +#.....# +####### + +After 1 round: +####### +#..G..# G(200) +#...EG# E(197), G(197) +#.#G#G# G(200), G(197) +#...#E# E(197) +#.....# +####### + +After 2 rounds: +####### +#...G.# G(200) +#..GEG# G(200), E(188), G(194) +#.#.#G# G(194) +#...#E# E(194) +#.....# +####### + +Combat ensues; eventually, the top Elf dies: + +After 23 rounds: +####### +#...G.# G(200) +#..G.G# G(200), G(131) +#.#.#G# G(131) +#...#E# E(131) +#.....# +####### + +After 24 rounds: +####### +#..G..# G(200) +#...G.# G(131) +#.#G#G# G(200), G(128) +#...#E# E(128) +#.....# +####### + +After 25 rounds: +####### +#.G...# G(200) +#..G..# G(131) +#.#.#G# G(125) +#..G#E# G(200), E(125) +#.....# +####### + +After 26 rounds: +####### +#G....# G(200) +#.G...# G(131) +#.#.#G# G(122) +#...#E# E(122) +#..G..# G(200) +####### + +After 27 rounds: +####### +#G....# G(200) +#.G...# G(131) +#.#.#G# G(119) +#...#E# E(119) +#...G.# G(200) +####### + +After 28 rounds: +####### +#G....# G(200) +#.G...# G(131) +#.#.#G# G(116) +#...#E# E(113) +#....G# G(200) +####### + +More combat ensues; eventually, the bottom Elf dies: + +After 47 rounds: +####### +#G....# G(200) +#.G...# G(131) +#.#.#G# G(59) +#...#.# +#....G# G(200) +####### + +Before the 48th round can finish, the top-left Goblin finds that there are no targets remaining, and +so combat ends. So, the number of [1m[97mfull rounds[0m that were completed is [1m[97m47[0m, and the sum of the hit +points of all remaining units is 200+131+59+200 = [1m[97m590[0m. From these, the [1m[97moutcome[0m of the battle is 47 * +590 = [1m[97m27730[0m. + +Here are a few example summarized combats: + +####### ####### +#G..#E# #...#E# E(200) +#E#E.E# #E#...# E(197) +#G.##.# --> #.E##.# E(185) +#...#E# #E..#E# E(200), E(200) +#...E.# #.....# +####### ####### + +Combat ends after 37 full rounds +Elves win with 982 total hit points left +Outcome: 37 * 982 = [1m[97m36334[0m + +####### ####### +#E..EG# #.E.E.# E(164), E(197) +#.#G.E# #.#E..# E(200) +#E.##E# --> #E.##.# E(98) +#G..#.# #.E.#.# E(200) +#..E#.# #...#.# +####### ####### + +Combat ends after 46 full rounds +Elves win with 859 total hit points left +Outcome: 46 * 859 = [1m[97m39514[0m + +####### ####### +#E.G#.# #G.G#.# G(200), G(98) +#.#G..# #.#G..# G(200) +#G.#.G# --> #..#..# +#G..#.# #...#G# G(95) +#...E.# #...G.# G(200) +####### ####### + +Combat ends after 35 full rounds +Goblins win with 793 total hit points left +Outcome: 35 * 793 = [1m[97m27755[0m + +####### ####### +#.E...# #.....# +#.#..G# #.#G..# G(200) +#.###.# --> #.###.# +#E#G#G# #.#.#.# +#...#G# #G.G#G# G(98), G(38), G(200) +####### ####### + +Combat ends after 54 full rounds +Goblins win with 536 total hit points left +Outcome: 54 * 536 = [1m[97m28944[0m + +######### ######### +#G......# #.G.....# G(137) +#.E.#...# #G.G#...# G(200), G(200) +#..##..G# #.G##...# G(200) +#...##..# --> #...##..# +#...#...# #.G.#...# G(200) +#.G...G.# #.......# +#.....G.# #.......# +######### ######### + +Combat ends after 20 full rounds +Goblins win with 937 total hit points left +Outcome: 20 * 937 = [1m[97m18740[0m + +[1m[97mWhat is the outcome[0m of the combat described in your puzzle input? + + diff --git a/src/15/part2 b/src/15/part2 new file mode 100644 index 0000000..749d947 --- /dev/null +++ b/src/15/part2 @@ -0,0 +1,57 @@ +--- Part Two --- + +You quickly repair the oxygen system; oxygen gradually fills the area. + +Oxygen starts in the location containing the repaired oxygen system. It takes [1m[97mone minute[0m for oxygen +to spread to all open locations that are adjacent to a location that already contains oxygen. +Diagonal locations are [1m[97mnot[0m adjacent. + +In the example above, suppose you've used the droid to explore the area fully and have the following +map (where locations that currently contain oxygen are marked O): + + ## +#..## +#.#..# +#.O.# + ### + +Initially, the only location which contains oxygen is the location of the repaired oxygen system. +However, after one minute, the oxygen spreads to all open (.) locations that are adjacent to a +location containing oxygen: + + ## +#..## +#.#..# +#OOO# + ### + +After a total of two minutes, the map looks like this: + + ## +#..## +#O#O.# +#OOO# + ### + +After a total of three minutes: + + ## +#O.## +#O#OO# +#OOO# + ### + +And finally, the whole region is full of oxygen after a total of four minutes: + + ## +#OO## +#O#OO# +#OOO# + ### + +So, in this example, all locations contain oxygen after [1m[97m4[0m minutes. + +Use the repair droid to get a complete map of the area. [1m[97mHow many minutes will it take to fill with +oxygen?[0m + + diff --git a/src/15/solve.py b/src/15/solve.py new file mode 100644 index 0000000..cc16c9d --- /dev/null +++ b/src/15/solve.py @@ -0,0 +1,229 @@ +import sys
+sys.path.append("../common")
+import aoc
+
+data = aoc.data.split("\n")
+actors = list()
+
+def parse_entity(x, y):
+ global actors
+ c = data[y][x]
+ if c == "#":
+ return 1
+ else:
+ if c == "G":
+ actors.append([x, y, 200, 1, len(actors), 3])
+ elif c == "E":
+ actors.append([x, y, 200, 0, len(actors), 3])
+ return 0
+
+ylen = len(data)
+xlen = len(data[0])
+
+adjacent = [[0, -1], [-1, 0], [1, 0], [0, 1]] # first in reading order
+vmap = list()
+
+def set_game():
+ global vmap, actors
+ actors = list()
+ vmap = [[parse_entity(x, y) for x in range(xlen)] for y in range(ylen)]
+
+
+def inmap(cmap, cx, cy):
+ for i in range(len(cmap)):
+ ent = cmap[i]
+ if ent[0] == cx and ent[1] == cy:
+ return i
+ return None
+
+def iswall(x,y):
+ return vmap[y][x] != 0
+
+def isblocked(x, y):
+ return (vmap[y][x] != 0 or inmap(actors, x, y) != None)
+
+def freeAdjacent(x, y):
+ poslist = list()
+ for dir in adjacent:
+ nx = x + dir[0]
+ ny = y + dir[1]
+ if not isblocked(nx, ny):
+ poslist.append((nx,ny))
+ return poslist
+
+def flatten(l):
+ flat = list()
+ for ll in l:
+ flat += ll
+ return flat
+
+def drawMap():
+ global actors
+
+ for y in range(ylen):
+ for x in range(xlen):
+ ind = inmap(actors, x, y)
+ aoc.debug(("G" if actors[ind][3] == 1 else "E") \
+ if ind != None else ("." if vmap[y][x] == 0 else "#"), end="")
+ aoc.debug()
+
+def getSteps(cmap, a1):
+ # adjacent squares
+ npos = [[a1[0] + dir[0], a1[1] + dir[1]] for dir in adjacent]
+
+ # pos of enemy and distance
+ steps = [[np[0], np[1], cmap[np[0], np[1]]] for np in npos if (np[0], np[1]) in cmap]
+
+ return steps
+
+def closestStep(a1, a2):
+ countmap = dict()
+ next = dict()
+ next[(a2[0], a2[1])] = 0
+ counter = 0
+ steps = list()
+ while len(next) > 0 and len(steps) == 0: # first steps available will be shortest
+ countmap = {**countmap, **next} # merge dictionaries
+ counter += 1
+ temp = dict()
+ for n in next:
+ for dir in adjacent:
+ nx = n[0]+dir[0]
+ ny = n[1]+dir[1]
+ if not isblocked(nx, ny) and (nx, ny) not in countmap and (nx, ny) not in temp:
+ temp[(nx,ny)] = counter
+ next = temp
+ steps = getSteps(countmap, a1)
+
+ # if reachable
+ if len(steps) != 0:
+ return sorted(steps, key = lambda x : (x[1], x[0]))[0]
+ else:
+ return [None]
+
+def move(a):
+ global actors
+
+ # best steps from enemies
+ steps = [[na[0], na[1]] + closestStep(a, na) for na in actors if na[3] != a[3]]
+
+ # only where step is possible
+ steps = [s for s in steps if s[2] != None]
+
+ # skip when none possible
+ if len(steps) == 0:
+ return
+
+ # best move
+ bestmove = sorted(steps, key = lambda x : (x[4], x[1], x[0]))[0]
+ a[0] = bestmove[2]
+ a[1] = bestmove[3]
+
+def getInrange(a):
+ global actors
+
+ inrange = list()
+ for dir in adjacent:
+ nx = a[0] + dir[0]
+ ny = a[1] + dir[1]
+ ind = inmap(actors, nx, ny)
+ if ind != None and actors[ind][3] != a[3]:
+ inrange.append(ind)
+ return inrange
+
+def next_tick(tick):
+ global actors
+
+ actors = sorted(actors, key=lambda x: (x[1], x[0]), reverse=True)
+ i = len(actors)-1
+
+ while i >= 0:
+ a = actors[i]
+ inrange = getInrange(a) # get enemies in range
+ if len(inrange) == 0:
+ move(a)
+ inrange = getInrange(a)
+
+ if len(inrange) != 0:
+ inrange = [actors[ai] + [ai] for ai in inrange]
+
+ # lowest health in reading order
+ cai = sorted(inrange, key = lambda x : (x[2], x[1], x[0]))[0][-1]
+
+ # attack player
+ actors[cai][2] -= a[5] # attack
+ if actors[cai][2] <= 0:
+ actors.pop(cai) # dead
+ aoc.debug("death -",cai)
+ if min_alive() == 0 and i != 0: # incomplete round
+ return False
+ if cai < i: i -= 1
+
+ if aoc.debug_lvl and False:
+ aoc.debug()
+ aoc.debug("small step -",a[4])
+ drawMap()
+ status_report()
+ i -= 1
+
+ if aoc.debug_lvl:
+ aoc.debug()
+ aoc.debug("tick:", tick)
+ drawMap()
+ status_report()
+ else:
+ aoc.debug(tick)
+
+ return True
+
+def min_alive():
+ alive = [0,0]
+ for a in actors:
+ alive[1 * (a[3] == 0)] += 1
+ return min(alive)
+
+def sum_hp():
+ return sum(a[2] for a in actors)
+
+def status_report():
+ global actors
+
+ sactors = sorted(actors, key = lambda x:x[4])
+ for a in sactors:
+ aoc.debug("HP:", a[2])
+ aoc.debug()
+
+def elves_alive():
+ return len([a for a in actors if a[3] == 0])
+
+def start_battle(eap):
+ global actors
+
+ set_game()
+ for a in actors:
+ if a[3] == 0:
+ a[5] = eap
+
+ elfcount = elves_alive()
+
+ ticks = 0
+ while min_alive() > 0:
+ if next_tick(ticks):
+ ticks += 1
+ status_report()
+
+ return ((sum_hp() * ticks), (elfcount - elves_alive()))
+
+def solve1(args):
+ res = start_battle(3)
+ return res[0]
+
+def solve2(args):
+ eap = 4
+ res = start_battle(eap)
+ while res[1] != 0:
+ eap += 1
+ res = start_battle(eap)
+ return res[0]
+
+aoc.run(solve1, solve2, sols=[229798, 52972])
diff --git a/src/15/test1 b/src/15/test1 new file mode 100644 index 0000000..ac399d6 --- /dev/null +++ b/src/15/test1 @@ -0,0 +1,7 @@ +####### +#G..#E# +#E#E.E# +#G.##.# +#...#E# +#...E.# +####### diff --git a/src/15/test2 b/src/15/test2 new file mode 100644 index 0000000..58f778d --- /dev/null +++ b/src/15/test2 @@ -0,0 +1,7 @@ +####### +#E..EG# +#.#G.E# +#E.##E# +#G..#.# +#..E#.# +####### diff --git a/src/15/test3 b/src/15/test3 new file mode 100644 index 0000000..6dc1c08 --- /dev/null +++ b/src/15/test3 @@ -0,0 +1,7 @@ +####### +#E.G#.# +#.#G..# +#G.#.G# +#G..#.# +#...E.# +####### diff --git a/src/15/test4 b/src/15/test4 new file mode 100644 index 0000000..2343d7b --- /dev/null +++ b/src/15/test4 @@ -0,0 +1,7 @@ +####### +#.E...# +#.#..G# +#.###.# +#E#G#G# +#...#G# +####### diff --git a/src/15/test5 b/src/15/test5 new file mode 100644 index 0000000..95882b2 --- /dev/null +++ b/src/15/test5 @@ -0,0 +1,9 @@ +######### +#G......# +#.E.#...# +#..##..G# +#...##..# +#...#...# +#.G...G.# +#.....G.# +######### diff --git a/src/15/test6 b/src/15/test6 new file mode 100644 index 0000000..291d351 --- /dev/null +++ b/src/15/test6 @@ -0,0 +1,7 @@ +####### +#.G...# +#...EG# +#.#.#G# +#..G#E# +#.....# +####### diff --git a/src/16/input b/src/16/input new file mode 100644 index 0000000..71f3ecd --- /dev/null +++ b/src/16/input @@ -0,0 +1,4148 @@ +Before: [1, 1, 0, 1]
+0 1 0 1
+After: [1, 1, 0, 1]
+
+Before: [2, 2, 2, 1]
+2 1 2 2
+After: [2, 2, 1, 1]
+
+Before: [1, 3, 2, 2]
+1 2 2 0
+After: [4, 3, 2, 2]
+
+Before: [2, 2, 1, 1]
+8 0 2 1
+After: [2, 3, 1, 1]
+
+Before: [0, 1, 2, 2]
+7 3 1 1
+After: [0, 3, 2, 2]
+
+Before: [1, 2, 2, 0]
+8 2 0 1
+After: [1, 3, 2, 0]
+
+Before: [2, 2, 2, 0]
+2 1 2 0
+After: [1, 2, 2, 0]
+
+Before: [0, 1, 1, 1]
+3 1 0 1
+After: [0, 1, 1, 1]
+
+Before: [2, 3, 2, 2]
+15 1 2 2
+After: [2, 3, 6, 2]
+
+Before: [0, 3, 1, 1]
+9 0 0 3
+After: [0, 3, 1, 0]
+
+Before: [2, 0, 1, 1]
+4 2 3 2
+After: [2, 0, 0, 1]
+
+Before: [1, 1, 3, 3]
+6 0 3 3
+After: [1, 1, 3, 0]
+
+Before: [3, 2, 3, 2]
+11 1 3 3
+After: [3, 2, 3, 1]
+
+Before: [3, 2, 1, 2]
+14 3 3 1
+After: [3, 6, 1, 2]
+
+Before: [1, 0, 1, 2]
+10 1 0 1
+After: [1, 1, 1, 2]
+
+Before: [1, 2, 0, 2]
+11 1 3 2
+After: [1, 2, 1, 2]
+
+Before: [3, 3, 0, 0]
+14 0 3 2
+After: [3, 3, 9, 0]
+
+Before: [2, 0, 2, 3]
+6 0 3 1
+After: [2, 0, 2, 3]
+
+Before: [3, 2, 2, 2]
+11 1 3 1
+After: [3, 1, 2, 2]
+
+Before: [2, 2, 0, 2]
+13 1 2 1
+After: [2, 4, 0, 2]
+
+Before: [2, 2, 2, 0]
+8 3 1 3
+After: [2, 2, 2, 2]
+
+Before: [2, 3, 1, 3]
+6 0 3 2
+After: [2, 3, 0, 3]
+
+Before: [3, 3, 1, 1]
+14 1 3 1
+After: [3, 9, 1, 1]
+
+Before: [2, 2, 1, 3]
+6 0 3 2
+After: [2, 2, 0, 3]
+
+Before: [2, 3, 2, 3]
+15 3 3 0
+After: [9, 3, 2, 3]
+
+Before: [1, 0, 0, 3]
+10 1 0 1
+After: [1, 1, 0, 3]
+
+Before: [1, 3, 1, 3]
+15 1 3 3
+After: [1, 3, 1, 9]
+
+Before: [1, 1, 2, 3]
+15 1 2 3
+After: [1, 1, 2, 2]
+
+Before: [1, 1, 3, 0]
+0 1 0 0
+After: [1, 1, 3, 0]
+
+Before: [1, 2, 3, 2]
+13 3 2 2
+After: [1, 2, 4, 2]
+
+Before: [0, 1, 1, 2]
+9 0 0 0
+After: [0, 1, 1, 2]
+
+Before: [2, 2, 0, 0]
+12 1 1 3
+After: [2, 2, 0, 1]
+
+Before: [1, 0, 2, 3]
+6 0 3 2
+After: [1, 0, 0, 3]
+
+Before: [1, 1, 0, 3]
+6 0 3 3
+After: [1, 1, 0, 0]
+
+Before: [0, 2, 0, 0]
+9 0 0 2
+After: [0, 2, 0, 0]
+
+Before: [0, 2, 2, 3]
+5 0 3 0
+After: [3, 2, 2, 3]
+
+Before: [1, 0, 2, 1]
+5 1 2 3
+After: [1, 0, 2, 2]
+
+Before: [1, 1, 3, 3]
+0 1 0 2
+After: [1, 1, 1, 3]
+
+Before: [2, 0, 3, 1]
+12 2 3 0
+After: [0, 0, 3, 1]
+
+Before: [0, 3, 2, 0]
+5 0 2 0
+After: [2, 3, 2, 0]
+
+Before: [2, 1, 2, 2]
+1 2 2 0
+After: [4, 1, 2, 2]
+
+Before: [1, 2, 1, 3]
+6 0 3 2
+After: [1, 2, 0, 3]
+
+Before: [0, 2, 3, 1]
+14 1 3 2
+After: [0, 2, 6, 1]
+
+Before: [1, 3, 3, 3]
+5 0 3 2
+After: [1, 3, 3, 3]
+
+Before: [3, 1, 0, 3]
+14 3 2 3
+After: [3, 1, 0, 6]
+
+Before: [2, 0, 3, 3]
+12 3 2 0
+After: [1, 0, 3, 3]
+
+Before: [1, 2, 1, 2]
+11 1 3 3
+After: [1, 2, 1, 1]
+
+Before: [2, 1, 2, 1]
+1 0 2 1
+After: [2, 4, 2, 1]
+
+Before: [0, 1, 1, 0]
+3 1 0 1
+After: [0, 1, 1, 0]
+
+Before: [0, 2, 3, 0]
+9 0 0 2
+After: [0, 2, 0, 0]
+
+Before: [3, 1, 2, 3]
+15 2 3 3
+After: [3, 1, 2, 6]
+
+Before: [0, 1, 0, 0]
+3 1 0 0
+After: [1, 1, 0, 0]
+
+Before: [0, 0, 1, 2]
+5 2 3 2
+After: [0, 0, 3, 2]
+
+Before: [0, 2, 2, 2]
+8 0 3 1
+After: [0, 2, 2, 2]
+
+Before: [1, 2, 0, 3]
+15 0 1 0
+After: [2, 2, 0, 3]
+
+Before: [2, 1, 0, 3]
+6 0 3 2
+After: [2, 1, 0, 3]
+
+Before: [0, 2, 3, 2]
+11 1 3 1
+After: [0, 1, 3, 2]
+
+Before: [1, 1, 2, 1]
+0 1 0 1
+After: [1, 1, 2, 1]
+
+Before: [2, 2, 2, 0]
+12 1 1 1
+After: [2, 1, 2, 0]
+
+Before: [3, 1, 2, 2]
+1 2 2 2
+After: [3, 1, 4, 2]
+
+Before: [0, 1, 3, 0]
+3 1 0 3
+After: [0, 1, 3, 1]
+
+Before: [3, 0, 2, 0]
+1 2 2 2
+After: [3, 0, 4, 0]
+
+Before: [2, 3, 3, 2]
+15 1 3 2
+After: [2, 3, 6, 2]
+
+Before: [3, 0, 2, 0]
+1 2 2 0
+After: [4, 0, 2, 0]
+
+Before: [3, 2, 3, 2]
+12 1 1 0
+After: [1, 2, 3, 2]
+
+Before: [2, 3, 3, 2]
+13 0 2 0
+After: [4, 3, 3, 2]
+
+Before: [1, 0, 2, 2]
+10 1 0 0
+After: [1, 0, 2, 2]
+
+Before: [2, 0, 0, 0]
+8 1 0 1
+After: [2, 2, 0, 0]
+
+Before: [0, 2, 2, 1]
+12 2 1 0
+After: [1, 2, 2, 1]
+
+Before: [0, 3, 2, 1]
+9 0 0 3
+After: [0, 3, 2, 0]
+
+Before: [2, 2, 2, 1]
+1 0 2 1
+After: [2, 4, 2, 1]
+
+Before: [0, 1, 2, 3]
+3 1 0 2
+After: [0, 1, 1, 3]
+
+Before: [1, 1, 0, 2]
+0 1 0 0
+After: [1, 1, 0, 2]
+
+Before: [3, 2, 1, 2]
+11 1 3 0
+After: [1, 2, 1, 2]
+
+Before: [3, 1, 3, 3]
+8 1 0 0
+After: [3, 1, 3, 3]
+
+Before: [3, 1, 2, 3]
+15 0 2 2
+After: [3, 1, 6, 3]
+
+Before: [0, 2, 2, 1]
+2 1 2 3
+After: [0, 2, 2, 1]
+
+Before: [1, 1, 0, 2]
+0 1 0 3
+After: [1, 1, 0, 1]
+
+Before: [2, 2, 3, 2]
+11 1 3 0
+After: [1, 2, 3, 2]
+
+Before: [1, 1, 3, 1]
+0 1 0 2
+After: [1, 1, 1, 1]
+
+Before: [1, 2, 3, 0]
+8 3 1 0
+After: [2, 2, 3, 0]
+
+Before: [1, 0, 2, 3]
+10 1 0 0
+After: [1, 0, 2, 3]
+
+Before: [1, 3, 3, 1]
+12 1 2 1
+After: [1, 1, 3, 1]
+
+Before: [0, 1, 2, 2]
+3 1 0 0
+After: [1, 1, 2, 2]
+
+Before: [2, 2, 2, 3]
+6 0 3 2
+After: [2, 2, 0, 3]
+
+Before: [3, 2, 3, 0]
+13 1 2 0
+After: [4, 2, 3, 0]
+
+Before: [0, 1, 0, 1]
+9 0 0 2
+After: [0, 1, 0, 1]
+
+Before: [2, 3, 3, 2]
+13 3 2 1
+After: [2, 4, 3, 2]
+
+Before: [2, 2, 1, 3]
+4 1 2 2
+After: [2, 2, 1, 3]
+
+Before: [1, 3, 0, 1]
+8 0 1 2
+After: [1, 3, 3, 1]
+
+Before: [0, 1, 2, 0]
+3 1 0 1
+After: [0, 1, 2, 0]
+
+Before: [0, 2, 0, 2]
+11 1 3 1
+After: [0, 1, 0, 2]
+
+Before: [3, 2, 3, 1]
+14 2 3 3
+After: [3, 2, 3, 9]
+
+Before: [0, 1, 1, 3]
+3 1 0 0
+After: [1, 1, 1, 3]
+
+Before: [2, 2, 2, 1]
+2 1 2 0
+After: [1, 2, 2, 1]
+
+Before: [0, 2, 1, 2]
+4 3 3 3
+After: [0, 2, 1, 0]
+
+Before: [0, 1, 1, 2]
+7 3 1 3
+After: [0, 1, 1, 3]
+
+Before: [1, 0, 1, 0]
+10 1 0 0
+After: [1, 0, 1, 0]
+
+Before: [3, 2, 2, 1]
+12 1 1 3
+After: [3, 2, 2, 1]
+
+Before: [0, 1, 0, 0]
+9 0 0 2
+After: [0, 1, 0, 0]
+
+Before: [2, 2, 2, 1]
+2 1 2 1
+After: [2, 1, 2, 1]
+
+Before: [1, 3, 0, 3]
+2 1 3 0
+After: [1, 3, 0, 3]
+
+Before: [1, 1, 2, 2]
+0 1 0 2
+After: [1, 1, 1, 2]
+
+Before: [0, 2, 0, 2]
+11 1 3 3
+After: [0, 2, 0, 1]
+
+Before: [0, 2, 3, 2]
+11 1 3 0
+After: [1, 2, 3, 2]
+
+Before: [2, 3, 2, 1]
+7 3 2 0
+After: [3, 3, 2, 1]
+
+Before: [2, 1, 1, 3]
+14 3 2 0
+After: [6, 1, 1, 3]
+
+Before: [1, 1, 3, 2]
+0 1 0 0
+After: [1, 1, 3, 2]
+
+Before: [2, 2, 2, 3]
+1 0 2 2
+After: [2, 2, 4, 3]
+
+Before: [1, 1, 0, 3]
+0 1 0 3
+After: [1, 1, 0, 1]
+
+Before: [1, 0, 3, 0]
+10 1 0 2
+After: [1, 0, 1, 0]
+
+Before: [0, 2, 0, 2]
+11 1 3 2
+After: [0, 2, 1, 2]
+
+Before: [1, 3, 2, 1]
+7 3 2 0
+After: [3, 3, 2, 1]
+
+Before: [2, 2, 1, 0]
+14 0 3 2
+After: [2, 2, 6, 0]
+
+Before: [0, 1, 0, 0]
+5 0 1 3
+After: [0, 1, 0, 1]
+
+Before: [0, 2, 2, 3]
+15 2 3 0
+After: [6, 2, 2, 3]
+
+Before: [3, 3, 0, 3]
+15 0 3 0
+After: [9, 3, 0, 3]
+
+Before: [0, 3, 3, 0]
+14 2 3 0
+After: [9, 3, 3, 0]
+
+Before: [0, 1, 1, 2]
+7 3 1 2
+After: [0, 1, 3, 2]
+
+Before: [1, 3, 1, 3]
+2 1 3 0
+After: [1, 3, 1, 3]
+
+Before: [1, 0, 3, 3]
+10 1 0 2
+After: [1, 0, 1, 3]
+
+Before: [0, 1, 3, 2]
+3 1 0 3
+After: [0, 1, 3, 1]
+
+Before: [0, 1, 3, 1]
+3 1 0 2
+After: [0, 1, 1, 1]
+
+Before: [1, 1, 2, 0]
+0 1 0 1
+After: [1, 1, 2, 0]
+
+Before: [0, 3, 0, 2]
+15 1 3 3
+After: [0, 3, 0, 6]
+
+Before: [0, 2, 1, 1]
+4 1 2 2
+After: [0, 2, 1, 1]
+
+Before: [0, 2, 2, 1]
+4 3 3 0
+After: [0, 2, 2, 1]
+
+Before: [1, 2, 1, 2]
+8 1 0 1
+After: [1, 3, 1, 2]
+
+Before: [1, 2, 2, 0]
+15 0 2 1
+After: [1, 2, 2, 0]
+
+Before: [2, 2, 3, 1]
+4 3 3 1
+After: [2, 0, 3, 1]
+
+Before: [1, 2, 1, 0]
+8 3 1 3
+After: [1, 2, 1, 2]
+
+Before: [3, 0, 2, 2]
+8 1 0 2
+After: [3, 0, 3, 2]
+
+Before: [0, 0, 2, 0]
+9 0 0 2
+After: [0, 0, 0, 0]
+
+Before: [1, 2, 2, 3]
+4 1 0 2
+After: [1, 2, 1, 3]
+
+Before: [2, 1, 2, 2]
+1 3 2 1
+After: [2, 4, 2, 2]
+
+Before: [2, 3, 0, 3]
+2 1 3 1
+After: [2, 1, 0, 3]
+
+Before: [1, 2, 0, 2]
+11 1 3 1
+After: [1, 1, 0, 2]
+
+Before: [3, 1, 0, 2]
+7 3 1 1
+After: [3, 3, 0, 2]
+
+Before: [0, 2, 2, 3]
+1 1 2 3
+After: [0, 2, 2, 4]
+
+Before: [1, 2, 3, 3]
+6 0 3 0
+After: [0, 2, 3, 3]
+
+Before: [2, 0, 2, 1]
+7 3 2 0
+After: [3, 0, 2, 1]
+
+Before: [0, 2, 2, 2]
+8 0 3 2
+After: [0, 2, 2, 2]
+
+Before: [1, 0, 3, 1]
+10 1 0 2
+After: [1, 0, 1, 1]
+
+Before: [0, 1, 2, 1]
+4 3 3 2
+After: [0, 1, 0, 1]
+
+Before: [0, 2, 2, 0]
+2 1 2 3
+After: [0, 2, 2, 1]
+
+Before: [0, 0, 2, 2]
+5 1 2 0
+After: [2, 0, 2, 2]
+
+Before: [1, 0, 0, 3]
+10 1 0 3
+After: [1, 0, 0, 1]
+
+Before: [1, 0, 3, 1]
+10 1 0 3
+After: [1, 0, 3, 1]
+
+Before: [0, 0, 3, 2]
+9 0 0 3
+After: [0, 0, 3, 0]
+
+Before: [1, 0, 1, 3]
+10 1 0 2
+After: [1, 0, 1, 3]
+
+Before: [3, 2, 3, 2]
+4 3 3 2
+After: [3, 2, 0, 2]
+
+Before: [0, 1, 1, 3]
+3 1 0 2
+After: [0, 1, 1, 3]
+
+Before: [1, 2, 3, 3]
+4 1 0 1
+After: [1, 1, 3, 3]
+
+Before: [0, 0, 0, 2]
+9 0 0 1
+After: [0, 0, 0, 2]
+
+Before: [1, 0, 2, 1]
+10 1 0 1
+After: [1, 1, 2, 1]
+
+Before: [1, 2, 3, 2]
+5 0 3 2
+After: [1, 2, 3, 2]
+
+Before: [2, 2, 3, 2]
+12 1 1 0
+After: [1, 2, 3, 2]
+
+Before: [2, 2, 2, 2]
+12 2 1 2
+After: [2, 2, 1, 2]
+
+Before: [2, 2, 2, 3]
+1 2 2 1
+After: [2, 4, 2, 3]
+
+Before: [3, 1, 3, 2]
+7 3 1 2
+After: [3, 1, 3, 2]
+
+Before: [2, 2, 0, 0]
+13 0 2 1
+After: [2, 4, 0, 0]
+
+Before: [0, 2, 1, 3]
+15 1 3 1
+After: [0, 6, 1, 3]
+
+Before: [0, 1, 1, 2]
+3 1 0 0
+After: [1, 1, 1, 2]
+
+Before: [2, 1, 0, 0]
+8 3 0 1
+After: [2, 2, 0, 0]
+
+Before: [0, 1, 3, 3]
+15 2 3 0
+After: [9, 1, 3, 3]
+
+Before: [0, 1, 1, 2]
+3 1 0 1
+After: [0, 1, 1, 2]
+
+Before: [0, 1, 1, 1]
+8 0 2 0
+After: [1, 1, 1, 1]
+
+Before: [1, 2, 2, 3]
+12 1 1 3
+After: [1, 2, 2, 1]
+
+Before: [3, 3, 1, 2]
+12 1 0 1
+After: [3, 1, 1, 2]
+
+Before: [3, 0, 0, 3]
+14 3 2 2
+After: [3, 0, 6, 3]
+
+Before: [3, 3, 3, 1]
+12 2 3 3
+After: [3, 3, 3, 0]
+
+Before: [2, 3, 2, 0]
+14 2 3 1
+After: [2, 6, 2, 0]
+
+Before: [2, 3, 0, 2]
+15 1 3 2
+After: [2, 3, 6, 2]
+
+Before: [3, 2, 3, 2]
+11 1 3 1
+After: [3, 1, 3, 2]
+
+Before: [1, 2, 2, 1]
+15 3 2 1
+After: [1, 2, 2, 1]
+
+Before: [1, 2, 2, 1]
+5 0 2 1
+After: [1, 3, 2, 1]
+
+Before: [1, 2, 3, 3]
+6 0 3 2
+After: [1, 2, 0, 3]
+
+Before: [1, 2, 2, 0]
+5 0 2 2
+After: [1, 2, 3, 0]
+
+Before: [3, 0, 0, 2]
+4 3 3 1
+After: [3, 0, 0, 2]
+
+Before: [1, 2, 1, 3]
+8 1 0 2
+After: [1, 2, 3, 3]
+
+Before: [2, 0, 2, 1]
+1 2 2 1
+After: [2, 4, 2, 1]
+
+Before: [2, 1, 2, 3]
+1 2 2 3
+After: [2, 1, 2, 4]
+
+Before: [1, 1, 0, 1]
+14 3 2 1
+After: [1, 2, 0, 1]
+
+Before: [1, 0, 2, 1]
+1 2 2 1
+After: [1, 4, 2, 1]
+
+Before: [2, 2, 0, 3]
+15 0 3 3
+After: [2, 2, 0, 6]
+
+Before: [3, 0, 2, 2]
+1 3 2 0
+After: [4, 0, 2, 2]
+
+Before: [2, 2, 3, 2]
+13 3 2 1
+After: [2, 4, 3, 2]
+
+Before: [1, 1, 2, 1]
+0 1 0 2
+After: [1, 1, 1, 1]
+
+Before: [0, 2, 3, 2]
+11 1 3 2
+After: [0, 2, 1, 2]
+
+Before: [2, 1, 1, 2]
+7 3 1 0
+After: [3, 1, 1, 2]
+
+Before: [3, 0, 2, 0]
+14 2 3 3
+After: [3, 0, 2, 6]
+
+Before: [2, 2, 0, 2]
+14 0 3 3
+After: [2, 2, 0, 6]
+
+Before: [0, 0, 3, 2]
+9 0 0 0
+After: [0, 0, 3, 2]
+
+Before: [1, 1, 3, 1]
+0 1 0 1
+After: [1, 1, 3, 1]
+
+Before: [1, 1, 1, 1]
+0 1 0 1
+After: [1, 1, 1, 1]
+
+Before: [1, 0, 2, 0]
+10 1 0 1
+After: [1, 1, 2, 0]
+
+Before: [1, 1, 0, 3]
+0 1 0 0
+After: [1, 1, 0, 3]
+
+Before: [0, 1, 0, 2]
+13 3 2 1
+After: [0, 4, 0, 2]
+
+Before: [2, 1, 0, 0]
+14 1 2 3
+After: [2, 1, 0, 2]
+
+Before: [3, 3, 2, 2]
+4 3 3 1
+After: [3, 0, 2, 2]
+
+Before: [0, 2, 0, 0]
+12 1 1 3
+After: [0, 2, 0, 1]
+
+Before: [1, 0, 2, 1]
+1 2 2 2
+After: [1, 0, 4, 1]
+
+Before: [0, 1, 2, 1]
+9 0 0 2
+After: [0, 1, 0, 1]
+
+Before: [1, 1, 3, 2]
+0 1 0 2
+After: [1, 1, 1, 2]
+
+Before: [3, 0, 3, 2]
+15 0 3 0
+After: [6, 0, 3, 2]
+
+Before: [2, 1, 2, 0]
+5 3 2 0
+After: [2, 1, 2, 0]
+
+Before: [3, 2, 2, 2]
+1 2 2 2
+After: [3, 2, 4, 2]
+
+Before: [1, 1, 0, 0]
+0 1 0 3
+After: [1, 1, 0, 1]
+
+Before: [1, 2, 0, 3]
+12 1 1 2
+After: [1, 2, 1, 3]
+
+Before: [2, 2, 2, 0]
+1 0 2 1
+After: [2, 4, 2, 0]
+
+Before: [0, 2, 1, 3]
+8 0 2 2
+After: [0, 2, 1, 3]
+
+Before: [3, 2, 0, 0]
+14 1 3 1
+After: [3, 6, 0, 0]
+
+Before: [0, 2, 2, 3]
+15 3 3 3
+After: [0, 2, 2, 9]
+
+Before: [1, 0, 3, 2]
+10 1 0 0
+After: [1, 0, 3, 2]
+
+Before: [1, 2, 2, 0]
+2 1 2 2
+After: [1, 2, 1, 0]
+
+Before: [0, 0, 3, 3]
+9 0 0 1
+After: [0, 0, 3, 3]
+
+Before: [0, 1, 2, 3]
+3 1 0 1
+After: [0, 1, 2, 3]
+
+Before: [1, 0, 1, 1]
+10 1 0 3
+After: [1, 0, 1, 1]
+
+Before: [2, 0, 2, 3]
+6 0 3 0
+After: [0, 0, 2, 3]
+
+Before: [0, 2, 3, 0]
+13 1 2 1
+After: [0, 4, 3, 0]
+
+Before: [0, 1, 3, 2]
+3 1 0 1
+After: [0, 1, 3, 2]
+
+Before: [1, 1, 0, 3]
+6 0 3 0
+After: [0, 1, 0, 3]
+
+Before: [3, 2, 0, 1]
+13 1 2 0
+After: [4, 2, 0, 1]
+
+Before: [2, 1, 3, 1]
+5 0 1 2
+After: [2, 1, 3, 1]
+
+Before: [1, 1, 3, 2]
+0 1 0 1
+After: [1, 1, 3, 2]
+
+Before: [2, 0, 0, 3]
+6 0 3 0
+After: [0, 0, 0, 3]
+
+Before: [1, 2, 1, 0]
+13 1 2 1
+After: [1, 4, 1, 0]
+
+Before: [2, 2, 1, 2]
+11 1 3 3
+After: [2, 2, 1, 1]
+
+Before: [0, 1, 2, 3]
+5 1 3 3
+After: [0, 1, 2, 3]
+
+Before: [2, 0, 3, 3]
+6 0 3 2
+After: [2, 0, 0, 3]
+
+Before: [2, 2, 1, 0]
+12 1 0 0
+After: [1, 2, 1, 0]
+
+Before: [2, 2, 2, 2]
+11 1 3 0
+After: [1, 2, 2, 2]
+
+Before: [1, 1, 0, 1]
+0 1 0 0
+After: [1, 1, 0, 1]
+
+Before: [0, 2, 2, 2]
+11 1 3 0
+After: [1, 2, 2, 2]
+
+Before: [2, 2, 0, 2]
+11 1 3 3
+After: [2, 2, 0, 1]
+
+Before: [2, 2, 2, 0]
+2 1 2 2
+After: [2, 2, 1, 0]
+
+Before: [3, 1, 1, 2]
+7 3 1 3
+After: [3, 1, 1, 3]
+
+Before: [0, 2, 1, 3]
+9 0 0 0
+After: [0, 2, 1, 3]
+
+Before: [0, 2, 2, 2]
+11 1 3 3
+After: [0, 2, 2, 1]
+
+Before: [3, 3, 3, 1]
+7 3 2 2
+After: [3, 3, 3, 1]
+
+Before: [2, 0, 3, 3]
+6 0 3 1
+After: [2, 0, 3, 3]
+
+Before: [0, 0, 2, 3]
+5 1 3 1
+After: [0, 3, 2, 3]
+
+Before: [3, 3, 2, 0]
+5 3 2 2
+After: [3, 3, 2, 0]
+
+Before: [3, 1, 2, 0]
+14 2 3 3
+After: [3, 1, 2, 6]
+
+Before: [1, 1, 2, 0]
+1 2 2 2
+After: [1, 1, 4, 0]
+
+Before: [1, 3, 1, 1]
+4 2 3 1
+After: [1, 0, 1, 1]
+
+Before: [1, 1, 2, 3]
+0 1 0 1
+After: [1, 1, 2, 3]
+
+Before: [3, 3, 3, 2]
+15 2 3 0
+After: [6, 3, 3, 2]
+
+Before: [1, 1, 0, 1]
+0 1 0 3
+After: [1, 1, 0, 1]
+
+Before: [2, 1, 1, 1]
+13 0 2 1
+After: [2, 4, 1, 1]
+
+Before: [3, 3, 2, 1]
+1 2 2 1
+After: [3, 4, 2, 1]
+
+Before: [0, 2, 2, 3]
+2 1 2 3
+After: [0, 2, 2, 1]
+
+Before: [2, 0, 1, 3]
+6 0 3 2
+After: [2, 0, 0, 3]
+
+Before: [1, 3, 3, 3]
+6 0 3 2
+After: [1, 3, 0, 3]
+
+Before: [0, 1, 0, 2]
+7 3 1 3
+After: [0, 1, 0, 3]
+
+Before: [0, 2, 2, 1]
+12 2 1 2
+After: [0, 2, 1, 1]
+
+Before: [1, 3, 2, 3]
+6 0 3 1
+After: [1, 0, 2, 3]
+
+Before: [1, 3, 1, 3]
+15 1 3 2
+After: [1, 3, 9, 3]
+
+Before: [0, 3, 2, 2]
+1 2 2 1
+After: [0, 4, 2, 2]
+
+Before: [3, 3, 2, 3]
+2 1 3 2
+After: [3, 3, 1, 3]
+
+Before: [0, 0, 2, 3]
+5 0 2 0
+After: [2, 0, 2, 3]
+
+Before: [3, 0, 2, 3]
+15 2 3 0
+After: [6, 0, 2, 3]
+
+Before: [2, 3, 0, 3]
+14 3 2 1
+After: [2, 6, 0, 3]
+
+Before: [2, 0, 2, 1]
+1 0 2 2
+After: [2, 0, 4, 1]
+
+Before: [0, 1, 3, 1]
+9 0 0 2
+After: [0, 1, 0, 1]
+
+Before: [1, 2, 2, 2]
+2 1 2 3
+After: [1, 2, 2, 1]
+
+Before: [0, 0, 3, 1]
+9 0 0 0
+After: [0, 0, 3, 1]
+
+Before: [0, 1, 3, 3]
+3 1 0 2
+After: [0, 1, 1, 3]
+
+Before: [2, 1, 2, 3]
+12 2 0 0
+After: [1, 1, 2, 3]
+
+Before: [1, 2, 3, 2]
+11 1 3 2
+After: [1, 2, 1, 2]
+
+Before: [3, 2, 0, 2]
+11 1 3 3
+After: [3, 2, 0, 1]
+
+Before: [2, 1, 2, 2]
+12 2 0 1
+After: [2, 1, 2, 2]
+
+Before: [0, 1, 0, 2]
+13 3 2 2
+After: [0, 1, 4, 2]
+
+Before: [0, 1, 1, 0]
+9 0 0 3
+After: [0, 1, 1, 0]
+
+Before: [2, 1, 1, 3]
+5 1 3 1
+After: [2, 3, 1, 3]
+
+Before: [0, 2, 2, 2]
+1 2 2 1
+After: [0, 4, 2, 2]
+
+Before: [0, 1, 1, 2]
+5 0 1 2
+After: [0, 1, 1, 2]
+
+Before: [1, 1, 1, 2]
+0 1 0 1
+After: [1, 1, 1, 2]
+
+Before: [3, 3, 1, 2]
+12 1 0 0
+After: [1, 3, 1, 2]
+
+Before: [3, 2, 1, 0]
+14 0 3 0
+After: [9, 2, 1, 0]
+
+Before: [2, 2, 1, 1]
+15 3 1 0
+After: [2, 2, 1, 1]
+
+Before: [1, 3, 2, 1]
+7 3 2 2
+After: [1, 3, 3, 1]
+
+Before: [0, 2, 0, 0]
+9 0 0 3
+After: [0, 2, 0, 0]
+
+Before: [1, 2, 1, 3]
+4 1 0 1
+After: [1, 1, 1, 3]
+
+Before: [1, 1, 3, 2]
+15 2 3 1
+After: [1, 6, 3, 2]
+
+Before: [2, 3, 3, 1]
+7 3 2 0
+After: [3, 3, 3, 1]
+
+Before: [0, 1, 2, 2]
+5 0 1 0
+After: [1, 1, 2, 2]
+
+Before: [3, 1, 0, 2]
+7 3 1 0
+After: [3, 1, 0, 2]
+
+Before: [1, 3, 3, 3]
+15 2 3 3
+After: [1, 3, 3, 9]
+
+Before: [3, 2, 2, 3]
+15 3 3 1
+After: [3, 9, 2, 3]
+
+Before: [0, 0, 0, 2]
+9 0 0 2
+After: [0, 0, 0, 2]
+
+Before: [2, 1, 3, 0]
+5 1 2 3
+After: [2, 1, 3, 3]
+
+Before: [3, 0, 2, 1]
+1 2 2 0
+After: [4, 0, 2, 1]
+
+Before: [1, 0, 2, 3]
+10 1 0 3
+After: [1, 0, 2, 1]
+
+Before: [0, 3, 1, 2]
+14 3 3 2
+After: [0, 3, 6, 2]
+
+Before: [0, 3, 3, 3]
+2 1 3 2
+After: [0, 3, 1, 3]
+
+Before: [0, 2, 2, 0]
+5 3 2 3
+After: [0, 2, 2, 2]
+
+Before: [1, 1, 2, 1]
+5 2 1 0
+After: [3, 1, 2, 1]
+
+Before: [1, 2, 0, 2]
+11 1 3 3
+After: [1, 2, 0, 1]
+
+Before: [3, 0, 2, 1]
+7 3 2 3
+After: [3, 0, 2, 3]
+
+Before: [0, 2, 1, 3]
+9 0 0 2
+After: [0, 2, 0, 3]
+
+Before: [2, 2, 2, 2]
+11 1 3 3
+After: [2, 2, 2, 1]
+
+Before: [1, 3, 2, 3]
+1 2 2 0
+After: [4, 3, 2, 3]
+
+Before: [1, 3, 1, 3]
+2 1 3 2
+After: [1, 3, 1, 3]
+
+Before: [0, 1, 2, 3]
+5 0 3 1
+After: [0, 3, 2, 3]
+
+Before: [2, 2, 1, 2]
+11 1 3 1
+After: [2, 1, 1, 2]
+
+Before: [1, 0, 3, 1]
+7 3 2 0
+After: [3, 0, 3, 1]
+
+Before: [1, 2, 1, 3]
+6 0 3 0
+After: [0, 2, 1, 3]
+
+Before: [3, 2, 2, 2]
+2 1 2 0
+After: [1, 2, 2, 2]
+
+Before: [3, 0, 0, 3]
+5 1 3 0
+After: [3, 0, 0, 3]
+
+Before: [2, 3, 3, 3]
+6 0 3 2
+After: [2, 3, 0, 3]
+
+Before: [1, 2, 3, 2]
+11 1 3 0
+After: [1, 2, 3, 2]
+
+Before: [2, 3, 3, 3]
+6 0 3 1
+After: [2, 0, 3, 3]
+
+Before: [2, 1, 0, 3]
+6 0 3 0
+After: [0, 1, 0, 3]
+
+Before: [3, 2, 3, 1]
+4 3 3 1
+After: [3, 0, 3, 1]
+
+Before: [1, 2, 2, 3]
+1 2 2 1
+After: [1, 4, 2, 3]
+
+Before: [0, 2, 0, 2]
+12 1 1 2
+After: [0, 2, 1, 2]
+
+Before: [3, 3, 1, 3]
+2 1 3 3
+After: [3, 3, 1, 1]
+
+Before: [1, 1, 2, 2]
+5 1 2 2
+After: [1, 1, 3, 2]
+
+Before: [0, 0, 2, 2]
+5 0 2 3
+After: [0, 0, 2, 2]
+
+Before: [0, 1, 3, 1]
+9 0 0 0
+After: [0, 1, 3, 1]
+
+Before: [0, 1, 0, 0]
+3 1 0 1
+After: [0, 1, 0, 0]
+
+Before: [1, 0, 0, 1]
+10 1 0 1
+After: [1, 1, 0, 1]
+
+Before: [1, 1, 1, 3]
+0 1 0 0
+After: [1, 1, 1, 3]
+
+Before: [0, 2, 2, 2]
+4 3 3 1
+After: [0, 0, 2, 2]
+
+Before: [1, 2, 1, 0]
+8 2 1 0
+After: [3, 2, 1, 0]
+
+Before: [0, 1, 2, 1]
+3 1 0 3
+After: [0, 1, 2, 1]
+
+Before: [1, 0, 2, 1]
+10 1 0 3
+After: [1, 0, 2, 1]
+
+Before: [1, 1, 3, 1]
+5 0 2 1
+After: [1, 3, 3, 1]
+
+Before: [2, 3, 2, 1]
+4 3 3 2
+After: [2, 3, 0, 1]
+
+Before: [3, 3, 0, 3]
+12 1 0 1
+After: [3, 1, 0, 3]
+
+Before: [3, 3, 1, 3]
+8 2 0 3
+After: [3, 3, 1, 3]
+
+Before: [1, 3, 3, 1]
+7 3 2 2
+After: [1, 3, 3, 1]
+
+Before: [3, 0, 3, 1]
+4 3 3 0
+After: [0, 0, 3, 1]
+
+Before: [1, 3, 2, 3]
+15 3 2 3
+After: [1, 3, 2, 6]
+
+Before: [3, 2, 2, 0]
+2 1 2 2
+After: [3, 2, 1, 0]
+
+Before: [3, 1, 2, 1]
+4 3 3 1
+After: [3, 0, 2, 1]
+
+Before: [2, 3, 1, 3]
+2 1 3 3
+After: [2, 3, 1, 1]
+
+Before: [2, 2, 0, 3]
+6 0 3 1
+After: [2, 0, 0, 3]
+
+Before: [2, 3, 2, 2]
+1 0 2 0
+After: [4, 3, 2, 2]
+
+Before: [0, 1, 3, 3]
+5 0 3 3
+After: [0, 1, 3, 3]
+
+Before: [2, 0, 3, 3]
+12 3 2 2
+After: [2, 0, 1, 3]
+
+Before: [1, 1, 3, 2]
+13 3 2 2
+After: [1, 1, 4, 2]
+
+Before: [1, 3, 3, 3]
+2 1 3 2
+After: [1, 3, 1, 3]
+
+Before: [3, 2, 2, 2]
+14 0 3 1
+After: [3, 9, 2, 2]
+
+Before: [1, 0, 3, 2]
+8 1 3 2
+After: [1, 0, 2, 2]
+
+Before: [0, 3, 3, 3]
+9 0 0 2
+After: [0, 3, 0, 3]
+
+Before: [3, 2, 0, 1]
+4 3 3 0
+After: [0, 2, 0, 1]
+
+Before: [3, 0, 3, 2]
+4 3 3 0
+After: [0, 0, 3, 2]
+
+Before: [3, 0, 3, 2]
+8 1 2 1
+After: [3, 3, 3, 2]
+
+Before: [0, 2, 1, 1]
+8 0 3 0
+After: [1, 2, 1, 1]
+
+Before: [2, 2, 2, 0]
+1 1 2 1
+After: [2, 4, 2, 0]
+
+Before: [2, 2, 1, 3]
+13 0 2 1
+After: [2, 4, 1, 3]
+
+Before: [0, 1, 3, 1]
+3 1 0 0
+After: [1, 1, 3, 1]
+
+Before: [0, 1, 2, 2]
+3 1 0 3
+After: [0, 1, 2, 1]
+
+Before: [1, 2, 2, 3]
+6 0 3 1
+After: [1, 0, 2, 3]
+
+Before: [3, 2, 0, 3]
+12 1 1 2
+After: [3, 2, 1, 3]
+
+Before: [2, 3, 1, 1]
+13 0 2 0
+After: [4, 3, 1, 1]
+
+Before: [2, 1, 1, 0]
+5 0 1 1
+After: [2, 3, 1, 0]
+
+Before: [3, 3, 2, 3]
+15 3 2 3
+After: [3, 3, 2, 6]
+
+Before: [0, 1, 0, 3]
+3 1 0 3
+After: [0, 1, 0, 1]
+
+Before: [1, 0, 3, 2]
+14 2 3 1
+After: [1, 9, 3, 2]
+
+Before: [0, 2, 3, 1]
+7 3 2 0
+After: [3, 2, 3, 1]
+
+Before: [2, 3, 0, 2]
+14 1 2 2
+After: [2, 3, 6, 2]
+
+Before: [2, 2, 3, 1]
+7 3 2 0
+After: [3, 2, 3, 1]
+
+Before: [0, 3, 3, 3]
+12 3 2 2
+After: [0, 3, 1, 3]
+
+Before: [0, 2, 2, 2]
+9 0 0 2
+After: [0, 2, 0, 2]
+
+Before: [0, 3, 1, 0]
+8 0 1 2
+After: [0, 3, 3, 0]
+
+Before: [0, 3, 3, 0]
+9 0 0 0
+After: [0, 3, 3, 0]
+
+Before: [0, 3, 0, 3]
+15 3 3 1
+After: [0, 9, 0, 3]
+
+Before: [2, 1, 1, 3]
+6 0 3 2
+After: [2, 1, 0, 3]
+
+Before: [2, 0, 0, 3]
+15 3 3 1
+After: [2, 9, 0, 3]
+
+Before: [0, 1, 0, 3]
+5 0 3 2
+After: [0, 1, 3, 3]
+
+Before: [1, 2, 2, 1]
+4 1 0 0
+After: [1, 2, 2, 1]
+
+Before: [0, 2, 3, 2]
+15 2 3 0
+After: [6, 2, 3, 2]
+
+Before: [0, 2, 2, 3]
+9 0 0 1
+After: [0, 0, 2, 3]
+
+Before: [3, 3, 3, 3]
+2 1 3 1
+After: [3, 1, 3, 3]
+
+Before: [1, 0, 2, 3]
+10 1 0 1
+After: [1, 1, 2, 3]
+
+Before: [2, 1, 1, 3]
+6 0 3 1
+After: [2, 0, 1, 3]
+
+Before: [0, 2, 2, 3]
+1 2 2 1
+After: [0, 4, 2, 3]
+
+Before: [1, 1, 1, 1]
+0 1 0 2
+After: [1, 1, 1, 1]
+
+Before: [0, 0, 2, 0]
+1 2 2 1
+After: [0, 4, 2, 0]
+
+Before: [1, 3, 0, 2]
+13 3 2 3
+After: [1, 3, 0, 4]
+
+Before: [1, 1, 0, 0]
+0 1 0 2
+After: [1, 1, 1, 0]
+
+Before: [1, 1, 1, 3]
+0 1 0 2
+After: [1, 1, 1, 3]
+
+Before: [1, 0, 3, 1]
+10 1 0 0
+After: [1, 0, 3, 1]
+
+Before: [2, 2, 1, 2]
+11 1 3 0
+After: [1, 2, 1, 2]
+
+Before: [0, 1, 0, 1]
+9 0 0 3
+After: [0, 1, 0, 0]
+
+Before: [0, 2, 1, 3]
+5 2 3 2
+After: [0, 2, 3, 3]
+
+Before: [1, 2, 2, 0]
+1 1 2 3
+After: [1, 2, 2, 4]
+
+Before: [1, 1, 0, 1]
+0 1 0 2
+After: [1, 1, 1, 1]
+
+Before: [0, 1, 2, 3]
+3 1 0 0
+After: [1, 1, 2, 3]
+
+Before: [0, 0, 2, 1]
+14 2 3 1
+After: [0, 6, 2, 1]
+
+Before: [2, 1, 2, 2]
+7 3 1 3
+After: [2, 1, 2, 3]
+
+Before: [1, 3, 3, 2]
+12 1 2 0
+After: [1, 3, 3, 2]
+
+Before: [3, 2, 2, 3]
+1 2 2 2
+After: [3, 2, 4, 3]
+
+Before: [0, 3, 2, 1]
+8 0 3 2
+After: [0, 3, 1, 1]
+
+Before: [1, 1, 0, 3]
+0 1 0 2
+After: [1, 1, 1, 3]
+
+Before: [3, 2, 1, 2]
+11 1 3 2
+After: [3, 2, 1, 2]
+
+Before: [0, 2, 1, 2]
+11 1 3 1
+After: [0, 1, 1, 2]
+
+Before: [1, 2, 1, 3]
+6 0 3 1
+After: [1, 0, 1, 3]
+
+Before: [2, 2, 2, 3]
+2 1 2 2
+After: [2, 2, 1, 3]
+
+Before: [3, 2, 2, 1]
+1 1 2 1
+After: [3, 4, 2, 1]
+
+Before: [1, 0, 0, 1]
+10 1 0 3
+After: [1, 0, 0, 1]
+
+Before: [0, 1, 0, 1]
+3 1 0 3
+After: [0, 1, 0, 1]
+
+Before: [1, 1, 1, 0]
+0 1 0 3
+After: [1, 1, 1, 1]
+
+Before: [1, 1, 1, 2]
+7 3 1 3
+After: [1, 1, 1, 3]
+
+Before: [3, 3, 1, 3]
+2 1 3 0
+After: [1, 3, 1, 3]
+
+Before: [1, 0, 0, 2]
+10 1 0 0
+After: [1, 0, 0, 2]
+
+Before: [0, 2, 1, 3]
+13 1 2 3
+After: [0, 2, 1, 4]
+
+Before: [1, 0, 2, 0]
+10 1 0 3
+After: [1, 0, 2, 1]
+
+Before: [2, 3, 3, 0]
+13 0 2 3
+After: [2, 3, 3, 4]
+
+Before: [3, 1, 2, 3]
+5 1 3 3
+After: [3, 1, 2, 3]
+
+Before: [1, 1, 1, 3]
+0 1 0 1
+After: [1, 1, 1, 3]
+
+Before: [2, 1, 2, 1]
+7 3 2 3
+After: [2, 1, 2, 3]
+
+Before: [1, 0, 0, 0]
+10 1 0 0
+After: [1, 0, 0, 0]
+
+Before: [1, 1, 0, 2]
+0 1 0 1
+After: [1, 1, 0, 2]
+
+Before: [3, 1, 2, 2]
+1 2 2 0
+After: [4, 1, 2, 2]
+
+Before: [1, 1, 1, 2]
+0 1 0 3
+After: [1, 1, 1, 1]
+
+Before: [1, 2, 3, 2]
+11 1 3 1
+After: [1, 1, 3, 2]
+
+Before: [3, 0, 2, 1]
+1 2 2 3
+After: [3, 0, 2, 4]
+
+Before: [0, 1, 0, 2]
+3 1 0 1
+After: [0, 1, 0, 2]
+
+Before: [1, 0, 3, 3]
+10 1 0 3
+After: [1, 0, 3, 1]
+
+Before: [1, 3, 1, 2]
+5 0 3 2
+After: [1, 3, 3, 2]
+
+Before: [1, 0, 0, 2]
+10 1 0 2
+After: [1, 0, 1, 2]
+
+Before: [1, 1, 1, 3]
+6 0 3 3
+After: [1, 1, 1, 0]
+
+Before: [1, 2, 0, 2]
+11 1 3 0
+After: [1, 2, 0, 2]
+
+Before: [1, 2, 1, 2]
+11 1 3 1
+After: [1, 1, 1, 2]
+
+Before: [0, 0, 2, 0]
+9 0 0 3
+After: [0, 0, 2, 0]
+
+Before: [3, 2, 2, 2]
+1 3 2 2
+After: [3, 2, 4, 2]
+
+Before: [0, 1, 3, 2]
+3 1 0 2
+After: [0, 1, 1, 2]
+
+Before: [2, 2, 1, 2]
+11 1 3 2
+After: [2, 2, 1, 2]
+
+Before: [1, 3, 0, 2]
+13 3 2 0
+After: [4, 3, 0, 2]
+
+Before: [2, 1, 2, 3]
+6 0 3 2
+After: [2, 1, 0, 3]
+
+Before: [0, 2, 1, 2]
+11 1 3 2
+After: [0, 2, 1, 2]
+
+Before: [2, 2, 2, 2]
+2 1 2 1
+After: [2, 1, 2, 2]
+
+Before: [3, 0, 2, 2]
+1 2 2 3
+After: [3, 0, 2, 4]
+
+Before: [0, 0, 3, 2]
+13 3 2 0
+After: [4, 0, 3, 2]
+
+Before: [1, 2, 1, 1]
+4 1 0 1
+After: [1, 1, 1, 1]
+
+Before: [1, 0, 2, 1]
+10 1 0 0
+After: [1, 0, 2, 1]
+
+Before: [2, 0, 2, 3]
+6 0 3 3
+After: [2, 0, 2, 0]
+
+Before: [1, 2, 3, 1]
+4 3 3 3
+After: [1, 2, 3, 0]
+
+Before: [1, 1, 1, 2]
+5 2 3 2
+After: [1, 1, 3, 2]
+
+Before: [1, 2, 3, 0]
+14 1 3 1
+After: [1, 6, 3, 0]
+
+Before: [0, 0, 1, 3]
+5 2 3 0
+After: [3, 0, 1, 3]
+
+Before: [0, 0, 0, 1]
+9 0 0 0
+After: [0, 0, 0, 1]
+
+Before: [2, 1, 3, 1]
+5 0 1 3
+After: [2, 1, 3, 3]
+
+Before: [2, 1, 2, 3]
+6 0 3 3
+After: [2, 1, 2, 0]
+
+Before: [2, 3, 1, 3]
+2 1 3 1
+After: [2, 1, 1, 3]
+
+Before: [1, 2, 1, 2]
+4 3 3 3
+After: [1, 2, 1, 0]
+
+Before: [2, 2, 3, 2]
+11 1 3 1
+After: [2, 1, 3, 2]
+
+Before: [2, 3, 3, 3]
+13 0 2 1
+After: [2, 4, 3, 3]
+
+Before: [1, 3, 2, 3]
+6 0 3 2
+After: [1, 3, 0, 3]
+
+Before: [2, 2, 1, 1]
+4 1 2 0
+After: [1, 2, 1, 1]
+
+Before: [1, 0, 3, 3]
+5 1 3 2
+After: [1, 0, 3, 3]
+
+Before: [3, 3, 2, 1]
+7 3 2 1
+After: [3, 3, 2, 1]
+
+Before: [1, 0, 2, 2]
+10 1 0 1
+After: [1, 1, 2, 2]
+
+Before: [2, 1, 1, 3]
+13 0 2 0
+After: [4, 1, 1, 3]
+
+Before: [1, 1, 0, 0]
+0 1 0 0
+After: [1, 1, 0, 0]
+
+Before: [2, 2, 2, 0]
+2 1 2 1
+After: [2, 1, 2, 0]
+
+Before: [0, 1, 1, 0]
+3 1 0 2
+After: [0, 1, 1, 0]
+
+Before: [1, 1, 2, 2]
+1 3 2 3
+After: [1, 1, 2, 4]
+
+Before: [2, 2, 1, 2]
+13 3 2 0
+After: [4, 2, 1, 2]
+
+Before: [0, 1, 0, 0]
+9 0 0 1
+After: [0, 0, 0, 0]
+
+Before: [1, 3, 1, 1]
+14 1 2 2
+After: [1, 3, 6, 1]
+
+Before: [1, 3, 0, 3]
+6 0 3 1
+After: [1, 0, 0, 3]
+
+Before: [1, 2, 2, 2]
+11 1 3 1
+After: [1, 1, 2, 2]
+
+Before: [1, 2, 0, 1]
+12 1 1 2
+After: [1, 2, 1, 1]
+
+Before: [3, 3, 2, 2]
+4 3 3 0
+After: [0, 3, 2, 2]
+
+Before: [0, 0, 0, 2]
+4 3 3 3
+After: [0, 0, 0, 0]
+
+Before: [1, 1, 2, 0]
+0 1 0 2
+After: [1, 1, 1, 0]
+
+Before: [3, 0, 2, 1]
+7 3 2 2
+After: [3, 0, 3, 1]
+
+Before: [3, 1, 2, 1]
+7 3 2 1
+After: [3, 3, 2, 1]
+
+Before: [0, 0, 2, 2]
+1 3 2 2
+After: [0, 0, 4, 2]
+
+Before: [0, 1, 3, 1]
+3 1 0 3
+After: [0, 1, 3, 1]
+
+Before: [1, 3, 2, 2]
+14 3 3 3
+After: [1, 3, 2, 6]
+
+Before: [1, 3, 3, 0]
+8 0 1 0
+After: [3, 3, 3, 0]
+
+Before: [1, 3, 2, 3]
+1 2 2 1
+After: [1, 4, 2, 3]
+
+Before: [0, 1, 3, 2]
+7 3 1 3
+After: [0, 1, 3, 3]
+
+Before: [3, 3, 2, 2]
+15 1 2 2
+After: [3, 3, 6, 2]
+
+Before: [0, 3, 3, 1]
+7 3 2 3
+After: [0, 3, 3, 3]
+
+Before: [2, 3, 3, 3]
+2 1 3 1
+After: [2, 1, 3, 3]
+
+Before: [1, 1, 3, 1]
+14 0 2 2
+After: [1, 1, 2, 1]
+
+Before: [2, 1, 0, 3]
+8 1 0 2
+After: [2, 1, 3, 3]
+
+Before: [1, 2, 2, 0]
+2 1 2 0
+After: [1, 2, 2, 0]
+
+Before: [1, 0, 0, 0]
+10 1 0 2
+After: [1, 0, 1, 0]
+
+Before: [1, 3, 3, 3]
+2 1 3 3
+After: [1, 3, 3, 1]
+
+Before: [0, 2, 2, 1]
+1 1 2 3
+After: [0, 2, 2, 4]
+
+Before: [1, 2, 2, 3]
+6 0 3 3
+After: [1, 2, 2, 0]
+
+Before: [3, 2, 0, 2]
+11 1 3 2
+After: [3, 2, 1, 2]
+
+Before: [2, 2, 2, 2]
+1 2 2 0
+After: [4, 2, 2, 2]
+
+Before: [1, 0, 0, 1]
+4 3 3 1
+After: [1, 0, 0, 1]
+
+Before: [3, 1, 1, 2]
+4 3 3 1
+After: [3, 0, 1, 2]
+
+Before: [1, 1, 2, 3]
+6 0 3 3
+After: [1, 1, 2, 0]
+
+Before: [0, 3, 1, 3]
+9 0 0 2
+After: [0, 3, 0, 3]
+
+Before: [1, 3, 0, 0]
+8 2 1 0
+After: [3, 3, 0, 0]
+
+Before: [3, 2, 0, 2]
+13 1 2 3
+After: [3, 2, 0, 4]
+
+Before: [0, 0, 1, 2]
+13 3 2 2
+After: [0, 0, 4, 2]
+
+Before: [0, 2, 0, 2]
+11 1 3 0
+After: [1, 2, 0, 2]
+
+Before: [0, 3, 1, 3]
+9 0 0 3
+After: [0, 3, 1, 0]
+
+Before: [2, 2, 0, 2]
+11 1 3 0
+After: [1, 2, 0, 2]
+
+Before: [0, 3, 1, 2]
+8 2 1 0
+After: [3, 3, 1, 2]
+
+Before: [0, 3, 2, 2]
+9 0 0 2
+After: [0, 3, 0, 2]
+
+Before: [3, 2, 0, 2]
+13 1 2 2
+After: [3, 2, 4, 2]
+
+Before: [0, 3, 1, 1]
+14 1 3 2
+After: [0, 3, 9, 1]
+
+Before: [2, 0, 2, 0]
+1 0 2 1
+After: [2, 4, 2, 0]
+
+Before: [3, 2, 3, 2]
+11 1 3 0
+After: [1, 2, 3, 2]
+
+Before: [0, 0, 3, 1]
+7 3 2 0
+After: [3, 0, 3, 1]
+
+Before: [2, 2, 0, 2]
+12 1 1 2
+After: [2, 2, 1, 2]
+
+Before: [0, 3, 2, 1]
+8 0 1 0
+After: [3, 3, 2, 1]
+
+Before: [2, 0, 3, 1]
+7 3 2 0
+After: [3, 0, 3, 1]
+
+Before: [0, 0, 1, 2]
+8 0 3 2
+After: [0, 0, 2, 2]
+
+Before: [1, 1, 3, 0]
+0 1 0 3
+After: [1, 1, 3, 1]
+
+Before: [1, 2, 0, 3]
+4 1 0 1
+After: [1, 1, 0, 3]
+
+Before: [1, 1, 2, 1]
+0 1 0 0
+After: [1, 1, 2, 1]
+
+Before: [2, 3, 2, 3]
+6 0 3 3
+After: [2, 3, 2, 0]
+
+Before: [2, 1, 3, 2]
+7 3 1 3
+After: [2, 1, 3, 3]
+
+Before: [1, 0, 0, 2]
+4 3 3 2
+After: [1, 0, 0, 2]
+
+Before: [0, 0, 1, 1]
+4 2 3 2
+After: [0, 0, 0, 1]
+
+Before: [1, 1, 0, 2]
+0 1 0 2
+After: [1, 1, 1, 2]
+
+Before: [0, 1, 0, 2]
+3 1 0 2
+After: [0, 1, 1, 2]
+
+Before: [2, 2, 0, 1]
+13 0 2 0
+After: [4, 2, 0, 1]
+
+Before: [2, 2, 0, 3]
+6 0 3 3
+After: [2, 2, 0, 0]
+
+Before: [0, 2, 0, 2]
+13 3 2 0
+After: [4, 2, 0, 2]
+
+Before: [2, 2, 2, 2]
+1 0 2 3
+After: [2, 2, 2, 4]
+
+Before: [1, 2, 2, 3]
+2 1 2 3
+After: [1, 2, 2, 1]
+
+Before: [1, 2, 0, 0]
+15 0 1 3
+After: [1, 2, 0, 2]
+
+Before: [2, 2, 0, 2]
+11 1 3 1
+After: [2, 1, 0, 2]
+
+Before: [1, 0, 2, 3]
+5 0 2 0
+After: [3, 0, 2, 3]
+
+Before: [1, 0, 0, 1]
+10 1 0 2
+After: [1, 0, 1, 1]
+
+Before: [3, 1, 1, 1]
+14 0 3 2
+After: [3, 1, 9, 1]
+
+Before: [0, 1, 3, 3]
+3 1 0 3
+After: [0, 1, 3, 1]
+
+Before: [2, 1, 2, 2]
+1 0 2 2
+After: [2, 1, 4, 2]
+
+Before: [0, 2, 2, 1]
+12 1 1 0
+After: [1, 2, 2, 1]
+
+Before: [1, 2, 1, 2]
+11 1 3 2
+After: [1, 2, 1, 2]
+
+Before: [0, 1, 2, 2]
+3 1 0 1
+After: [0, 1, 2, 2]
+
+Before: [2, 2, 3, 2]
+11 1 3 3
+After: [2, 2, 3, 1]
+
+Before: [0, 2, 1, 2]
+12 1 1 1
+After: [0, 1, 1, 2]
+
+Before: [2, 1, 1, 3]
+6 0 3 0
+After: [0, 1, 1, 3]
+
+Before: [1, 2, 1, 3]
+8 0 1 3
+After: [1, 2, 1, 3]
+
+Before: [0, 3, 0, 2]
+9 0 0 3
+After: [0, 3, 0, 0]
+
+Before: [0, 2, 2, 2]
+11 1 3 1
+After: [0, 1, 2, 2]
+
+Before: [0, 1, 0, 2]
+3 1 0 0
+After: [1, 1, 0, 2]
+
+Before: [2, 0, 1, 2]
+13 0 2 2
+After: [2, 0, 4, 2]
+
+Before: [1, 0, 0, 2]
+10 1 0 3
+After: [1, 0, 0, 1]
+
+Before: [3, 1, 3, 2]
+14 0 3 3
+After: [3, 1, 3, 9]
+
+Before: [2, 2, 2, 3]
+15 2 3 0
+After: [6, 2, 2, 3]
+
+Before: [1, 0, 1, 0]
+10 1 0 2
+After: [1, 0, 1, 0]
+
+Before: [0, 2, 1, 0]
+9 0 0 3
+After: [0, 2, 1, 0]
+
+Before: [1, 2, 2, 2]
+11 1 3 0
+After: [1, 2, 2, 2]
+
+Before: [1, 2, 3, 1]
+15 3 1 0
+After: [2, 2, 3, 1]
+
+Before: [0, 0, 3, 1]
+8 0 2 2
+After: [0, 0, 3, 1]
+
+Before: [2, 0, 2, 1]
+14 0 3 1
+After: [2, 6, 2, 1]
+
+Before: [0, 0, 2, 3]
+15 2 3 1
+After: [0, 6, 2, 3]
+
+Before: [1, 2, 2, 0]
+12 1 1 2
+After: [1, 2, 1, 0]
+
+Before: [2, 2, 3, 0]
+12 1 0 2
+After: [2, 2, 1, 0]
+
+Before: [3, 2, 0, 2]
+11 1 3 1
+After: [3, 1, 0, 2]
+
+Before: [2, 2, 2, 3]
+6 0 3 3
+After: [2, 2, 2, 0]
+
+Before: [0, 1, 0, 0]
+3 1 0 2
+After: [0, 1, 1, 0]
+
+Before: [0, 1, 1, 3]
+3 1 0 3
+After: [0, 1, 1, 1]
+
+Before: [2, 0, 0, 3]
+6 0 3 1
+After: [2, 0, 0, 3]
+
+Before: [3, 1, 0, 0]
+8 1 0 0
+After: [3, 1, 0, 0]
+
+Before: [0, 1, 2, 1]
+3 1 0 1
+After: [0, 1, 2, 1]
+
+Before: [1, 0, 1, 0]
+10 1 0 3
+After: [1, 0, 1, 1]
+
+Before: [0, 0, 3, 1]
+12 2 3 3
+After: [0, 0, 3, 0]
+
+Before: [0, 1, 0, 1]
+4 3 3 2
+After: [0, 1, 0, 1]
+
+Before: [1, 0, 2, 1]
+7 3 2 2
+After: [1, 0, 3, 1]
+
+Before: [1, 1, 2, 2]
+15 0 2 0
+After: [2, 1, 2, 2]
+
+Before: [3, 3, 0, 3]
+2 1 3 2
+After: [3, 3, 1, 3]
+
+Before: [1, 0, 3, 3]
+10 1 0 0
+After: [1, 0, 3, 3]
+
+Before: [1, 3, 2, 1]
+14 2 3 2
+After: [1, 3, 6, 1]
+
+Before: [0, 1, 1, 1]
+3 1 0 0
+After: [1, 1, 1, 1]
+
+Before: [3, 3, 0, 1]
+4 3 3 3
+After: [3, 3, 0, 0]
+
+Before: [3, 3, 2, 1]
+7 3 2 2
+After: [3, 3, 3, 1]
+
+Before: [3, 2, 2, 1]
+2 1 2 3
+After: [3, 2, 2, 1]
+
+Before: [1, 1, 1, 3]
+6 0 3 0
+After: [0, 1, 1, 3]
+
+Before: [3, 0, 2, 3]
+5 1 3 3
+After: [3, 0, 2, 3]
+
+Before: [2, 2, 3, 3]
+15 1 3 2
+After: [2, 2, 6, 3]
+
+Before: [1, 2, 1, 2]
+8 2 1 3
+After: [1, 2, 1, 3]
+
+Before: [0, 2, 3, 1]
+15 3 1 0
+After: [2, 2, 3, 1]
+
+Before: [3, 3, 0, 3]
+12 3 0 2
+After: [3, 3, 1, 3]
+
+Before: [2, 2, 2, 2]
+11 1 3 2
+After: [2, 2, 1, 2]
+
+Before: [3, 0, 3, 0]
+8 1 2 1
+After: [3, 3, 3, 0]
+
+Before: [1, 1, 1, 2]
+5 0 3 2
+After: [1, 1, 3, 2]
+
+Before: [0, 3, 3, 2]
+9 0 0 2
+After: [0, 3, 0, 2]
+
+Before: [0, 3, 2, 1]
+9 0 0 0
+After: [0, 3, 2, 1]
+
+Before: [1, 3, 1, 3]
+5 2 3 3
+After: [1, 3, 1, 3]
+
+Before: [2, 1, 3, 3]
+6 0 3 3
+After: [2, 1, 3, 0]
+
+Before: [0, 1, 1, 0]
+9 0 0 0
+After: [0, 1, 1, 0]
+
+Before: [1, 0, 2, 3]
+6 0 3 0
+After: [0, 0, 2, 3]
+
+Before: [3, 3, 3, 1]
+7 3 2 0
+After: [3, 3, 3, 1]
+
+Before: [0, 1, 3, 0]
+3 1 0 2
+After: [0, 1, 1, 0]
+
+Before: [1, 2, 2, 2]
+4 3 3 1
+After: [1, 0, 2, 2]
+
+Before: [3, 2, 2, 2]
+11 1 3 3
+After: [3, 2, 2, 1]
+
+Before: [0, 1, 0, 2]
+9 0 0 0
+After: [0, 1, 0, 2]
+
+Before: [1, 0, 1, 3]
+10 1 0 0
+After: [1, 0, 1, 3]
+
+Before: [3, 3, 2, 3]
+2 1 3 1
+After: [3, 1, 2, 3]
+
+Before: [2, 3, 1, 0]
+8 3 0 1
+After: [2, 2, 1, 0]
+
+Before: [1, 1, 2, 1]
+0 1 0 3
+After: [1, 1, 2, 1]
+
+Before: [3, 3, 2, 3]
+15 3 2 1
+After: [3, 6, 2, 3]
+
+Before: [0, 2, 1, 2]
+4 1 2 3
+After: [0, 2, 1, 1]
+
+Before: [2, 2, 1, 0]
+13 1 2 1
+After: [2, 4, 1, 0]
+
+Before: [1, 0, 3, 3]
+10 1 0 1
+After: [1, 1, 3, 3]
+
+Before: [3, 3, 2, 0]
+1 2 2 2
+After: [3, 3, 4, 0]
+
+Before: [1, 2, 1, 2]
+11 1 3 0
+After: [1, 2, 1, 2]
+
+Before: [1, 3, 1, 3]
+6 0 3 3
+After: [1, 3, 1, 0]
+
+Before: [3, 3, 1, 3]
+8 2 1 1
+After: [3, 3, 1, 3]
+
+Before: [1, 0, 0, 1]
+4 3 3 0
+After: [0, 0, 0, 1]
+
+Before: [1, 2, 2, 2]
+11 1 3 3
+After: [1, 2, 2, 1]
+
+Before: [3, 1, 2, 1]
+8 1 0 0
+After: [3, 1, 2, 1]
+
+Before: [3, 0, 1, 2]
+8 1 3 3
+After: [3, 0, 1, 2]
+
+Before: [1, 1, 3, 3]
+0 1 0 3
+After: [1, 1, 3, 1]
+
+Before: [0, 0, 1, 2]
+13 3 2 1
+After: [0, 4, 1, 2]
+
+Before: [2, 3, 0, 1]
+13 0 2 0
+After: [4, 3, 0, 1]
+
+Before: [1, 2, 2, 0]
+2 1 2 1
+After: [1, 1, 2, 0]
+
+Before: [2, 3, 1, 0]
+13 0 2 2
+After: [2, 3, 4, 0]
+
+Before: [0, 1, 2, 3]
+3 1 0 3
+After: [0, 1, 2, 1]
+
+Before: [2, 3, 2, 2]
+15 1 3 1
+After: [2, 6, 2, 2]
+
+Before: [0, 1, 2, 0]
+3 1 0 3
+After: [0, 1, 2, 1]
+
+Before: [1, 2, 2, 2]
+15 0 2 2
+After: [1, 2, 2, 2]
+
+Before: [1, 2, 2, 1]
+12 1 1 2
+After: [1, 2, 1, 1]
+
+Before: [0, 1, 1, 0]
+3 1 0 0
+After: [1, 1, 1, 0]
+
+Before: [3, 3, 0, 1]
+14 0 3 1
+After: [3, 9, 0, 1]
+
+Before: [1, 0, 2, 1]
+10 1 0 2
+After: [1, 0, 1, 1]
+
+Before: [0, 3, 2, 3]
+9 0 0 2
+After: [0, 3, 0, 3]
+
+Before: [0, 2, 1, 2]
+11 1 3 3
+After: [0, 2, 1, 1]
+
+Before: [2, 0, 1, 3]
+6 0 3 1
+After: [2, 0, 1, 3]
+
+Before: [1, 1, 2, 3]
+0 1 0 3
+After: [1, 1, 2, 1]
+
+Before: [3, 0, 2, 2]
+1 2 2 1
+After: [3, 4, 2, 2]
+
+Before: [1, 3, 2, 0]
+5 3 2 3
+After: [1, 3, 2, 2]
+
+Before: [3, 3, 0, 3]
+8 2 0 1
+After: [3, 3, 0, 3]
+
+Before: [0, 0, 3, 3]
+9 0 0 3
+After: [0, 0, 3, 0]
+
+Before: [0, 3, 1, 3]
+8 2 1 3
+After: [0, 3, 1, 3]
+
+Before: [1, 1, 3, 2]
+0 1 0 3
+After: [1, 1, 3, 1]
+
+Before: [1, 0, 0, 3]
+10 1 0 2
+After: [1, 0, 1, 3]
+
+Before: [2, 0, 1, 2]
+13 3 2 3
+After: [2, 0, 1, 4]
+
+Before: [3, 2, 3, 2]
+13 1 2 0
+After: [4, 2, 3, 2]
+
+Before: [0, 1, 0, 2]
+3 1 0 3
+After: [0, 1, 0, 1]
+
+Before: [1, 1, 3, 1]
+0 1 0 0
+After: [1, 1, 3, 1]
+
+Before: [0, 1, 3, 0]
+3 1 0 0
+After: [1, 1, 3, 0]
+
+Before: [0, 1, 0, 1]
+3 1 0 1
+After: [0, 1, 0, 1]
+
+Before: [3, 2, 1, 2]
+4 1 2 2
+After: [3, 2, 1, 2]
+
+Before: [1, 1, 2, 3]
+0 1 0 0
+After: [1, 1, 2, 3]
+
+Before: [3, 2, 3, 2]
+11 1 3 2
+After: [3, 2, 1, 2]
+
+Before: [0, 1, 3, 1]
+3 1 0 1
+After: [0, 1, 3, 1]
+
+Before: [1, 1, 2, 0]
+0 1 0 3
+After: [1, 1, 2, 1]
+
+Before: [0, 1, 3, 0]
+9 0 0 3
+After: [0, 1, 3, 0]
+
+Before: [2, 2, 3, 1]
+14 2 3 2
+After: [2, 2, 9, 1]
+
+Before: [0, 1, 0, 1]
+3 1 0 2
+After: [0, 1, 1, 1]
+
+Before: [3, 3, 3, 3]
+15 0 3 3
+After: [3, 3, 3, 9]
+
+Before: [2, 1, 2, 3]
+6 0 3 0
+After: [0, 1, 2, 3]
+
+Before: [0, 2, 1, 2]
+8 0 3 1
+After: [0, 2, 1, 2]
+
+Before: [0, 2, 2, 1]
+2 1 2 1
+After: [0, 1, 2, 1]
+
+Before: [1, 0, 1, 2]
+10 1 0 0
+After: [1, 0, 1, 2]
+
+Before: [1, 2, 3, 3]
+15 1 3 3
+After: [1, 2, 3, 6]
+
+Before: [2, 1, 2, 3]
+15 1 2 3
+After: [2, 1, 2, 2]
+
+Before: [1, 2, 2, 1]
+14 1 3 3
+After: [1, 2, 2, 6]
+
+Before: [1, 1, 1, 0]
+0 1 0 1
+After: [1, 1, 1, 0]
+
+Before: [3, 2, 3, 1]
+4 3 3 0
+After: [0, 2, 3, 1]
+
+Before: [0, 2, 2, 2]
+11 1 3 2
+After: [0, 2, 1, 2]
+
+Before: [2, 1, 3, 1]
+14 3 2 3
+After: [2, 1, 3, 2]
+
+Before: [0, 2, 2, 3]
+2 1 2 0
+After: [1, 2, 2, 3]
+
+Before: [0, 1, 3, 3]
+5 0 3 2
+After: [0, 1, 3, 3]
+
+Before: [0, 3, 2, 2]
+15 1 2 0
+After: [6, 3, 2, 2]
+
+Before: [2, 2, 1, 2]
+14 3 3 1
+After: [2, 6, 1, 2]
+
+Before: [2, 2, 2, 2]
+11 1 3 1
+After: [2, 1, 2, 2]
+
+Before: [3, 2, 2, 2]
+11 1 3 0
+After: [1, 2, 2, 2]
+
+Before: [1, 3, 2, 1]
+15 0 2 0
+After: [2, 3, 2, 1]
+
+Before: [1, 2, 0, 0]
+15 0 1 2
+After: [1, 2, 2, 0]
+
+Before: [1, 2, 2, 3]
+1 1 2 1
+After: [1, 4, 2, 3]
+
+Before: [3, 2, 2, 1]
+7 3 2 0
+After: [3, 2, 2, 1]
+
+Before: [3, 2, 2, 0]
+12 1 1 2
+After: [3, 2, 1, 0]
+
+Before: [1, 0, 3, 3]
+6 0 3 1
+After: [1, 0, 3, 3]
+
+Before: [2, 0, 2, 1]
+1 0 2 3
+After: [2, 0, 2, 4]
+
+Before: [2, 0, 1, 2]
+13 0 2 0
+After: [4, 0, 1, 2]
+
+Before: [2, 2, 2, 2]
+12 2 1 0
+After: [1, 2, 2, 2]
+
+Before: [2, 2, 0, 2]
+13 3 2 1
+After: [2, 4, 0, 2]
+
+Before: [3, 3, 3, 0]
+14 2 3 1
+After: [3, 9, 3, 0]
+
+Before: [3, 1, 0, 2]
+4 3 3 3
+After: [3, 1, 0, 0]
+
+Before: [0, 2, 2, 3]
+1 1 2 0
+After: [4, 2, 2, 3]
+
+Before: [0, 1, 1, 2]
+9 0 0 1
+After: [0, 0, 1, 2]
+
+Before: [3, 3, 1, 0]
+14 1 3 2
+After: [3, 3, 9, 0]
+
+Before: [2, 0, 2, 3]
+5 1 2 2
+After: [2, 0, 2, 3]
+
+Before: [1, 1, 1, 2]
+0 1 0 0
+After: [1, 1, 1, 2]
+
+Before: [3, 2, 3, 3]
+15 1 3 0
+After: [6, 2, 3, 3]
+
+Before: [1, 3, 2, 1]
+14 1 3 0
+After: [9, 3, 2, 1]
+
+Before: [2, 0, 2, 2]
+1 2 2 0
+After: [4, 0, 2, 2]
+
+Before: [0, 2, 1, 2]
+11 1 3 0
+After: [1, 2, 1, 2]
+
+Before: [0, 1, 1, 1]
+3 1 0 3
+After: [0, 1, 1, 1]
+
+Before: [1, 0, 1, 0]
+10 1 0 1
+After: [1, 1, 1, 0]
+
+Before: [1, 1, 1, 1]
+4 3 3 3
+After: [1, 1, 1, 0]
+
+Before: [3, 2, 2, 2]
+14 0 3 3
+After: [3, 2, 2, 9]
+
+Before: [0, 1, 2, 1]
+9 0 0 0
+After: [0, 1, 2, 1]
+
+Before: [2, 0, 2, 3]
+1 2 2 0
+After: [4, 0, 2, 3]
+
+Before: [1, 1, 1, 3]
+0 1 0 3
+After: [1, 1, 1, 1]
+
+Before: [0, 1, 0, 3]
+3 1 0 1
+After: [0, 1, 0, 3]
+
+Before: [2, 0, 2, 1]
+5 1 2 0
+After: [2, 0, 2, 1]
+
+Before: [1, 3, 3, 1]
+14 0 2 0
+After: [2, 3, 3, 1]
+
+Before: [1, 0, 0, 3]
+6 0 3 1
+After: [1, 0, 0, 3]
+
+Before: [2, 3, 0, 3]
+6 0 3 3
+After: [2, 3, 0, 0]
+
+Before: [0, 1, 2, 2]
+1 3 2 3
+After: [0, 1, 2, 4]
+
+Before: [3, 1, 2, 3]
+1 2 2 2
+After: [3, 1, 4, 3]
+
+Before: [3, 1, 0, 3]
+8 2 0 3
+After: [3, 1, 0, 3]
+
+Before: [3, 3, 1, 2]
+14 0 3 3
+After: [3, 3, 1, 9]
+
+Before: [3, 0, 3, 2]
+4 3 3 3
+After: [3, 0, 3, 0]
+
+Before: [2, 3, 1, 0]
+8 2 1 0
+After: [3, 3, 1, 0]
+
+Before: [0, 1, 2, 1]
+3 1 0 2
+After: [0, 1, 1, 1]
+
+Before: [0, 1, 3, 2]
+3 1 0 0
+After: [1, 1, 3, 2]
+
+Before: [1, 1, 2, 0]
+15 0 2 1
+After: [1, 2, 2, 0]
+
+Before: [0, 3, 2, 2]
+1 3 2 0
+After: [4, 3, 2, 2]
+
+Before: [1, 0, 1, 2]
+10 1 0 3
+After: [1, 0, 1, 1]
+
+Before: [0, 2, 2, 0]
+12 1 1 0
+After: [1, 2, 2, 0]
+
+Before: [1, 1, 3, 3]
+0 1 0 1
+After: [1, 1, 3, 3]
+
+Before: [1, 0, 2, 0]
+10 1 0 2
+After: [1, 0, 1, 0]
+
+Before: [2, 3, 2, 1]
+15 1 2 1
+After: [2, 6, 2, 1]
+
+Before: [1, 2, 0, 0]
+8 1 0 1
+After: [1, 3, 0, 0]
+
+Before: [3, 2, 1, 2]
+11 1 3 3
+After: [3, 2, 1, 1]
+
+Before: [1, 1, 1, 1]
+0 1 0 3
+After: [1, 1, 1, 1]
+
+Before: [2, 3, 1, 3]
+6 0 3 3
+After: [2, 3, 1, 0]
+
+Before: [0, 2, 1, 3]
+13 1 2 2
+After: [0, 2, 4, 3]
+
+Before: [1, 0, 3, 1]
+7 3 2 3
+After: [1, 0, 3, 3]
+
+Before: [2, 1, 0, 0]
+8 3 0 3
+After: [2, 1, 0, 2]
+
+Before: [1, 1, 1, 2]
+0 1 0 2
+After: [1, 1, 1, 2]
+
+Before: [3, 2, 2, 2]
+1 3 2 3
+After: [3, 2, 2, 4]
+
+Before: [3, 1, 1, 1]
+14 0 3 3
+After: [3, 1, 1, 9]
+
+Before: [2, 2, 3, 3]
+6 0 3 0
+After: [0, 2, 3, 3]
+
+Before: [0, 1, 1, 2]
+3 1 0 2
+After: [0, 1, 1, 2]
+
+Before: [3, 2, 1, 2]
+14 0 3 0
+After: [9, 2, 1, 2]
+
+Before: [2, 0, 3, 1]
+7 3 2 3
+After: [2, 0, 3, 3]
+
+Before: [1, 2, 2, 1]
+2 1 2 0
+After: [1, 2, 2, 1]
+
+Before: [0, 0, 2, 1]
+4 3 3 3
+After: [0, 0, 2, 0]
+
+Before: [3, 2, 3, 3]
+12 3 0 3
+After: [3, 2, 3, 1]
+
+Before: [1, 1, 2, 2]
+0 1 0 3
+After: [1, 1, 2, 1]
+
+Before: [2, 3, 1, 1]
+14 1 3 2
+After: [2, 3, 9, 1]
+
+Before: [1, 0, 2, 1]
+15 0 2 1
+After: [1, 2, 2, 1]
+
+Before: [0, 1, 2, 3]
+9 0 0 3
+After: [0, 1, 2, 0]
+
+Before: [3, 0, 0, 2]
+4 3 3 0
+After: [0, 0, 0, 2]
+
+Before: [3, 0, 3, 1]
+7 3 2 3
+After: [3, 0, 3, 3]
+
+Before: [3, 2, 2, 3]
+12 2 1 1
+After: [3, 1, 2, 3]
+
+Before: [0, 3, 3, 3]
+2 1 3 1
+After: [0, 1, 3, 3]
+
+Before: [1, 0, 0, 0]
+10 1 0 1
+After: [1, 1, 0, 0]
+
+Before: [1, 3, 0, 3]
+2 1 3 3
+After: [1, 3, 0, 1]
+
+Before: [3, 2, 2, 3]
+12 3 0 2
+After: [3, 2, 1, 3]
+
+Before: [1, 1, 2, 0]
+0 1 0 0
+After: [1, 1, 2, 0]
+
+Before: [0, 2, 2, 1]
+2 1 2 2
+After: [0, 2, 1, 1]
+
+Before: [1, 0, 1, 2]
+10 1 0 2
+After: [1, 0, 1, 2]
+
+Before: [1, 0, 3, 0]
+14 0 2 2
+After: [1, 0, 2, 0]
+
+Before: [0, 2, 3, 2]
+11 1 3 3
+After: [0, 2, 3, 1]
+
+Before: [0, 1, 0, 3]
+3 1 0 2
+After: [0, 1, 1, 3]
+
+Before: [3, 3, 2, 1]
+12 1 0 0
+After: [1, 3, 2, 1]
+
+Before: [0, 2, 3, 3]
+13 1 2 0
+After: [4, 2, 3, 3]
+
+Before: [1, 1, 3, 0]
+0 1 0 1
+After: [1, 1, 3, 0]
+
+Before: [1, 2, 2, 2]
+2 1 2 2
+After: [1, 2, 1, 2]
+
+Before: [2, 1, 3, 3]
+13 0 2 2
+After: [2, 1, 4, 3]
+
+Before: [1, 0, 1, 3]
+10 1 0 3
+After: [1, 0, 1, 1]
+
+Before: [2, 1, 3, 2]
+7 3 1 1
+After: [2, 3, 3, 2]
+
+Before: [1, 1, 1, 0]
+0 1 0 0
+After: [1, 1, 1, 0]
+
+Before: [0, 2, 3, 2]
+13 3 2 3
+After: [0, 2, 3, 4]
+
+Before: [3, 2, 2, 3]
+12 3 0 3
+After: [3, 2, 2, 1]
+
+Before: [2, 3, 2, 3]
+2 1 3 1
+After: [2, 1, 2, 3]
+
+Before: [2, 3, 0, 3]
+6 0 3 1
+After: [2, 0, 0, 3]
+
+Before: [2, 2, 2, 3]
+1 2 2 0
+After: [4, 2, 2, 3]
+
+Before: [3, 2, 3, 2]
+4 3 3 1
+After: [3, 0, 3, 2]
+
+Before: [0, 2, 2, 0]
+12 1 1 1
+After: [0, 1, 2, 0]
+
+Before: [2, 2, 3, 2]
+11 1 3 2
+After: [2, 2, 1, 2]
+
+Before: [3, 0, 2, 3]
+1 2 2 2
+After: [3, 0, 4, 3]
+
+Before: [0, 3, 2, 0]
+9 0 0 0
+After: [0, 3, 2, 0]
+
+Before: [0, 2, 3, 1]
+9 0 0 2
+After: [0, 2, 0, 1]
+
+Before: [0, 1, 1, 1]
+3 1 0 2
+After: [0, 1, 1, 1]
+
+Before: [2, 2, 2, 3]
+2 1 2 0
+After: [1, 2, 2, 3]
+
+Before: [0, 1, 2, 3]
+15 3 2 0
+After: [6, 1, 2, 3]
+
+Before: [1, 1, 0, 2]
+7 3 1 3
+After: [1, 1, 0, 3]
+
+Before: [1, 1, 1, 1]
+0 1 0 0
+After: [1, 1, 1, 1]
+
+Before: [1, 2, 3, 3]
+15 0 1 3
+After: [1, 2, 3, 2]
+
+Before: [0, 3, 2, 3]
+2 1 3 1
+After: [0, 1, 2, 3]
+
+Before: [0, 3, 0, 0]
+8 2 1 3
+After: [0, 3, 0, 3]
+
+Before: [2, 0, 2, 3]
+1 0 2 0
+After: [4, 0, 2, 3]
+
+Before: [0, 3, 0, 3]
+5 0 3 3
+After: [0, 3, 0, 3]
+
+Before: [0, 1, 2, 0]
+3 1 0 0
+After: [1, 1, 2, 0]
+
+
+
+7 3 2 0
+7 2 1 1
+7 1 0 3
+8 1 0 1
+14 1 2 1
+1 2 1 2
+7 3 3 1
+7 2 0 0
+14 3 0 3
+13 3 2 3
+0 1 0 1
+14 1 1 1
+1 1 2 2
+7 2 2 1
+7 3 1 0
+7 1 0 3
+1 3 3 3
+14 3 3 3
+1 2 3 2
+3 2 1 0
+14 3 0 3
+13 3 0 3
+7 2 3 2
+14 2 0 1
+13 1 0 1
+6 3 2 2
+14 2 2 2
+1 0 2 0
+7 3 1 1
+7 2 2 3
+14 3 0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
+7 1 1 0
+13 0 1 0
+14 0 1 0
+14 0 2 0
+1 2 0 2
+14 2 0 0
+13 0 2 0
+7 2 3 3
+11 0 3 1
+14 1 2 1
+1 1 2 2
+3 2 1 1
+7 3 3 3
+7 3 3 2
+2 0 2 3
+14 3 1 3
+14 3 3 3
+1 1 3 1
+3 1 0 3
+7 1 1 2
+7 3 0 1
+12 0 1 1
+14 1 2 1
+1 1 3 3
+3 3 3 1
+14 3 0 2
+13 2 0 2
+7 2 2 3
+11 0 3 3
+14 3 2 3
+1 1 3 1
+3 1 1 2
+7 3 3 1
+7 1 2 3
+4 0 3 3
+14 3 3 3
+14 3 2 3
+1 2 3 2
+3 2 0 0
+7 0 2 2
+14 2 0 3
+13 3 1 3
+1 3 3 1
+14 1 2 1
+14 1 2 1
+1 1 0 0
+3 0 2 2
+7 2 1 0
+7 1 0 1
+15 1 0 1
+14 1 2 1
+14 1 2 1
+1 2 1 2
+3 2 2 1
+7 3 3 3
+7 3 2 2
+8 0 2 0
+14 0 3 0
+1 0 1 1
+7 0 2 2
+7 2 1 3
+14 1 0 0
+13 0 3 0
+2 2 0 0
+14 0 3 0
+14 0 3 0
+1 0 1 1
+3 1 0 2
+7 2 2 0
+7 2 3 1
+11 0 3 0
+14 0 3 0
+14 0 1 0
+1 0 2 2
+3 2 2 3
+7 2 2 0
+7 1 3 2
+14 3 0 1
+13 1 3 1
+12 0 1 0
+14 0 2 0
+14 0 3 0
+1 3 0 3
+3 3 2 0
+7 2 2 2
+7 0 1 3
+6 3 2 3
+14 3 1 3
+1 3 0 0
diff --git a/src/16/part1 b/src/16/part1 new file mode 100644 index 0000000..d0582fd --- /dev/null +++ b/src/16/part1 @@ -0,0 +1,136 @@ +--- Day 16: Chronal Classification --- + +As you see the Elves defend their hot chocolate successfully, you go back to falling through time. +This is going to become a problem. + +If you're ever going to return to your own time, you need to understand how this device on your +wrist works. You have a little while before you reach your next destination, and with a bit of trial +and error, you manage to pull up a programming manual on the device's tiny screen. + +According to the manual, the device has four registers (numbered 0 through 3) that can be +manipulated by instructions containing one of 16 opcodes. The registers start with the value 0. + +Every instruction consists of four values: an [1m[97mopcode[0m, two [1m[97minputs[0m (named A and B), and an +[1m[97moutput[0m (named C), in that order. The opcode specifies the behavior of the instruction and how the +inputs are interpreted. The output, C, is always treated as a register. + +In the opcode descriptions below, if something says "[1m[97mvalue A[0m", it means to take the number given as +A [1m[97mliterally[0m. (This is also called an "immediate" value.) If something says "[1m[97mregister A[0m", it means to +use the number given as A to read from (or write to) the [1m[97mregister with that number[0m. So, if the +opcode addi adds register A and value B, storing the result in register C, and the instruction addi +0 7 3 is encountered, it would add 7 to the value contained by register 0 and store the sum in +register 3, never modifying registers 0, 1, or 2 in the process. + +Many opcodes are similar except for how they interpret their arguments. The opcodes fall into seven +general categories: + +Addition: + + + - addr (add register) stores into register C the result of adding register A and register B. + + - addi (add immediate) stores into register C the result of adding register A and value B. + + +Multiplication: + + + - mulr (multiply register) stores into register C the result of multiplying register A and register +B. + + - muli (multiply immediate) stores into register C the result of multiplying register A and value +B. + + +Bitwise AND: + + + - banr (bitwise AND register) stores into register C the result of the bitwise AND of register A +and register B. + + - bani (bitwise AND immediate) stores into register C the result of the bitwise AND of register A +and value B. + + +Bitwise OR: + + + - borr (bitwise OR register) stores into register C the result of the bitwise OR of register A and +register B. + + - bori (bitwise OR immediate) stores into register C the result of the bitwise OR of register A and +value B. + + +Assignment: + + + - setr (set register) copies the contents of register A into register C. (Input B is ignored.) + + - seti (set immediate) stores value A into register C. (Input B is ignored.) + + +Greater-than testing: + + + - gtir (greater-than immediate/register) sets register C to 1 if value A is greater than register +B. Otherwise, register C is set to 0. + + - gtri (greater-than register/immediate) sets register C to 1 if register A is greater than value +B. Otherwise, register C is set to 0. + + - gtrr (greater-than register/register) sets register C to 1 if register A is greater than register +B. Otherwise, register C is set to 0. + + +Equality testing: + + + - eqir (equal immediate/register) sets register C to 1 if value A is equal to register B. +Otherwise, register C is set to 0. + + - eqri (equal register/immediate) sets register C to 1 if register A is equal to value B. +Otherwise, register C is set to 0. + + - eqrr (equal register/register) sets register C to 1 if register A is equal to register B. +Otherwise, register C is set to 0. + + +Unfortunately, while the manual gives the [1m[97mname[0m of each opcode, it doesn't seem to indicate the +[1m[97mnumber[0m. However, you can monitor the CPU to see the contents of the registers before and after +instructions are executed to try to work them out. Each opcode has a number from 0 through 15, but +the manual doesn't say which is which. For example, suppose you capture the following sample: + +Before: [3, 2, 1, 1] +9 2 1 2 +After: [3, 2, 2, 1] + +This sample shows the effect of the instruction 9 2 1 2 on the registers. Before the instruction is +executed, register 0 has value 3, register 1 has value 2, and registers 2 and 3 have value 1. After +the instruction is executed, register 2's value becomes 2. + +The instruction itself, 9 2 1 2, means that opcode 9 was executed with A=2, B=1, and C=2. Opcode 9 +could be any of the 16 opcodes listed above, but only three of them behave in a way that would cause +the result shown in the sample: + + + - Opcode 9 could be mulr: register 2 (which has a value of 1) times register 1 (which has a value +of 2) produces 2, which matches the value stored in the output register, register 2. + + - Opcode 9 could be addi: register 2 (which has a value of 1) plus value 1 produces 2, which +matches the value stored in the output register, register 2. + + - Opcode 9 could be seti: value 2 matches the value stored in the output register, register 2; the +number given for B is irrelevant. + + +None of the other opcodes produce the result captured in the sample. Because of this, the sample +above [1m[97mbehaves like three opcodes[0m. + +You collect many of these samples (the first section of your puzzle input). The manual also includes +a small test program (the second section of your puzzle input) - you can [1m[97mignore it for now[0m. + +Ignoring the opcode numbers, [1m[97mhow many samples in your puzzle input behave like three or more +opcodes?[0m + + diff --git a/src/16/part2 b/src/16/part2 new file mode 100644 index 0000000..609807e --- /dev/null +++ b/src/16/part2 @@ -0,0 +1,32 @@ +--- Part Two --- + +Now that your FFT is working, you can decode the [1m[97mreal signal[0m. + +The real signal is your puzzle input [1m[97mrepeated 10000 times[0m. Treat this new signal as a single input +list. Patterns are still calculated as before, and 100 phases of FFT are still applied. + +The [1m[97mfirst seven digits[0m of your initial input signal also represent the [1m[97mmessage offset[0m. The message +offset is the location of the eight-digit message in the final output list. Specifically, the +message offset indicates [1m[97mthe number of digits to skip[0m before reading the eight-digit message. For +example, if the first seven digits of your initial input signal were 1234567, the eight-digit +message would be the eight digits after skipping 1,234,567 digits of the final output list. Or, if +the message offset were 7 and your final output list were 98765432109876543210, the eight-digit +message would be 21098765. (Of course, your real message offset will be a seven-digit number, not a +one-digit number like 7.) + +Here is the eight-digit message in the final output list after 100 phases. The message offset given +in each input has been highlighted. (Note that the inputs given below are repeated 10000 times to +find the actual starting input lists.) + + + - [1m[97m0303673[0m2577212944063491565474664 becomes 84462026. + + - [1m[97m0293510[0m9699940807407585447034323 becomes 78725270. + + - [1m[97m0308177[0m0884921959731165446850517 becomes 53553731. + + +After repeating your input signal 10000 times and running 100 phases of FFT, [1m[97mwhat is the eight-digit +message embedded in the final output list?[0m + + diff --git a/src/16/solve.py b/src/16/solve.py new file mode 100644 index 0000000..f9a11b6 --- /dev/null +++ b/src/16/solve.py @@ -0,0 +1,109 @@ +import sys
+sys.path.append("../common")
+import aoc
+
+def parse_log(ls):
+ data = list()
+ before = [int(v) for v in ls[0].split("[")[1].split("]")[0].split(",")]
+ ins = [int(v) for v in ls[1].split(" ")]
+ after = [int(v) for v in ls[2].split("[")[1].split("]")[0].split(",")]
+ return (before, ins, after)
+
+inslog = []
+data = aoc.data.split("\n")
+progsec = None
+for i in range(0, len(data), 4):
+ if data[i] == "\n":
+ progsec = i
+ break
+ inslog.append(parse_log(data[i:i+4]))
+
+register = list()
+
+opmap = dict()
+opmap["addr"] = lambda a, b : register[a] + register[b]
+opmap["addi"] = lambda a, b : register[a] + b
+opmap["mulr"] = lambda a, b : register[a] * register[b]
+opmap["muli"] = lambda a, b : register[a] * b
+opmap["banr"] = lambda a, b : register[a] & register[b]
+opmap["bani"] = lambda a, b : register[a] & b
+opmap["borr"] = lambda a, b : register[a] | register[b]
+opmap["bori"] = lambda a, b : register[a] | b
+opmap["setr"] = lambda a, b : register[a]
+opmap["seti"] = lambda a, b : a
+opmap["gtir"] = lambda a, b : 1 * (a > register[b])
+opmap["gtri"] = lambda a, b : 1 * (register[a] > b)
+opmap["gtrr"] = lambda a, b : 1 * (register[a] > register[b])
+opmap["eqir"] = lambda a, b : 1 * (a == register[b])
+opmap["eqri"] = lambda a, b : 1 * (register[a] == b)
+opmap["eqrr"] = lambda a, b : 1 * (register[a] == register[b])
+
+def get_possible(ins):
+ global register
+ sregister = register[:]
+ before = ins[0]
+ after = ins[2]
+ register = before
+ a = ins[1][1]
+ b = ins[1][2]
+ c = ins[1][3]
+ ops = list(opmap.values())
+ possibles = list()
+ for i in range(len(ops)):
+ op = ops[i]
+ res = None
+ try:
+ res = op(a, b)
+ except:
+ continue
+ if res == after[c]:
+ possibles.append(i)
+ register = sregister
+ return possibles
+
+def solve1(args):
+ global register
+ uncertain = 0
+ for ins in inslog:
+ if len(get_possible(ins)) >= 3:
+ uncertain += 1
+ return uncertain
+
+def solve2(args):
+ possible = dict()
+ for ins in inslog:
+ o = ins[1][0]
+ if o in possible:
+ possible[o] = [op for op in get_possible(ins) if op in possible[o]]
+ else:
+ possible[o] = get_possible(ins)
+
+ certain = False
+ while not certain:
+ singles = [p[0] for p in possible.values() if len(p) == 1]
+ for p in possible:
+ if len(possible[p]) != 1:
+ possible[p] = [v for v in possible[p] if v not in singles]
+
+ certain = True
+ for p in possible.values():
+ if len(p) != 1:
+ certain = False
+ break
+
+ ntrans = dict()
+ for p in possible: # flatten
+ ntrans[p] = possible[p][0]
+
+ for i in range(progsec, len(data)): # execute program
+ l = data[i]
+ if l == "\n": continue
+ cmd = [int(v) for v in l.split(" ")]
+ while len(register)-1 < cmd[3]:
+ register.append(0)
+
+ register[cmd[3]] = list(opmap.values())[ntrans[cmd[0]]](cmd[1], cmd[2])
+
+ return register[0]
+
+aoc.run(solve1, solve2, sols=[531, 649])
diff --git a/src/17/.gitignore b/src/17/.gitignore new file mode 100644 index 0000000..53752db --- /dev/null +++ b/src/17/.gitignore @@ -0,0 +1 @@ +output diff --git a/src/17/input b/src/17/input new file mode 100644 index 0000000..c383645 --- /dev/null +++ b/src/17/input @@ -0,0 +1,1884 @@ +x=309, y=1432..1458
+y=231, x=423..450
+y=1629, x=355..382
+y=1321, x=462..472
+x=478, y=804..815
+x=447, y=583..592
+y=1585, x=315..369
+x=463, y=743..745
+y=1705, x=370..372
+x=478, y=784..794
+x=590, y=149..154
+x=322, y=839..858
+x=322, y=33..38
+y=257, x=474..501
+y=530, x=562..584
+x=588, y=1364..1368
+y=1048, x=567..578
+x=391, y=395..398
+x=585, y=1397..1401
+y=590, x=452..467
+x=549, y=133..146
+y=743, x=463..465
+x=377, y=564..585
+x=405, y=91..97
+x=356, y=893..907
+x=410, y=700..702
+x=583, y=1128..1132
+x=375, y=1449..1455
+x=354, y=1408..1418
+y=876, x=468..477
+y=573, x=402..408
+y=667, x=390..409
+y=1393, x=490..495
+y=1719, x=614..617
+x=379, y=510..530
+y=524, x=369..371
+x=442, y=9..21
+x=380, y=950..975
+x=552, y=66..68
+x=429, y=1005..1020
+x=340, y=216..240
+y=1115, x=580..608
+x=487, y=672..689
+y=519, x=460..468
+y=450, x=503..506
+y=1104, x=369..494
+y=367, x=588..592
+x=409, y=1604..1630
+y=681, x=615..629
+y=1544, x=397..400
+y=71, x=338..349
+x=444, y=283..288
+x=622, y=224..251
+x=465, y=743..745
+x=591, y=1464..1471
+x=349, y=1691..1696
+x=327, y=1158..1162
+x=566, y=237..247
+x=533, y=1366..1368
+y=398, x=364..391
+x=382, y=1446..1458
+x=387, y=1637..1645
+y=266, x=505..524
+y=911, x=365..392
+x=618, y=348..350
+y=24, x=550..568
+y=244, x=558..560
+y=1046, x=360..378
+x=530, y=502..515
+y=1270, x=610..620
+x=623, y=136..162
+y=1477, x=330..349
+x=415, y=834..850
+x=358, y=1489..1502
+x=617, y=1707..1719
+y=1223, x=460..476
+x=382, y=1294..1319
+x=492, y=177..184
+x=372, y=1695..1705
+x=538, y=1573..1598
+x=415, y=238..249
+x=383, y=1070..1077
+y=1371, x=579..600
+x=394, y=1071..1077
+x=586, y=320..334
+x=420, y=481..499
+x=520, y=1307..1320
+x=349, y=1593..1605
+x=577, y=1291..1314
+y=1728, x=326..348
+x=628, y=1007..1011
+y=1424, x=605..608
+x=435, y=1072..1076
+x=355, y=1250..1256
+x=390, y=648..667
+x=520, y=695..721
+y=1011, x=603..628
+x=404, y=701..702
+x=584, y=685..687
+y=1357, x=354..356
+y=645, x=614..620
+x=470, y=992..1002
+y=1543, x=381..385
+y=1143, x=544..546
+x=320, y=1232..1234
+x=633, y=1132..1142
+x=477, y=872..876
+x=340, y=316..339
+x=352, y=1073..1079
+x=486, y=814..831
+x=475, y=1620..1640
+x=553, y=1074..1086
+y=1579, x=345..361
+x=522, y=457..458
+y=585, x=498..635
+x=468, y=513..519
+y=745, x=463..465
+y=1537, x=397..400
+x=448, y=1004..1020
+x=492, y=1543..1546
+x=567, y=1593..1614
+x=566, y=1384..1393
+x=491, y=717..729
+x=334, y=461..481
+y=1697, x=505..508
+y=1437, x=389..403
+x=582, y=36..48
+x=594, y=1323..1345
+x=401, y=1495..1501
+y=1335, x=494..508
+y=782, x=509..511
+x=611, y=484..496
+x=462, y=1281..1297
+x=503, y=1436..1462
+y=850, x=415..420
+y=646, x=336..361
+x=548, y=238..247
+x=330, y=404..406
+x=502, y=408..426
+y=1122, x=307..309
+y=1084, x=342..359
+y=1144, x=312..334
+y=1409, x=380..387
+x=591, y=263..266
+x=367, y=1493..1495
+y=147, x=348..350
+x=496, y=1689..1707
+y=1037, x=434..450
+x=533, y=502..515
+x=513, y=676..689
+x=478, y=700..710
+x=368, y=778..781
+y=1380, x=346..363
+x=604, y=481..493
+x=325, y=438..459
+x=621, y=1606..1614
+y=1533, x=528..530
+x=603, y=929..942
+x=541, y=504..518
+y=1126, x=514..537
+y=369, x=588..592
+x=578, y=216..224
+x=558, y=88..92
+y=997, x=491..500
+x=509, y=779..782
+x=540, y=983..993
+y=641, x=365..370
+x=332, y=501..524
+x=542, y=1261..1274
+y=885, x=417..433
+x=514, y=384..387
+y=1252, x=309..321
+x=412, y=1571..1597
+x=409, y=648..667
+y=1096, x=510..512
+y=1694, x=430..441
+x=516, y=1005..1025
+x=460, y=513..519
+y=1640, x=463..475
+x=420, y=1684..1686
+x=523, y=556..560
+x=381, y=1349..1352
+x=559, y=443..450
+y=975, x=354..380
+x=356, y=865..872
+x=500, y=528..542
+x=402, y=1639..1649
+y=1422, x=605..608
+x=383, y=1474..1476
+y=1385, x=618..633
+x=378, y=240..265
+x=548, y=322..326
+x=570, y=342..351
+x=552, y=1366..1368
+y=836, x=306..322
+x=528, y=527..537
+x=382, y=1617..1629
+x=295, y=1349..1351
+x=326, y=1266..1278
+y=235, x=460..466
+y=53, x=362..384
+x=440, y=157..170
+y=625, x=347..372
+x=610, y=339..353
+y=836, x=464..480
+x=524, y=1572..1598
+y=1604, x=376..378
+x=429, y=180..182
+y=1073, x=350..352
+y=713, x=336..359
+x=618, y=1343..1356
+x=378, y=692..695
+x=471, y=92..101
+x=610, y=1192..1194
+y=1217, x=431..455
+y=1146, x=360..520
+y=73, x=314..316
+x=592, y=1296..1308
+y=1617, x=303..307
+x=324, y=673..687
+x=594, y=793..799
+x=496, y=1051..1063
+x=342, y=400..413
+x=502, y=72..82
+x=578, y=257..268
+y=1255, x=509..528
+x=534, y=1153..1163
+x=599, y=680..694
+y=1667, x=582..599
+x=352, y=1388..1399
+x=373, y=826..832
+x=466, y=230..235
+x=343, y=584..595
+x=626, y=1148..1164
+y=1234, x=484..509
+x=322, y=1053..1056
+x=349, y=1664..1667
+x=335, y=500..524
+x=533, y=278..279
+x=392, y=132..136
+x=434, y=1037..1039
+x=537, y=484..489
+x=375, y=1474..1476
+x=445, y=360..387
+x=555, y=406..420
+x=365, y=897..911
+y=324, x=378..389
+y=1702, x=457..473
+x=353, y=1368..1377
+x=460, y=950..959
+y=354, x=444..449
+y=1505, x=569..578
+x=329, y=1681..1699
+x=476, y=1214..1223
+x=569, y=523..525
+y=542, x=522..538
+y=1684, x=370..375
+x=618, y=1188..1202
+x=518, y=1239..1248
+x=415, y=1206..1210
+x=306, y=818..836
+x=438, y=1605..1618
+x=373, y=1621..1623
+x=595, y=1591..1599
+x=348, y=1725..1728
+x=552, y=864..867
+x=504, y=245..247
+y=537, x=528..532
+y=869, x=584..601
+x=339, y=1536..1540
+y=1271, x=511..524
+x=602, y=147..162
+y=1446, x=509..534
+y=1563, x=326..344
+y=563, x=305..330
+y=1536, x=339..344
+x=440, y=325..330
+y=1182, x=510..514
+x=481, y=493..506
+y=313, x=576..592
+x=393, y=371..376
+x=394, y=1262..1272
+x=591, y=710..727
+x=345, y=250..265
+y=995, x=568..577
+y=278, x=413..418
+x=598, y=1073..1099
+y=1560, x=333..338
+x=486, y=32..44
+x=577, y=926..934
+x=361, y=642..646
+y=193, x=528..549
+x=301, y=518..544
+y=1208, x=312..321
+x=342, y=656..662
+x=603, y=1323..1345
+x=503, y=775..785
+y=689, x=396..400
+x=596, y=895..902
+x=526, y=833..841
+x=498, y=783..794
+x=326, y=1725..1728
+x=475, y=1563..1588
+x=419, y=724..738
+x=321, y=1527..1531
+x=433, y=142..158
+x=596, y=1469..1496
+x=341, y=982..989
+y=378, x=497..504
+y=1599, x=621..633
+x=355, y=1617..1629
+y=1039, x=434..450
+x=360, y=827..832
+x=393, y=1467..1479
+y=937, x=344..350
+x=501, y=251..257
+y=526, x=369..371
+x=527, y=427..438
+y=1599, x=595..615
+x=486, y=1562..1588
+x=358, y=1550..1563
+y=82, x=471..502
+x=300, y=259..276
+y=808, x=492..494
+x=444, y=335..354
+y=1368, x=443..445
+x=567, y=1022..1048
+x=620, y=440..452
+x=572, y=600..612
+x=442, y=583..592
+y=194, x=622..624
+y=184, x=375..379
+x=304, y=1432..1458
+x=443, y=617..637
+x=332, y=1446..1458
+x=327, y=888..913
+x=588, y=1463..1471
+y=1278, x=313..326
+y=493, x=526..550
+x=301, y=438..459
+x=467, y=1158..1182
+y=592, x=442..447
+x=618, y=1364..1385
+x=499, y=35..37
+x=470, y=673..689
+x=620, y=1255..1270
+x=329, y=792..815
+x=389, y=513..532
+y=1598, x=524..538
+x=350, y=1073..1079
+x=414, y=514..532
+x=334, y=128..155
+y=1021, x=404..422
+x=543, y=1457..1476
+x=527, y=297..303
+x=363, y=1677..1687
+x=325, y=399..413
+x=436, y=728..749
+x=561, y=1187..1192
+x=632, y=1149..1164
+y=630, x=474..493
+y=1471, x=422..436
+y=1074, x=553..556
+y=882, x=377..389
+x=404, y=1010..1021
+x=307, y=1461..1481
+y=1018, x=473..478
+x=568, y=35..48
+x=351, y=1194..1202
+x=373, y=1449..1455
+x=516, y=610..617
+y=617, x=607..616
+y=493, x=601..604
+x=618, y=1545..1561
+y=158, x=419..433
+x=560, y=235..244
+x=362, y=38..53
+x=309, y=1120..1122
+x=342, y=1066..1084
+x=495, y=1381..1393
+x=505, y=1634..1641
+x=526, y=791..798
+y=1052, x=583..589
+x=557, y=1135..1146
+x=318, y=34..38
+y=601, x=426..428
+x=530, y=70..74
+y=1099, x=581..598
+y=342, x=466..468
+x=512, y=1094..1096
+x=568, y=984..995
+y=32, x=599..618
+y=1720, x=590..608
+x=365, y=630..641
+y=1571, x=453..466
+y=492, x=617..624
+y=1301, x=341..359
+x=536, y=777..784
+x=589, y=1051..1052
+x=429, y=802..819
+y=1397, x=469..471
+x=620, y=627..645
+y=1431, x=557..576
+y=785, x=503..529
+y=1269, x=402..404
+y=940, x=419..458
+x=590, y=1024..1039
+x=345, y=1576..1579
+x=387, y=287..306
+x=628, y=137..162
+x=336, y=641..646
+x=624, y=1651..1661
+y=944, x=505..511
+x=481, y=989..999
+x=369, y=1595..1608
+y=858, x=317..322
+x=302, y=260..276
+x=347, y=766..769
+x=599, y=1665..1667
+x=561, y=1384..1393
+x=354, y=1345..1357
+y=330, x=530..554
+x=614, y=1708..1719
+y=420, x=540..555
+x=313, y=1011..1029
+x=297, y=1074..1096
+x=362, y=765..769
+y=1409, x=579..595
+y=287, x=585..588
+x=594, y=1024..1039
+y=247, x=504..519
+x=448, y=616..637
+y=210, x=542..566
+x=629, y=666..681
+x=383, y=832..834
+y=238, x=300..324
+x=364, y=1347..1361
+y=405, x=466..478
+y=35, x=494..499
+x=611, y=1553..1556
+y=993, x=540..552
+y=1667, x=342..349
+x=592, y=300..313
+x=563, y=916..934
+x=471, y=1239..1256
+x=463, y=89..98
+x=472, y=1319..1321
+x=373, y=1556..1560
+x=566, y=218..229
+y=617, x=516..540
+y=249, x=415..441
+x=426, y=1177..1182
+y=816, x=400..421
+x=319, y=117..140
+y=821, x=311..315
+y=1563, x=358..381
+y=1143, x=346..357
+x=546, y=777..784
+x=300, y=213..238
+x=417, y=861..885
+x=604, y=1292..1314
+x=389, y=1533..1552
+y=1661, x=618..624
+y=160, x=390..399
+y=542, x=494..500
+y=669, x=504..526
+x=549, y=175..193
+x=412, y=1262..1272
+x=457, y=339..356
+x=400, y=435..454
+x=521, y=1173..1185
+y=1142, x=614..633
+x=392, y=599..621
+x=514, y=1112..1126
+x=618, y=119..142
+y=44, x=486..505
+x=490, y=372..384
+y=355, x=564..581
+x=305, y=694..715
+y=1548, x=559..572
+y=481, x=334..347
+x=583, y=1532..1557
+y=396, x=548..564
+x=400, y=811..816
+x=423, y=361..387
+x=411, y=334..337
+y=1531, x=302..321
+x=570, y=445..455
+x=394, y=1637..1645
+x=468, y=801..811
+x=538, y=1506..1533
+y=454, x=400..423
+x=561, y=1437..1448
+y=585, x=364..377
+x=503, y=219..224
+x=555, y=1303..1317
+x=616, y=609..617
+y=824, x=311..315
+x=543, y=1166..1176
+x=305, y=1594..1604
+x=301, y=288..305
+y=1567, x=418..432
+y=1546, x=473..492
+y=1210, x=499..516
+y=748, x=491..511
+y=1256, x=464..471
+x=411, y=146..164
+y=1248, x=518..520
+x=473, y=1699..1702
+y=347, x=466..468
+x=318, y=1149..1167
+y=155, x=334..358
+x=490, y=677..689
+y=1311, x=623..625
+x=408, y=53..80
+y=1056, x=318..322
+y=1372, x=382..409
+x=434, y=84..91
+x=352, y=865..872
+x=483, y=373..384
+y=1418, x=334..354
+y=387, x=514..534
+x=355, y=1516..1518
+x=391, y=688..701
+y=38, x=318..322
+y=195, x=583..590
+x=363, y=1370..1380
+y=1577, x=493..499
+y=1194, x=608..610
+x=605, y=968..992
+x=531, y=40..56
+y=460, x=475..478
+x=384, y=147..164
+x=353, y=1285..1291
+x=615, y=1590..1599
+x=381, y=1549..1563
+x=497, y=473..492
+x=552, y=984..993
+y=959, x=539..551
+y=65, x=466..479
+x=318, y=1053..1056
+x=568, y=182..186
+x=342, y=1598..1621
+y=1493, x=470..490
+x=609, y=928..942
+y=290, x=578..597
+y=467, x=303..320
+x=457, y=1698..1702
+x=460, y=492..506
+x=588, y=367..369
+x=470, y=1489..1493
+y=1438, x=344..367
+x=544, y=1132..1143
+x=473, y=1280..1297
+x=566, y=320..334
+x=402, y=1267..1269
+y=1215, x=590..605
+x=358, y=1532..1544
+x=625, y=1301..1311
+y=999, x=478..481
+x=514, y=811..817
+x=384, y=940..944
+y=74, x=530..539
+x=542, y=1036..1039
+y=899, x=443..494
+y=426, x=464..466
+x=358, y=128..155
+x=419, y=927..940
+x=505, y=645..647
+y=452, x=620..631
+x=520, y=1134..1146
+x=454, y=947..956
+x=456, y=738..748
+x=592, y=667..669
+y=229, x=394..406
+x=444, y=1514..1520
+x=375, y=1674..1684
+y=1338, x=350..539
+x=340, y=1463..1474
+y=91, x=434..447
+y=418, x=609..613
+x=574, y=179..189
+x=612, y=224..251
+x=595, y=1188..1202
+x=356, y=585..595
+y=1228, x=406..424
+y=1540, x=339..344
+y=1291, x=351..353
+x=338, y=1387..1399
+x=518, y=407..426
+y=1182, x=467..479
+y=413, x=325..342
+y=1407, x=621..624
+x=346, y=1511..1525
+y=1449, x=373..375
+x=361, y=1516..1518
+x=355, y=1430..1435
+y=1164, x=626..632
+x=530, y=733..734
+x=364, y=1556..1560
+y=798, x=505..526
+x=506, y=1043..1058
+x=492, y=801..808
+x=438, y=10..21
+x=460, y=89..98
+x=480, y=1422..1426
+y=1192, x=608..610
+y=1588, x=475..486
+y=637, x=443..448
+y=1090, x=540..562
+x=586, y=297..310
+y=420, x=609..613
+y=715, x=303..305
+x=583, y=1050..1052
+x=302, y=983..993
+x=432, y=1402..1406
+y=1710, x=589..606
+x=560, y=256..268
+x=551, y=953..959
+x=494, y=1090..1104
+y=1501, x=401..418
+x=603, y=412..425
+x=593, y=1171..1178
+y=1079, x=350..352
+x=385, y=1527..1543
+x=485, y=1010..1021
+y=80, x=408..427
+x=371, y=109..117
+x=454, y=1245..1255
+y=944, x=384..412
+x=524, y=1550..1560
+y=989, x=327..341
+y=69, x=314..316
+x=370, y=1511..1525
+y=1476, x=524..543
+x=330, y=1465..1477
+y=1317, x=528..555
+y=727, x=582..591
+x=409, y=1363..1372
+x=609, y=1022..1025
+y=240, x=333..340
+y=1165, x=425..428
+x=534, y=384..387
+x=515, y=219..224
+x=485, y=854..856
+x=377, y=876..882
+x=543, y=431..434
+y=602, x=322..330
+x=464, y=1238..1256
+x=400, y=1537..1544
+x=482, y=1375..1398
+x=315, y=1611..1625
+x=613, y=1040..1061
+x=436, y=1457..1471
+x=378, y=1593..1604
+x=535, y=431..434
+x=344, y=1536..1540
+y=1630, x=409..420
+x=546, y=1511..1536
+y=101, x=453..471
+x=615, y=666..681
+y=981, x=405..470
+y=1455, x=373..375
+x=550, y=11..24
+x=403, y=1418..1437
+y=76, x=413..420
+x=604, y=718..720
+x=422, y=1520..1526
+x=541, y=917..934
+y=706, x=486..493
+x=413, y=221..226
+x=504, y=375..378
+x=598, y=361..372
+x=472, y=821..832
+x=413, y=61..76
+y=149, x=590..595
+y=1725, x=415..428
+x=443, y=1356..1368
+x=334, y=1342..1345
+x=367, y=1427..1438
+y=1552, x=389..407
+x=426, y=492..494
+x=480, y=163..166
+x=527, y=76..87
+y=733, x=371..381
+x=502, y=871..890
+x=511, y=1265..1271
+x=576, y=299..313
+x=590, y=1206..1215
+x=537, y=1436..1448
+x=353, y=251..265
+x=579, y=1392..1409
+y=130, x=560..574
+y=1427, x=598..623
+y=1291, x=548..554
+x=392, y=1657..1667
+y=1396, x=550..576
+x=528, y=39..56
+x=605, y=1422..1424
+x=417, y=481..499
+x=564, y=344..355
+x=321, y=1241..1252
+x=315, y=1571..1585
+x=481, y=1028..1042
+y=907, x=353..356
+x=342, y=1665..1667
+x=436, y=107..134
+x=322, y=593..602
+y=481, x=313..331
+y=1625, x=295..315
+x=539, y=69..74
+y=1368, x=588..592
+y=1474, x=340..343
+x=405, y=967..981
+x=301, y=763..789
+y=162, x=623..628
+y=738, x=394..419
+y=1351, x=295..310
+y=1398, x=482..485
+x=356, y=1345..1357
+x=541, y=1512..1536
+x=307, y=287..305
+y=426, x=502..518
+y=834, x=383..392
+y=119, x=593..600
+x=561, y=1129..1132
+x=314, y=69..73
+x=569, y=760..788
+x=515, y=1307..1320
+y=280, x=307..311
+x=583, y=146..162
+x=312, y=1196..1208
+y=1604, x=305..322
+x=296, y=1681..1683
+y=34, x=400..424
+x=554, y=204..207
+x=367, y=329..332
+y=1479, x=370..393
+x=562, y=507..530
+x=326, y=1549..1563
+x=344, y=1427..1438
+x=451, y=1536..1538
+x=554, y=317..330
+y=142, x=604..618
+x=331, y=1599..1621
+y=1039, x=539..542
+y=337, x=408..411
+y=1643, x=354..356
+x=577, y=983..995
+y=1608, x=369..385
+x=346, y=1371..1380
+y=1368, x=421..425
+x=363, y=330..332
+x=504, y=659..669
+y=85, x=378..391
+x=494, y=1332..1335
+y=163, x=477..480
+x=589, y=667..669
+x=498, y=1379..1393
+y=859, x=471..491
+x=334, y=1133..1144
+x=614, y=1605..1614
+y=1345, x=594..603
+x=434, y=824..826
+x=381, y=714..733
+y=247, x=548..566
+y=1673, x=474..489
+x=429, y=908..918
+x=431, y=292..295
+x=621, y=1591..1599
+x=337, y=1637..1652
+x=509, y=1423..1446
+x=574, y=792..799
+y=1671, x=380..398
+x=303, y=1012..1029
+x=442, y=949..959
+y=431, x=535..543
+x=516, y=1196..1210
+y=268, x=560..578
+x=404, y=1294..1319
+y=266, x=591..619
+y=1063, x=382..496
+y=1683, x=296..299
+x=299, y=1682..1683
+x=309, y=1241..1252
+x=449, y=801..819
+y=967, x=316..344
+x=336, y=1149..1167
+x=579, y=579..582
+x=295, y=116..140
+y=276, x=300..302
+x=478, y=390..405
+y=992, x=605..612
+y=328, x=490..497
+x=302, y=1528..1531
+y=212, x=467..471
+y=1210, x=447..449
+y=428, x=380..393
+y=1022, x=605..609
+x=460, y=1215..1223
+x=347, y=1691..1696
+y=499, x=417..420
+y=1204, x=508..510
+x=610, y=1256..1270
+x=546, y=1166..1176
+x=393, y=1390..1412
+y=350, x=618..622
+y=1448, x=537..561
+y=366, x=397..417
+y=87, x=505..527
+x=464, y=824..836
+x=508, y=1692..1697
+y=1409, x=423..438
+x=347, y=1153..1161
+x=347, y=461..481
+y=595, x=343..356
+y=1086, x=553..556
+y=1210, x=415..417
+y=1406, x=430..432
+x=556, y=1480..1507
+y=492, x=497..517
+x=356, y=1639..1643
+x=614, y=1133..1142
+y=332, x=363..367
+x=586, y=993..1006
+x=329, y=89..111
+x=370, y=1468..1479
+x=424, y=23..34
+x=629, y=367..394
+y=519, x=598..623
+x=493, y=618..630
+x=468, y=342..347
+x=369, y=524..526
+x=478, y=1008..1018
+x=554, y=1281..1291
+x=532, y=527..537
+x=450, y=217..231
+x=590, y=180..195
+x=511, y=918..944
+x=352, y=736..756
+x=553, y=1168..1180
+x=599, y=16..32
+x=418, y=273..278
+y=621, x=383..392
+x=499, y=1568..1577
+x=479, y=338..356
+y=913, x=324..327
+x=438, y=1395..1409
+x=344, y=911..937
+y=755, x=518..525
+x=372, y=599..625
+y=1255, x=436..454
+x=423, y=218..231
+y=1560, x=516..524
+x=548, y=1281..1291
+x=560, y=108..130
+y=749, x=422..436
+x=515, y=10..23
+y=1077, x=383..394
+y=1273, x=549..564
+x=382, y=1363..1372
+x=313, y=471..481
+y=1294, x=542..560
+x=380, y=100..120
+x=558, y=381..393
+x=610, y=744..772
+y=315, x=399..416
+x=420, y=834..850
+y=942, x=603..609
+y=1000, x=395..411
+y=134, x=430..436
+x=484, y=1221..1234
+y=1504, x=468..470
+x=463, y=1498..1518
+x=359, y=1281..1301
+y=111, x=306..329
+x=524, y=250..266
+x=410, y=609..635
+y=734, x=530..544
+x=371, y=1714..1727
+x=416, y=306..315
+x=445, y=1356..1368
+y=154, x=590..595
+x=359, y=100..120
+y=1520, x=444..447
+x=602, y=1488..1493
+y=1481, x=307..312
+y=662, x=342..370
+x=509, y=346..349
+y=687, x=324..351
+x=512, y=345..349
+x=347, y=1016..1021
+x=540, y=1070..1090
+x=311, y=821..824
+y=288, x=444..466
+x=489, y=1184..1199
+x=580, y=627..637
+x=417, y=363..366
+x=498, y=304..312
+y=182, x=429..453
+x=332, y=1231..1234
+x=422, y=727..749
+x=493, y=704..706
+y=1538, x=430..451
+x=475, y=1408..1412
+x=566, y=841..850
+x=470, y=967..981
+x=453, y=91..101
+x=431, y=1073..1076
+x=334, y=1483..1495
+y=326, x=539..548
+y=186, x=375..379
+x=428, y=594..601
+x=585, y=274..287
+x=467, y=209..212
+y=1633, x=478..483
+x=389, y=1417..1437
+x=471, y=209..212
+y=184, x=492..502
+x=463, y=759..772
+x=540, y=609..617
+x=333, y=215..240
+x=518, y=696..721
+x=483, y=1070..1082
+x=458, y=360..385
+y=1163, x=509..534
+x=370, y=630..641
+y=817, x=514..532
+x=386, y=173..191
+x=363, y=1637..1646
+x=370, y=1674..1684
+x=434, y=1155..1172
+y=189, x=557..574
+x=364, y=563..585
+y=310, x=584..586
+x=562, y=18..20
+y=769, x=347..362
+x=601, y=853..869
+y=1234, x=320..332
+y=694, x=443..449
+x=417, y=1206..1210
+x=345, y=1592..1605
+x=466, y=284..288
+x=461, y=1441..1467
+x=394, y=723..738
+y=1020, x=429..448
+x=348, y=1405..1414
+x=485, y=596..609
+y=489, x=537..542
+x=608, y=1717..1720
+x=342, y=1636..1646
+x=328, y=735..756
+x=384, y=240..265
+x=541, y=1709..1727
+y=756, x=328..352
+x=505, y=736..745
+x=525, y=556..560
+x=379, y=1717..1730
+x=508, y=1070..1082
+x=621, y=1100..1120
+y=434, x=535..543
+y=954, x=583..591
+x=583, y=181..195
+y=1536, x=541..546
+x=428, y=1707..1725
+x=394, y=1203..1212
+x=460, y=230..235
+x=499, y=9..23
+x=621, y=412..425
+x=501, y=1437..1462
+x=427, y=54..80
+x=582, y=1664..1667
+x=312, y=983..993
+x=408, y=334..337
+x=558, y=235..244
+x=328, y=1485..1498
+x=394, y=777..781
+y=815, x=329..341
+x=528, y=1241..1255
+x=576, y=1639..1642
+y=1286, x=504..523
+x=581, y=1252..1264
+x=334, y=1407..1418
+x=404, y=1267..1269
+y=1645, x=431..442
+x=361, y=1015..1021
+x=448, y=133..146
+x=519, y=246..247
+x=591, y=1219..1243
+x=385, y=1596..1608
+x=557, y=366..368
+y=1401, x=585..587
+x=532, y=810..817
+x=579, y=1352..1371
+x=570, y=1252..1264
+x=608, y=1192..1194
+y=506, x=460..481
+x=588, y=274..287
+x=577, y=1437..1456
+x=566, y=197..210
+y=1272, x=394..412
+y=635, x=410..419
+x=592, y=367..369
+x=406, y=522..525
+x=569, y=1490..1505
+y=265, x=378..384
+x=430, y=1677..1694
+y=1642, x=576..578
+x=389, y=1349..1352
+x=605, y=1488..1493
+y=704, x=464..466
+x=384, y=39..53
+x=623, y=1412..1427
+x=478, y=989..999
+x=344, y=951..967
+x=466, y=342..347
+x=529, y=1637..1658
+x=510, y=1094..1096
+x=378, y=65..85
+x=549, y=723..728
+y=1180, x=535..553
+y=1176, x=543..546
+y=1399, x=338..352
+y=745, x=502..505
+y=1498, x=328..345
+x=463, y=633..653
+x=578, y=680..694
+x=602, y=1533..1536
+y=1621, x=373..375
+x=478, y=1619..1633
+y=1623, x=373..375
+y=1402, x=430..432
+x=419, y=610..635
+x=590, y=1716..1720
+x=336, y=700..713
+x=470, y=1504..1511
+x=383, y=599..621
+x=307, y=259..280
+x=348, y=136..147
+x=322, y=819..836
+x=635, y=573..585
+y=387, x=423..445
+x=413, y=274..278
+x=590, y=1436..1456
+x=578, y=523..525
+x=453, y=1546..1571
+x=612, y=967..992
+y=1185, x=501..521
+x=388, y=1202..1212
+x=406, y=1203..1228
+x=509, y=1154..1163
+x=369, y=137..150
+x=528, y=1530..1533
+x=607, y=610..617
+x=455, y=1192..1217
+y=701, x=369..391
+x=353, y=892..907
+x=479, y=1158..1182
+x=443, y=889..899
+x=428, y=1165..1167
+x=389, y=315..324
+y=48, x=568..582
+y=1199, x=489..493
+y=890, x=502..520
+y=959, x=442..460
+x=617, y=477..492
+x=524, y=1265..1271
+x=601, y=719..720
+y=265, x=345..353
+x=345, y=1486..1498
+y=1178, x=593..608
+x=330, y=593..602
+y=525, x=395..406
+y=1687, x=363..381
+x=539, y=952..959
+x=584, y=832..839
+x=509, y=305..312
+x=462, y=1319..1321
+x=509, y=1221..1234
+x=396, y=463..466
+x=580, y=1109..1115
+x=585, y=489..498
+x=565, y=1197..1219
+y=498, x=568..585
+y=209, x=344..350
+y=1120, x=614..621
+y=1652, x=329..337
+x=305, y=58..78
+y=1161, x=347..349
+y=956, x=452..454
+y=1096, x=297..306
+x=511, y=779..782
+y=1605, x=345..349
+y=741, x=295..300
+x=582, y=709..727
+x=615, y=1017..1030
+x=305, y=561..563
+y=1146, x=537..557
+x=571, y=1639..1656
+y=875, x=344..362
+x=505, y=75..87
+y=473, x=541..609
+y=565, x=512..532
+y=689, x=470..487
+y=772, x=463..486
+x=387, y=482..505
+x=315, y=1341..1345
+x=602, y=367..394
+x=572, y=1522..1548
+x=350, y=136..147
+x=458, y=927..940
+x=310, y=1041..1064
+x=551, y=1701..1720
+y=815, x=461..478
+x=505, y=32..44
+x=447, y=83..91
+y=419, x=410..419
+y=1172, x=416..434
+x=433, y=861..885
+x=380, y=421..428
+y=1666, x=613..630
+y=215, x=459..477
+x=397, y=363..366
+x=429, y=1504..1525
+x=376, y=1593..1604
+x=561, y=1644..1652
+x=295, y=714..741
+y=1219, x=538..565
+x=583, y=1296..1308
+x=550, y=1380..1396
+x=391, y=65..85
+x=566, y=182..186
+x=494, y=51..65
+y=56, x=528..531
+x=494, y=1616..1627
+x=468, y=872..876
+y=1039, x=590..594
+y=120, x=359..380
+x=466, y=391..405
+x=453, y=823..826
+x=430, y=1535..1538
+x=573, y=342..351
+y=186, x=566..568
+x=317, y=840..858
+x=503, y=429..450
+y=1404, x=380..387
+x=490, y=1382..1393
+y=305, x=301..307
+x=593, y=114..119
+x=520, y=1239..1248
+x=582, y=1238..1240
+y=1064, x=310..329
+y=1240, x=582..584
+x=620, y=720..734
+x=603, y=1007..1011
+x=375, y=1621..1623
+y=1597, x=412..428
+y=20, x=506..508
+y=356, x=457..479
+y=1656, x=547..571
+y=748, x=456..475
+y=1202, x=342..351
+x=464, y=717..729
+x=577, y=360..372
+x=386, y=90..97
+x=447, y=493..494
+x=455, y=361..385
+y=458, x=496..522
+x=595, y=149..154
+x=547, y=1638..1656
+x=609, y=462..473
+x=538, y=1197..1219
+x=595, y=1393..1409
+x=562, y=443..450
+x=391, y=1028..1042
+x=307, y=1617..1621
+x=453, y=180..182
+x=389, y=875..882
+x=374, y=109..117
+x=329, y=1636..1652
+x=515, y=1689..1707
+x=499, y=1617..1627
+y=832, x=472..474
+y=1618, x=438..445
+x=530, y=318..330
+y=518, x=524..541
+y=65, x=494..516
+x=488, y=814..831
+y=1614, x=614..621
+x=514, y=1179..1182
+x=389, y=28..31
+y=29, x=606..608
+x=496, y=1495..1500
+x=458, y=1441..1467
+y=1006, x=586..591
+x=586, y=814..823
+x=336, y=404..406
+x=497, y=375..378
+x=303, y=463..467
+x=570, y=362..376
+x=466, y=1545..1571
+x=344, y=1550..1563
+y=1476, x=375..383
+x=605, y=86..99
+x=500, y=976..997
+x=576, y=657..675
+x=307, y=1120..1122
+y=1021, x=468..485
+y=496, x=594..611
+x=606, y=25..29
+y=376, x=371..393
+x=432, y=1551..1567
+x=450, y=908..918
+x=447, y=1514..1520
+y=1107, x=571..575
+y=455, x=552..570
+x=575, y=1218..1243
+x=509, y=1242..1255
+x=508, y=7..20
+y=1167, x=425..428
+x=603, y=832..839
+x=399, y=157..160
+y=1544, x=332..358
+y=1621, x=303..307
+x=421, y=1366..1368
+y=329, x=354..358
+x=623, y=505..519
+y=525, x=569..578
+x=450, y=1037..1039
+y=21, x=438..442
+x=400, y=671..689
+y=92, x=556..558
+y=609, x=485..505
+x=441, y=239..249
+x=578, y=1021..1048
+y=1518, x=355..361
+x=406, y=211..229
+y=1082, x=483..508
+x=375, y=29..31
+x=447, y=1207..1210
+x=452, y=568..590
+y=1030, x=599..615
+y=702, x=404..410
+x=512, y=552..565
+x=306, y=90..111
+x=552, y=1644..1652
+y=330, x=440..454
+x=397, y=1537..1544
+y=191, x=365..386
+y=1687, x=614..628
+x=453, y=419..433
+x=471, y=1374..1397
+x=494, y=800..808
+y=1029, x=303..313
+x=357, y=1682..1699
+x=330, y=562..563
+x=380, y=1660..1671
+x=306, y=1075..1096
+y=170, x=440..564
+x=392, y=897..911
+y=1361, x=348..364
+x=498, y=574..585
+x=370, y=657..662
+x=613, y=418..420
+x=516, y=641..650
+x=524, y=1456..1476
+y=788, x=555..569
+x=630, y=1644..1666
+y=1308, x=583..592
+y=25, x=606..608
+x=537, y=1134..1146
+y=1352, x=381..389
+x=508, y=1194..1204
+y=166, x=477..480
+x=416, y=1156..1172
+y=1511, x=468..470
+x=378, y=1040..1046
+x=556, y=1074..1086
+x=425, y=1165..1167
+x=609, y=418..420
+y=669, x=589..592
+y=1397, x=585..587
+x=587, y=685..687
+x=385, y=481..505
+x=501, y=1174..1185
+x=360, y=1041..1046
+x=603, y=1544..1561
+x=560, y=1284..1294
+x=336, y=1251..1256
+x=505, y=791..798
+x=381, y=1527..1543
+x=502, y=736..745
+y=466, x=373..396
+x=510, y=1194..1204
+x=341, y=793..815
+y=1495, x=334..339
+x=357, y=1368..1377
+x=540, y=406..420
+x=538, y=530..542
+x=490, y=317..328
+x=300, y=714..741
+x=628, y=1676..1687
+y=867, x=527..552
+y=1182, x=422..426
+y=1426, x=480..502
+x=350, y=195..209
+x=428, y=1570..1597
+x=300, y=156..181
+x=425, y=1367..1368
+y=1526, x=416..422
+x=303, y=694..715
+x=324, y=214..238
+x=468, y=1011..1021
+x=397, y=550..567
+x=518, y=731..755
+x=371, y=1389..1412
+x=625, y=719..734
+y=146, x=448..549
+x=586, y=626..637
+x=589, y=1698..1710
+y=123, x=462..541
+x=539, y=1036..1039
+x=624, y=478..492
+x=614, y=1342..1356
+y=1645, x=387..394
+x=618, y=15..32
+x=513, y=1496..1500
+x=321, y=1196..1208
+y=162, x=583..602
+x=474, y=821..832
+x=605, y=1022..1025
+x=416, y=1683..1686
+x=532, y=552..565
+x=333, y=1547..1560
+x=474, y=252..257
+y=1576, x=345..361
+x=614, y=1100..1120
+x=442, y=1627..1645
+y=532, x=389..414
+x=396, y=671..689
+y=425, x=603..621
+x=469, y=1373..1397
+x=349, y=49..71
+y=1686, x=416..420
+x=456, y=57..60
+x=461, y=803..815
+x=598, y=1413..1427
+x=353, y=1430..1435
+x=455, y=1589..1596
+y=181, x=300..312
+x=295, y=1611..1625
+y=650, x=466..516
+y=251, x=612..622
+x=373, y=286..306
+x=602, y=657..675
+x=449, y=685..694
+y=1720, x=551..577
+x=486, y=760..772
+x=633, y=1364..1385
+x=360, y=1156..1165
+y=372, x=577..598
+y=1165, x=342..360
+y=71, x=620..625
+x=310, y=1348..1351
+x=457, y=867..881
+y=695, x=378..381
+y=1435, x=353..355
+x=534, y=1507..1533
+x=591, y=947..954
+x=549, y=1017..1044
+x=346, y=1132..1143
+x=409, y=222..226
+x=530, y=1017..1044
+y=1021, x=347..361
+x=524, y=505..518
+x=550, y=481..493
+x=550, y=834..841
+y=850, x=557..566
+y=1285, x=351..353
+x=395, y=988..1000
+x=555, y=381..393
+y=1101, x=376..422
+y=1507, x=556..560
+x=342, y=1155..1165
+x=530, y=1529..1533
+x=487, y=991..1002
+y=1467, x=458..461
+x=478, y=449..460
+x=598, y=505..519
+x=350, y=1328..1338
+y=339, x=340..348
+x=330, y=1158..1162
+x=369, y=1571..1585
+x=565, y=813..823
+x=516, y=1550..1560
+x=454, y=325..330
+x=584, y=1238..1240
+y=394, x=602..629
+x=343, y=1463..1474
+y=23, x=499..515
+x=575, y=1104..1107
+y=1104, x=502..522
+x=548, y=67..68
+y=560, x=523..525
+y=530, x=358..379
+x=376, y=1098..1101
+x=581, y=1073..1099
+x=630, y=338..353
+x=354, y=949..975
+x=348, y=315..339
+x=525, y=731..755
+y=1596, x=443..455
+y=1332, x=494..508
+y=734, x=620..625
+x=499, y=1197..1210
+y=1730, x=359..379
+x=462, y=110..123
+x=604, y=119..142
+x=395, y=522..525
+y=974, x=431..449
+x=371, y=524..526
+x=486, y=704..706
+y=1345, x=315..334
+x=571, y=1103..1107
+x=502, y=177..184
+x=421, y=810..816
+y=1496, x=596..617
+x=331, y=470..481
+x=624, y=1391..1407
+x=494, y=888..899
+x=614, y=626..645
+y=1192, x=561..568
+x=411, y=988..1000
+y=1393, x=561..566
+x=388, y=131..136
+x=451, y=632..653
+x=361, y=1697..1709
+x=584, y=853..869
+x=359, y=1716..1730
+x=527, y=865..867
+y=993, x=302..312
+y=1414, x=346..348
+y=20, x=560..562
+y=839, x=584..603
+y=349, x=509..512
+y=207, x=552..554
+y=1699, x=329..357
+x=430, y=108..134
+y=1727, x=527..541
+x=510, y=1379..1393
+x=471, y=73..82
+x=528, y=176..193
+y=351, x=570..573
+y=902, x=576..596
+y=728, x=549..568
+x=485, y=1374..1398
+x=576, y=1411..1431
+y=295, x=425..431
+y=687, x=584..587
+y=823, x=565..586
+x=410, y=1315..1324
+x=466, y=57..65
+x=358, y=312..329
+x=557, y=180..189
+y=1500, x=496..513
+y=544, x=301..306
+x=371, y=1493..1495
+x=594, y=483..496
+x=486, y=645..647
+x=502, y=1421..1426
+x=477, y=205..215
+x=577, y=1702..1720
+y=1264, x=570..581
+y=1495, x=367..371
+x=452, y=947..956
+y=637, x=580..586
+x=592, y=1364..1368
+x=560, y=1480..1507
+x=542, y=484..489
+y=523, x=569..578
+x=348, y=1348..1361
+x=312, y=157..181
+x=490, y=1488..1493
+x=549, y=1255..1273
+x=568, y=722..728
+x=619, y=262..266
+x=508, y=1332..1335
+y=647, x=486..505
+y=385, x=455..458
+x=528, y=1439..1442
+x=510, y=1179..1182
+x=568, y=11..24
+y=1652, x=552..561
+x=502, y=1090..1104
+y=1553, x=609..611
+y=1696, x=347..349
+x=493, y=1568..1577
+x=311, y=765..787
+x=581, y=345..355
+x=474, y=1656..1673
+x=483, y=1408..1412
+y=831, x=486..488
+y=819, x=429..449
+y=505, x=385..387
+y=1132, x=561..583
+y=98, x=460..463
+x=329, y=59..78
+x=381, y=1676..1687
+y=918, x=429..450
+y=368, x=557..560
+y=1646, x=342..363
+y=1707, x=496..515
+x=601, y=481..493
+y=1691, x=347..349
+y=645, x=486..505
+x=419, y=142..158
+x=400, y=24..34
+x=608, y=1109..1115
+x=570, y=913..916
+x=419, y=399..419
+x=559, y=1523..1548
+x=597, y=277..290
+x=480, y=823..836
+x=622, y=190..194
+x=560, y=18..20
+x=526, y=1439..1442
+x=618, y=1651..1661
+x=392, y=831..834
+x=479, y=58..65
+x=527, y=1708..1727
+x=473, y=1008..1018
+x=517, y=473..492
+x=306, y=517..544
+x=578, y=87..99
+x=608, y=25..29
+x=389, y=1657..1667
+x=586, y=219..229
+x=621, y=1391..1407
+x=449, y=972..974
+y=1324, x=410..431
+y=1556, x=609..611
+x=364, y=394..398
+y=1044, x=530..549
+x=342, y=1194..1202
+x=349, y=1153..1161
+x=371, y=713..733
+x=371, y=138..150
+x=479, y=1499..1518
+y=1621, x=331..342
+x=552, y=204..207
+x=430, y=1402..1406
+y=1393, x=498..510
+x=468, y=1504..1511
+y=1243, x=575..591
+x=494, y=529..542
+y=856, x=481..485
+y=353, x=610..630
+x=390, y=157..160
+x=420, y=61..76
+x=494, y=35..37
+x=312, y=1133..1144
+x=369, y=1091..1104
+x=381, y=1488..1502
+x=315, y=821..824
+x=522, y=529..542
+x=511, y=739..748
+x=505, y=917..944
+x=608, y=1422..1424
+x=466, y=422..426
+x=357, y=1133..1143
+x=398, y=1659..1671
+x=620, y=1532..1536
+x=623, y=1301..1311
+x=539, y=1327..1338
+x=578, y=276..290
+x=443, y=684..694
+x=535, y=1169..1180
+y=1162, x=327..330
+y=78, x=305..329
+y=1533, x=534..538
+x=477, y=163..166
+x=364, y=1714..1727
+y=729, x=464..491
+y=934, x=541..563
+y=1256, x=336..355
+x=572, y=1594..1614
+x=491, y=846..859
+x=341, y=1280..1301
+y=781, x=368..394
+y=1314, x=577..604
+x=466, y=640..650
+y=1709, x=361..378
+y=934, x=577..591
+y=916, x=570..587
+y=406, x=330..336
+y=334, x=566..586
+x=518, y=1637..1658
+y=164, x=384..411
+y=224, x=576..578
+x=467, y=569..590
+y=376, x=550..570
+y=1061, x=610..613
+x=475, y=739..748
+x=466, y=801..811
+x=591, y=994..1006
+y=675, x=576..602
+x=475, y=1260..1274
+x=550, y=363..376
+x=375, y=184..186
+y=1238, x=582..584
+y=1614, x=567..572
+y=384, x=483..490
+x=489, y=1655..1673
+x=523, y=1282..1286
+y=303, x=527..543
+x=332, y=1533..1544
+x=471, y=847..859
+x=384, y=550..567
+x=546, y=1132..1143
+x=580, y=601..612
+x=528, y=1304..1317
+y=841, x=526..550
+y=494, x=426..447
+y=1462, x=501..503
+y=136, x=388..392
+y=37, x=494..499
+y=881, x=457..484
+x=422, y=1098..1101
+x=365, y=173..191
+x=354, y=1639..1643
+y=450, x=559..562
+y=1502, x=358..381
+y=787, x=311..331
+y=1412, x=475..483
+x=338, y=1547..1560
+x=303, y=1617..1621
+y=1384, x=561..566
+x=459, y=206..215
+x=491, y=738..748
+x=418, y=1494..1501
+x=552, y=428..438
+x=506, y=7..20
+y=1368, x=533..552
+x=617, y=1470..1496
+x=445, y=1606..1618
+x=474, y=618..630
+x=378, y=316..324
+x=506, y=429..450
+x=600, y=1351..1371
+y=1525, x=429..456
+x=422, y=1456..1471
+x=541, y=462..473
+x=418, y=1551..1567
+y=692, x=378..381
+x=324, y=887..913
+y=1561, x=603..618
+x=436, y=1244..1255
+y=117, x=371..374
+y=1471, x=588..591
+y=1667, x=389..392
+y=484, x=537..542
+y=567, x=384..397
+x=316, y=69..73
+x=568, y=490..498
+x=493, y=1184..1199
+x=354, y=313..329
+y=832, x=360..373
+y=811, x=466..468
+x=380, y=1404..1409
+x=600, y=744..772
+y=1002, x=470..487
+y=1202, x=595..618
+x=562, y=1069..1090
+x=599, y=1016..1030
+x=622, y=348..350
+x=614, y=1677..1687
+x=370, y=1695..1705
+x=347, y=599..625
+x=605, y=1206..1215
+x=449, y=1207..1210
+x=316, y=951..967
+y=1514, x=444..447
+x=420, y=1603..1630
+x=408, y=552..573
+x=534, y=1422..1446
+x=402, y=553..573
+x=464, y=422..426
+x=576, y=216..224
+x=351, y=1285..1291
+y=312, x=498..509
+x=497, y=316..328
+x=327, y=982..989
+x=304, y=763..789
+y=789, x=301..304
+x=542, y=196..210
+x=349, y=1466..1477
+x=423, y=1395..1409
+x=329, y=1041..1064
+x=431, y=1627..1645
+y=31, x=375..389
+y=1442, x=526..528
+x=542, y=1283..1294
+x=520, y=872..890
+x=423, y=434..454
+y=826, x=434..453
+x=505, y=596..609
+x=416, y=1519..1526
+x=606, y=1699..1710
+x=424, y=1204..1228
+x=407, y=1534..1552
+x=631, y=440..452
+y=1560, x=364..373
+y=1627, x=494..499
+x=576, y=1381..1396
+y=1167, x=318..336
+x=320, y=464..467
+y=1456, x=577..590
+y=404, x=330..336
+x=344, y=194..209
+x=466, y=701..704
+x=593, y=1532..1557
+x=311, y=259..280
+y=872, x=352..356
+x=443, y=1590..1596
+x=518, y=1043..1058
+x=587, y=913..916
+y=459, x=301..325
+x=473, y=1542..1546
+x=574, y=108..130
+x=483, y=1620..1633
+y=784, x=536..546
+x=464, y=702..704
+y=772, x=600..610
+x=360, y=1134..1146
+y=226, x=409..413
+x=584, y=297..310
+y=1412, x=371..393
+y=140, x=295..319
+y=393, x=555..558
+y=1653, x=305..310
+x=633, y=1590..1599
+y=1493, x=602..605
+x=431, y=1315..1324
+x=557, y=1412..1431
+y=794, x=478..498
+y=1025, x=605..609
+y=1518, x=463..479
+x=516, y=51..65
+x=578, y=1638..1642
+y=1525, x=346..370
+x=481, y=854..856
+x=359, y=1066..1084
+y=1557, x=583..593
+x=472, y=418..433
+x=546, y=277..279
+x=305, y=1631..1653
+x=541, y=110..123
+x=573, y=921..929
+x=313, y=1266..1278
+x=449, y=334..354
+x=399, y=306..315
+x=441, y=1677..1694
+x=564, y=1256..1273
+x=557, y=842..850
+x=410, y=399..419
+y=1042, x=391..481
+y=1319, x=382..404
+x=564, y=158..170
+y=710, x=478..502
+y=1458, x=332..382
+x=378, y=1698..1709
+y=689, x=490..513
+x=613, y=1644..1666
+y=229, x=566..586
+y=1658, x=518..529
+x=522, y=1091..1104
+y=1377, x=353..357
+x=625, y=58..71
+x=350, y=911..937
+y=1320, x=515..520
+x=583, y=946..954
+y=653, x=451..463
+x=312, y=1461..1481
+x=544, y=732..734
+x=502, y=699..710
+x=594, y=579..582
+y=1274, x=475..542
+y=612, x=572..580
+x=491, y=975..997
+x=498, y=1634..1641
+x=387, y=1404..1409
+x=539, y=322..326
+x=521, y=1006..1025
+y=150, x=369..371
+y=1727, x=364..371
+y=279, x=533..546
+x=331, y=764..787
+x=568, y=1186..1192
+x=526, y=482..493
+x=393, y=421..428
+x=587, y=1397..1401
+y=438, x=527..552
+y=1212, x=388..394
+x=381, y=692..695
+x=441, y=56..60
+y=694, x=578..599
+y=1641, x=498..505
+y=1536, x=602..620
+y=1058, x=506..518
+x=624, y=190..194
+x=584, y=507..530
+x=608, y=1170..1178
+x=422, y=1178..1182
+x=564, y=384..396
+x=496, y=456..458
+x=382, y=1051..1063
+x=600, y=114..119
+y=582, x=579..594
+x=526, y=658..669
+x=361, y=1576..1579
+y=929, x=567..573
+x=431, y=1191..1217
+y=433, x=453..472
+x=556, y=89..92
+x=351, y=673..687
+x=338, y=50..71
+y=1076, x=431..435
+x=475, y=450..460
+y=799, x=574..594
+x=578, y=1491..1505
+x=555, y=760..788
+x=620, y=58..71
+x=358, y=510..530
+x=339, y=1483..1495
+x=537, y=1112..1126
+x=359, y=699..713
+y=68, x=548..552
+x=382, y=1640..1649
+x=567, y=920..929
+x=543, y=298..303
+x=379, y=184..186
+x=552, y=446..455
+x=609, y=1553..1556
+x=548, y=383..396
+x=369, y=689..701
+y=720, x=601..604
+x=322, y=1593..1604
+x=505, y=1692..1697
+x=346, y=1405..1414
+x=431, y=972..974
+y=1025, x=516..521
+x=591, y=925..934
+x=484, y=867..881
+y=721, x=518..520
+y=1356, x=614..618
+x=456, y=1503..1525
+y=524, x=332..335
+y=99, x=578..605
+x=371, y=370..376
+x=415, y=1707..1725
+x=422, y=1010..1021
+x=344, y=862..875
+x=426, y=593..601
+y=1649, x=382..402
+x=362, y=861..875
+x=610, y=1040..1061
+x=310, y=1632..1653
+y=1458, x=304..309
+x=576, y=895..902
+y=224, x=503..515
+y=515, x=530..533
+y=306, x=373..387
+x=394, y=212..229
+x=373, y=463..466
+y=97, x=386..405
+y=1297, x=462..473
+x=560, y=366..368
+x=425, y=293..295
+y=60, x=441..456
+x=463, y=1619..1640
+x=412, y=941..944
+x=529, y=774..785
+x=505, y=250..266
+x=504, y=1281..1286
diff --git a/src/17/part1 b/src/17/part1 new file mode 100644 index 0000000..ed0d74c --- /dev/null +++ b/src/17/part1 @@ -0,0 +1,177 @@ +--- Day 17: Reservoir Research --- + +You arrive in the year 18. If it weren't for the coat you got in 1018, you would be very cold: the +North Pole base hasn't even been constructed. + +Rather, it hasn't been constructed [1m[97myet[0m. The Elves are making a little progress, but there's not a +lot of liquid water in this climate, so they're getting very dehydrated. Maybe there's more +underground? + +You scan a two-dimensional vertical slice of the ground nearby and discover that it is mostly +[1m[97msand[0m with veins of [1m[97mclay[0m. The scan only provides data with a granularity of [1m[97msquare meters[0m, but it +should be good enough to determine how much water is trapped there. In the scan, x represents the +distance to the right, and y represents the distance down. There is also a [1m[97mspring of water[0m near the +surface at x=500, y=0. The scan identifies [1m[97mwhich square meters are clay[0m (your puzzle input). + +For example, suppose your scan shows the following veins of clay: + +x=495, y=2..7 +y=7, x=495..501 +x=501, y=3..7 +x=498, y=2..4 +x=506, y=1..2 +x=498, y=10..13 +x=504, y=10..13 +y=13, x=498..504 + +Rendering clay as #, sand as ., and the water spring as +, and with x increasing to the right and y +increasing downward, this becomes: + + 44444455555555 + 99999900000000 + 45678901234567 + 0 ......+....... + 1 ............#. + 2 .#..#.......#. + 3 .#..#..#...... + 4 .#..#..#...... + 5 .#.....#...... + 6 .#.....#...... + 7 .#######...... + 8 .............. + 9 .............. +10 ....#.....#... +11 ....#.....#... +12 ....#.....#... +13 ....#######... + +The spring of water will produce water [1m[97mforever[0m. Water can move through sand, but is blocked by clay. +Water [1m[97malways moves down[0m when possible, and spreads to the left and right otherwise, filling space +that has clay on both sides and falling out otherwise. + +For example, if five squares of water are created, they will flow downward until they reach the clay +and settle there. Water that has come to rest is shown here as ~, while sand through which water has +passed (but which is now dry again) is shown as |: + +......+....... +......|.....#. +.#..#.|.....#. +.#..#.|#...... +.#..#.|#...... +.#....|#...... +.#~~~~~#...... +.#######...... +.............. +.............. +....#.....#... +....#.....#... +....#.....#... +....#######... + +Two squares of water can't occupy the same location. If another five squares of water are created, +they will settle on the first five, filling the clay reservoir a little more: + +......+....... +......|.....#. +.#..#.|.....#. +.#..#.|#...... +.#..#.|#...... +.#~~~~~#...... +.#~~~~~#...... +.#######...... +.............. +.............. +....#.....#... +....#.....#... +....#.....#... +....#######... + +Water pressure does not apply in this scenario. If another four squares of water are created, they +will stay on the right side of the barrier, and no water will reach the left side: + +......+....... +......|.....#. +.#..#.|.....#. +.#..#~~#...... +.#..#~~#...... +.#~~~~~#...... +.#~~~~~#...... +.#######...... +.............. +.............. +....#.....#... +....#.....#... +....#.....#... +....#######... + +At this point, the top reservoir overflows. While water can reach the tiles above the surface of the +water, it cannot settle there, and so the next five squares of water settle like this: + +......+....... +......|.....#. +.#..#[1m[97m|[0m|||...#. +.#..#~~#|..... +.#..#~~#|..... +.#~~~~~#|..... +.#~~~~~#|..... +.#######|..... +........|..... +........|..... +....#...|.#... +....#...|.#... +....#~~~~~#... +....#######... + +Note especially the leftmost |: the new squares of water can reach this tile, but cannot stop there. + Instead, eventually, they all fall to the right and settle in the reservoir below. + +After 10 more squares of water, the bottom reservoir is also full: + +......+....... +......|.....#. +.#..#||||...#. +.#..#~~#|..... +.#..#~~#|..... +.#~~~~~#|..... +.#~~~~~#|..... +.#######|..... +........|..... +........|..... +....#~~~~~#... +....#~~~~~#... +....#~~~~~#... +....#######... + +Finally, while there is nowhere left for the water to settle, it can reach a few more tiles before +overflowing beyond the bottom of the scanned data: + +......+....... (line not counted: above minimum y value) +......|.....#. +.#..#||||...#. +.#..#~~#|..... +.#..#~~#|..... +.#~~~~~#|..... +.#~~~~~#|..... +.#######|..... +........|..... +...|||||||||.. +...|#~~~~~#|.. +...|#~~~~~#|.. +...|#~~~~~#|.. +...|#######|.. +...|.......|.. (line not counted: below maximum y value) +...|.......|.. (line not counted: below maximum y value) +...|.......|.. (line not counted: below maximum y value) + +How many tiles can be reached by the water? [1m[97mTo prevent counting forever[0m, ignore tiles with a y +coordinate smaller than the smallest y coordinate in your scan data or larger than the largest one. +Any x coordinate is valid. In this example, the lowest y coordinate given is 1, and the highest is +13, causing the water spring (in row 0) and the water falling off the bottom of the render (in rows +14 through infinity) to be ignored. + +So, in the example above, counting both water at rest (~) and other sand tiles the water can +hypothetically reach (|), the total number of tiles the water can reach is [1m[97m57[0m. + +[1m[97mHow many tiles can the water reach[0m within the range of y values in your scan? + + diff --git a/src/17/part2 b/src/17/part2 new file mode 100644 index 0000000..a0801b8 --- /dev/null +++ b/src/17/part2 @@ -0,0 +1,105 @@ +--- Part Two --- + +Now for the tricky part: notifying all the other robots about the solar flare. The vacuum robot can +do this automatically if it gets into range of a robot. However, you can't see the other robots on +the camera, so you need to be thorough instead: you need to make the vacuum robot [1m[97mvisit every part +of the scaffold at least once[0m. + +The vacuum robot normally wanders randomly, but there isn't time for that today. Instead, you can +[1m[97moverride its movement logic[0m with new rules. + +Force the vacuum robot to wake up by changing the value in your ASCII program at address 0 from 1 to +[1m[97m2[0m. When you do this, you will be automatically prompted for the new movement rules that the vacuum +robot should use. The ASCII program will use input instructions to receive them, but they need to be +provided as ASCII code; end each line of logic with a single newline, ASCII code 10. + +First, you will be prompted for the [1m[97mmain movement routine[0m. The main routine may only call the +[1m[97mmovement functions[0m: A, B, or C. Supply the movement functions to use as ASCII text, separating them +with commas (,, ASCII code 44), and ending the list with a newline (ASCII code 10). For example, to +call A twice, then alternate between B and C three times, provide the string A,A,B,C,B,C,B,C and +then a newline. + +Then, you will be prompted for each [1m[97mmovement function[0m. Movement functions may use L to [1m[97mturn +left[0m, R to [1m[97mturn right[0m, or a number to [1m[97mmove forward[0m that many units. Movement functions may not call +other movement functions. Again, separate the actions with commas and end the list with a newline. +For example, to move forward 10 units, turn left, move forward 8 units, turn right, and finally move +forward 6 units, provide the string 10,L,8,R,6 and then a newline. + +Finally, you will be asked whether you want to see a [1m[97mcontinuous video feed[0m; provide either y or n +and a newline. Enabling the continuous video feed can help you see what's going on, but it also +requires a significant amount of processing power, and may even cause your Intcode computer to +overheat. + +Due to the limited amount of memory in the vacuum robot, the ASCII definitions of the main routine +and the movement functions may each contain [1m[97mat most 20 characters[0m, not counting the newline. + +For example, consider the following camera feed: + +#######...##### +#.....#...#...# +#.....#...#...# +......#...#...# +......#...###.# +......#.....#.# +^########...#.# +......#.#...#.# +......######### +........#...#.. +....#########.. +....#...#...... +....#...#...... +....#...#...... +....#####...... + +In order for the vacuum robot to [1m[97mvisit every part of the scaffold at least once[0m, one path it could +take is: + +R,8,R,8,R,4,R,4,R,8,L,6,L,2,R,4,R,4,R,8,R,8,R,8,L,6,L,2 +Without the memory limit, you could just supply this whole string to function A and have the main +routine call A once. However, you'll need to split it into smaller parts. + +One approach is: + + + - [1m[97mMain routine: A,B,C,B,A,C[0m(ASCII input: 65, 44, 66, 44, 67, 44, 66, 44, 65, 44, 67, 10) + + - [1m[97mFunction A:Â Â Â R,8,R,8[0m(ASCII input: 82, 44, 56, 44, 82, 44, 56, 10) + + - [1m[97mFunction B:Â Â Â R,4,R,4,R,8[0m(ASCII input: 82, 44, 52, 44, 82, 44, 52, 44, 82, 44, 56, 10) + + - [1m[97mFunction C:Â Â Â L,6,L,2[0m(ASCII input: 76, 44, 54, 44, 76, 44, 50, 10) + + +Visually, this would break the desired path into the following parts: + +A, B, C, B, A, C +R,8,R,8, R,4,R,4,R,8, L,6,L,2, R,4,R,4,R,8, R,8,R,8, L,6,L,2 + +CCCCCCA...BBBBB +C.....A...B...B +C.....A...B...B +......A...B...B +......A...CCC.B +......A.....C.B +^AAAAAAAA...C.B +......A.A...C.B +......AAAAAA#AB +........A...C.. +....BBBB#BBBB.. +....B...A...... +....B...A...... +....B...A...... +....BBBBA...... + +Of course, the scaffolding outside your ship is much more complex. + +As the vacuum robot finds other robots and notifies them of the impending solar flare, it also can't +help but leave them squeaky clean, collecting any space dust it finds. Once it finishes the +programmed set of movements, assuming it hasn't drifted off into space, the cleaning robot will +return to its docking station and report the amount of space dust it collected as a large, non-ASCII +value in a single output instruction. + +After visiting every part of the scaffold at least once, [1m[97mhow much dust does the vacuum robot report +it has collected?[0m + + diff --git a/src/17/solve.py b/src/17/solve.py new file mode 100644 index 0000000..c6454f3 --- /dev/null +++ b/src/17/solve.py @@ -0,0 +1,183 @@ +import sys
+sys.path.append("../common")
+import aoc
+
+def parse_line(l):
+ s = l.split(", ")
+ if s[0].startswith("y="):
+ s = s[::-1]
+
+ res = [[int(x) for x in v.split("=")[1].split("..")] for v in s]
+ return res
+
+constraints = [parse_line(l) for l in aoc.data.split("\n")]
+
+xmin = min(c[0][0] for c in constraints)-1
+xmax = max(c[0][-1] for c in constraints)+1
+ymin = min(c[1][0] for c in constraints)
+ymax = max(c[1][-1] for c in constraints)
+xdif = xmax - xmin + 1
+ydif = ymax - ymin + 1
+
+vmap = [[0 for x in range(xdif)] for y in range(ydif)]
+
+def set_map(x, y, v):
+ global vmap
+ if y < ymin or y > ymax or x < xmin or x > xmax:
+ return
+ vmap[y-ymin][x-xmin] = v
+
+def get_map(x, y):
+ global vmap
+ if x > xmax or x < xmin:
+ return 1
+ elif y > ymax:
+ return 0
+ return vmap[y-ymin][x-xmin]
+
+def drawWall(c):
+ if len(c[0]) == 1:
+ for y in range(c[1][0], c[1][1] + 1):
+ set_map(c[0][0], y, 1)
+ else:
+ for x in range(c[0][0], c[0][1] + 1):
+ set_map(x, c[1][0], 1)
+
+for c in constraints:
+ drawWall(c)
+
+spring = (500, 0)
+
+
+### SETUP END
+
+
+def interpretChar(v):
+ chars = [".", "#", "|", "~"]
+ return chars[v]
+
+def drawMap():
+ for y in range(ydif):
+ aoc.debug("".join([interpretChar(v) for v in vmap[y]]))
+
+def fwriteMap():
+ f = open("output","w+")
+ for y in range(ydif):
+ f.write("".join([interpretChar(v) for v in vmap[y]])+"\n")
+ f.close()
+
+def isstatic(p):
+ return get_map(p[0], p[1]) in (1, 3)
+
+def isfree(p):
+ return get_map(p[0], p[1]) == 0
+
+def move(p):
+ x = p[0]
+ y = p[1]
+ if isfree((x, y+1)):
+ return (x, y+1)
+ onblock = isstatic((x, y+1))
+ if not onblock:
+ return (x,y)
+ npos = [(x + dir, y) for dir in [-1, 1]]
+ npos = [np for np in npos if isfree(np) and onblock]
+ if len(npos) > 1:
+ return npos
+ elif len(npos) == 1:
+ return npos[0]
+ return (x, y)
+
+def fillfloor(p):
+ onblock = True
+ isblock = False
+ x = p[0]
+ while onblock and not isblock and x >= xmin:
+ x -= 1
+ isblock = isstatic((x, p[1]))
+ onblock = isstatic((x, p[1]+1))
+ if not isblock:
+ return None # edge
+ lx = x+1
+
+ onblock = True
+ isblock = False
+ x = p[0]
+ while onblock and not isblock and x <= xmax:
+ x += 1
+ isblock = isstatic((x, p[1]))
+ onblock = isstatic((x, p[1]+1))
+ if not isblock:
+ return None
+ rx = x-1
+
+ return [(i, p[1]) for i in range(lx, rx+1)]
+
+def count_w_flowing():
+ water = 0
+ for y in range(ymin, ymax+1):
+ for x in range(xmin, xmax+1):
+ if get_map(x,y) == 2:
+ water += 1
+ return water
+
+def count_w_static():
+ water = 0
+ for y in range(ymin, ymax+1):
+ for x in range(xmin, xmax+1):
+ if get_map(x,y) == 3:
+ water += 1
+ return water
+
+def simulate():
+ heads = [spring]
+ while len(heads) > 0:
+ cp = heads[-1]
+ if isstatic((cp[0], cp[1]+1)):
+ # solid below => expand
+ res = fillfloor(cp)
+ if res:
+ for p in res:
+ set_map(p[0], p[1], 3)
+ nhead = None
+ for x in range(res[0][0], res[-1][0]+1):
+ np = (x, res[0][1]-1)
+ if get_map(np[0], np[1]) == 2:
+ nhead = np
+ break
+ if nhead == None: # head got trapped
+ heads.pop()
+ else:
+ heads[-1] = nhead
+ continue
+
+ res = move(cp)
+ if type(res[0]) == tuple:
+ heads.pop()
+ heads += res
+ for p in res:
+ set_map(p[0], p[1], 2)
+ else:
+ if res != cp:
+ if res[1] <= ymax:
+ set_map(res[0], res[1], 2)
+ heads[-1] = res
+ else:
+ heads.pop()
+ else:
+ heads.pop()
+
+ if aoc.debug_lvl:
+ aoc.debug(heads)
+ input()
+ fwriteMap()
+
+def solve1(args):
+ simulate()
+ return count_w_flowing() + count_w_static()
+
+def solve2(args):
+ simulate()
+ return count_w_static()
+
+aoc.run(solve1, solve2, sols=[39557, 32984])
diff --git a/src/17/test1 b/src/17/test1 new file mode 100644 index 0000000..293b5af --- /dev/null +++ b/src/17/test1 @@ -0,0 +1,8 @@ +x=495, y=2..7 +y=7, x=495..501 +x=501, y=3..7 +x=498, y=2..4 +x=506, y=1..2 +x=498, y=10..13 +x=504, y=10..13 +y=13, x=498..504 diff --git a/src/18/input b/src/18/input new file mode 100644 index 0000000..0f62ca5 --- /dev/null +++ b/src/18/input @@ -0,0 +1,50 @@ +|...||..|....|..#..|.|..#.|......#|.||.||.|..|....
+.#.....#....#|||#|#..||..|.#..|....#...||.#.#|.|.|
+.|...|#..|||..|.#....#..|.|....|...||...#.#|...|#.
+.........|.|.#||.##.#|.||.|#..||..||...##.##......
+..|.||.#.|.|.|....||#.....|.|.||##.#|##.|....|.#..
+#..#|#..|#...|...#...#....#|##......#..|||#..#.#..
+...#.#.#|...||...|.#...||#.....|##|||.....#.#.#.|.
+.#..|.###|#.|.##......||..#...#.#..|#.|.##.#.#.|..
+..||.|.|.....###...#|...###..##|.#.#....#|..##.|.|
+.##..#.|.#....##...||.|#..#.####..|#..##.|...#....
+..#...#|..|..|.|.#|#.|.|..|..||......#|.|...##..|.
+..||...##|#.....#|..|..|.|.##.|.##.|#|.##|.||...#.
+..|.||......#...#......|......|.##...|..|.|.#...#.
+||#.#|...#.......#......|..|#.#.|.....#...#.|##..|
+.....||.|..|##.#|..#..#|..#|.##....##|.##.||...###
+#|..#..#....|...|.|....#.##...#..|.|..#........|#|
+....#.|.....##.|..##.....##..#.....|#.|.#.|.#.###.
+...###........|.....|..|#..#..|##..###.....#||..||
+#.#...#|..##...|..|||#.....|#|.......#..#.......#|
+#.....||||.#..##.|..|#|.#..|.......|##.|#|#....#.|
+#..##|...|....#.#.#.||.|..|.....#|...|....#|..##|#
+#..|||#..#..|..#|....#.........#...#...#...|.|...#
+.........|.|...#...|...#|##..#.....#.|.#..||.#...#
+.|#...#|...#.###.|#.||.|..#..#.####..#..||.#.#|..|
+.|#....||#|#|.|.|#....##..||.##|....#....#||...|.|
+...|....|...|.||#...#...........#..#....##|.#....|
+....#|#..#....|##...#..|#..#.|......|#........|#..
+.|..#...|..#.|.#....#....#.|...#..|........|..|...
+...##|....||...##...|......|#..|..#..|.........##.
+..##.|.#..........##.|....|##|.....|.#.#.|.....|.#
+#|.|.......#|..#..#.#.|..|.|.#.||#.#...|.#..|.....
+||.#............#...|...#..|#|..||##...#.|#|##|.#|
+..|..||####.|....|##.#.|...|||#..|.|.|.........##.
+...|....|..||.#..##||.|||#..|..#...#.##...||.|..||
+....|...|##...#|.|.|..#|..|#|..##.|....||..|.|.||.
+#..#.......|.#..#..||...#|..#.....#|#..|..|...##..
+#...#..##..|.#...#.....|......###|..|...||.....|..
+#.|..#..|#..|#|..#..||#......|#.......|.#....###..
+#...#||...##|.#.#|####|...|......|.#.#..|#.##...|.
+|.#..#....#..#.....|#..|#.|..##.#..|#|##........||
+#.........##..|....|#.........||..||##...||.|..|.|
+.#....#.......#..|#.|...|....#.#.#........##.##.|.
+.#.#..|.|#..|..#..###...|.#......|.|#.|.##..|.|##.
+..||..|.##.##|...|....#||##....#..#.|#|.|#||#..|..
+.......#|#||.....|.||.|##..|.|....|....|.#...#..|.
+#||##|.||..|##.|..|#.#.|.|....#|.#|.....|||..#.||.
+.||#.|#...||#.#..#..|.|#.....#.#.|#.|...#..#...#..
+#........|..#...|#..###.|.#|...#..#...........#.|#
+.|...#|....||.|...#.|..|.||##.|..#|.#|..|.#....#..
+||....###...#...|||.||..#.|.....||.#|..###..|....#
diff --git a/src/18/part1 b/src/18/part1 new file mode 100644 index 0000000..02322ac --- /dev/null +++ b/src/18/part1 @@ -0,0 +1,175 @@ +--- Day 18: Settlers of The North Pole --- + +On the outskirts of the North Pole base construction project, many Elves are collecting lumber. + +The lumber collection area is 50 acres by 50 acres; each acre can be either [1m[97mopen ground[0m (.), +[1m[97mtrees[0m (|), or a [1m[97mlumberyard[0m (#). You take a scan of the area (your puzzle input). + +Strange magic is at work here: each minute, the landscape looks entirely different. In exactly +[1m[97mone minute[0m, an open acre can fill with trees, a wooded acre can be converted to a lumberyard, or a +lumberyard can be cleared to open ground (the lumber having been sent to other projects). + +The change to each acre is based entirely on [1m[97mthe contents of that acre[0m as well as [1m[97mthe number of +open, wooded, or lumberyard acres adjacent to it[0m at the start of each minute. Here, "adjacent" means +any of the eight acres surrounding that acre. (Acres on the edges of the lumber collection area +might have fewer than eight adjacent acres; the missing acres aren't counted.) + +In particular: + + + - An [1m[97mopen[0m acre will become filled with [1m[97mtrees[0m if [1m[97mthree or more[0m adjacent acres contained trees. +Otherwise, nothing happens. + + - An acre filled with [1m[97mtrees[0m will become a [1m[97mlumberyard[0m if [1m[97mthree or more[0m adjacent acres were +lumberyards. Otherwise, nothing happens. + + - An acre containing a [1m[97mlumberyard[0m will remain a [1m[97mlumberyard[0m if it was adjacent to [1m[97mat least one other +lumberyard and at least one acre containing trees[0m. Otherwise, it becomes [1m[97mopen[0m. + + +These changes happen across all acres [1m[97msimultaneously[0m, each of them using the state of all acres at +the beginning of the minute and changing to their new form by the end of that same minute. Changes +that happen during the minute don't affect each other. + +For example, suppose the lumber collection area is instead only 10 by 10 acres with this initial +configuration: + +Initial state: +.#.#...|#. +.....#|##| +.|..|...#. +..|#.....# +#.#|||#|#| +...#.||... +.|....|... +||...#|.#| +|.||||..|. +...#.|..|. + +After 1 minute: +.......##. +......|### +.|..|...#. +..|#||...# +..##||.|#| +...#||||.. +||...|||.. +|||||.||.| +|||||||||| +....||..|. + +After 2 minutes: +.......#.. +......|#.. +.|.|||.... +..##|||..# +..###|||#| +...#|||||. +|||||||||. +|||||||||| +|||||||||| +.||||||||| + +After 3 minutes: +.......#.. +....|||#.. +.|.||||... +..###|||.# +...##|||#| +.||##||||| +|||||||||| +|||||||||| +|||||||||| +|||||||||| + +After 4 minutes: +.....|.#.. +...||||#.. +.|.#||||.. +..###||||# +...###||#| +|||##||||| +|||||||||| +|||||||||| +|||||||||| +|||||||||| + +After 5 minutes: +....|||#.. +...||||#.. +.|.##||||. +..####|||# +.|.###||#| +|||###|||| +|||||||||| +|||||||||| +|||||||||| +|||||||||| + +After 6 minutes: +...||||#.. +...||||#.. +.|.###|||. +..#.##|||# +|||#.##|#| +|||###|||| +||||#||||| +|||||||||| +|||||||||| +|||||||||| + +After 7 minutes: +...||||#.. +..||#|##.. +.|.####||. +||#..##||# +||##.##|#| +|||####||| +|||###|||| +|||||||||| +|||||||||| +|||||||||| + +After 8 minutes: +..||||##.. +..|#####.. +|||#####|. +||#...##|# +||##..###| +||##.###|| +|||####||| +||||#||||| +|||||||||| +|||||||||| + +After 9 minutes: +..||###... +.||#####.. +||##...##. +||#....### +|##....##| +||##..###| +||######|| +|||###|||| +|||||||||| +|||||||||| + +After 10 minutes: +.||##..... +||###..... +||##...... +|##.....## +|##.....## +|##....##| +||##.####| +||#####||| +||||#||||| +|||||||||| + +After 10 minutes, there are 37 wooded acres and 31 lumberyards. Multiplying the number of wooded +acres by the number of lumberyards gives the total [1m[97mresource value[0m after ten minutes: 37 * 31 = +[1m[97m1147[0m. + +[1m[97mWhat will the total resource value of the lumber collection area be after 10 minutes?[0m + + diff --git a/src/18/part2 b/src/18/part2 new file mode 100644 index 0000000..c37ea49 --- /dev/null +++ b/src/18/part2 @@ -0,0 +1,184 @@ +--- Part Two --- + +You arrive at the vault only to discover that there is not one vault, but [1m[97mfour[0m - each with its own +entrance. + +On your map, find the area in the middle that looks like this: + +... +.@. +... + +Update your map to instead use the correct data: + +@#@ +### +@#@ + +This change will split your map into four separate sections, each with its own entrance: + +####### ####### +#a.#Cd# #a.#Cd# +##...## ##[1m[97m@#@[0m## +##.@.## --> ##[1m[97m###[0m## +##...## ##[1m[97m@#@[0m## +#cB#Ab# #cB#Ab# +####### ####### + +Because some of the keys are for doors in other vaults, it would take much too long to collect all +of the keys by yourself. Instead, you deploy four remote-controlled robots. Each starts at one of +the entrances (@). + +Your goal is still to [1m[97mcollect all of the keys in the fewest steps[0m, but now, each robot has its own +position and can move independently. You can only remotely control a single robot at a time. +Collecting a key instantly unlocks any corresponding doors, regardless of the vault in which the key +or door is found. + +For example, in the map above, the top-left robot first collects key a, unlocking door A in the +bottom-right vault: + +####### +#@.#Cd# +##.#@## +####### +##@#@## +#cB#.b# +####### + +Then, the bottom-right robot collects key b, unlocking door B in the bottom-left vault: + +####### +#@.#Cd# +##.#@## +####### +##@#.## +#c.#.@# +####### + +Then, the bottom-left robot collects key c: + +####### +#@.#.d# +##.#@## +####### +##.#.## +#@.#.@# +####### + +Finally, the top-right robot collects key d: + +####### +#@.#.@# +##.#.## +####### +##.#.## +#@.#.@# +####### + +In this example, it only took [1m[97m8[0m steps to collect all of the keys. + +Sometimes, multiple robots might have keys available, or a robot might have to wait for multiple +keys to be collected: + +############### +#d.ABC.#.....a# +######@#@###### +############### +######@#@###### +#b.....#.....c# +############### + +First, the top-right, bottom-left, and bottom-right robots take turns collecting keys a, b, and c, a +total of 6 + 6 + 6 = 18 steps. Then, the top-left robot can access key d, spending another 6 steps; +collecting all of the keys here takes a minimum of [1m[97m24[0m steps. + +Here's a more complex example: + +############# +#DcBa.#.GhKl# +#.###@#@#I### +#e#d#####j#k# +###C#@#@###J# +#fEbA.#.FgHi# +############# + + + - Top-left robot collects key a. + + - Bottom-left robot collects key b. + + - Top-left robot collects key c. + + - Bottom-left robot collects key d. + + - Top-left robot collects key e. + + - Bottom-left robot collects key f. + + - Bottom-right robot collects key g. + + - Top-right robot collects key h. + + - Bottom-right robot collects key i. + + - Top-right robot collects key j. + + - Bottom-right robot collects key k. + + - Top-right robot collects key l. + + +In the above example, the fewest steps to collect all of the keys is [1m[97m32[0m. + +Here's an example with more choices: + +############# +#g#f.D#..h#l# +#F###e#E###.# +#dCba@#@BcIJ# +############# +#nK.L@#@G...# +#M###N#H###.# +#o#m..#i#jk.# +############# + +One solution with the fewest steps is: + + + - Top-left robot collects key e. + + - Top-right robot collects key h. + + - Bottom-right robot collects key i. + + - Top-left robot collects key a. + + - Top-left robot collects key b. + + - Top-right robot collects key c. + + - Top-left robot collects key d. + + - Top-left robot collects key f. + + - Top-left robot collects key g. + + - Bottom-right robot collects key k. + + - Bottom-right robot collects key j. + + - Top-right robot collects key l. + + - Bottom-left robot collects key n. + + - Bottom-left robot collects key m. + + - Bottom-left robot collects key o. + + +This example requires at least [1m[97m72[0m steps to collect all keys. + +After updating your map and using the remote-controlled robots, [1m[97mwhat is the fewest steps necessary +to collect all of the keys?[0m + + diff --git a/src/18/solve.py b/src/18/solve.py new file mode 100644 index 0000000..f209429 --- /dev/null +++ b/src/18/solve.py @@ -0,0 +1,81 @@ +import sys
+sys.path.append("../common")
+import aoc
+from copy import deepcopy
+from collections import deque
+
+states = (".", "|", "#")
+
+ivals = dict()
+ivals["#"] = 0
+ivals["."] = 0
+ivals["|"] = 0
+
+def pasrse_line(l):
+ return tuple([states.index(c) for c in l])
+
+vmap = [pasrse_line(l) for l in aoc.data.split("\n")]
+xlen, ylen = len(vmap[0]), len(vmap)
+
+def get_at(x, y):
+ if y < 0 or y >= ylen or x < 0 or x >= xlen:
+ return None
+ return vmap[y][x]
+
+def next(x, y):
+ v = vmap[y][x]
+ around = list()
+ [[around.append(get_at(x+i-1, y+j-1)) for j in range(3) if not (i == 1 and j == 1)] for i in range(3)]
+ if v == 0:
+ if len([v for v in around if v == 1]) >= 3:
+ return 1
+ elif v == 1:
+ if len([v for v in around if v == 2]) >= 3:
+ return 2
+ elif v == 2:
+ if len([v for v in around if v == 1]) < 1 or len([v for v in around if v == 2]) < 1:
+ return 0
+ return v
+
+def get_vals():
+ vals = [0 for x in range(3)]
+ for y in range(ylen):
+ for x in range(xlen):
+ vals[vmap[y][x]] += 1
+ return vals
+
+def draw_map(cmap):
+ for y in range(ylen):
+ aoc.debug("".join([str(c) for c in cmap[y]]))
+
+def iterate(n):
+ global vmap
+ for i in range(n):
+ omap = [deque() for y in range(ylen)]
+ for y in range(ylen):
+ for x in range(xlen):
+ omap[y].append(next(x, y))
+ vmap = omap
+
+def get_res():
+ vals = get_vals()
+ return (vals[1] * vals[2])
+
+def solve1(args):
+ iterate(10)
+ vals = get_vals()
+ return vals[1] * vals[2]
+
+def solve2(args):
+ iterate(1000)
+ omap = deepcopy(vmap)
+ counter = 0
+ while True:
+ iterate(1)
+ counter += 1
+ if vmap == omap:
+ break
+
+ return get_res()
+
+aoc.run(solve1, solve2, sols=[574590, 183787])
diff --git a/src/18/test1 b/src/18/test1 new file mode 100644 index 0000000..13d299d --- /dev/null +++ b/src/18/test1 @@ -0,0 +1,10 @@ +.#.#...|#. +.....#|##| +.|..|...#. +..|#.....# +#.#|||#|#| +...#.||... +.|....|... +||...#|.#| +|.||||..|. +...#.|..|. diff --git a/src/19/input b/src/19/input new file mode 100644 index 0000000..0392b90 --- /dev/null +++ b/src/19/input @@ -0,0 +1,37 @@ +#ip 4
+addi 4 16 4
+seti 1 5 1
+seti 1 2 2
+mulr 1 2 3
+eqrr 3 5 3
+addr 3 4 4
+addi 4 1 4
+addr 1 0 0
+addi 2 1 2
+gtrr 2 5 3
+addr 4 3 4
+seti 2 7 4
+addi 1 1 1
+gtrr 1 5 3
+addr 3 4 4
+seti 1 9 4
+mulr 4 4 4
+addi 5 2 5
+mulr 5 5 5
+mulr 4 5 5
+muli 5 11 5
+addi 3 1 3
+mulr 3 4 3
+addi 3 18 3
+addr 5 3 5
+addr 4 0 4
+seti 0 3 4
+setr 4 2 3
+mulr 3 4 3
+addr 4 3 3
+mulr 4 3 3
+muli 3 14 3
+mulr 3 4 3
+addr 5 3 5
+seti 0 4 0
+seti 0 5 4
diff --git a/src/19/part1 b/src/19/part1 new file mode 100644 index 0000000..1a9c60b --- /dev/null +++ b/src/19/part1 @@ -0,0 +1,92 @@ +--- Day 19: Go With The Flow --- + +With the Elves well on their way constructing the North Pole base, you turn your attention back to +understanding the inner workings of programming the device. + +You can't help but notice that the device's opcodes don't contain any [1m[97mflow control[0m like jump +instructions. The device's manual goes on to explain: + +"In programs where flow control is required, the instruction pointer can be [1m[97mbound to a register[0m so +that it can be manipulated directly. This way, setr/seti can function as absolute jumps, addr/addi +can function as relative jumps, and other opcodes can cause truly fascinating effects." + +This mechanism is achieved through a declaration like #ip 1, which would modify register 1 so that +accesses to it let the program indirectly access the instruction pointer itself. To compensate for +this kind of binding, there are now [1m[97msix[0m registers (numbered 0 through 5); the five not bound to the +instruction pointer behave as normal. Otherwise, the same rules apply as the last time you worked +with this device. + +When the [1m[97minstruction pointer[0m is bound to a register, its value is written to that register just +before each instruction is executed, and the value of that register is written back to the +instruction pointer immediately after each instruction finishes execution. Afterward, move to the +next instruction by adding one to the instruction pointer, even if the value in the instruction +pointer was just updated by an instruction. (Because of this, instructions must effectively set the +instruction pointer to the instruction [1m[97mbefore[0m the one they want executed next.) + +The instruction pointer is 0 during the first instruction, 1 during the second, and so on. If the +instruction pointer ever causes the device to attempt to load an instruction outside the +instructions defined in the program, the program instead immediately halts. The instruction pointer +starts at 0. + +It turns out that this new information is already proving useful: the CPU in the device is not very +powerful, and a background process is occupying most of its time. You dump the background process' +declarations and instructions to a file (your puzzle input), making sure to use the names of the +opcodes rather than the numbers. + +For example, suppose you have the following program: + +#ip 0 +seti 5 0 1 +seti 6 0 2 +addi 0 1 0 +addr 1 2 3 +setr 1 0 0 +seti 8 0 4 +seti 9 0 5 + +When executed, the following instructions are executed. Each line contains the value of the +instruction pointer at the time the instruction started, the values of the six registers before +executing the instructions (in square brackets), the instruction itself, and the values of the six +registers after executing the instruction (also in square brackets). + +ip=0 [0, 0, 0, 0, 0, 0] seti 5 0 1 [0, 5, 0, 0, 0, 0] +ip=1 [1, 5, 0, 0, 0, 0] seti 6 0 2 [1, 5, 6, 0, 0, 0] +ip=2 [2, 5, 6, 0, 0, 0] addi 0 1 0 [3, 5, 6, 0, 0, 0] +ip=4 [4, 5, 6, 0, 0, 0] setr 1 0 0 [5, 5, 6, 0, 0, 0] +ip=6 [6, 5, 6, 0, 0, 0] seti 9 0 5 [6, 5, 6, 0, 0, 9] + +In detail, when running this program, the following events occur: + + + - The first line (#ip 0) indicates that the instruction pointer should be bound to register 0 in +this program. This is not an instruction, and so the value of the instruction pointer does not +change during the processing of this line. + + - The instruction pointer contains 0, and so the first instruction is executed (seti 5 0 1). It +updates register 0 to the current instruction pointer value (0), sets register 1 to 5, sets the +instruction pointer to the value of register 0 (which has no effect, as the instruction did not +modify register 0), and then adds one to the instruction pointer. + + - The instruction pointer contains 1, and so the second instruction, seti 6 0 2, is executed. This +is very similar to the instruction before it: 6 is stored in register 2, and the instruction pointer +is left with the value 2. + + - The instruction pointer is 2, which points at the instruction addi 0 1 0. This is like a +[1m[97mrelative jump[0m: the value of the instruction pointer, 2, is loaded into register 0. Then, addi finds +the result of adding the value in register 0 and the value 1, storing the result, 3, back in +register 0. Register 0 is then copied back to the instruction pointer, which will cause it to end up +1 larger than it would have otherwise and skip the next instruction (addr 1 2 3) entirely. Finally, +1 is added to the instruction pointer. + + - The instruction pointer is 4, so the instruction setr 1 0 0 is run. This is like an +[1m[97mabsolute jump[0m: it copies the value contained in register 1, 5, into register 0, which causes it to +end up in the instruction pointer. The instruction pointer is then incremented, leaving it at 6. + + - The instruction pointer is 6, so the instruction seti 9 0 5 stores 9 into register 5. The +instruction pointer is incremented, causing it to point outside the program, and so the program +ends. + + +[1m[97mWhat value is left in register 0[0m when the background process halts? + + diff --git a/src/19/part2 b/src/19/part2 new file mode 100644 index 0000000..3bfe430 --- /dev/null +++ b/src/19/part2 @@ -0,0 +1,58 @@ +--- Part Two --- + +You aren't sure how large Santa's ship is. You aren't even sure if you'll need to use this thing on +Santa's ship, but it doesn't hurt to be prepared. You figure Santa's ship might fit in a +[1m[97m100x100[0m square. + +The beam gets wider as it travels away from the emitter; you'll need to be a minimum distance away +to fit a square of that size into the beam fully. (Don't rotate the square; it should be aligned to +the same axes as the drone grid.) + +For example, suppose you have the following tractor beam readings: + +#....................................... +.#...................................... +..##.................................... +...###.................................. +....###................................. +.....####............................... +......#####............................. +......######............................ +.......#######.......................... +........########........................ +.........#########...................... +..........#########..................... +...........##########................... +...........############................. +............############................ +.............#############.............. +..............##############............ +...............###############.......... +................###############......... +................#################....... +.................########[1m[97mO[0mOOOOOOOOO..... +..................#######OOOOOOOOOO#.... +...................######OOOOOOOOOO###.. +....................#####OOOOOOOOOO##### +.....................####OOOOOOOOOO##### +.....................####OOOOOOOOOO##### +......................###OOOOOOOOOO##### +.......................##OOOOOOOOOO##### +........................#OOOOOOOOOO##### +.........................OOOOOOOOOO##### +..........................############## +..........................############## +...........................############# +............................############ +.............................########### + +In this example, the [1m[97m10x10[0m square closest to the emitter that fits entirely within the tractor beam +has been marked O. Within it, the point closest to the emitter (the only highlighted [1m[97mO[0m) is at X=25, +Y=20. + +Find the [1m[97m100x100[0m square closest to the emitter that fits entirely within the tractor beam; within +that square, find the point closest to the emitter. [1m[97mWhat value do you get if you take that point's +X coordinate, multiply it by 10000, then add the point's Y coordinate?[0m (In the example above, this +would be 250020.) + + diff --git a/src/19/solve.py b/src/19/solve.py new file mode 100644 index 0000000..c0c41eb --- /dev/null +++ b/src/19/solve.py @@ -0,0 +1,109 @@ +import sys
+sys.path.append("../common")
+import aoc
+from math import sqrt
+
+def parse_command(l):
+ s = l.split(" ")
+ args = [s[0]]
+ args = args + [int(v) for v in s[1:]]
+ return args
+
+data = aoc.data.split("\n")
+
+inspaddr = int(data[0][4:])
+instructs = [parse_command(l) for l in data[1:] if len(l) != 0]
+
+register = [0 for x in range(inspaddr+1)]
+
+opmap = dict()
+opmap["addr"] = lambda a, b : register[a] + register[b]
+opmap["addi"] = lambda a, b : register[a] + b
+opmap["mulr"] = lambda a, b : register[a] * register[b]
+opmap["muli"] = lambda a, b : register[a] * b
+opmap["banr"] = lambda a, b : register[a] & register[b]
+opmap["bani"] = lambda a, b : register[a] & b
+opmap["borr"] = lambda a, b : register[a] | register[b]
+opmap["bori"] = lambda a, b : register[a] | b
+opmap["setr"] = lambda a, b : register[a]
+opmap["seti"] = lambda a, b : a
+opmap["gtir"] = lambda a, b : 1 * (a > register[b])
+opmap["gtri"] = lambda a, b : 1 * (register[a] > b)
+opmap["gtrr"] = lambda a, b : 1 * (register[a] > register[b])
+opmap["eqir"] = lambda a, b : 1 * (a == register[b])
+opmap["eqri"] = lambda a, b : 1 * (register[a] == b)
+opmap["eqrr"] = lambda a, b : 1 * (register[a] == register[b])
+
+
+def solve1(args):
+ global register, insptr
+ while register[inspaddr] < len(instructs):
+ insptr = register[inspaddr]
+ ins = instructs[insptr]
+ #aoc.debug(register)
+
+ # execute command
+ if len(register) <= ins[3]:
+ register += [0 for x in range(ins[3] - len(register) + 1)]
+ register[ins[3]] = opmap[ins[0]](ins[1], ins[2])
+
+ # increment instruction pointer
+ register[inspaddr] += 1
+
+ return register[0]
+
+
+alpha = [chr(c + ord('a')) for c in range(26)]
+
+dismap = dict()
+dismap["addr"] = lambda a, b : "%s + %s" % (alpha[a], alpha[b])
+dismap["addi"] = lambda a, b : "%s + %d" % (alpha[a], b)
+dismap["mulr"] = lambda a, b : "%s * %s" % (alpha[a], alpha[b])
+dismap["muli"] = lambda a, b : "%s * %d" % (alpha[a], b)
+dismap["banr"] = lambda a, b : str(alpha[a] & alpha[b])
+dismap["bani"] = lambda a, b : str(alpha[a] & b)
+dismap["borr"] = lambda a, b : str(alpha[a] | alpha[b])
+dismap["bori"] = lambda a, b : str(alpha[a] | b)
+dismap["setr"] = lambda a, b : str(alpha[a])
+dismap["seti"] = lambda a, b : str(a)
+dismap["gtir"] = lambda a, b : "(%d > %s)" % (a, alpha[b])
+dismap["gtri"] = lambda a, b : "(%s > %d)" % (alpha[a], b)
+dismap["gtrr"] = lambda a, b : "(%s > %s)" % (alpha[a], alpha[b])
+dismap["eqir"] = lambda a, b : "(%d == %s)" % (a, alpha[b])
+dismap["eqri"] = lambda a, b : "(%s == %d)" % (alpha[a], b)
+dismap["eqrr"] = lambda a, b : "(%s == %s)" % (alpha[a], alpha[b])
+
+def disassemble():
+ for i in range(len(instructs)):
+ ins = instructs[i]
+ aoc.debug(i ,":",alpha[ins[3]],"=", dismap[ins[0]](ins[1], ins[2]))
+ aoc.debug()
+
+""" divisor sum algo disassembled
+c = 1
+b = 1
+a = 0
+while b <= f:
+ c = 1
+ while c <= f:
+ if b * c == f:
+ a += b
+ c += 1
+ b += 1
+"""
+
+def solve2(args):
+ f = 10551276 # found by running
+
+ res = 0
+ sqrtf = sqrt(f)
+ for i in range(1, int(sqrtf)):
+ if f % i == 0:
+ res += i + f / i
+
+ if int(sqrtf) % f == 0:
+ res += sqrtf
+
+ return int(res)
+
+aoc.run(solve1, solve2, sols=[2072, 27578880])
diff --git a/src/19/test1 b/src/19/test1 new file mode 100644 index 0000000..d7d2a21 --- /dev/null +++ b/src/19/test1 @@ -0,0 +1,8 @@ +#ip 0 +seti 5 0 1 +seti 6 0 2 +addi 0 1 0 +addr 1 2 3 +setr 1 0 0 +seti 8 0 4 +seti 9 0 5 diff --git a/src/20/.gitignore b/src/20/.gitignore new file mode 100644 index 0000000..53752db --- /dev/null +++ b/src/20/.gitignore @@ -0,0 +1 @@ +output diff --git a/src/20/input b/src/20/input new file mode 100644 index 0000000..9c6c2aa --- /dev/null +++ b/src/20/input @@ -0,0 +1 @@ +^WSWSWSWNWSSWWWWWNENESENNWWNENENESENEEES(SWNWSS(WW(SS|N(W|E))|E)|EEENNEENESSWSSSSEENNESSENESSWWWWSWWWSWWSSSEEENEENWW(WWSEWNEE|)NEEESSENEENN(WSWNWESENE|)ESENENEEENEESWSESWWNWWSESWW(N|WSEESSSWWWNN(ESENSWNW|)N(WSW(SESSWSSSESSSSWWWSWWNNNENESS(WSNE|)EENWN(E|NWNENWNEN(NWWS(WN(NEEEWWWS|)WWWSEESSESWWNNWWSWNWSWNWNWWSSWWWSESENESENN(ESSSSSSENNNESENNN(WWSEWNEE|)ESE(ESWSW(N|SESSWWW(NE(NWES|)E|SESWWWWWSESWWWWWNWWSWWWSSSWWNWSWWNENWNENENNESSE(EEENWNNWSSWNNNNWWSWNWNENNWNNENEESENESEENNW(WWWWNWSWSWSSSWNNWSSWWNENWWNNNNWNWSWSSSSSWNNNWWSWSWSESEE(NWNENSWSES|)SENEENNE(SSE(N|SEESENESSSE(NNNEWSSS|)ESSE(NEENSWWS|)SWWS(WNWSWWWWSWWWNWNEEE(SWEN|)EEENWWWWNENESENEEE(NWWNWWS(WWWS(WNN(WSWNN(WSWWWNWWWWWWNWNEESENENESS(EEEE(SWEN|)(NWNWSWNNEENEE(SWSNEN|)NE(S|NWNENNENESESWWSEE(SSWNWS|ENENW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EENEENN(WSWENE|)EEESESSWWW(SESSSWSESSENNENWNNEN(EESWS(EENN(NWNNW(NNW(WNN(WSWS(WNN(E|NWSWNWS(NESENEWSWNWS|))|E)|ESEESSEENW(ESWWNNSSEENW|))|S)|SS)|EEESSWNWSSWSWW(NEWS|)SEESESSWWWSESEESESWWNWWSWNWSWWSEESWWSSEEN(ENNEE(N|EESSWWSW(NNEEWWSS|)WSWWWWWWNENWWSSSSSSWNNNWSSWNWWNENWNNEES(W|S(S|EENNNENNENEE(EENNNN(WWSSWS(EENNSSWW|)WWSWSWWNENNNEEE(SWWSNEEN|)ENWNWNEEE(ESWWEENW|)NNNN(ESNW|)WWWSEESSWWN(WWWSESSWNWWSWWNNE(ENWNWSW(SSSSSSSESESSENNE(NENNWN(EEE(NNN|E)|WSS(SWNWNENW(ESWSESNWNENW|)|E)|N)|SSS(WWSWNNW(SSSSEE(NWES|)SWSW(SSSSEENWNEEE(SSESSESENNWNN(NWSNES|)EEENENNW(NEEEEESENESSSSEESSESSWNWWNN(ESNW|)WWWNWSWW(WSW(NWES|)SESWSS(ENENNNEEEEESWSSWS(WW(NNNEESWS(NENWWSNEESWS|)|W)|EENESEN(NWWEES|)EES(ENNEENWNW(NWNEENWNENWWWNEENESENESEENNNENWNWNENENESENNNWWNNNNNESSESWSEEESEENWNNWNW(SSEWNN|)WN(NWWNEENWN(E|WSWWSESSWSSE(SWSESS(EE|WWN(E|NWNNE(S|NWWN(WSWSESSE(SSW(SESESSW(SSS(ENNE(NNNEN(WWNNSSEE|)E|SE(S(W|S)|N))|W(NNN|WWS(W(SSSSEENW(ESWWNNSSEENW|)|W)|E)))|N)|N|WW)|NN)|ENE(NN(WS|NEE)|S|E)))))|N))|EEEES(W|SEENEENW(WWSNEE|)NENEN(WWSNEE|)E(N|SESSWW(NEWS|)SEEENENWNEN(WW|ESSESESSSWSSWSWNWNENE(S|NENW(N|WSWSWSSWSEESWWWSSWSWWNENWNWN(NNN(W|EESWSES(E(S(S|W)|ENWNNEE(SWEN|)N(E|WWW))|W))|WSWWSW(NN(N|EE)|SWWS(WNSE|)SESSESESESEESSSWSEESWWSESWSEEEES(EENESEEEEENWNEENNNWWNENESESSENEESSSSWWNW(NEE(S|N)|SS(WNSE|)EEEENEES(W|EEENWWNNNEESWSEEESS(WNSE|)ENENWNWNNNEEESSW(NWSNES|)SEEENWNENNW(NEEENENWNENNENENNWSWSWNWNNNEENWNENNENNWNNEENENNNWWWNNESENNNNWWSESWWNNWWSSSE(ESSSEEESWSWNWWNWSWWWSESENEEESWSESS(E|WSWNWNE(E|N(N|WWSWWSESE(ESWSSWNNWNWWNNNWWWNWNEESENEENNNEES(ENE(N(EESWENWW|)WNWSWNWW(S(WWWN(EE|WNW(SSESSES(ENN(W|EESWSE)|WWNWSSSSE(ESWWWNWSWSESEESSSWWSESWWSEEESSSENNESSESSWNWSWNWSSEEESSEEEEEENNESE(NNNNNNWSSWSWS(EENSWW|)WNWSSW(S(WN|EENES)|NNNENWNEESE(SWEN|)ENWNENEEN(EE(NENN(EN|WSWS)|SWS(WW|SSSESWSSEE(SWWEEN|)N(W|NENWNWNN(SSESESNWNWNN|))))|WWNNWWWWWWSEESESS(ENENNW(S|W)|WW(SS|N(E|NWSSWNN(WSNE|)NNNNEN(WWW|ESS(EE(NWNN(ESNW|)W|EE)|W)))))))|SSW(WWWWWSS(WWWW(SSSEENWNE(WSESWWEENWNE|)|NNWWNEEN(WWNWWSESS(SEEWWN|)WNWNWWNWSWNWWSWSSWNWWNNEE(SWEN|)ENNNNENNN(EENESSWSW(N|SSWSEENNESSS(EENES(SWEN|)EENWNWWNENE(EESE(SW(WNWESE|)SS|N)|NWNENENWNWW(NENE(ES(ES(ENSW|)W|W)|NWNENENWNWN(WS(SES|WN)|EESENE(SSWENN|)NN(E(NNWSNESS|)E|WWS(WNWSNESE|)E)))|SS(ENSW|)SSSW(W|NNNN|SSS)))|WWW))|WSSWSSSWWWNWSSS(E(NEEEWWWS|)SSSEESEESESSS(WW(S|NENWNWW(NWES|)SSS(ENN|WN))|ENNNNNEE(SSSW(NN|SSS(ENNENES(NWSWSSNNENES|)|W))|N(WW(WSSNNE|)N|E(S|E))))|WNWNWNWNEENENE(SS(EESENSWNWW|)WS(S|W)|NWWSWSWW(EENENEWSWSWW|))))|ESSSENES(NWSWNNSSENES|)))|EE(NWES|)SS)|N))|NN))|NENN(WSNE|)NNE(ENNNWESSSW|)S))|E)|NEEEENE(SS|NNWW(NENWNEEEESESS(WWN(WNEWSE|)E|ENNNESSEEENWWNNEEENWWWNENENWWNEENENNWSWW(S(WSWW(NEWS|)WSSSEENE(NWWSNEES|)(SSWS(W(S|WWN(EE|WWS(E|W(WSNE|)N)))|E)|E)|E)|NENNNW(WWWNWSWWNWW(WWNWW(WSSNNE|)NENNNW(NWNNENWWNNWNWWSESWSSWSSWSWSWS(WWNWSWWS(E|SWSSSWSSWNNWWSSSWWSWSSS(WNNNNWNNEEENE(SSWW(W|S)|NN(WSWSNENE|)ESENNESE(SWEN|)NN(WWWSNEEE|)NNE(SS|NWNNNEENNENENENW(WSW(SW(SS|W)|N)|NNENWNW(WWWNW(NEENESES(WW|ENESEESESSWSEEEES(ENNNWNWNENNWWS(E|W(NNNEEES(WW|ENEEESSSWWN(NESNWS|)WSSSESESESSEENNNESSSESEESEENESEENNNESENENEEENNENWNNENWWSSWWNENWWSWWSESSES(ENEN(ESSW|WWN)|SWNWNNWWWWWNWWWWNW(SSEEEESSW(NWWWS(WNWN(W|E)|SS)|SSENEENN(WSNE|)EEESWSW(SEE(NEWS|)S(WWW(S|W(NEWS|)W)|S)|N))|NNNENNWWWNNWNENESSSEENNW(NNEEENWWNWSWSWNWWNEEENWWNEEENWWNNWNENWNEEESSW(SSEEENNNNNNNWNWNNEES(W|SEESWSEESSEEEESESSENEEENENNNESEENNNWNWNEEEESENN(WWWWWWSWWWWSSESESE(NNN(W(S|W)|ESSE(ESNW|)N)|SSWSWWNEN(NWNWNNNWSWNN(WSSWW(SES(SSEEEE(NWWNENWWSS(NNEESWENWWSS|)|S|E)|W)|WNN(ESENSWNW|)W(WWWWWWSSEE(NWES|)SSESES(SSSSWENNNN|)WWNWSWWNENWN(EESNWW|)WWWSESE(N|SWSSENESSSSESWWWSWWWWWNNESENNWWNNESEESSE(SWEN|)ENN(ESSNNW|)W(S|NNNWSSWNWWWSWWSSSSENE(NWNEWSES|)SSWSSSENEN(EEESENESE(NENWESWS|)SSEESWSWNWSWWSWSSWWNNWSWSESSWNWNNWWSESWWNWWWWWWWNWNENEENWWWSWWWWSEESE(SESWSESWWNWNN(ESNW|)WSSSWNNNWSSWSESEESWWWSSSSSENES(SWSWNWWNENWNNWNWSSWSWNNWWNEEE(NENWWWWNENESEENWNWNWWNWNWSWWWNWSSSEEN(ESEE(NWES|)S(ENEWSW|)SWNWWWWSESSENNESEES(EEE|SWSESWWSWNNWN(WSSESWSWS(SENEEEEEESSWNWWS(WW(NE|WWSEE)|ESEEEEEEESS(ENNEEN(ESNW|)WWN(WSWNNENN(WSWWSSE(N|SWWNNNNNWSWWS(EE|WWW))|N)|E)|W(S|NWWS(WNWSWN|E))))|WNWWNEENNE(SS|NNN(ESNW|)NNWSSWWSSSE(NENWESWS|)SWW(S|NWNNNE(SS|NWNWWSW(NNEENNENWWW(SESWENWN|)NEEENNNESESWSESSW(N|SWSEENES(SW(SEWN|)W|ENNWNENWNENESS(SSSS|ENNENWNEESSSWSEE(SWEN|)NNNESEEENENNWWWS(SENEWSWN|)WWNWNWSWWNNNNESS(EENENWNENWWNWSWWWWNWWNWSSSWW(NNE(S|NWNEENNNESSEESEENWNNNN(EESSS(WNNSSE|)SESS(W(SWNW(WWNWESEE|)S|N)|ENNENESSEENNNESSESWSEESSESSENENWNWNNNNNWNEN(ESEEN(W|ESSWWSSSW(SEES(SEENESEEESWWWSSSWSWNWSSWWSESWW(SEESENNNESEESWSW(N|SEESE(S(WWWWWNN(ESEEWWNW|)WNWW(SWW(SEEE(ESW(SEES(W|EE(N(ESNW|)W|SWSSW(NN|SEE(N(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ESSW(N|SE(EENWNEE(S|NWWNNEES(E(NNWWWNN(WSSSSWWN(E|WW(SEWN|)N)|ESENEEESSESE(NESEN(NWWWEEES|)ESSENESEE(SWEN|)NWNNE(S|EEEEEEEEN(E|WWWNN(ESNW|)WSWS(WNN(WSSWWWSSW(ENNEEEWWWSSW|)|NE(S|EE))|E)))|SWWWN(NNWESS|)E))|S)|W))|SWS(ES|WNN)))|WSWW(NE|SE)))|N)|W)))|SS))|EEEEEE)|E))|ESESENN(ESSSWWSSSWSSWSWWNWSSESSSWWWSSENEEESWWSWWWWWSEEESWSSWWNWSWNWSSWNNNEENNE(SSEESNWWNN|)NENESENNWWWSWWWWNWWNNESENE(SENEES(WSWWEENE|)ENN(W|EENEE(NWNEEEE(S|ENWNW(S|NEN(WNWESE|)ESSENNN(SSSWNNSSENNN|)))|SSW(WS(EEEN|WN)|N)))|NNWNWSS(WWWSESSWSESW(SESWSESWWNW(SSSESWSEEEENWWNN(EENNNENN(EESS(ENNEWSSW|)W(N|SSW(N|SESW(SSSWWWSWNWSWSESENESENNESESWSEEENNEENENESENNWWWSWNN(ENEEEEENEN(NNESESWSSWSEEENN(WSNE|)NENNW(N(WSNE|)EENNW(NWNENN(WSNE|)ESSES(EENNEEEESENEESWSESENENWNNWNNNENENEESEEENWNEESESWSWSSEESSSENEE(NWNNE(S|NNNWSW(NNEENNNNWSWWWWWWWSWSWWNNN(WWSESWWWWWSSENESSWWWN(WWSESEESWWSEEESS(EENE(S|NWNW(SS|WNEEE(S|NE(S|EN(EEENE(SS|EEN(ESE(S|EN(ESNW|)W)|WW))|WWW(NEEWWS|)S)))))|WWN(E|WSWNNW(NENSWS|)S(SSESNWNN|)W))|NNNNESEEENWW(EESWWWEEENWW|))|EE(SWSNEN|)EEEEEEE)|S(E|S(W(N|W)|SS))))|SSSSWSWWWSSWNWSSSSWSWNNENWNWWWSWNWWSSWNWNWNEE(S|EENEN(ESS(W|EENNENW(WSSNNE|)NEEESWSEE(SWWWSES(NWNEEEWWWSES|)|ENESENEN(WWWW(S|NENWWSWNNWWW(SEESWENWWN|)NN(WSNE|)ESENEN(WW(W|N)|ESS(SEEWWN|)W))|N)))|WNWWN(E|WNWWSESESS(ENESNWSW|)WNWNWSSSWW(WSSESWWSSESEENWN(ENENE(SSSSW(SESSSEESSSWNWSSSWNNWSSWWNENWWWNNNENNESESWSES(WWNSEE|)EEN(EE|WNNN(ESSNNW|)WN(WWWN(E|WSSESWW(SS(E(N|SWSSE(SSENNESSESWSWWSWWWSESWWNNNNESEEN(NW(N(N|E)|WWWSSSSWWW(NEN(W|E(S|N))|WSESENESE(SWWWSSSSSESS(WNW(WNENNNWSSWWWNWSWSS(EEE(S|N(ESNW|)WW)|WNNNW(SS|NEE(S|NWNWNW(S(SEWN|)W|NNWNEE(EESSENEEEESWSEESSWNWWWSW(SEESENNW(ESSWNWESENNW|)|NN(EENWESWW|)W(WNWNEWSESE|)S)|NWWW(SS|WNWN(E|N)))))))|S)|EENEENNNNESSENNNEEESWSESENEENNWW(SEWN|)NWWWNNW(NEESSENNESES(ENNEEESSSESWWSW(NN(NE(NWES|)S|WW)|SSSSWSWWNN(E(ENWESW|)S|WWSESWSSSSENENESSSSSSSWSESWSSWSWSWNNENNNE(SS|NNNWNN(ESE(SS|NN)|WNWWW(NNNW(SSWNNSSENN|)NEENNEE(N(NN|E)|SWSESSWNWSSEE(WWNNESNWSSEE|))|SEESWSW(SW(SES(WW|SENENN(WSNE|)NE(N|SS(ENSW|)SSWS(E|SWW(NEWS|)SSSSWSEENNE(NWNEWSES|)SENEEESWSSSSESEENWNNN(WSSNNE|)EESEEENNWW(SEWN|)NENNENWWWWW(SWS(EEE(SSWNWS|N(ESNW|)W)|W)|NEENNENNEESWSEENESSSW(NWWS(WNSE|)E|SEESESEESENNNWNNESENENENWWNNWNWNNNNESENNEEENWNNWWSWS(EENSWW|)WNNNE(NWWSWSSE(N|SS(SWSESWWWNWNNWWNNESEESSE(S|NN(ESNW|)NWNNWNWN(ENEESS(WNSE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|N)|WNNNE(SESWENWN|)NWN(EENNNWW(EESSSWENNNWW|)|WW))|N)|ESSESENESSEEENWWNN(WWW|NNEEE(NWWWWN|SSWS(WNNEWSSE|)E(EN(ESNW|)N|SSSESWW(NWSWNWWS(SENSWN|)WW(NEN(WNSE|)E|W)|SEESE(N|E(SWS(E|SWSWNWN(EEN|WS))|EEENEN)))))))|SS))|WSESWSES(WWSWNSENEE|)ESSSENE(NWN(NWES|)E|SSSEESWSESENNNESESENNWN(ENESEENEE(NWNN(ESNW|)WWWSEESW(S|WW)|ESWSSWSWWW(SWWSSWSESEENESSESSESES(WWNWNNWSSWWS(EEE|WWWWWWNNWWSESWWWNENWWNENNWSW(SSWSS(ENESNWSW|)WW(NENWESWS|)W|NNEN(W|EEN(W|ENWNENESSSSWSSSS(WNNNWESSSE|)EEEESES(WWNSEE|)EENWNWNWNNWSSWWNEN(W|NEEN(ESE(NENNSSWS|)SS(WNSE|)SE(N|SESENN(E|W))|WWNNE(SEWN|)NWNWN(WSWSNENE|)E))))))|ENNWNENNNENNWSWNWN(ENENNESE(SEESWSEESEENNEN(WWWSES|ESESWSESWW(SWWN(E|WWSESSWSESEES(WWWNWNWNW(NEN(E(NWN(EE|NNW(N|W))|S(S|E))|W)|SSES(E|W))|EEENNEEESS(WNWSNESE|)ENEENE(SSWWEENN|)NNWWWWS(ESENEWSWNW|)WNWN(WWSS(WWS(EESW|WNNEE)|E(E|N))|NEEENESENNNWSWNWNWW(WNENNW(SWWSEWNEEN|)NNNESES(SSES(EEES(E(SSSSSWWWWW(EEEEENSWWWWW|)|NNNNNWWSWS(SENE(N|S)|WNNENEENWWNWSW(SEWN|)WNNE(S|NNNEENNWSWNW(NNNESES(EEENNE(NNNWNNE(S|NNWSWWSW(NNEENEENN(SSWWSWENEENN|)|SESSW(S(EE(SSWNWESENN|)N(ESNW|)NNN|W(WWS(WWW(S|NEENNWSWNNW(ESSENEWSWNNW|))|S)|N))|N)))|SSSWWSSSWWSSENESSEE(SS|NWNENNNWSS(NNESSSNNNWSS|)))|W)|SSW(N|SWSWSWWSEEENE(NENSWS|)SSWS(S|WNWSWNWN(SESENEWSWNWN|)))))))|WW)|W)|W)|SSSEN(ESNW|)N))))|NN))|N)|WSW(S(WNWSSNNESE|)ESSEN(ESSWSNENNW|)N|N)))|NEN(E(ENSW|)S|W)))|WWWWNEE(WWSEEEWWWNEE|)))))|SE(N|E))|E)))|NNNWNEE(NWES|)E)))|N)|NENE(NWES|)S)|EESSSW)|NNNNWS(SS|WNN(WSWENE|)EE))))))|E)|NWNENWN(ENSW|)W)))))|WWWWSE))|NWNENN(N|W(S|WW)))))|WNNNWSS(W|S))))))|S(EE|S)))|E)|SS)|WSWSES(E(ESNW|)N|WSSWSSW(NWWWSNEEES|)SESENN(N|EESSW(N|SWWSS(ENEENE(SEESENN(WW|ESSESSS(WWSS(WNNNN(ESENSWNW|)WNW(WW|S)|SE(SEWN|)NN)|E(E|NN)))|N)|W(NNN|SESWSS)))))))|EE))|S))))))|N)|N))))))|W)|SSWNWWSES(E|WSWSESSWW(N(NNW(NEEWWS|)SS|E)|S))))|N))|S)|EE)|N))|W)|NNNWWSESWWNNN(E|WWW)))|E))|NN)|N(WW(W|S)|NN))|W)|NNNESS)))))|W)|S)|S)|W)|WWSESS(W(SS|W|N)|E))|WW)))|W(NEWS|)S)|W)|W)|WNNN(NNNEN(EESWENWW|)NW(NEWS|)S|WSW(S(ESNW|)W|N)|E))|E))|W)))|N)|S))))|SESSES(E|W)))|WSSSWNNWN(WSW(NN(W|NN(NWES|)E)|SWSSSSWW(NEN(W|N)|SS(SWNNWNE(WSESSEWNNWNE|)|ENESE(ENENNWNW(SS(S|E)|NENESSE(E|SS))|S))))|E)))|S)|S))))|EENWNEEESEENESSWSS(ENESENNWNNNN(WWS(E|W(NW(SWWEEN|)NN|S))|ESSEEEESWS(EES(W|EENWNWNENNN(EN(E(S|EE(E|NNW(NENNSSWS|)SW(N|W)))|W)|WWSESWWNWSWN(SENESEWNWSWN|)))|WNW(S|W)))|SWNW(SSSWSESWSS(WNW(S|NNWWW(SEEWWN|)NN(W|EEES(E(NEWS|)SS|WW)|N))|SEESS(WNWESE|)EESENE(NEEN(EESWENWW|)WNNWNEN(ESSSNNNW|)WWWSSE(N|SWSW(NWN(WSNE|)ENWNNNES(E|S)|SEENEN))|S))|NENWWN))))|EEEE(SWEN|)NN(WSWENE|)NNEESS(SWNNSSEN|)E(NNNWN(WSNE|)N|E))|SS)|SSE(SWEN|)(N|EEE))|SS)))|S(E|S))))|S)|WSSSESWW(NWES|)SS)|N))))|NN)|S)))|WWWWWNNWWNWSWWSWNWW(NENWNENNWSW(NNEN(EEESW(SSEEESS(WSWWNNE(E|S)|EEE(SWEN|)NWNENN(ESNW|)WNWSWW(NEN(E|NWW(NEN|SE))|S(EE(E|SS)|W)))|W)|W)|S(W|S))|SS(WNWSNESE|)E(N|EEEEN(EESWENWW|)W)))))))))))|S)|W))|WWWWWWWWNNNEN(EE(NN|SWSS(WNSE|)EEE(NW(W|NN)|EE))|W))|NENNNEESS(WNSE|)ENESSW)|S)|NWW(N|W))|N)|N(N|E))|ENE(E|SSS)))|NNNEEEESW(WW|SE(EEENWN(EEEEENW(ESWWWWEEEENW|)|NNNNW(SWSWWS(WWNNE(NWNEWSES|)(EE|S)|EEE(SS|N))|NNE(SEEWWN|)N))|SS)))|S)|E)|EE(EE(NWWNSEES|)E|SWSSE(E|N)))|SWSES(WWNSEE|)SS))))|W))|W)|W)|NE(NWES|)E)|NW(NN|S))|NNE(NE(NWNNW(NNE(SESSNNWN|)NNNWSS|SSS)|S)|S)))|E)))|EEENWNN(SSESWWEENWNN|))))))|N)))))))|WW(W|N))))))|S(W|SE(SWSNEN|)N)))))|EE)|EE))))|E)))|E)|W)|E)|EEEN(W|E))|E)|E)|SW(S(EEENWESWWW|)S|W))|E))|NWNNES)|S)|SWS(ES|WN))))|NN)|N)|E)|E))|N)|N)))$
diff --git a/src/20/part1 b/src/20/part1 new file mode 100644 index 0000000..b341e27 --- /dev/null +++ b/src/20/part1 @@ -0,0 +1,187 @@ +--- Day 20: A Regular Map --- + +While you were learning about instruction pointers, the Elves made considerable progress. When you +look up, you discover that the North Pole base construction project has completely surrounded you. + +The area you are in is made up entirely of [1m[97mrooms[0m and [1m[97mdoors[0m. The rooms are arranged in a grid, and +rooms only connect to adjacent rooms when a door is present between them. + +For example, drawing rooms as ., walls as #, doors as | or -, your current position as X, and where +north is up, the area you're in might look like this: + +##### +#.|.# +#-### +#.|X# +##### + +You get the attention of a passing construction Elf and ask for a map. "I don't have time to draw +out a map of this place - it's [1m[97mhuge[0m. Instead, I can give you directions to [1m[97mevery room in the +facility[0m!" He writes down some directions on a piece of parchment and runs off. In the example +above, the instructions might have been ^WNE$, a regular expression or "[1m[97mregex[0m" (your puzzle input). + +The regex matches routes (like WNE for "west, north, east") that will take you from your current +room through various doors in the facility. In aggregate, the routes will take you through +[1m[97mevery door in the facility at least once[0m; mapping out all of these routes will let you build a +proper map and find your way around. + +^ and $ are at the beginning and end of your regex; these just mean that the regex doesn't match +anything outside the routes it describes. (Specifically, ^ matches the start of the route, and $ +matches the end of it.) These characters will not appear elsewhere in the regex. + +The rest of the regex matches various sequences of the characters N (north), S (south), E (east), +and W (west). In the example above, ^WNE$ matches only one route, WNE, which means you can move +[1m[97mwest, then north, then east[0m from your current position. Sequences of letters like this always match +that exact route in the same order. + +Sometimes, the route can [1m[97mbranch[0m. A branch is given by a [1m[97mlist of options[0m separated by pipes (|) and +wrapped in parentheses. So, ^N(E|W)N$ contains a branch: after going north, you must choose to go +[1m[97meither east or west[0m before finishing your route by going north again. By tracing out the possible +routes after branching, you can determine where the doors are and, therefore, where the rooms are in +the facility. + +For example, consider this regex: ^ENWWW(NEEE|SSE(EE|N))$ + +This regex begins with ENWWW, which means that from your current position, all routes must begin by +moving east, north, and then west three times, in that order. After this, there is a branch. Before +you consider the branch, this is what you know about the map so far, with doors you aren't sure +about marked with a ?: + +#?#?#?#?# +?.|.|.|.? +#?#?#?#-# + ?X|.? + #?#?# + +After this point, there is (NEEE|SSE(EE|N)). This gives you exactly two options: NEEE and SSE(EE|N). +By following NEEE, the map now looks like this: + +#?#?#?#?# +?.|.|.|.? +#-#?#?#?# +?.|.|.|.? +#?#?#?#-# + ?X|.? + #?#?# + +Now, only SSE(EE|N) remains. Because it is in the same parenthesized group as NEEE, it starts from +the same room NEEE started in. It states that starting from that point, there exist doors which will +allow you to move south twice, then east; this ends up at another branch. After that, you can either +move east twice or north once. This information fills in the rest of the doors: + +#?#?#?#?# +?.|.|.|.? +#-#?#?#?# +?.|.|.|.? +#-#?#?#-# +?.?.?X|.? +#-#-#?#?# +?.|.|.|.? +#?#?#?#?# + +Once you've followed all possible routes, you know the remaining unknown parts are all walls, +producing a finished map of the facility: + +######### +#.|.|.|.# +#-####### +#.|.|.|.# +#-#####-# +#.#.#X|.# +#-#-##### +#.|.|.|.# +######### + +Sometimes, a list of options can have an [1m[97mempty option[0m, like (NEWS|WNSE|). This means that routes at +this point could effectively skip the options in parentheses and move on immediately. For example, +consider this regex and the corresponding map: + +^ENNWSWW(NEWS|)SSSEEN(WNSE|)EE(SWEN|)NNN$ + +########### +#.|.#.|.#.# +#-###-#-#-# +#.|.|.#.#.# +#-#####-#-# +#.#.#X|.#.# +#-#-#####-# +#.#.|.|.|.# +#-###-###-# +#.|.|.#.|.# +########### + +This regex has one main route which, at three locations, can optionally include additional detours +and be valid: (NEWS|), (WNSE|), and (SWEN|). Regardless of which option is taken, the route +continues from the position it is left at after taking those steps. So, for example, this regex +matches all of the following routes (and more that aren't listed here): + + + - ENNWSWWSSSEENEENNN + + - ENNWSWW[1m[97mNEWS[0mSSSEENEENNN + + - ENNWSWW[1m[97mNEWS[0mSSSEENEE[1m[97mSWEN[0mNNN + + - ENNWSWWSSSEEN[1m[97mWNSE[0mEENNN + + +By following the various routes the regex matches, a full map of all of the doors and rooms in the +facility can be assembled. + +To get a sense for the size of this facility, you'd like to determine which room is +[1m[97mfurthest[0m from you: specifically, you would like to find the room for which the [1m[97mshortest path to that +room would require passing through the most doors[0m. + + + - In the first example (^WNE$), this would be the north-east corner [1m[97m3[0m doors away. + + - In the second example (^ENWWW(NEEE|SSE(EE|N))$), this would be the south-east corner +[1m[97m10[0m doors away. + + - In the third example (^ENNWSWW(NEWS|)SSSEEN(WNSE|)EE(SWEN|)NNN$), this would be the north-east +corner [1m[97m18[0m doors away. + + +Here are a few more examples: + +Regex: ^ESSWWN(E|NNENN(EESS(WNSE|)SSS|WWWSSSSE(SW|NNNE)))$ +Furthest room requires passing 23 doors + +############# +#.|.|.|.|.|.# +#-#####-###-# +#.#.|.#.#.#.# +#-#-###-#-#-# +#.#.#.|.#.|.# +#-#-#-#####-# +#.#.#.#X|.#.# +#-#-#-###-#-# +#.|.#.|.#.#.# +###-#-###-#-# +#.|.#.|.|.#.# +############# + +Regex: ^WSSEESWWWNW(S|NENNEEEENN(ESSSSW(NWSW|SSEN)|WSWWN(E|WWS(E|SS))))$ +Furthest room requires passing 31 doors + +############### +#.|.|.|.#.|.|.# +#-###-###-#-#-# +#.|.#.|.|.#.#.# +#-#########-#-# +#.#.|.|.|.|.#.# +#-#-#########-# +#.#.#.|X#.|.#.# +###-#-###-#-#-# +#.|.#.#.|.#.|.# +#-###-#####-### +#.|.#.|.|.#.#.# +#-#-#####-#-#-# +#.#.|.|.|.#.|.# +############### + +[1m[97mWhat is the largest number of doors you would be required to pass through to reach a room?[0m That is, +find the room for which the shortest path from your starting location to that room would require +passing through the most doors; what is the fewest doors you can pass through to reach it? + + diff --git a/src/20/part2 b/src/20/part2 new file mode 100644 index 0000000..bef65a3 --- /dev/null +++ b/src/20/part2 @@ -0,0 +1,207 @@ +--- Part Two --- + +Strangely, the exit isn't open when you reach it. Then, you remember: the ancient Plutonians were +famous for building [1m[97mrecursive spaces[0m. + +The marked connections in the maze aren't portals: they [1m[97mphysically connect[0m to a larger or smaller +copy of the maze. Specifically, the labeled tiles around the inside edge actually connect to a +smaller copy of the same maze, and the smaller copy's inner labeled tiles connect to yet a +[1m[97msmaller[0m copy, and so on. + +When you enter the maze, you are at the outermost level; when at the outermost level, only the outer +labels AA and ZZ function (as the start and end, respectively); all other outer labeled tiles are +effectively walls. At any other level, AA and ZZ count as walls, but the other outer labeled tiles +bring you one level outward. + +Your goal is to find a path through the maze that brings you back to ZZ at the outermost level of +the maze. + +In the first example above, the shortest path is now the loop around the right side. If the starting +level is 0, then taking the previously-shortest path would pass through BC (to level 1), DE (to +level 2), and FG (back to level 1). Because this is not the outermost level, ZZ is a wall, and the +only option is to go back around to BC, which would only send you even deeper into the recursive +maze. + +In the second example above, there is no path that brings you to ZZ at the outermost level. + +Here is a more interesting example: + + Z L X W C + Z P Q B K + ###########.#.#.#.#######.############### + #...#.......#.#.......#.#.......#.#.#...# + ###.#.#.#.#.#.#.#.###.#.#.#######.#.#.### + #.#...#.#.#...#.#.#...#...#...#.#.......# + #.###.#######.###.###.#.###.###.#.####### + #...#.......#.#...#...#.............#...# + #.#########.#######.#.#######.#######.### + #...#.# F R I Z #.#.#.# + #.###.# D E C H #.#.#.# + #.#...# #...#.# + #.###.# #.###.# + #.#....OA WB..#.#..ZH + #.###.# #.#.#.# +CJ......# #.....# + ####### ####### + #.#....CK #......IC + #.###.# #.###.# + #.....# #...#.# + ###.### #.#.#.# +XF....#.# RF..#.#.# + #####.# ####### + #......CJ NM..#...# + ###.#.# #.###.# +RE....#.# #......RF + ###.### X X L #.#.#.# + #.....# F Q P #.#.#.# + ###.###########.###.#######.#########.### + #.....#...#.....#.......#...#.....#.#...# + #####.#.###.#######.#######.###.###.#.#.# + #.......#.......#.#.#.#.#...#...#...#.#.# + #####.###.#####.#.#.#.#.###.###.#.###.### + #.......#.....#.#...#...............#...# + #############.#.#.###.################### + A O F N + A A D M + +One shortest path through the maze is the following: + + + - Walk from AA to XF (16 steps) + + - Recurse into level 1 through XF (1 step) + + - Walk from XF to CK (10 steps) + + - Recurse into level 2 through CK (1 step) + + - Walk from CK to ZH (14 steps) + + - Recurse into level 3 through ZH (1 step) + + - Walk from ZH to WB (10 steps) + + - Recurse into level 4 through WB (1 step) + + - Walk from WB to IC (10 steps) + + - Recurse into level 5 through IC (1 step) + + - Walk from IC to RF (10 steps) + + - Recurse into level 6 through RF (1 step) + + - Walk from RF to NM (8 steps) + + - Recurse into level 7 through NM (1 step) + + - Walk from NM to LP (12 steps) + + - Recurse into level 8 through LP (1 step) + + - Walk from LP to FD (24 steps) + + - Recurse into level 9 through FD (1 step) + + - Walk from FD to XQ (8 steps) + + - Recurse into level 10 through XQ (1 step) + + - Walk from XQ to WB (4 steps) + + - Return to level 9 through WB (1 step) + + - Walk from WB to ZH (10 steps) + + - Return to level 8 through ZH (1 step) + + - Walk from ZH to CK (14 steps) + + - Return to level 7 through CK (1 step) + + - Walk from CK to XF (10 steps) + + - Return to level 6 through XF (1 step) + + - Walk from XF to OA (14 steps) + + - Return to level 5 through OA (1 step) + + - Walk from OA to CJ (8 steps) + + - Return to level 4 through CJ (1 step) + + - Walk from CJ to RE (8 steps) + + - Return to level 3 through RE (1 step) + + - Walk from RE to IC (4 steps) + + - Recurse into level 4 through IC (1 step) + + - Walk from IC to RF (10 steps) + + - Recurse into level 5 through RF (1 step) + + - Walk from RF to NM (8 steps) + + - Recurse into level 6 through NM (1 step) + + - Walk from NM to LP (12 steps) + + - Recurse into level 7 through LP (1 step) + + - Walk from LP to FD (24 steps) + + - Recurse into level 8 through FD (1 step) + + - Walk from FD to XQ (8 steps) + + - Recurse into level 9 through XQ (1 step) + + - Walk from XQ to WB (4 steps) + + - Return to level 8 through WB (1 step) + + - Walk from WB to ZH (10 steps) + + - Return to level 7 through ZH (1 step) + + - Walk from ZH to CK (14 steps) + + - Return to level 6 through CK (1 step) + + - Walk from CK to XF (10 steps) + + - Return to level 5 through XF (1 step) + + - Walk from XF to OA (14 steps) + + - Return to level 4 through OA (1 step) + + - Walk from OA to CJ (8 steps) + + - Return to level 3 through CJ (1 step) + + - Walk from CJ to RE (8 steps) + + - Return to level 2 through RE (1 step) + + - Walk from RE to XQ (14 steps) + + - Return to level 1 through XQ (1 step) + + - Walk from XQ to FD (8 steps) + + - Return to level 0 through FD (1 step) + + - Walk from FD to ZZ (18 steps) + + +This path takes a total of [1m[97m396[0m steps to move from AA at the outermost layer to ZZ at the outermost +layer. + +In your maze, when accounting for recursion, [1m[97mhow many steps does it take to get from the open tile +marked AA to the open tile marked ZZ, both at the outermost layer?[0m + + diff --git a/src/20/solve.py b/src/20/solve.py new file mode 100644 index 0000000..63695b7 --- /dev/null +++ b/src/20/solve.py @@ -0,0 +1,151 @@ +import sys
+sys.path.append("../common")
+import aoc
+from copy import deepcopy
+
+data = list(aoc.data)
+
+def get_map(p):
+ return vmap[p[1] + spos[1]][p[0] + spos[0]]
+
+def set_map(p, c):
+ global vmap, spos
+ vmap[p[1] + spos[1]][p[0] + spos[0]] = c
+
+def new_pos(p, c):
+ p = p[:]
+ if c == "N":
+ p[1] -= 2
+ elif c == "S":
+ p[1] += 2
+ elif c == "W":
+ p[0] -= 2
+ elif c == "E":
+ p[0] += 2
+ return p
+
+def calc_pos(stack):
+ p = [0,0]
+ for c in stack:
+ p = new_pos(p, c)
+ return p
+
+xmin = 0
+xmax = 0
+ymin = 0
+ymax = 0
+
+def check_size(stack):
+ global xmin, xmax, ymin, ymax
+
+ p = calc_pos(stack)
+ if p[0] < xmin:
+ xmin = p[0]
+ if p[0] > xmax:
+ xmax = p[0]
+ if p[1] < ymin:
+ ymin = p[1]
+ if p[1] > ymax:
+ ymax = p[1]
+
+def draw_route(stack):
+ p = calc_pos(stack)
+ set_map(p, ".")
+ np = new_pos(p, stack[-1])
+ cp = [0,0]
+ cp[0] = p[0] + int((p[0] - np[0])/2)
+ cp[1] = p[1] + int((p[1] - np[1])/2)
+ set_map(cp, "+")
+
+def iter_regex(func):
+ stacklens = [0]
+ stack = []
+ for i in range(1, len(data)-1):
+ c = data[i]
+ if c == "(":
+ stacklens.append(0)
+ elif c == "|":
+ for i in range(stacklens[-1]):
+ stack.pop()
+ stacklens[-1] = 0
+ elif c == ")":
+ for i in range(stacklens[-1]):
+ stack.pop()
+ stacklens.pop()
+ else:
+ stack.append(c)
+ stacklens[-1] += 1
+ func(stack)
+
+def fwriteMap():
+ f = open("output", "w+")
+ for y in range(len(vmap)):
+ f.write("".join([str(v) for v in vmap[y]]) + "\n")
+ f.close()
+
+mshape = None
+spos = None
+vmap = None
+
+def genMap():
+ global vmap, mshape, spos
+
+ iter_regex(check_size)
+ xdif = xmax - xmin + 2
+ ydif = ymax - ymin + 2
+
+ spos = (-xmin+1, -ymin+1)
+ mshape = (xdif, ydif)
+
+ vmap = [["#" for x in range(xdif+1)] for y in range(ydif+1)]
+ vmap[spos[1]][spos[0]] = "X"
+
+ iter_regex(draw_route)
+
+
+adjacent = ((-1, 0), (0, -1), (1, 0), (0, 1))
+
+def gen_countmap(sp):
+ countmap = dict()
+ next = dict()
+ next[(sp[0], sp[1])] = 0
+ counter = 0
+ steps = list()
+ while len(next) > 0 and len(steps) == 0: # first steps available will be shortest
+ countmap = {**countmap, **next} # merge dictionaries
+ counter += 1
+ temp = dict()
+ for n in next:
+ for dir in adjacent:
+ nx = n[0]+dir[0]
+ ny = n[1]+dir[1]
+ if get_map((nx, ny)) != "#" and (nx, ny) not in countmap and (nx, ny) not in temp:
+ temp[(nx,ny)] = counter
+ next = temp
+ return countmap
+
+def next_step(cmap, p):
+ # adjacent squares
+ npos = [[p[0] + dir[0], p[1] + dir[1]] for dir in adjacent]
+
+ # steps and dist
+ steps = [[np[0], np[1], cmap[np[0], np[1]]] for np in npos if (np[0], np[1]) in cmap]
+
+ if len(steps) == 0:
+ return None
+ else:
+ return sorted(steps, key = lambda x: x[2])[0] #closest
+
+genMap()
+
+def solve1(args):
+ cmap = gen_countmap((0,0))
+ ipos = sorted(cmap, key = lambda x : cmap[x])[-1]
+ return int(cmap[ipos]/2)
+
+def solve2(args):
+ cmap = gen_countmap((0,0))
+ count = len([v for v in cmap if int(cmap[v]/2) >= 1000 and get_map(v) == "."])
+ return count
+
+aoc.run(solve1, solve2, sols=[4121, 8636])
diff --git a/src/20/test1 b/src/20/test1 new file mode 100644 index 0000000..25ab237 --- /dev/null +++ b/src/20/test1 @@ -0,0 +1 @@ +^ENWWW(NEEE|SSE(EE|N))$ diff --git a/src/21/input b/src/21/input new file mode 100644 index 0000000..d60c037 --- /dev/null +++ b/src/21/input @@ -0,0 +1,32 @@ +#ip 3
+seti 123 0 1
+bani 1 456 1
+eqri 1 72 1
+addr 1 3 3
+seti 0 0 3
+seti 0 7 1
+bori 1 65536 4
+seti 3798839 3 1
+bani 4 255 5
+addr 1 5 1
+bani 1 16777215 1
+muli 1 65899 1
+bani 1 16777215 1
+gtir 256 4 5
+addr 5 3 3
+addi 3 1 3
+seti 27 6 3
+seti 0 2 5
+addi 5 1 2
+muli 2 256 2
+gtrr 2 4 2
+addr 2 3 3
+addi 3 1 3
+seti 25 3 3
+addi 5 1 5
+seti 17 1 3
+setr 5 6 4
+seti 7 8 3
+eqrr 1 0 5
+addr 5 3 3
+seti 5 6 3
diff --git a/src/21/part1 b/src/21/part1 new file mode 100644 index 0000000..679f3ec --- /dev/null +++ b/src/21/part1 @@ -0,0 +1,41 @@ +--- Day 21: Chronal Conversion --- + +You should have been watching where you were going, because as you wander the new North Pole base, +you trip and fall into a very deep hole! + +Just kidding. You're falling through time again. + +If you keep up your current pace, you should have resolved all of the temporal anomalies by the next +time the device activates. Since you have very little interest in browsing history in 500-year +increments for the rest of your life, you need to find a way to get back to your present time. + +After a little research, you discover two important facts about the behavior of the device: + +First, you discover that the device is hard-wired to always send you back in time in 500-year +increments. Changing this is probably not feasible. + +Second, you discover the [1m[97mactivation system[0m (your puzzle input) for the time travel module. +Currently, it appears to [1m[97mrun forever without halting[0m. + +If you can cause the activation system to [1m[97mhalt[0m at a specific moment, maybe you can make the device +send you so far back in time that you cause an integer underflow [1m[97min time itself[0m and wrap around back +to your current time! + +The device executes the program as specified in manual section one and manual section two. + +Your goal is to figure out how the program works and cause it to halt. You can only control +[1m[97mregister 0[0m; every other register begins at 0 as usual. + +Because time travel is a dangerous activity, the activation system begins with a few instructions +which verify that [1m[97mbitwise AND[0m (via bani) does a [1m[97mnumeric[0m operation and [1m[97mnot[0m an operation as if the +inputs were interpreted as strings. If the test fails, it enters an infinite loop re-running the +test instead of allowing the program to execute normally. If the test passes, the program +continues, and assumes that [1m[97mall other bitwise operations[0m (banr, bori, and borr) also interpret their +inputs as [1m[97mnumbers[0m. (Clearly, the Elves who wrote this system were worried that someone might +introduce a bug while trying to emulate this system with a scripting language.) + +[1m[97mWhat is the lowest non-negative integer value for register 0 that causes the program to halt after +executing the fewest instructions?[0m (Executing the same instruction multiple times counts as multiple +instructions executed.) + + diff --git a/src/21/part2 b/src/21/part2 new file mode 100644 index 0000000..192cbb3 --- /dev/null +++ b/src/21/part2 @@ -0,0 +1,27 @@ +--- Part Two --- + +There are many areas the springdroid can't reach. You flip through the manual and discover a way to +[1m[97mincrease its sensor range[0m. + +Instead of ending your springcode program with WALK, use RUN. Doing this will enable +[1m[97mextended sensor mode[0m, capable of sensing ground up to [1m[97mnine tiles away[0m. This data is available in +[1m[97mfive new read-only registers[0m: + + + - Register E indicates whether there is ground [1m[97mfive[0m tiles away. + + - Register F indicates whether there is ground [1m[97msix[0m tiles away. + + - Register G indicates whether there is ground [1m[97mseven[0m tiles away. + + - Register H indicates whether there is ground [1m[97meight[0m tiles away. + + - Register I indicates whether there is ground [1m[97mnine[0m tiles away. + + +All other functions remain the same. + +Successfully survey the rest of the hull by ending your program with RUN. [1m[97mWhat amount of hull +damage does the springdroid now report?[0m + + diff --git a/src/21/solve.py b/src/21/solve.py new file mode 100644 index 0000000..e2b8fce --- /dev/null +++ b/src/21/solve.py @@ -0,0 +1,112 @@ +import sys
+sys.path.append("../common")
+import aoc
+from math import sqrt
+
+def parse_command(l):
+ s = l.split(" ")
+ args = [s[0]]
+ args = args + [int(v) for v in s[1:]]
+ return args
+
+data = aoc.data.split("\n")
+
+inspaddr = int(data[0][4:])
+instructs = [parse_command(l) for l in data[1:] if len(l) != 0]
+
+register = [0 for x in range(inspaddr+1)]
+
+opmap = dict()
+opmap["addr"] = lambda a, b : register[a] + register[b]
+opmap["addi"] = lambda a, b : register[a] + b
+opmap["mulr"] = lambda a, b : register[a] * register[b]
+opmap["muli"] = lambda a, b : register[a] * b
+opmap["banr"] = lambda a, b : register[a] & register[b]
+opmap["bani"] = lambda a, b : register[a] & b
+opmap["borr"] = lambda a, b : register[a] | register[b]
+opmap["bori"] = lambda a, b : register[a] | b
+opmap["setr"] = lambda a, b : register[a]
+opmap["seti"] = lambda a, b : a
+opmap["gtir"] = lambda a, b : 1 * (a > register[b])
+opmap["gtri"] = lambda a, b : 1 * (register[a] > b)
+opmap["gtrr"] = lambda a, b : 1 * (register[a] > register[b])
+opmap["eqir"] = lambda a, b : 1 * (a == register[b])
+opmap["eqri"] = lambda a, b : 1 * (register[a] == b)
+opmap["eqrr"] = lambda a, b : 1 * (register[a] == register[b])
+
+def varname(v):
+ return "R"+str(v)
+
+dismap = dict()
+dismap["addr"] = lambda a, b : "%s + %s" % (varname(a), varname(b))
+dismap["addi"] = lambda a, b : "%s + %d" % (varname(a), b)
+dismap["mulr"] = lambda a, b : "%s * %s" % (varname(a), varname(b))
+dismap["muli"] = lambda a, b : "%s * %d" % (varname(a), b)
+dismap["banr"] = lambda a, b : "%s & %s" % (varname(a), varname(b))
+dismap["bani"] = lambda a, b : "%s & %d" % (varname(a), b)
+dismap["borr"] = lambda a, b : "%s | %s" % (varname(a), varname(b))
+dismap["bori"] = lambda a, b : "%s | %d" % (varname(a), b)
+dismap["setr"] = lambda a, b : "%s" % (varname(a))
+dismap["seti"] = lambda a, b : "%d" % (a)
+dismap["gtir"] = lambda a, b : "(%d > %s)" % (a, varname(b))
+dismap["gtri"] = lambda a, b : "(%s > %d)" % (varname(a), b)
+dismap["gtrr"] = lambda a, b : "(%s > %s)" % (varname(a), varname(b))
+dismap["eqir"] = lambda a, b : "(%d == %s)" % (a, varname(b))
+dismap["eqri"] = lambda a, b : "(%s == %d)" % (varname(a), b)
+dismap["eqrr"] = lambda a, b : "(%s == %s)" % (varname(a), varname(b))
+
+def disassemble(s, e):
+ for i in range(s, e):
+ ins = instructs[i]
+ aoc.debug(i ,":",varname(ins[3]),"=", dismap[ins[0]](ins[1], ins[2]))
+ aoc.debug()
+
+def execute():
+ global register, insptr
+
+ while register[inspaddr] < len(instructs):
+ insptr = register[inspaddr]
+ ins = instructs[insptr]
+
+ # execute command
+ if len(register) <= ins[3]:
+ register += [0 for x in range(ins[3] - len(register) + 1)]
+ register[ins[3]] = opmap[ins[0]](ins[1], ins[2])
+
+ # part 1
+ #if insptr == 13 and register[4] == 1:
+ # aoc.debug(register)
+ # return
+
+ # increment instruction pointer
+ register[inspaddr] += 1
+
+def solve1(args):
+ r0 = 1797184 # (first opportunity for comparison r1 and r0)
+
+ #disassemble(0, len(instructs))
+ #execute()
+
+ return r0
+
+def solve2(args):
+ r1 = 0
+ candidates = list()
+ while True:
+ r4 = r1 | 65536 # flip 9th bit
+ r1 = 3798839
+ while True: # scan bytes of r4 and add them to r1 and multiply
+ r5 = r4 & 255
+ r1 += r5
+ r1 = r1 & 16777215
+ r1 *= 65899 # equals 1 00000001 01101011
+ r1 = r1 & 16777215
+ if r4 < 256:
+ break
+ r4 = int(r4/256) # bit shift 8 to the right
+ if r1 not in candidates:
+ candidates.append(r1)
+ elif r1 == candidates[-1]:
+ return candidates[-1]
+
+aoc.run(solve1, solve2, sols=[1797184, 11011493])
diff --git a/src/21/test1 b/src/21/test1 new file mode 100644 index 0000000..d7d2a21 --- /dev/null +++ b/src/21/test1 @@ -0,0 +1,8 @@ +#ip 0 +seti 5 0 1 +seti 6 0 2 +addi 0 1 0 +addr 1 2 3 +setr 1 0 0 +seti 8 0 4 +seti 9 0 5 diff --git a/src/22/input b/src/22/input new file mode 100644 index 0000000..9b643c6 --- /dev/null +++ b/src/22/input @@ -0,0 +1,2 @@ +depth: 4848
+target: 15,700
diff --git a/src/22/part1 b/src/22/part1 new file mode 100644 index 0000000..bb29305 --- /dev/null +++ b/src/22/part1 @@ -0,0 +1,106 @@ +--- Day 22: Mode Maze --- + +This is it, your final stop: the year -483. It's snowing and dark outside; the only light you can +see is coming from a small cottage in the distance. You make your way there and knock on the door. + +A portly man with a large, white beard answers the door and invites you inside. For someone living +near the North Pole in -483, he must not get many visitors, but he doesn't act surprised to see you. +Instead, he offers you some milk and cookies. + +After talking for a while, he asks a favor of you. His friend hasn't come back in a few hours, and +he's not sure where he is. Scanning the region briefly, you discover one life signal in a cave +system nearby; his friend must have taken shelter there. The man asks if you can go there to +retrieve his friend. + +The cave is divided into square [1m[97mregions[0m which are either dominantly [1m[97mrocky[0m, [1m[97mnarrow[0m, or +[1m[97mwet[0m (called its [1m[97mtype[0m). Each region occupies exactly one [1m[97mcoordinate[0m in X,Y format where X and Y are +integers and zero or greater. (Adjacent regions can be the same type.) + +The scan (your puzzle input) is not very detailed: it only reveals the [1m[97mdepth[0m of the cave system and +the [1m[97mcoordinates of the target[0m. However, it does not reveal the type of each region. The mouth of the +cave is at 0,0. + +The man explains that due to the unusual geology in the area, there is a method to determine any +region's type based on its [1m[97merosion level[0m. The erosion level of a region can be determined from its +[1m[97mgeologic index[0m. The geologic index can be determined using the first rule that applies from the list +below: + + + - The region at 0,0 (the mouth of the cave) has a geologic index of 0. + + - The region at the coordinates of the target has a geologic index of 0. + + - If the region's Y coordinate is 0, the geologic index is its X coordinate times 16807. + + - If the region's X coordinate is 0, the geologic index is its Y coordinate times 48271. + + - Otherwise, the region's geologic index is the result of multiplying the erosion +[1m[97mlevels[0m of the regions at X-1,Y and X,Y-1. + + +A region's [1m[97merosion level[0m is its [1m[97mgeologic index[0m plus the cave system's [1m[97mdepth[0m, all modulo 20183. Then: + + + - If the [1m[97merosion level modulo 3[0m is 0, the region's type is [1m[97mrocky[0m. + + - If the [1m[97merosion level modulo 3[0m is 1, the region's type is [1m[97mwet[0m. + + - If the [1m[97merosion level modulo 3[0m is 2, the region's type is [1m[97mnarrow[0m. + + +For example, suppose the cave system's depth is 510 and the target's coordinates are 10,10. Using % +to represent the modulo operator, the cavern would look as follows: + + + - At 0,0, the geologic index is 0. The erosion level is (0 + 510) % 20183 = 510. The type is 510 % +3 = 0, [1m[97mrocky[0m. + + - At 1,0, because the Y coordinate is 0, the geologic index is 1 * 16807 = 16807. The erosion level +is (16807 + 510) % 20183 = 17317. The type is 17317 % 3 = 1, [1m[97mwet[0m. + + - At 0,1, because the X coordinate is 0, the geologic index is 1 * 48271 = 48271. The erosion +level is (48271 + 510) % 20183 = 8415. The type is 8415 % 3 = 0, [1m[97mrocky[0m. + + - At 1,1, neither coordinate is 0 and it is not the coordinate of the target, so the geologic index +is the erosion level of 0,1 (8415) times the erosion level of 1,0 (17317), 8415 * 17317 = 145722555. +The erosion level is (145722555 + 510) % 20183 = 1805. The type is 1805 % 3 = 2, +[1m[97mnarrow[0m. + + - At 10,10, because they are the target's coordinates, the geologic index is 0. The erosion level +is (0 + 510) % 20183 = 510. The type is 510 % 3 = 0, [1m[97mrocky[0m. + + +Drawing this same cave system with rocky as ., wet as =, narrow as |, the mouth as M, the target as +T, with 0,0 in the top-left corner, X increasing to the right, and Y increasing downward, the +top-left corner of the map looks like this: + +[1m[97mM[0m=.|=.|.|=.|=|=. +.|=|=|||..|.=... +.==|....||=..|== +=.|....|.==.|==. +=|..==...=.|==.. +=||.=.=||=|=..|= +|.=.===|||..=..| +|..==||=.|==|=== +.=..===..=|.|||. +.======|||=|=.|= +.===|=|===[1m[97mT[0m===|| +=|||...|==..|=.| +=.=|=.=..=.||==| +||=|=...|==.=|== +|=.=||===.|||=== +||.|==.|.|.||=|| + +Before you go in, you should determine the [1m[97mrisk level[0m of the area. For the rectangle that has a +top-left corner of region 0,0 and a bottom-right corner of the region containing the target, add up +the risk level of each individual region: 0 for rocky regions, 1 for wet regions, and 2 for narrow +regions. + +In the cave system above, because the mouth is at 0,0 and the target is at 10,10, adding up the risk +level of all regions with an X coordinate from 0 to 10 and a Y coordinate from 0 to 10, this total +is [1m[97m114[0m. + +[1m[97mWhat is the total risk level for the smallest rectangle that includes 0,0 and the target's +coordinates?[0m + + diff --git a/src/22/part2 b/src/22/part2 new file mode 100644 index 0000000..fbcfdd7 --- /dev/null +++ b/src/22/part2 @@ -0,0 +1,22 @@ +--- Part Two --- + +After a while, you realize your shuffling skill won't improve much more with merely a single deck of +cards. You ask every 3D printer on the ship to make you some more cards while you check on the ship +repairs. While reviewing the work the droids have finished so far, you think you see Halley's Comet +fly past! + +When you get back, you discover that the 3D printers have combined their power to create for you a +single, giant, brand new, [1m[97mfactory order[0m deck of [1m[97m119315717514047 space cards[0m. + +Finally, a deck of cards worthy of shuffling! + +You decide to apply your complete shuffle process (your puzzle input) to the deck +[1m[97m101741582076661 times in a row[0m. + +You'll need to be careful, though - one wrong move with this many cards and you might +[1m[97moverflow[0m your entire ship! + +After shuffling your new, giant, [1m[97mfactory order[0m deck that many times, [1m[97mwhat number is on the card that +ends up in position 2020?[0m + + diff --git a/src/22/solve.py b/src/22/solve.py new file mode 100644 index 0000000..375ae23 --- /dev/null +++ b/src/22/solve.py @@ -0,0 +1,93 @@ +import sys
+sys.path.append("../common")
+import aoc
+import networkx
+
+adjacent = [[-1, 0], [0, -1], [1, 0], [0, 1]]
+
+# create symbol definitions
+symbols = [".", "=", "|"]
+rocky, wet, narrow = 0, 1, 2
+torch, gear, neither = 0, 1, 2
+
+tooloptions = dict()
+tooloptions[rocky] = (torch, gear)
+tooloptions[wet] = (gear, neither)
+tooloptions[narrow] = (torch, neither)
+
+# parse input file
+def parse_input(si):
+ s = si.split("\n")
+ depth = int(s[0].split(": ")[1])
+ target = [int(v) for v in s[1].split(": ")[1].split(",")]
+ return depth, target
+
+# get erosion level from geological index
+def get_erosion_level(n):
+ return (n + depth) % 20183
+
+# generate map of erosion types
+def gen_map():
+ grid = [[0 for x in range(mrange[0])] for y in range(mrange[1])]
+
+ # generate values on x side
+ grid[0] = [get_erosion_level(x * 16807) for x in range(mrange[0])]
+
+ # generate values on y side
+ for y in range(mrange[1]):
+ grid[y][0] = get_erosion_level(y * 48271)
+
+ # fill in other positions
+ for y in range(1, mrange[1]):
+ for x in range(1, mrange[0]):
+ grid[y][x] = get_erosion_level(grid[y-1][x] * grid[y][x-1])
+
+ # mod 3 for env type
+ grid = [[grid[y][x] % 3 for x in range(mrange[0])] for y in range(mrange[1])]
+
+ # start position is rocky
+ grid[target[1]][target[0]] = 0
+
+ return grid
+
+# define constants from input file
+depth, target = parse_input(aoc.data)
+mrange = (target[0] + 100, target[1] + 100) # 100 block padding for potential hook-paths
+
+vmap = gen_map()
+
+def risk_level(width, height):
+ risk = 0
+ for y in range(height + 1):
+ for x in range(width + 1):
+ risk += vmap[y][x]
+ return risk
+
+def adj(p):
+ return [[p[0] + di[0], p[1] + di[1]] for di in adjacent]
+
+def dijkstra():
+ graph = networkx.Graph()
+ for y in range(mrange[1]):
+ for x in range(mrange[0]):
+ tools = tooloptions[vmap[y][x]]
+ # always takes 7 minutes to switch, 2 z-options for each tool
+ graph.add_edge((x, y, tools[0]), (x, y, tools[1]), weight = 7)
+ for (nx, ny) in adj((x, y)):
+ if 0 <= nx < mrange[0] and 0 <= ny < mrange[1]:
+ ntools = tooloptions[vmap[ny][nx]]
+ # if tool is usable in both environments
+ for tool in [t for t in tools if t in ntools]:
+ # then it only takes 1 minute
+ graph.add_edge((x, y, tool), (nx, ny, tool), weight = 1)
+
+ return networkx.dijkstra_path_length(graph,
+ (0, 0, torch), (target[0], target[1], torch))
+
+def solve1(args):
+ return risk_level(target[0], target[1])
+
+def solve2(args):
+ return dijkstra()
+
+aoc.run(solve1, solve2, sols=[11359, 976])
diff --git a/src/23/input b/src/23/input new file mode 100644 index 0000000..907fba5 --- /dev/null +++ b/src/23/input @@ -0,0 +1,1000 @@ +pos=<-16209987,47027970,47490542>, r=98801023
+pos=<73745460,41591621,42240956>, r=76560913
+pos=<4551319,6410013,77079444>, r=82537741
+pos=<-55798978,49930734,33808479>, r=79339065
+pos=<56057232,43991106,52515158>, r=60369161
+pos=<27685939,25858127,69445550>, r=67061283
+pos=<22783600,-683534,51135109>, r=70390130
+pos=<40167657,26125450,48671980>, r=58502052
+pos=<54015509,18650011,53936040>, r=85089447
+pos=<84654974,41945044,56166134>, r=94663913
+pos=<-46787351,48583488,47946572>, r=62570098
+pos=<19314005,97561006,51616905>, r=61212789
+pos=<24477527,46824853,50396966>, r=75100485
+pos=<67176091,46416523,30655622>, r=76751755
+pos=<-21150714,30959067,70905379>, r=77516823
+pos=<112218820,120699018,77494742>, r=55203229
+pos=<63770215,45551080,55860088>, r=69867429
+pos=<6379372,35506523,118307115>, r=92841505
+pos=<98096818,59728529,48249403>, r=98795760
+pos=<21527515,49560695,41315388>, r=74283972
+pos=<54834592,23221039,40704011>, r=77557183
+pos=<55426131,33893125,52095886>, r=69416781
+pos=<27596914,9934002,24452432>, r=79858015
+pos=<28090284,54212215,80637111>, r=55660928
+pos=<22829834,38364639,102907046>, r=83160527
+pos=<3668198,42627590,-18678120>, r=79661927
+pos=<103927773,50000865,47157607>, r=96872388
+pos=<36970463,45301027,87281941>, r=74739332
+pos=<33391255,-136600539,47600155>, r=87688788
+pos=<33665785,6992101,63192343>, r=85654056
+pos=<61173816,64883908,55555682>, r=74334136
+pos=<5097583,50069485,70432602>, r=60583429
+pos=<-1837092,78149001,59623045>, r=52961786
+pos=<-60254277,61998488,50503967>, r=86109418
+pos=<53977623,47174375,48514069>, r=51105170
+pos=<15601233,25924567,83048475>, r=68513023
+pos=<61361862,40953736,36970270>, r=70085412
+pos=<47547625,48236340,63394460>, r=58493616
+pos=<-63676796,44893701,56746887>, r=91949623
+pos=<87869217,42543699,52458504>, r=93571952
+pos=<32427048,17383348,52171127>, r=63002681
+pos=<81882342,52633871,54975916>, r=82212849
+pos=<70696757,44417317,55052272>, r=77119556
+pos=<-49248140,48737162,63680856>, r=80612077
+pos=<13918083,40390867,56560725>, r=84721595
+pos=<45452531,78018774,48053402>, r=64245527
+pos=<122091904,-27603918,34341477>, r=98462907
+pos=<77203590,45381319,48399764>, r=76009880
+pos=<57064408,44265526,51628232>, r=60214965
+pos=<16070640,53224911,90418044>, r=52434346
+pos=<35569361,39258587,91258220>, r=83356927
+pos=<9266305,-14804864,69422130>, r=91380305
+pos=<69537538,45933425,51327688>, r=70719672
+pos=<25585454,6947031,82170082>, r=96596377
+pos=<30639357,86989378,69892037>, r=80241676
+pos=<15753723,62546317,88149704>, r=59170501
+pos=<12855538,19978510,72163429>, r=60828332
+pos=<46404854,48880849,25641181>, r=58530637
+pos=<-55889541,54067735,54822996>, r=78132750
+pos=<41058882,36477717,72731301>, r=73100552
+pos=<46890524,38019010,47800562>, r=52459939
+pos=<31474689,24135827,25118982>, r=68867406
+pos=<96487710,47525097,50424697>, r=95175247
+pos=<49691010,61157444,17924445>, r=76504583
+pos=<40540965,41876057,86259788>, r=80712543
+pos=<33894722,-2428504,66917260>, r=99028363
+pos=<56723849,49175014,49948029>, r=53284817
+pos=<-30794270,57206520,31548596>, r=60664368
+pos=<73564235,61400251,46857703>, r=74542914
+pos=<50230740,37144250,54713473>, r=63587807
+pos=<33140809,16563216,50640572>, r=63006017
+pos=<78239061,39894506,46620636>, r=80753142
+pos=<19839558,48569582,41983045>, r=86418555
+pos=<64720131,45442707,71074558>, r=86140097
+pos=<21457591,12606422,44332714>, r=51166205
+pos=<53725145,78495032,53630822>, r=78571718
+pos=<43734268,22198578,63834795>, r=81158400
+pos=<21771033,50476594,46487442>, r=57349480
+pos=<17051700,28960038,105050402>, r=88930165
+pos=<-18344770,47674325,94566658>, r=81656729
+pos=<53690567,36285538,33032505>, r=71020161
+pos=<62596515,62743208,61128652>, r=79189162
+pos=<57223206,34405104,64928051>, r=83534116
+pos=<11829266,46127298,53324603>, r=68528612
+pos=<78262895,53220717,32577200>, r=82487080
+pos=<13876706,-17203933,69360895>, r=96229381
+pos=<1432258,2466968,69722185>, r=82242700
+pos=<55142824,17490510,60748876>, r=94189109
+pos=<54534147,70727873,57669388>, r=75652186
+pos=<48649521,50158347,56730144>, r=51009192
+pos=<36254749,31612966,199545974>, r=69834600
+pos=<12713539,43388882,-16167874>, r=72140165
+pos=<15293434,12604209,81398838>, r=79875960
+pos=<-12226196,82874914,57477922>, r=65931636
+pos=<55414530,27891313,76227929>, r=99539116
+pos=<-3214003,71845811,62636393>, r=51048754
+pos=<47317326,31864552,46854267>, r=58094894
+pos=<33621572,70179735,84493713>, r=81015867
+pos=<-31157992,41971599,54992735>, r=60598760
+pos=<-6565817,30537085,59150864>, r=51599243
+pos=<26040451,10276472,67233790>, r=78785619
+pos=<-9377417,22961418,77297688>, r=80133336
+pos=<-31455163,47474342,69151181>, r=69551704
+pos=<12347416,49879987,66463008>, r=83625401
+pos=<24352926,18651035,53296590>, r=54786430
+pos=<21535513,30531456,6161487>, r=71490349
+pos=<27353414,12930603,27343507>, r=73726872
+pos=<40948831,48373073,76082712>, r=64446317
+pos=<90922819,43664008,51436920>, r=94483573
+pos=<95901984,53671403,54584582>, r=96878705
+pos=<496719,75206859,67122627>, r=55185250
+pos=<26687396,25498336,64050389>, r=61027345
+pos=<17008662,9290371,30714222>, r=63651597
+pos=<13091033,7361420,62651595>, r=64169079
+pos=<89671041,66491288,49999754>, r=98882863
+pos=<59882546,46663400,47620974>, r=56628711
+pos=<87101386,45508539,47318881>, r=84699594
+pos=<45475543,55304319,82271799>, r=75772380
+pos=<44482272,35793511,27613792>, r=67722623
+pos=<51319604,35806204,54539578>, r=65840847
+pos=<36251727,53297127,50749236>, r=92755594
+pos=<20784337,34927212,49970474>, r=80484149
+pos=<15081418,72186832,76913680>, r=56902641
+pos=<-19373364,75634015,16244758>, r=82975025
+pos=<28986836,15822980,74547083>, r=83498937
+pos=<36401949,34990986,55367621>, r=52566460
+pos=<54595254,46310166,49948012>, r=54020963
+pos=<39784774,22581345,56449213>, r=69440488
+pos=<32290220,18277524,59512701>, r=69313902
+pos=<48841968,43780382,90240460>, r=91089970
+pos=<25569157,-15885460,56395751>, r=93638214
+pos=<44290962,21726746,47365822>, r=65717886
+pos=<58217123,45116498,35265903>, r=64482281
+pos=<63242944,47468029,60274913>, r=71837737
+pos=<41921146,14579274,55047915>, r=78177703
+pos=<35082182,23433908,31357271>, r=66938948
+pos=<-41745520,55032124,64322796>, r=74453061
+pos=<89483854,36242092,50686383>, r=99716110
+pos=<-18428434,42488730,32228176>, r=50991328
+pos=<26539721,61700251,54811617>, r=78993320
+pos=<35745027,43347675,69843919>, r=58029214
+pos=<55551797,40133351,46783489>, r=57989814
+pos=<73277883,49306136,49363646>, r=69123808
+pos=<41328708,14615105,32896741>, r=80464413
+pos=<24355178,-15165549,47534306>, r=82843195
+pos=<12741008,28698289,79114502>, r=58945148
+pos=<46280279,88189533,55896827>, r=83087401
+pos=<71840345,48196815,69091010>, r=88522382
+pos=<21867617,28933226,90405305>, r=79127578
+pos=<-22111659,37170464,54577924>, r=55939091
+pos=<74753799,37626920,26622580>, r=97151874
+pos=<-33233446,23673463,65264098>, r=91243777
+pos=<63703596,53768919,43093372>, r=57959547
+pos=<21689341,47523258,83572411>, r=53526595
+pos=<16104682,39976757,81821905>, r=53737797
+pos=<34341621,49348508,53271674>, r=73754793
+pos=<28713678,48347792,52665655>, r=59784304
+pos=<-44557541,49112081,50128372>, r=61993602
+pos=<15611067,50472688,56496573>, r=77499817
+pos=<28155302,56820155,7215922>, r=61340089
+pos=<30142712,75249794,73282061>, r=71395316
+pos=<19563200,31655975,-2390374>, r=76945121
+pos=<45316184,28301941,63819256>, r=76621493
+pos=<-58822393,41399159,52007667>, r=85850551
+pos=<85439557,47865361,50181181>, r=83543302
+pos=<61219321,57339205,59699536>, r=70978975
+pos=<12702571,31243144,87807651>, r=65054926
+pos=<15913429,39656114,121157788>, r=93203087
+pos=<21783328,45025340,42445890>, r=84705547
+pos=<29529025,47582200,50397780>, r=82577309
+pos=<69141052,33504917,41396423>, r=80887368
+pos=<20010841,95986253,52126261>, r=60844065
+pos=<31080682,103152018,69697014>, r=96650829
+pos=<63979353,46299690,84868254>, r=98336196
+pos=<2372524,64645160,30440764>, r=79346435
+pos=<5594935,33832616,89847963>, r=66840156
+pos=<70149544,42867469,14935636>, r=98993964
+pos=<72027944,37978949,52905695>, r=82742805
+pos=<9008546,15909210,10253278>, r=72108282
+pos=<-25205732,29845445,52876789>, r=64656691
+pos=<73115779,48976059,50530315>, r=70457975
+pos=<27510427,10020616,82199214>, r=95477391
+pos=<62028292,38168188,55268688>, r=74916860
+pos=<-8805465,85625532,12773938>, r=85869253
+pos=<-10547582,8713883,46694851>, r=64948201
+pos=<13410194,27385806,99989241>, r=81801503
+pos=<22719567,37243277,76871789>, r=58136433
+pos=<37290216,34006595,62093726>, r=61165474
+pos=<45157080,23569186,33913884>, r=74321570
+pos=<26713948,1122681,78458414>, r=99837563
+pos=<27958057,47737175,80870002>, r=56879297
+pos=<61247315,61474051,53092349>, r=68534495
+pos=<34297427,8233221,43683213>, r=69028617
+pos=<851641,-18176823,60770160>, r=94515620
+pos=<35366439,36416696,72516368>, r=67254047
+pos=<26678851,44555934,118379531>, r=96290405
+pos=<18791088,4747346,54722449>, r=64554096
+pos=<-30614396,35309724,38002656>, r=64581516
+pos=<-10320557,76729842,93474188>, r=93877069
+pos=<13776253,112564232,47459616>, r=66520809
+pos=<-19426400,76077875,73457390>, r=82314393
+pos=<20392710,-597374,75723277>, r=92501204
+pos=<73565874,44941739,46762681>, r=71174659
+pos=<44794582,45211865,34417889>, r=51812431
+pos=<30808532,11094130,61030147>, r=76532437
+pos=<46909639,5793869,53612079>, r=90516030
+pos=<27513857,3328475,16421598>, r=94411369
+pos=<21640888,8618138,58030066>, r=66841101
+pos=<60187840,48378575,49626488>, r=57223601
+pos=<53323160,35056110,60192977>, r=74248013
+pos=<39045276,34764803,92526128>, r=92594547
+pos=<29788477,33246508,82610486>, r=74940456
+pos=<61287491,41064943,75859138>, r=91869706
+pos=<83805674,38606862,33472372>, r=98374442
+pos=<24765096,72558665,83491980>, r=73536803
+pos=<73243064,48794009,48347901>, r=68585135
+pos=<2257507,48610195,50126246>, r=50579503
+pos=<56097309,27350537,68965302>, r=93499983
+pos=<27401848,61892753,108424451>, r=90440369
+pos=<38085245,31391991,62957917>, r=65439403
+pos=<27389873,44871535,57954105>, r=93238295
+pos=<28642998,55245239,47015295>, r=59138145
+pos=<59538529,72127104,48554461>, r=72940901
+pos=<24695503,17370947,71439981>, r=74552391
+pos=<190046363,60522528,59689720>, r=92569687
+pos=<83874063,57401017,55642739>, r=89638527
+pos=<37870963,32991930,88576851>, r=89243765
+pos=<59858602,21117176,60067051>, r=94596816
+pos=<62954004,39908683,30959151>, r=78733760
+pos=<-53805700,48011649,48466717>, r=70680467
+pos=<33918641,25229014,60092421>, r=64570019
+pos=<29935706,34682379,24104345>, r=57796544
+pos=<45469975,42072374,51688123>, r=50873804
+pos=<239645,49028770,53431321>, r=50918757
+pos=<22090049,90648730,38816139>, r=57503031
+pos=<73604072,38716803,53552837>, r=84228037
+pos=<-51648900,56507375,61236299>, r=82745278
+pos=<11433948,43173426,103762424>, r=67811156
+pos=<23769388,39639423,-15963779>, r=86741470
+pos=<90108754,49907193,36538383>, r=90310826
+pos=<40849395,23391212,49075614>, r=62321996
+pos=<60821623,36192478,49278751>, r=69695738
+pos=<-55004700,46205783,64401507>, r=89620119
+pos=<63891681,29314730,23382396>, r=97842273
+pos=<22899842,15990496,81493049>, r=84190251
+pos=<89442429,47657270,41332006>, r=87100806
+pos=<79902041,44400909,61780770>, r=93069934
+pos=<12154437,4371833,26551604>, r=67878763
+pos=<27961135,87898499,76297820>, r=84878304
+pos=<31179984,28156901,39622919>, r=50047728
+pos=<58834795,30116288,46805154>, r=71312238
+pos=<-37468150,39344404,49020703>, r=63564073
+pos=<13787634,30078047,95312289>, r=74809856
+pos=<21258677,24051888,59906910>, r=52901660
+pos=<25225987,10325944,48238626>, r=58926753
+pos=<-10216665,25028155,91775630>, r=93383813
+pos=<63196009,23817526,51927834>, r=87094186
+pos=<78200816,44278767,50093045>, r=79803049
+pos=<12524886,4324522,65091297>, r=69079602
+pos=<48398389,35662075,50732742>, r=59256899
+pos=<23193286,27697887,23748030>, r=58395019
+pos=<82171057,54001603,31121508>, r=88631620
+pos=<15882046,39600274,101297409>, r=73367075
+pos=<70345026,37464544,69938048>, r=98606419
+pos=<-31043984,49767824,33513724>, r=55042141
+pos=<-55745758,44494393,32168250>, r=86362423
+pos=<56968345,37311126,47328713>, r=62774012
+pos=<30491191,36646570,70589772>, r=60222460
+pos=<48790001,39470499,56116026>, r=61223433
+pos=<28232060,46775992,59299221>, r=73067993
+pos=<68721330,45676371,55700353>, r=74533436
+pos=<38025035,19071830,68806731>, r=83548020
+pos=<42463034,37837946,80990100>, r=81403157
+pos=<36140392,49413460,90167162>, r=72682232
+pos=<26340970,55295635,91433924>, r=65791237
+pos=<15217405,9663894,22720612>, r=69480434
+pos=<81192075,46831788,43722714>, r=77285227
+pos=<15791903,28617628,110143879>, r=93105998
+pos=<16868923,49996635,56353961>, r=59812204
+pos=<42072515,52655370,102307622>, r=89756283
+pos=<14064447,19989302,103921055>, r=93784250
+pos=<37033923,49843789,84769975>, r=67748133
+pos=<22272907,-8628448,64767492>, r=91456997
+pos=<66433463,32496150,53421452>, r=83146990
+pos=<20376840,-12139249,36699606>, r=82464067
+pos=<-23069411,40763186,74371558>, r=73097410
+pos=<16697985,15972562,66507867>, r=63021135
+pos=<58007380,45899300,56513705>, r=64409631
+pos=<12761878,101691058,52895130>, r=60068852
+pos=<65894728,48209002,40462715>, r=63870563
+pos=<-23578044,34329341,37436507>, r=59091730
+pos=<68670964,16020450,49033118>, r=97471527
+pos=<33450874,47692314,-16223660>, r=88629759
+pos=<29781906,110368238,48159734>, r=81030671
+pos=<-27382509,21051143,53767746>, r=76518917
+pos=<60711958,39335255,52007845>, r=69172501
+pos=<11873166,88653870,23702422>, r=60405198
+pos=<58456301,48334661,79898883>, r=85808755
+pos=<50561688,48802388,55004270>, r=52551686
+pos=<43906493,32073585,51254496>, r=58875453
+pos=<47202402,50487493,70388561>, r=62891312
+pos=<-24116893,35291116,42635465>, r=53469675
+pos=<29209795,48521255,32274473>, r=85692282
+pos=<22484243,31939044,41793056>, r=82345538
+pos=<39097645,48891805,-19388309>, r=96241673
+pos=<59448744,68318970,40736586>, r=70611679
+pos=<83899973,37394573,49527516>, r=91820849
+pos=<55119095,50531578,51820611>, r=52196052
+pos=<45909585,53516236,86611488>, r=78758039
+pos=<19575906,47754929,98232262>, r=65841157
+pos=<19821157,36832032,108165950>, r=86942918
+pos=<-42420092,49011802,49296701>, r=59124779
+pos=<16472049,493910,53543555>, r=65309626
+pos=<68475317,41875907,27009080>, r=86237985
+pos=<67975635,48132669,50642322>, r=66273143
+pos=<25514411,65896120,89685291>, r=73816791
+pos=<16076440,89463609,74072826>, r=72333648
+pos=<27038996,32284186,65083628>, r=55626291
+pos=<-45037807,54600267,50510768>, r=63501514
+pos=<75059894,43339425,51691601>, r=79200072
+pos=<45152503,13344493,68568525>, r=96164400
+pos=<23873270,96606052,51217763>, r=64418135
+pos=<35898574,15927821,56647149>, r=72405745
+pos=<14612996,38731636,51361472>, r=77646591
+pos=<-5902131,-3009640,68615229>, r=93946649
+pos=<74100631,46397060,60185704>, r=83677550
+pos=<2936997,10598739,66630803>, r=69514991
+pos=<33570368,26782253,65025779>, r=67601981
+pos=<22620708,70858421,14393696>, r=62665863
+pos=<69466587,47252697,80746089>, r=98747882
+pos=<57532000,43090615,46974285>, r=57203560
+pos=<-33323057,91524681,48752606>, r=86952945
+pos=<41867684,17902013,28694498>, r=81918918
+pos=<146474118,-17792253,48791288>, r=91760988
+pos=<43673493,41382502,93959889>, r=92038818
+pos=<88776317,60159570,51464487>, r=93121118
+pos=<41060247,13736073,29064377>, r=84907334
+pos=<42728063,-10035065,46708469>, r=95259841
+pos=<-31248574,22471388,51225348>, r=76422198
+pos=<-18292749,36619041,94605944>, r=92699396
+pos=<17669559,37527354,30367227>, r=58873366
+pos=<54066075,11948262,58745633>, r=96651610
+pos=<45634092,29248479,22896668>, r=80136484
+pos=<-3795303,14198844,66360238>, r=72376722
+pos=<52020051,48753548,73821716>, r=72876113
+pos=<44548645,71463152,22277466>, r=77314771
+pos=<95943902,49609488,50198922>, r=92321250
+pos=<11382219,49322850,110903283>, r=68750606
+pos=<16308951,38157204,77052401>, r=50992004
+pos=<49901052,45124447,52037873>, r=52602362
+pos=<11714697,46522793,60277422>, r=86501043
+pos=<32599204,10080713,42412200>, r=66753836
+pos=<-50339159,23376356,49895699>, r=93278133
+pos=<-481926,60817079,58399771>, r=73508417
+pos=<-34775068,30743004,72593787>, r=93045883
+pos=<31703167,37579991,26710568>, r=54060155
+pos=<41418042,75865990,48410305>, r=58415074
+pos=<55730667,44335603,79466153>, r=86649137
+pos=<48921063,-1366791,47738032>, r=93813807
+pos=<18627860,75681093,104199391>, r=91229054
+pos=<-36525811,42687600,48387004>, r=58644992
+pos=<28641236,45199073,77647713>, r=56877756
+pos=<56454486,55389785,46595035>, r=51160090
+pos=<-44194179,46266759,53335689>, r=67682726
+pos=<44618256,47710737,68453471>, r=61148903
+pos=<77229388,30534622,48416640>, r=90899526
+pos=<77687829,54469926,72231820>, r=97110635
+pos=<63121199,36032263,53619717>, r=76496503
+pos=<12666308,1966278,52017002>, r=58505385
+pos=<9020703,41272284,104812725>, r=70939694
+pos=<-19876219,41329660,67061534>, r=62027710
+pos=<55241981,44813263,63241753>, r=69458443
+pos=<16356575,44485986,96742222>, r=64400701
+pos=<13419236,-2544111,43252873>, r=59358359
+pos=<22342824,37447768,-22522083>, r=94064662
+pos=<48434035,43030917,54104152>, r=55295183
+pos=<-39720309,18033694,53711823>, r=91818270
+pos=<68153523,24661189,51517065>, r=90797317
+pos=<57325117,36293425,52234259>, r=69053961
+pos=<13722317,-5975253,73260726>, r=88746404
+pos=<-22350557,14129834,68397483>, r=93037852
+pos=<-32846284,27309425,48298945>, r=70255582
+pos=<57109144,31122521,61722057>, r=83497409
+pos=<32946559,19404403,79754970>, r=89084974
+pos=<60061590,34361758,74387621>, r=95875303
+pos=<22533855,20654706,97156873>, r=94823874
+pos=<60152075,61920634,64021170>, r=78814818
+pos=<88164102,48936730,36418698>, r=89456571
+pos=<63892308,79586772,55868598>, r=92068421
+pos=<61532968,43473306,50786055>, r=64633657
+pos=<145623332,-2263726,69014308>, r=80292810
+pos=<2244472,27189143,66161887>, r=53148205
+pos=<-621732,102357809,52028838>, r=68360948
+pos=<61015381,58405279,64915602>, r=77056999
+pos=<60036547,55462799,48852232>, r=57072293
+pos=<94133369,46514549,54630562>, r=98037409
+pos=<72882906,59169748,51959185>, r=76732560
+pos=<32368075,60813968,24159462>, r=52602971
+pos=<54820773,44932220,56461271>, r=62137817
+pos=<62827112,31108663,57634227>, r=85140656
+pos=<51289253,34882837,19403489>, r=83650579
+pos=<175246533,31538525,67205974>, r=99505297
+pos=<25835322,2476858,51057405>, r=70203756
+pos=<12647698,-16202354,75015212>, r=99653119
+pos=<25266699,55270130,56338470>, r=67556059
+pos=<2882839,17030271,89204393>, r=85711363
+pos=<13196433,2362720,73412118>, r=80033960
+pos=<-11541580,50263890,48002742>, r=62312381
+pos=<34454328,40838677,18099279>, r=62164019
+pos=<37346077,31634254,28037442>, r=64321911
+pos=<11550857,42697314,39371708>, r=86650306
+pos=<-56401026,55366533,48205618>, r=73325693
+pos=<3816696,43852368,85718508>, r=54469130
+pos=<-79970804,49758850,41406694>, r=96084636
+pos=<14157508,103810845,60988076>, r=71677137
+pos=<4883606,49148947,120911158>, r=83298303
+pos=<-54154624,54732055,71287395>, r=93526560
+pos=<-107075921,141613208,48460011>, r=79578616
+pos=<68124043,48018177,54869429>, r=70763515
+pos=<83883062,40301975,59748843>, r=99118141
+pos=<54330488,26956855,58785754>, r=81947247
+pos=<76716545,35766972,30606196>, r=96991168
+pos=<16733076,27004538,93131598>, r=78648559
+pos=<3164345,49994959,56199522>, r=85739181
+pos=<-65558371,46915176,49114144>, r=84177039
+pos=<22685992,58644418,-950811>, r=65861709
+pos=<46358820,77830246,73429650>, r=90340073
+pos=<31784224,4207619,58310315>, r=81674765
+pos=<40645163,40567313,4653981>, r=82071403
+pos=<74363782,34217574,48163864>, r=84097917
+pos=<71820542,48586015,47738648>, r=66761057
+pos=<22234457,96842307,42253839>, r=60403387
+pos=<78451229,48820222,54996216>, r=80415223
+pos=<55176882,40544947,76946620>, r=87366696
+pos=<29097323,92590803,48640896>, r=63049730
+pos=<47699581,38966811,43687798>, r=51692495
+pos=<41901097,23376954,18308495>, r=86863193
+pos=<40226381,50474536,48478776>, r=60204013
+pos=<22090484,103665863,61385007>, r=79862151
+pos=<39247750,46181881,65887820>, r=54741938
+pos=<44210292,28931291,57045309>, r=68112618
+pos=<90306607,55489067,44378311>, r=84997943
+pos=<26653020,44999935,112425297>, r=89866225
+pos=<122251992,147643275,47675356>, r=94393500
+pos=<54219761,60627098,37141976>, r=61285654
+pos=<36649940,35082339,35920668>, r=52294500
+pos=<84892874,48719177,50121076>, r=82082848
+pos=<43120199,45946706,82533341>, r=75494753
+pos=<29831398,24225673,63889088>, r=65282736
+pos=<87394874,44998738,49682919>, r=87867324
+pos=<48084711,44048093,63225183>, r=63050163
+pos=<43079746,21416551,61833837>, r=79284894
+pos=<-27985227,50324769,88476742>, r=82556945
+pos=<12936227,-40139519,49809699>, r=98673305
+pos=<52836924,33137569,74342803>, r=89830087
+pos=<20467909,19474436,73112536>, r=69893864
+pos=<-44655883,49991909,47503850>, r=58587565
+pos=<39619033,24778414,30323670>, r=71165088
+pos=<19701254,77089381,95844145>, r=85355833
+pos=<30357825,18623923,53787778>, r=61309535
+pos=<28689384,13553180,85027304>, r=95951414
+pos=<22738613,44005405,92031474>, r=66552524
+pos=<24096661,16884327,51212128>, r=54212327
+pos=<41221658,20947737,74264841>, r=90326709
+pos=<68704250,49495499,37096454>, r=68759850
+pos=<41015706,30453802,34374780>, r=62834656
+pos=<-39192967,44418054,7052818>, r=95001429
+pos=<58346423,29905829,49694789>, r=73923235
+pos=<-47411321,37316615,28943783>, r=88430221
+pos=<6313009,62147666,88907284>, r=58094460
+pos=<-18949075,25664501,21189086>, r=79374791
+pos=<-6231316,47877771,94894815>, r=69668092
+pos=<-4959627,-11284677,51207141>, r=83871070
+pos=<-26800100,31316792,85891899>, r=97794986
+pos=<14800798,45475080,60920218>, r=72772631
+pos=<15574017,34567333,47616823>, r=66137500
+pos=<12571199,54183215,132092028>, r=91567229
+pos=<85964775,48452816,55987158>, r=89287458
+pos=<32528848,61756003,83668280>, r=70674142
+pos=<30415640,45251980,77786048>, r=58737656
+pos=<67405095,42038057,69727689>, r=90882628
+pos=<-27282332,29932094,67302192>, r=81072131
+pos=<27079726,55818148,118457056>, r=94075852
+pos=<47427996,25432369,65752919>, r=83536399
+pos=<35912784,28823686,2889180>, r=90847490
+pos=<19022011,10805866,42244718>, r=52618965
+pos=<55358564,45107226,86922766>, r=92961987
+pos=<91759672,52695604,55771385>, r=92947404
+pos=<60858731,31571552,49336855>, r=74411908
+pos=<46105003,47719012,104076255>, r=98250390
+pos=<64769624,44050871,46823679>, r=63330378
+pos=<56334065,35473114,46976697>, r=63625520
+pos=<38784558,36154334,74158463>, r=72576536
+pos=<15139892,18208980,77208777>, r=69927622
+pos=<29773988,37862753,46837729>, r=75128840
+pos=<-19400907,31009643,82672979>, r=87483874
+pos=<22436249,4335612,40742681>, r=64005480
+pos=<57933119,49369634,42963977>, r=52247105
+pos=<28821341,50174459,94048725>, r=68483455
+pos=<42766720,46919122,67704700>, r=59340324
+pos=<43192236,27198101,49575789>, r=61358052
+pos=<-43692646,50057336,47231844>, r=57286951
+pos=<24831701,44238507,82312902>, r=58694420
+pos=<-19868908,46213059,29145531>, r=51789614
+pos=<37674304,49027851,49803431>, r=90236159
+pos=<24179213,63137357,81030652>, r=61067930
+pos=<-835109,16301785,8763875>, r=83048767
+pos=<60007651,48580022,37157717>, r=60917473
+pos=<-3513465,58931192,36689940>, r=55272504
+pos=<64730482,44061727,58071338>, r=74527937
+pos=<57557140,27453254,49956610>, r=75848545
+pos=<-50758494,45826073,49691770>, r=71044146
+pos=<62645509,43017700,73596116>, r=89011779
+pos=<43962359,59963273,58181592>, r=54827941
+pos=<52767000,-690037,48453913>, r=97698880
+pos=<36714194,13278504,58057504>, r=77281248
+pos=<46379652,23339944,54461382>, r=73289025
+pos=<74833796,38777792,55501950>, r=87345964
+pos=<23836805,41117550,54512089>, r=73696116
+pos=<94628232,45461045,54228196>, r=99183319
+pos=<-202999,18069622,15568647>, r=73844178
+pos=<55086259,69483283,67351942>, r=84642235
+pos=<24550342,19362192,54084961>, r=55060970
+pos=<43561989,42181396,88479347>, r=85648270
+pos=<-10024336,12574124,61824031>, r=75694149
+pos=<63093494,50487012,63430637>, r=71824989
+pos=<13238260,46838666,114531109>, r=76718572
+pos=<-34508328,31733290,61903414>, r=81098212
+pos=<47273878,56549746,61206875>, r=57751410
+pos=<51901311,47124485,54742381>, r=55307053
+pos=<48911462,42998379,52595262>, r=54296238
+pos=<8423758,33788169,81472480>, r=55680436
+pos=<52489834,37039683,24551750>, r=77545996
+pos=<23221192,46053010,27109621>, r=98563626
+pos=<78341303,34632795,52942740>, r=92439118
+pos=<32822753,50528340,48492662>, r=97586626
+pos=<36078569,60831753,61121675>, r=50752802
+pos=<55393077,32887415,62078817>, r=80372957
+pos=<52577411,47834409,95027660>, r=95558504
+pos=<7982580,35935469,100410636>, r=72912221
+pos=<28254934,-5692809,48594864>, r=78330449
+pos=<93164787,53953121,37319613>, r=93379220
+pos=<69683700,50311127,43526271>, r=62493847
+pos=<69096402,68831913,54068839>, r=84717956
+pos=<-15616652,53162917,-21828268>, r=94820191
+pos=<35830017,36797729,60460363>, r=55280585
+pos=<35725837,39987392,71708389>, r=63234702
+pos=<28921285,10377573,21486225>, r=83705064
+pos=<58009877,36953434,64309175>, r=81153603
+pos=<4041304,23448367,80380950>, r=69311143
+pos=<-40188030,50193428,73717210>, r=80131916
+pos=<45331205,43356992,-10246333>, r=98868108
+pos=<33231458,35304292,63319974>, r=57035283
+pos=<83212557,55802897,49643328>, r=81379842
+pos=<52407685,62044414,55808689>, r=62981541
+pos=<24465344,55030614,40709025>, r=54511963
+pos=<34822445,35586247,94835471>, r=89859730
+pos=<41947430,106641696,58499087>, r=99808954
+pos=<34007805,25332256,74415584>, r=78879361
+pos=<42353277,21583684,43211560>, r=64205555
+pos=<46824219,41469745,81092671>, r=82235471
+pos=<39175888,64066480,56005552>, r=51968987
+pos=<35169294,14706659,70874056>, r=87124538
+pos=<31756579,36505937,69862353>, r=60901351
+pos=<66186233,74698949,62308132>, r=95914312
+pos=<18299494,9943745,88313443>, r=92457156
+pos=<64305625,54642605,46635994>, r=58305361
+pos=<43342211,54051656,-12524699>, r=93499604
+pos=<1204873,43713891,90688678>, r=62189555
+pos=<-13283018,54729947,41861605>, r=69590101
+pos=<-31932080,38880157,7478672>, r=92852555
+pos=<67997362,18838826,53846693>, r=98793093
+pos=<45005507,45677940,68474889>, r=63590345
+pos=<25047748,19693002,56942178>, r=58084775
+pos=<59536893,53878804,44330064>, r=52666034
+pos=<-12305191,18814086,32691404>, r=68079081
+pos=<48514310,71015090,73260507>, r=85510764
+pos=<23215433,24849773,62414951>, r=56568576
+pos=<48375251,44217463,50195484>, r=50141167
+pos=<8533516,5205217,57154320>, r=59835206
+pos=<41744489,61900670,68759898>, r=65125788
+pos=<25995530,53455792,52876125>, r=84745629
+pos=<41898674,28658953,46841382>, r=55868987
+pos=<46615138,40873389,53992506>, r=55522112
+pos=<13621634,15130507,61150930>, r=55429905
+pos=<28800949,96176199,42744584>, r=65812962
+pos=<50716446,46054079,51943058>, r=52393279
+pos=<66090044,46936103,49597951>, r=64539754
+pos=<12384728,99052817,46672196>, r=50830830
+pos=<30507487,46324078,49196636>, r=53377596
+pos=<56707853,42200865,4638876>, r=96515756
+pos=<45826945,29273332,70679395>, r=83020876
+pos=<65858096,44235953,74579721>, r=91990032
+pos=<28468588,10920920,16097499>, r=88097726
+pos=<39759374,55004146,65068076>, r=52552527
+pos=<32722185,9152217,77258644>, r=96616467
+pos=<40263724,90798362,74141016>, r=97923911
+pos=<63813583,25734960,52445419>, r=86311957
+pos=<13623156,-11399099,50323103>, r=71133222
+pos=<18835638,13208529,78575760>, r=79990895
+pos=<31131751,31960100,16459375>, r=69359930
+pos=<-5532018,47842393,49544702>, r=58199211
+pos=<52543769,56002412,56281106>, r=57548097
+pos=<17271103,16098713,85210155>, r=82170398
+pos=<8560336,-262030,79159540>, r=87280971
+pos=<49926956,35704274,61116865>, r=71127399
+pos=<24101783,26395277,56890858>, r=50385330
+pos=<31297309,36015975,73610976>, r=64680170
+pos=<60951357,47487423,50040977>, r=59292976
+pos=<-6552339,46865581,54171566>, r=97135699
+pos=<12266799,29794615,102575318>, r=80835894
+pos=<41362010,-1001153,50726468>, r=88877562
+pos=<-79408914,53316703,42177087>, r=94760688
+pos=<104015414,-12058702,95553517>, r=85034410
+pos=<36118486,58455496,73252433>, r=60547157
+pos=<-162951879,53857833,83594703>, r=82185074
+pos=<15903426,43651781,104639242>, r=72678942
+pos=<-32854808,26002494,56327108>, r=79599457
+pos=<21099481,19094332,100959051>, r=98752255
+pos=<24167618,-8739717,30495704>, r=89059173
+pos=<72394872,39330632,49717840>, r=78570062
+pos=<54775712,32622258,55154577>, r=73096062
+pos=<861857,49218541,51118330>, r=58066068
+pos=<-5468812,11766419,47201314>, r=57323538
+pos=<54376534,50267426,68123851>, r=68020831
+pos=<-11193839,16324032,71540744>, r=82830218
+pos=<-60523002,57442850,50274191>, r=81592741
+pos=<-29839548,43107702,59094053>, r=62245514
+pos=<40995692,35189656,31867983>, r=60585578
+pos=<2127548,79947411,64210470>, r=55382907
+pos=<76435206,62567388,49224029>, r=80947342
+pos=<18292419,78668262,89502317>, r=79183714
+pos=<61543563,48678038,49393560>, r=58047050
+pos=<49056268,16749754,54586590>, r=82681442
+pos=<32160288,47889573,74659453>, r=54718020
+pos=<43809313,17203556,60239870>, r=82633519
+pos=<18382152,13782734,50572366>, r=50960144
+pos=<-4612540,43956582,74570265>, r=51646458
+pos=<36877255,77690656,71014199>, r=78302974
+pos=<8461245,107223701,82490762>, r=94606042
+pos=<61128848,32827418,55774134>, r=79863718
+pos=<35913499,38963411,33332024>, r=50265639
+pos=<1127776,127388872,36292973>, r=94180310
+pos=<5714307,34985745,46938437>, r=89784313
+pos=<-15828124,26101435,54773764>, r=60920527
+pos=<17592081,23832016,67514705>, r=57062704
+pos=<22653811,39455116,-26751413>, r=96597920
+pos=<83579555,50410261,40303906>, r=79513010
+pos=<29570730,41524388,115128062>, r=98963193
+pos=<62901527,46405373,72119120>, r=84403400
+pos=<42033717,49579045,28951343>, r=50151335
+pos=<50290153,79090876,13155390>, r=99806125
+pos=<32838667,20265229,82380525>, r=90742084
+pos=<27072546,25112976,60984139>, r=58731786
+pos=<51760954,99673414,42947756>, r=92067022
+pos=<96223097,46579168,48454836>, r=93886917
+pos=<20539700,89615026,50388392>, r=53263954
+pos=<87474324,48927205,58630524>, r=92965513
+pos=<87649196,50247640,46578408>, r=79768044
+pos=<63644165,45941702,48165556>, r=61655968
+pos=<33917984,4384397,66017074>, r=91338622
+pos=<90694157,50424925,44050932>, r=82865925
+pos=<39280851,63394294,29871881>, r=56383866
+pos=<25736639,3788474,70557146>, r=88293650
+pos=<59625129,68137746,50847955>, r=71331539
+pos=<61786342,88735694,43227520>, r=90874904
+pos=<66478154,41830201,57355016>, r=77790879
+pos=<83213797,55956176,53769628>, r=85660378
+pos=<14226222,58285154,111838422>, r=77070532
+pos=<-11089422,72660627,37151124>, r=50811403
+pos=<11525519,36372344,-9153000>, r=70953805
+pos=<25625653,11933339,43090128>, r=57249743
+pos=<36965738,80069817,28251408>, r=72364572
+pos=<2572456,15663929,100772980>, r=98956227
+pos=<48816868,52979093,10561684>, r=74814866
+pos=<27764324,7364015,56320592>, r=72508887
+pos=<14680376,45038335,52622286>, r=87447411
+pos=<37306057,35355772,58697872>, r=56436152
+pos=<55684043,32089169,68474119>, r=87856982
+pos=<-18599421,-5478046,57047646>, r=97544769
+pos=<46354713,6968713,57464127>, r=92638083
+pos=<12118033,36165008,65677052>, r=92989592
+pos=<676447,14621732,49607037>, r=50728470
+pos=<45415617,25927891,47690084>, r=62966053
+pos=<51847139,43968466,50866526>, r=54533096
+pos=<57224688,40723631,79967977>, r=92256877
+pos=<-41974385,48487581,80338473>, r=90245001
+pos=<16279186,32644408,70877830>, r=50300455
+pos=<85730512,71284983,49342982>, r=99079305
+pos=<43300839,49858117,87012245>, r=76242982
+pos=<26140848,85069690,51915298>, r=55846552
+pos=<20067563,36478896,98226338>, r=77602895
+pos=<39024976,27267627,48331999>, r=55877287
+pos=<18110738,19933929,9316375>, r=75507977
+pos=<38156702,29592331,90417231>, r=94769476
+pos=<34468095,39311352,92446616>, r=83391277
+pos=<-25451345,41357746,73731306>, r=74245009
+pos=<145307806,16055465,95063224>, r=75973034
+pos=<88345475,44366394,46860999>, r=86627939
+pos=<6746817,43065828,49395836>, r=95953060
+pos=<89668345,49174202,42502939>, r=84638925
+pos=<19422506,48109611,52984496>, r=89581683
+pos=<23615329,24451475,80055897>, r=75007733
+pos=<24561493,70588119,78915934>, r=66786277
+pos=<-20892926,-38826140,130041705>, r=52046051
+pos=<56952734,44502535,86146779>, r=94384964
+pos=<59125451,70835494,37750123>, r=75791215
+pos=<59725315,44820369,88398197>, r=99091066
+pos=<57563903,84369724,56767806>, r=91422143
+pos=<18891838,32251556,89134226>, r=71562367
+pos=<-69109214,43003113,52687251>, r=95212996
+pos=<37148297,44575567,19114076>, r=60106192
+pos=<82516570,52959759,49160201>, r=77357244
+pos=<19925280,22565540,89295485>, r=82443083
+pos=<39831007,75957528,84332801>, r=92842107
+pos=<56267863,56708031,53720953>, r=59417573
+pos=<24392246,16027229,40515445>, r=54497098
+pos=<63416774,22732986,60340221>, r=96812001
+pos=<18771596,11907097,89674460>, r=92326888
+pos=<18295602,-904377,65180787>, r=80168710
+pos=<76729461,42587467,58598855>, r=88528733
+pos=<25931532,2564546,11558661>, r=98455851
+pos=<51390419,34959237,79913376>, r=92132677
+pos=<94475054,62344308,46861391>, r=96401848
+pos=<26239695,23326743,52168243>, r=50869390
+pos=<66754433,36150331,60711348>, r=87103297
+pos=<13266196,33527546,106571230>, r=82097743
+pos=<-111114055,25436871,-16523878>, r=63252951
+pos=<11785966,44919593,51105643>, r=92641366
+pos=<35035786,25809847,51892798>, r=56906614
+pos=<15815182,42589787,-28524114>, r=88397274
+pos=<-12205162,32089283,61698274>, r=58233858
+pos=<24004232,46728143,47520031>, r=80510576
+pos=<-39813644,45613790,54431313>, r=65051203
+pos=<11920487,38615876,104246746>, r=73339363
+pos=<11594417,28228040,87840235>, r=66994730
+pos=<30139945,39056924,99484053>, r=86355178
+pos=<73761945,56681469,48614608>, r=71778765
+pos=<59980939,29175677,26217768>, r=91235042
+pos=<30800201,20881857,60419025>, r=66125344
+pos=<-34885630,41760696,81446273>, r=90990848
+pos=<13252723,44070799,52426754>, r=94797487
+pos=<27523884,25555060,62301005>, r=60057803
+pos=<32470726,44648260,50078802>, r=96898852
+pos=<-53460454,38096864,58236941>, r=90020247
+pos=<-7776033,22272570,221743855>, r=86784484
+pos=<47643890,27979205,40999038>, r=65313513
+pos=<-49206723,45418829,48581232>, r=68789009
+pos=<26415945,-5360609,59927893>, r=87492289
+pos=<19632729,78551565,62425950>, r=53330966
+pos=<-29090215,37747226,47368558>, r=55131296
+pos=<-51203935,53688305,57192245>, r=75436998
+pos=<53194351,20229586,67261433>, r=96014134
+pos=<59033165,36574712,47501506>, r=65747804
+pos=<28726549,27459466,93978463>, r=91033437
+pos=<-30349534,63679163,66487486>, r=73868777
+pos=<20354826,55708258,37414470>, r=72587261
+pos=<42872525,39192697,50827455>, r=50295430
+pos=<4189367,50148842,96495172>, r=58576579
+pos=<19839189,17405958,53327135>, r=51548236
+pos=<58403995,10724829,48552702>, r=92019833
+pos=<56925937,26654482,53930796>, r=79990192
+pos=<85525382,46874490,48028508>, r=82467632
+pos=<78385761,56459173,49607407>, r=77173058
+pos=<28013172,47226074,79168364>, r=55743341
+pos=<-36546158,49367662,58228805>, r=61827009
+pos=<3642627,47501084,48667348>, r=57476869
+pos=<-15026375,34676964,79400636>, r=76169828
+pos=<44776752,36631338,71777618>, r=75710994
+pos=<50724281,61695377,82977929>, r=88118313
+pos=<50543721,68583753,53494826>, r=65343024
+pos=<64977795,48269498,54421041>, r=66917342
+pos=<64337633,33093342,58674046>, r=85706180
+pos=<84494054,42694659,47766968>, r=85354223
+pos=<79454530,40991599,47286470>, r=81537244
+pos=<23892691,60032681,90072163>, r=66718981
+pos=<21372139,1624627,53503785>, r=69039163
+pos=<32035749,76966477,77095200>, r=78818138
+pos=<-39499597,25497978,52638773>, r=83060005
+pos=<-10727342,21233519,89113195>, r=95026634
+pos=<34649133,-17816943,154076639>, r=51706066
+pos=<-310521,29251681,80872892>, r=68351348
+pos=<-35626731,35652256,75324884>, r=91719269
+pos=<-28584393,32369975,43021280>, r=60472430
+pos=<61823323,45088436,60143456>, r=72666223
+pos=<19033380,42730838,53791921>, r=74141163
+pos=<89830892,52562549,46779381>, r=81893560
+pos=<60608855,18813091,52694817>, r=90278462
+pos=<17267224,9563744,50202739>, r=53694165
+pos=<55214888,49890270,77081555>, r=78194093
+pos=<21982510,-9174335,56667109>, r=83611796
+pos=<35336772,34419679,54381440>, r=51087223
+pos=<35732933,81750930,86722356>, r=96927086
+pos=<40366133,48699432,63195639>, r=50650272
+pos=<13860407,36375969,101322588>, r=74595100
+pos=<16654655,36160858,79841714>, r=56123648
+pos=<13730532,24543010,108062953>, r=93038317
+pos=<56199116,27392338,60095346>, r=84689997
+pos=<44970060,64701313,51356719>, r=53748935
+pos=<71898699,50091653,58409487>, r=76004388
+pos=<18623007,7703241,34029562>, r=63537736
+pos=<-69845451,43522664,36014739>, r=97587341
+pos=<-53398759,61033989,53124637>, r=80910003
+pos=<18996826,123082386,64172124>, r=98972193
+pos=<15071090,48002057,56402678>, r=57294116
+pos=<64784508,42817602,60967142>, r=78722225
+pos=<33099124,20384062,48987534>, r=57490445
+pos=<56499928,48281788,30462746>, r=64403000
+pos=<62602261,43877833,56646859>, r=71159357
+pos=<40601081,46287045,83500099>, r=73602278
+pos=<46785400,44105544,53710952>, r=52178655
+pos=<31776156,49138212,57102165>, r=60343554
+pos=<-8087849,101058920,53869413>, r=76368664
+pos=<68800958,28321106,60722937>, r=96990643
+pos=<44816049,54633928,75794575>, r=67965727
+pos=<53252976,16997617,52757921>, r=84801128
+pos=<20159573,4917801,67394005>, r=78423671
+pos=<25186863,36991940,50906823>, r=71847864
+pos=<46455946,49323556,32169085>, r=51610830
+pos=<15112853,9193790,78091697>, r=79798602
+pos=<35172783,44955593,9138129>, r=67726599
+pos=<36845715,-3865187,58915348>, r=95414111
+pos=<12724806,43742754,47758789>, r=63661481
+pos=<13740984,41462272,59374328>, r=57290740
+pos=<7184350,-5378407,35786459>, r=69686895
+pos=<30315306,19909058,60567093>, r=66761347
+pos=<23042705,48106561,51062072>, r=50370479
+pos=<38003218,18795506,63663686>, r=78659260
+pos=<-50152515,23434111,49563288>, r=92701310
+pos=<19779981,31020057,87716735>, r=72264514
+pos=<54675785,37143320,47301025>, r=60621369
+pos=<27317419,85532118,10755307>, r=85674671
+pos=<24220749,30298714,65600831>, r=55311342
+pos=<38298211,16829754,79700955>, r=96957274
+pos=<-41859234,48457035,49945636>, r=59767580
+pos=<15266796,50152960,-16783399>, r=68545261
+pos=<17354489,34934398,73509340>, r=51717315
+pos=<76679677,41784174,46600433>, r=77283789
+pos=<75785122,49189963,24555572>, r=88687133
+pos=<31602386,-1809514,54021584>, r=83221452
+pos=<24197293,118556292,36240959>, r=90093112
+pos=<41713307,36996636,24935624>, r=66428640
+pos=<64299038,38463199,55694734>, r=77318434
+pos=<7757987,3749260,53680732>, r=58593180
+pos=<56221259,45539040,51392924>, r=57863010
+pos=<86280392,40570521,49823680>, r=91321406
+pos=<40985822,38422757,62675052>, r=61025959
+pos=<-19769433,28482426,78681909>, r=86388751
+pos=<-6975289,5730781,37065950>, r=71457939
+pos=<61259091,50186505,46648264>, r=53508700
+pos=<8622052,32220056,49275276>, r=88278530
+pos=<61833857,50412963,46753340>, r=53962077
+pos=<-4399009,48809097,49452903>, r=56894734
+pos=<48606866,55703082,56835691>, r=53866623
+pos=<40277235,43060796,86674977>, r=79679544
+pos=<66381376,38657592,47549643>, r=71061283
+pos=<66610246,33076581,51254403>, r=80575997
+pos=<-2229,78636750,63424870>, r=55416397
+pos=<18377518,48832963,53562604>, r=60890684
+pos=<90908649,49671025,54674574>, r=91700065
+pos=<62717793,49507540,49498777>, r=58496891
+pos=<-26695452,9896056,59394189>, r=92613353
+pos=<96813903,49950678,36030803>, r=97480109
+pos=<-45934044,48006955,85314808>, r=99661609
+pos=<28345752,89056626,57135197>, r=67258391
+pos=<46911176,67966691,50703397>, r=58302218
+pos=<45655336,-1240007,50118609>, r=92802415
+pos=<27257302,48792534,114476548>, r=88729184
+pos=<45076163,60506472,99480933>, r=97784511
+pos=<24440656,6331158,66321442>, r=80218952
+pos=<86718134,53471098,64974817>, r=97884835
+pos=<13002461,39245232,82230607>, r=51775751
+pos=<44016665,17763542,57611529>, r=79652512
+pos=<-40064560,37224025,75652211>, r=94912530
+pos=<68208507,25863026,38158715>, r=90834297
+pos=<57565384,22102840,65819937>, r=97070379
+pos=<-47003116,46864661,75781978>, r=92340060
+pos=<38490016,32334280,92578602>, r=94522370
+pos=<-5714689,45715794,87305984>, r=63724875
+pos=<4169961,32223055,70655443>, r=50682064
+pos=<11631169,53756595,112500350>, r=70608970
+pos=<27964048,53760540,51946071>, r=92193390
+pos=<62492358,64684669,60220122>, r=80117908
+pos=<-27985050,39566338,86615198>, r=91453594
+pos=<-52065594,42472259,56377190>, r=82390370
+pos=<3898843,34780596,84015287>, r=61755735
+pos=<73216183,66007552,63917955>, r=95862769
+pos=<-33586886,28099044,37596253>, r=75170893
+pos=<62162136,43593080,35027233>, r=70189425
+pos=<42380204,45054117,82581795>, r=75695929
+pos=<45713633,71246439,58274227>, r=67955009
+pos=<58496590,28810046,66509544>, r=91984064
+pos=<54228416,29844211,60458606>, r=80630925
+pos=<59125452,49727840,68165913>, r=73351472
+pos=<31594381,31254777,60488769>, r=56616312
+pos=<32996607,28401497,-6185652>, r=97428371
+pos=<-27676173,72955050,62868850>, r=76852602
+pos=<36595255,83832410,61664703>, r=74813170
+pos=<52289767,76573303,55458584>, r=77042452
+pos=<-34430198,64069661,41407622>, r=61304548
+pos=<15997561,36915640,46433122>, r=54038958
+pos=<16413353,47783146,34674415>, r=64901486
+pos=<64015954,32627612,35048732>, r=82987175
+pos=<21913810,20066037,60927310>, r=58562956
+pos=<96002159,52824857,46573747>, r=88121609
+pos=<39394945,28882724,7474056>, r=89685818
+pos=<20056233,48412744,50668598>, r=51524642
+pos=<30581455,6484858,69827246>, r=89711776
+pos=<73531536,63489490,52817602>, r=82559358
+pos=<65079976,47254318,50149238>, r=63763076
+pos=<58105319,28997976,74309152>, r=99204458
+pos=<21645135,25383360,65148930>, r=57198651
+pos=<59322587,38618996,31830445>, r=75520670
+pos=<75723124,49496530,47681602>, r=69696040
+pos=<72472729,43854197,49307273>, r=73713667
+pos=<92245604,45344606,55387050>, r=98076063
+pos=<87346974,40579582,55400523>, r=97955832
+pos=<58553092,85903549,61580627>, r=98758064
+pos=<22211175,17784675,38135312>, r=52938902
+pos=<-46446441,46123527,56447350>, r=73189932
+pos=<79651174,60649653,46567278>, r=79588813
+pos=<3183358,100608031,62255472>, r=73032671
+pos=<84980054,44306467,57852320>, r=94314054
+pos=<13159152,29544137,118948329>, r=98351255
+pos=<55989149,34723518,60253057>, r=77306587
+pos=<7464919,27618769,50195292>, r=76432568
+pos=<45662029,18032820,57472487>, r=80889542
+pos=<66488550,47840796,60192370>, r=74628113
+pos=<100834168,48505590,47688018>, r=95804844
+pos=<87058178,55277294,63550312>, r=98606540
+pos=<-19261340,57535170,95998544>, r=86147581
+pos=<22462549,16255123,52915145>, r=54910418
+pos=<35394749,-14347718,38837399>, r=97552776
+pos=<49442112,80167286,56485161>, r=78815295
+pos=<66124088,25084623,60378789>, r=97206223
+pos=<-39094862,31312067,71694639>, r=95897158
+pos=<45547869,28670666,77058327>, r=89723604
+pos=<-35254682,48200671,53522661>, r=56996485
+pos=<-50681993,48889912,58602953>, r=76814767
+pos=<93416089,42886451,50093636>, r=96411181
+pos=<40273726,50187487,66338184>, r=52212762
+pos=<71495746,53518296,47340518>, r=65075268
+pos=<35337185,28850385,52422541>, r=54697230
+pos=<-37186059,23174072,65019898>, r=95451690
+pos=<3055203,42428530,50525534>, r=79863289
+pos=<70807397,48153577,52976082>, r=71417799
+pos=<45425352,22601606,54140471>, r=72752062
+pos=<34860856,50202696,84178116>, r=64624132
+pos=<-35019085,35299269,67521723>, r=83661179
+pos=<52396219,18046217,66743576>, r=96881503
+pos=<21320619,82371380,96152708>, r=92565605
+pos=<15886629,53838385,51253655>, r=58325490
+pos=<25540620,-144082,61949032>, r=83421601
+pos=<19607299,26079014,80784933>, r=70101061
+pos=<43625002,82379202,46671610>, r=65396639
+pos=<18087611,27416816,79754040>, r=66212759
+pos=<52278728,43457996,59554059>, r=64162646
+pos=<191891394,43647854,79856100>, r=87885001
+pos=<-23316041,33305239,21542834>, r=75747369
+pos=<41051615,43217745,79629775>, r=73251611
+pos=<25282015,96914280,81356373>, r=96273579
+pos=<86498829,49826166,49875799>, r=82336333
+pos=<-2914005,73696408,20031560>, r=60791049
+pos=<72317668,48710121,46906664>, r=66302188
+pos=<24124048,40230442,50737700>, r=70045992
+pos=<-15331082,23393472,69420246>, r=77777481
+pos=<60370615,61835353,41939391>, r=63847038
+pos=<27912835,58216095,95876603>, r=74726266
+pos=<13135381,29673914,-7200729>, r=77310078
+pos=<-4293975,-7924701,63718721>, r=92357382
+pos=<-7845395,8196541,81649819>, r=97718361
+pos=<57821160,39886034,47821779>, r=61544955
+pos=<35050365,102312488,47343243>, r=77426827
+pos=<12449896,27209138,16418756>, r=55470037
+pos=<34494730,73748079,90752501>, r=91716038
+pos=<57118108,63486407,40599841>, r=63585305
+pos=<31614222,37827352,66347891>, r=55922716
+pos=<71921216,57086361,62053860>, r=83782202
+pos=<40604336,61796038,95345438>, r=90466524
+pos=<42823781,91753158,31528226>, r=86629121
+pos=<13084484,44428600,39734739>, r=58630736
+pos=<46026357,72434951,50677960>, r=61860344
+pos=<44047082,25365962,65870631>, r=80339615
+pos=<33858606,24554085,63480297>, r=68572838
+pos=<13990494,12966574,37651100>, r=50020522
+pos=<85453922,48022937,62761507>, r=95980379
+pos=<-14758008,50462005,34355789>, r=56928077
+pos=<-68410383,64305072,50641199>, r=96709132
+pos=<30323743,56371517,79602907>, r=59018900
+pos=<-17874241,42022179,93323172>, r=85595054
+pos=<-65617654,54203269,55220274>, r=88393709
+pos=<24714328,14807957,19217556>, r=77336830
+pos=<13766705,14407030,95466028>, r=90613558
+pos=<15391997,96619121,55137901>, r=59869773
+pos=<22510663,75019333,95466166>, r=85716891
+pos=<69099146,47076193,31474558>, r=77195928
+pos=<44744760,6567211,31332589>, r=93492631
+pos=<9200050,27713300,-12919955>, r=83285900
+pos=<66111729,48955586,47702449>, r=60646506
+pos=<-10141224,77420819,98708097>, r=99622712
diff --git a/src/23/part1 b/src/23/part1 new file mode 100644 index 0000000..675bbfa --- /dev/null +++ b/src/23/part1 @@ -0,0 +1,64 @@ +--- Day 23: Experimental Emergency Teleportation --- + +Using your torch to search the darkness of the rocky cavern, you finally locate the man's friend: a +small [1m[97mreindeer[0m. + +You're not sure how it got so far in this cave. It looks sick - too sick to walk - and too heavy +for you to carry all the way back. Sleighs won't be invented for another 1500 years, of course. + +The only option is [1m[97mexperimental emergency teleportation[0m. + +You hit the "experimental emergency teleportation" button on the device and push [1m[97mI accept the +risk[0m on no fewer than 18 different warning messages. Immediately, the device deploys hundreds of +tiny [1m[97mnanobots[0m which fly around the cavern, apparently assembling themselves into a very specific +[1m[97mformation[0m. The device lists the X,Y,Z position (pos) for each nanobot as well as its [1m[97msignal +radius[0m (r) on its tiny screen (your puzzle input). + +Each nanobot can transmit signals to any integer coordinate which is a distance away from it +[1m[97mless than or equal to[0m its signal radius (as measured by Manhattan distance). Coordinates a distance +away of less than or equal to a nanobot's signal radius are said to be [1m[97min range[0m of that nanobot. + +Before you start the teleportation process, you should determine which nanobot is the +[1m[97mstrongest[0m (that is, which has the largest signal radius) and then, for that nanobot, the +[1m[97mtotal number of nanobots that are in range[0m of it, [1m[97mincluding itself[0m. + +For example, given the following nanobots: + +pos=<0,0,0>, r=4 +pos=<1,0,0>, r=1 +pos=<4,0,0>, r=3 +pos=<0,2,0>, r=1 +pos=<0,5,0>, r=3 +pos=<0,0,3>, r=1 +pos=<1,1,1>, r=1 +pos=<1,1,2>, r=1 +pos=<1,3,1>, r=1 + +The strongest nanobot is the first one (position 0,0,0) because its signal radius, 4 is the largest. +Using that nanobot's location and signal radius, the following nanobots are in or out of range: + + + - The nanobot at 0,0,0 is distance 0 away, and so it is [1m[97min range[0m. + + - The nanobot at 1,0,0 is distance 1 away, and so it is [1m[97min range[0m. + + - The nanobot at 4,0,0 is distance 4 away, and so it is [1m[97min range[0m. + + - The nanobot at 0,2,0 is distance 2 away, and so it is [1m[97min range[0m. + + - The nanobot at 0,5,0 is distance 5 away, and so it is [1m[97mnot[0m in range. + + - The nanobot at 0,0,3 is distance 3 away, and so it is [1m[97min range[0m. + + - The nanobot at 1,1,1 is distance 3 away, and so it is [1m[97min range[0m. + + - The nanobot at 1,1,2 is distance 4 away, and so it is [1m[97min range[0m. + + - The nanobot at 1,3,1 is distance 5 away, and so it is [1m[97mnot[0m in range. + + +In this example, in total, [1m[97m7[0m nanobots are in range of the nanobot with the largest signal radius. + +Find the nanobot with the largest signal radius. [1m[97mHow many nanobots are in range[0m of its signals? + + diff --git a/src/23/part2 b/src/23/part2 new file mode 100644 index 0000000..f0f8db0 --- /dev/null +++ b/src/23/part2 @@ -0,0 +1,22 @@ +--- Part Two --- + +Packets sent to address 255 are handled by a device called a NAT (Not Always Transmitting). The NAT +is responsible for managing power consumption of the network by blocking certain packets and +watching for idle periods in the computers. + +If a packet would be sent to address 255, the NAT receives it instead. The NAT remembers only the +[1m[97mlast[0m packet it receives; that is, the data in each packet it receives overwrites the NAT's packet +memory with the new packet's X and Y values. + +The NAT also monitors all computers on the network. If all computers have [1m[97mempty incoming packet +queues[0m and are [1m[97mcontinuously trying to receive packets[0m without sending packets, the network is +considered [1m[97midle[0m. + +Once the network is idle, the NAT sends [1m[97monly the last packet it received[0m to address 0; this will +cause the computers on the network to resume activity. In this way, the NAT can throttle power +consumption of the network when the ship needs power in other areas. + +Monitor packets released to the computer at address 0 by the NAT. [1m[97mWhat is the first Y value +delivered by the NAT to the computer at address 0 twice in a row?[0m + + diff --git a/src/23/solve.py b/src/23/solve.py new file mode 100644 index 0000000..f78dd94 --- /dev/null +++ b/src/23/solve.py @@ -0,0 +1,108 @@ +import sys +sys.path.append("../common") +import aoc +import math + +# nanobots consist of tuples containing: (position, radius) +nanobots = list() + +# parse a line of input file +def parse_entry(l): + s = l.split(">, ") + pos = [int(v) for v in s[0].split("=<")[1].split(",")] + radius = int(s[1].split("=")[1]) + nanobots.append((pos, radius)) + +data = [parse_entry(l) for l in aoc.data.split("\n") if len(l) != 0] + +# manhattan distance +def dist(p1, p2): + xd = abs(p1[0] - p2[0]) + yd = abs(p1[1] - p2[1]) + zd = abs(p1[2] - p2[2]) + return xd + yd + zd + +# two nanobots range overlap +def is_overlap(nb1, nb2): + return nb1[1] + nb2[1] >= dist(nb1[0], nb2[0]) + +# nanobots range completely inside anothers range +def is_inside(nb1, nb2): + return dist(nb1[0], nb2[0]) <= nb2[1] - nb1[1] + +# check if range of nanobot is inside grid +def tile_in_range(tile, nb, gridsize): + hgridsize = math.floor(gridsize / 2) # case gridsize = 1 => squares should have 0 width + nbp = nb[0] + ds = [abs(nbp[i] - tile[i]) for i in range(3)] + md = max(ds) + if md == 0: + return True + ds = [d * hgridsize / md for d in ds] # get distance along squares sides + return dist(nbp, tile) - sum(ds) <= nb[1] + +def solve1(args): + maxr = max(nanobots, key = lambda x : x[1]) + inrange = 0 + for nb in nanobots: + if dist(nb[0], maxr[0]) <= maxr[1]: + inrange += 1 + return inrange + +def solve2(args): + global nanobots + + # use smaller getting grid like binary search to find position in range of most nanobots + minpx = min(nanobots, key = lambda x : x[0][0])[0][0] + minpy = min(nanobots, key = lambda x : x[0][1])[0][1] + minpz = min(nanobots, key = lambda x : x[0][2])[0][2] + minp = (minpx, minpy, minpz) + + maxpx = max(nanobots, key = lambda x : x[0][0])[0][0] + maxpy = max(nanobots, key = lambda x : x[0][1])[0][1] + maxpz = max(nanobots, key = lambda x : x[0][2])[0][2] + maxp = (maxpx, maxpy, maxpz) + + gridsize = max([maxp[i] - minp[i] for i in range(3)]) # largest dif dim to ensure all nanbots are in the grid + + bestpos = None + while gridsize >= 1: + maxintile = 0 + + # traverse grid in steps of gridsize + xsteps = math.ceil((maxp[0] - minp[0]) / gridsize) + 1 + ysteps = math.ceil((maxp[1] - minp[1]) / gridsize) + 1 + zsteps = math.ceil((maxp[2] - minp[2]) / gridsize) + 1 + for nx in range(xsteps): + for ny in range(ysteps): + for nz in range(zsteps): + x = minp[0] + nx * gridsize + y = minp[1] + ny * gridsize + z = minp[2] + nz * gridsize + intile = 0 + for nb in nanobots: + # check if nanobots range intersects with tile + if tile_in_range((x, y, z), nb, gridsize): + intile += 1 + if maxintile < intile: + maxintile = intile + bestpos = (x, y, z) + elif maxintile == intile: + dist = sum([abs(v) for v in (x, y, z)]) + bestdist = sum([abs(v) for v in bestpos]) + # if two gridtiles have the same count, + # choose the one closest to the origin + if maxintile == 0 or dist < bestdist: + bestpos = (x, y, z) + + if gridsize == 1: + break + + gridsize = math.floor(gridsize / 2) + + minp = [v - gridsize for v in bestpos] + maxp = [v + gridsize for v in bestpos] + + return sum(bestpos) + +aoc.run(solve1, solve2, sols=[573, 107279292]) diff --git a/src/24/input b/src/24/input new file mode 100644 index 0000000..969be90 --- /dev/null +++ b/src/24/input @@ -0,0 +1,23 @@ +Immune System: +2728 units each with 5703 hit points (weak to fire) with an attack that does 18 cold damage at initiative 12 +916 units each with 5535 hit points (weak to bludgeoning) with an attack that does 55 slashing damage at initiative 20 +2255 units each with 7442 hit points (weak to radiation) with an attack that does 31 bludgeoning damage at initiative 8 +112 units each with 4951 hit points (immune to cold) with an attack that does 360 fire damage at initiative 9 +7376 units each with 6574 hit points (immune to cold, slashing, fire) with an attack that does 7 bludgeoning damage at initiative 4 +77 units each with 5884 hit points (weak to slashing) with an attack that does 738 radiation damage at initiative 6 +6601 units each with 8652 hit points (weak to fire, cold) with an attack that does 11 fire damage at initiative 19 +3259 units each with 10067 hit points (weak to bludgeoning) with an attack that does 29 cold damage at initiative 13 +2033 units each with 4054 hit points (immune to cold; weak to fire, slashing) with an attack that does 18 slashing damage at initiative 3 +3109 units each with 3593 hit points with an attack that does 9 bludgeoning damage at initiative 11 + +Infection: +1466 units each with 57281 hit points (weak to slashing, fire) with an attack that does 58 slashing damage at initiative 7 +247 units each with 13627 hit points with an attack that does 108 fire damage at initiative 15 +1298 units each with 41570 hit points (immune to fire, bludgeoning) with an attack that does 63 fire damage at initiative 14 +2161 units each with 40187 hit points (weak to fire) with an attack that does 33 slashing damage at initiative 5 +57 units each with 55432 hit points (weak to cold) with an attack that does 1687 radiation damage at initiative 17 +3537 units each with 24220 hit points (weak to cold) with an attack that does 11 fire damage at initiative 10 +339 units each with 44733 hit points (immune to cold, bludgeoning; weak to radiation, fire) with an attack that does 258 cold damage at initiative 18 +1140 units each with 17741 hit points (weak to bludgeoning; immune to fire, slashing) with an attack that does 25 fire damage at initiative 2 +112 units each with 44488 hit points (weak to bludgeoning, radiation; immune to cold) with an attack that does 749 radiation damage at initiative 16 +2918 units each with 36170 hit points (immune to bludgeoning; weak to slashing, cold) with an attack that does 24 radiation damage at initiative 1 diff --git a/src/24/part1 b/src/24/part1 new file mode 100644 index 0000000..80675fb --- /dev/null +++ b/src/24/part1 @@ -0,0 +1,199 @@ +--- Day 24: Immune System Simulator 20XX --- + +After a weird buzzing noise, you appear back at the man's cottage. He seems relieved to see his +friend, but quickly notices that the little reindeer caught some kind of cold while out exploring. + +The portly man explains that this reindeer's immune system isn't similar to regular reindeer immune +systems: + +The [1m[97mimmune system[0m and the [1m[97minfection[0m each have an army made up of several [1m[97mgroups[0m; each +[1m[97mgroup[0m consists of one or more identical [1m[97munits[0m. The armies repeatedly [1m[97mfight[0m until only one army has +units remaining. + +[1m[97mUnits[0m within a group all have the same [1m[97mhit points[0m (amount of damage a unit can take before it is +destroyed), [1m[97mattack damage[0m (the amount of damage each unit deals), an [1m[97mattack type[0m, an +[1m[97minitiative[0m (higher initiative units attack first and win ties), and sometimes +[1m[97mweaknesses[0m or [1m[97mimmunities[0m. Here is an example group: + +18 units each with 729 hit points (weak to fire; immune to cold, slashing) + with an attack that does 8 radiation damage at initiative 10 + +Each group also has an [1m[97meffective power[0m: the number of units in that group multiplied by their attack +damage. The above group has an effective power of 18 * 8 = 144. Groups never have zero or negative +units; instead, the group is removed from combat. + +Each [1m[97mfight[0m consists of two phases: [1m[97mtarget selection[0m and [1m[97mattacking[0m. + +During the [1m[97mtarget selection[0m phase, each group attempts to choose one target. In decreasing order of +effective power, groups choose their targets; in a tie, the group with the higher initiative chooses +first. The attacking group chooses to target the group in the enemy army to which it would deal the +most damage (after accounting for weaknesses and immunities, but not accounting for whether the +defending group has enough units to actually receive all of that damage). + +If an attacking group is considering two defending groups to which it would deal equal damage, it +chooses to target the defending group with the largest effective power; if there is still a tie, it +chooses the defending group with the highest initiative. If it cannot deal any defending groups +damage, it does not choose a target. Defending groups can only be chosen as a target by one +attacking group. + +At the end of the target selection phase, each group has selected zero or one groups to attack, and +each group is being attacked by zero or one groups. + +During the [1m[97mattacking[0m phase, each group deals damage to the target it selected, if any. Groups attack +in decreasing order of initiative, regardless of whether they are part of the infection or the +immune system. (If a group contains no units, it cannot attack.) + +The damage an attacking group deals to a defending group depends on the attacking group's attack +type and the defending group's immunities and weaknesses. By default, an attacking group would deal +damage equal to its [1m[97meffective power[0m to the defending group. However, if the defending group is +[1m[97mimmune[0m to the attacking group's attack type, the defending group instead takes [1m[97mno damage[0m; if the +defending group is [1m[97mweak[0m to the attacking group's attack type, the defending group instead takes +[1m[97mdouble damage[0m. + +The defending group only loses [1m[97mwhole units[0m from damage; damage is always dealt in such a way that it +kills the most units possible, and any remaining damage to a unit that does not immediately kill it +is ignored. For example, if a defending group contains 10 units with 10 hit points each and receives +75 damage, it loses exactly 7 units and is left with 3 units at full health. + +After the fight is over, if both armies still contain units, a new fight begins; combat only ends +once one army has lost all of its units. + +For example, consider the following armies: + +Immune System: +17 units each with 5390 hit points (weak to radiation, bludgeoning) with + an attack that does 4507 fire damage at initiative 2 +989 units each with 1274 hit points (immune to fire; weak to bludgeoning, + slashing) with an attack that does 25 slashing damage at initiative 3 + +Infection: +801 units each with 4706 hit points (weak to radiation) with an attack + that does 116 bludgeoning damage at initiative 1 +4485 units each with 2961 hit points (immune to radiation; weak to fire, + cold) with an attack that does 12 slashing damage at initiative 4 + +If these armies were to enter combat, the following fights, including details during the target +selection and attacking phases, would take place: + +Immune System: +Group 1 contains 17 units +Group 2 contains 989 units +Infection: +Group 1 contains 801 units +Group 2 contains 4485 units + +Infection group 1 would deal defending group 1 185832 damage +Infection group 1 would deal defending group 2 185832 damage +Infection group 2 would deal defending group 2 107640 damage +Immune System group 1 would deal defending group 1 76619 damage +Immune System group 1 would deal defending group 2 153238 damage +Immune System group 2 would deal defending group 1 24725 damage + +Infection group 2 attacks defending group 2, killing 84 units +Immune System group 2 attacks defending group 1, killing 4 units +Immune System group 1 attacks defending group 2, killing 51 units +Infection group 1 attacks defending group 1, killing 17 units + +Immune System: +Group 2 contains 905 units +Infection: +Group 1 contains 797 units +Group 2 contains 4434 units + +Infection group 1 would deal defending group 2 184904 damage +Immune System group 2 would deal defending group 1 22625 damage +Immune System group 2 would deal defending group 2 22625 damage + +Immune System group 2 attacks defending group 1, killing 4 units +Infection group 1 attacks defending group 2, killing 144 units + +Immune System: +Group 2 contains 761 units +Infection: +Group 1 contains 793 units +Group 2 contains 4434 units + +Infection group 1 would deal defending group 2 183976 damage +Immune System group 2 would deal defending group 1 19025 damage +Immune System group 2 would deal defending group 2 19025 damage + +Immune System group 2 attacks defending group 1, killing 4 units +Infection group 1 attacks defending group 2, killing 143 units + +Immune System: +Group 2 contains 618 units +Infection: +Group 1 contains 789 units +Group 2 contains 4434 units + +Infection group 1 would deal defending group 2 183048 damage +Immune System group 2 would deal defending group 1 15450 damage +Immune System group 2 would deal defending group 2 15450 damage + +Immune System group 2 attacks defending group 1, killing 3 units +Infection group 1 attacks defending group 2, killing 143 units + +Immune System: +Group 2 contains 475 units +Infection: +Group 1 contains 786 units +Group 2 contains 4434 units + +Infection group 1 would deal defending group 2 182352 damage +Immune System group 2 would deal defending group 1 11875 damage +Immune System group 2 would deal defending group 2 11875 damage + +Immune System group 2 attacks defending group 1, killing 2 units +Infection group 1 attacks defending group 2, killing 142 units + +Immune System: +Group 2 contains 333 units +Infection: +Group 1 contains 784 units +Group 2 contains 4434 units + +Infection group 1 would deal defending group 2 181888 damage +Immune System group 2 would deal defending group 1 8325 damage +Immune System group 2 would deal defending group 2 8325 damage + +Immune System group 2 attacks defending group 1, killing 1 unit +Infection group 1 attacks defending group 2, killing 142 units + +Immune System: +Group 2 contains 191 units +Infection: +Group 1 contains 783 units +Group 2 contains 4434 units + +Infection group 1 would deal defending group 2 181656 damage +Immune System group 2 would deal defending group 1 4775 damage +Immune System group 2 would deal defending group 2 4775 damage + +Immune System group 2 attacks defending group 1, killing 1 unit +Infection group 1 attacks defending group 2, killing 142 units + +Immune System: +Group 2 contains 49 units +Infection: +Group 1 contains 782 units +Group 2 contains 4434 units + +Infection group 1 would deal defending group 2 181424 damage +Immune System group 2 would deal defending group 1 1225 damage +Immune System group 2 would deal defending group 2 1225 damage + +Immune System group 2 attacks defending group 1, killing 0 units +Infection group 1 attacks defending group 2, killing 49 units + +Immune System: +No groups remain. +Infection: +Group 1 contains 782 units +Group 2 contains 4434 units + +In the example above, the winning army ends up with 782 + 4434 = [1m[97m5216[0m units. + +You scan the reindeer's condition (your puzzle input); the white-bearded man looks nervous. As it +stands now, [1m[97mhow many units would the winning army have[0m? + + diff --git a/src/24/part2 b/src/24/part2 new file mode 100644 index 0000000..2cf3f09 --- /dev/null +++ b/src/24/part2 @@ -0,0 +1,186 @@ +--- Part Two --- + +After careful analysis, one thing is certain: [1m[97myou have no idea where all these bugs are coming +from[0m. + +Then, you remember: Eris is an old Plutonian settlement! Clearly, the bugs are coming from +recursively-folded space. + +This 5x5 grid is [1m[97monly one[0m level in an [1m[97minfinite[0m number of recursion levels. The tile in the middle of +the grid is actually another 5x5 grid, the grid in your scan is contained as the middle tile of a +larger 5x5 grid, and so on. Two levels of grids look like this: + + | | | | + | | | | + | | | | +-----+-----+---------+-----+----- + | | | | + | | | | + | | | | +-----+-----+---------+-----+----- + | | | | | | | | + | |-+-+-+-+-| | + | | | | | | | | + | |-+-+-+-+-| | + | | | |?| | | | + | |-+-+-+-+-| | + | | | | | | | | + | |-+-+-+-+-| | + | | | | | | | | +-----+-----+---------+-----+----- + | | | | + | | | | + | | | | +-----+-----+---------+-----+----- + | | | | + | | | | + | | | | + +(To save space, some of the tiles are not drawn to scale.) Remember, this is only a small part of +the infinitely recursive grid; there is a 5x5 grid that contains this diagram, and a 5x5 grid that +contains that one, and so on. Also, the ? in the diagram contains another 5x5 grid, which itself +contains another 5x5 grid, and so on. + +The scan you took (your puzzle input) shows where the bugs are [1m[97mon a single level[0m of this structure. +The middle tile of your scan is empty to accommodate the recursive grids within it. Initially, no +other levels contain bugs. + +Tiles still count as [1m[97madjacent[0m if they are directly [1m[97mup, down, left, or right[0m of a given tile. Some +tiles have adjacent tiles at a recursion level above or below its own level. For example: + + | | | | + 1 | 2 | 3 | 4 | 5 + | | | | +-----+-----+---------+-----+----- + | | | | + 6 | 7 | 8 | 9 | 10 + | | | | +-----+-----+---------+-----+----- + | |A|B|C|D|E| | + | |-+-+-+-+-| | + | |F|G|H|I|J| | + | |-+-+-+-+-| | + 11 | 12 |K|L|?|N|O| 14 | 15 + | |-+-+-+-+-| | + | |P|Q|R|S|T| | + | |-+-+-+-+-| | + | |U|V|W|X|Y| | +-----+-----+---------+-----+----- + | | | | + 16 | 17 | 18 | 19 | 20 + | | | | +-----+-----+---------+-----+----- + | | | | + 21 | 22 | 23 | 24 | 25 + | | | | + + + - Tile 19 has four adjacent tiles: 14, 18, 20, and 24. + + - Tile G has four adjacent tiles: B, F, H, and L. + + - Tile D has four adjacent tiles: 8, C, E, and I. + + - Tile E has four adjacent tiles: 8, D, 14, and J. + + - Tile 14 has [1m[97meight[0m adjacent tiles: 9, E, J, O, T, Y, 15, and 19. + + - Tile N has [1m[97meight[0m adjacent tiles: I, O, S, and five tiles within the sub-grid marked ?. + + +The rules about bugs living and dying are the same as before. + +For example, consider the same initial state as above: + +....# +#..#. +#.?## +..#.. +#.... + +The center tile is drawn as ? to indicate the next recursive grid. Call this level 0; the grid +within this one is level 1, and the grid that contains this one is level -1. Then, after +[1m[97mten[0m minutes, the grid at each level would look like this: + +Depth -5: +..#.. +.#.#. +..?.# +.#.#. +..#.. + +Depth -4: +...#. +...## +..?.. +...## +...#. + +Depth -3: +#.#.. +.#... +..?.. +.#... +#.#.. + +Depth -2: +.#.## +....# +..?.# +...## +.###. + +Depth -1: +#..## +...## +..?.. +...#. +.#### + +Depth 0: +.#... +.#.## +.#?.. +..... +..... + +Depth 1: +.##.. +#..## +..?.# +##.## +##### + +Depth 2: +###.. +##.#. +#.?.. +.#.## +#.#.. + +Depth 3: +..### +..... +#.?.. +#.... +#...# + +Depth 4: +.###. +#..#. +#.?.. +##.#. +..... + +Depth 5: +####. +#..#. +#.?#. +####. +..... + +In this example, after 10 minutes, a total of [1m[97m99[0m bugs are present. + +Starting with your scan, [1m[97mhow many bugs are present after 200 minutes?[0m + + diff --git a/src/24/solve.py b/src/24/solve.py new file mode 100644 index 0000000..fc89c84 --- /dev/null +++ b/src/24/solve.py @@ -0,0 +1,127 @@ +import sys
+sys.path.append("../common")
+import aoc
+
+immunesys = 0
+infection = 1
+ctype = 0
+
+# parse input from file
+def parse_input():
+ groups = list()
+ for l in aoc.data.split("\n"):
+ pl = parse_entry(l)
+ if pl != None:
+ groups.append(pl)
+ return groups
+
+# parse line of input
+def parse_entry(line):
+ global ctype
+ group = None
+ if "Immune" in line:
+ ctype = immunesys
+ elif "Infection" in line:
+ ctype = infection
+ elif line != "":
+ ls = line.split()
+ group = dict()
+ group["type"] = ctype
+ group["units"] = int(ls[0])
+ group["unithp"] = int(ls[4])
+ group["initiative"] = int(ls[-1])
+ group["weak"] = list()
+ group["immune"] = list()
+ if "(" in line:
+ parenthstr = line.split("(")[1].split(")")[0]
+ traits = parenthstr.split(";")
+ for traitstr in traits:
+ info = traitstr.split()
+ group[info[0]] = [v.replace(",","") for v in info[2:]]
+ dmginfo = line.split("does")[1].split("damage")[0].split()
+ group["dmg"] = int(dmginfo[0])
+ group["dmgtype"] = dmginfo[1]
+ return group
+
+def effective_power(g):
+ return g["units"] * g["dmg"]
+
+def damage(attacker, defender):
+ dmg = effective_power(attacker)
+ dmg *= (0 if attacker["dmgtype"] in defender["immune"] else 1)
+ dmg *= (2 if attacker["dmgtype"] in defender["weak"] else 1)
+ return dmg
+
+groups = parse_input()
+
+def fight():
+ global groups
+
+ lunits = 0
+
+ immalive = len([g for g in groups if g["type"] == immunesys])
+ infalive = len([g for g in groups if g["type"] == infection])
+
+ while immalive > 0 and infalive > 0:
+ # target selection
+ attacked = list()
+ attackpairs = list()
+ groups = sorted(groups, key = lambda x : (effective_power(x), x["initiative"]), reverse = True)
+ for group in groups:
+ # choose group of other army, which is not already being attacked and sort appropriately
+ enemies = [g for g in groups if g["type"] != group["type"] and g not in attacked]
+ if len(enemies) == 0:
+ continue
+ target = max(enemies, key = lambda x : \
+ (damage(group, x), effective_power(x), x["initiative"]))
+ if damage(group, target) != 0: # enemies which arent immune
+ attacked.append(target)
+ attackpairs.append((groups.index(group), groups.index(target)))
+
+ # attacking phase
+ attackpairs = sorted(attackpairs, key = lambda x : groups[x[0]]["initiative"], reverse = True)
+
+ for ap in attackpairs:
+ attacker = groups[ap[0]]
+ attacked = groups[ap[1]]
+ # if attacker or defender is dead, no need to attack
+ if attacker["units"] > 0 and attacked["units"] > 0:
+ dmg = damage(attacker, attacked)
+ # remove whole numbers of units
+ attacked["units"] = max(0, attacked["units"] - dmg // attacked["unithp"])
+
+ groups = [g for g in groups if g["units"] > 0]
+ immalive = sum([g["units"] for g in groups if g["type"] == immunesys])
+ infalive = sum([g["units"] for g in groups if g["type"] == infection])
+ units = immalive + infalive
+ if units == lunits:
+ return units
+ lunits = units
+
+ return units
+
+def solve1(args):
+ return fight()
+
+def solve2(args):
+ global groups
+
+ immunewin = False
+ boost = 1
+ while not immunewin:
+ groups = parse_input()
+ for g in groups:
+ if g["type"] == immunesys:
+ g["dmg"] += boost
+
+ fight()
+
+ immunewin = (sum([0 if g["type"] == immunesys else 1 for g in groups]) == 0)
+
+ boost += 1
+
+ aoc.debug("boost:", boost)
+
+ return sum([v["units"] for v in groups])
+
+aoc.run(solve1, solve2, sols=[10538, 9174])
diff --git a/src/25/input b/src/25/input new file mode 100644 index 0000000..dfdbb5b --- /dev/null +++ b/src/25/input @@ -0,0 +1,1248 @@ +-6,2,-8,3
+7,8,-1,-8
+7,-2,-4,-2
+4,-4,2,7
+5,8,-1,6
+-1,6,-4,-5
+-2,-6,-6,-6
+1,4,7,0
+-1,-3,-8,2
+5,-6,-5,-2
+-5,7,4,-2
+-2,6,-1,6
+5,4,0,-7
+1,5,-8,-3
+-3,3,8,2
+4,0,0,6
+4,-8,-3,3
+0,0,-7,-5
+-2,0,5,-3
+2,1,7,-1
+1,6,2,2
+4,4,7,-6
+-1,0,-1,1
+2,4,4,6
+-4,3,-7,2
+-5,-2,8,-7
+6,-8,-1,3
+-8,-6,-7,-3
+4,1,-7,-1
+-7,-5,-4,4
+5,-2,8,-5
+-5,-1,4,-4
+3,-3,8,4
+3,8,-8,-7
+-3,7,7,0
+-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8,8,-3
+6,-6,-6,3
+2,-3,-3,-3
+8,-5,-2,0
+-3,5,7,-4
+-7,-8,1,5
+0,-1,-1,-1
+8,1,7,-8
+4,4,2,4
+6,2,-1,2
+-5,6,-6,5
+-2,-5,-3,4
+6,-3,-4,0
+8,8,-5,-7
+2,2,0,-3
+-5,-8,1,2
+7,-6,-2,8
+-5,0,-3,3
+-2,7,-4,-5
+8,-1,-6,1
+7,6,-1,-4
+-3,0,2,1
+0,0,5,0
+-1,8,-2,3
+-3,2,1,-8
+1,7,-7,0
+1,4,-1,0
+6,-4,3,-2
+-1,-6,-2,2
+-2,2,2,2
+2,0,-3,5
+-4,1,-8,-3
+-4,1,5,-7
+-6,8,1,4
+5,3,0,1
+-8,-7,7,-1
+-8,-3,1,-7
+0,2,4,7
+6,7,2,-8
+4,1,2,8
+3,-2,1,-5
+8,2,-7,6
+8,0,5,3
+-7,4,8,-7
+3,8,-1,-7
+-1,-5,-2,0
+-3,0,6,3
+6,5,-3,-2
+1,8,7,-2
+-4,-1,-7,-2
+-6,-1,8,3
+8,-1,5,-6
+5,0,5,2
+-4,8,0,-1
+-5,2,7,-3
+5,-2,-6,5
+4,-4,4,0
+-7,-1,-5,-5
+-8,-5,4,5
+4,-6,-8,3
+7,2,7,-5
+1,6,2,-3
+-3,3,-8,0
+1,-6,7,-3
+-5,8,6,-3
+-3,-2,-4,-6
+7,-7,-2,1
+5,4,-7,-1
+3,-4,-5,-1
+-1,-5,6,-1
+-8,4,-5,1
diff --git a/src/25/part1 b/src/25/part1 new file mode 100644 index 0000000..d2d59b5 --- /dev/null +++ b/src/25/part1 @@ -0,0 +1,108 @@ +--- Day 25: Four-Dimensional Adventure --- + +The reindeer's symptoms are getting worse, and neither you nor the white-bearded man have a +solution. At least the reindeer has a warm place to rest: a small bed near where you're sitting. + +As you reach down, the reindeer looks up at you, accidentally bumping a button on your wrist-mounted +device with its nose in the process - a button labeled [1m[97m"help"[0m. + +"Hello, and welcome to the Time Travel Support Hotline! If you are lost in time and space, press 1. +If you are trapped in a time paradox, press 2. If you need help caring for a sick reindeer, press 3. +If you--" + +[1m[97mBeep.[0m + +A few seconds later, you hear a new voice. "Hello; please state the nature of your reindeer." You +try to describe the situation. + +"Just a moment, I think I can remotely run a diagnostic scan." A beam of light projects from the +device and sweeps over the reindeer a few times. + +"Okay, it looks like your reindeer is very low on magical energy; it should fully recover if we can +fix that. Let me check your timeline for a source.... Got one. There's actually a powerful source +of magical energy about 1000 years forward from you, and at roughly your position, too! It looks +like... hot chocolate? Anyway, you should be able to travel there to pick some up; just don't +forget a mug! Is there anything else I can help you with today?" + +You explain that your device isn't capable of going forward in time. "I... see. That's tricky. +Well, according to this information, your device should have the necessary hardware to open a small +portal and send some hot chocolate back to you. You'll need a list of [1m[97mfixed points in spacetime[0m; I'm +transmitting it to you now." + +"You just need to align your device to the constellations of fixed points so that it can lock on to +the destination and open the portal. Let me look up how much hot chocolate that breed of reindeer +needs." + +"It says here that your particular reindeer is-- this can't be right, it says there's only one like +that in the universe! But THAT means that you're--" You disconnect the call. + +The list of fixed points in spacetime (your puzzle input) is a set of four-dimensional coordinates. +To align your device, acquire the hot chocolate, and save the reindeer, you just need to find the +[1m[97mnumber of constellations[0m of points in the list. + +Two points are in the same [1m[97mconstellation[0m if their manhattan distance apart is [1m[97mno more than 3[0m or if +they can form a chain of points, each a manhattan distance no more than 3 from the last, between the +two of them. (That is, if a point is close enough to a constellation, it "joins" that +constellation.) For example: + + 0,0,0,0 + 3,0,0,0 + 0,3,0,0 + 0,0,3,0 + 0,0,0,3 + 0,0,0,6 + 9,0,0,0 +12,0,0,0 + +In the above list, the first six points form a single constellation: 0,0,0,0 is exactly distance 3 +from the next four, and the point at 0,0,0,6 is connected to the others by being 3 away from +0,0,0,3, which is already in the constellation. The bottom two points, 9,0,0,0 and 12,0,0,0 are in a +separate constellation because no point is close enough to connect them to the first constellation. +So, in the above list, the number of constellations is [1m[97m2[0m. (If a point at 6,0,0,0 were present, it +would connect 3,0,0,0 and 9,0,0,0, merging all of the points into a single giant constellation +instead.) + +In this example, the number of constellations is 4: + +-1,2,2,0 +0,0,2,-2 +0,0,0,-2 +-1,2,0,0 +-2,-2,-2,2 +3,0,2,-1 +-1,3,2,2 +-1,0,-1,0 +0,2,1,-2 +3,0,0,0 + +In this one, it's 3: + +1,-1,0,1 +2,0,-1,0 +3,2,-1,0 +0,0,3,1 +0,0,-1,-1 +2,3,-2,0 +-2,2,0,0 +2,-2,0,-1 +1,-1,0,-1 +3,2,0,2 + +Finally, in this one, it's 8: + +1,-1,-1,-2 +-2,-2,0,1 +0,2,1,3 +-2,3,-2,1 +0,2,3,-2 +-1,-1,1,-2 +0,-2,-1,0 +-2,2,3,-1 +1,2,2,0 +-1,-2,0,-2 + +The portly man nervously strokes his white beard. It's time to get that hot chocolate. + +[1m[97mHow many constellations are formed by the fixed points in spacetime?[0m + + diff --git a/src/25/part2 b/src/25/part2 new file mode 100644 index 0000000..6a97cd2 --- /dev/null +++ b/src/25/part2 @@ -0,0 +1,17 @@ +--- Part Two --- + +As you move through the main airlock, the air inside the ship is already heating up to reasonable +levels. Santa explains that he didn't notice you coming because he was just taking a quick nap. +The ship wasn't frozen; he just had the thermostat set to "North Pole". + +You make your way over to the navigation console. It beeps. "Status: Stranded. Please supply +measurements from [1m[33m49 stars[0m to recalibrate." + +"49 stars? But the Elves told me you needed fifty--" + +Santa just smiles and nods his head toward the window. There, in the distance, you can see the +center of the Solar System: the Sun! + +The navigation console beeps again. + + diff --git a/src/25/solve.py b/src/25/solve.py new file mode 100644 index 0000000..973885a --- /dev/null +++ b/src/25/solve.py @@ -0,0 +1,50 @@ +import sys
+sys.path.append("../common")
+import aoc
+
+def parse_entry(l):
+ return [int(v) for v in l.split(",")]
+
+coordinates = [parse_entry(l) for l in aoc.data.split("\n") if len(l) != 0]
+
+def dist(c1, c2):
+ return sum([abs(c1[i] - c2[i]) for i in range(4)])
+
+def get_close(coords, c):
+ match = list()
+ j = 0
+ while j in range(len(coords)):
+ if dist(c, coords[j]) <= 3:
+ match.append(coords[j])
+ coords.pop(j)
+ else:
+ j += 1
+ return match
+
+"""
+sum = 0
+for cons in constellations:
+ sum += len(cons)
+print(sum)
+"""
+
+def solve1(args):
+ constellations = list()
+ available = coordinates[:]
+
+ while len(available) != 0:
+ match = get_close(available, available[0])
+
+ j = 0
+ while j < len(match):
+ match += get_close(available, match[j])
+ j += 1
+
+ constellations.append(match)
+
+ return len(constellations)
+
+def solve2(args):
+ return ""
+
+aoc.run(solve1, solve2, sols=[386, ""])
diff --git a/src/25/test1 b/src/25/test1 new file mode 100644 index 0000000..1147af7 --- /dev/null +++ b/src/25/test1 @@ -0,0 +1,10 @@ +1,-1,-1,-2 +-2,-2,0,1 +0,2,1,3 +-2,3,-2,1 +0,2,3,-2 +-1,-1,1,-2 +0,-2,-1,0 +-2,2,3,-1 +1,2,2,0 +-1,-2,0,-2 diff --git a/src/25/test2 b/src/25/test2 new file mode 100644 index 0000000..bf5c2b9 --- /dev/null +++ b/src/25/test2 @@ -0,0 +1,10 @@ +1,-1,0,1 +2,0,-1,0 +3,2,-1,0 +0,0,3,1 +0,0,-1,-1 +2,3,-2,0 +-2,2,0,0 +2,-2,0,-1 +1,-1,0,-1 +3,2,0,2 diff --git a/src/25/test3 b/src/25/test3 new file mode 100644 index 0000000..3089dd5 --- /dev/null +++ b/src/25/test3 @@ -0,0 +1,8 @@ +0,0,0,0 +3,0,0,0 +0,3,0,0 +0,0,3,0 +0,0,0,3 +0,0,0,6 +9,0,0,0 +12,0,0,0 diff --git a/src/25/test4 b/src/25/test4 new file mode 100644 index 0000000..3a97e16 --- /dev/null +++ b/src/25/test4 @@ -0,0 +1,10 @@ +-1,2,2,0 +0,0,2,-2 +0,0,0,-2 +-1,2,0,0 +-2,-2,-2,2 +3,0,2,-1 +-1,3,2,2 +-1,0,-1,0 +0,2,1,-2 +3,0,0,0 diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..d564047 --- /dev/null +++ b/src/Makefile @@ -0,0 +1,15 @@ +DAYS = $(shell seq 1 25 | xargs printf "%02i\n") + +.PHONY: all +all:: + +define make-day +all:: $1/run +.PHONY: $1/run +$1/run: + @echo "== day $1 ==" + @echo -en "\npart 1: " && cd $1 && time python3 solve.py 1 + @echo -en "\npart 2: " && cd $1 && time python3 solve.py 2 + @echo "" +endef +$(foreach day,$(DAYS),$(eval $(call make-day,$(day)))) diff --git a/src/common/aoc.py b/src/common/aoc.py new file mode 100644 index 0000000..0d8d802 --- /dev/null +++ b/src/common/aoc.py @@ -0,0 +1,35 @@ +import sys, os + +debug_lvl = os.getenv("AOC_DEBUG") +debug_lvl = int(debug_lvl) if debug_lvl is not None else 0 + +input_name = os.getenv("AOC_INPUT") +input_name = input_name if input_name is not None else "input" + +data = open(input_name).read().strip("\n") + +def debug(*args, **kwargs): + if debug_lvl: + print(*args, **kwargs, file=sys.stderr) + +def run(solve1, solve2, sols=[None, None]): + if len(sys.argv) <= 1: + sys.exit(0) + part = int(sys.argv[1]) + if part == 1: + answer = solve1(sys.argv[2:]) + print(answer) + if sols[part - 1] is not None: + assert(answer == sols[part - 1]) + else: + print("warn: no solution available", file=sys.stderr) + elif part == 2: + answer = solve2(sys.argv[2:]) + print(answer) + if sols[part - 1] is not None: + assert(answer == sols[part - 1]) + else: + print("warn: no solution available", file=sys.stderr) + else: + assert(False) # bad part + |
