From 086fef2122609d9aebcd5f343719b934396f2c9a Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 00:39:33 +0100 Subject: [PATCH 001/100] 2015: d01: ex1: add input --- 2015/d01/ex1/input | 1 + 1 file changed, 1 insertion(+) create mode 100644 2015/d01/ex1/input diff --git a/2015/d01/ex1/input b/2015/d01/ex1/input new file mode 100644 index 0000000..f7beb58 --- /dev/null +++ b/2015/d01/ex1/input @@ -0,0 +1 @@ +((((()(()(((((((()))(((()((((()())(())()(((()((((((()((()(()(((()(()((())))()((()()())))))))))()((((((())((()))(((((()(((((((((()()))((()(())()((())((()(()))((()))()))()(((((()(((()()))()())((()((((())()())()((((())()(()(()(((()(())(()(())(((((((())()()(((())(()(()(()(())))(()((((())((()))(((()(()()(((((()()(()(((()(((((())()))()((()(()))()((()((((())((((())(()(((())()()(()()()()()(())((((())((())(()()))()((((())))((((()())()((((())((()())((())(())(((((()((((()(((()((((())(()(((()()))()))((((((()((())()())))(((()(()))(()()(()(((()(()))((()()()())((()()()(((())())()())())())((()))(()(()))(((((()(()(())((()(())(())()((((()())()))((((())(())((())())((((()(((())(())((()()((((()((((((()(())()()(()(()()((((()))(())()())()))(())))(())))())()()(())(()))()((()(()(())()()))(()())))))(()))(()()))(())(((((()(()(()()((())()())))))((())())((())(()(())((()))(())(((()((((((((()()()(()))()()(((()))()((()()(())(())())()(()(())))(((((()(())(())(()))))())()))(()))()(()(((((((()((((())))())())())())()((((((((((((((()()((((((()()()())())()())())())(())(())))())((()())((()(()))))))()))))))))))))))))())((())((())()()))))))(((()((()(()()))((())(()()))()()())))(())))))))(()(((())))())()())))()()(())()))()(()))())((()()))))(()))))()))(()()(())))))))()(((()))))()(()))(())())))))()))((()))((()))())(())))))))))((((())()))()))()))())(())()()(())))())))(()())()))((()()(())))(())((((((()(())((()(((()(()()(())))()))))))()))()(()((()))()(()))(()(((())((((())())(())(()))))))))())))))))())())))))())))))()()(((())()(()))))))))())))))(())()()()))()))()))(()(())()()())())))))))())()(()(()))))()()()))))())(()))))()()))))()())))))(((())()()))(()))))))))))()()))))()()()))))(()())())()()())()(()))))()(()))(())))))))(((((())(())())()()))()()))(())))))()(()))))(())(()()))()())()))()))()))()))))())()()))())())))(()))(()))))))())()(((())()))))))))()))()())))())))())))()))))))))))()()))(()()))))))(())()(()))))())(()))))(()))))(()())))))())())()()))))())()))))))))(()))))()))))))()(()())))))))()))())))())))())))())))))))())(()()))))))(()())())))()())()))))))))))))))())))()(())))()))())()()(())(()()))(())))())()())(()(()(()))))())))))))))))())(()))()))()))))(())()())()())))))))))))()()))))))))))))())())))))(()())))))))))))())(())))()))))))))())())(()))()))(())))()))()()(())()))))))()((((())()))())())))))()))()))))((()())()))))())))(())))))))))))))))))()))))()()())()))()()))))())()))((()())))())))(()))(()())))))))()))()))))(())))))))(())))))())()()(()))())()))()()))))())()()))))())()))())))))))(()))))()())()))))))))(()))())))(()))()))))(())()))())())(())())())))))))((((())))))()))()))()())()(())))()))()))()())(()())()()(()())()))))())())))))(()))()))))())(()()(())))))(())()()((())())))))(())(())))))))())))))))))()(())))))))()())())())()(()))))))))(()))))))))())()()))()(()))))))()))))))())))))))(())))()()(())()())))))(((())))()((())()))())))(()()))())(())())))()(((()())))))()(()()())))()()(()()(()()))())()(()()()))())()()))()())(()))))())))))())))(())()()))))(()))))(())(()))(())))))()()))()))))())()))()()(())())))((()))())()))))))()()))))((()(()))))()()))))))())))))())(()((()())))))))))))()())())))()))(()))))))(()))(())()())))(()))))))))())()()()()))))(()())))))))((())))()))(()))(())(())()())()))))))))(())))())))(()))()()))(()()))(()))())))()(())))())((()((()(())))((())))()))))((((())())()())))(())))()))))))())(()()((())))())()(()())))))(()())()))())))))))((())())))))))(()(()))())()()(()()(((()(((()())))))()))))))()(())(()()((()()(())()()))())()())()))()())())())))))))(((())))))))()()))))))(((())()))(()()))(()()))))(()(()()((((())()())((()()))))(()(())))))()((()()()())()()((()((()()))(()))(((()()()))(((())))()(((())()))))))((()(())())))(()())(((((()(()))(()((()))(()())()))))(()(()))()(()))(())(((())(()()))))()()))(((()))))(()()()()))())))((()()()(())()))()))))()()))()))))))((((((()()()))))())((()()(((()))))(()(())(()()())())())))()(((()()))(())((())))(()))(()()()())((())())())(()))))()))()((()(())()(()()(())(()))(())()))(())(()))))(())(())())(()()(()((()()((())))((()))()((())))(((()()()()((((()))(()()))()()()(((())((())())(()()(()()()))()((())(())()))())(((()()(())))()((()()())()())(()(())())(((())(())())((())(())()(((()()))(())))((())(()())())(())((()()()((((((())))((()(((((())()))()))(())(()()))()))(())()()))(())((()()())()()(()))())()((())))()((()()())((((()())((())())())((()((()))()))((())((()()(()((()()(((())(()()))))((()((())()(((())(()((())())((())(()((((((())())()(()())()(())(((())((((((()(())(()((()()()((()()(()()()())))()()(((((()()))()((((((()))()(()(()(()(((()())((()))())()((()))(())))()))()()))())()()))())((((())(()(()))(((((((())(((()(((((()(((()()((((())(((())())))(()()()(()(()))()))((((((()))((()(((()(())((()((((()((((((())(((((())))(((()(()))))(((()(((())()((())(()((()))(((()()(((())((((()(()(((((()))(((()(((((((()(()()()(()(()(()()())(())(((((()(())())()())(()(()(()))()(()()()())(()()(()((()))()((())())()(()))((())(()))()(()))()(((()(()(()((((((()()()()())()(((((()()(((()()()((()(((((()))((((((((()()()(((((()))))))(()()()(())(()))(()()))))(())()))(((((()(((((()()(()(()())(((()))((((()((()(()(()((()(()((())))()(((()((()))((()))(((((((((()((()((()(())))()((((()((()()))((())(((()(((((()()(()(()()((()(()()()(((((((())())()())))))((((()()(()))()))(()((())()(()(((((((((()()(((()(()())(()((()())((())())((((()(((()(((()((((()((()((((()(()((((((())((((((((((((()()(()()((((((((((((((()((()()))()((((((((((((())((((()(()())((()(()(()))()(((((()()(((()()))()())(())((()(((((()((())(((((()((()(((((()))()()((((())()((((())(((((((((()(())(()(())))())(()((())(((())(())(())())(()(()(())()()((()((())()(((()(((((()(())))()(((()((())))((()()()(((()(((()((()(()(())(()((()())(()(()(((()(((((((((())(()((((()()))(()((((()()()()(((()((((((((()(()()((((((()(()()(()((()((((((((((()()(((((((()())(())))(((()()))(((((()((()()())(()()((((())((()((((()))))(())((()(()()(((()(()(((()((((()(((((()))())())(()((())()))(((()())((())((())((((()((()((((((())(()((((()()))((((((())()(()))((()(((())((((((((((()()(((((()(((((()((()()()((((())))(()))()((()(())()()((()((((((((((()((())(())(((((()(()(()()))((((()((((()()((()(((()(((((((((()(()((()((()))((((((()(((())()()((()(((((((()())))()()(()((()((()()(((()(()()()()((((()((())((((()(((((((((()(((()()(((()(()(((()(((()((())()(()((()(()(()(()))()(((()))(()((((()((())((((())((((((())(()))(()((((())((()(()((((((((()()((((((()(()(()()()(())((()((()()(((()(((((((()()((()(((((((()))(((((()(((()(()()()(()(((()((()()((())(()(((((((((()(()((()((((((()()((())()))(((((()((())()())()(((((((((((()))((((()()()()())(()()(()(()()))()))(()))(()(((()()))())(()(()))()()((())(()())()())()(()))()))(()()(()((((((())((()(((((((((((()(())()((()(()((()((()(()((()((((((((((()()())((())()(())))((())()())()(((((()(()())((((()((()(())(()))(((())()((()))(((((())(()))()()(()))(((())((((()((((()(())))(((((((()))))())()())(())((())()(()()((()(()))()(()()(()()((()())((())((()()))((((()))()()))(()()(())()()(((((()(())((()((((()))()))(()())())(((()()(()()))(())))))(()))((())(((((()((((()))()((((()))()((())(((())))(((()())))((()(()()(( \ No newline at end of file From 380b527017eb590e07f5f655380b04743bfae089 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 00:39:38 +0100 Subject: [PATCH 002/100] 2015: d01: ex1: add solution --- 2015/d01/ex1/ex1.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 2015/d01/ex1/ex1.py diff --git a/2015/d01/ex1/ex1.py b/2015/d01/ex1/ex1.py new file mode 100755 index 0000000..616d288 --- /dev/null +++ b/2015/d01/ex1/ex1.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python + +import collections +import sys + + +def solve(input: str) -> int: + directions = collections.Counter(input.strip()) + return directions["("] - directions[")"] + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 8c3207a3858c76705e194786fb49b67943d637d4 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 00:39:44 +0100 Subject: [PATCH 003/100] 2015: d01: ex2: add input --- 2015/d01/ex2/input | 1 + 1 file changed, 1 insertion(+) create mode 100644 2015/d01/ex2/input diff --git a/2015/d01/ex2/input b/2015/d01/ex2/input new file mode 100644 index 0000000..f7beb58 --- /dev/null +++ b/2015/d01/ex2/input @@ -0,0 +1 @@ +((((()(()(((((((()))(((()((((()())(())()(((()((((((()((()(()(((()(()((())))()((()()())))))))))()((((((())((()))(((((()(((((((((()()))((()(())()((())((()(()))((()))()))()(((((()(((()()))()())((()((((())()())()((((())()(()(()(((()(())(()(())(((((((())()()(((())(()(()(()(())))(()((((())((()))(((()(()()(((((()()(()(((()(((((())()))()((()(()))()((()((((())((((())(()(((())()()(()()()()()(())((((())((())(()()))()((((())))((((()())()((((())((()())((())(())(((((()((((()(((()((((())(()(((()()))()))((((((()((())()())))(((()(()))(()()(()(((()(()))((()()()())((()()()(((())())()())())())((()))(()(()))(((((()(()(())((()(())(())()((((()())()))((((())(())((())())((((()(((())(())((()()((((()((((((()(())()()(()(()()((((()))(())()())()))(())))(())))())()()(())(()))()((()(()(())()()))(()())))))(()))(()()))(())(((((()(()(()()((())()())))))((())())((())(()(())((()))(())(((()((((((((()()()(()))()()(((()))()((()()(())(())())()(()(())))(((((()(())(())(()))))())()))(()))()(()(((((((()((((())))())())())())()((((((((((((((()()((((((()()()())())()())())())(())(())))())((()())((()(()))))))()))))))))))))))))())((())((())()()))))))(((()((()(()()))((())(()()))()()())))(())))))))(()(((())))())()())))()()(())()))()(()))())((()()))))(()))))()))(()()(())))))))()(((()))))()(()))(())())))))()))((()))((()))())(())))))))))((((())()))()))()))())(())()()(())))())))(()())()))((()()(())))(())((((((()(())((()(((()(()()(())))()))))))()))()(()((()))()(()))(()(((())((((())())(())(()))))))))())))))))())())))))())))))()()(((())()(()))))))))())))))(())()()()))()))()))(()(())()()())())))))))())()(()(()))))()()()))))())(()))))()()))))()())))))(((())()()))(()))))))))))()()))))()()()))))(()())())()()())()(()))))()(()))(())))))))(((((())(())())()()))()()))(())))))()(()))))(())(()()))()())()))()))()))()))))())()()))())())))(()))(()))))))())()(((())()))))))))()))()())))())))())))()))))))))))()()))(()()))))))(())()(()))))())(()))))(()))))(()())))))())())()()))))())()))))))))(()))))()))))))()(()())))))))()))())))())))())))())))))))())(()()))))))(()())())))()())()))))))))))))))())))()(())))()))())()()(())(()()))(())))())()())(()(()(()))))())))))))))))())(()))()))()))))(())()())()())))))))))))()()))))))))))))())())))))(()())))))))))))())(())))()))))))))())())(()))()))(())))()))()()(())()))))))()((((())()))())())))))()))()))))((()())()))))())))(())))))))))))))))))()))))()()())()))()()))))())()))((()())))())))(()))(()())))))))()))()))))(())))))))(())))))())()()(()))())()))()()))))())()()))))())()))())))))))(()))))()())()))))))))(()))())))(()))()))))(())()))())())(())())())))))))((((())))))()))()))()())()(())))()))()))()())(()())()()(()())()))))())())))))(()))()))))())(()()(())))))(())()()((())())))))(())(())))))))())))))))))()(())))))))()())())())()(()))))))))(()))))))))())()()))()(()))))))()))))))())))))))(())))()()(())()())))))(((())))()((())()))())))(()()))())(())())))()(((()())))))()(()()())))()()(()()(()()))())()(()()()))())()()))()())(()))))())))))())))(())()()))))(()))))(())(()))(())))))()()))()))))())()))()()(())())))((()))())()))))))()()))))((()(()))))()()))))))())))))())(()((()())))))))))))()())())))()))(()))))))(()))(())()())))(()))))))))())()()()()))))(()())))))))((())))()))(()))(())(())()())()))))))))(())))())))(()))()()))(()()))(()))())))()(())))())((()((()(())))((())))()))))((((())())()())))(())))()))))))())(()()((())))())()(()())))))(()())()))())))))))((())())))))))(()(()))())()()(()()(((()(((()())))))()))))))()(())(()()((()()(())()()))())()())()))()())())())))))))(((())))))))()()))))))(((())()))(()()))(()()))))(()(()()((((())()())((()()))))(()(())))))()((()()()())()()((()((()()))(()))(((()()()))(((())))()(((())()))))))((()(())())))(()())(((((()(()))(()((()))(()())()))))(()(()))()(()))(())(((())(()()))))()()))(((()))))(()()()()))())))((()()()(())()))()))))()()))()))))))((((((()()()))))())((()()(((()))))(()(())(()()())())())))()(((()()))(())((())))(()))(()()()())((())())())(()))))()))()((()(())()(()()(())(()))(())()))(())(()))))(())(())())(()()(()((()()((())))((()))()((())))(((()()()()((((()))(()()))()()()(((())((())())(()()(()()()))()((())(())()))())(((()()(())))()((()()())()())(()(())())(((())(())())((())(())()(((()()))(())))((())(()())())(())((()()()((((((())))((()(((((())()))()))(())(()()))()))(())()()))(())((()()())()()(()))())()((())))()((()()())((((()())((())())())((()((()))()))((())((()()(()((()()(((())(()()))))((()((())()(((())(()((())())((())(()((((((())())()(()())()(())(((())((((((()(())(()((()()()((()()(()()()())))()()(((((()()))()((((((()))()(()(()(()(((()())((()))())()((()))(())))()))()()))())()()))())((((())(()(()))(((((((())(((()(((((()(((()()((((())(((())())))(()()()(()(()))()))((((((()))((()(((()(())((()((((()((((((())(((((())))(((()(()))))(((()(((())()((())(()((()))(((()()(((())((((()(()(((((()))(((()(((((((()(()()()(()(()(()()())(())(((((()(())())()())(()(()(()))()(()()()())(()()(()((()))()((())())()(()))((())(()))()(()))()(((()(()(()((((((()()()()())()(((((()()(((()()()((()(((((()))((((((((()()()(((((()))))))(()()()(())(()))(()()))))(())()))(((((()(((((()()(()(()())(((()))((((()((()(()(()((()(()((())))()(((()((()))((()))(((((((((()((()((()(())))()((((()((()()))((())(((()(((((()()(()(()()((()(()()()(((((((())())()())))))((((()()(()))()))(()((())()(()(((((((((()()(((()(()())(()((()())((())())((((()(((()(((()((((()((()((((()(()((((((())((((((((((((()()(()()((((((((((((((()((()()))()((((((((((((())((((()(()())((()(()(()))()(((((()()(((()()))()())(())((()(((((()((())(((((()((()(((((()))()()((((())()((((())(((((((((()(())(()(())))())(()((())(((())(())(())())(()(()(())()()((()((())()(((()(((((()(())))()(((()((())))((()()()(((()(((()((()(()(())(()((()())(()(()(((()(((((((((())(()((((()()))(()((((()()()()(((()((((((((()(()()((((((()(()()(()((()((((((((((()()(((((((()())(())))(((()()))(((((()((()()())(()()((((())((()((((()))))(())((()(()()(((()(()(((()((((()(((((()))())())(()((())()))(((()())((())((())((((()((()((((((())(()((((()()))((((((())()(()))((()(((())((((((((((()()(((((()(((((()((()()()((((())))(()))()((()(())()()((()((((((((((()((())(())(((((()(()(()()))((((()((((()()((()(((()(((((((((()(()((()((()))((((((()(((())()()((()(((((((()())))()()(()((()((()()(((()(()()()()((((()((())((((()(((((((((()(((()()(((()(()(((()(((()((())()(()((()(()(()(()))()(((()))(()((((()((())((((())((((((())(()))(()((((())((()(()((((((((()()((((((()(()(()()()(())((()((()()(((()(((((((()()((()(((((((()))(((((()(((()(()()()(()(((()((()()((())(()(((((((((()(()((()((((((()()((())()))(((((()((())()())()(((((((((((()))((((()()()()())(()()(()(()()))()))(()))(()(((()()))())(()(()))()()((())(()())()())()(()))()))(()()(()((((((())((()(((((((((((()(())()((()(()((()((()(()((()((((((((((()()())((())()(())))((())()())()(((((()(()())((((()((()(())(()))(((())()((()))(((((())(()))()()(()))(((())((((()((((()(())))(((((((()))))())()())(())((())()(()()((()(()))()(()()(()()((()())((())((()()))((((()))()()))(()()(())()()(((((()(())((()((((()))()))(()())())(((()()(()()))(())))))(()))((())(((((()((((()))()((((()))()((())(((())))(((()())))((()(()()(( \ No newline at end of file From c6afe68ac50c7e63ea57de3aaf67859a034f384c Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 00:39:52 +0100 Subject: [PATCH 004/100] 2015: d01: ex2: add solution --- 2015/d01/ex2/ex2.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 2015/d01/ex2/ex2.py diff --git a/2015/d01/ex2/ex2.py b/2015/d01/ex2/ex2.py new file mode 100755 index 0000000..4383f4a --- /dev/null +++ b/2015/d01/ex2/ex2.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +import sys + + +def solve(input: str) -> int: + BASEMENT = -1 + current = 0 + for i, c in enumerate(input, start=1): + current += 1 if c == "(" else -1 + if current == BASEMENT: + return i + assert False # Sanity check + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 79e75fe0a5866d797019ea569b804cbef71cf602 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 00:47:26 +0100 Subject: [PATCH 005/100] 2015: d02: ex1: add input --- 2015/d02/ex1/input | 1000 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1000 insertions(+) create mode 100644 2015/d02/ex1/input diff --git a/2015/d02/ex1/input b/2015/d02/ex1/input new file mode 100644 index 0000000..2f04474 --- /dev/null +++ b/2015/d02/ex1/input @@ -0,0 +1,1000 @@ +20x3x11 +15x27x5 +6x29x7 +30x15x9 +19x29x21 +10x4x15 +1x26x4 +1x5x18 +10x15x23 +10x14x20 +3x5x18 +29x23x30 +7x4x10 +22x24x29 +30x1x2 +19x2x5 +11x9x22 +23x15x10 +11x11x10 +30x28x5 +22x5x4 +6x26x20 +16x12x30 +10x20x5 +25x14x24 +16x17x22 +11x28x26 +1x11x10 +1x24x15 +13x17x21 +30x3x13 +20x25x17 +22x12x5 +22x20x24 +9x2x14 +6x18x8 +27x28x24 +11x17x1 +1x4x12 +5x20x13 +24x23x23 +22x1x25 +18x19x5 +5x23x13 +8x16x4 +20x21x9 +1x7x11 +8x30x17 +3x30x9 +6x16x18 +22x25x27 +9x20x26 +16x21x23 +5x24x17 +15x17x15 +26x15x10 +22x16x3 +20x24x24 +8x18x10 +23x19x16 +1x21x24 +23x23x9 +14x20x6 +25x5x5 +16x3x1 +29x29x20 +11x4x26 +10x23x24 +29x25x16 +27x27x22 +9x7x22 +6x21x18 +25x11x19 +14x13x3 +15x28x17 +14x3x12 +29x8x19 +30x14x20 +20x23x4 +8x16x5 +4x11x18 +20x8x24 +21x13x21 +14x26x29 +27x4x17 +27x4x25 +5x28x6 +23x24x11 +29x22x5 +30x20x6 +23x2x10 +11x4x7 +27x23x6 +10x20x19 +8x20x22 +5x29x22 +16x13x2 +2x11x14 +6x12x4 +3x13x6 +16x5x18 +25x3x28 +21x1x5 +20x16x19 +28x30x27 +26x7x18 +25x27x24 +11x19x7 +21x19x17 +2x12x27 +20x5x14 +8x5x8 +6x24x8 +7x28x20 +3x20x28 +5x20x30 +13x29x1 +26x29x5 +19x28x25 +5x19x11 +11x20x22 +4x23x1 +19x25x12 +3x10x6 +3x14x10 +28x16x12 +23x12x2 +23x12x19 +20x28x10 +9x10x25 +16x21x16 +1x18x20 +9x4x26 +3x25x8 +17x16x28 +9x28x16 +27x3x12 +17x24x12 +13x21x10 +7x17x13 +6x10x9 +7x29x25 +11x19x30 +1x24x5 +20x16x23 +24x28x21 +6x29x19 +25x2x19 +12x5x26 +25x29x12 +16x28x22 +26x26x15 +9x13x5 +10x29x7 +1x24x16 +22x2x2 +6x16x13 +3x12x28 +4x12x13 +14x27x21 +14x23x26 +7x5x18 +8x30x27 +15x9x18 +26x16x5 +3x29x17 +19x7x18 +16x18x1 +26x15x30 +24x30x21 +13x20x7 +4x12x10 +27x20x11 +28x29x21 +20x14x30 +28x12x3 +19x1x8 +4x8x6 +21x14x2 +27x19x21 +17x24x14 +15x18x11 +18x7x26 +25x28x29 +27x26x9 +18x12x17 +24x28x25 +13x24x14 +26x9x28 +9x3x30 +9x2x9 +8x1x29 +18x30x10 +18x14x5 +26x8x30 +12x1x1 +30x5x28 +26x17x21 +10x10x10 +20x7x27 +13x17x6 +21x13x17 +2x16x8 +7x9x9 +15x26x4 +11x28x25 +10x6x19 +21x6x29 +15x5x6 +28x9x16 +14x3x10 +12x29x5 +22x19x19 +25x15x22 +30x6x28 +11x23x13 +20x25x14 +26x1x13 +6x14x15 +16x25x17 +28x4x13 +10x24x25 +4x13x10 +9x15x16 +15x24x6 +22x9x19 +11x11x8 +4x19x12 +24x5x4 +27x12x13 +7x27x16 +2x6x9 +29x27x15 +18x26x23 +19x16x15 +14x5x25 +9x16x30 +4x6x4 +13x10x10 +1x8x29 +23x5x17 +19x20x20 +11x27x24 +27x15x5 +15x11x12 +21x11x3 +1x13x22 +17x8x8 +13x14x14 +17x22x7 +9x5x8 +2x6x3 +25x9x15 +11x8x13 +9x25x12 +3x16x12 +12x16x8 +16x24x17 +4x6x26 +22x29x11 +14x17x19 +28x2x27 +24x22x19 +22x20x30 +23x28x4 +16x12x14 +22x24x22 +29x1x28 +26x29x16 +3x25x30 +27x3x13 +22x24x26 +25x3x2 +7x24x2 +10x5x3 +28x8x29 +25x6x4 +12x17x14 +24x3x5 +23x27x7 +26x23x30 +11x10x19 +23x7x11 +26x14x15 +14x3x25 +12x24x14 +2x14x12 +9x12x16 +9x2x28 +3x8x2 +22x6x9 +2x30x2 +25x1x9 +20x11x2 +14x11x12 +7x14x12 +24x8x26 +13x21x23 +18x17x23 +13x6x17 +20x20x19 +13x17x29 +7x24x24 +23x8x6 +19x10x28 +3x8x21 +15x20x18 +11x27x1 +11x24x28 +13x20x11 +18x19x22 +27x22x12 +28x3x2 +13x4x29 +26x5x6 +14x29x25 +7x4x7 +5x17x7 +2x8x1 +22x30x24 +22x21x28 +1x28x13 +11x20x4 +25x29x19 +9x23x4 +30x6x11 +25x18x10 +28x10x24 +3x5x20 +19x28x10 +27x19x2 +26x20x4 +19x21x6 +2x12x30 +8x26x27 +11x27x10 +14x13x17 +4x3x21 +2x20x21 +22x30x3 +2x23x2 +3x16x12 +22x28x22 +3x23x29 +8x25x15 +9x30x4 +10x11x1 +24x8x20 +10x7x27 +7x22x4 +27x13x17 +5x28x5 +30x15x13 +10x8x17 +8x21x5 +8x17x26 +25x16x4 +9x7x25 +13x11x20 +6x30x9 +15x14x12 +30x1x23 +5x20x24 +22x7x6 +26x11x23 +29x7x5 +13x24x28 +22x20x10 +18x3x1 +15x19x23 +28x28x20 +7x26x2 +9x12x20 +15x4x6 +1x17x21 +3x22x17 +9x4x20 +25x19x5 +9x11x22 +14x1x17 +14x5x16 +30x5x18 +19x6x12 +28x16x22 +13x4x25 +29x23x18 +1x27x3 +12x14x4 +10x25x19 +15x19x30 +11x30x4 +11x22x26 +13x25x2 +17x13x27 +11x30x24 +15x1x14 +17x18x4 +26x11x3 +16x22x28 +13x20x9 +1x18x3 +25x11x12 +20x21x1 +22x27x4 +8x28x23 +7x13x27 +17x9x26 +27x27x20 +11x20x12 +26x21x11 +29x14x12 +27x25x1 +28x29x25 +21x23x28 +5x18x18 +19x5x4 +7x6x30 +27x8x11 +12x24x12 +16x25x22 +26x11x29 +25x22x17 +15x23x23 +17x9x6 +30x10x16 +21x3x5 +18x27x2 +28x21x14 +16x18x17 +4x18x2 +9x1x14 +9x1x9 +5x27x12 +8x16x30 +3x19x19 +16x26x24 +1x6x9 +15x14x3 +11x7x19 +8x19x3 +17x26x26 +6x18x11 +19x12x4 +29x20x16 +20x17x23 +6x6x5 +20x30x19 +18x25x18 +2x26x2 +3x1x1 +14x25x18 +3x1x6 +11x14x18 +17x23x27 +25x29x9 +6x25x20 +20x10x9 +17x5x18 +29x14x8 +14x25x26 +10x15x29 +23x19x11 +22x2x2 +4x5x5 +13x23x25 +19x13x19 +20x18x6 +30x7x28 +26x18x17 +29x18x10 +30x29x1 +12x26x24 +18x17x26 +29x28x15 +3x12x20 +24x10x8 +30x15x6 +28x23x15 +14x28x11 +10x27x19 +14x8x21 +24x1x23 +1x3x27 +6x15x6 +8x25x26 +13x10x25 +6x9x8 +10x29x29 +26x23x5 +14x24x1 +25x6x22 +17x11x18 +1x27x26 +18x25x23 +20x15x6 +2x21x28 +2x10x13 +12x25x14 +2x14x23 +30x5x23 +29x19x21 +29x10x25 +14x22x16 +17x11x26 +12x17x30 +8x17x7 +20x25x28 +20x11x30 +15x1x12 +13x3x24 +16x23x23 +27x3x3 +26x3x27 +18x5x12 +12x26x7 +19x27x12 +20x10x28 +30x12x25 +3x14x10 +21x26x1 +24x26x26 +7x21x30 +3x29x12 +29x28x5 +5x20x7 +27x11x2 +15x20x4 +16x15x15 +19x13x7 +7x17x15 +27x24x15 +9x17x28 +20x21x14 +14x29x29 +23x26x13 +27x23x21 +18x13x6 +26x16x21 +18x26x27 +9x3x12 +30x18x24 +12x11x29 +5x15x1 +1x16x3 +14x28x11 +2x18x1 +19x18x19 +18x28x21 +2x3x14 +22x16x5 +28x18x28 +24x16x18 +7x4x10 +19x26x19 +24x17x7 +25x9x6 +25x17x7 +20x22x20 +3x3x7 +23x19x15 +21x27x21 +1x23x11 +9x19x4 +22x4x18 +6x15x5 +15x25x2 +23x11x20 +27x16x6 +27x8x5 +10x10x19 +22x14x1 +7x1x29 +8x11x17 +27x9x27 +28x9x24 +17x7x3 +26x23x8 +7x6x30 +25x28x2 +1x30x25 +3x18x18 +28x27x15 +14x14x1 +10x25x29 +18x12x9 +20x28x16 +26x27x22 +8x26x1 +21x2x12 +25x16x14 +21x19x5 +12x9x22 +16x5x4 +5x4x16 +25x29x3 +4x29x13 +15x16x29 +8x11x24 +30x11x20 +17x21x14 +12x24x10 +10x12x6 +3x26x30 +15x14x25 +20x12x21 +13x11x16 +15x13x3 +5x17x29 +6x3x23 +9x26x11 +30x1x8 +14x10x30 +18x30x10 +13x19x19 +16x19x17 +28x7x10 +28x29x4 +3x21x10 +4x28x24 +7x28x9 +2x4x9 +25x27x13 +6x12x15 +4x18x20 +20x1x16 +5x13x24 +11x11x10 +12x9x23 +1x9x30 +17x28x24 +9x5x27 +21x15x16 +17x4x14 +8x14x4 +13x10x7 +17x12x14 +9x19x19 +2x7x21 +8x24x23 +19x5x12 +11x23x21 +13x3x1 +5x27x15 +12x25x25 +13x21x16 +9x17x11 +1x15x21 +4x26x17 +11x5x15 +23x10x15 +12x17x21 +27x15x1 +4x29x14 +5x24x25 +10x10x12 +18x12x9 +11x24x23 +24x23x3 +28x12x15 +29x9x14 +11x25x8 +5x12x2 +26x26x29 +9x21x2 +8x8x25 +1x16x30 +17x29x20 +9x22x13 +7x18x16 +3x3x23 +26x25x30 +15x23x24 +20x23x5 +20x16x10 +23x7x8 +20x18x26 +8x27x6 +30x23x23 +7x7x24 +21x11x15 +1x30x25 +26x27x22 +30x28x13 +20x13x13 +3x1x15 +16x7x1 +7x25x15 +12x7x18 +16x9x23 +16x12x18 +29x5x2 +17x7x7 +21x17x5 +9x9x17 +26x16x10 +29x29x23 +17x26x10 +5x19x17 +1x10x1 +14x21x20 +13x6x4 +13x13x3 +23x4x18 +4x16x3 +16x30x11 +2x11x2 +15x30x15 +20x30x22 +18x12x16 +23x5x16 +6x14x15 +9x4x11 +30x23x21 +20x7x12 +7x18x6 +15x6x5 +18x22x19 +16x10x22 +26x20x25 +9x25x25 +29x21x10 +9x21x24 +7x18x21 +14x3x15 +18x19x19 +4x29x17 +14x10x9 +2x26x14 +13x3x24 +4x4x17 +6x27x24 +2x18x3 +14x25x2 +30x14x17 +11x6x14 +4x10x18 +15x4x2 +27x7x10 +13x24x1 +7x12x6 +25x22x26 +19x2x18 +23x29x2 +2x15x4 +12x6x9 +16x14x29 +9x17x3 +21x9x12 +23x18x22 +10x8x4 +29x2x7 +19x27x15 +4x24x27 +25x20x14 +8x23x19 +1x24x19 +6x20x10 +15x8x5 +18x28x5 +17x23x22 +9x16x13 +30x24x4 +26x3x13 +12x22x18 +29x17x29 +26x4x16 +15x7x20 +9x15x30 +12x7x18 +28x19x18 +11x23x23 +24x20x1 +20x3x24 +1x26x1 +14x10x6 +5x27x24 +13x21x12 +20x20x5 +6x28x9 +11x26x11 +26x29x12 +21x4x11 +20x11x17 +22x27x20 +19x11x21 +2x11x11 +13x5x7 +12x10x25 +21x28x1 +15x30x17 +28x19x1 +4x19x12 +11x4x12 +4x10x30 +11x18x5 +22x20x12 +3x7x27 +20x26x4 +13x27x26 +23x14x13 +4x19x7 +26x27x16 +20x5x20 +18x5x8 +19x21x1 +22x8x1 +29x4x1 +24x10x15 +24x9x20 +10x3x8 +29x30x3 +2x8x24 +16x7x18 +2x11x23 +23x15x16 +21x12x6 +24x28x9 +6x1x13 +14x29x20 +27x24x13 +16x26x8 +5x6x17 +21x8x1 +28x19x21 +1x14x16 +18x2x9 +29x28x10 +22x26x27 +18x26x23 +22x24x2 +28x26x1 +27x29x12 +30x13x11 +1x25x5 +13x30x18 +3x13x22 +22x10x11 +2x7x7 +18x17x8 +9x22x26 +30x18x16 +10x2x3 +7x27x13 +3x20x16 +9x21x16 +1x18x15 +21x30x30 +4x25x23 +3x11x7 +5x6x12 +27x1x20 +13x15x24 +23x29x2 +13x5x24 +22x16x15 +28x14x3 +29x24x9 +2x20x4 +30x10x4 +23x7x20 +22x12x21 +3x19x11 +4x28x28 +5x4x7 +28x12x25 +2x16x26 +23x20x7 +5x21x29 +9x21x16 +9x6x10 +9x6x4 +24x14x29 +28x11x6 +10x22x1 +21x30x20 +13x17x8 +2x25x24 +19x21x3 +28x8x14 +6x29x28 +27x10x28 +30x11x12 +17x2x10 +14x19x17 +2x11x4 +26x1x2 +13x4x4 +23x20x18 +2x17x21 +28x7x15 +3x3x27 +24x17x30 +28x28x20 +21x5x29 +13x12x19 +24x29x29 +19x10x6 +19x12x14 +21x4x17 +27x16x1 +4x17x30 +23x23x18 +23x15x27 +26x2x11 +12x8x8 +15x23x26 +30x17x15 +17x17x15 +24x4x30 +9x9x10 +14x25x20 +25x11x19 +20x7x1 +9x21x3 +7x19x9 +10x6x19 +26x12x30 +21x9x20 +15x11x6 +30x21x9 +10x18x17 +22x9x8 +8x30x26 +28x12x27 +17x17x7 +11x13x8 +5x3x21 +24x1x29 +1x28x2 +18x28x10 +8x29x14 +26x26x27 +17x10x25 +22x30x3 +27x9x13 +21x21x4 +30x29x16 +22x7x20 +24x10x2 +16x29x17 +28x15x17 +19x19x22 +9x8x6 +26x23x24 +25x4x27 +16x12x2 +11x6x18 +19x14x8 +9x29x13 +23x30x19 +10x16x1 +4x21x28 +23x25x25 +19x9x16 +30x11x12 +24x3x9 +28x19x4 +18x12x9 +7x1x25 +28x7x1 +24x3x12 +30x24x22 +27x24x26 +9x30x30 +29x10x8 +4x6x18 +10x1x15 +10x4x26 +23x20x16 +6x3x14 +30x8x16 +25x14x20 +11x9x3 +15x23x25 +8x30x22 +22x19x18 +25x1x12 +27x25x7 +25x23x3 +13x20x8 +5x30x7 +18x19x27 +20x23x3 +1x17x21 +21x21x27 +13x1x24 +7x30x20 +21x9x18 +23x26x6 +22x9x29 +17x6x21 +28x28x29 +19x25x26 +9x27x21 +5x26x8 +11x19x1 +10x1x18 +29x4x8 +21x2x22 +14x12x8 From 948e946f1df421fcb1518151533173130ae1f0ff Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 00:47:33 +0100 Subject: [PATCH 006/100] 2015: d02: ex1: add solution --- 2015/d02/ex1/ex1.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 2015/d02/ex1/ex1.py diff --git a/2015/d02/ex1/ex1.py b/2015/d02/ex1/ex1.py new file mode 100755 index 0000000..9127151 --- /dev/null +++ b/2015/d02/ex1/ex1.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python + +import sys + + +def solve(input: str) -> int: + def parse_line(input: str) -> tuple[int, int, int]: + x, y, z = map(int, input.split("x")) + return x, y, z + + def parse(input: str) -> list[tuple[int, int, int]]: + return [parse_line(line) for line in input.splitlines()] + + def wrapping_paper(x: int, y: int, z: int) -> int: + slack = min(x * y, y * z, z * x) + return 2 * (x * y + y * z + z * x) + slack + + presents = parse(input) + return sum(wrapping_paper(*present) for present in presents) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 3e12df9ac750947428b2f0bb31df350921e6b617 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 00:47:40 +0100 Subject: [PATCH 007/100] 2015: d02: ex2: add input --- 2015/d02/ex2/input | 1000 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1000 insertions(+) create mode 100644 2015/d02/ex2/input diff --git a/2015/d02/ex2/input b/2015/d02/ex2/input new file mode 100644 index 0000000..2f04474 --- /dev/null +++ b/2015/d02/ex2/input @@ -0,0 +1,1000 @@ +20x3x11 +15x27x5 +6x29x7 +30x15x9 +19x29x21 +10x4x15 +1x26x4 +1x5x18 +10x15x23 +10x14x20 +3x5x18 +29x23x30 +7x4x10 +22x24x29 +30x1x2 +19x2x5 +11x9x22 +23x15x10 +11x11x10 +30x28x5 +22x5x4 +6x26x20 +16x12x30 +10x20x5 +25x14x24 +16x17x22 +11x28x26 +1x11x10 +1x24x15 +13x17x21 +30x3x13 +20x25x17 +22x12x5 +22x20x24 +9x2x14 +6x18x8 +27x28x24 +11x17x1 +1x4x12 +5x20x13 +24x23x23 +22x1x25 +18x19x5 +5x23x13 +8x16x4 +20x21x9 +1x7x11 +8x30x17 +3x30x9 +6x16x18 +22x25x27 +9x20x26 +16x21x23 +5x24x17 +15x17x15 +26x15x10 +22x16x3 +20x24x24 +8x18x10 +23x19x16 +1x21x24 +23x23x9 +14x20x6 +25x5x5 +16x3x1 +29x29x20 +11x4x26 +10x23x24 +29x25x16 +27x27x22 +9x7x22 +6x21x18 +25x11x19 +14x13x3 +15x28x17 +14x3x12 +29x8x19 +30x14x20 +20x23x4 +8x16x5 +4x11x18 +20x8x24 +21x13x21 +14x26x29 +27x4x17 +27x4x25 +5x28x6 +23x24x11 +29x22x5 +30x20x6 +23x2x10 +11x4x7 +27x23x6 +10x20x19 +8x20x22 +5x29x22 +16x13x2 +2x11x14 +6x12x4 +3x13x6 +16x5x18 +25x3x28 +21x1x5 +20x16x19 +28x30x27 +26x7x18 +25x27x24 +11x19x7 +21x19x17 +2x12x27 +20x5x14 +8x5x8 +6x24x8 +7x28x20 +3x20x28 +5x20x30 +13x29x1 +26x29x5 +19x28x25 +5x19x11 +11x20x22 +4x23x1 +19x25x12 +3x10x6 +3x14x10 +28x16x12 +23x12x2 +23x12x19 +20x28x10 +9x10x25 +16x21x16 +1x18x20 +9x4x26 +3x25x8 +17x16x28 +9x28x16 +27x3x12 +17x24x12 +13x21x10 +7x17x13 +6x10x9 +7x29x25 +11x19x30 +1x24x5 +20x16x23 +24x28x21 +6x29x19 +25x2x19 +12x5x26 +25x29x12 +16x28x22 +26x26x15 +9x13x5 +10x29x7 +1x24x16 +22x2x2 +6x16x13 +3x12x28 +4x12x13 +14x27x21 +14x23x26 +7x5x18 +8x30x27 +15x9x18 +26x16x5 +3x29x17 +19x7x18 +16x18x1 +26x15x30 +24x30x21 +13x20x7 +4x12x10 +27x20x11 +28x29x21 +20x14x30 +28x12x3 +19x1x8 +4x8x6 +21x14x2 +27x19x21 +17x24x14 +15x18x11 +18x7x26 +25x28x29 +27x26x9 +18x12x17 +24x28x25 +13x24x14 +26x9x28 +9x3x30 +9x2x9 +8x1x29 +18x30x10 +18x14x5 +26x8x30 +12x1x1 +30x5x28 +26x17x21 +10x10x10 +20x7x27 +13x17x6 +21x13x17 +2x16x8 +7x9x9 +15x26x4 +11x28x25 +10x6x19 +21x6x29 +15x5x6 +28x9x16 +14x3x10 +12x29x5 +22x19x19 +25x15x22 +30x6x28 +11x23x13 +20x25x14 +26x1x13 +6x14x15 +16x25x17 +28x4x13 +10x24x25 +4x13x10 +9x15x16 +15x24x6 +22x9x19 +11x11x8 +4x19x12 +24x5x4 +27x12x13 +7x27x16 +2x6x9 +29x27x15 +18x26x23 +19x16x15 +14x5x25 +9x16x30 +4x6x4 +13x10x10 +1x8x29 +23x5x17 +19x20x20 +11x27x24 +27x15x5 +15x11x12 +21x11x3 +1x13x22 +17x8x8 +13x14x14 +17x22x7 +9x5x8 +2x6x3 +25x9x15 +11x8x13 +9x25x12 +3x16x12 +12x16x8 +16x24x17 +4x6x26 +22x29x11 +14x17x19 +28x2x27 +24x22x19 +22x20x30 +23x28x4 +16x12x14 +22x24x22 +29x1x28 +26x29x16 +3x25x30 +27x3x13 +22x24x26 +25x3x2 +7x24x2 +10x5x3 +28x8x29 +25x6x4 +12x17x14 +24x3x5 +23x27x7 +26x23x30 +11x10x19 +23x7x11 +26x14x15 +14x3x25 +12x24x14 +2x14x12 +9x12x16 +9x2x28 +3x8x2 +22x6x9 +2x30x2 +25x1x9 +20x11x2 +14x11x12 +7x14x12 +24x8x26 +13x21x23 +18x17x23 +13x6x17 +20x20x19 +13x17x29 +7x24x24 +23x8x6 +19x10x28 +3x8x21 +15x20x18 +11x27x1 +11x24x28 +13x20x11 +18x19x22 +27x22x12 +28x3x2 +13x4x29 +26x5x6 +14x29x25 +7x4x7 +5x17x7 +2x8x1 +22x30x24 +22x21x28 +1x28x13 +11x20x4 +25x29x19 +9x23x4 +30x6x11 +25x18x10 +28x10x24 +3x5x20 +19x28x10 +27x19x2 +26x20x4 +19x21x6 +2x12x30 +8x26x27 +11x27x10 +14x13x17 +4x3x21 +2x20x21 +22x30x3 +2x23x2 +3x16x12 +22x28x22 +3x23x29 +8x25x15 +9x30x4 +10x11x1 +24x8x20 +10x7x27 +7x22x4 +27x13x17 +5x28x5 +30x15x13 +10x8x17 +8x21x5 +8x17x26 +25x16x4 +9x7x25 +13x11x20 +6x30x9 +15x14x12 +30x1x23 +5x20x24 +22x7x6 +26x11x23 +29x7x5 +13x24x28 +22x20x10 +18x3x1 +15x19x23 +28x28x20 +7x26x2 +9x12x20 +15x4x6 +1x17x21 +3x22x17 +9x4x20 +25x19x5 +9x11x22 +14x1x17 +14x5x16 +30x5x18 +19x6x12 +28x16x22 +13x4x25 +29x23x18 +1x27x3 +12x14x4 +10x25x19 +15x19x30 +11x30x4 +11x22x26 +13x25x2 +17x13x27 +11x30x24 +15x1x14 +17x18x4 +26x11x3 +16x22x28 +13x20x9 +1x18x3 +25x11x12 +20x21x1 +22x27x4 +8x28x23 +7x13x27 +17x9x26 +27x27x20 +11x20x12 +26x21x11 +29x14x12 +27x25x1 +28x29x25 +21x23x28 +5x18x18 +19x5x4 +7x6x30 +27x8x11 +12x24x12 +16x25x22 +26x11x29 +25x22x17 +15x23x23 +17x9x6 +30x10x16 +21x3x5 +18x27x2 +28x21x14 +16x18x17 +4x18x2 +9x1x14 +9x1x9 +5x27x12 +8x16x30 +3x19x19 +16x26x24 +1x6x9 +15x14x3 +11x7x19 +8x19x3 +17x26x26 +6x18x11 +19x12x4 +29x20x16 +20x17x23 +6x6x5 +20x30x19 +18x25x18 +2x26x2 +3x1x1 +14x25x18 +3x1x6 +11x14x18 +17x23x27 +25x29x9 +6x25x20 +20x10x9 +17x5x18 +29x14x8 +14x25x26 +10x15x29 +23x19x11 +22x2x2 +4x5x5 +13x23x25 +19x13x19 +20x18x6 +30x7x28 +26x18x17 +29x18x10 +30x29x1 +12x26x24 +18x17x26 +29x28x15 +3x12x20 +24x10x8 +30x15x6 +28x23x15 +14x28x11 +10x27x19 +14x8x21 +24x1x23 +1x3x27 +6x15x6 +8x25x26 +13x10x25 +6x9x8 +10x29x29 +26x23x5 +14x24x1 +25x6x22 +17x11x18 +1x27x26 +18x25x23 +20x15x6 +2x21x28 +2x10x13 +12x25x14 +2x14x23 +30x5x23 +29x19x21 +29x10x25 +14x22x16 +17x11x26 +12x17x30 +8x17x7 +20x25x28 +20x11x30 +15x1x12 +13x3x24 +16x23x23 +27x3x3 +26x3x27 +18x5x12 +12x26x7 +19x27x12 +20x10x28 +30x12x25 +3x14x10 +21x26x1 +24x26x26 +7x21x30 +3x29x12 +29x28x5 +5x20x7 +27x11x2 +15x20x4 +16x15x15 +19x13x7 +7x17x15 +27x24x15 +9x17x28 +20x21x14 +14x29x29 +23x26x13 +27x23x21 +18x13x6 +26x16x21 +18x26x27 +9x3x12 +30x18x24 +12x11x29 +5x15x1 +1x16x3 +14x28x11 +2x18x1 +19x18x19 +18x28x21 +2x3x14 +22x16x5 +28x18x28 +24x16x18 +7x4x10 +19x26x19 +24x17x7 +25x9x6 +25x17x7 +20x22x20 +3x3x7 +23x19x15 +21x27x21 +1x23x11 +9x19x4 +22x4x18 +6x15x5 +15x25x2 +23x11x20 +27x16x6 +27x8x5 +10x10x19 +22x14x1 +7x1x29 +8x11x17 +27x9x27 +28x9x24 +17x7x3 +26x23x8 +7x6x30 +25x28x2 +1x30x25 +3x18x18 +28x27x15 +14x14x1 +10x25x29 +18x12x9 +20x28x16 +26x27x22 +8x26x1 +21x2x12 +25x16x14 +21x19x5 +12x9x22 +16x5x4 +5x4x16 +25x29x3 +4x29x13 +15x16x29 +8x11x24 +30x11x20 +17x21x14 +12x24x10 +10x12x6 +3x26x30 +15x14x25 +20x12x21 +13x11x16 +15x13x3 +5x17x29 +6x3x23 +9x26x11 +30x1x8 +14x10x30 +18x30x10 +13x19x19 +16x19x17 +28x7x10 +28x29x4 +3x21x10 +4x28x24 +7x28x9 +2x4x9 +25x27x13 +6x12x15 +4x18x20 +20x1x16 +5x13x24 +11x11x10 +12x9x23 +1x9x30 +17x28x24 +9x5x27 +21x15x16 +17x4x14 +8x14x4 +13x10x7 +17x12x14 +9x19x19 +2x7x21 +8x24x23 +19x5x12 +11x23x21 +13x3x1 +5x27x15 +12x25x25 +13x21x16 +9x17x11 +1x15x21 +4x26x17 +11x5x15 +23x10x15 +12x17x21 +27x15x1 +4x29x14 +5x24x25 +10x10x12 +18x12x9 +11x24x23 +24x23x3 +28x12x15 +29x9x14 +11x25x8 +5x12x2 +26x26x29 +9x21x2 +8x8x25 +1x16x30 +17x29x20 +9x22x13 +7x18x16 +3x3x23 +26x25x30 +15x23x24 +20x23x5 +20x16x10 +23x7x8 +20x18x26 +8x27x6 +30x23x23 +7x7x24 +21x11x15 +1x30x25 +26x27x22 +30x28x13 +20x13x13 +3x1x15 +16x7x1 +7x25x15 +12x7x18 +16x9x23 +16x12x18 +29x5x2 +17x7x7 +21x17x5 +9x9x17 +26x16x10 +29x29x23 +17x26x10 +5x19x17 +1x10x1 +14x21x20 +13x6x4 +13x13x3 +23x4x18 +4x16x3 +16x30x11 +2x11x2 +15x30x15 +20x30x22 +18x12x16 +23x5x16 +6x14x15 +9x4x11 +30x23x21 +20x7x12 +7x18x6 +15x6x5 +18x22x19 +16x10x22 +26x20x25 +9x25x25 +29x21x10 +9x21x24 +7x18x21 +14x3x15 +18x19x19 +4x29x17 +14x10x9 +2x26x14 +13x3x24 +4x4x17 +6x27x24 +2x18x3 +14x25x2 +30x14x17 +11x6x14 +4x10x18 +15x4x2 +27x7x10 +13x24x1 +7x12x6 +25x22x26 +19x2x18 +23x29x2 +2x15x4 +12x6x9 +16x14x29 +9x17x3 +21x9x12 +23x18x22 +10x8x4 +29x2x7 +19x27x15 +4x24x27 +25x20x14 +8x23x19 +1x24x19 +6x20x10 +15x8x5 +18x28x5 +17x23x22 +9x16x13 +30x24x4 +26x3x13 +12x22x18 +29x17x29 +26x4x16 +15x7x20 +9x15x30 +12x7x18 +28x19x18 +11x23x23 +24x20x1 +20x3x24 +1x26x1 +14x10x6 +5x27x24 +13x21x12 +20x20x5 +6x28x9 +11x26x11 +26x29x12 +21x4x11 +20x11x17 +22x27x20 +19x11x21 +2x11x11 +13x5x7 +12x10x25 +21x28x1 +15x30x17 +28x19x1 +4x19x12 +11x4x12 +4x10x30 +11x18x5 +22x20x12 +3x7x27 +20x26x4 +13x27x26 +23x14x13 +4x19x7 +26x27x16 +20x5x20 +18x5x8 +19x21x1 +22x8x1 +29x4x1 +24x10x15 +24x9x20 +10x3x8 +29x30x3 +2x8x24 +16x7x18 +2x11x23 +23x15x16 +21x12x6 +24x28x9 +6x1x13 +14x29x20 +27x24x13 +16x26x8 +5x6x17 +21x8x1 +28x19x21 +1x14x16 +18x2x9 +29x28x10 +22x26x27 +18x26x23 +22x24x2 +28x26x1 +27x29x12 +30x13x11 +1x25x5 +13x30x18 +3x13x22 +22x10x11 +2x7x7 +18x17x8 +9x22x26 +30x18x16 +10x2x3 +7x27x13 +3x20x16 +9x21x16 +1x18x15 +21x30x30 +4x25x23 +3x11x7 +5x6x12 +27x1x20 +13x15x24 +23x29x2 +13x5x24 +22x16x15 +28x14x3 +29x24x9 +2x20x4 +30x10x4 +23x7x20 +22x12x21 +3x19x11 +4x28x28 +5x4x7 +28x12x25 +2x16x26 +23x20x7 +5x21x29 +9x21x16 +9x6x10 +9x6x4 +24x14x29 +28x11x6 +10x22x1 +21x30x20 +13x17x8 +2x25x24 +19x21x3 +28x8x14 +6x29x28 +27x10x28 +30x11x12 +17x2x10 +14x19x17 +2x11x4 +26x1x2 +13x4x4 +23x20x18 +2x17x21 +28x7x15 +3x3x27 +24x17x30 +28x28x20 +21x5x29 +13x12x19 +24x29x29 +19x10x6 +19x12x14 +21x4x17 +27x16x1 +4x17x30 +23x23x18 +23x15x27 +26x2x11 +12x8x8 +15x23x26 +30x17x15 +17x17x15 +24x4x30 +9x9x10 +14x25x20 +25x11x19 +20x7x1 +9x21x3 +7x19x9 +10x6x19 +26x12x30 +21x9x20 +15x11x6 +30x21x9 +10x18x17 +22x9x8 +8x30x26 +28x12x27 +17x17x7 +11x13x8 +5x3x21 +24x1x29 +1x28x2 +18x28x10 +8x29x14 +26x26x27 +17x10x25 +22x30x3 +27x9x13 +21x21x4 +30x29x16 +22x7x20 +24x10x2 +16x29x17 +28x15x17 +19x19x22 +9x8x6 +26x23x24 +25x4x27 +16x12x2 +11x6x18 +19x14x8 +9x29x13 +23x30x19 +10x16x1 +4x21x28 +23x25x25 +19x9x16 +30x11x12 +24x3x9 +28x19x4 +18x12x9 +7x1x25 +28x7x1 +24x3x12 +30x24x22 +27x24x26 +9x30x30 +29x10x8 +4x6x18 +10x1x15 +10x4x26 +23x20x16 +6x3x14 +30x8x16 +25x14x20 +11x9x3 +15x23x25 +8x30x22 +22x19x18 +25x1x12 +27x25x7 +25x23x3 +13x20x8 +5x30x7 +18x19x27 +20x23x3 +1x17x21 +21x21x27 +13x1x24 +7x30x20 +21x9x18 +23x26x6 +22x9x29 +17x6x21 +28x28x29 +19x25x26 +9x27x21 +5x26x8 +11x19x1 +10x1x18 +29x4x8 +21x2x22 +14x12x8 From 175f1773bdd200772bb14bf951abf77e858ea79b Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 00:47:45 +0100 Subject: [PATCH 008/100] 2015: d02: ex2: add solution --- 2015/d02/ex2/ex2.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 2015/d02/ex2/ex2.py diff --git a/2015/d02/ex2/ex2.py b/2015/d02/ex2/ex2.py new file mode 100755 index 0000000..b28720b --- /dev/null +++ b/2015/d02/ex2/ex2.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python + +import sys + + +def solve(input: str) -> int: + def parse_line(input: str) -> tuple[int, int, int]: + x, y, z = map(int, input.split("x")) + return x, y, z + + def parse(input: str) -> list[tuple[int, int, int]]: + return [parse_line(line) for line in input.splitlines()] + + def ribbon(x: int, y: int, z: int) -> int: + bow = x * y * z + return 2 * min(x + y, y + z, z + x) + bow + + presents = parse(input) + return sum(ribbon(*present) for present in presents) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 3d6c56044921cb4903d94684877fc1003b2ece1a Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 00:55:28 +0100 Subject: [PATCH 009/100] 2015: d03: ex1: add input --- 2015/d03/ex1/input | 1 + 1 file changed, 1 insertion(+) create mode 100644 2015/d03/ex1/input diff --git a/2015/d03/ex1/input b/2015/d03/ex1/input new file mode 100644 index 0000000..03504fc --- /dev/null +++ b/2015/d03/ex1/input @@ -0,0 +1 @@ +^><^>>>^<^v<<^<><^<^v>^vv<>v>>^^^v<<<^>^<^v<^>^v><<<^>><>v>v^<<^>^<<^^^>v>>v^^>^>vv>>^>>v^>^v>^<^^v>^>^^v^^>v^^v><^><^<<>v^<^<^vv^>>>v^v^>^<>^v<^^vv^>^<>^^<vv<>^>v<^>^v>v^>^v<>^><>>v^v<><>v^v>>>>v^^>^><^^<^>^v^v<>v<<<^<v^^^<^^^>v<^v>>>>>v<^^^^>v<^<>>>>>>v^vvvv^^^v<^v^>v><^>^v<<>>vv^>v>v^^>vv^<^vvv<>><>><><^^^^<^^^<^v>>v>^v^^^>v^^^v>>^v^^<^>>^>^<>>^^<>>^vv>v^<^>>>><><^^v<><<<<^^<>>^<>vv^<^>v^^><^v>^^>v<>^v^<>^vv^>vvv>v>^>^>>^>><>>>^^^^v^<>v^^>^<>v<^^v><^v><>^^^^^v^v>>^^v><<><^^^^><^>v>><<<^v>v^^>^v^<^^v>v<^<<>>^v<<>v<^v^>v^>^v<<v>v>>v>v^^v>^v^>>>><>^>v>^v^>>>>v^<<<>vvv>><^^>^<><^^<^v^v^<^^>^<^v^<<<^^v^v>>><>^^>vv<<^v^<<<<^^>>>v>v<<<>^^>>>v>^>v>vv<<>^<^>^^<^>^v^<>v^><^^^>vv>><^v<^<<<><<^^<><>v>^>^<>>^^v>vv^<^^v>><^vv^<<<>vv^v<^<>v^^>><>^<^v<<<^<<^>>>^^<^^v>v^vvvv>v<>><^>^<<<v^^^v<>v>^^<v>>v>>v^>^<>v><>>>v^>^v<^<><<^>^^^>^><>^><^<>vv<>>v^v>^>^>^<^><>v<><>>>^^^<^v>>^<>>>vv^>vvvv>>><^>v<>^^^>v>>v^v^>^^<<^>^>>v<<><>v^^>v^><<^v^>^^<v><<<^v^<>^<>^>>^<^^<>^v<>v^>>><>^><>>vv>v^<^^^>v>^^>^v<><>>><>><^<>>v>v^^>^^<^^>^>>v>vv^^v<^<^v>><<^>^v>^^^<<>v^<^^v<<<>^^vv<^>vv>^>^<><<>vv<^>v^vv>^^^v><<^vv>^v<>vv^^<^<>^^v^<^vvv>v^^<>^^>^^>^<><<^v>^><^^vvvv<><>^v<>^><>v>><>vv^<<><<>><>v<^>^v>>^^v><<<>>^<^v^^^<^<><><^><<<<^^<>><><>>v><<vvvv^^vv><<^v^vvv><>v><>v<<<^><^^>v^>^^^v^v>><<>^v<>v^v<<<<^^^v^v<<>>>v>>vv>^^<><^v<>>v^>>>>>^>v^v^<^v^v^vvv>vvv^<vv>>v^^vv<^v>>>>vv<>v<>^^vv^v^>>vvv<<v>v>^><<<^>v^>^v^^^><<><<<^^<^^<>^^v<^v>^v<^>^>><>^v^v<<^>^>v><^>^vv^^^v^v^>^<<>>>>>v^<>^>v^vv^><<>>^^<>v^>^vvv^>v^v><>^><<>v>v<^<^><^^vv<<><>>v>>v>>^v<<>^vv<>^vv>v>v>^>^>>><><<>v^<<^v^^<<<>>vv<^<<>v<^^^<<^v^>^v>^^^v^v>>>v>v^v>^>^vv<^^<^<<v^<><<^vvv^^><>vv^v>v>^><<^^^^vvv^><^v<^>^<>>^>>vv^<>>^v>^>v>^<^<^^^<>>>>>>v>^<>^^v^><>><^v^^><>v^v<^<<<<^>^^>vv>><^v^vvv>v^^><^^<^<>>^^v^vv<>v<^<<v>v<>^v^><>v<^v>><<^<^v^>><^<^><>v>>^vv<^v>^>v<^>>^>>v^>^v<^v^v><<><>^><<<><>^<>^^^^v>^>^vvvvv>v>>v><<<^><<^v><^v>>>>^v<^v<<>>^>^<v>><<^>^>^v><><>^><v^><<^v^<^^><^^v^<<^v^^>>^v^<^>v^^<<^^^<><>^>v^v>v^>^v^vv>^^>>>>^^<^>>>^^v<^^v><<<>^>^^>^>^v<<<<>>^<<>>>v>^^<^v<>v<>v^>v^><^<^^>^^vv><>v>^<<<^><^^<^<^^v<^>v^v^^^><^>v^v>>^^v^>>>>><<>^>v>v<>>>v>^^^^>>v^<<^>>><^v^<<>>v><>^v^^><<>>^>^>vv<^<>^vvv^vv^v>^^<<<<<>^v^>^<>v^^<>v^v^<>vv^<^vv>>><<>v^^^>^>^^>>>vvv>^>v>v>>>^>vv^><>^><>v>^^^><><<<>>v^v<^<>^^<>^^<<><>^v<><>>>^vv<^<<^<^v>v<<<<<^^v<^v<><^>v>^v>>^v^><^^^^v<><><>vv^<>vv<^v<^^><^^v^v^<^^<<>v<>v^v<^>vvv><<^v>>v><>>>v<^>>v>^<>><>^v<^^>^<^v<^<<^^v<>>^>^>^v^^v^v>v>v<>v^>v^^>^^>><<>><<^^>><^v<<><<>>>>>>^^^^^<<>^<<^><<^^vvv<<>vv><<>v>v^v>>>>>^<>><^^^><<<<>>v<^>>>^^vvv>v<>>>>v>>^v^vvv<<>vvv<<^^^<>vv^^v<<>^^^>>^<^v^<^^>v^>>^<<^v<v^>>^>v^><^><>^>>>vv>><^^^>vv<<^^vv><^<>^>^^<^<>>^vv^>>^v><>v^>>><<<^^<^>^>v<^>^<^^<>>><^^<>^v^<<>vvv>v^v<<^^^><<^vv^v>v>v<<^v^<<<>^><>v>^vv^v<>vv^>^^<^>^>v^^v><>>^v<^<><><^vv<><<>v^^>^^<><<>^<^<<<>v>><^<<>^>^v^v<^>>^v<^>v<<>^^^<^v>>>^vvvv<vvvv>v<>v^<><>vvv<>^<<>^>>>>v^<^<><^v>v^>>v><>^><^<<>^>^v^>^v>^<>v^<^^>v>^>>>v^v>>>^<>^<>>>>>v>>vv^v<><<<><><<>>vv<^^v<<>v^v<^v<>>^v>>vvv^^v>>v>^>^>v><^>^^<<>^v<^<<<<^>v<^>>v^<^v>^v<<>^>^vvv<^^vv>^vv>vv<>>v>v>v^<<<<<^^v^>v>^<<>v^<<>>^<^>^^<>>>>^<^v<>v^^>^<^^v<^><>>>^v^vv<^v<^><><>><^^>^<^v^<^<>v<<<^v>v^^^<>v^^v^>><>^^<<^^v^<>^<^vv>>><^v>vv<^v<<>v>v^v>^v<^<>v^vvv>^vv<<<<^>>^^>><^v><<^>v^^<<<<<>^v<<^^>v<<<<^>^>^>>^>>>v^<>^^v>>>^vvv<^v<>>>vv>^^><^v>vv^>>v>v^<>^^>^<<^>^^^>>^vv>^^>vvvv<>>^^^^>>>v>v^^>vv>vv^<<>^><^><<>>^>^><^v^>v^<>^>v^^v^>^^>v<<<<^<<^>>v>v^^^<<>>^^v>v<<<<^^^v>^vv^>><>^v<>>>v>vvv^v^^v^>>vv>^>><>^v><^v^><^^>vv>^<^<^>>v>><><>^>^>v>vv>vv>^^>v>v^>^>^v>^^v>^<^v<>>vvv^^>^>vvv^^v<^<^>vv^^<^^^>v>vv<v<^>^v^<^>v<^>^<>vv^><>>^>>^<^><<>^<^>v>v><>>>^<<^><<^v<>>vv<^>>v>v>>>>^^>v<^v^>><<^<>>v><^><<^>^<<>>^^<><^^v>^^>vv>^v>^^v^<^<<>>v^^^<^><^<<><><<>^v>vvv^vvv^^>>^<^><>^<<<<^^<>>>v^<<^^v>><><v>^vv>vv^><>^><<><^^>^>^<><>><^^<><>^>><^v<<<<>>^v>^^vv^v^<><<vv>>v>>^v^<>>vv^<^>^<<>v<<<^vv<^vv^vv<^v^^^v>>v<^^<^^vvv<^^v<>>>^>v^>^^><>vv>v>v<<<^^v<^vv^v>^^^>>>^^<>^^<^vvv>><><<><^><<>^>^^vv>vv^^<^^<<><><v><<>v>vvv<^^^^<^>>><<<^^^<^>vv^^v>>v<vvv^^v^^<^v<^<>^<^v>>^><><>v>>>^^>>v^>><>v<><>>><>>>>><<^vvv<<><><<>^><><<^^v><<^>v>^>^v>v>>^^<><^>vv<^<^v>v<><^<<^><>^^^^^v>><>^>^vvv>v^vv^v^>v><>v^><>v>^^^^><^v^^^>^^><<^^>v>v<^v^^vv^<<<<^>v>v^v><>^><><>^v^<>^v>^v>v^<><^>>v<<^><^vv^<><^<>><>><<^^^^>v<^<^vv<><^vv><<^<v^>>^v>^>v^^v>vvv<v<>^>>vv^>>><>^v^^<^>v<<^<^^v^^v^<vv^><^v<^>>>vv^^^^v>^><^^^<><<^^>v<><><><>vv^><<^>^><^v<^<^v^v<<<<<<><vv>v<^><<><><<>>v>><^>^v>^v^<>v^^^><^^<<<^vv^vv>^v^vvv^^>v^><^<^<^<>^vv^^^>vv^v>>><<<^<>>v>v<^^<>>><><^v^^<<><<<>^<^^v^>v><^<^>^>>^<>^v><>>^vv^>^^<<<^v<>>^v<>vvv<<^^<<>>>>^^<><>^><>^vv^v<^>^v<>v^vv<><^vvv<><<^>>^^><><>^<>^>v^^v^><>>v>><^v>^v<<<>vvv^<^^v^<>^>>v<>^^><>>^><^^vv>><<>><^><>>^vv>vv^v^^v<<^^v^^vv<<^<<><>^<><^<^<>>^vvv>>^<^vv>^vv^>v>^<><^><^<>v^v^^<^<>^^v>>><^v<>v^v<<^>v><>^^<v^>>v>^<>^>^>^<^>v><<><><><<<>^>><^>>>^v<<<^<<>^><<^>>>>>v<^>v>>v^^>v^^><>v^v^vvvvv>>><<>^<v>^>^vv^^<^>>v>vv^v<^<>^v^<^<<><<<^vvv^>^^<<>>>vv<<^<><^v<^<><<^^>vv^v>v^^^>>>>^>vv<v>>^^v^^><>v<<^><^>^>v^v>><^v^>v<<^<^<^<^<>>v^^>><<<>vv<^^>^vv<<<^^v^^>v<<><^<>^^>^v<>v>><^^^vv^>^><>v^^>^v>^<<^v>^>>>>><^^^<>v>v^^<^v^>>v^<^>v^v>>>>^>>vv<>^<^v>v>v^v>^<>^>v<<>^<>>^<>>^<>v^><<>^v>>^^^^<<^v><>^<^>^^v><^^<^^v>v<<^>^>><<^^^vvv<<^vv<^^>v^^vv^<^^<<^^>>^^<v^>>v^^>v<^>^>vv>><v><^<^vv>^^v>^>v<<^vv><^^^^^^><<^>>>^v<>^^v<<<>><<<>^<<v^>^^^<^>^^^v<<>v^><<^^<<^v<<>^v>>vv>><<^v^^>v^v>^^v<><^^^<^^>v>^<>vvv^v^^^>v^^v<^>^^>>^v<><^><^<<^vv^<><<>v^vv^<<<^^>v<<>>>v<>v<><<^v>^^v>^^>v>^>^>v<>><>^>^>^vvvv<^^^^^v>v>><>^>^><>^^>v^^<<><^><<<<>v>^^>^v<<<>vvv>>v<^v>>v>v^<<<>^>^>^<>v<^^vv><^v<<^vv<^<<^^vv^^>vv<^>v>^^<^>v<<^^<^>^^^v^^>>v^vv^<^v>^<>^<^>>^<^v<>v><^^<><>^>v<^<^vv>><^v>^<>^^>^<><<>^<>><<>vvv^<<^^>>v<^>>vv>^v^^^v<>v<>><>^vv^>vv^ \ No newline at end of file From b27649bb65cfba478b669c5ebb6b1fb125f4cf0c Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 00:55:40 +0100 Subject: [PATCH 010/100] 2015: d03: ex1: add solution --- 2015/d03/ex1/ex1.py | 55 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100755 2015/d03/ex1/ex1.py diff --git a/2015/d03/ex1/ex1.py b/2015/d03/ex1/ex1.py new file mode 100755 index 0000000..ef5bf4b --- /dev/null +++ b/2015/d03/ex1/ex1.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python + +import enum +import sys +from typing import NamedTuple + + +class Point(NamedTuple): + x: int + y: int + + +class Direction(enum.StrEnum): + NORTH = "^" + EAST = ">" + SOUTH = "v" + WEST = "<" + + def apply(self, p: Point) -> Point: + match self: + case Direction.NORTH: + dx, dy = -1, 0 + case Direction.EAST: + dx, dy = 0, 1 + case Direction.SOUTH: + dx, dy = 1, 0 + case Direction.WEST: + dx, dy = 0, -1 + return Point(p.x + dx, p.y + dy) + + +def solve(input: str) -> int: + def parse(input: str) -> list[Direction]: + return [Direction(c) for c in input.strip()] + + def distribute_presents(moves: list[Direction]) -> set[Point]: + pos = Point(0, 0) + seen = {pos} + for move in moves: + pos = move.apply(pos) + seen.add(pos) + return seen + + moves = parse(input) + presents = distribute_presents(moves) + return len(presents) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 5183d84bf73b9701930d4308671e33f7a6dac505 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 00:55:45 +0100 Subject: [PATCH 011/100] 2015: d03: ex2: add input --- 2015/d03/ex2/input | 1 + 1 file changed, 1 insertion(+) create mode 100644 2015/d03/ex2/input diff --git a/2015/d03/ex2/input b/2015/d03/ex2/input new file mode 100644 index 0000000..03504fc --- /dev/null +++ b/2015/d03/ex2/input @@ -0,0 +1 @@ +^><^>>>^<^v<<^<><^<^v>^vv<>v>>^^^v<<<^>^<^v<^>^v><<<^>><>v>v^<<^>^<<^^^>v>>v^^>^>vv>>^>>v^>^v>^<^^v>^>^^v^^>v^^v><^><^<<>v^<^<^vv^>>>v^v^>^<>^v<^^vv^>^<>^^<vv<>^>v<^>^v>v^>^v<>^><>>v^v<><>v^v>>>>v^^>^><^^<^>^v^v<>v<<<^<v^^^<^^^>v<^v>>>>>v<^^^^>v<^<>>>>>>v^vvvv^^^v<^v^>v><^>^v<<>>vv^>v>v^^>vv^<^vvv<>><>><><^^^^<^^^<^v>>v>^v^^^>v^^^v>>^v^^<^>>^>^<>>^^<>>^vv>v^<^>>>><><^^v<><<<<^^<>>^<>vv^<^>v^^><^v>^^>v<>^v^<>^vv^>vvv>v>^>^>>^>><>>>^^^^v^<>v^^>^<>v<^^v><^v><>^^^^^v^v>>^^v><<><^^^^><^>v>><<<^v>v^^>^v^<^^v>v<^<<>>^v<<>v<^v^>v^>^v<<v>v>>v>v^^v>^v^>>>><>^>v>^v^>>>>v^<<<>vvv>><^^>^<><^^<^v^v^<^^>^<^v^<<<^^v^v>>><>^^>vv<<^v^<<<<^^>>>v>v<<<>^^>>>v>^>v>vv<<>^<^>^^<^>^v^<>v^><^^^>vv>><^v<^<<<><<^^<><>v>^>^<>>^^v>vv^<^^v>><^vv^<<<>vv^v<^<>v^^>><>^<^v<<<^<<^>>>^^<^^v>v^vvvv>v<>><^>^<<<v^^^v<>v>^^<v>>v>>v^>^<>v><>>>v^>^v<^<><<^>^^^>^><>^><^<>vv<>>v^v>^>^>^<^><>v<><>>>^^^<^v>>^<>>>vv^>vvvv>>><^>v<>^^^>v>>v^v^>^^<<^>^>>v<<><>v^^>v^><<^v^>^^<v><<<^v^<>^<>^>>^<^^<>^v<>v^>>><>^><>>vv>v^<^^^>v>^^>^v<><>>><>><^<>>v>v^^>^^<^^>^>>v>vv^^v<^<^v>><<^>^v>^^^<<>v^<^^v<<<>^^vv<^>vv>^>^<><<>vv<^>v^vv>^^^v><<^vv>^v<>vv^^<^<>^^v^<^vvv>v^^<>^^>^^>^<><<^v>^><^^vvvv<><>^v<>^><>v>><>vv^<<><<>><>v<^>^v>>^^v><<<>>^<^v^^^<^<><><^><<<<^^<>><><>>v><<vvvv^^vv><<^v^vvv><>v><>v<<<^><^^>v^>^^^v^v>><<>^v<>v^v<<<<^^^v^v<<>>>v>>vv>^^<><^v<>>v^>>>>>^>v^v^<^v^v^vvv>vvv^<vv>>v^^vv<^v>>>>vv<>v<>^^vv^v^>>vvv<<v>v>^><<<^>v^>^v^^^><<><<<^^<^^<>^^v<^v>^v<^>^>><>^v^v<<^>^>v><^>^vv^^^v^v^>^<<>>>>>v^<>^>v^vv^><<>>^^<>v^>^vvv^>v^v><>^><<>v>v<^<^><^^vv<<><>>v>>v>>^v<<>^vv<>^vv>v>v>^>^>>><><<>v^<<^v^^<<<>>vv<^<<>v<^^^<<^v^>^v>^^^v^v>>>v>v^v>^>^vv<^^<^<<v^<><<^vvv^^><>vv^v>v>^><<^^^^vvv^><^v<^>^<>>^>>vv^<>>^v>^>v>^<^<^^^<>>>>>>v>^<>^^v^><>><^v^^><>v^v<^<<<<^>^^>vv>><^v^vvv>v^^><^^<^<>>^^v^vv<>v<^<<v>v<>^v^><>v<^v>><<^<^v^>><^<^><>v>>^vv<^v>^>v<^>>^>>v^>^v<^v^v><<><>^><<<><>^<>^^^^v>^>^vvvvv>v>>v><<<^><<^v><^v>>>>^v<^v<<>>^>^<v>><<^>^>^v><><>^><v^><<^v^<^^><^^v^<<^v^^>>^v^<^>v^^<<^^^<><>^>v^v>v^>^v^vv>^^>>>>^^<^>>>^^v<^^v><<<>^>^^>^>^v<<<<>>^<<>>>v>^^<^v<>v<>v^>v^><^<^^>^^vv><>v>^<<<^><^^<^<^^v<^>v^v^^^><^>v^v>>^^v^>>>>><<>^>v>v<>>>v>^^^^>>v^<<^>>><^v^<<>>v><>^v^^><<>>^>^>vv<^<>^vvv^vv^v>^^<<<<<>^v^>^<>v^^<>v^v^<>vv^<^vv>>><<>v^^^>^>^^>>>vvv>^>v>v>>>^>vv^><>^><>v>^^^><><<<>>v^v<^<>^^<>^^<<><>^v<><>>>^vv<^<<^<^v>v<<<<<^^v<^v<><^>v>^v>>^v^><^^^^v<><><>vv^<>vv<^v<^^><^^v^v^<^^<<>v<>v^v<^>vvv><<^v>>v><>>>v<^>>v>^<>><>^v<^^>^<^v<^<<^^v<>>^>^>^v^^v^v>v>v<>v^>v^^>^^>><<>><<^^>><^v<<><<>>>>>>^^^^^<<>^<<^><<^^vvv<<>vv><<>v>v^v>>>>>^<>><^^^><<<<>>v<^>>>^^vvv>v<>>>>v>>^v^vvv<<>vvv<<^^^<>vv^^v<<>^^^>>^<^v^<^^>v^>>^<<^v<v^>>^>v^><^><>^>>>vv>><^^^>vv<<^^vv><^<>^>^^<^<>>^vv^>>^v><>v^>>><<<^^<^>^>v<^>^<^^<>>><^^<>^v^<<>vvv>v^v<<^^^><<^vv^v>v>v<<^v^<<<>^><>v>^vv^v<>vv^>^^<^>^>v^^v><>>^v<^<><><^vv<><<>v^^>^^<><<>^<^<<<>v>><^<<>^>^v^v<^>>^v<^>v<<>^^^<^v>>>^vvvv<vvvv>v<>v^<><>vvv<>^<<>^>>>>v^<^<><^v>v^>>v><>^><^<<>^>^v^>^v>^<>v^<^^>v>^>>>v^v>>>^<>^<>>>>>v>>vv^v<><<<><><<>>vv<^^v<<>v^v<^v<>>^v>>vvv^^v>>v>^>^>v><^>^^<<>^v<^<<<<^>v<^>>v^<^v>^v<<>^>^vvv<^^vv>^vv>vv<>>v>v>v^<<<<<^^v^>v>^<<>v^<<>>^<^>^^<>>>>^<^v<>v^^>^<^^v<^><>>>^v^vv<^v<^><><>><^^>^<^v^<^<>v<<<^v>v^^^<>v^^v^>><>^^<<^^v^<>^<^vv>>><^v>vv<^v<<>v>v^v>^v<^<>v^vvv>^vv<<<<^>>^^>><^v><<^>v^^<<<<<>^v<<^^>v<<<<^>^>^>>^>>>v^<>^^v>>>^vvv<^v<>>>vv>^^><^v>vv^>>v>v^<>^^>^<<^>^^^>>^vv>^^>vvvv<>>^^^^>>>v>v^^>vv>vv^<<>^><^><<>>^>^><^v^>v^<>^>v^^v^>^^>v<<<<^<<^>>v>v^^^<<>>^^v>v<<<<^^^v>^vv^>><>^v<>>>v>vvv^v^^v^>>vv>^>><>^v><^v^><^^>vv>^<^<^>>v>><><>^>^>v>vv>vv>^^>v>v^>^>^v>^^v>^<^v<>>vvv^^>^>vvv^^v<^<^>vv^^<^^^>v>vv<v<^>^v^<^>v<^>^<>vv^><>>^>>^<^><<>^<^>v>v><>>>^<<^><<^v<>>vv<^>>v>v>>>>^^>v<^v^>><<^<>>v><^><<^>^<<>>^^<><^^v>^^>vv>^v>^^v^<^<<>>v^^^<^><^<<><><<>^v>vvv^vvv^^>>^<^><>^<<<<^^<>>>v^<<^^v>><><v>^vv>vv^><>^><<><^^>^>^<><>><^^<><>^>><^v<<<<>>^v>^^vv^v^<><<vv>>v>>^v^<>>vv^<^>^<<>v<<<^vv<^vv^vv<^v^^^v>>v<^^<^^vvv<^^v<>>>^>v^>^^><>vv>v>v<<<^^v<^vv^v>^^^>>>^^<>^^<^vvv>><><<><^><<>^>^^vv>vv^^<^^<<><><v><<>v>vvv<^^^^<^>>><<<^^^<^>vv^^v>>v<vvv^^v^^<^v<^<>^<^v>>^><><>v>>>^^>>v^>><>v<><>>><>>>>><<^vvv<<><><<>^><><<^^v><<^>v>^>^v>v>>^^<><^>vv<^<^v>v<><^<<^><>^^^^^v>><>^>^vvv>v^vv^v^>v><>v^><>v>^^^^><^v^^^>^^><<^^>v>v<^v^^vv^<<<<^>v>v^v><>^><><>^v^<>^v>^v>v^<><^>>v<<^><^vv^<><^<>><>><<^^^^>v<^<^vv<><^vv><<^<v^>>^v>^>v^^v>vvv<v<>^>>vv^>>><>^v^^<^>v<<^<^^v^^v^<vv^><^v<^>>>vv^^^^v>^><^^^<><<^^>v<><><><>vv^><<^>^><^v<^<^v^v<<<<<<><vv>v<^><<><><<>>v>><^>^v>^v^<>v^^^><^^<<<^vv^vv>^v^vvv^^>v^><^<^<^<>^vv^^^>vv^v>>><<<^<>>v>v<^^<>>><><^v^^<<><<<>^<^^v^>v><^<^>^>>^<>^v><>>^vv^>^^<<<^v<>>^v<>vvv<<^^<<>>>>^^<><>^><>^vv^v<^>^v<>v^vv<><^vvv<><<^>>^^><><>^<>^>v^^v^><>>v>><^v>^v<<<>vvv^<^^v^<>^>>v<>^^><>>^><^^vv>><<>><^><>>^vv>vv^v^^v<<^^v^^vv<<^<<><>^<><^<^<>>^vvv>>^<^vv>^vv^>v>^<><^><^<>v^v^^<^<>^^v>>><^v<>v^v<<^>v><>^^<v^>>v>^<>^>^>^<^>v><<><><><<<>^>><^>>>^v<<<^<<>^><<^>>>>>v<^>v>>v^^>v^^><>v^v^vvvvv>>><<>^<v>^>^vv^^<^>>v>vv^v<^<>^v^<^<<><<<^vvv^>^^<<>>>vv<<^<><^v<^<><<^^>vv^v>v^^^>>>>^>vv<v>>^^v^^><>v<<^><^>^>v^v>><^v^>v<<^<^<^<^<>>v^^>><<<>vv<^^>^vv<<<^^v^^>v<<><^<>^^>^v<>v>><^^^vv^>^><>v^^>^v>^<<^v>^>>>>><^^^<>v>v^^<^v^>>v^<^>v^v>>>>^>>vv<>^<^v>v>v^v>^<>^>v<<>^<>>^<>>^<>v^><<>^v>>^^^^<<^v><>^<^>^^v><^^<^^v>v<<^>^>><<^^^vvv<<^vv<^^>v^^vv^<^^<<^^>>^^<v^>>v^^>v<^>^>vv>><v><^<^vv>^^v>^>v<<^vv><^^^^^^><<^>>>^v<>^^v<<<>><<<>^<<v^>^^^<^>^^^v<<>v^><<^^<<^v<<>^v>>vv>><<^v^^>v^v>^^v<><^^^<^^>v>^<>vvv^v^^^>v^^v<^>^^>>^v<><^><^<<^vv^<><<>v^vv^<<<^^>v<<>>>v<>v<><<^v>^^v>^^>v>^>^>v<>><>^>^>^vvvv<^^^^^v>v>><>^>^><>^^>v^^<<><^><<<<>v>^^>^v<<<>vvv>>v<^v>>v>v^<<<>^>^>^<>v<^^vv><^v<<^vv<^<<^^vv^^>vv<^>v>^^<^>v<<^^<^>^^^v^^>>v^vv^<^v>^<>^<^>>^<^v<>v><^^<><>^>v<^<^vv>><^v>^<>^^>^<><<>^<>><<>vvv^<<^^>>v<^>>vv>^v^^^v<>v<>><>^vv^>vv^ \ No newline at end of file From 6d318ff84d4149c1a48500a1cd7f3a1fa5f139cc Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 00:55:56 +0100 Subject: [PATCH 012/100] 2015: d03: ex2: add solution --- 2015/d03/ex2/ex2.py | 55 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100755 2015/d03/ex2/ex2.py diff --git a/2015/d03/ex2/ex2.py b/2015/d03/ex2/ex2.py new file mode 100755 index 0000000..b81e49e --- /dev/null +++ b/2015/d03/ex2/ex2.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python + +import enum +import sys +from typing import NamedTuple + + +class Point(NamedTuple): + x: int + y: int + + +class Direction(enum.StrEnum): + NORTH = "^" + EAST = ">" + SOUTH = "v" + WEST = "<" + + def apply(self, p: Point) -> Point: + match self: + case Direction.NORTH: + dx, dy = -1, 0 + case Direction.EAST: + dx, dy = 0, 1 + case Direction.SOUTH: + dx, dy = 1, 0 + case Direction.WEST: + dx, dy = 0, -1 + return Point(p.x + dx, p.y + dy) + + +def solve(input: str) -> int: + def parse(input: str) -> list[Direction]: + return [Direction(c) for c in input.strip()] + + def distribute_presents(moves: list[Direction]) -> set[Point]: + pos = Point(0, 0) + seen = {pos} + for move in moves: + pos = move.apply(pos) + seen.add(pos) + return seen + + moves = parse(input) + presents = distribute_presents(moves[::2]) | distribute_presents(moves[1::2]) + return len(presents) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 6dcb0c3c3bcaf882a8638df524dcd53a368435f0 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 00:59:09 +0100 Subject: [PATCH 013/100] 2015: d04: ex1: add input --- 2015/d04/ex1/input | 1 + 1 file changed, 1 insertion(+) create mode 100644 2015/d04/ex1/input diff --git a/2015/d04/ex1/input b/2015/d04/ex1/input new file mode 100644 index 0000000..d75e0dc --- /dev/null +++ b/2015/d04/ex1/input @@ -0,0 +1 @@ +yzbqklnj From b3642638385d3c9cbe579d980b630382b6aab13b Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 00:59:17 +0100 Subject: [PATCH 014/100] 2015: d04: ex1: add solution --- 2015/d04/ex1/ex1.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 2015/d04/ex1/ex1.py diff --git a/2015/d04/ex1/ex1.py b/2015/d04/ex1/ex1.py new file mode 100755 index 0000000..47e0280 --- /dev/null +++ b/2015/d04/ex1/ex1.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +import hashlib +import itertools +import sys + + +def solve(input: str) -> int: + key = input.strip() + for i in itertools.count(1): + hash = hashlib.md5((key + str(i)).encode()).hexdigest() + if hash.startswith("00000"): + return i + assert False # Sanity check + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 5eda64047ccaa3dd667a2d51402050aec4a83fec Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 00:59:22 +0100 Subject: [PATCH 015/100] 2015: d04: ex2: add input --- 2015/d04/ex2/input | 1 + 1 file changed, 1 insertion(+) create mode 100644 2015/d04/ex2/input diff --git a/2015/d04/ex2/input b/2015/d04/ex2/input new file mode 100644 index 0000000..d75e0dc --- /dev/null +++ b/2015/d04/ex2/input @@ -0,0 +1 @@ +yzbqklnj From b46027ca9e41acf2a0d8b41d45ad06886c1cf335 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 00:59:37 +0100 Subject: [PATCH 016/100] 2015: d04: ex2: add solution --- 2015/d04/ex2/ex2.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 2015/d04/ex2/ex2.py diff --git a/2015/d04/ex2/ex2.py b/2015/d04/ex2/ex2.py new file mode 100755 index 0000000..8ec99f7 --- /dev/null +++ b/2015/d04/ex2/ex2.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +import hashlib +import itertools +import sys + + +def solve(input: str) -> int: + key = input.strip() + for i in itertools.count(1): + hash = hashlib.md5((key + str(i)).encode()).hexdigest() + if hash.startswith("000000"): + return i + assert False # Sanity check + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From a1c3ca238158a5aad0ba6ea4079458c82e519e49 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 01:19:38 +0100 Subject: [PATCH 017/100] 2015: d05: ex1: add input --- 2015/d05/ex1/input | 1000 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1000 insertions(+) create mode 100644 2015/d05/ex1/input diff --git a/2015/d05/ex1/input b/2015/d05/ex1/input new file mode 100644 index 0000000..a9b6e77 --- /dev/null +++ b/2015/d05/ex1/input @@ -0,0 +1,1000 @@ +sszojmmrrkwuftyv +isaljhemltsdzlum +fujcyucsrxgatisb +qiqqlmcgnhzparyg +oijbmduquhfactbc +jqzuvtggpdqcekgk +zwqadogmpjmmxijf +uilzxjythsqhwndh +gtssqejjknzkkpvw +wrggegukhhatygfi +vhtcgqzerxonhsye +tedlwzdjfppbmtdx +iuvrelxiapllaxbg +feybgiimfthtplui +qxmmcnirvkzfrjwd +vfarmltinsriqxpu +oanqfyqirkraesfq +xilodxfuxphuiiii +yukhnchvjkfwcbiq +bdaibcbzeuxqplop +ivegnnpbiyxqsion +ybahkbzpditgwdgt +dmebdomwabxgtctu +ibtvimgfaeonknoh +jsqraroxudetmfyw +dqdbcwtpintfcvuz +tiyphjunlxddenpj +fgqwjgntxagidhah +nwenhxmakxqkeehg +zdoheaxqpcnlhnen +tfetfqojqcdzlpbm +qpnxkuldeiituggg +xwttlbdwxohahwar +hjkwzadmtrkegzye +koksqrqcfwcaxeof +wulwmrptktliyxeq +gyufbedqhhyqgqzj +txpunzodohikzlmj +jloqfuejfkemcrvu +amnflshcheuddqtc +pdvcsduggcogbiia +yrioavgfmeafjpcz +uyhbtmbutozzqfvq +mwhgfwsgyuwcdzik +auqylgxhmullxpaa +lgelzivplaeoivzh +uyvcepielfcmswoa +qhirixgwkkccuzlp +zoonniyosmkeejfg +iayfetpixkedyana +ictqeyzyqswdskiy +ejsgqteafvmorwxe +lhaiqrlqqwfbrqdx +ydjyboqwhfpqfydc +dwhttezyanrnbybv +edgzkqeqkyojowvr +rmjfdwsqamjqehdq +ozminkgnkwqctrxz +bztjhxpjthchhfcd +vrtioawyxkivrpiq +dpbcsznkpkaaclyy +vpoypksymdwttpvz +hhdlruwclartkyap +bqkrcbrksbzcggbo +jerbbbnxlwfvlaiw +dwkasufidwjrjfbf +kkfxtjhbnmqbmfwf +vmnfziwqxmioukmj +rqxvcultipkecdtu +fhmfdibhtjzkiqsd +hdpjbuzzbyafqrpd +emszboysjuvwwvts +msyigmwcuybfiooq +druyksfnbluvnwoh +fvgstvynnfbvxhsx +bmzalvducnqtuune +lzwkzfzttsvpllei +olmplpvjamynfyfd +padcwfkhystsvyfb +wjhbvxkwtbfqdilb +hruaqjwphonnterf +bufjobjtvxtzjpmj +oiedrjvmlbtwyyuy +sgiemafwfztwsyju +nsoqqfudrtwszyqf +vonbxquiiwxnazyl +yvnmjxtptujwqudn +rrnybqhvrcgwvrkq +taktoxzgotzxntfu +quffzywzpxyaepxa +rfvjebfiddcfgmwv +iaeozntougqwnzoh +scdqyrhoqmljhoil +bfmqticltmfhxwld +brbuktbyqlyfpsdl +oidnyhjkeqenjlhd +kujsaiqojopvrygg +vebzobmdbzvjnjtk +uunoygzqjopwgmbg +piljqxgicjzgifso +ikgptwcjzywswqnw +pujqsixoisvhdvwi +trtuxbgigogfsbbk +mplstsqclhhdyaqk +gzcwflvmstogdpvo +tfjywbkmimyyqcjd +gijutvhruqcsiznq +ibxkhjvzzxgavkha +btnxeqvznkxjsgmq +tjgofgauxaelmjoq +sokshvyhlkxerjrv +ltogbivktqmtezta +uduwytzvqvfluyuf +msuckpthtgzhdxan +fqmcglidvhvpirzr +gwztkqpcwnutvfga +bsjfgsrntdhlpqbx +xloczbqybxmiopwt +orvevzyjliomkkgu +mzjbhmfjjvaziget +tlsdxuhwdmghdyjb +atoecyjhwmznaewi +pyxpyvvipbqibiox +ajbfmpqqobfsmesj +siknbzefjblnohgd +eqfhgewbblwdfkmc +opylbscrotckkrbk +lbwxbofgjkzdxkle +ceixfjstaptdomvm +hnkrqxifjmmjktie +aqykzeuzvvetoygd +fouahjimfcisxima +prkzhutbqsyrhjzx +qqwliakathnsbzne +sayhgqtlcqqidqhj +ygduolbysehdudra +zricvxhdzznuxuce +ucvzakslykpgsixd +udirhgcttmyspgsb +yuwzppjzfsjhhdzi +gtqergjiuwookwre +xvxexbjyjkxovvwf +mlpaqhnnkqxrmwmm +ezuqbrjozwuqafhb +mcarusdthcbsonoq +weeguqeheeiigrue +pngtfugozxofaqxv +copphvbjcmfspenv +jiyahihykjjkdaya +gdqnmesvptuyrfwp +vbdscfywqmfxbohh +crtrfuxyjypzubrg +seihvevtxywxhflp +fvvpmgttnapklwou +qmqaqsajmqwhetpk +zetxvrgjmblxvakr +kpvwblrizaabmnhz +mwpvvzaaicntrkcp +clqyjiegtdsswqfm +ymrcnqgcpldgfwtm +nzyqpdenetncgnwq +cmkzevgacnmdkqro +kzfdsnamjqbeirhi +kpxrvgvvxapqlued +rzskbnfobevzrtqu +vjoahbfwtydugzap +ykbbldkoijlvicbl +mfdmroiztsgjlasb +quoigfyxwtwprmdr +ekxjqafwudgwfqjm +obtvyjkiycxfcdpb +lhoihfnbuqelthof +eydwzitgxryktddt +rxsihfybacnpoyny +bsncccxlplqgygtw +rvmlaudsifnzhcqh +huxwsyjyebckcsnn +gtuqzyihwhqvjtes +zreeyomtngvztveq +nwddzjingsarhkxb +nuqxqtctpoldrlsh +wkvnrwqgjooovhpf +kwgueyiyffudtbyg +tpkzapnjxefqnmew +ludwccvkihagvxal +lfdtzhfadvabghna +njqmlsnrkcfhtvbb +cajzbqleghhnlgap +vmitdcozzvqvzatp +eelzefwqwjiywbcz +uyztcuptfqvymjpi +aorhnrpkjqqtgnfo +lfrxfdrduoeqmwwp +vszpjvbctblplinh +zexhadgpqfifcqrz +ueirfnshekpemqua +qfremlntihbwabtb +nwznunammfexltjc +zkyieokaaogjehwt +vlrxgkpclzeslqkq +xrqrwfsuacywczhs +olghlnfjdiwgdbqc +difnlxnedpqcsrdf +dgpuhiisybjpidsj +vlwmwrikmitmoxbt +sazpcmcnviynoktm +pratafauetiknhln +ilgteekhzwlsfwcn +ywvwhrwhkaubvkbl +qlaxivzwxyhvrxcf +hbtlwjdriizqvjfb +nrmsononytuwslsa +mpxqgdthpoipyhjc +mcdiwmiqeidwcglk +vfbaeavmjjemfrmo +qzcbzmisnynzibrc +shzmpgxhehhcejhb +wirtjadsqzydtyxd +qjlrnjfokkqvnpue +dxawdvjntlbxtuqc +wttfmnrievfestog +eamjfvsjhvzzaobg +pbvfcwzjgxahlrag +omvmjkqqnobvnzkn +lcwmeibxhhlxnkzv +uiaeroqfbvlazegs +twniyldyuonfyzqw +wgjkmsbwgfotdabi +hnomamxoxvrzvtew +ycrcfavikkrxxfgw +isieyodknagzhaxy +mgzdqwikzullzyco +mumezgtxjrrejtrs +nwmwjcgrqiwgfqel +wjgxmebfmyjnxyyp +durpspyljdykvzxf +zuslbrpooyetgafh +kuzrhcjwbdouhyme +wyxuvbciodscbvfm +kbnpvuqwmxwfqtqe +zddzercqogdpxmft +sigrdchxtgavzzjh +lznjolnorbuddgcs +ycnqabxlcajagwbt +bnaudeaexahdgxsj +rlnykxvoctfwanms +jngyetkoplrstfzt +tdpxknwacksotdub +yutqgssfoptvizgr +lzmqnxeqjfnsxmsa +iqpgfsfmukovsdgu +qywreehbidowtjyz +iozamtgusdctvnkw +ielmujhtmynlwcfd +hzxnhtbnmmejlkyf +ftbslbzmiqkzebtd +bcwdqgiiizmohack +dqhfkzeddjzbdlxu +mxopokqffisxosci +vciatxhtuechbylk +khtkhcvelidjdena +blatarwzfqcapkdt +elamngegnczctcck +xeicefdbwrxhuxuf +sawvdhjoeahlgcdr +kmdcimzsfkdfpnir +axjayzqlosrduajb +mfhzreuzzumvoggr +iqlbkbhrkptquldb +xcvztvlshiefuhgb +pkvwyqmyoazocrio +ajsxkdnerbmhyxaj +tudibgsbnpnizvsi +cxuiydkgdccrqvkh +cyztpjesdzmbcpot +nnazphxpanegwitx +uphymczbmjalmsct +yyxiwnlrogyzwqmg +gmqwnahjvvdyhnfa +utolskxpuoheugyl +mseszdhyzoyavepd +ycqknvbuvcjfgmlc +sknrxhxbfpvpeorn +zqxqjetooqcodwml +sesylkpvbndrdhsy +fryuxvjnsvnjrxlw +mfxusewqurscujnu +mbitdjjtgzchvkfv +ozwlyxtaalxofovd +wdqcduaykxbunpie +rlnhykxiraileysk +wgoqfrygttlamobg +kflxzgxvcblkpsbz +tmkisflhativzhde +owsdrfgkaamogjzd +gaupjkvkzavhfnes +wknkurddcknbdleg +lltviwincmbtduap +qwzvspgbcksyzzmb +ydzzkumecryfjgnk +jzvmwgjutxoysaam +icrwpyhxllbardkr +jdopyntshmvltrve +afgkigxcuvmdbqou +mfzzudntmvuyhjzt +duxhgtwafcgrpihc +tsnhrkvponudumeb +sqtvnbeiigdzbjgv +eczmkqwvnsrracuo +mhehsgqwiczaiaxv +kaudmfvifovrimpd +lupikgivechdbwfr +mwaaysrndiutuiqx +aacuiiwgaannunmm +tjqjbftaqitukwzp +lrcqyskykbjpaekn +lirrvofbcqpjzxmr +jurorvzpplyelfml +qonbllojmloykjqe +sllkzqujfnbauuqp +auexjwsvphvikali +usuelbssqmbrkxyc +wyuokkfjexikptvv +wmfedauwjgbrgytl +sfwvtlzzebxzmuvw +rdhqxuechjsjcvaf +kpavhqkukugocsxu +ovnjtumxowbxduts +zgerpjufauptxgat +pevvnzjfwhjxdoxq +pmmfwxajgfziszcs +difmeqvaghuitjhs +icpwjbzcmlcterwm +ngqpvhajttxuegyh +mosjlqswdngwqsmi +frlvgpxrjolgodlu +eazwgrpcxjgoszeg +bbtsthgkjrpkiiyk +tjonoglufuvsvabe +xhkbcrofytmbzrtk +kqftfzdmpbxjynps +kmeqpocbnikdtfyv +qjjymgqxhnjwxxhp +dmgicrhgbngdtmjt +zdxrhdhbdutlawnc +afvoekuhdboxghvx +hiipezngkqcnihty +bbmqgheidenweeov +suprgwxgxwfsgjnx +adeagikyamgqphrj +zzifqinoeqaorjxg +adhgppljizpaxzld +lvxyieypvvuqjiyc +nljoakatwwwoovzn +fcrkfxclcacshhmx +ownnxqtdhqbgthch +lmfylrcdmdkgpwnj +hlwjfbvlswbzpbjr +mkofhdtljdetcyvp +synyxhifbetzarpo +agnggugngadrcxoc +uhttadmdmhidpyjw +ohfwjfhunalbubpr +pzkkkkwrlvxiuysn +kmidbxmyzkjrwjhu +egtitdydwjxmajnw +civoeoiuwtwgbqqs +dfptsguzfinqoslk +tdfvkreormspprer +zvnvbrmthatzztwi +ffkyddccrrfikjde +hrrmraevdnztiwff +qaeygykcpbtjwjbr +purwhitkmrtybslh +qzziznlswjaussel +dfcxkvdpqccdqqxj +tuotforulrrytgyn +gmtgfofgucjywkev +wkyoxudvdkbgpwhd +qbvktvfvipftztnn +otckgmojziezmojb +inxhvzbtgkjxflay +qvxapbiatuudseno +krpvqosbesnjntut +oqeukkgjsfuqkjbb +prcjnyymnqwqksiz +vuortvjxgckresko +orqlyobvkuwgathr +qnpyxlnazyfuijox +zwlblfkoklqmqzkw +hmwurwtpwnrcsanl +jzvxohuakopuzgpf +sfcpnxrviphhvxmx +qtwdeadudtqhbely +dbmkmloasqphnlgj +olylnjtkxgrubmtk +nxsdbqjuvwrrdbpq +wbabpirnpcsmpipw +hjnkyiuxpqrlvims +enzpntcjnxdpuqch +vvvqhlstzcizyimn +triozhqndbttglhv +fukvgteitwaagpzx +uhcvukfbmrvskpen +tizcyupztftzxdmt +vtkpnbpdzsaluczz +wodfoyhoekidxttm +otqocljrmwfqbxzu +linfbsnfvixlwykn +vxsluutrwskslnye +zbshygtwugixjvsi +zdcqwxvwytmzhvoo +wrseozkkcyctrmei +fblgtvogvkpqzxiy +opueqnuyngegbtnf +qxbovietpacqqxok +zacrdrrkohfygddn +gbnnvjqmkdupwzpq +qgrgmsxeotozvcak +hnppukzvzfmlokid +dzbheurndscrrtcl +wbgdkadtszebbrcw +fdmzppzphhpzyuiz +bukomunhrjrypohj +ohodhelegxootqbj +rsplgzarlrknqjyh +punjjwpsxnhpzgvu +djdfahypfjvpvibm +mlgrqsmhaozatsvy +xwktrgyuhqiquxgn +wvfaoolwtkbrisvf +plttjdmguxjwmeqr +zlvvbwvlhauyjykw +cigwkbyjhmepikej +masmylenrusgtyxs +hviqzufwyetyznze +nzqfuhrooswxxhus +pdbdetaqcrqzzwxf +oehmvziiqwkzhzib +icgpyrukiokmytoy +ooixfvwtiafnwkce +rvnmgqggpjopkihs +wywualssrmaqigqk +pdbvflnwfswsrirl +jeaezptokkccpbuj +mbdwjntysntsaaby +ldlgcawkzcwuxzpz +lwktbgrzswbsweht +ecspepmzarzmgpjm +qmfyvulkmkxjncai +izftypvwngiukrns +zgmnyjfeqffbooww +nyrkhggnprhedows +yykzzrjmlevgffah +mavaemfxhlfejfki +cmegmfjbkvpncqwf +zxidlodrezztcrij +fseasudpgvgnysjv +fupcimjupywzpqzp +iqhgokavirrcvyys +wjmkcareucnmfhui +nftflsqnkgjaexhq +mgklahzlcbapntgw +kfbmeavfxtppnrxn +nuhyvhknlufdynvn +nviogjxbluwrcoec +tyozixxxaqiuvoys +kgwlvmvgtsvxojpr +moeektyhyonfdhrb +kahvevmmfsmiiqex +xcywnqzcdqtvhiwd +fnievhiyltbvtvem +jlmndqufirwgtdxd +muypbfttoeelsnbs +rypxzbnujitfwkou +ubmmjbznskildeoj +ofnmizdeicrmkjxp +rekvectjbmdnfcib +yohrojuvdexbctdh +gwfnfdeibynzjmhz +jfznhfcqdwlpjull +scrinzycfhwkmmso +mskutzossrwoqqsi +rygoebkzgyzushhr +jpjqiycflqkexemx +arbufysjqmgaapnl +dbjerflevtgweeoj +snybnnjlmwjvhois +fszuzplntraprmbj +mkvaatolvuggikvg +zpuzuqygoxesnuyc +wnpxvmxvllxalulm +eivuuafkvudeouwy +rvzckdyixetfuehr +qgmnicdoqhveahyx +miawwngyymshjmpj +pvckyoncpqeqkbmx +llninfenrfjqxurv +kzbjnlgsqjfuzqtp +rveqcmxomvpjcwte +bzotkawzbopkosnx +ktqvpiribpypaymu +wvlzkivbukhnvram +uohntlcoguvjqqdo +ajlsiksjrcnzepkt +xsqatbldqcykwusd +ihbivgzrwpmowkop +vfayesfojmibkjpb +uaqbnijtrhvqxjtb +hhovshsfmvkvymba +jerwmyxrfeyvxcgg +hncafjwrlvdcupma +qyvigggxfylbbrzt +hiiixcyohmvnkpgk +mmitpwopgxuftdfu +iaxderqpceboixoa +zodfmjhuzhnsqfcb +sthtcbadrclrazsi +bkkkkcwegvypbrio +wmpcofuvzemunlhj +gqwebiifvqoeynro +juupusqdsvxcpsgv +rbhdfhthxelolyse +kjimpwnjfrqlqhhz +rcuigrjzarzpjgfq +htxcejfyzhydinks +sxucpdxhvqjxxjwf +omsznfcimbcwaxal +gufmtdlhgrsvcosb +bssshaqujtmluerz +uukotwjkstgwijtr +kbqkneobbrdogrxk +ljqopjcjmelgrakz +rwtfnvnzryujwkfb +dedjjbrndqnilbeh +nzinsxnpptzagwlb +lwqanydfirhnhkxy +hrjuzfumbvfccxno +okismsadkbseumnp +sfkmiaiwlktxqvwa +hauwpjjwowbunbjj +nowkofejwvutcnui +bqzzppwoslaeixro +urpfgufwbtzenkpj +xgeszvuqwxeykhef +yxoldvkyuikwqyeq +onbbhxrnmohzskgg +qcikuxakrqeugpoa +lnudcqbtyzhlpers +nxduvwfrgzaailgl +xniuwvxufzxjjrwz +ljwithcqmgvntjdj +awkftfagrfzywkhs +uedtpzxyubeveuek +bhcqdwidbjkqqhzl +iyneqjdmlhowwzxx +kvshzltcrrururty +zgfpiwajegwezupo +tkrvyanujjwmyyri +ercsefuihcmoaiep +ienjrxpmetinvbos +jnwfutjbgenlipzq +bgohjmrptfuamzbz +rtsyamajrhxbcncw +tfjdssnmztvbnscs +bgaychdlmchngqlp +kfjljiobynhwfkjo +owtdxzcpqleftbvn +ltjtimxwstvzwzjj +wbrvjjjajuombokf +zblpbpuaqbkvsxye +gwgdtbpnlhyqspdi +abipqjihjqfofmkx +nlqymnuvjpvvgova +avngotmhodpoufzn +qmdyivtzitnrjuae +xfwjmqtqdljuerxi +csuellnlcyqaaamq +slqyrcurcyuoxquo +dcjmxyzbzpohzprl +uqfnmjwniyqgsowb +rbmxpqoblyxdocqc +ebjclrdbqjhladem +ainnfhxnsgwqnmyo +eyytjjwhvodtzquf +iabjgmbbhilrcyyp +pqfnehkivuelyccc +xgjbyhfgmtseiimt +jwxyqhdbjiqqqeyy +gxsbrncqkmvaryln +vhjisxjkinaejytk +seexagcdmaedpcvh +lvudfgrcpjxzdpvd +fxtegyrqjzhmqean +dnoiseraqcoossmc +nwrhmwwbykvwmgep +udmzskejvizmtlce +hbzvqhvudfdlegaa +cghmlfqejbxewskv +bntcmjqfwomtbwsb +qezhowyopjdyhzng +todzsocdkgfxanbz +zgjkssrjlwxuhwbk +eibzljqsieriyrzr +wamxvzqyycrxotjp +epzvfkispwqynadu +dwlpfhtrafrxlyie +qhgzujhgdruowoug +girstvkahaemmxvh +baitcrqmxhazyhbl +xyanqcchbhkajdmc +gfvjmmcgfhvgnfdq +tdfdbslwncbnkzyz +jojuselkpmnnbcbb +hatdslkgxtqpmavj +dvelfeddvgjcyxkj +gnsofhkfepgwltse +mdngnobasfpewlno +qssnbcyjgmkyuoga +glvcmmjytmprqwvn +gwrixumjbcdffsdl +lozravlzvfqtsuiq +sicaflbqdxbmdlch +inwfjkyyqbwpmqlq +cuvszfotxywuzhzi +igfxyoaacoarlvay +ucjfhgdmnjvgvuni +rvvkzjsytqgiposh +jduinhjjntrmqroz +yparkxbgsfnueyll +lyeqqeisxzfsqzuj +woncskbibjnumydm +lltucklragtjmxtl +ubiyvmyhlesfxotj +uecjseeicldqrqww +xxlxkbcthufnjbnm +lhqijovvhlffpxga +fzdgqpzijitlogjz +efzzjqvwphomxdpd +jvgzvuyzobeazssc +hejfycgxywfjgbfw +yhjjmvkqfbnbliks +sffvfyywtlntsdsz +dwmxqudvxqdenrur +asnukgppdemxrzaz +nwqfnumblwvdpphx +kqsmkkspqvxzuket +cpnraovljzqiquaz +qrzgrdlyyzbyykhg +opoahcbiydyhsmqe +hjknnfdauidjeydr +hczdjjlygoezadow +rtflowzqycimllfv +sfsrgrerzlnychhq +bpahuvlblcolpjmj +albgnjkgmcrlaicl +pijyqdhfxpaxzdex +eeymiddvcwkpbpux +rqwkqoabywgggnln +vckbollyhgbgmgwh +ylzlgvnuvpynybkm +hpmbxtpfosbsjixt +ocebeihnhvkhjfqz +tvctyxoujdgwayze +efvhwxtuhapqxjen +rusksgefyidldmpo +nkmtjvddfmhirmzz +whvtsuadwofzmvrt +iiwjqvsdxudhdzzk +gucirgxaxgcassyo +rmhfasfzexeykwmr +hynlxcvsbgosjbis +huregszrcaocueen +pifezpoolrnbdqtv +unatnixzvdbqeyox +xtawlpduxgacchfe +bdvdbflqfphndduf +xtdsnjnmzccfptyt +nkhsdkhqtzqbphhg +aqcubmfkczlaxiyb +moziflxpsfubucmv +srdgnnjtfehiimqx +pwfalehdfyykrohf +sysxssmvewyfjrve +brsemdzosgqvvlxe +bimbjoshuvflkiat +hkgjasmljkpkwwku +sbnmwjvodygobpqc +bbbqycejueruihhd +corawswvlvneipyc +gcyhknmwsczcxedh +kppakbffdhntmcqp +ynulzwkfaemkcefp +pyroowjekeurlbii +iwksighrswdcnmxf +glokrdmugreygnsg +xkmvvumnfzckryop +aesviofpufygschi +csloawlirnegsssq +fkqdqqmlzuxbkzbc +uzlhzcfenxdfjdzp +poaaidrktteusvyf +zrlyfzmjzfvivcfr +qwjulskbniitgqtx +gjeszjksbfsuejki +vczdejdbfixbduaq +knjdrjthitjxluth +jweydeginrnicirl +bottrfgccqhyycsl +eiquffofoadmbuhk +lbqfutmzoksscswf +xfmdvnvfcnzjprba +uvugkjbkhlaoxmyx +wadlgtpczgvcaqqv +inzrszbtossflsxk +dbzbtashaartczrj +qbjiqpccefcfkvod +hluujmokjywotvzy +thwlliksfztcmwzh +arahybspdaqdexrq +nuojrmsgyipdvwyx +hnajdwjwmzattvst +sulcgaxezkprjbgu +rjowuugwdpkjtypw +oeugzwuhnrgiaqga +wvxnyymwftfoswij +pqxklzkjpcqscvde +tuymjzknntekglqj +odteewktugcwlhln +exsptotlfecmgehc +eeswfcijtvzgrqel +vjhrkiwmunuiwqau +zhlixepkeijoemne +pavfsmwesuvebzdd +jzovbklnngfdmyws +nbajyohtzfeoiixz +ciozmhrsjzrwxvhz +gwucrxieqbaqfjuv +uayrxrltnohexawc +flmrbhwsfbcquffm +gjyabmngkitawlxc +rwwtggvaygfbovhg +xquiegaisynictjq +oudzwuhexrwwdbyy +lengxmguyrwhrebb +uklxpglldbgqsjls +dbmvlfeyguydfsxq +zspdwdqcrmtmdtsc +mqfnzwbfqlauvrgc +amcrkzptgacywvhv +ndxmskrwrqysrndf +mwjyhsufeqhwisju +srlrukoaenyevykt +tnpjtpwawrxbikct +geczalxmgxejulcv +tvkcbqdhmuwcxqci +tiovluvwezwwgaox +zrjhtbgajkjqzmfo +vcrywduwsklepirs +lofequdigsszuioy +wxsdzomkjqymlzat +iabaczqtrfbmypuy +ibdlmudbajikcncr +rqcvkzsbwmavdwnv +ypxoyjelhllhbeog +fdnszbkezyjbttbg +uxnhrldastpdjkdz +xfrjbehtxnlyzcka +omjyfhbibqwgcpbv +eguucnoxaoprszmp +xfpypldgcmcllyzz +aypnmgqjxjqceelv +mgzharymejlafvgf +tzowgwsubbaigdok +ilsehjqpcjwmylxc +pfmouwntfhfnmrwk +csgokybgdqwnduwp +eaxwvxvvwbrovypz +nmluqvobbbmdiwwb +lnkminvfjjzqbmio +mjiiqzycqdhfietz +towlrzriicyraevq +obiloewdvbrsfwjo +lmeooaajlthsfltw +ichygipzpykkesrw +gfysloxmqdsfskvt +saqzntehjldvwtsx +pqddoemaufpfcaew +mjrxvbvwcreaybwe +ngfbrwfqnxqosoai +nesyewxreiqvhald +kqhqdlquywotcyfy +liliptyoqujensfi +nsahsaxvaepzneqq +zaickulfjajhctye +gxjzahtgbgbabtht +koxbuopaqhlsyhrp +jhzejdjidqqtjnwe +dekrkdvprfqpcqki +linwlombdqtdeyop +dvckqqbnigdcmwmx +yaxygbjpzkvnnebv +rlzkdkgaagmcpxah +cfzuyxivtknirqvt +obivkajhsjnrxxhn +lmjhayymgpseuynn +bbjyewkwadaipyju +lmzyhwomfypoftuu +gtzhqlgltvatxack +jfflcfaqqkrrltgq +txoummmnzfrlrmcg +ohemsbfuqqpucups +imsfvowcbieotlok +tcnsnccdszxfcyde +qkcdtkwuaquajazz +arcfnhmdjezdbqku +srnocgyqrlcvlhkb +mppbzvfmcdirbyfw +xiuarktilpldwgwd +ypufwmhrvzqmexpc +itpdnsfkwgrdujmj +cmpxnodtsswkyxkr +wayyxtjklfrmvbfp +mfaxphcnjczhbbwy +sjxhgwdnqcofbdra +pnxmujuylqccjvjm +ivamtjbvairwjqwl +deijtmzgpfxrclss +bzkqcaqagsynlaer +tycefobvxcvwaulz +ctbhnywezxkdsswf +urrxxebxrthtjvib +fpfelcigwqwdjucv +ngfcyyqpqulwcphb +rltkzsiipkpzlgpw +qfdsymzwhqqdkykc +balrhhxipoqzmihj +rnwalxgigswxomga +ghqnxeogckshphgr +lyyaentdizaumnla +exriodwfzosbeoib +speswfggibijfejk +yxmxgfhvmshqszrq +hcqhngvahzgawjga +qmhlsrfpesmeksur +eviafjejygakodla +kvcfeiqhynqadbzv +fusvyhowslfzqttg +girqmvwmcvntrwau +yuavizroykfkdekz +jmcwohvmzvowrhxf +kzimlcpavapynfue +wjudcdtrewfabppq +yqpteuxqgbmqfgxh +xdgiszbuhdognniu +jsguxfwhpftlcjoh +whakkvspssgjzxre +ggvnvjurlyhhijgm +krvbhjybnpemeptr +pqedgfojyjybfbzr +jzhcrsgmnkwwtpdo +yyscxoxwofslncmp +gzjhnxytmyntzths +iteigbnqbtpvqumi +zjevfzusnjukqpfw +xippcyhkfuounxqk +mcnhrcfonfdgpkyh +pinkcyuhjkexbmzj +lotxrswlxbxlxufs +fmqajrtoabpckbnu +wfkwsgmcffdgaqxg +qfrsiwnohoyfbidr +czfqbsbmiuyusaqs +ieknnjeecucghpoo +cevdgqnugupvmsge +gjkajcyjnxdrtuvr +udzhrargnujxiclq +zqqrhhmjwermjssg +ggdivtmgoqajydzz +wnpfsgtxowkjiivl +afbhqawjbotxnqpd +xjpkifkhfjeqifdn +oyfggzsstfhvticp +kercaetahymeawxy +khphblhcgmbupmzt +iggoqtqpvaebtiol +ofknifysuasshoya +qxuewroccsbogrbv +apsbnbkiopopytgu +zyahfroovfjlythh +bxhjwfgeuxlviydq +uvbhdtvaypasaswa +qamcjzrmesqgqdiz +hjnjyzrxntiycyel +wkcrwqwniczwdxgq +hibxlvkqakusswkx +mzjyuenepwdgrkty +tvywsoqslfsulses +jqwcwuuisrclircv +xanwaoebfrzhurct +ykriratovsvxxasf +qyebvtqqxbjuuwuo +telrvlwvriylnder +acksrrptgnhkeiaa +yemwfjhiqlzsvdxf +banrornfkcymmkcc +ytbhxvaeiigjpcgm +crepyazgxquposkn +xlqwdrytzwnxzwzv +xtrbfbwopxscftps +kwbytzukgseeyjla +qtfdvavvjogybxjg +ytbmvmrcxwfkgvzw +nbscbdskdeocnfzr +sqquwjbdxsxhcseg +ewqxhigqcgszfsuw +cvkyfcyfmubzwsee +dcoawetekigxgygd +ohgqnqhfimyuqhvi +otisopzzpvnhctte +bauieohjejamzien +ewnnopzkujbvhwce +aeyqlskpaehagdiv +pncudvivwnnqspxy +ytugesilgveokxcg +zoidxeelqdjesxpr +ducjccsuaygfchzj +smhgllqqqcjfubfc +nlbyyywergronmir +prdawpbjhrzsbsvj +nmgzhnjhlpcplmui +eflaogtjghdjmxxz +qolvpngucbkprrdc +ixywxcienveltgho +mwnpqtocagenkxut +iskrfbwxonkguywx +ouhtbvcaczqzmpua +srewprgddfgmdbao +dyufrltacelchlvu +czmzcbrkecixuwzz +dtbeojcztzauofuk +prrgoehpqhngfgmw +baolzvfrrevxsyke +zqadgxshwiarkzwh +vsackherluvurqqj +surbpxdulvcvgjbd +wqxytarcxzgxhvtx +vbcubqvejcfsgrac +zqnjfeapshjowzja +hekvbhtainkvbynx +knnugxoktxpvoxnh +knoaalcefpgtvlwm +qoakaunowmsuvkus +ypkvlzcduzlezqcb +ujhcagawtyepyogh +wsilcrxncnffaxjf +gbbycjuscquaycrk +aduojapeaqwivnly +ceafyxrakviagcjy +nntajnghicgnrlst +vdodpeherjmmvbje +wyyhrnegblwvdobn +xlfurpghkpbzhhif +xyppnjiljvirmqjo +kglzqahipnddanpi +omjateouxikwxowr +ocifnoopfglmndcx +emudcukfbadyijev +ooktviixetfddfmh +wtvrhloyjewdeycg +cgjncqykgutfjhvb +nkwvpswppeffmwad +hqbcmfhzkxmnrivg +mdskbvzguxvieilr +anjcvqpavhdloaqh +erksespdevjylenq +fadxwbmisazyegup +iyuiffjmcaahowhj +ygkdezmynmltodbv +fytneukxqkjattvh +woerxfadbfrvdcnz +iwsljvkyfastccoa +movylhjranlorofe +drdmicdaiwukemep +knfgtsmuhfcvvshg +ibstpbevqmdlhajn +tstwsswswrxlzrqs +estyydmzothggudf +jezogwvymvikszwa +izmqcwdyggibliet +nzpxbegurwnwrnca +kzkojelnvkwfublh +xqcssgozuxfqtiwi +tcdoigumjrgvczfv +ikcjyubjmylkwlwq +kqfivwystpqzvhan +bzukgvyoqewniivj +iduapzclhhyfladn +fbpyzxdfmkrtfaeg +yzsmlbnftftgwadz From 5134d471d9aafbfbadd74109047d6aab1dc486a1 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 01:19:44 +0100 Subject: [PATCH 018/100] 2015: d05: ex1: add solution --- 2015/d05/ex1/ex1.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 2015/d05/ex1/ex1.py diff --git a/2015/d05/ex1/ex1.py b/2015/d05/ex1/ex1.py new file mode 100755 index 0000000..48cf3f8 --- /dev/null +++ b/2015/d05/ex1/ex1.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python + +import collections +import sys + + +def solve(input: str) -> int: + def is_nice(input: str) -> bool: + counts = collections.Counter(input) + if sum(counts[c] for c in "aeiou") < 3: + return False + if not any((c + c) in input for c in (chr(ord("a") + i) for i in range(26))): + return False + for bad in ("ab", "cd", "pq", "xy"): + if bad in input: + return False + return True + + return sum(map(is_nice, input.splitlines())) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 0cc937849a2a86883ee63f00b504933c59d8c178 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 01:19:50 +0100 Subject: [PATCH 019/100] 2015: d05: ex2: add input --- 2015/d05/ex2/input | 1000 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1000 insertions(+) create mode 100644 2015/d05/ex2/input diff --git a/2015/d05/ex2/input b/2015/d05/ex2/input new file mode 100644 index 0000000..a9b6e77 --- /dev/null +++ b/2015/d05/ex2/input @@ -0,0 +1,1000 @@ +sszojmmrrkwuftyv +isaljhemltsdzlum +fujcyucsrxgatisb +qiqqlmcgnhzparyg +oijbmduquhfactbc +jqzuvtggpdqcekgk +zwqadogmpjmmxijf +uilzxjythsqhwndh +gtssqejjknzkkpvw +wrggegukhhatygfi +vhtcgqzerxonhsye +tedlwzdjfppbmtdx +iuvrelxiapllaxbg +feybgiimfthtplui +qxmmcnirvkzfrjwd +vfarmltinsriqxpu +oanqfyqirkraesfq +xilodxfuxphuiiii +yukhnchvjkfwcbiq +bdaibcbzeuxqplop +ivegnnpbiyxqsion +ybahkbzpditgwdgt +dmebdomwabxgtctu +ibtvimgfaeonknoh +jsqraroxudetmfyw +dqdbcwtpintfcvuz +tiyphjunlxddenpj +fgqwjgntxagidhah +nwenhxmakxqkeehg +zdoheaxqpcnlhnen +tfetfqojqcdzlpbm +qpnxkuldeiituggg +xwttlbdwxohahwar +hjkwzadmtrkegzye +koksqrqcfwcaxeof +wulwmrptktliyxeq +gyufbedqhhyqgqzj +txpunzodohikzlmj +jloqfuejfkemcrvu +amnflshcheuddqtc +pdvcsduggcogbiia +yrioavgfmeafjpcz +uyhbtmbutozzqfvq +mwhgfwsgyuwcdzik +auqylgxhmullxpaa +lgelzivplaeoivzh +uyvcepielfcmswoa +qhirixgwkkccuzlp +zoonniyosmkeejfg +iayfetpixkedyana +ictqeyzyqswdskiy +ejsgqteafvmorwxe +lhaiqrlqqwfbrqdx +ydjyboqwhfpqfydc +dwhttezyanrnbybv +edgzkqeqkyojowvr +rmjfdwsqamjqehdq +ozminkgnkwqctrxz +bztjhxpjthchhfcd +vrtioawyxkivrpiq +dpbcsznkpkaaclyy +vpoypksymdwttpvz +hhdlruwclartkyap +bqkrcbrksbzcggbo +jerbbbnxlwfvlaiw +dwkasufidwjrjfbf +kkfxtjhbnmqbmfwf +vmnfziwqxmioukmj +rqxvcultipkecdtu +fhmfdibhtjzkiqsd +hdpjbuzzbyafqrpd +emszboysjuvwwvts +msyigmwcuybfiooq +druyksfnbluvnwoh +fvgstvynnfbvxhsx +bmzalvducnqtuune +lzwkzfzttsvpllei +olmplpvjamynfyfd +padcwfkhystsvyfb +wjhbvxkwtbfqdilb +hruaqjwphonnterf +bufjobjtvxtzjpmj +oiedrjvmlbtwyyuy +sgiemafwfztwsyju +nsoqqfudrtwszyqf +vonbxquiiwxnazyl +yvnmjxtptujwqudn +rrnybqhvrcgwvrkq +taktoxzgotzxntfu +quffzywzpxyaepxa +rfvjebfiddcfgmwv +iaeozntougqwnzoh +scdqyrhoqmljhoil +bfmqticltmfhxwld +brbuktbyqlyfpsdl +oidnyhjkeqenjlhd +kujsaiqojopvrygg +vebzobmdbzvjnjtk +uunoygzqjopwgmbg +piljqxgicjzgifso +ikgptwcjzywswqnw +pujqsixoisvhdvwi +trtuxbgigogfsbbk +mplstsqclhhdyaqk +gzcwflvmstogdpvo +tfjywbkmimyyqcjd +gijutvhruqcsiznq +ibxkhjvzzxgavkha +btnxeqvznkxjsgmq +tjgofgauxaelmjoq +sokshvyhlkxerjrv +ltogbivktqmtezta +uduwytzvqvfluyuf +msuckpthtgzhdxan +fqmcglidvhvpirzr +gwztkqpcwnutvfga +bsjfgsrntdhlpqbx +xloczbqybxmiopwt +orvevzyjliomkkgu +mzjbhmfjjvaziget +tlsdxuhwdmghdyjb +atoecyjhwmznaewi +pyxpyvvipbqibiox +ajbfmpqqobfsmesj +siknbzefjblnohgd +eqfhgewbblwdfkmc +opylbscrotckkrbk +lbwxbofgjkzdxkle +ceixfjstaptdomvm +hnkrqxifjmmjktie +aqykzeuzvvetoygd +fouahjimfcisxima +prkzhutbqsyrhjzx +qqwliakathnsbzne +sayhgqtlcqqidqhj +ygduolbysehdudra +zricvxhdzznuxuce +ucvzakslykpgsixd +udirhgcttmyspgsb +yuwzppjzfsjhhdzi +gtqergjiuwookwre +xvxexbjyjkxovvwf +mlpaqhnnkqxrmwmm +ezuqbrjozwuqafhb +mcarusdthcbsonoq +weeguqeheeiigrue +pngtfugozxofaqxv +copphvbjcmfspenv +jiyahihykjjkdaya +gdqnmesvptuyrfwp +vbdscfywqmfxbohh +crtrfuxyjypzubrg +seihvevtxywxhflp +fvvpmgttnapklwou +qmqaqsajmqwhetpk +zetxvrgjmblxvakr +kpvwblrizaabmnhz +mwpvvzaaicntrkcp +clqyjiegtdsswqfm +ymrcnqgcpldgfwtm +nzyqpdenetncgnwq +cmkzevgacnmdkqro +kzfdsnamjqbeirhi +kpxrvgvvxapqlued +rzskbnfobevzrtqu +vjoahbfwtydugzap +ykbbldkoijlvicbl +mfdmroiztsgjlasb +quoigfyxwtwprmdr +ekxjqafwudgwfqjm +obtvyjkiycxfcdpb +lhoihfnbuqelthof +eydwzitgxryktddt +rxsihfybacnpoyny +bsncccxlplqgygtw +rvmlaudsifnzhcqh +huxwsyjyebckcsnn +gtuqzyihwhqvjtes +zreeyomtngvztveq +nwddzjingsarhkxb +nuqxqtctpoldrlsh +wkvnrwqgjooovhpf +kwgueyiyffudtbyg +tpkzapnjxefqnmew +ludwccvkihagvxal +lfdtzhfadvabghna +njqmlsnrkcfhtvbb +cajzbqleghhnlgap +vmitdcozzvqvzatp +eelzefwqwjiywbcz +uyztcuptfqvymjpi +aorhnrpkjqqtgnfo +lfrxfdrduoeqmwwp +vszpjvbctblplinh +zexhadgpqfifcqrz +ueirfnshekpemqua +qfremlntihbwabtb +nwznunammfexltjc +zkyieokaaogjehwt +vlrxgkpclzeslqkq +xrqrwfsuacywczhs +olghlnfjdiwgdbqc +difnlxnedpqcsrdf +dgpuhiisybjpidsj +vlwmwrikmitmoxbt +sazpcmcnviynoktm +pratafauetiknhln +ilgteekhzwlsfwcn +ywvwhrwhkaubvkbl +qlaxivzwxyhvrxcf +hbtlwjdriizqvjfb +nrmsononytuwslsa +mpxqgdthpoipyhjc +mcdiwmiqeidwcglk +vfbaeavmjjemfrmo +qzcbzmisnynzibrc +shzmpgxhehhcejhb +wirtjadsqzydtyxd +qjlrnjfokkqvnpue +dxawdvjntlbxtuqc +wttfmnrievfestog +eamjfvsjhvzzaobg +pbvfcwzjgxahlrag +omvmjkqqnobvnzkn +lcwmeibxhhlxnkzv +uiaeroqfbvlazegs +twniyldyuonfyzqw +wgjkmsbwgfotdabi +hnomamxoxvrzvtew +ycrcfavikkrxxfgw +isieyodknagzhaxy +mgzdqwikzullzyco +mumezgtxjrrejtrs +nwmwjcgrqiwgfqel +wjgxmebfmyjnxyyp +durpspyljdykvzxf +zuslbrpooyetgafh +kuzrhcjwbdouhyme +wyxuvbciodscbvfm +kbnpvuqwmxwfqtqe +zddzercqogdpxmft +sigrdchxtgavzzjh +lznjolnorbuddgcs +ycnqabxlcajagwbt +bnaudeaexahdgxsj +rlnykxvoctfwanms +jngyetkoplrstfzt +tdpxknwacksotdub +yutqgssfoptvizgr +lzmqnxeqjfnsxmsa +iqpgfsfmukovsdgu +qywreehbidowtjyz +iozamtgusdctvnkw +ielmujhtmynlwcfd +hzxnhtbnmmejlkyf +ftbslbzmiqkzebtd +bcwdqgiiizmohack +dqhfkzeddjzbdlxu +mxopokqffisxosci +vciatxhtuechbylk +khtkhcvelidjdena +blatarwzfqcapkdt +elamngegnczctcck +xeicefdbwrxhuxuf +sawvdhjoeahlgcdr +kmdcimzsfkdfpnir +axjayzqlosrduajb +mfhzreuzzumvoggr +iqlbkbhrkptquldb +xcvztvlshiefuhgb +pkvwyqmyoazocrio +ajsxkdnerbmhyxaj +tudibgsbnpnizvsi +cxuiydkgdccrqvkh +cyztpjesdzmbcpot +nnazphxpanegwitx +uphymczbmjalmsct +yyxiwnlrogyzwqmg +gmqwnahjvvdyhnfa +utolskxpuoheugyl +mseszdhyzoyavepd +ycqknvbuvcjfgmlc +sknrxhxbfpvpeorn +zqxqjetooqcodwml +sesylkpvbndrdhsy +fryuxvjnsvnjrxlw +mfxusewqurscujnu +mbitdjjtgzchvkfv +ozwlyxtaalxofovd +wdqcduaykxbunpie +rlnhykxiraileysk +wgoqfrygttlamobg +kflxzgxvcblkpsbz +tmkisflhativzhde +owsdrfgkaamogjzd +gaupjkvkzavhfnes +wknkurddcknbdleg +lltviwincmbtduap +qwzvspgbcksyzzmb +ydzzkumecryfjgnk +jzvmwgjutxoysaam +icrwpyhxllbardkr +jdopyntshmvltrve +afgkigxcuvmdbqou +mfzzudntmvuyhjzt +duxhgtwafcgrpihc +tsnhrkvponudumeb +sqtvnbeiigdzbjgv +eczmkqwvnsrracuo +mhehsgqwiczaiaxv +kaudmfvifovrimpd +lupikgivechdbwfr +mwaaysrndiutuiqx +aacuiiwgaannunmm +tjqjbftaqitukwzp +lrcqyskykbjpaekn +lirrvofbcqpjzxmr +jurorvzpplyelfml +qonbllojmloykjqe +sllkzqujfnbauuqp +auexjwsvphvikali +usuelbssqmbrkxyc +wyuokkfjexikptvv +wmfedauwjgbrgytl +sfwvtlzzebxzmuvw +rdhqxuechjsjcvaf +kpavhqkukugocsxu +ovnjtumxowbxduts +zgerpjufauptxgat +pevvnzjfwhjxdoxq +pmmfwxajgfziszcs +difmeqvaghuitjhs +icpwjbzcmlcterwm +ngqpvhajttxuegyh +mosjlqswdngwqsmi +frlvgpxrjolgodlu +eazwgrpcxjgoszeg +bbtsthgkjrpkiiyk +tjonoglufuvsvabe +xhkbcrofytmbzrtk +kqftfzdmpbxjynps +kmeqpocbnikdtfyv +qjjymgqxhnjwxxhp +dmgicrhgbngdtmjt +zdxrhdhbdutlawnc +afvoekuhdboxghvx +hiipezngkqcnihty +bbmqgheidenweeov +suprgwxgxwfsgjnx +adeagikyamgqphrj +zzifqinoeqaorjxg +adhgppljizpaxzld +lvxyieypvvuqjiyc +nljoakatwwwoovzn +fcrkfxclcacshhmx +ownnxqtdhqbgthch +lmfylrcdmdkgpwnj +hlwjfbvlswbzpbjr +mkofhdtljdetcyvp +synyxhifbetzarpo +agnggugngadrcxoc +uhttadmdmhidpyjw +ohfwjfhunalbubpr +pzkkkkwrlvxiuysn +kmidbxmyzkjrwjhu +egtitdydwjxmajnw +civoeoiuwtwgbqqs +dfptsguzfinqoslk +tdfvkreormspprer +zvnvbrmthatzztwi +ffkyddccrrfikjde +hrrmraevdnztiwff +qaeygykcpbtjwjbr +purwhitkmrtybslh +qzziznlswjaussel +dfcxkvdpqccdqqxj +tuotforulrrytgyn +gmtgfofgucjywkev +wkyoxudvdkbgpwhd +qbvktvfvipftztnn +otckgmojziezmojb +inxhvzbtgkjxflay +qvxapbiatuudseno +krpvqosbesnjntut +oqeukkgjsfuqkjbb +prcjnyymnqwqksiz +vuortvjxgckresko +orqlyobvkuwgathr +qnpyxlnazyfuijox +zwlblfkoklqmqzkw +hmwurwtpwnrcsanl +jzvxohuakopuzgpf +sfcpnxrviphhvxmx +qtwdeadudtqhbely +dbmkmloasqphnlgj +olylnjtkxgrubmtk +nxsdbqjuvwrrdbpq +wbabpirnpcsmpipw +hjnkyiuxpqrlvims +enzpntcjnxdpuqch +vvvqhlstzcizyimn +triozhqndbttglhv +fukvgteitwaagpzx +uhcvukfbmrvskpen +tizcyupztftzxdmt +vtkpnbpdzsaluczz +wodfoyhoekidxttm +otqocljrmwfqbxzu +linfbsnfvixlwykn +vxsluutrwskslnye +zbshygtwugixjvsi +zdcqwxvwytmzhvoo +wrseozkkcyctrmei +fblgtvogvkpqzxiy +opueqnuyngegbtnf +qxbovietpacqqxok +zacrdrrkohfygddn +gbnnvjqmkdupwzpq +qgrgmsxeotozvcak +hnppukzvzfmlokid +dzbheurndscrrtcl +wbgdkadtszebbrcw +fdmzppzphhpzyuiz +bukomunhrjrypohj +ohodhelegxootqbj +rsplgzarlrknqjyh +punjjwpsxnhpzgvu +djdfahypfjvpvibm +mlgrqsmhaozatsvy +xwktrgyuhqiquxgn +wvfaoolwtkbrisvf +plttjdmguxjwmeqr +zlvvbwvlhauyjykw +cigwkbyjhmepikej +masmylenrusgtyxs +hviqzufwyetyznze +nzqfuhrooswxxhus +pdbdetaqcrqzzwxf +oehmvziiqwkzhzib +icgpyrukiokmytoy +ooixfvwtiafnwkce +rvnmgqggpjopkihs +wywualssrmaqigqk +pdbvflnwfswsrirl +jeaezptokkccpbuj +mbdwjntysntsaaby +ldlgcawkzcwuxzpz +lwktbgrzswbsweht +ecspepmzarzmgpjm +qmfyvulkmkxjncai +izftypvwngiukrns +zgmnyjfeqffbooww +nyrkhggnprhedows +yykzzrjmlevgffah +mavaemfxhlfejfki +cmegmfjbkvpncqwf +zxidlodrezztcrij +fseasudpgvgnysjv +fupcimjupywzpqzp +iqhgokavirrcvyys +wjmkcareucnmfhui +nftflsqnkgjaexhq +mgklahzlcbapntgw +kfbmeavfxtppnrxn +nuhyvhknlufdynvn +nviogjxbluwrcoec +tyozixxxaqiuvoys +kgwlvmvgtsvxojpr +moeektyhyonfdhrb +kahvevmmfsmiiqex +xcywnqzcdqtvhiwd +fnievhiyltbvtvem +jlmndqufirwgtdxd +muypbfttoeelsnbs +rypxzbnujitfwkou +ubmmjbznskildeoj +ofnmizdeicrmkjxp +rekvectjbmdnfcib +yohrojuvdexbctdh +gwfnfdeibynzjmhz +jfznhfcqdwlpjull +scrinzycfhwkmmso +mskutzossrwoqqsi +rygoebkzgyzushhr +jpjqiycflqkexemx +arbufysjqmgaapnl +dbjerflevtgweeoj +snybnnjlmwjvhois +fszuzplntraprmbj +mkvaatolvuggikvg +zpuzuqygoxesnuyc +wnpxvmxvllxalulm +eivuuafkvudeouwy +rvzckdyixetfuehr +qgmnicdoqhveahyx +miawwngyymshjmpj +pvckyoncpqeqkbmx +llninfenrfjqxurv +kzbjnlgsqjfuzqtp +rveqcmxomvpjcwte +bzotkawzbopkosnx +ktqvpiribpypaymu +wvlzkivbukhnvram +uohntlcoguvjqqdo +ajlsiksjrcnzepkt +xsqatbldqcykwusd +ihbivgzrwpmowkop +vfayesfojmibkjpb +uaqbnijtrhvqxjtb +hhovshsfmvkvymba +jerwmyxrfeyvxcgg +hncafjwrlvdcupma +qyvigggxfylbbrzt +hiiixcyohmvnkpgk +mmitpwopgxuftdfu +iaxderqpceboixoa +zodfmjhuzhnsqfcb +sthtcbadrclrazsi +bkkkkcwegvypbrio +wmpcofuvzemunlhj +gqwebiifvqoeynro +juupusqdsvxcpsgv +rbhdfhthxelolyse +kjimpwnjfrqlqhhz +rcuigrjzarzpjgfq +htxcejfyzhydinks +sxucpdxhvqjxxjwf +omsznfcimbcwaxal +gufmtdlhgrsvcosb +bssshaqujtmluerz +uukotwjkstgwijtr +kbqkneobbrdogrxk +ljqopjcjmelgrakz +rwtfnvnzryujwkfb +dedjjbrndqnilbeh +nzinsxnpptzagwlb +lwqanydfirhnhkxy +hrjuzfumbvfccxno +okismsadkbseumnp +sfkmiaiwlktxqvwa +hauwpjjwowbunbjj +nowkofejwvutcnui +bqzzppwoslaeixro +urpfgufwbtzenkpj +xgeszvuqwxeykhef +yxoldvkyuikwqyeq +onbbhxrnmohzskgg +qcikuxakrqeugpoa +lnudcqbtyzhlpers +nxduvwfrgzaailgl +xniuwvxufzxjjrwz +ljwithcqmgvntjdj +awkftfagrfzywkhs +uedtpzxyubeveuek +bhcqdwidbjkqqhzl +iyneqjdmlhowwzxx +kvshzltcrrururty +zgfpiwajegwezupo +tkrvyanujjwmyyri +ercsefuihcmoaiep +ienjrxpmetinvbos +jnwfutjbgenlipzq +bgohjmrptfuamzbz +rtsyamajrhxbcncw +tfjdssnmztvbnscs +bgaychdlmchngqlp +kfjljiobynhwfkjo +owtdxzcpqleftbvn +ltjtimxwstvzwzjj +wbrvjjjajuombokf +zblpbpuaqbkvsxye +gwgdtbpnlhyqspdi +abipqjihjqfofmkx +nlqymnuvjpvvgova +avngotmhodpoufzn +qmdyivtzitnrjuae +xfwjmqtqdljuerxi +csuellnlcyqaaamq +slqyrcurcyuoxquo +dcjmxyzbzpohzprl +uqfnmjwniyqgsowb +rbmxpqoblyxdocqc +ebjclrdbqjhladem +ainnfhxnsgwqnmyo +eyytjjwhvodtzquf +iabjgmbbhilrcyyp +pqfnehkivuelyccc +xgjbyhfgmtseiimt +jwxyqhdbjiqqqeyy +gxsbrncqkmvaryln +vhjisxjkinaejytk +seexagcdmaedpcvh +lvudfgrcpjxzdpvd +fxtegyrqjzhmqean +dnoiseraqcoossmc +nwrhmwwbykvwmgep +udmzskejvizmtlce +hbzvqhvudfdlegaa +cghmlfqejbxewskv +bntcmjqfwomtbwsb +qezhowyopjdyhzng +todzsocdkgfxanbz +zgjkssrjlwxuhwbk +eibzljqsieriyrzr +wamxvzqyycrxotjp +epzvfkispwqynadu +dwlpfhtrafrxlyie +qhgzujhgdruowoug +girstvkahaemmxvh +baitcrqmxhazyhbl +xyanqcchbhkajdmc +gfvjmmcgfhvgnfdq +tdfdbslwncbnkzyz +jojuselkpmnnbcbb +hatdslkgxtqpmavj +dvelfeddvgjcyxkj +gnsofhkfepgwltse +mdngnobasfpewlno +qssnbcyjgmkyuoga +glvcmmjytmprqwvn +gwrixumjbcdffsdl +lozravlzvfqtsuiq +sicaflbqdxbmdlch +inwfjkyyqbwpmqlq +cuvszfotxywuzhzi +igfxyoaacoarlvay +ucjfhgdmnjvgvuni +rvvkzjsytqgiposh +jduinhjjntrmqroz +yparkxbgsfnueyll +lyeqqeisxzfsqzuj +woncskbibjnumydm +lltucklragtjmxtl +ubiyvmyhlesfxotj +uecjseeicldqrqww +xxlxkbcthufnjbnm +lhqijovvhlffpxga +fzdgqpzijitlogjz +efzzjqvwphomxdpd +jvgzvuyzobeazssc +hejfycgxywfjgbfw +yhjjmvkqfbnbliks +sffvfyywtlntsdsz +dwmxqudvxqdenrur +asnukgppdemxrzaz +nwqfnumblwvdpphx +kqsmkkspqvxzuket +cpnraovljzqiquaz +qrzgrdlyyzbyykhg +opoahcbiydyhsmqe +hjknnfdauidjeydr +hczdjjlygoezadow +rtflowzqycimllfv +sfsrgrerzlnychhq +bpahuvlblcolpjmj +albgnjkgmcrlaicl +pijyqdhfxpaxzdex +eeymiddvcwkpbpux +rqwkqoabywgggnln +vckbollyhgbgmgwh +ylzlgvnuvpynybkm +hpmbxtpfosbsjixt +ocebeihnhvkhjfqz +tvctyxoujdgwayze +efvhwxtuhapqxjen +rusksgefyidldmpo +nkmtjvddfmhirmzz +whvtsuadwofzmvrt +iiwjqvsdxudhdzzk +gucirgxaxgcassyo +rmhfasfzexeykwmr +hynlxcvsbgosjbis +huregszrcaocueen +pifezpoolrnbdqtv +unatnixzvdbqeyox +xtawlpduxgacchfe +bdvdbflqfphndduf +xtdsnjnmzccfptyt +nkhsdkhqtzqbphhg +aqcubmfkczlaxiyb +moziflxpsfubucmv +srdgnnjtfehiimqx +pwfalehdfyykrohf +sysxssmvewyfjrve +brsemdzosgqvvlxe +bimbjoshuvflkiat +hkgjasmljkpkwwku +sbnmwjvodygobpqc +bbbqycejueruihhd +corawswvlvneipyc +gcyhknmwsczcxedh +kppakbffdhntmcqp +ynulzwkfaemkcefp +pyroowjekeurlbii +iwksighrswdcnmxf +glokrdmugreygnsg +xkmvvumnfzckryop +aesviofpufygschi +csloawlirnegsssq +fkqdqqmlzuxbkzbc +uzlhzcfenxdfjdzp +poaaidrktteusvyf +zrlyfzmjzfvivcfr +qwjulskbniitgqtx +gjeszjksbfsuejki +vczdejdbfixbduaq +knjdrjthitjxluth +jweydeginrnicirl +bottrfgccqhyycsl +eiquffofoadmbuhk +lbqfutmzoksscswf +xfmdvnvfcnzjprba +uvugkjbkhlaoxmyx +wadlgtpczgvcaqqv +inzrszbtossflsxk +dbzbtashaartczrj +qbjiqpccefcfkvod +hluujmokjywotvzy +thwlliksfztcmwzh +arahybspdaqdexrq +nuojrmsgyipdvwyx +hnajdwjwmzattvst +sulcgaxezkprjbgu +rjowuugwdpkjtypw +oeugzwuhnrgiaqga +wvxnyymwftfoswij +pqxklzkjpcqscvde +tuymjzknntekglqj +odteewktugcwlhln +exsptotlfecmgehc +eeswfcijtvzgrqel +vjhrkiwmunuiwqau +zhlixepkeijoemne +pavfsmwesuvebzdd +jzovbklnngfdmyws +nbajyohtzfeoiixz +ciozmhrsjzrwxvhz +gwucrxieqbaqfjuv +uayrxrltnohexawc +flmrbhwsfbcquffm +gjyabmngkitawlxc +rwwtggvaygfbovhg +xquiegaisynictjq +oudzwuhexrwwdbyy +lengxmguyrwhrebb +uklxpglldbgqsjls +dbmvlfeyguydfsxq +zspdwdqcrmtmdtsc +mqfnzwbfqlauvrgc +amcrkzptgacywvhv +ndxmskrwrqysrndf +mwjyhsufeqhwisju +srlrukoaenyevykt +tnpjtpwawrxbikct +geczalxmgxejulcv +tvkcbqdhmuwcxqci +tiovluvwezwwgaox +zrjhtbgajkjqzmfo +vcrywduwsklepirs +lofequdigsszuioy +wxsdzomkjqymlzat +iabaczqtrfbmypuy +ibdlmudbajikcncr +rqcvkzsbwmavdwnv +ypxoyjelhllhbeog +fdnszbkezyjbttbg +uxnhrldastpdjkdz +xfrjbehtxnlyzcka +omjyfhbibqwgcpbv +eguucnoxaoprszmp +xfpypldgcmcllyzz +aypnmgqjxjqceelv +mgzharymejlafvgf +tzowgwsubbaigdok +ilsehjqpcjwmylxc +pfmouwntfhfnmrwk +csgokybgdqwnduwp +eaxwvxvvwbrovypz +nmluqvobbbmdiwwb +lnkminvfjjzqbmio +mjiiqzycqdhfietz +towlrzriicyraevq +obiloewdvbrsfwjo +lmeooaajlthsfltw +ichygipzpykkesrw +gfysloxmqdsfskvt +saqzntehjldvwtsx +pqddoemaufpfcaew +mjrxvbvwcreaybwe +ngfbrwfqnxqosoai +nesyewxreiqvhald +kqhqdlquywotcyfy +liliptyoqujensfi +nsahsaxvaepzneqq +zaickulfjajhctye +gxjzahtgbgbabtht +koxbuopaqhlsyhrp +jhzejdjidqqtjnwe +dekrkdvprfqpcqki +linwlombdqtdeyop +dvckqqbnigdcmwmx +yaxygbjpzkvnnebv +rlzkdkgaagmcpxah +cfzuyxivtknirqvt +obivkajhsjnrxxhn +lmjhayymgpseuynn +bbjyewkwadaipyju +lmzyhwomfypoftuu +gtzhqlgltvatxack +jfflcfaqqkrrltgq +txoummmnzfrlrmcg +ohemsbfuqqpucups +imsfvowcbieotlok +tcnsnccdszxfcyde +qkcdtkwuaquajazz +arcfnhmdjezdbqku +srnocgyqrlcvlhkb +mppbzvfmcdirbyfw +xiuarktilpldwgwd +ypufwmhrvzqmexpc +itpdnsfkwgrdujmj +cmpxnodtsswkyxkr +wayyxtjklfrmvbfp +mfaxphcnjczhbbwy +sjxhgwdnqcofbdra +pnxmujuylqccjvjm +ivamtjbvairwjqwl +deijtmzgpfxrclss +bzkqcaqagsynlaer +tycefobvxcvwaulz +ctbhnywezxkdsswf +urrxxebxrthtjvib +fpfelcigwqwdjucv +ngfcyyqpqulwcphb +rltkzsiipkpzlgpw +qfdsymzwhqqdkykc +balrhhxipoqzmihj +rnwalxgigswxomga +ghqnxeogckshphgr +lyyaentdizaumnla +exriodwfzosbeoib +speswfggibijfejk +yxmxgfhvmshqszrq +hcqhngvahzgawjga +qmhlsrfpesmeksur +eviafjejygakodla +kvcfeiqhynqadbzv +fusvyhowslfzqttg +girqmvwmcvntrwau +yuavizroykfkdekz +jmcwohvmzvowrhxf +kzimlcpavapynfue +wjudcdtrewfabppq +yqpteuxqgbmqfgxh +xdgiszbuhdognniu +jsguxfwhpftlcjoh +whakkvspssgjzxre +ggvnvjurlyhhijgm +krvbhjybnpemeptr +pqedgfojyjybfbzr +jzhcrsgmnkwwtpdo +yyscxoxwofslncmp +gzjhnxytmyntzths +iteigbnqbtpvqumi +zjevfzusnjukqpfw +xippcyhkfuounxqk +mcnhrcfonfdgpkyh +pinkcyuhjkexbmzj +lotxrswlxbxlxufs +fmqajrtoabpckbnu +wfkwsgmcffdgaqxg +qfrsiwnohoyfbidr +czfqbsbmiuyusaqs +ieknnjeecucghpoo +cevdgqnugupvmsge +gjkajcyjnxdrtuvr +udzhrargnujxiclq +zqqrhhmjwermjssg +ggdivtmgoqajydzz +wnpfsgtxowkjiivl +afbhqawjbotxnqpd +xjpkifkhfjeqifdn +oyfggzsstfhvticp +kercaetahymeawxy +khphblhcgmbupmzt +iggoqtqpvaebtiol +ofknifysuasshoya +qxuewroccsbogrbv +apsbnbkiopopytgu +zyahfroovfjlythh +bxhjwfgeuxlviydq +uvbhdtvaypasaswa +qamcjzrmesqgqdiz +hjnjyzrxntiycyel +wkcrwqwniczwdxgq +hibxlvkqakusswkx +mzjyuenepwdgrkty +tvywsoqslfsulses +jqwcwuuisrclircv +xanwaoebfrzhurct +ykriratovsvxxasf +qyebvtqqxbjuuwuo +telrvlwvriylnder +acksrrptgnhkeiaa +yemwfjhiqlzsvdxf +banrornfkcymmkcc +ytbhxvaeiigjpcgm +crepyazgxquposkn +xlqwdrytzwnxzwzv +xtrbfbwopxscftps +kwbytzukgseeyjla +qtfdvavvjogybxjg +ytbmvmrcxwfkgvzw +nbscbdskdeocnfzr +sqquwjbdxsxhcseg +ewqxhigqcgszfsuw +cvkyfcyfmubzwsee +dcoawetekigxgygd +ohgqnqhfimyuqhvi +otisopzzpvnhctte +bauieohjejamzien +ewnnopzkujbvhwce +aeyqlskpaehagdiv +pncudvivwnnqspxy +ytugesilgveokxcg +zoidxeelqdjesxpr +ducjccsuaygfchzj +smhgllqqqcjfubfc +nlbyyywergronmir +prdawpbjhrzsbsvj +nmgzhnjhlpcplmui +eflaogtjghdjmxxz +qolvpngucbkprrdc +ixywxcienveltgho +mwnpqtocagenkxut +iskrfbwxonkguywx +ouhtbvcaczqzmpua +srewprgddfgmdbao +dyufrltacelchlvu +czmzcbrkecixuwzz +dtbeojcztzauofuk +prrgoehpqhngfgmw +baolzvfrrevxsyke +zqadgxshwiarkzwh +vsackherluvurqqj +surbpxdulvcvgjbd +wqxytarcxzgxhvtx +vbcubqvejcfsgrac +zqnjfeapshjowzja +hekvbhtainkvbynx +knnugxoktxpvoxnh +knoaalcefpgtvlwm +qoakaunowmsuvkus +ypkvlzcduzlezqcb +ujhcagawtyepyogh +wsilcrxncnffaxjf +gbbycjuscquaycrk +aduojapeaqwivnly +ceafyxrakviagcjy +nntajnghicgnrlst +vdodpeherjmmvbje +wyyhrnegblwvdobn +xlfurpghkpbzhhif +xyppnjiljvirmqjo +kglzqahipnddanpi +omjateouxikwxowr +ocifnoopfglmndcx +emudcukfbadyijev +ooktviixetfddfmh +wtvrhloyjewdeycg +cgjncqykgutfjhvb +nkwvpswppeffmwad +hqbcmfhzkxmnrivg +mdskbvzguxvieilr +anjcvqpavhdloaqh +erksespdevjylenq +fadxwbmisazyegup +iyuiffjmcaahowhj +ygkdezmynmltodbv +fytneukxqkjattvh +woerxfadbfrvdcnz +iwsljvkyfastccoa +movylhjranlorofe +drdmicdaiwukemep +knfgtsmuhfcvvshg +ibstpbevqmdlhajn +tstwsswswrxlzrqs +estyydmzothggudf +jezogwvymvikszwa +izmqcwdyggibliet +nzpxbegurwnwrnca +kzkojelnvkwfublh +xqcssgozuxfqtiwi +tcdoigumjrgvczfv +ikcjyubjmylkwlwq +kqfivwystpqzvhan +bzukgvyoqewniivj +iduapzclhhyfladn +fbpyzxdfmkrtfaeg +yzsmlbnftftgwadz From e3ed06e2464d98e66d0ebcddef195494f3d978d4 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 01:19:55 +0100 Subject: [PATCH 020/100] 2015: d05: ex2: add solution --- 2015/d05/ex2/ex2.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 2015/d05/ex2/ex2.py diff --git a/2015/d05/ex2/ex2.py b/2015/d05/ex2/ex2.py new file mode 100755 index 0000000..8245c65 --- /dev/null +++ b/2015/d05/ex2/ex2.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python + +import collections +import itertools +import sys +from collections.abc import Iterable, Iterator +from typing import TypeVar + +T = TypeVar("T") + + +def sliding_window(iterable: Iterable[T], n: int) -> Iterator[tuple[T, ...]]: + iterator = iter(iterable) + window = collections.deque(itertools.islice(iterator, n - 1), maxlen=n) + for x in iterator: + window.append(x) + yield tuple(window) + + +def solve(input: str) -> int: + def is_nice(input: str) -> bool: + if not any( + ab in rest + for ab, rest in ( + (input[i : i + 2], input[i + 2 :]) for i in range(len(input) - 1) + ) + ): + return False + if not any(a == c for a, _, c in sliding_window(input, 3)): + return False + return True + + return sum(map(is_nice, input.splitlines())) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 7b51b229f31d60680ff9b5a179235366a09e0d79 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 01:43:57 +0100 Subject: [PATCH 021/100] 2015: d06: ex1: add input --- 2015/d06/ex1/input | 300 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 300 insertions(+) create mode 100644 2015/d06/ex1/input diff --git a/2015/d06/ex1/input b/2015/d06/ex1/input new file mode 100644 index 0000000..df10465 --- /dev/null +++ b/2015/d06/ex1/input @@ -0,0 +1,300 @@ +turn on 489,959 through 759,964 +turn off 820,516 through 871,914 +turn off 427,423 through 929,502 +turn on 774,14 through 977,877 +turn on 410,146 through 864,337 +turn on 931,331 through 939,812 +turn off 756,53 through 923,339 +turn off 313,787 through 545,979 +turn off 12,823 through 102,934 +toggle 756,965 through 812,992 +turn off 743,684 through 789,958 +toggle 120,314 through 745,489 +toggle 692,845 through 866,994 +turn off 587,176 through 850,273 +turn off 674,321 through 793,388 +toggle 749,672 through 973,965 +turn on 943,30 through 990,907 +turn on 296,50 through 729,664 +turn on 212,957 through 490,987 +toggle 171,31 through 688,88 +turn off 991,989 through 994,998 +turn off 913,943 through 958,953 +turn off 278,258 through 367,386 +toggle 275,796 through 493,971 +turn off 70,873 through 798,923 +toggle 258,985 through 663,998 +turn on 601,259 through 831,486 +turn off 914,94 through 941,102 +turn off 558,161 through 994,647 +turn on 119,662 through 760,838 +toggle 378,775 through 526,852 +turn off 384,670 through 674,972 +turn off 249,41 through 270,936 +turn on 614,742 through 769,780 +turn on 427,70 through 575,441 +turn on 410,478 through 985,753 +turn off 619,46 through 931,342 +turn on 284,55 through 768,922 +turn off 40,592 through 728,685 +turn on 825,291 through 956,950 +turn on 147,843 through 592,909 +turn off 218,675 through 972,911 +toggle 249,291 through 350,960 +turn off 556,80 through 967,675 +toggle 609,148 through 968,279 +toggle 217,605 through 961,862 +toggle 407,177 through 548,910 +toggle 400,936 through 599,938 +turn off 721,101 through 925,455 +turn on 268,631 through 735,814 +toggle 549,969 through 612,991 +toggle 553,268 through 689,432 +turn off 817,668 through 889,897 +toggle 801,544 through 858,556 +toggle 615,729 through 832,951 +turn off 427,477 through 958,948 +turn on 164,49 through 852,946 +turn on 542,449 through 774,776 +turn off 923,196 through 980,446 +toggle 90,310 through 718,846 +turn off 657,215 through 744,252 +turn off 800,239 through 811,712 +turn on 502,90 through 619,760 +toggle 649,512 through 862,844 +turn off 334,903 through 823,935 +turn off 630,233 through 839,445 +turn on 713,67 through 839,865 +turn on 932,50 through 982,411 +turn off 480,729 through 984,910 +turn on 100,219 through 796,395 +turn on 758,108 through 850,950 +turn off 427,276 through 439,938 +turn on 178,284 through 670,536 +toggle 540,27 through 625,102 +turn off 906,722 through 936,948 +toggle 345,418 through 859,627 +toggle 175,775 through 580,781 +toggle 863,28 through 929,735 +turn off 824,858 through 905,973 +toggle 752,312 through 863,425 +turn on 985,716 through 988,852 +turn off 68,504 through 763,745 +toggle 76,209 through 810,720 +turn off 657,607 through 676,664 +toggle 596,869 through 896,921 +turn off 915,411 through 968,945 +turn off 368,39 through 902,986 +turn on 11,549 through 393,597 +turn off 842,893 through 976,911 +toggle 274,106 through 581,329 +toggle 406,403 through 780,950 +toggle 408,988 through 500,994 +toggle 217,73 through 826,951 +turn on 917,872 through 961,911 +toggle 394,34 through 510,572 +toggle 424,603 through 583,626 +toggle 106,159 through 755,738 +turn off 244,610 through 472,709 +turn on 350,265 through 884,690 +turn on 688,184 through 928,280 +toggle 279,443 through 720,797 +turn off 615,493 through 888,610 +toggle 118,413 through 736,632 +turn on 798,782 through 829,813 +turn off 250,934 through 442,972 +turn on 68,503 through 400,949 +toggle 297,482 through 313,871 +toggle 710,3 through 839,859 +turn on 125,300 through 546,888 +toggle 482,39 through 584,159 +turn off 536,89 through 765,962 +turn on 530,518 through 843,676 +turn on 994,467 through 994,676 +turn on 623,628 through 744,927 +toggle 704,912 through 837,983 +turn on 154,364 through 517,412 +toggle 344,409 through 780,524 +turn off 578,740 through 725,879 +turn on 251,933 through 632,957 +turn on 827,705 through 971,789 +toggle 191,282 through 470,929 +toggle 324,525 through 446,867 +toggle 534,343 through 874,971 +toggle 550,650 through 633,980 +toggle 837,404 through 881,915 +toggle 338,881 through 845,905 +turn on 469,462 through 750,696 +turn on 741,703 through 892,870 +turn off 570,215 through 733,562 +turn on 445,576 through 870,775 +turn on 466,747 through 554,878 +turn off 820,453 through 868,712 +turn off 892,706 through 938,792 +turn off 300,238 through 894,746 +turn off 306,44 through 457,444 +turn off 912,569 through 967,963 +toggle 109,756 through 297,867 +turn on 37,546 through 41,951 +turn on 321,637 through 790,910 +toggle 66,50 through 579,301 +toggle 933,221 through 933,791 +turn on 486,676 through 878,797 +turn on 417,231 through 556,317 +toggle 904,468 through 981,873 +turn on 417,675 through 749,712 +turn on 692,371 through 821,842 +toggle 324,73 through 830,543 +turn on 912,490 through 977,757 +turn off 634,872 through 902,949 +toggle 266,779 through 870,798 +turn on 772,982 through 990,996 +turn off 607,46 through 798,559 +turn on 295,602 through 963,987 +turn on 657,86 through 944,742 +turn off 334,639 through 456,821 +turn off 997,667 through 997,670 +turn off 725,832 through 951,945 +turn off 30,120 through 952,984 +turn on 860,965 through 917,976 +toggle 471,997 through 840,998 +turn off 319,307 through 928,504 +toggle 823,631 through 940,908 +toggle 969,984 through 981,993 +turn off 691,319 through 865,954 +toggle 911,926 through 938,929 +turn on 953,937 through 968,991 +toggle 914,643 through 975,840 +turn on 266,982 through 436,996 +turn off 101,896 through 321,932 +turn off 193,852 through 751,885 +turn off 576,532 through 863,684 +turn on 761,456 through 940,783 +turn on 20,290 through 398,933 +turn off 435,335 through 644,652 +turn on 830,569 through 905,770 +turn off 630,517 through 905,654 +turn on 664,53 through 886,976 +toggle 275,416 through 408,719 +turn on 370,621 through 515,793 +turn on 483,373 through 654,749 +turn on 656,786 through 847,928 +turn off 532,752 through 945,974 +toggle 301,150 through 880,792 +turn off 951,488 through 958,952 +turn on 207,729 through 882,828 +toggle 694,532 through 973,961 +toggle 676,639 through 891,802 +turn off 653,6 through 905,519 +toggle 391,109 through 418,312 +turn on 877,423 through 957,932 +turn on 340,145 through 563,522 +turn off 978,467 through 988,895 +turn off 396,418 through 420,885 +turn off 31,308 through 816,316 +turn on 107,675 through 758,824 +turn on 61,82 through 789,876 +turn on 750,743 through 754,760 +toggle 88,733 through 736,968 +turn off 754,349 through 849,897 +toggle 157,50 through 975,781 +turn off 230,231 through 865,842 +turn off 516,317 through 630,329 +turn off 697,820 through 829,903 +turn on 218,250 through 271,732 +toggle 56,167 through 404,431 +toggle 626,891 through 680,927 +toggle 370,207 through 791,514 +toggle 860,74 through 949,888 +turn on 416,527 through 616,541 +turn off 745,449 through 786,908 +turn on 485,554 through 689,689 +turn on 586,62 through 693,141 +toggle 506,759 through 768,829 +turn on 473,109 through 929,166 +turn on 760,617 through 773,789 +toggle 595,683 through 618,789 +turn off 210,775 through 825,972 +toggle 12,426 through 179,982 +turn on 774,539 through 778,786 +turn on 102,498 through 121,807 +turn off 706,897 through 834,965 +turn off 678,529 through 824,627 +turn on 7,765 through 615,870 +turn off 730,872 through 974,943 +turn off 595,626 through 836,711 +turn off 215,424 through 841,959 +toggle 341,780 through 861,813 +toggle 507,503 through 568,822 +turn on 252,603 through 349,655 +toggle 93,521 through 154,834 +turn on 565,682 through 951,954 +turn on 544,318 through 703,418 +toggle 756,953 through 891,964 +turn on 531,123 through 856,991 +turn on 148,315 through 776,559 +turn off 925,835 through 963,971 +turn on 895,944 through 967,964 +turn off 102,527 through 650,747 +toggle 626,105 through 738,720 +turn off 160,75 through 384,922 +toggle 813,724 through 903,941 +turn on 207,107 through 982,849 +toggle 750,505 through 961,697 +toggle 105,410 through 885,819 +turn on 226,104 through 298,283 +turn off 224,604 through 508,762 +turn on 477,368 through 523,506 +turn off 477,901 through 627,936 +turn off 887,131 through 889,670 +turn on 896,994 through 938,999 +toggle 401,580 through 493,728 +toggle 987,184 through 991,205 +turn on 821,643 through 882,674 +toggle 784,940 through 968,959 +turn off 251,293 through 274,632 +turn off 339,840 through 341,844 +turn off 675,351 through 675,836 +toggle 918,857 through 944,886 +toggle 70,253 through 918,736 +turn off 612,604 through 772,680 +turn off 277,40 through 828,348 +toggle 692,139 through 698,880 +toggle 124,446 through 883,453 +toggle 969,932 through 990,945 +toggle 855,692 through 993,693 +toggle 722,472 through 887,899 +toggle 978,149 through 985,442 +toggle 837,540 through 916,889 +turn off 612,2 through 835,82 +toggle 560,767 through 878,856 +turn on 461,734 through 524,991 +toggle 206,824 through 976,912 +turn on 826,610 through 879,892 +turn on 577,699 through 956,933 +turn off 9,250 through 50,529 +turn off 77,657 through 817,677 +turn on 68,419 through 86,426 +turn on 991,720 through 992,784 +turn on 668,20 through 935,470 +turn off 133,418 through 613,458 +turn off 487,286 through 540,328 +toggle 247,874 through 840,955 +toggle 301,808 through 754,970 +turn off 34,194 through 578,203 +turn off 451,49 through 492,921 +turn on 907,256 through 912,737 +turn off 479,305 through 702,587 +turn on 545,583 through 732,749 +toggle 11,16 through 725,868 +turn on 965,343 through 986,908 +turn on 674,953 through 820,965 +toggle 398,147 through 504,583 +turn off 778,194 through 898,298 +turn on 179,140 through 350,852 +turn off 241,118 through 530,832 +turn off 41,447 through 932,737 +turn off 820,663 through 832,982 +turn on 550,460 through 964,782 +turn on 31,760 through 655,892 +toggle 628,958 through 811,992 From 6808196ffe8689657258018f15655adf0dfbf570 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 01:44:02 +0100 Subject: [PATCH 022/100] 2015: d06: ex1: add solution --- 2015/d06/ex1/ex1.py | 70 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100755 2015/d06/ex1/ex1.py diff --git a/2015/d06/ex1/ex1.py b/2015/d06/ex1/ex1.py new file mode 100755 index 0000000..c39cb14 --- /dev/null +++ b/2015/d06/ex1/ex1.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python + +import enum +import itertools +import sys +from typing import NamedTuple + + +class Point(NamedTuple): + x: int + y: int + + +class Op(enum.StrEnum): + TURN_ON = "on" + TOGGLE = "toggle" + TURN_OFF = "off" + + +class Instruction(NamedTuple): + op: Op + a: Point + b: Point + + @classmethod + def from_str(cls, input: str) -> "Instruction": + split_input = input.split() + raw_a, raw_b = split_input[-3], split_input[-1] + op = Op(split_input[1]) if split_input[0] == "turn" else Op(split_input[0]) + return Instruction( + op, + Point(*map(int, raw_a.split(","))), + Point(*map(int, raw_b.split(","))), + ) + + def apply(self, screen: set[Point]) -> set[Point]: + points = { + Point(x, y) + for x, y in itertools.product( + range(self.a.x, self.b.x + 1), + range(self.a.y, self.b.y + 1), + ) + } + match self.op: + case Op.TURN_ON: + return screen | points + case Op.TOGGLE: + return screen ^ points + case Op.TURN_OFF: + return screen - points + + +def solve(input: str) -> int: + def parse(input: str) -> list[Instruction]: + return [Instruction.from_str(line) for line in input.splitlines()] + + instructions = parse(input) + screen: set[Point] = set() + for instr in instructions: + screen = instr.apply(screen) + return len(screen) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From a3feed2595fe8e5265b231a189b6fbfbd639e9a8 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 01:44:08 +0100 Subject: [PATCH 023/100] 2015: d06: ex2: add input --- 2015/d06/ex2/input | 300 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 300 insertions(+) create mode 100644 2015/d06/ex2/input diff --git a/2015/d06/ex2/input b/2015/d06/ex2/input new file mode 100644 index 0000000..df10465 --- /dev/null +++ b/2015/d06/ex2/input @@ -0,0 +1,300 @@ +turn on 489,959 through 759,964 +turn off 820,516 through 871,914 +turn off 427,423 through 929,502 +turn on 774,14 through 977,877 +turn on 410,146 through 864,337 +turn on 931,331 through 939,812 +turn off 756,53 through 923,339 +turn off 313,787 through 545,979 +turn off 12,823 through 102,934 +toggle 756,965 through 812,992 +turn off 743,684 through 789,958 +toggle 120,314 through 745,489 +toggle 692,845 through 866,994 +turn off 587,176 through 850,273 +turn off 674,321 through 793,388 +toggle 749,672 through 973,965 +turn on 943,30 through 990,907 +turn on 296,50 through 729,664 +turn on 212,957 through 490,987 +toggle 171,31 through 688,88 +turn off 991,989 through 994,998 +turn off 913,943 through 958,953 +turn off 278,258 through 367,386 +toggle 275,796 through 493,971 +turn off 70,873 through 798,923 +toggle 258,985 through 663,998 +turn on 601,259 through 831,486 +turn off 914,94 through 941,102 +turn off 558,161 through 994,647 +turn on 119,662 through 760,838 +toggle 378,775 through 526,852 +turn off 384,670 through 674,972 +turn off 249,41 through 270,936 +turn on 614,742 through 769,780 +turn on 427,70 through 575,441 +turn on 410,478 through 985,753 +turn off 619,46 through 931,342 +turn on 284,55 through 768,922 +turn off 40,592 through 728,685 +turn on 825,291 through 956,950 +turn on 147,843 through 592,909 +turn off 218,675 through 972,911 +toggle 249,291 through 350,960 +turn off 556,80 through 967,675 +toggle 609,148 through 968,279 +toggle 217,605 through 961,862 +toggle 407,177 through 548,910 +toggle 400,936 through 599,938 +turn off 721,101 through 925,455 +turn on 268,631 through 735,814 +toggle 549,969 through 612,991 +toggle 553,268 through 689,432 +turn off 817,668 through 889,897 +toggle 801,544 through 858,556 +toggle 615,729 through 832,951 +turn off 427,477 through 958,948 +turn on 164,49 through 852,946 +turn on 542,449 through 774,776 +turn off 923,196 through 980,446 +toggle 90,310 through 718,846 +turn off 657,215 through 744,252 +turn off 800,239 through 811,712 +turn on 502,90 through 619,760 +toggle 649,512 through 862,844 +turn off 334,903 through 823,935 +turn off 630,233 through 839,445 +turn on 713,67 through 839,865 +turn on 932,50 through 982,411 +turn off 480,729 through 984,910 +turn on 100,219 through 796,395 +turn on 758,108 through 850,950 +turn off 427,276 through 439,938 +turn on 178,284 through 670,536 +toggle 540,27 through 625,102 +turn off 906,722 through 936,948 +toggle 345,418 through 859,627 +toggle 175,775 through 580,781 +toggle 863,28 through 929,735 +turn off 824,858 through 905,973 +toggle 752,312 through 863,425 +turn on 985,716 through 988,852 +turn off 68,504 through 763,745 +toggle 76,209 through 810,720 +turn off 657,607 through 676,664 +toggle 596,869 through 896,921 +turn off 915,411 through 968,945 +turn off 368,39 through 902,986 +turn on 11,549 through 393,597 +turn off 842,893 through 976,911 +toggle 274,106 through 581,329 +toggle 406,403 through 780,950 +toggle 408,988 through 500,994 +toggle 217,73 through 826,951 +turn on 917,872 through 961,911 +toggle 394,34 through 510,572 +toggle 424,603 through 583,626 +toggle 106,159 through 755,738 +turn off 244,610 through 472,709 +turn on 350,265 through 884,690 +turn on 688,184 through 928,280 +toggle 279,443 through 720,797 +turn off 615,493 through 888,610 +toggle 118,413 through 736,632 +turn on 798,782 through 829,813 +turn off 250,934 through 442,972 +turn on 68,503 through 400,949 +toggle 297,482 through 313,871 +toggle 710,3 through 839,859 +turn on 125,300 through 546,888 +toggle 482,39 through 584,159 +turn off 536,89 through 765,962 +turn on 530,518 through 843,676 +turn on 994,467 through 994,676 +turn on 623,628 through 744,927 +toggle 704,912 through 837,983 +turn on 154,364 through 517,412 +toggle 344,409 through 780,524 +turn off 578,740 through 725,879 +turn on 251,933 through 632,957 +turn on 827,705 through 971,789 +toggle 191,282 through 470,929 +toggle 324,525 through 446,867 +toggle 534,343 through 874,971 +toggle 550,650 through 633,980 +toggle 837,404 through 881,915 +toggle 338,881 through 845,905 +turn on 469,462 through 750,696 +turn on 741,703 through 892,870 +turn off 570,215 through 733,562 +turn on 445,576 through 870,775 +turn on 466,747 through 554,878 +turn off 820,453 through 868,712 +turn off 892,706 through 938,792 +turn off 300,238 through 894,746 +turn off 306,44 through 457,444 +turn off 912,569 through 967,963 +toggle 109,756 through 297,867 +turn on 37,546 through 41,951 +turn on 321,637 through 790,910 +toggle 66,50 through 579,301 +toggle 933,221 through 933,791 +turn on 486,676 through 878,797 +turn on 417,231 through 556,317 +toggle 904,468 through 981,873 +turn on 417,675 through 749,712 +turn on 692,371 through 821,842 +toggle 324,73 through 830,543 +turn on 912,490 through 977,757 +turn off 634,872 through 902,949 +toggle 266,779 through 870,798 +turn on 772,982 through 990,996 +turn off 607,46 through 798,559 +turn on 295,602 through 963,987 +turn on 657,86 through 944,742 +turn off 334,639 through 456,821 +turn off 997,667 through 997,670 +turn off 725,832 through 951,945 +turn off 30,120 through 952,984 +turn on 860,965 through 917,976 +toggle 471,997 through 840,998 +turn off 319,307 through 928,504 +toggle 823,631 through 940,908 +toggle 969,984 through 981,993 +turn off 691,319 through 865,954 +toggle 911,926 through 938,929 +turn on 953,937 through 968,991 +toggle 914,643 through 975,840 +turn on 266,982 through 436,996 +turn off 101,896 through 321,932 +turn off 193,852 through 751,885 +turn off 576,532 through 863,684 +turn on 761,456 through 940,783 +turn on 20,290 through 398,933 +turn off 435,335 through 644,652 +turn on 830,569 through 905,770 +turn off 630,517 through 905,654 +turn on 664,53 through 886,976 +toggle 275,416 through 408,719 +turn on 370,621 through 515,793 +turn on 483,373 through 654,749 +turn on 656,786 through 847,928 +turn off 532,752 through 945,974 +toggle 301,150 through 880,792 +turn off 951,488 through 958,952 +turn on 207,729 through 882,828 +toggle 694,532 through 973,961 +toggle 676,639 through 891,802 +turn off 653,6 through 905,519 +toggle 391,109 through 418,312 +turn on 877,423 through 957,932 +turn on 340,145 through 563,522 +turn off 978,467 through 988,895 +turn off 396,418 through 420,885 +turn off 31,308 through 816,316 +turn on 107,675 through 758,824 +turn on 61,82 through 789,876 +turn on 750,743 through 754,760 +toggle 88,733 through 736,968 +turn off 754,349 through 849,897 +toggle 157,50 through 975,781 +turn off 230,231 through 865,842 +turn off 516,317 through 630,329 +turn off 697,820 through 829,903 +turn on 218,250 through 271,732 +toggle 56,167 through 404,431 +toggle 626,891 through 680,927 +toggle 370,207 through 791,514 +toggle 860,74 through 949,888 +turn on 416,527 through 616,541 +turn off 745,449 through 786,908 +turn on 485,554 through 689,689 +turn on 586,62 through 693,141 +toggle 506,759 through 768,829 +turn on 473,109 through 929,166 +turn on 760,617 through 773,789 +toggle 595,683 through 618,789 +turn off 210,775 through 825,972 +toggle 12,426 through 179,982 +turn on 774,539 through 778,786 +turn on 102,498 through 121,807 +turn off 706,897 through 834,965 +turn off 678,529 through 824,627 +turn on 7,765 through 615,870 +turn off 730,872 through 974,943 +turn off 595,626 through 836,711 +turn off 215,424 through 841,959 +toggle 341,780 through 861,813 +toggle 507,503 through 568,822 +turn on 252,603 through 349,655 +toggle 93,521 through 154,834 +turn on 565,682 through 951,954 +turn on 544,318 through 703,418 +toggle 756,953 through 891,964 +turn on 531,123 through 856,991 +turn on 148,315 through 776,559 +turn off 925,835 through 963,971 +turn on 895,944 through 967,964 +turn off 102,527 through 650,747 +toggle 626,105 through 738,720 +turn off 160,75 through 384,922 +toggle 813,724 through 903,941 +turn on 207,107 through 982,849 +toggle 750,505 through 961,697 +toggle 105,410 through 885,819 +turn on 226,104 through 298,283 +turn off 224,604 through 508,762 +turn on 477,368 through 523,506 +turn off 477,901 through 627,936 +turn off 887,131 through 889,670 +turn on 896,994 through 938,999 +toggle 401,580 through 493,728 +toggle 987,184 through 991,205 +turn on 821,643 through 882,674 +toggle 784,940 through 968,959 +turn off 251,293 through 274,632 +turn off 339,840 through 341,844 +turn off 675,351 through 675,836 +toggle 918,857 through 944,886 +toggle 70,253 through 918,736 +turn off 612,604 through 772,680 +turn off 277,40 through 828,348 +toggle 692,139 through 698,880 +toggle 124,446 through 883,453 +toggle 969,932 through 990,945 +toggle 855,692 through 993,693 +toggle 722,472 through 887,899 +toggle 978,149 through 985,442 +toggle 837,540 through 916,889 +turn off 612,2 through 835,82 +toggle 560,767 through 878,856 +turn on 461,734 through 524,991 +toggle 206,824 through 976,912 +turn on 826,610 through 879,892 +turn on 577,699 through 956,933 +turn off 9,250 through 50,529 +turn off 77,657 through 817,677 +turn on 68,419 through 86,426 +turn on 991,720 through 992,784 +turn on 668,20 through 935,470 +turn off 133,418 through 613,458 +turn off 487,286 through 540,328 +toggle 247,874 through 840,955 +toggle 301,808 through 754,970 +turn off 34,194 through 578,203 +turn off 451,49 through 492,921 +turn on 907,256 through 912,737 +turn off 479,305 through 702,587 +turn on 545,583 through 732,749 +toggle 11,16 through 725,868 +turn on 965,343 through 986,908 +turn on 674,953 through 820,965 +toggle 398,147 through 504,583 +turn off 778,194 through 898,298 +turn on 179,140 through 350,852 +turn off 241,118 through 530,832 +turn off 41,447 through 932,737 +turn off 820,663 through 832,982 +turn on 550,460 through 964,782 +turn on 31,760 through 655,892 +toggle 628,958 through 811,992 From 211b4ef9109d9b812341a3dfcafed57f086166a3 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 01:44:14 +0100 Subject: [PATCH 024/100] 2015: d06: ex2: add solution --- 2015/d06/ex2/ex2.py | 71 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100755 2015/d06/ex2/ex2.py diff --git a/2015/d06/ex2/ex2.py b/2015/d06/ex2/ex2.py new file mode 100755 index 0000000..6da18af --- /dev/null +++ b/2015/d06/ex2/ex2.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python + +import collections +import enum +import itertools +import sys +from typing import NamedTuple + + +class Point(NamedTuple): + x: int + y: int + + +class Op(enum.StrEnum): + TURN_ON = "on" + TOGGLE = "toggle" + TURN_OFF = "off" + + +class Instruction(NamedTuple): + op: Op + a: Point + b: Point + + @classmethod + def from_str(cls, input: str) -> "Instruction": + split_input = input.split() + raw_a, raw_b = split_input[-3], split_input[-1] + op = Op(split_input[1]) if split_input[0] == "turn" else Op(split_input[0]) + return Instruction( + op, + Point(*map(int, raw_a.split(","))), + Point(*map(int, raw_b.split(","))), + ) + + def apply(self, screen: collections.Counter[Point]) -> collections.Counter[Point]: + points = collections.Counter( + Point(x, y) + for x, y in itertools.product( + range(self.a.x, self.b.x + 1), + range(self.a.y, self.b.y + 1), + ) + ) + match self.op: + case Op.TURN_ON: + return screen + points + case Op.TOGGLE: + return screen + points + points + case Op.TURN_OFF: + return screen - points + + +def solve(input: str) -> int: + def parse(input: str) -> list[Instruction]: + return [Instruction.from_str(line) for line in input.splitlines()] + + instructions = parse(input) + screen: collections.Counter[Point] = collections.Counter() + for instr in instructions: + screen = instr.apply(screen) + return screen.total() + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 06950b6c721fbd15195adc5c03f83cc46c56ee7f Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 02:24:03 +0100 Subject: [PATCH 025/100] 2015: d07: ex1: add input --- 2015/d07/ex1/input | 339 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 339 insertions(+) create mode 100644 2015/d07/ex1/input diff --git a/2015/d07/ex1/input b/2015/d07/ex1/input new file mode 100644 index 0000000..0fd2859 --- /dev/null +++ b/2015/d07/ex1/input @@ -0,0 +1,339 @@ +lf AND lq -> ls +iu RSHIFT 1 -> jn +bo OR bu -> bv +gj RSHIFT 1 -> hc +et RSHIFT 2 -> eu +bv AND bx -> by +is OR it -> iu +b OR n -> o +gf OR ge -> gg +NOT kt -> ku +ea AND eb -> ed +kl OR kr -> ks +hi AND hk -> hl +au AND av -> ax +lf RSHIFT 2 -> lg +dd RSHIFT 3 -> df +eu AND fa -> fc +df AND dg -> di +ip LSHIFT 15 -> it +NOT el -> em +et OR fe -> ff +fj LSHIFT 15 -> fn +t OR s -> u +ly OR lz -> ma +ko AND kq -> kr +NOT fx -> fy +et RSHIFT 1 -> fm +eu OR fa -> fb +dd RSHIFT 2 -> de +NOT go -> gp +kb AND kd -> ke +hg OR hh -> hi +jm LSHIFT 1 -> kg +NOT cn -> co +jp RSHIFT 2 -> jq +jp RSHIFT 5 -> js +1 AND io -> ip +eo LSHIFT 15 -> es +1 AND jj -> jk +g AND i -> j +ci RSHIFT 3 -> ck +gn AND gp -> gq +fs AND fu -> fv +lj AND ll -> lm +jk LSHIFT 15 -> jo +iu RSHIFT 3 -> iw +NOT ii -> ij +1 AND cc -> cd +bn RSHIFT 3 -> bp +NOT gw -> gx +NOT ft -> fu +jn OR jo -> jp +iv OR jb -> jc +hv OR hu -> hw +19138 -> b +gj RSHIFT 5 -> gm +hq AND hs -> ht +dy RSHIFT 1 -> er +ao OR an -> ap +ld OR le -> lf +bk LSHIFT 1 -> ce +bz AND cb -> cc +bi LSHIFT 15 -> bm +il AND in -> io +af AND ah -> ai +as RSHIFT 1 -> bl +lf RSHIFT 3 -> lh +er OR es -> et +NOT ax -> ay +ci RSHIFT 1 -> db +et AND fe -> fg +lg OR lm -> ln +k AND m -> n +hz RSHIFT 2 -> ia +kh LSHIFT 1 -> lb +NOT ey -> ez +NOT di -> dj +dz OR ef -> eg +lx -> a +NOT iz -> ja +gz LSHIFT 15 -> hd +ce OR cd -> cf +fq AND fr -> ft +at AND az -> bb +ha OR gz -> hb +fp AND fv -> fx +NOT gb -> gc +ia AND ig -> ii +gl OR gm -> gn +0 -> c +NOT ca -> cb +bn RSHIFT 1 -> cg +c LSHIFT 1 -> t +iw OR ix -> iy +kg OR kf -> kh +dy OR ej -> ek +km AND kn -> kp +NOT fc -> fd +hz RSHIFT 3 -> ib +NOT dq -> dr +NOT fg -> fh +dy RSHIFT 2 -> dz +kk RSHIFT 2 -> kl +1 AND fi -> fj +NOT hr -> hs +jp RSHIFT 1 -> ki +bl OR bm -> bn +1 AND gy -> gz +gr AND gt -> gu +db OR dc -> dd +de OR dk -> dl +as RSHIFT 5 -> av +lf RSHIFT 5 -> li +hm AND ho -> hp +cg OR ch -> ci +gj AND gu -> gw +ge LSHIFT 15 -> gi +e OR f -> g +fp OR fv -> fw +fb AND fd -> fe +cd LSHIFT 15 -> ch +b RSHIFT 1 -> v +at OR az -> ba +bn RSHIFT 2 -> bo +lh AND li -> lk +dl AND dn -> do +eg AND ei -> ej +ex AND ez -> fa +NOT kp -> kq +NOT lk -> ll +x AND ai -> ak +jp OR ka -> kb +NOT jd -> je +iy AND ja -> jb +jp RSHIFT 3 -> jr +fo OR fz -> ga +df OR dg -> dh +gj RSHIFT 2 -> gk +gj OR gu -> gv +NOT jh -> ji +ap LSHIFT 1 -> bj +NOT ls -> lt +ir LSHIFT 1 -> jl +bn AND by -> ca +lv LSHIFT 15 -> lz +ba AND bc -> bd +cy LSHIFT 15 -> dc +ln AND lp -> lq +x RSHIFT 1 -> aq +gk OR gq -> gr +NOT kx -> ky +jg AND ji -> jj +bn OR by -> bz +fl LSHIFT 1 -> gf +bp OR bq -> br +he OR hp -> hq +et RSHIFT 5 -> ew +iu RSHIFT 2 -> iv +gl AND gm -> go +x OR ai -> aj +hc OR hd -> he +lg AND lm -> lo +lh OR li -> lj +da LSHIFT 1 -> du +fo RSHIFT 2 -> fp +gk AND gq -> gs +bj OR bi -> bk +lf OR lq -> lr +cj AND cp -> cr +hu LSHIFT 15 -> hy +1 AND bh -> bi +fo RSHIFT 3 -> fq +NOT lo -> lp +hw LSHIFT 1 -> iq +dd RSHIFT 1 -> dw +dt LSHIFT 15 -> dx +dy AND ej -> el +an LSHIFT 15 -> ar +aq OR ar -> as +1 AND r -> s +fw AND fy -> fz +NOT im -> in +et RSHIFT 3 -> ev +1 AND ds -> dt +ec AND ee -> ef +NOT ak -> al +jl OR jk -> jm +1 AND en -> eo +lb OR la -> lc +iu AND jf -> jh +iu RSHIFT 5 -> ix +bo AND bu -> bw +cz OR cy -> da +iv AND jb -> jd +iw AND ix -> iz +lf RSHIFT 1 -> ly +iu OR jf -> jg +NOT dm -> dn +lw OR lv -> lx +gg LSHIFT 1 -> ha +lr AND lt -> lu +fm OR fn -> fo +he RSHIFT 3 -> hg +aj AND al -> am +1 AND kz -> la +dy RSHIFT 5 -> eb +jc AND je -> jf +cm AND co -> cp +gv AND gx -> gy +ev OR ew -> ex +jp AND ka -> kc +fk OR fj -> fl +dy RSHIFT 3 -> ea +NOT bs -> bt +NOT ag -> ah +dz AND ef -> eh +cf LSHIFT 1 -> cz +NOT cv -> cw +1 AND cx -> cy +de AND dk -> dm +ck AND cl -> cn +x RSHIFT 5 -> aa +dv LSHIFT 1 -> ep +he RSHIFT 2 -> hf +NOT bw -> bx +ck OR cl -> cm +bp AND bq -> bs +as OR bd -> be +he AND hp -> hr +ev AND ew -> ey +1 AND lu -> lv +kk RSHIFT 3 -> km +b AND n -> p +NOT kc -> kd +lc LSHIFT 1 -> lw +km OR kn -> ko +id AND if -> ig +ih AND ij -> ik +jr AND js -> ju +ci RSHIFT 5 -> cl +hz RSHIFT 1 -> is +1 AND ke -> kf +NOT gs -> gt +aw AND ay -> az +x RSHIFT 2 -> y +ab AND ad -> ae +ff AND fh -> fi +ci AND ct -> cv +eq LSHIFT 1 -> fk +gj RSHIFT 3 -> gl +u LSHIFT 1 -> ao +NOT bb -> bc +NOT hj -> hk +kw AND ky -> kz +as AND bd -> bf +dw OR dx -> dy +br AND bt -> bu +kk AND kv -> kx +ep OR eo -> eq +he RSHIFT 1 -> hx +ki OR kj -> kk +NOT ju -> jv +ek AND em -> en +kk RSHIFT 5 -> kn +NOT eh -> ei +hx OR hy -> hz +ea OR eb -> ec +s LSHIFT 15 -> w +fo RSHIFT 1 -> gh +kk OR kv -> kw +bn RSHIFT 5 -> bq +NOT ed -> ee +1 AND ht -> hu +cu AND cw -> cx +b RSHIFT 5 -> f +kl AND kr -> kt +iq OR ip -> ir +ci RSHIFT 2 -> cj +cj OR cp -> cq +o AND q -> r +dd RSHIFT 5 -> dg +b RSHIFT 2 -> d +ks AND ku -> kv +b RSHIFT 3 -> e +d OR j -> k +NOT p -> q +NOT cr -> cs +du OR dt -> dv +kf LSHIFT 15 -> kj +NOT ac -> ad +fo RSHIFT 5 -> fr +hz OR ik -> il +jx AND jz -> ka +gh OR gi -> gj +kk RSHIFT 1 -> ld +hz RSHIFT 5 -> ic +as RSHIFT 2 -> at +NOT jy -> jz +1 AND am -> an +ci OR ct -> cu +hg AND hh -> hj +jq OR jw -> jx +v OR w -> x +la LSHIFT 15 -> le +dh AND dj -> dk +dp AND dr -> ds +jq AND jw -> jy +au OR av -> aw +NOT bf -> bg +z OR aa -> ab +ga AND gc -> gd +hz AND ik -> im +jt AND jv -> jw +z AND aa -> ac +jr OR js -> jt +hb LSHIFT 1 -> hv +hf OR hl -> hm +ib OR ic -> id +fq OR fr -> fs +cq AND cs -> ct +ia OR ig -> ih +dd OR do -> dp +d AND j -> l +ib AND ic -> ie +as RSHIFT 3 -> au +be AND bg -> bh +dd AND do -> dq +NOT l -> m +1 AND gd -> ge +y AND ae -> ag +fo AND fz -> gb +NOT ie -> if +e AND f -> h +x RSHIFT 3 -> z +y OR ae -> af +hf AND hl -> hn +NOT h -> i +NOT hn -> ho +he RSHIFT 5 -> hh From de56afd64b1278bdb48bc74f64e7328ec3fb9642 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 02:24:14 +0100 Subject: [PATCH 026/100] 2015: d07: ex1: add solution --- 2015/d07/ex1/ex1.py | 121 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100755 2015/d07/ex1/ex1.py diff --git a/2015/d07/ex1/ex1.py b/2015/d07/ex1/ex1.py new file mode 100755 index 0000000..c70461c --- /dev/null +++ b/2015/d07/ex1/ex1.py @@ -0,0 +1,121 @@ +#!/usr/bin/env python + +import enum +import operator +import sys +from typing import NamedTuple + + +class Op(enum.StrEnum): + AND = "AND_" + OR = "OR_" + LSHIFT = "LSHIFT" + RSHIFT = "RSHIFT" + NOT = "NOT" + IDENTITY = "" # For the output to `a`, which has no operator + + def apply(self, lhs: int, rhs: int | None) -> int: + if self == Op.IDENTITY: + assert rhs is None + return lhs + if self == Op.NOT: + assert rhs is None + return ~lhs + assert rhs is not None + return getattr(operator, self.lower())(lhs, rhs) + + +class Instruction(NamedTuple): + op: Op + lhs: str + rhs: str | None = None + + @classmethod + def from_str(cls, input: str) -> "Instruction": + split_input = input.split() + if len(split_input) == 1: + op = "" + lhs = split_input[0] + rest = [] + elif split_input[0] == "NOT": + op, lhs, *rest = split_input + else: + lhs, op, *rest = split_input + # Hacky way to match with the function in the `operator` module... + if op in ("AND", "OR"): + op = op + "_" + return cls(Op(op), lhs, *rest) + + +Circuit = dict[str, Instruction | int] + + +def solve(input: str) -> int: + def parse_line(input: str) -> tuple[str, Instruction | int]: + raw_instr, wire = input.split(" -> ") + if raw_instr.isdigit(): + return wire, int(raw_instr) + return wire, Instruction.from_str(raw_instr) + + def parse(input: str) -> Circuit: + return {wire: val for wire, val in map(parse_line, input.splitlines())} + + def dependencies(circuit: Circuit) -> dict[str, set[str]]: + res: dict[str, set[str]] = {wire: set() for wire in circuit.keys()} + for wire, val in circuit.items(): + if isinstance(val, int): + continue + for dep in (val.lhs, val.rhs): + if dep is None: + continue + if dep.isdigit(): + continue + res[wire].add(dep) + return res + + def topo_sort(dep_graph: dict[str, set[str]]) -> list[str]: + res: list[str] = [] + + queue = {n for n, deps in dep_graph.items() if not deps} + seen: set[str] = set() + + while queue: + node = queue.pop() + + res.append(node) + seen.add(node) + # Iterate over all nodes as we don't have information on children + for child, deps in dep_graph.items(): + if child in seen: + continue + if deps - seen: + continue + queue.add(child) + + return res + + def run(circuit: Circuit) -> dict[str, int]: + res: dict[str, int] = {} + for wire in topo_sort(dependencies(circuit)): + match circuit[wire]: + case int(n): + res[wire] = n + case Instruction(op, lhs, rhs): + resolve = lambda v: int(v) if v.isdigit() else res[v] + lhs_n = resolve(lhs) + rhs_n = None if rhs is None else resolve(rhs) + res[wire] = op.apply(lhs_n, rhs_n) + return res + + circuit = parse(input) + wires = run(circuit) + return wires["a"] + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 8bb151fd6a1144615f7bfac894ec6be097ec20d6 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 02:24:20 +0100 Subject: [PATCH 027/100] 2015: d07: ex2: add input --- 2015/d07/ex2/input | 339 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 339 insertions(+) create mode 100644 2015/d07/ex2/input diff --git a/2015/d07/ex2/input b/2015/d07/ex2/input new file mode 100644 index 0000000..0fd2859 --- /dev/null +++ b/2015/d07/ex2/input @@ -0,0 +1,339 @@ +lf AND lq -> ls +iu RSHIFT 1 -> jn +bo OR bu -> bv +gj RSHIFT 1 -> hc +et RSHIFT 2 -> eu +bv AND bx -> by +is OR it -> iu +b OR n -> o +gf OR ge -> gg +NOT kt -> ku +ea AND eb -> ed +kl OR kr -> ks +hi AND hk -> hl +au AND av -> ax +lf RSHIFT 2 -> lg +dd RSHIFT 3 -> df +eu AND fa -> fc +df AND dg -> di +ip LSHIFT 15 -> it +NOT el -> em +et OR fe -> ff +fj LSHIFT 15 -> fn +t OR s -> u +ly OR lz -> ma +ko AND kq -> kr +NOT fx -> fy +et RSHIFT 1 -> fm +eu OR fa -> fb +dd RSHIFT 2 -> de +NOT go -> gp +kb AND kd -> ke +hg OR hh -> hi +jm LSHIFT 1 -> kg +NOT cn -> co +jp RSHIFT 2 -> jq +jp RSHIFT 5 -> js +1 AND io -> ip +eo LSHIFT 15 -> es +1 AND jj -> jk +g AND i -> j +ci RSHIFT 3 -> ck +gn AND gp -> gq +fs AND fu -> fv +lj AND ll -> lm +jk LSHIFT 15 -> jo +iu RSHIFT 3 -> iw +NOT ii -> ij +1 AND cc -> cd +bn RSHIFT 3 -> bp +NOT gw -> gx +NOT ft -> fu +jn OR jo -> jp +iv OR jb -> jc +hv OR hu -> hw +19138 -> b +gj RSHIFT 5 -> gm +hq AND hs -> ht +dy RSHIFT 1 -> er +ao OR an -> ap +ld OR le -> lf +bk LSHIFT 1 -> ce +bz AND cb -> cc +bi LSHIFT 15 -> bm +il AND in -> io +af AND ah -> ai +as RSHIFT 1 -> bl +lf RSHIFT 3 -> lh +er OR es -> et +NOT ax -> ay +ci RSHIFT 1 -> db +et AND fe -> fg +lg OR lm -> ln +k AND m -> n +hz RSHIFT 2 -> ia +kh LSHIFT 1 -> lb +NOT ey -> ez +NOT di -> dj +dz OR ef -> eg +lx -> a +NOT iz -> ja +gz LSHIFT 15 -> hd +ce OR cd -> cf +fq AND fr -> ft +at AND az -> bb +ha OR gz -> hb +fp AND fv -> fx +NOT gb -> gc +ia AND ig -> ii +gl OR gm -> gn +0 -> c +NOT ca -> cb +bn RSHIFT 1 -> cg +c LSHIFT 1 -> t +iw OR ix -> iy +kg OR kf -> kh +dy OR ej -> ek +km AND kn -> kp +NOT fc -> fd +hz RSHIFT 3 -> ib +NOT dq -> dr +NOT fg -> fh +dy RSHIFT 2 -> dz +kk RSHIFT 2 -> kl +1 AND fi -> fj +NOT hr -> hs +jp RSHIFT 1 -> ki +bl OR bm -> bn +1 AND gy -> gz +gr AND gt -> gu +db OR dc -> dd +de OR dk -> dl +as RSHIFT 5 -> av +lf RSHIFT 5 -> li +hm AND ho -> hp +cg OR ch -> ci +gj AND gu -> gw +ge LSHIFT 15 -> gi +e OR f -> g +fp OR fv -> fw +fb AND fd -> fe +cd LSHIFT 15 -> ch +b RSHIFT 1 -> v +at OR az -> ba +bn RSHIFT 2 -> bo +lh AND li -> lk +dl AND dn -> do +eg AND ei -> ej +ex AND ez -> fa +NOT kp -> kq +NOT lk -> ll +x AND ai -> ak +jp OR ka -> kb +NOT jd -> je +iy AND ja -> jb +jp RSHIFT 3 -> jr +fo OR fz -> ga +df OR dg -> dh +gj RSHIFT 2 -> gk +gj OR gu -> gv +NOT jh -> ji +ap LSHIFT 1 -> bj +NOT ls -> lt +ir LSHIFT 1 -> jl +bn AND by -> ca +lv LSHIFT 15 -> lz +ba AND bc -> bd +cy LSHIFT 15 -> dc +ln AND lp -> lq +x RSHIFT 1 -> aq +gk OR gq -> gr +NOT kx -> ky +jg AND ji -> jj +bn OR by -> bz +fl LSHIFT 1 -> gf +bp OR bq -> br +he OR hp -> hq +et RSHIFT 5 -> ew +iu RSHIFT 2 -> iv +gl AND gm -> go +x OR ai -> aj +hc OR hd -> he +lg AND lm -> lo +lh OR li -> lj +da LSHIFT 1 -> du +fo RSHIFT 2 -> fp +gk AND gq -> gs +bj OR bi -> bk +lf OR lq -> lr +cj AND cp -> cr +hu LSHIFT 15 -> hy +1 AND bh -> bi +fo RSHIFT 3 -> fq +NOT lo -> lp +hw LSHIFT 1 -> iq +dd RSHIFT 1 -> dw +dt LSHIFT 15 -> dx +dy AND ej -> el +an LSHIFT 15 -> ar +aq OR ar -> as +1 AND r -> s +fw AND fy -> fz +NOT im -> in +et RSHIFT 3 -> ev +1 AND ds -> dt +ec AND ee -> ef +NOT ak -> al +jl OR jk -> jm +1 AND en -> eo +lb OR la -> lc +iu AND jf -> jh +iu RSHIFT 5 -> ix +bo AND bu -> bw +cz OR cy -> da +iv AND jb -> jd +iw AND ix -> iz +lf RSHIFT 1 -> ly +iu OR jf -> jg +NOT dm -> dn +lw OR lv -> lx +gg LSHIFT 1 -> ha +lr AND lt -> lu +fm OR fn -> fo +he RSHIFT 3 -> hg +aj AND al -> am +1 AND kz -> la +dy RSHIFT 5 -> eb +jc AND je -> jf +cm AND co -> cp +gv AND gx -> gy +ev OR ew -> ex +jp AND ka -> kc +fk OR fj -> fl +dy RSHIFT 3 -> ea +NOT bs -> bt +NOT ag -> ah +dz AND ef -> eh +cf LSHIFT 1 -> cz +NOT cv -> cw +1 AND cx -> cy +de AND dk -> dm +ck AND cl -> cn +x RSHIFT 5 -> aa +dv LSHIFT 1 -> ep +he RSHIFT 2 -> hf +NOT bw -> bx +ck OR cl -> cm +bp AND bq -> bs +as OR bd -> be +he AND hp -> hr +ev AND ew -> ey +1 AND lu -> lv +kk RSHIFT 3 -> km +b AND n -> p +NOT kc -> kd +lc LSHIFT 1 -> lw +km OR kn -> ko +id AND if -> ig +ih AND ij -> ik +jr AND js -> ju +ci RSHIFT 5 -> cl +hz RSHIFT 1 -> is +1 AND ke -> kf +NOT gs -> gt +aw AND ay -> az +x RSHIFT 2 -> y +ab AND ad -> ae +ff AND fh -> fi +ci AND ct -> cv +eq LSHIFT 1 -> fk +gj RSHIFT 3 -> gl +u LSHIFT 1 -> ao +NOT bb -> bc +NOT hj -> hk +kw AND ky -> kz +as AND bd -> bf +dw OR dx -> dy +br AND bt -> bu +kk AND kv -> kx +ep OR eo -> eq +he RSHIFT 1 -> hx +ki OR kj -> kk +NOT ju -> jv +ek AND em -> en +kk RSHIFT 5 -> kn +NOT eh -> ei +hx OR hy -> hz +ea OR eb -> ec +s LSHIFT 15 -> w +fo RSHIFT 1 -> gh +kk OR kv -> kw +bn RSHIFT 5 -> bq +NOT ed -> ee +1 AND ht -> hu +cu AND cw -> cx +b RSHIFT 5 -> f +kl AND kr -> kt +iq OR ip -> ir +ci RSHIFT 2 -> cj +cj OR cp -> cq +o AND q -> r +dd RSHIFT 5 -> dg +b RSHIFT 2 -> d +ks AND ku -> kv +b RSHIFT 3 -> e +d OR j -> k +NOT p -> q +NOT cr -> cs +du OR dt -> dv +kf LSHIFT 15 -> kj +NOT ac -> ad +fo RSHIFT 5 -> fr +hz OR ik -> il +jx AND jz -> ka +gh OR gi -> gj +kk RSHIFT 1 -> ld +hz RSHIFT 5 -> ic +as RSHIFT 2 -> at +NOT jy -> jz +1 AND am -> an +ci OR ct -> cu +hg AND hh -> hj +jq OR jw -> jx +v OR w -> x +la LSHIFT 15 -> le +dh AND dj -> dk +dp AND dr -> ds +jq AND jw -> jy +au OR av -> aw +NOT bf -> bg +z OR aa -> ab +ga AND gc -> gd +hz AND ik -> im +jt AND jv -> jw +z AND aa -> ac +jr OR js -> jt +hb LSHIFT 1 -> hv +hf OR hl -> hm +ib OR ic -> id +fq OR fr -> fs +cq AND cs -> ct +ia OR ig -> ih +dd OR do -> dp +d AND j -> l +ib AND ic -> ie +as RSHIFT 3 -> au +be AND bg -> bh +dd AND do -> dq +NOT l -> m +1 AND gd -> ge +y AND ae -> ag +fo AND fz -> gb +NOT ie -> if +e AND f -> h +x RSHIFT 3 -> z +y OR ae -> af +hf AND hl -> hn +NOT h -> i +NOT hn -> ho +he RSHIFT 5 -> hh From 0a500256dab35ff712f52f132f545fc761c07bb9 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 02:24:30 +0100 Subject: [PATCH 028/100] 2015: d07: ex2: add solution --- 2015/d07/ex2/ex2.py | 122 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100755 2015/d07/ex2/ex2.py diff --git a/2015/d07/ex2/ex2.py b/2015/d07/ex2/ex2.py new file mode 100755 index 0000000..103836f --- /dev/null +++ b/2015/d07/ex2/ex2.py @@ -0,0 +1,122 @@ +#!/usr/bin/env python + +import enum +import operator +import sys +from typing import NamedTuple + + +class Op(enum.StrEnum): + AND = "AND_" + OR = "OR_" + LSHIFT = "LSHIFT" + RSHIFT = "RSHIFT" + NOT = "NOT" + IDENTITY = "" # For the output to `a`, which has no operator + + def apply(self, lhs: int, rhs: int | None) -> int: + if self == Op.IDENTITY: + assert rhs is None + return lhs + if self == Op.NOT: + assert rhs is None + return ~lhs + assert rhs is not None + return getattr(operator, self.lower())(lhs, rhs) + + +class Instruction(NamedTuple): + op: Op + lhs: str + rhs: str | None = None + + @classmethod + def from_str(cls, input: str) -> "Instruction": + split_input = input.split() + if len(split_input) == 1: + op = "" + lhs = split_input[0] + rest = [] + elif split_input[0] == "NOT": + op, lhs, *rest = split_input + else: + lhs, op, *rest = split_input + # Hacky way to match with the function in the `operator` module... + if op in ("AND", "OR"): + op = op + "_" + return cls(Op(op), lhs, *rest) + + +Circuit = dict[str, Instruction | int] + + +def solve(input: str) -> int: + def parse_line(input: str) -> tuple[str, Instruction | int]: + raw_instr, wire = input.split(" -> ") + if raw_instr.isdigit(): + return wire, int(raw_instr) + return wire, Instruction.from_str(raw_instr) + + def parse(input: str) -> Circuit: + return {wire: val for wire, val in map(parse_line, input.splitlines())} + + def dependencies(circuit: Circuit) -> dict[str, set[str]]: + res: dict[str, set[str]] = {wire: set() for wire in circuit.keys()} + for wire, val in circuit.items(): + if isinstance(val, int): + continue + for dep in (val.lhs, val.rhs): + if dep is None: + continue + if dep.isdigit(): + continue + res[wire].add(dep) + return res + + def topo_sort(dep_graph: dict[str, set[str]]) -> list[str]: + res: list[str] = [] + + queue = {n for n, deps in dep_graph.items() if not deps} + seen: set[str] = set() + + while queue: + node = queue.pop() + + res.append(node) + seen.add(node) + # Iterate over all nodes as we don't have information on children + for child, deps in dep_graph.items(): + if child in seen: + continue + if deps - seen: + continue + queue.add(child) + + return res + + def run(circuit: Circuit) -> dict[str, int]: + res: dict[str, int] = {} + for wire in topo_sort(dependencies(circuit)): + match circuit[wire]: + case int(n): + res[wire] = n + case Instruction(op, lhs, rhs): + resolve = lambda v: int(v) if v.isdigit() else res[v] + lhs_n = resolve(lhs) + rhs_n = None if rhs is None else resolve(rhs) + res[wire] = op.apply(lhs_n, rhs_n) + return res + + circuit = parse(input) + first_run = run(circuit) + wires = run(circuit | {"b": first_run["a"]}) + return wires["a"] + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 72d37ffa5cfc4be7f165e21ad9be6a5c49c04b13 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 02:35:28 +0100 Subject: [PATCH 029/100] 2015: d08: ex1: add input --- 2015/d08/ex1/input | 300 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 300 insertions(+) create mode 100644 2015/d08/ex1/input diff --git a/2015/d08/ex1/input b/2015/d08/ex1/input new file mode 100644 index 0000000..94538e7 --- /dev/null +++ b/2015/d08/ex1/input @@ -0,0 +1,300 @@ +"qxfcsmh" +"ffsfyxbyuhqkpwatkjgudo" +"byc\x9dyxuafof\\\xa6uf\\axfozomj\\olh\x6a" +"jtqvz" +"uzezxa\"jgbmojtwyfbfguz" +"vqsremfk\x8fxiknektafj" +"wzntebpxnnt\"vqndz\"i\x47vvjqo\"" +"higvez\"k\"riewqk" +"dlkrbhbrlfrp\\damiauyucwhty" +"d\"" +"qlz" +"ku" +"yy\"\"uoao\"uripabop" +"saduyrntuswlnlkuppdro\\sicxosted" +"tj" +"zzphopswlwdhebwkxeurvizdv" +"xfoheirjoakrpofles\"nfu" +"q\xb7oh\"p\xce\"n" +"qeendp\"ercwgywdjeylxcv" +"dcmem" +"\"i\x13r\"l" +"ikso\xdcbvqnbrjduh\"uqudzki\xderwk" +"wfdsn" +"pwynglklryhtsqbno" +"hcoj\x63iccz\"v\"ttr" +"zf\x23\\hlj\\kkce\\d\\asy\"yyfestwcdxyfj" +"xs" +"m\"tvltapxdvtrxiy" +"bmud" +"k\"a" +"b\"oas" +"\"yexnjjupoqsxyqnquy\"uzfdvetqrc" +"vdw\xe3olxfgujaj" +"qomcxdnd\"\\cfoe\"" +"fpul" +"m\"avamefphkpv" +"vvdnb\\x\\uhnxfw\"dpubfkxfmeuhnxisd" +"hey\\" +"ldaeigghlfey" +"eure\"hoy\xa5iezjp\\tm" +"yygb\"twbj\\r\"\x10gmxuhmp\"" +"weirebp\x39mqonbtmfmd" +"ltuz\\hs\"e" +"ysvmpc" +"g\x8amjtt\"megl\"omsaihifwa" +"yimmm" +"iiyqfalh" +"cwknlaaf" +"q\x37feg\xc6s\"xx" +"uayrgeurgyp\\oi" +"xhug\"pt\"axugllbdiggzhvy" +"kdaarqmsjfx\xc3d" +"\"vkwla" +"d\"" +"tmroz\"bvfinxoe\\mum\"wmm" +"\"n\"bbswxne\\p\\yr\"qhwpdd" +"skzlkietklkqovjhvj\xfe" +"pbg\\pab\"bubqaf\"obzcwxwywbs\\dhtq" +"xxjidvqh\"lx\\wu\"ij" +"daef\x5fe\x5b\\kbeeb\x13qnydtboof" +"ogvazaqy\"j\x73" +"y" +"n\"tibetedldy\\gsamm\"nwu" +"wldkvgdtqulwkad" +"dpmxnj" +"twybw\"cdvf\"mjdajurokbce" +"ru\"\\lasij\"i" +"roc\\vra\\lhrm" +"pbkt\x60booz\"fjlkc" +"j\x4dytvjwrzt" +"\\uiwjkniumxcs" +"cbhm\"nexccior\"v\"j\"nazxilmfp\x47" +"qdxngevzrlgoq" +"\"lrzxftytpobsdfyrtdqpjbpuwmm\x9e" +"mdag\x0asnck\xc2ggj\"slb\"fjy" +"wyqkhjuazdtcgkcxvjkpnjdae" +"aixfk\xc0iom\x21vueob" +"dkiiakyjpkffqlluhaetires" +"ysspv\"lysgkvnmwbbsy" +"gy\"ryexcjjxdm\"xswssgtr" +"s" +"ddxv" +"qwt\"\x27puilb\"pslmbrsxhrz" +"qdg\xc9e\\qwtknlvkol\x54oqvmchn\\" +"lvo" +"b" +"fk\"aa\"\"yenwch\\\\on" +"srig\x63hpwaavs\\\x80qzk\"xa\"\xe6u\\wr" +"yxjxuj\"ghyhhxfj\"\xa6qvatre" +"yoktqxjxkzrklkoeroil" +"\"jfmik\"" +"smgseztzdwldikbqrh\"" +"jftahgctf\"hoqy" +"tcnhicr\"znpgckt\"ble" +"vqktnkodh\"lo\"a\\bkmdjqqnsqr" +"ztnirfzqq" +"s" +"xx" +"iqj\"y\\hqgzflwrdsusasekyrxbp\\ad" +"\\xzjhlaiynkioz\"\"bxepzimvgwt" +"s\x36rbw" +"mniieztwrisvdx" +"atyfxioy\x2b\\" +"irde\x85\x5cvbah\\jekw\"ia" +"bdmftlhkwrprmpat\"prfaocvp" +"w\\k" +"umbpausy" +"zfauhpsangy" +"p\"zqyw" +"wtztypyqvnnxzvlvipnq\"zu" +"deicgwq\\oqvajpbov\\or\"kgplwu" +"mbzlfgpi\\\\zqcidjpzqdzxityxa" +"lfkxvhma" +"\xf2yduqzqr\"\\fak\"p\"n" +"mpajacfuxotonpadvng" +"anb\\telzvcdu\\a\xf2flfq" +"lrs\"ebethwpmuuc\"\x86ygr" +"qmvdbhtumzc\"ci" +"meet" +"yopg\x0fdxdq\"h\\ugsu\xffmolxjv" +"uhy" +"fzgidrtzycsireghazscvmwcfmw\\t" +"cqohkhpgvpru" +"bihyigtnvmevx\"xx" +"xz" +"zofomwotzuxsjk\"q\"mc\"js\"dnmalhxd" +"\\ktnddux\\fqvt\"ibnjntjcbn" +"ia" +"htjadnefwetyp\xd5kbrwfycbyy" +"\"\\hkuxqddnao" +"meqqsz\x83luecpgaem" +"cvks\x87frvxo\"svqivqsdpgwhukmju" +"sgmxiai\\o\"riufxwjfigr\xdf" +"fgywdfecqufccpcdn" +"faghjoq\x28abxnpxj" +"zuppgzcfb\"dctvp\"elup\"zxkopx" +"xqs\x45xxdqcihbwghmzoa" +"anbnlp\\cgcvm\"hc" +"xf\"fgrngwzys" +"nrxsjduedcy\x24" +"\x71sxl\"gj\"sds\"ulcruguz\\t\\ssvjcwhi" +"jhj\"msch" +"qpovolktfwyiuyicbfeeju\x01" +"nkyxmb\"qyqultgt\"nmvzvvnxnb" +"ycsrkbstgzqb\"uv\\cisn" +"s" +"ueptjnn\"\"sh" +"lp\"z\"d\"mxtxiy" +"yzjtvockdnvbubqabjourf\"k\"uoxwle" +"\x82\"wqm\"" +"\xb5cwtuks\x5fpgh" +"wd" +"tbvf" +"ttbmzdgn" +"vfpiyfdejyrlbgcdtwzbnm" +"uc" +"otdcmhpjagqix" +"\\\xb1qso\"s" +"scowax" +"behpstjdh\xccqlgnqjyz\"eesn" +"r\xe1cbnjwzveoomkzlo\\kxlfouhm" +"jgrl" +"kzqs\\r" +"ctscb\x7fthwkdyko\"\x62pkf\"d\xe6knmhurg" +"tc\"kw\x3ftt" +"bxb\x5ccl" +"jyrmfbphsldwpq" +"jylpvysl\"\"juducjg" +"en\\m\"kxpq\"wpb\\\"" +"madouht\"bmdwvnyqvpnawiphgac\"" +"vuxpk\"ltucrw" +"aae\x60arr" +"ttitnne\"kilkrgssnr\xfdurzh" +"oalw" +"pc\"\"gktkdykzbdpkwigucqni\"nxiqx" +"dbrsaj" +"bgzsowyxcbrvhtvekhsh\"qgd" +"kudfemvk\"\"\"hkbrbil\"chkqoa" +"zjzgj\\ekbhyfzufy" +"\\acos\"fqekuxqzxbmkbnn\x1ejzwrm" +"elxahvudn\"txtmomotgw" +"\x2eoxmwdhelpr\"cgi\xf7pzvb" +"eapheklx" +"hfvma\"mietvc\"tszbbm\"czex" +"h\"iiockj\\\xc1et" +"d\"rmjjftm" +"qlvhdcbqtyrhlc\\" +"yy\"rsucjtulm\"coryri\"eqjlbmk" +"tv" +"r\"bfuht\\jjgujp\"" +"kukxvuauamtdosngdjlkauylttaokaj" +"srgost\"\"rbkcqtlccu\x65ohjptstrjkzy" +"yxwxl\\yjilwwxffrjjuazmzjs" +"dxlw\\fkstu\"hjrtiafhyuoh\"sewabne" +"\x88sj\"v" +"rfzprz\xec\"oxqclu\"krzefp\\q" +"cfmhdbjuhrcymgxpylllyvpni" +"ucrmjvmimmcq\x88\xd9\"lz" +"lujtt\"" +"gvbqoixn\"pmledpjmo\"flydnwkfxllf" +"dvxqlbshhmelsk\x8big\"l" +"mx\x54lma\x8bbguxejg" +"\x66jdati\xeceieo" +"\"iyyupixei\x54ff" +"xohzf\"rbxsoksxamiu" +"vlhthspeshzbppa\x4drhqnohjop\"\"mfjd" +"f\"tvxxla\"vurian\"\"idjq\x3aptm\xc3olep" +"gzqz" +"kbq\\wogye\\altvi\\hbvmodny" +"j\xd8" +"ofjozdhkblvndl" +"hbitoupimbawimxlxqze" +"ypeleimnme" +"xfwdrzsc\\oxqamawyizvi\\y" +"enoikppx\xa1ixe\"yo\"gumye" +"fb" +"vzf" +"zxidr" +"cu\x31beirsywtskq" +"lxpjbvqzztafwezd" +"\\jyxeuo\x18bv" +"b\"vawc\"p\\\\giern\"b" +"odizunx\"\"t\\yicdn\"x\"sdiz" +"\"\"tebrtsi" +"ctyzsxv\xa6pegfkwsi\"tgyltaakytccb" +"htxwbofchvmzbppycccliyik\xe5a" +"ggsslefamsklezqkrd" +"rcep\"fnimwvvdx\"l" +"zyrzlqmd\x12egvqs\\llqyie" +"\x07gsqyrr\\rcyhyspsvn" +"butg\"" +"gb" +"gywkoxf\"jsg\\wtopxvumirqxlwz" +"rj\"ir\"wldwveair\x2es\"dhjrdehbqnzl" +"ru\"elktnsbxufk\\ejufjfjlevt\\lrzd" +"\"widsvok" +"oy\"\x81nuesvw" +"ay" +"syticfac\x1cfjsivwlmy\"pumsqlqqzx" +"m" +"rjjkfh\x78cf\x2brgceg\"jmdyas\"\\xlv\xb6p" +"tmuvo\"\x3ffdqdovjmdmkgpstotojkv\"as" +"jd\\ojvynhxllfzzxvbn\"wrpphcvx" +"pz" +"\"twr" +"n\\hdzmxe\"mzjjeadlz" +"fb\"rprxuagvahjnri" +"rfmexmjjgh\\xrnmyvnatrvfruflaqjnd" +"obbbde\"co\"qr\"qpiwjgqahqm\\jjp\"" +"vpbq\"\"y\"czk\\b\x52ed\"lnzepobp" +"syzeajzfarplydipny\"y\"\xe8ad" +"mpyodwb" +"\x47rakphlqqptd" +"wa\"oj\"aiy" +"a" +"ropozx" +"q\x51nbtlwa" +"etukvgx\\jqxlkq" +"\"tp\"rah\"pg\"s\"bpdtes\\tkasdhqd" +"dn\"qqpkikadowssb\xcah\"dzpsf\\ect\"jdh" +"pxunovbbrrn\\vullyn\"bno\"\"\"myfxlp\"" +"qaixyazuryvkmoulhcqaotegfj\\mpzm" +"bvfrbicutzbjwn\\oml\"cf\"d\"ezcpv\"j" +"rmbrdtneudemigdhelmb" +"aq\\aurmbhy" +"wujqvzw" +"gf\"tssmvm\"gm\"hu\x9a\xb7yjawsa" +"hrhqqxow\xe2gsydtdspcfqy\"zw\\ou" +"ianwwf\\yko\\tdujhhqdi" +"xylz\"zpvpab" +"lwuopbeeegp" +"aoop\x49jhhcexdmdtun" +"\\\\mouqqcsgmz" +"tltuvwhveau\x43b\"ymxjlcgiymcynwt" +"gsugerumpyuhtjljbhrdyoj" +"lnjm\xb8wg\"ajh" +"zmspue\"nfttdon\\b\"eww" +"\"w\x67jwaq\x7ernmyvs\\rmdsuwydsd\"th" +"ogtgvtlmcvgllyv" +"z\"fqi\"rvddoehrciyl" +"yustxxtot\"muec\"xvfdbzunzvveq" +"mqslw" +"txqnyvzmibqgjs\xb6xy\x86nfalfyx" +"kzhehlmkholov" +"plpmywcnirrjutjguosh\\" +"pydbnqofv\"dn\\m" +"aegqof" +"eambmxt\\dxagoogl\\zapfwwlmk" +"afbmqitxxqhddlozuxcpjxgh" +"vgts" +"bfdpqtoxzzhmzcilehnflna" +"s\"idpz" +"\xcfhgly\"nlmztwybx\"ecezmsxaqw" +"aackfgndqcqiy" +"\x22unqdlsrvgzfaohoffgxzfpir\"s" +"abh\"ydv\"kbpdhrerl" +"bdzpg" +"ekwgkywtmzp" +"wtoodejqmrrgslhvnk\"pi\"ldnogpth" +"njro\x68qgbx\xe4af\"\\suan" From 0c458813d468dc2cb8dedd87b3e68f03cd104636 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 02:35:33 +0100 Subject: [PATCH 030/100] 2015: d08: ex1: add solution --- 2015/d08/ex1/ex1.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 2015/d08/ex1/ex1.py diff --git a/2015/d08/ex1/ex1.py b/2015/d08/ex1/ex1.py new file mode 100755 index 0000000..8e14c7f --- /dev/null +++ b/2015/d08/ex1/ex1.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python + +import ast +import sys + + +def solve(input: str) -> int: + strings = input.splitlines() + # It's too easy to use the built-in parser not to do it... + return sum(len(raw) - len(ast.literal_eval(raw)) for raw in strings) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 797b1048505b6eb71adda7857e3354c207be841c Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 02:35:38 +0100 Subject: [PATCH 031/100] 2015: d08: ex2: add input --- 2015/d08/ex2/input | 300 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 300 insertions(+) create mode 100644 2015/d08/ex2/input diff --git a/2015/d08/ex2/input b/2015/d08/ex2/input new file mode 100644 index 0000000..94538e7 --- /dev/null +++ b/2015/d08/ex2/input @@ -0,0 +1,300 @@ +"qxfcsmh" +"ffsfyxbyuhqkpwatkjgudo" +"byc\x9dyxuafof\\\xa6uf\\axfozomj\\olh\x6a" +"jtqvz" +"uzezxa\"jgbmojtwyfbfguz" +"vqsremfk\x8fxiknektafj" +"wzntebpxnnt\"vqndz\"i\x47vvjqo\"" +"higvez\"k\"riewqk" +"dlkrbhbrlfrp\\damiauyucwhty" +"d\"" +"qlz" +"ku" +"yy\"\"uoao\"uripabop" +"saduyrntuswlnlkuppdro\\sicxosted" +"tj" +"zzphopswlwdhebwkxeurvizdv" +"xfoheirjoakrpofles\"nfu" +"q\xb7oh\"p\xce\"n" +"qeendp\"ercwgywdjeylxcv" +"dcmem" +"\"i\x13r\"l" +"ikso\xdcbvqnbrjduh\"uqudzki\xderwk" +"wfdsn" +"pwynglklryhtsqbno" +"hcoj\x63iccz\"v\"ttr" +"zf\x23\\hlj\\kkce\\d\\asy\"yyfestwcdxyfj" +"xs" +"m\"tvltapxdvtrxiy" +"bmud" +"k\"a" +"b\"oas" +"\"yexnjjupoqsxyqnquy\"uzfdvetqrc" +"vdw\xe3olxfgujaj" +"qomcxdnd\"\\cfoe\"" +"fpul" +"m\"avamefphkpv" +"vvdnb\\x\\uhnxfw\"dpubfkxfmeuhnxisd" +"hey\\" +"ldaeigghlfey" +"eure\"hoy\xa5iezjp\\tm" +"yygb\"twbj\\r\"\x10gmxuhmp\"" +"weirebp\x39mqonbtmfmd" +"ltuz\\hs\"e" +"ysvmpc" +"g\x8amjtt\"megl\"omsaihifwa" +"yimmm" +"iiyqfalh" +"cwknlaaf" +"q\x37feg\xc6s\"xx" +"uayrgeurgyp\\oi" +"xhug\"pt\"axugllbdiggzhvy" +"kdaarqmsjfx\xc3d" +"\"vkwla" +"d\"" +"tmroz\"bvfinxoe\\mum\"wmm" +"\"n\"bbswxne\\p\\yr\"qhwpdd" +"skzlkietklkqovjhvj\xfe" +"pbg\\pab\"bubqaf\"obzcwxwywbs\\dhtq" +"xxjidvqh\"lx\\wu\"ij" +"daef\x5fe\x5b\\kbeeb\x13qnydtboof" +"ogvazaqy\"j\x73" +"y" +"n\"tibetedldy\\gsamm\"nwu" +"wldkvgdtqulwkad" +"dpmxnj" +"twybw\"cdvf\"mjdajurokbce" +"ru\"\\lasij\"i" +"roc\\vra\\lhrm" +"pbkt\x60booz\"fjlkc" +"j\x4dytvjwrzt" +"\\uiwjkniumxcs" +"cbhm\"nexccior\"v\"j\"nazxilmfp\x47" +"qdxngevzrlgoq" +"\"lrzxftytpobsdfyrtdqpjbpuwmm\x9e" +"mdag\x0asnck\xc2ggj\"slb\"fjy" +"wyqkhjuazdtcgkcxvjkpnjdae" +"aixfk\xc0iom\x21vueob" +"dkiiakyjpkffqlluhaetires" +"ysspv\"lysgkvnmwbbsy" +"gy\"ryexcjjxdm\"xswssgtr" +"s" +"ddxv" +"qwt\"\x27puilb\"pslmbrsxhrz" +"qdg\xc9e\\qwtknlvkol\x54oqvmchn\\" +"lvo" +"b" +"fk\"aa\"\"yenwch\\\\on" +"srig\x63hpwaavs\\\x80qzk\"xa\"\xe6u\\wr" +"yxjxuj\"ghyhhxfj\"\xa6qvatre" +"yoktqxjxkzrklkoeroil" +"\"jfmik\"" +"smgseztzdwldikbqrh\"" +"jftahgctf\"hoqy" +"tcnhicr\"znpgckt\"ble" +"vqktnkodh\"lo\"a\\bkmdjqqnsqr" +"ztnirfzqq" +"s" +"xx" +"iqj\"y\\hqgzflwrdsusasekyrxbp\\ad" +"\\xzjhlaiynkioz\"\"bxepzimvgwt" +"s\x36rbw" +"mniieztwrisvdx" +"atyfxioy\x2b\\" +"irde\x85\x5cvbah\\jekw\"ia" +"bdmftlhkwrprmpat\"prfaocvp" +"w\\k" +"umbpausy" +"zfauhpsangy" +"p\"zqyw" +"wtztypyqvnnxzvlvipnq\"zu" +"deicgwq\\oqvajpbov\\or\"kgplwu" +"mbzlfgpi\\\\zqcidjpzqdzxityxa" +"lfkxvhma" +"\xf2yduqzqr\"\\fak\"p\"n" +"mpajacfuxotonpadvng" +"anb\\telzvcdu\\a\xf2flfq" +"lrs\"ebethwpmuuc\"\x86ygr" +"qmvdbhtumzc\"ci" +"meet" +"yopg\x0fdxdq\"h\\ugsu\xffmolxjv" +"uhy" +"fzgidrtzycsireghazscvmwcfmw\\t" +"cqohkhpgvpru" +"bihyigtnvmevx\"xx" +"xz" +"zofomwotzuxsjk\"q\"mc\"js\"dnmalhxd" +"\\ktnddux\\fqvt\"ibnjntjcbn" +"ia" +"htjadnefwetyp\xd5kbrwfycbyy" +"\"\\hkuxqddnao" +"meqqsz\x83luecpgaem" +"cvks\x87frvxo\"svqivqsdpgwhukmju" +"sgmxiai\\o\"riufxwjfigr\xdf" +"fgywdfecqufccpcdn" +"faghjoq\x28abxnpxj" +"zuppgzcfb\"dctvp\"elup\"zxkopx" +"xqs\x45xxdqcihbwghmzoa" +"anbnlp\\cgcvm\"hc" +"xf\"fgrngwzys" +"nrxsjduedcy\x24" +"\x71sxl\"gj\"sds\"ulcruguz\\t\\ssvjcwhi" +"jhj\"msch" +"qpovolktfwyiuyicbfeeju\x01" +"nkyxmb\"qyqultgt\"nmvzvvnxnb" +"ycsrkbstgzqb\"uv\\cisn" +"s" +"ueptjnn\"\"sh" +"lp\"z\"d\"mxtxiy" +"yzjtvockdnvbubqabjourf\"k\"uoxwle" +"\x82\"wqm\"" +"\xb5cwtuks\x5fpgh" +"wd" +"tbvf" +"ttbmzdgn" +"vfpiyfdejyrlbgcdtwzbnm" +"uc" +"otdcmhpjagqix" +"\\\xb1qso\"s" +"scowax" +"behpstjdh\xccqlgnqjyz\"eesn" +"r\xe1cbnjwzveoomkzlo\\kxlfouhm" +"jgrl" +"kzqs\\r" +"ctscb\x7fthwkdyko\"\x62pkf\"d\xe6knmhurg" +"tc\"kw\x3ftt" +"bxb\x5ccl" +"jyrmfbphsldwpq" +"jylpvysl\"\"juducjg" +"en\\m\"kxpq\"wpb\\\"" +"madouht\"bmdwvnyqvpnawiphgac\"" +"vuxpk\"ltucrw" +"aae\x60arr" +"ttitnne\"kilkrgssnr\xfdurzh" +"oalw" +"pc\"\"gktkdykzbdpkwigucqni\"nxiqx" +"dbrsaj" +"bgzsowyxcbrvhtvekhsh\"qgd" +"kudfemvk\"\"\"hkbrbil\"chkqoa" +"zjzgj\\ekbhyfzufy" +"\\acos\"fqekuxqzxbmkbnn\x1ejzwrm" +"elxahvudn\"txtmomotgw" +"\x2eoxmwdhelpr\"cgi\xf7pzvb" +"eapheklx" +"hfvma\"mietvc\"tszbbm\"czex" +"h\"iiockj\\\xc1et" +"d\"rmjjftm" +"qlvhdcbqtyrhlc\\" +"yy\"rsucjtulm\"coryri\"eqjlbmk" +"tv" +"r\"bfuht\\jjgujp\"" +"kukxvuauamtdosngdjlkauylttaokaj" +"srgost\"\"rbkcqtlccu\x65ohjptstrjkzy" +"yxwxl\\yjilwwxffrjjuazmzjs" +"dxlw\\fkstu\"hjrtiafhyuoh\"sewabne" +"\x88sj\"v" +"rfzprz\xec\"oxqclu\"krzefp\\q" +"cfmhdbjuhrcymgxpylllyvpni" +"ucrmjvmimmcq\x88\xd9\"lz" +"lujtt\"" +"gvbqoixn\"pmledpjmo\"flydnwkfxllf" +"dvxqlbshhmelsk\x8big\"l" +"mx\x54lma\x8bbguxejg" +"\x66jdati\xeceieo" +"\"iyyupixei\x54ff" +"xohzf\"rbxsoksxamiu" +"vlhthspeshzbppa\x4drhqnohjop\"\"mfjd" +"f\"tvxxla\"vurian\"\"idjq\x3aptm\xc3olep" +"gzqz" +"kbq\\wogye\\altvi\\hbvmodny" +"j\xd8" +"ofjozdhkblvndl" +"hbitoupimbawimxlxqze" +"ypeleimnme" +"xfwdrzsc\\oxqamawyizvi\\y" +"enoikppx\xa1ixe\"yo\"gumye" +"fb" +"vzf" +"zxidr" +"cu\x31beirsywtskq" +"lxpjbvqzztafwezd" +"\\jyxeuo\x18bv" +"b\"vawc\"p\\\\giern\"b" +"odizunx\"\"t\\yicdn\"x\"sdiz" +"\"\"tebrtsi" +"ctyzsxv\xa6pegfkwsi\"tgyltaakytccb" +"htxwbofchvmzbppycccliyik\xe5a" +"ggsslefamsklezqkrd" +"rcep\"fnimwvvdx\"l" +"zyrzlqmd\x12egvqs\\llqyie" +"\x07gsqyrr\\rcyhyspsvn" +"butg\"" +"gb" +"gywkoxf\"jsg\\wtopxvumirqxlwz" +"rj\"ir\"wldwveair\x2es\"dhjrdehbqnzl" +"ru\"elktnsbxufk\\ejufjfjlevt\\lrzd" +"\"widsvok" +"oy\"\x81nuesvw" +"ay" +"syticfac\x1cfjsivwlmy\"pumsqlqqzx" +"m" +"rjjkfh\x78cf\x2brgceg\"jmdyas\"\\xlv\xb6p" +"tmuvo\"\x3ffdqdovjmdmkgpstotojkv\"as" +"jd\\ojvynhxllfzzxvbn\"wrpphcvx" +"pz" +"\"twr" +"n\\hdzmxe\"mzjjeadlz" +"fb\"rprxuagvahjnri" +"rfmexmjjgh\\xrnmyvnatrvfruflaqjnd" +"obbbde\"co\"qr\"qpiwjgqahqm\\jjp\"" +"vpbq\"\"y\"czk\\b\x52ed\"lnzepobp" +"syzeajzfarplydipny\"y\"\xe8ad" +"mpyodwb" +"\x47rakphlqqptd" +"wa\"oj\"aiy" +"a" +"ropozx" +"q\x51nbtlwa" +"etukvgx\\jqxlkq" +"\"tp\"rah\"pg\"s\"bpdtes\\tkasdhqd" +"dn\"qqpkikadowssb\xcah\"dzpsf\\ect\"jdh" +"pxunovbbrrn\\vullyn\"bno\"\"\"myfxlp\"" +"qaixyazuryvkmoulhcqaotegfj\\mpzm" +"bvfrbicutzbjwn\\oml\"cf\"d\"ezcpv\"j" +"rmbrdtneudemigdhelmb" +"aq\\aurmbhy" +"wujqvzw" +"gf\"tssmvm\"gm\"hu\x9a\xb7yjawsa" +"hrhqqxow\xe2gsydtdspcfqy\"zw\\ou" +"ianwwf\\yko\\tdujhhqdi" +"xylz\"zpvpab" +"lwuopbeeegp" +"aoop\x49jhhcexdmdtun" +"\\\\mouqqcsgmz" +"tltuvwhveau\x43b\"ymxjlcgiymcynwt" +"gsugerumpyuhtjljbhrdyoj" +"lnjm\xb8wg\"ajh" +"zmspue\"nfttdon\\b\"eww" +"\"w\x67jwaq\x7ernmyvs\\rmdsuwydsd\"th" +"ogtgvtlmcvgllyv" +"z\"fqi\"rvddoehrciyl" +"yustxxtot\"muec\"xvfdbzunzvveq" +"mqslw" +"txqnyvzmibqgjs\xb6xy\x86nfalfyx" +"kzhehlmkholov" +"plpmywcnirrjutjguosh\\" +"pydbnqofv\"dn\\m" +"aegqof" +"eambmxt\\dxagoogl\\zapfwwlmk" +"afbmqitxxqhddlozuxcpjxgh" +"vgts" +"bfdpqtoxzzhmzcilehnflna" +"s\"idpz" +"\xcfhgly\"nlmztwybx\"ecezmsxaqw" +"aackfgndqcqiy" +"\x22unqdlsrvgzfaohoffgxzfpir\"s" +"abh\"ydv\"kbpdhrerl" +"bdzpg" +"ekwgkywtmzp" +"wtoodejqmrrgslhvnk\"pi\"ldnogpth" +"njro\x68qgbx\xe4af\"\\suan" From 40f9ff8ae8d3326217a1a823eb6d41c922e934a6 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 02:35:42 +0100 Subject: [PATCH 032/100] 2015: d08: ex2: add solution --- 2015/d08/ex2/ex2.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 2015/d08/ex2/ex2.py diff --git a/2015/d08/ex2/ex2.py b/2015/d08/ex2/ex2.py new file mode 100755 index 0000000..247844b --- /dev/null +++ b/2015/d08/ex2/ex2.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +import collections +import sys + + +def solve(input: str) -> int: + def quote_len(raw: str) -> int: + characters = collections.Counter(raw) + # The `+ 2` is for the surrounding quotes + return characters.total() + characters['"'] + characters["\\"] + 2 + + strings = input.splitlines() + return sum(quote_len(raw) - len(raw) for raw in strings) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 332e7ebcfda54f92637dc172e4a94fdf0e18f36d Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 02:41:40 +0100 Subject: [PATCH 033/100] 2015: d09: ex1: add input --- 2015/d09/ex1/input | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 2015/d09/ex1/input diff --git a/2015/d09/ex1/input b/2015/d09/ex1/input new file mode 100644 index 0000000..9850564 --- /dev/null +++ b/2015/d09/ex1/input @@ -0,0 +1,28 @@ +Faerun to Norrath = 129 +Faerun to Tristram = 58 +Faerun to AlphaCentauri = 13 +Faerun to Arbre = 24 +Faerun to Snowdin = 60 +Faerun to Tambi = 71 +Faerun to Straylight = 67 +Norrath to Tristram = 142 +Norrath to AlphaCentauri = 15 +Norrath to Arbre = 135 +Norrath to Snowdin = 75 +Norrath to Tambi = 82 +Norrath to Straylight = 54 +Tristram to AlphaCentauri = 118 +Tristram to Arbre = 122 +Tristram to Snowdin = 103 +Tristram to Tambi = 49 +Tristram to Straylight = 97 +AlphaCentauri to Arbre = 116 +AlphaCentauri to Snowdin = 12 +AlphaCentauri to Tambi = 18 +AlphaCentauri to Straylight = 91 +Arbre to Snowdin = 129 +Arbre to Tambi = 53 +Arbre to Straylight = 40 +Snowdin to Tambi = 15 +Snowdin to Straylight = 99 +Tambi to Straylight = 70 From 53326d7598d523911bcc43dd7ee35011110a3b85 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 02:41:46 +0100 Subject: [PATCH 034/100] 2015: d09: ex1: add solution --- 2015/d09/ex1/ex1.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 2015/d09/ex1/ex1.py diff --git a/2015/d09/ex1/ex1.py b/2015/d09/ex1/ex1.py new file mode 100755 index 0000000..603897e --- /dev/null +++ b/2015/d09/ex1/ex1.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python + +import collections +import itertools +import sys + + +def solve(input: str) -> int: + def parse_line(input: str) -> tuple[str, str, int]: + p1, _, p2, _, dist = input.split() + return p1, p2, int(dist) + + def parse(input: str) -> dict[str, dict[str, int]]: + res: dict[str, dict[str, int]] = collections.defaultdict(dict) + for p1, p2, dist in map(parse_line, input.splitlines()): + res[p1][p2] = dist + res[p2][p1] = dist + return res + + # Boring Traveling Salesman solution + distances = parse(input) + return min( + sum(distances[s][e] for s, e in itertools.pairwise(travel_plan)) + for travel_plan in itertools.permutations(distances.keys()) + ) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From dc7d58b0764d9e5af9c745665905fc3ead2597f3 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 02:41:50 +0100 Subject: [PATCH 035/100] 2015: d09: ex2: add input --- 2015/d09/ex2/input | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 2015/d09/ex2/input diff --git a/2015/d09/ex2/input b/2015/d09/ex2/input new file mode 100644 index 0000000..9850564 --- /dev/null +++ b/2015/d09/ex2/input @@ -0,0 +1,28 @@ +Faerun to Norrath = 129 +Faerun to Tristram = 58 +Faerun to AlphaCentauri = 13 +Faerun to Arbre = 24 +Faerun to Snowdin = 60 +Faerun to Tambi = 71 +Faerun to Straylight = 67 +Norrath to Tristram = 142 +Norrath to AlphaCentauri = 15 +Norrath to Arbre = 135 +Norrath to Snowdin = 75 +Norrath to Tambi = 82 +Norrath to Straylight = 54 +Tristram to AlphaCentauri = 118 +Tristram to Arbre = 122 +Tristram to Snowdin = 103 +Tristram to Tambi = 49 +Tristram to Straylight = 97 +AlphaCentauri to Arbre = 116 +AlphaCentauri to Snowdin = 12 +AlphaCentauri to Tambi = 18 +AlphaCentauri to Straylight = 91 +Arbre to Snowdin = 129 +Arbre to Tambi = 53 +Arbre to Straylight = 40 +Snowdin to Tambi = 15 +Snowdin to Straylight = 99 +Tambi to Straylight = 70 From a3f3f2e5f639dc76db45e6d0143fd2de93f3e5f4 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 02:41:55 +0100 Subject: [PATCH 036/100] 2015: d09: ex2: add solution --- 2015/d09/ex2/ex2.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 2015/d09/ex2/ex2.py diff --git a/2015/d09/ex2/ex2.py b/2015/d09/ex2/ex2.py new file mode 100755 index 0000000..80cfdda --- /dev/null +++ b/2015/d09/ex2/ex2.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python + +import collections +import itertools +import sys + + +def solve(input: str) -> int: + def parse_line(input: str) -> tuple[str, str, int]: + p1, _, p2, _, dist = input.split() + return p1, p2, int(dist) + + def parse(input: str) -> dict[str, dict[str, int]]: + res: dict[str, dict[str, int]] = collections.defaultdict(dict) + for p1, p2, dist in map(parse_line, input.splitlines()): + res[p1][p2] = dist + res[p2][p1] = dist + return res + + # Boring Traveling Salesman solution + distances = parse(input) + return max( + sum(distances[s][e] for s, e in itertools.pairwise(travel_plan)) + for travel_plan in itertools.permutations(distances.keys()) + ) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 04dc121ae80637d14289b294f77f33f23a1cb7dc Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 02:58:15 +0100 Subject: [PATCH 037/100] 2015: d10: ex1: add input --- 2015/d10/ex1/input | 1 + 1 file changed, 1 insertion(+) create mode 100644 2015/d10/ex1/input diff --git a/2015/d10/ex1/input b/2015/d10/ex1/input new file mode 100644 index 0000000..13dcd63 --- /dev/null +++ b/2015/d10/ex1/input @@ -0,0 +1 @@ +3113322113 From e85f35a361a5726dfbb8481a37a08e3cf91cfe88 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 02:58:26 +0100 Subject: [PATCH 038/100] 2015: d10: ex1: add solution --- 2015/d10/ex1/ex1.py | 312 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 312 insertions(+) create mode 100755 2015/d10/ex1/ex1.py diff --git a/2015/d10/ex1/ex1.py b/2015/d10/ex1/ex1.py new file mode 100755 index 0000000..b433abb --- /dev/null +++ b/2015/d10/ex1/ex1.py @@ -0,0 +1,312 @@ +#!/usr/bin/env python + +import collections +import enum +import sys + + +# https://en.wikipedia.org/wiki/Look-and-say_sequence#Cosmological_decay +class Atom(enum.StrEnum): + H = "22" + He = "13112221133211322112211213322112" + Li = "312211322212221121123222112" + Be = "111312211312113221133211322112211213322112" + B = "1321132122211322212221121123222112" + C = "3113112211322112211213322112" + N = "111312212221121123222112" + O = "132112211213322112" + F = "31121123222112" + Ne = "111213322112" + Na = "123222112" + Mg = "3113322112" + Al = "1113222112" + Si = "1322112" + P = "311311222112" + S = "1113122112" + Cl = "132112" + Ar = "3112" + K = "1112" + Ca = "12" + Sc = "3113112221133112" + Ti = "11131221131112" + V = "13211312" + Cr = "31132" + Mn = "111311222112" + Fe = "13122112" + Co = "32112" + Ni = "11133112" + Cu = "131112" + Zn = "312" + Ga = "13221133122211332" + Ge = "31131122211311122113222" + As = "11131221131211322113322112" + Se = "13211321222113222112" + Br = "3113112211322112" + Kr = "11131221222112" + Rb = "1321122112" + Sr = "3112112" + Y = "1112133" + Zr = "12322211331222113112211" + Nb = "1113122113322113111221131221" + Mo = "13211322211312113211" + Tc = "311322113212221" + Ru = "132211331222113112211" + Rh = "311311222113111221131221" + Pd = "111312211312113211" + Ag = "132113212221" + Cd = "3113112211" + In = "11131221" + Sn = "13211" + Sb = "3112221" + Te = "1322113312211" + I = "311311222113111221" + Xe = "11131221131211" + Cs = "13211321" + Ba = "311311" + La = "11131" + Ce = "1321133112" + Pr = "31131112" + Nd = "111312" + Pm = "132" + Sm = "311332" + Eu = "1113222" + Gd = "13221133112" + Tb = "3113112221131112" + Dy = "111312211312" + Ho = "1321132" + Er = "311311222" + Tm = "11131221133112" + Yb = "1321131112" + Lu = "311312" + Hf = "11132" + Ta = "13112221133211322112211213322113" + W = "312211322212221121123222113" + Re = "111312211312113221133211322112211213322113" + Os = "1321132122211322212221121123222113" + Ir = "3113112211322112211213322113" + Pt = "111312212221121123222113" + Au = "132112211213322113" + Hg = "31121123222113" + Tl = "111213322113" + Pb = "123222113" + Bi = "3113322113" + Po = "1113222113" + At = "1322113" + Rn = "311311222113" + Fr = "1113122113" + Ra = "132113" + Ac = "3113" + Th = "1113" + Pa = "13" + U = "3" + + def decay(self) -> list["Atom"]: + match self: + case Atom.H: + return [Atom.H] + case Atom.He: + return [Atom.Hf, Atom.Pa, Atom.H, Atom.Ca, Atom.Li] + case Atom.Li: + return [Atom.He] + case Atom.Be: + return [Atom.Ge, Atom.Ca, Atom.Li] + case Atom.B: + return [Atom.Be] + case Atom.C: + return [Atom.B] + case Atom.N: + return [Atom.C] + case Atom.O: + return [Atom.N] + case Atom.F: + return [Atom.O] + case Atom.Ne: + return [Atom.F] + case Atom.Na: + return [Atom.Ne] + case Atom.Mg: + return [Atom.Pm, Atom.Na] + case Atom.Al: + return [Atom.Mg] + case Atom.Si: + return [Atom.Al] + case Atom.P: + return [Atom.Ho, Atom.Si] + case Atom.S: + return [Atom.P] + case Atom.Cl: + return [Atom.S] + case Atom.Ar: + return [Atom.Cl] + case Atom.K: + return [Atom.Ar] + case Atom.Ca: + return [Atom.K] + case Atom.Sc: + return [Atom.Ho, Atom.Pa, Atom.H, Atom.Ca, Atom.Co] + case Atom.Ti: + return [Atom.Sc] + case Atom.V: + return [Atom.Ti] + case Atom.Cr: + return [Atom.V] + case Atom.Mn: + return [Atom.Cr, Atom.Si] + case Atom.Fe: + return [Atom.Mn] + case Atom.Co: + return [Atom.Fe] + case Atom.Ni: + return [Atom.Zn, Atom.Co] + case Atom.Cu: + return [Atom.Ni] + case Atom.Zn: + return [Atom.Cu] + case Atom.Ga: + return [Atom.Eu, Atom.Ca, Atom.Ac, Atom.H, Atom.Ca, Atom.Zn] + case Atom.Ge: + return [Atom.Ho, Atom.Ga] + case Atom.As: + return [Atom.Ge, Atom.Na] + case Atom.Se: + return [Atom.As] + case Atom.Br: + return [Atom.Se] + case Atom.Kr: + return [Atom.Br] + case Atom.Rb: + return [Atom.Kr] + case Atom.Sr: + return [Atom.Rb] + case Atom.Y: + return [Atom.Sr, Atom.U] + case Atom.Zr: + return [Atom.Y, Atom.H, Atom.Ca, Atom.Tc] + case Atom.Nb: + return [Atom.Er, Atom.Zr] + case Atom.Mo: + return [Atom.Nb] + case Atom.Tc: + return [Atom.Mo] + case Atom.Ru: + return [Atom.Eu, Atom.Ca, Atom.Tc] + case Atom.Rh: + return [Atom.Ho, Atom.Ru] + case Atom.Pd: + return [Atom.Rh] + case Atom.Ag: + return [Atom.Pd] + case Atom.Cd: + return [Atom.Ag] + case Atom.In: + return [Atom.Cd] + case Atom.Sn: + return [Atom.In] + case Atom.Sb: + return [Atom.Pm, Atom.Sn] + case Atom.Te: + return [Atom.Eu, Atom.Ca, Atom.Sb] + case Atom.I: + return [Atom.Ho, Atom.Te] + case Atom.Xe: + return [Atom.I] + case Atom.Cs: + return [Atom.Xe] + case Atom.Ba: + return [Atom.Cs] + case Atom.La: + return [Atom.Ba] + case Atom.Ce: + return [Atom.La, Atom.H, Atom.Ca, Atom.Co] + case Atom.Pr: + return [Atom.Ce] + case Atom.Nd: + return [Atom.Pr] + case Atom.Pm: + return [Atom.Nd] + case Atom.Sm: + return [Atom.Pm, Atom.Ca, Atom.Zn] + case Atom.Eu: + return [Atom.Sm] + case Atom.Gd: + return [Atom.Eu, Atom.Ca, Atom.Co] + case Atom.Tb: + return [Atom.Ho, Atom.Gd] + case Atom.Dy: + return [Atom.Tb] + case Atom.Ho: + return [Atom.Dy] + case Atom.Er: + return [Atom.Ho, Atom.Pm] + case Atom.Tm: + return [Atom.Er, Atom.Ca, Atom.Co] + case Atom.Yb: + return [Atom.Tm] + case Atom.Lu: + return [Atom.Yb] + case Atom.Hf: + return [Atom.Lu] + case Atom.Ta: + return [Atom.Hf, Atom.Pa, Atom.H, Atom.Ca, Atom.W] + case Atom.W: + return [Atom.Ta] + case Atom.Re: + return [Atom.Ge, Atom.Ca, Atom.W] + case Atom.Os: + return [Atom.Re] + case Atom.Ir: + return [Atom.Os] + case Atom.Pt: + return [Atom.Ir] + case Atom.Au: + return [Atom.Pt] + case Atom.Hg: + return [Atom.Au] + case Atom.Tl: + return [Atom.Hg] + case Atom.Pb: + return [Atom.Tl] + case Atom.Bi: + return [Atom.Pm, Atom.Pb] + case Atom.Po: + return [Atom.Bi] + case Atom.At: + return [Atom.Po] + case Atom.Rn: + return [Atom.Ho, Atom.At] + case Atom.Fr: + return [Atom.Rn] + case Atom.Ra: + return [Atom.Fr] + case Atom.Ac: + return [Atom.Ra] + case Atom.Th: + return [Atom.Ac] + case Atom.Pa: + return [Atom.Th] + case Atom.U: + return [Atom.Pa] + + +def solve(input: str) -> int: + def look_and_say(atoms: dict[Atom, int]) -> dict[Atom, int]: + res: collections.Counter[Atom] = collections.Counter() + for atom, count in atoms.items(): + for split in atom.decay(): + res[split] += count + return res + + # Happens to work, I assume for all inputs + atoms = {Atom(input.strip()): 1} + for _ in range(40): + atoms = look_and_say(atoms) + return sum(len(atom) * count for atom, count in atoms.items()) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From a5539ea9ca6c5f75468d758a3afb9b24c46b5f39 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 02:58:33 +0100 Subject: [PATCH 039/100] 2015: d10: ex2: add input --- 2015/d10/ex2/input | 1 + 1 file changed, 1 insertion(+) create mode 100644 2015/d10/ex2/input diff --git a/2015/d10/ex2/input b/2015/d10/ex2/input new file mode 100644 index 0000000..13dcd63 --- /dev/null +++ b/2015/d10/ex2/input @@ -0,0 +1 @@ +3113322113 From 2b377c9b9b2f944ededc1a6877662d15ff82d8f8 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 02:58:43 +0100 Subject: [PATCH 040/100] 2015: d10: ex2: add solution --- 2015/d10/ex2/ex2.py | 312 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 312 insertions(+) create mode 100755 2015/d10/ex2/ex2.py diff --git a/2015/d10/ex2/ex2.py b/2015/d10/ex2/ex2.py new file mode 100755 index 0000000..1c6f40d --- /dev/null +++ b/2015/d10/ex2/ex2.py @@ -0,0 +1,312 @@ +#!/usr/bin/env python + +import collections +import enum +import sys + + +# https://en.wikipedia.org/wiki/Look-and-say_sequence#Cosmological_decay +class Atom(enum.StrEnum): + H = "22" + He = "13112221133211322112211213322112" + Li = "312211322212221121123222112" + Be = "111312211312113221133211322112211213322112" + B = "1321132122211322212221121123222112" + C = "3113112211322112211213322112" + N = "111312212221121123222112" + O = "132112211213322112" + F = "31121123222112" + Ne = "111213322112" + Na = "123222112" + Mg = "3113322112" + Al = "1113222112" + Si = "1322112" + P = "311311222112" + S = "1113122112" + Cl = "132112" + Ar = "3112" + K = "1112" + Ca = "12" + Sc = "3113112221133112" + Ti = "11131221131112" + V = "13211312" + Cr = "31132" + Mn = "111311222112" + Fe = "13122112" + Co = "32112" + Ni = "11133112" + Cu = "131112" + Zn = "312" + Ga = "13221133122211332" + Ge = "31131122211311122113222" + As = "11131221131211322113322112" + Se = "13211321222113222112" + Br = "3113112211322112" + Kr = "11131221222112" + Rb = "1321122112" + Sr = "3112112" + Y = "1112133" + Zr = "12322211331222113112211" + Nb = "1113122113322113111221131221" + Mo = "13211322211312113211" + Tc = "311322113212221" + Ru = "132211331222113112211" + Rh = "311311222113111221131221" + Pd = "111312211312113211" + Ag = "132113212221" + Cd = "3113112211" + In = "11131221" + Sn = "13211" + Sb = "3112221" + Te = "1322113312211" + I = "311311222113111221" + Xe = "11131221131211" + Cs = "13211321" + Ba = "311311" + La = "11131" + Ce = "1321133112" + Pr = "31131112" + Nd = "111312" + Pm = "132" + Sm = "311332" + Eu = "1113222" + Gd = "13221133112" + Tb = "3113112221131112" + Dy = "111312211312" + Ho = "1321132" + Er = "311311222" + Tm = "11131221133112" + Yb = "1321131112" + Lu = "311312" + Hf = "11132" + Ta = "13112221133211322112211213322113" + W = "312211322212221121123222113" + Re = "111312211312113221133211322112211213322113" + Os = "1321132122211322212221121123222113" + Ir = "3113112211322112211213322113" + Pt = "111312212221121123222113" + Au = "132112211213322113" + Hg = "31121123222113" + Tl = "111213322113" + Pb = "123222113" + Bi = "3113322113" + Po = "1113222113" + At = "1322113" + Rn = "311311222113" + Fr = "1113122113" + Ra = "132113" + Ac = "3113" + Th = "1113" + Pa = "13" + U = "3" + + def decay(self) -> list["Atom"]: + match self: + case Atom.H: + return [Atom.H] + case Atom.He: + return [Atom.Hf, Atom.Pa, Atom.H, Atom.Ca, Atom.Li] + case Atom.Li: + return [Atom.He] + case Atom.Be: + return [Atom.Ge, Atom.Ca, Atom.Li] + case Atom.B: + return [Atom.Be] + case Atom.C: + return [Atom.B] + case Atom.N: + return [Atom.C] + case Atom.O: + return [Atom.N] + case Atom.F: + return [Atom.O] + case Atom.Ne: + return [Atom.F] + case Atom.Na: + return [Atom.Ne] + case Atom.Mg: + return [Atom.Pm, Atom.Na] + case Atom.Al: + return [Atom.Mg] + case Atom.Si: + return [Atom.Al] + case Atom.P: + return [Atom.Ho, Atom.Si] + case Atom.S: + return [Atom.P] + case Atom.Cl: + return [Atom.S] + case Atom.Ar: + return [Atom.Cl] + case Atom.K: + return [Atom.Ar] + case Atom.Ca: + return [Atom.K] + case Atom.Sc: + return [Atom.Ho, Atom.Pa, Atom.H, Atom.Ca, Atom.Co] + case Atom.Ti: + return [Atom.Sc] + case Atom.V: + return [Atom.Ti] + case Atom.Cr: + return [Atom.V] + case Atom.Mn: + return [Atom.Cr, Atom.Si] + case Atom.Fe: + return [Atom.Mn] + case Atom.Co: + return [Atom.Fe] + case Atom.Ni: + return [Atom.Zn, Atom.Co] + case Atom.Cu: + return [Atom.Ni] + case Atom.Zn: + return [Atom.Cu] + case Atom.Ga: + return [Atom.Eu, Atom.Ca, Atom.Ac, Atom.H, Atom.Ca, Atom.Zn] + case Atom.Ge: + return [Atom.Ho, Atom.Ga] + case Atom.As: + return [Atom.Ge, Atom.Na] + case Atom.Se: + return [Atom.As] + case Atom.Br: + return [Atom.Se] + case Atom.Kr: + return [Atom.Br] + case Atom.Rb: + return [Atom.Kr] + case Atom.Sr: + return [Atom.Rb] + case Atom.Y: + return [Atom.Sr, Atom.U] + case Atom.Zr: + return [Atom.Y, Atom.H, Atom.Ca, Atom.Tc] + case Atom.Nb: + return [Atom.Er, Atom.Zr] + case Atom.Mo: + return [Atom.Nb] + case Atom.Tc: + return [Atom.Mo] + case Atom.Ru: + return [Atom.Eu, Atom.Ca, Atom.Tc] + case Atom.Rh: + return [Atom.Ho, Atom.Ru] + case Atom.Pd: + return [Atom.Rh] + case Atom.Ag: + return [Atom.Pd] + case Atom.Cd: + return [Atom.Ag] + case Atom.In: + return [Atom.Cd] + case Atom.Sn: + return [Atom.In] + case Atom.Sb: + return [Atom.Pm, Atom.Sn] + case Atom.Te: + return [Atom.Eu, Atom.Ca, Atom.Sb] + case Atom.I: + return [Atom.Ho, Atom.Te] + case Atom.Xe: + return [Atom.I] + case Atom.Cs: + return [Atom.Xe] + case Atom.Ba: + return [Atom.Cs] + case Atom.La: + return [Atom.Ba] + case Atom.Ce: + return [Atom.La, Atom.H, Atom.Ca, Atom.Co] + case Atom.Pr: + return [Atom.Ce] + case Atom.Nd: + return [Atom.Pr] + case Atom.Pm: + return [Atom.Nd] + case Atom.Sm: + return [Atom.Pm, Atom.Ca, Atom.Zn] + case Atom.Eu: + return [Atom.Sm] + case Atom.Gd: + return [Atom.Eu, Atom.Ca, Atom.Co] + case Atom.Tb: + return [Atom.Ho, Atom.Gd] + case Atom.Dy: + return [Atom.Tb] + case Atom.Ho: + return [Atom.Dy] + case Atom.Er: + return [Atom.Ho, Atom.Pm] + case Atom.Tm: + return [Atom.Er, Atom.Ca, Atom.Co] + case Atom.Yb: + return [Atom.Tm] + case Atom.Lu: + return [Atom.Yb] + case Atom.Hf: + return [Atom.Lu] + case Atom.Ta: + return [Atom.Hf, Atom.Pa, Atom.H, Atom.Ca, Atom.W] + case Atom.W: + return [Atom.Ta] + case Atom.Re: + return [Atom.Ge, Atom.Ca, Atom.W] + case Atom.Os: + return [Atom.Re] + case Atom.Ir: + return [Atom.Os] + case Atom.Pt: + return [Atom.Ir] + case Atom.Au: + return [Atom.Pt] + case Atom.Hg: + return [Atom.Au] + case Atom.Tl: + return [Atom.Hg] + case Atom.Pb: + return [Atom.Tl] + case Atom.Bi: + return [Atom.Pm, Atom.Pb] + case Atom.Po: + return [Atom.Bi] + case Atom.At: + return [Atom.Po] + case Atom.Rn: + return [Atom.Ho, Atom.At] + case Atom.Fr: + return [Atom.Rn] + case Atom.Ra: + return [Atom.Fr] + case Atom.Ac: + return [Atom.Ra] + case Atom.Th: + return [Atom.Ac] + case Atom.Pa: + return [Atom.Th] + case Atom.U: + return [Atom.Pa] + + +def solve(input: str) -> int: + def look_and_say(atoms: dict[Atom, int]) -> dict[Atom, int]: + res: collections.Counter[Atom] = collections.Counter() + for atom, count in atoms.items(): + for split in atom.decay(): + res[split] += count + return res + + # Happens to work, I assume for all inputs + atoms = {Atom(input.strip()): 1} + for _ in range(50): + atoms = look_and_say(atoms) + return sum(len(atom) * count for atom, count in atoms.items()) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 9a1a48e5f806793a276a523af47e580921fdd072 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 03:30:57 +0100 Subject: [PATCH 041/100] 2015: d11: ex1: add input --- 2015/d11/ex1/input | 1 + 1 file changed, 1 insertion(+) create mode 100644 2015/d11/ex1/input diff --git a/2015/d11/ex1/input b/2015/d11/ex1/input new file mode 100644 index 0000000..988745d --- /dev/null +++ b/2015/d11/ex1/input @@ -0,0 +1 @@ +vzbxkghb From baa134a8b24b40fe5303ff40d6ddcdc925664a55 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 03:31:03 +0100 Subject: [PATCH 042/100] 2015: d11: ex1: add solution --- 2015/d11/ex1/ex1.py | 70 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100755 2015/d11/ex1/ex1.py diff --git a/2015/d11/ex1/ex1.py b/2015/d11/ex1/ex1.py new file mode 100755 index 0000000..2fa6fe8 --- /dev/null +++ b/2015/d11/ex1/ex1.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python + +import collections +import itertools +import sys +from collections.abc import Iterable, Iterator +from typing import TypeVar + +T = TypeVar("T") + + +def sliding_window(iterable: Iterable[T], n: int) -> Iterator[tuple[T, ...]]: + iterator = iter(iterable) + window = collections.deque(itertools.islice(iterator, n - 1), maxlen=n) + for x in iterator: + window.append(x) + yield tuple(window) + + +def solve(input: str) -> str: + def parse(input: str) -> int: + res = 0 + for c in input.strip(): + res = res * 26 + ord(c) - ord("a") + return res + + def unparse(n: int) -> str: + # Passwords *must* have 8 characters + assert 0 <= n < 26**8 # Sanity check + return "".join(chr(ord("a") + (n // 26**i) % 26) for i in range(8))[::-1] + + def has_straight(password: str) -> bool: + for a, b, c in sliding_window(password, 3): + if ord(a) + 1 == ord(b) and ord(b) + 1 == ord(c): + return True + return False + + def no_iol(password: str) -> bool: + return not any(c in password for c in "iol") + + def has_couples(password: str) -> bool: + for i, (a, b) in enumerate(itertools.pairwise(password)): + if a != b: + continue + for c, d in itertools.pairwise(password[i + 2 :]): + if c == d: + return True + return False + return False + + n = parse(input) + while True: + n = (n + 1) % 26**8 # Restrict password to 8 characters + password = unparse(n) + if not has_straight(password): + continue + if not no_iol(password): + continue + if not has_couples(password): + continue + return password + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From e8fc688ac30edcd3c58ae1b1ec9ce08be2c5981d Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 03:31:08 +0100 Subject: [PATCH 043/100] 2015: d11: ex2: add input --- 2015/d11/ex2/input | 1 + 1 file changed, 1 insertion(+) create mode 100644 2015/d11/ex2/input diff --git a/2015/d11/ex2/input b/2015/d11/ex2/input new file mode 100644 index 0000000..988745d --- /dev/null +++ b/2015/d11/ex2/input @@ -0,0 +1 @@ +vzbxkghb From ba05a1b3a0588548ab803210d198dc09b5e430fc Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 03:31:13 +0100 Subject: [PATCH 044/100] 2015: d11: ex2: add solution --- 2015/d11/ex2/ex2.py | 73 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100755 2015/d11/ex2/ex2.py diff --git a/2015/d11/ex2/ex2.py b/2015/d11/ex2/ex2.py new file mode 100755 index 0000000..d69452b --- /dev/null +++ b/2015/d11/ex2/ex2.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python + +import collections +import itertools +import sys +from collections.abc import Iterable, Iterator +from typing import TypeVar + +T = TypeVar("T") + + +def sliding_window(iterable: Iterable[T], n: int) -> Iterator[tuple[T, ...]]: + iterator = iter(iterable) + window = collections.deque(itertools.islice(iterator, n - 1), maxlen=n) + for x in iterator: + window.append(x) + yield tuple(window) + + +def solve(input: str) -> str: + def parse(input: str) -> int: + res = 0 + for c in input.strip(): + res = res * 26 + ord(c) - ord("a") + return res + + def unparse(n: int) -> str: + # Passwords *must* have 8 characters + assert 0 <= n < 26**8 # Sanity check + return "".join(chr(ord("a") + (n // 26**i) % 26) for i in range(8))[::-1] + + def has_straight(password: str) -> bool: + for a, b, c in sliding_window(password, 3): + if ord(a) + 1 == ord(b) and ord(b) + 1 == ord(c): + return True + return False + + def no_iol(password: str) -> bool: + return not any(c in password for c in "iol") + + def has_couples(password: str) -> bool: + for i, (a, b) in enumerate(itertools.pairwise(password)): + if a != b: + continue + for c, d in itertools.pairwise(password[i + 2 :]): + if c == d: + return True + return False + return False + + def next_password(password: str) -> str: + n = parse(password) + while True: + n = (n + 1) % 26**8 # Restrict password to 8 characters + password = unparse(n) + if not has_straight(password): + continue + if not no_iol(password): + continue + if not has_couples(password): + continue + return password + + return next_password(next_password(input)) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From b1ae9d9a06f76ce19e7202d6f595f33206431530 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 03:38:24 +0100 Subject: [PATCH 045/100] 2015: d12: ex1: add input --- 2015/d12/ex1/input | 1 + 1 file changed, 1 insertion(+) create mode 100644 2015/d12/ex1/input diff --git a/2015/d12/ex1/input b/2015/d12/ex1/input new file mode 100644 index 0000000..87e5309 --- /dev/null +++ b/2015/d12/ex1/input @@ -0,0 +1 @@ +[{"a":{"e":{"e":161,"a":"blue","d":{"e":-14,"a":"red","d":{"c":"yellow","a":[-35,0],"b":"orange","d":{"e":70,"a":"green","d":"blue","j":12,"c":69,"h":"orange","b":92,"g":"yellow","f":"green","i":121}},"c":"blue","h":14,"b":46,"g":62,"f":[179]},"j":{"e":133,"c":"violet","a":"orange","b":"blue","d":"violet"},"c":{"e":151,"a":"violet","d":{"e":"red","c":93,"a":135,"g":{"e":43,"c":"green","a":"orange","b":"green","d":54},"b":69,"d":159,"f":2},"c":"green","h":65,"b":{"c":126,"a":106,"b":190,"d":-40},"g":134,"f":"red"},"h":87,"b":[-3,"yellow",50,120],"g":{"e":[138,83,"red"],"c":["yellow",["red",177,98,"blue",179,"blue","violet",23],108,["green",17,-46,3,99],-43,46,"orange","yellow",{"a":192,"b":39},57],"a":"red","b":195,"d":172},"f":97,"i":160},"a":"orange","d":120,"c":61,"h":"red","b":186,"g":{"e":"orange","a":82,"d":{"a":{"e":"green","c":-5,"a":-13,"b":12,"d":"blue","f":-19}},"c":"blue","h":["violet","violet",82,3,"orange","orange",45,"red",198,[81,"red","green","green","yellow",{"c":"orange","a":"blue","b":193},"blue"]],"b":99,"g":{"a":[64,"orange","blue",98],"b":30},"f":"orange","i":[167]},"f":[{"e":"green","c":168,"a":"red","b":173,"d":"blue"},{"e":"violet","c":90,"a":10,"g":{"a":3,"b":195},"b":"orange","d":{"e":143,"c":-26,"a":136,"g":-28,"b":137,"d":"violet","f":[108,70,19,"blue","violet","orange"]},"f":-11},{"e":188,"a":173,"d":135,"j":148,"c":"orange","h":["orange","yellow",108,"violet","violet","blue",188,"yellow","red"],"b":[145,118,"orange","green","green",17,["red",55,86,-20,"green",118,"violet","green"]],"g":{"e":62,"c":"blue","a":"violet","b":-41,"d":5},"f":"green","i":[33,"orange"]},{"a":"green"},{"a":[87,"violet"],"b":"violet"},{"e":"violet","a":147,"d":"blue","c":["blue",91,"violet","violet","yellow","orange","yellow",-4],"h":"yellow","b":19,"g":{"a":"red"},"f":[-38,"yellow","violet",-10,"orange",29,"violet",52],"i":"red"},54,[-14,-2,{"e":12,"a":"violet","d":"blue","j":"orange","c":180,"h":{"e":186,"a":"green","d":"violet","c":"orange","h":"yellow","b":"yellow","g":"green","f":"violet"},"b":"green","g":{"e":"green","c":103,"a":119,"b":"blue","d":"violet","f":116},"f":22,"i":"yellow"},["violet","blue","blue","violet",44,"orange"],144],"red",[119,"red",[10,15,115,"orange",55,"yellow",85,135,-12,"orange"],61,{"e":"red","c":"yellow","a":34,"b":"blue","d":"orange","f":"yellow"},{"c":{"c":"yellow","a":0,"b":"violet"},"a":"orange","b":"green","d":-37},-21]],"i":{"e":[{"e":123,"a":106,"d":100,"j":"violet","c":164,"h":["red",120,"orange","violet",54],"b":-22,"g":"violet","f":"orange","i":130}],"c":{"e":"blue","a":[[198,82,2,"orange",151],128,"violet",88],"d":72,"c":"blue","h":194,"b":4,"g":149,"f":"violet"},"a":[["blue",27,"green",174],"orange",50,"orange",["orange","violet",154,167],"red","orange",{"c":49,"a":"violet","b":76,"d":{"c":166,"a":"red","b":10,"d":185}},53,"yellow"],"b":"orange","d":101,"f":-1}},"b":{"e":{"e":["blue",92,-20,"red","yellow",129,99,"yellow",38],"a":98,"d":129,"c":-5,"h":"green","b":"violet","g":"blue","f":"yellow","i":"red"},"a":"blue","d":[[20,87,"red",124,-2,"yellow","red",17,"violet","yellow"],{"c":"violet","a":"red","b":161},104,{"e":["blue",[51,47,57,-41,"green",149,-11,"red",103,"orange"],"violet",72,"red",["orange","blue","red"],-8,{"c":"violet","a":68,"b":-43,"d":"green"},"orange"],"a":36,"d":["orange","green","green",106,"green","red","red","red","violet"],"j":{"a":"red","b":144},"c":166,"h":109,"b":[{"a":56,"b":"red"},-41,"blue",36,20,"blue","blue"],"g":188,"f":"yellow","i":-7},[155,["green","green",0,"red","blue"],{"e":144,"c":"green","a":"orange","b":133,"d":10,"f":[91,160,"blue",183,18,43,85,-37]},{"e":"violet","a":-35,"d":57,"c":"violet","h":17,"b":"orange","g":57,"f":"red","i":"blue"},"red","red","green","red",29,{"e":112,"c":["red","blue",68,"red","yellow"],"a":"blue","g":"blue","b":{"a":"red"},"d":162,"f":"green"}],"green",[42,"orange"],[["yellow",183,2,"red",115,"red",-31]]],"j":29,"c":{"e":[{"c":"orange","a":{"e":"orange","c":-47,"a":"blue","b":35,"d":25,"f":"blue"},"b":111,"d":16},-44,-22,179,"yellow",84],"a":{"e":178,"a":["red",183,92],"d":163,"c":105,"h":24,"b":"violet","g":-26,"f":[125,"green","violet"],"i":"red"},"d":[[12,"yellow","blue","green"],144,[114,"orange",92,"blue",["violet",40,"blue"],67,105],["orange",155,"violet",37,-38]],"j":{"a":{"c":["green","yellow",-13,"green","red"],"a":[-27],"b":"violet"},"b":["red",[109,57],181,"blue",193,-32,83,"violet"]},"c":128,"h":21,"b":{"e":"red","a":"red","d":"green","c":["green",{"a":"blue"}],"h":"orange","b":{"e":199,"c":35,"a":126,"b":183,"d":60},"g":"orange","f":"violet","i":105},"g":"yellow","f":133,"i":[{"c":"violet","a":"yellow","b":"orange","d":144},"red","yellow","green",105,72,"red","yellow"]},"h":["violet",[[161,"red","blue",[98,"red","violet"],"orange",51,"violet"],"violet",-6,"orange","yellow",51],{"e":72,"a":[190,"red","blue",-13,90,"blue",-6,"violet",137,61],"d":[126,["red",101,118],13,"blue",-4,"blue",[47,157,77]],"c":"orange","h":176,"b":{"c":[67,"green",59,"green",140,"orange","blue",15,53],"a":162,"b":"orange","d":47},"g":49,"f":"yellow","i":"violet"}],"b":{"e":132,"c":[["blue",142,"violet","green",75,56,"green","green"],"red",185,"orange","violet"],"a":144,"b":"violet","d":{"e":"green","a":"blue","d":"violet","c":["violet","yellow","orange","green",121,"blue",-23],"h":"violet","b":"yellow","g":-34,"f":147,"i":127},"f":-25},"g":"green","f":"blue","i":80}},{"e":[43,[34,"yellow",-1,{"e":[150,95],"a":"red","d":"green","j":{"e":"red","c":"yellow","a":"orange","g":-4,"b":-4,"d":{"e":108,"a":"green","d":"orange","j":70,"c":-1,"h":45,"b":"blue","g":-20,"f":"yellow","i":"yellow"},"f":-19},"c":"red","h":90,"b":-46,"g":96,"f":[44,-43,"green","green"],"i":[124,"orange",30,"blue","green","violet",66,"red","orange",125]}]],"c":{"a":[{"c":108,"a":"green","b":"orange"},"green","yellow"],"b":-11},"a":["red",["violet",132,-33,{"a":[148,-13,"orange",84,"yellow",10,"orange","blue"]},["red",-21,{"c":"green","a":"violet","b":"blue"},-1,"red",110,"yellow",51],["violet",{"a":"orange","b":127},[-14,{"a":"yellow"}],{"a":15}]]],"g":"violet","b":["green","violet"],"d":{"a":"yellow","b":"red"},"f":{"e":"green","c":{"a":"orange","b":"violet"},"a":{"c":102,"a":["red","green",{"e":"yellow","a":-41,"d":101,"j":{"a":"yellow"},"c":"yellow","h":"violet","b":19,"g":"blue","f":"yellow","i":61}],"b":["red","green"]},"g":55,"b":"violet","d":{"a":"orange","b":{"e":{"e":-5,"c":113,"a":"orange","g":"blue","b":"orange","d":35,"f":"violet"},"c":"blue","a":26,"b":150,"d":"blue"}},"f":"red"}},[{"a":[{"e":39,"a":"green","d":[[152,198,"yellow",75,"yellow",191,131,"blue"],[177,27,"blue","red"],51,129,"red",{"a":52},"green"],"c":165,"h":"blue","b":4,"g":[{"c":"yellow","a":"violet","b":15},"red","yellow","blue",52,182,{"a":83,"b":"green"},"blue",167,[103,66,105]],"f":-19,"i":162},"blue","orange",165,[153,"green",115],["orange",0,"green",{"c":"violet","a":"red","b":26,"d":198}],{"e":15,"a":["violet",58,-15,"orange",-3],"d":{"e":113,"c":59,"a":["green",-42,"violet",38,"green",-2],"b":"orange","d":"red"},"c":["green",156,"green","yellow",79,"red",126,64,"orange"],"h":"blue","b":"red","g":["orange",43,"red","yellow",{"e":"blue","a":47,"d":"red","c":"violet","h":44,"b":-15,"g":60,"f":"violet","i":-38},"orange",130,34],"f":-49,"i":"yellow"}],"b":[142,"green",[{"c":"yellow","a":181,"b":"yellow"},"blue"],{"a":[["red",35,"green","red",0,"yellow"]],"b":"yellow"},-20]},{"e":88,"a":{"e":"yellow","c":"blue","a":171,"b":{"c":[{"e":"orange","a":"orange","d":"green","c":"green","h":-13,"b":28,"g":70,"f":-30,"i":63}],"a":"green","b":"orange","d":23},"d":"red"},"d":19,"c":"violet","h":[[105,{"e":"orange","a":["red","violet",138,"blue"],"d":21,"j":-20,"c":-26,"h":143,"b":26,"g":119,"f":179,"i":"orange"},"green",["red",48,171,"blue"],"blue","yellow",{"a":"yellow","b":132}],"yellow",{"c":92,"a":{"c":-23,"a":"yellow","b":"violet"},"b":"green","d":[52,124,"violet",{"e":-19,"c":"yellow","a":181,"b":-23,"d":-7},"yellow",139,136]},117,{"e":145,"c":"blue","a":175,"b":42,"d":193}],"b":"yellow","g":[-16,-43,{"a":146,"b":[115,199,"red","violet",150]},{"a":{"c":-14,"a":129,"b":"yellow"}},64,[86,1,109,"orange",[{"e":"blue","c":"blue","a":"violet","b":"orange","d":"yellow"},149,30,"blue",112,{"e":140,"c":"green","a":139,"b":"orange","d":-8},-13,25,111],[127,183,"violet",81,"yellow",192,"blue",{"a":"blue"},"violet",105],71,"violet",18,{"c":37,"a":["red","blue"],"b":184,"d":121}],"green",["yellow",{"e":59,"c":33,"a":154,"g":97,"b":113,"d":"orange","f":23},"yellow",125,"yellow",85,99],34,{"c":100,"a":{"e":"green","a":19,"d":-2,"c":114,"h":72,"b":144,"g":96,"f":85,"i":125},"b":"green","d":-18}],"f":[[73,"blue",132,["yellow","blue","orange","blue",146,15,"orange","orange",{"e":138,"a":"violet","d":194,"c":104,"h":-4,"b":122,"g":-32,"f":"yellow"},-28]],{"e":"red","c":-6,"a":18,"g":-31,"b":44,"d":{"a":117,"b":-37},"f":{"a":"yellow"}},"orange",122,{"e":{"e":-31,"a":"yellow","d":78,"c":118,"h":"green","b":{"a":"violet","b":166},"g":167,"f":126,"i":137},"a":"yellow","d":{"c":152,"a":"blue","b":"green"},"c":"yellow","h":[14,"green",39,171,"red",46,137,-13],"b":"red","g":{"e":"green","c":136,"a":"violet","b":76,"d":"red","f":148},"f":86},-9,["green",156,119,["red",66,198,["orange",-1,34],"yellow",["violet",52,85,-5,"red"],96,43,"violet"],"red",32,95,{"e":119,"a":"blue","d":-8,"c":126,"h":17,"b":"blue","g":178,"f":"violet"},73]],"i":{"e":57,"a":"green","d":195,"c":"violet","h":23,"b":[{"c":"violet","a":122,"b":[64,"violet","green",11,"red",-18,"orange","green","yellow","orange"]},"orange","red",{"e":"violet","a":147,"d":"green","j":-34,"c":{"e":-24,"a":51,"d":"violet","c":"orange","h":121,"b":"blue","g":104,"f":152,"i":99},"h":62,"b":"yellow","g":37,"f":"orange","i":178}],"g":"yellow","f":"violet","i":112}},"violet","violet",{"a":192,"b":"yellow"},["red",["green",165],{"a":"red"},[["green","blue","red","violet",82,"violet","violet",61,86],["violet","green",[187,119,"yellow","orange",17,173],"orange",{"e":"yellow","a":193,"d":87,"c":-1,"h":-1,"b":"red","g":"green","f":"orange"},133,{"e":165,"a":["green",68,-24,"blue"],"d":129,"c":"yellow","h":52,"b":173,"g":"green","f":145},51],141,129],{"c":"red","a":14,"b":"violet","d":{"e":25,"a":118,"d":"orange","c":{"e":6,"c":169,"a":"violet","b":"orange","d":"violet"},"h":29,"b":{"e":"blue","c":"violet","a":["red",176,79,74,"violet","yellow",67,"violet","blue"],"b":"violet","d":"yellow"},"g":34,"f":[47,"green","violet","blue"]}},{"e":"blue","c":{"c":23,"a":"violet","b":16,"d":{"e":-27,"c":"orange","a":{"e":48,"a":56,"d":"yellow","c":173,"h":"violet","b":98,"g":147,"f":"green","i":69},"b":137,"d":[171,"green","orange",1,-22,17,"red","orange","green",-33],"f":"red"}},"a":[{"c":"blue","a":"red","b":-30},"red",{"e":"blue","c":154,"a":"green","b":"blue","d":"red","f":{"e":"blue","c":59,"a":"orange","g":125,"b":84,"d":"green","f":50}},[91,{"e":-20,"c":"red","a":"orange","b":-13,"d":46},79,173,["orange","blue","orange","yellow","red","violet",107,103,32]]],"b":[193,["orange",{"a":6,"b":"violet"},"violet",82,-24,"green"],197],"d":25,"f":-2},{"e":167,"a":-45,"d":"violet","c":55,"h":"red","b":"red","g":"blue","f":21,"i":{"e":198,"c":[{"c":"yellow","a":"green","b":55,"d":"violet"},[44,13,0],{"e":"red","a":197,"d":"violet","c":69,"h":80,"b":92,"g":11,"f":158,"i":130},"red"],"a":"violet","b":"red","d":"yellow"}},[{"e":88,"a":[["green",199,176,-23],{"e":128,"a":185,"d":"yellow","c":142,"h":"blue","b":"red","g":148,"f":124,"i":"violet"},15,"violet","violet",1],"d":"orange","c":"blue","h":-31,"b":[{"e":"violet","c":90,"a":"red","b":24,"d":177},190,65,-14],"g":146,"f":140,"i":126},"green",["yellow",-11,158,11,{"e":"green","c":"red","a":"red","b":{"a":168},"d":7},"orange",107,"green","red"]],167,[["green",{"e":37,"a":"blue","d":"blue","c":-48,"h":"red","b":179,"g":"blue","f":"orange"},{"c":"yellow","a":116,"b":196,"d":97},{"e":"violet","c":{"e":"green","a":"orange","d":107,"c":144,"h":"violet","b":4,"g":98,"f":147,"i":"blue"},"a":"violet","b":"orange","d":["orange",-40,"violet","violet",64],"f":191},["blue","blue"],178,"violet",["violet"]],"violet",49,"green","blue","violet",{"e":"orange","c":61,"a":"orange","b":"green","d":125,"f":["red","yellow","orange",["orange","yellow",-41,27,"violet","orange","blue"],"violet",9,"green","red"]}]],{"e":194,"a":{"e":138,"a":"violet","d":112,"c":[[184,"green","red","violet","blue","red",{"e":"yellow","c":"orange","a":-16,"g":"orange","b":115,"d":"red","f":-6}],149],"h":[-20,["yellow",50,"yellow",20,"red"],"green","blue",-38,128],"b":{"e":["orange",[160],{"e":193,"c":-18,"a":118,"g":"violet","b":"violet","d":"orange","f":"yellow"},183],"c":"red","a":"red","b":{"e":"yellow","a":"yellow","d":99,"c":-13,"h":166,"b":{"e":20,"c":183,"a":"red","b":77,"d":61},"g":-31,"f":"violet","i":"violet"},"d":"orange","f":49},"g":"green","f":166,"i":"red"},"d":{"e":[[-30,"green",-33,"blue"],-38,"red",167,"yellow",["orange",[53,145,67,109,156],"green",189,{"e":"red","c":"red","a":"orange","b":116,"d":"red","f":"violet"},-24,"orange","yellow","violet","violet"],{"e":"red","c":"violet","a":"red","b":76,"d":"blue","f":"orange"},[45,10,"green",168,-9,"violet"]],"c":{"c":[93,-6,109,[12,"orange","red","blue"],"violet"],"a":{"e":-35,"c":{"e":36,"c":-10,"a":105,"b":31,"d":"green"},"a":"green","b":40,"d":"yellow"},"b":["violet",{"e":"violet","a":"blue","d":"blue","c":75,"h":"yellow","b":"orange","g":23,"f":"violet"},187],"d":48},"a":172,"b":{"e":"red","a":"blue","d":[7,"yellow","yellow","red",-2],"c":"blue","h":"blue","b":167,"g":"violet","f":{"a":"yellow"}},"d":"green","f":"orange"},"c":{"e":["violet",{"c":"yellow","a":"violet","b":140,"d":102},62,"yellow",111,69,[84]],"a":114,"d":"violet","c":13,"h":"violet","b":"green","g":99,"f":{"e":"blue","a":"green","d":"blue","j":[-21,"blue","red",88,174,"orange",-1],"c":"yellow","h":[[68,119,152,"yellow"],132,"green","violet","violet",8,{"e":61,"c":1,"a":70,"b":"yellow","d":"blue","f":"violet"}],"b":48,"g":-39,"f":[3,142,"green","blue","violet","orange","orange","yellow","blue",114],"i":["blue","green",82,19,91,18]}},"h":-24,"b":137,"g":153,"f":0,"i":"orange"},{"e":45,"a":{"e":[[62,25,"orange",189,"orange",38,"orange"]],"c":119,"a":100,"b":["red",{"a":"green","b":[-36,"green","red","orange","violet",157,"blue","green",42]},"violet"],"d":[{"c":{"a":24,"b":77},"a":135,"b":8,"d":{"e":185,"a":"violet","d":138,"j":"green","c":-16,"h":6,"b":149,"g":23,"f":"violet","i":"blue"}}],"f":{"e":192,"c":"yellow","a":[-36,"blue",-27],"b":["green",-17,81],"d":"yellow","f":141}},"d":23,"j":{"a":[86,"blue",-22,"orange",123,56,[131,156,58,"violet","green",{"e":27,"a":56,"d":"yellow","c":35,"h":"green","b":84,"g":141,"f":65}],{"a":-17,"b":192},137]},"c":[47,{"e":{"e":95,"a":{"e":182,"a":177,"d":"blue","c":174,"h":-11,"b":"red","g":"yellow","f":"violet","i":39},"d":80,"c":"orange","h":"violet","b":112,"g":-19,"f":"green"},"c":{"c":"violet","a":-18,"b":"green","d":["red",16,-37,"blue","yellow",21,"blue"]},"a":-5,"b":106,"d":31,"f":146},46,-49,{"c":"orange","a":-20,"b":-9},["orange",{"e":["blue","blue",155,"orange","red"],"a":"violet","d":"orange","j":-33,"c":"green","h":"violet","b":"orange","g":"violet","f":173,"i":[-1,"yellow",194,"green",-31,"green"]},{"a":42,"b":{"e":"blue","a":"green","d":"yellow","j":"violet","c":121,"h":102,"b":"orange","g":-27,"f":137,"i":-23}},{"e":{"c":-25,"a":"red","b":129},"c":145,"a":34,"b":108,"d":"red"},"yellow","red","yellow",131,164,6],"yellow",{"a":["orange"],"b":31}],"h":{"e":{"e":"orange","a":"orange","d":{"c":"violet","a":{"e":"blue","a":127,"d":"blue","c":"green","h":"violet","b":88,"g":-40,"f":"yellow","i":"red"},"b":"violet"},"c":["red",{"e":"yellow","a":160,"d":"yellow","j":"blue","c":"orange","h":25,"b":41,"g":44,"f":"yellow","i":106},["yellow",197,21,115,"blue","green",144,38,-24,"blue"],"blue","blue","yellow",148],"h":"red","b":[65,41,{"a":177,"b":118},-42,{"e":13,"c":"orange","a":"violet","g":104,"b":32,"d":"blue","f":"orange"},119,"blue",-44],"g":"violet","f":87,"i":58},"a":128,"d":"green","j":"green","c":[{"a":{"e":"red","c":-24,"a":"yellow","b":"orange","d":"red","f":15}},"violet","green",165,"yellow",{"e":109,"a":101,"d":98,"c":"orange","h":"red","b":"yellow","g":"red","f":78},[166,"green","blue",-20,[33],"red",-9,"yellow","orange",112],"blue"],"h":[{"c":{"e":"yellow","c":144,"a":86,"b":"orange","d":"yellow","f":176},"a":128,"b":"violet","d":{"a":150}},71,{"e":{"a":47},"a":105,"d":45,"c":"green","h":"green","b":112,"g":"red","f":["yellow",196,170,49,"green","red"],"i":91},"blue","blue","green"],"b":{"e":["blue",-40,{"e":-46,"a":-15,"d":"green","c":"red","h":93,"b":18,"g":"yellow","f":-17},"green","violet","green","orange","orange","orange",80],"c":"orange","a":[93,"blue",199,91,"green"],"b":"green","d":{"e":70,"c":"orange","a":"blue","b":-39,"d":198,"f":"blue"}},"g":[57,"violet",81],"f":"violet","i":"violet"},"b":"blue","g":[154,"orange",["yellow",{"e":{"e":-37,"c":-6,"a":"orange","g":"violet","b":"orange","d":"orange","f":77},"c":"green","a":"violet","g":"yellow","b":157,"d":"violet","f":"red"},75,86,"orange"],[{"e":"orange","c":7,"a":["orange",-40,"red",139,"violet"],"b":34,"d":120,"f":"green"},152,119,"orange",{"e":[-5,"orange",107,105,"red","violet",104,136,"violet"],"c":9,"a":199,"b":48,"d":178,"f":152},36],"yellow",89,{"a":155,"b":107},{"a":{"c":13,"a":160,"b":114}},{"a":"yellow"}],"f":["yellow",{"a":"blue","b":157},{"e":"orange","c":[81,-48,"yellow",76,13,"red","red"],"a":{"e":"red","a":"yellow","d":"violet","j":12,"c":"green","h":"green","b":"yellow","g":"yellow","f":76,"i":-44},"b":"blue","d":"green","f":"blue"},{"c":{"a":"orange"},"a":180,"b":"orange","d":133}],"i":{"e":"violet","c":{"e":"orange","c":{"e":[13,"red","yellow","yellow","blue","green","red",156],"c":{"e":"violet","a":"violet","d":"blue","c":102,"h":-7,"b":21,"g":"blue","f":"violet"},"a":129,"b":26,"d":"green"},"a":7,"b":"green","d":"orange"},"a":"red","b":"orange","d":[["yellow",33,178,-31,194,9,126],"orange",27,7,91,[190,-27],[143,{"e":"blue","a":3,"d":5,"c":116,"h":"blue","b":"red","g":"red","f":"violet","i":39},"green",81,[-24,-34,-42,188,63,"orange"],2,172,-44,"yellow",75],{"e":-40,"a":["green","blue","violet",197,-21,"yellow","blue",84,"blue",7],"d":["red","yellow","orange",39,"orange",98,"violet",173],"c":49,"h":38,"b":184,"g":"green","f":-33}]}}],[[[{"e":["violet","blue",53],"a":{"e":77,"c":"orange","a":[166,118,"red",-6,"orange","orange","violet",74,"green"],"b":"red","d":47},"d":"violet","c":92,"h":4,"b":3,"g":{"e":"green","c":"blue","a":"yellow","g":167,"b":"green","d":-31,"f":30},"f":"orange"},{"e":"orange","c":194,"a":"violet","g":-34,"b":43,"d":"yellow","f":"blue"},"yellow",-28],[["green",181,"blue"]],175,"orange",110,198,[185,{"e":183,"c":{"c":29,"a":"blue","b":{"e":45,"a":"yellow","d":"orange","c":"green","h":155,"b":"green","g":-39,"f":"blue","i":"red"},"d":192},"a":"red","g":{"e":{"a":"violet","b":77},"a":-42,"d":57,"j":"orange","c":193,"h":62,"b":"red","g":64,"f":58,"i":"yellow"},"b":[["green",-31,"yellow",141,"yellow","red",111,167,-13,"blue"]],"d":["red",17],"f":"red"},"green",[{"e":22,"c":"orange","a":{"a":"red","b":"violet"},"b":"violet","d":{"a":167,"b":"blue"},"f":56},{"a":{"e":26,"c":145,"a":"violet","g":6,"b":13,"d":"green","f":"yellow"},"b":-41},"yellow",[[120,"red",187,124,"red","green"],"violet","red"],["yellow","violet",34],"yellow","red",71],{"c":["red","green",82,"yellow"],"a":[146,87,"green","orange",168,"yellow"],"b":{"a":["violet"]}},117,"orange",39,144],["violet",{"e":131,"a":-28,"d":["red","green","blue","blue","violet",-15,"violet"],"j":-42,"c":"orange","h":47,"b":"green","g":"yellow","f":[99,140,138],"i":"blue"},{"e":"blue","a":65,"d":"red","c":185,"h":8,"b":["orange",153,{"c":"orange","a":-40,"b":"violet"},"blue","orange",93,175],"g":-27,"f":"yellow","i":-47},48,{"c":83,"a":["blue",184,"orange","blue",{"a":167,"b":"yellow"},"violet","yellow"],"b":-27}],[[12,22,-15,"yellow",34],28,{"e":121,"c":170,"a":"red","g":{"e":13,"a":"yellow","d":44,"j":{"c":198,"a":"violet","b":176},"c":23,"h":-3,"b":"green","g":"blue","f":"violet","i":165},"b":"blue","d":64,"f":189},"yellow",-19,{"e":-49,"c":123,"a":-6,"g":"green","b":[190,"red","orange",68,98,"yellow","orange","red",{"c":68,"a":"red","b":"red"},"violet"],"d":-27,"f":"orange"},17,{"a":[105,127,{"e":-1,"a":138,"d":173,"j":"green","c":"blue","h":80,"b":"yellow","g":176,"f":"green","i":"green"},139,-41,"blue",10]},"orange"]],[[[{"e":"green","a":"blue","d":"orange","j":"blue","c":"yellow","h":"yellow","b":{"c":199,"a":"violet","b":-19},"g":"yellow","f":"red","i":"violet"},["orange"],[{"e":-20,"a":72,"d":"violet","c":"green","h":"yellow","b":20,"g":62,"f":-46},["yellow",48,44,"yellow","orange",-19,"green","red",10],{"c":0,"a":"blue","b":"green"},71,168,-27,"red"],{"e":"violet","a":{"a":"violet"},"d":-32,"c":"orange","h":"orange","b":"yellow","g":144,"f":131,"i":"orange"},"orange","violet","yellow","red"],151,[18,[{"a":"green"}],"orange","red","blue"]],{"c":91,"a":-17,"b":47,"d":46}],[["orange","green",[132],[4,156,186,{"e":148,"a":"green","d":"red","c":14,"h":34,"b":98,"g":141,"f":197,"i":"blue"},"red"],["yellow",["red","violet",-8,{"e":"orange","a":86,"d":"green","c":-49,"h":"green","b":"orange","g":107,"f":"green","i":174},101,57,"red","red",{"c":"orange","a":185,"b":84,"d":"blue"}],92,"orange","green","green",{"e":[-17,"blue","violet"],"c":["blue",80,"red"],"a":134,"g":192,"b":"green","d":"violet","f":51}],{"e":[122,"yellow","green","orange"],"a":"blue","d":113,"c":"yellow","h":"yellow","b":["violet","violet",199,71,128,["yellow","green","violet","blue",-41,"green","violet","yellow","yellow"],["yellow",190,"green","green","orange","green",-30,61]],"g":{"a":136,"b":"red"},"f":[135,"violet",60,["yellow",16,"blue"],131,"yellow",{"e":"orange","c":"violet","a":62,"b":190,"d":109},"blue",68,{"a":58,"b":-31}]},"yellow",-17,"violet","red"],44,[-39,"orange",{"e":70,"c":199,"a":73,"g":12,"b":"orange","d":6,"f":"green"},["blue","red",58,{"e":51,"c":80,"a":[46,26,"violet",64,"violet"],"b":"red","d":"red"},{"a":"yellow","b":"blue"}],196,{"a":"orange","b":{"c":"yellow","a":66,"b":161}}],157,[-25,["red",31],96,"yellow",[{"a":"green","b":9},"yellow",147,"yellow","green","orange",[-4,"green",66,152,157,["violet","violet",45,199,36,"violet",125,25]],50,["green",34,"orange",-37,33,179]],"green",{"e":"violet","a":["red",{"e":40,"a":"green","d":-24,"c":174,"h":"violet","b":"red","g":180,"f":63},"red","red",{"a":-36},178,-19,"violet",["green","red",24,"red"],"violet"],"d":{"e":24,"c":9,"a":7,"g":-41,"b":44,"d":"red","f":"violet"},"c":"violet","h":"yellow","b":["red"],"g":"yellow","f":-1,"i":["blue",53,"violet","red",87,"blue",{"e":-20,"a":130,"d":"red","c":"blue","h":58,"b":"blue","g":"blue","f":"blue","i":"yellow"},"orange","green"]},["red","green","green",-23,-6,75,"blue",{"e":112,"a":"green","d":129,"c":"yellow","h":"green","b":"yellow","g":-16,"f":194,"i":{"a":"violet","b":114}},"blue",[87,{"a":"violet"},10,65,70,"yellow",104,78,-41]],{"e":"violet","a":[[180,108],"orange","green","yellow",119,52],"d":113,"j":"red","c":[91,"green","red",41,"red",41],"h":"yellow","b":{"e":"orange","c":188,"a":77,"g":"yellow","b":"blue","d":-46,"f":"blue"},"g":"yellow","f":"yellow","i":{"e":{"e":"yellow","c":112,"a":"red","b":-36,"d":10,"f":"blue"},"a":{"a":172},"d":["green",92,87,65,123],"c":"blue","h":{"c":152,"a":"green","b":107,"d":-47},"b":"violet","g":25,"f":65,"i":"blue"}},"violet"],[["orange",{"e":"yellow","c":"orange","a":"orange","b":128,"d":145},"blue",-3,"green",108,"yellow",153],{"e":"red","c":50,"a":[90,"green",34,91,{"c":"orange","a":"red","b":197,"d":"red"}],"b":{"e":[54,"yellow","yellow"],"a":{"e":"orange","c":"yellow","a":"red","g":59,"b":"orange","d":161,"f":15},"d":"green","c":"orange","h":"green","b":25,"g":"green","f":"green","i":[191,95,-39]},"d":11},"yellow",39,"green","blue"],{"e":[[-45,[77,"yellow",-2,149,"blue",37,114],"violet",53,"green","violet",86,"green",2],135,-36,193,{"e":177,"a":33,"d":23,"j":"orange","c":-49,"h":79,"b":"violet","g":2,"f":"orange","i":-11},{"c":35,"a":"green","b":"blue"},"red",71,"violet","yellow"],"a":{"c":[100,"red",-32,"green","red","red",106,"red"],"a":"violet","b":-37,"d":{"e":145,"a":22,"d":[-45,85,-25,141],"j":"yellow","c":150,"h":[-4,"violet","green","violet",197,26,52,13,"blue",195],"b":165,"g":79,"f":-2,"i":"yellow"}},"d":[174,182,4,111,"violet",[25,"violet","yellow","red",107,124,114,"violet"],["red",57,-26,"green",131,25,"blue",["green","blue",47,-9,91,"yellow","red",-29,"red"]]],"c":[49,"violet",-24,56,99,127,26],"h":{"e":30,"a":10,"d":"violet","c":{"e":"blue","c":192,"a":86,"g":"blue","b":111,"d":[198,"green"],"f":-42},"h":-9,"b":["violet",{"e":29,"a":"blue","d":49,"j":109,"c":99,"h":-9,"b":"violet","g":"orange","f":120,"i":"orange"},["green",-7,"green"],"blue",129,"green","violet",{"e":-7,"a":"blue","d":130,"c":"green","h":126,"b":158,"g":"blue","f":132,"i":"blue"},191,"orange"],"g":183,"f":"yellow"},"b":"orange","g":[-7,"blue",{"e":"orange","a":"yellow","d":"violet","j":139,"c":33,"h":"blue","b":"red","g":-20,"f":3,"i":151},"blue",136,"orange",160],"f":[128]}],[["blue",185,57,82,{"e":"yellow","a":"red","d":"violet","c":5,"h":"yellow","b":16,"g":11,"f":-27}],[["orange",38,{"c":"green","a":"blue","b":[177,"blue","violet",-41,"orange",41,67,106]},"green","blue","red"],"violet",["green",-13,"orange",6,{"e":"red","a":116,"d":"orange","c":100,"h":"violet","b":"yellow","g":"red","f":"red","i":"red"},{"e":36,"a":"blue","d":"blue","j":135,"c":194,"h":-27,"b":["green",186,"green","violet","violet",197,32],"g":["blue"],"f":"violet","i":101},-47,"violet",30],[11,"orange",[-11,{"a":"green","b":-32},-21,133],{"a":32}],"orange",-49,102,136,"blue",125],-1,{"e":"orange","a":{"e":{"c":"violet","a":"green","b":13,"d":"blue"},"a":[{"e":"red","c":"orange","a":67,"g":"blue","b":"red","d":103,"f":176},7,5,176],"d":["orange",[-12,"orange","orange","yellow",165,152],["blue",38,"yellow","blue"],"violet",157,"orange"],"c":153,"h":"yellow","b":"green","g":["blue",[11,"red","yellow","green",16,89,"yellow"],"violet",180,120],"f":-21,"i":166},"d":["yellow",{"e":"violet","c":"green","a":"red","b":156,"d":"blue","f":{"e":38,"a":"orange","d":109,"c":"orange","h":93,"b":"green","g":-19,"f":-4}},{"e":88,"c":81,"a":50,"b":184,"d":"orange"},{"a":"green"},"red",[31,["blue",37],"violet",-5,16,"red",-43],"orange",32,[-10,72,16,138,"blue","green","violet"],"green"],"c":"violet","h":{"e":49,"c":-25,"a":"violet","b":42,"d":["red",-5,65,"green",-47,146,{"e":"red","c":167,"a":113,"b":169,"d":"red"},-19,"blue"],"f":"blue"},"b":{"a":89},"g":{"e":-42,"c":"green","a":-27,"b":{"e":"orange","a":"blue","d":"violet","j":"green","c":-8,"h":112,"b":-45,"g":-27,"f":"green","i":["violet","yellow","blue","violet",13,"blue",21]},"d":["orange",113,152,115,"red",112,-11,-5,{"e":"blue","c":"orange","a":158,"b":57,"d":"violet"}],"f":42},"f":[18,"yellow","red"],"i":-37}],{"c":[-7,"orange","green","green"],"a":{"a":"blue"},"b":{"e":"orange","a":114,"d":{"c":{"c":45,"a":26,"b":-4},"a":111,"b":["yellow",["red",196,"blue","yellow","orange","orange"],"red",-39,"orange","red","blue",{"e":"red","c":"red","a":"violet","b":"green","d":-13,"f":144},18],"d":22},"c":["green",{"c":"orange","a":20,"b":"yellow","d":120},98,107,"green","orange",181,[69,-30,{"e":"red","a":"blue","d":"orange","c":42,"h":136,"b":"blue","g":24,"f":35,"i":"red"},["violet","blue",77,152,"violet","red","orange"],185,[87,59],178,"yellow"],"violet"],"h":172,"b":{"c":"orange","a":{"e":161,"c":52,"a":33,"b":"violet","d":169,"f":122},"b":{"e":"yellow","a":-12,"d":"yellow","c":43,"h":-30,"b":"blue","g":94,"f":"yellow"},"d":{"e":0,"a":37,"d":"green","c":-30,"h":101,"b":111,"g":"orange","f":195}},"g":{"a":138,"b":"yellow"},"f":[160]},"d":"violet"},[{"c":{"e":{"e":[-30,"green",127],"c":"red","a":"red","b":123,"d":163},"c":"violet","a":[62,"red",101,103,172,"green",{"e":"orange","a":"blue","d":"green","j":23,"c":"red","h":"blue","b":43,"g":"orange","f":"red","i":-31},"violet",159],"b":"orange","d":37,"f":143},"a":"blue","b":136},{"e":74,"a":49,"d":"violet","j":176,"c":{"e":147,"c":50,"a":158,"b":{"e":55,"a":99,"d":"yellow","c":{"e":"red","a":"yellow","d":-14,"j":89,"c":79,"h":185,"b":138,"g":-1,"f":66,"i":"green"},"h":{"a":-9},"b":{"e":-19,"a":"violet","d":"red","c":-5,"h":99,"b":11,"g":"green","f":90},"g":177,"f":146,"i":"green"},"d":190,"f":{"e":"red","c":"yellow","a":"blue","g":"blue","b":135,"d":-49,"f":114}},"h":"yellow","b":88,"g":[{"a":["green","red",36,"violet"]},{"e":[118],"c":"violet","a":-4,"b":"red","d":"blue"},"violet","green",[["green","blue",81,"orange","blue","violet","violet",115,195],19,39,39,31,41,-1],"yellow",{"a":42,"b":149},79],"f":129,"i":173},["violet",{"e":48,"a":81,"d":102,"j":76,"c":182,"h":{"a":43,"b":"violet"},"b":-27,"g":166,"f":["orange",["yellow"],36,"green",[86,"green",2,"yellow",-36],83,"yellow","orange",89],"i":133},[{"a":"violet","b":"violet"},"blue","orange","orange",161,"violet",[196,-14,152,{"a":129},"violet"],181,"red","red"],{"e":"violet","c":40,"a":["orange","violet","yellow","violet","yellow",91,"orange","violet",108],"g":"orange","b":"blue","d":[{"a":"orange"},-28,7,"orange",{"a":"violet"},183],"f":-12},115,-32,"yellow","violet","orange",193],{"e":{"a":147,"b":11},"c":127,"a":79,"b":"yellow","d":-5},{"e":[{"e":1,"a":101,"d":"blue","c":[126,"violet",-24,"green"],"h":"blue","b":149,"g":"orange","f":"violet"},"red","red",{"a":5,"b":"orange"},"red"],"c":{"e":"orange","a":-49,"d":"red","j":-22,"c":{"e":"blue","c":155,"a":-2,"g":"blue","b":{"c":"violet","a":151,"b":"blue","d":"violet"},"d":{"c":55,"a":"blue","b":68,"d":"green"},"f":"green"},"h":"red","b":"red","g":27,"f":[["violet","blue"],"violet",144,111,-24,"blue","red","yellow"],"i":{"a":155,"b":38}},"a":"red","b":1,"d":"yellow","f":{"e":{"c":78,"a":40,"b":"green"},"c":"yellow","a":122,"g":"blue","b":"red","d":{"a":[70,79,65,"green",77,"red",133]},"f":[115,"blue"]}},{"c":42,"a":[{"e":"violet","c":{"e":"violet","a":"blue","d":"yellow","c":"violet","h":-24,"b":11,"g":"green","f":"green","i":"violet"},"a":122,"b":"orange","d":"violet"},[197,"blue",62,-32,127,119,"orange","blue"],121,{"c":198,"a":"orange","b":["red","yellow","yellow"],"d":"red"},-5],"b":{"e":14,"c":-41,"a":[["green",75,"yellow",138,"green","orange",42,188],21,98,109,149],"g":-36,"b":[-34,["orange","green",98,-45],[33,89,"blue","green"],184,"violet","yellow"],"d":["green",["orange",111,"blue","orange","blue","yellow","orange",189,"yellow","blue"],"orange",98,"green"],"f":[-32,{"e":-13,"c":"blue","a":108,"g":106,"b":153,"d":-45,"f":3},"blue",109,"blue"]}},[[[172,{"e":"red","a":"blue","d":71,"j":"green","c":61,"h":"orange","b":133,"g":155,"f":153,"i":169},"red",-6,"red",155],[60,130,80],"blue",["green",63,"green",127,"red"],["yellow",185,{"c":"orange","a":27,"b":"blue"},"yellow","violet",{"c":32,"a":6,"b":-37},-18],"yellow",138,["blue",{"e":94,"c":"blue","a":156,"b":-15,"d":52},101,"orange",61],"blue"],{"e":[62,"blue","red"],"a":138,"d":"red","j":"yellow","c":"blue","h":["green","green",-42,"green"],"b":["red",3,-36,"red","red","violet",{"e":"violet","a":"blue","d":77,"c":"orange","h":"yellow","b":"violet","g":"orange","f":"green","i":"blue"}],"g":[193,"blue","yellow",74,"green",-24,96,7],"f":-9,"i":"blue"},["yellow",[138,100,"orange",62,-30,"blue","green"],"yellow","violet",19]],109,{"e":"violet","a":"blue","d":90,"j":-39,"c":"green","h":[{"a":"green","b":153},91],"b":189,"g":"blue","f":"orange","i":"green"}],{"a":{"c":"green","a":34,"b":["yellow",181,-2,126,"blue","orange","violet"],"d":["red","violet",133,[192,176,16,"blue",3],[96,"blue","red","orange",[-16,"red",119,"yellow","orange","red",149,"red"],"red","violet","violet",-17,"yellow"],["blue"],"blue","green","blue"]},"b":{"a":"green","b":"violet"}},{"e":{"e":170,"c":139,"a":[{"e":-15,"a":78,"d":"violet","j":-1,"c":7,"h":71,"b":[116,-1,-25,-20],"g":"blue","f":"green","i":68},-25,[[125,"orange",134,"orange",35,50,126],-3,[166,"red",33,"red",85],-33,"orange",[198,"violet","red","blue",106,141,-45],-47],77,[["violet",74,"green","yellow",130,"violet"],9],{"e":9,"a":140,"d":111,"c":"yellow","h":"orange","b":"yellow","g":"violet","f":"red"}],"b":{"e":"green","c":167,"a":[16,-5,"green","red","green"],"b":-27,"d":"blue","f":"orange"},"d":{"e":{"c":66,"a":{"e":"red","a":"violet","d":"yellow","j":"red","c":"blue","h":-32,"b":95,"g":"violet","f":31,"i":"red"},"b":"blue","d":"blue"},"a":"red","d":{"c":75,"a":"yellow","b":"green","d":["green",-21,171,"yellow","blue",131,0,-33]},"c":[164,"orange"],"h":"red","b":118,"g":161,"f":"yellow","i":{"e":"violet","a":"green","d":{"e":123,"c":"violet","a":"orange","g":46,"b":-29,"d":"yellow","f":43},"c":-44,"h":"green","b":{"c":"green","a":81,"b":31,"d":"blue"},"g":"yellow","f":3}},"f":"green"},"c":"yellow","a":[["yellow","blue","red",168,69,[-44,"orange"],{"e":"blue","c":"yellow","a":65,"b":"yellow","d":"red","f":"orange"},"green","blue","blue"],{"e":{"c":48,"a":-39,"b":["orange",127,"blue","blue",92,"green"],"d":"red"},"a":-41,"d":"blue","j":"blue","c":134,"h":["violet","red"],"b":-48,"g":13,"f":"blue","i":["red",131,"blue","orange","green","green",161]},{"e":197,"a":-17,"d":-48,"c":"violet","h":177,"b":123,"g":"violet","f":-12,"i":[52,148,"violet","red",128,["blue"]]},[17,-28,{"e":-20,"a":{"a":"violet"},"d":"yellow","c":{"a":"blue","b":"violet"},"h":11,"b":39,"g":{"e":"blue","a":"green","d":"violet","c":"orange","h":"blue","b":132,"g":137,"f":"red"},"f":"blue","i":[187]},{"e":"violet","c":149,"a":"green","g":"red","b":72,"d":[-5],"f":{"c":11,"a":-2,"b":"green"}},-6,["green","yellow","yellow",{"e":"orange","c":"red","a":185,"b":"green","d":"red"}]],4],"g":"orange","b":[{"e":["violet","violet","green",119,-26],"a":"blue","d":"red","c":{"e":-38,"c":"green","a":17,"b":{"a":-31},"d":"yellow"},"h":["red","violet",-13,-41,[197,"violet","orange",150,"violet",156,161,179,70,"red"],143,110,-2,"blue","green"],"b":"green","g":"blue","f":"red"},"orange",{"c":[26,{"c":-21,"a":"green","b":"red"},"blue","orange",-23,"green",179,["orange"],{"e":"orange","c":"blue","a":"green","b":169,"d":"red"},"orange"],"a":"violet","b":"blue","d":175},60,"orange",[-44,{"e":"green","c":"orange","a":-41,"b":"violet","d":[0,"orange","green"]},"blue",["violet",[26,-9,"yellow",101,6,"yellow",161],81,104,"red","red","violet","red",180,60],114],"orange",15,22,"yellow"],"d":[53,"yellow",{"e":{"e":[99],"a":51,"d":["orange","yellow",114],"c":67,"h":{"e":109,"c":"violet","a":"orange","g":"orange","b":"blue","d":"orange","f":-4},"b":-27,"g":[93,"orange"],"f":"blue","i":"red"},"a":"red","d":37,"j":{"c":"red","a":"blue","b":"orange","d":{"a":"violet"}},"c":["green"],"h":"orange","b":[32,{"c":"red","a":"red","b":34},81,-3,{"c":"red","a":133,"b":-47,"d":112},"green","green","orange",{"e":"blue","a":"orange","d":"green","j":45,"c":-16,"h":78,"b":-28,"g":"yellow","f":"blue","i":130},0],"g":116,"f":-5,"i":"red"},"yellow","blue",152],"f":{"c":{"e":116,"c":"orange","a":128,"b":"blue","d":"blue"},"a":2,"b":{"c":101,"a":-48,"b":["yellow",106,179,["orange",97,104,"violet","orange","blue","orange"],{"e":"blue","a":183,"d":"red","c":-8,"h":26,"b":"orange","g":4,"f":"orange"},"violet","green","blue","green"]}}}],[{"e":10,"c":[[{"a":195},"yellow",[89,"orange","blue",[158,"violet",-41,174,135,"red",-21,182,"yellow","green"]],"green",{"e":"orange","a":[159,-6],"d":"yellow","j":"violet","c":"green","h":-23,"b":"orange","g":108,"f":"orange","i":53},["blue"],["blue","blue",[3,"violet","red"],"violet","yellow","violet"],85,92,"yellow"],{"a":"violet","b":188},"violet",{"a":197}],"a":-46,"g":"yellow","b":[54,["yellow","orange","violet",168,197,125,{"e":"blue","c":-24,"a":"orange","g":164,"b":"red","d":148,"f":{"e":48,"c":61,"a":"yellow","g":"blue","b":-46,"d":56,"f":-4}},{"a":["blue",131,6]},{"c":[179],"a":-13,"b":"violet","d":-34},-22],"violet",187],"d":34,"f":"yellow"},197,[{"e":52,"c":96,"a":{"e":59,"c":"orange","a":73,"b":["blue","green"],"d":-22},"b":{"e":["blue",152],"a":123,"d":"green","c":28,"h":-33,"b":-8,"g":"violet","f":167,"i":-29},"d":[[-21,"yellow"],52,"blue","red"]},-21],176,[[[193],53]],[[175,{"e":"red","a":132,"d":113,"c":["yellow"],"h":["red",185,129,57,"violet",135,"green","yellow","blue","green"],"b":"orange","g":-20,"f":{"c":"red","a":"orange","b":{"a":"violet","b":11}},"i":141},28,{"e":-4,"a":{"e":51,"a":171,"d":103,"c":{"e":-9,"a":144,"d":"green","j":"orange","c":"violet","h":126,"b":"yellow","g":60,"f":"violet","i":"orange"},"h":{"e":-40,"c":99,"a":"orange","g":"green","b":"red","d":128,"f":"blue"},"b":"green","g":82,"f":-23},"d":-16,"j":"violet","c":108,"h":140,"b":"yellow","g":"blue","f":84,"i":"orange"},[{"e":"red","c":-31,"a":-23,"g":-11,"b":25,"d":"green","f":"green"},{"e":"blue","c":180,"a":58,"b":-27,"d":60,"f":79},"orange",172],"red"],["orange",{"c":64,"a":109,"b":-14,"d":"red"},{"a":70,"b":"orange"},["violet",17],{"e":"violet","a":[141,"blue",{"a":"red"},[142,"red","violet","violet",-45,58,78,"yellow","orange"],"orange"],"d":{"e":"green","a":"red","d":86,"c":{"e":-44,"a":33,"d":"violet","c":188,"h":"red","b":-36,"g":"blue","f":"yellow"},"h":"red","b":186,"g":166,"f":"red"},"c":20,"h":"red","b":["violet",{"e":"blue","a":187,"d":115,"j":193,"c":119,"h":"yellow","b":"yellow","g":"red","f":74,"i":25},"orange",0,-17,"yellow",-23],"g":199,"f":76}]]]] From a0d227c53e3360ec556557a1126478dbce8c861b Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 03:38:29 +0100 Subject: [PATCH 046/100] 2015: d12: ex1: add solution --- 2015/d12/ex1/ex1.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 2015/d12/ex1/ex1.py diff --git a/2015/d12/ex1/ex1.py b/2015/d12/ex1/ex1.py new file mode 100755 index 0000000..c622db9 --- /dev/null +++ b/2015/d12/ex1/ex1.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python + +import json +import sys +from collections.abc import Iterator + +JSONValue = int | str | list["JSONValue"] | dict[str, "JSONValue"] + + +def solve(input: str) -> int: + def parse(input: str) -> JSONValue: + return json.loads(input) + + def all_numbers(doc: JSONValue) -> Iterator[int]: + if isinstance(doc, int): + yield doc + elif isinstance(doc, list): + for it in doc: + yield from all_numbers(it) + elif isinstance(doc, dict): + for it in doc.values(): + yield from all_numbers(it) + + doc = parse(input) + return sum(all_numbers(doc)) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 8ac7dfe5a7b5a1e3f67b17c9be59cd31535a88a4 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 03:38:33 +0100 Subject: [PATCH 047/100] 2015: d12: ex2: add input --- 2015/d12/ex2/input | 1 + 1 file changed, 1 insertion(+) create mode 100644 2015/d12/ex2/input diff --git a/2015/d12/ex2/input b/2015/d12/ex2/input new file mode 100644 index 0000000..87e5309 --- /dev/null +++ b/2015/d12/ex2/input @@ -0,0 +1 @@ +[{"a":{"e":{"e":161,"a":"blue","d":{"e":-14,"a":"red","d":{"c":"yellow","a":[-35,0],"b":"orange","d":{"e":70,"a":"green","d":"blue","j":12,"c":69,"h":"orange","b":92,"g":"yellow","f":"green","i":121}},"c":"blue","h":14,"b":46,"g":62,"f":[179]},"j":{"e":133,"c":"violet","a":"orange","b":"blue","d":"violet"},"c":{"e":151,"a":"violet","d":{"e":"red","c":93,"a":135,"g":{"e":43,"c":"green","a":"orange","b":"green","d":54},"b":69,"d":159,"f":2},"c":"green","h":65,"b":{"c":126,"a":106,"b":190,"d":-40},"g":134,"f":"red"},"h":87,"b":[-3,"yellow",50,120],"g":{"e":[138,83,"red"],"c":["yellow",["red",177,98,"blue",179,"blue","violet",23],108,["green",17,-46,3,99],-43,46,"orange","yellow",{"a":192,"b":39},57],"a":"red","b":195,"d":172},"f":97,"i":160},"a":"orange","d":120,"c":61,"h":"red","b":186,"g":{"e":"orange","a":82,"d":{"a":{"e":"green","c":-5,"a":-13,"b":12,"d":"blue","f":-19}},"c":"blue","h":["violet","violet",82,3,"orange","orange",45,"red",198,[81,"red","green","green","yellow",{"c":"orange","a":"blue","b":193},"blue"]],"b":99,"g":{"a":[64,"orange","blue",98],"b":30},"f":"orange","i":[167]},"f":[{"e":"green","c":168,"a":"red","b":173,"d":"blue"},{"e":"violet","c":90,"a":10,"g":{"a":3,"b":195},"b":"orange","d":{"e":143,"c":-26,"a":136,"g":-28,"b":137,"d":"violet","f":[108,70,19,"blue","violet","orange"]},"f":-11},{"e":188,"a":173,"d":135,"j":148,"c":"orange","h":["orange","yellow",108,"violet","violet","blue",188,"yellow","red"],"b":[145,118,"orange","green","green",17,["red",55,86,-20,"green",118,"violet","green"]],"g":{"e":62,"c":"blue","a":"violet","b":-41,"d":5},"f":"green","i":[33,"orange"]},{"a":"green"},{"a":[87,"violet"],"b":"violet"},{"e":"violet","a":147,"d":"blue","c":["blue",91,"violet","violet","yellow","orange","yellow",-4],"h":"yellow","b":19,"g":{"a":"red"},"f":[-38,"yellow","violet",-10,"orange",29,"violet",52],"i":"red"},54,[-14,-2,{"e":12,"a":"violet","d":"blue","j":"orange","c":180,"h":{"e":186,"a":"green","d":"violet","c":"orange","h":"yellow","b":"yellow","g":"green","f":"violet"},"b":"green","g":{"e":"green","c":103,"a":119,"b":"blue","d":"violet","f":116},"f":22,"i":"yellow"},["violet","blue","blue","violet",44,"orange"],144],"red",[119,"red",[10,15,115,"orange",55,"yellow",85,135,-12,"orange"],61,{"e":"red","c":"yellow","a":34,"b":"blue","d":"orange","f":"yellow"},{"c":{"c":"yellow","a":0,"b":"violet"},"a":"orange","b":"green","d":-37},-21]],"i":{"e":[{"e":123,"a":106,"d":100,"j":"violet","c":164,"h":["red",120,"orange","violet",54],"b":-22,"g":"violet","f":"orange","i":130}],"c":{"e":"blue","a":[[198,82,2,"orange",151],128,"violet",88],"d":72,"c":"blue","h":194,"b":4,"g":149,"f":"violet"},"a":[["blue",27,"green",174],"orange",50,"orange",["orange","violet",154,167],"red","orange",{"c":49,"a":"violet","b":76,"d":{"c":166,"a":"red","b":10,"d":185}},53,"yellow"],"b":"orange","d":101,"f":-1}},"b":{"e":{"e":["blue",92,-20,"red","yellow",129,99,"yellow",38],"a":98,"d":129,"c":-5,"h":"green","b":"violet","g":"blue","f":"yellow","i":"red"},"a":"blue","d":[[20,87,"red",124,-2,"yellow","red",17,"violet","yellow"],{"c":"violet","a":"red","b":161},104,{"e":["blue",[51,47,57,-41,"green",149,-11,"red",103,"orange"],"violet",72,"red",["orange","blue","red"],-8,{"c":"violet","a":68,"b":-43,"d":"green"},"orange"],"a":36,"d":["orange","green","green",106,"green","red","red","red","violet"],"j":{"a":"red","b":144},"c":166,"h":109,"b":[{"a":56,"b":"red"},-41,"blue",36,20,"blue","blue"],"g":188,"f":"yellow","i":-7},[155,["green","green",0,"red","blue"],{"e":144,"c":"green","a":"orange","b":133,"d":10,"f":[91,160,"blue",183,18,43,85,-37]},{"e":"violet","a":-35,"d":57,"c":"violet","h":17,"b":"orange","g":57,"f":"red","i":"blue"},"red","red","green","red",29,{"e":112,"c":["red","blue",68,"red","yellow"],"a":"blue","g":"blue","b":{"a":"red"},"d":162,"f":"green"}],"green",[42,"orange"],[["yellow",183,2,"red",115,"red",-31]]],"j":29,"c":{"e":[{"c":"orange","a":{"e":"orange","c":-47,"a":"blue","b":35,"d":25,"f":"blue"},"b":111,"d":16},-44,-22,179,"yellow",84],"a":{"e":178,"a":["red",183,92],"d":163,"c":105,"h":24,"b":"violet","g":-26,"f":[125,"green","violet"],"i":"red"},"d":[[12,"yellow","blue","green"],144,[114,"orange",92,"blue",["violet",40,"blue"],67,105],["orange",155,"violet",37,-38]],"j":{"a":{"c":["green","yellow",-13,"green","red"],"a":[-27],"b":"violet"},"b":["red",[109,57],181,"blue",193,-32,83,"violet"]},"c":128,"h":21,"b":{"e":"red","a":"red","d":"green","c":["green",{"a":"blue"}],"h":"orange","b":{"e":199,"c":35,"a":126,"b":183,"d":60},"g":"orange","f":"violet","i":105},"g":"yellow","f":133,"i":[{"c":"violet","a":"yellow","b":"orange","d":144},"red","yellow","green",105,72,"red","yellow"]},"h":["violet",[[161,"red","blue",[98,"red","violet"],"orange",51,"violet"],"violet",-6,"orange","yellow",51],{"e":72,"a":[190,"red","blue",-13,90,"blue",-6,"violet",137,61],"d":[126,["red",101,118],13,"blue",-4,"blue",[47,157,77]],"c":"orange","h":176,"b":{"c":[67,"green",59,"green",140,"orange","blue",15,53],"a":162,"b":"orange","d":47},"g":49,"f":"yellow","i":"violet"}],"b":{"e":132,"c":[["blue",142,"violet","green",75,56,"green","green"],"red",185,"orange","violet"],"a":144,"b":"violet","d":{"e":"green","a":"blue","d":"violet","c":["violet","yellow","orange","green",121,"blue",-23],"h":"violet","b":"yellow","g":-34,"f":147,"i":127},"f":-25},"g":"green","f":"blue","i":80}},{"e":[43,[34,"yellow",-1,{"e":[150,95],"a":"red","d":"green","j":{"e":"red","c":"yellow","a":"orange","g":-4,"b":-4,"d":{"e":108,"a":"green","d":"orange","j":70,"c":-1,"h":45,"b":"blue","g":-20,"f":"yellow","i":"yellow"},"f":-19},"c":"red","h":90,"b":-46,"g":96,"f":[44,-43,"green","green"],"i":[124,"orange",30,"blue","green","violet",66,"red","orange",125]}]],"c":{"a":[{"c":108,"a":"green","b":"orange"},"green","yellow"],"b":-11},"a":["red",["violet",132,-33,{"a":[148,-13,"orange",84,"yellow",10,"orange","blue"]},["red",-21,{"c":"green","a":"violet","b":"blue"},-1,"red",110,"yellow",51],["violet",{"a":"orange","b":127},[-14,{"a":"yellow"}],{"a":15}]]],"g":"violet","b":["green","violet"],"d":{"a":"yellow","b":"red"},"f":{"e":"green","c":{"a":"orange","b":"violet"},"a":{"c":102,"a":["red","green",{"e":"yellow","a":-41,"d":101,"j":{"a":"yellow"},"c":"yellow","h":"violet","b":19,"g":"blue","f":"yellow","i":61}],"b":["red","green"]},"g":55,"b":"violet","d":{"a":"orange","b":{"e":{"e":-5,"c":113,"a":"orange","g":"blue","b":"orange","d":35,"f":"violet"},"c":"blue","a":26,"b":150,"d":"blue"}},"f":"red"}},[{"a":[{"e":39,"a":"green","d":[[152,198,"yellow",75,"yellow",191,131,"blue"],[177,27,"blue","red"],51,129,"red",{"a":52},"green"],"c":165,"h":"blue","b":4,"g":[{"c":"yellow","a":"violet","b":15},"red","yellow","blue",52,182,{"a":83,"b":"green"},"blue",167,[103,66,105]],"f":-19,"i":162},"blue","orange",165,[153,"green",115],["orange",0,"green",{"c":"violet","a":"red","b":26,"d":198}],{"e":15,"a":["violet",58,-15,"orange",-3],"d":{"e":113,"c":59,"a":["green",-42,"violet",38,"green",-2],"b":"orange","d":"red"},"c":["green",156,"green","yellow",79,"red",126,64,"orange"],"h":"blue","b":"red","g":["orange",43,"red","yellow",{"e":"blue","a":47,"d":"red","c":"violet","h":44,"b":-15,"g":60,"f":"violet","i":-38},"orange",130,34],"f":-49,"i":"yellow"}],"b":[142,"green",[{"c":"yellow","a":181,"b":"yellow"},"blue"],{"a":[["red",35,"green","red",0,"yellow"]],"b":"yellow"},-20]},{"e":88,"a":{"e":"yellow","c":"blue","a":171,"b":{"c":[{"e":"orange","a":"orange","d":"green","c":"green","h":-13,"b":28,"g":70,"f":-30,"i":63}],"a":"green","b":"orange","d":23},"d":"red"},"d":19,"c":"violet","h":[[105,{"e":"orange","a":["red","violet",138,"blue"],"d":21,"j":-20,"c":-26,"h":143,"b":26,"g":119,"f":179,"i":"orange"},"green",["red",48,171,"blue"],"blue","yellow",{"a":"yellow","b":132}],"yellow",{"c":92,"a":{"c":-23,"a":"yellow","b":"violet"},"b":"green","d":[52,124,"violet",{"e":-19,"c":"yellow","a":181,"b":-23,"d":-7},"yellow",139,136]},117,{"e":145,"c":"blue","a":175,"b":42,"d":193}],"b":"yellow","g":[-16,-43,{"a":146,"b":[115,199,"red","violet",150]},{"a":{"c":-14,"a":129,"b":"yellow"}},64,[86,1,109,"orange",[{"e":"blue","c":"blue","a":"violet","b":"orange","d":"yellow"},149,30,"blue",112,{"e":140,"c":"green","a":139,"b":"orange","d":-8},-13,25,111],[127,183,"violet",81,"yellow",192,"blue",{"a":"blue"},"violet",105],71,"violet",18,{"c":37,"a":["red","blue"],"b":184,"d":121}],"green",["yellow",{"e":59,"c":33,"a":154,"g":97,"b":113,"d":"orange","f":23},"yellow",125,"yellow",85,99],34,{"c":100,"a":{"e":"green","a":19,"d":-2,"c":114,"h":72,"b":144,"g":96,"f":85,"i":125},"b":"green","d":-18}],"f":[[73,"blue",132,["yellow","blue","orange","blue",146,15,"orange","orange",{"e":138,"a":"violet","d":194,"c":104,"h":-4,"b":122,"g":-32,"f":"yellow"},-28]],{"e":"red","c":-6,"a":18,"g":-31,"b":44,"d":{"a":117,"b":-37},"f":{"a":"yellow"}},"orange",122,{"e":{"e":-31,"a":"yellow","d":78,"c":118,"h":"green","b":{"a":"violet","b":166},"g":167,"f":126,"i":137},"a":"yellow","d":{"c":152,"a":"blue","b":"green"},"c":"yellow","h":[14,"green",39,171,"red",46,137,-13],"b":"red","g":{"e":"green","c":136,"a":"violet","b":76,"d":"red","f":148},"f":86},-9,["green",156,119,["red",66,198,["orange",-1,34],"yellow",["violet",52,85,-5,"red"],96,43,"violet"],"red",32,95,{"e":119,"a":"blue","d":-8,"c":126,"h":17,"b":"blue","g":178,"f":"violet"},73]],"i":{"e":57,"a":"green","d":195,"c":"violet","h":23,"b":[{"c":"violet","a":122,"b":[64,"violet","green",11,"red",-18,"orange","green","yellow","orange"]},"orange","red",{"e":"violet","a":147,"d":"green","j":-34,"c":{"e":-24,"a":51,"d":"violet","c":"orange","h":121,"b":"blue","g":104,"f":152,"i":99},"h":62,"b":"yellow","g":37,"f":"orange","i":178}],"g":"yellow","f":"violet","i":112}},"violet","violet",{"a":192,"b":"yellow"},["red",["green",165],{"a":"red"},[["green","blue","red","violet",82,"violet","violet",61,86],["violet","green",[187,119,"yellow","orange",17,173],"orange",{"e":"yellow","a":193,"d":87,"c":-1,"h":-1,"b":"red","g":"green","f":"orange"},133,{"e":165,"a":["green",68,-24,"blue"],"d":129,"c":"yellow","h":52,"b":173,"g":"green","f":145},51],141,129],{"c":"red","a":14,"b":"violet","d":{"e":25,"a":118,"d":"orange","c":{"e":6,"c":169,"a":"violet","b":"orange","d":"violet"},"h":29,"b":{"e":"blue","c":"violet","a":["red",176,79,74,"violet","yellow",67,"violet","blue"],"b":"violet","d":"yellow"},"g":34,"f":[47,"green","violet","blue"]}},{"e":"blue","c":{"c":23,"a":"violet","b":16,"d":{"e":-27,"c":"orange","a":{"e":48,"a":56,"d":"yellow","c":173,"h":"violet","b":98,"g":147,"f":"green","i":69},"b":137,"d":[171,"green","orange",1,-22,17,"red","orange","green",-33],"f":"red"}},"a":[{"c":"blue","a":"red","b":-30},"red",{"e":"blue","c":154,"a":"green","b":"blue","d":"red","f":{"e":"blue","c":59,"a":"orange","g":125,"b":84,"d":"green","f":50}},[91,{"e":-20,"c":"red","a":"orange","b":-13,"d":46},79,173,["orange","blue","orange","yellow","red","violet",107,103,32]]],"b":[193,["orange",{"a":6,"b":"violet"},"violet",82,-24,"green"],197],"d":25,"f":-2},{"e":167,"a":-45,"d":"violet","c":55,"h":"red","b":"red","g":"blue","f":21,"i":{"e":198,"c":[{"c":"yellow","a":"green","b":55,"d":"violet"},[44,13,0],{"e":"red","a":197,"d":"violet","c":69,"h":80,"b":92,"g":11,"f":158,"i":130},"red"],"a":"violet","b":"red","d":"yellow"}},[{"e":88,"a":[["green",199,176,-23],{"e":128,"a":185,"d":"yellow","c":142,"h":"blue","b":"red","g":148,"f":124,"i":"violet"},15,"violet","violet",1],"d":"orange","c":"blue","h":-31,"b":[{"e":"violet","c":90,"a":"red","b":24,"d":177},190,65,-14],"g":146,"f":140,"i":126},"green",["yellow",-11,158,11,{"e":"green","c":"red","a":"red","b":{"a":168},"d":7},"orange",107,"green","red"]],167,[["green",{"e":37,"a":"blue","d":"blue","c":-48,"h":"red","b":179,"g":"blue","f":"orange"},{"c":"yellow","a":116,"b":196,"d":97},{"e":"violet","c":{"e":"green","a":"orange","d":107,"c":144,"h":"violet","b":4,"g":98,"f":147,"i":"blue"},"a":"violet","b":"orange","d":["orange",-40,"violet","violet",64],"f":191},["blue","blue"],178,"violet",["violet"]],"violet",49,"green","blue","violet",{"e":"orange","c":61,"a":"orange","b":"green","d":125,"f":["red","yellow","orange",["orange","yellow",-41,27,"violet","orange","blue"],"violet",9,"green","red"]}]],{"e":194,"a":{"e":138,"a":"violet","d":112,"c":[[184,"green","red","violet","blue","red",{"e":"yellow","c":"orange","a":-16,"g":"orange","b":115,"d":"red","f":-6}],149],"h":[-20,["yellow",50,"yellow",20,"red"],"green","blue",-38,128],"b":{"e":["orange",[160],{"e":193,"c":-18,"a":118,"g":"violet","b":"violet","d":"orange","f":"yellow"},183],"c":"red","a":"red","b":{"e":"yellow","a":"yellow","d":99,"c":-13,"h":166,"b":{"e":20,"c":183,"a":"red","b":77,"d":61},"g":-31,"f":"violet","i":"violet"},"d":"orange","f":49},"g":"green","f":166,"i":"red"},"d":{"e":[[-30,"green",-33,"blue"],-38,"red",167,"yellow",["orange",[53,145,67,109,156],"green",189,{"e":"red","c":"red","a":"orange","b":116,"d":"red","f":"violet"},-24,"orange","yellow","violet","violet"],{"e":"red","c":"violet","a":"red","b":76,"d":"blue","f":"orange"},[45,10,"green",168,-9,"violet"]],"c":{"c":[93,-6,109,[12,"orange","red","blue"],"violet"],"a":{"e":-35,"c":{"e":36,"c":-10,"a":105,"b":31,"d":"green"},"a":"green","b":40,"d":"yellow"},"b":["violet",{"e":"violet","a":"blue","d":"blue","c":75,"h":"yellow","b":"orange","g":23,"f":"violet"},187],"d":48},"a":172,"b":{"e":"red","a":"blue","d":[7,"yellow","yellow","red",-2],"c":"blue","h":"blue","b":167,"g":"violet","f":{"a":"yellow"}},"d":"green","f":"orange"},"c":{"e":["violet",{"c":"yellow","a":"violet","b":140,"d":102},62,"yellow",111,69,[84]],"a":114,"d":"violet","c":13,"h":"violet","b":"green","g":99,"f":{"e":"blue","a":"green","d":"blue","j":[-21,"blue","red",88,174,"orange",-1],"c":"yellow","h":[[68,119,152,"yellow"],132,"green","violet","violet",8,{"e":61,"c":1,"a":70,"b":"yellow","d":"blue","f":"violet"}],"b":48,"g":-39,"f":[3,142,"green","blue","violet","orange","orange","yellow","blue",114],"i":["blue","green",82,19,91,18]}},"h":-24,"b":137,"g":153,"f":0,"i":"orange"},{"e":45,"a":{"e":[[62,25,"orange",189,"orange",38,"orange"]],"c":119,"a":100,"b":["red",{"a":"green","b":[-36,"green","red","orange","violet",157,"blue","green",42]},"violet"],"d":[{"c":{"a":24,"b":77},"a":135,"b":8,"d":{"e":185,"a":"violet","d":138,"j":"green","c":-16,"h":6,"b":149,"g":23,"f":"violet","i":"blue"}}],"f":{"e":192,"c":"yellow","a":[-36,"blue",-27],"b":["green",-17,81],"d":"yellow","f":141}},"d":23,"j":{"a":[86,"blue",-22,"orange",123,56,[131,156,58,"violet","green",{"e":27,"a":56,"d":"yellow","c":35,"h":"green","b":84,"g":141,"f":65}],{"a":-17,"b":192},137]},"c":[47,{"e":{"e":95,"a":{"e":182,"a":177,"d":"blue","c":174,"h":-11,"b":"red","g":"yellow","f":"violet","i":39},"d":80,"c":"orange","h":"violet","b":112,"g":-19,"f":"green"},"c":{"c":"violet","a":-18,"b":"green","d":["red",16,-37,"blue","yellow",21,"blue"]},"a":-5,"b":106,"d":31,"f":146},46,-49,{"c":"orange","a":-20,"b":-9},["orange",{"e":["blue","blue",155,"orange","red"],"a":"violet","d":"orange","j":-33,"c":"green","h":"violet","b":"orange","g":"violet","f":173,"i":[-1,"yellow",194,"green",-31,"green"]},{"a":42,"b":{"e":"blue","a":"green","d":"yellow","j":"violet","c":121,"h":102,"b":"orange","g":-27,"f":137,"i":-23}},{"e":{"c":-25,"a":"red","b":129},"c":145,"a":34,"b":108,"d":"red"},"yellow","red","yellow",131,164,6],"yellow",{"a":["orange"],"b":31}],"h":{"e":{"e":"orange","a":"orange","d":{"c":"violet","a":{"e":"blue","a":127,"d":"blue","c":"green","h":"violet","b":88,"g":-40,"f":"yellow","i":"red"},"b":"violet"},"c":["red",{"e":"yellow","a":160,"d":"yellow","j":"blue","c":"orange","h":25,"b":41,"g":44,"f":"yellow","i":106},["yellow",197,21,115,"blue","green",144,38,-24,"blue"],"blue","blue","yellow",148],"h":"red","b":[65,41,{"a":177,"b":118},-42,{"e":13,"c":"orange","a":"violet","g":104,"b":32,"d":"blue","f":"orange"},119,"blue",-44],"g":"violet","f":87,"i":58},"a":128,"d":"green","j":"green","c":[{"a":{"e":"red","c":-24,"a":"yellow","b":"orange","d":"red","f":15}},"violet","green",165,"yellow",{"e":109,"a":101,"d":98,"c":"orange","h":"red","b":"yellow","g":"red","f":78},[166,"green","blue",-20,[33],"red",-9,"yellow","orange",112],"blue"],"h":[{"c":{"e":"yellow","c":144,"a":86,"b":"orange","d":"yellow","f":176},"a":128,"b":"violet","d":{"a":150}},71,{"e":{"a":47},"a":105,"d":45,"c":"green","h":"green","b":112,"g":"red","f":["yellow",196,170,49,"green","red"],"i":91},"blue","blue","green"],"b":{"e":["blue",-40,{"e":-46,"a":-15,"d":"green","c":"red","h":93,"b":18,"g":"yellow","f":-17},"green","violet","green","orange","orange","orange",80],"c":"orange","a":[93,"blue",199,91,"green"],"b":"green","d":{"e":70,"c":"orange","a":"blue","b":-39,"d":198,"f":"blue"}},"g":[57,"violet",81],"f":"violet","i":"violet"},"b":"blue","g":[154,"orange",["yellow",{"e":{"e":-37,"c":-6,"a":"orange","g":"violet","b":"orange","d":"orange","f":77},"c":"green","a":"violet","g":"yellow","b":157,"d":"violet","f":"red"},75,86,"orange"],[{"e":"orange","c":7,"a":["orange",-40,"red",139,"violet"],"b":34,"d":120,"f":"green"},152,119,"orange",{"e":[-5,"orange",107,105,"red","violet",104,136,"violet"],"c":9,"a":199,"b":48,"d":178,"f":152},36],"yellow",89,{"a":155,"b":107},{"a":{"c":13,"a":160,"b":114}},{"a":"yellow"}],"f":["yellow",{"a":"blue","b":157},{"e":"orange","c":[81,-48,"yellow",76,13,"red","red"],"a":{"e":"red","a":"yellow","d":"violet","j":12,"c":"green","h":"green","b":"yellow","g":"yellow","f":76,"i":-44},"b":"blue","d":"green","f":"blue"},{"c":{"a":"orange"},"a":180,"b":"orange","d":133}],"i":{"e":"violet","c":{"e":"orange","c":{"e":[13,"red","yellow","yellow","blue","green","red",156],"c":{"e":"violet","a":"violet","d":"blue","c":102,"h":-7,"b":21,"g":"blue","f":"violet"},"a":129,"b":26,"d":"green"},"a":7,"b":"green","d":"orange"},"a":"red","b":"orange","d":[["yellow",33,178,-31,194,9,126],"orange",27,7,91,[190,-27],[143,{"e":"blue","a":3,"d":5,"c":116,"h":"blue","b":"red","g":"red","f":"violet","i":39},"green",81,[-24,-34,-42,188,63,"orange"],2,172,-44,"yellow",75],{"e":-40,"a":["green","blue","violet",197,-21,"yellow","blue",84,"blue",7],"d":["red","yellow","orange",39,"orange",98,"violet",173],"c":49,"h":38,"b":184,"g":"green","f":-33}]}}],[[[{"e":["violet","blue",53],"a":{"e":77,"c":"orange","a":[166,118,"red",-6,"orange","orange","violet",74,"green"],"b":"red","d":47},"d":"violet","c":92,"h":4,"b":3,"g":{"e":"green","c":"blue","a":"yellow","g":167,"b":"green","d":-31,"f":30},"f":"orange"},{"e":"orange","c":194,"a":"violet","g":-34,"b":43,"d":"yellow","f":"blue"},"yellow",-28],[["green",181,"blue"]],175,"orange",110,198,[185,{"e":183,"c":{"c":29,"a":"blue","b":{"e":45,"a":"yellow","d":"orange","c":"green","h":155,"b":"green","g":-39,"f":"blue","i":"red"},"d":192},"a":"red","g":{"e":{"a":"violet","b":77},"a":-42,"d":57,"j":"orange","c":193,"h":62,"b":"red","g":64,"f":58,"i":"yellow"},"b":[["green",-31,"yellow",141,"yellow","red",111,167,-13,"blue"]],"d":["red",17],"f":"red"},"green",[{"e":22,"c":"orange","a":{"a":"red","b":"violet"},"b":"violet","d":{"a":167,"b":"blue"},"f":56},{"a":{"e":26,"c":145,"a":"violet","g":6,"b":13,"d":"green","f":"yellow"},"b":-41},"yellow",[[120,"red",187,124,"red","green"],"violet","red"],["yellow","violet",34],"yellow","red",71],{"c":["red","green",82,"yellow"],"a":[146,87,"green","orange",168,"yellow"],"b":{"a":["violet"]}},117,"orange",39,144],["violet",{"e":131,"a":-28,"d":["red","green","blue","blue","violet",-15,"violet"],"j":-42,"c":"orange","h":47,"b":"green","g":"yellow","f":[99,140,138],"i":"blue"},{"e":"blue","a":65,"d":"red","c":185,"h":8,"b":["orange",153,{"c":"orange","a":-40,"b":"violet"},"blue","orange",93,175],"g":-27,"f":"yellow","i":-47},48,{"c":83,"a":["blue",184,"orange","blue",{"a":167,"b":"yellow"},"violet","yellow"],"b":-27}],[[12,22,-15,"yellow",34],28,{"e":121,"c":170,"a":"red","g":{"e":13,"a":"yellow","d":44,"j":{"c":198,"a":"violet","b":176},"c":23,"h":-3,"b":"green","g":"blue","f":"violet","i":165},"b":"blue","d":64,"f":189},"yellow",-19,{"e":-49,"c":123,"a":-6,"g":"green","b":[190,"red","orange",68,98,"yellow","orange","red",{"c":68,"a":"red","b":"red"},"violet"],"d":-27,"f":"orange"},17,{"a":[105,127,{"e":-1,"a":138,"d":173,"j":"green","c":"blue","h":80,"b":"yellow","g":176,"f":"green","i":"green"},139,-41,"blue",10]},"orange"]],[[[{"e":"green","a":"blue","d":"orange","j":"blue","c":"yellow","h":"yellow","b":{"c":199,"a":"violet","b":-19},"g":"yellow","f":"red","i":"violet"},["orange"],[{"e":-20,"a":72,"d":"violet","c":"green","h":"yellow","b":20,"g":62,"f":-46},["yellow",48,44,"yellow","orange",-19,"green","red",10],{"c":0,"a":"blue","b":"green"},71,168,-27,"red"],{"e":"violet","a":{"a":"violet"},"d":-32,"c":"orange","h":"orange","b":"yellow","g":144,"f":131,"i":"orange"},"orange","violet","yellow","red"],151,[18,[{"a":"green"}],"orange","red","blue"]],{"c":91,"a":-17,"b":47,"d":46}],[["orange","green",[132],[4,156,186,{"e":148,"a":"green","d":"red","c":14,"h":34,"b":98,"g":141,"f":197,"i":"blue"},"red"],["yellow",["red","violet",-8,{"e":"orange","a":86,"d":"green","c":-49,"h":"green","b":"orange","g":107,"f":"green","i":174},101,57,"red","red",{"c":"orange","a":185,"b":84,"d":"blue"}],92,"orange","green","green",{"e":[-17,"blue","violet"],"c":["blue",80,"red"],"a":134,"g":192,"b":"green","d":"violet","f":51}],{"e":[122,"yellow","green","orange"],"a":"blue","d":113,"c":"yellow","h":"yellow","b":["violet","violet",199,71,128,["yellow","green","violet","blue",-41,"green","violet","yellow","yellow"],["yellow",190,"green","green","orange","green",-30,61]],"g":{"a":136,"b":"red"},"f":[135,"violet",60,["yellow",16,"blue"],131,"yellow",{"e":"orange","c":"violet","a":62,"b":190,"d":109},"blue",68,{"a":58,"b":-31}]},"yellow",-17,"violet","red"],44,[-39,"orange",{"e":70,"c":199,"a":73,"g":12,"b":"orange","d":6,"f":"green"},["blue","red",58,{"e":51,"c":80,"a":[46,26,"violet",64,"violet"],"b":"red","d":"red"},{"a":"yellow","b":"blue"}],196,{"a":"orange","b":{"c":"yellow","a":66,"b":161}}],157,[-25,["red",31],96,"yellow",[{"a":"green","b":9},"yellow",147,"yellow","green","orange",[-4,"green",66,152,157,["violet","violet",45,199,36,"violet",125,25]],50,["green",34,"orange",-37,33,179]],"green",{"e":"violet","a":["red",{"e":40,"a":"green","d":-24,"c":174,"h":"violet","b":"red","g":180,"f":63},"red","red",{"a":-36},178,-19,"violet",["green","red",24,"red"],"violet"],"d":{"e":24,"c":9,"a":7,"g":-41,"b":44,"d":"red","f":"violet"},"c":"violet","h":"yellow","b":["red"],"g":"yellow","f":-1,"i":["blue",53,"violet","red",87,"blue",{"e":-20,"a":130,"d":"red","c":"blue","h":58,"b":"blue","g":"blue","f":"blue","i":"yellow"},"orange","green"]},["red","green","green",-23,-6,75,"blue",{"e":112,"a":"green","d":129,"c":"yellow","h":"green","b":"yellow","g":-16,"f":194,"i":{"a":"violet","b":114}},"blue",[87,{"a":"violet"},10,65,70,"yellow",104,78,-41]],{"e":"violet","a":[[180,108],"orange","green","yellow",119,52],"d":113,"j":"red","c":[91,"green","red",41,"red",41],"h":"yellow","b":{"e":"orange","c":188,"a":77,"g":"yellow","b":"blue","d":-46,"f":"blue"},"g":"yellow","f":"yellow","i":{"e":{"e":"yellow","c":112,"a":"red","b":-36,"d":10,"f":"blue"},"a":{"a":172},"d":["green",92,87,65,123],"c":"blue","h":{"c":152,"a":"green","b":107,"d":-47},"b":"violet","g":25,"f":65,"i":"blue"}},"violet"],[["orange",{"e":"yellow","c":"orange","a":"orange","b":128,"d":145},"blue",-3,"green",108,"yellow",153],{"e":"red","c":50,"a":[90,"green",34,91,{"c":"orange","a":"red","b":197,"d":"red"}],"b":{"e":[54,"yellow","yellow"],"a":{"e":"orange","c":"yellow","a":"red","g":59,"b":"orange","d":161,"f":15},"d":"green","c":"orange","h":"green","b":25,"g":"green","f":"green","i":[191,95,-39]},"d":11},"yellow",39,"green","blue"],{"e":[[-45,[77,"yellow",-2,149,"blue",37,114],"violet",53,"green","violet",86,"green",2],135,-36,193,{"e":177,"a":33,"d":23,"j":"orange","c":-49,"h":79,"b":"violet","g":2,"f":"orange","i":-11},{"c":35,"a":"green","b":"blue"},"red",71,"violet","yellow"],"a":{"c":[100,"red",-32,"green","red","red",106,"red"],"a":"violet","b":-37,"d":{"e":145,"a":22,"d":[-45,85,-25,141],"j":"yellow","c":150,"h":[-4,"violet","green","violet",197,26,52,13,"blue",195],"b":165,"g":79,"f":-2,"i":"yellow"}},"d":[174,182,4,111,"violet",[25,"violet","yellow","red",107,124,114,"violet"],["red",57,-26,"green",131,25,"blue",["green","blue",47,-9,91,"yellow","red",-29,"red"]]],"c":[49,"violet",-24,56,99,127,26],"h":{"e":30,"a":10,"d":"violet","c":{"e":"blue","c":192,"a":86,"g":"blue","b":111,"d":[198,"green"],"f":-42},"h":-9,"b":["violet",{"e":29,"a":"blue","d":49,"j":109,"c":99,"h":-9,"b":"violet","g":"orange","f":120,"i":"orange"},["green",-7,"green"],"blue",129,"green","violet",{"e":-7,"a":"blue","d":130,"c":"green","h":126,"b":158,"g":"blue","f":132,"i":"blue"},191,"orange"],"g":183,"f":"yellow"},"b":"orange","g":[-7,"blue",{"e":"orange","a":"yellow","d":"violet","j":139,"c":33,"h":"blue","b":"red","g":-20,"f":3,"i":151},"blue",136,"orange",160],"f":[128]}],[["blue",185,57,82,{"e":"yellow","a":"red","d":"violet","c":5,"h":"yellow","b":16,"g":11,"f":-27}],[["orange",38,{"c":"green","a":"blue","b":[177,"blue","violet",-41,"orange",41,67,106]},"green","blue","red"],"violet",["green",-13,"orange",6,{"e":"red","a":116,"d":"orange","c":100,"h":"violet","b":"yellow","g":"red","f":"red","i":"red"},{"e":36,"a":"blue","d":"blue","j":135,"c":194,"h":-27,"b":["green",186,"green","violet","violet",197,32],"g":["blue"],"f":"violet","i":101},-47,"violet",30],[11,"orange",[-11,{"a":"green","b":-32},-21,133],{"a":32}],"orange",-49,102,136,"blue",125],-1,{"e":"orange","a":{"e":{"c":"violet","a":"green","b":13,"d":"blue"},"a":[{"e":"red","c":"orange","a":67,"g":"blue","b":"red","d":103,"f":176},7,5,176],"d":["orange",[-12,"orange","orange","yellow",165,152],["blue",38,"yellow","blue"],"violet",157,"orange"],"c":153,"h":"yellow","b":"green","g":["blue",[11,"red","yellow","green",16,89,"yellow"],"violet",180,120],"f":-21,"i":166},"d":["yellow",{"e":"violet","c":"green","a":"red","b":156,"d":"blue","f":{"e":38,"a":"orange","d":109,"c":"orange","h":93,"b":"green","g":-19,"f":-4}},{"e":88,"c":81,"a":50,"b":184,"d":"orange"},{"a":"green"},"red",[31,["blue",37],"violet",-5,16,"red",-43],"orange",32,[-10,72,16,138,"blue","green","violet"],"green"],"c":"violet","h":{"e":49,"c":-25,"a":"violet","b":42,"d":["red",-5,65,"green",-47,146,{"e":"red","c":167,"a":113,"b":169,"d":"red"},-19,"blue"],"f":"blue"},"b":{"a":89},"g":{"e":-42,"c":"green","a":-27,"b":{"e":"orange","a":"blue","d":"violet","j":"green","c":-8,"h":112,"b":-45,"g":-27,"f":"green","i":["violet","yellow","blue","violet",13,"blue",21]},"d":["orange",113,152,115,"red",112,-11,-5,{"e":"blue","c":"orange","a":158,"b":57,"d":"violet"}],"f":42},"f":[18,"yellow","red"],"i":-37}],{"c":[-7,"orange","green","green"],"a":{"a":"blue"},"b":{"e":"orange","a":114,"d":{"c":{"c":45,"a":26,"b":-4},"a":111,"b":["yellow",["red",196,"blue","yellow","orange","orange"],"red",-39,"orange","red","blue",{"e":"red","c":"red","a":"violet","b":"green","d":-13,"f":144},18],"d":22},"c":["green",{"c":"orange","a":20,"b":"yellow","d":120},98,107,"green","orange",181,[69,-30,{"e":"red","a":"blue","d":"orange","c":42,"h":136,"b":"blue","g":24,"f":35,"i":"red"},["violet","blue",77,152,"violet","red","orange"],185,[87,59],178,"yellow"],"violet"],"h":172,"b":{"c":"orange","a":{"e":161,"c":52,"a":33,"b":"violet","d":169,"f":122},"b":{"e":"yellow","a":-12,"d":"yellow","c":43,"h":-30,"b":"blue","g":94,"f":"yellow"},"d":{"e":0,"a":37,"d":"green","c":-30,"h":101,"b":111,"g":"orange","f":195}},"g":{"a":138,"b":"yellow"},"f":[160]},"d":"violet"},[{"c":{"e":{"e":[-30,"green",127],"c":"red","a":"red","b":123,"d":163},"c":"violet","a":[62,"red",101,103,172,"green",{"e":"orange","a":"blue","d":"green","j":23,"c":"red","h":"blue","b":43,"g":"orange","f":"red","i":-31},"violet",159],"b":"orange","d":37,"f":143},"a":"blue","b":136},{"e":74,"a":49,"d":"violet","j":176,"c":{"e":147,"c":50,"a":158,"b":{"e":55,"a":99,"d":"yellow","c":{"e":"red","a":"yellow","d":-14,"j":89,"c":79,"h":185,"b":138,"g":-1,"f":66,"i":"green"},"h":{"a":-9},"b":{"e":-19,"a":"violet","d":"red","c":-5,"h":99,"b":11,"g":"green","f":90},"g":177,"f":146,"i":"green"},"d":190,"f":{"e":"red","c":"yellow","a":"blue","g":"blue","b":135,"d":-49,"f":114}},"h":"yellow","b":88,"g":[{"a":["green","red",36,"violet"]},{"e":[118],"c":"violet","a":-4,"b":"red","d":"blue"},"violet","green",[["green","blue",81,"orange","blue","violet","violet",115,195],19,39,39,31,41,-1],"yellow",{"a":42,"b":149},79],"f":129,"i":173},["violet",{"e":48,"a":81,"d":102,"j":76,"c":182,"h":{"a":43,"b":"violet"},"b":-27,"g":166,"f":["orange",["yellow"],36,"green",[86,"green",2,"yellow",-36],83,"yellow","orange",89],"i":133},[{"a":"violet","b":"violet"},"blue","orange","orange",161,"violet",[196,-14,152,{"a":129},"violet"],181,"red","red"],{"e":"violet","c":40,"a":["orange","violet","yellow","violet","yellow",91,"orange","violet",108],"g":"orange","b":"blue","d":[{"a":"orange"},-28,7,"orange",{"a":"violet"},183],"f":-12},115,-32,"yellow","violet","orange",193],{"e":{"a":147,"b":11},"c":127,"a":79,"b":"yellow","d":-5},{"e":[{"e":1,"a":101,"d":"blue","c":[126,"violet",-24,"green"],"h":"blue","b":149,"g":"orange","f":"violet"},"red","red",{"a":5,"b":"orange"},"red"],"c":{"e":"orange","a":-49,"d":"red","j":-22,"c":{"e":"blue","c":155,"a":-2,"g":"blue","b":{"c":"violet","a":151,"b":"blue","d":"violet"},"d":{"c":55,"a":"blue","b":68,"d":"green"},"f":"green"},"h":"red","b":"red","g":27,"f":[["violet","blue"],"violet",144,111,-24,"blue","red","yellow"],"i":{"a":155,"b":38}},"a":"red","b":1,"d":"yellow","f":{"e":{"c":78,"a":40,"b":"green"},"c":"yellow","a":122,"g":"blue","b":"red","d":{"a":[70,79,65,"green",77,"red",133]},"f":[115,"blue"]}},{"c":42,"a":[{"e":"violet","c":{"e":"violet","a":"blue","d":"yellow","c":"violet","h":-24,"b":11,"g":"green","f":"green","i":"violet"},"a":122,"b":"orange","d":"violet"},[197,"blue",62,-32,127,119,"orange","blue"],121,{"c":198,"a":"orange","b":["red","yellow","yellow"],"d":"red"},-5],"b":{"e":14,"c":-41,"a":[["green",75,"yellow",138,"green","orange",42,188],21,98,109,149],"g":-36,"b":[-34,["orange","green",98,-45],[33,89,"blue","green"],184,"violet","yellow"],"d":["green",["orange",111,"blue","orange","blue","yellow","orange",189,"yellow","blue"],"orange",98,"green"],"f":[-32,{"e":-13,"c":"blue","a":108,"g":106,"b":153,"d":-45,"f":3},"blue",109,"blue"]}},[[[172,{"e":"red","a":"blue","d":71,"j":"green","c":61,"h":"orange","b":133,"g":155,"f":153,"i":169},"red",-6,"red",155],[60,130,80],"blue",["green",63,"green",127,"red"],["yellow",185,{"c":"orange","a":27,"b":"blue"},"yellow","violet",{"c":32,"a":6,"b":-37},-18],"yellow",138,["blue",{"e":94,"c":"blue","a":156,"b":-15,"d":52},101,"orange",61],"blue"],{"e":[62,"blue","red"],"a":138,"d":"red","j":"yellow","c":"blue","h":["green","green",-42,"green"],"b":["red",3,-36,"red","red","violet",{"e":"violet","a":"blue","d":77,"c":"orange","h":"yellow","b":"violet","g":"orange","f":"green","i":"blue"}],"g":[193,"blue","yellow",74,"green",-24,96,7],"f":-9,"i":"blue"},["yellow",[138,100,"orange",62,-30,"blue","green"],"yellow","violet",19]],109,{"e":"violet","a":"blue","d":90,"j":-39,"c":"green","h":[{"a":"green","b":153},91],"b":189,"g":"blue","f":"orange","i":"green"}],{"a":{"c":"green","a":34,"b":["yellow",181,-2,126,"blue","orange","violet"],"d":["red","violet",133,[192,176,16,"blue",3],[96,"blue","red","orange",[-16,"red",119,"yellow","orange","red",149,"red"],"red","violet","violet",-17,"yellow"],["blue"],"blue","green","blue"]},"b":{"a":"green","b":"violet"}},{"e":{"e":170,"c":139,"a":[{"e":-15,"a":78,"d":"violet","j":-1,"c":7,"h":71,"b":[116,-1,-25,-20],"g":"blue","f":"green","i":68},-25,[[125,"orange",134,"orange",35,50,126],-3,[166,"red",33,"red",85],-33,"orange",[198,"violet","red","blue",106,141,-45],-47],77,[["violet",74,"green","yellow",130,"violet"],9],{"e":9,"a":140,"d":111,"c":"yellow","h":"orange","b":"yellow","g":"violet","f":"red"}],"b":{"e":"green","c":167,"a":[16,-5,"green","red","green"],"b":-27,"d":"blue","f":"orange"},"d":{"e":{"c":66,"a":{"e":"red","a":"violet","d":"yellow","j":"red","c":"blue","h":-32,"b":95,"g":"violet","f":31,"i":"red"},"b":"blue","d":"blue"},"a":"red","d":{"c":75,"a":"yellow","b":"green","d":["green",-21,171,"yellow","blue",131,0,-33]},"c":[164,"orange"],"h":"red","b":118,"g":161,"f":"yellow","i":{"e":"violet","a":"green","d":{"e":123,"c":"violet","a":"orange","g":46,"b":-29,"d":"yellow","f":43},"c":-44,"h":"green","b":{"c":"green","a":81,"b":31,"d":"blue"},"g":"yellow","f":3}},"f":"green"},"c":"yellow","a":[["yellow","blue","red",168,69,[-44,"orange"],{"e":"blue","c":"yellow","a":65,"b":"yellow","d":"red","f":"orange"},"green","blue","blue"],{"e":{"c":48,"a":-39,"b":["orange",127,"blue","blue",92,"green"],"d":"red"},"a":-41,"d":"blue","j":"blue","c":134,"h":["violet","red"],"b":-48,"g":13,"f":"blue","i":["red",131,"blue","orange","green","green",161]},{"e":197,"a":-17,"d":-48,"c":"violet","h":177,"b":123,"g":"violet","f":-12,"i":[52,148,"violet","red",128,["blue"]]},[17,-28,{"e":-20,"a":{"a":"violet"},"d":"yellow","c":{"a":"blue","b":"violet"},"h":11,"b":39,"g":{"e":"blue","a":"green","d":"violet","c":"orange","h":"blue","b":132,"g":137,"f":"red"},"f":"blue","i":[187]},{"e":"violet","c":149,"a":"green","g":"red","b":72,"d":[-5],"f":{"c":11,"a":-2,"b":"green"}},-6,["green","yellow","yellow",{"e":"orange","c":"red","a":185,"b":"green","d":"red"}]],4],"g":"orange","b":[{"e":["violet","violet","green",119,-26],"a":"blue","d":"red","c":{"e":-38,"c":"green","a":17,"b":{"a":-31},"d":"yellow"},"h":["red","violet",-13,-41,[197,"violet","orange",150,"violet",156,161,179,70,"red"],143,110,-2,"blue","green"],"b":"green","g":"blue","f":"red"},"orange",{"c":[26,{"c":-21,"a":"green","b":"red"},"blue","orange",-23,"green",179,["orange"],{"e":"orange","c":"blue","a":"green","b":169,"d":"red"},"orange"],"a":"violet","b":"blue","d":175},60,"orange",[-44,{"e":"green","c":"orange","a":-41,"b":"violet","d":[0,"orange","green"]},"blue",["violet",[26,-9,"yellow",101,6,"yellow",161],81,104,"red","red","violet","red",180,60],114],"orange",15,22,"yellow"],"d":[53,"yellow",{"e":{"e":[99],"a":51,"d":["orange","yellow",114],"c":67,"h":{"e":109,"c":"violet","a":"orange","g":"orange","b":"blue","d":"orange","f":-4},"b":-27,"g":[93,"orange"],"f":"blue","i":"red"},"a":"red","d":37,"j":{"c":"red","a":"blue","b":"orange","d":{"a":"violet"}},"c":["green"],"h":"orange","b":[32,{"c":"red","a":"red","b":34},81,-3,{"c":"red","a":133,"b":-47,"d":112},"green","green","orange",{"e":"blue","a":"orange","d":"green","j":45,"c":-16,"h":78,"b":-28,"g":"yellow","f":"blue","i":130},0],"g":116,"f":-5,"i":"red"},"yellow","blue",152],"f":{"c":{"e":116,"c":"orange","a":128,"b":"blue","d":"blue"},"a":2,"b":{"c":101,"a":-48,"b":["yellow",106,179,["orange",97,104,"violet","orange","blue","orange"],{"e":"blue","a":183,"d":"red","c":-8,"h":26,"b":"orange","g":4,"f":"orange"},"violet","green","blue","green"]}}}],[{"e":10,"c":[[{"a":195},"yellow",[89,"orange","blue",[158,"violet",-41,174,135,"red",-21,182,"yellow","green"]],"green",{"e":"orange","a":[159,-6],"d":"yellow","j":"violet","c":"green","h":-23,"b":"orange","g":108,"f":"orange","i":53},["blue"],["blue","blue",[3,"violet","red"],"violet","yellow","violet"],85,92,"yellow"],{"a":"violet","b":188},"violet",{"a":197}],"a":-46,"g":"yellow","b":[54,["yellow","orange","violet",168,197,125,{"e":"blue","c":-24,"a":"orange","g":164,"b":"red","d":148,"f":{"e":48,"c":61,"a":"yellow","g":"blue","b":-46,"d":56,"f":-4}},{"a":["blue",131,6]},{"c":[179],"a":-13,"b":"violet","d":-34},-22],"violet",187],"d":34,"f":"yellow"},197,[{"e":52,"c":96,"a":{"e":59,"c":"orange","a":73,"b":["blue","green"],"d":-22},"b":{"e":["blue",152],"a":123,"d":"green","c":28,"h":-33,"b":-8,"g":"violet","f":167,"i":-29},"d":[[-21,"yellow"],52,"blue","red"]},-21],176,[[[193],53]],[[175,{"e":"red","a":132,"d":113,"c":["yellow"],"h":["red",185,129,57,"violet",135,"green","yellow","blue","green"],"b":"orange","g":-20,"f":{"c":"red","a":"orange","b":{"a":"violet","b":11}},"i":141},28,{"e":-4,"a":{"e":51,"a":171,"d":103,"c":{"e":-9,"a":144,"d":"green","j":"orange","c":"violet","h":126,"b":"yellow","g":60,"f":"violet","i":"orange"},"h":{"e":-40,"c":99,"a":"orange","g":"green","b":"red","d":128,"f":"blue"},"b":"green","g":82,"f":-23},"d":-16,"j":"violet","c":108,"h":140,"b":"yellow","g":"blue","f":84,"i":"orange"},[{"e":"red","c":-31,"a":-23,"g":-11,"b":25,"d":"green","f":"green"},{"e":"blue","c":180,"a":58,"b":-27,"d":60,"f":79},"orange",172],"red"],["orange",{"c":64,"a":109,"b":-14,"d":"red"},{"a":70,"b":"orange"},["violet",17],{"e":"violet","a":[141,"blue",{"a":"red"},[142,"red","violet","violet",-45,58,78,"yellow","orange"],"orange"],"d":{"e":"green","a":"red","d":86,"c":{"e":-44,"a":33,"d":"violet","c":188,"h":"red","b":-36,"g":"blue","f":"yellow"},"h":"red","b":186,"g":166,"f":"red"},"c":20,"h":"red","b":["violet",{"e":"blue","a":187,"d":115,"j":193,"c":119,"h":"yellow","b":"yellow","g":"red","f":74,"i":25},"orange",0,-17,"yellow",-23],"g":199,"f":76}]]]] From 3c69c64c18babb232b804a72ad72a3b6c5d6c8ad Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 03:38:37 +0100 Subject: [PATCH 048/100] 2015: d12: ex2: add solution --- 2015/d12/ex2/ex2.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 2015/d12/ex2/ex2.py diff --git a/2015/d12/ex2/ex2.py b/2015/d12/ex2/ex2.py new file mode 100755 index 0000000..5f25859 --- /dev/null +++ b/2015/d12/ex2/ex2.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python + +import json +import sys +from collections.abc import Iterator + +JSONValue = int | str | list["JSONValue"] | dict[str, "JSONValue"] + + +def solve(input: str) -> int: + def parse(input: str) -> JSONValue: + return json.loads(input) + + def all_numbers(doc: JSONValue) -> Iterator[int]: + if isinstance(doc, int): + yield doc + elif isinstance(doc, list): + for it in doc: + yield from all_numbers(it) + elif isinstance(doc, dict): + if "red" in doc.values(): + return + for it in doc.values(): + yield from all_numbers(it) + + doc = parse(input) + return sum(all_numbers(doc)) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From a0ca39ca7209d6d4b844df1c868a1732e16dcc6a Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 03:48:00 +0100 Subject: [PATCH 049/100] 2015: d13: ex1: add input --- 2015/d13/ex1/input | 56 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 2015/d13/ex1/input diff --git a/2015/d13/ex1/input b/2015/d13/ex1/input new file mode 100644 index 0000000..a6f9c66 --- /dev/null +++ b/2015/d13/ex1/input @@ -0,0 +1,56 @@ +Alice would gain 2 happiness units by sitting next to Bob. +Alice would gain 26 happiness units by sitting next to Carol. +Alice would lose 82 happiness units by sitting next to David. +Alice would lose 75 happiness units by sitting next to Eric. +Alice would gain 42 happiness units by sitting next to Frank. +Alice would gain 38 happiness units by sitting next to George. +Alice would gain 39 happiness units by sitting next to Mallory. +Bob would gain 40 happiness units by sitting next to Alice. +Bob would lose 61 happiness units by sitting next to Carol. +Bob would lose 15 happiness units by sitting next to David. +Bob would gain 63 happiness units by sitting next to Eric. +Bob would gain 41 happiness units by sitting next to Frank. +Bob would gain 30 happiness units by sitting next to George. +Bob would gain 87 happiness units by sitting next to Mallory. +Carol would lose 35 happiness units by sitting next to Alice. +Carol would lose 99 happiness units by sitting next to Bob. +Carol would lose 51 happiness units by sitting next to David. +Carol would gain 95 happiness units by sitting next to Eric. +Carol would gain 90 happiness units by sitting next to Frank. +Carol would lose 16 happiness units by sitting next to George. +Carol would gain 94 happiness units by sitting next to Mallory. +David would gain 36 happiness units by sitting next to Alice. +David would lose 18 happiness units by sitting next to Bob. +David would lose 65 happiness units by sitting next to Carol. +David would lose 18 happiness units by sitting next to Eric. +David would lose 22 happiness units by sitting next to Frank. +David would gain 2 happiness units by sitting next to George. +David would gain 42 happiness units by sitting next to Mallory. +Eric would lose 65 happiness units by sitting next to Alice. +Eric would gain 24 happiness units by sitting next to Bob. +Eric would gain 100 happiness units by sitting next to Carol. +Eric would gain 51 happiness units by sitting next to David. +Eric would gain 21 happiness units by sitting next to Frank. +Eric would gain 55 happiness units by sitting next to George. +Eric would lose 44 happiness units by sitting next to Mallory. +Frank would lose 48 happiness units by sitting next to Alice. +Frank would gain 91 happiness units by sitting next to Bob. +Frank would gain 8 happiness units by sitting next to Carol. +Frank would lose 66 happiness units by sitting next to David. +Frank would gain 97 happiness units by sitting next to Eric. +Frank would lose 9 happiness units by sitting next to George. +Frank would lose 92 happiness units by sitting next to Mallory. +George would lose 44 happiness units by sitting next to Alice. +George would lose 25 happiness units by sitting next to Bob. +George would gain 17 happiness units by sitting next to Carol. +George would gain 92 happiness units by sitting next to David. +George would lose 92 happiness units by sitting next to Eric. +George would gain 18 happiness units by sitting next to Frank. +George would gain 97 happiness units by sitting next to Mallory. +Mallory would gain 92 happiness units by sitting next to Alice. +Mallory would lose 96 happiness units by sitting next to Bob. +Mallory would lose 51 happiness units by sitting next to Carol. +Mallory would lose 81 happiness units by sitting next to David. +Mallory would gain 31 happiness units by sitting next to Eric. +Mallory would lose 73 happiness units by sitting next to Frank. +Mallory would lose 89 happiness units by sitting next to George. From 34aaa729d6d68b222e68dd895f1b2dcbdc6d371a Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 03:48:12 +0100 Subject: [PATCH 050/100] 2015: d13: ex1: add solution --- 2015/d13/ex1/ex1.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 2015/d13/ex1/ex1.py diff --git a/2015/d13/ex1/ex1.py b/2015/d13/ex1/ex1.py new file mode 100755 index 0000000..06ac1ad --- /dev/null +++ b/2015/d13/ex1/ex1.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python + +import collections +import itertools +import sys + + +def solve(input: str) -> int: + def parse_line(input: str) -> tuple[str, str, int]: + split_input = input.removesuffix(".").split() + p, other = split_input[0], split_input[-1] + delta = int(split_input[3]) * (1 if split_input[2] == "gain" else -1) + return p, other, delta + + def parse(input: str) -> dict[str, dict[str, int]]: + res: dict[str, dict[str, int]] = collections.defaultdict(dict) + for p, neighbour, delta in map(parse_line, input.splitlines()): + res[p][neighbour] = delta + return res + + def score_seating(deltas: dict[str, dict[str, int]], seating: list[str]) -> int: + table = itertools.chain(seating, [seating[0]]) + return sum( + deltas[p1][p2] + deltas[p2][p1] for p1, p2 in itertools.pairwise(table) + ) + + deltas = parse(input) + return max( + score_seating(deltas, list(perm)) + for perm in itertools.permutations(deltas.keys()) + ) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 6e5baf38c29bee426039914170c46ea90123b764 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 03:48:18 +0100 Subject: [PATCH 051/100] 2015: d13: ex2: add input --- 2015/d13/ex2/input | 56 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 2015/d13/ex2/input diff --git a/2015/d13/ex2/input b/2015/d13/ex2/input new file mode 100644 index 0000000..a6f9c66 --- /dev/null +++ b/2015/d13/ex2/input @@ -0,0 +1,56 @@ +Alice would gain 2 happiness units by sitting next to Bob. +Alice would gain 26 happiness units by sitting next to Carol. +Alice would lose 82 happiness units by sitting next to David. +Alice would lose 75 happiness units by sitting next to Eric. +Alice would gain 42 happiness units by sitting next to Frank. +Alice would gain 38 happiness units by sitting next to George. +Alice would gain 39 happiness units by sitting next to Mallory. +Bob would gain 40 happiness units by sitting next to Alice. +Bob would lose 61 happiness units by sitting next to Carol. +Bob would lose 15 happiness units by sitting next to David. +Bob would gain 63 happiness units by sitting next to Eric. +Bob would gain 41 happiness units by sitting next to Frank. +Bob would gain 30 happiness units by sitting next to George. +Bob would gain 87 happiness units by sitting next to Mallory. +Carol would lose 35 happiness units by sitting next to Alice. +Carol would lose 99 happiness units by sitting next to Bob. +Carol would lose 51 happiness units by sitting next to David. +Carol would gain 95 happiness units by sitting next to Eric. +Carol would gain 90 happiness units by sitting next to Frank. +Carol would lose 16 happiness units by sitting next to George. +Carol would gain 94 happiness units by sitting next to Mallory. +David would gain 36 happiness units by sitting next to Alice. +David would lose 18 happiness units by sitting next to Bob. +David would lose 65 happiness units by sitting next to Carol. +David would lose 18 happiness units by sitting next to Eric. +David would lose 22 happiness units by sitting next to Frank. +David would gain 2 happiness units by sitting next to George. +David would gain 42 happiness units by sitting next to Mallory. +Eric would lose 65 happiness units by sitting next to Alice. +Eric would gain 24 happiness units by sitting next to Bob. +Eric would gain 100 happiness units by sitting next to Carol. +Eric would gain 51 happiness units by sitting next to David. +Eric would gain 21 happiness units by sitting next to Frank. +Eric would gain 55 happiness units by sitting next to George. +Eric would lose 44 happiness units by sitting next to Mallory. +Frank would lose 48 happiness units by sitting next to Alice. +Frank would gain 91 happiness units by sitting next to Bob. +Frank would gain 8 happiness units by sitting next to Carol. +Frank would lose 66 happiness units by sitting next to David. +Frank would gain 97 happiness units by sitting next to Eric. +Frank would lose 9 happiness units by sitting next to George. +Frank would lose 92 happiness units by sitting next to Mallory. +George would lose 44 happiness units by sitting next to Alice. +George would lose 25 happiness units by sitting next to Bob. +George would gain 17 happiness units by sitting next to Carol. +George would gain 92 happiness units by sitting next to David. +George would lose 92 happiness units by sitting next to Eric. +George would gain 18 happiness units by sitting next to Frank. +George would gain 97 happiness units by sitting next to Mallory. +Mallory would gain 92 happiness units by sitting next to Alice. +Mallory would lose 96 happiness units by sitting next to Bob. +Mallory would lose 51 happiness units by sitting next to Carol. +Mallory would lose 81 happiness units by sitting next to David. +Mallory would gain 31 happiness units by sitting next to Eric. +Mallory would lose 73 happiness units by sitting next to Frank. +Mallory would lose 89 happiness units by sitting next to George. From d19850f8d0b935adc753711f8c8e10e83daea8e0 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 03:48:33 +0100 Subject: [PATCH 052/100] 2015: d13: ex2: add solution --- 2015/d13/ex2/ex2.py | 47 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 2015/d13/ex2/ex2.py diff --git a/2015/d13/ex2/ex2.py b/2015/d13/ex2/ex2.py new file mode 100755 index 0000000..a7fad12 --- /dev/null +++ b/2015/d13/ex2/ex2.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python + +import collections +import itertools +import sys + + +def solve(input: str) -> int: + def parse_line(input: str) -> tuple[str, str, int]: + split_input = input.removesuffix(".").split() + p, other = split_input[0], split_input[-1] + delta = int(split_input[3]) * (1 if split_input[2] == "gain" else -1) + return p, other, delta + + def parse(input: str) -> dict[str, dict[str, int]]: + res: dict[str, dict[str, int]] = collections.defaultdict(dict) + for p, neighbour, delta in map(parse_line, input.splitlines()): + res[p][neighbour] = delta + return res + + def score_seating(deltas: dict[str, dict[str, int]], seating: list[str]) -> int: + table = itertools.chain(seating, [seating[0]]) + return sum( + deltas[p1][p2] + deltas[p2][p1] for p1, p2 in itertools.pairwise(table) + ) + + def add_me(deltas: dict[str, dict[str, int]]) -> None: + deltas["me"] = {} + for other in deltas.keys(): + deltas["me"][other] = 0 + deltas[other]["me"] = 0 + + deltas = parse(input) + add_me(deltas) + return max( + score_seating(deltas, list(perm)) + for perm in itertools.permutations(deltas.keys()) + ) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From c0a19164669816b40c1c4a2e06546af2da76faa4 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 04:05:12 +0100 Subject: [PATCH 053/100] 2015: d14: ex1: add input --- 2015/d14/ex1/input | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 2015/d14/ex1/input diff --git a/2015/d14/ex1/input b/2015/d14/ex1/input new file mode 100644 index 0000000..6cf5489 --- /dev/null +++ b/2015/d14/ex1/input @@ -0,0 +1,9 @@ +Dancer can fly 27 km/s for 5 seconds, but then must rest for 132 seconds. +Cupid can fly 22 km/s for 2 seconds, but then must rest for 41 seconds. +Rudolph can fly 11 km/s for 5 seconds, but then must rest for 48 seconds. +Donner can fly 28 km/s for 5 seconds, but then must rest for 134 seconds. +Dasher can fly 4 km/s for 16 seconds, but then must rest for 55 seconds. +Blitzen can fly 14 km/s for 3 seconds, but then must rest for 38 seconds. +Prancer can fly 3 km/s for 21 seconds, but then must rest for 40 seconds. +Comet can fly 18 km/s for 6 seconds, but then must rest for 103 seconds. +Vixen can fly 18 km/s for 5 seconds, but then must rest for 84 seconds. From b634beec24cb6e2622308901264d6214fcf34170 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 04:05:22 +0100 Subject: [PATCH 054/100] 2015: d14: ex1: add solution --- 2015/d14/ex1/ex1.py | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 2015/d14/ex1/ex1.py diff --git a/2015/d14/ex1/ex1.py b/2015/d14/ex1/ex1.py new file mode 100755 index 0000000..243daa2 --- /dev/null +++ b/2015/d14/ex1/ex1.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python + +import sys +from typing import NamedTuple + + +class RunPerformance(NamedTuple): + speed: int + time: int + rest: int + + def run(self, t: int) -> int: + cycle_length = self.time + self.rest + cycles = t // cycle_length + left_over = t % cycle_length + run_time = cycles * self.time + min(self.time, left_over) + return self.speed * run_time + + +def solve(input: str) -> int: + def parse_line(input: str) -> tuple[str, RunPerformance]: + split_input = input.split() + speed, time, rest = map(int, (split_input[3], split_input[6], split_input[-2])) + return split_input[0], RunPerformance(speed, time, rest) + + def parse(input: str) -> dict[str, RunPerformance]: + return {name: perf for name, perf in map(parse_line, input.splitlines())} + + reindeers = parse(input) + return max(perf.run(2503) for perf in reindeers.values()) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 41de5c0abc4a3eab6701ebf9ea39aeb75f24ffa9 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 04:05:36 +0100 Subject: [PATCH 055/100] 2015: d14: ex2: add input --- 2015/d14/ex2/input | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 2015/d14/ex2/input diff --git a/2015/d14/ex2/input b/2015/d14/ex2/input new file mode 100644 index 0000000..6cf5489 --- /dev/null +++ b/2015/d14/ex2/input @@ -0,0 +1,9 @@ +Dancer can fly 27 km/s for 5 seconds, but then must rest for 132 seconds. +Cupid can fly 22 km/s for 2 seconds, but then must rest for 41 seconds. +Rudolph can fly 11 km/s for 5 seconds, but then must rest for 48 seconds. +Donner can fly 28 km/s for 5 seconds, but then must rest for 134 seconds. +Dasher can fly 4 km/s for 16 seconds, but then must rest for 55 seconds. +Blitzen can fly 14 km/s for 3 seconds, but then must rest for 38 seconds. +Prancer can fly 3 km/s for 21 seconds, but then must rest for 40 seconds. +Comet can fly 18 km/s for 6 seconds, but then must rest for 103 seconds. +Vixen can fly 18 km/s for 5 seconds, but then must rest for 84 seconds. From ea5b2dfdfc91b518f6073c4f016372267cf5e632 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 04:05:45 +0100 Subject: [PATCH 056/100] 2015: d14: ex2: add solution --- 2015/d14/ex2/ex2.py | 50 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100755 2015/d14/ex2/ex2.py diff --git a/2015/d14/ex2/ex2.py b/2015/d14/ex2/ex2.py new file mode 100755 index 0000000..dbdd34f --- /dev/null +++ b/2015/d14/ex2/ex2.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python + +import sys +from typing import NamedTuple + + +class RunPerformance(NamedTuple): + speed: int + time: int + rest: int + + def run(self, t: int) -> int: + cycle_length = self.time + self.rest + cycles = t // cycle_length + left_over = t % cycle_length + run_time = cycles * self.time + min(self.time, left_over) + return self.speed * run_time + + +def solve(input: str) -> int: + def parse_line(input: str) -> tuple[str, RunPerformance]: + split_input = input.split() + speed, time, rest = map(int, (split_input[3], split_input[6], split_input[-2])) + return split_input[0], RunPerformance(speed, time, rest) + + def parse(input: str) -> dict[str, RunPerformance]: + return {name: perf for name, perf in map(parse_line, input.splitlines())} + + def race(reindeers: dict[str, RunPerformance], t: int) -> dict[str, int]: + points = {name: 0 for name in reindeers.keys()} + for i in range(1, t + 1): + # Just re-compute the run every time, it's fast enough + distances = {name: perf.run(i) for name, perf in reindeers.items()} + max_dist = max(distances.values()) + for name, distance in distances.items(): + points[name] += distance == max_dist + return points + + reindeers = parse(input) + scores = race(reindeers, 2503) + return max(scores.values()) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 5f561f0208a1be8e592dfbef05a57dc129b328d2 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 04:36:22 +0100 Subject: [PATCH 057/100] 2015: d15: ex1: add input --- 2015/d15/ex1/input | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 2015/d15/ex1/input diff --git a/2015/d15/ex1/input b/2015/d15/ex1/input new file mode 100644 index 0000000..6281182 --- /dev/null +++ b/2015/d15/ex1/input @@ -0,0 +1,4 @@ +Sprinkles: capacity 5, durability -1, flavor 0, texture 0, calories 5 +PeanutButter: capacity -1, durability 3, flavor 0, texture 0, calories 1 +Frosting: capacity 0, durability -1, flavor 4, texture 0, calories 6 +Sugar: capacity -1, durability 0, flavor 0, texture 2, calories 8 From 9caa6f9b98906735681c5a8b3b63f3efa57ce27e Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 04:36:27 +0100 Subject: [PATCH 058/100] 2015: d15: ex1: add solution --- 2015/d15/ex1/ex1.py | 73 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100755 2015/d15/ex1/ex1.py diff --git a/2015/d15/ex1/ex1.py b/2015/d15/ex1/ex1.py new file mode 100755 index 0000000..177d574 --- /dev/null +++ b/2015/d15/ex1/ex1.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python + +import sys +from collections.abc import Iterator +from typing import NamedTuple + + +class Properties(NamedTuple): + capacity: int + durability: int + flavor: int + texture: int + calories: int + + @classmethod + def from_str(cls, input: str) -> "Properties": + properties = map(str.split, input.split(", ")) + return cls(*(int(prop[-1]) for prop in properties)) + + +def solve(input: str) -> int: + def parse_line(input: str) -> tuple[str, Properties]: + ingredient, properties = input.split(": ") + return ingredient, Properties.from_str(properties) + + def parse(input: str) -> dict[str, Properties]: + return {name: prop for name, prop in map(parse_line, input.splitlines())} + + def score(ingredients: dict[str, Properties], amounts: dict[str, int]) -> int: + assert ingredients.keys() == amounts.keys() # Sanity check + assert sum(amounts.values()) == 100 # Sanity check + res = 1 + for prop in ("capacity", "durability", "flavor", "texture"): + res *= max( + 0, + sum( + getattr(ingredients[name], prop) * amounts[name] + for name in ingredients.keys() + ), + ) + return res + + def permute_amounts(ingredients: dict[str, Properties]) -> Iterator[dict[str, int]]: + def helper(amounts: dict[str, int]) -> Iterator[dict[str, int]]: + remaining = 100 - sum(amounts.values()) + assert remaining >= 0 # Sanity check + assert ingredients # Sanity check + + current = next(iter(n for n in ingredients.keys() if n not in amounts)) + if (len(amounts) + 1) == len(ingredients): + yield amounts | {current: remaining} + else: + for i in range(remaining): + yield from helper(amounts | {current: i}) + + yield from helper({}) + + def maximize_score(ingredient: dict[str, Properties]) -> int: + return max( + score(ingredient, amounts) for amounts in permute_amounts(ingredients) + ) + + ingredients = parse(input) + return maximize_score(ingredients) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From e8ef80c528b10923b43c53da0794d1bc761db2f1 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 04:36:33 +0100 Subject: [PATCH 059/100] 2015: d15: ex2: add input --- 2015/d15/ex2/input | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 2015/d15/ex2/input diff --git a/2015/d15/ex2/input b/2015/d15/ex2/input new file mode 100644 index 0000000..6281182 --- /dev/null +++ b/2015/d15/ex2/input @@ -0,0 +1,4 @@ +Sprinkles: capacity 5, durability -1, flavor 0, texture 0, calories 5 +PeanutButter: capacity -1, durability 3, flavor 0, texture 0, calories 1 +Frosting: capacity 0, durability -1, flavor 4, texture 0, calories 6 +Sugar: capacity -1, durability 0, flavor 0, texture 2, calories 8 From 151ab3e24f67a369d7beff29f7fc09b88987910d Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 04:37:06 +0100 Subject: [PATCH 060/100] 2015: d15: ex2: add solution --- 2015/d15/ex2/ex2.py | 85 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100755 2015/d15/ex2/ex2.py diff --git a/2015/d15/ex2/ex2.py b/2015/d15/ex2/ex2.py new file mode 100755 index 0000000..1861296 --- /dev/null +++ b/2015/d15/ex2/ex2.py @@ -0,0 +1,85 @@ +#!/usr/bin/env python + +import sys +from collections.abc import Iterator +from typing import Literal, NamedTuple, cast + + +class Properties(NamedTuple): + capacity: int + durability: int + flavor: int + texture: int + calories: int + + @classmethod + def from_str(cls, input: str) -> "Properties": + properties = map(str.split, input.split(", ")) + return cls(*(int(prop[-1]) for prop in properties)) + + +PropertyName = Literal["capacity", "durability", "flavor", "texture", "calories"] + + +def solve(input: str) -> int: + def parse_line(input: str) -> tuple[str, Properties]: + ingredient, properties = input.split(": ") + return ingredient, Properties.from_str(properties) + + def parse(input: str) -> dict[str, Properties]: + return {name: prop for name, prop in map(parse_line, input.splitlines())} + + def sum_properties( + ingredients: dict[str, Properties], + amounts: dict[str, int], + prop: PropertyName, + ) -> int: + return sum( + getattr(ingredients[name], prop) * amounts[name] + for name in ingredients.keys() + ) + + def score(ingredients: dict[str, Properties], amounts: dict[str, int]) -> int: + assert ingredients.keys() == amounts.keys() # Sanity check + assert sum(amounts.values()) == 100 # Sanity check + res = 1 + for prop in ("capacity", "durability", "flavor", "texture"): + res *= max( + 0, + sum_properties(ingredients, amounts, cast(PropertyName, prop)), + ) + return res + + def permute_amounts(ingredients: dict[str, Properties]) -> Iterator[dict[str, int]]: + def helper(amounts: dict[str, int]) -> Iterator[dict[str, int]]: + remaining = 100 - sum(amounts.values()) + assert remaining >= 0 # Sanity check + assert ingredients # Sanity check + + current = next(iter(n for n in ingredients.keys() if n not in amounts)) + if (len(amounts) + 1) == len(ingredients): + yield amounts | {current: remaining} + else: + for i in range(remaining): + yield from helper(amounts | {current: i}) + + yield from helper({}) + + def maximize_score(ingredient: dict[str, Properties]) -> int: + return max( + score(ingredient, amounts) + for amounts in permute_amounts(ingredients) + if sum_properties(ingredient, amounts, "calories") == 500 + ) + + ingredients = parse(input) + return maximize_score(ingredients) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 74843640bd5e696f6311f94892e9401bc64601e7 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 22:18:48 +0100 Subject: [PATCH 061/100] 2015: d16: ex1: add input --- 2015/d16/ex1/input | 500 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 500 insertions(+) create mode 100644 2015/d16/ex1/input diff --git a/2015/d16/ex1/input b/2015/d16/ex1/input new file mode 100644 index 0000000..92ed31c --- /dev/null +++ b/2015/d16/ex1/input @@ -0,0 +1,500 @@ +Sue 1: goldfish: 6, trees: 9, akitas: 0 +Sue 2: goldfish: 7, trees: 1, akitas: 0 +Sue 3: cars: 10, akitas: 6, perfumes: 7 +Sue 4: perfumes: 2, vizslas: 0, cars: 6 +Sue 5: goldfish: 1, trees: 3, perfumes: 10 +Sue 6: children: 9, vizslas: 7, cars: 9 +Sue 7: cars: 6, vizslas: 5, cats: 3 +Sue 8: akitas: 10, vizslas: 9, children: 3 +Sue 9: vizslas: 8, cats: 2, trees: 1 +Sue 10: perfumes: 10, trees: 6, cars: 4 +Sue 11: cars: 9, children: 1, cats: 1 +Sue 12: pomeranians: 4, akitas: 6, goldfish: 8 +Sue 13: cats: 10, children: 5, trees: 9 +Sue 14: perfumes: 8, vizslas: 3, samoyeds: 1 +Sue 15: vizslas: 2, perfumes: 8, trees: 3 +Sue 16: pomeranians: 10, trees: 9, samoyeds: 4 +Sue 17: akitas: 7, vizslas: 0, goldfish: 6 +Sue 18: trees: 5, vizslas: 9, cars: 0 +Sue 19: akitas: 3, goldfish: 9, trees: 10 +Sue 20: perfumes: 7, samoyeds: 3, vizslas: 10 +Sue 21: perfumes: 7, pomeranians: 10, akitas: 8 +Sue 22: vizslas: 6, trees: 8, akitas: 10 +Sue 23: goldfish: 0, trees: 4, children: 9 +Sue 24: goldfish: 7, pomeranians: 9, akitas: 4 +Sue 25: cars: 7, trees: 4, pomeranians: 4 +Sue 26: trees: 9, akitas: 9, pomeranians: 7 +Sue 27: samoyeds: 0, perfumes: 9, goldfish: 10 +Sue 28: cars: 5, trees: 7, vizslas: 1 +Sue 29: perfumes: 9, trees: 1, children: 6 +Sue 30: goldfish: 10, trees: 0, cars: 4 +Sue 31: akitas: 2, perfumes: 5, goldfish: 5 +Sue 32: goldfish: 0, akitas: 5, trees: 0 +Sue 33: vizslas: 2, akitas: 2, samoyeds: 3 +Sue 34: goldfish: 8, perfumes: 5, cars: 3 +Sue 35: akitas: 1, cats: 4, trees: 9 +Sue 36: cars: 4, vizslas: 4, goldfish: 7 +Sue 37: akitas: 5, perfumes: 7, trees: 3 +Sue 38: goldfish: 10, trees: 2, vizslas: 9 +Sue 39: goldfish: 4, pomeranians: 5, vizslas: 5 +Sue 40: perfumes: 5, samoyeds: 4, akitas: 6 +Sue 41: goldfish: 9, cars: 4, perfumes: 5 +Sue 42: trees: 6, pomeranians: 9, goldfish: 8 +Sue 43: perfumes: 7, pomeranians: 1, akitas: 2 +Sue 44: vizslas: 9, cars: 5, cats: 0 +Sue 45: akitas: 1, goldfish: 6, trees: 0 +Sue 46: akitas: 5, vizslas: 8, trees: 2 +Sue 47: trees: 9, akitas: 2, vizslas: 9 +Sue 48: goldfish: 10, trees: 5, akitas: 2 +Sue 49: cars: 7, vizslas: 2, perfumes: 6 +Sue 50: akitas: 5, goldfish: 6, perfumes: 0 +Sue 51: cars: 9, cats: 7, trees: 5 +Sue 52: akitas: 7, goldfish: 10, cars: 0 +Sue 53: cars: 10, cats: 4, perfumes: 2 +Sue 54: goldfish: 2, pomeranians: 5, perfumes: 10 +Sue 55: vizslas: 5, akitas: 4, cars: 8 +Sue 56: goldfish: 9, vizslas: 4, akitas: 5 +Sue 57: perfumes: 8, samoyeds: 7, cars: 9 +Sue 58: cars: 5, akitas: 7, perfumes: 8 +Sue 59: samoyeds: 8, cars: 10, vizslas: 10 +Sue 60: akitas: 6, samoyeds: 0, goldfish: 3 +Sue 61: trees: 8, pomeranians: 0, akitas: 2 +Sue 62: trees: 1, perfumes: 3, vizslas: 4 +Sue 63: vizslas: 6, samoyeds: 9, goldfish: 8 +Sue 64: goldfish: 7, trees: 6, vizslas: 3 +Sue 65: cars: 1, vizslas: 0, akitas: 6 +Sue 66: cats: 6, pomeranians: 4, cars: 9 +Sue 67: trees: 10, pomeranians: 7, samoyeds: 3 +Sue 68: pomeranians: 5, goldfish: 9, akitas: 1 +Sue 69: akitas: 1, vizslas: 0, trees: 9 +Sue 70: cats: 4, goldfish: 4, vizslas: 10 +Sue 71: vizslas: 7, perfumes: 7, trees: 8 +Sue 72: children: 2, vizslas: 9, cats: 3 +Sue 73: cars: 8, pomeranians: 0, perfumes: 6 +Sue 74: akitas: 1, pomeranians: 8, vizslas: 10 +Sue 75: vizslas: 5, perfumes: 5, cars: 7 +Sue 76: cars: 3, vizslas: 3, goldfish: 0 +Sue 77: akitas: 9, samoyeds: 1, pomeranians: 3 +Sue 78: trees: 0, vizslas: 0, akitas: 6 +Sue 79: pomeranians: 9, cars: 1, perfumes: 0 +Sue 80: perfumes: 10, trees: 1, cats: 0 +Sue 81: goldfish: 5, akitas: 9, trees: 0 +Sue 82: vizslas: 1, akitas: 6, children: 4 +Sue 83: samoyeds: 7, perfumes: 8, pomeranians: 4 +Sue 84: perfumes: 3, children: 3, cats: 7 +Sue 85: goldfish: 9, trees: 3, cars: 9 +Sue 86: cars: 0, perfumes: 9, vizslas: 0 +Sue 87: children: 3, trees: 4, akitas: 3 +Sue 88: trees: 1, samoyeds: 1, goldfish: 0 +Sue 89: akitas: 8, cars: 3, vizslas: 9 +Sue 90: pomeranians: 9, trees: 9, goldfish: 8 +Sue 91: goldfish: 7, trees: 10, children: 0 +Sue 92: cats: 9, cars: 7, perfumes: 7 +Sue 93: vizslas: 2, goldfish: 7, cats: 9 +Sue 94: akitas: 5, cars: 8, vizslas: 4 +Sue 95: goldfish: 7, vizslas: 1, perfumes: 2 +Sue 96: goldfish: 5, trees: 6, perfumes: 10 +Sue 97: trees: 0, perfumes: 7, cars: 0 +Sue 98: cars: 2, perfumes: 6, trees: 8 +Sue 99: trees: 10, children: 7, cats: 9 +Sue 100: samoyeds: 5, goldfish: 6, vizslas: 6 +Sue 101: cars: 10, perfumes: 9, vizslas: 3 +Sue 102: pomeranians: 6, trees: 1, samoyeds: 4 +Sue 103: cars: 2, perfumes: 1, goldfish: 5 +Sue 104: goldfish: 2, cars: 8, pomeranians: 2 +Sue 105: goldfish: 6, vizslas: 0, trees: 10 +Sue 106: trees: 10, akitas: 10, pomeranians: 0 +Sue 107: vizslas: 2, pomeranians: 10, trees: 3 +Sue 108: children: 3, vizslas: 8, akitas: 7 +Sue 109: perfumes: 2, akitas: 2, samoyeds: 3 +Sue 110: goldfish: 7, trees: 1, perfumes: 1 +Sue 111: akitas: 2, cars: 9, perfumes: 2 +Sue 112: children: 10, cars: 0, akitas: 3 +Sue 113: akitas: 9, vizslas: 4, children: 3 +Sue 114: pomeranians: 3, trees: 2, goldfish: 5 +Sue 115: perfumes: 8, cars: 6, trees: 0 +Sue 116: samoyeds: 6, children: 3, pomeranians: 1 +Sue 117: goldfish: 1, trees: 2, akitas: 1 +Sue 118: goldfish: 10, akitas: 10, samoyeds: 0 +Sue 119: vizslas: 10, perfumes: 6, cars: 0 +Sue 120: cars: 2, perfumes: 9, goldfish: 5 +Sue 121: vizslas: 2, trees: 2, cars: 6 +Sue 122: vizslas: 3, trees: 0, akitas: 2 +Sue 123: akitas: 5, samoyeds: 7, goldfish: 1 +Sue 124: goldfish: 8, samoyeds: 7, trees: 8 +Sue 125: trees: 3, goldfish: 8, perfumes: 5 +Sue 126: cats: 3, vizslas: 9, goldfish: 0 +Sue 127: pomeranians: 9, goldfish: 3, perfumes: 6 +Sue 128: vizslas: 4, cars: 8, goldfish: 5 +Sue 129: vizslas: 8, children: 5, perfumes: 8 +Sue 130: cars: 7, children: 7, cats: 3 +Sue 131: perfumes: 1, akitas: 8, vizslas: 9 +Sue 132: perfumes: 7, samoyeds: 10, pomeranians: 6 +Sue 133: cars: 5, perfumes: 3, goldfish: 7 +Sue 134: perfumes: 9, akitas: 2, cats: 3 +Sue 135: perfumes: 1, trees: 9, vizslas: 9 +Sue 136: akitas: 7, cars: 3, perfumes: 7 +Sue 137: vizslas: 9, goldfish: 8, cars: 5 +Sue 138: trees: 0, samoyeds: 1, cars: 3 +Sue 139: cars: 0, perfumes: 6, trees: 0 +Sue 140: pomeranians: 4, cars: 1, perfumes: 7 +Sue 141: vizslas: 10, akitas: 8, cats: 3 +Sue 142: trees: 1, cats: 6, vizslas: 5 +Sue 143: pomeranians: 9, cars: 7, perfumes: 9 +Sue 144: cars: 0, perfumes: 2, pomeranians: 1 +Sue 145: trees: 1, goldfish: 9, perfumes: 8 +Sue 146: cars: 8, children: 5, vizslas: 2 +Sue 147: perfumes: 2, goldfish: 5, cars: 0 +Sue 148: akitas: 2, perfumes: 7, pomeranians: 6 +Sue 149: goldfish: 8, cars: 0, trees: 1 +Sue 150: akitas: 6, perfumes: 5, trees: 0 +Sue 151: vizslas: 6, samoyeds: 8, akitas: 10 +Sue 152: trees: 7, akitas: 7, perfumes: 6 +Sue 153: goldfish: 9, cats: 9, cars: 3 +Sue 154: vizslas: 10, trees: 0, cars: 9 +Sue 155: perfumes: 3, children: 2, goldfish: 1 +Sue 156: goldfish: 7, perfumes: 5, akitas: 6 +Sue 157: cats: 10, trees: 1, goldfish: 0 +Sue 158: cats: 7, children: 7, vizslas: 6 +Sue 159: perfumes: 9, akitas: 0, cars: 0 +Sue 160: akitas: 3, goldfish: 10, pomeranians: 2 +Sue 161: goldfish: 10, cars: 6, perfumes: 3 +Sue 162: trees: 0, cars: 9, goldfish: 1 +Sue 163: cars: 8, perfumes: 9, vizslas: 5 +Sue 164: goldfish: 1, trees: 10, children: 6 +Sue 165: goldfish: 0, vizslas: 6, cars: 0 +Sue 166: akitas: 5, vizslas: 1, cars: 5 +Sue 167: vizslas: 1, samoyeds: 1, children: 4 +Sue 168: samoyeds: 7, vizslas: 7, akitas: 3 +Sue 169: goldfish: 3, cats: 9, trees: 2 +Sue 170: cars: 5, perfumes: 9, vizslas: 5 +Sue 171: goldfish: 7, cars: 6, perfumes: 10 +Sue 172: cats: 6, akitas: 1, children: 6 +Sue 173: cats: 4, goldfish: 1, children: 3 +Sue 174: cars: 2, pomeranians: 2, vizslas: 7 +Sue 175: trees: 0, children: 4, goldfish: 7 +Sue 176: children: 8, cars: 5, cats: 9 +Sue 177: pomeranians: 4, vizslas: 7, trees: 3 +Sue 178: vizslas: 6, perfumes: 10, akitas: 6 +Sue 179: cars: 4, akitas: 4, trees: 4 +Sue 180: akitas: 8, goldfish: 6, trees: 9 +Sue 181: perfumes: 3, vizslas: 10, cars: 3 +Sue 182: vizslas: 3, samoyeds: 3, goldfish: 7 +Sue 183: goldfish: 10, perfumes: 2, cats: 1 +Sue 184: goldfish: 5, trees: 1, perfumes: 1 +Sue 185: vizslas: 10, trees: 9, perfumes: 2 +Sue 186: goldfish: 6, perfumes: 9, trees: 1 +Sue 187: cars: 0, trees: 9, goldfish: 6 +Sue 188: cars: 0, trees: 1, vizslas: 9 +Sue 189: akitas: 7, vizslas: 2, trees: 0 +Sue 190: pomeranians: 5, perfumes: 8, akitas: 10 +Sue 191: vizslas: 5, akitas: 3, cats: 0 +Sue 192: children: 1, trees: 1, cars: 2 +Sue 193: cars: 3, goldfish: 9, trees: 2 +Sue 194: samoyeds: 3, akitas: 4, perfumes: 8 +Sue 195: trees: 1, vizslas: 8, akitas: 10 +Sue 196: akitas: 6, cars: 5, pomeranians: 0 +Sue 197: akitas: 5, vizslas: 5, cats: 1 +Sue 198: trees: 4, cars: 6, goldfish: 6 +Sue 199: cats: 7, cars: 5, goldfish: 6 +Sue 200: vizslas: 4, cats: 0, akitas: 9 +Sue 201: pomeranians: 1, perfumes: 4, children: 2 +Sue 202: cats: 1, perfumes: 4, vizslas: 3 +Sue 203: vizslas: 1, akitas: 9, children: 5 +Sue 204: perfumes: 8, cars: 7, trees: 4 +Sue 205: perfumes: 7, pomeranians: 5, cats: 9 +Sue 206: vizslas: 8, trees: 2, akitas: 2 +Sue 207: akitas: 6, vizslas: 2, perfumes: 10 +Sue 208: vizslas: 1, children: 7, akitas: 4 +Sue 209: perfumes: 4, trees: 2, children: 1 +Sue 210: goldfish: 0, vizslas: 2, samoyeds: 10 +Sue 211: cars: 8, perfumes: 3, trees: 1 +Sue 212: cars: 8, samoyeds: 5, pomeranians: 8 +Sue 213: akitas: 2, goldfish: 8, pomeranians: 2 +Sue 214: akitas: 6, pomeranians: 2, cars: 0 +Sue 215: trees: 10, pomeranians: 4, vizslas: 0 +Sue 216: perfumes: 0, cars: 8, trees: 0 +Sue 217: samoyeds: 8, akitas: 7, children: 10 +Sue 218: perfumes: 1, vizslas: 6, children: 0 +Sue 219: children: 1, goldfish: 4, trees: 1 +Sue 220: akitas: 10, goldfish: 10, trees: 5 +Sue 221: cars: 7, pomeranians: 6, perfumes: 3 +Sue 222: vizslas: 6, children: 0, akitas: 5 +Sue 223: perfumes: 9, cars: 1, trees: 6 +Sue 224: pomeranians: 1, trees: 0, vizslas: 0 +Sue 225: goldfish: 8, akitas: 4, perfumes: 10 +Sue 226: pomeranians: 7, cats: 7, children: 4 +Sue 227: trees: 0, akitas: 2, perfumes: 1 +Sue 228: vizslas: 6, cars: 10, perfumes: 9 +Sue 229: cars: 0, perfumes: 6, trees: 4 +Sue 230: pomeranians: 7, perfumes: 5, trees: 2 +Sue 231: goldfish: 9, cars: 6, trees: 7 +Sue 232: akitas: 1, vizslas: 5, cars: 3 +Sue 233: akitas: 7, samoyeds: 2, vizslas: 5 +Sue 234: akitas: 6, cats: 8, pomeranians: 0 +Sue 235: pomeranians: 5, akitas: 5, vizslas: 3 +Sue 236: goldfish: 5, trees: 6, akitas: 5 +Sue 237: goldfish: 9, perfumes: 5, cats: 5 +Sue 238: cats: 8, goldfish: 4, perfumes: 0 +Sue 239: samoyeds: 8, children: 6, pomeranians: 6 +Sue 240: akitas: 4, samoyeds: 10, trees: 8 +Sue 241: trees: 2, goldfish: 8, cars: 1 +Sue 242: perfumes: 2, cars: 0, akitas: 10 +Sue 243: pomeranians: 1, cars: 7, trees: 2 +Sue 244: trees: 9, vizslas: 2, akitas: 10 +Sue 245: cars: 9, pomeranians: 4, trees: 0 +Sue 246: cars: 9, pomeranians: 7, perfumes: 1 +Sue 247: trees: 0, goldfish: 1, akitas: 8 +Sue 248: vizslas: 1, cats: 4, akitas: 4 +Sue 249: cats: 6, children: 4, goldfish: 9 +Sue 250: vizslas: 1, cars: 10, samoyeds: 5 +Sue 251: cars: 0, goldfish: 1, vizslas: 7 +Sue 252: cars: 7, akitas: 9, vizslas: 10 +Sue 253: akitas: 7, vizslas: 2, perfumes: 5 +Sue 254: vizslas: 10, akitas: 5, samoyeds: 0 +Sue 255: pomeranians: 8, goldfish: 0, cats: 6 +Sue 256: cars: 10, goldfish: 8, vizslas: 9 +Sue 257: goldfish: 3, perfumes: 9, cats: 3 +Sue 258: trees: 6, goldfish: 6, cars: 6 +Sue 259: trees: 0, goldfish: 2, perfumes: 8 +Sue 260: trees: 5, akitas: 0, cars: 0 +Sue 261: pomeranians: 9, goldfish: 7, perfumes: 8 +Sue 262: perfumes: 8, vizslas: 6, goldfish: 2 +Sue 263: vizslas: 6, trees: 5, goldfish: 9 +Sue 264: vizslas: 4, perfumes: 7, cars: 9 +Sue 265: goldfish: 10, trees: 3, perfumes: 1 +Sue 266: trees: 10, akitas: 8, goldfish: 8 +Sue 267: goldfish: 4, trees: 0, samoyeds: 9 +Sue 268: vizslas: 1, trees: 0, goldfish: 8 +Sue 269: cars: 2, perfumes: 10, goldfish: 5 +Sue 270: perfumes: 7, cars: 2, vizslas: 1 +Sue 271: cars: 6, perfumes: 10, goldfish: 6 +Sue 272: samoyeds: 4, goldfish: 2, vizslas: 9 +Sue 273: perfumes: 4, goldfish: 4, vizslas: 1 +Sue 274: children: 4, cars: 4, perfumes: 3 +Sue 275: children: 8, vizslas: 3, trees: 2 +Sue 276: vizslas: 5, children: 7, perfumes: 3 +Sue 277: perfumes: 3, cats: 4, vizslas: 5 +Sue 278: cars: 1, samoyeds: 10, akitas: 2 +Sue 279: trees: 9, perfumes: 9, cars: 10 +Sue 280: vizslas: 5, trees: 0, perfumes: 6 +Sue 281: vizslas: 3, akitas: 10, pomeranians: 7 +Sue 282: trees: 1, children: 2, akitas: 8 +Sue 283: akitas: 9, goldfish: 6, cats: 5 +Sue 284: cars: 9, children: 10, pomeranians: 2 +Sue 285: pomeranians: 0, perfumes: 4, cars: 7 +Sue 286: perfumes: 0, vizslas: 10, akitas: 10 +Sue 287: cats: 2, perfumes: 3, trees: 5 +Sue 288: akitas: 9, vizslas: 8, samoyeds: 9 +Sue 289: perfumes: 6, children: 2, cars: 7 +Sue 290: akitas: 0, children: 5, cars: 5 +Sue 291: cars: 4, perfumes: 0, trees: 1 +Sue 292: cats: 0, cars: 8, perfumes: 6 +Sue 293: akitas: 9, cats: 5, children: 5 +Sue 294: akitas: 4, cars: 9, goldfish: 3 +Sue 295: cars: 2, akitas: 3, perfumes: 7 +Sue 296: perfumes: 4, cars: 7, goldfish: 10 +Sue 297: trees: 5, akitas: 8, vizslas: 1 +Sue 298: perfumes: 0, goldfish: 6, trees: 9 +Sue 299: perfumes: 6, samoyeds: 8, cars: 1 +Sue 300: goldfish: 10, perfumes: 4, akitas: 2 +Sue 301: cars: 3, trees: 0, goldfish: 8 +Sue 302: perfumes: 7, samoyeds: 2, vizslas: 7 +Sue 303: children: 10, goldfish: 7, perfumes: 2 +Sue 304: samoyeds: 8, vizslas: 2, cars: 1 +Sue 305: trees: 1, cats: 0, goldfish: 10 +Sue 306: trees: 4, perfumes: 2, cars: 7 +Sue 307: cars: 6, vizslas: 2, children: 6 +Sue 308: vizslas: 2, cars: 0, akitas: 7 +Sue 309: cars: 3, vizslas: 8, perfumes: 6 +Sue 310: goldfish: 7, perfumes: 7, vizslas: 3 +Sue 311: pomeranians: 10, trees: 2, cars: 0 +Sue 312: samoyeds: 2, vizslas: 9, akitas: 1 +Sue 313: cars: 4, pomeranians: 7, goldfish: 7 +Sue 314: akitas: 2, pomeranians: 9, samoyeds: 10 +Sue 315: akitas: 3, vizslas: 2, trees: 0 +Sue 316: cars: 0, perfumes: 4, pomeranians: 6 +Sue 317: akitas: 10, goldfish: 3, pomeranians: 7 +Sue 318: cars: 9, trees: 0, pomeranians: 9 +Sue 319: akitas: 3, vizslas: 7, children: 10 +Sue 320: vizslas: 0, akitas: 8, pomeranians: 4 +Sue 321: cars: 10, akitas: 9, vizslas: 3 +Sue 322: perfumes: 0, akitas: 8, vizslas: 6 +Sue 323: vizslas: 10, perfumes: 5, cars: 3 +Sue 324: akitas: 0, goldfish: 6, vizslas: 7 +Sue 325: perfumes: 9, vizslas: 5, pomeranians: 2 +Sue 326: vizslas: 6, goldfish: 10, pomeranians: 8 +Sue 327: vizslas: 10, cars: 1, akitas: 7 +Sue 328: trees: 1, perfumes: 10, cars: 10 +Sue 329: pomeranians: 5, samoyeds: 3, cars: 10 +Sue 330: akitas: 6, cars: 1, pomeranians: 4 +Sue 331: cars: 5, children: 2, trees: 0 +Sue 332: vizslas: 6, pomeranians: 1, perfumes: 0 +Sue 333: akitas: 7, trees: 1, cats: 9 +Sue 334: vizslas: 6, goldfish: 9, akitas: 7 +Sue 335: akitas: 3, samoyeds: 3, cars: 3 +Sue 336: samoyeds: 10, perfumes: 9, trees: 6 +Sue 337: vizslas: 2, cars: 9, akitas: 0 +Sue 338: akitas: 6, perfumes: 9, vizslas: 3 +Sue 339: cars: 3, samoyeds: 8, trees: 2 +Sue 340: cats: 7, perfumes: 8, cars: 9 +Sue 341: goldfish: 9, perfumes: 5, cars: 10 +Sue 342: trees: 0, akitas: 3, perfumes: 5 +Sue 343: perfumes: 2, children: 0, cars: 6 +Sue 344: goldfish: 8, trees: 8, perfumes: 0 +Sue 345: perfumes: 6, cars: 6, goldfish: 5 +Sue 346: vizslas: 8, trees: 1, cars: 6 +Sue 347: cars: 0, cats: 3, perfumes: 7 +Sue 348: children: 7, perfumes: 10, cars: 7 +Sue 349: pomeranians: 8, akitas: 5, children: 2 +Sue 350: perfumes: 9, pomeranians: 4, goldfish: 3 +Sue 351: perfumes: 8, pomeranians: 7, trees: 4 +Sue 352: samoyeds: 1, goldfish: 9, akitas: 8 +Sue 353: akitas: 6, goldfish: 10, vizslas: 8 +Sue 354: akitas: 7, cars: 2, goldfish: 6 +Sue 355: cars: 3, goldfish: 6, akitas: 5 +Sue 356: akitas: 2, goldfish: 9, pomeranians: 1 +Sue 357: goldfish: 10, cars: 6, pomeranians: 9 +Sue 358: trees: 0, children: 2, goldfish: 6 +Sue 359: samoyeds: 3, cars: 2, akitas: 4 +Sue 360: trees: 1, goldfish: 8, cars: 5 +Sue 361: akitas: 5, vizslas: 7, perfumes: 1 +Sue 362: cats: 5, vizslas: 9, children: 4 +Sue 363: goldfish: 9, perfumes: 3, vizslas: 9 +Sue 364: children: 7, samoyeds: 2, pomeranians: 10 +Sue 365: perfumes: 9, akitas: 10, pomeranians: 4 +Sue 366: cars: 10, trees: 3, cats: 4 +Sue 367: vizslas: 6, akitas: 10, perfumes: 5 +Sue 368: akitas: 9, vizslas: 9, children: 4 +Sue 369: goldfish: 8, trees: 2, perfumes: 5 +Sue 370: trees: 0, children: 4, cars: 8 +Sue 371: cats: 6, perfumes: 0, vizslas: 2 +Sue 372: akitas: 7, cars: 5, perfumes: 3 +Sue 373: cars: 0, perfumes: 4, pomeranians: 10 +Sue 374: akitas: 5, perfumes: 5, vizslas: 2 +Sue 375: goldfish: 7, trees: 10, pomeranians: 7 +Sue 376: cars: 8, trees: 1, pomeranians: 8 +Sue 377: cars: 0, akitas: 9, vizslas: 1 +Sue 378: akitas: 5, perfumes: 3, vizslas: 7 +Sue 379: trees: 2, goldfish: 8, pomeranians: 8 +Sue 380: akitas: 5, cars: 9, perfumes: 9 +Sue 381: cars: 2, perfumes: 6, trees: 3 +Sue 382: perfumes: 6, vizslas: 2, goldfish: 9 +Sue 383: akitas: 8, vizslas: 7, cats: 1 +Sue 384: akitas: 9, trees: 10, vizslas: 7 +Sue 385: cars: 0, perfumes: 7, vizslas: 2 +Sue 386: vizslas: 10, akitas: 4, perfumes: 9 +Sue 387: perfumes: 6, pomeranians: 5, samoyeds: 8 +Sue 388: vizslas: 10, trees: 9, goldfish: 9 +Sue 389: goldfish: 8, akitas: 4, perfumes: 10 +Sue 390: goldfish: 6, trees: 8, akitas: 1 +Sue 391: vizslas: 4, akitas: 10, goldfish: 7 +Sue 392: akitas: 1, vizslas: 6, samoyeds: 5 +Sue 393: trees: 6, cars: 3, akitas: 5 +Sue 394: goldfish: 9, trees: 3, cars: 5 +Sue 395: akitas: 6, samoyeds: 4, goldfish: 4 +Sue 396: akitas: 2, trees: 1, cats: 5 +Sue 397: cars: 0, children: 9, trees: 10 +Sue 398: pomeranians: 3, samoyeds: 9, goldfish: 10 +Sue 399: cars: 7, akitas: 4, goldfish: 8 +Sue 400: cars: 4, akitas: 5, vizslas: 4 +Sue 401: pomeranians: 5, akitas: 8, vizslas: 5 +Sue 402: cats: 7, cars: 6, goldfish: 6 +Sue 403: samoyeds: 8, perfumes: 4, cars: 5 +Sue 404: akitas: 10, goldfish: 4, trees: 2 +Sue 405: trees: 8, perfumes: 1, cars: 2 +Sue 406: trees: 0, perfumes: 9, pomeranians: 10 +Sue 407: perfumes: 4, trees: 7, goldfish: 3 +Sue 408: akitas: 1, perfumes: 3, cars: 5 +Sue 409: trees: 6, samoyeds: 3, cars: 9 +Sue 410: vizslas: 3, goldfish: 5, akitas: 7 +Sue 411: goldfish: 10, trees: 1, vizslas: 9 +Sue 412: cars: 0, akitas: 6, trees: 6 +Sue 413: goldfish: 7, trees: 0, cars: 3 +Sue 414: pomeranians: 10, samoyeds: 3, cars: 10 +Sue 415: perfumes: 6, trees: 9, cars: 4 +Sue 416: trees: 2, cars: 4, goldfish: 8 +Sue 417: goldfish: 2, cars: 9, cats: 5 +Sue 418: vizslas: 1, cars: 9, akitas: 0 +Sue 419: perfumes: 6, cats: 3, children: 9 +Sue 420: cats: 5, goldfish: 7, akitas: 9 +Sue 421: trees: 1, samoyeds: 6, pomeranians: 1 +Sue 422: trees: 10, goldfish: 6, children: 7 +Sue 423: cars: 8, goldfish: 7, vizslas: 3 +Sue 424: samoyeds: 9, akitas: 7, trees: 5 +Sue 425: akitas: 5, children: 4, perfumes: 9 +Sue 426: goldfish: 1, children: 9, cats: 2 +Sue 427: vizslas: 9, akitas: 7, goldfish: 9 +Sue 428: pomeranians: 7, akitas: 5, vizslas: 1 +Sue 429: vizslas: 7, goldfish: 7, cars: 9 +Sue 430: trees: 7, perfumes: 0, pomeranians: 5 +Sue 431: children: 9, perfumes: 5, vizslas: 7 +Sue 432: trees: 6, samoyeds: 7, cats: 1 +Sue 433: goldfish: 5, trees: 5, children: 6 +Sue 434: goldfish: 9, akitas: 7, cars: 3 +Sue 435: samoyeds: 10, perfumes: 2, cars: 0 +Sue 436: akitas: 5, pomeranians: 4, perfumes: 7 +Sue 437: vizslas: 5, cats: 6, perfumes: 5 +Sue 438: trees: 2, goldfish: 6, vizslas: 7 +Sue 439: samoyeds: 8, pomeranians: 10, goldfish: 1 +Sue 440: akitas: 6, children: 9, perfumes: 4 +Sue 441: cars: 2, goldfish: 9, children: 0 +Sue 442: goldfish: 7, cars: 2, vizslas: 8 +Sue 443: goldfish: 6, samoyeds: 3, perfumes: 2 +Sue 444: trees: 2, goldfish: 7, cars: 8 +Sue 445: trees: 2, pomeranians: 0, children: 0 +Sue 446: perfumes: 4, akitas: 4, goldfish: 6 +Sue 447: vizslas: 7, akitas: 9, cars: 3 +Sue 448: goldfish: 6, trees: 9, cars: 0 +Sue 449: samoyeds: 7, perfumes: 4, vizslas: 10 +Sue 450: akitas: 7, cars: 10, goldfish: 7 +Sue 451: goldfish: 4, children: 7, pomeranians: 4 +Sue 452: cats: 4, vizslas: 6, trees: 7 +Sue 453: cars: 1, trees: 10, goldfish: 9 +Sue 454: trees: 2, goldfish: 3, vizslas: 10 +Sue 455: pomeranians: 9, vizslas: 3, akitas: 2 +Sue 456: vizslas: 10, akitas: 2, goldfish: 1 +Sue 457: trees: 5, cats: 5, children: 8 +Sue 458: cars: 6, goldfish: 3, akitas: 9 +Sue 459: goldfish: 7, akitas: 2, cats: 7 +Sue 460: akitas: 1, cars: 5, children: 8 +Sue 461: cars: 8, perfumes: 0, goldfish: 6 +Sue 462: pomeranians: 6, cats: 2, perfumes: 6 +Sue 463: vizslas: 7, perfumes: 3, goldfish: 3 +Sue 464: akitas: 10, goldfish: 10, trees: 1 +Sue 465: vizslas: 0, akitas: 2, trees: 2 +Sue 466: perfumes: 6, akitas: 8, cars: 2 +Sue 467: goldfish: 1, cars: 10, perfumes: 3 +Sue 468: goldfish: 4, trees: 2, cars: 9 +Sue 469: perfumes: 6, pomeranians: 0, vizslas: 10 +Sue 470: samoyeds: 8, children: 0, akitas: 7 +Sue 471: children: 3, goldfish: 9, cats: 9 +Sue 472: samoyeds: 0, goldfish: 0, trees: 0 +Sue 473: trees: 3, goldfish: 4, vizslas: 1 +Sue 474: perfumes: 10, cars: 3, trees: 7 +Sue 475: akitas: 5, vizslas: 4, goldfish: 5 +Sue 476: children: 2, akitas: 7, vizslas: 3 +Sue 477: vizslas: 6, pomeranians: 9, trees: 6 +Sue 478: vizslas: 7, pomeranians: 6, akitas: 7 +Sue 479: trees: 2, perfumes: 2, children: 2 +Sue 480: cars: 8, cats: 5, vizslas: 0 +Sue 481: trees: 5, goldfish: 0, akitas: 3 +Sue 482: cars: 8, perfumes: 6, goldfish: 10 +Sue 483: goldfish: 0, cars: 3, perfumes: 10 +Sue 484: pomeranians: 1, samoyeds: 1, perfumes: 3 +Sue 485: trees: 0, akitas: 2, vizslas: 4 +Sue 486: cars: 3, vizslas: 8, goldfish: 1 +Sue 487: pomeranians: 9, vizslas: 2, children: 10 +Sue 488: akitas: 6, vizslas: 10, perfumes: 9 +Sue 489: goldfish: 6, vizslas: 4, cars: 2 +Sue 490: vizslas: 10, cats: 8, samoyeds: 1 +Sue 491: cats: 9, cars: 1, perfumes: 10 +Sue 492: goldfish: 6, cars: 9, pomeranians: 9 +Sue 493: children: 10, goldfish: 10, vizslas: 0 +Sue 494: pomeranians: 5, cars: 0, vizslas: 0 +Sue 495: vizslas: 7, perfumes: 6, samoyeds: 3 +Sue 496: trees: 1, cats: 4, cars: 10 +Sue 497: cats: 1, perfumes: 0, cars: 7 +Sue 498: perfumes: 7, vizslas: 6, cats: 9 +Sue 499: vizslas: 8, perfumes: 1, akitas: 3 +Sue 500: perfumes: 4, cars: 9, trees: 4 From 5cce56ced2c79531f5121fd928948c0448a920e9 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 22:18:54 +0100 Subject: [PATCH 062/100] 2015: d16: ex1: add solution --- 2015/d16/ex1/ex1.py | 62 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100755 2015/d16/ex1/ex1.py diff --git a/2015/d16/ex1/ex1.py b/2015/d16/ex1/ex1.py new file mode 100755 index 0000000..a7ca6c2 --- /dev/null +++ b/2015/d16/ex1/ex1.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python + +import sys +from typing import NamedTuple + + +class Sue(NamedTuple): + children: int | None = None + cats: int | None = None + samoyeds: int | None = None + pomeranians: int | None = None + akitas: int | None = None + vizslas: int | None = None + goldfish: int | None = None + trees: int | None = None + cars: int | None = None + perfumes: int | None = None + + def matches(self, reading: "Sue") -> bool: + for it, reading_it in zip(self, reading): + if it is None or reading_it is None: + continue + if it != reading_it: + return False + return True + + +def solve(input: str) -> int: + def parse_line(input: str) -> Sue: + _, other = input.split(": ", 1) + raw_items = other.split(", ") + items = { + name: int(val) for name, val in (item.split(": ") for item in raw_items) + } + return Sue(**items) + + def parse(input: str) -> list[Sue]: + return [parse_line(line) for line in input.splitlines()] + + aunts = parse(input) + reading = Sue( + children=3, + cats=7, + samoyeds=2, + pomeranians=3, + akitas=0, + vizslas=0, + goldfish=5, + trees=3, + cars=2, + perfumes=1, + ) + return next(i for i, sue in enumerate(aunts, 1) if sue.matches(reading)) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 0aefdfa45706e3837f0fd9aa827788a2750b34ec Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 22:18:59 +0100 Subject: [PATCH 063/100] 2015: d16: ex2: add input --- 2015/d16/ex2/input | 500 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 500 insertions(+) create mode 100644 2015/d16/ex2/input diff --git a/2015/d16/ex2/input b/2015/d16/ex2/input new file mode 100644 index 0000000..92ed31c --- /dev/null +++ b/2015/d16/ex2/input @@ -0,0 +1,500 @@ +Sue 1: goldfish: 6, trees: 9, akitas: 0 +Sue 2: goldfish: 7, trees: 1, akitas: 0 +Sue 3: cars: 10, akitas: 6, perfumes: 7 +Sue 4: perfumes: 2, vizslas: 0, cars: 6 +Sue 5: goldfish: 1, trees: 3, perfumes: 10 +Sue 6: children: 9, vizslas: 7, cars: 9 +Sue 7: cars: 6, vizslas: 5, cats: 3 +Sue 8: akitas: 10, vizslas: 9, children: 3 +Sue 9: vizslas: 8, cats: 2, trees: 1 +Sue 10: perfumes: 10, trees: 6, cars: 4 +Sue 11: cars: 9, children: 1, cats: 1 +Sue 12: pomeranians: 4, akitas: 6, goldfish: 8 +Sue 13: cats: 10, children: 5, trees: 9 +Sue 14: perfumes: 8, vizslas: 3, samoyeds: 1 +Sue 15: vizslas: 2, perfumes: 8, trees: 3 +Sue 16: pomeranians: 10, trees: 9, samoyeds: 4 +Sue 17: akitas: 7, vizslas: 0, goldfish: 6 +Sue 18: trees: 5, vizslas: 9, cars: 0 +Sue 19: akitas: 3, goldfish: 9, trees: 10 +Sue 20: perfumes: 7, samoyeds: 3, vizslas: 10 +Sue 21: perfumes: 7, pomeranians: 10, akitas: 8 +Sue 22: vizslas: 6, trees: 8, akitas: 10 +Sue 23: goldfish: 0, trees: 4, children: 9 +Sue 24: goldfish: 7, pomeranians: 9, akitas: 4 +Sue 25: cars: 7, trees: 4, pomeranians: 4 +Sue 26: trees: 9, akitas: 9, pomeranians: 7 +Sue 27: samoyeds: 0, perfumes: 9, goldfish: 10 +Sue 28: cars: 5, trees: 7, vizslas: 1 +Sue 29: perfumes: 9, trees: 1, children: 6 +Sue 30: goldfish: 10, trees: 0, cars: 4 +Sue 31: akitas: 2, perfumes: 5, goldfish: 5 +Sue 32: goldfish: 0, akitas: 5, trees: 0 +Sue 33: vizslas: 2, akitas: 2, samoyeds: 3 +Sue 34: goldfish: 8, perfumes: 5, cars: 3 +Sue 35: akitas: 1, cats: 4, trees: 9 +Sue 36: cars: 4, vizslas: 4, goldfish: 7 +Sue 37: akitas: 5, perfumes: 7, trees: 3 +Sue 38: goldfish: 10, trees: 2, vizslas: 9 +Sue 39: goldfish: 4, pomeranians: 5, vizslas: 5 +Sue 40: perfumes: 5, samoyeds: 4, akitas: 6 +Sue 41: goldfish: 9, cars: 4, perfumes: 5 +Sue 42: trees: 6, pomeranians: 9, goldfish: 8 +Sue 43: perfumes: 7, pomeranians: 1, akitas: 2 +Sue 44: vizslas: 9, cars: 5, cats: 0 +Sue 45: akitas: 1, goldfish: 6, trees: 0 +Sue 46: akitas: 5, vizslas: 8, trees: 2 +Sue 47: trees: 9, akitas: 2, vizslas: 9 +Sue 48: goldfish: 10, trees: 5, akitas: 2 +Sue 49: cars: 7, vizslas: 2, perfumes: 6 +Sue 50: akitas: 5, goldfish: 6, perfumes: 0 +Sue 51: cars: 9, cats: 7, trees: 5 +Sue 52: akitas: 7, goldfish: 10, cars: 0 +Sue 53: cars: 10, cats: 4, perfumes: 2 +Sue 54: goldfish: 2, pomeranians: 5, perfumes: 10 +Sue 55: vizslas: 5, akitas: 4, cars: 8 +Sue 56: goldfish: 9, vizslas: 4, akitas: 5 +Sue 57: perfumes: 8, samoyeds: 7, cars: 9 +Sue 58: cars: 5, akitas: 7, perfumes: 8 +Sue 59: samoyeds: 8, cars: 10, vizslas: 10 +Sue 60: akitas: 6, samoyeds: 0, goldfish: 3 +Sue 61: trees: 8, pomeranians: 0, akitas: 2 +Sue 62: trees: 1, perfumes: 3, vizslas: 4 +Sue 63: vizslas: 6, samoyeds: 9, goldfish: 8 +Sue 64: goldfish: 7, trees: 6, vizslas: 3 +Sue 65: cars: 1, vizslas: 0, akitas: 6 +Sue 66: cats: 6, pomeranians: 4, cars: 9 +Sue 67: trees: 10, pomeranians: 7, samoyeds: 3 +Sue 68: pomeranians: 5, goldfish: 9, akitas: 1 +Sue 69: akitas: 1, vizslas: 0, trees: 9 +Sue 70: cats: 4, goldfish: 4, vizslas: 10 +Sue 71: vizslas: 7, perfumes: 7, trees: 8 +Sue 72: children: 2, vizslas: 9, cats: 3 +Sue 73: cars: 8, pomeranians: 0, perfumes: 6 +Sue 74: akitas: 1, pomeranians: 8, vizslas: 10 +Sue 75: vizslas: 5, perfumes: 5, cars: 7 +Sue 76: cars: 3, vizslas: 3, goldfish: 0 +Sue 77: akitas: 9, samoyeds: 1, pomeranians: 3 +Sue 78: trees: 0, vizslas: 0, akitas: 6 +Sue 79: pomeranians: 9, cars: 1, perfumes: 0 +Sue 80: perfumes: 10, trees: 1, cats: 0 +Sue 81: goldfish: 5, akitas: 9, trees: 0 +Sue 82: vizslas: 1, akitas: 6, children: 4 +Sue 83: samoyeds: 7, perfumes: 8, pomeranians: 4 +Sue 84: perfumes: 3, children: 3, cats: 7 +Sue 85: goldfish: 9, trees: 3, cars: 9 +Sue 86: cars: 0, perfumes: 9, vizslas: 0 +Sue 87: children: 3, trees: 4, akitas: 3 +Sue 88: trees: 1, samoyeds: 1, goldfish: 0 +Sue 89: akitas: 8, cars: 3, vizslas: 9 +Sue 90: pomeranians: 9, trees: 9, goldfish: 8 +Sue 91: goldfish: 7, trees: 10, children: 0 +Sue 92: cats: 9, cars: 7, perfumes: 7 +Sue 93: vizslas: 2, goldfish: 7, cats: 9 +Sue 94: akitas: 5, cars: 8, vizslas: 4 +Sue 95: goldfish: 7, vizslas: 1, perfumes: 2 +Sue 96: goldfish: 5, trees: 6, perfumes: 10 +Sue 97: trees: 0, perfumes: 7, cars: 0 +Sue 98: cars: 2, perfumes: 6, trees: 8 +Sue 99: trees: 10, children: 7, cats: 9 +Sue 100: samoyeds: 5, goldfish: 6, vizslas: 6 +Sue 101: cars: 10, perfumes: 9, vizslas: 3 +Sue 102: pomeranians: 6, trees: 1, samoyeds: 4 +Sue 103: cars: 2, perfumes: 1, goldfish: 5 +Sue 104: goldfish: 2, cars: 8, pomeranians: 2 +Sue 105: goldfish: 6, vizslas: 0, trees: 10 +Sue 106: trees: 10, akitas: 10, pomeranians: 0 +Sue 107: vizslas: 2, pomeranians: 10, trees: 3 +Sue 108: children: 3, vizslas: 8, akitas: 7 +Sue 109: perfumes: 2, akitas: 2, samoyeds: 3 +Sue 110: goldfish: 7, trees: 1, perfumes: 1 +Sue 111: akitas: 2, cars: 9, perfumes: 2 +Sue 112: children: 10, cars: 0, akitas: 3 +Sue 113: akitas: 9, vizslas: 4, children: 3 +Sue 114: pomeranians: 3, trees: 2, goldfish: 5 +Sue 115: perfumes: 8, cars: 6, trees: 0 +Sue 116: samoyeds: 6, children: 3, pomeranians: 1 +Sue 117: goldfish: 1, trees: 2, akitas: 1 +Sue 118: goldfish: 10, akitas: 10, samoyeds: 0 +Sue 119: vizslas: 10, perfumes: 6, cars: 0 +Sue 120: cars: 2, perfumes: 9, goldfish: 5 +Sue 121: vizslas: 2, trees: 2, cars: 6 +Sue 122: vizslas: 3, trees: 0, akitas: 2 +Sue 123: akitas: 5, samoyeds: 7, goldfish: 1 +Sue 124: goldfish: 8, samoyeds: 7, trees: 8 +Sue 125: trees: 3, goldfish: 8, perfumes: 5 +Sue 126: cats: 3, vizslas: 9, goldfish: 0 +Sue 127: pomeranians: 9, goldfish: 3, perfumes: 6 +Sue 128: vizslas: 4, cars: 8, goldfish: 5 +Sue 129: vizslas: 8, children: 5, perfumes: 8 +Sue 130: cars: 7, children: 7, cats: 3 +Sue 131: perfumes: 1, akitas: 8, vizslas: 9 +Sue 132: perfumes: 7, samoyeds: 10, pomeranians: 6 +Sue 133: cars: 5, perfumes: 3, goldfish: 7 +Sue 134: perfumes: 9, akitas: 2, cats: 3 +Sue 135: perfumes: 1, trees: 9, vizslas: 9 +Sue 136: akitas: 7, cars: 3, perfumes: 7 +Sue 137: vizslas: 9, goldfish: 8, cars: 5 +Sue 138: trees: 0, samoyeds: 1, cars: 3 +Sue 139: cars: 0, perfumes: 6, trees: 0 +Sue 140: pomeranians: 4, cars: 1, perfumes: 7 +Sue 141: vizslas: 10, akitas: 8, cats: 3 +Sue 142: trees: 1, cats: 6, vizslas: 5 +Sue 143: pomeranians: 9, cars: 7, perfumes: 9 +Sue 144: cars: 0, perfumes: 2, pomeranians: 1 +Sue 145: trees: 1, goldfish: 9, perfumes: 8 +Sue 146: cars: 8, children: 5, vizslas: 2 +Sue 147: perfumes: 2, goldfish: 5, cars: 0 +Sue 148: akitas: 2, perfumes: 7, pomeranians: 6 +Sue 149: goldfish: 8, cars: 0, trees: 1 +Sue 150: akitas: 6, perfumes: 5, trees: 0 +Sue 151: vizslas: 6, samoyeds: 8, akitas: 10 +Sue 152: trees: 7, akitas: 7, perfumes: 6 +Sue 153: goldfish: 9, cats: 9, cars: 3 +Sue 154: vizslas: 10, trees: 0, cars: 9 +Sue 155: perfumes: 3, children: 2, goldfish: 1 +Sue 156: goldfish: 7, perfumes: 5, akitas: 6 +Sue 157: cats: 10, trees: 1, goldfish: 0 +Sue 158: cats: 7, children: 7, vizslas: 6 +Sue 159: perfumes: 9, akitas: 0, cars: 0 +Sue 160: akitas: 3, goldfish: 10, pomeranians: 2 +Sue 161: goldfish: 10, cars: 6, perfumes: 3 +Sue 162: trees: 0, cars: 9, goldfish: 1 +Sue 163: cars: 8, perfumes: 9, vizslas: 5 +Sue 164: goldfish: 1, trees: 10, children: 6 +Sue 165: goldfish: 0, vizslas: 6, cars: 0 +Sue 166: akitas: 5, vizslas: 1, cars: 5 +Sue 167: vizslas: 1, samoyeds: 1, children: 4 +Sue 168: samoyeds: 7, vizslas: 7, akitas: 3 +Sue 169: goldfish: 3, cats: 9, trees: 2 +Sue 170: cars: 5, perfumes: 9, vizslas: 5 +Sue 171: goldfish: 7, cars: 6, perfumes: 10 +Sue 172: cats: 6, akitas: 1, children: 6 +Sue 173: cats: 4, goldfish: 1, children: 3 +Sue 174: cars: 2, pomeranians: 2, vizslas: 7 +Sue 175: trees: 0, children: 4, goldfish: 7 +Sue 176: children: 8, cars: 5, cats: 9 +Sue 177: pomeranians: 4, vizslas: 7, trees: 3 +Sue 178: vizslas: 6, perfumes: 10, akitas: 6 +Sue 179: cars: 4, akitas: 4, trees: 4 +Sue 180: akitas: 8, goldfish: 6, trees: 9 +Sue 181: perfumes: 3, vizslas: 10, cars: 3 +Sue 182: vizslas: 3, samoyeds: 3, goldfish: 7 +Sue 183: goldfish: 10, perfumes: 2, cats: 1 +Sue 184: goldfish: 5, trees: 1, perfumes: 1 +Sue 185: vizslas: 10, trees: 9, perfumes: 2 +Sue 186: goldfish: 6, perfumes: 9, trees: 1 +Sue 187: cars: 0, trees: 9, goldfish: 6 +Sue 188: cars: 0, trees: 1, vizslas: 9 +Sue 189: akitas: 7, vizslas: 2, trees: 0 +Sue 190: pomeranians: 5, perfumes: 8, akitas: 10 +Sue 191: vizslas: 5, akitas: 3, cats: 0 +Sue 192: children: 1, trees: 1, cars: 2 +Sue 193: cars: 3, goldfish: 9, trees: 2 +Sue 194: samoyeds: 3, akitas: 4, perfumes: 8 +Sue 195: trees: 1, vizslas: 8, akitas: 10 +Sue 196: akitas: 6, cars: 5, pomeranians: 0 +Sue 197: akitas: 5, vizslas: 5, cats: 1 +Sue 198: trees: 4, cars: 6, goldfish: 6 +Sue 199: cats: 7, cars: 5, goldfish: 6 +Sue 200: vizslas: 4, cats: 0, akitas: 9 +Sue 201: pomeranians: 1, perfumes: 4, children: 2 +Sue 202: cats: 1, perfumes: 4, vizslas: 3 +Sue 203: vizslas: 1, akitas: 9, children: 5 +Sue 204: perfumes: 8, cars: 7, trees: 4 +Sue 205: perfumes: 7, pomeranians: 5, cats: 9 +Sue 206: vizslas: 8, trees: 2, akitas: 2 +Sue 207: akitas: 6, vizslas: 2, perfumes: 10 +Sue 208: vizslas: 1, children: 7, akitas: 4 +Sue 209: perfumes: 4, trees: 2, children: 1 +Sue 210: goldfish: 0, vizslas: 2, samoyeds: 10 +Sue 211: cars: 8, perfumes: 3, trees: 1 +Sue 212: cars: 8, samoyeds: 5, pomeranians: 8 +Sue 213: akitas: 2, goldfish: 8, pomeranians: 2 +Sue 214: akitas: 6, pomeranians: 2, cars: 0 +Sue 215: trees: 10, pomeranians: 4, vizslas: 0 +Sue 216: perfumes: 0, cars: 8, trees: 0 +Sue 217: samoyeds: 8, akitas: 7, children: 10 +Sue 218: perfumes: 1, vizslas: 6, children: 0 +Sue 219: children: 1, goldfish: 4, trees: 1 +Sue 220: akitas: 10, goldfish: 10, trees: 5 +Sue 221: cars: 7, pomeranians: 6, perfumes: 3 +Sue 222: vizslas: 6, children: 0, akitas: 5 +Sue 223: perfumes: 9, cars: 1, trees: 6 +Sue 224: pomeranians: 1, trees: 0, vizslas: 0 +Sue 225: goldfish: 8, akitas: 4, perfumes: 10 +Sue 226: pomeranians: 7, cats: 7, children: 4 +Sue 227: trees: 0, akitas: 2, perfumes: 1 +Sue 228: vizslas: 6, cars: 10, perfumes: 9 +Sue 229: cars: 0, perfumes: 6, trees: 4 +Sue 230: pomeranians: 7, perfumes: 5, trees: 2 +Sue 231: goldfish: 9, cars: 6, trees: 7 +Sue 232: akitas: 1, vizslas: 5, cars: 3 +Sue 233: akitas: 7, samoyeds: 2, vizslas: 5 +Sue 234: akitas: 6, cats: 8, pomeranians: 0 +Sue 235: pomeranians: 5, akitas: 5, vizslas: 3 +Sue 236: goldfish: 5, trees: 6, akitas: 5 +Sue 237: goldfish: 9, perfumes: 5, cats: 5 +Sue 238: cats: 8, goldfish: 4, perfumes: 0 +Sue 239: samoyeds: 8, children: 6, pomeranians: 6 +Sue 240: akitas: 4, samoyeds: 10, trees: 8 +Sue 241: trees: 2, goldfish: 8, cars: 1 +Sue 242: perfumes: 2, cars: 0, akitas: 10 +Sue 243: pomeranians: 1, cars: 7, trees: 2 +Sue 244: trees: 9, vizslas: 2, akitas: 10 +Sue 245: cars: 9, pomeranians: 4, trees: 0 +Sue 246: cars: 9, pomeranians: 7, perfumes: 1 +Sue 247: trees: 0, goldfish: 1, akitas: 8 +Sue 248: vizslas: 1, cats: 4, akitas: 4 +Sue 249: cats: 6, children: 4, goldfish: 9 +Sue 250: vizslas: 1, cars: 10, samoyeds: 5 +Sue 251: cars: 0, goldfish: 1, vizslas: 7 +Sue 252: cars: 7, akitas: 9, vizslas: 10 +Sue 253: akitas: 7, vizslas: 2, perfumes: 5 +Sue 254: vizslas: 10, akitas: 5, samoyeds: 0 +Sue 255: pomeranians: 8, goldfish: 0, cats: 6 +Sue 256: cars: 10, goldfish: 8, vizslas: 9 +Sue 257: goldfish: 3, perfumes: 9, cats: 3 +Sue 258: trees: 6, goldfish: 6, cars: 6 +Sue 259: trees: 0, goldfish: 2, perfumes: 8 +Sue 260: trees: 5, akitas: 0, cars: 0 +Sue 261: pomeranians: 9, goldfish: 7, perfumes: 8 +Sue 262: perfumes: 8, vizslas: 6, goldfish: 2 +Sue 263: vizslas: 6, trees: 5, goldfish: 9 +Sue 264: vizslas: 4, perfumes: 7, cars: 9 +Sue 265: goldfish: 10, trees: 3, perfumes: 1 +Sue 266: trees: 10, akitas: 8, goldfish: 8 +Sue 267: goldfish: 4, trees: 0, samoyeds: 9 +Sue 268: vizslas: 1, trees: 0, goldfish: 8 +Sue 269: cars: 2, perfumes: 10, goldfish: 5 +Sue 270: perfumes: 7, cars: 2, vizslas: 1 +Sue 271: cars: 6, perfumes: 10, goldfish: 6 +Sue 272: samoyeds: 4, goldfish: 2, vizslas: 9 +Sue 273: perfumes: 4, goldfish: 4, vizslas: 1 +Sue 274: children: 4, cars: 4, perfumes: 3 +Sue 275: children: 8, vizslas: 3, trees: 2 +Sue 276: vizslas: 5, children: 7, perfumes: 3 +Sue 277: perfumes: 3, cats: 4, vizslas: 5 +Sue 278: cars: 1, samoyeds: 10, akitas: 2 +Sue 279: trees: 9, perfumes: 9, cars: 10 +Sue 280: vizslas: 5, trees: 0, perfumes: 6 +Sue 281: vizslas: 3, akitas: 10, pomeranians: 7 +Sue 282: trees: 1, children: 2, akitas: 8 +Sue 283: akitas: 9, goldfish: 6, cats: 5 +Sue 284: cars: 9, children: 10, pomeranians: 2 +Sue 285: pomeranians: 0, perfumes: 4, cars: 7 +Sue 286: perfumes: 0, vizslas: 10, akitas: 10 +Sue 287: cats: 2, perfumes: 3, trees: 5 +Sue 288: akitas: 9, vizslas: 8, samoyeds: 9 +Sue 289: perfumes: 6, children: 2, cars: 7 +Sue 290: akitas: 0, children: 5, cars: 5 +Sue 291: cars: 4, perfumes: 0, trees: 1 +Sue 292: cats: 0, cars: 8, perfumes: 6 +Sue 293: akitas: 9, cats: 5, children: 5 +Sue 294: akitas: 4, cars: 9, goldfish: 3 +Sue 295: cars: 2, akitas: 3, perfumes: 7 +Sue 296: perfumes: 4, cars: 7, goldfish: 10 +Sue 297: trees: 5, akitas: 8, vizslas: 1 +Sue 298: perfumes: 0, goldfish: 6, trees: 9 +Sue 299: perfumes: 6, samoyeds: 8, cars: 1 +Sue 300: goldfish: 10, perfumes: 4, akitas: 2 +Sue 301: cars: 3, trees: 0, goldfish: 8 +Sue 302: perfumes: 7, samoyeds: 2, vizslas: 7 +Sue 303: children: 10, goldfish: 7, perfumes: 2 +Sue 304: samoyeds: 8, vizslas: 2, cars: 1 +Sue 305: trees: 1, cats: 0, goldfish: 10 +Sue 306: trees: 4, perfumes: 2, cars: 7 +Sue 307: cars: 6, vizslas: 2, children: 6 +Sue 308: vizslas: 2, cars: 0, akitas: 7 +Sue 309: cars: 3, vizslas: 8, perfumes: 6 +Sue 310: goldfish: 7, perfumes: 7, vizslas: 3 +Sue 311: pomeranians: 10, trees: 2, cars: 0 +Sue 312: samoyeds: 2, vizslas: 9, akitas: 1 +Sue 313: cars: 4, pomeranians: 7, goldfish: 7 +Sue 314: akitas: 2, pomeranians: 9, samoyeds: 10 +Sue 315: akitas: 3, vizslas: 2, trees: 0 +Sue 316: cars: 0, perfumes: 4, pomeranians: 6 +Sue 317: akitas: 10, goldfish: 3, pomeranians: 7 +Sue 318: cars: 9, trees: 0, pomeranians: 9 +Sue 319: akitas: 3, vizslas: 7, children: 10 +Sue 320: vizslas: 0, akitas: 8, pomeranians: 4 +Sue 321: cars: 10, akitas: 9, vizslas: 3 +Sue 322: perfumes: 0, akitas: 8, vizslas: 6 +Sue 323: vizslas: 10, perfumes: 5, cars: 3 +Sue 324: akitas: 0, goldfish: 6, vizslas: 7 +Sue 325: perfumes: 9, vizslas: 5, pomeranians: 2 +Sue 326: vizslas: 6, goldfish: 10, pomeranians: 8 +Sue 327: vizslas: 10, cars: 1, akitas: 7 +Sue 328: trees: 1, perfumes: 10, cars: 10 +Sue 329: pomeranians: 5, samoyeds: 3, cars: 10 +Sue 330: akitas: 6, cars: 1, pomeranians: 4 +Sue 331: cars: 5, children: 2, trees: 0 +Sue 332: vizslas: 6, pomeranians: 1, perfumes: 0 +Sue 333: akitas: 7, trees: 1, cats: 9 +Sue 334: vizslas: 6, goldfish: 9, akitas: 7 +Sue 335: akitas: 3, samoyeds: 3, cars: 3 +Sue 336: samoyeds: 10, perfumes: 9, trees: 6 +Sue 337: vizslas: 2, cars: 9, akitas: 0 +Sue 338: akitas: 6, perfumes: 9, vizslas: 3 +Sue 339: cars: 3, samoyeds: 8, trees: 2 +Sue 340: cats: 7, perfumes: 8, cars: 9 +Sue 341: goldfish: 9, perfumes: 5, cars: 10 +Sue 342: trees: 0, akitas: 3, perfumes: 5 +Sue 343: perfumes: 2, children: 0, cars: 6 +Sue 344: goldfish: 8, trees: 8, perfumes: 0 +Sue 345: perfumes: 6, cars: 6, goldfish: 5 +Sue 346: vizslas: 8, trees: 1, cars: 6 +Sue 347: cars: 0, cats: 3, perfumes: 7 +Sue 348: children: 7, perfumes: 10, cars: 7 +Sue 349: pomeranians: 8, akitas: 5, children: 2 +Sue 350: perfumes: 9, pomeranians: 4, goldfish: 3 +Sue 351: perfumes: 8, pomeranians: 7, trees: 4 +Sue 352: samoyeds: 1, goldfish: 9, akitas: 8 +Sue 353: akitas: 6, goldfish: 10, vizslas: 8 +Sue 354: akitas: 7, cars: 2, goldfish: 6 +Sue 355: cars: 3, goldfish: 6, akitas: 5 +Sue 356: akitas: 2, goldfish: 9, pomeranians: 1 +Sue 357: goldfish: 10, cars: 6, pomeranians: 9 +Sue 358: trees: 0, children: 2, goldfish: 6 +Sue 359: samoyeds: 3, cars: 2, akitas: 4 +Sue 360: trees: 1, goldfish: 8, cars: 5 +Sue 361: akitas: 5, vizslas: 7, perfumes: 1 +Sue 362: cats: 5, vizslas: 9, children: 4 +Sue 363: goldfish: 9, perfumes: 3, vizslas: 9 +Sue 364: children: 7, samoyeds: 2, pomeranians: 10 +Sue 365: perfumes: 9, akitas: 10, pomeranians: 4 +Sue 366: cars: 10, trees: 3, cats: 4 +Sue 367: vizslas: 6, akitas: 10, perfumes: 5 +Sue 368: akitas: 9, vizslas: 9, children: 4 +Sue 369: goldfish: 8, trees: 2, perfumes: 5 +Sue 370: trees: 0, children: 4, cars: 8 +Sue 371: cats: 6, perfumes: 0, vizslas: 2 +Sue 372: akitas: 7, cars: 5, perfumes: 3 +Sue 373: cars: 0, perfumes: 4, pomeranians: 10 +Sue 374: akitas: 5, perfumes: 5, vizslas: 2 +Sue 375: goldfish: 7, trees: 10, pomeranians: 7 +Sue 376: cars: 8, trees: 1, pomeranians: 8 +Sue 377: cars: 0, akitas: 9, vizslas: 1 +Sue 378: akitas: 5, perfumes: 3, vizslas: 7 +Sue 379: trees: 2, goldfish: 8, pomeranians: 8 +Sue 380: akitas: 5, cars: 9, perfumes: 9 +Sue 381: cars: 2, perfumes: 6, trees: 3 +Sue 382: perfumes: 6, vizslas: 2, goldfish: 9 +Sue 383: akitas: 8, vizslas: 7, cats: 1 +Sue 384: akitas: 9, trees: 10, vizslas: 7 +Sue 385: cars: 0, perfumes: 7, vizslas: 2 +Sue 386: vizslas: 10, akitas: 4, perfumes: 9 +Sue 387: perfumes: 6, pomeranians: 5, samoyeds: 8 +Sue 388: vizslas: 10, trees: 9, goldfish: 9 +Sue 389: goldfish: 8, akitas: 4, perfumes: 10 +Sue 390: goldfish: 6, trees: 8, akitas: 1 +Sue 391: vizslas: 4, akitas: 10, goldfish: 7 +Sue 392: akitas: 1, vizslas: 6, samoyeds: 5 +Sue 393: trees: 6, cars: 3, akitas: 5 +Sue 394: goldfish: 9, trees: 3, cars: 5 +Sue 395: akitas: 6, samoyeds: 4, goldfish: 4 +Sue 396: akitas: 2, trees: 1, cats: 5 +Sue 397: cars: 0, children: 9, trees: 10 +Sue 398: pomeranians: 3, samoyeds: 9, goldfish: 10 +Sue 399: cars: 7, akitas: 4, goldfish: 8 +Sue 400: cars: 4, akitas: 5, vizslas: 4 +Sue 401: pomeranians: 5, akitas: 8, vizslas: 5 +Sue 402: cats: 7, cars: 6, goldfish: 6 +Sue 403: samoyeds: 8, perfumes: 4, cars: 5 +Sue 404: akitas: 10, goldfish: 4, trees: 2 +Sue 405: trees: 8, perfumes: 1, cars: 2 +Sue 406: trees: 0, perfumes: 9, pomeranians: 10 +Sue 407: perfumes: 4, trees: 7, goldfish: 3 +Sue 408: akitas: 1, perfumes: 3, cars: 5 +Sue 409: trees: 6, samoyeds: 3, cars: 9 +Sue 410: vizslas: 3, goldfish: 5, akitas: 7 +Sue 411: goldfish: 10, trees: 1, vizslas: 9 +Sue 412: cars: 0, akitas: 6, trees: 6 +Sue 413: goldfish: 7, trees: 0, cars: 3 +Sue 414: pomeranians: 10, samoyeds: 3, cars: 10 +Sue 415: perfumes: 6, trees: 9, cars: 4 +Sue 416: trees: 2, cars: 4, goldfish: 8 +Sue 417: goldfish: 2, cars: 9, cats: 5 +Sue 418: vizslas: 1, cars: 9, akitas: 0 +Sue 419: perfumes: 6, cats: 3, children: 9 +Sue 420: cats: 5, goldfish: 7, akitas: 9 +Sue 421: trees: 1, samoyeds: 6, pomeranians: 1 +Sue 422: trees: 10, goldfish: 6, children: 7 +Sue 423: cars: 8, goldfish: 7, vizslas: 3 +Sue 424: samoyeds: 9, akitas: 7, trees: 5 +Sue 425: akitas: 5, children: 4, perfumes: 9 +Sue 426: goldfish: 1, children: 9, cats: 2 +Sue 427: vizslas: 9, akitas: 7, goldfish: 9 +Sue 428: pomeranians: 7, akitas: 5, vizslas: 1 +Sue 429: vizslas: 7, goldfish: 7, cars: 9 +Sue 430: trees: 7, perfumes: 0, pomeranians: 5 +Sue 431: children: 9, perfumes: 5, vizslas: 7 +Sue 432: trees: 6, samoyeds: 7, cats: 1 +Sue 433: goldfish: 5, trees: 5, children: 6 +Sue 434: goldfish: 9, akitas: 7, cars: 3 +Sue 435: samoyeds: 10, perfumes: 2, cars: 0 +Sue 436: akitas: 5, pomeranians: 4, perfumes: 7 +Sue 437: vizslas: 5, cats: 6, perfumes: 5 +Sue 438: trees: 2, goldfish: 6, vizslas: 7 +Sue 439: samoyeds: 8, pomeranians: 10, goldfish: 1 +Sue 440: akitas: 6, children: 9, perfumes: 4 +Sue 441: cars: 2, goldfish: 9, children: 0 +Sue 442: goldfish: 7, cars: 2, vizslas: 8 +Sue 443: goldfish: 6, samoyeds: 3, perfumes: 2 +Sue 444: trees: 2, goldfish: 7, cars: 8 +Sue 445: trees: 2, pomeranians: 0, children: 0 +Sue 446: perfumes: 4, akitas: 4, goldfish: 6 +Sue 447: vizslas: 7, akitas: 9, cars: 3 +Sue 448: goldfish: 6, trees: 9, cars: 0 +Sue 449: samoyeds: 7, perfumes: 4, vizslas: 10 +Sue 450: akitas: 7, cars: 10, goldfish: 7 +Sue 451: goldfish: 4, children: 7, pomeranians: 4 +Sue 452: cats: 4, vizslas: 6, trees: 7 +Sue 453: cars: 1, trees: 10, goldfish: 9 +Sue 454: trees: 2, goldfish: 3, vizslas: 10 +Sue 455: pomeranians: 9, vizslas: 3, akitas: 2 +Sue 456: vizslas: 10, akitas: 2, goldfish: 1 +Sue 457: trees: 5, cats: 5, children: 8 +Sue 458: cars: 6, goldfish: 3, akitas: 9 +Sue 459: goldfish: 7, akitas: 2, cats: 7 +Sue 460: akitas: 1, cars: 5, children: 8 +Sue 461: cars: 8, perfumes: 0, goldfish: 6 +Sue 462: pomeranians: 6, cats: 2, perfumes: 6 +Sue 463: vizslas: 7, perfumes: 3, goldfish: 3 +Sue 464: akitas: 10, goldfish: 10, trees: 1 +Sue 465: vizslas: 0, akitas: 2, trees: 2 +Sue 466: perfumes: 6, akitas: 8, cars: 2 +Sue 467: goldfish: 1, cars: 10, perfumes: 3 +Sue 468: goldfish: 4, trees: 2, cars: 9 +Sue 469: perfumes: 6, pomeranians: 0, vizslas: 10 +Sue 470: samoyeds: 8, children: 0, akitas: 7 +Sue 471: children: 3, goldfish: 9, cats: 9 +Sue 472: samoyeds: 0, goldfish: 0, trees: 0 +Sue 473: trees: 3, goldfish: 4, vizslas: 1 +Sue 474: perfumes: 10, cars: 3, trees: 7 +Sue 475: akitas: 5, vizslas: 4, goldfish: 5 +Sue 476: children: 2, akitas: 7, vizslas: 3 +Sue 477: vizslas: 6, pomeranians: 9, trees: 6 +Sue 478: vizslas: 7, pomeranians: 6, akitas: 7 +Sue 479: trees: 2, perfumes: 2, children: 2 +Sue 480: cars: 8, cats: 5, vizslas: 0 +Sue 481: trees: 5, goldfish: 0, akitas: 3 +Sue 482: cars: 8, perfumes: 6, goldfish: 10 +Sue 483: goldfish: 0, cars: 3, perfumes: 10 +Sue 484: pomeranians: 1, samoyeds: 1, perfumes: 3 +Sue 485: trees: 0, akitas: 2, vizslas: 4 +Sue 486: cars: 3, vizslas: 8, goldfish: 1 +Sue 487: pomeranians: 9, vizslas: 2, children: 10 +Sue 488: akitas: 6, vizslas: 10, perfumes: 9 +Sue 489: goldfish: 6, vizslas: 4, cars: 2 +Sue 490: vizslas: 10, cats: 8, samoyeds: 1 +Sue 491: cats: 9, cars: 1, perfumes: 10 +Sue 492: goldfish: 6, cars: 9, pomeranians: 9 +Sue 493: children: 10, goldfish: 10, vizslas: 0 +Sue 494: pomeranians: 5, cars: 0, vizslas: 0 +Sue 495: vizslas: 7, perfumes: 6, samoyeds: 3 +Sue 496: trees: 1, cats: 4, cars: 10 +Sue 497: cats: 1, perfumes: 0, cars: 7 +Sue 498: perfumes: 7, vizslas: 6, cats: 9 +Sue 499: vizslas: 8, perfumes: 1, akitas: 3 +Sue 500: perfumes: 4, cars: 9, trees: 4 From fc2cad488b519fede26af783e78936643fbec82d Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 22:19:08 +0100 Subject: [PATCH 064/100] 2015: d16: ex2: add solution --- 2015/d16/ex2/ex2.py | 69 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100755 2015/d16/ex2/ex2.py diff --git a/2015/d16/ex2/ex2.py b/2015/d16/ex2/ex2.py new file mode 100755 index 0000000..5711b59 --- /dev/null +++ b/2015/d16/ex2/ex2.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python + +import sys +from typing import NamedTuple + + +class Sue(NamedTuple): + children: int | None = None + cats: int | None = None + samoyeds: int | None = None + pomeranians: int | None = None + akitas: int | None = None + vizslas: int | None = None + goldfish: int | None = None + trees: int | None = None + cars: int | None = None + perfumes: int | None = None + + def matches(self, reading: dict[str, int | None]) -> bool: + for name, expected in reading.items(): + assert expected is not None # Sanity check + val = getattr(self, name) + if name in ("cats", "trees"): + if val is not None and val <= expected: + return False + elif name in ("pomeranians", "goldfish"): + if val is not None and val >= expected: + return False + else: + if val is not None and val != expected: + return False + return True + + +def solve(input: str) -> int: + def parse_line(input: str) -> Sue: + _, other = input.split(": ", 1) + raw_items = other.split(", ") + items = { + name: int(val) for name, val in (item.split(": ") for item in raw_items) + } + return Sue(**items) + + def parse(input: str) -> list[Sue]: + return [parse_line(line) for line in input.splitlines()] + + aunts = parse(input) + reading = Sue( + children=3, + cats=7, + samoyeds=2, + pomeranians=3, + akitas=0, + vizslas=0, + goldfish=5, + trees=3, + cars=2, + perfumes=1, + ) + return next(i for i, sue in enumerate(aunts, 1) if sue.matches(reading._asdict())) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 89caeed1573c0812473e4df6e9b4895081e3f3fb Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 22:25:32 +0100 Subject: [PATCH 065/100] 2015: d17: ex1: add input --- 2015/d17/ex1/input | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 2015/d17/ex1/input diff --git a/2015/d17/ex1/input b/2015/d17/ex1/input new file mode 100644 index 0000000..09ebd46 --- /dev/null +++ b/2015/d17/ex1/input @@ -0,0 +1,20 @@ +43 +3 +4 +10 +21 +44 +4 +6 +47 +41 +34 +17 +17 +44 +36 +31 +46 +9 +27 +38 From a6a126cc3da523d04135df13223b7d7cc81d608e Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 22:26:24 +0100 Subject: [PATCH 066/100] 2015: d17: ex1: add solution --- 2015/d17/ex1/ex1.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 2015/d17/ex1/ex1.py diff --git a/2015/d17/ex1/ex1.py b/2015/d17/ex1/ex1.py new file mode 100755 index 0000000..8cbeb5b --- /dev/null +++ b/2015/d17/ex1/ex1.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python + +import itertools +import sys + +TOTAL_EGGNOG = 150 + + +def solve(input: str) -> int: + def parse(input: str) -> list[int]: + return [int(line) for line in input.splitlines()] + + containers = parse(input) + return sum( + sum(combination) == TOTAL_EGGNOG + for combination in itertools.chain.from_iterable( + itertools.combinations(containers, i) for i in range(1, len(containers) + 1) + ) + ) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 6b2144fd2e67b2ba6ff063a8cd97f8f6a694c3f6 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 22:26:30 +0100 Subject: [PATCH 067/100] 2015: d17: ex2: add input --- 2015/d17/ex2/input | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 2015/d17/ex2/input diff --git a/2015/d17/ex2/input b/2015/d17/ex2/input new file mode 100644 index 0000000..09ebd46 --- /dev/null +++ b/2015/d17/ex2/input @@ -0,0 +1,20 @@ +43 +3 +4 +10 +21 +44 +4 +6 +47 +41 +34 +17 +17 +44 +36 +31 +46 +9 +27 +38 From 86cdf0c8b6eb2cb8172ebfbab35eb5572b6a5dbf Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 22:26:44 +0100 Subject: [PATCH 068/100] 2015: d17: ex2: add solution --- 2015/d17/ex2/ex2.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 2015/d17/ex2/ex2.py diff --git a/2015/d17/ex2/ex2.py b/2015/d17/ex2/ex2.py new file mode 100755 index 0000000..1c1cdda --- /dev/null +++ b/2015/d17/ex2/ex2.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python + +import itertools +import sys + +TOTAL_EGGNOG = 150 + + +def solve(input: str) -> int: + def parse(input: str) -> list[int]: + return [int(line) for line in input.splitlines()] + + containers = parse(input) + min_containers = min( + i + for i in range(1, len(containers) + 1) + if any( + sum(combination) == TOTAL_EGGNOG + for combination in itertools.combinations(containers, i) + ) + ) + return sum( + sum(combination) == TOTAL_EGGNOG + for combination in itertools.combinations(containers, min_containers) + ) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From c7bdbede809b1e49759c12dad120e618ab5b44c4 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 23:06:21 +0100 Subject: [PATCH 069/100] 2015: d18: ex1: add input --- 2015/d18/ex1/input | 100 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 2015/d18/ex1/input diff --git a/2015/d18/ex1/input b/2015/d18/ex1/input new file mode 100644 index 0000000..e91a2a7 --- /dev/null +++ b/2015/d18/ex1/input @@ -0,0 +1,100 @@ +###.##..##.#..#.##...#..#.####..#.##.##.##..###...#....#...###..#..###..###.#.#.#..#.##..#...##.#..# +.#...##.#####..##.......#..####.###.##.#..###.###.....#.#.####.##.###..##...###....#.##.....#.#.#.## +.....#.#.....#..###..####..#.....##.#..###.####.#.######..##......#####.#.##.#########.###..#.##.#.# +...###......#.#..###..#.#.....#.##..#.##..###...#.##.#..#..#.##.#..##......##.##.##.######...#....## +.###.....#...#.#...####.#.###..#..####.#..#.##..####...##.#...#..###...###...####..##....####.##..#. +..#....#...#.......#..###.###....#.##..#.....###.#.##.#....#.#....##.##..#.##.#..###.###.##.##..##.# +##..#####.#.#....#.#...#.#.####..#....#..#....#.#..#.#####...#..##.#.....#.##..##.####......#.#.##.. +.#..##..#.#.###..##..##...#....##...#..#.#..##.##..###.####.....#.####.#.....##.#.##...#..####..#... +#.#####.......#####...#...####.#.#.#....#.###.#.##.#####..#.###.#..##.##.#.##....#.##..#....####.#.# +#.##...#####....##.#.#.....##......##.##...#.##.##...##...###.###.##.#.####.####.##..#.##.#.#.####.. +#.##.##....###.###.#..#..##.##.#..#.#..##..#.#...#.##........###..#...##.#.#.##.......##.....#...### +###..#.#..##.##.#.#.#...#..#...##.##.#.########.......#.#...#....########..#.#.###..#.#..#.##..##### +####.#.#...#.##.##..#.#...#....#..###..#.#.#.####.#.##.##.#..##..##..#..#####.####.##..########..##. +.#.#...#..##.#..#..###.#..####.......##.#.#.#.##.#####..#..##...#.##...#..#....#..#..###..####.#.... +..#.#...#....##...#####..#..#...###.###.....#.###.#....#.#..##...#.##.##.####.#.#.#..#.##.#....#.#.. +#....###.####.##..#.#.###..###.##.##..#.#...###..#.##.#####.##.#######..#.#...##.#..........####.### +#.#####.#......#.#......#.....##...##.#.#########.#......##..##..##.#..##.##..#....##...###...#.#... +#..#..##..###.#.#.#.#.....###.#.####.##.##....#.#..##....#.#..#.####..###.##...#######.#####.##.#.#. +..###.#........##.#...###..#.##..#.#....##.#......#..#.##..#.#..#.#..#.####.#####..###.##..#.##.#... +##.###....#..##...#..#.#......##..#...#..#.####..#.##...##.####.#...#..###...#.#.#....###.##..#.#... +..##.##.#.##..##.#..#.###...##..##..#....##..##...####.#..####.###...#.....#..#.##..##..###..#.#...# +#.#....#.....#...##.#...####..#..##..##.####..##..##...####...#....##.#.#######..##.#......######.#. +#.#...###.######.######..##..##....#.#......#......#.#.##.#.##.#.#.#...#...#....#.#.#.#..#.##..#...# +####.###.#.#.##..#.##.#...#.##...#.##.##...#.....#.#..#.####.##..######.#..#.#..##....#.#.#..#.#.#.# +..##......#.#...#.##.##..##..##..#..##..#########.#..###..###.##...#..##.#..#.#.#.######..#....#.#.. +..##.##.#...###.#...##..######.##.#..####..#..#.#.##.####.##.##.#...##....#...###.##.####..#....#.#. +####...###..#.#.##.#.#....###..##.#.#..########..#...#.#...#.##....##.##...#.....#.#.....#.....#.... +.#.###############....#.##..###..#.####.#.##.##..#..#.#...###...##..##.##.#.....##...###.###.....#.. +.###..#..##.##..####.#.###.##.##..#..##....#.#......#......##.#...#.#...#..##.#.#...#...#.##..#.##.. +###.#.#.########.#.#..####.#..##.#.##.##.###.##..######...#..##.##.#..#.#...#.##..#####.....#.#.#..# +.##.##..#.#...#####.#.#.###...##...####...#......#...#..####..#.##..........#..#.#..###....######.## +..#####...#.#.#.#..#.##..#...#.#..#.##...##..##.##.#.##.#..#.#...#.......##.#...###.....#...#.#.#.## +##.##.#..######.##...#.....#.###.#..##.#.#.#..####.#....##.#....####...##....#.#.##.#..###.##.##..## +.###.##.#..#.###.####..#.##..####.#.#.##..###.#######.###.###...####........##....###.#...#.#.####.# +........#..#.#..##..########..........#.##.#..##.#...#.....####....##..#..#.#####.###...#...#.##.### +.....#..##.####...##.#####..######.##.#.###.####.##.##.#..##.##.######.##......#..#.####..##....#.## +##...####....#.##.##.###....#.#...#.####..##.#.##.#.#...####.#.#.#.#...##.###...##...###...######.## +.#....#.#.####...#.##.....##...###.#.#.##...##.#####....#.######.#.#....##..##...##....##.#.##.#.#.# +.###..###.#.......#.#######..#.#.#.######....#.#####.#.....#.#########...#....##...##.####.#..#..... +##.#..##..##.....#..##...#..##.##.#..#.#####.##.##.#.##.##...##.######.####..#.##..#####.##...##..#. +#.###...##.#.#.#.##....#.#.##.##..#....#...#.#.........#..#..####..####.####..#.##.##.#....####..##. +.#..######..#####.####.##.#.....#.#.#####..##..###.#.#.#..#.#...#.#######..##....##.##...#######..#. +#...#....#.#.##..#####..#########..#.....#...##.#.#.###...#####..##...##...####.......#######.#..### +.#......#...##.###..#....#...#.#.....#.#...##.#.#..#..###.##.###.#.##..##...#.##......#.###..#.#..## +.#....####...###..#.....##..#...#.#.###.#.#.##...#.##.##.#.#.#..####..###.#.#.#.##.#.#...#..#...#### +......##.##.#...#####.##..#.###..#.#####..##.#..##.###......#...#...#..#......###.######...#.#.##..# +###..#...#.##..###.#....##...#..#####.#.#..#.###...#####.#....##..####.#.##...#.#...##..#.#.#.#..#.# +...##.#.##.##..#.#.#.###.#.#...#.....###.###.##...#.###.##...##..#..###.#..##.##..###.#....###..##.. +.##.#..###..###.##.##...#..#####...#.....#####.##..####...#.##.#.#..##.#.#.#....###.....#....##..... +######.#..#.#..#....#.###...####.####.#.........#..##.#..##..##.....#..#.##.##...#...#####.#.##..#.# +.##.###...####....#.####...#####..#..#...#..#.....###.#..#.###..#.###.#.......##.####..#.##.#...##.. +........#.#.##.#.....#####.###......##..#.##.#..#...####.#...#..###.#.#...##..#.#...#.####...#.#.### +.#..#.##..##...######.###.##.#.#...#.#.#.#.##..##..##.#.##..#....#.##...#.##.##...##....##.###.##.#. +##...#...#...###.#.#...#...#..###......##.#.#....##..##.#..##.#.######...#..##.#.##.#.#....#.##.##.. +...#..###.#....#...#.##..##.#.##.#..###.##..#.##..####.#########....#.....##.#.##.##..##.##.######.# +#.##.#..##.......###...#.###....###.#..####..##.#####.##.###....##....#.###...####..#.#.#.##.....### +.......#...#...##.#...##.#.#..#.##..##.#....###...##.#####...#.........#.......###.##.#.#.###....##. +###.#.##.##.....#.#..#.#..####.####..#..###..........####.#.##...#######.###..#####..#.....#..###..# +#...##.##..####.##.###.#.#######..###.#..#######..#.##.####...#..#.##.####..####.#.#.......####.#... +...#.##..#..#..##........#.#..#..#.#....#.###.#.###..#.......###..#.....#....#..##.#...#.###...##.#. +###.##..#.##.#.#####..#.##.####....#####..###.#.#..#...#...###.#.##..#.#.#.....#.####.#.#.#.#.#.#... +..##..##..#..##.##.#...#..#....####....#...#..####..#.....######.###.####.#....##....##.#.#.###....# +.#.#.#.##..####..#.....#.####.#....#.....#....#.##..#.#..#.#...#.#.#.#..#..#..##.#....####.......#.. +..##.##..###......#...#..##...#.###.####.#...#.####..#.#.#.....#.#...####...#.########.##.#.#.#..### +#....#.##.....##.###.##.###..#.####.....####.##...#..##.###...###..###.#....####.#..#..#..#.#..##.#. +.#.#.##....#.##......#.#..###.#....###....#......#.#.##.##.#########..##..#...#.####..#...####..#..# +.#.#.......##.#.##.#...#...#.##.#..#.#.#.##....#..###.###.##.#.#...##.#..#..##....#..###.#...#.#.##. +#.##.#....####...#..##..#.#.#.#.##.#...#####.#...#..#..#.####.####.#.#....#......##..##..###...#..## +..##.###..##.####..#..#..##...###.#.#.#######.####...####......##.##..#...#.##...##....#..#..#.....# +....#..#..#.#.####.#...##..#....####.#..####...#.#...###...#..#..##...#....##...#.....#.#..#.#.#...# +...#.#.#.##..##.###..#.######....####.###...##...###.#...##.####..#.#..#.#..#.##.....#.#.#..##...... +.#.##.##.....##.#..###.###.##....#...###.#......#...##.###.#.##.##...###...###...#.######..#......#. +###..#...#......#..##...#....##.#..###.##.####..##..##....####.#...#.#....##..#.#######..#.#.#####.. +##...#####..####..##....#.#.###.##.#..#.#..#.....###...###.#####.....#..##.#......#...#.###.##.##... +...#.#.#..#.###..#.#.#....##.#.#..####.##.#.####.#.#.#...#....##....#.##.####..###.#.#...##.#..#..## +#.#.#..#.##..##.##.#...##.#....#...###..##..#.#######.#.###..##......##.#..###.########.#.##..#.#.## +######.###....##..#..#...####....#.#.#..#...#..######.#.#.##..##....##....##.##.##...#..#.####.#.#.. +#####.###..#..###......##...##.####.#.#.#.###.......##..##.####..##.####.#..#..####..#.####.#####... +##.#.#.###..##.#.##.#.#.#.##.#...##........###.#.##..####....###.#.####.####.#.......##.##.##...##.. +#.#..###...#..##.....##.#..#.#..##..######.#####...###.#.......###...#..##..#..#..##.#.#....#..#..#. +#.#..####.###..#...#...#...#.###..#.#.#.#.#.#.#..#....#.##.##.##..###..####.#..##..##.###.###....##. +#..#.##.#####........#..#.##.#..##.#...#....#..#.##..###..##..##.##..#..##.#.#...#.#.##.#.##....#.#. +.......##..#.....#..#.#.....#.##...####.###..####..#.#.#.#..#.....#....##...#..#.##..###.#.#....#... +#...###########.##.....##...###.#.##.##..####.##...#.####.#####.#####.####...###.##...##..#.#.###..# +....#.#.###.####.###...#...#.#..###.#.#.##...#..#.#.#..#.####..#..###.######.#.####.###...###.#.##.# +.....#..#..########...#.#.#.#.#.#.#.#..###.##..####...##.#.#.#...##..#####.##.#...#.####.#######.##. +.......#...#.#..#..#...#..#..##.....#.##....##.##...##..##.##...##...#.#..#.##.#.###.#.####.#.#..##. +.####...#...#.#.#....##..........##.##.###.##.#.#..#.#.#......########.#...#.####.##.###..##...####. +#.#.#...##.###..##..#..#.....####.#.....##.##.#..#.#.###.#..#######...##..#.#..#.#..############.### +.##..####.#..#.....###..#..#.#.....#.#.#...##.##.#....#..#..###.#...#....#.#...####..#.....###.####. +..#...#.###.###....##.#..#.##..####.##.#.##.##.##...###.####..#.#.#.##.#.#.#..###..##.##.##.##.#..## +#...............##.....######.#.#####.##.#....#.#..#.##...#.##....#........##.##...#.##.##.#..#.##.# +#..##..#.#.#.##.#..#.#.##.##...#...#..#.#.##..#.#...###...##...###..#####.#.#..#..#.#..#.#.##...##.# +.#######.#.....##...#.#.####.######.#..#......#....##.#.#..#..###.#...###...#....#.#..#.##.#...#.#.. +#.###......##.#.##..#.###.###..####..##....#..###......##..##..#####.####....#...###.....###.#..#... +###...#....###.#..#.###.##...###.##.......##.##.#.#.#....####....###..##.###...#..##....#.#.##..##.. +.##.......##.######.#.#..#..##....#####.###.#.##.....####....#......####....#.##.#.##..#.##...##.#.# +.#.###...#.#.#.##.###..###...##..#.##.##..##..#.....###.#..#.##.##.####........##.#####.#.#....#...# +##...##..#.##.#######.###.#.##.#####....##.....##.#.....#.#.##.#....#.##.#....##.#..#.###..#..#.#... +.#..#.#.#.#...#.##...###.##.#.#...###.##...#.#..###....###.#.###...##..###..#..##.##....###...###.## From 03e99e9d07b0182589c005d1203b36445ec10970 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 23:06:32 +0100 Subject: [PATCH 070/100] 2015: d18: ex1: add solution --- 2015/d18/ex1/ex1.py | 57 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100755 2015/d18/ex1/ex1.py diff --git a/2015/d18/ex1/ex1.py b/2015/d18/ex1/ex1.py new file mode 100755 index 0000000..4c9aec2 --- /dev/null +++ b/2015/d18/ex1/ex1.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python + +import itertools +import sys +from collections.abc import Iterator +from typing import NamedTuple + + +class Point(NamedTuple): + x: int + y: int + + +def solve(input: str) -> int: + def parse(input: str) -> set[Point]: + return { + Point(x, y) + for x, line in enumerate(input.splitlines()) + for y, c in enumerate(line) + if c == "#" + } + + def neighbours(p: Point) -> Iterator[Point]: + for dx, dy in itertools.product((-1, 0, 1), repeat=2): + if dx == 0 and dy == 0: + continue + yield Point(p.x + dx, p.y + dy) + + def step(lights: set[Point], dimensions: Point) -> set[Point]: + res: set[Point] = set() + for p in map( + Point._make, + itertools.product(range(dimensions.x), range(dimensions.y)), + ): + num_alive = sum(n in lights for n in neighbours(p)) + if p in lights and num_alive not in (2, 3): + continue + if p not in lights and num_alive != 3: + continue + res.add(p) + + return res + + lights = parse(input) + dimensions = Point(100, 100) + for _ in range(100): + lights = step(lights, dimensions) + return len(lights) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From ebf5f6307a407474981132dd1fa6cfa08d86c9b7 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 23:06:38 +0100 Subject: [PATCH 071/100] 2015: d18: ex2: add input --- 2015/d18/ex2/input | 100 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 2015/d18/ex2/input diff --git a/2015/d18/ex2/input b/2015/d18/ex2/input new file mode 100644 index 0000000..e91a2a7 --- /dev/null +++ b/2015/d18/ex2/input @@ -0,0 +1,100 @@ +###.##..##.#..#.##...#..#.####..#.##.##.##..###...#....#...###..#..###..###.#.#.#..#.##..#...##.#..# +.#...##.#####..##.......#..####.###.##.#..###.###.....#.#.####.##.###..##...###....#.##.....#.#.#.## +.....#.#.....#..###..####..#.....##.#..###.####.#.######..##......#####.#.##.#########.###..#.##.#.# +...###......#.#..###..#.#.....#.##..#.##..###...#.##.#..#..#.##.#..##......##.##.##.######...#....## +.###.....#...#.#...####.#.###..#..####.#..#.##..####...##.#...#..###...###...####..##....####.##..#. +..#....#...#.......#..###.###....#.##..#.....###.#.##.#....#.#....##.##..#.##.#..###.###.##.##..##.# +##..#####.#.#....#.#...#.#.####..#....#..#....#.#..#.#####...#..##.#.....#.##..##.####......#.#.##.. +.#..##..#.#.###..##..##...#....##...#..#.#..##.##..###.####.....#.####.#.....##.#.##...#..####..#... +#.#####.......#####...#...####.#.#.#....#.###.#.##.#####..#.###.#..##.##.#.##....#.##..#....####.#.# +#.##...#####....##.#.#.....##......##.##...#.##.##...##...###.###.##.#.####.####.##..#.##.#.#.####.. +#.##.##....###.###.#..#..##.##.#..#.#..##..#.#...#.##........###..#...##.#.#.##.......##.....#...### +###..#.#..##.##.#.#.#...#..#...##.##.#.########.......#.#...#....########..#.#.###..#.#..#.##..##### +####.#.#...#.##.##..#.#...#....#..###..#.#.#.####.#.##.##.#..##..##..#..#####.####.##..########..##. +.#.#...#..##.#..#..###.#..####.......##.#.#.#.##.#####..#..##...#.##...#..#....#..#..###..####.#.... +..#.#...#....##...#####..#..#...###.###.....#.###.#....#.#..##...#.##.##.####.#.#.#..#.##.#....#.#.. +#....###.####.##..#.#.###..###.##.##..#.#...###..#.##.#####.##.#######..#.#...##.#..........####.### +#.#####.#......#.#......#.....##...##.#.#########.#......##..##..##.#..##.##..#....##...###...#.#... +#..#..##..###.#.#.#.#.....###.#.####.##.##....#.#..##....#.#..#.####..###.##...#######.#####.##.#.#. +..###.#........##.#...###..#.##..#.#....##.#......#..#.##..#.#..#.#..#.####.#####..###.##..#.##.#... +##.###....#..##...#..#.#......##..#...#..#.####..#.##...##.####.#...#..###...#.#.#....###.##..#.#... +..##.##.#.##..##.#..#.###...##..##..#....##..##...####.#..####.###...#.....#..#.##..##..###..#.#...# +#.#....#.....#...##.#...####..#..##..##.####..##..##...####...#....##.#.#######..##.#......######.#. +#.#...###.######.######..##..##....#.#......#......#.#.##.#.##.#.#.#...#...#....#.#.#.#..#.##..#...# +####.###.#.#.##..#.##.#...#.##...#.##.##...#.....#.#..#.####.##..######.#..#.#..##....#.#.#..#.#.#.# +..##......#.#...#.##.##..##..##..#..##..#########.#..###..###.##...#..##.#..#.#.#.######..#....#.#.. +..##.##.#...###.#...##..######.##.#..####..#..#.#.##.####.##.##.#...##....#...###.##.####..#....#.#. +####...###..#.#.##.#.#....###..##.#.#..########..#...#.#...#.##....##.##...#.....#.#.....#.....#.... +.#.###############....#.##..###..#.####.#.##.##..#..#.#...###...##..##.##.#.....##...###.###.....#.. +.###..#..##.##..####.#.###.##.##..#..##....#.#......#......##.#...#.#...#..##.#.#...#...#.##..#.##.. +###.#.#.########.#.#..####.#..##.#.##.##.###.##..######...#..##.##.#..#.#...#.##..#####.....#.#.#..# +.##.##..#.#...#####.#.#.###...##...####...#......#...#..####..#.##..........#..#.#..###....######.## +..#####...#.#.#.#..#.##..#...#.#..#.##...##..##.##.#.##.#..#.#...#.......##.#...###.....#...#.#.#.## +##.##.#..######.##...#.....#.###.#..##.#.#.#..####.#....##.#....####...##....#.#.##.#..###.##.##..## +.###.##.#..#.###.####..#.##..####.#.#.##..###.#######.###.###...####........##....###.#...#.#.####.# +........#..#.#..##..########..........#.##.#..##.#...#.....####....##..#..#.#####.###...#...#.##.### +.....#..##.####...##.#####..######.##.#.###.####.##.##.#..##.##.######.##......#..#.####..##....#.## +##...####....#.##.##.###....#.#...#.####..##.#.##.#.#...####.#.#.#.#...##.###...##...###...######.## +.#....#.#.####...#.##.....##...###.#.#.##...##.#####....#.######.#.#....##..##...##....##.#.##.#.#.# +.###..###.#.......#.#######..#.#.#.######....#.#####.#.....#.#########...#....##...##.####.#..#..... +##.#..##..##.....#..##...#..##.##.#..#.#####.##.##.#.##.##...##.######.####..#.##..#####.##...##..#. +#.###...##.#.#.#.##....#.#.##.##..#....#...#.#.........#..#..####..####.####..#.##.##.#....####..##. +.#..######..#####.####.##.#.....#.#.#####..##..###.#.#.#..#.#...#.#######..##....##.##...#######..#. +#...#....#.#.##..#####..#########..#.....#...##.#.#.###...#####..##...##...####.......#######.#..### +.#......#...##.###..#....#...#.#.....#.#...##.#.#..#..###.##.###.#.##..##...#.##......#.###..#.#..## +.#....####...###..#.....##..#...#.#.###.#.#.##...#.##.##.#.#.#..####..###.#.#.#.##.#.#...#..#...#### +......##.##.#...#####.##..#.###..#.#####..##.#..##.###......#...#...#..#......###.######...#.#.##..# +###..#...#.##..###.#....##...#..#####.#.#..#.###...#####.#....##..####.#.##...#.#...##..#.#.#.#..#.# +...##.#.##.##..#.#.#.###.#.#...#.....###.###.##...#.###.##...##..#..###.#..##.##..###.#....###..##.. +.##.#..###..###.##.##...#..#####...#.....#####.##..####...#.##.#.#..##.#.#.#....###.....#....##..... +######.#..#.#..#....#.###...####.####.#.........#..##.#..##..##.....#..#.##.##...#...#####.#.##..#.# +.##.###...####....#.####...#####..#..#...#..#.....###.#..#.###..#.###.#.......##.####..#.##.#...##.. +........#.#.##.#.....#####.###......##..#.##.#..#...####.#...#..###.#.#...##..#.#...#.####...#.#.### +.#..#.##..##...######.###.##.#.#...#.#.#.#.##..##..##.#.##..#....#.##...#.##.##...##....##.###.##.#. +##...#...#...###.#.#...#...#..###......##.#.#....##..##.#..##.#.######...#..##.#.##.#.#....#.##.##.. +...#..###.#....#...#.##..##.#.##.#..###.##..#.##..####.#########....#.....##.#.##.##..##.##.######.# +#.##.#..##.......###...#.###....###.#..####..##.#####.##.###....##....#.###...####..#.#.#.##.....### +.......#...#...##.#...##.#.#..#.##..##.#....###...##.#####...#.........#.......###.##.#.#.###....##. +###.#.##.##.....#.#..#.#..####.####..#..###..........####.#.##...#######.###..#####..#.....#..###..# +#...##.##..####.##.###.#.#######..###.#..#######..#.##.####...#..#.##.####..####.#.#.......####.#... +...#.##..#..#..##........#.#..#..#.#....#.###.#.###..#.......###..#.....#....#..##.#...#.###...##.#. +###.##..#.##.#.#####..#.##.####....#####..###.#.#..#...#...###.#.##..#.#.#.....#.####.#.#.#.#.#.#... +..##..##..#..##.##.#...#..#....####....#...#..####..#.....######.###.####.#....##....##.#.#.###....# +.#.#.#.##..####..#.....#.####.#....#.....#....#.##..#.#..#.#...#.#.#.#..#..#..##.#....####.......#.. +..##.##..###......#...#..##...#.###.####.#...#.####..#.#.#.....#.#...####...#.########.##.#.#.#..### +#....#.##.....##.###.##.###..#.####.....####.##...#..##.###...###..###.#....####.#..#..#..#.#..##.#. +.#.#.##....#.##......#.#..###.#....###....#......#.#.##.##.#########..##..#...#.####..#...####..#..# +.#.#.......##.#.##.#...#...#.##.#..#.#.#.##....#..###.###.##.#.#...##.#..#..##....#..###.#...#.#.##. +#.##.#....####...#..##..#.#.#.#.##.#...#####.#...#..#..#.####.####.#.#....#......##..##..###...#..## +..##.###..##.####..#..#..##...###.#.#.#######.####...####......##.##..#...#.##...##....#..#..#.....# +....#..#..#.#.####.#...##..#....####.#..####...#.#...###...#..#..##...#....##...#.....#.#..#.#.#...# +...#.#.#.##..##.###..#.######....####.###...##...###.#...##.####..#.#..#.#..#.##.....#.#.#..##...... +.#.##.##.....##.#..###.###.##....#...###.#......#...##.###.#.##.##...###...###...#.######..#......#. +###..#...#......#..##...#....##.#..###.##.####..##..##....####.#...#.#....##..#.#######..#.#.#####.. +##...#####..####..##....#.#.###.##.#..#.#..#.....###...###.#####.....#..##.#......#...#.###.##.##... +...#.#.#..#.###..#.#.#....##.#.#..####.##.#.####.#.#.#...#....##....#.##.####..###.#.#...##.#..#..## +#.#.#..#.##..##.##.#...##.#....#...###..##..#.#######.#.###..##......##.#..###.########.#.##..#.#.## +######.###....##..#..#...####....#.#.#..#...#..######.#.#.##..##....##....##.##.##...#..#.####.#.#.. +#####.###..#..###......##...##.####.#.#.#.###.......##..##.####..##.####.#..#..####..#.####.#####... +##.#.#.###..##.#.##.#.#.#.##.#...##........###.#.##..####....###.#.####.####.#.......##.##.##...##.. +#.#..###...#..##.....##.#..#.#..##..######.#####...###.#.......###...#..##..#..#..##.#.#....#..#..#. +#.#..####.###..#...#...#...#.###..#.#.#.#.#.#.#..#....#.##.##.##..###..####.#..##..##.###.###....##. +#..#.##.#####........#..#.##.#..##.#...#....#..#.##..###..##..##.##..#..##.#.#...#.#.##.#.##....#.#. +.......##..#.....#..#.#.....#.##...####.###..####..#.#.#.#..#.....#....##...#..#.##..###.#.#....#... +#...###########.##.....##...###.#.##.##..####.##...#.####.#####.#####.####...###.##...##..#.#.###..# +....#.#.###.####.###...#...#.#..###.#.#.##...#..#.#.#..#.####..#..###.######.#.####.###...###.#.##.# +.....#..#..########...#.#.#.#.#.#.#.#..###.##..####...##.#.#.#...##..#####.##.#...#.####.#######.##. +.......#...#.#..#..#...#..#..##.....#.##....##.##...##..##.##...##...#.#..#.##.#.###.#.####.#.#..##. +.####...#...#.#.#....##..........##.##.###.##.#.#..#.#.#......########.#...#.####.##.###..##...####. +#.#.#...##.###..##..#..#.....####.#.....##.##.#..#.#.###.#..#######...##..#.#..#.#..############.### +.##..####.#..#.....###..#..#.#.....#.#.#...##.##.#....#..#..###.#...#....#.#...####..#.....###.####. +..#...#.###.###....##.#..#.##..####.##.#.##.##.##...###.####..#.#.#.##.#.#.#..###..##.##.##.##.#..## +#...............##.....######.#.#####.##.#....#.#..#.##...#.##....#........##.##...#.##.##.#..#.##.# +#..##..#.#.#.##.#..#.#.##.##...#...#..#.#.##..#.#...###...##...###..#####.#.#..#..#.#..#.#.##...##.# +.#######.#.....##...#.#.####.######.#..#......#....##.#.#..#..###.#...###...#....#.#..#.##.#...#.#.. +#.###......##.#.##..#.###.###..####..##....#..###......##..##..#####.####....#...###.....###.#..#... +###...#....###.#..#.###.##...###.##.......##.##.#.#.#....####....###..##.###...#..##....#.#.##..##.. +.##.......##.######.#.#..#..##....#####.###.#.##.....####....#......####....#.##.#.##..#.##...##.#.# +.#.###...#.#.#.##.###..###...##..#.##.##..##..#.....###.#..#.##.##.####........##.#####.#.#....#...# +##...##..#.##.#######.###.#.##.#####....##.....##.#.....#.#.##.#....#.##.#....##.#..#.###..#..#.#... +.#..#.#.#.#...#.##...###.##.#.#...###.##...#.#..###....###.#.###...##..###..#..##.##....###...###.## From 68d99c78904c8bf111f219f1444ce96c56ff5226 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 21 May 2025 23:06:42 +0100 Subject: [PATCH 072/100] 2015: d18: ex2: add solution --- 2015/d18/ex2/ex2.py | 70 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100755 2015/d18/ex2/ex2.py diff --git a/2015/d18/ex2/ex2.py b/2015/d18/ex2/ex2.py new file mode 100755 index 0000000..f39b6da --- /dev/null +++ b/2015/d18/ex2/ex2.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python + +import itertools +import sys +from collections.abc import Iterator +from typing import NamedTuple + + +class Point(NamedTuple): + x: int + y: int + + +def solve(input: str) -> int: + def parse(input: str) -> set[Point]: + return { + Point(x, y) + for x, line in enumerate(input.splitlines()) + for y, c in enumerate(line) + if c == "#" + } + + def neighbours(p: Point) -> Iterator[Point]: + for dx, dy in itertools.product((-1, 0, 1), repeat=2): + if dx == 0 and dy == 0: + continue + yield Point(p.x + dx, p.y + dy) + + def step(lights: set[Point], dimensions: Point) -> set[Point]: + res = { + # Four corners are stuck on + Point(0, 0), + Point(0, dimensions.y - 1), + Point(dimensions.x - 1, 0), + Point(dimensions.x - 1, dimensions.y - 1), + } + for p in map( + Point._make, + itertools.product(range(dimensions.x), range(dimensions.y)), + ): + num_alive = sum(n in lights for n in neighbours(p)) + if p in lights and num_alive not in (2, 3): + continue + if p not in lights and num_alive != 3: + continue + res.add(p) + + return res + + lights = parse(input) + dimensions = Point(100, 100) + lights |= { + # Four corners are stuck on + Point(0, 0), + Point(0, dimensions.y - 1), + Point(dimensions.x - 1, 0), + Point(dimensions.x - 1, dimensions.y - 1), + } + for _ in range(100): + lights = step(lights, dimensions) + return len(lights) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From e275f1f03cc313450a5f1111e5a9fb5df441599a Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 22 May 2025 00:23:47 +0100 Subject: [PATCH 073/100] 2015: d19: ex1: add input --- 2015/d19/ex1/input | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 2015/d19/ex1/input diff --git a/2015/d19/ex1/input b/2015/d19/ex1/input new file mode 100644 index 0000000..806774f --- /dev/null +++ b/2015/d19/ex1/input @@ -0,0 +1,45 @@ +Al => ThF +Al => ThRnFAr +B => BCa +B => TiB +B => TiRnFAr +Ca => CaCa +Ca => PB +Ca => PRnFAr +Ca => SiRnFYFAr +Ca => SiRnMgAr +Ca => SiTh +F => CaF +F => PMg +F => SiAl +H => CRnAlAr +H => CRnFYFYFAr +H => CRnFYMgAr +H => CRnMgYFAr +H => HCa +H => NRnFYFAr +H => NRnMgAr +H => NTh +H => OB +H => ORnFAr +Mg => BF +Mg => TiMg +N => CRnFAr +N => HSi +O => CRnFYFAr +O => CRnMgAr +O => HP +O => NRnFAr +O => OTi +P => CaP +P => PTi +P => SiRnFAr +Si => CaSi +Th => ThCa +Ti => BP +Ti => TiTi +e => HF +e => NAl +e => OMg + +CRnCaSiRnBSiRnFArTiBPTiTiBFArPBCaSiThSiRnTiBPBPMgArCaSiRnTiMgArCaSiThCaSiRnFArRnSiRnFArTiTiBFArCaCaSiRnSiThCaCaSiRnMgArFYSiRnFYCaFArSiThCaSiThPBPTiMgArCaPRnSiAlArPBCaCaSiRnFYSiThCaRnFArArCaCaSiRnPBSiRnFArMgYCaCaCaCaSiThCaCaSiAlArCaCaSiRnPBSiAlArBCaCaCaCaSiThCaPBSiThPBPBCaSiRnFYFArSiThCaSiRnFArBCaCaSiRnFYFArSiThCaPBSiThCaSiRnPMgArRnFArPTiBCaPRnFArCaCaCaCaSiRnCaCaSiRnFYFArFArBCaSiThFArThSiThSiRnTiRnPMgArFArCaSiThCaPBCaSiRnBFArCaCaPRnCaCaPMgArSiRnFYFArCaSiThRnPBPMgAr From 9d15c56597c8f14e380c07799eaa2b8bb7d1949c Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 22 May 2025 00:23:54 +0100 Subject: [PATCH 074/100] 2015: d19: ex1: add solution --- 2015/d19/ex1/ex1.py | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100755 2015/d19/ex1/ex1.py diff --git a/2015/d19/ex1/ex1.py b/2015/d19/ex1/ex1.py new file mode 100755 index 0000000..4f038b2 --- /dev/null +++ b/2015/d19/ex1/ex1.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python + +import collections +import sys +from collections.abc import Iterator + + +def solve(input: str) -> int: + def parse(input: str) -> tuple[dict[str, list[str]], str]: + raw_replacements, molecule = input.strip().split("\n\n") + res: dict[str, list[str]] = collections.defaultdict(list) + for start, end in ( + line.split(" => ") for line in raw_replacements.splitlines() + ): + res[start].append(end) + return res, molecule + + def replace_needle(input: str, needle: str, to: str) -> Iterator[str]: + assert needle in input # Sanity check + i = input.find(needle) + while i != -1: + yield input[:i] + to + input[i + len(needle) :] + i = input.find(needle, i + 1) + + def do_replacements( + replacements: dict[str, list[str]], molecule: str + ) -> Iterator[str]: + for needle, vals in replacements.items(): + if needle not in molecule: + continue + for to in vals: + yield from replace_needle(molecule, needle, to) + + replacements, molecule = parse(input) + new_molecules = set(do_replacements(replacements, molecule)) + return len(new_molecules) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From e4ffdd2bfb607e2b189327275071c1b39c4b0a46 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 22 May 2025 00:23:59 +0100 Subject: [PATCH 075/100] 2015: d19: ex2: add input --- 2015/d19/ex2/input | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 2015/d19/ex2/input diff --git a/2015/d19/ex2/input b/2015/d19/ex2/input new file mode 100644 index 0000000..806774f --- /dev/null +++ b/2015/d19/ex2/input @@ -0,0 +1,45 @@ +Al => ThF +Al => ThRnFAr +B => BCa +B => TiB +B => TiRnFAr +Ca => CaCa +Ca => PB +Ca => PRnFAr +Ca => SiRnFYFAr +Ca => SiRnMgAr +Ca => SiTh +F => CaF +F => PMg +F => SiAl +H => CRnAlAr +H => CRnFYFYFAr +H => CRnFYMgAr +H => CRnMgYFAr +H => HCa +H => NRnFYFAr +H => NRnMgAr +H => NTh +H => OB +H => ORnFAr +Mg => BF +Mg => TiMg +N => CRnFAr +N => HSi +O => CRnFYFAr +O => CRnMgAr +O => HP +O => NRnFAr +O => OTi +P => CaP +P => PTi +P => SiRnFAr +Si => CaSi +Th => ThCa +Ti => BP +Ti => TiTi +e => HF +e => NAl +e => OMg + +CRnCaSiRnBSiRnFArTiBPTiTiBFArPBCaSiThSiRnTiBPBPMgArCaSiRnTiMgArCaSiThCaSiRnFArRnSiRnFArTiTiBFArCaCaSiRnSiThCaCaSiRnMgArFYSiRnFYCaFArSiThCaSiThPBPTiMgArCaPRnSiAlArPBCaCaSiRnFYSiThCaRnFArArCaCaSiRnPBSiRnFArMgYCaCaCaCaSiThCaCaSiAlArCaCaSiRnPBSiAlArBCaCaCaCaSiThCaPBSiThPBPBCaSiRnFYFArSiThCaSiRnFArBCaCaSiRnFYFArSiThCaPBSiThCaSiRnPMgArRnFArPTiBCaPRnFArCaCaCaCaSiRnCaCaSiRnFYFArFArBCaSiThFArThSiThSiRnTiRnPMgArFArCaSiThCaPBCaSiRnBFArCaCaPRnCaCaPMgArSiRnFYFArCaSiThRnPBPMgAr From 54a04e458a67ee0a3796748c76dd83511d53d946 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 22 May 2025 00:24:09 +0100 Subject: [PATCH 076/100] 2015: d19: ex2: add solution --- 2015/d19/ex2/ex2.py | 49 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100755 2015/d19/ex2/ex2.py diff --git a/2015/d19/ex2/ex2.py b/2015/d19/ex2/ex2.py new file mode 100755 index 0000000..4195e9b --- /dev/null +++ b/2015/d19/ex2/ex2.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python + +import collections +import sys + + +def solve(input: str) -> int: + def parse(input: str) -> tuple[dict[str, list[str]], str]: + raw_replacements, molecule = input.strip().split("\n\n") + res: dict[str, list[str]] = collections.defaultdict(list) + for start, end in ( + line.split(" => ") for line in raw_replacements.splitlines() + ): + res[start].append(end) + return res, molecule + + def inverse(input: dict[str, list[str]]) -> dict[str, str]: + res: dict[str, str] = {} + for key, vals in input.items(): + for val in vals: + res[val] = key + assert len(res) == sum(map(len, input.values())) # Sanity check + return res + + def build(replacements: dict[str, list[str]], molecule: str) -> int: + # We will be "building down" to the electron, so inverse the replacement mapping + inversed_replacements = inverse(replacements) + # Order the replacement needles to try the longest ones first + needles = sorted(inversed_replacements.keys(), key=len, reverse=True) + res = 0 + while molecule != "e": + for needle in needles: + if needle not in molecule: + continue + res += 1 + molecule = molecule.replace(needle, inversed_replacements[needle], 1) + return res + + replacements, molecule = parse(input) + return build(replacements, molecule) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 8d739cd487fc77dabd1e64a66d23f69bb5ea2bc2 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 22 May 2025 00:43:43 +0100 Subject: [PATCH 077/100] 2015: d20: ex1: add input --- 2015/d20/ex1/input | 1 + 1 file changed, 1 insertion(+) create mode 100644 2015/d20/ex1/input diff --git a/2015/d20/ex1/input b/2015/d20/ex1/input new file mode 100644 index 0000000..f0d8336 --- /dev/null +++ b/2015/d20/ex1/input @@ -0,0 +1 @@ +36000000 From 4c511702fc5b2244c63560051e4994f9be309c7e Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 22 May 2025 00:43:54 +0100 Subject: [PATCH 078/100] 2015: d20: ex1: add solution --- 2015/d20/ex1/ex1.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 2015/d20/ex1/ex1.py diff --git a/2015/d20/ex1/ex1.py b/2015/d20/ex1/ex1.py new file mode 100755 index 0000000..5892642 --- /dev/null +++ b/2015/d20/ex1/ex1.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +import sys + + +def solve(input: str) -> int: + needed = int(input.strip()) + presents = [0] * (needed // 10) # Surely this should be enough houses + for i in range(1, len(presents)): + for j in range(i, len(presents), i): + presents[j] += 10 * i + for i, total in enumerate(presents): + if total >= needed: + return i + assert False # Sanity check + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 0259d9bbf797ebbfbc6bb23b7b070b9945ce70ef Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 22 May 2025 00:43:59 +0100 Subject: [PATCH 079/100] 2015: d20: ex2: add input --- 2015/d20/ex2/input | 1 + 1 file changed, 1 insertion(+) create mode 100644 2015/d20/ex2/input diff --git a/2015/d20/ex2/input b/2015/d20/ex2/input new file mode 100644 index 0000000..f0d8336 --- /dev/null +++ b/2015/d20/ex2/input @@ -0,0 +1 @@ +36000000 From 235f801f412f4fd60c0cb5504a3a57fd7d129c37 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 22 May 2025 00:44:09 +0100 Subject: [PATCH 080/100] 2015: d20: ex2: add solution --- 2015/d20/ex2/ex2.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 2015/d20/ex2/ex2.py diff --git a/2015/d20/ex2/ex2.py b/2015/d20/ex2/ex2.py new file mode 100755 index 0000000..1d7c373 --- /dev/null +++ b/2015/d20/ex2/ex2.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python + +import sys + + +def solve(input: str) -> int: + needed = int(input.strip()) + presents = [0] * (needed // 10) # Surely this should be enough houses + for i in range(1, len(presents)): + for j in range(1, 50 + 1): + if (i * j) >= len(presents): + continue + presents[i * j] += 11 * i + for i, total in enumerate(presents): + if total >= needed: + return i + assert False # Sanity check + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From ae67526c409b0068fb570f8a0112de410039d108 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 22 May 2025 01:10:46 +0100 Subject: [PATCH 081/100] 2015: d21: ex1: add input --- 2015/d21/ex1/input | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 2015/d21/ex1/input diff --git a/2015/d21/ex1/input b/2015/d21/ex1/input new file mode 100644 index 0000000..c5f2409 --- /dev/null +++ b/2015/d21/ex1/input @@ -0,0 +1,3 @@ +Hit Points: 109 +Damage: 8 +Armor: 2 From d9406a42581ec0d7febaaee764c5341f11fd2f99 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 22 May 2025 01:10:52 +0100 Subject: [PATCH 082/100] 2015: d21: ex1: add solution --- 2015/d21/ex1/ex1.py | 104 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100755 2015/d21/ex1/ex1.py diff --git a/2015/d21/ex1/ex1.py b/2015/d21/ex1/ex1.py new file mode 100755 index 0000000..3dfc88d --- /dev/null +++ b/2015/d21/ex1/ex1.py @@ -0,0 +1,104 @@ +#!/usr/bin/env python + +import itertools +import sys +from collections.abc import Iterator +from typing import NamedTuple + + +class Ennemy(NamedTuple): + hp: int + damage: int + armor: int + + def attack(self, other: "Ennemy") -> "Ennemy": + return Ennemy( + other.hp - max(1, self.damage - other.armor), + other.damage, + other.armor, + ) + + +class Item(NamedTuple): + cost: int + damage: int + armor: int + + +WEAPONS = { + "Dagger": Item(8, 4, 0), + "Shortsword": Item(10, 5, 0), + "Warhammer": Item(25, 6, 0), + "Longsword": Item(40, 7, 0), + "Greataxe": Item(74, 8, 0), +} +ARMORS = { + "Leather": Item(13, 0, 1), + "Chainmail": Item(31, 0, 2), + "Splintmail": Item(53, 0, 3), + "Bandedmail": Item(75, 0, 4), + "Platemail": Item(102, 0, 5), +} +RINGS = { + "Damage +1": Item(25, 1, 0), + "Damage +2": Item(50, 2, 0), + "Damage +3": Item(100, 3, 0), + "Defense +1": Item(20, 0, 1), + "Defense +2": Item(40, 0, 2), + "Defense +3": Item(80, 0, 3), +} + + +def solve(input: str) -> int: + def parse(input: str) -> Ennemy: + return Ennemy(*map(int, (line.split(": ")[1] for line in input.splitlines()))) + + def choose_items() -> Iterator[list[Item]]: + allowed_weapons = [1] + allowed_armors = [0, 1] + allowed_rings = [0, 1, 2] + + for weapons, armors, rings in itertools.product( + itertools.chain.from_iterable( + itertools.combinations(WEAPONS.values(), i) for i in allowed_weapons + ), + itertools.chain.from_iterable( + itertools.combinations(ARMORS.values(), i) for i in allowed_armors + ), + itertools.chain.from_iterable( + itertools.combinations(RINGS.values(), i) for i in allowed_rings + ), + ): + yield list(itertools.chain(weapons, armors, rings)) + + def assemble_inventory(items: list[Item]) -> Ennemy: + return Ennemy( + hp=100, + damage=sum(item.damage for item in items), + armor=sum(item.armor for item in items), + ) + + def battle(us: Ennemy, ennemy: Ennemy) -> bool: + while True: + ennemy = us.attack(ennemy) + if ennemy.hp <= 0: + return True + us = ennemy.attack(us) + if us.hp <= 0: + return False + + ennemy = parse(input) + return min( + sum(item.cost for item in items) + for items in choose_items() + if battle(assemble_inventory(items), ennemy) + ) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From e3db77cae2ba5098a70524f10b3dc17332a850b3 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 22 May 2025 01:10:57 +0100 Subject: [PATCH 083/100] 2015: d21: ex2: add input --- 2015/d21/ex2/input | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 2015/d21/ex2/input diff --git a/2015/d21/ex2/input b/2015/d21/ex2/input new file mode 100644 index 0000000..c5f2409 --- /dev/null +++ b/2015/d21/ex2/input @@ -0,0 +1,3 @@ +Hit Points: 109 +Damage: 8 +Armor: 2 From 6a11f30a2facac445a808555fe7635a4e16003ad Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 22 May 2025 01:11:01 +0100 Subject: [PATCH 084/100] 2015: d21: ex2: add solution --- 2015/d21/ex2/ex2.py | 104 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100755 2015/d21/ex2/ex2.py diff --git a/2015/d21/ex2/ex2.py b/2015/d21/ex2/ex2.py new file mode 100755 index 0000000..eca2485 --- /dev/null +++ b/2015/d21/ex2/ex2.py @@ -0,0 +1,104 @@ +#!/usr/bin/env python + +import itertools +import sys +from collections.abc import Iterator +from typing import NamedTuple + + +class Ennemy(NamedTuple): + hp: int + damage: int + armor: int + + def attack(self, other: "Ennemy") -> "Ennemy": + return Ennemy( + other.hp - max(1, self.damage - other.armor), + other.damage, + other.armor, + ) + + +class Item(NamedTuple): + cost: int + damage: int + armor: int + + +WEAPONS = { + "Dagger": Item(8, 4, 0), + "Shortsword": Item(10, 5, 0), + "Warhammer": Item(25, 6, 0), + "Longsword": Item(40, 7, 0), + "Greataxe": Item(74, 8, 0), +} +ARMORS = { + "Leather": Item(13, 0, 1), + "Chainmail": Item(31, 0, 2), + "Splintmail": Item(53, 0, 3), + "Bandedmail": Item(75, 0, 4), + "Platemail": Item(102, 0, 5), +} +RINGS = { + "Damage +1": Item(25, 1, 0), + "Damage +2": Item(50, 2, 0), + "Damage +3": Item(100, 3, 0), + "Defense +1": Item(20, 0, 1), + "Defense +2": Item(40, 0, 2), + "Defense +3": Item(80, 0, 3), +} + + +def solve(input: str) -> int: + def parse(input: str) -> Ennemy: + return Ennemy(*map(int, (line.split(": ")[1] for line in input.splitlines()))) + + def choose_items() -> Iterator[list[Item]]: + allowed_weapons = [1] + allowed_armors = [0, 1] + allowed_rings = [0, 1, 2] + + for weapons, armors, rings in itertools.product( + itertools.chain.from_iterable( + itertools.combinations(WEAPONS.values(), i) for i in allowed_weapons + ), + itertools.chain.from_iterable( + itertools.combinations(ARMORS.values(), i) for i in allowed_armors + ), + itertools.chain.from_iterable( + itertools.combinations(RINGS.values(), i) for i in allowed_rings + ), + ): + yield list(itertools.chain(weapons, armors, rings)) + + def assemble_inventory(items: list[Item]) -> Ennemy: + return Ennemy( + hp=100, + damage=sum(item.damage for item in items), + armor=sum(item.armor for item in items), + ) + + def battle(us: Ennemy, ennemy: Ennemy) -> bool: + while True: + ennemy = us.attack(ennemy) + if ennemy.hp <= 0: + return True + us = ennemy.attack(us) + if us.hp <= 0: + return False + + ennemy = parse(input) + return max( + sum(item.cost for item in items) + for items in choose_items() + if not battle(assemble_inventory(items), ennemy) + ) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From d045384d20d6f03362de9e3d2bd537bf3877b003 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 22 May 2025 02:44:02 +0100 Subject: [PATCH 085/100] 2015: d22: ex1: add input --- 2015/d22/ex1/input | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 2015/d22/ex1/input diff --git a/2015/d22/ex1/input b/2015/d22/ex1/input new file mode 100644 index 0000000..afff321 --- /dev/null +++ b/2015/d22/ex1/input @@ -0,0 +1,2 @@ +Hit Points: 51 +Damage: 9 From 43018d1302865d72144030887d41155654617649 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 22 May 2025 02:44:17 +0100 Subject: [PATCH 086/100] 2015: d22: ex1: add solution --- 2015/d22/ex1/ex1.py | 166 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 166 insertions(+) create mode 100755 2015/d22/ex1/ex1.py diff --git a/2015/d22/ex1/ex1.py b/2015/d22/ex1/ex1.py new file mode 100755 index 0000000..25cbd5b --- /dev/null +++ b/2015/d22/ex1/ex1.py @@ -0,0 +1,166 @@ +#!/usr/bin/env python + +import heapq +import sys +from collections.abc import Iterator +from typing import NamedTuple + + +class Ennemy(NamedTuple): + hp: int + damage: int + + +class Effects(NamedTuple): + # Effect is active is it is greater or equal to zero + shield: int = -1 + poison: int = -1 + recharge: int = -1 + + def tick(self) -> "Effects": + return Effects(*(n - 1 for n in self)) + + def shield_active(self) -> bool: + return self.shield >= 0 + + def poison_active(self) -> bool: + return self.poison >= 0 + + def recharge_active(self) -> bool: + return self.recharge >= 0 + + def with_shield(self) -> "Effects": + assert self.shield <= 0 # Sanity check + return self._replace(shield=6) + + def with_poison(self) -> "Effects": + assert self.poison <= 0 # Sanity check + return self._replace(poison=6) + + def with_recharge(self) -> "Effects": + assert self.recharge <= 0 # Sanity check + return self._replace(recharge=5) + + +class Player(NamedTuple): + hp: int + mana: int + effects: Effects + + +MISSILE = 53 +DRAIN = 73 +SHIELD = 113 +POISON = 173 +RECHARGE = 229 + + +def solve(input: str) -> int: + def parse(input: str) -> Ennemy: + return Ennemy(*map(int, (line.split(": ")[1] for line in input.splitlines()))) + + def step(player: Player, ennemy: Ennemy) -> Iterator[tuple[int, Player, Ennemy]]: + def tick_spells(player: Player, ennemy: Ennemy) -> tuple[Player, Ennemy]: + player = player._replace(effects=player.effects.tick()) + if player.effects.recharge_active(): + player = player._replace(mana=player.mana + 101) + if player.effects.poison_active(): + ennemy = ennemy._replace(hp=ennemy.hp - 3) + return player, ennemy + + # Note: does *not* drain the mana for the spell + def possible_spells( + player: Player, + ennemy: Ennemy, + ) -> Iterator[tuple[int, Player, Ennemy]]: + if player.mana >= MISSILE: + yield ( + MISSILE, + player, + ennemy._replace(hp=ennemy.hp - 4), + ) + if player.mana >= DRAIN: + yield ( + DRAIN, + player._replace(hp=player.hp + 2), + ennemy._replace(hp=ennemy.hp - 2), + ) + if player.mana >= SHIELD and player.effects.shield <= 0: + yield ( + SHIELD, + player._replace(effects=player.effects.with_shield()), + ennemy, + ) + if player.mana >= POISON and player.effects.poison <= 0: + yield ( + POISON, + player._replace(effects=player.effects.with_poison()), + ennemy, + ) + if player.mana >= RECHARGE and player.effects.recharge <= 0: + yield ( + RECHARGE, + player._replace(effects=player.effects.with_recharge()), + ennemy, + ) + + def boss_turn(player: Player, ennemy: Ennemy) -> tuple[Player, Ennemy]: + # Spells are ticked at start of turn + player, ennemy = tick_spells(player, ennemy) + + # Ennemy can't attack if they're dead + if ennemy.hp <= 0: + return player, ennemy + + armor = 7 if player.effects.shield_active() else 0 + damage = max(1, ennemy.damage - armor) + return player._replace(hp=player.hp - damage), ennemy + + # We lose if we run out of hp + if player.hp <= 0: + return + + # Spells are ticked at start of turn + player, ennemy = tick_spells(player, ennemy) + + # Don't spend a spell if the ennemy is already dead + if ennemy.hp <= 0: + yield 0, player, ennemy + + for cost, player, ennemy in possible_spells(player, ennemy): + yield cost, *boss_turn(player._replace(mana=player.mana - cost), ennemy) + + def dijkstra(player: Player, ennemy: Ennemy) -> int: + # Priority queue of (mana_spent, player, ennemy) + queue = [(0, player, ennemy)] + seen: set[tuple[Player, Ennemy]] = set() + + while len(queue) > 0: + total_cost, p, e = heapq.heappop(queue) + if p.hp <= 0: + continue + if e.hp <= 0: + return total_cost + # We must have seen (p, e) with a smaller distance before + if (p, e) in seen: + continue + # First time encountering (p, e), must be the smallest distance to it + seen.add((p, e)) + # Add all neighbours to be visited + for cost, p, e in step(p, e): + heapq.heappush(queue, (total_cost + cost, p, e)) + + assert False # Sanity check + + ennemy = parse(input) + player = Player(50, 500, Effects()) + return dijkstra(player, ennemy) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 6d4fb1e41867b1d850469540393fb04368ae9a69 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 22 May 2025 02:44:22 +0100 Subject: [PATCH 087/100] 2015: d22: ex2: add input --- 2015/d22/ex2/input | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 2015/d22/ex2/input diff --git a/2015/d22/ex2/input b/2015/d22/ex2/input new file mode 100644 index 0000000..afff321 --- /dev/null +++ b/2015/d22/ex2/input @@ -0,0 +1,2 @@ +Hit Points: 51 +Damage: 9 From 1ecb0bf7be2d5cc3770235cc091aba1f138f4f5e Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 22 May 2025 02:44:26 +0100 Subject: [PATCH 088/100] 2015: d22: ex2: add solution --- 2015/d22/ex2/ex2.py | 168 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100755 2015/d22/ex2/ex2.py diff --git a/2015/d22/ex2/ex2.py b/2015/d22/ex2/ex2.py new file mode 100755 index 0000000..af74f23 --- /dev/null +++ b/2015/d22/ex2/ex2.py @@ -0,0 +1,168 @@ +#!/usr/bin/env python + +import heapq +import sys +from collections.abc import Iterator +from typing import NamedTuple + + +class Ennemy(NamedTuple): + hp: int + damage: int + + +class Effects(NamedTuple): + # Effect is active is it is greater or equal to zero + shield: int = -1 + poison: int = -1 + recharge: int = -1 + + def tick(self) -> "Effects": + return Effects(*(n - 1 for n in self)) + + def shield_active(self) -> bool: + return self.shield >= 0 + + def poison_active(self) -> bool: + return self.poison >= 0 + + def recharge_active(self) -> bool: + return self.recharge >= 0 + + def with_shield(self) -> "Effects": + assert self.shield <= 0 # Sanity check + return self._replace(shield=6) + + def with_poison(self) -> "Effects": + assert self.poison <= 0 # Sanity check + return self._replace(poison=6) + + def with_recharge(self) -> "Effects": + assert self.recharge <= 0 # Sanity check + return self._replace(recharge=5) + + +class Player(NamedTuple): + hp: int + mana: int + effects: Effects + + +MISSILE = 53 +DRAIN = 73 +SHIELD = 113 +POISON = 173 +RECHARGE = 229 + + +def solve(input: str) -> int: + def parse(input: str) -> Ennemy: + return Ennemy(*map(int, (line.split(": ")[1] for line in input.splitlines()))) + + def step(player: Player, ennemy: Ennemy) -> Iterator[tuple[int, Player, Ennemy]]: + def tick_spells(player: Player, ennemy: Ennemy) -> tuple[Player, Ennemy]: + player = player._replace(effects=player.effects.tick()) + if player.effects.recharge_active(): + player = player._replace(mana=player.mana + 101) + if player.effects.poison_active(): + ennemy = ennemy._replace(hp=ennemy.hp - 3) + return player, ennemy + + # Note: does *not* drain the mana for the spell + def possible_spells( + player: Player, + ennemy: Ennemy, + ) -> Iterator[tuple[int, Player, Ennemy]]: + if player.mana >= MISSILE: + yield ( + MISSILE, + player, + ennemy._replace(hp=ennemy.hp - 4), + ) + if player.mana >= DRAIN: + yield ( + DRAIN, + player._replace(hp=player.hp + 2), + ennemy._replace(hp=ennemy.hp - 2), + ) + if player.mana >= SHIELD and player.effects.shield <= 0: + yield ( + SHIELD, + player._replace(effects=player.effects.with_shield()), + ennemy, + ) + if player.mana >= POISON and player.effects.poison <= 0: + yield ( + POISON, + player._replace(effects=player.effects.with_poison()), + ennemy, + ) + if player.mana >= RECHARGE and player.effects.recharge <= 0: + yield ( + RECHARGE, + player._replace(effects=player.effects.with_recharge()), + ennemy, + ) + + def boss_turn(player: Player, ennemy: Ennemy) -> tuple[Player, Ennemy]: + # Spells are ticked at start of turn + player, ennemy = tick_spells(player, ennemy) + + # Ennemy can't attack if they're dead + if ennemy.hp <= 0: + return player, ennemy + + armor = 7 if player.effects.shield_active() else 0 + damage = max(1, ennemy.damage - armor) + return player._replace(hp=player.hp - damage), ennemy + + # Apply hard mode HP loss + player = player._replace(hp=player.hp - 1) + # We lose if we run out of hp + if player.hp <= 0: + return + + # Spells are ticked at start of turn + player, ennemy = tick_spells(player, ennemy) + + # Don't spend a spell if the ennemy is already dead + if ennemy.hp <= 0: + yield 0, player, ennemy + + for cost, player, ennemy in possible_spells(player, ennemy): + yield cost, *boss_turn(player._replace(mana=player.mana - cost), ennemy) + + def dijkstra(player: Player, ennemy: Ennemy) -> int: + # Priority queue of (mana_spent, player, ennemy) + queue = [(0, player, ennemy)] + seen: set[tuple[Player, Ennemy]] = set() + + while len(queue) > 0: + total_cost, p, e = heapq.heappop(queue) + if p.hp <= 0: + continue + if e.hp <= 0: + return total_cost + # We must have seen (p, e) with a smaller distance before + if (p, e) in seen: + continue + # First time encountering (p, e), must be the smallest distance to it + seen.add((p, e)) + # Add all neighbours to be visited + for cost, p, e in step(p, e): + heapq.heappush(queue, (total_cost + cost, p, e)) + + assert False # Sanity check + + ennemy = parse(input) + player = Player(50, 500, Effects()) + return dijkstra(player, ennemy) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From a5fbfbbedf69347fd79ebfc565aa13e2ed262021 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 22 May 2025 03:07:43 +0100 Subject: [PATCH 089/100] 2015: d23: ex1: add input --- 2015/d23/ex1/input | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 2015/d23/ex1/input diff --git a/2015/d23/ex1/input b/2015/d23/ex1/input new file mode 100644 index 0000000..79d9624 --- /dev/null +++ b/2015/d23/ex1/input @@ -0,0 +1,46 @@ +jio a, +16 +inc a +inc a +tpl a +tpl a +tpl a +inc a +inc a +tpl a +inc a +inc a +tpl a +tpl a +tpl a +inc a +jmp +23 +tpl a +inc a +inc a +tpl a +inc a +inc a +tpl a +tpl a +inc a +inc a +tpl a +inc a +tpl a +inc a +tpl a +inc a +inc a +tpl a +inc a +tpl a +tpl a +inc a +jio a, +8 +inc b +jie a, +4 +tpl a +inc a +jmp +2 +hlf a +jmp -7 From 5da03de585297673af7d17c05d2fab3263f2b64e Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 22 May 2025 03:07:51 +0100 Subject: [PATCH 090/100] 2015: d23: ex1: add solution --- 2015/d23/ex1/ex1.py | 67 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100755 2015/d23/ex1/ex1.py diff --git a/2015/d23/ex1/ex1.py b/2015/d23/ex1/ex1.py new file mode 100755 index 0000000..b498706 --- /dev/null +++ b/2015/d23/ex1/ex1.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python + +import enum +import sys +from typing import NamedTuple + + +class Op(enum.StrEnum): + HLF = "hlf" + TPL = "tpl" + INC = "inc" + JMP = "jmp" + JIE = "jie" + JIO = "jio" + + +class Instruction(NamedTuple): + op: Op + x: str + y: str | None = None + + @classmethod + def from_str(cls, input: str) -> "Instruction": + op, rest = input.split(None, 1) + return cls(Op(op), *rest.split(", ")) + + +def solve(input: str) -> int: + def parse(input: str) -> list[Instruction]: + return [Instruction.from_str(line) for line in input.splitlines()] + + instructions = parse(input) + registers: dict[str, int] = {"a": 0, "b": 0} + + ip = 0 + while True: + if ip < 0 or ip >= len(instructions): + break + instr = instructions[ip] + ip += 1 + match instr.op: + case Op.HLF: + registers[instr.x] //= 2 + case Op.TPL: + registers[instr.x] *= 3 + case Op.INC: + registers[instr.x] += 1 + case Op.JMP: + ip += int(instr.x) - 1 # Account auto-increment + case Op.JIE: + assert instr.y is not None + if registers[instr.x] % 2 == 0: + ip += int(instr.y) - 1 # Account auto-increment + case Op.JIO: + assert instr.y is not None + if registers[instr.x] == 1: + ip += int(instr.y) - 1 # Account auto-increment + return registers["b"] + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 8abe651cf08d18c58e74e4b602fba2a6ca8933c9 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 22 May 2025 03:07:56 +0100 Subject: [PATCH 091/100] 2015: d23: ex2: add input --- 2015/d23/ex2/input | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 2015/d23/ex2/input diff --git a/2015/d23/ex2/input b/2015/d23/ex2/input new file mode 100644 index 0000000..79d9624 --- /dev/null +++ b/2015/d23/ex2/input @@ -0,0 +1,46 @@ +jio a, +16 +inc a +inc a +tpl a +tpl a +tpl a +inc a +inc a +tpl a +inc a +inc a +tpl a +tpl a +tpl a +inc a +jmp +23 +tpl a +inc a +inc a +tpl a +inc a +inc a +tpl a +tpl a +inc a +inc a +tpl a +inc a +tpl a +inc a +tpl a +inc a +inc a +tpl a +inc a +tpl a +tpl a +inc a +jio a, +8 +inc b +jie a, +4 +tpl a +inc a +jmp +2 +hlf a +jmp -7 From 3f1533b6e09a2c4bf3a657736e4c12ac357b5c4d Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 22 May 2025 03:08:05 +0100 Subject: [PATCH 092/100] 2015: d23: ex2: add solution --- 2015/d23/ex2/ex2.py | 67 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100755 2015/d23/ex2/ex2.py diff --git a/2015/d23/ex2/ex2.py b/2015/d23/ex2/ex2.py new file mode 100755 index 0000000..42bc07a --- /dev/null +++ b/2015/d23/ex2/ex2.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python + +import enum +import sys +from typing import NamedTuple + + +class Op(enum.StrEnum): + HLF = "hlf" + TPL = "tpl" + INC = "inc" + JMP = "jmp" + JIE = "jie" + JIO = "jio" + + +class Instruction(NamedTuple): + op: Op + x: str + y: str | None = None + + @classmethod + def from_str(cls, input: str) -> "Instruction": + op, rest = input.split(None, 1) + return cls(Op(op), *rest.split(", ")) + + +def solve(input: str) -> int: + def parse(input: str) -> list[Instruction]: + return [Instruction.from_str(line) for line in input.splitlines()] + + instructions = parse(input) + registers: dict[str, int] = {"a": 1, "b": 0} + + ip = 0 + while True: + if ip < 0 or ip >= len(instructions): + break + instr = instructions[ip] + ip += 1 + match instr.op: + case Op.HLF: + registers[instr.x] //= 2 + case Op.TPL: + registers[instr.x] *= 3 + case Op.INC: + registers[instr.x] += 1 + case Op.JMP: + ip += int(instr.x) - 1 # Account auto-increment + case Op.JIE: + assert instr.y is not None + if registers[instr.x] % 2 == 0: + ip += int(instr.y) - 1 # Account auto-increment + case Op.JIO: + assert instr.y is not None + if registers[instr.x] == 1: + ip += int(instr.y) - 1 # Account auto-increment + return registers["b"] + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From e8c323465f508a6e89f52c54a47644623cb0b165 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 22 May 2025 03:59:14 +0100 Subject: [PATCH 093/100] 2015: d24: ex1: add input --- 2015/d24/ex1/input | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 2015/d24/ex1/input diff --git a/2015/d24/ex1/input b/2015/d24/ex1/input new file mode 100644 index 0000000..bcdfa26 --- /dev/null +++ b/2015/d24/ex1/input @@ -0,0 +1,29 @@ +1 +2 +3 +7 +11 +13 +17 +19 +23 +31 +37 +41 +43 +47 +53 +59 +61 +67 +71 +73 +79 +83 +89 +97 +101 +103 +107 +109 +113 From a001f39ff0bb4c671240ecc1e9d835ec7059fbc2 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 22 May 2025 03:59:20 +0100 Subject: [PATCH 094/100] 2015: d24: ex1: add solution --- 2015/d24/ex1/ex1.py | 46 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100755 2015/d24/ex1/ex1.py diff --git a/2015/d24/ex1/ex1.py b/2015/d24/ex1/ex1.py new file mode 100755 index 0000000..025bb30 --- /dev/null +++ b/2015/d24/ex1/ex1.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python + +import itertools +import math +import sys + + +def solve(input: str) -> int: + def parse(input: str) -> list[int]: + return [int(n) for n in input.splitlines()] + + def package_groups(packages: list[int]) -> tuple[list[int], list[int], list[int]]: + assert sum(packages) % 3 == 0 # Sanity check + target_weight = sum(packages) // 3 + + # I'm lazy, a brute-force double loop is good enough + for first_len in range(1, len(packages) + 1): + for perm in itertools.combinations(range(len(packages)), first_len): + first = [packages[p] for p in perm] + if sum(first) != target_weight: + continue + others = [p for i, p in enumerate(packages) if i not in perm] + for sec_len in range(1, len(others) + 1): + for perm in itertools.combinations(range(len(others)), sec_len): + second = [others[p] for p in perm] + if sum(second) != target_weight: + continue + last = [p for i, p in enumerate(others) if i not in perm] + return first, second, last + assert False # Sanity check + + def quantum_entanglement(packages: list[int]) -> int: + return math.prod(packages) + + packages = parse(input) + best_split = package_groups(packages) + return quantum_entanglement(best_split[0]) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 57b3f7bbf6b8ac2f24f1d9424841cc1dfdc66716 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 22 May 2025 03:59:26 +0100 Subject: [PATCH 095/100] 2015: d24: ex2: add input --- 2015/d24/ex2/input | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 2015/d24/ex2/input diff --git a/2015/d24/ex2/input b/2015/d24/ex2/input new file mode 100644 index 0000000..bcdfa26 --- /dev/null +++ b/2015/d24/ex2/input @@ -0,0 +1,29 @@ +1 +2 +3 +7 +11 +13 +17 +19 +23 +31 +37 +41 +43 +47 +53 +59 +61 +67 +71 +73 +79 +83 +89 +97 +101 +103 +107 +109 +113 From 587896b43f0af8b33f5bdc42195bb95b79c79bf0 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 22 May 2025 03:59:31 +0100 Subject: [PATCH 096/100] 2015: d24: ex2: add solution --- 2015/d24/ex2/ex2.py | 71 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100755 2015/d24/ex2/ex2.py diff --git a/2015/d24/ex2/ex2.py b/2015/d24/ex2/ex2.py new file mode 100755 index 0000000..8136a7b --- /dev/null +++ b/2015/d24/ex2/ex2.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python + +import itertools +import math +import sys +from collections.abc import Iterator + + +def solve(input: str) -> int: + def parse(input: str) -> list[int]: + return [int(n) for n in input.splitlines()] + + def package_groups( + packages: list[int], + ) -> Iterator[tuple[list[int], list[int], list[int], list[int]]]: + assert sum(packages) % 4 == 0 # Sanity check + target_weight = sum(packages) // 4 + + # I'm lazy, a brute-force triple loop is good enough + found = False + for first_len in range(1, len(packages) + 1): + for perm in itertools.combinations(range(len(packages)), first_len): + first = [packages[p] for p in perm] + if sum(first) != target_weight: + continue + others = [p for i, p in enumerate(packages) if i not in perm] + for sec_len in range(1, len(others) + 1): + for perm in itertools.combinations(range(len(others)), sec_len): + second = [others[p] for p in perm] + if sum(second) != target_weight: + continue + others_ = [p for i, p in enumerate(others) if i not in perm] + for third_len in range(1, len(others_) + 1): + for perm in itertools.combinations( + range(len(others_)), third_len + ): + third = [others_[p] for p in perm] + last = [ + others_[i] + for i in range(len(others_)) + if i not in perm + ] + yield first, second, third, last + # We only care to enumerate all valid *first* packages + # Not *all* permutations + found = True + break + if found: + break + if found: + break + if found: + break + # *Don't* break if `found`, we want to keep enumerating this length + if found: + break + + def quantum_entanglement(packages: list[int]) -> int: + return math.prod(packages) + + packages = parse(input) + return min(quantum_entanglement(split[0]) for split in package_groups(packages)) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From 65f558bf0e3c45996e33eb7ed0d881fb902bb28f Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 22 May 2025 04:23:54 +0100 Subject: [PATCH 097/100] 2015: d25: ex1: add input --- 2015/d25/ex1/input | 1 + 1 file changed, 1 insertion(+) create mode 100644 2015/d25/ex1/input diff --git a/2015/d25/ex1/input b/2015/d25/ex1/input new file mode 100644 index 0000000..c5c38e6 --- /dev/null +++ b/2015/d25/ex1/input @@ -0,0 +1 @@ +To continue, please consult the code grid in the manual. Enter the code at row 2947, column 3029. From 6a8aa0685909c8f2fb2b0fcb650b400665235e4b Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 22 May 2025 04:24:04 +0100 Subject: [PATCH 098/100] 2015: d25: ex1: add solution --- 2015/d25/ex1/ex1.py | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 2015/d25/ex1/ex1.py diff --git a/2015/d25/ex1/ex1.py b/2015/d25/ex1/ex1.py new file mode 100755 index 0000000..1b6cc03 --- /dev/null +++ b/2015/d25/ex1/ex1.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python + +import sys +from typing import NamedTuple + + +class Point(NamedTuple): + x: int + y: int + + +def solve(input: str) -> int: + def parse(input: str) -> tuple[int, int]: + *_, row, column = input.replace(".", "").split(", ") + return int(row.split()[-1]), int(column.split()[-1]) + + def mod_pow(n: int, pow: int, mod: int) -> int: + if pow == 0: + return 1 + if pow == 1: + return n % mod + res = mod_pow(n, pow // 2, mod) ** 2 + if pow % 2 == 1: + res *= n + return res % mod + + def lookup(row: int, column: int) -> int: + n = column + row - 1 + top_right = n * (n + 1) // 2 + i = top_right - row + return 20151125 * mod_pow(252533, i, 33554393) % 33554393 + + row, column = parse(input) + return lookup(row, column) + + +def main() -> None: + input = sys.stdin.read() + print(solve(input)) + + +if __name__ == "__main__": + main() From fad5b0ba260748f62fd913376caecd53b3e9b0bf Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 22 May 2025 04:24:09 +0100 Subject: [PATCH 099/100] 2015: d25: ex2: add input --- 2015/d25/ex2/input | 1 + 1 file changed, 1 insertion(+) create mode 100644 2015/d25/ex2/input diff --git a/2015/d25/ex2/input b/2015/d25/ex2/input new file mode 100644 index 0000000..c5c38e6 --- /dev/null +++ b/2015/d25/ex2/input @@ -0,0 +1 @@ +To continue, please consult the code grid in the manual. Enter the code at row 2947, column 3029. From efa485c08c0e99d4f0d8052d6c5e58f9943d1627 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 22 May 2025 04:24:15 +0100 Subject: [PATCH 100/100] 2015: d25: ex2: add solution --- 2015/d25/ex2/ex2.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100755 2015/d25/ex2/ex2.py diff --git a/2015/d25/ex2/ex2.py b/2015/d25/ex2/ex2.py new file mode 100755 index 0000000..918e0ec --- /dev/null +++ b/2015/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()