From 78f5ee4da86b1511382399822d5eaaccd9f11a54 Mon Sep 17 00:00:00 2001 From: stupidcomputer Date: Thu, 19 Dec 2024 17:13:16 -0600 Subject: [PATCH] in progress stuff --- 2024/2/1.py | 29 ++ 2024/2/input | 1000 +++++++++++++++++++++++++++++++++++++++++++++++++ 2024/2/two.py | 66 ++++ 2024/3/input | 6 + 2024/3/two.py | 26 ++ 2024/4/input | 140 +++++++ 2024/4/one.py | 96 +++++ 2024/4/sample | 10 + 8 files changed, 1373 insertions(+) create mode 100644 2024/2/1.py create mode 100644 2024/2/input create mode 100644 2024/2/two.py create mode 100644 2024/3/input create mode 100644 2024/3/two.py create mode 100644 2024/4/input create mode 100644 2024/4/one.py create mode 100644 2024/4/sample diff --git a/2024/2/1.py b/2024/2/1.py new file mode 100644 index 0000000..34b7040 --- /dev/null +++ b/2024/2/1.py @@ -0,0 +1,29 @@ +from collections import Counter +from itertools import pairwise +reports = [i.rstrip() for i in open("input").readlines()] +reports = [[int(j) for j in i.split(' ')] for i in reports] + +def reduce_report_to_state(report): + p = pairwise(report) + + diffs = [x - y for x, y in p] + absdiff = list(map(abs, diffs)) + c = Counter(absdiff) + if c[0] > 0: + return False + signs = list(map(lambda x: x > 0, diffs)) + signs = set(signs) + if len(signs) != 1: + return False + + for i in absdiff: + if i < 1 or i > 3: + return False + + return True + + +processed = map(reduce_report_to_state, reports) +counted = Counter(processed) + +print(counted[True]) diff --git a/2024/2/input b/2024/2/input new file mode 100644 index 0000000..8f28518 --- /dev/null +++ b/2024/2/input @@ -0,0 +1,1000 @@ +1 3 5 6 8 9 12 9 +66 67 70 72 73 74 75 75 +18 20 22 25 28 31 35 +85 86 87 90 93 99 +5 6 5 7 10 12 15 16 +68 70 72 73 74 73 74 71 +75 76 79 76 79 79 +38 41 44 45 43 47 +76 77 79 80 83 85 84 90 +73 76 79 79 82 85 88 +86 87 87 90 93 94 97 96 +47 48 48 49 49 +29 30 31 31 35 +85 87 89 89 90 95 +33 34 38 39 40 42 +84 86 90 93 92 +20 22 25 29 29 +76 78 81 84 85 89 92 96 +47 48 52 54 57 58 59 64 +19 20 21 27 28 +49 51 58 59 61 59 +18 21 26 29 32 32 +46 48 53 54 57 58 62 +71 72 73 78 80 85 +25 23 25 28 29 32 35 +34 32 35 38 39 40 43 42 +15 14 15 18 19 19 +48 47 49 51 55 +9 8 9 12 19 +33 31 33 34 36 37 36 37 +71 68 66 68 66 +86 84 86 85 86 88 88 +30 27 28 27 28 30 32 36 +77 76 74 75 78 85 +66 63 64 65 65 67 +48 45 47 49 52 52 53 50 +28 26 26 27 30 33 33 +26 25 25 27 28 29 33 +93 91 92 92 97 +36 35 39 42 43 46 47 +18 15 18 22 25 22 +43 41 43 46 50 52 52 +28 27 30 32 33 37 41 +58 56 58 62 63 65 67 73 +3 1 3 8 9 +28 27 30 33 34 39 38 +65 64 65 68 75 75 +51 48 55 57 61 +57 54 61 64 65 71 +26 26 27 28 31 33 34 35 +37 37 40 41 43 44 47 44 +41 41 43 44 47 50 51 51 +32 32 34 36 37 40 41 45 +32 32 35 38 40 41 42 47 +79 79 80 77 78 81 +91 91 89 92 95 97 99 96 +86 86 83 85 88 88 +37 37 36 38 42 +63 63 60 61 63 66 73 +43 43 43 44 47 +54 54 57 57 58 57 +26 26 29 31 31 33 33 +21 21 24 27 27 31 +9 9 10 12 14 14 15 22 +41 41 44 48 49 52 53 54 +16 16 18 22 24 26 25 +11 11 13 17 20 20 +62 62 63 65 66 70 72 76 +74 74 76 78 82 85 91 +72 72 75 76 81 84 +12 12 14 21 24 25 26 23 +6 6 8 10 15 15 +10 10 11 12 14 20 24 +17 17 20 21 22 29 31 36 +23 27 29 32 35 38 41 +34 38 41 44 43 +37 41 44 47 49 50 52 52 +41 45 47 48 50 51 54 58 +79 83 86 89 90 91 92 99 +25 29 30 33 36 39 36 38 +90 94 97 94 96 99 96 +84 88 86 87 88 88 +48 52 55 54 58 +46 50 49 51 53 59 +22 26 26 27 29 +52 56 59 59 56 +42 46 49 49 49 +62 66 66 69 70 74 +64 68 69 72 72 73 76 83 +10 14 17 21 22 25 26 +43 47 50 54 55 52 +85 89 92 96 96 +58 62 66 68 69 72 74 78 +8 12 16 19 24 +69 73 74 80 81 82 +65 69 76 77 75 +16 20 23 28 31 32 34 34 +41 45 48 53 55 56 60 +80 84 87 92 98 +69 75 76 79 81 84 85 87 +27 34 36 37 36 +51 57 59 60 62 62 +20 27 30 33 37 +39 45 47 50 51 57 +65 72 75 73 74 +78 83 85 87 89 86 83 +50 57 60 63 62 64 65 65 +39 46 47 44 48 +36 41 44 42 43 49 +7 14 14 17 18 21 +61 66 67 67 64 +66 73 74 76 76 77 77 +47 53 56 57 60 60 64 +38 43 45 45 52 +30 36 38 41 44 48 51 +26 32 35 38 41 43 47 46 +79 85 87 88 91 95 95 +36 43 44 46 50 52 55 59 +64 69 71 74 77 81 83 88 +46 51 53 54 57 59 66 68 +64 71 78 81 83 80 +22 29 30 35 36 36 +60 66 69 74 75 79 +23 28 33 36 37 39 42 48 +10 8 7 6 3 1 3 +69 68 65 62 61 58 58 +76 74 71 68 67 63 +84 81 80 78 76 70 +67 66 63 65 62 +35 33 30 28 31 30 32 +65 62 64 63 63 +95 93 91 92 88 +72 70 73 70 65 +69 67 67 64 62 60 58 56 +69 66 66 63 65 +11 8 5 5 5 +53 52 49 46 43 43 41 37 +19 16 15 13 13 11 4 +48 45 44 41 37 36 34 33 +52 50 47 46 42 44 +32 29 26 22 22 +29 28 24 21 18 14 +64 63 59 58 56 55 48 +62 60 57 51 48 45 42 +43 40 39 34 35 +17 16 13 12 6 5 5 +85 82 75 72 71 70 66 +55 52 49 42 35 +8 11 9 7 4 +47 49 47 44 43 40 39 42 +76 78 75 73 70 67 66 66 +64 66 64 63 60 58 56 52 +88 91 89 87 81 +35 37 40 39 36 +8 11 9 11 10 11 +4 7 6 4 6 6 +40 42 39 36 34 32 35 31 +77 79 77 76 79 76 71 +92 94 91 91 90 88 86 +55 56 55 54 54 53 54 +38 41 41 40 40 +18 19 19 18 17 13 +12 13 12 10 9 9 8 3 +11 14 11 10 9 5 2 +36 38 36 32 31 32 +12 13 10 7 6 2 1 1 +81 82 80 77 73 71 70 66 +17 20 16 13 11 9 8 1 +34 35 32 27 26 +94 96 91 90 89 90 +52 54 47 44 42 41 38 38 +75 78 77 71 70 66 +82 84 79 78 76 73 70 63 +57 57 54 53 50 49 +22 22 21 19 21 +81 81 80 77 76 75 74 74 +65 65 64 62 60 57 53 +39 39 37 34 28 +18 18 21 18 16 14 +10 10 7 9 12 +47 47 44 46 45 44 44 +69 69 71 69 66 63 62 58 +84 84 81 83 81 75 +73 73 71 71 68 65 62 59 +47 47 47 44 41 42 +86 86 84 81 80 78 78 78 +83 83 83 81 77 +36 36 33 33 32 27 +65 65 62 58 56 +77 77 76 73 70 66 63 64 +61 61 60 57 53 53 +22 22 19 15 11 +52 52 49 45 43 38 +71 71 70 67 65 60 58 +28 28 26 23 21 16 13 16 +89 89 86 80 77 75 72 72 +81 81 80 79 74 70 +84 84 83 80 79 72 66 +92 88 87 84 83 81 80 79 +83 79 76 74 73 74 +77 73 70 68 66 66 +34 30 29 26 23 21 18 14 +34 30 28 26 25 20 +53 49 47 45 43 44 42 +65 61 62 61 64 +95 91 90 91 91 +95 91 90 93 91 87 +95 91 89 86 84 83 86 80 +26 22 22 20 17 14 11 +30 26 24 21 19 19 16 19 +37 33 30 27 27 27 +20 16 14 14 10 +76 72 72 69 64 +70 66 65 61 59 57 55 +59 55 51 48 51 +84 80 76 73 73 +81 77 76 72 68 +95 91 87 86 80 +57 53 52 51 50 44 41 39 +29 25 19 16 15 17 +41 37 32 29 29 +63 59 58 56 49 47 46 42 +23 19 12 11 4 +35 29 26 24 23 22 +64 59 56 53 52 49 51 +52 47 44 43 41 41 +25 18 16 15 12 10 6 +25 19 17 15 13 12 9 2 +76 71 73 70 68 67 +58 51 50 47 50 51 +70 65 62 59 58 57 58 58 +19 12 9 6 5 7 3 +85 78 79 78 77 76 71 +85 78 78 75 74 71 68 65 +97 92 91 90 90 88 85 86 +62 56 53 51 51 51 +80 75 72 72 69 66 62 +89 83 83 80 79 72 +58 51 47 46 43 40 +95 90 88 84 86 +78 73 70 66 66 +60 53 49 46 45 41 +55 48 47 43 38 +21 15 14 11 9 4 2 +60 54 51 46 47 +50 44 42 35 32 30 30 +27 21 19 16 10 6 +53 47 41 39 38 37 32 +54 56 59 61 62 59 +3 4 7 9 12 13 16 16 +17 19 21 24 27 31 +23 26 27 28 35 +18 21 22 24 21 24 25 26 +53 55 53 55 54 +14 17 19 20 17 18 18 +78 81 82 83 81 84 87 91 +65 66 68 66 68 75 +32 34 34 37 39 +40 42 43 46 46 47 44 +58 59 61 61 61 +54 55 57 57 61 +24 25 25 27 30 32 35 41 +70 71 75 77 80 83 85 87 +79 82 84 85 88 91 95 93 +82 83 85 88 92 94 95 95 +35 37 41 43 46 50 +60 61 64 67 71 77 +4 7 10 17 18 19 +28 31 37 38 37 +73 74 76 82 83 83 +54 57 59 62 69 72 73 77 +43 44 46 53 56 61 +44 41 42 44 46 47 48 51 +83 81 82 85 87 89 86 +50 49 51 54 56 58 58 +41 38 39 42 45 48 49 53 +10 8 11 14 19 +74 73 72 74 77 80 +27 25 26 27 24 21 +15 12 15 12 12 +68 66 68 66 70 +44 43 42 44 45 50 +85 84 85 88 88 91 93 +19 16 18 18 16 +50 49 49 50 53 53 +69 66 69 72 75 78 78 82 +31 30 32 33 33 36 41 +74 72 73 76 80 82 83 +82 79 82 85 86 90 87 +33 31 34 35 39 40 40 +45 42 44 46 48 52 55 59 +45 44 48 51 54 60 +46 44 49 52 54 +34 31 37 38 40 41 39 +78 77 78 85 87 88 89 89 +30 29 32 37 41 +51 50 51 54 57 63 70 +57 57 58 61 64 66 69 72 +35 35 37 38 39 42 43 41 +33 33 36 37 39 41 41 +62 62 65 66 70 +68 68 71 74 76 79 81 87 +6 6 7 9 12 13 10 12 +82 82 79 82 81 +13 13 15 13 13 +13 13 15 17 15 17 21 +47 47 50 47 50 52 57 +60 60 60 62 63 +61 61 62 62 64 66 67 64 +50 50 51 51 51 +59 59 59 61 64 68 +24 24 24 26 29 36 +72 72 76 79 81 82 +52 52 56 58 55 +32 32 33 37 38 38 +81 81 84 87 91 95 +47 47 51 53 60 +39 39 42 44 47 52 55 56 +43 43 49 50 53 55 52 +78 78 81 84 87 93 93 +46 46 47 50 56 57 60 64 +41 41 44 50 53 58 +53 57 59 62 63 66 69 +83 87 90 92 95 98 99 96 +49 53 55 57 59 61 61 +63 67 68 71 75 +77 81 82 85 87 89 95 +34 38 40 42 41 42 45 46 +8 12 14 16 17 19 18 16 +48 52 50 53 54 56 56 +4 8 6 8 12 +42 46 49 50 49 51 56 +39 43 46 47 47 48 +77 81 83 83 82 +55 59 60 62 62 65 67 67 +36 40 42 42 43 44 46 50 +66 70 73 76 79 79 82 88 +35 39 40 44 45 48 49 52 +72 76 77 81 79 +37 41 45 48 48 +36 40 43 47 51 +71 75 77 81 86 +18 22 29 30 31 33 +33 37 40 43 49 50 47 +25 29 32 34 41 41 +60 64 67 73 77 +36 40 42 47 50 53 54 60 +52 57 59 62 63 64 +10 17 20 23 20 +26 32 35 38 40 43 44 44 +78 83 85 88 90 94 +47 52 54 55 57 63 +74 79 82 85 82 85 +86 92 93 95 92 90 +42 47 48 50 53 50 50 +62 68 71 70 74 +71 78 81 80 82 83 84 90 +39 44 44 46 47 49 50 +31 36 38 38 37 +23 30 32 32 34 37 37 +19 26 29 30 30 34 +76 83 83 85 88 89 96 +58 65 67 70 71 75 77 79 +76 83 85 88 92 95 96 94 +53 60 64 66 68 68 +35 41 43 47 48 52 +50 57 61 62 64 70 +32 39 40 41 44 50 51 +72 77 84 85 87 88 86 +25 32 38 39 41 42 45 45 +15 21 24 26 33 37 +35 41 46 48 49 50 55 +61 58 57 54 56 +28 26 23 22 19 16 13 13 +54 51 49 46 42 +41 38 37 36 29 +91 89 87 84 83 84 81 +92 91 90 91 90 89 90 +87 86 88 87 87 +34 31 29 30 29 26 22 +47 44 43 40 38 36 37 32 +69 66 63 60 58 58 56 +10 7 6 4 4 2 3 +79 76 76 73 73 +60 59 59 56 54 51 47 +33 31 28 28 23 +29 27 26 23 22 18 16 15 +60 58 54 52 51 48 49 +43 41 37 35 33 31 31 +41 40 38 34 33 30 26 +89 88 85 81 76 +34 31 26 25 24 22 19 18 +92 89 84 82 79 77 80 +26 23 21 20 17 14 8 8 +53 51 50 47 41 37 +24 23 20 14 13 8 +29 31 28 26 24 +53 54 53 52 50 47 46 47 +76 78 75 74 72 69 66 66 +69 71 69 66 64 62 58 +58 61 59 58 56 50 +54 57 54 52 50 52 51 +38 39 41 38 36 37 +12 14 11 9 6 4 5 5 +35 37 36 34 35 33 32 28 +10 11 9 12 11 10 8 3 +23 25 23 23 20 17 16 +75 76 76 74 72 69 70 +58 60 57 54 54 52 52 +6 9 6 6 2 +40 43 43 41 39 33 +75 76 72 69 68 67 +40 41 40 36 39 +83 85 84 81 77 74 74 +26 28 24 21 19 15 +27 30 26 24 22 21 19 13 +50 53 52 51 45 42 +50 52 49 43 41 42 +23 24 23 20 19 12 11 11 +52 54 52 47 45 42 38 +70 71 64 61 54 +65 65 62 61 58 55 +14 14 11 8 5 4 7 +52 52 51 48 46 46 +99 99 98 97 94 90 +54 54 53 52 46 +48 48 47 45 47 45 +64 64 61 64 67 +23 23 22 21 23 22 22 +75 75 74 76 73 70 66 +25 25 26 25 23 21 19 13 +74 74 72 72 71 +75 75 73 70 70 72 +94 94 92 89 89 88 88 +27 27 24 24 22 20 17 13 +59 59 59 58 56 51 +44 44 41 37 36 33 +14 14 12 9 8 4 5 +74 74 71 67 67 +25 25 21 18 15 13 12 8 +60 60 56 53 47 +39 39 37 34 33 30 24 21 +60 60 59 58 51 54 +24 24 21 18 11 8 6 6 +62 62 59 52 50 48 45 41 +42 42 40 39 33 32 26 +14 10 8 7 5 2 +69 65 63 62 61 60 59 61 +55 51 48 46 43 42 42 +38 34 31 29 28 25 21 +29 25 22 21 19 18 17 11 +55 51 50 51 48 47 45 42 +87 83 82 85 84 85 +42 38 35 32 33 31 31 +29 25 23 20 18 15 16 12 +87 83 84 81 78 72 +25 21 19 17 17 16 14 13 +68 64 62 59 57 57 58 +86 82 80 80 80 +94 90 90 87 84 81 77 +64 60 59 58 56 56 54 49 +89 85 81 78 76 73 +63 59 55 53 50 53 +68 64 61 60 57 53 51 51 +57 53 51 49 45 42 41 37 +57 53 51 48 44 41 36 +77 73 70 64 63 +37 33 31 28 25 19 17 19 +34 30 27 24 19 19 +67 63 61 56 55 52 48 +90 86 79 77 71 +45 40 39 38 36 35 32 29 +21 15 12 11 12 +27 21 19 18 17 16 16 +94 88 85 84 82 81 80 76 +93 87 84 83 80 73 +59 54 53 56 55 +86 79 81 79 77 75 76 +80 73 74 71 71 +14 7 5 3 5 1 +95 89 91 88 83 +85 79 79 76 73 +97 92 89 87 87 85 88 +50 44 44 41 39 38 35 35 +37 32 32 29 27 26 22 +87 82 82 79 76 74 68 +43 37 35 34 30 29 +35 30 27 23 22 19 16 17 +74 67 65 61 60 59 57 57 +82 76 73 69 67 66 62 +57 52 49 45 42 41 36 +36 29 22 20 17 +45 40 37 31 34 +37 31 29 22 20 20 +64 59 52 51 48 44 +23 17 11 10 8 1 +45 50 52 53 56 60 67 +5 9 7 10 9 +34 40 44 46 48 49 +34 34 36 42 44 45 49 +67 62 63 60 59 53 +43 43 40 36 33 32 32 +90 86 84 80 77 74 71 64 +74 75 77 79 84 86 89 +37 35 37 40 42 43 47 +91 84 82 79 76 75 74 68 +31 26 24 22 21 21 21 +24 22 21 20 16 16 +18 14 12 11 8 4 4 +70 77 78 81 83 85 87 93 +36 30 26 23 23 +39 39 37 34 34 31 +42 38 39 36 35 34 30 +13 14 16 17 14 13 +18 18 16 14 10 8 7 2 +71 74 75 78 79 82 81 +56 55 59 60 62 65 +32 28 26 24 24 25 +8 12 14 18 20 22 25 25 +81 85 86 84 91 +61 62 65 66 71 75 +27 21 22 19 16 13 11 11 +1 5 6 7 11 14 +87 86 83 81 74 +69 76 76 77 79 +19 17 21 24 25 28 28 +36 30 29 25 23 26 +67 67 69 74 76 +63 67 70 70 74 +69 69 67 64 61 59 61 +80 78 75 72 69 67 63 +43 43 44 45 48 48 51 51 +60 64 67 68 71 72 73 72 +26 33 34 36 38 45 44 +99 99 97 94 90 87 85 88 +70 77 79 80 84 +38 38 41 42 40 +49 49 50 51 53 57 60 59 +82 82 81 81 80 79 82 +15 15 16 18 20 +82 80 77 80 84 +14 18 18 20 21 18 +25 25 22 19 14 +92 91 89 90 87 87 +82 78 77 75 77 77 +32 27 25 20 17 15 +91 84 78 77 74 73 76 +50 48 51 51 53 55 +57 53 50 49 48 46 +84 80 78 75 71 68 64 +84 78 77 74 71 69 66 66 +26 27 24 23 22 18 14 +80 78 77 76 69 72 +90 86 83 81 80 80 79 79 +56 49 48 50 49 46 +36 40 41 44 49 51 54 60 +77 79 80 83 84 87 91 98 +81 80 83 88 92 +38 40 39 38 35 38 +20 17 16 14 11 10 6 2 +68 69 73 76 79 83 +72 68 66 64 64 62 60 +56 63 63 65 66 67 69 69 +7 11 13 13 15 16 16 +19 25 28 30 33 40 42 +86 86 84 77 78 +26 26 23 21 19 20 19 14 +23 23 24 26 27 29 33 37 +25 28 25 22 20 17 13 +95 95 93 90 88 83 81 75 +53 53 55 60 63 65 68 67 +76 77 76 77 79 82 83 85 +51 51 50 49 48 +58 58 54 53 52 50 48 45 +26 28 26 23 23 22 18 +16 16 20 23 26 29 31 +21 25 27 29 35 39 +71 70 76 78 81 83 84 81 +97 91 88 88 85 82 81 83 +76 76 78 81 82 84 87 93 +75 72 67 64 62 +48 45 46 49 52 +29 25 22 18 16 14 +68 75 75 77 79 80 87 +69 67 64 63 56 56 +74 80 81 81 82 84 86 83 +89 90 90 93 97 +17 17 16 19 18 17 14 +12 8 7 4 2 5 +93 89 87 81 78 +88 88 91 91 93 91 +50 46 39 38 40 +87 90 89 85 84 83 83 +26 24 28 31 33 34 32 +22 18 17 16 15 15 +66 65 69 70 71 73 80 +82 83 84 81 81 +97 97 98 96 93 90 91 +67 67 69 67 70 73 76 83 +9 9 13 16 16 +79 73 71 68 64 61 57 +17 17 19 21 23 23 28 +60 63 60 59 58 55 53 53 +28 35 36 37 40 43 46 43 +57 52 51 48 46 48 +83 82 84 82 84 84 +24 23 23 20 19 19 +38 38 36 33 26 23 23 +26 31 34 37 41 43 47 +31 34 32 31 28 21 19 22 +68 72 74 74 75 +51 52 50 48 46 39 35 +91 94 92 90 86 83 81 +37 33 32 28 29 +36 36 29 26 22 +52 53 55 52 50 44 +19 26 28 29 32 35 37 39 +79 81 81 82 88 +47 47 49 51 54 57 59 59 +55 55 52 49 45 +84 80 82 81 79 78 76 74 +35 28 25 25 22 19 12 +76 82 79 80 80 +90 90 87 87 85 84 83 78 +77 84 86 88 88 92 +17 17 16 15 15 +34 37 36 33 32 33 31 27 +73 70 73 76 82 +62 68 69 72 78 79 79 +42 41 39 38 32 28 +69 66 69 68 64 +47 51 48 50 51 54 58 +53 57 60 63 64 65 71 +43 43 43 42 41 40 37 33 +69 66 64 67 74 +67 71 72 73 75 +13 11 12 15 16 19 19 +61 64 59 58 55 52 49 44 +57 56 55 52 50 47 48 +24 28 30 33 38 39 38 +78 75 72 70 70 68 71 +57 59 61 64 67 70 73 +13 16 19 21 22 25 +18 16 15 12 9 +17 18 20 23 24 26 +63 66 68 69 70 72 75 +36 38 40 43 44 +37 40 42 43 44 45 48 +44 42 39 37 35 34 +11 8 7 5 2 +52 54 55 57 58 +16 17 18 20 23 25 26 +87 86 83 80 77 74 73 +16 19 22 24 26 29 31 +29 31 33 36 37 39 +46 43 42 40 37 34 33 32 +84 87 90 91 93 95 +49 51 54 55 58 60 +63 61 59 58 56 53 50 +9 11 12 13 16 18 21 22 +61 60 59 58 56 55 +73 74 76 79 82 +88 90 93 95 96 99 +56 58 61 64 67 70 +82 79 78 75 72 70 69 +2 3 4 5 6 8 +32 31 28 27 24 23 22 +65 64 61 58 57 55 +57 55 52 49 46 45 43 40 +57 56 53 51 49 47 45 +2 4 5 7 8 10 11 +71 69 67 65 64 61 59 +46 48 49 51 53 55 +74 73 70 68 65 62 +62 64 65 68 71 +37 35 32 31 28 25 23 20 +58 57 54 51 48 45 42 40 +66 68 69 71 74 +4 7 9 12 14 17 19 22 +42 45 48 51 52 54 +50 52 53 56 57 58 +52 51 50 49 47 46 45 42 +53 51 49 48 46 43 40 +91 90 87 84 83 80 77 +87 84 82 79 78 +17 18 19 22 25 27 29 32 +94 91 88 87 86 84 +90 91 92 93 95 98 +4 6 9 11 13 +79 81 84 87 89 92 94 96 +42 40 37 36 34 32 29 28 +70 71 72 74 76 +22 25 28 30 33 36 38 41 +52 54 57 60 62 63 +72 71 69 66 63 +18 15 13 11 8 6 3 1 +31 28 26 23 21 19 18 17 +52 54 56 59 60 63 65 +5 7 8 9 10 12 14 17 +93 92 89 88 85 +75 73 70 69 68 67 64 +18 19 21 22 25 +31 34 36 39 41 44 46 +97 96 94 92 90 87 84 +28 26 23 21 18 +21 18 15 14 13 11 +13 16 17 19 20 +49 46 43 40 38 35 +72 69 67 65 63 62 59 56 +60 57 54 52 50 49 46 +37 40 41 42 43 46 47 +59 61 64 65 67 +33 31 28 25 22 19 18 17 +2 3 4 7 8 10 12 +82 80 79 76 74 71 69 68 +45 42 39 38 37 34 31 30 +40 41 43 44 47 50 +40 41 42 44 45 +75 78 80 81 84 85 +32 34 35 37 39 40 41 44 +51 49 47 44 43 42 40 37 +35 38 41 42 45 47 48 51 +33 34 35 37 38 40 42 43 +41 38 35 33 31 28 25 22 +64 67 69 70 71 73 74 +62 63 65 67 68 70 73 +92 89 88 85 82 +18 15 12 9 8 5 3 +48 50 52 55 56 57 +56 54 52 50 47 44 43 41 +82 83 85 88 89 90 +68 70 72 74 77 78 +28 26 24 22 21 19 17 15 +86 87 89 90 93 94 95 +48 47 46 43 40 38 36 34 +42 39 37 35 33 31 29 26 +75 78 81 84 86 88 91 +97 96 94 93 90 +32 33 36 37 38 +31 28 27 24 21 18 15 14 +90 91 93 96 98 99 +72 75 76 79 81 +26 29 31 33 34 35 36 38 +43 42 39 38 37 +23 20 17 15 14 +82 83 86 89 92 95 +14 12 11 9 6 +70 71 72 73 74 77 +74 77 80 81 82 83 86 89 +59 61 63 65 68 71 72 +69 70 72 75 78 79 81 +51 54 56 59 62 64 65 68 +83 85 87 88 89 +83 84 87 90 91 94 95 +59 57 54 53 50 +16 14 12 9 6 3 +72 69 67 64 62 61 58 57 +99 96 95 94 91 89 86 83 +45 42 40 39 36 +65 66 67 70 73 74 76 +39 42 45 48 49 52 +64 61 60 57 55 54 51 50 +42 39 36 34 31 30 +28 31 32 33 34 36 39 40 +38 40 43 45 46 47 50 +95 94 91 89 87 +38 41 43 45 46 48 51 54 +49 48 45 44 43 40 39 37 +5 8 10 12 15 18 19 22 +34 35 37 39 41 42 +65 66 67 68 71 +42 39 36 34 33 32 +81 78 77 75 72 69 +60 59 58 55 53 51 +79 80 82 84 85 88 91 +79 76 73 70 67 64 62 +99 96 95 92 91 88 87 +15 14 11 9 7 6 +11 9 8 6 3 +38 41 43 44 46 48 +30 31 32 34 36 37 38 +80 83 84 87 89 +39 37 36 34 33 +38 35 32 30 28 26 25 +42 40 38 36 33 +54 56 59 61 63 +8 11 13 15 16 19 22 +75 77 80 82 83 86 +17 20 23 24 27 28 30 33 +76 77 79 80 82 84 +33 36 39 42 43 46 49 50 +16 18 20 22 25 28 +44 46 49 51 53 +39 41 44 46 47 +75 76 77 78 80 83 85 +8 11 12 14 17 20 22 23 +64 63 60 58 57 54 53 51 +59 61 63 64 65 66 67 68 +43 41 38 35 32 29 26 23 +79 78 76 74 72 70 67 +35 37 40 43 45 46 +4 5 6 8 10 12 +34 32 29 28 25 23 21 +60 62 64 67 70 71 +40 38 37 35 33 32 30 +67 70 73 75 78 80 83 84 +34 35 38 40 42 +26 28 29 30 33 +55 53 50 48 47 46 43 41 +57 54 52 50 48 45 42 39 +57 59 62 65 67 +25 27 28 29 31 +4 5 6 7 10 12 15 +59 62 65 67 68 70 +33 30 28 27 26 24 +30 28 27 26 23 +29 32 34 35 36 +73 70 69 67 64 61 +59 60 61 63 66 67 70 +63 61 58 57 54 +48 49 52 53 55 +54 53 50 49 48 47 46 +26 23 21 19 17 +29 28 26 25 23 +25 23 21 20 18 15 13 10 +76 74 72 69 66 +98 95 92 89 86 84 81 79 +90 87 86 84 82 79 76 +48 51 54 55 57 58 60 61 +93 92 91 89 86 84 83 +16 14 13 10 7 +44 41 39 38 37 +85 82 79 77 75 74 73 +14 16 19 21 23 +61 58 57 56 54 51 48 47 +19 21 22 25 26 27 28 29 +74 72 69 68 66 63 61 60 +56 58 60 62 64 65 +56 55 53 51 49 48 47 45 +78 80 81 84 85 86 +28 26 25 22 20 17 16 +47 49 52 53 55 58 +90 91 93 94 95 +9 12 15 16 18 21 22 25 +57 55 54 53 50 48 47 +77 79 81 83 85 87 90 +42 39 37 34 33 +87 84 83 80 77 +21 19 17 16 15 12 +58 61 63 65 68 71 72 +46 49 50 51 54 56 57 +61 58 57 54 51 48 +18 21 23 26 29 31 +80 77 74 73 71 +85 83 82 80 79 78 75 +94 93 90 87 85 83 81 80 +50 48 47 46 45 44 43 +32 31 29 28 26 23 21 +90 89 88 87 85 +63 61 60 58 56 55 54 +84 81 80 77 75 74 +86 83 82 80 79 76 75 74 +53 55 58 60 62 65 66 +84 85 86 89 90 93 +18 16 13 12 11 +13 15 16 18 20 23 25 26 +7 10 11 13 14 +81 80 77 76 74 73 71 +9 8 7 4 3 +61 63 65 67 68 70 72 +5 6 8 11 12 14 16 +54 57 59 60 62 64 65 +25 28 31 32 33 36 38 40 +82 79 77 75 72 70 67 66 +84 81 79 77 76 +6 8 11 14 17 18 21 22 +12 15 17 20 21 24 +81 84 86 87 88 91 +43 45 46 48 50 51 52 54 +57 56 53 51 50 49 47 46 +65 64 63 61 59 58 56 54 +40 37 35 32 30 29 27 +82 79 77 76 74 71 +45 42 41 39 36 34 33 +20 23 25 27 28 +42 43 46 48 49 +42 45 47 49 50 53 56 +66 65 64 62 59 57 54 +49 48 46 44 41 39 38 +38 35 34 32 31 29 28 +22 23 26 27 29 +67 65 63 60 57 54 +20 22 25 27 28 30 33 36 +20 23 24 25 26 +69 71 72 73 74 76 79 81 +77 74 73 72 69 +3 5 8 10 11 12 13 14 +47 46 43 41 38 +10 11 12 14 15 17 +18 17 15 12 11 8 5 +35 37 40 41 43 44 45 +19 20 22 24 26 27 28 +70 69 67 64 61 59 57 56 +83 82 80 78 75 73 72 71 +51 48 47 44 42 41 40 +66 68 70 73 74 +93 91 90 88 85 +11 9 8 7 6 +40 37 35 33 32 31 28 +25 27 29 32 35 +35 36 38 39 41 +40 42 45 47 50 51 54 +49 52 54 56 57 60 +49 52 53 56 58 61 63 66 +64 62 59 57 56 +63 64 65 66 67 68 +70 72 73 75 78 +82 79 78 75 73 +67 66 65 63 61 60 58 55 +4 5 7 9 11 13 +71 69 67 65 63 60 57 +90 87 84 83 82 80 77 74 +31 28 25 23 21 19 17 +48 51 52 55 57 59 62 +36 34 31 30 27 25 +26 29 31 32 33 36 +44 43 40 38 37 +62 65 68 70 73 75 +61 62 64 65 68 69 72 +57 60 63 66 68 71 73 +35 37 39 40 42 43 45 +93 91 90 87 85 +24 23 21 20 19 17 15 13 +82 83 84 85 88 +30 31 32 35 37 +32 31 30 29 28 26 23 21 +57 55 53 52 49 +62 65 66 67 68 70 +64 65 68 69 70 73 +56 57 60 63 66 67 68 70 +12 14 17 19 22 24 25 27 +38 35 32 30 28 25 22 20 +73 75 76 77 79 82 83 +31 29 26 23 20 +25 26 27 30 33 34 +18 17 14 11 8 6 +25 23 22 20 17 +55 56 58 59 62 64 66 +79 80 82 85 88 89 91 92 +68 67 65 62 60 +84 87 88 89 92 93 96 +30 32 33 35 38 41 44 +86 85 82 81 79 76 75 +48 47 44 42 40 38 +72 71 69 66 63 62 +46 45 43 41 39 37 +44 42 41 40 39 38 36 33 +23 22 20 19 18 +29 30 32 33 36 38 +35 34 31 28 27 25 23 21 +54 52 50 47 45 44 43 +96 93 90 89 87 +76 77 78 81 84 86 +13 15 16 19 22 +58 60 61 63 64 66 67 +78 77 76 74 73 71 +35 38 41 44 47 49 +73 74 76 77 78 +28 26 24 23 22 21 +49 51 52 55 56 +88 91 92 95 96 99 +85 88 90 93 94 +73 76 78 80 81 83 84 +38 35 33 32 31 29 +32 29 26 23 22 20 18 16 +70 69 68 65 62 59 57 54 +80 79 76 73 70 +12 10 9 7 6 +75 72 71 69 67 +64 61 59 58 57 56 +88 90 92 95 96 +58 60 63 64 66 +99 96 95 92 91 90 89 87 +16 17 19 22 24 25 28 +77 79 81 84 85 86 +28 26 23 21 19 18 +82 81 80 79 76 74 73 70 +76 75 74 73 71 70 69 68 +94 92 91 88 85 +11 12 13 14 17 18 20 +74 73 71 69 67 65 62 61 +25 26 27 28 30 32 35 +61 64 67 68 70 73 +58 56 55 54 51 50 +69 66 65 64 61 59 +47 50 53 55 56 +26 25 22 19 16 14 12 11 +51 52 54 57 60 61 +60 59 56 55 54 52 51 +46 47 50 53 54 57 59 61 \ No newline at end of file diff --git a/2024/2/two.py b/2024/2/two.py new file mode 100644 index 0000000..7812244 --- /dev/null +++ b/2024/2/two.py @@ -0,0 +1,66 @@ +from collections import Counter +reports = [i.rstrip() for i in open("input").readlines()] +reports = [[int(j) for j in i.split(' ')] for i in reports] + +def reduce_report_to_state(report, outer_level=True): + last = None + diff = None + sign = 0 + + for index, item in enumerate(report): + bad = False + if not last: + last = item + continue + + diff = item - last + if diff == 0: + print("diff bad") + bad = True + + thissign = 1 if diff > 0 else -1 + print(thissign, diff) + if sign == 0: + sign = thissign + + if sign != thissign: + print("sign bad") + bad = True + + adiff = abs(diff) + print(adiff) + + if adiff > 3 or adiff < 1: + print("range bad") + bad = True + + last = item + if bad: + return False + return True + +def reduce_with_deference(report): + verdict = reduce_report_to_state(report) + if not verdict: + for i in range(len(report) - 1): + sliced = report[:i + 1] + report[i + 2:] + print(report) + print(sliced) + second_result = reduce_report_to_state( + sliced + ) + if second_result: + return True + continue + + return verdict + +results = [] +for i in reports: + results.append(reduce_with_deference(i)) + +print( + sum( + [1 if i else 0 for i in results] + ) +) \ No newline at end of file diff --git a/2024/3/input b/2024/3/input new file mode 100644 index 0000000..a91a300 --- /dev/null +++ b/2024/3/input @@ -0,0 +1,6 @@ +^mul(721,815)who()&[how()mul(990,467)select()why();what(327,762)?@mul(636,928),[!#$??:+do()where()@%>@&],<}mul(766,598)mul(117,278)where()$mul(469,793)[~]where()mul(884,216)mul(795,723){what()mul(184,793)when()!*&mul(87,768)(mul(436,871)>>?::why(645,65)~/why()why()mul(761,50)'&-: &;mul(450,66)>what()-how(244,505)}mul(737,574)$where()who()!select()mul(828,224) %/((mul(612,706)[mul(56,369)<+when(871,669)+when()/^#when()]mul(33,835)when()$what()from()'when(575,599)mul(98,444)(&from(399,328)]mul(149,861)%who()mul(493,109)+#(how()!$}-where() mul(992,42)when()>mul(966,422) {mul(128,242){$,when()-what()from()who()where()/&what()mul(111,554)-+don't()}}/(^(&+mul(130,716)[+!/mul(585,272){how()/:who()who()where()mul(638,890)>mul(892,569) -/;mul(365,771)mul(703,962)mul(891,916)!why()[{:!why()!mul(85,405)^?$what()where()where()~,(select():when()mul(102,589)who()]#when()^do()$when()+*mul(433,264)!%where() mul(676,814){who()mul(791,825)?mul(69,953)}mul(348,556)##how()what()who(){[>?how(151,194)mul(346,158)mul(698,833)>(:mul(249,39)!{<{//~when(){mul(686,621)what()mul(516,43)*who()mul(326,716)select()do()^#$/&mul(692,750)when()&[?->{mul(218,8)&&mulwho() $where()}{}#mul(820,744)/mul(230,927)^ :where(351,105)~/(;mul(900,172)$]{?$#where()mul(652,481)<}don't()*where()select(200,394)select()#who()mul(650,602):}when(552,753)-when()how()'mul(349,401),&how(){'mul(989,165)%$* ,,&mul(906,532)mul(701,543)when():?#what()~+how()mul(113,743)[$;select()!how()mul(68who()mul(153,928)%()^[from()mul(555,552)@select(522,482)mul(295,900)where()/mul(189,189)+'&mul(490,144)++/&from():why()+*do()how()[~when(612,413)-when()?do()}who()mul@/why() {?-%%mul(126,29)@+from();mul(548,673)mul(51,970)--}what()~,what()(mul(261,780)@;'why()>;what()mul(843,665)when();@mul(575,431)]:;>{#mul(123,103);]where()where() mul(331,417)?+select()}when()mul(730,923what()who(514,796)where(716,633);when());why(122,722)(mul(923,885)where()''#'where(645,705)}#select()!don't()where(),,;!}&^mul(609-'(mul(245,580):mul(898,814)how()+mul(999,143)),select()mul(251,507)(%<:who()why()how()/%mul(192,864) +*,/~):^[mul(802,939~;!:@mul(656,831)}]?~mul(92,389)/:who()&why()'mul(698,92):who()]/< @@@mul(956,581)who(252,379),#&,%mul(315,398)mul(518,43)@, &/[* mul(344,100)how();mul(826,831)when()select()++'mul(175,965) [ mul(786,297)from()how(520,671):*?]&%]mul(647,834)why()when()select()/mul(585,934)!@<&how()!/mul(965,795)!,@/how())(#{mul(701,685) mul(51,440)/)mul(382,190)@why()how()>>#+;%{mul(808,654)#*mul(128,793)%:->mul(397,504)];$]from()mulselect(533,968))>why();^mul(661,310)mul(415,957)}?&%#@(mul(261,4)*;mul(292,885)!mul(639,791)from()how()when()mul(451,10)mul(853,231)+~+']>mul(543,437)mul(218,441) *mul(447,927)why()from()mul(178,473)how()<*why()[&how()how(),mul(139,541)>~why(644,46) who()what()+~(mul(888,667)^from()&^when()^when()-where():mul(585,185)>from())]+mul(766,787)mul(16,587)%@mul(475,198){^mul(353,741)&~]$<;]:mul(529,533)where()~mul(980,696)how()when()/*>when()#^don't()![]#[*%-mul(315,512/when(57,948)?why()mul(107,632)%>&who()[mul(554,91):from()!who()?how()why()%#when(313,134)don't()mul(694,300)/~(,+who(382,968)}from()mul(69,889)')why(768,374)+how()mul(338,324)$select()}] select()mul(572,647):from()mul(12,530)mul(651,890)mul~@?mul(841,284)]%^where()mul(201,525)where()(do()&@}]how()<^who()]&mul(166,168)>;mul(419,733)!mul(197,692)select()+>-@'&{who()mul(936,290)select()/when()#(/when()mul(201,918)~,how()>&[@<}'mul(400,452)<&[[%^select(131,478)$where()^mul(31,294)@{who()mul(275,538)^]@;}]&^mul(362,151)~mul(840,788(,/;&why()^[[don't()mul(615,413)where()$mul(404,421)select()@,when()~+%}$mul(157,970)$mul(846,324)what()mul(449,574)-mul(517,831)* +when(478,401)?]mul(991,421)@%mul%select()%who()mul(970,585),&[?/'?~:/mul(831,536)^]how()>mul(577,864)^$+mul(391,353)who()what()@${mul(144,420)])why()* !:mul(595,206),select();when()-)mul(723,270)+!*~^]where()mul(629,243)how()(mul(651,134)'')$)why():'$mul(488,642)mul(975:#from()^?%mul(663,263)#+!(from()/;why()(mul(4,649)mul(520,137)*'>mul[?where()-:%;mul(647,34):-what()why()select()-mul(549,57)}mul(917,540)where()?why()when()why()why()/$!select()mul(938,743{mul(61,74)+@mul(405,137)$who()mul(937,685]'^mul(965,910)}what(838,413)mul(975,550){}+?++<'mul(928,26how(128,389)'?>#who()<-select()do()%[how()]select()@[ >/ mul(114from()}*what():when()#when();mul(613,512)where()[~~;@(how()^mul(46:where()($mul(773,236)^*from(101,73)$mul(127,952)):?,:<-mul(12,239)mul(683,676)how()/[#mul(650,459)#;'mul(252,579)?from()@[do()mulwhere()]!,->$]~>mul(657,580)select()$>+;when()>mul(983,621)*from()}how()/]#!<{mul(135,869)!@:what()select()}#mul(947,363)mul(267,51)#mul(178,200)mul(131,552)^(why()mul$-+/~-~-^[who()mul(763,94)&(]% ~^/>mul(820,422)&,select()%: !mul(27,886)select()what()+/}^@what(),mul(704,766)*[why()why()mul(358,218)-&>when()mul(432,681)?% ?mul(502,580)]{::'*!]mul(237,998)how()++where()who()from()what()/mul(897,575)how()how()+?&>}mul(696,285)select()] {/(+mul(340,384);mul(164^from()-%~{mul(283,522)&+'%~- )}where()mul(237,601){! ~mul(19,553)/(#,when()-from()from()!mul(933,578):(@#^from()#>*mul(296,919)from()what()-mul(239,343)~$when()mul(184,945)&!?&+!#when()why()/mul(814,466)@how()where():why()what()%/mul(498$!where()mul(121,233)+<)~select(89,323):;}where()why()mul(293,662)[from()mul~}mul(96,122))when()who()who() ':(}how()#mul(303,846)+&^%;]select()!why()mul(856,3)$'where()how(),mul(985,407)~mul(75,217)>%@({@don't()how()mul(601,409)]$-}[^@&don't()@>from()mul(313,975)!$when()-;<~+~mul(273,261)[-(mul(849,769)*select()how(480,586)from():+)mul(263,796)%what()why():!{mul(732,962)@mul(541,715)who():)++-?~select()mul(272,709),%how()&from()where()mul(128,863)-%>mul(66,521);what(),&~@}+:{mul(683,867)^mul(967,554))+(mul(163,187<:}; where(149,753),-!mul(454,102)]from(581,325)^>^how()?select()~'mul(612,695)>$~;?from(335,390)>;<(mul(158,809)mul(994,415)why()^who()('mul(906,133)[:mul(454,783)select()}/ mul(496,587)&$[)]<*<^%mul(916,337) *where()(,}from()%mul(781,945))^select();why())mul(966,406)!$+(why()}<^mul(118,864)/how()mul(946,437)#{mul(723,269)%*&*^when()$mul(337,544)*-select()!when())]what()[$mul(624,678)&;who()what()how()$@mul(41,821)mul(860,521)&-why()from())@^where()'mul(627,836)?>;?,$mul(862,746)when()from()&~$who()select(171,606)mul(325,203)?from(569,805)what()%select()]mul(316,107)?~&&from();^}&when()#mul(229,118)what()what()why()-* +%;mul(635,909)mul(965,642)^mul(942select()]{mul(793,836)@/+why()*>/(mul(453,491)>'^where(){select()select()%mul(628,54)*>]?select()$who();mul(508,795)}%!%>mul(823,280)from()%mul(247,633):mul(779,419)/#^*<}?mul(921,457)where() -where(439,307)?+/how()+(mul(231,858) :mul(205,634):[how()?-'^<'mul(160,480)%!)(what()why()^^~,mul(276,727)when()^[ ##select()mul(382,146)where()when():?^[]%-mul(976,132how()^-&how():-)!#/mul(25,564)!(when(464,814)how()when(440,219)who()[~where()mul(956,412))]@select()who()$~']'mul(507,562)&}> mulhow()$/ &&,(<-}#!/usr/bin/perl^when():{+^('how()^mul(452,533)@where()?$mul(442,913)how(){]from()select()$how()select()from(),mul(484,240) +&mul(444,854)when()mul(774,478)where()&&^ mul(922,900)how()how()]+{what() mul(606,127)from()]what(){[what()mul(721,275)mul(235,360)(%'what()*)mul(572,460)'mul(48,7)who()],where()from()>>mul(593,878)where()%<>&mul(820,458)from()&select(271,971)!do()where():>-mul(355,304)from()(;why();[select()}mul(805,242)+![select();mul(775,789)~mul(628,350)$$from()@(*how(){'mul(960,498)why()<>select(440,141)(mul(670,865),>what()+::mul(208,606)mul(329,619)$don't()^from()-where(651,585)how();,how(753,435)>'mul(198,179)~mul(687,19)#->/do()+%$]^mul(36,106)%where()who();)mul(146,12)^/-mul(957$mul(722,483)(^where()mul(791,915)&+^who()!do()}>'%:^:mul(419,941)/don't(){when()+when()~*(^mul(595,305)from()why(),/how()where()]}mul(819;^&what() ]-where()&who()>mul(335,130)what()]where()[/where()what()?;mul(193,281)~,who():+why()mul(346,672)){@do();^>select(629,407)where(){^/!'mul(523,137)]&select()$/?/^mul(757,373)don't();when(648,805)mul(937,925)where()mul(52,179)?*&}>;mul(820,72)from()mul/}from();&!when()what()mul(341,113)%when(),/+@@mul(282,840)%what(845,759)?/%?who(38,906)mul(790,88)select()when()(-}&select()/mul(460,748)}#why()how()^}($from()mul(736,446)#$/don't()@*:<$mul(647,695) where():where()who(){mul(124,189)}:~@mul(567,682)from()''mul(537,138)mul(126,676)>why(){how()/;select()what()mul(211,918)]@*%where()<;;!mul(367,207)',?mul(699,852)what()>,)~mul(223,597)+what()how(556,77)+don't()/@/:[{-mul(610,646)(why()who()how()*}mul(388,590):why()!mul(777,494)[who()+mul(332,45)!:when()mul(107,845)who()(]from()select()mul(518,311){*mul(75,698)(/!~#@$where()!,mul(55,490) :{where()mul(681,43)}~>]--^:$]mul(55,980){;mul(443,44)@mul(750,251)from()$$&#when()>mul(979who()!how()mul(504,318)mul(402,389)[!#@why(525,210)+mul(984,318)when()how()}%/mul(221,803){who()how()~$mul(88,963)>}$&from()where()+]from()%mul(38,316),mul(207,135)who()what()what()+&mul(627,85)]: &?why()?*--mul(79,741)+(?~%!!mul(51,132)where()@where(994,962)mul(691,851)from()+why(): {[mul(543,495&#how(){(;how()['mul(352,179)/)+ /~mul(250,222)^+<} mul(719,257)%from()why():^?!^[don't()(,where()$mul(894,942)how()!(where()$mul(506,810) from()}%@)**mul(261,233)mul(179,77)>$mul(248&why()%where())+%}<,who()mul(920,816);mul(384,108>mul(954,663)mul(11,936)who()&%{:mul(698,682)who()select(903,689)who()from()-where()/+mul(332,753) where(){?how(52,910) )(what()mul(580,139)[[~,('mul(762,762)from()~}- ~*^[mul(348,345)%*mul(776,555)how()/when()-!&:+mul(354,880)when()%<>;mul(121,687)-#:]when()why()/::mulwhere()from()mul(353,738)@&}#don't()mul(888,259):{[ +*mul(457,716){from()mul(784,718)::^mul(34,955),from()select(545,368)%!]?/mul(795,164)-?)why()how()'%'[who()mul(754,424)from()-select()from()^mul(772,122)where()where()where()select()?where()%-mul(849,64)what()!$'&++mul(557,560)!? :]select()(mul(824,973)>;?{(mul(333,526)why(),mul(814,560{from()#mul(860,603)what()]{where()select()mul(209,175);when()>where()mul(242,542) [[mul(563,973)-mul-&$;)~why()$%why()mul(443,590)?[<;when()don't()what()where()}where()what()mul(178when()from()where()where(244,944)mul(674,125)'mul(709,133)'<):?&why()&>%+,mul) , !-mul(160,387)~&^mul(725,120)who()[]mul(512,611)select()/?mul(617,372)select()>who()[(mul(802,268)-)*&:mul(815,27)]what() )#-,%<&mul(429,97)}!&mul(106,545){~: when()+,mul(438,161/>--mul(818,804)<))don't()[>mul(602,506)mul(55,393)*[:mul(157,531)^don't()?{+mul(554,938)*;mul(385,567:who()>how()&+?*mul(574,353)mul(984,83)-how()-mul(872,273)((mul(517,792)?select()why()^mul(730,625){{'mul(83,516)when()((mul(130,817):mul(519,651)]&/why()!mul(836,209)[%,[mul(213,670) )what()>;@!mul(611,517)>]mul(197,385)@mul(68,987)mul(162,106):when(7,896):mul(796,638)>^!/'>mul(845,941)/where()do()#:what()what()?~&?mul(806,128)]%why()mul(348,883),'+mul(336,235): 'how()mul(855,266)@$^why()mul(742,387)who()!mul(995,906):]]when()<)*from()(&mul(764,180)~how()@# :mul(707,290)#/{@mul(65,579)-who()where(960,596)>*(don't()from(766,430)where()mul(75,404)(when(457,596)#&mul(612,799)#)where()mul(401,474)what()%where()#>+mul(31,289)&>)?/(-mul(189,149)>~,when():mul(985,763)$&who()#%!mul(804,329)>'mul(229,945) don't()who()who(84,291)*select()why(),;,?mul(470,948)from(681,767):*who()&%mul(850,581)what()>(#}%}mul(636%mul(641,599)mul(184,164)mul(575,439);({{mul(738^--^)%mul(60,730)where()^]from()who()-/:what(848,902)mul(958,89)},where(148,634)-mul(371,786)when()?mul(151,757)select(973,278)!)select()]'who(130,338)):mul(644,833)mul(480,246)what()mul(305,497)^mul(233,355),}who(563,221)>who()where()/when()'mul(412,498^how()-$?what()&[select()mul(179,439)&where()^{#[%mul(510,163)when()where(353,632)':mul(629,922)+%}:+how();@how(103,365)}mul(961,420)~select()*~:#mul(914,166)who()/!why()mul(392,362){<@what(){from()select()why(917,470);why()mul(217,122)~}what()where()$(}mul(422,535)(*how()}&mul(777,997)&[where()]mul(664,558)!/+)*{ why()mul(308,60)~[*how()what(){,!from()where()mul(234,662)*)+who() who(){]{mul(638,389)select()$%;}~how()who()mul(223,862):what()mul(150,399)mul(566,885)mul(231,725)[/mul(230,942)')-:)who()'{where()^mul(400,853)why()@[from()where()&[@<^mul(325,706)+-{mul(115,2)&&?*{mul(954,823);what()mul(600,695)when()how()when()*;:[-mul(78,362)#select()/$(>select()$^mul(981,64)>mul(899,724)what()}who()mul(94,857)@$&<:)mul(142,322)&&;/?*who()?where(315,764)mul(169,174)&/%('mul(340,253);@)[select(607,401))select()mul(683,991)&:how()select()[<#how()mul(186,106){>!(*mul(490,980)(]))from()]where(84,603)mul(342,395what(){)&];why()who()what()[%mul(751,371)who(720,254) why()when()what()}select(455,617)'mul(53,661),:/>:!mul(446,454-?what():$[[+mul(498,205)>(mul(759,494)mul&>?:^'} mul(867,709)mul(605,504)what()[-!}!mul(106?>mul(239,94)+>where()#+! mul(618,663)&--':%mul(57,203)/![:,$select()mul(614,15)^]mul(570,897)what())?who(812,559)/*don't()}mul(150,813)&+what()]~!+mul(999,729)[mul(110,688)>:select()@>select()/,who()}mul(22,21)how()~^- $+#from() mul(45,829)don't()([why()+-:>mul(488,321)&*-mul(652,853)>when()^ how()where()select()*mul(468,965)++mul(781,52)why()>+~^}]mul(268,658) ::where()>'mul(233,327):select()?}mul(269,680)/{+>@:(select()$how()mul(322,587)/;mul(406,648):*who()/mul(53,8)don't()::mul(340,161)/?>/&don't()select()*>mul(315,698)]who())how()[,how()how()}mul(987,159)&!mul(979,457)~[-where()#mul(381,476){from(261,299)from()};^,where()from()?mul(681,344)*+when()why()@;(#&don't()~ ,select()where()mul(239,813)!mul(808,143)what()(>select()!what()what()!,mul(494,477)do()select()how()-+where()from()what()!mul(797,39)>}}}+[(^why()how()mul(393,474);{mul(159,285)!how()[}mul(936,615)]mul(311,234):>)why()!mul(70,105),[]mul(143,155)?who()/ +(when()select()~mul(225,35)/^!mul(637,97)~!&*#+<$mul(886,753)what()!]what()(mul(513,884)~how()-+]mul(906,496)+!&where(){>' ;when()mul(302,264)@!~/where()?what()$do()>$who(391,417)what(106,572)mul(97,315)'-mul(211,823)},/mul(460,903)!;#{ }~'mul(264,775)mul(913,491)-when()~%[how()/}?%mul(482,242)@+<:from()$'don't()~;mul(396,591){from():where()]~mul(525,827)when()#why()from() #%*who()mul(407,541)*mul(484,568)mul(62,785) what()@what()when()mul(908,348)%>]how()mul(531,232)]how(827,75)>-don't() ??++mul(7,189)#do()who()mul(661,112);who()'--;mul(793,568)who()select()-~{mul(937,614)mul(775,294)<'when()~^;+mul(140,643))+<#' \ No newline at end of file diff --git a/2024/3/two.py b/2024/3/two.py new file mode 100644 index 0000000..0864a5f --- /dev/null +++ b/2024/3/two.py @@ -0,0 +1,26 @@ +import re +input = open("input").read() + +regex = re.compile('mul\([0-9]{1,},[0-9]{1,}\)|don\'t\(\)|do\(\)') +results = regex.findall(input) +mul_enabled = True +total = 0 +for i in results: + print(i) + if i == "do()": + mul_enabled = True + continue + elif i == "don't()": + mul_enabled = False + continue + + if not mul_enabled: + continue + splitted = i.replace('(', ',').replace(')', ',').split(',') + left = int(splitted[1]) + right = int(splitted[2]) + + total += left * right +print(total) + + diff --git a/2024/4/input b/2024/4/input new file mode 100644 index 0000000..1b4dc00 --- /dev/null +++ b/2024/4/input @@ -0,0 +1,140 @@ +XMMMSMMXMSXMXMAXSMMAXXXXSXXASXSASAMSXMAXAAMSMMMSXSAMXMMXMASMMMSXMXSAMXSASAMXXXXMMMMMMXMXSMXSMSMSMSXSSXSMSSMSAMMXXSAMXMXMXSMSMMASMXMAASMSMMMM +MSMXAASXMSASAAAXSASMSAMXMMMXAAMMMASMMXSXMXSAMAAMXSMMASXSSXMAAAAAMAMAXASAXMMSMMMXSAAASMMAMSAMASAAASXMAMAAAAXMAMAASAMSAMXMAAMAMAASMMMSXMAAMAAM +AAMMXXMXASAMXSSMSAMAXAMMSAXMMSMSSXMXSAXASXSASMXMAXASMMSAAASXMSSMMASMMMMMMAAAAXXAXMXMXAMAXMMSAMSMXMAXMXMMMSMSAMMXSAASASMMAXSASMMXAAAMMMSMSMXX +SSSSXASMMMSMAXXAMXMXMXMASXSAAAAXMXXXMASAMMSAMASMMSAMAXXMSMMMMAMASAXAAXASAMXSSMMMSMSSSMMSSMXMAXMMSSMMXMMAMAASXSXMSMMSAMXSAXAMMASXMMMSAXAAAASX +XAAMAMXAAAAMXMMMAAMAAAMMSXXMSSSMMSMAMAMAMAMXMAMAMAMMXMSXXMASMAXAMXSXMXMXXSAMAMAAAAAAXXAAAXXMMMMAAAAMMXSASMXMXMMMXMAMMMAMXSMAXAMAAMASXSMSXMAA +MMMMAXSMMSSMSXAASXSASXSMMASAAAAMAAAMMMSXMXMAMXSAMSASAMXAXSMMSSMMXMAXMSMMAMXMAASXMSMMMMXSAMSMSMMMSXXMAASXXXAXAAAMAMSSMMXSASXSMAXMMMAXAXAMMSMA +MXSSMMMSMMMAAMMMXAMXMXAAXAMMMSMMSMSXAX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MMMAXAAXSSSSMSMXAAXAMXMMSAMAAASAMMAA +MSMMMXMASMXSAMXMXSXSASAASMSSSXSSSMSAMAXMMXMAXMSMMSMSXSAMXMMSXXAAAXXMXAXXMMASAASASXMSAAASAMMSSMSAAAAAMXAAASASMMSMAXAAAASMSMSAMXAAMXXAMXMXMMMS +AMASAAAAMXXMASXMAMAMASMMMAAAAAMAAAAAMAXSMSMSMMAAAXAXASASMSSXMMSMMSSMMMMMSAAMMXMXMAAMMSXSASAAMAMMSMMSSMSSMSAXMAMMMMSMMMAXXMAAMSMXSASXXMASXSXX +MAAMSAMXSXMSAMXMASAMAMAAMMMMMAMMSMSXMASXAAAAXSSMMMXMASAAAXMASAMAAAMXASAASMXMXASXSMMXMMMSAMMSMAMMMMXMAXMAAMAMMASAAAAAAXMXMASAMXAXMASXAXAASMAX +AMSXXXMXAMAMXMSAMXMSMSSSSMSAXSMMXXMASXAMMMMMMMASAMXXXMMMAMSAMMSMMSSSMSMXSSXMSXSMXSAXSXMMSMAAMXSAMXXSXMSMMMAMMMSXMSSSMSXSAMXAXXSXMSMMXMASAMXM \ No newline at end of file diff --git a/2024/4/one.py b/2024/4/one.py new file mode 100644 index 0000000..d02212a --- /dev/null +++ b/2024/4/one.py @@ -0,0 +1,96 @@ +from itertools import chain +import re +filename = 'sample' +input = [list(i.rstrip()) for i in open(filename).readlines()] + +def generate_horizontal_cross_sections(search): + return search + +def generate_vertical_cross_sections(search): + output = [] + for row in range(len(input[0])): + current = [] + for line in search: + current.append(line[row]) + + output.append(current) + + return output + +def generate_diagonal_cross_sections(search): + modulo = len(search[0]) + concat = ''.join(chain(*search)) + output = [] + for offset in range(len(concat)): + current = [] + index = offset + while index % modulo != 0 and index < len(concat): + current.append(concat[index]) + index += modulo - 1 + try: + current.append(concat[index]) + except IndexError: + pass + output.append(current) + + output = [i for i in output if len(i) >= 4] + return output + +def generate_antidiagonal_cross_sections(search): + # start from the points on the right and bottom edges + # of the array, and then work northwest diagonally + indexes_to_start = [] + modulo = len(search[0]) + concat = ''.join(chain(*search)) + + index = modulo - 1 + while index < len(concat): + indexes_to_start.append(index) + index += modulo + + index -= modulo + while index % modulo != 0: + indexes_to_start.append(index) + index -= 1 + + indexes_to_start.append(index) + + # work up northwest + output = [] + + for index in indexes_to_start: + current = [] + while index % modulo != 0 and index > 0: + current.append(concat[index]) + index -= modulo + 1 + + if index > 0: current.append(concat[index]) + + output.append(current) + + output = [i for i in output if len(i) >= 4] + return output + +search_space = [ + *generate_horizontal_cross_sections(input), + *generate_vertical_cross_sections(input), + *generate_diagonal_cross_sections(input), + *generate_antidiagonal_cross_sections(input), +] + +xmas = re.compile('XMAS') + +total = 0 +for item in search_space: + joined = ''.join(item) + print(joined) + results = xmas.findall(joined) + print(results) + total += len(results) + joined = ''.join(reversed(item)) + print(joined) + results = xmas.findall(joined) + print(results) + total += len(results) + +print(results) \ No newline at end of file diff --git a/2024/4/sample b/2024/4/sample new file mode 100644 index 0000000..c41c5ea --- /dev/null +++ b/2024/4/sample @@ -0,0 +1,10 @@ +MMMSXXMASM +MSAMXMSMSA +AMXSXMAAMM +MSAMASMSMX +XMASAMXAMM +XXAMMXXAMA +SMSMSASXSS +SAXAMASAAA +MAMMMXMMMM +MXMXAXMASX \ No newline at end of file