diff --git a/day8/input0.txt b/day8/input0.txt deleted file mode 100644 index 20c6fd2..0000000 --- a/day8/input0.txt +++ /dev/null @@ -1,20 +0,0 @@ -162,817,812 -57,618,57 -906,360,560 -592,479,940 -352,342,300 -466,668,158 -542,29,236 -431,825,988 -739,650,466 -52,470,668 -216,146,977 -819,987,18 -117,168,530 -805,96,715 -346,949,466 -970,615,88 -941,993,340 -862,61,35 -984,92,344 -425,690,689 \ No newline at end of file diff --git a/day8/input1.txt b/day8/input1.txt deleted file mode 100644 index 00d0175..0000000 --- a/day8/input1.txt +++ /dev/null @@ -1,1000 +0,0 @@ -72684,92643,14649 -26210,2364,67790 -84573,71566,22481 -76641,46208,81658 -68380,43507,32460 -86060,12732,47088 -45442,86598,14542 -88586,16892,56419 -55108,83036,27110 -23427,18264,27840 -38765,6904,85430 -82529,52691,4008 -42661,21649,19526 -91433,91853,62629 -86980,3561,34893 -88133,41675,22886 -53284,70099,25666 -11269,40540,4210 -647,75611,96619 -99416,71870,92060 -57287,59219,14228 -65798,83432,88294 -4903,25174,61060 -59873,21306,99589 -79425,62571,15466 -9465,38249,88496 -3036,67217,43260 -32114,78148,2834 -48768,97906,76370 -52947,95296,97269 -94197,93730,26430 -85712,42466,25222 -91344,11463,65451 -86374,95494,28453 -20563,69179,31669 -59675,53731,18156 -45211,71674,61773 -24583,81334,54837 -39088,17612,57823 -65935,16546,96200 -64374,24577,15016 -54462,29711,10663 -24634,10817,21316 -59298,49044,29339 -60227,17915,7022 -5293,87293,19212 -93121,206,8266 -36300,65537,43491 -56262,52764,49748 -44877,32718,81670 -37777,76368,45747 -61769,87040,14622 -39701,5660,12483 -79174,66141,59624 -48750,42522,56821 -95766,83652,22457 -28706,8124,23678 -32083,42714,41358 -10452,59428,97252 -85696,23071,66530 -18708,18871,54367 -41292,99903,35272 -64225,47279,78719 -46411,85079,4213 -69376,63541,73904 -91285,93324,33090 -82163,6896,72917 -15026,6118,91273 -74461,1622,11008 -36121,26311,24151 -15379,70286,8324 -94091,18225,39053 -60310,56451,38787 -42584,95730,80246 -74358,85817,22389 -86026,18098,26592 -61652,75270,89818 -13557,51903,20588 -36404,42411,8521 -39732,43776,54066 -62522,77659,53140 -66375,91604,78234 -95104,1128,2252 -35949,95815,8165 -88937,75266,89507 -30761,38384,34431 -7236,22212,23173 -6867,37593,47894 -32421,68323,52890 -64433,68206,44917 -14955,96321,28292 -35955,64823,57760 -39538,27238,27166 -35311,76120,23406 -35453,35529,24086 -1133,90171,55872 -53363,74861,77678 -90454,52499,60625 -99650,82432,25281 -85749,36041,68748 -55040,88350,1740 -81568,7542,73056 -67829,13874,70702 -81912,31869,78405 -55163,22578,12656 -82498,98468,91499 -58492,63484,4050 -86457,34459,26405 -89476,20632,54145 -58086,34060,5956 -50735,58417,79356 -45151,17527,94435 -5858,64236,60493 -97861,51108,86910 -87192,58673,47679 -31843,44536,21641 -634,38081,19971 -39139,32758,53561 -39581,30681,49387 -69601,55362,20241 -93283,39549,81139 -78349,11613,73024 -50941,63091,62587 -65884,69174,97352 -77247,78840,53184 -18061,23668,60094 -35275,4732,15794 -66364,63162,21563 -69224,45766,80395 -60710,41340,30319 -67174,39614,46047 -47001,8170,6521 -4400,97544,28691 -34098,64893,8259 -419,8737,92344 -93522,79836,44178 -5936,68032,68625 -93223,26941,42958 -8196,94906,39386 -35871,68046,60512 -44879,51207,7838 -67869,11101,61378 -79525,36202,35158 -54076,52257,94538 -13763,51126,48199 -24960,85806,42379 -51291,62054,75655 -84837,17979,4735 -61662,64591,74125 -53247,51113,5717 -16010,19009,94786 -86043,56108,77999 -89383,11464,22298 -99204,19598,36336 -58404,91399,91963 -52299,6239,76839 -25887,7977,16373 -35655,42371,50243 -24021,25551,34664 -78739,95104,87361 -6895,89912,48697 -6836,24093,17817 -68686,39477,60008 -95273,48168,80136 -45817,1596,53522 -98224,83960,99059 -35404,77887,75538 -8696,55447,29159 -28466,31993,89960 -39146,35989,85900 -35395,43764,93478 -7458,90146,41686 -15285,76722,58997 -78173,15700,53959 -1171,71687,79131 -82529,71794,79038 -97776,52471,36186 -22655,41480,82548 -33615,78013,18077 -68690,44340,20714 -14948,73512,53198 -6002,98464,31250 -82782,32154,9723 -2302,87288,71030 -87692,96102,98042 -7200,99525,38817 -54583,76252,88593 -6462,40140,90226 -19741,20465,88037 -21418,47718,9747 -31502,63317,48229 -3848,45486,86266 -50107,25258,99712 -12066,25516,10076 -22406,11151,16549 -38248,16652,69333 -35488,85638,48532 -23080,91423,94735 -36761,14725,34524 -97839,50469,9136 -76463,72819,99482 -48647,11039,6521 -40955,6412,81563 -32055,40157,52849 -93832,73589,762 -43993,67328,14020 -11749,13064,28551 -17674,61523,31663 -44027,20728,13628 -58822,45547,7633 -68174,14663,34668 -41863,95595,70494 -49559,15722,98217 -4188,6090,36613 -55433,14263,71892 -18882,41723,49278 -21323,1399,76506 -92012,39154,44911 -710,37308,68856 -70910,58264,35002 -29107,9225,49503 -97509,80065,6580 -76976,27719,3819 -77441,8678,34795 -54719,23993,76634 -21450,33064,19211 -24361,39592,76302 -98755,30676,85867 -46793,89526,11958 -3495,13850,68887 -34016,51346,84489 -85136,18779,20236 -75019,21114,81881 -14713,41377,75779 -83551,66822,96373 -8252,66995,16814 -46682,2608,22513 -40628,31097,95391 -79925,51519,47535 -69468,51510,74821 -21869,73668,28716 -32694,13614,26654 -61481,66720,27145 -12201,3442,28200 -22222,61259,711 -31482,2815,41072 -98865,68095,31317 -63481,81421,37010 -27989,71281,74166 -48026,98795,33992 -20529,85034,3655 -61161,72482,78129 -60432,33923,44839 -78020,45958,33016 -45061,72867,35927 -56087,39438,51917 -42097,28600,24836 -37769,92819,13692 -94760,60680,36110 -67530,72524,85411 -61383,1154,12541 -70119,64293,38854 -74660,4794,60114 -80489,63799,55803 -65532,12721,7457 -15824,61081,86374 -53053,2599,50549 -6482,92995,63770 -97126,23065,32062 -71876,25862,77517 -64947,47286,88808 -47254,23761,36489 -33197,43709,29905 -28026,47974,92293 -62397,83356,83172 -51724,57340,39887 -96981,91304,29444 -48788,33265,23115 -56338,1557,27830 -99360,66519,82678 -84348,8761,457 -37298,13861,98236 -76320,34237,47607 -73259,43404,27838 -78183,91117,80505 -14179,64111,12636 -27733,45698,17589 -59258,89480,16087 -43106,81084,26307 -77485,78512,57702 -53194,73139,21822 -65471,72036,99408 -82449,73032,4373 -85471,39608,99901 -25240,51708,2236 -52488,75989,78149 -62207,56926,99933 -52664,97752,40890 -73320,40061,88227 -86816,20471,3532 -29857,29452,7605 -49993,19148,1817 -8168,62006,84707 -28870,53101,17734 -76655,18399,3898 -3712,57184,28028 -72237,55269,6672 -77295,17116,48729 -61703,89160,64609 -45942,18118,58433 -54355,3328,61507 -60540,34711,97934 -66286,95886,20995 -55836,33367,58529 -40603,52487,5625 -76585,8905,69972 -13642,82267,81090 -66988,4805,75734 -79570,38973,3802 -76313,2566,8410 -38148,41801,27406 -99528,48708,49252 -58286,73488,41785 -94362,61146,55766 -39393,89549,32682 -98685,50371,39271 -72617,30448,33552 -93898,51164,35109 -10749,37299,71592 -43044,31566,37818 -31963,41450,2646 -84794,53092,12515 -91444,83292,77885 -29181,96377,34894 -35393,80517,1426 -12808,35356,1149 -7038,87712,71494 -91552,58259,10258 -49583,69996,91404 -80951,93255,40996 -68293,36477,19758 -83157,20412,41880 -57327,62977,53882 -99080,97135,93683 -11382,93283,48564 -71227,95668,27499 -38136,64435,98025 -83081,33674,20930 -55960,71478,17890 -84291,70423,53907 -94160,37042,21428 -35150,4167,75999 -30446,32754,27426 -55535,71764,70592 -29610,66002,46875 -96717,25674,41328 -15048,19767,28826 -55441,48845,49839 -3719,92044,30255 -11755,26120,78477 -66283,28192,48820 -10310,22696,93426 -69497,59203,11625 -35604,8356,28928 -29112,95993,7098 -81620,98406,796 -14463,3079,5749 -17319,93277,68507 -9176,38214,68651 -41594,94925,30440 -93346,24493,57722 -89457,74017,35384 -93461,12460,28298 -36210,38748,19970 -7787,55265,39761 -24752,63872,38174 -21887,46528,72777 -33714,95471,65382 -1898,46843,26364 -75079,52755,15501 -22289,57728,76104 -37304,7600,35596 -23739,60654,44863 -35439,89462,87119 -97741,10870,40959 -9915,46693,33221 -55572,40107,68320 -69562,29501,77576 -67470,95366,22778 -49149,25177,30316 -55559,19572,57561 -69505,66379,41626 -3297,3357,44825 -35637,98141,61751 -31707,13646,2330 -78795,44640,3607 -13944,91247,98796 -99968,92361,56688 -97427,11131,89665 -97027,18026,85390 -23884,42935,4268 -45554,50811,18204 -35300,20297,95934 -67224,9580,26192 -85043,89663,85251 -78204,72020,14470 -30534,14934,61090 -69792,81393,46353 -84706,99590,88104 -20874,48844,44159 -73287,71710,36660 -56972,70643,22577 -56488,29688,72529 -94276,88432,60566 -75334,67620,78307 -37515,71702,87142 -21434,38372,28143 -73238,90319,39564 -93461,88473,78309 -95887,78617,44133 -39930,23793,10494 -54472,12325,17141 -2351,43984,50521 -16143,71368,84306 -22383,69040,20955 -5666,2223,93427 -52139,68111,10949 -95029,67083,41892 -56072,10673,29048 -87384,78425,47420 -80327,22755,60337 -18916,33790,53461 -59406,74263,18744 -19562,15010,54988 -9554,4190,13765 -46276,10317,75394 -73276,43531,33404 -91576,8683,82070 -48853,51968,27262 -63293,8551,83840 -66484,5809,59571 -19686,59394,94705 -58680,74207,7532 -50449,21112,3153 -40478,83797,75764 -35725,87478,1816 -32722,67969,20865 -28708,82593,86474 -13799,64046,58053 -36298,92079,19354 -71822,32795,27791 -92857,38279,74374 -39465,55149,14057 -67380,45661,95721 -61243,91827,35274 -60710,11320,70273 -35324,38093,79843 -99757,99998,91136 -21020,63060,13926 -55371,5231,91987 -94542,53055,2780 -78700,65485,32495 -1956,89329,89824 -53576,14412,61255 -23451,15217,44051 -80632,21979,25125 -99044,42200,82709 -12649,81606,98796 -51540,67177,81918 -56158,74951,78590 -55459,59945,32501 -63747,65277,39708 -75440,80747,41 -10007,3464,77376 -26290,5834,92130 -54125,29973,29738 -97605,77889,42579 -76140,99148,87756 -14729,46561,30758 -37336,92650,83115 -15758,12340,7472 -89590,67629,11285 -4440,25556,99271 -40473,9118,2821 -85044,31061,54171 -71659,15735,60860 -16772,698,48042 -51518,49851,56370 -75771,3207,26819 -10163,89794,34576 -68988,12219,74639 -71477,37334,93731 -39496,43,58498 -6211,55305,89766 -21864,89296,73748 -42127,46255,29229 -21289,17244,27228 -34073,76430,92554 -58398,98993,62045 -66467,81671,62477 -79634,9360,84222 -92763,17813,2814 -86512,80710,23977 -84201,81398,21792 -3149,11857,4373 -24435,20453,90415 -68242,95962,28772 -96232,50156,163 -17938,39071,6902 -4082,9893,3866 -37111,95860,80593 -70921,41571,52990 -25824,95375,29648 -21730,57603,88407 -19228,66937,508 -30083,7002,8268 -84045,23799,86883 -47614,6462,87231 -47438,45423,86172 -47011,28991,34762 -55699,41861,1337 -94058,76965,39870 -81365,87477,30338 -83256,33346,38878 -18544,2280,33894 -27120,22895,97951 -78728,80629,96883 -10200,13295,44145 -1680,38974,77077 -84602,1240,15342 -19312,73265,90220 -68381,17791,12331 -25791,62125,72992 -83993,51332,91043 -55991,63864,14232 -98728,24079,16924 -96222,94262,35026 -49125,49391,75939 -56033,20045,96919 -69991,82259,88570 -49433,60049,21855 -3928,66365,24248 -28541,15765,69778 -34169,41610,39790 -84666,71814,38560 -17448,25626,26114 -93454,70265,92288 -73328,29249,304 -43797,80405,33944 -89109,41369,96651 -96436,17857,24577 -86956,90559,73135 -94883,74677,66177 -25805,44365,89639 -79623,17355,90053 -87727,36472,59579 -58125,24225,16162 -32574,37156,20255 -77544,44031,67013 -77057,98771,13667 -7822,28783,14422 -51887,997,13367 -72175,76237,77935 -10853,24227,24980 -28914,97244,92926 -89621,29413,83175 -42434,60241,49109 -14092,49561,4924 -82416,61312,87270 -41072,32657,10755 -17533,88263,24982 -82872,79505,63928 -88140,88540,61394 -21399,30557,31587 -56079,69828,92052 -20003,31916,24626 -5625,527,50316 -40987,82125,11625 -44241,90116,89354 -79380,38929,63868 -42208,1416,64661 -87795,35156,62842 -36578,91727,16835 -62994,78242,20410 -40010,55049,52434 -62037,81158,85821 -57258,59617,51662 -88437,10036,37193 -57722,15075,1301 -90720,75992,84470 -71625,40527,15313 -64002,73915,30102 -27337,58402,1277 -53871,7184,56636 -17747,56459,13030 -10586,47262,27776 -5975,19391,90437 -14627,20125,52752 -23461,31006,70914 -16339,26894,9063 -77029,89324,22032 -32009,39221,14836 -49,3001,95680 -10989,95146,61823 -68109,75720,21858 -78839,60957,60601 -2276,55235,66375 -85416,99055,95478 -23160,99968,31324 -4997,45293,86070 -34036,99166,66675 -40099,66870,92517 -87373,14237,40248 -5790,73368,97271 -96811,77691,78528 -28637,23642,74627 -72768,2536,19924 -40372,74265,93171 -66907,36271,72768 -23293,41156,66513 -73777,82639,41678 -20661,94367,52119 -18913,63093,57122 -95497,65342,55187 -91866,80243,59167 -67677,177,90522 -13743,67304,25985 -902,34903,90855 -19627,12385,98814 -31292,71508,81268 -46238,92745,16002 -34908,21055,44615 -83384,716,26499 -48411,76593,30179 -10767,5741,15570 -77891,42587,1241 -72067,66707,79102 -92329,85486,99418 -50450,10230,6402 -3590,18980,85560 -46482,2353,48835 -39284,61356,42348 -30691,79739,77303 -34675,1840,99438 -14142,45960,36594 -4985,63952,99675 -40204,63207,55487 -8187,78309,40972 -51606,79862,76352 -81837,94803,12581 -94633,87915,50241 -40218,39615,39541 -1176,43368,56243 -83486,91578,41204 -36432,99169,62842 -8106,47271,6711 -3067,33308,27710 -1078,14477,99283 -74327,93626,17530 -62621,62142,71945 -98337,5131,53386 -77443,82697,91249 -90561,69070,87618 -36557,56288,32861 -76330,10286,94316 -97833,80885,68903 -8119,86730,77283 -37623,96695,17882 -10187,19541,14281 -55366,90619,48048 -90574,97036,92226 -95332,61835,82598 -75725,78883,7757 -80994,91948,47607 -83496,82049,80442 -90842,75886,21621 -60929,66510,94685 -32136,41293,40835 -57342,46954,59177 -31479,14096,32940 -70190,41124,41186 -61993,68258,10066 -56487,10372,11363 -37548,64025,40935 -56098,63444,42741 -44922,18741,38422 -68554,8727,59373 -73692,6715,9846 -73685,65320,69577 -12629,8122,55274 -90987,26748,35689 -77087,86483,52947 -28989,51169,14364 -85308,94552,39236 -18407,76175,28479 -42679,62803,28297 -71558,72318,83747 -33481,75658,21203 -2445,73021,99273 -74922,80121,38483 -26023,94884,79528 -35378,63953,43794 -85424,46877,49089 -30339,63028,54999 -52041,88112,74827 -87218,51543,94061 -97148,19286,98068 -97585,16865,64557 -16303,33670,89156 -32072,91733,68345 -33807,45594,15339 -66835,7937,27011 -16243,95949,55237 -50346,33926,48337 -16568,84692,3359 -72260,22733,34270 -2495,85349,38872 -97152,41819,62645 -10357,47766,29882 -143,74493,75739 -92546,36162,60482 -10124,42451,49614 -44708,24968,20053 -70714,60024,63151 -59803,24461,59488 -59801,70994,57592 -98193,76110,79709 -67309,45275,26662 -18077,85362,53701 -58036,2391,68722 -62437,99568,40303 -91817,56641,96113 -97456,22799,71597 -61894,29043,34441 -58306,79531,5532 -49925,78798,51578 -87040,71044,23248 -904,43005,88652 -662,7460,13460 -22635,67587,44667 -62303,4783,69609 -15301,85440,53294 -34739,85626,84484 -37275,54688,40501 -70024,3638,97501 -66211,40625,3679 -97010,9909,10909 -18567,46278,6442 -71197,85847,73242 -42622,36759,30137 -16708,35096,97695 -53497,58378,28383 -73536,17562,24573 -4450,48877,68783 -11366,22418,58542 -9084,35055,47436 -70191,80608,81053 -60000,97672,19788 -47480,72558,65411 -92060,22978,88211 -29433,64523,33758 -68883,68004,24751 -63721,97302,59271 -45669,29020,11165 -16430,9722,48878 -9461,6091,91805 -36330,13416,12360 -6244,63108,48989 -59083,15228,73823 -78194,73704,86970 -16318,74581,77553 -63732,62289,28402 -55380,30776,48717 -1758,78956,65312 -23939,88586,99893 -33078,19297,81526 -3526,97131,77473 -7223,29935,93519 -12306,85854,43307 -78129,12296,73717 -22421,39188,61047 -72176,46156,41137 -40959,3168,76720 -34501,62285,50647 -92959,9971,65981 -66540,48616,56576 -65786,72,90716 -54397,23098,27609 -55868,29963,95566 -45150,66071,60242 -4139,43077,27462 -34661,22922,95131 -91351,47635,65703 -77609,77007,17143 -52266,49578,1573 -27142,13434,38304 -98310,18615,18794 -75915,44404,87837 -41106,73219,61540 -74527,42003,42897 -89198,90892,91333 -33883,55651,93265 -19771,96944,28303 -73814,16686,66000 -43281,93229,24630 -41488,18619,86938 -51089,2502,34268 -40579,47459,49889 -92950,36165,75612 -52054,70766,49255 -45468,87811,9631 -16301,41931,15054 -37327,34594,50045 -46468,65654,42745 -84630,64889,10840 -2395,18980,4225 -25359,77312,10705 -677,72388,36596 -84895,59507,96489 -26806,4284,27329 -56083,69811,39179 -31968,87318,98009 -19641,16390,33685 -29371,87080,17609 -98975,75885,76348 -73796,86380,44490 -10041,76780,35406 -16715,4410,40403 -31806,80507,49599 -16681,43521,83080 -38980,61708,83720 -79010,85138,43525 -26198,25436,66994 -6516,2266,39430 -34188,41927,20601 -20166,27486,19927 -25209,61707,18449 -3969,17518,58732 -78720,48068,77923 -41691,97476,83728 -85220,66762,94648 -67865,1206,53102 -42960,7326,22316 -80289,49198,34745 -92981,84315,35393 -58848,77106,74092 -55085,88245,27863 -12056,25041,58786 -23050,93446,15696 -22039,17436,27038 -36329,57124,36656 -75037,56123,94485 -13705,87594,97588 -21972,71503,55411 -22576,28611,38307 -66509,46575,16395 -60059,56067,78167 -26253,40913,73550 -96245,21083,3597 -3096,77457,144 -51630,81612,44991 -78530,29743,86309 -72162,9827,94309 -57923,80847,5607 -7049,87850,86083 -72547,70311,3388 -60164,45720,6469 -13513,98587,8639 -5592,33002,37816 -9208,90741,41359 -88092,88207,81143 -14408,5422,57244 -84189,59472,29593 -19951,78793,17791 -83381,96903,94447 -23176,15543,90136 -23819,54241,928 -84929,19002,20115 -83781,99603,94490 -6567,57033,10789 -7173,7272,54649 -98783,28005,14103 -21207,4621,92701 -72307,16149,18911 -28981,6365,52474 -34051,36654,14648 -61322,89332,45445 -4032,98413,52428 -90336,66770,56599 -92255,42511,82831 -44927,65064,77655 -91933,20231,17256 -85143,15508,76991 -91095,49177,3257 -87334,40486,14543 -78610,10908,26023 -94233,91463,46356 -68647,70942,56508 -19076,47746,11328 -84151,89110,38780 -62130,85696,62470 -24168,25864,98636 -93568,95630,13648 -98275,93302,82799 -86827,84740,72720 -47090,17976,94982 -3992,4081,94395 -2427,39454,89910 -84922,54298,98300 -83722,73,32 -25480,87723,79242 -70882,4174,55849 -21255,38423,81480 -40813,47055,60752 -55211,94857,8461 -93270,90974,41993 -73629,14088,54576 -26895,69126,81407 -81232,8709,7376 -85611,75039,85461 -95786,86618,68622 -17914,5286,87205 -41929,39892,68358 -5253,32844,47326 -3631,87775,91987 -10328,408,92666 -74815,44356,94337 -31293,390,58281 -77455,67795,76314 -2262,92300,55569 -20673,8018,91753 -25038,46005,22067 -11747,31495,87875 -10693,12425,10153 -6096,78276,30862 -45315,93857,10568 -42452,40025,46638 -86632,12986,14986 -55619,10623,4743 -84917,50342,92946 -70022,65698,62359 -63460,68324,86215 -69812,63461,99081 -89425,5080,32679 -72704,52706,21201 -59255,96935,78609 -63753,79723,33534 -64064,43563,19878 -58508,55122,51353 -31728,15928,11490 -61559,64696,95413 -12180,91528,76964 -43137,22352,80654 -44380,68471,49111 -37229,16272,67768 -48176,38609,39469 -14154,6711,21324 -71170,70303,43506 -34776,8172,59086 -4358,67022,12387 -65423,26896,59646 -31349,59000,39189 -75896,26111,90486 -94713,51035,89014 -68967,32272,54333 -79541,22472,53438 -10478,29807,50241 -97113,35456,82161 -19794,46791,23627 -62499,45744,61756 -2867,64636,13644 -80294,41832,6952 -10972,97309,25001 -98587,90815,70027 -92977,64451,5577 -6552,41760,54166 -67880,77538,70457 -35314,86685,36254 -83116,84501,64077 -6328,49069,43414 -20725,180,33554 -56261,28017,48065 -57023,59239,21883 -83405,59627,59076 -74307,9450,33971 -41426,45545,54871 -76397,97986,60001 -10096,85302,49892 -84453,27141,39881 -29602,61980,2779 -77731,13356,27279 -32438,4216,3071 -78847,69162,21339 -17470,19304,33022 -49223,50115,78651 -52994,26085,60473 -33065,81015,39603 -51178,61408,19655 -16170,13178,77943 -25093,80117,62120 \ No newline at end of file diff --git a/day8/main.go b/day8/main.go deleted file mode 100644 index dce3cfa..0000000 --- a/day8/main.go +++ /dev/null @@ -1,208 +0,0 @@ -package main - -import ( - "fmt" - "os" - "slices" - "strconv" - "strings" - - "github.com/dominikbraun/graph" -) - -func readLines(filename string) []string { - raw, err := os.ReadFile(filename) - if err != nil { - panic(err) - } - return strings.Split(string(raw), "\n") -} - -// input1 80446 -func main() { - filename := "input0.txt" - if len(os.Args) > 1 { - filename = os.Args[1] - } - lines := readLines(filename) - p := parsePlayground(lines) - circuits, err := p.wireClosest(1000) - if err != nil { - panic(err) - } - counts := map[uint]uint{} - for _, circuit := range circuits { - counts[circuit]++ - } - totals := []uint{} - for _, v := range counts { - totals = append(totals, v) - } - slices.Sort(totals) - slices.Reverse(totals) - fmt.Printf("%v\n", totals[0]*totals[1]*totals[2]) - xx, err := p.wireAll() - if err != nil { - panic(err) - } - fmt.Printf("%d\n", xx) -} - -func parsePlayground(lines []string) playground { - p := playground{ - boxes: []box{}, - distances: graph.New(boxHash, graph.Weighted()), - } - for _, line := range lines { - parts := strings.Split(line, ",") - b := box{line: line} - b.x, _ = strconv.Atoi(parts[0]) - b.y, _ = strconv.Atoi(parts[1]) - b.z, _ = strconv.Atoi(parts[2]) - _ = p.distances.AddVertex(b) - for _, c := range p.boxes { - _ = p.distances.AddEdge(b.line, c.line, graph.EdgeWeight(b.distanceTo(c))) - } - p.boxes = append(p.boxes, b) - } - return p -} - -func (p *playground) wireClosest(n uint64) (map[string]uint, error) { - edges, err := p.distances.Edges() - if err != nil { - return nil, err - } - slices.SortFunc(edges, func(e1, e2 graph.Edge[string]) int { - return e1.Properties.Weight - e2.Properties.Weight - }) - nextCircuit := uint(1) - circuits := map[string]uint{} - for i := range n { - edge := edges[i] - sourceCircuit := circuits[edge.Source] - targetCircuit := circuits[edge.Target] - if sourceCircuit == 0 && targetCircuit == 0 { - circuits[edge.Source] = nextCircuit - circuits[edge.Target] = nextCircuit - nextCircuit++ - continue - } - if sourceCircuit == 0 { - circuits[edge.Source] = targetCircuit - continue - } - if targetCircuit == 0 { - circuits[edge.Target] = sourceCircuit - continue - } - if sourceCircuit == targetCircuit { - continue - } - for k, v := range circuits { - if v == targetCircuit { - circuits[k] = sourceCircuit - } - } - } - return circuits, nil -} - -func (p *playground) wireAll() (int, error) { - edges, err := p.distances.Edges() - if err != nil { - return 0, err - } - slices.SortFunc(edges, func(e1, e2 graph.Edge[string]) int { - return e1.Properties.Weight - e2.Properties.Weight - }) - circuitsInUse := 0 - nextCircuit := uint(1) - circuits := map[string]uint{} - for _, edge := range edges { - sourceCircuit := circuits[edge.Source] - targetCircuit := circuits[edge.Target] - if sourceCircuit == 0 && targetCircuit == 0 { - circuits[edge.Source] = nextCircuit - circuits[edge.Target] = nextCircuit - nextCircuit++ - circuitsInUse++ - continue - } - if sourceCircuit == 0 { - circuits[edge.Source] = targetCircuit - if circuitsInUse == 1 { - count, _ := p.distances.Order() - if count == len(circuits) { - v1, _ := p.distances.Vertex(edge.Source) - v2, _ := p.distances.Vertex(edge.Target) - return v1.x * v2.x, nil - } - } - continue - } - if targetCircuit == 0 { - circuits[edge.Target] = sourceCircuit - if circuitsInUse == 1 { - count, _ := p.distances.Order() - if count == len(circuits) { - v1, _ := p.distances.Vertex(edge.Source) - v2, _ := p.distances.Vertex(edge.Target) - return v1.x * v2.x, nil - } - } - continue - } - if sourceCircuit == targetCircuit { - if circuitsInUse == 1 { - count, _ := p.distances.Order() - if count == len(circuits) { - v1, _ := p.distances.Vertex(edge.Source) - v2, _ := p.distances.Vertex(edge.Target) - return v1.x * v2.x, nil - } - } - continue - } - for k, v := range circuits { - if v == targetCircuit { - circuits[k] = sourceCircuit - } - } - circuitsInUse-- - if circuitsInUse == 1 { - count, _ := p.distances.Order() - if count == len(circuits) { - v1, _ := p.distances.Vertex(edge.Source) - v2, _ := p.distances.Vertex(edge.Target) - return v1.x * v2.x, nil - } - } - } - v, _ := p.distances.Order() - return 0, fmt.Errorf("exhausted edges without reaching full connectivity %v", v) -} - -type playground struct { - boxes []box - distances graph.Graph[string, box] -} - -func boxHash(b box) string { - return b.line -} - -type box struct { - line string - x int - y int - z int -} - -func (b box) distanceTo(c box) int { - x := c.x - b.x - y := c.y - b.y - z := c.z - b.z - // no need to sqrt since we only care about relative distances - return x*x + y*y + z*z -} diff --git a/go.mod b/go.mod index 81eef9b..0602399 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,6 @@ module ballstads.name/aoc2025 go 1.25.5 require ( - github.com/dominikbraun/graph v0.23.0 // indirect github.com/kelindar/bitmap v1.5.3 // indirect github.com/kelindar/simd v1.1.2 // indirect github.com/klauspost/cpuid/v2 v2.2.4 // indirect diff --git a/go.sum b/go.sum index 41aa0a2..2f6de97 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,3 @@ -github.com/dominikbraun/graph v0.23.0 h1:TdZB4pPqCLFxYhdyMFb1TBdFxp8XLcJfTTBQucVPgCo= -github.com/dominikbraun/graph v0.23.0/go.mod h1:yOjYyogZLY1LSG9E33JWZJiq5k83Qy2C6POAuiViluc= github.com/kelindar/bitmap v1.5.3 h1:/ty1SvbLE5ZKO4ToFNeXe3P3RrQsoj4a0x5gZNp5Vzo= github.com/kelindar/bitmap v1.5.3/go.mod h1:j3qZjxH9s4OtvsnFTP2bmPkjqil9Y2xQlxPYHexasEA= github.com/kelindar/simd v1.1.2 h1:KduKb+M9cMY2HIH8S/cdJyD+5n5EGgq+Aeeleos55To=