diff --git a/2024/cmd/root.go b/2024/cmd/root.go index ccb3f4a..0fed7ab 100644 --- a/2024/cmd/root.go +++ b/2024/cmd/root.go @@ -30,6 +30,7 @@ import ( "cpatino.com/advent-of-code/2024/day19" "cpatino.com/advent-of-code/2024/day20" "cpatino.com/advent-of-code/2024/day21" + "cpatino.com/advent-of-code/2024/day22" ) var days = map[int]func(string) (interface{}, interface{}){ @@ -54,6 +55,7 @@ var days = map[int]func(string) (interface{}, interface{}){ 19: day19.Run, 20: day20.Run, 21: day21.Run, + 22: day22.Run, } var rootCmd = &cobra.Command{ diff --git a/2024/day22/day22.go b/2024/day22/day22.go new file mode 100755 index 0000000..7e53bba --- /dev/null +++ b/2024/day22/day22.go @@ -0,0 +1,134 @@ +package day22 + +import ( + "bufio" + "os" + "strconv" + "sync" +) + +type SharedStore struct { + Store map[string]int + Lock sync.Mutex +} + +func secretIterator(initial int, limit int) func() (int, bool) { + current := initial + count := 0 + return func() (int, bool) { + if count >= limit { + return -1, false + } + + current = (current ^ (current * 64)) % 16777216 + current = (current ^ (current / 32)) % 16777216 + current = (current ^ (current * 2048)) % 16777216 + + count += 1 + return current, true + } +} + +func Part1(secrets []int) int { + sum := 0 + for _, secret := range secrets { + iter := secretIterator(secret, 2000) + + last := -1 + for secret, ok := iter(); ok; secret, ok = iter() { + last = secret + } + + sum += last + } + + return sum +} + +func Part2(secrets []int) int { + var wg sync.WaitGroup + + rewards := SharedStore{Store: make(map[string]int)} + for _, secret := range secrets { + wg.Add(1) + go func(secret int) { + defer wg.Done() + + iter := secretIterator(secret, 2000) + previousPrice := secret % 10 + + buyer := make(map[string]int) + var changes []int + for secret, ok := iter(); ok; secret, ok = iter() { + currentPrice := secret % 10 + change := currentPrice - previousPrice + previousPrice = currentPrice + + changes = append(changes, change) + + if len(changes) > 4 { + changes = changes[1:] + } + + if len(changes) == 4 { + key := "" + for _, change := range changes { + key += strconv.Itoa(change) + "," + } + + if _, ok := buyer[key]; !ok { + buyer[key] = currentPrice + } + } + } + + rewards.Lock.Lock() + defer rewards.Lock.Unlock() + for key, reward := range buyer { + rewards.Store[key] += reward + } + }(secret) + } + + wg.Wait() + + max := 0 + for _, reward := range rewards.Store { + if reward > max { + max = reward + } + } + + return max +} + +func Run(filename string) (interface{}, interface{}) { + file, err := os.Open(filename) + if err != nil { + panic(err) + } + defer file.Close() + + var secrets []int + + scanner := bufio.NewScanner(file) + for scanner.Scan() { + line := scanner.Text() + + number, err := strconv.Atoi(line) + if err != nil { + panic(err) + } + + secrets = append(secrets, number) + } + + if err := scanner.Err(); err != nil { + panic(err) + } + + part1 := Part1(secrets) + part2 := Part2(secrets) + + return part1, part2 +} diff --git a/2024/day22/day22_test.go b/2024/day22/day22_test.go new file mode 100755 index 0000000..3a5309c --- /dev/null +++ b/2024/day22/day22_test.go @@ -0,0 +1,34 @@ +package day22 + +import ( + "os" + "testing" +) + +type TestCase struct { + FileName string + Part1 interface{} + Part2 interface{} +} + +func TestDay22(t *testing.T) { + tests := []TestCase{ + {"test.txt", 37990510, 23}, + {"input.txt", 19241711734, 2058}, + } + + for _, test := range tests { + if _, err := os.Stat(test.FileName); os.IsNotExist(err) { + t.Fatalf("test file does not exist: %v", test.FileName) + } + + part1, part2 := Run(test.FileName) + if test.Part1 != nil && part1 != test.Part1 { + t.Fatalf("%s: unexpected part1:\nwant:\t%v\ngot:\t%v", test.FileName, test.Part1, part1) + } + + if test.Part2 != nil && part2 != test.Part2 { + t.Fatalf("%s: unexpected part2:\nwant:\t%v\ngot:\t%v", test.FileName, test.Part2, part2) + } + } +} diff --git a/2024/day22/input.txt b/2024/day22/input.txt new file mode 100755 index 0000000..00e13e9 --- /dev/null +++ b/2024/day22/input.txt @@ -0,0 +1,2256 @@ +6149533 +4604652 +15650110 +710023 +1485853 +9723939 +3342360 +11979999 +390251 +15229770 +7571082 +5328185 +2151343 +1130253 +5508077 +16211282 +5605260 +14392079 +1011517 +3105438 +11339827 +5533794 +8218944 +2581102 +5463478 +7169066 +4512918 +243814 +9870161 +3232914 +15169562 +8904385 +14271933 +11313036 +13904714 +812589 +9423631 +6057292 +792506 +5812580 +14686844 +1776727 +2469078 +881191 +12666911 +9620274 +1618030 +7837415 +1238063 +4388444 +1282507 +6127612 +7316817 +1564949 +7582242 +8680995 +12587623 +2082503 +2469749 +10213316 +6408429 +195187 +3625452 +8780959 +14391588 +10457977 +12571377 +6026574 +1390683 +12262497 +10083388 +10875770 +10941256 +2099942 +4658965 +2100627 +11486715 +15290752 +1731848 +6310772 +2995171 +7728116 +13461054 +15033750 +10143869 +6048567 +16730771 +12100638 +1468307 +162492 +6943852 +5698444 +2036382 +12377055 +16743203 +13109183 +4689525 +4035743 +14029242 +5410942 +14311843 +6887163 +7960913 +14138103 +15757019 +7493532 +12138649 +6225484 +1435755 +4578880 +730682 +14832811 +452696 +11035214 +8761059 +14103372 +11533435 +7097225 +2049097 +1038412 +14173760 +3437437 +9335851 +5225050 +8632789 +4833635 +3334354 +803330 +10311730 +2662839 +12553046 +14255003 +2011657 +161131 +10821186 +14801344 +12177113 +9340120 +15921388 +4997071 +6613570 +2818323 +1690649 +15185887 +7996013 +6978788 +14861102 +8867181 +8752065 +5369626 +8070512 +15280943 +7659543 +7783216 +4473944 +2317403 +8862106 +6182204 +1632831 +11019823 +2605788 +1909819 +11236124 +9321111 +7077388 +9720681 +4379436 +16219736 +9532443 +4006434 +9042128 +14137745 +3944786 +15321881 +6560522 +9412113 +6977355 +5361957 +9314361 +15092099 +8493903 +6343414 +9929954 +11358058 +5839879 +14483737 +10316683 +12305822 +12083430 +4850810 +3858590 +5012230 +16095501 +5257288 +10367880 +15268169 +15469924 +13249215 +3972151 +7740517 +13478473 +4826516 +2391350 +14722122 +5650386 +5722910 +6384256 +11878911 +6542212 +11764060 +4974397 +3354913 +648076 +10312142 +488550 +4765006 +6193371 +3102212 +15414096 +1896027 +15649536 +3270191 +7595214 +15457347 +5424534 +2120339 +8881072 +1009970 +1589982 +2880500 +4123351 +11373380 +4419962 +2911047 +5761085 +14517574 +1332144 +3129288 +12683701 +16700458 +15047725 +15351199 +2837008 +7281327 +10159906 +8429481 +4176107 +14836836 +15441369 +7155379 +12265496 +9453890 +13088216 +5286047 +12612373 +8960433 +16561048 +9141326 +10545863 +10485074 +5661239 +16518393 +8805636 +1858191 +15877578 +1628864 +15718446 +4571052 +1039351 +13490113 +5155433 +15422695 +13626874 +10824379 +3728799 +4266033 +2263002 +9769870 +9228483 +3705597 +6222174 +1283143 +8374080 +14882757 +7550566 +11699302 +4748507 +2739250 +14740641 +16612634 +9941397 +3484649 +2061307 +4580819 +903801 +8084654 +4842750 +16560729 +1983605 +2472908 +4533282 +9836514 +3758491 +6710378 +6806108 +12889885 +3934829 +9796636 +15620472 +7851821 +9750494 +771000 +2837882 +7744176 +6675206 +216166 +5556996 +15611303 +1761382 +11010254 +10024137 +14813934 +16466421 +14122574 +16369501 +6583115 +9019374 +4679519 +5181975 +15956146 +512162 +7513195 +4949374 +9719652 +7177801 +6359248 +8684186 +4990402 +16380683 +10843160 +15667862 +11469968 +16112140 +4854035 +4766346 +14406935 +13599880 +9495295 +16010183 +5897016 +3008154 +12507578 +6055119 +8710149 +8189008 +2717362 +16716311 +13330326 +13600853 +1591873 +6444789 +9770009 +5328223 +9222670 +1887875 +15122949 +5740073 +16017964 +6287599 +13727519 +9169049 +12974548 +9157506 +14989763 +8708913 +5279479 +5953493 +12189769 +16511934 +16500501 +12859616 +3775438 +1093294 +14042475 +13386289 +12687053 +6966041 +8670193 +3911233 +5779714 +353301 +7076710 +15844335 +12617717 +354162 +7683146 +15609905 +6279226 +10520677 +8881301 +8302501 +1021970 +2839869 +9771469 +12073753 +16304771 +9870726 +13687358 +1686060 +10457894 +5426553 +8167452 +2909944 +7631143 +13869038 +2026397 +2528588 +355275 +171081 +13400927 +9041460 +12435108 +2788936 +5568986 +12103027 +5494840 +6390966 +3991817 +10785134 +14361943 +7087704 +7262255 +4398641 +15134409 +1754274 +16027677 +12411299 +7548903 +15904211 +15019592 +8013950 +5408009 +14040924 +9026505 +7342469 +4225337 +11942259 +6680672 +4799862 +853394 +338140 +4403344 +6864478 +10488580 +9072629 +8709679 +15886237 +4461251 +1756949 +2494939 +4452445 +15035327 +8667722 +10673978 +9929811 +9608625 +971379 +6601542 +2724271 +13471248 +13991342 +12466304 +2168444 +9640503 +5292506 +5049948 +15211312 +4681052 +16349154 +4271396 +3080986 +404132 +1352267 +15696676 +3009828 +11955395 +7823691 +4739341 +2162647 +11566809 +7892361 +16467779 +301503 +755468 +656427 +15790618 +4580137 +4306015 +10356439 +2286846 +7538413 +2688975 +9036722 +8233451 +8699183 +1427019 +9275441 +8276203 +468009 +13688696 +8505639 +15261638 +3663830 +7015782 +5971466 +3181208 +3682492 +10202448 +14735587 +14335928 +12383345 +6156935 +15330067 +2333181 +7290443 +7099451 +1197137 +3440999 +6325332 +14239361 +4366575 +11395320 +14072592 +13064280 +2202047 +11685553 +6730135 +1750175 +5807716 +4195758 +10837639 +6839598 +10325553 +7196571 +14529684 +3667465 +16480004 +12666894 +9360136 +11593101 +5105908 +11527842 +8710722 +1527313 +8047547 +13726289 +1107471 +1568732 +13104177 +835063 +6047505 +4221127 +5590861 +1835447 +14346402 +144104 +12681524 +16602032 +16226633 +4454076 +9418046 +6621773 +3946659 +7641349 +9906858 +10152062 +4965799 +14701172 +13442326 +16344600 +7514997 +10756224 +10291860 +989685 +11296834 +8789343 +11292552 +1113435 +3260870 +9404987 +8623391 +10946282 +4172626 +10818508 +10737270 +11887443 +535526 +16246903 +1226029 +5808639 +5381381 +874691 +15506500 +11968556 +4994418 +6199704 +7447228 +3623895 +4658411 +10759221 +14111368 +8638089 +5975762 +1033210 +3553010 +10351643 +10903842 +16146279 +4744065 +14364760 +3136057 +2003340 +5291270 +480695 +7838430 +7138568 +435546 +8490056 +5128625 +12735324 +3369661 +8153216 +10303831 +7396314 +15755707 +11076275 +11676391 +10874560 +6604485 +15980461 +1016280 +10159207 +2414482 +3544636 +15375665 +11779910 +16404117 +5845583 +14758640 +8549274 +8962211 +942576 +14327192 +5691928 +8169766 +4694071 +13561962 +1504695 +7886801 +746564 +11101256 +6228225 +14589739 +16395115 +9243953 +4380314 +7884955 +320416 +4251207 +8187074 +9563413 +12002224 +9263016 +2168229 +5178316 +8371936 +5656001 +14385111 +11062930 +5949225 +918698 +2764114 +3881188 +7043463 +7228118 +6401129 +9887439 +7811248 +375994 +12132298 +4990745 +819439 +6768187 +1167756 +1938476 +7377369 +9119368 +11189110 +8070289 +329037 +2489995 +5762424 +7485868 +9630784 +7344492 +16776173 +6639030 +15486666 +11409577 +4959215 +16700367 +1844006 +5872097 +6294841 +3945000 +7648387 +9190152 +8114549 +6871584 +6878181 +8341940 +9357518 +13781069 +6998201 +10529600 +9987463 +530980 +6220112 +3099889 +5997869 +7769083 +7400193 +11369658 +169853 +7959541 +1450883 +10312748 +16368278 +9191466 +3751610 +11525862 +5677903 +5139515 +9286456 +4125779 +8364219 +15224641 +6357404 +14354623 +3732683 +6802110 +1031454 +11131783 +203482 +2046184 +617382 +7249680 +12743058 +3582043 +3104590 +7326263 +14993714 +16441311 +2465592 +13648453 +11152223 +7891585 +5505128 +9524993 +481332 +15654366 +7912874 +7614500 +9749984 +13710856 +10523983 +4258693 +11274093 +16008940 +13824552 +11113825 +16487614 +2317973 +14385204 +7155647 +13915003 +4258106 +15086106 +4344389 +14344206 +3883840 +13955290 +1978624 +13070359 +15383021 +9277426 +1000801 +7460548 +3400899 +4072374 +1380656 +15689865 +7959262 +14568091 +9899679 +11501666 +7556335 +10978023 +3547744 +10591869 +2484425 +12992867 +2354316 +3831954 +2529937 +11043232 +4635233 +13430946 +10040554 +2367909 +16147760 +7956677 +11939999 +10358793 +1417570 +10556415 +14102646 +10387710 +2095975 +15601047 +11739855 +11778842 +14042697 +12360813 +13816840 +9315423 +5492986 +13377304 +5735777 +2617747 +9243344 +15716890 +7950427 +2683329 +10159466 +14986408 +14139737 +10189958 +8823054 +7455627 +11360620 +4618191 +1525949 +2713242 +9140707 +10026894 +12028803 +1377540 +1163372 +12227654 +16066862 +3664185 +13691665 +15026736 +7297090 +6045630 +3345544 +298854 +598557 +1533550 +13366732 +8808842 +1648475 +2626788 +4015616 +11337781 +6709780 +11207849 +13781008 +10075839 +3044376 +5237167 +367234 +6748899 +12754248 +7533362 +10763338 +3204166 +2617394 +14021540 +14214490 +1271833 +9507174 +14650791 +7874063 +7463314 +3442578 +2510154 +6846806 +9826698 +11804433 +14873007 +1166805 +2560562 +13785793 +6880597 +8375793 +6008191 +12750058 +6300594 +3135754 +12204774 +15115681 +5483436 +9430200 +10920123 +14657407 +12667044 +14075691 +6327492 +12197765 +7291184 +4611941 +16010107 +1966326 +8295594 +2164765 +13290465 +8087883 +11002040 +12604077 +9094106 +14783196 +16209832 +7306126 +6124716 +3052949 +15632686 +7988540 +4545912 +5731312 +3017346 +5334159 +4231270 +11124406 +11092530 +1949147 +8358801 +14889784 +10578209 +6326313 +1568474 +3994997 +2029110 +4335428 +10127469 +15219029 +2326273 +510242 +6861010 +12163900 +4263548 +2597774 +4086377 +8540255 +6690137 +3677883 +14054497 +5927388 +16549604 +5598399 +16452702 +12165673 +16657315 +10960786 +9767299 +7754348 +11436270 +5116794 +6642881 +14294097 +14552226 +7652724 +3627818 +6657144 +7692011 +4263996 +14599229 +11155691 +5450638 +10086991 +3223100 +243208 +16720315 +1290036 +14647829 +3779116 +8928926 +1001992 +14384524 +1428646 +12199178 +14828072 +3824160 +9656054 +11077018 +15159407 +13668199 +11972347 +7104377 +10221408 +4251041 +2061708 +16766100 +7415299 +12412590 +1678881 +1789340 +1579038 +7763407 +9724263 +16733312 +10553817 +11659041 +6782276 +6307899 +12633240 +4977753 +10291306 +10417376 +1577544 +16378314 +7691693 +8234943 +12158699 +3877801 +13138798 +5128975 +4344230 +4166703 +12799195 +2201666 +15026703 +3931713 +4017513 +10667393 +2033618 +9734726 +14805431 +3801877 +8217924 +1077736 +12385312 +16454276 +10241211 +10356924 +12209553 +4289613 +3440615 +6922514 +15047849 +8692665 +7760813 +9935521 +3820783 +345113 +3937603 +5235247 +4093372 +8282362 +717466 +7009016 +195551 +5813624 +152384 +6629952 +9244931 +2754244 +9479196 +8353857 +3586261 +2211088 +12055177 +15961470 +5741677 +6710762 +14493293 +476556 +3459258 +12065979 +8026626 +11587154 +9253831 +132009 +11261193 +14797327 +1623625 +1581457 +336683 +2435193 +10672765 +10148560 +6454856 +3392998 +2739794 +1025018 +14239834 +10941334 +16420076 +5433386 +2163096 +11872239 +15493636 +9300640 +15657288 +9983490 +3727366 +10208727 +14362274 +14763615 +7520209 +2867891 +12871158 +3804712 +6104513 +3924667 +4870407 +11473173 +9210646 +1868141 +4461406 +3954227 +14154777 +15588527 +5697543 +6369846 +2605586 +6337601 +10010864 +9769819 +8424457 +2633126 +16233652 +10327847 +9021783 +2360989 +11118935 +10411946 +3509594 +2274669 +3978499 +5804387 +6445897 +3364276 +12491899 +14617197 +7627674 +13022004 +8301928 +11904068 +11305418 +1182770 +8287309 +2058546 +6314014 +555914 +16027203 +4401734 +2500524 +4763979 +5511487 +9158811 +13374574 +13017339 +12807634 +3162582 +11935495 +9312271 +15826691 +14002624 +13242352 +810746 +1626862 +5105451 +8487184 +13815160 +11801969 +337550 +12165935 +13557823 +16586815 +11847240 +7881612 +8209674 +3747103 +12686536 +6283937 +13398868 +14639928 +13444516 +3196794 +15259017 +12894886 +11033883 +10699322 +9431400 +15488389 +7950218 +9083922 +14145694 +11011854 +10918126 +10179263 +6239521 +16268077 +11998655 +686257 +8139232 +16568152 +5961564 +4237592 +14477464 +12518188 +16412788 +2926548 +12788529 +645293 +10577673 +11939732 +13789997 +13880240 +12832533 +16499900 +15181258 +9404966 +1472552 +6865011 +2533714 +16463562 +13268734 +902354 +6783223 +7815334 +7931782 +3930254 +16161288 +1120183 +3555753 +7654761 +5572836 +3646670 +5345494 +1683584 +12468026 +1528985 +13906256 +1592839 +7065956 +9784958 +1016858 +10648105 +6930317 +11473852 +6334632 +5455543 +5091879 +8821980 +2762597 +6086626 +13951473 +9074501 +563113 +7879068 +2571072 +16141671 +9300947 +13431373 +6524038 +2377064 +7251197 +15167050 +5843578 +12488718 +9087476 +1962245 +389639 +10741493 +6177057 +7415057 +13734731 +16275904 +3471230 +7768613 +15258224 +6889843 +304572 +9809869 +7814382 +8647292 +14464403 +871407 +13868288 +5365121 +10029379 +12664156 +6437758 +7855956 +13571171 +15889265 +4152138 +12002751 +11650153 +16583761 +12581508 +16669799 +15636082 +2376335 +10884730 +10573298 +3918969 +11268356 +13160676 +1285704 +5380959 +14645062 +12509573 +8924587 +7125776 +15600286 +10078098 +4457935 +1615711 +7363965 +14474339 +13640999 +9150808 +14604848 +13270532 +15815889 +1342033 +9192531 +9264649 +15662747 +6429246 +7321221 +3475646 +16565690 +13702818 +2678579 +3734604 +268735 +11891904 +13684402 +10766320 +3910540 +10950110 +4410005 +11559509 +9538234 +15688908 +9999648 +4883857 +13169455 +4986415 +4000709 +11325397 +1007929 +5009106 +5276678 +2894813 +10846883 +5548436 +13005448 +9352365 +11069428 +10237824 +2274323 +5314213 +11929079 +11009328 +15024903 +4793895 +15986758 +12388034 +5616970 +3302240 +15089053 +10153052 +10386891 +14738546 +15497515 +3809934 +13337021 +9745764 +13653250 +15491306 +14842676 +13979798 +15674454 +9186178 +6502707 +4564282 +14429162 +6242123 +220993 +9505918 +5064602 +11492076 +1285224 +15893353 +12505240 +14461684 +6367749 +5441612 +3183716 +5203772 +15857138 +2144448 +11512873 +9448647 +9197735 +1407397 +12978816 +911737 +13387374 +2547564 +12785204 +3945163 +12986951 +7774998 +11249389 +13394865 +12722454 +6238684 +5974046 +7765510 +142243 +4287308 +14408432 +13532681 +10857810 +14163412 +11779102 +3367099 +14658530 +13733187 +11060010 +12563812 +375142 +5417890 +4687728 +16002276 +13053004 +11052053 +6623722 +9538619 +10007000 +16382681 +12202680 +14606373 +1948771 +4882079 +13910908 +807847 +12495023 +16603011 +15873801 +7010324 +15500071 +15990946 +12013221 +9361458 +13917972 +351291 +15407499 +3893013 +14382574 +15884421 +1609493 +7381880 +14711697 +10499854 +13591364 +384928 +13331614 +13945462 +8200970 +10426655 +11976296 +2193563 +615936 +14555446 +352951 +9853700 +8216785 +1407803 +14228796 +5166678 +13140676 +10899407 +11322354 +7863529 +10052726 +10803108 +12465801 +7797347 +16136671 +6753309 +5841643 +6225704 +14025039 +6227273 +11896107 +8641767 +2543623 +12533847 +173980 +10498614 +16490150 +9514516 +11019118 +209995 +13289338 +6615789 +4842259 +7865420 +15970878 +16574300 +1230038 +11750227 +12111796 +11537898 +623923 +13528733 +5285605 +7245957 +1627454 +11599220 +6758807 +2783052 +3584238 +10718862 +10291428 +2397385 +6644567 +3324766 +9011615 +9851937 +16472765 +1408933 +13356395 +2048701 +7906359 +12602138 +677133 +14632379 +6110407 +619610 +10253785 +4338079 +7501069 +882872 +7035525 +10587575 +2194305 +8201584 +11315960 +12100086 +16598923 +8723938 +6138402 +11555645 +15537466 +12482827 +9549827 +13757587 +14900535 +10733658 +3581053 +5030177 +4892237 +3390503 +985254 +11921531 +15736112 +1824954 +13921172 +16015963 +16444285 +15004322 +5863610 +210379 +6334339 +2110576 +9200678 +1310587 +11975476 +12753791 +3006450 +5542172 +11112628 +11573080 +6754661 +11488639 +4517400 +4051096 +3526457 +3979388 +10086292 +733925 +6447246 +9239502 +5562055 +2286170 +5370112 +14811258 +15421179 +6330954 +16395610 +12983458 +575511 +9599435 +1567026 +15695203 +2886792 +11861119 +11824070 +16482482 +12998849 +6153335 +14413074 +14916139 +8549633 +13262501 +1898289 +12807262 +6902456 +8222586 +10917549 +1776665 +4265581 +3074713 +2656831 +12061247 +13630513 +1699909 +4436795 +3139514 +4876172 +15759172 +12113557 +1125448 +1148810 +3629922 +15529740 +5792053 +6134711 +14758256 +7542479 +805472 +15558423 +4170437 +15703372 +8189814 +1343963 +16170409 +968898 +15350449 +639243 +9244399 +12715355 +10309457 +12848287 +4279563 +13992311 +6479224 +4384635 +9011077 +5528304 +1415456 +411977 +13430889 +16580581 +10085300 +1038265 +3889539 +5849541 +13689058 +5055121 +16185020 +247520 +15529311 +2774013 +13042366 +10180874 +8298100 +6509547 +15553855 +7903801 +9357731 +13642143 +2403292 +9844305 +14708967 +11037049 +9763125 +2899600 +671928 +1091033 +385910 +14234437 +6997375 +15306788 +11367595 +11587279 +8273097 +13572691 +4296326 +791755 +1585263 +7295258 +11188539 +2940368 +1234083 +6267497 +16235472 +10169825 +3896021 +2628401 +13141293 +4353564 +10913922 +14817657 +3887478 +11676652 +12816130 +6861912 +13158631 +16289110 +8281792 +10773020 +6278497 +2766256 +14410146 +7230643 +2923546 +8786998 +12860338 +9485741 +16464554 +14250423 +8518605 +15484021 +14572429 +13283231 +5989774 +3998434 +2627499 +16606292 +14413703 +6315300 +2439688 +12511948 +7205514 +12190197 +12595697 +13689104 +10872254 +6080075 +14348335 +11564547 +8838434 +2708501 +9467560 +2721453 +15018588 +2600274 +7817424 +13981913 +13871023 +5190559 +6447041 +4450441 +10969190 +16093054 +10684554 +8462974 +4970039 +14797271 +11140975 +10658697 +1459652 +13497546 +663850 +12877319 +3019441 +237215 +15447339 +5875816 +9130937 +10432933 +11289284 +5755961 +3181968 +4556267 +13521138 +14286976 +13672084 +6679869 +1486303 +317394 +3676639 +4425313 +12309215 +736742 +10591401 +5816681 +14330791 +982210 +2335162 +15057918 +397011 +15639309 +1110559 +13586650 +2441879 +8253023 +10345842 +14448914 +11224405 +3594658 +2360471 +7645088 +7249785 +6757377 +5748002 +8157047 +7027796 +6540265 +4058956 +7381417 +3423289 +15230733 +3695116 +1346405 +1412096 +7266131 +7828889 +13855323 +1445737 +13885668 +7553664 +2189486 +1158488 +4483721 +2672527 +1634258 +13435114 +9263802 +6054041 +1805007 +11329956 +9292969 +3559833 +11426804 +8487326 +1330371 +15329700 +9609126 +15025028 +526057 +10970547 +14503141 +16545182 +13323718 +13386106 +3454005 +8403900 +8201583 +2904658 +11902472 +827853 +391036 +11008654 +13396540 +10562929 +10690433 +15036541 +13441558 +5734212 +16295882 +15780115 +14875933 +9139963 +13312736 +15980574 +9987703 +4044919 +8196678 +5932263 +8833998 +12901884 +10385785 +8044332 +9559922 +9020809 +6097159 +6388653 +16088397 +12920553 +16147507 +15863198 +3142736 +5693109 +15877950 +504271 +8234073 +2683309 +1597712 +12674508 +8837644 +3108149 +6183822 +16072371 +5441253 +9502356 +8805986 +11716153 +14492345 +2573473 +4789161 +12627460 +10247439 +10729518 +677956 +2293599 +14282530 +13467676 +4193825 +15416638 +13466359 +14764115 +5687593 +818553 +15599574 +13000788 +1358579 +10349152 +6121576 +13801449 +5058980 +2644968 +10957367 +4798634 +15197897 +12686853 +8317069 +10183344 +12437306 +8412470 +16027036 +1334143 +2322529 +4454576 +16212906 +16712108 +1381737 +10762305 +3124271 +2270985 +10165033 +14604445 +4457515 +15251548 +6686637 +12300450 +8155811 +15766939 +2413947 +11586272 +4401122 +11086454 +15101626 +4531667 +10457428 +5875160 +10378370 +3725333 +7931345 +10168643 +15965859 +2730536 +9216242 +12226731 +11168564 +2136708 +4954211 +4604242 +6045489 +4212769 +1021022 +13440129 +3499381 +7133414 +1669990 +12933809 +16110374 +16114212 +13846717 +6626979 +16257986 +1261237 +1539245 +2447178 +1169047 +1576493 +9208948 +5950758 +6985595 +2400318 +12000679 +3204252 +10199102 +1930358 +7580957 +3351898 +4735797 +16135753 +1127385 +9940856 +10972369 +9276852 +8512535 +2649120 +9467414 +10185381 +2045319 +5362162 +3024706 +2237157 +12718276 +970523 +7929024 +16067679 +626550 +13020456 +12622860 +4499012 +12035867 +14581534 +7589301 +11227124 +7708688 +14838293 +6410582 +12083815 +9023652 +14122445 +6699712 +13122887 +14328802 +13833752 +4012319 +11178531 +12240256 +12399062 +10413144 +12130985 +3931823 +5224797 +15097395 +8567088 +8665743 +4740786 +4054901 +12108223 +1498132 +3202765 +3967015 +3279645 +8114522 +11734612 +4166116 +5904529 +8462848 +8179390 +13606421 +7885740 +2993620 +2800830 +10275960 +2418316 +3677929 +5519103 +11160405 +14919957 +5914011 +779992 +7446071 +10152651 +2374934 +12592254 +12063981 +13907519 +2298824 +1806214 +6176484 +1955430 +6443998 +2886687 +5024249 +14983298 +295915 +4816726 +1589998 +3791649 +16445232 +16263688 +13255875 +8909294 +11009625 +754888 +4197950 +1031230 +9966921 +15579125 +9530823 +6915769 +13424483 +4000902 +7810787 +3456188 +4239854 +1533142 +449883 +8143309 +1325703 +2519691 +14937102 +7889886 +14540296 +4133204 +11834443 +2900494 +7443023 +7478932 +4254057 +8904238 +9157118 +9969265 +6393603 +4290394 +2401503 +15785942 +13845044 +2146016 +14254249 +11637994 +14660259 +8506327 +5901539 +8457565 +12841782 +332498 +4905020 +12653963 +11779749 +14883740 +10194414 +11973118 +6999537 +6099962 +12924419 +3464226 +6105439 +8251960 +14813926 +15105104 +7439123 +8214923 +8218956 +9185330 +8247564 +502571 +9870502 +9129103 +16029105 +5316261 +13963606 +14424100 +894636 +13273048 +4025945 +6753246 +14826548 +14100178 +1434033 +10317076 +15827811 +8311555 +7314629 +9501130 +6182785 +3335454 +6629331 +2344681 +11662503 +3395423 +13982993 +1953414 +1752148 +10934306 +5702741 +12759528 +15361768 +791609 +3745574 +4387263 +2100806 +166585 +8534437 +9721961 +12751349 +16232661 +7702349 +12949372 +11100035 +6313660 +610701 +12244193 +10278366 +15545469 +1413657 +14341624 +7449510 +4646031 +12069488 +7469536 +13111942 +7534294 +7454022 +14858461 +15603633 +5926846 +6012049 +5238595 +3475374 +7823745 +15996837 +3798982 +14591152 +11802249 +2824007 +14105900 +9488030 +10064286 diff --git a/2024/day22/test.txt b/2024/day22/test.txt new file mode 100755 index 0000000..201df76 --- /dev/null +++ b/2024/day22/test.txt @@ -0,0 +1,4 @@ +1 +2 +3 +2024