From 0a5c1f77d01fc0bd166494787f24562e2fd3a9e9 Mon Sep 17 00:00:00 2001 From: Botond Hende Date: Wed, 11 Dec 2024 10:18:23 +0100 Subject: renamed day folders to two digit format --- 2024/day01/input | 1000 ++++++++++++++++++++++++++++++++++ 2024/day01/solve.py | 18 + 2024/day01/solve2.py | 20 + 2024/day02/input | 1000 ++++++++++++++++++++++++++++++++++ 2024/day02/input_test | 6 + 2024/day02/solve.py | 31 ++ 2024/day02/solve2.py | 42 ++ 2024/day03/input | 6 + 2024/day03/input_test | 1 + 2024/day03/input_test2 | 1 + 2024/day03/solve.py | 12 + 2024/day03/solve2.py | 38 ++ 2024/day04/input | 140 +++++ 2024/day04/input_test | 10 + 2024/day04/solve.py | 43 ++ 2024/day04/solve2.py | 33 ++ 2024/day05/input | 1387 ++++++++++++++++++++++++++++++++++++++++++++++++ 2024/day05/input_test | 28 + 2024/day05/solve.py | 27 + 2024/day05/solve2.py | 36 ++ 2024/day06/input | 130 +++++ 2024/day06/input_test | 10 + 2024/day06/solve.py | 55 ++ 2024/day06/solve2.py | 78 +++ 2024/day07/input | 850 +++++++++++++++++++++++++++++ 2024/day07/input_test | 9 + 2024/day07/solve.py | 38 ++ 2024/day07/solve2.py | 44 ++ 2024/day08/input | 50 ++ 2024/day08/input_test | 12 + 2024/day08/solve.py | 34 ++ 2024/day08/solve2.py | 35 ++ 2024/day1/input | 1000 ---------------------------------- 2024/day1/solve.py | 18 - 2024/day1/solve2.py | 20 - 2024/day2/input | 1000 ---------------------------------- 2024/day2/input_test | 6 - 2024/day2/solve.py | 31 -- 2024/day2/solve2.py | 42 -- 2024/day3/input | 6 - 2024/day3/input_test | 1 - 2024/day3/input_test2 | 1 - 2024/day3/solve.py | 12 - 2024/day3/solve2.py | 38 -- 2024/day4/input | 140 ----- 2024/day4/input_test | 10 - 2024/day4/solve.py | 43 -- 2024/day4/solve2.py | 33 -- 2024/day5/input | 1387 ------------------------------------------------ 2024/day5/input_test | 28 - 2024/day5/solve.py | 27 - 2024/day5/solve2.py | 36 -- 2024/day6/input | 130 ----- 2024/day6/input_test | 10 - 2024/day6/solve.py | 55 -- 2024/day6/solve2.py | 78 --- 2024/day7/input | 850 ----------------------------- 2024/day7/input_test | 9 - 2024/day7/solve.py | 38 -- 2024/day7/solve2.py | 44 -- 2024/day8/input | 50 -- 2024/day8/input_test | 12 - 2024/day8/solve.py | 34 -- 2024/day8/solve2.py | 35 -- 64 files changed, 5224 insertions(+), 5224 deletions(-) create mode 100644 2024/day01/input create mode 100644 2024/day01/solve.py create mode 100644 2024/day01/solve2.py create mode 100644 2024/day02/input create mode 100644 2024/day02/input_test create mode 100644 2024/day02/solve.py create mode 100644 2024/day02/solve2.py create mode 100644 2024/day03/input create mode 100644 2024/day03/input_test create mode 100644 2024/day03/input_test2 create mode 100644 2024/day03/solve.py create mode 100644 2024/day03/solve2.py create mode 100644 2024/day04/input create mode 100644 2024/day04/input_test create mode 100644 2024/day04/solve.py create mode 100644 2024/day04/solve2.py create mode 100644 2024/day05/input create mode 100644 2024/day05/input_test create mode 100644 2024/day05/solve.py create mode 100644 2024/day05/solve2.py create mode 100644 2024/day06/input create mode 100644 2024/day06/input_test create mode 100644 2024/day06/solve.py create mode 100644 2024/day06/solve2.py create mode 100644 2024/day07/input create mode 100644 2024/day07/input_test create mode 100644 2024/day07/solve.py create mode 100644 2024/day07/solve2.py create mode 100644 2024/day08/input create mode 100644 2024/day08/input_test create mode 100644 2024/day08/solve.py create mode 100644 2024/day08/solve2.py delete mode 100644 2024/day1/input delete mode 100644 2024/day1/solve.py delete mode 100644 2024/day1/solve2.py delete mode 100644 2024/day2/input delete mode 100644 2024/day2/input_test delete mode 100644 2024/day2/solve.py delete mode 100644 2024/day2/solve2.py delete mode 100644 2024/day3/input delete mode 100644 2024/day3/input_test delete mode 100644 2024/day3/input_test2 delete mode 100644 2024/day3/solve.py delete mode 100644 2024/day3/solve2.py delete mode 100644 2024/day4/input delete mode 100644 2024/day4/input_test delete mode 100644 2024/day4/solve.py delete mode 100644 2024/day4/solve2.py delete mode 100644 2024/day5/input delete mode 100644 2024/day5/input_test delete mode 100644 2024/day5/solve.py delete mode 100644 2024/day5/solve2.py delete mode 100644 2024/day6/input delete mode 100644 2024/day6/input_test delete mode 100644 2024/day6/solve.py delete mode 100644 2024/day6/solve2.py delete mode 100644 2024/day7/input delete mode 100644 2024/day7/input_test delete mode 100644 2024/day7/solve.py delete mode 100644 2024/day7/solve2.py delete mode 100644 2024/day8/input delete mode 100644 2024/day8/input_test delete mode 100644 2024/day8/solve.py delete mode 100644 2024/day8/solve2.py (limited to '2024') diff --git a/2024/day01/input b/2024/day01/input new file mode 100644 index 0000000..921687d --- /dev/null +++ b/2024/day01/input @@ -0,0 +1,1000 @@ +23238 26034 +94370 90190 +15509 72666 +48816 23909 +31300 40420 +14729 97519 +47167 21596 +18644 62370 +10058 89257 +15802 28645 +63557 90190 +66676 90412 +95224 92079 +20517 91403 +33109 13140 +58060 17075 +63986 35300 +92785 33038 +75525 55696 +91034 12712 +54945 85952 +70951 90190 +72666 33543 +19148 51672 +84872 54241 +44568 34382 +83462 63079 +75888 90582 +51807 47834 +71629 83895 +78782 92388 +15141 90190 +31753 44568 +33506 43240 +47083 26486 +38009 74762 +46783 42091 +59913 32597 +27337 56511 +84961 14925 +49804 93940 +79195 90534 +37742 34810 +38653 36830 +60692 21316 +34988 77576 +68550 56068 +59229 83297 +72846 80603 +28642 34506 +96975 38315 +76719 55715 +68212 11978 +49896 58929 +85899 72666 +65378 79253 +81584 98628 +57795 66296 +89138 37249 +24417 72666 +85907 44568 +33187 29605 +32132 47166 +61218 79101 +79906 17323 +75306 69897 +36113 20298 +19848 37536 +79974 53573 +82681 88411 +61356 72666 +67779 12835 +73747 32976 +43226 98628 +27418 42113 +81936 47166 +65390 72188 +86410 48512 +63152 89057 +83433 48642 +15154 49428 +67196 31091 +52145 66296 +97392 54967 +68822 89257 +95968 18999 +10231 48028 +75979 10758 +68791 71081 +73395 23710 +35116 61618 +75457 47834 +59013 74006 +60089 83297 +81215 72666 +85282 30857 +77169 72362 +77343 83136 +58477 47834 +93845 62570 +80320 36393 +25356 36515 +30605 14520 +41757 38101 +52096 63406 +37058 90190 +59797 79101 +65557 21111 +29895 62370 +76060 22181 +20451 88174 +98101 10985 +89542 16550 +35720 78549 +21328 90190 +78382 40764 +70594 72376 +44254 93643 +79324 84865 +61358 62370 +70753 70574 +19289 14760 +50375 77640 +55565 77975 +62697 88319 +97267 29605 +10937 83297 +45672 67842 +39846 62370 +55006 42276 +12817 55094 +25730 62370 +41309 45811 +79332 28406 +62494 71394 +40764 54500 +48573 10017 +32570 92974 +70630 79760 +33351 65490 +72008 71845 +99063 21041 +55424 44568 +54777 63064 +61905 72634 +81660 62370 +43650 92176 +98062 35629 +64890 32075 +84348 79253 +19809 15891 +17397 44325 +85724 79818 +50967 79253 +80513 21562 +90817 90582 +27451 84569 +97017 51807 +22724 65607 +61250 74083 +51613 82431 +92507 66296 +20838 67775 +21646 97601 +43227 42156 +54500 79253 +67589 79631 +68298 21800 +97081 13343 +49525 72376 +77455 89257 +49455 91182 +92689 77523 +10868 44679 +26724 47166 +94594 40764 +84697 79414 +14040 90751 +26930 62370 +62034 79253 +41654 62370 +72668 37285 +69857 97462 +89426 44374 +38354 20538 +68214 68822 +51210 38361 +60260 34047 +97778 35495 +64646 30634 +86706 85448 +71151 32417 +52064 84475 +92076 79101 +52941 65015 +83276 28661 +45040 52329 +24804 40692 +80127 71081 +75976 83297 +50856 54764 +98860 14310 +86849 68822 +55826 22807 +44426 84475 +18776 63854 +88579 41265 +86039 72666 +31003 79253 +38782 72839 +44759 40764 +49379 74859 +96296 22158 +52253 28645 +40895 79101 +11295 47834 +82274 36463 +75980 53984 +80045 90190 +24187 60596 +84264 60692 +39382 52329 +68621 67760 +78207 92176 +29605 89257 +82965 57643 +35473 32611 +76842 83297 +53704 69974 +18987 86774 +87307 55460 +13653 79101 +63448 47166 +82570 11369 +35219 79094 +78126 58440 +90509 42934 +67069 89709 +30317 83976 +59656 67961 +85165 47834 +87543 41626 +63866 28813 +96015 89257 +41635 40764 +58535 47166 +86065 53573 +59283 43240 +52899 68822 +93324 28248 +30465 29605 +90803 40764 +65604 72666 +41070 97917 +21201 32712 +66296 51560 +23241 18816 +49231 22376 +16090 71800 +60878 70919 +18216 86802 +31255 56222 +43385 43240 +27548 79253 +21800 47834 +90258 68822 +66198 41931 +77218 75490 +33929 46602 +63886 36805 +38478 28645 +75472 77934 +22622 47166 +68813 72376 +24242 67007 +56625 30429 +33816 69857 +99853 53573 +25244 99809 +58312 90190 +84081 72666 +18267 84356 +98628 57652 +70385 22850 +55944 49172 +34925 73021 +45979 61368 +69251 66296 +87383 52329 +40150 39790 +53132 65879 +11700 36363 +56444 44568 +96855 62674 +84569 66296 +10076 36393 +82102 77658 +34089 83297 +75465 16448 +96939 27252 +59547 44296 +17871 52665 +48300 85270 +99007 51807 +60501 72338 +54290 75136 +82299 76051 +19912 58398 +29748 28645 +94064 29440 +67058 66296 +96558 33145 +28211 60692 +83522 37461 +24984 31435 +73026 54947 +37704 83297 +45679 12243 +59293 96287 +70715 12977 +75300 92176 +47834 88660 +73179 44568 +15396 69857 +13155 45242 +15322 40764 +87738 44568 +39228 63056 +10094 99306 +19187 51279 +24608 66876 +64188 17378 +92176 34202 +27181 94666 +25568 21800 +23269 79101 +73632 83094 +76443 79253 +50395 40764 +95389 12857 +37621 76935 +98105 83297 +52329 70935 +22302 11041 +21359 68822 +85409 61115 +78562 66999 +80124 12495 +27657 85353 +21050 89257 +99720 24490 +34473 60692 +40097 28645 +71499 89052 +14699 66369 +39662 30699 +10126 90582 +70882 41277 +53822 88374 +26814 44568 +46613 19368 +60821 32241 +50555 48329 +47797 74633 +13233 84569 +82025 20968 +60368 92176 +83906 38286 +10747 61071 +55896 85143 +92268 95602 +69037 84475 +34685 46159 +19218 43240 +28324 72085 +11651 44568 +78958 66147 +17530 46029 +74555 44500 +77014 47834 +24738 47834 +16637 91276 +45665 79253 +92616 30393 +37952 59966 +19685 11968 +94702 29605 +41971 66296 +36214 79101 +56277 52329 +50495 55484 +12931 19137 +30115 27951 +43240 48011 +35685 28124 +83746 99263 +65419 44568 +24233 60692 +47241 55356 +35356 59649 +94202 43240 +79253 72376 +47166 33437 +91716 77323 +47182 44568 +53626 79101 +13563 61608 +48825 25123 +28824 84475 +90758 85547 +89417 90761 +22416 93637 +48389 40943 +38655 27039 +27191 19247 +79955 68822 +82905 40764 +86695 28645 +40972 66296 +45612 28645 +41731 21800 +61510 40764 +91192 98628 +15004 72376 +22943 54500 +68404 41433 +60311 44568 +60689 84252 +60979 43240 +19808 72495 +80126 38496 +13846 29383 +22482 13993 +39349 84569 +85531 37632 +80209 83851 +63852 56007 +54497 35634 +51625 87132 +38979 80241 +28939 88293 +59010 83649 +30553 26199 +94589 79101 +70488 99011 +81746 92176 +64311 44568 +88295 60692 +93665 89557 +53760 33880 +14737 80051 +25521 61141 +86653 98106 +91054 87401 +74929 40764 +20082 72374 +43069 87032 +95088 51436 +82111 80970 +39862 99504 +82669 46360 +83378 62370 +62130 25115 +43544 20178 +23808 89185 +98111 83928 +20879 43240 +49519 84475 +94944 85865 +75415 75964 +47156 36358 +27019 28645 +81852 52329 +83726 90190 +36393 96318 +65529 91634 +22850 28317 +12435 21800 +45103 82620 +54394 16838 +48022 53556 +52784 68553 +76933 84475 +66619 72666 +45083 10443 +85277 88103 +95818 90190 +23357 79253 +10551 63173 +86368 10170 +49946 12592 +73961 76042 +11496 47834 +15914 51997 +21677 66325 +24401 81589 +72493 50642 +72307 91265 +25787 80652 +56985 71081 +55531 44402 +59945 83297 +63295 83297 +20808 90190 +89697 47834 +65568 29693 +98707 28645 +62217 20682 +99249 48525 +13276 33527 +10427 46523 +69239 79253 +69378 67265 +64906 98628 +79879 42860 +12341 24113 +63649 28645 +93094 10616 +81490 28786 +13491 28645 +74076 93412 +54347 22101 +49315 90582 +56725 83297 +86924 56458 +62370 32885 +48988 72376 +42946 42505 +43680 95834 +62438 72376 +46412 79101 +97903 79101 +26320 47834 +69366 71081 +34171 68822 +30248 63980 +19619 40923 +47420 89257 +87678 57669 +61051 96558 +62807 12392 +30534 17024 +49199 67605 +48341 44568 +53638 58468 +12820 84475 +79439 72666 +80714 44568 +14366 84475 +21888 60692 +95972 59581 +63117 85887 +96782 72376 +71622 88794 +62648 62370 +21936 60167 +69675 39650 +88205 66550 +93488 93842 +28475 42399 +75331 25752 +88545 84475 +45032 57784 +97469 41573 +60842 78415 +19399 47166 +36862 22156 +44872 33736 +91430 41673 +28875 44568 +67699 94310 +69033 13525 +68804 47834 +35863 52441 +78678 99708 +68260 84487 +32978 60692 +46940 80397 +72663 74882 +21043 90582 +74375 17862 +96385 76273 +79101 53573 +76218 92278 +87477 43240 +58381 57987 +29149 78325 +16341 72376 +47020 52329 +65310 61228 +37754 83297 +77458 67510 +61915 23653 +36950 55786 +28645 34188 +35813 92176 +47172 66598 +90056 62370 +14736 85451 +89257 84569 +17180 34739 +66755 92176 +28028 29549 +78468 60692 +15102 60692 +17822 41158 +31218 66296 +41429 79101 +21620 72666 +57643 98463 +93661 22308 +97777 51057 +71356 33985 +55197 29232 +70795 55547 +71377 52329 +18251 92760 +49293 83737 +63584 43517 +32445 72666 +70614 68967 +47977 19618 +91379 69845 +17003 85894 +87325 99345 +12731 44568 +42313 70327 +36391 82618 +14548 47834 +80254 21800 +21669 90190 +54961 67621 +95444 79253 +84613 78529 +36436 62364 +62416 61914 +78479 43240 +31827 37146 +94738 81883 +97541 79253 +66855 29605 +70582 83297 +66034 32135 +33893 20394 +77467 68822 +37149 79166 +22676 28333 +92029 47166 +94520 70838 +45370 79253 +86953 50576 +12736 16934 +37014 41185 +95511 85166 +93629 61042 +95831 40730 +56049 80299 +29900 16094 +77032 47834 +88320 64538 +68300 23040 +82526 32180 +91345 62370 +85150 39035 +65519 44754 +10865 28011 +18592 83297 +19078 62370 +65128 83297 +29680 16423 +63907 60692 +52189 79101 +50834 68822 +48390 98628 +16835 43240 +16523 58031 +23750 72666 +93801 62698 +15455 85166 +39313 39154 +12246 29615 +57256 28645 +70719 80450 +93935 11251 +49629 43085 +68611 12734 +69656 44568 +30033 32331 +54145 10729 +25483 29605 +20736 27197 +70628 17513 +46547 79966 +34712 54500 +10856 47834 +40229 18590 +62932 79646 +34539 77892 +52528 92176 +98937 18544 +91209 71352 +18740 63353 +86629 70628 +64790 47041 +56551 79101 +83297 20038 +75130 56853 +33535 61978 +43492 14865 +51344 99384 +35260 24059 +84784 51807 +12409 16319 +16243 18062 +19891 46508 +35614 86985 +15122 68822 +43057 98628 +84820 60692 +12233 76084 +23335 65709 +71081 79101 +67869 62671 +49734 51807 +12696 83851 +15492 54500 +29208 62370 +24284 11417 +41157 47772 +30544 66296 +92226 17271 +61246 52329 +63227 96077 +31426 44568 +57047 79253 +23855 79520 +69439 27186 +85166 31655 +25322 62989 +14479 26112 +77140 28645 +10612 17077 +56543 83297 +53494 80908 +45334 95239 +89902 85166 +73255 57735 +26895 18173 +64218 47924 +78172 49084 +77332 43240 +17955 95261 +31704 37280 +83774 66296 +54943 83851 +65875 79101 +30695 72666 +25827 53304 +66127 92176 +16436 97614 +27869 48013 +54766 34900 +96521 83851 +39183 70628 +18834 35784 +73420 64200 +97485 45854 +50874 98017 +61477 58419 +52459 52329 +82878 79253 +18371 19152 +58631 54500 +92293 22682 +64034 28645 +75077 51807 +81292 45981 +81885 93158 +92300 36393 +97964 67294 +59096 69267 +48792 69248 +22288 94108 +18619 68822 +17920 27815 +89408 72666 +51222 92339 +33457 90190 +79548 68822 +16841 17911 +61683 77353 +58205 39848 +43788 38588 +84475 84475 +74053 10266 +11537 93796 +91987 89494 +19804 40764 +35138 83851 +88532 62479 +21972 20395 +87380 16280 +69296 83851 +78721 85856 +85819 47166 +80119 11244 +96949 13944 +10638 97010 +12213 49984 +90582 66296 +84153 69786 +52703 14947 +82734 44321 +31346 65022 +30574 56778 +48416 38908 +71402 46947 +17158 22018 +40254 82756 +24823 68567 +36467 52987 +38460 90190 +28032 71264 +90853 58391 +93193 72666 +90190 28645 +35742 90190 +64472 95923 +45785 79101 +84235 51774 +20337 21528 +71921 28645 +51844 44536 +93894 84475 +91414 15256 +23884 66296 +57314 28319 +66738 90958 +72376 78771 +59616 21810 +99956 40120 +63926 51298 +53573 25383 +83851 13307 +62052 37219 +18954 54500 +19984 67636 +60119 33810 +12147 20266 +31871 79253 +55040 90217 +23706 83367 +17851 83851 +85520 83297 +38471 40983 +64357 94963 +82719 28371 +55216 56394 +98567 47834 +58865 50989 +84116 10207 +94278 12968 +31912 32099 +14886 44568 +75820 60692 +37985 49205 +66024 31579 +40690 72376 +97296 84475 +26537 64899 +23676 72995 +19014 84475 +93618 67504 +22886 44568 +42999 43240 +97005 40764 +49168 84388 +32187 29605 +55580 35405 +47138 81256 +65134 72988 +70225 28645 +32247 41914 +77382 69857 +85910 89257 +24055 67072 +49487 11022 +70897 18278 +96846 83297 +26249 22533 +31913 72086 +13340 88560 +81511 66296 +57973 36393 +26791 89257 +41155 36393 +11531 65438 +70981 41334 +19021 60692 +19123 84569 +15215 57592 +51944 14684 +42510 72666 +14313 84475 +75686 94789 +37398 64138 +80968 49372 +13423 40764 +51784 21800 +16771 79101 +46751 29605 +32177 39427 +91885 68822 +29436 84475 +37793 40764 +18527 69857 +83464 77792 +44411 54500 +30554 29550 +55958 51807 +97160 23416 +12673 62370 +72021 65743 +86272 27177 +58595 90582 +23628 10375 +79261 72666 +34730 61458 +32101 49340 +91964 19525 +60149 92176 +96421 36393 +73535 81729 +75343 60692 +48638 28844 +33746 66296 +57163 64173 +40694 25667 +17656 12560 +25674 81321 +46631 79101 +31088 79101 +16025 15602 +90344 93010 +83502 89257 +72506 97934 +67982 92119 +53274 20232 +81581 15775 +61634 92176 +34465 76620 +39738 76121 +29929 34694 +63062 53509 +61325 19831 +95180 32789 +76828 81537 +16895 72666 +42407 31971 +38627 66296 +49392 53573 +10342 73936 +81470 19476 +79948 73681 +80798 67908 +48113 26473 +27504 66296 +63214 72376 +30224 23096 +63112 69857 +47829 66296 +32412 32329 +52231 72376 +30379 62620 +80100 29605 +74262 90582 +14634 52329 +41091 97452 +32482 31278 +44499 83851 +12050 85447 +93469 21599 +73286 38522 +88923 81268 +20527 29605 +83959 57974 +92046 83593 +67939 99783 +42239 53315 +56584 16398 +70237 21652 +50928 90582 +77632 88216 +59573 94988 +94450 36393 +43063 91467 +95915 28645 +18977 63414 +59673 96558 +73123 12635 diff --git a/2024/day01/solve.py b/2024/day01/solve.py new file mode 100644 index 0000000..e01ded4 --- /dev/null +++ b/2024/day01/solve.py @@ -0,0 +1,18 @@ +sum = 0 + +list1 = [] +list2 = [] + +with open("input") as f: + for line in f.readlines(): + nums = line.split() + list1.append(int(nums[0])) + list2.append(int(nums[1])) + +list1.sort() +list2.sort() + +for ii, num in enumerate(list1): + sum += abs(num - list2[ii]) + +print(sum) \ No newline at end of file diff --git a/2024/day01/solve2.py b/2024/day01/solve2.py new file mode 100644 index 0000000..8b00942 --- /dev/null +++ b/2024/day01/solve2.py @@ -0,0 +1,20 @@ +sum = 0 + +list1 = [] +list2 = [] + +with open("input") as f: + for line in f.readlines(): + nums = line.split() + list1.append(int(nums[0])) + list2.append(int(nums[1])) + +memoize_count = {} + +for num in list1: + if num not in memoize_count.keys(): + memoize_count[num] = list2.count(num) + + sum += memoize_count[num] * num + +print(sum) \ No newline at end of file diff --git a/2024/day02/input b/2024/day02/input new file mode 100644 index 0000000..0501d5f --- /dev/null +++ b/2024/day02/input @@ -0,0 +1,1000 @@ +24 25 28 31 28 +41 44 45 48 49 50 50 +5 8 10 13 15 16 17 21 +11 13 16 17 19 26 +79 81 78 79 82 84 +16 19 20 18 20 22 25 22 +84 87 90 92 94 97 96 96 +86 87 88 91 88 91 95 +40 43 41 44 49 +8 10 10 11 13 +91 94 95 95 92 +18 19 20 20 21 23 25 25 +15 17 19 19 23 +35 37 37 39 40 43 50 +2 5 6 10 12 +82 85 87 88 91 93 97 94 +30 32 35 38 42 43 43 +64 66 68 72 76 +73 74 77 80 84 86 91 +64 67 72 73 74 76 +72 73 75 81 82 81 +24 25 32 35 37 38 38 +59 60 62 64 65 70 74 +44 46 47 48 50 52 58 63 +54 52 53 56 57 58 +77 76 77 80 82 81 +48 45 48 49 52 54 54 +74 71 74 76 78 81 85 +20 18 19 21 27 +88 86 88 91 92 89 92 +17 16 14 17 18 15 +95 92 91 93 95 96 96 +7 5 6 9 8 11 14 18 +15 12 9 12 14 16 21 +3 2 2 5 6 +58 55 55 57 58 57 +36 35 36 36 36 +73 72 72 75 79 +80 77 78 78 79 82 87 +20 19 23 25 27 28 31 32 +92 90 91 95 97 96 +86 84 86 90 93 96 98 98 +36 33 34 38 41 45 +82 81 85 88 89 92 99 +70 69 71 77 78 81 +51 49 50 57 60 58 +28 27 30 33 35 40 40 +40 37 38 45 49 +53 52 54 55 56 61 67 +27 27 29 31 34 +82 82 84 86 89 92 89 +91 91 93 96 96 +55 55 58 60 64 +80 80 81 82 83 85 88 95 +84 84 87 84 85 +81 81 80 82 79 +25 25 22 24 24 +71 71 74 76 77 74 78 +86 86 87 86 87 88 93 +41 41 43 43 46 +70 70 70 72 71 +12 12 13 13 14 15 15 +23 23 23 26 28 31 35 +84 84 86 88 88 89 91 98 +4 4 5 7 8 9 13 14 +31 31 35 36 37 36 +19 19 23 26 26 +80 80 84 85 88 90 94 +51 51 53 54 58 60 61 66 +35 35 36 42 43 +9 9 12 15 18 24 21 +2 2 8 11 14 15 15 +25 25 30 33 36 38 39 43 +13 13 18 19 26 +10 14 15 17 19 +35 39 40 43 45 46 48 45 +41 45 47 50 50 +16 20 23 25 28 31 34 38 +10 14 15 18 20 25 +42 46 49 46 48 +25 29 32 31 34 31 +7 11 14 11 14 14 +90 94 92 94 98 +27 31 34 32 35 37 44 +50 54 54 56 59 61 63 +48 52 52 53 50 +84 88 89 90 91 91 91 +48 52 54 54 56 60 +85 89 89 91 98 +9 13 15 17 21 23 +43 47 49 52 53 57 55 +76 80 82 83 86 90 93 93 +5 9 11 15 16 20 +53 57 61 62 65 66 73 +65 69 70 73 76 81 82 83 +15 19 21 27 24 +51 55 57 63 65 65 +15 19 22 25 27 33 37 +1 5 6 7 9 11 16 22 +50 56 58 60 63 65 68 70 +36 42 43 44 41 +36 42 44 47 50 52 54 54 +79 84 87 88 90 92 94 98 +35 42 45 46 47 49 52 58 +74 80 83 80 81 82 84 85 +60 67 69 72 73 71 72 71 +85 92 94 97 96 98 98 +17 22 25 27 25 28 32 +22 28 26 28 31 33 40 +51 57 60 61 61 62 63 +7 13 16 16 19 18 +80 87 87 89 89 +70 76 79 81 84 84 88 +39 45 46 49 49 51 52 58 +38 43 45 48 52 55 57 58 +79 84 86 89 93 94 92 +39 45 48 52 52 +58 63 67 69 70 74 +76 83 86 90 97 +13 18 25 27 29 31 +60 66 69 72 75 80 82 81 +21 26 29 31 33 38 38 +31 37 42 45 46 50 +15 21 23 24 30 32 38 +51 48 45 43 44 +45 43 41 40 38 37 36 36 +66 64 61 60 57 53 +89 86 83 81 76 +36 33 30 33 30 29 28 27 +91 88 91 89 86 85 83 85 +12 10 12 11 11 +31 30 27 30 28 27 23 +35 32 31 34 32 26 +11 10 10 9 6 5 4 3 +44 41 38 38 37 35 34 36 +80 78 76 73 72 71 71 71 +45 43 40 37 37 33 +97 94 91 88 87 86 86 80 +58 56 53 51 47 44 +66 63 62 60 58 56 52 53 +73 72 71 68 65 61 61 +95 92 88 86 82 +19 17 16 12 11 10 5 +80 77 74 71 66 64 62 61 +64 62 59 56 51 52 +47 46 43 42 39 38 33 33 +45 44 41 39 34 30 +95 92 89 87 82 81 80 74 +94 96 94 91 88 +89 91 90 88 89 +40 41 38 36 36 +70 72 70 68 67 63 +22 25 24 21 19 18 13 +41 42 39 40 38 37 +35 36 35 32 31 29 32 35 +31 34 31 34 34 +88 90 89 91 90 88 85 81 +54 57 60 59 56 50 +83 85 82 82 80 +66 68 68 65 62 61 62 +35 36 36 34 32 30 30 +79 80 80 78 76 74 70 +44 45 45 43 37 +37 40 37 33 31 +63 65 63 59 56 55 54 56 +19 22 21 17 15 13 11 11 +94 95 91 90 88 84 +22 23 19 18 16 14 7 +29 32 30 23 22 +64 67 64 58 56 57 +29 30 27 24 18 18 +33 36 34 27 24 22 20 16 +50 52 49 48 46 39 37 31 +31 31 28 25 22 21 19 16 +47 47 44 43 40 37 38 +88 88 85 84 84 +41 41 38 36 32 +73 73 70 69 67 66 60 +80 80 81 80 79 77 76 75 +36 36 34 32 34 35 +59 59 57 60 59 58 56 56 +30 30 27 28 25 23 19 +9 9 7 6 5 8 3 +89 89 87 86 85 85 82 +52 52 49 46 46 47 +60 60 59 59 59 +21 21 19 19 15 +17 17 17 16 13 12 10 4 +33 33 29 28 26 25 +67 67 63 61 58 60 +27 27 25 24 20 20 +78 78 76 74 72 68 64 +62 62 59 55 49 +47 47 44 38 36 33 31 +31 31 28 21 23 +81 81 80 79 78 72 72 +75 75 69 66 62 +97 97 91 89 87 85 78 +35 31 28 27 26 25 +35 31 28 27 25 22 21 23 +37 33 32 31 28 28 +73 69 67 65 62 59 55 +67 63 60 58 53 +52 48 47 44 47 46 43 +73 69 70 68 69 +18 14 13 16 16 +91 87 84 81 82 79 77 73 +96 92 90 92 91 88 81 +40 36 35 35 34 33 31 +93 89 86 83 82 82 80 81 +86 82 79 79 78 77 77 +20 16 13 13 12 8 +30 26 23 23 21 19 17 10 +76 72 69 66 62 60 57 54 +57 53 49 46 48 +64 60 58 54 54 +20 16 15 12 8 5 1 +40 36 34 31 27 25 19 +25 21 20 18 16 14 9 6 +48 44 43 40 38 36 29 31 +96 92 90 89 83 81 80 80 +45 41 34 32 28 +35 31 28 27 21 19 14 +35 30 27 26 23 +73 66 63 61 64 +60 55 53 51 50 50 +68 62 61 60 56 +55 50 49 46 43 42 37 +29 23 22 25 22 20 18 16 +96 90 88 85 84 86 83 85 +47 41 39 36 37 37 +72 66 69 68 66 62 +52 47 49 46 43 36 +77 71 68 68 67 66 +99 94 94 93 96 +45 38 35 33 31 31 31 +23 16 13 10 10 6 +33 26 25 25 23 20 18 11 +44 37 33 30 28 27 +90 85 81 79 80 +91 85 82 79 77 73 70 70 +98 91 88 86 82 78 +68 63 61 58 54 52 45 +64 58 57 50 49 +66 59 56 49 52 +89 82 77 76 73 70 70 +80 73 72 67 63 +73 66 60 59 57 50 +11 14 15 17 20 23 21 +47 50 52 55 56 56 +16 17 18 19 20 23 27 +82 83 85 88 90 91 94 99 +59 61 59 61 64 67 70 73 +32 33 36 37 38 36 39 38 +86 89 90 91 89 92 94 94 +67 68 71 68 71 73 76 80 +28 30 31 33 34 32 39 +3 4 6 6 7 10 12 13 +61 64 64 66 69 71 68 +49 50 52 52 53 55 55 +8 11 14 16 16 20 +59 62 62 63 70 +43 45 49 52 55 57 +80 82 86 88 89 92 93 91 +81 82 86 87 88 91 94 94 +38 41 45 48 51 53 57 +35 38 40 41 45 47 54 +6 9 12 14 15 17 22 23 +81 82 83 85 91 90 +74 76 83 84 87 87 +24 27 28 35 37 41 +69 71 72 77 80 85 +12 9 12 13 15 17 20 23 +77 75 76 77 78 81 78 +60 57 59 61 61 +13 10 11 14 16 20 +81 80 81 84 85 90 +6 5 6 7 5 7 10 13 +54 51 54 52 54 55 54 +72 71 70 73 73 +89 86 88 90 91 88 90 94 +8 6 3 5 10 +10 7 8 10 12 12 15 16 +14 11 12 14 16 16 19 18 +39 37 38 38 39 42 44 44 +13 11 12 13 15 15 16 20 +10 8 8 11 14 20 +42 40 42 45 49 50 +67 66 70 73 76 78 77 +32 30 34 35 37 37 +47 44 45 49 51 55 +36 35 39 40 43 45 47 53 +68 66 67 68 73 74 +40 37 38 39 40 46 47 45 +28 26 27 30 35 35 +45 42 48 50 54 +44 43 45 48 54 59 +61 61 62 63 64 66 67 +57 57 58 61 59 +66 66 69 71 73 75 78 78 +59 59 61 64 67 71 +28 28 29 30 31 33 36 41 +41 41 42 41 44 45 +11 11 10 13 15 12 +37 37 40 38 41 41 +41 41 40 42 46 +68 68 69 72 69 71 78 +95 95 95 97 98 99 +9 9 9 10 13 14 17 16 +81 81 82 85 88 88 88 +86 86 86 89 92 96 +58 58 59 62 62 67 +80 80 81 85 87 +84 84 87 91 88 +3 3 7 10 11 12 12 +74 74 75 79 81 82 85 89 +26 26 28 29 31 35 37 44 +38 38 39 46 49 +77 77 80 81 87 88 85 +75 75 78 81 87 90 92 92 +28 28 31 37 40 43 47 +11 11 12 18 20 27 +15 19 21 22 23 26 +58 62 64 65 66 69 71 69 +56 60 61 63 63 +46 50 53 56 58 62 +67 71 73 76 81 +52 56 58 56 58 60 +6 10 11 8 7 +81 85 86 89 87 88 88 +72 76 79 76 79 82 86 +39 43 44 46 43 49 +38 42 45 45 46 +41 45 48 51 51 48 +79 83 86 86 86 +24 28 29 31 33 33 34 38 +55 59 59 61 62 65 67 74 +73 77 80 82 86 87 90 +45 49 50 53 57 54 +80 84 88 90 92 92 +14 18 20 22 24 28 32 +61 65 69 70 73 76 82 +50 54 57 59 62 63 69 70 +75 79 81 82 83 89 92 89 +45 49 52 59 61 63 63 +38 42 44 45 48 55 57 61 +62 66 69 71 74 80 86 +28 35 37 40 41 43 +25 30 32 33 34 37 35 +14 19 20 21 22 22 +8 14 17 20 23 27 +23 28 29 31 38 +68 74 77 78 76 79 80 +14 21 18 20 22 23 25 22 +18 23 20 22 22 +65 72 71 74 76 80 +8 14 15 17 14 17 20 25 +59 65 68 70 70 73 +59 65 68 68 71 74 71 +34 41 43 43 43 +20 25 25 28 32 +43 48 50 50 53 56 58 64 +38 45 49 52 55 58 +23 30 34 35 33 +4 9 11 14 18 20 21 21 +51 57 61 63 67 +67 74 78 81 82 88 +20 26 29 36 37 +9 14 15 18 20 26 29 28 +73 79 82 87 90 90 +9 16 18 24 28 +8 14 19 22 29 +80 77 75 73 76 +93 90 88 85 84 81 78 78 +25 22 20 18 15 12 11 7 +51 48 47 44 42 40 37 31 +77 74 77 75 73 72 +94 91 92 90 88 89 +28 27 26 24 21 22 20 20 +94 91 88 87 86 89 85 +91 90 87 85 82 80 81 74 +59 56 56 54 52 50 +89 88 88 87 84 82 85 +96 95 93 90 89 86 86 86 +25 22 22 19 15 +39 36 34 34 33 31 24 +53 52 49 47 43 40 +93 92 88 85 87 +82 80 76 75 72 69 66 66 +57 55 52 49 47 43 39 +43 40 36 33 26 +33 30 28 21 18 +72 70 67 66 59 61 +26 23 22 19 14 12 10 10 +25 22 20 18 13 10 9 5 +33 30 27 21 19 16 13 6 +96 98 97 95 93 90 89 +47 48 46 45 47 +10 12 9 8 7 5 3 3 +48 49 48 47 43 +25 28 26 25 22 15 +2 4 1 4 3 +59 62 65 64 65 +24 25 22 19 20 17 17 +53 54 52 54 51 48 46 42 +21 23 21 18 19 18 12 +48 49 46 46 43 41 40 +58 61 59 57 57 59 +84 85 83 80 79 78 78 78 +20 22 22 19 17 15 11 +87 89 87 86 86 81 +97 99 95 94 91 +15 18 16 15 11 13 +54 55 53 49 49 +28 30 26 25 23 21 17 +34 37 34 32 28 21 +33 36 33 31 28 21 18 15 +66 69 68 63 61 58 55 58 +93 94 93 87 85 85 +17 18 13 12 8 +81 83 80 78 71 68 63 +68 68 66 65 63 +65 65 62 61 58 57 60 +28 28 26 23 23 +48 48 46 45 44 43 39 +16 16 13 11 6 +30 30 29 26 29 28 +23 23 20 22 20 17 20 +41 41 43 41 41 +39 39 36 39 36 32 +34 34 36 35 30 +88 88 87 85 85 84 +6 6 4 3 3 5 +41 41 38 38 38 +14 14 11 8 8 7 5 1 +75 75 72 72 70 64 +59 59 55 52 51 +91 91 88 84 81 79 80 +95 95 92 88 85 85 +62 62 60 59 55 51 +17 17 13 11 4 +67 67 66 65 63 58 56 +63 63 56 55 57 +46 46 45 39 39 +42 42 39 38 32 28 +91 91 86 84 78 +30 26 24 22 21 20 19 +58 54 53 50 53 +10 6 5 4 4 +93 89 88 86 85 83 81 77 +52 48 46 43 38 +89 85 84 81 83 82 79 +46 42 41 39 42 44 +48 44 41 44 43 42 39 39 +61 57 56 53 54 51 47 +55 51 54 52 50 43 +23 19 16 16 15 13 11 8 +23 19 17 16 14 14 13 14 +23 19 19 17 14 11 9 9 +24 20 19 16 14 14 10 +94 90 88 85 85 84 77 +47 43 41 39 36 32 30 +54 50 46 45 42 43 +88 84 81 77 77 +29 25 21 20 18 15 12 8 +67 63 59 58 51 +16 12 6 3 1 +68 64 61 59 53 51 50 53 +70 66 60 58 58 +84 80 75 73 70 66 +92 88 86 85 78 77 71 +93 86 83 82 79 77 74 73 +56 50 48 46 48 +25 20 19 16 13 13 +79 74 73 72 70 69 67 63 +77 71 70 67 64 62 56 +80 74 71 68 67 69 68 65 +36 29 27 26 28 31 +88 82 83 82 82 +13 6 5 7 3 +17 11 12 9 6 1 +87 82 81 80 80 78 75 +23 17 14 11 11 12 +70 64 61 58 58 58 +96 91 90 87 87 85 81 +92 85 85 83 80 74 +23 17 13 12 11 +70 63 59 56 55 53 54 +85 80 79 76 73 70 66 66 +81 75 74 73 72 68 64 +69 62 59 55 54 49 +68 62 60 58 52 49 +81 75 74 71 69 64 66 +71 65 58 55 55 +39 32 31 26 24 22 19 15 +53 47 42 40 33 +39 40 43 44 46 48 55 61 +41 37 35 31 29 25 +33 28 26 23 23 24 +53 49 48 45 43 39 +45 45 46 47 49 49 50 57 +55 52 51 50 47 46 46 42 +43 40 39 33 27 +31 37 42 44 46 46 +38 36 34 33 30 29 27 30 +25 31 33 35 32 38 +74 74 80 82 83 87 +34 40 40 41 44 45 50 +75 68 66 63 61 +72 69 67 64 61 54 54 +23 27 27 29 34 +53 57 58 60 60 +47 40 35 34 35 +28 24 22 20 18 16 16 +55 58 56 52 52 +9 9 11 14 15 12 16 +38 33 29 27 26 21 +19 18 19 19 20 24 +59 59 55 54 53 52 46 +9 13 16 18 20 21 22 26 +36 32 25 24 21 15 +40 41 44 45 47 46 49 53 +2 4 7 7 9 11 18 +16 21 20 22 23 25 +90 84 82 79 75 72 68 +74 74 78 79 81 81 +59 61 64 63 61 59 52 +76 76 75 68 67 64 65 +85 85 85 86 85 +34 37 35 32 29 25 24 +86 84 84 83 80 77 75 68 +15 16 20 21 23 26 29 +65 71 75 76 73 +95 95 94 91 88 90 +81 87 88 91 94 96 97 97 +4 8 11 13 14 12 15 +34 40 42 44 47 45 43 +34 36 38 41 48 51 55 +44 46 44 44 41 40 38 38 +95 98 97 96 93 93 +54 53 50 48 44 38 +25 25 23 20 17 15 11 +82 82 81 81 81 +52 56 58 62 64 68 +39 39 36 35 34 +83 86 88 85 87 +46 39 41 40 34 +18 24 27 34 37 +34 30 28 26 24 23 24 +65 67 70 72 74 77 76 +18 23 24 27 34 36 37 36 +10 10 11 14 16 21 +2 6 9 12 13 13 15 14 +46 51 52 56 57 59 63 +69 75 80 81 85 +60 61 64 61 58 57 60 +84 87 86 80 79 79 +76 73 75 73 73 +72 66 65 62 65 63 60 +10 14 16 17 18 25 27 31 +15 16 17 17 18 +94 94 91 86 82 +39 46 47 49 52 56 58 +1 1 2 2 2 +3 7 8 10 17 20 20 +26 26 24 19 17 14 12 +43 43 42 44 42 37 +62 62 59 60 59 58 55 55 +19 23 27 28 30 36 +41 44 42 44 41 41 +12 10 10 12 13 15 17 22 +52 53 54 55 62 65 67 67 +21 22 21 20 20 19 16 17 +50 46 45 43 41 40 40 40 +69 70 74 77 77 +83 87 89 89 90 94 +14 11 9 11 15 +86 83 84 88 89 92 93 97 +47 44 44 47 47 +83 87 89 89 92 +65 61 57 55 57 +65 69 71 75 78 81 81 +72 72 73 80 81 84 82 +31 28 30 34 35 36 39 41 +94 89 83 82 81 80 79 +55 55 52 48 45 45 +64 66 64 61 59 54 50 +7 6 11 14 17 21 +83 79 75 73 72 71 70 70 +37 36 36 33 31 29 28 31 +92 94 93 92 91 86 +71 70 69 68 63 +80 83 82 83 82 79 77 +51 55 57 61 58 +53 50 47 46 42 42 +89 89 90 96 99 +34 33 36 39 40 44 42 +77 73 69 68 66 +10 10 13 14 16 13 +76 77 74 74 69 +91 92 93 95 96 99 99 99 +17 15 11 10 9 6 5 +47 47 44 41 39 40 41 +21 25 28 30 28 35 +52 55 52 48 49 +44 44 42 45 43 39 +36 36 37 41 42 44 46 44 +43 43 40 40 37 40 +19 22 19 15 10 +61 62 59 56 55 51 +31 37 38 41 45 45 +1 5 8 9 10 15 +42 38 40 38 37 30 +60 61 59 57 55 +36 34 36 33 30 +38 40 41 42 40 42 44 43 +58 55 53 52 51 49 46 42 +91 88 91 89 88 89 +53 53 51 50 50 +89 91 92 95 92 99 +18 13 15 13 11 11 +64 65 66 68 69 70 +71 74 77 80 83 84 86 +40 42 45 48 51 52 54 57 +29 31 32 34 37 39 42 +13 14 15 18 19 22 25 27 +20 18 16 13 12 +21 19 16 13 12 10 7 +88 91 94 95 97 +25 22 21 18 15 13 +55 53 51 48 45 42 40 38 +63 62 61 58 55 52 50 48 +61 58 56 55 54 52 49 +59 60 62 65 67 69 +68 69 72 74 76 77 +73 70 68 65 63 61 +88 89 92 95 96 +37 36 34 33 30 +50 51 52 55 56 59 62 63 +67 70 71 73 76 78 +90 92 93 95 96 +41 42 43 45 46 +60 59 56 54 52 50 47 +39 38 36 35 32 31 28 27 +14 17 19 20 21 24 25 +60 58 56 55 53 51 +11 10 7 6 5 +10 11 14 15 17 19 +14 11 8 5 4 3 +64 62 61 58 55 52 51 +17 14 13 12 11 10 7 +72 70 69 68 66 64 61 +74 77 80 82 85 86 88 89 +26 29 32 35 36 38 +62 60 59 57 56 53 50 +26 25 23 22 20 19 16 13 +7 10 13 16 17 20 21 +71 70 69 67 65 62 61 +11 13 14 15 18 21 +22 20 17 14 11 9 6 5 +3 4 6 8 11 12 14 15 +2 4 6 9 12 +81 84 86 88 91 94 97 98 +32 33 36 37 38 41 +78 77 76 74 73 +71 72 74 76 78 +44 45 48 49 51 53 54 +78 75 74 73 70 69 66 64 +75 74 71 69 66 63 +84 82 79 78 75 74 71 69 +62 61 58 56 54 52 51 48 +98 95 92 89 88 87 85 +3 5 7 9 10 12 14 +89 87 85 83 82 +80 79 77 75 73 71 68 +61 62 64 66 69 72 74 76 +51 49 46 44 43 40 39 38 +70 67 64 63 62 +35 34 33 31 29 27 24 23 +42 44 47 50 51 52 +52 55 58 59 62 64 65 +67 69 72 74 77 80 +14 12 11 9 8 +53 51 48 45 43 +57 58 60 63 65 68 70 +30 32 35 36 38 41 43 +99 97 96 94 91 89 88 +68 65 63 61 59 57 56 +92 90 88 86 85 +44 46 47 49 52 +49 52 53 54 56 57 59 +28 27 25 22 21 20 17 16 +48 46 43 41 40 +79 80 82 85 87 88 89 +58 56 54 53 52 51 49 47 +54 57 60 61 62 64 65 +40 39 38 36 35 33 +32 30 29 27 24 23 22 +17 14 11 9 7 5 +91 89 88 87 86 83 +19 16 14 11 9 8 +40 41 42 45 46 49 51 52 +86 84 81 80 77 74 71 68 +42 41 39 37 36 34 +36 33 32 29 26 23 20 +24 21 20 17 16 +12 9 8 5 4 +76 79 82 85 88 91 92 +64 66 69 72 75 +35 37 38 41 44 46 49 51 +94 92 89 87 86 85 +66 68 71 74 76 +81 80 79 77 75 74 72 71 +83 86 89 92 94 +43 40 37 34 31 +36 37 38 41 43 +31 28 25 23 20 18 +45 44 42 41 38 36 +86 85 84 82 80 77 74 +58 57 55 54 53 50 49 47 +70 71 73 75 78 +73 76 79 80 82 +85 83 81 78 75 72 +37 38 39 42 45 48 50 +64 67 68 71 72 +66 63 61 58 56 +61 64 65 67 68 69 72 74 +95 94 91 90 89 87 85 84 +84 87 89 91 94 +63 65 68 71 72 73 +40 39 38 37 35 34 32 +88 87 86 83 82 81 80 +71 70 68 65 63 62 +92 90 88 85 82 81 80 +76 74 71 68 65 64 +9 11 12 14 17 +74 75 77 78 80 82 +30 33 36 38 39 42 44 45 +59 62 63 65 67 69 +83 86 88 91 94 95 +29 28 26 23 21 +70 71 74 77 78 80 82 +70 72 74 75 76 +6 9 12 15 18 21 24 25 +32 31 29 26 23 22 +76 75 74 72 70 68 +93 92 91 90 89 +56 58 59 60 63 64 +72 73 74 76 78 80 83 85 +96 95 92 89 86 84 +98 95 94 93 90 +27 29 31 33 36 37 39 40 +48 47 44 41 39 38 37 36 +20 19 16 14 13 +98 97 96 95 92 +71 72 74 75 78 80 +49 51 53 55 57 +63 60 59 56 53 +78 80 82 83 84 +80 79 77 75 73 71 69 66 +24 25 27 30 33 34 36 +81 82 84 86 89 +35 36 39 42 43 44 46 +14 15 16 18 21 23 25 28 +83 84 86 89 92 93 +82 81 78 76 73 +19 21 24 27 28 30 32 +61 60 58 56 53 +7 8 10 12 14 +69 67 66 64 61 59 +29 28 25 23 21 +44 46 49 52 54 55 57 60 +6 7 9 10 12 14 15 +27 25 22 19 18 17 14 +50 52 54 56 59 60 63 65 +40 39 36 33 32 +10 11 12 14 16 +30 27 26 24 23 21 19 18 +24 22 20 19 18 16 14 +89 91 93 95 97 98 99 +60 57 54 53 51 48 47 +1 3 6 7 8 10 13 +14 13 11 10 8 +57 55 53 51 50 +48 46 45 42 40 39 36 35 +42 43 45 47 50 +92 90 88 86 85 82 +94 91 90 88 87 85 84 82 +45 46 48 50 53 +24 21 20 17 14 11 9 7 +65 64 62 60 59 56 55 53 +54 51 50 48 47 44 43 +49 47 45 42 39 38 37 34 +37 34 32 30 27 26 25 +87 88 91 92 94 97 +86 84 81 79 76 73 71 70 +59 60 63 64 65 +39 42 43 44 46 +14 16 17 18 21 23 24 27 +5 6 7 9 12 14 16 19 +64 65 67 70 73 +90 89 88 85 84 81 78 +83 85 88 90 92 93 96 97 +83 81 79 76 74 73 +68 71 74 77 78 80 83 86 +41 40 38 35 34 +34 31 28 27 24 +87 88 90 92 93 94 96 +52 55 56 57 60 62 +17 20 23 24 25 27 +30 28 27 24 21 18 15 12 +28 27 26 25 22 19 +72 69 68 67 66 64 +59 56 55 54 52 49 47 45 +26 28 31 32 35 36 38 +52 49 46 45 42 41 39 +9 10 11 12 14 15 17 +35 36 37 39 40 42 44 47 +59 58 55 54 53 52 +11 10 9 8 6 4 3 +18 20 22 23 24 27 +10 8 7 6 5 4 3 +68 71 72 74 76 77 +64 63 62 59 56 54 51 +37 36 35 33 31 28 +98 97 96 95 93 92 90 87 +18 19 21 24 27 +23 24 26 29 30 33 36 39 +52 51 49 47 46 45 42 41 +50 48 47 44 43 +40 43 46 49 52 54 55 58 +45 43 40 37 35 33 31 29 +35 33 30 27 24 23 20 18 +82 83 84 86 88 +19 16 13 10 9 +37 34 33 32 29 +86 83 80 77 76 +77 78 79 81 84 87 88 90 +13 15 18 21 22 25 27 +6 7 9 11 13 14 17 18 +51 50 48 47 46 44 41 40 +79 80 82 83 85 +74 72 69 67 65 63 62 59 +58 57 55 53 50 +54 57 60 62 64 65 68 +28 30 32 34 37 38 +10 13 15 18 20 22 24 27 +80 79 77 74 73 71 70 +21 20 18 15 13 11 9 +21 23 26 29 31 33 35 +74 75 76 78 81 83 +61 58 56 55 54 53 51 50 +54 55 56 57 60 62 64 65 +45 43 42 41 38 37 35 34 +47 50 53 56 57 59 +98 95 94 93 92 90 +13 12 9 7 6 4 2 +68 70 73 76 79 80 81 84 +59 62 65 68 69 72 75 +80 82 84 87 89 92 95 +63 65 68 70 71 72 73 76 +92 90 87 86 85 82 80 77 +20 18 15 13 11 9 7 +60 59 58 55 54 51 48 47 +18 16 15 13 11 9 +71 68 65 62 61 59 57 +69 68 65 62 60 57 56 +75 74 73 72 70 67 65 62 +17 20 22 25 28 31 +43 45 46 48 50 51 +28 25 22 21 19 17 15 +36 33 30 29 27 24 22 21 +13 14 15 18 20 23 +84 82 81 78 77 76 75 +23 26 27 30 33 +56 53 50 47 46 +25 27 28 30 31 32 34 37 +90 92 94 95 96 99 +82 83 85 88 90 92 95 +49 46 45 43 42 40 +55 58 61 63 65 68 69 72 +61 62 65 66 68 69 +49 52 54 55 56 58 59 61 +41 43 44 46 49 +74 71 70 68 65 62 61 58 +26 29 30 31 32 35 38 40 +11 12 14 15 18 21 +79 76 74 72 71 68 66 +17 20 23 25 27 30 33 35 +52 53 55 58 60 +6 7 9 11 12 +88 85 84 83 81 79 77 +71 74 76 77 79 +70 72 75 78 79 +54 56 58 59 62 +97 96 94 91 90 +6 9 10 11 14 17 20 22 +23 21 18 15 14 +99 98 96 94 91 88 87 +96 93 92 90 89 88 +91 89 88 85 84 82 80 77 +86 87 88 91 94 +3 4 7 10 11 12 +56 59 61 64 67 +40 41 44 46 48 49 52 53 +35 34 32 31 30 27 24 22 +48 47 44 43 42 40 38 36 +31 29 26 23 20 19 16 +25 27 28 29 30 32 +4 7 10 13 15 +36 39 40 42 43 45 48 +20 23 25 27 28 31 34 +40 42 45 48 49 52 54 +14 12 10 9 7 4 2 1 +76 74 71 68 66 64 +25 27 29 30 31 +34 31 29 28 25 24 22 +63 64 67 70 72 73 +95 93 90 89 87 85 +29 27 25 22 20 18 +28 30 32 33 34 37 +53 52 49 46 43 42 +41 40 38 36 33 31 30 +81 79 77 75 74 73 +97 96 95 94 93 90 +77 79 81 82 83 +67 64 62 59 56 54 +55 54 52 50 48 46 45 +74 73 70 69 67 +90 88 85 82 80 +16 14 13 12 11 +32 31 29 26 24 23 +17 18 21 24 27 +21 18 16 14 11 9 6 +37 39 41 42 45 47 +6 8 9 11 13 +35 34 32 30 28 27 25 23 +80 78 77 75 73 71 +4 5 6 9 12 15 +48 51 52 53 55 56 57 +31 33 34 35 37 38 40 42 +75 77 78 80 83 86 87 +39 40 43 46 49 51 +70 71 72 74 75 77 79 +95 92 89 87 85 84 82 +5 7 10 12 14 17 18 20 +68 67 66 65 62 +61 63 64 66 68 69 70 73 +61 59 57 55 53 51 +38 36 33 32 31 30 29 +83 82 79 76 75 74 72 69 +17 20 22 23 26 28 +81 83 86 87 90 93 94 +85 82 81 79 77 +7 10 11 12 13 +94 93 90 87 84 82 +63 64 66 69 70 71 73 +35 36 37 39 42 45 +48 47 45 44 41 +93 92 91 89 88 86 +47 50 52 54 55 +33 35 38 40 43 46 48 49 +70 73 76 77 80 +96 95 92 91 88 87 84 83 +14 17 20 21 22 23 25 28 +14 15 16 17 18 20 21 +72 71 70 68 65 63 60 59 +57 60 61 64 67 68 +18 17 16 13 10 +49 47 44 42 40 38 +30 32 34 37 38 +70 69 68 65 63 62 61 +37 40 43 44 47 48 +55 54 53 52 50 47 45 +90 88 86 85 83 81 80 +90 88 85 83 80 +38 40 43 45 46 +64 67 70 73 75 +91 93 95 98 99 +18 15 12 9 8 6 4 1 +80 77 75 73 70 67 64 62 +29 26 24 21 19 16 15 +61 63 64 67 69 72 +60 59 57 54 53 +63 61 59 57 56 54 53 +49 50 52 53 54 +57 59 60 63 66 +61 63 64 65 66 67 69 70 +24 21 19 18 16 14 +42 39 36 35 34 33 +95 94 92 91 89 86 83 +72 75 77 78 81 83 86 +4 5 6 8 9 12 14 +20 22 25 28 30 33 +65 68 70 71 73 74 +1 3 4 6 9 11 12 15 +75 77 79 81 83 85 +21 22 25 28 29 31 34 +8 7 4 3 2 +39 37 34 31 28 \ No newline at end of file diff --git a/2024/day02/input_test b/2024/day02/input_test new file mode 100644 index 0000000..2d6faf5 --- /dev/null +++ b/2024/day02/input_test @@ -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 \ No newline at end of file diff --git a/2024/day02/solve.py b/2024/day02/solve.py new file mode 100644 index 0000000..3ec9967 --- /dev/null +++ b/2024/day02/solve.py @@ -0,0 +1,31 @@ +safe = unsafe = 0 + + +def is_safe(report: str) -> bool: + last_num = 0 + increase = True + for ii, num in enumerate((int(elem) for elem in report.split())): + if ii != 0: + if ii == 1: + increase = num > last_num + + if (num > last_num) != increase: + return False + + diff = abs(num - last_num) + if diff < 1 or diff > 3: + return False + + last_num = num + + return True + + +with open("input") as f: + for report in f.readlines(): + if is_safe(report): + safe += 1 + else: + unsafe += 1 + +print(f"safe: {safe}\nunsafe: {unsafe}") diff --git a/2024/day02/solve2.py b/2024/day02/solve2.py new file mode 100644 index 0000000..8e2f8e7 --- /dev/null +++ b/2024/day02/solve2.py @@ -0,0 +1,42 @@ +from typing import Generator + +safe = unsafe = 0 + + +def is_safe_with_dampening(report: str) -> bool: + numbers = [int(elem) for elem in report.split()] + for ii in range(len(numbers)): + if is_safe((elem for idx, elem in enumerate(numbers) if idx != ii)): + return True + + return False + + +def is_safe(numbers: Generator[int, None, None]) -> bool: + last_num = 0 + increase = True + for ii, num in enumerate(numbers): + if ii != 0: + if ii == 1: + increase = num > last_num + + if (num > last_num) != increase: + return False + + diff = abs(num - last_num) + if diff < 1 or diff > 3: + return False + + last_num = num + + return True + + +with open("input") as f: + for report in f.readlines(): + if is_safe_with_dampening(report): + safe += 1 + else: + unsafe += 1 + +print(f"safe: {safe}\nunsafe: {unsafe}") \ No newline at end of file diff --git a/2024/day03/input b/2024/day03/input new file mode 100644 index 0000000..64eaed9 --- /dev/null +++ b/2024/day03/input @@ -0,0 +1,6 @@ +from()$&mul(602,165)why()mul(305,64)?(where()-:mul(80,703);)why()*from()%select()mul(290,957)}/?%'from()]mul(851,335)mul(844,49)what()]![from(667,522)]}how()how()mul(938,695)#/)*?@~?@select()mul(706,392)^mul(242,513)who()@]mul(871,132)( ] from()$mul(41,656)^{(&how()from()[when()-when()mul(628,478)mul(287,621)why():'mul(127,825)# ]mul(360,578)select()?^^select() @:why()mul(136,849);{how()%*@%+how()[mul(544,891)mul(436,21)from()}mul(184,294)+/from(81,871) how()&?]mul(297,492)select()/}%;$$~{*mul(161,703)when():+(,mul(335,695) ()&where()?who();'mul(689,420)^how()from()how()what()>]where()don't()}%mul(78,176)~$where():@,>%mul(62,695)@{#how()mul(742,538)who(){$$who()@{+(mul(282,209)%mul(428,514)/+from()}>@mul(665,815),mul(762,48)[+/mul(591,445)~?who()#mul(36,3)select()~$ [<}*/do()''>~'$mul(109,905)}how(){!@where()%/mul(380,929)*){~:where()mul(547,552)$:*mul(58,881)where(145,89)[why(634,213)mul(699,443)mul(826,660)what()from()-how()}'from()what()<;mul(700,665)] #(*?how()<+mul(507,719))~*/-^(%mul(941,551)$;don't()#;:when()+#>mul(87,663)who()/how()mul(332,238)~mul(290,235)',why()mul(950,204);where(),(when()mul(233,633)-^}@who()^mul(289,147)$>-'$select(736,261)*~]mul(899,836)'why()do()@when()why()from()mul(975,883);select()who()mul(165,847)why();^/{^mul(31,153)?;'don't()( from()+})what()mul(262,509)!*where()}/-#~/mul(308,953);*!]mul(741,76)[mul(256,536)[)>%-who()<^[$mul(382,338)where()[ when():select()<>mul(993,630)@$mul(411,640)/+where(623,926)/~mul(807,676)+*],mul(579,979who()what()from()when()how()what(),mul(882,434)&who()'mul(154,824)from()#<<,,{where()$mul(259,438)from()}?:;mul(641,967?from())<,>~mul(325,912)%select()mul where()do()where()where();(!,[$why()mul(131,307)mul(323,794)mul(570,548+!$from()!}what(588,195)-from()mul(319,524)!/why()mul(737,137)+^&]/mul(228,919)@mul(672,604)+when(773,127)select()+why(941,245)mul(121!<[?$?;from(987,370):mul(904,487)#^what()from()({?mul(791,791)!,::)@^(mul(517,686)what()*how(),why()&mul(218,978)#,who()&$who()how(205,211)where()[mul(70,357)^$[?^$^what()mul(245,237)where()why()?{/mul$when()+},why()mul(264,30)@*:when(628,215):+&why()[mul(346,794){:}~-,select(),mul(115,926)~mul(140,56)[/:#~don't()@:mul(889,788);;*!<$[when(),%mul(177,883)[mul(815,344)when()@$+ @)where(935,128)}{mul(638,520)why()-] when()] mul(639,171)!>[mulwho()~^:what()why()] mul(560,354)from()where()/];,how()} mul(980,896) +>/;%who()&where(504,464);!do(),where()/mul(901,274)!when()mul(76,577)>select()mul(257,297)^+(/what(52,6)@%from()who()mul(331,276),what()when())+]{:&mul(653,163)''; '~mul(946,195)+/[from()mul(345,866)mul(975,684)#-:/why();-<:&mul(416,406)where(864,494)}{mul(343,101where()~ $/!where(331,467)who()@:mul(484,862)' mul(629,780)&%why(436,493)what()$mul(104,102)$,where()mul(2,157)who()%mul(404,895)mul(154,983)):]]%#:do()]from()+/#)/mul(682,696)what(518,168)select()where()+when(518,618)mul(799,756)+}why()}:mul(565,289);mul(687,685);@%!>?why()&;-mul(819,190)}]mul(596,898)mul(113,184)who();{@do()@?)why(),*/select()[mul(351,147):{+}}~^from()why()mul(350,104$''(from()$!when()mul(574,321)-mul(325,17);<& who(){]mul(960,765)^from())<<$:how()mul(412,562);mul(220,976)*mul(338,463),$/#',from();select()*mul(982,199)&^:&mul(607,915)who()mul(473,531)$mul(490,191)select()&-~+>when()mul(105where()'/!do()<;[#why()mul(453,793)&*,^who()who()what()-@why()from(642,548)%^(from()+don't()?-mul(976,65)what();]mul(155,153))where()who()when()[]mul(44,452)}mul(51,177)~$[mul(462,949)$}^select()#[)]mul(743,555)?[mul(750,557)}#{from()%(why()where()mul(807,786)+})>{)what()}do()mul(231 (how()*mul(667,833)when()~from()why(),who()(;)mul(729,999)mul(805,756)when()}what()who()!**who()]mul(920,392*]when(26,462)mul(558,874)!~?+$$';mul(694,195)when()/$?from()mul(198,978)%>;/why()who()}+why()@mul(248,980)$ how()>'select();mul(888,351)mul(476,169)[>@-mul(282,926)#why()mul(637,563)-'~@!how()'^what()$mul(303,12)]how()~mul(922,806)^+when()[?don't(){,when()!*select()select(828,14)who()'why()mul(237,256)#mul(603,548)mul(887,362)!>%/how()[,%]don't()&mul(499,574)select()}%how() mul(787,625)what()who()) '*,mul(197,610)?!~('where()%'select()how()mul(840,759)} {$mul(19,916)}/mul(965[)) *who()how()~from()who()how()mul(319,356),where(196,245) who()mulwhat())^when(211,851)select()do()-$>+}'?from();>mul(349,592)&;>mul(473,196)where()~mul(939,515)$?{;^{}what()mul(417,24){??where(390,662)~from(),mul(93,289) when()] #from()$mul(543,426)&;&*;why()where()mulfrom(){-?'>,;who()mul(65,960):!how()*}*mul(544,316)%what(585,366)how():>mul(453,85)&[-from()/-#?how(829,900)why(){mul(544,588)mul(178,94)from()where()mul(84,939)+^]who()]select()(&mul(951,416)how()[-] mul(324,907)who(){< )mul-select()![@&mul(578,700)mul>@~]%){mul(543,266)#how()!*why()$@%don't()>$what()mul(451,107)/mul(307,230)+@$when()from()?['mul(822,895)$mul(530,529)+mul(792,795]$from()what(158,547){what()mul(851,381)?when(649,20),*mul(73,793)<] :(:@+;mul(93,749)from()];'mul(419,25);:!who()-mul(102,426)'why()+from();mul(186,663) +select()$how()]%]{~mul(183,456)::,+;![when()>mul(513,696)mul(835,886) from()##* select()%{mul(820,742)don't()why()mul(295,615)^]what()how()-what()*who()why(931,57)when()mul(688,219)!@mul(191,470)how()>?from()from(764,712):where(){:mul(951,673)!mul(536,960)[>?':]mul(353,508)!*how(977,514){)'mul(135,970)}>%select()select()::where()mul(580,976)'^when()mul(144,491)what()%&]mul(360,420(who()how() :@mul(925,707)mul(723,986){mul(465,348) mul(153,323)#~when();from()@}-;] how()[^ :what()mul(990,144)}mul(567,848)select();@where()'(^@mul(620,639))how(711,187)how()select()+?)+^don't()mul(776who()$mul(592,515)what(),who(),mul(870,763)where():when()^>{}mul(503,440)mul(524,563)why(112,173)how()(,[;mul(235,893)how()*?/]mul(524,355%/],^]*^!%where()mul(464,297)select()from()who()};%what();{mul(289,689)#who()[&[mul(604,447)select()~#<;(~^mul(807,738)[~/from()mul(477,588) ^-]-mul(820,399)@-when()>%mul(580,918)mul(401why()*;],why()]]+!mul(343,445)*<+why()$mul(830~@who(),;from()#mul(776,674)?$who(){+mul(295,290){where()when()mul(321,389)&{'@$}who()mul(879,995)*{from()/(;)mul(569,107)mul(223,576)~~>*@when()]]mul(624,981)?{^'$>(mul(812,37)what()-?:>&{+mul(731 < %-who()select()mul(656,82)how()'from()mul(446,744)'<;~why()}^:,]mul(461,437)when(245,888);$[%when(896,829)who()>{mul(791,568),-%$! ?#*mul(134,101),~<-'}how(672,596)?/mul(641,129) :from()#?mul(414 )]-%from(),@)(mul(53,315):@& ,who()where(734,227)^mul(271,699)from()>how():when(595,247)'}%',mul(730,933)from()',]why()+ how()where()mul(231,37)~<+&[$:}!:mulwhen(572,105)}who()mul(374,347)/-why()*what()how()#!@}mul(230,754)-what()-:mul(759,756)select() $what()]^select()#how()?mul(567,572)mul(757,309)'[mul(530when()+/(*{mul(736,155)+*where(960,885)%: {:mul(713,672)!$*{#%mul(17,60)&what(966,667)what()why(): select(428,568)*!&mul(228,28)where()where()@/])do()}!/{^?{[why()mul(218,633)mul(156,644)>{~^[?mul(377,886) where()%who(159,149));how(909,452)-mul(869,404)>:mul(920,501){what())+how()mul(545,793)~-mul(74,347)where()!-;how()when()>)%mul(647,960})>;&why()mul(767,582)~^+;who()<)<)mul(494,399/;-from()^don't()why()mul(215,704)%%from()mul(392,808)-who()+where()[{-*/mul(869,412)from()mul(501,148)?'don't()from():}select()mul(796,221)select()mul<)@ ,when()}[:[what(96,456)mul(651,592)when()';$ (*why()mul(134,209);select())[mul(434,869)@{+'$mul(292,419)mul(175,874),from()select()$?[{^mul(866,742) +how()?}% #who()']#!/usr/bin/perlmul(875,840);]:::mul(127,915)>^>select(736,608)why()+ mul(13,855) ++ how()>mul(568,520)<)'mul(332,245)::where()@&mul(625,889):who()^}+who()mul(392,15)*how()mul(437,461)select()]+how()$(!mul(219,47)^mul(518,535)(select()#mul(776,790)who()^how()~)where()mul(622,336)why(171,784)>];@who()where()mul(255,591) >when()what()-,)&(mul(827,655):)(*mul(457,68)]what()^[&[mul(758'/select()mul(351,283)<{&{*%,mul(345,900)&when()<;[:[(when()select()^(^@mul(904,504){{from()(&mul mul(537,360)why()/{)what())mul(812,420){!mul(320,4)who(275,101)who()}^who()^why(562,771)%;-don't()<}}]mul(943,216):{)mul(17,572)&$why()where()mul(86,371)from()$$ +,>,mul(793,733)^?how()&?{;mul(174,855)(#/ what()select()where()[*mul(706,247)who()~why()/#;*mul(459,541) where()}mul(586?(mul(470,802)who(773,148){what()?/why(397,830)),where()from()mul(532,611){[select())}why()when()mul(855,381))@?-/) (do()who()mul(4?*select()$select()where()!!mul(758,795)/*:mul(221,874)mul(587,201)~{?{;/why()mul(757,730)'$-$how();do()why(423,32)}%!*from(930,638)mul(196,228)%mul(753,37)'mul(970,912)[what();~mul(643,558)(where())how()mul(525,660)when()}$#) +mul(770,997)mul(523,352)/%when()mul(139,306)/(mul(435,619)who()$;)mul(353,463)/how()$who()#what()!where()select()mul(218,409)'$:what()^don't()#when()from() &}>where()?mul(41,95)%mul(93,123)mul(615,917)how()^#mul>!@~how()>mul(801,12)select()what(76,678)from()$#}>mul(206,424)/;~select()what()who()%:/mul(920,696)'^+mul(467,893how()mul(732,924)when()*{mul(212,801)select()}$mul(253,942)from(245,298)$%select():mul(200,773)(what() ,mul(484,816%[@:what()$#mul(392,392)select()/mul(603,982){?'}{%mul(767,605)(*select(839,960)from()%,[-{%mul(810,348)<)}:$why()-mul(568,717$/*!*:#<<mul(519,560)mul(371,303)#mul(444,873)/#;~! mul(825,442) +;'?,&@@mul(687,295)mul(992,56)from()@$:when();mul(839{*;~mul(577,183)@-where()}why()~@^from()mul(226,901)how() >%when()?[~mul(281,291)#&>#$how()}mul(500,749)&>^-;why()@!@]do()/@?*,]~)mul(530,987)who()why()why()@>mul(282,486)*,-from(),>'what()mul(147,97)- /select()<$do()mul(339,632)<+mul(476,603)#$!mul(249,732)![]mul(552,713)}%^:[~who(294,666)!mul(335,971)>#mul(190(how();who():)mul(364,772)[~,when()*mul(350,52;who(640,301)from()-$,%:};mul(407,507))&#why()/{&[mul(668,42),~mul(849,891)what()*-:/who()$mul(335,214)?:why(); ,%mul;}mul(561,325){mul/+?when()select()#do()!{!)/!mul(398,351)'$]how()%?:)from(716,264)}mul(976,539)when()}/mul(800,619)who())[?mul#+who()}mul(527,856)mul(479,693)[what()#}{where()where()mul(310,5)$]>mul(687,149))!how(),why()how(941,130)where()when()what()mul(187,693)(mul(24,418){':}mul(304,601)when()mul(66,524)how()']select()from()>what()mul(217,884)~~-when())?@/mul(62,572)))when(482,658){select(561,928)when()!({mul(388,507)from()/+mul(64,284)who()why(899,74)when()why()mul(734,117)<-+}#:what()mul(567:where()select()mul(694,323)/[select()mul(772,515)[/'>why()when()/(*@mul(663,798)$when()select()$%#<,select()mul(810,58):~,(+select()[from()~'mul(838,509)mul(227,633)] mul(300,309)]>,!}'mul(369,74)$~({ ~'}{]don't()~)&<[>who()>mul(76,891)!]~ }:)${/mul(226,65)~/&<)^mul(981,600)[who(271,199)~-$&;[where(691,309)mul(69,207)*>select()*(+mul(935,119)<> ?;->mul(116,703)'where()-;;from()mul(324,982from()what()@<^mul(144,872)@+mul(569,48)mul(475,850)*how()'~^-mul(486,714)~![why()why()}</select()how()mul(789,342)?select()]!why()#mul(485,483)'%why();?%who()mul(921,916)do()'*]where()how(977,165)@mul(441,964)*-who()]&mul(395,170)> }mul(583,793)<*-how(){{mul(794,26)%~/;mul(297,812)mul(264,703)[select(253,420)select()mul(665)*when()*/>when()from()/where()!mul(264,312)where(756,949),+{}from()+;mul(454,375),do(){mul(72,780)(who() mul(4,67) +/why()[*>when())from()mul(163,222)who();select()@?select()mul(631,370)where()^%mul(48,604)%where()select()]%:!{mul(492,16):?select(566,72)'@+when()})mul(277,631)when()when()+%#mul(356,136)mul^who() from()!from()~[don't()?:#!mul(536,636){how()why(167,58){from()$;&mul(170,241)-~$mulwho(),mul(295,979)^when()$}mul(872,817)'^+ %%%@%;mul(796,401){@$from():%(@who()where()do()how();,>where()*how()mul(562,34)mul(851,857)([how()mul(870)do()^#]what()mul(855,774)>from()mul(19,63))from()/'#mul(502,592)$(mul(330,265)-*'why()/<@mul(919,336)'when()when()(~ mul(222,37)mul}*?mul(716,440);how(254,405)#mul(938,798)]why()+mul(370,761);+select())mul(308,872):!who()%mul(376,736)when()[don't()$;#~,how():select()~what()mul(793,522)){?who()/mul(812,372)<;@mul(627,289)[!don't()^+)how()$from()##mul(500,501)#{why(120,25)mul(571,651):&{?mul(792,25))@$(@>don't()who()?^')' from()[mul(323,38)when()where()*/who()%mul(623,356)?mul(629,625))}+how()mul(950,826)(+,#mul(947,453)why();'how()&]from()mul(510,94)-?[from(){mul(34,148){when()mul(661,839)do()/}who()mul(597,740)^;mul(6,887)~#how(287,928) $>?}:don't()/-%(,;/))mul(910,743)!:%,%}/mul(626,661)((&([mul(320,446){what()'~<-@mul(573,309)^:?why(352,585)how(328,377)(@mul(996,815),~don't()mul(558,873), what()?>]^$mul(647,533);$@]!when();;when()mul(508,819)&select()( select()mul(823,518)/-how(),]mul(584,720)mul(127,993)''why()'/![where()mul(130,642)*what()when()mul(648,223)#}])don't() !when(647,635)+&$ mul(154,204)@~~?mul(90,691)when()]^&from()'[mul(236,768)~where())^~->(&mul(378,233) pos: + break + else: + current_state = elem[1] + + return current_state + + +result = 0 +for match in pattern.finditer(data): + if get_do_state(do_dont_intervals, match.start()): + result += int(match.group(1)) * int(match.group(2)) + + +print(result) diff --git a/2024/day04/input b/2024/day04/input new file mode 100644 index 0000000..ea53c2c --- /dev/null +++ b/2024/day04/input @@ -0,0 +1,140 @@ +MMSSMSMXAMXMSSSSMMXSSMSAMASASXXAAXMAXXAMXAXSXMAMXMMMMSSMXMAAAMXMMMXXAMMAMSAMXXAMMMAAMMMSMMMMMXXSAMXMASXMXSMSXMXMMMSMSAMXSSMMXMMASMSMSMMMAMMS +AASAAAXMSMMAMAXAASMMAAMASXMMSASMSSXASAMXXAXMASAXXMMMAAAXMAMXMSAMSMSSMSMAMMMMSMAMASMMSXMAXXAASXAXAMXMASAMMSAMXMXMAAAXMASXMAMSAXXMSAAAAAASASXS +MXSMMMMAAMAAMXMSMMASMMMAMAAAMAMAAMMAXAMXSSXSAMSMSAMMMSSSMSXMAMAMXMAAXXMMSMAAASAMXSXASMSMSXSMSAMSXMAXASAMAMAMXMASMSXXSAMMSSMSAMSASMMSMSMSASAS +MMMASXSSMXSASXAXASMMAXMMSSMMMXMMMMSSSMSMMAAXXMAXXAMXMMXAAXAXASXMAMSXMSAMXMMSXSXSXMMXMAMXMAMMXAMAMMSMASMMASXMSSXSAMAAMAMMAMXMAAMAMMXXXXXMAMAX +SASXMAAXXMMAMXMMAMXSXMMMXASMMMMXSAAAAAAXMMMMMMXXMAMXMMSMMMSMXAXXXMAASAMXASXMAXXAMXASMSMAMXMASMMXSAAMXMASASAMAMAMAMMXAAMMAMXMMMMMXSAMASMMXMXM +SXSAMXMXMSMAMAMSAMXMXXAASAMXXASAMMSMMXM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AMX +XAAXMXMMMMAMXMAAXXXAAXAMAMMSMSMMAXMASXSMSSSSSSMAXSAXAAXMXSXAAMMSXXAMAXMXSMASAMXSXXASMSSSMMSMMMSMSAMMMMSXMSMSAMXSAMXAAAAAAXMAMXAAMMXSAMXSMSMA +SMSXSASAMXMMMSSMXSAMSSXMAMXAAAMMAMSMMASAAMMAXAMXXSAMMSSMASMMXMASXXAMXSXMXMAMAXAXMSAMAMAAMAAMMAXASMSAAAAXAAASAMASAASXSSMXAMSSMSSSXAAMXMXMAMAA +SXMAMXSAMAMAXAAMASXMAAASAXSMSMSMAMAAMAMMMSSSSSXSAMXMXAMMAMAXAMXSMSMMASAMASMSXMMSMMAMSMSMMSSSMMMXMAXXAMXMSMXMMMMSAMXAXAMSSMAMAMAMXMMSAMAMAMAX +XAMAMXMXSASXSSXMASAXMSMSAMSAAAXXSSSSMAXAAMMAAXAASXAXMASMASMSSSXMAAAMASMMAXXAXAAAAAXMAMAAXAAXAASAMXMMXAXXXSAMXAASMMMSMMMAAMAMAMAMXAAXMSMSXSMX +SXMASMAMSAMXMASMMSAMXAMXMASMMXMAMMXXXXSMSSMMMMXMASXSXSXMMSXXMAMMSXSAMXMMASMXMMSSSMSSXSSSMMSSSMSMSAXXMASXMASXSMMSXSXAASMMSSMSXSXSXMSMMAMXMAMS \ No newline at end of file diff --git a/2024/day04/input_test b/2024/day04/input_test new file mode 100644 index 0000000..c41c5ea --- /dev/null +++ b/2024/day04/input_test @@ -0,0 +1,10 @@ +MMMSXXMASM +MSAMXMSMSA +AMXSXMAAMM +MSAMASMSMX +XMASAMXAMM +XXAMMXXAMA +SMSMSASXSS +SAXAMASAAA +MAMMMXMMMM +MXMXAXMASX \ No newline at end of file diff --git a/2024/day04/solve.py b/2024/day04/solve.py new file mode 100644 index 0000000..da301c9 --- /dev/null +++ b/2024/day04/solve.py @@ -0,0 +1,43 @@ +def check_direction(lines: list[str], row_idx: int, col_idx: int, row_step: int, column_step: int) -> bool: + column_count = len(lines[0]) + row_count = len(lines) + for step, letter in enumerate("MAS"): + current_row = row_idx + (step + 1) * row_step + current_col = col_idx + (step + 1) * column_step + if current_row >= row_count or current_row < 0: + return False + + if current_col >= column_count or current_col < 0: + return False + + if lines[current_row][current_col] != letter: + return False + + return True + +def get_current_pos_words(lines: list[str], row_idx: int, col_idx: int) -> int: + if lines[row_idx][col_idx] != 'X': + return 0 + + count = 0 + for row_step in range(-1, 2): + for column_step in range(-1, 2): + if row_step == 0 and column_step == 0: + continue + + if check_direction(lines, row_idx, col_idx, row_step, column_step): + count += 1 + + return count + +data = [] +with open("input") as f: + for line in f: + data.append(line.strip()) + +result = 0 +for row, line in enumerate(data): + for col in range(len(line)): + result += get_current_pos_words(data, row, col) + +print(result) \ No newline at end of file diff --git a/2024/day04/solve2.py b/2024/day04/solve2.py new file mode 100644 index 0000000..8866fc0 --- /dev/null +++ b/2024/day04/solve2.py @@ -0,0 +1,33 @@ +def is_xmas(lines: list[str], row_idx: int, col_idx: int) -> bool: + if lines[row_idx][col_idx] != 'A': + return False + + if row_idx == 0 or col_idx == 0 or row_idx == len(lines) - 1 or col_idx == len(lines[0]) - 1: + return False + + found_mas_count = 0 + for row_step in range(-1, 2, 2): + for column_step in range(-1, 2, 2): + current_corner = lines[row_idx + row_step][col_idx + column_step] + if current_corner == 'M': + if lines[row_idx - row_step][col_idx - column_step] == 'S': + found_mas_count += 1 + else: + return False + elif current_corner != 'S': + return False + + return found_mas_count == 2 + +data = [] +with open("input") as f: + for line in f: + data.append(line.strip()) + +result = 0 +for row, line in enumerate(data): + for col in range(len(line)): + if is_xmas(data, row, col): + result += 1 + +print(result) \ No newline at end of file diff --git a/2024/day05/input b/2024/day05/input new file mode 100644 index 0000000..75195a7 --- /dev/null +++ b/2024/day05/input @@ -0,0 +1,1387 @@ +24|55 +38|32 +38|21 +48|51 +48|92 +48|14 +78|35 +78|54 +78|87 +78|44 +72|29 +72|65 +72|87 +72|82 +72|37 +23|56 +23|51 +23|81 +23|83 +23|25 +23|87 +25|14 +25|18 +25|55 +25|22 +25|15 +25|77 +25|17 +54|96 +54|65 +54|33 +54|21 +54|36 +54|29 +54|56 +54|89 +56|78 +56|88 +56|77 +56|52 +56|22 +56|81 +56|14 +56|85 +56|17 +33|23 +33|22 +33|83 +33|14 +33|89 +33|25 +33|55 +33|92 +33|72 +33|78 +96|78 +96|21 +96|14 +96|77 +96|92 +96|68 +96|88 +96|24 +96|83 +96|55 +96|91 +97|56 +97|54 +97|17 +97|43 +97|13 +97|33 +97|48 +97|96 +97|65 +97|89 +97|83 +97|37 +35|92 +35|23 +35|25 +35|52 +35|24 +35|33 +35|51 +35|21 +35|55 +35|88 +35|17 +35|56 +35|89 +52|44 +52|61 +52|88 +52|82 +52|64 +52|71 +52|51 +52|99 +52|97 +52|68 +52|85 +52|91 +52|18 +52|55 +22|43 +22|61 +22|72 +22|68 +22|15 +22|87 +22|64 +22|85 +22|97 +22|88 +22|51 +22|71 +22|18 +22|63 +22|91 +29|14 +29|81 +29|35 +29|89 +29|96 +29|21 +29|13 +29|36 +29|23 +29|65 +29|48 +29|17 +29|24 +29|52 +29|33 +29|99 +65|17 +65|15 +65|25 +65|48 +65|56 +65|22 +65|52 +65|21 +65|92 +65|23 +65|36 +65|83 +65|24 +65|55 +65|37 +65|89 +65|81 +36|77 +36|96 +36|83 +36|99 +36|56 +36|89 +36|68 +36|21 +36|55 +36|92 +36|78 +36|88 +36|51 +36|72 +36|52 +36|14 +36|24 +36|17 +32|24 +32|83 +32|13 +32|29 +32|21 +32|25 +32|92 +32|56 +32|33 +32|99 +32|96 +32|14 +32|35 +32|22 +32|88 +32|17 +32|65 +32|81 +32|37 +64|42 +64|48 +64|37 +64|96 +64|44 +64|56 +64|71 +64|76 +64|36 +64|29 +64|33 +64|23 +64|65 +64|13 +64|25 +64|38 +64|43 +64|32 +64|97 +64|54 +55|64 +55|76 +55|61 +55|43 +55|38 +55|87 +55|71 +55|72 +55|54 +55|68 +55|18 +55|67 +55|85 +55|63 +55|51 +55|78 +55|77 +55|44 +55|15 +55|97 +55|91 +43|14 +43|96 +43|32 +43|89 +43|48 +43|35 +43|23 +43|36 +43|83 +43|24 +43|33 +43|52 +43|56 +43|65 +43|13 +43|25 +43|21 +43|17 +43|54 +43|76 +43|42 +43|37 +92|85 +92|71 +92|38 +92|77 +92|64 +92|76 +92|44 +92|51 +92|63 +92|68 +92|87 +92|55 +92|88 +92|18 +92|99 +92|15 +92|72 +92|97 +92|43 +92|82 +92|61 +92|91 +92|78 +17|18 +17|81 +17|82 +17|52 +17|92 +17|77 +17|64 +17|21 +17|14 +17|68 +17|51 +17|83 +17|99 +17|24 +17|91 +17|72 +17|88 +17|15 +17|87 +17|85 +17|55 +17|22 +17|67 +17|78 +83|68 +83|77 +83|18 +83|99 +83|67 +83|51 +83|15 +83|72 +83|92 +83|22 +83|82 +83|85 +83|88 +83|63 +83|78 +83|44 +83|52 +83|24 +83|91 +83|55 +83|87 +83|61 +83|14 +83|64 +76|25 +76|14 +76|56 +76|22 +76|89 +76|23 +76|42 +76|35 +76|83 +76|29 +76|48 +76|32 +76|81 +76|33 +76|96 +76|13 +76|65 +76|21 +76|36 +76|52 +76|24 +76|17 +76|37 +76|54 +67|32 +67|71 +67|33 +67|25 +67|56 +67|97 +67|42 +67|43 +67|38 +67|37 +67|64 +67|29 +67|76 +67|35 +67|48 +67|44 +67|36 +67|82 +67|54 +67|23 +67|61 +67|63 +67|65 +67|13 +71|25 +71|48 +71|29 +71|33 +71|96 +71|42 +71|17 +71|89 +71|97 +71|35 +71|37 +71|54 +71|23 +71|43 +71|83 +71|36 +71|21 +71|13 +71|38 +71|76 +71|81 +71|65 +71|56 +71|32 +42|22 +42|35 +42|29 +42|24 +42|92 +42|36 +42|32 +42|99 +42|89 +42|14 +42|48 +42|65 +42|56 +42|17 +42|37 +42|96 +42|23 +42|25 +42|13 +42|21 +42|52 +42|81 +42|33 +42|83 +51|67 +51|78 +51|61 +51|71 +51|63 +51|97 +51|42 +51|87 +51|72 +51|77 +51|18 +51|29 +51|15 +51|64 +51|85 +51|82 +51|44 +51|43 +51|68 +51|54 +51|38 +51|76 +51|91 +51|32 +85|61 +85|67 +85|76 +85|25 +85|37 +85|33 +85|36 +85|32 +85|23 +85|97 +85|43 +85|63 +85|38 +85|35 +85|13 +85|48 +85|29 +85|44 +85|64 +85|82 +85|65 +85|42 +85|54 +85|71 +81|82 +81|72 +81|52 +81|87 +81|91 +81|15 +81|14 +81|83 +81|92 +81|22 +81|78 +81|68 +81|77 +81|18 +81|24 +81|67 +81|51 +81|85 +81|64 +81|99 +81|88 +81|55 +81|61 +81|21 +63|29 +63|44 +63|38 +63|89 +63|36 +63|48 +63|25 +63|33 +63|96 +63|17 +63|81 +63|32 +63|43 +63|42 +63|35 +63|37 +63|13 +63|76 +63|56 +63|97 +63|54 +63|65 +63|71 +63|23 +37|22 +37|56 +37|99 +37|36 +37|33 +37|78 +37|92 +37|23 +37|52 +37|14 +37|24 +37|55 +37|13 +37|48 +37|25 +37|81 +37|89 +37|83 +37|21 +37|96 +37|15 +37|17 +37|88 +37|51 +15|67 +15|61 +15|29 +15|77 +15|76 +15|68 +15|97 +15|71 +15|85 +15|32 +15|64 +15|63 +15|54 +15|35 +15|87 +15|91 +15|38 +15|43 +15|78 +15|42 +15|44 +15|82 +15|18 +15|72 +82|71 +82|54 +82|36 +82|65 +82|61 +82|63 +82|35 +82|96 +82|32 +82|33 +82|48 +82|76 +82|97 +82|56 +82|29 +82|43 +82|89 +82|23 +82|38 +82|25 +82|42 +82|37 +82|44 +82|13 +88|42 +88|78 +88|71 +88|15 +88|44 +88|54 +88|51 +88|85 +88|97 +88|43 +88|72 +88|91 +88|76 +88|87 +88|18 +88|64 +88|82 +88|63 +88|77 +88|38 +88|67 +88|68 +88|55 +88|61 +14|85 +14|77 +14|68 +14|87 +14|55 +14|67 +14|44 +14|99 +14|22 +14|91 +14|92 +14|61 +14|38 +14|64 +14|71 +14|15 +14|72 +14|52 +14|51 +14|82 +14|63 +14|78 +14|88 +14|18 +18|65 +18|64 +18|71 +18|38 +18|33 +18|63 +18|43 +18|61 +18|67 +18|91 +18|37 +18|13 +18|82 +18|29 +18|48 +18|97 +18|44 +18|42 +18|23 +18|35 +18|85 +18|54 +18|76 +18|32 +77|54 +77|68 +77|97 +77|63 +77|67 +77|85 +77|37 +77|42 +77|38 +77|61 +77|72 +77|18 +77|65 +77|29 +77|44 +77|35 +77|91 +77|82 +77|43 +77|71 +77|32 +77|76 +77|87 +77|64 +44|38 +44|35 +44|25 +44|36 +44|29 +44|33 +44|89 +44|76 +44|56 +44|37 +44|23 +44|48 +44|96 +44|65 +44|97 +44|43 +44|54 +44|71 +44|17 +44|21 +44|81 +44|42 +44|32 +44|13 +21|61 +21|22 +21|14 +21|82 +21|72 +21|92 +21|91 +21|18 +21|15 +21|24 +21|87 +21|67 +21|83 +21|55 +21|85 +21|99 +21|77 +21|63 +21|68 +21|51 +21|88 +21|64 +21|52 +21|78 +87|37 +87|65 +87|64 +87|48 +87|67 +87|91 +87|33 +87|82 +87|29 +87|63 +87|54 +87|85 +87|42 +87|61 +87|76 +87|38 +87|97 +87|44 +87|35 +87|43 +87|32 +87|18 +87|13 +87|71 +89|87 +89|81 +89|92 +89|78 +89|15 +89|88 +89|64 +89|91 +89|17 +89|68 +89|24 +89|72 +89|77 +89|99 +89|55 +89|83 +89|22 +89|18 +89|14 +89|52 +89|21 +89|85 +89|51 +89|67 +61|63 +61|97 +61|33 +61|23 +61|65 +61|17 +61|35 +61|13 +61|56 +61|71 +61|44 +61|96 +61|42 +61|38 +61|37 +61|29 +61|76 +61|48 +61|32 +61|54 +61|36 +61|43 +61|89 +61|25 +91|65 +91|67 +91|44 +91|13 +91|76 +91|32 +91|61 +91|82 +91|63 +91|85 +91|29 +91|43 +91|36 +91|64 +91|48 +91|71 +91|38 +91|37 +91|33 +91|42 +91|97 +91|35 +91|23 +91|54 +68|87 +68|65 +68|63 +68|91 +68|38 +68|37 +68|61 +68|35 +68|54 +68|32 +68|82 +68|97 +68|18 +68|71 +68|13 +68|72 +68|64 +68|85 +68|44 +68|42 +68|29 +68|76 +68|43 +68|67 +99|91 +99|15 +99|38 +99|55 +99|72 +99|64 +99|77 +99|18 +99|97 +99|54 +99|76 +99|61 +99|78 +99|44 +99|71 +99|68 +99|82 +99|43 +99|51 +99|88 +99|85 +99|63 +99|67 +99|87 +13|15 +13|14 +13|99 +13|89 +13|17 +13|21 +13|25 +13|51 +13|56 +13|33 +13|48 +13|36 +13|78 +13|83 +13|77 +13|81 +13|24 +13|52 +13|88 +13|23 +13|22 +13|55 +13|92 +13|96 +24|18 +24|87 +24|77 +24|92 +24|52 +24|14 +24|44 +24|61 +24|22 +24|71 +24|82 +24|72 +24|78 +24|68 +24|64 +24|63 +24|51 +24|67 +24|88 +24|99 +24|15 +24|85 +24|91 +38|43 +38|65 +38|54 +38|42 +38|23 +38|33 +38|76 +38|83 +38|96 +38|25 +38|37 +38|48 +38|35 +38|81 +38|56 +38|97 +38|29 +38|13 +38|36 +38|89 +38|24 +38|17 +48|33 +48|83 +48|23 +48|78 +48|55 +48|81 +48|22 +48|77 +48|89 +48|25 +48|24 +48|21 +48|99 +48|36 +48|17 +48|96 +48|68 +48|56 +48|52 +48|15 +48|88 +78|68 +78|72 +78|77 +78|43 +78|64 +78|38 +78|61 +78|97 +78|71 +78|76 +78|42 +78|32 +78|85 +78|65 +78|91 +78|63 +78|82 +78|18 +78|67 +78|29 +72|32 +72|67 +72|97 +72|64 +72|61 +72|13 +72|42 +72|85 +72|76 +72|71 +72|91 +72|35 +72|18 +72|54 +72|48 +72|63 +72|43 +72|38 +72|44 +23|96 +23|68 +23|92 +23|99 +23|22 +23|14 +23|89 +23|72 +23|77 +23|17 +23|24 +23|55 +23|52 +23|15 +23|78 +23|88 +23|36 +23|21 +25|72 +25|51 +25|52 +25|21 +25|92 +25|78 +25|87 +25|91 +25|24 +25|88 +25|96 +25|83 +25|99 +25|81 +25|68 +25|89 +25|56 +54|83 +54|22 +54|81 +54|42 +54|48 +54|92 +54|24 +54|25 +54|13 +54|35 +54|52 +54|37 +54|32 +54|14 +54|23 +54|17 +56|68 +56|24 +56|99 +56|72 +56|15 +56|55 +56|51 +56|18 +56|21 +56|91 +56|87 +56|92 +56|83 +56|89 +56|96 +33|56 +33|99 +33|96 +33|52 +33|81 +33|88 +33|15 +33|36 +33|68 +33|77 +33|17 +33|51 +33|24 +33|21 +96|72 +96|52 +96|67 +96|51 +96|85 +96|81 +96|89 +96|87 +96|18 +96|17 +96|22 +96|15 +96|99 +97|42 +97|29 +97|14 +97|36 +97|81 +97|32 +97|23 +97|21 +97|35 +97|76 +97|24 +97|25 +35|65 +35|22 +35|99 +35|37 +35|13 +35|96 +35|81 +35|36 +35|14 +35|48 +35|83 +52|92 +52|15 +52|78 +52|63 +52|67 +52|22 +52|72 +52|38 +52|87 +52|77 +22|92 +22|78 +22|99 +22|82 +22|44 +22|67 +22|77 +22|38 +22|55 +29|55 +29|92 +29|56 +29|88 +29|22 +29|83 +29|25 +29|37 +65|14 +65|99 +65|88 +65|13 +65|51 +65|96 +65|33 +36|81 +36|87 +36|25 +36|15 +36|22 +36|18 +32|36 +32|48 +32|89 +32|23 +32|52 +64|82 +64|63 +64|61 +64|35 +55|32 +55|42 +55|82 +43|81 +43|29 +92|67 + +42,54,21,36,22,33,13,29,35 +83,67,22,14,78,99,18,92,15,77,52,68,82,55,21,61,85,91,51,64,72,24,88 +85,67,64,82,61,63,44,71,38,97,43,54,42,32,29,35,65,37,13,48,33,23,36 +96,81,21,14,52,99,88,55,51,15,77,68,72,18,85 +63,52,77,85,91,83,22,61,14,64,82,68,51,24,55 +63,97,76,32,29,35,13,48,33,36,25,56,96,89,17 +15,99,51,88,21,83,72,56,81,18,92,52,55,17,89,96,87 +92,22,17,96,78,87,72,14,24,55,81,91,52,83,68,88,18,99,56 +87,18,61,67,64,76,72,85,97,65,91,68,32,44,29,43,37 +87,63,72,64,85,38,43,78,76,82,77,67,88,54,55 +51,77,87,85,67,61,63,44,97 +35,65,37,13,48,36,25,56,81,24,22,92,88 +85,29,32,42,35,87,43,13,63,37,71,72,82,76,91 +56,35,81,96,55,92,83 +54,68,67,77,61,18,63,76,82,55,97,15,42,91,51,38,85,43,72,87,71 +99,88,55,15,77,68,72,87,18,91,67,82,61,44,71,38,97,43,76 +14,17,81,91,55,22,21,87,64 +92,51,68,96,81,17,88,89,83,22,23,15,14,21,25,99,24,78,56,72,36,77,55 +68,87,18,85,82,44,71,43,76,54,42,32,29,35,37 +92,22,88,14,21,55,24,17,25,36,13,23,48 +92,25,18,68,88,51,17 +32,17,37,54,89,71,43,33,42,21,25 +33,36,25,56,96,89,17,81,83,24,14,52,22,92,99,55,51,15,78,77,68 +61,63,44,71,38,43,76,54,42,32,65,13,48,33,36,56,89 +14,88,51,87,64,44,71 +14,92,88,51,15,77,68,87,71 +42,21,89,83,35,65,81,24,23,32,33,13,29,14,52,25,17 +17,83,14,22,92,55,51,15,78,77,18,91,85,67,64 +21,83,22,18,92,67,15,99,64,85,68,87,55,91,78,51,88,77,14,61,52 +64,15,77,85,92,61,88,83,78,22,18,72,68,52,82,91,87,63,14,99,55 +89,21,76,35,96,83,17,13,38,25,54 +77,68,91,85,64,82,44,38,65 +54,64,91,38,63,51,71,61,85,97,44,18,67,76,43,72,78,15,32 +51,87,52,85,72,14,83,24,68,15,21,17,92 +21,83,99,96,36,17,52,81,56,65,25,14,48,13,24,92,55,23,89 +76,42,29,48,33,36,25,56,96,89,17,81,83 +77,55,22,78,87,64,61,88,67,68,71,72,51,44,52,82,99,15,14 +37,33,85,54,44,76,38,23,13,42,36 +43,25,29,13,33,38,35,97,48,56,65,32,17,54,89,81,44,37,36,23,71 +81,92,88,78,68,91,85,67,82 +56,81,21,24,14,88,55,51,77,68,91 +97,29,65,33,17,83,24 +38,33,56,43,61,35,76,54,64,32,36 +63,44,71,38,43,76,54,42,37,13,48,23,36 +22,17,96,89,14,92,83,37,99,88,29,21,52,48,23,81,35,24,36,13,25 +77,61,18,87,72,51,38 +24,92,99,55,51,85,44 +64,82,77,35,38 +87,51,15,88,67,52,18,82,72,77,99,71,64,22,44 +99,88,51,15,78,72,87,18,85,67,64,61,63,71,76 +23,36,25,56,96,17,81,83,14,52,92,88,55,51,78,68,72 +52,92,99,15,78,77,68,72,87,91,85,64,82,61,44,71,38 +13,23,17,14,99,55,78 +25,17,35,37,44,54,71,81,56,65,32 +38,64,55,52,87,77,71,99,88,68,18 +71,38,97,76,54,42,32,29,35,65,13,33,23,36,25,56,96,89,17,81,21 +82,91,52,83,21,18,14,77,85,61,92,64,88,51,68,99,78,22,24 +29,35,13,33,25,56,96,89,17,21,83,24,14,52,22,92,88 +91,61,14,88,18,15,55,99,82,77,64,92,78,87,71,68,51,85,72 +13,36,35,32,38,76,63,82,37,43,65,42,54,48,64,29,56,97,33 +61,88,71,68,92,55,77,63,67,51,38 +18,85,88,63,77,52,38,61,64 +89,83,99,88,55,15,78,77,68,72,87,18,91,85,67 +13,17,35,89,48,33,43,54,21,23,38,83,76 +36,25,56,96,89,17,81,21,83,24,14,52,22,92,99,88,51,15,78,77,68,72,87 +24,52,22,55,51,15,78,72,87,64,82,61,44 +55,15,78,87,18,85,63,71,38,97,54 +37,44,61,32,85,76,71,68,87 +23,65,89,56,33,21,37,22,48,17,96,25,92 +24,14,52,92,99,88,55,51,15,72,87,18,91,61,63 +24,14,22,92,99,88,51,15,78,68,72,87,18,85,64,82,61,63,44 +64,44,97,43,76,54,42,35,37,13,33,36,56 +15,87,91,67,82,61,97 +63,18,32,76,67,82,15,64,91,72,85,68,54,43,42,71,61,87,97,44,38,78,29 +48,33,25,56,96,89,81,21,14,52,22,92,99,88,55,51,15,78,77 +89,17,81,83,52,88,15,78,77,72,87 +51,55,92,77,88,72,68,24,87,89,85,99,52,14,83,81,21,91,15,17,22,18,96 +76,35,33,13,14,42,81,43,23,29,89,24,21,96,17,37,32,25,65 +89,25,13,56,78,15,92,48,17,23,88,99,14,51,52 +21,83,54,33,35,25,13,22,48,37,56,14,36,89,42 +61,71,29,37,13 +96,17,24,14,22,92,88,51,77,72,85 +99,88,55,51,77,68,72,87,18,91,85,82,61,63,71,38,97,43,76 +65,35,42,32,13,17,25,83,33,23,54,14,24 +76,54,87,72,61,18,97,91,44,42,65,85,82,71,77,35,29 +91,87,92,78,21,52,18,24,68,85,77,15,81,83,22,64,72,51,99,82,14,67,88 +43,32,35,37,13,96,17 +33,36,96,21,24,14,52,22,92 +77,83,92,85,81,91,21,68,24,64,82 +61,71,48,63,44,32,42,65,37,56,96,43,35,76,29,23,38 +44,71,38,54,32,35,13,33,23,56,96 +23,17,81,21,83,24,92,99,88,55,51,15,78,77,72 +42,33,61,67,23,64,25,65,82 +81,13,48,22,29,23,35,14,21,92,89 +33,23,36,25,56,96,17,81,21,83,24,14,52,22,92,99,88,55,51,15,78,77,68 +32,29,35,65,37,48,23,36,56,96,89,17,81,21,83,24,52,22,99 +65,37,13,25,96,89,17,21,92 +48,76,13,82,71,97,23,61,56,29,36,33,44,42,25,43,38,54,37,96,35 +21,99,61,87,68,22,88 +18,38,54,32,35,48,33 +97,63,55,78,15,77,68,87,61,18,38,51,71,91,88,99,92,22,44,85,82,67,64 +56,99,36,96,13 +56,25,43,76,23,33,64,29,36 +99,51,68,87,91,82,63,44,71,43,76 +82,54,85,91,29,64,33,61,42,37,97 +56,42,17,33,97,43,63 +77,17,21,99,52,85,15,91,78,88,14,67,51,24,92,22,64 +55,51,15,78,77,68,72,87,18,91,85,67,64,82,61,63,44,38,97,43,76,54,42 +87,78,67,18,42,61,55,82,91,71,85,97,15,72,43,76,63,44,64,38,54,77,51 +37,44,64,13,29,97,25,82,61,67,36,35,43,63,23 +33,23,25,56,96,89,17,21,83,14,52,22,92,99,88,51,78,77,68 +33,36,32,35,48,23,24,21,22,17,99,83,25,37,96,29,81,92,14,65,52 +76,32,71,42,33,82,97,36,54,44,35,13,29,43,37,63,48,96,65 +65,37,13,48,33,23,36,25,56,96,89,17,81,21,83,24,52,22,92,99,88,55,51 +42,32,29,35,37,13,48,23,36,56,96,21,83,14,52,22,92 +42,43,25,65,23,37,61,44,48,29,76,33,36,38,54,97,96,89,35 +52,99,55,51,78,18,64,82,63,71,38 +36,96,89,17,81,83,14,52,88,51,15,78,77 +96,81,51,15,99,37,24,36,13,17,33 +21,83,24,14,52,99,88,55,51,15,68,72,91,85,67,64,61 +25,51,81,22,99,56,18,52,78,14,87,92,15,77,68,83,55 +81,77,92,21,51,15,99,96,56 +71,43,65,82,54,42,13,36,25,61,23,33,35,63,67,38,76,97,37,32,29 +37,76,63,61,96,56,25,35,13,36,43,29,82,32,48,33,97 +35,52,23,14,96,42,89,21,81,83,76 +48,23,36,25,56,96,89,17,81,21,83,24,14,52,22,92,99,88,55,51,15,78,77 +44,61,85,92,91,77,15,64,51 +37,13,48,33,23,25,56,81,83,52,92,51,15 +56,78,96,88,92,36,23,17,25,52,48,99,24,89,55,21,15,81,51 +64,22,67,55,97,72,15,18,68,38,88 +85,64,68,44,54,87,76,91,82,63,88 +85,38,78,82,18,87,91,32,77,43,76,72,15,42,51 +22,92,88,72,87,91,67,82,61,44,97 +55,18,54,38,87,88,85,15,76 +83,24,14,52,22,92,88,55,51,15,78,77,68,72,18,91,85,67,64,61,63 +42,32,35,65,37,13,48,33,23,36,25,56,96,89,21,83,24,14,52,22,92 +32,17,29,83,48,14,21,25,52,42,96,33,37,65,76 +35,89,81,14,32,83,29,65,52,25,92,13,22,36,33,48,37,42,24 +81,42,35,36,89,54,71,25,32,43,76,37,38,44,65,23,17,33,56 +21,18,87,52,22,56,51,15,77,92,25,55,72,99,78,96,14,83,24 +56,25,37,81,38,89,21,43,65,83,33,36,35,96,48,42,29 +55,15,77,68,87,18,91,85,61,44,38,97,43,76,42 +22,99,72,83,67,52,61,21,68,14,87,18,77,51,64 +92,55,85,14,22,17,52,89,78 +88,68,18,14,81,22,91,52,83,99,72 +36,17,29,83,96,65,54,89,43,35,56,23,25,13,81,76,14 +88,51,78,63,43,76,54 +91,67,82,61,38,97,43,76,54,42,32,29,35,13,48,33,23 +67,63,35,71,54,68,37 +85,35,33,32,61,76,65,54,37,67,91,42,97,48,71,82,38,29,13,44,43 +77,15,81,89,96,25,14,92,78,22,51,24,21,83,56,18,88,99,68 +23,36,25,22,92,15,72 +23,25,54,36,65,17,14,76,56,96,35,48,81,24,37,21,89 +85,64,61,38,32,29,65 +56,89,17,24,14,92,99,55,78,18,91 +18,85,61,63,44,71,38,48,33 +81,21,14,52,92,88,72,67,82 +55,51,15,78,77,64,63,44,38,43,76,54,42 +76,54,48,23,96,81,83,24,52 +21,83,13,14,22,96,25,37,56,81,36,92,42,89,23,32,24,33,52,35,17 +42,13,91,38,43,82,35,18,87,29,37,85,64,67,54,32,63,76,72,61,44 +23,22,29,21,24,36,14,99,89,56,88 +77,56,15,33,48,24,81,22,92 +78,87,85,67,44,71,97,29,35 +61,15,78,63,77,71,44,68,91,87,32,85,72,43,76,82,29,97,42,54,18,38,67 +99,18,81,82,87,24,78,51,83 +54,65,48,36,14,52,22 +63,44,38,97,54,42,32,65,37,56,96,89,17 +83,88,68,72,81,52,55,36,25,22,17,92,87 +44,38,97,54,42,37,13,33,23,36,81 +61,18,67,64,38,35,65,85,68,29,37,63,71,42,91,82,97 +65,54,23,35,89,43,29,38,36,76,81,21,32,17,56,71,42 +96,78,55,91,17,77,85 +64,82,61,44,38,97,43,42,32,35,65,37,48,33,23 +23,36,25,56,89,17,81,21,83,14,52,22,92,99,88,55,51,15,78,68,72 +97,43,54,42,32,29,35,37,13,48,33,23,56,96,89,17,21,83,24 +54,65,36,23,71 +13,44,33,63,48,97,25,38,64,82,61,56,76,42,54,65,71,43,23,35,36,37,32 +65,13,48,23,36,56,89,21,52,22,88,55,51 +68,51,14,83,64,18,77,17,91 +76,37,38,25,13,33,71,21,42 +21,92,81,87,24,56,51 +48,83,35,37,81,97,89,54,33,29,36,13,96,23,38,21,65,17,76,56,32,43,25 +13,48,17,83,14,15,78 +18,22,92,82,68,87,24,52,44,99,67 +77,99,87,92,22,51,52,68,71,14,82 +22,67,83,63,14,15,82 +64,44,97,61,67,32,37,65,38,29,35,48,71,36,54,76,85 +24,14,92,99,15,78,87 +63,71,76,54,32,29,35,65,37,13,48,33,23,36,25,56,96,89,17 +42,96,71,35,25,65,23,33,44,81,32,97,29,76,13,54,43,56,17 +87,91,67,82,44,71,38,97,43,76,29,35,65,37,48 +33,38,13,48,65,43,61,82,37,76,54,32,35,44,67,29,85 +24,52,22,92,55,51,78,68,72,18,91,85,64,82,44 +63,48,85,67,38 +42,32,35,65,13,48,33,36,25,89,17,81,14 +63,44,71,43,35,65,37,13,23,36,17 +25,21,97,33,54,32,76,42,37,17,35,65,89,81,83,96,36,23,48,43,13,38,29 +42,32,29,35,65,37,33,25,56,89,17,21,24,14,52,22,92 +37,48,81,21,83,14,22,88,55,51,15 +55,51,77,68,87,18,91,85,67,82,63,44,38,97,54 +35,65,13,33,36 +61,48,44,64,43,36,82,42,56,29,23,54,33 +92,99,88,55,15,78,77,68,72,18,91,67,64,82,61,63,44,71,38,97,43 +32,29,33,23,96,83,22,92,99 +63,55,61,92,87,64,88,85,72 +67,92,77,64,52,51,81,91,17,85,21,22,14,78,15,88,18,72,83,55,68 +36,78,92,22,51,87,99 +37,13,36,56,81,92,88,55,15 +29,35,37,13,48,33,23,25,56,96,89,17,81,21,83,24,52,22,92,99,88 \ No newline at end of file diff --git a/2024/day05/input_test b/2024/day05/input_test new file mode 100644 index 0000000..2508bd7 --- /dev/null +++ b/2024/day05/input_test @@ -0,0 +1,28 @@ +47|53 +97|13 +97|61 +97|47 +75|29 +61|13 +75|53 +29|13 +97|29 +53|29 +61|53 +97|53 +61|29 +47|13 +75|47 +97|75 +47|61 +75|61 +47|29 +75|13 +53|13 + +75,47,61,53,29 +97,61,53,29,13 +75,29,13 +75,97,47,61,53 +61,13,29 +97,13,75,29,47 \ No newline at end of file diff --git a/2024/day05/solve.py b/2024/day05/solve.py new file mode 100644 index 0000000..b2b578a --- /dev/null +++ b/2024/day05/solve.py @@ -0,0 +1,27 @@ +def middle_page_if_update_correct(update: list[str], rules: list[tuple[str, str]]) -> int: + for idx, page in enumerate(update): + for previous_page in (update[previous_idx] for previous_idx in range(idx)): + if (page, previous_page) in rules: + return 0 + + return int(update[len(update) // 2]) + + +rules = [] +updates = [] + +reading_updates = False +with open("input") as f: + for line in f.readlines(): + if reading_updates: + updates.append(line.strip().split(",")) + elif line == "\n": + reading_updates = True + else: + rules.append(tuple(line.strip().split("|"))) + +result = 0 +for update in updates: + result += middle_page_if_update_correct(update, rules) + +print(result) diff --git a/2024/day05/solve2.py b/2024/day05/solve2.py new file mode 100644 index 0000000..4675e85 --- /dev/null +++ b/2024/day05/solve2.py @@ -0,0 +1,36 @@ +from functools import cmp_to_key + +def is_update_correct(update: list[str], rules: list[tuple[str, str]]) -> bool: + for idx, page in enumerate(update): + for previous_page in (update[previous_idx] for previous_idx in range(idx)): + if (page, previous_page) in rules: + return False + + return True + + +rules = [] +updates = [] + +reading_updates = False +with open("input") as f: + for line in f.readlines(): + if reading_updates: + updates.append(line.strip().split(",")) + elif line == "\n": + reading_updates = True + else: + rules.append(tuple(line.strip().split("|"))) + +for idx in range(len(updates) - 1, -1, -1): + if is_update_correct(updates[idx], rules): + updates.pop(idx) + +for update in updates: + update.sort(key=cmp_to_key(lambda item1, item2: -1 if (item1, item2) in rules else 1 if (item2, item1) in rules else 0)) + +result = 0 +for update in updates: + result += int(update[len(update) // 2]) + +print(result) diff --git a/2024/day06/input b/2024/day06/input new file mode 100644 index 0000000..f297efc --- /dev/null +++ b/2024/day06/input @@ -0,0 +1,130 @@ +........#.............................#......#................#..................#..................#.........#.#.#............... +...........................................#..#......................#............................#...........................#.#. +.............#..........#........#.#...........#........................#............................##........................... +............#.............#.....................................#........................#.....#.................................. +.........#...........#................#................................#......#.....................#.............#..............# +...........................##...........................................................................................#......... +...........#.......#.................................................................#..............#....................#........ +.......................#.............................................#.........................................#.#..............#. +.#...................#..................#...........#...#.........#...##.......................................................... +.................#..........#.....#.........#.....................................................................#..........##... +....#.#............#..........#.......................#.........................#.................#.........#.............#....#.. +...#....................................#.............#..............................#............#.....................#........# +....................#..............................#...#.#...#.#..........#.................................#..................#.. +........................................................................................#.....#.........#............#.........#.. +...................#.................#.......................................................................................#...# +..............#.......#..................#........#....#........#.....................#..........................#................ +...........#..#....................................#.............#.#..#.......................................#.........#.#...#... +...#.............#............................#..............#....................#.#............................................. +..#...........#.#.........#...............................................#...#...............#.#...........#........##....#...... +.............................................#..#.........#......#................................................................ +.................................#.................#..............#.....#...................................................#..... +............................#.......#............#...............................................................#................ +.....#....................#...........................................#..........................#..........#..#...#......#...#... +........................#......#...#.......................#....##.......#..........#...............#............................. +#..#....................................................................................................#......................... +...........................................#......#..........................#..............................#.............#.....#. +..............#......................#..#...................................#.#..................#.......#............#........... +.................#...................................#..........#......#....#.#.#...#....................#..........#......#...... +........#....................................#........#.........................................#......#.#...............#......#. +..................................#......#........#........#.#......#.........................#.#.......#......................#.. +......#..#.........#............#...........................................................#.............#.........#............. +.........................#......................#.....#........#..........#....................................................... +#.......#..................#............................................................#......................................... +.........#.....#.............#...............#......#.....................#....................................................... +.........#..#.........................................................#.........##..................##........#................... +.#.....#..............#..............#.........................................#.....................................#............ +..............................#......................................................................................#............ +..............#..........................#................................#.#.....#...........#.........#......................... +....................#...#.#...........................................................................#...........#............... +...........#.............................#....................#........#...............................##....#.................... +.....................#......................#.#.....#...........................#.......#........#................................ +#..........#...............#.......#..................................#.....................................................##.... +.........................................................#...#....#...............................................#.........##.... +.....................#......................#..............#..................................................#................... +......#.............#........#..................................................#...#.............................#......#........ +....................#............#........#...............#......#.......#........................................................ +..........................................................................#........................#......#.............#.......#. +.....................................................#..#........#....................#.....................#..................... +..#.................#........................................#................................................##...............#.. +.............#......#.........#................................................................................#.................. +#......#.......................................................................................................#......#........... +.......##.......................#...................#.........##..........#.............................#........................# +...........................................................#................................#...............#............##....... +..........................#...................#...........................................................#.............#........# +...#......................#..##................................................................................................#.. +............#..#.........#...#.........................................................#........#..............#.................. +.................#.................#........#............................................................................#........ +............#..#..#..#....#...........................#.................................................#..#...................#.. +....................................................#..#.................................#.#..............................#....... +.........#.#................................................#..#............................................................#..... +...##............................................#.....#.#...........................#....#.................#.#..........#........ +...............#.#.#.........................................#......#.....#..............................................#....#... +.............#........................................#....#.......................................#...#....#..................... +...........#.................................#...............................................#...........#..#..#......#........... +#.......................................###....#....#.........................................#......#.............#.............. +...............#.#.....................................................................................#....................#..... +##.........#..............#................................#..#..#..........#....................#..#..........#.....#............ +...................#..........................................#........................#.......................................#.. +#........#.#.....#............................................................##......#....#...........................#.......... +...............##....#.............#......................................#......................#...................#.#.......... +....................................##....#.............................................#..........#...................#....#..... +.....#...............#........#..............#.............#..#..#...#.................................................#.#...##... +........##.....................................................#.................................................................. +.........#.............................................................#.......................................................... +.............#.............#............................................................................#....#..........#.......#. +.#........#...........................................#....#.........#......#............#.#................................#....# +...............................................#.......#.............#.............#....................#.....................#... +......................................#....................................................#...................................#.. +....#........#.....................................................#.......................................##..................... +..........................................#............................................#.......#.....................#...#........ +................#.#.............#.....#....................#............#.............................................#........... +..............................#..............#.................#...................#...#.......#.................................. +.#...............................................................#..................#......#............#................#........ +...................................#.................................##........................................................... +...............................................................#....#..##...................#..#..............................#... +..............................#...........#.................................................#.#....#...............#.....#........ +............................#........#.........#.........................................#....#................................... +........................#................................................#....#..............#.........................#.......... +.........#....#....................#.......................#.#.......................................................#............ +.........................#......................................................#................................................. +.............#...#...........#...................#.#..............^........................................#....#................. +.................##............................................................................................................... +..................#......#..............................#...............#.##.........................#............................ +....................................................###........................................................................... +........#....................................................#........#........................................##...#.......#..... +.........................##.....#.........................................................................#.........#............. +.................#...........................................................................#........#..............#..#......... +.........#.#..................................#..#...................................#.................................#.......... +.....#............#...#............#..............................#..........#.........#....#...........#......................... +#...#...........................................................................................#.....#....#.........#.....#...... +......................................................#.#...............#......#.................#...............#.............#.. +.......................................................................................#.........#...#...........#..............#. +.........................#................#.................#...............................#........#.##....................#.... +.....#...#................................#......................#...........#........................................#..#........ +.................#................................#.#.....................#............................................#....#..... +...................#............................................................................#........#.....................##. +.....#.................................................................#..................#........#.......#...#.................. +...............................#..#...................................#..........#...........#......................#............. +....#................#..................#..........................................................................#........#..... +......#.........................#............................................#....................#....#.......................... +.#.......#....#.#...#....#................#........................#...................#...................#......#............... +..#...................#......#.#........#.........................#.........................#............#........................ +..#....#...#.......................................................................#......................#....................#.. +.......#...#............................................................#.................#......................................# +..##..........#..................#...............#.....#..#...........#....#...............................................#...... +...##....#............##..................................................................................................#....... +...........#.........................#....#......#...#.............................................#....................#........# +............................................................................#...............#..#..............#................... +.....#............................#.....................................................................................#......#.# +.........#.............................#.....#.........................................................#.#.....#.................. +.......................#..#.#.......#..#................................#.....#..............#.........................#.......... +.................#.....................#............................................................................#........#.... +........#...............................................................#....#........#.........#.......#......#......#........... +..............#............#......#..............#.#...........#.............................##...##.#..............#.....#....... +##....................................................................#.......................#.................#................. +............#...................................................................................................................#. +...#....#....................#..............................................................................#........#............ +....#......................#......................................................#............................................... +.#...#...........#....#........#...#.................#..............................#................#.##......................... +...#.................#..............................#................................#...........#................................ \ No newline at end of file diff --git a/2024/day06/input_test b/2024/day06/input_test new file mode 100644 index 0000000..f76349a --- /dev/null +++ b/2024/day06/input_test @@ -0,0 +1,10 @@ +....#..... +.........# +.......... +..#....... +.......#.. +.......... +.#..^..... +........#. +#......... +......#... \ No newline at end of file diff --git a/2024/day06/solve.py b/2024/day06/solve.py new file mode 100644 index 0000000..7e8a972 --- /dev/null +++ b/2024/day06/solve.py @@ -0,0 +1,55 @@ +import sys + +lines = [] +with open("input") as f: + for line in f.readlines(): + lines.append(list(line.strip())) + +found_guard = False +guard_row_idx = None +guard_col_idx = None +direction = None + +directions = [(-1, 0), (0, 1), (1, 0), (0, -1)] + +for line_idx, line in enumerate(lines): + for icon_idx, guard_icon in enumerate(("^", ">", "v", "<")): + if guard_icon in line: + guard_row_idx = line_idx + guard_col_idx = line.index(guard_icon) + direction = directions[icon_idx] + found_guard = True + break + + if found_guard: + break + +if not found_guard: + sys.exit("Could not found guard.") + +row_count = len(lines) +col_count = len(lines[0]) +while True: + lines[guard_row_idx][guard_col_idx] = "X" + new_row_idx = guard_row_idx + direction[0] + new_col_idx = guard_col_idx + direction[1] + + if new_row_idx < 0 or new_row_idx >= row_count or new_col_idx < 0 or new_col_idx >= col_count: + break + + if lines[new_row_idx][new_col_idx] == "#": + dir_idx = directions.index(direction) + if dir_idx == len(directions) - 1: + dir_idx = 0 + else: + dir_idx += 1 + direction = directions[dir_idx] + else: + guard_row_idx = new_row_idx + guard_col_idx = new_col_idx + +count = 0 +for line in lines: + count += line.count("X") + +print(count) diff --git a/2024/day06/solve2.py b/2024/day06/solve2.py new file mode 100644 index 0000000..faaf88a --- /dev/null +++ b/2024/day06/solve2.py @@ -0,0 +1,78 @@ +import sys + +def traverse(room: list[list[str]], guard_current_row: int, guard_current_col: int, direct: tuple[int, int], check_for_loop: bool) -> bool: + row_count = len(room) + col_count = len(room[0]) + previous_directions: list[list[list[tuple[int, int]]]] = [] + for _ in range(row_count): + previous_directions.append([]) + for _ in range(col_count): + previous_directions[-1].append([]) + + while True: + if not check_for_loop: + room[guard_current_row][guard_current_col] = "X" + else: + if direct in previous_directions[guard_current_row][guard_current_col]: + return True + + previous_directions[guard_current_row][guard_current_col].append(direct) + + new_row_idx = guard_current_row + direct[0] + new_col_idx = guard_current_col + direct[1] + + if new_row_idx < 0 or new_row_idx >= row_count or new_col_idx < 0 or new_col_idx >= col_count: + break + + if room[new_row_idx][new_col_idx] == "#": + dir_idx = directions.index(direct) + if dir_idx == len(directions) - 1: + dir_idx = 0 + else: + dir_idx += 1 + direct = directions[dir_idx] + else: + guard_current_row = new_row_idx + guard_current_col = new_col_idx + + return False + +lines = [] +with open("input") as f: + for line in f.readlines(): + lines.append(list(line.strip())) + +found_guard = False +guard_row_idx = None +guard_col_idx = None +direction = None + +directions = [(-1, 0), (0, 1), (1, 0), (0, -1)] + +for line_idx, line in enumerate(lines): + for icon_idx, guard_icon in enumerate(("^", ">", "v", "<")): + if guard_icon in line: + guard_row_idx = line_idx + guard_col_idx = line.index(guard_icon) + direction = directions[icon_idx] + found_guard = True + break + + if found_guard: + break + +if not found_guard: + sys.exit("Could not found guard.") + +traverse(lines, guard_row_idx, guard_col_idx, direction, False) + +count = 0 +for row_idx, line in enumerate(lines): + for col_idx, char in enumerate(line): + if char == "X": + lines[row_idx][col_idx] = "#" + if traverse(lines, guard_row_idx, guard_col_idx, direction, True): + count += 1 + lines[row_idx][col_idx] = "X" + +print(count) diff --git a/2024/day07/input b/2024/day07/input new file mode 100644 index 0000000..f617be2 --- /dev/null +++ b/2024/day07/input @@ -0,0 +1,850 @@ +9151: 132 1 8 714 972 5 21 1 +740: 136 4 40 1 85 71 +1959240: 61 84 4 6 563 +9619353: 62 7 1 9 92 19 44 17 3 4 +85383: 141 8 4 6 9 5 49 +468373294: 7 25 841 46 101 329 4 +634495747544: 83 6 5 5 5 8 95 8 3 7 542 +1473921: 18 1 54 270 8 1 +191617: 9 2 3 78 617 +105545: 1 49 5 1 209 +3074260824: 89 4 90 5 9 4 3 62 452 9 +7871304: 9 3 6 7 96 456 3 1 9 6 8 +113179142: 7 7 96 6 70 6 6 4 49 3 2 7 +65190: 79 7 3 7 246 +111675278: 3 856 13 5 11 9 1 69 7 1 +18232286011544: 911 6 143 5 4 11 544 +2525217842: 2 9 9 8 5 1 4 8 6 4 310 3 +2754: 4 5 8 51 7 4 6 +9742: 77 15 27 6 8 6 81 7 80 +996566149: 674 4 12 668 45 22 1 7 +161036550888: 71 12 27 7 8 550 880 7 +6631527185: 7 5 98 5 9 764 1 7 185 +626: 72 3 379 8 23 +339047997: 914 3 409 904 88 +91402: 115 786 951 60 1 +2463205322: 9 2 8 60 5 821 1 6 8 5 2 +11096244: 24 9 2 43 508 +2761679223799: 8 8 8 5 1 8 490 1 22 799 +9228832: 43 19 8 4 353 +27049036274445: 8 9 5 4 9 791 5 34 3 8 4 2 +1366911546: 793 7 22 123 91 +123461: 53 1 9 5 38 5 338 88 +3822: 63 7 6 +18091789: 1 697 8 7 951 83 785 4 +7714: 469 92 1 13 408 +30391973: 8 593 8 6 1 2 3 8 5 7 6 71 +353583: 6 41 6 29 7 83 +198733471: 66 244 3 595 876 +358201: 6 49 29 7 6 5 47 57 +986380800: 148 51 7 24 64 85 +101112: 931 72 22 29 37 724 +743680946: 7 9 7 5 38 34 23 9 3 49 7 +115585260: 6 6 92 6 5 25 894 +15917620: 1 4 414 140 272 180 +28029104911: 84 15 3 278 4 114 8 +1123377777: 2 50 299 7 5 176 4 4 4 +108274258: 39 209 8 80 65 4 527 2 +6517: 7 7 40 1 3 9 2 5 7 3 144 1 +34114050: 4 8 38 57 9 8 43 123 5 1 +116285217: 10 9 322 2 88 1 4 9 4 15 +57634: 1 496 99 1 6 15 4 4 4 4 2 +26014: 986 9 26 55 89 +9106125640: 956 3 6 1 8 496 522 5 8 +721: 6 60 361 +4047586935: 59 61 1 679 32 +44558521: 856 72 52 859 49 1 +560032830: 10 1 2 1 915 8 7 20 85 6 +1855165370808: 8 7 5 4 1 76 1 4 370 80 8 +1146142: 7 578 3 7 48 94 +329511: 469 7 2 10 11 +420024: 2 73 6 4 516 +126044109: 61 9 6 729 91 25 9 +48703404994: 408 9 3 8 54 6 397 79 4 +5979: 8 7 9 731 88 8 7 3 9 7 3 +10432490441: 939 853 2 4 5 3 37 41 +119418127: 2 64 3 3 1 1 7 5 60 1 2 7 +87128064: 4 39 44 4 8 696 +2130168: 1 5 8 6 9 757 8 7 329 1 9 +97426804: 75 36 97 372 4 +806038: 1 26 6 24 69 3 536 686 +1313845: 26 19 8 6 9 5 +22504: 7 9 6 962 940 400 +3587483330: 92 39 874 4 286 +874581: 8 7 458 3 +8216470392: 3 7 74 81 2 8 3 314 5 9 4 +139797569: 4 1 9 8 1 7 268 71 5 61 8 +50791720425: 7 4 25 2 1 48 76 80 8 4 9 +946998094001: 721 7 46 130 93 994 7 +173645680: 310 56 4 5 680 +34416111: 956 45 8 64 49 +3093564117903: 66 72 42 781 80 155 4 +60037497240: 670 4 1 8 5 9 5 63 30 7 4 +310072: 738 2 35 18 4 +47077801344: 9 966 18 476 632 +126008: 453 669 9 669 70 8 +264843: 20 1 3 6 1 4 51 4 45 +81426920: 9 9 426 1 9 20 +466206: 19 5 178 38 2 2 9 9 1 3 6 +752675046: 858 6 35 3 2 6 5 78 62 6 +4462816920: 59 823 27 746 978 +84744: 6 2 844 9 11 +11830537: 1 3 3 6 44 8 7 19 7 1 39 +63332543: 623 9 60 1 71 527 5 9 +194775: 7 330 4 19 1 12 1 6 5 15 +394568496: 494 85 42 651 976 +24439099581: 41 73 887 9 907 +174366325623: 6 900 722 95 35 624 +444: 66 7 41 1 80 247 +837: 67 1 3 330 69 367 +196056917: 88 2 8 1 147 7 9 2 908 8 +409060: 6 615 82 86 30 94 8 4 +47090: 9 164 1 3 2 33 4 7 2 80 4 +7175: 64 2 823 8 66 7 +20344478588: 3 405 972 2 53 513 2 +659821815620: 613 343 263 5 69 620 +802485555: 2 444 5 7 6 88 16 5 535 +102625677: 1 8 65 2 608 7 3 4 5 +51268162: 879 90 529 80 62 +1662663653: 40 9 6 653 6 6 9 4 46 1 5 +1749: 3 6 89 1 769 +2104465: 6 9 7 49 7 1 9 7 1 1 2 243 +39785040: 3 975 678 4 3 5 +325326: 463 7 9 49 64 3 +505443247: 3 6 3 4 31 2 3 9 322 2 8 1 +6685230840: 84 5 8 1 8 35 79 13 841 +555959866: 3 47 111 2 7 5 98 68 1 +1232050199: 943 6 6 4 7 864 6 1 2 20 +24433540629540: 82 5 83 718 629 541 1 +139844572: 834 9 31 601 286 +352024115: 81 457 8 1 6 294 7 95 +466754400: 72 51 3 9 224 63 +1956636464: 397 89 61 66 463 4 +179284672885: 40 8 82 86 796 56 8 85 +12195470: 7 7 3 710 95 1 38 4 3 +1450501930: 9 5 2 1 7 95 19 1 4 28 5 5 +214898: 8 406 2 96 9 4 4 7 16 2 +27864: 6 966 4 +34977: 4 7 6 6 30 +1128443492504: 8 37 9 749 46 25 2 2 +7965: 13 4 17 9 9 +7258: 1 8 50 7 7 5 8 +9527870: 3 451 8 118 7 46 +9428848: 7 543 125 5 91 +4401902: 5 5 3 1 53 4 3 5 9 2 146 2 +14286283265: 26 996 54 98 65 +2644109705: 279 32 16 2 413 808 +2068932: 61 7 5 969 7 92 9 7 2 +20472203604: 1 9 3 6 2 2 7 3 37 760 1 4 +58617495: 2 171 3 9 177 104 214 +398838423580: 301 18 8 8 92 235 80 +18786839: 26 8 7 1 7 64 919 9 +6278462: 3 956 655 389 1 +9088797: 36 17 3 5 1 5 99 3 +2974506427701: 493 1 2 8 8 737 754 1 +19231: 5 9 420 4 5 271 24 27 +2350420985703: 3 7 1 23 5 6 7 7 53 9 877 +2736: 334 1 8 63 1 +2231907992: 9 149 18 81 509 248 +1118593: 86 1 13 483 106 4 +420262: 68 123 545 571 6 +1386900: 2 67 5 21 516 1 2 2 1 5 5 +26430: 5 522 50 12 68 +1832437: 277 35 189 80 +27477720: 8 66 48 6 48 15 1 508 +789621523: 4 983 8 1 2 1 515 8 +49684854: 77 5 6 9 8 252 90 5 84 +2088517152: 4 3 90 63 7 2 876 53 +4067837: 763 8 42 567 5 +844082: 43 7 7 5 76 29 2 2 9 512 +54108: 67 9 8 56 1 81 +54075944: 870 92 47 4 299 +7776679: 89 5 7 48 71 66 7 1 8 +819893: 3 98 9 3 4 9 2 800 8 693 +1052: 5 1 7 25 +794511615: 18 49 79 9 613 +5775164984242: 765 937 754 42 4 2 +166105353: 2 8 1 1 557 8 994 +449204: 8 9 959 556 2 1 28 +1307419: 1 2 2 4 4 8 4 9 8 178 5 7 +136481: 1 2 21 2 780 3 5 5 7 6 89 +2845449257: 284 5 449 257 +147060: 4 3 2 9 190 +1154: 6 3 8 8 2 +8713340202: 2 3 8 1 567 66 49 749 2 +285498: 154 269 672 495 747 +93244906260: 257 48 31 5 59 60 33 +199254: 9 362 8 51 3 22 +52132: 5 6 8 3 9 6 3 85 990 5 7 +81110: 4 912 157 16 6 +217141: 75 4 7 71 41 +243480250794: 6 67 8 6 7 4 6 744 1 7 7 4 +1461781: 90 66 6 42 9 1 1 +17748024: 7 7 80 926 5 4 10 87 24 +3203786001678: 46 7 4 1 45 85 8 1 678 +202847059: 7 1 943 2 470 59 +19485111: 39 9 575 2 496 5 146 +112166340: 701 2 8 60 2 74 69 +2188134198: 51 3 7 4 1 341 1 6 82 +10944961: 9 5 7 161 89 9 10 6 3 3 6 +42331808802: 2 1 4 5 7 65 37 2 746 6 2 +5325792196: 8 9 374 2 40 1 2 7 2 7 9 +12021872: 51 614 23 393 1 1 2 +4767141: 611 17 2 39 15 +3718357725: 7 1 1 5 1 5 5 5 44 2 5 417 +7646335: 41 4 41 889 84 851 +40469: 8 5 1 3 67 +615330: 643 26 918 300 888 +50260150: 359 700 5 2 8 8 6 5 +125520: 5 5 963 73 120 +647346227: 6 437 8 76 87 295 34 +29711242851815: 70 474 259 897 47 4 1 +5548803: 5 2 32 7 66 332 87 +450: 19 3 23 5 9 +132343: 8 54 40 4 2 3 52 4 3 4 27 +1179858960: 6 70 333 5 7 74 18 +497886150: 199 444 805 7 4 86 +141950: 4 7 8 1 7 8 46 543 4 6 9 4 +149735820035: 153 5 752 975 35 +100199700585: 91 94 765 708 1 583 +1044062784: 2 3 1 755 4 8 661 4 1 16 +5204633552: 5 5 52 4 63 22 7 5 1 5 5 +3620: 1 4 28 6 94 3 45 +295284: 3 41 40 60 84 +48248907: 902 19 8 938 3 5 4 9 3 +615145: 2 1 209 29 84 +2709056: 443 8 5 6 56 +54847043762: 2 7 704 3 746 4 5 5 5 1 8 +1120898: 56 6 6 556 +106037568094: 89 6 770 442 40 36 9 4 +19146429617: 32 28 7 2 7 1 6 959 7 53 +15963224760: 2 248 993 7 4 5 6 212 +776736688: 211 9 63 5 31 87 688 +364586: 18 346 49 9 6 +14059350: 8 2 363 6 8 6 785 +8619: 4 2 619 +16720759: 636 291 710 9 4 9 6 +798569985: 637 928 823 5 51 +210270837: 964 1 7 862 3 541 3 7 2 +2778624710: 231 10 2 4 9 4 8 7 1 2 1 +2153: 387 13 26 1 3 5 +3148076678: 314 807 667 6 1 +16220433195: 9 9 6 3 45 275 1 899 46 +29050653: 7 7 4 29 9 64 7 3 3 +4504999: 8 9 3 9 7 91 2 2 6 8 501 7 +24476553: 2 610 799 84 7 25 553 +960837415277: 24 68 388 213 26 4 77 +362770: 58 781 28 8 5 15 142 +98892626: 120 44 67 9 626 +56: 2 1 53 +264046: 4 970 7 5 53 +362427305: 6 2 9 423 84 4 6 15 7 +319715433: 8 928 7 9 259 8 7 69 69 +227299: 415 3 3 7 1 2 1 6 9 3 4 80 +2284578: 8 660 4 242 784 2 +2808058480: 90 390 731 8 2 +516: 22 1 22 5 464 2 +992: 4 39 50 31 7 7 3 8 99 5 2 +289123: 141 2 17 694 8 3 +564264010: 9 159 96 17 44 14 +485047: 67 740 4 598 69 +3790642776: 984 6 2 21 207 642 +95881: 604 2 1 3 9 52 877 +593105029510: 920 969 644 993 511 +24022618098: 1 5 3 9 3 9 8 5 972 4 7 94 +58556544: 30 4 1 5 794 218 6 32 +253136185: 506 270 5 11 26 57 +5474366: 741 6 246 414 4 3 8 96 +16587427068: 729 79 72 304 767 4 3 +50874781: 6 96 883 139 7 9 +5895: 75 7 130 9 +242279046: 13 9 6 520 4 52 8 80 6 +2242: 4 559 8 +11592154: 1 89 1 268 1 1 664 490 +16020118: 6 709 400 62 1 56 646 +1299962: 20 47 80 98 27 7 16 4 +295680: 1 3 5 40 52 800 5 8 +10464417: 9 2 6 27 3 3 34 83 +34462664411: 78 5 3 1 5 666 4 38 3 2 +8555: 96 88 59 44 4 +1169280986289: 9 4 35 928 9 86 289 +276164011: 119 444 60 49 14 1 +318180816: 53 6 175 5 814 +2591: 2 5 75 2 58 8 3 +32533493: 6 6 5 7 3 55 9 30 53 3 23 +229398: 266 4 1 45 1 5 9 16 663 +1728893159421: 8 1 28 9 8 566 69 11 1 8 +76054443206: 7 7 1 3 54 28 4 7 8 6 58 7 +35589: 20 57 66 1 7 1 1 14 +1253928: 74 5 65 64 52 +13626929426: 2 90 700 2 147 26 +17809524054: 51 5 1 97 4 5 72 54 +224832107: 93 68 3 8 107 +71645285: 98 143 73 89 5 +1030424: 4 6 5 87 596 4 5 92 7 5 +14471016: 516 57 82 52 6 +172454: 4 9 9 2 266 78 8 +855653: 5 2 82 8 65 287 366 +1226600: 7 37 1 473 5 58 8 7 979 +447240: 3 64 833 8 323 426 +15238243461: 21 7 39 2 69 9 730 2 +1071922335: 7 7 4 3 2 96 116 5 2 5 +229848187: 3 241 942 149 38 +45344183: 3 3 77 42 308 3 651 81 +4901: 888 7 5 2 424 +46609776: 568 1 34 82 589 6 +47824041: 469 33 515 6 108 3 +4985084: 1 912 5 34 2 13 +93130324833: 4 3 8 9 2 71 28 9 2 4 67 3 +149374: 30 1 118 37 4 +1027499: 6 55 3 7 100 248 3 34 1 +1019443816: 5 5 94 393 92 7 892 +148406254: 4 2 397 86 89 +1046424933: 5 48 276 19 5 40 9 837 +789121218468: 394 17 64 3 12 184 68 +24606: 394 61 1 26 531 8 6 +32826875: 5 3 24 35 2 7 449 8 75 +78610925642: 4 61 99 8 7 14 9 256 40 +563129: 19 9 9 1 939 5 501 1 3 2 +1185206173: 469 9 41 824 5 3 2 5 4 9 +88615648: 9 7 3 2 94 806 3 6 9 7 21 +3541: 44 3 74 8 55 +104271660: 3 487 26 633 6 8 15 3 +20881: 32 651 3 2 44 +1876729: 4 168 9 780 748 +28509624384: 996 8 4 286 3 84 +1026553844795: 74 92 52 5 527 4 72 7 5 +29043744111: 6 437 2 2 6 47 8 5 2 9 1 +1722468804: 9 2 4 636 9 6 142 1 866 +270229300: 6 6 890 10 4 3 48 5 92 +3004099: 894 6 28 6 8 2 78 45 +3616992: 3 60 600 8 1 5 51 1 4 9 2 +214643388: 39 55 73 70 388 +914715656: 7 1 20 11 3 352 9 4 8 8 +21106475520: 119 1 213 6 1 130 2 32 +53262303: 68 2 8 5 780 5 +507716: 498 7 81 85 60 45 6 +19438755840: 4 3 6 9 96 28 16 5 558 +684865: 66 7 18 52 71 9 78 5 +50379008: 2 9 8 843 83 261 2 5 6 7 +1751841: 125 36 403 9 3 +411768738: 9 65 20 73 78 92 231 6 +25: 5 8 12 +69387321: 69 3 8 731 8 +74878624: 1 20 379 7 8 1 2 6 7 4 4 +17592: 8 9 5 8 9 +55543298: 7 822 1 9 710 +52244409: 884 985 6 4 5 +27014: 270 1 4 +290549879: 538 3 5 83 360 +57134: 9 693 9 1 79 965 +1602647: 6 9 68 23 7 +2542: 24 47 1 7 88 +1341748: 134 167 7 1 8 +49167143: 3 79 37 108 38 12 336 +1229666510: 17 376 391 45 3 1 4 2 4 +918: 9 1 7 54 +1066482049: 2 2 7 7 6 3 7 53 6 9 535 9 +401582160: 340 7 86 6 327 +11328164873: 3 77 9 1 54 5 7 9 34 2 4 1 +4608: 6 5 719 6 6 78 +523320: 27 6 9 81 602 534 +5810: 8 70 8 84 9 109 +678988872: 9 3 99 4 126 8 56 4 4 9 +3745560: 28 7 546 35 2 +10516660: 3 3 53 9 34 26 3 8 7 70 2 +255469822776: 7 87 7 3 48 79 95 4 3 9 8 +69634: 2 298 5 3 26 74 +16699318278: 9 277 3 99 30 1 6 5 6 5 4 +18603: 69 8 5 3 8 +67053055690: 1 2 515 434 4 1 569 3 +141888: 733 6 1 3 64 +873288345622: 15 161 19 6 6 96 6 2 3 +112480808: 8 15 6 61 8 64 628 1 4 4 +8506730: 69 70 93 658 766 +10772735: 8 3 624 8 26 +29935635: 36 8 22 85 1 5 811 +870: 46 85 22 1 715 +96866: 8 1 260 7 5 2 5 2 1 9 8 7 +21406467537232: 37 24 2 35 5 8 376 482 +24602893: 72 8 2 2 8 8 2 96 3 873 7 +140909724814: 297 27 7 9 158 5 1 1 3 4 +3454011: 575 49 2 3 354 3 +286400393: 706 86 89 57 53 +18063592456: 9 808 6 56 511 767 +27428489: 421 83 2 544 9 +1796674401: 9 11 4 7 6 72 2 326 5 4 9 +337021994: 6 311 29 9 692 2 +7026159: 78 8 53 8 59 6 159 +443282: 382 16 45 1 68 34 7 73 +1046899268800: 466 6 9 779 4 1 7 880 4 +3651: 346 8 7 30 74 +572386770216: 6 8 69 7 7 50 55 6 486 +21346403103: 981 207 3 40 876 57 6 +2463381202: 7 4 6 3 3 8 52 77 55 3 94 +30407481: 9 5 621 318 4 +13515323217: 681 1 592 6 49 33 +1087609539: 332 9 2 90 431 416 +410953440: 9 91 93 5 987 955 485 +171585054: 124 6 72 1 256 174 9 +28973728: 25 3 1 96 5 1 8 6 83 4 7 8 +345430: 60 2 55 269 778 +2723562: 7 1 7 9 5 5 5 2 37 5 8 2 +24545063129: 6 6 3 3 4 2 9 43 20 1 930 +189356832874: 4 836 2 2 3 6 2 786 874 +1664708: 3 1 79 2 2 523 +3234: 566 1 4 9 66 8 879 6 +51568806: 978 8 44 9 4 97 91 8 2 +21978100: 17 65 67 525 4 +516143: 6 309 278 731 +1604981961: 862 1 4 8 5 7 7 6 69 8 4 9 +230: 9 21 2 7 1 31 +29711: 3 981 22 6 55 +7387441984: 52 2 76 2 557 839 +2497700061: 2 7 26 37 81 29 9 +283450487882: 9 446 7 3 5 8 4 9 596 5 6 +4611600047: 823 5 160 35 47 +18762785: 3 101 90 688 60 965 +6039720: 6 4 9 699 1 2 7 1 5 5 25 4 +18778179043: 7 9 81 3 6 8 7 528 3 1 13 +107610050: 8 50 7 4 952 8 13 6 7 3 2 +322506: 930 55 36 95 270 9 9 +112567: 1 3 874 8 8 72 1 2 12 27 +2187945065478: 6 853 342 5 2 6 5 9 6 5 +378542670168571: 94 635 6 67 542 4 571 +95370: 36 20 2 5 66 +60925172439: 572 3 202 5 2 710 19 +1864083431: 11 65 2 8 83 429 +130006538: 3 49 5 50 6 4 1 1 93 45 +45205660: 3 44 5 7 2 98 20 9 6 1 4 +4473939: 5 8 902 6 79 885 9 +9229836: 3 4 6 5 5 811 9 194 80 6 +126846796: 4 1 4 3 783 79 6 +354965538790: 3 48 6 965 5 3 878 1 2 +1523: 8 561 881 2 71 +2911951343: 41 157 34 5 9 1 343 +3411360640: 3 5 1 885 2 103 6 3 641 +8384: 90 5 11 3 8 +58070691758: 9 796 988 626 6 +4606: 38 79 56 669 2 +1855761377: 1 2 4 177 57 6 12 95 82 +8785483574: 6 27 5 2 1 5 53 8 2 82 1 7 +12108: 70 32 969 889 58 6 +14567: 1 6 12 78 7 4 480 237 +150941: 5 7 5 90 941 +786264: 6 788 1 989 396 602 +51732: 39 781 63 2 70 +4021802: 7 718 7 8 6 436 +307443454: 482 30 405 76 6 +6876720: 68 767 1 6 1 +3775473626: 94 38 684 4 26 +477729: 96 211 222 93 7 +186422884169: 1 2 86 92 6 2 8 6 4 16 9 +10320797: 130 8 4 992 29 +5947214674: 5 94 72 146 74 +75017587536: 75 10 1 758 753 6 +87977: 28 7 80 579 93 +595019375: 3 2 736 1 199 7 976 63 +5401506: 68 355 82 223 +423147: 6 7 23 6 2 38 9 +37519365: 9 8 92 5 360 98 5 8 5 +153574577: 86 21 7 172 8 829 670 +749: 292 79 378 +1322409: 397 871 46 8 409 +1616671693: 9 6 3 4 4 43 2 6 9 9 2 469 +8395504261: 2 4 39 542 3 5 4 2 63 +1485870: 6 2 9 8 9 7 35 847 4 722 +1438: 4 13 880 463 3 40 +272444064: 7 3 3 5 33 7 7 2 6 1 944 6 +463128200: 92 625 6 40 5 +17757: 5 62 57 81 7 +223440: 6 94 9 264 3 9 95 2 +17536: 183 3 337 22 8 +159298: 73 85 491 802 5 +7217725681: 3 1 88 3 3 2 94 7 7 40 46 +9102004482: 8 6 20 37 4 99 8 1 143 2 +73: 6 8 11 9 5 +522: 73 14 6 +2317: 3 88 75 6 654 +45537732: 7 1 1 58 95 2 1 5 9 5 2 6 +292143828: 683 6 801 6 89 972 +26166150: 82 7 25 7 6 2 95 8 6 3 75 +524161499002: 73 825 563 24 71 +535311: 89 675 7 90 65 356 +912: 4 6 866 +26016: 796 8 89 47 4 +1953265: 8 8 8 3 5 8 5 64 3 9 7 370 +184602403: 18 10 3 32 62 40 403 +16262943763: 146 8 88 2 90 6 8 29 6 2 +102402849: 328 214 8 39 81 +28237920: 1 5 575 902 14 2 4 267 +823891: 85 2 736 8 94 +146882851: 706 25 9 885 94 919 +5015: 9 1 3 412 71 1 +39960936: 2 5 365 2 85 6 92 184 +149149800: 79 4 7 41 47 860 +245273298: 272 525 6 1 7 7 5 9 +36014801803: 3 5 1 9 2 296 5 180 2 +9268771223: 122 92 8 754 23 +3879: 1 7 5 97 +6366882079: 5 280 25 1 73 5 4 3 2 5 9 +22651880: 4 566 2 2 376 5 +416: 397 2 17 +7522024: 666 3 8 7 7 644 36 76 +12054942: 1 16 48 872 6 125 13 3 +1804617: 8 77 14 505 4 2 16 +4979592: 1 684 479 62 69 +13230: 7 7 5 6 9 +188694006: 260 7 955 1 68 74 +664824301: 76 399 783 4 7 925 +99691298: 7 72 2 989 98 +2957: 40 58 8 516 52 61 +20566962720: 48 3 2 704 221 2 4 6 54 +768427128109: 8 50 10 3 904 810 7 +6527661: 8 36 61 9 1 993 2 9 2 4 +28558016: 237 908 7 738 4 3 17 4 +5416190: 6 9 136 814 7 3 611 4 5 +3058632: 384 4 2 895 7 59 92 +13389382: 8 7 1 2 759 7 295 1 7 2 +162903312071: 6 520 30 6 586 9 55 68 +1105: 4 2 86 1 184 +156: 83 34 5 2 32 +75682: 2 97 759 5 79 +738707: 7 4 7 9 54 916 7 +181872944: 2 6 48 511 3 339 93 9 5 +6916941511: 3 688 6 9 3 83 1 8 24 11 +215342: 3 3 7 2 534 69 1 67 540 +399338: 7 114 8 7 956 +2973648: 9 333 992 84 7 533 +3201299426: 1 2 3 5 1 8 43 2 57 2 3 23 +522701569: 5 22 58 3 9 15 5 2 1 6 8 2 +303731392: 5 1 9 9 930 84 35 63 6 8 +34897940825: 610 13 46 89 44 8 25 +29346: 8 3 49 67 6 +60466566943: 4 6 3 3 3 29 91 68 438 9 +3078173: 276 237 6 164 9 +1526065: 61 5 316 3 2 44 73 +1346: 382 814 9 45 96 +9683184: 9 2 5 537 16 7 7 +47632853: 79 363 25 6 54 +18427387459263: 2 9 42 7 385 2 4 592 62 +72445: 1 1 76 9 93 +354603: 9 3 8 2 29 4 893 975 +30207570456: 21 449 202 83 84 +1601402382: 623 34 56 7 6 47 18 +805: 51 5 618 89 42 +453218: 453 156 52 2 8 +2454691634: 3 7 52 4 58 67 7 16 34 +4249375: 376 8 3 2 5 4 44 8 7 18 4 +11202362: 466 76 1 5 24 +13890175488: 495 575 352 9 778 36 +77784300: 82 512 5 97 15 6 3 +3417: 17 5 91 3 3 2 46 16 2 3 3 +158868604400: 295 538 158 604 400 +14794788: 7 3 3 10 469 72 734 6 +496329: 55 9 51 2 1 90 726 +49702: 5 967 66 69 2 +5820848128: 65 789 227 5 1 8 611 +9911: 900 9 905 +2116507855: 939 7 7 46 926 920 9 +678377763: 7 35 8 866 57 3 8 1 9 6 1 +15252661: 8 7 25 265 8 +432963: 6 1 16 8 1 9 4 395 8 1 4 7 +462883134: 2 314 4 1 5 5 4 9 5 5 989 +20394944733: 2 40 259 72 280 1 93 +25449007500: 56 3 875 82 630 +673: 4 6 6 9 98 35 +433234809674: 481 369 3 45 2 962 5 4 +2231307: 932 1 1 5 239 +5496: 421 29 8 1 1 12 +361056486: 95 38 527 33 4 86 +14832: 2 119 7 +55377: 355 66 256 9 58 2 9 +3672207430366: 64 290 1 229 9 7 33 96 +924506: 8 1 8 7 7 307 4 825 72 7 +585727992: 406 75 29 24 2 5 72 +4464: 4 3 50 9 8 +969362: 2 30 8 420 +91356570230: 3 6 6 34 2 9 92 9 3 6 2 28 +21019: 41 38 543 7 +24076855887: 481 53 2 3 2 1 17 7 5 2 +5655436: 4 1 5 666 6 62 8 5 22 3 3 +2196815: 6 1 6 6 742 76 +197984593: 394 39 502 4 806 +225: 7 3 3 1 9 +54870: 914 4 1 6 +966: 25 9 641 93 7 +37809635: 53 269 851 87 321 2 3 +3735230: 18 717 5 43 1 36 995 +514763246: 3 8 21 10 76 3 23 1 7 1 9 +203727: 7 6 82 79 720 9 +17269915: 8 7 15 4 4 2 95 6 69 2 65 +10989115532: 7 8 1 650 6 4 6 2 3 11 3 5 +42746579602: 70 422 7 607 2 86 414 +128541973: 67 37 954 2 1 4 +2255236: 5 80 424 931 61 5 +335089472: 6 10 5 904 5 6 68 478 +342735588: 17 14 40 433 36 +9159: 9 21 35 27 5 384 +955712: 6 199 64 8 +429600: 1 96 52 29 4 100 +16629466: 870 9 41 38 70 4 46 7 1 +428326080: 2 8 6 715 4 6 2 6 4 65 6 +11696320: 36 547 4 40 8 +3480960: 60 14 8 74 7 +9707101: 995 6 975 +1408: 2 510 386 +82190387178: 821 871 32 8 7 1 81 +3057975750: 765 3 47 3 7 9 8 8 4 5 5 6 +1089290533: 3 4 3 5 1 603 7 69 533 +4645808: 451 2 133 771 37 +1875141773: 24 353 997 74 34 6 3 5 +1485138665414: 3 99 28 74 6 95 47 414 +37584: 87 9 6 8 +54241847: 3 530 6 7 341 +831532886240: 7 3 8 3 525 1 827 140 8 +2269440: 34 64 2 97 15 768 +3335: 5 3 8 6 92 24 3 640 +1607: 9 5 1 35 +926184: 88 19 82 7 7 84 +211117960879: 9 5 8 20 866 7 67 691 7 +9035504: 8 36 1 7 193 2 8 +1081599840165: 4 7 30 8 782 9 34 33 5 +1193940730: 958 47 18 66 7 30 +655320: 6 551 71 9 28 94 17 +2132901: 8 6 2 3 9 6 9 3 7 10 277 7 +6688892: 1 667 88 83 3 6 +5173437: 14 87 8 35 64 +29980: 23 13 54 26 +78634578: 65 55 8 3 34 6 803 +51202768: 420 4 2 878 2 359 409 +329599694594: 533 1 258 84 32 23 +419178834: 4 41 5 2 9 2 8 1 2 5 9 246 +203412475243: 4 168 6 5 2 6 47 4 5 7 4 1 +27075: 7 2 1 3 62 852 +416831779: 8 533 5 399 91 7 7 +3976787: 52 2 9 7 865 9 +240484: 70 1 885 5 48 8 2 1 236 +1959168: 573 4 2 4 223 9 3 8 4 8 3 +13400405953: 7 403 5 392 181 +54686971: 6 6 3 12 1 9 479 3 559 1 +15780086: 8 2 4 24 4 8 9 2 94 8 80 4 +5328139588: 877 15 9 50 9 7 1 9 6 13 +103650: 7 9 9 6 3 4 14 2 51 984 6 +1132504: 3 47 906 5 5 4 +1325436: 64 445 1 4 651 +522368033: 985 59 53 53 36 +17934048: 5 4 6 748 74 +32923: 8 80 5 92 3 +1684403: 68 375 9 66 64 2 734 9 +111745: 89 91 7 88 411 2 452 +13263230: 163 3 131 62 4 +3868986962: 6 42 362 167 98 72 8 5 +11345670: 3 43 145 63 27 +319239004896: 50 6 72 85 768 16 8 63 +3034544540: 3 5 867 4 33 12 4 3 +40627: 4 51 4 9 +47169937111206: 47 1 69 937 111 208 +112164822847: 5 804 2 7 7 66 3 84 5 2 1 +5803503559: 7 7 904 7 6 868 88 2 6 +11634120945: 947 6 29 4 306 943 +34851742: 913 7 9 3 63 55 98 +6297303600: 8 72 2 2 653 5 4 6 5 490 +9669310775124: 869 94 1 629 308 611 +4741903666: 6 1 9 6 182 6 77 1 6 4 2 6 +1410872158446: 7 5 271 80 3 958 7 4 98 +343116238185: 10 359 7 898 36 92 9 +400086541453: 837 478 54 1 453 +6515098: 63 25 7 270 254 +348: 30 4 6 +239609608: 1 1 6 19 5 33 607 28 53 +7414288540: 49 42 859 3 5 4 10 +96771: 6 200 1 8 43 1 37 56 3 +1894118717: 281 674 2 176 68 3 7 +6310857469: 80 8 6 160 6 3 5 11 7 6 9 +6182479: 6 72 92 77 2 +1032: 925 2 57 48 1 +1091687: 8 8 2 736 2 6 915 2 999 +543443: 92 1 59 3 49 +165718061: 2 7 6 22 24 445 5 6 5 +610745: 754 9 9 1 5 +5361319385: 8 8 2 3 777 193 76 9 +6159: 191 1 4 907 61 5 339 +493628437516: 7 421 75 9 5 9 3 7 1 886 +15757062: 104 293 147 2 9 9 3 51 +11216: 79 480 142 2 8 +6822: 23 13 3 7 543 +3388859842: 5 8 555 43 87 25 170 +8334: 25 77 9 75 9 +2250866676: 8 7 29 9 3 9 42 5 7 86 7 4 +89826408460: 4 411 863 36 6 457 +153485: 23 922 642 7 437 112 +36262905: 3 4 4 61 2 571 1 5 13 5 5 +22502497: 970 280 2 9 2 498 +2331369: 84 70 3 5 900 5 734 27 +22804091: 54 711 60 593 869 +24912366556: 76 4 88 3 700 607 7 44 +781102: 324 8 7 20 39 24 +341021: 41 9 881 3 51 46 118 1 +125012160: 48 14 56 952 36 45 2 +8601135: 928 45 3 6 9 20 971 17 +580850: 29 5 40 96 712 44 +26137464000: 61 1 95 10 860 4 129 +86455555: 868 9 199 1 5 +353502837: 5 11 261 66 969 86 9 +1766966: 243 665 65 2 908 +40398720: 8 59 727 795 64 +15777929: 1 36 6 6 886 8 6 35 +26640: 12 14 9 26 7 52 2 7 7 1 9 +6825793: 8 245 8 578 6 2 4 759 4 +7785132: 64 310 18 2 7 7 8 9 3 +5165452178: 239 350 658 34 633 +41027: 607 6 4 50 406 7 +109810788: 3 1 6 860 2 4 9 95 7 1 1 3 +3302: 87 63 8 60 27 226 7 5 +9182593: 1 5 274 62 98 2 9 2 5 73 +111608008784: 5 9 702 6 213 8 6 3 688 +82474315: 4 407 77 8 591 20 51 7 +3266534: 4 211 645 9 27 6 6 2 +235297: 806 22 7 5 5 8 7 26 71 +2902992: 12 32 5 8 67 1 36 38 8 +757673: 39 75 7 37 98 +5392: 852 6 13 26 241 +30316819: 606 5 1 15 799 21 +84160936096: 8 9 153 530 4 944 +18573: 2 2 9 7 72 29 397 3 +3400587: 339 9 6 9 88 +59117080933: 6 58 4 707 23 7 3 8 5 8 1 +709244949: 7 164 99 8 7 6 8 5 5 8 +256666: 631 3 4 3 380 5 30 278 +149736926: 594 4 77 5 3 21 6 96 2 +51400927: 8 69 782 45 853 +24013402569: 7 9 3 614 54 584 98 9 +41468325: 2 74 88 3 8 15 382 769 +80871091: 36 3 720 1 18 25 1 2 8 3 +437200704: 4 10 7 860 4 131 5 49 +52531364: 52 53 136 5 2 1 +1159045536329: 60 1 95 2 276 79 2 5 29 +30401139: 3 36 415 44 92 1 5 654 +855593039661: 7 8 4 7 1 3 6 328 2 6 2 66 +19362670: 1 314 442 87 98 3 124 +9366020992: 124 88 15 31 5 8 541 2 +79281216: 411 66 28 742 8 +2185054238: 79 63 8 343 2 61 7 40 +53587566: 6 918 47 69 78 3 +356106996: 4 5 8 7 96 92 9 175 7 7 4 +5372: 71 8 68 +42886097: 561 8 78 6 67 140 737 +2103466457: 4 72 14 60 9 73 +724634064: 8 2 2 599 2 8 6 4 26 2 72 +8940017483: 73 575 5 39 9 135 98 +734376: 2 4 62 455 888 +54967: 24 21 7 8 214 86 787 +25455: 2 3 8 467 8 925 3 3 3 2 3 +1706: 792 13 901 +16791586: 6 3 582 4 4 27 26 9 75 +1710311: 85 9 85 4 13 92 8 98 2 +178: 90 81 7 +2750345348: 5 7 298 853 8 4 4 3 2 3 2 +14913758: 9 271 33 16 264 9 58 1 +26509773: 4 6 104 10 192 13 771 +317152: 4 8 13 8 748 +54215093: 541 1 150 92 1 +14652360: 24 4 2 6 1 297 61 2 +147456741: 46 37 318 72 68 +135995340: 755 18 9 530 2 38 +5483610: 41 568 288 2 9 +265251335: 7 7 9 9 7 3 34 64 2 4 3 5 +444155: 38 74 566 78 75 +126994861: 23 4 157 3 17 4 861 +5528579: 6 5 3 8 8 1 3 7 7 7 34 624 +2198016422: 646 2 1 8 424 424 +16522: 5 7 9 9 51 +159183412: 320 141 392 9 52 +650538326: 6 46 7 1 26 8 4 3 824 8 6 +77169: 237 65 8 7 5 69 +49257063: 584 1 842 56 7 +51989200: 553 94 6 9 56 4 10 4 56 +636276292: 357 69 1 7 9 9 41 +5011587678720: 51 320 643 32 7 678 +62832226: 9 87 2 6 35 364 3 226 +324973544: 1 4 6 9 54 9 735 44 +43107424: 6 62 423 63 93 4 +1329: 3 7 11 1 921 +8127180: 4 5 2 35 1 5 9 43 55 5 3 +1646401: 6 276 1 7 2 1 7 6 8 800 1 +15569384: 37 40 4 763 1 597 787 +553222: 2 78 2 5 349 57 +667200: 91 610 24 66 12 +516301112: 573 630 6 365 9 1 721 +1375256534: 764 9 28 267 2 +24960320: 229 2 5 23 494 14 40 4 +54337879040: 7 2 37 3 3 37 878 98 5 7 +194164: 57 85 4 6 30 4 +214404579: 127 55 5 7 877 4 +91527: 3 6 73 5 2 7 +2551884: 287 616 314 9 6 +48941720325: 6 7 9 74 6 40 4 6 2 9 2 9 +9203: 16 575 5 +14256435294: 348 5 681 409 4 +3318458: 83 563 71 697 2 +36500: 52 7 32 6 62 +16233851004: 143 9 4 6 4 18 157 2 7 +130073: 73 9 22 8 9 +41452: 7 1 7 7 893 8 8 4 4 6 54 +29730573: 81 4 8 6 6 5 82 6 509 73 +451552: 27 147 928 2 2 292 8 +3607962: 5 67 97 3 6 37 1 784 8 3 +26553: 9 4 8 5 5 3 4 653 4 6 33 +99871: 3 26 67 3 871 +7974822: 79 7 431 6 506 +1065219: 42 1 44 12 48 771 +5804229: 602 964 37 58 1 +583501: 1 53 20 3 8 19 8 +8588035: 8 1 556 80 38 1 6 5 +2580648233: 9 7 2 8 1 6 727 8 6 9 9 69 +4013: 8 7 47 541 177 657 3 +4153099: 3 4 4 2 3 1 15 3 6 3 615 4 +232804: 539 972 51 533 5 3 7 +2309375607: 68 6 3 1 5 74 7 195 1 8 +769560: 3 90 7 40 458 8 1 6 2 8 4 +1016784: 78 7 6 6 307 +1178617147: 864 3 489 278 3 5 +38149143: 6 69 282 57 69 +665229: 98 7 5 67 9 580 +4130590464: 406 987 78 33 192 6 +447: 4 86 357 +3914899837: 4 2 156 4 4 66 3 1 1 3 1 6 +56259883189: 3 48 8 2 6 92 2 2 7 28 6 9 +2622: 12 7 4 2 74 +194536: 97 268 2 +31098614: 921 6 97 72 8 78 3 58 +948415: 4 4 8 8 96 8 527 67 2 4 5 +2672: 752 90 680 554 596 +476795: 45 8 6 6 9 6 4 6 5 9 4 412 +20759512: 2 6 8 8 4 938 8 869 840 +88817568: 97 6 7 6 2 668 9 6 1 8 12 +670085900344: 351 76 350 7 8 1 4 49 4 +755086: 4 3 7 840 59 730 9 2 4 +432946594: 432 946 1 49 396 46 +620888945040: 79 8 6 3 49 7 510 4 91 6 +9711: 856 9 839 168 135 +194558935285: 2 2 772 237 63 4 285 +758: 7 750 2 +6280922826: 4 32 9 3 3 7 6 5 7 81 9 +138895: 8 322 4 68 95 +1025917474: 6 30 395 917 47 4 +164811353: 4 3 67 35 66 1 356 +75636042382: 9 950 7 38 88 42 379 6 +3167998: 619 12 29 960 5 +1481204467: 5 2 5 8 4 175 2 4 38 8 8 1 +9923388: 2 515 47 23 8 51 12 +541863871: 541 86 38 7 2 +56829631: 3 5 7 676 9 144 632 1 1 +3465276611: 5 5 2 9 21 11 25 1 613 +10455518: 2 9 163 4 221 8 +45296160: 99 681 3 3 7 85 6 7 16 +142800: 8 6 7 34 2 971 1 8 5 50 +91872: 30 3 30 498 24 +55018317: 16 95 832 472 39 546 +4901324998: 919 5 77 83 53 8 \ No newline at end of file diff --git a/2024/day07/input_test b/2024/day07/input_test new file mode 100644 index 0000000..87b8b25 --- /dev/null +++ b/2024/day07/input_test @@ -0,0 +1,9 @@ +190: 10 19 +3267: 81 40 27 +83: 17 5 +156: 15 6 +7290: 6 8 6 15 +161011: 16 10 13 +192: 17 8 14 +21037: 9 7 18 13 +292: 11 6 16 20 \ No newline at end of file diff --git a/2024/day07/solve.py b/2024/day07/solve.py new file mode 100644 index 0000000..4737c9c --- /dev/null +++ b/2024/day07/solve.py @@ -0,0 +1,38 @@ +def is_valid_entry(ent: tuple[int, list[int]], current_result: int = 0, current_index: int = 0) -> bool: + if current_index == 0: + current_result += ent[1][current_index] + return is_valid_entry(ent, current_result, current_index + 1) + + if current_index >= len(ent[1]): + if current_result == ent[0]: + return True + return False + + new_result = current_result + ent[1][current_index] + + if new_result <= ent[0]: + if is_valid_entry(ent, new_result, current_index + 1): + return True + + new_result = current_result * ent[1][current_index] + + if new_result <= ent[0]: + if is_valid_entry(ent, new_result, current_index + 1): + return True + + return False + +entries = [] + +with open("input") as f: + for line in f: + line = line.strip() + split = line.split(": ") + entries.append((int(split[0]), [int(elem) for elem in split[1].split(" ")])) + +result = 0 +for entry in entries: + if is_valid_entry(entry): + result += entry[0] + +print(result) \ No newline at end of file diff --git a/2024/day07/solve2.py b/2024/day07/solve2.py new file mode 100644 index 0000000..f508ad9 --- /dev/null +++ b/2024/day07/solve2.py @@ -0,0 +1,44 @@ +def is_valid_entry(ent: tuple[int, list[int]], current_result: int = 0, current_index: int = 0) -> bool: + if current_index == 0: + current_result += ent[1][current_index] + return is_valid_entry(ent, current_result, current_index + 1) + + if current_index >= len(ent[1]): + if current_result == ent[0]: + return True + return False + + new_result = current_result + ent[1][current_index] + + if new_result <= ent[0]: + if is_valid_entry(ent, new_result, current_index + 1): + return True + + new_result = current_result * ent[1][current_index] + + if new_result <= ent[0]: + if is_valid_entry(ent, new_result, current_index + 1): + return True + + new_result = int(f"{current_result}{ent[1][current_index]}") + + if new_result <= ent[0]: + if is_valid_entry(ent, new_result, current_index + 1): + return True + + return False + +entries = [] + +with open("input") as f: + for line in f: + line = line.strip() + split = line.split(": ") + entries.append((int(split[0]), [int(elem) for elem in split[1].split(" ")])) + +result = 0 +for entry in entries: + if is_valid_entry(entry): + result += entry[0] + +print(result) \ No newline at end of file diff --git a/2024/day08/input b/2024/day08/input new file mode 100644 index 0000000..8f67508 --- /dev/null +++ b/2024/day08/input @@ -0,0 +1,50 @@ +..F..........L............5....................... +............................L.U................... +.................................................. +.............z.L.........5.....4........8....1.P.. +...F................D..4.8.............P......J... +......f................8....z........U..J......... +.......D..f........B..o.........m..........JX..... +......o...5........F..........m.......6....X...... +....s........f...n.....54.U....E................3. +....F.......l.......k..............6.3n........... +L..........z....7..U............E...k.P..3b....... +..s.......D..........h...k.....G........y..m...... +d..............o.........X............8...n....... +...........o.......D.......J...................... +....................z.....1.9....G6..Y.b....y..... +.d................4.........EN..G.9.b............. +.......................7.......................... +..d................l.........pc..n................ +..............l........1Nm..........G..9.......... +.f.........s...7........1........E........X....y.. +.............d...................6......v......... +........................h.............B........... +.......l.......................h........B.....p..y +........w......A................................M. +.....s.................O...........p.......2...... +...............9.........................B.b...... +......................w..0..............H......... +.....................w7.j..O....................e. +.A......Z...................K...h...M............. +.................S....KZ.......................... +.................V..............x................. +......Z...............................N........... +.......................a.......................... +....A..........................K.................M +.......Z..................ON.KT.........c......... +...........................YO....t.......x........ +..............g........w.T.............k...c...... +..........................v....................... +....S..................................u.......... +..........0............v...............c...e..C.p. +.......S............V.j........v.......x.......... +......S..0W.......HT....a......................... +A..............H...W..a......C.................... +................T.2.....V......H..t...u........C.. +.................g.j....2.........u..t...e......C. +.........W...........g.......................u.... +........W...0.................Y.........e.tM...... +................g..a.j............................ +.................................................. +.................2........Y...........x........... \ No newline at end of file diff --git a/2024/day08/input_test b/2024/day08/input_test new file mode 100644 index 0000000..de0f909 --- /dev/null +++ b/2024/day08/input_test @@ -0,0 +1,12 @@ +............ +........0... +.....0...... +.......0.... +....0....... +......A..... +............ +............ +........A... +.........A.. +............ +............ \ No newline at end of file diff --git a/2024/day08/solve.py b/2024/day08/solve.py new file mode 100644 index 0000000..9dba99e --- /dev/null +++ b/2024/day08/solve.py @@ -0,0 +1,34 @@ +lines = [] + +with open("input") as f: + for line in f: + lines.append(line.strip()) + +antennas: dict[str, list[tuple[int, int]]] = {} +for row_idx, line in enumerate(lines): + for col_idx, char in enumerate(line): + if char != ".": + if char not in antennas: + antennas[char] = [] + + antennas[char].append((row_idx, col_idx)) + +row_count = len(lines) +col_count = len(lines[0]) +antinodes: set[tuple[int, int]] = set() +for antenna_list in antennas.values(): + for idx, antenna1 in enumerate(antenna_list): + for antenna2 in antenna_list[idx + 1:]: + row_diff = antenna2[0] - antenna1[0] + col_diff = antenna2[1] - antenna1[1] + + pos1 = (antenna1[0] - row_diff, antenna1[1] - col_diff) + pos2 = (antenna2[0] + row_diff, antenna2[1] + col_diff) + + if 0 <= pos1[0] < row_count and 0 <= pos1[1] < col_count: + antinodes.add(pos1) + + if 0 <= pos2[0] < row_count and 0 <= pos2[1] < col_count: + antinodes.add(pos2) + +print(len(antinodes)) \ No newline at end of file diff --git a/2024/day08/solve2.py b/2024/day08/solve2.py new file mode 100644 index 0000000..1642e35 --- /dev/null +++ b/2024/day08/solve2.py @@ -0,0 +1,35 @@ +lines = [] + +with open("input") as f: + for line in f: + lines.append(line.strip()) + +antennas: dict[str, list[tuple[int, int]]] = {} +for row_idx, line in enumerate(lines): + for col_idx, char in enumerate(line): + if char != ".": + if char not in antennas: + antennas[char] = [] + + antennas[char].append((row_idx, col_idx)) + +row_count = len(lines) +col_count = len(lines[0]) +antinodes: set[tuple[int, int]] = set() +for antenna_list in antennas.values(): + for idx, antenna1 in enumerate(antenna_list): + for antenna2 in antenna_list[idx + 1:]: + row_diff = antenna2[0] - antenna1[0] + col_diff = antenna2[1] - antenna1[1] + + pos = antenna1 + while 0 <= pos[0] < row_count and 0 <= pos[1] < col_count: + antinodes.add(pos) + pos = (pos[0] - row_diff, pos[1] - col_diff) + + pos = antenna2 + while 0 <= pos[0] < row_count and 0 <= pos[1] < col_count: + antinodes.add(pos) + pos = (pos[0] + row_diff, pos[1] + col_diff) + +print(len(antinodes)) \ No newline at end of file diff --git a/2024/day1/input b/2024/day1/input deleted file mode 100644 index 921687d..0000000 --- a/2024/day1/input +++ /dev/null @@ -1,1000 +0,0 @@ -23238 26034 -94370 90190 -15509 72666 -48816 23909 -31300 40420 -14729 97519 -47167 21596 -18644 62370 -10058 89257 -15802 28645 -63557 90190 -66676 90412 -95224 92079 -20517 91403 -33109 13140 -58060 17075 -63986 35300 -92785 33038 -75525 55696 -91034 12712 -54945 85952 -70951 90190 -72666 33543 -19148 51672 -84872 54241 -44568 34382 -83462 63079 -75888 90582 -51807 47834 -71629 83895 -78782 92388 -15141 90190 -31753 44568 -33506 43240 -47083 26486 -38009 74762 -46783 42091 -59913 32597 -27337 56511 -84961 14925 -49804 93940 -79195 90534 -37742 34810 -38653 36830 -60692 21316 -34988 77576 -68550 56068 -59229 83297 -72846 80603 -28642 34506 -96975 38315 -76719 55715 -68212 11978 -49896 58929 -85899 72666 -65378 79253 -81584 98628 -57795 66296 -89138 37249 -24417 72666 -85907 44568 -33187 29605 -32132 47166 -61218 79101 -79906 17323 -75306 69897 -36113 20298 -19848 37536 -79974 53573 -82681 88411 -61356 72666 -67779 12835 -73747 32976 -43226 98628 -27418 42113 -81936 47166 -65390 72188 -86410 48512 -63152 89057 -83433 48642 -15154 49428 -67196 31091 -52145 66296 -97392 54967 -68822 89257 -95968 18999 -10231 48028 -75979 10758 -68791 71081 -73395 23710 -35116 61618 -75457 47834 -59013 74006 -60089 83297 -81215 72666 -85282 30857 -77169 72362 -77343 83136 -58477 47834 -93845 62570 -80320 36393 -25356 36515 -30605 14520 -41757 38101 -52096 63406 -37058 90190 -59797 79101 -65557 21111 -29895 62370 -76060 22181 -20451 88174 -98101 10985 -89542 16550 -35720 78549 -21328 90190 -78382 40764 -70594 72376 -44254 93643 -79324 84865 -61358 62370 -70753 70574 -19289 14760 -50375 77640 -55565 77975 -62697 88319 -97267 29605 -10937 83297 -45672 67842 -39846 62370 -55006 42276 -12817 55094 -25730 62370 -41309 45811 -79332 28406 -62494 71394 -40764 54500 -48573 10017 -32570 92974 -70630 79760 -33351 65490 -72008 71845 -99063 21041 -55424 44568 -54777 63064 -61905 72634 -81660 62370 -43650 92176 -98062 35629 -64890 32075 -84348 79253 -19809 15891 -17397 44325 -85724 79818 -50967 79253 -80513 21562 -90817 90582 -27451 84569 -97017 51807 -22724 65607 -61250 74083 -51613 82431 -92507 66296 -20838 67775 -21646 97601 -43227 42156 -54500 79253 -67589 79631 -68298 21800 -97081 13343 -49525 72376 -77455 89257 -49455 91182 -92689 77523 -10868 44679 -26724 47166 -94594 40764 -84697 79414 -14040 90751 -26930 62370 -62034 79253 -41654 62370 -72668 37285 -69857 97462 -89426 44374 -38354 20538 -68214 68822 -51210 38361 -60260 34047 -97778 35495 -64646 30634 -86706 85448 -71151 32417 -52064 84475 -92076 79101 -52941 65015 -83276 28661 -45040 52329 -24804 40692 -80127 71081 -75976 83297 -50856 54764 -98860 14310 -86849 68822 -55826 22807 -44426 84475 -18776 63854 -88579 41265 -86039 72666 -31003 79253 -38782 72839 -44759 40764 -49379 74859 -96296 22158 -52253 28645 -40895 79101 -11295 47834 -82274 36463 -75980 53984 -80045 90190 -24187 60596 -84264 60692 -39382 52329 -68621 67760 -78207 92176 -29605 89257 -82965 57643 -35473 32611 -76842 83297 -53704 69974 -18987 86774 -87307 55460 -13653 79101 -63448 47166 -82570 11369 -35219 79094 -78126 58440 -90509 42934 -67069 89709 -30317 83976 -59656 67961 -85165 47834 -87543 41626 -63866 28813 -96015 89257 -41635 40764 -58535 47166 -86065 53573 -59283 43240 -52899 68822 -93324 28248 -30465 29605 -90803 40764 -65604 72666 -41070 97917 -21201 32712 -66296 51560 -23241 18816 -49231 22376 -16090 71800 -60878 70919 -18216 86802 -31255 56222 -43385 43240 -27548 79253 -21800 47834 -90258 68822 -66198 41931 -77218 75490 -33929 46602 -63886 36805 -38478 28645 -75472 77934 -22622 47166 -68813 72376 -24242 67007 -56625 30429 -33816 69857 -99853 53573 -25244 99809 -58312 90190 -84081 72666 -18267 84356 -98628 57652 -70385 22850 -55944 49172 -34925 73021 -45979 61368 -69251 66296 -87383 52329 -40150 39790 -53132 65879 -11700 36363 -56444 44568 -96855 62674 -84569 66296 -10076 36393 -82102 77658 -34089 83297 -75465 16448 -96939 27252 -59547 44296 -17871 52665 -48300 85270 -99007 51807 -60501 72338 -54290 75136 -82299 76051 -19912 58398 -29748 28645 -94064 29440 -67058 66296 -96558 33145 -28211 60692 -83522 37461 -24984 31435 -73026 54947 -37704 83297 -45679 12243 -59293 96287 -70715 12977 -75300 92176 -47834 88660 -73179 44568 -15396 69857 -13155 45242 -15322 40764 -87738 44568 -39228 63056 -10094 99306 -19187 51279 -24608 66876 -64188 17378 -92176 34202 -27181 94666 -25568 21800 -23269 79101 -73632 83094 -76443 79253 -50395 40764 -95389 12857 -37621 76935 -98105 83297 -52329 70935 -22302 11041 -21359 68822 -85409 61115 -78562 66999 -80124 12495 -27657 85353 -21050 89257 -99720 24490 -34473 60692 -40097 28645 -71499 89052 -14699 66369 -39662 30699 -10126 90582 -70882 41277 -53822 88374 -26814 44568 -46613 19368 -60821 32241 -50555 48329 -47797 74633 -13233 84569 -82025 20968 -60368 92176 -83906 38286 -10747 61071 -55896 85143 -92268 95602 -69037 84475 -34685 46159 -19218 43240 -28324 72085 -11651 44568 -78958 66147 -17530 46029 -74555 44500 -77014 47834 -24738 47834 -16637 91276 -45665 79253 -92616 30393 -37952 59966 -19685 11968 -94702 29605 -41971 66296 -36214 79101 -56277 52329 -50495 55484 -12931 19137 -30115 27951 -43240 48011 -35685 28124 -83746 99263 -65419 44568 -24233 60692 -47241 55356 -35356 59649 -94202 43240 -79253 72376 -47166 33437 -91716 77323 -47182 44568 -53626 79101 -13563 61608 -48825 25123 -28824 84475 -90758 85547 -89417 90761 -22416 93637 -48389 40943 -38655 27039 -27191 19247 -79955 68822 -82905 40764 -86695 28645 -40972 66296 -45612 28645 -41731 21800 -61510 40764 -91192 98628 -15004 72376 -22943 54500 -68404 41433 -60311 44568 -60689 84252 -60979 43240 -19808 72495 -80126 38496 -13846 29383 -22482 13993 -39349 84569 -85531 37632 -80209 83851 -63852 56007 -54497 35634 -51625 87132 -38979 80241 -28939 88293 -59010 83649 -30553 26199 -94589 79101 -70488 99011 -81746 92176 -64311 44568 -88295 60692 -93665 89557 -53760 33880 -14737 80051 -25521 61141 -86653 98106 -91054 87401 -74929 40764 -20082 72374 -43069 87032 -95088 51436 -82111 80970 -39862 99504 -82669 46360 -83378 62370 -62130 25115 -43544 20178 -23808 89185 -98111 83928 -20879 43240 -49519 84475 -94944 85865 -75415 75964 -47156 36358 -27019 28645 -81852 52329 -83726 90190 -36393 96318 -65529 91634 -22850 28317 -12435 21800 -45103 82620 -54394 16838 -48022 53556 -52784 68553 -76933 84475 -66619 72666 -45083 10443 -85277 88103 -95818 90190 -23357 79253 -10551 63173 -86368 10170 -49946 12592 -73961 76042 -11496 47834 -15914 51997 -21677 66325 -24401 81589 -72493 50642 -72307 91265 -25787 80652 -56985 71081 -55531 44402 -59945 83297 -63295 83297 -20808 90190 -89697 47834 -65568 29693 -98707 28645 -62217 20682 -99249 48525 -13276 33527 -10427 46523 -69239 79253 -69378 67265 -64906 98628 -79879 42860 -12341 24113 -63649 28645 -93094 10616 -81490 28786 -13491 28645 -74076 93412 -54347 22101 -49315 90582 -56725 83297 -86924 56458 -62370 32885 -48988 72376 -42946 42505 -43680 95834 -62438 72376 -46412 79101 -97903 79101 -26320 47834 -69366 71081 -34171 68822 -30248 63980 -19619 40923 -47420 89257 -87678 57669 -61051 96558 -62807 12392 -30534 17024 -49199 67605 -48341 44568 -53638 58468 -12820 84475 -79439 72666 -80714 44568 -14366 84475 -21888 60692 -95972 59581 -63117 85887 -96782 72376 -71622 88794 -62648 62370 -21936 60167 -69675 39650 -88205 66550 -93488 93842 -28475 42399 -75331 25752 -88545 84475 -45032 57784 -97469 41573 -60842 78415 -19399 47166 -36862 22156 -44872 33736 -91430 41673 -28875 44568 -67699 94310 -69033 13525 -68804 47834 -35863 52441 -78678 99708 -68260 84487 -32978 60692 -46940 80397 -72663 74882 -21043 90582 -74375 17862 -96385 76273 -79101 53573 -76218 92278 -87477 43240 -58381 57987 -29149 78325 -16341 72376 -47020 52329 -65310 61228 -37754 83297 -77458 67510 -61915 23653 -36950 55786 -28645 34188 -35813 92176 -47172 66598 -90056 62370 -14736 85451 -89257 84569 -17180 34739 -66755 92176 -28028 29549 -78468 60692 -15102 60692 -17822 41158 -31218 66296 -41429 79101 -21620 72666 -57643 98463 -93661 22308 -97777 51057 -71356 33985 -55197 29232 -70795 55547 -71377 52329 -18251 92760 -49293 83737 -63584 43517 -32445 72666 -70614 68967 -47977 19618 -91379 69845 -17003 85894 -87325 99345 -12731 44568 -42313 70327 -36391 82618 -14548 47834 -80254 21800 -21669 90190 -54961 67621 -95444 79253 -84613 78529 -36436 62364 -62416 61914 -78479 43240 -31827 37146 -94738 81883 -97541 79253 -66855 29605 -70582 83297 -66034 32135 -33893 20394 -77467 68822 -37149 79166 -22676 28333 -92029 47166 -94520 70838 -45370 79253 -86953 50576 -12736 16934 -37014 41185 -95511 85166 -93629 61042 -95831 40730 -56049 80299 -29900 16094 -77032 47834 -88320 64538 -68300 23040 -82526 32180 -91345 62370 -85150 39035 -65519 44754 -10865 28011 -18592 83297 -19078 62370 -65128 83297 -29680 16423 -63907 60692 -52189 79101 -50834 68822 -48390 98628 -16835 43240 -16523 58031 -23750 72666 -93801 62698 -15455 85166 -39313 39154 -12246 29615 -57256 28645 -70719 80450 -93935 11251 -49629 43085 -68611 12734 -69656 44568 -30033 32331 -54145 10729 -25483 29605 -20736 27197 -70628 17513 -46547 79966 -34712 54500 -10856 47834 -40229 18590 -62932 79646 -34539 77892 -52528 92176 -98937 18544 -91209 71352 -18740 63353 -86629 70628 -64790 47041 -56551 79101 -83297 20038 -75130 56853 -33535 61978 -43492 14865 -51344 99384 -35260 24059 -84784 51807 -12409 16319 -16243 18062 -19891 46508 -35614 86985 -15122 68822 -43057 98628 -84820 60692 -12233 76084 -23335 65709 -71081 79101 -67869 62671 -49734 51807 -12696 83851 -15492 54500 -29208 62370 -24284 11417 -41157 47772 -30544 66296 -92226 17271 -61246 52329 -63227 96077 -31426 44568 -57047 79253 -23855 79520 -69439 27186 -85166 31655 -25322 62989 -14479 26112 -77140 28645 -10612 17077 -56543 83297 -53494 80908 -45334 95239 -89902 85166 -73255 57735 -26895 18173 -64218 47924 -78172 49084 -77332 43240 -17955 95261 -31704 37280 -83774 66296 -54943 83851 -65875 79101 -30695 72666 -25827 53304 -66127 92176 -16436 97614 -27869 48013 -54766 34900 -96521 83851 -39183 70628 -18834 35784 -73420 64200 -97485 45854 -50874 98017 -61477 58419 -52459 52329 -82878 79253 -18371 19152 -58631 54500 -92293 22682 -64034 28645 -75077 51807 -81292 45981 -81885 93158 -92300 36393 -97964 67294 -59096 69267 -48792 69248 -22288 94108 -18619 68822 -17920 27815 -89408 72666 -51222 92339 -33457 90190 -79548 68822 -16841 17911 -61683 77353 -58205 39848 -43788 38588 -84475 84475 -74053 10266 -11537 93796 -91987 89494 -19804 40764 -35138 83851 -88532 62479 -21972 20395 -87380 16280 -69296 83851 -78721 85856 -85819 47166 -80119 11244 -96949 13944 -10638 97010 -12213 49984 -90582 66296 -84153 69786 -52703 14947 -82734 44321 -31346 65022 -30574 56778 -48416 38908 -71402 46947 -17158 22018 -40254 82756 -24823 68567 -36467 52987 -38460 90190 -28032 71264 -90853 58391 -93193 72666 -90190 28645 -35742 90190 -64472 95923 -45785 79101 -84235 51774 -20337 21528 -71921 28645 -51844 44536 -93894 84475 -91414 15256 -23884 66296 -57314 28319 -66738 90958 -72376 78771 -59616 21810 -99956 40120 -63926 51298 -53573 25383 -83851 13307 -62052 37219 -18954 54500 -19984 67636 -60119 33810 -12147 20266 -31871 79253 -55040 90217 -23706 83367 -17851 83851 -85520 83297 -38471 40983 -64357 94963 -82719 28371 -55216 56394 -98567 47834 -58865 50989 -84116 10207 -94278 12968 -31912 32099 -14886 44568 -75820 60692 -37985 49205 -66024 31579 -40690 72376 -97296 84475 -26537 64899 -23676 72995 -19014 84475 -93618 67504 -22886 44568 -42999 43240 -97005 40764 -49168 84388 -32187 29605 -55580 35405 -47138 81256 -65134 72988 -70225 28645 -32247 41914 -77382 69857 -85910 89257 -24055 67072 -49487 11022 -70897 18278 -96846 83297 -26249 22533 -31913 72086 -13340 88560 -81511 66296 -57973 36393 -26791 89257 -41155 36393 -11531 65438 -70981 41334 -19021 60692 -19123 84569 -15215 57592 -51944 14684 -42510 72666 -14313 84475 -75686 94789 -37398 64138 -80968 49372 -13423 40764 -51784 21800 -16771 79101 -46751 29605 -32177 39427 -91885 68822 -29436 84475 -37793 40764 -18527 69857 -83464 77792 -44411 54500 -30554 29550 -55958 51807 -97160 23416 -12673 62370 -72021 65743 -86272 27177 -58595 90582 -23628 10375 -79261 72666 -34730 61458 -32101 49340 -91964 19525 -60149 92176 -96421 36393 -73535 81729 -75343 60692 -48638 28844 -33746 66296 -57163 64173 -40694 25667 -17656 12560 -25674 81321 -46631 79101 -31088 79101 -16025 15602 -90344 93010 -83502 89257 -72506 97934 -67982 92119 -53274 20232 -81581 15775 -61634 92176 -34465 76620 -39738 76121 -29929 34694 -63062 53509 -61325 19831 -95180 32789 -76828 81537 -16895 72666 -42407 31971 -38627 66296 -49392 53573 -10342 73936 -81470 19476 -79948 73681 -80798 67908 -48113 26473 -27504 66296 -63214 72376 -30224 23096 -63112 69857 -47829 66296 -32412 32329 -52231 72376 -30379 62620 -80100 29605 -74262 90582 -14634 52329 -41091 97452 -32482 31278 -44499 83851 -12050 85447 -93469 21599 -73286 38522 -88923 81268 -20527 29605 -83959 57974 -92046 83593 -67939 99783 -42239 53315 -56584 16398 -70237 21652 -50928 90582 -77632 88216 -59573 94988 -94450 36393 -43063 91467 -95915 28645 -18977 63414 -59673 96558 -73123 12635 diff --git a/2024/day1/solve.py b/2024/day1/solve.py deleted file mode 100644 index e01ded4..0000000 --- a/2024/day1/solve.py +++ /dev/null @@ -1,18 +0,0 @@ -sum = 0 - -list1 = [] -list2 = [] - -with open("input") as f: - for line in f.readlines(): - nums = line.split() - list1.append(int(nums[0])) - list2.append(int(nums[1])) - -list1.sort() -list2.sort() - -for ii, num in enumerate(list1): - sum += abs(num - list2[ii]) - -print(sum) \ No newline at end of file diff --git a/2024/day1/solve2.py b/2024/day1/solve2.py deleted file mode 100644 index 8b00942..0000000 --- a/2024/day1/solve2.py +++ /dev/null @@ -1,20 +0,0 @@ -sum = 0 - -list1 = [] -list2 = [] - -with open("input") as f: - for line in f.readlines(): - nums = line.split() - list1.append(int(nums[0])) - list2.append(int(nums[1])) - -memoize_count = {} - -for num in list1: - if num not in memoize_count.keys(): - memoize_count[num] = list2.count(num) - - sum += memoize_count[num] * num - -print(sum) \ No newline at end of file diff --git a/2024/day2/input b/2024/day2/input deleted file mode 100644 index 0501d5f..0000000 --- a/2024/day2/input +++ /dev/null @@ -1,1000 +0,0 @@ -24 25 28 31 28 -41 44 45 48 49 50 50 -5 8 10 13 15 16 17 21 -11 13 16 17 19 26 -79 81 78 79 82 84 -16 19 20 18 20 22 25 22 -84 87 90 92 94 97 96 96 -86 87 88 91 88 91 95 -40 43 41 44 49 -8 10 10 11 13 -91 94 95 95 92 -18 19 20 20 21 23 25 25 -15 17 19 19 23 -35 37 37 39 40 43 50 -2 5 6 10 12 -82 85 87 88 91 93 97 94 -30 32 35 38 42 43 43 -64 66 68 72 76 -73 74 77 80 84 86 91 -64 67 72 73 74 76 -72 73 75 81 82 81 -24 25 32 35 37 38 38 -59 60 62 64 65 70 74 -44 46 47 48 50 52 58 63 -54 52 53 56 57 58 -77 76 77 80 82 81 -48 45 48 49 52 54 54 -74 71 74 76 78 81 85 -20 18 19 21 27 -88 86 88 91 92 89 92 -17 16 14 17 18 15 -95 92 91 93 95 96 96 -7 5 6 9 8 11 14 18 -15 12 9 12 14 16 21 -3 2 2 5 6 -58 55 55 57 58 57 -36 35 36 36 36 -73 72 72 75 79 -80 77 78 78 79 82 87 -20 19 23 25 27 28 31 32 -92 90 91 95 97 96 -86 84 86 90 93 96 98 98 -36 33 34 38 41 45 -82 81 85 88 89 92 99 -70 69 71 77 78 81 -51 49 50 57 60 58 -28 27 30 33 35 40 40 -40 37 38 45 49 -53 52 54 55 56 61 67 -27 27 29 31 34 -82 82 84 86 89 92 89 -91 91 93 96 96 -55 55 58 60 64 -80 80 81 82 83 85 88 95 -84 84 87 84 85 -81 81 80 82 79 -25 25 22 24 24 -71 71 74 76 77 74 78 -86 86 87 86 87 88 93 -41 41 43 43 46 -70 70 70 72 71 -12 12 13 13 14 15 15 -23 23 23 26 28 31 35 -84 84 86 88 88 89 91 98 -4 4 5 7 8 9 13 14 -31 31 35 36 37 36 -19 19 23 26 26 -80 80 84 85 88 90 94 -51 51 53 54 58 60 61 66 -35 35 36 42 43 -9 9 12 15 18 24 21 -2 2 8 11 14 15 15 -25 25 30 33 36 38 39 43 -13 13 18 19 26 -10 14 15 17 19 -35 39 40 43 45 46 48 45 -41 45 47 50 50 -16 20 23 25 28 31 34 38 -10 14 15 18 20 25 -42 46 49 46 48 -25 29 32 31 34 31 -7 11 14 11 14 14 -90 94 92 94 98 -27 31 34 32 35 37 44 -50 54 54 56 59 61 63 -48 52 52 53 50 -84 88 89 90 91 91 91 -48 52 54 54 56 60 -85 89 89 91 98 -9 13 15 17 21 23 -43 47 49 52 53 57 55 -76 80 82 83 86 90 93 93 -5 9 11 15 16 20 -53 57 61 62 65 66 73 -65 69 70 73 76 81 82 83 -15 19 21 27 24 -51 55 57 63 65 65 -15 19 22 25 27 33 37 -1 5 6 7 9 11 16 22 -50 56 58 60 63 65 68 70 -36 42 43 44 41 -36 42 44 47 50 52 54 54 -79 84 87 88 90 92 94 98 -35 42 45 46 47 49 52 58 -74 80 83 80 81 82 84 85 -60 67 69 72 73 71 72 71 -85 92 94 97 96 98 98 -17 22 25 27 25 28 32 -22 28 26 28 31 33 40 -51 57 60 61 61 62 63 -7 13 16 16 19 18 -80 87 87 89 89 -70 76 79 81 84 84 88 -39 45 46 49 49 51 52 58 -38 43 45 48 52 55 57 58 -79 84 86 89 93 94 92 -39 45 48 52 52 -58 63 67 69 70 74 -76 83 86 90 97 -13 18 25 27 29 31 -60 66 69 72 75 80 82 81 -21 26 29 31 33 38 38 -31 37 42 45 46 50 -15 21 23 24 30 32 38 -51 48 45 43 44 -45 43 41 40 38 37 36 36 -66 64 61 60 57 53 -89 86 83 81 76 -36 33 30 33 30 29 28 27 -91 88 91 89 86 85 83 85 -12 10 12 11 11 -31 30 27 30 28 27 23 -35 32 31 34 32 26 -11 10 10 9 6 5 4 3 -44 41 38 38 37 35 34 36 -80 78 76 73 72 71 71 71 -45 43 40 37 37 33 -97 94 91 88 87 86 86 80 -58 56 53 51 47 44 -66 63 62 60 58 56 52 53 -73 72 71 68 65 61 61 -95 92 88 86 82 -19 17 16 12 11 10 5 -80 77 74 71 66 64 62 61 -64 62 59 56 51 52 -47 46 43 42 39 38 33 33 -45 44 41 39 34 30 -95 92 89 87 82 81 80 74 -94 96 94 91 88 -89 91 90 88 89 -40 41 38 36 36 -70 72 70 68 67 63 -22 25 24 21 19 18 13 -41 42 39 40 38 37 -35 36 35 32 31 29 32 35 -31 34 31 34 34 -88 90 89 91 90 88 85 81 -54 57 60 59 56 50 -83 85 82 82 80 -66 68 68 65 62 61 62 -35 36 36 34 32 30 30 -79 80 80 78 76 74 70 -44 45 45 43 37 -37 40 37 33 31 -63 65 63 59 56 55 54 56 -19 22 21 17 15 13 11 11 -94 95 91 90 88 84 -22 23 19 18 16 14 7 -29 32 30 23 22 -64 67 64 58 56 57 -29 30 27 24 18 18 -33 36 34 27 24 22 20 16 -50 52 49 48 46 39 37 31 -31 31 28 25 22 21 19 16 -47 47 44 43 40 37 38 -88 88 85 84 84 -41 41 38 36 32 -73 73 70 69 67 66 60 -80 80 81 80 79 77 76 75 -36 36 34 32 34 35 -59 59 57 60 59 58 56 56 -30 30 27 28 25 23 19 -9 9 7 6 5 8 3 -89 89 87 86 85 85 82 -52 52 49 46 46 47 -60 60 59 59 59 -21 21 19 19 15 -17 17 17 16 13 12 10 4 -33 33 29 28 26 25 -67 67 63 61 58 60 -27 27 25 24 20 20 -78 78 76 74 72 68 64 -62 62 59 55 49 -47 47 44 38 36 33 31 -31 31 28 21 23 -81 81 80 79 78 72 72 -75 75 69 66 62 -97 97 91 89 87 85 78 -35 31 28 27 26 25 -35 31 28 27 25 22 21 23 -37 33 32 31 28 28 -73 69 67 65 62 59 55 -67 63 60 58 53 -52 48 47 44 47 46 43 -73 69 70 68 69 -18 14 13 16 16 -91 87 84 81 82 79 77 73 -96 92 90 92 91 88 81 -40 36 35 35 34 33 31 -93 89 86 83 82 82 80 81 -86 82 79 79 78 77 77 -20 16 13 13 12 8 -30 26 23 23 21 19 17 10 -76 72 69 66 62 60 57 54 -57 53 49 46 48 -64 60 58 54 54 -20 16 15 12 8 5 1 -40 36 34 31 27 25 19 -25 21 20 18 16 14 9 6 -48 44 43 40 38 36 29 31 -96 92 90 89 83 81 80 80 -45 41 34 32 28 -35 31 28 27 21 19 14 -35 30 27 26 23 -73 66 63 61 64 -60 55 53 51 50 50 -68 62 61 60 56 -55 50 49 46 43 42 37 -29 23 22 25 22 20 18 16 -96 90 88 85 84 86 83 85 -47 41 39 36 37 37 -72 66 69 68 66 62 -52 47 49 46 43 36 -77 71 68 68 67 66 -99 94 94 93 96 -45 38 35 33 31 31 31 -23 16 13 10 10 6 -33 26 25 25 23 20 18 11 -44 37 33 30 28 27 -90 85 81 79 80 -91 85 82 79 77 73 70 70 -98 91 88 86 82 78 -68 63 61 58 54 52 45 -64 58 57 50 49 -66 59 56 49 52 -89 82 77 76 73 70 70 -80 73 72 67 63 -73 66 60 59 57 50 -11 14 15 17 20 23 21 -47 50 52 55 56 56 -16 17 18 19 20 23 27 -82 83 85 88 90 91 94 99 -59 61 59 61 64 67 70 73 -32 33 36 37 38 36 39 38 -86 89 90 91 89 92 94 94 -67 68 71 68 71 73 76 80 -28 30 31 33 34 32 39 -3 4 6 6 7 10 12 13 -61 64 64 66 69 71 68 -49 50 52 52 53 55 55 -8 11 14 16 16 20 -59 62 62 63 70 -43 45 49 52 55 57 -80 82 86 88 89 92 93 91 -81 82 86 87 88 91 94 94 -38 41 45 48 51 53 57 -35 38 40 41 45 47 54 -6 9 12 14 15 17 22 23 -81 82 83 85 91 90 -74 76 83 84 87 87 -24 27 28 35 37 41 -69 71 72 77 80 85 -12 9 12 13 15 17 20 23 -77 75 76 77 78 81 78 -60 57 59 61 61 -13 10 11 14 16 20 -81 80 81 84 85 90 -6 5 6 7 5 7 10 13 -54 51 54 52 54 55 54 -72 71 70 73 73 -89 86 88 90 91 88 90 94 -8 6 3 5 10 -10 7 8 10 12 12 15 16 -14 11 12 14 16 16 19 18 -39 37 38 38 39 42 44 44 -13 11 12 13 15 15 16 20 -10 8 8 11 14 20 -42 40 42 45 49 50 -67 66 70 73 76 78 77 -32 30 34 35 37 37 -47 44 45 49 51 55 -36 35 39 40 43 45 47 53 -68 66 67 68 73 74 -40 37 38 39 40 46 47 45 -28 26 27 30 35 35 -45 42 48 50 54 -44 43 45 48 54 59 -61 61 62 63 64 66 67 -57 57 58 61 59 -66 66 69 71 73 75 78 78 -59 59 61 64 67 71 -28 28 29 30 31 33 36 41 -41 41 42 41 44 45 -11 11 10 13 15 12 -37 37 40 38 41 41 -41 41 40 42 46 -68 68 69 72 69 71 78 -95 95 95 97 98 99 -9 9 9 10 13 14 17 16 -81 81 82 85 88 88 88 -86 86 86 89 92 96 -58 58 59 62 62 67 -80 80 81 85 87 -84 84 87 91 88 -3 3 7 10 11 12 12 -74 74 75 79 81 82 85 89 -26 26 28 29 31 35 37 44 -38 38 39 46 49 -77 77 80 81 87 88 85 -75 75 78 81 87 90 92 92 -28 28 31 37 40 43 47 -11 11 12 18 20 27 -15 19 21 22 23 26 -58 62 64 65 66 69 71 69 -56 60 61 63 63 -46 50 53 56 58 62 -67 71 73 76 81 -52 56 58 56 58 60 -6 10 11 8 7 -81 85 86 89 87 88 88 -72 76 79 76 79 82 86 -39 43 44 46 43 49 -38 42 45 45 46 -41 45 48 51 51 48 -79 83 86 86 86 -24 28 29 31 33 33 34 38 -55 59 59 61 62 65 67 74 -73 77 80 82 86 87 90 -45 49 50 53 57 54 -80 84 88 90 92 92 -14 18 20 22 24 28 32 -61 65 69 70 73 76 82 -50 54 57 59 62 63 69 70 -75 79 81 82 83 89 92 89 -45 49 52 59 61 63 63 -38 42 44 45 48 55 57 61 -62 66 69 71 74 80 86 -28 35 37 40 41 43 -25 30 32 33 34 37 35 -14 19 20 21 22 22 -8 14 17 20 23 27 -23 28 29 31 38 -68 74 77 78 76 79 80 -14 21 18 20 22 23 25 22 -18 23 20 22 22 -65 72 71 74 76 80 -8 14 15 17 14 17 20 25 -59 65 68 70 70 73 -59 65 68 68 71 74 71 -34 41 43 43 43 -20 25 25 28 32 -43 48 50 50 53 56 58 64 -38 45 49 52 55 58 -23 30 34 35 33 -4 9 11 14 18 20 21 21 -51 57 61 63 67 -67 74 78 81 82 88 -20 26 29 36 37 -9 14 15 18 20 26 29 28 -73 79 82 87 90 90 -9 16 18 24 28 -8 14 19 22 29 -80 77 75 73 76 -93 90 88 85 84 81 78 78 -25 22 20 18 15 12 11 7 -51 48 47 44 42 40 37 31 -77 74 77 75 73 72 -94 91 92 90 88 89 -28 27 26 24 21 22 20 20 -94 91 88 87 86 89 85 -91 90 87 85 82 80 81 74 -59 56 56 54 52 50 -89 88 88 87 84 82 85 -96 95 93 90 89 86 86 86 -25 22 22 19 15 -39 36 34 34 33 31 24 -53 52 49 47 43 40 -93 92 88 85 87 -82 80 76 75 72 69 66 66 -57 55 52 49 47 43 39 -43 40 36 33 26 -33 30 28 21 18 -72 70 67 66 59 61 -26 23 22 19 14 12 10 10 -25 22 20 18 13 10 9 5 -33 30 27 21 19 16 13 6 -96 98 97 95 93 90 89 -47 48 46 45 47 -10 12 9 8 7 5 3 3 -48 49 48 47 43 -25 28 26 25 22 15 -2 4 1 4 3 -59 62 65 64 65 -24 25 22 19 20 17 17 -53 54 52 54 51 48 46 42 -21 23 21 18 19 18 12 -48 49 46 46 43 41 40 -58 61 59 57 57 59 -84 85 83 80 79 78 78 78 -20 22 22 19 17 15 11 -87 89 87 86 86 81 -97 99 95 94 91 -15 18 16 15 11 13 -54 55 53 49 49 -28 30 26 25 23 21 17 -34 37 34 32 28 21 -33 36 33 31 28 21 18 15 -66 69 68 63 61 58 55 58 -93 94 93 87 85 85 -17 18 13 12 8 -81 83 80 78 71 68 63 -68 68 66 65 63 -65 65 62 61 58 57 60 -28 28 26 23 23 -48 48 46 45 44 43 39 -16 16 13 11 6 -30 30 29 26 29 28 -23 23 20 22 20 17 20 -41 41 43 41 41 -39 39 36 39 36 32 -34 34 36 35 30 -88 88 87 85 85 84 -6 6 4 3 3 5 -41 41 38 38 38 -14 14 11 8 8 7 5 1 -75 75 72 72 70 64 -59 59 55 52 51 -91 91 88 84 81 79 80 -95 95 92 88 85 85 -62 62 60 59 55 51 -17 17 13 11 4 -67 67 66 65 63 58 56 -63 63 56 55 57 -46 46 45 39 39 -42 42 39 38 32 28 -91 91 86 84 78 -30 26 24 22 21 20 19 -58 54 53 50 53 -10 6 5 4 4 -93 89 88 86 85 83 81 77 -52 48 46 43 38 -89 85 84 81 83 82 79 -46 42 41 39 42 44 -48 44 41 44 43 42 39 39 -61 57 56 53 54 51 47 -55 51 54 52 50 43 -23 19 16 16 15 13 11 8 -23 19 17 16 14 14 13 14 -23 19 19 17 14 11 9 9 -24 20 19 16 14 14 10 -94 90 88 85 85 84 77 -47 43 41 39 36 32 30 -54 50 46 45 42 43 -88 84 81 77 77 -29 25 21 20 18 15 12 8 -67 63 59 58 51 -16 12 6 3 1 -68 64 61 59 53 51 50 53 -70 66 60 58 58 -84 80 75 73 70 66 -92 88 86 85 78 77 71 -93 86 83 82 79 77 74 73 -56 50 48 46 48 -25 20 19 16 13 13 -79 74 73 72 70 69 67 63 -77 71 70 67 64 62 56 -80 74 71 68 67 69 68 65 -36 29 27 26 28 31 -88 82 83 82 82 -13 6 5 7 3 -17 11 12 9 6 1 -87 82 81 80 80 78 75 -23 17 14 11 11 12 -70 64 61 58 58 58 -96 91 90 87 87 85 81 -92 85 85 83 80 74 -23 17 13 12 11 -70 63 59 56 55 53 54 -85 80 79 76 73 70 66 66 -81 75 74 73 72 68 64 -69 62 59 55 54 49 -68 62 60 58 52 49 -81 75 74 71 69 64 66 -71 65 58 55 55 -39 32 31 26 24 22 19 15 -53 47 42 40 33 -39 40 43 44 46 48 55 61 -41 37 35 31 29 25 -33 28 26 23 23 24 -53 49 48 45 43 39 -45 45 46 47 49 49 50 57 -55 52 51 50 47 46 46 42 -43 40 39 33 27 -31 37 42 44 46 46 -38 36 34 33 30 29 27 30 -25 31 33 35 32 38 -74 74 80 82 83 87 -34 40 40 41 44 45 50 -75 68 66 63 61 -72 69 67 64 61 54 54 -23 27 27 29 34 -53 57 58 60 60 -47 40 35 34 35 -28 24 22 20 18 16 16 -55 58 56 52 52 -9 9 11 14 15 12 16 -38 33 29 27 26 21 -19 18 19 19 20 24 -59 59 55 54 53 52 46 -9 13 16 18 20 21 22 26 -36 32 25 24 21 15 -40 41 44 45 47 46 49 53 -2 4 7 7 9 11 18 -16 21 20 22 23 25 -90 84 82 79 75 72 68 -74 74 78 79 81 81 -59 61 64 63 61 59 52 -76 76 75 68 67 64 65 -85 85 85 86 85 -34 37 35 32 29 25 24 -86 84 84 83 80 77 75 68 -15 16 20 21 23 26 29 -65 71 75 76 73 -95 95 94 91 88 90 -81 87 88 91 94 96 97 97 -4 8 11 13 14 12 15 -34 40 42 44 47 45 43 -34 36 38 41 48 51 55 -44 46 44 44 41 40 38 38 -95 98 97 96 93 93 -54 53 50 48 44 38 -25 25 23 20 17 15 11 -82 82 81 81 81 -52 56 58 62 64 68 -39 39 36 35 34 -83 86 88 85 87 -46 39 41 40 34 -18 24 27 34 37 -34 30 28 26 24 23 24 -65 67 70 72 74 77 76 -18 23 24 27 34 36 37 36 -10 10 11 14 16 21 -2 6 9 12 13 13 15 14 -46 51 52 56 57 59 63 -69 75 80 81 85 -60 61 64 61 58 57 60 -84 87 86 80 79 79 -76 73 75 73 73 -72 66 65 62 65 63 60 -10 14 16 17 18 25 27 31 -15 16 17 17 18 -94 94 91 86 82 -39 46 47 49 52 56 58 -1 1 2 2 2 -3 7 8 10 17 20 20 -26 26 24 19 17 14 12 -43 43 42 44 42 37 -62 62 59 60 59 58 55 55 -19 23 27 28 30 36 -41 44 42 44 41 41 -12 10 10 12 13 15 17 22 -52 53 54 55 62 65 67 67 -21 22 21 20 20 19 16 17 -50 46 45 43 41 40 40 40 -69 70 74 77 77 -83 87 89 89 90 94 -14 11 9 11 15 -86 83 84 88 89 92 93 97 -47 44 44 47 47 -83 87 89 89 92 -65 61 57 55 57 -65 69 71 75 78 81 81 -72 72 73 80 81 84 82 -31 28 30 34 35 36 39 41 -94 89 83 82 81 80 79 -55 55 52 48 45 45 -64 66 64 61 59 54 50 -7 6 11 14 17 21 -83 79 75 73 72 71 70 70 -37 36 36 33 31 29 28 31 -92 94 93 92 91 86 -71 70 69 68 63 -80 83 82 83 82 79 77 -51 55 57 61 58 -53 50 47 46 42 42 -89 89 90 96 99 -34 33 36 39 40 44 42 -77 73 69 68 66 -10 10 13 14 16 13 -76 77 74 74 69 -91 92 93 95 96 99 99 99 -17 15 11 10 9 6 5 -47 47 44 41 39 40 41 -21 25 28 30 28 35 -52 55 52 48 49 -44 44 42 45 43 39 -36 36 37 41 42 44 46 44 -43 43 40 40 37 40 -19 22 19 15 10 -61 62 59 56 55 51 -31 37 38 41 45 45 -1 5 8 9 10 15 -42 38 40 38 37 30 -60 61 59 57 55 -36 34 36 33 30 -38 40 41 42 40 42 44 43 -58 55 53 52 51 49 46 42 -91 88 91 89 88 89 -53 53 51 50 50 -89 91 92 95 92 99 -18 13 15 13 11 11 -64 65 66 68 69 70 -71 74 77 80 83 84 86 -40 42 45 48 51 52 54 57 -29 31 32 34 37 39 42 -13 14 15 18 19 22 25 27 -20 18 16 13 12 -21 19 16 13 12 10 7 -88 91 94 95 97 -25 22 21 18 15 13 -55 53 51 48 45 42 40 38 -63 62 61 58 55 52 50 48 -61 58 56 55 54 52 49 -59 60 62 65 67 69 -68 69 72 74 76 77 -73 70 68 65 63 61 -88 89 92 95 96 -37 36 34 33 30 -50 51 52 55 56 59 62 63 -67 70 71 73 76 78 -90 92 93 95 96 -41 42 43 45 46 -60 59 56 54 52 50 47 -39 38 36 35 32 31 28 27 -14 17 19 20 21 24 25 -60 58 56 55 53 51 -11 10 7 6 5 -10 11 14 15 17 19 -14 11 8 5 4 3 -64 62 61 58 55 52 51 -17 14 13 12 11 10 7 -72 70 69 68 66 64 61 -74 77 80 82 85 86 88 89 -26 29 32 35 36 38 -62 60 59 57 56 53 50 -26 25 23 22 20 19 16 13 -7 10 13 16 17 20 21 -71 70 69 67 65 62 61 -11 13 14 15 18 21 -22 20 17 14 11 9 6 5 -3 4 6 8 11 12 14 15 -2 4 6 9 12 -81 84 86 88 91 94 97 98 -32 33 36 37 38 41 -78 77 76 74 73 -71 72 74 76 78 -44 45 48 49 51 53 54 -78 75 74 73 70 69 66 64 -75 74 71 69 66 63 -84 82 79 78 75 74 71 69 -62 61 58 56 54 52 51 48 -98 95 92 89 88 87 85 -3 5 7 9 10 12 14 -89 87 85 83 82 -80 79 77 75 73 71 68 -61 62 64 66 69 72 74 76 -51 49 46 44 43 40 39 38 -70 67 64 63 62 -35 34 33 31 29 27 24 23 -42 44 47 50 51 52 -52 55 58 59 62 64 65 -67 69 72 74 77 80 -14 12 11 9 8 -53 51 48 45 43 -57 58 60 63 65 68 70 -30 32 35 36 38 41 43 -99 97 96 94 91 89 88 -68 65 63 61 59 57 56 -92 90 88 86 85 -44 46 47 49 52 -49 52 53 54 56 57 59 -28 27 25 22 21 20 17 16 -48 46 43 41 40 -79 80 82 85 87 88 89 -58 56 54 53 52 51 49 47 -54 57 60 61 62 64 65 -40 39 38 36 35 33 -32 30 29 27 24 23 22 -17 14 11 9 7 5 -91 89 88 87 86 83 -19 16 14 11 9 8 -40 41 42 45 46 49 51 52 -86 84 81 80 77 74 71 68 -42 41 39 37 36 34 -36 33 32 29 26 23 20 -24 21 20 17 16 -12 9 8 5 4 -76 79 82 85 88 91 92 -64 66 69 72 75 -35 37 38 41 44 46 49 51 -94 92 89 87 86 85 -66 68 71 74 76 -81 80 79 77 75 74 72 71 -83 86 89 92 94 -43 40 37 34 31 -36 37 38 41 43 -31 28 25 23 20 18 -45 44 42 41 38 36 -86 85 84 82 80 77 74 -58 57 55 54 53 50 49 47 -70 71 73 75 78 -73 76 79 80 82 -85 83 81 78 75 72 -37 38 39 42 45 48 50 -64 67 68 71 72 -66 63 61 58 56 -61 64 65 67 68 69 72 74 -95 94 91 90 89 87 85 84 -84 87 89 91 94 -63 65 68 71 72 73 -40 39 38 37 35 34 32 -88 87 86 83 82 81 80 -71 70 68 65 63 62 -92 90 88 85 82 81 80 -76 74 71 68 65 64 -9 11 12 14 17 -74 75 77 78 80 82 -30 33 36 38 39 42 44 45 -59 62 63 65 67 69 -83 86 88 91 94 95 -29 28 26 23 21 -70 71 74 77 78 80 82 -70 72 74 75 76 -6 9 12 15 18 21 24 25 -32 31 29 26 23 22 -76 75 74 72 70 68 -93 92 91 90 89 -56 58 59 60 63 64 -72 73 74 76 78 80 83 85 -96 95 92 89 86 84 -98 95 94 93 90 -27 29 31 33 36 37 39 40 -48 47 44 41 39 38 37 36 -20 19 16 14 13 -98 97 96 95 92 -71 72 74 75 78 80 -49 51 53 55 57 -63 60 59 56 53 -78 80 82 83 84 -80 79 77 75 73 71 69 66 -24 25 27 30 33 34 36 -81 82 84 86 89 -35 36 39 42 43 44 46 -14 15 16 18 21 23 25 28 -83 84 86 89 92 93 -82 81 78 76 73 -19 21 24 27 28 30 32 -61 60 58 56 53 -7 8 10 12 14 -69 67 66 64 61 59 -29 28 25 23 21 -44 46 49 52 54 55 57 60 -6 7 9 10 12 14 15 -27 25 22 19 18 17 14 -50 52 54 56 59 60 63 65 -40 39 36 33 32 -10 11 12 14 16 -30 27 26 24 23 21 19 18 -24 22 20 19 18 16 14 -89 91 93 95 97 98 99 -60 57 54 53 51 48 47 -1 3 6 7 8 10 13 -14 13 11 10 8 -57 55 53 51 50 -48 46 45 42 40 39 36 35 -42 43 45 47 50 -92 90 88 86 85 82 -94 91 90 88 87 85 84 82 -45 46 48 50 53 -24 21 20 17 14 11 9 7 -65 64 62 60 59 56 55 53 -54 51 50 48 47 44 43 -49 47 45 42 39 38 37 34 -37 34 32 30 27 26 25 -87 88 91 92 94 97 -86 84 81 79 76 73 71 70 -59 60 63 64 65 -39 42 43 44 46 -14 16 17 18 21 23 24 27 -5 6 7 9 12 14 16 19 -64 65 67 70 73 -90 89 88 85 84 81 78 -83 85 88 90 92 93 96 97 -83 81 79 76 74 73 -68 71 74 77 78 80 83 86 -41 40 38 35 34 -34 31 28 27 24 -87 88 90 92 93 94 96 -52 55 56 57 60 62 -17 20 23 24 25 27 -30 28 27 24 21 18 15 12 -28 27 26 25 22 19 -72 69 68 67 66 64 -59 56 55 54 52 49 47 45 -26 28 31 32 35 36 38 -52 49 46 45 42 41 39 -9 10 11 12 14 15 17 -35 36 37 39 40 42 44 47 -59 58 55 54 53 52 -11 10 9 8 6 4 3 -18 20 22 23 24 27 -10 8 7 6 5 4 3 -68 71 72 74 76 77 -64 63 62 59 56 54 51 -37 36 35 33 31 28 -98 97 96 95 93 92 90 87 -18 19 21 24 27 -23 24 26 29 30 33 36 39 -52 51 49 47 46 45 42 41 -50 48 47 44 43 -40 43 46 49 52 54 55 58 -45 43 40 37 35 33 31 29 -35 33 30 27 24 23 20 18 -82 83 84 86 88 -19 16 13 10 9 -37 34 33 32 29 -86 83 80 77 76 -77 78 79 81 84 87 88 90 -13 15 18 21 22 25 27 -6 7 9 11 13 14 17 18 -51 50 48 47 46 44 41 40 -79 80 82 83 85 -74 72 69 67 65 63 62 59 -58 57 55 53 50 -54 57 60 62 64 65 68 -28 30 32 34 37 38 -10 13 15 18 20 22 24 27 -80 79 77 74 73 71 70 -21 20 18 15 13 11 9 -21 23 26 29 31 33 35 -74 75 76 78 81 83 -61 58 56 55 54 53 51 50 -54 55 56 57 60 62 64 65 -45 43 42 41 38 37 35 34 -47 50 53 56 57 59 -98 95 94 93 92 90 -13 12 9 7 6 4 2 -68 70 73 76 79 80 81 84 -59 62 65 68 69 72 75 -80 82 84 87 89 92 95 -63 65 68 70 71 72 73 76 -92 90 87 86 85 82 80 77 -20 18 15 13 11 9 7 -60 59 58 55 54 51 48 47 -18 16 15 13 11 9 -71 68 65 62 61 59 57 -69 68 65 62 60 57 56 -75 74 73 72 70 67 65 62 -17 20 22 25 28 31 -43 45 46 48 50 51 -28 25 22 21 19 17 15 -36 33 30 29 27 24 22 21 -13 14 15 18 20 23 -84 82 81 78 77 76 75 -23 26 27 30 33 -56 53 50 47 46 -25 27 28 30 31 32 34 37 -90 92 94 95 96 99 -82 83 85 88 90 92 95 -49 46 45 43 42 40 -55 58 61 63 65 68 69 72 -61 62 65 66 68 69 -49 52 54 55 56 58 59 61 -41 43 44 46 49 -74 71 70 68 65 62 61 58 -26 29 30 31 32 35 38 40 -11 12 14 15 18 21 -79 76 74 72 71 68 66 -17 20 23 25 27 30 33 35 -52 53 55 58 60 -6 7 9 11 12 -88 85 84 83 81 79 77 -71 74 76 77 79 -70 72 75 78 79 -54 56 58 59 62 -97 96 94 91 90 -6 9 10 11 14 17 20 22 -23 21 18 15 14 -99 98 96 94 91 88 87 -96 93 92 90 89 88 -91 89 88 85 84 82 80 77 -86 87 88 91 94 -3 4 7 10 11 12 -56 59 61 64 67 -40 41 44 46 48 49 52 53 -35 34 32 31 30 27 24 22 -48 47 44 43 42 40 38 36 -31 29 26 23 20 19 16 -25 27 28 29 30 32 -4 7 10 13 15 -36 39 40 42 43 45 48 -20 23 25 27 28 31 34 -40 42 45 48 49 52 54 -14 12 10 9 7 4 2 1 -76 74 71 68 66 64 -25 27 29 30 31 -34 31 29 28 25 24 22 -63 64 67 70 72 73 -95 93 90 89 87 85 -29 27 25 22 20 18 -28 30 32 33 34 37 -53 52 49 46 43 42 -41 40 38 36 33 31 30 -81 79 77 75 74 73 -97 96 95 94 93 90 -77 79 81 82 83 -67 64 62 59 56 54 -55 54 52 50 48 46 45 -74 73 70 69 67 -90 88 85 82 80 -16 14 13 12 11 -32 31 29 26 24 23 -17 18 21 24 27 -21 18 16 14 11 9 6 -37 39 41 42 45 47 -6 8 9 11 13 -35 34 32 30 28 27 25 23 -80 78 77 75 73 71 -4 5 6 9 12 15 -48 51 52 53 55 56 57 -31 33 34 35 37 38 40 42 -75 77 78 80 83 86 87 -39 40 43 46 49 51 -70 71 72 74 75 77 79 -95 92 89 87 85 84 82 -5 7 10 12 14 17 18 20 -68 67 66 65 62 -61 63 64 66 68 69 70 73 -61 59 57 55 53 51 -38 36 33 32 31 30 29 -83 82 79 76 75 74 72 69 -17 20 22 23 26 28 -81 83 86 87 90 93 94 -85 82 81 79 77 -7 10 11 12 13 -94 93 90 87 84 82 -63 64 66 69 70 71 73 -35 36 37 39 42 45 -48 47 45 44 41 -93 92 91 89 88 86 -47 50 52 54 55 -33 35 38 40 43 46 48 49 -70 73 76 77 80 -96 95 92 91 88 87 84 83 -14 17 20 21 22 23 25 28 -14 15 16 17 18 20 21 -72 71 70 68 65 63 60 59 -57 60 61 64 67 68 -18 17 16 13 10 -49 47 44 42 40 38 -30 32 34 37 38 -70 69 68 65 63 62 61 -37 40 43 44 47 48 -55 54 53 52 50 47 45 -90 88 86 85 83 81 80 -90 88 85 83 80 -38 40 43 45 46 -64 67 70 73 75 -91 93 95 98 99 -18 15 12 9 8 6 4 1 -80 77 75 73 70 67 64 62 -29 26 24 21 19 16 15 -61 63 64 67 69 72 -60 59 57 54 53 -63 61 59 57 56 54 53 -49 50 52 53 54 -57 59 60 63 66 -61 63 64 65 66 67 69 70 -24 21 19 18 16 14 -42 39 36 35 34 33 -95 94 92 91 89 86 83 -72 75 77 78 81 83 86 -4 5 6 8 9 12 14 -20 22 25 28 30 33 -65 68 70 71 73 74 -1 3 4 6 9 11 12 15 -75 77 79 81 83 85 -21 22 25 28 29 31 34 -8 7 4 3 2 -39 37 34 31 28 \ No newline at end of file diff --git a/2024/day2/input_test b/2024/day2/input_test deleted file mode 100644 index 2d6faf5..0000000 --- a/2024/day2/input_test +++ /dev/null @@ -1,6 +0,0 @@ -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 \ No newline at end of file diff --git a/2024/day2/solve.py b/2024/day2/solve.py deleted file mode 100644 index 3ec9967..0000000 --- a/2024/day2/solve.py +++ /dev/null @@ -1,31 +0,0 @@ -safe = unsafe = 0 - - -def is_safe(report: str) -> bool: - last_num = 0 - increase = True - for ii, num in enumerate((int(elem) for elem in report.split())): - if ii != 0: - if ii == 1: - increase = num > last_num - - if (num > last_num) != increase: - return False - - diff = abs(num - last_num) - if diff < 1 or diff > 3: - return False - - last_num = num - - return True - - -with open("input") as f: - for report in f.readlines(): - if is_safe(report): - safe += 1 - else: - unsafe += 1 - -print(f"safe: {safe}\nunsafe: {unsafe}") diff --git a/2024/day2/solve2.py b/2024/day2/solve2.py deleted file mode 100644 index 8e2f8e7..0000000 --- a/2024/day2/solve2.py +++ /dev/null @@ -1,42 +0,0 @@ -from typing import Generator - -safe = unsafe = 0 - - -def is_safe_with_dampening(report: str) -> bool: - numbers = [int(elem) for elem in report.split()] - for ii in range(len(numbers)): - if is_safe((elem for idx, elem in enumerate(numbers) if idx != ii)): - return True - - return False - - -def is_safe(numbers: Generator[int, None, None]) -> bool: - last_num = 0 - increase = True - for ii, num in enumerate(numbers): - if ii != 0: - if ii == 1: - increase = num > last_num - - if (num > last_num) != increase: - return False - - diff = abs(num - last_num) - if diff < 1 or diff > 3: - return False - - last_num = num - - return True - - -with open("input") as f: - for report in f.readlines(): - if is_safe_with_dampening(report): - safe += 1 - else: - unsafe += 1 - -print(f"safe: {safe}\nunsafe: {unsafe}") \ No newline at end of file diff --git a/2024/day3/input b/2024/day3/input deleted file mode 100644 index 64eaed9..0000000 --- a/2024/day3/input +++ /dev/null @@ -1,6 +0,0 @@ -from()$&mul(602,165)why()mul(305,64)?(where()-:mul(80,703);)why()*from()%select()mul(290,957)}/?%'from()]mul(851,335)mul(844,49)what()]![from(667,522)]}how()how()mul(938,695)#/)*?@~?@select()mul(706,392)^mul(242,513)who()@]mul(871,132)( ] from()$mul(41,656)^{(&how()from()[when()-when()mul(628,478)mul(287,621)why():'mul(127,825)# ]mul(360,578)select()?^^select() @:why()mul(136,849);{how()%*@%+how()[mul(544,891)mul(436,21)from()}mul(184,294)+/from(81,871) how()&?]mul(297,492)select()/}%;$$~{*mul(161,703)when():+(,mul(335,695) ()&where()?who();'mul(689,420)^how()from()how()what()>]where()don't()}%mul(78,176)~$where():@,>%mul(62,695)@{#how()mul(742,538)who(){$$who()@{+(mul(282,209)%mul(428,514)/+from()}>@mul(665,815),mul(762,48)[+/mul(591,445)~?who()#mul(36,3)select()~$ [<}*/do()''>~'$mul(109,905)}how(){!@where()%/mul(380,929)*){~:where()mul(547,552)$:*mul(58,881)where(145,89)[why(634,213)mul(699,443)mul(826,660)what()from()-how()}'from()what()<;mul(700,665)] #(*?how()<+mul(507,719))~*/-^(%mul(941,551)$;don't()#;:when()+#>mul(87,663)who()/how()mul(332,238)~mul(290,235)',why()mul(950,204);where(),(when()mul(233,633)-^}@who()^mul(289,147)$>-'$select(736,261)*~]mul(899,836)'why()do()@when()why()from()mul(975,883);select()who()mul(165,847)why();^/{^mul(31,153)?;'don't()( from()+})what()mul(262,509)!*where()}/-#~/mul(308,953);*!]mul(741,76)[mul(256,536)[)>%-who()<^[$mul(382,338)where()[ when():select()<>mul(993,630)@$mul(411,640)/+where(623,926)/~mul(807,676)+*],mul(579,979who()what()from()when()how()what(),mul(882,434)&who()'mul(154,824)from()#<<,,{where()$mul(259,438)from()}?:;mul(641,967?from())<,>~mul(325,912)%select()mul where()do()where()where();(!,[$why()mul(131,307)mul(323,794)mul(570,548+!$from()!}what(588,195)-from()mul(319,524)!/why()mul(737,137)+^&]/mul(228,919)@mul(672,604)+when(773,127)select()+why(941,245)mul(121!<[?$?;from(987,370):mul(904,487)#^what()from()({?mul(791,791)!,::)@^(mul(517,686)what()*how(),why()&mul(218,978)#,who()&$who()how(205,211)where()[mul(70,357)^$[?^$^what()mul(245,237)where()why()?{/mul$when()+},why()mul(264,30)@*:when(628,215):+&why()[mul(346,794){:}~-,select(),mul(115,926)~mul(140,56)[/:#~don't()@:mul(889,788);;*!<$[when(),%mul(177,883)[mul(815,344)when()@$+ @)where(935,128)}{mul(638,520)why()-] when()] mul(639,171)!>[mulwho()~^:what()why()] mul(560,354)from()where()/];,how()} mul(980,896) ->/;%who()&where(504,464);!do(),where()/mul(901,274)!when()mul(76,577)>select()mul(257,297)^+(/what(52,6)@%from()who()mul(331,276),what()when())+]{:&mul(653,163)''; '~mul(946,195)+/[from()mul(345,866)mul(975,684)#-:/why();-<:&mul(416,406)where(864,494)}{mul(343,101where()~ $/!where(331,467)who()@:mul(484,862)' mul(629,780)&%why(436,493)what()$mul(104,102)$,where()mul(2,157)who()%mul(404,895)mul(154,983)):]]%#:do()]from()+/#)/mul(682,696)what(518,168)select()where()+when(518,618)mul(799,756)+}why()}:mul(565,289);mul(687,685);@%!>?why()&;-mul(819,190)}]mul(596,898)mul(113,184)who();{@do()@?)why(),*/select()[mul(351,147):{+}}~^from()why()mul(350,104$''(from()$!when()mul(574,321)-mul(325,17);<& who(){]mul(960,765)^from())<<$:how()mul(412,562);mul(220,976)*mul(338,463),$/#',from();select()*mul(982,199)&^:&mul(607,915)who()mul(473,531)$mul(490,191)select()&-~+>when()mul(105where()'/!do()<;[#why()mul(453,793)&*,^who()who()what()-@why()from(642,548)%^(from()+don't()?-mul(976,65)what();]mul(155,153))where()who()when()[]mul(44,452)}mul(51,177)~$[mul(462,949)$}^select()#[)]mul(743,555)?[mul(750,557)}#{from()%(why()where()mul(807,786)+})>{)what()}do()mul(231 (how()*mul(667,833)when()~from()why(),who()(;)mul(729,999)mul(805,756)when()}what()who()!**who()]mul(920,392*]when(26,462)mul(558,874)!~?+$$';mul(694,195)when()/$?from()mul(198,978)%>;/why()who()}+why()@mul(248,980)$ how()>'select();mul(888,351)mul(476,169)[>@-mul(282,926)#why()mul(637,563)-'~@!how()'^what()$mul(303,12)]how()~mul(922,806)^+when()[?don't(){,when()!*select()select(828,14)who()'why()mul(237,256)#mul(603,548)mul(887,362)!>%/how()[,%]don't()&mul(499,574)select()}%how() mul(787,625)what()who()) '*,mul(197,610)?!~('where()%'select()how()mul(840,759)} {$mul(19,916)}/mul(965[)) *who()how()~from()who()how()mul(319,356),where(196,245) who()mulwhat())^when(211,851)select()do()-$>+}'?from();>mul(349,592)&;>mul(473,196)where()~mul(939,515)$?{;^{}what()mul(417,24){??where(390,662)~from(),mul(93,289) when()] #from()$mul(543,426)&;&*;why()where()mulfrom(){-?'>,;who()mul(65,960):!how()*}*mul(544,316)%what(585,366)how():>mul(453,85)&[-from()/-#?how(829,900)why(){mul(544,588)mul(178,94)from()where()mul(84,939)+^]who()]select()(&mul(951,416)how()[-] mul(324,907)who(){< )mul-select()![@&mul(578,700)mul>@~]%){mul(543,266)#how()!*why()$@%don't()>$what()mul(451,107)/mul(307,230)+@$when()from()?['mul(822,895)$mul(530,529)+mul(792,795]$from()what(158,547){what()mul(851,381)?when(649,20),*mul(73,793)<] :(:@+;mul(93,749)from()];'mul(419,25);:!who()-mul(102,426)'why()+from();mul(186,663) -select()$how()]%]{~mul(183,456)::,+;![when()>mul(513,696)mul(835,886) from()##* select()%{mul(820,742)don't()why()mul(295,615)^]what()how()-what()*who()why(931,57)when()mul(688,219)!@mul(191,470)how()>?from()from(764,712):where(){:mul(951,673)!mul(536,960)[>?':]mul(353,508)!*how(977,514){)'mul(135,970)}>%select()select()::where()mul(580,976)'^when()mul(144,491)what()%&]mul(360,420(who()how() :@mul(925,707)mul(723,986){mul(465,348) mul(153,323)#~when();from()@}-;] how()[^ :what()mul(990,144)}mul(567,848)select();@where()'(^@mul(620,639))how(711,187)how()select()+?)+^don't()mul(776who()$mul(592,515)what(),who(),mul(870,763)where():when()^>{}mul(503,440)mul(524,563)why(112,173)how()(,[;mul(235,893)how()*?/]mul(524,355%/],^]*^!%where()mul(464,297)select()from()who()};%what();{mul(289,689)#who()[&[mul(604,447)select()~#<;(~^mul(807,738)[~/from()mul(477,588) ^-]-mul(820,399)@-when()>%mul(580,918)mul(401why()*;],why()]]+!mul(343,445)*<+why()$mul(830~@who(),;from()#mul(776,674)?$who(){+mul(295,290){where()when()mul(321,389)&{'@$}who()mul(879,995)*{from()/(;)mul(569,107)mul(223,576)~~>*@when()]]mul(624,981)?{^'$>(mul(812,37)what()-?:>&{+mul(731 < %-who()select()mul(656,82)how()'from()mul(446,744)'<;~why()}^:,]mul(461,437)when(245,888);$[%when(896,829)who()>{mul(791,568),-%$! ?#*mul(134,101),~<-'}how(672,596)?/mul(641,129) :from()#?mul(414 )]-%from(),@)(mul(53,315):@& ,who()where(734,227)^mul(271,699)from()>how():when(595,247)'}%',mul(730,933)from()',]why()+ how()where()mul(231,37)~<+&[$:}!:mulwhen(572,105)}who()mul(374,347)/-why()*what()how()#!@}mul(230,754)-what()-:mul(759,756)select() $what()]^select()#how()?mul(567,572)mul(757,309)'[mul(530when()+/(*{mul(736,155)+*where(960,885)%: {:mul(713,672)!$*{#%mul(17,60)&what(966,667)what()why(): select(428,568)*!&mul(228,28)where()where()@/])do()}!/{^?{[why()mul(218,633)mul(156,644)>{~^[?mul(377,886) where()%who(159,149));how(909,452)-mul(869,404)>:mul(920,501){what())+how()mul(545,793)~-mul(74,347)where()!-;how()when()>)%mul(647,960})>;&why()mul(767,582)~^+;who()<)<)mul(494,399/;-from()^don't()why()mul(215,704)%%from()mul(392,808)-who()+where()[{-*/mul(869,412)from()mul(501,148)?'don't()from():}select()mul(796,221)select()mul<)@ ,when()}[:[what(96,456)mul(651,592)when()';$ (*why()mul(134,209);select())[mul(434,869)@{+'$mul(292,419)mul(175,874),from()select()$?[{^mul(866,742) -how()?}% #who()']#!/usr/bin/perlmul(875,840);]:::mul(127,915)>^>select(736,608)why()+ mul(13,855) ++ how()>mul(568,520)<)'mul(332,245)::where()@&mul(625,889):who()^}+who()mul(392,15)*how()mul(437,461)select()]+how()$(!mul(219,47)^mul(518,535)(select()#mul(776,790)who()^how()~)where()mul(622,336)why(171,784)>];@who()where()mul(255,591) >when()what()-,)&(mul(827,655):)(*mul(457,68)]what()^[&[mul(758'/select()mul(351,283)<{&{*%,mul(345,900)&when()<;[:[(when()select()^(^@mul(904,504){{from()(&mul mul(537,360)why()/{)what())mul(812,420){!mul(320,4)who(275,101)who()}^who()^why(562,771)%;-don't()<}}]mul(943,216):{)mul(17,572)&$why()where()mul(86,371)from()$$ +,>,mul(793,733)^?how()&?{;mul(174,855)(#/ what()select()where()[*mul(706,247)who()~why()/#;*mul(459,541) where()}mul(586?(mul(470,802)who(773,148){what()?/why(397,830)),where()from()mul(532,611){[select())}why()when()mul(855,381))@?-/) (do()who()mul(4?*select()$select()where()!!mul(758,795)/*:mul(221,874)mul(587,201)~{?{;/why()mul(757,730)'$-$how();do()why(423,32)}%!*from(930,638)mul(196,228)%mul(753,37)'mul(970,912)[what();~mul(643,558)(where())how()mul(525,660)when()}$#) +mul(770,997)mul(523,352)/%when()mul(139,306)/(mul(435,619)who()$;)mul(353,463)/how()$who()#what()!where()select()mul(218,409)'$:what()^don't()#when()from() &}>where()?mul(41,95)%mul(93,123)mul(615,917)how()^#mul>!@~how()>mul(801,12)select()what(76,678)from()$#}>mul(206,424)/;~select()what()who()%:/mul(920,696)'^+mul(467,893how()mul(732,924)when()*{mul(212,801)select()}$mul(253,942)from(245,298)$%select():mul(200,773)(what() ,mul(484,816%[@:what()$#mul(392,392)select()/mul(603,982){?'}{%mul(767,605)(*select(839,960)from()%,[-{%mul(810,348)<)}:$why()-mul(568,717$/*!*:#<<mul(519,560)mul(371,303)#mul(444,873)/#;~! mul(825,442) -;'?,&@@mul(687,295)mul(992,56)from()@$:when();mul(839{*;~mul(577,183)@-where()}why()~@^from()mul(226,901)how() >%when()?[~mul(281,291)#&>#$how()}mul(500,749)&>^-;why()@!@]do()/@?*,]~)mul(530,987)who()why()why()@>mul(282,486)*,-from(),>'what()mul(147,97)- /select()<$do()mul(339,632)<+mul(476,603)#$!mul(249,732)![]mul(552,713)}%^:[~who(294,666)!mul(335,971)>#mul(190(how();who():)mul(364,772)[~,when()*mul(350,52;who(640,301)from()-$,%:};mul(407,507))&#why()/{&[mul(668,42),~mul(849,891)what()*-:/who()$mul(335,214)?:why(); ,%mul;}mul(561,325){mul/+?when()select()#do()!{!)/!mul(398,351)'$]how()%?:)from(716,264)}mul(976,539)when()}/mul(800,619)who())[?mul#+who()}mul(527,856)mul(479,693)[what()#}{where()where()mul(310,5)$]>mul(687,149))!how(),why()how(941,130)where()when()what()mul(187,693)(mul(24,418){':}mul(304,601)when()mul(66,524)how()']select()from()>what()mul(217,884)~~-when())?@/mul(62,572)))when(482,658){select(561,928)when()!({mul(388,507)from()/+mul(64,284)who()why(899,74)when()why()mul(734,117)<-+}#:what()mul(567:where()select()mul(694,323)/[select()mul(772,515)[/'>why()when()/(*@mul(663,798)$when()select()$%#<,select()mul(810,58):~,(+select()[from()~'mul(838,509)mul(227,633)] mul(300,309)]>,!}'mul(369,74)$~({ ~'}{]don't()~)&<[>who()>mul(76,891)!]~ }:)${/mul(226,65)~/&<)^mul(981,600)[who(271,199)~-$&;[where(691,309)mul(69,207)*>select()*(+mul(935,119)<> ?;->mul(116,703)'where()-;;from()mul(324,982from()what()@<^mul(144,872)@+mul(569,48)mul(475,850)*how()'~^-mul(486,714)~![why()why()}</select()how()mul(789,342)?select()]!why()#mul(485,483)'%why();?%who()mul(921,916)do()'*]where()how(977,165)@mul(441,964)*-who()]&mul(395,170)> }mul(583,793)<*-how(){{mul(794,26)%~/;mul(297,812)mul(264,703)[select(253,420)select()mul(665)*when()*/>when()from()/where()!mul(264,312)where(756,949),+{}from()+;mul(454,375),do(){mul(72,780)(who() mul(4,67) -/why()[*>when())from()mul(163,222)who();select()@?select()mul(631,370)where()^%mul(48,604)%where()select()]%:!{mul(492,16):?select(566,72)'@+when()})mul(277,631)when()when()+%#mul(356,136)mul^who() from()!from()~[don't()?:#!mul(536,636){how()why(167,58){from()$;&mul(170,241)-~$mulwho(),mul(295,979)^when()$}mul(872,817)'^+ %%%@%;mul(796,401){@$from():%(@who()where()do()how();,>where()*how()mul(562,34)mul(851,857)([how()mul(870)do()^#]what()mul(855,774)>from()mul(19,63))from()/'#mul(502,592)$(mul(330,265)-*'why()/<@mul(919,336)'when()when()(~ mul(222,37)mul}*?mul(716,440);how(254,405)#mul(938,798)]why()+mul(370,761);+select())mul(308,872):!who()%mul(376,736)when()[don't()$;#~,how():select()~what()mul(793,522)){?who()/mul(812,372)<;@mul(627,289)[!don't()^+)how()$from()##mul(500,501)#{why(120,25)mul(571,651):&{?mul(792,25))@$(@>don't()who()?^')' from()[mul(323,38)when()where()*/who()%mul(623,356)?mul(629,625))}+how()mul(950,826)(+,#mul(947,453)why();'how()&]from()mul(510,94)-?[from(){mul(34,148){when()mul(661,839)do()/}who()mul(597,740)^;mul(6,887)~#how(287,928) $>?}:don't()/-%(,;/))mul(910,743)!:%,%}/mul(626,661)((&([mul(320,446){what()'~<-@mul(573,309)^:?why(352,585)how(328,377)(@mul(996,815),~don't()mul(558,873), what()?>]^$mul(647,533);$@]!when();;when()mul(508,819)&select()( select()mul(823,518)/-how(),]mul(584,720)mul(127,993)''why()'/![where()mul(130,642)*what()when()mul(648,223)#}])don't() !when(647,635)+&$ mul(154,204)@~~?mul(90,691)when()]^&from()'[mul(236,768)~where())^~->(&mul(378,233) pos: - break - else: - current_state = elem[1] - - return current_state - - -result = 0 -for match in pattern.finditer(data): - if get_do_state(do_dont_intervals, match.start()): - result += int(match.group(1)) * int(match.group(2)) - - -print(result) diff --git a/2024/day4/input b/2024/day4/input deleted file mode 100644 index ea53c2c..0000000 --- a/2024/day4/input +++ /dev/null @@ -1,140 +0,0 @@ -MMSSMSMXAMXMSSSSMMXSSMSAMASASXXAAXMAXXAMXAXSXMAMXMMMMSSMXMAAAMXMMMXXAMMAMSAMXXAMMMAAMMMSMMMMMXXSAMXMASXMXSMSXMXMMMSMSAMXSSMMXMMASMSMSMMMAMMS -AASAAAXMSMMAMAXAASMMAAMASXMMSASMSSXASAMXXAXMASAXXMMMAAAXMAMXMSAMSMSSMSMAMMMMSMAMASMMSXMAXXAASXAXAMXMASAMMSAMXMXMAAAXMASXMAMSAXXMSAAAAAASASXS -MXSMMMMAAMAAMXMSMMASMMMAMAAAMAMAAMMAXAMXSSXSAMSMSAMMMSSSMSXM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XSMMSXSXAASMMSSMSXSXSXMSMMAMXMAMS \ No newline at end of file diff --git a/2024/day4/input_test b/2024/day4/input_test deleted file mode 100644 index c41c5ea..0000000 --- a/2024/day4/input_test +++ /dev/null @@ -1,10 +0,0 @@ -MMMSXXMASM -MSAMXMSMSA -AMXSXMAAMM -MSAMASMSMX -XMASAMXAMM -XXAMMXXAMA -SMSMSASXSS -SAXAMASAAA -MAMMMXMMMM -MXMXAXMASX \ No newline at end of file diff --git a/2024/day4/solve.py b/2024/day4/solve.py deleted file mode 100644 index da301c9..0000000 --- a/2024/day4/solve.py +++ /dev/null @@ -1,43 +0,0 @@ -def check_direction(lines: list[str], row_idx: int, col_idx: int, row_step: int, column_step: int) -> bool: - column_count = len(lines[0]) - row_count = len(lines) - for step, letter in enumerate("MAS"): - current_row = row_idx + (step + 1) * row_step - current_col = col_idx + (step + 1) * column_step - if current_row >= row_count or current_row < 0: - return False - - if current_col >= column_count or current_col < 0: - return False - - if lines[current_row][current_col] != letter: - return False - - return True - -def get_current_pos_words(lines: list[str], row_idx: int, col_idx: int) -> int: - if lines[row_idx][col_idx] != 'X': - return 0 - - count = 0 - for row_step in range(-1, 2): - for column_step in range(-1, 2): - if row_step == 0 and column_step == 0: - continue - - if check_direction(lines, row_idx, col_idx, row_step, column_step): - count += 1 - - return count - -data = [] -with open("input") as f: - for line in f: - data.append(line.strip()) - -result = 0 -for row, line in enumerate(data): - for col in range(len(line)): - result += get_current_pos_words(data, row, col) - -print(result) \ No newline at end of file diff --git a/2024/day4/solve2.py b/2024/day4/solve2.py deleted file mode 100644 index 8866fc0..0000000 --- a/2024/day4/solve2.py +++ /dev/null @@ -1,33 +0,0 @@ -def is_xmas(lines: list[str], row_idx: int, col_idx: int) -> bool: - if lines[row_idx][col_idx] != 'A': - return False - - if row_idx == 0 or col_idx == 0 or row_idx == len(lines) - 1 or col_idx == len(lines[0]) - 1: - return False - - found_mas_count = 0 - for row_step in range(-1, 2, 2): - for column_step in range(-1, 2, 2): - current_corner = lines[row_idx + row_step][col_idx + column_step] - if current_corner == 'M': - if lines[row_idx - row_step][col_idx - column_step] == 'S': - found_mas_count += 1 - else: - return False - elif current_corner != 'S': - return False - - return found_mas_count == 2 - -data = [] -with open("input") as f: - for line in f: - data.append(line.strip()) - -result = 0 -for row, line in enumerate(data): - for col in range(len(line)): - if is_xmas(data, row, col): - result += 1 - -print(result) \ No newline at end of file diff --git a/2024/day5/input b/2024/day5/input deleted file mode 100644 index 75195a7..0000000 --- a/2024/day5/input +++ /dev/null @@ -1,1387 +0,0 @@ -24|55 -38|32 -38|21 -48|51 -48|92 -48|14 -78|35 -78|54 -78|87 -78|44 -72|29 -72|65 -72|87 -72|82 -72|37 -23|56 -23|51 -23|81 -23|83 -23|25 -23|87 -25|14 -25|18 -25|55 -25|22 -25|15 -25|77 -25|17 -54|96 -54|65 -54|33 -54|21 -54|36 -54|29 -54|56 -54|89 -56|78 -56|88 -56|77 -56|52 -56|22 -56|81 -56|14 -56|85 -56|17 -33|23 -33|22 -33|83 -33|14 -33|89 -33|25 -33|55 -33|92 -33|72 -33|78 -96|78 -96|21 -96|14 -96|77 -96|92 -96|68 -96|88 -96|24 -96|83 -96|55 -96|91 -97|56 -97|54 -97|17 -97|43 -97|13 -97|33 -97|48 -97|96 -97|65 -97|89 -97|83 -97|37 -35|92 -35|23 -35|25 -35|52 -35|24 -35|33 -35|51 -35|21 -35|55 -35|88 -35|17 -35|56 -35|89 -52|44 -52|61 -52|88 -52|82 -52|64 -52|71 -52|51 -52|99 -52|97 -52|68 -52|85 -52|91 -52|18 -52|55 -22|43 -22|61 -22|72 -22|68 -22|15 -22|87 -22|64 -22|85 -22|97 -22|88 -22|51 -22|71 -22|18 -22|63 -22|91 -29|14 -29|81 -29|35 -29|89 -29|96 -29|21 -29|13 -29|36 -29|23 -29|65 -29|48 -29|17 -29|24 -29|52 -29|33 -29|99 -65|17 -65|15 -65|25 -65|48 -65|56 -65|22 -65|52 -65|21 -65|92 -65|23 -65|36 -65|83 -65|24 -65|55 -65|37 -65|89 -65|81 -36|77 -36|96 -36|83 -36|99 -36|56 -36|89 -36|68 -36|21 -36|55 -36|92 -36|78 -36|88 -36|51 -36|72 -36|52 -36|14 -36|24 -36|17 -32|24 -32|83 -32|13 -32|29 -32|21 -32|25 -32|92 -32|56 -32|33 -32|99 -32|96 -32|14 -32|35 -32|22 -32|88 -32|17 -32|65 -32|81 -32|37 -64|42 -64|48 -64|37 -64|96 -64|44 -64|56 -64|71 -64|76 -64|36 -64|29 -64|33 -64|23 -64|65 -64|13 -64|25 -64|38 -64|43 -64|32 -64|97 -64|54 -55|64 -55|76 -55|61 -55|43 -55|38 -55|87 -55|71 -55|72 -55|54 -55|68 -55|18 -55|67 -55|85 -55|63 -55|51 -55|78 -55|77 -55|44 -55|15 -55|97 -55|91 -43|14 -43|96 -43|32 -43|89 -43|48 -43|35 -43|23 -43|36 -43|83 -43|24 -43|33 -43|52 -43|56 -43|65 -43|13 -43|25 -43|21 -43|17 -43|54 -43|76 -43|42 -43|37 -92|85 -92|71 -92|38 -92|77 -92|64 -92|76 -92|44 -92|51 -92|63 -92|68 -92|87 -92|55 -92|88 -92|18 -92|99 -92|15 -92|72 -92|97 -92|43 -92|82 -92|61 -92|91 -92|78 -17|18 -17|81 -17|82 -17|52 -17|92 -17|77 -17|64 -17|21 -17|14 -17|68 -17|51 -17|83 -17|99 -17|24 -17|91 -17|72 -17|88 -17|15 -17|87 -17|85 -17|55 -17|22 -17|67 -17|78 -83|68 -83|77 -83|18 -83|99 -83|67 -83|51 -83|15 -83|72 -83|92 -83|22 -83|82 -83|85 -83|88 -83|63 -83|78 -83|44 -83|52 -83|24 -83|91 -83|55 -83|87 -83|61 -83|14 -83|64 -76|25 -76|14 -76|56 -76|22 -76|89 -76|23 -76|42 -76|35 -76|83 -76|29 -76|48 -76|32 -76|81 -76|33 -76|96 -76|13 -76|65 -76|21 -76|36 -76|52 -76|24 -76|17 -76|37 -76|54 -67|32 -67|71 -67|33 -67|25 -67|56 -67|97 -67|42 -67|43 -67|38 -67|37 -67|64 -67|29 -67|76 -67|35 -67|48 -67|44 -67|36 -67|82 -67|54 -67|23 -67|61 -67|63 -67|65 -67|13 -71|25 -71|48 -71|29 -71|33 -71|96 -71|42 -71|17 -71|89 -71|97 -71|35 -71|37 -71|54 -71|23 -71|43 -71|83 -71|36 -71|21 -71|13 -71|38 -71|76 -71|81 -71|65 -71|56 -71|32 -42|22 -42|35 -42|29 -42|24 -42|92 -42|36 -42|32 -42|99 -42|89 -42|14 -42|48 -42|65 -42|56 -42|17 -42|37 -42|96 -42|23 -42|25 -42|13 -42|21 -42|52 -42|81 -42|33 -42|83 -51|67 -51|78 -51|61 -51|71 -51|63 -51|97 -51|42 -51|87 -51|72 -51|77 -51|18 -51|29 -51|15 -51|64 -51|85 -51|82 -51|44 -51|43 -51|68 -51|54 -51|38 -51|76 -51|91 -51|32 -85|61 -85|67 -85|76 -85|25 -85|37 -85|33 -85|36 -85|32 -85|23 -85|97 -85|43 -85|63 -85|38 -85|35 -85|13 -85|48 -85|29 -85|44 -85|64 -85|82 -85|65 -85|42 -85|54 -85|71 -81|82 -81|72 -81|52 -81|87 -81|91 -81|15 -81|14 -81|83 -81|92 -81|22 -81|78 -81|68 -81|77 -81|18 -81|24 -81|67 -81|51 -81|85 -81|64 -81|99 -81|88 -81|55 -81|61 -81|21 -63|29 -63|44 -63|38 -63|89 -63|36 -63|48 -63|25 -63|33 -63|96 -63|17 -63|81 -63|32 -63|43 -63|42 -63|35 -63|37 -63|13 -63|76 -63|56 -63|97 -63|54 -63|65 -63|71 -63|23 -37|22 -37|56 -37|99 -37|36 -37|33 -37|78 -37|92 -37|23 -37|52 -37|14 -37|24 -37|55 -37|13 -37|48 -37|25 -37|81 -37|89 -37|83 -37|21 -37|96 -37|15 -37|17 -37|88 -37|51 -15|67 -15|61 -15|29 -15|77 -15|76 -15|68 -15|97 -15|71 -15|85 -15|32 -15|64 -15|63 -15|54 -15|35 -15|87 -15|91 -15|38 -15|43 -15|78 -15|42 -15|44 -15|82 -15|18 -15|72 -82|71 -82|54 -82|36 -82|65 -82|61 -82|63 -82|35 -82|96 -82|32 -82|33 -82|48 -82|76 -82|97 -82|56 -82|29 -82|43 -82|89 -82|23 -82|38 -82|25 -82|42 -82|37 -82|44 -82|13 -88|42 -88|78 -88|71 -88|15 -88|44 -88|54 -88|51 -88|85 -88|97 -88|43 -88|72 -88|91 -88|76 -88|87 -88|18 -88|64 -88|82 -88|63 -88|77 -88|38 -88|67 -88|68 -88|55 -88|61 -14|85 -14|77 -14|68 -14|87 -14|55 -14|67 -14|44 -14|99 -14|22 -14|91 -14|92 -14|61 -14|38 -14|64 -14|71 -14|15 -14|72 -14|52 -14|51 -14|82 -14|63 -14|78 -14|88 -14|18 -18|65 -18|64 -18|71 -18|38 -18|33 -18|63 -18|43 -18|61 -18|67 -18|91 -18|37 -18|13 -18|82 -18|29 -18|48 -18|97 -18|44 -18|42 -18|23 -18|35 -18|85 -18|54 -18|76 -18|32 -77|54 -77|68 -77|97 -77|63 -77|67 -77|85 -77|37 -77|42 -77|38 -77|61 -77|72 -77|18 -77|65 -77|29 -77|44 -77|35 -77|91 -77|82 -77|43 -77|71 -77|32 -77|76 -77|87 -77|64 -44|38 -44|35 -44|25 -44|36 -44|29 -44|33 -44|89 -44|76 -44|56 -44|37 -44|23 -44|48 -44|96 -44|65 -44|97 -44|43 -44|54 -44|71 -44|17 -44|21 -44|81 -44|42 -44|32 -44|13 -21|61 -21|22 -21|14 -21|82 -21|72 -21|92 -21|91 -21|18 -21|15 -21|24 -21|87 -21|67 -21|83 -21|55 -21|85 -21|99 -21|77 -21|63 -21|68 -21|51 -21|88 -21|64 -21|52 -21|78 -87|37 -87|65 -87|64 -87|48 -87|67 -87|91 -87|33 -87|82 -87|29 -87|63 -87|54 -87|85 -87|42 -87|61 -87|76 -87|38 -87|97 -87|44 -87|35 -87|43 -87|32 -87|18 -87|13 -87|71 -89|87 -89|81 -89|92 -89|78 -89|15 -89|88 -89|64 -89|91 -89|17 -89|68 -89|24 -89|72 -89|77 -89|99 -89|55 -89|83 -89|22 -89|18 -89|14 -89|52 -89|21 -89|85 -89|51 -89|67 -61|63 -61|97 -61|33 -61|23 -61|65 -61|17 -61|35 -61|13 -61|56 -61|71 -61|44 -61|96 -61|42 -61|38 -61|37 -61|29 -61|76 -61|48 -61|32 -61|54 -61|36 -61|43 -61|89 -61|25 -91|65 -91|67 -91|44 -91|13 -91|76 -91|32 -91|61 -91|82 -91|63 -91|85 -91|29 -91|43 -91|36 -91|64 -91|48 -91|71 -91|38 -91|37 -91|33 -91|42 -91|97 -91|35 -91|23 -91|54 -68|87 -68|65 -68|63 -68|91 -68|38 -68|37 -68|61 -68|35 -68|54 -68|32 -68|82 -68|97 -68|18 -68|71 -68|13 -68|72 -68|64 -68|85 -68|44 -68|42 -68|29 -68|76 -68|43 -68|67 -99|91 -99|15 -99|38 -99|55 -99|72 -99|64 -99|77 -99|18 -99|97 -99|54 -99|76 -99|61 -99|78 -99|44 -99|71 -99|68 -99|82 -99|43 -99|51 -99|88 -99|85 -99|63 -99|67 -99|87 -13|15 -13|14 -13|99 -13|89 -13|17 -13|21 -13|25 -13|51 -13|56 -13|33 -13|48 -13|36 -13|78 -13|83 -13|77 -13|81 -13|24 -13|52 -13|88 -13|23 -13|22 -13|55 -13|92 -13|96 -24|18 -24|87 -24|77 -24|92 -24|52 -24|14 -24|44 -24|61 -24|22 -24|71 -24|82 -24|72 -24|78 -24|68 -24|64 -24|63 -24|51 -24|67 -24|88 -24|99 -24|15 -24|85 -24|91 -38|43 -38|65 -38|54 -38|42 -38|23 -38|33 -38|76 -38|83 -38|96 -38|25 -38|37 -38|48 -38|35 -38|81 -38|56 -38|97 -38|29 -38|13 -38|36 -38|89 -38|24 -38|17 -48|33 -48|83 -48|23 -48|78 -48|55 -48|81 -48|22 -48|77 -48|89 -48|25 -48|24 -48|21 -48|99 -48|36 -48|17 -48|96 -48|68 -48|56 -48|52 -48|15 -48|88 -78|68 -78|72 -78|77 -78|43 -78|64 -78|38 -78|61 -78|97 -78|71 -78|76 -78|42 -78|32 -78|85 -78|65 -78|91 -78|63 -78|82 -78|18 -78|67 -78|29 -72|32 -72|67 -72|97 -72|64 -72|61 -72|13 -72|42 -72|85 -72|76 -72|71 -72|91 -72|35 -72|18 -72|54 -72|48 -72|63 -72|43 -72|38 -72|44 -23|96 -23|68 -23|92 -23|99 -23|22 -23|14 -23|89 -23|72 -23|77 -23|17 -23|24 -23|55 -23|52 -23|15 -23|78 -23|88 -23|36 -23|21 -25|72 -25|51 -25|52 -25|21 -25|92 -25|78 -25|87 -25|91 -25|24 -25|88 -25|96 -25|83 -25|99 -25|81 -25|68 -25|89 -25|56 -54|83 -54|22 -54|81 -54|42 -54|48 -54|92 -54|24 -54|25 -54|13 -54|35 -54|52 -54|37 -54|32 -54|14 -54|23 -54|17 -56|68 -56|24 -56|99 -56|72 -56|15 -56|55 -56|51 -56|18 -56|21 -56|91 -56|87 -56|92 -56|83 -56|89 -56|96 -33|56 -33|99 -33|96 -33|52 -33|81 -33|88 -33|15 -33|36 -33|68 -33|77 -33|17 -33|51 -33|24 -33|21 -96|72 -96|52 -96|67 -96|51 -96|85 -96|81 -96|89 -96|87 -96|18 -96|17 -96|22 -96|15 -96|99 -97|42 -97|29 -97|14 -97|36 -97|81 -97|32 -97|23 -97|21 -97|35 -97|76 -97|24 -97|25 -35|65 -35|22 -35|99 -35|37 -35|13 -35|96 -35|81 -35|36 -35|14 -35|48 -35|83 -52|92 -52|15 -52|78 -52|63 -52|67 -52|22 -52|72 -52|38 -52|87 -52|77 -22|92 -22|78 -22|99 -22|82 -22|44 -22|67 -22|77 -22|38 -22|55 -29|55 -29|92 -29|56 -29|88 -29|22 -29|83 -29|25 -29|37 -65|14 -65|99 -65|88 -65|13 -65|51 -65|96 -65|33 -36|81 -36|87 -36|25 -36|15 -36|22 -36|18 -32|36 -32|48 -32|89 -32|23 -32|52 -64|82 -64|63 -64|61 -64|35 -55|32 -55|42 -55|82 -43|81 -43|29 -92|67 - -42,54,21,36,22,33,13,29,35 -83,67,22,14,78,99,18,92,15,77,52,68,82,55,21,61,85,91,51,64,72,24,88 -85,67,64,82,61,63,44,71,38,97,43,54,42,32,29,35,65,37,13,48,33,23,36 -96,81,21,14,52,99,88,55,51,15,77,68,72,18,85 -63,52,77,85,91,83,22,61,14,64,82,68,51,24,55 -63,97,76,32,29,35,13,48,33,36,25,56,96,89,17 -15,99,51,88,21,83,72,56,81,18,92,52,55,17,89,96,87 -92,22,17,96,78,87,72,14,24,55,81,91,52,83,68,88,18,99,56 -87,18,61,67,64,76,72,85,97,65,91,68,32,44,29,43,37 -87,63,72,64,85,38,43,78,76,82,77,67,88,54,55 -51,77,87,85,67,61,63,44,97 -35,65,37,13,48,36,25,56,81,24,22,92,88 -85,29,32,42,35,87,43,13,63,37,71,72,82,76,91 -56,35,81,96,55,92,83 -54,68,67,77,61,18,63,76,82,55,97,15,42,91,51,38,85,43,72,87,71 -99,88,55,15,77,68,72,87,18,91,67,82,61,44,71,38,97,43,76 -14,17,81,91,55,22,21,87,64 -92,51,68,96,81,17,88,89,83,22,23,15,14,21,25,99,24,78,56,72,36,77,55 -68,87,18,85,82,44,71,43,76,54,42,32,29,35,37 -92,22,88,14,21,55,24,17,25,36,13,23,48 -92,25,18,68,88,51,17 -32,17,37,54,89,71,43,33,42,21,25 -33,36,25,56,96,89,17,81,83,24,14,52,22,92,99,55,51,15,78,77,68 -61,63,44,71,38,43,76,54,42,32,65,13,48,33,36,56,89 -14,88,51,87,64,44,71 -14,92,88,51,15,77,68,87,71 -42,21,89,83,35,65,81,24,23,32,33,13,29,14,52,25,17 -17,83,14,22,92,55,51,15,78,77,18,91,85,67,64 -21,83,22,18,92,67,15,99,64,85,68,87,55,91,78,51,88,77,14,61,52 -64,15,77,85,92,61,88,83,78,22,18,72,68,52,82,91,87,63,14,99,55 -89,21,76,35,96,83,17,13,38,25,54 -77,68,91,85,64,82,44,38,65 -54,64,91,38,63,51,71,61,85,97,44,18,67,76,43,72,78,15,32 -51,87,52,85,72,14,83,24,68,15,21,17,92 -21,83,99,96,36,17,52,81,56,65,25,14,48,13,24,92,55,23,89 -76,42,29,48,33,36,25,56,96,89,17,81,83 -77,55,22,78,87,64,61,88,67,68,71,72,51,44,52,82,99,15,14 -37,33,85,54,44,76,38,23,13,42,36 -43,25,29,13,33,38,35,97,48,56,65,32,17,54,89,81,44,37,36,23,71 -81,92,88,78,68,91,85,67,82 -56,81,21,24,14,88,55,51,77,68,91 -97,29,65,33,17,83,24 -38,33,56,43,61,35,76,54,64,32,36 -63,44,71,38,43,76,54,42,37,13,48,23,36 -22,17,96,89,14,92,83,37,99,88,29,21,52,48,23,81,35,24,36,13,25 -77,61,18,87,72,51,38 -24,92,99,55,51,85,44 -64,82,77,35,38 -87,51,15,88,67,52,18,82,72,77,99,71,64,22,44 -99,88,51,15,78,72,87,18,85,67,64,61,63,71,76 -23,36,25,56,96,17,81,83,14,52,92,88,55,51,78,68,72 -52,92,99,15,78,77,68,72,87,91,85,64,82,61,44,71,38 -13,23,17,14,99,55,78 -25,17,35,37,44,54,71,81,56,65,32 -38,64,55,52,87,77,71,99,88,68,18 -71,38,97,76,54,42,32,29,35,65,13,33,23,36,25,56,96,89,17,81,21 -82,91,52,83,21,18,14,77,85,61,92,64,88,51,68,99,78,22,24 -29,35,13,33,25,56,96,89,17,21,83,24,14,52,22,92,88 -91,61,14,88,18,15,55,99,82,77,64,92,78,87,71,68,51,85,72 -13,36,35,32,38,76,63,82,37,43,65,42,54,48,64,29,56,97,33 -61,88,71,68,92,55,77,63,67,51,38 -18,85,88,63,77,52,38,61,64 -89,83,99,88,55,15,78,77,68,72,87,18,91,85,67 -13,17,35,89,48,33,43,54,21,23,38,83,76 -36,25,56,96,89,17,81,21,83,24,14,52,22,92,99,88,51,15,78,77,68,72,87 -24,52,22,55,51,15,78,72,87,64,82,61,44 -55,15,78,87,18,85,63,71,38,97,54 -37,44,61,32,85,76,71,68,87 -23,65,89,56,33,21,37,22,48,17,96,25,92 -24,14,52,92,99,88,55,51,15,72,87,18,91,61,63 -24,14,22,92,99,88,51,15,78,68,72,87,18,85,64,82,61,63,44 -64,44,97,43,76,54,42,35,37,13,33,36,56 -15,87,91,67,82,61,97 -63,18,32,76,67,82,15,64,91,72,85,68,54,43,42,71,61,87,97,44,38,78,29 -48,33,25,56,96,89,81,21,14,52,22,92,99,88,55,51,15,78,77 -89,17,81,83,52,88,15,78,77,72,87 -51,55,92,77,88,72,68,24,87,89,85,99,52,14,83,81,21,91,15,17,22,18,96 -76,35,33,13,14,42,81,43,23,29,89,24,21,96,17,37,32,25,65 -89,25,13,56,78,15,92,48,17,23,88,99,14,51,52 -21,83,54,33,35,25,13,22,48,37,56,14,36,89,42 -61,71,29,37,13 -96,17,24,14,22,92,88,51,77,72,85 -99,88,55,51,77,68,72,87,18,91,85,82,61,63,71,38,97,43,76 -65,35,42,32,13,17,25,83,33,23,54,14,24 -76,54,87,72,61,18,97,91,44,42,65,85,82,71,77,35,29 -91,87,92,78,21,52,18,24,68,85,77,15,81,83,22,64,72,51,99,82,14,67,88 -43,32,35,37,13,96,17 -33,36,96,21,24,14,52,22,92 -77,83,92,85,81,91,21,68,24,64,82 -61,71,48,63,44,32,42,65,37,56,96,43,35,76,29,23,38 -44,71,38,54,32,35,13,33,23,56,96 -23,17,81,21,83,24,92,99,88,55,51,15,78,77,72 -42,33,61,67,23,64,25,65,82 -81,13,48,22,29,23,35,14,21,92,89 -33,23,36,25,56,96,17,81,21,83,24,14,52,22,92,99,88,55,51,15,78,77,68 -32,29,35,65,37,48,23,36,56,96,89,17,81,21,83,24,52,22,99 -65,37,13,25,96,89,17,21,92 -48,76,13,82,71,97,23,61,56,29,36,33,44,42,25,43,38,54,37,96,35 -21,99,61,87,68,22,88 -18,38,54,32,35,48,33 -97,63,55,78,15,77,68,87,61,18,38,51,71,91,88,99,92,22,44,85,82,67,64 -56,99,36,96,13 -56,25,43,76,23,33,64,29,36 -99,51,68,87,91,82,63,44,71,43,76 -82,54,85,91,29,64,33,61,42,37,97 -56,42,17,33,97,43,63 -77,17,21,99,52,85,15,91,78,88,14,67,51,24,92,22,64 -55,51,15,78,77,68,72,87,18,91,85,67,64,82,61,63,44,38,97,43,76,54,42 -87,78,67,18,42,61,55,82,91,71,85,97,15,72,43,76,63,44,64,38,54,77,51 -37,44,64,13,29,97,25,82,61,67,36,35,43,63,23 -33,23,25,56,96,89,17,21,83,14,52,22,92,99,88,51,78,77,68 -33,36,32,35,48,23,24,21,22,17,99,83,25,37,96,29,81,92,14,65,52 -76,32,71,42,33,82,97,36,54,44,35,13,29,43,37,63,48,96,65 -65,37,13,48,33,23,36,25,56,96,89,17,81,21,83,24,52,22,92,99,88,55,51 -42,32,29,35,37,13,48,23,36,56,96,21,83,14,52,22,92 -42,43,25,65,23,37,61,44,48,29,76,33,36,38,54,97,96,89,35 -52,99,55,51,78,18,64,82,63,71,38 -36,96,89,17,81,83,14,52,88,51,15,78,77 -96,81,51,15,99,37,24,36,13,17,33 -21,83,24,14,52,99,88,55,51,15,68,72,91,85,67,64,61 -25,51,81,22,99,56,18,52,78,14,87,92,15,77,68,83,55 -81,77,92,21,51,15,99,96,56 -71,43,65,82,54,42,13,36,25,61,23,33,35,63,67,38,76,97,37,32,29 -37,76,63,61,96,56,25,35,13,36,43,29,82,32,48,33,97 -35,52,23,14,96,42,89,21,81,83,76 -48,23,36,25,56,96,89,17,81,21,83,24,14,52,22,92,99,88,55,51,15,78,77 -44,61,85,92,91,77,15,64,51 -37,13,48,33,23,25,56,81,83,52,92,51,15 -56,78,96,88,92,36,23,17,25,52,48,99,24,89,55,21,15,81,51 -64,22,67,55,97,72,15,18,68,38,88 -85,64,68,44,54,87,76,91,82,63,88 -85,38,78,82,18,87,91,32,77,43,76,72,15,42,51 -22,92,88,72,87,91,67,82,61,44,97 -55,18,54,38,87,88,85,15,76 -83,24,14,52,22,92,88,55,51,15,78,77,68,72,18,91,85,67,64,61,63 -42,32,35,65,37,13,48,33,23,36,25,56,96,89,21,83,24,14,52,22,92 -32,17,29,83,48,14,21,25,52,42,96,33,37,65,76 -35,89,81,14,32,83,29,65,52,25,92,13,22,36,33,48,37,42,24 -81,42,35,36,89,54,71,25,32,43,76,37,38,44,65,23,17,33,56 -21,18,87,52,22,56,51,15,77,92,25,55,72,99,78,96,14,83,24 -56,25,37,81,38,89,21,43,65,83,33,36,35,96,48,42,29 -55,15,77,68,87,18,91,85,61,44,38,97,43,76,42 -22,99,72,83,67,52,61,21,68,14,87,18,77,51,64 -92,55,85,14,22,17,52,89,78 -88,68,18,14,81,22,91,52,83,99,72 -36,17,29,83,96,65,54,89,43,35,56,23,25,13,81,76,14 -88,51,78,63,43,76,54 -91,67,82,61,38,97,43,76,54,42,32,29,35,13,48,33,23 -67,63,35,71,54,68,37 -85,35,33,32,61,76,65,54,37,67,91,42,97,48,71,82,38,29,13,44,43 -77,15,81,89,96,25,14,92,78,22,51,24,21,83,56,18,88,99,68 -23,36,25,22,92,15,72 -23,25,54,36,65,17,14,76,56,96,35,48,81,24,37,21,89 -85,64,61,38,32,29,65 -56,89,17,24,14,92,99,55,78,18,91 -18,85,61,63,44,71,38,48,33 -81,21,14,52,92,88,72,67,82 -55,51,15,78,77,64,63,44,38,43,76,54,42 -76,54,48,23,96,81,83,24,52 -21,83,13,14,22,96,25,37,56,81,36,92,42,89,23,32,24,33,52,35,17 -42,13,91,38,43,82,35,18,87,29,37,85,64,67,54,32,63,76,72,61,44 -23,22,29,21,24,36,14,99,89,56,88 -77,56,15,33,48,24,81,22,92 -78,87,85,67,44,71,97,29,35 -61,15,78,63,77,71,44,68,91,87,32,85,72,43,76,82,29,97,42,54,18,38,67 -99,18,81,82,87,24,78,51,83 -54,65,48,36,14,52,22 -63,44,38,97,54,42,32,65,37,56,96,89,17 -83,88,68,72,81,52,55,36,25,22,17,92,87 -44,38,97,54,42,37,13,33,23,36,81 -61,18,67,64,38,35,65,85,68,29,37,63,71,42,91,82,97 -65,54,23,35,89,43,29,38,36,76,81,21,32,17,56,71,42 -96,78,55,91,17,77,85 -64,82,61,44,38,97,43,42,32,35,65,37,48,33,23 -23,36,25,56,89,17,81,21,83,14,52,22,92,99,88,55,51,15,78,68,72 -97,43,54,42,32,29,35,37,13,48,33,23,56,96,89,17,21,83,24 -54,65,36,23,71 -13,44,33,63,48,97,25,38,64,82,61,56,76,42,54,65,71,43,23,35,36,37,32 -65,13,48,23,36,56,89,21,52,22,88,55,51 -68,51,14,83,64,18,77,17,91 -76,37,38,25,13,33,71,21,42 -21,92,81,87,24,56,51 -48,83,35,37,81,97,89,54,33,29,36,13,96,23,38,21,65,17,76,56,32,43,25 -13,48,17,83,14,15,78 -18,22,92,82,68,87,24,52,44,99,67 -77,99,87,92,22,51,52,68,71,14,82 -22,67,83,63,14,15,82 -64,44,97,61,67,32,37,65,38,29,35,48,71,36,54,76,85 -24,14,92,99,15,78,87 -63,71,76,54,32,29,35,65,37,13,48,33,23,36,25,56,96,89,17 -42,96,71,35,25,65,23,33,44,81,32,97,29,76,13,54,43,56,17 -87,91,67,82,44,71,38,97,43,76,29,35,65,37,48 -33,38,13,48,65,43,61,82,37,76,54,32,35,44,67,29,85 -24,52,22,92,55,51,78,68,72,18,91,85,64,82,44 -63,48,85,67,38 -42,32,35,65,13,48,33,36,25,89,17,81,14 -63,44,71,43,35,65,37,13,23,36,17 -25,21,97,33,54,32,76,42,37,17,35,65,89,81,83,96,36,23,48,43,13,38,29 -42,32,29,35,65,37,33,25,56,89,17,21,24,14,52,22,92 -37,48,81,21,83,14,22,88,55,51,15 -55,51,77,68,87,18,91,85,67,82,63,44,38,97,54 -35,65,13,33,36 -61,48,44,64,43,36,82,42,56,29,23,54,33 -92,99,88,55,15,78,77,68,72,18,91,67,64,82,61,63,44,71,38,97,43 -32,29,33,23,96,83,22,92,99 -63,55,61,92,87,64,88,85,72 -67,92,77,64,52,51,81,91,17,85,21,22,14,78,15,88,18,72,83,55,68 -36,78,92,22,51,87,99 -37,13,36,56,81,92,88,55,15 -29,35,37,13,48,33,23,25,56,96,89,17,81,21,83,24,52,22,92,99,88 \ No newline at end of file diff --git a/2024/day5/input_test b/2024/day5/input_test deleted file mode 100644 index 2508bd7..0000000 --- a/2024/day5/input_test +++ /dev/null @@ -1,28 +0,0 @@ -47|53 -97|13 -97|61 -97|47 -75|29 -61|13 -75|53 -29|13 -97|29 -53|29 -61|53 -97|53 -61|29 -47|13 -75|47 -97|75 -47|61 -75|61 -47|29 -75|13 -53|13 - -75,47,61,53,29 -97,61,53,29,13 -75,29,13 -75,97,47,61,53 -61,13,29 -97,13,75,29,47 \ No newline at end of file diff --git a/2024/day5/solve.py b/2024/day5/solve.py deleted file mode 100644 index b2b578a..0000000 --- a/2024/day5/solve.py +++ /dev/null @@ -1,27 +0,0 @@ -def middle_page_if_update_correct(update: list[str], rules: list[tuple[str, str]]) -> int: - for idx, page in enumerate(update): - for previous_page in (update[previous_idx] for previous_idx in range(idx)): - if (page, previous_page) in rules: - return 0 - - return int(update[len(update) // 2]) - - -rules = [] -updates = [] - -reading_updates = False -with open("input") as f: - for line in f.readlines(): - if reading_updates: - updates.append(line.strip().split(",")) - elif line == "\n": - reading_updates = True - else: - rules.append(tuple(line.strip().split("|"))) - -result = 0 -for update in updates: - result += middle_page_if_update_correct(update, rules) - -print(result) diff --git a/2024/day5/solve2.py b/2024/day5/solve2.py deleted file mode 100644 index 4675e85..0000000 --- a/2024/day5/solve2.py +++ /dev/null @@ -1,36 +0,0 @@ -from functools import cmp_to_key - -def is_update_correct(update: list[str], rules: list[tuple[str, str]]) -> bool: - for idx, page in enumerate(update): - for previous_page in (update[previous_idx] for previous_idx in range(idx)): - if (page, previous_page) in rules: - return False - - return True - - -rules = [] -updates = [] - -reading_updates = False -with open("input") as f: - for line in f.readlines(): - if reading_updates: - updates.append(line.strip().split(",")) - elif line == "\n": - reading_updates = True - else: - rules.append(tuple(line.strip().split("|"))) - -for idx in range(len(updates) - 1, -1, -1): - if is_update_correct(updates[idx], rules): - updates.pop(idx) - -for update in updates: - update.sort(key=cmp_to_key(lambda item1, item2: -1 if (item1, item2) in rules else 1 if (item2, item1) in rules else 0)) - -result = 0 -for update in updates: - result += int(update[len(update) // 2]) - -print(result) diff --git a/2024/day6/input b/2024/day6/input deleted file mode 100644 index f297efc..0000000 --- a/2024/day6/input +++ /dev/null @@ -1,130 +0,0 @@ -........#.............................#......#................#..................#..................#.........#.#.#............... -...........................................#..#......................#............................#...........................#.#. -.............#..........#........#.#...........#........................#............................##........................... -............#.............#.....................................#........................#.....#.................................. -.........#...........#................#................................#......#.....................#.............#..............# -...........................##...........................................................................................#......... -...........#.......#.................................................................#..............#....................#........ -.......................#.............................................#.........................................#.#..............#. -.#...................#..................#...........#...#.........#...##.......................................................... -.................#..........#.....#.........#.....................................................................#..........##... -....#.#............#..........#.......................#.........................#.................#.........#.............#....#.. -...#....................................#.............#..............................#............#.....................#........# -....................#..............................#...#.#...#.#..........#.................................#..................#.. -........................................................................................#.....#.........#............#.........#.. -...................#.................#.......................................................................................#...# -..............#.......#..................#........#....#........#.....................#..........................#................ -...........#..#....................................#.............#.#..#.......................................#.........#.#...#... -...#.............#............................#..............#....................#.#............................................. -..#...........#.#.........#...............................................#...#...............#.#...........#........##....#...... -.............................................#..#.........#......#................................................................ -.................................#.................#..............#.....#...................................................#..... -............................#.......#............#...............................................................#................ -.....#....................#...........................................#..........................#..........#..#...#......#...#... -........................#......#...#.......................#....##.......#..........#...............#............................. -#..#....................................................................................................#......................... -...........................................#......#..........................#..............................#.............#.....#. -..............#......................#..#...................................#.#..................#.......#............#........... -.................#...................................#..........#......#....#.#.#...#....................#..........#......#...... -........#....................................#........#.........................................#......#.#...............#......#. -..................................#......#........#........#.#......#.........................#.#.......#......................#.. -......#..#.........#............#...........................................................#.............#.........#............. -.........................#......................#.....#........#..........#....................................................... -#.......#..................#............................................................#......................................... -.........#.....#.............#...............#......#.....................#....................................................... -.........#..#.........................................................#.........##..................##........#................... -.#.....#..............#..............#.........................................#.....................................#............ -..............................#......................................................................................#............ -..............#..........................#................................#.#.....#...........#.........#......................... -....................#...#.#...........................................................................#...........#............... -...........#.............................#....................#........#...............................##....#.................... -.....................#......................#.#.....#...........................#.......#........#................................ -#..........#...............#.......#..................................#.....................................................##.... -.........................................................#...#....#...............................................#.........##.... -.....................#......................#..............#..................................................#................... -......#.............#........#..................................................#...#.............................#......#........ -....................#............#........#...............#......#.......#........................................................ -..........................................................................#........................#......#.............#.......#. -.....................................................#..#........#....................#.....................#..................... -..#.................#........................................#................................................##...............#.. -.............#......#.........#................................................................................#.................. -#......#.......................................................................................................#......#........... -.......##.......................#...................#.........##..........#.............................#........................# -...........................................................#................................#...............#............##....... -..........................#...................#...........................................................#.............#........# -...#......................#..##................................................................................................#.. -............#..#.........#...#.........................................................#........#..............#.................. -.................#.................#........#............................................................................#........ -............#..#..#..#....#...........................#.................................................#..#...................#.. -....................................................#..#.................................#.#..............................#....... -.........#.#................................................#..#............................................................#..... -...##............................................#.....#.#...........................#....#.................#.#..........#........ -...............#.#.#.........................................#......#.....#..............................................#....#... -.............#........................................#....#.......................................#...#....#..................... -...........#.................................#...............................................#...........#..#..#......#........... -#.......................................###....#....#.........................................#......#.............#.............. -...............#.#.....................................................................................#....................#..... -##.........#..............#................................#..#..#..........#....................#..#..........#.....#............ -...................#..........................................#........................#.......................................#.. -#........#.#.....#............................................................##......#....#...........................#.......... -...............##....#.............#......................................#......................#...................#.#.......... -....................................##....#.............................................#..........#...................#....#..... -.....#...............#........#..............#.............#..#..#...#.................................................#.#...##... -........##.....................................................#.................................................................. -.........#.............................................................#.......................................................... -.............#.............#............................................................................#....#..........#.......#. -.#........#...........................................#....#.........#......#............#.#................................#....# -...............................................#.......#.............#.............#....................#.....................#... -......................................#....................................................#...................................#.. -....#........#.....................................................#.......................................##..................... -..........................................#............................................#.......#.....................#...#........ -................#.#.............#.....#....................#............#.............................................#........... -..............................#..............#.................#...................#...#.......#.................................. -.#...............................................................#..................#......#............#................#........ -...................................#.................................##........................................................... -...............................................................#....#..##...................#..#..............................#... -..............................#...........#.................................................#.#....#...............#.....#........ -............................#........#.........#.........................................#....#................................... -........................#................................................#....#..............#.........................#.......... -.........#....#....................#.......................#.#.......................................................#............ -.........................#......................................................#................................................. -.............#...#...........#...................#.#..............^........................................#....#................. -.................##............................................................................................................... -..................#......#..............................#...............#.##.........................#............................ -....................................................###........................................................................... -........#....................................................#........#........................................##...#.......#..... -.........................##.....#.........................................................................#.........#............. -.................#...........................................................................#........#..............#..#......... -.........#.#..................................#..#...................................#.................................#.......... -.....#............#...#............#..............................#..........#.........#....#...........#......................... -#...#...........................................................................................#.....#....#.........#.....#...... -......................................................#.#...............#......#.................#...............#.............#.. -.......................................................................................#.........#...#...........#..............#. -.........................#................#.................#...............................#........#.##....................#.... -.....#...#................................#......................#...........#........................................#..#........ -.................#................................#.#.....................#............................................#....#..... -...................#............................................................................#........#.....................##. -.....#.................................................................#..................#........#.......#...#.................. -...............................#..#...................................#..........#...........#......................#............. -....#................#..................#..........................................................................#........#..... -......#.........................#............................................#....................#....#.......................... -.#.......#....#.#...#....#................#........................#...................#...................#......#............... -..#...................#......#.#........#.........................#.........................#............#........................ -..#....#...#.......................................................................#......................#....................#.. -.......#...#............................................................#.................#......................................# -..##..........#..................#...............#.....#..#...........#....#...............................................#...... -...##....#............##..................................................................................................#....... -...........#.........................#....#......#...#.............................................#....................#........# -............................................................................#...............#..#..............#................... -.....#............................#.....................................................................................#......#.# -.........#.............................#.....#.........................................................#.#.....#.................. -.......................#..#.#.......#..#................................#.....#..............#.........................#.......... -.................#.....................#............................................................................#........#.... -........#...............................................................#....#........#.........#.......#......#......#........... -..............#............#......#..............#.#...........#.............................##...##.#..............#.....#....... -##....................................................................#.......................#.................#................. -............#...................................................................................................................#. -...#....#....................#..............................................................................#........#............ -....#......................#......................................................#............................................... -.#...#...........#....#........#...#.................#..............................#................#.##......................... -...#.................#..............................#................................#...........#................................ \ No newline at end of file diff --git a/2024/day6/input_test b/2024/day6/input_test deleted file mode 100644 index f76349a..0000000 --- a/2024/day6/input_test +++ /dev/null @@ -1,10 +0,0 @@ -....#..... -.........# -.......... -..#....... -.......#.. -.......... -.#..^..... -........#. -#......... -......#... \ No newline at end of file diff --git a/2024/day6/solve.py b/2024/day6/solve.py deleted file mode 100644 index 7e8a972..0000000 --- a/2024/day6/solve.py +++ /dev/null @@ -1,55 +0,0 @@ -import sys - -lines = [] -with open("input") as f: - for line in f.readlines(): - lines.append(list(line.strip())) - -found_guard = False -guard_row_idx = None -guard_col_idx = None -direction = None - -directions = [(-1, 0), (0, 1), (1, 0), (0, -1)] - -for line_idx, line in enumerate(lines): - for icon_idx, guard_icon in enumerate(("^", ">", "v", "<")): - if guard_icon in line: - guard_row_idx = line_idx - guard_col_idx = line.index(guard_icon) - direction = directions[icon_idx] - found_guard = True - break - - if found_guard: - break - -if not found_guard: - sys.exit("Could not found guard.") - -row_count = len(lines) -col_count = len(lines[0]) -while True: - lines[guard_row_idx][guard_col_idx] = "X" - new_row_idx = guard_row_idx + direction[0] - new_col_idx = guard_col_idx + direction[1] - - if new_row_idx < 0 or new_row_idx >= row_count or new_col_idx < 0 or new_col_idx >= col_count: - break - - if lines[new_row_idx][new_col_idx] == "#": - dir_idx = directions.index(direction) - if dir_idx == len(directions) - 1: - dir_idx = 0 - else: - dir_idx += 1 - direction = directions[dir_idx] - else: - guard_row_idx = new_row_idx - guard_col_idx = new_col_idx - -count = 0 -for line in lines: - count += line.count("X") - -print(count) diff --git a/2024/day6/solve2.py b/2024/day6/solve2.py deleted file mode 100644 index faaf88a..0000000 --- a/2024/day6/solve2.py +++ /dev/null @@ -1,78 +0,0 @@ -import sys - -def traverse(room: list[list[str]], guard_current_row: int, guard_current_col: int, direct: tuple[int, int], check_for_loop: bool) -> bool: - row_count = len(room) - col_count = len(room[0]) - previous_directions: list[list[list[tuple[int, int]]]] = [] - for _ in range(row_count): - previous_directions.append([]) - for _ in range(col_count): - previous_directions[-1].append([]) - - while True: - if not check_for_loop: - room[guard_current_row][guard_current_col] = "X" - else: - if direct in previous_directions[guard_current_row][guard_current_col]: - return True - - previous_directions[guard_current_row][guard_current_col].append(direct) - - new_row_idx = guard_current_row + direct[0] - new_col_idx = guard_current_col + direct[1] - - if new_row_idx < 0 or new_row_idx >= row_count or new_col_idx < 0 or new_col_idx >= col_count: - break - - if room[new_row_idx][new_col_idx] == "#": - dir_idx = directions.index(direct) - if dir_idx == len(directions) - 1: - dir_idx = 0 - else: - dir_idx += 1 - direct = directions[dir_idx] - else: - guard_current_row = new_row_idx - guard_current_col = new_col_idx - - return False - -lines = [] -with open("input") as f: - for line in f.readlines(): - lines.append(list(line.strip())) - -found_guard = False -guard_row_idx = None -guard_col_idx = None -direction = None - -directions = [(-1, 0), (0, 1), (1, 0), (0, -1)] - -for line_idx, line in enumerate(lines): - for icon_idx, guard_icon in enumerate(("^", ">", "v", "<")): - if guard_icon in line: - guard_row_idx = line_idx - guard_col_idx = line.index(guard_icon) - direction = directions[icon_idx] - found_guard = True - break - - if found_guard: - break - -if not found_guard: - sys.exit("Could not found guard.") - -traverse(lines, guard_row_idx, guard_col_idx, direction, False) - -count = 0 -for row_idx, line in enumerate(lines): - for col_idx, char in enumerate(line): - if char == "X": - lines[row_idx][col_idx] = "#" - if traverse(lines, guard_row_idx, guard_col_idx, direction, True): - count += 1 - lines[row_idx][col_idx] = "X" - -print(count) diff --git a/2024/day7/input b/2024/day7/input deleted file mode 100644 index f617be2..0000000 --- a/2024/day7/input +++ /dev/null @@ -1,850 +0,0 @@ -9151: 132 1 8 714 972 5 21 1 -740: 136 4 40 1 85 71 -1959240: 61 84 4 6 563 -9619353: 62 7 1 9 92 19 44 17 3 4 -85383: 141 8 4 6 9 5 49 -468373294: 7 25 841 46 101 329 4 -634495747544: 83 6 5 5 5 8 95 8 3 7 542 -1473921: 18 1 54 270 8 1 -191617: 9 2 3 78 617 -105545: 1 49 5 1 209 -3074260824: 89 4 90 5 9 4 3 62 452 9 -7871304: 9 3 6 7 96 456 3 1 9 6 8 -113179142: 7 7 96 6 70 6 6 4 49 3 2 7 -65190: 79 7 3 7 246 -111675278: 3 856 13 5 11 9 1 69 7 1 -18232286011544: 911 6 143 5 4 11 544 -2525217842: 2 9 9 8 5 1 4 8 6 4 310 3 -2754: 4 5 8 51 7 4 6 -9742: 77 15 27 6 8 6 81 7 80 -996566149: 674 4 12 668 45 22 1 7 -161036550888: 71 12 27 7 8 550 880 7 -6631527185: 7 5 98 5 9 764 1 7 185 -626: 72 3 379 8 23 -339047997: 914 3 409 904 88 -91402: 115 786 951 60 1 -2463205322: 9 2 8 60 5 821 1 6 8 5 2 -11096244: 24 9 2 43 508 -2761679223799: 8 8 8 5 1 8 490 1 22 799 -9228832: 43 19 8 4 353 -27049036274445: 8 9 5 4 9 791 5 34 3 8 4 2 -1366911546: 793 7 22 123 91 -123461: 53 1 9 5 38 5 338 88 -3822: 63 7 6 -18091789: 1 697 8 7 951 83 785 4 -7714: 469 92 1 13 408 -30391973: 8 593 8 6 1 2 3 8 5 7 6 71 -353583: 6 41 6 29 7 83 -198733471: 66 244 3 595 876 -358201: 6 49 29 7 6 5 47 57 -986380800: 148 51 7 24 64 85 -101112: 931 72 22 29 37 724 -743680946: 7 9 7 5 38 34 23 9 3 49 7 -115585260: 6 6 92 6 5 25 894 -15917620: 1 4 414 140 272 180 -28029104911: 84 15 3 278 4 114 8 -1123377777: 2 50 299 7 5 176 4 4 4 -108274258: 39 209 8 80 65 4 527 2 -6517: 7 7 40 1 3 9 2 5 7 3 144 1 -34114050: 4 8 38 57 9 8 43 123 5 1 -116285217: 10 9 322 2 88 1 4 9 4 15 -57634: 1 496 99 1 6 15 4 4 4 4 2 -26014: 986 9 26 55 89 -9106125640: 956 3 6 1 8 496 522 5 8 -721: 6 60 361 -4047586935: 59 61 1 679 32 -44558521: 856 72 52 859 49 1 -560032830: 10 1 2 1 915 8 7 20 85 6 -1855165370808: 8 7 5 4 1 76 1 4 370 80 8 -1146142: 7 578 3 7 48 94 -329511: 469 7 2 10 11 -420024: 2 73 6 4 516 -126044109: 61 9 6 729 91 25 9 -48703404994: 408 9 3 8 54 6 397 79 4 -5979: 8 7 9 731 88 8 7 3 9 7 3 -10432490441: 939 853 2 4 5 3 37 41 -119418127: 2 64 3 3 1 1 7 5 60 1 2 7 -87128064: 4 39 44 4 8 696 -2130168: 1 5 8 6 9 757 8 7 329 1 9 -97426804: 75 36 97 372 4 -806038: 1 26 6 24 69 3 536 686 -1313845: 26 19 8 6 9 5 -22504: 7 9 6 962 940 400 -3587483330: 92 39 874 4 286 -874581: 8 7 458 3 -8216470392: 3 7 74 81 2 8 3 314 5 9 4 -139797569: 4 1 9 8 1 7 268 71 5 61 8 -50791720425: 7 4 25 2 1 48 76 80 8 4 9 -946998094001: 721 7 46 130 93 994 7 -173645680: 310 56 4 5 680 -34416111: 956 45 8 64 49 -3093564117903: 66 72 42 781 80 155 4 -60037497240: 670 4 1 8 5 9 5 63 30 7 4 -310072: 738 2 35 18 4 -47077801344: 9 966 18 476 632 -126008: 453 669 9 669 70 8 -264843: 20 1 3 6 1 4 51 4 45 -81426920: 9 9 426 1 9 20 -466206: 19 5 178 38 2 2 9 9 1 3 6 -752675046: 858 6 35 3 2 6 5 78 62 6 -4462816920: 59 823 27 746 978 -84744: 6 2 844 9 11 -11830537: 1 3 3 6 44 8 7 19 7 1 39 -63332543: 623 9 60 1 71 527 5 9 -194775: 7 330 4 19 1 12 1 6 5 15 -394568496: 494 85 42 651 976 -24439099581: 41 73 887 9 907 -174366325623: 6 900 722 95 35 624 -444: 66 7 41 1 80 247 -837: 67 1 3 330 69 367 -196056917: 88 2 8 1 147 7 9 2 908 8 -409060: 6 615 82 86 30 94 8 4 -47090: 9 164 1 3 2 33 4 7 2 80 4 -7175: 64 2 823 8 66 7 -20344478588: 3 405 972 2 53 513 2 -659821815620: 613 343 263 5 69 620 -802485555: 2 444 5 7 6 88 16 5 535 -102625677: 1 8 65 2 608 7 3 4 5 -51268162: 879 90 529 80 62 -1662663653: 40 9 6 653 6 6 9 4 46 1 5 -1749: 3 6 89 1 769 -2104465: 6 9 7 49 7 1 9 7 1 1 2 243 -39785040: 3 975 678 4 3 5 -325326: 463 7 9 49 64 3 -505443247: 3 6 3 4 31 2 3 9 322 2 8 1 -6685230840: 84 5 8 1 8 35 79 13 841 -555959866: 3 47 111 2 7 5 98 68 1 -1232050199: 943 6 6 4 7 864 6 1 2 20 -24433540629540: 82 5 83 718 629 541 1 -139844572: 834 9 31 601 286 -352024115: 81 457 8 1 6 294 7 95 -466754400: 72 51 3 9 224 63 -1956636464: 397 89 61 66 463 4 -179284672885: 40 8 82 86 796 56 8 85 -12195470: 7 7 3 710 95 1 38 4 3 -1450501930: 9 5 2 1 7 95 19 1 4 28 5 5 -214898: 8 406 2 96 9 4 4 7 16 2 -27864: 6 966 4 -34977: 4 7 6 6 30 -1128443492504: 8 37 9 749 46 25 2 2 -7965: 13 4 17 9 9 -7258: 1 8 50 7 7 5 8 -9527870: 3 451 8 118 7 46 -9428848: 7 543 125 5 91 -4401902: 5 5 3 1 53 4 3 5 9 2 146 2 -14286283265: 26 996 54 98 65 -2644109705: 279 32 16 2 413 808 -2068932: 61 7 5 969 7 92 9 7 2 -20472203604: 1 9 3 6 2 2 7 3 37 760 1 4 -58617495: 2 171 3 9 177 104 214 -398838423580: 301 18 8 8 92 235 80 -18786839: 26 8 7 1 7 64 919 9 -6278462: 3 956 655 389 1 -9088797: 36 17 3 5 1 5 99 3 -2974506427701: 493 1 2 8 8 737 754 1 -19231: 5 9 420 4 5 271 24 27 -2350420985703: 3 7 1 23 5 6 7 7 53 9 877 -2736: 334 1 8 63 1 -2231907992: 9 149 18 81 509 248 -1118593: 86 1 13 483 106 4 -420262: 68 123 545 571 6 -1386900: 2 67 5 21 516 1 2 2 1 5 5 -26430: 5 522 50 12 68 -1832437: 277 35 189 80 -27477720: 8 66 48 6 48 15 1 508 -789621523: 4 983 8 1 2 1 515 8 -49684854: 77 5 6 9 8 252 90 5 84 -2088517152: 4 3 90 63 7 2 876 53 -4067837: 763 8 42 567 5 -844082: 43 7 7 5 76 29 2 2 9 512 -54108: 67 9 8 56 1 81 -54075944: 870 92 47 4 299 -7776679: 89 5 7 48 71 66 7 1 8 -819893: 3 98 9 3 4 9 2 800 8 693 -1052: 5 1 7 25 -794511615: 18 49 79 9 613 -5775164984242: 765 937 754 42 4 2 -166105353: 2 8 1 1 557 8 994 -449204: 8 9 959 556 2 1 28 -1307419: 1 2 2 4 4 8 4 9 8 178 5 7 -136481: 1 2 21 2 780 3 5 5 7 6 89 -2845449257: 284 5 449 257 -147060: 4 3 2 9 190 -1154: 6 3 8 8 2 -8713340202: 2 3 8 1 567 66 49 749 2 -285498: 154 269 672 495 747 -93244906260: 257 48 31 5 59 60 33 -199254: 9 362 8 51 3 22 -52132: 5 6 8 3 9 6 3 85 990 5 7 -81110: 4 912 157 16 6 -217141: 75 4 7 71 41 -243480250794: 6 67 8 6 7 4 6 744 1 7 7 4 -1461781: 90 66 6 42 9 1 1 -17748024: 7 7 80 926 5 4 10 87 24 -3203786001678: 46 7 4 1 45 85 8 1 678 -202847059: 7 1 943 2 470 59 -19485111: 39 9 575 2 496 5 146 -112166340: 701 2 8 60 2 74 69 -2188134198: 51 3 7 4 1 341 1 6 82 -10944961: 9 5 7 161 89 9 10 6 3 3 6 -42331808802: 2 1 4 5 7 65 37 2 746 6 2 -5325792196: 8 9 374 2 40 1 2 7 2 7 9 -12021872: 51 614 23 393 1 1 2 -4767141: 611 17 2 39 15 -3718357725: 7 1 1 5 1 5 5 5 44 2 5 417 -7646335: 41 4 41 889 84 851 -40469: 8 5 1 3 67 -615330: 643 26 918 300 888 -50260150: 359 700 5 2 8 8 6 5 -125520: 5 5 963 73 120 -647346227: 6 437 8 76 87 295 34 -29711242851815: 70 474 259 897 47 4 1 -5548803: 5 2 32 7 66 332 87 -450: 19 3 23 5 9 -132343: 8 54 40 4 2 3 52 4 3 4 27 -1179858960: 6 70 333 5 7 74 18 -497886150: 199 444 805 7 4 86 -141950: 4 7 8 1 7 8 46 543 4 6 9 4 -149735820035: 153 5 752 975 35 -100199700585: 91 94 765 708 1 583 -1044062784: 2 3 1 755 4 8 661 4 1 16 -5204633552: 5 5 52 4 63 22 7 5 1 5 5 -3620: 1 4 28 6 94 3 45 -295284: 3 41 40 60 84 -48248907: 902 19 8 938 3 5 4 9 3 -615145: 2 1 209 29 84 -2709056: 443 8 5 6 56 -54847043762: 2 7 704 3 746 4 5 5 5 1 8 -1120898: 56 6 6 556 -106037568094: 89 6 770 442 40 36 9 4 -19146429617: 32 28 7 2 7 1 6 959 7 53 -15963224760: 2 248 993 7 4 5 6 212 -776736688: 211 9 63 5 31 87 688 -364586: 18 346 49 9 6 -14059350: 8 2 363 6 8 6 785 -8619: 4 2 619 -16720759: 636 291 710 9 4 9 6 -798569985: 637 928 823 5 51 -210270837: 964 1 7 862 3 541 3 7 2 -2778624710: 231 10 2 4 9 4 8 7 1 2 1 -2153: 387 13 26 1 3 5 -3148076678: 314 807 667 6 1 -16220433195: 9 9 6 3 45 275 1 899 46 -29050653: 7 7 4 29 9 64 7 3 3 -4504999: 8 9 3 9 7 91 2 2 6 8 501 7 -24476553: 2 610 799 84 7 25 553 -960837415277: 24 68 388 213 26 4 77 -362770: 58 781 28 8 5 15 142 -98892626: 120 44 67 9 626 -56: 2 1 53 -264046: 4 970 7 5 53 -362427305: 6 2 9 423 84 4 6 15 7 -319715433: 8 928 7 9 259 8 7 69 69 -227299: 415 3 3 7 1 2 1 6 9 3 4 80 -2284578: 8 660 4 242 784 2 -2808058480: 90 390 731 8 2 -516: 22 1 22 5 464 2 -992: 4 39 50 31 7 7 3 8 99 5 2 -289123: 141 2 17 694 8 3 -564264010: 9 159 96 17 44 14 -485047: 67 740 4 598 69 -3790642776: 984 6 2 21 207 642 -95881: 604 2 1 3 9 52 877 -593105029510: 920 969 644 993 511 -24022618098: 1 5 3 9 3 9 8 5 972 4 7 94 -58556544: 30 4 1 5 794 218 6 32 -253136185: 506 270 5 11 26 57 -5474366: 741 6 246 414 4 3 8 96 -16587427068: 729 79 72 304 767 4 3 -50874781: 6 96 883 139 7 9 -5895: 75 7 130 9 -242279046: 13 9 6 520 4 52 8 80 6 -2242: 4 559 8 -11592154: 1 89 1 268 1 1 664 490 -16020118: 6 709 400 62 1 56 646 -1299962: 20 47 80 98 27 7 16 4 -295680: 1 3 5 40 52 800 5 8 -10464417: 9 2 6 27 3 3 34 83 -34462664411: 78 5 3 1 5 666 4 38 3 2 -8555: 96 88 59 44 4 -1169280986289: 9 4 35 928 9 86 289 -276164011: 119 444 60 49 14 1 -318180816: 53 6 175 5 814 -2591: 2 5 75 2 58 8 3 -32533493: 6 6 5 7 3 55 9 30 53 3 23 -229398: 266 4 1 45 1 5 9 16 663 -1728893159421: 8 1 28 9 8 566 69 11 1 8 -76054443206: 7 7 1 3 54 28 4 7 8 6 58 7 -35589: 20 57 66 1 7 1 1 14 -1253928: 74 5 65 64 52 -13626929426: 2 90 700 2 147 26 -17809524054: 51 5 1 97 4 5 72 54 -224832107: 93 68 3 8 107 -71645285: 98 143 73 89 5 -1030424: 4 6 5 87 596 4 5 92 7 5 -14471016: 516 57 82 52 6 -172454: 4 9 9 2 266 78 8 -855653: 5 2 82 8 65 287 366 -1226600: 7 37 1 473 5 58 8 7 979 -447240: 3 64 833 8 323 426 -15238243461: 21 7 39 2 69 9 730 2 -1071922335: 7 7 4 3 2 96 116 5 2 5 -229848187: 3 241 942 149 38 -45344183: 3 3 77 42 308 3 651 81 -4901: 888 7 5 2 424 -46609776: 568 1 34 82 589 6 -47824041: 469 33 515 6 108 3 -4985084: 1 912 5 34 2 13 -93130324833: 4 3 8 9 2 71 28 9 2 4 67 3 -149374: 30 1 118 37 4 -1027499: 6 55 3 7 100 248 3 34 1 -1019443816: 5 5 94 393 92 7 892 -148406254: 4 2 397 86 89 -1046424933: 5 48 276 19 5 40 9 837 -789121218468: 394 17 64 3 12 184 68 -24606: 394 61 1 26 531 8 6 -32826875: 5 3 24 35 2 7 449 8 75 -78610925642: 4 61 99 8 7 14 9 256 40 -563129: 19 9 9 1 939 5 501 1 3 2 -1185206173: 469 9 41 824 5 3 2 5 4 9 -88615648: 9 7 3 2 94 806 3 6 9 7 21 -3541: 44 3 74 8 55 -104271660: 3 487 26 633 6 8 15 3 -20881: 32 651 3 2 44 -1876729: 4 168 9 780 748 -28509624384: 996 8 4 286 3 84 -1026553844795: 74 92 52 5 527 4 72 7 5 -29043744111: 6 437 2 2 6 47 8 5 2 9 1 -1722468804: 9 2 4 636 9 6 142 1 866 -270229300: 6 6 890 10 4 3 48 5 92 -3004099: 894 6 28 6 8 2 78 45 -3616992: 3 60 600 8 1 5 51 1 4 9 2 -214643388: 39 55 73 70 388 -914715656: 7 1 20 11 3 352 9 4 8 8 -21106475520: 119 1 213 6 1 130 2 32 -53262303: 68 2 8 5 780 5 -507716: 498 7 81 85 60 45 6 -19438755840: 4 3 6 9 96 28 16 5 558 -684865: 66 7 18 52 71 9 78 5 -50379008: 2 9 8 843 83 261 2 5 6 7 -1751841: 125 36 403 9 3 -411768738: 9 65 20 73 78 92 231 6 -25: 5 8 12 -69387321: 69 3 8 731 8 -74878624: 1 20 379 7 8 1 2 6 7 4 4 -17592: 8 9 5 8 9 -55543298: 7 822 1 9 710 -52244409: 884 985 6 4 5 -27014: 270 1 4 -290549879: 538 3 5 83 360 -57134: 9 693 9 1 79 965 -1602647: 6 9 68 23 7 -2542: 24 47 1 7 88 -1341748: 134 167 7 1 8 -49167143: 3 79 37 108 38 12 336 -1229666510: 17 376 391 45 3 1 4 2 4 -918: 9 1 7 54 -1066482049: 2 2 7 7 6 3 7 53 6 9 535 9 -401582160: 340 7 86 6 327 -11328164873: 3 77 9 1 54 5 7 9 34 2 4 1 -4608: 6 5 719 6 6 78 -523320: 27 6 9 81 602 534 -5810: 8 70 8 84 9 109 -678988872: 9 3 99 4 126 8 56 4 4 9 -3745560: 28 7 546 35 2 -10516660: 3 3 53 9 34 26 3 8 7 70 2 -255469822776: 7 87 7 3 48 79 95 4 3 9 8 -69634: 2 298 5 3 26 74 -16699318278: 9 277 3 99 30 1 6 5 6 5 4 -18603: 69 8 5 3 8 -67053055690: 1 2 515 434 4 1 569 3 -141888: 733 6 1 3 64 -873288345622: 15 161 19 6 6 96 6 2 3 -112480808: 8 15 6 61 8 64 628 1 4 4 -8506730: 69 70 93 658 766 -10772735: 8 3 624 8 26 -29935635: 36 8 22 85 1 5 811 -870: 46 85 22 1 715 -96866: 8 1 260 7 5 2 5 2 1 9 8 7 -21406467537232: 37 24 2 35 5 8 376 482 -24602893: 72 8 2 2 8 8 2 96 3 873 7 -140909724814: 297 27 7 9 158 5 1 1 3 4 -3454011: 575 49 2 3 354 3 -286400393: 706 86 89 57 53 -18063592456: 9 808 6 56 511 767 -27428489: 421 83 2 544 9 -1796674401: 9 11 4 7 6 72 2 326 5 4 9 -337021994: 6 311 29 9 692 2 -7026159: 78 8 53 8 59 6 159 -443282: 382 16 45 1 68 34 7 73 -1046899268800: 466 6 9 779 4 1 7 880 4 -3651: 346 8 7 30 74 -572386770216: 6 8 69 7 7 50 55 6 486 -21346403103: 981 207 3 40 876 57 6 -2463381202: 7 4 6 3 3 8 52 77 55 3 94 -30407481: 9 5 621 318 4 -13515323217: 681 1 592 6 49 33 -1087609539: 332 9 2 90 431 416 -410953440: 9 91 93 5 987 955 485 -171585054: 124 6 72 1 256 174 9 -28973728: 25 3 1 96 5 1 8 6 83 4 7 8 -345430: 60 2 55 269 778 -2723562: 7 1 7 9 5 5 5 2 37 5 8 2 -24545063129: 6 6 3 3 4 2 9 43 20 1 930 -189356832874: 4 836 2 2 3 6 2 786 874 -1664708: 3 1 79 2 2 523 -3234: 566 1 4 9 66 8 879 6 -51568806: 978 8 44 9 4 97 91 8 2 -21978100: 17 65 67 525 4 -516143: 6 309 278 731 -1604981961: 862 1 4 8 5 7 7 6 69 8 4 9 -230: 9 21 2 7 1 31 -29711: 3 981 22 6 55 -7387441984: 52 2 76 2 557 839 -2497700061: 2 7 26 37 81 29 9 -283450487882: 9 446 7 3 5 8 4 9 596 5 6 -4611600047: 823 5 160 35 47 -18762785: 3 101 90 688 60 965 -6039720: 6 4 9 699 1 2 7 1 5 5 25 4 -18778179043: 7 9 81 3 6 8 7 528 3 1 13 -107610050: 8 50 7 4 952 8 13 6 7 3 2 -322506: 930 55 36 95 270 9 9 -112567: 1 3 874 8 8 72 1 2 12 27 -2187945065478: 6 853 342 5 2 6 5 9 6 5 -378542670168571: 94 635 6 67 542 4 571 -95370: 36 20 2 5 66 -60925172439: 572 3 202 5 2 710 19 -1864083431: 11 65 2 8 83 429 -130006538: 3 49 5 50 6 4 1 1 93 45 -45205660: 3 44 5 7 2 98 20 9 6 1 4 -4473939: 5 8 902 6 79 885 9 -9229836: 3 4 6 5 5 811 9 194 80 6 -126846796: 4 1 4 3 783 79 6 -354965538790: 3 48 6 965 5 3 878 1 2 -1523: 8 561 881 2 71 -2911951343: 41 157 34 5 9 1 343 -3411360640: 3 5 1 885 2 103 6 3 641 -8384: 90 5 11 3 8 -58070691758: 9 796 988 626 6 -4606: 38 79 56 669 2 -1855761377: 1 2 4 177 57 6 12 95 82 -8785483574: 6 27 5 2 1 5 53 8 2 82 1 7 -12108: 70 32 969 889 58 6 -14567: 1 6 12 78 7 4 480 237 -150941: 5 7 5 90 941 -786264: 6 788 1 989 396 602 -51732: 39 781 63 2 70 -4021802: 7 718 7 8 6 436 -307443454: 482 30 405 76 6 -6876720: 68 767 1 6 1 -3775473626: 94 38 684 4 26 -477729: 96 211 222 93 7 -186422884169: 1 2 86 92 6 2 8 6 4 16 9 -10320797: 130 8 4 992 29 -5947214674: 5 94 72 146 74 -75017587536: 75 10 1 758 753 6 -87977: 28 7 80 579 93 -595019375: 3 2 736 1 199 7 976 63 -5401506: 68 355 82 223 -423147: 6 7 23 6 2 38 9 -37519365: 9 8 92 5 360 98 5 8 5 -153574577: 86 21 7 172 8 829 670 -749: 292 79 378 -1322409: 397 871 46 8 409 -1616671693: 9 6 3 4 4 43 2 6 9 9 2 469 -8395504261: 2 4 39 542 3 5 4 2 63 -1485870: 6 2 9 8 9 7 35 847 4 722 -1438: 4 13 880 463 3 40 -272444064: 7 3 3 5 33 7 7 2 6 1 944 6 -463128200: 92 625 6 40 5 -17757: 5 62 57 81 7 -223440: 6 94 9 264 3 9 95 2 -17536: 183 3 337 22 8 -159298: 73 85 491 802 5 -7217725681: 3 1 88 3 3 2 94 7 7 40 46 -9102004482: 8 6 20 37 4 99 8 1 143 2 -73: 6 8 11 9 5 -522: 73 14 6 -2317: 3 88 75 6 654 -45537732: 7 1 1 58 95 2 1 5 9 5 2 6 -292143828: 683 6 801 6 89 972 -26166150: 82 7 25 7 6 2 95 8 6 3 75 -524161499002: 73 825 563 24 71 -535311: 89 675 7 90 65 356 -912: 4 6 866 -26016: 796 8 89 47 4 -1953265: 8 8 8 3 5 8 5 64 3 9 7 370 -184602403: 18 10 3 32 62 40 403 -16262943763: 146 8 88 2 90 6 8 29 6 2 -102402849: 328 214 8 39 81 -28237920: 1 5 575 902 14 2 4 267 -823891: 85 2 736 8 94 -146882851: 706 25 9 885 94 919 -5015: 9 1 3 412 71 1 -39960936: 2 5 365 2 85 6 92 184 -149149800: 79 4 7 41 47 860 -245273298: 272 525 6 1 7 7 5 9 -36014801803: 3 5 1 9 2 296 5 180 2 -9268771223: 122 92 8 754 23 -3879: 1 7 5 97 -6366882079: 5 280 25 1 73 5 4 3 2 5 9 -22651880: 4 566 2 2 376 5 -416: 397 2 17 -7522024: 666 3 8 7 7 644 36 76 -12054942: 1 16 48 872 6 125 13 3 -1804617: 8 77 14 505 4 2 16 -4979592: 1 684 479 62 69 -13230: 7 7 5 6 9 -188694006: 260 7 955 1 68 74 -664824301: 76 399 783 4 7 925 -99691298: 7 72 2 989 98 -2957: 40 58 8 516 52 61 -20566962720: 48 3 2 704 221 2 4 6 54 -768427128109: 8 50 10 3 904 810 7 -6527661: 8 36 61 9 1 993 2 9 2 4 -28558016: 237 908 7 738 4 3 17 4 -5416190: 6 9 136 814 7 3 611 4 5 -3058632: 384 4 2 895 7 59 92 -13389382: 8 7 1 2 759 7 295 1 7 2 -162903312071: 6 520 30 6 586 9 55 68 -1105: 4 2 86 1 184 -156: 83 34 5 2 32 -75682: 2 97 759 5 79 -738707: 7 4 7 9 54 916 7 -181872944: 2 6 48 511 3 339 93 9 5 -6916941511: 3 688 6 9 3 83 1 8 24 11 -215342: 3 3 7 2 534 69 1 67 540 -399338: 7 114 8 7 956 -2973648: 9 333 992 84 7 533 -3201299426: 1 2 3 5 1 8 43 2 57 2 3 23 -522701569: 5 22 58 3 9 15 5 2 1 6 8 2 -303731392: 5 1 9 9 930 84 35 63 6 8 -34897940825: 610 13 46 89 44 8 25 -29346: 8 3 49 67 6 -60466566943: 4 6 3 3 3 29 91 68 438 9 -3078173: 276 237 6 164 9 -1526065: 61 5 316 3 2 44 73 -1346: 382 814 9 45 96 -9683184: 9 2 5 537 16 7 7 -47632853: 79 363 25 6 54 -18427387459263: 2 9 42 7 385 2 4 592 62 -72445: 1 1 76 9 93 -354603: 9 3 8 2 29 4 893 975 -30207570456: 21 449 202 83 84 -1601402382: 623 34 56 7 6 47 18 -805: 51 5 618 89 42 -453218: 453 156 52 2 8 -2454691634: 3 7 52 4 58 67 7 16 34 -4249375: 376 8 3 2 5 4 44 8 7 18 4 -11202362: 466 76 1 5 24 -13890175488: 495 575 352 9 778 36 -77784300: 82 512 5 97 15 6 3 -3417: 17 5 91 3 3 2 46 16 2 3 3 -158868604400: 295 538 158 604 400 -14794788: 7 3 3 10 469 72 734 6 -496329: 55 9 51 2 1 90 726 -49702: 5 967 66 69 2 -5820848128: 65 789 227 5 1 8 611 -9911: 900 9 905 -2116507855: 939 7 7 46 926 920 9 -678377763: 7 35 8 866 57 3 8 1 9 6 1 -15252661: 8 7 25 265 8 -432963: 6 1 16 8 1 9 4 395 8 1 4 7 -462883134: 2 314 4 1 5 5 4 9 5 5 989 -20394944733: 2 40 259 72 280 1 93 -25449007500: 56 3 875 82 630 -673: 4 6 6 9 98 35 -433234809674: 481 369 3 45 2 962 5 4 -2231307: 932 1 1 5 239 -5496: 421 29 8 1 1 12 -361056486: 95 38 527 33 4 86 -14832: 2 119 7 -55377: 355 66 256 9 58 2 9 -3672207430366: 64 290 1 229 9 7 33 96 -924506: 8 1 8 7 7 307 4 825 72 7 -585727992: 406 75 29 24 2 5 72 -4464: 4 3 50 9 8 -969362: 2 30 8 420 -91356570230: 3 6 6 34 2 9 92 9 3 6 2 28 -21019: 41 38 543 7 -24076855887: 481 53 2 3 2 1 17 7 5 2 -5655436: 4 1 5 666 6 62 8 5 22 3 3 -2196815: 6 1 6 6 742 76 -197984593: 394 39 502 4 806 -225: 7 3 3 1 9 -54870: 914 4 1 6 -966: 25 9 641 93 7 -37809635: 53 269 851 87 321 2 3 -3735230: 18 717 5 43 1 36 995 -514763246: 3 8 21 10 76 3 23 1 7 1 9 -203727: 7 6 82 79 720 9 -17269915: 8 7 15 4 4 2 95 6 69 2 65 -10989115532: 7 8 1 650 6 4 6 2 3 11 3 5 -42746579602: 70 422 7 607 2 86 414 -128541973: 67 37 954 2 1 4 -2255236: 5 80 424 931 61 5 -335089472: 6 10 5 904 5 6 68 478 -342735588: 17 14 40 433 36 -9159: 9 21 35 27 5 384 -955712: 6 199 64 8 -429600: 1 96 52 29 4 100 -16629466: 870 9 41 38 70 4 46 7 1 -428326080: 2 8 6 715 4 6 2 6 4 65 6 -11696320: 36 547 4 40 8 -3480960: 60 14 8 74 7 -9707101: 995 6 975 -1408: 2 510 386 -82190387178: 821 871 32 8 7 1 81 -3057975750: 765 3 47 3 7 9 8 8 4 5 5 6 -1089290533: 3 4 3 5 1 603 7 69 533 -4645808: 451 2 133 771 37 -1875141773: 24 353 997 74 34 6 3 5 -1485138665414: 3 99 28 74 6 95 47 414 -37584: 87 9 6 8 -54241847: 3 530 6 7 341 -831532886240: 7 3 8 3 525 1 827 140 8 -2269440: 34 64 2 97 15 768 -3335: 5 3 8 6 92 24 3 640 -1607: 9 5 1 35 -926184: 88 19 82 7 7 84 -211117960879: 9 5 8 20 866 7 67 691 7 -9035504: 8 36 1 7 193 2 8 -1081599840165: 4 7 30 8 782 9 34 33 5 -1193940730: 958 47 18 66 7 30 -655320: 6 551 71 9 28 94 17 -2132901: 8 6 2 3 9 6 9 3 7 10 277 7 -6688892: 1 667 88 83 3 6 -5173437: 14 87 8 35 64 -29980: 23 13 54 26 -78634578: 65 55 8 3 34 6 803 -51202768: 420 4 2 878 2 359 409 -329599694594: 533 1 258 84 32 23 -419178834: 4 41 5 2 9 2 8 1 2 5 9 246 -203412475243: 4 168 6 5 2 6 47 4 5 7 4 1 -27075: 7 2 1 3 62 852 -416831779: 8 533 5 399 91 7 7 -3976787: 52 2 9 7 865 9 -240484: 70 1 885 5 48 8 2 1 236 -1959168: 573 4 2 4 223 9 3 8 4 8 3 -13400405953: 7 403 5 392 181 -54686971: 6 6 3 12 1 9 479 3 559 1 -15780086: 8 2 4 24 4 8 9 2 94 8 80 4 -5328139588: 877 15 9 50 9 7 1 9 6 13 -103650: 7 9 9 6 3 4 14 2 51 984 6 -1132504: 3 47 906 5 5 4 -1325436: 64 445 1 4 651 -522368033: 985 59 53 53 36 -17934048: 5 4 6 748 74 -32923: 8 80 5 92 3 -1684403: 68 375 9 66 64 2 734 9 -111745: 89 91 7 88 411 2 452 -13263230: 163 3 131 62 4 -3868986962: 6 42 362 167 98 72 8 5 -11345670: 3 43 145 63 27 -319239004896: 50 6 72 85 768 16 8 63 -3034544540: 3 5 867 4 33 12 4 3 -40627: 4 51 4 9 -47169937111206: 47 1 69 937 111 208 -112164822847: 5 804 2 7 7 66 3 84 5 2 1 -5803503559: 7 7 904 7 6 868 88 2 6 -11634120945: 947 6 29 4 306 943 -34851742: 913 7 9 3 63 55 98 -6297303600: 8 72 2 2 653 5 4 6 5 490 -9669310775124: 869 94 1 629 308 611 -4741903666: 6 1 9 6 182 6 77 1 6 4 2 6 -1410872158446: 7 5 271 80 3 958 7 4 98 -343116238185: 10 359 7 898 36 92 9 -400086541453: 837 478 54 1 453 -6515098: 63 25 7 270 254 -348: 30 4 6 -239609608: 1 1 6 19 5 33 607 28 53 -7414288540: 49 42 859 3 5 4 10 -96771: 6 200 1 8 43 1 37 56 3 -1894118717: 281 674 2 176 68 3 7 -6310857469: 80 8 6 160 6 3 5 11 7 6 9 -6182479: 6 72 92 77 2 -1032: 925 2 57 48 1 -1091687: 8 8 2 736 2 6 915 2 999 -543443: 92 1 59 3 49 -165718061: 2 7 6 22 24 445 5 6 5 -610745: 754 9 9 1 5 -5361319385: 8 8 2 3 777 193 76 9 -6159: 191 1 4 907 61 5 339 -493628437516: 7 421 75 9 5 9 3 7 1 886 -15757062: 104 293 147 2 9 9 3 51 -11216: 79 480 142 2 8 -6822: 23 13 3 7 543 -3388859842: 5 8 555 43 87 25 170 -8334: 25 77 9 75 9 -2250866676: 8 7 29 9 3 9 42 5 7 86 7 4 -89826408460: 4 411 863 36 6 457 -153485: 23 922 642 7 437 112 -36262905: 3 4 4 61 2 571 1 5 13 5 5 -22502497: 970 280 2 9 2 498 -2331369: 84 70 3 5 900 5 734 27 -22804091: 54 711 60 593 869 -24912366556: 76 4 88 3 700 607 7 44 -781102: 324 8 7 20 39 24 -341021: 41 9 881 3 51 46 118 1 -125012160: 48 14 56 952 36 45 2 -8601135: 928 45 3 6 9 20 971 17 -580850: 29 5 40 96 712 44 -26137464000: 61 1 95 10 860 4 129 -86455555: 868 9 199 1 5 -353502837: 5 11 261 66 969 86 9 -1766966: 243 665 65 2 908 -40398720: 8 59 727 795 64 -15777929: 1 36 6 6 886 8 6 35 -26640: 12 14 9 26 7 52 2 7 7 1 9 -6825793: 8 245 8 578 6 2 4 759 4 -7785132: 64 310 18 2 7 7 8 9 3 -5165452178: 239 350 658 34 633 -41027: 607 6 4 50 406 7 -109810788: 3 1 6 860 2 4 9 95 7 1 1 3 -3302: 87 63 8 60 27 226 7 5 -9182593: 1 5 274 62 98 2 9 2 5 73 -111608008784: 5 9 702 6 213 8 6 3 688 -82474315: 4 407 77 8 591 20 51 7 -3266534: 4 211 645 9 27 6 6 2 -235297: 806 22 7 5 5 8 7 26 71 -2902992: 12 32 5 8 67 1 36 38 8 -757673: 39 75 7 37 98 -5392: 852 6 13 26 241 -30316819: 606 5 1 15 799 21 -84160936096: 8 9 153 530 4 944 -18573: 2 2 9 7 72 29 397 3 -3400587: 339 9 6 9 88 -59117080933: 6 58 4 707 23 7 3 8 5 8 1 -709244949: 7 164 99 8 7 6 8 5 5 8 -256666: 631 3 4 3 380 5 30 278 -149736926: 594 4 77 5 3 21 6 96 2 -51400927: 8 69 782 45 853 -24013402569: 7 9 3 614 54 584 98 9 -41468325: 2 74 88 3 8 15 382 769 -80871091: 36 3 720 1 18 25 1 2 8 3 -437200704: 4 10 7 860 4 131 5 49 -52531364: 52 53 136 5 2 1 -1159045536329: 60 1 95 2 276 79 2 5 29 -30401139: 3 36 415 44 92 1 5 654 -855593039661: 7 8 4 7 1 3 6 328 2 6 2 66 -19362670: 1 314 442 87 98 3 124 -9366020992: 124 88 15 31 5 8 541 2 -79281216: 411 66 28 742 8 -2185054238: 79 63 8 343 2 61 7 40 -53587566: 6 918 47 69 78 3 -356106996: 4 5 8 7 96 92 9 175 7 7 4 -5372: 71 8 68 -42886097: 561 8 78 6 67 140 737 -2103466457: 4 72 14 60 9 73 -724634064: 8 2 2 599 2 8 6 4 26 2 72 -8940017483: 73 575 5 39 9 135 98 -734376: 2 4 62 455 888 -54967: 24 21 7 8 214 86 787 -25455: 2 3 8 467 8 925 3 3 3 2 3 -1706: 792 13 901 -16791586: 6 3 582 4 4 27 26 9 75 -1710311: 85 9 85 4 13 92 8 98 2 -178: 90 81 7 -2750345348: 5 7 298 853 8 4 4 3 2 3 2 -14913758: 9 271 33 16 264 9 58 1 -26509773: 4 6 104 10 192 13 771 -317152: 4 8 13 8 748 -54215093: 541 1 150 92 1 -14652360: 24 4 2 6 1 297 61 2 -147456741: 46 37 318 72 68 -135995340: 755 18 9 530 2 38 -5483610: 41 568 288 2 9 -265251335: 7 7 9 9 7 3 34 64 2 4 3 5 -444155: 38 74 566 78 75 -126994861: 23 4 157 3 17 4 861 -5528579: 6 5 3 8 8 1 3 7 7 7 34 624 -2198016422: 646 2 1 8 424 424 -16522: 5 7 9 9 51 -159183412: 320 141 392 9 52 -650538326: 6 46 7 1 26 8 4 3 824 8 6 -77169: 237 65 8 7 5 69 -49257063: 584 1 842 56 7 -51989200: 553 94 6 9 56 4 10 4 56 -636276292: 357 69 1 7 9 9 41 -5011587678720: 51 320 643 32 7 678 -62832226: 9 87 2 6 35 364 3 226 -324973544: 1 4 6 9 54 9 735 44 -43107424: 6 62 423 63 93 4 -1329: 3 7 11 1 921 -8127180: 4 5 2 35 1 5 9 43 55 5 3 -1646401: 6 276 1 7 2 1 7 6 8 800 1 -15569384: 37 40 4 763 1 597 787 -553222: 2 78 2 5 349 57 -667200: 91 610 24 66 12 -516301112: 573 630 6 365 9 1 721 -1375256534: 764 9 28 267 2 -24960320: 229 2 5 23 494 14 40 4 -54337879040: 7 2 37 3 3 37 878 98 5 7 -194164: 57 85 4 6 30 4 -214404579: 127 55 5 7 877 4 -91527: 3 6 73 5 2 7 -2551884: 287 616 314 9 6 -48941720325: 6 7 9 74 6 40 4 6 2 9 2 9 -9203: 16 575 5 -14256435294: 348 5 681 409 4 -3318458: 83 563 71 697 2 -36500: 52 7 32 6 62 -16233851004: 143 9 4 6 4 18 157 2 7 -130073: 73 9 22 8 9 -41452: 7 1 7 7 893 8 8 4 4 6 54 -29730573: 81 4 8 6 6 5 82 6 509 73 -451552: 27 147 928 2 2 292 8 -3607962: 5 67 97 3 6 37 1 784 8 3 -26553: 9 4 8 5 5 3 4 653 4 6 33 -99871: 3 26 67 3 871 -7974822: 79 7 431 6 506 -1065219: 42 1 44 12 48 771 -5804229: 602 964 37 58 1 -583501: 1 53 20 3 8 19 8 -8588035: 8 1 556 80 38 1 6 5 -2580648233: 9 7 2 8 1 6 727 8 6 9 9 69 -4013: 8 7 47 541 177 657 3 -4153099: 3 4 4 2 3 1 15 3 6 3 615 4 -232804: 539 972 51 533 5 3 7 -2309375607: 68 6 3 1 5 74 7 195 1 8 -769560: 3 90 7 40 458 8 1 6 2 8 4 -1016784: 78 7 6 6 307 -1178617147: 864 3 489 278 3 5 -38149143: 6 69 282 57 69 -665229: 98 7 5 67 9 580 -4130590464: 406 987 78 33 192 6 -447: 4 86 357 -3914899837: 4 2 156 4 4 66 3 1 1 3 1 6 -56259883189: 3 48 8 2 6 92 2 2 7 28 6 9 -2622: 12 7 4 2 74 -194536: 97 268 2 -31098614: 921 6 97 72 8 78 3 58 -948415: 4 4 8 8 96 8 527 67 2 4 5 -2672: 752 90 680 554 596 -476795: 45 8 6 6 9 6 4 6 5 9 4 412 -20759512: 2 6 8 8 4 938 8 869 840 -88817568: 97 6 7 6 2 668 9 6 1 8 12 -670085900344: 351 76 350 7 8 1 4 49 4 -755086: 4 3 7 840 59 730 9 2 4 -432946594: 432 946 1 49 396 46 -620888945040: 79 8 6 3 49 7 510 4 91 6 -9711: 856 9 839 168 135 -194558935285: 2 2 772 237 63 4 285 -758: 7 750 2 -6280922826: 4 32 9 3 3 7 6 5 7 81 9 -138895: 8 322 4 68 95 -1025917474: 6 30 395 917 47 4 -164811353: 4 3 67 35 66 1 356 -75636042382: 9 950 7 38 88 42 379 6 -3167998: 619 12 29 960 5 -1481204467: 5 2 5 8 4 175 2 4 38 8 8 1 -9923388: 2 515 47 23 8 51 12 -541863871: 541 86 38 7 2 -56829631: 3 5 7 676 9 144 632 1 1 -3465276611: 5 5 2 9 21 11 25 1 613 -10455518: 2 9 163 4 221 8 -45296160: 99 681 3 3 7 85 6 7 16 -142800: 8 6 7 34 2 971 1 8 5 50 -91872: 30 3 30 498 24 -55018317: 16 95 832 472 39 546 -4901324998: 919 5 77 83 53 8 \ No newline at end of file diff --git a/2024/day7/input_test b/2024/day7/input_test deleted file mode 100644 index 87b8b25..0000000 --- a/2024/day7/input_test +++ /dev/null @@ -1,9 +0,0 @@ -190: 10 19 -3267: 81 40 27 -83: 17 5 -156: 15 6 -7290: 6 8 6 15 -161011: 16 10 13 -192: 17 8 14 -21037: 9 7 18 13 -292: 11 6 16 20 \ No newline at end of file diff --git a/2024/day7/solve.py b/2024/day7/solve.py deleted file mode 100644 index 4737c9c..0000000 --- a/2024/day7/solve.py +++ /dev/null @@ -1,38 +0,0 @@ -def is_valid_entry(ent: tuple[int, list[int]], current_result: int = 0, current_index: int = 0) -> bool: - if current_index == 0: - current_result += ent[1][current_index] - return is_valid_entry(ent, current_result, current_index + 1) - - if current_index >= len(ent[1]): - if current_result == ent[0]: - return True - return False - - new_result = current_result + ent[1][current_index] - - if new_result <= ent[0]: - if is_valid_entry(ent, new_result, current_index + 1): - return True - - new_result = current_result * ent[1][current_index] - - if new_result <= ent[0]: - if is_valid_entry(ent, new_result, current_index + 1): - return True - - return False - -entries = [] - -with open("input") as f: - for line in f: - line = line.strip() - split = line.split(": ") - entries.append((int(split[0]), [int(elem) for elem in split[1].split(" ")])) - -result = 0 -for entry in entries: - if is_valid_entry(entry): - result += entry[0] - -print(result) \ No newline at end of file diff --git a/2024/day7/solve2.py b/2024/day7/solve2.py deleted file mode 100644 index f508ad9..0000000 --- a/2024/day7/solve2.py +++ /dev/null @@ -1,44 +0,0 @@ -def is_valid_entry(ent: tuple[int, list[int]], current_result: int = 0, current_index: int = 0) -> bool: - if current_index == 0: - current_result += ent[1][current_index] - return is_valid_entry(ent, current_result, current_index + 1) - - if current_index >= len(ent[1]): - if current_result == ent[0]: - return True - return False - - new_result = current_result + ent[1][current_index] - - if new_result <= ent[0]: - if is_valid_entry(ent, new_result, current_index + 1): - return True - - new_result = current_result * ent[1][current_index] - - if new_result <= ent[0]: - if is_valid_entry(ent, new_result, current_index + 1): - return True - - new_result = int(f"{current_result}{ent[1][current_index]}") - - if new_result <= ent[0]: - if is_valid_entry(ent, new_result, current_index + 1): - return True - - return False - -entries = [] - -with open("input") as f: - for line in f: - line = line.strip() - split = line.split(": ") - entries.append((int(split[0]), [int(elem) for elem in split[1].split(" ")])) - -result = 0 -for entry in entries: - if is_valid_entry(entry): - result += entry[0] - -print(result) \ No newline at end of file diff --git a/2024/day8/input b/2024/day8/input deleted file mode 100644 index 8f67508..0000000 --- a/2024/day8/input +++ /dev/null @@ -1,50 +0,0 @@ -..F..........L............5....................... -............................L.U................... -.................................................. -.............z.L.........5.....4........8....1.P.. -...F................D..4.8.............P......J... -......f................8....z........U..J......... -.......D..f........B..o.........m..........JX..... -......o...5........F..........m.......6....X...... -....s........f...n.....54.U....E................3. -....F.......l.......k..............6.3n........... -L..........z....7..U............E...k.P..3b....... -..s.......D..........h...k.....G........y..m...... -d..............o.........X............8...n....... -...........o.......D.......J...................... -....................z.....1.9....G6..Y.b....y..... -.d................4.........EN..G.9.b............. -.......................7.......................... -..d................l.........pc..n................ -..............l........1Nm..........G..9.......... -.f.........s...7........1........E........X....y.. -.............d...................6......v......... -........................h.............B........... -.......l.......................h........B.....p..y -........w......A................................M. -.....s.................O...........p.......2...... -...............9.........................B.b...... -......................w..0..............H......... -.....................w7.j..O....................e. -.A......Z...................K...h...M............. -.................S....KZ.......................... -.................V..............x................. -......Z...............................N........... -.......................a.......................... -....A..........................K.................M -.......Z..................ON.KT.........c......... -...........................YO....t.......x........ -..............g........w.T.............k...c...... -..........................v....................... -....S..................................u.......... -..........0............v...............c...e..C.p. -.......S............V.j........v.......x.......... -......S..0W.......HT....a......................... -A..............H...W..a......C.................... -................T.2.....V......H..t...u........C.. -.................g.j....2.........u..t...e......C. -.........W...........g.......................u.... -........W...0.................Y.........e.tM...... -................g..a.j............................ -.................................................. -.................2........Y...........x........... \ No newline at end of file diff --git a/2024/day8/input_test b/2024/day8/input_test deleted file mode 100644 index de0f909..0000000 --- a/2024/day8/input_test +++ /dev/null @@ -1,12 +0,0 @@ -............ -........0... -.....0...... -.......0.... -....0....... -......A..... -............ -............ -........A... -.........A.. -............ -............ \ No newline at end of file diff --git a/2024/day8/solve.py b/2024/day8/solve.py deleted file mode 100644 index 9dba99e..0000000 --- a/2024/day8/solve.py +++ /dev/null @@ -1,34 +0,0 @@ -lines = [] - -with open("input") as f: - for line in f: - lines.append(line.strip()) - -antennas: dict[str, list[tuple[int, int]]] = {} -for row_idx, line in enumerate(lines): - for col_idx, char in enumerate(line): - if char != ".": - if char not in antennas: - antennas[char] = [] - - antennas[char].append((row_idx, col_idx)) - -row_count = len(lines) -col_count = len(lines[0]) -antinodes: set[tuple[int, int]] = set() -for antenna_list in antennas.values(): - for idx, antenna1 in enumerate(antenna_list): - for antenna2 in antenna_list[idx + 1:]: - row_diff = antenna2[0] - antenna1[0] - col_diff = antenna2[1] - antenna1[1] - - pos1 = (antenna1[0] - row_diff, antenna1[1] - col_diff) - pos2 = (antenna2[0] + row_diff, antenna2[1] + col_diff) - - if 0 <= pos1[0] < row_count and 0 <= pos1[1] < col_count: - antinodes.add(pos1) - - if 0 <= pos2[0] < row_count and 0 <= pos2[1] < col_count: - antinodes.add(pos2) - -print(len(antinodes)) \ No newline at end of file diff --git a/2024/day8/solve2.py b/2024/day8/solve2.py deleted file mode 100644 index 1642e35..0000000 --- a/2024/day8/solve2.py +++ /dev/null @@ -1,35 +0,0 @@ -lines = [] - -with open("input") as f: - for line in f: - lines.append(line.strip()) - -antennas: dict[str, list[tuple[int, int]]] = {} -for row_idx, line in enumerate(lines): - for col_idx, char in enumerate(line): - if char != ".": - if char not in antennas: - antennas[char] = [] - - antennas[char].append((row_idx, col_idx)) - -row_count = len(lines) -col_count = len(lines[0]) -antinodes: set[tuple[int, int]] = set() -for antenna_list in antennas.values(): - for idx, antenna1 in enumerate(antenna_list): - for antenna2 in antenna_list[idx + 1:]: - row_diff = antenna2[0] - antenna1[0] - col_diff = antenna2[1] - antenna1[1] - - pos = antenna1 - while 0 <= pos[0] < row_count and 0 <= pos[1] < col_count: - antinodes.add(pos) - pos = (pos[0] - row_diff, pos[1] - col_diff) - - pos = antenna2 - while 0 <= pos[0] < row_count and 0 <= pos[1] < col_count: - antinodes.add(pos) - pos = (pos[0] + row_diff, pos[1] + col_diff) - -print(len(antinodes)) \ No newline at end of file -- cgit v1.2.3-70-g09d2