diff options
-rw-r--r-- | 2015/01/example | 1 | ||||
-rw-r--r-- | 2015/01/input | 1 | ||||
-rw-r--r-- | 2015/01/not_quite_lisp.py | 9 | ||||
-rw-r--r-- | 2015/01/not_quite_lisp2.py | 14 | ||||
-rw-r--r-- | 2015/02/input | 1000 | ||||
-rw-r--r-- | 2015/02/nomath.py | 22 | ||||
-rw-r--r-- | 2022/01/calories.py | 12 | ||||
-rw-r--r-- | 2022/01/calories2.py | 12 | ||||
-rw-r--r-- | 2022/01/example | 14 | ||||
-rw-r--r-- | 2022/01/input | 2248 | ||||
-rw-r--r-- | 2022/02/a.py | 43 | ||||
-rw-r--r-- | 2022/02/exmaple | 3 | ||||
-rw-r--r-- | 2022/02/input | 2500 | ||||
-rw-r--r-- | 2022/03/example | 6 | ||||
-rw-r--r-- | 2022/03/input | 300 | ||||
-rw-r--r-- | 2022/03/rucksack.py | 30 | ||||
-rw-r--r-- | 2022/04/a.py | 18 | ||||
-rw-r--r-- | 2022/04/b | 4 | ||||
-rw-r--r-- | 2022/04/example | 6 | ||||
-rw-r--r-- | 2022/04/input | 1000 | ||||
-rw-r--r-- | 2022/08/a.py | 42 | ||||
-rw-r--r-- | 2022/08/example | 5 | ||||
-rw-r--r-- | 2022/08/input | 99 | ||||
-rw-r--r-- | UNLICENSE | 24 |
24 files changed, 7413 insertions, 0 deletions
diff --git a/2015/01/example b/2015/01/example new file mode 100644 index 0000000..4b58722 --- /dev/null +++ b/2015/01/example @@ -0,0 +1 @@ +()()) diff --git a/2015/01/input b/2015/01/input new file mode 100644 index 0000000..71a7803 --- /dev/null +++ b/2015/01/input @@ -0,0 +1 @@ +()(((()))(()()()((((()(((())(()(()((((((()(()(((())))((()(((()))((())(()((()()()()(((())(((((((())))()()(()(()(())(((((()()()((())(((((()()))))()(())(((())(())((((((())())))(()())))()))))()())()())((()()((()()()()(()((((((((()()())((()()(((((()(((())((())(()))()((((()((((((((())()((()())(())((()))())((((()())(((((((((((()()(((((()(()))())(((()(()))())((()(()())())())(()(((())(())())()()(()(()((()))((()))))((((()(((()))))((((()(()(()())())()(((()((((())((((()(((()()(())()()()())((()((((((()((()()))()((()))()(()()((())))(((()(((()))((()((()(()))(((()()(()(()()()))))()()(((()(((())())))))((()(((())()(()(())((()())))((((())))(()(()(()())()((()())))(((()((()(())()()((()((())(()()((())(())()))()))((()(())()))())(((((((()(()()(()(())())))))))(()((((((())((((())((())())(()()))))()(())(()())()())((())(()))))(()))(()((()))()(()((((((()()()()((((((((()(()(())((()()(()()))(())()())()((())))()))()())(((()))(())()(())()))()((()((()(()()())(())()()()((())())))((()()(()()((()(())()()())(((()(()()))))(())))(()(()())()))()()))))))()))))((((((())))())))(()(())())(()())))))(()))()))))))()((()))))()))))(()(()((()())())(()()))))(((())()))())())())(((()(()()))(())()(())(())((((((()()))))((()(()))))))(()))())(((()()(()))()())()()()())))))))))))))(())(()))(()))((()(())(()())(())())(()())(())()()(()())))()()()))(())())()))())())(())((())))))))(())))(())))))()))))((())(()(((()))))(()))()((()(())))(()())(((((()))()())()()))))()))))()))())(()(()()()))()))))))((()))))))))))()((()))((()(())((())()()(()()))()(()))))()()(()))()))(((())))(())()((())(())(()())()())())))))))())))()((())))()))(()))()()))(((((((()))())(()()))(()()(()))()(()((()())()))))))(((()()()())))(())()))()())(()()))()()))))))))(())))()))()()))))))()))()())))()(())(())))))()(())()()(()()))))())((()))))()))))(()(((((()))))))))())))())()(())()()))))(())))())()()())()()())()(()))))()))()))))))))())))((()))()))()))())))()())()()())))())))(()((())()((()))())))))())()(())((())))))))))))())()())(())())())(()))(()))()))())(()(())())()())()()(()))))(()(())))))))(())))())(())))))))())()()(())())())))(())))))()))()(()())()(()))())())))))()()(()))()))))())))))))))()))))()))))))())()())()()))))()())))())))))))))))()()))))()()(((()))()()(())()))))((()))))(()))(())())))(())()))))))(()))()))))(())())))))()))(()())))))))))))))())))))))))()((()())(()())))))))((()))))(())(())))()(()())())))())())(()()()())))()))))))())))))())()()())))))))))))()()(()))))()())()))((()())(()))))()(()))))))))))()())())(((())(()))))())()))()))()))))))()))))))(()))))()))))()(())))(())))(()))())()()(()()))()))(()()))))))))()))(()))())(()()(()(()())()()))()))))))))(())))))((()()(()))())())))))()))())(()())()()))())))()(()()()()))((())())))())()(()()))()))))))))(()))(())))()))))(()(()())(()))))()())())()))()()))())))))))))))())()))))))()))))))))())))))()))))())(()())))(())()))())())))))()()(()()())(()())))()()))(((()))(()()()))))()))))()))))((())))()((((((()()))))))())))))))))))(((()))))))))))))(())())))))())(()))))))(()))((()))())))()(()((()))()))()))))))))))())()))()(()()))))())))())(())()(()))()))())(()))()))))(()()))()()(())))))()))(())(()(()()))(()()())))))(((()))))))()))))))))))))(())(()))))()())())()()((()()))())))))(()))))())))))))()()()))))))))())))()(((()()))(())))))(((())())))))((()))()(()))(()))))(()())))(()))())))))()))))(())(())))()((()))(())())))()()))()))))))))()))(()()()(()()()(()))())(())()())(((()))(())))))))))(((()())))()()))))))))()(())(()))()((((())(())(()())))()))(((())()()()))((()))(()))())())))())))(()))())()())())(()(())())()()()(())))())(())))(())))(())()))()))(()((()))))))))())(()))))))())(()()))()()))()(()(()())))()()(()((()((((((()))(())))()()()))())()))((()()(()))())((()(()(()))(()()))))()())))()))()())))))))()()((()())(())))()))(()))(())(()))())(()(())))()()))))))(((()(((()()))()(()(())())((()()))()))()))()))()(()()()(()))((()())()(())))()()))(((())()()())(())()((()()()()(()(())(()()))()(((((()())))((())))))(()()()))))(((()(())))()))((()((()(())()(()((())))((()())()(()))(((()())()()(()))(())(((()((()())()((())()())(((()()))((()((())(()))(()())(()()()))((()))(())(()((()()())((()))(())))(())(())(())))(()())))(((((()(()(((((()())((((()(()())(())(()()(((())((()(((()()(((()()((((((())))())(()((((((()(()))()))()()((()((()))))()(()()(()((()()))))))(((((()(((((())()()()(())())))))))()))((()()(())))(())(()()()())))))(()((((())))))))()()(((()(()(()(()(()())()()()(((((((((()()())()(()))((()()()()()(((((((()())()((())()))((((((()(()(()(()())(((()(((((((()(((())(((((((((())(())())()))((()(()))(((()()())(())(()(()()(((()(())()))())))(())((((((())(()()())()()(((()(((())(()(((())(((((((()(((((((((()))(())(()(()(()))))((()))()(())())())((()(()((()()))((()()((()(())(())(()((())(((())(((()()()((((((()()(())((((())()))))(())((()(()((())))(((((()(()()())())((())())))((())((()((()()((((((())(((()()(()())())(()(()))(()(()))())())()(((((((()(((()(())()()((())((()(()()((()(()()(((((((((((())((())((((((())((()((((()(()((((()(((((((())()((()))))())()((()((((()(()(((()((()())))(())())(((()(((())((((((()(((((((((()()(())))(()(((((()((((()())))((()((()((()(()()(((())((((((((((((()(((())(()(((((()))(()()(()()()()()()((())(((((((())(((((())))))())()(()()(()(()(((()()(((((())(()((()((()(((()()((()((((())()))()((((())(())))()())(((())(())(()()((()(((()()((((((((((()()(()())())(((((((((())((((()))()()((((())(()((((()(((())())(((((((((((()((((())))(())(()(((()(((()((())(((((()((()()(()(()()((((((()((((()((()(()((()(()((((((()))))()()(((((()((()(()(())()))(())(((((((()((((()())(()((()((()(()))())))(())((()))))(((((((()()()())(()))(()()((()())()((()((()()()(()(()()))(()())(())(((((()(((((((((((()((()(((()(((((((()()((((((()(((((()(()((()(((((())((((((()))((((())((()()((())(((())()(((((()()(((((()((()(()(((((((()(((((()((()((()((())(())((())(()))()()))(()()(()(()()(((((((()(((()(((())()(((((()((((((()())((((())()((()((()(()()())(()))((((()()((((((()((()(()(()((((()((()((())((((((()(()(())((((((()((((((((((()((())()))()(()(()(((((()()()))((())))()(()((((((((((((((()(((()((((()((())((()((()(((()()(()(((()((())(()()())))()(()(()(((((()()(()(()((((()(((((())()(()(()))(((((()()(((()()(())((((((((((((((())((())(((((((((((())()()()(())()(()(()(((((((((())(((()))(()()())(()((((()(())(((((()())(())((((((((())()((((()((((((())(()((()(())(((()((((()))(((((((((()()))((((()(())()()()(())(()((())((()()))()(((())(((((())((((((()()))(((((((((()((((((())))(((((((()((()(()(())))())(()(()))()(((((()())(()))()(()(())(((()))))())()())))(((((()))())()((()(()))))((()()()((((((()))()()((((((((())((()(()(((()(()((())((()())(()((((())(()(((()()()(()(()()))())())((((((((((())())((()))()((())(())(())))())()(()()(())))())(()))(((()(()()(((()(((())))()(((()(())()((((((())()))()))()((((((()(()(((((()())))()))))())()()(((()(((((())((()()(()((()((()(()(()(())))(()()()()((()(())(((()((()))((((()))())(())))())(()))()()()())()))(((()()())()((())))(())(()()()()(()())((()(()()((((())))((()((()(())((()(()((())()(()()(((()())()()())((()))((())(((()()(())))()()))(((()((())()(((((()())(())((())()())())((((((()(()(((((()))(()(
\ No newline at end of file diff --git a/2015/01/not_quite_lisp.py b/2015/01/not_quite_lisp.py new file mode 100644 index 0000000..d7c59d4 --- /dev/null +++ b/2015/01/not_quite_lisp.py @@ -0,0 +1,9 @@ +floor = 0 +with open("input", encoding="utf-8") as f: + text = f.read() +for char in text: + if char == '(': + floor += 1 + elif char == ')': + floor -= 1 +print(f"floor is {floor}") diff --git a/2015/01/not_quite_lisp2.py b/2015/01/not_quite_lisp2.py new file mode 100644 index 0000000..a688b3b --- /dev/null +++ b/2015/01/not_quite_lisp2.py @@ -0,0 +1,14 @@ +pos = 1 +floor = 0 +with open("input", encoding="utf-8") as f: + text = f.read() +for char in text: + if char == '(' or char == ')': + if char == '(': + floor += 1 + else: + floor -= 1 + if floor == -1: + print(f"basement position is {pos}") + break; + pos += 1 diff --git a/2015/02/input b/2015/02/input new file mode 100644 index 0000000..5f3335f --- /dev/null +++ b/2015/02/input @@ -0,0 +1,1000 @@ +29x13x26 +11x11x14 +27x2x5 +6x10x13 +15x19x10 +26x29x15 +8x23x6 +17x8x26 +20x28x3 +23x12x24 +11x17x3 +19x23x28 +25x2x25 +1x15x3 +25x14x4 +23x10x23 +29x19x7 +17x10x13 +26x30x4 +16x7x16 +7x5x27 +8x23x6 +2x20x2 +18x4x24 +30x2x26 +6x14x23 +10x23x9 +29x29x22 +1x21x14 +22x10x13 +10x12x10 +20x13x11 +12x2x14 +2x16x29 +27x18x26 +6x12x20 +18x17x8 +14x25x1 +30x15x22 +17x18x7 +28x23x24 +15x12x25 +14x7x20 +29x23x8 +24x5x22 +6x22x8 +1x15x26 +14x5x1 +24x28x28 +17x23x23 +4x15x7 +23x8x11 +6x15x1 +23x18x13 +17x1x26 +23x13x17 +2x18x8 +22x22x1 +10x22x6 +28x29x20 +22x21x25 +14x8x23 +12x30x14 +8x7x5 +3x30x15 +4x3x29 +25x18x3 +16x7x16 +4x3x8 +9x16x30 +20x28x3 +28x24x6 +4x18x2 +23x18x5 +22x4x30 +15x30x9 +7x12x12 +3x22x29 +12x1x9 +9x2x25 +17x11x10 +25x24x7 +7x27x26 +26x4x12 +29x2x26 +19x24x12 +23x23x3 +26x28x16 +18x4x16 +25x30x18 +29x19x19 +16x3x27 +29x25x29 +18x19x5 +14x21x30 +19x13x26 +19x10x15 +9x4x7 +18x6x6 +24x25x29 +9x12x27 +15x3x22 +30x17x21 +18x19x28 +9x11x12 +8x28x22 +11x3x4 +28x17x20 +24x18x15 +11x12x13 +6x19x24 +28x4x5 +28x22x23 +13x29x2 +9x16x15 +29x28x1 +10x18x30 +19x11x12 +26x28x25 +23x17x13 +25x1x21 +17x1x27 +17x27x28 +28x13x15 +14x13x25 +11x29x7 +22x29x5 +13x6x14 +23x18x13 +25x7x17 +18x9x20 +21x11x2 +28x11x13 +13x25x1 +19x29x25 +16x29x4 +10x21x10 +7x25x17 +5x9x3 +1x15x6 +8x27x29 +23x6x30 +22x22x29 +6x20x30 +26x25x29 +10x19x19 +20x30x9 +5x30x24 +17x10x27 +30x14x30 +8x17x4 +7x18x6 +3x5x4 +24x17x15 +14x20x17 +22x27x15 +18x14x15 +23x9x11 +21x16x29 +7x18x21 +9x3x29 +10x13x4 +2x30x4 +23x20x4 +8x22x21 +29x28x4 +13x16x25 +21x9x11 +7x26x26 +13x23x30 +19x7x10 +9x23x21 +21x9x17 +9x21x15 +20x29x22 +23x13x15 +19x25x2 +12x11x30 +20x21x6 +21x6x17 +24x26x9 +29x21x29 +29x26x16 +6x16x1 +2x12x6 +6x7x20 +7x2x22 +6x22x4 +13x11x27 +25x27x14 +11x8x6 +26x11x14 +30x3x29 +27x21x20 +15x16x26 +6x22x10 +11x9x25 +23x13x6 +13x9x3 +30x22x13 +29x23x14 +25x19x6 +7x29x11 +19x18x5 +29x25x13 +25x24x27 +1x9x12 +22x9x17 +14x12x28 +19x21x17 +13x25x17 +14x25x12 +4x14x30 +7x15x28 +3x6x25 +6x2x16 +15x19x11 +17x30x20 +20x23x7 +26x21x6 +26x29x24 +2x4x30 +4x22x18 +13x3x28 +27x6x21 +5x3x27 +12x7x11 +28x11x9 +12x9x2 +1x22x20 +15x13x28 +14x19x16 +28x20x3 +20x4x9 +26x7x26 +18x19x25 +7x1x13 +20x23x29 +27x26x8 +11x15x15 +10x21x23 +29x2x11 +21x28x20 +3x18x23 +26x17x17 +14x26x17 +20x7x17 +18x12x8 +4x8x8 +8x15x23 +24x29x5 +1x25x8 +1x28x17 +16x18x13 +29x24x22 +13x16x10 +14x7x16 +15x11x29 +12x15x19 +17x6x28 +4x3x9 +15x16x8 +29x27x11 +2x24x20 +4x21x3 +29x24x27 +18x22x22 +7x8x18 +20x7x8 +19x9x2 +20x17x2 +2x29x10 +19x25x1 +28x9x3 +29x27x20 +7x21x7 +10x4x22 +26x8x5 +26x14x1 +5x27x9 +2x18x3 +3x27x17 +30x17x23 +30x11x20 +4x6x7 +6x29x27 +30x16x20 +24x30x28 +19x20x26 +18x1x25 +26x12x12 +19x15x29 +16x21x24 +23x13x26 +25x16x10 +8x9x18 +24x14x1 +24x15x21 +19x9x14 +8x23x11 +22x2x16 +29x9x26 +3x16x25 +15x20x30 +3x11x12 +15x2x3 +13x7x4 +2x7x27 +9x26x11 +30x24x19 +28x17x21 +10x8x2 +11x15x26 +10x12x20 +24x24x27 +25x26x16 +13x4x20 +25x13x11 +12x22x3 +20x7x1 +12x18x6 +26x8x20 +14x2x7 +23x12x1 +26x24x24 +27x26x23 +26x17x5 +17x24x2 +26x5x6 +23x5x1 +5x18x30 +24x21x19 +5x28x11 +21x20x14 +25x4x22 +26x24x11 +7x5x8 +13x1x30 +5x1x6 +14x5x2 +8x11x7 +13x20x1 +17x30x14 +29x22x10 +12x26x3 +27x17x3 +26x27x4 +5x26x17 +22x11x19 +8x26x3 +24x19x22 +7x1x4 +6x27x30 +4x28x14 +16x14x18 +4x5x20 +19x25x4 +15x15x1 +10x14x14 +16x18x24 +21x27x15 +5x5x10 +1x7x13 +16x2x8 +13x15x11 +3x25x10 +20x29x8 +12x3x2 +10x13x12 +25x27x1 +11x30x19 +7x19x13 +27x6x18 +16x21x19 +21x29x5 +16x23x12 +29x19x15 +5x5x10 +27x15x1 +13x16x22 +29x19x5 +8x12x9 +3x18x5 +13x25x3 +5x9x21 +10x20x16 +9x9x11 +23x21x1 +22x2x15 +27x8x13 +23x7x3 +26x30x15 +29x15x16 +16x27x13 +2x18x9 +10x27x8 +20x9x25 +10x2x17 +16x13x13 +21x26x1 +27x26x24 +9x30x16 +19x17x28 +25x15x1 +10x26x6 +10x11x11 +5x26x25 +30x4x15 +9x8x23 +14x25x7 +8x28x8 +28x18x24 +4x4x25 +16x25x11 +17x27x8 +15x16x9 +24x13x21 +17x3x27 +27x5x26 +8x27x12 +29x2x8 +24x23x30 +1x30x21 +6x18x20 +13x14x12 +25x30x23 +24x6x24 +12x7x21 +11x6x8 +8x30x30 +26x3x12 +28x6x5 +18x7x1 +7x6x20 +14x16x18 +11x22x15 +4x20x10 +19x24x19 +8x24x11 +4x9x10 +6x6x22 +10x9x29 +1x5x28 +19x25x29 +20x30x3 +15x13x13 +9x9x24 +20x14x29 +26x24x13 +2x25x8 +10x26x2 +12x19x12 +18x6x20 +4x5x14 +26x27x10 +16x26x20 +3x21x15 +2x26x18 +14x11x17 +26x26x25 +10x1x11 +17x19x19 +27x28x26 +9x2x10 +19x30x15 +23x30x14 +15x3x20 +2x14x22 +21x18x8 +22x4x29 +19x6x29 +9x26x29 +16x10x9 +22x12x22 +13x28x14 +25x14x28 +28x3x30 +10x17x1 +10x27x22 +10x23x19 +14x25x9 +11x24x8 +30x25x10 +22x13x28 +2x7x6 +11x20x8 +9x22x14 +19x16x9 +11x24x4 +11x17x2 +6x4x10 +26x10x10 +12x14x5 +27x10x3 +15x3x6 +11x7x19 +22x10x12 +21x26x10 +13x20x3 +27x8x8 +1x24x23 +24x9x22 +23x17x23 +3x28x19 +2x20x28 +23x17x24 +26x1x4 +4x1x12 +5x6x16 +13x22x13 +25x21x21 +20x21x12 +9x24x25 +17x16x12 +12x28x9 +18x16x27 +29x12x2 +30x12x15 +24x11x10 +4x9x22 +4x24x5 +19x11x5 +6x25x6 +1x20x17 +22x8x21 +11x26x4 +16x19x3 +8x12x8 +13x2x18 +10x5x11 +8x12x17 +21x2x5 +26x17x26 +23x18x17 +28x11x14 +1x4x27 +29x5x28 +5x9x10 +5x7x25 +20x15x27 +15x11x17 +12x14x1 +29x14x4 +18x14x18 +14x25x24 +26x14x18 +13x8x11 +30x1x23 +3x4x12 +12x24x9 +8x6x16 +14x15x30 +12x30x8 +22x11x18 +16x30x28 +17x18x4 +13x14x23 +2x28x8 +3x28x30 +29x30x8 +4x6x26 +6x30x17 +11x30x30 +19x4x3 +12x15x20 +22x28x4 +26x30x2 +6x12x7 +1x10x5 +25x29x7 +17x9x18 +16x21x29 +21x14x7 +15x16x11 +26x6x15 +8x24x7 +2x20x4 +2x9x3 +19x8x13 +18x7x22 +27x14x17 +2x13x8 +18x15x26 +15x27x27 +18x11x15 +1x29x20 +21x12x11 +20x2x15 +28x23x9 +1x1x17 +7x23x9 +30x9x27 +9x16x18 +15x24x28 +30x11x18 +29x26x10 +9x5x25 +2x1x19 +14x3x14 +6x3x6 +30x15x20 +20x17x27 +28x10x9 +14x24x28 +17x11x6 +12x3x6 +8x8x15 +23x14x21 +11x21x7 +5x13x30 +4x29x25 +30x28x24 +18x4x9 +3x15x6 +13x9x19 +30x14x7 +7x9x9 +17x11x26 +24x26x13 +16x21x16 +27x17x25 +2x21x11 +9x11x27 +3x3x7 +13x8x14 +20x20x26 +13x29x22 +30x11x1 +7x10x19 +27x5x9 +23x17x15 +21x6x13 +24x15x16 +18x4x14 +18x16x6 +22x11x18 +14x2x5 +15x3x7 +10x20x29 +16x1x10 +30x23x1 +10x15x11 +17x14x5 +22x8x13 +7x11x28 +26x17x3 +2x23x2 +28x13x19 +18x12x28 +22x23x16 +14x12x1 +20x8x19 +17x19x13 +29x2x12 +2x26x27 +29x16x4 +13x8x18 +16x15x30 +23x16x2 +28x8x27 +21x8x23 +13x20x26 +19x6x17 +17x30x15 +7x4x30 +2x13x30 +18x7x19 +4x13x27 +8x6x5 +18x20x25 +2x3x30 +23x27x13 +22x30x4 +23x25x25 +23x16x19 +25x3x1 +5x6x15 +11x29x12 +25x24x7 +16x7x20 +20x3x2 +12x27x15 +16x10x12 +1x3x14 +22x1x26 +2x24x18 +11x29x16 +15x2x9 +10x1x24 +21x8x11 +30x11x23 +6x30x21 +13x27x29 +14x6x5 +18x29x19 +12x4x28 +29x3x14 +10x30x28 +5x7x15 +14x1x10 +9x25x14 +7x24x18 +28x17x21 +18x13x25 +26x15x1 +21x1x19 +12x16x21 +4x6x13 +7x15x26 +17x19x5 +12x28x2 +1x20x19 +27x7x5 +17x26x8 +12x15x19 +5x23x10 +8x2x8 +16x13x12 +14x27x1 +26x29x3 +24x16x14 +14x13x13 +7x22x23 +2x9x30 +4x27x8 +26x27x15 +23x1x6 +25x29x18 +5x18x1 +20x8x20 +5x10x25 +30x25x15 +7x22x25 +28x26x17 +29x4x1 +21x11x27 +20x9x8 +25x22x12 +2x11x11 +23x2x16 +23x27x20 +2x13x28 +27x2x24 +11x1x17 +12x4x27 +16x20x22 +30x12x10 +5x15x4 +5x2x27 +12x4x25 +1x16x4 +27x4x4 +21x16x3 +27x26x3 +24x6x6 +24x12x12 +20x20x25 +8x29x2 +21x4x5 +2x4x8 +4x13x19 +3x20x10 +12x15x16 +6x5x4 +12x16x20 +22x19x17 +8x17x22 +25x16x15 +7x1x19 +10x1x7 +23x23x5 +28x6x12 +2x25x12 +10x27x12 +24x27x19 +14x14x20 +4x1x5 +16x27x29 +20x20x24 +28x24x30 +6x15x15 +9x15x30 +23x26x3 +17x24x21 +22x25x25 +18x29x10 +20x25x1 +24x11x16 +20x7x21 +20x7x9 +7x26x2 +5x18x1 +16x26x28 +4x10x18 +27x30x21 +26x9x9 +8x16x14 +6x27x8 +28x9x20 +13x13x4 +9x18x16 +18x15x18 +22x19x14 +14x10x17 +25x29x11 +1x18x19 +8x11x26 +18x6x14 +30x24x13 +27x1x27 +15x9x3 +2x29x17 +2x26x21 +22x9x9 +20x20x20 +22x28x2 +26x5x16 +11x3x14 +21x16x16 +18x26x7 +18x30x6 +7x11x12 +15x10x2 +27x2x16 +27x30x24 +28x14x24 +7x4x8 +6x28x15 +13x19x1 +22x26x30 +7x30x24 +2x17x21 +19x26x2 +19x24x15 +14x23x2 +21x27x15 +30x15x14 +21x29x5 +23x30x2 +4x1x2 +15x5x13 +21x2x30 +20x7x16 +1x21x25 +2x25x1 +12x29x5 +28x13x16 +26x3x12 +29x20x23 +28x12x20 +4x30x8 +16x15x16 +6x16x29 +2x28x13 +24x25x2 +26x15x22 +17x20x11 +18x12x7 +19x1x18 +8x27x13 +22x16x8 +19x26x17 +13x11x10 +22x12x3 +13x12x14 +29x17x9 +6x14x10 +14x20x10 +8x26x9 +25x13x22 +3x30x25 +14x28x1 +30x29x12 +3x17x15 +3x24x14 +28x24x22 +16x6x1 +20x25x14 +17x17x13 +6x19x27 +10x15x20 +8x23x20 +7x29x21 +18x9x25 +10x5x22 +2x27x27 +16x18x30 +15x5x12 +26x29x29 +28x11x10 +9x29x28 +24x15x23 +26x9x10 +5x1x25 +22x27x16 +7x29x3 +1x3x5 +8x7x29 +19x21x11 +28x13x30 +17x16x20 +5x10x25 +9x14x15 +15x14x23 +16x4x17 +21x8x2 +9x9x8 +22x22x4 +10x2x27 +12x19x10 +15x29x4 +22x14x7 +29x18x5 +1x7x27 +24x1x15 +23x23x26 +12x17x23 +26x10x24 +8x22x2 +8x1x10 +22x19x12 +2x23x13 +11x27x25 +26x15x27 +27x7x21 +18x9x6 +22x21x22 +7x12x26 +23x21x13 +14x3x8 +5x9x28 +29x29x15 +27x25x23 +12x2x24 +8x2x20 +29x19x4 +12x24x29 +2x27x28 +14x20x9 +28x6x25 +18x29x8 +19x11x30 +15x11x23 +18x7x7 +14x20x14 +26x18x22 +27x25x13 +12x10x30 +30x2x7 +28x10x1 +18x10x30 +22x11x5 +22x16x3 +25x15x9 +5x10x24 +4x28x8 +19x24x18 +3x4x25 +14x4x30 +11x26x3 +12x12x12 +26x7x24 +3x2x14 +1x27x7 +2x2x13 +3x26x26 +12x4x11 +12x17x20 +4x19x30 +5x18x10 +17x6x18 +19x30x20 +11x2x17 +30x13x19 +22x23x7 +17x28x2 +5x17x30 +7x11x4 +21x26x18 +15x28x4 +5x6x27 +12x6x16 +9x17x12 +27x20x5 +14x5x20 +27x14x6 +2x14x21 +4x28x30 +24x5x1 +19x29x29 +11x23x1 +8x16x21 +3x17x19 +10x13x5 +20x21x16 +23x3x6 +27x26x11 +3x2x22 +14x3x5 +10x9x8 diff --git a/2015/02/nomath.py b/2015/02/nomath.py new file mode 100644 index 0000000..1788cfd --- /dev/null +++ b/2015/02/nomath.py @@ -0,0 +1,22 @@ +def recprism_area(l, w, h): + return 2*l*w + 2*w*h + 2*h*l + +def smallest_side(l, w, h): + return min(l*w, w*h, h*l) + +def ribbon_wrap(l, w, h): + di = [l, w, h] + stmin = min(di) + di.remove(stmin) + ndmin = min(di) + return 2*stmin + 2*ndmin + +def ribbon_bow(l, w, h): + return l*w*h + +order = 0 +with open("input") as f: + for line in [l.strip() for l in f.readlines()]: + di = list(map(int, line.split("x"))) + order += ribbon_wrap(*di) + ribbon_bow(*di) +print(order) diff --git a/2022/01/calories.py b/2022/01/calories.py new file mode 100644 index 0000000..8fddecf --- /dev/null +++ b/2022/01/calories.py @@ -0,0 +1,12 @@ +cur_cal = 0 +max_cal = 0 +with open("input", encoding="utf-8") as f: + foods = f.readlines() +for food in foods: + if food == "\n": + if cur_cal > max_cal: + max_cal = cur_cal + cur_cal = 0 + else: + cur_cal += int(food) +print(f"highest calories is {max_cal}") diff --git a/2022/01/calories2.py b/2022/01/calories2.py new file mode 100644 index 0000000..bba30a2 --- /dev/null +++ b/2022/01/calories2.py @@ -0,0 +1,12 @@ +elf_cals = [0] +with open("input", encoding="utf-8") as f: + foods = f.readlines() +i = 0 +for food in foods: + if food == "\n": + elf_cals.append(0) + i += 1; + else: + elf_cals[i] += int(food) +top3 = sum(sorted(elf_cals, reverse=True)[:3]) +print(f"sum of top 3 calories is {top3}") diff --git a/2022/01/example b/2022/01/example new file mode 100644 index 0000000..2094f91 --- /dev/null +++ b/2022/01/example @@ -0,0 +1,14 @@ +1000 +2000 +3000 + +4000 + +5000 +6000 + +7000 +8000 +9000 + +10000 diff --git a/2022/01/input b/2022/01/input new file mode 100644 index 0000000..342079f --- /dev/null +++ b/2022/01/input @@ -0,0 +1,2248 @@ +7844 +1892 +10928 +4800 +9730 +3485 +7293 + +11956 +2767 +12893 +2757 +3026 +9979 + +4507 +4199 +2855 +1792 +2041 +4162 +3855 +2650 +2165 +5464 +2125 +4979 +4878 +6301 + +2546 +3750 +1192 +4692 +6809 +2808 +6505 +2811 +6448 +4270 +2919 +1297 +1678 + +2006 +6163 +5949 +2074 +5917 +5796 +3456 +1161 +6843 +3988 +4064 +5591 + +17062 +14531 +5297 + +16033 +18054 +25935 + +3621 +3121 +5884 +5199 +4584 +4796 +1325 +3374 +5789 +2545 +5842 +1760 +5766 +1882 +3084 + +10364 +1136 +2256 +5654 +7065 +5990 +3621 +8063 + +4334 +1865 +4485 +4741 +2591 +2594 +2991 +3928 +5849 +6864 +4932 + +6627 +8318 +11410 +18778 + +14870 +13264 +8777 +2567 +15388 + +11837 +11042 +12115 +11169 +8021 +4206 +8637 + +2955 +2115 +2292 +2759 +6464 +2843 +3817 +1628 +6486 +2499 +3935 +4944 +1427 +4870 + +14800 +13942 +2563 +18543 + +8415 +5943 +6117 +3863 +7123 +8666 +9834 +7437 + +12318 +5577 +8108 +11695 +2720 +3413 + +4765 +2805 +2850 +5241 +3910 +4837 +5770 +4998 +3358 +5141 +1052 +2281 +4405 +1714 + +7984 +4685 +12922 +11579 +4278 + +14877 +4676 +4571 +9279 +11337 + +1782 +3009 +14712 + +5936 +5243 +3849 +1001 +10728 +3847 +9986 + +1531 +3707 +3599 +5533 +4025 +4651 +3934 +4205 +2481 +3462 +1672 +1806 +3833 +4072 +1497 + +16920 +25420 +17042 + +43927 + +8193 +3107 +2831 +4122 +16336 + +7507 +1665 +8553 +3231 +2528 +1046 +3491 +4631 +3574 + +35988 +29345 + +3520 +4006 +6327 +1658 +4714 +1123 +1938 +3667 +3807 +1824 +4808 +4586 +3275 +4548 + +9989 +32096 + +52470 + +1188 +7694 +7875 +6114 +6189 +4343 +6974 +4812 +1776 +4794 +8065 + +2364 +4111 +3663 +4182 +3667 +5440 +5482 +2657 +3931 +5871 +5403 +5956 +2659 +2320 + +10249 +13770 + +6331 +7262 +1498 +1329 +8943 +1563 +8197 +6898 +2300 + +5116 +5930 +8363 +8908 +6063 +8325 +1070 + +7829 +8877 +5631 +6100 +1007 +4754 +7353 +8363 + +13160 +16304 +6155 +15418 + +18068 +24378 +16529 + +8216 +1918 +3305 +7698 +5936 +2012 +2053 +3575 +5705 + +5372 +3627 +2860 +3742 +4117 +5514 +2590 +4503 +2494 +4418 +1908 +4109 +5255 +5749 +5061 + +14547 +31905 + +4691 +4268 +3887 +4136 +5724 +4507 +2298 +6660 +5243 +4719 +5145 +2949 +1460 + +6324 +1211 +2329 +4872 +5530 +1645 +2989 +3687 +3925 +2578 +1153 +4364 + +1864 +8160 +9219 +6479 +1098 +9364 +7442 +9665 +1522 + +3185 +3657 +5730 +7979 +8956 +2138 +8288 +3524 +7910 + +20487 + +4948 +4419 +3363 +6742 +1536 +3809 +4289 +1861 +2490 +4842 +1005 +2083 +3115 + +5872 +2895 +2163 +6140 +4962 +1566 +1502 +6407 +6241 +7154 + +8910 +5483 +10358 +10448 +5912 +9133 +1919 +5768 + +7887 +1592 +3503 +6182 +10088 +12143 + +3897 +4813 +2087 +2953 +5308 +1587 +7320 +4947 +1366 +6723 +2720 + +16484 +15947 +2582 +11421 + +2457 +1498 +4113 +5639 +3930 +4950 +4130 +5475 +6156 +4966 +1322 +5749 +5892 +2257 + +24070 + +2634 +2784 +5289 +1472 +5770 +4442 +1733 +2003 +2281 +4283 +4183 +3183 +5405 +5055 +4089 + +6167 +5650 +6531 +8255 +11103 +12421 + +8499 +15327 +4714 + +52582 + +8000 +4408 +4744 +7665 +3565 +6676 +4983 +3282 +1095 +8269 + +6893 +4008 +2512 +5249 +6578 +2231 +7044 +7903 +3901 +2480 +1832 + +2278 +5805 +7783 +1497 +4503 +5569 +4260 +7618 +3310 +8083 + +8025 +17429 +14782 +12645 + +5914 +1865 +9622 +4014 +9577 +1812 +8287 +10720 + +3848 +12978 +12735 +3860 + +5562 +11339 +9051 +6703 +13290 +10611 + +1232 +1116 +2620 +2495 +4198 +4751 +6099 +3727 +3111 +2493 +3780 +2379 +3042 +4395 +6100 + +62606 + +13357 +13984 +11428 +18201 + +33875 +5610 + +2504 +19711 +17021 +5985 + +3759 +5522 +8815 +2113 +2333 +9169 +4805 +2870 +6419 + +6210 +4186 +3763 +5633 +5159 +5116 +4448 +4570 +5894 +4045 +1994 +3044 + +10366 +6706 +11448 +1927 +10647 +11786 +11927 + +1350 +10908 +9325 +2455 + +10527 +8300 +1312 +1403 +8155 +8803 +9663 +7780 + +2118 +5436 +5909 +4083 +3714 +3001 +2226 +2915 +5627 +6476 +3578 +6112 + +36649 +6648 + +17271 +23884 +15032 + +16967 +17931 +2443 + +2520 +1468 +2779 +6020 +4477 +4798 +1894 +2429 +4645 +5053 +6478 +5899 +5824 +2554 + +12614 +11252 +25055 + +3435 +1317 +5073 +3082 +4576 +5006 +2238 +3055 +4867 +5079 +4385 +5723 +2084 +4307 + +6609 +1556 +2351 +2301 +4913 +1820 +1122 +5398 +4738 +2377 +2843 +4704 + +1201 +1092 +1622 +6094 +1793 +6521 +8237 +2848 +5617 +6585 + +3561 +8072 +3941 +4432 +4740 +9292 +8115 +3586 +5464 + +2926 +6812 +5551 +3104 +4369 +7421 +3774 +1272 +1492 +1842 +6058 +1815 + +5555 +2688 +8859 +8517 +3338 +1500 +7276 +8130 +5984 + +6597 +5544 +4944 +6402 +1336 +4243 +4333 +6374 +6770 +5346 + +7225 +33323 + +17863 +9174 +21966 + +4835 +4359 +6074 +4069 +5984 +11934 +2577 + +1738 +2317 +6844 +1672 +4213 +3930 +4658 +5785 +8074 +5695 + +3063 +6287 +7248 +5656 +1571 +5468 +1512 +5555 +3192 +7892 +5664 + +5819 +28895 + +4407 +5072 +4733 +2964 +4073 +5739 +2423 +6131 +3999 +1454 +1221 +1243 + +26391 + +35896 +26888 + +1171 +4136 +1050 +5788 +1049 +5686 +5297 +6035 +2968 +2274 +2771 +5596 +4478 +3401 +5860 + +6699 +15009 +4368 +13135 +13609 + +6033 +3972 +1214 +1549 +3996 +2251 +3213 +5217 +5525 +3656 +2585 +2710 +6035 +1903 +1586 + +8651 + +4494 +7096 +7913 +1024 +1334 +1353 +2705 +5405 +1601 +7386 + +18756 +19801 +24646 + +8490 +5254 +1932 +3706 +1980 +6058 +1961 +3150 +5200 +1337 + +2846 +6123 +3274 +4632 +3068 +5384 +5842 +2688 +1307 +3279 +2424 +4783 +3932 + +2720 +7808 +5871 +1416 +7979 +6594 +7325 +4214 +5444 +2132 + +2626 +6949 +6034 +4887 +6773 +1111 +3317 +3388 +4209 +2809 +2730 +6578 +2700 + +8995 +10064 + +2134 +5564 +5889 +3719 +6357 +3523 +4600 +2138 +5976 +6025 +5689 +5950 +3745 +1542 + +5545 +5789 +4295 +6717 +8612 +3847 +7911 +3367 +6867 +5975 + +23119 +18834 +3134 + +7080 +2729 +4118 +1407 +7022 +4796 +8459 +8530 +7721 +7333 + +5245 +3739 +1338 +1245 +2926 +2695 +4571 +1492 +4794 +4380 +3726 +2225 +2098 +5942 +6081 + +2192 +2866 +4690 +4240 +6512 +1881 +5789 +1641 +6017 +4327 +3688 +6622 +3555 + +12879 +2468 +13146 +8534 +10525 +4590 + +8451 +8697 +11858 +5657 +4893 + +14019 +13301 +7206 +13988 + +17234 +22191 +13894 + +6383 +3682 +5281 +6335 +5412 +5474 +8723 +9536 +8864 + +14888 +9953 + +2464 +5875 +2484 +1693 +3441 +5883 +7835 + +34085 + +1997 +9058 +7144 +6222 +2930 +3661 +4107 +8058 +4938 + +3033 +2420 +5196 +5152 +1364 +2192 +3442 +1149 +3575 +6916 +6856 +1995 +6259 + +1331 +1731 +10757 +3486 +8823 +2450 +8018 +9197 + +64329 + +25450 + +6652 +4972 +5085 +1881 +5555 +1521 +3723 +1158 +3260 +1532 +3131 +2904 + +1088 +14166 +4490 +15880 +6439 + +19789 +5274 +7770 +11329 + +64877 + +4256 +5811 +3538 +8943 + +6164 +7843 +5400 +14856 +2882 + +2781 +3829 +8689 +6347 +8239 +4232 +8606 +5770 + +10061 +6576 +19346 +15720 + +9071 +6842 +5147 +8570 +4175 +3801 +6512 + +21045 +29371 + +5646 +1786 +11347 +11957 +4226 +12836 + +1786 +1117 +2905 +5545 +2759 +3168 +5993 +1050 +4096 +1812 +1036 +3048 +1602 + +5694 +4123 +4940 +8115 +8877 +2063 +7222 + +5281 +5676 +5429 +5198 +1480 +7224 +6453 +2535 +1894 +2730 +5489 +6674 + +6091 +3148 +4124 +5837 +1575 +4028 +5943 +2374 +3307 +4535 +2008 +2981 +1251 +1902 +1689 + +1154 +4931 +1030 +6793 +9190 +6920 +6588 +4759 +5502 + +23727 + +1716 +2529 +6082 +5333 +2555 +3710 +4174 +1747 +1506 +2434 +2343 +4019 +5704 +1253 +3978 + +13129 +11913 +9504 +11759 +5353 +9152 + +7685 +7469 +2376 +2221 +3446 +2576 +7992 +2538 +3572 +1715 +7268 + +15241 +4735 +10421 +9976 +1717 + +3460 +5386 +1806 +3764 +3019 +4349 +6319 +6635 +6608 +7641 + +3249 +2254 +4624 +2495 +3325 +1502 +2347 +1544 +2806 +2844 +5702 +3594 +3448 +4378 +5474 + +4447 +1251 +1088 +2070 +4109 +1029 +5779 +3795 +1080 +3589 +3016 +2793 +2636 +5946 +4953 + +52518 + +5836 +6177 +4873 +2860 +4545 +2793 +3492 +6810 +2330 +2067 +3626 + +14370 +14242 +8644 +16054 +7313 + +8547 +6827 +1264 +8991 +1306 +3829 +6188 + +1566 +6239 +4931 +5359 +7314 +7493 +2898 +4429 +5609 +3329 + +6747 +3945 +9283 +10312 +2925 +11240 + +9133 +14062 +15257 +12353 + +12534 +17806 +5580 +7262 + +4311 +3933 +3798 +4932 +3040 +1819 +4434 +5705 +1293 +4348 +4241 +3050 +4471 +4445 + +21451 +9368 + +5252 +6300 +3548 +7323 +2328 +2721 +5001 +1261 +7357 +1350 +7024 +5193 + +15832 +15934 +17497 +7846 + +1647 +6717 +1323 +5420 +5063 +2488 +3298 +1163 +1205 +3104 +3644 +4177 +2730 + +6851 +4735 +2851 +7015 +2836 +4052 +6511 +2413 +4049 +6620 +1205 +3131 + +8028 +6431 +8863 + +3411 +3434 +1509 +4907 +5244 +2022 +5347 +2648 +5479 +1668 +3461 +1380 +2991 +4789 +1003 + +3584 +3947 +2670 +2718 +7380 +1243 +2124 +2825 +5907 +7608 +4592 + +7236 +3836 +2137 +1824 +3283 +4702 +6791 +6370 +4781 +1647 +5176 +6373 + +2526 +5660 +5065 +1103 +5031 +1394 +1948 +2812 +1240 +4727 +5359 +3119 +2511 +2913 +2763 + +25820 +24769 + +2645 +1917 +5280 +1864 +5772 +2984 +1410 +3052 +3599 +2034 +4122 +3678 +1502 +1107 + +3385 +2149 +2758 +1895 +6232 +3858 +6266 +2861 +6624 +1078 +6721 +5652 + +6842 +4520 +4919 +6678 +3890 +1823 +6488 +2575 +5245 +3696 +4294 +6071 +5158 + +38153 + +4245 +4359 +6283 +3510 +2610 +2592 +4843 +2179 +1218 + +1895 +3676 +4307 +1886 +2495 +2143 +6751 +6498 +1546 +4454 +2203 +6640 +3713 + +6943 +2324 +3284 +2277 +1234 +2005 +1168 +3585 +1931 +4371 +5547 +1237 +6250 + +2722 +6827 +7366 +7001 +8320 +8560 +10331 + +7759 +11634 +4006 +9406 +12116 +1403 +10477 + +6213 +6458 +5178 +9407 +5651 +5743 +4120 + +9958 +18260 +9126 + +6239 +3466 +2939 +4775 +1326 +6307 +4255 +2843 +7634 +5993 +4585 + +6607 +8754 +9714 +9844 +12936 + +20048 +24368 +16320 + +6152 +1868 +2057 +6981 +6244 +6557 +2858 +4943 +2261 +7241 +6353 + +3362 +1989 +4154 +6154 +4409 +5546 +1202 +6484 +2812 +4690 +6080 +2564 +6001 +1379 + +4859 +7852 +4538 +1495 +6904 +7849 +4937 +2986 +8593 +4164 + +2338 +1139 +4118 +2916 +2087 +2180 +1476 +1669 +6375 +2689 +3890 +6928 + +2032 +2582 +3926 +2966 +4326 +1334 +4264 +1151 +1513 +3098 +2618 +4087 +5318 +5287 +4176 + +2012 +3358 +12673 +15745 +13638 + +18797 +6045 +12915 + +10036 +10932 +11869 +6686 +2505 +4998 +2545 + +9353 +24442 +15660 + +1563 +6832 +6212 +7249 +5815 +3135 +4260 +1632 +1105 +2628 +1693 +4728 + +5564 +3863 +2269 +1623 +3527 +2445 +4823 +2271 +1102 +2110 +3765 +1731 +4149 +2924 +3807 + +3049 +8544 +2753 +1454 +6543 +2379 +6571 +3467 +5347 + +4430 +6186 +8128 +6013 +8050 +6688 +5697 +5250 +3077 +4775 + +5639 +1567 +4651 +2362 +1676 +2033 +2843 +1577 +5838 +5545 +5803 +2561 +1774 +5371 +4177 + +2934 +4347 +5400 +1017 +1907 +5367 +3233 +3201 +6389 +3857 +1884 +2082 +5091 +1362 + +3574 +1873 +5995 +3908 +6154 +5350 +1856 +5219 +5865 +4628 +4904 +1988 +3336 +3602 + +17499 +8319 +8975 + +4570 +8463 +8389 +5896 +6657 +5300 +2953 +5541 +3791 +8065 + +2177 +7674 +10338 +6861 +7176 +12012 +5930 + +11051 +4024 +11264 +7017 +7432 +3699 +6920 + +5220 +3483 +7075 +5240 +2156 +2838 +7600 +7522 +3647 +3466 +1903 + +2400 +6060 +3414 +1852 +6822 +5793 +4895 +2960 +6642 +1477 +1240 +3047 +6426 + +11128 +22839 +20660 + +5889 +3600 +7076 +4431 +3604 +4256 +2548 +5482 +3501 +5278 + +3410 +3519 +9965 +12953 +9463 +6493 + +3949 +5992 +2986 +2886 +1598 +3393 +5766 +3427 +3750 +2125 +2819 +2818 +3033 +5536 +4458 + +9958 +8583 +3283 +6782 +10683 +3178 +4486 + +7674 +1680 +2315 +7486 +3096 +4386 +1553 +3675 +4100 +7705 +3479 + +6402 +3133 +3192 +3227 +2933 +6881 +3088 +8628 +2271 + +3697 +4072 +4962 +6101 +4711 +2184 +5168 +3172 +1076 +4206 +4876 +6040 +1844 +2792 +2138 + +5141 +6671 +7291 +8327 +9200 +1479 +2338 +9402 +4860 + +12944 +3176 +1343 + +8561 +4339 +4569 +5435 +4568 +10420 +6843 + +2642 +11252 +3981 +7926 +9800 + +6046 +3747 +3534 +5597 +1487 +2726 +3469 +4202 +5847 +3297 +6666 +3832 + +10609 +2492 +1269 +2012 +5583 +7277 +4471 +9874 + +4697 +3030 +3002 +6541 +1895 +1254 +2032 +6218 +2624 +4494 +3822 + +1077 +5664 +2566 +2028 +6227 +5342 +6013 +5994 +6331 +5290 +4154 +1985 +3748 +3666 + +5745 +1780 +6074 +5641 +2102 +5400 +2585 +6776 +1732 +6493 +4095 +2228 +4647 + +5283 +6675 +6784 +1759 +6256 +5952 +2476 +4176 +3949 +3097 +5127 +6465 +2571 + +4670 +5896 +3916 +8881 +6058 +10440 +9862 +10596 + +10471 +7667 +2665 +10829 +6934 +2179 +5155 + +3258 +4634 +6263 +2398 +6452 +1536 +3066 +2195 +3431 +1245 +2672 +2692 +1056 +3313 + +7418 +1070 +2436 +5831 +4648 +3358 +2808 +4966 +5358 +3868 +2124 + +4779 +5703 +3827 +4386 +6424 +4582 +4501 +2325 +1586 +1450 +5306 +6237 +1210 + +4882 +4275 +1094 +3855 +5611 +5650 +2271 +1769 +5764 +5895 +2891 +2344 +5228 +6017 +4763 + +20686 +14164 +24547 + +26116 +2047 + +64931 + +11106 +11298 +3236 +2998 +3995 +10523 + +1230 +3999 +2775 +2882 +4474 +2490 +5185 +3853 +6045 +1786 +3372 +3548 +2217 +1424 + +4424 +2982 +3616 +1397 +4217 +3084 +2641 +2703 +1247 +1131 +3372 +1664 +1351 +2609 +4200 + +10258 +1295 +10597 +5712 +8643 +7976 +5578 +2924 + +1514 +8050 +4828 +8746 +5551 +8739 +1382 +8218 +6875 +6039 + +45328 + +18784 +21739 + +2884 +7165 +8039 +3978 +6701 +2646 +6171 +3899 +2700 + +6461 +4227 +7052 +1458 +6367 +4403 +2232 +7085 + +3490 +4126 +6334 +2320 +4354 +5981 +4319 +2031 +1629 + +5536 +3182 +6285 +1561 +1215 +2367 +5133 +2720 +3062 +6456 +6160 +3248 +5430 +3354 + +2124 +7143 +6779 +2022 +2034 +9093 +4122 +1303 +5054 diff --git a/2022/02/a.py b/2022/02/a.py new file mode 100644 index 0000000..1338bbf --- /dev/null +++ b/2022/02/a.py @@ -0,0 +1,43 @@ +points = 0 +p = {"lost": 0, "draw": 3, "won": 6} +p2 = {"X": 1, "Y": 2, "Z": 3} + +sym = {"X": "A", "Y": "B", "Z": "C"} +sym2 = {"A": "X", "B": "Y", "C": "Z"} + +wins = {"C": "X", "A": "Y", "B": "Z"} +wins2 = {"A": "Z", "B": "X", "C": "Y"} + +trans = {"me": {"X": "R", "Y": "P", "Z": "S"}, + "enem": {"A": "R", "B": "P", "C": "S"} + } + +with open("input") as f: + lines = f.readlines() + + +for line in lines: + enem, me = line.split(" ") + enem = enem.strip() + me = me.strip() + print(enem, me) + if me == "X": + me = wins2[enem] + elif me == "Y": + me = sym2[enem] + elif me == "Z": + me = wins[enem] + if (sym[me] == enem): + points = points + p["draw"] + p2[me] + elif (me == "X" and enem == "C"): + points = points + p["won"] + p2[me] + elif (me == "Y" and enem == "A"): + points = points + p["won"] + p2[me] + elif (me == "Z" and enem == "B"): + points = points + p["won"] + p2[me] + else: + points += p2[me] + print(enem, me) + print(points) + print() +print(points) diff --git a/2022/02/exmaple b/2022/02/exmaple new file mode 100644 index 0000000..db60e36 --- /dev/null +++ b/2022/02/exmaple @@ -0,0 +1,3 @@ +A Y +B X +C Z diff --git a/2022/02/input b/2022/02/input new file mode 100644 index 0000000..5525ccf --- /dev/null +++ b/2022/02/input @@ -0,0 +1,2500 @@ +B Y +A Z +C Z +A Y +A Y +B Y +C Y +A Y +B Y +B Y +A Y +B Z +B Y +A Y +C Y +B X +B Y +B Y +B Y +C Y +B Y +A Y +B Y +A Y +B Y +C Y +A Y +B X +B Y +B Y +B X +B Y +C Y +B Y +C Z +A X +B Y +B Y +A Z +B X +C Y +C Z +B Y +B Y +A Y +B X +B Y +B Y +B X +B Y +C Y +A Y +B Y +C Y +C X +B X +B X +A Z +C Y +B Y +C Z +B X +B Y +B Y +B X +B Y +B Z +B Y +B Y +B X +B Y +B X +C X +B Y +B X +A Y +B Y +B X +B Y +A Y +B X +B X +B Y +A Y +B Y +B Y +B Y +C Z +B X +B Y +B X +B X +B Y +B X +C Z +B Y +B Y +B Y +B Y +B Y +B X +A Y +B Y +C Y +C Z +A Y +B Y +A Y +C Z +B Y +B X +B Y +C X +A Y +B X +B Y +B X +B X +B X +A Y +C Z +B Y +A Y +B X +A Y +B Y +A Y +B X +B Y +B Y +B Y +B X +B X +C Z +B Z +B Y +B X +C Y +C Y +C Z +C X +C Y +B Y +B X +A Y +A Y +B X +C Z +B X +C X +B X +B Y +B Y +A Z +B Z +C Y +C Y +B Y +B Y +C Y +C Y +C Z +B Y +B X +B Y +B Y +C Y +B Y +B Y +B Y +B Y +B Y +C Y +A Z +B X +B Y +C Z +B Y +C Y +B Y +B X +C Y +B Y +B X +C Y +B Y +B Y +B Y +A Y +B X +B X +B Y +B Y +B X +C Z +B Y +A Y +A Y +B X +C X +A Y +B X +B X +B Y +B Y +A Y +C Y +C Z +C Y +B Y +B Y +A Y +A Y +A Y +B Y +B Y +A X +B Y +B Y +B X +B X +C Z +B X +B X +A Y +A Y +A Y +B Y +B Y +C Y +B X +A Y +B Y +C Z +B X +A Y +C Z +A Y +B X +C Y +B Y +B Y +C Y +B X +B X +B Y +B Y +B Y +B Y +A Y +B X +B X +B Y +A Y +B Z +A Y +B Y +C Y +B Y +B Y +B X +C Z +B Y +B Y +B X +B X +C Z +B Y +A Y +B Y +B X +C Y +A Z +C Z +B Y +B Y +B X +C Y +C X +B X +C Y +C Z +B X +B Y +B Y +C Z +B X +C X +A Z +A Y +B X +C X +B Y +A Z +A Z +A Y +B X +A Y +B Y +B Y +C Z +B X +A Z +B Y +B X +A Y +B Y +C Y +B Y +B X +B X +A Z +B Y +B Y +C Z +B X +B X +B Y +C Z +B X +B X +C Z +B X +A Y +B X +C Z +A Y +C X +B Y +B X +B Y +B Y +C Y +B X +A Z +A Y +B X +A Z +B X +B Y +B Y +A Z +C X +B Y +B Y +B Y +A Z +B Y +B X +C Y +C Z +B X +B Y +B Y +B Y +C Y +A Z +B Y +C Z +C X +B Y +C Y +B Y +B X +B Y +B Y +A Y +B Y +B Y +C Z +A Z +B X +C Y +B Y +B Y +B Y +A Y +A Y +B Y +A Y +B Y +A Y +B X +C Y +B Y +C X +A X +B X +A Y +C Y +B Y +A X +B X +A Z +B X +B Y +B Y +B X +B Y +B Y +B X +A Y +A Z +C Z +B Y +B Y +B X +C Z +C Z +B Y +A Y +B X +C Z +A Y +B X +B Z +B Y +B Y +B Y +B X +B Y +B X +B X +B Y +C Y +B Y +B Y +B Y +B Y +B Y +C Z +B X +B Y +B Y +B Y +B X +B X +C Y +B X +B X +C Z +B Y +B Y +B Y +B Y +B Y +C Y +B Y +B Y +B Y +B X +B Y +B X +B Y +B Y +C X +B Y +C X +B X +C Z +C X +B Y +A Y +A Z +A Y +C Y +B X +B Y +B Y +C Z +A Z +B Y +B Y +B Y +B Y +B Y +B Y +B Y +C Y +B Y +C Y +C X +B X +B X +C Z +A X +B X +B Y +A Y +B X +B Y +A Z +B Y +C Y +B X +B Y +B Y +C Y +C Y +B Y +B X +B X +B Y +B Y +B Y +B Y +C Z +B X +B Y +B Y +B X +B Y +B X +B X +B Y +B X +B Y +B Y +C Y +B X +B Y +B Y +B Y +A Y +B Y +A Z +B Y +C Y +C Y +B Y +B X +A X +B Y +A Y +B X +B Y +B Y +B X +C Y +C Z +B X +B Y +A Y +C Y +A Z +C Y +B Y +B Y +B Y +B X +C Y +B Y +B Y +A Y +A X +B Y +B X +B Y +B Y +A Y +B X +C X +B Y +A Y +C Y +B Y +B Y +A Y +C Y +A Y +C Y +B Y +B X +C Y +C Y +B Y +B Y +A Y +B Y +B Y +B Y +C Z +B X +B Y +B X +B X +A X +A Y +B Y +B X +A Z +B X +A Y +B Y +C Y +C Y +C Y +B Y +A Y +A Y +B Y +B Y +B Z +B Y +B X +A Y +B X +A Z +B Y +B Y +B X +B Y +C Y +A Z +B Y +C X +C Y +B Y +B Y +C X +B Y +A Y +A Y +C Z +B X +B X +B X +B X +B Y +C Z +B X +C Y +A Y +B Y +A Y +B Y +A Y +B Y +B Y +C Y +B Y +B Y +B X +B Y +B X +B Y +B X +B Y +A Z +C X +B X +C X +B X +A Y +C Y +B X +C Y +B X +B X +C Z +C Y +B X +B X +B X +B Y +C Y +B X +B X +A Z +B Y +B Y +C Y +B X +C Z +C Y +A Y +B X +C Y +C X +B Y +B Y +A X +B Y +B X +B Y +B X +C Y +B X +A Y +B Y +B X +B Y +B Y +B Y +C Y +C Y +C Y +C Y +B X +B Y +A Z +B X +B X +B Y +B Y +C Z +B Y +B X +B Y +B X +C Y +B Y +C Z +A X +B X +B Y +C Y +C X +B X +B X +B Y +B Y +B Y +B X +B Y +B Y +B X +C Z +B Y +B Y +B X +B X +B Y +B X +C Z +A Z +C X +C X +B Y +B X +A Y +B Y +B X +C Z +A X +B X +B Y +B X +B X +B Y +B Y +A Z +B X +A Y +A Y +B Y +B X +B Y +C Y +A Y +A Y +B X +B Z +C Y +C Y +B Y +C X +B X +C Z +C Z +B Y +C X +A Y +B Y +B X +A Y +B Y +C X +B Y +B X +B Y +C Z +A X +A Z +B Y +B Y +B X +B X +A Y +B Y +B X +B Y +C Y +B Y +B X +C Z +C X +C Y +A Y +B Y +A Y +B Y +B Y +B X +B X +A Y +A Y +B Y +B Y +B Y +A Y +B Y +B Y +B Y +C Z +A Z +C Y +B Y +B X +C Y +A Z +B X +B Y +A Z +C Y +B Y +B X +B Y +B Y +A Y +B X +B Z +B X +B X +B X +B X +B Y +B Y +B X +B Y +C Y +C X +C Z +B Y +B Y +C Y +A Y +B X +B X +B Y +B X +B Y +B Y +A Y +B Y +B Y +B Y +B Y +A Y +B X +C Z +B Y +B Y +B Y +B X +B Y +C Y +B X +B X +A Y +A X +A Y +C X +C Y +B Y +B Y +C Y +B X +B Y +B Y +C Y +B X +C X +B X +C Y +B Y +B X +B X +B Y +C X +B X +B Y +B X +B X +B Y +B X +B Y +B Y +B Y +C Y +B Y +B Y +C Z +B Y +B X +C Y +B Y +B Y +B X +B Y +A Y +B Y +A Y +B Y +B Y +A Z +B X +B Y +B Y +C Z +B X +B X +B Y +B Y +B Y +B X +C Y +C Y +B X +B Z +A X +B Z +C Y +B X +B X +A X +B Y +B X +C Z +C Y +B X +B Y +B Y +B Y +C Z +B Y +C Y +C Y +A Y +B X +B Y +B Y +B Y +A X +B Y +B Y +B X +B X +A Y +B X +B Y +A Z +B Y +C Z +B X +B Y +B Y +A Y +A Y +B Y +B Y +B Y +B Y +C Y +C Z +B X +B X +B Y +B Y +B X +B X +A X +A Y +B Y +B Y +B X +B Y +A Y +B Z +B X +C Z +B Y +B X +B X +B Y +B Y +B Y +C Y +C X +B X +C Z +B Z +B X +B X +C Z +C Y +B X +A Z +C Y +A Y +B X +B Y +C Z +B Y +B Y +B X +B Y +C Z +B Y +A Y +B X +B X +B X +C Y +B X +B Y +B X +B Y +B Y +A X +C Y +A Y +C Y +B X +B Y +B X +B X +B Y +B Y +B Y +B Y +B Y +B Z +B Y +A X +C Z +B X +A Y +C Z +B Y +C X +A Y +C Y +C X +B Y +B X +B X +C Z +C Y +A Z +C Y +A Y +B Z +A Y +B X +C X +A Z +C X +B Y +C X +B Y +A Y +A X +B X +B Y +B X +B X +B X +A Y +B Y +B X +B Y +A X +B Y +C X +B Y +B X +B Y +A Y +B X +B Y +B X +B Y +B X +B Y +B Y +A Z +A X +B Y +C Z +B Y +B Y +B Y +B Y +C Y +B Y +A Y +A Y +C Z +C Y +B Y +A Y +B Y +B X +A Y +C Y +B Y +B Y +A Y +B Y +A X +C X +B Y +B Y +C X +B Y +B X +A X +B Y +B Y +B Y +B X +B X +A Z +B Y +A X +B X +A Z +B X +C Z +B Y +B Y +B Y +B X +B Y +B Y +C Y +B Y +B X +A Y +C Z +B Y +B X +A Y +C Y +B X +B Y +B Y +C Z +A Y +B X +B Y +B X +B X +C X +B Z +C Y +B Y +B Y +B X +B Y +C Y +C Y +C Y +B Y +A Y +C Z +B Y +C X +C Y +B Y +B Y +A Z +B X +A Y +A Y +A Z +B X +A Y +C Z +B Y +B Y +A X +B X +B Y +C Z +B Y +B Y +B X +B Y +B X +B X +A X +C Y +C Y +C Y +B Y +B Y +C Z +B Y +B X +C X +B Y +C Z +B X +B Y +B Y +B Y +B X +B Y +B X +B X +B Y +B Y +B Y +B Y +B X +B Y +B Y +C Z +B X +B Y +C Y +B X +B Z +B Y +C Z +C Y +B Y +A Z +A Y +B X +B Y +C Y +A X +A Y +B X +B Y +C Z +B Y +C X +A Y +C Y +B Y +B X +B Y +B Y +B Y +B X +B Y +C X +A Z +B X +C Y +A Y +B X +B Y +B X +B Y +C X +A Y +A Y +C Z +B Y +C Y +B Y +B Y +B Y +B Y +B Y +C Y +A Y +B Y +B X +C Y +B Y +B Y +A Z +B Y +B Y +B X +B Y +B Y +B X +A Y +A Z +B X +B X +C Y +B Y +B X +C Y +B Y +A X +B X +B Y +A Z +B Y +B Y +B Y +B Y +B X +A X +B X +C Y +B Y +B Y +B X +C Y +B Y +B X +B Y +B X +A X +B Y +A Y +B X +C X +B Y +C Z +B Y +B Y +C Y +B Y +C X +B Y +B X +A Z +B Y +B X +B Y +A Y +B Y +B X +B X +B X +B Y +B Y +B Y +A Y +C X +B X +B X +C Z +B Y +A Y +A Z +A Y +B Y +B Y +B X +C X +C Y +C Z +B Y +B Y +B Y +B Y +B Y +B X +C Y +B Y +B Y +B X +B X +B Y +B Y +A Y +A Y +A Y +B X +B X +C Y +B Y +A Z +B X +C Y +B Y +B X +B Y +B Y +A Y +A Y +B Y +B Y +B X +B X +A Y +A X +A Z +C X +A Z +B X +B Y +C Y +A X +B X +C Z +B Y +C Y +A Y +C X +B Y +C X +A Y +B Y +B X +B Y +A X +B X +B X +B Y +B Y +B Y +B X +B Y +B X +B Y +A X +B Y +B X +B Y +B Y +B Y +B X +B X +A Y +B Y +A Z +B Y +B X +C Z +B X +B Y +B Y +B Y +B X +C Y +B Y +B Y +A Y +B X +B X +B Y +B Y +A Y +B Y +B X +B Y +B X +B Y +C X +C Y +B X +B X +B X +C Z +B Y +B Y +B X +B X +B Y +A Y +B Y +C X +A Y +B Y +B Y +C X +B X +A Y +C X +B Y +B X +C Z +B X +B Y +A Y +B Y +B X +C Y +A Y +B Y +A X +B Y +C Y +C X +B Y +B X +A Z +B Y +B Y +B X +B Y +B Y +B X +B Y +C Y +B X +B Y +B X +B X +C Y +B X +B X +A Y +B X +B Y +B Y +B Y +B Y +B Y +B Y +B Y +C X +B X +B X +A Y +B Y +A Y +B X +B Y +A Y +B Y +A Z +B X +A Y +C Z +A Y +A Z +B X +B Y +A Y +B X +B X +B Y +B Y +A Z +A Y +B X +C Y +B Y +B Z +C X +C X +B X +A Y +B X +B Y +B Y +A X +B Y +A X +B Y +A Y +B X +B X +A Z +A Y +A Y +C Z +B Y +B Y +C Z +B Y +B X +C Y +B Y +B X +A Y +B Y +B X +C X +C X +B Y +A Y +B Y +B Y +B Y +B X +A Y +B Y +B Y +A Y +B Y +B X +B X +C Y +C X +B Y +C X +B Y +C Y +B X +B Y +B X +B Y +B Y +B X +B Y +B Y +C Y +B X +B Y +B X +B Y +A Y +B X +A Y +B X +B Y +B X +C X +C Y +B Y +B X +B Y +B Y +B X +B Y +B Y +A Y +B Y +B X +B Y +B X +C Y +A Y +B Y +B X +B Z +B Y +B X +C Y +B Y +C Y +C Y +B X +C Z +B X +C Y +B Y +A Y +B Y +A X +B Y +B Y +B Y +B Y +A Z +B Y +B Y +A Y +C Y +B Y +B X +B Y +B X +B Y +B Z +B X +B X +B Y +B Y +B Y +B X +B Y +B X +B Y +B Y +A Y +C Z +B Y +B Y +B X +B X +B X +B Y +A Y +A Y +B X +B Y +B X +A X +B Y +B Y +C Y +A Y +C Z +A Z +A Y +B Y +B Y +B Y +B Y +B Y +C X +B Y +A Y +C X +C Y +B X +A Z +C Z +A Z +C Y +B X +B Y +B Y +B X +B Y +A Z +C Z +C X +B X +B Z +A Y +C Y +C Y +C Y +A Y +C X +B X +C Y +C Y +B Y +B Y +A Y +B Y +A Y +A Y +B X +B X +C Y +B Y +C Y +B Y +B Z +B Y +A Y +B X +B Y +A X +B X +B Y +B Y +C Y +B Y +C Z +B Z +A Y +A Y +A Y +B Y +B X +B Y +A Y +C X +B X +B Y +B X +C X +B Y +B X +B Y +B Y +B X +A Y +A Y +B Y +B Y +B Y +A Z +B Y +B Y +B Y +B Y +B Y +B X +B Y +B Y +B Y +B Y +B Y +B X +B X +B X +A X +C Y +C X +C Z +C Y +B X +B Y +A Z +B Y +C Y +B Y +B X +B Y +A Y +B X +B X +B X +C Y +B Y +B Y +B Y +B X +B Y +B Y +B Y +B Y +B Y +B Y +C X +B Y +A X +B X +C Z +B X +B Y +B X +B Y +C Y +B Y +B Y +B X +A Z +B Y +A X +B Y +C Z +C Y +B Y +B Y +B Y +C X +B Y +B Y +B X +A Y +C Z +B Y +B X +B Y +B Y +B Y +B X +B Y +B Y +B Y +C X +B X +B X +C Z +B Y +B Y +B X +A Z +B Y +B Y +C Y +C Y +A Y +C Y +A Y +B Y +B X +B Y +B X +C Y +B Y +B Y +B Y +B Y +B Y +C X +B X +B X +B Y +C X +C Z +B X +A Y +C Z +B X +B X +C Y +C Y +A Y +B Y +B X +B Y +B Y +A Z +A Z +B Y +B Y +B Y +B Y +B Y +B Y +B Y +B X +B Y +C Y +B Y +B X +A X +B Y +A Y +A Y +B Y +B Y +B X +B Y +B Y +C Y +A Y +B X +B X +B X +B Y +B Y +B Y +B Y +B X +B X +A Y +B X +B X +B X +B X +B Y +B X +A X +C Y +B Y +B Y +A Y +B Y +B X +C X +C Y +A Y +B Y +A Z +C Y +B Y +B Y +B Y +B X +B X +B Y +C X +B X +B Y +C X +B X +A Y +B Y +B X +B Y +B Y +B X +B Y +B Y +C Y +B X +B X +B X +A Y +B Y +B X +C Y +C Y +B X +A Y +B Y +C Y +B X +B Y +B X +B X +B Y +C Y +A Y +C Y +B X +C X +B Y +B X +A Y +C Y +B Y +B Y +B Y +C Z +C Y +A Z +A Y +B Y +B Y +B Y +B Y +A Y +B X +B Y +B Y +C Y +C X +B Y +B Y +B Y +B Y +B X +B X +B X +C Z +B Y +B Y +C Y +B X +B Y +B Y +A Z +B Y +C Z +B X +A Y +B X +B Y +A Y +A Z +A Z +B Z +B Y +B Y +A Y +C Z +B Y +C Z +B X +B Y +B Y +B Y +B Y +C Y +B X +B X +B X +B X +B X +B Y +A Z +A Y +B Y +B Y +B Y +C X +B Y +A Y +B Y +B Y +B X +B Y +C Y +A Z +A Y +C Y +C Z +B X +A Z +B X +B X +B Z +B Y +C Y +A Y +B Y +B Y +B X +C Z +B Y +B Y +A Z +A X +B Y +B X +B Y +B X +B X +B X +B X +A Y +B Y +A X +B X +B X +B Y +B X +B Y +B Y +A Y +B Y +C Y +A Z +A Y +B X +B Y +A Y +C X +B Y +C Y +B X +B Y +A Y +B Y +A Z +B Y +B Y +A Y +B X +C Y +B Y +B Y +C Z +B X +B Z +B Y +A Y +B Y +C X +B Y +B Y +B Y +B Y +B Y +C Z +C Z +B Y +C Y +C Z +A X +B Y +A Y +B X +B X +B Z +B X +A Y +B Y +B Y +B Y +A Z +C Y +B Y +B Y +C Y +C Z +C X +B Y +A X +B Y +A Y +C X +B Y +B Y +B Y +B Z +B X +B X +C Y +B X +B X +C Z +B Y +B X +B X +B Y +B Y +B X +C X +B Y +B Y +B X +A Y +B Y +C Y +B Y +A X +B Y +A Y +A Y +B Y +B X +B X +C X +B Y +B X +A Y +C X +A Y +B X +B Y +B Y +C Z +B X +B Y +B X +B Y +B Y +A Z +B Z +B Y +B Y +C Y +C X +C Y +C Y +B Y +B Y +B Y +C Y +A Z +A Z +B Y +B X +A Y +B X +B Y +A Y +B X +B Y +B X +C X +B Y +B Y +B X +B X +A Z +A Y +B Y +A Y +B Y +B X +B X +A Y +B X +B Y +B Y +B X +C X +C X +B Y +B Y +A Y +B X +B Y +B Y +B Y +B Y +C Y +B Y +C Z +B Y +B Y +C X +B X +B Y +B Y +B X +B X +B Y +B Y +B Y +B X +A Z +B Y +B X +C Z +B X +B Y +A Z +C Z +A Z +B X +B Y +B Y +B Y +B X +B Y +C Y +C X +C Y +A X +B Y +B Z +B Y +B Y +B Y +A Y +B X +B Y +C Y +B Y +B X +B X +B Y +B Y +B Y +C Z +B Y +B X +B Z +B X +B Y +B Y +B X +B X +A Y +B X +B X +B X +A Y +B X +B X +B Y +B X +A X +B Y +B Y +C Y +B X +B Y +B X +B X +C Y +B Y +B Y +B X +A X +C Y +C X +A Y +B X +B Y +B Y +B Y +B Y +B X +B Y +B Y +B Y +B Y +C Y +C Z +B Y +C X +B X +B Y +A Z +C X +B X +B Y +B Y +B X +B Y +B Y +B Y +B Y +B Y +B Y +B Y +C Y +B Y +C Y +B X +A Z +B Y +B X +A Y +B Y +B X +A Y +B X +B X +B X +B Y +B Y +B X +B Y +A Z +B Y +B Y +B Y +B Y +B Y +B Y +B Y +B Y +B X +B Y +B Y +A Y +B Y +B X +B X +C Y +C X +B Y +A Y +C Z +B X +B X +B Y +C Y +A Y +B Y +B Y +B X +B Y +B X +C Y +C Y +B Y +B X +B X +B Y +C Y +B Y +C Y +B Y +B Y +C Y +A Y +B Y +A Z +C X +B Y +B Y +B X +B X +C Z +B Y +B Y +B Y +B X +B X +A X +B X +B Z +B Y +B X +B X +B Y +B X +B X +B Y +B Y +B Y +B Y +A Y +B Y +B X +B Z +B Y +A X +A X +A Y +B Y +B Y +C Y +A Y +C Y +B Y +B X +B Y +B Y +B X +B Y +A Y +B Y +B Y +B X +B Y +A Y +B X +B Y diff --git a/2022/03/example b/2022/03/example new file mode 100644 index 0000000..f17e726 --- /dev/null +++ b/2022/03/example @@ -0,0 +1,6 @@ +vJrwpWtwJgWrhcsFMMfFFhFp +jqHRNqRjqzjGDLGLrsFMfFZSrLrFZsSL +PmmdzqPrVvPwwTWBwg +wMqvLMZHhHMvwLHjbvcjnnSBnvTQFn +ttgJtRGJQctTZtZT +CrZsJsPPZsGzwwsLwLmpwMDw diff --git a/2022/03/input b/2022/03/input new file mode 100644 index 0000000..fca63f0 --- /dev/null +++ b/2022/03/input @@ -0,0 +1,300 @@ +qFdBBvtHHfvRlfvsqldvqjPpQmnQmjnjjjTRTLGRNG +ZCWhhCsJCzSJzSbzgsmPTGNNPPNGjgLTLjgn +WJZsbJMwJcszJcScwhVltFwBFBlqddvFdHDfqq +crtTsGTtqFThGQGCrsjTwdNJwpRdnJJwffRClpSf +PWVBPVHLvHHVgvZWBzmPpnfRSJJRQnSRflRPSNSl +gmzBzDgzmZQWLDLLgVmDrqGhsscrqDMGhcqtqcFr +HsbcdVrsbVbcLfPqqQsqqtPj +mMBFzZRnmFMRBDnDFBGZDGdDqLjtdQtPtgfPfttgtqgq +BZvZZdJMBFdJhSvhbhchcHll +GNRSqRfcNTpfGCcqjfzBpDQPWBzgDpQsPWzW +rrSdnVHlbMdLd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HHNpsNcNVdVlhCMlHQQMQQzLfzQPttFGPMLSLgtF diff --git a/2022/03/rucksack.py b/2022/03/rucksack.py new file mode 100644 index 0000000..30efa92 --- /dev/null +++ b/2022/03/rucksack.py @@ -0,0 +1,30 @@ +def priority(c): + if (ord(c) >= ord("a")): + return ord(c) - ord("a") + 1 + else: + return ord(c) - ord("A") + 27 +def same(x, y): + a = set() + for x1 in x: + if x1 in y: + a.add(x1) + return list(a) +def inlists(x, y): + isin = [] + for x1 in x: + if all([x1 in y1 for y1 in y]): + isin.append(x1) + if len(isin) > 0: + return isin[0] + return None + +with open("input") as f: + compartments = [line.strip() for line in f.readlines()] +points = 0 +for i in range(0, len(compartments), 3): + group = compartments[i:i+3] + if len(group) == 3: + c = inlists(group[0], group[1:]) + if c is not None: + points += priority(c) +print(points) diff --git a/2022/04/a.py b/2022/04/a.py new file mode 100644 index 0000000..73baa96 --- /dev/null +++ b/2022/04/a.py @@ -0,0 +1,18 @@ +points = 0 + +def contains(ran1, ran2): + return ran1.start <= ran2.start and ran1.stop >= ran2.stop +def overlap(ran1, ran2): + return ran1.stop >= ran2.start and ran1.start <= ran2.stop + +#with open("example") as f: +with open("input") as f: + lines = f.readlines() +for line in lines: + r1, r2 = line.strip().split(",") + r11, r12 = list(map(int, r1.split("-"))) + r21, r22 = list(map(int, r2.split("-"))) + ran1, ran2 = range(r11, r12), range(r21, r22) + if overlap(ran1, ran2): + points += 1 +print(points) diff --git a/2022/04/b b/2022/04/b new file mode 100644 index 0000000..082251f --- /dev/null +++ b/2022/04/b @@ -0,0 +1,4 @@ +123456 + 456789 + 4567 +123456 diff --git a/2022/04/example b/2022/04/example new file mode 100644 index 0000000..9f9e9cf --- /dev/null +++ b/2022/04/example @@ -0,0 +1,6 @@ +2-4,6-8 +2-3,4-5 +5-7,7-9 +2-8,3-7 +6-6,4-6 +2-6,4-8 diff --git a/2022/04/input b/2022/04/input new file mode 100644 index 0000000..b916015 --- /dev/null +++ b/2022/04/input @@ -0,0 +1,1000 @@ +24-66,23-25 +3-3,2-80 +14-80,13-20 +39-78,40-40 +36-90,89-90 +51-94,50-50 +10-72,10-98 +54-81,2-90 +27-84,27-85 +21-57,21-57 +6-55,4-5 +80-87,87-90 +23-71,22-90 +24-37,2-36 +79-91,78-91 +75-92,91-93 +23-80,23-81 +67-94,68-94 +79-85,79-81 +40-88,39-89 +15-75,14-76 +18-77,34-78 +2-99,4-93 +1-74,15-75 +39-82,39-81 +19-91,18-84 +56-87,57-86 +15-72,14-71 +37-88,36-87 +21-24,18-23 +34-83,34-34 +20-95,94-95 +27-75,26-80 +91-93,27-92 +55-66,56-62 +29-31,30-89 +85-95,89-99 +1-2,1-3 +63-64,13-64 +66-95,30-86 +2-73,3-74 +25-99,6-25 +10-28,28-87 +10-42,9-43 +12-46,46-75 +91-97,91-96 +46-59,46-59 +34-35,5-34 +27-93,93-93 +4-12,21-97 +7-65,5-8 +42-63,2-62 +70-76,64-75 +1-95,1-94 +12-30,13-30 +3-99,2-99 +46-60,58-60 +1-94,93-98 +7-98,8-98 +7-51,8-81 +39-84,40-85 +43-84,8-84 +10-93,11-93 +3-63,2-47 +18-87,18-18 +77-96,95-97 +2-99,1-99 +3-45,2-45 +19-99,8-97 +7-98,8-60 +3-94,2-2 +51-71,21-51 +28-98,10-27 +13-96,13-97 +4-99,1-1 +3-93,93-97 +13-13,14-98 +16-38,17-17 +16-46,16-46 +7-63,4-8 +18-85,13-19 +17-21,18-21 +7-74,8-73 +5-77,4-6 +11-18,1-18 +3-25,4-4 +2-96,2-93 +19-38,18-39 +11-45,10-10 +20-20,21-83 +2-97,97-97 +81-81,2-80 +5-82,58-59 +47-51,4-47 +89-93,40-89 +19-29,18-84 +18-36,16-18 +41-55,47-47 +6-34,7-33 +5-82,6-81 +6-19,18-27 +42-55,43-55 +1-99,2-71 +45-94,45-45 +2-88,1-88 +15-35,14-36 +17-36,10-25 +20-96,84-98 +81-87,81-81 +85-87,85-86 +34-74,73-74 +17-97,16-98 +11-50,12-51 +2-99,3-3 +79-90,79-91 +89-99,1-89 +87-93,72-93 +31-52,30-96 +75-84,45-83 +81-96,81-96 +84-85,24-85 +36-60,35-36 +11-91,10-91 +18-19,19-62 +50-52,50-54 +59-86,52-86 +61-65,70-70 +28-96,58-99 +10-46,46-46 +10-10,10-25 +17-72,18-18 +58-77,34-59 +3-5,5-34 +14-14,14-83 +5-88,6-14 +2-70,3-69 +42-79,48-80 +26-48,26-27 +15-84,14-85 +82-83,33-76 +14-34,5-33 +27-76,26-26 +3-88,2-2 +19-58,20-57 +26-79,25-89 +94-95,13-94 +35-77,35-78 +63-99,69-99 +18-26,27-99 +1-76,76-77 +37-44,22-44 +3-64,3-89 +54-86,55-85 +92-92,92-95 +26-38,26-38 +62-81,19-80 +20-63,8-65 +46-79,46-80 +35-71,70-72 +12-81,11-11 +34-69,18-77 +1-84,2-2 +19-24,18-21 +8-90,89-91 +12-64,64-65 +18-97,17-19 +93-93,5-93 +34-46,34-46 +14-82,13-81 +32-46,46-47 +1-8,9-97 +3-4,3-54 +85-87,69-86 +12-90,12-91 +7-11,10-33 +19-34,18-24 +36-63,26-62 +4-98,6-98 +80-96,80-81 +10-11,10-34 +21-69,8-70 +6-80,5-81 +14-92,3-15 +23-40,16-39 +8-66,20-66 +12-79,12-13 +14-61,15-52 +10-29,10-29 +36-37,36-89 +46-48,18-47 +24-98,23-25 +81-96,13-81 +6-88,1-89 +58-76,57-75 +56-76,57-75 +1-84,1-1 +1-20,2-20 +38-98,38-99 +33-73,32-73 +41-95,40-94 +29-44,28-44 +68-86,67-69 +1-66,1-2 +12-28,13-90 +28-74,19-29 +48-51,51-65 +11-64,11-64 +74-74,66-74 +2-5,5-87 +69-69,4-69 +21-51,51-56 +51-83,13-83 +12-99,5-6 +3-91,4-90 +3-55,8-36 +12-44,36-45 +6-86,5-87 +9-18,8-16 +13-63,14-57 +3-96,4-95 +41-87,42-86 +44-62,22-48 +17-62,46-63 +62-63,63-64 +31-59,30-60 +10-78,9-79 +41-97,20-96 +18-92,18-92 +30-30,30-90 +6-80,4-79 +46-98,13-36 +7-70,7-7 +35-46,25-46 +77-77,76-76 +8-10,9-78 +4-98,5-36 +37-96,41-96 +35-68,34-88 +22-69,40-70 +13-90,12-89 +11-39,12-56 +51-82,50-81 +47-96,46-73 +95-96,2-91 +66-95,56-77 +84-84,83-85 +7-58,8-87 +6-83,5-83 +23-49,14-48 +4-97,5-96 +17-18,17-46 +15-76,93-99 +63-64,63-67 +45-46,29-45 +29-84,13-84 +95-95,95-98 +19-91,11-37 +14-19,19-94 +24-93,75-91 +52-79,78-80 +3-94,4-93 +2-99,2-3 +40-96,38-95 +23-91,23-91 +88-89,66-88 +14-92,91-92 +14-94,6-94 +21-57,36-84 +15-97,99-99 +2-98,1-99 +38-80,38-80 +12-93,29-98 +19-34,20-42 +11-70,10-71 +44-95,45-95 +53-69,54-68 +33-68,10-34 +33-35,33-34 +3-5,4-66 +57-82,56-56 +36-54,36-53 +14-15,10-15 +24-51,38-52 +16-76,72-76 +56-57,3-57 +6-89,5-90 +12-45,13-70 +36-38,37-88 +19-31,25-31 +2-2,8-96 +5-92,4-69 +9-98,8-8 +5-14,5-14 +46-99,9-46 +55-56,2-55 +7-95,7-94 +45-65,41-65 +80-81,4-80 +6-47,48-86 +25-34,35-75 +72-74,71-71 +2-94,1-3 +31-49,32-49 +20-61,19-35 +11-86,11-90 +52-78,52-53 +42-42,18-43 +2-2,4-94 +8-78,78-78 +3-49,2-50 +5-74,11-73 +17-56,16-72 +46-87,47-79 +72-80,47-51 +11-69,12-12 +2-99,3-99 +13-27,12-15 +23-95,22-96 +39-41,40-96 +74-98,73-73 +82-83,80-82 +12-79,11-32 +6-58,7-7 +3-3,3-97 +4-97,24-95 +3-80,4-75 +72-83,71-84 +20-82,21-21 +6-73,6-72 +77-77,77-97 +18-57,57-57 +53-76,46-75 +21-40,20-74 +60-65,55-64 +78-78,32-78 +22-46,42-46 +4-46,3-47 +35-39,39-40 +79-90,80-89 +36-36,37-60 +9-28,13-29 +15-85,82-85 +5-5,4-79 +17-86,9-17 +6-57,57-57 +76-88,76-88 +73-79,78-80 +52-54,2-53 +1-95,6-94 +46-91,23-99 +70-86,11-71 +19-96,18-96 +25-42,24-24 +32-88,88-94 +7-93,8-99 +5-21,5-20 +34-94,93-94 +92-93,15-92 +38-84,39-85 +79-80,7-79 +48-72,72-72 +10-92,93-98 +14-53,15-92 +7-42,7-37 +11-88,11-87 +41-65,64-65 +71-85,11-64 +21-79,79-87 +80-81,22-81 +40-79,39-41 +18-67,67-91 +11-13,12-61 +1-97,96-98 +5-66,4-4 +1-1,2-75 +15-62,16-62 +28-56,28-28 +3-3,4-79 +68-94,3-68 +8-92,7-9 +69-83,69-84 +6-90,22-90 +10-20,5-10 +21-80,20-21 +15-76,14-76 +75-75,74-83 +5-13,6-22 +39-84,83-84 +30-43,34-38 +42-98,43-97 +6-29,5-59 +62-80,63-88 +5-93,6-6 +53-64,54-64 +47-47,4-47 +62-62,59-62 +46-87,46-87 +93-95,43-55 +4-4,4-19 +86-91,48-86 +22-45,23-44 +13-38,38-93 +5-36,4-20 +27-27,27-33 +10-12,11-83 +10-93,3-93 +79-80,35-80 +64-90,53-68 +52-91,47-89 +2-66,2-3 +58-58,22-57 +7-58,5-94 +3-11,4-10 +32-38,31-39 +10-76,21-29 +15-42,15-42 +9-43,9-95 +3-56,4-57 +35-68,36-68 +55-89,56-88 +2-3,2-99 +2-97,97-99 +29-66,30-65 +5-25,4-25 +52-87,51-54 +28-64,36-66 +52-90,51-51 +95-96,33-95 +1-2,1-82 +19-32,20-31 +73-75,74-83 +73-87,87-88 +19-70,70-70 +4-93,5-13 +96-96,6-95 +10-17,10-18 +70-73,24-70 +25-25,26-76 +58-58,10-58 +5-83,4-84 +45-47,46-74 +50-67,66-68 +88-89,89-93 +15-19,16-24 +28-30,2-29 +17-19,18-77 +21-94,21-83 +23-81,81-82 +2-91,3-66 +75-94,76-94 +2-4,3-99 +19-82,82-83 +3-85,3-3 +62-74,45-61 +33-33,33-47 +66-72,66-72 +62-97,61-61 +41-74,40-75 +7-89,4-7 +56-67,55-57 +6-25,25-89 +11-11,10-14 +89-98,16-97 +18-76,18-76 +23-96,61-97 +6-15,16-68 +3-99,2-99 +22-61,9-22 +45-86,44-44 +30-46,45-46 +55-86,1-97 +21-95,20-95 +20-47,48-82 +15-47,16-80 +39-51,39-52 +9-15,9-90 +1-86,85-86 +38-38,38-79 +41-41,18-42 +7-98,87-98 +9-87,60-88 +30-87,87-88 +10-58,1-6 +5-58,5-58 +38-76,37-76 +9-82,81-82 +2-10,5-43 +50-51,2-51 +35-93,34-93 +18-75,17-75 +14-59,14-59 +27-27,28-88 +61-62,46-61 +38-74,38-51 +49-87,50-50 +39-39,38-95 +48-98,2-97 +27-29,28-92 +23-55,22-54 +30-31,29-31 +11-59,10-58 +15-84,59-85 +22-57,24-56 +17-42,6-42 +5-93,92-94 +76-89,76-90 +1-84,84-85 +36-77,13-78 +31-78,31-57 +23-89,22-90 +36-37,36-48 +41-84,34-83 +6-36,5-6 +74-91,45-92 +62-99,62-65 +3-30,4-98 +9-83,9-83 +11-93,13-94 +7-35,6-6 +36-38,37-67 +84-93,1-92 +28-57,27-56 +94-97,95-98 +41-74,40-75 +7-91,12-88 +42-97,43-96 +7-13,14-85 +58-96,4-98 +15-95,47-95 +87-90,5-87 +35-71,36-71 +27-29,29-29 +21-28,28-46 +2-13,13-99 +38-52,39-51 +12-79,61-80 +59-81,19-59 +87-88,15-87 +10-53,8-10 +4-10,2-9 +13-93,69-94 +42-61,82-83 +9-97,10-10 +9-21,8-20 +42-89,89-90 +4-86,79-87 +11-58,11-47 +83-84,14-84 +5-75,32-75 +45-97,97-97 +39-39,38-48 +44-44,43-58 +50-69,49-68 +61-87,55-86 +4-95,94-95 +47-48,47-48 +40-67,39-39 +15-68,15-69 +4-84,4-84 +98-99,1-99 +3-8,8-98 +2-97,3-97 +20-46,46-90 +25-64,43-83 +26-47,26-47 +27-28,1-28 +50-52,51-64 +76-87,91-99 +39-60,38-40 +3-99,4-99 +67-82,10-67 +45-76,46-59 +16-79,15-78 +11-63,19-62 +9-54,10-55 +4-95,96-96 +16-87,15-88 +9-30,29-88 +68-69,10-68 +51-54,52-74 +2-4,4-59 +1-96,97-99 +17-90,54-91 +25-27,26-88 +95-97,57-95 +25-33,25-25 +33-64,33-47 +32-93,33-93 +3-37,37-38 +60-80,54-79 +38-39,21-39 +9-94,94-96 +27-80,27-81 +1-74,22-75 +11-89,11-89 +7-81,82-98 +5-56,56-75 +3-3,3-90 +18-62,18-19 +28-99,29-98 +2-2,2-75 +31-86,12-65 +71-72,20-71 +73-73,56-72 +94-98,7-88 +91-91,92-92 +3-98,4-97 +2-71,70-71 +5-63,63-63 +39-81,21-81 +44-44,44-78 +64-88,15-87 +95-95,92-96 +17-32,32-94 +11-81,12-82 +86-97,85-98 +92-99,8-98 +22-70,23-23 +11-97,10-11 +72-73,61-72 +25-58,24-98 +52-65,53-55 +66-67,1-66 +8-65,53-65 +83-98,82-89 +33-79,33-79 +65-79,65-92 +7-34,8-53 +27-43,34-73 +28-77,28-77 +59-96,27-98 +7-55,19-66 +2-78,3-79 +13-13,12-81 +2-92,91-92 +2-44,1-43 +32-33,32-99 +92-93,20-93 +97-98,8-98 +15-60,16-60 +3-98,2-99 +37-37,13-37 +9-82,82-97 +23-86,22-67 +18-35,9-27 +57-73,57-58 +36-93,36-37 +15-15,15-77 +52-82,51-73 +13-22,14-96 +9-67,8-68 +6-76,7-83 +1-4,1-4 +1-95,1-90 +25-29,29-80 +77-91,39-90 +7-97,8-96 +45-77,46-88 +20-59,59-82 +64-64,63-96 +31-83,32-32 +11-96,96-97 +59-77,59-59 +47-75,47-65 +8-95,2-8 +19-81,19-81 +35-36,36-37 +83-84,83-90 +4-97,2-49 +39-96,38-97 +64-99,6-86 +29-95,29-96 +27-84,7-27 +4-63,6-62 +60-66,61-66 +58-91,90-91 +44-65,62-69 +13-24,23-61 +45-88,88-93 +62-95,95-96 +1-86,1-85 +33-33,12-33 +36-67,37-66 +11-49,48-50 +4-76,1-4 +5-84,4-53 +22-65,22-65 +12-22,13-64 +16-16,16-33 +10-97,44-98 +47-52,48-64 +58-95,59-99 +18-71,37-72 +7-79,8-79 +2-61,3-98 +67-84,83-85 +56-86,82-85 +22-97,28-98 +42-57,41-57 +23-26,11-25 +45-82,5-81 +41-43,42-79 +3-93,93-93 +60-87,59-84 +93-99,44-93 +47-95,74-95 +51-52,40-52 +11-32,12-84 +4-89,1-4 +3-93,93-94 +97-97,17-96 +12-67,11-11 +25-80,39-60 +98-99,3-98 +61-62,60-62 +24-35,34-35 +10-86,11-87 +64-66,4-90 +1-1,2-89 +15-75,46-76 +71-72,17-72 +7-9,8-91 +18-36,18-70 +3-5,4-16 +8-88,7-88 +69-85,69-69 +17-46,18-47 +8-37,37-50 +2-38,1-39 +99-99,9-99 +30-78,31-89 +51-64,52-63 +11-99,1-99 +81-82,23-81 +54-62,53-53 +80-91,24-80 +96-98,75-97 +78-78,46-78 +7-88,7-89 +1-22,1-22 +5-39,5-38 +95-95,13-96 +19-49,17-85 +7-96,6-96 +29-93,49-75 +42-76,43-75 +62-62,61-70 +36-42,37-46 +5-84,91-92 +26-95,25-27 +36-81,63-82 +17-51,18-50 +34-74,34-75 +6-53,53-86 +28-28,28-36 +6-6,6-77 +42-70,41-70 +29-92,92-93 +10-50,9-51 +90-93,80-90 +3-84,28-97 +3-3,2-74 +9-92,8-10 +58-70,58-70 +1-61,2-16 +29-85,29-69 +61-96,31-96 +30-81,12-30 +25-72,24-26 +60-96,60-96 +2-29,2-28 +27-57,26-57 +5-94,2-99 +5-15,4-19 +2-46,3-29 +39-60,38-99 +1-2,1-83 +17-86,18-87 +68-95,69-94 +31-52,8-53 +80-89,81-88 +17-57,16-56 +7-28,6-24 +35-63,63-63 +42-89,88-89 +97-98,71-98 +79-82,6-68 +8-34,34-34 +66-71,38-70 +15-65,66-71 +22-82,21-83 +9-81,10-22 +19-85,18-86 +19-19,20-70 +6-76,45-76 +1-37,36-55 +49-98,98-98 +9-88,4-10 +74-83,17-82 +30-63,22-62 +8-89,4-8 +3-87,2-16 +91-91,49-91 +2-53,53-97 +9-14,13-71 +33-98,34-99 +31-58,27-59 +22-34,34-34 +3-5,4-97 +36-93,25-31 +50-62,35-61 +43-84,43-83 +60-81,19-60 +2-90,2-89 +1-3,5-44 +5-99,8-96 +7-7,8-8 +27-39,28-80 +6-89,4-5 +44-66,11-67 +15-88,7-99 +5-44,5-6 +70-95,71-94 +2-2,2-81 +99-99,4-99 +98-99,22-98 +69-78,65-77 +46-51,45-51 +34-67,66-68 +36-74,35-75 +38-63,39-62 +22-72,39-73 +15-52,16-52 +19-98,19-97 +4-99,3-3 +2-2,3-96 +3-85,4-4 +19-91,10-20 +4-20,20-78 +2-56,6-85 +6-54,5-54 +4-65,5-65 +13-74,15-74 +78-92,79-94 +68-77,62-76 +5-75,5-75 +68-85,69-88 +62-94,21-94 +6-94,5-95 +1-3,3-61 +37-68,37-69 +4-4,5-65 +96-97,3-97 +8-96,7-7 +69-96,8-91 +87-88,8-88 +17-32,74-91 +13-93,13-93 +44-46,21-45 +37-49,49-50 +9-53,53-90 +43-51,49-49 +5-91,6-92 +12-77,12-13 +29-94,30-32 +77-78,53-77 +10-62,26-83 +44-46,45-60 +79-90,79-97 +5-89,89-89 +3-64,2-65 +58-96,73-96 +49-97,16-96 +27-49,26-50 +25-51,51-71 +45-48,46-51 +80-81,3-80 +26-30,25-25 +94-95,50-94 +65-95,63-94 +11-95,3-44 +11-97,10-10 +97-98,2-97 +46-50,53-66 +7-23,22-97 +55-85,55-85 +85-92,11-85 +98-99,5-99 +60-61,4-61 +30-31,8-30 +53-54,38-53 +2-3,4-5 +3-99,2-99 +19-85,21-66 +36-53,36-50 +70-71,24-70 +19-85,20-85 +1-84,15-86 +30-57,30-58 +78-81,77-82 +19-26,26-27 +52-73,51-72 +73-89,69-88 +2-5,4-79 +9-35,10-34 +4-60,3-61 +5-5,4-69 +98-99,16-98 +57-85,85-86 +1-81,2-80 +44-73,44-73 +90-97,68-90 +75-88,1-75 +95-98,12-95 +40-66,39-67 +3-99,4-26 +52-76,93-99 +16-30,30-66 +68-69,68-69 +19-68,9-19 +37-90,37-41 +1-94,94-94 +2-2,1-83 +12-93,2-12 +27-96,17-28 +44-46,36-67 +72-90,73-89 +20-29,21-21 +7-59,59-60 +69-74,66-74 +27-82,69-83 +12-78,12-78 +13-64,63-70 +41-60,40-40 +32-96,59-97 +1-98,1-97 +9-64,8-19 +4-4,3-97 +8-96,8-9 +5-5,4-68 +44-68,45-45 +42-67,41-71 +49-50,18-49 +1-95,83-91 +7-8,7-82 +31-76,32-75 +45-63,54-64 +92-93,84-92 +94-96,95-97 +21-61,20-62 +13-67,5-42 +15-58,16-84 +47-55,29-46 +56-65,55-57 +11-53,12-52 +1-48,48-57 +20-75,15-75 +1-95,21-95 +2-39,3-90 +4-54,24-55 +8-42,41-46 +9-97,9-98 +45-83,39-82 +23-72,22-71 +68-68,62-68 +2-96,1-1 +15-90,16-91 +25-27,26-93 +34-36,30-35 +2-65,3-64 +2-54,53-54 +39-84,38-84 +9-96,10-96 +79-80,70-76 +22-47,31-47 +13-87,12-87 +87-93,87-94 +24-44,25-94 +36-93,6-97 +8-94,28-41 +50-61,56-62 +32-74,74-75 +3-78,13-78 +99-99,23-87 +25-83,25-83 +15-15,14-20 +62-63,32-63 +36-49,35-57 +48-93,14-49 +52-71,51-53 +1-2,1-11 +22-99,98-99 +28-29,28-49 +7-8,7-81 +27-64,64-93 +13-59,14-60 +12-88,10-11 +13-79,14-50 +2-3,5-87 +18-77,18-76 diff --git a/2022/08/a.py b/2022/08/a.py new file mode 100644 index 0000000..f762554 --- /dev/null +++ b/2022/08/a.py @@ -0,0 +1,42 @@ +def is_visible(i, j): + this = grid[i][j] + surround = [ + [grid[i2][j] for i2 in range(i)], + [grid[i][j2] for j2 in range(j)], + [grid[i2][j] for i2 in range(i+1, len(grid))], + [grid[i][j2] for j2 in range(j+1, len(grid[0]))], + ] + return any([all([s < this for s in sur]) for sur in surround]) + +def view(i, j): + score = 1 + this = grid[i][j] + surround = [ + [grid[i2][j] for i2 in range(i-1, -1, -1)], + [grid[i][j2] for j2 in range(j-1, -1, -1)], + [grid[i2][j] for i2 in range(i+1, len(grid))], + [grid[i][j2] for j2 in range(j+1, len(grid[0]))], + ] + for sur in surround: + surlen = len(sur) + i = 0 + while i < surlen and sur[i] < this: + i += 1 + if i < surlen and sur[i] >= this: + i += 1 + score *= i + return score + + +#with open("example") as f: +with open("input") as f: + grid = [line.strip() for line in f.readlines()] +width, height = len(grid[0]), len(grid) +edge_visible = (width + height-2) * 2 +highest = 0 +for i in range(1, height-1): + for j in range(1, width-1): + score = view(i, j) + if score > highest: + highest = score +print(highest) diff --git a/2022/08/example b/2022/08/example new file mode 100644 index 0000000..16d6fbd --- /dev/null +++ b/2022/08/example @@ -0,0 +1,5 @@ +30373 +25512 +65332 +33549 +35390 diff --git a/2022/08/input b/2022/08/input new file mode 100644 index 0000000..0e37410 --- /dev/null +++ b/2022/08/input @@ -0,0 +1,99 @@ +112121202020313300020340412130241443213110212555412551412441344012102310202342110301131001201210222 +002220000133232333300400324440200340331442222154322435351134115104433131022400301210231103320120102 +002111110023312202140422121302301411425412143121451113531553512221212012141140202223332010130102121 +200121112032232121304410232442313124341433152252314544515325125233341244332012020324021110233002001 +201022212100303122230042110420411144235142233535353242115241433555244414021310121244221013322222121 +011133013013221340022444040034222334222333233513241314324332525223122512421234021412140011030323220 +210300120303001122232014221422523555232331235422254211412225214325215241553042040303041423101011002 +003120002332341304133020544511125535535541345465624233512532523153125344553310344313112440310203011 +131130201012400142322154551413323211211264453362355545322422255141341455331312144311201120100013210 +231231113320032112042452344144421222532325455233246353364224262633314514222114310222010411123020310 +130132323324003111222144335255232253526222366424453236522644225645542113443452221300403213402211010 +113120324042321002433123114511424246663652545323562652666642343346224141215312351154031420431123313 +322103103420203222134243312435226546235454342354423362646633563243445363453321134444313221424211210 +222002200102244012425542311135622554533554536552565362325262535422342364211432245513321404214403103 +020312030211000311145233135522425335364263235236633766423525523653365556233412434131421431421413032 +210200210122104332244324435223345455654634767746775377345346266325246256554325112245151433442112120 +122021103003325452113155263653362555455536744343555667465337737332644556355541512314415321432122010 +302130331324344154351152233526435626553676357536566754666777544543643553226655255322235341014410100 +314012231321215344153565545233452474545654556345434346477343637634766266254223421545221444103004003 +203142142342444551513532553564436657337357765377547636675373434576744336526346456543411441023143110 +012342201025331211122452444533576366457663645436375557334447647673566472636623645223251551503132201 +242040141354332534632526224223663666376753663766575676333754654644753446365223356333455541211334020 +304212105422512243642223324443434437444774475647656876467367634464365546355325563651434541552020333 +411420043555145455366465334765477455434665856478775445748748844536643753776566362432434143454420144 +401414045521554536566434665734634475568447478784884574576588667675763475753664255466323144315114340 +403203444553445263226363636763747365744764846865845556768875448846334555367546232343531522434303222 +320101251535223652234326457665537657586786457478765885578775686476536463546335334642346321452233131 +101012145413152534234557444577344864876885844857544755664447444658566665757343254462522531514251101 +340341152532244444232667437647346678855466568676685668454547775878787354745333434364264512332351234 +034022314552563333466574354365446884777648857896869775765876486687448874547744636623356245124411300 +434115222252325233267546336767445666887887795778879879888964665878876674757366746353365644321332143 +312035533543623363556753755356877487485687695957956976755556874674844755665746737526623244522514143 +420252322135326524253347754684544485747997555758865876756898776645768885645667637664454254124241132 +042551521433445422576644675485868857686859585876589677967989879564666758475665333623554365252143351 +404455122524562436436545777675857467559889565668857859685895859976758774886545433533522546412531113 +402414213444443632667535548848565847669657785977756989557799965677887465558473374753636263414433431 +022221152324544456367356377556875457665895668676988667859858876695687554757534736365524353324555445 +344111222625453364363635787885744595658769866898866968696568596595864444764473337656423523432142535 +225434342232366345537763675578769565995877778767697786787965759585779855884865343633323444422312351 +035315413543653543334365848874759855766697967679779767999679566665785768858653734543735645643221454 +023235144645352563656735676476699588575688669887679986967789786578779847658656675663653453233341153 +142225254342433566337738656784888579869898976766696886867989878587588888556744335476656546565134514 +332531546644465434575456856855557977598878768976688677796996689765566874765455375433552656652141222 +245115244422246534474538846486987698857687868676878977996687768986655856867454644744464462545223145 +534255233266234565357356454786989999898896977688879977977896669857699764786566736463343326443154122 +454354332542262477736688458567665797769979688789788788987866776769877696655848467435475444463335241 +512543144352562655357675475585978965976868699798788899789679876985786899685774865763673624244331431 +324412256535565334657448674688895886877986668889799998798889878866685759475645457456546355544251525 +115513233345333374765468446775577596767887988887878879877777968697669577748775734356333445243551434 +415151565352224735474558556859799577886898999998979889789968896887667799778755865475767222365331232 +341542233524534557363486747546566765697666978897898998779776898687767558456588645347447452326635211 +141352533235633637755547684876556558796988688897999988799797887989695558885678545676777233242514541 +521224242633256545773565667556868787766779689977797878779776688978856968445584875373474655564453414 +212223344626635634464468564667887899889688667779987877977666888978896755878447456437466626246242154 +234115532222663767644584477756969899977977999989879987999976887779867996588585775466444223626514313 +135352514355535475547475454586885687868789797787897877999696989878678658675857877374766244666335415 +245312112534242364465384488548568678767769779778898997999876767795755964548464847565732454524524223 +021525515246626734753566444568597959566979986967678896977989678777787774766445653374342254643512525 +154333554224543664547576668488558779569899998698676696676768688689695868756558334756732443435414211 +241121123663636476553777547778679898575887899887676677898688967655685877474554463766356464665314411 +042314546263224256647665654464888598856776787699868899986977858568579785688458575346453652462152344 +123331145253442347344577548844655756795759896669869969898669978977675445684486336563564633463521424 +441245214645233266655474685847446687769676869796966869876898656576557445456865677774743333555121233 +125144145355562535553453348876854556596588579796889867979959976599967847546665344765436664421452124 +005214145522463625374665767445668477766757899558986688996855569799556464475877546663265544522533142 +424213534345444245575767446587747766879868999866679969656557796695754688786576454364542222333552433 +340123443165235626753533465668444668759977876797965776795859756987877778467766435676633663325451242 +003233434214334366657377335845776467875798576979767697579687977648857565845364473624435244552521232 +424135233343456444347333753548856886767998675667957686789866998677467875563746577654546663332345512 +142144412143652453363555366356464857764776776669865675576766767657655474454367647255355333454132411 +114044434535536365647343757563768767554848877759975798758895468485667587677463336535634542315521124 +243044411234356654655645476665375787765667655868887868786658648788875454747665334553525245122313313 +223005135155362266463337346655467578858875455446758445778678456564555447754654655642444335244151100 +441031313535133543536645563565447868478877557885475885785484588664864367437333352334646552545540434 +230403434533122325663365655775564467566764578557546875654785658764434354637753535553443132323132432 +231103055415354435244636576576467643575457665666647886566848556463753663346723326243525141135130424 +234240311433354434253255264577573744567747565865655865884455858675735663776644624454624322251114322 +001140425351442116425436424534333635755754445857766654848476464365374745573246334553145131221240002 +423442125121142242554242262463344446436337646568454446465366647477574476743566434562422322213241112 +041120244223522424262622532426564364336575645645643473455773734743736536462532635531424223442140002 +333213342044141312256465444645743463747737775353476574446663366477433766453534634424144243324342330 +123301211302132311214446544655333545346646756574364363763577337443636433244534466131243245142313041 +333302233005545533332445234232634365637756745756665533337455656536362324645335641322232425441330441 +210101031320143231223346443232362353735643457655456457447337655745423533326242244322432513011341141 +103110441134453455534214566635432365634456656643365735556363677266633236436433421143354400234124322 +210103104441245232113425543552436226532532734735737666776674646353226636524623254312414101401413013 +020024442231000453252454154546643563663622535463445755356246553442265263346551444421542422240011133 +031020232402201014325415255432463233224332466352332362464633465245446636555422514435430143120003112 +310302320413232125411435155524536333442626366353663655223253243262552253454113353253031242202102210 +221201232400342023452154554354353535536252463345626432342652363255555242425543353242440134432103103 +210032311140434341431423452253535242446256556466223466635264232223251545121524142114121403343313003 +120033031102121020314222514435233222253442525525522546426665636231521441532113451340400133032210231 +210023013101112320231215311434153455555125335452263535435665554254354533423243412221004001101231111 +221223223131114201030343552243332413432225514566333324653532145252122232542252133334211422030222312 +222331111212014202022011214444443411412221134525134425141412252142514152354243232311422120203312310 +110131122101302404410231242111542122454123223331222324435451342542314134420104111021220102332003000 +201221202213022021032201013424223253221544343453433115235543553513232252242121443333323311020103222 +001200323302010132410244321011414224212135145444322543324442532241244022442341044312322333033210110 +012221120210002201233041204141124034134123443133233422423453224352410321301023102020300131022311221 diff --git a/UNLICENSE b/UNLICENSE new file mode 100644 index 0000000..68a49da --- /dev/null +++ b/UNLICENSE @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to <http://unlicense.org/> |