From 67e41503c96e393f812b22e090a8ebe487a13f85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=C3=ABl=20Capelle?= Date: Fri, 13 Dec 2024 09:15:23 +0100 Subject: [PATCH] 2024 day 13. --- poetry.lock | 15 +- pyproject.toml | 1 + src/holt59/aoc/2024/day13.py | 74 +- src/holt59/aoc/inputs/holt59/2024/day13.txt | 1279 +++++++++++++++++++ src/holt59/aoc/inputs/tests/2024/day13.txt | 15 + 5 files changed, 1381 insertions(+), 3 deletions(-) diff --git a/poetry.lock b/poetry.lock index ac71c61..22b401a 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.4 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. [[package]] name = "appnope" @@ -353,6 +353,17 @@ files = [ [package.dependencies] traitlets = "*" +[[package]] +name = "more-itertools" +version = "10.5.0" +description = "More routines for operating on iterables, beyond itertools" +optional = false +python-versions = ">=3.8" +files = [ + {file = "more-itertools-10.5.0.tar.gz", hash = "sha256:5482bfef7849c25dc3c6dd53a6173ae4795da2a41a80faea6700d9f5846c5da6"}, + {file = "more_itertools-10.5.0-py3-none-any.whl", hash = "sha256:037b0d3203ce90cca8ab1defbbdac29d5f993fc20131f3664dc8d6acfa872aef"}, +] + [[package]] name = "mpmath" version = "1.3.0" @@ -1295,4 +1306,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "c91bc307ff4a5b3e8cd1976ebea211c9749fe09d563dd80861f70ce26826cda9" +content-hash = "10ecc039b99b304e65eef14905c0fb0fcc7b8fb31328b19c65b54779fcc0e336" diff --git a/pyproject.toml b/pyproject.toml index 2fd2d8a..e490fb7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,6 +16,7 @@ scipy = "^1.14.1" sympy = "^1.13.3" networkx = "^3.4.2" pandas = "^2.2.3" +more-itertools = "^10.5.0" [tool.poetry.group.dev.dependencies] pyright = "^1.1.389" diff --git a/src/holt59/aoc/2024/day13.py b/src/holt59/aoc/2024/day13.py index 07e201e..7e7792e 100644 --- a/src/holt59/aoc/2024/day13.py +++ b/src/holt59/aoc/2024/day13.py @@ -1,7 +1,79 @@ +import math +from dataclasses import dataclass from typing import Any, Iterator +import parse # pyright: ignore[reportMissingTypeStubs] + from ..base import BaseSolver +@dataclass(frozen=True) +class Machine: + prize: tuple[int, int] + button_a: tuple[int, int] + button_b: tuple[int, int] + + +def read_machine(block: str) -> Machine: + ba = parse.parse( # type: ignore + """Button A: X{bax:d}, Y{bay:d} +Button B: X{bbx:d}, Y{bby:d} +Prize: X={px:d}, Y={py:d}""", + block, + ) + return Machine( + prize=(ba["px"], ba["py"]), # type: ignore + button_a=(ba["bax"], ba["bay"]), # type: ignore + button_b=(ba["bbx"], ba["bby"]), # type: ignore + ) + + +def diophantine(a: int, b: int, c: int) -> tuple[int, int]: + q, r = divmod(a, b) + if r == 0: + return (0, c // b) + else: + u, v = diophantine(b, r, c) + return (v, u - q * v) + + +def solve(machine: Machine) -> int: + (ax, ay), (bx, by), (px, py) = machine.button_a, machine.button_b, machine.prize + dx, dy = math.gcd(ax, bx), math.gcd(ay, by) + + if px % dx != 0 or py % dy != 0: + return 0 + + xa, xb = diophantine(ax, bx, px) + ya, yb = diophantine(ay, by, py) + + # expr (x): xa - kx * bx / dx, xb + kx * ax / dx + # expr (y): ya - ky * by / dy, yb + ky * ay / dy + + num = ay * (ya - xa) + by * (yb - xb) + den = (ax * by - ay * bx) // dx + + if num % den != 0: + return 0 + + kx = num // den + pa, pb = xa - kx * bx // dx, xb + kx * ax // dx + return 3 * pa + pb + + class Solver(BaseSolver): - def solve(self, input: str) -> Iterator[Any]: ... + def solve(self, input: str) -> Iterator[Any]: + machines = [read_machine(block) for block in input.split("\n\n")] + + yield sum(map(solve, machines)) + + shift = 10000000000000 + machines = [ + Machine( + prize=(shift + m.prize[0], shift + m.prize[1]), + button_a=m.button_a, + button_b=m.button_b, + ) + for m in machines + ] + yield sum(map(solve, machines)) diff --git a/src/holt59/aoc/inputs/holt59/2024/day13.txt b/src/holt59/aoc/inputs/holt59/2024/day13.txt index e69de29..039e83d 100644 --- a/src/holt59/aoc/inputs/holt59/2024/day13.txt +++ b/src/holt59/aoc/inputs/holt59/2024/day13.txt @@ -0,0 +1,1279 @@ +Button A: X+38, Y+33 +Button B: X+11, Y+47 +Prize: X=1461, Y=2879 + +Button A: X+77, Y+14 +Button B: X+15, Y+80 +Prize: X=11953, Y=16146 + +Button A: X+74, Y+90 +Button B: X+52, Y+13 +Prize: X=3526, Y=3384 + +Button A: X+30, Y+13 +Button B: X+46, Y+70 +Prize: X=11420, Y=16443 + +Button A: X+12, Y+46 +Button B: X+21, Y+11 +Prize: X=8099, Y=12717 + +Button A: X+36, Y+13 +Button B: X+41, Y+66 +Prize: X=6419, Y=13070 + +Button A: X+27, Y+53 +Button B: X+37, Y+15 +Prize: X=5668, Y=1112 + +Button A: X+53, Y+21 +Button B: X+38, Y+74 +Prize: X=17062, Y=6282 + +Button A: X+18, Y+70 +Button B: X+38, Y+12 +Prize: X=17222, Y=7342 + +Button A: X+80, Y+19 +Button B: X+54, Y+66 +Prize: X=6378, Y=4014 + +Button A: X+77, Y+71 +Button B: X+88, Y+15 +Prize: X=8569, Y=6380 + +Button A: X+27, Y+57 +Button B: X+55, Y+23 +Prize: X=3315, Y=12067 + +Button A: X+87, Y+89 +Button B: X+11, Y+77 +Prize: X=6983, Y=13521 + +Button A: X+12, Y+54 +Button B: X+67, Y+15 +Prize: X=15107, Y=12005 + +Button A: X+29, Y+72 +Button B: X+91, Y+37 +Prize: X=9614, Y=5354 + +Button A: X+56, Y+69 +Button B: X+68, Y+22 +Prize: X=9480, Y=6120 + +Button A: X+46, Y+32 +Button B: X+17, Y+40 +Prize: X=2109, Y=2904 + +Button A: X+53, Y+12 +Button B: X+27, Y+78 +Prize: X=13205, Y=6050 + +Button A: X+26, Y+58 +Button B: X+66, Y+28 +Prize: X=8892, Y=1786 + +Button A: X+53, Y+25 +Button B: X+24, Y+48 +Prize: X=6546, Y=14506 + +Button A: X+61, Y+90 +Button B: X+91, Y+33 +Prize: X=4751, Y=5592 + +Button A: X+69, Y+15 +Button B: X+15, Y+63 +Prize: X=8156, Y=7136 + +Button A: X+82, Y+87 +Button B: X+16, Y+86 +Prize: X=7330, Y=10745 + +Button A: X+54, Y+15 +Button B: X+20, Y+45 +Prize: X=17428, Y=6920 + +Button A: X+67, Y+70 +Button B: X+63, Y+14 +Prize: X=2989, Y=1050 + +Button A: X+20, Y+66 +Button B: X+57, Y+18 +Prize: X=10935, Y=9554 + +Button A: X+29, Y+51 +Button B: X+54, Y+29 +Prize: X=3771, Y=7210 + +Button A: X+50, Y+81 +Button B: X+71, Y+37 +Prize: X=8410, Y=8943 + +Button A: X+73, Y+18 +Button B: X+11, Y+37 +Prize: X=1239, Y=3827 + +Button A: X+58, Y+55 +Button B: X+28, Y+99 +Prize: X=3156, Y=7557 + +Button A: X+99, Y+34 +Button B: X+24, Y+36 +Prize: X=8631, Y=3214 + +Button A: X+48, Y+76 +Button B: X+85, Y+25 +Prize: X=6812, Y=5964 + +Button A: X+43, Y+74 +Button B: X+46, Y+19 +Prize: X=9606, Y=1424 + +Button A: X+47, Y+13 +Button B: X+14, Y+40 +Prize: X=13405, Y=11139 + +Button A: X+46, Y+54 +Button B: X+12, Y+91 +Prize: X=4886, Y=10812 + +Button A: X+17, Y+84 +Button B: X+34, Y+35 +Prize: X=2159, Y=6678 + +Button A: X+46, Y+15 +Button B: X+23, Y+58 +Prize: X=18454, Y=1703 + +Button A: X+18, Y+57 +Button B: X+99, Y+18 +Prize: X=10395, Y=6618 + +Button A: X+82, Y+32 +Button B: X+48, Y+95 +Prize: X=2784, Y=2383 + +Button A: X+65, Y+44 +Button B: X+11, Y+37 +Prize: X=19146, Y=4461 + +Button A: X+17, Y+33 +Button B: X+50, Y+11 +Prize: X=13534, Y=3521 + +Button A: X+29, Y+12 +Button B: X+11, Y+78 +Prize: X=1248, Y=7494 + +Button A: X+35, Y+62 +Button B: X+59, Y+34 +Prize: X=3162, Y=4332 + +Button A: X+24, Y+90 +Button B: X+80, Y+25 +Prize: X=7656, Y=9735 + +Button A: X+82, Y+14 +Button B: X+30, Y+61 +Prize: X=5742, Y=6177 + +Button A: X+11, Y+72 +Button B: X+88, Y+24 +Prize: X=3487, Y=4056 + +Button A: X+14, Y+65 +Button B: X+66, Y+48 +Prize: X=2988, Y=2502 + +Button A: X+84, Y+14 +Button B: X+28, Y+87 +Prize: X=6216, Y=5729 + +Button A: X+17, Y+70 +Button B: X+64, Y+12 +Prize: X=6571, Y=17770 + +Button A: X+42, Y+13 +Button B: X+28, Y+41 +Prize: X=2338, Y=3084 + +Button A: X+19, Y+38 +Button B: X+76, Y+14 +Prize: X=7771, Y=2156 + +Button A: X+47, Y+20 +Button B: X+14, Y+63 +Prize: X=4304, Y=18772 + +Button A: X+33, Y+58 +Button B: X+44, Y+14 +Prize: X=7657, Y=6452 + +Button A: X+54, Y+76 +Button B: X+98, Y+15 +Prize: X=8484, Y=2721 + +Button A: X+20, Y+40 +Button B: X+36, Y+15 +Prize: X=19800, Y=16585 + +Button A: X+13, Y+89 +Button B: X+66, Y+66 +Prize: X=2145, Y=9669 + +Button A: X+80, Y+15 +Button B: X+40, Y+49 +Prize: X=10680, Y=5198 + +Button A: X+74, Y+17 +Button B: X+15, Y+73 +Prize: X=12709, Y=10781 + +Button A: X+15, Y+59 +Button B: X+77, Y+17 +Prize: X=6280, Y=6120 + +Button A: X+50, Y+14 +Button B: X+30, Y+77 +Prize: X=3330, Y=10497 + +Button A: X+40, Y+80 +Button B: X+37, Y+13 +Prize: X=3609, Y=2521 + +Button A: X+48, Y+96 +Button B: X+48, Y+18 +Prize: X=2400, Y=1992 + +Button A: X+75, Y+22 +Button B: X+18, Y+72 +Prize: X=5442, Y=7868 + +Button A: X+13, Y+44 +Button B: X+58, Y+33 +Prize: X=17227, Y=9230 + +Button A: X+13, Y+66 +Button B: X+88, Y+76 +Prize: X=5659, Y=8338 + +Button A: X+59, Y+18 +Button B: X+18, Y+44 +Prize: X=3114, Y=1340 + +Button A: X+32, Y+11 +Button B: X+20, Y+49 +Prize: X=18756, Y=13214 + +Button A: X+61, Y+40 +Button B: X+11, Y+32 +Prize: X=4473, Y=3528 + +Button A: X+65, Y+13 +Button B: X+23, Y+78 +Prize: X=16396, Y=11274 + +Button A: X+13, Y+40 +Button B: X+33, Y+13 +Prize: X=2924, Y=2268 + +Button A: X+58, Y+34 +Button B: X+20, Y+41 +Prize: X=17404, Y=7897 + +Button A: X+86, Y+20 +Button B: X+12, Y+78 +Prize: X=18048, Y=9798 + +Button A: X+17, Y+79 +Button B: X+96, Y+30 +Prize: X=8430, Y=8382 + +Button A: X+98, Y+39 +Button B: X+34, Y+48 +Prize: X=6620, Y=4875 + +Button A: X+66, Y+67 +Button B: X+91, Y+19 +Prize: X=5961, Y=2309 + +Button A: X+65, Y+85 +Button B: X+82, Y+18 +Prize: X=4930, Y=3770 + +Button A: X+13, Y+24 +Button B: X+41, Y+22 +Prize: X=6060, Y=4002 + +Button A: X+34, Y+76 +Button B: X+44, Y+15 +Prize: X=9062, Y=6068 + +Button A: X+20, Y+57 +Button B: X+94, Y+62 +Prize: X=9522, Y=10048 + +Button A: X+37, Y+69 +Button B: X+80, Y+18 +Prize: X=7086, Y=3900 + +Button A: X+20, Y+30 +Button B: X+86, Y+30 +Prize: X=2786, Y=2100 + +Button A: X+36, Y+98 +Button B: X+53, Y+35 +Prize: X=5791, Y=9317 + +Button A: X+78, Y+19 +Button B: X+11, Y+65 +Prize: X=3481, Y=3777 + +Button A: X+16, Y+31 +Button B: X+65, Y+16 +Prize: X=7088, Y=3179 + +Button A: X+58, Y+64 +Button B: X+85, Y+17 +Prize: X=1283, Y=571 + +Button A: X+29, Y+17 +Button B: X+14, Y+40 +Prize: X=12201, Y=18541 + +Button A: X+38, Y+23 +Button B: X+13, Y+78 +Prize: X=4672, Y=7737 + +Button A: X+24, Y+99 +Button B: X+57, Y+19 +Prize: X=5892, Y=9608 + +Button A: X+24, Y+50 +Button B: X+60, Y+34 +Prize: X=3012, Y=4182 + +Button A: X+63, Y+65 +Button B: X+75, Y+19 +Prize: X=12123, Y=7779 + +Button A: X+58, Y+37 +Button B: X+14, Y+30 +Prize: X=9716, Y=18406 + +Button A: X+36, Y+97 +Button B: X+75, Y+21 +Prize: X=1224, Y=1125 + +Button A: X+73, Y+67 +Button B: X+63, Y+12 +Prize: X=9736, Y=6049 + +Button A: X+36, Y+76 +Button B: X+54, Y+19 +Prize: X=602, Y=11197 + +Button A: X+51, Y+19 +Button B: X+12, Y+67 +Prize: X=740, Y=1681 + +Button A: X+37, Y+19 +Button B: X+25, Y+98 +Prize: X=2987, Y=5281 + +Button A: X+15, Y+68 +Button B: X+62, Y+21 +Prize: X=13634, Y=1083 + +Button A: X+25, Y+92 +Button B: X+97, Y+76 +Prize: X=10483, Y=13572 + +Button A: X+40, Y+18 +Button B: X+17, Y+62 +Prize: X=17013, Y=13476 + +Button A: X+76, Y+28 +Button B: X+14, Y+43 +Prize: X=668, Y=4206 + +Button A: X+37, Y+12 +Button B: X+15, Y+66 +Prize: X=15383, Y=13010 + +Button A: X+52, Y+14 +Button B: X+25, Y+62 +Prize: X=4629, Y=14632 + +Button A: X+68, Y+34 +Button B: X+12, Y+55 +Prize: X=14908, Y=17865 + +Button A: X+83, Y+45 +Button B: X+23, Y+41 +Prize: X=5421, Y=3795 + +Button A: X+78, Y+27 +Button B: X+45, Y+68 +Prize: X=4311, Y=4061 + +Button A: X+16, Y+91 +Button B: X+82, Y+72 +Prize: X=5656, Y=5351 + +Button A: X+60, Y+20 +Button B: X+17, Y+55 +Prize: X=1561, Y=3135 + +Button A: X+15, Y+56 +Button B: X+71, Y+11 +Prize: X=12551, Y=16574 + +Button A: X+12, Y+35 +Button B: X+61, Y+14 +Prize: X=17527, Y=19023 + +Button A: X+39, Y+23 +Button B: X+23, Y+42 +Prize: X=4867, Y=9906 + +Button A: X+34, Y+51 +Button B: X+48, Y+23 +Prize: X=13054, Y=9219 + +Button A: X+81, Y+51 +Button B: X+22, Y+90 +Prize: X=4582, Y=7530 + +Button A: X+38, Y+36 +Button B: X+14, Y+68 +Prize: X=1822, Y=2164 + +Button A: X+23, Y+84 +Button B: X+67, Y+11 +Prize: X=15640, Y=15995 + +Button A: X+49, Y+79 +Button B: X+33, Y+13 +Prize: X=13515, Y=4035 + +Button A: X+12, Y+58 +Button B: X+89, Y+40 +Prize: X=4834, Y=3856 + +Button A: X+31, Y+50 +Button B: X+78, Y+18 +Prize: X=2445, Y=1464 + +Button A: X+66, Y+28 +Button B: X+43, Y+67 +Prize: X=4151, Y=3175 + +Button A: X+72, Y+30 +Button B: X+13, Y+40 +Prize: X=18183, Y=18360 + +Button A: X+64, Y+41 +Button B: X+17, Y+42 +Prize: X=17623, Y=1156 + +Button A: X+60, Y+12 +Button B: X+22, Y+60 +Prize: X=5656, Y=4004 + +Button A: X+35, Y+11 +Button B: X+47, Y+67 +Prize: X=4904, Y=3996 + +Button A: X+16, Y+43 +Button B: X+51, Y+20 +Prize: X=10743, Y=15989 + +Button A: X+18, Y+24 +Button B: X+91, Y+22 +Prize: X=3473, Y=1154 + +Button A: X+24, Y+69 +Button B: X+64, Y+25 +Prize: X=8232, Y=3297 + +Button A: X+82, Y+20 +Button B: X+71, Y+86 +Prize: X=8175, Y=5222 + +Button A: X+80, Y+17 +Button B: X+17, Y+79 +Prize: X=1834, Y=1342 + +Button A: X+83, Y+22 +Button B: X+43, Y+92 +Prize: X=3748, Y=6152 + +Button A: X+25, Y+45 +Button B: X+58, Y+25 +Prize: X=17894, Y=15400 + +Button A: X+81, Y+17 +Button B: X+15, Y+76 +Prize: X=842, Y=8595 + +Button A: X+69, Y+31 +Button B: X+15, Y+61 +Prize: X=14162, Y=6486 + +Button A: X+54, Y+16 +Button B: X+23, Y+38 +Prize: X=5410, Y=2788 + +Button A: X+13, Y+58 +Button B: X+69, Y+12 +Prize: X=12856, Y=13042 + +Button A: X+17, Y+53 +Button B: X+42, Y+17 +Prize: X=8799, Y=8442 + +Button A: X+16, Y+39 +Button B: X+47, Y+25 +Prize: X=4182, Y=16147 + +Button A: X+15, Y+39 +Button B: X+48, Y+21 +Prize: X=16817, Y=6797 + +Button A: X+32, Y+48 +Button B: X+34, Y+16 +Prize: X=15440, Y=14240 + +Button A: X+19, Y+47 +Button B: X+70, Y+32 +Prize: X=14083, Y=16647 + +Button A: X+42, Y+86 +Button B: X+53, Y+30 +Prize: X=1133, Y=828 + +Button A: X+20, Y+71 +Button B: X+37, Y+13 +Prize: X=14666, Y=212 + +Button A: X+25, Y+85 +Button B: X+87, Y+81 +Prize: X=7639, Y=10507 + +Button A: X+26, Y+77 +Button B: X+58, Y+11 +Prize: X=13070, Y=11375 + +Button A: X+14, Y+70 +Button B: X+65, Y+21 +Prize: X=7324, Y=3308 + +Button A: X+12, Y+52 +Button B: X+70, Y+24 +Prize: X=2306, Y=9556 + +Button A: X+58, Y+76 +Button B: X+72, Y+26 +Prize: X=2134, Y=1156 + +Button A: X+60, Y+34 +Button B: X+42, Y+86 +Prize: X=3150, Y=5828 + +Button A: X+62, Y+31 +Button B: X+48, Y+97 +Prize: X=7814, Y=10039 + +Button A: X+29, Y+82 +Button B: X+89, Y+21 +Prize: X=9618, Y=8282 + +Button A: X+73, Y+39 +Button B: X+17, Y+46 +Prize: X=7127, Y=6761 + +Button A: X+39, Y+11 +Button B: X+17, Y+62 +Prize: X=15705, Y=1673 + +Button A: X+45, Y+60 +Button B: X+77, Y+12 +Prize: X=4738, Y=2328 + +Button A: X+59, Y+28 +Button B: X+36, Y+69 +Prize: X=4378, Y=11871 + +Button A: X+19, Y+42 +Button B: X+59, Y+34 +Prize: X=1337, Y=582 + +Button A: X+14, Y+41 +Button B: X+62, Y+39 +Prize: X=19064, Y=3530 + +Button A: X+12, Y+36 +Button B: X+63, Y+28 +Prize: X=5414, Y=15996 + +Button A: X+94, Y+21 +Button B: X+40, Y+43 +Prize: X=8480, Y=4313 + +Button A: X+11, Y+83 +Button B: X+52, Y+55 +Prize: X=5475, Y=11286 + +Button A: X+38, Y+18 +Button B: X+33, Y+59 +Prize: X=2195, Y=3425 + +Button A: X+86, Y+13 +Button B: X+27, Y+50 +Prize: X=2572, Y=1399 + +Button A: X+93, Y+18 +Button B: X+48, Y+47 +Prize: X=5703, Y=3027 + +Button A: X+25, Y+92 +Button B: X+23, Y+13 +Prize: X=1716, Y=3306 + +Button A: X+96, Y+44 +Button B: X+21, Y+54 +Prize: X=7977, Y=3878 + +Button A: X+95, Y+12 +Button B: X+77, Y+87 +Prize: X=11121, Y=6273 + +Button A: X+19, Y+76 +Button B: X+37, Y+15 +Prize: X=3389, Y=1852 + +Button A: X+12, Y+54 +Button B: X+77, Y+27 +Prize: X=6017, Y=8927 + +Button A: X+38, Y+20 +Button B: X+41, Y+83 +Prize: X=1846, Y=2200 + +Button A: X+82, Y+22 +Button B: X+11, Y+24 +Prize: X=2171, Y=2540 + +Button A: X+50, Y+11 +Button B: X+14, Y+25 +Prize: X=3144, Y=968 + +Button A: X+60, Y+23 +Button B: X+64, Y+97 +Prize: X=8996, Y=9898 + +Button A: X+16, Y+55 +Button B: X+71, Y+31 +Prize: X=19013, Y=12735 + +Button A: X+50, Y+23 +Button B: X+13, Y+23 +Prize: X=15100, Y=9760 + +Button A: X+40, Y+58 +Button B: X+67, Y+16 +Prize: X=5613, Y=1728 + +Button A: X+18, Y+63 +Button B: X+73, Y+12 +Prize: X=18494, Y=14435 + +Button A: X+41, Y+22 +Button B: X+22, Y+38 +Prize: X=10405, Y=13134 + +Button A: X+67, Y+87 +Button B: X+47, Y+17 +Prize: X=8357, Y=6977 + +Button A: X+24, Y+49 +Button B: X+47, Y+18 +Prize: X=9158, Y=4969 + +Button A: X+74, Y+55 +Button B: X+19, Y+74 +Prize: X=3926, Y=7828 + +Button A: X+29, Y+75 +Button B: X+88, Y+62 +Prize: X=7887, Y=6157 + +Button A: X+72, Y+35 +Button B: X+11, Y+53 +Prize: X=12009, Y=3226 + +Button A: X+68, Y+14 +Button B: X+24, Y+78 +Prize: X=9796, Y=4288 + +Button A: X+64, Y+19 +Button B: X+38, Y+49 +Prize: X=1654, Y=1434 + +Button A: X+92, Y+40 +Button B: X+19, Y+68 +Prize: X=8857, Y=4508 + +Button A: X+18, Y+36 +Button B: X+58, Y+33 +Prize: X=2710, Y=1851 + +Button A: X+58, Y+14 +Button B: X+18, Y+64 +Prize: X=3912, Y=2686 + +Button A: X+53, Y+20 +Button B: X+21, Y+36 +Prize: X=16294, Y=12904 + +Button A: X+23, Y+96 +Button B: X+84, Y+40 +Prize: X=4255, Y=3472 + +Button A: X+23, Y+48 +Button B: X+56, Y+28 +Prize: X=14775, Y=16408 + +Button A: X+11, Y+79 +Button B: X+30, Y+31 +Prize: X=2925, Y=8095 + +Button A: X+56, Y+83 +Button B: X+36, Y+13 +Prize: X=4976, Y=17088 + +Button A: X+20, Y+86 +Button B: X+94, Y+11 +Prize: X=6622, Y=3703 + +Button A: X+51, Y+16 +Button B: X+53, Y+80 +Prize: X=7012, Y=4608 + +Button A: X+45, Y+62 +Button B: X+58, Y+21 +Prize: X=4237, Y=2951 + +Button A: X+27, Y+50 +Button B: X+26, Y+16 +Prize: X=15183, Y=15590 + +Button A: X+98, Y+27 +Button B: X+31, Y+53 +Prize: X=4669, Y=2220 + +Button A: X+15, Y+67 +Button B: X+58, Y+22 +Prize: X=14390, Y=4978 + +Button A: X+96, Y+41 +Button B: X+13, Y+49 +Prize: X=4275, Y=4563 + +Button A: X+45, Y+76 +Button B: X+53, Y+27 +Prize: X=5037, Y=6069 + +Button A: X+23, Y+12 +Button B: X+32, Y+85 +Prize: X=4539, Y=9062 + +Button A: X+23, Y+55 +Button B: X+63, Y+31 +Prize: X=2492, Y=8764 + +Button A: X+17, Y+34 +Button B: X+74, Y+34 +Prize: X=5054, Y=2584 + +Button A: X+22, Y+20 +Button B: X+69, Y+14 +Prize: X=5162, Y=1964 + +Button A: X+73, Y+43 +Button B: X+14, Y+30 +Prize: X=4519, Y=14141 + +Button A: X+20, Y+41 +Button B: X+52, Y+34 +Prize: X=15084, Y=12885 + +Button A: X+48, Y+16 +Button B: X+16, Y+26 +Prize: X=12208, Y=5510 + +Button A: X+15, Y+68 +Button B: X+59, Y+20 +Prize: X=14017, Y=4348 + +Button A: X+33, Y+43 +Button B: X+88, Y+29 +Prize: X=5863, Y=2157 + +Button A: X+90, Y+59 +Button B: X+20, Y+63 +Prize: X=8390, Y=10040 + +Button A: X+16, Y+40 +Button B: X+38, Y+27 +Prize: X=1930, Y=1629 + +Button A: X+51, Y+59 +Button B: X+93, Y+13 +Prize: X=7260, Y=5372 + +Button A: X+26, Y+54 +Button B: X+60, Y+39 +Prize: X=7640, Y=7563 + +Button A: X+24, Y+60 +Button B: X+55, Y+18 +Prize: X=13404, Y=10124 + +Button A: X+71, Y+12 +Button B: X+20, Y+69 +Prize: X=7325, Y=16931 + +Button A: X+31, Y+62 +Button B: X+91, Y+46 +Prize: X=3619, Y=2478 + +Button A: X+30, Y+81 +Button B: X+91, Y+64 +Prize: X=6973, Y=5563 + +Button A: X+57, Y+20 +Button B: X+24, Y+56 +Prize: X=6896, Y=6032 + +Button A: X+94, Y+48 +Button B: X+40, Y+66 +Prize: X=10026, Y=5940 + +Button A: X+38, Y+95 +Button B: X+61, Y+29 +Prize: X=7490, Y=6869 + +Button A: X+66, Y+91 +Button B: X+76, Y+25 +Prize: X=8304, Y=7859 + +Button A: X+39, Y+19 +Button B: X+12, Y+18 +Prize: X=7967, Y=11793 + +Button A: X+96, Y+31 +Button B: X+20, Y+67 +Prize: X=2600, Y=2898 + +Button A: X+67, Y+16 +Button B: X+23, Y+67 +Prize: X=19653, Y=13787 + +Button A: X+17, Y+37 +Button B: X+56, Y+34 +Prize: X=266, Y=8102 + +Button A: X+74, Y+17 +Button B: X+23, Y+74 +Prize: X=17764, Y=14647 + +Button A: X+95, Y+38 +Button B: X+50, Y+73 +Prize: X=11310, Y=6644 + +Button A: X+82, Y+13 +Button B: X+13, Y+66 +Prize: X=11485, Y=3256 + +Button A: X+98, Y+37 +Button B: X+32, Y+88 +Prize: X=8598, Y=6207 + +Button A: X+30, Y+45 +Button B: X+40, Y+13 +Prize: X=19780, Y=3463 + +Button A: X+22, Y+49 +Button B: X+95, Y+28 +Prize: X=9489, Y=4795 + +Button A: X+52, Y+16 +Button B: X+13, Y+71 +Prize: X=11274, Y=11738 + +Button A: X+39, Y+74 +Button B: X+95, Y+47 +Prize: X=10423, Y=9916 + +Button A: X+55, Y+85 +Button B: X+96, Y+35 +Prize: X=5253, Y=2110 + +Button A: X+37, Y+33 +Button B: X+29, Y+90 +Prize: X=1699, Y=4209 + +Button A: X+19, Y+75 +Button B: X+90, Y+67 +Prize: X=8877, Y=12268 + +Button A: X+13, Y+31 +Button B: X+40, Y+27 +Prize: X=15606, Y=17360 + +Button A: X+14, Y+83 +Button B: X+84, Y+25 +Prize: X=5446, Y=9110 + +Button A: X+31, Y+58 +Button B: X+45, Y+13 +Prize: X=13589, Y=2965 + +Button A: X+56, Y+12 +Button B: X+40, Y+61 +Prize: X=7600, Y=5351 + +Button A: X+50, Y+30 +Button B: X+16, Y+34 +Prize: X=14194, Y=18386 + +Button A: X+12, Y+34 +Button B: X+35, Y+13 +Prize: X=18026, Y=5992 + +Button A: X+26, Y+83 +Button B: X+73, Y+15 +Prize: X=3330, Y=8173 + +Button A: X+69, Y+29 +Button B: X+11, Y+45 +Prize: X=1131, Y=4841 + +Button A: X+40, Y+74 +Button B: X+51, Y+13 +Prize: X=3375, Y=2583 + +Button A: X+51, Y+27 +Button B: X+11, Y+24 +Prize: X=18338, Y=431 + +Button A: X+14, Y+94 +Button B: X+78, Y+72 +Prize: X=2114, Y=4708 + +Button A: X+79, Y+72 +Button B: X+90, Y+19 +Prize: X=2094, Y=774 + +Button A: X+73, Y+79 +Button B: X+58, Y+13 +Prize: X=4001, Y=2588 + +Button A: X+16, Y+38 +Button B: X+57, Y+41 +Prize: X=1614, Y=2512 + +Button A: X+15, Y+48 +Button B: X+70, Y+34 +Prize: X=7570, Y=9634 + +Button A: X+46, Y+48 +Button B: X+67, Y+19 +Prize: X=7208, Y=3652 + +Button A: X+41, Y+70 +Button B: X+43, Y+17 +Prize: X=11708, Y=7946 + +Button A: X+12, Y+45 +Button B: X+58, Y+39 +Prize: X=1830, Y=3114 + +Button A: X+44, Y+16 +Button B: X+12, Y+43 +Prize: X=4220, Y=10655 + +Button A: X+35, Y+21 +Button B: X+13, Y+47 +Prize: X=10931, Y=10889 + +Button A: X+72, Y+12 +Button B: X+16, Y+67 +Prize: X=10608, Y=4182 + +Button A: X+20, Y+46 +Button B: X+26, Y+16 +Prize: X=11452, Y=2952 + +Button A: X+45, Y+20 +Button B: X+24, Y+39 +Prize: X=13166, Y=12551 + +Button A: X+65, Y+23 +Button B: X+11, Y+33 +Prize: X=19578, Y=5834 + +Button A: X+78, Y+31 +Button B: X+12, Y+55 +Prize: X=2456, Y=19050 + +Button A: X+39, Y+99 +Button B: X+98, Y+35 +Prize: X=5176, Y=9505 + +Button A: X+12, Y+25 +Button B: X+33, Y+22 +Prize: X=19454, Y=10070 + +Button A: X+48, Y+15 +Button B: X+15, Y+29 +Prize: X=9644, Y=17154 + +Button A: X+88, Y+81 +Button B: X+74, Y+11 +Prize: X=8202, Y=2238 + +Button A: X+24, Y+85 +Button B: X+41, Y+25 +Prize: X=4286, Y=3880 + +Button A: X+25, Y+99 +Button B: X+88, Y+37 +Prize: X=7066, Y=10227 + +Button A: X+21, Y+12 +Button B: X+15, Y+65 +Prize: X=1236, Y=1722 + +Button A: X+80, Y+33 +Button B: X+14, Y+96 +Prize: X=6680, Y=4560 + +Button A: X+39, Y+91 +Button B: X+42, Y+31 +Prize: X=2343, Y=1916 + +Button A: X+37, Y+11 +Button B: X+17, Y+47 +Prize: X=1729, Y=4415 + +Button A: X+50, Y+11 +Button B: X+65, Y+92 +Prize: X=9450, Y=9072 + +Button A: X+11, Y+99 +Button B: X+78, Y+12 +Prize: X=6466, Y=6444 + +Button A: X+69, Y+38 +Button B: X+34, Y+79 +Prize: X=5916, Y=5428 + +Button A: X+13, Y+49 +Button B: X+60, Y+22 +Prize: X=6187, Y=13675 + +Button A: X+11, Y+42 +Button B: X+88, Y+42 +Prize: X=1298, Y=3780 + +Button A: X+63, Y+12 +Button B: X+11, Y+82 +Prize: X=13411, Y=14496 + +Button A: X+46, Y+50 +Button B: X+68, Y+14 +Prize: X=6064, Y=1978 + +Button A: X+20, Y+47 +Button B: X+61, Y+16 +Prize: X=8092, Y=12115 + +Button A: X+25, Y+91 +Button B: X+47, Y+18 +Prize: X=2736, Y=4142 + +Button A: X+43, Y+12 +Button B: X+20, Y+34 +Prize: X=15175, Y=16880 + +Button A: X+48, Y+69 +Button B: X+40, Y+14 +Prize: X=14520, Y=8113 + +Button A: X+47, Y+11 +Button B: X+38, Y+66 +Prize: X=18819, Y=10055 + +Button A: X+61, Y+23 +Button B: X+49, Y+80 +Prize: X=4792, Y=4760 + +Button A: X+67, Y+94 +Button B: X+73, Y+12 +Prize: X=5898, Y=4206 + +Button A: X+78, Y+12 +Button B: X+55, Y+45 +Prize: X=2723, Y=1917 + +Button A: X+91, Y+99 +Button B: X+95, Y+21 +Prize: X=14793, Y=9423 + +Button A: X+83, Y+29 +Button B: X+37, Y+47 +Prize: X=4954, Y=5070 + +Button A: X+21, Y+50 +Button B: X+23, Y+11 +Prize: X=5354, Y=15292 + +Button A: X+45, Y+17 +Button B: X+16, Y+53 +Prize: X=1626, Y=8358 + +Button A: X+57, Y+20 +Button B: X+20, Y+51 +Prize: X=17486, Y=17959 + +Button A: X+11, Y+51 +Button B: X+95, Y+13 +Prize: X=9572, Y=4626 + +Button A: X+46, Y+23 +Button B: X+29, Y+56 +Prize: X=11764, Y=7258 + +Button A: X+13, Y+38 +Button B: X+46, Y+15 +Prize: X=13792, Y=16649 + +Button A: X+32, Y+54 +Button B: X+45, Y+19 +Prize: X=1729, Y=6947 + +Button A: X+79, Y+16 +Button B: X+86, Y+83 +Prize: X=5312, Y=1994 + +Button A: X+15, Y+94 +Button B: X+54, Y+23 +Prize: X=5319, Y=10939 + +Button A: X+18, Y+96 +Button B: X+22, Y+21 +Prize: X=2150, Y=2604 + +Button A: X+92, Y+32 +Button B: X+12, Y+42 +Prize: X=6928, Y=4528 + +Button A: X+53, Y+17 +Button B: X+12, Y+61 +Prize: X=6202, Y=9615 + +Button A: X+15, Y+74 +Button B: X+81, Y+11 +Prize: X=13811, Y=18227 + +Button A: X+60, Y+20 +Button B: X+11, Y+65 +Prize: X=15686, Y=2290 + +Button A: X+12, Y+42 +Button B: X+88, Y+35 +Prize: X=6908, Y=5614 + +Button A: X+98, Y+29 +Button B: X+77, Y+90 +Prize: X=9429, Y=6487 + +Button A: X+23, Y+42 +Button B: X+46, Y+27 +Prize: X=14199, Y=9962 + +Button A: X+75, Y+50 +Button B: X+19, Y+44 +Prize: X=17671, Y=17596 + +Button A: X+12, Y+90 +Button B: X+35, Y+41 +Prize: X=2357, Y=8153 + +Button A: X+65, Y+33 +Button B: X+16, Y+57 +Prize: X=2125, Y=11579 + +Button A: X+39, Y+61 +Button B: X+91, Y+36 +Prize: X=10426, Y=5993 + +Button A: X+98, Y+32 +Button B: X+29, Y+43 +Prize: X=4099, Y=3585 + +Button A: X+11, Y+28 +Button B: X+51, Y+24 +Prize: X=10410, Y=7624 + +Button A: X+33, Y+78 +Button B: X+90, Y+29 +Prize: X=8046, Y=5422 + +Button A: X+28, Y+93 +Button B: X+98, Y+26 +Prize: X=2044, Y=3794 + +Button A: X+69, Y+19 +Button B: X+15, Y+59 +Prize: X=1679, Y=14277 + +Button A: X+94, Y+12 +Button B: X+12, Y+16 +Prize: X=6464, Y=912 + +Button A: X+20, Y+57 +Button B: X+37, Y+15 +Prize: X=1017, Y=6431 + +Button A: X+77, Y+22 +Button B: X+25, Y+48 +Prize: X=1378, Y=884 + +Button A: X+44, Y+17 +Button B: X+36, Y+67 +Prize: X=11320, Y=11922 + +Button A: X+31, Y+79 +Button B: X+89, Y+44 +Prize: X=6326, Y=7712 + +Button A: X+71, Y+23 +Button B: X+24, Y+62 +Prize: X=4287, Y=1931 + +Button A: X+65, Y+59 +Button B: X+18, Y+89 +Prize: X=3241, Y=5267 + +Button A: X+62, Y+20 +Button B: X+27, Y+64 +Prize: X=14578, Y=5476 + +Button A: X+19, Y+77 +Button B: X+44, Y+19 +Prize: X=3144, Y=1908 diff --git a/src/holt59/aoc/inputs/tests/2024/day13.txt b/src/holt59/aoc/inputs/tests/2024/day13.txt index e69de29..912f482 100644 --- a/src/holt59/aoc/inputs/tests/2024/day13.txt +++ b/src/holt59/aoc/inputs/tests/2024/day13.txt @@ -0,0 +1,15 @@ +Button A: X+94, Y+34 +Button B: X+22, Y+67 +Prize: X=8400, Y=5400 + +Button A: X+26, Y+66 +Button B: X+67, Y+21 +Prize: X=12748, Y=12176 + +Button A: X+17, Y+86 +Button B: X+84, Y+37 +Prize: X=7870, Y=6450 + +Button A: X+69, Y+23 +Button B: X+27, Y+71 +Prize: X=18641, Y=10279