diff --git a/day22/c/day22 b/day22/c/day22 new file mode 100755 index 0000000..3cb360d Binary files /dev/null and b/day22/c/day22 differ diff --git a/day22/c/day22.c b/day22/c/day22.c new file mode 100644 index 0000000..f088df9 --- /dev/null +++ b/day22/c/day22.c @@ -0,0 +1,189 @@ +#include +#include +#include +#include +#include + +#define CHARS_MAX 64 +#define MAX_BUYERS 8*1024 +#define GENERATION 2000 + +typedef struct node { + struct node *children[19]; + uint64_t value; + char key; + uint8_t is_leaf; +} node_t; + +node_t* create_node() { + node_t *node = calloc(1, sizeof(node[0])); + return node; +} + +node_t* search(node_t* root, int8_t* word, int len) { + node_t* node = root; + for (int i = 0; i < len; i++) { + if (node->children[word[i] + 9] == NULL) { + return NULL; + } + node = node->children[word[i] + 9]; + } + return node; +} + +void insert(node_t* root, int8_t* word, int len, uint64_t value) { + node_t* node = root; + for (int i = 0; i < len; i++) { + if (node->children[word[i] + 9] == NULL) { + node->children[word[i] + 9] = create_node(); + } + node = node->children[word[i] + 9]; + } + node->value = value; + node->is_leaf = 1; +} + +void free_node(node_t* node) { + for (int i = 0; i < 19; i++) { + if (node->children[i] != NULL) { + free_node(node->children[i]); + } + } + + free(node); +} + +uint64_t generate_new_secret(uint64_t); +uint64_t mix(uint64_t, uint64_t); +uint64_t prune(uint64_t); + +int main() { + char *p, *buf, c; + + buf = calloc(CHARS_MAX, sizeof(char)); + p = buf; + + uint64_t *secrets = calloc(MAX_BUYERS, sizeof(secrets[0])); + int secret_count = 0; + + while ((c = getchar()) != EOF) { + *p++ = c; + if (c != '\n') { + continue; + } + + sscanf(buf, "%lu", &secrets[secret_count++]); + + memset(buf, 0, CHARS_MAX); + p = buf; + } + free(buf); + + uint64_t sum = 0; + uint64_t **prices = calloc(secret_count, sizeof(prices[0])); + for (int i = 0; i < secret_count; i++) { + prices[i] = calloc(GENERATION + 1, sizeof(prices[0][0])); + prices[i][0] = secrets[i] % 10; + for (int j = 0; j < GENERATION; j++) { + secrets[i] = generate_new_secret(secrets[i]); + prices[i][j+1] = secrets[i] % 10; + } + sum += secrets[i]; + } + printf("%lu\n", sum); + + free(secrets); + + // Calculate diffs + int8_t **diffs = calloc(secret_count, sizeof(diffs[0])); + for (int i = 0; i < secret_count; i++) { + diffs[i] = calloc(GENERATION, sizeof(diffs[0][0])); + for (int j = 0; j < GENERATION; j++) { + diffs[i][j] = (int8_t)prices[i][j+1] - (int8_t)prices[i][j]; + } + } + + int8_t (**sequences)[4] = calloc(secret_count, sizeof(int8_t(*)[4])); + for (int i = 0; i < secret_count; i++) { + sequences[i] = calloc(GENERATION - 4, sizeof(int8_t[4])); + for (int j = 0; j < GENERATION-4; j++) { + sequences[i][j][0] = diffs[i][j]; + sequences[i][j][1] = diffs[i][j+1]; + sequences[i][j][2] = diffs[i][j+2]; + sequences[i][j][3] = diffs[i][j+3]; + } + free(diffs[i]); + } + free(diffs); + + node_t *root = calloc(1, sizeof(node_t)); + + uint64_t max_bananas = 0; + for (int i = 0; i < secret_count; i++) { + for (int j = 0; j < GENERATION - 4; j++) { + int8_t pattern[4]; + memcpy(pattern, sequences[i][j], sizeof(sequences[0][0])); + + node_t *node = search(root, pattern, 4); + + if (node != NULL && node->is_leaf) { + continue; + } + + // Count bananas + uint64_t bananas = 0; +#pragma omp parallel for + for (int k = 0; k < secret_count; k++) { + for (int l = 0; l < GENERATION - 4; l++) { + if (memcmp(pattern, sequences[k][l], sizeof(sequences[0][0]))) { + continue; + } + +#pragma omp critical + { + bananas += prices[k][l+4]; + } + break; + } + } + + insert(root, pattern, 4, bananas); + + if (bananas > max_bananas) { + max_bananas = bananas; + } + } + } + + printf("%lu\n", max_bananas); + + + for (int i = 0; i < secret_count; i++) { + free(prices[i]); + free(sequences[i]); + } + + free_node(root); + free(prices); + free(sequences); +} + +uint64_t generate_new_secret(uint64_t secret) { + uint64_t new_secret = secret; + // 1 + new_secret = prune(mix(new_secret, new_secret * 64)); + // 2 + new_secret = prune(mix(new_secret, new_secret / 32)); + // 3 + new_secret = prune(mix(new_secret, new_secret * 2048)); + + return new_secret; +} + +uint64_t mix(uint64_t secret, uint64_t value) { + return secret ^ value; +} + +uint64_t prune(uint64_t secret) { + return secret % 16777216; +} diff --git a/day22/input.txt b/day22/input.txt new file mode 100644 index 0000000..4f263d8 --- /dev/null +++ b/day22/input.txt @@ -0,0 +1,2179 @@ +10091473 +2800582 +4897680 +2283185 +8888032 +10607323 +15832218 +868773 +13129906 +9875502 +14841768 +12596734 +6108060 +6741350 +9427286 +6965970 +13475724 +3978765 +9116257 +6711992 +13191638 +14368456 +13875595 +15013298 +13386833 +4675257 +13642603 +13984865 +2305622 +11616054 +13549711 +3549450 +3826901 +13814088 +4184486 +4262959 +10625020 +13775591 +7394479 +13433066 +6474929 +9212356 +11214974 +16488105 +9162268 +12289985 +2750726 +14696342 +13471390 +12580770 +7006769 +2820751 +13615074 +11350171 +558095 +5415520 +7452267 +11619957 +6819195 +8069070 +16694708 +3322811 +6001966 +11445762 +6970904 +9829699 +12245157 +7448267 +8066265 +4826042 +12984034 +12540818 +16099394 +16634471 +11444085 +7529940 +15646030 +9143167 +8738541 +705670 +11651449 +6259565 +14185716 +14993414 +15665442 +13107065 +10209569 +14397926 +11231640 +670163 +4840849 +7427687 +1610800 +15663044 +9741586 +2938926 +13299131 +3718945 +10017173 +2539929 +9022106 +9855084 +6892134 +8910580 +2298609 +11942972 +928607 +16334801 +12274653 +595563 +3691275 +15354067 +2550092 +4362597 +14758007 +9384059 +7950300 +10564001 +7800311 +849331 +9848412 +855497 +4196319 +10900552 +12124856 +2458978 +5978317 +980720 +12340673 +10731293 +5706663 +226806 +6867935 +13814479 +5140999 +2605686 +411106 +2077475 +10102601 +11836825 +9118744 +5949860 +7477493 +14755664 +7591541 +9393796 +1435568 +447934 +3358213 +949667 +5237820 +2296776 +5271010 +12164604 +6882697 +2729761 +9589718 +8144975 +840484 +15938192 +8491563 +8181807 +1772980 +16366934 +2591912 +2820125 +11798879 +8245784 +7559534 +9365538 +6918002 +14001188 +4447061 +1599436 +7626896 +2334335 +601503 +1456569 +2116408 +6634201 +9639965 +13361675 +13696588 +16706631 +1922711 +459568 +6815914 +16013438 +779777 +14077723 +6461645 +7325517 +4820244 +8345590 +16598452 +8595727 +9221165 +16669597 +12697624 +3555076 +2625725 +275156 +12555340 +1903017 +613191 +15892782 +16137423 +4243099 +1925850 +16772815 +15495112 +11605728 +3175946 +15532810 +14219629 +11537667 +13164232 +3516336 +3876425 +12336664 +15836161 +9374299 +9127462 +16483938 +9826507 +3189925 +2704959 +5730338 +13657275 +3491671 +8229668 +9324052 +7906150 +12685522 +15885175 +8360179 +12724575 +3241455 +981100 +3493289 +16556733 +2324316 +13843126 +5893561 +14129656 +9752104 +4853262 +1784580 +13741370 +6945215 +3974749 +2056223 +16571207 +11616720 +16036596 +12440860 +8892402 +5667056 +2763272 +5493518 +4120975 +881339 +10316797 +9477220 +1017093 +7260961 +11280057 +9935530 +11832359 +5178938 +262311 +7577979 +7696763 +4262316 +4635759 +786154 +15033647 +9987050 +16115200 +5581338 +12982217 +14468095 +13459902 +14054790 +9793610 +12453783 +5891104 +8593883 +8625047 +12783094 +2395480 +15095190 +4944565 +2643792 +11873756 +2554330 +1649375 +573851 +1638658 +3493023 +10718874 +7432297 +11197951 +8220613 +13961221 +15916462 +9533686 +6130277 +3992306 +8406914 +3242166 +2210406 +7374855 +4598751 +2901549 +6518348 +7762146 +6238547 +8039281 +9097000 +12599123 +15289135 +4124041 +9948813 +10512096 +2208606 +3674362 +9820596 +8572789 +5561441 +8237406 +11292437 +975236 +714035 +11811571 +8033318 +2387746 +9756638 +2334301 +13658966 +7840092 +6214776 +6401404 +717797 +3956175 +15095303 +15030342 +10044367 +10552487 +10147674 +2217289 +9671865 +3406691 +12379223 +14513795 +1953191 +9777994 +4637337 +13650890 +15036692 +11613222 +4039486 +12502011 +6299668 +16030431 +3865047 +7141559 +5884976 +14899340 +11815473 +13969729 +10815721 +13578300 +588377 +4574137 +11057151 +6311914 +13938887 +9005955 +12019473 +2014026 +874976 +13427809 +11228802 +5921990 +6425946 +2768442 +9262911 +9810316 +15547601 +10488369 +10673033 +3694796 +9534237 +4483357 +15727789 +12178219 +7733323 +8409590 +15886714 +636431 +10494725 +13367115 +16751900 +2874862 +2637410 +4110629 +9316625 +4803239 +14607483 +15304756 +6743303 +932082 +9268261 +10771331 +4682174 +7058265 +2722879 +5565992 +2455081 +16743292 +15276698 +12759754 +9076128 +1270098 +12355949 +13191709 +11624524 +8724683 +14572898 +3410826 +11794857 +8326815 +7709192 +5293989 +15651210 +14719546 +11469611 +4064776 +5228536 +12635255 +11168257 +10289020 +3221734 +9257111 +15017375 +1414474 +1867774 +6678002 +5910807 +3594951 +1876856 +15754507 +9838587 +12417564 +10263916 +14877013 +14990736 +10589289 +12982786 +12841317 +14824703 +9679677 +4908154 +14586235 +4291366 +3942778 +12104244 +11511598 +2627154 +13092727 +3884959 +6275209 +7849756 +1518926 +15598702 +15539297 +15931684 +11741658 +4362291 +8225917 +4764645 +10914065 +1573966 +8328222 +535831 +3949527 +1257746 +11437502 +16318537 +13841016 +8189904 +3785017 +9479226 +2354303 +14090196 +12379971 +11210615 +7100529 +456270 +6348796 +5801004 +9715599 +3151500 +11589479 +1601769 +15853671 +11257396 +11953151 +13791773 +13951647 +1758648 +7346198 +3602575 +2597371 +11107751 +15251049 +13718748 +10998290 +11920218 +9790560 +2918693 +11285196 +5769204 +1454206 +3113364 +8047395 +2824654 +1753368 +11699238 +12519211 +6266639 +10395093 +13807978 +4084655 +1810025 +11099538 +9196608 +15310924 +8021491 +16589065 +8329130 +6175750 +7720292 +3453224 +8763588 +5264367 +7183909 +3724623 +15907244 +2245253 +2575924 +1505679 +5724649 +3431661 +5337141 +11204290 +9216795 +6831138 +8026302 +7677364 +15777635 +1578938 +8449143 +8403653 +14138059 +9818294 +10107280 +13602845 +14025772 +15345990 +12502736 +9458008 +7656916 +4748606 +8968336 +9286535 +11768813 +9249352 +3169754 +13256637 +5582861 +4512199 +7891784 +4930500 +13950971 +848994 +13622063 +3060800 +9546394 +228429 +2838852 +162956 +15747915 +15090211 +16754719 +4010637 +1579716 +818496 +4447898 +11497290 +7376460 +14366300 +7671728 +6932322 +13536438 +6893036 +1986086 +188556 +10781974 +10363603 +11777049 +5915138 +6989647 +5250181 +12663427 +11103536 +4307922 +3910066 +13990814 +237889 +9000903 +3841296 +1126999 +7952101 +794325 +13281493 +13288964 +9953668 +13538608 +11205088 +1016298 +593699 +15988040 +9142609 +14621052 +16607384 +6448551 +15372784 +9241004 +11181875 +12107484 +6465858 +9110332 +15238064 +7559232 +2307783 +630432 +12962657 +10595935 +6011227 +14329260 +2300788 +11231338 +6231850 +12478288 +1308407 +5721277 +11033387 +16079698 +8184174 +13265143 +3829596 +6958391 +4154908 +7688504 +4563103 +3797871 +14076352 +5377645 +267035 +16662608 +7307827 +3403095 +7102643 +8280693 +2859895 +13744591 +9548067 +1535925 +9649365 +8957052 +11942097 +15138363 +987470 +6540940 +2255726 +5853173 +1676545 +2398324 +13944287 +6679347 +4719707 +12175293 +15076076 +7261466 +9607593 +16356879 +9407346 +13598055 +16525652 +10877537 +5943532 +7160822 +1641503 +6807049 +14603041 +1215894 +13793532 +539585 +9991165 +11584449 +10878109 +9967699 +13144441 +6045747 +13781860 +13690021 +9294200 +6729353 +10379887 +8450311 +13242768 +13109653 +4451712 +6787984 +1656944 +12301464 +9357533 +11796491 +9817000 +1906727 +11782106 +6203809 +12045901 +15277122 +13152637 +3902919 +1597160 +10035935 +6137021 +12699477 +14620869 +12021044 +16401399 +16326864 +11413926 +15701963 +10392516 +821186 +8123502 +3140563 +14371564 +5362189 +14577462 +6902781 +14108696 +4940430 +13634227 +7919282 +4216071 +5580321 +12017095 +4877230 +826945 +8189496 +6264144 +11537826 +5904615 +7183524 +9804350 +6624972 +12727782 +9831926 +2132270 +10923903 +12186088 +4278025 +16137107 +6984664 +6798167 +10104760 +16498108 +1855790 +10777476 +7244435 +9130658 +5423184 +15113275 +16435351 +2851235 +16102891 +11053131 +1684066 +12795646 +12010364 +12284482 +9725773 +10873065 +7693918 +1022242 +3352547 +12199088 +8353245 +10513971 +13004260 +14281838 +16656798 +8270041 +3672490 +6740577 +8695064 +2260281 +11689289 +4140494 +9975955 +8615870 +5597705 +11901690 +4931996 +14533052 +16443126 +7528076 +8260058 +16415295 +16629873 +5941536 +15302878 +13977779 +5278283 +4777131 +8309155 +3536191 +9832925 +12969626 +8703076 +5350343 +11867359 +15655546 +1242788 +10099254 +2012771 +1844498 +9331581 +671767 +11310680 +7029452 +209572 +16016570 +14799662 +9021748 +2409194 +15986949 +6504974 +5559896 +12327603 +955016 +11002343 +16317597 +7742271 +12858861 +7885331 +15723138 +16773262 +2119346 +3112942 +10731178 +814161 +7618826 +6834390 +8916286 +11797576 +14899205 +13721940 +10397575 +4125052 +8041863 +3729420 +16510294 +1319611 +4616778 +10237176 +5530769 +14579717 +2060788 +14998789 +10809800 +5886674 +9701750 +6998212 +3430530 +6055534 +2067486 +16022562 +8142450 +4186424 +16745842 +10237541 +16424278 +2394365 +6873733 +11529875 +14346205 +5545840 +8111238 +6685303 +6285686 +3904851 +14440298 +13364995 +1119044 +5787891 +9271823 +452998 +15478045 +2589768 +3139766 +12098416 +4565935 +3114569 +10159776 +825303 +9035891 +6158063 +13133742 +5241793 +7745619 +15899585 +2842132 +5552746 +1052251 +7088378 +3773119 +7186018 +5237741 +16004797 +1509324 +10664205 +1321838 +14119005 +2016067 +14050685 +2859099 +2650679 +5188760 +8583943 +2669605 +10286955 +11288736 +13887745 +10116403 +10973293 +12647805 +11196720 +7778470 +12794947 +15309205 +2845487 +5100426 +7880032 +3114469 +3887600 +14626872 +3796439 +7742487 +7124677 +7210159 +9458457 +4797276 +16397579 +8540622 +8977494 +4060055 +2570115 +16622862 +10659402 +3605625 +4705962 +13431480 +8396876 +13841682 +1091377 +2488322 +12773213 +11757573 +5905027 +1867746 +1882424 +3272633 +4227790 +12731591 +3840362 +6053127 +8927643 +1907113 +5681653 +8693920 +6602007 +3559505 +6014526 +5594054 +6637189 +3997121 +8918703 +7034694 +1252634 +10650427 +3566552 +8124265 +13809031 +10327584 +2241982 +5208141 +10313965 +11243157 +4081043 +6946634 +14430108 +1896311 +6980146 +15194954 +5543502 +1080769 +15485027 +2174608 +8210610 +5745960 +13958221 +14354433 +9446464 +4534051 +7475016 +16068676 +10916632 +11916350 +3383762 +3524326 +14596713 +13117666 +2198142 +6481250 +8217485 +14416482 +11818325 +1865809 +6603840 +8497767 +6064496 +10711570 +2104009 +2001215 +5294454 +6255903 +11212761 +4634354 +535812 +13278881 +6421254 +645729 +8014399 +11711307 +6644061 +5873883 +6681918 +11440211 +9269595 +5239552 +10206324 +4675621 +14829033 +6838499 +8712918 +6079926 +8932459 +15047348 +15783982 +2277816 +11756035 +6647859 +14658245 +2726266 +13540163 +7629716 +11043195 +2088977 +7938370 +7034705 +16674637 +3167877 +5431522 +14044596 +3485530 +10712793 +15070826 +11399112 +3430302 +1711955 +9497158 +12751744 +13602526 +3804957 +14660751 +6619582 +7771271 +5083696 +4712064 +5087230 +851392 +16580758 +13939588 +7901744 +10397278 +4729737 +11035036 +7709523 +1643823 +7801172 +13435693 +13005330 +13757837 +11071183 +5993714 +10980783 +3492653 +12085803 +1587957 +11446807 +1979625 +11916828 +6676642 +8313850 +5484090 +16018870 +2518010 +11313737 +9644621 +7270445 +13489092 +16733523 +8383652 +7905102 +16541238 +13701196 +3948437 +1502163 +15526446 +16069584 +1324620 +13813465 +8444476 +15782495 +5055345 +16717680 +6117431 +16549515 +1185043 +7470531 +453314 +8710407 +15132464 +12489379 +16342642 +6676063 +5248479 +2416896 +14908060 +5356657 +10419207 +5740476 +11464887 +16419439 +3410278 +3343222 +1502557 +2475625 +9140182 +15882770 +9108864 +7326938 +14205337 +6968231 +10037821 +1545493 +9930507 +11468247 +4453353 +1737638 +8617464 +3548927 +16218747 +16573996 +16619167 +7841167 +6555742 +7980374 +16430750 +3476623 +4675048 +1463792 +10786496 +10385590 +4540745 +16704563 +7185228 +16672939 +15227318 +575641 +1752110 +13229762 +6936249 +5254834 +14924097 +11872822 +11566931 +15814782 +9329637 +848143 +360811 +7051009 +3762221 +11905525 +3420766 +4972198 +16572938 +8478168 +3520294 +15675193 +11770890 +7205845 +12852861 +16287505 +1866432 +10919387 +717769 +13966111 +2225954 +7559541 +2520871 +5016922 +5556442 +9860543 +7204872 +15678470 +5133590 +4340939 +13964581 +510480 +5635079 +13386710 +15628339 +12873403 +3732785 +12943697 +14618341 +1852511 +2080119 +11506274 +12859140 +2995981 +4958154 +9830788 +3238484 +4003685 +9617301 +314863 +8311248 +9906128 +1017866 +2082332 +12791913 +16049618 +14303951 +10933980 +10646802 +11975153 +11020515 +4885463 +6915080 +9255464 +12097286 +7564476 +13001144 +14325902 +6203771 +2057265 +9070450 +8994119 +820908 +14494107 +14560545 +2796418 +975583 +11005153 +562410 +5843075 +6401566 +387798 +1718060 +8674682 +3722822 +16693639 +4470965 +4768777 +7669575 +2497671 +1334107 +14794231 +13525174 +11016784 +8090667 +10231238 +13461264 +1467455 +2823005 +9319240 +7104074 +9857533 +12868351 +6844558 +9785275 +4431637 +6628091 +12776427 +16475381 +1801513 +7902572 +7859905 +14307482 +14618287 +12875472 +14578278 +3030020 +10333210 +5045104 +7196456 +2896205 +6023261 +13639864 +7981565 +2691882 +9715725 +2315974 +693832 +5987320 +671974 +13192796 +7999051 +3029356 +4901962 +6292168 +6758885 +13787020 +13338400 +5879763 +7414590 +12046764 +3746536 +11295461 +14645237 +9042097 +16410351 +7165370 +5404270 +11180071 +6190223 +2478549 +3589556 +644426 +3999178 +10694578 +15308359 +14657975 +11819557 +5383488 +8673061 +8666173 +15667550 +15189427 +5322503 +3343120 +3524270 +12806899 +9149108 +2222188 +15798380 +14219290 +14989583 +11037668 +761684 +13282918 +14385194 +15580033 +14404994 +1532899 +6207352 +962330 +8574674 +9141925 +7450056 +16478866 +11242151 +15460859 +13404533 +9789177 +16767303 +11150945 +6824367 +4013089 +10679445 +11242003 +8320119 +10350989 +12227748 +15159620 +9036121 +9041046 +9667487 +8641244 +1675401 +13745932 +5378476 +3840823 +10048610 +4383661 +3416032 +342827 +5542896 +2054549 +6205663 +6942670 +6345557 +6560490 +619985 +3365077 +5496447 +16438019 +15904282 +13351292 +13094599 +16517800 +8613847 +11983813 +9842842 +9163568 +10718559 +6531522 +7388773 +1149121 +5292276 +13231404 +3833197 +14933610 +1213078 +10181888 +8504143 +12671331 +9065518 +6988868 +5454665 +11458925 +3655069 +15025691 +12555355 +12144669 +7785415 +14254975 +14579886 +15971747 +9376661 +10561432 +3663518 +4150447 +10879720 +9790108 +348147 +8863240 +548271 +1960293 +3280855 +6421675 +14793688 +11793295 +792334 +16464490 +3069298 +709622 +9182223 +16318573 +1395801 +3056029 +13786229 +9342046 +6038970 +5382880 +15465253 +15177600 +7090504 +9268128 +4351389 +10192564 +11646814 +2652834 +12699247 +4046321 +6748708 +7261153 +9402116 +10128819 +11165657 +1709765 +8481364 +6916518 +16446595 +9054572 +2535755 +10095591 +9947074 +1015557 +604908 +10161213 +2058032 +3235920 +3785314 +5371096 +15218309 +7617441 +10495621 +12698500 +16450542 +13610934 +2559280 +13134951 +4014117 +3693202 +11097150 +8015894 +13991573 +9096762 +2112965 +7517990 +5116271 +14786755 +9570412 +5115682 +2355093 +15730289 +11043726 +5330299 +9094780 +14089215 +6398992 +5392883 +10538882 +11210508 +15785591 +7346380 +12539600 +11678661 +13008915 +2093885 +6680776 +4248446 +2297746 +8855439 +8925695 +13037726 +5324944 +9002942 +9298967 +2331546 +5034282 +1438335 +6989621 +1112883 +2426830 +5180731 +1223604 +15704582 +13434308 +10779336 +6136172 +2756039 +6007880 +2318449 +7440699 +1350403 +9781519 +3683958 +3023300 +9813053 +15581286 +2050034 +6490359 +274021 +15782196 +16707057 +11415749 +2871392 +15128103 +10413965 +6501739 +16484653 +3768982 +11483852 +14991092 +7012750 +7533701 +775494 +1316133 +6884533 +15223646 +10644932 +6364300 +9250938 +4763583 +13370979 +9845884 +1135318 +9895924 +1363754 +12799939 +2947378 +13484367 +1003686 +11949132 +14712814 +5944516 +6083208 +2334828 +13756166 +5003203 +6641977 +7929434 +5608770 +3458393 +16229337 +3092316 +2957208 +7840313 +11071576 +14972779 +7526297 +5506118 +11235847 +5463908 +4096929 +11949751 +11546185 +3980987 +16281470 +16386782 +11143199 +14824769 +13118895 +6823449 +7875494 +8380899 +9251363 +3801899 +1876955 +1876836 +290940 +10808281 +9692307 +3691470 +10007354 +10787376 +10913276 +5436895 +14499857 +611175 +6798297 +10022112 +3064260 +12192740 +16021015 +14631523 +5288536 +1763399 +12331144 +13195741 +6652732 +9793005 +5005629 +7593891 +10399057 +4301249 +13655573 +13129403 +10031614 +3768715 +6117441 +5142258 +1176217 +3741265 +13710484 +10557934 +6681967 +12413117 +8224738 +8340104 +5407068 +5123740 +998410 +16043091 +8227764 +5938706 +4129455 +11893309 +10011002 +15313686 +14465906 +9949523 +4509314 +5603875 +3981799 +5492758 +12325873 +3638068 +5333367 +14350938 +9971160 +11449654 +10444847 +7875982 +9453131 +16040002 +5612138 +8947771 +6155557 +8079108 +7163480 +7774687 +4042800 +1245619 +13182099 +14292132 +3076278 +10652189 +3850258 +11051331 +13556689 +12473370 +7614804 +13051189 +555744 +1313766 +5037001 +15684720 +14598988 +6909836 +7202620 +13910370 +15501777 +2545074 +7870087 +4179773 +685760 +4050349 +13491844 +2747308 +4487285 +6860520 +4880922 +7619775 +15239232 +6968083 +15079185 +2479711 +968281 +12753853 +3117395 +6889158 +7238720 +14582607 +5332097 +12260190 +5618672 +7292788 +5039009 +9862666 +11052725 +12542538 +8049232 +16242223 +13003326 +945323 +12142304 +14460912 +10886809 +6308155 +1380252 +10528456 +15201847 +11510181 +9886622 +288309 +8960746 +3588327 +16127903 +9673560 +7094741 +10433045 +4933027 +4713580 +13563372 +13651576 +11768157 +11556490 +13293124 +3335015 +13606927 +15709851 +11353280 +8932242 +15591073 +4792180 +13071383 +1352697 +9816535 +2124763 +6171405 +5697013 +1533894 +13135812 +6348782 +15874383 +15004894 +4640602 +10730463 +16494172 +14038885 +3066952 +9069434 +11469998 +3006361 +9386385 +522860 +5954008 +13669997 +16294766 +5049421 +12314923 +13225566 +3470101 +14804714 +11306089 +13446833 +14238935 +14480223 +11092372 +3159891 +3611094 +1907997 +3389191 +9842552 +15781023 +706998 +7055434 +4989225 +3045680 +2511828 +10305244 +1864993 +11211881 +7899163 +4593265 +2454147 +15461535 +16254452 +8519405 +5999199 +5858265 +6123853 +16290684 +8117584 +8750209 +15171400 +332014 +12064542 +7188877 +12687253 +3035539 +2404058 +14005175 +6889659 +13262195 +2246298 +16567614 +14534705 +13936330 +7117544 +2313342 +8583467 +6201163 +6607796 +5948177 +14426236 +12572323 +10655152 +6750829 +3066240 +262449 +9551895 +16658380 +762430 +6361828 +3735019 +493276 +11547700 +3846297 +2179121 +13112564 +11263513 +4357676 +8959446 +2761900 +602617 +1760214 +13900688 +6292357 +9649261 +10636876 +9983857 +10420141 +8515232 +13606212 +1222319 +797518 +2920119 +2322404 +6581691 +6933402 +14936833 +12472527 +5673147 +10880151 +14771394 +8142900 +8424006 +1830386 +305655 +13745270 +2229606 +5169457 +11281056 +13178279 +14560231 +1281436 +1853489 +14569500 +6428743 +7846264 +329177 +16147220 +8501455 +3936931 +1845235 +953427 +14619871 +7930242 +13248947 +9913641 +13454295 +6424553 +14504840 +10771302 +12788672 +5388793 +7482379 +7945472 +15647314 +6041655 +6382197 +12702560 +8305403 +5982155 +3626393 +1097315 +8017193 +4321150 +4032309 +15692611 +14320959 +13722964 +7084584 +15600553 +333198 +11004061 +16381079 +13728049 +15192279 +11843330 +10446471 +6069432 +16704287 +6872989 +6947699 +9661120 +13446391 +3028275 +14255050 +4391456 +8380075 +12226475 +12413657 +2511934 +4759933 +14529610 +5855391 +9951438 +14547587 +9843638 +1734267 +13213458 +12837530 +13065130 +15434562 +11138639 +8656521 +1900558 +1863773 +15313665 +8980350 +1364909 +9381865 +9861412 +1905627 +8501972 +3042456 +11833743 +6529172 +973357 +15163674 +10673189 +10647902 +5898412 +10440516 +9086526 +10522449 +12174540 +2097376 +1544031 +9543669 +5870197 +540230 +13984214 +15120164 +16695166 +14598961 +10939523 +6417076 +11683963 +178718 +8286860 +11240603 +1723786 +6763418 +9478218 +4476114 +15202022 +2839155 +13608493 +9854273 +1227407 +4282734 +15783384 +11422904 +9350874 +1397877 +5852946 +2969665 +6209706 +10731403 +1348758 +14733536 +12539664 +1632979 +15310880 +7329123 +5222497 +7904778 +14668923 +16732393 +3839573 +1175658 +11683709 +16256351 +15130216 +11783636 +14667851 +13009556 +15759805 +8269903 +1592144 +4836386 +14942938 +1556344 +12914872 +2246675 +10362862 +653173 +13555501 +10664714 +2723084 +5173309 +11833077 +2196053 +4588125 +2864520 +8668287 +13112994 +8304270 +3230169 +3678365 +14907315 +15938774 +8451122 +2438045 +7008499 +11360115 +621235 +16130697 +900293 +16130868 +6432117 +15468239 +14644969 +2303368 +15574553 +3476340 +3734177 +10613915 +7975753 +1932285 +425187 +335756 +12373356 +3355391 +14060382 +5557010 +7951387 +3767614 +12749819 +7105796 +8455312 +10857727 +6599454 +13014492 +7139700 +12422157 +13029124 +9958100 +2876832 +10001574 +11352426 +14556274 +15099734 +2254423 +7902173 +5981222 +15518029 +1693287 +6050870 +2377572 +199829 +1093670 +16489232 +13135562 +14486228 +7605040 +6828878 +12483614 +2182594 +14714909 +8267108 +1206693 +6950895 +12126945 diff --git a/day22/sample.txt b/day22/sample.txt new file mode 100644 index 0000000..07b41ba --- /dev/null +++ b/day22/sample.txt @@ -0,0 +1,4 @@ +1 +10 +100 +2024 diff --git a/day22/sample2.txt b/day22/sample2.txt new file mode 100644 index 0000000..201df76 --- /dev/null +++ b/day22/sample2.txt @@ -0,0 +1,4 @@ +1 +2 +3 +2024