diff options
Diffstat (limited to '2020/day9')
-rw-r--r-- | 2020/day9/input | 1000 | ||||
-rw-r--r-- | 2020/day9/xmas_encoder.pl | 70 |
2 files changed, 1070 insertions, 0 deletions
diff --git a/2020/day9/input b/2020/day9/input new file mode 100644 index 0000000..c27e1a4 --- /dev/null +++ b/2020/day9/input | |||
@@ -0,0 +1,1000 @@ | |||
1 | 30 | ||
2 | 17 | ||
3 | 44 | ||
4 | 5 | ||
5 | 10 | ||
6 | 33 | ||
7 | 19 | ||
8 | 31 | ||
9 | 22 | ||
10 | 25 | ||
11 | 39 | ||
12 | 49 | ||
13 | 1 | ||
14 | 26 | ||
15 | 38 | ||
16 | 36 | ||
17 | 14 | ||
18 | 27 | ||
19 | 15 | ||
20 | 50 | ||
21 | 28 | ||
22 | 41 | ||
23 | 20 | ||
24 | 34 | ||
25 | 18 | ||
26 | 6 | ||
27 | 24 | ||
28 | 16 | ||
29 | 11 | ||
30 | 81 | ||
31 | 7 | ||
32 | 8 | ||
33 | 63 | ||
34 | 65 | ||
35 | 58 | ||
36 | 9 | ||
37 | 109 | ||
38 | 10 | ||
39 | 13 | ||
40 | 26 | ||
41 | 86 | ||
42 | 17 | ||
43 | 57 | ||
44 | 32 | ||
45 | 14 | ||
46 | 15 | ||
47 | 42 | ||
48 | 22 | ||
49 | 21 | ||
50 | 30 | ||
51 | 40 | ||
52 | 39 | ||
53 | 28 | ||
54 | 37 | ||
55 | 20 | ||
56 | 16 | ||
57 | 18 | ||
58 | 24 | ||
59 | 19 | ||
60 | 23 | ||
61 | 35 | ||
62 | 33 | ||
63 | 25 | ||
64 | 56 | ||
65 | 29 | ||
66 | 31 | ||
67 | 34 | ||
68 | 92 | ||
69 | 75 | ||
70 | 64 | ||
71 | 61 | ||
72 | 36 | ||
73 | 38 | ||
74 | 41 | ||
75 | 42 | ||
76 | 78 | ||
77 | 43 | ||
78 | 39 | ||
79 | 44 | ||
80 | 48 | ||
81 | 37 | ||
82 | 97 | ||
83 | 59 | ||
84 | 55 | ||
85 | 62 | ||
86 | 58 | ||
87 | 106 | ||
88 | 105 | ||
89 | 79 | ||
90 | 60 | ||
91 | 87 | ||
92 | 93 | ||
93 | 73 | ||
94 | 114 | ||
95 | 74 | ||
96 | 75 | ||
97 | 149 | ||
98 | 116 | ||
99 | 99 | ||
100 | 108 | ||
101 | 82 | ||
102 | 76 | ||
103 | 162 | ||
104 | 81 | ||
105 | 110 | ||
106 | 118 | ||
107 | 150 | ||
108 | 113 | ||
109 | 220 | ||
110 | 120 | ||
111 | 131 | ||
112 | 133 | ||
113 | 213 | ||
114 | 134 | ||
115 | 142 | ||
116 | 147 | ||
117 | 148 | ||
118 | 196 | ||
119 | 221 | ||
120 | 156 | ||
121 | 151 | ||
122 | 157 | ||
123 | 181 | ||
124 | 175 | ||
125 | 242 | ||
126 | 158 | ||
127 | 186 | ||
128 | 214 | ||
129 | 384 | ||
130 | 233 | ||
131 | 231 | ||
132 | 244 | ||
133 | 251 | ||
134 | 253 | ||
135 | 254 | ||
136 | 352 | ||
137 | 467 | ||
138 | 276 | ||
139 | 281 | ||
140 | 347 | ||
141 | 304 | ||
142 | 299 | ||
143 | 308 | ||
144 | 313 | ||
145 | 307 | ||
146 | 309 | ||
147 | 315 | ||
148 | 475 | ||
149 | 783 | ||
150 | 389 | ||
151 | 575 | ||
152 | 400 | ||
153 | 445 | ||
154 | 464 | ||
155 | 477 | ||
156 | 482 | ||
157 | 624 | ||
158 | 504 | ||
159 | 851 | ||
160 | 622 | ||
161 | 1079 | ||
162 | 923 | ||
163 | 1251 | ||
164 | 704 | ||
165 | 603 | ||
166 | 606 | ||
167 | 795 | ||
168 | 620 | ||
169 | 1158 | ||
170 | 616 | ||
171 | 773 | ||
172 | 715 | ||
173 | 789 | ||
174 | 1477 | ||
175 | 834 | ||
176 | 1794 | ||
177 | 845 | ||
178 | 909 | ||
179 | 941 | ||
180 | 986 | ||
181 | 1318 | ||
182 | 1695 | ||
183 | 1981 | ||
184 | 1209 | ||
185 | 1219 | ||
186 | 1222 | ||
187 | 1223 | ||
188 | 1226 | ||
189 | 1307 | ||
190 | 2304 | ||
191 | 2012 | ||
192 | 1236 | ||
193 | 1549 | ||
194 | 1331 | ||
195 | 1786 | ||
196 | 1488 | ||
197 | 1504 | ||
198 | 2649 | ||
199 | 2272 | ||
200 | 1679 | ||
201 | 3183 | ||
202 | 2727 | ||
203 | 2131 | ||
204 | 2177 | ||
205 | 2195 | ||
206 | 2428 | ||
207 | 2431 | ||
208 | 3667 | ||
209 | 2432 | ||
210 | 2445 | ||
211 | 2905 | ||
212 | 3874 | ||
213 | 2543 | ||
214 | 2567 | ||
215 | 2724 | ||
216 | 2785 | ||
217 | 4862 | ||
218 | 3932 | ||
219 | 3635 | ||
220 | 2992 | ||
221 | 3167 | ||
222 | 4584 | ||
223 | 4563 | ||
224 | 5423 | ||
225 | 5159 | ||
226 | 4308 | ||
227 | 4326 | ||
228 | 4859 | ||
229 | 6521 | ||
230 | 10285 | ||
231 | 6080 | ||
232 | 5110 | ||
233 | 4877 | ||
234 | 4975 | ||
235 | 4988 | ||
236 | 5267 | ||
237 | 5291 | ||
238 | 7895 | ||
239 | 10153 | ||
240 | 7773 | ||
241 | 5777 | ||
242 | 7730 | ||
243 | 6627 | ||
244 | 13196 | ||
245 | 7751 | ||
246 | 10887 | ||
247 | 8892 | ||
248 | 8634 | ||
249 | 9167 | ||
250 | 9185 | ||
251 | 9314 | ||
252 | 9203 | ||
253 | 10126 | ||
254 | 9963 | ||
255 | 9865 | ||
256 | 10255 | ||
257 | 9852 | ||
258 | 10144 | ||
259 | 10242 | ||
260 | 10279 | ||
261 | 16492 | ||
262 | 11068 | ||
263 | 14378 | ||
264 | 12404 | ||
265 | 14944 | ||
266 | 13507 | ||
267 | 16622 | ||
268 | 15261 | ||
269 | 16385 | ||
270 | 16954 | ||
271 | 17526 | ||
272 | 17801 | ||
273 | 17819 | ||
274 | 25695 | ||
275 | 18388 | ||
276 | 18517 | ||
277 | 28796 | ||
278 | 20534 | ||
279 | 19717 | ||
280 | 19996 | ||
281 | 20131 | ||
282 | 20094 | ||
283 | 26734 | ||
284 | 20521 | ||
285 | 24657 | ||
286 | 23472 | ||
287 | 26012 | ||
288 | 41995 | ||
289 | 35392 | ||
290 | 28451 | ||
291 | 33339 | ||
292 | 43119 | ||
293 | 34186 | ||
294 | 47184 | ||
295 | 34773 | ||
296 | 38611 | ||
297 | 35620 | ||
298 | 45729 | ||
299 | 40251 | ||
300 | 62126 | ||
301 | 39811 | ||
302 | 39713 | ||
303 | 58328 | ||
304 | 39848 | ||
305 | 44653 | ||
306 | 43993 | ||
307 | 40615 | ||
308 | 56141 | ||
309 | 55294 | ||
310 | 48129 | ||
311 | 51923 | ||
312 | 61404 | ||
313 | 89480 | ||
314 | 83706 | ||
315 | 61790 | ||
316 | 102321 | ||
317 | 95989 | ||
318 | 68959 | ||
319 | 70393 | ||
320 | 73384 | ||
321 | 74231 | ||
322 | 75333 | ||
323 | 79524 | ||
324 | 79561 | ||
325 | 114846 | ||
326 | 79659 | ||
327 | 80328 | ||
328 | 80463 | ||
329 | 83841 | ||
330 | 84608 | ||
331 | 88744 | ||
332 | 92538 | ||
333 | 100052 | ||
334 | 107217 | ||
335 | 109533 | ||
336 | 113327 | ||
337 | 131797 | ||
338 | 130749 | ||
339 | 179711 | ||
340 | 136021 | ||
341 | 144292 | ||
342 | 172099 | ||
343 | 139352 | ||
344 | 257619 | ||
345 | 272151 | ||
346 | 149564 | ||
347 | 154857 | ||
348 | 159085 | ||
349 | 352479 | ||
350 | 164304 | ||
351 | 159987 | ||
352 | 207269 | ||
353 | 176379 | ||
354 | 168449 | ||
355 | 231890 | ||
356 | 181282 | ||
357 | 244344 | ||
358 | 340548 | ||
359 | 291784 | ||
360 | 276089 | ||
361 | 268184 | ||
362 | 262546 | ||
363 | 275041 | ||
364 | 275373 | ||
365 | 280313 | ||
366 | 283644 | ||
367 | 429877 | ||
368 | 318013 | ||
369 | 304421 | ||
370 | 495405 | ||
371 | 308649 | ||
372 | 366354 | ||
373 | 323389 | ||
374 | 328436 | ||
375 | 324291 | ||
376 | 336366 | ||
377 | 344828 | ||
378 | 491838 | ||
379 | 460233 | ||
380 | 544273 | ||
381 | 425626 | ||
382 | 519385 | ||
383 | 607033 | ||
384 | 543225 | ||
385 | 537587 | ||
386 | 551828 | ||
387 | 642304 | ||
388 | 550414 | ||
389 | 555686 | ||
390 | 641402 | ||
391 | 847646 | ||
392 | 613070 | ||
393 | 805061 | ||
394 | 627810 | ||
395 | 632038 | ||
396 | 632940 | ||
397 | 659755 | ||
398 | 647680 | ||
399 | 972638 | ||
400 | 660657 | ||
401 | 681194 | ||
402 | 895242 | ||
403 | 1099959 | ||
404 | 1073303 | ||
405 | 1230687 | ||
406 | 1479684 | ||
407 | 1056972 | ||
408 | 1080812 | ||
409 | 1089415 | ||
410 | 1168756 | ||
411 | 1811060 | ||
412 | 1210169 | ||
413 | 1293597 | ||
414 | 1183496 | ||
415 | 2458740 | ||
416 | 1246010 | ||
417 | 1508312 | ||
418 | 1259848 | ||
419 | 2597727 | ||
420 | 1620318 | ||
421 | 1737095 | ||
422 | 1905765 | ||
423 | 1328874 | ||
424 | 1341851 | ||
425 | 1555899 | ||
426 | 1576436 | ||
427 | 1984657 | ||
428 | 2146387 | ||
429 | 2130275 | ||
430 | 2137784 | ||
431 | 2900475 | ||
432 | 2170227 | ||
433 | 2352252 | ||
434 | 2258171 | ||
435 | 3356556 | ||
436 | 2393665 | ||
437 | 2836284 | ||
438 | 2983105 | ||
439 | 4428398 | ||
440 | 2884773 | ||
441 | 2505858 | ||
442 | 3518019 | ||
443 | 3430075 | ||
444 | 2670725 | ||
445 | 2897750 | ||
446 | 3890422 | ||
447 | 3461664 | ||
448 | 4758949 | ||
449 | 5335357 | ||
450 | 3132335 | ||
451 | 4122441 | ||
452 | 5967522 | ||
453 | 4268059 | ||
454 | 4300502 | ||
455 | 6558673 | ||
456 | 4522479 | ||
457 | 9429186 | ||
458 | 8319774 | ||
459 | 4651836 | ||
460 | 5176583 | ||
461 | 4899523 | ||
462 | 7251164 | ||
463 | 5390631 | ||
464 | 5568475 | ||
465 | 5403608 | ||
466 | 5935933 | ||
467 | 8012863 | ||
468 | 5803060 | ||
469 | 7549586 | ||
470 | 6030085 | ||
471 | 6593999 | ||
472 | 7254776 | ||
473 | 8919895 | ||
474 | 7400394 | ||
475 | 9477085 | ||
476 | 8390500 | ||
477 | 14832794 | ||
478 | 9422002 | ||
479 | 8822981 | ||
480 | 9174315 | ||
481 | 9551359 | ||
482 | 9828419 | ||
483 | 13496357 | ||
484 | 11770582 | ||
485 | 14598585 | ||
486 | 10290154 | ||
487 | 10794239 | ||
488 | 11738993 | ||
489 | 10972083 | ||
490 | 17674926 | ||
491 | 11833145 | ||
492 | 12397059 | ||
493 | 12624084 | ||
494 | 13284861 | ||
495 | 13430479 | ||
496 | 14984499 | ||
497 | 15645276 | ||
498 | 15790894 | ||
499 | 16574709 | ||
500 | 28263273 | ||
501 | 40660332 | ||
502 | 22046086 | ||
503 | 54156689 | ||
504 | 17997296 | ||
505 | 22564821 | ||
506 | 19379778 | ||
507 | 21567412 | ||
508 | 21084393 | ||
509 | 33306405 | ||
510 | 21262237 | ||
511 | 21766322 | ||
512 | 22533232 | ||
513 | 54390798 | ||
514 | 22805228 | ||
515 | 43028559 | ||
516 | 24230204 | ||
517 | 26715340 | ||
518 | 25908945 | ||
519 | 28269360 | ||
520 | 28414978 | ||
521 | 41425864 | ||
522 | 31436170 | ||
523 | 50461064 | ||
524 | 39259533 | ||
525 | 42227500 | ||
526 | 37377074 | ||
527 | 39081689 | ||
528 | 39564708 | ||
529 | 45492441 | ||
530 | 40464171 | ||
531 | 40642015 | ||
532 | 44100644 | ||
533 | 42346630 | ||
534 | 59910306 | ||
535 | 61025855 | ||
536 | 44299554 | ||
537 | 50948210 | ||
538 | 63447243 | ||
539 | 86447274 | ||
540 | 54323923 | ||
541 | 50139149 | ||
542 | 52624285 | ||
543 | 59851148 | ||
544 | 56684338 | ||
545 | 72515622 | ||
546 | 70517859 | ||
547 | 83360177 | ||
548 | 83381243 | ||
549 | 78019089 | ||
550 | 76458763 | ||
551 | 77841245 | ||
552 | 78646397 | ||
553 | 130465530 | ||
554 | 84763725 | ||
555 | 95247764 | ||
556 | 84742659 | ||
557 | 86646184 | ||
558 | 93294840 | ||
559 | 109308623 | ||
560 | 111165004 | ||
561 | 136586423 | ||
562 | 101087359 | ||
563 | 102763434 | ||
564 | 123142144 | ||
565 | 104463072 | ||
566 | 106823487 | ||
567 | 112475433 | ||
568 | 116535486 | ||
569 | 133143101 | ||
570 | 148359104 | ||
571 | 155105160 | ||
572 | 155860334 | ||
573 | 154300008 | ||
574 | 154477852 | ||
575 | 197239158 | ||
576 | 156487642 | ||
577 | 187506093 | ||
578 | 197218092 | ||
579 | 191587212 | ||
580 | 219298920 | ||
581 | 171388843 | ||
582 | 199121617 | ||
583 | 223358973 | ||
584 | 220473627 | ||
585 | 203850793 | ||
586 | 205550431 | ||
587 | 207226506 | ||
588 | 323761992 | ||
589 | 235617577 | ||
590 | 211286559 | ||
591 | 344429660 | ||
592 | 229010919 | ||
593 | 374951479 | ||
594 | 404672048 | ||
595 | 302659112 | ||
596 | 353078426 | ||
597 | 312347976 | ||
598 | 401089951 | ||
599 | 310965494 | ||
600 | 353726800 | ||
601 | 360338435 | ||
602 | 370510460 | ||
603 | 382675402 | ||
604 | 362976055 | ||
605 | 423149713 | ||
606 | 375239636 | ||
607 | 434739194 | ||
608 | 409401224 | ||
609 | 673941549 | ||
610 | 518192000 | ||
611 | 412776937 | ||
612 | 783765353 | ||
613 | 440297478 | ||
614 | 446904136 | ||
615 | 646025753 | ||
616 | 400480901 | ||
617 | 687587612 | ||
618 | 783156303 | ||
619 | 613624606 | ||
620 | 615007088 | ||
621 | 623313470 | ||
622 | 975345523 | ||
623 | 664692294 | ||
624 | 720366718 | ||
625 | 714065235 | ||
626 | 1036774319 | ||
627 | 733486515 | ||
628 | 772377279 | ||
629 | 875036672 | ||
630 | 775720537 | ||
631 | 840778379 | ||
632 | 809882125 | ||
633 | 847385037 | ||
634 | 813257838 | ||
635 | 1616498916 | ||
636 | 853074415 | ||
637 | 887201614 | ||
638 | 1014105507 | ||
639 | 1310718047 | ||
640 | 1023794371 | ||
641 | 1015487989 | ||
642 | 1310901082 | ||
643 | 1228631694 | ||
644 | 1236938076 | ||
645 | 1238320558 | ||
646 | 1378757529 | ||
647 | 1942696929 | ||
648 | 1385059012 | ||
649 | 1453853233 | ||
650 | 1700459452 | ||
651 | 2510341577 | ||
652 | 1505863794 | ||
653 | 1548097816 | ||
654 | 1588978375 | ||
655 | 1623105574 | ||
656 | 1623139963 | ||
657 | 2198102696 | ||
658 | 1876868786 | ||
659 | 2429756754 | ||
660 | 2125522172 | ||
661 | 1740276029 | ||
662 | 2253808547 | ||
663 | 2029593496 | ||
664 | 3094842169 | ||
665 | 3408351025 | ||
666 | 2244119683 | ||
667 | 2465569770 | ||
668 | 2466952252 | ||
669 | 2475258634 | ||
670 | 2617078087 | ||
671 | 2763816541 | ||
672 | 2933156828 | ||
673 | 3171237779 | ||
674 | 2959717027 | ||
675 | 5426669279 | ||
676 | 5338961852 | ||
677 | 3053961610 | ||
678 | 4815180783 | ||
679 | 3329254404 | ||
680 | 3246245537 | ||
681 | 3363415992 | ||
682 | 3769869525 | ||
683 | 5046834841 | ||
684 | 3865798201 | ||
685 | 4357354116 | ||
686 | 6013678637 | ||
687 | 4273713179 | ||
688 | 5203836710 | ||
689 | 4709689453 | ||
690 | 4711071935 | ||
691 | 4719378317 | ||
692 | 4932522022 | ||
693 | 6288971431 | ||
694 | 5092336721 | ||
695 | 6296572820 | ||
696 | 5696973369 | ||
697 | 5892873855 | ||
698 | 6130954806 | ||
699 | 12189446675 | ||
700 | 7133285517 | ||
701 | 6300207147 | ||
702 | 6383216014 | ||
703 | 6575499941 | ||
704 | 6609661529 | ||
705 | 7016115062 | ||
706 | 7635667726 | ||
707 | 8043582704 | ||
708 | 12193081002 | ||
709 | 10849213120 | ||
710 | 8631067295 | ||
711 | 8983402632 | ||
712 | 8984785114 | ||
713 | 10024858743 | ||
714 | 9429067770 | ||
715 | 9430450252 | ||
716 | 12431161953 | ||
717 | 15558902573 | ||
718 | 10789310090 | ||
719 | 10985210576 | ||
720 | 11589847224 | ||
721 | 11827928175 | ||
722 | 12023828661 | ||
723 | 22379157314 | ||
724 | 12683423161 | ||
725 | 12875707088 | ||
726 | 12909868676 | ||
727 | 16040111781 | ||
728 | 14211167667 | ||
729 | 21614705967 | ||
730 | 23860917664 | ||
731 | 34650227754 | ||
732 | 16674649999 | ||
733 | 39901029445 | ||
734 | 20814168833 | ||
735 | 17614469927 | ||
736 | 17968187746 | ||
737 | 24273270385 | ||
738 | 29558034970 | ||
739 | 18859518022 | ||
740 | 33527090319 | ||
741 | 22617238265 | ||
742 | 23417775399 | ||
743 | 24703635263 | ||
744 | 22575057800 | ||
745 | 23613675885 | ||
746 | 23851756836 | ||
747 | 24899535749 | ||
748 | 54341259152 | ||
749 | 25559130249 | ||
750 | 41887740312 | ||
751 | 27121036343 | ||
752 | 81788769757 | ||
753 | 30885817666 | ||
754 | 34289119926 | ||
755 | 42318105190 | ||
756 | 35534168021 | ||
757 | 34642837745 | ||
758 | 42711274858 | ||
759 | 41466226763 | ||
760 | 35582657673 | ||
761 | 83784331953 | ||
762 | 41434575822 | ||
763 | 97052534010 | ||
764 | 52386608341 | ||
765 | 47031451284 | ||
766 | 82614108957 | ||
767 | 45992833199 | ||
768 | 52020572092 | ||
769 | 65501416197 | ||
770 | 81674289029 | ||
771 | 48751292585 | ||
772 | 50458665998 | ||
773 | 52680166592 | ||
774 | 84177501621 | ||
775 | 79507644684 | ||
776 | 76968743843 | ||
777 | 77017233495 | ||
778 | 68931957671 | ||
779 | 113796764610 | ||
780 | 70177005766 | ||
781 | 70225495418 | ||
782 | 76109064508 | ||
783 | 77048884436 | ||
784 | 81575490872 | ||
785 | 84333950258 | ||
786 | 149684650450 | ||
787 | 88466027106 | ||
788 | 93024284483 | ||
789 | 130170334820 | ||
790 | 116169838965 | ||
791 | 94744125784 | ||
792 | 104700738684 | ||
793 | 102479238090 | ||
794 | 149733140102 | ||
795 | 128789231100 | ||
796 | 99209958583 | ||
797 | 164921131550 | ||
798 | 122905662010 | ||
799 | 169993028326 | ||
800 | 169386964349 | ||
801 | 139157453089 | ||
802 | 139108963437 | ||
803 | 223442913695 | ||
804 | 164575091614 | ||
805 | 140402501184 | ||
806 | 195503522573 | ||
807 | 153157948944 | ||
808 | 197223363874 | ||
809 | 238199167208 | ||
810 | 183210152890 | ||
811 | 181490311589 | ||
812 | 187675985689 | ||
813 | 292315402033 | ||
814 | 193954084367 | ||
815 | 201689196673 | ||
816 | 199444864468 | ||
817 | 207179976774 | ||
818 | 279511464621 | ||
819 | 322743315467 | ||
820 | 222115620593 | ||
821 | 238318922020 | ||
822 | 262014625447 | ||
823 | 363947112693 | ||
824 | 278266416526 | ||
825 | 500213792655 | ||
826 | 304977592798 | ||
827 | 321892812773 | ||
828 | 293560450128 | ||
829 | 352251077303 | ||
830 | 323612654074 | ||
831 | 380935176057 | ||
832 | 347112033311 | ||
833 | 460434542613 | ||
834 | 369166297278 | ||
835 | 364700464479 | ||
836 | 387120850157 | ||
837 | 381630070056 | ||
838 | 393398948835 | ||
839 | 423804817266 | ||
840 | 566389661152 | ||
841 | 477711280994 | ||
842 | 445498898794 | ||
843 | 484130246040 | ||
844 | 500333547467 | ||
845 | 500382037119 | ||
846 | 531879372148 | ||
847 | 540281041973 | ||
848 | 921216218030 | ||
849 | 615453262901 | ||
850 | 598538042926 | ||
851 | 770916850577 | ||
852 | 617173104202 | ||
853 | 784047196687 | ||
854 | 913501694463 | ||
855 | 704547830131 | ||
856 | 711812497790 | ||
857 | 1000715584586 | ||
858 | 751821314636 | ||
859 | 901516098260 | ||
860 | 746330534535 | ||
861 | 1093442567846 | ||
862 | 775029018891 | ||
863 | 817203766101 | ||
864 | 924186854385 | ||
865 | 923210179788 | ||
866 | 929629144834 | ||
867 | 945880935913 | ||
868 | 1445381066611 | ||
869 | 1157454146175 | ||
870 | 1032261409267 | ||
871 | 1130417415074 | ||
872 | 1401220300889 | ||
873 | 1215711147128 | ||
874 | 1213991305827 | ||
875 | 1388089954779 | ||
876 | 1321720934333 | ||
877 | 1363503638737 | ||
878 | 1416360327921 | ||
879 | 1450878364666 | ||
880 | 1456369144767 | ||
881 | 1698239198679 | ||
882 | 1592232784992 | ||
883 | 2722941235222 | ||
884 | 1741390620486 | ||
885 | 2672080291895 | ||
886 | 1699215873276 | ||
887 | 2138532657628 | ||
888 | 1763084702014 | ||
889 | 1847397034173 | ||
890 | 1852839324622 | ||
891 | 4060170246674 | ||
892 | 1978142345180 | ||
893 | 2162678824341 | ||
894 | 2189715555442 | ||
895 | 2664869670493 | ||
896 | 2344408720901 | ||
897 | 3303717689288 | ||
898 | 2429702452955 | ||
899 | 3403706861269 | ||
900 | 2685224573070 | ||
901 | 2738081262254 | ||
902 | 3104894259223 | ||
903 | 2872729472688 | ||
904 | 2907247509433 | ||
905 | 3594901802395 | ||
906 | 3887954754121 | ||
907 | 5652403031666 | ||
908 | 4384440446346 | ||
909 | 4568235110583 | ||
910 | 3462300575290 | ||
911 | 3546612907449 | ||
912 | 7979342248741 | ||
913 | 3610481736187 | ||
914 | 4015518148963 | ||
915 | 6237279770968 | ||
916 | 4140821169521 | ||
917 | 5610810734942 | ||
918 | 6295706309257 | ||
919 | 4534124276343 | ||
920 | 5790118832293 | ||
921 | 5977623731911 | ||
922 | 5167783715209 | ||
923 | 6795202263554 | ||
924 | 6147525148360 | ||
925 | 7291687955779 | ||
926 | 6419342380137 | ||
927 | 8757297290889 | ||
928 | 8129026078738 | ||
929 | 6369548084723 | ||
930 | 9699580346258 | ||
931 | 7625999885150 | ||
932 | 7008913482739 | ||
933 | 14084020792604 | ||
934 | 11363437374137 | ||
935 | 7072782311477 | ||
936 | 7157094643636 | ||
937 | 7751302905708 | ||
938 | 9183301864172 | ||
939 | 11400929567235 | ||
940 | 8674945445864 | ||
941 | 10511748008254 | ||
942 | 9701907991552 | ||
943 | 11537331799932 | ||
944 | 10903672361066 | ||
945 | 10957902547502 | ||
946 | 17684856948292 | ||
947 | 11315308863569 | ||
948 | 13214544643691 | ||
949 | 13773525033510 | ||
950 | 13378461567462 | ||
951 | 12788890464860 | ||
952 | 13442330396200 | ||
953 | 13526642728359 | ||
954 | 14698782196627 | ||
955 | 14824085217185 | ||
956 | 14166008126375 | ||
957 | 14229876955113 | ||
958 | 14908397549344 | ||
959 | 19695049872426 | ||
960 | 16774690303029 | ||
961 | 15832040089500 | ||
962 | 16426248351572 | ||
963 | 18376853437416 | ||
964 | 19186693454118 | ||
965 | 30530822286127 | ||
966 | 20213655999806 | ||
967 | 20605580352618 | ||
968 | 22441004160998 | ||
969 | 21861574908568 | ||
970 | 22273211411071 | ||
971 | 24529853507260 | ||
972 | 35651672978533 | ||
973 | 28038629860876 | ||
974 | 26167352032322 | ||
975 | 28620930554360 | ||
976 | 26231220861060 | ||
977 | 56762043147187 | ||
978 | 28225424924986 | ||
979 | 28395885081488 | ||
980 | 30592256477947 | ||
981 | 36121298223998 | ||
982 | 29138274504457 | ||
983 | 30740437638844 | ||
984 | 35527089961926 | ||
985 | 33200938654601 | ||
986 | 40650064848487 | ||
987 | 34803101788988 | ||
988 | 39400349453924 | ||
989 | 39792273806736 | ||
990 | 58756247211113 | ||
991 | 40819236352424 | ||
992 | 46836801213678 | ||
993 | 44134786319639 | ||
994 | 46391428415828 | ||
995 | 46803064918331 | ||
996 | 75319363768662 | ||
997 | 54205981893198 | ||
998 | 52398572893382 | ||
999 | 54392776957308 | ||
1000 | 59213187032307 | ||
diff --git a/2020/day9/xmas_encoder.pl b/2020/day9/xmas_encoder.pl new file mode 100644 index 0000000..4fdcb9b --- /dev/null +++ b/2020/day9/xmas_encoder.pl | |||
@@ -0,0 +1,70 @@ | |||
1 | use strict; | ||
2 | use warnings; | ||
3 | use DDP; | ||
4 | use Smart::Comments; | ||
5 | use Tie::File; | ||
6 | use List::Util qw(min max); | ||
7 | |||
8 | tie my @xmas, 'Tie::File', "input" or die "no input present, $!"; | ||
9 | |||
10 | my %preamble; | ||
11 | # because it's easier this way trust me | ||
12 | my @also_queue; | ||
13 | my $goalnum; | ||
14 | |||
15 | foreach my $idx (0 .. $#xmas) { | ||
16 | if ($idx < 25) { | ||
17 | my $t = int($xmas[$idx]); | ||
18 | $preamble{$t} = 1; | ||
19 | push @also_queue, $t; | ||
20 | } else { | ||
21 | my $nextnum = int($xmas[$idx]); | ||
22 | my $tester = 0; | ||
23 | foreach my $num (keys %preamble) { | ||
24 | $tester++; | ||
25 | if (exists $preamble{$nextnum - $num}) { | ||
26 | my $old = shift @also_queue; | ||
27 | delete $preamble{$old}; | ||
28 | push @also_queue, $nextnum; | ||
29 | $preamble{$nextnum} = 1; | ||
30 | last; | ||
31 | } | ||
32 | } | ||
33 | |||
34 | if (not scalar grep { $_ == $nextnum } @also_queue) { | ||
35 | $goalnum = $nextnum; | ||
36 | print("XMAS weak num: $goalnum\n"); | ||
37 | last; | ||
38 | } | ||
39 | } | ||
40 | } | ||
41 | |||
42 | # find the contiguous set | ||
43 | |||
44 | my @contiguous; | ||
45 | my $total = 0; | ||
46 | |||
47 | foreach my $curr (@xmas) { | ||
48 | if ($total + $curr < $goalnum) { | ||
49 | $total += $curr; | ||
50 | push @contiguous, $curr; | ||
51 | } elsif ($total + $curr > $goalnum) { | ||
52 | while ($total + $curr > $goalnum) { | ||
53 | my $evictee = shift @contiguous; | ||
54 | if (not defined $evictee) { | ||
55 | last; | ||
56 | } | ||
57 | $total -= $evictee; | ||
58 | } | ||
59 | push @contiguous, $curr; | ||
60 | $total += $curr; | ||
61 | } | ||
62 | |||
63 | if ($total == $goalnum) { | ||
64 | print(min(@contiguous) + max(@contiguous)); | ||
65 | p @contiguous; | ||
66 | exit; | ||
67 | } | ||
68 | } | ||
69 | |||
70 | untie @xmas; | ||