diff options
author | mms <michal@sapka.me> | 2024-12-02 14:18:16 +0100 |
---|---|---|
committer | mms <michal@sapka.me> | 2024-12-02 14:18:16 +0100 |
commit | 558e9a668287b318a400725d1b6ad38e6753d54c (patch) | |
tree | 2416a52db75f55353013245f00bb5e72b0247507 /2024 |
2024@1-2
Diffstat (limited to '2024')
-rw-r--r-- | 2024/01a/data.txt | 1000 | ||||
-rwxr-xr-x | 2024/01a/run.rb | 17 | ||||
-rw-r--r-- | 2024/01b/data.txt | 1000 | ||||
-rwxr-xr-x | 2024/01b/run.rb | 24 | ||||
-rw-r--r-- | 2024/02a/data.txt | 1000 | ||||
-rwxr-xr-x | 2024/02a/run.rb | 32 | ||||
-rw-r--r-- | 2024/02b/data.txt | 1000 | ||||
-rw-r--r-- | 2024/02b/data_o | 6 | ||||
-rwxr-xr-x | 2024/02b/run.rb | 47 |
9 files changed, 4126 insertions, 0 deletions
diff --git a/2024/01a/data.txt b/2024/01a/data.txt new file mode 100644 index 0000000..7d1b595 --- /dev/null +++ b/2024/01a/data.txt @@ -0,0 +1,1000 @@ +40094 37480 +52117 14510 +92290 82570 +41563 59882 +56597 98604 +60657 66508 +85570 59882 +56065 27818 +78474 72704 +71099 14510 +34302 92950 +11680 14510 +17162 66508 +85767 69912 +43222 99057 +84192 42459 +86349 47916 +15974 93804 +62582 84872 +46480 96423 +49083 47125 +26321 82391 +29705 99057 +76669 53445 +97344 23937 +22364 82947 +43057 41784 +89096 14096 +54594 74691 +16496 21289 +16315 26820 +12070 39776 +92869 76329 +51048 82455 +39150 94320 +58187 83731 +68901 59853 +73788 77097 +11009 17200 +88295 15720 +59037 65311 +89459 74691 +44460 30211 +71139 80238 +91079 65185 +35005 50427 +50560 84872 +66445 66508 +11233 14510 +17699 33984 +90637 44753 +93142 10300 +19092 42065 +19173 83731 +58875 86050 +63423 83870 +71780 70501 +29252 92869 +59508 78068 +28083 14549 +81355 33405 +64678 38506 +83118 41435 +83177 48400 +94114 70501 +52985 82400 +60853 70531 +70827 98303 +78106 23782 +58175 55623 +33789 19841 +76421 45114 +58847 77539 +99979 53408 +59287 42943 +73877 29014 +95914 36915 +84344 87773 +19462 84872 +75441 13097 +51621 85661 +18456 32965 +49881 48400 +59056 55469 +52464 14549 +17562 76246 +99617 74396 +14300 46447 +15278 16859 +78081 41160 +74953 18829 +96718 92869 +56734 70429 +96632 92950 +87669 82496 +41413 47115 +23478 83870 +44726 38354 +98494 70501 +20040 82400 +52539 42459 +66799 78088 +34219 14821 +47568 77539 +36511 76135 +49296 14510 +81088 39776 +29532 39776 +93599 32110 +89573 43968 +61226 48400 +61073 17960 +10265 55334 +83307 82947 +26932 81159 +66857 83731 +77172 74877 +82796 14510 +83224 75812 +65968 33984 +58067 54289 +27835 73261 +25580 85562 +28693 14510 +11013 42459 +72686 75812 +38200 64002 +10540 82391 +16594 86787 +38238 47324 +72787 84872 +32314 65237 +52509 85451 +11856 42459 +74689 14549 +11006 47324 +62911 36777 +96648 28762 +78556 84872 +43118 55149 +15524 18835 +97188 68430 +36316 11638 +23469 74803 +30969 33984 +19616 57386 +74603 51560 +73140 52522 +50052 84086 +67225 82400 +82945 39776 +59463 36777 +43724 39776 +38655 36019 +16887 34982 +63076 82400 +57786 92869 +40159 91888 +86882 74877 +30168 74750 +94821 91385 +22335 20714 +14549 74691 +17267 46572 +86022 83923 +40758 83870 +33144 41548 +20281 78088 +87782 14661 +26820 67869 +72492 81368 +92950 55032 +42737 36777 +22360 65185 +61694 67189 +43534 76135 +25697 62054 +65617 70501 +36055 82455 +42978 70973 +69418 29676 +87319 39776 +92611 74554 +45366 50611 +86780 47925 +14580 36676 +60406 24721 +44987 66508 +23481 13654 +89422 77304 +21807 92950 +52893 22984 +70221 76135 +61432 28691 +50739 61410 +69705 10534 +11551 84737 +14653 82947 +84764 70227 +19435 86399 +46702 90481 +59882 66508 +27462 39776 +45303 78835 +41509 75370 +22494 80790 +59433 58283 +19204 20602 +13874 75812 +50130 44169 +68727 83731 +58262 18103 +33787 88584 +28931 50419 +90686 77539 +33865 92950 +57146 59882 +26465 55530 +68279 41051 +77998 92950 +44063 69056 +21928 28982 +18478 83731 +79582 30353 +80695 81630 +25322 71284 +52650 91070 +90146 16859 +74890 66508 +54271 49699 +35728 96535 +15295 88122 +85415 41051 +96077 74836 +71257 31093 +10677 78088 +72271 58494 +50820 64678 +12266 33434 +32264 78179 +59541 64841 +51353 83870 +41310 74853 +62865 15554 +66303 53130 +30556 25580 +27203 66508 +31790 71172 +33932 47324 +43212 88773 +58069 83731 +88235 25580 +41094 99057 +25979 25580 +62261 60853 +79993 23589 +73964 71455 +82400 64678 +65762 18579 +73651 16859 +67581 76135 +30713 14716 +47252 19658 +14691 39961 +40662 12202 +57025 69091 +83266 48400 +30600 79683 +62076 16859 +16881 83870 +65361 63743 +80773 63741 +71794 48591 +65839 66508 +75318 20602 +91238 82391 +45707 64678 +40980 77539 +85661 99057 +59298 29272 +19492 84014 +93934 48400 +15984 64678 +89737 48584 +94738 63640 +36639 52035 +61394 40066 +48772 34199 +18258 74691 +20283 80659 +63972 40629 +82137 59882 +76239 25580 +12349 41106 +75728 64348 +74691 78088 +62001 21680 +70269 34199 +25443 39776 +19584 15829 +30199 87448 +92524 19400 +41674 23116 +63728 44519 +99875 91712 +17735 30851 +67540 81902 +27828 92950 +85889 33984 +39816 37113 +87480 91733 +19469 33984 +62803 12772 +17043 33984 +97479 81159 +91505 45435 +12207 69925 +60626 95997 +68126 92869 +76852 13346 +71419 70109 +49664 42459 +74526 32376 +16446 47891 +23116 39776 +43806 64678 +23988 61719 +97167 92950 +66668 44592 +25225 35154 +14284 14510 +23861 47115 +55048 45238 +33484 60853 +46372 80717 +61795 22743 +73995 44753 +89733 76532 +91399 53238 +53467 20602 +71484 98629 +37974 64678 +73312 99057 +75812 73554 +47324 58729 +14895 92017 +69525 50204 +47032 78088 +90971 72856 +63357 33984 +94931 99057 +11959 73715 +70226 77539 +54005 44541 +38941 48400 +64230 74691 +31008 11797 +47599 55425 +67007 10384 +14054 82455 +22131 22556 +52663 80307 +90266 61207 +76934 33537 +97373 27252 +37507 99057 +95323 86821 +79869 56443 +53249 77539 +62806 14510 +23745 41051 +61452 60853 +97548 19963 +57870 24236 +18763 15129 +85117 39776 +30254 51456 +51491 67525 +93572 77539 +82325 83731 +15877 41056 +98690 11852 +58483 14549 +46792 46579 +19738 32343 +96327 41051 +84003 82455 +58135 99057 +22481 68384 +38401 92272 +44698 30430 +39030 14510 +64037 47324 +70100 84872 +64299 48400 +75003 18219 +74190 19588 +71831 92869 +20635 88403 +28133 39036 +39722 42459 +42378 20602 +31939 75812 +69490 77539 +85822 41051 +99562 93734 +48527 23116 +56404 52393 +44682 26105 +66332 92869 +55356 52743 +13056 18829 +19925 82455 +66686 22256 +48103 99057 +82466 99057 +71384 20602 +56960 36777 +14192 41310 +44212 58300 +71988 92950 +90172 75812 +86104 75812 +58359 98375 +95930 48202 +61264 14510 +85630 74877 +27124 48370 +49572 48140 +48424 77539 +77569 45931 +30308 81159 +26594 40011 +63775 66508 +34220 82947 +46571 47585 +81978 77539 +37668 82947 +51727 66508 +79066 20602 +12567 74691 +47130 12241 +15691 93831 +65408 33984 +15617 82400 +48601 36777 +10561 60853 +97955 41051 +82817 21661 +21081 77539 +50859 33984 +23474 82400 +15893 47324 +48663 98013 +80276 77539 +29558 64989 +98180 99880 +31381 66796 +32510 14549 +47508 15854 +14500 14549 +30226 70501 +10524 92869 +26213 92869 +75481 44753 +39239 53324 +72660 64678 +16154 83870 +84492 41051 +21987 20602 +45236 75576 +36827 57147 +81865 60831 +36531 99057 +77201 70501 +28863 31856 +32410 48400 +62294 53873 +49825 99057 +17226 50273 +36614 34199 +14510 48400 +15818 74691 +41051 27891 +39776 33984 +43740 25580 +61248 97412 +63739 47404 +33984 88105 +64598 81159 +71104 89965 +71399 13250 +22174 20602 +60654 39776 +36993 45136 +81016 74327 +47735 64918 +80903 14510 +87865 39776 +38245 91066 +29883 51319 +52463 23311 +32632 35610 +75507 97544 +57330 65354 +59693 55540 +96123 48400 +15649 92950 +84872 82947 +52036 85576 +56140 65185 +23571 32245 +45230 97874 +49231 50934 +43993 85661 +27831 14510 +59732 83870 +46676 39776 +92968 60853 +66157 28036 +88365 70501 +78552 95048 +30812 39388 +70615 32340 +90718 49637 +55059 43376 +44052 32254 +64928 14510 +49820 82400 +60638 64678 +39415 82391 +17390 82391 +64214 77539 +59411 78901 +13819 33984 +92129 28689 +51618 86239 +24039 42459 +27702 39776 +69110 75948 +58967 84872 +97823 45780 +11609 82400 +54722 82391 +82391 18829 +74051 85569 +24976 75812 +65185 36777 +86919 18888 +39690 82947 +42614 48845 +36554 16859 +29410 99296 +38412 70501 +74218 18829 +49407 90164 +48400 64678 +23114 82947 +27649 78088 +68537 78526 +24479 21094 +47444 99057 +65003 33984 +39426 83535 +90358 51196 +22234 98284 +30880 28789 +32544 82947 +10847 82947 +54047 18829 +52242 32818 +10490 24089 +41618 75977 +35876 14549 +49262 28889 +94438 26726 +51893 75812 +93759 58987 +51981 14510 +60103 71702 +88905 66508 +48747 42459 +96263 75812 +40463 83870 +48597 57204 +22536 44753 +66412 99054 +17790 66120 +77539 25203 +78865 50851 +50309 81159 +17303 35610 +54010 79127 +20241 14510 +63100 92950 +83731 14510 +68951 31982 +56970 82400 +44753 60853 +46362 49519 +67946 60853 +84813 83698 +71665 11245 +30689 66459 +69584 47324 +42706 75812 +52831 78088 +92039 20602 +58831 14549 +20290 41051 +90055 41727 +50084 48967 +23456 27651 +39078 41568 +63877 34199 +99100 83870 +45801 64678 +84659 44834 +11493 25580 +69169 85661 +67297 75310 +13814 88874 +92809 83870 +84504 44970 +18829 39776 +32708 83870 +55821 81159 +33006 82400 +73062 16859 +19055 99551 +78888 33984 +19620 36962 +35643 84872 +36777 74691 +81225 41051 +11880 96744 +58979 11943 +22530 25580 +61936 72308 +50817 85661 +33683 82947 +38394 67535 +78267 50808 +90229 95996 +76219 47324 +24324 40775 +64552 77539 +50492 24650 +75184 37186 +72456 98388 +65577 28564 +74502 42459 +70395 70501 +45032 12987 +71299 82400 +39462 59882 +90600 62577 +47384 74691 +13946 81159 +72317 58599 +15940 38852 +10917 33984 +35057 70501 +62360 55948 +78591 36777 +92380 95224 +80300 25360 +74967 47844 +33642 32775 +67167 29873 +84766 31938 +54914 18149 +12612 60853 +51871 78088 +52446 11322 +45850 99057 +86339 20388 +92007 92950 +50584 55255 +74877 83870 +70625 36777 +59262 76788 +88734 74877 +54461 99057 +53614 20602 +97695 92442 +95664 74877 +26474 63443 +40271 66508 +46223 27041 +95183 18367 +23141 76135 +90287 82391 +86387 74877 +59164 63318 +96424 13830 +46986 50003 +14676 98418 +16897 75812 +93799 83870 +26152 14783 +73164 35799 +83870 74691 +69539 25580 +37270 25580 +22633 66508 +95442 35703 +60229 92950 +68469 74691 +32827 95745 +54254 66508 +19421 30678 +83601 37175 +48236 33984 +35864 92869 +12715 91646 +37578 49676 +52157 28386 +89788 39266 +55235 50669 +77355 33641 +92895 48400 +90314 82391 +89697 29794 +78864 81204 +74210 71372 +19120 45857 +50876 30101 +59106 92950 +19702 25499 +97014 91896 +74875 16783 +13073 84306 +26041 83870 +68942 88484 +40578 83731 +72258 65004 +92705 83870 +86757 59882 +98431 76644 +26967 82947 +16928 37207 +35610 15275 +78099 66508 +18168 48400 +58016 48400 +81932 93264 +49522 70501 +46342 99057 +78434 34199 +57459 93096 +99686 37409 +45420 15677 +65862 61547 +68451 32852 +62057 20602 +54187 53430 +41398 43131 +81637 25396 +10157 93885 +66508 12152 +10450 84872 +25261 20602 +56274 63730 +72119 95604 +46569 75812 +35380 42970 +43443 92950 +39631 52734 +42459 45026 +96567 34884 +93222 62504 +60053 71698 +75897 47324 +48328 20602 +99057 48400 +35826 82341 +67035 82400 +58053 86856 +81936 12257 +68310 14510 +29468 62020 +81781 67379 +15436 14549 +56095 65185 +66163 10638 +49425 14510 +68972 92950 +49574 14549 +38234 83870 +28540 84872 +81462 48400 +41295 34199 +80808 91315 +28524 33984 +77949 74691 +99083 20602 +62026 42459 +31125 48400 +79195 63833 +42400 74725 +13187 57183 +28716 77539 +80819 92964 +95678 39668 +54023 39776 +59766 42459 +71124 13499 +68339 49253 +61897 46696 +80221 11294 +35387 98184 +68473 39786 +35763 73269 +65760 20385 +89259 47268 +14170 77539 +35101 85211 +18374 83870 +92328 85661 +82839 78903 +18361 33984 +23227 74691 +95071 64678 +90966 82947 +95801 77539 +81159 64755 +65256 70501 +55147 13543 +15387 99057 +35642 82400 +32240 27515 +67866 14549 +12086 49665 +36184 84872 +15635 31890 +10214 40993 +49134 77539 +62743 48400 +44489 70501 +80178 68714 +36457 78753 +17887 84293 +16849 67107 +63559 77539 +80694 52080 +58142 78088 +18872 14510 +12338 67478 +85829 40208 +66792 84872 +61928 93693 +33263 17549 +84614 81847 +61330 48400 +68335 20602 +29181 60853 +74548 75771 +30127 15911 +47115 26923 +91933 35610 +83734 84584 +44683 89834 +41249 78088 +80290 48400 +96903 79098 +70501 82561 +32022 63239 +69817 24120 +90313 78614 +70861 42934 +58151 47251 +28667 55887 +22841 34199 +73857 71309 +16835 14899 +95850 34199 +50640 51985 +18035 47324 +37594 50221 +16970 71726 +25362 15286 +44543 18995 +83609 45774 +89691 84872 +50795 70501 +24679 48469 +71908 82947 +67185 38287 +18054 35390 +34199 69184 +40616 75812 +20602 94728 +49793 82400 +14963 24258 +60662 74691 +86403 43539 +74430 66236 +77078 39136 +87428 82947 +77070 54393 +70944 42459 +12653 18130 +81773 25580 +49019 17153 +82455 31077 +25942 64678 +26835 91201 +39062 80768 +81313 27193 +45192 77539 +15593 37923 +56100 28304 +82947 38124 +88630 40195 +52146 10487 +85442 23549 +99766 23732 +16859 25580 +21961 24033 +76135 30552 +17662 77266 +52907 28266 +98310 14512 +52835 17260 +41921 99977 +98536 79658 +14361 75812 +33091 85661 +98222 76135 +21436 89453 +38710 11479 +82047 68962 +35897 14592 +88326 74877 +46035 99057 +78652 97213 +44755 20602 +96573 47324 +36653 46767 +70603 26820 +61979 76005 +21272 39776 +78088 81081 +34305 33984 +35661 10012 +61006 47115 +93440 41051 +21321 98330 +75070 16859 +95372 70501 +38869 60853 +76195 78088 +14557 46481 +42861 86390 +57044 34199 +68752 33984 +86232 67003 +27620 76135 +55091 37530 +29965 41051 +33771 84872 +58339 66508 +12708 75812 +72653 92869 +84021 10337 +87356 82391 +74653 92950 +92234 47324 +50621 33984 +42267 64801 +22400 42459 +24231 79555 +58301 84563 +80962 99057 +71109 14549 +65386 46911 +26148 43854 +38755 82400 +75344 98637 +25436 14549 +64378 97144 +62564 94652 +10638 16859 +38487 36777 +73552 66508 +91379 34199 +22001 14549 +56967 13015 +98527 38329 +41766 38964 +10762 75812 +15598 25580 +42586 16859 +51351 32233 +59322 66508 +98442 10520 +15717 73514 +20342 72228 +13498 75812 diff --git a/2024/01a/run.rb b/2024/01a/run.rb new file mode 100755 index 0000000..420a596 --- /dev/null +++ b/2024/01a/run.rb @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby + +data = File.read("data.txt") + +data = data.split("\n") +data = data.map(&:split) + +first_row = data.map { |data| data[0] }.sort +second_row = data.map { |data| data[1] }.sort + +merged = first_row.zip(second_row) + +distance = merged.map do |row| + (row[0].to_i - row[1].to_i).abs +end.sum + +p distance diff --git a/2024/01b/data.txt b/2024/01b/data.txt new file mode 100644 index 0000000..7d1b595 --- /dev/null +++ b/2024/01b/data.txt @@ -0,0 +1,1000 @@ +40094 37480 +52117 14510 +92290 82570 +41563 59882 +56597 98604 +60657 66508 +85570 59882 +56065 27818 +78474 72704 +71099 14510 +34302 92950 +11680 14510 +17162 66508 +85767 69912 +43222 99057 +84192 42459 +86349 47916 +15974 93804 +62582 84872 +46480 96423 +49083 47125 +26321 82391 +29705 99057 +76669 53445 +97344 23937 +22364 82947 +43057 41784 +89096 14096 +54594 74691 +16496 21289 +16315 26820 +12070 39776 +92869 76329 +51048 82455 +39150 94320 +58187 83731 +68901 59853 +73788 77097 +11009 17200 +88295 15720 +59037 65311 +89459 74691 +44460 30211 +71139 80238 +91079 65185 +35005 50427 +50560 84872 +66445 66508 +11233 14510 +17699 33984 +90637 44753 +93142 10300 +19092 42065 +19173 83731 +58875 86050 +63423 83870 +71780 70501 +29252 92869 +59508 78068 +28083 14549 +81355 33405 +64678 38506 +83118 41435 +83177 48400 +94114 70501 +52985 82400 +60853 70531 +70827 98303 +78106 23782 +58175 55623 +33789 19841 +76421 45114 +58847 77539 +99979 53408 +59287 42943 +73877 29014 +95914 36915 +84344 87773 +19462 84872 +75441 13097 +51621 85661 +18456 32965 +49881 48400 +59056 55469 +52464 14549 +17562 76246 +99617 74396 +14300 46447 +15278 16859 +78081 41160 +74953 18829 +96718 92869 +56734 70429 +96632 92950 +87669 82496 +41413 47115 +23478 83870 +44726 38354 +98494 70501 +20040 82400 +52539 42459 +66799 78088 +34219 14821 +47568 77539 +36511 76135 +49296 14510 +81088 39776 +29532 39776 +93599 32110 +89573 43968 +61226 48400 +61073 17960 +10265 55334 +83307 82947 +26932 81159 +66857 83731 +77172 74877 +82796 14510 +83224 75812 +65968 33984 +58067 54289 +27835 73261 +25580 85562 +28693 14510 +11013 42459 +72686 75812 +38200 64002 +10540 82391 +16594 86787 +38238 47324 +72787 84872 +32314 65237 +52509 85451 +11856 42459 +74689 14549 +11006 47324 +62911 36777 +96648 28762 +78556 84872 +43118 55149 +15524 18835 +97188 68430 +36316 11638 +23469 74803 +30969 33984 +19616 57386 +74603 51560 +73140 52522 +50052 84086 +67225 82400 +82945 39776 +59463 36777 +43724 39776 +38655 36019 +16887 34982 +63076 82400 +57786 92869 +40159 91888 +86882 74877 +30168 74750 +94821 91385 +22335 20714 +14549 74691 +17267 46572 +86022 83923 +40758 83870 +33144 41548 +20281 78088 +87782 14661 +26820 67869 +72492 81368 +92950 55032 +42737 36777 +22360 65185 +61694 67189 +43534 76135 +25697 62054 +65617 70501 +36055 82455 +42978 70973 +69418 29676 +87319 39776 +92611 74554 +45366 50611 +86780 47925 +14580 36676 +60406 24721 +44987 66508 +23481 13654 +89422 77304 +21807 92950 +52893 22984 +70221 76135 +61432 28691 +50739 61410 +69705 10534 +11551 84737 +14653 82947 +84764 70227 +19435 86399 +46702 90481 +59882 66508 +27462 39776 +45303 78835 +41509 75370 +22494 80790 +59433 58283 +19204 20602 +13874 75812 +50130 44169 +68727 83731 +58262 18103 +33787 88584 +28931 50419 +90686 77539 +33865 92950 +57146 59882 +26465 55530 +68279 41051 +77998 92950 +44063 69056 +21928 28982 +18478 83731 +79582 30353 +80695 81630 +25322 71284 +52650 91070 +90146 16859 +74890 66508 +54271 49699 +35728 96535 +15295 88122 +85415 41051 +96077 74836 +71257 31093 +10677 78088 +72271 58494 +50820 64678 +12266 33434 +32264 78179 +59541 64841 +51353 83870 +41310 74853 +62865 15554 +66303 53130 +30556 25580 +27203 66508 +31790 71172 +33932 47324 +43212 88773 +58069 83731 +88235 25580 +41094 99057 +25979 25580 +62261 60853 +79993 23589 +73964 71455 +82400 64678 +65762 18579 +73651 16859 +67581 76135 +30713 14716 +47252 19658 +14691 39961 +40662 12202 +57025 69091 +83266 48400 +30600 79683 +62076 16859 +16881 83870 +65361 63743 +80773 63741 +71794 48591 +65839 66508 +75318 20602 +91238 82391 +45707 64678 +40980 77539 +85661 99057 +59298 29272 +19492 84014 +93934 48400 +15984 64678 +89737 48584 +94738 63640 +36639 52035 +61394 40066 +48772 34199 +18258 74691 +20283 80659 +63972 40629 +82137 59882 +76239 25580 +12349 41106 +75728 64348 +74691 78088 +62001 21680 +70269 34199 +25443 39776 +19584 15829 +30199 87448 +92524 19400 +41674 23116 +63728 44519 +99875 91712 +17735 30851 +67540 81902 +27828 92950 +85889 33984 +39816 37113 +87480 91733 +19469 33984 +62803 12772 +17043 33984 +97479 81159 +91505 45435 +12207 69925 +60626 95997 +68126 92869 +76852 13346 +71419 70109 +49664 42459 +74526 32376 +16446 47891 +23116 39776 +43806 64678 +23988 61719 +97167 92950 +66668 44592 +25225 35154 +14284 14510 +23861 47115 +55048 45238 +33484 60853 +46372 80717 +61795 22743 +73995 44753 +89733 76532 +91399 53238 +53467 20602 +71484 98629 +37974 64678 +73312 99057 +75812 73554 +47324 58729 +14895 92017 +69525 50204 +47032 78088 +90971 72856 +63357 33984 +94931 99057 +11959 73715 +70226 77539 +54005 44541 +38941 48400 +64230 74691 +31008 11797 +47599 55425 +67007 10384 +14054 82455 +22131 22556 +52663 80307 +90266 61207 +76934 33537 +97373 27252 +37507 99057 +95323 86821 +79869 56443 +53249 77539 +62806 14510 +23745 41051 +61452 60853 +97548 19963 +57870 24236 +18763 15129 +85117 39776 +30254 51456 +51491 67525 +93572 77539 +82325 83731 +15877 41056 +98690 11852 +58483 14549 +46792 46579 +19738 32343 +96327 41051 +84003 82455 +58135 99057 +22481 68384 +38401 92272 +44698 30430 +39030 14510 +64037 47324 +70100 84872 +64299 48400 +75003 18219 +74190 19588 +71831 92869 +20635 88403 +28133 39036 +39722 42459 +42378 20602 +31939 75812 +69490 77539 +85822 41051 +99562 93734 +48527 23116 +56404 52393 +44682 26105 +66332 92869 +55356 52743 +13056 18829 +19925 82455 +66686 22256 +48103 99057 +82466 99057 +71384 20602 +56960 36777 +14192 41310 +44212 58300 +71988 92950 +90172 75812 +86104 75812 +58359 98375 +95930 48202 +61264 14510 +85630 74877 +27124 48370 +49572 48140 +48424 77539 +77569 45931 +30308 81159 +26594 40011 +63775 66508 +34220 82947 +46571 47585 +81978 77539 +37668 82947 +51727 66508 +79066 20602 +12567 74691 +47130 12241 +15691 93831 +65408 33984 +15617 82400 +48601 36777 +10561 60853 +97955 41051 +82817 21661 +21081 77539 +50859 33984 +23474 82400 +15893 47324 +48663 98013 +80276 77539 +29558 64989 +98180 99880 +31381 66796 +32510 14549 +47508 15854 +14500 14549 +30226 70501 +10524 92869 +26213 92869 +75481 44753 +39239 53324 +72660 64678 +16154 83870 +84492 41051 +21987 20602 +45236 75576 +36827 57147 +81865 60831 +36531 99057 +77201 70501 +28863 31856 +32410 48400 +62294 53873 +49825 99057 +17226 50273 +36614 34199 +14510 48400 +15818 74691 +41051 27891 +39776 33984 +43740 25580 +61248 97412 +63739 47404 +33984 88105 +64598 81159 +71104 89965 +71399 13250 +22174 20602 +60654 39776 +36993 45136 +81016 74327 +47735 64918 +80903 14510 +87865 39776 +38245 91066 +29883 51319 +52463 23311 +32632 35610 +75507 97544 +57330 65354 +59693 55540 +96123 48400 +15649 92950 +84872 82947 +52036 85576 +56140 65185 +23571 32245 +45230 97874 +49231 50934 +43993 85661 +27831 14510 +59732 83870 +46676 39776 +92968 60853 +66157 28036 +88365 70501 +78552 95048 +30812 39388 +70615 32340 +90718 49637 +55059 43376 +44052 32254 +64928 14510 +49820 82400 +60638 64678 +39415 82391 +17390 82391 +64214 77539 +59411 78901 +13819 33984 +92129 28689 +51618 86239 +24039 42459 +27702 39776 +69110 75948 +58967 84872 +97823 45780 +11609 82400 +54722 82391 +82391 18829 +74051 85569 +24976 75812 +65185 36777 +86919 18888 +39690 82947 +42614 48845 +36554 16859 +29410 99296 +38412 70501 +74218 18829 +49407 90164 +48400 64678 +23114 82947 +27649 78088 +68537 78526 +24479 21094 +47444 99057 +65003 33984 +39426 83535 +90358 51196 +22234 98284 +30880 28789 +32544 82947 +10847 82947 +54047 18829 +52242 32818 +10490 24089 +41618 75977 +35876 14549 +49262 28889 +94438 26726 +51893 75812 +93759 58987 +51981 14510 +60103 71702 +88905 66508 +48747 42459 +96263 75812 +40463 83870 +48597 57204 +22536 44753 +66412 99054 +17790 66120 +77539 25203 +78865 50851 +50309 81159 +17303 35610 +54010 79127 +20241 14510 +63100 92950 +83731 14510 +68951 31982 +56970 82400 +44753 60853 +46362 49519 +67946 60853 +84813 83698 +71665 11245 +30689 66459 +69584 47324 +42706 75812 +52831 78088 +92039 20602 +58831 14549 +20290 41051 +90055 41727 +50084 48967 +23456 27651 +39078 41568 +63877 34199 +99100 83870 +45801 64678 +84659 44834 +11493 25580 +69169 85661 +67297 75310 +13814 88874 +92809 83870 +84504 44970 +18829 39776 +32708 83870 +55821 81159 +33006 82400 +73062 16859 +19055 99551 +78888 33984 +19620 36962 +35643 84872 +36777 74691 +81225 41051 +11880 96744 +58979 11943 +22530 25580 +61936 72308 +50817 85661 +33683 82947 +38394 67535 +78267 50808 +90229 95996 +76219 47324 +24324 40775 +64552 77539 +50492 24650 +75184 37186 +72456 98388 +65577 28564 +74502 42459 +70395 70501 +45032 12987 +71299 82400 +39462 59882 +90600 62577 +47384 74691 +13946 81159 +72317 58599 +15940 38852 +10917 33984 +35057 70501 +62360 55948 +78591 36777 +92380 95224 +80300 25360 +74967 47844 +33642 32775 +67167 29873 +84766 31938 +54914 18149 +12612 60853 +51871 78088 +52446 11322 +45850 99057 +86339 20388 +92007 92950 +50584 55255 +74877 83870 +70625 36777 +59262 76788 +88734 74877 +54461 99057 +53614 20602 +97695 92442 +95664 74877 +26474 63443 +40271 66508 +46223 27041 +95183 18367 +23141 76135 +90287 82391 +86387 74877 +59164 63318 +96424 13830 +46986 50003 +14676 98418 +16897 75812 +93799 83870 +26152 14783 +73164 35799 +83870 74691 +69539 25580 +37270 25580 +22633 66508 +95442 35703 +60229 92950 +68469 74691 +32827 95745 +54254 66508 +19421 30678 +83601 37175 +48236 33984 +35864 92869 +12715 91646 +37578 49676 +52157 28386 +89788 39266 +55235 50669 +77355 33641 +92895 48400 +90314 82391 +89697 29794 +78864 81204 +74210 71372 +19120 45857 +50876 30101 +59106 92950 +19702 25499 +97014 91896 +74875 16783 +13073 84306 +26041 83870 +68942 88484 +40578 83731 +72258 65004 +92705 83870 +86757 59882 +98431 76644 +26967 82947 +16928 37207 +35610 15275 +78099 66508 +18168 48400 +58016 48400 +81932 93264 +49522 70501 +46342 99057 +78434 34199 +57459 93096 +99686 37409 +45420 15677 +65862 61547 +68451 32852 +62057 20602 +54187 53430 +41398 43131 +81637 25396 +10157 93885 +66508 12152 +10450 84872 +25261 20602 +56274 63730 +72119 95604 +46569 75812 +35380 42970 +43443 92950 +39631 52734 +42459 45026 +96567 34884 +93222 62504 +60053 71698 +75897 47324 +48328 20602 +99057 48400 +35826 82341 +67035 82400 +58053 86856 +81936 12257 +68310 14510 +29468 62020 +81781 67379 +15436 14549 +56095 65185 +66163 10638 +49425 14510 +68972 92950 +49574 14549 +38234 83870 +28540 84872 +81462 48400 +41295 34199 +80808 91315 +28524 33984 +77949 74691 +99083 20602 +62026 42459 +31125 48400 +79195 63833 +42400 74725 +13187 57183 +28716 77539 +80819 92964 +95678 39668 +54023 39776 +59766 42459 +71124 13499 +68339 49253 +61897 46696 +80221 11294 +35387 98184 +68473 39786 +35763 73269 +65760 20385 +89259 47268 +14170 77539 +35101 85211 +18374 83870 +92328 85661 +82839 78903 +18361 33984 +23227 74691 +95071 64678 +90966 82947 +95801 77539 +81159 64755 +65256 70501 +55147 13543 +15387 99057 +35642 82400 +32240 27515 +67866 14549 +12086 49665 +36184 84872 +15635 31890 +10214 40993 +49134 77539 +62743 48400 +44489 70501 +80178 68714 +36457 78753 +17887 84293 +16849 67107 +63559 77539 +80694 52080 +58142 78088 +18872 14510 +12338 67478 +85829 40208 +66792 84872 +61928 93693 +33263 17549 +84614 81847 +61330 48400 +68335 20602 +29181 60853 +74548 75771 +30127 15911 +47115 26923 +91933 35610 +83734 84584 +44683 89834 +41249 78088 +80290 48400 +96903 79098 +70501 82561 +32022 63239 +69817 24120 +90313 78614 +70861 42934 +58151 47251 +28667 55887 +22841 34199 +73857 71309 +16835 14899 +95850 34199 +50640 51985 +18035 47324 +37594 50221 +16970 71726 +25362 15286 +44543 18995 +83609 45774 +89691 84872 +50795 70501 +24679 48469 +71908 82947 +67185 38287 +18054 35390 +34199 69184 +40616 75812 +20602 94728 +49793 82400 +14963 24258 +60662 74691 +86403 43539 +74430 66236 +77078 39136 +87428 82947 +77070 54393 +70944 42459 +12653 18130 +81773 25580 +49019 17153 +82455 31077 +25942 64678 +26835 91201 +39062 80768 +81313 27193 +45192 77539 +15593 37923 +56100 28304 +82947 38124 +88630 40195 +52146 10487 +85442 23549 +99766 23732 +16859 25580 +21961 24033 +76135 30552 +17662 77266 +52907 28266 +98310 14512 +52835 17260 +41921 99977 +98536 79658 +14361 75812 +33091 85661 +98222 76135 +21436 89453 +38710 11479 +82047 68962 +35897 14592 +88326 74877 +46035 99057 +78652 97213 +44755 20602 +96573 47324 +36653 46767 +70603 26820 +61979 76005 +21272 39776 +78088 81081 +34305 33984 +35661 10012 +61006 47115 +93440 41051 +21321 98330 +75070 16859 +95372 70501 +38869 60853 +76195 78088 +14557 46481 +42861 86390 +57044 34199 +68752 33984 +86232 67003 +27620 76135 +55091 37530 +29965 41051 +33771 84872 +58339 66508 +12708 75812 +72653 92869 +84021 10337 +87356 82391 +74653 92950 +92234 47324 +50621 33984 +42267 64801 +22400 42459 +24231 79555 +58301 84563 +80962 99057 +71109 14549 +65386 46911 +26148 43854 +38755 82400 +75344 98637 +25436 14549 +64378 97144 +62564 94652 +10638 16859 +38487 36777 +73552 66508 +91379 34199 +22001 14549 +56967 13015 +98527 38329 +41766 38964 +10762 75812 +15598 25580 +42586 16859 +51351 32233 +59322 66508 +98442 10520 +15717 73514 +20342 72228 +13498 75812 diff --git a/2024/01b/run.rb b/2024/01b/run.rb new file mode 100755 index 0000000..29d9539 --- /dev/null +++ b/2024/01b/run.rb @@ -0,0 +1,24 @@ +#!/usr/bin/env ruby + +data = File.read("data.txt") + +data = data.split("\n") +data = data.map(&:split) + +first_row = data.map { |data| data[0].to_i } +second_row = {} + +data.map do |data| + value = data[1].to_i + count = second_row[value] ? second_row[value] + 1 : 1 + second_row[value] = count +end + +similiarity = first_row.map do |value| + multiplayer = second_row.fetch(value, 0) + value * multiplayer +end.sum + +p similiarity + + diff --git a/2024/02a/data.txt b/2024/02a/data.txt new file mode 100644 index 0000000..88eccc0 --- /dev/null +++ b/2024/02a/data.txt @@ -0,0 +1,1000 @@ +90 91 93 96 93 +3 5 7 10 11 11 +35 37 39 42 46 +67 70 72 74 79 +9 12 13 16 15 16 19 +48 51 52 55 58 61 58 57 +3 4 7 9 8 9 9 +22 25 28 30 28 32 +38 41 44 45 42 49 +54 57 59 59 61 +54 55 55 56 58 55 +66 68 70 71 72 72 75 75 +32 35 35 38 42 +22 24 26 28 28 31 34 41 +55 57 59 63 64 +18 21 25 26 28 27 +39 40 41 43 47 49 50 50 +10 11 14 17 20 22 26 30 +35 36 39 40 44 45 52 +57 59 66 67 70 +15 17 19 22 29 26 +66 69 72 75 78 83 83 +73 76 78 83 86 90 +23 26 28 35 36 41 +83 81 82 85 88 90 92 93 +4 2 3 4 1 +8 7 8 9 11 13 13 +71 70 71 73 76 80 +22 20 21 22 25 31 +80 78 81 83 82 84 87 88 +14 13 16 19 18 19 20 18 +69 68 65 67 67 +57 55 56 55 59 +5 4 7 9 11 13 12 18 +91 88 88 90 92 93 +47 45 48 48 46 +58 56 59 60 63 63 63 +39 37 40 43 43 45 49 +34 33 36 36 43 +13 11 13 17 20 23 25 +11 8 12 14 12 +2 1 5 7 7 +8 7 10 14 18 +38 36 38 40 41 45 48 53 +68 67 72 75 77 79 +25 24 26 29 30 37 39 37 +31 29 31 37 37 +64 61 62 69 72 76 +5 2 5 11 14 15 22 +55 55 58 60 61 64 65 +59 59 61 63 66 65 +2 2 5 7 9 12 12 +29 29 31 34 35 38 39 43 +42 42 44 46 49 51 54 61 +89 89 90 93 96 94 96 98 +41 41 39 40 41 43 45 42 +36 36 38 35 37 37 +1 1 4 2 6 +36 36 39 41 40 42 47 +29 29 29 32 35 36 +24 24 26 29 31 31 29 +58 58 58 60 60 +56 56 56 58 62 +73 73 76 76 79 86 +49 49 52 56 59 +11 11 12 13 17 18 15 +63 63 67 70 70 +82 82 86 89 90 91 94 98 +38 38 40 42 45 49 54 +16 16 21 22 23 +45 45 51 54 51 +6 6 7 10 13 14 20 20 +22 22 23 29 30 32 33 37 +7 7 13 14 21 +81 85 87 89 90 92 95 97 +75 79 80 81 79 +56 60 61 63 65 65 +67 71 74 75 79 +4 8 11 13 15 18 23 +83 87 85 87 90 93 95 +90 94 95 93 94 93 +87 91 92 93 96 94 94 +34 38 39 36 38 39 43 +4 8 9 7 10 17 +23 27 28 30 33 33 34 36 +11 15 15 17 16 +38 42 44 47 48 49 49 49 +43 47 49 49 52 55 59 +79 83 85 85 92 +16 20 24 26 29 30 +77 81 83 87 90 92 89 +33 37 39 42 44 48 51 51 +71 75 79 81 85 +69 73 76 77 81 88 +33 37 42 44 47 50 53 +13 17 20 23 28 26 +51 55 56 59 60 62 67 67 +35 39 41 43 49 52 56 +60 64 70 71 76 +25 32 34 37 38 41 +1 6 8 10 12 9 +20 27 29 30 30 +52 59 60 62 63 64 65 69 +71 78 80 81 84 85 90 +64 71 73 71 72 73 76 +67 72 75 76 74 76 77 76 +38 43 40 41 41 +2 8 11 9 13 +72 79 80 79 80 86 +21 26 26 29 31 +72 78 79 79 81 83 81 +76 81 84 84 85 85 +42 47 50 53 53 54 58 +14 21 23 25 26 29 29 35 +83 88 90 93 97 98 +17 22 26 29 30 31 28 +46 52 54 58 58 +22 28 32 33 37 +65 71 73 77 82 +64 71 73 75 78 81 88 89 +42 47 50 55 56 54 +69 74 77 79 85 85 +54 59 62 68 72 +40 45 46 51 53 55 61 +55 53 50 47 44 43 40 42 +94 91 90 89 86 85 85 +52 50 47 46 44 40 +52 49 47 45 43 38 +88 87 88 85 84 82 81 78 +95 93 96 93 94 +84 83 84 83 83 +70 67 65 64 61 64 60 +98 97 98 97 95 94 92 86 +29 27 24 24 22 +34 31 30 30 28 29 +83 81 78 78 77 75 75 +60 59 59 58 57 55 52 48 +97 96 96 95 93 88 +50 49 47 43 42 41 39 +45 43 39 38 37 40 +91 89 85 83 83 +20 18 14 11 7 +82 81 79 76 75 71 66 +45 43 42 40 33 30 28 25 +92 91 85 84 85 +30 29 24 21 18 15 14 14 +31 28 27 26 21 18 14 +38 35 34 33 31 28 22 17 +46 47 45 43 41 +89 90 88 86 84 83 84 +68 71 69 68 66 66 +71 73 72 69 65 +44 46 43 41 38 32 +8 11 9 12 11 10 +49 51 49 48 50 52 +75 76 79 76 76 +67 70 71 70 66 +51 53 54 53 50 48 47 42 +67 69 66 65 65 62 +57 59 59 58 55 53 54 +66 67 66 66 63 63 +49 50 49 46 46 43 40 36 +50 52 52 50 49 47 40 +22 23 20 16 13 11 10 8 +29 31 30 26 23 26 +46 47 43 42 42 +65 68 67 64 63 59 55 +68 69 67 64 60 58 53 +87 90 87 82 80 79 78 77 +43 44 43 41 34 37 +13 14 13 11 10 4 4 +77 78 76 74 69 67 63 +69 71 69 63 61 54 +32 32 29 26 25 22 20 19 +99 99 98 97 96 98 +91 91 89 88 86 86 +26 26 23 21 17 +45 45 43 42 40 37 36 30 +41 41 39 42 39 37 +7 7 6 8 7 4 2 4 +30 30 33 32 31 29 27 27 +58 58 55 53 50 53 49 +31 31 28 31 25 +35 35 35 32 30 +46 46 46 43 44 +38 38 38 37 37 +77 77 74 71 71 69 65 +70 70 68 65 65 62 60 54 +60 60 58 54 51 48 45 43 +32 32 28 27 26 23 21 24 +43 43 41 40 36 36 +72 72 70 66 62 +25 25 23 19 13 +68 68 67 65 62 61 56 54 +74 74 71 69 67 60 59 61 +40 40 37 32 32 +73 73 66 64 61 57 +47 47 41 40 35 +84 80 77 75 73 70 68 +93 89 88 86 85 82 80 81 +35 31 30 28 27 26 25 25 +28 24 22 21 18 17 13 +34 30 28 27 25 22 20 15 +17 13 10 7 10 7 +95 91 94 92 90 92 +20 16 13 12 13 11 9 9 +58 54 53 52 54 52 48 +86 82 83 82 77 +28 24 21 21 20 +97 93 93 91 92 +28 24 23 20 18 18 18 +38 34 32 32 30 28 27 23 +53 49 47 46 45 44 44 39 +69 65 62 61 57 56 53 +48 44 42 40 39 35 38 +73 69 67 63 63 +59 55 53 51 47 44 41 37 +83 79 76 73 71 68 64 57 +23 19 17 16 14 9 8 +51 47 45 38 41 +77 73 70 68 63 61 60 60 +26 22 21 20 18 17 11 7 +31 27 26 21 14 +34 27 25 22 19 +78 71 70 67 70 +62 56 53 50 48 46 46 +18 12 11 9 5 +79 74 72 69 67 66 65 58 +10 5 6 3 1 +69 63 65 63 60 62 +60 54 51 49 52 50 50 +28 23 25 24 21 17 +58 51 52 50 49 46 41 +49 44 44 41 39 36 +47 40 38 38 37 36 35 38 +48 43 41 40 37 37 37 +87 82 80 77 77 73 +24 18 18 16 15 14 9 +83 77 73 71 68 67 66 64 +58 53 49 47 48 +50 45 44 40 38 38 +34 29 28 24 22 21 20 16 +48 42 41 39 35 29 +94 89 83 82 80 78 +65 58 51 49 46 48 +51 46 43 40 33 32 29 29 +53 48 45 43 37 33 +85 80 79 74 71 70 63 +9 11 13 14 15 18 19 17 +88 91 93 95 96 96 +2 4 6 7 9 13 +59 60 63 66 68 69 74 +16 17 16 19 20 22 +20 22 19 21 18 +11 12 14 15 13 16 16 +24 25 26 23 27 +83 84 85 84 87 88 94 +41 42 45 45 48 50 51 +38 41 42 45 45 48 50 48 +73 75 75 78 78 +68 69 70 70 73 76 79 83 +58 61 64 64 65 66 73 +32 33 34 36 40 41 43 +35 36 37 41 42 44 43 +79 81 82 83 87 89 92 92 +54 55 57 58 62 66 +33 35 36 40 42 49 +15 17 22 23 26 +18 20 27 29 31 33 32 +79 81 83 84 90 91 91 +32 33 35 41 45 +75 77 80 83 89 91 98 +14 12 14 15 16 17 +89 86 89 92 93 94 95 92 +56 55 58 61 61 +41 40 42 43 45 48 50 54 +56 54 56 58 65 +61 59 56 58 61 +59 57 60 61 60 57 +24 23 25 27 24 25 27 27 +90 87 88 86 88 92 +11 8 6 9 10 11 18 +74 73 73 75 78 80 +88 85 88 88 86 +92 91 92 92 94 94 +5 2 2 4 8 +42 41 43 46 48 48 54 +62 60 62 63 65 69 70 72 +91 88 92 95 94 +48 47 51 52 54 54 +20 18 19 20 21 25 27 31 +80 77 80 84 90 +56 53 56 57 60 67 70 +8 5 10 13 16 15 +39 38 40 43 50 52 52 +54 51 54 61 64 67 71 +58 55 61 62 64 67 70 76 +67 67 69 72 73 76 79 82 +11 11 14 15 18 20 19 +63 63 66 68 70 72 72 +26 26 28 31 33 36 40 +67 67 68 70 73 76 78 83 +8 8 11 13 15 12 13 16 +13 13 10 13 16 17 20 18 +49 49 48 51 53 55 55 +37 37 39 38 42 +85 85 87 84 91 +21 21 23 23 25 +56 56 59 60 60 63 61 +37 37 39 42 45 45 45 +49 49 51 54 57 58 58 62 +31 31 31 32 34 36 42 +67 67 68 70 73 76 80 81 +9 9 12 13 16 20 18 +73 73 76 78 80 81 85 85 +60 60 61 65 68 71 75 +7 7 11 12 19 +44 44 45 46 47 53 55 +16 16 21 22 25 28 27 +9 9 10 15 18 21 24 24 +83 83 84 87 89 94 98 +24 24 27 29 36 37 43 +81 85 86 88 91 94 95 97 +41 45 46 49 51 50 +31 35 36 37 38 39 39 +56 60 61 62 65 69 +74 78 79 81 82 88 +12 16 17 14 15 18 +58 62 63 65 63 65 63 +39 43 42 45 48 49 49 +57 61 59 61 63 64 66 70 +1 5 6 5 7 9 14 +70 74 77 77 78 81 84 85 +25 29 31 31 33 34 36 35 +57 61 61 63 63 +76 80 82 82 86 +28 32 34 35 35 37 44 +52 56 60 63 64 +10 14 16 18 22 25 28 26 +62 66 67 70 73 77 79 79 +42 46 50 53 54 55 56 60 +10 14 18 21 23 30 +72 76 77 82 83 +29 33 36 37 40 43 49 47 +79 83 85 90 90 +63 67 68 70 71 72 78 82 +20 24 27 29 32 39 44 +56 61 62 65 67 +58 65 66 69 70 72 71 +29 36 39 41 41 +70 77 80 83 84 88 +39 45 46 49 55 +45 52 55 54 57 59 62 63 +14 19 20 22 19 21 24 23 +11 18 21 22 24 22 22 +49 54 57 59 62 65 63 67 +37 42 39 40 41 48 +14 19 22 23 26 26 29 +87 94 95 96 96 93 +51 58 61 62 64 64 64 +57 64 65 66 68 68 69 73 +31 36 38 38 39 46 +16 23 25 28 31 34 38 39 +46 53 56 59 63 62 +46 51 53 56 58 59 63 63 +39 46 50 51 54 58 +63 70 71 75 82 +71 77 78 79 86 88 +75 81 83 89 91 92 91 +57 64 65 67 70 72 79 79 +4 10 13 20 21 23 24 28 +7 12 15 20 25 +74 72 71 69 68 65 68 +79 77 74 73 73 +60 59 57 56 52 +32 31 28 25 18 +35 32 33 31 28 +30 29 31 29 26 25 22 23 +10 9 8 7 5 7 7 +68 67 66 64 65 61 +68 66 64 66 63 62 56 +74 73 73 71 69 67 66 64 +92 91 88 88 90 +48 47 44 44 43 43 +45 42 40 40 39 35 +51 48 48 45 42 39 32 +93 90 89 85 82 +83 81 78 74 73 75 +82 79 75 72 69 68 68 +76 75 73 72 70 67 63 59 +95 93 89 88 81 +70 69 68 61 58 56 53 +99 98 97 90 92 +33 30 23 20 18 15 15 +82 79 76 71 69 68 65 61 +28 25 23 16 14 12 10 4 +14 15 13 12 9 8 5 +67 68 67 64 63 61 59 61 +84 86 85 83 83 +43 46 45 43 39 +45 46 44 41 40 34 +45 48 46 43 41 44 43 42 +19 21 20 22 24 +68 69 68 69 66 66 +33 34 32 35 31 +88 91 90 92 90 85 +30 31 30 27 26 26 24 22 +35 38 36 36 38 +7 9 9 7 7 +39 41 38 38 34 +30 31 28 28 22 +43 46 42 41 38 36 33 +74 75 73 69 72 +20 23 20 17 15 11 11 +56 57 54 50 47 46 44 40 +20 21 18 16 12 10 4 +44 45 43 37 34 +47 48 46 45 43 42 36 38 +51 52 50 44 41 41 +37 40 35 34 32 28 +94 97 94 91 90 87 82 77 +88 88 85 82 80 77 74 +87 87 84 81 80 83 +67 67 65 64 64 +68 68 65 62 58 +32 32 29 26 23 18 +64 64 65 64 63 61 +66 66 67 65 68 +79 79 76 77 74 73 73 +68 68 69 67 65 64 63 59 +75 75 72 75 74 72 65 +73 73 71 70 70 69 +96 96 94 92 92 89 91 +43 43 41 41 40 40 +95 95 94 94 91 89 85 +69 69 66 66 59 +55 55 54 52 48 46 44 +28 28 26 25 23 19 18 21 +27 27 25 24 20 20 +17 17 13 10 6 +86 86 85 81 76 +53 53 52 49 44 43 41 +91 91 90 85 84 81 84 +96 96 90 87 84 81 78 78 +76 76 74 71 70 63 59 +46 46 44 41 40 34 27 +52 48 46 43 42 41 +58 54 52 49 50 +76 72 70 68 65 65 +23 19 18 15 13 11 10 6 +26 22 19 16 11 +46 42 40 37 40 38 35 +19 15 14 13 10 11 8 10 +91 87 85 83 81 78 81 81 +77 73 75 74 72 69 68 64 +39 35 32 35 32 27 +94 90 89 86 86 84 82 +99 95 94 92 92 94 +53 49 48 48 48 +86 82 80 80 78 75 71 +42 38 38 36 29 +31 27 25 21 18 17 +84 80 76 73 74 +86 82 81 79 75 75 +46 42 38 36 32 +69 65 64 60 53 +82 78 75 69 66 65 63 +93 89 86 81 82 +91 87 86 84 77 77 +31 27 25 23 22 15 11 +95 91 88 81 78 77 72 +40 34 32 29 28 25 +79 72 69 68 65 62 59 60 +80 73 72 71 69 66 66 +95 88 85 84 82 78 +31 25 24 23 21 15 +34 29 30 27 24 21 20 19 +72 65 63 62 59 60 61 +14 8 9 7 5 5 +75 69 72 70 67 64 63 59 +72 66 63 64 62 59 53 +26 20 19 17 17 14 +89 84 84 82 79 78 75 78 +65 59 57 57 55 52 49 49 +17 10 9 8 8 4 +52 45 44 44 41 39 32 +16 11 8 4 2 +49 43 39 38 36 33 36 +77 70 69 68 64 64 +68 61 58 55 51 48 44 +41 34 30 28 27 20 +35 28 27 24 17 15 +43 38 35 32 30 29 22 24 +68 61 58 53 53 +23 16 11 8 4 +53 47 45 44 37 34 28 +75 71 68 68 65 64 58 +62 66 67 70 67 69 69 +26 30 31 34 37 44 46 46 +77 79 77 80 79 77 80 +28 33 34 35 37 41 43 +74 76 80 82 83 86 89 96 +39 35 37 36 31 +34 36 34 32 28 +56 54 53 48 45 41 +68 70 69 67 65 63 62 +41 44 45 48 52 53 56 53 +84 84 77 75 72 72 +84 86 83 85 88 87 +66 66 71 72 73 75 81 +76 76 77 79 80 82 88 89 +30 26 23 20 19 15 10 +42 38 36 34 33 33 35 +34 32 30 28 23 20 18 11 +35 38 37 35 35 33 +72 68 67 66 64 67 65 62 +74 70 66 64 61 61 +30 33 35 37 41 +38 42 45 47 50 56 +62 65 67 65 65 +30 31 33 37 38 +41 34 30 28 27 25 24 25 +71 73 75 74 79 +74 73 70 64 62 62 +81 85 86 88 88 88 +87 83 84 81 79 75 +56 58 56 53 50 48 46 41 +54 48 44 42 42 +40 42 40 39 38 32 30 30 +52 55 57 60 61 64 66 66 +68 67 70 73 74 77 82 81 +70 71 76 78 82 +54 57 59 63 67 +78 84 85 85 86 90 +12 19 20 21 22 20 23 23 +80 80 79 80 76 +84 79 79 78 78 +7 8 11 14 16 18 19 25 +12 12 11 9 11 5 +11 15 19 20 18 +82 83 86 88 88 90 91 +18 15 12 12 11 9 11 +24 31 32 35 39 43 +6 4 6 5 6 12 +64 68 73 75 78 80 81 85 +43 47 48 46 47 54 +7 10 11 13 17 20 20 +52 46 45 44 43 42 +41 43 43 40 40 +79 81 78 74 71 70 66 +63 62 64 67 70 71 71 +13 17 20 26 28 +18 15 13 16 19 22 23 20 +81 77 71 68 67 +28 22 18 15 12 9 8 +30 30 32 35 36 +40 40 41 43 44 47 47 +96 96 97 97 95 +55 55 59 60 63 67 +44 51 51 53 60 +23 30 31 32 35 36 36 +54 54 56 59 61 67 68 68 +76 76 79 80 81 84 84 91 +33 26 23 22 22 21 22 +88 88 88 86 79 +35 39 42 44 48 54 +87 87 88 90 88 89 89 +17 11 8 11 8 9 +32 36 37 40 41 +72 73 72 70 67 65 66 64 +49 55 57 55 57 60 61 64 +20 20 19 20 17 +37 36 39 38 37 34 +28 30 27 26 25 23 18 20 +17 16 14 10 6 +87 83 78 75 74 71 70 72 +1 5 9 12 14 14 +30 29 30 29 25 +41 41 44 44 46 +81 79 77 76 73 +32 29 27 24 21 18 17 +33 36 39 41 43 +59 60 61 62 63 64 67 70 +16 17 20 22 23 +54 57 58 60 61 63 64 65 +13 12 11 9 7 6 4 +39 42 43 46 48 49 +73 74 75 76 79 80 83 85 +45 48 51 52 54 57 58 +31 28 25 24 23 +63 60 57 56 55 52 +26 27 28 30 32 35 +29 32 34 35 36 38 +28 29 30 33 35 36 37 +35 36 37 40 42 44 47 +87 85 82 79 77 76 +16 14 12 10 8 6 5 3 +74 71 68 65 63 +22 21 19 18 17 +51 48 45 42 41 38 35 32 +59 58 56 54 52 +36 35 34 32 31 30 +75 78 79 81 83 84 +80 82 85 88 91 93 94 +29 31 32 35 38 41 +83 84 87 89 90 91 +16 19 21 24 27 29 +35 36 39 41 43 +22 25 26 29 32 33 +34 31 28 25 22 20 18 +50 47 44 41 39 37 35 32 +41 39 36 34 32 31 +34 32 31 28 27 +25 23 22 21 20 17 +86 88 90 91 92 94 96 +51 52 55 58 60 +43 41 39 38 36 35 34 33 +36 33 30 29 28 +77 78 79 82 85 +88 85 82 81 79 78 76 +20 22 25 28 30 33 35 37 +16 19 22 25 28 30 32 +98 96 93 91 89 87 +80 77 76 74 72 +5 8 9 12 15 17 +14 13 10 7 5 +37 39 42 45 46 47 48 +1 3 6 8 10 11 14 +18 17 15 14 11 10 +49 48 47 45 43 40 37 +90 89 86 83 80 78 +91 89 86 84 81 79 76 +61 58 55 52 50 49 +77 80 82 83 86 88 89 91 +41 42 43 44 45 +53 51 50 49 47 44 41 38 +92 93 96 97 98 +51 52 53 56 58 +70 69 67 65 62 +21 23 24 25 26 28 31 32 +37 39 42 44 47 49 51 52 +29 31 33 34 35 36 37 38 +26 24 21 18 16 15 12 9 +75 72 71 68 66 63 62 +66 67 70 72 74 +78 77 74 72 71 70 +12 13 15 18 20 21 24 27 +65 64 63 61 60 57 +26 24 23 20 17 15 12 +17 19 22 25 27 30 +88 85 84 81 78 76 75 73 +85 84 81 78 75 72 69 67 +21 19 18 17 14 +62 59 58 55 53 51 50 +93 91 89 86 84 81 +79 82 85 88 89 91 +87 89 91 92 94 97 +98 97 95 94 93 91 88 85 +35 38 41 42 43 44 47 +65 62 61 58 56 55 52 +30 27 26 23 20 17 14 +55 54 53 50 48 47 +80 78 77 75 73 71 +48 51 54 56 57 +40 38 36 35 33 +70 73 76 79 81 84 86 88 +47 45 44 41 40 38 37 34 +35 34 32 29 27 +44 47 50 53 56 +7 9 10 12 13 14 +58 59 62 65 66 67 68 +19 18 16 14 12 10 7 +86 85 83 81 80 78 +56 57 60 63 64 67 68 69 +99 96 93 90 89 +37 36 34 32 31 29 +59 56 53 51 50 48 +73 72 71 70 69 66 65 +53 52 51 50 48 47 +76 75 72 71 68 67 66 +49 52 55 58 60 62 +80 78 75 72 71 68 67 +41 39 37 35 32 29 26 25 +66 67 70 72 73 +54 53 51 49 47 44 43 41 +93 96 97 98 99 +75 76 78 80 81 82 83 +45 43 40 39 37 34 +4 6 8 11 12 +46 43 41 39 36 34 31 +61 58 55 54 52 50 47 45 +16 14 11 8 6 +75 76 79 81 82 83 +47 45 43 41 38 37 34 31 +90 89 88 85 84 82 80 +49 47 44 43 41 39 36 +15 13 12 11 10 7 5 2 +99 97 95 94 93 +9 10 12 15 18 21 23 +8 11 13 14 15 16 +27 30 32 35 36 37 39 40 +56 59 62 64 67 69 +60 63 64 66 67 70 72 +48 50 51 53 54 +51 48 45 44 42 41 39 36 +58 60 63 64 66 67 68 71 +74 72 71 70 67 +89 86 84 83 81 78 76 75 +74 76 79 80 83 85 87 89 +95 94 93 90 88 85 +24 27 28 30 31 33 +62 63 66 67 69 71 +68 70 72 74 77 +23 22 19 16 15 +3 5 7 8 10 11 14 17 +82 85 86 88 89 90 +12 10 7 6 3 2 +41 42 43 44 47 50 +16 19 22 23 24 27 +55 52 49 47 44 +83 82 80 79 78 75 72 +81 80 79 77 76 75 72 +41 39 38 36 35 34 +21 24 27 28 29 32 33 34 +79 78 75 72 71 70 67 66 +62 59 56 55 54 51 +85 86 88 91 92 94 97 99 +69 67 65 64 61 59 +54 55 58 61 64 +75 77 80 82 83 86 88 +10 11 12 13 14 15 17 19 +69 72 74 76 78 80 81 +93 92 89 87 84 82 +44 41 38 37 35 34 33 +99 98 95 92 91 88 87 84 +40 37 35 33 30 27 24 23 +4 7 10 12 14 17 +74 77 80 82 84 +33 34 37 38 40 42 43 46 +29 27 26 23 22 19 +57 59 62 64 66 +17 14 11 10 7 6 3 2 +79 76 73 70 69 68 +51 48 46 44 42 40 38 +40 41 43 45 46 47 49 +14 11 9 8 6 3 +16 15 12 9 8 5 4 +68 67 66 64 63 60 58 56 +32 31 30 29 28 +36 39 40 42 45 46 +27 29 32 35 36 37 39 +89 88 87 85 84 81 78 77 +42 40 38 35 33 32 29 27 +50 47 46 45 42 +68 69 71 74 76 77 +23 25 27 28 30 32 33 35 +7 9 12 14 16 17 20 21 +77 74 72 71 70 69 67 66 +11 9 7 6 5 3 +23 22 20 18 17 15 14 12 +84 85 88 90 91 +50 51 54 57 60 63 64 +66 68 70 73 74 75 +77 78 81 82 85 +38 41 42 44 47 50 51 52 +89 90 91 93 94 97 +36 39 41 43 44 +19 22 23 26 27 30 +29 27 24 22 20 +27 25 22 19 18 +31 34 35 36 37 40 41 44 +91 92 93 95 98 +67 70 73 74 76 +17 18 19 22 25 27 29 +35 33 30 29 26 24 22 21 +13 11 10 7 5 4 3 +78 76 75 73 72 70 68 66 +86 87 88 90 91 +22 21 18 17 14 12 10 +67 68 71 74 77 80 +50 53 56 57 59 62 65 +70 71 72 73 74 77 80 +53 55 56 58 59 60 63 +44 42 40 39 37 35 +39 38 36 33 30 28 26 +50 48 47 45 44 41 +51 48 46 45 44 42 39 +87 85 82 79 78 77 76 +76 75 74 73 71 68 +67 69 72 73 76 79 80 81 +68 65 63 61 60 +70 68 66 65 63 60 +49 50 53 56 59 62 +37 40 41 43 44 47 50 52 +66 65 63 61 58 55 +41 38 35 34 32 31 +33 32 31 28 25 23 +42 41 39 38 36 35 32 30 +51 48 47 45 43 42 +49 47 45 42 39 38 36 +86 83 80 79 76 73 72 71 +52 53 56 58 61 62 63 +54 57 59 61 62 +2 4 6 7 10 +7 10 11 12 13 14 16 19 +67 69 71 72 73 74 +36 37 38 41 43 46 49 50 +72 75 76 79 80 81 +12 11 10 7 6 +26 28 29 31 34 36 +66 63 62 61 58 +46 43 41 39 36 34 33 31 +37 39 41 44 47 50 51 53 +22 19 18 16 13 +20 22 25 26 27 +68 65 64 62 60 +9 10 13 16 18 20 21 +51 53 56 59 62 +19 20 23 24 26 27 29 +25 22 20 18 16 +50 52 54 56 58 61 62 +27 25 22 21 20 19 16 15 +47 48 51 52 55 56 58 +18 20 21 22 24 26 27 30 +76 77 80 81 82 83 85 +31 33 36 39 40 +23 25 28 31 34 37 38 39 +70 69 68 66 64 62 60 +43 42 41 38 35 +9 10 12 14 16 19 20 22 +65 62 59 58 56 53 50 48 +12 15 18 20 22 23 26 29 +32 35 37 40 41 44 46 47 +60 57 54 53 52 49 +25 28 29 30 31 +91 90 89 87 85 84 +1 4 7 9 10 12 +24 25 26 29 32 33 +39 41 44 45 47 49 50 +37 34 33 31 28 26 24 +54 57 59 61 62 63 +92 89 86 84 81 79 78 +42 45 47 50 52 55 +24 27 28 29 32 34 35 +8 5 4 3 1 +13 15 18 19 22 25 28 +61 59 58 56 53 50 +7 9 12 15 16 18 +13 15 16 19 21 +82 81 78 75 74 +6 8 10 13 16 +33 31 29 28 25 24 23 20 +12 10 9 7 4 +1 3 5 8 11 14 17 19 +31 28 26 24 21 +22 23 25 27 28 31 33 +24 22 20 18 16 +63 66 67 68 71 +51 48 45 44 43 +81 83 84 87 88 89 92 93 +85 82 80 77 75 73 +82 80 77 74 71 68 65 64 +57 58 61 64 65 66 +55 54 51 48 47 44 +7 10 13 14 17 19 +70 68 66 65 64 +57 59 62 65 66 69 +23 21 20 17 16 14 13 +58 57 56 53 52 49 46 +30 31 33 35 38 41 43 +35 36 38 41 43 +45 47 50 53 54 55 +46 49 52 54 55 56 59 62 +56 57 60 61 64 67 68 +28 30 32 34 36 37 39 42 +19 17 16 13 11 9 +9 10 11 13 16 19 +65 63 61 59 58 57 55 +85 82 80 79 76 73 72 +37 35 34 31 30 +67 66 65 62 60 59 56 +51 54 56 58 60 62 +60 57 56 54 52 49 +85 82 81 78 77 +90 89 88 85 83 82 79 78 +41 38 36 33 32 +94 92 90 88 87 86 83 80 +89 87 85 83 81 80 77 +66 67 70 71 73 74 75 +66 65 63 62 61 +75 73 71 69 67 66 +36 34 33 31 30 29 27 +71 69 66 65 62 59 57 +27 25 23 22 19 18 15 13 +55 54 53 51 48 +23 21 18 15 13 11 8 7 +63 66 69 70 72 75 76 +46 44 42 40 37 34 33 +39 38 35 34 33 30 29 28 +10 13 15 18 19 20 21 23 +20 19 18 15 13 10 +65 67 70 71 73 75 78 +60 61 64 65 66 67 70 73 +68 67 64 62 60 +64 63 60 57 55 52 +84 85 88 90 93 96 98 99 +84 87 90 93 96 97 99 +81 83 86 89 91 92 93 94 +42 45 47 48 51 54 +72 74 77 79 81 83 84 86 +54 53 50 49 46 43 +55 57 58 60 62 64 66 68 +20 21 22 23 25 26 27 +53 54 56 58 59 60 61 +67 68 70 72 73 76 +20 17 15 12 10 8 +71 68 65 62 61 60 59 57 +78 76 75 73 72 +25 23 22 19 18 17 15 13 +30 29 27 26 25 23 20 18 +23 24 25 28 29 31 34 +40 43 45 47 49 +44 46 48 51 52 53 +38 36 33 31 28 +28 29 32 34 37 38 40 41 +44 45 46 48 49 +99 96 93 91 89 87 84 82 +49 48 47 45 43 +79 81 84 85 87 89 92 +28 29 32 35 38 39 41 42 +26 23 22 19 16 14 13 +30 27 24 23 20 19 +76 74 71 69 67 64 +99 96 95 94 93 90 88 +69 68 67 64 63 62 60 +88 91 93 95 97 +86 87 90 91 92 95 96 +33 34 36 37 39 40 +65 63 62 59 58 +29 28 26 24 21 19 17 +87 84 81 80 78 77 74 72 +89 87 84 81 78 +76 79 81 84 86 87 88 +48 50 53 54 55 +38 41 42 43 45 +93 90 88 86 84 81 80 77 +87 85 83 80 78 +75 73 71 70 69 +23 21 20 18 15 12 9 6 +89 87 84 81 79 +80 83 85 86 88 91 94 +62 65 66 69 70 71 +28 26 23 21 19 +94 93 90 87 86 83 +19 17 15 13 11 10 8 6 +63 65 67 68 71 +2 3 6 7 10 11 +37 39 42 44 45 +52 54 56 57 60 +54 51 50 49 47 +55 54 53 52 50 47 +78 80 82 85 86 +76 74 73 71 68 +78 79 82 84 85 87 90 93 +52 51 50 49 48 +25 28 30 32 35 36 38 +59 56 55 52 49 46 45 42 +18 19 22 23 25 28 30 +57 56 55 52 51 48 45 +55 53 51 50 47 44 +34 33 32 31 28 25 23 +75 72 71 69 68 67 65 64 +4 7 10 12 13 15 16 +61 59 57 55 54 53 52 49 +72 71 69 68 67 65 62 59 +32 33 34 35 36 37 +21 19 16 15 13 12 10 +56 55 52 50 47 44 43 +66 68 70 73 76 79 82 +12 11 8 5 3 2 +87 89 91 94 96 +81 78 77 74 73 70 69 +75 78 81 82 84 85 87 89 +36 35 34 31 29 27 25 22 +39 38 36 34 31 28 25 +64 65 67 70 72 +82 85 87 88 90 92 94 95 +46 45 43 41 40 38 36 35 +45 47 48 50 53 55 +52 51 50 48 47 46 +59 56 54 52 50 48 46 43 +6 9 12 13 15 18 20 22 +18 16 15 12 9 +14 11 9 6 3 2 +64 62 59 57 55 54 +50 47 45 44 43 +62 64 65 67 70 71 72 +66 67 70 73 74 76 78 80 +61 63 66 68 70 +28 27 24 22 19 diff --git a/2024/02a/run.rb b/2024/02a/run.rb new file mode 100755 index 0000000..2ba1060 --- /dev/null +++ b/2024/02a/run.rb @@ -0,0 +1,32 @@ +#!/usr/bin/env ruby + +data = File.read("data.txt") + +data = data.split("\n") +data = data.map(&:split) + +safe_arr = data.map do |row| + directions = [] + + row.each_with_index do |value, index| + next if index.zero? + distance = (value.to_i - row[index-1].to_i) + direction = if (distance.abs > 3 ) + :err + elsif distance > 0 + :up + elsif distance < 0 + :down + else + :err + end + + directions << direction + end + + directions.uniq.count == 1 ? 1 : 0 + + +end + +p safe_arr.sum diff --git a/2024/02b/data.txt b/2024/02b/data.txt new file mode 100644 index 0000000..88eccc0 --- /dev/null +++ b/2024/02b/data.txt @@ -0,0 +1,1000 @@ +90 91 93 96 93 +3 5 7 10 11 11 +35 37 39 42 46 +67 70 72 74 79 +9 12 13 16 15 16 19 +48 51 52 55 58 61 58 57 +3 4 7 9 8 9 9 +22 25 28 30 28 32 +38 41 44 45 42 49 +54 57 59 59 61 +54 55 55 56 58 55 +66 68 70 71 72 72 75 75 +32 35 35 38 42 +22 24 26 28 28 31 34 41 +55 57 59 63 64 +18 21 25 26 28 27 +39 40 41 43 47 49 50 50 +10 11 14 17 20 22 26 30 +35 36 39 40 44 45 52 +57 59 66 67 70 +15 17 19 22 29 26 +66 69 72 75 78 83 83 +73 76 78 83 86 90 +23 26 28 35 36 41 +83 81 82 85 88 90 92 93 +4 2 3 4 1 +8 7 8 9 11 13 13 +71 70 71 73 76 80 +22 20 21 22 25 31 +80 78 81 83 82 84 87 88 +14 13 16 19 18 19 20 18 +69 68 65 67 67 +57 55 56 55 59 +5 4 7 9 11 13 12 18 +91 88 88 90 92 93 +47 45 48 48 46 +58 56 59 60 63 63 63 +39 37 40 43 43 45 49 +34 33 36 36 43 +13 11 13 17 20 23 25 +11 8 12 14 12 +2 1 5 7 7 +8 7 10 14 18 +38 36 38 40 41 45 48 53 +68 67 72 75 77 79 +25 24 26 29 30 37 39 37 +31 29 31 37 37 +64 61 62 69 72 76 +5 2 5 11 14 15 22 +55 55 58 60 61 64 65 +59 59 61 63 66 65 +2 2 5 7 9 12 12 +29 29 31 34 35 38 39 43 +42 42 44 46 49 51 54 61 +89 89 90 93 96 94 96 98 +41 41 39 40 41 43 45 42 +36 36 38 35 37 37 +1 1 4 2 6 +36 36 39 41 40 42 47 +29 29 29 32 35 36 +24 24 26 29 31 31 29 +58 58 58 60 60 +56 56 56 58 62 +73 73 76 76 79 86 +49 49 52 56 59 +11 11 12 13 17 18 15 +63 63 67 70 70 +82 82 86 89 90 91 94 98 +38 38 40 42 45 49 54 +16 16 21 22 23 +45 45 51 54 51 +6 6 7 10 13 14 20 20 +22 22 23 29 30 32 33 37 +7 7 13 14 21 +81 85 87 89 90 92 95 97 +75 79 80 81 79 +56 60 61 63 65 65 +67 71 74 75 79 +4 8 11 13 15 18 23 +83 87 85 87 90 93 95 +90 94 95 93 94 93 +87 91 92 93 96 94 94 +34 38 39 36 38 39 43 +4 8 9 7 10 17 +23 27 28 30 33 33 34 36 +11 15 15 17 16 +38 42 44 47 48 49 49 49 +43 47 49 49 52 55 59 +79 83 85 85 92 +16 20 24 26 29 30 +77 81 83 87 90 92 89 +33 37 39 42 44 48 51 51 +71 75 79 81 85 +69 73 76 77 81 88 +33 37 42 44 47 50 53 +13 17 20 23 28 26 +51 55 56 59 60 62 67 67 +35 39 41 43 49 52 56 +60 64 70 71 76 +25 32 34 37 38 41 +1 6 8 10 12 9 +20 27 29 30 30 +52 59 60 62 63 64 65 69 +71 78 80 81 84 85 90 +64 71 73 71 72 73 76 +67 72 75 76 74 76 77 76 +38 43 40 41 41 +2 8 11 9 13 +72 79 80 79 80 86 +21 26 26 29 31 +72 78 79 79 81 83 81 +76 81 84 84 85 85 +42 47 50 53 53 54 58 +14 21 23 25 26 29 29 35 +83 88 90 93 97 98 +17 22 26 29 30 31 28 +46 52 54 58 58 +22 28 32 33 37 +65 71 73 77 82 +64 71 73 75 78 81 88 89 +42 47 50 55 56 54 +69 74 77 79 85 85 +54 59 62 68 72 +40 45 46 51 53 55 61 +55 53 50 47 44 43 40 42 +94 91 90 89 86 85 85 +52 50 47 46 44 40 +52 49 47 45 43 38 +88 87 88 85 84 82 81 78 +95 93 96 93 94 +84 83 84 83 83 +70 67 65 64 61 64 60 +98 97 98 97 95 94 92 86 +29 27 24 24 22 +34 31 30 30 28 29 +83 81 78 78 77 75 75 +60 59 59 58 57 55 52 48 +97 96 96 95 93 88 +50 49 47 43 42 41 39 +45 43 39 38 37 40 +91 89 85 83 83 +20 18 14 11 7 +82 81 79 76 75 71 66 +45 43 42 40 33 30 28 25 +92 91 85 84 85 +30 29 24 21 18 15 14 14 +31 28 27 26 21 18 14 +38 35 34 33 31 28 22 17 +46 47 45 43 41 +89 90 88 86 84 83 84 +68 71 69 68 66 66 +71 73 72 69 65 +44 46 43 41 38 32 +8 11 9 12 11 10 +49 51 49 48 50 52 +75 76 79 76 76 +67 70 71 70 66 +51 53 54 53 50 48 47 42 +67 69 66 65 65 62 +57 59 59 58 55 53 54 +66 67 66 66 63 63 +49 50 49 46 46 43 40 36 +50 52 52 50 49 47 40 +22 23 20 16 13 11 10 8 +29 31 30 26 23 26 +46 47 43 42 42 +65 68 67 64 63 59 55 +68 69 67 64 60 58 53 +87 90 87 82 80 79 78 77 +43 44 43 41 34 37 +13 14 13 11 10 4 4 +77 78 76 74 69 67 63 +69 71 69 63 61 54 +32 32 29 26 25 22 20 19 +99 99 98 97 96 98 +91 91 89 88 86 86 +26 26 23 21 17 +45 45 43 42 40 37 36 30 +41 41 39 42 39 37 +7 7 6 8 7 4 2 4 +30 30 33 32 31 29 27 27 +58 58 55 53 50 53 49 +31 31 28 31 25 +35 35 35 32 30 +46 46 46 43 44 +38 38 38 37 37 +77 77 74 71 71 69 65 +70 70 68 65 65 62 60 54 +60 60 58 54 51 48 45 43 +32 32 28 27 26 23 21 24 +43 43 41 40 36 36 +72 72 70 66 62 +25 25 23 19 13 +68 68 67 65 62 61 56 54 +74 74 71 69 67 60 59 61 +40 40 37 32 32 +73 73 66 64 61 57 +47 47 41 40 35 +84 80 77 75 73 70 68 +93 89 88 86 85 82 80 81 +35 31 30 28 27 26 25 25 +28 24 22 21 18 17 13 +34 30 28 27 25 22 20 15 +17 13 10 7 10 7 +95 91 94 92 90 92 +20 16 13 12 13 11 9 9 +58 54 53 52 54 52 48 +86 82 83 82 77 +28 24 21 21 20 +97 93 93 91 92 +28 24 23 20 18 18 18 +38 34 32 32 30 28 27 23 +53 49 47 46 45 44 44 39 +69 65 62 61 57 56 53 +48 44 42 40 39 35 38 +73 69 67 63 63 +59 55 53 51 47 44 41 37 +83 79 76 73 71 68 64 57 +23 19 17 16 14 9 8 +51 47 45 38 41 +77 73 70 68 63 61 60 60 +26 22 21 20 18 17 11 7 +31 27 26 21 14 +34 27 25 22 19 +78 71 70 67 70 +62 56 53 50 48 46 46 +18 12 11 9 5 +79 74 72 69 67 66 65 58 +10 5 6 3 1 +69 63 65 63 60 62 +60 54 51 49 52 50 50 +28 23 25 24 21 17 +58 51 52 50 49 46 41 +49 44 44 41 39 36 +47 40 38 38 37 36 35 38 +48 43 41 40 37 37 37 +87 82 80 77 77 73 +24 18 18 16 15 14 9 +83 77 73 71 68 67 66 64 +58 53 49 47 48 +50 45 44 40 38 38 +34 29 28 24 22 21 20 16 +48 42 41 39 35 29 +94 89 83 82 80 78 +65 58 51 49 46 48 +51 46 43 40 33 32 29 29 +53 48 45 43 37 33 +85 80 79 74 71 70 63 +9 11 13 14 15 18 19 17 +88 91 93 95 96 96 +2 4 6 7 9 13 +59 60 63 66 68 69 74 +16 17 16 19 20 22 +20 22 19 21 18 +11 12 14 15 13 16 16 +24 25 26 23 27 +83 84 85 84 87 88 94 +41 42 45 45 48 50 51 +38 41 42 45 45 48 50 48 +73 75 75 78 78 +68 69 70 70 73 76 79 83 +58 61 64 64 65 66 73 +32 33 34 36 40 41 43 +35 36 37 41 42 44 43 +79 81 82 83 87 89 92 92 +54 55 57 58 62 66 +33 35 36 40 42 49 +15 17 22 23 26 +18 20 27 29 31 33 32 +79 81 83 84 90 91 91 +32 33 35 41 45 +75 77 80 83 89 91 98 +14 12 14 15 16 17 +89 86 89 92 93 94 95 92 +56 55 58 61 61 +41 40 42 43 45 48 50 54 +56 54 56 58 65 +61 59 56 58 61 +59 57 60 61 60 57 +24 23 25 27 24 25 27 27 +90 87 88 86 88 92 +11 8 6 9 10 11 18 +74 73 73 75 78 80 +88 85 88 88 86 +92 91 92 92 94 94 +5 2 2 4 8 +42 41 43 46 48 48 54 +62 60 62 63 65 69 70 72 +91 88 92 95 94 +48 47 51 52 54 54 +20 18 19 20 21 25 27 31 +80 77 80 84 90 +56 53 56 57 60 67 70 +8 5 10 13 16 15 +39 38 40 43 50 52 52 +54 51 54 61 64 67 71 +58 55 61 62 64 67 70 76 +67 67 69 72 73 76 79 82 +11 11 14 15 18 20 19 +63 63 66 68 70 72 72 +26 26 28 31 33 36 40 +67 67 68 70 73 76 78 83 +8 8 11 13 15 12 13 16 +13 13 10 13 16 17 20 18 +49 49 48 51 53 55 55 +37 37 39 38 42 +85 85 87 84 91 +21 21 23 23 25 +56 56 59 60 60 63 61 +37 37 39 42 45 45 45 +49 49 51 54 57 58 58 62 +31 31 31 32 34 36 42 +67 67 68 70 73 76 80 81 +9 9 12 13 16 20 18 +73 73 76 78 80 81 85 85 +60 60 61 65 68 71 75 +7 7 11 12 19 +44 44 45 46 47 53 55 +16 16 21 22 25 28 27 +9 9 10 15 18 21 24 24 +83 83 84 87 89 94 98 +24 24 27 29 36 37 43 +81 85 86 88 91 94 95 97 +41 45 46 49 51 50 +31 35 36 37 38 39 39 +56 60 61 62 65 69 +74 78 79 81 82 88 +12 16 17 14 15 18 +58 62 63 65 63 65 63 +39 43 42 45 48 49 49 +57 61 59 61 63 64 66 70 +1 5 6 5 7 9 14 +70 74 77 77 78 81 84 85 +25 29 31 31 33 34 36 35 +57 61 61 63 63 +76 80 82 82 86 +28 32 34 35 35 37 44 +52 56 60 63 64 +10 14 16 18 22 25 28 26 +62 66 67 70 73 77 79 79 +42 46 50 53 54 55 56 60 +10 14 18 21 23 30 +72 76 77 82 83 +29 33 36 37 40 43 49 47 +79 83 85 90 90 +63 67 68 70 71 72 78 82 +20 24 27 29 32 39 44 +56 61 62 65 67 +58 65 66 69 70 72 71 +29 36 39 41 41 +70 77 80 83 84 88 +39 45 46 49 55 +45 52 55 54 57 59 62 63 +14 19 20 22 19 21 24 23 +11 18 21 22 24 22 22 +49 54 57 59 62 65 63 67 +37 42 39 40 41 48 +14 19 22 23 26 26 29 +87 94 95 96 96 93 +51 58 61 62 64 64 64 +57 64 65 66 68 68 69 73 +31 36 38 38 39 46 +16 23 25 28 31 34 38 39 +46 53 56 59 63 62 +46 51 53 56 58 59 63 63 +39 46 50 51 54 58 +63 70 71 75 82 +71 77 78 79 86 88 +75 81 83 89 91 92 91 +57 64 65 67 70 72 79 79 +4 10 13 20 21 23 24 28 +7 12 15 20 25 +74 72 71 69 68 65 68 +79 77 74 73 73 +60 59 57 56 52 +32 31 28 25 18 +35 32 33 31 28 +30 29 31 29 26 25 22 23 +10 9 8 7 5 7 7 +68 67 66 64 65 61 +68 66 64 66 63 62 56 +74 73 73 71 69 67 66 64 +92 91 88 88 90 +48 47 44 44 43 43 +45 42 40 40 39 35 +51 48 48 45 42 39 32 +93 90 89 85 82 +83 81 78 74 73 75 +82 79 75 72 69 68 68 +76 75 73 72 70 67 63 59 +95 93 89 88 81 +70 69 68 61 58 56 53 +99 98 97 90 92 +33 30 23 20 18 15 15 +82 79 76 71 69 68 65 61 +28 25 23 16 14 12 10 4 +14 15 13 12 9 8 5 +67 68 67 64 63 61 59 61 +84 86 85 83 83 +43 46 45 43 39 +45 46 44 41 40 34 +45 48 46 43 41 44 43 42 +19 21 20 22 24 +68 69 68 69 66 66 +33 34 32 35 31 +88 91 90 92 90 85 +30 31 30 27 26 26 24 22 +35 38 36 36 38 +7 9 9 7 7 +39 41 38 38 34 +30 31 28 28 22 +43 46 42 41 38 36 33 +74 75 73 69 72 +20 23 20 17 15 11 11 +56 57 54 50 47 46 44 40 +20 21 18 16 12 10 4 +44 45 43 37 34 +47 48 46 45 43 42 36 38 +51 52 50 44 41 41 +37 40 35 34 32 28 +94 97 94 91 90 87 82 77 +88 88 85 82 80 77 74 +87 87 84 81 80 83 +67 67 65 64 64 +68 68 65 62 58 +32 32 29 26 23 18 +64 64 65 64 63 61 +66 66 67 65 68 +79 79 76 77 74 73 73 +68 68 69 67 65 64 63 59 +75 75 72 75 74 72 65 +73 73 71 70 70 69 +96 96 94 92 92 89 91 +43 43 41 41 40 40 +95 95 94 94 91 89 85 +69 69 66 66 59 +55 55 54 52 48 46 44 +28 28 26 25 23 19 18 21 +27 27 25 24 20 20 +17 17 13 10 6 +86 86 85 81 76 +53 53 52 49 44 43 41 +91 91 90 85 84 81 84 +96 96 90 87 84 81 78 78 +76 76 74 71 70 63 59 +46 46 44 41 40 34 27 +52 48 46 43 42 41 +58 54 52 49 50 +76 72 70 68 65 65 +23 19 18 15 13 11 10 6 +26 22 19 16 11 +46 42 40 37 40 38 35 +19 15 14 13 10 11 8 10 +91 87 85 83 81 78 81 81 +77 73 75 74 72 69 68 64 +39 35 32 35 32 27 +94 90 89 86 86 84 82 +99 95 94 92 92 94 +53 49 48 48 48 +86 82 80 80 78 75 71 +42 38 38 36 29 +31 27 25 21 18 17 +84 80 76 73 74 +86 82 81 79 75 75 +46 42 38 36 32 +69 65 64 60 53 +82 78 75 69 66 65 63 +93 89 86 81 82 +91 87 86 84 77 77 +31 27 25 23 22 15 11 +95 91 88 81 78 77 72 +40 34 32 29 28 25 +79 72 69 68 65 62 59 60 +80 73 72 71 69 66 66 +95 88 85 84 82 78 +31 25 24 23 21 15 +34 29 30 27 24 21 20 19 +72 65 63 62 59 60 61 +14 8 9 7 5 5 +75 69 72 70 67 64 63 59 +72 66 63 64 62 59 53 +26 20 19 17 17 14 +89 84 84 82 79 78 75 78 +65 59 57 57 55 52 49 49 +17 10 9 8 8 4 +52 45 44 44 41 39 32 +16 11 8 4 2 +49 43 39 38 36 33 36 +77 70 69 68 64 64 +68 61 58 55 51 48 44 +41 34 30 28 27 20 +35 28 27 24 17 15 +43 38 35 32 30 29 22 24 +68 61 58 53 53 +23 16 11 8 4 +53 47 45 44 37 34 28 +75 71 68 68 65 64 58 +62 66 67 70 67 69 69 +26 30 31 34 37 44 46 46 +77 79 77 80 79 77 80 +28 33 34 35 37 41 43 +74 76 80 82 83 86 89 96 +39 35 37 36 31 +34 36 34 32 28 +56 54 53 48 45 41 +68 70 69 67 65 63 62 +41 44 45 48 52 53 56 53 +84 84 77 75 72 72 +84 86 83 85 88 87 +66 66 71 72 73 75 81 +76 76 77 79 80 82 88 89 +30 26 23 20 19 15 10 +42 38 36 34 33 33 35 +34 32 30 28 23 20 18 11 +35 38 37 35 35 33 +72 68 67 66 64 67 65 62 +74 70 66 64 61 61 +30 33 35 37 41 +38 42 45 47 50 56 +62 65 67 65 65 +30 31 33 37 38 +41 34 30 28 27 25 24 25 +71 73 75 74 79 +74 73 70 64 62 62 +81 85 86 88 88 88 +87 83 84 81 79 75 +56 58 56 53 50 48 46 41 +54 48 44 42 42 +40 42 40 39 38 32 30 30 +52 55 57 60 61 64 66 66 +68 67 70 73 74 77 82 81 +70 71 76 78 82 +54 57 59 63 67 +78 84 85 85 86 90 +12 19 20 21 22 20 23 23 +80 80 79 80 76 +84 79 79 78 78 +7 8 11 14 16 18 19 25 +12 12 11 9 11 5 +11 15 19 20 18 +82 83 86 88 88 90 91 +18 15 12 12 11 9 11 +24 31 32 35 39 43 +6 4 6 5 6 12 +64 68 73 75 78 80 81 85 +43 47 48 46 47 54 +7 10 11 13 17 20 20 +52 46 45 44 43 42 +41 43 43 40 40 +79 81 78 74 71 70 66 +63 62 64 67 70 71 71 +13 17 20 26 28 +18 15 13 16 19 22 23 20 +81 77 71 68 67 +28 22 18 15 12 9 8 +30 30 32 35 36 +40 40 41 43 44 47 47 +96 96 97 97 95 +55 55 59 60 63 67 +44 51 51 53 60 +23 30 31 32 35 36 36 +54 54 56 59 61 67 68 68 +76 76 79 80 81 84 84 91 +33 26 23 22 22 21 22 +88 88 88 86 79 +35 39 42 44 48 54 +87 87 88 90 88 89 89 +17 11 8 11 8 9 +32 36 37 40 41 +72 73 72 70 67 65 66 64 +49 55 57 55 57 60 61 64 +20 20 19 20 17 +37 36 39 38 37 34 +28 30 27 26 25 23 18 20 +17 16 14 10 6 +87 83 78 75 74 71 70 72 +1 5 9 12 14 14 +30 29 30 29 25 +41 41 44 44 46 +81 79 77 76 73 +32 29 27 24 21 18 17 +33 36 39 41 43 +59 60 61 62 63 64 67 70 +16 17 20 22 23 +54 57 58 60 61 63 64 65 +13 12 11 9 7 6 4 +39 42 43 46 48 49 +73 74 75 76 79 80 83 85 +45 48 51 52 54 57 58 +31 28 25 24 23 +63 60 57 56 55 52 +26 27 28 30 32 35 +29 32 34 35 36 38 +28 29 30 33 35 36 37 +35 36 37 40 42 44 47 +87 85 82 79 77 76 +16 14 12 10 8 6 5 3 +74 71 68 65 63 +22 21 19 18 17 +51 48 45 42 41 38 35 32 +59 58 56 54 52 +36 35 34 32 31 30 +75 78 79 81 83 84 +80 82 85 88 91 93 94 +29 31 32 35 38 41 +83 84 87 89 90 91 +16 19 21 24 27 29 +35 36 39 41 43 +22 25 26 29 32 33 +34 31 28 25 22 20 18 +50 47 44 41 39 37 35 32 +41 39 36 34 32 31 +34 32 31 28 27 +25 23 22 21 20 17 +86 88 90 91 92 94 96 +51 52 55 58 60 +43 41 39 38 36 35 34 33 +36 33 30 29 28 +77 78 79 82 85 +88 85 82 81 79 78 76 +20 22 25 28 30 33 35 37 +16 19 22 25 28 30 32 +98 96 93 91 89 87 +80 77 76 74 72 +5 8 9 12 15 17 +14 13 10 7 5 +37 39 42 45 46 47 48 +1 3 6 8 10 11 14 +18 17 15 14 11 10 +49 48 47 45 43 40 37 +90 89 86 83 80 78 +91 89 86 84 81 79 76 +61 58 55 52 50 49 +77 80 82 83 86 88 89 91 +41 42 43 44 45 +53 51 50 49 47 44 41 38 +92 93 96 97 98 +51 52 53 56 58 +70 69 67 65 62 +21 23 24 25 26 28 31 32 +37 39 42 44 47 49 51 52 +29 31 33 34 35 36 37 38 +26 24 21 18 16 15 12 9 +75 72 71 68 66 63 62 +66 67 70 72 74 +78 77 74 72 71 70 +12 13 15 18 20 21 24 27 +65 64 63 61 60 57 +26 24 23 20 17 15 12 +17 19 22 25 27 30 +88 85 84 81 78 76 75 73 +85 84 81 78 75 72 69 67 +21 19 18 17 14 +62 59 58 55 53 51 50 +93 91 89 86 84 81 +79 82 85 88 89 91 +87 89 91 92 94 97 +98 97 95 94 93 91 88 85 +35 38 41 42 43 44 47 +65 62 61 58 56 55 52 +30 27 26 23 20 17 14 +55 54 53 50 48 47 +80 78 77 75 73 71 +48 51 54 56 57 +40 38 36 35 33 +70 73 76 79 81 84 86 88 +47 45 44 41 40 38 37 34 +35 34 32 29 27 +44 47 50 53 56 +7 9 10 12 13 14 +58 59 62 65 66 67 68 +19 18 16 14 12 10 7 +86 85 83 81 80 78 +56 57 60 63 64 67 68 69 +99 96 93 90 89 +37 36 34 32 31 29 +59 56 53 51 50 48 +73 72 71 70 69 66 65 +53 52 51 50 48 47 +76 75 72 71 68 67 66 +49 52 55 58 60 62 +80 78 75 72 71 68 67 +41 39 37 35 32 29 26 25 +66 67 70 72 73 +54 53 51 49 47 44 43 41 +93 96 97 98 99 +75 76 78 80 81 82 83 +45 43 40 39 37 34 +4 6 8 11 12 +46 43 41 39 36 34 31 +61 58 55 54 52 50 47 45 +16 14 11 8 6 +75 76 79 81 82 83 +47 45 43 41 38 37 34 31 +90 89 88 85 84 82 80 +49 47 44 43 41 39 36 +15 13 12 11 10 7 5 2 +99 97 95 94 93 +9 10 12 15 18 21 23 +8 11 13 14 15 16 +27 30 32 35 36 37 39 40 +56 59 62 64 67 69 +60 63 64 66 67 70 72 +48 50 51 53 54 +51 48 45 44 42 41 39 36 +58 60 63 64 66 67 68 71 +74 72 71 70 67 +89 86 84 83 81 78 76 75 +74 76 79 80 83 85 87 89 +95 94 93 90 88 85 +24 27 28 30 31 33 +62 63 66 67 69 71 +68 70 72 74 77 +23 22 19 16 15 +3 5 7 8 10 11 14 17 +82 85 86 88 89 90 +12 10 7 6 3 2 +41 42 43 44 47 50 +16 19 22 23 24 27 +55 52 49 47 44 +83 82 80 79 78 75 72 +81 80 79 77 76 75 72 +41 39 38 36 35 34 +21 24 27 28 29 32 33 34 +79 78 75 72 71 70 67 66 +62 59 56 55 54 51 +85 86 88 91 92 94 97 99 +69 67 65 64 61 59 +54 55 58 61 64 +75 77 80 82 83 86 88 +10 11 12 13 14 15 17 19 +69 72 74 76 78 80 81 +93 92 89 87 84 82 +44 41 38 37 35 34 33 +99 98 95 92 91 88 87 84 +40 37 35 33 30 27 24 23 +4 7 10 12 14 17 +74 77 80 82 84 +33 34 37 38 40 42 43 46 +29 27 26 23 22 19 +57 59 62 64 66 +17 14 11 10 7 6 3 2 +79 76 73 70 69 68 +51 48 46 44 42 40 38 +40 41 43 45 46 47 49 +14 11 9 8 6 3 +16 15 12 9 8 5 4 +68 67 66 64 63 60 58 56 +32 31 30 29 28 +36 39 40 42 45 46 +27 29 32 35 36 37 39 +89 88 87 85 84 81 78 77 +42 40 38 35 33 32 29 27 +50 47 46 45 42 +68 69 71 74 76 77 +23 25 27 28 30 32 33 35 +7 9 12 14 16 17 20 21 +77 74 72 71 70 69 67 66 +11 9 7 6 5 3 +23 22 20 18 17 15 14 12 +84 85 88 90 91 +50 51 54 57 60 63 64 +66 68 70 73 74 75 +77 78 81 82 85 +38 41 42 44 47 50 51 52 +89 90 91 93 94 97 +36 39 41 43 44 +19 22 23 26 27 30 +29 27 24 22 20 +27 25 22 19 18 +31 34 35 36 37 40 41 44 +91 92 93 95 98 +67 70 73 74 76 +17 18 19 22 25 27 29 +35 33 30 29 26 24 22 21 +13 11 10 7 5 4 3 +78 76 75 73 72 70 68 66 +86 87 88 90 91 +22 21 18 17 14 12 10 +67 68 71 74 77 80 +50 53 56 57 59 62 65 +70 71 72 73 74 77 80 +53 55 56 58 59 60 63 +44 42 40 39 37 35 +39 38 36 33 30 28 26 +50 48 47 45 44 41 +51 48 46 45 44 42 39 +87 85 82 79 78 77 76 +76 75 74 73 71 68 +67 69 72 73 76 79 80 81 +68 65 63 61 60 +70 68 66 65 63 60 +49 50 53 56 59 62 +37 40 41 43 44 47 50 52 +66 65 63 61 58 55 +41 38 35 34 32 31 +33 32 31 28 25 23 +42 41 39 38 36 35 32 30 +51 48 47 45 43 42 +49 47 45 42 39 38 36 +86 83 80 79 76 73 72 71 +52 53 56 58 61 62 63 +54 57 59 61 62 +2 4 6 7 10 +7 10 11 12 13 14 16 19 +67 69 71 72 73 74 +36 37 38 41 43 46 49 50 +72 75 76 79 80 81 +12 11 10 7 6 +26 28 29 31 34 36 +66 63 62 61 58 +46 43 41 39 36 34 33 31 +37 39 41 44 47 50 51 53 +22 19 18 16 13 +20 22 25 26 27 +68 65 64 62 60 +9 10 13 16 18 20 21 +51 53 56 59 62 +19 20 23 24 26 27 29 +25 22 20 18 16 +50 52 54 56 58 61 62 +27 25 22 21 20 19 16 15 +47 48 51 52 55 56 58 +18 20 21 22 24 26 27 30 +76 77 80 81 82 83 85 +31 33 36 39 40 +23 25 28 31 34 37 38 39 +70 69 68 66 64 62 60 +43 42 41 38 35 +9 10 12 14 16 19 20 22 +65 62 59 58 56 53 50 48 +12 15 18 20 22 23 26 29 +32 35 37 40 41 44 46 47 +60 57 54 53 52 49 +25 28 29 30 31 +91 90 89 87 85 84 +1 4 7 9 10 12 +24 25 26 29 32 33 +39 41 44 45 47 49 50 +37 34 33 31 28 26 24 +54 57 59 61 62 63 +92 89 86 84 81 79 78 +42 45 47 50 52 55 +24 27 28 29 32 34 35 +8 5 4 3 1 +13 15 18 19 22 25 28 +61 59 58 56 53 50 +7 9 12 15 16 18 +13 15 16 19 21 +82 81 78 75 74 +6 8 10 13 16 +33 31 29 28 25 24 23 20 +12 10 9 7 4 +1 3 5 8 11 14 17 19 +31 28 26 24 21 +22 23 25 27 28 31 33 +24 22 20 18 16 +63 66 67 68 71 +51 48 45 44 43 +81 83 84 87 88 89 92 93 +85 82 80 77 75 73 +82 80 77 74 71 68 65 64 +57 58 61 64 65 66 +55 54 51 48 47 44 +7 10 13 14 17 19 +70 68 66 65 64 +57 59 62 65 66 69 +23 21 20 17 16 14 13 +58 57 56 53 52 49 46 +30 31 33 35 38 41 43 +35 36 38 41 43 +45 47 50 53 54 55 +46 49 52 54 55 56 59 62 +56 57 60 61 64 67 68 +28 30 32 34 36 37 39 42 +19 17 16 13 11 9 +9 10 11 13 16 19 +65 63 61 59 58 57 55 +85 82 80 79 76 73 72 +37 35 34 31 30 +67 66 65 62 60 59 56 +51 54 56 58 60 62 +60 57 56 54 52 49 +85 82 81 78 77 +90 89 88 85 83 82 79 78 +41 38 36 33 32 +94 92 90 88 87 86 83 80 +89 87 85 83 81 80 77 +66 67 70 71 73 74 75 +66 65 63 62 61 +75 73 71 69 67 66 +36 34 33 31 30 29 27 +71 69 66 65 62 59 57 +27 25 23 22 19 18 15 13 +55 54 53 51 48 +23 21 18 15 13 11 8 7 +63 66 69 70 72 75 76 +46 44 42 40 37 34 33 +39 38 35 34 33 30 29 28 +10 13 15 18 19 20 21 23 +20 19 18 15 13 10 +65 67 70 71 73 75 78 +60 61 64 65 66 67 70 73 +68 67 64 62 60 +64 63 60 57 55 52 +84 85 88 90 93 96 98 99 +84 87 90 93 96 97 99 +81 83 86 89 91 92 93 94 +42 45 47 48 51 54 +72 74 77 79 81 83 84 86 +54 53 50 49 46 43 +55 57 58 60 62 64 66 68 +20 21 22 23 25 26 27 +53 54 56 58 59 60 61 +67 68 70 72 73 76 +20 17 15 12 10 8 +71 68 65 62 61 60 59 57 +78 76 75 73 72 +25 23 22 19 18 17 15 13 +30 29 27 26 25 23 20 18 +23 24 25 28 29 31 34 +40 43 45 47 49 +44 46 48 51 52 53 +38 36 33 31 28 +28 29 32 34 37 38 40 41 +44 45 46 48 49 +99 96 93 91 89 87 84 82 +49 48 47 45 43 +79 81 84 85 87 89 92 +28 29 32 35 38 39 41 42 +26 23 22 19 16 14 13 +30 27 24 23 20 19 +76 74 71 69 67 64 +99 96 95 94 93 90 88 +69 68 67 64 63 62 60 +88 91 93 95 97 +86 87 90 91 92 95 96 +33 34 36 37 39 40 +65 63 62 59 58 +29 28 26 24 21 19 17 +87 84 81 80 78 77 74 72 +89 87 84 81 78 +76 79 81 84 86 87 88 +48 50 53 54 55 +38 41 42 43 45 +93 90 88 86 84 81 80 77 +87 85 83 80 78 +75 73 71 70 69 +23 21 20 18 15 12 9 6 +89 87 84 81 79 +80 83 85 86 88 91 94 +62 65 66 69 70 71 +28 26 23 21 19 +94 93 90 87 86 83 +19 17 15 13 11 10 8 6 +63 65 67 68 71 +2 3 6 7 10 11 +37 39 42 44 45 +52 54 56 57 60 +54 51 50 49 47 +55 54 53 52 50 47 +78 80 82 85 86 +76 74 73 71 68 +78 79 82 84 85 87 90 93 +52 51 50 49 48 +25 28 30 32 35 36 38 +59 56 55 52 49 46 45 42 +18 19 22 23 25 28 30 +57 56 55 52 51 48 45 +55 53 51 50 47 44 +34 33 32 31 28 25 23 +75 72 71 69 68 67 65 64 +4 7 10 12 13 15 16 +61 59 57 55 54 53 52 49 +72 71 69 68 67 65 62 59 +32 33 34 35 36 37 +21 19 16 15 13 12 10 +56 55 52 50 47 44 43 +66 68 70 73 76 79 82 +12 11 8 5 3 2 +87 89 91 94 96 +81 78 77 74 73 70 69 +75 78 81 82 84 85 87 89 +36 35 34 31 29 27 25 22 +39 38 36 34 31 28 25 +64 65 67 70 72 +82 85 87 88 90 92 94 95 +46 45 43 41 40 38 36 35 +45 47 48 50 53 55 +52 51 50 48 47 46 +59 56 54 52 50 48 46 43 +6 9 12 13 15 18 20 22 +18 16 15 12 9 +14 11 9 6 3 2 +64 62 59 57 55 54 +50 47 45 44 43 +62 64 65 67 70 71 72 +66 67 70 73 74 76 78 80 +61 63 66 68 70 +28 27 24 22 19 diff --git a/2024/02b/data_o b/2024/02b/data_o new file mode 100644 index 0000000..b49c10d --- /dev/null +++ b/2024/02b/data_o @@ -0,0 +1,6 @@ +7 6 4 2 1 +1 2 7 8 9 +9 7 6 2 1 +1 3 2 4 5 +8 6 4 4 1 +1 3 6 7 9 diff --git a/2024/02b/run.rb b/2024/02b/run.rb new file mode 100755 index 0000000..627bac4 --- /dev/null +++ b/2024/02b/run.rb @@ -0,0 +1,47 @@ +#!/usr/bin/env ruby + + +def directions_for_values(values) + directions = [] + values.each_with_index do |value, index| + next if index.zero? + + distance = (value.to_i - values[index-1].to_i) + direction = if (distance.abs > 3 ) + :err + elsif distance > 0 + :up + elsif distance < 0 + :down + else + :err + end + + directions << direction + end + + return 0 if directions.count(:err) > 1 + directions.uniq.count == 1 ? 1 : 0 +end + + +data = File.read("data.txt") + +data = data.split("\n") +data = data.map(&:split) + +safe_arr = data.map do |row| + results = [directions_for_values(row)] + + row.each_with_index do |value, index| + tmp_arr = row.dup + tmp_arr.delete_at(index) + results << directions_for_values(tmp_arr) + end + + results +end.map(&:sum) + + +p safe_arr.count { |row| row > 0 } + |