diff options
author | Leah Neukirchen <leah@vuxu.org> | 2019-11-28 17:38:10 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2019-11-28 17:38:10 +0100 |
commit | e12436c99bb04897d6344b6351d0336e4c627573 (patch) | |
tree | 74f8afb9de5d2a466e5fe6225df3661e1280519e | |
parent | 05050c3b5e20d5d475894788df6c31f867d2c51a (diff) | |
download | adventofcode2018-e12436c99bb04897d6344b6351d0336e4c627573.tar.gz adventofcode2018-e12436c99bb04897d6344b6351d0336e4c627573.tar.xz adventofcode2018-e12436c99bb04897d6344b6351d0336e4c627573.zip |
-rw-r--r-- | day05.rb | 21 | ||||
-rw-r--r-- | day07.k | 14 | ||||
-rw-r--r-- | day08.k | 3 | ||||
-rw-r--r-- | day08.rb | 43 | ||||
-rw-r--r-- | day09.rb | 54 | ||||
-rw-r--r-- | day11.k | 6 | ||||
-rw-r--r-- | day12 | 34 | ||||
-rw-r--r-- | day12.rb | 79 | ||||
-rw-r--r-- | day13 | 150 | ||||
-rw-r--r-- | day13.rb | 137 | ||||
-rw-r--r-- | day14 | 1 | ||||
-rw-r--r-- | day14.rb | 25 | ||||
-rw-r--r-- | day15.rb | 32 | ||||
-rw-r--r-- | day16 | 4014 | ||||
-rw-r--r-- | day16.rb | 92 | ||||
-rw-r--r-- | day18 | 50 | ||||
-rw-r--r-- | day18.rb | 95 | ||||
-rw-r--r-- | day19 | 37 | ||||
-rw-r--r-- | day19.rb | 86 | ||||
-rw-r--r-- | day20 | 1 | ||||
-rw-r--r-- | day20.rb | 48 | ||||
-rw-r--r-- | day21 | 32 | ||||
-rw-r--r-- | day21.rb | 67 | ||||
-rw-r--r-- | day22 | 2 | ||||
-rw-r--r-- | day22.rb | 34 | ||||
-rw-r--r-- | day23 | 1000 | ||||
-rw-r--r-- | day23.rb | 21 | ||||
-rw-r--r-- | day24 | 23 | ||||
-rw-r--r-- | day25 | 1315 | ||||
-rw-r--r-- | day25.rb | 34 |
30 files changed, 7550 insertions, 0 deletions
diff --git a/day05.rb b/day05.rb new file mode 100644 index 0000000..ce5fd2e --- /dev/null +++ b/day05.rb @@ -0,0 +1,21 @@ +t = s = File.read("day05").chomp + +v = ('a'..'z').map { |l| ["#{l}#{l.upcase}", "#{l.upcase}#{l}"] }.flatten +r = Regexp.union v + +p r + +while s.gsub!(r, '') +end + +p s.size + +# 9687 too high + +p ('a'..'z').map { |l| + s = t.delete "#{l}#{l.upcase}" + while s.gsub!(r, '') + end + p [l, s.size] + s.size +}.min diff --git a/day07.k b/day07.k new file mode 100644 index 0000000..ebb0a13 --- /dev/null +++ b/day07.k @@ -0,0 +1,14 @@ + +(1:`day07)@'/:5,36 + +/ d[;36]@=(d:1:`day07)[;5] +m: d[;5]@=(d:1:`day07)[;36] + +s: ?(,/m)^m + + + m: d[;5]@=(d:1:`day07)[;36] + m:{x@<x}'m + +s: (!m)^(,/m) + +/ wrong BDNGEVOQYHLWXPSUAMZJIKRTFC \ No newline at end of file diff --git a/day08.k b/day08.k new file mode 100644 index 0000000..4770580 --- /dev/null +++ b/day08.k @@ -0,0 +1,3 @@ +d:2 3 0 3 10 11 12 1 1 0 1 99 2 1 1 2 + +t:{} \ No newline at end of file diff --git a/day08.rb b/day08.rb new file mode 100644 index 0000000..a51543b --- /dev/null +++ b/day08.rb @@ -0,0 +1,43 @@ +d=File.read("day08").split.map(&:to_i) + +def t(d) + return 0 if d.empty? + + len = d.shift + md = d.shift + + mds = 0 + (0...len).map { + mds += t(d) + } + mds += d.shift(md).sum +end + +def s(d) + return 0 if d.empty? + + len = d.shift + md = d.shift + + mds = (0...len).map { + s(d) + } + + m = d.shift(md) + + if len == 0 + m.sum + else + m.map { |i| + if i <=0 || i > mds.size + 0 + else + mds[i-1] + end + }.sum + end +end + +p t(d.clone) # 35852 +p s(d.clone) # 33422 + diff --git a/day09.rb b/day09.rb new file mode 100644 index 0000000..ed76465 --- /dev/null +++ b/day09.rb @@ -0,0 +1,54 @@ +s = [0] + +m = 1 +i = 0 + +mp = 9 +mr = 25 + +mp = 10 +mr = 1618 +=begin + +mp = 13 +mr = 7999 + +mp, mr = File.read("day09").scan(/\d+/).map(&:to_i) +mr *= 100 # part 2 + +p mr +=end + +scores = Hash.new(0) + +catch(:done) { +loop { + (1..mp).each { |p| + print m, " ", i, " ", s.size, " " + p s + + if m % 23 == 0 + scores[p] += m + print "score1 #{p} #{m}\n" + i = (i - 8) % s.size + print "score2 #{p} #{s[i]}\n" + scores[p] += s.delete_at(i) + + i = (i+1)%s.size + m += 1 + else + i += 1 + s.insert(i, m) + i = (i+1)%s.size + m += 1 + end + + p m if m % 100000 == 0 + + throw :done if m >= mr+1 + } +} +} + +p scores +p scores.values.max # 382055 diff --git a/day11.k b/day11.k new file mode 100644 index 0000000..e2b88f9 --- /dev/null +++ b/day11.k @@ -0,0 +1,6 @@ +d:7857 +v:{{-5+`i$x[2]}@|$r*d+(*|x)*r:*:x+10}''300 300#+!300 300 +","/:'$1_'{x[2,*>x]}@{s::x;({x@*>x}@{(+/(v .)'+x+!2#s),x,s}'+!2#300-s)}'1+!22 + +/ 243,16 +/ 231,227,14 diff --git a/day12 b/day12 new file mode 100644 index 0000000..1ca818c --- /dev/null +++ b/day12 @@ -0,0 +1,34 @@ +initial state: ##.####..####...#.####..##.#..##..#####.##.#..#...#.###.###....####.###...##..#...##.#.#...##.##.. + +##.## => # +....# => . +.#.#. => # +..### => . +##... => # +##### => . +###.# => # +.##.. => . +..##. => . +...## => # +####. => . +###.. => . +.#### => # +#...# => # +..... => . +..#.. => . +#..## => . +#.#.# => # +.#.## => # +.###. => . +##..# => . +.#... => # +.#..# => # +...#. => . +#.#.. => . +#.... => . +##.#. => . +#.### => . +.##.# => . +#..#. => # +..#.# => . +#.##. => # diff --git a/day12.rb b/day12.rb new file mode 100644 index 0000000..288d34f --- /dev/null +++ b/day12.rb @@ -0,0 +1,79 @@ +s="#..#.#..##......###...###" + +t = { +"...##"=>"#", +"..#.."=>"#", +".#..."=>"#", +".#.#."=>"#", +".#.##"=>"#", +".##.."=>"#", +".####"=>"#", +"#.#.#"=>"#", +"#.###"=>"#", +"##.#."=>"#", +"##.##"=>"#", +"###.."=>"#", +"###.#"=>"#", +"####."=>"#", +} + +s="##.####..####...#.####..##.#..##..#####.##.#..#...#.###.###....####.###...##..#...##.#.#...##.##.." + +t={ +"##.##"=>"#", +"....#"=>".", +".#.#."=>"#", +"..###"=>".", +"##..."=>"#", +"#####"=>".", +"###.#"=>"#", +".##.."=>".", +"..##."=>".", +"...##"=>"#", +"####."=>".", +"###.."=>".", +".####"=>"#", +"#...#"=>"#", +"....."=>".", +"..#.."=>".", +"#..##"=>".", +"#.#.#"=>"#", +".#.##"=>"#", +".###."=>".", +"##..#"=>".", +".#..."=>"#", +".#..#"=>"#", +"...#."=>".", +"#.#.."=>".", +"#...."=>".", +"##.#."=>".", +"#.###"=>".", +".##.#"=>".", +"#..#."=>"#", +"..#.#"=>".", +"#.##."=>"#", +} + +s = ("."*1000) + s + (".")*1000 + +r = 0 +(1..1000).each { |i| + s = "..#{s}..".chars.each_cons(5).map { |c| + t[c.join] || "." + }.join + + if i == 20 || i == 500 || i == 1000 + r = 0 + s.chars.each_with_index { |c, i| + if c == "#" + # p i-10 + r += i-1000 + end + } + + p [i,r] + end +} + +# 1000..2000 adds up to 32000 +p r + ((50000000000/1000)-1)*32000 # 1600000032081 diff --git a/day13 b/day13 new file mode 100644 index 0000000..e6855b9 --- /dev/null +++ b/day13 @@ -0,0 +1,150 @@ + /------------------------------------------------------------------------------------------\ + /---------------------+---------------------------------------------\ | + /--------------------+---------------------+--------------------------------\ | /------------\ | + | | /---+--------------------------------+------------+----------------------+------------+--------+---\ + |/-------------------+-----------------+---+\ /--------------+---------\ | | | | | + /------++-----------\ | | || /---------+\ | | | | | | | + | || | | /------+---++------+---------++-------------+---------+--+-----\ | | | | + | || | | | |/--++------+---------++-------\ /-+--------\| | | | | | | + | || /-------+-------+----------+\ || || | || | | | || | | | | | | + | /-++---+-------+-----\ |/---------++-----++--++------+---------++-------+---+-+--------++--+-----+-----------\ | | | | + | | || | | | || /---++-----++--++------+---------++-------+---+-+\ || | | | | | | | + | | || | | | || | || || || | ||/------+---+-++-------++--+-----+-----------+----+-\ | | | + | | || | | | || | || /++--++------+---------+++------+---+-++-------++--+-----+--\ | | | | | | + /+----+-++---+-------+-----+-++-----+---++----+++--++->----+---------+++------+-\ | || || | | | | | | | | | + || | || |/------+-----+-++-----+---++----+++--++------+---------+++------+-+-+-++-------++--+-----+--+-------\| | | | | | + || | || || | | || | || ||| || | ||| | | | || /--++--+-----+--+-------++----+-+---\ | | | + || | || || | | || | /-++----+++--++----\ | ||| | | | || | || | | | || | | | | | | + || /--+-++---++------+-----+-++-----+-+-++----+++--++----+-+---------+++---\ | | | || | || | | | || | | | | | | + || | \-++---++------+-----/ || | | || |||/-++----+-+---------+++---+--+-+-+-++----+--++--+-----+-\| || | | | /---+--------+--\| + || | || || | || /+-+-++----++++-++----+-+---------+++---+--+-+-+-++----+--++--+-----+\|| /-++----+-+-\ | | | | || + || | || || | || /-++-+-++----++++-++----+-+---------+++---+--+-+-+-++----+--++--+-----++++-\ | || | | | | | | | || + || | || || | || | || | || |||| || | | ||\---+--+-+-+-++----+--++--+-----++++-+---+-++----+-/ | | | | | || + || | || || | || | || | || |||| || |/+---------++----+--+-+-+-++----+--++--+---\ |||| | | || | | | | /+-------\| || + || | || || | || | || | || |||| || ||| || |/-+-+-+-++----+--++--+---+-++++-+---+-++-\ | | | | || || || + || | || || | || | || | ||/---++++-++----+++---------++----++-+-+-+-++----+--++--+---+-++++-+---+-++-+\ | | | | || || || + || | || || /---+-------++--+-++-+-+++---++++-++----+++---------++----++-+-+-+-++----+--++--+---+-++++-+---+-++-++-+-\ | | | || || || + /++-+----++---++--+---+--\ || | || | ||| |||| || ||| || || | | | || |/-++--+---+-++++-+---+-++-++-+-+-+-+--+--++\ || || + ||| | || || | | | || | || | \++---++++-++----+++---------++----++-+-+-+-++----++-++--+---+-/||| |/--+-++-++-+-+-+-+--+--+++---\ || || + ||| |/---++---++--+---+--+----++\ | || | || |||| || ||| \+----++-+-+-+-++----++-+/ | | ||| || | || || | | | | | ||| | || || + ||| || || /++--+---+--+----+++-+-++-+--++---++++-++----+++----------+----++-+-+-+\|| || | | | ||| ||/-+-++-++-+-+-+-+--+--+++---+--++-\|| + ||| || || ||| | | | ||| | || | || |||| || ||| /---+----++-+-+-++++----++-+---+---+--+++-+++-+-++-++-+-+-+-+--+-<+++---+\ || ||| + ||| ||/--++--+++-\| | | ||| | || | || |||\-++----+++------+---+----++-+-+-++++----++-+---+---+--+/| ||| \-++-++-+-+-/ | | ||| || || ||| + ||| ||| ||/-+++-++-\ | /+----+++-+-++-+--++---+++--++----+++------+---+----++-+-+-++++----++-+---+---+--+-+-+++---++-++\| | | | ||| || || ||| + ||| ||| ||| ||| || | | || ||| | || | || ||| || /--+++------+---+----++-+\| |||| || | | | | | ||| || |||| | | | ||| || || ||| + ||| ||| ||| ||| || | | || ||| | || | || |\+--++-+--+++------+---+----++-+++-++++----++-+---+---+--+-+-+++---++-++++-+---+--+--+++->-++-++-++/ + ||| ||| ||| ||| || | | || ||| | || |/-++---+-+--++-+--+++->----+---+----++-+++-++++----++-+---+---+--+-+-+++---++-++++-+---+\ | ||| || || || + ||| ||| ||| ||| || | | || ||| | || ||/++---+-+--++-+--+++------+---+----++-+++-++++----++-+---+---+--+-+-+++---++-++++-+---++-+--+++---++\|| || + |\+-+++--+++-+++-++-+-+-++----+++-+-++-+++++---+-+--++-+--+++------+---+----++-++/ |||| || | | | | | ||| || |||| | || | ||| ||||| || + | | ||| ||| ||\-++-+-+-++----+++-+-++-+++++---+-+--++-+--+++------+---+----++-++--++++----++-+---+---+--+-+-+++---/| |||| | || | ||| ||||| || + | | ||| ||| ||/-++-+-+-++----+++\| || \++++---+-+--++-+--/|| | | || || |||| || | | | | | ||| | |||| | || | ||| ||||| || + | | ||| ||| ||| || | | || ||||| ||/-++++---+-+--++-+---++------+---+----++-++--++++----++-+---+---+--+-+\||| | |||| | || | ||| ||||| || + | | ||| ||| |||/++-+-+-++--\ ||||| ||| |||| /+-+--++-+---++------+---+----++-++--++++--\ || | | | | ||||| | |||| | || | ||| ||||| || + | | ||| ||| |||||| | | || | ||||| ||| |||| || | || | || | | |\-++--++++--+-++-+---+---+--+-+++++----+-/||| | || | ||| ||||| || + | | ||| ||| |||||^ | | || | ||||| ||| |||| || | \+-+---++------+---+----+--++--++++--+-++-+---+---+--+-+++++----+--+++-+---++-+--+++---++++/ || + |/+-+++--+++-++++++-+-+-++--+-+++++-+++-++++--++-+---+-+---++------+---+----+--++--++++--+-++-+---+---+\ | ||||| | ||| | || | ||| |||| || + ||| ||| ||| |||||| | | || | |||||/+++-++++--++-+---+-+---++------+---+----+--++--++++--+-++-+---+---++-+-+++++\ | ||| | || | ||| |||| || + ||| ||| ||| |||||| | | || | \++++++++-++++--++-+---+-+---++------+---+----+--++--++++--+-++-+---/ || | |||||| | ||| | || | ||| |||| || +/-+++-+++--+++-++++++-+-+-++--+--++++++++-++++--++-+---+-+---++------+---+----+--++--++++--+-++-+--\ || | |||||| | ||| | || | ||| |||| || +| ||| ||| v|| \+++++-+-+-++--+--++++++++-++++--++-+---+-+---++------+---+----+--++--+/|| | || | | || | |||||| | ||| | || | ||| |||| || +| ||| ||| ||| ||||| |/+-++--+--++++++++-++++--++-+---+-+---++------+---+----+--++--+-++-\| || | /+----++-+-++++++---+--+++-+--\|| | ||| |||| || +| ||| ||| ||| ||||| ||| || | \+++++++-++++--++-+---+-+---++------+---+----+--++--+-++-++-++-+-++----++-+-++++++---/ ||| | ||| | ||| |||| || +| ||\-+++--+++--+++++-++//++--+---+++++++-++++--++-+---+-+---++--\ | | /-+--++--+-++-++-++-+-++--\ || | |||||| ||| | ||| | ||| ||^| || +| || ||| \++--+++++-++-+++--+---+++++++-++++--++-+---+-+---++--+---+---+--+-+--++--+-/| || || | || | || | |||||| ||| | ||| | ||| |||| || +| || ||| ||/-+++++-++-+++--+---+++++++-++++-\|| | | \---++--+---+---+--+-+--+/ | | || || | || | || | |||||| ||\-+--+++-+--+/| |||| || +| || \++---+++-+++++-++-+++--+---+++++++-++++-+++-+---+-----++--+---+---+--+-/ | | | || || | || | || | |||||| ||/-+--+++-+--+-+---++++-\|| +| || || ||| ||||| || ||| | ||||||| |||| ||| | | || | |/--+--+----+-\ | | || || | || | || | ||||\+------+++-+--+++-+--+-+---++++-+/| +| || || ||| ||||| || ||| | ||||||| |||| ||| | | || | || |/-+----+-+-+--+-++-++-+-++--+-++-+-++++-+------+++-+--+++\| | | |||| | | +| || || ||| ||||| || ||| /+---+++++++-++++-+++-+---+-----++--+---++--++-+----+-+-+\ | || || | || | || | |||| | ||| | ||||| | | |||| | | +| || || /+++-+++++-++-+++-++---+++++++-++++-+++-+---+-----++--+---++--++-+----+-+-++-+-++-++-+\|| | || | |||| | /----+++-+\ ||||| | | |||| | | +| || ||/-++++-+++++-++-+++-++-\ ||||||| |||| |||/+---+-----++--+---++--++-+----+-+-++-+-++\\+-++++--+-++-+-++++-+-+----+++-++-+/||| | | |||| | | +| || ||| |||| ||\++-++-+++-+/ | ||||||| |||| ||||| | /---++--+--\|| || | | | || | ||| | |||| | || | |||| | | ||| || | ||| | | |||| | | +| || ||| |||| || || || ||| | | ||||||| |||| ||||| | | || | ||| || | | | \+-+-+++-+-/||| | || | |||| | ^ ||| || | ||\--+-+---++++-+-/ +| || ||| |||| || || || ||| | | |||||||/++++-+++++---+-+---++--+--+++--++-+----+-+--+-+-+++-+--+++--+-++-+-++++-+-+----+++-++-+\|| | | |||| | +| || ||| |||| || || || ||| | | |||||||||||| ||||| | | || | ||| || | | | | | ||| | ||| | || | |||| | | ||| || |||| | | |||| | +| || ||| |||| || || || ||| | /+-++++++++++++-+++++---+-+---++--+--+++--++-+----+-+--+-+-+++-+--+++--+-++-+-++++-+-+----+++-++-++++--\| | |||| | +| || |\+-++++-++-/| || ||| | || |||||||||||| ||||| | | ||/-+--+++--++-+----+-+--+-+-+++-+--+++--+-++-+-++++-+-+--\ ||| || |||| || | |||| | +| || | | |||| || | || ||| | || |||||\++++++-+++++---+-+---+++-+--+++--++-+----+-+--+-/ ||| | ||| | || | |||| | | | ||| || |||| || | |||| | +| || | | |||| || | || \++-+-++-+++++-++++++-+++++---+-+---+++-/ ||| || | | | | ||| | ||| | || | |||| | | | ||| || |||| || | |||| | +| || | | |||| || | || \+-+-++-+++++-++++++-+++++---+-+---+++----+++--++-+----+-+--+---+++-+--+++--+-++-+-++++-+-+--+-+/| || |||| || | |||| | +| || | | |||\-++--+-++---+-+-++-+++++-++++++-/|||| | | ||| ||| || | | | | ||| | ||| | || | |||| | | | | | || |||| || | |||| | +| || | | ||\--++--+-/| | | || ||||| |||||| |||| | | ||| /+++--++-+----+-+--+---+++-+--+++--+-++-+-++++-+\| | | | || |||| || | |||| | +| || /-+-+-++---++--+--+---+-+-++-+++++-++++++--++++---+-+---+++---++++--++-+----+-+--+---+++-+--+++-\| || | |||\-+++--+-+-+-++-++++--++-+---/||| | +| || | | | || || | | /-+-+-++-+++++-++++++--++++---+-+---+++---++++--++-+----+-+-\| ||| | ||| || || | |v| ||| | | | || |||| || | ||| | +| || | | | ||/--++--+--+-+-+-+-++-+++++\|||||| |||| | | ||| |||| || | | | || ||| | ||| || || | ||| ||| | | | || |||| || | ||| | +| || |/+-+-+++--++--+--+-+-+-+-++-++++++++++++--++++---+-+\ /+++---++++--++-+----+-+-++---+++-+--+++-++-++-+-+++--+++--+-+-+-++-++++--++-+---\||| | +| || ||| | ||| || | | | | \-++-++++++++++++--++++---+-++-++++---++++--++-+----+-+-+/ ||| | ||| || || | ||| ||| | | | || |||| || | |||| | +| || ||| | \++--++--+--+-+-+---++-++++++++++++--++++---+-++-++++---++++--++-+----+-+-+----+++-+--/|| || || | ||| ||| | | | || |||| || | |||| | +| || ||| | || || |/-+-+-+---++-++++++++++++--++++---+-++-++++---++++--++-+----+-+-+---\||| | || || || | ||| ||| | | | || |||| || | |||| | +| || ||| | || || || | | | || |||||||||||| ||\+---+-++-++++---++++--++-+----+-+-+---+++/ | || || || | ||| ||| | | | || |||| || | |||| | +| || ||| | || || || | | | || |||\++++++++--++-+---+-++-++++---++++--++-+----+-+-+---+++--+---++-++-++-+-+++--/|| | | | || |||| || | |||| | +| || ||| | || || || | | | || ||| |||||||| || \---+-++-++++---++++--++-+----/ | |/--+++--+---++-++-++-+-+++---++--+-+-+-++-++++--++\| |||| | +| || ||| \--++--++--++-+-+-+---+/ ||| |||||\++--++-----+-++-++++---++++--++-+------+-++--+++--+---++-++-++-+-+++---++--+-+-+-++-++++--++++---++/| | +| || ||| || || || | | | | ||| ||||| || || | || |||| |||| || | /---+-++--+++--+---++-++-++-+-+++---++-\| | | || |||| |||| || | | +| || ||| |\--++--++-+-+-+---+--+++-+/||| || || | || |||| |||| || | | | || ||| | || || || | ||| || || | | || |||| |||| || | | +| || ||| | || /++-+-+-+---+--+++-+-+++-++--++-----+-++-++++---++++\ || |/-+---+-++--+++--+---++-++-++-+-+++---++-++-+-+-++-++++--++++-\ || | | +| || ||| | || ||| | | | | ||| |/+++-++--++-----+-++-++++---+++++-++-++-+---+-++--+++--+\ || || || | ||| || || | | || |||| ||||/+-++-+-+\ +| || ||| | || ||| | | | | ||| ||||| || || | || |v|| /-+++++-++-++-+---+-++--+++--++--++-++-++-+-+++---++-++-+-+-++-++++\ |||||| || | || +| || ||| | || ||| | | | | ||| ||||| || || | || |||| | ||||| || || | /+-++--+++--++--++-++-++-+-+++---++\|| | | || ||||| |||||| || | || +| || ||| | || ||| | | | | ||| ||||| || || /-+-++-++++-+-+++++-++-++-+--++-++--+++--++--++-++-++-+-+++---+++++-+-+-++-+++++\|||||| || | || +| || ||| | || ||| | | | | ||| ||||| || || | | || |||| | ||||| ||/++-+--++-++--+++--++--++-++-++-+-+++---+++++-+-+-++\|||||||||||| || | || +| || ||| | || ||| | | | | ||| ||||| || || | | || \+++-+-+++++-+++++-+--++-++--+++--++--++-++-++-+-+++---+++++-+-+-+++++++++++++++-/| | || +| \+-+++----+---++-+++-+-+-/ v ||| ||||| || || | | || ||| | |||\+-+++++-+--+/ || ||| || || || || | ||| ||||| | | ||||||||||||||| | | || +| | ||| |/--++-+++-+-+-----+--+++-+++++-++--++---+-+-++--+++-+-+++-+-+++++-+--+--++--+++--++-\|| || || | ||| ||||| | | ||||||||||||||| | | || +| | ||| || || ||| | | | ||| ||||| |\--++---+-+-++--+++-+-+++-+-+++++-+--+--++--+++--++-+++-++-++-+-+++---+++++-/ | ||||||||||||||| | | || +| | ||| || /++-+++-+-+-----+--+++-+++++-+-\ || | | || ||| | ||| | ||||| | | || ||| || ||| || || | ||| ||||| | ||||||||||||||| | | || +| | ||| || ||| ||| | | | ||| ||||| | | || | | || ||| | ||| | ||||| | | || ||| || ||| || || | ||| |\+++---+-+/||||||||||||| | | || +| | ||| || ||| ||| | | | ||| ||||| | | || | | || ||| | ||| | ||||| | | || ||| || ||| || || | ||| | ||| | | ||||||||||||| | | || +| | ||| || ||| ||| \-+-----+--+++-+++++-+-+-++---+-+-++--+++-+-+++-+-+++++-+--+--++--+/| || ||| || || | ||| | ||| | | ||||||||||||| | | || +| | ||| || ||| ||| | | ||| ||||| | | || | | \+--+++-+-+/| | ||||| | | || | | || ||| || || | ||| | ||| | | ||||||||||||| | | || +| | ||| \+-+++-+++---+-----+--+++-+++++-+-+-++---+-/ | ||| | | | | ||||| | | ||/-+-+--++-+++-++\|| | ||| | ||| | | ||||||||||||| | | || +| | ||| | ||| ||| | | ||| ||||| | | |\---+----+--+++-+-+-+-+-+++++-+--+--+++-+-+--++-+++-+++++-+-/|| | ||| | | ||||||||\++++--+-/ || +| | ||| | ||| ||| | | ||| ||||| | | | | | ||| | | | | ||||| | | ||| | |/-++-+++-+++++-+--++---+-+++--\| | |||||||| |||| | || +| \-+++-----+-+++-+++---+-----+--+++-+++++-+-+-+----+----+--+++-+-+-+-+-+++++-+--+--+++-+-++-++-+++-++++/ |/-++---+-+++--++-+-++++++++-++++--+---++\ +| ^|| | |||/+++---+-----+--+++-+++++-+-+-+----+----+--+++-+-+-+-+-+++++-+-\| ||| | || || ||| |||| || || | ||| || | |||||||| |||| | ||| +| ||| | ||||||| | | ||| ||||| | | | | | ||| | | | | ||\++-+-++--+++-+-++-++-+++-++++--++-++---+-+++--++-+-/||||||| |||| | ||| +| ||| | ||||||| | | ||\-+++++-+-+-+----+----+--+++-+-+-+-+-++-++-+-++--+++-+-++-++-+++-++++--++-+/ | ||| || | ||||||| |||| | ||| +| ||\-----+-+++++++---+-----+--/| ||||| | | | | | ||| | | | | ||/++-+-++--+++-+-++-++\||| |||| || | | ||| || | ||||||| |||| | ||| +| || | ||||||| \-----+---+--+++++-+-+-+----+----+--+++-+-+-+-+-+++++-+-++--/|| | || |||||| |||| || | | ||| || | ||||||| |||| | ||| +| || | ||||||\---------+---+--+++++-+-+-+----+----+--+++-+-+-+-+-+++++-+-++---++-/ || |||||| |||| || | | ||| || | ||||||| |||| | ||| +| || | |\++++----------+---+--+++++-/ | | | | |\+-+-+-+-+-/|||| | || || || |||||| |||| || | | ||| || | ||||||| |||| v ||| +| || | | |||| | | ||\++---+-+----+----+--+-+-+-+-+-+--++++-+-++---++---++-++++++-++++--++-/ | ||| || | ||||||| |||| | ||| +| || | | |||| | | || || | | | | | \-+-+-+-+--++++-+-++---++---++-++++++-++++--++------+-++/ || | ||||||| |||| | ||| +| || | | |||| \---+--++-++---+-+----+----+--+---+-+-+-+--++++-+-++---++---++-++++++-++++--++------+-++---++-+--++++++/ |||| | ||| +| || | \-++++--------------+--++-++---/ | | | | | | | | |||| | || |\---++-++++++-++/| || | || || | |||||| |||| | ||| +| || | |||| | || || | | | | | | | | |||| | || |/---++-++++++-++-+--++----\ | || || | |||||| |||| | ||| +| || | |||| | || || /-+----+----+--+---+-+-+-+--++++-+-++---++---++-++++++-++-+--++----+-+-++--\|| | |||||| |||| | ||| +| || | |||| | || \+---+-+----+----+--+---+-+-+-+--++++-+-++---++---++-++++++-++-+--++----+-+-++--+++-+--+/|||| |||| | ||| +| || | |||\--------------+--++--+---+-+----+----+--+---+-+-+-+--++++-+-++---++---++-++++++-++-+--++----+-+-++--+++-/ | |||| |||| | ||| +| || | ||| /-----------+--++--+---+-+----+----+--+---+-+-+-+--++++-+-++--\|| || |||||| || | || | | || ||| | |||| |||| | ||| +| || | ||| | | \+--+---+-+----+----+--+---+-+-+-+--++++-+-++--+++---++-++++++-++-+--/| | | || ||| | |||| |||| | ||| +| |\------+---+++---+-----------+---+--+---+-+----+----/ | | | | | |||| | || ||| || |||||| || | | | | || ||| | |||| |||| | ||| +| | | ||| | | | | | | | \---+-+-+-+--++++-+-++--+++---++-++++++-++-/ | | | || ||| | |||| |||| | ||| +| | | ||| | | | |/--+-+----+-----------+-+-+-+--++++-+-++--+++---++-++++++-++-----+----+-+-++--+++-\ | |||| |||| | ||| +| | | ||\---+-----------+---+--++--+-+----+-----------+-+-+-/ |||| | || ||| || |||||| || | | | || ||| | | |||| |||| | ||| +| | | || | /--+---+--++\ | | | | \-+----++++-+-++--+++---++-++++++-++-----+----+-/ || ||| | | |||| |||| | ||| +| | | || | | | | ||| | | | | | |||| | || ||| || |||||| || | | || ||| | | |||| |||| | ||| +| | | || | | | | ||| | | | | | |||| | || ||| |\-++++++-++-----+----+---++--+/| | | |||| ||\+--+---+/| +| | | || \--------+--+---+--+++-+-+----+-----------+---+----++++-+-++--/|| | \+++++-++-----+----+---++--+-+-+--+-++++--+/ | | | | +| | | || | | | \++-+-+----+-----------+---+----++++-+-++---++---+---+++++-++-----+----+---++--+-+-+--+-/||| | | | | | +| | /-+---++--------\ | | | || | | | | | ||\+-+-++---++---+---+++++-+/ | | || | | | | ||| | | | | | +| | | | || | | | | || | | | \---+----++-+-+-++---++---+---+++++-+------+----+->-++--+-+-+--+--+/| | | | | | +| | | | || | | | | || | | | | || \-+-++---++---+---+++++-+------+----+---++--+-+-+--+--+-+--+--/ | | | +| | | | \+--------+----+--/ | \+-+-+----+---------------+----++---+-++---++---+---+++++-+------+----+---++--+-+-/ | | | | | | | +\----+-----+-+----+--------+----+------+----+-+-+----+---------------+----++---+-++---++---+---++++/ | | | || | | | | | | | | | + | | | | | | | | | | | /-------+----++---+-++---++---+---++++--+---\ | | || | | | | | | | | | + | | | | | | \----+-+-+----+-------+-------+----++---+-++---++---+---/||| | | | | || | | | | | | | | | + | | | | | | | | | | | | || | || || | ||| | | \----+---++--+-+----+--+-+--+-----+---+-/ + | | | | | | | | | | | | || | |\---++---+----+++--+---+-------+---/| | \----+--+-+--+-----+---/ + | | | | | | | | | | | \----++---+-+----++---+----+++--+---+-------+----+--+------+--+-+--+-----/ + | | | | | | | | | | | \+---+-+----++---+----+++--+---+-------+----+--+------+--/ | | + | | | | | | | | \----+-------+-------------+---+-+----++---/ ||| | | | | | | | | + | \-+----+--<-----/ | | | | | | | | \+--------+++--+---+-------+----+--+------+----+--/ + | | \-------------+-----------+-+------+-------+-------------+---+-/ \--------+++--+---+-------/ | | | | + | | \-----------/ | | | | \----------------+++--+---+------------/ | | | + | | | \-------+-------------+--------------------+++--+---+---------------+------+----/ + | | | | \--------------------/|\--+---+---------------+------/ + | v \--------------+-----------------------------------+---+---+---------------/ + \-------+-----------------------------------------------+-----------------------------------+---/ | + | \-----------------------------------+-------/ + \--------------------------------------------------------------------------------<--/ diff --git a/day13.rb b/day13.rb new file mode 100644 index 0000000..9b2003c --- /dev/null +++ b/day13.rb @@ -0,0 +1,137 @@ +maze = File.readlines("day13") + +xmaze = <<'EOF'.lines.to_a +/->-\ +| | /----\ +| /-+--+-\ | +| | | | v | +\-+-/ \-+--/ + \------/ +EOF + +cars = [] + +maze.each_with_index { |row, i| + row.chars.each_with_index { |col, j| + case col + when "^"; cars << [i,j,:n,:l]; row[j] = "|" + when ">"; cars << [i,j,:e,:l]; row[j] = "-" + when "v"; cars << [i,j,:s,:l]; row[j] = "|" + when "<"; cars << [i,j,:w,:l]; row[j] = "-" + end + } +} + + +cars = [ + [65, 26, :s, :r], + [105, 39, :n, :l], + [140, 85, :e, :r] +] + +puts maze + +crashed = [] + +loop { + cars.sort! #_by! { |(i,j,d,s)| [j,i] } + + p cars.size + p cars + + m = maze.map {|l|l.dup} + cars.each { |(i,j,d,s)| + m[i][j] = case d + when :e; ">" + when :n; "^" + when :s; "v" + when :w; "<" + end + } +# puts m + + if cars.size == 1 + p cars + break + end + + cars.each_with_index { |(i,j,d,s),n| + p [maze[i][j],d] + case [maze[i][j],d] + when ["-", :e] + cars[n][1] += 1 + when ["-", :w] + cars[n][1] -= 1 + when ["|", :s] + cars[n][0] += 1 + when ["|", :n] + cars[n][0] -= 1 + when ["+", :s] + case s + when :l; cars[n][1] +=1; cars[n][2] = :e; cars[n][3] = :s + when :s; cars[n][0] +=1; cars[n][3] = :r + when :r; cars[n][1] -=1; cars[n][2] = :w; cars[n][3] = :l + end + when ["+", :n] + case s + when :l; cars[n][1] -=1; cars[n][2] = :w; cars[n][3] = :s + when :s; cars[n][0] -=1; cars[n][3] = :r + when :r; cars[n][1] +=1; cars[n][2] = :e; cars[n][3] = :l + end + when ["+", :e] + case s + when :l; cars[n][0] -=1; cars[n][2] = :n; cars[n][3] = :s + when :s; cars[n][1] +=1; cars[n][3] = :r + when :r; cars[n][0] +=1; cars[n][2] = :s; cars[n][3] = :l + end + when ["+", :w] + case s + when :l; cars[n][0] +=1; cars[n][2] = :s; cars[n][3] = :s + when :s; cars[n][1] -=1; cars[n][3] = :r + when :r; cars[n][0] -=1; cars[n][2] = :n; cars[n][3] = :l + end + when ["\\", :e] + cars[n][2] = :s + cars[n][0] += 1 + when ["/", :e] + cars[n][2] = :n + cars[n][0] -= 1 + when ["\\", :n] + cars[n][2] = :w + cars[n][1] -= 1 + when ["/", :n] + cars[n][2] = :e + cars[n][1] += 1 + when ["\\", :s] + cars[n][2] = :e + cars[n][1] += 1 + when ["/", :s] + cars[n][2] = :w + cars[n][1] -= 1 + when ["/", :w] + cars[n][2] = :s + cars[n][0] += 1 + when ["\\", :w] + cars[n][2] = :n + cars[n][0] -= 1 + else + p [:miss, maze[i][j], d] + end + + if cars.each.with_index.any? { |(i2,j2,_,_,m)| i == i2 && j == j2 && n != m } + if crashed.empty? + p [:crash, j, i] + end + crashed << true + cars.delete_at n + cars.delete_if { |(i2,j2,_,_,m)| i == i2 && j == j2 } + end + + } +} + +p cars + +# 32,8 ok +# 38,38 + diff --git a/day14 b/day14 new file mode 100644 index 0000000..bb84d0a --- /dev/null +++ b/day14 @@ -0,0 +1 @@ +360781 diff --git a/day14.rb b/day14.rb new file mode 100644 index 0000000..c290b18 --- /dev/null +++ b/day14.rb @@ -0,0 +1,25 @@ +d = 360781 + +s = [3,7] +e1 = 0 +e2 = 1 + +30_000_000.times { +# p [:X, e1, e2, s[e1], s[e2]] + c = (s[e1] + s[e2]).to_s.split('').map(&:to_i) + s.concat c + e1 = (e1 + 1 + s[e1]) % s.size + e2 = (e2 + 1 + s[e2]) % s.size + +# p s + +# p s.size-6 if s[-7]==3&&s[-6]==6&&s[-5]==0&&s[-4]==7&&s[-3]==9&&s[-2]==1 +# p s.size-6 if s[-6]==3&&s[-5]==6&&s[-4]==0&&s[-3]==7&&s[-2]==9&&s[-1]==1 +} + +p s.size +p s[d,10].join('') +# 6521571010 + +p s.join('').index d.to_s +# 20262967 diff --git a/day15.rb b/day15.rb new file mode 100644 index 0000000..4df8590 --- /dev/null +++ b/day15.rb @@ -0,0 +1,32 @@ +################################ +#####################....####### +#####################....####### +####################.....####### +#########...G#######......###### +#########....#....#.........#..# +######.#...G####.G......#..E...# +######.##..##.#.......###....### +####............#.##..###.....## +####.G.##....G....###.####...### +####.GGG##........###.#####..### +#####...##...G.................# +######.###..G.#####.........#### +######..##...#######........#### +######...GG.#########....E...### +######.....G#########.E.E......# +######......#########..........# +#########.#.#########....#....## +#########G#.#########.....###### +###.#####G...#######......###### +#..G..##...E..#####........##### +#..##.##.................E.##### +#..G.......................##### +###..G......G..E............#### +###...##.G......#...##......#### +########..E....##.#######..##### +#######........################# +#######........################# +########.##......############### +######...##..E.E.############### +######.....##.#.################ +################################ diff --git a/day16 b/day16 new file mode 100644 index 0000000..a768055 --- /dev/null +++ b/day16 @@ -0,0 +1,4014 @@ +Before: [0, 2, 2, 2] +4 2 3 2 +After: [0, 2, 5, 2] + +Before: [2, 2, 1, 3] +3 1 0 2 +After: [2, 2, 1, 3] + +Before: [0, 2, 0, 0] +8 1 2 0 +After: [4, 2, 0, 0] + +Before: [2, 2, 2, 0] +2 1 2 2 +After: [2, 2, 1, 0] + +Before: [3, 1, 2, 2] +11 1 0 3 +After: [3, 1, 2, 3] + +Before: [1, 1, 2, 3] +12 0 3 0 +After: [0, 1, 2, 3] + +Before: [3, 1, 2, 2] +15 0 3 3 +After: [3, 1, 2, 6] + +Before: [1, 2, 2, 2] +6 1 0 1 +After: [1, 1, 2, 2] + +Before: [0, 1, 3, 1] +5 1 0 2 +After: [0, 1, 1, 1] + +Before: [2, 2, 1, 0] +3 1 0 1 +After: [2, 1, 1, 0] + +Before: [3, 3, 1, 2] +6 3 3 1 +After: [3, 0, 1, 2] + +Before: [2, 2, 3, 0] +3 1 1 0 +After: [1, 2, 3, 0] + +Before: [0, 2, 2, 1] +15 3 1 0 +After: [2, 2, 2, 1] + +Before: [0, 1, 3, 1] +5 1 0 0 +After: [1, 1, 3, 1] + +Before: [0, 1, 0, 3] +5 1 0 0 +After: [1, 1, 0, 3] + +Before: [3, 2, 2, 3] +7 1 0 3 +After: [3, 2, 2, 1] + +Before: [0, 2, 3, 0] +10 0 0 1 +After: [0, 0, 3, 0] + +Before: [0, 1, 1, 0] +4 2 3 0 +After: [4, 1, 1, 0] + +Before: [2, 1, 2, 3] +14 0 2 1 +After: [2, 4, 2, 3] + +Before: [2, 1, 3, 2] +1 3 1 2 +After: [2, 1, 3, 2] + +Before: [2, 2, 2, 1] +1 3 2 0 +After: [3, 2, 2, 1] + +Before: [0, 0, 3, 1] +10 0 0 0 +After: [0, 0, 3, 1] + +Before: [0, 2, 2, 3] +2 1 2 3 +After: [0, 2, 2, 1] + +Before: [2, 1, 0, 3] +12 0 3 2 +After: [2, 1, 0, 3] + +Before: [3, 0, 3, 3] +4 2 2 1 +After: [3, 5, 3, 3] + +Before: [0, 3, 3, 1] +3 1 2 0 +After: [1, 3, 3, 1] + +Before: [2, 0, 0, 3] +12 0 3 1 +After: [2, 0, 0, 3] + +Before: [2, 0, 3, 2] +4 2 2 2 +After: [2, 0, 5, 2] + +Before: [1, 3, 3, 0] +3 1 2 1 +After: [1, 1, 3, 0] + +Before: [1, 1, 2, 2] +4 0 3 0 +After: [4, 1, 2, 2] + +Before: [1, 2, 2, 3] +15 0 1 3 +After: [1, 2, 2, 2] + +Before: [3, 2, 3, 0] +7 1 0 3 +After: [3, 2, 3, 1] + +Before: [0, 1, 2, 0] +10 0 0 2 +After: [0, 1, 0, 0] + +Before: [0, 3, 2, 1] +10 0 0 0 +After: [0, 3, 2, 1] + +Before: [2, 1, 3, 2] +9 1 3 0 +After: [3, 1, 3, 2] + +Before: [1, 1, 3, 0] +13 1 0 2 +After: [1, 1, 1, 0] + +Before: [3, 1, 2, 2] +6 3 3 2 +After: [3, 1, 0, 2] + +Before: [3, 1, 3, 2] +15 2 3 2 +After: [3, 1, 6, 2] + +Before: [3, 2, 2, 2] +7 1 0 1 +After: [3, 1, 2, 2] + +Before: [1, 1, 0, 2] +13 1 0 2 +After: [1, 1, 1, 2] + +Before: [1, 1, 2, 3] +13 1 0 0 +After: [1, 1, 2, 3] + +Before: [1, 1, 2, 1] +9 2 1 2 +After: [1, 1, 3, 1] + +Before: [1, 2, 2, 2] +2 1 2 1 +After: [1, 1, 2, 2] + +Before: [1, 0, 1, 2] +0 1 0 3 +After: [1, 0, 1, 1] + +Before: [1, 2, 2, 2] +6 3 3 0 +After: [0, 2, 2, 2] + +Before: [2, 2, 2, 2] +3 1 1 1 +After: [2, 1, 2, 2] + +Before: [1, 3, 0, 3] +9 0 3 0 +After: [3, 3, 0, 3] + +Before: [0, 2, 2, 1] +2 1 2 1 +After: [0, 1, 2, 1] + +Before: [3, 2, 1, 0] +7 1 0 0 +After: [1, 2, 1, 0] + +Before: [2, 0, 3, 1] +6 3 3 0 +After: [0, 0, 3, 1] + +Before: [2, 2, 2, 2] +6 3 3 1 +After: [2, 0, 2, 2] + +Before: [1, 1, 2, 0] +13 1 0 1 +After: [1, 1, 2, 0] + +Before: [3, 3, 1, 3] +11 2 0 2 +After: [3, 3, 3, 3] + +Before: [2, 2, 3, 0] +3 1 0 2 +After: [2, 2, 1, 0] + +Before: [1, 2, 0, 3] +12 0 3 2 +After: [1, 2, 0, 3] + +Before: [0, 2, 3, 1] +10 0 0 0 +After: [0, 2, 3, 1] + +Before: [1, 0, 2, 2] +0 1 0 3 +After: [1, 0, 2, 1] + +Before: [1, 0, 1, 0] +0 1 0 3 +After: [1, 0, 1, 1] + +Before: [0, 1, 1, 2] +5 1 0 3 +After: [0, 1, 1, 1] + +Before: [0, 3, 0, 2] +11 0 3 2 +After: [0, 3, 2, 2] + +Before: [3, 2, 3, 2] +15 2 3 1 +After: [3, 6, 3, 2] + +Before: [1, 1, 2, 3] +13 1 0 1 +After: [1, 1, 2, 3] + +Before: [3, 1, 0, 1] +11 1 0 2 +After: [3, 1, 3, 1] + +Before: [1, 1, 0, 0] +13 1 0 0 +After: [1, 1, 0, 0] + +Before: [0, 2, 2, 1] +2 1 2 3 +After: [0, 2, 2, 1] + +Before: [3, 1, 2, 1] +1 3 2 3 +After: [3, 1, 2, 3] + +Before: [3, 3, 3, 2] +6 3 3 3 +After: [3, 3, 3, 0] + +Before: [1, 0, 3, 2] +11 1 2 0 +After: [3, 0, 3, 2] + +Before: [1, 0, 1, 2] +0 1 0 1 +After: [1, 1, 1, 2] + +Before: [1, 3, 0, 3] +9 0 3 2 +After: [1, 3, 3, 3] + +Before: [3, 3, 3, 3] +3 1 2 0 +After: [1, 3, 3, 3] + +Before: [3, 2, 1, 1] +7 1 0 3 +After: [3, 2, 1, 1] + +Before: [3, 2, 2, 3] +7 1 0 0 +After: [1, 2, 2, 3] + +Before: [3, 1, 2, 0] +14 2 2 2 +After: [3, 1, 4, 0] + +Before: [0, 0, 1, 2] +10 0 0 0 +After: [0, 0, 1, 2] + +Before: [2, 3, 2, 3] +2 1 3 3 +After: [2, 3, 2, 1] + +Before: [3, 2, 3, 1] +4 0 3 2 +After: [3, 2, 6, 1] + +Before: [2, 1, 0, 2] +6 3 3 3 +After: [2, 1, 0, 0] + +Before: [3, 2, 0, 2] +7 1 0 0 +After: [1, 2, 0, 2] + +Before: [1, 0, 0, 1] +0 1 0 2 +After: [1, 0, 1, 1] + +Before: [1, 1, 0, 0] +4 0 3 2 +After: [1, 1, 4, 0] + +Before: [2, 2, 2, 3] +8 2 3 1 +After: [2, 6, 2, 3] + +Before: [1, 0, 2, 2] +0 1 0 0 +After: [1, 0, 2, 2] + +Before: [0, 2, 1, 0] +10 0 0 1 +After: [0, 0, 1, 0] + +Before: [0, 3, 2, 3] +14 2 2 3 +After: [0, 3, 2, 4] + +Before: [1, 3, 0, 3] +12 0 3 3 +After: [1, 3, 0, 0] + +Before: [3, 2, 3, 3] +7 1 0 0 +After: [1, 2, 3, 3] + +Before: [1, 1, 1, 3] +9 2 3 2 +After: [1, 1, 3, 3] + +Before: [3, 2, 0, 1] +7 1 0 3 +After: [3, 2, 0, 1] + +Before: [0, 2, 1, 3] +11 2 1 1 +After: [0, 3, 1, 3] + +Before: [0, 0, 0, 1] +4 3 1 3 +After: [0, 0, 0, 2] + +Before: [1, 1, 0, 2] +1 3 1 3 +After: [1, 1, 0, 3] + +Before: [0, 1, 2, 1] +5 1 0 2 +After: [0, 1, 1, 1] + +Before: [0, 2, 1, 0] +4 1 3 1 +After: [0, 5, 1, 0] + +Before: [3, 3, 0, 3] +2 1 3 1 +After: [3, 1, 0, 3] + +Before: [1, 0, 2, 1] +0 1 0 0 +After: [1, 0, 2, 1] + +Before: [1, 1, 2, 1] +13 1 0 1 +After: [1, 1, 2, 1] + +Before: [0, 3, 2, 1] +4 1 1 2 +After: [0, 3, 4, 1] + +Before: [0, 3, 0, 3] +9 2 3 2 +After: [0, 3, 3, 3] + +Before: [2, 2, 0, 3] +8 1 2 2 +After: [2, 2, 4, 3] + +Before: [2, 2, 0, 0] +3 1 1 2 +After: [2, 2, 1, 0] + +Before: [0, 1, 2, 3] +5 1 0 1 +After: [0, 1, 2, 3] + +Before: [1, 1, 1, 1] +13 1 0 3 +After: [1, 1, 1, 1] + +Before: [3, 1, 3, 1] +6 3 3 2 +After: [3, 1, 0, 1] + +Before: [0, 2, 0, 2] +6 3 3 2 +After: [0, 2, 0, 2] + +Before: [0, 3, 0, 2] +10 0 0 0 +After: [0, 3, 0, 2] + +Before: [2, 3, 2, 3] +14 2 2 0 +After: [4, 3, 2, 3] + +Before: [1, 2, 1, 0] +3 1 1 0 +After: [1, 2, 1, 0] + +Before: [2, 0, 1, 1] +11 0 2 3 +After: [2, 0, 1, 3] + +Before: [2, 2, 1, 3] +12 0 3 2 +After: [2, 2, 0, 3] + +Before: [0, 2, 0, 3] +8 1 2 3 +After: [0, 2, 0, 4] + +Before: [2, 1, 3, 2] +8 3 2 0 +After: [4, 1, 3, 2] + +Before: [1, 0, 0, 2] +0 1 0 1 +After: [1, 1, 0, 2] + +Before: [1, 1, 1, 0] +13 1 0 2 +After: [1, 1, 1, 0] + +Before: [3, 1, 2, 2] +14 2 2 3 +After: [3, 1, 2, 4] + +Before: [1, 2, 2, 1] +14 1 2 2 +After: [1, 2, 4, 1] + +Before: [3, 3, 2, 3] +2 1 3 0 +After: [1, 3, 2, 3] + +Before: [3, 2, 2, 0] +11 3 1 3 +After: [3, 2, 2, 2] + +Before: [2, 2, 0, 2] +3 1 1 0 +After: [1, 2, 0, 2] + +Before: [1, 3, 3, 2] +4 2 1 3 +After: [1, 3, 3, 4] + +Before: [1, 3, 2, 3] +2 1 3 1 +After: [1, 1, 2, 3] + +Before: [1, 0, 3, 1] +0 1 0 3 +After: [1, 0, 3, 1] + +Before: [1, 0, 1, 3] +0 1 0 0 +After: [1, 0, 1, 3] + +Before: [3, 2, 0, 1] +7 1 0 0 +After: [1, 2, 0, 1] + +Before: [3, 2, 1, 2] +7 1 0 0 +After: [1, 2, 1, 2] + +Before: [0, 2, 2, 2] +2 1 2 1 +After: [0, 1, 2, 2] + +Before: [0, 1, 2, 3] +5 1 0 2 +After: [0, 1, 1, 3] + +Before: [1, 0, 2, 3] +0 1 0 1 +After: [1, 1, 2, 3] + +Before: [0, 1, 0, 2] +5 1 0 3 +After: [0, 1, 0, 1] + +Before: [2, 1, 3, 3] +11 1 0 3 +After: [2, 1, 3, 3] + +Before: [1, 3, 1, 1] +6 3 3 1 +After: [1, 0, 1, 1] + +Before: [3, 0, 3, 1] +1 3 2 3 +After: [3, 0, 3, 3] + +Before: [1, 2, 3, 0] +9 0 2 2 +After: [1, 2, 3, 0] + +Before: [2, 2, 2, 0] +11 3 0 1 +After: [2, 2, 2, 0] + +Before: [2, 2, 2, 1] +14 0 2 3 +After: [2, 2, 2, 4] + +Before: [3, 2, 0, 2] +7 1 0 3 +After: [3, 2, 0, 1] + +Before: [0, 2, 1, 3] +9 2 3 2 +After: [0, 2, 3, 3] + +Before: [1, 1, 2, 2] +9 0 3 2 +After: [1, 1, 3, 2] + +Before: [2, 1, 3, 3] +12 0 3 2 +After: [2, 1, 0, 3] + +Before: [0, 2, 2, 0] +14 1 2 3 +After: [0, 2, 2, 4] + +Before: [2, 2, 0, 3] +12 0 3 2 +After: [2, 2, 0, 3] + +Before: [0, 0, 3, 2] +15 2 3 1 +After: [0, 6, 3, 2] + +Before: [0, 3, 0, 1] +4 1 3 0 +After: [6, 3, 0, 1] + +Before: [2, 2, 2, 3] +12 0 3 0 +After: [0, 2, 2, 3] + +Before: [0, 1, 1, 0] +5 1 0 1 +After: [0, 1, 1, 0] + +Before: [0, 3, 1, 3] +2 1 3 3 +After: [0, 3, 1, 1] + +Before: [1, 1, 2, 0] +14 2 2 2 +After: [1, 1, 4, 0] + +Before: [0, 0, 2, 1] +10 0 0 3 +After: [0, 0, 2, 0] + +Before: [3, 3, 3, 1] +3 1 2 0 +After: [1, 3, 3, 1] + +Before: [3, 2, 1, 1] +11 1 2 3 +After: [3, 2, 1, 3] + +Before: [2, 2, 1, 1] +6 1 2 2 +After: [2, 2, 1, 1] + +Before: [0, 0, 1, 0] +10 0 0 2 +After: [0, 0, 0, 0] + +Before: [3, 3, 3, 3] +3 1 0 0 +After: [1, 3, 3, 3] + +Before: [3, 0, 2, 1] +1 3 2 2 +After: [3, 0, 3, 1] + +Before: [1, 1, 2, 3] +13 1 0 2 +After: [1, 1, 1, 3] + +Before: [2, 1, 1, 1] +6 2 3 0 +After: [0, 1, 1, 1] + +Before: [1, 1, 2, 2] +1 3 1 3 +After: [1, 1, 2, 3] + +Before: [1, 2, 3, 3] +15 0 1 0 +After: [2, 2, 3, 3] + +Before: [0, 1, 2, 2] +5 1 0 3 +After: [0, 1, 2, 1] + +Before: [1, 2, 0, 3] +12 0 3 3 +After: [1, 2, 0, 0] + +Before: [1, 0, 3, 1] +6 3 3 1 +After: [1, 0, 3, 1] + +Before: [3, 0, 1, 2] +15 0 3 2 +After: [3, 0, 6, 2] + +Before: [3, 3, 2, 0] +8 1 2 2 +After: [3, 3, 6, 0] + +Before: [0, 1, 1, 2] +1 3 1 1 +After: [0, 3, 1, 2] + +Before: [2, 1, 3, 3] +9 0 1 1 +After: [2, 3, 3, 3] + +Before: [2, 3, 2, 3] +12 0 3 3 +After: [2, 3, 2, 0] + +Before: [2, 1, 0, 3] +9 1 3 2 +After: [2, 1, 3, 3] + +Before: [3, 0, 2, 1] +9 1 2 2 +After: [3, 0, 2, 1] + +Before: [2, 0, 1, 3] +8 0 3 0 +After: [6, 0, 1, 3] + +Before: [1, 0, 2, 1] +0 1 0 1 +After: [1, 1, 2, 1] + +Before: [2, 1, 2, 3] +8 2 3 3 +After: [2, 1, 2, 6] + +Before: [1, 0, 3, 3] +12 0 3 3 +After: [1, 0, 3, 0] + +Before: [0, 3, 3, 0] +4 2 2 2 +After: [0, 3, 5, 0] + +Before: [0, 3, 3, 3] +10 0 0 3 +After: [0, 3, 3, 0] + +Before: [3, 2, 2, 2] +14 2 2 2 +After: [3, 2, 4, 2] + +Before: [0, 3, 1, 3] +8 3 3 3 +After: [0, 3, 1, 9] + +Before: [0, 2, 0, 1] +3 1 1 3 +After: [0, 2, 0, 1] + +Before: [0, 2, 2, 1] +14 2 2 0 +After: [4, 2, 2, 1] + +Before: [1, 3, 0, 3] +2 1 3 1 +After: [1, 1, 0, 3] + +Before: [2, 3, 2, 3] +2 1 3 2 +After: [2, 3, 1, 3] + +Before: [3, 2, 2, 1] +7 1 0 2 +After: [3, 2, 1, 1] + +Before: [1, 3, 1, 3] +12 0 3 0 +After: [0, 3, 1, 3] + +Before: [1, 1, 2, 3] +8 1 2 1 +After: [1, 2, 2, 3] + +Before: [1, 2, 3, 0] +15 0 1 0 +After: [2, 2, 3, 0] + +Before: [1, 0, 0, 2] +0 1 0 2 +After: [1, 0, 1, 2] + +Before: [0, 2, 2, 3] +3 1 1 0 +After: [1, 2, 2, 3] + +Before: [3, 2, 2, 0] +3 1 1 0 +After: [1, 2, 2, 0] + +Before: [1, 3, 2, 1] +1 3 2 0 +After: [3, 3, 2, 1] + +Before: [1, 1, 3, 0] +13 1 0 1 +After: [1, 1, 3, 0] + +Before: [1, 1, 2, 1] +13 1 0 3 +After: [1, 1, 2, 1] + +Before: [1, 0, 1, 1] +0 1 0 0 +After: [1, 0, 1, 1] + +Before: [2, 3, 3, 2] +4 2 2 3 +After: [2, 3, 3, 5] + +Before: [3, 2, 1, 2] +7 1 0 3 +After: [3, 2, 1, 1] + +Before: [1, 0, 3, 2] +0 1 0 0 +After: [1, 0, 3, 2] + +Before: [0, 2, 0, 3] +10 0 0 1 +After: [0, 0, 0, 3] + +Before: [3, 1, 2, 3] +9 1 3 0 +After: [3, 1, 2, 3] + +Before: [0, 0, 3, 1] +1 3 2 0 +After: [3, 0, 3, 1] + +Before: [0, 3, 2, 1] +1 3 2 1 +After: [0, 3, 2, 1] + +Before: [3, 2, 3, 1] +15 3 1 3 +After: [3, 2, 3, 2] + +Before: [3, 2, 1, 1] +15 3 1 3 +After: [3, 2, 1, 2] + +Before: [2, 0, 0, 3] +12 0 3 0 +After: [0, 0, 0, 3] + +Before: [2, 2, 1, 2] +4 2 3 3 +After: [2, 2, 1, 4] + +Before: [0, 1, 2, 3] +8 3 3 2 +After: [0, 1, 9, 3] + +Before: [1, 2, 2, 3] +12 0 3 3 +After: [1, 2, 2, 0] + +Before: [2, 2, 0, 3] +8 1 2 3 +After: [2, 2, 0, 4] + +Before: [1, 0, 0, 3] +0 1 0 2 +After: [1, 0, 1, 3] + +Before: [0, 2, 0, 2] +10 0 0 2 +After: [0, 2, 0, 2] + +Before: [2, 2, 3, 2] +3 1 0 0 +After: [1, 2, 3, 2] + +Before: [2, 0, 0, 3] +12 0 3 2 +After: [2, 0, 0, 3] + +Before: [2, 0, 2, 3] +8 2 3 3 +After: [2, 0, 2, 6] + +Before: [1, 0, 2, 1] +0 1 0 2 +After: [1, 0, 1, 1] + +Before: [1, 2, 2, 3] +14 1 2 3 +After: [1, 2, 2, 4] + +Before: [0, 3, 1, 3] +11 0 1 2 +After: [0, 3, 3, 3] + +Before: [1, 0, 3, 2] +15 2 3 0 +After: [6, 0, 3, 2] + +Before: [0, 1, 1, 1] +5 1 0 3 +After: [0, 1, 1, 1] + +Before: [0, 1, 3, 2] +5 1 0 1 +After: [0, 1, 3, 2] + +Before: [3, 2, 1, 2] +8 1 2 3 +After: [3, 2, 1, 4] + +Before: [2, 1, 2, 3] +12 0 3 3 +After: [2, 1, 2, 0] + +Before: [0, 1, 0, 0] +5 1 0 2 +After: [0, 1, 1, 0] + +Before: [1, 1, 2, 1] +4 0 3 2 +After: [1, 1, 4, 1] + +Before: [1, 0, 3, 1] +4 2 2 1 +After: [1, 5, 3, 1] + +Before: [1, 1, 3, 1] +13 1 0 1 +After: [1, 1, 3, 1] + +Before: [3, 2, 3, 1] +7 1 0 3 +After: [3, 2, 3, 1] + +Before: [1, 1, 0, 2] +13 1 0 1 +After: [1, 1, 0, 2] + +Before: [3, 2, 0, 3] +7 1 0 3 +After: [3, 2, 0, 1] + +Before: [3, 2, 2, 1] +15 3 1 2 +After: [3, 2, 2, 1] + +Before: [0, 3, 0, 2] +15 1 3 1 +After: [0, 6, 0, 2] + +Before: [3, 2, 0, 3] +7 1 0 0 +After: [1, 2, 0, 3] + +Before: [3, 2, 0, 2] +7 1 0 1 +After: [3, 1, 0, 2] + +Before: [0, 2, 2, 3] +9 0 3 1 +After: [0, 3, 2, 3] + +Before: [0, 2, 2, 1] +11 0 3 1 +After: [0, 1, 2, 1] + +Before: [2, 2, 1, 0] +3 1 1 1 +After: [2, 1, 1, 0] + +Before: [2, 3, 3, 2] +15 2 3 1 +After: [2, 6, 3, 2] + +Before: [0, 2, 3, 2] +10 0 0 0 +After: [0, 2, 3, 2] + +Before: [1, 0, 2, 2] +9 0 3 2 +After: [1, 0, 3, 2] + +Before: [2, 1, 1, 3] +8 3 3 0 +After: [9, 1, 1, 3] + +Before: [1, 2, 3, 3] +9 0 2 0 +After: [3, 2, 3, 3] + +Before: [1, 2, 2, 1] +2 1 2 3 +After: [1, 2, 2, 1] + +Before: [1, 2, 0, 2] +15 0 1 1 +After: [1, 2, 0, 2] + +Before: [0, 2, 3, 0] +10 0 0 3 +After: [0, 2, 3, 0] + +Before: [2, 2, 0, 2] +3 1 1 2 +After: [2, 2, 1, 2] + +Before: [3, 2, 2, 2] +14 2 2 0 +After: [4, 2, 2, 2] + +Before: [0, 0, 3, 2] +15 2 3 0 +After: [6, 0, 3, 2] + +Before: [0, 3, 0, 3] +10 0 0 0 +After: [0, 3, 0, 3] + +Before: [0, 1, 1, 2] +6 3 3 3 +After: [0, 1, 1, 0] + +Before: [1, 2, 0, 3] +11 0 1 3 +After: [1, 2, 0, 3] + +Before: [0, 2, 1, 0] +6 1 2 3 +After: [0, 2, 1, 1] + +Before: [1, 0, 0, 0] +0 1 0 1 +After: [1, 1, 0, 0] + +Before: [3, 3, 1, 1] +6 3 3 2 +After: [3, 3, 0, 1] + +Before: [0, 1, 3, 3] +9 0 1 1 +After: [0, 1, 3, 3] + +Before: [1, 0, 1, 1] +0 1 0 1 +After: [1, 1, 1, 1] + +Before: [1, 1, 2, 0] +13 1 0 0 +After: [1, 1, 2, 0] + +Before: [2, 2, 2, 2] +14 2 2 1 +After: [2, 4, 2, 2] + +Before: [0, 1, 1, 3] +10 0 0 2 +After: [0, 1, 0, 3] + +Before: [0, 2, 1, 1] +10 0 0 3 +After: [0, 2, 1, 0] + +Before: [3, 3, 0, 3] +2 1 3 2 +After: [3, 3, 1, 3] + +Before: [0, 1, 3, 3] +10 0 0 0 +After: [0, 1, 3, 3] + +Before: [1, 0, 3, 3] +0 1 0 2 +After: [1, 0, 1, 3] + +Before: [0, 2, 3, 3] +10 0 0 1 +After: [0, 0, 3, 3] + +Before: [2, 3, 1, 2] +11 2 1 3 +After: [2, 3, 1, 3] + +Before: [3, 3, 3, 2] +4 0 1 2 +After: [3, 3, 4, 2] + +Before: [0, 0, 2, 0] +9 0 2 1 +After: [0, 2, 2, 0] + +Before: [1, 0, 1, 3] +0 1 0 2 +After: [1, 0, 1, 3] + +Before: [1, 2, 0, 1] +15 3 1 0 +After: [2, 2, 0, 1] + +Before: [1, 3, 3, 3] +12 0 3 2 +After: [1, 3, 0, 3] + +Before: [3, 3, 0, 3] +2 1 3 3 +After: [3, 3, 0, 1] + +Before: [0, 3, 1, 2] +11 0 1 1 +After: [0, 3, 1, 2] + +Before: [2, 0, 1, 0] +11 0 2 3 +After: [2, 0, 1, 3] + +Before: [2, 2, 2, 3] +2 1 2 0 +After: [1, 2, 2, 3] + +Before: [2, 0, 3, 1] +1 3 2 1 +After: [2, 3, 3, 1] + +Before: [0, 0, 3, 1] +10 0 0 2 +After: [0, 0, 0, 1] + +Before: [3, 2, 0, 0] +7 1 0 1 +After: [3, 1, 0, 0] + +Before: [1, 1, 0, 3] +13 1 0 3 +After: [1, 1, 0, 1] + +Before: [1, 2, 1, 3] +12 0 3 0 +After: [0, 2, 1, 3] + +Before: [1, 0, 2, 2] +14 3 2 0 +After: [4, 0, 2, 2] + +Before: [2, 2, 2, 1] +14 2 2 0 +After: [4, 2, 2, 1] + +Before: [2, 3, 1, 3] +11 2 0 2 +After: [2, 3, 3, 3] + +Before: [0, 1, 3, 3] +5 1 0 2 +After: [0, 1, 1, 3] + +Before: [3, 3, 3, 3] +2 1 3 3 +After: [3, 3, 3, 1] + +Before: [1, 1, 2, 2] +13 1 0 1 +After: [1, 1, 2, 2] + +Before: [0, 1, 2, 2] +5 1 0 1 +After: [0, 1, 2, 2] + +Before: [1, 0, 1, 1] +4 2 3 3 +After: [1, 0, 1, 4] + +Before: [2, 2, 1, 1] +15 3 1 1 +After: [2, 2, 1, 1] + +Before: [1, 3, 0, 1] +11 0 1 3 +After: [1, 3, 0, 3] + +Before: [3, 3, 2, 3] +8 2 3 3 +After: [3, 3, 2, 6] + +Before: [3, 1, 1, 1] +6 2 3 0 +After: [0, 1, 1, 1] + +Before: [0, 3, 0, 2] +6 3 3 1 +After: [0, 0, 0, 2] + +Before: [0, 2, 3, 1] +15 3 1 0 +After: [2, 2, 3, 1] + +Before: [1, 0, 3, 3] +12 0 3 2 +After: [1, 0, 0, 3] + +Before: [0, 1, 3, 1] +1 3 2 3 +After: [0, 1, 3, 3] + +Before: [2, 1, 2, 2] +9 1 2 3 +After: [2, 1, 2, 3] + +Before: [2, 1, 2, 2] +9 0 1 3 +After: [2, 1, 2, 3] + +Before: [1, 0, 1, 2] +0 1 0 2 +After: [1, 0, 1, 2] + +Before: [1, 0, 1, 0] +0 1 0 2 +After: [1, 0, 1, 0] + +Before: [3, 2, 2, 1] +3 1 1 3 +After: [3, 2, 2, 1] + +Before: [0, 3, 2, 3] +2 1 3 3 +After: [0, 3, 2, 1] + +Before: [1, 2, 3, 3] +6 1 0 1 +After: [1, 1, 3, 3] + +Before: [2, 2, 2, 2] +2 1 2 3 +After: [2, 2, 2, 1] + +Before: [2, 2, 2, 1] +3 1 1 2 +After: [2, 2, 1, 1] + +Before: [1, 1, 0, 2] +13 1 0 0 +After: [1, 1, 0, 2] + +Before: [2, 0, 0, 3] +12 0 3 3 +After: [2, 0, 0, 0] + +Before: [1, 1, 1, 1] +6 2 3 0 +After: [0, 1, 1, 1] + +Before: [3, 2, 1, 3] +11 2 0 0 +After: [3, 2, 1, 3] + +Before: [1, 3, 1, 2] +15 1 3 1 +After: [1, 6, 1, 2] + +Before: [0, 2, 1, 0] +3 1 1 0 +After: [1, 2, 1, 0] + +Before: [1, 1, 1, 3] +12 0 3 3 +After: [1, 1, 1, 0] + +Before: [3, 2, 3, 2] +3 1 1 2 +After: [3, 2, 1, 2] + +Before: [1, 0, 2, 0] +9 0 2 1 +After: [1, 3, 2, 0] + +Before: [3, 3, 1, 2] +8 3 2 0 +After: [4, 3, 1, 2] + +Before: [1, 1, 0, 3] +13 1 0 0 +After: [1, 1, 0, 3] + +Before: [1, 1, 3, 0] +13 1 0 0 +After: [1, 1, 3, 0] + +Before: [3, 0, 2, 3] +8 3 2 3 +After: [3, 0, 2, 6] + +Before: [2, 3, 3, 2] +15 2 3 2 +After: [2, 3, 6, 2] + +Before: [1, 1, 0, 2] +13 1 0 3 +After: [1, 1, 0, 1] + +Before: [0, 1, 2, 1] +1 3 2 2 +After: [0, 1, 3, 1] + +Before: [3, 0, 2, 1] +6 3 3 2 +After: [3, 0, 0, 1] + +Before: [3, 2, 1, 0] +7 1 0 3 +After: [3, 2, 1, 1] + +Before: [3, 2, 1, 2] +15 0 3 1 +After: [3, 6, 1, 2] + +Before: [1, 2, 1, 1] +11 1 2 1 +After: [1, 3, 1, 1] + +Before: [3, 0, 2, 0] +14 2 2 1 +After: [3, 4, 2, 0] + +Before: [0, 2, 3, 1] +1 3 2 3 +After: [0, 2, 3, 3] + +Before: [3, 1, 3, 0] +11 1 0 0 +After: [3, 1, 3, 0] + +Before: [2, 3, 1, 1] +6 2 3 1 +After: [2, 0, 1, 1] + +Before: [3, 2, 0, 0] +7 1 0 2 +After: [3, 2, 1, 0] + +Before: [1, 1, 3, 1] +13 1 0 2 +After: [1, 1, 1, 1] + +Before: [0, 3, 1, 3] +2 1 3 2 +After: [0, 3, 1, 3] + +Before: [0, 1, 2, 2] +5 1 0 2 +After: [0, 1, 1, 2] + +Before: [1, 2, 3, 3] +12 0 3 3 +After: [1, 2, 3, 0] + +Before: [0, 1, 0, 1] +6 3 3 2 +After: [0, 1, 0, 1] + +Before: [2, 2, 3, 1] +4 1 3 3 +After: [2, 2, 3, 5] + +Before: [1, 2, 3, 3] +9 0 3 2 +After: [1, 2, 3, 3] + +Before: [1, 0, 0, 0] +0 1 0 3 +After: [1, 0, 0, 1] + +Before: [2, 1, 2, 1] +4 2 3 2 +After: [2, 1, 5, 1] + +Before: [0, 3, 3, 3] +2 1 3 2 +After: [0, 3, 1, 3] + +Before: [1, 0, 0, 1] +0 1 0 1 +After: [1, 1, 0, 1] + +Before: [2, 2, 3, 1] +1 3 2 2 +After: [2, 2, 3, 1] + +Before: [1, 0, 1, 0] +0 1 0 1 +After: [1, 1, 1, 0] + +Before: [2, 0, 0, 0] +11 1 0 0 +After: [2, 0, 0, 0] + +Before: [2, 0, 1, 1] +8 0 2 1 +After: [2, 4, 1, 1] + +Before: [3, 2, 2, 1] +2 1 2 2 +After: [3, 2, 1, 1] + +Before: [3, 2, 3, 2] +7 1 0 1 +After: [3, 1, 3, 2] + +Before: [3, 3, 3, 3] +4 3 2 3 +After: [3, 3, 3, 5] + +Before: [1, 2, 2, 2] +2 1 2 3 +After: [1, 2, 2, 1] + +Before: [2, 3, 0, 3] +2 1 3 2 +After: [2, 3, 1, 3] + +Before: [0, 3, 2, 1] +11 0 3 0 +After: [1, 3, 2, 1] + +Before: [1, 1, 2, 0] +13 1 0 3 +After: [1, 1, 2, 1] + +Before: [3, 2, 1, 3] +7 1 0 0 +After: [1, 2, 1, 3] + +Before: [0, 1, 3, 2] +5 1 0 0 +After: [1, 1, 3, 2] + +Before: [3, 1, 0, 0] +11 1 0 2 +After: [3, 1, 3, 0] + +Before: [2, 3, 2, 1] +1 3 2 2 +After: [2, 3, 3, 1] + +Before: [0, 1, 1, 0] +5 1 0 3 +After: [0, 1, 1, 1] + +Before: [0, 1, 2, 3] +14 2 2 2 +After: [0, 1, 4, 3] + +Before: [1, 0, 3, 2] +0 1 0 2 +After: [1, 0, 1, 2] + +Before: [3, 1, 1, 1] +6 3 3 1 +After: [3, 0, 1, 1] + +Before: [2, 0, 3, 2] +11 1 2 1 +After: [2, 3, 3, 2] + +Before: [0, 2, 2, 1] +14 1 2 0 +After: [4, 2, 2, 1] + +Before: [0, 1, 1, 2] +10 0 0 3 +After: [0, 1, 1, 0] + +Before: [0, 0, 0, 1] +10 0 0 1 +After: [0, 0, 0, 1] + +Before: [0, 1, 0, 1] +9 0 1 3 +After: [0, 1, 0, 1] + +Before: [0, 2, 0, 0] +10 0 0 3 +After: [0, 2, 0, 0] + +Before: [1, 0, 2, 0] +11 2 0 1 +After: [1, 3, 2, 0] + +Before: [1, 2, 0, 0] +11 0 1 1 +After: [1, 3, 0, 0] + +Before: [1, 1, 2, 1] +13 1 0 0 +After: [1, 1, 2, 1] + +Before: [1, 1, 3, 3] +9 1 2 3 +After: [1, 1, 3, 3] + +Before: [0, 0, 3, 2] +10 0 0 1 +After: [0, 0, 3, 2] + +Before: [1, 3, 1, 3] +12 0 3 1 +After: [1, 0, 1, 3] + +Before: [0, 3, 2, 1] +14 2 2 1 +After: [0, 4, 2, 1] + +Before: [3, 2, 3, 1] +7 1 0 0 +After: [1, 2, 3, 1] + +Before: [0, 2, 2, 0] +3 1 1 0 +After: [1, 2, 2, 0] + +Before: [1, 1, 3, 0] +9 0 2 1 +After: [1, 3, 3, 0] + +Before: [2, 0, 2, 1] +6 3 3 0 +After: [0, 0, 2, 1] + +Before: [2, 0, 2, 1] +1 3 2 1 +After: [2, 3, 2, 1] + +Before: [1, 2, 2, 3] +3 1 1 3 +After: [1, 2, 2, 1] + +Before: [2, 2, 2, 2] +2 1 2 2 +After: [2, 2, 1, 2] + +Before: [1, 3, 1, 3] +2 1 3 0 +After: [1, 3, 1, 3] + +Before: [2, 3, 1, 2] +8 3 2 2 +After: [2, 3, 4, 2] + +Before: [1, 1, 2, 3] +13 1 0 3 +After: [1, 1, 2, 1] + +Before: [0, 2, 1, 3] +4 3 2 0 +After: [5, 2, 1, 3] + +Before: [2, 1, 1, 3] +12 0 3 0 +After: [0, 1, 1, 3] + +Before: [0, 0, 3, 1] +4 3 3 0 +After: [4, 0, 3, 1] + +Before: [2, 0, 3, 2] +15 2 3 1 +After: [2, 6, 3, 2] + +Before: [1, 0, 3, 3] +0 1 0 1 +After: [1, 1, 3, 3] + +Before: [0, 2, 0, 1] +10 0 0 2 +After: [0, 2, 0, 1] + +Before: [2, 1, 2, 2] +1 3 1 2 +After: [2, 1, 3, 2] + +Before: [3, 2, 2, 0] +7 1 0 3 +After: [3, 2, 2, 1] + +Before: [2, 3, 2, 3] +12 0 3 1 +After: [2, 0, 2, 3] + +Before: [0, 0, 3, 0] +10 0 0 2 +After: [0, 0, 0, 0] + +Before: [3, 2, 3, 3] +7 1 0 2 +After: [3, 2, 1, 3] + +Before: [2, 2, 3, 2] +3 1 1 2 +After: [2, 2, 1, 2] + +Before: [1, 0, 3, 1] +4 2 2 2 +After: [1, 0, 5, 1] + +Before: [2, 0, 1, 1] +6 3 3 3 +After: [2, 0, 1, 0] + +Before: [2, 0, 3, 2] +15 2 3 2 +After: [2, 0, 6, 2] + +Before: [1, 2, 1, 3] +12 0 3 3 +After: [1, 2, 1, 0] + +Before: [3, 1, 1, 2] +15 0 3 1 +After: [3, 6, 1, 2] + +Before: [1, 0, 0, 3] +4 0 1 1 +After: [1, 2, 0, 3] + +Before: [0, 3, 0, 0] +10 0 0 0 +After: [0, 3, 0, 0] + +Before: [1, 3, 2, 2] +9 0 2 1 +After: [1, 3, 2, 2] + +Before: [0, 2, 1, 0] +10 0 0 3 +After: [0, 2, 1, 0] + +Before: [0, 1, 0, 1] +6 3 3 3 +After: [0, 1, 0, 0] + +Before: [2, 0, 3, 3] +12 0 3 2 +After: [2, 0, 0, 3] + +Before: [2, 0, 2, 2] +9 1 2 2 +After: [2, 0, 2, 2] + +Before: [0, 1, 0, 1] +5 1 0 1 +After: [0, 1, 0, 1] + +Before: [0, 3, 2, 2] +14 3 2 1 +After: [0, 4, 2, 2] + +Before: [1, 1, 3, 3] +13 1 0 0 +After: [1, 1, 3, 3] + +Before: [3, 2, 2, 1] +8 0 2 2 +After: [3, 2, 6, 1] + +Before: [3, 2, 1, 3] +11 2 0 2 +After: [3, 2, 3, 3] + +Before: [3, 3, 1, 3] +3 1 0 2 +After: [3, 3, 1, 3] + +Before: [2, 0, 0, 1] +6 3 3 3 +After: [2, 0, 0, 0] + +Before: [0, 0, 3, 2] +10 0 0 2 +After: [0, 0, 0, 2] + +Before: [1, 1, 3, 1] +6 3 3 1 +After: [1, 0, 3, 1] + +Before: [0, 0, 2, 2] +10 0 0 3 +After: [0, 0, 2, 0] + +Before: [0, 0, 0, 2] +6 3 3 0 +After: [0, 0, 0, 2] + +Before: [1, 0, 2, 1] +14 2 2 2 +After: [1, 0, 4, 1] + +Before: [1, 1, 1, 2] +13 1 0 3 +After: [1, 1, 1, 1] + +Before: [1, 3, 1, 3] +11 2 1 2 +After: [1, 3, 3, 3] + +Before: [2, 1, 1, 2] +1 3 1 1 +After: [2, 3, 1, 2] + +Before: [3, 0, 1, 0] +11 1 0 1 +After: [3, 3, 1, 0] + +Before: [0, 2, 3, 2] +11 0 2 0 +After: [3, 2, 3, 2] + +Before: [1, 0, 1, 3] +12 0 3 2 +After: [1, 0, 0, 3] + +Before: [1, 1, 0, 0] +13 1 0 1 +After: [1, 1, 0, 0] + +Before: [0, 1, 2, 0] +5 1 0 2 +After: [0, 1, 1, 0] + +Before: [3, 1, 0, 2] +15 0 3 2 +After: [3, 1, 6, 2] + +Before: [2, 0, 1, 0] +8 0 2 3 +After: [2, 0, 1, 4] + +Before: [3, 1, 1, 2] +1 3 1 2 +After: [3, 1, 3, 2] + +Before: [1, 2, 0, 1] +15 3 1 3 +After: [1, 2, 0, 2] + +Before: [2, 1, 3, 2] +9 1 3 3 +After: [2, 1, 3, 3] + +Before: [0, 3, 0, 1] +10 0 0 1 +After: [0, 0, 0, 1] + +Before: [3, 0, 3, 1] +1 3 2 2 +After: [3, 0, 3, 1] + +Before: [2, 0, 3, 1] +4 0 3 1 +After: [2, 5, 3, 1] + +Before: [2, 3, 2, 1] +14 0 2 2 +After: [2, 3, 4, 1] + +Before: [3, 2, 2, 3] +3 1 1 1 +After: [3, 1, 2, 3] + +Before: [0, 1, 0, 3] +5 1 0 2 +After: [0, 1, 1, 3] + +Before: [1, 3, 1, 3] +12 0 3 3 +After: [1, 3, 1, 0] + +Before: [1, 1, 1, 3] +13 1 0 0 +After: [1, 1, 1, 3] + +Before: [0, 0, 3, 0] +10 0 0 1 +After: [0, 0, 3, 0] + +Before: [2, 2, 0, 2] +3 1 1 1 +After: [2, 1, 0, 2] + +Before: [0, 0, 0, 0] +10 0 0 3 +After: [0, 0, 0, 0] + +Before: [0, 1, 2, 3] +14 2 2 1 +After: [0, 4, 2, 3] + +Before: [0, 1, 2, 1] +1 3 2 0 +After: [3, 1, 2, 1] + +Before: [1, 2, 0, 1] +15 0 1 3 +After: [1, 2, 0, 2] + +Before: [1, 3, 2, 3] +8 1 2 0 +After: [6, 3, 2, 3] + +Before: [2, 2, 2, 2] +14 0 2 3 +After: [2, 2, 2, 4] + +Before: [3, 0, 2, 2] +14 3 2 2 +After: [3, 0, 4, 2] + +Before: [3, 2, 0, 1] +6 3 3 2 +After: [3, 2, 0, 1] + +Before: [1, 1, 2, 3] +8 3 2 2 +After: [1, 1, 6, 3] + +Before: [0, 1, 0, 3] +10 0 0 1 +After: [0, 0, 0, 3] + +Before: [3, 3, 0, 2] +15 1 3 0 +After: [6, 3, 0, 2] + +Before: [1, 0, 0, 0] +0 1 0 2 +After: [1, 0, 1, 0] + +Before: [1, 3, 3, 3] +2 1 3 0 +After: [1, 3, 3, 3] + +Before: [3, 3, 2, 1] +3 1 0 2 +After: [3, 3, 1, 1] + +Before: [3, 2, 2, 1] +7 1 0 3 +After: [3, 2, 2, 1] + +Before: [3, 2, 2, 0] +9 3 2 3 +After: [3, 2, 2, 2] + +Before: [1, 1, 1, 3] +12 0 3 2 +After: [1, 1, 0, 3] + +Before: [2, 2, 0, 3] +12 0 3 0 +After: [0, 2, 0, 3] + +Before: [3, 1, 2, 1] +1 3 2 0 +After: [3, 1, 2, 1] + +Before: [3, 2, 0, 3] +9 2 3 2 +After: [3, 2, 3, 3] + +Before: [1, 2, 0, 0] +15 0 1 0 +After: [2, 2, 0, 0] + +Before: [1, 2, 1, 2] +6 1 0 3 +After: [1, 2, 1, 1] + +Before: [2, 0, 3, 1] +1 3 2 2 +After: [2, 0, 3, 1] + +Before: [0, 0, 2, 3] +8 3 3 3 +After: [0, 0, 2, 9] + +Before: [3, 2, 3, 0] +11 3 1 1 +After: [3, 2, 3, 0] + +Before: [2, 2, 2, 2] +3 1 0 1 +After: [2, 1, 2, 2] + +Before: [1, 2, 0, 1] +15 3 1 1 +After: [1, 2, 0, 1] + +Before: [3, 2, 2, 0] +14 2 2 3 +After: [3, 2, 2, 4] + +Before: [0, 0, 0, 1] +6 3 3 0 +After: [0, 0, 0, 1] + +Before: [1, 0, 3, 0] +0 1 0 3 +After: [1, 0, 3, 1] + +Before: [3, 2, 3, 2] +7 1 0 2 +After: [3, 2, 1, 2] + +Before: [0, 3, 3, 3] +3 1 2 3 +After: [0, 3, 3, 1] + +Before: [1, 0, 1, 2] +8 3 2 2 +After: [1, 0, 4, 2] + +Before: [0, 2, 1, 3] +10 0 0 2 +After: [0, 2, 0, 3] + +Before: [2, 3, 2, 2] +14 3 2 3 +After: [2, 3, 2, 4] + +Before: [3, 0, 2, 1] +1 3 2 0 +After: [3, 0, 2, 1] + +Before: [0, 0, 2, 1] +6 3 3 1 +After: [0, 0, 2, 1] + +Before: [0, 1, 1, 2] +9 0 1 0 +After: [1, 1, 1, 2] + +Before: [3, 2, 0, 2] +7 1 0 2 +After: [3, 2, 1, 2] + +Before: [2, 2, 1, 2] +4 2 3 0 +After: [4, 2, 1, 2] + +Before: [0, 2, 3, 2] +3 1 1 0 +After: [1, 2, 3, 2] + +Before: [3, 1, 3, 1] +4 2 3 0 +After: [6, 1, 3, 1] + +Before: [2, 3, 0, 1] +6 3 3 0 +After: [0, 3, 0, 1] + +Before: [2, 2, 3, 1] +4 2 3 2 +After: [2, 2, 6, 1] + +Before: [0, 1, 2, 1] +1 3 2 1 +After: [0, 3, 2, 1] + +Before: [2, 2, 2, 3] +2 1 2 3 +After: [2, 2, 2, 1] + +Before: [3, 0, 1, 2] +8 3 2 1 +After: [3, 4, 1, 2] + +Before: [2, 2, 3, 3] +3 1 1 3 +After: [2, 2, 3, 1] + +Before: [3, 2, 2, 2] +7 1 0 3 +After: [3, 2, 2, 1] + +Before: [3, 2, 1, 2] +4 0 1 1 +After: [3, 4, 1, 2] + +Before: [1, 0, 0, 2] +6 3 3 0 +After: [0, 0, 0, 2] + +Before: [2, 3, 2, 1] +1 3 2 1 +After: [2, 3, 2, 1] + +Before: [3, 2, 1, 0] +7 1 0 2 +After: [3, 2, 1, 0] + +Before: [1, 1, 0, 0] +13 1 0 3 +After: [1, 1, 0, 1] + +Before: [3, 2, 2, 2] +2 1 2 0 +After: [1, 2, 2, 2] + +Before: [0, 2, 3, 2] +4 3 3 1 +After: [0, 5, 3, 2] + +Before: [0, 0, 3, 3] +9 0 3 0 +After: [3, 0, 3, 3] + +Before: [2, 2, 3, 0] +8 1 2 3 +After: [2, 2, 3, 4] + +Before: [1, 2, 1, 3] +3 1 1 1 +After: [1, 1, 1, 3] + +Before: [0, 1, 1, 3] +5 1 0 3 +After: [0, 1, 1, 1] + +Before: [1, 3, 2, 1] +14 2 2 0 +After: [4, 3, 2, 1] + +Before: [1, 0, 1, 2] +0 1 0 0 +After: [1, 0, 1, 2] + +Before: [0, 1, 2, 1] +11 0 3 1 +After: [0, 1, 2, 1] + +Before: [3, 3, 3, 2] +15 1 3 0 +After: [6, 3, 3, 2] + +Before: [1, 0, 3, 1] +0 1 0 1 +After: [1, 1, 3, 1] + +Before: [3, 3, 2, 1] +4 3 1 0 +After: [2, 3, 2, 1] + +Before: [2, 2, 1, 3] +3 1 1 1 +After: [2, 1, 1, 3] + +Before: [2, 3, 0, 2] +4 3 3 1 +After: [2, 5, 0, 2] + +Before: [1, 1, 0, 2] +1 3 1 2 +After: [1, 1, 3, 2] + +Before: [3, 2, 2, 2] +7 1 0 2 +After: [3, 2, 1, 2] + +Before: [3, 2, 3, 3] +7 1 0 1 +After: [3, 1, 3, 3] + +Before: [3, 0, 0, 2] +6 3 3 3 +After: [3, 0, 0, 0] + +Before: [2, 3, 1, 3] +2 1 3 2 +After: [2, 3, 1, 3] + +Before: [2, 2, 0, 3] +12 0 3 3 +After: [2, 2, 0, 0] + +Before: [2, 3, 1, 3] +2 1 3 1 +After: [2, 1, 1, 3] + +Before: [0, 3, 3, 3] +2 1 3 0 +After: [1, 3, 3, 3] + +Before: [1, 1, 1, 2] +13 1 0 1 +After: [1, 1, 1, 2] + +Before: [2, 0, 3, 1] +6 3 3 3 +After: [2, 0, 3, 0] + +Before: [1, 2, 1, 1] +11 2 1 2 +After: [1, 2, 3, 1] + +Before: [1, 3, 0, 2] +9 0 3 0 +After: [3, 3, 0, 2] + +Before: [1, 3, 3, 3] +8 3 3 2 +After: [1, 3, 9, 3] + +Before: [3, 3, 3, 2] +3 1 2 2 +After: [3, 3, 1, 2] + +Before: [3, 2, 3, 3] +3 1 1 3 +After: [3, 2, 3, 1] + +Before: [3, 3, 2, 2] +14 3 2 2 +After: [3, 3, 4, 2] + +Before: [0, 2, 3, 0] +3 1 1 1 +After: [0, 1, 3, 0] + +Before: [0, 1, 3, 1] +10 0 0 2 +After: [0, 1, 0, 1] + +Before: [0, 0, 0, 3] +10 0 0 3 +After: [0, 0, 0, 0] + +Before: [2, 0, 2, 3] +14 2 2 0 +After: [4, 0, 2, 3] + +Before: [1, 0, 3, 2] +4 3 3 0 +After: [5, 0, 3, 2] + +Before: [0, 1, 2, 1] +5 1 0 3 +After: [0, 1, 2, 1] + +Before: [0, 3, 2, 3] +2 1 3 1 +After: [0, 1, 2, 3] + +Before: [3, 1, 2, 0] +14 2 2 3 +After: [3, 1, 2, 4] + +Before: [1, 3, 0, 3] +11 0 1 0 +After: [3, 3, 0, 3] + +Before: [3, 2, 2, 3] +7 1 0 2 +After: [3, 2, 1, 3] + +Before: [2, 2, 1, 3] +8 0 3 2 +After: [2, 2, 6, 3] + +Before: [0, 2, 3, 1] +10 0 0 2 +After: [0, 2, 0, 1] + +Before: [1, 0, 2, 1] +1 3 2 0 +After: [3, 0, 2, 1] + +Before: [3, 2, 2, 1] +2 1 2 1 +After: [3, 1, 2, 1] + +Before: [3, 2, 1, 3] +7 1 0 1 +After: [3, 1, 1, 3] + +Before: [1, 1, 2, 1] +1 3 2 1 +After: [1, 3, 2, 1] + +Before: [0, 1, 3, 2] +5 1 0 2 +After: [0, 1, 1, 2] + +Before: [3, 1, 0, 3] +4 0 2 1 +After: [3, 5, 0, 3] + +Before: [1, 0, 3, 2] +0 1 0 1 +After: [1, 1, 3, 2] + +Before: [0, 2, 0, 1] +10 0 0 0 +After: [0, 2, 0, 1] + +Before: [1, 1, 0, 1] +13 1 0 0 +After: [1, 1, 0, 1] + +Before: [1, 0, 3, 3] +4 2 2 1 +After: [1, 5, 3, 3] + +Before: [0, 1, 2, 2] +10 0 0 3 +After: [0, 1, 2, 0] + +Before: [2, 2, 3, 1] +4 2 2 2 +After: [2, 2, 5, 1] + +Before: [1, 3, 1, 3] +2 1 3 1 +After: [1, 1, 1, 3] + +Before: [0, 1, 3, 3] +5 1 0 1 +After: [0, 1, 3, 3] + +Before: [0, 0, 1, 1] +10 0 0 0 +After: [0, 0, 1, 1] + +Before: [2, 0, 2, 3] +12 0 3 2 +After: [2, 0, 0, 3] + +Before: [0, 2, 3, 1] +3 1 1 2 +After: [0, 2, 1, 1] + +Before: [0, 3, 1, 0] +4 1 2 3 +After: [0, 3, 1, 5] + +Before: [1, 2, 1, 3] +6 1 0 3 +After: [1, 2, 1, 1] + +Before: [0, 1, 0, 0] +5 1 0 3 +After: [0, 1, 0, 1] + +Before: [0, 0, 3, 2] +11 1 2 2 +After: [0, 0, 3, 2] + +Before: [1, 1, 3, 3] +12 0 3 3 +After: [1, 1, 3, 0] + +Before: [2, 3, 1, 2] +11 2 1 2 +After: [2, 3, 3, 2] + +Before: [1, 1, 3, 3] +12 0 3 2 +After: [1, 1, 0, 3] + +Before: [1, 2, 2, 2] +2 1 2 2 +After: [1, 2, 1, 2] + +Before: [2, 3, 2, 2] +15 1 3 0 +After: [6, 3, 2, 2] + +Before: [0, 0, 2, 1] +4 3 1 2 +After: [0, 0, 2, 1] + +Before: [3, 3, 1, 3] +2 1 3 3 +After: [3, 3, 1, 1] + +Before: [0, 1, 1, 3] +11 0 2 0 +After: [1, 1, 1, 3] + +Before: [1, 1, 1, 3] +13 1 0 1 +After: [1, 1, 1, 3] + +Before: [1, 3, 2, 1] +14 2 2 2 +After: [1, 3, 4, 1] + +Before: [0, 1, 2, 2] +5 1 0 0 +After: [1, 1, 2, 2] + +Before: [2, 2, 0, 0] +3 1 0 0 +After: [1, 2, 0, 0] + +Before: [0, 2, 3, 1] +10 0 0 3 +After: [0, 2, 3, 0] + +Before: [1, 3, 2, 3] +12 0 3 1 +After: [1, 0, 2, 3] + +Before: [1, 3, 3, 1] +1 3 2 1 +After: [1, 3, 3, 1] + +Before: [0, 2, 0, 3] +4 3 2 2 +After: [0, 2, 5, 3] + +Before: [1, 2, 2, 1] +14 2 2 3 +After: [1, 2, 2, 4] + +Before: [2, 3, 3, 1] +3 1 2 0 +After: [1, 3, 3, 1] + +Before: [3, 2, 3, 2] +7 1 0 3 +After: [3, 2, 3, 1] + +Before: [1, 0, 3, 2] +11 1 3 0 +After: [2, 0, 3, 2] + +Before: [3, 0, 2, 1] +8 3 2 1 +After: [3, 2, 2, 1] + +Before: [2, 1, 3, 2] +15 2 3 3 +After: [2, 1, 3, 6] + +Before: [1, 2, 2, 0] +2 1 2 2 +After: [1, 2, 1, 0] + +Before: [3, 3, 0, 2] +3 1 0 2 +After: [3, 3, 1, 2] + +Before: [2, 2, 1, 1] +6 1 2 0 +After: [1, 2, 1, 1] + +Before: [1, 0, 3, 3] +0 1 0 0 +After: [1, 0, 3, 3] + +Before: [1, 1, 1, 0] +13 1 0 0 +After: [1, 1, 1, 0] + +Before: [2, 2, 2, 1] +1 3 2 2 +After: [2, 2, 3, 1] + +Before: [2, 2, 2, 1] +2 1 2 2 +After: [2, 2, 1, 1] + +Before: [3, 1, 1, 1] +6 3 3 2 +After: [3, 1, 0, 1] + +Before: [3, 1, 3, 3] +9 1 3 1 +After: [3, 3, 3, 3] + +Before: [0, 2, 3, 2] +10 0 0 2 +After: [0, 2, 0, 2] + +Before: [0, 3, 1, 1] +11 0 2 3 +After: [0, 3, 1, 1] + +Before: [1, 0, 3, 1] +1 3 2 2 +After: [1, 0, 3, 1] + +Before: [2, 1, 2, 2] +1 3 1 1 +After: [2, 3, 2, 2] + +Before: [3, 2, 2, 3] +2 1 2 0 +After: [1, 2, 2, 3] + +Before: [1, 0, 0, 2] +0 1 0 0 +After: [1, 0, 0, 2] + +Before: [0, 1, 0, 1] +10 0 0 0 +After: [0, 1, 0, 1] + +Before: [1, 0, 0, 3] +12 0 3 3 +After: [1, 0, 0, 0] + +Before: [1, 1, 0, 3] +13 1 0 1 +After: [1, 1, 0, 3] + +Before: [1, 0, 0, 3] +0 1 0 0 +After: [1, 0, 0, 3] + +Before: [3, 2, 1, 3] +7 1 0 3 +After: [3, 2, 1, 1] + +Before: [0, 3, 3, 3] +2 1 3 3 +After: [0, 3, 3, 1] + +Before: [3, 2, 1, 2] +7 1 0 1 +After: [3, 1, 1, 2] + +Before: [3, 2, 0, 1] +4 3 3 0 +After: [4, 2, 0, 1] + +Before: [3, 2, 1, 0] +6 1 2 2 +After: [3, 2, 1, 0] + +Before: [0, 1, 1, 2] +5 1 0 1 +After: [0, 1, 1, 2] + +Before: [3, 3, 3, 3] +2 1 3 1 +After: [3, 1, 3, 3] + +Before: [1, 3, 3, 2] +15 2 3 2 +After: [1, 3, 6, 2] + +Before: [3, 2, 3, 1] +15 3 1 2 +After: [3, 2, 2, 1] + +Before: [3, 3, 0, 3] +4 1 1 2 +After: [3, 3, 4, 3] + +Before: [0, 0, 2, 3] +9 0 3 1 +After: [0, 3, 2, 3] + +Before: [1, 3, 3, 1] +1 3 2 2 +After: [1, 3, 3, 1] + +Before: [3, 0, 2, 2] +15 0 3 0 +After: [6, 0, 2, 2] + +Before: [0, 1, 3, 3] +9 0 1 3 +After: [0, 1, 3, 1] + +Before: [1, 3, 3, 2] +4 1 1 3 +After: [1, 3, 3, 4] + +Before: [1, 0, 2, 2] +0 1 0 1 +After: [1, 1, 2, 2] + +Before: [1, 2, 2, 1] +15 3 1 0 +After: [2, 2, 2, 1] + +Before: [0, 1, 2, 1] +5 1 0 1 +After: [0, 1, 2, 1] + +Before: [1, 2, 1, 1] +15 0 1 0 +After: [2, 2, 1, 1] + +Before: [1, 1, 0, 3] +13 1 0 2 +After: [1, 1, 1, 3] + +Before: [2, 1, 2, 3] +14 0 2 0 +After: [4, 1, 2, 3] + +Before: [1, 3, 2, 3] +8 2 3 3 +After: [1, 3, 2, 6] + +Before: [0, 1, 1, 1] +9 0 1 1 +After: [0, 1, 1, 1] + +Before: [2, 0, 1, 2] +8 3 2 3 +After: [2, 0, 1, 4] + +Before: [1, 0, 1, 1] +0 1 0 3 +After: [1, 0, 1, 1] + +Before: [2, 3, 1, 1] +6 3 3 3 +After: [2, 3, 1, 0] + +Before: [3, 2, 3, 3] +7 1 0 3 +After: [3, 2, 3, 1] + +Before: [1, 3, 3, 3] +3 1 2 1 +After: [1, 1, 3, 3] + +Before: [0, 1, 1, 3] +5 1 0 2 +After: [0, 1, 1, 3] + +Before: [3, 3, 1, 3] +2 1 3 1 +After: [3, 1, 1, 3] + +Before: [0, 1, 2, 0] +5 1 0 0 +After: [1, 1, 2, 0] + +Before: [2, 1, 2, 0] +9 1 2 0 +After: [3, 1, 2, 0] + +Before: [0, 0, 3, 1] +10 0 0 1 +After: [0, 0, 3, 1] + +Before: [0, 1, 0, 2] +1 3 1 1 +After: [0, 3, 0, 2] + +Before: [3, 0, 1, 0] +11 1 0 2 +After: [3, 0, 3, 0] + +Before: [1, 2, 3, 1] +6 1 0 3 +After: [1, 2, 3, 1] + +Before: [1, 0, 3, 0] +0 1 0 0 +After: [1, 0, 3, 0] + +Before: [0, 2, 1, 0] +11 0 1 3 +After: [0, 2, 1, 2] + +Before: [1, 1, 1, 0] +13 1 0 3 +After: [1, 1, 1, 1] + +Before: [1, 2, 3, 1] +1 3 2 3 +After: [1, 2, 3, 3] + +Before: [0, 1, 3, 0] +5 1 0 2 +After: [0, 1, 1, 0] + +Before: [3, 0, 2, 2] +6 3 3 0 +After: [0, 0, 2, 2] + +Before: [1, 2, 3, 1] +6 3 3 3 +After: [1, 2, 3, 0] + +Before: [3, 2, 0, 1] +7 1 0 2 +After: [3, 2, 1, 1] + +Before: [1, 1, 3, 2] +13 1 0 1 +After: [1, 1, 3, 2] + +Before: [0, 0, 1, 2] +10 0 0 2 +After: [0, 0, 0, 2] + +Before: [3, 2, 2, 2] +6 3 3 0 +After: [0, 2, 2, 2] + +Before: [1, 0, 2, 0] +0 1 0 0 +After: [1, 0, 2, 0] + +Before: [1, 0, 2, 2] +9 0 2 3 +After: [1, 0, 2, 3] + +Before: [2, 0, 3, 3] +12 0 3 1 +After: [2, 0, 3, 3] + +Before: [2, 3, 0, 3] +2 1 3 1 +After: [2, 1, 0, 3] + +Before: [1, 3, 2, 2] +6 3 3 3 +After: [1, 3, 2, 0] + +Before: [3, 1, 1, 1] +4 3 3 0 +After: [4, 1, 1, 1] + +Before: [2, 1, 1, 0] +8 0 2 2 +After: [2, 1, 4, 0] + +Before: [1, 0, 2, 3] +0 1 0 3 +After: [1, 0, 2, 1] + +Before: [1, 2, 2, 1] +4 3 3 1 +After: [1, 4, 2, 1] + +Before: [0, 3, 2, 1] +10 0 0 3 +After: [0, 3, 2, 0] + +Before: [0, 1, 0, 2] +5 1 0 0 +After: [1, 1, 0, 2] + +Before: [0, 1, 1, 1] +5 1 0 0 +After: [1, 1, 1, 1] + +Before: [1, 2, 3, 3] +12 0 3 2 +After: [1, 2, 0, 3] + +Before: [1, 3, 3, 1] +3 1 2 1 +After: [1, 1, 3, 1] + +Before: [1, 0, 3, 0] +0 1 0 2 +After: [1, 0, 1, 0] + +Before: [3, 2, 3, 0] +7 1 0 1 +After: [3, 1, 3, 0] + +Before: [1, 1, 1, 1] +13 1 0 0 +After: [1, 1, 1, 1] + +Before: [0, 0, 0, 3] +9 1 3 1 +After: [0, 3, 0, 3] + +Before: [3, 1, 0, 0] +11 2 0 2 +After: [3, 1, 3, 0] + +Before: [0, 0, 1, 3] +11 0 2 0 +After: [1, 0, 1, 3] + +Before: [3, 3, 3, 2] +4 2 1 1 +After: [3, 4, 3, 2] + +Before: [0, 3, 2, 3] +2 1 3 0 +After: [1, 3, 2, 3] + +Before: [1, 1, 1, 3] +9 0 3 2 +After: [1, 1, 3, 3] + +Before: [2, 2, 1, 1] +15 3 1 3 +After: [2, 2, 1, 2] + +Before: [3, 2, 1, 3] +7 1 0 2 +After: [3, 2, 1, 3] + +Before: [1, 1, 0, 1] +13 1 0 2 +After: [1, 1, 1, 1] + +Before: [3, 2, 2, 3] +3 1 1 0 +After: [1, 2, 2, 3] + +Before: [0, 1, 2, 3] +5 1 0 0 +After: [1, 1, 2, 3] + +Before: [0, 1, 3, 3] +5 1 0 3 +After: [0, 1, 3, 1] + +Before: [0, 3, 1, 2] +6 3 3 0 +After: [0, 3, 1, 2] + +Before: [0, 2, 3, 1] +8 1 2 2 +After: [0, 2, 4, 1] + +Before: [1, 0, 2, 3] +0 1 0 2 +After: [1, 0, 1, 3] + +Before: [2, 1, 1, 3] +9 1 3 1 +After: [2, 3, 1, 3] + +Before: [2, 3, 3, 3] +12 0 3 1 +After: [2, 0, 3, 3] + +Before: [1, 2, 3, 3] +3 1 1 3 +After: [1, 2, 3, 1] + +Before: [1, 2, 0, 2] +15 0 1 3 +After: [1, 2, 0, 2] + +Before: [1, 0, 0, 0] +0 1 0 0 +After: [1, 0, 0, 0] + +Before: [0, 1, 1, 1] +6 2 3 0 +After: [0, 1, 1, 1] + +Before: [3, 2, 2, 0] +7 1 0 1 +After: [3, 1, 2, 0] + +Before: [2, 2, 0, 3] +8 0 3 1 +After: [2, 6, 0, 3] + +Before: [1, 1, 0, 3] +12 0 3 2 +After: [1, 1, 0, 3] + +Before: [2, 3, 2, 3] +12 0 3 0 +After: [0, 3, 2, 3] + +Before: [2, 0, 1, 1] +6 3 3 1 +After: [2, 0, 1, 1] + +Before: [1, 2, 0, 1] +4 1 3 0 +After: [5, 2, 0, 1] + +Before: [0, 3, 2, 3] +10 0 0 3 +After: [0, 3, 2, 0] + +Before: [2, 1, 2, 3] +9 1 2 2 +After: [2, 1, 3, 3] + +Before: [2, 1, 2, 0] +11 1 0 2 +After: [2, 1, 3, 0] + +Before: [0, 2, 2, 2] +2 1 2 0 +After: [1, 2, 2, 2] + +Before: [1, 3, 2, 3] +8 0 2 2 +After: [1, 3, 2, 3] + +Before: [1, 0, 0, 3] +9 2 3 1 +After: [1, 3, 0, 3] + +Before: [1, 0, 2, 2] +0 1 0 2 +After: [1, 0, 1, 2] + +Before: [0, 1, 1, 2] +1 3 1 0 +After: [3, 1, 1, 2] + +Before: [3, 1, 3, 1] +1 3 2 3 +After: [3, 1, 3, 3] + +Before: [0, 1, 0, 3] +4 3 2 2 +After: [0, 1, 5, 3] + +Before: [1, 2, 2, 3] +8 3 3 0 +After: [9, 2, 2, 3] + +Before: [1, 2, 2, 2] +14 3 2 2 +After: [1, 2, 4, 2] + +Before: [0, 3, 0, 3] +2 1 3 2 +After: [0, 3, 1, 3] + +Before: [2, 2, 0, 0] +3 1 0 2 +After: [2, 2, 1, 0] + +Before: [1, 2, 3, 2] +9 0 2 1 +After: [1, 3, 3, 2] + +Before: [0, 3, 2, 2] +8 1 2 0 +After: [6, 3, 2, 2] + +Before: [1, 3, 2, 3] +2 1 3 0 +After: [1, 3, 2, 3] + +Before: [1, 0, 2, 1] +1 3 2 1 +After: [1, 3, 2, 1] + +Before: [0, 2, 2, 3] +10 0 0 1 +After: [0, 0, 2, 3] + +Before: [0, 2, 2, 3] +2 1 2 1 +After: [0, 1, 2, 3] + +Before: [3, 1, 2, 1] +14 2 2 1 +After: [3, 4, 2, 1] + +Before: [1, 0, 0, 1] +4 0 3 3 +After: [1, 0, 0, 4] + +Before: [1, 1, 0, 2] +8 3 2 2 +After: [1, 1, 4, 2] + +Before: [0, 1, 1, 1] +4 1 3 1 +After: [0, 4, 1, 1] + +Before: [1, 3, 1, 2] +15 1 3 3 +After: [1, 3, 1, 6] + +Before: [2, 2, 2, 2] +6 3 3 0 +After: [0, 2, 2, 2] + +Before: [1, 2, 3, 3] +8 1 3 1 +After: [1, 6, 3, 3] + +Before: [3, 2, 2, 1] +14 2 2 1 +After: [3, 4, 2, 1] + +Before: [3, 1, 2, 3] +8 1 2 3 +After: [3, 1, 2, 2] + +Before: [2, 0, 3, 3] +4 2 1 0 +After: [4, 0, 3, 3] + +Before: [0, 1, 1, 3] +5 1 0 0 +After: [1, 1, 1, 3] + +Before: [1, 2, 2, 1] +15 3 1 2 +After: [1, 2, 2, 1] + +Before: [2, 3, 3, 3] +4 3 1 1 +After: [2, 4, 3, 3] + +Before: [1, 3, 2, 1] +14 2 2 1 +After: [1, 4, 2, 1] + +Before: [0, 1, 2, 3] +5 1 0 3 +After: [0, 1, 2, 1] + +Before: [1, 1, 1, 2] +13 1 0 2 +After: [1, 1, 1, 2] + +Before: [3, 2, 2, 0] +7 1 0 0 +After: [1, 2, 2, 0] + +Before: [0, 1, 0, 2] +5 1 0 2 +After: [0, 1, 1, 2] + +Before: [1, 0, 1, 3] +0 1 0 3 +After: [1, 0, 1, 1] + +Before: [0, 3, 0, 3] +2 1 3 3 +After: [0, 3, 0, 1] + +Before: [0, 2, 2, 1] +10 0 0 1 +After: [0, 0, 2, 1] + +Before: [2, 2, 2, 0] +14 1 2 3 +After: [2, 2, 2, 4] + +Before: [3, 1, 3, 2] +15 2 3 3 +After: [3, 1, 3, 6] + +Before: [1, 1, 2, 0] +13 1 0 2 +After: [1, 1, 1, 0] + +Before: [1, 0, 1, 1] +0 1 0 2 +After: [1, 0, 1, 1] + +Before: [3, 2, 1, 2] +7 1 0 2 +After: [3, 2, 1, 2] + +Before: [2, 3, 3, 3] +12 0 3 2 +After: [2, 3, 0, 3] + +Before: [0, 1, 3, 3] +10 0 0 3 +After: [0, 1, 3, 0] + +Before: [3, 1, 2, 2] +1 3 1 2 +After: [3, 1, 3, 2] + +Before: [1, 3, 3, 1] +6 3 3 2 +After: [1, 3, 0, 1] + +Before: [0, 2, 3, 0] +10 0 0 2 +After: [0, 2, 0, 0] + +Before: [0, 2, 1, 3] +10 0 0 3 +After: [0, 2, 1, 0] + +Before: [2, 1, 3, 2] +4 1 3 2 +After: [2, 1, 4, 2] + +Before: [1, 0, 2, 0] +0 1 0 1 +After: [1, 1, 2, 0] + +Before: [1, 3, 0, 3] +4 1 2 3 +After: [1, 3, 0, 5] + +Before: [0, 1, 0, 3] +5 1 0 1 +After: [0, 1, 0, 3] + +Before: [2, 3, 2, 1] +1 3 2 3 +After: [2, 3, 2, 3] + +Before: [3, 2, 1, 1] +7 1 0 0 +After: [1, 2, 1, 1] + +Before: [2, 3, 2, 0] +14 0 2 0 +After: [4, 3, 2, 0] + +Before: [1, 0, 0, 3] +9 0 3 1 +After: [1, 3, 0, 3] + +Before: [0, 3, 2, 1] +14 2 2 3 +After: [0, 3, 2, 4] + +Before: [0, 1, 0, 1] +5 1 0 0 +After: [1, 1, 0, 1] + +Before: [1, 3, 3, 2] +15 2 3 0 +After: [6, 3, 3, 2] + +Before: [1, 1, 3, 0] +4 2 3 1 +After: [1, 6, 3, 0] + +Before: [1, 2, 0, 1] +15 0 1 2 +After: [1, 2, 2, 1] + +Before: [0, 1, 2, 0] +5 1 0 1 +After: [0, 1, 2, 0] + +Before: [1, 2, 3, 1] +15 0 1 3 +After: [1, 2, 3, 2] + +Before: [1, 1, 2, 2] +13 1 0 2 +After: [1, 1, 1, 2] + +Before: [3, 2, 2, 2] +7 1 0 0 +After: [1, 2, 2, 2] + +Before: [1, 1, 3, 1] +1 3 2 3 +After: [1, 1, 3, 3] + +Before: [1, 0, 2, 0] +0 1 0 2 +After: [1, 0, 1, 0] + +Before: [2, 2, 3, 3] +12 0 3 2 +After: [2, 2, 0, 3] + +Before: [1, 0, 2, 3] +0 1 0 0 +After: [1, 0, 2, 3] + +Before: [0, 1, 0, 3] +5 1 0 3 +After: [0, 1, 0, 1] + +Before: [1, 2, 3, 0] +15 0 1 1 +After: [1, 2, 3, 0] + +Before: [1, 2, 2, 0] +14 1 2 2 +After: [1, 2, 4, 0] + + + +1 0 2 3 +1 2 1 0 +1 2 3 2 +9 0 3 3 +8 3 2 3 +14 3 1 1 +5 1 2 0 +1 0 1 3 +1 2 2 1 +12 3 2 3 +8 3 1 3 +14 3 0 0 +5 0 2 2 +8 0 0 0 +4 0 2 0 +1 0 3 3 +1 1 0 1 +9 0 3 3 +8 3 1 3 +14 2 3 2 +1 2 1 3 +1 0 3 1 +3 0 3 0 +8 0 1 0 +14 2 0 2 +1 2 0 1 +1 2 0 0 +1 3 2 3 +13 3 0 3 +8 3 2 3 +14 3 2 2 +5 2 0 1 +1 1 0 3 +1 3 2 2 +1 0 3 0 +14 3 3 0 +8 0 1 0 +14 1 0 1 +1 0 0 0 +1 1 1 2 +14 3 3 0 +8 0 1 0 +14 0 1 1 +5 1 3 0 +1 2 3 1 +1 3 2 3 +13 3 1 1 +8 1 2 1 +8 1 2 1 +14 1 0 0 +5 0 0 3 +1 2 1 1 +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1 3 2 +10 1 2 2 +8 2 2 2 +8 2 1 2 +14 3 2 3 +5 3 0 0 diff --git a/day16.rb b/day16.rb new file mode 100644 index 0000000..782e9bd --- /dev/null +++ b/day16.rb @@ -0,0 +1,92 @@ +def op(cmd, regs) + regs2 = regs.dup + + case cmd[0] + when :addr; regs2[cmd[3]] = regs[cmd[1]] + regs[cmd[2]] + when :addi; regs2[cmd[3]] = regs[cmd[1]] + cmd[2] + when :mulr; regs2[cmd[3]] = regs[cmd[1]] * regs[cmd[2]] + when :muli; regs2[cmd[3]] = regs[cmd[1]] * cmd[2] + when :banr; regs2[cmd[3]] = regs[cmd[1]] & regs[cmd[2]] + when :bani; regs2[cmd[3]] = regs[cmd[1]] & cmd[2] + when :borr; regs2[cmd[3]] = regs[cmd[1]] | regs[cmd[2]] + when :bori; regs2[cmd[3]] = regs[cmd[1]] | cmd[2] + when :setr; regs2[cmd[3]] = regs[cmd[1]] + when :seti; regs2[cmd[3]] = cmd[1] + when :gtir; regs2[cmd[3]] = cmd[1] > regs[cmd[2]] ? 1 : 0 + when :gtri; regs2[cmd[3]] = regs[cmd[1]] > cmd[2] ? 1 : 0 + when :gtrr; regs2[cmd[3]] = regs[cmd[1]] > regs[cmd[2]] ? 1 : 0 + when :eqri; regs2[cmd[3]] = regs[cmd[1]] == cmd[2] ? 1 : 0 + when :eqir; regs2[cmd[3]] = cmd[1] == regs[cmd[2]] ? 1 : 0 + when :eqrr; regs2[cmd[3]] = regs[cmd[1]] == regs[cmd[2]] ? 1 : 0 + end + + regs2 +end + +OPS = [:addr, :addi, :mulr, :muli, :banr, :bani, :borr, :bori, :setr, :seti, + :gtri, :gtir, :gtrr, :eqri, :eqir, :eqrr] + +OPS.each { |o| + + if op([o, 2, 1, 2], [3, 2, 1, 1]) == [3, 2, 2, 1] + p o + end +} + +p1 = 0 + +poss = Array.new(16) { OPS } + +code = nil + +File.read("day16").split("\n\n").each { |samp| + if samp =~ /^Before:/ + x = samp.lines.map { |l| l.scan(/\[.*?\]/) } + before = eval(x[0].first) + unop, *args = samp.lines[1].split(' ').map(&:to_i) + after = eval(x[2].first) + + n = OPS.find_all { |o| + op([o, *args], before) == after + } + + poss[unop] &= n + + if n.size >= 3 + p1 += 1 + end + else + code = samp + end +} + +p p1 + +require 'pp' + +pp poss + +loop { + det = poss.find_all { |p| p.size == 1 }.flatten + break if det.size == 16 + poss.each_index { |i| + poss[i] -= det unless poss[i].size == 1 + } +} + +poss.map!(&:first) + +p poss + +regs = [0,0,0,0] +code.each_line { |l| + numop, *args = l.split(' ').map(&:to_i) + regs = op([poss[numop], *args], regs) +} +p regs[0] + +__END__ + +Before: [3, 2, 1, 1] +9 2 1 2 +After: [3, 2, 2, 1] diff --git a/day18 b/day18 new file mode 100644 index 0000000..3fc46f8 --- /dev/null +++ b/day18 @@ -0,0 +1,50 @@ +....||.#|..|...|.#..#...|.|.....|.....##|.....||.. +....#.|..|.....#|....|#|##|...#........|...#.#|.#. +.#||....|...#####..|.|.#..|..|.|..#.|#....#..||#.. +.....|....|..|....#....#..#...||....|.....#.|#..|# +.|.#||##.|..#....|#.|..|||#..##.|.#.|..##..|...|.| +.|.|...|...|#.|.....#...#|.#.....#..|#........###. +......|#|..#....|.#.#|....||#|.|#.....#|..#.#||... +.|.......##|..|..#|....|.|.|....#..|#|#.#...#.||## +##|..#.#..#||.###.|......|#.|....#...#.|...#....#| +..|###|#....#.|.#|#|.....|..|.||#|.|#.||...|##...# +...#....|.||||.|.|.##...#..|.||.|....#|#|#.|..|||. +|#....#...##..#||..|..#|.......|#|....|.|.|..|##.. +|#....|.|..|..|..#.#......|..|.|..|||.#||...#.#.|| +...|.|.....#.##|....|..#.|.....||..##..#..|||..... +.###.#.|.|||#.#.|.|.|...#..###..#|.........|.....# +|..#..|#..#........#.#.###.#...|.|.....|.||.|.|.|| +|##.|..#..#...#|.........#|...#||.|..#|#.|.|..||.. +....||.|....#.....|......#.|.|#.#.......|.|...#... +|.#.#|..#|#..#.#......#||.#..|||.#.#..#.||.####.#. +|.||.|.|.|#|.#.#|.#.|||..|........|..#..|.......|. +##..|.#..||............|||..#....|.....###|#...|#. +#|.|..#.|.|......|#|#.||.|....#...#....|...|...|.. +#.#.#...##...#....|#|#||.#|#...|#||#|....|..|...|| +.|.#.|.|...###.|..##..||#..|.....||.|.|....##..#|# +..#|#|..##...##|..|||||.|....|.#..|...|...#.#|||.. +..|.|....#.##.##|..|#..|...||...|..||##..##...#.## +..#|###..##....##|.||.|.|.||#...|.#.#|#.##||.|..|. +...|#...|#..#.....#|.....##..##.......#...##.|...# +.|..#.##|....#.#.#...|...##........|##|..#.|...|.. +......|#....#.........#.|.....||...#|.|...#.|#.... +..|.#..###||...#|###...|.|...|.|....#...#..|.|.#.| +.#|....||#.#|..#.#|..##.........|#.|.....#....|||. +....#.#....#|.|#.#.#.|#............|.#.#....|#...| +..|#....#|...#.#..#.#.#||..#.#..|......##.#.||.... +..|#....|#..|.#..#....#.|#.||.....#..#.#|.#...|..# +.#........|||.......|....|||.#|#..#.#|#........||. +#..|.....#...#..#.|#....##...##.##...#||.........| +..|.##.|..|...|..#|#.|.........||...##......###.|. +.|..|...#....||..#....#||#...#.#......##......#|.# +.|..#......#.|.#.##.|..|...#.|##..|||...|.......#. +...#..#..|#.|.....#||.|....#...|##|##.....|.#..|.. +#.....#...#...##.|....|......##...|...#.#.#.|..... +....#..|.|.|###|.##.|.#|.|.||.|#..|#..#...|.##.#.. +..|.|.#.|#.#...##.#||#...#..||.#.|#..|###....|#... +|.|..........|.#......#..#|.#...#.....#.#.#|.###.| +#..#|||....#..|....##|...|.#.|##||.|..|.#|.|...|#| +.|###..#.....|.#.||.#..|#...#.#|.#|.|.##|....#|#.. +.|...#...##......|..#.|#|.#.##......#.|......|...| +#.#..|#.#...#.|#|....#|##..#....##|..#.|..|#...|.. +.#.#..|.#..#........##.|#..|##||......|..#...#.... diff --git a/day18.rb b/day18.rb new file mode 100644 index 0000000..a9f0967 --- /dev/null +++ b/day18.rb @@ -0,0 +1,95 @@ +d = ["\n", *File.readlines("day18").map { |x| " " + x }, "\n"] + + +=begin + An open acre will become filled with trees if three or more adjacent acres contained trees. Otherwise, nothing happens. + An acre filled with trees will become a lumberyard if three or more adjacent acres were lumberyards. Otherwise, nothing happens. + An acre containing a lumberyard will remain a lumberyard if it was adjacent to at least one other lumberyard and at least one acre containing trees. Otherwise, it becomes open. +=end + + +xd = <<EOF.lines.to_a + + .#.#...|#. + .....#|##| + .|..|...#. + ..|#.....# + #.#|||#|#| + ...#.||... + .|....|... + ||...#|.#| + |.||||..|. + ...#.|..|. + +EOF + +require 'pp' + +seen = [] + +p1 = 0 + +i = 0 +d2 = nil +1000.times { |i| +pp d + +d2 = d.map(&:clone) + +d.each_index { |i| + d[i].chars.each_index { |j| + case d[i][j] + when '.' + if [d[i-1][j-1], d[i-1][j], d[i-1][j+1], + d[i ][j-1], d[i ][j+1], + d[i+1][j-1], d[i+1][j], d[i+1][j+1]].count('|') >= 3 + d2[i][j] = '|' + end + when '|' + if [d[i-1][j-1], d[i-1][j], d[i-1][j+1], + d[i ][j-1], d[i ][j+1], + d[i+1][j-1], d[i+1][j], d[i+1][j+1]].count('#') >= 3 + d2[i][j] = '#' + end + when '#' + s = [d[i-1][j-1], d[i-1][j], d[i-1][j+1], :X, + d[i ][j-1], d[i ][j+1], :Y, + d[i+1][j-1], d[i+1][j], d[i+1][j+1]] + if s.include?('#') && s.include?('|') + # keep + else + d2[i][j] = '.' + end + end + } +} + +if seen.include? d2 + p [:cycle, i, seen.size - seen.index(d2)] + break +else + seen << d2 +end + +if i == 10 + r = d.join + p1 = r.count('#') * r.count('|') # 535522 +end + +d = d2 +r = d.join +} + + +p p1 + +n = (1000000000-i)%(seen.size - seen.index(d2)) + +p seen.map { |s| +r = s.join +p2 = r.count('#') * r.count('|') +}.index(210160) + +#p p2 + +# 210160 diff --git a/day19 b/day19 new file mode 100644 index 0000000..3a7db07 --- /dev/null +++ b/day19 @@ -0,0 +1,37 @@ +#ip 4 +addi 4 16 4 +seti 1 9 5 +seti 1 5 2 +mulr 5 2 1 +eqrr 1 3 1 +addr 1 4 4 +addi 4 1 4 +addr 5 0 0 +addi 2 1 2 +gtrr 2 3 1 +addr 4 1 4 +seti 2 6 4 +addi 5 1 5 +gtrr 5 3 1 +addr 1 4 4 +seti 1 2 4 +mulr 4 4 4 +addi 3 2 3 +mulr 3 3 3 +mulr 4 3 3 +muli 3 11 3 +addi 1 5 1 +mulr 1 4 1 +addi 1 2 1 +addr 3 1 3 +addr 4 0 4 +seti 0 2 4 +setr 4 8 1 +mulr 1 4 1 +addr 4 1 1 +mulr 4 1 1 +muli 1 14 1 +mulr 1 4 1 +addr 3 1 3 +seti 0 0 0 +seti 0 2 4 diff --git a/day19.rb b/day19.rb new file mode 100644 index 0000000..ec3e2ff --- /dev/null +++ b/day19.rb @@ -0,0 +1,86 @@ +insn = [:eqri, :seti, :eqir, :eqrr, :addi, :setr, :gtrr, :gtir, :muli, :bori, :bani, :borr, :gtri, :banr, :addr, :mulr] + +def op(cmd, regs) + regs2 = regs.dup + + case cmd[0] + when :addr; regs2[cmd[3]] = regs[cmd[1]] + regs[cmd[2]] + when :addi; regs2[cmd[3]] = regs[cmd[1]] + cmd[2] + when :mulr; regs2[cmd[3]] = regs[cmd[1]] * regs[cmd[2]] + when :muli; regs2[cmd[3]] = regs[cmd[1]] * cmd[2] + when :banr; regs2[cmd[3]] = regs[cmd[1]] & regs[cmd[2]] + when :bani; regs2[cmd[3]] = regs[cmd[1]] & cmd[2] + when :borr; regs2[cmd[3]] = regs[cmd[1]] | regs[cmd[2]] + when :bori; regs2[cmd[3]] = regs[cmd[1]] | cmd[2] + when :setr; regs2[cmd[3]] = regs[cmd[1]] + when :seti; regs2[cmd[3]] = cmd[1] + when :gtir; regs2[cmd[3]] = cmd[1] > regs[cmd[2]] ? 1 : 0 + when :gtri; regs2[cmd[3]] = regs[cmd[1]] > cmd[2] ? 1 : 0 + when :gtrr; regs2[cmd[3]] = regs[cmd[1]] > regs[cmd[2]] ? 1 : 0 + when :eqri; regs2[cmd[3]] = regs[cmd[1]] == cmd[2] ? 1 : 0 + when :eqir; regs2[cmd[3]] = cmd[1] == regs[cmd[2]] ? 1 : 0 + when :eqrr; regs2[cmd[3]] = regs[cmd[1]] == regs[cmd[2]] ? 1 : 0 + end + + regs2 +end + + +r0 = 0 +r3=10551348 + +f = [1, + 2, + 3, + 4, + 6, + 9, + 12, + 18, + 36, + 293093, + 586186, + 879279, + 1172372, + 1758558, + 2637837, + 3517116, + 5275674, + 10551348] + +f.each { |r1| + f.each { |r5| + if r1*r5 == r3 + r0 += r1 + end + } +} + +p r0 + + +rip, *program = File.readlines("day19") + +rip = rip.scan(/\d/)[0].to_i + +program.map! { |line| + o,a,b,c = line.split + [o.to_sym, a.to_i, b.to_i, c.to_i] +} + +regs = [0]*6 +regs[0] = 1 +ip = 0 + +loop { + break if ip < 0 || ip > program.size + + regs[rip] = ip + p regs + regs = op(program[ip], regs) + ip = regs[rip] + 1 +} + +p regs.first # 2240 + +# 10844452 too low diff --git a/day20 b/day20 new file mode 100644 index 0000000..10e6b40 --- /dev/null +++ b/day20 @@ -0,0 +1 @@ +^WSSSWNNWNENWNNWWNNWWSWNNENENWNENNWNWWNENNENNNWWWSWSEE(ENWESW|)SSWWN(E|WSWNWSWSWNWNNWSSSWSWSEEESSWWWWSSSENNEEESWSW(N|SSSESWWWSESSSEENNEEEESEESEEENNWNNWWSS(E(SEWN|)N|WNWNNE(NWWNENEENNNWSWS(E|WW(NNE(S|ENNN(WSSWNNW(N|W)|NEESWSES(W|ENE(NNWSNESS|)SEE(NWES|)(SSSWSWSW(SES(WWNNWESSEE|)E(NN|SSESESSSEEESE(NNWNWW(SEWN|)NEENNWSWNW(S|N(WS|EN))|EEEENWNEN(W|ENNW(S|WWNNEENENWNWWWWW(SSENES(ENESNWSW|)SS|NW(SWEN|)NENWNENWNENWNEEENWWWW(NNNESES(ENESESENESSEENNEENNNWWNNESENNNNEEENNNWSSWWWWWSSS(ENNESS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SE(ESSWSSSENNEEESSWSESWWWSEEEEENESENNWWNEEESEEESSSENESSWWWNWW(NEENWW|SSWNWSSEEEEN(WNSE|)EEEEESEENNEEESSSSSWSESWWWNWSWWWSEESWWWWNNWNWNNN(WSSSSSSWWSSSESWWNWSWWSSWNNWSSWNW(SSSESWSEENNEEEESSWWW(NEEWWS|)SESSWNWNWWSSE(ESWSW(SSSSSENENENWN(WSSNNE|)NENESEENWNNNEESS(WNSE|)SSSWWSESWW(NNWESS|)SESWSWSWN(NENSWS|)WSW(N|SSENESESWSWW(NEWS|)SEESWSW(N|SEESSESESSSENNNNWNWNN(W|NNEEESWSS(WNNSSE|)SEEEESSENNENNNENWWNEENNENENNENWNENEESSESSWNW(SWSSWSSENENNEEESEEEESWWWSSSSSESSWSWSWWNENNE(E|S|NNNNWSSSWSWWNENWWSWW(SSSSW(WSWNWWW(NEENWW|SEESEESEEESWSEEEESSSWNWSWSWSSSSESENEESSEENENWNEENNNWNNESESEENESSSSSEESESENNENENNNNWWWNWNNWNNWWWSESE(SS(E(SESEEESSWWS(S|E|WNW(S|N(N|EEE)))|N)|WNWW(SESNWN|)WNE(E|NWWWW(NWNWW(SSE(N|E)|WN(WSWNSENE|)NENN(EE(SSS(EEESS(WNWESE|)EENWNNENESS(SEEENESEEENWNENEESEEESSWNWWSESWSESSWWS(WWNENE(E|NN(NNN|WWWWSEE(SWSNEN|)E))|ESENEENNEENNNNNNEESEENENNEEESEEEEENWNENNEEEENWWNENEENEEENWNWWNNWWN(WWWSESWWNNWSWSWSWWSEESWWWWWNNWWNEENENENWN(WWSWNN(WNWSW(SSWNWWWNWNENWWNNE(S|NENWWSWWWSWNWNEENWWNWSSSWNWSSWNNWSWNNNWSWSESWWWWWSWNWWW(SSSSSSWSSSW(N|SESWW(N|SEESSENES(EENNNE(NE(NNNENWWWWSESE(SWWNWW(NENNEEEENNESES(SEEEEESWS(WNSE|)ESWSEESW(SEENNENESSWSESESWSESWWSSW(NW(S|NNE(S|E))|SEEENEE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(SWEN|)NNN|SSEEEE(NWES|)SESSWWWWSSESWSEES(WWWNNWWNNEE(SWEN|)NNNESEE(NWES|)E|SENEENNNWWS(SENSWN|)WNN(W|EEENESSE(SWSSSSE(SESWSSWWWSSWWWS(W(W|NNEEENNNESENN(ESSNNW|)NW(NE|WSE))|ESEEN(W|ENNEEEENN(WSNE|)EE(SSEEEENWN(WSWNSENE|)EESSSENNENENN(EESESSSEE(NEN(WWSNEE|)NNE(SSS|N)|SSESSWNWWS(E|WS(E|WNNNWSWSWSS(EEN(N|W)|WNNNEN(ENNESENN(W|N(N|ESSSS(EENWESWW|)S))|WWSWSESSWNWNNNN(E(E|S)|WSWSESWWS(SENESESS(NNWNWSNESESS|)|WWNNE(S|NE(N(NN|WWWWSE(SWWSWSESWS(EENENWNE(WSESWSNENWNE|)|WW)|E)|E)|S)))))))))|NNWW(SSW(S(W|E(ENNSSW|)S)|N)|NNESEN))|N(N|WW))))|NNN)|ENN(E(EE|S)|W(S|NNWW(SE|NW)))))))|SES(S|W))|S))))|S)))|E)|EEEEN(ESE|WWWNE))))|N)|ESENEE(EN(N|E|W)|S(S|W)))|E)|ENN(NEESESWW(N|SEEENNESES(W|EEEEEENNNWSWNWSWNWNEEEENEEEEESSWSWSS(ENESENESEEENENEENEEENNESESENESSWSES(WWNWN(WSS(WWWW(NEENES|W)|E)|N|E)|ENNEENWWNENWWNENNNESENNWWWNWSSWSSE(SSWNWWWWSS(ENSW|)WNNWNWSWNNWSWNNWNENESES(W|EENWNWNENNNWNENESESENESSWWSW(NN|SES(W|SEENEES(SW(N|WSS(ENESNWSW|)WNW(NEWS|)(S|WW))|ENNNWSWN(NENNEESWSEESS(WNSE|)ESENENESS(EEESWSSSENESSEEESENNENENNWSWWNNNWNNWNEENNNWWSWS(EENSWW|)SWWSESWW(NWWNWSW(SEWN|)NWNENEENEESS(SWN(N|WW)|EENNENEENWNWSWSW(SS|NNENWNWSWSSE(SWWNNNNWSSWNNWNWSSWWSSWWNENNWWS(SSSS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WW)|ESSWW(W|SESWSSE(N|SSWWN(E|WWSWSSEE(SSWNWWNNNNWNN(WSSNNE|)ESE(NN|S|E)|N(W|EEEEESSE(N|E)|N)))))))|W)|NNENWNNNWWW(SS(ENESS|WN)|NENNESSENNENWWWW(SS|WWWWS(E|WNWSWNNNWWWNWWNNEEES(SEEENWNEESEEESESES(WWNWSWWN(WSNE|)EN(E|W)|ENNWNWNNWNWSW(SEEWWN|)NNWWNWWSWWSWNNENNWNNWWNWNWNN(EES(W|SEENN(WSNE|)EEESWWSEESEEENNWN(WSSEWNNE|)EESEEN(W|EESESEESEESSWNWSWSSWWSWNNEENNENWWWSESWWNWW(WWWSSENESS(ES(ESE(EEESW(W|SSENENNEN(NESSSSW(SESWSEENNNESEENENWW(WNW(NENWN(ENENENESENNWNWSWW(WNN(WS(S|WNW(S|W))|ESENEEEES(ENESENESENESSEENWNEEEEESENEEESSWW(NEWS|)SEEE(NNN|SWWWSESENESSSSSWSWWNENWNWWNEN(ESEES(S|W)|NNWNENWWNWSW(N|SEESSS(ENSW|)SWNWSWWSEEESWSSSSESESEESENEESSW(N|WWSWSSENENEEE(SWWSESWSWN(WSWSEEESSENE(NN(WSNE|)NN|SSWSWWSWNNE(E|NWN(WWNNN(E|NNWWNNWNWSSWSSSESSWNWNNWWWWNWNNWWSWSWSSEESEEN(EESENESSWWW(WSSWWNN(ESNW|)WWSESWSWW(NNNNNE(S(EE|SSS)|NNW(NEENENEENEES(ESENESSE(NNNE(SS|EEE(NWWNWWS(WNWWS(WNNNENEENWNENENWNNEEEE(S(ENESNWSW|)WW(S(SSWSESSW(N|WS(EEEE(NWNENW|S)|W(W|N)))|EE)|W)|NWWWNWWWWWSEEE(SWWWSEESS(ENNSSW|)WSESWWW(WNENWNN(ESE(E|SS)|WSSSW(SEWN|)NN)|SE(SSW(SESWWN(N|WWWSES(E(E|N)|SWNWWWS(EESEWNWW|)WNNN(N|W)))|N)|E))|E))|ES(W|E))|E)|ES(W|ES(SWN|EN))))|SWWWN(WNSE|)E)|W)|WS(E|SSS)))|S(WNSE|)ESEESENENWW(NEEEESSSW(NN|SEESWWSEEEESESWWWWWN(WSWNNW(NEE(S|N(WW|N))|SSSEEESWSESWW(NNWSWNN(SSENESNWSWNN|)|SESEEN(NNNESENEEEESSSESWWWNNW(NEESSNNWWS|)SWSW(NNEWSS|)SWSEESESSEENWNNWN(W|N|EESENESESSSSESWWNW(WWWSWSWSSWW(SEEEENN(WSNE|)EESSW(SWWSESWSESWSWNWWNWNWSSWWSWS(WNNNWNEEES(WSNE|)ENN(WWWWN(NW(SS|WNEENNES(NWSSWWEENNES|))|E)|EEESENE(NWW|SSW))|SEESENNEN(WWSWENEE|)(ESE(N|ESWSWSESWWSWNN(ENNEWSSW|)WSWSS(WWNWWNEN(ESE(NNESNWSS|)S|WW)|E(EEESESEEEEESWWSWSWNWN(EE|WWSESESWWWWSESESEENN(W(S|W)|EESEESESEEESWSEESEEEEEEE(SWSESWWNNWSSSWWWNNEN(ESSWENNW|)WWSSW(WNENWN(E|W(S|WWNN(ESENSWNW|)W(S|WNW(N(EESEWNWW|)N|WS(WNWSWNNWWWWWSWS(WWWNENWWSWNWNENNNENWWN(EN(ESESENE(NWWEES|)SEEESSSS(EE(E|NWNNE(ENN(E(SSEWNN|)NN(WS|ESE)|WSWNWWW(EEESENSWNWWW|))|S))|WWW(WWNN(WSSNNE|)EN(EESWS(EENNSSWW|)W|W)|S(S|E)))|W)|WWSESWSSSWNNNWW(WW|NEENNWSWN(SENESSNNWSWN|)|SESSSEESE(NNNEN(N|W)|ESWSS(WNNW(SSWWWW|N)|ES(SEESENE(S|NNWSWWNEN(NWSWENES|)EE)|W)))))|EESENN(EE|W))|E|S)))))|SSSSEEENEN(WWW(SEWN|)N|EESESWW(WSEESWWSSSSSW(SWSWSESWSSSS(WNWNWNEE(NWWNWWSSWNNNWSWNNNW(NENWESWS|)SSSS(SENESSESENE(SS(E(N|E)|WWWWN(NWSWWSEE(WWNEENSWWSEE|)|E))|NN)|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NW|)W)|SS))|SS))))|W(NWWS(E|W)|S))))|W)|W(SS|N|W))))))|N)))|N))|N)|NEN(NNE(S|ENWN(E|NWSW(SEWN|)(W|NNN)))|WWSWS(E|W)))|NNN(ESSNNW|)W))|W)))|EEE))|W))|N)|WN(E|W(NENSWS|)W)))|E)))|N)|NNNNWNWWS(E|WNN(EEEE(S|N)|NWNENWW(SWSES(W|SE(S|N))|N))))))))|W))|S(E|S))|WW)|S)|S)|N)|WW))|NNNW(WNEWSE|)S)|W)|WWWW(S|NNWNE(ESS|NWWW)))|NEEN(WW|E(E|N)))))|WSW(N|SWSEE(N|SW(SEEE(NWNSES|)EESS(E|SSSS(EEEE(N(E(N|ES(ENSW|)W)|W)|SS)|WWWN(WWSESEEESWWWSSWNW(SWSEEEEEEN(NWWSEWNEES|)ESSE(SWW(S|WN(W|E))|EN(WN|EESW))|NN(ESNW|)W)|EE)))|W)))))|WW))))))|W(S|NNEEN(EE|WNWSWWS(WW|E))))|WSWWSWNW(N|SWSSWSSWSWSSS(WWNWSW(SSS(WNSE|)EENENWWS(NEESWSNENWWS|)|NNENW(WSWWEENE|)NEN(EES(ENENWESWSW|)SW(SESNWN|)N|NNNWWWNWNENENN(EENEN(ESESE(SWW(WNE|SEE)|NNNW(NW(NEEE(SWEN|)NNE(SEWN|)NNNW(NEWS|)WWWSSESWSEENNENWW(EESWSSNNENWW|)|S)|S))|W)|WSWWS(WNW(SSEESWSW(N|SEEE(NWES|)EEES(W|S))|NEENES)|E))))|ENNE(S|E(E|N(W|NN))))))|W)|ENNESSS(SSEEE(SWWEEN|)(NN|EE)|WW)))|W)|N)|W))))|E(NEEENW(WWW|NEN(W|E(N|SSS(SWWWEEEN|)EENNWS)))|SS))|E)|N)))|SEEESE(NNWNSESS|)SWS(EE(SWSEENE(WSWWNEWSEENE|)|NN)|W))|W)|WWS(S|E))))))|NE(N|S)))|WNNNEN(E|WW))))|W))|N)|NWNNES)|W))|W)))|NNNNESSSENNN(SSSWNNSSENNN|))|NN(E(S|EN(W|ESEENNW(S|NNNNWWW(SEESNWWN|)NEEEENE(N|SESS(ENNESNWSSW|)SSWNW(NNESNWSS|)S))))|W))))|S)))|W)|W(NN|W))|E)|W(NEWS|)S))|SEESWSSSSWWSS(E(NEENSWWS|)SS|WNWW(SEWN|)NEEN(EENNNSSSWW|)W))))|N))|NN)|NENEN(WNNSSE|)EEE(N(W|EN(WNE|ES))|S(S|WW))))|NN))))|N)|N)|NNNENWNENNESSSSENEENEE(NWWNWSW(SEWN|)NNWWNNENESEEEEN(NWWW(SEEWWN|)NEEENWN(WWWWWSSW(NNNNN(E(EENNEWSSWW|)SS|NNNNNE)|SE(EENN(WSNE|)EE|SWSSSSS(NNNNNEWSSSSS|)))|EEE)|ESE(SWWSEESSWNWWNNWW(SEWN|)WW|N))|SSW(N|WWS(WWWSNEEE|)E)))|ESENNEEESSWW(NEWS|)SS(WNWESE|)(SS|EEN(W|E(S|ENWNEESE(NNNESSS(NNNWSSNNESSS|)|S(S|W)))))))|N)|NNESEE(NWN(WNENNENWWW(SESWSS|NNEEES(EENEENWNEESSEENNNW(NEEESSW(SSSWWWS(WW(NEWS|)WW|EESENENNEN(W|NNEEENEENN(WWS(WWN(WWWWWS(EEEESEE(WWNWWWEEESEE|)|WSWS(WNNWN(WSWNWWSSW(NN|SEEN(N|EESSS(ENNNSSSW|)(S|WN(N|WSWNWS))))|EE(S|E))|E))|E)|E)|EEESSWW(NEWS|)SESWSSENENESSWSES(WWWN(E|WNNNNWSSSWSW(SES(W|EE(NWNSES|)ESS(WNSE|)E(NN|S))|W(NNE(S|N(ESNW|)W)|W)))|E(NNNE(SSENEWSWNN|)NNW(W(NNNEEWWSSS|)W|S)|S)))))|N)|SS)|WW))|E)|S(S|W))))))|E))))|ESS(EN(ESNW|)N|W(WW|N))))))|NN(ENWESW|)WSWSWNN(N|E)))|S))))|E)|N)))|SWWSEESSWWWN(NNWSSSSE(E|SSW(SSS|N))|EE))|EE))|EE))|E(NN|E))|SS))|SEESS(S|EEE(NWWNEWSEES|)E))))|WS(WW|E(SWSEWNEN|)E))|E))))))|WNWWS(ESNW|)WNWWWW(SEEESNWWWN|)NEENN(WWS(E|W(NNNESEN(SWNWSSNNESEN|)|W))|ESSEEEE(WWWWNNSSEEEE|)))|SWWSSE(SSEWNN|)N))|N))|W)|SS(WNSE|)S))))))|NNNE(N(ESNW|)W|S))|E))))|S(E|SSW(WNENSWSE|)SEESWS(W(WWSSNNEE|)N|E))))|S))))$ diff --git a/day20.rb b/day20.rb new file mode 100644 index 0000000..1b4fc78 --- /dev/null +++ b/day20.rb @@ -0,0 +1,48 @@ +r = File.read("day20") + +#r = "^ENNWSWW(NEWS|)SSSEEN(WNSE|)EE(SWEN|)NNN$" +#r = "^WSSEESWWWNW(S|NENNEEEENN(ESSSSW(NWSW|SSEN)|WSWWN(E|WWS(E|SS))))$" + +r.gsub!(/^\^|\$$/, '') + + +def dist(str) + seen = [] + x = y = 0 + str.chars.each { |c| + case c + when "E"; x += 1 + when "W"; x -= 1 + when "S"; y += 1 + when "N"; y -= 1 + end + seen << [x,y] + } + seen.uniq.size +end + +p1 = 0 +p2 = 0 + +stk = [""] +r.chars.each { |c| + case c + when "E", "S", "W", "N" + stk.last << c + p1 = [p1, dist(stk.last)].max + p2 += 1 if dist(stk.last) > 1000 + when "(" + stk << stk.last.dup + when "|" + stk.pop + stk << stk.last.dup + when ")" + stk.pop + end +} + +p p1 # 3788 +p p2 # 8568 + +# 9558 too high +# 9557 too high diff --git a/day21 b/day21 new file mode 100644 index 0000000..f2d4b98 --- /dev/null +++ b/day21 @@ -0,0 +1,32 @@ +#ip 1 +seti 123 0 5 +bani 5 456 5 +eqri 5 72 5 +addr 5 1 1 +seti 0 0 1 +seti 0 3 5 +bori 5 65536 4 +seti 13284195 4 5 +bani 4 255 3 +addr 5 3 5 +bani 5 16777215 5 +muli 5 65899 5 +bani 5 16777215 5 +gtir 256 4 3 +addr 3 1 1 +addi 1 1 1 +seti 27 1 1 +seti 0 5 3 +addi 3 1 2 +muli 2 256 2 +gtrr 2 4 2 +addr 2 1 1 +addi 1 1 1 +seti 25 2 1 +addi 3 1 3 +seti 17 1 1 +setr 3 7 4 +seti 7 3 1 +eqrr 5 0 3 +addr 3 1 1 +seti 5 3 1 diff --git a/day21.rb b/day21.rb new file mode 100644 index 0000000..a64a16a --- /dev/null +++ b/day21.rb @@ -0,0 +1,67 @@ +insn = [:eqri, :seti, :eqir, :eqrr, :addi, :setr, :gtrr, :gtir, :muli, :bori, :bani, :borr, :gtri, :banr, :addr, :mulr] + +def op(cmd, regs) + regs2 = regs.dup + + case cmd[0] + when :addr; regs2[cmd[3]] = regs[cmd[1]] + regs[cmd[2]] + when :addi; regs2[cmd[3]] = regs[cmd[1]] + cmd[2] + when :mulr; regs2[cmd[3]] = regs[cmd[1]] * regs[cmd[2]] + when :muli; regs2[cmd[3]] = regs[cmd[1]] * cmd[2] + when :banr; regs2[cmd[3]] = regs[cmd[1]] & regs[cmd[2]] + when :bani; regs2[cmd[3]] = regs[cmd[1]] & cmd[2] + when :borr; regs2[cmd[3]] = regs[cmd[1]] | regs[cmd[2]] + when :bori; regs2[cmd[3]] = regs[cmd[1]] | cmd[2] + when :setr; regs2[cmd[3]] = regs[cmd[1]] + when :seti; regs2[cmd[3]] = cmd[1] + when :gtir; regs2[cmd[3]] = cmd[1] > regs[cmd[2]] ? 1 : 0 + when :gtri; regs2[cmd[3]] = regs[cmd[1]] > cmd[2] ? 1 : 0 + when :gtrr; regs2[cmd[3]] = regs[cmd[1]] > regs[cmd[2]] ? 1 : 0 + when :eqri; regs2[cmd[3]] = regs[cmd[1]] == cmd[2] ? 1 : 0 + when :eqir; regs2[cmd[3]] = cmd[1] == regs[cmd[2]] ? 1 : 0 + when :eqrr; regs2[cmd[3]] = regs[cmd[1]] == regs[cmd[2]] ? 1 : 0 + end + + regs2 +end + +rip, *program = File.readlines("day21") + +rip = rip.scan(/\d/)[0].to_i + +program.map! { |line| + o,a,b,c = line.split + [o.to_sym, a.to_i, b.to_i, c.to_i] +} + +regs = [0]*6 +regs[0] = 0 +ip = 0 + +or5 = 0 + +seen = [] + +# 3_000_000.times { +loop { + break if ip < 0 || ip >= program.size + + regs[rip] = ip + regs = op(program[ip], regs) + + if program[ip][0] == :eqrr + p regs[5] + if seen.include? regs[5] + break + end + seen << regs[5] + end + + ip = regs[rip] + 1 +} + +p regs +p seen + +# 7224964 +# 13813247 first before duplicate diff --git a/day22 b/day22 new file mode 100644 index 0000000..0426b39 --- /dev/null +++ b/day22 @@ -0,0 +1,2 @@ +depth: 11739 +target: 11,718 diff --git a/day22.rb b/day22.rb new file mode 100644 index 0000000..e1cb1a8 --- /dev/null +++ b/day22.rb @@ -0,0 +1,34 @@ +DEPTH = 11739 +TX, TY = 11, 718 + +#DEPTH = 510 +#TX, TY = 10, 10 + +$GI = {} +def gi(x,y) + $GI[[x,y]] ||= + if (x == 0 && y == 0) || (x == TX && y == TY) + 0 + elsif y == 0 + x * 16807 + elsif x == 0 + y * 48271 + else + el(x-1,y) * el(x,y-1) + end +end + +def el(x,y) + (gi(x,y) + DEPTH) % 20183 +end + +p gi(0,0) +p el(1,1) + +p1 = 0 +(0..TX).each { |x| + (0..TY).each { |y| + p1 += el(x,y)%3 + } +} +p p1 # 8735 diff --git a/day23 b/day23 new file mode 100644 index 0000000..47b4554 --- /dev/null +++ b/day23 @@ -0,0 +1,1000 @@ +pos=<-22356506,24819383,19709017>, r=53389427 +pos=<-17754746,29336035,-6021399>, r=68469044 +pos=<-28773573,22083066,35754706>, r=73115842 +pos=<-42043810,-4459593,13364132>, r=84568654 +pos=<1377848,7981572,-53489987>, r=95559952 +pos=<77798984,113924090,-46144528>, r=99130575 +pos=<-21811459,22764450,23866452>, r=54946920 +pos=<-24406099,34895910,6268549>, r=68390278 +pos=<191202236,41463041,27590787>, r=52967460 +pos=<7482975,45518455,58224369>, r=82764489 +pos=<47275743,27337294,35902156>, r=59086064 +pos=<-20109964,19119467,30852453>, r=56586481 +pos=<-9214366,54244996,23604816>, r=73568692 +pos=<-17274958,20368960,32810868>, r=56959289 +pos=<10289599,84963381,19396434>, r=80574757 +pos=<-16451482,34636846,21583141>, r=59176130 +pos=<-7866204,19527727,50341893>, r=64240563 +pos=<2810784,79426857,8134034>, r=83839005 +pos=<-37053157,19697549,15699972>, r=58955487 +pos=<4482142,31526501,6872272>, r=65043744 +pos=<-37808820,12085004,25843085>, r=74144216 +pos=<-28871779,30192064,3825211>, r=70595546 +pos=<-9536367,19168337,46725588>, r=61934832 +pos=<40197278,20075006,11981046>, r=96486039 +pos=<-3511627,-29548596,16636002>, r=72273377 +pos=<-48052304,32226064,20009798>, r=86792737 +pos=<-11358294,59313872,39222020>, r=96398679 +pos=<62206841,32247643,-16460480>, r=88338014 +pos=<-33649141,1116960,20225107>, r=75334336 +pos=<-5379923,57808473,32005160>, r=81698408 +pos=<-27846254,20891670,1064576>, r=63030202 +pos=<51343948,24389554,70297480>, r=94601641 +pos=<13016236,-16050735,60216421>, r=85828167 +pos=<32736913,20320221,57098799>, r=58726593 +pos=<-16889613,33693367,10521298>, r=55418498 +pos=<-12275831,30836077,27126052>, r=56742839 +pos=<74031008,21804950,29441983>, r=73848693 +pos=<-62660174,19947603,16856783>, r=85969050 +pos=<42447735,45673720,19515353>, r=56207776 +pos=<60039053,28436782,25883499>, r=62930017 +pos=<37512688,25132452,76286231>, r=87502018 +pos=<17866975,23017707,79667382>, r=71322908 +pos=<7665948,21260606,10764360>, r=76109218 +pos=<-2440559,47525061,-1696322>, r=67018981 +pos=<-22995980,28977299,-23924985>, r=91255150 +pos=<8550958,91720682,139747174>, r=58429255 +pos=<-29695457,19854538,28087357>, r=64141854 +pos=<5061573,22998273,68724243>, r=73165453 +pos=<-6175193,31848913,-1368880>, r=54749818 +pos=<-32886397,41344119,38279044>, r=99014138 +pos=<1006406,-43212024,21688712>, r=86471386 +pos=<-13805836,37333964,55453375>, r=93098080 +pos=<-168931884,36273749,32133035>, r=79574022 +pos=<15544614,49586329,57505627>, r=78051964 +pos=<-19859235,30891815,22902630>, r=60158674 +pos=<-29090862,23470069,11201042>, r=56716790 +pos=<-27479894,19699617,-6297987>, r=68834492 +pos=<-24512631,28043510,15779964>, r=54840619 +pos=<-5291579,30469021,54006749>, r=76271965 +pos=<-40606510,47134722,23068855>, r=97314638 +pos=<-35235698,25789979,-18390847>, r=94773444 +pos=<62824419,27807413,22075398>, r=61277908 +pos=<69995231,24930779,15594621>, r=59091442 +pos=<-14178452,25463550,24053139>, r=50199680 +pos=<-852074,34696906,29946338>, r=52000657 +pos=<-10841979,77715733,13136014>, r=90778594 +pos=<-29424868,28824800,22577763>, r=67332159 +pos=<-11006037,30225984,-2402652>, r=58991532 +pos=<16878969,49416791,36416947>, r=55459301 +pos=<30417860,-26381527,37100896>, r=78543556 +pos=<106074135,37692408,-99141334>, r=81416529 +pos=<-53638678,39250330,11078510>, r=97167485 +pos=<141555,24016661,7051936>, r=86299326 +pos=<-34448950,27050981,34835368>, r=82840143 +pos=<-21066693,20264528,33912584>, r=61748321 +pos=<7687633,25240259,23606696>, r=50550493 +pos=<29962778,17015310,23970328>, r=78199322 +pos=<-17365290,27947849,19929970>, r=51747602 +pos=<-19605455,27076354,20136150>, r=53322597 +pos=<67670934,32724878,8556928>, r=69261842 +pos=<-38157562,-10201485,28256197>, r=99192296 +pos=<-8781844,53642930,17776074>, r=66705385 +pos=<-13411472,52283669,35841827>, r=88041478 +pos=<8583325,62321841,30724843>, r=70968178 +pos=<-52247995,16087121,2556661>, r=85033682 +pos=<152007,48137440,40860662>, r=75350588 +pos=<-1463907,40832547,29631909>, r=58433117 +pos=<85312654,24375940,26062105>, r=84321359 +pos=<-12141864,50011852,24030092>, r=72688294 +pos=<-1208469,68580504,28119448>, r=84412913 +pos=<-6222629,51070741,17434479>, r=61232449 +pos=<-40882441,28491384,19850631>, r=75728981 +pos=<165388353,63326184,39193103>, r=99805853 +pos=<-28261713,37298224,22501498>, r=74566042 +pos=<9807375,20372322,-30706931>, r=56628731 +pos=<-19413806,24547219,64482302>, r=94948110 +pos=<-37790174,24437163,17492901>, r=66224736 +pos=<67730507,21557587,22012405>, r=59871597 +pos=<-19519520,24073183,31847749>, r=61944948 +pos=<-46530322,19629579,36489647>, r=89154164 +pos=<-4012414,38471190,23852070>, r=52840190 +pos=<46667187,14172523,47350434>, r=64488320 +pos=<72784272,20748537,20618670>, r=62722302 +pos=<71468821,22903578,44855975>, r=87799019 +pos=<31914021,75453452,37345432>, r=93283586 +pos=<35426160,46827366,26108193>, r=56932479 +pos=<-21782199,21252428,42033212>, r=71572737 +pos=<41019167,34450294,-13645780>, r=66538278 +pos=<-55330157,2263632,11168336>, r=93327582 +pos=<-938789,86174611,25040631>, r=98658596 +pos=<25934756,28420308,15964412>, r=52360869 +pos=<-8105107,32857264,32132107>, r=59599034 +pos=<67702242,30023662,9894535>, r=65254476 +pos=<-27970162,20882180,19379828>, r=54736921 +pos=<15246572,11357059,22679160>, r=76349515 +pos=<725888,-12723106,47917506>, r=82491793 +pos=<-18941730,31568565,40984159>, r=77999088 +pos=<-20343505,35795352,17928957>, r=60572435 +pos=<-50024165,27538080,30169972>, r=94236792 +pos=<14916897,-18159640,29524464>, r=55344268 +pos=<88051569,-7098715,17503153>, r=97296747 +pos=<10218298,69951896,28867329>, r=75105546 +pos=<45856848,10728400,-14576175>, r=63200220 +pos=<-37108806,19338453,15840859>, r=58792605 +pos=<75161553,52165674,21925300>, r=97823276 +pos=<-8655272,24265325,60666473>, r=80091771 +pos=<15020271,36669723,84510358>, r=92664369 +pos=<58669550,22155995,5046969>, r=53201583 +pos=<54394118,19804076,58951143>, r=81720083 +pos=<-39597876,27090197,-8772781>, r=90818274 +pos=<-37344234,19275039,-21279846>, r=93256133 +pos=<-1628183,38404350,44392979>, r=70930041 +pos=<35484920,52958779,57486816>, r=94501736 +pos=<62873185,19632492,62927599>, r=94004205 +pos=<-28379188,14359697,29922407>, r=66518949 +pos=<-20995796,19219797,28923805>, r=55643896 +pos=<-28070212,32119719,23869110>, r=70563606 +pos=<48874841,25806149,35996882>, r=59248540 +pos=<-36523110,58326149,10883736>, r=99322513 +pos=<6400987,27365399,20661423>, r=60089087 +pos=<48067583,26763370,-32786362>, r=85040702 +pos=<6336804,70191899,41718072>, r=92077883 +pos=<-71927636,21992080,17631430>, r=98055706 +pos=<81066992,8404647,17190866>, r=74496421 +pos=<-18572577,33571708,26527904>, r=65176846 +pos=<33175113,40265919,62703641>, r=84715351 +pos=<353630,57477688,45600153>, r=89228721 +pos=<11083786,69599511,30719664>, r=75739875 +pos=<-17488674,30764752,38851617>, r=73609620 +pos=<-49718532,32637220,25586396>, r=94446703 +pos=<15451978,23152152,62277900>, r=56482598 +pos=<-42715255,40068320,7337630>, r=90802835 +pos=<-11627268,64600628,31891345>, r=94623990 +pos=<-31744892,19944995,22843768>, r=61038200 +pos=<15347441,56066422,27945024>, r=55168497 +pos=<49898726,42903332,53663507>, r=95036196 +pos=<6260135,24472962,84411171>, r=89128520 +pos=<222054855,21615288,6364360>, r=71240818 +pos=<7315444,49127217,40619299>, r=68936184 +pos=<-31061005,23141139,21897097>, r=62604373 +pos=<-126474321,40724809,-33615920>, r=85167298 +pos=<-2804772,27683281,12687365>, r=83626248 +pos=<-47644671,37824198,15724920>, r=87698314 +pos=<-47125471,23248934,18767037>, r=75645946 +pos=<1140080,21840913,16111038>, r=96523207 +pos=<-17562924,7812577,20598547>, r=52925942 +pos=<-25959305,30882398,22713085>, r=66059283 +pos=<-28916095,21631858,34186520>, r=71239225 +pos=<5264890,52252362,51244933>, r=84737081 +pos=<1964391,29700536,54168927>, r=68410253 +pos=<-44946752,19782298,16176722>, r=67410417 +pos=<-6646688,27005624,67765168>, r=87922167 +pos=<6392194,30902574,50815463>, r=61830348 +pos=<-25072186,45061444,26892173>, r=83530306 +pos=<9262991,23431918,49451511>, r=50125019 +pos=<12762578,42001950,54626057>, r=70370239 +pos=<49132642,-9207996,45829961>, r=88813998 +pos=<49991950,73929949,19621642>, r=92114397 +pos=<7941216,24438871,31522572>, r=80942226 +pos=<-82785908,53265419,78123494>, r=52842890 +pos=<-42144086,39933543,19857110>, r=88439259 +pos=<-1323227,27092939,35754688>, r=50675371 +pos=<-13449052,32633130,23248487>, r=55835189 +pos=<-33317630,31457216,20575447>, r=71854919 +pos=<-32336088,15465548,25395070>, r=64842758 +pos=<-50116304,43872971,9935995>, r=99410227 +pos=<96166223,21041290,15978716>, r=81756922 +pos=<-64609071,23548589,16991276>, r=91653887 +pos=<-22034273,12865326,54920065>, r=86666172 +pos=<13462860,-5203283,-24847655>, r=68017504 +pos=<-4573689,1828319,65581090>, r=90903999 +pos=<45759849,33276316,58166791>, r=85773618 +pos=<77528785,23195394,17152796>, r=66447605 +pos=<-1507011,26222979,46141506>, r=60375994 +pos=<21901845,31754349,28884691>, r=68955754 +pos=<-36694253,41710804,154533592>, r=74959923 +pos=<-14715221,20918319,34936824>, r=57074941 +pos=<13694420,52074861,57850208>, r=82735317 +pos=<-9949931,-6519913,49922020>, r=88968916 +pos=<-14716348,30330369,38621292>, r=70172496 +pos=<30807550,58366942,57326610>, r=95071733 +pos=<80160104,21441622,19012272>, r=69185273 +pos=<-8960402,28731263,31761803>, r=55957957 +pos=<-8351933,10303665,40527054>, r=61152482 +pos=<-40883713,23300348,34215984>, r=84904941 +pos=<-61739808,19171513,10920230>, r=85348290 +pos=<-9395031,39402893,22763156>, r=58065727 +pos=<-53111243,6626969,16099671>, r=85161187 +pos=<17324245,76306986,-21833335>, r=96172965 +pos=<65553708,31895424,24764243>, r=70784213 +pos=<-35905383,4246146,31425222>, r=85661536 +pos=<4849211,59484221,20962149>, r=62101829 +pos=<-32479384,33752867,25573599>, r=78310660 +pos=<30164641,21015869,24375541>, r=68980152 +pos=<-49645331,25874086,29829876>, r=91853850 +pos=<23680947,28293695,56763812>, r=57309404 +pos=<-25564646,29517464,27145085>, r=68731705 +pos=<68421778,27278090,-16605747>, r=89728573 +pos=<16528575,93754615,23313375>, r=87043904 +pos=<51834580,5641153,23237402>, r=54074038 +pos=<78005953,32218867,16708137>, r=75503588 +pos=<-28203724,13897916,48429087>, r=85311999 +pos=<-39975732,33123389,9617871>, r=78838150 +pos=<14080825,29446070,49158631>, r=51028594 +pos=<-40350716,25256026,20829461>, r=72940911 +pos=<97192622,2258066,17796665>, r=97374461 +pos=<12880929,22386619,70384376>, r=66394574 +pos=<-25661743,56175310,24496465>, r=92838114 +pos=<20689574,-4253126,22136437>, r=68615542 +pos=<-7860313,49812834,25112308>, r=69290011 +pos=<9487166,41269734,37895914>, r=56182982 +pos=<-21058316,39366347,1910443>, r=73871436 +pos=<-589523,20314903,10527926>, r=86961420 +pos=<-20639734,-6792050,21536829>, r=71545671 +pos=<-6287711,14287888,-11935724>, r=55365443 +pos=<-59130250,30030819,5295282>, r=99222605 +pos=<-1443925,-23435737,23507820>, r=70964584 +pos=<16054984,65143126,26765978>, r=62358862 +pos=<60929913,-2999270,33309756>, r=81882228 +pos=<-28406057,16453693,54569312>, r=89099138 +pos=<-50232030,16894626,35563872>, r=91478393 +pos=<15143218,-49648683,22412406>, r=79494952 +pos=<-27471607,6189194,15813617>, r=59673094 +pos=<11692984,52246073,27036699>, r=54094303 +pos=<-60832761,21161731,15680101>, r=84179345 +pos=<11253962,73190364,4510170>, r=72783476 +pos=<92999994,19878998,19379350>, r=80828975 +pos=<-70876960,21111788,16465076>, r=94958323 +pos=<-48463435,23773289,15584995>, r=74326256 +pos=<-2032178,41086652,67989912>, r=97613332 +pos=<11990201,16280859,22643658>, r=50725483 +pos=<64765745,-2416825,25782294>, r=77608071 +pos=<-15584274,25839072,-36168049>, r=92948310 +pos=<-26732949,-16483129,24791120>, r=90584289 +pos=<25406450,57926010,62244051>, r=94147147 +pos=<20993131,93943130,18516612>, r=82023503 +pos=<51340007,22707233,-14507105>, r=65977345 +pos=<101856286,19146507,10909293>, r=87516512 +pos=<-4733631,11558601,76310899>, r=92063019 +pos=<-58072356,34388599,18965669>, r=97931152 +pos=<-33847202,20906996,19387569>, r=60646353 +pos=<14759729,7855338,35269693>, r=70789644 +pos=<26444204,71346799,25123633>, r=71485341 +pos=<-73893543,21891073,15591087>, r=97880527 +pos=<11744722,41501201,48633046>, r=64894126 +pos=<-56954222,20364256,19230452>, r=83053421 +pos=<-35155952,29729682,25304589>, r=76694735 +pos=<26074635,15275059,21379778>, r=68522833 +pos=<12110774,27563455,11784388>, r=67123691 +pos=<4559518,47505660,25741178>, r=55191827 +pos=<62558060,24860233,28540900>, r=64529831 +pos=<1942759,60653291,30574277>, r=75789303 +pos=<46948686,46171702,40886542>, r=82577595 +pos=<5931467,73399499,27972034>, r=81944828 +pos=<-15471379,29318461,27316201>, r=58610666 +pos=<31130069,28444881,82539354>, r=90685375 +pos=<-20666853,27259059,40722601>, r=75153281 +pos=<-47918384,19893597,35022987>, r=89339525 +pos=<-52020776,24009824,20804566>, r=83339654 +pos=<14944505,72051411,37073422>, r=80684815 +pos=<35338609,40208350,68429016>, r=92546604 +pos=<5467568,39193965,69171065>, r=89402020 +pos=<-12509118,-11749859,36278546>, r=83114639 +pos=<3456012,28458399,44353756>, r=55860702 +pos=<6399493,37485797,45979953>, r=63570769 +pos=<1678963,13293384,61696236>, r=69301053 +pos=<17276056,-3982958,75755689>, r=85039638 +pos=<14559180,63641475,15442837>, r=51029887 +pos=<-3051901,21659715,-20951386>, r=61019955 +pos=<-32256330,23117129,8803332>, r=61927319 +pos=<37437526,47871274,26636731>, r=60516522 +pos=<-15704060,45777961,17317506>, r=65304222 +pos=<28035804,26837710,16142265>, r=97890931 +pos=<77930887,19618706,19870770>, r=65990994 +pos=<-17274941,31395651,24461350>, r=59636432 +pos=<-34248301,24255654,6558333>, r=67302445 +pos=<61585659,43227453,24083478>, r=77467227 +pos=<15012143,10066192,16684458>, r=93283730 +pos=<3169969,52726593,43034264>, r=79095775 +pos=<13611615,19816668,88328238>, r=81037819 +pos=<15367957,29337890,61834758>, r=62309264 +pos=<-43859641,27858637,37611953>, r=95834926 +pos=<-54836877,21744186,15890917>, r=78976503 +pos=<-32396391,23233980,42596802>, r=84732502 +pos=<-9432953,21280794,-41672679>, r=87743448 +pos=<-29618857,20083419,6547469>, r=58511980 +pos=<-7357957,49308014,36076832>, r=79247362 +pos=<2501105,26690771,18227056>, r=69600431 +pos=<-3066209,48810305,-2479520>, r=69713065 +pos=<-5738161,66653915,27921764>, r=86818349 +pos=<55719396,58463783,30806191>, r=93560018 +pos=<73857977,23895493,18766670>, r=65090838 +pos=<-65568502,15773061,18405411>, r=90778418 +pos=<11921070,38468124,47984116>, r=61035911 +pos=<-32221355,33668479,19661892>, r=72056229 +pos=<-33626850,14024394,17362470>, r=59542022 +pos=<-6974624,49017333,-7406006>, r=78754872 +pos=<6987804,-31439178,-14582268>, r=90463030 +pos=<-64291545,19114317,1809089>, r=96953856 +pos=<79926649,20138617,41765014>, r=90401212 +pos=<1810331,41668547,28283895>, r=54646626 +pos=<-22533695,34255754,17959719>, r=61253869 +pos=<-6733137,28261186,-12681371>, r=63032643 +pos=<56070466,30880916,17390051>, r=52912064 +pos=<-16046921,-21009303,29450025>, r=89083582 +pos=<8009825,25445830,64006678>, r=67947393 +pos=<-16317759,45170137,-14983724>, r=91828437 +pos=<-815205,71317845,27540080>, r=86177702 +pos=<39839069,13184378,22867072>, r=59159861 +pos=<37811438,25564474,66237861>, r=78184518 +pos=<45810323,35946133,23278862>, r=53606019 +pos=<-13118197,23215402,32258204>, r=55096527 +pos=<4024404,75212057,29517102>, r=87209283 +pos=<-12748911,24638092,-9117665>, r=61861706 +pos=<-5750329,27437395,43463954>, r=63156257 +pos=<6832553,21511638,33156140>, r=56517778 +pos=<-62894985,24385226,15608723>, r=89393544 +pos=<77834,49556191,13293565>, r=51541838 +pos=<-61379226,19972832,4831399>, r=91877481 +pos=<-36255686,16247719,22313812>, r=64898967 +pos=<-26234455,31553000,24387769>, r=68679839 +pos=<8964592,38620749,74888640>, r=91049441 +pos=<-119872,30062596,41464113>, r=58151090 +pos=<-7185569,21397828,37258740>, r=52346626 +pos=<332476,29290566,76270151>, r=91732966 +pos=<82474752,26255964,7587448>, r=78566251 +pos=<-40917566,40926437,21698992>, r=90047736 +pos=<-45698230,14201981,23929391>, r=78002790 +pos=<-31875696,23436832,-6224246>, r=76893820 +pos=<-21695955,22687879,21481906>, r=52370230 +pos=<58187016,59755465,10076590>, r=85289253 +pos=<-51649463,4073199,24829327>, r=94983032 +pos=<-11528895,-13252964,18542012>, r=65901119 +pos=<-18292734,-744206,7350728>, r=63115841 +pos=<-10751386,37157528,21332818>, r=55746226 +pos=<-41411115,-8684567,15548429>, r=88221228 +pos=<26437526,40809963,45148110>, r=60966230 +pos=<-29091548,-100577178,63261920>, r=85206387 +pos=<-9897288,29004258,59878203>, r=85284252 +pos=<-28095107,22090188,36683265>, r=73373055 +pos=<332579,24331853,53049177>, r=63553241 +pos=<-37315274,47800389,19192187>, r=90812340 +pos=<-17972579,28596958,-281275>, r=62207715 +pos=<-36770337,35302892,-5356709>, r=92786785 +pos=<22815381,71244426,38716925>, r=81347372 +pos=<-894102,43608992,48397509>, r=79405101 +pos=<42506842,22395984,22081662>, r=56669140 +pos=<-26186312,42394828,6765646>, r=77172335 +pos=<29530872,30842596,41701127>, r=50645224 +pos=<11636855,-7799133,-7304499>, r=54896156 +pos=<-33353173,47164750,21713116>, r=88735603 +pos=<12560088,13719273,65145>, r=84802598 +pos=<88271940,16758556,17745541>, r=73902262 +pos=<4001660,26464002,-14501981>, r=52321824 +pos=<16982960,-40004880,41117815>, r=86717206 +pos=<13113771,42442444,19251783>, r=75890504 +pos=<-29679470,37629875,23160340>, r=76974173 +pos=<71089799,24760757,17371666>, r=61793065 +pos=<-8024183,58523077,43503539>, r=96555744 +pos=<-12185654,35783902,52715104>, r=87189150 +pos=<-5788296,47682267,-3804291>, r=72631691 +pos=<72133155,899599,25401275>, r=81278414 +pos=<21829441,71389576,46167730>, r=87957377 +pos=<67144263,26377484,25431706>, r=67524392 +pos=<-43110567,31704368,22276756>, r=83596183 +pos=<9739729,37091510,40433774>, r=54290143 +pos=<13850730,-11208867,54578523>, r=74513802 +pos=<15279912,28862717,77651228>, r=77738643 +pos=<29318075,37582100,51115428>, r=66586312 +pos=<-18744388,33095390,59504226>, r=97848603 +pos=<67826313,32568899,16923420>, r=65889260 +pos=<-1981152,51896501,42797573>, r=83179714 +pos=<-54137449,35654602,20335873>, r=96632451 +pos=<-24670531,29968739,25314432>, r=66458217 +pos=<-16116043,43005941,50921359>, r=96548000 +pos=<92651030,25710262,18935773>, r=85867718 +pos=<45006406,42463141,30511035>, r=66551832 +pos=<-39886761,34035903,7477911>, r=81801831 +pos=<-27656328,33450812,24448598>, r=72060384 +pos=<-3661447,44933449,12233488>, r=51718587 +pos=<-35153958,35363533,27417691>, r=84439875 +pos=<-24779635,5113302,38320449>, r=80563843 +pos=<6075871,-27885696,31256896>, r=75643804 +pos=<1742661,30742814,61607409>, r=77112126 +pos=<-4531497,45940087,-5097588>, r=70926059 +pos=<87455541,16073051,18851365>, r=74877045 +pos=<-12057904,52925992,32985814>, r=84474356 +pos=<-33245967,21829849,47998053>, r=89578589 +pos=<9098086,33245245,62003823>, r=72655646 +pos=<-16989103,6550823,-15065575>, r=76933253 +pos=<-34091971,30925760,22476780>, r=73999161 +pos=<-4754891,44813508,30676286>, r=66749255 +pos=<-34770113,34849859,35626757>, r=91751226 +pos=<-3245426,21344940,16386753>, r=73942370 +pos=<-5992355,24072914,34308508>, r=50878304 +pos=<61192094,22719285,10490926>, r=50843424 +pos=<-22650033,36376678,31805054>, r=77336258 +pos=<16578977,53596365,-17391334>, r=69765609 +pos=<-35037258,27019421,24299476>, r=72860921 +pos=<16989567,20021649,27794497>, r=86103287 +pos=<3095528,53938061,43299329>, r=80646489 +pos=<30838657,54490792,16307970>, r=50208758 +pos=<-20548116,26903548,-13704101>, r=76512777 +pos=<4092320,66765759,27539403>, r=76717884 +pos=<22149723,30809709,-52727473>, r=83110097 +pos=<-45909650,41111046,13094493>, r=89283173 +pos=<-4368532,26842794,34690837>, r=52406656 +pos=<-14814619,32401259,21990646>, r=55711172 +pos=<-8989543,36580198,27209012>, r=59283487 +pos=<-50011157,23904627,17755620>, r=78176059 +pos=<-59215512,24657057,16584409>, r=86961561 +pos=<-34457879,31529893,4771295>, r=76573381 +pos=<-28461365,-17183409,27955879>, r=96177706 +pos=<17428126,21460317,72192711>, r=62729410 +pos=<12246932,29861461,7380138>, r=59028875 +pos=<31632552,54473280,6222405>, r=57306390 +pos=<4443377,61473851,26585507>, r=70120529 +pos=<2665798,48726225,-13783192>, r=75200520 +pos=<56329869,66601987,7180100>, r=93174732 +pos=<-2539586,45254492,22703989>, r=57002686 +pos=<9063516,91924569,18097496>, r=87463213 +pos=<59446181,3735908,24784095>, r=65137664 +pos=<13465363,50056718,41052658>, r=64148526 +pos=<-56414591,6215069,18029068>, r=90805692 +pos=<16014009,6094240,16614764>, r=76066751 +pos=<17095650,70472856,58517139>, r=98398881 +pos=<7682204,24673605,25105498>, r=78836457 +pos=<-26684331,47084583,29000114>, r=89273762 +pos=<-31832614,22949642,51551368>, r=92838129 +pos=<9798056,51377676,6640540>, r=50296465 +pos=<40890960,41749608,52176418>, r=83387794 +pos=<-21887345,20583456,29287284>, r=58262910 +pos=<17045487,-25590827,23772578>, r=54895064 +pos=<-30689679,28694079,27008193>, r=72896499 +pos=<13366331,39802345,41508716>, r=54450123 +pos=<97664020,29949651,20131664>, r=96316112 +pos=<1807425,56837275,-25545739>, r=95932471 +pos=<-33789297,25603591,37990609>, r=83887997 +pos=<25604086,65611529,25722762>, r=65509092 +pos=<-9553164,34462025,39057759>, r=69577537 +pos=<-12978785,-2594393,19468965>, r=57619186 +pos=<-9197106,20046727,38067531>, r=53816050 +pos=<-14306938,-2783159,26939477>, r=66606649 +pos=<-60262357,9690817,18501913>, r=91650714 +pos=<-25052260,-15309253,17966912>, r=80905706 +pos=<5955716,81338048,26955198>, r=88842164 +pos=<73398525,-7358964,16946750>, r=82347427 +pos=<-31000330,19987851,17786746>, r=55279414 +pos=<-44078931,27422921,28507988>, r=86514402 +pos=<-26267675,50935123,19596190>, r=83303724 +pos=<-44518995,22090173,24530318>, r=77644105 +pos=<-4996912,36796160,24391145>, r=52688786 +pos=<-25037046,37820308,-552304>, r=78766579 +pos=<-15673058,45701132,44397473>, r=92276338 +pos=<1094884,42126869,25363190>, r=52900066 +pos=<-10235365,27601596,58158562>, r=82500376 +pos=<-21162963,25049592,28249204>, r=60966259 +pos=<-25437003,24371429,17032673>, r=53345603 +pos=<1741187,37272762,-22495840>, r=73384700 +pos=<-3943283,27573023,-45759240>, r=92632362 +pos=<7985951,20762161,12141888>, r=55031219 +pos=<3959434,-36167177,21405941>, r=76190726 +pos=<8176565,35751846,40147224>, r=54226999 +pos=<28574345,-6104433,73444926>, r=92766904 +pos=<-19395377,30333995,20293119>, r=56527022 +pos=<22075789,90739612,16961187>, r=78347620 +pos=<-2910991,29720091,69659492>, r=88795368 +pos=<-28641868,741459,18085008>, r=68562477 +pos=<4453848,47844431,24048898>, r=53944007 +pos=<-13121082,26779191,25740846>, r=52145628 +pos=<58639441,34757304,41544397>, r=83512043 +pos=<-4746686,7220292,36352955>, r=56456756 +pos=<-41654376,19786057,19343708>, r=67288631 +pos=<1922099,27757580,41900851>, r=54241003 +pos=<-26106391,24039403,26547536>, r=63198013 +pos=<51909359,39040191,-23550203>, r=91922720 +pos=<-31883928,19174319,16232194>, r=53794951 +pos=<-18111135,30225071,45988610>, r=80829323 +pos=<3462246,47341625,37911288>, r=68295249 +pos=<-21209912,38169565,9849441>, r=64886854 +pos=<6102482,22969953,33637142>, r=81164151 +pos=<-29094168,39024191,39912640>, r=94535485 +pos=<-39564562,32389487,30231504>, r=88690284 +pos=<-67583890,19937793,12733832>, r=90144701 +pos=<7439437,57446155,-13141269>, r=78504860 +pos=<-54408920,23429475,30144431>, r=94487312 +pos=<-10624959,-24967742,18153400>, r=76323157 +pos=<12734649,19654835,91633145>, r=85057827 +pos=<-56228792,19543674,15561625>, r=77838600 +pos=<15026550,57405761,23405682>, r=52289452 +pos=<27351030,54217690,54477028>, r=84616383 +pos=<-68713220,25606980,15944349>, r=96769209 +pos=<-30253382,21119758,49579286>, r=87456986 +pos=<72470546,37615120,36682292>, r=95338611 +pos=<-23442457,46448205,29234726>, r=85630024 +pos=<-64753842,20575209,20028988>, r=91862608 +pos=<20323082,6325662,-8079952>, r=76961994 +pos=<-26170337,33385922,-10491192>, r=85404272 +pos=<-52804067,25148869,108304>, r=93201456 +pos=<-20702532,36644362,25833714>, r=69685480 +pos=<33128385,33827761,35569293>, r=51096087 +pos=<-12064211,37526617,44613944>, r=80709288 +pos=<9630045,22977213,18513512>, r=80478689 +pos=<-14392533,80378859,17739526>, r=99015587 +pos=<-49554130,28102711,16264768>, r=80426120 +pos=<48585462,32333864,6067470>, r=52274820 +pos=<-44936102,24457282,34647424>, r=90545425 +pos=<17122051,54400067,68615061>, r=92397800 +pos=<75552009,24688336,25232742>, r=74043933 +pos=<65186315,20007774,30585805>, r=64350909 +pos=<5340143,42024065,30890977>, r=54079390 +pos=<3712081,21960600,74435408>, r=79188707 +pos=<-62518276,28719133,19309345>, r=97051400 +pos=<-49605073,22357227,33119716>, r=91586537 +pos=<9877346,44765934,-10669419>, r=60914884 +pos=<-50230141,26866736,13200558>, r=79253162 +pos=<-22215771,32434741,30683085>, r=71838135 +pos=<-10906666,39818153,16653597>, r=53882902 +pos=<200316,48815486,2307025>, r=61665054 +pos=<13364476,52796960,27008332>, r=52945321 +pos=<-54575005,27929316,17269683>, r=86278491 +pos=<-14148755,-20815963,34299290>, r=91841062 +pos=<95409270,22369477,18287131>, r=84636677 +pos=<-65267629,21281804,15753376>, r=88807303 +pos=<-22514300,25592776,11522778>, r=51941167 +pos=<9677229,38312590,56940780>, r=72080637 +pos=<-40480496,22683540,19750214>, r=69418850 +pos=<76753853,21058506,26284253>, r=72667246 +pos=<-69923232,19983905,11131784>, r=94132449 +pos=<79556109,7675997,11456181>, r=73919449 +pos=<21208276,30862408,17745997>, r=86339866 +pos=<87231055,35027756,23394348>, r=94223791 +pos=<2965591,52968786,54766980>, r=91274775 +pos=<38830705,39285181,-1298152>, r=56836999 +pos=<-17209565,53273886,16654161>, r=73642365 +pos=<-2091822,48531205,-18708870>, r=84688726 +pos=<16575730,16270182,88424011>, r=78155145 +pos=<-26211447,19989219,47697421>, r=80402727 +pos=<-11614478,41470816,27828438>, r=67418282 +pos=<13613315,25442730,30298476>, r=83389361 +pos=<-30997491,24351980,2860498>, r=67845791 +pos=<13174294,55008036,60365978>, r=88704210 +pos=<-66200460,25172709,19700202>, r=97577966 +pos=<-15575674,32215476,33481040>, r=67776725 +pos=<-828646,23717102,74053120>, r=85103369 +pos=<67082441,21554528,18209610>, r=55417358 +pos=<35289001,31964654,54452852>, r=70277186 +pos=<-37626603,22684178,39369744>, r=86185050 +pos=<-36476135,6661820,6119562>, r=75124212 +pos=<61412808,41356618,26246311>, r=77586503 +pos=<4349364,52113911,21313109>, r=55582147 +pos=<-29126413,10831829,-9489737>, r=79213693 +pos=<-35510131,33936453,1498226>, r=83305208 +pos=<10711803,56327977,54436248>, r=86556930 +pos=<-10986495,33479453,25386321>, r=56356771 +pos=<10839021,29615135,45987360>, r=51268004 +pos=<134500140,30697932,95120704>, r=79464034 +pos=<-9996928,15180732,43776070>, r=61169366 +pos=<8560796,52431760,-7692351>, r=66920135 +pos=<42869087,54159132,19806116>, r=65405066 +pos=<-28125179,32576762,30236596>, r=77443109 +pos=<29213882,72974856,23572361>, r=74331743 +pos=<6463341,35794744,82950747>, r=98787106 +pos=<16998364,43204188,42725887>, r=55436199 +pos=<-47809700,12764998,-4752711>, r=91227027 +pos=<-23667302,38222857,32520281>, r=80914972 +pos=<5018049,31868090,-42498386>, r=84705478 +pos=<-32740338,-48761,20145292>, r=75511435 +pos=<-31998062,16839567,18784325>, r=56519909 +pos=<14621953,56185701,34899979>, r=62968568 +pos=<-68866996,21585739,21022094>, r=97979315 +pos=<9867568,19329463,37100578>, r=77257682 +pos=<-62123211,22203859,11130571>, r=88553520 +pos=<77221580,24094107,16734917>, r=66621475 +pos=<-1821246,146278874,71332633>, r=50603635 +pos=<15695762,19623508,-12504375>, r=86176231 +pos=<-38748833,46005618,27720062>, r=98979148 +pos=<-9826408,21686640,52087370>, r=70105063 +pos=<-28740105,20621331,5646218>, r=59072137 +pos=<-18171799,45015675,39474938>, r=89167248 +pos=<-33947976,21584199,13397637>, r=57491357 +pos=<26513145,26087751,16685669>, r=56323404 +pos=<-11751760,34546347,65029270>, r=97832098 +pos=<14822609,38121041,89463361>, r=99266326 +pos=<6464839,73295099,6749637>, r=75437439 +pos=<-4524725,16467567,-11269014>, r=50755566 +pos=<-19329442,50791069,9638799>, r=75838609 +pos=<-45372988,21193667,17794822>, r=70866131 +pos=<-31731289,30869255,-7007932>, r=84965292 +pos=<-5071639,-10542190,19965497>, r=58156487 +pos=<68796747,14374123,28637783>, r=67703608 +pos=<43258818,56443114,32418999>, r=80691777 +pos=<-22503864,21597977,28543654>, r=59149994 +pos=<-22981706,11224220,23379917>, r=57714456 +pos=<2792705,55768393,41537614>, r=81018125 +pos=<-6343063,27952551,33183295>, r=53983437 +pos=<-7766640,21346094,16368100>, r=68588634 +pos=<49849537,24458794,42556872>, r=65435898 +pos=<56858459,-22045733,35625937>, r=99173332 +pos=<-39774035,21064462,25775707>, r=73118739 +pos=<-14993990,27469926,35619277>, r=64587679 +pos=<-43351704,3130025,24260072>, r=87058819 +pos=<30061462,65144305,50729458>, r=94505853 +pos=<-61832878,7785572,13000354>, r=92476522 +pos=<-52901190,20673282,18732962>, r=78812385 +pos=<-8571540,24699403,54905820>, r=74681313 +pos=<-37946319,34840656,20383740>, r=79675262 +pos=<-19838087,37351260,33253636>, r=76947568 +pos=<100847962,20524708,19206622>, r=89149925 +pos=<14455559,35233625,53700177>, r=60982791 +pos=<-20056662,56796383,34607132>, r=97964811 +pos=<9335162,3248985,85305624>, r=95298869 +pos=<88553571,14676264,15644268>, r=74164948 +pos=<-106610070,80008545,33528869>, r=99682821 +pos=<28264958,48650255,58033061>, r=83518914 +pos=<-17992625,45110551,48871141>, r=98478898 +pos=<69351949,5510582,25068156>, r=73552817 +pos=<-5705614,71653685,27728234>, r=91592107 +pos=<-17999747,25607396,21269038>, r=51380732 +pos=<-3205888,73012435,18538659>, r=81261635 +pos=<-3592057,25690835,56551659>, r=72339061 +pos=<1124658,24329061,19167822>, r=81587270 +pos=<-20802881,24668833,19823447>, r=51799858 +pos=<91853134,23414084,23045414>, r=86883301 +pos=<11308256,34015699,47134981>, r=56346912 +pos=<23941826,-24682269,22127619>, r=55394984 +pos=<2696109,67183426,43559924>, r=94552230 +pos=<46044170,37177299,36751145>, r=68543436 +pos=<6606434,21482473,34492952>, r=57815762 +pos=<34285517,19655024,15856185>, r=51306898 +pos=<8778135,22138548,67180627>, r=67045678 +pos=<30436629,33960173,-25071971>, r=66891736 +pos=<16129791,36219589,46557642>, r=53152020 +pos=<-4088749,62141812,2429997>, r=79157386 +pos=<-34401835,49197576,25435679>, r=95539930 +pos=<11676506,33753700,53141032>, r=61722792 +pos=<32707329,25861894,50187135>, r=57326997 +pos=<-8599604,-43075779,15894303>, r=90146754 +pos=<20965926,36360906,24401829>, r=60041660 +pos=<44776021,24251979,17223936>, r=75326241 +pos=<62538446,-4068536,22259080>, r=73509296 +pos=<-7250951,19937879,63480768>, r=77174204 +pos=<-33687444,28446020,21754771>, r=70392915 +pos=<-32676864,15046530,46773204>, r=86980581 +pos=<-12140995,20215852,-21775729>, r=69489510 +pos=<-26276846,42664168,23044658>, r=78490158 +pos=<-30338799,29183588,1436942>, r=73442811 +pos=<-42311395,21717480,40964276>, r=91497925 +pos=<-5752305,26483527,44945017>, r=63685392 +pos=<-2020739,26348098,59043072>, r=73916445 +pos=<2305442,27181675,9864180>, r=89847253 +pos=<24031909,57187890,922953>, r=57719994 +pos=<46081152,40431021,16031959>, r=51114769 +pos=<-4539533,61028721,19015725>, r=71088652 +pos=<62566597,-5740225,-11453959>, r=93256375 +pos=<295284,6340891,81950484>, r=97891413 +pos=<2170373,-18887927,23386747>, r=62681625 +pos=<16898502,31764641,87046268>, r=88416905 +pos=<90040619,9753129,18620337>, r=83551175 +pos=<8872743,56602255,34190034>, r=68424040 +pos=<-8360958,33716133,-14819718>, r=72253659 +pos=<12968548,23384948,-24475755>, r=50249145 +pos=<35437457,57555383,49108259>, r=90671747 +pos=<-27803063,19643981,32092866>, r=66044885 +pos=<14060705,56855419,28247979>, r=57547688 +pos=<417927,83403863,8295330>, r=90047426 +pos=<-36582718,34379125,30821956>, r=88288288 +pos=<-35619486,11529623,39689639>, r=86356544 +pos=<82748832,99851221,-51099242>, r=65444407 +pos=<-90072183,80613801,47426645>, r=80676265 +pos=<-1271823,10095366,17846927>, r=67689220 +pos=<8326508,65054647,52062355>, r=95295436 +pos=<-38016508,6924638,34071203>, r=87740549 +pos=<-5881230,47676110,49334906>, r=89396767 +pos=<68508362,-104765399,44390710>, r=94844086 +pos=<-10930711,53983679,12362749>, r=67908460 +pos=<56861269,50887818,561833>, r=84610333 +pos=<25884466,19111137,22613478>, r=70236386 +pos=<-38212755,32606517,34127984>, r=91451744 +pos=<32091711,58393197,11931508>, r=55976432 +pos=<-23846311,19311592,5477269>, r=53037450 +pos=<-23489350,19530867,21494536>, r=51019263 +pos=<31831575,50320484,45958501>, r=76681195 +pos=<36716427,29966616,76056381>, r=91310057 +pos=<15539489,43451622,-44204703>, r=87473706 +pos=<-34494856,23415098,16643666>, r=61058111 +pos=<79178949,48371683,11748656>, r=93225201 +pos=<-58324015,68454915,102896082>, r=95619434 +pos=<-41183195,37699049,16783713>, r=82170443 +pos=<-38927213,24332689,23063864>, r=72828452 +pos=<96025486,29641732,21715783>, r=95953843 +pos=<-6358110,21300784,-9752831>, r=52768639 +pos=<-144829223,-16756024,24569177>, r=67108955 +pos=<28240627,24988848,16808305>, r=50754384 +pos=<-21532777,329375,19394556>, r=63175000 +pos=<21667519,-10323661,50648697>, r=67283068 +pos=<13298150,24778686,17403411>, r=74528572 +pos=<102338959,19111655,22206798>, r=92228049 +pos=<-41176453,19079007,26527956>, r=73288226 +pos=<16641085,37471443,-40874890>, r=77062359 +pos=<-7418842,26247964,36463431>, r=56634775 +pos=<4165723,31234115,-33759555>, r=76185154 +pos=<10594331,31010219,17574041>, r=69525535 +pos=<-8563545,45006983,16239332>, r=56314504 +pos=<55005132,25689304,-4001151>, r=62118630 +pos=<-4376534,52632021,26338656>, r=69852027 +pos=<8256209,28653188,52612341>, r=59513806 +pos=<46657132,71021890,29481044>, r=95730698 +pos=<13902637,65216519,-26093567>, r=92764308 +pos=<71103266,21154299,43358351>, r=84186559 +pos=<17345681,82229516,16074509>, r=67462830 +pos=<-5538200,149534,38625466>, r=66591223 +pos=<71497360,21522866,10941885>, r=59501504 +pos=<-63477676,22817913,18669859>, r=91470041 +pos=<-17105355,31160955,-2071889>, r=65695126 +pos=<22394541,65900397,61205985>, r=98071593 +pos=<13252005,37181642,54336851>, r=64771440 +pos=<-21715438,44948330,15601037>, r=68769444 +pos=<-27439271,24322148,36227707>, r=74493911 +pos=<5766439,71076250,21707927>, r=73522290 +pos=<11851540,103523253,16424326>, r=94600531 +pos=<-35936364,25818095,26014260>, r=74273573 +pos=<-31874422,35762630,36035888>, r=90177435 +pos=<55512974,2428965,29430672>, r=67157872 +pos=<-16925035,64964840,30342498>, r=98736899 +pos=<-26179507,33773569,50201669>, r=96659452 +pos=<-10420798,28282193,40297782>, r=65505632 +pos=<-3536358,68354169,9952516>, r=77295243 +pos=<-17670714,26747732,24777656>, r=55700588 +pos=<6006248,70211081,27579531>, r=78289082 +pos=<76047518,27546733,18344623>, r=70509548 +pos=<-43757210,23682110,16509255>, r=70453074 +pos=<-28255216,15484963,7525602>, r=56674024 +pos=<20860911,12175042,42404586>, r=59595480 +pos=<-5198999,37158298,22027507>, r=50889389 +pos=<60191585,25695404,24939164>, r=59396853 +pos=<48113664,13574846,61013966>, r=80195985 +pos=<43935960,24809476,62008671>, r=79324814 +pos=<-7532169,-342364,24711284>, r=55162861 +pos=<24181680,36592240,21498336>, r=60711278 +pos=<47949585,42292822,24863047>, r=63676574 +pos=<15092860,40346420,44802794>, r=56560840 +pos=<16400870,43134632,41955309>, r=55193707 +pos=<-37242426,26461429,-1894245>, r=80954961 +pos=<-26938628,36292392,20686361>, r=70422019 +pos=<-8834715,29451092,-9608029>, r=63250800 +pos=<-18609214,31077799,52191567>, r=88383397 +pos=<-54750977,-415380,146275064>, r=92249294 +pos=<-2023401,33151759,66653502>, r=88333273 +pos=<36331134,-53331987,20335299>, r=94641605 +pos=<3150569,8571310,18986143>, r=78575480 +pos=<-45306597,19790214,19479629>, r=71081153 +pos=<-69358363,11975595,17171396>, r=97131215 +pos=<-16550534,28860936,50138804>, r=82054992 +pos=<6540170,27783511,43037271>, r=50785208 +pos=<-4945713,24195473,37884442>, r=53530143 +pos=<9665920,15733964,88204874>, r=85382098 +pos=<-1598376,27249205,51463568>, r=66815714 +pos=<10723020,60360313,52155729>, r=88297513 +pos=<-18243939,40517354,-5526765>, r=79644926 +pos=<-16903445,29937623,51744334>, r=85090409 +pos=<-11790426,31944298,23453777>, r=53692989 +pos=<52792545,36664182,45243704>, r=83271149 +pos=<24556891,40338428,38402988>, r=51868941 +pos=<44286570,22509374,70796569>, r=86163539 +pos=<5473867,72973258,22380418>, r=76384598 +pos=<-16972413,36311578,27172586>, r=66961122 +pos=<-34633201,33960550,15491358>, r=70589714 +pos=<17467491,6542097,72157213>, r=70725146 +pos=<5665746,74783281,156355889>, r=93957287 +pos=<-64172069,21730649,15682463>, r=88089742 +pos=<2685201,65235733,-967922>, r=78875377 +pos=<-4257607,40834124,46163206>, r=77759912 +pos=<-39668861,20523915,29479434>, r=76177140 +pos=<-49325139,42666448,21057925>, r=99554240 +pos=<98241678,14728921,1882426>, r=95125898 +pos=<-2644115,44049079,26435520>, r=59633251 +pos=<-5245833,-3360914,37676784>, r=68860588 +pos=<-19051770,48004620,18222322>, r=71783198 +pos=<15522991,29258936,16887250>, r=97447371 +pos=<-10295907,19528520,52301244>, r=68630727 +pos=<-8656765,27943662,29722627>, r=52827675 +pos=<59415926,33090586,24195985>, r=65273131 +pos=<-35763152,27898612,48223548>, r=98389798 +pos=<-47071475,25195001,20676619>, r=79447640 +pos=<-63120767,11092112,21759772>, r=96365550 +pos=<-37364557,27395894,11379897>, r=68737389 +pos=<-47572398,19204893,23825750>, r=77107834 +pos=<16046503,13033383,62015642>, r=55513298 +pos=<5239194,66468425,51304888>, r=99039262 +pos=<-15721321,23334078,32850424>, r=58410314 +pos=<38464312,4946271,48844014>, r=67005316 +pos=<-33000168,28521867,24183414>, r=72209965 +pos=<15527836,67904701,31845123>, r=70726519 +pos=<-19145592,74797230,18302643>, r=98749957 +pos=<40215058,467039,69929736>, r=94321349 +pos=<53124805,30481272,-13927176>, r=74956268 +pos=<3055359,22280316,23455679>, r=98564734 +pos=<-69144912,15804863,13317273>, r=91452305 +pos=<-50485481,20198161,22640058>, r=79828203 +pos=<-44840761,29032485,17379908>, r=77757716 +pos=<16378973,56765959,24926859>, r=51818388 +pos=<-17553918,15277290,27233173>, r=52087185 +pos=<-64946352,26965066,20597486>, r=99013460 +pos=<17544279,42036181,85676484>, r=96673021 +pos=<-44537995,33840688,21361315>, r=86244625 +pos=<-42416632,23970409,15495297>, r=68386871 +pos=<11016987,13665432,18936244>, r=73272543 +pos=<1818286,32017445,40233147>, r=56936996 +pos=<73372649,3393998,33339987>, r=87961823 +pos=<67239353,26435357,26306861>, r=68552199 +pos=<-702449,24351927,9579495>, r=62447833 +pos=<-14309099,30607733,19856069>, r=51277442 +pos=<4342531,20264028,20238911>, r=56908180 +pos=<11944158,41897050,-9302532>, r=54612301 +pos=<5887903,33391949,68189676>, r=82198605 +pos=<53037552,55310238,26029358>, r=82947857 +pos=<4107719,30759711,39616711>, r=52773538 +pos=<-13711814,3268039,65928599>, r=98949471 +pos=<65545186,28044108,15927270>, r=58087194 +pos=<1107016,26686911,83704606>, r=95789369 +pos=<-39291923,20846322,16375602>, r=63018380 +pos=<-30641202,27508544,37593684>, r=82248558 +pos=<72639472,12135185,22544085>, r=67691812 +pos=<-18725087,53120747,722243>, r=86480451 +pos=<-15843951,4658230,24716115>, r=58478884 +pos=<74275221,4681765,34221481>, r=88458621 +pos=<-26159772,44732593,18361408>, r=75758298 +pos=<14949502,26487956,26415586>, r=62132541 +pos=<-34570002,23276690,28852703>, r=73203902 +pos=<2046940,37986116,65446402>, r=87890088 +pos=<-17483875,54922771,8839294>, r=78924509 +pos=<-52506611,8292750,23400648>, r=90191875 +pos=<-2229132,33440911,40144270>, r=62318869 +pos=<25836134,9994730,15645938>, r=58321360 +pos=<-3058146,36739844,30907065>, r=57209669 +pos=<71455988,21543831,17532661>, r=59103140 +pos=<17897049,12116771,58414547>, r=50977789 +pos=<54096854,21189608,35240202>, r=59097602 +pos=<-22459330,38427126,-3683854>, r=79927688 +pos=<-60942270,23436516,18519800>, r=89403078 +pos=<-11133185,19747844,15873036>, r=51561367 +pos=<-36142665,30056754,26389945>, r=79093948 +pos=<-36397637,13146861,16273692>, r=62101578 +pos=<1585519,68315301,46579817>, r=99814336 +pos=<-72979404,19297219,18208512>, r=96989726 +pos=<-59149668,7987305,18051406>, r=91790914 +pos=<-21819672,59470687,18222433>, r=86017284 +pos=<-3121147,38524674,44657590>, r=72807944 +pos=<-58570148,20860115,5708865>, r=89078277 +pos=<-19133699,38762621,21243570>, r=65644376 +pos=<17653602,22873680,-45967094>, r=66544144 +pos=<-23108032,33331067,23219313>, r=66163005 +pos=<15672142,68668549,49729405>, r=89230416 +pos=<35927908,42218058,56783546>, r=83500228 +pos=<63056981,-13293942,-4560093>, r=94406708 +pos=<11776318,-27618281,20446064>, r=58865084 +pos=<16835574,46986020,35667984>, r=52323155 +pos=<14387376,40926467,-26122046>, r=68018092 +pos=<82717827,15419121,16380535>, r=68322496 +pos=<-3372397,60315528,1502937>, r=77541898 +pos=<224178065,22404335,9840502>, r=95030030 +pos=<10525392,23373047,33973198>, r=85137995 +pos=<12745453,32823279,52110534>, r=58693153 +pos=<7702406,32069177,-10716268>, r=50439888 +pos=<11724329,10575335,16223487>, r=50979484 +pos=<-40575085,28203139,16294657>, r=71577530 +pos=<-39035522,20087752,28896810>, r=74524591 +pos=<13054726,30035255,-32404862>, r=64742255 +pos=<-8558783,55103660,44503931>, r=94671214 +pos=<-57460532,15407640,28388333>, r=93018269 +pos=<-5882594,47074540,19052333>, r=58514343 +pos=<-9050931,46031875,21056959>, r=62644255 +pos=<53557157,918690,31290721>, r=68572532 +pos=<-23453548,48093870,15645015>, r=73696997 +pos=<11139730,45347600,-22608640>, r=72173339 +pos=<100519983,22436948,17314398>, r=88841960 +pos=<9749341,33596850,47353067>, r=57705152 +pos=<-19660534,45304545,18101278>, r=69570878 +pos=<-29422623,27864323,39727736>, r=83519196 +pos=<14912797,31806798,63843436>, r=67241924 +pos=<-37584351,27640240,27952037>, r=79681301 +pos=<-42464627,37953918,15821915>, r=82745329 +pos=<-20305422,14407025,36175899>, r=64651536 +pos=<-33712086,29537587,22956495>, r=72710784 +pos=<17592936,61182312,-18214532>, r=77160947 +pos=<32687775,-33258766,47744694>, r=98334515 +pos=<2611416,-31653634,22244081>, r=73863412 +pos=<63937441,19860245,26352526>, r=58720861 +pos=<-26000222,29942747,16282576>, r=58730144 +pos=<72041493,22235632,32098242>, r=74946060 +pos=<83506282,25085928,5569924>, r=80445250 +pos=<21856922,54769509,-7323103>, r=61372504 +pos=<-6785507,50769402,5274344>, r=67637491 +pos=<-49054840,25708393,28758541>, r=90026280 +pos=<41453758,36161967,-5565676>, r=60604598 +pos=<23957380,98491976,25197508>, r=96217492 +pos=<-1918997,40872712,56020837>, r=85317037 +pos=<11560897,-13417473,35667589>, r=60101227 +pos=<16095547,34033277,17499405>, r=63373349 +pos=<19992290,39104546,51635522>, r=59303173 +pos=<-9543243,24703883,55439601>, r=76191319 +pos=<-2629657,61222040,-9027259>, r=88235881 +pos=<-7954438,26409135,71841366>, r=92709428 +pos=<56100040,35718903,-2943841>, r=72186148 +pos=<15194014,34724058,51380300>, r=57415060 +pos=<5149757,32879120,57059018>, r=71292927 +pos=<-45117989,31717981,24626933>, r=87967509 +pos=<-49525793,27631358,31437399>, r=95099113 +pos=<-36306848,22065328,23040435>, r=67917382 +pos=<7338739,19359924,28927676>, r=76399015 +pos=<15722921,22564620,67554210>, r=60900563 +pos=<-60668204,19293726,15539593>, r=82006045 +pos=<-11641123,36130019,24895482>, r=59171132 +pos=<20312628,-18082245,-38613762>, r=90504280 +pos=<37497722,19085334,-24743751>, r=58749886 +pos=<-192579537,20345121,16842397>, r=97756688 +pos=<-10677857,19600465,55979964>, r=72762775 +pos=<42525405,33414203,47776287>, r=72286523 +pos=<15706619,26835579,16458822>, r=56518320 +pos=<15809191,84768944,40385209>, r=95849545 +pos=<10773970,66999475,-2142936>, r=73725278 +pos=<-25063202,27449660,23041100>, r=62058628 +pos=<7277029,-12837408,22286000>, r=50423549 +pos=<2139203,4602136,-39115521>, r=83803573 +pos=<-1206701,-33067867,36638247>, r=93489865 +pos=<17199864,24463876,62720466>, r=56488989 +pos=<12800652,42177849,45685273>, r=61567044 +pos=<-29617960,28338878,17474860>, r=61936672 +pos=<56231418,49001563,-917997>, r=83574259 +pos=<-1100672,59918278,29611507>, r=77135099 +pos=<2840100,24064715,26419467>, r=66185333 +pos=<-25745230,27768519,59674568>, r=99693246 +pos=<4013710,42655821,68735864>, r=93882614 +pos=<28190191,-11448870,33663870>, r=57946149 +pos=<14317415,36836782,73815992>, r=82839849 +pos=<-1902327,4911366,42167513>, r=61735635 +pos=<-20143004,25972869,25423419>, r=58044185 +pos=<16110265,39732923,-36507950>, r=75487869 +pos=<-22915802,34700389,24925277>, r=69045988 +pos=<-45086387,19247909,16794241>, r=67633059 +pos=<-30742321,27658789,42275051>, r=87180746 +pos=<-8483151,74444239,17371943>, r=86803935 +pos=<6428243,27088246,64397425>, r=71561996 +pos=<24533884,21791651,19666481>, r=72843158 +pos=<-30388692,37610995,12980780>, r=70375724 +pos=<-28467247,27750195,52587545>, r=95309521 +pos=<62548627,-1513034,38960561>, r=87665573 +pos=<2633017,33111177,81587141>, r=98570148 +pos=<-39944129,40403838,18264526>, r=85117165 +pos=<-14561007,65391707,20339025>, r=86796234 +pos=<-2017942,80879578,25890819>, r=95292839 +pos=<6288287,60919820,30914954>, r=72050978 +pos=<27282061,78333102,39773596>, r=93959479 +pos=<14788668,20798979,42072660>, r=50563382 +pos=<-42729331,29603434,17220290>, r=76057756 +pos=<10075818,55209552,18851111>, r=50489387 +pos=<6292121,19851428,17294956>, r=89344416 +pos=<-92577266,-44957254,41247834>, r=92002848 +pos=<-12891027,80820196,16147620>, r=96363329 +pos=<25731530,28064889,51145333>, r=53512398 +pos=<-45635644,23504114,5526602>, r=78970711 +pos=<13775814,63239460,57446403>, r=93414566 +pos=<17806166,27152615,22686791>, r=53140461 +pos=<10224826,22444410,21024630>, r=81367756 +pos=<23171186,28174511,79079304>, r=78995647 +pos=<-52226525,22456043,25035287>, r=86222449 +pos=<-10363788,31948809,28489940>, r=57307103 +pos=<14306966,38581115,-13983082>, r=53614065 +pos=<10664208,51477968,48267682>, r=75585948 +pos=<31169459,-17095102,41819338>, r=74727115 +pos=<-809520,69793205,18054666>, r=75161960 +pos=<-20304245,21918733,46600435>, r=75327972 +pos=<-6188774,19267409,17599622>, r=85788293 +pos=<-23484420,19370437,33406344>, r=62765687 +pos=<-36162654,8056165,9432272>, r=70104221 +pos=<11436037,29048070,32190088>, r=73021637 +pos=<6483456,22081501,23232660>, r=64032836 +pos=<45571672,39708352,55410440>, r=89261119 +pos=<-3973530,28214854,57251942>, r=75944882 diff --git a/day23.rb b/day23.rb new file mode 100644 index 0000000..d946376 --- /dev/null +++ b/day23.rb @@ -0,0 +1,21 @@ +file = File.read("day23") + +bots = file.lines.map { |l| + l.scan(/<(-?\d+),(-?\d+),(-?\d+)>.*r=(-?\d+)/).first.map(&:to_i) +} + +strongest = bots.max_by { |x,y,z,w| w } + +p bots.count { |x,y,z,w| + ((x-strongest[0]).abs + + (y-strongest[1]).abs + + (z-strongest[2]).abs) <= strongest[3] +} # 577 + + +p bots.map { |b| b[0] }.sum +p bots.map { |b| b[1] }.sum +p bots.map { |b| b[2] }.sum + +# 16933511,19092135,15403726 +# 51429372 diff --git a/day24 b/day24 new file mode 100644 index 0000000..b5339c9 --- /dev/null +++ b/day24 @@ -0,0 +1,23 @@ +Immune System: +1466 units each with 7549 hit points (weak to fire, bludgeoning) with an attack that does 49 fire damage at initiative 1 +8647 units each with 6003 hit points (weak to radiation, cold) with an attack that does 6 cold damage at initiative 3 +2777 units each with 7460 hit points (weak to fire; immune to slashing) with an attack that does 24 bludgeoning damage at initiative 7 +470 units each with 1938 hit points (weak to fire, cold) with an attack that does 40 cold damage at initiative 18 +4203 units each with 6288 hit points (immune to fire) with an attack that does 13 cold damage at initiative 9 +2975 units each with 4211 hit points (immune to slashing) with an attack that does 14 slashing damage at initiative 20 +123 units each with 10083 hit points (immune to radiation; weak to fire) with an attack that does 777 bludgeoning damage at initiative 15 +3455 units each with 6391 hit points (weak to radiation, slashing; immune to cold, bludgeoning) with an attack that does 16 bludgeoning damage at initiative 19 +4323 units each with 4880 hit points (weak to cold; immune to radiation) with an attack that does 10 slashing damage at initiative 14 +1586 units each with 3567 hit points (weak to bludgeoning, radiation; immune to slashing, cold) with an attack that does 17 radiation damage at initiative 4 + +Infection: +5380 units each with 18316 hit points with an attack that does 5 slashing damage at initiative 17 +6230 units each with 12274 hit points (weak to slashing) with an attack that does 3 fire damage at initiative 16 +214 units each with 27761 hit points (weak to bludgeoning) with an attack that does 233 fire damage at initiative 11 +1515 units each with 47688 hit points (weak to slashing; immune to radiation) with an attack that does 49 cold damage at initiative 8 +268 units each with 44231 hit points with an attack that does 259 fire damage at initiative 6 +2318 units each with 22996 hit points with an attack that does 18 fire damage at initiative 5 +9492 units each with 19449 hit points (weak to bludgeoning, slashing; immune to cold) with an attack that does 4 radiation damage at initiative 13 +1113 units each with 39287 hit points with an attack that does 69 fire damage at initiative 12 +1382 units each with 15277 hit points (weak to radiation, fire) with an attack that does 19 cold damage at initiative 2 +2101 units each with 25567 hit points with an attack that does 17 slashing damage at initiative 10 diff --git a/day25 b/day25 new file mode 100644 index 0000000..761b364 --- /dev/null +++ b/day25 @@ -0,0 +1,1315 @@ +-7,1,-6,1 +-4,-2,2,2 +0,-6,-3,-7 +0,5,-4,-2 +-1,-4,4,1 +-3,7,8,1 +-8,-7,4,-8 +-7,8,8,3 +3,-4,-2,-8 +2,4,-7,6 +6,-5,-2,5 +-1,-7,7,0 +5,5,-2,6 +3,4,2,-8 +-6,7,3,-4 +-3,-7,0,7 +-4,0,0,1 +1,8,6,-3 +5,5,-3,-7 +0,3,0,-6 +4,-5,6,4 +-1,7,8,-6 +8,1,-1,-3 +-7,5,-3,-2 +7,3,7,5 +-6,-4,-5,-3 +0,7,-8,-1 +-5,8,-2,-7 +2,8,7,8 +-7,6,-8,-3 +-5,7,0,-2 +5,3,0,-1 +-5,4,0,3 +-8,-8,2,5 +8,5,8,4 +3,5,-5,-7 +-6,-4,-2,-2 +-5,-7,1,5 +-5,0,1,7 +-1,0,0,-7 +5,-5,7,1 +4,-2,-8,4 +-1,-4,6,-1 +-8,-6,5,1 +-2,0,-2,8 +-1,1,-3,2 +4,2,-8,2 +-6,8,8,-3 +6,-3,0,2 +8,-2,8,-8 +-4,0,0,-2 +7,5,0,4 +2,-3,-8,-4 +-7,0,-6,-5 +2,3,-3,-8 +-7,5,-6,-2 +-3,6,2,1 +-3,-3,8,-2 +-6,5,4,7 +-5,7,0,-1 +6,1,7,8 +7,4,4,-8 +6,0,-5,3 +2,-4,-3,-7 +8,0,-7,-5 +6,0,-8,0 +-2,-5,2,-2 +0,-3,5,6 +6,5,2,1 +7,0,6,7 +5,5,0,2 +-3,0,8,-1 +0,1,-7,-4 +-3,-2,-7,-6 +-5,-7,5,-4 +0,-1,-3,4 +-2,-8,2,-1 +7,-2,0,0 +1,-3,3,2 +-2,7,3,6 +6,8,8,2 +8,5,6,0 +-6,-6,3,7 +6,0,8,1 +-1,3,-2,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,34 @@ +d = File.readlines("day25").map { |x| x.split(",").map(&:to_i) } + +class DSU + + def initialize(x) + @array = Array.new(x) {|i| i } + end + + def find(x) + return x if @array[x] == x + @array[x] = find(@array[x]) + end + + def union(a, b) + @array[find(a)] = @array[find(b)] + end + + def sets + @array.collect{ |i| find(i) }.uniq.length + end + +end + +dsu = DSU.new(d.size) + +(0...d.size).each { |i| + (i+1...d.size).each { |j| + if d[i].zip(d[j]).map { |(a,b)| (a-b).abs }.sum <= 3 + dsu.union(i, j) + end + } +} + +p dsu.sets |