LONPSESXZSOLTBGAMF3UH5EUSQVM4S3ZUIOSEZ43BARRZNVQAFZQC [{:dependencies {org.clojure/clojure {:vsn "1.11.1", :native-prefix nil}, org.clojure/spec.alpha {:vsn "0.3.218", :native-prefix nil}, org.clojure/core.specs.alpha {:vsn "0.2.62", :native-prefix nil}, nrepl {:vsn "1.0.0", :native-prefix nil}, org.nrepl/incomplete {:vsn "0.1.0", :native-prefix nil}}, :native-path "target/native"} {:native-path "target/native", :dependencies {org.clojure/clojure {:vsn "1.11.1", :native-prefix nil, :native? false}, org.clojure/spec.alpha {:vsn "0.3.218", :native-prefix nil, :native? false}, org.clojure/core.specs.alpha {:vsn "0.2.62", :native-prefix nil, :native? false}, nrepl {:vsn "1.0.0", :native-prefix nil, :native? false}, org.nrepl/incomplete {:vsn "0.1.0", :native-prefix nil, :native? false}}}]
artifactId=day-2groupId=day-2version=0.1.0-SNAPSHOT
(ns day-2.core(:require [clojure.java.io :as io])(:require [clojure.string :as str])(:use [clojure.test :only [is]])(:use [clojure.pprint :only [pprint]])(:gen-class))(def test-set "7 6 4 2 11 2 7 8 99 7 6 2 11 3 2 4 58 6 4 4 11 3 6 7 9")(defn str-subtract [a b] (- (Integer/parseInt a) (Integer/parseInt b)))(defn satisfy-restriction [pred el](and (pred el 0) (<= (abs el) 3)))(defn every-satisfies-restriction [pred elements](every? (partial satisfy-restriction pred) elements))(defn every-satisfies-either-restriction [xs](or (every-satisfies-restriction > xs) (every-satisfies-restriction < xs)))(defn solve-first [data](let [lines (map #(str/split (str/triml %) #" ") (str/split-lines data))differences (map #(map str-subtract (drop 1 %) %) lines)](->> differences(map every-satisfies-either-restriction)(filter true?)(count))))(defn test-all-combinations [xs](or (not-every? false? (->> (range 0 (count xs))(map #(let [n %n2 (+ n 2)end (if (> n2 (count xs)) n n2)start (if (> n2 (count xs)) (dec n) n)](concat (take start xs) [(->> (drop start (take end xs)) (reduce +))] (drop n2 xs))))(map #(every-satisfies-either-restriction (into '() %)))))(every-satisfies-either-restriction (drop 1 xs))))(defn take-if-true [elements mask](->> (map vector elements mask)(filter (fn [[_ condition]] condition))(map first)))(defn solve-second [data](let [lines (map #(str/split (str/triml %) #" ") (str/split-lines data))differences (map #(map str-subtract (drop 1 %) %) lines)](count (filter true? (map test-all-combinations differences)))))(defn -main[& args](let [data-set (slurp "data/day2.txt")](println "(1) Test set...")(println (solve-first test-set))(println "(1) Large set...")(println (solve-first data-set))(println "(2) Test set...")(println (solve-second test-set))(println "(2) Large set...")(println (solve-second data-set))))
(defproject day-2 "0.1.0-SNAPSHOT":description "FIXME: write description":url "http://example.com/FIXME":license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0":url "https://www.eclipse.org/legal/epl-2.0/"}:dependencies [[org.clojure/clojure "1.11.1"]]:main ^:skip-aot day-2.core:target-path "target/%s":profiles {:uberjar {:aot :all:jvm-opts ["-Dclojure.compiler.direct-linking=true"]}})
44 47 50 51 53 54 5370 73 75 77 80 81 84 841 3 4 7 10 13 16 2047 49 52 53 55 57 60 6569 70 71 70 7122 23 20 21 24 27 2490 92 93 94 95 93 94 9416 18 15 16 2047 48 51 50 5527 28 31 31 32 3435 36 36 38 39 41 3832 33 33 36 38 39 3911 14 14 17 20 22 23 2765 68 71 71 72 7968 69 71 74 76 79 83 8451 52 56 58 59 61 64 6189 91 94 98 9845 48 51 55 5982 85 89 90 91 93 9941 42 44 49 5174 76 77 82 8133 36 37 43 45 48 4810 12 15 18 23 2763 66 72 75 76 8171 68 71 73 74 7578 75 76 77 768 6 9 11 1139 37 38 41 43 4787 86 87 90 9632 31 32 30 33 3517 16 17 18 16 17 1463 60 62 61 62 65 6577 76 77 78 75 78 80 849 7 10 11 8 1548 46 47 49 52 52 5417 16 17 19 20 23 23 2212 9 10 12 12 13 1320 18 20 20 2469 66 66 67 729 7 10 12 16 17 1819 17 18 19 21 25 28 2755 54 57 58 62 6255 54 58 61 6551 49 53 55 58 60 6559 58 60 65 6882 81 88 90 93 96 9317 14 17 18 23 2353 50 52 54 61 6526 24 27 28 33 34 36 4318 18 19 20 21 2263 63 65 67 68 71 703 3 6 7 10 1082 82 83 86 89 9337 37 40 43 5053 53 54 51 52 54 5686 86 83 84 8337 37 40 42 41 419 9 12 13 10 12 13 1757 57 59 61 60 63 65 7165 65 67 67 70 7223 23 24 24 2394 94 96 98 98 99 9949 49 50 53 53 55 57 6154 54 54 57 6470 70 74 77 7846 46 47 51 489 9 10 14 1478 78 80 81 84 88 9249 49 50 53 55 56 60 6770 70 77 79 82 85 887 7 14 15 1346 46 52 55 58 59 62 6216 16 21 22 2628 28 29 31 36 432 6 9 10 11 1256 60 62 64 6360 64 65 68 71 73 74 7427 31 33 34 37 38 41 456 10 11 14 15 18 21 2614 18 19 22 19 22 2417 21 23 26 27 26 28 2785 89 92 93 91 94 9420 24 27 24 2847 51 52 51 52 53 56 6218 22 24 24 25 2828 32 35 38 38 40 3943 47 47 49 50 52 5245 49 52 52 5633 37 38 38 4566 70 73 75 79 81 82 8312 16 20 22 24 25 26 2554 58 59 61 65 68 71 7114 18 20 24 2830 34 36 40 43 45 5022 26 27 29 31 32 38 4059 63 66 67 70 73 79 7640 44 47 49 50 55 58 5846 50 51 53 58 6234 38 40 43 48 5553 59 61 64 67 7047 52 53 55 56 5431 37 39 41 43 45 4521 27 29 31 33 3718 24 26 28 30 33 36 4129 36 37 38 36 382 9 7 9 12 14 15 1272 77 76 77 80 82 85 8542 48 50 48 50 53 5775 81 83 81 84 87 90 9717 22 24 27 27 30 33 3442 48 48 51 54 5282 87 89 89 91 92 93 9336 42 44 45 48 50 50 5451 58 60 62 62 63 6815 20 23 24 26 30 3318 25 27 31 3068 73 77 78 81 816 12 13 17 218 15 19 21 23 26 318 15 17 22 24 2719 25 32 35 37 38 40 3955 60 61 63 70 71 7143 50 57 60 61 63 6712 17 19 25 26 28 3496 94 93 92 91 90 87 9075 74 71 70 69 66 63 6372 69 68 67 66 6277 74 72 69 67 66 65 5843 42 40 37 40 38 37 3699 96 97 96 95 93 92 9389 86 85 86 83 81 8148 46 43 42 41 42 40 3669 66 64 61 64 62 61 5598 95 93 90 90 87 84 8130 27 24 24 23 2533 30 28 28 2858 57 54 54 52 4871 69 68 68 65 62 5736 33 32 31 27 2494 91 87 86 84 81 78 7935 34 31 28 27 24 20 2077 76 75 71 69 6553 52 48 45 44 41 39 3399 98 96 95 88 85 83 8079 76 69 66 64 61 6258 57 55 49 48 4840 39 33 32 30 27 2393 90 89 88 87 81 7437 39 36 35 32 29 2896 99 96 94 9647 48 47 45 42 39 3933 35 34 32 2817 19 16 14 782 83 81 78 79 78 75 7225 27 26 25 28 26 2923 26 29 28 25 2585 88 91 89 88 86 85 8181 83 82 79 82 79 77 7244 47 47 45 4380 83 82 82 8538 40 39 38 37 37 35 3586 88 85 83 83 82 7827 29 28 28 2249 51 49 45 4237 39 37 33 30 27 3063 65 62 58 5843 45 42 40 39 36 32 2833 34 32 29 25 23 1733 35 33 31 28 22 1939 41 38 31 30 28 2915 16 15 8 7 6 624 26 25 20 1692 93 90 88 82 7654 54 51 49 46 44 42 4037 37 36 35 3744 44 43 42 41 4132 32 31 30 27 24 2034 34 32 29 2394 94 97 94 92 9043 43 40 42 40 37 4036 36 38 36 35 32 3266 66 63 66 65 63 596 6 3 6 148 48 45 44 44 42 41 4043 43 42 42 39 4252 52 49 47 44 44 4431 31 28 28 26 2247 47 45 45 3879 79 75 72 71 6943 43 42 39 37 34 30 3321 21 17 14 1469 69 66 62 60 57 56 5242 42 38 35 32 2594 94 91 86 8425 25 23 20 14 11 8 1127 27 21 20 18 16 1680 80 79 73 72 71 6738 38 35 32 25 1948 44 43 40 38 37 36 3417 13 11 9 6 5 859 55 52 49 47 46 4692 88 87 84 82 79 76 7274 70 69 66 63 60 57 5190 86 85 88 8782 78 75 76 75 7672 68 71 69 66 65 6579 75 74 72 70 68 70 6655 51 52 49 4234 30 30 29 28 25 2472 68 67 64 64 6777 73 72 72 70 7085 81 80 77 77 76 7245 41 39 38 35 35 33 2731 27 25 23 20 16 1569 65 61 59 58 6054 50 49 45 43 4364 60 59 57 53 51 49 4531 27 26 22 1778 74 67 64 62 61 6043 39 37 32 3581 77 71 70 67 64 62 6271 67 65 64 63 58 56 5252 48 47 45 42 39 32 2797 90 88 86 84 81 78 7715 10 9 7 6 943 37 35 33 32 3289 84 81 78 76 75 7135 28 25 22 19 16 14 766 59 56 57 55 52 51 4979 74 72 73 7683 78 80 77 74 72 7262 55 53 55 5195 89 87 89 86 7931 24 23 22 20 18 18 1694 89 87 87 85 82 79 8035 29 29 28 2845 39 39 36 35 3130 23 23 21 19 16 1173 68 64 63 62 59 58 5557 50 46 45 42 4528 22 21 19 15 12 10 1061 56 53 49 4557 52 50 47 46 44 40 3564 57 54 48 47 44 4327 21 18 11 10 9 1051 45 42 39 36 29 26 2695 88 85 79 7541 34 33 27 2279 80 83 84 86 92 9046 39 36 33 29 2554 50 49 46 45 44 4794 89 88 82 8216 19 22 25 27 31 32 3492 89 90 96 9683 83 82 79 76 69 6880 77 79 80 80 8741 44 45 48 49 56 6028 28 27 23 1987 88 90 93 94 98 99 976 10 7 10 813 13 18 20 2457 57 57 58 6275 77 79 82 79 80 8362 59 63 65 68 69 7289 85 84 81 79 77 74 7249 50 49 46 42 40 38 3431 28 30 36 3838 34 34 31 29 2395 96 99 97 96 95 94 9698 94 91 88 87 86 85 8569 69 66 64 62 61 5447 47 49 50 51 51 5131 27 25 28 27 26 2273 76 79 81 8512 15 15 13 11 457 64 65 67 72 75 7731 29 26 25 2666 73 79 81 7959 62 62 59 56 5678 74 73 73 70 67 6423 23 23 20 19 17 1168 68 66 64 62 65 63 6463 59 62 60 57 54 5431 37 35 37 38 3844 45 42 41 39 4122 22 25 26 2849 51 44 43 41 38 37 4019 18 21 21 2589 83 79 77 74 7698 97 96 94 91 88 8389 88 85 82 79 76 76 7171 68 67 65 61 60 5832 36 37 44 45 47 49 5514 12 10 12 1219 17 18 20 21 21 1915 12 17 18 21 23 3086 87 86 81 8065 65 64 62 64 62 60 564 6 5 8 870 67 63 60 6041 42 42 45 4945 47 54 55 58 5881 85 87 88 89 9383 84 83 80 79 78 71 6563 60 59 61 5757 57 54 53 51 51 484 3 5 6 7 770 70 68 69 6857 51 48 43 4174 78 81 83 86 8556 60 61 62 65 6810 11 11 14 15 1586 90 91 92 93 94 99 9843 47 50 51 54 6136 29 27 26 23 22 19 1356 57 54 51 51 49 46 4446 40 37 34 34 2856 61 64 65 64 65 66 6813 11 8 5 179 79 77 77 76 73 72 7237 35 34 31 31 3161 57 53 51 48 4726 22 21 19 17 1237 33 31 28 25 23 1925 31 34 37 38 37 38 4216 23 26 27 30 33 37 3765 60 57 51 48 46 423 2 5 2 656 56 57 59 61 64 7078 78 76 73 70 69 63 6388 89 86 82 8229 31 29 29 2570 66 64 62 56 55 5335 34 35 36 38 362 6 7 8 11 14 16 1650 48 49 51 52 57 58 6249 49 52 56 58 6271 66 63 61 5789 91 92 95 95 9425 30 33 36 4382 84 85 86 87 89 91 9742 42 40 39 32 2863 67 70 72 76 78 79 8166 66 67 69 70 7447 40 38 38 37 36 34 3414 14 13 14 16 17 1768 68 66 63 61 60 57 5751 52 56 59 61 6840 42 40 39 36 35 34 3028 25 18 15 13 981 85 83 84 8827 23 19 18 17 15 1140 41 42 48 4961 61 62 61 58 55 5533 34 33 36 2929 27 26 20 18 1628 23 20 18 15 12 10 85 5 8 9 10 10 12 1751 56 56 58 61 6717 21 23 24 24 26 29 2612 18 20 21 23 25 2516 16 17 20 22 23 27 2820 18 15 14 14 1040 34 33 31 30 33 31 2939 38 41 44 46 44 5015 15 19 22 23 3057 61 58 60 62 6972 79 82 85 8258 56 54 52 49 47 49 478 10 15 16 2176 75 78 82 83 8093 95 94 91 84 8087 85 86 88 91 94 95 9988 88 86 84 83 7974 75 78 79 82 8258 59 61 65 67 69 6957 64 66 69 7381 77 72 71 68 6273 73 68 67 66 65 63 5856 56 53 52 48 5056 55 53 50 45 43 42 4226 24 20 19 17 1262 62 63 64 62 64 6247 42 38 37 34 32 2655 59 62 63 61 63 6481 78 77 73 70 7146 46 48 49 46 49 5573 70 70 69 7262 62 63 62 61 5674 78 81 78 81 8190 86 84 83 82 78 782 9 12 14 14 15 1395 91 88 88 8945 45 43 41 39 33 31 3343 42 43 45 42 44 45 4520 24 27 33 3785 81 80 78 78 747 10 8 10 939 41 42 40 37 3776 73 72 66 6834 40 41 44 49 5392 90 93 97 9761 68 70 72 69 72 74 7237 33 31 30 29 24 2024 20 16 14 11 10 9 472 76 78 84 85 86 8621 24 23 20 17 16 18 1426 28 25 23 20 204 4 7 8 12 14 1292 91 88 86 85 83 8095 93 91 90 8983 84 86 89 92 9561 62 65 67 7091 88 85 84 816 7 9 10 1381 82 85 88 91 93 9574 73 70 67 66 6455 57 59 62 6512 10 9 6 4 248 46 44 41 40 3998 95 94 92 8938 39 40 41 42 44 4519 22 23 25 28 30 32 3456 59 61 63 65 66 6721 23 24 26 27 309 11 14 15 183 6 8 10 1124 23 20 18 17 15 1317 15 14 11 10 7 4 249 48 45 42 40 37 34 3349 50 51 53 5518 16 13 11 8 7 475 73 70 68 67 64 61 5817 14 12 10 9 78 10 12 13 15 18 20 2177 76 75 73 71 70 6967 66 63 62 59 5817 18 20 22 2467 65 63 60 592 4 7 9 10 11 1439 37 35 32 3031 33 35 36 37 3983 82 79 78 75 72 71 6946 45 42 40 39 38 36 3336 38 39 40 4140 42 45 47 4946 45 43 42 40 38 36 3437 35 32 31 30 2834 33 32 30 28 26 2366 69 71 72 73 75 7863 60 57 55 54 52 5159 61 63 64 6620 17 16 14 11 899 97 94 91 89 87 84 8292 90 87 86 84 81 79 7653 51 48 47 44 41 39 3688 90 91 94 96 9714 11 9 8 54 5 6 7 9 12 1589 87 85 83 82 79 77 762 5 8 9 10 11 14 1710 12 14 16 18 2151 54 57 60 62 64 66 6846 48 49 50 535 7 8 11 14 16 17 2073 71 70 69 67 64 61 5894 91 89 86 84 83 8087 90 91 92 95 96 9725 23 20 17 15 1370 71 73 76 79 81 8372 70 69 66 65 62 6097 95 92 91 89 8759 58 57 56 5461 60 57 55 52 5193 90 87 84 838 11 14 15 18 2025 26 29 32 3514 15 16 19 20 22 23 2477 75 73 72 7179 82 83 86 87 89 91 9440 39 36 34 31 28 2685 87 90 91 94 9553 50 49 46 45 43 40 3772 74 77 80 81 84 8668 65 63 61 58 56 5417 16 14 13 1082 81 79 76 75 72 71 682 3 6 8 11 12 1356 53 50 48 4763 65 67 69 71 74 7738 40 41 44 4789 86 84 81 80 77 7665 62 61 59 5853 55 56 58 61 63 6569 71 74 75 77 79 8278 76 73 72 71 69 68 6771 74 77 78 81 82 84 8714 12 9 8 5 384 81 79 76 74 73 71 7058 57 55 53 51 49 4759 62 64 65 67 6917 14 12 10 8 5 446 43 41 39 36 33 3266 65 62 60 5714 13 11 10 9 73 5 6 9 12 13 1638 39 41 42 43 45 47 4819 22 23 25 27 3041 38 36 35 33 32 29 2634 36 37 39 4240 37 34 33 3226 23 21 20 18 1675 76 77 79 8275 77 78 79 80 8367 70 72 73 74 77 80 8250 48 45 42 3969 68 67 65 64 63 6115 14 12 10 742 40 37 36 3327 24 22 21 19 17 1457 59 62 64 67 7014 17 20 22 24 25 2632 29 27 24 23 21 18 1565 67 70 71 741 4 5 8 1179 80 81 84 87 90 92 9411 10 9 7 5 3 241 40 37 36 35 32 29 2861 63 66 68 69 72 7442 41 40 39 38 36 33 3036 35 33 32 31 30 2812 13 15 18 21 2362 61 58 55 53 5278 76 73 71 68 6622 24 26 28 31 3331 29 26 24 21 197 10 12 13 15 178 9 11 13 15 1662 61 60 58 5611 9 6 4 172 74 76 77 78 81 8353 55 56 58 60 63 65 6742 44 46 48 49 5222 21 19 18 15 13 11 942 45 46 48 51 5249 48 47 46 45 4311 9 7 4 386 85 84 81 79 77 7422 24 25 28 29 32 35 3646 47 49 51 52 5320 21 24 25 26 2848 50 51 54 55 5842 41 39 38 3760 59 56 53 50 47 46 4425 22 20 19 17 16 1314 13 11 10 9 7 5 479 76 75 72 71 70 6867 64 62 59 57 55 53 5028 25 24 23 21 194 7 10 11 12 13 1627 24 22 20 1937 36 33 32 30 273 5 8 11 14 1522 23 25 26 29 32 35 3863 65 66 68 69 7186 87 88 89 90 93 94 9765 63 60 57 5648 46 44 42 3998 96 94 91 90 87 86 856 9 10 11 1388 91 92 94 96 9874 77 78 79 81 8496 95 93 91 90 8733 34 35 37 3912 9 7 6 419 21 22 23 26 2813 16 17 19 20 21 2356 58 59 61 63 66 68 6972 70 69 67 64 63 62 5963 66 69 71 7241 38 37 36 34 3176 79 82 83 84 87 89 915 6 8 10 12 15 1672 74 77 80 83 84 87 9088 85 83 80 78 75 74 7346 44 41 39 37 36 33 3069 71 74 76 79 8289 90 93 95 9858 55 54 51 49 48 4544 41 38 37 36 35 3434 36 37 40 4266 68 70 73 75 7859 61 62 63 66 67 69 7222 21 18 16 14 13 11 915 14 13 12 941 39 38 36 33 30 29 2614 15 18 20 2232 31 28 26 23 2122 24 25 26 28 29 3273 76 79 81 84 86 89 9013 15 18 20 23 25 27 285 6 8 10 12 1317 18 21 24 2791 89 87 85 83 81 8030 29 26 23 21 1934 37 40 43 44 45 4838 39 41 42 44 46 49 5029 32 33 34 37 39 4175 77 80 81 84 87 90 9374 73 70 67 6610 11 14 16 18 19 2130 29 27 25 24 2165 68 71 72 73 76 7978 75 73 72 70 67 6499 98 96 93 9171 69 68 67 66 64 62 6118 20 22 25 26 27 2964 67 69 71 72 75 7888 87 84 81 78 76 7325 23 22 21 1889 86 84 83 82 80 7879 76 75 72 70 67 66 6367 69 71 74 76 7766 63 60 59 56 5573 72 69 66 63 61 6020 23 24 27 29 3096 95 93 92 9165 63 62 61 5875 76 77 80 8331 28 25 22 20 18 15 1420 23 26 29 31 34 3689 90 91 92 95 96 9774 72 69 66 64 63 6139 41 44 46 4938 36 33 30 27 24 23 2078 79 81 82 84 873 4 7 10 12 1412 9 8 6 4 395 93 92 91 90 88 8744 45 46 47 4880 81 82 85 8847 44 41 38 3755 57 59 61 62 65 6652 54 56 57 6083 82 80 78 7572 70 67 66 63 61 60 5843 44 46 47 50 53 5415 14 11 9 8 785 83 81 80 7819 17 14 12 10 8 5 422 23 25 27 29 31 3343 45 47 49 52 54 57 5857 56 54 51 50 4789 88 86 84 81 80 7754 55 57 58 59 61 6432 29 28 26 23 21 1838 36 35 34 3336 38 40 42 44 4722 21 20 19 17 16 14 1152 54 55 57 60 63 6413 15 18 19 21 23 2519 21 24 27 28 3114 17 20 22 2563 61 58 57 54 5222 20 18 15 14 13 10 734 36 37 40 4115 14 13 11 8 6 5 236 39 40 42 44 45 4735 37 40 42 43 44 4519 18 16 14 11 938 41 42 44 45 4684 85 88 90 93 95 9753 52 51 48 4537 35 33 32 31 30 27 2517 19 20 22 25 289 10 12 14 1525 26 29 31 34 36 37 4019 20 23 24 2648 51 53 56 57 59 6074 71 68 66 63 62 59 5717 15 12 10 8 6 436 33 30 27 25 22 21 2071 72 75 78 8067 69 72 73 74 75 7767 70 71 74 7689 92 94 95 9761 59 56 54 52 51 4815 17 20 22 2526 29 32 34 35 37 4022 24 25 28 29 3226 25 22 19 16 15 1213 16 17 20 22 2385 82 79 77 76 75 729 11 13 16 18 20 2356 55 54 51 485 8 11 14 15 1654 51 48 47 46 4560 62 65 68 69 70 7322 19 17 15 1397 95 94 92 90 87 85 8322 19 16 13 12 963 66 67 70 73 7594 92 91 88 86 84 83 8142 43 45 48 50 53 56 5842 44 47 50 5315 14 13 12 1063 60 58 56 54 51 49 4854 52 50 47 44 4118 21 23 26 28 30 3238 37 35 34 31 28 26 2381 79 76 75 73 72 71 6846 44 41 38 3791 90 87 85 8312 14 15 18 2054 56 57 60 63 6557 56 55 52 51 5040 37 35 32 30 2861 63 64 65 682 3 4 5 6 9 1249 50 51 52 5469 71 74 75 76 7774 75 77 79 82 8517 15 12 11 932 31 28 25 22 2127 28 31 34 3711 13 16 17 20 22 23 2680 79 77 75 74 7115 12 11 10 7 687 84 83 81 7934 37 38 40 43 45 4745 48 49 52 55 5754 51 50 49 46 44 4337 40 41 44 47 49 5016 13 12 10 8 6 384 86 87 90 93 96 9959 57 54 53 52 49 4860 57 55 54 51 50 4829 30 31 33 34 3666 67 70 71 74 76 79 8184 86 88 91 94 9647 44 43 40 3980 79 77 75 73 72 71 6817 15 13 12 981 79 76 74 71 70 6722 20 19 17 1556 58 60 62 63 66 6726 28 29 31 32 33 3448 45 43 42 41 38 3741 44 47 50 53 5671 70 68 66 6350 49 47 44 43 41 3916 13 10 8 7 6 5 340 37 34 31 28 26 25 2279 82 84 86 87 90 92 9590 87 86 85 82 79 78 7548 50 51 54 5662 59 56 53 5252 55 57 60 6139 42 45 48 50 5268 67 65 64 63 608 10 13 14 17 20 21 2323 24 25 27 28 30 33 3480 79 77 74 72 70 67 653 4 7 9 12 13 15 1665 67 70 72 7564 63 60 57 55 5282 79 78 76 73 70 67 6491 89 86 83 80 79 78 7618 15 13 11 8 6 5 371 69 68 67 65 62 5958 60 62 64 66 6953 52 49 46 44 41 40 3752 53 54 57 58 61 64 675 7 9 12 14 16 1962 64 65 68 71 73 74 7532 34 36 38 4039 40 42 45 48 49 52 5510 12 15 18 20 21 2244 41 40 38 35 32 2974 75 76 77 7914 13 11 9 8 716 18 19 20 21 2419 16 13 10 7 654 57 58 59 62 63 6412 15 16 19 21 23 26 2861 58 57 55 5424 21 19 18 1654 51 50 49 4633 36 39 41 4432 33 36 38 41 44 4744 47 49 51 5220 22 25 28 29 31 3446 43 40 39 36 34 33 324 7 9 12 1518 16 14 12 9 8 617 14 11 8 551 50 49 48 4551 50 48 47 45 44 4348 46 43 42 4170 71 74 76 77 7842 41 38 37 36 3443 42 39 37 35 32 30 2773 70 68 67 65 64 61 6085 86 89 91 92 9453 56 58 59 60 61 63 6683 84 86 88 91 9291 90 89 86 85 84 834 6 9 12 14 15 1889 88 85 82 79 7731 29 26 25 2428 30 33 35 36 37 39 4066 65 64 62 5925 23 21 19 18 1793 92 91 89 88 86 84 8119 20 22 24 27 28 31 3424 25 27 28 307 10 11 14 17 18 2026 27 30 32 3572 69 66 65 62 59 5796 94 93 92 9011 13 16 19 20 23 24 2650 49 47 44 43 42 40 3931 29 27 24 21 20 19 1853 55 58 61 63 66 6857 60 63 65 6773 74 75 77 78 8021 20 17 14 11 9 756 58 61 64 65 66 6777 75 72 69 67 65 6453 55 57 58 6130 27 25 23 20 1745 44 42 40 37 36 3334 31 28 26 23 21 20 1745 46 48 50 5251 52 53 54 55 5839 36 35 33 3156 59 61 64 66 69 71 7294 92 89 88 85 834 7 10 12 15 17 18 2174 76 79 82 83 8471 69 66 63 61 60 5782 85 86 88 90 92 94 9669 71 73 74 7535 38 40 41 44 46 4978 80 81 82 84 85 87 8829 32 34 35 3826 24 21 19 17 16 13 1139 41 43 45 4858 60 61 62 63 64 67 6861 64 66 67 70 7385 84 83 81 8066 63 62 61 59 57 5538 41 42 43 46 4947 44 41 40 38 35 32 3041 39 38 37 3685 88 91 93 957 10 11 13 16 19 2251 50 48 47 44 43 4047 46 43 41 39 38 3693 92 91 89 87 85 83 8283 80 79 77 74 73 7046 44 41 39 37 36 33 3229 32 33 35 3821 18 16 15 12 9 825 27 29 31 3351 53 56 58 59 62 6457 58 61 63 65 6749 48 47 45 44 4142 44 47 48 4969 68 66 63 61 6027 24 22 21 2081 78 77 74 71 70 67 6441 44 46 49 5013 11 9 6 5 353 52 50 48 47 44 43 4248 45 42 41 38 36 3462 59 58 57 56 5551 50 47 44 42 39 363 4 7 10 13 1616 19 20 22 2593 91 90 87 8587 86 83 80 7784 82 80 79 78 76 75 7325 27 28 29 31 32 35 3882 81 78 75 74 72 7084 85 86 89 9080 81 82 85 87 891 2 5 8 1074 76 78 81 82 83 84 8652 54 55 56 57 5817 20 22 24 26 28 30 3173 72 69 68 65 6265 62 60 59 56 5554 52 50 48 4644 43 42 40 3967 68 70 73 74 77 79 8191 90 88 86 83 82 81 8036 38 39 40 43 45 47 4929 28 25 24 23 2039 40 43 46 47 4983 81 79 76 74 7345 43 42 41 40 3738 41 42 44 45 47 4834 35 38 41 42 43 44 4562 59 56 55 52 49 4811 13 16 17 20 2149 46 45 43 41 40 3854 52 51 49 46 4496 94 92 89 88 86 8441 38 36 33 31 28 2521 22 25 26 29 30 3127 28 29 32 35 37 39 4155 58 60 63 66 68 69 7118 15 14 12 11 1077 75 74 71 7023 25 28 30 31 3214 15 17 20 23 25 2846 48 50 51 53 5572 71 70 69 6860 57 56 54 53 5193 92 89 86 8366 63 62 61 60 59 5828 31 34 37 3878 79 82 84 85 88 90 9260 62 65 67 70 7157 60 62 65 67 70 725 8 11 14 1563 65 67 69 71 74 75 7779 77 74 72 7055 58 60 62 6528 30 32 34 3719 21 24 25 2767 65 62 59 58 5694 93 91 89 86 83 81 7942 41 40 39 3716 19 21 23 2667 64 62 59 5666 64 61 59 56 54 53 5162 63 64 67 6887 84 81 79 76 74 71 687 8 11 14 1537 39 42 43 4521 24 26 28 31 33 36 3948 50 53 56 59 61 64 6563 64 65 66 69 7058 60 63 64 655 6 7 10 11 14 17 1951 48 47 46 4425 28 30 32 35 37 3932 31 28 26 2591 89 88 85 8391 90 87 85 84 8339 38 35 34 31 2950 51 53 54 5659 60 63 65 6625 27 28 30 3157 54 53 51 5050 53 56 57 60 62 65 6863 61 60 58 55 52 5060 62 64 65 66 68 6943 45 48 49 51 52 5565 66 68 71 74 7724 25 26 28 29 30 32 3589 90 92 95 9783 84 86 88 89 92 9431 32 34 35 37 40 42 4373 76 78 79 8163 64 67 68 70 73 75 7886 84 81 78 77 7543 42 40 38 3562 64 65 68 7168 70 72 75 78 80 8377 80 82 85 88 90 91 9411 9 8 7 679 80 83 84 8744 45 46 47 50 52 55 5632 34 35 37 38 40 4357 54 51 49 46 45 44 4241 39 38 37 34 31 29 2681 82 83 85 88 90 91 9362 64 66 69 72 73 7627 28 30 31 32 33 34 3625 27 30 31 33 3699 96 93 92 9034 33 30 27 25 23 22 2127 24 23 20 18 15 1391 90 88 87 8462 59 56 55 52 49 4719 17 16 15 14 1395 92 90 87 84 82 79 7612 11 9 8 6 315 18 20 22 25 26 27 2951 49 47 46 43 4062 65 67 68 7167 68 71 74 77 79 82 8447 45 42 39 37 35 32 3151 48 47 46 44 42 41 3945 46 49 50 51 5286 89 90 92 9366 67 68 71 72 75
# Advent of Code
Eclipse Public License - v 2.0THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSEPUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTIONOF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.1. DEFINITIONS"Contribution" means:a) in the case of the initial Contributor, the initial contentDistributed under this Agreement, andb) in the case of each subsequent Contributor:i) changes to the Program, andii) additions to the Program;where such changes and/or additions to the Program originate fromand are Distributed by that particular Contributor. A Contribution"originates" from a Contributor if it was added to the Program bysuch Contributor itself or anyone acting on such Contributor's behalf.Contributions do not include changes or additions to the Program thatare not Modified Works."Contributor" means any person or entity that Distributes the Program."Licensed Patents" mean patent claims licensable by a Contributor whichare necessarily infringed by the use or sale of its Contribution aloneor when combined with the Program."Program" means the Contributions Distributed in accordance with thisAgreement."Recipient" means anyone who receives the Program under this Agreementor any Secondary License (as applicable), including Contributors."Derivative Works" shall mean any work, whether in Source Code or otherform, that is based on (or derived from) the Program and for which theeditorial revisions, annotations, elaborations, or other modificationsrepresent, as a whole, an original work of authorship."Modified Works" shall mean any work in Source Code or other form thatresults from an addition to, deletion from, or modification of thecontents of the Program, including, for purposes of clarity any new filein Source Code form that contains any contents of the Program. ModifiedWorks shall not include works that contain only declarations,interfaces, types, classes, structures, or files of the Program solelyin each case in order to link to, bind by name, or subclass the Programor Modified Works thereof."Distribute" means the acts of a) distributing or b) making availablein any manner that enables the transfer of a copy."Source Code" means the form of a Program preferred for makingmodifications, including but not limited to software source code,documentation source, and configuration files."Secondary License" means either the GNU General Public License,Version 2.0, or any later versions of that license, including anyexceptions or additional permissions as identified by the initialContributor.2. GRANT OF RIGHTSa) Subject to the terms of this Agreement, each Contributor herebygrants Recipient a non-exclusive, worldwide, royalty-free copyrightlicense to reproduce, prepare Derivative Works of, publicly display,publicly perform, Distribute and sublicense the Contribution of suchContributor, if any, and such Derivative Works.b) Subject to the terms of this Agreement, each Contributor herebygrants Recipient a non-exclusive, worldwide, royalty-free patentlicense under Licensed Patents to make, use, sell, offer to sell,import and otherwise transfer the Contribution of such Contributor,if any, in Source Code or other form. This patent license shallapply to the combination of the Contribution and the Program if, atthe time the Contribution is added by the Contributor, such additionof the Contribution causes such combination to be covered by theLicensed Patents. The patent license shall not apply to any othercombinations which include the Contribution. No hardware per se islicensed hereunder.c) Recipient understands that although each Contributor grants thelicenses to its Contributions set forth herein, no assurances areprovided by any Contributor that the Program does not infringe thepatent or other intellectual property rights of any other entity.Each Contributor disclaims any liability to Recipient for claimsbrought by any other entity based on infringement of intellectualproperty rights or otherwise. As a condition to exercising therights and licenses granted hereunder, each Recipient herebyassumes sole responsibility to secure any other intellectualproperty rights needed, if any. For example, if a third partypatent license is required to allow Recipient to Distribute theProgram, it is Recipient's responsibility to acquire that licensebefore distributing the Program.d) Each Contributor represents that to its knowledge it hassufficient copyright rights in its Contribution, if any, to grantthe copyright license set forth in this Agreement.e) Notwithstanding the terms of any Secondary License, noContributor makes additional grants to any Recipient (other thanthose set forth in this Agreement) as a result of such Recipient'sreceipt of the Program under the terms of a Secondary License(if permitted under the terms of Section 3).3. REQUIREMENTS3.1 If a Contributor Distributes the Program in any form, then:a) the Program must also be made available as Source Code, inaccordance with section 3.2, and the Contributor must accompanythe Program with a statement that the Source Code for the Programis available under this Agreement, and informs Recipients how toobtain it in a reasonable manner on or through a medium customarilyused for software exchange; andb) the Contributor may Distribute the Program under a licensedifferent than this Agreement, provided that such license:i) effectively disclaims on behalf of all other Contributors allwarranties and conditions, express and implied, includingwarranties or conditions of title and non-infringement, andimplied warranties or conditions of merchantability and fitnessfor a particular purpose;ii) effectively excludes on behalf of all other Contributors allliability for damages, including direct, indirect, special,incidental and consequential damages, such as lost profits;iii) does not attempt to limit or alter the recipients' rightsin the Source Code under section 3.2; andiv) requires any subsequent distribution of the Program by anyparty to be under a license that satisfies the requirementsof this section 3.3.2 When the Program is Distributed as Source Code:a) it must be made available under this Agreement, or if theProgram (i) is combined with other material in a separate file orfiles made available under a Secondary License, and (ii) the initialContributor attached to the Source Code the notice described inExhibit A of this Agreement, then the Program may be made availableunder the terms of such Secondary Licenses, andb) a copy of this Agreement must be included with each copy ofthe Program.3.3 Contributors may not remove or alter any copyright, patent,trademark, attribution notices, disclaimers of warranty, or limitationsof liability ("notices") contained within the Program from any copy ofthe Program which they Distribute, provided that Contributors may addtheir own appropriate notices.4. COMMERCIAL DISTRIBUTIONCommercial distributors of software may accept certain responsibilitieswith respect to end users, business partners and the like. While thislicense is intended to facilitate the commercial use of the Program,the Contributor who includes the Program in a commercial productoffering should do so in a manner which does not create potentialliability for other Contributors. Therefore, if a Contributor includesthe Program in a commercial product offering, such Contributor("Commercial Contributor") hereby agrees to defend and indemnify everyother Contributor ("Indemnified Contributor") against any losses,damages and costs (collectively "Losses") arising from claims, lawsuitsand other legal actions brought by a third party against the IndemnifiedContributor to the extent caused by the acts or omissions of suchCommercial Contributor in connection with its distribution of the Programin a commercial product offering. The obligations in this section do notapply to any claims or Losses relating to any actual or allegedintellectual property infringement. In order to qualify, an IndemnifiedContributor must: a) promptly notify the Commercial Contributor inwriting of such claim, and b) allow the Commercial Contributor to control,and cooperate with the Commercial Contributor in, the defense and anyrelated settlement negotiations. The Indemnified Contributor mayparticipate in any such claim at its own expense.For example, a Contributor might include the Program in a commercialproduct offering, Product X. That Contributor is then a CommercialContributor. If that Commercial Contributor then makes performanceclaims, or offers warranties related to Product X, those performanceclaims and warranties are such Commercial Contributor's responsibilityalone. Under this section, the Commercial Contributor would have todefend claims against the other Contributors related to those performanceclaims and warranties, and if a court requires any other Contributor topay any damages as a result, the Commercial Contributor must paythose damages.5. NO WARRANTYEXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENTPERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN "AS IS"BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS ORIMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OFTITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULARPURPOSE. Each Recipient is solely responsible for determining theappropriateness of using and distributing the Program and assumes allrisks associated with its exercise of rights under this Agreement,including but not limited to the risks and costs of program errors,compliance with applicable laws, damage to or loss of data, programsor equipment, and unavailability or interruption of operations.6. DISCLAIMER OF LIABILITYEXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENTPERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORSSHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOSTPROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER INCONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THEEXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THEPOSSIBILITY OF SUCH DAMAGES.7. GENERALIf any provision of this Agreement is invalid or unenforceable underapplicable law, it shall not affect the validity or enforceability ofthe remainder of the terms of this Agreement, and without furtheraction by the parties hereto, such provision shall be reformed to theminimum extent necessary to make such provision valid and enforceable.If Recipient institutes patent litigation against any entity(including a cross-claim or counterclaim in a lawsuit) alleging that theProgram itself (excluding combinations of the Program with other softwareor hardware) infringes such Recipient's patent(s), then such Recipient'srights granted under Section 2(b) shall terminate as of the date suchlitigation is filed.All Recipient's rights under this Agreement shall terminate if itfails to comply with any of the material terms or conditions of thisAgreement and does not cure such failure in a reasonable period oftime after becoming aware of such noncompliance. If all Recipient'srights under this Agreement terminate, Recipient agrees to cease useand distribution of the Program as soon as reasonably practicable.However, Recipient's obligations under this Agreement and any licensesgranted by Recipient relating to the Program shall continue and survive.Everyone is permitted to copy and distribute copies of this Agreement,but in order to avoid inconsistency the Agreement is copyrighted andmay only be modified in the following manner. The Agreement Stewardreserves the right to publish new versions (including revisions) ofthis Agreement from time to time. No one other than the AgreementSteward has the right to modify this Agreement. The Eclipse Foundationis the initial Agreement Steward. The Eclipse Foundation may assign theresponsibility to serve as the Agreement Steward to a suitable separateentity. Each new version of the Agreement will be given a distinguishingversion number. The Program (including Contributions) may always beDistributed subject to the version of the Agreement under which it wasreceived. In addition, after a new version of the Agreement is published,Contributor may elect to Distribute the Program (including itsContributions) under the new version.Except as expressly stated in Sections 2(a) and 2(b) above, Recipientreceives no rights or licenses to the intellectual property of anyContributor under this Agreement, whether expressly, by implication,estoppel or otherwise. All rights in the Program not expressly grantedunder this Agreement are reserved. Nothing in this Agreement is intendedto be enforceable by any entity that is not a Contributor or Recipient.No third-party beneficiary rights are created under this Agreement.Exhibit A - Form of Secondary Licenses Notice"This Source Code may also be made available under the followingSecondary Licenses when the conditions for such availability set forthin the Eclipse Public License, v. 2.0 are satisfied: GNU General PublicLicense as published by the Free Software Foundation, either version 2of the License, or (at your option) any later version, with the GNUClasspath Exception which is available athttps://www.gnu.org/software/classpath/license.html."Simply including a copy of this Agreement, including this Exhibit Ais not sufficient to license the Source Code under Secondary Licenses.If it is not possible or desirable to put the notice in a particularfile, then You may include the notice in a location (such as a LICENSEfile in a relevant directory) where a recipient would be likely tolook for such a notice.You may add additional accurate notices of copyright ownership.