From f85cbb1539cef42fd5450da7b163fdec75d56336 Mon Sep 17 00:00:00 2001 From: Andrew Ekstedt Date: Mon, 2 Dec 2024 03:40:57 +0000 Subject: [PATCH] day 1 --- day01/data.ivy | 1 + day01/input | 1000 ++++++++++++++++++++++++++++++++++++++++++++++ day01/sample1.in | 6 + day01/sol.ivy | 3 + day01/sol.py | 18 + 5 files changed, 1028 insertions(+) create mode 100644 day01/data.ivy create mode 100644 day01/input create mode 100644 day01/sample1.in create mode 100644 day01/sol.ivy create mode 100644 day01/sol.py diff --git a/day01/data.ivy b/day01/data.ivy new file mode 100644 index 0000000..0983de2 --- /dev/null +++ b/day01/data.ivy @@ -0,0 +1 @@ +a = 2 1000 rho 27636 67663 92436 51410 68957 77912 36747 51149 30882 77912 46213 99914 86101 84506 33651 96019 21290 82431 63075 53396 71804 79079 59491 99914 38723 14006 33281 26247 83935 50770 86374 85083 25576 54727 73648 86649 22409 70249 29227 64316 35430 67143 56749 86649 54666 96019 34014 95399 79952 39373 11527 93723 62980 57578 30486 71734 32658 65436 93735 27438 61456 18953 25491 56656 76585 62810 25849 18414 31715 71902 70587 95582 80976 14987 38641 41417 67621 73094 85775 53902 17220 40408 88727 97556 22359 67543 91113 12527 62161 31532 11773 15282 89645 63687 25738 16174 90797 16652 57466 93723 51356 19628 25218 41212 23778 85100 69307 79895 13469 20787 88354 57627 21993 13027 55533 37964 69092 70902 48561 79752 65224 87109 87087 63928 51086 13027 29509 99914 70303 58298 70347 61384 26945 76706 70853 57779 73422 69817 44312 25891 59429 14006 37343 70249 19979 70249 69957 39312 18726 53276 83466 77883 61518 13900 42155 89500 63098 60521 14449 98681 82637 43106 22191 50560 73961 11938 45981 65414 52835 21932 64522 66095 72719 18593 95067 14254 67827 67002 91626 16259 46648 97579 64260 16945 51036 96019 11763 16672 22050 54727 81115 40408 24109 99038 61490 16520 12415 86649 70936 46470 67369 17839 66661 65147 46002 97383 92236 32003 76595 80883 99797 80845 47203 21390 12531 13900 14567 85100 97701 14006 36042 77912 68698 58773 83171 93348 46016 85412 74415 15656 54278 51529 97371 98662 71146 19396 34619 49766 27335 55419 14750 15656 20499 47003 65181 18169 25908 34850 48966 46960 56623 67545 84778 14006 23425 55003 57291 77912 34146 20637 30067 85100 43424 35599 73421 14006 91453 13935 78330 51410 76088 28885 18833 13272 20958 75765 96718 30755 56023 67143 43806 52016 14604 59721 44139 12527 65784 77912 29570 76135 47348 70249 43549 86649 76570 70249 88162 71939 34486 60331 26741 92387 41198 13377 53021 50770 98314 23805 52060 12527 86515 86649 98183 99252 79091 41638 56721 32794 69895 88727 30104 55899 48178 11818 99914 18935 18953 99914 59782 97763 69560 77912 84587 39848 16112 36887 97943 88572 48829 84079 61496 50770 16975 65569 20602 88536 28286 55419 46401 96019 33053 57040 20081 70249 20222 50466 87107 65780 70108 20762 60443 18222 86645 18222 86432 61462 10447 40408 26601 30399 20669 51410 64973 54727 26844 67876 66711 15656 50935 70954 64188 27385 72301 76224 68529 19569 60079 90182 31692 56893 32049 55692 99568 24749 68169 51227 90063 70816 70353 76443 45207 83046 10840 44770 29710 88168 84751 77912 22547 39355 32776 54727 10792 96019 86847 34709 90912 94687 61472 33330 17627 82577 59955 82580 84314 67146 17585 12527 85936 90872 19621 24662 91812 81993 32625 19895 15656 32549 99742 94319 66920 85100 24557 21855 64760 54727 83318 85721 41316 96019 70737 80023 77115 60150 48008 50770 65812 50858 49725 63057 59430 29710 56813 71902 18412 69153 74854 88293 53478 61306 46955 13896 58632 18937 19960 45246 50522 14006 13027 14006 50345 25891 32301 73422 56811 74923 33257 26767 85044 57082 44874 23425 90402 83509 35786 99914 27689 73422 12527 48603 56563 40588 49173 58298 25094 21932 52615 28332 87738 47861 15259 86649 56450 12469 99476 13027 31357 20788 29302 88536 69527 99914 79016 86091 86187 75381 37040 13900 40789 17863 52819 88536 99512 67289 43526 49745 93256 92442 86400 71902 13900 32003 86362 46470 84806 89066 13325 73969 38597 82656 26209 71126 67143 49421 12555 73422 49109 47621 12757 93723 60966 54727 91829 82268 16715 15691 68953 93723 29390 76089 17838 65569 51410 31825 87719 13027 20487 39355 56471 24545 21675 43800 13445 54727 20493 65829 12310 73945 29366 93723 55574 74438 20558 40408 60707 60326 67675 28319 68219 99051 55901 12056 36090 67102 21645 93723 91741 70249 86631 68917 16190 73338 69156 78863 25891 12529 60505 76667 91367 54996 35197 12527 96289 65569 99720 13027 60152 67328 47373 40408 46470 29710 92309 49534 96399 17417 19136 80925 75645 55419 60134 51410 44963 25891 57213 36908 32935 13027 13760 16748 10501 48177 24699 88567 87817 63343 98506 96019 13109 51410 98827 88536 81592 29559 32418 96845 23249 35212 33739 18823 91660 94468 41270 14006 61624 45215 94473 82748 81411 22202 62042 79434 87156 78604 96708 39355 21576 94644 58090 88727 75796 88727 36732 65569 98878 93723 77836 40408 12739 71850 14393 65616 54759 54727 91950 67999 32038 71414 88128 88727 18687 51410 86649 10180 54652 14006 51200 94013 25759 73695 78325 88536 85100 15068 77314 70249 29771 25891 48512 39931 32758 23781 65569 81723 76547 81341 97796 93723 23560 86649 85749 75599 90577 14006 89148 88727 87413 25602 80005 86649 18222 50953 84166 12223 21431 55419 51539 88536 39002 77912 40699 93886 78076 33894 50213 58400 20711 12527 66242 50770 58894 95457 20142 13027 75889 82440 42984 27810 26613 18222 17725 46470 78045 58527 70755 96361 34750 71902 23788 36870 71435 15656 69573 76045 97075 41621 68889 74341 43705 71777 51174 15068 25175 77912 46042 18071 43652 91644 17776 13027 21586 32003 55557 44791 15068 26861 31285 37296 41268 12527 12274 70661 64942 83051 40158 27491 97113 12527 64437 50770 29587 52457 93723 18953 26593 61122 77159 36445 70733 11733 58626 69962 88075 10820 27706 71880 62175 19584 29037 77912 39846 88536 52710 17260 37988 12527 98941 40408 55492 27433 49614 49375 73031 53756 69107 93963 13487 13027 88557 52956 19978 54109 70308 61626 97197 75015 29461 13027 49851 33862 61641 43710 97372 21774 24845 11676 23306 33519 79069 85100 90401 66032 70009 38628 74208 90870 66927 34883 83113 78562 67665 13027 50134 79665 39442 94713 34392 81306 74601 88727 15396 42882 75388 94071 60137 52050 11501 44410 70249 86649 34514 95654 58802 59932 60092 82834 59700 84142 73594 84251 41063 23656 24258 85833 77170 71729 57174 93723 52939 49958 17073 40408 91476 19173 67849 46955 42366 85100 31967 18222 51791 29710 80503 21818 21171 29593 35814 88536 50383 18222 68500 73422 60941 38247 80579 25728 56150 40408 91392 58387 97794 36481 24938 16433 20897 29710 69005 86270 23332 82430 96092 40408 55606 47408 69393 25538 88805 93865 25377 70249 74563 88727 89699 53054 45796 55419 56407 67840 72925 97565 88536 75060 33881 70279 19496 13027 26289 44211 51334 88536 12579 46470 69622 39657 17900 77122 67747 89325 79881 21053 61202 42967 70883 87544 16535 93383 26503 45342 28297 61791 50933 96173 32002 32699 34690 57980 28399 29710 13660 21932 98065 27996 50853 35963 88438 86562 36165 73677 79940 40408 40541 67170 20091 91424 39355 99566 13081 14006 58083 81235 54830 49834 32825 96019 83692 43716 95628 73356 74443 89957 35677 36499 75279 88536 71821 80590 84260 98484 59645 59826 35932 50116 75575 22994 73616 84555 51144 93243 60005 14006 12864 10684 77834 48318 69011 41387 97024 46470 98000 64609 26029 33500 33877 94750 55830 93723 15334 85100 89061 23221 11922 77337 47976 22799 11635 91933 75213 24886 90993 41805 90684 25891 72604 76753 42647 85843 40408 68133 75946 51218 70196 25891 30412 57914 97066 18953 38230 13899 29377 11580 75574 72968 29393 72845 77297 89211 16269 94844 82893 88061 37116 76838 80997 20602 97618 91685 33698 51410 61935 12527 44252 79583 46297 65424 21075 15121 61997 65569 82784 24455 32616 50770 65600 52179 70762 93723 33830 14006 59127 76111 79111 42235 14634 65569 61114 98404 34701 57155 66321 32003 71411 77114 36070 54003 44096 31057 17790 54727 94384 50770 55954 71902 48200 87183 77912 12527 68228 18280 98972 44903 36198 50770 38106 65335 25785 12527 76187 77603 23889 85100 68678 41314 22106 18953 24718 77912 23942 40408 78992 55995 69199 55700 53735 79770 44697 51111 32874 28161 65350 46470 31226 70249 25736 68636 35753 99319 84252 54258 28351 73446 36754 11085 81734 37763 20447 86649 93586 53062 68321 90392 60154 94363 94162 12527 49437 88536 36753 77770 52652 51410 44124 77727 41114 39334 16864 77072 83149 65132 59730 54727 84057 23618 30656 12284 92801 37685 49414 78016 21932 88727 83899 99914 50417 73542 42247 36961 11620 12527 89175 55534 29239 54727 52046 39122 10565 13027 94606 34488 80368 51410 19058 70249 52560 88727 94907 94594 22583 59070 87045 57573 81908 66470 52664 14006 85444 50714 79620 41857 64520 28656 77565 40408 54891 79480 60407 67143 94156 85508 78606 12527 49973 99914 18848 12527 16148 13383 39583 88536 71135 76625 15135 88536 81304 13900 78906 24249 70225 84691 82947 40735 56886 59761 87699 68570 48939 46470 72665 99460 29077 13027 37693 86226 49023 23978 14671 63325 95319 61292 40288 73784 40842 70647 52129 68530 59166 91619 21052 11307 98213 99699 61504 13900 27254 99914 30050 25730 75338 80979 91814 16267 84916 50770 51427 88782 51277 82884 50738 85720 71902 32003 61287 54727 48427 93265 34807 51980 56975 96019 58937 51410 64930 22005 72532 55499 40608 56661 53656 88727 62477 96019 48812 88536 37482 25188 32909 71902 60132 12743 36648 92407 26489 46955 25601 23377 17624 71902 69982 63535 23798 12527 14088 46470 79596 12527 47284 18073 66594 82908 47309 21386 41035 86649 95662 18222 19255 70249 59514 22092 83736 32111 19643 64859 30590 26610 16132 94311 61696 45689 67551 96019 12741 12527 78583 25891 26961 17506 78162 56028 80916 83853 98196 76265 58308 16344 40122 58950 53743 21620 24428 86026 78836 73860 10212 38302 19115 36550 15104 93723 16369 51410 68786 14006 43892 40408 23295 29751 91988 79020 20067 54727 43312 77912 68147 71902 13779 32131 94847 40408 91423 73498 69229 13900 25697 72238 99306 63294 66446 48149 69853 29710 92750 51625 81823 55419 36427 15068 86459 66813 48199 81641 20218 56086 83018 39032 72219 50770 94256 93723 32003 39207 47335 14006 42785 62691 74560 63579 27781 86649 15494 13647 92404 45629 84689 85500 17033 21765 10332 13027 35398 79463 92891 79965 33833 48986 55107 99914 57461 88727 60916 87668 79014 20602 17965 13027 10123 29710 36522 46583 83178 51594 92593 37792 38714 21861 40023 13395 72206 73081 36381 75286 90435 26071 97471 69336 97952 40145 56034 20097 13292 81538 20477 50770 11873 77989 60247 50523 67149 48592 49108 68874 68890 87402 40881 94963 35432 13027 39476 47915 90012 54566 92534 48674 92032 50770 27585 79761 37875 37853 89774 13027 61075 15674 60756 87360 47898 92766 96598 68826 50236 47764 55057 70249 54727 17366 13681 54727 17072 77525 42614 90096 98669 82051 57089 13900 18696 54195 94345 35225 44841 88536 38879 23114 83766 94182 58826 99914 41811 85416 72019 50770 38976 86649 42451 59949 14546 55721 99835 97560 49639 30033 73524 60863 65556 87850 96707 58953 27288 74220 46483 15656 72352 96712 32100 70249 63167 14314 16622 95903 19000 15656 42483 78654 54025 76612 70377 60749 39261 36106 21224 96019 50908 82897 33035 16572 96495 31039 58082 88727 81593 19590 35755 54727 67526 44620 72752 89000 83650 17979 70801 85100 25664 39700 44529 12527 59027 70249 16374 51410 80656 73108 66428 70249 13405 29710 24375 51410 68087 40408 76117 48681 94015 65689 76691 16635 99054 13378 30917 90481 96893 25891 62567 21627 94245 10321 14080 40408 49942 29710 27954 25201 75660 93412 78795 88727 77270 88727 85985 42151 30119 46470 24570 15656 38301 25919 60012 82323 17386 61141 41982 15656 52502 14428 40518 16829 67678 88727 98468 67870 58153 18953 99115 15112 46175 92280 76963 70249 47731 85214 23760 73422 67026 30272 60174 27340 53612 13317 54298 88727 96019 77912 38623 64924 64015 99483 78520 32003 55419 65046 16763 77012 79038 70196 10821 93823 21975 92009 59774 70249 49520 59948 23429 74262 74297 84035 60268 86649 97106 70249 67040 13027 64952 32110 28218 14006 40852 83878 14006 78414 71194 95950 49032 88536 93565 76366 87180 54727 44863 27608 45305 75367 92628 30076 53704 25974 98469 33452 59903 54979 10499 20819 83104 67143 96322 65569 32582 14006 56098 93723 94744 60959 87479 15950 89231 11601 50869 70404 38814 73422 32132 73422 74145 35520 90512 88727 70617 38209 58298 48954 56952 29710 68984 70249 72264 56329 58999 54727 48633 42365 56154 57575 24276 54727 24166 14006 43755 59506 14184 65569 89299 31443 44142 46882 91129 86649 85560 86681 64723 14006 15506 10738 48493 71902 66107 48245 91213 16367 52172 54762 57989 56463 12155 82395 77388 25091 43192 47163 72417 30734 49430 71902 70268 85100 44133 81902 19946 82107 39220 51410 28498 29710 50770 27829 95962 15656 61245 14960 74434 46710 21991 30826 diff --git a/day01/input b/day01/input new file mode 100644 index 0000000..124f451 --- /dev/null +++ b/day01/input @@ -0,0 +1,1000 @@ +27636 67663 +92436 51410 +68957 77912 +36747 51149 +30882 77912 +46213 99914 +86101 84506 +33651 96019 +21290 82431 +63075 53396 +71804 79079 +59491 99914 +38723 14006 +33281 26247 +83935 50770 +86374 85083 +25576 54727 +73648 86649 +22409 70249 +29227 64316 +35430 67143 +56749 86649 +54666 96019 +34014 95399 +79952 39373 +11527 93723 +62980 57578 +30486 71734 +32658 65436 +93735 27438 +61456 18953 +25491 56656 +76585 62810 +25849 18414 +31715 71902 +70587 95582 +80976 14987 +38641 41417 +67621 73094 +85775 53902 +17220 40408 +88727 97556 +22359 67543 +91113 12527 +62161 31532 +11773 15282 +89645 63687 +25738 16174 +90797 16652 +57466 93723 +51356 19628 +25218 41212 +23778 85100 +69307 79895 +13469 20787 +88354 57627 +21993 13027 +55533 37964 +69092 70902 +48561 79752 +65224 87109 +87087 63928 +51086 13027 +29509 99914 +70303 58298 +70347 61384 +26945 76706 +70853 57779 +73422 69817 +44312 25891 +59429 14006 +37343 70249 +19979 70249 +69957 39312 +18726 53276 +83466 77883 +61518 13900 +42155 89500 +63098 60521 +14449 98681 +82637 43106 +22191 50560 +73961 11938 +45981 65414 +52835 21932 +64522 66095 +72719 18593 +95067 14254 +67827 67002 +91626 16259 +46648 97579 +64260 16945 +51036 96019 +11763 16672 +22050 54727 +81115 40408 +24109 99038 +61490 16520 +12415 86649 +70936 46470 +67369 17839 +66661 65147 +46002 97383 +92236 32003 +76595 80883 +99797 80845 +47203 21390 +12531 13900 +14567 85100 +97701 14006 +36042 77912 +68698 58773 +83171 93348 +46016 85412 +74415 15656 +54278 51529 +97371 98662 +71146 19396 +34619 49766 +27335 55419 +14750 15656 +20499 47003 +65181 18169 +25908 34850 +48966 46960 +56623 67545 +84778 14006 +23425 55003 +57291 77912 +34146 20637 +30067 85100 +43424 35599 +73421 14006 +91453 13935 +78330 51410 +76088 28885 +18833 13272 +20958 75765 +96718 30755 +56023 67143 +43806 52016 +14604 59721 +44139 12527 +65784 77912 +29570 76135 +47348 70249 +43549 86649 +76570 70249 +88162 71939 +34486 60331 +26741 92387 +41198 13377 +53021 50770 +98314 23805 +52060 12527 +86515 86649 +98183 99252 +79091 41638 +56721 32794 +69895 88727 +30104 55899 +48178 11818 +99914 18935 +18953 99914 +59782 97763 +69560 77912 +84587 39848 +16112 36887 +97943 88572 +48829 84079 +61496 50770 +16975 65569 +20602 88536 +28286 55419 +46401 96019 +33053 57040 +20081 70249 +20222 50466 +87107 65780 +70108 20762 +60443 18222 +86645 18222 +86432 61462 +10447 40408 +26601 30399 +20669 51410 +64973 54727 +26844 67876 +66711 15656 +50935 70954 +64188 27385 +72301 76224 +68529 19569 +60079 90182 +31692 56893 +32049 55692 +99568 24749 +68169 51227 +90063 70816 +70353 76443 +45207 83046 +10840 44770 +29710 88168 +84751 77912 +22547 39355 +32776 54727 +10792 96019 +86847 34709 +90912 94687 +61472 33330 +17627 82577 +59955 82580 +84314 67146 +17585 12527 +85936 90872 +19621 24662 +91812 81993 +32625 19895 +15656 32549 +99742 94319 +66920 85100 +24557 21855 +64760 54727 +83318 85721 +41316 96019 +70737 80023 +77115 60150 +48008 50770 +65812 50858 +49725 63057 +59430 29710 +56813 71902 +18412 69153 +74854 88293 +53478 61306 +46955 13896 +58632 18937 +19960 45246 +50522 14006 +13027 14006 +50345 25891 +32301 73422 +56811 74923 +33257 26767 +85044 57082 +44874 23425 +90402 83509 +35786 99914 +27689 73422 +12527 48603 +56563 40588 +49173 58298 +25094 21932 +52615 28332 +87738 47861 +15259 86649 +56450 12469 +99476 13027 +31357 20788 +29302 88536 +69527 99914 +79016 86091 +86187 75381 +37040 13900 +40789 17863 +52819 88536 +99512 67289 +43526 49745 +93256 92442 +86400 71902 +13900 32003 +86362 46470 +84806 89066 +13325 73969 +38597 82656 +26209 71126 +67143 49421 +12555 73422 +49109 47621 +12757 93723 +60966 54727 +91829 82268 +16715 15691 +68953 93723 +29390 76089 +17838 65569 +51410 31825 +87719 13027 +20487 39355 +56471 24545 +21675 43800 +13445 54727 +20493 65829 +12310 73945 +29366 93723 +55574 74438 +20558 40408 +60707 60326 +67675 28319 +68219 99051 +55901 12056 +36090 67102 +21645 93723 +91741 70249 +86631 68917 +16190 73338 +69156 78863 +25891 12529 +60505 76667 +91367 54996 +35197 12527 +96289 65569 +99720 13027 +60152 67328 +47373 40408 +46470 29710 +92309 49534 +96399 17417 +19136 80925 +75645 55419 +60134 51410 +44963 25891 +57213 36908 +32935 13027 +13760 16748 +10501 48177 +24699 88567 +87817 63343 +98506 96019 +13109 51410 +98827 88536 +81592 29559 +32418 96845 +23249 35212 +33739 18823 +91660 94468 +41270 14006 +61624 45215 +94473 82748 +81411 22202 +62042 79434 +87156 78604 +96708 39355 +21576 94644 +58090 88727 +75796 88727 +36732 65569 +98878 93723 +77836 40408 +12739 71850 +14393 65616 +54759 54727 +91950 67999 +32038 71414 +88128 88727 +18687 51410 +86649 10180 +54652 14006 +51200 94013 +25759 73695 +78325 88536 +85100 15068 +77314 70249 +29771 25891 +48512 39931 +32758 23781 +65569 81723 +76547 81341 +97796 93723 +23560 86649 +85749 75599 +90577 14006 +89148 88727 +87413 25602 +80005 86649 +18222 50953 +84166 12223 +21431 55419 +51539 88536 +39002 77912 +40699 93886 +78076 33894 +50213 58400 +20711 12527 +66242 50770 +58894 95457 +20142 13027 +75889 82440 +42984 27810 +26613 18222 +17725 46470 +78045 58527 +70755 96361 +34750 71902 +23788 36870 +71435 15656 +69573 76045 +97075 41621 +68889 74341 +43705 71777 +51174 15068 +25175 77912 +46042 18071 +43652 91644 +17776 13027 +21586 32003 +55557 44791 +15068 26861 +31285 37296 +41268 12527 +12274 70661 +64942 83051 +40158 27491 +97113 12527 +64437 50770 +29587 52457 +93723 18953 +26593 61122 +77159 36445 +70733 11733 +58626 69962 +88075 10820 +27706 71880 +62175 19584 +29037 77912 +39846 88536 +52710 17260 +37988 12527 +98941 40408 +55492 27433 +49614 49375 +73031 53756 +69107 93963 +13487 13027 +88557 52956 +19978 54109 +70308 61626 +97197 75015 +29461 13027 +49851 33862 +61641 43710 +97372 21774 +24845 11676 +23306 33519 +79069 85100 +90401 66032 +70009 38628 +74208 90870 +66927 34883 +83113 78562 +67665 13027 +50134 79665 +39442 94713 +34392 81306 +74601 88727 +15396 42882 +75388 94071 +60137 52050 +11501 44410 +70249 86649 +34514 95654 +58802 59932 +60092 82834 +59700 84142 +73594 84251 +41063 23656 +24258 85833 +77170 71729 +57174 93723 +52939 49958 +17073 40408 +91476 19173 +67849 46955 +42366 85100 +31967 18222 +51791 29710 +80503 21818 +21171 29593 +35814 88536 +50383 18222 +68500 73422 +60941 38247 +80579 25728 +56150 40408 +91392 58387 +97794 36481 +24938 16433 +20897 29710 +69005 86270 +23332 82430 +96092 40408 +55606 47408 +69393 25538 +88805 93865 +25377 70249 +74563 88727 +89699 53054 +45796 55419 +56407 67840 +72925 97565 +88536 75060 +33881 70279 +19496 13027 +26289 44211 +51334 88536 +12579 46470 +69622 39657 +17900 77122 +67747 89325 +79881 21053 +61202 42967 +70883 87544 +16535 93383 +26503 45342 +28297 61791 +50933 96173 +32002 32699 +34690 57980 +28399 29710 +13660 21932 +98065 27996 +50853 35963 +88438 86562 +36165 73677 +79940 40408 +40541 67170 +20091 91424 +39355 99566 +13081 14006 +58083 81235 +54830 49834 +32825 96019 +83692 43716 +95628 73356 +74443 89957 +35677 36499 +75279 88536 +71821 80590 +84260 98484 +59645 59826 +35932 50116 +75575 22994 +73616 84555 +51144 93243 +60005 14006 +12864 10684 +77834 48318 +69011 41387 +97024 46470 +98000 64609 +26029 33500 +33877 94750 +55830 93723 +15334 85100 +89061 23221 +11922 77337 +47976 22799 +11635 91933 +75213 24886 +90993 41805 +90684 25891 +72604 76753 +42647 85843 +40408 68133 +75946 51218 +70196 25891 +30412 57914 +97066 18953 +38230 13899 +29377 11580 +75574 72968 +29393 72845 +77297 89211 +16269 94844 +82893 88061 +37116 76838 +80997 20602 +97618 91685 +33698 51410 +61935 12527 +44252 79583 +46297 65424 +21075 15121 +61997 65569 +82784 24455 +32616 50770 +65600 52179 +70762 93723 +33830 14006 +59127 76111 +79111 42235 +14634 65569 +61114 98404 +34701 57155 +66321 32003 +71411 77114 +36070 54003 +44096 31057 +17790 54727 +94384 50770 +55954 71902 +48200 87183 +77912 12527 +68228 18280 +98972 44903 +36198 50770 +38106 65335 +25785 12527 +76187 77603 +23889 85100 +68678 41314 +22106 18953 +24718 77912 +23942 40408 +78992 55995 +69199 55700 +53735 79770 +44697 51111 +32874 28161 +65350 46470 +31226 70249 +25736 68636 +35753 99319 +84252 54258 +28351 73446 +36754 11085 +81734 37763 +20447 86649 +93586 53062 +68321 90392 +60154 94363 +94162 12527 +49437 88536 +36753 77770 +52652 51410 +44124 77727 +41114 39334 +16864 77072 +83149 65132 +59730 54727 +84057 23618 +30656 12284 +92801 37685 +49414 78016 +21932 88727 +83899 99914 +50417 73542 +42247 36961 +11620 12527 +89175 55534 +29239 54727 +52046 39122 +10565 13027 +94606 34488 +80368 51410 +19058 70249 +52560 88727 +94907 94594 +22583 59070 +87045 57573 +81908 66470 +52664 14006 +85444 50714 +79620 41857 +64520 28656 +77565 40408 +54891 79480 +60407 67143 +94156 85508 +78606 12527 +49973 99914 +18848 12527 +16148 13383 +39583 88536 +71135 76625 +15135 88536 +81304 13900 +78906 24249 +70225 84691 +82947 40735 +56886 59761 +87699 68570 +48939 46470 +72665 99460 +29077 13027 +37693 86226 +49023 23978 +14671 63325 +95319 61292 +40288 73784 +40842 70647 +52129 68530 +59166 91619 +21052 11307 +98213 99699 +61504 13900 +27254 99914 +30050 25730 +75338 80979 +91814 16267 +84916 50770 +51427 88782 +51277 82884 +50738 85720 +71902 32003 +61287 54727 +48427 93265 +34807 51980 +56975 96019 +58937 51410 +64930 22005 +72532 55499 +40608 56661 +53656 88727 +62477 96019 +48812 88536 +37482 25188 +32909 71902 +60132 12743 +36648 92407 +26489 46955 +25601 23377 +17624 71902 +69982 63535 +23798 12527 +14088 46470 +79596 12527 +47284 18073 +66594 82908 +47309 21386 +41035 86649 +95662 18222 +19255 70249 +59514 22092 +83736 32111 +19643 64859 +30590 26610 +16132 94311 +61696 45689 +67551 96019 +12741 12527 +78583 25891 +26961 17506 +78162 56028 +80916 83853 +98196 76265 +58308 16344 +40122 58950 +53743 21620 +24428 86026 +78836 73860 +10212 38302 +19115 36550 +15104 93723 +16369 51410 +68786 14006 +43892 40408 +23295 29751 +91988 79020 +20067 54727 +43312 77912 +68147 71902 +13779 32131 +94847 40408 +91423 73498 +69229 13900 +25697 72238 +99306 63294 +66446 48149 +69853 29710 +92750 51625 +81823 55419 +36427 15068 +86459 66813 +48199 81641 +20218 56086 +83018 39032 +72219 50770 +94256 93723 +32003 39207 +47335 14006 +42785 62691 +74560 63579 +27781 86649 +15494 13647 +92404 45629 +84689 85500 +17033 21765 +10332 13027 +35398 79463 +92891 79965 +33833 48986 +55107 99914 +57461 88727 +60916 87668 +79014 20602 +17965 13027 +10123 29710 +36522 46583 +83178 51594 +92593 37792 +38714 21861 +40023 13395 +72206 73081 +36381 75286 +90435 26071 +97471 69336 +97952 40145 +56034 20097 +13292 81538 +20477 50770 +11873 77989 +60247 50523 +67149 48592 +49108 68874 +68890 87402 +40881 94963 +35432 13027 +39476 47915 +90012 54566 +92534 48674 +92032 50770 +27585 79761 +37875 37853 +89774 13027 +61075 15674 +60756 87360 +47898 92766 +96598 68826 +50236 47764 +55057 70249 +54727 17366 +13681 54727 +17072 77525 +42614 90096 +98669 82051 +57089 13900 +18696 54195 +94345 35225 +44841 88536 +38879 23114 +83766 94182 +58826 99914 +41811 85416 +72019 50770 +38976 86649 +42451 59949 +14546 55721 +99835 97560 +49639 30033 +73524 60863 +65556 87850 +96707 58953 +27288 74220 +46483 15656 +72352 96712 +32100 70249 +63167 14314 +16622 95903 +19000 15656 +42483 78654 +54025 76612 +70377 60749 +39261 36106 +21224 96019 +50908 82897 +33035 16572 +96495 31039 +58082 88727 +81593 19590 +35755 54727 +67526 44620 +72752 89000 +83650 17979 +70801 85100 +25664 39700 +44529 12527 +59027 70249 +16374 51410 +80656 73108 +66428 70249 +13405 29710 +24375 51410 +68087 40408 +76117 48681 +94015 65689 +76691 16635 +99054 13378 +30917 90481 +96893 25891 +62567 21627 +94245 10321 +14080 40408 +49942 29710 +27954 25201 +75660 93412 +78795 88727 +77270 88727 +85985 42151 +30119 46470 +24570 15656 +38301 25919 +60012 82323 +17386 61141 +41982 15656 +52502 14428 +40518 16829 +67678 88727 +98468 67870 +58153 18953 +99115 15112 +46175 92280 +76963 70249 +47731 85214 +23760 73422 +67026 30272 +60174 27340 +53612 13317 +54298 88727 +96019 77912 +38623 64924 +64015 99483 +78520 32003 +55419 65046 +16763 77012 +79038 70196 +10821 93823 +21975 92009 +59774 70249 +49520 59948 +23429 74262 +74297 84035 +60268 86649 +97106 70249 +67040 13027 +64952 32110 +28218 14006 +40852 83878 +14006 78414 +71194 95950 +49032 88536 +93565 76366 +87180 54727 +44863 27608 +45305 75367 +92628 30076 +53704 25974 +98469 33452 +59903 54979 +10499 20819 +83104 67143 +96322 65569 +32582 14006 +56098 93723 +94744 60959 +87479 15950 +89231 11601 +50869 70404 +38814 73422 +32132 73422 +74145 35520 +90512 88727 +70617 38209 +58298 48954 +56952 29710 +68984 70249 +72264 56329 +58999 54727 +48633 42365 +56154 57575 +24276 54727 +24166 14006 +43755 59506 +14184 65569 +89299 31443 +44142 46882 +91129 86649 +85560 86681 +64723 14006 +15506 10738 +48493 71902 +66107 48245 +91213 16367 +52172 54762 +57989 56463 +12155 82395 +77388 25091 +43192 47163 +72417 30734 +49430 71902 +70268 85100 +44133 81902 +19946 82107 +39220 51410 +28498 29710 +50770 27829 +95962 15656 +61245 14960 +74434 46710 +21991 30826 diff --git a/day01/sample1.in b/day01/sample1.in new file mode 100644 index 0000000..b8af9ad --- /dev/null +++ b/day01/sample1.in @@ -0,0 +1,6 @@ +3 4 +4 3 +2 5 +1 3 +3 9 +3 3 diff --git a/day01/sol.ivy b/day01/sol.ivy new file mode 100644 index 0000000..c8c233d --- /dev/null +++ b/day01/sol.ivy @@ -0,0 +1,3 @@ +) read "data.ivy" + +a diff --git a/day01/sol.py b/day01/sol.py new file mode 100644 index 0000000..d6350e8 --- /dev/null +++ b/day01/sol.py @@ -0,0 +1,18 @@ +#input = open("sample1.in") +input = open("input") + +nums = [[int(x) for x in line.split()] for line in input] + +# part 1 +a = [x[0] for x in nums] +b = [x[1] for x in nums] +a.sort() +b.sort() +distance = [abs(x-y) for x,y in zip(a,b)] +print(sum(distance)) + +# part 2 +from collections import Counter +c = Counter(b) +scores = [x*c[x] for x in a] +print(sum(scores))