, containers
, pqueue
-
\ No newline at end of file
+executable advent16
+ hs-source-dirs: src/advent16
+ main-is: advent16.hs
+ default-language: Haskell2010
+ build-depends: base >= 4.7 && < 5
+ , text
+ , megaparsec
+ , containers
--- /dev/null
+Before: [3, 1, 2, 3]
+5 3 1 1
+After: [3, 0, 2, 3]
+
+Before: [1, 1, 2, 2]
+9 0 2 0
+After: [0, 1, 2, 2]
+
+Before: [0, 1, 3, 3]
+12 1 0 3
+After: [0, 1, 3, 1]
+
+Before: [1, 0, 2, 3]
+9 0 2 2
+After: [1, 0, 0, 3]
+
+Before: [3, 0, 2, 2]
+8 0 3 0
+After: [1, 0, 2, 2]
+
+Before: [3, 1, 0, 0]
+11 2 0 2
+After: [3, 1, 1, 0]
+
+Before: [0, 1, 2, 2]
+7 0 0 3
+After: [0, 1, 2, 0]
+
+Before: [0, 1, 0, 0]
+15 1 3 3
+After: [0, 1, 0, 1]
+
+Before: [3, 0, 0, 2]
+8 0 3 1
+After: [3, 1, 0, 2]
+
+Before: [0, 2, 2, 1]
+3 3 2 0
+After: [1, 2, 2, 1]
+
+Before: [1, 1, 3, 0]
+15 1 3 2
+After: [1, 1, 1, 0]
+
+Before: [3, 1, 1, 2]
+1 1 3 0
+After: [0, 1, 1, 2]
+
+Before: [2, 1, 3, 0]
+15 1 3 1
+After: [2, 1, 3, 0]
+
+Before: [3, 0, 1, 3]
+6 2 3 1
+After: [3, 0, 1, 3]
+
+Before: [2, 1, 1, 2]
+1 1 3 1
+After: [2, 0, 1, 2]
+
+Before: [3, 2, 1, 3]
+6 2 3 2
+After: [3, 2, 0, 3]
+
+Before: [2, 1, 2, 2]
+1 1 3 1
+After: [2, 0, 2, 2]
+
+Before: [1, 2, 1, 3]
+5 3 2 2
+After: [1, 2, 0, 3]
+
+Before: [3, 2, 2, 2]
+10 0 2 1
+After: [3, 1, 2, 2]
+
+Before: [0, 1, 0, 0]
+15 1 3 0
+After: [1, 1, 0, 0]
+
+Before: [0, 0, 2, 1]
+5 0 0 2
+After: [0, 0, 1, 1]
+
+Before: [3, 1, 3, 2]
+1 1 3 0
+After: [0, 1, 3, 2]
+
+Before: [2, 1, 3, 2]
+4 3 2 0
+After: [2, 1, 3, 2]
+
+Before: [0, 2, 3, 3]
+4 1 2 0
+After: [2, 2, 3, 3]
+
+Before: [0, 1, 0, 0]
+12 1 0 3
+After: [0, 1, 0, 1]
+
+Before: [2, 1, 3, 3]
+11 0 2 2
+After: [2, 1, 1, 3]
+
+Before: [0, 3, 2, 1]
+3 3 2 2
+After: [0, 3, 1, 1]
+
+Before: [0, 1, 3, 3]
+12 1 0 0
+After: [1, 1, 3, 3]
+
+Before: [0, 3, 0, 1]
+7 0 0 1
+After: [0, 0, 0, 1]
+
+Before: [1, 0, 2, 1]
+14 3 3 3
+After: [1, 0, 2, 0]
+
+Before: [2, 3, 3, 2]
+4 0 2 1
+After: [2, 2, 3, 2]
+
+Before: [1, 2, 2, 2]
+13 2 2 0
+After: [2, 2, 2, 2]
+
+Before: [3, 0, 3, 2]
+4 3 2 3
+After: [3, 0, 3, 2]
+
+Before: [0, 1, 3, 2]
+1 1 3 2
+After: [0, 1, 0, 2]
+
+Before: [1, 0, 1, 1]
+2 3 1 0
+After: [1, 0, 1, 1]
+
+Before: [0, 1, 1, 3]
+6 1 3 3
+After: [0, 1, 1, 0]
+
+Before: [0, 2, 3, 1]
+5 2 3 0
+After: [0, 2, 3, 1]
+
+Before: [2, 3, 3, 1]
+5 2 3 0
+After: [0, 3, 3, 1]
+
+Before: [2, 1, 2, 2]
+13 2 2 0
+After: [2, 1, 2, 2]
+
+Before: [1, 2, 3, 1]
+5 2 3 3
+After: [1, 2, 3, 0]
+
+Before: [1, 2, 0, 2]
+14 3 3 0
+After: [0, 2, 0, 2]
+
+Before: [2, 1, 0, 2]
+14 3 3 2
+After: [2, 1, 0, 2]
+
+Before: [2, 2, 3, 1]
+11 0 2 3
+After: [2, 2, 3, 1]
+
+Before: [2, 3, 3, 2]
+4 3 2 2
+After: [2, 3, 2, 2]
+
+Before: [2, 2, 1, 1]
+14 3 3 3
+After: [2, 2, 1, 0]
+
+Before: [2, 1, 3, 2]
+14 3 3 3
+After: [2, 1, 3, 0]
+
+Before: [2, 1, 0, 3]
+10 0 1 3
+After: [2, 1, 0, 1]
+
+Before: [0, 1, 2, 1]
+0 1 2 0
+After: [0, 1, 2, 1]
+
+Before: [3, 2, 0, 0]
+11 2 0 2
+After: [3, 2, 1, 0]
+
+Before: [3, 1, 0, 1]
+11 2 0 2
+After: [3, 1, 1, 1]
+
+Before: [1, 1, 3, 0]
+15 1 3 3
+After: [1, 1, 3, 1]
+
+Before: [0, 0, 3, 2]
+14 3 3 0
+After: [0, 0, 3, 2]
+
+Before: [2, 1, 3, 1]
+10 0 1 3
+After: [2, 1, 3, 1]
+
+Before: [1, 1, 2, 3]
+0 1 2 2
+After: [1, 1, 0, 3]
+
+Before: [0, 2, 2, 3]
+13 3 3 2
+After: [0, 2, 3, 3]
+
+Before: [1, 1, 3, 3]
+5 3 3 3
+After: [1, 1, 3, 1]
+
+Before: [1, 2, 3, 3]
+4 1 2 1
+After: [1, 2, 3, 3]
+
+Before: [1, 1, 2, 3]
+5 2 2 3
+After: [1, 1, 2, 1]
+
+Before: [2, 0, 3, 3]
+11 0 2 2
+After: [2, 0, 1, 3]
+
+Before: [1, 0, 2, 3]
+13 2 2 1
+After: [1, 2, 2, 3]
+
+Before: [0, 1, 2, 1]
+7 0 0 1
+After: [0, 0, 2, 1]
+
+Before: [2, 0, 2, 3]
+13 2 2 2
+After: [2, 0, 2, 3]
+
+Before: [3, 0, 1, 0]
+2 2 1 0
+After: [1, 0, 1, 0]
+
+Before: [3, 3, 3, 3]
+5 3 2 1
+After: [3, 1, 3, 3]
+
+Before: [0, 1, 2, 3]
+12 1 0 2
+After: [0, 1, 1, 3]
+
+Before: [2, 0, 3, 1]
+11 0 2 3
+After: [2, 0, 3, 1]
+
+Before: [2, 1, 2, 1]
+3 3 2 1
+After: [2, 1, 2, 1]
+
+Before: [2, 1, 3, 0]
+11 0 2 2
+After: [2, 1, 1, 0]
+
+Before: [0, 1, 2, 2]
+1 1 3 0
+After: [0, 1, 2, 2]
+
+Before: [2, 0, 3, 3]
+4 0 2 1
+After: [2, 2, 3, 3]
+
+Before: [3, 0, 1, 1]
+2 3 1 3
+After: [3, 0, 1, 1]
+
+Before: [2, 2, 1, 2]
+8 0 2 1
+After: [2, 1, 1, 2]
+
+Before: [3, 2, 3, 3]
+4 1 2 0
+After: [2, 2, 3, 3]
+
+Before: [1, 1, 2, 3]
+0 1 2 0
+After: [0, 1, 2, 3]
+
+Before: [2, 1, 1, 1]
+8 0 2 1
+After: [2, 1, 1, 1]
+
+Before: [1, 2, 2, 3]
+5 2 1 2
+After: [1, 2, 1, 3]
+
+Before: [2, 3, 1, 2]
+8 0 2 3
+After: [2, 3, 1, 1]
+
+Before: [0, 1, 2, 1]
+12 1 0 1
+After: [0, 1, 2, 1]
+
+Before: [0, 1, 1, 3]
+12 1 0 1
+After: [0, 1, 1, 3]
+
+Before: [2, 1, 3, 0]
+15 1 3 0
+After: [1, 1, 3, 0]
+
+Before: [0, 1, 2, 2]
+1 1 3 3
+After: [0, 1, 2, 0]
+
+Before: [3, 2, 2, 2]
+8 0 3 1
+After: [3, 1, 2, 2]
+
+Before: [1, 2, 0, 3]
+13 3 3 2
+After: [1, 2, 3, 3]
+
+Before: [0, 1, 0, 1]
+12 1 0 3
+After: [0, 1, 0, 1]
+
+Before: [3, 2, 2, 3]
+6 1 3 1
+After: [3, 0, 2, 3]
+
+Before: [1, 2, 3, 2]
+4 3 2 2
+After: [1, 2, 2, 2]
+
+Before: [3, 2, 2, 3]
+10 0 2 2
+After: [3, 2, 1, 3]
+
+Before: [2, 1, 2, 2]
+0 1 2 2
+After: [2, 1, 0, 2]
+
+Before: [2, 3, 2, 3]
+5 3 3 2
+After: [2, 3, 1, 3]
+
+Before: [1, 1, 2, 3]
+6 2 3 3
+After: [1, 1, 2, 0]
+
+Before: [2, 1, 1, 3]
+6 2 3 2
+After: [2, 1, 0, 3]
+
+Before: [3, 2, 3, 2]
+4 1 2 1
+After: [3, 2, 3, 2]
+
+Before: [1, 0, 2, 2]
+9 0 2 1
+After: [1, 0, 2, 2]
+
+Before: [0, 3, 3, 2]
+5 0 0 1
+After: [0, 1, 3, 2]
+
+Before: [1, 1, 3, 3]
+5 3 2 3
+After: [1, 1, 3, 1]
+
+Before: [3, 1, 0, 2]
+1 1 3 0
+After: [0, 1, 0, 2]
+
+Before: [0, 1, 1, 0]
+12 1 0 0
+After: [1, 1, 1, 0]
+
+Before: [3, 0, 3, 2]
+8 0 3 2
+After: [3, 0, 1, 2]
+
+Before: [1, 0, 1, 1]
+14 3 3 1
+After: [1, 0, 1, 1]
+
+Before: [3, 1, 1, 0]
+15 1 3 3
+After: [3, 1, 1, 1]
+
+Before: [3, 0, 1, 0]
+2 2 1 2
+After: [3, 0, 1, 0]
+
+Before: [3, 1, 0, 2]
+8 0 3 2
+After: [3, 1, 1, 2]
+
+Before: [0, 1, 3, 0]
+12 1 0 0
+After: [1, 1, 3, 0]
+
+Before: [2, 3, 3, 3]
+4 0 2 3
+After: [2, 3, 3, 2]
+
+Before: [3, 2, 2, 2]
+8 0 3 0
+After: [1, 2, 2, 2]
+
+Before: [3, 1, 3, 0]
+15 1 3 0
+After: [1, 1, 3, 0]
+
+Before: [2, 1, 2, 2]
+1 1 3 3
+After: [2, 1, 2, 0]
+
+Before: [0, 1, 2, 2]
+1 1 3 2
+After: [0, 1, 0, 2]
+
+Before: [2, 2, 1, 3]
+8 0 2 0
+After: [1, 2, 1, 3]
+
+Before: [1, 1, 2, 2]
+0 1 2 0
+After: [0, 1, 2, 2]
+
+Before: [0, 1, 3, 2]
+4 3 2 2
+After: [0, 1, 2, 2]
+
+Before: [2, 1, 2, 3]
+6 1 3 0
+After: [0, 1, 2, 3]
+
+Before: [2, 1, 2, 3]
+10 0 1 2
+After: [2, 1, 1, 3]
+
+Before: [1, 1, 2, 2]
+9 0 2 2
+After: [1, 1, 0, 2]
+
+Before: [3, 1, 1, 3]
+6 2 3 2
+After: [3, 1, 0, 3]
+
+Before: [1, 1, 2, 0]
+9 0 2 0
+After: [0, 1, 2, 0]
+
+Before: [3, 1, 3, 1]
+14 3 3 1
+After: [3, 0, 3, 1]
+
+Before: [1, 1, 0, 0]
+15 1 3 3
+After: [1, 1, 0, 1]
+
+Before: [0, 0, 2, 1]
+3 3 2 2
+After: [0, 0, 1, 1]
+
+Before: [2, 3, 3, 2]
+4 0 2 3
+After: [2, 3, 3, 2]
+
+Before: [2, 2, 1, 3]
+6 2 3 1
+After: [2, 0, 1, 3]
+
+Before: [2, 1, 2, 1]
+3 3 2 2
+After: [2, 1, 1, 1]
+
+Before: [2, 2, 3, 2]
+14 3 3 2
+After: [2, 2, 0, 2]
+
+Before: [1, 1, 2, 2]
+0 1 2 2
+After: [1, 1, 0, 2]
+
+Before: [2, 1, 0, 3]
+6 1 3 2
+After: [2, 1, 0, 3]
+
+Before: [3, 2, 2, 0]
+13 2 2 3
+After: [3, 2, 2, 2]
+
+Before: [0, 1, 1, 0]
+12 1 0 2
+After: [0, 1, 1, 0]
+
+Before: [2, 1, 0, 2]
+10 0 1 2
+After: [2, 1, 1, 2]
+
+Before: [1, 0, 0, 2]
+2 0 1 1
+After: [1, 1, 0, 2]
+
+Before: [0, 1, 2, 1]
+3 3 2 0
+After: [1, 1, 2, 1]
+
+Before: [0, 1, 3, 0]
+12 1 0 3
+After: [0, 1, 3, 1]
+
+Before: [0, 1, 2, 3]
+13 3 3 1
+After: [0, 3, 2, 3]
+
+Before: [0, 1, 2, 1]
+12 1 0 0
+After: [1, 1, 2, 1]
+
+Before: [0, 1, 1, 1]
+14 2 3 0
+After: [0, 1, 1, 1]
+
+Before: [0, 2, 2, 3]
+6 2 3 1
+After: [0, 0, 2, 3]
+
+Before: [3, 1, 0, 0]
+15 1 3 2
+After: [3, 1, 1, 0]
+
+Before: [1, 0, 3, 1]
+2 0 1 0
+After: [1, 0, 3, 1]
+
+Before: [2, 1, 1, 2]
+8 0 2 0
+After: [1, 1, 1, 2]
+
+Before: [2, 1, 2, 2]
+10 0 1 2
+After: [2, 1, 1, 2]
+
+Before: [2, 2, 2, 1]
+3 3 2 1
+After: [2, 1, 2, 1]
+
+Before: [2, 1, 3, 2]
+11 0 2 1
+After: [2, 1, 3, 2]
+
+Before: [3, 2, 3, 2]
+8 0 3 3
+After: [3, 2, 3, 1]
+
+Before: [1, 2, 0, 3]
+6 1 3 3
+After: [1, 2, 0, 0]
+
+Before: [2, 1, 0, 2]
+1 1 3 1
+After: [2, 0, 0, 2]
+
+Before: [3, 3, 1, 3]
+13 3 3 3
+After: [3, 3, 1, 3]
+
+Before: [1, 2, 2, 1]
+3 3 2 3
+After: [1, 2, 2, 1]
+
+Before: [2, 1, 3, 2]
+1 1 3 1
+After: [2, 0, 3, 2]
+
+Before: [2, 1, 3, 2]
+10 0 1 0
+After: [1, 1, 3, 2]
+
+Before: [1, 0, 2, 1]
+3 3 2 2
+After: [1, 0, 1, 1]
+
+Before: [1, 1, 3, 2]
+1 1 3 2
+After: [1, 1, 0, 2]
+
+Before: [2, 2, 3, 0]
+11 0 2 1
+After: [2, 1, 3, 0]
+
+Before: [3, 0, 0, 2]
+14 3 3 1
+After: [3, 0, 0, 2]
+
+Before: [3, 1, 3, 0]
+15 1 3 2
+After: [3, 1, 1, 0]
+
+Before: [2, 1, 2, 1]
+3 3 2 0
+After: [1, 1, 2, 1]
+
+Before: [0, 1, 3, 2]
+12 1 0 2
+After: [0, 1, 1, 2]
+
+Before: [3, 3, 0, 3]
+11 2 0 3
+After: [3, 3, 0, 1]
+
+Before: [2, 0, 3, 1]
+2 3 1 2
+After: [2, 0, 1, 1]
+
+Before: [1, 3, 0, 2]
+14 3 3 0
+After: [0, 3, 0, 2]
+
+Before: [3, 0, 0, 2]
+8 0 3 3
+After: [3, 0, 0, 1]
+
+Before: [3, 0, 2, 1]
+3 3 2 2
+After: [3, 0, 1, 1]
+
+Before: [3, 1, 0, 3]
+11 2 0 2
+After: [3, 1, 1, 3]
+
+Before: [0, 1, 0, 3]
+12 1 0 1
+After: [0, 1, 0, 3]
+
+Before: [2, 2, 2, 1]
+3 3 2 0
+After: [1, 2, 2, 1]
+
+Before: [1, 0, 3, 1]
+2 0 1 3
+After: [1, 0, 3, 1]
+
+Before: [1, 1, 2, 3]
+9 0 2 0
+After: [0, 1, 2, 3]
+
+Before: [1, 3, 2, 3]
+6 2 3 2
+After: [1, 3, 0, 3]
+
+Before: [0, 1, 3, 0]
+7 0 0 3
+After: [0, 1, 3, 0]
+
+Before: [1, 1, 2, 0]
+15 1 3 1
+After: [1, 1, 2, 0]
+
+Before: [3, 1, 3, 2]
+1 1 3 1
+After: [3, 0, 3, 2]
+
+Before: [1, 3, 2, 1]
+9 0 2 3
+After: [1, 3, 2, 0]
+
+Before: [0, 0, 2, 1]
+7 0 0 1
+After: [0, 0, 2, 1]
+
+Before: [2, 1, 1, 0]
+15 1 3 2
+After: [2, 1, 1, 0]
+
+Before: [2, 3, 2, 0]
+13 2 2 0
+After: [2, 3, 2, 0]
+
+Before: [1, 1, 2, 1]
+9 0 2 1
+After: [1, 0, 2, 1]
+
+Before: [2, 1, 2, 0]
+15 1 3 1
+After: [2, 1, 2, 0]
+
+Before: [1, 0, 2, 1]
+9 0 2 2
+After: [1, 0, 0, 1]
+
+Before: [1, 1, 0, 2]
+1 1 3 2
+After: [1, 1, 0, 2]
+
+Before: [3, 0, 0, 1]
+2 3 1 0
+After: [1, 0, 0, 1]
+
+Before: [1, 0, 0, 3]
+2 0 1 3
+After: [1, 0, 0, 1]
+
+Before: [3, 1, 2, 0]
+0 1 2 1
+After: [3, 0, 2, 0]
+
+Before: [1, 1, 2, 0]
+0 1 2 1
+After: [1, 0, 2, 0]
+
+Before: [2, 1, 2, 0]
+0 1 2 3
+After: [2, 1, 2, 0]
+
+Before: [1, 0, 3, 1]
+14 3 3 0
+After: [0, 0, 3, 1]
+
+Before: [0, 1, 3, 2]
+12 1 0 0
+After: [1, 1, 3, 2]
+
+Before: [1, 3, 2, 3]
+9 0 2 2
+After: [1, 3, 0, 3]
+
+Before: [0, 2, 2, 1]
+3 3 2 3
+After: [0, 2, 2, 1]
+
+Before: [0, 2, 2, 0]
+7 0 0 3
+After: [0, 2, 2, 0]
+
+Before: [2, 0, 0, 1]
+14 3 3 0
+After: [0, 0, 0, 1]
+
+Before: [2, 3, 3, 3]
+13 3 3 3
+After: [2, 3, 3, 3]
+
+Before: [3, 2, 3, 3]
+4 1 2 1
+After: [3, 2, 3, 3]
+
+Before: [3, 3, 2, 2]
+8 0 3 0
+After: [1, 3, 2, 2]
+
+Before: [2, 2, 3, 0]
+4 1 2 2
+After: [2, 2, 2, 0]
+
+Before: [0, 0, 1, 3]
+7 0 0 3
+After: [0, 0, 1, 0]
+
+Before: [2, 0, 2, 1]
+13 2 2 2
+After: [2, 0, 2, 1]
+
+Before: [2, 2, 3, 1]
+5 2 3 1
+After: [2, 0, 3, 1]
+
+Before: [2, 0, 1, 1]
+2 3 1 0
+After: [1, 0, 1, 1]
+
+Before: [0, 0, 2, 3]
+6 2 3 0
+After: [0, 0, 2, 3]
+
+Before: [2, 1, 3, 3]
+13 3 3 2
+After: [2, 1, 3, 3]
+
+Before: [1, 0, 3, 0]
+2 0 1 2
+After: [1, 0, 1, 0]
+
+Before: [0, 1, 3, 2]
+12 1 0 3
+After: [0, 1, 3, 1]
+
+Before: [0, 2, 3, 1]
+7 0 0 1
+After: [0, 0, 3, 1]
+
+Before: [1, 0, 1, 3]
+13 3 3 3
+After: [1, 0, 1, 3]
+
+Before: [3, 3, 0, 2]
+11 2 0 3
+After: [3, 3, 0, 1]
+
+Before: [3, 0, 2, 1]
+3 3 2 1
+After: [3, 1, 2, 1]
+
+Before: [1, 0, 2, 0]
+9 0 2 0
+After: [0, 0, 2, 0]
+
+Before: [0, 3, 2, 2]
+13 2 2 0
+After: [2, 3, 2, 2]
+
+Before: [0, 0, 0, 1]
+2 3 1 3
+After: [0, 0, 0, 1]
+
+Before: [2, 1, 2, 1]
+0 1 2 3
+After: [2, 1, 2, 0]
+
+Before: [2, 3, 1, 3]
+8 0 2 1
+After: [2, 1, 1, 3]
+
+Before: [3, 3, 0, 0]
+11 2 0 1
+After: [3, 1, 0, 0]
+
+Before: [1, 3, 3, 3]
+13 3 3 0
+After: [3, 3, 3, 3]
+
+Before: [0, 1, 0, 1]
+12 1 0 0
+After: [1, 1, 0, 1]
+
+Before: [3, 2, 0, 1]
+14 3 3 0
+After: [0, 2, 0, 1]
+
+Before: [0, 1, 0, 0]
+7 0 0 0
+After: [0, 1, 0, 0]
+
+Before: [2, 1, 2, 1]
+0 1 2 1
+After: [2, 0, 2, 1]
+
+Before: [3, 2, 1, 1]
+14 3 3 3
+After: [3, 2, 1, 0]
+
+Before: [3, 1, 0, 0]
+11 2 0 1
+After: [3, 1, 0, 0]
+
+Before: [2, 1, 3, 2]
+1 1 3 2
+After: [2, 1, 0, 2]
+
+Before: [0, 2, 2, 3]
+6 2 3 0
+After: [0, 2, 2, 3]
+
+Before: [1, 0, 2, 0]
+9 0 2 2
+After: [1, 0, 0, 0]
+
+Before: [0, 2, 1, 2]
+7 0 0 2
+After: [0, 2, 0, 2]
+
+Before: [0, 0, 1, 3]
+6 2 3 3
+After: [0, 0, 1, 0]
+
+Before: [3, 2, 3, 1]
+4 1 2 2
+After: [3, 2, 2, 1]
+
+Before: [1, 0, 2, 1]
+3 3 2 1
+After: [1, 1, 2, 1]
+
+Before: [2, 3, 2, 1]
+3 3 2 3
+After: [2, 3, 2, 1]
+
+Before: [3, 1, 2, 0]
+15 1 3 0
+After: [1, 1, 2, 0]
+
+Before: [0, 1, 2, 0]
+12 1 0 0
+After: [1, 1, 2, 0]
+
+Before: [3, 3, 0, 0]
+11 2 0 3
+After: [3, 3, 0, 1]
+
+Before: [2, 0, 1, 2]
+8 0 2 3
+After: [2, 0, 1, 1]
+
+Before: [3, 1, 3, 3]
+5 3 2 2
+After: [3, 1, 1, 3]
+
+Before: [1, 0, 2, 2]
+14 3 3 1
+After: [1, 0, 2, 2]
+
+Before: [2, 1, 2, 3]
+0 1 2 3
+After: [2, 1, 2, 0]
+
+Before: [3, 0, 2, 1]
+10 0 2 1
+After: [3, 1, 2, 1]
+
+Before: [2, 1, 0, 2]
+1 1 3 2
+After: [2, 1, 0, 2]
+
+Before: [0, 1, 1, 2]
+12 1 0 3
+After: [0, 1, 1, 1]
+
+Before: [3, 1, 0, 2]
+1 1 3 3
+After: [3, 1, 0, 0]
+
+Before: [0, 2, 3, 0]
+4 1 2 2
+After: [0, 2, 2, 0]
+
+Before: [3, 1, 2, 3]
+0 1 2 1
+After: [3, 0, 2, 3]
+
+Before: [0, 0, 2, 1]
+3 3 2 3
+After: [0, 0, 2, 1]
+
+Before: [0, 1, 2, 1]
+0 1 2 3
+After: [0, 1, 2, 0]
+
+Before: [2, 0, 1, 2]
+14 3 3 1
+After: [2, 0, 1, 2]
+
+Before: [0, 0, 2, 0]
+7 0 0 3
+After: [0, 0, 2, 0]
+
+Before: [3, 1, 3, 2]
+1 1 3 2
+After: [3, 1, 0, 2]
+
+Before: [2, 1, 0, 0]
+15 1 3 1
+After: [2, 1, 0, 0]
+
+Before: [2, 2, 2, 2]
+13 2 2 0
+After: [2, 2, 2, 2]
+
+Before: [0, 2, 3, 3]
+6 1 3 1
+After: [0, 0, 3, 3]
+
+Before: [3, 3, 2, 1]
+3 3 2 3
+After: [3, 3, 2, 1]
+
+Before: [1, 0, 2, 2]
+9 0 2 0
+After: [0, 0, 2, 2]
+
+Before: [0, 1, 2, 3]
+0 1 2 0
+After: [0, 1, 2, 3]
+
+Before: [0, 1, 2, 0]
+0 1 2 0
+After: [0, 1, 2, 0]
+
+Before: [0, 1, 2, 1]
+3 3 2 3
+After: [0, 1, 2, 1]
+
+Before: [0, 1, 0, 3]
+7 0 0 3
+After: [0, 1, 0, 0]
+
+Before: [2, 0, 1, 1]
+8 0 2 2
+After: [2, 0, 1, 1]
+
+Before: [1, 2, 0, 3]
+6 1 3 1
+After: [1, 0, 0, 3]
+
+Before: [1, 1, 2, 2]
+0 1 2 1
+After: [1, 0, 2, 2]
+
+Before: [2, 3, 1, 2]
+14 3 3 1
+After: [2, 0, 1, 2]
+
+Before: [3, 2, 0, 3]
+11 2 0 1
+After: [3, 1, 0, 3]
+
+Before: [1, 0, 2, 3]
+9 0 2 0
+After: [0, 0, 2, 3]
+
+Before: [3, 2, 2, 0]
+10 0 2 0
+After: [1, 2, 2, 0]
+
+Before: [3, 3, 3, 2]
+8 0 3 3
+After: [3, 3, 3, 1]
+
+Before: [0, 1, 3, 2]
+1 1 3 0
+After: [0, 1, 3, 2]
+
+Before: [0, 0, 0, 1]
+14 3 3 3
+After: [0, 0, 0, 0]
+
+Before: [1, 0, 2, 3]
+2 0 1 0
+After: [1, 0, 2, 3]
+
+Before: [2, 1, 3, 1]
+14 3 3 3
+After: [2, 1, 3, 0]
+
+Before: [1, 3, 1, 2]
+14 3 3 2
+After: [1, 3, 0, 2]
+
+Before: [2, 0, 2, 1]
+3 3 2 3
+After: [2, 0, 2, 1]
+
+Before: [0, 1, 2, 3]
+6 1 3 0
+After: [0, 1, 2, 3]
+
+Before: [2, 1, 3, 1]
+11 0 2 2
+After: [2, 1, 1, 1]
+
+Before: [0, 1, 1, 0]
+15 1 3 2
+After: [0, 1, 1, 0]
+
+Before: [1, 1, 2, 1]
+9 0 2 2
+After: [1, 1, 0, 1]
+
+Before: [3, 1, 1, 3]
+6 1 3 1
+After: [3, 0, 1, 3]
+
+Before: [0, 1, 3, 3]
+7 0 0 3
+After: [0, 1, 3, 0]
+
+Before: [1, 0, 2, 1]
+2 0 1 1
+After: [1, 1, 2, 1]
+
+Before: [2, 0, 1, 1]
+8 0 2 0
+After: [1, 0, 1, 1]
+
+Before: [0, 2, 2, 2]
+7 0 0 3
+After: [0, 2, 2, 0]
+
+Before: [3, 2, 3, 3]
+6 1 3 3
+After: [3, 2, 3, 0]
+
+Before: [3, 3, 3, 2]
+4 3 2 3
+After: [3, 3, 3, 2]
+
+Before: [3, 1, 1, 1]
+14 3 3 3
+After: [3, 1, 1, 0]
+
+Before: [2, 0, 3, 1]
+4 0 2 3
+After: [2, 0, 3, 2]
+
+Before: [2, 1, 2, 2]
+1 1 3 2
+After: [2, 1, 0, 2]
+
+Before: [3, 1, 0, 1]
+11 2 0 1
+After: [3, 1, 0, 1]
+
+Before: [2, 3, 2, 1]
+3 3 2 2
+After: [2, 3, 1, 1]
+
+Before: [0, 0, 3, 1]
+7 0 0 1
+After: [0, 0, 3, 1]
+
+Before: [2, 3, 1, 0]
+8 0 2 1
+After: [2, 1, 1, 0]
+
+Before: [2, 0, 0, 1]
+14 3 3 1
+After: [2, 0, 0, 1]
+
+Before: [0, 1, 3, 1]
+12 1 0 2
+After: [0, 1, 1, 1]
+
+Before: [2, 0, 2, 1]
+3 3 2 0
+After: [1, 0, 2, 1]
+
+Before: [2, 3, 3, 1]
+11 0 2 0
+After: [1, 3, 3, 1]
+
+Before: [0, 0, 3, 1]
+2 3 1 3
+After: [0, 0, 3, 1]
+
+Before: [1, 0, 1, 3]
+2 0 1 3
+After: [1, 0, 1, 1]
+
+Before: [0, 2, 2, 2]
+14 3 3 2
+After: [0, 2, 0, 2]
+
+Before: [3, 3, 0, 1]
+11 2 0 1
+After: [3, 1, 0, 1]
+
+Before: [3, 1, 3, 3]
+6 1 3 3
+After: [3, 1, 3, 0]
+
+Before: [1, 2, 3, 2]
+4 1 2 3
+After: [1, 2, 3, 2]
+
+Before: [0, 1, 0, 3]
+6 1 3 0
+After: [0, 1, 0, 3]
+
+Before: [2, 0, 2, 1]
+2 3 1 1
+After: [2, 1, 2, 1]
+
+Before: [0, 2, 0, 3]
+13 3 3 0
+After: [3, 2, 0, 3]
+
+Before: [1, 1, 1, 2]
+1 1 3 3
+After: [1, 1, 1, 0]
+
+Before: [1, 3, 3, 3]
+13 3 3 2
+After: [1, 3, 3, 3]
+
+Before: [0, 1, 3, 0]
+12 1 0 2
+After: [0, 1, 1, 0]
+
+Before: [3, 1, 2, 0]
+15 1 3 1
+After: [3, 1, 2, 0]
+
+Before: [2, 2, 2, 1]
+3 3 2 2
+After: [2, 2, 1, 1]
+
+Before: [2, 2, 1, 2]
+8 0 2 0
+After: [1, 2, 1, 2]
+
+Before: [3, 1, 2, 3]
+0 1 2 2
+After: [3, 1, 0, 3]
+
+Before: [0, 1, 1, 2]
+14 3 3 1
+After: [0, 0, 1, 2]
+
+Before: [0, 1, 3, 3]
+5 3 2 0
+After: [1, 1, 3, 3]
+
+Before: [3, 1, 2, 2]
+8 0 3 0
+After: [1, 1, 2, 2]
+
+Before: [2, 1, 1, 3]
+13 3 3 1
+After: [2, 3, 1, 3]
+
+Before: [0, 2, 1, 2]
+7 0 0 0
+After: [0, 2, 1, 2]
+
+Before: [0, 1, 1, 0]
+15 1 3 0
+After: [1, 1, 1, 0]
+
+Before: [3, 1, 2, 2]
+1 1 3 3
+After: [3, 1, 2, 0]
+
+Before: [0, 0, 2, 3]
+13 3 3 1
+After: [0, 3, 2, 3]
+
+Before: [1, 0, 0, 3]
+5 3 3 3
+After: [1, 0, 0, 1]
+
+Before: [2, 0, 1, 1]
+2 2 1 3
+After: [2, 0, 1, 1]
+
+Before: [3, 3, 1, 2]
+14 3 3 2
+After: [3, 3, 0, 2]
+
+Before: [0, 1, 0, 2]
+12 1 0 3
+After: [0, 1, 0, 1]
+
+Before: [1, 2, 3, 1]
+4 1 2 2
+After: [1, 2, 2, 1]
+
+Before: [3, 0, 3, 2]
+8 0 3 1
+After: [3, 1, 3, 2]
+
+Before: [3, 1, 1, 1]
+14 2 3 2
+After: [3, 1, 0, 1]
+
+Before: [0, 2, 2, 0]
+13 2 2 0
+After: [2, 2, 2, 0]
+
+Before: [0, 1, 3, 2]
+12 1 0 1
+After: [0, 1, 3, 2]
+
+Before: [3, 1, 2, 1]
+10 0 2 3
+After: [3, 1, 2, 1]
+
+Before: [3, 0, 0, 2]
+11 2 0 3
+After: [3, 0, 0, 1]
+
+Before: [1, 2, 2, 2]
+9 0 2 2
+After: [1, 2, 0, 2]
+
+Before: [2, 0, 0, 1]
+2 3 1 2
+After: [2, 0, 1, 1]
+
+Before: [1, 0, 0, 1]
+14 3 3 1
+After: [1, 0, 0, 1]
+
+Before: [3, 3, 1, 2]
+8 0 3 2
+After: [3, 3, 1, 2]
+
+Before: [0, 1, 1, 0]
+12 1 0 1
+After: [0, 1, 1, 0]
+
+Before: [0, 2, 1, 1]
+7 0 0 1
+After: [0, 0, 1, 1]
+
+Before: [0, 1, 2, 0]
+12 1 0 3
+After: [0, 1, 2, 1]
+
+Before: [2, 1, 2, 1]
+13 2 2 1
+After: [2, 2, 2, 1]
+
+Before: [1, 1, 1, 3]
+6 2 3 3
+After: [1, 1, 1, 0]
+
+Before: [1, 1, 2, 0]
+0 1 2 0
+After: [0, 1, 2, 0]
+
+Before: [2, 1, 1, 2]
+10 0 1 0
+After: [1, 1, 1, 2]
+
+Before: [3, 2, 2, 1]
+3 3 2 3
+After: [3, 2, 2, 1]
+
+Before: [3, 0, 3, 2]
+4 3 2 1
+After: [3, 2, 3, 2]
+
+Before: [1, 0, 0, 1]
+2 3 1 3
+After: [1, 0, 0, 1]
+
+Before: [2, 3, 2, 2]
+13 2 2 0
+After: [2, 3, 2, 2]
+
+Before: [2, 1, 0, 0]
+10 0 1 2
+After: [2, 1, 1, 0]
+
+Before: [2, 0, 3, 2]
+4 0 2 3
+After: [2, 0, 3, 2]
+
+Before: [0, 2, 3, 2]
+7 0 0 1
+After: [0, 0, 3, 2]
+
+Before: [0, 3, 2, 3]
+7 0 0 2
+After: [0, 3, 0, 3]
+
+Before: [3, 2, 2, 0]
+10 0 2 2
+After: [3, 2, 1, 0]
+
+Before: [3, 0, 2, 1]
+5 2 2 1
+After: [3, 1, 2, 1]
+
+Before: [2, 0, 2, 1]
+3 3 2 2
+After: [2, 0, 1, 1]
+
+Before: [1, 2, 2, 3]
+9 0 2 2
+After: [1, 2, 0, 3]
+
+Before: [0, 3, 2, 1]
+3 3 2 0
+After: [1, 3, 2, 1]
+
+Before: [0, 3, 1, 3]
+13 3 3 0
+After: [3, 3, 1, 3]
+
+Before: [0, 1, 2, 3]
+0 1 2 2
+After: [0, 1, 0, 3]
+
+Before: [2, 0, 1, 3]
+2 2 1 0
+After: [1, 0, 1, 3]
+
+Before: [1, 1, 2, 2]
+1 1 3 0
+After: [0, 1, 2, 2]
+
+Before: [2, 1, 2, 3]
+10 0 1 3
+After: [2, 1, 2, 1]
+
+Before: [0, 1, 2, 3]
+6 1 3 2
+After: [0, 1, 0, 3]
+
+Before: [3, 1, 3, 2]
+4 3 2 3
+After: [3, 1, 3, 2]
+
+Before: [3, 1, 0, 2]
+11 2 0 3
+After: [3, 1, 0, 1]
+
+Before: [2, 0, 3, 1]
+11 0 2 2
+After: [2, 0, 1, 1]
+
+Before: [2, 3, 3, 3]
+4 0 2 2
+After: [2, 3, 2, 3]
+
+Before: [0, 1, 2, 2]
+1 1 3 1
+After: [0, 0, 2, 2]
+
+Before: [0, 1, 1, 2]
+1 1 3 2
+After: [0, 1, 0, 2]
+
+Before: [1, 3, 2, 0]
+9 0 2 2
+After: [1, 3, 0, 0]
+
+Before: [3, 3, 1, 3]
+13 3 3 1
+After: [3, 3, 1, 3]
+
+Before: [1, 1, 3, 3]
+5 3 3 2
+After: [1, 1, 1, 3]
+
+Before: [0, 0, 0, 2]
+7 0 0 0
+After: [0, 0, 0, 2]
+
+Before: [2, 1, 1, 2]
+10 0 1 1
+After: [2, 1, 1, 2]
+
+Before: [3, 0, 0, 1]
+2 3 1 1
+After: [3, 1, 0, 1]
+
+Before: [0, 1, 2, 2]
+0 1 2 1
+After: [0, 0, 2, 2]
+
+Before: [1, 1, 2, 2]
+0 1 2 3
+After: [1, 1, 2, 0]
+
+Before: [0, 1, 1, 3]
+12 1 0 0
+After: [1, 1, 1, 3]
+
+Before: [1, 2, 2, 1]
+3 3 2 0
+After: [1, 2, 2, 1]
+
+Before: [2, 1, 2, 0]
+10 0 1 2
+After: [2, 1, 1, 0]
+
+Before: [0, 1, 2, 3]
+0 1 2 3
+After: [0, 1, 2, 0]
+
+Before: [1, 2, 1, 3]
+6 2 3 0
+After: [0, 2, 1, 3]
+
+Before: [3, 1, 2, 2]
+1 1 3 1
+After: [3, 0, 2, 2]
+
+Before: [1, 2, 2, 2]
+5 2 1 0
+After: [1, 2, 2, 2]
+
+Before: [2, 1, 2, 1]
+3 3 2 3
+After: [2, 1, 2, 1]
+
+Before: [3, 1, 0, 0]
+15 1 3 3
+After: [3, 1, 0, 1]
+
+Before: [3, 3, 2, 0]
+10 0 2 3
+After: [3, 3, 2, 1]
+
+Before: [1, 0, 3, 1]
+2 3 1 0
+After: [1, 0, 3, 1]
+
+Before: [1, 2, 1, 3]
+6 1 3 3
+After: [1, 2, 1, 0]
+
+Before: [3, 1, 0, 2]
+11 2 0 1
+After: [3, 1, 0, 2]
+
+Before: [0, 1, 0, 2]
+1 1 3 2
+After: [0, 1, 0, 2]
+
+Before: [1, 0, 1, 2]
+14 3 3 2
+After: [1, 0, 0, 2]
+
+Before: [2, 1, 1, 1]
+10 0 1 0
+After: [1, 1, 1, 1]
+
+Before: [1, 3, 1, 3]
+6 2 3 0
+After: [0, 3, 1, 3]
+
+Before: [1, 1, 2, 1]
+9 0 2 0
+After: [0, 1, 2, 1]
+
+Before: [1, 2, 3, 3]
+6 1 3 3
+After: [1, 2, 3, 0]
+
+Before: [3, 1, 2, 2]
+0 1 2 3
+After: [3, 1, 2, 0]
+
+Before: [1, 0, 2, 0]
+2 0 1 3
+After: [1, 0, 2, 1]
+
+Before: [1, 1, 2, 2]
+9 0 2 3
+After: [1, 1, 2, 0]
+
+Before: [2, 0, 2, 3]
+6 2 3 0
+After: [0, 0, 2, 3]
+
+Before: [1, 3, 1, 2]
+14 3 3 1
+After: [1, 0, 1, 2]
+
+Before: [0, 2, 1, 3]
+6 1 3 1
+After: [0, 0, 1, 3]
+
+Before: [1, 1, 1, 2]
+1 1 3 1
+After: [1, 0, 1, 2]
+
+Before: [3, 1, 2, 1]
+0 1 2 1
+After: [3, 0, 2, 1]
+
+Before: [2, 1, 1, 3]
+6 2 3 3
+After: [2, 1, 1, 0]
+
+Before: [1, 1, 2, 3]
+0 1 2 1
+After: [1, 0, 2, 3]
+
+Before: [0, 1, 3, 1]
+12 1 0 1
+After: [0, 1, 3, 1]
+
+Before: [3, 3, 2, 2]
+14 3 3 1
+After: [3, 0, 2, 2]
+
+Before: [0, 2, 3, 0]
+7 0 0 0
+After: [0, 2, 3, 0]
+
+Before: [0, 1, 0, 3]
+6 1 3 3
+After: [0, 1, 0, 0]
+
+Before: [1, 1, 2, 3]
+9 0 2 3
+After: [1, 1, 2, 0]
+
+Before: [1, 1, 2, 0]
+9 0 2 2
+After: [1, 1, 0, 0]
+
+Before: [1, 0, 3, 1]
+2 3 1 2
+After: [1, 0, 1, 1]
+
+Before: [2, 0, 3, 2]
+4 0 2 1
+After: [2, 2, 3, 2]
+
+Before: [3, 1, 3, 1]
+5 2 3 3
+After: [3, 1, 3, 0]
+
+Before: [2, 0, 1, 1]
+14 2 3 1
+After: [2, 0, 1, 1]
+
+Before: [2, 0, 3, 3]
+11 0 2 0
+After: [1, 0, 3, 3]
+
+Before: [3, 1, 2, 1]
+0 1 2 0
+After: [0, 1, 2, 1]
+
+Before: [3, 3, 1, 3]
+13 3 3 2
+After: [3, 3, 3, 3]
+
+Before: [0, 1, 0, 3]
+12 1 0 0
+After: [1, 1, 0, 3]
+
+Before: [2, 1, 1, 0]
+8 0 2 1
+After: [2, 1, 1, 0]
+
+Before: [0, 1, 3, 2]
+1 1 3 3
+After: [0, 1, 3, 0]
+
+Before: [3, 2, 3, 2]
+8 0 3 0
+After: [1, 2, 3, 2]
+
+Before: [2, 0, 3, 2]
+11 0 2 1
+After: [2, 1, 3, 2]
+
+Before: [0, 1, 1, 1]
+12 1 0 1
+After: [0, 1, 1, 1]
+
+Before: [2, 0, 3, 1]
+4 0 2 1
+After: [2, 2, 3, 1]
+
+Before: [2, 1, 2, 1]
+0 1 2 0
+After: [0, 1, 2, 1]
+
+Before: [3, 2, 0, 1]
+11 2 0 2
+After: [3, 2, 1, 1]
+
+Before: [0, 1, 0, 0]
+15 1 3 1
+After: [0, 1, 0, 0]
+
+Before: [3, 1, 2, 3]
+6 1 3 0
+After: [0, 1, 2, 3]
+
+Before: [0, 1, 2, 0]
+0 1 2 2
+After: [0, 1, 0, 0]
+
+Before: [1, 2, 2, 1]
+9 0 2 2
+After: [1, 2, 0, 1]
+
+Before: [3, 3, 2, 1]
+3 3 2 2
+After: [3, 3, 1, 1]
+
+Before: [0, 2, 1, 3]
+13 3 3 1
+After: [0, 3, 1, 3]
+
+Before: [0, 2, 2, 2]
+7 0 0 0
+After: [0, 2, 2, 2]
+
+Before: [1, 3, 3, 2]
+14 3 3 2
+After: [1, 3, 0, 2]
+
+Before: [3, 1, 0, 2]
+1 1 3 1
+After: [3, 0, 0, 2]
+
+Before: [0, 2, 3, 3]
+6 1 3 3
+After: [0, 2, 3, 0]
+
+Before: [3, 1, 2, 0]
+15 1 3 2
+After: [3, 1, 1, 0]
+
+Before: [0, 0, 2, 3]
+5 2 2 3
+After: [0, 0, 2, 1]
+
+Before: [1, 0, 2, 1]
+9 0 2 0
+After: [0, 0, 2, 1]
+
+Before: [0, 1, 1, 2]
+7 0 0 0
+After: [0, 1, 1, 2]
+
+Before: [2, 3, 1, 3]
+5 3 2 1
+After: [2, 0, 1, 3]
+
+Before: [2, 1, 2, 3]
+0 1 2 0
+After: [0, 1, 2, 3]
+
+Before: [2, 2, 3, 2]
+4 0 2 1
+After: [2, 2, 3, 2]
+
+Before: [0, 3, 2, 2]
+7 0 0 2
+After: [0, 3, 0, 2]
+
+Before: [3, 0, 3, 3]
+5 3 0 3
+After: [3, 0, 3, 1]
+
+Before: [1, 1, 3, 3]
+13 3 3 0
+After: [3, 1, 3, 3]
+
+Before: [3, 2, 3, 3]
+4 1 2 3
+After: [3, 2, 3, 2]
+
+Before: [0, 1, 2, 2]
+13 2 2 0
+After: [2, 1, 2, 2]
+
+Before: [0, 3, 2, 3]
+5 0 0 2
+After: [0, 3, 1, 3]
+
+Before: [3, 3, 3, 2]
+4 3 2 2
+After: [3, 3, 2, 2]
+
+Before: [0, 3, 0, 3]
+5 3 3 0
+After: [1, 3, 0, 3]
+
+Before: [3, 3, 2, 2]
+13 2 2 2
+After: [3, 3, 2, 2]
+
+Before: [2, 1, 0, 2]
+1 1 3 0
+After: [0, 1, 0, 2]
+
+Before: [3, 3, 0, 1]
+14 3 3 1
+After: [3, 0, 0, 1]
+
+Before: [0, 0, 3, 0]
+7 0 0 2
+After: [0, 0, 0, 0]
+
+Before: [1, 0, 1, 1]
+2 0 1 2
+After: [1, 0, 1, 1]
+
+Before: [1, 2, 3, 3]
+13 3 3 0
+After: [3, 2, 3, 3]
+
+Before: [3, 2, 1, 3]
+6 2 3 3
+After: [3, 2, 1, 0]
+
+Before: [3, 1, 2, 1]
+10 0 2 1
+After: [3, 1, 2, 1]
+
+Before: [1, 2, 2, 0]
+9 0 2 3
+After: [1, 2, 2, 0]
+
+Before: [3, 1, 2, 2]
+0 1 2 0
+After: [0, 1, 2, 2]
+
+Before: [0, 1, 0, 0]
+12 1 0 0
+After: [1, 1, 0, 0]
+
+Before: [2, 0, 2, 1]
+2 3 1 2
+After: [2, 0, 1, 1]
+
+Before: [2, 3, 2, 1]
+3 3 2 1
+After: [2, 1, 2, 1]
+
+Before: [3, 2, 3, 1]
+14 3 3 3
+After: [3, 2, 3, 0]
+
+Before: [1, 0, 2, 1]
+3 3 2 0
+After: [1, 0, 2, 1]
+
+Before: [1, 1, 2, 0]
+0 1 2 2
+After: [1, 1, 0, 0]
+
+Before: [2, 2, 3, 2]
+11 0 2 3
+After: [2, 2, 3, 1]
+
+Before: [3, 0, 2, 3]
+10 0 2 0
+After: [1, 0, 2, 3]
+
+Before: [3, 2, 3, 2]
+4 3 2 1
+After: [3, 2, 3, 2]
+
+Before: [3, 1, 2, 2]
+10 0 2 2
+After: [3, 1, 1, 2]
+
+Before: [2, 1, 3, 3]
+6 1 3 2
+After: [2, 1, 0, 3]
+
+Before: [3, 2, 2, 2]
+8 0 3 2
+After: [3, 2, 1, 2]
+
+Before: [0, 1, 0, 0]
+7 0 0 3
+After: [0, 1, 0, 0]
+
+Before: [2, 3, 3, 2]
+11 0 2 3
+After: [2, 3, 3, 1]
+
+Before: [0, 2, 3, 2]
+7 0 0 3
+After: [0, 2, 3, 0]
+
+Before: [1, 3, 3, 3]
+5 3 2 0
+After: [1, 3, 3, 3]
+
+Before: [3, 2, 0, 3]
+11 2 0 3
+After: [3, 2, 0, 1]
+
+Before: [3, 2, 2, 2]
+14 3 3 3
+After: [3, 2, 2, 0]
+
+Before: [2, 3, 2, 3]
+13 2 2 3
+After: [2, 3, 2, 2]
+
+Before: [3, 2, 3, 2]
+14 3 3 0
+After: [0, 2, 3, 2]
+
+Before: [1, 3, 1, 1]
+14 3 3 0
+After: [0, 3, 1, 1]
+
+Before: [3, 1, 2, 1]
+0 1 2 2
+After: [3, 1, 0, 1]
+
+Before: [0, 1, 1, 2]
+1 1 3 1
+After: [0, 0, 1, 2]
+
+Before: [3, 3, 3, 2]
+8 0 3 0
+After: [1, 3, 3, 2]
+
+Before: [2, 0, 3, 3]
+4 0 2 0
+After: [2, 0, 3, 3]
+
+Before: [1, 2, 2, 1]
+3 3 2 1
+After: [1, 1, 2, 1]
+
+Before: [0, 1, 3, 0]
+7 0 0 2
+After: [0, 1, 0, 0]
+
+Before: [0, 0, 3, 2]
+14 3 3 2
+After: [0, 0, 0, 2]
+
+Before: [2, 3, 2, 1]
+5 2 0 3
+After: [2, 3, 2, 1]
+
+Before: [0, 1, 0, 1]
+12 1 0 2
+After: [0, 1, 1, 1]
+
+Before: [0, 1, 2, 0]
+15 1 3 3
+After: [0, 1, 2, 1]
+
+Before: [1, 3, 2, 3]
+6 2 3 0
+After: [0, 3, 2, 3]
+
+Before: [1, 1, 1, 3]
+13 3 3 1
+After: [1, 3, 1, 3]
+
+Before: [2, 1, 3, 3]
+4 0 2 3
+After: [2, 1, 3, 2]
+
+Before: [0, 1, 2, 3]
+0 1 2 1
+After: [0, 0, 2, 3]
+
+Before: [2, 1, 1, 2]
+1 1 3 3
+After: [2, 1, 1, 0]
+
+Before: [3, 0, 2, 0]
+10 0 2 3
+After: [3, 0, 2, 1]
+
+Before: [1, 2, 2, 1]
+9 0 2 3
+After: [1, 2, 2, 0]
+
+Before: [2, 1, 3, 2]
+4 0 2 1
+After: [2, 2, 3, 2]
+
+Before: [3, 3, 0, 1]
+11 2 0 3
+After: [3, 3, 0, 1]
+
+Before: [3, 1, 2, 0]
+0 1 2 0
+After: [0, 1, 2, 0]
+
+Before: [0, 1, 3, 3]
+12 1 0 1
+After: [0, 1, 3, 3]
+
+Before: [1, 0, 0, 1]
+2 3 1 1
+After: [1, 1, 0, 1]
+
+Before: [1, 1, 2, 3]
+9 0 2 1
+After: [1, 0, 2, 3]
+
+Before: [3, 2, 0, 2]
+11 2 0 1
+After: [3, 1, 0, 2]
+
+Before: [0, 3, 1, 1]
+7 0 0 1
+After: [0, 0, 1, 1]
+
+Before: [0, 1, 2, 2]
+7 0 0 1
+After: [0, 0, 2, 2]
+
+Before: [0, 3, 2, 0]
+7 0 0 0
+After: [0, 3, 2, 0]
+
+Before: [2, 3, 2, 1]
+3 3 2 0
+After: [1, 3, 2, 1]
+
+Before: [3, 3, 0, 2]
+8 0 3 1
+After: [3, 1, 0, 2]
+
+Before: [0, 1, 2, 1]
+12 1 0 3
+After: [0, 1, 2, 1]
+
+Before: [0, 2, 3, 3]
+5 0 0 3
+After: [0, 2, 3, 1]
+
+Before: [0, 0, 0, 1]
+2 3 1 1
+After: [0, 1, 0, 1]
+
+Before: [2, 0, 3, 2]
+11 0 2 2
+After: [2, 0, 1, 2]
+
+Before: [0, 1, 3, 0]
+15 1 3 1
+After: [0, 1, 3, 0]
+
+Before: [0, 2, 1, 3]
+7 0 0 0
+After: [0, 2, 1, 3]
+
+Before: [0, 3, 3, 3]
+7 0 0 2
+After: [0, 3, 0, 3]
+
+Before: [3, 1, 2, 2]
+1 1 3 0
+After: [0, 1, 2, 2]
+
+Before: [3, 0, 0, 2]
+14 3 3 3
+After: [3, 0, 0, 0]
+
+Before: [3, 1, 3, 0]
+15 1 3 1
+After: [3, 1, 3, 0]
+
+Before: [3, 0, 2, 1]
+3 3 2 3
+After: [3, 0, 2, 1]
+
+Before: [0, 1, 0, 3]
+12 1 0 2
+After: [0, 1, 1, 3]
+
+Before: [2, 3, 2, 2]
+5 2 0 0
+After: [1, 3, 2, 2]
+
+Before: [0, 1, 2, 2]
+0 1 2 0
+After: [0, 1, 2, 2]
+
+Before: [2, 0, 1, 0]
+8 0 2 1
+After: [2, 1, 1, 0]
+
+Before: [3, 1, 3, 3]
+6 1 3 0
+After: [0, 1, 3, 3]
+
+Before: [1, 1, 1, 2]
+1 1 3 2
+After: [1, 1, 0, 2]
+
+Before: [2, 1, 0, 2]
+1 1 3 3
+After: [2, 1, 0, 0]
+
+Before: [2, 1, 3, 2]
+11 0 2 3
+After: [2, 1, 3, 1]
+
+Before: [3, 1, 2, 2]
+14 3 3 3
+After: [3, 1, 2, 0]
+
+Before: [3, 0, 1, 2]
+2 2 1 1
+After: [3, 1, 1, 2]
+
+Before: [3, 1, 1, 0]
+15 1 3 1
+After: [3, 1, 1, 0]
+
+Before: [2, 0, 3, 0]
+4 0 2 3
+After: [2, 0, 3, 2]
+
+Before: [0, 2, 0, 3]
+7 0 0 2
+After: [0, 2, 0, 3]
+
+Before: [1, 0, 2, 2]
+9 0 2 2
+After: [1, 0, 0, 2]
+
+Before: [0, 3, 2, 1]
+3 3 2 3
+After: [0, 3, 2, 1]
+
+Before: [2, 1, 1, 0]
+15 1 3 0
+After: [1, 1, 1, 0]
+
+Before: [3, 1, 3, 2]
+8 0 3 1
+After: [3, 1, 3, 2]
+
+Before: [0, 0, 2, 1]
+2 3 1 3
+After: [0, 0, 2, 1]
+
+Before: [3, 1, 2, 2]
+10 0 2 0
+After: [1, 1, 2, 2]
+
+Before: [1, 3, 2, 1]
+3 3 2 0
+After: [1, 3, 2, 1]
+
+Before: [1, 3, 2, 1]
+3 3 2 3
+After: [1, 3, 2, 1]
+
+Before: [3, 2, 3, 2]
+4 3 2 0
+After: [2, 2, 3, 2]
+
+Before: [2, 1, 3, 0]
+4 0 2 0
+After: [2, 1, 3, 0]
+
+Before: [3, 1, 2, 1]
+3 3 2 1
+After: [3, 1, 2, 1]
+
+Before: [1, 3, 2, 0]
+9 0 2 1
+After: [1, 0, 2, 0]
+
+Before: [3, 2, 0, 1]
+14 3 3 2
+After: [3, 2, 0, 1]
+
+Before: [2, 3, 3, 3]
+11 0 2 1
+After: [2, 1, 3, 3]
+
+Before: [0, 1, 2, 0]
+0 1 2 3
+After: [0, 1, 2, 0]
+
+Before: [2, 1, 3, 2]
+1 1 3 0
+After: [0, 1, 3, 2]
+
+Before: [1, 1, 2, 0]
+9 0 2 3
+After: [1, 1, 2, 0]
+
+Before: [0, 1, 2, 2]
+12 1 0 2
+After: [0, 1, 1, 2]
+
+Before: [0, 0, 3, 3]
+5 0 0 2
+After: [0, 0, 1, 3]
+
+Before: [1, 0, 1, 3]
+2 2 1 0
+After: [1, 0, 1, 3]
+
+Before: [2, 0, 3, 0]
+11 0 2 3
+After: [2, 0, 3, 1]
+
+Before: [2, 3, 2, 1]
+14 3 3 1
+After: [2, 0, 2, 1]
+
+Before: [3, 2, 2, 3]
+10 0 2 0
+After: [1, 2, 2, 3]
+
+Before: [2, 0, 1, 1]
+8 0 2 3
+After: [2, 0, 1, 1]
+
+Before: [0, 1, 2, 1]
+0 1 2 1
+After: [0, 0, 2, 1]
+
+Before: [0, 1, 2, 3]
+5 3 1 1
+After: [0, 0, 2, 3]
+
+Before: [3, 0, 0, 3]
+13 3 3 2
+After: [3, 0, 3, 3]
+
+Before: [1, 1, 2, 2]
+1 1 3 3
+After: [1, 1, 2, 0]
+
+Before: [3, 0, 0, 3]
+13 3 3 3
+After: [3, 0, 0, 3]
+
+Before: [0, 1, 1, 2]
+1 1 3 0
+After: [0, 1, 1, 2]
+
+Before: [0, 1, 2, 3]
+13 2 2 1
+After: [0, 2, 2, 3]
+
+Before: [1, 1, 2, 3]
+9 0 2 2
+After: [1, 1, 0, 3]
+
+Before: [3, 0, 0, 3]
+11 2 0 0
+After: [1, 0, 0, 3]
+
+Before: [0, 1, 0, 2]
+12 1 0 2
+After: [0, 1, 1, 2]
+
+Before: [0, 1, 2, 0]
+5 0 0 3
+After: [0, 1, 2, 1]
+
+Before: [3, 3, 2, 1]
+10 0 2 3
+After: [3, 3, 2, 1]
+
+Before: [2, 2, 3, 0]
+4 1 2 3
+After: [2, 2, 3, 2]
+
+Before: [2, 0, 2, 0]
+5 2 2 3
+After: [2, 0, 2, 1]
+
+Before: [1, 1, 2, 0]
+15 1 3 0
+After: [1, 1, 2, 0]
+
+Before: [1, 3, 2, 3]
+9 0 2 0
+After: [0, 3, 2, 3]
+
+Before: [3, 1, 3, 0]
+15 1 3 3
+After: [3, 1, 3, 1]
+
+Before: [3, 0, 1, 3]
+2 2 1 3
+After: [3, 0, 1, 1]
+
+Before: [0, 1, 1, 0]
+15 1 3 1
+After: [0, 1, 1, 0]
+
+Before: [1, 3, 2, 1]
+3 3 2 2
+After: [1, 3, 1, 1]
+
+Before: [2, 2, 3, 0]
+11 0 2 3
+After: [2, 2, 3, 1]
+
+Before: [1, 1, 2, 3]
+5 3 2 1
+After: [1, 0, 2, 3]
+
+Before: [3, 0, 1, 1]
+2 3 1 0
+After: [1, 0, 1, 1]
+
+Before: [2, 1, 2, 3]
+5 2 0 1
+After: [2, 1, 2, 3]
+
+Before: [2, 1, 2, 0]
+10 0 1 0
+After: [1, 1, 2, 0]
+
+Before: [2, 2, 3, 3]
+4 1 2 1
+After: [2, 2, 3, 3]
+
+Before: [3, 0, 2, 1]
+3 3 2 0
+After: [1, 0, 2, 1]
+
+Before: [3, 2, 2, 0]
+10 0 2 3
+After: [3, 2, 2, 1]
+
+Before: [3, 0, 1, 3]
+5 3 0 3
+After: [3, 0, 1, 1]
+
+Before: [1, 1, 2, 0]
+0 1 2 3
+After: [1, 1, 2, 0]
+
+Before: [3, 1, 1, 2]
+1 1 3 1
+After: [3, 0, 1, 2]
+
+Before: [1, 3, 2, 1]
+3 3 2 1
+After: [1, 1, 2, 1]
+
+Before: [0, 1, 1, 0]
+7 0 0 0
+After: [0, 1, 1, 0]
+
+Before: [3, 1, 3, 2]
+1 1 3 3
+After: [3, 1, 3, 0]
+
+Before: [0, 3, 2, 3]
+6 2 3 1
+After: [0, 0, 2, 3]
+
+Before: [3, 2, 2, 3]
+6 2 3 0
+After: [0, 2, 2, 3]
+
+Before: [3, 1, 2, 1]
+3 3 2 2
+After: [3, 1, 1, 1]
+
+Before: [2, 0, 2, 3]
+6 2 3 1
+After: [2, 0, 2, 3]
+
+Before: [3, 1, 0, 2]
+11 2 0 2
+After: [3, 1, 1, 2]
+
+Before: [1, 1, 0, 2]
+1 1 3 1
+After: [1, 0, 0, 2]
+
+Before: [2, 2, 3, 3]
+11 0 2 2
+After: [2, 2, 1, 3]
+
+Before: [0, 0, 2, 3]
+13 2 2 1
+After: [0, 2, 2, 3]
+
+Before: [2, 1, 3, 0]
+10 0 1 1
+After: [2, 1, 3, 0]
+
+Before: [0, 1, 2, 2]
+5 2 2 0
+After: [1, 1, 2, 2]
+
+Before: [1, 1, 3, 2]
+4 3 2 3
+After: [1, 1, 3, 2]
+
+Before: [3, 1, 2, 0]
+15 1 3 3
+After: [3, 1, 2, 1]
+
+Before: [0, 1, 3, 1]
+12 1 0 3
+After: [0, 1, 3, 1]
+
+Before: [0, 1, 2, 2]
+0 1 2 3
+After: [0, 1, 2, 0]
+
+Before: [3, 2, 2, 3]
+10 0 2 1
+After: [3, 1, 2, 3]
+
+Before: [0, 3, 1, 1]
+14 3 3 0
+After: [0, 3, 1, 1]
+
+Before: [3, 0, 2, 1]
+2 3 1 1
+After: [3, 1, 2, 1]
+
+Before: [0, 3, 2, 3]
+13 2 2 3
+After: [0, 3, 2, 2]
+
+Before: [3, 0, 2, 0]
+10 0 2 2
+After: [3, 0, 1, 0]
+
+Before: [2, 3, 0, 3]
+13 3 3 3
+After: [2, 3, 0, 3]
+
+Before: [3, 0, 1, 3]
+2 2 1 0
+After: [1, 0, 1, 3]
+
+Before: [0, 1, 1, 0]
+12 1 0 3
+After: [0, 1, 1, 1]
+
+Before: [0, 1, 2, 3]
+12 1 0 1
+After: [0, 1, 2, 3]
+
+Before: [0, 1, 3, 0]
+5 0 0 1
+After: [0, 1, 3, 0]
+
+Before: [3, 2, 2, 1]
+10 0 2 2
+After: [3, 2, 1, 1]
+
+Before: [3, 1, 3, 1]
+5 2 1 0
+After: [0, 1, 3, 1]
+
+Before: [0, 1, 2, 0]
+15 1 3 0
+After: [1, 1, 2, 0]
+
+Before: [0, 1, 0, 2]
+1 1 3 1
+After: [0, 0, 0, 2]
+
+Before: [3, 0, 2, 1]
+10 0 2 2
+After: [3, 0, 1, 1]
+
+Before: [0, 1, 0, 0]
+12 1 0 2
+After: [0, 1, 1, 0]
+
+Before: [3, 0, 2, 1]
+10 0 2 3
+After: [3, 0, 2, 1]
+
+Before: [0, 3, 2, 1]
+3 3 2 1
+After: [0, 1, 2, 1]
+
+Before: [1, 1, 2, 2]
+9 0 2 1
+After: [1, 0, 2, 2]
+
+Before: [2, 1, 3, 0]
+15 1 3 2
+After: [2, 1, 1, 0]
+
+Before: [0, 0, 2, 1]
+13 2 2 2
+After: [0, 0, 2, 1]
+
+Before: [0, 3, 3, 2]
+4 3 2 2
+After: [0, 3, 2, 2]
+
+Before: [2, 1, 2, 0]
+15 1 3 2
+After: [2, 1, 1, 0]
+
+Before: [1, 0, 2, 2]
+9 0 2 3
+After: [1, 0, 2, 0]
+
+Before: [0, 1, 1, 0]
+15 1 3 3
+After: [0, 1, 1, 1]
+
+Before: [0, 1, 0, 0]
+15 1 3 2
+After: [0, 1, 1, 0]
+
+Before: [0, 1, 1, 3]
+12 1 0 2
+After: [0, 1, 1, 3]
+
+Before: [3, 1, 2, 2]
+10 0 2 3
+After: [3, 1, 2, 1]
+
+Before: [3, 3, 2, 3]
+10 0 2 3
+After: [3, 3, 2, 1]
+
+Before: [0, 0, 1, 3]
+2 2 1 1
+After: [0, 1, 1, 3]
+
+Before: [0, 1, 3, 0]
+15 1 3 2
+After: [0, 1, 1, 0]
+
+Before: [1, 3, 2, 2]
+9 0 2 1
+After: [1, 0, 2, 2]
+
+Before: [3, 3, 0, 0]
+11 2 0 0
+After: [1, 3, 0, 0]
+
+Before: [0, 1, 0, 0]
+12 1 0 1
+After: [0, 1, 0, 0]
+
+Before: [3, 2, 0, 2]
+14 3 3 2
+After: [3, 2, 0, 2]
+
+Before: [3, 3, 0, 2]
+11 2 0 2
+After: [3, 3, 1, 2]
+
+Before: [1, 2, 2, 3]
+9 0 2 3
+After: [1, 2, 2, 0]
+
+Before: [1, 3, 3, 3]
+5 3 3 2
+After: [1, 3, 1, 3]
+
+Before: [2, 0, 1, 1]
+14 3 3 0
+After: [0, 0, 1, 1]
+
+Before: [1, 3, 2, 2]
+9 0 2 0
+After: [0, 3, 2, 2]
+
+Before: [2, 1, 1, 3]
+8 0 2 1
+After: [2, 1, 1, 3]
+
+Before: [2, 1, 1, 2]
+8 0 2 3
+After: [2, 1, 1, 1]
+
+Before: [2, 2, 1, 0]
+8 0 2 2
+After: [2, 2, 1, 0]
+
+Before: [3, 1, 2, 1]
+10 0 2 2
+After: [3, 1, 1, 1]
+
+Before: [0, 2, 3, 0]
+7 0 0 1
+After: [0, 0, 3, 0]
+
+Before: [3, 3, 3, 3]
+5 3 0 2
+After: [3, 3, 1, 3]
+
+Before: [3, 0, 2, 1]
+13 2 2 1
+After: [3, 2, 2, 1]
+
+Before: [1, 1, 2, 3]
+0 1 2 3
+After: [1, 1, 2, 0]
+
+Before: [2, 1, 2, 3]
+6 2 3 1
+After: [2, 0, 2, 3]
+
+Before: [0, 0, 1, 2]
+2 2 1 2
+After: [0, 0, 1, 2]
+
+Before: [1, 2, 1, 3]
+5 3 1 2
+After: [1, 2, 0, 3]
+
+Before: [3, 0, 0, 2]
+8 0 3 0
+After: [1, 0, 0, 2]
+
+Before: [1, 3, 2, 1]
+9 0 2 1
+After: [1, 0, 2, 1]
+
+Before: [3, 1, 2, 1]
+0 1 2 3
+After: [3, 1, 2, 0]
+
+Before: [0, 1, 2, 3]
+12 1 0 0
+After: [1, 1, 2, 3]
+
+Before: [2, 3, 3, 3]
+11 0 2 3
+After: [2, 3, 3, 1]
+
+Before: [0, 2, 0, 3]
+7 0 0 3
+After: [0, 2, 0, 0]
+
+Before: [1, 1, 3, 2]
+1 1 3 3
+After: [1, 1, 3, 0]
+
+Before: [3, 2, 3, 3]
+5 3 2 1
+After: [3, 1, 3, 3]
+
+Before: [1, 0, 2, 3]
+13 3 3 1
+After: [1, 3, 2, 3]
+
+Before: [2, 1, 3, 0]
+15 1 3 3
+After: [2, 1, 3, 1]
+
+Before: [2, 0, 2, 3]
+6 2 3 2
+After: [2, 0, 0, 3]
+
+Before: [2, 1, 1, 3]
+6 1 3 0
+After: [0, 1, 1, 3]
+
+Before: [0, 0, 2, 1]
+2 3 1 2
+After: [0, 0, 1, 1]
+
+Before: [1, 0, 1, 0]
+2 0 1 3
+After: [1, 0, 1, 1]
+
+Before: [2, 1, 1, 3]
+13 3 3 2
+After: [2, 1, 3, 3]
+
+Before: [0, 2, 1, 0]
+7 0 0 2
+After: [0, 2, 0, 0]
+
+Before: [1, 0, 2, 0]
+2 0 1 2
+After: [1, 0, 1, 0]
+
+Before: [0, 0, 3, 1]
+2 3 1 0
+After: [1, 0, 3, 1]
+
+Before: [2, 0, 1, 0]
+8 0 2 3
+After: [2, 0, 1, 1]
+
+Before: [3, 1, 1, 2]
+1 1 3 3
+After: [3, 1, 1, 0]
+
+Before: [0, 1, 1, 2]
+12 1 0 0
+After: [1, 1, 1, 2]
+
+Before: [1, 1, 2, 1]
+9 0 2 3
+After: [1, 1, 2, 0]
+
+Before: [0, 0, 0, 2]
+14 3 3 2
+After: [0, 0, 0, 2]
+
+Before: [3, 1, 0, 2]
+1 1 3 2
+After: [3, 1, 0, 2]
+
+Before: [0, 1, 3, 2]
+4 3 2 0
+After: [2, 1, 3, 2]
+
+Before: [1, 0, 2, 1]
+2 0 1 2
+After: [1, 0, 1, 1]
+
+Before: [1, 3, 2, 1]
+9 0 2 0
+After: [0, 3, 2, 1]
+
+Before: [0, 0, 2, 1]
+3 3 2 1
+After: [0, 1, 2, 1]
+
+Before: [2, 2, 2, 3]
+6 1 3 3
+After: [2, 2, 2, 0]
+
+Before: [3, 2, 2, 2]
+10 0 2 2
+After: [3, 2, 1, 2]
+
+Before: [1, 0, 3, 2]
+14 3 3 1
+After: [1, 0, 3, 2]
+
+Before: [2, 0, 3, 0]
+4 0 2 1
+After: [2, 2, 3, 0]
+
+Before: [2, 1, 1, 2]
+10 0 1 3
+After: [2, 1, 1, 1]
+
+Before: [2, 1, 2, 0]
+10 0 1 3
+After: [2, 1, 2, 1]
+
+Before: [2, 3, 3, 3]
+11 0 2 2
+After: [2, 3, 1, 3]
+
+Before: [2, 1, 2, 1]
+10 0 1 1
+After: [2, 1, 2, 1]
+
+Before: [2, 2, 3, 3]
+4 1 2 3
+After: [2, 2, 3, 2]
+
+Before: [3, 1, 2, 3]
+10 0 2 3
+After: [3, 1, 2, 1]
+
+Before: [1, 2, 2, 0]
+9 0 2 1
+After: [1, 0, 2, 0]
+
+Before: [1, 3, 2, 2]
+9 0 2 3
+After: [1, 3, 2, 0]
+
+Before: [1, 1, 2, 3]
+5 3 2 2
+After: [1, 1, 0, 3]
+
+Before: [1, 0, 3, 0]
+2 0 1 1
+After: [1, 1, 3, 0]
+
+Before: [1, 1, 1, 0]
+15 1 3 0
+After: [1, 1, 1, 0]
+
+Before: [0, 2, 3, 3]
+4 1 2 2
+After: [0, 2, 2, 3]
+
+Before: [2, 1, 3, 2]
+5 2 1 2
+After: [2, 1, 0, 2]
+
+Before: [2, 1, 2, 0]
+0 1 2 1
+After: [2, 0, 2, 0]
+
+Before: [1, 1, 3, 2]
+1 1 3 0
+After: [0, 1, 3, 2]
+
+Before: [3, 3, 2, 1]
+10 0 2 2
+After: [3, 3, 1, 1]
+
+Before: [0, 1, 2, 1]
+3 3 2 2
+After: [0, 1, 1, 1]
+
+Before: [0, 1, 3, 3]
+7 0 0 0
+After: [0, 1, 3, 3]
+
+Before: [2, 0, 2, 1]
+3 3 2 1
+After: [2, 1, 2, 1]
+
+Before: [1, 1, 2, 1]
+0 1 2 1
+After: [1, 0, 2, 1]
+
+Before: [3, 0, 1, 2]
+8 0 3 1
+After: [3, 1, 1, 2]
+
+Before: [1, 0, 2, 2]
+2 0 1 2
+After: [1, 0, 1, 2]
+
+Before: [3, 1, 2, 3]
+6 2 3 1
+After: [3, 0, 2, 3]
+
+Before: [0, 0, 2, 1]
+2 3 1 0
+After: [1, 0, 2, 1]
+
+Before: [0, 1, 0, 3]
+12 1 0 3
+After: [0, 1, 0, 1]
+
+Before: [2, 1, 1, 3]
+5 3 2 3
+After: [2, 1, 1, 0]
+
+Before: [2, 0, 3, 2]
+14 3 3 1
+After: [2, 0, 3, 2]
+
+Before: [1, 2, 2, 2]
+9 0 2 1
+After: [1, 0, 2, 2]
+
+Before: [0, 1, 1, 1]
+12 1 0 0
+After: [1, 1, 1, 1]
+
+Before: [0, 2, 0, 1]
+7 0 0 2
+After: [0, 2, 0, 1]
+
+Before: [2, 2, 1, 2]
+8 0 2 3
+After: [2, 2, 1, 1]
+
+Before: [1, 0, 1, 1]
+2 0 1 3
+After: [1, 0, 1, 1]
+
+Before: [2, 1, 1, 2]
+10 0 1 2
+After: [2, 1, 1, 2]
+
+Before: [2, 1, 1, 1]
+8 0 2 2
+After: [2, 1, 1, 1]
+
+Before: [3, 3, 2, 2]
+10 0 2 2
+After: [3, 3, 1, 2]
+
+Before: [2, 3, 2, 0]
+13 2 2 1
+After: [2, 2, 2, 0]
+
+Before: [1, 0, 2, 3]
+2 0 1 2
+After: [1, 0, 1, 3]
+
+Before: [2, 1, 3, 3]
+4 0 2 0
+After: [2, 1, 3, 3]
+
+Before: [1, 2, 2, 0]
+5 2 1 2
+After: [1, 2, 1, 0]
+
+Before: [0, 1, 0, 2]
+12 1 0 1
+After: [0, 1, 0, 2]
+
+Before: [3, 1, 1, 2]
+8 0 3 0
+After: [1, 1, 1, 2]
+
+Before: [0, 1, 3, 0]
+15 1 3 0
+After: [1, 1, 3, 0]
+
+Before: [2, 1, 3, 2]
+4 3 2 2
+After: [2, 1, 2, 2]
+
+Before: [3, 1, 0, 2]
+8 0 3 3
+After: [3, 1, 0, 1]
+
+Before: [2, 3, 3, 3]
+11 0 2 0
+After: [1, 3, 3, 3]
+
+Before: [0, 1, 1, 3]
+6 2 3 2
+After: [0, 1, 0, 3]
+
+Before: [2, 3, 3, 1]
+11 0 2 2
+After: [2, 3, 1, 1]
+
+Before: [3, 1, 1, 2]
+8 0 3 2
+After: [3, 1, 1, 2]
+
+Before: [1, 2, 2, 3]
+9 0 2 0
+After: [0, 2, 2, 3]
+
+Before: [1, 1, 0, 2]
+1 1 3 0
+After: [0, 1, 0, 2]
+
+Before: [1, 1, 0, 2]
+1 1 3 3
+After: [1, 1, 0, 0]
+
+Before: [0, 1, 2, 3]
+12 1 0 3
+After: [0, 1, 2, 1]
+
+Before: [3, 0, 1, 2]
+8 0 3 3
+After: [3, 0, 1, 1]
+
+Before: [2, 1, 2, 3]
+0 1 2 1
+After: [2, 0, 2, 3]
+
+Before: [3, 0, 0, 0]
+11 2 0 3
+After: [3, 0, 0, 1]
+
+Before: [3, 2, 2, 2]
+8 0 3 3
+After: [3, 2, 2, 1]
+
+Before: [1, 1, 3, 3]
+6 1 3 1
+After: [1, 0, 3, 3]
+
+Before: [3, 1, 0, 1]
+11 2 0 0
+After: [1, 1, 0, 1]
+
+Before: [1, 1, 1, 0]
+15 1 3 3
+After: [1, 1, 1, 1]
+
+Before: [2, 2, 3, 2]
+4 0 2 3
+After: [2, 2, 3, 2]
+
+Before: [2, 2, 3, 2]
+11 0 2 1
+After: [2, 1, 3, 2]
+
+Before: [0, 0, 1, 1]
+7 0 0 0
+After: [0, 0, 1, 1]
+
+Before: [0, 3, 1, 3]
+7 0 0 1
+After: [0, 0, 1, 3]
+
+Before: [2, 1, 3, 1]
+10 0 1 0
+After: [1, 1, 3, 1]
+
+Before: [3, 1, 2, 2]
+0 1 2 2
+After: [3, 1, 0, 2]
+
+Before: [1, 0, 3, 2]
+2 0 1 0
+After: [1, 0, 3, 2]
+
+Before: [3, 0, 3, 1]
+2 3 1 1
+After: [3, 1, 3, 1]
+
+Before: [3, 1, 2, 1]
+3 3 2 0
+After: [1, 1, 2, 1]
+
+Before: [3, 1, 2, 1]
+10 0 2 0
+After: [1, 1, 2, 1]
+
+Before: [3, 3, 2, 1]
+3 3 2 1
+After: [3, 1, 2, 1]
+
+Before: [0, 1, 0, 2]
+1 1 3 0
+After: [0, 1, 0, 2]
+
+Before: [2, 1, 3, 1]
+11 0 2 1
+After: [2, 1, 3, 1]
+
+Before: [2, 3, 1, 1]
+8 0 2 3
+After: [2, 3, 1, 1]
+
+Before: [2, 2, 2, 1]
+5 2 2 1
+After: [2, 1, 2, 1]
+
+Before: [3, 0, 1, 1]
+2 3 1 2
+After: [3, 0, 1, 1]
+
+Before: [2, 2, 2, 1]
+14 3 3 0
+After: [0, 2, 2, 1]
+
+Before: [2, 3, 3, 2]
+4 0 2 0
+After: [2, 3, 3, 2]
+
+Before: [2, 2, 3, 1]
+11 0 2 2
+After: [2, 2, 1, 1]
+
+Before: [0, 1, 1, 1]
+7 0 0 3
+After: [0, 1, 1, 0]
+
+Before: [3, 3, 0, 1]
+11 2 0 2
+After: [3, 3, 1, 1]
+
+Before: [2, 2, 3, 3]
+4 0 2 2
+After: [2, 2, 2, 3]
+
+Before: [2, 2, 3, 0]
+4 0 2 3
+After: [2, 2, 3, 2]
+
+Before: [1, 1, 2, 1]
+0 1 2 3
+After: [1, 1, 2, 0]
+
+Before: [2, 1, 0, 2]
+10 0 1 1
+After: [2, 1, 0, 2]
+
+Before: [1, 3, 2, 0]
+9 0 2 0
+After: [0, 3, 2, 0]
+
+Before: [3, 2, 0, 2]
+11 2 0 2
+After: [3, 2, 1, 2]
+
+Before: [0, 1, 1, 2]
+1 1 3 3
+After: [0, 1, 1, 0]
+
+Before: [1, 1, 3, 2]
+1 1 3 1
+After: [1, 0, 3, 2]
+
+Before: [0, 2, 2, 1]
+3 3 2 2
+After: [0, 2, 1, 1]
+
+Before: [2, 1, 1, 3]
+10 0 1 2
+After: [2, 1, 1, 3]
+
+Before: [0, 1, 1, 3]
+7 0 0 2
+After: [0, 1, 0, 3]
+
+Before: [3, 1, 2, 1]
+5 2 2 0
+After: [1, 1, 2, 1]
+
+Before: [1, 1, 2, 0]
+15 1 3 2
+After: [1, 1, 1, 0]
+
+Before: [0, 1, 2, 2]
+0 1 2 2
+After: [0, 1, 0, 2]
+
+Before: [2, 0, 1, 1]
+2 2 1 2
+After: [2, 0, 1, 1]
+
+Before: [1, 1, 2, 2]
+1 1 3 1
+After: [1, 0, 2, 2]
+
+Before: [3, 1, 2, 0]
+10 0 2 2
+After: [3, 1, 1, 0]
+
+Before: [3, 2, 0, 3]
+11 2 0 2
+After: [3, 2, 1, 3]
+
+
+
+9 1 1 1
+9 1 1 2
+9 3 3 3
+0 3 2 1
+2 1 3 1
+15 0 1 0
+3 0 3 1
+9 2 0 3
+9 3 0 0
+9 2 3 2
+4 2 3 2
+2 2 1 2
+2 2 2 2
+15 2 1 1
+3 1 1 3
+9 1 2 0
+9 3 1 1
+9 2 0 2
+3 0 2 0
+2 0 3 0
+15 3 0 3
+3 3 1 1
+9 3 0 2
+9 2 3 3
+9 2 0 0
+11 0 2 2
+2 2 3 2
+2 2 1 2
+15 1 2 1
+2 3 0 2
+12 2 0 2
+5 0 3 2
+2 2 1 2
+2 2 2 2
+15 1 2 1
+9 1 2 2
+9 3 1 3
+9 3 2 0
+0 3 2 2
+2 2 3 2
+15 2 1 1
+3 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0
+9 1 0 2
+9 2 0 3
+2 3 2 3
+2 3 1 3
+15 1 3 1
+3 1 1 3
+9 3 1 1
+9 2 0 0
+9 3 0 2
+13 0 2 0
+2 0 1 0
+15 0 3 3
+3 3 3 2
+9 1 0 0
+9 2 1 3
+7 0 3 0
+2 0 1 0
+2 0 1 0
+15 0 2 2
+3 2 0 0
+9 0 2 3
+9 2 2 2
+6 3 2 2
+2 2 1 2
+15 0 2 0
+3 0 1 1
+9 3 1 0
+2 1 0 2
+12 2 1 2
+9 3 0 3
+9 2 3 0
+2 0 3 0
+15 0 1 1
+3 1 3 3
+9 3 1 0
+9 3 3 2
+9 3 1 1
+0 1 2 2
+2 2 2 2
+15 3 2 3
+3 3 2 1
+9 2 0 2
+9 2 1 3
+1 0 3 0
+2 0 3 0
+15 0 1 1
+3 1 2 2
+9 2 0 1
+2 1 0 0
+12 0 1 0
+7 0 3 0
+2 0 1 0
+15 0 2 2
+3 2 0 1
+9 2 2 0
+9 3 1 2
+2 3 0 3
+12 3 1 3
+7 3 0 0
+2 0 1 0
+15 1 0 1
+9 3 2 0
+9 1 2 2
+0 0 2 2
+2 2 3 2
+15 2 1 1
+3 1 0 3
+9 0 1 2
+2 1 0 1
+12 1 0 1
+0 0 2 0
+2 0 3 0
+15 3 0 3
+3 3 0 0
+9 2 1 1
+9 3 0 2
+9 2 2 3
+4 1 3 2
+2 2 1 2
+2 2 1 2
+15 2 0 0
--- /dev/null
+<!DOCTYPE html>
+<html lang="en-us">
+<head>
+<meta charset="utf-8"/>
+<title>Day 15 - Advent of Code 2018</title>
+<!--[if lt IE 9]><script src="/static/html5.js"></script><![endif]-->
+<link href='//fonts.googleapis.com/css?family=Source+Code+Pro:300&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
+<link rel="stylesheet" type="text/css" href="/static/style.css?18"/>
+<link rel="stylesheet alternate" type="text/css" href="/static/highcontrast.css?0" title="High Contrast"/>
+<link rel="shortcut icon" href="/favicon.png"/>
+</head><!--
+
+
+
+
+Oh, hello! Funny seeing you here.
+
+I appreciate your enthusiasm, but you aren't going to find much down here.
+There certainly aren't clues to any of the puzzles. The best surprises don't
+even appear in the source until you unlock them for real.
+
+Please be careful with automated requests; I'm not Google, and I can only take
+so much traffic. Please be considerate so that everyone gets to play.
+
+If you're curious about how Advent of Code works, it's running on some custom
+Perl code. Other than a few integrations (auth, analytics, ads, social media),
+I built the whole thing myself, including the design, animations, prose, and
+all of the puzzles.
+
+The puzzles are most of the work; the easiest ones take 3-4 hours each, but the
+harder ones take 6-8 hours, and a few even longer than that. A lot of effort
+went into building this thing - I hope you're enjoying playing it as much as I
+enjoyed making it for you!
+
+If you'd like to hang out, I'm @ericwastl on Twitter.
+
+- Eric Wastl
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-->
+<body>
+<header><div><h1 class="title-global"><a href="/">Advent of Code</a></h1><nav><ul><li><a href="/2018/about">[About]</a></li><li><a href="/2018/events">[Events]</a></li><li><a href="https://teespring.com/adventofcode" target="_blank">[Shop]</a></li><li><a href="/2018/settings">[Settings]</a></li><li><a href="/2018/auth/logout">[Log Out]</a></li></ul></nav><div class="user">Neil Smith <a href="/2018/support" class="supporter-badge" title="Advent of Code Supporter">(AoC++)</a> <span class="star-count">30*</span></div></div><div><h1 class="title-event"> <span class="title-event-wrap"></span><a href="/2018">2018</a><span class="title-event-wrap"></span></h1><nav><ul><li><a href="/2018">[Calendar]</a></li><li><a href="/2018/support">[AoC++]</a></li><li><a href="/2018/sponsors">[Sponsors]</a></li><li><a href="/2018/leaderboard">[Leaderboard]</a></li><li><a href="/2018/stats">[Stats]</a></li></ul></nav></div></header>
+
+<div id="sidebar">
+<div id="sponsor"><div class="quiet">Our <a href="/2018/sponsors">sponsors</a> help make Advent of Code possible:</div><div class="sponsor"><a href="https://xebia.com/community/advent-of-code" target="_blank" onclick="if(ga)ga('send','event','sponsor','click',this.href);" rel="noopener">Xebia</a> - an international network of passionate technologists and craftspeople, dedicated to exploring and creating new frontiers in IT</div></div>
+</div><!--/sidebar-->
+
+<main>
+<article class="day-desc"><h2>--- Day 15: Beverage Bandits ---</h2><p>Having perfected their hot chocolate, the Elves have a new problem: the <a href="https://en.wikipedia.org/wiki/Goblin">Goblins</a> that live in these caves will do anything to steal it. Looks like they're here for a fight.</p>
+<p>You scan the area, generating a map of the walls (<code>#</code>), open cavern (<code>.</code>), and starting position of every Goblin (<code>G</code>) and Elf (<code>E</code>) (your puzzle input).</p>
+<p>Combat proceeds in <em>rounds</em>; in each round, each unit that is still alive takes a <em>turn</em>, resolving all of its actions before the next unit's turn begins. On each unit's turn, it tries to <em>move</em> into range of an enemy (if it isn't already) and then <em>attack</em> (if it is in range).</p>
+<p>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 <em>reading order</em>: top-to-bottom, then left-to-right. For instance, the order in which units take their turns within a round is the <em>reading order of their starting positions</em> in that round, regardless of the type of unit or whether other units have moved after the round started. For example:</p>
+<pre><code> would take their
+These units: turns in this order:
+ ####### #######
+ #.G.E.# #.1.2.#
+ #E.G.E# #3.4.5#
+ #.G.E.# #.6.7.#
+ ####### #######
+</code></pre>
+<p>Each unit begins its turn by identifying all possible <em>targets</em> (enemy units). If no targets remain, combat ends.</p>
+<p>Then, the unit identifies all of the open squares (<code>.</code>) that are <em>in range</em> of each target; these are the squares which are <em>adjacent</em> (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 <em>already</em> 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.</p>
+<p>If the unit is already in range of a target, it does not <em>move</em>, but continues its turn with an <em>attack</em>. Otherwise, since it is not in range of a target, it <em>moves</em>.</p>
+<p>To <em>move</em>, the unit first considers the squares that are <em>in range</em> and determines <em>which of those squares it could reach in the fewest steps</em>. A <em>step</em> is a single movement to any <em>adjacent</em> (immediately up, down, left, or right) open (<code>.</code>) square. Units cannot move into walls or other units. The unit does this while considering the <em>current positions of units</em> and does <em>not</em> 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 <em>tied</em> for being reachable in the fewest steps, the square which is first in <em>reading order</em> is chosen. For example:</p>
+<pre><code>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#
+####### ####### ####### ####### #######
+</code></pre>
+<p>In the above scenario, the Elf has three targets (the three Goblins):</p>
+<ul>
+<li>Each of the Goblins has open, adjacent squares which are <em>in range</em> (marked with a <code>?</code> on the map).</li>
+<li>Of those squares, four are <em>reachable</em> (marked <code>@</code>); the other two (on the right) would require moving through a wall or unit to reach.</li>
+<li>Three of these reachable squares are <em>nearest</em>, requiring the fewest steps (only <code>2</code>) to reach (marked <code>!</code>).</li>
+<li>Of those, the square which is first in reading order is <em>chosen</em> (<code>+</code>).</li>
+</ul>
+<p>The unit then takes a single <em>step</em> toward the chosen square along the <em>shortest path</em> 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 <em>more than one shortest path</em> so that you can consider the first step of each such path.) For example:</p>
+<pre><code>In range: Nearest: Chosen: Distance: Step:
+####### ####### ####### ####### #######
+#.E...# #.E...# #.E...# #4E<em>2</em>12# #..E..#
+#...?.# --> #...!.# --> #...+.# --> #3<em>2</em>101# --> #.....#
+#..?G?# #..!G.# #...G.# #432G2# #...G.#
+####### ####### ####### ####### #######
+</code></pre>
+<p>The Elf sees three squares in range of a target (<code>?</code>), two of which are nearest (<code>!</code>), and so the first in reading order is chosen (<code>+</code>). 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 <code>2</code> steps from being in range of the Goblin. Because the step which is first in reading order is chosen, the Elf moves <em>right</em> one square.</p>
+<p>Here's a larger example of movement:</p>
+<pre><code>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#
+#.......#
+#.......#
+#########
+</code></pre>
+<p>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.</p>
+<p>After moving (or if the unit began its turn in range of a target), the unit <em>attacks</em>.</p>
+<p>To <em>attack</em>, the unit first determines <em>all</em> of the targets that are <em>in range</em> of it by being immediately <em>adjacent</em> to it. If there are no such targets, the unit ends its turn. Otherwise, the adjacent target with the <em>fewest hit points</em> is selected; in a tie, the adjacent target with the fewest hit points which is first in reading order is selected.</p>
+<p>The unit deals damage equal to its <em>attack power</em> to the selected target, reducing its hit points by that amount. If this reduces its hit points to <code>0</code> or fewer, the selected target <em>dies</em>: its square becomes <code>.</code> and it takes no further turns.</p>
+<p>Each <em>unit</em>, either Goblin or Elf, has <code>3</code> <em>attack power</em> and starts with <code>200</code> <em>hit points</em>.</p>
+<p>For example, suppose the only Elf is about to attack:</p>
+<pre><code> HP: HP:
+G.... 9 G.... 9
+..G.. 4 ..G.. 4
+..E<em>G</em>. 2 --> ..E..
+..G.. 2 ..G.. 2
+...G. 1 ...G. 1
+</code></pre>
+<p>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 <code>4</code> hit points), the Goblin to its right (with <code>2</code> hit points), and the Goblin below it (also with <code>2</code> hit points). Because three targets are in range, the ones with the lowest hit points are selected: the two Goblins with <code>2</code> 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 (<code>2</code>) are reduced by the Elf's attack power (<code>3</code>), reducing its hit points to <code>-1</code>, killing it.</p>
+<p>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.</p>
+<p>The Elves look quite outnumbered. You need to determine the <em>outcome</em> of the battle: the <em>number of full rounds that were completed</em> (not counting the round in which combat ends) multiplied by <em>the sum of the hit points of all remaining units</em> at the moment combat ends. (Combat only ends when a unit finds no targets during its turn.)</p>
+<p>Below is an entire sample combat. Next to each map, each row's units' hit points are listed from left to right.</p>
+<pre><code>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)
+#######
+</code></pre>
+<p>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 <em>full rounds</em> that were completed is <code><em>47</em></code>, and the sum of the hit points of all remaining units is <code>200+131+59+200 = <em>590</em></code>. From these, the <em>outcome</em> of the battle is <code>47 * 590 = <em>27730</em></code>.</p>
+<p>Here are a few example summarized combats:</p>
+<pre><code>####### #######
+#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 = <em>36334</em>
+</code></pre>
+<pre><code>####### #######
+#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 = <em>39514</em>
+</code></pre>
+<pre><code>####### #######
+#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 = <em>27755</em>
+</code></pre>
+<pre><code>####### #######
+#.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 = <em>28944</em>
+</code></pre>
+<pre><code>######### #########
+#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 = <em>18740</em>
+</code></pre>
+<p><em>What is the outcome</em> of the combat described in your puzzle input?</p>
+</article>
+<p>Your puzzle answer was <code>196200</code>.</p><article class="day-desc"><h2 id="part2">--- Part Two ---</h2><p>According to your calculations, the Elves are going to lose badly. Surely, you won't mess up the timeline too much if you give them <span title="See also: the plot of every Civilization game.">just a little advanced technology</span>, right?</p>
+<p>You need to make sure the Elves not only <em>win</em>, but also suffer <em>no losses</em>: even the death of a single Elf is unacceptable.</p>
+<p>However, you can't go too far: larger changes will be more likely to permanently alter spacetime.</p>
+<p>So, you need to <em>find the outcome</em> of the battle in which the Elves have the <em>lowest integer attack power</em> (at least <code>4</code>) that allows them to <em>win without a single death</em>. The Goblins always have an attack power of <code>3</code>.</p>
+<p>In the first summarized example above, the lowest attack power the Elves need to win without losses is <code>15</code>:</p>
+<pre><code>####### #######
+#.G...# #..E..# E(158)
+#...EG# #...E.# E(14)
+#.#.#G# --> #.#.#.#
+#..G#E# #...#.#
+#.....# #.....#
+####### #######
+
+Combat ends after 29 full rounds
+Elves win with 172 total hit points left
+Outcome: 29 * 172 = <em>4988</em>
+</code></pre>
+<p>In the second example above, the Elves need only <code>4</code> attack power:</p>
+<pre><code>####### #######
+#E..EG# #.E.E.# E(200), E(23)
+#.#G.E# #.#E..# E(200)
+#E.##E# --> #E.##E# E(125), E(200)
+#G..#.# #.E.#.# E(200)
+#..E#.# #...#.#
+####### #######
+
+Combat ends after 33 full rounds
+Elves win with 948 total hit points left
+Outcome: 33 * 948 = <em>31284</em>
+</code></pre>
+<p>In the third example above, the Elves need <code>15</code> attack power:</p>
+<pre><code>####### #######
+#E.G#.# #.E.#.# E(8)
+#.#G..# #.#E..# E(86)
+#G.#.G# --> #..#..#
+#G..#.# #...#.#
+#...E.# #.....#
+####### #######
+
+Combat ends after 37 full rounds
+Elves win with 94 total hit points left
+Outcome: 37 * 94 = <em>3478</em>
+</code></pre>
+<p>In the fourth example above, the Elves need <code>12</code> attack power:</p>
+<pre><code>####### #######
+#.E...# #...E.# E(14)
+#.#..G# #.#..E# E(152)
+#.###.# --> #.###.#
+#E#G#G# #.#.#.#
+#...#G# #...#.#
+####### #######
+
+Combat ends after 39 full rounds
+Elves win with 166 total hit points left
+Outcome: 39 * 166 = <em>6474</em>
+</code></pre>
+<p>In the last example above, the lone Elf needs <code>34</code> attack power:</p>
+<pre><code>######### #########
+#G......# #.......#
+#.E.#...# #.E.#...# E(38)
+#..##..G# #..##...#
+#...##..# --> #...##..#
+#...#...# #...#...#
+#.G...G.# #.......#
+#.....G.# #.......#
+######### #########
+
+Combat ends after 30 full rounds
+Elves win with 38 total hit points left
+Outcome: 30 * 38 = <em>1140</em>
+</code></pre>
+<p>After increasing the Elves' attack power until it is just barely enough for them to win without any Elves dying, <em>what is the outcome</em> of the combat described in your puzzle input?</p>
+</article>
+<p>Your puzzle answer was <code>61750</code>.</p><p class="day-success">Both parts of this puzzle are complete! They provide two gold stars: **</p>
+<p>At this point, you should <a href="/2018">return to your advent calendar</a> and try another puzzle.</p>
+<p>If you still want to see it, you can <a href="15/input" target="_blank">get your puzzle input</a>.</p>
+<p>You can also <span class="share">[Share<span class="share-content">on
+ <a href="https://twitter.com/intent/tweet?text=I%27ve+completed+%22Beverage+Bandits%22+%2D+Day+15+%2D+Advent+of+Code+2018&url=https%3A%2F%2Fadventofcode%2Ecom%2F2018%2Fday%2F15&related=ericwastl&hashtags=AdventOfCode" target="_blank">Twitter</a>
+ <a href="http://www.reddit.com/submit?url=https%3A%2F%2Fadventofcode%2Ecom%2F2018%2Fday%2F15&title=I%27ve+completed+%22Beverage+Bandits%22+%2D+Day+15+%2D+Advent+of+Code+2018" target="_blank">Reddit</a
+></span>]</span> this puzzle.</p>
+</main>
+
+<!-- ga -->
+<script>
+(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+ga('create', 'UA-69522494-1', 'auto');
+ga('send', 'pageview');
+</script>
+<!-- /ga -->
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<html lang="en-us">
+<head>
+<meta charset="utf-8"/>
+<title>Day 16 - Advent of Code 2018</title>
+<!--[if lt IE 9]><script src="/static/html5.js"></script><![endif]-->
+<link href='//fonts.googleapis.com/css?family=Source+Code+Pro:300&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
+<link rel="stylesheet" type="text/css" href="/static/style.css?18"/>
+<link rel="stylesheet alternate" type="text/css" href="/static/highcontrast.css?0" title="High Contrast"/>
+<link rel="shortcut icon" href="/favicon.png"/>
+</head><!--
+
+
+
+
+Oh, hello! Funny seeing you here.
+
+I appreciate your enthusiasm, but you aren't going to find much down here.
+There certainly aren't clues to any of the puzzles. The best surprises don't
+even appear in the source until you unlock them for real.
+
+Please be careful with automated requests; I'm not Google, and I can only take
+so much traffic. Please be considerate so that everyone gets to play.
+
+If you're curious about how Advent of Code works, it's running on some custom
+Perl code. Other than a few integrations (auth, analytics, ads, social media),
+I built the whole thing myself, including the design, animations, prose, and
+all of the puzzles.
+
+The puzzles are most of the work; the easiest ones take 3-4 hours each, but the
+harder ones take 6-8 hours, and a few even longer than that. A lot of effort
+went into building this thing - I hope you're enjoying playing it as much as I
+enjoyed making it for you!
+
+If you'd like to hang out, I'm @ericwastl on Twitter.
+
+- Eric Wastl
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-->
+<body>
+<header><div><h1 class="title-global"><a href="/">Advent of Code</a></h1><nav><ul><li><a href="/2018/about">[About]</a></li><li><a href="/2018/events">[Events]</a></li><li><a href="https://teespring.com/adventofcode" target="_blank">[Shop]</a></li><li><a href="/2018/settings">[Settings]</a></li><li><a href="/2018/auth/logout">[Log Out]</a></li></ul></nav><div class="user">Neil Smith <a href="/2018/support" class="supporter-badge" title="Advent of Code Supporter">(AoC++)</a> <span class="star-count">32*</span></div></div><div><h1 class="title-event"> <span class="title-event-wrap">0xffff&</span><a href="/2018">2018</a><span class="title-event-wrap"></span></h1><nav><ul><li><a href="/2018">[Calendar]</a></li><li><a href="/2018/support">[AoC++]</a></li><li><a href="/2018/sponsors">[Sponsors]</a></li><li><a href="/2018/leaderboard">[Leaderboard]</a></li><li><a href="/2018/stats">[Stats]</a></li></ul></nav></div></header>
+
+<div id="sidebar">
+<div id="sponsor"><div class="quiet">Our <a href="/2018/sponsors">sponsors</a> help make Advent of Code possible:</div><div class="sponsor"><a href="https://formlabs.com/jobs/" target="_blank" onclick="if(ga)ga('send','event','sponsor','click',this.href);" rel="noopener">Formlabs</a> - 3D printing with lasers. Software, hardware, and more. Pew pew!</div></div>
+</div><!--/sidebar-->
+
+<main>
+<article class="day-desc"><h2>--- Day 16: Chronal Classification ---</h2><p>As you see the Elves defend their hot chocolate successfully, you go back to falling through time. This is going to become a problem.</p>
+<p>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.</p>
+<p>According to the manual, the device has four <a href="https://en.wikipedia.org/wiki/Hardware_register">registers</a> (numbered <code>0</code> through <code>3</code>) that can be manipulated by <a href="https://en.wikipedia.org/wiki/Instruction_set_architecture#Instructions">instructions</a> containing one of 16 opcodes. The registers start with the value <code>0</code>.</p>
+<p>Every instruction consists of four values: an <em>opcode</em>, two <em>inputs</em> (named <code>A</code> and <code>B</code>), and an <em>output</em> (named <code>C</code>), in that order. The opcode specifies the behavior of the instruction and how the inputs are interpreted. The output, <code>C</code>, is always treated as a register.</p>
+<p>In the opcode descriptions below, if something says "<em>value <code>A</code></em>", it means to take the number given as <code>A</code> <em>literally</em>. (This is also called an "immediate" value.) If something says "<em>register <code>A</code></em>", it means to use the number given as <code>A</code> to read from (or write to) the <em>register with that number</em>. So, if the opcode <code>addi</code> adds register <code>A</code> and value <code>B</code>, storing the result in register <code>C</code>, and the instruction <code>addi 0 7 3</code> is encountered, it would add <code>7</code> to the value contained by register <code>0</code> and store the sum in register <code>3</code>, never modifying registers <code>0</code>, <code>1</code>, or <code>2</code> in the process.</p>
+<p>Many opcodes are similar except for how they interpret their arguments. The opcodes fall into seven general categories:</p>
+<p>Addition:</p>
+<ul>
+<li><code>addr</code> (add register) stores into register <code>C</code> the result of adding register <code>A</code> and register <code>B</code>.</li>
+<li><code>addi</code> (add immediate) stores into register <code>C</code> the result of adding register <code>A</code> and value <code>B</code>.</li>
+</ul>
+<p>Multiplication:</p>
+<ul>
+<li><code>mulr</code> (multiply register) stores into register <code>C</code> the result of multiplying register <code>A</code> and register <code>B</code>.</li>
+<li><code>muli</code> (multiply immediate) stores into register <code>C</code> the result of multiplying register <code>A</code> and value <code>B</code>.</li>
+</ul>
+<p><a href="https://en.wikipedia.org/wiki/Bitwise_AND">Bitwise AND</a>:</p>
+<ul>
+<li><code>banr</code> (bitwise AND register) stores into register <code>C</code> the result of the bitwise AND of register <code>A</code> and register <code>B</code>.</li>
+<li><code>bani</code> (bitwise AND immediate) stores into register <code>C</code> the result of the bitwise AND of register <code>A</code> and value <code>B</code>.</li>
+</ul>
+<p><a href="https://en.wikipedia.org/wiki/Bitwise_OR">Bitwise OR</a>:</p>
+<ul>
+<li><code>borr</code> (bitwise OR register) stores into register <code>C</code> the result of the bitwise OR of register <code>A</code> and register <code>B</code>.</li>
+<li><code>bori</code> (bitwise OR immediate) stores into register <code>C</code> the result of the bitwise OR of register <code>A</code> and value <code>B</code>.</li>
+</ul>
+<p>Assignment:</p>
+<ul>
+<li><code>setr</code> (set register) copies the contents of register <code>A</code> into register <code>C</code>. (Input <code>B</code> is ignored.)</li>
+<li><code>seti</code> (set immediate) stores value <code>A</code> into register <code>C</code>. (Input <code>B</code> is ignored.)</li>
+</ul>
+<p>Greater-than testing:</p>
+<ul>
+<li><code>gtir</code> (greater-than immediate/register) sets register <code>C</code> to <code>1</code> if value <code>A</code> is greater than register <code>B</code>. Otherwise, register <code>C</code> is set to <code>0</code>.</li>
+<li><code>gtri</code> (greater-than register/immediate) sets register <code>C</code> to <code>1</code> if register <code>A</code> is greater than value <code>B</code>. Otherwise, register <code>C</code> is set to <code>0</code>.</li>
+<li><code>gtrr</code> (greater-than register/register) sets register <code>C</code> to <code>1</code> if register <code>A</code> is greater than register <code>B</code>. Otherwise, register <code>C</code> is set to <code>0</code>.</li>
+</ul>
+<p>Equality testing:</p>
+<ul>
+<li><code>eqir</code> (equal immediate/register) sets register <code>C</code> to <code>1</code> if value <code>A</code> is equal to register <code>B</code>. Otherwise, register <code>C</code> is set to <code>0</code>.</li>
+<li><code>eqri</code> (equal register/immediate) sets register <code>C</code> to <code>1</code> if register <code>A</code> is equal to value <code>B</code>. Otherwise, register <code>C</code> is set to <code>0</code>.</li>
+<li><code>eqrr</code> (equal register/register) sets register <code>C</code> to <code>1</code> if register <code>A</code> is equal to register <code>B</code>. Otherwise, register <code>C</code> is set to <code>0</code>.</li>
+</ul>
+<p>Unfortunately, while the manual gives the <em>name</em> of each opcode, it doesn't seem to indicate the <em>number</em>. 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 <code>0</code> through <code>15</code>, but the manual doesn't say which is which. For example, suppose you capture the following sample:</p>
+<pre><code>Before: [3, 2, 1, 1]
+9 2 1 2
+After: [3, 2, 2, 1]
+</code></pre>
+<p>This sample shows the effect of the instruction <code>9 2 1 2</code> on the registers. Before the instruction is executed, register <code>0</code> has value <code>3</code>, register <code>1</code> has value <code>2</code>, and registers <code>2</code> and <code>3</code> have value <code>1</code>. After the instruction is executed, register <code>2</code>'s value becomes <code>2</code>.</p>
+<p>The instruction itself, <code>9 2 1 2</code>, means that opcode <code>9</code> was executed with <code>A=2</code>, <code>B=1</code>, and <code>C=2</code>. Opcode <code>9</code> 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:</p>
+<ul>
+<li>Opcode <code>9</code> could be <code>mulr</code>: register <code>2</code> (which has a value of <code>1</code>) times register <code>1</code> (which has a value of <code>2</code>) produces <code>2</code>, which matches the value stored in the output register, register <code>2</code>.</li>
+<li>Opcode <code>9</code> could be <code>addi</code>: register <code>2</code> (which has a value of <code>1</code>) plus value <code>1</code> produces <code>2</code>, which matches the value stored in the output register, register <code>2</code>.</li>
+<li>Opcode <code>9</code> could be <code>seti</code>: value <code>2</code> matches the value stored in the output register, register <code>2</code>; the number given for <code>B</code> is irrelevant.</li>
+</ul>
+<p>None of the other opcodes produce the result captured in the sample. Because of this, the sample above <em>behaves like three opcodes</em>.</p>
+<p>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 <em>ignore it for now</em>.</p>
+<p>Ignoring the opcode numbers, <em>how many samples in your puzzle input behave like three or more opcodes?</em></p>
+</article>
+<p>Your puzzle answer was <code>580</code>.</p><article class="day-desc"><h2 id="part2">--- Part Two ---</h2><p>Using the samples you collected, <span title="This is one of my favorite puzzles.">work out the number of each opcode</span> and execute the test program (the second section of your puzzle input).</p>
+<p><em>What value is contained in register <code>0</code> after executing the test program?</em></p>
+</article>
+<p>Your puzzle answer was <code>537</code>.</p><p class="day-success">Both parts of this puzzle are complete! They provide two gold stars: **</p>
+<p>At this point, you should <a href="/2018">return to your advent calendar</a> and try another puzzle.</p>
+<p>If you still want to see it, you can <a href="16/input" target="_blank">get your puzzle input</a>.</p>
+<p>You can also <span class="share">[Share<span class="share-content">on
+ <a href="https://twitter.com/intent/tweet?text=I%27ve+completed+%22Chronal+Classification%22+%2D+Day+16+%2D+Advent+of+Code+2018&url=https%3A%2F%2Fadventofcode%2Ecom%2F2018%2Fday%2F16&related=ericwastl&hashtags=AdventOfCode" target="_blank">Twitter</a>
+ <a href="http://www.reddit.com/submit?url=https%3A%2F%2Fadventofcode%2Ecom%2F2018%2Fday%2F16&title=I%27ve+completed+%22Chronal+Classification%22+%2D+Day+16+%2D+Advent+of+Code+2018" target="_blank">Reddit</a
+></span>]</span> this puzzle.</p>
+</main>
+
+<!-- ga -->
+<script>
+(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+ga('create', 'UA-69522494-1', 'auto');
+ga('send', 'pageview');
+</script>
+<!-- /ga -->
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+{-# LANGUAGE OverloadedStrings #-}
+
+import Data.Text (Text)
+import qualified Data.Text as T
+import qualified Data.Text.IO as TIO
+
+import Data.Void (Void)
+
+import Text.Megaparsec
+import Text.Megaparsec.Char
+import qualified Text.Megaparsec.Char.Lexer as L
+import qualified Control.Applicative as CA
+
+import Data.List
+import qualified Data.Set as S
+
+import qualified Data.Map.Strict as M
+import Data.Map.Strict ((!))
+import Data.Bits ((.&.), (.|.))
+
+type Memory = M.Map Int Int
+data Operation =
+ Addr
+ | Addi
+ | Mulr
+ | Muli
+ | Banr
+ | Bani
+ | Borr
+ | Bori
+ | Setr
+ | Seti
+ | Gtir
+ | Gtri
+ | Gtrr
+ | Eqir
+ | Eqri
+ | Eqrr
+ deriving (Eq, Show, Enum, Bounded, Ord)
+data RawOperation = RawOperation {_opcode :: Int, _a :: Int, _b :: Int, _c :: Int} deriving (Eq, Show)
+data Test = Test {_preMemory :: Memory, _testOperation :: RawOperation, _postMemory :: Memory} deriving (Eq, Show)
+type Candidates = M.Map Int (S.Set Operation)
+type OpcodeAssignments = M.Map Int Operation
+
+main :: IO ()
+main = do
+ text <- TIO.readFile "data/advent16.txt"
+ let (tests, program) = successfulParse text
+ print $ part1 tests
+ print $ part2 tests program
+
+part1 :: [Test] -> Int
+part1 = length . filter (>= 3) . map S.size . map matches
+
+part2 :: [Test] -> [RawOperation] -> Int
+part2 tests program = finalMemory!0
+ where candidates = candidateOpcodes tests
+ opcodes = findOpcodes candidates
+ finalMemory = foldl' (\m op -> execute op opcodes m) (M.singleton 0 0) program
+
+
+execute :: RawOperation -> OpcodeAssignments -> Memory -> Memory
+execute op codes m = perform o (_a op) (_b op) (_c op) m
+ where o = codes!(_opcode op)
+
+perform :: Operation -> Int -> Int -> Int -> Memory -> Memory
+perform Addr a b c memory = M.insert c (memory!a + memory!b) memory
+perform Addi a b c memory = M.insert c (memory!a + b) memory
+perform Mulr a b c memory = M.insert c (memory!a * memory!b) memory
+perform Muli a b c memory = M.insert c (memory!a * b) memory
+perform Banr a b c memory = M.insert c (memory!a .&. memory!b) memory
+perform Bani a b c memory = M.insert c (memory!a .&. b) memory
+perform Borr a b c memory = M.insert c (memory!a .|. memory!b) memory
+perform Bori a b c memory = M.insert c (memory!a .|. b) memory
+perform Setr a b c memory = M.insert c (memory!a) memory
+perform Seti a b c memory = M.insert c a memory
+perform Gtir a b c memory = M.insert c (if a > (memory!b) then 1 else 0) memory
+perform Gtri a b c memory = M.insert c (if (memory!a) > b then 1 else 0) memory
+perform Gtrr a b c memory = M.insert c (if (memory!a) > (memory!b) then 1 else 0) memory
+perform Eqir a b c memory = M.insert c (if a == memory!b then 1 else 0) memory
+perform Eqri a b c memory = M.insert c (if (memory!a) == b then 1 else 0) memory
+perform Eqrr a b c memory = M.insert c (if (memory!a) == (memory!b) then 1 else 0) memory
+
+doTest :: Test -> Operation -> Bool
+doTest test operation = calculatedMemory == (_postMemory test)
+ where rawOp = _testOperation test
+ calculatedMemory = perform operation (_a rawOp) (_b rawOp) (_c rawOp) (_preMemory test)
+
+matches :: Test -> S.Set Operation
+matches test = S.fromList $ filter (doTest test) [minBound..maxBound]
+
+
+
+candidateOpcodes :: [Test] -> Candidates
+candidateOpcodes tests = foldl' restrict M.empty tests
+
+restrict :: Candidates -> Test -> Candidates
+restrict candidates test = M.insertWith S.intersection opcode possibles candidates
+ where opcode = _opcode $ _testOperation test
+ possibles = matches test
+
+findOpcodes :: Candidates -> OpcodeAssignments
+findOpcodes candidates = findOpcodes' candidates M.empty
+
+findOpcodes' :: Candidates -> OpcodeAssignments -> OpcodeAssignments
+findOpcodes' candidates assignments
+ | M.null candidates = assignments
+ | otherwise = findOpcodes' candidates'' assignments'
+ where singletons = M.map S.findMin $ M.filter (\c -> S.size c == 1) candidates
+ assignments' = assignments `M.union` singletons
+ candidates' = candidates `M.difference` singletons
+ founds = S.fromList $ M.elems assignments
+ candidates'' = M.map (\cs -> S.filter (\c -> c `S.notMember` founds) cs) candidates'
+
+
+-- allOps :: S.Set Operation
+-- allOps = S.fromList [minBound..maxBound]
+
+-- Parse the input file
+
+type Parser = Parsec Void Text
+
+sc :: Parser ()
+sc = L.space (skipSome spaceChar) CA.empty CA.empty
+
+lexeme = L.lexeme sc
+integer = lexeme L.decimal
+symb = L.symbol sc
+
+memoryP = (M.fromList . zip [0..] . map fromIntegral) <$> between (symb "[") (symb "]") (integer `sepBy` (symb ","))
+
+beforeP = symb "Before:" *> memoryP
+afterP = symb "After:" *> memoryP
+
+rawOpP = opify <$> integer <*> integer <*> integer <*> integer
+ where opify o a b c = RawOperation { _opcode = fromIntegral o
+ , _a = fromIntegral a
+ , _b = fromIntegral b
+ , _c = fromIntegral c
+ }
+
+testP = testify <$> beforeP <*> rawOpP <*> afterP
+ where testify b o a = Test {_preMemory = b, _testOperation = o, _postMemory = a}
+
+fileP = (,) <$> (many testP) <*> (many rawOpP)
+
+successfulParse :: Text -> ([Test], [RawOperation])
+successfulParse input =
+ case parse fileP "input" input of
+ Left _error -> ([], []) -- TIO.putStr $ T.pack $ parseErrorPretty err
+ Right world -> world
\ No newline at end of file