From 537abb62bd7c0f7281cdf770321780d5f840a7f1 Mon Sep 17 00:00:00 2001 From: Stefan Harmuth Date: Sat, 18 Dec 2021 09:09:35 +0100 Subject: [PATCH] day18: slow as fuck, but working --- day18.py | 110 ++++++++++++++++++++++++++++++++++++++++ inputs/input18 | 100 ++++++++++++++++++++++++++++++++++++ inputs/test_input18_1_0 | 10 ++++ inputs/test_input18_1_1 | 100 ++++++++++++++++++++++++++++++++++++ inputs/test_input18_2_0 | 10 ++++ inputs/test_input18_2_1 | 100 ++++++++++++++++++++++++++++++++++++ 6 files changed, 430 insertions(+) create mode 100644 day18.py create mode 100644 inputs/input18 create mode 100644 inputs/test_input18_1_0 create mode 100644 inputs/test_input18_1_1 create mode 100644 inputs/test_input18_2_0 create mode 100644 inputs/test_input18_2_1 diff --git a/day18.py b/day18.py new file mode 100644 index 0000000..27425ad --- /dev/null +++ b/day18.py @@ -0,0 +1,110 @@ +from itertools import combinations +from math import ceil +from tools.aoc import AOCDay +from typing import Any + + +class Snailfish: + def __init__(self, fish_str: str): + self.pairs = fish_str + while self.reduce(): + pass + + def __add__(self, other): + return Snailfish("[%s,%s]" % (self.pairs, other.pairs)) + + def reduce(self): + open_count = 0 + for i, c in enumerate(self.pairs): + if c == "]": + open_count -= 1 + elif c == "[": + open_count += 1 + if open_count == 5: + index_explode = i + while self.pairs[index_explode + 1] == "[" or self.pairs[index_explode + 3] == "[": + if self.pairs[index_explode + 1] == "[": + index_explode += 1 + if self.pairs[index_explode + 3] == "[": + index_explode += 3 + explode_pair = self.pairs[index_explode:self.pairs.index("]", index_explode) + 1] + explode_left, explode_right = map(int, explode_pair[1:-1].split(",")) + old_number_left = "" + old_number_right = "" + new_number_left = "" + new_number_right = "" + index_left = index_explode + index_right = index_explode + len(explode_pair) + for i_left in range(index_explode, 0, -1): + if self.pairs[i_left] not in ['[', ']', ',']: + il_add = 0 + while self.pairs[i_left - il_add - 1] in "0123456789": + il_add += 1 + index_left = i_left - il_add + old_number_left = self.pairs[i_left - il_add:i_left + 1] + new_number_left = str(int(old_number_left) + explode_left) + break + for i_right in range(index_explode + len(explode_pair), len(self.pairs)): + if self.pairs[i_right] not in ['[', ']', ',']: + ir_add = 0 + while self.pairs[i_right + ir_add + 1] in "0123456789": + ir_add += 1 + index_right = i_right + old_number_right = self.pairs[i_right:i_right + ir_add + 1] + new_number_right = str(int(old_number_right) + explode_right) + break + new_pairs = "" + if index_left != index_explode: + new_pairs += self.pairs[:index_left] + new_number_left + self.pairs[index_left + len(old_number_left):index_explode] + else: + new_pairs = self.pairs[:index_explode] + new_pairs += "0" + if index_right != index_explode + len(explode_pair): + new_pairs += self.pairs[index_explode + len(explode_pair):index_right] + new_number_right + self.pairs[index_right + len(old_number_right):] + else: + new_pairs += self.pairs[index_explode + len(explode_pair):] + self.pairs = new_pairs + return True + + for i in range(1, len(self.pairs)): + if self.pairs[i - 1] not in ["[", "]", ","] and self.pairs[i] not in ["[", "]", ","]: + number = int(self.pairs[i-1:i+1]) + self.pairs = self.pairs.replace(str(number), "[%d,%d]" % (number // 2, int(ceil(number / 2))), 1) + return True + + return False + + def getMagnitude(self) -> int: + pairs = self.pairs + while "[" in pairs: + for i in range(len(pairs)): + if pairs[i] == "]": + r = i + 1 + l = i - 1 + while pairs[l] != "[": + l -= 1 + replace_pair = pairs[l:r] + num1, num2 = map(int, replace_pair[1:-1].split(",")) + pairs = pairs.replace(replace_pair, str(num1 * 3 + num2 * 2)) + break + + return int(pairs) + + +class Day(AOCDay): + test_solutions_p1 = [4140, 4417] + test_solutions_p2 = [3993, 4796] + + def part1(self) -> Any: + snailfishes = [Snailfish(x) for x in self.getInput()] + return sum(snailfishes[1:], start=snailfishes[0]).getMagnitude() + + def part2(self) -> Any: + snailfishes = [Snailfish(x) for x in self.getInput()] + max_mag = 0 + for a, b in combinations(snailfishes, 2): + sub_mag_a = (a + b).getMagnitude() + sub_mag_b = (b + a).getMagnitude() + max_mag = max(max_mag, sub_mag_a, sub_mag_b) + + return max_mag diff --git a/inputs/input18 b/inputs/input18 new file mode 100644 index 0000000..7e0d113 --- /dev/null +++ b/inputs/input18 @@ -0,0 +1,100 @@ +[[[[2,2],7],[[9,2],[5,2]]],[4,[[8,9],9]]] +[[8,8],[5,[[2,9],1]]] +[0,[3,[[9,2],[3,1]]]] +[9,[[4,5],[5,[3,2]]]] +[[0,[4,3]],[2,[[1,4],[3,0]]]] +[[[9,[0,2]],[[2,6],9]],2] +[1,[[[6,0],[2,6]],[[7,5],[5,6]]]] +[[[1,[6,6]],[6,[5,2]]],[[[5,6],4],9]] +[6,[[7,[1,4]],4]] +[[[[7,6],[0,5]],[[5,4],0]],[[3,[2,3]],[[0,2],[6,4]]]] +[[[3,4],7],[[[8,1],7],[3,[1,8]]]] +[[[[6,5],0],[[5,2],6]],[[1,3],[0,[5,2]]]] +[[[1,2],3],[[0,[3,7]],[4,[5,2]]]] +[[[[4,4],3],2],[2,[6,3]]] +[[[4,5],[[6,4],[8,5]]],[[[5,1],3],[8,3]]] +[[6,[[9,0],6]],[3,[[3,3],3]]] +[[8,[5,[1,7]]],[[4,5],[1,2]]] +[[[[9,1],0],[[1,6],9]],[[8,[7,4]],9]] +[[[3,1],[3,[5,5]]],[[[8,4],[2,9]],[6,[0,1]]]] +[[7,4],[[6,3],[[8,3],[2,3]]]] +[[[2,[5,6]],[[7,9],[8,7]]],[[3,5],[[1,7],[9,8]]]] +[[[[2,8],1],[[1,9],[7,6]]],6] +[[[[1,9],[5,5]],[7,8]],[[3,9],[2,[5,1]]]] +[[4,[[6,7],6]],[1,[6,[6,5]]]] +[[[[0,3],[2,7]],[7,1]],[[4,3],[[1,0],6]]] +[[[[0,8],7],[[5,4],[8,6]]],[[1,[6,5]],5]] +[[6,[[0,3],5]],[[9,[9,8]],0]] +[[0,1],9] +[[[[3,0],4],4],4] +[[[0,8],[[1,7],1]],[[9,1],[4,[2,4]]]] +[[5,[[6,1],2]],[[4,[5,9]],[[8,6],6]]] +[[4,9],[[5,0],[[4,4],3]]] +[[[[7,7],3],[3,[0,0]]],[1,[[0,8],[9,9]]]] +[[[1,6],[9,1]],4] +[[4,4],[[[0,0],9],[[2,0],[8,7]]]] +[[7,[[6,8],9]],[[2,[7,6]],[6,[8,1]]]] +[[[[7,9],[6,9]],[7,[2,5]]],[[[4,8],[3,7]],8]] +[[[8,7],[[9,8],[3,6]]],[[[2,1],[4,7]],[[3,9],5]]] +[[0,[[9,8],[5,3]]],[[9,6],[1,6]]] +[9,[[[7,4],[9,9]],5]] +[[9,[[6,7],[2,6]]],[[[2,8],[1,9]],[[4,1],[6,2]]]] +[[1,[9,5]],[0,[[1,8],0]]] +[[3,[7,6]],[8,[[3,2],[3,0]]]] +[[4,6],[6,3]] +[[[1,5],[[7,8],[6,4]]],[[3,[5,4]],[[9,8],1]]] +[[[[8,5],5],[[7,9],8]],[[5,2],[8,6]]] +[[[[3,4],9],[2,8]],[1,[9,8]]] +[[[6,9],8],[[7,9],[6,[8,5]]]] +[[[[7,4],9],1],7] +[[[[0,5],[3,4]],[9,[9,7]]],[[1,6],5]] +[6,[[[9,9],6],[[5,6],7]]] +[[[1,4],[[4,6],[9,4]]],[[[0,3],2],[[1,9],6]]] +[[8,[1,8]],[1,[5,[2,0]]]] +[[[4,5],[[6,6],1]],[[4,0],[[9,9],[3,6]]]] +[[9,[[0,0],[5,3]]],[[5,1],7]] +[[[9,4],[[5,1],[2,7]]],[6,[6,1]]] +[[8,5],[[[0,2],[2,6]],[3,[5,0]]]] +[[[[4,8],[3,6]],[3,[3,1]]],[0,[6,3]]] +[[[5,[9,6]],[3,[1,7]]],[[1,[9,2]],[6,5]]] +[[[[5,2],[9,4]],[[6,5],7]],[[4,8],[[7,1],2]]] +[[[5,[1,5]],5],[[[5,1],[0,9]],6]] +[[4,[3,[9,9]]],[[[7,1],[6,5]],2]] +[8,[[7,6],[8,7]]] +[[[[4,2],5],[3,2]],[[2,7],[[7,2],[9,2]]]] +[[[8,1],1],[5,[[0,9],[5,9]]]] +[[[[2,2],[4,0]],2],[[9,[5,4]],[[2,9],[8,6]]]] +[[[[6,8],0],[4,[1,5]]],[6,[[8,0],[6,6]]]] +[[[3,0],2],5] +[[[2,6],[5,[9,9]]],2] +[[[[4,8],7],[0,0]],[[8,6],[[9,6],9]]] +[[[1,4],0],[[[8,8],[9,3]],5]] +[[[7,[8,8]],[[0,9],3]],7] +[[[[3,1],[9,9]],[[7,9],7]],[[6,5],[[4,7],5]]] +[[[1,3],2],[8,0]] +[[8,[[5,0],[4,4]]],2] +[[3,4],[[[4,8],4],[[3,4],8]]] +[[4,[5,1]],[[8,[8,2]],[[3,5],[6,4]]]] +[[[[7,6],5],[9,[7,3]]],[[4,[6,4]],[[6,1],9]]] +[[0,[3,1]],[[4,[5,7]],6]] +[[2,[[7,2],[4,5]]],1] +[[[0,2],[3,[2,8]]],[[0,[0,6]],[1,[7,7]]]] +[[1,[0,[7,0]]],[[[1,2],[1,9]],[4,[1,4]]]] +[[[5,[7,4]],[[5,9],[7,0]]],[[[7,9],3],[[5,5],1]]] +[[[[7,9],[3,0]],3],[8,8]] +[[[[6,7],4],[[0,3],3]],[[2,[5,3]],8]] +[[0,5],[3,[[6,6],[5,2]]]] +[9,[[2,[8,7]],[6,[2,6]]]] +[7,[[[1,9],[2,9]],[[1,0],5]]] +[[5,0],[8,[2,2]]] +[[3,[2,[8,0]]],3] +[[[0,2],[6,[4,5]]],[3,[9,[0,4]]]] +[[[6,7],7],[[8,[4,5]],[4,[1,7]]]] +[[[[2,7],[9,6]],[5,0]],3] +[[[[3,2],5],[8,3]],[[4,1],[[8,8],[6,4]]]] +[[[2,[5,3]],[1,4]],[[[3,9],9],[[7,8],[5,7]]]] +[5,[[[8,2],[0,4]],[[5,3],0]]] +[[[3,4],3],[3,[[3,8],[2,1]]]] +[5,[[[3,8],[5,2]],2]] +[[[[3,8],6],[8,9]],[[3,[7,5]],[[4,4],2]]] +[[[2,[3,9]],[[4,5],[7,9]]],5] diff --git a/inputs/test_input18_1_0 b/inputs/test_input18_1_0 new file mode 100644 index 0000000..1368dc4 --- /dev/null +++ b/inputs/test_input18_1_0 @@ -0,0 +1,10 @@ +[[[0,[5,8]],[[1,7],[9,6]]],[[4,[1,2]],[[1,4],2]]] +[[[5,[2,8]],4],[5,[[9,9],0]]] +[6,[[[6,2],[5,6]],[[7,6],[4,7]]]] +[[[6,[0,7]],[0,9]],[4,[9,[9,0]]]] +[[[7,[6,4]],[3,[1,3]]],[[[5,5],1],9]] +[[6,[[7,3],[3,2]]],[[[3,8],[5,7]],4]] +[[[[5,4],[7,7]],8],[[8,3],8]] +[[9,3],[[9,9],[6,[4,9]]]] +[[2,[[7,7],7]],[[5,8],[[9,3],[0,2]]]] +[[[[5,2],5],[8,[3,7]]],[[5,[7,5]],[4,4]]] diff --git a/inputs/test_input18_1_1 b/inputs/test_input18_1_1 new file mode 100644 index 0000000..7e0d113 --- /dev/null +++ b/inputs/test_input18_1_1 @@ -0,0 +1,100 @@ +[[[[2,2],7],[[9,2],[5,2]]],[4,[[8,9],9]]] +[[8,8],[5,[[2,9],1]]] +[0,[3,[[9,2],[3,1]]]] +[9,[[4,5],[5,[3,2]]]] +[[0,[4,3]],[2,[[1,4],[3,0]]]] +[[[9,[0,2]],[[2,6],9]],2] +[1,[[[6,0],[2,6]],[[7,5],[5,6]]]] +[[[1,[6,6]],[6,[5,2]]],[[[5,6],4],9]] +[6,[[7,[1,4]],4]] +[[[[7,6],[0,5]],[[5,4],0]],[[3,[2,3]],[[0,2],[6,4]]]] +[[[3,4],7],[[[8,1],7],[3,[1,8]]]] +[[[[6,5],0],[[5,2],6]],[[1,3],[0,[5,2]]]] +[[[1,2],3],[[0,[3,7]],[4,[5,2]]]] +[[[[4,4],3],2],[2,[6,3]]] +[[[4,5],[[6,4],[8,5]]],[[[5,1],3],[8,3]]] +[[6,[[9,0],6]],[3,[[3,3],3]]] +[[8,[5,[1,7]]],[[4,5],[1,2]]] +[[[[9,1],0],[[1,6],9]],[[8,[7,4]],9]] +[[[3,1],[3,[5,5]]],[[[8,4],[2,9]],[6,[0,1]]]] +[[7,4],[[6,3],[[8,3],[2,3]]]] +[[[2,[5,6]],[[7,9],[8,7]]],[[3,5],[[1,7],[9,8]]]] +[[[[2,8],1],[[1,9],[7,6]]],6] +[[[[1,9],[5,5]],[7,8]],[[3,9],[2,[5,1]]]] +[[4,[[6,7],6]],[1,[6,[6,5]]]] +[[[[0,3],[2,7]],[7,1]],[[4,3],[[1,0],6]]] +[[[[0,8],7],[[5,4],[8,6]]],[[1,[6,5]],5]] +[[6,[[0,3],5]],[[9,[9,8]],0]] +[[0,1],9] +[[[[3,0],4],4],4] +[[[0,8],[[1,7],1]],[[9,1],[4,[2,4]]]] +[[5,[[6,1],2]],[[4,[5,9]],[[8,6],6]]] +[[4,9],[[5,0],[[4,4],3]]] +[[[[7,7],3],[3,[0,0]]],[1,[[0,8],[9,9]]]] +[[[1,6],[9,1]],4] +[[4,4],[[[0,0],9],[[2,0],[8,7]]]] +[[7,[[6,8],9]],[[2,[7,6]],[6,[8,1]]]] +[[[[7,9],[6,9]],[7,[2,5]]],[[[4,8],[3,7]],8]] +[[[8,7],[[9,8],[3,6]]],[[[2,1],[4,7]],[[3,9],5]]] +[[0,[[9,8],[5,3]]],[[9,6],[1,6]]] +[9,[[[7,4],[9,9]],5]] +[[9,[[6,7],[2,6]]],[[[2,8],[1,9]],[[4,1],[6,2]]]] +[[1,[9,5]],[0,[[1,8],0]]] +[[3,[7,6]],[8,[[3,2],[3,0]]]] +[[4,6],[6,3]] +[[[1,5],[[7,8],[6,4]]],[[3,[5,4]],[[9,8],1]]] +[[[[8,5],5],[[7,9],8]],[[5,2],[8,6]]] +[[[[3,4],9],[2,8]],[1,[9,8]]] +[[[6,9],8],[[7,9],[6,[8,5]]]] +[[[[7,4],9],1],7] +[[[[0,5],[3,4]],[9,[9,7]]],[[1,6],5]] +[6,[[[9,9],6],[[5,6],7]]] +[[[1,4],[[4,6],[9,4]]],[[[0,3],2],[[1,9],6]]] +[[8,[1,8]],[1,[5,[2,0]]]] +[[[4,5],[[6,6],1]],[[4,0],[[9,9],[3,6]]]] +[[9,[[0,0],[5,3]]],[[5,1],7]] +[[[9,4],[[5,1],[2,7]]],[6,[6,1]]] +[[8,5],[[[0,2],[2,6]],[3,[5,0]]]] +[[[[4,8],[3,6]],[3,[3,1]]],[0,[6,3]]] +[[[5,[9,6]],[3,[1,7]]],[[1,[9,2]],[6,5]]] +[[[[5,2],[9,4]],[[6,5],7]],[[4,8],[[7,1],2]]] +[[[5,[1,5]],5],[[[5,1],[0,9]],6]] +[[4,[3,[9,9]]],[[[7,1],[6,5]],2]] +[8,[[7,6],[8,7]]] +[[[[4,2],5],[3,2]],[[2,7],[[7,2],[9,2]]]] +[[[8,1],1],[5,[[0,9],[5,9]]]] +[[[[2,2],[4,0]],2],[[9,[5,4]],[[2,9],[8,6]]]] +[[[[6,8],0],[4,[1,5]]],[6,[[8,0],[6,6]]]] +[[[3,0],2],5] +[[[2,6],[5,[9,9]]],2] +[[[[4,8],7],[0,0]],[[8,6],[[9,6],9]]] +[[[1,4],0],[[[8,8],[9,3]],5]] +[[[7,[8,8]],[[0,9],3]],7] +[[[[3,1],[9,9]],[[7,9],7]],[[6,5],[[4,7],5]]] +[[[1,3],2],[8,0]] +[[8,[[5,0],[4,4]]],2] +[[3,4],[[[4,8],4],[[3,4],8]]] +[[4,[5,1]],[[8,[8,2]],[[3,5],[6,4]]]] +[[[[7,6],5],[9,[7,3]]],[[4,[6,4]],[[6,1],9]]] +[[0,[3,1]],[[4,[5,7]],6]] +[[2,[[7,2],[4,5]]],1] +[[[0,2],[3,[2,8]]],[[0,[0,6]],[1,[7,7]]]] +[[1,[0,[7,0]]],[[[1,2],[1,9]],[4,[1,4]]]] +[[[5,[7,4]],[[5,9],[7,0]]],[[[7,9],3],[[5,5],1]]] +[[[[7,9],[3,0]],3],[8,8]] +[[[[6,7],4],[[0,3],3]],[[2,[5,3]],8]] +[[0,5],[3,[[6,6],[5,2]]]] +[9,[[2,[8,7]],[6,[2,6]]]] +[7,[[[1,9],[2,9]],[[1,0],5]]] +[[5,0],[8,[2,2]]] +[[3,[2,[8,0]]],3] +[[[0,2],[6,[4,5]]],[3,[9,[0,4]]]] +[[[6,7],7],[[8,[4,5]],[4,[1,7]]]] +[[[[2,7],[9,6]],[5,0]],3] +[[[[3,2],5],[8,3]],[[4,1],[[8,8],[6,4]]]] +[[[2,[5,3]],[1,4]],[[[3,9],9],[[7,8],[5,7]]]] +[5,[[[8,2],[0,4]],[[5,3],0]]] +[[[3,4],3],[3,[[3,8],[2,1]]]] +[5,[[[3,8],[5,2]],2]] +[[[[3,8],6],[8,9]],[[3,[7,5]],[[4,4],2]]] +[[[2,[3,9]],[[4,5],[7,9]]],5] diff --git a/inputs/test_input18_2_0 b/inputs/test_input18_2_0 new file mode 100644 index 0000000..1368dc4 --- /dev/null +++ b/inputs/test_input18_2_0 @@ -0,0 +1,10 @@ +[[[0,[5,8]],[[1,7],[9,6]]],[[4,[1,2]],[[1,4],2]]] +[[[5,[2,8]],4],[5,[[9,9],0]]] +[6,[[[6,2],[5,6]],[[7,6],[4,7]]]] +[[[6,[0,7]],[0,9]],[4,[9,[9,0]]]] +[[[7,[6,4]],[3,[1,3]]],[[[5,5],1],9]] +[[6,[[7,3],[3,2]]],[[[3,8],[5,7]],4]] +[[[[5,4],[7,7]],8],[[8,3],8]] +[[9,3],[[9,9],[6,[4,9]]]] +[[2,[[7,7],7]],[[5,8],[[9,3],[0,2]]]] +[[[[5,2],5],[8,[3,7]]],[[5,[7,5]],[4,4]]] diff --git a/inputs/test_input18_2_1 b/inputs/test_input18_2_1 new file mode 100644 index 0000000..7e0d113 --- /dev/null +++ b/inputs/test_input18_2_1 @@ -0,0 +1,100 @@ +[[[[2,2],7],[[9,2],[5,2]]],[4,[[8,9],9]]] +[[8,8],[5,[[2,9],1]]] +[0,[3,[[9,2],[3,1]]]] +[9,[[4,5],[5,[3,2]]]] +[[0,[4,3]],[2,[[1,4],[3,0]]]] +[[[9,[0,2]],[[2,6],9]],2] +[1,[[[6,0],[2,6]],[[7,5],[5,6]]]] +[[[1,[6,6]],[6,[5,2]]],[[[5,6],4],9]] +[6,[[7,[1,4]],4]] +[[[[7,6],[0,5]],[[5,4],0]],[[3,[2,3]],[[0,2],[6,4]]]] +[[[3,4],7],[[[8,1],7],[3,[1,8]]]] +[[[[6,5],0],[[5,2],6]],[[1,3],[0,[5,2]]]] +[[[1,2],3],[[0,[3,7]],[4,[5,2]]]] +[[[[4,4],3],2],[2,[6,3]]] +[[[4,5],[[6,4],[8,5]]],[[[5,1],3],[8,3]]] +[[6,[[9,0],6]],[3,[[3,3],3]]] +[[8,[5,[1,7]]],[[4,5],[1,2]]] +[[[[9,1],0],[[1,6],9]],[[8,[7,4]],9]] +[[[3,1],[3,[5,5]]],[[[8,4],[2,9]],[6,[0,1]]]] +[[7,4],[[6,3],[[8,3],[2,3]]]] +[[[2,[5,6]],[[7,9],[8,7]]],[[3,5],[[1,7],[9,8]]]] +[[[[2,8],1],[[1,9],[7,6]]],6] +[[[[1,9],[5,5]],[7,8]],[[3,9],[2,[5,1]]]] +[[4,[[6,7],6]],[1,[6,[6,5]]]] +[[[[0,3],[2,7]],[7,1]],[[4,3],[[1,0],6]]] +[[[[0,8],7],[[5,4],[8,6]]],[[1,[6,5]],5]] +[[6,[[0,3],5]],[[9,[9,8]],0]] +[[0,1],9] +[[[[3,0],4],4],4] +[[[0,8],[[1,7],1]],[[9,1],[4,[2,4]]]] +[[5,[[6,1],2]],[[4,[5,9]],[[8,6],6]]] +[[4,9],[[5,0],[[4,4],3]]] +[[[[7,7],3],[3,[0,0]]],[1,[[0,8],[9,9]]]] +[[[1,6],[9,1]],4] +[[4,4],[[[0,0],9],[[2,0],[8,7]]]] +[[7,[[6,8],9]],[[2,[7,6]],[6,[8,1]]]] +[[[[7,9],[6,9]],[7,[2,5]]],[[[4,8],[3,7]],8]] +[[[8,7],[[9,8],[3,6]]],[[[2,1],[4,7]],[[3,9],5]]] +[[0,[[9,8],[5,3]]],[[9,6],[1,6]]] +[9,[[[7,4],[9,9]],5]] +[[9,[[6,7],[2,6]]],[[[2,8],[1,9]],[[4,1],[6,2]]]] +[[1,[9,5]],[0,[[1,8],0]]] +[[3,[7,6]],[8,[[3,2],[3,0]]]] +[[4,6],[6,3]] +[[[1,5],[[7,8],[6,4]]],[[3,[5,4]],[[9,8],1]]] +[[[[8,5],5],[[7,9],8]],[[5,2],[8,6]]] +[[[[3,4],9],[2,8]],[1,[9,8]]] +[[[6,9],8],[[7,9],[6,[8,5]]]] +[[[[7,4],9],1],7] +[[[[0,5],[3,4]],[9,[9,7]]],[[1,6],5]] +[6,[[[9,9],6],[[5,6],7]]] +[[[1,4],[[4,6],[9,4]]],[[[0,3],2],[[1,9],6]]] +[[8,[1,8]],[1,[5,[2,0]]]] +[[[4,5],[[6,6],1]],[[4,0],[[9,9],[3,6]]]] +[[9,[[0,0],[5,3]]],[[5,1],7]] +[[[9,4],[[5,1],[2,7]]],[6,[6,1]]] +[[8,5],[[[0,2],[2,6]],[3,[5,0]]]] +[[[[4,8],[3,6]],[3,[3,1]]],[0,[6,3]]] +[[[5,[9,6]],[3,[1,7]]],[[1,[9,2]],[6,5]]] +[[[[5,2],[9,4]],[[6,5],7]],[[4,8],[[7,1],2]]] +[[[5,[1,5]],5],[[[5,1],[0,9]],6]] +[[4,[3,[9,9]]],[[[7,1],[6,5]],2]] +[8,[[7,6],[8,7]]] +[[[[4,2],5],[3,2]],[[2,7],[[7,2],[9,2]]]] +[[[8,1],1],[5,[[0,9],[5,9]]]] +[[[[2,2],[4,0]],2],[[9,[5,4]],[[2,9],[8,6]]]] +[[[[6,8],0],[4,[1,5]]],[6,[[8,0],[6,6]]]] +[[[3,0],2],5] +[[[2,6],[5,[9,9]]],2] +[[[[4,8],7],[0,0]],[[8,6],[[9,6],9]]] +[[[1,4],0],[[[8,8],[9,3]],5]] +[[[7,[8,8]],[[0,9],3]],7] +[[[[3,1],[9,9]],[[7,9],7]],[[6,5],[[4,7],5]]] +[[[1,3],2],[8,0]] +[[8,[[5,0],[4,4]]],2] +[[3,4],[[[4,8],4],[[3,4],8]]] +[[4,[5,1]],[[8,[8,2]],[[3,5],[6,4]]]] +[[[[7,6],5],[9,[7,3]]],[[4,[6,4]],[[6,1],9]]] +[[0,[3,1]],[[4,[5,7]],6]] +[[2,[[7,2],[4,5]]],1] +[[[0,2],[3,[2,8]]],[[0,[0,6]],[1,[7,7]]]] +[[1,[0,[7,0]]],[[[1,2],[1,9]],[4,[1,4]]]] +[[[5,[7,4]],[[5,9],[7,0]]],[[[7,9],3],[[5,5],1]]] +[[[[7,9],[3,0]],3],[8,8]] +[[[[6,7],4],[[0,3],3]],[[2,[5,3]],8]] +[[0,5],[3,[[6,6],[5,2]]]] +[9,[[2,[8,7]],[6,[2,6]]]] +[7,[[[1,9],[2,9]],[[1,0],5]]] +[[5,0],[8,[2,2]]] +[[3,[2,[8,0]]],3] +[[[0,2],[6,[4,5]]],[3,[9,[0,4]]]] +[[[6,7],7],[[8,[4,5]],[4,[1,7]]]] +[[[[2,7],[9,6]],[5,0]],3] +[[[[3,2],5],[8,3]],[[4,1],[[8,8],[6,4]]]] +[[[2,[5,3]],[1,4]],[[[3,9],9],[[7,8],[5,7]]]] +[5,[[[8,2],[0,4]],[[5,3],0]]] +[[[3,4],3],[3,[[3,8],[2,1]]]] +[5,[[[3,8],[5,2]],2]] +[[[[3,8],6],[8,9]],[[3,[7,5]],[[4,4],2]]] +[[[2,[3,9]],[[4,5],[7,9]]],5]