diff --git a/inputs/year_2024/01.dat b/inputs/year_2024/01.dat new file mode 100644 index 0000000..13f1f99 --- /dev/null +++ b/inputs/year_2024/01.dat @@ -0,0 +1,1000 @@ +39687 54930 +86219 31559 +48536 73145 +19932 82178 +87646 97411 +18305 78515 +60437 30432 +35451 49981 +93478 61402 +19754 38933 +85455 20590 +82836 14896 +55217 89552 +11698 99229 +93753 84187 +93422 97415 +57366 97415 +97937 74337 +49478 74337 +14644 38161 +19399 13589 +74271 80973 +30811 43748 +39084 14139 +50012 35681 +26833 68646 +85916 94351 +48783 65976 +60349 37405 +48397 24524 +12784 96876 +26511 32005 +25828 50973 +41783 18470 +86788 84403 +52646 85455 +47960 55292 +33628 88834 +60975 32865 +18734 34272 +97411 13386 +98587 32005 +13899 55558 +83942 39621 +27222 72250 +92406 40726 +58334 43748 +57066 38522 +39164 54930 +41041 87903 +53063 31354 +41396 72724 +95245 79046 +83977 29994 +23525 23626 +28481 78774 +57089 88281 +95507 89601 +14606 37413 +83403 69108 +20870 65520 +52065 31711 +10688 43748 +14754 74862 +58940 92984 +34160 79046 +40229 15374 +19557 39621 +76326 14606 +18064 99891 +50829 29383 +24524 85455 +45230 19089 +89022 79046 +66250 51691 +90805 65372 +56019 50673 +67451 12866 +76068 65372 +77238 83243 +93710 65976 +79065 73391 +24363 74337 +29740 32931 +87834 79002 +30513 20720 +15378 30432 +13130 97438 +66810 70609 +98441 68294 +83594 50359 +43148 83382 +25005 37240 +98638 65372 +78319 50811 +90823 58614 +16089 93976 +14911 13087 +60443 12156 +94516 50973 +91753 26787 +15992 37046 +79270 50973 +67191 65372 +32268 35681 +41819 54930 +41351 69285 +44832 11020 +72750 91217 +34941 23646 +65976 65070 +56038 47570 +28753 81142 +63264 23646 +26145 88981 +71576 17123 +97331 79046 +22775 79740 +85844 94770 +25823 10501 +34176 91199 +45060 20266 +31332 25957 +32455 16146 +87120 19937 +73733 97415 +37954 51285 +28922 96517 +39972 32931 +30973 99605 +86546 62291 +80526 69673 +86070 73161 +55954 30432 +37437 34788 +63111 97415 +96362 88981 +75508 30398 +69428 81796 +28796 20675 +57288 32931 +73193 42247 +25130 51213 +38097 15664 +98834 26533 +32103 60744 +68331 13196 +22986 65372 +28918 65976 +27607 43147 +98022 83243 +39035 20720 +62361 42612 +78321 83243 +62399 15803 +84309 20526 +42350 39621 +51744 22556 +58919 92305 +37337 88981 +47722 83460 +29319 91248 +69603 85455 +56191 19231 +62286 73859 +28227 18100 +36024 83100 +60918 32611 +23022 88981 +38410 13292 +29383 92881 +18625 84889 +25141 26391 +69831 15803 +56740 18537 +26869 48559 +60352 24016 +45390 32931 +45676 55292 +69684 51183 +20234 15201 +58742 39621 +99779 17566 +61992 70009 +52853 15896 +46535 20590 +81327 20620 +75451 65976 +25891 91886 +78175 46303 +33500 61400 +78157 29280 +51091 31645 +73117 43748 +66382 70259 +59120 20590 +48683 38424 +21096 58463 +81257 48491 +30677 65122 +70554 61053 +12626 43309 +13513 74337 +71553 39621 +53798 20720 +48705 20590 +46863 35681 +90815 71503 +15964 69448 +68964 19189 +76668 55292 +64426 98722 +29505 73351 +33746 29460 +10038 84187 +48123 58056 +77274 43748 +29578 68732 +55816 65976 +18618 43748 +62734 31263 +12764 71426 +61615 18256 +44776 55292 +69008 44200 +69615 29383 +21562 80490 +41425 32594 +21356 55560 +28712 99731 +56355 55292 +11748 39388 +19994 41606 +10033 82834 +11253 97411 +14845 74337 +78797 23324 +66173 43748 +70836 75361 +59179 10501 +53947 35681 +84118 92551 +87855 85455 +62508 58746 +99196 43088 +93172 44793 +99062 76397 +77322 55292 +16386 74377 +95019 50973 +67124 32931 +23658 92851 +22040 24243 +20095 18432 +86545 53685 +94185 84851 +65351 50443 +43248 97411 +30440 89706 +74737 79046 +46947 71503 +80582 10501 +49951 40689 +67305 65372 +85943 39673 +26645 53881 +94034 35681 +69322 74264 +81573 74337 +85036 82011 +32378 89449 +72709 38642 +66311 30432 +14984 25526 +42649 24834 +91802 79129 +75402 23646 +39996 41604 +18325 29105 +61602 47315 +74612 54077 +15431 87294 +82611 37415 +30159 25725 +68269 50973 +64640 32005 +24359 73902 +66906 70478 +12361 96235 +72942 90254 +98451 20590 +59149 55292 +44917 85455 +22929 31273 +60258 50973 +63980 57267 +32828 71587 +51001 98441 +10733 55292 +20720 55900 +79366 88638 +61465 21535 +49575 23016 +78447 74337 +12815 89570 +12157 29383 +27474 83243 +95075 55673 +96642 20590 +29226 22801 +96829 87851 +84841 35759 +49793 65372 +13351 80850 +50977 23646 +50215 99614 +87295 35681 +98087 92194 +43530 98441 +29741 45244 +24141 55292 +67314 39621 +57310 87645 +20572 56180 +75549 65310 +33083 79046 +49934 50973 +16255 85455 +22048 74337 +67521 30432 +22178 32931 +40137 54930 +93021 33176 +90141 64438 +20161 30432 +31200 83204 +49277 71955 +15343 35290 +69746 97411 +94592 82043 +93759 97411 +42111 43395 +45727 50234 +71307 31990 +24277 79046 +10940 23668 +87027 65372 +77454 29383 +73569 20590 +32144 86307 +83494 35248 +86165 25280 +21035 33870 +51419 38933 +62394 65976 +20590 38491 +16178 16522 +32526 99622 +66974 94518 +24041 96291 +50807 97415 +36530 77854 +34288 98477 +25885 32931 +39957 39146 +36622 65372 +43748 56856 +22540 64266 +47812 25636 +60778 20520 +37116 73874 +74490 49028 +23646 57999 +10244 97415 +93378 69485 +92192 82321 +49671 47880 +40968 14606 +30997 75730 +44903 96764 +97415 35945 +42061 18761 +67473 32005 +71346 62789 +35117 38933 +68817 30432 +55081 30581 +63660 20730 +27470 41097 +85409 76643 +79664 57942 +59103 19889 +89854 85455 +34937 23469 +62589 71503 +31126 79046 +59987 17936 +41702 15768 +53158 89572 +47155 50973 +15410 66375 +33512 96295 +17682 24524 +85010 42666 +42326 71503 +74438 54930 +90691 88981 +24647 11015 +75856 26787 +10008 29383 +59249 95463 +61498 99412 +92390 58161 +98660 13452 +64740 97415 +42786 78023 +95159 44617 +88981 22058 +10814 89818 +82896 55292 +59582 74337 +36481 63656 +64320 84187 +78275 20590 +12031 97411 +55466 97411 +78361 32931 +27572 43748 +65372 53800 +25862 45484 +45103 24524 +46928 79046 +85030 55720 +88276 23748 +18649 19319 +35681 17984 +29111 20651 +94218 97415 +86252 38933 +93823 61400 +77315 74483 +29554 36566 +69304 32005 +67449 63281 +59720 30968 +97180 10501 +42054 96975 +84226 73716 +77336 97415 +95184 50973 +74680 79227 +44559 20266 +42923 89529 +23122 80745 +68282 79046 +18348 96777 +43175 77218 +47771 50919 +71875 31700 +51767 10501 +15666 77315 +47306 50973 +67340 24524 +39560 97411 +27302 71081 +22715 10711 +19262 35428 +30522 32931 +41704 85455 +69346 71001 +69691 20866 +39771 41097 +67926 78162 +33936 65976 +27443 41097 +71926 20590 +89325 87688 +95998 20724 +49871 36142 +18672 62700 +60268 10501 +95709 49926 +58557 70587 +86330 24463 +66612 55292 +63979 35681 +45966 26787 +30432 26787 +88832 43748 +16475 24524 +43091 50973 +91285 35681 +74407 71503 +74337 49897 +44472 42771 +51748 32931 +66315 42856 +70339 28495 +32919 97411 +34170 46975 +29144 84300 +68669 97411 +79046 96815 +68797 81914 +61355 48612 +66045 26787 +65345 61624 +34776 88918 +62024 45208 +22080 92268 +41658 29383 +40489 90276 +77414 91031 +87328 42581 +39847 29383 +62166 56210 +14946 97415 +46608 32931 +61626 97411 +68038 26110 +74304 24524 +33687 65027 +89997 29383 +71497 48576 +70649 20720 +75076 43748 +39550 57870 +42772 33596 +27314 43930 +52382 16823 +10501 32931 +60075 65372 +67162 62251 +18539 10501 +98602 39621 +86708 24677 +18832 39692 +34806 62896 +57052 88981 +26225 90413 +86466 77315 +22149 79085 +72545 38933 +61056 79046 +42425 79046 +18465 97415 +96275 26478 +93622 62612 +24920 61828 +76211 92315 +42390 25904 +22748 32005 +23429 11388 +28323 71503 +69320 61063 +39102 97714 +27448 32005 +60718 84165 +38364 82518 +65294 65372 +78308 27739 +71470 41212 +18756 33498 +21876 38933 +23964 17950 +63538 82294 +27576 19320 +11707 43748 +84686 20831 +26018 61400 +49866 33433 +76498 38933 +18202 35681 +32295 24256 +13631 32931 +82697 51213 +93416 51322 +33240 39621 +50664 24609 +24764 77315 +89632 68872 +30109 29018 +91551 83438 +61710 97411 +94996 54930 +58869 86341 +32931 79847 +83906 51213 +63729 89532 +92094 59179 +57957 15741 +14369 44761 +87984 43748 +73328 42459 +85008 58525 +57450 70925 +65808 43556 +20553 11393 +80030 43748 +24598 84187 +14926 86503 +63774 36452 +56586 29383 +42048 54930 +29688 83243 +81927 33315 +37463 73028 +44318 70491 +38022 64772 +40289 43748 +36192 95264 +34815 63383 +30912 49204 +29375 60846 +10954 67406 +20827 44437 +71373 82013 +55907 39621 +66557 97415 +20370 84187 +42450 29383 +47937 54930 +35114 76258 +50280 46068 +53360 87478 +52625 46035 +74506 23646 +78581 65372 +50670 41097 +67067 43748 +53047 91346 +28877 84369 +42353 97411 +71840 54233 +62376 27440 +53738 86424 +24879 52760 +69261 35681 +57133 64491 +33644 97411 +73635 32005 +12036 20590 +27599 31074 +41620 37578 +31518 39621 +43210 93438 +29331 39621 +80103 46896 +58324 86405 +72535 32976 +50973 39621 +19898 39789 +95111 74741 +62134 58215 +22738 92185 +85240 38472 +41403 44573 +10562 32005 +66230 19396 +66002 30432 +29925 18981 +86609 30432 +16196 20590 +26610 94216 +28817 24524 +64124 85455 +81667 67238 +49763 26547 +64284 29383 +62185 50068 +99896 16882 +46020 90218 +17194 35268 +74962 97415 +13420 33099 +16973 51937 +89651 43043 +67742 88988 +54231 39621 +41902 55292 +93241 82277 +53267 13313 +75234 75622 +89219 23646 +99065 93661 +23411 67647 +41648 75186 +78473 93028 +46849 26787 +96778 23661 +36339 84643 +66106 32005 +83602 19530 +60191 26202 +39157 38933 +75269 24524 +54146 77716 +64769 50973 +32005 65976 +95839 41098 +80529 20838 +30527 36612 +83243 65976 +58199 55292 +78364 93097 +15803 33060 +19540 81520 +24332 55715 +69804 14018 +89498 26787 +32922 55158 +51186 50973 +64371 59179 +67761 36282 +14931 65372 +33983 30208 +23532 99746 +60995 32005 +46968 33271 +71489 76548 +15532 56451 +60734 39621 +80923 84616 +55415 95600 +33838 97411 +38933 92991 +28270 15952 +64729 43748 +82909 41097 +21322 20447 +20606 32931 +20323 10923 +65612 72747 +42742 85455 +60541 15141 +69361 28920 +83643 78124 +33413 26942 +80131 64910 +60963 84167 +31622 20590 +76264 85208 +78435 48325 +64808 22279 +28784 75805 +84514 46617 +99920 39621 +64277 79046 +32066 65976 +61170 83000 +53590 24445 +75500 44994 +21399 74337 +57159 53312 +95725 45088 +47434 32005 +14728 20279 +86794 41097 +52400 97415 +64448 84187 +27278 10285 +54885 10894 +79570 20720 +85379 82557 +19497 60054 +10131 28282 +82510 72112 +37690 74278 +19278 55292 +28841 30432 +27287 99050 +32480 82634 +56252 20590 +77005 27163 +38978 77315 +12387 43748 +17737 29495 +55292 85455 +95579 20590 +60386 54930 +83024 43060 +43990 54930 +14130 10610 +97781 65608 +25377 27025 +10359 44055 +44237 75566 +30104 32005 +93883 46062 +28533 43292 +52211 50973 +28015 35681 +54979 23646 +59145 59518 +88731 93289 +92214 28192 +60194 65976 +96948 71503 +83445 85455 +44724 58215 +99575 77315 +59780 74337 +88198 69047 +67804 17472 +15309 77315 +63776 32005 +39191 93784 +88847 12410 +51336 18547 +67934 97415 +61623 75270 +30153 52371 +13866 84187 +13232 19867 +18107 32931 +24272 65976 +37532 57552 +74619 11064 +18266 66168 +69298 55431 +74422 24753 +83542 61400 +93767 78919 +70226 33845 +83460 67750 +30637 52438 +17147 51213 +47019 60841 +61400 96946 +99313 50492 +24905 49729 +64661 32931 +80464 42915 +59801 65976 +26787 88398 +30009 59179 +46714 50760 +85549 97411 +80405 14606 +90469 57491 +47988 57093 +54532 10501 +49943 20590 +77697 71503 +11487 99685 +41097 61400 +96136 98696 +65608 94443 +55729 71785 +64859 13167 +51213 97415 +95044 45340 +26875 41284 +20266 68008 +54279 10125 +49123 27746 +25659 97411 +71503 77315 +25042 15803 +85683 34351 +75203 87921 +15024 83243 +48884 23732 +20362 88981 +29757 33017 +69591 83341 +52463 20266 +96531 50973 +18691 82070 +38982 10738 +46845 53716 +43757 97415 +59287 30432 +53671 87058 +71592 73972 +15612 13840 +31062 83351 +27714 30432 +81451 91637 +83692 24524 +17667 19315 +38165 99318 +31407 50973 +54602 32944 +16418 62441 +24549 83243 +68171 97415 +45107 66287 +85000 77293 +52279 50973 +39804 88981 +54930 89838 +33435 55541 +35192 24621 +28963 61285 +62401 47165 +62057 35923 +66086 20060 +68558 43071 +64279 11503 +53866 28743 +53322 43781 +57423 30491 +84187 62562 +36345 20720 +14838 82939 +66499 32457 +12383 43748 +49461 57729 +63604 83243 +70558 87459 +25392 69359 +76916 65373 +92341 76150 +35379 65372 +76956 26702 +95342 21946 +70320 20266 +69676 49315 +61564 54930 +87659 27359 +76459 14606 +58765 35234 +60496 10501 +95443 56583 +23163 54736 +42578 96214 +35408 28339 +73211 38245 +19253 45584 +81387 77205 +60736 94989 +93733 39621 +35524 20266 +10497 11300 +82104 39339 +63189 79046 +69699 13319 +64848 21528 +79082 32931 +25166 97415 +67709 72646 +89006 61400 +31258 20322 +78044 39621 +28810 14074 +85541 99495 +25783 78712 +84160 85455 +60869 68898 +15908 91740 +21392 98478 +91823 94915 +68112 93339 +68487 50503 +79369 77802 +33236 96238 +53085 59514 +25758 50973 +95806 71503 +79198 78066 +87996 54816 +11943 39621 +98740 65372 +63599 54930 +30758 61133 +78768 47891 +29026 30432 +62476 91148 +19193 10501 +47322 14810 +30951 43985 +42954 61631 +32520 95242 +31248 55278 +58121 97415 +30540 55292 +35353 29383 +72450 97411 +69146 74337 +87152 76785 +31122 93490 +58215 43748 +92645 55292 +12395 71311 +88681 18719 +37459 27744 +36993 84187 +48597 39621 +94499 50619 +68261 90287 +35126 73663 +95513 97411 +73472 38933 +28325 29796 +83597 72689 +12914 79531 +39621 90125 +10029 95431 +85400 15291 \ No newline at end of file diff --git a/inputs/year_2024/02.dat b/inputs/year_2024/02.dat new file mode 100644 index 0000000..0ddb295 --- /dev/null +++ b/inputs/year_2024/02.dat @@ -0,0 +1,1000 @@ +74 76 78 79 76 +38 40 43 44 44 +1 2 4 6 8 9 13 +65 68 70 72 75 76 81 +89 91 92 95 93 94 +15 17 16 18 19 17 +46 47 45 48 51 52 52 +77 78 79 82 79 83 +55 58 59 57 60 61 68 +79 82 84 84 85 86 +23 24 25 25 23 +23 26 27 28 31 31 31 +42 43 43 44 48 +72 74 74 77 82 +85 86 87 88 89 93 94 +48 50 51 53 57 59 62 61 +29 32 34 38 38 +71 73 75 78 82 85 88 92 +1 4 7 8 12 18 +16 17 20 25 27 30 33 +49 52 55 62 63 66 68 67 +69 71 74 76 78 80 85 85 +34 36 39 42 48 49 53 +48 51 52 55 61 67 +55 54 57 60 61 +34 33 34 37 39 40 43 40 +23 20 23 24 26 29 29 +22 21 23 26 27 30 31 35 +79 76 78 81 82 89 +39 38 41 38 39 42 +47 45 48 50 51 52 50 48 +57 55 58 59 62 60 61 61 +94 92 89 91 92 96 +67 66 69 70 71 72 71 78 +41 39 42 45 45 46 +39 38 41 41 44 41 +21 20 22 23 26 26 29 29 +36 35 36 39 39 43 +60 57 58 58 63 +12 11 13 17 18 +49 46 47 49 52 56 53 +30 28 29 31 32 36 36 +81 80 82 86 89 91 95 +60 59 63 66 71 +71 68 69 75 76 78 +24 22 25 27 28 30 37 35 +6 5 12 14 17 20 20 +56 54 60 62 66 +82 81 88 89 94 +52 52 54 57 60 62 64 +3 3 4 6 9 12 10 +89 89 92 95 97 97 +67 67 69 72 75 78 82 +8 8 10 12 19 +10 10 12 13 10 11 +59 59 60 63 61 64 65 64 +68 68 70 71 70 70 +31 31 30 31 33 37 +63 63 60 63 68 +52 52 52 55 58 60 61 64 +34 34 37 39 42 42 43 41 +35 35 36 39 39 40 40 +69 69 69 72 73 74 78 +41 41 41 43 50 +27 27 30 33 37 40 42 +61 61 63 65 69 67 +3 3 5 7 11 14 14 +58 58 60 62 64 68 69 73 +21 21 25 26 29 35 +76 76 79 85 88 +49 49 50 53 55 60 58 +79 79 84 87 87 +63 63 64 66 67 72 74 78 +68 68 70 72 78 81 82 87 +43 47 49 50 53 56 59 61 +62 66 68 70 73 74 75 72 +21 25 26 29 31 31 +16 20 21 23 24 27 31 +23 27 30 31 33 40 +42 46 47 50 47 50 +76 80 81 83 85 84 83 +13 17 20 23 26 27 25 25 +8 12 9 10 13 14 15 19 +18 22 23 26 27 29 27 34 +42 46 46 48 49 +52 56 59 60 60 62 64 61 +77 81 82 82 84 84 +76 80 80 82 86 +53 57 60 62 63 64 64 70 +16 20 24 27 29 32 +51 55 57 61 63 65 62 +82 86 90 91 91 +61 65 66 69 73 77 +38 42 44 48 50 53 55 62 +13 17 19 25 27 28 31 +32 36 41 43 41 +63 67 68 71 77 77 +23 27 28 31 38 40 44 +45 49 50 55 56 58 59 64 +71 77 78 81 83 +26 33 35 36 37 35 +57 64 65 66 66 +11 16 18 20 22 24 25 29 +35 41 44 47 48 49 50 55 +52 59 60 57 60 63 +51 58 57 59 61 59 +4 10 8 9 12 13 15 15 +27 33 35 32 33 35 39 +20 26 25 26 27 29 31 38 +36 41 43 44 44 47 +48 54 57 60 61 61 63 62 +40 46 49 50 52 52 52 +13 20 22 22 25 29 +45 52 52 55 61 +73 78 79 82 85 88 92 95 +51 57 60 61 65 67 70 67 +6 12 16 19 20 22 23 23 +12 18 22 25 26 30 +56 61 65 66 72 +25 30 33 38 41 43 +64 70 76 79 77 +36 41 48 49 49 +59 64 66 68 74 77 81 +44 51 57 59 64 +87 86 83 82 81 78 77 80 +55 52 51 49 49 +46 43 41 39 38 37 33 +33 31 28 27 26 24 22 17 +83 80 78 77 79 76 73 +51 49 47 46 48 46 44 46 +56 55 52 55 52 52 +13 10 9 12 11 7 +36 33 31 34 27 +77 76 75 75 73 70 68 +93 91 91 89 88 86 83 86 +92 89 89 86 86 +51 48 48 46 42 +41 38 38 37 34 29 +51 50 48 46 42 40 +84 83 79 78 80 +19 16 13 11 9 5 5 +70 67 66 62 61 57 +73 71 70 69 68 64 58 +93 92 91 88 81 80 78 +56 54 52 50 45 46 +51 48 45 43 37 37 +82 80 74 71 67 +59 56 54 52 50 47 40 35 +17 20 19 18 16 13 10 7 +74 76 73 72 69 67 65 67 +95 96 93 92 92 +25 28 26 23 20 17 13 +43 45 42 40 38 32 +91 92 93 91 88 +41 44 42 39 38 39 42 +41 43 42 41 42 40 40 +63 66 68 67 63 +65 66 64 62 64 61 59 53 +84 85 82 82 81 78 77 75 +23 26 25 24 24 22 23 +30 31 29 27 25 25 25 +31 32 31 31 29 28 26 22 +12 15 15 13 6 +13 14 12 9 5 2 +10 12 10 6 8 +61 64 62 60 58 54 51 51 +92 93 89 86 82 +69 70 67 66 63 59 54 +80 81 79 77 74 68 66 +64 67 61 59 56 58 +65 67 60 57 56 54 52 52 +51 52 51 49 47 40 38 34 +51 52 51 49 43 36 +87 87 84 82 81 78 75 73 +37 37 36 35 33 36 +71 71 69 68 65 63 63 +16 16 15 13 9 +49 49 46 44 38 +64 64 67 65 63 +7 7 10 8 6 3 5 +30 30 27 24 21 19 21 21 +57 57 56 58 56 52 +79 79 82 79 74 +23 23 21 19 16 16 14 13 +91 91 91 88 87 84 83 84 +98 98 95 94 94 94 +93 93 91 88 88 87 83 +32 32 31 29 29 28 22 +33 33 31 30 28 24 23 22 +49 49 46 43 41 37 34 35 +65 65 61 58 58 +56 56 55 54 50 47 45 41 +17 17 16 12 5 +63 63 60 59 58 51 50 47 +48 48 43 42 41 40 37 39 +90 90 84 83 83 +48 48 42 40 39 35 +50 50 47 44 41 36 34 29 +34 30 27 24 23 +84 80 79 78 80 +79 75 73 71 69 67 64 64 +16 12 11 9 8 4 +30 26 25 23 22 21 20 15 +13 9 11 8 7 +26 22 21 20 19 20 21 +27 23 25 22 20 18 18 +37 33 31 32 29 25 +45 41 38 37 34 32 35 28 +56 52 50 50 48 +19 15 13 10 10 8 11 +18 14 14 12 12 +81 77 76 76 72 +81 77 77 74 68 +43 39 38 36 32 31 28 27 +98 94 93 89 92 +64 60 56 53 52 51 51 +93 89 88 85 81 77 +31 27 23 21 18 17 16 9 +84 80 79 77 75 69 68 +80 76 73 68 65 68 +97 93 86 83 81 81 +47 43 38 36 35 34 33 29 +69 65 63 58 53 +37 30 27 24 22 19 16 +95 88 85 84 83 85 +22 17 14 11 11 +93 88 87 86 83 81 80 76 +86 81 80 77 76 73 66 +96 91 89 90 89 87 +84 77 75 78 76 73 76 +12 7 9 7 7 +99 94 92 94 92 90 87 83 +32 25 23 20 17 16 17 10 +94 89 88 88 86 84 83 80 +56 51 51 50 49 47 46 48 +89 84 82 80 80 77 77 +71 64 63 63 59 +71 64 62 62 55 +41 35 32 29 25 22 19 +76 69 67 65 64 60 58 60 +50 44 43 41 40 36 36 +43 37 33 32 28 +33 27 23 21 18 15 14 9 +60 53 47 46 45 +52 45 39 37 34 35 +20 13 10 8 3 3 +47 40 38 32 30 28 26 22 +72 65 58 55 50 +9 10 11 14 17 19 17 +47 49 51 54 57 57 +38 40 41 43 45 49 +39 40 41 43 44 45 52 +18 20 18 21 24 25 27 30 +86 89 87 88 90 93 94 91 +85 86 88 90 88 90 93 93 +51 53 54 56 54 58 +27 30 28 31 32 37 +57 60 63 63 65 +52 54 54 56 55 +25 27 30 30 30 +69 70 73 74 74 76 80 +15 16 18 18 19 21 28 +23 24 27 31 33 +24 27 30 34 36 37 35 +50 52 54 56 59 63 66 66 +78 79 83 84 87 88 92 +17 18 20 21 25 31 +39 42 44 51 54 56 58 +10 13 20 23 20 +8 9 10 15 18 18 +49 50 56 58 60 62 65 69 +11 14 21 22 29 +88 87 90 93 94 96 +90 87 88 90 87 +48 45 47 48 48 +37 36 39 41 42 45 46 50 +3 1 2 3 4 10 +77 76 75 78 81 82 +38 35 33 34 31 +41 38 41 44 42 42 +13 12 10 12 16 +19 17 14 15 16 22 +14 12 14 15 15 18 20 22 +29 27 30 30 31 30 +60 57 59 59 59 +78 76 77 80 80 82 86 +57 54 57 57 63 +36 35 37 40 44 46 +42 40 41 44 48 45 +74 72 74 77 78 82 82 +12 11 12 16 20 +79 77 78 81 83 86 90 95 +39 37 43 46 48 +53 51 57 58 59 58 +23 20 21 26 26 +77 74 81 84 87 91 +66 63 69 72 79 +27 27 30 31 33 35 36 38 +30 30 33 34 36 38 41 40 +56 56 57 58 58 +75 75 76 79 83 +33 33 34 35 38 40 42 49 +8 8 11 14 12 14 16 18 +36 36 39 41 42 44 42 40 +48 48 50 51 50 52 52 +20 20 18 19 22 25 29 +54 54 53 56 62 +68 68 68 70 72 74 76 78 +22 22 22 24 25 28 27 +93 93 93 95 95 +70 70 70 72 74 77 79 83 +79 79 80 82 82 83 85 92 +52 52 56 59 61 +1 1 4 7 10 12 16 15 +41 41 43 47 47 +39 39 43 44 46 48 49 53 +38 38 41 45 50 +71 71 72 75 81 83 84 87 +79 79 85 87 88 86 +29 29 31 37 37 +41 41 43 46 48 51 57 61 +62 62 63 65 70 71 74 79 +39 43 46 49 50 52 +37 41 42 45 48 47 +4 8 9 12 14 14 +26 30 31 34 36 37 39 43 +1 5 7 9 12 14 15 20 +18 22 25 27 24 26 28 +35 39 40 42 43 41 44 43 +69 73 71 73 74 76 76 +6 10 12 13 12 14 16 20 +77 81 82 81 84 89 +37 41 41 44 46 48 49 50 +47 51 52 53 53 56 54 +7 11 12 13 15 15 16 16 +51 55 56 58 61 63 63 67 +55 59 59 60 62 64 66 71 +47 51 52 55 57 58 62 64 +23 27 31 32 34 36 34 +75 79 83 84 87 87 +20 24 25 27 31 35 +62 66 70 72 78 +4 8 9 11 18 20 23 +65 69 71 76 77 79 78 +43 47 48 53 56 57 59 59 +36 40 43 46 51 55 +14 18 21 24 29 34 +44 50 51 54 56 +1 6 9 10 11 14 13 +24 30 31 34 37 38 41 41 +11 18 21 22 26 +50 56 59 60 62 68 +21 26 25 27 30 +37 44 41 44 41 +61 66 67 70 68 68 +89 94 91 92 94 95 99 +53 60 63 61 62 68 +8 15 16 16 17 18 +64 70 70 73 76 75 +74 81 81 83 83 +10 16 19 19 22 26 +57 63 63 64 70 +53 59 62 63 66 70 73 +6 13 17 19 17 +16 22 24 28 29 31 31 +65 70 72 76 80 +56 63 64 67 71 73 80 +65 72 74 76 78 84 87 +37 42 47 49 50 48 +63 69 72 77 78 79 79 +67 73 76 83 87 +59 66 68 73 79 +35 33 32 29 31 +29 26 25 24 22 20 20 +53 52 51 48 44 +42 39 37 34 33 31 26 +14 12 9 8 5 3 4 1 +89 87 89 88 86 88 +50 47 48 45 42 40 39 39 +22 20 17 20 17 13 +86 84 87 85 82 75 +86 84 82 81 80 80 78 +20 19 17 15 13 10 10 13 +14 13 12 12 12 +85 82 82 79 77 74 71 67 +77 74 74 72 65 +21 18 15 12 10 6 5 +22 20 19 17 13 10 7 9 +61 60 57 56 52 52 +74 72 69 65 63 60 59 55 +74 73 71 70 66 63 61 55 +79 78 75 68 66 65 63 +21 19 16 13 6 7 +91 89 82 81 78 77 74 74 +57 55 54 52 47 43 +82 79 78 75 68 66 60 +79 82 80 78 76 +89 91 90 89 88 89 +22 23 21 20 20 +90 92 90 89 85 +86 89 86 85 84 79 +80 83 85 82 80 +59 60 58 55 57 59 +59 60 61 59 58 57 57 +28 30 28 29 27 23 +5 7 5 8 1 +12 14 14 11 9 7 +17 20 17 17 18 +27 30 30 27 24 24 +24 27 26 26 24 22 18 +21 23 21 18 15 15 8 +33 35 31 28 27 24 21 +60 62 58 57 58 +9 11 8 7 5 1 1 +51 54 50 47 43 +61 63 60 58 56 52 50 45 +90 91 88 81 79 78 77 +53 56 55 48 45 48 +31 32 31 26 24 21 18 18 +31 34 32 25 23 19 +17 18 11 8 3 +95 95 93 90 87 84 81 80 +92 92 91 89 87 85 87 +64 64 62 61 58 58 +14 14 11 8 6 2 +81 81 80 78 72 +24 24 22 20 23 20 +73 73 70 72 70 73 +50 50 49 46 48 48 +28 28 26 28 24 +81 81 84 81 75 +91 91 89 89 87 85 82 +32 32 32 30 28 29 +33 33 32 29 26 26 26 +82 82 82 81 77 +56 56 55 52 52 50 47 42 +29 29 25 23 22 19 16 +55 55 52 49 45 42 44 +85 85 81 78 78 +19 19 16 13 9 8 5 1 +29 29 26 24 20 19 14 +99 99 96 90 87 84 +27 27 21 18 15 18 +50 50 43 40 40 +65 65 63 62 61 56 52 +37 37 30 29 23 +82 78 77 76 73 72 71 +58 54 52 51 48 47 44 47 +29 25 22 21 18 17 15 15 +67 63 62 61 59 56 52 +38 34 32 29 22 +86 82 81 79 81 80 78 76 +49 45 46 44 46 +94 90 92 89 88 88 +39 35 36 35 34 31 30 26 +84 80 77 76 79 78 76 71 +16 12 9 9 8 5 +57 53 51 51 52 +26 22 22 19 16 14 13 13 +62 58 57 57 56 53 49 +54 50 48 45 45 42 35 +70 66 62 60 58 55 53 +45 41 37 36 33 32 34 +39 35 32 28 26 23 23 +94 90 86 83 82 79 75 +73 69 65 63 62 55 +98 94 93 90 83 80 +80 76 74 73 71 66 65 66 +75 71 68 65 58 55 55 +21 17 15 14 9 8 5 1 +72 68 62 59 58 56 50 +89 83 81 79 78 77 75 +67 60 57 54 52 50 49 51 +74 68 67 64 61 61 +99 94 91 90 89 85 +68 63 62 61 60 57 54 47 +71 65 63 60 61 58 56 53 +43 36 33 32 33 35 +20 15 14 16 16 +23 18 20 18 17 13 +32 27 24 23 26 25 19 +69 64 64 61 60 57 54 51 +27 20 17 17 19 +80 75 75 72 69 66 66 +99 92 91 90 90 89 85 +74 68 68 65 63 56 +64 59 56 53 52 49 45 44 +94 89 86 84 80 83 +34 27 23 20 19 18 18 +41 34 32 28 27 26 24 20 +70 65 64 63 61 57 51 +50 43 42 40 39 34 33 32 +79 72 67 65 66 +76 70 68 67 62 59 59 +19 12 7 6 2 +35 29 26 25 18 13 +32 30 29 28 25 25 +65 68 70 73 75 77 80 84 +80 80 77 80 82 +88 90 88 86 83 80 80 76 +70 72 75 73 74 +14 10 9 6 4 3 2 1 +84 85 84 82 79 79 78 +62 60 61 63 64 63 64 66 +85 89 91 94 94 96 +22 22 26 27 28 28 +46 46 44 43 39 37 32 +43 49 50 53 52 54 58 +65 66 65 61 56 +31 35 41 42 39 +32 29 26 24 21 20 16 16 +19 14 11 10 9 5 +16 20 23 30 30 +1 1 3 7 10 +24 22 20 23 20 16 +15 14 16 19 20 21 20 +53 53 49 48 51 +57 57 54 51 48 50 +89 85 85 84 80 +57 55 50 47 46 42 +26 29 28 25 25 23 17 +16 18 16 11 10 +6 13 13 16 21 +88 88 90 91 93 93 95 92 +20 16 13 11 7 +26 33 35 36 37 40 39 +30 25 23 21 19 17 19 13 +26 26 29 32 33 40 42 46 +69 63 59 57 55 50 +90 93 90 89 86 86 +74 78 81 84 88 +39 40 40 42 46 +87 84 84 83 81 79 +77 72 68 65 64 62 +41 41 39 42 44 +82 82 85 92 98 +11 11 8 6 4 4 +89 83 82 84 83 80 +5 3 7 8 11 8 +36 41 44 44 48 +26 19 17 15 13 12 10 7 +52 49 50 49 48 47 +26 32 32 33 33 +38 42 45 46 46 46 +66 69 66 63 64 +37 42 43 44 47 48 51 +75 75 73 70 66 62 +97 93 86 85 85 +63 63 66 69 71 73 75 82 +20 16 15 13 13 +77 77 76 73 73 71 70 +12 16 17 15 16 21 +68 65 58 57 57 +56 56 60 63 60 +16 16 19 16 14 13 10 7 +59 55 54 50 53 +43 39 33 31 30 +79 80 78 78 79 +49 47 46 44 41 41 41 +23 25 23 21 20 17 19 19 +28 35 38 41 42 42 44 +56 60 62 60 64 +18 18 20 19 19 +75 74 78 79 80 83 83 +58 55 53 47 44 45 +24 24 23 21 17 16 16 +27 20 19 15 12 11 8 9 +59 56 53 51 49 47 43 39 +64 64 62 61 54 52 55 +66 66 71 74 75 77 78 75 +77 77 76 69 66 64 57 +30 28 29 32 38 40 +72 71 72 73 75 76 77 77 +81 80 83 81 83 +40 40 39 37 36 35 34 32 +52 52 55 54 56 59 65 +18 15 18 19 21 28 +48 46 49 47 48 48 +51 47 45 43 45 +16 19 19 20 22 25 27 29 +8 12 11 14 17 20 +77 82 85 86 85 88 94 +47 44 49 52 53 57 +64 60 55 53 46 +93 92 89 87 85 81 79 80 +95 92 93 96 94 97 95 +93 91 91 90 86 +21 15 13 11 12 14 +25 26 25 22 21 18 14 +41 41 39 38 33 29 +18 22 26 29 27 +88 86 89 91 91 98 +55 55 55 53 51 49 49 +32 35 32 33 30 +61 60 60 57 56 51 +12 11 14 13 15 19 +68 64 64 62 61 61 +20 27 30 36 39 41 +17 17 19 23 24 26 33 +51 49 50 51 55 56 60 +21 16 15 12 11 8 11 +36 35 38 43 44 44 +18 18 20 26 26 +24 29 31 34 34 36 33 +75 76 74 72 71 71 71 +88 88 87 85 80 78 +74 73 72 68 67 65 64 57 +74 67 67 64 63 58 +71 70 73 74 77 +69 63 60 57 55 50 +3 5 11 12 14 19 +64 68 70 71 69 +40 36 35 38 36 34 +38 39 35 32 31 30 27 24 +59 58 60 63 67 68 75 +80 78 77 76 77 77 +72 79 81 82 84 90 92 91 +46 39 39 37 38 +10 17 18 19 21 21 +67 73 74 73 74 72 +57 57 55 58 54 +57 59 61 61 63 66 65 +6 10 10 11 14 19 +6 7 10 11 15 16 19 19 +60 62 63 66 73 +26 19 19 16 14 14 +28 32 39 42 44 46 +78 84 85 92 96 +52 52 56 58 60 64 +46 44 50 53 59 +56 52 49 47 46 42 39 36 +32 32 34 35 36 38 41 38 +38 32 29 23 21 +70 71 76 79 80 82 83 87 +40 36 35 32 34 31 32 +51 57 60 64 65 67 70 +31 31 32 33 32 33 33 +37 38 36 30 26 +71 67 65 60 58 55 51 +84 80 80 77 74 75 +32 38 35 36 39 42 +60 60 62 63 63 66 73 +42 42 43 46 49 +58 59 56 53 52 50 47 +67 67 64 58 56 53 52 52 +42 48 50 54 58 +80 83 78 77 76 75 73 67 +77 78 74 71 72 +48 50 52 54 61 63 65 66 +46 50 51 54 54 56 54 +20 24 25 28 31 38 +46 48 49 50 53 53 +21 18 20 21 25 26 29 +54 60 64 67 69 71 71 +67 60 53 51 50 49 48 48 +44 45 45 46 47 48 50 57 +55 58 61 61 62 64 65 65 +49 48 48 51 52 54 55 59 +38 34 32 28 24 +78 82 85 87 89 92 94 95 +35 31 29 28 31 27 +71 72 73 70 70 +54 50 46 44 43 37 +29 22 17 16 17 +58 59 60 64 67 71 +21 25 26 27 27 +19 23 25 28 29 26 29 27 +77 77 79 81 81 82 82 +34 34 32 29 27 25 21 20 +22 29 31 33 36 34 37 37 +14 20 23 26 33 +40 37 34 30 29 +85 89 91 90 92 92 +65 64 67 68 70 72 73 77 +63 63 66 71 72 73 +15 13 16 16 19 22 +11 13 9 7 7 +88 88 88 89 90 93 94 +89 89 88 88 86 85 84 87 +2 1 2 3 3 5 5 +61 63 70 72 73 73 +53 48 47 50 48 47 46 42 +37 41 44 48 53 +47 50 48 44 43 40 36 +19 24 25 31 37 +70 70 69 67 65 65 61 +38 44 45 48 54 57 58 58 +54 49 46 44 42 38 38 +81 82 84 86 91 92 91 +15 13 12 10 9 6 2 +51 56 59 60 61 65 +44 45 44 41 34 +75 77 74 75 77 76 +51 45 44 41 39 37 37 +19 23 27 29 30 30 +89 85 83 81 80 79 73 +18 19 12 10 9 7 5 6 +41 40 34 32 29 28 +88 84 80 78 77 76 76 +86 89 86 85 83 85 83 79 +43 43 44 43 44 45 48 52 +74 68 62 61 60 57 55 49 +60 60 63 63 67 +13 17 19 21 27 31 +41 41 39 39 36 29 +85 85 82 79 72 +61 59 57 54 53 55 +59 55 54 54 53 50 +80 79 79 77 74 76 +24 21 23 29 28 +1 7 8 10 14 13 +95 95 94 97 94 89 +79 77 75 74 67 64 58 +5 6 8 5 7 8 10 16 +44 41 39 37 36 35 28 +64 67 71 74 75 78 77 +49 49 48 47 45 42 38 +63 59 58 58 56 51 +26 26 25 28 30 29 +77 77 79 82 82 +11 18 19 23 30 +17 14 11 13 8 +98 92 91 90 87 85 81 77 +65 62 65 63 65 72 +11 15 16 21 28 +95 93 95 95 96 98 97 +87 80 79 76 75 75 72 +66 67 66 59 58 55 55 +24 19 13 10 9 6 5 1 +4 8 8 11 15 +72 73 76 74 73 68 +95 91 89 87 90 90 +1 2 5 3 4 7 +60 55 52 52 49 45 +62 55 54 51 52 52 +7 11 13 15 17 21 25 +2 4 5 7 11 12 14 +60 62 63 64 67 68 72 79 +8 8 9 10 11 13 17 +83 79 77 78 75 70 +73 69 62 61 59 57 60 +75 77 80 83 82 +47 50 51 52 51 55 +95 93 91 89 86 85 84 81 +96 95 92 91 88 85 82 +14 15 16 17 20 21 23 +3 4 7 8 10 11 13 15 +43 45 48 51 53 56 59 62 +67 66 65 64 63 62 +34 31 30 28 25 +64 61 60 59 58 56 55 +2 5 8 9 11 13 15 +48 51 52 54 55 58 60 61 +33 34 35 36 38 +12 14 17 20 23 24 25 +4 7 9 11 13 16 19 22 +34 32 31 28 26 24 21 19 +58 57 56 55 54 53 +72 73 76 78 81 84 85 +66 68 70 73 75 76 79 +40 42 44 46 47 +13 15 18 21 22 25 +49 51 52 55 56 57 +49 50 52 53 54 57 59 +24 27 28 30 31 +4 5 7 10 12 13 14 15 +59 58 56 55 54 +18 16 14 13 12 +1 4 6 9 12 15 16 +66 64 63 62 59 57 54 53 +90 88 86 85 83 82 80 +67 70 72 74 76 79 82 85 +57 56 54 52 49 48 +11 14 16 18 20 23 25 +50 53 55 57 59 62 64 +77 78 81 82 84 86 +67 70 72 74 76 79 81 84 +70 69 67 65 64 62 60 58 +6 9 12 14 17 18 21 23 +72 74 76 77 78 81 83 86 +43 40 39 36 34 32 29 +49 47 46 44 43 40 +65 62 60 57 56 +71 73 76 79 80 +74 71 69 68 66 +21 22 25 28 31 +85 84 82 81 78 +42 44 46 47 48 50 51 54 +54 53 51 50 48 47 44 42 +95 92 90 89 86 +80 81 82 84 85 86 +59 58 55 54 51 +58 57 56 55 52 +32 35 36 38 41 +30 28 26 23 22 19 +36 33 31 30 29 26 25 23 +53 55 56 58 59 61 62 +40 42 44 47 49 +49 52 54 57 58 +71 74 77 78 81 83 +18 16 14 12 10 8 7 4 +28 31 34 37 38 41 +5 8 11 14 16 19 +10 13 16 19 22 24 +77 79 82 83 85 86 88 90 +49 46 43 40 38 37 +7 8 10 12 13 15 18 19 +69 70 71 72 73 76 +52 51 48 47 45 42 40 39 +19 21 23 24 27 +47 44 42 39 36 34 +35 36 37 38 40 42 44 46 +70 73 75 78 79 82 84 85 +33 34 35 36 39 40 42 +71 73 76 78 80 83 85 +77 75 74 73 71 68 +84 82 81 78 76 75 +32 31 29 28 26 23 22 +34 31 30 28 26 +83 82 81 80 77 74 72 +81 79 78 77 75 74 71 +9 12 14 16 18 19 21 +30 29 28 25 24 +46 47 48 50 52 54 57 59 +27 25 22 19 16 14 +50 48 47 44 42 +27 24 22 21 19 18 17 15 +24 25 27 30 32 35 +54 57 59 62 65 67 69 +90 88 85 83 82 81 79 76 +52 50 47 44 43 42 40 39 +53 56 59 61 63 65 68 70 +75 74 72 70 69 +71 74 75 77 78 79 82 +11 14 15 17 20 22 25 26 +23 21 19 17 16 14 12 +83 84 86 89 92 93 +83 80 78 77 74 71 68 67 +51 52 55 57 60 63 64 66 +60 62 64 65 68 +70 68 65 63 62 60 58 +82 83 85 86 89 90 92 93 +62 65 68 70 72 75 76 79 +55 57 60 63 66 67 70 71 +23 26 29 31 34 35 36 +46 48 49 52 53 56 +44 41 38 35 33 31 28 +74 75 77 80 82 83 +27 30 32 33 36 39 40 43 +39 42 43 46 49 52 55 58 +29 27 25 22 19 +31 34 35 38 39 40 +57 56 53 51 50 47 +36 34 33 31 29 +76 77 78 79 80 83 84 86 +69 70 73 76 79 82 84 +84 87 90 92 93 94 +79 78 77 74 71 68 67 +50 51 53 55 57 60 +43 46 49 52 53 +87 86 84 83 82 79 76 74 +18 15 12 11 8 7 6 4 +87 85 84 83 82 +30 33 35 38 39 +76 74 72 71 68 67 64 +56 57 59 62 63 65 +47 49 52 53 55 56 58 61 +63 66 67 69 70 +51 52 54 56 58 61 +73 75 78 81 82 84 86 89 +50 51 54 57 58 60 62 +92 89 86 84 82 79 +45 48 51 54 57 60 +9 12 13 15 17 18 +13 12 9 6 5 4 2 1 +26 24 22 21 18 +57 59 61 64 67 +2 5 7 9 10 12 +11 10 8 7 6 3 +45 46 48 51 53 55 56 57 +27 28 30 33 35 36 37 +23 22 21 18 15 13 10 +72 74 75 78 81 84 86 89 +38 40 42 45 47 +1 4 7 8 10 11 14 16 +71 73 74 75 78 80 83 85 +16 19 20 23 26 29 +65 64 62 61 60 59 58 56 +51 49 48 45 44 42 41 +80 81 84 87 88 90 93 +37 35 34 32 31 29 +89 90 91 93 94 95 96 +62 64 66 69 70 72 75 78 +85 86 89 90 91 93 +54 52 50 47 44 42 41 39 +79 80 81 83 84 86 89 +15 18 21 22 25 27 30 31 +68 65 64 62 60 58 +80 81 83 84 85 87 90 +53 54 55 57 58 +20 21 24 25 28 30 33 35 +78 79 82 85 86 +12 15 17 19 21 24 26 +36 33 32 30 28 26 25 +68 70 73 75 78 81 82 +33 32 30 27 24 23 20 +32 31 30 29 26 +82 79 76 75 74 72 71 +37 34 31 28 25 24 +55 58 59 62 64 65 68 69 +27 28 31 33 36 38 41 +60 59 58 56 55 53 52 +81 78 76 74 72 69 +72 70 68 65 64 63 60 +43 41 40 37 34 31 +66 69 70 73 76 +24 25 28 31 32 34 +69 70 72 75 78 81 +26 27 29 31 33 34 +7 8 10 12 15 16 +61 64 65 66 67 68 71 +65 62 60 58 57 55 +15 18 21 23 24 26 28 31 +89 90 92 93 94 96 97 +17 20 22 24 27 +45 44 41 39 37 +53 55 58 60 62 64 +18 17 16 15 14 11 9 +60 61 64 66 69 72 +90 88 87 86 84 81 79 77 +49 52 53 56 58 61 63 +84 82 81 80 78 76 +15 13 12 11 9 8 5 +11 13 15 17 19 22 24 27 +85 82 80 77 75 72 70 +51 54 57 59 62 65 +86 83 82 81 79 78 77 +25 22 20 18 16 +69 67 64 61 58 55 52 +61 59 58 57 55 +97 95 94 91 88 85 84 83 +73 72 69 68 65 62 +56 58 61 62 63 64 65 67 +31 34 36 37 39 41 +95 94 91 89 88 87 +71 72 73 76 77 79 82 85 +44 47 49 52 55 +69 70 72 75 77 +65 68 69 72 75 77 79 +33 32 29 28 27 26 +78 77 75 73 71 70 69 68 +44 46 48 49 52 53 54 +56 53 51 48 47 46 +50 52 53 55 58 60 63 66 +35 36 37 40 43 46 48 51 +32 35 37 39 42 +17 14 13 10 7 6 +50 53 55 57 58 59 60 63 +26 29 32 33 35 +62 63 65 66 67 70 72 73 +65 66 69 72 73 75 +41 39 37 36 35 34 32 29 +77 74 72 70 67 66 65 62 +89 91 92 95 96 98 99 +21 19 17 15 13 10 +75 78 79 80 83 85 88 91 +12 13 14 15 17 18 19 22 +23 20 19 17 14 +55 52 49 47 45 44 +33 30 29 27 24 22 20 +92 91 90 87 84 81 78 +54 55 58 61 64 66 69 71 +66 68 70 72 75 77 +37 34 31 28 26 +74 76 79 81 82 85 +39 36 35 32 31 29 26 25 +55 54 51 48 46 45 +20 19 17 14 12 9 +71 70 69 66 64 +11 9 6 5 4 2 1 +66 63 62 59 57 55 54 +59 56 53 52 49 46 43 42 +66 67 70 71 74 76 79 +23 22 21 20 18 17 +86 83 81 78 77 75 +38 39 40 41 42 +42 41 39 37 34 +62 60 58 56 54 +92 91 89 86 84 83 81 +31 33 36 37 40 42 43 44 +35 32 31 28 26 25 +62 61 60 59 57 56 53 +65 64 62 61 60 57 55 +78 76 75 73 71 +95 94 92 89 88 86 +54 51 50 47 46 44 43 +58 61 62 65 67 70 73 +40 37 34 33 32 31 +47 50 53 54 57 58 60 61 +59 58 55 53 52 \ No newline at end of file diff --git a/inputs/year_2024/03.dat b/inputs/year_2024/03.dat new file mode 100644 index 0000000..3a475a5 --- /dev/null +++ b/inputs/year_2024/03.dat @@ -0,0 +1,6 @@ +from()why()?mul(603,692)({select()}] )]-(mul(387,685)who()mul(28,717)who()]where()what()mul(486,768)]where()$mul(280,932)select()&'?~$mul(306,553)mul(272,821)&mul(547,513)) mul(514,132)when(121,319)who()mul(718,581):-!mul(210,910)}why()from()from()what(),!how()>mul(934,601)-(*@mul(975,495)when()mul(503,843)?mul(550,120)+mul(554,332)(who()+%],,{* mul(748,391)} <@'}mul(287,771)mul(805,862)[mul(899,214)$!~@what(513,928)?mul(677,473)}how()mul(21,309)?why()mul(106,356)when()!mul(614,290)$#>,>(!)&]mul(813,264)-] +mul(333,889)+/$}mul(307,370)[?mul(293,832)who()~why()]how()^>select()]don't()<,'mul(942,587)why()}what()&]-? (!mul(74,836)(,when()what() {*(mul(860,687)mul(50,589)mul(70,389)<{how()/where()]'mul(703,164)/>mul(421,905){/)^]mul(951,314)when()why()mul(958,595)when()]+#)@!!;[do()mul(704,757)#who()%+-mul(914,316)>!?&/@*mul(180,886)>)*mul(471,519)?*where()how(280,479)who()mul(552,129)&>why()($}]mul(361,533)!< }mul(809,768)%why()*}?*}what()!mul(55,163)#$select()how()mul(504,457)$:&$&mul(477,739)~] );-#!-^mul(290,284)how()who()&+why()~]!;mul(817,543)from()mul(510,673)~mul(553,851))when()! :+/<}what()'-%from(608,924)mul(51,899))who()mul(720,60)where()&*{mul)how()where()})who()%&^mul(632,14)>)*don't()select()(why()!mul(510,556) where()}{:when()&mul(497,500)why()do(),who()~]mul(343,705)/:@why()<[from(579,514)how()*mul(167,77)'):>+!:what();mul(441,250)how()]why(273,806)}[what()why()$why()mul(491,462)#>({(who()#/-mul(534,432)~@-'mul/>>who()($@mul(442,24)~&select(),[who() /mul(317,909)from()*![%%~mul(807,603)>;where()when()where()>mul(757,741):*how(781,794))mul(403when()>]how(472,280)~?}mul(170,711)@~what(){~{why()mul(347,151)$-:from()* -)^how()mul(946,614))mul(496,996)!+^-why()why():-:-+where()do(){-,$; #+what()mul(687,385)$*?%mul(989,55)~from()?#@where(){from()^what(478,489)do()mul(572,540;why(212,904)<#@;~>mul(900,593)[+@{$#how()mul(406,49) where()]@$}(where()what()%mul(712,667) +#]>from()}:^:why()mul(257,615)@'@[-!-,mul(381,780)how()mul(848,35&who(889,624){?mul(486,721)-*what(342,748)mul(660who()+]%?^what()mul(368,85)+?how();+from()#mulwhy()!how()!mul(21,287)),-+/<'(@mul(680,378)from()+what()@:}+~:+where()!how()#*mul(755,80)%mul(889^[how())what()$mul(781,598),+:;#'mul(788,253)< mul(131,148)!)how()mul(485,939):^[] @mul(401,246-}('^+#how()mul(58,198)@{*when()*~select()from()>mul(703,690)~ mul(210,596)@-mul(89,722)mul(64,727)?why()(mul(319,520)mul(174,955)mul(946,77)'why()- {~+ mul(672,214)mul(809,877)#/how()>~&from()~>mul%~mul(428,30)who()#)where()@when()'mul(928,351)([:^<*}-mul(61,385)#;mul(742,584)<]#-&mul(321,543)+^what()*where();^)from()mul(448,52)/?who()>select()mul(133,834)$mulhow()!where()'#)mul(760,90)mul(899,586)^][where())-mul(352,440)$@(,from()mul(476,125+^from()$/mul(34,660)mul(144,354)who()#^mul(849,172)?;:&:what()%}{>mul(309,477)-why() ^select(),)who()select()mul(491,355);{>how(){[@how()do()~-[what()/)when()>''mul(815,427)mul(538,327)%when()mul(390,965)^')!{::who(){@mul(8,973)who()mul(56,54)what(163,182)?where()$>?,>+*don't()'%when()mul(461,711)+--(where()@, +)mul(523,517)&!mul(27,506)-@+mul(797,6)(who()}mul(243,573)*:where()>why()<]):mul(680,263)!(mul(96,910)@&>who()!why()}{mul(548,279)]*(mul(801,596)from()~'[when(),^}-&mul(79,50)where()who():mul(512,820) >}$mul(743,399)how(),when()^$mul>>[@how()[$)mul(134,216)''mul(596,615):]>~why()&< ]>mul(509,208)select()*:&,:]${mul*:?*from()when(): mul(553,269)how()>&<;(},]where()mul(692,816)$ how()'>;when()don't()what()@what()/;]~^mul(585,546)[mul(280,948)-%mul(404,914)from()select()(^mul(110,946):#why()+&]mul(422,904)^}:%-(mul(513,623)%(!from()mul(981,173)<^who()<> mul(6,379)}$*''who()?{mul(979,885)!what()( how()who()>mul(123,654)how()]select()~)~*%,do()how()&'from()@/from(831,136)mul(273,764)#select()'from(661,437)[:mul(334,108)who(417,697)select()&#mul(863,899)'$}what()^ [);mul(202,611)@%how()&'%#mul(124,666)-*<]mul(405,735)}@[,'^{; mul(39,967)when()'+'/?how()select()>don't()?%%^#+mul(624,72)*mul(232,300) ~+{@where()+{mul(636] why()mul(367,706)from()from()&#!;]:(select()do()/<,where(349,951)mul(276,893)mul(139,18) )when()what()[what()*mul(859,550);mul(971,708)) +who()from(621,931)(($!!mul(856,817)select(),*mul(432,421)^mul(380,571)??{,$when()$why(){mul>/:#-where()when()%how()@what()mul(474,342)!who()):}@how()mul(467,667);mul(31,334)mul(883,979)why()select()/who()[select()!~/~do()mul(161,220)*:what()mul(83,659)~!}^$(why()where()what()select()mul(365,786),when()#{^?why());how()mul(530,814):],how()mul(467,765){[@mul(386,260~who(){mul(798,565)what()#who()]why(), <)mul(115,336)select()}(+what()~^why()'~mul(883,729)!@?;)):&mul(397,957)mul(80,44)?^from()what():(mul(992,682)!@]~why()mul(653,545)when()<,mul(349,559) +@{how()where()mul(132,764)where()@?]<[:)do()mul(934,299)!how();from(219,458)who()'how()where()mul(448,152)!: >^why()~&what(959,826)mul(421,331)mul(537,76)?<-mul(549,349)@~[!}%$how()*mul(662,422)when()!/^^'#how()!mul(370,635)what():)when()select(424,921)*mul(403,199)where()[}mul(510,374)(what()%mul(356,60)$+when()$mul(743,924)mul(317,382)-*from(253,395)from()^:who()<'mul(692,182)where()*when()mul(743,58)mul(703,870)where()what(74,21)mul(480,28)+what()!&$/?mul(711,746)-::how()why()+%${mul(869,811)how(),){/$why()do()who()select()}why()[who()mul(935,566):&~select()<@who()@>(mul(802,524):]who())*[mul(184,293)/+from()[!>'mul(989,102)]$(when()[@don't()?where()^mul(837?!how()@?mul(363,116)how()-select()[where()-'?-mul(451,766)mul(245,879<%<***$[#where(316,862)how()mul(970,700)/do()>*<%}when()mul(80,248):,'@})mul(514,148)why()mul(604,160), @%*$when()@from()mul&$-^mul(778,375)?select()@select())why(498,51)don't()%@]?(select(),![mul(239,721):@{why()mul(607,190)where()*[when()<'don't()$mul(678,822)>:!,mul(467,171(when()mul(807,110)where()select()mul(242,720)+!>what()%{+,$mul(911&what()}where(818,212)#where()mul(326,766)@'from()#do()mul(556,143)-@when()^/how()^[mul(408,289)mul(576,220@&who())mul(64,259)+]mul(610,521)mul(605,41)@mul(417[what():!+mul(908,353)[mul(396,24)who()mul(91,151)%select()mul(544,343)}[*~&why()mul(695,829)what()^;where()?,[[mul(905,287)};where())*?where()mul(666,591)-;#[}who()mul(671,325);where()%mul(630,789)&;@%}>}'?mul(711,15)} >{{what(948,68)mul(570,962)>mul(513,989)who()':[mul(672,83)-select()what()<;#why()where()don't()mul(458,928)where()/@$how(681,711)mul(573,736)&who(105,88)>,what(257,757):;)mul(720,176)^/@{how()>+$+when()mul(930,133)how()<%[}why()-why()}mul(33,761)+mul(47,200)mul(146,123){select()(select()/%;,mul(18,995)select()/from()how()%mul(383,881)<[+[mul(240}!where()how():mul(847,979)mul(726,233)]what():mul(798,926)*]when(){%-})from()mul(133,906)<:$where()@($from()}mul(45,7);/why()~mul(801where(866,189)mul(176,679)#++:mul(172,913)~,,%select()'mul(48,534);;~ -who()<^mul(705,712)*^,mul(232,487)what()-((%what(),what()$mul(228,981),;who()'when()+%[mul(886,441)}%<*,,mul(837,365)-!+',:%-select()mul(7,594);mul(530,424)why()[~/?mul(171,756)@]^*mul(342,328)*where()*;where()where()mul(51,137),how()&/[*&mul(994,980)what()^^how()-]mul(161,542)%&why()!+:}mul(854,734)mul(715,965)>#mul(225,21)@{how()~;mul(168,178)%where()/;]-what()mul(625,781*mul(913,156)(?when(581,507)??~-what()'mul(369,928)&(?/,-don't()$mul(901,668){#-how()where()$;?/mul(11,724):{~/&who(923,98)[/>mul(530,998)mul(186,573)$[;%]!>^^)mul(115,810select()!/&;why()mul(314,424))what()$mul(852,503)when()from()mul(521,770)who(802,289),('mul(361,165)why(454,380)&[how()mul(410,359)!when();~when(629,110)why()+,)mul(600,742)%~where(791,133)mul(219,287)mul(931,454)]from(), +$'mul(882,113)select()where()]+mul(983,17),where()$%why()select()mul(217,362)mul(692,111)mul(34,17)how():%what()how()]mul(472,633){%mul(324,69)]select()mul(542,365)(why()%?;who()mul(806,779)when()]}?:~mul(946,462)mul(957how()~mul(707,432)>,-*^&mul(477,553)^mul(362,4)why()#]?who()from(934,98)#from()*mul(356,610):who()( +,~:mul(99!when()}?&what()%,~]where()mul(156,709),mul(858,113)how()$how()what()mul(458,358)*)@>$[]mul(388,862)]#don't()~#[how();mul(848,651)*where(741,650))mul(129,5)'@@,mul(153,994)]mul(596,617)-^$+%/+how()mul(863,465),who(765,354)mul(436,109)where()]!@mul(403,366)~''who() {&mul(421,812)when()from()mul(783,846):}-from()'+,mul(406,87)who()!select()mul(138,952)?why() },>select()$mul(118,332){),@~:mul(505,459)%}[<:how(273,57)^>(what()mul(65,551who()(how()-~when()(:what()from()mul(345,236)'mul(892,526)/why()mul(739,975),who()mul(710-*%mul(40,319)?why():mul(919,144)!when()mul(540,77)what()select()mul(527,286)'(^%why()(don't();*who()?who()mul(865,906)$what()+}mul(417,111)what();+mul(877,675[]what()mul(905,57){from()(}/who()~>-mul(914,370)where()?&mul(734,186)%!%,:)mul(54,324)mul(238,439)when()what()mul(73,276)[how()[*+where()how()}{mul(505,735)~how()*~select()]+mul(956,708)[!+ %;+what()/why()mul(888,390),!(?^;what()#mul(716,886) +[mul(980,100:+when()what()<>mul(670,970)where() mul(60,574)+ where()from()>mul(424,922)-what()) };mul(998,698)/~&}++*mul(700,428)mul(711,527)}@'>mul(460,489)?'(/;mul(544,578)+from()who()when()mul(842,707)/mul(548,669)~%: %!$(mul(637,105)#/how()who()mul(333,88)mul(442,689)~&,:%#mul(142,210) 'when()mul(92,854)mul(967,544):}<%what() {#don't()*?+*{what()>mul(731,150)^/when()what(866,334)mul+&@mul(735,364)when(187,833)^ (+*~mul(508,962)from()select()mul(703,591)mul(448,49) when();from()*mul(214,478)!mul(891,494)mul(745,961)from():select()who()'#where();mul(867,127)<)(^,+*mul(894,207))what()what()&'select()mul(382,824)from()/;} %/*mul(343,494)$+%when()-**mul(658,77)$why()@when()@who()%(where(681,90)>mul(359,733)?what()mul(657,531);#/ $&#mul(94,761)~when()@<+where()*[?mul(730,273)<(' *!#when()'+mul(29,213)<:*{from()>,mul(999,444)@when()where()+-from()do()mul(620,569)why()mul(34,811)mul(934,29)where()>-where()why(),+&)mul-%^@select()!)(<+mul(707,336)$]%@mul(459,769)who()%+what()where():!mul(547,553)mul(554,390)who()#where()from()#>,<[mul(125,257)(!(where()^~-select()mul(297,774)when()where()%when()@mul(919,719)who())?;:%&[who()mul(40,839)}>*;mul(944,123);}when(),)<~]?mul(652,722)why()when()%why()<]mul(193,859)%>mul(379,558)why()mul(231,786)<#']who(){<#mul(748,767)select();mul(15,618)don't()!+{+*what()mul(814,151)when()when()]where()don't():,]from()#%,who()mul(556,60)why()how()what()how();mul(56,682)!,}][where()mul(974,191)!mul(894,70)?&#do()-what()/how()what()?>why(726,902)$;mul(364,892)select()$##]what(956,616)%~)mul(264,763)select()why()mul(663,310)+who(273,991)-mul(97,257)why(){>$who(920,449){>,%}do()*mul(672,685)where();!^)why()(from()%how()mul(384,910),;why()!how():#{'mul(169,774)select()/>!${}mul(843,717)'where()*-select(){&what()$%mul(3,577)+'/!~:where(){)@mul(729,710):where())when()%]why()~{$mul(542,202)>select()[how()how()*%<+don't() ^mul(754,460)mul(590,305)mul(959@#]-where()#mul(724,268)>?what())why()who())[ mul(548,465),mul(50,721)when()mul/what()@:;mul(43,189)don't()-(how();!mul(206,946)mul(962,222)//why()$mul(448,884):[~ ^don't()@mul(637,461)>select(905,87)[!how()(why()~mul(281,216)^;-when()/how()-&%;mul(577,722)!%{(!?how()+@)mul(269,575) select()@(>)&}from(),mul(80why()who()-!]when(347,788)>from()-'when()don't()'what();&where()mul<>^~> where()-who()who()mul(89,415)<$>>when()where(){select()mul(945,109#[#how()],how()'/-*mul(874,712) }-}#]*mul(368,562)<*}what()where()?mul(691,657)who()what()'; :&mul(25,126)from()!*when()^(>from()do()how(264,492)?@@[)mul(648,619)>where()%'~%@}&mul(949,194)*mul(486,964))why()}&^<)mul(556,688)@#,+-$*(what()mul(81,110)!?:@%?;what()mul(897,336)how()]!mul(842,431)mul(927,669)]&(how()* when()$mul(84,909)who()+select(){mul(666,542)why()mul(148,609) +#mul(55,264)?!^+)when()what()mul(332,605)where(){what()?what()mul(721,480)& #@mul(61,304),@from()@how()#mul(496,506)select()$mul(826,26){/',how()][,~where()mul(773,845)how()from()^mul%(*mul(239,751)*who()&^how()}mul(971,568);-when()#+&why(){,>>;who()>where()do()[<@how()$@]where()?from()mul(619,593)@#:when()-where()[[why()+mul(53,745):;?(#mul(167*from()'*){-how()mul(746,677)?}:from()select()!^:%]mul(410,746)!$* :[-mul(355,228)} select()@ mul(968,91)/~<(who()//]mul(923,647)(,'mul(697,603)!select(),select()select()?how()mul(609,195)why(664,970)why(),^<[don't()select()/?mul>from()/',why()how()mul(833,431)&}+%#mul(924,387)mul(245,807)from()where()where():mul(866,528)[^from()who()how()select()where()what() mul(610,589)/ !&,{who()mul(81,246)#mul(591,208)}^+$where()select()when()mul(936,143)<< >select():>:@mul(349,372)$^! ]}?('do()when()/mul(42,24) -?who()@mul(501,520){@what(869,966)why()select()&mul(435,922)&>@from(134,495)select())where()@from()!]'mul(955,305)*mul(39,915)how()what()mul(484,347)&select() ?~[?)don't()!>?^?#who()mul(30,374)@]>$when()!?where()]select()mul(770,206)mul(260,165)-~/^mul(980,877)){where()from())mul(556,133))@&;who(257,213)where()*;^{mul(381,791);]select(821,109)+select()< why()(do()mul(763,606):<#[>;*(*how()don't()$>how()(#{mul(898,960)]from()how()^why()from()/:mul(932,119)@%){from();mul(926,30)#;mul(90,54)/^~'#}/mul(665,248)mul(483,311)~+:,(how()mul(824,825)(}mul(342,735)from()+/&what()mul(903,919) ()%from()'(why()mul(556,22)@#what()!mul(544,701)when()*>+'$$&'[mul(811,773)-,~~mul(701,85)::-/-do():when(318,3)how()&%who()mul(759,372)>+why(),/)~mul(796,407){mul(101,955)select(){mul(429,479)who()]->}@mul(174,416);when()!what(): '[{-mul(909,460)@&who()^/;@!mul(517,830)mul(809,577)},#why()how()+ how()&mul(813,555)/( from()'* \ No newline at end of file diff --git a/scripts/generate_new_day_skeleton_files_from_templates.py b/scripts/generate_new_day_skeleton_files_from_templates.py index c435df3..102965b 100644 --- a/scripts/generate_new_day_skeleton_files_from_templates.py +++ b/scripts/generate_new_day_skeleton_files_from_templates.py @@ -2,7 +2,7 @@ import argparse -TEMPLATES_PATH = os.path.join(".", "src", "advent_of_code", "scripts", "templates") +TEMPLATES_PATH = os.path.join("scripts", "templates") def parse_input_args(): @@ -45,26 +45,18 @@ def generate_file(template_file_path, input_day, input_year, output_file_path): if __name__ == "__main__": args = parse_input_args() - input_day = args.day + input_day_raw = args.day input_year = args.year + input_day = str(input_day_raw).zfill(2) day_file_dest = os.path.join( - "src", "advent_of_code", f"year_{input_year}", f"days/{input_day}.py" + "src", "advent_of_code", f"year_{input_year}", f"day_{input_day}.py" ) template_path = os.path.join(TEMPLATES_PATH, "days_template.txt") generate_file(template_path, input_day, input_year, day_file_dest) - solvers_file_dest = os.path.join( - "src", - "advent_of_code", - f"year_{input_year}", - f"solvers/day_{input_day}_solvers.py", - ) - template_path = os.path.join(TEMPLATES_PATH, "solvers_template.txt") - generate_file(template_path, input_day, input_year, solvers_file_dest) - tests_file_dest = os.path.join( - "tests", f"year_{input_year}", f"test_day_{input_day}_solvers.py" + "tests", f"year_{input_year}", f"test_day_{input_day}.py" ) template_path = os.path.join(TEMPLATES_PATH, "tests_template.txt") generate_file(template_path, input_day, input_year, tests_file_dest) diff --git a/scripts/templates/days_template.txt b/scripts/templates/days_template.txt index c294252..8898757 100644 --- a/scripts/templates/days_template.txt +++ b/scripts/templates/days_template.txt @@ -1,13 +1,13 @@ -from advent_of_code.year_{year}.solvers.day_{day}_solvers import ( - solve_day_{day}, -) -from advent_of_code.utils.input_handling import read_input, parse_args +from advent_of_code.utils.input_handling import read_input -def main(): - args = parse_args() - input = read_input(args.input_file) - result_part_1, result_part_2 = solve_day_{day}(input) +def solve(input): + return (None, None) + + +def main(input_file): + input = read_input(input_file) + (result_part_1, result_part_2) = solve(input) print( f"Day {day}: " f" Result for part 1 is {result_part_1}. " diff --git a/scripts/templates/solvers_template.txt b/scripts/templates/solvers_template.txt deleted file mode 100644 index d666f5c..0000000 --- a/scripts/templates/solvers_template.txt +++ /dev/null @@ -1,3 +0,0 @@ -def solve_day_{day}(input): - part_1, part_2 = do_something(input) - return (part_1, part_2) diff --git a/scripts/templates/tests_template.txt b/scripts/templates/tests_template.txt index 52d5e96..e3ff3bf 100644 --- a/scripts/templates/tests_template.txt +++ b/scripts/templates/tests_template.txt @@ -1,6 +1,6 @@ import pytest -from advent_of_code.year_{year}.solvers.day_{day}_solvers import ( - solve_day_{day}, +from advent_of_code.year_{year}.day_{day} import ( + solve, ) diff --git a/src/advent_of_code/utils/input_handling.py b/src/advent_of_code/utils/input_handling.py index c7dd191..913bcb5 100644 --- a/src/advent_of_code/utils/input_handling.py +++ b/src/advent_of_code/utils/input_handling.py @@ -14,3 +14,12 @@ def parse_args(): parser.add_argument("--part", type=int) args = parser.parse_args() return args + + +def read_side_by_side_list_format(data): + list1, list2 = [], [] + for line in data: + list1.append(int(line.split()[0])) + list2.append(int(line.split()[1])) + + return (list1, list2) diff --git a/src/advent_of_code/year_2024/day_01.py b/src/advent_of_code/year_2024/day_01.py new file mode 100644 index 0000000..8fd2f99 --- /dev/null +++ b/src/advent_of_code/year_2024/day_01.py @@ -0,0 +1,54 @@ +from advent_of_code.utils.input_handling import read_input, read_side_by_side_list_format + +def compute_distance(i, j): + return abs(i - j) + + +def solve_part_1(parsed_input): + (list1, list2) = parsed_input + list1_ordered = list(sorted(list1)) + list2_ordered = list(sorted(list2)) + + total_distance = 0 + + for i, j in zip(list1_ordered, list2_ordered): + total_distance += compute_distance(i, j) + + return total_distance + + +def compute_similarity(i, lst): + return i * lst.count(i) + + +def solve_part_2(parsed_input): + (list1, list2) = parsed_input + + total_similarity_score = 0 + + for element in list1: + total_similarity_score += compute_similarity(element, list2) + + return total_similarity_score + + + +def solve(input): + parsed_input = read_side_by_side_list_format(input) + part_1_solution = solve_part_1(parsed_input) + part_2_solution = solve_part_2(parsed_input) + return (part_1_solution, part_2_solution) + + +def main(input_file): + input = read_input(input_file) + (result_part_1, result_part_2) = solve(input) + print( + f"Day 01: " + f" Result for part 1 is {result_part_1}. " + f" Result for part 2 is {result_part_2}. " + ) + + +if __name__ == "__main__": + main() diff --git a/src/advent_of_code/year_2024/day_02.py b/src/advent_of_code/year_2024/day_02.py new file mode 100644 index 0000000..3d5b681 --- /dev/null +++ b/src/advent_of_code/year_2024/day_02.py @@ -0,0 +1,62 @@ +from advent_of_code.utils.input_handling import read_input + +def is_report_safe(report,): + if not ((report==sorted(report)) or (report==sorted(report,reverse=True))): + return False + + differences = [abs(report[i+1] - report[i]) for i in range(len(report) - 1)] + if ((max(differences) > 3) or (min(differences)<1)): + return False + + return True + + +def solve_part_1(input): + safe_report_count = 0 + for report in input: + if is_report_safe(report): + safe_report_count += 1 + return safe_report_count + + +def solve_part_2(input,): + + safe_report_count = 0 + + for report in input: + if is_report_safe(report): + safe_report_count += 1 + else: + for idx, _ in enumerate(report): + tmp_report = report[:] + del tmp_report[idx] + if is_report_safe(tmp_report,): + safe_report_count += 1 + break + return safe_report_count + + +def solve(input): + part_1_solution = solve_part_1(input) + part_2_solution = solve_part_2(input) + return (part_1_solution, part_2_solution) + + +def parse_input(input_data,dtype=int): + data = [list(map(dtype, line.rstrip("\n").split())) for line in input_data] + return data + + +def main(input_file): + unparsed_input = read_input(input_file) + parsed_input = parse_input(unparsed_input) + (result_part_1, result_part_2) = solve(parsed_input) + print( + f"Day 02: " + f" Result for part 1 is {result_part_1}. " + f" Result for part 2 is {result_part_2}. " + ) + + +if __name__ == "__main__": + main() diff --git a/src/advent_of_code/year_2024/day_03.py b/src/advent_of_code/year_2024/day_03.py new file mode 100644 index 0000000..eca06c6 --- /dev/null +++ b/src/advent_of_code/year_2024/day_03.py @@ -0,0 +1,60 @@ + +import re +import math + +DO_SUBSTR = 'do()' +DONT_SUBSTR = 'don\'t()' + +def find_valid_substrings(s, match_str=r'mul\(\d+,\d+\)'): + return re.findall(match_str, s) + +def find_and_multiply_valid_muls_in_string(input_string): + string_score = 0 + valid_muls = find_valid_substrings(input_string) + for m in valid_muls: + found_ints = find_valid_substrings(m, match_str=r'\d+') + string_score += math.prod(map(int, found_ints)) + return string_score + +def instruction_compute(instruction, use_do_dont_rule=False): + + if not use_do_dont_rule: + instruction_score = find_and_multiply_valid_muls_in_string(instruction) + else: + instruction_score=0 + padded_instruction = DO_SUBSTR+instruction.strip("\n")+DONT_SUBSTR + valid_subs = find_valid_substrings( + padded_instruction, + match_str=r"mul\((\d+),(\d+)\)|(do\(\))|(don't\(\))" + ) + counting_active = False + for (i, j, do, dont) in valid_subs: + if do: + counting_active = True + elif dont: + counting_active = False + else: + if counting_active: + instruction_score += int(i)*int(j) + return instruction_score + +def solve(input): + + part_1_solution, part_2_solution = 0, 0 + part_1_solution = instruction_compute(input, False) + part_2_solution = instruction_compute(input, True) + return (part_1_solution, part_2_solution) + + +def main(input_file): + input = input = open(input_file).read() + (result_part_1, result_part_2) = solve(input) + print( + f"Day 03: " + f" Result for part 1 is {result_part_1}. " + f" Result for part 2 is {result_part_2}. " + ) + + +if __name__ == "__main__": + main() diff --git a/tests/year_2024/test_day_01.py b/tests/year_2024/test_day_01.py new file mode 100644 index 0000000..bcc1919 --- /dev/null +++ b/tests/year_2024/test_day_01.py @@ -0,0 +1,26 @@ +import pytest +from advent_of_code.year_2024.day_01 import ( + solve, +) + + +@pytest.fixture +def day_01_test_input(): + return [ + "3 4", + "4 3", + "2 5", + "1 3", + "3 9", + "3 3", + ] + + +@pytest.fixture +def day_01_expected_output(): + return (11, 31) + + +def test_solver(day_01_test_input, day_01_expected_output): + result = solve(day_01_test_input) + assert result == day_01_expected_output diff --git a/tests/year_2024/test_day_02.py b/tests/year_2024/test_day_02.py new file mode 100644 index 0000000..3246b89 --- /dev/null +++ b/tests/year_2024/test_day_02.py @@ -0,0 +1,28 @@ +import pytest +from advent_of_code.year_2024.day_02 import ( + solve, + parse_input, +) + + +@pytest.fixture +def day_02_test_input(): + return [ + "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", + ] + + +@pytest.fixture +def day_02_expected_output(): + return (2,4) + + +def test_solver(day_02_test_input, day_02_expected_output): + day_02_test_input_parsed = parse_input(day_02_test_input) + result = solve(day_02_test_input_parsed) + assert result == day_02_expected_output diff --git a/tests/year_2024/test_day_03.py b/tests/year_2024/test_day_03.py new file mode 100644 index 0000000..b4e0390 --- /dev/null +++ b/tests/year_2024/test_day_03.py @@ -0,0 +1,18 @@ +import pytest +from advent_of_code.year_2024.day_03 import ( + instruction_compute, +) + +@pytest.mark.parametrize("input, use_do_dont_rule, expected", [ + ["xmul(2,4)%&mul[3,7]!@^do_not_mul(5,5)+mul(32,64]then(mul(11,8)mul(8,5))", False, 161], + ["xmul(2,4)", False, 8], + ["%&mul[3,7]!@^do_not_mul(5,5)", False, 25], + ["mul(11,8)mul(8,5)", False, 128], + ["xmul(2,4)&mul[3,7]!^don't()_mul(5,5)+mul(32,64](mul(11,8)undo()?mul(8,5))", True, 48], +]) +def test_instruction_compute(input, use_do_dont_rule, expected): + result = instruction_compute(input, use_do_dont_rule=use_do_dont_rule) + print(result) + assert result == expected + +