From 9bbcf416572d2e0d6f1a271601c3852531def32a Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sun, 29 Dec 2024 23:49:45 -0500 Subject: [PATCH 01/48] 2018: d14: ex1: add input --- 2018/d14/ex1/input | 1 + 1 file changed, 1 insertion(+) create mode 100644 2018/d14/ex1/input diff --git a/2018/d14/ex1/input b/2018/d14/ex1/input new file mode 100644 index 0000000..85b04f5 --- /dev/null +++ b/2018/d14/ex1/input @@ -0,0 +1 @@ +556061 From a7eac8ea74a720dfa74673563e6b8a63b8c9f523 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sun, 29 Dec 2024 23:49:51 -0500 Subject: [PATCH 02/48] 2018: d14: ex1: add solution --- 2018/d14/ex1/ex1.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 2018/d14/ex1/ex1.py diff --git a/2018/d14/ex1/ex1.py b/2018/d14/ex1/ex1.py new file mode 100755 index 0000000..1f25cb8 --- /dev/null +++ b/2018/d14/ex1/ex1.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python + +import functools +import sys + + +def solve(input: str) -> int: + n_recipes = int(input) + + scores = [3, 7] + elves = [0, 1] + + while (len(scores) - 10) < n_recipes: + sum = scores[elves[0]] + scores[elves[1]] + scores.extend(map(int, str(sum))) + elves = [(elf + 1 + scores[elf]) % len(scores) for elf in elves] + + return functools.reduce(lambda lhs, rhs: lhs * 10 + rhs, scores[-10:]) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 05e7c391425f0bc27c5953bf99e01998c844287c Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sun, 29 Dec 2024 23:49:57 -0500 Subject: [PATCH 03/48] 2018: d14: ex2: add input --- 2018/d14/ex2/input | 1 + 1 file changed, 1 insertion(+) create mode 100644 2018/d14/ex2/input diff --git a/2018/d14/ex2/input b/2018/d14/ex2/input new file mode 100644 index 0000000..85b04f5 --- /dev/null +++ b/2018/d14/ex2/input @@ -0,0 +1 @@ +556061 From 1010cacbe963dcd885e3ab70fc0a6c4fe36cb77d Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sun, 29 Dec 2024 23:50:09 -0500 Subject: [PATCH 04/48] 2018: d14: ex2: add solution --- 2018/d14/ex2/ex2.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 2018/d14/ex2/ex2.py diff --git a/2018/d14/ex2/ex2.py b/2018/d14/ex2/ex2.py new file mode 100755 index 0000000..844c250 --- /dev/null +++ b/2018/d14/ex2/ex2.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python + +import sys + + +def solve(input: str) -> int: + digits = [int(n) for n in input.strip()] + + scores = [3, 7] + elves = [0, 1] + + while scores[-len(digits) :] != digits and scores[-len(digits) - 1 : -1] != digits: + sum = scores[elves[0]] + scores[elves[1]] + scores.extend(map(int, str(sum))) + elves = [(elf + 1 + scores[elf]) % len(scores) for elf in elves] + + left_of_digits = len(scores) - len(digits) - (scores[-len(digits) :] != digits) + return left_of_digits + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 583c913bbe67f2aa2cc9db0075e2e9c8e442f53e Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 30 Dec 2024 16:22:45 -0500 Subject: [PATCH 05/48] 2018: d15: ex1: add input --- 2018/d15/ex1/input | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 2018/d15/ex1/input diff --git a/2018/d15/ex1/input b/2018/d15/ex1/input new file mode 100644 index 0000000..922938f --- /dev/null +++ b/2018/d15/ex1/input @@ -0,0 +1,32 @@ +################################ +######################........## +####################...........# +##############G.G..G.#.......#.# +#############.....G...#....###.# +############..##.G.............# +#############...#...GG......#### +#############......G......###### +##############G....EG.....###### +#############.......G.....###### +############.....G......#.###### +###########......E...G.######### +##########....#####......####### +##########G..#######......###### +######......#########....####### +#####....G..#########....####### +###.......#.#########....####### +###.G.....#.#########E...####### +#........##.#########E...####### +#.......###..#######...E.####### +#.#.#.........#####.......###### +#.###.#.###.G..............##### +####.....###..........E.##.##### +#......G####.E..........######## +###..G..####...........####..### +####..########..E......###...### +###..............#...E...#.##### +##.........##....##........##### +#.......#.####.........######### +#...##G.##########....E######### +#...##...####################### +################################ From cea7f60e469a47d7299dbdb725c54df6715f55b2 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 30 Dec 2024 16:22:52 -0500 Subject: [PATCH 06/48] 2018: d15: ex1: add solution --- 2018/d15/ex1/ex1.py | 192 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 192 insertions(+) create mode 100755 2018/d15/ex1/ex1.py diff --git a/2018/d15/ex1/ex1.py b/2018/d15/ex1/ex1.py new file mode 100755 index 0000000..54d2de5 --- /dev/null +++ b/2018/d15/ex1/ex1.py @@ -0,0 +1,192 @@ +#!/usr/bin/env python + +import dataclasses +import enum +import sys +from typing import Iterator, NamedTuple + + +class Point(NamedTuple): + x: int + y: int + + # Returned in reading order + def neighbours(self) -> Iterator["Point"]: + for dx, dy in ( + (-1, 0), + (0, -1), + (0, 1), + (1, 0), + ): + yield Point(self.x + dx, self.y + dy) + + +class Unit(enum.StrEnum): + ELF = "E" + GOBLIN = "G" + + def ennemy(self) -> "Unit": + if self == Unit.ELF: + return Unit.GOBLIN + if self == Unit.GOBLIN: + return Unit.ELF + assert False # Sanity check + + +@dataclasses.dataclass +class UnitData: + hp: int = 200 + power: int = 3 + + +def solve(input: str) -> int: + def parse(input: list[str]) -> tuple[set[Point], dict[Unit, set[Point]]]: + walls: set[Point] = set() + units: dict[Unit, set[Point]] = {u: set() for u in Unit} + + for x, line in enumerate(input): + for y, c in enumerate(line): + p = Point(x, y) + if c in Unit: + units[Unit(c)].add(p) + if c == "#": + walls.add(p) + + return walls, units + + def double_bfs( + unit_type: Unit, + unit_pos: Point, + walls: set[Point], + units: dict[Unit, set[Point]], + ) -> Point | None: + def bfs( + start: Point, + targets: set[Point], + blockers: set[Point], + ) -> Point | None: + frontier = [start] + seen: set[Point] = set() + while frontier: + new_frontier: set[Point] = set() + + for p in frontier: + if p in targets: + return p + seen.add(p) + for n in p.neighbours(): + if n in seen: + continue + if n in blockers: + continue + new_frontier.add(n) + frontier = sorted(new_frontier) + + return None + + blockers = walls | units[unit_type] + ennemies = units[unit_type.ennemy()] + + # First BFS from start to square next to an ennemy + targets_in_range = { + n for ennemy in ennemies for n in ennemy.neighbours() if n not in blockers + } + if (target := bfs(unit_pos, targets_in_range, blockers)) is None: + return None + + # Then back from chosen target to one of the movement squares + movement_squares = {n for n in unit_pos.neighbours() if n not in blockers} + return bfs(target, movement_squares, blockers) + + def do_move( + unit_type: Unit, + unit_pos: Point, + walls: set[Point], + units: dict[Unit, set[Point]], + unit_data: dict[Point, UnitData], + ) -> Point: + # If already next to an ennemy, do not move + if any(n in units[unit_type.ennemy()] for n in unit_pos.neighbours()): + return unit_pos + + new_pos = double_bfs(unit_type, unit_pos, walls, units) + + # Nowhere to move to, no-op + if new_pos is None: + return unit_pos + + assert new_pos != unit_pos # Sanity check + assert unit_pos in units[unit_type] # Sanity check + assert new_pos not in units[unit_type] # Sanity check + + # Make the movement in-place + units[unit_type] ^= {unit_pos, new_pos} + unit_data[new_pos] = unit_data.pop(unit_pos) + + return new_pos + + def do_attack( + unit_type: Unit, + unit_pos: Point, + units: dict[Unit, set[Point]], + unit_data: dict[Point, UnitData], + ) -> None: + # Look for an attack target + target = min( + (n for n in unit_pos.neighbours() if n in units[unit_type.ennemy()]), + key=lambda p: unit_data[p].hp, + default=None, + ) + + # If not in range, no-op + if target is None: + return + + assert target not in units[unit_type] # Sanity check + assert target in units[unit_type.ennemy()] # Sanity check + assert unit_data[target].hp > 0 # Sanity check + + # Make the attack in-place + unit_data[target].hp -= unit_data[unit_pos].power + # And if we killed it, remove it from `units` + if unit_data[target].hp <= 0: + units[unit_type.ennemy()].remove(target) + unit_data.pop(target) + + def turn( + walls: set[Point], + units: dict[Unit, set[Point]], + unit_data: dict[Point, UnitData], + ) -> bool: + turn_order = sorted((p, u) for u, points in units.items() for p in points) + for p, u in turn_order: + # Don't do anything if the unit is dead + if p not in units[u]: + continue + + # If no ennemies left, finish the turn early and indicate that we're done + if not units[u.ennemy()]: + return False + + # Movements and attacks are made in-place + p = do_move(u, p, walls, units, unit_data) + do_attack(u, p, units, unit_data) + + return True + + walls, units = parse(input.splitlines()) + unit_data = {p: UnitData() for points in units.values() for p in points} + + turns = 0 + while turn(walls, units, unit_data): + turns += 1 + return turns * sum(data.hp for data in unit_data.values()) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From a7a5f62afeff7e492e5dcfe231cac571a9f2888f Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 30 Dec 2024 16:22:58 -0500 Subject: [PATCH 07/48] 2018: d15: ex2: add input --- 2018/d15/ex2/input | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 2018/d15/ex2/input diff --git a/2018/d15/ex2/input b/2018/d15/ex2/input new file mode 100644 index 0000000..922938f --- /dev/null +++ b/2018/d15/ex2/input @@ -0,0 +1,32 @@ +################################ +######################........## +####################...........# +##############G.G..G.#.......#.# +#############.....G...#....###.# +############..##.G.............# +#############...#...GG......#### +#############......G......###### +##############G....EG.....###### +#############.......G.....###### +############.....G......#.###### +###########......E...G.######### +##########....#####......####### +##########G..#######......###### +######......#########....####### +#####....G..#########....####### +###.......#.#########....####### +###.G.....#.#########E...####### +#........##.#########E...####### +#.......###..#######...E.####### +#.#.#.........#####.......###### +#.###.#.###.G..............##### +####.....###..........E.##.##### +#......G####.E..........######## +###..G..####...........####..### +####..########..E......###...### +###..............#...E...#.##### +##.........##....##........##### +#.......#.####.........######### +#...##G.##########....E######### +#...##...####################### +################################ From fd604ff8a474d54257c23f804ae327cb26e62faf Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 30 Dec 2024 16:23:22 -0500 Subject: [PATCH 08/48] 2018: d15: ex2: add solution --- 2018/d15/ex2/ex2.py | 239 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 239 insertions(+) create mode 100755 2018/d15/ex2/ex2.py diff --git a/2018/d15/ex2/ex2.py b/2018/d15/ex2/ex2.py new file mode 100755 index 0000000..b67ec81 --- /dev/null +++ b/2018/d15/ex2/ex2.py @@ -0,0 +1,239 @@ +#!/usr/bin/env python + +import copy +import dataclasses +import enum +import itertools +import sys +from typing import Iterator, NamedTuple + + +class Point(NamedTuple): + x: int + y: int + + # Returned in reading order + def neighbours(self) -> Iterator["Point"]: + for dx, dy in ( + (-1, 0), + (0, -1), + (0, 1), + (1, 0), + ): + yield Point(self.x + dx, self.y + dy) + + +class Unit(enum.StrEnum): + ELF = "E" + GOBLIN = "G" + + def ennemy(self) -> "Unit": + if self == Unit.ELF: + return Unit.GOBLIN + if self == Unit.GOBLIN: + return Unit.ELF + assert False # Sanity check + + +@dataclasses.dataclass +class UnitData: + hp: int = 200 + power: int = 3 + + +class ElfDiedError(Exception): + pass + + +def solve(input: str) -> int: + def parse(input: list[str]) -> tuple[set[Point], dict[Unit, set[Point]]]: + walls: set[Point] = set() + units: dict[Unit, set[Point]] = {u: set() for u in Unit} + + for x, line in enumerate(input): + for y, c in enumerate(line): + p = Point(x, y) + if c in Unit: + units[Unit(c)].add(p) + if c == "#": + walls.add(p) + + return walls, units + + def double_bfs( + unit_type: Unit, + unit_pos: Point, + walls: set[Point], + units: dict[Unit, set[Point]], + ) -> Point | None: + def bfs( + start: Point, + targets: set[Point], + blockers: set[Point], + ) -> Point | None: + frontier = [start] + seen: set[Point] = set() + while frontier: + new_frontier: set[Point] = set() + + for p in frontier: + if p in targets: + return p + seen.add(p) + for n in p.neighbours(): + if n in seen: + continue + if n in blockers: + continue + new_frontier.add(n) + frontier = sorted(new_frontier) + + return None + + blockers = walls | units[unit_type] + ennemies = units[unit_type.ennemy()] + + # First BFS from start to square next to an ennemy + targets_in_range = { + n for ennemy in ennemies for n in ennemy.neighbours() if n not in blockers + } + if (target := bfs(unit_pos, targets_in_range, blockers)) is None: + return None + + # Then back from chosen target to one of the movement squares + movement_squares = {n for n in unit_pos.neighbours() if n not in blockers} + return bfs(target, movement_squares, blockers) + + def do_move( + unit_type: Unit, + unit_pos: Point, + walls: set[Point], + units: dict[Unit, set[Point]], + unit_data: dict[Point, UnitData], + ) -> Point: + # If already next to an ennemy, do not move + if any(n in units[unit_type.ennemy()] for n in unit_pos.neighbours()): + return unit_pos + + new_pos = double_bfs(unit_type, unit_pos, walls, units) + + # Nowhere to move to, no-op + if new_pos is None: + return unit_pos + + assert new_pos != unit_pos # Sanity check + assert unit_pos in units[unit_type] # Sanity check + assert new_pos not in units[unit_type] # Sanity check + + # Make the movement in-place + units[unit_type] ^= {unit_pos, new_pos} + unit_data[new_pos] = unit_data.pop(unit_pos) + + return new_pos + + def do_attack( + unit_type: Unit, + unit_pos: Point, + units: dict[Unit, set[Point]], + unit_data: dict[Point, UnitData], + ) -> None: + # Look for an attack target + target = min( + (n for n in unit_pos.neighbours() if n in units[unit_type.ennemy()]), + key=lambda p: unit_data[p].hp, + default=None, + ) + + # If not in range, no-op + if target is None: + return + + assert target not in units[unit_type] # Sanity check + assert target in units[unit_type.ennemy()] # Sanity check + assert unit_data[target].hp > 0 # Sanity check + + # Make the attack in-place + unit_data[target].hp -= unit_data[unit_pos].power + # And if we killed it, remove it from `units` + if unit_data[target].hp <= 0: + if unit_type.ennemy() == Unit.ELF: + raise ElfDiedError + units[unit_type.ennemy()].remove(target) + unit_data.pop(target) + + def turn( + walls: set[Point], + units: dict[Unit, set[Point]], + unit_data: dict[Point, UnitData], + ) -> bool: + turn_order = sorted((p, u) for u, points in units.items() for p in points) + for p, u in turn_order: + # Don't do anything if the unit is dead + if p not in units[u]: + continue + + # If no ennemies left, finish the turn early and indicate that we're done + if not units[u.ennemy()]: + return False + + # Movements and attacks are made in-place + p = do_move(u, p, walls, units, unit_data) + do_attack(u, p, units, unit_data) + + return True + + def print_map(walls: set[Point], units: dict[Unit, set[Point]]) -> None: + max_x, max_y = max(p.x for p in walls), max(p.y for p in walls) + for x in range(0, max_x + 1): + for y in range(0, max_y + 1): + p = Point(x, y) + for u in Unit: + if p in units[u]: + print(str(u), end="") + break + else: + print("#" if p in walls else ".", end="") + print() + print() + + def run_to_completion( + walls: set[Point], + units: dict[Unit, set[Point]], + unit_data: dict[Point, UnitData], + ) -> int: + turns = 0 + while turn(walls, units, unit_data): + turns += 1 + return turns * sum(data.hp for data in unit_data.values()) + + def arm_elves( + walls: set[Point], + units: dict[Unit, set[Point]], + ) -> int: + for elf_power in itertools.count(start=3): + try: + unit_data = { + p: UnitData(power=elf_power if u == Unit.ELF else 3) + for u, points in units.items() + for p in points + } + return run_to_completion( + copy.deepcopy(walls), + copy.deepcopy(units), + unit_data, + ) + except ElfDiedError: + pass + assert False # Sanity check + + walls, units = parse(input.splitlines()) + return arm_elves(walls, units) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From d0013a1e17080e9aa507fbba48a946977c555416 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 30 Dec 2024 17:23:38 -0500 Subject: [PATCH 09/48] 2018: d16: ex1: add input --- 2018/d16/ex1/input | 4148 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 4148 insertions(+) create mode 100644 2018/d16/ex1/input diff --git a/2018/d16/ex1/input b/2018/d16/ex1/input new file mode 100644 index 0000000..88aab0a --- /dev/null +++ b/2018/d16/ex1/input @@ -0,0 +1,4148 @@ +Before: [1, 1, 0, 1] +0 1 0 1 +After: [1, 1, 0, 1] + +Before: [2, 2, 2, 1] +2 1 2 2 +After: [2, 2, 1, 1] + +Before: [1, 3, 2, 2] +1 2 2 0 +After: [4, 3, 2, 2] + +Before: [2, 2, 1, 1] +8 0 2 1 +After: [2, 3, 1, 1] + +Before: [0, 1, 2, 2] +7 3 1 1 +After: [0, 3, 2, 2] + +Before: [1, 2, 2, 0] +8 2 0 1 +After: [1, 3, 2, 0] + +Before: [2, 2, 2, 0] +2 1 2 0 +After: [1, 2, 2, 0] + +Before: [0, 1, 1, 1] +3 1 0 1 +After: [0, 1, 1, 1] + +Before: [2, 3, 2, 2] +15 1 2 2 +After: [2, 3, 6, 2] + +Before: [0, 3, 1, 1] +9 0 0 3 +After: [0, 3, 1, 0] + +Before: [2, 0, 1, 1] +4 2 3 2 +After: [2, 0, 0, 1] + +Before: [1, 1, 3, 3] +6 0 3 3 +After: [1, 1, 3, 0] + +Before: [3, 2, 3, 2] +11 1 3 3 +After: [3, 2, 3, 1] + +Before: [3, 2, 1, 2] +14 3 3 1 +After: [3, 6, 1, 2] + +Before: [1, 0, 1, 2] +10 1 0 1 +After: [1, 1, 1, 2] + +Before: [1, 2, 0, 2] +11 1 3 2 +After: [1, 2, 1, 2] + +Before: [3, 3, 0, 0] +14 0 3 2 +After: [3, 3, 9, 0] + +Before: [2, 0, 2, 3] +6 0 3 1 +After: [2, 0, 2, 3] + +Before: [3, 2, 2, 2] +11 1 3 1 +After: [3, 1, 2, 2] + +Before: [2, 2, 0, 2] +13 1 2 1 +After: [2, 4, 0, 2] + +Before: [2, 2, 2, 0] +8 3 1 3 +After: [2, 2, 2, 2] + +Before: [2, 3, 1, 3] +6 0 3 2 +After: [2, 3, 0, 3] + +Before: [3, 3, 1, 1] +14 1 3 1 +After: [3, 9, 1, 1] + +Before: [2, 2, 1, 3] +6 0 3 2 +After: [2, 2, 0, 3] + +Before: [2, 3, 2, 3] +15 3 3 0 +After: [9, 3, 2, 3] + +Before: [1, 0, 0, 3] +10 1 0 1 +After: [1, 1, 0, 3] + +Before: [1, 3, 1, 3] +15 1 3 3 +After: [1, 3, 1, 9] + +Before: [1, 1, 2, 3] +15 1 2 3 +After: [1, 1, 2, 2] + +Before: [1, 1, 3, 0] +0 1 0 0 +After: [1, 1, 3, 0] + +Before: [1, 2, 3, 2] +13 3 2 2 +After: [1, 2, 4, 2] + +Before: [0, 1, 1, 2] +9 0 0 0 +After: [0, 1, 1, 2] + +Before: [2, 2, 0, 0] +12 1 1 3 +After: [2, 2, 0, 1] + +Before: [1, 0, 2, 3] +6 0 3 2 +After: [1, 0, 0, 3] + +Before: [1, 1, 0, 3] +6 0 3 3 +After: [1, 1, 0, 0] + +Before: [0, 2, 0, 0] +9 0 0 2 +After: [0, 2, 0, 0] + +Before: [0, 2, 2, 3] +5 0 3 0 +After: [3, 2, 2, 3] + +Before: [1, 0, 2, 1] +5 1 2 3 +After: [1, 0, 2, 2] + +Before: [1, 1, 3, 3] +0 1 0 2 +After: [1, 1, 1, 3] + +Before: [2, 0, 3, 1] +12 2 3 0 +After: [0, 0, 3, 1] + +Before: [0, 3, 2, 0] +5 0 2 0 +After: [2, 3, 2, 0] + +Before: [2, 1, 2, 2] +1 2 2 0 +After: [4, 1, 2, 2] + +Before: [1, 2, 1, 3] +6 0 3 2 +After: [1, 2, 0, 3] + +Before: [0, 2, 3, 1] +14 1 3 2 +After: [0, 2, 6, 1] + +Before: [1, 3, 3, 3] +5 0 3 2 +After: [1, 3, 3, 3] + +Before: [3, 1, 0, 3] +14 3 2 3 +After: [3, 1, 0, 6] + +Before: [2, 0, 3, 3] +12 3 2 0 +After: [1, 0, 3, 3] + +Before: [1, 2, 1, 2] +11 1 3 3 +After: [1, 2, 1, 1] + +Before: [2, 1, 2, 1] +1 0 2 1 +After: [2, 4, 2, 1] + +Before: [0, 1, 1, 0] +3 1 0 1 +After: [0, 1, 1, 0] + +Before: [0, 2, 3, 0] +9 0 0 2 +After: [0, 2, 0, 0] + +Before: [3, 1, 2, 3] +15 2 3 3 +After: [3, 1, 2, 6] + +Before: [0, 1, 0, 0] +3 1 0 0 +After: [1, 1, 0, 0] + +Before: [0, 0, 1, 2] +5 2 3 2 +After: [0, 0, 3, 2] + +Before: [0, 2, 2, 2] +8 0 3 1 +After: [0, 2, 2, 2] + +Before: [1, 2, 0, 3] +15 0 1 0 +After: [2, 2, 0, 3] + +Before: [2, 1, 0, 3] +6 0 3 2 +After: [2, 1, 0, 3] + +Before: [0, 2, 3, 2] +11 1 3 1 +After: [0, 1, 3, 2] + +Before: [1, 1, 2, 1] +0 1 0 1 +After: [1, 1, 2, 1] + +Before: [2, 2, 2, 0] +12 1 1 1 +After: [2, 1, 2, 0] + +Before: [3, 1, 2, 2] +1 2 2 2 +After: [3, 1, 4, 2] + +Before: [0, 1, 3, 0] +3 1 0 3 +After: [0, 1, 3, 1] + +Before: [3, 0, 2, 0] +1 2 2 2 +After: [3, 0, 4, 0] + +Before: [2, 3, 3, 2] +15 1 3 2 +After: [2, 3, 6, 2] + +Before: [3, 0, 2, 0] +1 2 2 0 +After: [4, 0, 2, 0] + +Before: [3, 2, 3, 2] +12 1 1 0 +After: [1, 2, 3, 2] + +Before: [2, 3, 3, 2] +13 0 2 0 +After: [4, 3, 3, 2] + +Before: [1, 0, 2, 2] +10 1 0 0 +After: [1, 0, 2, 2] + +Before: [2, 0, 0, 0] +8 1 0 1 +After: [2, 2, 0, 0] + +Before: [0, 2, 2, 1] +12 2 1 0 +After: [1, 2, 2, 1] + +Before: [0, 3, 2, 1] +9 0 0 3 +After: [0, 3, 2, 0] + +Before: [2, 2, 2, 1] +1 0 2 1 +After: [2, 4, 2, 1] + +Before: [0, 1, 2, 3] +3 1 0 2 +After: [0, 1, 1, 3] + +Before: [1, 1, 0, 2] +0 1 0 0 +After: [1, 1, 0, 2] + +Before: [3, 2, 1, 2] +11 1 3 0 +After: [1, 2, 1, 2] + +Before: [3, 1, 3, 3] +8 1 0 0 +After: [3, 1, 3, 3] + +Before: [3, 1, 2, 3] +15 0 2 2 +After: [3, 1, 6, 3] + +Before: [0, 2, 2, 1] +2 1 2 3 +After: [0, 2, 2, 1] + +Before: [1, 1, 0, 2] +0 1 0 3 +After: [1, 1, 0, 1] + +Before: [2, 2, 3, 2] +11 1 3 0 +After: [1, 2, 3, 2] + +Before: [1, 1, 3, 1] +0 1 0 2 +After: [1, 1, 1, 1] + +Before: [1, 2, 3, 0] +8 3 1 0 +After: [2, 2, 3, 0] + +Before: [1, 0, 2, 3] +10 1 0 0 +After: [1, 0, 2, 3] + +Before: [1, 3, 3, 1] +12 1 2 1 +After: [1, 1, 3, 1] + +Before: [0, 1, 2, 2] +3 1 0 0 +After: [1, 1, 2, 2] + +Before: [2, 2, 2, 3] +6 0 3 2 +After: [2, 2, 0, 3] + +Before: [3, 2, 3, 0] +13 1 2 0 +After: [4, 2, 3, 0] + +Before: [0, 1, 0, 1] +9 0 0 2 +After: [0, 1, 0, 1] + +Before: [2, 3, 3, 2] +13 3 2 1 +After: [2, 4, 3, 2] + +Before: [2, 2, 1, 3] +4 1 2 2 +After: [2, 2, 1, 3] + +Before: [1, 3, 0, 1] +8 0 1 2 +After: [1, 3, 3, 1] + +Before: [0, 1, 2, 0] +3 1 0 1 +After: [0, 1, 2, 0] + +Before: [0, 2, 0, 2] +11 1 3 1 +After: [0, 1, 0, 2] + +Before: [3, 2, 3, 1] +14 2 3 3 +After: [3, 2, 3, 9] + +Before: [0, 1, 1, 3] +3 1 0 0 +After: [1, 1, 1, 3] + +Before: [2, 2, 2, 1] +2 1 2 0 +After: [1, 2, 2, 1] + +Before: [0, 2, 1, 2] +4 3 3 3 +After: [0, 2, 1, 0] + +Before: [0, 1, 1, 2] +7 3 1 3 +After: [0, 1, 1, 3] + +Before: [1, 0, 1, 0] +10 1 0 0 +After: [1, 0, 1, 0] + +Before: [3, 2, 2, 1] +12 1 1 3 +After: [3, 2, 2, 1] + +Before: [0, 1, 0, 0] +9 0 0 2 +After: [0, 1, 0, 0] + +Before: [2, 2, 2, 1] +2 1 2 1 +After: [2, 1, 2, 1] + +Before: [1, 3, 0, 3] +2 1 3 0 +After: [1, 3, 0, 3] + +Before: [1, 1, 2, 2] +0 1 0 2 +After: [1, 1, 1, 2] + +Before: [0, 2, 0, 2] +11 1 3 3 +After: [0, 2, 0, 1] + +Before: [0, 2, 3, 2] +11 1 3 0 +After: [1, 2, 3, 2] + +Before: [2, 3, 2, 1] +7 3 2 0 +After: [3, 3, 2, 1] + +Before: [2, 1, 1, 3] +14 3 2 0 +After: [6, 1, 1, 3] + +Before: [1, 1, 3, 2] +0 1 0 0 +After: [1, 1, 3, 2] + +Before: [2, 2, 2, 3] +1 0 2 2 +After: [2, 2, 4, 3] + +Before: [1, 1, 0, 3] +0 1 0 3 +After: [1, 1, 0, 1] + +Before: [1, 0, 3, 0] +10 1 0 2 +After: [1, 0, 1, 0] + +Before: [0, 2, 0, 2] +11 1 3 2 +After: [0, 2, 1, 2] + +Before: [1, 3, 2, 1] +7 3 2 0 +After: [3, 3, 2, 1] + +Before: [2, 2, 1, 0] +14 0 3 2 +After: [2, 2, 6, 0] + +Before: [0, 1, 0, 0] +5 0 1 3 +After: [0, 1, 0, 1] + +Before: [0, 2, 2, 3] +15 2 3 0 +After: [6, 2, 2, 3] + +Before: [3, 3, 0, 3] +15 0 3 0 +After: [9, 3, 0, 3] + +Before: [0, 3, 3, 0] +14 2 3 0 +After: [9, 3, 3, 0] + +Before: [0, 1, 1, 2] +7 3 1 2 +After: [0, 1, 3, 2] + +Before: [1, 3, 1, 3] +2 1 3 0 +After: [1, 3, 1, 3] + +Before: [1, 0, 3, 3] +10 1 0 2 +After: [1, 0, 1, 3] + +Before: [0, 1, 3, 2] +3 1 0 3 +After: [0, 1, 3, 1] + +Before: [0, 1, 3, 1] +3 1 0 2 +After: [0, 1, 1, 1] + +Before: [1, 1, 2, 0] +0 1 0 1 +After: [1, 1, 2, 0] + +Before: [0, 3, 0, 2] +15 1 3 3 +After: [0, 3, 0, 6] + +Before: [0, 2, 1, 1] +4 1 2 2 +After: [0, 2, 1, 1] + +Before: [0, 2, 2, 1] +4 3 3 0 +After: [0, 2, 2, 1] + +Before: [1, 2, 1, 2] +8 1 0 1 +After: [1, 3, 1, 2] + +Before: [1, 2, 2, 0] +15 0 2 1 +After: [1, 2, 2, 0] + +Before: [2, 2, 3, 1] +4 3 3 1 +After: [2, 0, 3, 1] + +Before: [1, 2, 1, 0] +8 3 1 3 +After: [1, 2, 1, 2] + +Before: [3, 0, 2, 2] +8 1 0 2 +After: [3, 0, 3, 2] + +Before: [0, 0, 2, 0] +9 0 0 2 +After: [0, 0, 0, 0] + +Before: [1, 2, 2, 3] +4 1 0 2 +After: [1, 2, 1, 3] + +Before: [2, 1, 2, 2] +1 3 2 1 +After: [2, 4, 2, 2] + +Before: [2, 3, 0, 3] +2 1 3 1 +After: [2, 1, 0, 3] + +Before: [1, 2, 0, 2] +11 1 3 1 +After: [1, 1, 0, 2] + +Before: [3, 1, 0, 2] +7 3 1 1 +After: [3, 3, 0, 2] + +Before: [0, 2, 2, 3] +1 1 2 3 +After: [0, 2, 2, 4] + +Before: [1, 2, 3, 3] +6 0 3 0 +After: [0, 2, 3, 3] + +Before: [2, 0, 2, 1] +7 3 2 0 +After: [3, 0, 2, 1] + +Before: [0, 2, 2, 2] +8 0 3 2 +After: [0, 2, 2, 2] + +Before: [1, 0, 3, 1] +10 1 0 2 +After: [1, 0, 1, 1] + +Before: [0, 1, 2, 1] +4 3 3 2 +After: [0, 1, 0, 1] + +Before: [0, 2, 2, 0] +2 1 2 3 +After: [0, 2, 2, 1] + +Before: [0, 0, 2, 2] +5 1 2 0 +After: [2, 0, 2, 2] + +Before: [1, 0, 0, 3] +10 1 0 3 +After: [1, 0, 0, 1] + +Before: [1, 0, 3, 1] +10 1 0 3 +After: [1, 0, 3, 1] + +Before: [0, 0, 3, 2] +9 0 0 3 +After: [0, 0, 3, 0] + +Before: [1, 0, 1, 3] +10 1 0 2 +After: [1, 0, 1, 3] + +Before: [3, 2, 3, 2] +4 3 3 2 +After: [3, 2, 0, 2] + +Before: [0, 1, 1, 3] +3 1 0 2 +After: [0, 1, 1, 3] + +Before: [1, 2, 3, 3] +4 1 0 1 +After: [1, 1, 3, 3] + +Before: [0, 0, 0, 2] +9 0 0 1 +After: [0, 0, 0, 2] + +Before: [1, 0, 2, 1] +10 1 0 1 +After: [1, 1, 2, 1] + +Before: [1, 2, 3, 2] +5 0 3 2 +After: [1, 2, 3, 2] + +Before: [2, 2, 3, 2] +12 1 1 0 +After: [1, 2, 3, 2] + +Before: [2, 2, 2, 2] +12 2 1 2 +After: [2, 2, 1, 2] + +Before: [2, 2, 2, 3] +1 2 2 1 +After: [2, 4, 2, 3] + +Before: [3, 1, 3, 2] +7 3 1 2 +After: [3, 1, 3, 2] + +Before: [2, 2, 0, 0] +13 0 2 1 +After: [2, 4, 0, 0] + +Before: [0, 2, 1, 3] +15 1 3 1 +After: [0, 6, 1, 3] + +Before: [0, 1, 1, 2] +3 1 0 0 +After: [1, 1, 1, 2] + +Before: [2, 1, 0, 0] +8 3 0 1 +After: [2, 2, 0, 0] + +Before: [0, 1, 3, 3] +15 2 3 0 +After: [9, 1, 3, 3] + +Before: [0, 1, 1, 2] +3 1 0 1 +After: [0, 1, 1, 2] + +Before: [0, 1, 1, 1] +8 0 2 0 +After: [1, 1, 1, 1] + +Before: [1, 2, 2, 3] +12 1 1 3 +After: [1, 2, 2, 1] + +Before: [3, 3, 1, 2] +12 1 0 1 +After: [3, 1, 1, 2] + +Before: [3, 0, 0, 3] +14 3 2 2 +After: [3, 0, 6, 3] + +Before: [3, 3, 3, 1] +12 2 3 3 +After: [3, 3, 3, 0] + +Before: [2, 3, 2, 0] +14 2 3 1 +After: [2, 6, 2, 0] + +Before: [2, 3, 0, 2] +15 1 3 2 +After: [2, 3, 6, 2] + +Before: [3, 2, 3, 2] +11 1 3 1 +After: [3, 1, 3, 2] + +Before: [1, 2, 2, 1] +15 3 2 1 +After: [1, 2, 2, 1] + +Before: [1, 2, 2, 1] +5 0 2 1 +After: [1, 3, 2, 1] + +Before: [1, 2, 3, 3] +6 0 3 2 +After: [1, 2, 0, 3] + +Before: [1, 2, 2, 0] +5 0 2 2 +After: [1, 2, 3, 0] + +Before: [3, 0, 0, 2] +4 3 3 1 +After: [3, 0, 0, 2] + +Before: [1, 2, 1, 3] +8 1 0 2 +After: [1, 2, 3, 3] + +Before: [2, 0, 2, 1] +1 2 2 1 +After: [2, 4, 2, 1] + +Before: [2, 1, 2, 3] +1 2 2 3 +After: [2, 1, 2, 4] + +Before: [1, 1, 0, 1] +14 3 2 1 +After: [1, 2, 0, 1] + +Before: [1, 0, 2, 1] +1 2 2 1 +After: [1, 4, 2, 1] + +Before: [2, 2, 0, 3] +15 0 3 3 +After: [2, 2, 0, 6] + +Before: [3, 0, 2, 2] +1 3 2 0 +After: [4, 0, 2, 2] + +Before: [2, 2, 3, 2] +13 3 2 1 +After: [2, 4, 3, 2] + +Before: [1, 1, 2, 1] +0 1 0 2 +After: [1, 1, 1, 1] + +Before: [0, 2, 3, 2] +11 1 3 2 +After: [0, 2, 1, 2] + +Before: [2, 1, 1, 2] +7 3 1 0 +After: [3, 1, 1, 2] + +Before: [3, 0, 2, 0] +14 2 3 3 +After: [3, 0, 2, 6] + +Before: [2, 2, 0, 2] +14 0 3 3 +After: [2, 2, 0, 6] + +Before: [0, 0, 3, 2] +9 0 0 0 +After: [0, 0, 3, 2] + +Before: [1, 1, 3, 1] +0 1 0 1 +After: [1, 1, 3, 1] + +Before: [1, 1, 1, 1] +0 1 0 1 +After: [1, 1, 1, 1] + +Before: [1, 0, 2, 0] +10 1 0 1 +After: [1, 1, 2, 0] + +Before: [1, 1, 0, 3] +0 1 0 0 +After: [1, 1, 0, 3] + +Before: [0, 1, 0, 2] +13 3 2 1 +After: [0, 4, 0, 2] + +Before: [2, 1, 0, 0] +14 1 2 3 +After: [2, 1, 0, 2] + +Before: [3, 3, 2, 2] +4 3 3 1 +After: [3, 0, 2, 2] + +Before: [0, 2, 0, 0] +12 1 1 3 +After: [0, 2, 0, 1] + +Before: [1, 0, 2, 1] +1 2 2 2 +After: [1, 0, 4, 1] + +Before: [0, 1, 2, 1] +9 0 0 2 +After: [0, 1, 0, 1] + +Before: [1, 1, 3, 2] +0 1 0 2 +After: [1, 1, 1, 2] + +Before: [3, 0, 3, 2] +15 0 3 0 +After: [6, 0, 3, 2] + +Before: [2, 1, 2, 0] +5 3 2 0 +After: [2, 1, 2, 0] + +Before: [3, 2, 2, 2] +1 2 2 2 +After: [3, 2, 4, 2] + +Before: [1, 1, 0, 0] +0 1 0 3 +After: [1, 1, 0, 1] + +Before: [1, 2, 0, 3] +12 1 1 2 +After: [1, 2, 1, 3] + +Before: [2, 2, 2, 0] +1 0 2 1 +After: [2, 4, 2, 0] + +Before: [0, 2, 1, 3] +8 0 2 2 +After: [0, 2, 1, 3] + +Before: [3, 2, 0, 0] +14 1 3 1 +After: [3, 6, 0, 0] + +Before: [0, 2, 2, 3] +15 3 3 3 +After: [0, 2, 2, 9] + +Before: [1, 0, 3, 2] +10 1 0 0 +After: [1, 0, 3, 2] + +Before: [1, 2, 2, 0] +2 1 2 2 +After: [1, 2, 1, 0] + +Before: [0, 0, 3, 3] +9 0 0 1 +After: [0, 0, 3, 3] + +Before: [0, 1, 2, 3] +3 1 0 1 +After: [0, 1, 2, 3] + +Before: [1, 0, 1, 1] +10 1 0 3 +After: [1, 0, 1, 1] + +Before: [2, 0, 2, 3] +6 0 3 0 +After: [0, 0, 2, 3] + +Before: [0, 2, 3, 0] +13 1 2 1 +After: [0, 4, 3, 0] + +Before: [0, 1, 3, 2] +3 1 0 1 +After: [0, 1, 3, 2] + +Before: [1, 1, 0, 3] +6 0 3 0 +After: [0, 1, 0, 3] + +Before: [3, 2, 0, 1] +13 1 2 0 +After: [4, 2, 0, 1] + +Before: [2, 1, 3, 1] +5 0 1 2 +After: [2, 1, 3, 1] + +Before: [1, 1, 3, 2] +0 1 0 1 +After: [1, 1, 3, 2] + +Before: [2, 0, 0, 3] +6 0 3 0 +After: [0, 0, 0, 3] + +Before: [1, 2, 1, 0] +13 1 2 1 +After: [1, 4, 1, 0] + +Before: [2, 2, 1, 2] +11 1 3 3 +After: [2, 2, 1, 1] + +Before: [0, 1, 2, 3] +5 1 3 3 +After: [0, 1, 2, 3] + +Before: [2, 0, 3, 3] +6 0 3 2 +After: [2, 0, 0, 3] + +Before: [2, 2, 1, 0] +12 1 0 0 +After: [1, 2, 1, 0] + +Before: [2, 2, 2, 2] +11 1 3 0 +After: [1, 2, 2, 2] + +Before: [1, 1, 0, 1] +0 1 0 0 +After: [1, 1, 0, 1] + +Before: [0, 2, 2, 2] +11 1 3 0 +After: [1, 2, 2, 2] + +Before: [2, 2, 0, 2] +11 1 3 3 +After: [2, 2, 0, 1] + +Before: [2, 2, 2, 0] +2 1 2 2 +After: [2, 2, 1, 0] + +Before: [3, 1, 1, 2] +7 3 1 3 +After: [3, 1, 1, 3] + +Before: [0, 2, 1, 3] +9 0 0 0 +After: [0, 2, 1, 3] + +Before: [0, 2, 2, 2] +11 1 3 3 +After: [0, 2, 2, 1] + +Before: [3, 3, 3, 1] +7 3 2 2 +After: [3, 3, 3, 1] + +Before: [2, 0, 3, 3] +6 0 3 1 +After: [2, 0, 3, 3] + +Before: [0, 0, 2, 3] +5 1 3 1 +After: [0, 3, 2, 3] + +Before: [3, 3, 2, 0] +5 3 2 2 +After: [3, 3, 2, 0] + +Before: [3, 1, 2, 0] +14 2 3 3 +After: [3, 1, 2, 6] + +Before: [1, 1, 2, 0] +1 2 2 2 +After: [1, 1, 4, 0] + +Before: [1, 3, 1, 1] +4 2 3 1 +After: [1, 0, 1, 1] + +Before: [1, 1, 2, 3] +0 1 0 1 +After: [1, 1, 2, 3] + +Before: [3, 3, 3, 2] +15 2 3 0 +After: [6, 3, 3, 2] + +Before: [1, 1, 0, 1] +0 1 0 3 +After: [1, 1, 0, 1] + +Before: [2, 1, 1, 1] +13 0 2 1 +After: [2, 4, 1, 1] + +Before: [3, 3, 2, 1] +1 2 2 1 +After: [3, 4, 2, 1] + +Before: [0, 2, 2, 3] +2 1 2 3 +After: [0, 2, 2, 1] + +Before: [2, 0, 1, 3] +6 0 3 2 +After: [2, 0, 0, 3] + +Before: [1, 3, 3, 3] +6 0 3 2 +After: [1, 3, 0, 3] + +Before: [0, 1, 0, 2] +7 3 1 3 +After: [0, 1, 0, 3] + +Before: [0, 2, 2, 1] +12 2 1 2 +After: [0, 2, 1, 1] + +Before: [1, 3, 2, 3] +6 0 3 1 +After: [1, 0, 2, 3] + +Before: [1, 3, 1, 3] +15 1 3 2 +After: [1, 3, 9, 3] + +Before: [0, 3, 2, 2] +1 2 2 1 +After: [0, 4, 2, 2] + +Before: [3, 3, 2, 3] +2 1 3 2 +After: [3, 3, 1, 3] + +Before: [0, 0, 2, 3] +5 0 2 0 +After: [2, 0, 2, 3] + +Before: [3, 0, 2, 3] +15 2 3 0 +After: [6, 0, 2, 3] + +Before: [2, 3, 0, 3] +14 3 2 1 +After: [2, 6, 0, 3] + +Before: [2, 0, 2, 1] +1 0 2 2 +After: [2, 0, 4, 1] + +Before: [0, 1, 3, 1] +9 0 0 2 +After: [0, 1, 0, 1] + +Before: [1, 2, 2, 2] +2 1 2 3 +After: [1, 2, 2, 1] + +Before: [0, 0, 3, 1] +9 0 0 0 +After: [0, 0, 3, 1] + +Before: [0, 1, 3, 3] +3 1 0 2 +After: [0, 1, 1, 3] + +Before: [2, 1, 2, 3] +12 2 0 0 +After: [1, 1, 2, 3] + +Before: [1, 2, 3, 2] +11 1 3 2 +After: [1, 2, 1, 2] + +Before: [3, 2, 0, 2] +11 1 3 3 +After: [3, 2, 0, 1] + +Before: [2, 1, 2, 2] +12 2 0 1 +After: [2, 1, 2, 2] + +Before: [0, 1, 0, 2] +13 3 2 2 +After: [0, 1, 4, 2] + +Before: [0, 1, 1, 0] +9 0 0 3 +After: [0, 1, 1, 0] + +Before: [2, 1, 1, 3] +5 1 3 1 +After: [2, 3, 1, 3] + +Before: [0, 2, 2, 2] +1 2 2 1 +After: [0, 4, 2, 2] + +Before: [0, 1, 1, 2] +5 0 1 2 +After: [0, 1, 1, 2] + +Before: [1, 1, 1, 2] +0 1 0 1 +After: [1, 1, 1, 2] + +Before: [3, 3, 1, 2] +12 1 0 0 +After: [1, 3, 1, 2] + +Before: [3, 2, 1, 0] +14 0 3 0 +After: [9, 2, 1, 0] + +Before: [2, 2, 1, 1] +15 3 1 0 +After: [2, 2, 1, 1] + +Before: [1, 3, 2, 1] +7 3 2 2 +After: [1, 3, 3, 1] + +Before: [0, 2, 0, 0] +9 0 0 3 +After: [0, 2, 0, 0] + +Before: [1, 2, 1, 3] +4 1 0 1 +After: [1, 1, 1, 3] + +Before: [1, 1, 3, 2] +15 2 3 1 +After: [1, 6, 3, 2] + +Before: [2, 3, 3, 1] +7 3 2 0 +After: [3, 3, 3, 1] + +Before: [0, 1, 2, 2] +5 0 1 0 +After: [1, 1, 2, 2] + +Before: [3, 1, 0, 2] +7 3 1 0 +After: [3, 1, 0, 2] + +Before: [1, 3, 3, 3] +15 2 3 3 +After: [1, 3, 3, 9] + +Before: [3, 2, 2, 3] +15 3 3 1 +After: [3, 9, 2, 3] + +Before: [0, 0, 0, 2] +9 0 0 2 +After: [0, 0, 0, 2] + +Before: [2, 1, 3, 0] +5 1 2 3 +After: [2, 1, 3, 3] + +Before: [3, 0, 2, 1] +1 2 2 0 +After: [4, 0, 2, 1] + +Before: [1, 0, 2, 3] +10 1 0 3 +After: [1, 0, 2, 1] + +Before: [0, 3, 1, 2] +14 3 3 2 +After: [0, 3, 6, 2] + +Before: [0, 3, 3, 3] +2 1 3 2 +After: [0, 3, 1, 3] + +Before: [0, 2, 2, 0] +5 3 2 3 +After: [0, 2, 2, 2] + +Before: [1, 1, 2, 1] +5 2 1 0 +After: [3, 1, 2, 1] + +Before: [1, 2, 0, 2] +11 1 3 3 +After: [1, 2, 0, 1] + +Before: [3, 0, 2, 1] +7 3 2 3 +After: [3, 0, 2, 3] + +Before: [0, 2, 1, 3] +9 0 0 2 +After: [0, 2, 0, 3] + +Before: [2, 2, 2, 2] +11 1 3 3 +After: [2, 2, 2, 1] + +Before: [1, 3, 2, 3] +1 2 2 0 +After: [4, 3, 2, 3] + +Before: [1, 3, 1, 3] +2 1 3 2 +After: [1, 3, 1, 3] + +Before: [0, 1, 2, 3] +5 0 3 1 +After: [0, 3, 2, 3] + +Before: [2, 2, 1, 2] +11 1 3 1 +After: [2, 1, 1, 2] + +Before: [1, 0, 3, 1] +7 3 2 0 +After: [3, 0, 3, 1] + +Before: [1, 2, 1, 3] +6 0 3 0 +After: [0, 2, 1, 3] + +Before: [3, 2, 2, 2] +2 1 2 0 +After: [1, 2, 2, 2] + +Before: [3, 0, 0, 3] +5 1 3 0 +After: [3, 0, 0, 3] + +Before: [2, 3, 3, 3] +6 0 3 2 +After: [2, 3, 0, 3] + +Before: [1, 2, 3, 2] +11 1 3 0 +After: [1, 2, 3, 2] + +Before: [2, 3, 3, 3] +6 0 3 1 +After: [2, 0, 3, 3] + +Before: [2, 1, 0, 3] +6 0 3 0 +After: [0, 1, 0, 3] + +Before: [3, 2, 3, 1] +4 3 3 1 +After: [3, 0, 3, 1] + +Before: [1, 2, 2, 3] +1 2 2 1 +After: [1, 4, 2, 3] + +Before: [0, 2, 0, 2] +12 1 1 2 +After: [0, 2, 1, 2] + +Before: [3, 3, 1, 3] +2 1 3 3 +After: [3, 3, 1, 1] + +Before: [1, 1, 2, 2] +5 1 2 2 +After: [1, 1, 3, 2] + +Before: [0, 0, 2, 2] +5 0 2 3 +After: [0, 0, 2, 2] + +Before: [0, 1, 3, 1] +9 0 0 0 +After: [0, 1, 3, 1] + +Before: [0, 1, 0, 0] +3 1 0 1 +After: [0, 1, 0, 0] + +Before: [1, 0, 0, 1] +10 1 0 1 +After: [1, 1, 0, 1] + +Before: [1, 1, 1, 3] +0 1 0 0 +After: [1, 1, 1, 3] + +Before: [0, 2, 2, 2] +4 3 3 1 +After: [0, 0, 2, 2] + +Before: [1, 2, 1, 0] +8 2 1 0 +After: [3, 2, 1, 0] + +Before: [0, 1, 2, 1] +3 1 0 3 +After: [0, 1, 2, 1] + +Before: [1, 0, 2, 1] +10 1 0 3 +After: [1, 0, 2, 1] + +Before: [1, 1, 3, 1] +5 0 2 1 +After: [1, 3, 3, 1] + +Before: [2, 3, 2, 1] +4 3 3 2 +After: [2, 3, 0, 1] + +Before: [3, 3, 0, 3] +12 1 0 1 +After: [3, 1, 0, 3] + +Before: [3, 3, 1, 3] +8 2 0 3 +After: [3, 3, 1, 3] + +Before: [1, 3, 3, 1] +7 3 2 2 +After: [1, 3, 3, 1] + +Before: [3, 0, 3, 1] +4 3 3 0 +After: [0, 0, 3, 1] + +Before: [1, 3, 2, 3] +15 3 2 3 +After: [1, 3, 2, 6] + +Before: [3, 2, 2, 0] +2 1 2 2 +After: [3, 2, 1, 0] + +Before: [3, 1, 2, 1] +4 3 3 1 +After: [3, 0, 2, 1] + +Before: [2, 3, 1, 3] +2 1 3 3 +After: [2, 3, 1, 1] + +Before: [2, 2, 0, 3] +6 0 3 1 +After: [2, 0, 0, 3] + +Before: [2, 3, 2, 2] +1 0 2 0 +After: [4, 3, 2, 2] + +Before: [0, 1, 3, 3] +5 0 3 3 +After: [0, 1, 3, 3] + +Before: [2, 0, 3, 3] +12 3 2 2 +After: [2, 0, 1, 3] + +Before: [1, 1, 3, 2] +13 3 2 2 +After: [1, 1, 4, 2] + +Before: [1, 3, 3, 3] +2 1 3 2 +After: [1, 3, 1, 3] + +Before: [3, 2, 2, 2] +14 0 3 1 +After: [3, 9, 2, 2] + +Before: [1, 0, 3, 2] +8 1 3 2 +After: [1, 0, 2, 2] + +Before: [0, 3, 3, 3] +9 0 0 2 +After: [0, 3, 0, 3] + +Before: [3, 2, 0, 1] +4 3 3 0 +After: [0, 2, 0, 1] + +Before: [3, 0, 3, 2] +4 3 3 0 +After: [0, 0, 3, 2] + +Before: [3, 0, 3, 2] +8 1 2 1 +After: [3, 3, 3, 2] + +Before: [0, 2, 1, 1] +8 0 3 0 +After: [1, 2, 1, 1] + +Before: [2, 2, 2, 0] +1 1 2 1 +After: [2, 4, 2, 0] + +Before: [2, 2, 1, 3] +13 0 2 1 +After: [2, 4, 1, 3] + +Before: [0, 1, 3, 1] +3 1 0 0 +After: [1, 1, 3, 1] + +Before: [0, 1, 2, 2] +3 1 0 3 +After: [0, 1, 2, 1] + +Before: [1, 2, 2, 3] +6 0 3 1 +After: [1, 0, 2, 3] + +Before: [3, 2, 0, 3] +12 1 1 2 +After: [3, 2, 1, 3] + +Before: [2, 3, 1, 1] +13 0 2 0 +After: [4, 3, 1, 1] + +Before: [2, 1, 1, 0] +5 0 1 1 +After: [2, 3, 1, 0] + +Before: [3, 3, 2, 3] +15 3 2 3 +After: [3, 3, 2, 6] + +Before: [0, 1, 0, 3] +3 1 0 3 +After: [0, 1, 0, 1] + +Before: [1, 0, 3, 2] +14 2 3 1 +After: [1, 9, 3, 2] + +Before: [0, 2, 3, 1] +7 3 2 0 +After: [3, 2, 3, 1] + +Before: [2, 3, 0, 2] +14 1 2 2 +After: [2, 3, 6, 2] + +Before: [2, 2, 3, 1] +7 3 2 0 +After: [3, 2, 3, 1] + +Before: [0, 3, 3, 3] +12 3 2 2 +After: [0, 3, 1, 3] + +Before: [0, 2, 2, 2] +9 0 0 2 +After: [0, 2, 0, 2] + +Before: [0, 3, 1, 0] +8 0 1 2 +After: [0, 3, 3, 0] + +Before: [0, 3, 3, 0] +9 0 0 0 +After: [0, 3, 3, 0] + +Before: [0, 3, 0, 3] +15 3 3 1 +After: [0, 9, 0, 3] + +Before: [2, 1, 1, 3] +6 0 3 2 +After: [2, 1, 0, 3] + +Before: [2, 0, 0, 3] +15 3 3 1 +After: [2, 9, 0, 3] + +Before: [0, 1, 0, 3] +5 0 3 2 +After: [0, 1, 3, 3] + +Before: [1, 2, 2, 1] +4 1 0 0 +After: [1, 2, 2, 1] + +Before: [0, 2, 3, 2] +15 2 3 0 +After: [6, 2, 3, 2] + +Before: [0, 2, 2, 3] +9 0 0 1 +After: [0, 0, 2, 3] + +Before: [3, 3, 3, 3] +2 1 3 1 +After: [3, 1, 3, 3] + +Before: [1, 0, 2, 3] +10 1 0 1 +After: [1, 1, 2, 3] + +Before: [2, 1, 1, 3] +6 0 3 1 +After: [2, 0, 1, 3] + +Before: [0, 2, 2, 3] +1 2 2 1 +After: [0, 4, 2, 3] + +Before: [1, 1, 1, 1] +0 1 0 2 +After: [1, 1, 1, 1] + +Before: [0, 0, 2, 0] +1 2 2 1 +After: [0, 4, 2, 0] + +Before: [1, 3, 0, 2] +13 3 2 3 +After: [1, 3, 0, 4] + +Before: [1, 1, 0, 0] +0 1 0 2 +After: [1, 1, 1, 0] + +Before: [1, 1, 1, 3] +0 1 0 2 +After: [1, 1, 1, 3] + +Before: [1, 0, 3, 1] +10 1 0 0 +After: [1, 0, 3, 1] + +Before: [2, 2, 1, 2] +11 1 3 0 +After: [1, 2, 1, 2] + +Before: [0, 1, 0, 1] +9 0 0 3 +After: [0, 1, 0, 0] + +Before: [0, 2, 1, 3] +5 2 3 2 +After: [0, 2, 3, 3] + +Before: [1, 2, 2, 0] +1 1 2 3 +After: [1, 2, 2, 4] + +Before: [1, 1, 0, 1] +0 1 0 2 +After: [1, 1, 1, 1] + +Before: [0, 1, 2, 3] +3 1 0 0 +After: [1, 1, 2, 3] + +Before: [0, 0, 2, 1] +14 2 3 1 +After: [0, 6, 2, 1] + +Before: [2, 1, 2, 2] +7 3 1 3 +After: [2, 1, 2, 3] + +Before: [1, 3, 3, 2] +12 1 2 0 +After: [1, 3, 3, 2] + +Before: [3, 2, 2, 3] +1 2 2 2 +After: [3, 2, 4, 3] + +Before: [0, 3, 2, 1] +8 0 3 2 +After: [0, 3, 1, 1] + +Before: [1, 1, 0, 3] +0 1 0 2 +After: [1, 1, 1, 3] + +Before: [3, 2, 1, 2] +11 1 3 2 +After: [3, 2, 1, 2] + +Before: [0, 2, 1, 2] +11 1 3 1 +After: [0, 1, 1, 2] + +Before: [1, 2, 1, 3] +6 0 3 1 +After: [1, 0, 1, 3] + +Before: [2, 2, 2, 3] +2 1 2 2 +After: [2, 2, 1, 3] + +Before: [3, 2, 2, 1] +1 1 2 1 +After: [3, 4, 2, 1] + +Before: [1, 0, 0, 1] +10 1 0 3 +After: [1, 0, 0, 1] + +Before: [0, 1, 0, 1] +3 1 0 3 +After: [0, 1, 0, 1] + +Before: [1, 1, 1, 0] +0 1 0 3 +After: [1, 1, 1, 1] + +Before: [1, 1, 1, 2] +7 3 1 3 +After: [1, 1, 1, 3] + +Before: [3, 3, 1, 3] +2 1 3 0 +After: [1, 3, 1, 3] + +Before: [1, 0, 0, 2] +10 1 0 0 +After: [1, 0, 0, 2] + +Before: [0, 2, 1, 3] +13 1 2 3 +After: [0, 2, 1, 4] + +Before: [1, 0, 2, 0] +10 1 0 3 +After: [1, 0, 2, 1] + +Before: [2, 3, 3, 0] +13 0 2 3 +After: [2, 3, 3, 4] + +Before: [3, 1, 2, 3] +5 1 3 3 +After: [3, 1, 2, 3] + +Before: [1, 1, 1, 3] +0 1 0 1 +After: [1, 1, 1, 3] + +Before: [2, 1, 2, 1] +7 3 2 3 +After: [2, 1, 2, 3] + +Before: [1, 0, 0, 0] +10 1 0 0 +After: [1, 0, 0, 0] + +Before: [1, 1, 0, 2] +0 1 0 1 +After: [1, 1, 0, 2] + +Before: [3, 1, 2, 2] +1 2 2 0 +After: [4, 1, 2, 2] + +Before: [1, 1, 1, 2] +0 1 0 3 +After: [1, 1, 1, 1] + +Before: [1, 2, 3, 2] +11 1 3 1 +After: [1, 1, 3, 2] + +Before: [3, 0, 2, 1] +1 2 2 3 +After: [3, 0, 2, 4] + +Before: [0, 1, 0, 2] +3 1 0 1 +After: [0, 1, 0, 2] + +Before: [1, 0, 3, 3] +10 1 0 3 +After: [1, 0, 3, 1] + +Before: [1, 3, 1, 2] +5 0 3 2 +After: [1, 3, 3, 2] + +Before: [1, 0, 0, 2] +10 1 0 2 +After: [1, 0, 1, 2] + +Before: [1, 1, 1, 3] +6 0 3 3 +After: [1, 1, 1, 0] + +Before: [1, 2, 0, 2] +11 1 3 0 +After: [1, 2, 0, 2] + +Before: [1, 2, 1, 2] +11 1 3 1 +After: [1, 1, 1, 2] + +Before: [0, 0, 2, 0] +9 0 0 3 +After: [0, 0, 2, 0] + +Before: [3, 2, 2, 2] +1 3 2 2 +After: [3, 2, 4, 2] + +Before: [0, 1, 3, 2] +3 1 0 2 +After: [0, 1, 1, 2] + +Before: [2, 2, 1, 2] +11 1 3 2 +After: [2, 2, 1, 2] + +Before: [1, 3, 0, 2] +13 3 2 0 +After: [4, 3, 0, 2] + +Before: [2, 1, 2, 3] +6 0 3 2 +After: [2, 1, 0, 3] + +Before: [0, 2, 1, 2] +11 1 3 2 +After: [0, 2, 1, 2] + +Before: [2, 2, 2, 2] +2 1 2 1 +After: [2, 1, 2, 2] + +Before: [3, 0, 2, 2] +1 2 2 3 +After: [3, 0, 2, 4] + +Before: [0, 0, 3, 2] +13 3 2 0 +After: [4, 0, 3, 2] + +Before: [1, 2, 1, 1] +4 1 0 1 +After: [1, 1, 1, 1] + +Before: [1, 0, 2, 1] +10 1 0 0 +After: [1, 0, 2, 1] + +Before: [2, 0, 2, 3] +6 0 3 3 +After: [2, 0, 2, 0] + +Before: [1, 2, 3, 1] +4 3 3 3 +After: [1, 2, 3, 0] + +Before: [1, 1, 1, 2] +5 2 3 2 +After: [1, 1, 3, 2] + +Before: [1, 2, 3, 0] +14 1 3 1 +After: [1, 6, 3, 0] + +Before: [0, 0, 1, 3] +5 2 3 0 +After: [3, 0, 1, 3] + +Before: [0, 0, 0, 1] +9 0 0 0 +After: [0, 0, 0, 1] + +Before: [2, 1, 3, 1] +5 0 1 3 +After: [2, 1, 3, 3] + +Before: [2, 1, 2, 3] +6 0 3 3 +After: [2, 1, 2, 0] + +Before: [2, 3, 1, 3] +2 1 3 1 +After: [2, 1, 1, 3] + +Before: [1, 2, 1, 2] +4 3 3 3 +After: [1, 2, 1, 0] + +Before: [2, 2, 3, 2] +11 1 3 1 +After: [2, 1, 3, 2] + +Before: [2, 3, 3, 3] +13 0 2 1 +After: [2, 4, 3, 3] + +Before: [1, 3, 2, 3] +6 0 3 2 +After: [1, 3, 0, 3] + +Before: [2, 2, 1, 1] +4 1 2 0 +After: [1, 2, 1, 1] + +Before: [1, 0, 3, 3] +5 1 3 2 +After: [1, 0, 3, 3] + +Before: [3, 3, 2, 1] +7 3 2 1 +After: [3, 3, 2, 1] + +Before: [1, 0, 2, 2] +10 1 0 1 +After: [1, 1, 2, 2] + +Before: [2, 1, 1, 3] +13 0 2 0 +After: [4, 1, 1, 3] + +Before: [1, 1, 0, 0] +0 1 0 0 +After: [1, 1, 0, 0] + +Before: [2, 2, 2, 0] +2 1 2 1 +After: [2, 1, 2, 0] + +Before: [0, 1, 1, 0] +3 1 0 2 +After: [0, 1, 1, 0] + +Before: [1, 1, 2, 2] +1 3 2 3 +After: [1, 1, 2, 4] + +Before: [2, 2, 1, 2] +13 3 2 0 +After: [4, 2, 1, 2] + +Before: [0, 1, 0, 0] +9 0 0 1 +After: [0, 0, 0, 0] + +Before: [1, 3, 1, 1] +14 1 2 2 +After: [1, 3, 6, 1] + +Before: [1, 3, 0, 3] +6 0 3 1 +After: [1, 0, 0, 3] + +Before: [1, 2, 2, 2] +11 1 3 1 +After: [1, 1, 2, 2] + +Before: [1, 2, 0, 1] +12 1 1 2 +After: [1, 2, 1, 1] + +Before: [3, 3, 2, 2] +4 3 3 0 +After: [0, 3, 2, 2] + +Before: [0, 0, 0, 2] +4 3 3 3 +After: [0, 0, 0, 0] + +Before: [1, 1, 2, 0] +0 1 0 2 +After: [1, 1, 1, 0] + +Before: [3, 0, 2, 1] +7 3 2 2 +After: [3, 0, 3, 1] + +Before: [3, 1, 2, 1] +7 3 2 1 +After: [3, 3, 2, 1] + +Before: [0, 0, 2, 2] +1 3 2 2 +After: [0, 0, 4, 2] + +Before: [0, 1, 3, 1] +3 1 0 3 +After: [0, 1, 3, 1] + +Before: [1, 3, 2, 2] +14 3 3 3 +After: [1, 3, 2, 6] + +Before: [1, 3, 3, 0] +8 0 1 0 +After: [3, 3, 3, 0] + +Before: [1, 3, 2, 3] +1 2 2 1 +After: [1, 4, 2, 3] + +Before: [0, 1, 3, 2] +7 3 1 3 +After: [0, 1, 3, 3] + +Before: [3, 3, 2, 2] +15 1 2 2 +After: [3, 3, 6, 2] + +Before: [0, 3, 3, 1] +7 3 2 3 +After: [0, 3, 3, 3] + +Before: [2, 3, 3, 3] +2 1 3 1 +After: [2, 1, 3, 3] + +Before: [1, 1, 3, 1] +14 0 2 2 +After: [1, 1, 2, 1] + +Before: [2, 1, 0, 3] +8 1 0 2 +After: [2, 1, 3, 3] + +Before: [1, 2, 2, 0] +2 1 2 0 +After: [1, 2, 2, 0] + +Before: [1, 0, 0, 0] +10 1 0 2 +After: [1, 0, 1, 0] + +Before: [1, 3, 3, 3] +2 1 3 3 +After: [1, 3, 3, 1] + +Before: [0, 2, 2, 1] +1 1 2 3 +After: [0, 2, 2, 4] + +Before: [1, 2, 2, 3] +6 0 3 3 +After: [1, 2, 2, 0] + +Before: [3, 2, 0, 2] +11 1 3 2 +After: [3, 2, 1, 2] + +Before: [2, 2, 2, 2] +1 2 2 0 +After: [4, 2, 2, 2] + +Before: [1, 0, 0, 1] +4 3 3 1 +After: [1, 0, 0, 1] + +Before: [3, 1, 1, 2] +4 3 3 1 +After: [3, 0, 1, 2] + +Before: [1, 1, 2, 3] +6 0 3 3 +After: [1, 1, 2, 0] + +Before: [0, 3, 1, 3] +9 0 0 2 +After: [0, 3, 0, 3] + +Before: [1, 3, 0, 0] +8 2 1 0 +After: [3, 3, 0, 0] + +Before: [3, 2, 0, 2] +13 1 2 3 +After: [3, 2, 0, 4] + +Before: [0, 0, 1, 2] +13 3 2 2 +After: [0, 0, 4, 2] + +Before: [0, 2, 0, 2] +11 1 3 0 +After: [1, 2, 0, 2] + +Before: [0, 3, 1, 3] +9 0 0 3 +After: [0, 3, 1, 0] + +Before: [2, 2, 0, 2] +11 1 3 0 +After: [1, 2, 0, 2] + +Before: [0, 3, 1, 2] +8 2 1 0 +After: [3, 3, 1, 2] + +Before: [0, 3, 2, 2] +9 0 0 2 +After: [0, 3, 0, 2] + +Before: [3, 2, 0, 2] +13 1 2 2 +After: [3, 2, 4, 2] + +Before: [0, 3, 1, 1] +14 1 3 2 +After: [0, 3, 9, 1] + +Before: [2, 0, 2, 0] +1 0 2 1 +After: [2, 4, 2, 0] + +Before: [3, 2, 3, 2] +11 1 3 0 +After: [1, 2, 3, 2] + +Before: [0, 0, 3, 1] +7 3 2 0 +After: [3, 0, 3, 1] + +Before: [2, 2, 0, 2] +12 1 1 2 +After: [2, 2, 1, 2] + +Before: [0, 3, 2, 1] +8 0 1 0 +After: [3, 3, 2, 1] + +Before: [2, 0, 3, 1] +7 3 2 0 +After: [3, 0, 3, 1] + +Before: [0, 0, 1, 2] +8 0 3 2 +After: [0, 0, 2, 2] + +Before: [1, 1, 3, 0] +0 1 0 3 +After: [1, 1, 3, 1] + +Before: [1, 2, 0, 3] +4 1 0 1 +After: [1, 1, 0, 3] + +Before: [1, 1, 2, 1] +0 1 0 0 +After: [1, 1, 2, 1] + +Before: [2, 3, 2, 3] +6 0 3 3 +After: [2, 3, 2, 0] + +Before: [2, 1, 3, 2] +7 3 1 3 +After: [2, 1, 3, 3] + +Before: [1, 0, 0, 2] +4 3 3 2 +After: [1, 0, 0, 2] + +Before: [0, 0, 1, 1] +4 2 3 2 +After: [0, 0, 0, 1] + +Before: [1, 1, 0, 2] +0 1 0 2 +After: [1, 1, 1, 2] + +Before: [0, 1, 0, 2] +3 1 0 2 +After: [0, 1, 1, 2] + +Before: [2, 2, 0, 1] +13 0 2 0 +After: [4, 2, 0, 1] + +Before: [2, 2, 0, 3] +6 0 3 3 +After: [2, 2, 0, 0] + +Before: [0, 2, 0, 2] +13 3 2 0 +After: [4, 2, 0, 2] + +Before: [2, 2, 2, 2] +1 0 2 3 +After: [2, 2, 2, 4] + +Before: [1, 2, 2, 3] +2 1 2 3 +After: [1, 2, 2, 1] + +Before: [1, 2, 0, 0] +15 0 1 3 +After: [1, 2, 0, 2] + +Before: [2, 2, 0, 2] +11 1 3 1 +After: [2, 1, 0, 2] + +Before: [1, 0, 2, 3] +5 0 2 0 +After: [3, 0, 2, 3] + +Before: [1, 0, 0, 1] +10 1 0 2 +After: [1, 0, 1, 1] + +Before: [3, 1, 1, 1] +14 0 3 2 +After: [3, 1, 9, 1] + +Before: [0, 1, 3, 3] +3 1 0 3 +After: [0, 1, 3, 1] + +Before: [2, 1, 2, 2] +1 0 2 2 +After: [2, 1, 4, 2] + +Before: [0, 2, 2, 1] +12 1 1 0 +After: [1, 2, 2, 1] + +Before: [1, 2, 1, 2] +11 1 3 2 +After: [1, 2, 1, 2] + +Before: [0, 1, 2, 2] +3 1 0 1 +After: [0, 1, 2, 2] + +Before: [2, 2, 3, 2] +11 1 3 3 +After: [2, 2, 3, 1] + +Before: [0, 2, 1, 2] +12 1 1 1 +After: [0, 1, 1, 2] + +Before: [2, 1, 1, 3] +6 0 3 0 +After: [0, 1, 1, 3] + +Before: [1, 2, 1, 3] +8 0 1 3 +After: [1, 2, 1, 3] + +Before: [0, 3, 0, 2] +9 0 0 3 +After: [0, 3, 0, 0] + +Before: [0, 2, 2, 2] +11 1 3 1 +After: [0, 1, 2, 2] + +Before: [0, 1, 0, 2] +3 1 0 0 +After: [1, 1, 0, 2] + +Before: [2, 0, 1, 2] +13 0 2 2 +After: [2, 0, 4, 2] + +Before: [1, 0, 0, 2] +10 1 0 3 +After: [1, 0, 0, 1] + +Before: [3, 1, 3, 2] +14 0 3 3 +After: [3, 1, 3, 9] + +Before: [2, 2, 2, 3] +15 2 3 0 +After: [6, 2, 2, 3] + +Before: [1, 0, 1, 0] +10 1 0 2 +After: [1, 0, 1, 0] + +Before: [0, 2, 1, 0] +9 0 0 3 +After: [0, 2, 1, 0] + +Before: [1, 2, 2, 2] +11 1 3 0 +After: [1, 2, 2, 2] + +Before: [1, 2, 3, 1] +15 3 1 0 +After: [2, 2, 3, 1] + +Before: [0, 0, 3, 1] +8 0 2 2 +After: [0, 0, 3, 1] + +Before: [2, 0, 2, 1] +14 0 3 1 +After: [2, 6, 2, 1] + +Before: [0, 0, 2, 3] +15 2 3 1 +After: [0, 6, 2, 3] + +Before: [1, 2, 2, 0] +12 1 1 2 +After: [1, 2, 1, 0] + +Before: [2, 2, 3, 0] +12 1 0 2 +After: [2, 2, 1, 0] + +Before: [3, 2, 0, 2] +11 1 3 1 +After: [3, 1, 0, 2] + +Before: [2, 2, 2, 3] +6 0 3 3 +After: [2, 2, 2, 0] + +Before: [0, 1, 0, 0] +3 1 0 2 +After: [0, 1, 1, 0] + +Before: [0, 1, 1, 3] +3 1 0 3 +After: [0, 1, 1, 1] + +Before: [2, 0, 0, 3] +6 0 3 1 +After: [2, 0, 0, 3] + +Before: [3, 1, 0, 0] +8 1 0 0 +After: [3, 1, 0, 0] + +Before: [0, 1, 2, 1] +3 1 0 1 +After: [0, 1, 2, 1] + +Before: [1, 0, 1, 0] +10 1 0 3 +After: [1, 0, 1, 1] + +Before: [0, 0, 3, 1] +12 2 3 3 +After: [0, 0, 3, 0] + +Before: [0, 1, 0, 1] +4 3 3 2 +After: [0, 1, 0, 1] + +Before: [1, 0, 2, 1] +7 3 2 2 +After: [1, 0, 3, 1] + +Before: [1, 1, 2, 2] +15 0 2 0 +After: [2, 1, 2, 2] + +Before: [3, 3, 0, 3] +2 1 3 2 +After: [3, 3, 1, 3] + +Before: [1, 0, 3, 3] +10 1 0 0 +After: [1, 0, 3, 3] + +Before: [1, 3, 2, 1] +14 2 3 2 +After: [1, 3, 6, 1] + +Before: [0, 1, 1, 1] +3 1 0 0 +After: [1, 1, 1, 1] + +Before: [3, 3, 0, 1] +4 3 3 3 +After: [3, 3, 0, 0] + +Before: [3, 3, 2, 1] +7 3 2 2 +After: [3, 3, 3, 1] + +Before: [3, 2, 2, 1] +2 1 2 3 +After: [3, 2, 2, 1] + +Before: [1, 1, 1, 3] +6 0 3 0 +After: [0, 1, 1, 3] + +Before: [3, 0, 2, 3] +5 1 3 3 +After: [3, 0, 2, 3] + +Before: [2, 2, 3, 3] +15 1 3 2 +After: [2, 2, 6, 3] + +Before: [1, 2, 1, 2] +8 2 1 3 +After: [1, 2, 1, 3] + +Before: [0, 2, 3, 1] +15 3 1 0 +After: [2, 2, 3, 1] + +Before: [3, 3, 0, 3] +12 3 0 2 +After: [3, 3, 1, 3] + +Before: [2, 2, 2, 2] +11 1 3 2 +After: [2, 2, 1, 2] + +Before: [3, 0, 3, 0] +8 1 2 1 +After: [3, 3, 3, 0] + +Before: [1, 1, 1, 2] +5 0 3 2 +After: [1, 1, 3, 2] + +Before: [0, 3, 3, 2] +9 0 0 2 +After: [0, 3, 0, 2] + +Before: [0, 3, 2, 1] +9 0 0 0 +After: [0, 3, 2, 1] + +Before: [1, 3, 1, 3] +5 2 3 3 +After: [1, 3, 1, 3] + +Before: [2, 1, 3, 3] +6 0 3 3 +After: [2, 1, 3, 0] + +Before: [0, 1, 1, 0] +9 0 0 0 +After: [0, 1, 1, 0] + +Before: [1, 0, 2, 3] +6 0 3 0 +After: [0, 0, 2, 3] + +Before: [3, 3, 3, 1] +7 3 2 0 +After: [3, 3, 3, 1] + +Before: [0, 1, 3, 0] +3 1 0 2 +After: [0, 1, 1, 0] + +Before: [1, 2, 2, 2] +4 3 3 1 +After: [1, 0, 2, 2] + +Before: [3, 2, 2, 2] +11 1 3 3 +After: [3, 2, 2, 1] + +Before: [0, 1, 0, 2] +9 0 0 0 +After: [0, 1, 0, 2] + +Before: [1, 0, 1, 3] +10 1 0 0 +After: [1, 0, 1, 3] + +Before: [3, 3, 2, 3] +2 1 3 1 +After: [3, 1, 2, 3] + +Before: [2, 3, 1, 0] +8 3 0 1 +After: [2, 2, 1, 0] + +Before: [1, 1, 2, 1] +0 1 0 3 +After: [1, 1, 2, 1] + +Before: [3, 3, 2, 3] +15 3 2 1 +After: [3, 6, 2, 3] + +Before: [0, 2, 1, 2] +4 1 2 3 +After: [0, 2, 1, 1] + +Before: [2, 2, 1, 0] +13 1 2 1 +After: [2, 4, 1, 0] + +Before: [1, 0, 3, 3] +10 1 0 1 +After: [1, 1, 3, 3] + +Before: [3, 3, 2, 0] +1 2 2 2 +After: [3, 3, 4, 0] + +Before: [1, 2, 1, 2] +11 1 3 0 +After: [1, 2, 1, 2] + +Before: [1, 3, 1, 3] +6 0 3 3 +After: [1, 3, 1, 0] + +Before: [3, 3, 1, 3] +8 2 1 1 +After: [3, 3, 1, 3] + +Before: [1, 0, 0, 1] +4 3 3 0 +After: [0, 0, 0, 1] + +Before: [1, 2, 2, 2] +11 1 3 3 +After: [1, 2, 2, 1] + +Before: [3, 1, 2, 1] +8 1 0 0 +After: [3, 1, 2, 1] + +Before: [3, 0, 1, 2] +8 1 3 3 +After: [3, 0, 1, 2] + +Before: [1, 1, 3, 3] +0 1 0 3 +After: [1, 1, 3, 1] + +Before: [0, 0, 1, 2] +13 3 2 1 +After: [0, 4, 1, 2] + +Before: [2, 3, 0, 1] +13 0 2 0 +After: [4, 3, 0, 1] + +Before: [1, 2, 2, 0] +2 1 2 1 +After: [1, 1, 2, 0] + +Before: [2, 3, 1, 0] +13 0 2 2 +After: [2, 3, 4, 0] + +Before: [0, 1, 2, 3] +3 1 0 3 +After: [0, 1, 2, 1] + +Before: [2, 3, 2, 2] +15 1 3 1 +After: [2, 6, 2, 2] + +Before: [0, 1, 2, 0] +3 1 0 3 +After: [0, 1, 2, 1] + +Before: [1, 2, 2, 2] +15 0 2 2 +After: [1, 2, 2, 2] + +Before: [1, 2, 2, 1] +12 1 1 2 +After: [1, 2, 1, 1] + +Before: [0, 1, 1, 0] +3 1 0 0 +After: [1, 1, 1, 0] + +Before: [3, 3, 0, 1] +14 0 3 1 +After: [3, 9, 0, 1] + +Before: [1, 0, 2, 1] +10 1 0 2 +After: [1, 0, 1, 1] + +Before: [0, 3, 2, 3] +9 0 0 2 +After: [0, 3, 0, 3] + +Before: [0, 2, 1, 2] +11 1 3 3 +After: [0, 2, 1, 1] + +Before: [2, 0, 1, 3] +6 0 3 1 +After: [2, 0, 1, 3] + +Before: [1, 1, 2, 3] +0 1 0 3 +After: [1, 1, 2, 1] + +Before: [3, 0, 2, 2] +1 2 2 1 +After: [3, 4, 2, 2] + +Before: [1, 3, 2, 0] +5 3 2 3 +After: [1, 3, 2, 2] + +Before: [3, 3, 0, 3] +8 2 0 1 +After: [3, 3, 0, 3] + +Before: [0, 0, 3, 3] +9 0 0 3 +After: [0, 0, 3, 0] + +Before: [0, 3, 1, 3] +8 2 1 3 +After: [0, 3, 1, 3] + +Before: [1, 1, 3, 2] +0 1 0 3 +After: [1, 1, 3, 1] + +Before: [1, 0, 0, 3] +10 1 0 2 +After: [1, 0, 1, 3] + +Before: [2, 0, 1, 2] +13 3 2 3 +After: [2, 0, 1, 4] + +Before: [3, 2, 3, 2] +13 1 2 0 +After: [4, 2, 3, 2] + +Before: [0, 1, 0, 2] +3 1 0 3 +After: [0, 1, 0, 1] + +Before: [1, 1, 3, 1] +0 1 0 0 +After: [1, 1, 3, 1] + +Before: [0, 1, 3, 0] +3 1 0 0 +After: [1, 1, 3, 0] + +Before: [0, 1, 0, 1] +3 1 0 1 +After: [0, 1, 0, 1] + +Before: [3, 2, 1, 2] +4 1 2 2 +After: [3, 2, 1, 2] + +Before: [1, 1, 2, 3] +0 1 0 0 +After: [1, 1, 2, 3] + +Before: [3, 2, 3, 2] +11 1 3 2 +After: [3, 2, 1, 2] + +Before: [0, 1, 3, 1] +3 1 0 1 +After: [0, 1, 3, 1] + +Before: [1, 1, 2, 0] +0 1 0 3 +After: [1, 1, 2, 1] + +Before: [0, 1, 3, 0] +9 0 0 3 +After: [0, 1, 3, 0] + +Before: [2, 2, 3, 1] +14 2 3 2 +After: [2, 2, 9, 1] + +Before: [0, 1, 0, 1] +3 1 0 2 +After: [0, 1, 1, 1] + +Before: [3, 3, 3, 3] +15 0 3 3 +After: [3, 3, 3, 9] + +Before: [2, 1, 2, 3] +6 0 3 0 +After: [0, 1, 2, 3] + +Before: [0, 2, 1, 2] +8 0 3 1 +After: [0, 2, 1, 2] + +Before: [0, 2, 2, 1] +2 1 2 1 +After: [0, 1, 2, 1] + +Before: [1, 0, 1, 2] +10 1 0 0 +After: [1, 0, 1, 2] + +Before: [1, 2, 3, 3] +15 1 3 3 +After: [1, 2, 3, 6] + +Before: [2, 1, 2, 3] +15 1 2 3 +After: [2, 1, 2, 2] + +Before: [1, 2, 2, 1] +14 1 3 3 +After: [1, 2, 2, 6] + +Before: [1, 1, 1, 0] +0 1 0 1 +After: [1, 1, 1, 0] + +Before: [3, 2, 3, 1] +4 3 3 0 +After: [0, 2, 3, 1] + +Before: [0, 2, 2, 2] +11 1 3 2 +After: [0, 2, 1, 2] + +Before: [2, 1, 3, 1] +14 3 2 3 +After: [2, 1, 3, 2] + +Before: [0, 2, 2, 3] +2 1 2 0 +After: [1, 2, 2, 3] + +Before: [0, 1, 3, 3] +5 0 3 2 +After: [0, 1, 3, 3] + +Before: [0, 3, 2, 2] +15 1 2 0 +After: [6, 3, 2, 2] + +Before: [2, 2, 1, 2] +14 3 3 1 +After: [2, 6, 1, 2] + +Before: [2, 2, 2, 2] +11 1 3 1 +After: [2, 1, 2, 2] + +Before: [3, 2, 2, 2] +11 1 3 0 +After: [1, 2, 2, 2] + +Before: [1, 3, 2, 1] +15 0 2 0 +After: [2, 3, 2, 1] + +Before: [1, 2, 0, 0] +15 0 1 2 +After: [1, 2, 2, 0] + +Before: [1, 2, 2, 3] +1 1 2 1 +After: [1, 4, 2, 3] + +Before: [3, 2, 2, 1] +7 3 2 0 +After: [3, 2, 2, 1] + +Before: [3, 2, 2, 0] +12 1 1 2 +After: [3, 2, 1, 0] + +Before: [1, 0, 3, 3] +6 0 3 1 +After: [1, 0, 3, 3] + +Before: [2, 0, 2, 1] +1 0 2 3 +After: [2, 0, 2, 4] + +Before: [2, 0, 1, 2] +13 0 2 0 +After: [4, 0, 1, 2] + +Before: [2, 2, 2, 2] +12 2 1 0 +After: [1, 2, 2, 2] + +Before: [2, 2, 0, 2] +13 3 2 1 +After: [2, 4, 0, 2] + +Before: [3, 3, 3, 0] +14 2 3 1 +After: [3, 9, 3, 0] + +Before: [3, 1, 0, 2] +4 3 3 3 +After: [3, 1, 0, 0] + +Before: [0, 2, 2, 3] +1 1 2 0 +After: [4, 2, 2, 3] + +Before: [0, 1, 1, 2] +9 0 0 1 +After: [0, 0, 1, 2] + +Before: [3, 3, 1, 0] +14 1 3 2 +After: [3, 3, 9, 0] + +Before: [2, 0, 2, 3] +5 1 2 2 +After: [2, 0, 2, 3] + +Before: [1, 1, 1, 2] +0 1 0 0 +After: [1, 1, 1, 2] + +Before: [3, 2, 3, 3] +15 1 3 0 +After: [6, 2, 3, 3] + +Before: [1, 3, 2, 1] +14 1 3 0 +After: [9, 3, 2, 1] + +Before: [2, 0, 2, 2] +1 2 2 0 +After: [4, 0, 2, 2] + +Before: [0, 2, 1, 2] +11 1 3 0 +After: [1, 2, 1, 2] + +Before: [0, 1, 1, 1] +3 1 0 3 +After: [0, 1, 1, 1] + +Before: [1, 0, 1, 0] +10 1 0 1 +After: [1, 1, 1, 0] + +Before: [1, 1, 1, 1] +4 3 3 3 +After: [1, 1, 1, 0] + +Before: [3, 2, 2, 2] +14 0 3 3 +After: [3, 2, 2, 9] + +Before: [0, 1, 2, 1] +9 0 0 0 +After: [0, 1, 2, 1] + +Before: [2, 0, 2, 3] +1 2 2 0 +After: [4, 0, 2, 3] + +Before: [1, 1, 1, 3] +0 1 0 3 +After: [1, 1, 1, 1] + +Before: [0, 1, 0, 3] +3 1 0 1 +After: [0, 1, 0, 3] + +Before: [2, 0, 2, 1] +5 1 2 0 +After: [2, 0, 2, 1] + +Before: [1, 3, 3, 1] +14 0 2 0 +After: [2, 3, 3, 1] + +Before: [1, 0, 0, 3] +6 0 3 1 +After: [1, 0, 0, 3] + +Before: [2, 3, 0, 3] +6 0 3 3 +After: [2, 3, 0, 0] + +Before: [0, 1, 2, 2] +1 3 2 3 +After: [0, 1, 2, 4] + +Before: [3, 1, 2, 3] +1 2 2 2 +After: [3, 1, 4, 3] + +Before: [3, 1, 0, 3] +8 2 0 3 +After: [3, 1, 0, 3] + +Before: [3, 3, 1, 2] +14 0 3 3 +After: [3, 3, 1, 9] + +Before: [3, 0, 3, 2] +4 3 3 3 +After: [3, 0, 3, 0] + +Before: [2, 3, 1, 0] +8 2 1 0 +After: [3, 3, 1, 0] + +Before: [0, 1, 2, 1] +3 1 0 2 +After: [0, 1, 1, 1] + +Before: [0, 1, 3, 2] +3 1 0 0 +After: [1, 1, 3, 2] + +Before: [1, 1, 2, 0] +15 0 2 1 +After: [1, 2, 2, 0] + +Before: [0, 3, 2, 2] +1 3 2 0 +After: [4, 3, 2, 2] + +Before: [1, 0, 1, 2] +10 1 0 3 +After: [1, 0, 1, 1] + +Before: [0, 2, 2, 0] +12 1 1 0 +After: [1, 2, 2, 0] + +Before: [1, 1, 3, 3] +0 1 0 1 +After: [1, 1, 3, 3] + +Before: [1, 0, 2, 0] +10 1 0 2 +After: [1, 0, 1, 0] + +Before: [2, 3, 2, 1] +15 1 2 1 +After: [2, 6, 2, 1] + +Before: [1, 2, 0, 0] +8 1 0 1 +After: [1, 3, 0, 0] + +Before: [3, 2, 1, 2] +11 1 3 3 +After: [3, 2, 1, 1] + +Before: [1, 1, 1, 1] +0 1 0 3 +After: [1, 1, 1, 1] + +Before: [2, 3, 1, 3] +6 0 3 3 +After: [2, 3, 1, 0] + +Before: [0, 2, 1, 3] +13 1 2 2 +After: [0, 2, 4, 3] + +Before: [1, 0, 3, 1] +7 3 2 3 +After: [1, 0, 3, 3] + +Before: [2, 1, 0, 0] +8 3 0 3 +After: [2, 1, 0, 2] + +Before: [1, 1, 1, 2] +0 1 0 2 +After: [1, 1, 1, 2] + +Before: [3, 2, 2, 2] +1 3 2 3 +After: [3, 2, 2, 4] + +Before: [3, 1, 1, 1] +14 0 3 3 +After: [3, 1, 1, 9] + +Before: [2, 2, 3, 3] +6 0 3 0 +After: [0, 2, 3, 3] + +Before: [0, 1, 1, 2] +3 1 0 2 +After: [0, 1, 1, 2] + +Before: [3, 2, 1, 2] +14 0 3 0 +After: [9, 2, 1, 2] + +Before: [2, 0, 3, 1] +7 3 2 3 +After: [2, 0, 3, 3] + +Before: [1, 2, 2, 1] +2 1 2 0 +After: [1, 2, 2, 1] + +Before: [0, 0, 2, 1] +4 3 3 3 +After: [0, 0, 2, 0] + +Before: [3, 2, 3, 3] +12 3 0 3 +After: [3, 2, 3, 1] + +Before: [1, 1, 2, 2] +0 1 0 3 +After: [1, 1, 2, 1] + +Before: [2, 3, 1, 1] +14 1 3 2 +After: [2, 3, 9, 1] + +Before: [1, 0, 2, 1] +15 0 2 1 +After: [1, 2, 2, 1] + +Before: [0, 1, 2, 3] +9 0 0 3 +After: [0, 1, 2, 0] + +Before: [3, 0, 0, 2] +4 3 3 0 +After: [0, 0, 0, 2] + +Before: [3, 0, 3, 1] +7 3 2 3 +After: [3, 0, 3, 3] + +Before: [3, 2, 2, 3] +12 2 1 1 +After: [3, 1, 2, 3] + +Before: [0, 3, 3, 3] +2 1 3 1 +After: [0, 1, 3, 3] + +Before: [1, 0, 0, 0] +10 1 0 1 +After: [1, 1, 0, 0] + +Before: [1, 3, 0, 3] +2 1 3 3 +After: [1, 3, 0, 1] + +Before: [3, 2, 2, 3] +12 3 0 2 +After: [3, 2, 1, 3] + +Before: [1, 1, 2, 0] +0 1 0 0 +After: [1, 1, 2, 0] + +Before: [0, 2, 2, 1] +2 1 2 2 +After: [0, 2, 1, 1] + +Before: [1, 0, 1, 2] +10 1 0 2 +After: [1, 0, 1, 2] + +Before: [1, 0, 3, 0] +14 0 2 2 +After: [1, 0, 2, 0] + +Before: [0, 2, 3, 2] +11 1 3 3 +After: [0, 2, 3, 1] + +Before: [0, 1, 0, 3] +3 1 0 2 +After: [0, 1, 1, 3] + +Before: [3, 3, 2, 1] +12 1 0 0 +After: [1, 3, 2, 1] + +Before: [0, 2, 3, 3] +13 1 2 0 +After: [4, 2, 3, 3] + +Before: [1, 1, 3, 0] +0 1 0 1 +After: [1, 1, 3, 0] + +Before: [1, 2, 2, 2] +2 1 2 2 +After: [1, 2, 1, 2] + +Before: [2, 1, 3, 3] +13 0 2 2 +After: [2, 1, 4, 3] + +Before: [1, 0, 1, 3] +10 1 0 3 +After: [1, 0, 1, 1] + +Before: [2, 1, 3, 2] +7 3 1 1 +After: [2, 3, 3, 2] + +Before: [1, 1, 1, 0] +0 1 0 0 +After: [1, 1, 1, 0] + +Before: [0, 2, 3, 2] +13 3 2 3 +After: [0, 2, 3, 4] + +Before: [3, 2, 2, 3] +12 3 0 3 +After: [3, 2, 2, 1] + +Before: [2, 3, 2, 3] +2 1 3 1 +After: [2, 1, 2, 3] + +Before: [2, 3, 0, 3] +6 0 3 1 +After: [2, 0, 0, 3] + +Before: [2, 2, 2, 3] +1 2 2 0 +After: [4, 2, 2, 3] + +Before: [3, 2, 3, 2] +4 3 3 1 +After: [3, 0, 3, 2] + +Before: [0, 2, 2, 0] +12 1 1 1 +After: [0, 1, 2, 0] + +Before: [2, 2, 3, 2] +11 1 3 2 +After: [2, 2, 1, 2] + +Before: [3, 0, 2, 3] +1 2 2 2 +After: [3, 0, 4, 3] + +Before: [0, 3, 2, 0] +9 0 0 0 +After: [0, 3, 2, 0] + +Before: [0, 2, 3, 1] +9 0 0 2 +After: [0, 2, 0, 1] + +Before: [0, 1, 1, 1] +3 1 0 2 +After: [0, 1, 1, 1] + +Before: [2, 2, 2, 3] +2 1 2 0 +After: [1, 2, 2, 3] + +Before: [0, 1, 2, 3] +15 3 2 0 +After: [6, 1, 2, 3] + +Before: [1, 1, 0, 2] +7 3 1 3 +After: [1, 1, 0, 3] + +Before: [1, 1, 1, 1] +0 1 0 0 +After: [1, 1, 1, 1] + +Before: [1, 2, 3, 3] +15 0 1 3 +After: [1, 2, 3, 2] + +Before: [0, 3, 2, 3] +2 1 3 1 +After: [0, 1, 2, 3] + +Before: [0, 3, 0, 0] +8 2 1 3 +After: [0, 3, 0, 3] + +Before: [2, 0, 2, 3] +1 0 2 0 +After: [4, 0, 2, 3] + +Before: [0, 3, 0, 3] +5 0 3 3 +After: [0, 3, 0, 3] + +Before: [0, 1, 2, 0] +3 1 0 0 +After: [1, 1, 2, 0] + + + +7 3 2 0 +7 2 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2 2 +7 0 1 3 +6 3 2 3 +14 3 1 3 +1 3 0 0 From 1aea4b9bcd6638468565da1afaec9bbc26835197 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 30 Dec 2024 17:23:48 -0500 Subject: [PATCH 10/48] 2018: d16: ex1: add solution --- 2018/d16/ex1/ex1.py | 110 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100755 2018/d16/ex1/ex1.py diff --git a/2018/d16/ex1/ex1.py b/2018/d16/ex1/ex1.py new file mode 100755 index 0000000..2bc4551 --- /dev/null +++ b/2018/d16/ex1/ex1.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python + +import copy +import enum +import sys +from typing import NamedTuple + + +class OpCode(enum.StrEnum): + ADDR = "addr" + ADDI = "addi" + MULR = "mulr" + MULI = "muli" + BANR = "banr" + BANI = "bani" + BORR = "borr" + BORI = "bori" + SETR = "setr" + SETI = "seti" + GTIR = "gtir" + GTRI = "gtri" + GTRR = "gtrr" + EQIR = "eqir" + EQRI = "eqri" + EQRR = "eqrr" + + def apply(self, registers: list[int], a: int, b: int, c: int) -> list[int]: + registers = copy.deepcopy(registers) + if self == OpCode.ADDR: + registers[c] = registers[a] + registers[b] + if self == OpCode.ADDI: + registers[c] = registers[a] + b + if self == OpCode.MULR: + registers[c] = registers[a] * registers[b] + if self == OpCode.MULI: + registers[c] = registers[a] * b + if self == OpCode.BANR: + registers[c] = registers[a] & registers[b] + if self == OpCode.BANI: + registers[c] = registers[a] & b + if self == OpCode.BORR: + registers[c] = registers[a] | registers[b] + if self == OpCode.BORI: + registers[c] = registers[a] | b + if self == OpCode.SETR: + registers[c] = registers[a] + if self == OpCode.SETI: + registers[c] = a + if self == OpCode.GTIR: + registers[c] = a > registers[b] + if self == OpCode.GTRI: + registers[c] = registers[a] > b + if self == OpCode.GTRR: + registers[c] = registers[a] > registers[b] + if self == OpCode.EQIR: + registers[c] = a == registers[b] + if self == OpCode.EQRI: + registers[c] = registers[a] == b + if self == OpCode.EQRR: + registers[c] = registers[a] == registers[b] + return registers + + +Instruction = list[int] + + +class Example(NamedTuple): + before: list[int] + data: Instruction + after: list[int] + + +def solve(input: str) -> int: + def parse_example(input: list[str]) -> Example: + before = input[0].removeprefix("Before: [").removesuffix("]") + data = input[1] + after = input[2].removeprefix("After: [").removesuffix("]") + return Example( + [int(n) for n in before.split(", ")], + [int(n) for n in data.split()], + [int(n) for n in after.split(", ")], + ) + + def parse_examples(input: str) -> list[Example]: + return [parse_example(example.splitlines()) for example in input.split("\n\n")] + + def parse_data(input: list[str]) -> list[Instruction]: + return [[int(n) for n in line.split()] for line in input] + + def parse(input: str) -> tuple[list[Example], list[Instruction]]: + examples, data = input.split("\n\n\n\n") + return parse_examples(examples), parse_data(data.splitlines()) + + def num_candidates(example: Example) -> int: + return sum( + op.apply(example.before, *example.data[1:]) == example.after + for op in OpCode + ) + + examples, data = parse(input) + return sum(num_candidates(example) >= 3 for example in examples) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 43de4e9dbaa12cf084c2eedf78fa2e1425733219 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 30 Dec 2024 17:23:54 -0500 Subject: [PATCH 11/48] 2018: d16: ex2: add input --- 2018/d16/ex2/input | 4148 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 4148 insertions(+) create mode 100644 2018/d16/ex2/input diff --git a/2018/d16/ex2/input b/2018/d16/ex2/input new file mode 100644 index 0000000..88aab0a --- /dev/null +++ b/2018/d16/ex2/input @@ -0,0 +1,4148 @@ +Before: [1, 1, 0, 1] +0 1 0 1 +After: [1, 1, 0, 1] + +Before: [2, 2, 2, 1] +2 1 2 2 +After: [2, 2, 1, 1] + +Before: [1, 3, 2, 2] +1 2 2 0 +After: [4, 3, 2, 2] + +Before: [2, 2, 1, 1] +8 0 2 1 +After: [2, 3, 1, 1] + +Before: [0, 1, 2, 2] +7 3 1 1 +After: [0, 3, 2, 2] + +Before: [1, 2, 2, 0] +8 2 0 1 +After: [1, 3, 2, 0] + +Before: [2, 2, 2, 0] +2 1 2 0 +After: [1, 2, 2, 0] + +Before: [0, 1, 1, 1] +3 1 0 1 +After: [0, 1, 1, 1] + +Before: [2, 3, 2, 2] +15 1 2 2 +After: [2, 3, 6, 2] + +Before: [0, 3, 1, 1] +9 0 0 3 +After: [0, 3, 1, 0] + +Before: [2, 0, 1, 1] +4 2 3 2 +After: [2, 0, 0, 1] + +Before: [1, 1, 3, 3] +6 0 3 3 +After: [1, 1, 3, 0] + +Before: [3, 2, 3, 2] +11 1 3 3 +After: [3, 2, 3, 1] + +Before: [3, 2, 1, 2] +14 3 3 1 +After: [3, 6, 1, 2] + +Before: [1, 0, 1, 2] +10 1 0 1 +After: [1, 1, 1, 2] + +Before: [1, 2, 0, 2] +11 1 3 2 +After: [1, 2, 1, 2] + +Before: [3, 3, 0, 0] +14 0 3 2 +After: [3, 3, 9, 0] + +Before: [2, 0, 2, 3] +6 0 3 1 +After: [2, 0, 2, 3] + +Before: [3, 2, 2, 2] +11 1 3 1 +After: [3, 1, 2, 2] + +Before: [2, 2, 0, 2] +13 1 2 1 +After: [2, 4, 0, 2] + +Before: [2, 2, 2, 0] +8 3 1 3 +After: [2, 2, 2, 2] + +Before: [2, 3, 1, 3] +6 0 3 2 +After: [2, 3, 0, 3] + +Before: [3, 3, 1, 1] +14 1 3 1 +After: [3, 9, 1, 1] + +Before: [2, 2, 1, 3] +6 0 3 2 +After: [2, 2, 0, 3] + +Before: [2, 3, 2, 3] +15 3 3 0 +After: [9, 3, 2, 3] + +Before: [1, 0, 0, 3] +10 1 0 1 +After: [1, 1, 0, 3] + +Before: [1, 3, 1, 3] +15 1 3 3 +After: [1, 3, 1, 9] + +Before: [1, 1, 2, 3] +15 1 2 3 +After: [1, 1, 2, 2] + +Before: [1, 1, 3, 0] +0 1 0 0 +After: [1, 1, 3, 0] + +Before: [1, 2, 3, 2] +13 3 2 2 +After: [1, 2, 4, 2] + +Before: [0, 1, 1, 2] +9 0 0 0 +After: [0, 1, 1, 2] + +Before: [2, 2, 0, 0] +12 1 1 3 +After: [2, 2, 0, 1] + +Before: [1, 0, 2, 3] +6 0 3 2 +After: [1, 0, 0, 3] + +Before: [1, 1, 0, 3] +6 0 3 3 +After: [1, 1, 0, 0] + +Before: [0, 2, 0, 0] +9 0 0 2 +After: [0, 2, 0, 0] + +Before: [0, 2, 2, 3] +5 0 3 0 +After: [3, 2, 2, 3] + +Before: [1, 0, 2, 1] +5 1 2 3 +After: [1, 0, 2, 2] + +Before: [1, 1, 3, 3] +0 1 0 2 +After: [1, 1, 1, 3] + +Before: [2, 0, 3, 1] +12 2 3 0 +After: [0, 0, 3, 1] + +Before: [0, 3, 2, 0] +5 0 2 0 +After: [2, 3, 2, 0] + +Before: [2, 1, 2, 2] +1 2 2 0 +After: [4, 1, 2, 2] + +Before: [1, 2, 1, 3] +6 0 3 2 +After: [1, 2, 0, 3] + +Before: [0, 2, 3, 1] +14 1 3 2 +After: [0, 2, 6, 1] + +Before: [1, 3, 3, 3] +5 0 3 2 +After: [1, 3, 3, 3] + +Before: [3, 1, 0, 3] +14 3 2 3 +After: [3, 1, 0, 6] + +Before: [2, 0, 3, 3] +12 3 2 0 +After: [1, 0, 3, 3] + +Before: [1, 2, 1, 2] +11 1 3 3 +After: [1, 2, 1, 1] + +Before: [2, 1, 2, 1] +1 0 2 1 +After: [2, 4, 2, 1] + +Before: [0, 1, 1, 0] +3 1 0 1 +After: [0, 1, 1, 0] + +Before: [0, 2, 3, 0] +9 0 0 2 +After: [0, 2, 0, 0] + +Before: [3, 1, 2, 3] +15 2 3 3 +After: [3, 1, 2, 6] + +Before: [0, 1, 0, 0] +3 1 0 0 +After: [1, 1, 0, 0] + +Before: [0, 0, 1, 2] +5 2 3 2 +After: [0, 0, 3, 2] + +Before: [0, 2, 2, 2] +8 0 3 1 +After: [0, 2, 2, 2] + +Before: [1, 2, 0, 3] +15 0 1 0 +After: [2, 2, 0, 3] + +Before: [2, 1, 0, 3] +6 0 3 2 +After: [2, 1, 0, 3] + +Before: [0, 2, 3, 2] +11 1 3 1 +After: [0, 1, 3, 2] + +Before: [1, 1, 2, 1] +0 1 0 1 +After: [1, 1, 2, 1] + +Before: [2, 2, 2, 0] +12 1 1 1 +After: [2, 1, 2, 0] + +Before: [3, 1, 2, 2] +1 2 2 2 +After: [3, 1, 4, 2] + +Before: [0, 1, 3, 0] +3 1 0 3 +After: [0, 1, 3, 1] + +Before: [3, 0, 2, 0] +1 2 2 2 +After: [3, 0, 4, 0] + +Before: [2, 3, 3, 2] +15 1 3 2 +After: [2, 3, 6, 2] + +Before: [3, 0, 2, 0] +1 2 2 0 +After: [4, 0, 2, 0] + +Before: [3, 2, 3, 2] +12 1 1 0 +After: [1, 2, 3, 2] + +Before: [2, 3, 3, 2] +13 0 2 0 +After: [4, 3, 3, 2] + +Before: [1, 0, 2, 2] +10 1 0 0 +After: [1, 0, 2, 2] + +Before: [2, 0, 0, 0] +8 1 0 1 +After: [2, 2, 0, 0] + +Before: [0, 2, 2, 1] +12 2 1 0 +After: [1, 2, 2, 1] + +Before: [0, 3, 2, 1] +9 0 0 3 +After: [0, 3, 2, 0] + +Before: [2, 2, 2, 1] +1 0 2 1 +After: [2, 4, 2, 1] + +Before: [0, 1, 2, 3] +3 1 0 2 +After: [0, 1, 1, 3] + +Before: [1, 1, 0, 2] +0 1 0 0 +After: [1, 1, 0, 2] + +Before: [3, 2, 1, 2] +11 1 3 0 +After: [1, 2, 1, 2] + +Before: [3, 1, 3, 3] +8 1 0 0 +After: [3, 1, 3, 3] + +Before: [3, 1, 2, 3] +15 0 2 2 +After: [3, 1, 6, 3] + +Before: [0, 2, 2, 1] +2 1 2 3 +After: [0, 2, 2, 1] + +Before: [1, 1, 0, 2] +0 1 0 3 +After: [1, 1, 0, 1] + +Before: [2, 2, 3, 2] +11 1 3 0 +After: [1, 2, 3, 2] + +Before: [1, 1, 3, 1] +0 1 0 2 +After: [1, 1, 1, 1] + +Before: [1, 2, 3, 0] +8 3 1 0 +After: [2, 2, 3, 0] + +Before: [1, 0, 2, 3] +10 1 0 0 +After: [1, 0, 2, 3] + +Before: [1, 3, 3, 1] +12 1 2 1 +After: [1, 1, 3, 1] + +Before: [0, 1, 2, 2] +3 1 0 0 +After: [1, 1, 2, 2] + +Before: [2, 2, 2, 3] +6 0 3 2 +After: [2, 2, 0, 3] + +Before: [3, 2, 3, 0] +13 1 2 0 +After: [4, 2, 3, 0] + +Before: [0, 1, 0, 1] +9 0 0 2 +After: [0, 1, 0, 1] + +Before: [2, 3, 3, 2] +13 3 2 1 +After: [2, 4, 3, 2] + +Before: [2, 2, 1, 3] +4 1 2 2 +After: [2, 2, 1, 3] + +Before: [1, 3, 0, 1] +8 0 1 2 +After: [1, 3, 3, 1] + +Before: [0, 1, 2, 0] +3 1 0 1 +After: [0, 1, 2, 0] + +Before: [0, 2, 0, 2] +11 1 3 1 +After: [0, 1, 0, 2] + +Before: [3, 2, 3, 1] +14 2 3 3 +After: [3, 2, 3, 9] + +Before: [0, 1, 1, 3] +3 1 0 0 +After: [1, 1, 1, 3] + +Before: [2, 2, 2, 1] +2 1 2 0 +After: [1, 2, 2, 1] + +Before: [0, 2, 1, 2] +4 3 3 3 +After: [0, 2, 1, 0] + +Before: [0, 1, 1, 2] +7 3 1 3 +After: [0, 1, 1, 3] + +Before: [1, 0, 1, 0] +10 1 0 0 +After: [1, 0, 1, 0] + +Before: [3, 2, 2, 1] +12 1 1 3 +After: [3, 2, 2, 1] + +Before: [0, 1, 0, 0] +9 0 0 2 +After: [0, 1, 0, 0] + +Before: [2, 2, 2, 1] +2 1 2 1 +After: [2, 1, 2, 1] + +Before: [1, 3, 0, 3] +2 1 3 0 +After: [1, 3, 0, 3] + +Before: [1, 1, 2, 2] +0 1 0 2 +After: [1, 1, 1, 2] + +Before: [0, 2, 0, 2] +11 1 3 3 +After: [0, 2, 0, 1] + +Before: [0, 2, 3, 2] +11 1 3 0 +After: [1, 2, 3, 2] + +Before: [2, 3, 2, 1] +7 3 2 0 +After: [3, 3, 2, 1] + +Before: [2, 1, 1, 3] +14 3 2 0 +After: [6, 1, 1, 3] + +Before: [1, 1, 3, 2] +0 1 0 0 +After: [1, 1, 3, 2] + +Before: [2, 2, 2, 3] +1 0 2 2 +After: [2, 2, 4, 3] + +Before: [1, 1, 0, 3] +0 1 0 3 +After: [1, 1, 0, 1] + +Before: [1, 0, 3, 0] +10 1 0 2 +After: [1, 0, 1, 0] + +Before: [0, 2, 0, 2] +11 1 3 2 +After: [0, 2, 1, 2] + +Before: [1, 3, 2, 1] +7 3 2 0 +After: [3, 3, 2, 1] + +Before: [2, 2, 1, 0] +14 0 3 2 +After: [2, 2, 6, 0] + +Before: [0, 1, 0, 0] +5 0 1 3 +After: [0, 1, 0, 1] + +Before: [0, 2, 2, 3] +15 2 3 0 +After: [6, 2, 2, 3] + +Before: [3, 3, 0, 3] +15 0 3 0 +After: [9, 3, 0, 3] + +Before: [0, 3, 3, 0] +14 2 3 0 +After: [9, 3, 3, 0] + +Before: [0, 1, 1, 2] +7 3 1 2 +After: [0, 1, 3, 2] + +Before: [1, 3, 1, 3] +2 1 3 0 +After: [1, 3, 1, 3] + +Before: [1, 0, 3, 3] +10 1 0 2 +After: [1, 0, 1, 3] + +Before: [0, 1, 3, 2] +3 1 0 3 +After: [0, 1, 3, 1] + +Before: [0, 1, 3, 1] +3 1 0 2 +After: [0, 1, 1, 1] + +Before: [1, 1, 2, 0] +0 1 0 1 +After: [1, 1, 2, 0] + +Before: [0, 3, 0, 2] +15 1 3 3 +After: [0, 3, 0, 6] + +Before: [0, 2, 1, 1] +4 1 2 2 +After: [0, 2, 1, 1] + +Before: [0, 2, 2, 1] +4 3 3 0 +After: [0, 2, 2, 1] + +Before: [1, 2, 1, 2] +8 1 0 1 +After: [1, 3, 1, 2] + +Before: [1, 2, 2, 0] +15 0 2 1 +After: [1, 2, 2, 0] + +Before: [2, 2, 3, 1] +4 3 3 1 +After: [2, 0, 3, 1] + +Before: [1, 2, 1, 0] +8 3 1 3 +After: [1, 2, 1, 2] + +Before: [3, 0, 2, 2] +8 1 0 2 +After: [3, 0, 3, 2] + +Before: [0, 0, 2, 0] +9 0 0 2 +After: [0, 0, 0, 0] + +Before: [1, 2, 2, 3] +4 1 0 2 +After: [1, 2, 1, 3] + +Before: [2, 1, 2, 2] +1 3 2 1 +After: [2, 4, 2, 2] + +Before: [2, 3, 0, 3] +2 1 3 1 +After: [2, 1, 0, 3] + +Before: [1, 2, 0, 2] +11 1 3 1 +After: [1, 1, 0, 2] + +Before: [3, 1, 0, 2] +7 3 1 1 +After: [3, 3, 0, 2] + +Before: [0, 2, 2, 3] +1 1 2 3 +After: [0, 2, 2, 4] + +Before: [1, 2, 3, 3] +6 0 3 0 +After: [0, 2, 3, 3] + +Before: [2, 0, 2, 1] +7 3 2 0 +After: [3, 0, 2, 1] + +Before: [0, 2, 2, 2] +8 0 3 2 +After: [0, 2, 2, 2] + +Before: [1, 0, 3, 1] +10 1 0 2 +After: [1, 0, 1, 1] + +Before: [0, 1, 2, 1] +4 3 3 2 +After: [0, 1, 0, 1] + +Before: [0, 2, 2, 0] +2 1 2 3 +After: [0, 2, 2, 1] + +Before: [0, 0, 2, 2] +5 1 2 0 +After: [2, 0, 2, 2] + +Before: [1, 0, 0, 3] +10 1 0 3 +After: [1, 0, 0, 1] + +Before: [1, 0, 3, 1] +10 1 0 3 +After: [1, 0, 3, 1] + +Before: [0, 0, 3, 2] +9 0 0 3 +After: [0, 0, 3, 0] + +Before: [1, 0, 1, 3] +10 1 0 2 +After: [1, 0, 1, 3] + +Before: [3, 2, 3, 2] +4 3 3 2 +After: [3, 2, 0, 2] + +Before: [0, 1, 1, 3] +3 1 0 2 +After: [0, 1, 1, 3] + +Before: [1, 2, 3, 3] +4 1 0 1 +After: [1, 1, 3, 3] + +Before: [0, 0, 0, 2] +9 0 0 1 +After: [0, 0, 0, 2] + +Before: [1, 0, 2, 1] +10 1 0 1 +After: [1, 1, 2, 1] + +Before: [1, 2, 3, 2] +5 0 3 2 +After: [1, 2, 3, 2] + +Before: [2, 2, 3, 2] +12 1 1 0 +After: [1, 2, 3, 2] + +Before: [2, 2, 2, 2] +12 2 1 2 +After: [2, 2, 1, 2] + +Before: [2, 2, 2, 3] +1 2 2 1 +After: [2, 4, 2, 3] + +Before: [3, 1, 3, 2] +7 3 1 2 +After: [3, 1, 3, 2] + +Before: [2, 2, 0, 0] +13 0 2 1 +After: [2, 4, 0, 0] + +Before: [0, 2, 1, 3] +15 1 3 1 +After: [0, 6, 1, 3] + +Before: [0, 1, 1, 2] +3 1 0 0 +After: [1, 1, 1, 2] + +Before: [2, 1, 0, 0] +8 3 0 1 +After: [2, 2, 0, 0] + +Before: [0, 1, 3, 3] +15 2 3 0 +After: [9, 1, 3, 3] + +Before: [0, 1, 1, 2] +3 1 0 1 +After: [0, 1, 1, 2] + +Before: [0, 1, 1, 1] +8 0 2 0 +After: [1, 1, 1, 1] + +Before: [1, 2, 2, 3] +12 1 1 3 +After: [1, 2, 2, 1] + +Before: [3, 3, 1, 2] +12 1 0 1 +After: [3, 1, 1, 2] + +Before: [3, 0, 0, 3] +14 3 2 2 +After: [3, 0, 6, 3] + +Before: [3, 3, 3, 1] +12 2 3 3 +After: [3, 3, 3, 0] + +Before: [2, 3, 2, 0] +14 2 3 1 +After: [2, 6, 2, 0] + +Before: [2, 3, 0, 2] +15 1 3 2 +After: [2, 3, 6, 2] + +Before: [3, 2, 3, 2] +11 1 3 1 +After: [3, 1, 3, 2] + +Before: [1, 2, 2, 1] +15 3 2 1 +After: [1, 2, 2, 1] + +Before: [1, 2, 2, 1] +5 0 2 1 +After: [1, 3, 2, 1] + +Before: [1, 2, 3, 3] +6 0 3 2 +After: [1, 2, 0, 3] + +Before: [1, 2, 2, 0] +5 0 2 2 +After: [1, 2, 3, 0] + +Before: [3, 0, 0, 2] +4 3 3 1 +After: [3, 0, 0, 2] + +Before: [1, 2, 1, 3] +8 1 0 2 +After: [1, 2, 3, 3] + +Before: [2, 0, 2, 1] +1 2 2 1 +After: [2, 4, 2, 1] + +Before: [2, 1, 2, 3] +1 2 2 3 +After: [2, 1, 2, 4] + +Before: [1, 1, 0, 1] +14 3 2 1 +After: [1, 2, 0, 1] + +Before: [1, 0, 2, 1] +1 2 2 1 +After: [1, 4, 2, 1] + +Before: [2, 2, 0, 3] +15 0 3 3 +After: [2, 2, 0, 6] + +Before: [3, 0, 2, 2] +1 3 2 0 +After: [4, 0, 2, 2] + +Before: [2, 2, 3, 2] +13 3 2 1 +After: [2, 4, 3, 2] + +Before: [1, 1, 2, 1] +0 1 0 2 +After: [1, 1, 1, 1] + +Before: [0, 2, 3, 2] +11 1 3 2 +After: [0, 2, 1, 2] + +Before: [2, 1, 1, 2] +7 3 1 0 +After: [3, 1, 1, 2] + +Before: [3, 0, 2, 0] +14 2 3 3 +After: [3, 0, 2, 6] + +Before: [2, 2, 0, 2] +14 0 3 3 +After: [2, 2, 0, 6] + +Before: [0, 0, 3, 2] +9 0 0 0 +After: [0, 0, 3, 2] + +Before: [1, 1, 3, 1] +0 1 0 1 +After: [1, 1, 3, 1] + +Before: [1, 1, 1, 1] +0 1 0 1 +After: [1, 1, 1, 1] + +Before: [1, 0, 2, 0] +10 1 0 1 +After: [1, 1, 2, 0] + +Before: [1, 1, 0, 3] +0 1 0 0 +After: [1, 1, 0, 3] + +Before: [0, 1, 0, 2] +13 3 2 1 +After: [0, 4, 0, 2] + +Before: [2, 1, 0, 0] +14 1 2 3 +After: [2, 1, 0, 2] + +Before: [3, 3, 2, 2] +4 3 3 1 +After: [3, 0, 2, 2] + +Before: [0, 2, 0, 0] +12 1 1 3 +After: [0, 2, 0, 1] + +Before: [1, 0, 2, 1] +1 2 2 2 +After: [1, 0, 4, 1] + +Before: [0, 1, 2, 1] +9 0 0 2 +After: [0, 1, 0, 1] + +Before: [1, 1, 3, 2] +0 1 0 2 +After: [1, 1, 1, 2] + +Before: [3, 0, 3, 2] +15 0 3 0 +After: [6, 0, 3, 2] + +Before: [2, 1, 2, 0] +5 3 2 0 +After: [2, 1, 2, 0] + +Before: [3, 2, 2, 2] +1 2 2 2 +After: [3, 2, 4, 2] + +Before: [1, 1, 0, 0] +0 1 0 3 +After: [1, 1, 0, 1] + +Before: [1, 2, 0, 3] +12 1 1 2 +After: [1, 2, 1, 3] + +Before: [2, 2, 2, 0] +1 0 2 1 +After: [2, 4, 2, 0] + +Before: [0, 2, 1, 3] +8 0 2 2 +After: [0, 2, 1, 3] + +Before: [3, 2, 0, 0] +14 1 3 1 +After: [3, 6, 0, 0] + +Before: [0, 2, 2, 3] +15 3 3 3 +After: [0, 2, 2, 9] + +Before: [1, 0, 3, 2] +10 1 0 0 +After: [1, 0, 3, 2] + +Before: [1, 2, 2, 0] +2 1 2 2 +After: [1, 2, 1, 0] + +Before: [0, 0, 3, 3] +9 0 0 1 +After: [0, 0, 3, 3] + +Before: [0, 1, 2, 3] +3 1 0 1 +After: [0, 1, 2, 3] + +Before: [1, 0, 1, 1] +10 1 0 3 +After: [1, 0, 1, 1] + +Before: [2, 0, 2, 3] +6 0 3 0 +After: [0, 0, 2, 3] + +Before: [0, 2, 3, 0] +13 1 2 1 +After: [0, 4, 3, 0] + +Before: [0, 1, 3, 2] +3 1 0 1 +After: [0, 1, 3, 2] + +Before: [1, 1, 0, 3] +6 0 3 0 +After: [0, 1, 0, 3] + +Before: [3, 2, 0, 1] +13 1 2 0 +After: [4, 2, 0, 1] + +Before: [2, 1, 3, 1] +5 0 1 2 +After: [2, 1, 3, 1] + +Before: [1, 1, 3, 2] +0 1 0 1 +After: [1, 1, 3, 2] + +Before: [2, 0, 0, 3] +6 0 3 0 +After: [0, 0, 0, 3] + +Before: [1, 2, 1, 0] +13 1 2 1 +After: [1, 4, 1, 0] + +Before: [2, 2, 1, 2] +11 1 3 3 +After: [2, 2, 1, 1] + +Before: [0, 1, 2, 3] +5 1 3 3 +After: [0, 1, 2, 3] + +Before: [2, 0, 3, 3] +6 0 3 2 +After: [2, 0, 0, 3] + +Before: [2, 2, 1, 0] +12 1 0 0 +After: [1, 2, 1, 0] + +Before: [2, 2, 2, 2] +11 1 3 0 +After: [1, 2, 2, 2] + +Before: [1, 1, 0, 1] +0 1 0 0 +After: [1, 1, 0, 1] + +Before: [0, 2, 2, 2] +11 1 3 0 +After: [1, 2, 2, 2] + +Before: [2, 2, 0, 2] +11 1 3 3 +After: [2, 2, 0, 1] + +Before: [2, 2, 2, 0] +2 1 2 2 +After: [2, 2, 1, 0] + +Before: [3, 1, 1, 2] +7 3 1 3 +After: [3, 1, 1, 3] + +Before: [0, 2, 1, 3] +9 0 0 0 +After: [0, 2, 1, 3] + +Before: [0, 2, 2, 2] +11 1 3 3 +After: [0, 2, 2, 1] + +Before: [3, 3, 3, 1] +7 3 2 2 +After: [3, 3, 3, 1] + +Before: [2, 0, 3, 3] +6 0 3 1 +After: [2, 0, 3, 3] + +Before: [0, 0, 2, 3] +5 1 3 1 +After: [0, 3, 2, 3] + +Before: [3, 3, 2, 0] +5 3 2 2 +After: [3, 3, 2, 0] + +Before: [3, 1, 2, 0] +14 2 3 3 +After: [3, 1, 2, 6] + +Before: [1, 1, 2, 0] +1 2 2 2 +After: [1, 1, 4, 0] + +Before: [1, 3, 1, 1] +4 2 3 1 +After: [1, 0, 1, 1] + +Before: [1, 1, 2, 3] +0 1 0 1 +After: [1, 1, 2, 3] + +Before: [3, 3, 3, 2] +15 2 3 0 +After: [6, 3, 3, 2] + +Before: [1, 1, 0, 1] +0 1 0 3 +After: [1, 1, 0, 1] + +Before: [2, 1, 1, 1] +13 0 2 1 +After: [2, 4, 1, 1] + +Before: [3, 3, 2, 1] +1 2 2 1 +After: [3, 4, 2, 1] + +Before: [0, 2, 2, 3] +2 1 2 3 +After: [0, 2, 2, 1] + +Before: [2, 0, 1, 3] +6 0 3 2 +After: [2, 0, 0, 3] + +Before: [1, 3, 3, 3] +6 0 3 2 +After: [1, 3, 0, 3] + +Before: [0, 1, 0, 2] +7 3 1 3 +After: [0, 1, 0, 3] + +Before: [0, 2, 2, 1] +12 2 1 2 +After: [0, 2, 1, 1] + +Before: [1, 3, 2, 3] +6 0 3 1 +After: [1, 0, 2, 3] + +Before: [1, 3, 1, 3] +15 1 3 2 +After: [1, 3, 9, 3] + +Before: [0, 3, 2, 2] +1 2 2 1 +After: [0, 4, 2, 2] + +Before: [3, 3, 2, 3] +2 1 3 2 +After: [3, 3, 1, 3] + +Before: [0, 0, 2, 3] +5 0 2 0 +After: [2, 0, 2, 3] + +Before: [3, 0, 2, 3] +15 2 3 0 +After: [6, 0, 2, 3] + +Before: [2, 3, 0, 3] +14 3 2 1 +After: [2, 6, 0, 3] + +Before: [2, 0, 2, 1] +1 0 2 2 +After: [2, 0, 4, 1] + +Before: [0, 1, 3, 1] +9 0 0 2 +After: [0, 1, 0, 1] + +Before: [1, 2, 2, 2] +2 1 2 3 +After: [1, 2, 2, 1] + +Before: [0, 0, 3, 1] +9 0 0 0 +After: [0, 0, 3, 1] + +Before: [0, 1, 3, 3] +3 1 0 2 +After: [0, 1, 1, 3] + +Before: [2, 1, 2, 3] +12 2 0 0 +After: [1, 1, 2, 3] + +Before: [1, 2, 3, 2] +11 1 3 2 +After: [1, 2, 1, 2] + +Before: [3, 2, 0, 2] +11 1 3 3 +After: [3, 2, 0, 1] + +Before: [2, 1, 2, 2] +12 2 0 1 +After: [2, 1, 2, 2] + +Before: [0, 1, 0, 2] +13 3 2 2 +After: [0, 1, 4, 2] + +Before: [0, 1, 1, 0] +9 0 0 3 +After: [0, 1, 1, 0] + +Before: [2, 1, 1, 3] +5 1 3 1 +After: [2, 3, 1, 3] + +Before: [0, 2, 2, 2] +1 2 2 1 +After: [0, 4, 2, 2] + +Before: [0, 1, 1, 2] +5 0 1 2 +After: [0, 1, 1, 2] + +Before: [1, 1, 1, 2] +0 1 0 1 +After: [1, 1, 1, 2] + +Before: [3, 3, 1, 2] +12 1 0 0 +After: [1, 3, 1, 2] + +Before: [3, 2, 1, 0] +14 0 3 0 +After: [9, 2, 1, 0] + +Before: [2, 2, 1, 1] +15 3 1 0 +After: [2, 2, 1, 1] + +Before: [1, 3, 2, 1] +7 3 2 2 +After: [1, 3, 3, 1] + +Before: [0, 2, 0, 0] +9 0 0 3 +After: [0, 2, 0, 0] + +Before: [1, 2, 1, 3] +4 1 0 1 +After: [1, 1, 1, 3] + +Before: [1, 1, 3, 2] +15 2 3 1 +After: [1, 6, 3, 2] + +Before: [2, 3, 3, 1] +7 3 2 0 +After: [3, 3, 3, 1] + +Before: [0, 1, 2, 2] +5 0 1 0 +After: [1, 1, 2, 2] + +Before: [3, 1, 0, 2] +7 3 1 0 +After: [3, 1, 0, 2] + +Before: [1, 3, 3, 3] +15 2 3 3 +After: [1, 3, 3, 9] + +Before: [3, 2, 2, 3] +15 3 3 1 +After: [3, 9, 2, 3] + +Before: [0, 0, 0, 2] +9 0 0 2 +After: [0, 0, 0, 2] + +Before: [2, 1, 3, 0] +5 1 2 3 +After: [2, 1, 3, 3] + +Before: [3, 0, 2, 1] +1 2 2 0 +After: [4, 0, 2, 1] + +Before: [1, 0, 2, 3] +10 1 0 3 +After: [1, 0, 2, 1] + +Before: [0, 3, 1, 2] +14 3 3 2 +After: [0, 3, 6, 2] + +Before: [0, 3, 3, 3] +2 1 3 2 +After: [0, 3, 1, 3] + +Before: [0, 2, 2, 0] +5 3 2 3 +After: [0, 2, 2, 2] + +Before: [1, 1, 2, 1] +5 2 1 0 +After: [3, 1, 2, 1] + +Before: [1, 2, 0, 2] +11 1 3 3 +After: [1, 2, 0, 1] + +Before: [3, 0, 2, 1] +7 3 2 3 +After: [3, 0, 2, 3] + +Before: [0, 2, 1, 3] +9 0 0 2 +After: [0, 2, 0, 3] + +Before: [2, 2, 2, 2] +11 1 3 3 +After: [2, 2, 2, 1] + +Before: [1, 3, 2, 3] +1 2 2 0 +After: [4, 3, 2, 3] + +Before: [1, 3, 1, 3] +2 1 3 2 +After: [1, 3, 1, 3] + +Before: [0, 1, 2, 3] +5 0 3 1 +After: [0, 3, 2, 3] + +Before: [2, 2, 1, 2] +11 1 3 1 +After: [2, 1, 1, 2] + +Before: [1, 0, 3, 1] +7 3 2 0 +After: [3, 0, 3, 1] + +Before: [1, 2, 1, 3] +6 0 3 0 +After: [0, 2, 1, 3] + +Before: [3, 2, 2, 2] +2 1 2 0 +After: [1, 2, 2, 2] + +Before: [3, 0, 0, 3] +5 1 3 0 +After: [3, 0, 0, 3] + +Before: [2, 3, 3, 3] +6 0 3 2 +After: [2, 3, 0, 3] + +Before: [1, 2, 3, 2] +11 1 3 0 +After: [1, 2, 3, 2] + +Before: [2, 3, 3, 3] +6 0 3 1 +After: [2, 0, 3, 3] + +Before: [2, 1, 0, 3] +6 0 3 0 +After: [0, 1, 0, 3] + +Before: [3, 2, 3, 1] +4 3 3 1 +After: [3, 0, 3, 1] + +Before: [1, 2, 2, 3] +1 2 2 1 +After: [1, 4, 2, 3] + +Before: [0, 2, 0, 2] +12 1 1 2 +After: [0, 2, 1, 2] + +Before: [3, 3, 1, 3] +2 1 3 3 +After: [3, 3, 1, 1] + +Before: [1, 1, 2, 2] +5 1 2 2 +After: [1, 1, 3, 2] + +Before: [0, 0, 2, 2] +5 0 2 3 +After: [0, 0, 2, 2] + +Before: [0, 1, 3, 1] +9 0 0 0 +After: [0, 1, 3, 1] + +Before: [0, 1, 0, 0] +3 1 0 1 +After: [0, 1, 0, 0] + +Before: [1, 0, 0, 1] +10 1 0 1 +After: [1, 1, 0, 1] + +Before: [1, 1, 1, 3] +0 1 0 0 +After: [1, 1, 1, 3] + +Before: [0, 2, 2, 2] +4 3 3 1 +After: [0, 0, 2, 2] + +Before: [1, 2, 1, 0] +8 2 1 0 +After: [3, 2, 1, 0] + +Before: [0, 1, 2, 1] +3 1 0 3 +After: [0, 1, 2, 1] + +Before: [1, 0, 2, 1] +10 1 0 3 +After: [1, 0, 2, 1] + +Before: [1, 1, 3, 1] +5 0 2 1 +After: [1, 3, 3, 1] + +Before: [2, 3, 2, 1] +4 3 3 2 +After: [2, 3, 0, 1] + +Before: [3, 3, 0, 3] +12 1 0 1 +After: [3, 1, 0, 3] + +Before: [3, 3, 1, 3] +8 2 0 3 +After: [3, 3, 1, 3] + +Before: [1, 3, 3, 1] +7 3 2 2 +After: [1, 3, 3, 1] + +Before: [3, 0, 3, 1] +4 3 3 0 +After: [0, 0, 3, 1] + +Before: [1, 3, 2, 3] +15 3 2 3 +After: [1, 3, 2, 6] + +Before: [3, 2, 2, 0] +2 1 2 2 +After: [3, 2, 1, 0] + +Before: [3, 1, 2, 1] +4 3 3 1 +After: [3, 0, 2, 1] + +Before: [2, 3, 1, 3] +2 1 3 3 +After: [2, 3, 1, 1] + +Before: [2, 2, 0, 3] +6 0 3 1 +After: [2, 0, 0, 3] + +Before: [2, 3, 2, 2] +1 0 2 0 +After: [4, 3, 2, 2] + +Before: [0, 1, 3, 3] +5 0 3 3 +After: [0, 1, 3, 3] + +Before: [2, 0, 3, 3] +12 3 2 2 +After: [2, 0, 1, 3] + +Before: [1, 1, 3, 2] +13 3 2 2 +After: [1, 1, 4, 2] + +Before: [1, 3, 3, 3] +2 1 3 2 +After: [1, 3, 1, 3] + +Before: [3, 2, 2, 2] +14 0 3 1 +After: [3, 9, 2, 2] + +Before: [1, 0, 3, 2] +8 1 3 2 +After: [1, 0, 2, 2] + +Before: [0, 3, 3, 3] +9 0 0 2 +After: [0, 3, 0, 3] + +Before: [3, 2, 0, 1] +4 3 3 0 +After: [0, 2, 0, 1] + +Before: [3, 0, 3, 2] +4 3 3 0 +After: [0, 0, 3, 2] + +Before: [3, 0, 3, 2] +8 1 2 1 +After: [3, 3, 3, 2] + +Before: [0, 2, 1, 1] +8 0 3 0 +After: [1, 2, 1, 1] + +Before: [2, 2, 2, 0] +1 1 2 1 +After: [2, 4, 2, 0] + +Before: [2, 2, 1, 3] +13 0 2 1 +After: [2, 4, 1, 3] + +Before: [0, 1, 3, 1] +3 1 0 0 +After: [1, 1, 3, 1] + +Before: [0, 1, 2, 2] +3 1 0 3 +After: [0, 1, 2, 1] + +Before: [1, 2, 2, 3] +6 0 3 1 +After: [1, 0, 2, 3] + +Before: [3, 2, 0, 3] +12 1 1 2 +After: [3, 2, 1, 3] + +Before: [2, 3, 1, 1] +13 0 2 0 +After: [4, 3, 1, 1] + +Before: [2, 1, 1, 0] +5 0 1 1 +After: [2, 3, 1, 0] + +Before: [3, 3, 2, 3] +15 3 2 3 +After: [3, 3, 2, 6] + +Before: [0, 1, 0, 3] +3 1 0 3 +After: [0, 1, 0, 1] + +Before: [1, 0, 3, 2] +14 2 3 1 +After: [1, 9, 3, 2] + +Before: [0, 2, 3, 1] +7 3 2 0 +After: [3, 2, 3, 1] + +Before: [2, 3, 0, 2] +14 1 2 2 +After: [2, 3, 6, 2] + +Before: [2, 2, 3, 1] +7 3 2 0 +After: [3, 2, 3, 1] + +Before: [0, 3, 3, 3] +12 3 2 2 +After: [0, 3, 1, 3] + +Before: [0, 2, 2, 2] +9 0 0 2 +After: [0, 2, 0, 2] + +Before: [0, 3, 1, 0] +8 0 1 2 +After: [0, 3, 3, 0] + +Before: [0, 3, 3, 0] +9 0 0 0 +After: [0, 3, 3, 0] + +Before: [0, 3, 0, 3] +15 3 3 1 +After: [0, 9, 0, 3] + +Before: [2, 1, 1, 3] +6 0 3 2 +After: [2, 1, 0, 3] + +Before: [2, 0, 0, 3] +15 3 3 1 +After: [2, 9, 0, 3] + +Before: [0, 1, 0, 3] +5 0 3 2 +After: [0, 1, 3, 3] + +Before: [1, 2, 2, 1] +4 1 0 0 +After: [1, 2, 2, 1] + +Before: [0, 2, 3, 2] +15 2 3 0 +After: [6, 2, 3, 2] + +Before: [0, 2, 2, 3] +9 0 0 1 +After: [0, 0, 2, 3] + +Before: [3, 3, 3, 3] +2 1 3 1 +After: [3, 1, 3, 3] + +Before: [1, 0, 2, 3] +10 1 0 1 +After: [1, 1, 2, 3] + +Before: [2, 1, 1, 3] +6 0 3 1 +After: [2, 0, 1, 3] + +Before: [0, 2, 2, 3] +1 2 2 1 +After: [0, 4, 2, 3] + +Before: [1, 1, 1, 1] +0 1 0 2 +After: [1, 1, 1, 1] + +Before: [0, 0, 2, 0] +1 2 2 1 +After: [0, 4, 2, 0] + +Before: [1, 3, 0, 2] +13 3 2 3 +After: [1, 3, 0, 4] + +Before: [1, 1, 0, 0] +0 1 0 2 +After: [1, 1, 1, 0] + +Before: [1, 1, 1, 3] +0 1 0 2 +After: [1, 1, 1, 3] + +Before: [1, 0, 3, 1] +10 1 0 0 +After: [1, 0, 3, 1] + +Before: [2, 2, 1, 2] +11 1 3 0 +After: [1, 2, 1, 2] + +Before: [0, 1, 0, 1] +9 0 0 3 +After: [0, 1, 0, 0] + +Before: [0, 2, 1, 3] +5 2 3 2 +After: [0, 2, 3, 3] + +Before: [1, 2, 2, 0] +1 1 2 3 +After: [1, 2, 2, 4] + +Before: [1, 1, 0, 1] +0 1 0 2 +After: [1, 1, 1, 1] + +Before: [0, 1, 2, 3] +3 1 0 0 +After: [1, 1, 2, 3] + +Before: [0, 0, 2, 1] +14 2 3 1 +After: [0, 6, 2, 1] + +Before: [2, 1, 2, 2] +7 3 1 3 +After: [2, 1, 2, 3] + +Before: [1, 3, 3, 2] +12 1 2 0 +After: [1, 3, 3, 2] + +Before: [3, 2, 2, 3] +1 2 2 2 +After: [3, 2, 4, 3] + +Before: [0, 3, 2, 1] +8 0 3 2 +After: [0, 3, 1, 1] + +Before: [1, 1, 0, 3] +0 1 0 2 +After: [1, 1, 1, 3] + +Before: [3, 2, 1, 2] +11 1 3 2 +After: [3, 2, 1, 2] + +Before: [0, 2, 1, 2] +11 1 3 1 +After: [0, 1, 1, 2] + +Before: [1, 2, 1, 3] +6 0 3 1 +After: [1, 0, 1, 3] + +Before: [2, 2, 2, 3] +2 1 2 2 +After: [2, 2, 1, 3] + +Before: [3, 2, 2, 1] +1 1 2 1 +After: [3, 4, 2, 1] + +Before: [1, 0, 0, 1] +10 1 0 3 +After: [1, 0, 0, 1] + +Before: [0, 1, 0, 1] +3 1 0 3 +After: [0, 1, 0, 1] + +Before: [1, 1, 1, 0] +0 1 0 3 +After: [1, 1, 1, 1] + +Before: [1, 1, 1, 2] +7 3 1 3 +After: [1, 1, 1, 3] + +Before: [3, 3, 1, 3] +2 1 3 0 +After: [1, 3, 1, 3] + +Before: [1, 0, 0, 2] +10 1 0 0 +After: [1, 0, 0, 2] + +Before: [0, 2, 1, 3] +13 1 2 3 +After: [0, 2, 1, 4] + +Before: [1, 0, 2, 0] +10 1 0 3 +After: [1, 0, 2, 1] + +Before: [2, 3, 3, 0] +13 0 2 3 +After: [2, 3, 3, 4] + +Before: [3, 1, 2, 3] +5 1 3 3 +After: [3, 1, 2, 3] + +Before: [1, 1, 1, 3] +0 1 0 1 +After: [1, 1, 1, 3] + +Before: [2, 1, 2, 1] +7 3 2 3 +After: [2, 1, 2, 3] + +Before: [1, 0, 0, 0] +10 1 0 0 +After: [1, 0, 0, 0] + +Before: [1, 1, 0, 2] +0 1 0 1 +After: [1, 1, 0, 2] + +Before: [3, 1, 2, 2] +1 2 2 0 +After: [4, 1, 2, 2] + +Before: [1, 1, 1, 2] +0 1 0 3 +After: [1, 1, 1, 1] + +Before: [1, 2, 3, 2] +11 1 3 1 +After: [1, 1, 3, 2] + +Before: [3, 0, 2, 1] +1 2 2 3 +After: [3, 0, 2, 4] + +Before: [0, 1, 0, 2] +3 1 0 1 +After: [0, 1, 0, 2] + +Before: [1, 0, 3, 3] +10 1 0 3 +After: [1, 0, 3, 1] + +Before: [1, 3, 1, 2] +5 0 3 2 +After: [1, 3, 3, 2] + +Before: [1, 0, 0, 2] +10 1 0 2 +After: [1, 0, 1, 2] + +Before: [1, 1, 1, 3] +6 0 3 3 +After: [1, 1, 1, 0] + +Before: [1, 2, 0, 2] +11 1 3 0 +After: [1, 2, 0, 2] + +Before: [1, 2, 1, 2] +11 1 3 1 +After: [1, 1, 1, 2] + +Before: [0, 0, 2, 0] +9 0 0 3 +After: [0, 0, 2, 0] + +Before: [3, 2, 2, 2] +1 3 2 2 +After: [3, 2, 4, 2] + +Before: [0, 1, 3, 2] +3 1 0 2 +After: [0, 1, 1, 2] + +Before: [2, 2, 1, 2] +11 1 3 2 +After: [2, 2, 1, 2] + +Before: [1, 3, 0, 2] +13 3 2 0 +After: [4, 3, 0, 2] + +Before: [2, 1, 2, 3] +6 0 3 2 +After: [2, 1, 0, 3] + +Before: [0, 2, 1, 2] +11 1 3 2 +After: [0, 2, 1, 2] + +Before: [2, 2, 2, 2] +2 1 2 1 +After: [2, 1, 2, 2] + +Before: [3, 0, 2, 2] +1 2 2 3 +After: [3, 0, 2, 4] + +Before: [0, 0, 3, 2] +13 3 2 0 +After: [4, 0, 3, 2] + +Before: [1, 2, 1, 1] +4 1 0 1 +After: [1, 1, 1, 1] + +Before: [1, 0, 2, 1] +10 1 0 0 +After: [1, 0, 2, 1] + +Before: [2, 0, 2, 3] +6 0 3 3 +After: [2, 0, 2, 0] + +Before: [1, 2, 3, 1] +4 3 3 3 +After: [1, 2, 3, 0] + +Before: [1, 1, 1, 2] +5 2 3 2 +After: [1, 1, 3, 2] + +Before: [1, 2, 3, 0] +14 1 3 1 +After: [1, 6, 3, 0] + +Before: [0, 0, 1, 3] +5 2 3 0 +After: [3, 0, 1, 3] + +Before: [0, 0, 0, 1] +9 0 0 0 +After: [0, 0, 0, 1] + +Before: [2, 1, 3, 1] +5 0 1 3 +After: [2, 1, 3, 3] + +Before: [2, 1, 2, 3] +6 0 3 3 +After: [2, 1, 2, 0] + +Before: [2, 3, 1, 3] +2 1 3 1 +After: [2, 1, 1, 3] + +Before: [1, 2, 1, 2] +4 3 3 3 +After: [1, 2, 1, 0] + +Before: [2, 2, 3, 2] +11 1 3 1 +After: [2, 1, 3, 2] + +Before: [2, 3, 3, 3] +13 0 2 1 +After: [2, 4, 3, 3] + +Before: [1, 3, 2, 3] +6 0 3 2 +After: [1, 3, 0, 3] + +Before: [2, 2, 1, 1] +4 1 2 0 +After: [1, 2, 1, 1] + +Before: [1, 0, 3, 3] +5 1 3 2 +After: [1, 0, 3, 3] + +Before: [3, 3, 2, 1] +7 3 2 1 +After: [3, 3, 2, 1] + +Before: [1, 0, 2, 2] +10 1 0 1 +After: [1, 1, 2, 2] + +Before: [2, 1, 1, 3] +13 0 2 0 +After: [4, 1, 1, 3] + +Before: [1, 1, 0, 0] +0 1 0 0 +After: [1, 1, 0, 0] + +Before: [2, 2, 2, 0] +2 1 2 1 +After: [2, 1, 2, 0] + +Before: [0, 1, 1, 0] +3 1 0 2 +After: [0, 1, 1, 0] + +Before: [1, 1, 2, 2] +1 3 2 3 +After: [1, 1, 2, 4] + +Before: [2, 2, 1, 2] +13 3 2 0 +After: [4, 2, 1, 2] + +Before: [0, 1, 0, 0] +9 0 0 1 +After: [0, 0, 0, 0] + +Before: [1, 3, 1, 1] +14 1 2 2 +After: [1, 3, 6, 1] + +Before: [1, 3, 0, 3] +6 0 3 1 +After: [1, 0, 0, 3] + +Before: [1, 2, 2, 2] +11 1 3 1 +After: [1, 1, 2, 2] + +Before: [1, 2, 0, 1] +12 1 1 2 +After: [1, 2, 1, 1] + +Before: [3, 3, 2, 2] +4 3 3 0 +After: [0, 3, 2, 2] + +Before: [0, 0, 0, 2] +4 3 3 3 +After: [0, 0, 0, 0] + +Before: [1, 1, 2, 0] +0 1 0 2 +After: [1, 1, 1, 0] + +Before: [3, 0, 2, 1] +7 3 2 2 +After: [3, 0, 3, 1] + +Before: [3, 1, 2, 1] +7 3 2 1 +After: [3, 3, 2, 1] + +Before: [0, 0, 2, 2] +1 3 2 2 +After: [0, 0, 4, 2] + +Before: [0, 1, 3, 1] +3 1 0 3 +After: [0, 1, 3, 1] + +Before: [1, 3, 2, 2] +14 3 3 3 +After: [1, 3, 2, 6] + +Before: [1, 3, 3, 0] +8 0 1 0 +After: [3, 3, 3, 0] + +Before: [1, 3, 2, 3] +1 2 2 1 +After: [1, 4, 2, 3] + +Before: [0, 1, 3, 2] +7 3 1 3 +After: [0, 1, 3, 3] + +Before: [3, 3, 2, 2] +15 1 2 2 +After: [3, 3, 6, 2] + +Before: [0, 3, 3, 1] +7 3 2 3 +After: [0, 3, 3, 3] + +Before: [2, 3, 3, 3] +2 1 3 1 +After: [2, 1, 3, 3] + +Before: [1, 1, 3, 1] +14 0 2 2 +After: [1, 1, 2, 1] + +Before: [2, 1, 0, 3] +8 1 0 2 +After: [2, 1, 3, 3] + +Before: [1, 2, 2, 0] +2 1 2 0 +After: [1, 2, 2, 0] + +Before: [1, 0, 0, 0] +10 1 0 2 +After: [1, 0, 1, 0] + +Before: [1, 3, 3, 3] +2 1 3 3 +After: [1, 3, 3, 1] + +Before: [0, 2, 2, 1] +1 1 2 3 +After: [0, 2, 2, 4] + +Before: [1, 2, 2, 3] +6 0 3 3 +After: [1, 2, 2, 0] + +Before: [3, 2, 0, 2] +11 1 3 2 +After: [3, 2, 1, 2] + +Before: [2, 2, 2, 2] +1 2 2 0 +After: [4, 2, 2, 2] + +Before: [1, 0, 0, 1] +4 3 3 1 +After: [1, 0, 0, 1] + +Before: [3, 1, 1, 2] +4 3 3 1 +After: [3, 0, 1, 2] + +Before: [1, 1, 2, 3] +6 0 3 3 +After: [1, 1, 2, 0] + +Before: [0, 3, 1, 3] +9 0 0 2 +After: [0, 3, 0, 3] + +Before: [1, 3, 0, 0] +8 2 1 0 +After: [3, 3, 0, 0] + +Before: [3, 2, 0, 2] +13 1 2 3 +After: [3, 2, 0, 4] + +Before: [0, 0, 1, 2] +13 3 2 2 +After: [0, 0, 4, 2] + +Before: [0, 2, 0, 2] +11 1 3 0 +After: [1, 2, 0, 2] + +Before: [0, 3, 1, 3] +9 0 0 3 +After: [0, 3, 1, 0] + +Before: [2, 2, 0, 2] +11 1 3 0 +After: [1, 2, 0, 2] + +Before: [0, 3, 1, 2] +8 2 1 0 +After: [3, 3, 1, 2] + +Before: [0, 3, 2, 2] +9 0 0 2 +After: [0, 3, 0, 2] + +Before: [3, 2, 0, 2] +13 1 2 2 +After: [3, 2, 4, 2] + +Before: [0, 3, 1, 1] +14 1 3 2 +After: [0, 3, 9, 1] + +Before: [2, 0, 2, 0] +1 0 2 1 +After: [2, 4, 2, 0] + +Before: [3, 2, 3, 2] +11 1 3 0 +After: [1, 2, 3, 2] + +Before: [0, 0, 3, 1] +7 3 2 0 +After: [3, 0, 3, 1] + +Before: [2, 2, 0, 2] +12 1 1 2 +After: [2, 2, 1, 2] + +Before: [0, 3, 2, 1] +8 0 1 0 +After: [3, 3, 2, 1] + +Before: [2, 0, 3, 1] +7 3 2 0 +After: [3, 0, 3, 1] + +Before: [0, 0, 1, 2] +8 0 3 2 +After: [0, 0, 2, 2] + +Before: [1, 1, 3, 0] +0 1 0 3 +After: [1, 1, 3, 1] + +Before: [1, 2, 0, 3] +4 1 0 1 +After: [1, 1, 0, 3] + +Before: [1, 1, 2, 1] +0 1 0 0 +After: [1, 1, 2, 1] + +Before: [2, 3, 2, 3] +6 0 3 3 +After: [2, 3, 2, 0] + +Before: [2, 1, 3, 2] +7 3 1 3 +After: [2, 1, 3, 3] + +Before: [1, 0, 0, 2] +4 3 3 2 +After: [1, 0, 0, 2] + +Before: [0, 0, 1, 1] +4 2 3 2 +After: [0, 0, 0, 1] + +Before: [1, 1, 0, 2] +0 1 0 2 +After: [1, 1, 1, 2] + +Before: [0, 1, 0, 2] +3 1 0 2 +After: [0, 1, 1, 2] + +Before: [2, 2, 0, 1] +13 0 2 0 +After: [4, 2, 0, 1] + +Before: [2, 2, 0, 3] +6 0 3 3 +After: [2, 2, 0, 0] + +Before: [0, 2, 0, 2] +13 3 2 0 +After: [4, 2, 0, 2] + +Before: [2, 2, 2, 2] +1 0 2 3 +After: [2, 2, 2, 4] + +Before: [1, 2, 2, 3] +2 1 2 3 +After: [1, 2, 2, 1] + +Before: [1, 2, 0, 0] +15 0 1 3 +After: [1, 2, 0, 2] + +Before: [2, 2, 0, 2] +11 1 3 1 +After: [2, 1, 0, 2] + +Before: [1, 0, 2, 3] +5 0 2 0 +After: [3, 0, 2, 3] + +Before: [1, 0, 0, 1] +10 1 0 2 +After: [1, 0, 1, 1] + +Before: [3, 1, 1, 1] +14 0 3 2 +After: [3, 1, 9, 1] + +Before: [0, 1, 3, 3] +3 1 0 3 +After: [0, 1, 3, 1] + +Before: [2, 1, 2, 2] +1 0 2 2 +After: [2, 1, 4, 2] + +Before: [0, 2, 2, 1] +12 1 1 0 +After: [1, 2, 2, 1] + +Before: [1, 2, 1, 2] +11 1 3 2 +After: [1, 2, 1, 2] + +Before: [0, 1, 2, 2] +3 1 0 1 +After: [0, 1, 2, 2] + +Before: [2, 2, 3, 2] +11 1 3 3 +After: [2, 2, 3, 1] + +Before: [0, 2, 1, 2] +12 1 1 1 +After: [0, 1, 1, 2] + +Before: [2, 1, 1, 3] +6 0 3 0 +After: [0, 1, 1, 3] + +Before: [1, 2, 1, 3] +8 0 1 3 +After: [1, 2, 1, 3] + +Before: [0, 3, 0, 2] +9 0 0 3 +After: [0, 3, 0, 0] + +Before: [0, 2, 2, 2] +11 1 3 1 +After: [0, 1, 2, 2] + +Before: [0, 1, 0, 2] +3 1 0 0 +After: [1, 1, 0, 2] + +Before: [2, 0, 1, 2] +13 0 2 2 +After: [2, 0, 4, 2] + +Before: [1, 0, 0, 2] +10 1 0 3 +After: [1, 0, 0, 1] + +Before: [3, 1, 3, 2] +14 0 3 3 +After: [3, 1, 3, 9] + +Before: [2, 2, 2, 3] +15 2 3 0 +After: [6, 2, 2, 3] + +Before: [1, 0, 1, 0] +10 1 0 2 +After: [1, 0, 1, 0] + +Before: [0, 2, 1, 0] +9 0 0 3 +After: [0, 2, 1, 0] + +Before: [1, 2, 2, 2] +11 1 3 0 +After: [1, 2, 2, 2] + +Before: [1, 2, 3, 1] +15 3 1 0 +After: [2, 2, 3, 1] + +Before: [0, 0, 3, 1] +8 0 2 2 +After: [0, 0, 3, 1] + +Before: [2, 0, 2, 1] +14 0 3 1 +After: [2, 6, 2, 1] + +Before: [0, 0, 2, 3] +15 2 3 1 +After: [0, 6, 2, 3] + +Before: [1, 2, 2, 0] +12 1 1 2 +After: [1, 2, 1, 0] + +Before: [2, 2, 3, 0] +12 1 0 2 +After: [2, 2, 1, 0] + +Before: [3, 2, 0, 2] +11 1 3 1 +After: [3, 1, 0, 2] + +Before: [2, 2, 2, 3] +6 0 3 3 +After: [2, 2, 2, 0] + +Before: [0, 1, 0, 0] +3 1 0 2 +After: [0, 1, 1, 0] + +Before: [0, 1, 1, 3] +3 1 0 3 +After: [0, 1, 1, 1] + +Before: [2, 0, 0, 3] +6 0 3 1 +After: [2, 0, 0, 3] + +Before: [3, 1, 0, 0] +8 1 0 0 +After: [3, 1, 0, 0] + +Before: [0, 1, 2, 1] +3 1 0 1 +After: [0, 1, 2, 1] + +Before: [1, 0, 1, 0] +10 1 0 3 +After: [1, 0, 1, 1] + +Before: [0, 0, 3, 1] +12 2 3 3 +After: [0, 0, 3, 0] + +Before: [0, 1, 0, 1] +4 3 3 2 +After: [0, 1, 0, 1] + +Before: [1, 0, 2, 1] +7 3 2 2 +After: [1, 0, 3, 1] + +Before: [1, 1, 2, 2] +15 0 2 0 +After: [2, 1, 2, 2] + +Before: [3, 3, 0, 3] +2 1 3 2 +After: [3, 3, 1, 3] + +Before: [1, 0, 3, 3] +10 1 0 0 +After: [1, 0, 3, 3] + +Before: [1, 3, 2, 1] +14 2 3 2 +After: [1, 3, 6, 1] + +Before: [0, 1, 1, 1] +3 1 0 0 +After: [1, 1, 1, 1] + +Before: [3, 3, 0, 1] +4 3 3 3 +After: [3, 3, 0, 0] + +Before: [3, 3, 2, 1] +7 3 2 2 +After: [3, 3, 3, 1] + +Before: [3, 2, 2, 1] +2 1 2 3 +After: [3, 2, 2, 1] + +Before: [1, 1, 1, 3] +6 0 3 0 +After: [0, 1, 1, 3] + +Before: [3, 0, 2, 3] +5 1 3 3 +After: [3, 0, 2, 3] + +Before: [2, 2, 3, 3] +15 1 3 2 +After: [2, 2, 6, 3] + +Before: [1, 2, 1, 2] +8 2 1 3 +After: [1, 2, 1, 3] + +Before: [0, 2, 3, 1] +15 3 1 0 +After: [2, 2, 3, 1] + +Before: [3, 3, 0, 3] +12 3 0 2 +After: [3, 3, 1, 3] + +Before: [2, 2, 2, 2] +11 1 3 2 +After: [2, 2, 1, 2] + +Before: [3, 0, 3, 0] +8 1 2 1 +After: [3, 3, 3, 0] + +Before: [1, 1, 1, 2] +5 0 3 2 +After: [1, 1, 3, 2] + +Before: [0, 3, 3, 2] +9 0 0 2 +After: [0, 3, 0, 2] + +Before: [0, 3, 2, 1] +9 0 0 0 +After: [0, 3, 2, 1] + +Before: [1, 3, 1, 3] +5 2 3 3 +After: [1, 3, 1, 3] + +Before: [2, 1, 3, 3] +6 0 3 3 +After: [2, 1, 3, 0] + +Before: [0, 1, 1, 0] +9 0 0 0 +After: [0, 1, 1, 0] + +Before: [1, 0, 2, 3] +6 0 3 0 +After: [0, 0, 2, 3] + +Before: [3, 3, 3, 1] +7 3 2 0 +After: [3, 3, 3, 1] + +Before: [0, 1, 3, 0] +3 1 0 2 +After: [0, 1, 1, 0] + +Before: [1, 2, 2, 2] +4 3 3 1 +After: [1, 0, 2, 2] + +Before: [3, 2, 2, 2] +11 1 3 3 +After: [3, 2, 2, 1] + +Before: [0, 1, 0, 2] +9 0 0 0 +After: [0, 1, 0, 2] + +Before: [1, 0, 1, 3] +10 1 0 0 +After: [1, 0, 1, 3] + +Before: [3, 3, 2, 3] +2 1 3 1 +After: [3, 1, 2, 3] + +Before: [2, 3, 1, 0] +8 3 0 1 +After: [2, 2, 1, 0] + +Before: [1, 1, 2, 1] +0 1 0 3 +After: [1, 1, 2, 1] + +Before: [3, 3, 2, 3] +15 3 2 1 +After: [3, 6, 2, 3] + +Before: [0, 2, 1, 2] +4 1 2 3 +After: [0, 2, 1, 1] + +Before: [2, 2, 1, 0] +13 1 2 1 +After: [2, 4, 1, 0] + +Before: [1, 0, 3, 3] +10 1 0 1 +After: [1, 1, 3, 3] + +Before: [3, 3, 2, 0] +1 2 2 2 +After: [3, 3, 4, 0] + +Before: [1, 2, 1, 2] +11 1 3 0 +After: [1, 2, 1, 2] + +Before: [1, 3, 1, 3] +6 0 3 3 +After: [1, 3, 1, 0] + +Before: [3, 3, 1, 3] +8 2 1 1 +After: [3, 3, 1, 3] + +Before: [1, 0, 0, 1] +4 3 3 0 +After: [0, 0, 0, 1] + +Before: [1, 2, 2, 2] +11 1 3 3 +After: [1, 2, 2, 1] + +Before: [3, 1, 2, 1] +8 1 0 0 +After: [3, 1, 2, 1] + +Before: [3, 0, 1, 2] +8 1 3 3 +After: [3, 0, 1, 2] + +Before: [1, 1, 3, 3] +0 1 0 3 +After: [1, 1, 3, 1] + +Before: [0, 0, 1, 2] +13 3 2 1 +After: [0, 4, 1, 2] + +Before: [2, 3, 0, 1] +13 0 2 0 +After: [4, 3, 0, 1] + +Before: [1, 2, 2, 0] +2 1 2 1 +After: [1, 1, 2, 0] + +Before: [2, 3, 1, 0] +13 0 2 2 +After: [2, 3, 4, 0] + +Before: [0, 1, 2, 3] +3 1 0 3 +After: [0, 1, 2, 1] + +Before: [2, 3, 2, 2] +15 1 3 1 +After: [2, 6, 2, 2] + +Before: [0, 1, 2, 0] +3 1 0 3 +After: [0, 1, 2, 1] + +Before: [1, 2, 2, 2] +15 0 2 2 +After: [1, 2, 2, 2] + +Before: [1, 2, 2, 1] +12 1 1 2 +After: [1, 2, 1, 1] + +Before: [0, 1, 1, 0] +3 1 0 0 +After: [1, 1, 1, 0] + +Before: [3, 3, 0, 1] +14 0 3 1 +After: [3, 9, 0, 1] + +Before: [1, 0, 2, 1] +10 1 0 2 +After: [1, 0, 1, 1] + +Before: [0, 3, 2, 3] +9 0 0 2 +After: [0, 3, 0, 3] + +Before: [0, 2, 1, 2] +11 1 3 3 +After: [0, 2, 1, 1] + +Before: [2, 0, 1, 3] +6 0 3 1 +After: [2, 0, 1, 3] + +Before: [1, 1, 2, 3] +0 1 0 3 +After: [1, 1, 2, 1] + +Before: [3, 0, 2, 2] +1 2 2 1 +After: [3, 4, 2, 2] + +Before: [1, 3, 2, 0] +5 3 2 3 +After: [1, 3, 2, 2] + +Before: [3, 3, 0, 3] +8 2 0 1 +After: [3, 3, 0, 3] + +Before: [0, 0, 3, 3] +9 0 0 3 +After: [0, 0, 3, 0] + +Before: [0, 3, 1, 3] +8 2 1 3 +After: [0, 3, 1, 3] + +Before: [1, 1, 3, 2] +0 1 0 3 +After: [1, 1, 3, 1] + +Before: [1, 0, 0, 3] +10 1 0 2 +After: [1, 0, 1, 3] + +Before: [2, 0, 1, 2] +13 3 2 3 +After: [2, 0, 1, 4] + +Before: [3, 2, 3, 2] +13 1 2 0 +After: [4, 2, 3, 2] + +Before: [0, 1, 0, 2] +3 1 0 3 +After: [0, 1, 0, 1] + +Before: [1, 1, 3, 1] +0 1 0 0 +After: [1, 1, 3, 1] + +Before: [0, 1, 3, 0] +3 1 0 0 +After: [1, 1, 3, 0] + +Before: [0, 1, 0, 1] +3 1 0 1 +After: [0, 1, 0, 1] + +Before: [3, 2, 1, 2] +4 1 2 2 +After: [3, 2, 1, 2] + +Before: [1, 1, 2, 3] +0 1 0 0 +After: [1, 1, 2, 3] + +Before: [3, 2, 3, 2] +11 1 3 2 +After: [3, 2, 1, 2] + +Before: [0, 1, 3, 1] +3 1 0 1 +After: [0, 1, 3, 1] + +Before: [1, 1, 2, 0] +0 1 0 3 +After: [1, 1, 2, 1] + +Before: [0, 1, 3, 0] +9 0 0 3 +After: [0, 1, 3, 0] + +Before: [2, 2, 3, 1] +14 2 3 2 +After: [2, 2, 9, 1] + +Before: [0, 1, 0, 1] +3 1 0 2 +After: [0, 1, 1, 1] + +Before: [3, 3, 3, 3] +15 0 3 3 +After: [3, 3, 3, 9] + +Before: [2, 1, 2, 3] +6 0 3 0 +After: [0, 1, 2, 3] + +Before: [0, 2, 1, 2] +8 0 3 1 +After: [0, 2, 1, 2] + +Before: [0, 2, 2, 1] +2 1 2 1 +After: [0, 1, 2, 1] + +Before: [1, 0, 1, 2] +10 1 0 0 +After: [1, 0, 1, 2] + +Before: [1, 2, 3, 3] +15 1 3 3 +After: [1, 2, 3, 6] + +Before: [2, 1, 2, 3] +15 1 2 3 +After: [2, 1, 2, 2] + +Before: [1, 2, 2, 1] +14 1 3 3 +After: [1, 2, 2, 6] + +Before: [1, 1, 1, 0] +0 1 0 1 +After: [1, 1, 1, 0] + +Before: [3, 2, 3, 1] +4 3 3 0 +After: [0, 2, 3, 1] + +Before: [0, 2, 2, 2] +11 1 3 2 +After: [0, 2, 1, 2] + +Before: [2, 1, 3, 1] +14 3 2 3 +After: [2, 1, 3, 2] + +Before: [0, 2, 2, 3] +2 1 2 0 +After: [1, 2, 2, 3] + +Before: [0, 1, 3, 3] +5 0 3 2 +After: [0, 1, 3, 3] + +Before: [0, 3, 2, 2] +15 1 2 0 +After: [6, 3, 2, 2] + +Before: [2, 2, 1, 2] +14 3 3 1 +After: [2, 6, 1, 2] + +Before: [2, 2, 2, 2] +11 1 3 1 +After: [2, 1, 2, 2] + +Before: [3, 2, 2, 2] +11 1 3 0 +After: [1, 2, 2, 2] + +Before: [1, 3, 2, 1] +15 0 2 0 +After: [2, 3, 2, 1] + +Before: [1, 2, 0, 0] +15 0 1 2 +After: [1, 2, 2, 0] + +Before: [1, 2, 2, 3] +1 1 2 1 +After: [1, 4, 2, 3] + +Before: [3, 2, 2, 1] +7 3 2 0 +After: [3, 2, 2, 1] + +Before: [3, 2, 2, 0] +12 1 1 2 +After: [3, 2, 1, 0] + +Before: [1, 0, 3, 3] +6 0 3 1 +After: [1, 0, 3, 3] + +Before: [2, 0, 2, 1] +1 0 2 3 +After: [2, 0, 2, 4] + +Before: [2, 0, 1, 2] +13 0 2 0 +After: [4, 0, 1, 2] + +Before: [2, 2, 2, 2] +12 2 1 0 +After: [1, 2, 2, 2] + +Before: [2, 2, 0, 2] +13 3 2 1 +After: [2, 4, 0, 2] + +Before: [3, 3, 3, 0] +14 2 3 1 +After: [3, 9, 3, 0] + +Before: [3, 1, 0, 2] +4 3 3 3 +After: [3, 1, 0, 0] + +Before: [0, 2, 2, 3] +1 1 2 0 +After: [4, 2, 2, 3] + +Before: [0, 1, 1, 2] +9 0 0 1 +After: [0, 0, 1, 2] + +Before: [3, 3, 1, 0] +14 1 3 2 +After: [3, 3, 9, 0] + +Before: [2, 0, 2, 3] +5 1 2 2 +After: [2, 0, 2, 3] + +Before: [1, 1, 1, 2] +0 1 0 0 +After: [1, 1, 1, 2] + +Before: [3, 2, 3, 3] +15 1 3 0 +After: [6, 2, 3, 3] + +Before: [1, 3, 2, 1] +14 1 3 0 +After: [9, 3, 2, 1] + +Before: [2, 0, 2, 2] +1 2 2 0 +After: [4, 0, 2, 2] + +Before: [0, 2, 1, 2] +11 1 3 0 +After: [1, 2, 1, 2] + +Before: [0, 1, 1, 1] +3 1 0 3 +After: [0, 1, 1, 1] + +Before: [1, 0, 1, 0] +10 1 0 1 +After: [1, 1, 1, 0] + +Before: [1, 1, 1, 1] +4 3 3 3 +After: [1, 1, 1, 0] + +Before: [3, 2, 2, 2] +14 0 3 3 +After: [3, 2, 2, 9] + +Before: [0, 1, 2, 1] +9 0 0 0 +After: [0, 1, 2, 1] + +Before: [2, 0, 2, 3] +1 2 2 0 +After: [4, 0, 2, 3] + +Before: [1, 1, 1, 3] +0 1 0 3 +After: [1, 1, 1, 1] + +Before: [0, 1, 0, 3] +3 1 0 1 +After: [0, 1, 0, 3] + +Before: [2, 0, 2, 1] +5 1 2 0 +After: [2, 0, 2, 1] + +Before: [1, 3, 3, 1] +14 0 2 0 +After: [2, 3, 3, 1] + +Before: [1, 0, 0, 3] +6 0 3 1 +After: [1, 0, 0, 3] + +Before: [2, 3, 0, 3] +6 0 3 3 +After: [2, 3, 0, 0] + +Before: [0, 1, 2, 2] +1 3 2 3 +After: [0, 1, 2, 4] + +Before: [3, 1, 2, 3] +1 2 2 2 +After: [3, 1, 4, 3] + +Before: [3, 1, 0, 3] +8 2 0 3 +After: [3, 1, 0, 3] + +Before: [3, 3, 1, 2] +14 0 3 3 +After: [3, 3, 1, 9] + +Before: [3, 0, 3, 2] +4 3 3 3 +After: [3, 0, 3, 0] + +Before: [2, 3, 1, 0] +8 2 1 0 +After: [3, 3, 1, 0] + +Before: [0, 1, 2, 1] +3 1 0 2 +After: [0, 1, 1, 1] + +Before: [0, 1, 3, 2] +3 1 0 0 +After: [1, 1, 3, 2] + +Before: [1, 1, 2, 0] +15 0 2 1 +After: [1, 2, 2, 0] + +Before: [0, 3, 2, 2] +1 3 2 0 +After: [4, 3, 2, 2] + +Before: [1, 0, 1, 2] +10 1 0 3 +After: [1, 0, 1, 1] + +Before: [0, 2, 2, 0] +12 1 1 0 +After: [1, 2, 2, 0] + +Before: [1, 1, 3, 3] +0 1 0 1 +After: [1, 1, 3, 3] + +Before: [1, 0, 2, 0] +10 1 0 2 +After: [1, 0, 1, 0] + +Before: [2, 3, 2, 1] +15 1 2 1 +After: [2, 6, 2, 1] + +Before: [1, 2, 0, 0] +8 1 0 1 +After: [1, 3, 0, 0] + +Before: [3, 2, 1, 2] +11 1 3 3 +After: [3, 2, 1, 1] + +Before: [1, 1, 1, 1] +0 1 0 3 +After: [1, 1, 1, 1] + +Before: [2, 3, 1, 3] +6 0 3 3 +After: [2, 3, 1, 0] + +Before: [0, 2, 1, 3] +13 1 2 2 +After: [0, 2, 4, 3] + +Before: [1, 0, 3, 1] +7 3 2 3 +After: [1, 0, 3, 3] + +Before: [2, 1, 0, 0] +8 3 0 3 +After: [2, 1, 0, 2] + +Before: [1, 1, 1, 2] +0 1 0 2 +After: [1, 1, 1, 2] + +Before: [3, 2, 2, 2] +1 3 2 3 +After: [3, 2, 2, 4] + +Before: [3, 1, 1, 1] +14 0 3 3 +After: [3, 1, 1, 9] + +Before: [2, 2, 3, 3] +6 0 3 0 +After: [0, 2, 3, 3] + +Before: [0, 1, 1, 2] +3 1 0 2 +After: [0, 1, 1, 2] + +Before: [3, 2, 1, 2] +14 0 3 0 +After: [9, 2, 1, 2] + +Before: [2, 0, 3, 1] +7 3 2 3 +After: [2, 0, 3, 3] + +Before: [1, 2, 2, 1] +2 1 2 0 +After: [1, 2, 2, 1] + +Before: [0, 0, 2, 1] +4 3 3 3 +After: [0, 0, 2, 0] + +Before: [3, 2, 3, 3] +12 3 0 3 +After: [3, 2, 3, 1] + +Before: [1, 1, 2, 2] +0 1 0 3 +After: [1, 1, 2, 1] + +Before: [2, 3, 1, 1] +14 1 3 2 +After: [2, 3, 9, 1] + +Before: [1, 0, 2, 1] +15 0 2 1 +After: [1, 2, 2, 1] + +Before: [0, 1, 2, 3] +9 0 0 3 +After: [0, 1, 2, 0] + +Before: [3, 0, 0, 2] +4 3 3 0 +After: [0, 0, 0, 2] + +Before: [3, 0, 3, 1] +7 3 2 3 +After: [3, 0, 3, 3] + +Before: [3, 2, 2, 3] +12 2 1 1 +After: [3, 1, 2, 3] + +Before: [0, 3, 3, 3] +2 1 3 1 +After: [0, 1, 3, 3] + +Before: [1, 0, 0, 0] +10 1 0 1 +After: [1, 1, 0, 0] + +Before: [1, 3, 0, 3] +2 1 3 3 +After: [1, 3, 0, 1] + +Before: [3, 2, 2, 3] +12 3 0 2 +After: [3, 2, 1, 3] + +Before: [1, 1, 2, 0] +0 1 0 0 +After: [1, 1, 2, 0] + +Before: [0, 2, 2, 1] +2 1 2 2 +After: [0, 2, 1, 1] + +Before: [1, 0, 1, 2] +10 1 0 2 +After: [1, 0, 1, 2] + +Before: [1, 0, 3, 0] +14 0 2 2 +After: [1, 0, 2, 0] + +Before: [0, 2, 3, 2] +11 1 3 3 +After: [0, 2, 3, 1] + +Before: [0, 1, 0, 3] +3 1 0 2 +After: [0, 1, 1, 3] + +Before: [3, 3, 2, 1] +12 1 0 0 +After: [1, 3, 2, 1] + +Before: [0, 2, 3, 3] +13 1 2 0 +After: [4, 2, 3, 3] + +Before: [1, 1, 3, 0] +0 1 0 1 +After: [1, 1, 3, 0] + +Before: [1, 2, 2, 2] +2 1 2 2 +After: [1, 2, 1, 2] + +Before: [2, 1, 3, 3] +13 0 2 2 +After: [2, 1, 4, 3] + +Before: [1, 0, 1, 3] +10 1 0 3 +After: [1, 0, 1, 1] + +Before: [2, 1, 3, 2] +7 3 1 1 +After: [2, 3, 3, 2] + +Before: [1, 1, 1, 0] +0 1 0 0 +After: [1, 1, 1, 0] + +Before: [0, 2, 3, 2] +13 3 2 3 +After: [0, 2, 3, 4] + +Before: [3, 2, 2, 3] +12 3 0 3 +After: [3, 2, 2, 1] + +Before: [2, 3, 2, 3] +2 1 3 1 +After: [2, 1, 2, 3] + +Before: [2, 3, 0, 3] +6 0 3 1 +After: [2, 0, 0, 3] + +Before: [2, 2, 2, 3] +1 2 2 0 +After: [4, 2, 2, 3] + +Before: [3, 2, 3, 2] +4 3 3 1 +After: [3, 0, 3, 2] + +Before: [0, 2, 2, 0] +12 1 1 1 +After: [0, 1, 2, 0] + +Before: [2, 2, 3, 2] +11 1 3 2 +After: [2, 2, 1, 2] + +Before: [3, 0, 2, 3] +1 2 2 2 +After: [3, 0, 4, 3] + +Before: [0, 3, 2, 0] +9 0 0 0 +After: [0, 3, 2, 0] + +Before: [0, 2, 3, 1] +9 0 0 2 +After: [0, 2, 0, 1] + +Before: [0, 1, 1, 1] +3 1 0 2 +After: [0, 1, 1, 1] + +Before: [2, 2, 2, 3] +2 1 2 0 +After: [1, 2, 2, 3] + +Before: [0, 1, 2, 3] +15 3 2 0 +After: [6, 1, 2, 3] + +Before: [1, 1, 0, 2] +7 3 1 3 +After: [1, 1, 0, 3] + +Before: [1, 1, 1, 1] +0 1 0 0 +After: [1, 1, 1, 1] + +Before: [1, 2, 3, 3] +15 0 1 3 +After: [1, 2, 3, 2] + +Before: [0, 3, 2, 3] +2 1 3 1 +After: [0, 1, 2, 3] + +Before: [0, 3, 0, 0] +8 2 1 3 +After: [0, 3, 0, 3] + +Before: [2, 0, 2, 3] +1 0 2 0 +After: [4, 0, 2, 3] + +Before: [0, 3, 0, 3] +5 0 3 3 +After: [0, 3, 0, 3] + +Before: [0, 1, 2, 0] +3 1 0 0 +After: [1, 1, 2, 0] + + + +7 3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 2 0 +7 2 2 2 +7 0 1 3 +6 3 2 3 +14 3 1 3 +1 3 0 0 From 27c2cc0463c455089a9a51adc14c488b52293ee0 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 30 Dec 2024 17:24:06 -0500 Subject: [PATCH 12/48] 2018: d16: ex2: add solution --- 2018/d16/ex2/ex2.py | 133 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100755 2018/d16/ex2/ex2.py diff --git a/2018/d16/ex2/ex2.py b/2018/d16/ex2/ex2.py new file mode 100755 index 0000000..db81638 --- /dev/null +++ b/2018/d16/ex2/ex2.py @@ -0,0 +1,133 @@ +#!/usr/bin/env python + +import copy +import enum +import sys +from typing import NamedTuple + + +class OpCode(enum.StrEnum): + ADDR = "addr" + ADDI = "addi" + MULR = "mulr" + MULI = "muli" + BANR = "banr" + BANI = "bani" + BORR = "borr" + BORI = "bori" + SETR = "setr" + SETI = "seti" + GTIR = "gtir" + GTRI = "gtri" + GTRR = "gtrr" + EQIR = "eqir" + EQRI = "eqri" + EQRR = "eqrr" + + def apply(self, registers: list[int], a: int, b: int, c: int) -> list[int]: + registers = copy.deepcopy(registers) + if self == OpCode.ADDR: + registers[c] = registers[a] + registers[b] + if self == OpCode.ADDI: + registers[c] = registers[a] + b + if self == OpCode.MULR: + registers[c] = registers[a] * registers[b] + if self == OpCode.MULI: + registers[c] = registers[a] * b + if self == OpCode.BANR: + registers[c] = registers[a] & registers[b] + if self == OpCode.BANI: + registers[c] = registers[a] & b + if self == OpCode.BORR: + registers[c] = registers[a] | registers[b] + if self == OpCode.BORI: + registers[c] = registers[a] | b + if self == OpCode.SETR: + registers[c] = registers[a] + if self == OpCode.SETI: + registers[c] = a + if self == OpCode.GTIR: + registers[c] = a > registers[b] + if self == OpCode.GTRI: + registers[c] = registers[a] > b + if self == OpCode.GTRR: + registers[c] = registers[a] > registers[b] + if self == OpCode.EQIR: + registers[c] = a == registers[b] + if self == OpCode.EQRI: + registers[c] = registers[a] == b + if self == OpCode.EQRR: + registers[c] = registers[a] == registers[b] + return registers + + +Instruction = list[int] + + +class Example(NamedTuple): + before: list[int] + data: Instruction + after: list[int] + + +def solve(input: str) -> int: + def parse_example(input: list[str]) -> Example: + before = input[0].removeprefix("Before: [").removesuffix("]") + data = input[1] + after = input[2].removeprefix("After: [").removesuffix("]") + return Example( + [int(n) for n in before.split(", ")], + [int(n) for n in data.split()], + [int(n) for n in after.split(", ")], + ) + + def parse_examples(input: str) -> list[Example]: + return [parse_example(example.splitlines()) for example in input.split("\n\n")] + + def parse_data(input: list[str]) -> list[Instruction]: + return [[int(n) for n in line.split()] for line in input] + + def parse(input: str) -> tuple[list[Example], list[Instruction]]: + examples, data = input.split("\n\n\n\n") + return parse_examples(examples), parse_data(data.splitlines()) + + def find_opcodes(examples: list[Example]) -> dict[int, OpCode]: + candidates: dict[int, set[OpCode]] = {n: set(OpCode) for n in range(16)} + + for example in examples: + opcode, a, b, c = example.data + candidates[opcode] &= { + op + for op in candidates[opcode] + if op.apply(example.before, a, b, c) == example.after + } + + while not all(len(ops) == 1 for ops in candidates.values()): + singles = { + n: next(iter(ops)) for n, ops in candidates.items() if len(ops) == 1 + } + for n in candidates: + if n in singles: + continue + candidates[n] -= set(singles.values()) + return {n: ops.pop() for n, ops in candidates.items()} + + def run_program(data: list[Instruction], opcodes: dict[int, OpCode]) -> list[int]: + registers = [0] * 4 + for opcode, a, b, c in data: + registers = opcodes[opcode].apply(registers, a, b, c) + return registers + + examples, data = parse(input) + opcodes = find_opcodes(examples) + registers = run_program(data, opcodes) + return registers[0] + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 69b8894c5496462d62ce04cdd85e9ab77703de45 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 30 Dec 2024 19:10:07 -0500 Subject: [PATCH 13/48] 2018: d17: ex1: add input --- 2018/d17/ex1/input | 1470 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1470 insertions(+) create mode 100644 2018/d17/ex1/input diff --git a/2018/d17/ex1/input b/2018/d17/ex1/input new file mode 100644 index 0000000..623f657 --- /dev/null +++ b/2018/d17/ex1/input @@ -0,0 +1,1470 @@ +x=581, y=396..399 +y=1491, x=566..573 +y=1470, x=599..601 +y=980, x=526..541 +y=1173, x=487..497 +y=402, x=616..623 +y=361, x=534..577 +x=461, y=1151..1163 +x=530, y=431..443 +x=426, y=976..980 +y=794, x=520..524 +y=1574, x=600..604 +x=556, y=667..677 +x=482, y=1131..1141 +x=508, y=158..169 +x=472, y=1149..1159 +y=564, x=600..619 +x=590, y=1607..1616 +y=1401, x=421..437 +x=566, y=1187..1191 +x=616, y=392..402 +x=404, y=1561..1572 +y=886, x=580..601 +x=464, y=786..795 +y=1588, x=414..417 +x=568, y=1255..1257 +x=511, y=719..741 +x=580, y=716..733 +x=553, y=409..420 +x=430, y=133..147 +y=940, x=486..498 +y=748, x=560..577 +x=546, y=139..147 +x=470, y=1202..1204 +y=304, x=465..484 +x=610, y=68..89 +x=589, y=1139..1162 +x=409, y=60..82 +x=452, y=1037..1046 +x=575, y=516..529 +x=588, y=1370..1377 +y=843, x=421..423 +y=320, x=504..515 +x=501, y=1299..1327 +y=1010, x=604..609 +x=526, y=656..668 +y=385, x=478..481 +x=481, y=763..775 +x=410, y=418..428 +x=615, y=1279..1307 +x=464, y=553..566 +x=619, y=593..603 +x=556, y=450..477 +x=525, y=116..126 +x=538, y=955..963 +y=1127, x=592..616 +y=1229, x=485..503 +x=474, y=270..282 +y=1295, x=408..420 +y=1297, x=465..492 +x=550, y=500..519 +y=1148, x=572..574 +x=450, y=575..587 +y=590, x=552..567 +x=516, y=385..394 +x=594, y=1042..1048 +x=595, y=794..806 +x=418, y=1093..1096 +y=968, x=471..494 +x=623, y=856..874 +x=447, y=208..217 +x=444, y=578..590 +x=465, y=683..694 +x=566, y=1468..1491 +y=83, x=600..603 +x=416, y=1435..1451 +y=187, x=620..626 +y=932, x=561..571 +y=775, x=481..486 +y=1329, x=537..549 +x=511, y=98..107 +x=471, y=83..101 +x=553, y=80..108 +x=462, y=743..753 +x=485, y=8..22 +x=551, y=1034..1038 +y=1490, x=618..626 +y=408, x=479..502 +y=1083, x=443..465 +x=515, y=311..320 +x=609, y=1140..1162 +x=519, y=207..210 +x=483, y=1425..1436 +y=240, x=404..407 +x=450, y=974..987 +x=409, y=332..343 +x=498, y=1431..1433 +x=431, y=1458..1471 +x=576, y=1076..1099 +x=594, y=1586..1599 +x=613, y=90..107 +x=417, y=1500..1510 +y=1357, x=600..612 +y=1048, x=405..420 +x=475, y=84..101 +x=579, y=368..380 +y=236, x=594..605 +x=605, y=1590..1596 +x=577, y=1532..1540 +x=432, y=201..218 +y=56, x=498..500 +y=1590, x=603..605 +x=531, y=1508..1512 +x=437, y=333..343 +y=1431, x=498..502 +x=565, y=499..519 +x=404, y=153..163 +y=1099, x=576..586 +x=558, y=1185..1195 +y=477, x=556..565 +x=623, y=1552..1563 +x=430, y=59..83 +y=849, x=421..423 +y=987, x=450..472 +x=408, y=805..818 +x=593, y=250..264 +y=561, x=608..613 +x=584, y=1608..1616 +x=485, y=1321..1330 +x=616, y=1235..1242 +x=480, y=417..428 +x=435, y=976..980 +x=565, y=449..477 +x=428, y=1587..1608 +y=39, x=508..512 +y=967, x=432..458 +x=404, y=572..592 +x=579, y=1199..1218 +x=622, y=729..741 +y=322, x=554..600 +x=525, y=1373..1394 +y=480, x=607..616 +x=524, y=1340..1345 +y=581, x=589..591 +y=679, x=448..464 +y=809, x=451..453 +y=963, x=538..543 +y=1593, x=483..498 +x=457, y=396..404 +x=610, y=1019..1042 +x=496, y=419..433 +x=476, y=117..127 +x=437, y=1385..1401 +x=490, y=517..529 +x=581, y=1311..1332 +x=575, y=636..648 +y=292, x=571..576 +x=568, y=960..965 +y=1151, x=544..547 +x=616, y=469..480 +x=413, y=1412..1415 +x=511, y=516..518 +x=603, y=495..518 +y=210, x=519..537 +y=157, x=416..420 +y=795, x=445..464 +x=570, y=366..377 +y=1513, x=405..423 +x=434, y=268..283 +y=999, x=426..436 +y=592, x=404..421 +x=572, y=1102..1107 +y=599, x=606..609 +y=749, x=452..454 +y=376, x=442..453 +y=1125, x=419..426 +x=520, y=769..794 +x=501, y=624..639 +x=613, y=31..52 +x=432, y=749..761 +x=411, y=769..788 +x=550, y=838..840 +y=315, x=417..438 +y=1610, x=413..415 +y=454, x=502..518 +y=1162, x=589..609 +x=525, y=1097..1109 +y=402, x=566..592 +x=449, y=208..217 +y=107, x=494..511 +x=420, y=525..550 +x=430, y=238..253 +x=489, y=1445..1450 +x=557, y=1284..1290 +x=604, y=1559..1574 +x=502, y=395..408 +x=469, y=376..388 +x=458, y=40..65 +y=1120, x=601..606 +y=135, x=418..421 +y=22, x=485..501 +y=514, x=444..464 +x=517, y=624..639 +x=548, y=301..322 +x=501, y=1586..1589 +x=493, y=459..470 +x=421, y=681..696 +x=423, y=1502..1513 +x=615, y=625..636 +x=465, y=1284..1297 +x=501, y=9..22 +x=625, y=766..771 +y=1247, x=482..484 +x=503, y=1215..1229 +x=586, y=1077..1099 +y=1422, x=580..582 +x=592, y=1111..1127 +x=501, y=115..126 +y=1059, x=585..589 +y=868, x=506..511 +x=488, y=332..345 +x=496, y=732..736 +y=42, x=501..519 +y=245, x=446..449 +y=73, x=551..568 +x=415, y=1539..1550 +x=456, y=302..304 +x=545, y=158..169 +x=481, y=383..385 +y=1327, x=501..506 +x=439, y=1016..1029 +x=432, y=1518..1525 +x=430, y=1540..1550 +x=507, y=1442..1451 +y=628, x=435..437 +x=598, y=1399..1413 +x=617, y=1020..1042 +x=416, y=1138..1149 +y=1235, x=452..455 +y=1165, x=428..455 +x=609, y=128..154 +x=583, y=952..958 +y=1538, x=598..612 +x=512, y=1223..1229 +x=478, y=848..860 +x=484, y=518..529 +x=421, y=278..291 +x=475, y=803..813 +y=860, x=478..480 +y=867, x=447..452 +x=581, y=1567..1589 +x=508, y=1143..1164 +x=461, y=162..166 +x=458, y=1091..1103 +x=485, y=1197..1208 +y=1040, x=461..463 +x=496, y=118..127 +x=572, y=1141..1148 +y=1023, x=550..560 +y=1124, x=601..606 +x=468, y=488..494 +y=1589, x=501..524 +x=617, y=984..987 +y=1029, x=439..459 +y=947, x=426..443 +x=408, y=132..147 +x=590, y=1000..1013 +x=563, y=1570..1582 +y=816, x=464..481 +x=447, y=855..867 +y=121, x=484..487 +x=442, y=1521..1531 +y=1242, x=612..616 +y=1514, x=574..578 +x=500, y=1257..1285 +x=577, y=541..544 +y=19, x=490..493 +x=517, y=1047..1057 +x=577, y=1446..1462 +x=418, y=135..140 +y=1197, x=508..511 +x=460, y=1612..1626 +y=282, x=474..562 +x=452, y=855..867 +x=560, y=947..953 +x=582, y=1411..1422 +x=476, y=1202..1204 +x=466, y=1621..1623 +x=555, y=1478..1504 +x=556, y=1331..1348 +x=405, y=1503..1513 +x=502, y=440..454 +x=510, y=1293..1295 +x=606, y=591..599 +x=588, y=1312..1332 +y=792, x=420..441 +x=521, y=825..846 +y=1287, x=579..597 +x=585, y=1054..1059 +y=1572, x=586..591 +x=413, y=805..818 +x=485, y=206..218 +y=148, x=601..603 +y=179, x=554..567 +y=127, x=476..496 +x=573, y=412..415 +y=1332, x=581..588 +x=585, y=1166..1177 +x=433, y=642..651 +x=554, y=154..179 +x=626, y=164..187 +x=420, y=659..668 +x=455, y=442..452 +x=567, y=1602..1628 +x=502, y=95..104 +x=498, y=562..588 +y=625, x=587..612 +y=1080, x=453..456 +x=521, y=1504..1522 +x=422, y=981..985 +x=609, y=1553..1563 +x=472, y=702..711 +x=607, y=1455..1483 +x=443, y=935..947 +x=449, y=1112..1123 +x=568, y=366..377 +x=444, y=989..1007 +y=1379, x=450..489 +x=581, y=896..915 +x=563, y=1187..1191 +x=574, y=1512..1514 +x=424, y=1542..1545 +y=1191, x=563..566 +x=609, y=591..599 +y=1007, x=604..609 +x=449, y=49..68 +x=472, y=1173..1186 +x=473, y=1305..1315 +x=606, y=537..547 +x=545, y=1543..1550 +x=573, y=964..986 +y=616, x=503..525 +y=1232, x=418..436 +x=471, y=803..813 +x=557, y=513..516 +x=547, y=1144..1151 +x=484, y=1245..1247 +x=543, y=954..963 +x=439, y=303..304 +y=607, x=563..571 +y=1446, x=431..447 +y=1234, x=506..508 +x=449, y=243..245 +x=504, y=95..104 +x=616, y=1110..1127 +x=524, y=918..933 +x=552, y=1496..1502 +y=566, x=464..484 +y=1512, x=529..531 +y=1599, x=594..611 +x=421, y=573..592 +x=471, y=953..968 +x=586, y=494..505 +y=1510, x=415..417 +x=444, y=504..514 +x=467, y=1466..1469 +x=404, y=1603..1616 +x=616, y=270..278 +x=479, y=395..408 +x=528, y=1124..1128 +x=462, y=723..735 +x=609, y=1509..1521 +y=1096, x=412..418 +y=818, x=408..413 +x=567, y=860..887 +x=419, y=1115..1125 +x=564, y=789..817 +y=846, x=515..521 +x=563, y=826..837 +y=470, x=470..493 +x=436, y=748..761 +x=524, y=1585..1589 +y=1358, x=424..450 +x=414, y=1583..1588 +y=1195, x=558..573 +y=283, x=434..458 +y=363, x=423..431 +y=364, x=486..493 +x=612, y=767..771 +y=107, x=613..620 +x=594, y=659..672 +x=603, y=148..151 +x=582, y=920..945 +x=548, y=982..1006 +x=547, y=1602..1628 +x=624, y=953..973 +x=612, y=1235..1242 +x=508, y=1191..1197 +x=559, y=513..516 +x=599, y=861..867 +y=550, x=407..420 +y=140, x=418..421 +x=422, y=1455..1465 +y=1257, x=565..568 +x=586, y=1498..1518 +y=259, x=553..574 +y=986, x=573..575 +x=457, y=870..884 +y=159, x=416..420 +y=648, x=575..600 +x=425, y=1580..1594 +x=423, y=1520..1531 +x=478, y=1571..1574 +y=544, x=483..577 +x=603, y=1040..1062 +x=428, y=419..428 +y=264, x=593..608 +y=1005, x=464..466 +y=587, x=450..452 +y=1471, x=415..431 +x=495, y=399..404 +x=485, y=1216..1229 +y=90, x=491..509 +x=438, y=313..315 +x=469, y=420..432 +y=488, x=461..468 +x=494, y=287..303 +x=456, y=1481..1507 +x=490, y=6..19 +y=241, x=610..624 +y=497, x=452..478 +y=668, x=507..526 +x=428, y=1141..1165 +y=608, x=429..475 +x=594, y=517..529 +y=192, x=581..604 +x=533, y=32..56 +x=421, y=1604..1616 +y=513, x=557..559 +x=568, y=67..73 +x=475, y=726..732 +x=515, y=824..846 +x=430, y=909..925 +y=1260, x=594..604 +y=415, x=570..573 +x=602, y=1400..1413 +y=1315, x=471..473 +x=594, y=1236..1260 +x=548, y=104..116 +y=1616, x=404..421 +x=404, y=768..788 +y=197, x=419..422 +x=556, y=1568..1589 +y=65, x=458..468 +x=512, y=27..39 +x=582, y=830..834 +x=461, y=1040..1043 +x=424, y=493..495 +y=741, x=511..539 +x=615, y=730..741 +x=574, y=1141..1148 +y=90, x=438..455 +x=562, y=1453..1471 +x=534, y=1166..1170 +x=616, y=925..942 +x=584, y=1356..1365 +y=1525, x=432..434 +y=1563, x=609..623 +x=440, y=1384..1388 +y=505, x=568..586 +x=521, y=1257..1285 +y=1163, x=461..478 +x=564, y=80..108 +x=547, y=1341..1345 +y=1170, x=532..534 +x=600, y=310..322 +x=423, y=353..363 +x=579, y=1283..1287 +y=462, x=580..606 +x=624, y=1072..1087 +x=447, y=877..880 +x=424, y=1455..1465 +y=798, x=609..620 +x=494, y=1323..1335 +y=1013, x=590..617 +y=484, x=578..597 +x=501, y=354..368 +x=587, y=717..733 +x=463, y=1196..1208 +x=411, y=1043..1045 +y=1318, x=463..480 +x=449, y=398..408 +x=415, y=249..257 +y=475, x=441..463 +x=556, y=138..147 +x=429, y=661..671 +x=439, y=810..828 +x=508, y=1425..1436 +y=1469, x=467..480 +x=412, y=662..671 +y=965, x=550..568 +x=456, y=1298..1315 +x=562, y=287..301 +x=490, y=1558..1573 +x=512, y=288..303 +y=462, x=619..625 +x=429, y=598..608 +x=436, y=1223..1232 +y=590, x=444..464 +x=478, y=383..385 +x=417, y=313..315 +x=557, y=1205..1218 +x=467, y=162..166 +y=1231, x=544..565 +x=537, y=1187..1201 +x=586, y=1556..1572 +x=617, y=1001..1013 +x=432, y=1306..1320 +x=447, y=1172..1186 +x=461, y=488..494 +x=473, y=1572..1574 +x=575, y=963..986 +y=562, x=470..474 +x=557, y=31..56 +y=519, x=550..565 +y=636, x=615..620 +x=501, y=75..82 +x=416, y=157..159 +x=611, y=1184..1187 +x=571, y=177..197 +x=580, y=1137..1152 +x=571, y=292..297 +x=608, y=1183..1187 +x=469, y=1097..1100 +y=299, x=502..505 +x=581, y=1041..1048 +x=614, y=853..862 +y=753, x=442..462 +y=927, x=443..477 +y=1394, x=513..525 +x=600, y=14..24 +y=1372, x=437..440 +y=1335, x=475..494 +x=493, y=31..41 +y=1413, x=598..602 +y=874, x=529..541 +y=1152, x=553..580 +x=439, y=1430..1440 +x=554, y=1204..1218 +x=490, y=563..588 +y=925, x=409..430 +x=477, y=1239..1252 +x=534, y=465..476 +y=138, x=578..581 +x=477, y=1260..1274 +x=468, y=41..65 +x=605, y=222..236 +x=509, y=628..634 +x=472, y=785..787 +x=485, y=462..466 +x=575, y=947..953 +x=574, y=560..575 +x=534, y=1077..1081 +x=554, y=860..887 +y=813, x=471..475 +y=1141, x=463..482 +y=1064, x=464..487 +x=519, y=29..42 +x=480, y=1465..1469 +x=522, y=1552..1580 +x=526, y=263..267 +x=454, y=666..670 +y=837, x=563..589 +y=987, x=614..617 +y=639, x=501..517 +x=420, y=1268..1295 +y=1580, x=503..522 +x=464, y=577..590 +x=578, y=472..484 +x=511, y=1276..1278 +y=863, x=470..486 +x=444, y=1297..1315 +y=1177, x=585..592 +x=440, y=183..189 +y=1507, x=456..466 +x=601, y=700..719 +x=494, y=733..736 +x=442, y=200..218 +x=491, y=181..193 +y=1502, x=548..552 +y=1218, x=554..557 +y=1218, x=579..605 +x=502, y=294..299 +y=523, x=502..517 +x=558, y=1069..1084 +y=495, x=422..424 +x=507, y=54..67 +x=435, y=119..125 +x=587, y=611..625 +y=301, x=562..588 +y=1465, x=422..424 +x=418, y=701..711 +y=352, x=594..615 +y=1278, x=506..511 +y=1254, x=537..540 +y=1571, x=417..444 +y=1028, x=485..487 +x=443, y=918..927 +x=559, y=1408..1419 +x=553, y=247..259 +x=433, y=1410..1422 +y=1499, x=528..540 +y=267, x=501..526 +x=544, y=329..340 +x=550, y=1077..1079 +x=610, y=229..241 +x=576, y=1360..1362 +y=394, x=516..531 +x=553, y=1138..1152 +x=458, y=956..967 +x=463, y=463..475 +x=456, y=999..1011 +x=455, y=239..253 +y=761, x=558..563 +y=147, x=546..556 +x=554, y=1332..1348 +x=494, y=1213..1222 +y=388, x=469..490 +y=584, x=511..517 +y=1204, x=470..476 +x=584, y=141..145 +x=426, y=999..1002 +x=502, y=505..523 +x=548, y=125..128 +y=1081, x=479..505 +y=165, x=582..599 +x=615, y=1261..1273 +y=218, x=472..485 +y=1285, x=500..521 +y=1628, x=547..567 +y=880, x=438..447 +x=498, y=761..767 +y=874, x=617..623 +x=593, y=793..806 +x=503, y=595..616 +x=540, y=1186..1201 +x=445, y=1481..1495 +y=1483, x=592..607 +x=589, y=1053..1059 +x=549, y=1123..1128 +x=415, y=1601..1610 +x=520, y=865..871 +x=486, y=918..940 +y=775, x=456..475 +x=565, y=1255..1257 +x=442, y=349..376 +y=304, x=439..456 +y=1395, x=453..456 +y=953, x=523..533 +x=487, y=1051..1064 +x=413, y=1043..1045 +x=585, y=1422..1438 +x=562, y=329..340 +y=1229, x=512..524 +x=608, y=250..264 +y=82, x=409..411 +x=466, y=996..1005 +y=82, x=572..584 +x=454, y=740..749 +x=470, y=460..470 +x=571, y=597..607 +x=442, y=742..753 +y=494, x=461..468 +x=453, y=1078..1080 +y=1084, x=543..558 +x=486, y=314..324 +x=420, y=637..648 +x=531, y=386..394 +x=486, y=809..831 +x=548, y=1495..1502 +y=324, x=466..486 +y=732, x=470..475 +y=147, x=408..430 +x=617, y=855..874 +x=604, y=1007..1010 +x=482, y=462..466 +y=1273, x=615..623 +y=518, x=416..427 +x=552, y=335..337 +x=580, y=1525..1532 +y=1295, x=497..510 +y=1093, x=412..418 +x=587, y=142..145 +x=469, y=875..880 +y=652, x=410..427 +y=380, x=562..579 +x=483, y=541..544 +x=537, y=207..210 +x=437, y=1365..1372 +y=1345, x=524..547 +x=426, y=934..947 +x=417, y=1196..1216 +x=505, y=1074..1081 +x=422, y=170..197 +y=1208, x=502..517 +x=611, y=1510..1521 +y=767, x=498..505 +x=567, y=8..29 +x=469, y=399..408 +x=416, y=510..518 +y=61, x=498..500 +x=619, y=815..821 +x=448, y=655..679 +x=567, y=757..779 +x=477, y=917..927 +y=672, x=594..614 +y=719, x=601..607 +x=586, y=1445..1462 +y=1103, x=458..480 +y=711, x=418..472 +x=455, y=1545..1558 +x=447, y=1254..1276 +y=340, x=544..562 +y=433, x=496..510 +x=440, y=1366..1372 +x=407, y=444..447 +y=1011, x=456..474 +x=575, y=1244..1261 +x=454, y=1195..1220 +x=517, y=506..523 +x=592, y=920..945 +x=449, y=826..840 +x=604, y=178..192 +x=619, y=1430..1456 +x=498, y=919..940 +x=563, y=755..761 +x=501, y=263..267 +x=509, y=1346..1358 +x=483, y=1347..1358 +x=451, y=806..809 +x=563, y=1102..1107 +x=460, y=643..651 +x=568, y=1544..1550 +x=413, y=872..875 +x=493, y=6..19 +x=478, y=417..428 +x=527, y=1046..1057 +x=576, y=1283..1290 +x=426, y=1273..1301 +x=474, y=998..1011 +y=1550, x=415..430 +y=1013, x=568..577 +x=541, y=864..874 +x=422, y=1542..1545 +y=67, x=491..507 +x=586, y=470..478 +y=1594, x=406..425 +x=459, y=119..125 +x=413, y=1601..1610 +y=478, x=586..590 +x=508, y=1231..1234 +x=600, y=1558..1574 +x=466, y=313..324 +x=559, y=1355..1365 +y=945, x=582..592 +x=582, y=159..165 +x=434, y=1518..1525 +x=578, y=114..138 +y=428, x=478..480 +x=536, y=999..1012 +x=528, y=1488..1499 +x=572, y=1360..1362 +x=416, y=838..865 +y=828, x=425..439 +y=1271, x=464..468 +x=476, y=870..884 +x=518, y=441..454 +x=603, y=83..85 +y=337, x=552..554 +x=478, y=1152..1163 +x=528, y=1268..1290 +x=476, y=786..787 +x=420, y=157..159 +y=1573, x=485..490 +x=580, y=1341..1343 +x=506, y=1300..1327 +x=470, y=726..732 +x=490, y=376..388 +x=464, y=656..679 +x=467, y=229..237 +y=516, x=509..511 +x=572, y=895..915 +x=525, y=1143..1164 +y=1589, x=556..581 +x=414, y=372..399 +x=530, y=1617..1626 +x=535, y=135..147 +y=1222, x=492..494 +x=561, y=927..932 +x=456, y=666..670 +y=68, x=449..453 +x=550, y=960..965 +x=463, y=1040..1043 +x=499, y=178..189 +y=1596, x=603..605 +x=555, y=981..1006 +y=1079, x=550..552 +x=472, y=207..218 +x=420, y=1027..1048 +y=563, x=449..461 +x=497, y=1294..1295 +y=1574, x=473..478 +x=478, y=483..497 +y=756, x=541..549 +y=762, x=519..530 +x=460, y=1195..1220 +x=608, y=559..561 +x=539, y=718..741 +x=469, y=1113..1123 +x=620, y=89..107 +x=447, y=1433..1446 +x=581, y=113..138 +y=831, x=486..493 +x=475, y=311..318 +x=465, y=291..304 +x=540, y=1239..1254 +x=423, y=843..849 +y=1508, x=529..531 +x=456, y=1078..1080 +x=571, y=926..932 +x=459, y=1261..1274 +x=472, y=331..345 +y=696, x=421..424 +y=980, x=426..435 +x=465, y=1070..1083 +x=452, y=740..749 +x=464, y=996..1005 +x=415, y=1500..1510 +y=603, x=600..619 +y=89, x=595..610 +x=456, y=763..775 +y=24, x=600..617 +y=1398, x=448..464 +x=511, y=566..584 +y=345, x=472..488 +y=236, x=486..565 +y=1451, x=416..422 +x=519, y=759..762 +x=494, y=953..968 +x=506, y=1231..1234 +x=513, y=1374..1394 +x=594, y=129..154 +x=423, y=659..668 +x=612, y=418..426 +y=1471, x=537..562 +y=942, x=616..625 +y=1245, x=482..484 +x=554, y=311..322 +y=1330, x=485..488 +y=1377, x=588..616 +y=128, x=548..568 +y=1621, x=497..507 +x=582, y=1526..1532 +x=581, y=179..192 +x=475, y=598..608 +y=736, x=494..496 +x=567, y=153..179 +y=1187, x=608..611 +y=52, x=588..613 +x=590, y=470..478 +x=449, y=1020..1023 +y=116, x=545..548 +x=511, y=1191..1197 +y=396, x=574..581 +x=412, y=1093..1096 +x=453, y=805..809 +x=502, y=1443..1451 +x=426, y=1115..1125 +x=471, y=1621..1623 +y=432, x=469..488 +y=1436, x=483..508 +y=127, x=535..540 +y=973, x=598..624 +x=464, y=805..816 +y=585, x=582..600 +x=480, y=1308..1318 +x=603, y=1590..1596 +x=544, y=1225..1231 +x=487, y=1165..1173 +x=437, y=1621..1631 +x=485, y=1559..1573 +x=466, y=1482..1507 +y=1042, x=610..617 +x=526, y=1241..1249 +x=428, y=59..83 +y=1315, x=444..456 +x=542, y=48..51 +x=466, y=875..880 +x=626, y=1071..1087 +y=1518, x=562..586 +y=193, x=491..508 +x=592, y=1456..1483 +y=1048, x=581..594 +x=452, y=1227..1235 +x=533, y=946..953 +y=1522, x=521..537 +y=1301, x=426..436 +y=278, x=616..625 +x=620, y=624..636 +x=574, y=247..259 +x=511, y=866..868 +x=524, y=769..794 +x=591, y=570..581 +y=1043, x=461..463 +x=421, y=135..140 +x=407, y=233..240 +y=38, x=419..444 +x=444, y=1559..1571 +x=605, y=1200..1218 +x=568, y=125..128 +x=570, y=412..415 +y=629, x=530..556 +y=1451, x=502..507 +y=1290, x=528..538 +y=243, x=446..449 +y=341, x=477..482 +y=958, x=578..583 +y=787, x=472..476 +x=452, y=1586..1608 +y=476, x=534..545 +x=505, y=762..767 +y=452, x=455..482 +y=1358, x=483..509 +x=552, y=1077..1079 +x=450, y=1330..1358 +x=614, y=984..987 +x=491, y=53..67 +y=189, x=440..450 +y=1249, x=511..526 +x=534, y=347..361 +x=606, y=1120..1124 +x=468, y=1149..1159 +x=523, y=945..953 +y=1626, x=530..544 +y=1201, x=537..540 +x=471, y=1305..1315 +x=441, y=462..475 +y=166, x=461..467 +x=560, y=1017..1023 +x=437, y=615..628 +y=493, x=422..424 +x=513, y=602..607 +y=1160, x=481..501 +y=1421, x=500..508 +y=887, x=554..567 +y=648, x=418..420 +x=592, y=389..402 +x=452, y=483..497 +y=821, x=619..626 +x=560, y=1245..1261 +x=404, y=233..240 +x=406, y=1580..1594 +x=526, y=971..980 +x=562, y=1499..1518 +x=509, y=78..90 +x=530, y=627..629 +x=438, y=876..880 +y=575, x=570..574 +y=104, x=502..504 +y=1038, x=541..551 +x=474, y=550..562 +x=600, y=573..585 +y=671, x=412..429 +x=422, y=493..495 +y=399, x=405..414 +x=463, y=1307..1318 +x=434, y=932..942 +x=484, y=292..304 +y=1320, x=424..432 +x=565, y=667..677 +x=598, y=1530..1538 +y=1123, x=449..469 +x=455, y=83..90 +x=430, y=488..498 +y=1531, x=423..442 +y=443, x=521..530 +y=1362, x=572..576 +y=830, x=579..582 +y=125, x=435..459 +x=587, y=756..779 +x=607, y=468..480 +y=237, x=467..476 +x=628, y=682..694 +x=486, y=851..863 +y=428, x=410..428 +x=541, y=754..756 +x=500, y=1397..1421 +y=1388, x=440..442 +x=481, y=355..368 +y=1540, x=562..577 +x=409, y=909..925 +x=416, y=1622..1631 +x=543, y=653..671 +x=422, y=1434..1451 +x=595, y=860..867 +x=537, y=1505..1522 +x=517, y=567..584 +y=733, x=580..587 +x=550, y=1018..1023 +x=619, y=554..564 +x=476, y=228..237 +x=566, y=390..402 +y=1623, x=466..471 +y=677, x=556..565 +y=985, x=410..422 +x=559, y=1478..1504 +y=817, x=564..587 +y=1032, x=474..493 +x=470, y=850..863 +x=493, y=808..831 +x=441, y=783..792 +x=573, y=1469..1491 +x=562, y=270..282 +x=625, y=457..462 +y=1023, x=444..449 +x=489, y=1369..1379 +y=1006, x=548..555 +x=456, y=1385..1395 +x=558, y=754..761 +x=531, y=654..671 +x=612, y=1529..1538 +y=1290, x=557..576 +y=771, x=612..625 +x=442, y=837..865 +y=1572, x=404..414 +x=408, y=1269..1295 +y=1261, x=560..575 +x=521, y=430..443 +y=671, x=531..543 +y=1012, x=519..536 +y=559, x=608..613 +x=552, y=569..590 +y=83, x=428..430 +y=651, x=433..460 +x=485, y=1016..1028 +x=484, y=552..566 +x=481, y=1159..1160 +x=424, y=1306..1320 +y=197, x=571..578 +x=549, y=914..918 +y=498, x=415..430 +x=470, y=827..840 +x=444, y=1020..1023 +y=1512, x=574..578 +x=600, y=637..648 +y=1081, x=513..534 +y=51, x=542..548 +y=145, x=584..587 +x=551, y=67..73 +x=568, y=494..505 +x=580, y=453..462 +x=486, y=362..364 +x=588, y=32..52 +x=522, y=866..871 +y=529, x=575..594 +x=623, y=391..402 +y=1307, x=615..623 +x=464, y=504..514 +x=488, y=419..432 +y=1433, x=498..502 +x=588, y=287..301 +x=579, y=410..420 +x=579, y=830..834 +x=545, y=103..116 +x=410, y=981..985 +x=464, y=894..907 +x=497, y=1606..1621 +y=442, x=566..592 +x=443, y=1069..1083 +y=56, x=533..557 +x=486, y=225..236 +y=1422, x=433..454 +y=85, x=600..603 +x=622, y=1429..1456 +x=461, y=546..563 +y=1582, x=563..572 +y=867, x=595..599 +y=1276, x=447..451 +y=880, x=466..469 +x=517, y=1183..1208 +x=507, y=1607..1621 +y=1159, x=468..472 +y=1456, x=619..622 +x=421, y=990..1007 +x=560, y=731..748 +x=597, y=1283..1287 +x=537, y=1452..1471 +x=616, y=1369..1377 +x=421, y=843..849 +x=585, y=418..426 +y=529, x=484..490 +x=417, y=1560..1571 +x=492, y=399..404 +y=942, x=432..434 +y=991, x=602..623 +x=577, y=731..748 +y=1626, x=423..427 +x=509, y=516..518 +x=425, y=811..828 +y=404, x=492..495 +x=609, y=784..798 +x=410, y=639..652 +x=449, y=545..563 +x=511, y=1242..1249 +x=421, y=444..447 +y=322, x=542..548 +x=492, y=1238..1252 +x=483, y=1579..1593 +x=508, y=1397..1421 +x=519, y=1000..1012 +x=435, y=615..628 +x=480, y=32..41 +x=601, y=1463..1470 +x=580, y=882..886 +x=594, y=341..352 +x=493, y=1019..1032 +y=788, x=404..411 +y=1450, x=468..489 +x=626, y=1480..1490 +y=862, x=608..614 +x=615, y=342..352 +x=468, y=1258..1271 +y=865, x=416..442 +x=599, y=57..64 +x=421, y=1386..1401 +y=1002, x=426..436 +x=418, y=1224..1232 +y=1415, x=413..428 +x=599, y=1041..1062 +x=468, y=1446..1450 +x=599, y=159..165 +x=479, y=1073..1081 +y=953, x=560..575 +x=542, y=301..322 +x=568, y=1004..1013 +y=217, x=447..449 +x=574, y=396..399 +x=578, y=951..958 +x=431, y=352..363 +x=589, y=825..837 +x=466, y=1219..1228 +y=779, x=567..587 +x=432, y=932..942 +x=503, y=1553..1580 +x=609, y=1007..1010 +x=600, y=83..85 +x=556, y=200..214 +x=566, y=431..442 +x=417, y=1583..1588 +x=589, y=1340..1343 +y=169, x=508..545 +x=507, y=656..668 +x=530, y=760..762 +y=64, x=599..615 +x=427, y=640..652 +x=496, y=997..1017 +x=445, y=785..795 +y=806, x=593..595 +x=549, y=1307..1329 +y=29, x=567..579 +x=540, y=1489..1499 +x=492, y=1213..1222 +x=606, y=452..462 +x=498, y=75..82 +x=443, y=617..631 +y=1626, x=460..480 +x=599, y=1463..1470 +y=377, x=568..570 +y=1057, x=517..527 +y=840, x=449..470 +y=1545, x=422..424 +x=410, y=250..257 +y=1588, x=537..545 +x=539, y=1408..1419 +x=502, y=1431..1433 +y=741, x=615..622 +y=1208, x=463..485 +y=694, x=465..628 +y=1438, x=585..612 +x=405, y=1083..1099 +y=1202, x=470..476 +y=41, x=480..493 +x=455, y=1228..1235 +y=670, x=454..456 +x=542, y=915..918 +y=218, x=432..442 +x=424, y=1331..1358 +y=447, x=407..421 +y=1495, x=423..445 +x=584, y=77..82 +x=464, y=1258..1271 +x=613, y=559..561 +x=484, y=121..124 +x=525, y=594..616 +x=405, y=371..399 +x=623, y=1262..1273 +y=1252, x=477..492 +y=408, x=449..469 +x=518, y=135..147 +y=735, x=462..481 +y=547, x=466..606 +x=419, y=171..197 +x=429, y=154..163 +x=477, y=329..341 +x=620, y=164..187 +x=506, y=1276..1278 +x=600, y=555..564 +x=436, y=1430..1440 +x=470, y=550..562 +x=506, y=628..634 +x=459, y=1017..1029 +x=406, y=895..904 +x=594, y=223..236 +x=501, y=1158..1160 +x=469, y=1036..1046 +y=291, x=421..429 +y=1045, x=411..413 +y=518, x=601..603 +x=482, y=1245..1247 +y=253, x=430..455 +y=516, x=557..559 +x=537, y=1238..1254 +y=1062, x=599..603 +y=1220, x=454..460 +x=498, y=56..61 +x=549, y=753..756 +x=543, y=1069..1084 +y=1608, x=428..452 +x=459, y=396..404 +y=1149, x=416..420 +x=475, y=762..775 +x=540, y=115..127 +x=562, y=1533..1540 +x=579, y=8..29 +y=1228, x=466..475 +x=538, y=1269..1290 +y=668, x=420..423 +x=505, y=294..299 +y=875, x=406..413 +x=576, y=292..297 +x=472, y=311..318 +x=604, y=1237..1260 +y=933, x=520..524 +y=404, x=457..459 +x=452, y=575..587 +x=556, y=627..629 +y=1550, x=545..568 +x=612, y=1421..1438 +x=573, y=1184..1195 +x=481, y=722..735 +y=1628, x=423..427 +x=431, y=1082..1099 +x=625, y=271..278 +y=1558, x=455..478 +y=1087, x=624..626 +x=415, y=488..498 +y=154, x=594..609 +x=587, y=789..817 +x=532, y=1166..1170 +x=544, y=1145..1151 +y=1100, x=467..469 +x=608, y=853..862 +x=463, y=1132..1141 +x=502, y=1182..1208 +y=147, x=518..535 +x=502, y=178..189 +y=1186, x=447..472 +x=597, y=473..484 +x=487, y=1016..1028 +x=424, y=681..696 +x=451, y=1253..1276 +x=565, y=1226..1231 +x=554, y=335..337 +y=1532, x=580..582 +x=592, y=432..442 +x=541, y=1035..1038 +x=498, y=1580..1593 +y=257, x=410..415 +y=915, x=572..581 +x=458, y=269..283 +x=626, y=814..821 +x=545, y=1573..1588 +x=429, y=278..291 +x=619, y=458..462 +y=634, x=506..509 +y=1046, x=452..469 +y=420, x=553..579 +x=614, y=660..672 +x=466, y=537..547 +y=303, x=494..512 +x=600, y=594..603 +x=423, y=1482..1495 +x=464, y=1052..1064 +x=595, y=69..89 +y=163, x=404..429 +x=625, y=924..942 +x=444, y=20..38 +y=214, x=499..556 +x=428, y=1411..1415 +x=535, y=115..127 +y=108, x=553..564 +y=918, x=542..549 +y=1077, x=550..552 +x=500, y=56..61 +x=438, y=83..90 +y=1128, x=528..549 +x=501, y=30..42 +y=1099, x=405..431 +x=491, y=77..90 +x=418, y=637..648 +x=592, y=1165..1177 +y=466, x=482..485 +x=572, y=1570..1582 +x=508, y=27..39 +x=504, y=312..320 +x=582, y=572..585 +y=1616, x=584..590 +x=487, y=121..124 +x=562, y=369..380 +x=450, y=183..189 +y=1365, x=559..584 +y=884, x=457..476 +x=453, y=48..68 +x=478, y=1545..1558 +x=482, y=442..452 +y=1440, x=436..439 +x=488, y=1321..1330 +x=580, y=1412..1422 +x=419, y=21..38 +y=761, x=432..436 +y=1097, x=467..469 +x=506, y=867..868 +x=548, y=48..51 +x=480, y=1090..1103 +y=1017, x=496..511 +x=541, y=971..980 +x=448, y=1387..1398 +x=411, y=59..82 +x=494, y=97..107 +y=1216, x=417..435 +y=907, x=464..491 +x=482, y=329..341 +x=624, y=229..241 +y=1419, x=539..559 +y=126, x=501..525 +y=607, x=513..516 +y=588, x=490..498 +x=493, y=362..364 +x=474, y=1018..1032 +x=612, y=611..625 +x=467, y=1097..1100 +y=101, x=471..475 +x=598, y=952..973 +y=124, x=484..487 +x=464, y=1388..1398 +x=570, y=560..575 +x=578, y=1512..1514 +y=1107, x=563..572 +x=405, y=1028..1048 +x=442, y=1384..1388 +x=423, y=1626..1628 +x=537, y=1573..1588 +x=480, y=848..860 +x=607, y=701..719 +x=431, y=1432..1446 +x=567, y=569..590 +x=450, y=1370..1379 +x=499, y=200..214 +x=529, y=1508..1512 +x=545, y=466..476 +x=577, y=1005..1013 +y=1463, x=599..601 +x=446, y=243..245 +x=420, y=783..792 +x=486, y=762..775 +x=601, y=148..151 +y=1348, x=554..556 +x=578, y=178..197 +y=1164, x=508..525 +y=383, x=478..481 +y=518, x=509..511 +y=368, x=481..501 +x=618, y=1481..1490 +x=591, y=1555..1572 +x=480, y=1613..1626 +x=475, y=1324..1335 +x=406, y=873..875 +x=481, y=806..816 +x=572, y=77..82 +y=1462, x=577..586 +x=497, y=1164..1173 +x=601, y=1120..1124 +x=516, y=1096..1109 +x=529, y=865..874 +x=563, y=598..607 +x=601, y=882..886 +y=1631, x=416..437 +y=343, x=409..437 +x=612, y=1344..1357 +x=427, y=510..518 +y=1274, x=459..477 +x=472, y=974..987 +x=508, y=180..193 +x=429, y=896..904 +y=871, x=520..522 +x=453, y=349..376 +x=420, y=1139..1149 +y=151, x=601..603 +x=407, y=526..550 +y=1504, x=555..559 +x=432, y=955..967 +x=602, y=980..991 +x=516, y=602..607 +x=544, y=1617..1626 +y=1343, x=580..589 +y=318, x=472..475 +x=455, y=1140..1165 +y=1007, x=421..444 +x=427, y=618..631 +y=189, x=499..502 +x=435, y=1195..1216 +x=510, y=419..433 +y=297, x=571..576 +x=453, y=1385..1395 +x=511, y=996..1017 +x=617, y=14..24 +x=414, y=1562..1572 +y=834, x=579..582 +x=524, y=1222..1229 +x=454, y=1409..1422 +x=436, y=999..1002 +x=520, y=917..933 +x=415, y=1457..1471 +x=475, y=1220..1228 +y=48, x=542..548 +x=620, y=785..798 +x=601, y=496..518 +y=1521, x=609..611 +x=537, y=839..840 +y=426, x=585..612 +y=1109, x=516..525 +x=611, y=1587..1599 +x=589, y=570..581 +x=615, y=58..64 +x=623, y=1279..1307 +y=631, x=427..443 +y=904, x=406..429 +x=577, y=348..361 +x=537, y=1307..1329 +y=840, x=537..550 +x=600, y=1344..1357 +x=427, y=1626..1628 +x=623, y=981..991 +x=565, y=225..236 +x=492, y=1284..1297 +y=82, x=498..501 +y=399, x=574..581 +x=491, y=893..907 +x=436, y=1274..1301 +x=513, y=1076..1081 From dd31b1369dece4734f30a250b79ca050e9b39723 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 30 Dec 2024 19:10:12 -0500 Subject: [PATCH 14/48] 2018: d17: ex1: add solution --- 2018/d17/ex1/ex1.py | 108 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100755 2018/d17/ex1/ex1.py diff --git a/2018/d17/ex1/ex1.py b/2018/d17/ex1/ex1.py new file mode 100755 index 0000000..b4a507b --- /dev/null +++ b/2018/d17/ex1/ex1.py @@ -0,0 +1,108 @@ +#!/usr/bin/env python + +import enum +import itertools +import sys +from collections.abc import Iterator +from typing import NamedTuple + + +class Point(NamedTuple): + x: int + y: int + + +class Direction(enum.Enum): + DOWN = Point(0, 1) + LEFT = Point(-1, 0) + RIGHT = Point(1, 0) + + def apply(self, p: Point) -> Point: + dx, dy = self.value + return Point(p.x + dx, p.y + dy) + + +def solve(input: str) -> int: + def parse_range(input: str) -> range: + if ".." not in input: + input = input + ".." + input + start, end = map(int, input.split("..")) + return range(start, end + 1) + + def parse_line(input: str) -> Iterator[Point]: + xs, ys = sorted(input.split(", ")) + yield from map( + Point._make, + itertools.product(parse_range(xs[2:]), parse_range(ys[2:])), + ) + + def parse(input: list[str]) -> set[Point]: + return {p for line in input for p in parse_line(line)} + + def flow(clay: set[Point], source: Point) -> set[Point]: + max_y = max(p.y for p in clay) + + def helper( + source: Point, + water: set[Point], + settled: set[Point], + direction: Direction = Direction.DOWN, + ) -> bool: + # Clay is considered "settled" + if source in clay: + return True + + # We've already seen this, return early + if source in water: + return source in settled + + # Account for this new source + water.add(source) + + below = Direction.DOWN.apply(source) + if below not in clay: + if below.y <= max_y: + helper(below, water, settled) + if below not in settled: + return False + + left = Direction.LEFT.apply(source) + right = Direction.RIGHT.apply(source) + l_filled = helper(left, water, settled, Direction.LEFT) + r_filled = helper(right, water, settled, Direction.RIGHT) + + if direction == Direction.DOWN and l_filled and r_filled: + settled.add(source) + while left in water: + settled.add(left) + left = Direction.LEFT.apply(left) + while right in water: + settled.add(right) + right = Direction.RIGHT.apply(right) + return True + + return (direction == Direction.LEFT and l_filled) or ( + direction == Direction.RIGHT and r_filled + ) + + assert source not in clay # Sanity check + water: set[Point] = set() + settled: set[Point] = set() + helper(source, water, settled) + assert settled <= water # Sanity check + return water + + clay = parse(input.splitlines()) + sys.setrecursionlimit(5000) # HACK + water = flow(clay, Point(500, 0)) + min_y, max_y = min(p.y for p in clay), max(p.y for p in clay) + return sum(min_y <= p.y <= max_y for p in water) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 5ea92f305eca34655fa360f680094aa5d598dfd5 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 30 Dec 2024 19:10:18 -0500 Subject: [PATCH 15/48] 2018: d17: ex2: add input --- 2018/d17/ex2/input | 1470 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1470 insertions(+) create mode 100644 2018/d17/ex2/input diff --git a/2018/d17/ex2/input b/2018/d17/ex2/input new file mode 100644 index 0000000..623f657 --- /dev/null +++ b/2018/d17/ex2/input @@ -0,0 +1,1470 @@ +x=581, y=396..399 +y=1491, x=566..573 +y=1470, x=599..601 +y=980, x=526..541 +y=1173, x=487..497 +y=402, x=616..623 +y=361, x=534..577 +x=461, y=1151..1163 +x=530, y=431..443 +x=426, y=976..980 +y=794, x=520..524 +y=1574, x=600..604 +x=556, y=667..677 +x=482, y=1131..1141 +x=508, y=158..169 +x=472, y=1149..1159 +y=564, x=600..619 +x=590, y=1607..1616 +y=1401, x=421..437 +x=566, y=1187..1191 +x=616, y=392..402 +x=404, y=1561..1572 +y=886, x=580..601 +x=464, y=786..795 +y=1588, x=414..417 +x=568, y=1255..1257 +x=511, y=719..741 +x=580, y=716..733 +x=553, y=409..420 +x=430, y=133..147 +y=940, x=486..498 +y=748, x=560..577 +x=546, y=139..147 +x=470, y=1202..1204 +y=304, x=465..484 +x=610, y=68..89 +x=589, y=1139..1162 +x=409, y=60..82 +x=452, y=1037..1046 +x=575, y=516..529 +x=588, y=1370..1377 +y=843, x=421..423 +y=320, x=504..515 +x=501, y=1299..1327 +y=1010, x=604..609 +x=526, y=656..668 +y=385, x=478..481 +x=481, y=763..775 +x=410, y=418..428 +x=615, y=1279..1307 +x=464, y=553..566 +x=619, y=593..603 +x=556, y=450..477 +x=525, y=116..126 +x=538, y=955..963 +y=1127, x=592..616 +y=1229, x=485..503 +x=474, y=270..282 +y=1295, x=408..420 +y=1297, x=465..492 +x=550, y=500..519 +y=1148, x=572..574 +x=450, y=575..587 +y=590, x=552..567 +x=516, y=385..394 +x=594, y=1042..1048 +x=595, y=794..806 +x=418, y=1093..1096 +y=968, x=471..494 +x=623, y=856..874 +x=447, y=208..217 +x=444, y=578..590 +x=465, y=683..694 +x=566, y=1468..1491 +y=83, x=600..603 +x=416, y=1435..1451 +y=187, x=620..626 +y=932, x=561..571 +y=775, x=481..486 +y=1329, x=537..549 +x=511, y=98..107 +x=471, y=83..101 +x=553, y=80..108 +x=462, y=743..753 +x=485, y=8..22 +x=551, y=1034..1038 +y=1490, x=618..626 +y=408, x=479..502 +y=1083, x=443..465 +x=515, y=311..320 +x=609, y=1140..1162 +x=519, y=207..210 +x=483, y=1425..1436 +y=240, x=404..407 +x=450, y=974..987 +x=409, y=332..343 +x=498, y=1431..1433 +x=431, y=1458..1471 +x=576, y=1076..1099 +x=594, y=1586..1599 +x=613, y=90..107 +x=417, y=1500..1510 +y=1357, x=600..612 +y=1048, x=405..420 +x=475, y=84..101 +x=579, y=368..380 +y=236, x=594..605 +x=605, y=1590..1596 +x=577, y=1532..1540 +x=432, y=201..218 +y=56, x=498..500 +y=1590, x=603..605 +x=531, y=1508..1512 +x=437, y=333..343 +y=1431, x=498..502 +x=565, y=499..519 +x=404, y=153..163 +y=1099, x=576..586 +x=558, y=1185..1195 +y=477, x=556..565 +x=623, y=1552..1563 +x=430, y=59..83 +y=849, x=421..423 +y=987, x=450..472 +x=408, y=805..818 +x=593, y=250..264 +y=561, x=608..613 +x=584, y=1608..1616 +x=485, y=1321..1330 +x=616, y=1235..1242 +x=480, y=417..428 +x=435, y=976..980 +x=565, y=449..477 +x=428, y=1587..1608 +y=39, x=508..512 +y=967, x=432..458 +x=404, y=572..592 +x=579, y=1199..1218 +x=622, y=729..741 +y=322, x=554..600 +x=525, y=1373..1394 +y=480, x=607..616 +x=524, y=1340..1345 +y=581, x=589..591 +y=679, x=448..464 +y=809, x=451..453 +y=963, x=538..543 +y=1593, x=483..498 +x=457, y=396..404 +x=610, y=1019..1042 +x=496, y=419..433 +x=476, y=117..127 +x=437, y=1385..1401 +x=490, y=517..529 +x=581, y=1311..1332 +x=575, y=636..648 +y=292, x=571..576 +x=568, y=960..965 +y=1151, x=544..547 +x=616, y=469..480 +x=413, y=1412..1415 +x=511, y=516..518 +x=603, y=495..518 +y=210, x=519..537 +y=157, x=416..420 +y=795, x=445..464 +x=570, y=366..377 +y=1513, x=405..423 +x=434, y=268..283 +y=999, x=426..436 +y=592, x=404..421 +x=572, y=1102..1107 +y=599, x=606..609 +y=749, x=452..454 +y=376, x=442..453 +y=1125, x=419..426 +x=520, y=769..794 +x=501, y=624..639 +x=613, y=31..52 +x=432, y=749..761 +x=411, y=769..788 +x=550, y=838..840 +y=315, x=417..438 +y=1610, x=413..415 +y=454, x=502..518 +y=1162, x=589..609 +x=525, y=1097..1109 +y=402, x=566..592 +x=449, y=208..217 +y=107, x=494..511 +x=420, y=525..550 +x=430, y=238..253 +x=489, y=1445..1450 +x=557, y=1284..1290 +x=604, y=1559..1574 +x=502, y=395..408 +x=469, y=376..388 +x=458, y=40..65 +y=1120, x=601..606 +y=135, x=418..421 +y=22, x=485..501 +y=514, x=444..464 +x=517, y=624..639 +x=548, y=301..322 +x=501, y=1586..1589 +x=493, y=459..470 +x=421, y=681..696 +x=423, y=1502..1513 +x=615, y=625..636 +x=465, y=1284..1297 +x=501, y=9..22 +x=625, y=766..771 +y=1247, x=482..484 +x=503, y=1215..1229 +x=586, y=1077..1099 +y=1422, x=580..582 +x=592, y=1111..1127 +x=501, y=115..126 +y=1059, x=585..589 +y=868, x=506..511 +x=488, y=332..345 +x=496, y=732..736 +y=42, x=501..519 +y=245, x=446..449 +y=73, x=551..568 +x=415, y=1539..1550 +x=456, y=302..304 +x=545, y=158..169 +x=481, y=383..385 +y=1327, x=501..506 +x=439, y=1016..1029 +x=432, y=1518..1525 +x=430, y=1540..1550 +x=507, y=1442..1451 +y=628, x=435..437 +x=598, y=1399..1413 +x=617, y=1020..1042 +x=416, y=1138..1149 +y=1235, x=452..455 +y=1165, x=428..455 +x=609, y=128..154 +x=583, y=952..958 +y=1538, x=598..612 +x=512, y=1223..1229 +x=478, y=848..860 +x=484, y=518..529 +x=421, y=278..291 +x=475, y=803..813 +y=860, x=478..480 +y=867, x=447..452 +x=581, y=1567..1589 +x=508, y=1143..1164 +x=461, y=162..166 +x=458, y=1091..1103 +x=485, y=1197..1208 +y=1040, x=461..463 +x=496, y=118..127 +x=572, y=1141..1148 +y=1023, x=550..560 +y=1124, x=601..606 +x=468, y=488..494 +y=1589, x=501..524 +x=617, y=984..987 +y=1029, x=439..459 +y=947, x=426..443 +x=408, y=132..147 +x=590, y=1000..1013 +x=563, y=1570..1582 +y=816, x=464..481 +x=447, y=855..867 +y=121, x=484..487 +x=442, y=1521..1531 +y=1242, x=612..616 +y=1514, x=574..578 +x=500, y=1257..1285 +x=577, y=541..544 +y=19, x=490..493 +x=517, y=1047..1057 +x=577, y=1446..1462 +x=418, y=135..140 +y=1197, x=508..511 +x=460, y=1612..1626 +y=282, x=474..562 +x=452, y=855..867 +x=560, y=947..953 +x=582, y=1411..1422 +x=476, y=1202..1204 +x=466, y=1621..1623 +x=555, y=1478..1504 +x=556, y=1331..1348 +x=405, y=1503..1513 +x=502, y=440..454 +x=510, y=1293..1295 +x=606, y=591..599 +x=588, y=1312..1332 +y=792, x=420..441 +x=521, y=825..846 +y=1287, x=579..597 +x=585, y=1054..1059 +y=1572, x=586..591 +x=413, y=805..818 +x=485, y=206..218 +y=148, x=601..603 +y=179, x=554..567 +y=127, x=476..496 +x=573, y=412..415 +y=1332, x=581..588 +x=585, y=1166..1177 +x=433, y=642..651 +x=554, y=154..179 +x=626, y=164..187 +x=420, y=659..668 +x=455, y=442..452 +x=567, y=1602..1628 +x=502, y=95..104 +x=498, y=562..588 +y=625, x=587..612 +y=1080, x=453..456 +x=521, y=1504..1522 +x=422, y=981..985 +x=609, y=1553..1563 +x=472, y=702..711 +x=607, y=1455..1483 +x=443, y=935..947 +x=449, y=1112..1123 +x=568, y=366..377 +x=444, y=989..1007 +y=1379, x=450..489 +x=581, y=896..915 +x=563, y=1187..1191 +x=574, y=1512..1514 +x=424, y=1542..1545 +y=1191, x=563..566 +x=609, y=591..599 +y=1007, x=604..609 +x=449, y=49..68 +x=472, y=1173..1186 +x=473, y=1305..1315 +x=606, y=537..547 +x=545, y=1543..1550 +x=573, y=964..986 +y=616, x=503..525 +y=1232, x=418..436 +x=471, y=803..813 +x=557, y=513..516 +x=547, y=1144..1151 +x=484, y=1245..1247 +x=543, y=954..963 +x=439, y=303..304 +y=607, x=563..571 +y=1446, x=431..447 +y=1234, x=506..508 +x=449, y=243..245 +x=504, y=95..104 +x=616, y=1110..1127 +x=524, y=918..933 +x=552, y=1496..1502 +y=566, x=464..484 +y=1512, x=529..531 +y=1599, x=594..611 +x=421, y=573..592 +x=471, y=953..968 +x=586, y=494..505 +y=1510, x=415..417 +x=444, y=504..514 +x=467, y=1466..1469 +x=404, y=1603..1616 +x=616, y=270..278 +x=479, y=395..408 +x=528, y=1124..1128 +x=462, y=723..735 +x=609, y=1509..1521 +y=1096, x=412..418 +y=818, x=408..413 +x=567, y=860..887 +x=419, y=1115..1125 +x=564, y=789..817 +y=846, x=515..521 +x=563, y=826..837 +y=470, x=470..493 +x=436, y=748..761 +x=524, y=1585..1589 +y=1358, x=424..450 +x=414, y=1583..1588 +y=1195, x=558..573 +y=283, x=434..458 +y=363, x=423..431 +y=364, x=486..493 +x=612, y=767..771 +y=107, x=613..620 +x=594, y=659..672 +x=603, y=148..151 +x=582, y=920..945 +x=548, y=982..1006 +x=547, y=1602..1628 +x=624, y=953..973 +x=612, y=1235..1242 +x=508, y=1191..1197 +x=559, y=513..516 +x=599, y=861..867 +y=550, x=407..420 +y=140, x=418..421 +x=422, y=1455..1465 +y=1257, x=565..568 +x=586, y=1498..1518 +y=259, x=553..574 +y=986, x=573..575 +x=457, y=870..884 +y=159, x=416..420 +y=648, x=575..600 +x=425, y=1580..1594 +x=423, y=1520..1531 +x=478, y=1571..1574 +y=544, x=483..577 +x=603, y=1040..1062 +x=428, y=419..428 +y=264, x=593..608 +y=1005, x=464..466 +y=587, x=450..452 +y=1471, x=415..431 +x=495, y=399..404 +x=485, y=1216..1229 +y=90, x=491..509 +x=438, y=313..315 +x=469, y=420..432 +y=488, x=461..468 +x=494, y=287..303 +x=456, y=1481..1507 +x=490, y=6..19 +y=241, x=610..624 +y=497, x=452..478 +y=668, x=507..526 +x=428, y=1141..1165 +y=608, x=429..475 +x=594, y=517..529 +y=192, x=581..604 +x=533, y=32..56 +x=421, y=1604..1616 +y=513, x=557..559 +x=568, y=67..73 +x=475, y=726..732 +x=515, y=824..846 +x=430, y=909..925 +y=1260, x=594..604 +y=415, x=570..573 +x=602, y=1400..1413 +y=1315, x=471..473 +x=594, y=1236..1260 +x=548, y=104..116 +y=1616, x=404..421 +x=404, y=768..788 +y=197, x=419..422 +x=556, y=1568..1589 +y=65, x=458..468 +x=512, y=27..39 +x=582, y=830..834 +x=461, y=1040..1043 +x=424, y=493..495 +y=741, x=511..539 +x=615, y=730..741 +x=574, y=1141..1148 +y=90, x=438..455 +x=562, y=1453..1471 +x=534, y=1166..1170 +x=616, y=925..942 +x=584, y=1356..1365 +y=1525, x=432..434 +y=1563, x=609..623 +x=440, y=1384..1388 +y=505, x=568..586 +x=521, y=1257..1285 +y=1163, x=461..478 +x=564, y=80..108 +x=547, y=1341..1345 +y=1170, x=532..534 +x=600, y=310..322 +x=423, y=353..363 +x=579, y=1283..1287 +y=462, x=580..606 +x=624, y=1072..1087 +x=447, y=877..880 +x=424, y=1455..1465 +y=798, x=609..620 +x=494, y=1323..1335 +y=1013, x=590..617 +y=484, x=578..597 +x=501, y=354..368 +x=587, y=717..733 +x=463, y=1196..1208 +x=411, y=1043..1045 +y=1318, x=463..480 +x=449, y=398..408 +x=415, y=249..257 +y=475, x=441..463 +x=556, y=138..147 +x=429, y=661..671 +x=439, y=810..828 +x=508, y=1425..1436 +y=1469, x=467..480 +x=412, y=662..671 +y=965, x=550..568 +x=456, y=1298..1315 +x=562, y=287..301 +x=490, y=1558..1573 +x=512, y=288..303 +y=462, x=619..625 +x=429, y=598..608 +x=436, y=1223..1232 +y=590, x=444..464 +x=478, y=383..385 +x=417, y=313..315 +x=557, y=1205..1218 +x=467, y=162..166 +y=1231, x=544..565 +x=537, y=1187..1201 +x=586, y=1556..1572 +x=617, y=1001..1013 +x=432, y=1306..1320 +x=447, y=1172..1186 +x=461, y=488..494 +x=473, y=1572..1574 +x=575, y=963..986 +y=562, x=470..474 +x=557, y=31..56 +y=519, x=550..565 +y=636, x=615..620 +x=501, y=75..82 +x=416, y=157..159 +x=611, y=1184..1187 +x=571, y=177..197 +x=580, y=1137..1152 +x=571, y=292..297 +x=608, y=1183..1187 +x=469, y=1097..1100 +y=299, x=502..505 +x=581, y=1041..1048 +x=614, y=853..862 +y=753, x=442..462 +y=927, x=443..477 +y=1394, x=513..525 +x=600, y=14..24 +y=1372, x=437..440 +y=1335, x=475..494 +x=493, y=31..41 +y=1413, x=598..602 +y=874, x=529..541 +y=1152, x=553..580 +x=439, y=1430..1440 +x=554, y=1204..1218 +x=490, y=563..588 +y=925, x=409..430 +x=477, y=1239..1252 +x=534, y=465..476 +y=138, x=578..581 +x=477, y=1260..1274 +x=468, y=41..65 +x=605, y=222..236 +x=509, y=628..634 +x=472, y=785..787 +x=485, y=462..466 +x=575, y=947..953 +x=574, y=560..575 +x=534, y=1077..1081 +x=554, y=860..887 +y=813, x=471..475 +y=1141, x=463..482 +y=1064, x=464..487 +x=519, y=29..42 +x=480, y=1465..1469 +x=522, y=1552..1580 +x=526, y=263..267 +x=454, y=666..670 +y=837, x=563..589 +y=987, x=614..617 +y=639, x=501..517 +x=420, y=1268..1295 +y=1580, x=503..522 +x=464, y=577..590 +x=578, y=472..484 +x=511, y=1276..1278 +y=863, x=470..486 +x=444, y=1297..1315 +y=1177, x=585..592 +x=440, y=183..189 +y=1507, x=456..466 +x=601, y=700..719 +x=494, y=733..736 +x=442, y=200..218 +x=491, y=181..193 +y=1502, x=548..552 +y=1218, x=554..557 +y=1218, x=579..605 +x=502, y=294..299 +y=523, x=502..517 +x=558, y=1069..1084 +y=495, x=422..424 +x=507, y=54..67 +x=435, y=119..125 +x=587, y=611..625 +y=301, x=562..588 +y=1465, x=422..424 +x=418, y=701..711 +y=352, x=594..615 +y=1278, x=506..511 +y=1254, x=537..540 +y=1571, x=417..444 +y=1028, x=485..487 +x=443, y=918..927 +x=559, y=1408..1419 +x=553, y=247..259 +x=433, y=1410..1422 +y=1499, x=528..540 +y=267, x=501..526 +x=544, y=329..340 +x=550, y=1077..1079 +x=610, y=229..241 +x=576, y=1360..1362 +y=394, x=516..531 +x=553, y=1138..1152 +x=458, y=956..967 +x=463, y=463..475 +x=456, y=999..1011 +x=455, y=239..253 +y=761, x=558..563 +y=147, x=546..556 +x=554, y=1332..1348 +x=494, y=1213..1222 +y=388, x=469..490 +y=584, x=511..517 +y=1204, x=470..476 +x=584, y=141..145 +x=426, y=999..1002 +x=502, y=505..523 +x=548, y=125..128 +y=1081, x=479..505 +y=165, x=582..599 +x=615, y=1261..1273 +y=218, x=472..485 +y=1285, x=500..521 +y=1628, x=547..567 +y=880, x=438..447 +x=498, y=761..767 +y=874, x=617..623 +x=593, y=793..806 +x=503, y=595..616 +x=540, y=1186..1201 +x=445, y=1481..1495 +y=1483, x=592..607 +x=589, y=1053..1059 +x=549, y=1123..1128 +x=415, y=1601..1610 +x=520, y=865..871 +x=486, y=918..940 +y=775, x=456..475 +x=565, y=1255..1257 +x=442, y=349..376 +y=304, x=439..456 +y=1395, x=453..456 +y=953, x=523..533 +x=487, y=1051..1064 +x=413, y=1043..1045 +x=585, y=1422..1438 +x=562, y=329..340 +y=1229, x=512..524 +x=608, y=250..264 +y=82, x=409..411 +x=466, y=996..1005 +y=82, x=572..584 +x=454, y=740..749 +x=470, y=460..470 +x=571, y=597..607 +x=442, y=742..753 +y=494, x=461..468 +x=453, y=1078..1080 +y=1084, x=543..558 +x=486, y=314..324 +x=420, y=637..648 +x=531, y=386..394 +x=486, y=809..831 +x=548, y=1495..1502 +y=324, x=466..486 +y=732, x=470..475 +y=147, x=408..430 +x=617, y=855..874 +x=604, y=1007..1010 +x=482, y=462..466 +y=1273, x=615..623 +y=518, x=416..427 +x=552, y=335..337 +x=580, y=1525..1532 +y=1295, x=497..510 +y=1093, x=412..418 +x=587, y=142..145 +x=469, y=875..880 +y=652, x=410..427 +y=380, x=562..579 +x=483, y=541..544 +x=537, y=207..210 +x=437, y=1365..1372 +y=1345, x=524..547 +x=426, y=934..947 +x=417, y=1196..1216 +x=505, y=1074..1081 +x=422, y=170..197 +y=1208, x=502..517 +x=611, y=1510..1521 +y=767, x=498..505 +x=567, y=8..29 +x=469, y=399..408 +x=416, y=510..518 +y=61, x=498..500 +x=619, y=815..821 +x=448, y=655..679 +x=567, y=757..779 +x=477, y=917..927 +y=672, x=594..614 +y=719, x=601..607 +x=586, y=1445..1462 +y=1103, x=458..480 +y=711, x=418..472 +x=455, y=1545..1558 +x=447, y=1254..1276 +y=340, x=544..562 +y=433, x=496..510 +x=440, y=1366..1372 +x=407, y=444..447 +y=1011, x=456..474 +x=575, y=1244..1261 +x=454, y=1195..1220 +x=517, y=506..523 +x=592, y=920..945 +x=449, y=826..840 +x=604, y=178..192 +x=619, y=1430..1456 +x=498, y=919..940 +x=563, y=755..761 +x=501, y=263..267 +x=509, y=1346..1358 +x=483, y=1347..1358 +x=451, y=806..809 +x=563, y=1102..1107 +x=460, y=643..651 +x=568, y=1544..1550 +x=413, y=872..875 +x=493, y=6..19 +x=478, y=417..428 +x=527, y=1046..1057 +x=576, y=1283..1290 +x=426, y=1273..1301 +x=474, y=998..1011 +y=1550, x=415..430 +y=1013, x=568..577 +x=541, y=864..874 +x=422, y=1542..1545 +y=67, x=491..507 +x=586, y=470..478 +y=1594, x=406..425 +x=459, y=119..125 +x=413, y=1601..1610 +y=478, x=586..590 +x=508, y=1231..1234 +x=600, y=1558..1574 +x=466, y=313..324 +x=559, y=1355..1365 +y=945, x=582..592 +x=582, y=159..165 +x=434, y=1518..1525 +x=578, y=114..138 +y=428, x=478..480 +x=536, y=999..1012 +x=528, y=1488..1499 +x=572, y=1360..1362 +x=416, y=838..865 +y=828, x=425..439 +y=1271, x=464..468 +x=476, y=870..884 +x=518, y=441..454 +x=603, y=83..85 +y=337, x=552..554 +x=478, y=1152..1163 +x=528, y=1268..1290 +x=476, y=786..787 +x=420, y=157..159 +y=1573, x=485..490 +x=580, y=1341..1343 +x=506, y=1300..1327 +x=470, y=726..732 +x=490, y=376..388 +x=464, y=656..679 +x=467, y=229..237 +y=516, x=509..511 +x=572, y=895..915 +x=525, y=1143..1164 +y=1589, x=556..581 +x=414, y=372..399 +x=530, y=1617..1626 +x=535, y=135..147 +y=1222, x=492..494 +x=561, y=927..932 +x=456, y=666..670 +y=68, x=449..453 +x=550, y=960..965 +x=463, y=1040..1043 +x=499, y=178..189 +y=1596, x=603..605 +x=555, y=981..1006 +y=1079, x=550..552 +x=472, y=207..218 +x=420, y=1027..1048 +y=563, x=449..461 +x=497, y=1294..1295 +y=1574, x=473..478 +x=478, y=483..497 +y=756, x=541..549 +y=762, x=519..530 +x=460, y=1195..1220 +x=608, y=559..561 +x=539, y=718..741 +x=469, y=1113..1123 +x=620, y=89..107 +x=447, y=1433..1446 +x=581, y=113..138 +y=831, x=486..493 +x=475, y=311..318 +x=465, y=291..304 +x=540, y=1239..1254 +x=423, y=843..849 +y=1508, x=529..531 +x=456, y=1078..1080 +x=571, y=926..932 +x=459, y=1261..1274 +x=472, y=331..345 +y=696, x=421..424 +y=980, x=426..435 +x=465, y=1070..1083 +x=452, y=740..749 +x=464, y=996..1005 +x=415, y=1500..1510 +y=603, x=600..619 +y=89, x=595..610 +x=456, y=763..775 +y=24, x=600..617 +y=1398, x=448..464 +x=511, y=566..584 +y=345, x=472..488 +y=236, x=486..565 +y=1451, x=416..422 +x=519, y=759..762 +x=494, y=953..968 +x=506, y=1231..1234 +x=513, y=1374..1394 +x=594, y=129..154 +x=423, y=659..668 +x=612, y=418..426 +y=1471, x=537..562 +y=942, x=616..625 +y=1245, x=482..484 +x=554, y=311..322 +y=1330, x=485..488 +y=1377, x=588..616 +y=128, x=548..568 +y=1621, x=497..507 +x=582, y=1526..1532 +x=581, y=179..192 +x=475, y=598..608 +y=736, x=494..496 +x=567, y=153..179 +y=1187, x=608..611 +y=52, x=588..613 +x=590, y=470..478 +x=449, y=1020..1023 +y=116, x=545..548 +x=511, y=1191..1197 +y=396, x=574..581 +x=412, y=1093..1096 +x=453, y=805..809 +x=502, y=1443..1451 +x=426, y=1115..1125 +x=471, y=1621..1623 +y=432, x=469..488 +y=1436, x=483..508 +y=127, x=535..540 +y=973, x=598..624 +x=464, y=805..816 +y=585, x=582..600 +x=480, y=1308..1318 +x=603, y=1590..1596 +x=544, y=1225..1231 +x=487, y=1165..1173 +x=437, y=1621..1631 +x=485, y=1559..1573 +x=466, y=1482..1507 +y=1042, x=610..617 +x=526, y=1241..1249 +x=428, y=59..83 +y=1315, x=444..456 +x=542, y=48..51 +x=466, y=875..880 +x=626, y=1071..1087 +y=1518, x=562..586 +y=193, x=491..508 +x=592, y=1456..1483 +y=1048, x=581..594 +x=452, y=1227..1235 +x=533, y=946..953 +y=1522, x=521..537 +y=1301, x=426..436 +y=278, x=616..625 +x=620, y=624..636 +x=574, y=247..259 +x=511, y=866..868 +x=524, y=769..794 +x=591, y=570..581 +y=1043, x=461..463 +x=421, y=135..140 +x=407, y=233..240 +y=38, x=419..444 +x=444, y=1559..1571 +x=605, y=1200..1218 +x=568, y=125..128 +x=570, y=412..415 +y=629, x=530..556 +y=1451, x=502..507 +y=1290, x=528..538 +y=243, x=446..449 +y=341, x=477..482 +y=958, x=578..583 +y=787, x=472..476 +x=452, y=1586..1608 +y=476, x=534..545 +x=505, y=762..767 +y=452, x=455..482 +y=1358, x=483..509 +x=552, y=1077..1079 +x=450, y=1330..1358 +x=614, y=984..987 +x=491, y=53..67 +y=189, x=440..450 +y=1249, x=511..526 +x=534, y=347..361 +x=606, y=1120..1124 +x=468, y=1149..1159 +x=523, y=945..953 +y=1626, x=530..544 +y=1201, x=537..540 +x=471, y=1305..1315 +x=441, y=462..475 +y=166, x=461..467 +x=560, y=1017..1023 +x=437, y=615..628 +y=493, x=422..424 +x=513, y=602..607 +y=1160, x=481..501 +y=1421, x=500..508 +y=887, x=554..567 +y=648, x=418..420 +x=592, y=389..402 +x=452, y=483..497 +y=821, x=619..626 +x=560, y=1245..1261 +x=404, y=233..240 +x=406, y=1580..1594 +x=526, y=971..980 +x=562, y=1499..1518 +x=509, y=78..90 +x=530, y=627..629 +x=438, y=876..880 +y=575, x=570..574 +y=104, x=502..504 +y=1038, x=541..551 +x=474, y=550..562 +x=600, y=573..585 +y=671, x=412..429 +x=422, y=493..495 +y=399, x=405..414 +x=463, y=1307..1318 +x=434, y=932..942 +x=484, y=292..304 +y=1320, x=424..432 +x=565, y=667..677 +x=598, y=1530..1538 +y=1123, x=449..469 +x=455, y=83..90 +x=430, y=488..498 +y=1531, x=423..442 +y=443, x=521..530 +y=1362, x=572..576 +y=830, x=579..582 +y=125, x=435..459 +x=587, y=756..779 +x=607, y=468..480 +y=237, x=467..476 +x=628, y=682..694 +x=486, y=851..863 +y=428, x=410..428 +x=541, y=754..756 +x=500, y=1397..1421 +y=1388, x=440..442 +x=481, y=355..368 +y=1540, x=562..577 +x=409, y=909..925 +x=416, y=1622..1631 +x=543, y=653..671 +x=422, y=1434..1451 +x=595, y=860..867 +x=537, y=1505..1522 +x=517, y=567..584 +y=733, x=580..587 +x=550, y=1018..1023 +x=619, y=554..564 +x=476, y=228..237 +x=566, y=390..402 +y=1623, x=466..471 +y=677, x=556..565 +y=985, x=410..422 +x=559, y=1478..1504 +y=817, x=564..587 +y=1032, x=474..493 +x=470, y=850..863 +x=493, y=808..831 +x=441, y=783..792 +x=573, y=1469..1491 +x=562, y=270..282 +x=625, y=457..462 +y=1023, x=444..449 +x=489, y=1369..1379 +y=1006, x=548..555 +x=456, y=1385..1395 +x=558, y=754..761 +x=531, y=654..671 +x=612, y=1529..1538 +y=1290, x=557..576 +y=771, x=612..625 +x=442, y=837..865 +y=1572, x=404..414 +x=408, y=1269..1295 +y=1261, x=560..575 +x=521, y=430..443 +y=671, x=531..543 +y=1012, x=519..536 +y=559, x=608..613 +x=552, y=569..590 +y=83, x=428..430 +y=651, x=433..460 +x=485, y=1016..1028 +x=484, y=552..566 +x=481, y=1159..1160 +x=424, y=1306..1320 +y=197, x=571..578 +x=549, y=914..918 +y=498, x=415..430 +x=470, y=827..840 +x=444, y=1020..1023 +y=1512, x=574..578 +x=600, y=637..648 +y=1081, x=513..534 +y=51, x=542..548 +y=145, x=584..587 +x=551, y=67..73 +x=568, y=494..505 +x=580, y=453..462 +x=486, y=362..364 +x=588, y=32..52 +x=522, y=866..871 +y=529, x=575..594 +x=623, y=391..402 +y=1307, x=615..623 +x=464, y=504..514 +x=488, y=419..432 +y=1433, x=498..502 +x=588, y=287..301 +x=579, y=410..420 +x=579, y=830..834 +x=545, y=103..116 +x=410, y=981..985 +x=464, y=894..907 +x=497, y=1606..1621 +y=442, x=566..592 +x=443, y=1069..1083 +y=56, x=533..557 +x=486, y=225..236 +y=1422, x=433..454 +y=85, x=600..603 +x=622, y=1429..1456 +x=461, y=546..563 +y=1582, x=563..572 +y=867, x=595..599 +y=1276, x=447..451 +y=880, x=466..469 +x=517, y=1183..1208 +x=507, y=1607..1621 +y=1159, x=468..472 +y=1456, x=619..622 +x=421, y=990..1007 +x=560, y=731..748 +x=597, y=1283..1287 +x=537, y=1452..1471 +x=616, y=1369..1377 +x=421, y=843..849 +x=585, y=418..426 +y=529, x=484..490 +x=417, y=1560..1571 +x=492, y=399..404 +y=942, x=432..434 +y=991, x=602..623 +x=577, y=731..748 +y=1626, x=423..427 +x=509, y=516..518 +x=425, y=811..828 +y=404, x=492..495 +x=609, y=784..798 +x=410, y=639..652 +x=449, y=545..563 +x=511, y=1242..1249 +x=421, y=444..447 +y=322, x=542..548 +x=492, y=1238..1252 +x=483, y=1579..1593 +x=508, y=1397..1421 +x=519, y=1000..1012 +x=435, y=615..628 +x=480, y=32..41 +x=601, y=1463..1470 +x=580, y=882..886 +x=594, y=341..352 +x=493, y=1019..1032 +y=788, x=404..411 +y=1450, x=468..489 +x=626, y=1480..1490 +y=862, x=608..614 +x=615, y=342..352 +x=468, y=1258..1271 +y=865, x=416..442 +x=599, y=57..64 +x=421, y=1386..1401 +y=1002, x=426..436 +x=418, y=1224..1232 +y=1415, x=413..428 +x=599, y=1041..1062 +x=468, y=1446..1450 +x=599, y=159..165 +x=479, y=1073..1081 +y=953, x=560..575 +x=542, y=301..322 +x=568, y=1004..1013 +y=217, x=447..449 +x=574, y=396..399 +x=578, y=951..958 +x=431, y=352..363 +x=589, y=825..837 +x=466, y=1219..1228 +y=779, x=567..587 +x=432, y=932..942 +x=503, y=1553..1580 +x=609, y=1007..1010 +x=600, y=83..85 +x=556, y=200..214 +x=566, y=431..442 +x=417, y=1583..1588 +x=589, y=1340..1343 +y=169, x=508..545 +x=507, y=656..668 +x=530, y=760..762 +y=64, x=599..615 +x=427, y=640..652 +x=496, y=997..1017 +x=445, y=785..795 +y=806, x=593..595 +x=549, y=1307..1329 +y=29, x=567..579 +x=540, y=1489..1499 +x=492, y=1213..1222 +x=606, y=452..462 +x=498, y=75..82 +x=443, y=617..631 +y=1626, x=460..480 +x=599, y=1463..1470 +y=377, x=568..570 +y=1057, x=517..527 +y=840, x=449..470 +y=1545, x=422..424 +x=410, y=250..257 +y=1588, x=537..545 +x=539, y=1408..1419 +x=502, y=1431..1433 +y=741, x=615..622 +y=1208, x=463..485 +y=694, x=465..628 +y=1438, x=585..612 +x=405, y=1083..1099 +y=1202, x=470..476 +y=41, x=480..493 +x=455, y=1228..1235 +y=670, x=454..456 +x=542, y=915..918 +y=218, x=432..442 +x=424, y=1331..1358 +y=447, x=407..421 +y=1495, x=423..445 +x=584, y=77..82 +x=464, y=1258..1271 +x=613, y=559..561 +x=484, y=121..124 +x=525, y=594..616 +x=405, y=371..399 +x=623, y=1262..1273 +y=1252, x=477..492 +y=408, x=449..469 +x=518, y=135..147 +y=735, x=462..481 +y=547, x=466..606 +x=419, y=171..197 +x=429, y=154..163 +x=477, y=329..341 +x=620, y=164..187 +x=506, y=1276..1278 +x=600, y=555..564 +x=436, y=1430..1440 +x=470, y=550..562 +x=506, y=628..634 +x=459, y=1017..1029 +x=406, y=895..904 +x=594, y=223..236 +x=501, y=1158..1160 +x=469, y=1036..1046 +y=291, x=421..429 +y=1045, x=411..413 +y=518, x=601..603 +x=482, y=1245..1247 +y=253, x=430..455 +y=516, x=557..559 +x=537, y=1238..1254 +y=1062, x=599..603 +y=1220, x=454..460 +x=498, y=56..61 +x=549, y=753..756 +x=543, y=1069..1084 +y=1608, x=428..452 +x=459, y=396..404 +y=1149, x=416..420 +x=475, y=762..775 +x=540, y=115..127 +x=562, y=1533..1540 +x=579, y=8..29 +y=1228, x=466..475 +x=538, y=1269..1290 +y=668, x=420..423 +x=505, y=294..299 +y=875, x=406..413 +x=576, y=292..297 +x=472, y=311..318 +x=604, y=1237..1260 +y=933, x=520..524 +y=404, x=457..459 +x=452, y=575..587 +x=556, y=627..629 +y=1550, x=545..568 +x=612, y=1421..1438 +x=573, y=1184..1195 +x=481, y=722..735 +y=1628, x=423..427 +x=431, y=1082..1099 +x=625, y=271..278 +y=1558, x=455..478 +y=1087, x=624..626 +x=415, y=488..498 +y=154, x=594..609 +x=587, y=789..817 +x=532, y=1166..1170 +x=544, y=1145..1151 +y=1100, x=467..469 +x=608, y=853..862 +x=463, y=1132..1141 +x=502, y=1182..1208 +y=147, x=518..535 +x=502, y=178..189 +y=1186, x=447..472 +x=597, y=473..484 +x=487, y=1016..1028 +x=424, y=681..696 +x=451, y=1253..1276 +x=565, y=1226..1231 +x=554, y=335..337 +y=1532, x=580..582 +x=592, y=432..442 +x=541, y=1035..1038 +x=498, y=1580..1593 +y=257, x=410..415 +y=915, x=572..581 +x=458, y=269..283 +x=626, y=814..821 +x=545, y=1573..1588 +x=429, y=278..291 +x=619, y=458..462 +y=634, x=506..509 +y=1046, x=452..469 +y=420, x=553..579 +x=614, y=660..672 +x=466, y=537..547 +y=303, x=494..512 +x=600, y=594..603 +x=423, y=1482..1495 +x=464, y=1052..1064 +x=595, y=69..89 +y=163, x=404..429 +x=625, y=924..942 +x=444, y=20..38 +y=214, x=499..556 +x=428, y=1411..1415 +x=535, y=115..127 +y=108, x=553..564 +y=918, x=542..549 +y=1077, x=550..552 +x=500, y=56..61 +x=438, y=83..90 +y=1128, x=528..549 +x=501, y=30..42 +y=1099, x=405..431 +x=491, y=77..90 +x=418, y=637..648 +x=592, y=1165..1177 +y=466, x=482..485 +x=572, y=1570..1582 +x=508, y=27..39 +x=504, y=312..320 +x=582, y=572..585 +y=1616, x=584..590 +x=487, y=121..124 +x=562, y=369..380 +x=450, y=183..189 +y=1365, x=559..584 +y=884, x=457..476 +x=453, y=48..68 +x=478, y=1545..1558 +x=482, y=442..452 +y=1440, x=436..439 +x=488, y=1321..1330 +x=580, y=1412..1422 +x=419, y=21..38 +y=761, x=432..436 +y=1097, x=467..469 +x=506, y=867..868 +x=548, y=48..51 +x=480, y=1090..1103 +y=1017, x=496..511 +x=541, y=971..980 +x=448, y=1387..1398 +x=411, y=59..82 +x=494, y=97..107 +y=1216, x=417..435 +y=907, x=464..491 +x=482, y=329..341 +x=624, y=229..241 +y=1419, x=539..559 +y=126, x=501..525 +y=607, x=513..516 +y=588, x=490..498 +x=493, y=362..364 +x=474, y=1018..1032 +x=612, y=611..625 +x=467, y=1097..1100 +y=101, x=471..475 +x=598, y=952..973 +y=124, x=484..487 +x=464, y=1388..1398 +x=570, y=560..575 +x=578, y=1512..1514 +y=1107, x=563..572 +x=405, y=1028..1048 +x=442, y=1384..1388 +x=423, y=1626..1628 +x=537, y=1573..1588 +x=480, y=848..860 +x=607, y=701..719 +x=431, y=1432..1446 +x=567, y=569..590 +x=450, y=1370..1379 +x=499, y=200..214 +x=529, y=1508..1512 +x=545, y=466..476 +x=577, y=1005..1013 +y=1463, x=599..601 +x=446, y=243..245 +x=420, y=783..792 +x=486, y=762..775 +x=601, y=148..151 +y=1348, x=554..556 +x=578, y=178..197 +y=1164, x=508..525 +y=383, x=478..481 +y=518, x=509..511 +y=368, x=481..501 +x=618, y=1481..1490 +x=591, y=1555..1572 +x=480, y=1613..1626 +x=475, y=1324..1335 +x=406, y=873..875 +x=481, y=806..816 +x=572, y=77..82 +y=1462, x=577..586 +x=497, y=1164..1173 +x=601, y=1120..1124 +x=516, y=1096..1109 +x=529, y=865..874 +x=563, y=598..607 +x=601, y=882..886 +y=1631, x=416..437 +y=343, x=409..437 +x=612, y=1344..1357 +x=427, y=510..518 +y=1274, x=459..477 +x=472, y=974..987 +x=508, y=180..193 +x=429, y=896..904 +y=871, x=520..522 +x=453, y=349..376 +x=420, y=1139..1149 +y=151, x=601..603 +x=407, y=526..550 +y=1504, x=555..559 +x=432, y=955..967 +x=602, y=980..991 +x=516, y=602..607 +x=544, y=1617..1626 +y=1343, x=580..589 +y=318, x=472..475 +x=455, y=1140..1165 +y=1007, x=421..444 +x=427, y=618..631 +y=189, x=499..502 +x=435, y=1195..1216 +x=510, y=419..433 +y=297, x=571..576 +x=453, y=1385..1395 +x=511, y=996..1017 +x=617, y=14..24 +x=414, y=1562..1572 +y=834, x=579..582 +x=524, y=1222..1229 +x=454, y=1409..1422 +x=436, y=999..1002 +x=520, y=917..933 +x=415, y=1457..1471 +x=475, y=1220..1228 +y=48, x=542..548 +x=620, y=785..798 +x=601, y=496..518 +y=1521, x=609..611 +x=537, y=839..840 +y=426, x=585..612 +y=1109, x=516..525 +x=611, y=1587..1599 +x=589, y=570..581 +x=615, y=58..64 +x=623, y=1279..1307 +y=631, x=427..443 +y=904, x=406..429 +x=577, y=348..361 +x=537, y=1307..1329 +y=840, x=537..550 +x=600, y=1344..1357 +x=427, y=1626..1628 +x=623, y=981..991 +x=565, y=225..236 +x=492, y=1284..1297 +y=82, x=498..501 +y=399, x=574..581 +x=491, y=893..907 +x=436, y=1274..1301 +x=513, y=1076..1081 From f2ccb2cd5aabf60258bd137b13d3b18a150b3eb4 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 30 Dec 2024 19:10:22 -0500 Subject: [PATCH 16/48] 2018: d17: ex2: add solution --- 2018/d17/ex2/ex2.py | 107 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100755 2018/d17/ex2/ex2.py diff --git a/2018/d17/ex2/ex2.py b/2018/d17/ex2/ex2.py new file mode 100755 index 0000000..57630bc --- /dev/null +++ b/2018/d17/ex2/ex2.py @@ -0,0 +1,107 @@ +#!/usr/bin/env python + +import enum +import itertools +import sys +from collections.abc import Iterator +from typing import NamedTuple + + +class Point(NamedTuple): + x: int + y: int + + +class Direction(enum.Enum): + DOWN = Point(0, 1) + LEFT = Point(-1, 0) + RIGHT = Point(1, 0) + + def apply(self, p: Point) -> Point: + dx, dy = self.value + return Point(p.x + dx, p.y + dy) + + +def solve(input: str) -> int: + def parse_range(input: str) -> range: + if ".." not in input: + input = input + ".." + input + start, end = map(int, input.split("..")) + return range(start, end + 1) + + def parse_line(input: str) -> Iterator[Point]: + xs, ys = sorted(input.split(", ")) + yield from map( + Point._make, + itertools.product(parse_range(xs[2:]), parse_range(ys[2:])), + ) + + def parse(input: list[str]) -> set[Point]: + return {p for line in input for p in parse_line(line)} + + def flow(clay: set[Point], source: Point) -> set[Point]: + max_y = max(p.y for p in clay) + + def helper( + source: Point, + water: set[Point], + settled: set[Point], + direction: Direction = Direction.DOWN, + ) -> bool: + # Clay is considered "settled" + if source in clay: + return True + + # We've already seen this, return early + if source in water: + return source in settled + + # Account for this new source + water.add(source) + + below = Direction.DOWN.apply(source) + if below not in clay: + if below.y <= max_y: + helper(below, water, settled) + if below not in settled: + return False + + left = Direction.LEFT.apply(source) + right = Direction.RIGHT.apply(source) + l_filled = helper(left, water, settled, Direction.LEFT) + r_filled = helper(right, water, settled, Direction.RIGHT) + + if direction == Direction.DOWN and l_filled and r_filled: + settled.add(source) + while left in water: + settled.add(left) + left = Direction.LEFT.apply(left) + while right in water: + settled.add(right) + right = Direction.RIGHT.apply(right) + return True + + return (direction == Direction.LEFT and l_filled) or ( + direction == Direction.RIGHT and r_filled + ) + + assert source not in clay # Sanity check + water: set[Point] = set() + settled: set[Point] = set() + helper(source, water, settled) + assert settled <= water # Sanity check + return settled + + clay = parse(input.splitlines()) + sys.setrecursionlimit(5000) # HACK + settled = flow(clay, Point(500, 0)) + return len(settled) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From f0395b2fae108f0f2cada5fe31dcbac3086eec98 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 30 Dec 2024 19:40:58 -0500 Subject: [PATCH 17/48] 2018: d18: ex1: add input --- 2018/d18/ex1/input | 50 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 2018/d18/ex1/input diff --git a/2018/d18/ex1/input b/2018/d18/ex1/input new file mode 100644 index 0000000..98cad1f --- /dev/null +++ b/2018/d18/ex1/input @@ -0,0 +1,50 @@ +.#|#.##....#|....|.#.#.|||.#.|....||....|...|..#.. +..|#||.|#..|...|#|..#...|#...#..#..|.....||..#.|#. +#|||#..||.....||.#................|..#.##|.#...#.| +|#..#.|...##...#..#|#|#..|#.#...|....#..#...##.... +.###.........|.||#...#|.|#.||||#..|...||....#..#.. +###.|..|#|...|..||..##.....|..#.|.#.............|. +..|.|.||.#....|...|....#|.........##||..#||..|.##. +#||#|...#|..|.|.||#...#|...|#.......|...#.....|... +....||.....|.|.....#...|.......|...|..|...|......| +#......#..#|#|..|....#.|.|.#...#.#.|..#.|.....#.#. +.|#...|...........#|.#....#.#...#.|..|...|....|.|. +..||.#.|...||#|....#.#..||#..#...#|..#..|..#|..... +|..|.|..#...|.....#.|..|#.||..#|.|.||#|#..|#...##| +..|..|#......||##..|........#.|...#.|.|#.#...||..# +#.|...#.||#..|.|..|..|.#....|.||....|.|....#....#. +#||.|.#..#..|...#....##|#..#...#.#...|.#...#.....# +#.|.##.|##..#.##|##........#.|...#...|..#|.#|#|... +.|#|....|.#...#..|||.#.||..#||.||.|..#.|....|..##. +|.#.||#|.##.|.||.....#...#.#..###|.#......||#|.... +.|.#..|#||......|##..##.#|..#|.|#.|.|#......|#.|#. +#..|........|||..|###..|#..|||#.|.|.....#|..|...|# +..####||#......|#||..###.|...|....#..|.#|.||....|| +|##.......|||..........|..||.#.|#.......##...|...| +|.......#......####|#|....#....|......#.|#.###...# +#|.#.|||...|..|.....#....|...|......|#|#|......||. +...#.|......#..||||.#|.....|.|.|||.|.|.|#|.#...#.# +#.#.##.|.#|.|...|...|...#|...#.|#..|..##.|....#..| +|...#.......#....#....#.#....#.#|.|#||.|.|.|#...#. +#..|.||..|.#..|.#.....#|##.|.|....|....||.......|. +..||.#..|#|.###....#.#|..#|.#..........#...|...#|. +|#||.|.#..|....|....#.#||#.|......#..|#.#.|||||#|. +.|#.|#.##.....#.|.#.....|....|.#..#.#..|#.#.....|. +#.||.#.......|..|......|#||.|..#....#...|...|...|. +|.....#.|.....#||.....##...#.#...||.|..#........|. +||#..|.##.#...........#..|..|.|..#....|...#..||.#. +..||.##.##.|.||......#...|.#.#.#..#.#...##.#.|.#.. +.|.#......#|#||.|.#|......||.#.|.|..|....#...||... +....|.##.....|#|####.#..#..#|.....|.#.#|......|... +...#..|......#....|#.#...|...|.#.#.......#.#.##..# +.|||#.||||...|..|#||.|.#|#||..|..#..|..|..#||..... +.....|..#..|#|.||.#||.||......|||..|..#|.|##...... +.#...#|..#..|||..||.|..|.#.#.......||..|...|.|.... +.##.||..|..||.|.......#.|||.|.|..|.#.#..|.||.|#||| +.|..##|..#.#|#|....|.#.#.#|#.#|.##|........###...# +..#..|#|...#.........#.#.####..#.#..#..#||#|...#|# +#.|...|.......|.#.#..#.|#..#|#|..#..|.....|..|...| +.##.|..#.....|...#..|#..|.|.#..##.#.|..#.|..|.##.. +....|..|.|..||....|...|.....#..|.|.....|.#|......# +...##.|#..#..|.#|.##....|.#...||#|.....#...##.#|.. +.|....##.....||...#.#.....#|#...#...#|.|..#.#.#.## From c1f47d34ad28c0386ab3bfd31b1afb2771309c23 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 30 Dec 2024 19:41:08 -0500 Subject: [PATCH 18/48] 2018: d18: ex1: add solution --- 2018/d18/ex1/ex1.py | 68 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100755 2018/d18/ex1/ex1.py diff --git a/2018/d18/ex1/ex1.py b/2018/d18/ex1/ex1.py new file mode 100755 index 0000000..8e6b249 --- /dev/null +++ b/2018/d18/ex1/ex1.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python + +import enum +import itertools +import sys +from collections.abc import Iterator +from typing import NamedTuple + + +class Point(NamedTuple): + x: int + y: int + + def neighbours(self) -> Iterator["Point"]: + for dx, dy in itertools.product(range(-1, 1 + 1), repeat=2): + if dx == 0 and dy == 0: + continue + yield Point(self.x + dx, self.y + dy) + + +class Cell(enum.StrEnum): + OPEN = "." + TREE = "|" + LUMBERYARD = "#" + + +def solve(input: str) -> int: + def parse(input: list[str]) -> dict[Point, Cell]: + return { + Point(x, y): Cell(c) + for x, line in enumerate(input) + for y, c in enumerate(line) + } + + def step_cell(p: Point, grid: dict[Point, Cell]) -> Cell: + neighbours = (n for n in p.neighbours() if n in grid) + if grid[p] == Cell.OPEN: + trees = sum(grid[n] == Cell.TREE for n in neighbours) + return Cell.TREE if trees >= 3 else Cell.OPEN + if grid[p] == Cell.TREE: + lumberyards = sum(grid[n] == Cell.LUMBERYARD for n in neighbours) + return Cell.LUMBERYARD if lumberyards >= 3 else Cell.TREE + if grid[p] == Cell.LUMBERYARD: + continues = {Cell.TREE, Cell.LUMBERYARD} <= {grid[n] for n in neighbours} + return Cell.LUMBERYARD if continues else Cell.OPEN + assert False # Sanity check + + def step(grid: dict[Point, Cell]) -> dict[Point, Cell]: + res: dict[Point, Cell] = {} + for p in map(Point._make, itertools.product(range(50), repeat=2)): + res[p] = step_cell(p, grid) + return res + + grid = parse(input.splitlines()) + for _ in range(10): + grid = step(grid) + trees = sum(c == Cell.TREE for c in grid.values()) + lumberyards = sum(c == Cell.LUMBERYARD for c in grid.values()) + return trees * lumberyards + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 91cee79a22089069051e17501d8c206e07efc9b5 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 30 Dec 2024 19:41:14 -0500 Subject: [PATCH 19/48] 2018: d18: ex2: add input --- 2018/d18/ex2/input | 50 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 2018/d18/ex2/input diff --git a/2018/d18/ex2/input b/2018/d18/ex2/input new file mode 100644 index 0000000..98cad1f --- /dev/null +++ b/2018/d18/ex2/input @@ -0,0 +1,50 @@ +.#|#.##....#|....|.#.#.|||.#.|....||....|...|..#.. +..|#||.|#..|...|#|..#...|#...#..#..|.....||..#.|#. +#|||#..||.....||.#................|..#.##|.#...#.| +|#..#.|...##...#..#|#|#..|#.#...|....#..#...##.... +.###.........|.||#...#|.|#.||||#..|...||....#..#.. +###.|..|#|...|..||..##.....|..#.|.#.............|. +..|.|.||.#....|...|....#|.........##||..#||..|.##. +#||#|...#|..|.|.||#...#|...|#.......|...#.....|... +....||.....|.|.....#...|.......|...|..|...|......| +#......#..#|#|..|....#.|.|.#...#.#.|..#.|.....#.#. +.|#...|...........#|.#....#.#...#.|..|...|....|.|. +..||.#.|...||#|....#.#..||#..#...#|..#..|..#|..... +|..|.|..#...|.....#.|..|#.||..#|.|.||#|#..|#...##| +..|..|#......||##..|........#.|...#.|.|#.#...||..# +#.|...#.||#..|.|..|..|.#....|.||....|.|....#....#. +#||.|.#..#..|...#....##|#..#...#.#...|.#...#.....# +#.|.##.|##..#.##|##........#.|...#...|..#|.#|#|... +.|#|....|.#...#..|||.#.||..#||.||.|..#.|....|..##. +|.#.||#|.##.|.||.....#...#.#..###|.#......||#|.... +.|.#..|#||......|##..##.#|..#|.|#.|.|#......|#.|#. +#..|........|||..|###..|#..|||#.|.|.....#|..|...|# +..####||#......|#||..###.|...|....#..|.#|.||....|| +|##.......|||..........|..||.#.|#.......##...|...| +|.......#......####|#|....#....|......#.|#.###...# +#|.#.|||...|..|.....#....|...|......|#|#|......||. +...#.|......#..||||.#|.....|.|.|||.|.|.|#|.#...#.# +#.#.##.|.#|.|...|...|...#|...#.|#..|..##.|....#..| +|...#.......#....#....#.#....#.#|.|#||.|.|.|#...#. +#..|.||..|.#..|.#.....#|##.|.|....|....||.......|. +..||.#..|#|.###....#.#|..#|.#..........#...|...#|. +|#||.|.#..|....|....#.#||#.|......#..|#.#.|||||#|. +.|#.|#.##.....#.|.#.....|....|.#..#.#..|#.#.....|. +#.||.#.......|..|......|#||.|..#....#...|...|...|. +|.....#.|.....#||.....##...#.#...||.|..#........|. +||#..|.##.#...........#..|..|.|..#....|...#..||.#. +..||.##.##.|.||......#...|.#.#.#..#.#...##.#.|.#.. +.|.#......#|#||.|.#|......||.#.|.|..|....#...||... +....|.##.....|#|####.#..#..#|.....|.#.#|......|... +...#..|......#....|#.#...|...|.#.#.......#.#.##..# +.|||#.||||...|..|#||.|.#|#||..|..#..|..|..#||..... +.....|..#..|#|.||.#||.||......|||..|..#|.|##...... +.#...#|..#..|||..||.|..|.#.#.......||..|...|.|.... +.##.||..|..||.|.......#.|||.|.|..|.#.#..|.||.|#||| +.|..##|..#.#|#|....|.#.#.#|#.#|.##|........###...# +..#..|#|...#.........#.#.####..#.#..#..#||#|...#|# +#.|...|.......|.#.#..#.|#..#|#|..#..|.....|..|...| +.##.|..#.....|...#..|#..|.|.#..##.#.|..#.|..|.##.. +....|..|.|..||....|...|.....#..|.|.....|.#|......# +...##.|#..#..|.#|.##....|.#...||#|.....#...##.#|.. +.|....##.....||...#.#.....#|#...#...#|.|..#.#.#.## From 11b32839f402514dd4f847234f4fa79f30d2a2db Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 30 Dec 2024 19:41:27 -0500 Subject: [PATCH 20/48] 2018: d18: ex2: add solution --- 2018/d18/ex2/ex2.py | 90 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100755 2018/d18/ex2/ex2.py diff --git a/2018/d18/ex2/ex2.py b/2018/d18/ex2/ex2.py new file mode 100755 index 0000000..face0c0 --- /dev/null +++ b/2018/d18/ex2/ex2.py @@ -0,0 +1,90 @@ +#!/usr/bin/env python + +import enum +import itertools +import sys +from collections.abc import Iterator +from typing import NamedTuple + + +class Point(NamedTuple): + x: int + y: int + + def neighbours(self) -> Iterator["Point"]: + for dx, dy in itertools.product(range(-1, 1 + 1), repeat=2): + if dx == 0 and dy == 0: + continue + yield Point(self.x + dx, self.y + dy) + + +class Cell(enum.StrEnum): + OPEN = "." + TREE = "|" + LUMBERYARD = "#" + + +def solve(input: str) -> int: + def parse(input: list[str]) -> dict[Point, Cell]: + return { + Point(x, y): Cell(c) + for x, line in enumerate(input) + for y, c in enumerate(line) + } + + def step_cell(p: Point, grid: dict[Point, Cell]) -> Cell: + neighbours = (n for n in p.neighbours() if n in grid) + if grid[p] == Cell.OPEN: + trees = sum(grid[n] == Cell.TREE for n in neighbours) + return Cell.TREE if trees >= 3 else Cell.OPEN + if grid[p] == Cell.TREE: + lumberyards = sum(grid[n] == Cell.LUMBERYARD for n in neighbours) + return Cell.LUMBERYARD if lumberyards >= 3 else Cell.TREE + if grid[p] == Cell.LUMBERYARD: + continues = {Cell.TREE, Cell.LUMBERYARD} <= {grid[n] for n in neighbours} + return Cell.LUMBERYARD if continues else Cell.OPEN + assert False # Sanity check + + def step(grid: dict[Point, Cell]) -> dict[Point, Cell]: + res: dict[Point, Cell] = {} + for p in map(Point._make, itertools.product(range(50), repeat=2)): + res[p] = step_cell(p, grid) + return res + + def frozen(grid: dict[Point, Cell]) -> tuple[Cell, ...]: + return tuple(grid[p] for p in sorted(grid.keys())) + + def thawed(hashed_grid: tuple[Cell, ...]) -> dict[Point, Cell]: + return {Point(i // 50, i % 50): c for i, c in enumerate(hashed_grid)} + + def do_cycles(grid: dict[Point, Cell], end: int) -> dict[Point, Cell]: + hashed_grid = frozen(grid) + cache = {hashed_grid: 0} + t = 0 + while t < end: + hashed_grid = frozen(step(thawed(hashed_grid))) + t += 1 + if hashed_grid in cache: + previous_t = cache[hashed_grid] + cycle_length = t - previous_t + num_cycles = (end - t) // cycle_length + t += num_cycles * cycle_length + else: + cache[hashed_grid] = t + + return thawed(hashed_grid) + + grid = parse(input.splitlines()) + grid = do_cycles(grid, 1000000000) + trees = sum(c == Cell.TREE for c in grid.values()) + lumberyards = sum(c == Cell.LUMBERYARD for c in grid.values()) + return trees * lumberyards + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From aa767b9781f9808417df03eff1bdc3d465a7bc2e Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 30 Dec 2024 20:17:49 -0500 Subject: [PATCH 21/48] 2018: d19: ex1: add input --- 2018/d19/ex1/input | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 2018/d19/ex1/input diff --git a/2018/d19/ex1/input b/2018/d19/ex1/input new file mode 100644 index 0000000..4214e2c --- /dev/null +++ b/2018/d19/ex1/input @@ -0,0 +1,37 @@ +#ip 4 +addi 4 16 4 +seti 1 5 3 +seti 1 9 1 +mulr 3 1 2 +eqrr 2 5 2 +addr 2 4 4 +addi 4 1 4 +addr 3 0 0 +addi 1 1 1 +gtrr 1 5 2 +addr 4 2 4 +seti 2 9 4 +addi 3 1 3 +gtrr 3 5 2 +addr 2 4 4 +seti 1 8 4 +mulr 4 4 4 +addi 5 2 5 +mulr 5 5 5 +mulr 4 5 5 +muli 5 11 5 +addi 2 4 2 +mulr 2 4 2 +addi 2 5 2 +addr 5 2 5 +addr 4 0 4 +seti 0 9 4 +setr 4 2 2 +mulr 2 4 2 +addr 4 2 2 +mulr 4 2 2 +muli 2 14 2 +mulr 2 4 2 +addr 5 2 5 +seti 0 0 0 +seti 0 8 4 From 52a891aa57453759b96f9bd87077560f026e9d78 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 30 Dec 2024 20:17:54 -0500 Subject: [PATCH 22/48] 2018: d19: ex1: add solution --- 2018/d19/ex1/ex1.py | 98 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100755 2018/d19/ex1/ex1.py diff --git a/2018/d19/ex1/ex1.py b/2018/d19/ex1/ex1.py new file mode 100755 index 0000000..09c4a80 --- /dev/null +++ b/2018/d19/ex1/ex1.py @@ -0,0 +1,98 @@ +#!/usr/bin/env python + +import copy +import enum +import sys +from typing import NamedTuple + + +class OpCode(enum.StrEnum): + ADDR = "addr" + ADDI = "addi" + MULR = "mulr" + MULI = "muli" + BANR = "banr" + BANI = "bani" + BORR = "borr" + BORI = "bori" + SETR = "setr" + SETI = "seti" + GTIR = "gtir" + GTRI = "gtri" + GTRR = "gtrr" + EQIR = "eqir" + EQRI = "eqri" + EQRR = "eqrr" + + def apply(self, registers: list[int], a: int, b: int, c: int) -> list[int]: + registers = copy.deepcopy(registers) + if self == OpCode.ADDR: + registers[c] = registers[a] + registers[b] + if self == OpCode.ADDI: + registers[c] = registers[a] + b + if self == OpCode.MULR: + registers[c] = registers[a] * registers[b] + if self == OpCode.MULI: + registers[c] = registers[a] * b + if self == OpCode.BANR: + registers[c] = registers[a] & registers[b] + if self == OpCode.BANI: + registers[c] = registers[a] & b + if self == OpCode.BORR: + registers[c] = registers[a] | registers[b] + if self == OpCode.BORI: + registers[c] = registers[a] | b + if self == OpCode.SETR: + registers[c] = registers[a] + if self == OpCode.SETI: + registers[c] = a + if self == OpCode.GTIR: + registers[c] = a > registers[b] + if self == OpCode.GTRI: + registers[c] = registers[a] > b + if self == OpCode.GTRR: + registers[c] = registers[a] > registers[b] + if self == OpCode.EQIR: + registers[c] = a == registers[b] + if self == OpCode.EQRI: + registers[c] = registers[a] == b + if self == OpCode.EQRR: + registers[c] = registers[a] == registers[b] + return registers + + +class Instruction(NamedTuple): + op: OpCode + a: int + b: int + c: int + + def apply(self, registers: list[int]) -> list[int]: + return self.op.apply(registers, self.a, self.b, self.c) + + +def solve(input: str) -> int: + def parse_instruction(input: str) -> Instruction: + op, *values = input.split() + return Instruction(OpCode(op), *map(int, values)) + + def parse(input: list[str]) -> tuple[int, list[Instruction]]: + ip = int(input[0].removeprefix("#ip ")) + return ip, [parse_instruction(line) for line in input[1:]] + + ip_reg, instructions = parse(input.splitlines()) + registers = [0] * 6 + + while (ip := registers[ip_reg]) < len(instructions): + registers = instructions[ip].apply(registers) + registers[ip_reg] += 1 + return registers[0] + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 93b4eea6f880ffdc002b56ed67d97d911bceb8e6 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 30 Dec 2024 20:18:00 -0500 Subject: [PATCH 23/48] 2018: d19: ex2: add input --- 2018/d19/ex2/input | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 2018/d19/ex2/input diff --git a/2018/d19/ex2/input b/2018/d19/ex2/input new file mode 100644 index 0000000..4214e2c --- /dev/null +++ b/2018/d19/ex2/input @@ -0,0 +1,37 @@ +#ip 4 +addi 4 16 4 +seti 1 5 3 +seti 1 9 1 +mulr 3 1 2 +eqrr 2 5 2 +addr 2 4 4 +addi 4 1 4 +addr 3 0 0 +addi 1 1 1 +gtrr 1 5 2 +addr 4 2 4 +seti 2 9 4 +addi 3 1 3 +gtrr 3 5 2 +addr 2 4 4 +seti 1 8 4 +mulr 4 4 4 +addi 5 2 5 +mulr 5 5 5 +mulr 4 5 5 +muli 5 11 5 +addi 2 4 2 +mulr 2 4 2 +addi 2 5 2 +addr 5 2 5 +addr 4 0 4 +seti 0 9 4 +setr 4 2 2 +mulr 2 4 2 +addr 4 2 2 +mulr 4 2 2 +muli 2 14 2 +mulr 2 4 2 +addr 5 2 5 +seti 0 0 0 +seti 0 8 4 From a0e1e0e2234ea18fd305853d54186f67dfe6d9e5 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 30 Dec 2024 20:18:10 -0500 Subject: [PATCH 24/48] 2018: d19: ex2: add solution --- 2018/d19/ex2/ex2.py | 104 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100755 2018/d19/ex2/ex2.py diff --git a/2018/d19/ex2/ex2.py b/2018/d19/ex2/ex2.py new file mode 100755 index 0000000..7699f0b --- /dev/null +++ b/2018/d19/ex2/ex2.py @@ -0,0 +1,104 @@ +#!/usr/bin/env python + +import copy +import enum +import sys +from typing import NamedTuple + + +class OpCode(enum.StrEnum): + ADDR = "addr" + ADDI = "addi" + MULR = "mulr" + MULI = "muli" + BANR = "banr" + BANI = "bani" + BORR = "borr" + BORI = "bori" + SETR = "setr" + SETI = "seti" + GTIR = "gtir" + GTRI = "gtri" + GTRR = "gtrr" + EQIR = "eqir" + EQRI = "eqri" + EQRR = "eqrr" + + def apply(self, registers: list[int], a: int, b: int, c: int) -> list[int]: + registers = copy.deepcopy(registers) + if self == OpCode.ADDR: + registers[c] = registers[a] + registers[b] + if self == OpCode.ADDI: + registers[c] = registers[a] + b + if self == OpCode.MULR: + registers[c] = registers[a] * registers[b] + if self == OpCode.MULI: + registers[c] = registers[a] * b + if self == OpCode.BANR: + registers[c] = registers[a] & registers[b] + if self == OpCode.BANI: + registers[c] = registers[a] & b + if self == OpCode.BORR: + registers[c] = registers[a] | registers[b] + if self == OpCode.BORI: + registers[c] = registers[a] | b + if self == OpCode.SETR: + registers[c] = registers[a] + if self == OpCode.SETI: + registers[c] = a + if self == OpCode.GTIR: + registers[c] = a > registers[b] + if self == OpCode.GTRI: + registers[c] = registers[a] > b + if self == OpCode.GTRR: + registers[c] = registers[a] > registers[b] + if self == OpCode.EQIR: + registers[c] = a == registers[b] + if self == OpCode.EQRI: + registers[c] = registers[a] == b + if self == OpCode.EQRR: + registers[c] = registers[a] == registers[b] + return registers + + +class Instruction(NamedTuple): + op: OpCode + a: int + b: int + c: int + + def apply(self, registers: list[int]) -> list[int]: + return self.op.apply(registers, self.a, self.b, self.c) + + +def solve(input: str) -> int: + def parse_instruction(input: str) -> Instruction: + op, *values = input.split() + return Instruction(OpCode(op), *map(int, values)) + + def parse(input: list[str]) -> tuple[int, list[Instruction]]: + ip = int(input[0].removeprefix("#ip ")) + return ip, [parse_instruction(line) for line in input[1:]] + + def get_seed(ip_reg: int, instructions: list[Instruction]) -> int: + registers = [0] * 6 + registers[0] = 1 + + while (ip := registers[ip_reg]) != 1: + registers = instructions[ip].apply(registers) + registers[ip_reg] += 1 + + return max(registers) + + ip_reg, instructions = parse(input.splitlines()) + seed = get_seed(ip_reg, instructions) + return sum(i for i in range(1, seed + 1) if seed % i == 0) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From add0b47894d8dc992d49dc7463fe12f12c584def Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 30 Dec 2024 21:43:50 -0500 Subject: [PATCH 25/48] 2018: d20: ex1: add input --- 2018/d20/ex1/input | 1 + 1 file changed, 1 insertion(+) create mode 100644 2018/d20/ex1/input diff --git a/2018/d20/ex1/input b/2018/d20/ex1/input new file mode 100644 index 0000000..7be26dc --- /dev/null +++ b/2018/d20/ex1/input @@ -0,0 +1 @@ +^SESWSSSSESWWNNNNNWNENNWSWWNNWSWNWSWSESWSESENNNESEESWWSESSSSSESWWNWSWWNWSWWSESWSEENEN(W|EEEEESEESEEENNWSWNWWNEN(WNNW(S|NENWNE)|ESEEN(ENESSSW(N|SSESWSSSEESENENWWWNEENWNN(W|ENENWW(S|NEEENWNWNENNWNEENWNENNESSENNNENESENESSESESWWSSEEN(W|EEESENENENNNWNNWNWNENNNWSSWWSESSESSWSESS(WNW(NNW(WNEE(NWWNWSWWNWSWNNWNEESEE(S|NWNENEENWWWSWNWNNNNENESESWSS(WNNSSE|)EEN(NNENWWNENWNENENWNEEEENNEEEEESWWSWSESSWSEESSESSWNWNWN(E|WWNWSSSW(SEEEE(NWNWSNESES|)ESESWWNWSWS(SSWW(WSES(WWNN|SE)|NENNN(E|WS(WNNSSE|)S))|EEEESESSWW(SEESSS(WNNWESSE|)SESSENNNWNENNW(S|NNEEENNNNNWNNWNNENEESSSS(SENEESEESWSESENEESSEENEENWWW(NWNEENNNNESSEESWSEESSSEEENNWNENESSSEESWSSWWWN(EENSWW|)WSSSSENNESESSSSESWSSENENEESSSWN(N|WSWSWSSSSWWSSWWSWNWNNWNWWWNWWNWWNWSWNWWSSE(SSWWN(WNWSWNNWSSSSWWSWSSWWSSEESWSWWN(E|NNWNWSWSSSENE(NWES|)SSSESENN(W|EEEN(W|NNENEESWSSW(N|SSSWWSSENEEENNN(WSSNNE|)NNESENNNNNNN(ESSSESSSSENESENENNNNWSSSWNNNNN(EES(W|ENEESWSSSW(SESWSESSENNNENEEESWWSSSSW(NNN|WWWWNN(ESNW|)(N|WSWWSSWWNENWN(NNNN|EEE|WSW(SESSW(SSENESEEEENESESWSESWWWWNN(ESENSWNW|)WSSWSSWNWNNE(ENWWWSSSSSE(ESSWNWWWWSESEE(NWES|)ESENESSESSWNWSWNN(E|WWWWWWNWNNWSSSSWWSSWNNWNEEENWWNNNENWNNWSWSESWSSS(ENNSSW|)WNNNNWWWWNENENNESSS(W|ENNE(NNW(S|WNNWWSESWWWNENNN(EN(W|EESES(WW(N|W)|EENNNN(EESWSSSESWSSW(SSENENNEENESESWSESSSENNENWNEESE(NNWN(NEES(S|W)|WSWNWNN(NNEEWWSS|)WWS(E|W(NNWSNESS|)S))|SSW(N|SW(N|S(EENSWW|)WSW(NWWS(E|W(SSWNSENN|)NNNN(WSSNNE|)E(ESWSE|NWNE))|SES(W|ES(W|EEE))))))|NNWWSE)|WWS(WNWW(SEWN|)NWNENEEENWNEEE(SSSW(WS(WWNEWSEE|)EE|NN)|ENWNWNEESENENWWNWSWWWSW(NWNENWNENEEN(WW|NNNESSE(SSSEEEESEN(NWES|)ESSWW(SSSES(ENNN(WSNE|)E(NENE(SSWENN|)NN(WSWSNENE|)EEEENWN(WW(S(W|E)|NN)|ENNENWNNENWNN(W|EENNENWNNESEN(N|ESSESWSESSENEEN(WN(WS|EN)|ESSESEESENNWNN(WS(WNSE|)S|EEN(WW|NNNWW(W|NN)|ESSW(W|SESWSEEESE(NN|SSSSS(SWSSWNNNWWWNEENENE(NWNWWSESWWWS(WSESWSWWNWNWWNNNNWWWSWSESWW(SES(WW(SS(S|WW)|NN)|EEN(W|NE(NNWSNESS|)SSEES(W|ESEEEEEESE(NNWWWEEESS|)SSE(NEENNSSWWS|)SWWNNWNWWW(EEESESNWNWWW|))))|NNN(ENWNEN(NNE(NN|SESWSES(ENEEE(NWES|)ESWSSEEN(W|NESES(ENSW|)WSWSW(SESNWN|)NWSWNNNNW(ESSSSEWNNNNW|))|W))|WW)|W))|EE)|SS(W|S))|E)))))))))|S)|W(W(N|W)|S))|WNW(S|WWWSWWNNE(ENNSSW|)S))|N(N|E)))|SEE(S(E|WWWSS(WSW|EN))|N)))|ES(W|S)))))|WWSS(ENSW|)SSSSSE(ENWNEES(NWWSESNWNEES|)|SWWNWNWNWSWWWSEESESESSSSENNNN(NWNWESES|)ESSSSENNEESWSSEEN(W|ESSSSESSENENE(SESSWSWSESWSEENENEESSW(N|SW(SEENEEENNNENEENWNNENWWSWNWNN(EES(W|ENEES(W|SESENEESSENESENNESSSWWSSSESEESWSSWNWN(WWSSE(N|SSWSWSS(WWWWNEEENNEN(WWNENNE(SS|NNWSWSSWSWSWNWWN(EEENWNEE(S|NWN(WSWSSNNENE|)EE(S|NNN(ESSSEEE(SWSEEWWNEN|)NWWN(NN|EE)|W(SS|W|N))))|WWSWWSWSSSWS(EENNESSEEEEENWWWWNNN(WSWENE|)E(SSENE(NWES|)SEEN(E(SENSWN|)N|W)|N)|WWWNWSWWWWWWNNNWSSSWWNWSWNWWWWS(WNWSWWNNWWSESWWNWWWWWNNWSSS(EEEEE|WNWSWWNENENNWNEEENENENWNNENNWWNNNWWNWWWSSWSSEEN(W|NNESSEE(NWES|)SSWSSSWNNN(NEWS|)WSWWWN(NWNWSSESSWWN(WNNNNE(NWWSWNWWWWSWWNWNNEENWWWWNWSWWSESSWSSESENESSESWWNWSWNWN(WSWNWSWW(NENWNENESEES(WW|ENNWNE(E|NNWNWWWSW(NNEENESEEENWNW(WWWNW(SSEWNN|)NNNNNEEESESWWSESW(WNNNEWSSSE|)SEEEENWWNEEEEESWSSSES(EENWNWNEENEENEEESEESESSSWNNWWSESSSEEEN(WW|EESWSS(WNWWWS(EE|WWNENWNN(ESNW|)NNN(EE|W(NEWS|)WSW(W|SESE(NN|S(SSSW(W|S)|WW(WW|N)))|N)))|EEN(EE(EENWWWWNNENESES(EENWNWNWWWWWW(SES(ENEWSW|)W|NENWWNWNNESESENNNW(S|NEENEESWSESESESWSS(ENEENESSEESEEENWNEESSEENWNNNNNWWSWWNWWWSWNWNWS(WNNNNNESEESENNEESEENNENWNENWNEENESE(NNWNNWNNENNWSWWNENEEENWWWWWS(WWNNE(S|EENENESENNESSES(WWWW|SESSEE(NWNNNNNENEEEENNNNNWWNWNWWWSWWSESEEN(E(NWES|)ESSENESSSWWWWSWSS(SS|WNNWNNN(NWSWNWNNWSSSESEESSWSWWWS(E|SWWWSSSSWNWNNE(S|NWWNNNENWWNENWNEEENWNWNENNNWWWWSESWSEE(NNESNWSS|)SWWSWNWNENWNWSWWNNNES(EENWNNESEEENWWNWWWWWWNWSWSWNWSSWNNNWWNWWWNENNNNNNESSSSSES(W|ENNNEEEEESSENESSEENNNENWNENWWWWWSEESE(N|S(SS|WWNWWWWWWW(SS|NNNNWWNNESENNWNNESESSEESWSW(N|SSES(W|EEENNNW(NEENNEESSW(N|SS(WNSE|)ENESENESENNESESENEENWNWNNNNWNEEESENENNWWWWNWSS(WSSSWNWWWSESW(SESE(SWWNSEEN|)NN(N|ESSENE(SSEWNN|)N(W|N))|WWWNENE(S|NWNENENWWSWSWNNWSWNWNENWNWNNESESEENESESS(EENNEEEEENNNNEESSW(N|SSENENEENESEESWSWWW(NEEWWS|)WSEESS(WNWW(SEWN|)NWWWS(EE|SWWW(NEENWW|SSS(WNSE|)EENWNEE(WWSESWENWNEE|)))|ESEESWSSW(SESENEEENENWNEESSESEESSWWN(E|WSWN(NEWS|)WWSESWSWSEENESSSEEESWWSSWWNN(ESNW|)NNWWWNWWWW(SSESSENEEEN(ESSWWSW(SSSWSSWWNWNEE(S|NWNWSWNWNNEES(E(EES(W|S)|NNWNNWSWWW(N|SSE(NEEWWS|)SWSW(SW(N|SESENEE(ESWSEESEEEEENN(WSNE|)NNEN(W|NESESENEENNEENENWNWNNEN(WWW(W|SESSWN)|ENNEESWSEENEESENNENESENEENNWSWWWWNWSS(E|SWNNNNWSSWS(ESNW|)WNW(NENWNEE(NESENNNNWNWSSS(ENSW|)WSWWNNWWNEEES(S|ENNNWWS(E|WWNWSSWNNWSSWW(SW(N|SW(WNEWSE|)SEEES(ENNESEN(ESE(N|SESWS(WNNWW|ESW))|NWWWSW)|WSSE(SWWNSEEN|)N))|NENNNNNNN(WWWWWSWNWWSSWNNWSWNWWWWWSSSSEENNEN(WWSSNNEE|)ESES(WWSSENESSWS(E|WNWWS(E|W(SS|NW(N(WSWNNNWNWSWSEESS(WNWWNWWWSWSWSSWSWWNNWNNNEEEE(SWWS(ESWS|WN)|ENEEENE(S|ENN(WWWWWSWWSWS(WWNW(NNESE(NE(EE|S)|S)|SSSSSSESSSSW(SESSEENWNENENWW(S|NEEESENN(ESESSW(SWW(NEWS|)WSEESSE(SSWWWNN(NESSEWNNWS|)WSSWNNWW(SESWSESWSSEEEESSENE(SSWSESSWNWWWWSEESSWNWSSSW(NNNNNNNNNESENESSWS(WN|EEN)|SESWSSSSESESSSSWNW(NN(ESNW|)N|SSEEEEENEESSW(SWSEENESSESESSEENWNNNESES(ENNNNWNENNNWSWNNNNWSSSWSSWW(NENNWNNWNWNNNESENESSES(ENEN(EEN(W|ENEES(EENWESWW|)SSSWNN(WSWSESEESWWS(SENEENEESSESSWWN(WW(NEENSWWS|)SSSSWSW(SEENEENEEEESWWWSWSEENESESSSWWNWSSESSENEN(ESENE(NWNN(ESNW|)NNNW(S(W|SSSS)|N(E|NNNN(NEEWWS|)WSW(SS(ENSW|)WWWW(N(N|EEE)|S)|N)))|ESESSWNW(N|SSSENESESWSEESENNNNW(SS|NW(NEEE(NWW(NEEWWS|)W|EESWW(SESWSS(SSSWNWWWSWSES(ENE(NWES|)EES(S|WW)|W(SEWN|)WWWWNWWWWWWSEEEEESEESWWWWSWS(SSWWWNWSSEES(WWWNNWWNWNWWWWNWWSESESWSEEES(WWWWNNWN(WNENNNWNNNNWNWW(NENWNENWNNNNESSENNNNENNESENESEN(NWWWWNNN(E(E|SS)|WWSSE(SWW(NNN|SES(EN|SSWNN))|N))|ESSSSWNNWWSESWWW(NENSWS|)SEEESSSSSEESSWSWSWSW(SEENESEEEEEEEENWNENWWWNEEENWNNESEENESEESSWNWSSEEENNESESEEE(SSWNW(WW(WWWWWNW(NENWESWS|)SSSSWSWWN(E|WWWWWWWWSEEEES(W|ENESE(SESENEEN(EN(W|E(SSSWNSENNN|)N(E(EE|S)|W))|WWW)|N)))|N)|S)|NE(EE|S|NNWWNWWNWSW(SEESE(SENEWSWN|)N|NN(EENESE(SWEN|)N|WSW(SEWN|)NNENWNWSSSWS(W(S|WNNE(NWNNNWW(SSSSSE(NNNN|SWSWNWNWSSSW(SSSSES(EN(ESENSWNW|)NWNNE(S|EENWWN)|WWN(W|N))|NWWNNNESE(SWEN|)NN(WW|NN(NN|ESEE(NWES|)SS(WWNEWSEE|)S))))|NEENESESS(ENE(S|N(EEESNWWW|)WN(N|W))|S(WNNSSE|)SS))|S))|E)))))|NNENN(NWWS(ESWENW|)WNNNN(EEE(NWWEES|)SWS(WNSE|)E|W)|E(E|S))))|SESESWW(SEESSWSE(ENSW|)SWS(E|WNNNNE)|N))|E)|ENN(NWSWNSENES|)ESSE(SWWS|ENW))|S)|EENEEE))|ENE(ENWNSESW|)S)|W))|S))))|W)|NNNNE(NWES|)SS)|E)|WNNW(N(W|N)|SS))|N))|WWNNWN(E|WNWWSES(WWSSWWW(NENWNNEENN(ESSSW(W|SS)|N)|SS(WNNSSE|)EEN(ESSESSWNWW(SSE(N|S(WSEWNE|)EEEN(WW|E|NN))|N(E|W))|W))|E)))|W(WNWESE|)SES(S|W))|SSEEN(ESS(WWSESNWNEE|)E(ESNW|)NNN(WNSE|)E|W))|W)|N)))|N(NNWWN(WSS(EESNWW|)W(W|NN)|EE)|EE))|NN)|NEN(W|EENE(NWW(SWEN|)NNE(NWWNENWN(ENW|WSWSE)|S)|ESE(EESWWSWW(SES(W|ENE(SSWENN|)N)|N(N|E|W(S|W)))|N))))|N)|W))|NNN))|EENEENE(EE|S))|EEES(SEE(NWNE|SWSE)|WW))))|S)|EEE)|S))))|E(N|EEEN(N|ESS(WSEWNE|)ENNESSEES(W|E(NNNNWSSWNNW(ESSENNSSWNNW|)|S)))))|ESSSEEENESSEEEES(WWWW(S|WNWWS(WNSE|)E)|ES(EEEESSSEEENNNNEENWWWNEENENN(ESSS(SENNNNESSSEEENNESESENEESESEEEENNNWSWS(WNWNN(ESENEEESENEESSW(WSESSWNW(NN|SSWSSSEENESENNENNENWN(NNEEN(ESSWWSEESSW(N|SSENEESWSWWW(NN|SESSSSWSESESSSESSENEEENEEEEEESWS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E(SWEN|)EN(ESENSWNW|)W))|N))))|W))|WW(SEEWWN|)WNW(S|NNNE(NNW(S|W)|SES(W|SENNES)))))|NN)|E))|N)|N)))|E(NN|E)))|ESESWS(ESWENW|)WW(NEWS|)W))|ENESENEENENNNEN(WWSSSWNWNWNNESE(NEN(ESNW|)WWWWWWSW(N|SEEE(NWES|)S(W|SSSEN(ESEWNW|)N))|S)|ESSESSWW(N(E|N)|SEESEESE(NNNWSWN(SENESSNNWSWN|)|SSSS(EN(ESSSSES(WWWNNNESS(NNWSSSNNNESS|)|SENENWN(NW(NENWESWS|)S|EESSS(SSWNNSSENN|)EENWNEN(N|W)))|N)|WNWWS(E|WWNENNW(SWSW(SSE(SE(NEWS|)S(W|SSESSSWN(N|WSSESEEN(NN|W)))|N)|N)|NE(EESS(WN|EN)|NWW(N|WW)))))))))))|ESENN(W|E(SSSWWEENNN|)E))|E))))|N)))|NNNWWW(SSENES|WW|NEENW(NN(N(N|W)|EES(W|SS))|W)))|W)|W)|N(N|E))|N)|NN)))|WWWWSSWWNENWWSSSESESWSEEENNN(NNESSSE(E|SWSESWSEE(NESNWS|)SWSESWWWSEEESWWSS(EENWESWW|)WNWSSS(ENESNWSW|)WNNNWWWWNENEENWNNNWNE(EEESSWNWSSEE(EN(ESNW|)NN|SSW(S(EE|WW)|N))|NWWW(NENNNE(SSSENSWNNN|)NNWWS(E|SWW(NENWESWS|)SSSENENW(ESWSWNSENENW|))|SSE(SWW(N|WSEEEE(SWSWSWSESEESS(ENE(NWES|)S|WSWWNWNE(E(E|S)|NWNWNENEN(WW(NN|S)|E)))|N))|N))))|W(SS|W))))|WW)))|WW)|WSSSWSW(WSNE|)N))|N)|WWWW(SEEEWWWN|)WWWWSESW(ENWNEEWWSESW|))|E)|W)|WWWWWWWWWWWSWNWS(SSENEES(ENN(EESESEE(NEEN(WWW(S|W)|E)|SWWWNW(S(W|SEEEEESSSWNN(SSENNNSSSWNN|))|N))|W)|W)|WWN(E|WWSESW)))|W))))))|SS)|S))))|NW(N|W)))|NNNN)))|W))|N)|WWWN(W|E))|NNWNWNN(N|EES(E(NN|S(SSENEE(SWEN|)EN(WWWNSEEE|)N|W))|W))))|NN)))|W(S|WN(WSNE|)E))))|EEEE))|WS(ESWENW|)W)))))))|S)))|EES(WSEWNE|)ENE(SEEWWN|)N))|W)|ESEE(NWES|)SSWW(N(WWN(WWSW(NNENSWSS|)S(ES(WSNE|)EN(N|EE)|W)|E)|E)|S))))|E)|SEESSSWNWWN(EE|NWSSSSSESSS(ENNESSSWSSESEESSSEESSWWN(E|WNNW(N(WNSE|)E|SSSESWWWSWWNNWSWNWWW(NN(W(NWSNES|)S|ESEEEEEEESWWS(NEENWWEESWWS|))|SSS(WNSE|)ESEEEN(NWSWNWNE(WSESENSWNWNE|)|EESSENNENEESSW(WSSWSWSW(NWWNEE(N(N|WW)|E)|SSS(W|SEEEENWNENNEESWSESWSESENESSENEENESENNENNWWWWNWWW(SESE(EES(ENEWSW|)WSWNWWN(SEESENSWNWWN|)|N)|NEENWNNWSW(WSE(SWW(NN|WSSW(WSESWENWNE|)N)|E)|NNNNEEEEESESSSWSW(NWNNWN(WSNE|)EESSEN|SESEEEEENWNNWNW(NENENE(NWWNNWWWWNW(SSSEEN(W|ESE(S(E|W|S)|N))|WNENNNENNNNWSWSESWSWS(ESWSSNNENW|)WNNNE(NWNNESENNNESSEENESSSSENNNENEEE(NNWNWWN(EEESNWWW|)WNWSWWNWN(EESNWW|)WSWSEESES(ENEESS(S|EE(NWES|)E|W(WWSNEE|)N)|WWWSW(S(WS(SSSSS(W|S)|WNW(WNEWSE|)S)|E)|NN(EE|N)))|ESWSESWWNW(NEWS|)SW(N|SSE(NEEEE(SS(WNWWEESE|)S|NNNN)|SWWWN(E|W(NNN|SSSS(WNNSSE|)SEN(EES(ESSENSWNNW|)W|NN))))))|S))|SSENESEE(NWES|)SEEN(ESSWSSWSWSESSEEEESSWSSEEN(W|EEN(WWNNNWWWWNNENNESSES(ENENEWSWSW|)WW|ES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SS)|E)|EE)))|EEE))))|E)|ENEEEENNWN(EENESSWSSES(ENENNENNENWWNWS(SESWSSW(ENNENWESWSSW|)|W(NNNNWW(SEWN|)N(WSNE|)EENESESEESSW(NWSWNN|SEESENNWNNNWWNEEESSEEESWSW(NWES|)SSEEENN(WSWENE|)ESSESSSWSWWSWS(WWWWW(W|NNENEENEN(WWSWENEE|)ESES(WWS(E|SWNWSW)|ENENWW))|EEEEN(WW|EEEE(SWWWEEEN|)NNWNENWNENNWSWNNWSW(NNWNW(SSEWNN|)NNENWNNNESES(W|EENNNNWNWWWWSEES(WWWWWWNEEENNNNNNWNWNWSSESWWSSSS(SSWWNENNWWWSSWWNNNNWNN(EES(W|SS(ENENNW(NNNNNWNEEEESWSW(SSSENNEE(SWSS(ENSW|)SSW(NN|S(E|W))|N(W|EEEENNEEEENEEENWWNENNWNWNENNESSSENNE(SSSWSSE(N|SSSWSESSSSWSWSWNWSSWNNNEENNEE(SWSNEN|)NWWWN(EENWESWW|)WSSESWWSW(SSE(N|SSEEENEEE(SSSW(SSE(N|SSSSW(SESWWWS(SENEESSWN(SENNWWEESSWN|)|WN(W|NEN(ESNW|)W))|NNN))|NW(NEWS|)(S|WWWWWNN(SSEEEEWWWWNN|)))|N(W|N)))|NW(S|WN(WW|EEENWNE(WSESWWEENWNE|)))))|NNNNWWW(WWSEES(ENESSNNWSW|)WWWWSESSE(NNESNWSS|)SSSE(SWWWNWNNWNW(NWNN(NNWSSSWWN(WSS(EEE|S)|ENWNN(WNWWNWWWSSEE(NWES|)EE|E(E|S)))|ESEES(W|SE(N|SES(W|S))))|SSESWWNWSSSS(WWWWWWWS(W(NNEWSS|)SWNW(S|W)|E)|ESES(WWNSEE|)ENNWNWNEESE(EEE(SWWWEEEN|)E|N)))|N|E)|NEENNWSWNNENESE(SSS|N)))))|N)|S)|SS))|WSWW(NEWS|)SWSSENESSS(WNSE|)ESSW(N|SSENENN(NNWNENWNW(ESESWSNENWNW|)|ESSESSS(S|EENNESS(ENNENWN(EESEEN(ESSSWNWSW(N|WSEEESENE(SSWWEENN|)NNNN)|W)|WSWW(NEN(WWS|NNE)|SS))|S)))))|EEENNN(WSSWNN|N))|E(N|ES(S|W))))|SESSE(SWSES(E|WW)|N)))))|W))|WWWWW)|W(SS(W|E)|N))))|E)))|W(SSSESEESWWS(E|W(NNWWSESWW(WSNE|)NNNEENWNE(WSESWWEENWNE|)|SSSENN))|N))|N))|NWW(NN(ESNW|)W(SS|NNWNN(ESNW|)W(WWNWSNESEE|)SS)|S))))))|S)))|N)|S)|N)|N))))|NN))|WWSSE(SSS|N))|WW(NEEWWS|)SWWSWS(SWWEEN|)EENEE(N|S(W|SS)))))))|E)|N))|S)|WNN(N|W)))|N(E|N)))|NNNW(S|NEEEE(S|N(N(NNEWSS|)WSWWNE|E)))))|W))|E)|S)|S)|ENN(ESNW|)NN)))))|W)))$ From 6dbc98412eb5cbbc66935ffb86902827041a1d2d Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 30 Dec 2024 21:43:59 -0500 Subject: [PATCH 26/48] 2018: d20: ex1: add solution --- 2018/d20/ex1/ex1.py | 89 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100755 2018/d20/ex1/ex1.py diff --git a/2018/d20/ex1/ex1.py b/2018/d20/ex1/ex1.py new file mode 100755 index 0000000..d75fe38 --- /dev/null +++ b/2018/d20/ex1/ex1.py @@ -0,0 +1,89 @@ +#!/usr/bin/env python + +import collections +import copy +import enum +import sys +from typing import NamedTuple + + +class Point(NamedTuple): + x: int + y: int + + +class Direction(enum.StrEnum): + NORTH = "N" + SOUTH = "S" + WEST = "W" + EAST = "E" + + def apply(self, p: Point) -> Point: + delta: Point + match self: + case Direction.NORTH: + delta = Point(-1, 0) + case Direction.SOUTH: + delta = Point(1, 0) + case Direction.WEST: + delta = Point(0, -1) + case Direction.EAST: + delta = Point(0, 1) + return Point(p.x + delta.x, p.y + delta.y) + + +START = Point(0, 0) + + +def solve(input: str) -> int: + def to_graph(regex: str) -> dict[Point, set[Point]]: + res: dict[Point, set[Point]] = collections.defaultdict(set) + stack: list[set[Point]] = [{START}] + current_branches: set[Point] = set() + for c in regex.removeprefix("^").removesuffix("$"): + if c == "(": + stack.append(copy.deepcopy(stack[-1])) + current_branches = set() + elif c == "|": + current_branches |= stack.pop() + stack.append(copy.deepcopy(stack[-1])) + elif c == ")": + current_branches |= stack.pop() + stack[-1] = current_branches + else: + dir = Direction(c) + for p in stack[-1]: + neighbour = dir.apply(p) + res[p].add(neighbour) + res[neighbour].add(p) + stack[-1] = {dir.apply(p) for p in stack[-1]} + + return dict(res) + + def start_distances(graph: dict[Point, set[Point]]) -> dict[Point, int]: + queue = collections.deque([(0, START)]) + distances: dict[Point, int] = {} + + while queue: + dist, p = queue.popleft() + if p in distances: + continue + distances[p] = dist + for n in graph.get(p, set()): + queue.append((dist + 1, n)) + + return distances + + # Remove the anchors, we don't use them in the parsing code + graph = to_graph(input.strip()) + distances = start_distances(graph) + return max(distances.values()) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 9b6cb7bd45669cd0bd99e7e6685c7953b6e7eaa9 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 30 Dec 2024 21:44:05 -0500 Subject: [PATCH 27/48] 2018: d20: ex2: add input --- 2018/d20/ex2/input | 1 + 1 file changed, 1 insertion(+) create mode 100644 2018/d20/ex2/input diff --git a/2018/d20/ex2/input b/2018/d20/ex2/input new file mode 100644 index 0000000..7be26dc --- /dev/null +++ b/2018/d20/ex2/input @@ -0,0 +1 @@ +^SESWSSSSESWWNNNNNWNENNWSWWNNWSWNWSWSESWSESENNNESEESWWSESSSSSESWWNWSWWNWSWWSESWSEENEN(W|EEEEESEESEEENNWSWNWWNEN(WNNW(S|NENWNE)|ESEEN(ENESSSW(N|SSESWSSSEESENENWWWNEENWNN(W|ENENWW(S|NEEENWNWNENNWNEENWNENNESSENNNENESENESSESESWWSSEEN(W|EEESENENENNNWNNWNWNENNNWSSWWSESSESSWSESS(WNW(NNW(WNEE(NWWNWSWWNWSWNNWNEESEE(S|NWNENEENWWWSWNWNNNNENESESWSS(WNNSSE|)EEN(NNENWWNENWNENENWNEEEENNEEEEESWWSWSESSWSEESSESSWNWNWN(E|WWNWSSSW(SEEEE(NWNWSNESES|)ESESWWNWSWS(SSWW(WSES(WWNN|SE)|NENNN(E|WS(WNNSSE|)S))|EEEESESSWW(SEESSS(WNNWESSE|)SESSENNNWNENNW(S|NNEEENNNNNWNNWNNENEESSSS(SENEESEESWSESENEESSEENEENWWW(NWNEENNNNESSEESWSEESSSEEENNWNENESSSEESWSSWWWN(EENSWW|)WSSSSENNESESSSSESWSSENENEESSSWN(N|WSWSWSSSSWWSSWWSWNWNNWNWWWNWWNWWNWSWNWWSSE(SSWWN(WNWSWNNWSSSSWWSWSSWWSSEESWSWWN(E|NNWNWSWSSSENE(NWES|)SSSESENN(W|EEEN(W|NNENEESWSSW(N|SSSWWSSENEEENNN(WSSNNE|)NNESENNNNNNN(ESSSESSSSENESENENNNNWSSSWNNNNN(EES(W|ENEESWSSSW(SESWSESSENNNENEEESWWSSSSW(NNN|WWWWNN(ESNW|)(N|WSWWSSWWNENWN(NNNN|EEE|WSW(SESSW(SSENESEEEENESESWSESWWWWNN(ESENSWNW|)WSSWSSWNWNNE(ENWWWSSSSSE(ESSWNWWWWSESEE(NWES|)ESENESSESSWNWSWNN(E|WWWWWWNWNNWSSSSWWSSWNNWNEEENWWNNNENWNNWSWSESWSSS(ENNSSW|)WNNNNWWWWNENENNESSS(W|ENNE(NNW(S|WNNWWSESWWWNENNN(EN(W|EESES(WW(N|W)|EENNNN(EESWSSSESWSSW(SSENENNEENESESWSESSSENNENWNEESE(NNWN(NEES(S|W)|WSWNWNN(NNEEWWSS|)WWS(E|W(NNWSNESS|)S))|SSW(N|SW(N|S(EENSWW|)WSW(NWWS(E|W(SSWNSENN|)NNNN(WSSNNE|)E(ESWSE|NWNE))|SES(W|ES(W|EEE))))))|NNWWSE)|WWS(WNWW(SEWN|)NWNENEEENWNEEE(SSSW(WS(WWNEWSEE|)EE|NN)|ENWNWNEESENENWWNWSWWWSW(NWNENWNENEEN(WW|NNNESSE(SSSEEEESEN(NWES|)ESSWW(SSSES(ENNN(WSNE|)E(NENE(SSWENN|)NN(WSWSNENE|)EEEENWN(WW(S(W|E)|NN)|ENNENWNNENWNN(W|EENNENWNNESEN(N|ESSESWSESSENEEN(WN(WS|EN)|ESSESEESENNWNN(WS(WNSE|)S|EEN(WW|NNNWW(W|NN)|ESSW(W|SESWSEEESE(NN|SSSSS(SWSSWNNNWWWNEENENE(NWNWWSESWWWS(WSESWSWWNWNWWNNNNWWWSWSESWW(SES(WW(SS(S|WW)|NN)|EEN(W|NE(NNWSNESS|)SSEES(W|ESEEEEEESE(NNWWWEEESS|)SSE(NEENNSSWWS|)SWWNNWNWWW(EEESESNWNWWW|))))|NNN(ENWNEN(NNE(NN|SESWSES(ENEEE(NWES|)ESWSSEEN(W|NESES(ENSW|)WSWSW(SESNWN|)NWSWNNNNW(ESSSSEWNNNNW|))|W))|WW)|W))|EE)|SS(W|S))|E)))))))))|S)|W(W(N|W)|S))|WNW(S|WWWSWWNNE(ENNSSW|)S))|N(N|E)))|SEE(S(E|WWWSS(WSW|EN))|N)))|ES(W|S)))))|WWSS(ENSW|)SSSSSE(ENWNEES(NWWSESNWNEES|)|SWWNWNWNWSWWWSEESESESSSSENNNN(NWNWESES|)ESSSSENNEESWSSEEN(W|ESSSSESSENENE(SESSWSWSESWSEENENEESSW(N|SW(SEENEEENNNENEENWNNENWWSWNWNN(EES(W|ENEES(W|SESENEESSENESENNESSSWWSSSESEESWSSWNWN(WWSSE(N|SSWSWSS(WWWWNEEENNEN(WWNENNE(SS|NNWSWSSWSWSWNWWN(EEENWNEE(S|NWN(WSWSSNNENE|)EE(S|NNN(ESSSEEE(SWSEEWWNEN|)NWWN(NN|EE)|W(SS|W|N))))|WWSWWSWSSSWS(EENNESSEEEEENWWWWNNN(WSWENE|)E(SSENE(NWES|)SEEN(E(SENSWN|)N|W)|N)|WWWNWSWWWWWWNNNWSSSWWNWSWNWWWWS(WNWSWWNNWWSESWWNWWWWWNNWSSS(EEEEE|WNWSWWNENENNWNEEENENENWNNENNWWNNNWWNWWWSSWSSEEN(W|NNESSEE(NWES|)SSWSSSWNNN(NEWS|)WSWWWN(NWNWSSESSWWN(WNNNNE(NWWSWNWWWWSWWNWNNEENWWWWNWSWWSESSWSSESENESSESWWNWSWNWN(WSWNWSWW(NENWNENESEES(WW|ENNWNE(E|NNWNWWWSW(NNEENESEEENWNW(WWWNW(SSEWNN|)NNNNNEEESESWWSESW(WNNNEWSSSE|)SEEEENWWNEEEEESWSSSES(EENWNWNEENEENEEESEESESSSWNNWWSESSSEEEN(WW|EESWSS(WNWWWS(EE|WWNENWNN(ESNW|)NNN(EE|W(NEWS|)WSW(W|SESE(NN|S(SSSW(W|S)|WW(WW|N)))|N)))|EEN(EE(EENWWWWNNENESES(EENWNWNWWWWWW(SES(ENEWSW|)W|NENWWNWNNESESENNNW(S|NEENEESWSESESESWSS(ENEENESSEESEEENWNEESSEENWNNNNNWWSWWNWWWSWNWNWS(WNNNNNESEESENNEESEENNENWNENWNEENESE(NNWNNWNNENNWSWWNENEEENWWWWWS(WWNNE(S|EENENESENNESSES(WWWW|SESSEE(NWNNNNNENEEEENNNNNWWNWNWWWSWWSESEEN(E(NWES|)ESSENESSSWWWWSWSS(SS|WNNWNNN(NWSWNWNNWSSSESEESSWSWWWS(E|SWWWSSSSWNWNNE(S|NWWNNNENWWNENWNEEENWNWNENNNWWWWSESWSEE(NNESNWSS|)SWWSWNWNENWNWSWWNNNES(EENWNNESEEENWWNWWWWWWNWSWSWNWSSWNNNWWNWWWNENNNNNNESSSSSES(W|ENNNEEEEESSENESSEENNNENWNENWWWWWSEESE(N|S(SS|WWNWWWWWWW(SS|NNNNWWNNESENNWNNESESSEESWSW(N|SSES(W|EEENNNW(NEENNEESSW(N|SS(WNSE|)ENESENESENNESESENEENWNWNNNNWNEEESENENNWWWWNWSS(WSSSWNWWWSESW(SESE(SWWNSEEN|)NN(N|ESSENE(SSEWNN|)N(W|N))|WWWNENE(S|NWNENENWWSWSWNNWSWNWNENWNWNNESESEENESESS(EENNEEEEENNNNEESSW(N|SSENENEENESEESWSWWW(NEEWWS|)WSEESS(WNWW(SEWN|)NWWWS(EE|SWWW(NEENWW|SSS(WNSE|)EENWNEE(WWSESWENWNEE|)))|ESEESWSSW(SESENEEENENWNEESSESEESSWWN(E|WSWN(NEWS|)WWSESWSWSEENESSSEEESWWSSWWNN(ESNW|)NNWWWNWWWW(SSESSENEEEN(ESSWWSW(SSSWSSWWNWNEE(S|NWNWSWNWNNEES(E(EES(W|S)|NNWNNWSWWW(N|SSE(NEEWWS|)SWSW(SW(N|SESENEE(ESWSEESEEEEENN(WSNE|)NNEN(W|NESESENEENNEENENWNWNNEN(WWW(W|SESSWN)|ENNEESWSEENEESENNENESENEENNWSWWWWNWSS(E|SWNNNNWSSWS(ESNW|)WNW(NENWNEE(NESENNNNWNWSSS(ENSW|)WSWWNNWWNEEES(S|ENNNWWS(E|WWNWSSWNNWSSWW(SW(N|SW(WNEWSE|)SEEES(ENNESEN(ESE(N|SESWS(WNNWW|ESW))|NWWWSW)|WSSE(SWWNSEEN|)N))|NENNNNNNN(WWWWWSWNWWSSWNNWSWNWWWWWSSSSEENNEN(WWSSNNEE|)ESES(WWSSENESSWS(E|WNWWS(E|W(SS|NW(N(WSWNNNWNWSWSEESS(WNWWNWWWSWSWSSWSWWNNWNNNEEEE(SWWS(ESWS|WN)|ENEEENE(S|ENN(WWWWWSWWSWS(WWNW(NNESE(NE(EE|S)|S)|SSSSSSESSSSW(SESSEENWNENENWW(S|NEEESENN(ESESSW(SWW(NEWS|)WSEESSE(SSWWWNN(NESSEWNNWS|)WSSWNNWW(SESWSESWSSEEEESSENE(SSWSESSWNWWWWSEESSWNWSSSW(NNNNNNNNNESENESSWS(WN|EEN)|SESWSSSSESESSSSWNW(NN(ESNW|)N|SSEEEEENEESSW(SWSEENESSESESSEENWNNNESES(ENNNNWNENNNWSWNNNNWSSSWSSWW(NENNWNNWNWNNNESENESSES(ENEN(EEN(W|ENEES(EENWESWW|)SSSWNN(WSWSESEESWWS(SENEENEESSESSWWN(WW(NEENSWWS|)SSSSWSW(SEENEENEEEESWWWSWSEENESESSSWWNWSSESSENEN(ESENE(NWNN(ESNW|)NNNW(S(W|SSSS)|N(E|NNNN(NEEWWS|)WSW(SS(ENSW|)WWWW(N(N|EEE)|S)|N)))|ESESSWNW(N|SSSENESESWSEESENNNNW(SS|NW(NEEE(NWW(NEEWWS|)W|EESWW(SESWSS(SSSWNWWWSWSES(ENE(NWES|)EES(S|WW)|W(SEWN|)WWWWNWWWWWWSEEEEESEESWWWWSWS(SSWWWNWSSEES(WWWNNWWNWNWWWWNWWSESESWSEEES(WWWWNNWN(WNENNNWNNNNWNWW(NENWNENWNNNNESSENNNNENNESENESEN(NWWWWNNN(E(E|SS)|WWSSE(SWW(NNN|SES(EN|SSWNN))|N))|ESSSSWNNWWSESWWW(NENSWS|)SEEESSSSSEESSWSWSWSW(SEENESEEEEEEEENWNENWWWNEEENWNNESEENESEESSWNWSSEEENNESESEEE(SSWNW(WW(WWWWWNW(NENWESWS|)SSSSWSWWN(E|WWWWWWWWSEEEES(W|ENESE(SESENEEN(EN(W|E(SSSWNSENNN|)N(E(EE|S)|W))|WWW)|N)))|N)|S)|NE(EE|S|NNWWNWWNWSW(SEESE(SENEWSWN|)N|NN(EENESE(SWEN|)N|WSW(SEWN|)NNENWNWSSSWS(W(S|WNNE(NWNNNWW(SSSSSE(NNNN|SWSWNWNWSSSW(SSSSES(EN(ESENSWNW|)NWNNE(S|EENWWN)|WWN(W|N))|NWWNNNESE(SWEN|)NN(WW|NN(NN|ESEE(NWES|)SS(WWNEWSEE|)S))))|NEENESESS(ENE(S|N(EEESNWWW|)WN(N|W))|S(WNNSSE|)SS))|S))|E)))))|NNENN(NWWS(ESWENW|)WNNNN(EEE(NWWEES|)SWS(WNSE|)E|W)|E(E|S))))|SESESWW(SEESSWSE(ENSW|)SWS(E|WNNNNE)|N))|E)|ENN(NWSWNSENES|)ESSE(SWWS|ENW))|S)|EENEEE))|ENE(ENWNSESW|)S)|W))|S))))|W)|NNNNE(NWES|)SS)|E)|WNNW(N(W|N)|SS))|N))|WWNNWN(E|WNWWSES(WWSSWWW(NENWNNEENN(ESSSW(W|SS)|N)|SS(WNNSSE|)EEN(ESSESSWNWW(SSE(N|S(WSEWNE|)EEEN(WW|E|NN))|N(E|W))|W))|E)))|W(WNWESE|)SES(S|W))|SSEEN(ESS(WWSESNWNEE|)E(ESNW|)NNN(WNSE|)E|W))|W)|N)))|N(NNWWN(WSS(EESNWW|)W(W|NN)|EE)|EE))|NN)|NEN(W|EENE(NWW(SWEN|)NNE(NWWNENWN(ENW|WSWSE)|S)|ESE(EESWWSWW(SES(W|ENE(SSWENN|)N)|N(N|E|W(S|W)))|N))))|N)|W))|NNN))|EENEENE(EE|S))|EEES(SEE(NWNE|SWSE)|WW))))|S)|EEE)|S))))|E(N|EEEN(N|ESS(WSEWNE|)ENNESSEES(W|E(NNNNWSSWNNW(ESSENNSSWNNW|)|S)))))|ESSSEEENESSEEEES(WWWW(S|WNWWS(WNSE|)E)|ES(EEEESSSEEENNNNEENWWWNEENENN(ESSS(SENNNNESSSEEENNESESENEESESEEEENNNWSWS(WNWNN(ESENEEESENEESSW(WSESSWNW(NN|SSWSSSEENESENNENNENWN(NNEEN(ESSWWSEESSW(N|SSENEESWSWWW(NN|SESSSSWSESESSSESSENEEENEEEEEESWSWSSSWWWWWSSEEEN(EESWSESSENEENENWWW(SEWN|)NEENESENENWNWNEENESEENWNWNWWWW(SS(SWSS(E(N|E)|W(SEWN|)N)|ENE(E|S))|NEEENWNNNNNNENNENWWWNENESENEEENWNWSWNNWSSWNWSWNNEN(E(S|EEESENEESWSEENNEESWSESWWWSESEE(NWES|)SSSWNNWWS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(W|SSSEN(ESEWNW|)N))|S)|ESSESSWW(N(E|N)|SEESEESE(NNNWSWN(SENESSNNWSWN|)|SSSS(EN(ESSSSES(WWWNNNESS(NNWSSSNNNESS|)|SENENWN(NW(NENWESWS|)S|EESSS(SSWNNSSENN|)EENWNEN(N|W)))|N)|WNWWS(E|WWNENNW(SWSW(SSE(SE(NEWS|)S(W|SSESSSWN(N|WSSESEEN(NN|W)))|N)|N)|NE(EESS(WN|EN)|NWW(N|WW)))))))))))|ESENN(W|E(SSSWWEENNN|)E))|E))))|N)))|NNNWWW(SSENES|WW|NEENW(NN(N(N|W)|EES(W|SS))|W)))|W)|W)|N(N|E))|N)|NN)))|WWWWSSWWNENWWSSSESESWSEEENNN(NNESSSE(E|SWSESWSEE(NESNWS|)SWSESWWWSEEESWWSS(EENWESWW|)WNWSSS(ENESNWSW|)WNNNWWWWNENEENWNNNWNE(EEESSWNWSSEE(EN(ESNW|)NN|SSW(S(EE|WW)|N))|NWWW(NENNNE(SSSENSWNNN|)NNWWS(E|SWW(NENWESWS|)SSSENENW(ESWSWNSENENW|))|SSE(SWW(N|WSEEEE(SWSWSWSESEESS(ENE(NWES|)S|WSWWNWNE(E(E|S)|NWNWNENEN(WW(NN|S)|E)))|N))|N))))|W(SS|W))))|WW)))|WW)|WSSSWSW(WSNE|)N))|N)|WWWW(SEEEWWWN|)WWWWSESW(ENWNEEWWSESW|))|E)|W)|WWWWWWWWWWWSWNWS(SSENEES(ENN(EESESEE(NEEN(WWW(S|W)|E)|SWWWNW(S(W|SEEEEESSSWNN(SSENNNSSSWNN|))|N))|W)|W)|WWN(E|WWSESW)))|W))))))|SS)|S))))|NW(N|W)))|NNNN)))|W))|N)|WWWN(W|E))|NNWNWNN(N|EES(E(NN|S(SSENEE(SWEN|)EN(WWWNSEEE|)N|W))|W))))|NN)))|W(S|WN(WSNE|)E))))|EEEE))|WS(ESWENW|)W)))))))|S)))|EES(WSEWNE|)ENE(SEEWWN|)N))|W)|ESEE(NWES|)SSW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WWNEWSEE|)EN(ESSEEE(NWWNSEES|)E|N)|W))|E))|NN)|N)|NNNESEES(WW|EN(NNNWSW(SEWN|)NNWNN(WNSE|)ESESEE(S|ENWWNW)|ESS(SES(W|ES(E(NNN(W(W|S)|E)|SS(WNSE|)S)|W))|WW)))))|E)))|W))|SSESWWN(SEENWNSESWWN|)))))))|N)))))|WNNW(NN|WSESW(S|WNNWW(SESWWNW(WWNEWSEE|)S|N))))))|SES(EEENESSWSEE(S|NEN(ESENNSSWNW|)W)|S))|WNNWSSWNNNN(ESEWNW|)N)))|WW)|SSW(WS(ES|WN)|N))|W)))|WW(SWWEEN|)NN(NN|W))|S)|SS(S|ENEE(NWES|)(E|S(S|W))))))|SSEESWWSSENEENESSWWSEESENESSEEEEESWSS(EEEEENNWSWNW(SWEN|)NNNENNEESSW(SEEENWNEESENNEEESENESSSESSSE(SWWWWNWSWWWWWNENEEE(SWWEEN|)EENWNEE(SESWSE|NWWW(NEWS|)SWS(W(N|WW(WWWNSEEE|)S)|E))|NNE(NWNNE(S|EEN(E(S|ENWNNE(NEWS|)S)|WWWNW(SSS|N(EESNWW|)WSWWWWWWWS(WNWWWNEEENNEENE(SSS(WNWSNESE|)E|NWWWW(NEEWWS|)WWSSEE(N(W|EE)|SWWWSW(SWNWWWSEESSSS(WNW(S|NENWWW(SEWN|)NN(ESNW|)WN(E|W(S|WW)))|ENE(S|NWNEE(N|S)))|NNENNWW(SEWN|)N(NNNWWSSE(SWWEEN|)N|E))))|E))))|E|S))|N)|WNNWSSWWNENWWSWS(E|WWNWW(SEWN|)NNEN(NWSNES|)EESWS(W|E(ENEWSW|)S))))|E)|SSS)|E)|EE)))|EEE))))|E)|ENEEEENNWN(EENESSWSSES(ENENNENNENWWNWS(SESWSSW(ENNENWESWSSW|)|W(NNNNWW(SEWN|)N(WSNE|)EENESESEESSW(NWSWNN|SEESENNWNNNWWNEEESSEEESWSW(NWES|)SSEEENN(WSWENE|)ESSESSSWSWWSWS(WWWWW(W|NNENEEN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|)NNNEENWNE(WSESWWEENWNE|)|SSSENN))|N))|N))|NWW(NN(ESNW|)W(SS|NNWNN(ESNW|)W(WWNWSNESEE|)SS)|S))))))|S)))|N)|S)|N)|N))))|NN))|WWSSE(SSS|N))|WW(NEEWWS|)SWWSWS(SWWEEN|)EENEE(N|S(W|SS)))))))|E)|N))|S)|WNN(N|W)))|N(E|N)))|NNNW(S|NEEEE(S|N(N(NNEWSS|)WSWWNE|E)))))|W))|E)|S)|S)|ENN(ESNW|)NN)))))|W)))$ From 4cb48ee71c0e710165add3dec3ada52c382031c5 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 30 Dec 2024 21:44:13 -0500 Subject: [PATCH 28/48] 2018: d20: ex2: add solution --- 2018/d20/ex2/ex2.py | 89 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100755 2018/d20/ex2/ex2.py diff --git a/2018/d20/ex2/ex2.py b/2018/d20/ex2/ex2.py new file mode 100755 index 0000000..037b565 --- /dev/null +++ b/2018/d20/ex2/ex2.py @@ -0,0 +1,89 @@ +#!/usr/bin/env python + +import collections +import copy +import enum +import sys +from typing import NamedTuple + + +class Point(NamedTuple): + x: int + y: int + + +class Direction(enum.StrEnum): + NORTH = "N" + SOUTH = "S" + WEST = "W" + EAST = "E" + + def apply(self, p: Point) -> Point: + delta: Point + match self: + case Direction.NORTH: + delta = Point(-1, 0) + case Direction.SOUTH: + delta = Point(1, 0) + case Direction.WEST: + delta = Point(0, -1) + case Direction.EAST: + delta = Point(0, 1) + return Point(p.x + delta.x, p.y + delta.y) + + +START = Point(0, 0) + + +def solve(input: str) -> int: + def to_graph(regex: str) -> dict[Point, set[Point]]: + res: dict[Point, set[Point]] = collections.defaultdict(set) + stack: list[set[Point]] = [{START}] + current_branches: set[Point] = set() + for c in regex.removeprefix("^").removesuffix("$"): + if c == "(": + stack.append(copy.deepcopy(stack[-1])) + current_branches = set() + elif c == "|": + current_branches |= stack.pop() + stack.append(copy.deepcopy(stack[-1])) + elif c == ")": + current_branches |= stack.pop() + stack[-1] = current_branches + else: + dir = Direction(c) + for p in stack[-1]: + neighbour = dir.apply(p) + res[p].add(neighbour) + res[neighbour].add(p) + stack[-1] = {dir.apply(p) for p in stack[-1]} + + return dict(res) + + def start_distances(graph: dict[Point, set[Point]]) -> dict[Point, int]: + queue = collections.deque([(0, START)]) + distances: dict[Point, int] = {} + + while queue: + dist, p = queue.popleft() + if p in distances: + continue + distances[p] = dist + for n in graph.get(p, set()): + queue.append((dist + 1, n)) + + return distances + + # Remove the anchors, we don't use them in the parsing code + graph = to_graph(input.strip()) + distances = start_distances(graph) + return sum(d >= 1000 for d in distances.values()) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 763793ab0b68906e964e06f11f9ebd26a0263db8 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 30 Dec 2024 23:05:52 -0500 Subject: [PATCH 29/48] 2018: d21: ex1: add input --- 2018/d21/ex1/input | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 2018/d21/ex1/input diff --git a/2018/d21/ex1/input b/2018/d21/ex1/input new file mode 100644 index 0000000..3fd660d --- /dev/null +++ b/2018/d21/ex1/input @@ -0,0 +1,32 @@ +#ip 1 +seti 123 0 3 +bani 3 456 3 +eqri 3 72 3 +addr 3 1 1 +seti 0 0 1 +seti 0 9 3 +bori 3 65536 5 +seti 15028787 4 3 +bani 5 255 2 +addr 3 2 3 +bani 3 16777215 3 +muli 3 65899 3 +bani 3 16777215 3 +gtir 256 5 2 +addr 2 1 1 +addi 1 1 1 +seti 27 3 1 +seti 0 9 2 +addi 2 1 4 +muli 4 256 4 +gtrr 4 5 4 +addr 4 1 1 +addi 1 1 1 +seti 25 1 1 +addi 2 1 2 +seti 17 8 1 +setr 2 4 5 +seti 7 3 1 +eqrr 3 0 2 +addr 2 1 1 +seti 5 3 1 From 47cce9f0f3349a9cd585b63b2ed286a7da9831c0 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 30 Dec 2024 23:06:00 -0500 Subject: [PATCH 30/48] 2018: d21: ex1: add solution --- 2018/d21/ex1/ex1.py | 107 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100755 2018/d21/ex1/ex1.py diff --git a/2018/d21/ex1/ex1.py b/2018/d21/ex1/ex1.py new file mode 100755 index 0000000..285166a --- /dev/null +++ b/2018/d21/ex1/ex1.py @@ -0,0 +1,107 @@ +#!/usr/bin/env python + +import copy +import enum +import sys +from typing import NamedTuple + + +class OpCode(enum.StrEnum): + ADDR = "addr" + ADDI = "addi" + MULR = "mulr" + MULI = "muli" + BANR = "banr" + BANI = "bani" + BORR = "borr" + BORI = "bori" + SETR = "setr" + SETI = "seti" + GTIR = "gtir" + GTRI = "gtri" + GTRR = "gtrr" + EQIR = "eqir" + EQRI = "eqri" + EQRR = "eqrr" + + def apply(self, registers: list[int], a: int, b: int, c: int) -> list[int]: + registers = copy.deepcopy(registers) + if self == OpCode.ADDR: + registers[c] = registers[a] + registers[b] + if self == OpCode.ADDI: + registers[c] = registers[a] + b + if self == OpCode.MULR: + registers[c] = registers[a] * registers[b] + if self == OpCode.MULI: + registers[c] = registers[a] * b + if self == OpCode.BANR: + registers[c] = registers[a] & registers[b] + if self == OpCode.BANI: + registers[c] = registers[a] & b + if self == OpCode.BORR: + registers[c] = registers[a] | registers[b] + if self == OpCode.BORI: + registers[c] = registers[a] | b + if self == OpCode.SETR: + registers[c] = registers[a] + if self == OpCode.SETI: + registers[c] = a + if self == OpCode.GTIR: + registers[c] = a > registers[b] + if self == OpCode.GTRI: + registers[c] = registers[a] > b + if self == OpCode.GTRR: + registers[c] = registers[a] > registers[b] + if self == OpCode.EQIR: + registers[c] = a == registers[b] + if self == OpCode.EQRI: + registers[c] = registers[a] == b + if self == OpCode.EQRR: + registers[c] = registers[a] == registers[b] + return registers + + +class Instruction(NamedTuple): + op: OpCode + a: int + b: int + c: int + + def apply(self, registers: list[int]) -> list[int]: + return self.op.apply(registers, self.a, self.b, self.c) + + +def solve(input: str) -> int: + def parse_instruction(input: str) -> Instruction: + op, *values = input.split() + return Instruction(OpCode(op), *map(int, values)) + + def parse(input: list[str]) -> tuple[int, list[Instruction]]: + ip = int(input[0].removeprefix("#ip ")) + return ip, [parse_instruction(line) for line in input[1:]] + + # Relies on the input having a singular `EQRR` instruction + def find_comparison(ip_reg: int, instructions: list[Instruction]) -> int: + registers = [0] * 6 + while (ip := registers[ip_reg]) < len(instructions): + instr = instructions[ip] + if instr.op == OpCode.EQRR: + operands = {instr.a, instr.b} + assert 0 in operands # Sanity check + operands.remove(0) + return registers[operands.pop()] + registers = instr.apply(registers) + registers[ip_reg] += 1 + assert False # Sanity check + + ip_reg, instructions = parse(input.splitlines()) + return find_comparison(ip_reg, instructions) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 955d5ec6c2ff5db87bd96802312bebb9fed4420d Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 30 Dec 2024 23:06:05 -0500 Subject: [PATCH 31/48] 2018: d21: ex2: add input --- 2018/d21/ex2/input | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 2018/d21/ex2/input diff --git a/2018/d21/ex2/input b/2018/d21/ex2/input new file mode 100644 index 0000000..3fd660d --- /dev/null +++ b/2018/d21/ex2/input @@ -0,0 +1,32 @@ +#ip 1 +seti 123 0 3 +bani 3 456 3 +eqri 3 72 3 +addr 3 1 1 +seti 0 0 1 +seti 0 9 3 +bori 3 65536 5 +seti 15028787 4 3 +bani 5 255 2 +addr 3 2 3 +bani 3 16777215 3 +muli 3 65899 3 +bani 3 16777215 3 +gtir 256 5 2 +addr 2 1 1 +addi 1 1 1 +seti 27 3 1 +seti 0 9 2 +addi 2 1 4 +muli 4 256 4 +gtrr 4 5 4 +addr 4 1 1 +addi 1 1 1 +seti 25 1 1 +addi 2 1 2 +seti 17 8 1 +setr 2 4 5 +seti 7 3 1 +eqrr 3 0 2 +addr 2 1 1 +seti 5 3 1 From cd832a2bb0d5fd06bfcd87d8b20369c9fde097c3 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 30 Dec 2024 23:06:17 -0500 Subject: [PATCH 32/48] 2018: d21: ex2: add solution --- 2018/d21/ex2/ex2.py | 138 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100755 2018/d21/ex2/ex2.py diff --git a/2018/d21/ex2/ex2.py b/2018/d21/ex2/ex2.py new file mode 100755 index 0000000..e7a744d --- /dev/null +++ b/2018/d21/ex2/ex2.py @@ -0,0 +1,138 @@ +#!/usr/bin/env python + +import copy +import enum +import sys +from typing import NamedTuple + + +class OpCode(enum.StrEnum): + ADDR = "addr" + ADDI = "addi" + MULR = "mulr" + MULI = "muli" + BANR = "banr" + BANI = "bani" + BORR = "borr" + BORI = "bori" + SETR = "setr" + SETI = "seti" + GTIR = "gtir" + GTRI = "gtri" + GTRR = "gtrr" + EQIR = "eqir" + EQRI = "eqri" + EQRR = "eqrr" + + def apply(self, registers: list[int], a: int, b: int, c: int) -> list[int]: + registers = copy.deepcopy(registers) + if self == OpCode.ADDR: + registers[c] = registers[a] + registers[b] + if self == OpCode.ADDI: + registers[c] = registers[a] + b + if self == OpCode.MULR: + registers[c] = registers[a] * registers[b] + if self == OpCode.MULI: + registers[c] = registers[a] * b + if self == OpCode.BANR: + registers[c] = registers[a] & registers[b] + if self == OpCode.BANI: + registers[c] = registers[a] & b + if self == OpCode.BORR: + registers[c] = registers[a] | registers[b] + if self == OpCode.BORI: + registers[c] = registers[a] | b + if self == OpCode.SETR: + registers[c] = registers[a] + if self == OpCode.SETI: + registers[c] = a + if self == OpCode.GTIR: + registers[c] = a > registers[b] + if self == OpCode.GTRI: + registers[c] = registers[a] > b + if self == OpCode.GTRR: + registers[c] = registers[a] > registers[b] + if self == OpCode.EQIR: + registers[c] = a == registers[b] + if self == OpCode.EQRI: + registers[c] = registers[a] == b + if self == OpCode.EQRR: + registers[c] = registers[a] == registers[b] + return registers + + +class Instruction(NamedTuple): + op: OpCode + a: int + b: int + c: int + + def apply(self, registers: list[int]) -> list[int]: + return self.op.apply(registers, self.a, self.b, self.c) + + +def solve(input: str) -> int: + def parse_instruction(input: str) -> Instruction: + op, *values = input.split() + return Instruction(OpCode(op), *map(int, values)) + + def parse(input: list[str]) -> tuple[int, list[Instruction]]: + ip = int(input[0].removeprefix("#ip ")) + return ip, [parse_instruction(line) for line in input[1:]] + + def hash_loop(n: int, seed: int, perturb: int) -> int: + n |= 0x10000 # + while n: + seed += n & 0xFF + seed &= 0xFFFFFF # Keeps 24-bit + seed *= perturb + seed &= 0xFFFFFF # Keeps 24-bit + n >>= 8 + return seed + + # Relies heavily on input having a specific shape + def hash_params(ip_reg: int, instructions: list[Instruction]) -> tuple[int, int]: + def seed_index() -> int: + for i, instr in enumerate(instructions): + if instr.op == OpCode.BORI and instr.b == 65536: + return i + 1 + assert False # Sanity check + + def perturb_index() -> int: + for i, instr in enumerate(instructions): + if instr.op == OpCode.BANI and instr.b == 16777215: + return i + 1 + assert False # Sanity check + + seed_instr = instructions[seed_index()] + perturb_instr = instructions[perturb_index()] + + assert seed_instr.op == OpCode.SETI # Sanity check + assert perturb_instr.op == OpCode.MULI # Sanity check + assert perturb_instr.a == perturb_instr.c # Sanity check + return seed_instr.a, perturb_instr.b + + def find_comparison(ip_reg: int, instructions: list[Instruction]) -> int: + seed, perturb = hash_params(ip_reg, instructions) + value = 0 + count = 0 + seen: set[int] = set() + while True: + count += (value << 8) + (value << 16) + if (new_value := hash_loop(value, seed, perturb)) in seen: + return value + seen.add(new_value) + value = new_value + assert False # Sanity check + + ip_reg, instructions = parse(input.splitlines()) + return find_comparison(ip_reg, instructions) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From f18a8f45f6cee1b8849ac4de60f08803d4e0c4db Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 30 Dec 2024 23:58:08 -0500 Subject: [PATCH 33/48] 2018: d22: ex1: add input --- 2018/d22/ex1/input | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 2018/d22/ex1/input diff --git a/2018/d22/ex1/input b/2018/d22/ex1/input new file mode 100644 index 0000000..2e537a8 --- /dev/null +++ b/2018/d22/ex1/input @@ -0,0 +1,2 @@ +depth: 7740 +target: 12,763 From 49d71606177166f8c3f8cee4e74fa669d2a83b7b Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 30 Dec 2024 23:58:21 -0500 Subject: [PATCH 34/48] 2018: d22: ex1: add solution --- 2018/d22/ex1/ex1.py | 67 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100755 2018/d22/ex1/ex1.py diff --git a/2018/d22/ex1/ex1.py b/2018/d22/ex1/ex1.py new file mode 100755 index 0000000..c49e69d --- /dev/null +++ b/2018/d22/ex1/ex1.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python + +import enum +import itertools +import sys +from typing import NamedTuple + + +class Point(NamedTuple): + x: int + y: int + + +class Region(enum.IntEnum): + ROCKY = 0 + WET = 1 + NARROW = 2 + + +def solve(input: str) -> int: + def parse(input: list[str]) -> tuple[int, Point]: + depth = input[0].removeprefix("depth: ") + target = input[1].removeprefix("target: ") + return int(depth), Point(*(int(n) for n in target.split(","))) + + def compute_erosions(depth: int, target: Point) -> dict[Point, int]: + res: dict[Point, int] = {} + for x in range(0, target.x + 1): + for y in range(0, target.y + 1): + p = Point(x, y) + if p == Point(0, 0) or p == target: + res[p] = 0 + elif p.y == 0: + res[p] = p.x * 16807 + elif p.x == 0: + res[p] = p.y * 48271 + else: + res[p] = res[Point(p.x - 1, p.y)] * res[Point(p.x, p.y - 1)] + # Go from geologic index to erosion level + res[p] += depth + res[p] %= 20183 + return res + + def compute_regions(depth: int, target: Point) -> dict[Point, Region]: + return { + p: Region(erosion % 3) + for p, erosion in compute_erosions(depth, target).items() + } + + depth, target = parse(input.splitlines()) + regions = compute_regions(depth, target) + return sum( + regions[p] + for p in map( + Point._make, + itertools.product(range(0, target.x + 1), range(target.y + 1)), + ) + ) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From aab563b9ff93daef43cec12c34f253d65c5b65c5 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 30 Dec 2024 23:58:27 -0500 Subject: [PATCH 35/48] 2018: d22: ex2: add input --- 2018/d22/ex2/input | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 2018/d22/ex2/input diff --git a/2018/d22/ex2/input b/2018/d22/ex2/input new file mode 100644 index 0000000..2e537a8 --- /dev/null +++ b/2018/d22/ex2/input @@ -0,0 +1,2 @@ +depth: 7740 +target: 12,763 From 0624b4e44d5a1b0442e9a39a20882f6ee734a388 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 30 Dec 2024 23:58:48 -0500 Subject: [PATCH 36/48] 2018: d22: ex2: add solution --- 2018/d22/ex2/ex2.py | 128 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100755 2018/d22/ex2/ex2.py diff --git a/2018/d22/ex2/ex2.py b/2018/d22/ex2/ex2.py new file mode 100755 index 0000000..d27f3a3 --- /dev/null +++ b/2018/d22/ex2/ex2.py @@ -0,0 +1,128 @@ +#!/usr/bin/env python + +import dataclasses +import enum +import heapq +import sys +from collections.abc import Iterator +from typing import NamedTuple + + +class Point(NamedTuple): + x: int + y: int + + def neighbours(self) -> Iterator["Point"]: + for dx, dy in ( + (-1, 0), + (1, 0), + (0, -1), + (0, 1), + ): + yield Point(self.x + dx, self.y + dy) + + +class Region(enum.IntEnum): + ROCKY = 0 + WET = 1 + NARROW = 2 + + +@dataclasses.dataclass +class Cave: + depth: int + target: Point + erosion: dict[Point, int] = dataclasses.field(init=False) + + def __post_init__(self) -> None: + self.erosion = {} + + def erosion_at(self, p: Point) -> int: + if p in self.erosion: + return self.erosion[p] + + if p == Point(0, 0) or p == self.target: + self.erosion[p] = 0 + elif p.y == 0: + self.erosion[p] = p.x * 16807 + elif p.x == 0: + self.erosion[p] = p.y * 48271 + else: + self.erosion[p] = self.erosion_at(Point(p.x - 1, p.y)) * self.erosion_at( + Point(p.x, p.y - 1) + ) + # Go from geologic index to erosion level + self.erosion[p] += self.depth + self.erosion[p] %= 20183 + return self.erosion[p] + + def region_at(self, p: Point) -> Region: + return Region(self.erosion_at(p) % 3) + + +class Gear(enum.IntEnum): + NEITHER = 0 + TORCH = 1 + CLIMBING = 2 + + +class Explorer(NamedTuple): + pos: Point + gear: Gear + + +def solve(input: str) -> int: + def parse(input: list[str]) -> tuple[int, Point]: + depth = input[0].removeprefix("depth: ") + target = input[1].removeprefix("target: ") + return int(depth), Point(*(int(n) for n in target.split(","))) + + def next_state(explorer: Explorer, cave: Cave) -> Iterator[tuple[int, Explorer]]: + for n in explorer.pos.neighbours(): + if n.x < 0 or n.y < 0: + continue + region = cave.region_at(n) + if region == Region.ROCKY: + for gear in (Gear.CLIMBING, Gear.TORCH): + yield 1 + (7 if gear != explorer.gear else 0), Explorer(n, gear) + if region == Region.WET: + for gear in (Gear.CLIMBING, Gear.NEITHER): + yield 1 + (7 if gear != explorer.gear else 0), Explorer(n, gear) + if region == Region.NARROW: + for gear in (Gear.TORCH, Gear.NEITHER): + yield 1 + (7 if gear != explorer.gear else 0), Explorer(n, gear) + + def djikstra(start: Explorer, end: Explorer, cave: Cave) -> int: + # Priority queue of (distance, point) + queue = [(0, start)] + seen: set[Explorer] = set() + + while len(queue) > 0: + cost, explorer = heapq.heappop(queue) + if explorer == end: + return cost + # We must have seen p with a smaller distance before + if explorer in seen: + continue + # First time encountering p, must be the smallest distance to it + seen.add(explorer) + # Add all neighbours to be visited + for time, n in next_state(explorer, cave): + heapq.heappush(queue, (cost + time, n)) + + assert False # Sanity check + + depth, target = parse(input.splitlines()) + cave = Cave(depth, target) + start = Explorer(Point(0, 0), Gear.TORCH) + end = Explorer(target, Gear.TORCH) + return djikstra(start, end, cave) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 25aeec5676198c513d5ab673992208dd7aaf1ed3 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Tue, 31 Dec 2024 00:47:19 -0500 Subject: [PATCH 37/48] 2018: d23: ex1: add input --- 2018/d23/ex1/input | 1000 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1000 insertions(+) create mode 100644 2018/d23/ex1/input diff --git a/2018/d23/ex1/input b/2018/d23/ex1/input new file mode 100644 index 0000000..56ad959 --- /dev/null +++ b/2018/d23/ex1/input @@ -0,0 +1,1000 @@ +pos=<-26800153,54191419,14631486>, r=91909373 +pos=<2726122,52059927,-16784250>, r=91667585 +pos=<-1106302,78464933,37274659>, r=67846291 +pos=<-14676967,62367449,15230451>, r=87363344 +pos=<19283542,94968325,14626623>, r=86607330 +pos=<-1066104,66788622,7322926>, r=86081067 +pos=<-10327813,66959254,82168838>, r=82685423 +pos=<-12782412,37618518,45011118>, r=51320903 +pos=<-31606634,65230754,46027117>, r=76359614 +pos=<6733972,69543990,63956247>, r=49996039 +pos=<33854876,65000033,-14697092>, r=94704404 +pos=<-20114176,65135803,21306016>, r=89493234 +pos=<19966373,79368650,31671383>, r=53280220 +pos=<-44504614,61642083,47567346>, r=84128697 +pos=<-56959179,50805665,60035489>, r=91029871 +pos=<3833359,78337041,45411039>, r=54641822 +pos=<-9740514,69356208,46871803>, r=57774088 +pos=<79176394,59665612,42223492>, r=77771037 +pos=<-44885922,65011789,56458424>, r=89585685 +pos=<7188801,67430842,33413070>, r=52378146 +pos=<71981622,67198516,44650418>, r=75682568 +pos=<8471951,53949119,56588672>, r=90202717 +pos=<-21149813,53082243,44100402>, r=55681037 +pos=<61465091,51705189,24744707>, r=69577644 +pos=<-48427679,48875846,40504608>, r=82348095 +pos=<-16413220,64687719,48523359>, r=58127145 +pos=<41280618,18195971,22818620>, r=77036684 +pos=<24578568,12510958,32539456>, r=56298676 +pos=<10014943,77504976,13215099>, r=79824160 +pos=<32099889,55841549,33503165>, r=76599362 +pos=<-25934900,49453902,45457577>, r=55480521 +pos=<194428994,55319521,14326800>, r=72677431 +pos=<64044431,68921123,53558270>, r=65356299 +pos=<8611401,78916429,97105501>, r=90640047 +pos=<-3354425,50156520,49667979>, r=94822817 +pos=<86727740,49651294,37209042>, r=80322343 +pos=<-25482281,71458393,35135292>, r=87354550 +pos=<-56538221,50861580,45009103>, r=87939856 +pos=<25189303,52501081,55911181>, r=77913908 +pos=<-43747179,38521232,45927670>, r=80465847 +pos=<28680978,69986439,11874426>, r=67945167 +pos=<84354566,50011206,47992976>, r=67524866 +pos=<-44279563,46448363,48653641>, r=70345204 +pos=<-21033349,75676883,30863095>, r=91396305 +pos=<6132544,89170880,28377983>, r=80209515 +pos=<5838072,86938933,42122977>, r=64527115 +pos=<19427534,-8143678,45615709>, r=64268506 +pos=<14819968,60850429,35713119>, r=50675563 +pos=<2961664,78461502,47449899>, r=53599108 +pos=<-43363971,60346889,68132431>, r=95072805 +pos=<5444783,51735310,5801133>, r=66038720 +pos=<51608916,70339966,28851636>, r=74249476 +pos=<-39895346,56431956,29333441>, r=92543042 +pos=<-8613222,49276399,-6637951>, r=90076739 +pos=<68217090,56383884,49837668>, r=55915388 +pos=<-23031224,75798534,46219198>, r=78159777 +pos=<9982548,48837003,95009075>, r=57093080 +pos=<11783440,101197289,19256213>, r=95706918 +pos=<5523354,59300428,13433224>, r=65893184 +pos=<18607093,110399850,43651250>, r=73690807 +pos=<2119163,109847789,55948700>, r=86906887 +pos=<-47528630,71901316,54008364>, r=96667956 +pos=<68703448,66891625,43604620>, r=73142546 +pos=<-11507569,59058987,14159146>, r=81956819 +pos=<-20564060,52868253,42381061>, r=56600509 +pos=<7665464,86789990,47784126>, r=56889621 +pos=<-10994018,54755473,96964752>, r=85943807 +pos=<6628394,78144875,18768936>, r=78296745 +pos=<53248088,44523505,74094303>, r=57269778 +pos=<-31135955,38636131,22867651>, r=90799844 +pos=<-120483,94499416,39227452>, r=80941609 +pos=<43961851,57733220,13187610>, r=69659612 +pos=<-17145296,52725010,33700875>, r=61718656 +pos=<42398975,51457938,48534837>, r=50684428 +pos=<32989135,27108010,-11418788>, r=94070570 +pos=<-41281619,58529318,43713414>, r=81646835 +pos=<15676046,87664036,4474396>, r=93062768 +pos=<91288458,56341397,53854879>, r=80317303 +pos=<-13993707,51443582,19773222>, r=71213598 +pos=<-26166431,44282826,62488660>, r=63220434 +pos=<13760583,96393695,84713578>, r=90576204 +pos=<1399179,59472056,30865564>, r=52756738 +pos=<44353782,84240054,46022166>, r=63724044 +pos=<15223202,64424455,110031048>, r=82461868 +pos=<1831436,72155489,42370476>, r=53502789 +pos=<-3212782,90085872,69767179>, r=86295528 +pos=<2924551,84160632,22919443>, r=83865971 +pos=<-5277120,114055875,46749493>, r=98132946 +pos=<-44091102,60876760,34007702>, r=96509437 +pos=<9170763,60331193,24167167>, r=52542457 +pos=<4244629,37697533,19314365>, r=59911105 +pos=<66675928,53812019,35745466>, r=65894729 +pos=<17791554,54901626,27988883>, r=70869570 +pos=<20375935,50364328,-1807360>, r=57344942 +pos=<35621840,44634149,62393026>, r=70971770 +pos=<-42604642,57071715,45246338>, r=79979189 +pos=<-14872097,43082336,77210959>, r=67848969 +pos=<54374149,83056200,33467311>, r=85115127 +pos=<1476108,6758434,46385542>, r=66547693 +pos=<25039805,52794798,-19161299>, r=78147972 +pos=<-26819047,43199801,30459488>, r=74327370 +pos=<4286668,110940760,38802604>, r=93400678 +pos=<4053848,87892295,76015736>, r=83083719 +pos=<-1921035,61253227,-3665179>, r=92388716 +pos=<17204393,27151196,113219747>, r=87712277 +pos=<11482784,81631206,44449045>, r=51248801 +pos=<19881378,33514197,5150119>, r=62622046 +pos=<46089433,22660842,35676189>, r=64523299 +pos=<-2707511,17390331,65062945>, r=69228121 +pos=<-160344804,31914854,69649477>, r=58216880 +pos=<25746542,31258930,-22386759>, r=93644875 +pos=<-24641910,49256326,49576498>, r=49870969 +pos=<8138665,60289998,19311562>, r=58388923 +pos=<-49531327,40283414,41864583>, r=88551146 +pos=<-35890107,52441195,48988086>, r=64892519 +pos=<-9694645,68139955,55216246>, r=56280378 +pos=<3863609,74729614,36250636>, r=60164724 +pos=<20303891,76310639,47902413>, r=86110011 +pos=<5590258,65228278,22729995>, r=62457193 +pos=<7423293,113176291,47365165>, r=83936992 +pos=<9618443,-3334255,39112439>, r=75771037 +pos=<-15665487,65099560,48409673>, r=57904562 +pos=<-7406634,100313652,40556843>, r=92712595 +pos=<-7808460,15185536,29431259>, r=84359733 +pos=<-20145227,53162066,88647521>, r=85184552 +pos=<37028648,69939239,6285541>, r=81834647 +pos=<5755081,53742866,-9631786>, r=83168760 +pos=<11994016,50570209,49770258>, r=76269963 +pos=<6880573,89480514,31780836>, r=76368504 +pos=<-46877937,54638115,63437148>, r=88182724 +pos=<16761128,23463725,25560039>, r=55383042 +pos=<25619949,52383554,-14813656>, r=73969587 +pos=<-26151263,32330589,41470378>, r=73517864 +pos=<19942771,70356015,76849403>, r=50492213 +pos=<-18161652,17316315,38537427>, r=83475483 +pos=<19062989,86048494,35866945>, r=56668035 +pos=<-45283899,38588597,49149050>, r=78713876 +pos=<34105015,57347311,44606084>, r=61167471 +pos=<-15777887,63979386,46604073>, r=58702364 +pos=<5832914,66060638,109347991>, r=92805279 +pos=<17688916,56658632,58192464>, r=96313666 +pos=<6355763,80927880,41100496>, r=59020806 +pos=<11173519,50579434,59312652>, r=88064738 +pos=<-3905996,71416341,38543106>, r=62328789 +pos=<-50059189,58354525,42463481>, r=91499385 +pos=<-21617101,65640062,44787685>, r=68018684 +pos=<-28761475,51594902,42803996>, r=63101533 +pos=<10929227,58507467,10052175>, r=63075266 +pos=<-38430792,66655079,49444346>, r=81190702 +pos=<20120979,102109536,16959693>, r=90578194 +pos=<34600983,35756404,-4274311>, r=79889376 +pos=<-1985799,36471724,17720308>, r=68961375 +pos=<9371162,74595589,17137716>, r=73635864 +pos=<-35424413,63651338,42482381>, r=82142638 +pos=<93401552,54313815,50150501>, r=78716951 +pos=<-22696154,84093664,56658502>, r=86677969 +pos=<19525187,110040479,38062588>, r=78001974 +pos=<97476663,48906067,37381359>, r=90153765 +pos=<-48884970,41892178,38254699>, r=89905675 +pos=<-38261205,49539612,45162847>, r=68187235 +pos=<12329525,96606028,48121504>, r=61704179 +pos=<15963978,65128289,16978694>, r=57734901 +pos=<54038930,70481357,52514735>, r=55867584 +pos=<50943781,17115083,52304231>, r=60583940 +pos=<-5316971,63234279,23170316>, r=70930133 +pos=<-25172929,61023213,37341459>, r=74404122 +pos=<-7958162,51343940,67947180>, r=50478836 +pos=<12938179,17142371,-2068348>, r=93155408 +pos=<71256040,61844770,58825834>, r=70759169 +pos=<-27836991,53199230,50107637>, r=56477741 +pos=<16324980,50429681,6527672>, r=53126236 +pos=<-45956739,53163320,38604771>, r=86064466 +pos=<39752810,53774122,38733506>, r=52013644 +pos=<-33745599,59418191,49681696>, r=69031372 +pos=<-28497173,63793496,42067427>, r=75772402 +pos=<6286360,83560415,66565753>, r=67069329 +pos=<-40313646,56194051,45088191>, r=76968934 +pos=<16089367,-9683997,29630552>, r=85132010 +pos=<-61079456,50836160,48029878>, r=89435091 +pos=<26966244,51393377,44782774>, r=75958671 +pos=<-29173237,73797967,37283576>, r=91236814 +pos=<1271177,74956095,4351643>, r=94882930 +pos=<18356992,113969420,31969672>, r=89191987 +pos=<-16219396,66963311,20454210>, r=88277780 +pos=<17902178,24928900,25492581>, r=52843910 +pos=<-30304830,40794011,45162895>, r=65515684 +pos=<-26059279,54777258,44873176>, r=61512551 +pos=<15962705,-38337216,52649509>, r=93871997 +pos=<7184804,97406353,31237970>, r=84532937 +pos=<-12830649,93509796,36334257>, r=95555380 +pos=<-1902919,79833792,43102878>, r=64183151 +pos=<28703163,53362092,49750365>, r=96179626 +pos=<40614768,51868084,-20096829>, r=93731751 +pos=<25224934,49041535,-2520198>, r=57938941 +pos=<-48247723,52419441,40947808>, r=85268652 +pos=<-9005314,62344449,26303409>, r=70595900 +pos=<-35117585,65797421,49967600>, r=76496766 +pos=<65379544,73545604,58604243>, r=76361836 +pos=<-32759275,58062871,36574874>, r=79796651 +pos=<12461111,94097210,71412780>, r=76278684 +pos=<-19648028,44351942,59944555>, r=54088591 +pos=<68402809,51033371,44638063>, r=55950319 +pos=<-66132053,55482609,48793647>, r=98370169 +pos=<82702128,62657521,56952070>, r=81144152 +pos=<36533114,75333188,34189527>, r=58828965 +pos=<20502867,-33876446,49317718>, r=85223433 +pos=<9983563,97159661,15043042>, r=97682254 +pos=<-2159259,48902834,96746263>, r=71038257 +pos=<-15241821,72631048,48188569>, r=65233539 +pos=<14650498,-12387842,23788068>, r=95116864 +pos=<-14745664,69121145,45012949>, r=64403194 +pos=<2518462,65994075,31066725>, r=57958054 +pos=<80883451,39653219,46612384>, r=71388369 +pos=<-33880870,45417012,45474342>, r=64157221 +pos=<62573621,69403890,53388124>, r=64198247 +pos=<19564144,10843057,22674533>, r=68085834 +pos=<-22587674,52853897,34615239>, r=66375524 +pos=<21177981,82769628,102287531>, r=87108994 +pos=<-62457583,53656011,48515817>, r=93146983 +pos=<-420183,64091071,1274409>, r=88786053 +pos=<6716148,61303582,4084095>, r=76052625 +pos=<-45251359,50530733,35773115>, r=85558178 +pos=<37712765,36164454,28185567>, r=50133237 +pos=<-542350,79084734,10008923>, r=95167367 +pos=<17790571,57587760,-4505711>, r=69852752 +pos=<61432442,50715808,38131859>, r=55168470 +pos=<40657404,66910002,14965209>, r=73754285 +pos=<-19741467,77975018,48243769>, r=75022122 +pos=<20095461,-22021809,43126331>, r=79967774 +pos=<13967131,84850969,46754369>, r=49678688 +pos=<53414915,80690085,18630207>, r=96627188 +pos=<569600,84105219,65967423>, r=72732559 +pos=<3212547,53765176,25083365>, r=51018431 +pos=<-4112307,61319000,21594481>, r=69385982 +pos=<16007390,51273935,54163353>, r=84801155 +pos=<19386558,26556288,47907041>, r=94993706 +pos=<41521152,25025600,101909467>, r=92855893 +pos=<-33388108,65879261,31992880>, r=92824122 +pos=<5586381,99306656,48519561>, r=70749900 +pos=<1716441,51943074,11706508>, r=64069278 +pos=<13146361,73129328,18761399>, r=66770779 +pos=<-29731452,67267528,37067231>, r=85480978 +pos=<-25510849,58768487,32130122>, r=77698460 +pos=<70273318,54536613,46065588>, r=59896786 +pos=<50914300,36221702,41138672>, r=50324644 +pos=<-38663426,49734697,47260896>, r=66686440 +pos=<-5484240,57879561,14449755>, r=74463223 +pos=<45783048,60623348,23874529>, r=63684046 +pos=<-20789054,56519799,29933067>, r=72924972 +pos=<-16313550,56766265,53361472>, r=49670842 +pos=<9689320,101333832,29922247>, r=87271442 +pos=<14123292,93906653,54393457>, r=57406384 +pos=<1393920,82543460,29091305>, r=77607788 +pos=<-34664967,71395253,48860522>, r=82748902 +pos=<-13904118,52232743,39078364>, r=52607793 +pos=<30126288,58751667,61875210>, r=61697173 +pos=<62034054,55504258,85347828>, r=81718735 +pos=<9101052,62872457,17929835>, r=61390903 +pos=<-18719028,24645697,33359032>, r=81881869 +pos=<13301456,118745374,60909736>, r=89583184 +pos=<84991079,49514117,30343688>, r=85313684 +pos=<13208799,60817505,96738161>, r=67576683 +pos=<-9630684,64018969,30647090>, r=68551822 +pos=<-6496822,27098753,16967827>, r=83597870 +pos=<-61057137,40354588,48789133>, r=93081121 +pos=<-30658615,63644817,27322920>, r=92529704 +pos=<-43841749,57458265,48326772>, r=78522473 +pos=<4656352,101928201,64940007>, r=85441419 +pos=<56763899,76471203,29436064>, r=84951142 +pos=<13190870,86887027,48905142>, r=50340216 +pos=<3926792,44502511,44642416>, r=60560138 +pos=<-44674606,53411137,66002919>, r=87318223 +pos=<-29176711,34807781,26228264>, r=89308499 +pos=<33561068,84785215,36449423>, r=63049589 +pos=<-19886390,46501782,28463280>, r=66088925 +pos=<268718,57397961,52643849>, r=85360107 +pos=<-11977687,73922329,77302457>, r=86432033 +pos=<-36840982,49772545,30878942>, r=81283742 +pos=<-69799729,51510288,48429761>, r=98429531 +pos=<-32106175,59670385,38221542>, r=79104506 +pos=<-44174460,51444445,33817602>, r=87350479 +pos=<61687350,61595679,34183736>, r=70251509 +pos=<5283456,88111200,25274882>, r=83102041 +pos=<-35024964,57468781,38861657>, r=79181335 +pos=<-3080055,51642486,9823290>, r=70448411 +pos=<-40827266,53891466,46077710>, r=74190197 +pos=<-21517271,13700912,44974098>, r=84009829 +pos=<-24825646,64999241,34167994>, r=81206173 +pos=<-33565564,60375763,30726904>, r=88763810 +pos=<-3426827,51132507,29853656>, r=50254875 +pos=<14968538,100319076,30103590>, r=80796271 +pos=<-4775657,64206984,4850751>, r=89681116 +pos=<-16954699,49056838,25200878>, r=66359811 +pos=<5945628,94474349,32730542>, r=81347528 +pos=<-2949935,71654913,30136107>, r=70017948 +pos=<-27854664,53098422,49432361>, r=57070481 +pos=<15263982,108602893,37894133>, r=80993976 +pos=<95680982,55252735,47904083>, r=84181801 +pos=<-3089597,14851649,69615233>, r=76701121 +pos=<16930350,43293529,101149146>, r=59773198 +pos=<-24275128,41013222,6900378>, r=97529098 +pos=<100613536,54087314,46881481>, r=88971685 +pos=<3343489,92729109,47230534>, r=67704674 +pos=<-17448926,63567593,41139451>, r=65426244 +pos=<-33240293,69148978,63790680>, r=89409485 +pos=<56571887,81587490,38461315>, r=80850207 +pos=<8055278,20978205,37616309>, r=54517906 +pos=<28639566,106367116,59903773>, r=73742911 +pos=<6196049,51233308,52896481>, r=94318829 +pos=<-28536954,44022611,27547916>, r=78134066 +pos=<-28079264,43435569,19438417>, r=86372885 +pos=<-23107802,49082948,46160757>, r=51579574 +pos=<-16361551,-508526,42643497>, r=95394163 +pos=<50459747,44332572,27234854>, r=55662949 +pos=<73198302,70247505,61923451>, r=84202058 +pos=<-43387281,64742471,49364731>, r=84314328 +pos=<-1670773,74945192,23829317>, r=78336064 +pos=<26564343,81327811,33635077>, r=55409159 +pos=<20257514,95904211,46462870>, r=54733203 +pos=<-20043556,66062548,47455717>, r=64199978 +pos=<-1688293,29441812,-1943011>, r=95357070 +pos=<-110894772,119310152,41454062>, r=87281719 +pos=<2921978,49183363,53078286>, r=97968683 +pos=<5693513,101352582,22114610>, r=99093778 +pos=<102975844,40692247,49558547>, r=89495573 +pos=<-32431607,48884085,34793350>, r=72071745 +pos=<8115066,124693818,46977683>, r=95150222 +pos=<-42057746,43259427,66856031>, r=84502541 +pos=<-14919195,22755164,-96684707>, r=81099553 +pos=<-19803964,83188553,33099591>, r=95442247 +pos=<-3875371,52330380,-1499953>, r=83255528 +pos=<12694458,55002663,94657393>, r=60195158 +pos=<-31476582,49202346,54276407>, r=58184928 +pos=<42486981,36157687,102342707>, r=83123038 +pos=<-58293678,53359014,56116846>, r=90999113 +pos=<-39768613,46059171,47847681>, r=67029341 +pos=<-19611935,49145102,32074354>, r=62232001 +pos=<14285872,-7219337,-106237083>, r=83635824 +pos=<-12353609,56782049,71726121>, r=64091308 +pos=<-42921619,62580562,43100688>, r=87950786 +pos=<-18883922,67472712,20845419>, r=91060513 +pos=<21194652,56111150,45098088>, r=63487792 +pos=<-88741567,-27063895,34907820>, r=95313368 +pos=<19365051,51568769,3057382>, r=54695551 +pos=<-34073685,52022165,21223484>, r=90421527 +pos=<48172660,72033644,49611164>, r=51747268 +pos=<45277630,63520270,15867305>, r=74082669 +pos=<37333953,79085565,77839983>, r=73091967 +pos=<-24267532,51045463,35947659>, r=64914743 +pos=<29210563,48961810,56293747>, r=97837804 +pos=<13549017,93141184,39601385>, r=65539962 +pos=<-30172654,69466004,56796372>, r=79664582 +pos=<-24991841,54370341,49031260>, r=55880074 +pos=<-17441068,57640555,92455301>, r=90766485 +pos=<7771504,90139437,41125434>, r=66791703 +pos=<-120267300,62090786,-14543982>, r=84102275 +pos=<-3200488,82718372,43586667>, r=67881372 +pos=<18184696,112705161,42983578>, r=77086086 +pos=<13095313,101816041,58660880>, r=70611127 +pos=<27714001,50226805,41561484>, r=53542325 +pos=<9404974,54003658,7989512>, r=62158325 +pos=<-2700521,80059903,33167033>, r=75142591 +pos=<-3249629,92887890,62714946>, r=82082001 +pos=<-43042212,29003255,54705706>, r=87592608 +pos=<-19147052,85510967,39932177>, r=90274994 +pos=<28207492,15379476,90410726>, r=77689789 +pos=<15130656,17150221,17320494>, r=71566332 +pos=<177205281,49575511,-3173832>, r=99132489 +pos=<26036743,12892985,21317863>, r=68596634 +pos=<65162030,53289073,24373204>, r=75230122 +pos=<-48002152,50870049,43981017>, r=80440352 +pos=<48898780,34156686,6241608>, r=85270972 +pos=<74020351,69063704,49770698>, r=74465439 +pos=<2602905,86043760,23622367>, r=85367656 +pos=<-5597747,92966423,48407092>, r=75706278 +pos=<18355246,5666922,29067559>, r=68077869 +pos=<-3305078,45408796,107624979>, r=84369208 +pos=<71880640,60056951,47882004>, r=65207841 +pos=<-40786832,54649696,75134537>, r=93800698 +pos=<877773,33678060,20953646>, r=65658341 +pos=<33816219,49155633,35745297>, r=72063879 +pos=<-14575166,53841598,-2875914>, r=96842593 +pos=<23811728,99203184,14329771>, r=89837464 +pos=<-10130934,64455983,49598623>, r=50537833 +pos=<-861523,40976994,49934544>, r=70464214 +pos=<12619739,61086380,-2382359>, r=76398496 +pos=<69916022,49269467,45706756>, r=54630807 +pos=<65750826,53573612,45046333>, r=55430229 +pos=<-36597974,61735870,36211684>, r=87671650 +pos=<-27934903,70553630,55254020>, r=76972067 +pos=<-22267685,72469383,47681249>, r=72605035 +pos=<-21317649,71157584,38334420>, r=79690050 +pos=<13653541,58224360,14853350>, r=55266782 +pos=<-77386292,131323514,27233225>, r=90192338 +pos=<1100664,66357866,14353245>, r=76453109 +pos=<11112851,49579187,6836479>, r=57179026 +pos=<43010063,90701411,15615412>, r=99248181 +pos=<-60133740,-8778062,-29097666>, r=75680098 +pos=<33043454,57048199,16341347>, r=54902568 +pos=<-34578842,45788423,29956333>, r=80001654 +pos=<-32039208,70149061,29757734>, r=97979755 +pos=<-25729677,69463004,40028696>, r=80713195 +pos=<17332613,64787981,-5823138>, r=78827744 +pos=<-31070552,80502196,40012001>, r=97109924 +pos=<18516099,82050938,38888335>, r=50195924 +pos=<34342796,63184545,54981500>, r=94398108 +pos=<-14112984,54055686,1230646>, r=92487198 +pos=<65125373,73949883,66596415>, r=84504260 +pos=<-10819331,69984620,81904365>, r=85937838 +pos=<-6893052,62736332,24648344>, r=70530580 +pos=<-69677962,53307149,49604353>, r=98930456 +pos=<69520531,83646798,38099514>, r=96219904 +pos=<-32645642,28707123,31866439>, r=93239658 +pos=<10011718,116595257,57133026>, r=86946134 +pos=<15854060,83471157,29895491>, r=63270967 +pos=<16980464,74077549,12458888>, r=70187443 +pos=<1650286,65453118,33119777>, r=56232207 +pos=<17049731,98916822,20828637>, r=86587686 +pos=<11345336,126647939,50055821>, r=90795962 +pos=<2857842,61099553,26020772>, r=57770299 +pos=<20873707,63977885,40011826>, r=73427967 +pos=<-61634287,50503909,52208034>, r=87576274 +pos=<19806792,85041806,23882249>, r=66902078 +pos=<-21103791,34927075,16821573>, r=90522765 +pos=<-11467278,89838280,40965134>, r=85889682 +pos=<-10930654,76735710,31285442>, r=81930607 +pos=<-8535562,41678818,32850604>, r=55173908 +pos=<5049245,78608231,74307285>, r=71096327 +pos=<8304290,-22453283,42498119>, r=92818519 +pos=<3891933,85705498,10957314>, r=96405508 +pos=<-28515541,50529703,12095379>, r=92499150 +pos=<-19353342,77478644,61742688>, r=81804230 +pos=<17985891,69599218,23211547>, r=53951034 +pos=<13911235,50734753,97683971>, r=57737403 +pos=<-48351026,42880095,44660112>, r=81978424 +pos=<-14847844,57239466,19429832>, r=78206654 +pos=<62259034,45976669,66911507>, r=57644758 +pos=<-20908688,53102906,44596533>, r=54964232 +pos=<-30130488,60912854,40271389>, r=76321411 +pos=<12564011,109367473,24698433>, r=97654183 +pos=<-4186189,53246824,46923207>, r=50299068 +pos=<-54319122,51580639,37761353>, r=93687591 +pos=<50700535,84304368,48552962>, r=67604106 +pos=<-357163,35421601,2133541>, r=83969861 +pos=<-21574040,42039450,11854376>, r=88847909 +pos=<-31782838,43551351,44823672>, r=64575533 +pos=<-6916155,62980186,41805016>, r=53640482 +pos=<101782982,48840391,46661204>, r=85114359 +pos=<-19549756,73434901,34162084>, r=84371833 +pos=<-62259754,41565412,-59319704>, r=56322651 +pos=<93463992,-60589215,81299318>, r=94657460 +pos=<61956817,55660454,47615298>, r=51154333 +pos=<19106263,88587204,68223856>, r=60934335 +pos=<-66105696,48859174,46044049>, r=94470099 +pos=<235149,88727582,30864503>, r=83177618 +pos=<15290642,41954673,49904297>, r=72923884 +pos=<81246457,27498069,39890948>, r=90627976 +pos=<-10274478,53237796,34754021>, r=54307417 +pos=<-61528581,48927156,41219868>, r=94785037 +pos=<-25672253,50491609,53239700>, r=52633101 +pos=<-9196348,75713091,78263491>, r=86402444 +pos=<-23849582,51405630,65992125>, r=64476882 +pos=<-23543739,59833227,49312878>, r=59613370 +pos=<4014526,99163174,34613072>, r=86084853 +pos=<37362873,64176592,106044278>, r=86416529 +pos=<81141907,49405483,39166149>, r=72533712 +pos=<-57682315,52664289,49844128>, r=86051628 +pos=<87094691,49640861,74760058>, r=90328074 +pos=<-50281544,28761709,44854346>, r=97833213 +pos=<-51034256,45640640,41782826>, r=84778541 +pos=<11634118,46276604,41620009>, r=89553809 +pos=<-39816037,63800256,49415986>, r=79749496 +pos=<-25125286,66707747,41731762>, r=75650761 +pos=<-13976205,49449036,1257054>, r=87717477 +pos=<12699793,43248135,97757607>, r=60657879 +pos=<72698485,78521776,36995676>, r=95376667 +pos=<-50854433,22431352,162463326>, r=53208774 +pos=<-24897315,50993894,43716605>, r=57723763 +pos=<-23231806,50371462,98099119>, r=94932176 +pos=<-23146396,53234996,34423945>, r=67506600 +pos=<17126593,-2666688,39439060>, r=67268626 +pos=<18783793,103911977,35849838>, r=74827751 +pos=<19745828,14118663,27612437>, r=59690643 +pos=<8168347,50227071,46408287>, r=80103227 +pos=<-16736687,69015235,48529412>, r=62772036 +pos=<6362154,53011065,40597969>, r=54779555 +pos=<-20780361,66500789,43606176>, r=69224558 +pos=<37828611,67680178,82058140>, r=66399364 +pos=<-46477745,66877614,45277196>, r=93627331 +pos=<1459724,75448201,18670921>, r=80866849 +pos=<576112,100129414,73047112>, r=95829939 +pos=<-32614680,51242558,46981619>, r=62425391 +pos=<11159909,89950222,49200544>, r=55138988 +pos=<-37130673,53383141,29543974>, r=86519002 +pos=<16001336,55898847,-1246462>, r=66693268 +pos=<5391373,45137998,49241302>, r=73252412 +pos=<-20686382,55996849,52167060>, r=52079843 +pos=<26696051,50193173,94484832>, r=50206624 +pos=<-14512022,39108612,5722017>, r=90849053 +pos=<4591490,46180445,9631365>, r=60764310 +pos=<-21674786,64848442,44823972>, r=67248459 +pos=<40147581,95874753,46159808>, r=71014871 +pos=<18564915,92158316,12783801>, r=86358815 +pos=<15079575,98887229,34653571>, r=74703566 +pos=<61623936,56202773,36593215>, r=62385669 +pos=<30200018,53720365,172759>, r=64899730 +pos=<8942255,95330756,68405243>, r=78023306 +pos=<43798195,117816115,55532472>, r=95979245 +pos=<81319484,46435358,48379773>, r=63274845 +pos=<101886393,41002764,50032544>, r=87621633 +pos=<-21498404,56604671,44502137>, r=59150123 +pos=<26219500,49662554,-5741660>, r=62776284 +pos=<90197281,38043749,35753741>, r=93170727 +pos=<17395543,67639144,104028061>, r=77501189 +pos=<-64737324,49321137,50141738>, r=89465983 +pos=<-1399370,80171389,41372841>, r=65747088 +pos=<40494502,82617210,49205658>, r=55058183 +pos=<-47492175,51761576,45176658>, r=79626445 +pos=<-13529721,62290583,77387519>, r=76437387 +pos=<25698290,75089131,29650030>, r=52289496 +pos=<-25535297,58742443,66926197>, r=74433535 +pos=<882518,66320315,22411983>, r=68575299 +pos=<3222539,79039830,30898154>, r=70468554 +pos=<-25329625,73385292,64963510>, r=86907994 +pos=<58020944,9478152,38795602>, r=86517694 +pos=<-32579632,46481632,16052138>, r=91213586 +pos=<-13580155,58635455,55285113>, r=50730736 +pos=<14012829,66217297,19394211>, r=58359591 +pos=<-31118113,50436197,50095755>, r=57007723 +pos=<20416087,33039388,48386965>, r=66043046 +pos=<-4281194,75759521,13549481>, r=92040469 +pos=<68118463,45203388,81286147>, r=78652135 +pos=<39644220,72068776,19561539>, r=73303535 +pos=<-705964,50269904,16214957>, r=60310065 +pos=<27325526,97187099,92454701>, r=95799760 +pos=<5960982,-14892251,57469923>, r=85249127 +pos=<-18948384,55999611,52978332>, r=51156240 +pos=<7927547,76966692,35407966>, r=59180346 +pos=<-20856579,17646405,34190772>, r=90187042 +pos=<-30895111,53322745,48010098>, r=61757064 +pos=<8061812,69776684,91030632>, r=75975662 +pos=<-24714188,63051583,42964029>, r=70350978 +pos=<92344188,134730656,-15123610>, r=64787681 +pos=<-47895744,66750452,48547618>, r=91647776 +pos=<11384553,49976389,52522545>, r=55840055 +pos=<9542033,81341011,40355032>, r=56993762 +pos=<-9905083,63113882,40290705>, r=58277909 +pos=<-6799980,99336688,47731682>, r=83954326 +pos=<-61438558,53078285,43527172>, r=96538904 +pos=<-24627077,50640465,37088612>, r=63728118 +pos=<7863466,5958024,30100269>, r=77245890 +pos=<-5283296,38737824,22447122>, r=65266282 +pos=<-3030754,90335000,72881549>, r=89476871 +pos=<11776628,65710821,-124893858>, r=87243589 +pos=<-46731645,54590845,60325150>, r=84877190 +pos=<-90371982,5936993,-1316402>, r=75877673 +pos=<-4550279,67393705,1797048>, r=95696196 +pos=<-32445961,62241902,42962717>, r=77274390 +pos=<-23744235,54542576,42944106>, r=60891880 +pos=<10554656,78715334,17546585>, r=76163452 +pos=<73403039,43607060,48780630>, r=57785874 +pos=<52997872,76506988,33516550>, r=77140419 +pos=<-32730910,69952434,31585764>, r=96646770 +pos=<-4149538,14269448,27270133>, r=83777633 +pos=<-1756914,44054585,52602958>, r=94857071 +pos=<14058206,50156547,58617483>, r=55613064 +pos=<-60998436,51722898,56184290>, r=92135288 +pos=<20170177,30135153,109729998>, r=78272738 +pos=<-25788310,43186327,43110007>, r=60659607 +pos=<-10956342,49114234,98109796>, r=81409961 +pos=<-55328944,44949737,49639272>, r=81907866 +pos=<-34009488,59403507,33246384>, r=85715764 +pos=<-2965657,76576391,55028859>, r=57800431 +pos=<7413674,86438176,17796179>, r=86777515 +pos=<-21711925,50561714,40968389>, r=56855074 +pos=<-21935755,57627196,47759087>, r=57353129 +pos=<46233171,67173397,59316206>, r=51555253 +pos=<-28605529,53959074,44790849>, r=63323170 +pos=<-37331683,59606501,66895617>, r=87063539 +pos=<-14320904,64600927,81698922>, r=83850287 +pos=<93271265,70178629,45577939>, r=99024068 +pos=<-51619641,57204155,57252934>, r=89306280 +pos=<-10064461,62811203,79529853>, r=75635033 +pos=<50872125,70982165,53135094>, r=53821853 +pos=<52515155,55861758,37450740>, r=52078309 +pos=<-42764254,57317670,63195746>, r=86507214 +pos=<-14666206,59083822,46747995>, r=52551299 +pos=<-42771930,34423391,32711429>, r=96804727 +pos=<6266712,6088494,30991403>, r=77821177 +pos=<51462469,57440936,-461471>, r=90517015 +pos=<-12869217,60606985,9028743>, r=89996612 +pos=<-150487035,61069438,27042469>, r=87270110 +pos=<-62286565,52853523,48825319>, r=91863932 +pos=<-57280569,49603035,55210373>, r=85323538 +pos=<16061091,112700280,71038462>, r=90907173 +pos=<-32346623,67505659,75578466>, r=98660525 +pos=<55405774,51919734,72632698>, r=58790664 +pos=<12459178,-21870541,42368913>, r=88210249 +pos=<-12691430,56144490,29572885>, r=64812583 +pos=<19666265,78157022,33112939>, r=50926997 +pos=<-7927360,15910153,21694134>, r=91491416 +pos=<77828835,55223306,31861649>, r=82342659 +pos=<13265598,121110964,61749128>, r=92824052 +pos=<64375726,50242952,84957255>, r=78408497 +pos=<1306959,56655066,28579166>, r=52318284 +pos=<46727158,79447435,53557220>, r=58564289 +pos=<-27714219,53217642,43728204>, r=62752855 +pos=<59918963,53898220,59686526>, r=52336410 +pos=<-32596935,57734511,49541938>, r=66338706 +pos=<5159309,93023210,32255996>, r=81157367 +pos=<107052351,53806019,44035281>, r=97975185 +pos=<-27872651,65081732,39041779>, r=79462342 +pos=<15964428,97375924,69214775>, r=73855814 +pos=<-34037385,71304454,46429668>, r=84461349 +pos=<-17680690,50423741,28469640>, r=65183943 +pos=<-41664053,58818022,31253357>, r=94778438 +pos=<76262158,67702149,27798993>, r=97317481 +pos=<-3791121,69578126,11107789>, r=87810858 +pos=<-35048739,49030000,57700373>, r=65008853 +pos=<-5363047,111060916,45527914>, r=96445229 +pos=<-40021935,45001582,62586909>, r=76455315 +pos=<19977257,58140375,49317605>, r=72566336 +pos=<2191757,67451366,38746005>, r=52063163 +pos=<-65658507,50295529,42616310>, r=98886955 +pos=<-15142631,57271340,23584610>, r=74378564 +pos=<-22873365,12407093,40055525>, r=91578482 +pos=<-7339862,56073879,33613736>, r=55349338 +pos=<9361582,60754907,-3336335>, r=80278884 +pos=<10410132,93476342,48876299>, r=59739066 +pos=<-15458976,75333283,37965282>, r=78376187 +pos=<-5706721,63860739,61977165>, r=54774380 +pos=<-27102122,60799405,49573871>, r=63877097 +pos=<-36482416,66508426,48784022>, r=79756002 +pos=<-31653698,67588756,28273101>, r=96518667 +pos=<44190745,94893234,58135048>, r=76051941 +pos=<17089831,104847960,32944941>, r=80362423 +pos=<27475605,134517624,44206920>, r=98938430 +pos=<8673337,54132140,20034992>, r=50973377 +pos=<56196148,64478829,46453902>, r=55373213 +pos=<-32943306,36770609,26734123>, r=90606197 +pos=<56707506,72412415,44280055>, r=65991974 +pos=<-2433353,80878331,29625377>, r=79235596 +pos=<36537752,8459131,46910125>, r=57939087 +pos=<-51220670,51985115,61823556>, r=88258910 +pos=<39920466,52035468,43828621>, r=79912826 +pos=<-19145339,53869039,6905802>, r=91657728 +pos=<-35853878,64582167,31160616>, r=94824609 +pos=<-13577755,90558343,42331267>, r=87353986 +pos=<-570192,95069175,40398215>, r=80790309 +pos=<92123086,65787144,46332081>, r=92730512 +pos=<31272190,18811599,112007566>, r=98919131 +pos=<6777159,40959206,-10440173>, r=83871488 +pos=<-9740566,69691901,12612822>, r=92369217 +pos=<37166764,36666305,89582855>, r=64534253 +pos=<107124043,49227463,49523366>, r=87980656 +pos=<15772843,35909512,13605576>, r=55879690 +pos=<-2657558,93963466,32560129>, r=89610443 +pos=<20433218,28444321,83440331>, r=53410724 +pos=<-22999550,56419067,55438221>, r=58086365 +pos=<-30789611,50548398,52659266>, r=57226790 +pos=<37531473,-8930527,40589513>, r=82643022 +pos=<4510852,51390212,91735964>, r=61845252 +pos=<11714056,21660233,102449491>, r=87923156 +pos=<-4609352,70084374,33051750>, r=67191135 +pos=<12630645,85874601,41208514>, r=57584986 +pos=<52324981,31249573,59591472>, r=55117999 +pos=<-60229360,55326680,48364277>, r=92740940 +pos=<-29194872,50609586,50102783>, r=55250913 +pos=<4412399,52508921,15633312>, r=58013149 +pos=<43693562,54331097,49869587>, r=83284604 +pos=<-466173,53751163,29329192>, r=50437574 +pos=<-19674258,58705145,47341139>, r=56587549 +pos=<-12766668,15681359,33575985>, r=84676902 +pos=<-134995,51807106,-18809128>, r=96300799 +pos=<7950500,104210339,26139891>, r=95669304 +pos=<8916281,81096489,71160024>, r=66569989 +pos=<83307491,66020420,34621507>, r=95858500 +pos=<46932518,66783036,34382608>, r=60485019 +pos=<-25525627,67090779,40768720>, r=77396938 +pos=<113140622,51840761,52466329>, r=96280288 +pos=<-43234449,50840373,49596026>, r=70027957 +pos=<9636628,43731791,47427570>, r=80257863 +pos=<16952827,96460043,21330870>, r=83725500 +pos=<-3364858,5758742,53812510>, r=70266585 +pos=<42097321,66603859,28141668>, r=61711733 +pos=<2581735,105789003,35836791>, r=92920066 +pos=<56876747,52274927,25445428>, r=64858343 +pos=<7319198,15550258,8014801>, r=90283312 +pos=<-12128060,66079210,46738231>, r=57018198 +pos=<15875808,57958946,10017572>, r=57615030 +pos=<9008316,64537785,29247439>, r=51831251 +pos=<42734666,105437354,40314540>, r=89009550 +pos=<-22819084,54875169,48613105>, r=54630571 +pos=<14813442,58095859,34114480>, r=69712133 +pos=<2843789,86297879,33599696>, r=75403845 +pos=<14953623,59445003,16791933>, r=53248686 +pos=<-4540706,63227776,28850990>, r=64466644 +pos=<-7579268,81750777,25396831>, r=89482641 +pos=<10341720,94404216,24198039>, r=85413675 +pos=<-12855439,39482491,77851684>, r=70073123 +pos=<-22144366,78112861,37678571>, r=88128084 +pos=<-22967634,58362529,45789018>, r=61090313 +pos=<42505708,52433166,8371584>, r=67719588 +pos=<16465030,38392367,52821832>, r=71645146 +pos=<-51535228,50034314,39109816>, r=88008905 +pos=<11154064,82077078,19690276>, r=76782195 +pos=<10005555,80360662,66175698>, r=59760392 +pos=<-17419709,33655776,56183612>, r=58795541 +pos=<74041597,59582976,47357102>, r=67419569 +pos=<6179982,58514887,53789025>, r=92502894 +pos=<11678925,3162913,71519958>, r=75526365 +pos=<30869340,103105040,65191292>, r=77998432 +pos=<-11546274,78615351,45477010>, r=70233791 +pos=<-37165008,57404141,37319960>, r=82798347 +pos=<4474665,51437076,2992470>, r=69519498 +pos=<-61332836,45898973,54745279>, r=89027102 +pos=<-2779606,21982858,97525759>, r=97170505 +pos=<78379666,49066780,45038094>, r=63560451 +pos=<-14457352,40433767,32592761>, r=62598392 +pos=<-21858453,41279729,47945053>, r=53801362 +pos=<-26586799,64565572,50001408>, r=66700201 +pos=<49404816,54007507,13171867>, r=71392613 +pos=<69349808,86969766,49773216>, r=87698512 +pos=<66791475,5066228,40210322>, r=98285617 +pos=<-64444326,51819871,48841635>, r=92971771 +pos=<-33728678,50942768,48911440>, r=61309160 +pos=<-14191687,67205626,80526920>, r=85153869 +pos=<-29342061,71087750,33895963>, r=92083126 +pos=<63069791,61835294,23548919>, r=82508278 +pos=<-6423334,57952740,30429625>, r=59495770 +pos=<-22677994,81175697,66757848>, r=93841062 +pos=<17487288,23097254,30379779>, r=50203302 +pos=<-125591393,66850972,12060209>, r=92174113 +pos=<10456555,50805970,2764011>, r=63134594 +pos=<29134707,67255989,-14539402>, r=92082270 +pos=<105903840,52177930,41797183>, r=97436915 +pos=<91080,86368478,20306190>, r=91520488 +pos=<10655718,59472497,-3940819>, r=78306752 +pos=<-25271221,90884868,49543297>, r=92162097 +pos=<-13980758,58340640,45471371>, r=52399215 +pos=<26527216,54132539,10614433>, r=51197829 +pos=<-66553060,50877313,50024297>, r=92955356 +pos=<7707483,94775516,37451058>, r=75166173 +pos=<-12418781,64557411,41713810>, r=60811666 +pos=<32824183,57014427,4361913>, r=66629148 +pos=<-48266481,56309485,49363441>, r=80761691 +pos=<-27422137,87305165,45451290>, r=94825167 +pos=<-6100247,50616340,25832014>, r=56433914 +pos=<-38248607,31252354,60760819>, r=86605298 +pos=<36142986,58033027,119115377>, r=92123894 +pos=<1806384,223126255,46308572>, r=69490835 +pos=<54371458,58071064,-4297127>, r=97891722 +pos=<38619845,42916522,122574392>, r=92728625 +pos=<11241820,68519959,21403136>, r=61424272 +pos=<2235399,60301147,15136749>, r=68478790 +pos=<-2486952,93852830,43206391>, r=78682547 +pos=<-6976590,84652374,38255612>, r=78922562 +pos=<-46046864,46754490,33404484>, r=87055750 +pos=<-63245875,56608859,54411844>, r=97496339 +pos=<-6260032,40730522,18355377>, r=68341942 +pos=<3655623,16746276,14754100>, r=86011583 +pos=<-57649658,45163153,49883183>, r=83770988 +pos=<-22365900,58543320,37312371>, r=69146057 +pos=<-2659753,66927786,1509912>, r=93626813 +pos=<78425267,61772308,31980105>, r=89370002 +pos=<-5792872,16390032,58448860>, r=66699788 +pos=<13502218,8011414,27690082>, r=71964284 +pos=<15662956,100883919,16652514>, r=94117725 +pos=<-27982823,58363346,52949414>, r=62525337 +pos=<-20076812,70016345,62303108>, r=75626559 +pos=<-12199165,51486079,37144420>, r=52090161 +pos=<65489525,59775056,39457247>, r=66959486 +pos=<28988834,97436890,34373844>, r=73204349 +pos=<-1298553,66305165,40338681>, r=52814190 +pos=<-23019264,62811828,14486567>, r=96893709 +pos=<-44473237,59840005,48299068>, r=81563585 +pos=<65710037,50685865,46684812>, r=50863207 +pos=<57876365,34367583,59137691>, r=57097333 +pos=<20857961,87367877,6687890>, r=85371636 +pos=<-23249164,63105443,28083736>, r=83820257 +pos=<8010982,43808377,-6072329>, r=75420546 +pos=<-7886851,96930290,46915687>, r=83450627 +pos=<-8708520,54903952,17476103>, r=71685597 +pos=<-9041389,72875525,26705848>, r=80760471 +pos=<17727546,33646899,25129>, r=69768414 +pos=<20687393,26123339,-19137626>, r=93494470 +pos=<-39609488,46799081,47127212>, r=66851286 +pos=<-3646983,98560734,33425164>, r=94331809 +pos=<3485853,69925120,65172287>, r=54841491 +pos=<-29443780,26940253,44037187>, r=79634058 +pos=<20619578,68574147,879108>, r=72624631 +pos=<14390618,49373291,47497883>, r=60638715 +pos=<-49845392,45000860,26785462>, r=99226638 +pos=<-59562465,34267964,48672891>, r=97789458 +pos=<-6346981,3527196,44016263>, r=79971123 +pos=<77743233,57733274,45709921>, r=70918710 +pos=<-31391791,51399490,49373815>, r=58966773 +pos=<62127122,61610757,33123005>, r=71766970 +pos=<57792255,89304415,42522193>, r=85726549 +pos=<14308919,64617042,-19077920>, r=94935250 +pos=<-13410494,57946640,43726015>, r=53180272 +pos=<257809,70469514,22447830>, r=73313444 +pos=<-2251250,52625718,83343235>, r=61449839 +pos=<-30774327,54414203,46773830>, r=63963857 +pos=<-15951324,68550112,43283893>, r=66767093 +pos=<-19182160,71303883,45141724>, r=70893621 +pos=<-36060360,50244768,38473986>, r=73380346 +pos=<-13730821,51532578,40670147>, r=50142425 +pos=<-11435156,79357239,31228700>, r=85113006 +pos=<-5678299,87489889,41626078>, r=77091270 +pos=<8739446,16648317,45543645>, r=50236327 +pos=<-19331613,64553140,58793421>, r=65907903 +pos=<-29611001,14073482,45232620>, r=91472836 +pos=<8941863,94910846,40459302>, r=71059048 +pos=<-40761819,59468622,49346148>, r=76433650 +pos=<4343551,85385986,45466767>, r=61124866 +pos=<-22177207,50375490,69798895>, r=65581142 +pos=<18538560,101071117,42535514>, r=65546302 +pos=<16679994,57387579,50086645>, r=77273767 +pos=<-40754986,49327339,35496344>, r=80135160 +pos=<-42137035,68104815,43123472>, r=92667820 +pos=<-33297966,74528415,50063208>, r=83312382 +pos=<-1516605,71770703,19476803>, r=79359669 +pos=<12665073,68014777,105798750>, r=84378075 +pos=<-32757819,49073817,52537506>, r=57598763 +pos=<-33519066,45859525,40007164>, r=68819947 +pos=<86082037,52568755,46592409>, r=73210472 +pos=<-71556811,52200916,50084496>, r=99222384 +pos=<-28139761,50073799,22611947>, r=81150858 +pos=<13541164,91369683,32775224>, r=70602520 +pos=<-16317236,56068753,54560328>, r=50175959 +pos=<-11331344,51596532,85248648>, r=71406256 +pos=<-5931204,91111332,52396432>, r=72668490 +pos=<90289920,65845518,39399462>, r=97888047 +pos=<-3984592,51498988,48025950>, r=62092105 +pos=<3555037,87300161,42451961>, r=66842347 +pos=<-24589823,38535355,42558945>, r=64663151 +pos=<8782570,35154521,12462985>, r=64767726 +pos=<-37716780,63787472,59928868>, r=84662993 +pos=<-44579937,59640123,30698580>, r=99070649 +pos=<-55181742,64393089,46049932>, r=99074084 +pos=<-18035862,49604454,33775573>, r=59413952 +pos=<-12016341,59298834,30659871>, r=66204470 +pos=<18780968,7353383,18991027>, r=76042336 +pos=<14767876,70957328,48457261>, r=68122955 +pos=<176257,53187561,-8060611>, r=86621097 +pos=<-40135229,51998675,40377712>, r=77305429 +pos=<-56334739,53536066,42888336>, r=92531638 +pos=<-11171826,46664881,16674320>, r=69000193 +pos=<-38417421,73491747,43836162>, r=93622256 +pos=<6291993,59441100,47457386>, r=56292961 +pos=<2205547,114639308,46447857>, r=91535176 +pos=<15765659,98173971,47159153>, r=60798366 +pos=<-675874,54765553,961325>, r=80029272 +pos=<-24007098,72054783,48164877>, r=73446429 +pos=<12661038,42714476,49527033>, r=59232028 +pos=<-9301220,78721935,43851305>, r=69721021 +pos=<18229397,66808011,-9490519>, r=83618304 +pos=<-2812165,50834360,-17192926>, r=96388788 +pos=<15273284,83684501,9255317>, r=84705079 +pos=<25313976,76586387,94916933>, r=75649821 +pos=<83496364,57748330,44686539>, r=77710636 +pos=<-36028080,64272970,53195701>, r=76726277 +pos=<261370,98959952,41421871>, r=82826175 +pos=<19961413,92709316,2188488>, r=96108590 +pos=<-27744282,54399903,52610801>, r=57984580 +pos=<-37764856,55482711,45273766>, r=73523082 +pos=<6152034,51895689,112513637>, r=81486818 +pos=<-3620749,75990775,50026613>, r=55134415 +pos=<23685113,52343937,-27788152>, r=84969616 +pos=<26593265,67955055,22317572>, r=53382829 +pos=<5862115,67320726,-7744908>, r=94752728 +pos=<44977728,77579884,40227014>, r=63483062 +pos=<74393904,54186069,86175718>, r=93588247 +pos=<-30553363,66174930,35164879>, r=87112949 +pos=<846033,79419918,17759962>, r=86363085 +pos=<-40099609,59337331,41208658>, r=83777471 +pos=<-55842569,51636231,46920841>, r=86107111 +pos=<17515213,55299696,-11816155>, r=75149814 +pos=<-37784825,39818181,75335333>, r=92149923 +pos=<-12420237,59829730,35273741>, r=62525397 +pos=<-32523179,51372964,46315822>, r=63129489 +pos=<-30806438,72779505,49545610>, r=79589491 +pos=<-23829845,50807049,41247927>, r=58938154 +pos=<4660069,-16707481,46183487>, r=87031514 +pos=<-19549685,80746152,49937584>, r=75907412 +pos=<-41545505,49666087,63429881>, r=77870992 +pos=<-9176964,70779012,38604780>, r=66900348 +pos=<19366593,75787464,24120212>, r=57849927 +pos=<-14750430,73417796,44573391>, r=69144019 +pos=<-31774450,57071943,28643145>, r=85752443 +pos=<-7965034,60706991,44164680>, r=50056547 +pos=<51214616,73858526,38715005>, r=67510288 +pos=<10251526,69070534,101419818>, r=83468358 +pos=<-4958688,64877199,5190665>, r=90194415 +pos=<-36841538,57544331,33454243>, r=86481108 +pos=<-18958623,55225437,48608264>, r=51125038 +pos=<-3280361,53433769,-10771980>, r=93035347 +pos=<12825120,52631982,48360699>, r=96729476 +pos=<-42088987,52508004,30671939>, r=89474612 +pos=<-35099129,67549370,49921294>, r=78276592 +pos=<-6571815,67176770,76063719>, r=73042022 +pos=<2416377,56619494,72699592>, r=50132248 +pos=<97064159,50626941,48020070>, r=80823113 +pos=<51272253,26380803,33326913>, r=68335442 +pos=<9342781,53889780,43080304>, r=95582105 +pos=<-1683556,74871475,26684699>, r=75419689 +pos=<8655690,7777306,47799320>, r=56935265 +pos=<17035815,109258089,18976615>, r=98795114 +pos=<24611871,66002331,-21792415>, r=93558729 +pos=<31447616,56064626,18586455>, r=50077924 +pos=<-5130339,-22115664,52509829>, r=98603762 +pos=<92722633,107452480,143663345>, r=61974061 +pos=<-70026018,75795232,-32798349>, r=88409720 +pos=<15619226,95376541,39039546>, r=66267023 +pos=<-1207251,78798343,57094406>, r=60329522 +pos=<2132042,10320424,31576336>, r=77138788 +pos=<82004303,49184026,53999531>, r=64020754 +pos=<63570907,37966831,10497262>, r=91877487 +pos=<12030100,85242976,32983936>, r=65778531 +pos=<47765320,67685594,9420635>, r=87182355 +pos=<-25084947,55874463,49173858>, r=57334709 +pos=<37219734,65474633,8637481>, r=75209281 +pos=<23232094,68810264,43970026>, r=51966614 +pos=<9716868,85176052,86308160>, r=84996869 +pos=<-15307394,68315425,79438673>, r=86291752 +pos=<-24943052,40142371,19904420>, r=86063831 +pos=<-62778009,55062212,48188208>, r=95201334 +pos=<15774791,78686937,10759637>, r=77701773 +pos=<2412046,90195442,37515010>, r=75817676 +pos=<15199931,75830351,93500764>, r=77360701 +pos=<9763716,49114305,-19374106>, r=84274068 +pos=<19644689,89449989,35579117>, r=59775441 +pos=<12395354,50087041,5657795>, r=57583144 +pos=<12068322,56646634,81855752>, r=49663605 +pos=<-22969583,59602246,34244087>, r=73876898 +pos=<7580461,91934347,45722448>, r=64180664 +pos=<-3560538,72561264,14695420>, r=86975860 +pos=<-45074040,57657932,48541858>, r=79739309 +pos=<-18398078,65110734,53891019>, r=60629463 +pos=<44224718,33095683,31706952>, r=56192890 +pos=<-10774711,48950748,26982525>, r=58292086 +pos=<2605308,68722337,27786615>, r=63879636 +pos=<-1339359,24098920,22336372>, r=76071679 +pos=<-4438041,72545226,25089955>, r=77442602 +pos=<-6246231,34031597,15411121>, r=77971312 +pos=<-23002804,57043932,81328580>, r=84605074 +pos=<35048807,50807135,49019441>, r=94840805 +pos=<1863063,64010732,24909086>, r=62787946 +pos=<76640525,56175554,25669192>, r=88299186 +pos=<34310529,75546211,13529288>, r=77479538 +pos=<46878403,67399215,21839672>, r=73590048 +pos=<-29566728,48860198,32191929>, r=71784211 +pos=<47336901,99330017,45502113>, r=82316912 +pos=<35783602,102518119,56209209>, r=73343452 +pos=<38055746,55924973,-6345047>, r=81477836 +pos=<8608899,54529451,44721618>, r=91048066 +pos=<-23322941,35425975,65556423>, r=72301694 +pos=<66175266,61309696,33060367>, r=75577292 +pos=<-2630171,77181433,44606184>, r=60754647 +pos=<15615476,103373392,46114344>, r=67192771 +pos=<18720101,-5014280,15405990>, r=92055760 +pos=<19437849,105379399,13182198>, r=98308555 +pos=<24872430,207905077,10571812>, r=64706362 +pos=<-3900891,-17837213,48993241>, r=93912785 +pos=<4628129,84592380,46983368>, r=58530690 +pos=<-8500784,81354637,32649712>, r=82755023 +pos=<-21040160,59220604,49033361>, r=56776774 +pos=<-8569766,61063036,36874485>, r=58307563 +pos=<-61691190,46793583,48944174>, r=87121010 +pos=<97543945,38893710,37478590>, r=97942147 +pos=<-32468438,39994089,46330515>, r=67311544 +pos=<-50446554,34241799,50005562>, r=87366811 +pos=<80764682,64638264,33543385>, r=93011711 +pos=<-3359685,69242442,35795102>, r=62356521 +pos=<-7066785,39947970,1295266>, r=86991146 +pos=<19698314,74240211,86655363>, r=64426800 +pos=<-159219987,73286724,43691580>, r=80602293 +pos=<-10749338,68308806,69893809>, r=72181492 +pos=<4267160,31408568,28900755>, r=56591171 +pos=<29153070,55281220,-5024215>, r=70610604 +pos=<-31999404,51919732,53639756>, r=60788407 +pos=<20796365,7869106,-3949821>, r=96451932 +pos=<761180,51627157,44832255>, r=67227808 +pos=<-10078249,63600979,47754790>, r=51473612 +pos=<69320150,61417891,36283551>, r=75606574 +pos=<9296385,49261814,12112891>, r=53401849 +pos=<-7317543,43835002,26851576>, r=57798571 +pos=<-20323301,52285624,17357518>, r=80800563 +pos=<-32371707,7687445,53828813>, r=97361034 +pos=<-34553554,52364620,37734663>, r=74733323 +pos=<3375914,51345583,-24900541>, r=98419527 +pos=<31847704,77972619,20965665>, r=70006808 +pos=<-21691572,68915691,44331517>, r=71825213 +pos=<41498667,-13390854,46954930>, r=84705082 +pos=<7864562,60188918,15324170>, r=62549378 +pos=<-18338249,74638914,36374459>, r=82152065 +pos=<70679462,52058503,8730493>, r=95159593 +pos=<-37359151,56045979,34000785>, r=84954024 +pos=<3262220,66835742,37695863>, r=51427144 From c7538c902a5e000448e5985bde7c6b7f3d7d60d3 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Tue, 31 Dec 2024 00:47:24 -0500 Subject: [PATCH 38/48] 2018: d23: ex1: add solution --- 2018/d23/ex1/ex1.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 2018/d23/ex1/ex1.py diff --git a/2018/d23/ex1/ex1.py b/2018/d23/ex1/ex1.py new file mode 100755 index 0000000..34c2d4c --- /dev/null +++ b/2018/d23/ex1/ex1.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python + +import sys +from typing import NamedTuple + + +class Point(NamedTuple): + x: int + y: int + z: int + + +class NanoBot(NamedTuple): + pos: Point + r: int + + +def solve(input: str) -> int: + def parse_nanobot(input: str) -> NanoBot: + pos, r = input.split(", ") + pos = pos.removeprefix("pos=<").removesuffix(">") + r = r.removeprefix("r=") + return NanoBot(Point(*(int(n) for n in pos.split(","))), int(r)) + + def parse(input: list[str]) -> list[NanoBot]: + return [parse_nanobot(line) for line in input] + + def dist(lhs: Point, rhs: Point) -> int: + return sum(abs(l - r) for l, r in zip(lhs, rhs)) + + bots = parse(input.splitlines()) + strongest = max(bots, key=lambda b: b.r) + return sum(dist(strongest.pos, bot.pos) <= strongest.r for bot in bots) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 3353a225861333a3b9f0642de489e067952503c3 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Tue, 31 Dec 2024 00:47:30 -0500 Subject: [PATCH 39/48] 2018: d23: ex2: add input --- 2018/d23/ex2/input | 1000 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1000 insertions(+) create mode 100644 2018/d23/ex2/input diff --git a/2018/d23/ex2/input b/2018/d23/ex2/input new file mode 100644 index 0000000..56ad959 --- /dev/null +++ b/2018/d23/ex2/input @@ -0,0 +1,1000 @@ +pos=<-26800153,54191419,14631486>, r=91909373 +pos=<2726122,52059927,-16784250>, r=91667585 +pos=<-1106302,78464933,37274659>, r=67846291 +pos=<-14676967,62367449,15230451>, r=87363344 +pos=<19283542,94968325,14626623>, r=86607330 +pos=<-1066104,66788622,7322926>, r=86081067 +pos=<-10327813,66959254,82168838>, r=82685423 +pos=<-12782412,37618518,45011118>, r=51320903 +pos=<-31606634,65230754,46027117>, r=76359614 +pos=<6733972,69543990,63956247>, r=49996039 +pos=<33854876,65000033,-14697092>, r=94704404 +pos=<-20114176,65135803,21306016>, r=89493234 +pos=<19966373,79368650,31671383>, r=53280220 +pos=<-44504614,61642083,47567346>, r=84128697 +pos=<-56959179,50805665,60035489>, r=91029871 +pos=<3833359,78337041,45411039>, r=54641822 +pos=<-9740514,69356208,46871803>, r=57774088 +pos=<79176394,59665612,42223492>, r=77771037 +pos=<-44885922,65011789,56458424>, r=89585685 +pos=<7188801,67430842,33413070>, r=52378146 +pos=<71981622,67198516,44650418>, r=75682568 +pos=<8471951,53949119,56588672>, r=90202717 +pos=<-21149813,53082243,44100402>, r=55681037 +pos=<61465091,51705189,24744707>, r=69577644 +pos=<-48427679,48875846,40504608>, r=82348095 +pos=<-16413220,64687719,48523359>, r=58127145 +pos=<41280618,18195971,22818620>, r=77036684 +pos=<24578568,12510958,32539456>, r=56298676 +pos=<10014943,77504976,13215099>, r=79824160 +pos=<32099889,55841549,33503165>, r=76599362 +pos=<-25934900,49453902,45457577>, r=55480521 +pos=<194428994,55319521,14326800>, r=72677431 +pos=<64044431,68921123,53558270>, r=65356299 +pos=<8611401,78916429,97105501>, r=90640047 +pos=<-3354425,50156520,49667979>, r=94822817 +pos=<86727740,49651294,37209042>, r=80322343 +pos=<-25482281,71458393,35135292>, r=87354550 +pos=<-56538221,50861580,45009103>, r=87939856 +pos=<25189303,52501081,55911181>, r=77913908 +pos=<-43747179,38521232,45927670>, r=80465847 +pos=<28680978,69986439,11874426>, r=67945167 +pos=<84354566,50011206,47992976>, r=67524866 +pos=<-44279563,46448363,48653641>, r=70345204 +pos=<-21033349,75676883,30863095>, r=91396305 +pos=<6132544,89170880,28377983>, r=80209515 +pos=<5838072,86938933,42122977>, r=64527115 +pos=<19427534,-8143678,45615709>, r=64268506 +pos=<14819968,60850429,35713119>, r=50675563 +pos=<2961664,78461502,47449899>, r=53599108 +pos=<-43363971,60346889,68132431>, r=95072805 +pos=<5444783,51735310,5801133>, r=66038720 +pos=<51608916,70339966,28851636>, r=74249476 +pos=<-39895346,56431956,29333441>, r=92543042 +pos=<-8613222,49276399,-6637951>, r=90076739 +pos=<68217090,56383884,49837668>, r=55915388 +pos=<-23031224,75798534,46219198>, r=78159777 +pos=<9982548,48837003,95009075>, r=57093080 +pos=<11783440,101197289,19256213>, r=95706918 +pos=<5523354,59300428,13433224>, r=65893184 +pos=<18607093,110399850,43651250>, r=73690807 +pos=<2119163,109847789,55948700>, r=86906887 +pos=<-47528630,71901316,54008364>, r=96667956 +pos=<68703448,66891625,43604620>, r=73142546 +pos=<-11507569,59058987,14159146>, r=81956819 +pos=<-20564060,52868253,42381061>, r=56600509 +pos=<7665464,86789990,47784126>, r=56889621 +pos=<-10994018,54755473,96964752>, r=85943807 +pos=<6628394,78144875,18768936>, r=78296745 +pos=<53248088,44523505,74094303>, r=57269778 +pos=<-31135955,38636131,22867651>, r=90799844 +pos=<-120483,94499416,39227452>, r=80941609 +pos=<43961851,57733220,13187610>, r=69659612 +pos=<-17145296,52725010,33700875>, r=61718656 +pos=<42398975,51457938,48534837>, r=50684428 +pos=<32989135,27108010,-11418788>, r=94070570 +pos=<-41281619,58529318,43713414>, r=81646835 +pos=<15676046,87664036,4474396>, r=93062768 +pos=<91288458,56341397,53854879>, r=80317303 +pos=<-13993707,51443582,19773222>, r=71213598 +pos=<-26166431,44282826,62488660>, r=63220434 +pos=<13760583,96393695,84713578>, r=90576204 +pos=<1399179,59472056,30865564>, r=52756738 +pos=<44353782,84240054,46022166>, r=63724044 +pos=<15223202,64424455,110031048>, r=82461868 +pos=<1831436,72155489,42370476>, r=53502789 +pos=<-3212782,90085872,69767179>, r=86295528 +pos=<2924551,84160632,22919443>, r=83865971 +pos=<-5277120,114055875,46749493>, r=98132946 +pos=<-44091102,60876760,34007702>, r=96509437 +pos=<9170763,60331193,24167167>, r=52542457 +pos=<4244629,37697533,19314365>, r=59911105 +pos=<66675928,53812019,35745466>, r=65894729 +pos=<17791554,54901626,27988883>, r=70869570 +pos=<20375935,50364328,-1807360>, r=57344942 +pos=<35621840,44634149,62393026>, r=70971770 +pos=<-42604642,57071715,45246338>, r=79979189 +pos=<-14872097,43082336,77210959>, r=67848969 +pos=<54374149,83056200,33467311>, r=85115127 +pos=<1476108,6758434,46385542>, r=66547693 +pos=<25039805,52794798,-19161299>, r=78147972 +pos=<-26819047,43199801,30459488>, r=74327370 +pos=<4286668,110940760,38802604>, r=93400678 +pos=<4053848,87892295,76015736>, r=83083719 +pos=<-1921035,61253227,-3665179>, r=92388716 +pos=<17204393,27151196,113219747>, r=87712277 +pos=<11482784,81631206,44449045>, r=51248801 +pos=<19881378,33514197,5150119>, r=62622046 +pos=<46089433,22660842,35676189>, r=64523299 +pos=<-2707511,17390331,65062945>, r=69228121 +pos=<-160344804,31914854,69649477>, r=58216880 +pos=<25746542,31258930,-22386759>, r=93644875 +pos=<-24641910,49256326,49576498>, r=49870969 +pos=<8138665,60289998,19311562>, r=58388923 +pos=<-49531327,40283414,41864583>, r=88551146 +pos=<-35890107,52441195,48988086>, r=64892519 +pos=<-9694645,68139955,55216246>, r=56280378 +pos=<3863609,74729614,36250636>, r=60164724 +pos=<20303891,76310639,47902413>, r=86110011 +pos=<5590258,65228278,22729995>, r=62457193 +pos=<7423293,113176291,47365165>, r=83936992 +pos=<9618443,-3334255,39112439>, r=75771037 +pos=<-15665487,65099560,48409673>, r=57904562 +pos=<-7406634,100313652,40556843>, r=92712595 +pos=<-7808460,15185536,29431259>, r=84359733 +pos=<-20145227,53162066,88647521>, r=85184552 +pos=<37028648,69939239,6285541>, r=81834647 +pos=<5755081,53742866,-9631786>, r=83168760 +pos=<11994016,50570209,49770258>, r=76269963 +pos=<6880573,89480514,31780836>, r=76368504 +pos=<-46877937,54638115,63437148>, r=88182724 +pos=<16761128,23463725,25560039>, r=55383042 +pos=<25619949,52383554,-14813656>, r=73969587 +pos=<-26151263,32330589,41470378>, r=73517864 +pos=<19942771,70356015,76849403>, r=50492213 +pos=<-18161652,17316315,38537427>, r=83475483 +pos=<19062989,86048494,35866945>, r=56668035 +pos=<-45283899,38588597,49149050>, r=78713876 +pos=<34105015,57347311,44606084>, r=61167471 +pos=<-15777887,63979386,46604073>, r=58702364 +pos=<5832914,66060638,109347991>, r=92805279 +pos=<17688916,56658632,58192464>, r=96313666 +pos=<6355763,80927880,41100496>, r=59020806 +pos=<11173519,50579434,59312652>, r=88064738 +pos=<-3905996,71416341,38543106>, r=62328789 +pos=<-50059189,58354525,42463481>, r=91499385 +pos=<-21617101,65640062,44787685>, r=68018684 +pos=<-28761475,51594902,42803996>, r=63101533 +pos=<10929227,58507467,10052175>, r=63075266 +pos=<-38430792,66655079,49444346>, r=81190702 +pos=<20120979,102109536,16959693>, r=90578194 +pos=<34600983,35756404,-4274311>, r=79889376 +pos=<-1985799,36471724,17720308>, r=68961375 +pos=<9371162,74595589,17137716>, r=73635864 +pos=<-35424413,63651338,42482381>, r=82142638 +pos=<93401552,54313815,50150501>, r=78716951 +pos=<-22696154,84093664,56658502>, r=86677969 +pos=<19525187,110040479,38062588>, r=78001974 +pos=<97476663,48906067,37381359>, r=90153765 +pos=<-48884970,41892178,38254699>, r=89905675 +pos=<-38261205,49539612,45162847>, r=68187235 +pos=<12329525,96606028,48121504>, r=61704179 +pos=<15963978,65128289,16978694>, r=57734901 +pos=<54038930,70481357,52514735>, r=55867584 +pos=<50943781,17115083,52304231>, r=60583940 +pos=<-5316971,63234279,23170316>, r=70930133 +pos=<-25172929,61023213,37341459>, r=74404122 +pos=<-7958162,51343940,67947180>, r=50478836 +pos=<12938179,17142371,-2068348>, r=93155408 +pos=<71256040,61844770,58825834>, r=70759169 +pos=<-27836991,53199230,50107637>, r=56477741 +pos=<16324980,50429681,6527672>, r=53126236 +pos=<-45956739,53163320,38604771>, r=86064466 +pos=<39752810,53774122,38733506>, r=52013644 +pos=<-33745599,59418191,49681696>, r=69031372 +pos=<-28497173,63793496,42067427>, r=75772402 +pos=<6286360,83560415,66565753>, r=67069329 +pos=<-40313646,56194051,45088191>, r=76968934 +pos=<16089367,-9683997,29630552>, r=85132010 +pos=<-61079456,50836160,48029878>, r=89435091 +pos=<26966244,51393377,44782774>, r=75958671 +pos=<-29173237,73797967,37283576>, r=91236814 +pos=<1271177,74956095,4351643>, r=94882930 +pos=<18356992,113969420,31969672>, r=89191987 +pos=<-16219396,66963311,20454210>, r=88277780 +pos=<17902178,24928900,25492581>, r=52843910 +pos=<-30304830,40794011,45162895>, r=65515684 +pos=<-26059279,54777258,44873176>, r=61512551 +pos=<15962705,-38337216,52649509>, r=93871997 +pos=<7184804,97406353,31237970>, r=84532937 +pos=<-12830649,93509796,36334257>, r=95555380 +pos=<-1902919,79833792,43102878>, r=64183151 +pos=<28703163,53362092,49750365>, r=96179626 +pos=<40614768,51868084,-20096829>, r=93731751 +pos=<25224934,49041535,-2520198>, r=57938941 +pos=<-48247723,52419441,40947808>, r=85268652 +pos=<-9005314,62344449,26303409>, r=70595900 +pos=<-35117585,65797421,49967600>, r=76496766 +pos=<65379544,73545604,58604243>, r=76361836 +pos=<-32759275,58062871,36574874>, r=79796651 +pos=<12461111,94097210,71412780>, r=76278684 +pos=<-19648028,44351942,59944555>, r=54088591 +pos=<68402809,51033371,44638063>, r=55950319 +pos=<-66132053,55482609,48793647>, r=98370169 +pos=<82702128,62657521,56952070>, r=81144152 +pos=<36533114,75333188,34189527>, r=58828965 +pos=<20502867,-33876446,49317718>, r=85223433 +pos=<9983563,97159661,15043042>, r=97682254 +pos=<-2159259,48902834,96746263>, r=71038257 +pos=<-15241821,72631048,48188569>, r=65233539 +pos=<14650498,-12387842,23788068>, r=95116864 +pos=<-14745664,69121145,45012949>, r=64403194 +pos=<2518462,65994075,31066725>, r=57958054 +pos=<80883451,39653219,46612384>, r=71388369 +pos=<-33880870,45417012,45474342>, r=64157221 +pos=<62573621,69403890,53388124>, r=64198247 +pos=<19564144,10843057,22674533>, r=68085834 +pos=<-22587674,52853897,34615239>, r=66375524 +pos=<21177981,82769628,102287531>, r=87108994 +pos=<-62457583,53656011,48515817>, r=93146983 +pos=<-420183,64091071,1274409>, r=88786053 +pos=<6716148,61303582,4084095>, r=76052625 +pos=<-45251359,50530733,35773115>, r=85558178 +pos=<37712765,36164454,28185567>, r=50133237 +pos=<-542350,79084734,10008923>, r=95167367 +pos=<17790571,57587760,-4505711>, r=69852752 +pos=<61432442,50715808,38131859>, r=55168470 +pos=<40657404,66910002,14965209>, r=73754285 +pos=<-19741467,77975018,48243769>, r=75022122 +pos=<20095461,-22021809,43126331>, r=79967774 +pos=<13967131,84850969,46754369>, r=49678688 +pos=<53414915,80690085,18630207>, r=96627188 +pos=<569600,84105219,65967423>, r=72732559 +pos=<3212547,53765176,25083365>, r=51018431 +pos=<-4112307,61319000,21594481>, r=69385982 +pos=<16007390,51273935,54163353>, r=84801155 +pos=<19386558,26556288,47907041>, r=94993706 +pos=<41521152,25025600,101909467>, r=92855893 +pos=<-33388108,65879261,31992880>, r=92824122 +pos=<5586381,99306656,48519561>, r=70749900 +pos=<1716441,51943074,11706508>, r=64069278 +pos=<13146361,73129328,18761399>, r=66770779 +pos=<-29731452,67267528,37067231>, r=85480978 +pos=<-25510849,58768487,32130122>, r=77698460 +pos=<70273318,54536613,46065588>, r=59896786 +pos=<50914300,36221702,41138672>, r=50324644 +pos=<-38663426,49734697,47260896>, r=66686440 +pos=<-5484240,57879561,14449755>, r=74463223 +pos=<45783048,60623348,23874529>, r=63684046 +pos=<-20789054,56519799,29933067>, r=72924972 +pos=<-16313550,56766265,53361472>, r=49670842 +pos=<9689320,101333832,29922247>, r=87271442 +pos=<14123292,93906653,54393457>, r=57406384 +pos=<1393920,82543460,29091305>, r=77607788 +pos=<-34664967,71395253,48860522>, r=82748902 +pos=<-13904118,52232743,39078364>, r=52607793 +pos=<30126288,58751667,61875210>, r=61697173 +pos=<62034054,55504258,85347828>, r=81718735 +pos=<9101052,62872457,17929835>, r=61390903 +pos=<-18719028,24645697,33359032>, r=81881869 +pos=<13301456,118745374,60909736>, r=89583184 +pos=<84991079,49514117,30343688>, r=85313684 +pos=<13208799,60817505,96738161>, r=67576683 +pos=<-9630684,64018969,30647090>, r=68551822 +pos=<-6496822,27098753,16967827>, r=83597870 +pos=<-61057137,40354588,48789133>, r=93081121 +pos=<-30658615,63644817,27322920>, r=92529704 +pos=<-43841749,57458265,48326772>, r=78522473 +pos=<4656352,101928201,64940007>, r=85441419 +pos=<56763899,76471203,29436064>, r=84951142 +pos=<13190870,86887027,48905142>, r=50340216 +pos=<3926792,44502511,44642416>, r=60560138 +pos=<-44674606,53411137,66002919>, r=87318223 +pos=<-29176711,34807781,26228264>, r=89308499 +pos=<33561068,84785215,36449423>, r=63049589 +pos=<-19886390,46501782,28463280>, r=66088925 +pos=<268718,57397961,52643849>, r=85360107 +pos=<-11977687,73922329,77302457>, r=86432033 +pos=<-36840982,49772545,30878942>, r=81283742 +pos=<-69799729,51510288,48429761>, r=98429531 +pos=<-32106175,59670385,38221542>, r=79104506 +pos=<-44174460,51444445,33817602>, r=87350479 +pos=<61687350,61595679,34183736>, r=70251509 +pos=<5283456,88111200,25274882>, r=83102041 +pos=<-35024964,57468781,38861657>, r=79181335 +pos=<-3080055,51642486,9823290>, r=70448411 +pos=<-40827266,53891466,46077710>, r=74190197 +pos=<-21517271,13700912,44974098>, r=84009829 +pos=<-24825646,64999241,34167994>, r=81206173 +pos=<-33565564,60375763,30726904>, r=88763810 +pos=<-3426827,51132507,29853656>, r=50254875 +pos=<14968538,100319076,30103590>, r=80796271 +pos=<-4775657,64206984,4850751>, r=89681116 +pos=<-16954699,49056838,25200878>, r=66359811 +pos=<5945628,94474349,32730542>, r=81347528 +pos=<-2949935,71654913,30136107>, r=70017948 +pos=<-27854664,53098422,49432361>, r=57070481 +pos=<15263982,108602893,37894133>, r=80993976 +pos=<95680982,55252735,47904083>, r=84181801 +pos=<-3089597,14851649,69615233>, r=76701121 +pos=<16930350,43293529,101149146>, r=59773198 +pos=<-24275128,41013222,6900378>, r=97529098 +pos=<100613536,54087314,46881481>, r=88971685 +pos=<3343489,92729109,47230534>, r=67704674 +pos=<-17448926,63567593,41139451>, r=65426244 +pos=<-33240293,69148978,63790680>, r=89409485 +pos=<56571887,81587490,38461315>, r=80850207 +pos=<8055278,20978205,37616309>, r=54517906 +pos=<28639566,106367116,59903773>, r=73742911 +pos=<6196049,51233308,52896481>, r=94318829 +pos=<-28536954,44022611,27547916>, r=78134066 +pos=<-28079264,43435569,19438417>, r=86372885 +pos=<-23107802,49082948,46160757>, r=51579574 +pos=<-16361551,-508526,42643497>, r=95394163 +pos=<50459747,44332572,27234854>, r=55662949 +pos=<73198302,70247505,61923451>, r=84202058 +pos=<-43387281,64742471,49364731>, r=84314328 +pos=<-1670773,74945192,23829317>, r=78336064 +pos=<26564343,81327811,33635077>, r=55409159 +pos=<20257514,95904211,46462870>, r=54733203 +pos=<-20043556,66062548,47455717>, r=64199978 +pos=<-1688293,29441812,-1943011>, r=95357070 +pos=<-110894772,119310152,41454062>, r=87281719 +pos=<2921978,49183363,53078286>, r=97968683 +pos=<5693513,101352582,22114610>, r=99093778 +pos=<102975844,40692247,49558547>, r=89495573 +pos=<-32431607,48884085,34793350>, r=72071745 +pos=<8115066,124693818,46977683>, r=95150222 +pos=<-42057746,43259427,66856031>, r=84502541 +pos=<-14919195,22755164,-96684707>, r=81099553 +pos=<-19803964,83188553,33099591>, r=95442247 +pos=<-3875371,52330380,-1499953>, r=83255528 +pos=<12694458,55002663,94657393>, r=60195158 +pos=<-31476582,49202346,54276407>, r=58184928 +pos=<42486981,36157687,102342707>, r=83123038 +pos=<-58293678,53359014,56116846>, r=90999113 +pos=<-39768613,46059171,47847681>, r=67029341 +pos=<-19611935,49145102,32074354>, r=62232001 +pos=<14285872,-7219337,-106237083>, r=83635824 +pos=<-12353609,56782049,71726121>, r=64091308 +pos=<-42921619,62580562,43100688>, r=87950786 +pos=<-18883922,67472712,20845419>, r=91060513 +pos=<21194652,56111150,45098088>, r=63487792 +pos=<-88741567,-27063895,34907820>, r=95313368 +pos=<19365051,51568769,3057382>, r=54695551 +pos=<-34073685,52022165,21223484>, r=90421527 +pos=<48172660,72033644,49611164>, r=51747268 +pos=<45277630,63520270,15867305>, r=74082669 +pos=<37333953,79085565,77839983>, r=73091967 +pos=<-24267532,51045463,35947659>, r=64914743 +pos=<29210563,48961810,56293747>, r=97837804 +pos=<13549017,93141184,39601385>, r=65539962 +pos=<-30172654,69466004,56796372>, r=79664582 +pos=<-24991841,54370341,49031260>, r=55880074 +pos=<-17441068,57640555,92455301>, r=90766485 +pos=<7771504,90139437,41125434>, r=66791703 +pos=<-120267300,62090786,-14543982>, r=84102275 +pos=<-3200488,82718372,43586667>, r=67881372 +pos=<18184696,112705161,42983578>, r=77086086 +pos=<13095313,101816041,58660880>, r=70611127 +pos=<27714001,50226805,41561484>, r=53542325 +pos=<9404974,54003658,7989512>, r=62158325 +pos=<-2700521,80059903,33167033>, r=75142591 +pos=<-3249629,92887890,62714946>, r=82082001 +pos=<-43042212,29003255,54705706>, r=87592608 +pos=<-19147052,85510967,39932177>, r=90274994 +pos=<28207492,15379476,90410726>, r=77689789 +pos=<15130656,17150221,17320494>, r=71566332 +pos=<177205281,49575511,-3173832>, r=99132489 +pos=<26036743,12892985,21317863>, r=68596634 +pos=<65162030,53289073,24373204>, r=75230122 +pos=<-48002152,50870049,43981017>, r=80440352 +pos=<48898780,34156686,6241608>, r=85270972 +pos=<74020351,69063704,49770698>, r=74465439 +pos=<2602905,86043760,23622367>, r=85367656 +pos=<-5597747,92966423,48407092>, r=75706278 +pos=<18355246,5666922,29067559>, r=68077869 +pos=<-3305078,45408796,107624979>, r=84369208 +pos=<71880640,60056951,47882004>, r=65207841 +pos=<-40786832,54649696,75134537>, r=93800698 +pos=<877773,33678060,20953646>, r=65658341 +pos=<33816219,49155633,35745297>, r=72063879 +pos=<-14575166,53841598,-2875914>, r=96842593 +pos=<23811728,99203184,14329771>, r=89837464 +pos=<-10130934,64455983,49598623>, r=50537833 +pos=<-861523,40976994,49934544>, r=70464214 +pos=<12619739,61086380,-2382359>, r=76398496 +pos=<69916022,49269467,45706756>, r=54630807 +pos=<65750826,53573612,45046333>, r=55430229 +pos=<-36597974,61735870,36211684>, r=87671650 +pos=<-27934903,70553630,55254020>, r=76972067 +pos=<-22267685,72469383,47681249>, r=72605035 +pos=<-21317649,71157584,38334420>, r=79690050 +pos=<13653541,58224360,14853350>, r=55266782 +pos=<-77386292,131323514,27233225>, r=90192338 +pos=<1100664,66357866,14353245>, r=76453109 +pos=<11112851,49579187,6836479>, r=57179026 +pos=<43010063,90701411,15615412>, r=99248181 +pos=<-60133740,-8778062,-29097666>, r=75680098 +pos=<33043454,57048199,16341347>, r=54902568 +pos=<-34578842,45788423,29956333>, r=80001654 +pos=<-32039208,70149061,29757734>, r=97979755 +pos=<-25729677,69463004,40028696>, r=80713195 +pos=<17332613,64787981,-5823138>, r=78827744 +pos=<-31070552,80502196,40012001>, r=97109924 +pos=<18516099,82050938,38888335>, r=50195924 +pos=<34342796,63184545,54981500>, r=94398108 +pos=<-14112984,54055686,1230646>, r=92487198 +pos=<65125373,73949883,66596415>, r=84504260 +pos=<-10819331,69984620,81904365>, r=85937838 +pos=<-6893052,62736332,24648344>, r=70530580 +pos=<-69677962,53307149,49604353>, r=98930456 +pos=<69520531,83646798,38099514>, r=96219904 +pos=<-32645642,28707123,31866439>, r=93239658 +pos=<10011718,116595257,57133026>, r=86946134 +pos=<15854060,83471157,29895491>, r=63270967 +pos=<16980464,74077549,12458888>, r=70187443 +pos=<1650286,65453118,33119777>, r=56232207 +pos=<17049731,98916822,20828637>, r=86587686 +pos=<11345336,126647939,50055821>, r=90795962 +pos=<2857842,61099553,26020772>, r=57770299 +pos=<20873707,63977885,40011826>, r=73427967 +pos=<-61634287,50503909,52208034>, r=87576274 +pos=<19806792,85041806,23882249>, r=66902078 +pos=<-21103791,34927075,16821573>, r=90522765 +pos=<-11467278,89838280,40965134>, r=85889682 +pos=<-10930654,76735710,31285442>, r=81930607 +pos=<-8535562,41678818,32850604>, r=55173908 +pos=<5049245,78608231,74307285>, r=71096327 +pos=<8304290,-22453283,42498119>, r=92818519 +pos=<3891933,85705498,10957314>, r=96405508 +pos=<-28515541,50529703,12095379>, r=92499150 +pos=<-19353342,77478644,61742688>, r=81804230 +pos=<17985891,69599218,23211547>, r=53951034 +pos=<13911235,50734753,97683971>, r=57737403 +pos=<-48351026,42880095,44660112>, r=81978424 +pos=<-14847844,57239466,19429832>, r=78206654 +pos=<62259034,45976669,66911507>, r=57644758 +pos=<-20908688,53102906,44596533>, r=54964232 +pos=<-30130488,60912854,40271389>, r=76321411 +pos=<12564011,109367473,24698433>, r=97654183 +pos=<-4186189,53246824,46923207>, r=50299068 +pos=<-54319122,51580639,37761353>, r=93687591 +pos=<50700535,84304368,48552962>, r=67604106 +pos=<-357163,35421601,2133541>, r=83969861 +pos=<-21574040,42039450,11854376>, r=88847909 +pos=<-31782838,43551351,44823672>, r=64575533 +pos=<-6916155,62980186,41805016>, r=53640482 +pos=<101782982,48840391,46661204>, r=85114359 +pos=<-19549756,73434901,34162084>, r=84371833 +pos=<-62259754,41565412,-59319704>, r=56322651 +pos=<93463992,-60589215,81299318>, r=94657460 +pos=<61956817,55660454,47615298>, r=51154333 +pos=<19106263,88587204,68223856>, r=60934335 +pos=<-66105696,48859174,46044049>, r=94470099 +pos=<235149,88727582,30864503>, r=83177618 +pos=<15290642,41954673,49904297>, r=72923884 +pos=<81246457,27498069,39890948>, r=90627976 +pos=<-10274478,53237796,34754021>, r=54307417 +pos=<-61528581,48927156,41219868>, r=94785037 +pos=<-25672253,50491609,53239700>, r=52633101 +pos=<-9196348,75713091,78263491>, r=86402444 +pos=<-23849582,51405630,65992125>, r=64476882 +pos=<-23543739,59833227,49312878>, r=59613370 +pos=<4014526,99163174,34613072>, r=86084853 +pos=<37362873,64176592,106044278>, r=86416529 +pos=<81141907,49405483,39166149>, r=72533712 +pos=<-57682315,52664289,49844128>, r=86051628 +pos=<87094691,49640861,74760058>, r=90328074 +pos=<-50281544,28761709,44854346>, r=97833213 +pos=<-51034256,45640640,41782826>, r=84778541 +pos=<11634118,46276604,41620009>, r=89553809 +pos=<-39816037,63800256,49415986>, r=79749496 +pos=<-25125286,66707747,41731762>, r=75650761 +pos=<-13976205,49449036,1257054>, r=87717477 +pos=<12699793,43248135,97757607>, r=60657879 +pos=<72698485,78521776,36995676>, r=95376667 +pos=<-50854433,22431352,162463326>, r=53208774 +pos=<-24897315,50993894,43716605>, r=57723763 +pos=<-23231806,50371462,98099119>, r=94932176 +pos=<-23146396,53234996,34423945>, r=67506600 +pos=<17126593,-2666688,39439060>, r=67268626 +pos=<18783793,103911977,35849838>, r=74827751 +pos=<19745828,14118663,27612437>, r=59690643 +pos=<8168347,50227071,46408287>, r=80103227 +pos=<-16736687,69015235,48529412>, r=62772036 +pos=<6362154,53011065,40597969>, r=54779555 +pos=<-20780361,66500789,43606176>, r=69224558 +pos=<37828611,67680178,82058140>, r=66399364 +pos=<-46477745,66877614,45277196>, r=93627331 +pos=<1459724,75448201,18670921>, r=80866849 +pos=<576112,100129414,73047112>, r=95829939 +pos=<-32614680,51242558,46981619>, r=62425391 +pos=<11159909,89950222,49200544>, r=55138988 +pos=<-37130673,53383141,29543974>, r=86519002 +pos=<16001336,55898847,-1246462>, r=66693268 +pos=<5391373,45137998,49241302>, r=73252412 +pos=<-20686382,55996849,52167060>, r=52079843 +pos=<26696051,50193173,94484832>, r=50206624 +pos=<-14512022,39108612,5722017>, r=90849053 +pos=<4591490,46180445,9631365>, r=60764310 +pos=<-21674786,64848442,44823972>, r=67248459 +pos=<40147581,95874753,46159808>, r=71014871 +pos=<18564915,92158316,12783801>, r=86358815 +pos=<15079575,98887229,34653571>, r=74703566 +pos=<61623936,56202773,36593215>, r=62385669 +pos=<30200018,53720365,172759>, r=64899730 +pos=<8942255,95330756,68405243>, r=78023306 +pos=<43798195,117816115,55532472>, r=95979245 +pos=<81319484,46435358,48379773>, r=63274845 +pos=<101886393,41002764,50032544>, r=87621633 +pos=<-21498404,56604671,44502137>, r=59150123 +pos=<26219500,49662554,-5741660>, r=62776284 +pos=<90197281,38043749,35753741>, r=93170727 +pos=<17395543,67639144,104028061>, r=77501189 +pos=<-64737324,49321137,50141738>, r=89465983 +pos=<-1399370,80171389,41372841>, r=65747088 +pos=<40494502,82617210,49205658>, r=55058183 +pos=<-47492175,51761576,45176658>, r=79626445 +pos=<-13529721,62290583,77387519>, r=76437387 +pos=<25698290,75089131,29650030>, r=52289496 +pos=<-25535297,58742443,66926197>, r=74433535 +pos=<882518,66320315,22411983>, r=68575299 +pos=<3222539,79039830,30898154>, r=70468554 +pos=<-25329625,73385292,64963510>, r=86907994 +pos=<58020944,9478152,38795602>, r=86517694 +pos=<-32579632,46481632,16052138>, r=91213586 +pos=<-13580155,58635455,55285113>, r=50730736 +pos=<14012829,66217297,19394211>, r=58359591 +pos=<-31118113,50436197,50095755>, r=57007723 +pos=<20416087,33039388,48386965>, r=66043046 +pos=<-4281194,75759521,13549481>, r=92040469 +pos=<68118463,45203388,81286147>, r=78652135 +pos=<39644220,72068776,19561539>, r=73303535 +pos=<-705964,50269904,16214957>, r=60310065 +pos=<27325526,97187099,92454701>, r=95799760 +pos=<5960982,-14892251,57469923>, r=85249127 +pos=<-18948384,55999611,52978332>, r=51156240 +pos=<7927547,76966692,35407966>, r=59180346 +pos=<-20856579,17646405,34190772>, r=90187042 +pos=<-30895111,53322745,48010098>, r=61757064 +pos=<8061812,69776684,91030632>, r=75975662 +pos=<-24714188,63051583,42964029>, r=70350978 +pos=<92344188,134730656,-15123610>, r=64787681 +pos=<-47895744,66750452,48547618>, r=91647776 +pos=<11384553,49976389,52522545>, r=55840055 +pos=<9542033,81341011,40355032>, r=56993762 +pos=<-9905083,63113882,40290705>, r=58277909 +pos=<-6799980,99336688,47731682>, r=83954326 +pos=<-61438558,53078285,43527172>, r=96538904 +pos=<-24627077,50640465,37088612>, r=63728118 +pos=<7863466,5958024,30100269>, r=77245890 +pos=<-5283296,38737824,22447122>, r=65266282 +pos=<-3030754,90335000,72881549>, r=89476871 +pos=<11776628,65710821,-124893858>, r=87243589 +pos=<-46731645,54590845,60325150>, r=84877190 +pos=<-90371982,5936993,-1316402>, r=75877673 +pos=<-4550279,67393705,1797048>, r=95696196 +pos=<-32445961,62241902,42962717>, r=77274390 +pos=<-23744235,54542576,42944106>, r=60891880 +pos=<10554656,78715334,17546585>, r=76163452 +pos=<73403039,43607060,48780630>, r=57785874 +pos=<52997872,76506988,33516550>, r=77140419 +pos=<-32730910,69952434,31585764>, r=96646770 +pos=<-4149538,14269448,27270133>, r=83777633 +pos=<-1756914,44054585,52602958>, r=94857071 +pos=<14058206,50156547,58617483>, r=55613064 +pos=<-60998436,51722898,56184290>, r=92135288 +pos=<20170177,30135153,109729998>, r=78272738 +pos=<-25788310,43186327,43110007>, r=60659607 +pos=<-10956342,49114234,98109796>, r=81409961 +pos=<-55328944,44949737,49639272>, r=81907866 +pos=<-34009488,59403507,33246384>, r=85715764 +pos=<-2965657,76576391,55028859>, r=57800431 +pos=<7413674,86438176,17796179>, r=86777515 +pos=<-21711925,50561714,40968389>, r=56855074 +pos=<-21935755,57627196,47759087>, r=57353129 +pos=<46233171,67173397,59316206>, r=51555253 +pos=<-28605529,53959074,44790849>, r=63323170 +pos=<-37331683,59606501,66895617>, r=87063539 +pos=<-14320904,64600927,81698922>, r=83850287 +pos=<93271265,70178629,45577939>, r=99024068 +pos=<-51619641,57204155,57252934>, r=89306280 +pos=<-10064461,62811203,79529853>, r=75635033 +pos=<50872125,70982165,53135094>, r=53821853 +pos=<52515155,55861758,37450740>, r=52078309 +pos=<-42764254,57317670,63195746>, r=86507214 +pos=<-14666206,59083822,46747995>, r=52551299 +pos=<-42771930,34423391,32711429>, r=96804727 +pos=<6266712,6088494,30991403>, r=77821177 +pos=<51462469,57440936,-461471>, r=90517015 +pos=<-12869217,60606985,9028743>, r=89996612 +pos=<-150487035,61069438,27042469>, r=87270110 +pos=<-62286565,52853523,48825319>, r=91863932 +pos=<-57280569,49603035,55210373>, r=85323538 +pos=<16061091,112700280,71038462>, r=90907173 +pos=<-32346623,67505659,75578466>, r=98660525 +pos=<55405774,51919734,72632698>, r=58790664 +pos=<12459178,-21870541,42368913>, r=88210249 +pos=<-12691430,56144490,29572885>, r=64812583 +pos=<19666265,78157022,33112939>, r=50926997 +pos=<-7927360,15910153,21694134>, r=91491416 +pos=<77828835,55223306,31861649>, r=82342659 +pos=<13265598,121110964,61749128>, r=92824052 +pos=<64375726,50242952,84957255>, r=78408497 +pos=<1306959,56655066,28579166>, r=52318284 +pos=<46727158,79447435,53557220>, r=58564289 +pos=<-27714219,53217642,43728204>, r=62752855 +pos=<59918963,53898220,59686526>, r=52336410 +pos=<-32596935,57734511,49541938>, r=66338706 +pos=<5159309,93023210,32255996>, r=81157367 +pos=<107052351,53806019,44035281>, r=97975185 +pos=<-27872651,65081732,39041779>, r=79462342 +pos=<15964428,97375924,69214775>, r=73855814 +pos=<-34037385,71304454,46429668>, r=84461349 +pos=<-17680690,50423741,28469640>, r=65183943 +pos=<-41664053,58818022,31253357>, r=94778438 +pos=<76262158,67702149,27798993>, r=97317481 +pos=<-3791121,69578126,11107789>, r=87810858 +pos=<-35048739,49030000,57700373>, r=65008853 +pos=<-5363047,111060916,45527914>, r=96445229 +pos=<-40021935,45001582,62586909>, r=76455315 +pos=<19977257,58140375,49317605>, r=72566336 +pos=<2191757,67451366,38746005>, r=52063163 +pos=<-65658507,50295529,42616310>, r=98886955 +pos=<-15142631,57271340,23584610>, r=74378564 +pos=<-22873365,12407093,40055525>, r=91578482 +pos=<-7339862,56073879,33613736>, r=55349338 +pos=<9361582,60754907,-3336335>, r=80278884 +pos=<10410132,93476342,48876299>, r=59739066 +pos=<-15458976,75333283,37965282>, r=78376187 +pos=<-5706721,63860739,61977165>, r=54774380 +pos=<-27102122,60799405,49573871>, r=63877097 +pos=<-36482416,66508426,48784022>, r=79756002 +pos=<-31653698,67588756,28273101>, r=96518667 +pos=<44190745,94893234,58135048>, r=76051941 +pos=<17089831,104847960,32944941>, r=80362423 +pos=<27475605,134517624,44206920>, r=98938430 +pos=<8673337,54132140,20034992>, r=50973377 +pos=<56196148,64478829,46453902>, r=55373213 +pos=<-32943306,36770609,26734123>, r=90606197 +pos=<56707506,72412415,44280055>, r=65991974 +pos=<-2433353,80878331,29625377>, r=79235596 +pos=<36537752,8459131,46910125>, r=57939087 +pos=<-51220670,51985115,61823556>, r=88258910 +pos=<39920466,52035468,43828621>, r=79912826 +pos=<-19145339,53869039,6905802>, r=91657728 +pos=<-35853878,64582167,31160616>, r=94824609 +pos=<-13577755,90558343,42331267>, r=87353986 +pos=<-570192,95069175,40398215>, r=80790309 +pos=<92123086,65787144,46332081>, r=92730512 +pos=<31272190,18811599,112007566>, r=98919131 +pos=<6777159,40959206,-10440173>, r=83871488 +pos=<-9740566,69691901,12612822>, r=92369217 +pos=<37166764,36666305,89582855>, r=64534253 +pos=<107124043,49227463,49523366>, r=87980656 +pos=<15772843,35909512,13605576>, r=55879690 +pos=<-2657558,93963466,32560129>, r=89610443 +pos=<20433218,28444321,83440331>, r=53410724 +pos=<-22999550,56419067,55438221>, r=58086365 +pos=<-30789611,50548398,52659266>, r=57226790 +pos=<37531473,-8930527,40589513>, r=82643022 +pos=<4510852,51390212,91735964>, r=61845252 +pos=<11714056,21660233,102449491>, r=87923156 +pos=<-4609352,70084374,33051750>, r=67191135 +pos=<12630645,85874601,41208514>, r=57584986 +pos=<52324981,31249573,59591472>, r=55117999 +pos=<-60229360,55326680,48364277>, r=92740940 +pos=<-29194872,50609586,50102783>, r=55250913 +pos=<4412399,52508921,15633312>, r=58013149 +pos=<43693562,54331097,49869587>, r=83284604 +pos=<-466173,53751163,29329192>, r=50437574 +pos=<-19674258,58705145,47341139>, r=56587549 +pos=<-12766668,15681359,33575985>, r=84676902 +pos=<-134995,51807106,-18809128>, r=96300799 +pos=<7950500,104210339,26139891>, r=95669304 +pos=<8916281,81096489,71160024>, r=66569989 +pos=<83307491,66020420,34621507>, r=95858500 +pos=<46932518,66783036,34382608>, r=60485019 +pos=<-25525627,67090779,40768720>, r=77396938 +pos=<113140622,51840761,52466329>, r=96280288 +pos=<-43234449,50840373,49596026>, r=70027957 +pos=<9636628,43731791,47427570>, r=80257863 +pos=<16952827,96460043,21330870>, r=83725500 +pos=<-3364858,5758742,53812510>, r=70266585 +pos=<42097321,66603859,28141668>, r=61711733 +pos=<2581735,105789003,35836791>, r=92920066 +pos=<56876747,52274927,25445428>, r=64858343 +pos=<7319198,15550258,8014801>, r=90283312 +pos=<-12128060,66079210,46738231>, r=57018198 +pos=<15875808,57958946,10017572>, r=57615030 +pos=<9008316,64537785,29247439>, r=51831251 +pos=<42734666,105437354,40314540>, r=89009550 +pos=<-22819084,54875169,48613105>, r=54630571 +pos=<14813442,58095859,34114480>, r=69712133 +pos=<2843789,86297879,33599696>, r=75403845 +pos=<14953623,59445003,16791933>, r=53248686 +pos=<-4540706,63227776,28850990>, r=64466644 +pos=<-7579268,81750777,25396831>, r=89482641 +pos=<10341720,94404216,24198039>, r=85413675 +pos=<-12855439,39482491,77851684>, r=70073123 +pos=<-22144366,78112861,37678571>, r=88128084 +pos=<-22967634,58362529,45789018>, r=61090313 +pos=<42505708,52433166,8371584>, r=67719588 +pos=<16465030,38392367,52821832>, r=71645146 +pos=<-51535228,50034314,39109816>, r=88008905 +pos=<11154064,82077078,19690276>, r=76782195 +pos=<10005555,80360662,66175698>, r=59760392 +pos=<-17419709,33655776,56183612>, r=58795541 +pos=<74041597,59582976,47357102>, r=67419569 +pos=<6179982,58514887,53789025>, r=92502894 +pos=<11678925,3162913,71519958>, r=75526365 +pos=<30869340,103105040,65191292>, r=77998432 +pos=<-11546274,78615351,45477010>, r=70233791 +pos=<-37165008,57404141,37319960>, r=82798347 +pos=<4474665,51437076,2992470>, r=69519498 +pos=<-61332836,45898973,54745279>, r=89027102 +pos=<-2779606,21982858,97525759>, r=97170505 +pos=<78379666,49066780,45038094>, r=63560451 +pos=<-14457352,40433767,32592761>, r=62598392 +pos=<-21858453,41279729,47945053>, r=53801362 +pos=<-26586799,64565572,50001408>, r=66700201 +pos=<49404816,54007507,13171867>, r=71392613 +pos=<69349808,86969766,49773216>, r=87698512 +pos=<66791475,5066228,40210322>, r=98285617 +pos=<-64444326,51819871,48841635>, r=92971771 +pos=<-33728678,50942768,48911440>, r=61309160 +pos=<-14191687,67205626,80526920>, r=85153869 +pos=<-29342061,71087750,33895963>, r=92083126 +pos=<63069791,61835294,23548919>, r=82508278 +pos=<-6423334,57952740,30429625>, r=59495770 +pos=<-22677994,81175697,66757848>, r=93841062 +pos=<17487288,23097254,30379779>, r=50203302 +pos=<-125591393,66850972,12060209>, r=92174113 +pos=<10456555,50805970,2764011>, r=63134594 +pos=<29134707,67255989,-14539402>, r=92082270 +pos=<105903840,52177930,41797183>, r=97436915 +pos=<91080,86368478,20306190>, r=91520488 +pos=<10655718,59472497,-3940819>, r=78306752 +pos=<-25271221,90884868,49543297>, r=92162097 +pos=<-13980758,58340640,45471371>, r=52399215 +pos=<26527216,54132539,10614433>, r=51197829 +pos=<-66553060,50877313,50024297>, r=92955356 +pos=<7707483,94775516,37451058>, r=75166173 +pos=<-12418781,64557411,41713810>, r=60811666 +pos=<32824183,57014427,4361913>, r=66629148 +pos=<-48266481,56309485,49363441>, r=80761691 +pos=<-27422137,87305165,45451290>, r=94825167 +pos=<-6100247,50616340,25832014>, r=56433914 +pos=<-38248607,31252354,60760819>, r=86605298 +pos=<36142986,58033027,119115377>, r=92123894 +pos=<1806384,223126255,46308572>, r=69490835 +pos=<54371458,58071064,-4297127>, r=97891722 +pos=<38619845,42916522,122574392>, r=92728625 +pos=<11241820,68519959,21403136>, r=61424272 +pos=<2235399,60301147,15136749>, r=68478790 +pos=<-2486952,93852830,43206391>, r=78682547 +pos=<-6976590,84652374,38255612>, r=78922562 +pos=<-46046864,46754490,33404484>, r=87055750 +pos=<-63245875,56608859,54411844>, r=97496339 +pos=<-6260032,40730522,18355377>, r=68341942 +pos=<3655623,16746276,14754100>, r=86011583 +pos=<-57649658,45163153,49883183>, r=83770988 +pos=<-22365900,58543320,37312371>, r=69146057 +pos=<-2659753,66927786,1509912>, r=93626813 +pos=<78425267,61772308,31980105>, r=89370002 +pos=<-5792872,16390032,58448860>, r=66699788 +pos=<13502218,8011414,27690082>, r=71964284 +pos=<15662956,100883919,16652514>, r=94117725 +pos=<-27982823,58363346,52949414>, r=62525337 +pos=<-20076812,70016345,62303108>, r=75626559 +pos=<-12199165,51486079,37144420>, r=52090161 +pos=<65489525,59775056,39457247>, r=66959486 +pos=<28988834,97436890,34373844>, r=73204349 +pos=<-1298553,66305165,40338681>, r=52814190 +pos=<-23019264,62811828,14486567>, r=96893709 +pos=<-44473237,59840005,48299068>, r=81563585 +pos=<65710037,50685865,46684812>, r=50863207 +pos=<57876365,34367583,59137691>, r=57097333 +pos=<20857961,87367877,6687890>, r=85371636 +pos=<-23249164,63105443,28083736>, r=83820257 +pos=<8010982,43808377,-6072329>, r=75420546 +pos=<-7886851,96930290,46915687>, r=83450627 +pos=<-8708520,54903952,17476103>, r=71685597 +pos=<-9041389,72875525,26705848>, r=80760471 +pos=<17727546,33646899,25129>, r=69768414 +pos=<20687393,26123339,-19137626>, r=93494470 +pos=<-39609488,46799081,47127212>, r=66851286 +pos=<-3646983,98560734,33425164>, r=94331809 +pos=<3485853,69925120,65172287>, r=54841491 +pos=<-29443780,26940253,44037187>, r=79634058 +pos=<20619578,68574147,879108>, r=72624631 +pos=<14390618,49373291,47497883>, r=60638715 +pos=<-49845392,45000860,26785462>, r=99226638 +pos=<-59562465,34267964,48672891>, r=97789458 +pos=<-6346981,3527196,44016263>, r=79971123 +pos=<77743233,57733274,45709921>, r=70918710 +pos=<-31391791,51399490,49373815>, r=58966773 +pos=<62127122,61610757,33123005>, r=71766970 +pos=<57792255,89304415,42522193>, r=85726549 +pos=<14308919,64617042,-19077920>, r=94935250 +pos=<-13410494,57946640,43726015>, r=53180272 +pos=<257809,70469514,22447830>, r=73313444 +pos=<-2251250,52625718,83343235>, r=61449839 +pos=<-30774327,54414203,46773830>, r=63963857 +pos=<-15951324,68550112,43283893>, r=66767093 +pos=<-19182160,71303883,45141724>, r=70893621 +pos=<-36060360,50244768,38473986>, r=73380346 +pos=<-13730821,51532578,40670147>, r=50142425 +pos=<-11435156,79357239,31228700>, r=85113006 +pos=<-5678299,87489889,41626078>, r=77091270 +pos=<8739446,16648317,45543645>, r=50236327 +pos=<-19331613,64553140,58793421>, r=65907903 +pos=<-29611001,14073482,45232620>, r=91472836 +pos=<8941863,94910846,40459302>, r=71059048 +pos=<-40761819,59468622,49346148>, r=76433650 +pos=<4343551,85385986,45466767>, r=61124866 +pos=<-22177207,50375490,69798895>, r=65581142 +pos=<18538560,101071117,42535514>, r=65546302 +pos=<16679994,57387579,50086645>, r=77273767 +pos=<-40754986,49327339,35496344>, r=80135160 +pos=<-42137035,68104815,43123472>, r=92667820 +pos=<-33297966,74528415,50063208>, r=83312382 +pos=<-1516605,71770703,19476803>, r=79359669 +pos=<12665073,68014777,105798750>, r=84378075 +pos=<-32757819,49073817,52537506>, r=57598763 +pos=<-33519066,45859525,40007164>, r=68819947 +pos=<86082037,52568755,46592409>, r=73210472 +pos=<-71556811,52200916,50084496>, r=99222384 +pos=<-28139761,50073799,22611947>, r=81150858 +pos=<13541164,91369683,32775224>, r=70602520 +pos=<-16317236,56068753,54560328>, r=50175959 +pos=<-11331344,51596532,85248648>, r=71406256 +pos=<-5931204,91111332,52396432>, r=72668490 +pos=<90289920,65845518,39399462>, r=97888047 +pos=<-3984592,51498988,48025950>, r=62092105 +pos=<3555037,87300161,42451961>, r=66842347 +pos=<-24589823,38535355,42558945>, r=64663151 +pos=<8782570,35154521,12462985>, r=64767726 +pos=<-37716780,63787472,59928868>, r=84662993 +pos=<-44579937,59640123,30698580>, r=99070649 +pos=<-55181742,64393089,46049932>, r=99074084 +pos=<-18035862,49604454,33775573>, r=59413952 +pos=<-12016341,59298834,30659871>, r=66204470 +pos=<18780968,7353383,18991027>, r=76042336 +pos=<14767876,70957328,48457261>, r=68122955 +pos=<176257,53187561,-8060611>, r=86621097 +pos=<-40135229,51998675,40377712>, r=77305429 +pos=<-56334739,53536066,42888336>, r=92531638 +pos=<-11171826,46664881,16674320>, r=69000193 +pos=<-38417421,73491747,43836162>, r=93622256 +pos=<6291993,59441100,47457386>, r=56292961 +pos=<2205547,114639308,46447857>, r=91535176 +pos=<15765659,98173971,47159153>, r=60798366 +pos=<-675874,54765553,961325>, r=80029272 +pos=<-24007098,72054783,48164877>, r=73446429 +pos=<12661038,42714476,49527033>, r=59232028 +pos=<-9301220,78721935,43851305>, r=69721021 +pos=<18229397,66808011,-9490519>, r=83618304 +pos=<-2812165,50834360,-17192926>, r=96388788 +pos=<15273284,83684501,9255317>, r=84705079 +pos=<25313976,76586387,94916933>, r=75649821 +pos=<83496364,57748330,44686539>, r=77710636 +pos=<-36028080,64272970,53195701>, r=76726277 +pos=<261370,98959952,41421871>, r=82826175 +pos=<19961413,92709316,2188488>, r=96108590 +pos=<-27744282,54399903,52610801>, r=57984580 +pos=<-37764856,55482711,45273766>, r=73523082 +pos=<6152034,51895689,112513637>, r=81486818 +pos=<-3620749,75990775,50026613>, r=55134415 +pos=<23685113,52343937,-27788152>, r=84969616 +pos=<26593265,67955055,22317572>, r=53382829 +pos=<5862115,67320726,-7744908>, r=94752728 +pos=<44977728,77579884,40227014>, r=63483062 +pos=<74393904,54186069,86175718>, r=93588247 +pos=<-30553363,66174930,35164879>, r=87112949 +pos=<846033,79419918,17759962>, r=86363085 +pos=<-40099609,59337331,41208658>, r=83777471 +pos=<-55842569,51636231,46920841>, r=86107111 +pos=<17515213,55299696,-11816155>, r=75149814 +pos=<-37784825,39818181,75335333>, r=92149923 +pos=<-12420237,59829730,35273741>, r=62525397 +pos=<-32523179,51372964,46315822>, r=63129489 +pos=<-30806438,72779505,49545610>, r=79589491 +pos=<-23829845,50807049,41247927>, r=58938154 +pos=<4660069,-16707481,46183487>, r=87031514 +pos=<-19549685,80746152,49937584>, r=75907412 +pos=<-41545505,49666087,63429881>, r=77870992 +pos=<-9176964,70779012,38604780>, r=66900348 +pos=<19366593,75787464,24120212>, r=57849927 +pos=<-14750430,73417796,44573391>, r=69144019 +pos=<-31774450,57071943,28643145>, r=85752443 +pos=<-7965034,60706991,44164680>, r=50056547 +pos=<51214616,73858526,38715005>, r=67510288 +pos=<10251526,69070534,101419818>, r=83468358 +pos=<-4958688,64877199,5190665>, r=90194415 +pos=<-36841538,57544331,33454243>, r=86481108 +pos=<-18958623,55225437,48608264>, r=51125038 +pos=<-3280361,53433769,-10771980>, r=93035347 +pos=<12825120,52631982,48360699>, r=96729476 +pos=<-42088987,52508004,30671939>, r=89474612 +pos=<-35099129,67549370,49921294>, r=78276592 +pos=<-6571815,67176770,76063719>, r=73042022 +pos=<2416377,56619494,72699592>, r=50132248 +pos=<97064159,50626941,48020070>, r=80823113 +pos=<51272253,26380803,33326913>, r=68335442 +pos=<9342781,53889780,43080304>, r=95582105 +pos=<-1683556,74871475,26684699>, r=75419689 +pos=<8655690,7777306,47799320>, r=56935265 +pos=<17035815,109258089,18976615>, r=98795114 +pos=<24611871,66002331,-21792415>, r=93558729 +pos=<31447616,56064626,18586455>, r=50077924 +pos=<-5130339,-22115664,52509829>, r=98603762 +pos=<92722633,107452480,143663345>, r=61974061 +pos=<-70026018,75795232,-32798349>, r=88409720 +pos=<15619226,95376541,39039546>, r=66267023 +pos=<-1207251,78798343,57094406>, r=60329522 +pos=<2132042,10320424,31576336>, r=77138788 +pos=<82004303,49184026,53999531>, r=64020754 +pos=<63570907,37966831,10497262>, r=91877487 +pos=<12030100,85242976,32983936>, r=65778531 +pos=<47765320,67685594,9420635>, r=87182355 +pos=<-25084947,55874463,49173858>, r=57334709 +pos=<37219734,65474633,8637481>, r=75209281 +pos=<23232094,68810264,43970026>, r=51966614 +pos=<9716868,85176052,86308160>, r=84996869 +pos=<-15307394,68315425,79438673>, r=86291752 +pos=<-24943052,40142371,19904420>, r=86063831 +pos=<-62778009,55062212,48188208>, r=95201334 +pos=<15774791,78686937,10759637>, r=77701773 +pos=<2412046,90195442,37515010>, r=75817676 +pos=<15199931,75830351,93500764>, r=77360701 +pos=<9763716,49114305,-19374106>, r=84274068 +pos=<19644689,89449989,35579117>, r=59775441 +pos=<12395354,50087041,5657795>, r=57583144 +pos=<12068322,56646634,81855752>, r=49663605 +pos=<-22969583,59602246,34244087>, r=73876898 +pos=<7580461,91934347,45722448>, r=64180664 +pos=<-3560538,72561264,14695420>, r=86975860 +pos=<-45074040,57657932,48541858>, r=79739309 +pos=<-18398078,65110734,53891019>, r=60629463 +pos=<44224718,33095683,31706952>, r=56192890 +pos=<-10774711,48950748,26982525>, r=58292086 +pos=<2605308,68722337,27786615>, r=63879636 +pos=<-1339359,24098920,22336372>, r=76071679 +pos=<-4438041,72545226,25089955>, r=77442602 +pos=<-6246231,34031597,15411121>, r=77971312 +pos=<-23002804,57043932,81328580>, r=84605074 +pos=<35048807,50807135,49019441>, r=94840805 +pos=<1863063,64010732,24909086>, r=62787946 +pos=<76640525,56175554,25669192>, r=88299186 +pos=<34310529,75546211,13529288>, r=77479538 +pos=<46878403,67399215,21839672>, r=73590048 +pos=<-29566728,48860198,32191929>, r=71784211 +pos=<47336901,99330017,45502113>, r=82316912 +pos=<35783602,102518119,56209209>, r=73343452 +pos=<38055746,55924973,-6345047>, r=81477836 +pos=<8608899,54529451,44721618>, r=91048066 +pos=<-23322941,35425975,65556423>, r=72301694 +pos=<66175266,61309696,33060367>, r=75577292 +pos=<-2630171,77181433,44606184>, r=60754647 +pos=<15615476,103373392,46114344>, r=67192771 +pos=<18720101,-5014280,15405990>, r=92055760 +pos=<19437849,105379399,13182198>, r=98308555 +pos=<24872430,207905077,10571812>, r=64706362 +pos=<-3900891,-17837213,48993241>, r=93912785 +pos=<4628129,84592380,46983368>, r=58530690 +pos=<-8500784,81354637,32649712>, r=82755023 +pos=<-21040160,59220604,49033361>, r=56776774 +pos=<-8569766,61063036,36874485>, r=58307563 +pos=<-61691190,46793583,48944174>, r=87121010 +pos=<97543945,38893710,37478590>, r=97942147 +pos=<-32468438,39994089,46330515>, r=67311544 +pos=<-50446554,34241799,50005562>, r=87366811 +pos=<80764682,64638264,33543385>, r=93011711 +pos=<-3359685,69242442,35795102>, r=62356521 +pos=<-7066785,39947970,1295266>, r=86991146 +pos=<19698314,74240211,86655363>, r=64426800 +pos=<-159219987,73286724,43691580>, r=80602293 +pos=<-10749338,68308806,69893809>, r=72181492 +pos=<4267160,31408568,28900755>, r=56591171 +pos=<29153070,55281220,-5024215>, r=70610604 +pos=<-31999404,51919732,53639756>, r=60788407 +pos=<20796365,7869106,-3949821>, r=96451932 +pos=<761180,51627157,44832255>, r=67227808 +pos=<-10078249,63600979,47754790>, r=51473612 +pos=<69320150,61417891,36283551>, r=75606574 +pos=<9296385,49261814,12112891>, r=53401849 +pos=<-7317543,43835002,26851576>, r=57798571 +pos=<-20323301,52285624,17357518>, r=80800563 +pos=<-32371707,7687445,53828813>, r=97361034 +pos=<-34553554,52364620,37734663>, r=74733323 +pos=<3375914,51345583,-24900541>, r=98419527 +pos=<31847704,77972619,20965665>, r=70006808 +pos=<-21691572,68915691,44331517>, r=71825213 +pos=<41498667,-13390854,46954930>, r=84705082 +pos=<7864562,60188918,15324170>, r=62549378 +pos=<-18338249,74638914,36374459>, r=82152065 +pos=<70679462,52058503,8730493>, r=95159593 +pos=<-37359151,56045979,34000785>, r=84954024 +pos=<3262220,66835742,37695863>, r=51427144 From df08b37dd29ec45bdb9aad421e8809bcd6a32b9f Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Tue, 31 Dec 2024 00:47:41 -0500 Subject: [PATCH 40/48] 2018: d23: ex2: add solution --- 2018/d23/ex2/ex2.py | 71 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100755 2018/d23/ex2/ex2.py diff --git a/2018/d23/ex2/ex2.py b/2018/d23/ex2/ex2.py new file mode 100755 index 0000000..fc8d477 --- /dev/null +++ b/2018/d23/ex2/ex2.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python + +import sys +from typing import NamedTuple + +import z3 + + +class Point(NamedTuple): + x: int + y: int + z: int + + +class NanoBot(NamedTuple): + pos: Point + r: int + + +def solve(input: str) -> int: + def parse_nanobot(input: str) -> NanoBot: + pos, r = input.split(", ") + pos = pos.removeprefix("pos=<").removesuffix(">") + r = r.removeprefix("r=") + return NanoBot(Point(*(int(n) for n in pos.split(","))), int(r)) + + def parse(input: list[str]) -> list[NanoBot]: + return [parse_nanobot(line) for line in input] + + def dist(lhs: Point, rhs: Point) -> int: + return sum(abs(l - r) for l, r in zip(lhs, rhs)) + + def find_best(bots: list[NanoBot]) -> Point: + def z3_abs(n: z3.ArithRef) -> z3.ArithRef: + return z3.If(n > 0, n, -n) # type: ignore + + def z3_dist(lhs: tuple[z3.ArithRef, ...], rhs: Point) -> z3.ArithRef: + return sum(z3_abs(l - r) for l, r in zip(lhs, rhs)) # type: ignore + + pos = tuple(z3.Int(c) for c in ("x", "y", "z")) + + in_range = [z3.Int(f"in_range_{i}") for i in range(len(bots))] + total = z3.Int("total") + optimizer = z3.Optimize() + + for i, bot in enumerate(bots): + optimizer.add(in_range[i] == (z3_dist(pos, bot.pos) <= bot.r)) + optimizer.add(total == sum(in_range)) + + dist_to_origin = z3.Int("dist_to_origin") + optimizer.add(dist_to_origin == z3_dist(pos, Point(0, 0, 0))) + + optimizer.maximize(total) + optimizer.minimize(dist_to_origin) + + assert optimizer.check() == z3.sat # Sanity check + model = optimizer.model() + + return Point(*(map(lambda v: model.eval(v).as_long(), pos))) # type: ignore + + bots = parse(input.splitlines()) + return dist(find_best(bots), Point(0, 0, 0)) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 0d8ba9e62bd679d19d11d9e44df321c80a1cff08 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Tue, 31 Dec 2024 12:39:35 -0500 Subject: [PATCH 41/48] 2018: d24: ex1: add input --- 2018/d24/ex1/input | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 2018/d24/ex1/input diff --git a/2018/d24/ex1/input b/2018/d24/ex1/input new file mode 100644 index 0000000..5ac4ea6 --- /dev/null +++ b/2018/d24/ex1/input @@ -0,0 +1,23 @@ +Immune System: +916 units each with 3041 hit points (weak to cold, fire) with an attack that does 29 fire damage at initiative 13 +1959 units each with 7875 hit points (weak to cold; immune to slashing, bludgeoning) with an attack that does 38 radiation damage at initiative 20 +8933 units each with 5687 hit points with an attack that does 6 slashing damage at initiative 15 +938 units each with 8548 hit points with an attack that does 89 radiation damage at initiative 4 +1945 units each with 3360 hit points (immune to cold; weak to radiation) with an attack that does 16 cold damage at initiative 1 +2211 units each with 7794 hit points (weak to slashing) with an attack that does 30 fire damage at initiative 12 +24 units each with 3693 hit points with an attack that does 1502 fire damage at initiative 5 +2004 units each with 4141 hit points (immune to radiation) with an attack that does 18 slashing damage at initiative 19 +3862 units each with 3735 hit points (immune to bludgeoning, fire) with an attack that does 9 fire damage at initiative 10 +8831 units each with 3762 hit points (weak to radiation) with an attack that does 3 fire damage at initiative 7 + +Infection: +578 units each with 55836 hit points with an attack that does 154 radiation damage at initiative 9 +476 units each with 55907 hit points (weak to fire) with an attack that does 208 cold damage at initiative 18 +496 units each with 33203 hit points (weak to fire, radiation; immune to cold, bludgeoning) with an attack that does 116 slashing damage at initiative 14 +683 units each with 12889 hit points (weak to fire) with an attack that does 35 bludgeoning damage at initiative 11 +1093 units each with 29789 hit points (immune to cold, fire) with an attack that does 51 radiation damage at initiative 17 +2448 units each with 40566 hit points (immune to bludgeoning, fire; weak to cold) with an attack that does 25 slashing damage at initiative 16 +1229 units each with 6831 hit points (weak to fire, cold; immune to slashing) with an attack that does 8 bludgeoning damage at initiative 8 +3680 units each with 34240 hit points (immune to bludgeoning; weak to fire, cold) with an attack that does 17 radiation damage at initiative 3 +4523 units each with 9788 hit points (immune to bludgeoning, fire, slashing) with an attack that does 3 bludgeoning damage at initiative 6 +587 units each with 49714 hit points (weak to bludgeoning) with an attack that does 161 fire damage at initiative 2 From 5f9a7cb80adf24945456bad384706ede155d5c6c Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Tue, 31 Dec 2024 12:39:39 -0500 Subject: [PATCH 42/48] 2018: d24: ex1: add solution --- 2018/d24/ex1/ex1.py | 188 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 188 insertions(+) create mode 100755 2018/d24/ex1/ex1.py diff --git a/2018/d24/ex1/ex1.py b/2018/d24/ex1/ex1.py new file mode 100755 index 0000000..9a89a26 --- /dev/null +++ b/2018/d24/ex1/ex1.py @@ -0,0 +1,188 @@ +#!/usr/bin/env python + +import dataclasses +import enum +import sys + + +@dataclasses.dataclass +class Group: + units: int + hp: int + weaknesses: set[str] + immunities: set[str] + attack: int + attack_type: str + initiative: int + + @classmethod + def from_raw(cls, input: str) -> "Group": + def split_sections(input: str) -> tuple[str, str, str]: + points_idx = input.index("hit points ") + with_idx = input.index(" with an attack") + return ( + input[:points_idx].strip(), + input[points_idx:with_idx].removeprefix("(").removesuffix(")"), + input[with_idx:].strip(), + ) + + def parse_weak_immune(weak_immune: str) -> tuple[set[str], set[str]]: + weaknesses: set[str] = set() + immunities: set[str] = set() + for part in weak_immune.split("; "): + for start, values in ( + ("weak to ", weaknesses), + ("immune to ", immunities), + ): + if not part.startswith(start): + continue + values.update(part.removeprefix(start).split(", ")) + return weaknesses, immunities + + group_str, weak_immune, attack_str = split_sections(input) + group_list, attack_list = group_str.split(), attack_str.split() + weaknesses, immunities = parse_weak_immune( + weak_immune.removeprefix("hit points (") + ) + return cls( + units=int(group_list[0]), + hp=int(group_list[4]), + weaknesses=weaknesses, + immunities=immunities, + attack=int(attack_list[5]), + attack_type=attack_list[6], + initiative=int(attack_list[10]), + ) + + @property + def alive(self) -> bool: + return self.units > 0 + + @property + def effective_power(self) -> int: + return self.units * self.attack + + def potential_attack(self, ennemy: "Group") -> int: + multiplier = 1 + if self.attack_type in ennemy.weaknesses: + multiplier = 2 + if self.attack_type in ennemy.immunities: + multiplier = 0 + return self.effective_power * multiplier + + +class Army(enum.StrEnum): + INFECTION = "INFECTION" + IMMUNE = "IMMUNE" + + def ennemy(self) -> "Army": + if self == Army.INFECTION: + return Army.IMMUNE + if self == Army.IMMUNE: + return Army.INFECTION + assert False # Sanity check + + +@dataclasses.dataclass +class Armies: + immune: list[Group] + infection: list[Group] + + @classmethod + def from_raw(cls, input: str) -> "Armies": + immune, infection = map(str.splitlines, input.split("\n\n")) + assert "Immune System:" == immune[0] # Sanity check + assert "Infection:" == infection[0] # Sanity check + return cls( + list(map(Group.from_raw, immune[1:])), + list(map(Group.from_raw, infection[1:])), + ) + + def army(self, army: Army) -> list[Group]: + if army == Army.IMMUNE: + return self.immune + if army == Army.INFECTION: + return self.infection + assert False # Sanity check + + def active_groups(self, army: Army) -> set[int]: + return {i for i, group in enumerate(self.army(army)) if group.alive} + + def selection_phase(self) -> dict[tuple[Army, int], int]: + # Armies are sorted by decreasing power, initiative + def power_order(group: Group) -> tuple[int, int]: + return group.effective_power, group.initiative + + # Targets are ordered in decreasing potential attack, power, initiative + def target_order(group: Group, ennemy: Group) -> tuple[int, int, int]: + return ( + group.potential_attack(ennemy), + ennemy.effective_power, + ennemy.initiative, + ) + + res: dict[tuple[Army, int], int] = {} + for army in Army: + army_indices = sorted( + self.active_groups(army), + key=lambda i: power_order(self.army(army)[i]), + reverse=True, + ) + ennemies = self.army(army.ennemy()) + indices = set(self.active_groups(army.ennemy())) + for i in army_indices: + group = self.army(army)[i] + if not indices: + break + target = max(indices, key=lambda j: target_order(group, ennemies[j])) + # Skip target if we cannot deal damage to it + if group.potential_attack(ennemies[target]) == 0: + continue + res[(army, i)] = target + # Targets must be different for each attack + indices.remove(target) + return res + + def attack_phase(self, targets: dict[tuple[Army, int], int]) -> None: + # Armies take turn by initiative, regardless of type + turn_order = sorted( + ((army, i) for army in Army for i in self.active_groups(army)), + key=lambda t: self.army(t[0])[t[1]].initiative, + reverse=True, + ) + for army, i in turn_order: + # Empty armies do not fight + if not self.army(army)[i].alive: + continue + # Army must have a target selected + if (target := targets.get((army, i))) is None: + continue + attackers = self.army(army)[i] + defender = self.army(army.ennemy())[target] + damage = attackers.potential_attack(defender) + defender.units -= min(damage // defender.hp, defender.units) + + def fight(self) -> None: + while self.active_groups(Army.IMMUNE) and self.active_groups(Army.INFECTION): + targets = self.selection_phase() + self.attack_phase(targets) + + +def solve(input: str) -> int: + def parse(input: str) -> Armies: + return Armies.from_raw(input) + + armies = parse(input) + armies.fight() + return sum( + group.units for army in (armies.immune, armies.infection) for group in army + ) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From da0803985b6e612233adf04899f70f152719210a Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Tue, 31 Dec 2024 12:39:47 -0500 Subject: [PATCH 43/48] 2018: d24: ex2: add input --- 2018/d24/ex2/input | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 2018/d24/ex2/input diff --git a/2018/d24/ex2/input b/2018/d24/ex2/input new file mode 100644 index 0000000..5ac4ea6 --- /dev/null +++ b/2018/d24/ex2/input @@ -0,0 +1,23 @@ +Immune System: +916 units each with 3041 hit points (weak to cold, fire) with an attack that does 29 fire damage at initiative 13 +1959 units each with 7875 hit points (weak to cold; immune to slashing, bludgeoning) with an attack that does 38 radiation damage at initiative 20 +8933 units each with 5687 hit points with an attack that does 6 slashing damage at initiative 15 +938 units each with 8548 hit points with an attack that does 89 radiation damage at initiative 4 +1945 units each with 3360 hit points (immune to cold; weak to radiation) with an attack that does 16 cold damage at initiative 1 +2211 units each with 7794 hit points (weak to slashing) with an attack that does 30 fire damage at initiative 12 +24 units each with 3693 hit points with an attack that does 1502 fire damage at initiative 5 +2004 units each with 4141 hit points (immune to radiation) with an attack that does 18 slashing damage at initiative 19 +3862 units each with 3735 hit points (immune to bludgeoning, fire) with an attack that does 9 fire damage at initiative 10 +8831 units each with 3762 hit points (weak to radiation) with an attack that does 3 fire damage at initiative 7 + +Infection: +578 units each with 55836 hit points with an attack that does 154 radiation damage at initiative 9 +476 units each with 55907 hit points (weak to fire) with an attack that does 208 cold damage at initiative 18 +496 units each with 33203 hit points (weak to fire, radiation; immune to cold, bludgeoning) with an attack that does 116 slashing damage at initiative 14 +683 units each with 12889 hit points (weak to fire) with an attack that does 35 bludgeoning damage at initiative 11 +1093 units each with 29789 hit points (immune to cold, fire) with an attack that does 51 radiation damage at initiative 17 +2448 units each with 40566 hit points (immune to bludgeoning, fire; weak to cold) with an attack that does 25 slashing damage at initiative 16 +1229 units each with 6831 hit points (weak to fire, cold; immune to slashing) with an attack that does 8 bludgeoning damage at initiative 8 +3680 units each with 34240 hit points (immune to bludgeoning; weak to fire, cold) with an attack that does 17 radiation damage at initiative 3 +4523 units each with 9788 hit points (immune to bludgeoning, fire, slashing) with an attack that does 3 bludgeoning damage at initiative 6 +587 units each with 49714 hit points (weak to bludgeoning) with an attack that does 161 fire damage at initiative 2 From 759def15c90483b24a5c5bb51ac0c7f69de7638f Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Tue, 31 Dec 2024 12:40:01 -0500 Subject: [PATCH 44/48] 2018: d24: ex2: add solution --- 2018/d24/ex2/ex2.py | 219 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 219 insertions(+) create mode 100755 2018/d24/ex2/ex2.py diff --git a/2018/d24/ex2/ex2.py b/2018/d24/ex2/ex2.py new file mode 100755 index 0000000..481adc2 --- /dev/null +++ b/2018/d24/ex2/ex2.py @@ -0,0 +1,219 @@ +#!/usr/bin/env python + +import copy +import dataclasses +import enum +import sys + + +@dataclasses.dataclass +class Group: + units: int + hp: int + weaknesses: set[str] + immunities: set[str] + attack: int + attack_type: str + initiative: int + + @classmethod + def from_raw(cls, input: str) -> "Group": + def split_sections(input: str) -> tuple[str, str, str]: + points_idx = input.index("hit points ") + with_idx = input.index(" with an attack") + return ( + input[:points_idx].strip(), + input[points_idx:with_idx].removeprefix("(").removesuffix(")"), + input[with_idx:].strip(), + ) + + def parse_weak_immune(weak_immune: str) -> tuple[set[str], set[str]]: + weaknesses: set[str] = set() + immunities: set[str] = set() + for part in weak_immune.split("; "): + for start, values in ( + ("weak to ", weaknesses), + ("immune to ", immunities), + ): + if not part.startswith(start): + continue + values.update(part.removeprefix(start).split(", ")) + return weaknesses, immunities + + group_str, weak_immune, attack_str = split_sections(input) + group_list, attack_list = group_str.split(), attack_str.split() + weaknesses, immunities = parse_weak_immune( + weak_immune.removeprefix("hit points (") + ) + return cls( + units=int(group_list[0]), + hp=int(group_list[4]), + weaknesses=weaknesses, + immunities=immunities, + attack=int(attack_list[5]), + attack_type=attack_list[6], + initiative=int(attack_list[10]), + ) + + @property + def alive(self) -> bool: + return self.units > 0 + + @property + def effective_power(self) -> int: + return self.units * self.attack + + def potential_attack(self, ennemy: "Group") -> int: + multiplier = 1 + if self.attack_type in ennemy.weaknesses: + multiplier = 2 + if self.attack_type in ennemy.immunities: + multiplier = 0 + return self.effective_power * multiplier + + +class LoopError(Exception): + pass + + +class Army(enum.StrEnum): + INFECTION = "INFECTION" + IMMUNE = "IMMUNE" + + def ennemy(self) -> "Army": + if self == Army.INFECTION: + return Army.IMMUNE + if self == Army.IMMUNE: + return Army.INFECTION + assert False # Sanity check + + +@dataclasses.dataclass +class Armies: + immune: list[Group] + infection: list[Group] + + @classmethod + def from_raw(cls, input: str) -> "Armies": + immune, infection = map(str.splitlines, input.split("\n\n")) + assert "Immune System:" == immune[0] # Sanity check + assert "Infection:" == infection[0] # Sanity check + return cls( + list(map(Group.from_raw, immune[1:])), + list(map(Group.from_raw, infection[1:])), + ) + + def army(self, army: Army) -> list[Group]: + if army == Army.IMMUNE: + return self.immune + if army == Army.INFECTION: + return self.infection + assert False # Sanity check + + def active_groups(self, army: Army) -> set[int]: + return {i for i, group in enumerate(self.army(army)) if group.alive} + + def selection_phase(self) -> dict[tuple[Army, int], int]: + # Armies are sorted by decreasing power, initiative + def power_order(group: Group) -> tuple[int, int]: + return group.effective_power, group.initiative + + # Targets are ordered in decreasing potential attack, power, initiative + def target_order(group: Group, ennemy: Group) -> tuple[int, int, int]: + return ( + group.potential_attack(ennemy), + ennemy.effective_power, + ennemy.initiative, + ) + + res: dict[tuple[Army, int], int] = {} + for army in Army: + army_indices = sorted( + self.active_groups(army), + key=lambda i: power_order(self.army(army)[i]), + reverse=True, + ) + ennemies = self.army(army.ennemy()) + indices = set(self.active_groups(army.ennemy())) + for i in army_indices: + group = self.army(army)[i] + if not indices: + break + target = max(indices, key=lambda j: target_order(group, ennemies[j])) + # Skip target if we cannot deal damage to it + if group.potential_attack(ennemies[target]) == 0: + continue + res[(army, i)] = target + # Targets must be different for each attack + indices.remove(target) + return res + + def attack_phase(self, targets: dict[tuple[Army, int], int]) -> None: + # Armies take turn by initiative, regardless of type + turn_order = sorted( + ((army, i) for army in Army for i in self.active_groups(army)), + key=lambda t: self.army(t[0])[t[1]].initiative, + reverse=True, + ) + any_kills = False + for army, i in turn_order: + # Empty armies do not fight + if not self.army(army)[i].alive: + continue + # Army must have a target selected + if (target := targets.get((army, i))) is None: + continue + attackers = self.army(army)[i] + defender = self.army(army.ennemy())[target] + damage = attackers.potential_attack(defender) + killed_units = min(damage // defender.hp, defender.units) + defender.units -= killed_units + # Detect if no kills were done to avoid loops + any_kills |= bool(killed_units) + # If no units were killed, we're about to enter an infinite loop + if not any_kills: + raise LoopError + + def fight(self) -> None: + while self.active_groups(Army.IMMUNE) and self.active_groups(Army.INFECTION): + targets = self.selection_phase() + self.attack_phase(targets) + + +def solve(input: str) -> int: + def parse(input: str) -> Armies: + return Armies.from_raw(input) + + def apply_boost(armies: Armies, boost: int) -> int: + armies = copy.deepcopy(armies) + for group in armies.immune: + group.attack += boost + try: + armies.fight() + except LoopError: + return 0 + return sum(group.units for group in armies.immune) + + def bisect_boost(armies: Armies) -> int: + # Winning the fight feels like it should be monotonic + low, high = 0, 100000 # Probably good enough + while low < high: + mid = low + (high - low) // 2 + if apply_boost(armies, mid) != 0: + high = mid + else: + low = mid + 1 + # Wastefully re-run the fight to get the number of remaining units + return apply_boost(armies, low) + + armies = parse(input) + return bisect_boost(armies) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 00ed576a42510a62d17471b82700f712747d6e61 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Tue, 31 Dec 2024 13:16:08 -0500 Subject: [PATCH 45/48] 2018: d25: ex1: add input --- 2018/d25/ex1/input | 1378 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1378 insertions(+) create mode 100644 2018/d25/ex1/input diff --git a/2018/d25/ex1/input b/2018/d25/ex1/input new file mode 100644 index 0000000..4db8aa8 --- /dev/null +++ b/2018/d25/ex1/input @@ -0,0 +1,1378 @@ +0,6,-4,7 +5,4,0,-8 +0,1,1,-2 +7,-1,0,-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7 +2,4,-1,6 +4,0,8,1 +-4,0,8,0 +0,5,8,3 +3,-2,-6,4 +3,-5,-6,-6 +6,-2,2,-6 +-6,0,2,-4 +-3,5,0,0 +-3,5,-1,-4 +-8,-8,6,2 +0,-6,-2,5 +-8,-6,-3,3 +2,8,0,7 +-7,-8,5,-3 +-7,-6,6,-3 +2,2,4,0 +5,-7,3,4 +2,-5,6,-6 +-4,4,-7,7 +-2,-4,1,8 +-2,0,8,7 +4,-5,2,0 +-3,-3,0,5 +0,-8,1,4 +4,4,4,-5 +-4,5,8,7 +6,-3,-4,2 +-5,1,0,-8 +-6,2,5,-5 +1,0,-5,8 +8,8,-8,5 +2,-2,7,8 +-1,-8,5,-3 +7,7,-8,3 +3,4,1,2 +5,3,6,8 +-5,-7,-8,2 +-3,4,8,-8 +4,0,8,0 +7,-8,4,2 +6,6,-8,5 +-4,7,-5,-1 +-1,2,3,-2 +1,0,-8,1 From 220afe0b8a0895a9eb0ec80735b25a5b012bf098 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Tue, 31 Dec 2024 13:16:13 -0500 Subject: [PATCH 46/48] 2018: d25: ex1: add solution --- 2018/d25/ex1/ex1.py | 111 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100755 2018/d25/ex1/ex1.py diff --git a/2018/d25/ex1/ex1.py b/2018/d25/ex1/ex1.py new file mode 100755 index 0000000..c24f172 --- /dev/null +++ b/2018/d25/ex1/ex1.py @@ -0,0 +1,111 @@ +#!/usr/bin/env python + +import collections +import itertools +import sys +from collections.abc import Iterable +from typing import Generic, Hashable, NamedTuple, TypeVar + + +class Point(NamedTuple): + x: int + y: int + z: int + t: int + + +class UnionFind: + _parent: list[int] + _rank: list[int] + + def __init__(self, size: int): + # Each node is in its own set, making it its own parent... + self._parent = list(range(size)) + # ... And its rank 0 + self._rank = [0] * size + + def find(self, elem: int) -> int: + while (parent := self._parent[elem]) != elem: + # Replace each parent link by a link to the grand-parent + elem, self._parent[elem] = parent, self._parent[parent] + return elem + + def union(self, lhs: int, rhs: int) -> int: + lhs = self.find(lhs) + rhs = self.find(rhs) + # Bail out early if they already belong to the same set + if lhs == rhs: + return lhs + # Always keep `lhs` as the taller tree + if self._rank[lhs] < self._rank[rhs]: + lhs, rhs = rhs, lhs + # Merge the smaller tree into the taller one + self._parent[rhs] = lhs + # Update the rank when merging trees of approximately the same size + if self._rank[lhs] == self._rank[rhs]: + self._rank[lhs] += 1 + return lhs + + def sets(self) -> dict[int, set[int]]: + res: dict[int, set[int]] = collections.defaultdict(set) + for elem in range(len(self._parent)): + res[self.find(elem)].add(elem) + return dict(res) + + +# PEP 695 still not supported by MyPy... +T = TypeVar("T", bound=Hashable) + + +class DisjointSet(Generic[T]): + _values: list[T] + _to_index: dict[T, int] + _sets: UnionFind + + def __init__(self, values: Iterable[T]) -> None: + self._values = list(values) + self._to_index = {v: i for i, v in enumerate(self._values)} + self._sets = UnionFind(len(self._values)) + + def find(self, elem: T) -> T: + return self._values[self._sets.find(self._to_index[elem])] + + def union(self, lhs: T, rhs: T) -> T: + return self._values[self._sets.union(self._to_index[lhs], self._to_index[rhs])] + + def sets(self) -> dict[T, set[T]]: + sets = self._sets.sets() + return { + self._values[r]: {self._values[i] for i in values} + for r, values in sets.items() + } + + +def solve(input: str) -> int: + def parse(input: list[str]) -> list[Point]: + return [Point(*map(int, line.split(","))) for line in input] + + def dist(lhs: Point, rhs: Point) -> int: + return sum(abs(l - r) for l, r in zip(lhs, rhs)) + + def count_constellations(points: list[Point]) -> int: + sets = DisjointSet(points) + + for a, b in itertools.combinations(points, 2): + if dist(a, b) > 3: + continue + sets.union(a, b) + + return len(sets.sets()) + + points = parse(input.splitlines()) + return count_constellations(points) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From a6c001755357b9439aa4ad7ab623a6e39e7e5196 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Tue, 31 Dec 2024 13:16:19 -0500 Subject: [PATCH 47/48] 2018: d25: ex2: add input --- 2018/d25/ex2/input | 1378 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1378 insertions(+) create mode 100644 2018/d25/ex2/input diff --git a/2018/d25/ex2/input b/2018/d25/ex2/input new file mode 100644 index 0000000..4db8aa8 --- /dev/null +++ b/2018/d25/ex2/input @@ -0,0 +1,1378 @@ +0,6,-4,7 +5,4,0,-8 +0,1,1,-2 +7,-1,0,-2 +-3,4,0,6 +-3,-4,-2,1 +-7,-5,-4,3 +0,-4,6,2 +2,-4,0,7 +7,-4,-7,-4 +-7,-3,6,8 +0,-4,4,-6 +-2,-1,-3,0 +-4,7,-2,3 +-3,0,-8,3 +-2,-5,0,-4 +4,7,6,-8 +-1,7,8,-3 +-1,6,-8,8 +-6,6,0,-3 +-2,-7,-3,-8 +6,7,-2,-4 +7,-4,7,-4 +8,6,-3,-8 +0,-7,-2,-7 +-3,0,-8,4 +7,-2,2,6 +-5,1,8,-4 +0,-4,-7,5 +0,2,-8,1 +-5,-1,-2,-8 +-1,-2,-5,0 +-5,6,0,5 +3,-8,1,-6 +-5,-2,1,0 +0,-1,6,-3 +-6,-5,-1,2 +2,6,5,-1 +-7,-7,-7,0 +6,-6,-1,-6 +0,5,8,-7 +3,-4,5,3 +-4,-6,6,-4 +3,2,2,-1 +5,0,-6,-2 +-1,4,4,4 +0,8,6,7 +7,0,-5,-4 +-8,-1,-1,7 +-6,-7,2,-5 +8,-4,-3,-8 +2,-5,7,5 +-3,7,7,0 +1,4,6,3 +4,5,3,5 +-2,-6,-6,4 +-3,2,-6,0 +5,0,3,3 +-3,-1,2,1 +0,0,0,1 +-1,2,3,5 +-7,8,6,6 +-4,8,4,0 +1,8,3,5 +-3,-1,1,3 +0,4,7,6 +0,-1,2,-8 +1,7,-5,-2 +-6,0,-7,6 +-8,-7,-2,3 +0,5,5,-5 +1,-2,0,-5 +8,1,1,8 +3,-8,6,7 +-8,-7,-3,0 +2,-5,-8,-2 +3,5,1,-7 +5,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+6,-8,5,-7 +-6,-3,0,-1 +1,-2,-3,-6 +-3,-2,-7,-3 +0,-7,-8,3 +-6,-3,-1,2 +-4,8,2,-8 +-7,-2,2,1 +6,0,7,-2 +-3,-1,-6,1 +0,5,2,-5 +0,0,4,-8 +-1,-1,7,4 +6,3,3,-6 +0,5,2,6 +-8,-8,1,-7 +-1,-4,-1,7 +0,5,-8,-5 +1,-4,-7,-6 +3,4,6,-4 +1,-5,7,7 +2,4,-1,6 +4,0,8,1 +-4,0,8,0 +0,5,8,3 +3,-2,-6,4 +3,-5,-6,-6 +6,-2,2,-6 +-6,0,2,-4 +-3,5,0,0 +-3,5,-1,-4 +-8,-8,6,2 +0,-6,-2,5 +-8,-6,-3,3 +2,8,0,7 +-7,-8,5,-3 +-7,-6,6,-3 +2,2,4,0 +5,-7,3,4 +2,-5,6,-6 +-4,4,-7,7 +-2,-4,1,8 +-2,0,8,7 +4,-5,2,0 +-3,-3,0,5 +0,-8,1,4 +4,4,4,-5 +-4,5,8,7 +6,-3,-4,2 +-5,1,0,-8 +-6,2,5,-5 +1,0,-5,8 +8,8,-8,5 +2,-2,7,8 +-1,-8,5,-3 +7,7,-8,3 +3,4,1,2 +5,3,6,8 +-5,-7,-8,2 +-3,4,8,-8 +4,0,8,0 +7,-8,4,2 +6,6,-8,5 +-4,7,-5,-1 +-1,2,3,-2 +1,0,-8,1 From 4fc6136588f4a477c5eec36e3939e8555fe6a67e Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Tue, 31 Dec 2024 13:16:24 -0500 Subject: [PATCH 48/48] 2018: d25: ex2: add solution --- 2018/d25/ex2/ex2.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100755 2018/d25/ex2/ex2.py diff --git a/2018/d25/ex2/ex2.py b/2018/d25/ex2/ex2.py new file mode 100755 index 0000000..918e0ec --- /dev/null +++ b/2018/d25/ex2/ex2.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python + + +def main() -> None: + print("There is no part two...") + + +if __name__ == "__main__": + main()