Compare commits

...

65 Commits

Author SHA1 Message Date
Mikaël Capelle
2fb65387f7 Backup local 2022 day 16. 2023-12-05 20:16:27 +01:00
Mikael CAPELLE
8dbf0f101c 2023 day 5. 2023-12-05 13:41:17 +01:00
Mikaël Capelle
b8d8df06d6 2023 day 5 part 1. 2023-12-05 07:22:56 +01:00
Mikaël Capelle
825ebea299 Prepare 2023 days. 2023-12-04 19:32:41 +01:00
Mikaël Capelle
869cd4477f 2023 day 4. 2023-12-04 19:30:44 +01:00
Mikaël Capelle
fd777627d6 2023 day 3. 2023-12-03 09:09:25 +01:00
Mikaël Capelle
98f605f30e 2023 day 2. 2023-12-02 09:47:52 +01:00
Mikaël Capelle
d51fed283c Fix 2023 day 1. 2023-12-01 20:27:42 +01:00
Mikael CAPELLE
e991cd8b04 2023: Day 1. 2023-12-01 10:41:13 +01:00
Mikael CAPELLE
10f67e6bfd Post-christmas cleaning. 2023-01-06 13:48:18 +01:00
Mikaël Capelle
f291b0aa3f Day 25. 2022-12-25 11:34:49 +01:00
Mikaël Capelle
0eb5b5a88f Faster day 24. 2022-12-24 23:00:14 +01:00
Mikaël Capelle
2ec0a3d5f9 Day 24. 2022-12-24 20:50:37 +01:00
Mikael CAPELLE
0327a3f36a Add day 23. 2022-12-23 13:25:22 +01:00
Mikaël Capelle
3732e70ef7 Ugly day 22. 2022-12-22 23:00:36 +01:00
Mikaël Capelle
b0cc6b4a46 Update day 22. 2022-12-22 18:46:59 +01:00
Mikael CAPELLE
8c24b9f9e2 Update day 22. 2022-12-22 17:22:56 +01:00
Mikael CAPELLE
dca6f6a08f Update day 22. 2022-12-22 17:00:09 +01:00
Mikael CAPELLE
8d7a20f575 Day 22 part 1. 2022-12-22 14:10:30 +01:00
Mikael CAPELLE
3934dfd152 Start day 22. 2022-12-22 08:20:09 +01:00
Mikael CAPELLE
b656e8929e Remove tqdm from day 19. 2022-12-21 17:39:43 +01:00
Mikael CAPELLE
c9c69f479b Day 21. 2022-12-21 09:44:05 +01:00
Mikaël Capelle
72ebcfff1f Clean day 20. 2022-12-20 23:39:26 +01:00
Mikaël Capelle
dd72bb3238 Add empty files for following days. 2022-12-20 21:51:38 +01:00
Mikael CAPELLE
c1dd74c57d Faster day 20. 2022-12-20 18:27:09 +01:00
Mikael CAPELLE
1bf2de62c7 Day 20, slow. 2022-12-20 13:39:36 +01:00
Mikael CAPELLE
df808bc98a Start day 20. 2022-12-20 12:35:01 +01:00
Mikaël Capelle
f46e190e98 Add all tests from previous days. 2022-12-19 22:32:15 +01:00
Mikaël Capelle
7f4a34b2d7 Day 19. 2022-12-19 22:09:20 +01:00
Mikael CAPELLE
ddebd26db2 Tmp 2022-12-19 18:46:16 +01:00
Mikael CAPELLE
01300e23b2 Start working on day 19. 2022-12-19 13:51:32 +01:00
Mikaël Capelle
b8e2faa8c9 Clean day 17. 2022-12-18 16:46:00 +01:00
Mikaël Capelle
ea5b757180 Day 18. 2022-12-18 09:57:35 +01:00
Mikaël Capelle
89a71c175f Day 17. 2022-12-17 12:27:05 +01:00
Mikaël Capelle
9ffb332dea Day 17. 2022-12-17 12:25:48 +01:00
Mikaël Capelle
8167ab34c7 Less BFS for day 16. 2022-12-16 22:56:34 +01:00
Mikaël Capelle
100df02a09 Better day 16. 2022-12-16 22:52:03 +01:00
Mikael CAPELLE
15b987a590 Update ugly day 16. 2022-12-16 18:40:21 +01:00
Mikael CAPELLE
b1578f5709 Add ugly day 16, to be improved... 2022-12-16 09:21:54 +01:00
Mikael CAPELLE
d80dbb6c7c Update day 15. 2022-12-15 14:17:04 +01:00
Mikael CAPELLE
b679c1f895 Add day 15. 2022-12-15 09:36:19 +01:00
Mikael CAPELLE
e9d5f9747b Add day 14. 2022-12-14 09:29:56 +01:00
Mikael CAPELLE
fe3aad7ddd Clean day 9. 2022-12-13 11:18:31 +01:00
Mikael CAPELLE
7ac9981ae5 Clean day 13. 2022-12-13 08:59:53 +01:00
Mikael CAPELLE
652756a341 Add day 13. 2022-12-13 08:54:15 +01:00
Mikael CAPELLE
c7ef505f1b Clean day 12. 2022-12-12 17:55:24 +01:00
Mikael CAPELLE
c55f6ac8e1 One to many Dijkstra. 2022-12-12 17:50:48 +01:00
Mikael CAPELLE
726a6aecac Generic Dijkstra for day 12. 2022-12-12 15:59:19 +01:00
Mikael CAPELLE
291b188238 Clean day 12. 2022-12-12 10:48:37 +01:00
Mikael CAPELLE
289e3b7d02 Add day 12. 2022-12-12 09:35:12 +01:00
Mikaël Capelle
9820765e9c Clean monkey code. 2022-12-11 11:50:23 +01:00
Mikaël Capelle
c6522de8a2 Add day 11. 2022-12-11 11:42:47 +01:00
Mikaël Capelle
80465e5e53 Add day 10. 2022-12-10 10:24:23 +01:00
Mikaël Capelle
af1428b5e1 Add day 9. 2022-12-09 10:45:00 +01:00
Mikael CAPELLE
fca283527d Add 2022 day 8. 2022-12-08 08:59:25 +01:00
Mikael CAPELLE
0d37458ec5 Add 2021 day 5. 2022-12-07 18:41:39 +01:00
Mikael CAPELLE
198927e4a3 Add day 7. 2022-12-07 09:28:06 +01:00
Mikael CAPELLE
4192c98bba Cleaning. 2022-12-06 15:28:46 +01:00
Mikael CAPELLE
7cb8317659 Add day 6. 2022-12-06 09:03:22 +01:00
Mikaël Capelle
f46cb51c60 Add day 4. 2022-12-05 19:09:55 +01:00
Mikael CAPELLE
261a396ae7 Add day 5. 2022-12-05 08:58:25 +01:00
Mikaël Capelle
4b3af377ab Day 3. 2022-12-03 11:42:09 +01:00
Mikael CAPELLE
f697415ef2 More comments. 2022-12-02 15:06:37 +01:00
Mikael CAPELLE
ac2806b0fb Comments. 2022-12-02 09:21:38 +01:00
Mikael CAPELLE
c62b8abfd0 Day 2. 2022-12-02 09:12:49 +01:00
155 changed files with 23266 additions and 15 deletions

52
2021/day5.py Normal file
View File

@ -0,0 +1,52 @@
# -*- encoding: utf-8 -*-
import sys
from collections import defaultdict
import numpy as np
lines: list[str] = sys.stdin.read().splitlines()
sections: list[tuple[tuple[int, int], tuple[int, int]]] = [
(
(
int(line.split(" -> ")[0].split(",")[0]),
int(line.split(" -> ")[0].split(",")[1]),
),
(
int(line.split(" -> ")[1].split(",")[0]),
int(line.split(" -> ")[1].split(",")[1]),
),
)
for line in lines
]
np_sections = np.array(sections).reshape(-1, 4)
x_min, x_max, y_min, y_max = (
min(np_sections[:, 0].min(), np_sections[:, 2].min()),
max(np_sections[:, 0].max(), np_sections[:, 2].max()),
min(np_sections[:, 1].min(), np_sections[:, 3].min()),
max(np_sections[:, 1].max(), np_sections[:, 3].max()),
)
counts_1 = np.zeros((y_max + 1, x_max + 1), dtype=int)
counts_2 = counts_1.copy()
for (x1, y1), (x2, y2) in sections:
x_rng = range(x1, x2 + 1, 1) if x2 >= x1 else range(x1, x2 - 1, -1)
y_rng = range(y1, y2 + 1, 1) if y2 >= y1 else range(y1, y2 - 1, -1)
if x1 == x2 or y1 == y2:
counts_1[list(y_rng), list(x_rng)] += 1
counts_2[list(y_rng), list(x_rng)] += 1
elif abs(x2 - x1) == abs(y2 - y1):
for i, j in zip(y_rng, x_rng):
counts_2[i, j] += 1
answer_1 = (counts_1 >= 2).sum()
print(f"answer 1 is {answer_1}")
answer_2 = (counts_2 >= 2).sum()
print(f"answer 2 is {answer_2}")

500
2021/inputs/day5.txt Normal file
View File

@ -0,0 +1,500 @@
657,934 -> 657,926
130,34 -> 570,474
478,716 -> 226,464
861,110 -> 861,167
448,831 -> 370,831
75,738 -> 390,738
26,880 -> 864,42
965,658 -> 527,220
208,381 -> 80,381
523,475 -> 807,475
219,69 -> 219,434
793,538 -> 534,797
754,602 -> 754,148
443,327 -> 443,611
606,395 -> 546,395
980,56 -> 51,985
619,325 -> 354,325
342,123 -> 819,600
290,533 -> 374,533
598,77 -> 598,75
605,302 -> 605,636
97,981 -> 692,386
278,779 -> 278,800
661,377 -> 661,10
726,108 -> 518,316
271,883 -> 271,50
382,271 -> 606,271
963,358 -> 891,286
496,880 -> 496,855
211,142 -> 211,49
841,866 -> 260,285
841,849 -> 173,181
927,326 -> 391,862
396,558 -> 459,558
753,183 -> 953,183
941,698 -> 941,407
347,612 -> 347,476
18,340 -> 18,612
140,299 -> 797,956
714,907 -> 714,228
966,155 -> 194,927
769,674 -> 712,674
644,675 -> 948,979
703,872 -> 812,763
26,629 -> 120,535
844,738 -> 844,253
798,133 -> 798,795
27,318 -> 288,57
38,545 -> 872,545
827,351 -> 195,983
818,45 -> 21,842
257,559 -> 626,928
145,925 -> 886,184
83,618 -> 590,111
326,243 -> 53,243
489,278 -> 526,278
783,693 -> 783,525
495,636 -> 495,585
374,716 -> 215,557
839,536 -> 839,966
850,468 -> 955,468
55,799 -> 55,447
472,722 -> 296,898
390,731 -> 120,461
405,493 -> 208,296
807,42 -> 56,793
476,327 -> 655,327
24,965 -> 967,22
776,211 -> 776,850
489,20 -> 822,20
630,740 -> 871,499
743,493 -> 283,953
62,429 -> 62,720
806,270 -> 806,332
550,154 -> 107,597
71,713 -> 533,251
620,575 -> 620,156
726,829 -> 143,246
944,553 -> 468,553
185,582 -> 185,468
845,266 -> 212,899
654,97 -> 265,486
726,609 -> 726,147
631,76 -> 860,76
835,24 -> 928,24
712,719 -> 74,81
616,478 -> 616,117
903,226 -> 903,577
440,699 -> 136,395
215,705 -> 890,30
20,24 -> 981,985
102,144 -> 850,892
695,967 -> 582,967
219,284 -> 219,388
359,833 -> 665,833
389,55 -> 305,55
59,32 -> 957,930
815,198 -> 64,949
699,540 -> 717,558
215,682 -> 182,682
805,489 -> 328,489
43,546 -> 578,546
489,181 -> 489,363
266,391 -> 266,582
863,368 -> 448,368
83,236 -> 83,487
874,875 -> 874,413
799,90 -> 799,802
253,29 -> 253,905
136,446 -> 435,745
830,534 -> 550,534
183,785 -> 107,785
81,517 -> 159,517
359,941 -> 359,560
71,546 -> 948,546
596,811 -> 596,791
255,960 -> 255,159
788,15 -> 788,682
240,55 -> 240,244
51,423 -> 137,423
504,418 -> 809,723
131,842 -> 914,59
727,790 -> 82,145
281,509 -> 841,509
797,807 -> 834,807
333,499 -> 790,499
215,328 -> 215,139
500,898 -> 500,862
75,217 -> 777,919
17,264 -> 17,446
852,755 -> 150,755
865,186 -> 385,186
158,192 -> 158,733
196,261 -> 196,128
989,960 -> 131,102
807,393 -> 807,153
507,579 -> 507,764
468,76 -> 535,76
381,357 -> 659,357
794,277 -> 749,277
51,152 -> 546,647
797,959 -> 458,959
82,156 -> 967,156
261,624 -> 460,624
597,53 -> 197,53
153,507 -> 411,765
305,717 -> 768,717
344,954 -> 344,217
194,432 -> 545,432
346,46 -> 557,46
685,599 -> 685,312
49,719 -> 49,631
499,668 -> 304,863
262,405 -> 554,405
87,64 -> 295,64
859,675 -> 74,675
663,776 -> 99,212
232,189 -> 232,904
777,276 -> 703,276
704,492 -> 86,492
142,736 -> 514,364
418,611 -> 224,417
602,571 -> 602,424
152,603 -> 248,603
915,673 -> 143,673
538,32 -> 128,32
975,885 -> 975,344
870,511 -> 870,756
330,798 -> 46,798
440,195 -> 587,195
739,237 -> 568,66
54,838 -> 196,980
370,556 -> 47,556
124,575 -> 748,575
261,283 -> 880,902
784,91 -> 426,449
764,670 -> 148,670
32,51 -> 967,986
807,906 -> 10,906
470,488 -> 579,597
274,649 -> 285,649
221,540 -> 221,94
914,957 -> 914,510
879,825 -> 145,91
438,833 -> 438,775
191,844 -> 911,124
145,763 -> 595,763
504,81 -> 622,199
834,206 -> 834,704
908,308 -> 815,308
929,567 -> 929,322
805,50 -> 620,235
36,409 -> 133,312
345,375 -> 19,701
468,948 -> 468,108
109,547 -> 446,547
929,916 -> 69,56
927,857 -> 318,248
833,948 -> 833,61
559,787 -> 559,982
293,825 -> 293,775
508,744 -> 545,744
827,713 -> 753,639
88,775 -> 555,775
523,812 -> 684,812
307,142 -> 307,265
636,40 -> 355,321
891,875 -> 891,25
301,423 -> 712,12
922,187 -> 219,890
45,447 -> 230,262
114,568 -> 233,687
573,398 -> 677,398
334,101 -> 324,101
957,277 -> 957,652
943,834 -> 610,834
523,632 -> 523,379
958,361 -> 90,361
408,824 -> 380,824
647,314 -> 647,449
747,83 -> 59,83
776,104 -> 937,104
16,984 -> 989,11
362,581 -> 362,226
72,962 -> 940,94
319,877 -> 319,122
310,206 -> 986,882
794,877 -> 267,877
855,58 -> 976,58
699,971 -> 598,971
162,556 -> 162,440
494,859 -> 494,255
794,210 -> 142,862
275,510 -> 548,510
739,592 -> 739,793
376,985 -> 376,990
755,264 -> 280,739
187,34 -> 187,688
770,827 -> 770,548
10,68 -> 913,971
571,427 -> 571,944
153,211 -> 153,560
976,972 -> 55,51
103,611 -> 674,40
95,972 -> 924,143
929,94 -> 38,985
777,330 -> 60,330
312,430 -> 312,326
549,433 -> 269,433
477,267 -> 477,403
598,375 -> 19,375
512,799 -> 512,831
348,700 -> 348,43
165,97 -> 63,199
38,835 -> 38,828
282,334 -> 282,909
14,891 -> 390,515
930,657 -> 334,61
630,341 -> 630,85
671,464 -> 319,112
949,340 -> 894,285
663,916 -> 245,916
114,395 -> 286,223
335,804 -> 529,804
567,338 -> 14,891
623,705 -> 379,949
82,864 -> 545,401
932,128 -> 932,134
291,294 -> 291,101
739,765 -> 739,757
460,94 -> 892,94
375,673 -> 367,681
81,831 -> 90,831
890,402 -> 890,138
775,547 -> 790,547
49,927 -> 966,10
23,116 -> 257,116
923,75 -> 18,980
63,986 -> 687,362
369,844 -> 357,844
790,188 -> 644,188
557,282 -> 557,669
861,173 -> 390,644
480,529 -> 893,529
32,960 -> 830,162
368,725 -> 368,40
502,600 -> 701,600
63,977 -> 873,167
463,518 -> 788,193
738,406 -> 324,406
162,931 -> 822,931
377,487 -> 707,817
610,319 -> 901,319
586,658 -> 690,658
25,288 -> 53,288
760,602 -> 760,628
294,62 -> 951,62
222,773 -> 661,334
151,483 -> 646,483
272,852 -> 317,852
557,906 -> 503,960
736,445 -> 736,703
241,376 -> 241,692
835,41 -> 835,369
987,743 -> 987,210
42,700 -> 42,244
646,136 -> 646,440
544,751 -> 404,751
295,651 -> 295,805
687,878 -> 113,878
290,142 -> 604,142
579,920 -> 579,807
12,985 -> 987,10
919,940 -> 919,808
770,143 -> 770,832
114,76 -> 962,76
876,882 -> 428,434
861,139 -> 861,320
888,59 -> 888,39
629,823 -> 707,823
296,598 -> 296,305
61,54 -> 578,54
864,58 -> 253,58
71,861 -> 306,861
682,181 -> 326,537
307,418 -> 307,910
810,251 -> 810,431
151,836 -> 602,385
954,987 -> 243,276
724,272 -> 350,646
134,295 -> 434,295
178,235 -> 802,859
832,688 -> 832,573
165,334 -> 165,378
816,26 -> 114,728
668,192 -> 540,192
730,341 -> 969,341
951,169 -> 286,834
647,115 -> 886,115
664,288 -> 507,131
609,362 -> 609,295
747,479 -> 287,19
350,967 -> 350,725
117,383 -> 311,383
871,124 -> 292,124
654,271 -> 547,271
525,773 -> 345,953
401,670 -> 610,670
930,196 -> 301,825
336,37 -> 961,662
714,212 -> 714,667
454,848 -> 454,107
587,390 -> 587,577
530,437 -> 542,437
304,229 -> 517,229
340,571 -> 766,571
727,941 -> 138,352
831,325 -> 11,325
241,294 -> 403,456
788,658 -> 788,126
337,360 -> 337,589
799,402 -> 342,402
530,820 -> 530,319
982,27 -> 20,989
923,936 -> 923,721
581,395 -> 64,912
61,509 -> 61,827
989,580 -> 610,580
477,592 -> 219,592
296,775 -> 296,58
204,12 -> 204,457
190,171 -> 190,673
939,200 -> 939,457
472,282 -> 472,631
983,331 -> 734,331
365,609 -> 365,817
640,698 -> 145,698
103,618 -> 549,618
454,319 -> 454,346
650,815 -> 381,546
624,603 -> 507,603
966,445 -> 723,445
763,129 -> 763,784
695,145 -> 695,511
498,84 -> 435,147
188,716 -> 967,716
810,446 -> 810,924
731,483 -> 731,51
307,783 -> 307,533
15,956 -> 956,15
192,210 -> 882,210
303,173 -> 38,438
769,952 -> 769,863
135,781 -> 405,781
494,436 -> 494,892
705,394 -> 714,394
164,37 -> 164,633
813,232 -> 813,620
227,906 -> 222,906
542,432 -> 414,432
549,858 -> 88,397
200,101 -> 958,859
235,565 -> 469,331
492,871 -> 503,882
704,398 -> 869,563
450,736 -> 746,736
420,706 -> 420,635
717,493 -> 686,524
187,554 -> 717,24
31,851 -> 315,851
800,230 -> 466,230
226,324 -> 226,614
937,927 -> 937,798
143,26 -> 534,417
952,344 -> 12,344
181,361 -> 782,361
925,906 -> 415,396
685,944 -> 470,944
200,627 -> 290,627
728,285 -> 728,326
271,864 -> 271,34
802,558 -> 207,558
963,26 -> 84,905
504,60 -> 529,60
840,292 -> 180,292
914,272 -> 914,330
82,107 -> 925,950
33,245 -> 33,134
463,663 -> 463,82
27,305 -> 27,675
276,894 -> 891,279
746,325 -> 746,948
249,657 -> 341,749
530,848 -> 28,346
798,617 -> 798,609
119,767 -> 312,767
80,18 -> 674,18
723,374 -> 583,374
582,985 -> 239,642
217,765 -> 217,395
811,159 -> 609,159
689,896 -> 501,896
562,881 -> 562,96
244,621 -> 629,621
277,379 -> 277,287
856,153 -> 20,153
518,228 -> 518,898
230,789 -> 243,789
534,335 -> 534,592
240,790 -> 413,617
768,615 -> 768,560
773,101 -> 912,101
252,571 -> 767,56
370,595 -> 681,906
565,176 -> 565,318
750,465 -> 750,724
979,130 -> 120,989
160,153 -> 160,785
610,222 -> 610,191
873,124 -> 130,867
519,593 -> 519,32
525,947 -> 525,562
50,292 -> 291,533
558,927 -> 960,525
536,694 -> 249,981
954,896 -> 277,896
732,202 -> 732,288
447,989 -> 541,895
890,754 -> 367,231
368,89 -> 564,285
588,100 -> 588,156
282,313 -> 943,974
16,792 -> 495,792
111,591 -> 111,493
57,713 -> 685,85
676,632 -> 676,575
560,708 -> 560,602
489,288 -> 489,404
904,515 -> 443,54
70,977 -> 985,62
11,119 -> 11,403
215,859 -> 937,137
78,469 -> 110,437
747,605 -> 747,369
847,598 -> 847,299
742,695 -> 159,112
986,370 -> 986,460
631,900 -> 771,760
228,406 -> 683,861
189,639 -> 61,639
221,650 -> 820,650
558,569 -> 834,845
655,533 -> 558,630
967,921 -> 967,169
230,308 -> 429,308
873,762 -> 873,528
412,151 -> 412,538
881,587 -> 881,21
941,45 -> 26,960
377,126 -> 700,126

View File

@ -1,19 +1,9 @@
# -*- encoding: utf-8 -*-
from pathlib import Path
import sys
with open(Path(__file__).parent.joinpath("inputs", "day1.txt")) as fp:
lines = fp.readlines()
blocks = sys.stdin.read().split("\n\n")
values = sorted(sum(map(int, block.split())) for block in blocks)
values: list[int] = [0]
for line in lines:
if not line.strip():
values = values + [0]
else:
values[-1] += int(line.strip())
# part 1
print(f"max is {max(values)}")
# part 2
print(f"sum of top 3 is {sum(sorted(values)[-3:])}")
print(f"answer 1 is {values[-1]}")
print(f"answer 2 is {sum(values[-3:])}")

40
2022/day10.py Normal file
View File

@ -0,0 +1,40 @@
# -*- encoding: utf-8 -*-
import sys
lines = sys.stdin.read().splitlines()
cycle = 1
x = 1
values = {cycle: x}
for line in lines:
cycle += 1
if line == "noop":
pass
else:
r = int(line.split()[1])
values[cycle] = x
cycle += 1
x += r
values[cycle] = x
answer_1 = sum(c * values[c] for c in range(20, max(values.keys()) + 1, 40))
print(f"answer 1 is {answer_1}")
for i in range(6):
for j in range(40):
v = values[1 + i * 40 + j]
if j >= v - 1 and j <= v + 1:
print("#", end="")
else:
print(".", end="")
print()

146
2022/day11.py Normal file
View File

@ -0,0 +1,146 @@
# -*- encoding: utf-8 -*-
import copy
import sys
from functools import reduce
from typing import Callable, Final, Mapping, Sequence
class Monkey:
id: Final[int]
items: Final[Sequence[int]]
worry_fn: Final[Callable[[int], int]]
test_value: Final[int]
throw_targets: Final[Mapping[bool, int]]
def __init__(
self,
id: int,
items: list[int],
worry_fn: Callable[[int], int],
test_value: int,
throw_targets: dict[bool, int],
):
self.id = id
self.items = items
self.worry_fn = worry_fn
self.test_value = test_value
self.throw_targets = throw_targets
def __eq__(self, o: object) -> bool:
if not isinstance(o, Monkey):
return False
return self.id == o.id
def __hash__(self) -> int:
return hash(self.id)
def parse_monkey(lines: list[str]) -> Monkey:
assert lines[0].startswith("Monkey")
monkey_id = int(lines[0].split()[-1][:-1])
# parse items
items = [int(r.strip()) for r in lines[1].split(":")[1].split(",")]
# parse worry
worry_fn: Callable[[int], int]
worry_s = lines[2].split("new =")[1].strip()
operand = worry_s.split()[2].strip()
if worry_s.startswith("old *"):
if operand == "old":
worry_fn = lambda w: w * w # noqa: E731
else:
worry_fn = lambda w: w * int(operand) # noqa: E731
elif worry_s.startswith("old +"):
if operand == "old":
worry_fn = lambda w: w + w # noqa: E731
else:
worry_fn = lambda w: w + int(operand) # noqa: E731
else:
assert False, worry_s
# parse test
assert lines[3].split(":")[1].strip().startswith("divisible by")
test_value = int(lines[3].split()[-1])
assert lines[4].strip().startswith("If true")
assert lines[5].strip().startswith("If false")
throw_targets = {True: int(lines[4].split()[-1]), False: int(lines[5].split()[-1])}
assert monkey_id not in throw_targets.values()
return Monkey(monkey_id, items, worry_fn, test_value, throw_targets)
def run(
monkeys: list[Monkey], n_rounds: int, me_worry_fn: Callable[[int], int]
) -> dict[Monkey, int]:
"""
Perform a full run.
Args:
monkeys: Initial list of monkeys. The Monkey are not modified.
n_rounds: Number of rounds to run.
me_worry_fn: Worry function to apply after the Monkey operation (e.g., divide
by 3 for round 1).
Returns:
A mapping containing, for each monkey, the number of items inspected.
"""
# copy of the items
items = {monkey: list(monkey.items) for monkey in monkeys}
# number of inspects
inspects = {monkey: 0 for monkey in monkeys}
for round in range(n_rounds):
for monkey in monkeys:
for item in items[monkey]:
inspects[monkey] += 1
# compute the new worry level
item = me_worry_fn(monkey.worry_fn(item))
# find the target
target = monkey.throw_targets[item % monkey.test_value == 0]
assert target != monkey.id
items[monkeys[target]].append(item)
# clear after the loop
items[monkey].clear()
return inspects
def monkey_business(inspects: dict[Monkey, int]) -> int:
sorted_levels = sorted(inspects.values())
return sorted_levels[-2] * sorted_levels[-1]
monkeys = [parse_monkey(block.splitlines()) for block in sys.stdin.read().split("\n\n")]
# case 1: we simply divide the worry by 3 after applying the monkey worry operation
answer_1 = monkey_business(
run(copy.deepcopy(monkeys), 20, me_worry_fn=lambda w: w // 3)
)
print(f"answer 1 is {answer_1}")
# case 2: to keep reasonable level values, we can use a modulo operation, we need to
# use the product of all "divisible by" test so that the test remains valid
#
# (a + b) % c == ((a % c) + (b % c)) % c --- this would work for a single test value
#
# (a + b) % c == ((a % d) + (b % d)) % c --- if d is a multiple of c, which is why here
# we use the product of all test value
#
total_test_value = reduce(lambda w, m: w * m.test_value, monkeys, 1)
answer_2 = monkey_business(
run(copy.deepcopy(monkeys), 10_000, me_worry_fn=lambda w: w % total_test_value)
)
print(f"answer 2 is {answer_2}")

165
2022/day12.py Normal file
View File

@ -0,0 +1,165 @@
# -*- encoding: utf-8 -*-
import heapq
import sys
from typing import Callable, Iterator, TypeVar
Node = TypeVar("Node")
def dijkstra(
start: Node,
neighbors: Callable[[Node], Iterator[Node]],
cost: Callable[[Node, Node], float],
) -> tuple[dict[Node, float], dict[Node, Node]]:
"""
Compute shortest paths from one node to all reachable ones.
Args:
start: Starting node.
neighbors: Function returning the neighbors of a node.
cost: Function to compute the cost of an edge.
Returns:
A tuple (lengths, parents) where lengths is a mapping from Node to distance
(from the starting node) and parents a mapping from parents Node (in the
shortest path). If keyset of lengths and parents is the same. If a Node is not
in the mapping, it cannot be reached from the starting node.
"""
queue: list[tuple[float, Node]] = []
visited: set[Node] = set()
lengths: dict[Node, float] = {start: 0}
parents: dict[Node, Node] = {}
heapq.heappush(queue, (0, start))
while queue:
length, current = heapq.heappop(queue)
if current in visited:
continue
visited.add(current)
for neighbor in neighbors(current):
if neighbor in visited:
continue
neighbor_cost = length + cost(current, neighbor)
if neighbor_cost < lengths.get(neighbor, float("inf")):
lengths[neighbor] = neighbor_cost
parents[neighbor] = current
heapq.heappush(queue, (neighbor_cost, neighbor))
return lengths, parents
def make_path(parents: dict[Node, Node], start: Node, end: Node) -> list[Node] | None:
if end not in parents:
return None
path: list[Node] = [end]
while path[-1] is not start:
path.append(parents[path[-1]])
return list(reversed(path))
def print_path(path: list[tuple[int, int]], n_rows: int, n_cols: int) -> None:
end = path[-1]
graph = [["." for _c in range(n_cols)] for _r in range(n_rows)]
graph[end[0]][end[1]] = "E"
for i in range(0, len(path) - 1):
cr, cc = path[i]
nr, nc = path[i + 1]
if cr == nr and nc == cc - 1:
graph[cr][cc] = "<"
elif cr == nr and nc == cc + 1:
graph[cr][cc] = ">"
elif cr == nr - 1 and nc == cc:
graph[cr][cc] = "v"
elif cr == nr + 1 and nc == cc:
graph[cr][cc] = "^"
else:
assert False, "{} -> {} infeasible".format(path[i], path[i + 1])
print("\n".join("".join(row) for row in graph))
def neighbors(
grid: list[list[int]], node: tuple[int, int], up: bool
) -> Iterator[tuple[int, int]]:
n_rows = len(grid)
n_cols = len(grid[0])
c_row, c_col = node
for n_row, n_col in (
(c_row - 1, c_col),
(c_row + 1, c_col),
(c_row, c_col - 1),
(c_row, c_col + 1),
):
if not (n_row >= 0 and n_row < n_rows and n_col >= 0 and n_col < n_cols):
continue
if up and grid[n_row][n_col] > grid[c_row][c_col] + 1:
continue
elif not up and grid[n_row][n_col] < grid[c_row][c_col] - 1:
continue
yield n_row, n_col
# === main code ===
lines = sys.stdin.read().splitlines()
grid = [[ord(cell) - ord("a") for cell in line] for line in lines]
start: tuple[int, int]
end: tuple[int, int]
# for part 2
start_s: list[tuple[int, int]] = []
for i_row, row in enumerate(grid):
for i_col, col in enumerate(row):
if chr(col + ord("a")) == "S":
start = (i_row, i_col)
start_s.append(start)
elif chr(col + ord("a")) == "E":
end = (i_row, i_col)
elif col == 0:
start_s.append((i_row, i_col))
# fix values
grid[start[0]][start[1]] = 0
grid[end[0]][end[1]] = ord("z") - ord("a")
lengths_1, parents_1 = dijkstra(
start=start, neighbors=lambda n: neighbors(grid, n, True), cost=lambda lhs, rhs: 1
)
path_1 = make_path(parents_1, start, end)
assert path_1 is not None
print_path(path_1, n_rows=len(grid), n_cols=len(grid[0]))
print(f"answer 1 is {lengths_1[end] - 1}")
lengths_2, parents_2 = dijkstra(
start=end, neighbors=lambda n: neighbors(grid, n, False), cost=lambda lhs, rhs: 1
)
answer_2 = min(lengths_2.get(start, float("inf")) for start in start_s)
print(f"answer 2 is {answer_2}")

41
2022/day13.py Normal file
View File

@ -0,0 +1,41 @@
# -*- encoding: utf-8 -*-
import json
import sys
from functools import cmp_to_key
blocks = sys.stdin.read().strip().split("\n\n")
pairs = [tuple(json.loads(p) for p in block.split("\n")) for block in blocks]
def compare(lhs: list[int | list], rhs: list[int | list]) -> int:
for lhs_a, rhs_a in zip(lhs, rhs):
if isinstance(lhs_a, int) and isinstance(rhs_a, int):
if lhs_a != rhs_a:
return rhs_a - lhs_a
else:
if not isinstance(lhs_a, list):
lhs_a = [lhs_a]
elif not isinstance(rhs_a, list):
rhs_a = [rhs_a]
assert isinstance(rhs_a, list) and isinstance(lhs_a, list)
r = compare(lhs_a, rhs_a)
if r != 0:
return r
return len(rhs) - len(lhs)
answer_1 = sum(i + 1 for i, (lhs, rhs) in enumerate(pairs) if compare(lhs, rhs) > 0)
print(f"answer_1 is {answer_1}")
dividers = [[[2]], [[6]]]
packets = [packet for packets in pairs for packet in packets]
packets.extend(dividers)
packets = list(reversed(sorted(packets, key=cmp_to_key(compare))))
d_index = [packets.index(d) + 1 for d in dividers]
print(f"answer 2 is {d_index[0] * d_index[1]}")

144
2022/day14.py Normal file
View File

@ -0,0 +1,144 @@
# -*- encoding: utf-8 -*-
import sys
from collections import defaultdict
from enum import Enum, auto
from typing import Callable, cast
class Cell(Enum):
AIR = auto()
ROCK = auto()
SAND = auto()
def __str__(self) -> str:
return {Cell.AIR: ".", Cell.ROCK: "#", Cell.SAND: "O"}[self]
def print_blocks(blocks: dict[tuple[int, int], Cell]):
"""
Print the given set of blocks on a grid.
Args:
blocks: Set of blocks to print.
"""
x_min, y_min, x_max, y_max = (
min(x for x, y in blocks),
0,
max(x for x, y in blocks),
max(y for x, y in blocks),
)
for y in range(y_min, y_max + 1):
print(
"".join(str(blocks.get((x, y), Cell.AIR)) for x in range(x_min, x_max + 1))
)
def flow(
blocks: dict[tuple[int, int], Cell],
stop_fn: Callable[[int, int], bool],
fill_fn: Callable[[int, int], Cell],
) -> dict[tuple[int, int], Cell]:
"""
Flow sands onto the given set of blocks
Args:
blocks: Blocks containing ROCK position. Modified in-place.
stop_fn: Function called with the last (assumed) position of a grain of
sand BEFORE adding it to blocks. If the function returns True, the grain
is added and a new one is flowed, otherwise, the whole procedure stops
and the function returns (without adding the final grain).
fill_fn: Function called when the target position of a grain (during the
flowing process) is missing from blocks.
Returns:
The input blocks.
"""
y_max = max(y for x, y in blocks)
while True:
x, y = 500, 0
while y <= y_max:
moved = False
for cx, cy in ((x, y + 1), (x - 1, y + 1), (x + 1, y + 1)):
if (cx, cy) not in blocks and fill_fn(cx, cy) == Cell.AIR:
x, y = cx, cy
moved = True
elif blocks[cx, cy] == Cell.AIR:
x, y = cx, cy
moved = True
if moved:
break
if not moved:
break
if stop_fn(x, y):
break
blocks[x, y] = Cell.SAND
return blocks
# === inputs ===
lines = sys.stdin.read().splitlines()
paths: list[list[tuple[int, int]]] = []
for line in lines:
parts = line.split(" -> ")
paths.append(
[
cast(tuple[int, int], tuple(int(c.strip()) for c in part.split(",")))
for part in parts
]
)
blocks: dict[tuple[int, int], Cell] = {}
for path in paths:
for start, end in zip(path[:-1], path[1:]):
x_start = min(start[0], end[0])
x_end = max(start[0], end[0]) + 1
y_start = min(start[1], end[1])
y_end = max(start[1], end[1]) + 1
for x in range(x_start, x_end):
for y in range(y_start, y_end):
blocks[x, y] = Cell.ROCK
print_blocks(blocks)
print()
x_min, y_min, x_max, y_max = (
min(x for x, y in blocks),
0,
max(x for x, y in blocks),
max(y for x, y in blocks),
)
# === part 1 ===
blocks_1 = flow(
blocks.copy(), stop_fn=lambda x, y: y > y_max, fill_fn=lambda x, y: Cell.AIR
)
print_blocks(blocks_1)
print(f"answer 1 is {sum(v == Cell.SAND for v in blocks_1.values())}")
print()
# === part 2 ===
blocks_2 = flow(
blocks.copy(),
stop_fn=lambda x, y: x == 500 and y == 0,
fill_fn=lambda x, y: Cell.AIR if y < y_max + 2 else Cell.ROCK,
)
blocks_2[500, 0] = Cell.SAND
print_blocks(blocks_2)
print(f"answer 2 is {sum(v == Cell.SAND for v in blocks_2.values())}")

90
2022/day15.py Normal file
View File

@ -0,0 +1,90 @@
# -*- encoding: utf-8 -*-
import sys
import numpy as np
import parse
def part1(sensor_to_beacon: dict[tuple[int, int], tuple[int, int]], row: int) -> int:
no_beacons_row_l: list[np.ndarray] = []
for (sx, sy), (bx, by) in sensor_to_beacon.items():
d = abs(sx - bx) + abs(sy - by) # closest
no_beacons_row_l.append(sx - np.arange(0, d - abs(sy - row) + 1))
no_beacons_row_l.append(sx + np.arange(0, d - abs(sy - row) + 1))
beacons_at_row = set(bx for (bx, by) in sensor_to_beacon.values() if by == row)
no_beacons_row = set(np.concatenate(no_beacons_row_l)).difference(beacons_at_row)
return len(no_beacons_row)
def part2_intervals(
sensor_to_beacon: dict[tuple[int, int], tuple[int, int]], xy_max: int
) -> tuple[int, int, int]:
from tqdm import trange
for y in trange(xy_max + 1):
its: list[tuple[int, int]] = []
for (sx, sy), (bx, by) in sensor_to_beacon.items():
d = abs(sx - bx) + abs(sy - by)
dx = d - abs(sy - y)
if dx >= 0:
its.append((max(0, sx - dx), min(sx + dx, xy_max)))
its = sorted(its)
s, e = its[0]
for si, ei in its[1:]:
if si > e + 1:
return si - 1, y, 4_000_000 * (si - 1) + y
if ei > e:
e = ei
return (0, 0, 0)
def part2_cplex(
sensor_to_beacon: dict[tuple[int, int], tuple[int, int]], xy_max: int
) -> tuple[int, int, int]:
from docplex.mp.model import Model
m = Model()
x, y = m.continuous_var_list(2, ub=xy_max, name=["x", "y"])
for (sx, sy), (bx, by) in sensor_to_beacon.items():
d = abs(sx - bx) + abs(sy - by)
m.add_constraint(m.abs(x - sx) + m.abs(y - sy) >= d + 1, ctname=f"ct_{sx}_{sy}")
m.set_objective("min", x + y)
s = m.solve()
vx = int(s.get_value(x))
vy = int(s.get_value(y))
return vx, vy, 4_000_000 * vx + vy
lines = sys.stdin.read().splitlines()
sensor_to_beacon: dict[tuple[int, int], tuple[int, int]] = {}
for line in lines:
r = parse.parse(
"Sensor at x={sx}, y={sy}: closest beacon is at x={bx}, y={by}", line
)
sensor_to_beacon[int(r["sx"]), int(r["sy"])] = (int(r["bx"]), int(r["by"]))
xy_max = 4_000_000 if max(sensor_to_beacon) > (1_000, 0) else 20
row = 2_000_000 if max(sensor_to_beacon) > (1_000, 0) else 10
print(f"answer 1 is {part1(sensor_to_beacon, row)}")
# x, y, a2 = part2_cplex(sensor_to_beacon, xy_max)
x, y, a2 = part2_intervals(sensor_to_beacon, xy_max)
print(f"answer 2 is {a2} (x={x}, y={y})")

270
2022/day16.py Normal file
View File

@ -0,0 +1,270 @@
# -*- encoding: utf-8 -*-
from __future__ import annotations
import heapq
import itertools
import re
import sys
import time as time_p
from collections import defaultdict
from typing import FrozenSet, NamedTuple
from tqdm import tqdm, trange
class Pipe(NamedTuple):
name: str
flow: int
tunnels: list[str]
def __lt__(self, other: object) -> bool:
return isinstance(other, Pipe) and other.name < self.name
def __eq__(self, other: object) -> bool:
return isinstance(other, Pipe) and other.name == self.name
def __hash__(self) -> int:
return hash(self.name)
def __str__(self) -> str:
return self.name
def __repr__(self) -> str:
return self.name
def breadth_first_search(pipes: dict[str, Pipe], pipe: Pipe) -> dict[Pipe, int]:
"""
Runs a BFS from the given pipe and return the shortest distance (in term of hops)
to all other pipes.
"""
queue = [(0, pipe_1)]
visited = set()
distances: dict[Pipe, int] = {}
while len(distances) < len(pipes):
distance, current = heapq.heappop(queue)
if current in visited:
continue
visited.add(current)
distances[current] = distance
for tunnel in current.tunnels:
heapq.heappush(queue, (distance + 1, pipes[tunnel]))
return distances
def update_with_better(
node_at_times: dict[FrozenSet[Pipe], int], flow: int, flowing: FrozenSet[Pipe]
) -> None:
node_at_times[flowing] = max(node_at_times[flowing], flow)
def part_1(
start_pipe: Pipe,
max_time: int,
distances: dict[tuple[Pipe, Pipe], int],
relevant_pipes: FrozenSet[Pipe],
):
node_at_times: dict[int, dict[Pipe, dict[FrozenSet[Pipe], int]]] = defaultdict(
lambda: defaultdict(lambda: defaultdict(lambda: 0))
)
node_at_times[0] = {start_pipe: {frozenset(): 0}}
for time in range(max_time):
for c_pipe, nodes in node_at_times[time].items():
for flowing, flow in nodes.items():
for target in relevant_pipes:
distance = distances[c_pipe, target] + 1
if time + distance >= max_time or target in flowing:
continue
update_with_better(
node_at_times[time + distance][target],
flow + sum(pipe.flow for pipe in flowing) * distance,
flowing | {target},
)
update_with_better(
node_at_times[max_time][c_pipe],
flow + sum(pipe.flow for pipe in flowing) * (max_time - time),
flowing,
)
return max(
flow
for nodes_of_pipe in node_at_times[max_time].values()
for flow in nodes_of_pipe.values()
)
def part_2(
start_pipe: Pipe,
max_time: int,
pipes: dict[str, Pipe],
relevant_pipes: FrozenSet[Pipe],
distances: dict[tuple[Pipe, Pipe], int],
):
node_at_times: dict[
int, dict[tuple[Pipe, Pipe], dict[FrozenSet[Pipe], int]]
] = defaultdict(lambda: defaultdict(lambda: defaultdict(lambda: 0)))
node_at_times[0] = {(start_pipe, start_pipe): {frozenset(): 0}}
# map node + distance to
d1, d2, d3, d4 = 0, 0, 0, 0
best_flow = 0
for time in range(max_time):
print(
f"{time + 1:2d}/{max_time} - {best_flow:4d} - "
f"{sum(map(len, node_at_times[time].values())):7d} - "
f"{d1:.3f} {d2:.3f} {d3:.3f} {d4:.3f}"
)
d1, d2, d3, d4 = 0, 0, 0, 0
for (c_pipe, e_pipe), nodes in node_at_times[time].items():
for flowing, flow in nodes.items():
t1 = time_p.time()
c_best_flow = (
flow
+ sum(pipe.flow for pipe in flowing) * (max_time - time)
+ sum(
(
pipe.flow
* (
max_time
- time
- 1
- min(distances[c_pipe, pipe], distances[e_pipe, pipe])
)
for pipe in relevant_pipes
if pipe not in flowing
),
start=0,
)
)
d1 += time_p.time() - t1
if c_best_flow < best_flow:
continue
best_flow = max(
best_flow,
flow + sum(pipe.flow for pipe in flowing) * (max_time - time),
)
t1 = time_p.time()
if flowing != relevant_pipes:
for c_next_s, e_next_s in itertools.product(
c_pipe.tunnels, e_pipe.tunnels
):
c_next = pipes[c_next_s]
e_next = pipes[e_next_s]
update_with_better(
node_at_times[time + 1][c_next, e_next],
flow + sum(pipe.flow for pipe in flowing),
flowing,
)
d2 += time_p.time() - t1
t1 = time_p.time()
if c_pipe in relevant_pipes and c_pipe not in flowing:
for e_next_s in e_pipe.tunnels:
e_next = pipes[e_next_s]
update_with_better(
node_at_times[time + 1][c_pipe, e_next],
flow + sum(pipe.flow for pipe in flowing),
flowing | {c_pipe},
)
if e_pipe in relevant_pipes and e_pipe not in flowing:
for c_next_s in c_pipe.tunnels:
c_next = pipes[c_next_s]
update_with_better(
node_at_times[time + 1][c_next, e_pipe],
flow + sum(pipe.flow for pipe in flowing),
flowing | {e_pipe},
)
if (
e_pipe in relevant_pipes
and c_pipe in relevant_pipes
and e_pipe not in flowing
and c_pipe not in flowing
):
update_with_better(
node_at_times[time + 1][c_pipe, e_pipe],
flow + sum(pipe.flow for pipe in flowing),
flowing | {c_pipe, e_pipe},
)
update_with_better(
node_at_times[max_time][c_pipe, e_pipe],
flow + sum(pipe.flow for pipe in flowing) * (max_time - time),
flowing,
)
d3 += time_p.time() - t1
return max(
flow
for nodes_of_pipe in node_at_times[max_time].values()
for flow in nodes_of_pipe.values()
)
# === MAIN ===
lines = sys.stdin.read().splitlines()
pipes: dict[str, Pipe] = {}
for line in lines:
r = re.match(
R"Valve ([A-Z]+) has flow rate=([0-9]+); tunnels? leads? to valves? (.+)",
line,
)
assert r
g = r.groups()
pipes[g[0]] = Pipe(g[0], int(g[1]), g[2].split(", "))
# compute distances from one valve to any other
distances: dict[tuple[Pipe, Pipe], int] = {}
for pipe_1 in pipes.values():
distances.update(
{
(pipe_1, pipe_2): distance
for pipe_2, distance in breadth_first_search(pipes, pipe_1).items()
}
)
# valves with flow
relevant_pipes = frozenset(pipe for pipe in pipes.values() if pipe.flow > 0)
# 1651, 1653
print(part_1(pipes["AA"], 30, distances, relevant_pipes))
# 1707, 2223
print(part_2(pipes["AA"], 26, pipes, relevant_pipes, distances))

125
2022/day17.py Normal file
View File

@ -0,0 +1,125 @@
# -*- encoding: utf-8 -*-
import sys
from typing import Sequence, TypeVar
import numpy as np
T = TypeVar("T")
def print_tower(tower: np.ndarray, out: str = "#"):
print("-" * (tower.shape[1] + 2))
non_empty = False
for row in reversed(range(1, tower.shape[0])):
if not non_empty and not tower[row, :].any():
continue
non_empty = True
print("|" + "".join(out if c else "." for c in tower[row, :]) + "|")
print("+" + "-" * tower.shape[1] + "+")
def tower_height(tower: np.ndarray) -> int:
return int(tower.shape[0] - tower[::-1, :].argmax(axis=0).min() - 1)
def next_cycle(sequence: Sequence[T], index: int) -> tuple[T, int]:
t = sequence[index]
index = (index + 1) % len(sequence)
return t, index
ROCKS = [
np.array([(0, 0), (0, 1), (0, 2), (0, 3)]),
np.array([(0, 1), (1, 0), (1, 1), (1, 2), (2, 1)]),
np.array([(0, 0), (0, 1), (0, 2), (1, 2), (2, 2)]),
np.array([(0, 0), (1, 0), (2, 0), (3, 0)]),
np.array([(0, 0), (0, 1), (1, 0), (1, 1)]),
]
WIDTH = 7
START_X = 2
EMPTY_BLOCKS = np.zeros((10, WIDTH), dtype=bool)
def build_tower(
n_rocks: int,
jets: str,
early_stop: bool = False,
init: np.ndarray = np.ones(WIDTH, dtype=bool),
) -> tuple[np.ndarray, int, int, dict[int, int]]:
tower = EMPTY_BLOCKS.copy()
tower[0, :] = init
done_at: dict[tuple[int, int], int] = {}
heights: dict[int, int] = {}
i_jet, i_rock = 0, 0
rock_count = 0
for rock_count in range(n_rocks):
if early_stop:
if i_rock == 0 and (i_rock, i_jet) in done_at:
break
done_at[i_rock, i_jet] = rock_count
y_start = tower.shape[0] - tower[::-1, :].argmax(axis=0).min() + 3
rock, i_rock = next_cycle(ROCKS, i_rock)
rock_y = rock[:, 0] + y_start
rock_x = rock[:, 1] + START_X
if rock_y.max() >= tower.shape[0]:
tower = np.concatenate([tower, EMPTY_BLOCKS], axis=0)
while True:
jet, i_jet = next_cycle(jets, i_jet)
dx = 0
if jet == ">" and rock_x.max() < WIDTH - 1:
dx = 1
elif jet == "<" and rock_x.min() > 0:
dx = -1
if dx != 0 and not tower[rock_y, rock_x + dx].any():
rock_x = rock_x + dx
# move down
rock_y -= 1
if tower[rock_y, rock_x].any():
rock_y += 1
break
heights[rock_count] = tower_height(tower)
tower[rock_y, rock_x] = True
return tower, rock_count, done_at.get((i_rock, i_jet), -1), heights
line = sys.stdin.read().strip()
tower, *_ = build_tower(2022, line)
answer_1 = tower_height(tower)
print(f"answer 1 is {answer_1}")
TOTAL_ROCKS = 1_000_000_000_000
tower_1, n_rocks_1, prev_1, heights_1 = build_tower(TOTAL_ROCKS, line, True)
assert prev_1 > 0
# 2767 1513
remaining_rocks = TOTAL_ROCKS - n_rocks_1
n_repeat_rocks = n_rocks_1 - prev_1
n_repeat_towers = remaining_rocks // n_repeat_rocks
base_height = heights_1[prev_1]
repeat_height = heights_1[prev_1 + n_repeat_rocks - 1] - heights_1[prev_1]
remaining_height = (
heights_1[prev_1 + remaining_rocks % n_repeat_rocks] - heights_1[prev_1]
)
answer_2 = base_height + (n_repeat_towers + 1) * repeat_height + remaining_height
print(f"answer 2 is {answer_2}")

53
2022/day18.py Normal file
View File

@ -0,0 +1,53 @@
# -*- encoding: utf-8 -*-
import sys
from typing import FrozenSet
import numpy as np
xyz = np.asarray(
[
tuple(int(x) for x in row.split(",")) # type: ignore
for row in sys.stdin.read().splitlines()
]
)
xyz = xyz - xyz.min(axis=0) + 1
cubes = np.zeros(xyz.max(axis=0) + 3, dtype=bool)
cubes[xyz[:, 0], xyz[:, 1], xyz[:, 2]] = True
n_dims = len(cubes.shape)
faces = [(-1, 0, 0), (1, 0, 0), (0, -1, 0), (0, 1, 0), (0, 0, -1), (0, 0, 1)]
answer_1 = sum(
1 for x, y, z in xyz for dx, dy, dz in faces if not cubes[x + dx, y + dy, z + dz]
)
print(f"answer 1 is {answer_1}")
visited = np.zeros_like(cubes, dtype=bool)
queue = [(0, 0, 0)]
n_faces = 0
while queue:
x, y, z = queue.pop(0)
if visited[x, y, z]:
continue
visited[x, y, z] = True
for dx, dy, dz in faces:
nx, ny, nz = x + dx, y + dy, z + dz
if not all(n >= 0 and n < cubes.shape[i] for i, n in enumerate((nx, ny, nz))):
continue
if visited[nx, ny, nz]:
continue
if cubes[nx, ny, nz]:
n_faces += 1
else:
queue.append((nx, ny, nz))
print(f"answer 2 is {n_faces}")

186
2022/day19.py Normal file
View File

@ -0,0 +1,186 @@
# -*- encoding: utf-8 -*-
import sys
from typing import Literal
import numpy as np
import parse
from tqdm import tqdm
Reagent = Literal["ore", "clay", "obsidian", "geode"]
REAGENTS: tuple[Reagent, ...] = (
"ore",
"clay",
"obsidian",
"geode",
)
IntOfReagent = dict[Reagent, int]
class State:
robots: IntOfReagent
reagents: IntOfReagent
def __init__(
self,
robots: IntOfReagent | None = None,
reagents: IntOfReagent | None = None,
):
if robots is None:
assert reagents is None
self.reagents = {reagent: 0 for reagent in REAGENTS}
self.robots = {reagent: 0 for reagent in REAGENTS}
self.robots["ore"] = 1
else:
assert robots is not None and reagents is not None
self.robots = robots
self.reagents = reagents
def __eq__(self, other) -> bool:
return (
isinstance(other, State)
and self.robots == other.robots
and self.reagents == other.reagents
)
def __hash__(self) -> int:
return hash(tuple((self.robots[r], self.reagents[r]) for r in REAGENTS))
def __str__(self) -> str:
return "State({}, {})".format(
"/".join(str(self.robots[k]) for k in REAGENTS),
"/".join(str(self.reagents[k]) for k in REAGENTS),
)
def __repr__(self) -> str:
return str(self)
def dominates(lhs: State, rhs: State):
return all(
lhs.robots[r] >= rhs.robots[r] and lhs.reagents[r] >= rhs.reagents[r]
for r in REAGENTS
)
lines = sys.stdin.read().splitlines()
blueprints: list[dict[Reagent, IntOfReagent]] = []
for line in lines:
r = parse.parse(
"Blueprint {}: "
"Each ore robot costs {:d} ore. "
"Each clay robot costs {:d} ore. "
"Each obsidian robot costs {:d} ore and {:d} clay. "
"Each geode robot costs {:d} ore and {:d} obsidian.",
line,
)
blueprints.append(
{
"ore": {"ore": r[1]},
"clay": {"ore": r[2]},
"obsidian": {"ore": r[3], "clay": r[4]},
"geode": {"ore": r[5], "obsidian": r[6]},
}
)
def run(blueprint: dict[Reagent, dict[Reagent, int]], max_time: int) -> int:
# since we can only build one robot per time, we do not need more than X robots
# of type K where X is the maximum number of K required among all robots, e.g.,
# in the first toy blueprint, we need at most 4 ore robots, 14 clay ones and 7
# obsidian ones
maximums = {
name: max(blueprint[r].get(name, 0) for r in REAGENTS) for name in REAGENTS
}
state_after_t: dict[int, set[State]] = {0: [State()]}
for t in range(1, max_time + 1):
# list of new states at the end of step t that we are going to prune later
states_for_t: set[State] = set()
for state in state_after_t[t - 1]:
robots_that_can_be_built = [
robot
for robot in REAGENTS
if all(
state.reagents[reagent] >= blueprint[robot].get(reagent, 0)
for reagent in REAGENTS
)
]
states_for_t.add(
State(
robots=state.robots,
reagents={
reagent: state.reagents[reagent] + state.robots[reagent]
for reagent in REAGENTS
},
)
)
if "geode" in robots_that_can_be_built:
robots_that_can_be_built = ["geode"]
else:
robots_that_can_be_built = [
robot
for robot in robots_that_can_be_built
if state.robots[robot] < maximums[robot]
]
for robot in robots_that_can_be_built:
robots = state.robots.copy()
robots[robot] += 1
reagents = {
reagent: state.reagents[reagent]
+ state.robots[reagent]
- blueprint[robot].get(reagent, 0)
for reagent in REAGENTS
}
states_for_t.add(State(robots=robots, reagents=reagents))
# use numpy to switch computation of dominated states -> store each state
# as a 8 array and use numpy broadcasting to find dominated states
states_after = np.asarray(list(states_for_t))
np_states = np.array(
[
[state.robots[r] for r in REAGENTS]
+ [state.reagents[r] for r in REAGENTS]
for state in states_after
]
)
to_keep = []
while len(np_states) > 0:
first_dom = (np_states[1:] >= np_states[0]).all(axis=1).any()
if first_dom:
np_states = np_states[1:]
else:
to_keep.append(np_states[0])
np_states = np_states[1:][~(np_states[1:] <= np_states[0]).all(axis=1)]
state_after_t[t] = {
State(
robots=dict(zip(REAGENTS, row[:4])),
reagents=dict(zip(REAGENTS, row[4:])),
)
for row in to_keep
}
return max(state.reagents["geode"] for state in state_after_t[max_time])
answer_1 = sum(
(i_blueprint + 1) * run(blueprint, 24)
for i_blueprint, blueprint in enumerate(blueprints)
)
print(f"answer 1 is {answer_1}")
answer_2 = run(blueprints[0], 32) * run(blueprints[1], 32) * run(blueprints[2], 32)
print(f"answer 2 is {answer_2}")

55
2022/day2.py Normal file
View File

@ -0,0 +1,55 @@
# -*- encoding: utf-8 -*-
import sys
def score_1(ux: int, vx: int) -> int:
# here ux and vx are both moves: 0 = rock, 1 = paper, 2 = scissor
#
# 1. to get the score of the move/shape, we simply add 1 -> vx + 1
# 2. to get the score of the outcome (loss/draw/win), we use the fact that the
# winning hand is always the opponent hand (ux) + 1 in modulo-3 arithmetic:
# - (ux - vx) % 3 gives us 0 for a draw, 1 for a loss and 2 for a win
# - 1 - ((ux - vx) % 3) gives us -1 for a win, 0 for a loss and 1 for a draw
# - (1 - ((ux - vx) % 3)) gives us 0 / 1 / 2 for loss / draw / win
# - the above can be rewritten as ((1 - (ux - vx)) % 3)
# we can then simply multiply this by 3 to get the outcome score
#
return (vx + 1) + ((1 - (ux - vx)) % 3) * 3
def score_2(ux: int, vx: int) -> int:
# here ux is the opponent move (0 = rock, 1 = paper, 2 = scissor) and vx is the
# outcome (0 = loss, 1 = draw, 2 = win)
#
# 1. to get the score to the move/shape, we need to find it (as 0, 1 or 2) and then
# add 1 to it
# - (vx - 1) gives the offset from the opponent shape (-1 for a loss, 0 for a
# draw and 1 for a win)
# - from the offset, we can retrieve the shape by adding the opponent shape and
# using modulo-3 arithmetic -> (ux + vx - 1) % 3
# - we then add 1 to get the final shape score
# 2. to get the score of the outcome, we can simply multiply vx by 3 -> vx * 3
return (ux + vx - 1) % 3 + 1 + vx * 3
lines = sys.stdin.readlines()
# the solution relies on replacing rock / paper / scissor by values 0 / 1 / 2 and using
# modulo-3 arithmetic
#
# in modulo-3 arithmetic, the winning move is 1 + the opponent move (e.g., winning move
# if opponent plays 0 is 1, or 0 if opponent plays 2 (0 = (2 + 1 % 3)))
#
# we read the lines in a Nx2 in array with value 0/1/2 instead of A/B/C or X/Y/Z for
# easier manipulation
values = [(ord(row[0]) - ord("A"), ord(row[2]) - ord("X")) for row in lines]
# part 1 - 13526
print(f"score 1 is {sum(score_1(*v) for v in values)}")
# part 2 - 14204
print(f"score 2 is {sum(score_2(*v) for v in values)}")

77
2022/day20.py Normal file
View File

@ -0,0 +1,77 @@
# -*- encoding: utf-8 -*-
from __future__ import annotations
import sys
class Number:
current: int
value: int
def __init__(self, value: int):
self.current = 0
self.value = value
def __str__(self):
return str(self.value)
def __repr__(self):
return str(self)
def decrypt(numbers: list[Number], key: int, rounds: int) -> int:
numbers = numbers.copy()
original = numbers.copy()
for index, number in enumerate(numbers):
number.current = index
for _ in range(rounds):
for number in original:
index = number.current
offset = (number.value * key) % (len(numbers) - 1)
target = index + offset
# need to wrap
if target >= len(numbers):
target = offset - (len(numbers) - index) + 1
for number_2 in numbers[target:index]:
number_2.current += 1
numbers = (
numbers[:target]
+ [number]
+ numbers[target:index]
+ numbers[index + 1 :]
)
else:
for number_2 in numbers[index : target + 1]:
number_2.current -= 1
numbers = (
numbers[:index]
+ numbers[index + 1 : target + 1]
+ [number]
+ numbers[target + 1 :]
)
number.current = target
index_of_0 = next(
filter(lambda index: numbers[index].value == 0, range(len(numbers)))
)
return sum(
numbers[(index_of_0 + offset) % len(numbers)].value * key
for offset in (1000, 2000, 3000)
)
numbers = [Number(int(x)) for i, x in enumerate(sys.stdin.readlines())]
answer_1 = decrypt(numbers, 1, 1)
print(f"answer 1 is {answer_1}")
answer_2 = decrypt(numbers, 811589153, 10)
print(f"answer 2 is {answer_2}")

109
2022/day21.py Normal file
View File

@ -0,0 +1,109 @@
# -*- encoding: utf-8 -*-
import operator
import sys
from typing import Callable
def compute(monkeys: dict[str, int | tuple[str, str, str]], monkey: str) -> int:
value = monkeys[monkey]
if isinstance(value, int):
return value
else:
op: dict[str, Callable[[int, int], int]] = {
"+": operator.add,
"-": operator.sub,
"*": operator.mul,
"/": operator.floordiv,
}
value = op[value[1]](compute(monkeys, value[0]), compute(monkeys, value[2]))
monkeys[monkey] = value
return value
def invert(
monkeys: dict[str, int | tuple[str, str, str]], monkey: str, target: int
) -> dict[str, int | tuple[str, str, str]]:
"""
Revert the given mapping from monkey name to value or operation such that
the value from 'monkey' is computable by inverting operation until the root is
found.
Args:
monkeys: Dictionary of monkeys, that will be updated and returned.
monkey: Name of the monkey to start from.
target: Target value to set for the monkey that depends on root.
Returns:
The given dictionary of monkeys.
"""
monkeys = monkeys.copy()
depends: dict[str, str] = {}
for m, v in monkeys.items():
if isinstance(v, int):
continue
op1, _, op2 = v
assert op1 not in depends
assert op2 not in depends
depends[op1] = m
depends[op2] = m
invert_op = {"+": "-", "-": "+", "*": "/", "/": "*"}
current = monkey
while True:
dep = depends[current]
if dep == "root":
monkeys[current] = target
break
val = monkeys[dep]
assert not isinstance(val, int)
op1, ope, op2 = val
if op1 == current:
monkeys[current] = (dep, invert_op[ope], op2)
elif ope in ("+", "*"):
monkeys[current] = (dep, invert_op[ope], op1)
else:
monkeys[current] = (op1, ope, dep)
current = dep
return monkeys
lines = sys.stdin.read().splitlines()
monkeys: dict[str, int | tuple[str, str, str]] = {}
op_monkeys: set[str] = set()
for line in lines:
parts = line.split(":")
name = parts[0].strip()
try:
value = int(parts[1].strip())
monkeys[name] = value
except ValueError:
op1, ope, op2 = parts[1].strip().split()
monkeys[name] = (op1, ope, op2)
op_monkeys.add(name)
answer_1 = compute(monkeys.copy(), "root")
print(f"answer 1 is {answer_1}")
# assume the second operand of 'root' can be computed, and the first one depends on
# humn, which is the case is my input and the test input
p1, _, p2 = monkeys["root"] # type: ignore
answer_2 = compute(invert(monkeys, "humn", compute(monkeys.copy(), p2)), "humn")
print(f"answer 2 is {answer_2}")

226
2022/day22.py Normal file
View File

@ -0,0 +1,226 @@
# -*- encoding: utf-8 -*-
import re
import sys
from typing import Callable
import numpy as np
VOID, EMPTY, WALL = 0, 1, 2
TILE_FROM_CHAR = {" ": VOID, ".": EMPTY, "#": WALL}
SCORES = {"E": 0, "S": 1, "W": 2, "N": 3}
board_map_s, direction_s = sys.stdin.read().split("\n\n")
# board
board_lines = board_map_s.splitlines()
max_line = max(len(line) for line in board_lines)
board = np.array(
[
[TILE_FROM_CHAR[c] for c in row] + [VOID] * (max_line - len(row))
for row in board_map_s.splitlines()
]
)
directions = [
int(p1) if p2 else p1 for p1, p2 in re.findall(R"(([0-9])+|L|R)", direction_s)
]
# find on each row and column the first and last non-void
row_first_non_void = np.argmax(board != VOID, axis=1)
row_last_non_void = board.shape[1] - np.argmax(board[:, ::-1] != VOID, axis=1) - 1
col_first_non_void = np.argmax(board != VOID, axis=0)
col_last_non_void = board.shape[0] - np.argmax(board[::-1, :] != VOID, axis=0) - 1
faces = np.zeros_like(board)
size = np.gcd(board.shape[0], board.shape[1])
for row in range(0, board.shape[0], size):
for col in range(row_first_non_void[row], row_last_non_void[row], size):
faces[row : row + size, col : col + size] = faces.max() + 1
SIZE = np.gcd(*board.shape)
# TODO: deduce this from the actual cube...
faces_wrap: dict[int, dict[str, Callable[[int, int], tuple[int, int, str]]]]
if board.shape == (12, 16): # example
faces_wrap = {
1: {
"W": lambda y, x: (4, 4 + y, "S"), # 3N
"N": lambda y, x: (4, 11 - x, "S"), # 2N
"E": lambda y, x: (11 - y, 15, "W"), # 6E
},
2: {
"W": lambda y, x: (11, 19 - y, "N"), # 6S
"N": lambda y, x: (0, 11 - y, "S"), # 1N
"S": lambda y, x: (11, 11 - x, "N"), # 5S
},
3: {
"N": lambda y, x: (x - 4, 8, "E"), # 1W
"S": lambda y, x: (15 - x, 8, "E"), # 5W
},
4: {"E": lambda y, x: (8, 19 - y, "S")}, # 6N
5: {
"W": lambda y, x: (7, 15 - y, "N"), # 3S
"S": lambda y, x: (7, 11 - x, "N"), # 2S
},
6: {
"N": lambda y, x: (19 - x, 11, "W"), # 4E
"E": lambda y, x: (11 - y, 11, "W"), # 1E
"S": lambda y, x: (19 - x, 0, "E"), # 2W
},
}
else:
faces_wrap = {
1: {
"W": lambda y, x: (3 * SIZE - y - 1, 0, "E"), # 4W
"N": lambda y, x: (2 * SIZE + x, 0, "E"), # 6W
},
2: {
"N": lambda y, x: (4 * SIZE - 1, x - 2 * SIZE, "N"), # 6S
"E": lambda y, x: (3 * SIZE - y - 1, 2 * SIZE - 1, "W"), # 5E
"S": lambda y, x: (x - SIZE, 2 * SIZE - 1, "W"), # 3E
},
3: {
"W": lambda y, x: (2 * SIZE, y - SIZE, "S"), # 4N
"E": lambda y, x: (SIZE - 1, SIZE + y, "N"), # 2S
},
4: {
"W": lambda y, x: (3 * SIZE - y - 1, SIZE, "E"), # 1W
"N": lambda y, x: (SIZE + x, SIZE, "E"), # 3W
},
5: {
"E": lambda y, x: (3 * SIZE - y - 1, 3 * SIZE - 1, "W"), # 2E
"S": lambda y, x: (2 * SIZE + x, SIZE - 1, "W"), # 6E
},
6: {
"W": lambda y, x: (0, y - 2 * SIZE, "S"), # 1N
"E": lambda y, x: (3 * SIZE - 1, y - 2 * SIZE, "N"), # 5S
"S": lambda y, x: (0, x + 2 * SIZE, "S"), # 2N
},
}
def wrap_part_1(y0: int, x0: int, r0: str) -> tuple[int, int, str]:
if r0 == "E":
return y0, row_first_non_void[y0], r0
elif r0 == "S":
return col_first_non_void[x0], x0, r0
elif r0 == "W":
return y0, row_last_non_void[y0], r0
elif r0 == "N":
return col_last_non_void[x0], x0, r0
assert False
def wrap_part_2(y0: int, x0: int, r0: str) -> tuple[int, int, str]:
cube = faces[y0, x0]
assert r0 in faces_wrap[cube]
return faces_wrap[cube][r0](y0, x0)
def run(wrap: Callable[[int, int, str], tuple[int, int, str]]) -> tuple[int, int, str]:
y0 = 0
x0 = np.where(board[0] == EMPTY)[0][0]
r0 = "E"
for direction in directions:
if isinstance(direction, int):
while direction > 0:
if r0 == "E":
xi = np.where(board[y0, x0 + 1 : x0 + direction + 1] == WALL)[0]
if len(xi):
x0 = x0 + xi[0]
direction = 0
elif (
x0 + direction < board.shape[1]
and board[y0, x0 + direction] == EMPTY
):
x0 = x0 + direction
direction = 0
else:
y0_t, x0_t, r0_t = wrap(y0, x0, r0)
if board[y0_t, x0_t] == WALL:
x0 = row_last_non_void[y0]
direction = 0
else:
direction = direction - (row_last_non_void[y0] - x0) - 1
y0, x0, r0 = y0_t, x0_t, r0_t
elif r0 == "S":
yi = np.where(board[y0 + 1 : y0 + direction + 1, x0] == WALL)[0]
if len(yi):
y0 = y0 + yi[0]
direction = 0
elif (
y0 + direction < board.shape[0]
and board[y0 + direction, x0] == EMPTY
):
y0 = y0 + direction
direction = 0
else:
y0_t, x0_t, r0_t = wrap(y0, x0, r0)
if board[y0_t, x0_t] == WALL:
y0 = col_last_non_void[x0]
direction = 0
else:
direction = direction - (col_last_non_void[x0] - y0) - 1
y0, x0, r0 = y0_t, x0_t, r0_t
elif r0 == "W":
left = max(x0 - direction - 1, 0)
xi = np.where(board[y0, left:x0] == WALL)[0]
if len(xi):
x0 = left + xi[-1] + 1
direction = 0
elif x0 - direction >= 0 and board[y0, x0 - direction] == EMPTY:
x0 = x0 - direction
direction = 0
else:
y0_t, x0_t, r0_t = wrap(y0, x0, r0)
if board[y0_t, x0_t] == WALL:
x0 = row_first_non_void[y0]
direction = 0
else:
direction = direction - (x0 - row_first_non_void[y0]) - 1
y0, x0, r0 = y0_t, x0_t, r0_t
elif r0 == "N":
top = max(y0 - direction - 1, 0)
yi = np.where(board[top:y0, x0] == WALL)[0]
if len(yi):
y0 = top + yi[-1] + 1
direction = 0
elif y0 - direction >= 0 and board[y0 - direction, x0] == EMPTY:
y0 = y0 - direction
direction = 0
else:
y0_t, x0_t, r0_t = wrap(y0, x0, r0)
if board[y0_t, x0_t] == WALL:
y0 = col_first_non_void[x0]
direction = 0
else:
direction = direction - (y0 - col_first_non_void[x0]) - 1
y0, x0, r0 = y0_t, x0_t, r0_t
else:
r0 = {
"E": {"L": "N", "R": "S"},
"N": {"L": "W", "R": "E"},
"W": {"L": "S", "R": "N"},
"S": {"L": "E", "R": "W"},
}[r0][direction]
return y0, x0, r0
y1, x1, r1 = run(wrap_part_1)
answer_1 = 1000 * (1 + y1) + 4 * (1 + x1) + SCORES[r1]
print(f"answer 1 is {answer_1}")
y2, x2, r2 = run(wrap_part_2)
answer_2 = 1000 * (1 + y2) + 4 * (1 + x2) + SCORES[r2]
print(f"answer 2 is {answer_2}")

105
2022/day23.py Normal file
View File

@ -0,0 +1,105 @@
# -*- encoding: utf-8 -*-
import itertools
import sys
from collections import defaultdict
Directions = list[
tuple[
str, tuple[int, int], tuple[tuple[int, int], tuple[int, int], tuple[int, int]]
]
]
# (Y, X)
DIRECTIONS: Directions = [
("N", (-1, 0), ((-1, -1), (-1, 0), (-1, 1))),
("S", (1, 0), ((1, -1), (1, 0), (1, 1))),
("W", (0, -1), ((-1, -1), (0, -1), (1, -1))),
("E", (0, 1), ((-1, 1), (0, 1), (1, 1))),
]
def min_max_yx(positions: set[tuple[int, int]]) -> tuple[int, int, int, int]:
ys, xs = {y for y, x in positions}, {x for y, x in positions}
return min(ys), min(xs), max(ys), max(xs)
def print_positions(positions: set[tuple[int, int]]):
min_y, min_x, max_y, max_x = min_max_yx(positions)
print(
"\n".join(
"".join(
"#" if (y, x) in positions else "." for x in range(min_x - 1, max_x + 2)
)
for y in range(min_y - 1, max_y + 2)
)
)
def round(
positions: set[tuple[int, int]],
directions: Directions,
):
to_move: dict[tuple[int, int], list[tuple[int, int]]] = defaultdict(lambda: [])
for (y, x) in positions:
elves = {
(dy, dx): (y + dy, x + dx) in positions
for dy, dx in itertools.product((-1, 0, 1), (-1, 0, 1))
if (dy, dx) != (0, 0)
}
if not any(elves.values()):
to_move[y, x].append((y, x))
continue
found: str | None = None
for d, (dy, dx), d_yx_check in directions:
if not any(elves[dy, dx] for dy, dx in d_yx_check):
found = d
to_move[y + dy, x + dx].append((y, x))
break
if found is None:
to_move[y, x].append((y, x))
positions.clear()
for ty, tx in to_move:
if len(to_move[ty, tx]) > 1:
positions.update(to_move[ty, tx])
else:
positions.add((ty, tx))
directions.append(directions.pop(0))
POSITIONS = {
(i, j)
for i, row in enumerate(sys.stdin.read().splitlines())
for j, col in enumerate(row)
if col == "#"
}
# === part 1 ===
p1, d1 = POSITIONS.copy(), DIRECTIONS.copy()
for r in range(10):
round(p1, d1)
min_y, min_x, max_y, max_x = min_max_yx(p1)
answer_1 = sum(
(y, x) not in p1 for y in range(min_y, max_y + 1) for x in range(min_x, max_x + 1)
)
print(f"answer 1 is {answer_1}")
# === part 2 ===
p2, d2 = POSITIONS.copy(), DIRECTIONS.copy()
answer_2 = 0
while True:
answer_2 += 1
backup = p2.copy()
round(p2, d2)
if backup == p2:
break
print(f"answer 2 is {answer_2}")

100
2022/day24.py Normal file
View File

@ -0,0 +1,100 @@
# -*- encoding: utf-8 -*-
import heapq
import math
import sys
from collections import defaultdict
lines = sys.stdin.read().splitlines()
winds = {
(i - 1, j - 1, lines[i][j])
for i in range(1, len(lines) - 1)
for j in range(1, len(lines[i]) - 1)
if lines[i][j] != "."
}
n_rows, n_cols = len(lines) - 2, len(lines[0]) - 2
CYCLE = math.lcm(n_rows, n_cols)
east_winds = [{j for j in range(n_cols) if (i, j, ">") in winds} for i in range(n_rows)]
west_winds = [{j for j in range(n_cols) if (i, j, "<") in winds} for i in range(n_rows)]
north_winds = [
{i for i in range(n_rows) if (i, j, "^") in winds} for j in range(n_cols)
]
south_winds = [
{i for i in range(n_rows) if (i, j, "v") in winds} for j in range(n_cols)
]
def run(start: tuple[int, int], start_cycle: int, end: tuple[int, int]):
def heuristic(y: int, x: int) -> int:
return abs(end[0] - y) + abs(end[1] - x)
# (distance + heuristic, distance, (start_pos, cycle))
queue = [(heuristic(start[0], start[1]), 0, ((start[0], start[1]), start_cycle))]
visited: set[tuple[tuple[int, int], int]] = set()
distances: dict[tuple[int, int], dict[int, int]] = defaultdict(lambda: {})
while queue:
_, distance, ((y, x), cycle) = heapq.heappop(queue)
if ((y, x), cycle) in visited:
continue
distances[y, x][cycle] = distance
visited.add(((y, x), cycle))
if (y, x) == (end[0], end[1]):
break
for dy, dx in (0, 0), (-1, 0), (1, 0), (0, -1), (0, 1):
ty = y + dy
tx = x + dx
n_cycle = (cycle + 1) % CYCLE
if (ty, tx) == end:
heapq.heappush(queue, (distance + 1, distance + 1, ((ty, tx), n_cycle)))
break
if ((ty, tx), n_cycle) in visited:
continue
if (ty, tx) != start and (ty < 0 or tx < 0 or ty >= n_rows or tx >= n_cols):
continue
if (ty, tx) != start:
if (ty - n_cycle) % n_rows in south_winds[tx]:
continue
if (ty + n_cycle) % n_rows in north_winds[tx]:
continue
if (tx + n_cycle) % n_cols in west_winds[ty]:
continue
if (tx - n_cycle) % n_cols in east_winds[ty]:
continue
heapq.heappush(
queue,
((heuristic(ty, tx) + distance + 1, distance + 1, ((ty, tx), n_cycle))),
)
return distances, next(iter(distances[end].values()))
start = (
-1,
next(j for j in range(1, len(lines[0]) - 1) if lines[0][j] == ".") - 1,
)
end = (
n_rows,
next(j for j in range(1, len(lines[-1]) - 1) if lines[-1][j] == ".") - 1,
)
distances_1, forward_1 = run(start, 0, end)
print(f"answer 1 is {forward_1}")
distances_2, return_1 = run(end, next(iter(distances_1[end].keys())), start)
distances_3, forward_2 = run(start, next(iter(distances_2[start].keys())), end)
print(f"answer 2 is {forward_1 + return_1 + forward_2}")

29
2022/day25.py Normal file
View File

@ -0,0 +1,29 @@
# -*- encoding: utf-8 -*-
import sys
lines = sys.stdin.read().splitlines()
coeffs = {"2": 2, "1": 1, "0": 0, "-": -1, "=": -2}
def snafu2number(number: str) -> int:
value = 0
for c in number:
value *= 5
value += coeffs[c]
return value
def number2snafu(number: int) -> str:
values = ["0", "1", "2", "=", "-"]
res = ""
while number > 0:
mod = number % 5
res = res + values[mod]
number = number // 5 + int(mod >= 3)
return "".join(reversed(res))
answer_1 = number2snafu(sum(map(snafu2number, lines)))
print(f"answer 1 is {answer_1}")

25
2022/day3.py Normal file
View File

@ -0,0 +1,25 @@
# -*- encoding: utf-8 -*-
import string
import sys
lines = [line.strip() for line in sys.stdin.readlines()]
# extract content of each part
parts = [(set(line[: len(line) // 2]), set(line[len(line) // 2 :])) for line in lines]
# priorities
priorities = {c: i + 1 for i, c in enumerate(string.ascii_letters)}
# part 1
part1 = sum(priorities[c] for p1, p2 in parts for c in p1.intersection(p2))
print(f"score 1 is {part1}")
# part 2
n_per_group = 3
part2 = sum(
priorities[c]
for i in range(0, len(lines), n_per_group)
for c in set(lines[i]).intersection(*lines[i + 1 : i + n_per_group])
)
print(f"score 2 is {part2}")

19
2022/day4.py Normal file
View File

@ -0,0 +1,19 @@
# -*- encoding: utf-8 -*-
import sys
lines = [line.strip() for line in sys.stdin.readlines()]
def make_range(value: str) -> set[int]:
parts = value.split("-")
return set(range(int(parts[0]), int(parts[1]) + 1))
sections = [tuple(make_range(part) for part in line.split(",")) for line in lines]
score_1 = sum(s1.issubset(s2) or s2.issubset(s1) for s1, s2 in sections)
print(f"score 1 is {score_1}")
score_2 = sum(bool(s1.intersection(s2)) for s1, s2 in sections)
print(f"score 1 is {score_2}")

43
2022/day5.py Normal file
View File

@ -0,0 +1,43 @@
# -*- encoding: utf-8 -*-
import copy
import sys
blocks_s, moves_s = (part.splitlines() for part in sys.stdin.read().split("\n\n"))
blocks: dict[str, list[str]] = {stack: [] for stack in blocks_s[-1].split()}
# this codes assumes that the lines are regular, i.e., 4 characters per "crate" in the
# form of '[X] ' (including the trailing space)
#
for block in blocks_s[-2::-1]:
for stack, index in zip(blocks, range(0, len(block), 4)):
crate = block[index + 1 : index + 2].strip()
if crate:
blocks[stack].append(crate)
# part 1 - deep copy for part 2
blocks_1 = copy.deepcopy(blocks)
for move in moves_s:
_, count_s, _, from_, _, to_ = move.strip().split()
for _i in range(int(count_s)):
blocks_1[to_].append(blocks_1[from_].pop())
# part 2
blocks_2 = copy.deepcopy(blocks)
for move in moves_s:
_, count_s, _, from_, _, to_ = move.strip().split()
count = int(count_s)
blocks_2[to_].extend(blocks_2[from_][-count:])
del blocks_2[from_][-count:]
answer_1 = "".join(s[-1] for s in blocks_1.values())
print(f"answer 1 is {answer_1}")
answer_2 = "".join(s[-1] for s in blocks_2.values())
print(f"answer 2 is {answer_2}")

17
2022/day6.py Normal file
View File

@ -0,0 +1,17 @@
# -*- encoding: utf-8 -*-
import sys
def index_of_first_n_differents(data: str, n: int) -> int:
for i in range(len(data)):
if len(set(data[i : i + n])) == n:
return i + n
return -1
data = sys.stdin.read().strip()
print(f"answer 1 is {index_of_first_n_differents(data, 4)}")
print(f"answer 2 is {index_of_first_n_differents(data, 14)}")

82
2022/day7.py Normal file
View File

@ -0,0 +1,82 @@
# -*- encoding: utf-8 -*-
import sys
from pathlib import Path
lines = sys.stdin.read().splitlines()
# we are going to use Path to create path and go up/down in the file tree since it
# implements everything we need
#
# we can use .resolve() to get normalized path, although this will add C:\ to all paths
# on Windows but that is not an issue since only the sizes matter
#
# mapping from path to list of files or directories
trees: dict[Path, list[Path]] = {}
# mapping from paths to either size (for file) or -1 for directory
sizes: dict[Path, int] = {}
# first line must be a cd otherwise we have no idea where we are
assert lines[0].startswith("$ cd")
base_path = Path(lines[0].strip("$").split()[1]).resolve()
cur_path = base_path
trees[cur_path] = []
sizes[cur_path] = -1
for line in lines[1:]:
# command
if line.startswith("$"):
parts = line.strip("$").strip().split()
command = parts[0]
if command == "cd":
cur_path = cur_path.joinpath(parts[1]).resolve()
# just initialize the lis of files if not already done
if cur_path not in trees:
trees[cur_path] = []
else:
# nothing to do here
pass
# fill the current path
else:
parts = line.split()
name: str = parts[1]
if line.startswith("dir"):
size = -1
else:
size = int(parts[0])
path = cur_path.joinpath(name)
trees[cur_path].append(path)
sizes[path] = size
def compute_size(path: Path) -> int:
size = sizes[path]
if size >= 0:
return size
return sum(compute_size(sub) for sub in trees[path])
acc_sizes = {path: compute_size(path) for path in trees}
# part 1
answer_1 = sum(size for size in acc_sizes.values() if size <= 100_000)
print(f"answer 1 is {answer_1}")
# part 2
total_space = 70_000_000
update_space = 30_000_000
free_space = total_space - acc_sizes[base_path]
to_free_space = update_space - free_space
answer_2 = min(size for size in acc_sizes.values() if size >= to_free_space)
print(f"answer 2 is {answer_2}")

54
2022/day8.py Normal file
View File

@ -0,0 +1,54 @@
# -*- encoding: utf-8 -*-
import sys
import numpy as np
lines = sys.stdin.read().splitlines()
trees = np.array([[int(x) for x in row] for row in lines])
# answer 1
highest_trees = np.ones(trees.shape + (4,), dtype=int) * -1
highest_trees[1:-1, 1:-1] = [
[
[
trees[:i, j].max(),
trees[i + 1 :, j].max(),
trees[i, :j].max(),
trees[i, j + 1 :].max(),
]
for j in range(1, trees.shape[1] - 1)
]
for i in range(1, trees.shape[0] - 1)
]
answer_1 = (highest_trees.min(axis=2) < trees).sum()
print(f"answer 1 is {answer_1}")
def viewing_distance(row_of_trees: np.ndarray, value: int) -> int:
w = np.where(row_of_trees >= value)[0]
if not w.size:
return len(row_of_trees)
return w[0] + 1
# answer 2
v_distances = np.zeros(trees.shape + (4,), dtype=int)
v_distances[1:-1, 1:-1, :] = [
[
[
viewing_distance(trees[i - 1 :: -1, j], trees[i, j]),
viewing_distance(trees[i, j - 1 :: -1], trees[i, j]),
viewing_distance(trees[i, j + 1 :], trees[i, j]),
viewing_distance(trees[i + 1 :, j], trees[i, j]),
]
for j in range(1, trees.shape[1] - 1)
]
for i in range(1, trees.shape[0] - 1)
]
answer_2 = np.prod(v_distances, axis=2).max()
print(f"answer 2 is {answer_2}")

64
2022/day9.py Normal file
View File

@ -0,0 +1,64 @@
# -*- encoding: utf-8 -*-
import sys
import numpy as np
def move(head: tuple[int, int], command: str) -> tuple[int, int]:
h_col, h_row = head
if command == "L":
head = (h_col - 1, h_row)
elif command == "R":
head = (h_col + 1, h_row)
elif command == "U":
head = (h_col, h_row + 1)
elif command == "D":
head = (h_col, h_row - 1)
return head
def follow(head: tuple[int, int], tail: tuple[int, int]) -> tuple[int, int]:
h_col, h_row = head
t_col, t_row = tail
if abs(t_col - h_col) <= 1 and abs(t_row - h_row) <= 1:
return tail
return t_col + np.sign(h_col - t_col), t_row + np.sign(h_row - t_row)
def run(commands: list[str], n_blocks: int) -> list[tuple[int, int]]:
blocks = [(0, 0) for _ in range(n_blocks)]
visited = [blocks[-1]]
for command in commands:
blocks[0] = move(blocks[0], command)
for i in range(0, n_blocks - 1):
blocks[i + 1] = follow(blocks[i], blocks[i + 1])
visited.append(blocks[-1])
return visited
lines = sys.stdin.read().splitlines()
# flatten the commands
commands: list[str] = []
for line in lines:
d, c = line.split()
commands.extend(d * int(c))
visited_1 = run(commands, n_blocks=2)
print(f"answer 1 is {len(set(visited_1))}")
visited_2 = run(commands, n_blocks=10)
print(f"answer 2 is {len(set(visited_2))}")

144
2022/inputs/day10.txt Normal file
View File

@ -0,0 +1,144 @@
addx 1
addx 4
addx 1
noop
addx 4
addx 3
addx -2
addx 5
addx -1
noop
addx 3
noop
addx 7
addx -1
addx 1
noop
addx 6
addx -1
addx 5
noop
noop
noop
addx -37
addx 7
noop
noop
noop
addx 5
noop
noop
noop
addx 9
addx -8
addx 2
addx 5
addx 2
addx 5
noop
noop
addx -2
noop
addx 3
addx 2
noop
addx 3
addx 2
noop
addx 3
addx -36
noop
addx 26
addx -21
noop
noop
noop
addx 3
addx 5
addx 2
addx -4
noop
addx 9
addx 5
noop
noop
noop
addx -6
addx 7
addx 2
noop
addx 3
addx 2
addx 5
addx -39
addx 34
addx 5
addx -35
noop
addx 26
addx -21
addx 5
addx 2
addx 2
noop
addx 3
addx 12
addx -7
noop
noop
noop
noop
noop
addx 5
addx 2
addx 3
noop
noop
noop
noop
addx -37
addx 21
addx -14
addx 16
addx -11
noop
addx -2
addx 3
addx 2
addx 5
addx 2
addx -15
addx 6
addx 12
addx -2
addx 9
addx -6
addx 7
addx 2
noop
noop
noop
addx -33
addx 1
noop
addx 2
addx 13
addx 15
addx -21
addx 21
addx -15
noop
noop
addx 4
addx 1
noop
addx 4
addx 8
addx 6
addx -11
addx 5
addx 2
addx -35
addx -1
noop
noop

55
2022/inputs/day11.txt Normal file
View File

@ -0,0 +1,55 @@
Monkey 0:
Starting items: 54, 53
Operation: new = old * 3
Test: divisible by 2
If true: throw to monkey 2
If false: throw to monkey 6
Monkey 1:
Starting items: 95, 88, 75, 81, 91, 67, 65, 84
Operation: new = old * 11
Test: divisible by 7
If true: throw to monkey 3
If false: throw to monkey 4
Monkey 2:
Starting items: 76, 81, 50, 93, 96, 81, 83
Operation: new = old + 6
Test: divisible by 3
If true: throw to monkey 5
If false: throw to monkey 1
Monkey 3:
Starting items: 83, 85, 85, 63
Operation: new = old + 4
Test: divisible by 11
If true: throw to monkey 7
If false: throw to monkey 4
Monkey 4:
Starting items: 85, 52, 64
Operation: new = old + 8
Test: divisible by 17
If true: throw to monkey 0
If false: throw to monkey 7
Monkey 5:
Starting items: 57
Operation: new = old + 2
Test: divisible by 5
If true: throw to monkey 1
If false: throw to monkey 3
Monkey 6:
Starting items: 60, 95, 76, 66, 91
Operation: new = old * old
Test: divisible by 13
If true: throw to monkey 2
If false: throw to monkey 5
Monkey 7:
Starting items: 65, 84, 76, 72, 79, 65
Operation: new = old + 5
Test: divisible by 19
If true: throw to monkey 6
If false: throw to monkey 0

41
2022/inputs/day12.txt Normal file
View File

@ -0,0 +1,41 @@
abcccccccaaaaaaaaccccccccccaaaaaaccccccaccaaaaaaaccccccaacccccccccaaaaaaaaaaccccccccccccccccccccccccccccccccaaaaa
abcccccccaaaaaaaaacccccccccaaaaaacccccaaacaaaaaaaaaaaccaacccccccccccaaaaaaccccccccccccccccccccccccccccccccccaaaaa
abcccccccaaaaaaaaaaccccccccaaaaaacaaacaaaaaaaaaaaaaaaaaaccccccccccccaaaaaaccccccccccccccaaacccccccccccccccccaaaaa
abaaacccccccaaaaaaacccccccccaaacccaaaaaaaaaaaaaaaaaaaaaaaaacccccccccaaaaaaccccccccccccccaaacccccccccccccccccaaaaa
abaaaaccccccaaaccccccccccccccccccccaaaaaaaaacaaaacacaaaaaacccccccccaaaaaaaacccccccccccccaaaaccaaacccccccccccaccaa
abaaaaccccccaaccccaaccccccccccccccccaaaaaaacaaaaccccaaaaaccccccccccccccccacccccccccccccccaaaaaaaaacccccccccccccca
abaaaaccccccccccccaaaacccccccccaacaaaaaaaacccaaacccaaacaacccccccccccccccccccccccccccciiiiaaaaaaaacccccccccccccccc
abaaacccccccccccaaaaaacccccccccaaaaaaaaaaacccaaacccccccaacccccccccccaacccccccccccccciiiiiiijaaaaccccccccaaccccccc
abaaaccccccccccccaaaacccccccccaaaaaaaacaaacccaaaccccccccccccccccccccaaacaaacccccccciiiiiiiijjjacccccccccaaacccccc
abcccccaacaacccccaaaaaccccccccaaaaaacccccacaacccccccccccccccccccccccaaaaaaaccccccciiiinnnoijjjjjjjjkkkaaaaaaacccc
abcccccaaaaacccccaacaaccccccccccaaaacccaaaaaaccccccccccccccccccccccccaaaaaaccccccciiinnnnooojjjjjjjkkkkaaaaaacccc
abccccaaaaacccccccccccccccccccccaccccccaaaaaaaccccccccccccccccccccaaaaaaaaccccccchhinnnnnoooojjooopkkkkkaaaaccccc
abccccaaaaaaccccccccccccccccccccccccccccaaaaaaacccccccccccccccccccaaaaaaaaacccccchhhnnntttuooooooopppkkkaaaaccccc
abccccccaaaaccccccccccacccccccccccccccccaaaaaaacccaaccccccccccccccaaaaaaaaaaccccchhhnnttttuuoooooppppkkkaaaaccccc
abccccccaccccccccccccaaaacaaaccccccccccaaaaaacaaccaacccaaccccccccccccaaacaaacccchhhnnnttttuuuuuuuuupppkkccaaccccc
abccccccccccccccaaccccaaaaaaaccccccccccaaaaaacaaaaaacccaaaaaaccccccccaaacccccccchhhnnntttxxxuuuuuuupppkkccccccccc
abcccccccccccccaaaacccaaaaaaacccaccccccccccaaccaaaaaaacaaaaaaccccccccaacccaaccchhhhnnnttxxxxuuyyyuupppkkccccccccc
abcccccccccccccaaaaccaaaaaaaaacaaacccccccccccccaaaaaaaaaaaaaccccccccccccccaaachhhhmnnnttxxxxxxyyyuvppkkkccccccccc
abcccccccccccccaaaacaaaaaaaaaaaaaaccccccccccccaaaaaacaaaaaaaccccccccccccccaaaghhhmmmttttxxxxxyyyyvvpplllccccccccc
abccacccccccccccccccaaaaaaaaaaaaaaccccccccccccaaaaaacccaaaaaacccaacaacccaaaaagggmmmttttxxxxxyyyyvvppplllccccccccc
SbaaaccccccccccccccccccaaacaaaaaaaacccccccccccccccaacccaaccaacccaaaaacccaaaagggmmmsttxxxEzzzzyyvvvppplllccccccccc
abaaaccccccccccccccccccaaaaaaaaaaaaacaaccccccccccccccccaaccccccccaaaaaccccaagggmmmsssxxxxxyyyyyyvvvqqqlllcccccccc
abaaacccccccccccccccccccaaaaaaaaaaaaaaaaacccccccccccccccccccccccaaaaaaccccaagggmmmsssxxxwywyyyyyyvvvqqlllcccccccc
abaaaaacccccccccccccccccccaacaaaccaaaaaaacccccccccccccccccccccccaaaaccccccaagggmmmssswwwwwyyyyyyyvvvqqqllcccccccc
abaaaaaccccccccccccccccccccccaaaccccaaaacccccccccccccccccaaccaacccaaccccccccgggmmmmssssswwyywwvvvvvvqqqlllccccccc
abaaaaacccccccccccccaccacccccaaaccccaaaacccccccccccccccccaaaaaacccccccccccaaggggmllllsssswwywwwvvvvqqqqlllccccccc
abaaccccccccccccccccaaaaccccccccccccaccaccccccccccccccccccaaaaacccccccccccaaagggglllllssswwwwwrrqqqqqqmmllccccccc
abaaccccccccccccccccaaaaaccccccaaccaaccccccccccccccccccccaaaaaaccaacccccccaaaaggfffllllsswwwwrrrrqqqqqmmmcccccccc
abacaaaccccccccccccaaaaaaccccccaaaaaaccccccaacccccccccccaaaaaaaacaaacaaccccaaaaffffflllsrrwwwrrrmmmmmmmmmcccccccc
abaaaaaccccccccccccaaaaaaccccccaaaaaccccccaaaaccccccccccaaaaaaaacaaaaaaccccaaaaccfffflllrrrrrrkkmmmmmmmccccaccccc
abaaaacccccccccccccccaaccccccccaaaaaacccccaaaacccccccccccccaaccaaaaaaaccccccccccccffflllrrrrrkkkmmmmmccccccaccccc
abaaacccccccccccccccccccccccccaaaaaaaaccccaaaacccccccccccccaaccaaaaaaacccccccccccccfffllkrrrkkkkmddddcccccaaacccc
abaaacccccccccccccccccccccccccaaaaaaaacccccccccccccccccccccccccccaaaaaaccccccccccccfffllkkkkkkkdddddddcaaaaaacccc
abaaaacccccccccccccccccccccccccccaaccccccccccccccccccccccccccccccaacaaacccccccccccccfeekkkkkkkddddddcccaaaccccccc
abcaaacccccccccccaaaccccccccaacccaaccccaaaaaccccaaaccccccccccccccaaccccccccccccccccceeeeekkkkdddddccccccaaccccccc
abccccccccccccccaaaaaaccccccaaacaaccacaaaaaaaccaaaaccccccccccaccaaccccccccccccccccccceeeeeeeedddacccccccccccccccc
abccccccccccccccaaaaaacccccccaaaaacaaaaaccaaaaaaaacccccccccccaaaaacccccccccccccccccccceeeeeeedaaacccccccccccccaaa
abccccccaaacccccaaaaacccccccaaaaaacaaaaaaaaaaaaaaaccccccccccccaaaaaccccccccccccccccccccceeeeecaaacccccccccccccaaa
abccccccaaaccccccaaaaacccccaaaaaaaaccaaaaacaaaaaaccccccccccccaaaaaacccccccccccccccccccccaaaccccaccccccccccccccaaa
abccccaacaaaaacccaaaaacccccaaaaaaaacaaaaaaaaaaaaaaaccccaaaaccaaaacccccccccccccccccccccccaccccccccccccccccccaaaaaa
abccccaaaaaaaaccccccccccccccccaaccccaacaaaaaaaaaaaaaaccaaaaccccaaacccccccccccccccccccccccccccccccccccccccccaaaaaa

449
2022/inputs/day13.txt Normal file
View File

@ -0,0 +1,449 @@
[[],[],[[],10,[[7,0,1,1,10],9,6],[1,[4,9,1],6,[4,6,0]],[0,3,0]],[1,[10,[7,4,3,4],[]],[2,2],7,[[10],5,3]]]
[[8,1,[2,3,3,[6,7,7,2,6]],[[8,10,1]],[9]],[1,7,[7,[3,6],7,7,10]]]
[[[[3,0,4,4],9,2],8,[[1],3,[2,0,9,3],[5,3,6,4,5]]],[],[]]
[[[],[]],[[[8,4],[5,5,9,9],[1,9,1,8],0]]]
[[5,[4,[8,3,4],1,1,[3,8,9,4,0]],4]]
[[7,1,[[9,0,5,5,9],[5,0,3],[0,5,5,10,0],3,7],1],[9,[[1,6,3,2,2],7,[8,9],[7,7,2,10]],[],[]],[[8,0,[0],5],[[3]],3,[[1,0,0,9],[10,7,0,10]]],[[],8,2,3,[[10],[10,6,10],0,9]]]
[[4,8,6,8]]
[[[3,[],[4,7,4,4],1],1,[6,[5],[1,1,6,8]],3,10],[2,[3,6,[],6],10]]
[[1],[[0],5]]
[[10,[[2],10,[6,4,0],[],9]],[4,9,[[9,6,10,7]]]]
[[8,[[4,1,1,4],[6,10,6,6],7,6,[9,9,1]],[[0,9],3]],[1,[5],5,[]]]
[[],[[]]]
[[[[3,9],[],[5,9,8,3]],2,5,9,8]]
[[[9,0],4,[9,10],[5,6,10,0,[6]]]]
[[],[9],[4,[[10]],8,10,[10,10,[],[]]],[[],[[10,4,6]],[[1,1,6],[]],5],[[[1,7,5],[10,1,6],6,[]],[],2,3,9]]
[[],[[4,[5,4,8,7],[10]]],[10,7,[3],8],[[6,[1,2,9,5]],[],[[2,4,3]],[3,[3,8,9,8],[9]]],[[[6,0,0,7,3],9,3],[9,[0,4]],[[8,8],[2,1,8],[]],3,[]]]
[[[9,0,9],3,10,5,7],[8,10],[[[1,6],[3,5,2,7],[2,3,0,5,8],[1,3],10],[],8],[[4,[]]]]
[[7,[3,10,3],[[],[3],2,[5,4,3,10]],5,2],[6],[3,[],[[3,0,4,0]]]]
[[[10,3,[8]],10,1]]
[[[],5,1,[10,[3,8,7],[5],[1,3,6,0],[4,8,10,6]],[[7,7,1],[0,2],8,[2,1,9,8],8]]]
[[6,[9,[1]],10,[7],10],[[10,4,9],5]]
[[6,10,[[7,10,1]]],[[[2,9,0,3],[4,5,10,0,6],[2,4,2],9]],[],[[[5,0,8],[2,2,1,1],[1,6],5],[]]]
[[3,10,[7]],[4,[[0,3,8]],5,10],[],[[[8,9,4,8,10],[5,9,7,1,0],[6,5],8,7]],[]]
[[2,6,[7,7,[3,8]],[[1,6,7,1,9],7,7,[5]],3],[8,[8,[4,7,1,2,4],[2,8],[6,9,9,8,4],9],[[3,10,2,0]]],[[5,[6,9],[]],0],[7],[[[]],3,[3],1]]
[[6],[],[[[1,5,1,9,5]],7,10]]
[[],[5,[]],[[[1,2,1,1,7],[5,4,5]],8,3,3,8],[1,[5,[10,0,7],[7,4,9]]]]
[[1,2,8,[[4,10,2],[7,4,1,2,5],9],[7,0,[5,10,2,5,1],[5,4,9,2],0]],[1,10,[[5,10,4],[6],[8]],[[8],[2,9,10,1,3]],5],[[4],0],[]]
[[9,[[2,9,6,7],6,[6]],7]]
[[[]],[[],5,[2,3]],[],[8,[],3],[9]]
[[9,[6,6,9,[6,3,6,8],[]],[[],8,[0,8],[9],0],1,[]]]
[[0,[],10,[4,[8,7,10]],8],[[[],[10,6]]],[10,[1,[1,8,1,2],5,2],[[0,8,0],[1,9,1,1],[3,8,3],0],7,[0,5]]]
[[8,4,[6,9,2,[4,5,6],4],[[10,9,0,0,1],[6,7,8,8]]],[[[2,5,6,1],2,8,[6,8,3,9]],[[4,10,0]],0,9]]
[4,6,8,10,9]
[4,6,8,10]
[[[10,2,[0,1,2,0],0],7,[2],[[],[0],9]]]
[[],[[]],[9]]
[[1]]
[[],[[10],10]]
[[],[],[],[[[1]],9,10,[1,0,5]],[]]
[[6,[[4,4,9],[10,3,10,1,4],[10,5]],4,[[1,7,5,0,1],[3,7,10,1,1]]]]
[[[[9],[8]],[6,3,4],5],[[6,3],[7],[[5,10]],10],[],[3,5,[3,0,[0,3,3]],8,[]]]
[[3,[10,10],4],[8,[[7,1,0,6]],1],[8,[[5,0,7,4],[1,4],1],5,[[7,1],[2],[0,9,5,7,5]]],[[5,[6,3],[0,8,3,2],10,[10]]]]
[[],[[[1],0],[9,7,7,[3,9,3,9,10]],8,[5,10,[5,5,8,3,7],7,[9,0,7]]],[[8,2,[0],7],4]]
[[[8,0,4],5,3,2,5],[4,7,6]]
[[3,1,[[6],[2],[4,8,7,10],2],1],[[[6,2,8,6,4]],6,[9]],[8,[0],1],[]]
[[],[[[0],3,[2,10],10,[2,0,6,3]],9],[1,[[],10,[],8],[[6],2,7,8],[10,[4,3,4],[10,3,5,3,5]]],[[2,[],8],2,0,8]]
[[],[[[1,7],[0,2],[3,2,8],[7]],0],[1,[1,[7]]],[6],[[[7],[],[8,8,10],[0,5,1]],2,5,[[4,6,6,8],8,[0,9,4,5,4],4],[1,5,6,[2,4,6],[4]]]]
[[4,[5,[5],6]]]
[[[[6,10,4],7,[],[5],[5]],1,9,7]]
[[[]],[[[5,0,6,3,5],[]],8,[8,10,5,2],4,10],[7,[[8,0,9],9,[6,9],1,1],4,10],[6,4,6,9,5],[]]
[[[],1,9],[6,3,[[8,10,4,1]]],[[[0,4],9,7,[0,0,5]]],[[]]]
[[[9,3],[[]]]]
[[9,0,8,0],[[1,[0],8,[]]],[],[5,8,[[8,9,0,8,0],0,8,[],[]],[1,2,5],[[],5]],[[3,1,6,[],[4,9,3,6]],[5,[10,10,4],3]]]
[[6,[[],2,9],[1,9,[6,2,5,1],[1,5,0,8]]],[[2,[4,4,2,6,1],6],[],[],8,[[]]],[[[7,8,10,2,10],[1,4,9,5,2],7,[6,6,4,10,9],[7,3,3,0,0]]],[],[7,3,[2,[1,2],[2,2]]]]
[[1,[[2,6,1,6],[4,6],[3],[],[1]],8],[[8],6,5,[5,[4]],6],[[[],5,10,[10,7],[3,7,5,9,10]],0]]
[[[9,[7],1,[],5]]]
[[[9,2,1,0,6],[[0,4,8],5],[[],[],0,[8]]],[[[],2],[[7,7,7,8,10],10,[0],[0,2]],[],[]],[],[]]
[[],[5],[[[],5,[8,8,1,5],9],[7],[1,3,5,[0,0,0]]],[]]
[[[],[5,4,[],10,[1,8,1]]],[7],[[[1,4,10,10,4],[],9,[7,10,10,0,2],[10,4]],[4,[3,5,1],6,1]],[[[1,1,9,3,5],10,[2,1,3,9,3],[6,10]],[[],[]],2]]
[[[[1,3,7,8,5]],[1,[1,8,3],[4,1,3]],0,2,4],[],[],[[5,[7,9,2,5,2]],[[10,10,10,8,3],2,[]]]]
[[[[1,0,3],[10,8],[],[9,1,9],[0,5,2,4]],[],3,[[6,8,7],[6,0,7,1,0],3,10],2],[1,7,[4,[5,7],[4,6]],9],[[],[[1,2,0,5],1,3,[9],0],5],[]]
[[[[7,7,1,2]]]]
[[5,9],[[9,[1,9,2,2]],[[],8,[1,1]],[[],[6,4,0,3,3],[8,0]],[8],7],[[1],5,6,10],[]]
[[[]],[[[0,2,8,5,4],[4,5],5],7],[[[0,10,3,4],8,[0,7,10,2],[6,1,9,9,10]],9,2,6],[1,[2,7,[6,6,2,2],[10,0,9,4,3],2],6,[[2,1,4,1],10,[7,5]]]]
[[[[5,2,7,9],[10,0,8,1,1],[]],[6,6,3,[8,7,1,9,1],4],[[6,1,4,8,1]],[0,[5,10,2],5],1],[[],[5,10,1,4]],[0,[10,10],[1,[7,0,5],[4],[10,5,3,4,2],[8,10,1]],[],[5,[0,6,3,7,4],2,9,4]],[[6],[],0]]
[[[2,[10,9,9,9],7],[9,[1],10],1,[[5,10,5,4],2,1,1,[]],[10,[2,10],[0,7,2,5],0,1]]]
[[[4,9,[5,6,9,6],[7],[0,9,5,8,1]],[[8,0,2,5]]],[],[6,[[7,10],9]],[[5,2,[]],2],[[9,0],5,[[2]]]]
[[[]],[],[[[2,9],0],2,[[6,2],6,[3,8,1,1],1]],[]]
[[3,6,4,[2,5,0,[8,6,8],4],[[1],[5]]],[0,[2]],[],[5,[],[5,4,[10,9,4],9,6]]]
[[[[5,10,3],6,[2],[]],[[8,1,7,7,10],0,[6,8,9,3,9],[10,5,4],[9]],[[]],[[6,1,4,3,9],[10,9,9]],8],[9,7,6,[[3,8,0,1,1],1],8]]
[[[[0,3,8,10,5],2,[],[],[9]],3,6,[5,[0]],[5,[]]],[]]
[[0,3]]
[[[3]],[9],[],[[4,1,9,[5],[]]]]
[[[9,[5,6,3],4,[4]],[[],[5,6,4],[7,5,10,8]]],[[0,[8,3],4,6,[9,9,4,1,0]],[[3,5,1,7]],8,[]],[[],0,[8,2,9]],[4,[[],5,[10,10,10,6,6],[8,7,3]],[5,[1]]]]
[[[[1,0,3,6],6,[10,10,6,8]],[]],[[1,2,[9,7,1,10],[]],[[10,3,0,8,8]],2,8,[7,4]],[[[10,8,4]],[2,3],6],[[[10,6],[5],9,1],[],7]]
[[],[[],[[3,8,4],0,[]],[],6,[[3,7,1,0],10,8]],[[9,4,[]]]]
[[[8,[4]],6,3,10],[[5,1,8,[0,6],2]],[],[[],[[10],[6,6],0,[1,7]],8],[[[1],0,5,[],10],7,2,[10,[8,3],9,3,[]],4]]
[[[6],3,[]],[[[1,3,1],[1],[9,7]],[6,[1,9,9,7,9],2]]]
[[],[[8,4],0,[10,[]],5],[5]]
[[[4,[],[],7]],[[6,[3,5],[0,5,8],8,7],[7,0,[8]]]]
[[[2,[6],[9,7,1,2,5]],8,[3,[4,0,4,7,3],[],3],[[1,3,1,8],[5],4],4],[10,4,7,3],[[]]]
[[9,0,7,[],[8,5,10,[2,0,1,7,4],6]],[[8,[],10,6],1,[[5,0,7,0],[]]],[[9,[8,4,0],[0,8,8]]]]
[[[7]],[[3,1,3,[6,3],8],[],[[10,3,1,5],[9,5,6,4],1,[],5],2]]
[[5]]
[[[1,2,0],[[2,7,3,5],0,[9,7,0],10]],[6],[3,7]]
[[[[6,0,7],7,0],0,6,2,2],[5,6,5,7],[8,[]],[],[[[1],[0,5,10,6,9],[10],8,10],[[8,10,8,7],[],4]]]
[[4,[6,2,[9]],3],[0,8,10,[[2,9,1,1,8],7,5,5],[9,[],6]],[],[4]]
[[9,[[10,3,10,8]],4],[0],[],[7,[[5,0,9],9],[[7,5,3,9,0]]],[]]
[[[7],1,[9,0,4,[4,10,9],[4]],10],[6,4,[[]]],[[[3]],[[4,1,0,9,4],4],9,[[9,0,2,10]]],[[2,9,[0,3,10,7],8,8],[[10]],5,[[3,7,4]]]]
[[[10,[7,0],0,6,[3,3]],[[3,5,10,3]]],[[[1,6],[2,7,3,3,8],[8,0,7,3],8,[10,9,7,8]],2,[7,[1,9,0,9,1],2],[5,10,0,8,2]],[[[9,6,9,0,3]],9,3],[[[6,8,9,8],[0,2],[4,1,0,6,5],7]],[3,[[1],[7],1],[[3,7],10,[8,4,7,6],10],[9,[3,5,3,9],[6,3],3,[3,1]],[[5,3,10],[10,10,5,7],7,[0,1,5,1,3],8]]]
[[10,[8,[7,7,3],7,[5,3,8]],[1,2,10,[]],6]]
[[3,[3,[7,6,3,6,10],9,[6,9,1],[1,3,1]]],[3,[8,10,[1],[8]]],[[[1,4,4,8]],[]],[[2],[[4,8],[9]],[[5,3,5,4]],9,[2,10]]]
[[4,1]]
[[[10,[5,5,9,2,6],[],[3,2,0,4],10],[6,[8,7,7,4]],8,[]],[3,[0,[10,10,10,1]],[0,8,4],[[4,4,10,7,1],2,[],[2]],[5,2]],[[[10,6],7,[8,6,3],10,[5,8,0,6]]],[],[[]]]
[[[],7],[3,[5,[5,8,8,7,4],[2,6,2,10]],2,7,8],[5,[[],[1,8,1,2,5]],0,0],[]]
[[4,[3,7,0,9],8,0],[[[3,2,3],8,[10],[7]],9],[1,[[],[2,3,1],2]],[0]]
[[[[8,2,1],8,10,10]],[[5,4,[4,9,2,6]],3],[],[10,[[3,8,7,4],8,7,[3,10,1,2,7]],[4,5],1]]
[[4,[],4,[2]]]
[[[10,4]],[0,1,[]],[],[9,10,10,2]]
[[],[[[7,9],10,8]],[8,4,2,[[6,7]],5]]
[[],[[[0],2,7,[8,5,6],[6]]],[[3,[0,9],1,[9]],2,[[6,5,2,7,9],[],[3,8,3,0,2]]],[[3,[],[10,2,9,2],[9,3,1]],[1,7,[6,2],[9],6]],[[[10,4,0,9],[8,8,0],10,2],[8],6,[4],3]]
[[[[5,0],6]],[10,[]]]
[[[7,[4,6]],4,[5,7,[8,5,3,5],[2,9,5,5,5],7]]]
[[[[8,2],0,[0,8,10]],[],[8]],[[[1,10],10,1],[10,[5,1,4],6,6,0],6,[9]]]
[[[[4,9,7,1],[8,0,10]],[[8],0],9],[4,[7,[5,10,9],8],[[],[3,4],[9,4,9],[2,9,9]]],[],[],[[3,0,[7,8,5],9,2],[[],[],[0,5,2,1,1]]]]
[[0,[],9],[],[]]
[[5,[5,[5],[]],8,0],[3,[[]]],[6,[[7],[6],8,7,2],[[]],[],4]]
[[6,2,3],[0,[[6,1,9],[2,10,5],0],[1,0,8,[10,0,9],[]],[[0,1,5,2,2],[],1,1,6],[[4],[]]]]
[[[0,[5,9,0,1],5,[3,6,4,7],[3,0]],[],[7,[],4],1,[7,4,8]]]
[[[[2,0],0,[],6,1],[],[]],[1,5,[[],[3,0,3]],[6,3],[]],[[[9,9,0,3],5,[]],0,[[5,3],[6,9],[3,0,4,5,3]],[[7,6,2,6],[]]]]
[[5,[[3,5,10,7],3,[]],4,[]],[8,4,9,0],[[2,[10,2,8],[8,6,10],[9,8,0,3],[0,5,5]]],[[[6]],[6],3,4,[]]]
[[[],[],0,2],[0,[[9,1,4,8,5],2,7]]]
[[9,6,[4,[7],[9],10,5],[8,[4,5,1,0,3],[9,6,7]]],[8]]
[[2,[5,[6,1,3,6,8]],7],[[5,3,7,7,0],10,[8,6,6],[[1,2,3,8,5],[6,5],[9],[]],6],[[5,5,[],[0,4,5,5]]],[[5,2,2],5,[8,8,[8,9,5,1]],[],[6,7,3,8]],[8,3]]
[[9,2,[[],8,7]],[[[]],4],[[],[8,[6,1],[3],8],[[8,0,0]],3],[7,4,[[3,5,8,9,0],3],[],5]]
[[9,0,[],[2,[6,2,1,7],1],[10,2,[6,2,7],[9,2,0],[8]]],[3,9,6,[6,0]]]
[[0,[4,[],[]],[]],[[8],[],5,0,[]],[10,[7,9],[3,5,5],[3,[3,3],[6,7,3],[4,0,2],[6]]],[5,[],10,8]]
[[1],[],[[]],[7,[[],[0,1,3],[2],[],[4,0,7,7,9]]]]
[[[8,[2,4,7]],0,[0],[0,[],1,0,7],7],[0,8,4,4,[6]],[[],6,[[10,2,8,8],8,[7,2,4,9],1,5],[0,4,10,9]]]
[[[1,[7,6,1],8,[6],[5,9,8]],1,[[3,7,3,7,2]]],[],[8,[4,10,2],[8,[]],4,5],[[3,[5,10,1,6,10],2],10,0,[[10,2,2,5,5],9,[4,3,7,4],6]],[0,8]]
[[[0,[],[2,5,7,8,10],[4,0,7,7]],1,2,4,7],[[7,[6,0,0]],[2,[],9,[7,0,5,7,10]],[[0,7],[],[3,10]],[1,10,8,0,[1,8,5]]]]
[[],[8,[[1,10,3]],0,[],[[],8,5,4,7]],[[0],5,5],[[4],[5,8,[6,2,8],4,[1,4,2]],2,[[7,7,3]],[6]]]
[[8,[[6],1]],[0,8],[[7,2,[6,1],3],9,[6,[2,5],[5],[6],[6,1,0,1,10]],3,[[1,9,3,7],2,[]]]]
[[6,[]]]
[[6,6,[5]]]
[[9,[[],[4,8,1,2,10],[2,9,6,1],2],[[5,4]],3,[4,[1,1,10,5,10],4,[0,0],[7]]],[],[2,[1,[3,1,7,1],10,3]],[[[9,7,3,4]]]]
[[[]],[[8,[3,5,5,7,1],0],[10],0],[5,2,[[]],[2]],[]]
[[6,0,5,[[1],[6,8],3]]]
[[10,[3,[],10]],[0],[[4,[],2,7]],[[9]],[[[0,7,5],[]],[[9,4,4],[1,5,8],[4,10,7,6]],[[8,5,4],8,[9,3,1,4,2]]]]
[[1,[1,[5,2,7],0,[6,4,8,2,4],10],[],9,[1,3]],[[7,9,7,[7,5]]],[[[0,10,6,1]],[7,[8],6]]]
[[[0]],[[9,10],[9],[2,4,9,3],[[],[],1,7],10]]
[[[[0,7,4,7,7],[3,6],[5],[1]],[],[8,9,[2,5],[10,3,10],[10,4]]],[[[9,7,1,6,2],3,0,[7],1]],[[7,[4,3,6,6,9]]],[[],[],[[],[8,8,2],3]],[[9,[8,2,5,4],[8,9]],[]]]
[[[],[4,[7,5,10],9,6,10],4,3],[]]
[[6,4]]
[[[[],0,[8,8],3,[]],4,[4,[9],1],[[5,7,6,1],4,5,7,[]]],[1,5,1,[10],[]]]
[[[[3,8,9,2,7],[3,0],2],[2,[8,0,4],2,5],[[8,0,6,0,2],[0,4],4,[5,10]]],[2,[]],[[1,[5,9,9,1],[10,7,2,10],3]]]
[[],[],[8,[[6,1]],9,[1,3,2],8],[5,2,[[7,7,8],[9,5,0],[10,4,7],2,[0]],7,5]]
[[0,1,10],[4,3,[0,[5,4],4,5,2],[7,7,8],[[6,8,1,1,4],[6,3]]],[[[9,7,7,5,0]],6,[[5,0],[4,7,0],[5],9,8],[],[1,[8,8,9],[8]]],[[[7,8],6]],[]]
[[[[9,9,7],7,1,4,[9]],[],[4,8,6,[7,4,4,4],0]],[[2,[3,6,2],[0,8,0],[9,3],2]],[[[8,10,1],[9,7,8],[0,8,4,7,7],[0,7,7],5]]]
[[6,[[]],0,[[],[2,3],1],7],[],[0],[2,[5,0,[2,5,8,6,2],3],[10,[0,10,5],[9,7,3,7,10],[]],[9]]]
[[1],[[[],[5,4,4,8,8],6,3],6,[8,0],1]]
[[[1,9],1],[]]
[[[[0,6,6],[],0,3,[4,4]],[[10]]],[[[0]],8,0,0,9],[0,10,[7,[3,1,10],5,6,[1]],2,1],[[5,6],[[10,2,9,5]],6,[]]]
[[],[],[[]],[[[6],[2,0,7],0,10,5],1]]
[[[[8,0,3,6,10],[4,8],5,9,[7]],[[8],[3,10,2,10],[4,5,4,7],5,[]],0,7],[2],[3],[[5,6,3,4],[[2,0,3],[6,0,9,0],3,[2,5,4,1,6]],[4,[3,4,10,1],1,0],[7,[5,2]],3],[8,6]]
[[3,9],[5,[9,1,[7,1,1,8,7]],[6,[2],[4,8,4,2,10],[6,4,5,0],[]]],[[[1,2,3],[8,6,9]],7]]
[[[0,7,2,4,0]],[6,2,7,10,6]]
[[0,1],[2],[6]]
[[[[5]],4,2]]
[[[],7],[[[4,1],4,[2,0,3]],5],[[8],[1],2,[9,8,9,0,[2,3,9]],[9,[10,8,2,4,0],9,[6,0,2],6]],[[[5,5],[],1,5,[10,0,7,4,10]]],[8,7,3]]
[[[[1,1,1,9,2],[1,9,7,4,4],[],[0]],[2,[5,9,4,4],[7,5]],4,7],[1,7,5,[[],2,5]]]
[[2,[[7,6,4],[3,5,3,10,4],5,[8]],8,4,3],[1,5],[],[2,[[0],[4,5]],[8,[9,8]],[8,[]],0]]
[[5,[[3,8,7],[10,9,4,3],[1,9,9,4],4],6],[[3,1,0],[[2],6]],[[1],0,[[4,3,1,2,0]],7],[]]
[[9],[],[0,10,0],[1,5,[[8,6],[9,8,0,9],6,[0,10,1,9]],[[3],[2]],0]]
[[9]]
[[6,[[],2,3,10],7,8],[],[[3,9,0],5,[[4,0]],2],[[],2,3,[[2,6,0,5],10,6,[1,0,0,0],2],1]]
[[],[3,4,[[],[],[],[]]],[3,[8],[],8,[8,[0,10,0],2,3]],[[2,[8,7,3,5],[0,10,6]],5,[[7,10,6],[3,7,9,7],5,[8,4,2],9],5],[[0,[8,0],5,[4,6,4,6]]]]
[[5],[4,1,[[],7,[6,0,6,9]]],[[[6,3,3,9,8]],[],0,[[3,3],[8,7,8]]]]
[[[[10,4],[0,7,7,9],[10,6,0],[2,7,1,5,3],4],[4,[4],[1,8,0,2],[5,8,4],7],[9,10,6],3,5],[[[1,10,3,10,9]],4,[3],[7,0,3]],[7,[],[[2,5,1,3]],[7,[2,2,4]],[[4,6,4,10],2,[6,7,8,6],[3,7,3,2,0],1]],[3,2,[[2,3,10,2,0],9,1,[]]]]
[[9],[2,3,[[],9]],[[2,10],[]],[9,[2,[4]],7,[6,7,[10],[10,8,2],0]]]
[[1],[[6],4,0,[7,4,6],5]]
[[[[6,6,9],[1,2,2],[5],6,[8,8,8]],3],[[[],2,0],[],[],3,[[5,0,0],[2,0,1,5],0,[9]]],[[[],9,7],3,9]]
[[5,9,[],9,4],[[[9,8],0,2],8,5,[7,7,10,2]]]
[[[5]],[7,4,6,7],[],[[2,[3,5],[7,8],0],[]],[]]
[[[[5,9,9,8]],[8,[8,1],8],6],[[8,[4],8,8,[8,5,6]],[8,[],2]],[0,4,6],[],[7,[2],[4,5,[10,8],[1,6,3]],4,[10,[7],3,7,3]]]
[[0,[2],[],[5,[2,7,4,4,0],7,4]]]
[[10],[[[1,3,6,10],2,1],0,[],[3,[8,5],[3],8]],[0,[2,[],4,[1,10],[6,1,6,6,8]],[3,[0,8,7,3],10,9,5],6],[7]]
[[9,[]]]
[[],[[9,[],1],[9,[0,2,0,7,8],8,10,[0,6,3,5,0]],[10]],[7,1,[[6,2,3,0],0,5,4],10,[[1],6,[9,4,7,3],[6]]],[0,10,[6,[8]],5,[2,2]],[9,1,2]]
[[2,6,5,[2,7,[7,6,8,4,0]],[[3,0],3,[6,7],[10],4]]]
[[[],7,10,[[],7],3],[8],[[[],[7,8,0,0],[2,9,5,3,2],0],6,3]]
[[[[1,1,9,2,1],[],7,[5,8]],[4,[8,4,1],9],[[4,4,6],[5,8,2],[5],[5,7,0]],7,[0,3,[10],[],[4,2,0]]],[],[],[1]]
[[],[0],[[[8,0,7],5],0,[10,6,9,10,5],10,[]]]
[[[0,[6,1,6,10],[10,3,7,3],[1,4,9,3,8],[5,9]],0,[10],8,10],[],[7,3,[5],1]]
[[2,6],[8,0,[[10,8,7],[],[],[7]]],[[8,4],[],9,[7],2],[0,6],[[5,9],[2],[6,10,[3,2,2,6,0]],7,[[2,6,0,8,5],[],[9,4,10],2]]]
[[[2,[],0],[[1,10,7,0,5],[7,9,7,2,5]]],[[[0,5,7,2,5],4,[],2,4],9,2,[]]]
[[[[],8,6],[[5,7,0,8],1,10,9,[4,4,7,7]],6,[[10]],[]],[[10,3,[5,7,9,2,7]],[[10,0],5],[7,10,9],4],[],[[0,0],6],[]]
[[],[[[0],1,5],5],[[[6,2,4],0,[],6,5],[[7,1,8,1],[9,9,10,5,5],10,1,1],[3,10,10,10],2],[],[1]]
[[[],[[5,4,1,5],0,[],6],[6]],[4,0],[]]
[[[[],2,5,2,3]],[[[6,5]],[]],[[5,0]],[[],6,[[4],10,[0,7,9]]],[]]
[[[3,7,[8,4,7,6,3],[5,1,7,6],[2]],8,3,[[0],1,[10,2,6,3,8],[9]],[5,6,1,[],[9,6,7]]],[[10,7,6,[7],[1,3,4,2,4]],[7,[5,2,5,9,0],[0,1],[5,10,6]]],[[[6,2,0],6,3,9,[3,3]],[7,8]],[0,1,[[5,9,6]],[[9,8,10,0],[6,3,7,8],8,5]]]
[[],[[9,2,[0],[7,4,9,2],7],[[],[1,4,5,4],[2,10,8],0,5],1,3,[[7],9,9,[5,7]]],[[],4,[6,3,[3,0,1,6],5],[[],3]],[],[6,[1,[3,10,9,10,10],8,5,[4,3]],[10,4],[9]]]
[[[[7,2,3]]],[6]]
[[[2,[3],[]],4,4,8]]
[[0,[10,6,[6],4,4]],[6],[[6,[8,4,6,7],7,7,0],9,[],10],[[[5,5,10]],9,[[10,6,5,6]]]]
[[6,2,1,10]]
[3,6,5,10]
[3,6,5,10,10]
[[4],[1,[10,[2,9,9,1,6],[],7,[9,3,8,9,0]],[10,[9,7,2,2,3],[0,2,3],5]],[[10,[10],[9,2]],6,7,[4,[1],[]],[[],10,[9,7,5,4],[1,4,3,3,4]]],[]]
[[10,[9,[],0],4,[[],10],[0,0,6]],[],[5,[],8,[7,7,[4,7,0,9,6],5,1]],[],[[7,9],[[],5,5,[]]]]
[[[],0,5,[3,[5,1,1]],5],[[4,[6,5,2],[0,9,7,0],1,1],[],[1,10],4,10],[9,[1,9,9],[10],[[5],[5,9,0],[2,9,5],[7,2,3],1]]]
[[4,10],[5],[[[2,0,7],5,[0],[],[4,10,3]],1,[[9,4,4],6,[8],[7],0],[],[1,1,[8,4,5,7],[3]]],[7,7,[[],[1,1]],2,7],[9,[[2,6,9],[6,5,6,2,4],[4,8,10],[3,0,2,9,10],8],6,3,[[7,2,7],[3],[4,3,10,1,3],[5,2,10,4,5]]]]
[[[7,[4,7],[8,8,2],[6,3,9]],[[1],0,[10,3,10,7],[9,2,9,4],1]]]
[[],[[1]]]
[[[[4,1,10,4],2],[],[6,[]],5],[[[5,3,4,8],10,[]],[10,4,[0,7,9]],[],7],[[],4],[3,4,[],7]]
[[[0,[2,5,1,5],6,[]]]]
[[[3]],[],[7,[[],[1,7,7,8]],[],[1,8]]]
[[[0,[5,5,9,5],1,5]],[],[[[7,4,1,2,3],3,[],3],2,[[6,0,4],[0]],[[4,4,2,6,6]],[[9,0]]]]
[[4,4,8],[0]]
[[6,5]]
[[5,9,[[5,5,3,3],[],[8,5,0,4,1],1,2]],[5,1,[3,4]],[8],[[[9],8,8,[8,0,2,3,8]],[8,[9],4,[7,1,0]],8,[]]]
[[],[0],[],[4,4,[4,6,[10,1,1,0]],5,[3,6,[2,1,2,1],[5,8,7,10]]]]
[[7],[[10,[4,3,6],[6,9,10]],8,2,10]]
[[3,2],[[7,[10,2,5,1],[2,7,0,0],[],[0,10,1,3]],9,7]]
[[[[7,7],[0,9,4,2],[7,0,2,9,6],2],2]]
[[[[5,5,9]],[[7,4,4],[9,6]],6],[6,[8,1,6],3,7,4],[5,[6]],[],[[0,5],[8,1,3,4,9],[[],[3,4,9,10],6],[10]]]
[[6,[1,[6],6]]]
[[6,[0,5],[[5,6,4,7],7]]]
[[],[[5,8],3,0],[[9],9,[5],[[],[3,2,4,4],1,[3,6,8,7,1]]],[[[],0,1],[3,5,[4,10,4]],[],[[2,2,5],[5,10],[6,6,10,0,7],[10,10,5,3,10]],[[1],9,5,[3,3,8,1,5],[5,4,5]]]]
[[[[10,4,3,7,7],[3,6,6],[],[3]]],[5],[8,10,[7,3,5],7]]
[[9,7],[7],[]]
[[5,[[8,8,8,3,9],5],5]]
[[1],[[3,[5,7],[3,4],[6,4]]],[[],[[6,7,5,8]]]]
[[[[6,8],[],[]],0,[4,[]],1],[]]
[[],[[5,[2,9,0],3],1,[[]],[4,10,[]]],[[0,3,[4,1],[5,9,0],2],1,[]],[0],[[[4],5,6,4,3],3]]
[[7,[4,[9,6,1,3]],[[9]]],[[6,[2,1,10,2],[9],8],[8,6],[[5,2,8,10,9],[8,8,3,0,5],[5,10,8,3]],[],8]]
[[],[3,[],5]]
[[2,[],[[3,10,6,10],4]],[],[0,[10,8,[4,8]],[8,3,[9,8,3],[3,6],[10,9,9,6]]],[[[4],2,2,4],9],[[],[[],5,[],6]]]
[]
[[],[[4],4],[[8],6],[0,1,3]]
[[[3,10,3,[9,3,9,9,4],8],[3,[]],[[7,8,6,0]],[[],[10,1]]]]
[[0,3,10,2],[[[1],10],[3,0,4],9,[[4,8,6,7],[0,8,5],[],[9,5,3,1,4]]],[0,5,8,2],[2,[]],[]]
[[[1,[]]]]
[[[],5,2],[],[[[8],[3,4,1,7],[0,7,10],7,[]],1,1]]
[[[[4],[0,9,7,6,0]],[[1,7,7,1,10],[],5]],[[0,[7,9,0,9,9],[3,10,6]],10,[[1,6],[10],[10],[6,2,2,2,4]]],[[]]]
[[[4,[],0,[2,7,8,2,3]],8,[9,0,[1,9,1,2]]],[],[8,[3,2,0,[1,1,7,0]],[8,9,3,[10,5,1,5,4],[9,3]],[6,8,4,[3,3,4],[5,2,3]],1],[[3],5,[],[6,[2,4,9],[2,3],2,[]]]]
[[0,7,[10,3],10]]
[[],[]]
[[[6,[6,6,5,6],[3],[9]]],[4],[3,[]],[[6,8,[3,0,6,7]],[5,[7,4,5,6],3,[0,7,2,8,3]]],[[10,7,10,2,3],[2,1,[7,2,10,1,3]]]]
[[9],[[],3,0],[8,[10,[9],10]]]
[[10,[[5,9],10,[10],[10,7],4]],[0],[0,[9,[5],[5,6]]],[3]]
[[4],[[[7,4]],0,6,2],[9,[4,2,5,[4,10,3,10]],[4,10,[4,0,5,1,4],1,1],10],[]]
[[[4,[9],8],[7,5],[],[[8],[],[6,9,10,4]],2],[],[],[],[[[3,10,0,3,0],[8],5,8],10]]
[[[[1,2,1],10,[2,9]]],[4,[[6,0,4,3],[10,2],[],2,1],[[3,3,10,0,9],[3,7,2,5],[5,9]],10]]
[[[[8],[3,2,9,8,6]],[10,[3],5]]]
[[],[[[8,3,10]]],[[4,[1,5,3,6,2],[3,6,5,8,7],7],0,[6,[10,4,9,8,9]],[]]]
[[9,[6],0,[9,[8,4,5,7]],[9]],[7,[[9,9,10],[9,4,0]]],[[4,[6,1,5,6]],[[6,7,0],[]],0,[[3,1,10,9,10],[0,6,6,10],6,[6,1,3,9,9],[9,0,10]]]]
[[0,[10],8],[]]
[[0],[7,[[7,7,9],6],2,[],3]]
[[[7,6,5,[9],[8,1,0,3]]],[4,[],[6,4,[7,6]],6],[],[[],0,9,8,[[8,5],6,1,[1,2]]],[[],4]]
[[4,[8,[5,1,7,6,2],6,[7]]],[[8,8,4],[9,5,8]]]
[[5,[[10],2,[8,7,7,0],[9,0,7,5],3],6],[],[4,3,[]]]
[[2,3,7,1],[9,4,[],[[8,2,9,0,3],[]],[[6]]],[]]
[[2,[[5,2,10,8],4]]]
[[[[3,7,0,8,3],4,10,[4],4]],[[[2,4],6,6,3],[[5,2,8],[6,3,6,6],9,10],4,[1,9,[],[1,2,4,8],2],9],[6,[[6],[2,9,8,7],1,[10,10,5,0]],[10,7,[8,0,2,6],10,3],1,3]]
[[8,[7,[4,10,6,5],1,[]]],[[[0,0,2,9]],[10,2,0,[10,9,7,9,1],4],[5]],[[3,[10,5,1],1]]]
[[]]
[[],[5],[0,9],[8,[[5],10,2],7,[[9,6,5],[9,6,4,1]]],[[[],[8,10,0,2],[0,9,3,7,2],3,[2,7,1,6]],2,[],[],3]]
[[[3,4,[7,2,4]],7,[1,6,[7]],6],[1,[[1],8,8],[1,1]],[[[5,3],[]],[1],[[4,2,1],3,0],6,0],[[[],[2,0,8,0]],5,[]]]
[[],[[4,9],[8,3,[]]],[7,1,8,0]]
[[[[],9]],[],[7,2,10,1,[[6],6,[],3,[]]],[]]
[[[[1,10]],6,[],5],[4],[1,[[1],2,[5,4,4,4,4],2],[4,4,[2,2,8],8]],[1,[],6,2,1],[[[2],[10,8,6],[6,3]],3,1,[9,3,10,9,3]]]
[[5,6,8,3],[9]]
[[[],4],[[[],2,10],[5,[9,9,3],0,[]],4,3,[0,9]]]
[[10,3,0,[[7],8,3,7,5]],[[[6,9],[3,5],2],2,[[7,7,10],[5]],0],[[8,6,4,10,[7,10,5]]],[[4,[],[10,2,7,10,3],[10,3,7]],3,7,7],[[[2,0,2,0],[5,8,10,6,4],[3,10,10,0],[4,2,6,1]],10,3,[6]]]
[[[[1],[],5,[]]],[4,8,3]]
[[10,[8,5]],[1,[0,4,[0]],1,3,[[0]]],[1,4,[[3,4,0,1,3],9],[10]],[],[10,[],[1,8,1,[5,2,10],1],[8,3,[1,4,7,1],1,[8]],[0,3,[8,5,0,3,0],[]]]]
[[10,0,[7,[5,2,5,7],2,3,8]],[9,[[4,9,10,3],10,[],[1,1,5,2,2],[1,2]],3,[[9,1,9]],[[8,8],8]],[[5,8,[0,1,1],[7,7]],1,[3,[2,1],[10]],[]],[[10],3,[3,1,5],[4,[7],[2],2,[7,10,10]]]]
[[],[5,10,[[1,2,6,0],[2,9]],[2,[9,10,6],[2,7,4]]]]
[[7,[[2,9,4,10,5],6],[[4],9,[0,4,3,5],0,0],4]]
[[[],[4,[1,6,7,7,3],[7,5,2,4],[5,10,1,2,7],[]]]]
[[[8],[3],8,4]]
[[2,8,0],[[]],[],[[]],[1,[2]]]
[[[4,0,[9,3,2,5,3],[1,4],[2,0]],0,0,[[7,9],[3,9,1,5,9]]],[[[6,0,9],[10,5,0,5],0,[1],[5]],8,10],[],[6,[10,1,[9,9,6,4],[8,8,7,6,0]],[[6,1,9,0]]]]
[[2,5,[[],2],[]],[6,[],1,1],[[7,8,3,8,5]],[[2,3],1,8,7],[]]
[[[[],[],6,6]],[[7,1]]]
[[9,6,[9],4],[],[],[[[],3,6],[10],[1,[9,9,1,6,6],[],9,6]]]
[[7,5]]
[[[2,[0,0],8,7,[7,6]],5,[[9,7,7,0,3]]],[[0,7,4]],[7],[]]
[[[4,2,4,9]]]
[[5,2,[[10,8,8,1],1,8,4],0,[[9,8,4,4],[4,1],4]],[],[1]]
[[4,7,[[7],0,8,0,1],[6],0],[4,4,9,[[1,3,0,5],[],[3,5,0,3,3]],[6,[9,2,7,9]]],[9],[8,6,7],[[10,[3,2,9]]]]
[[[[8,7,7,9,4]]]]
[[2,[3,[9,8,5,6,2],[3,3,6,2]],8],[],[3,8],[[[0,0,2],6,3,7],9,[[3,8,8,0],[6,8],[5,9,6],0,7]]]
[[10],[[[8],2,[8]],[],7],[[2,2,[4,6]],5,6],[[],[[],3],[[9],3]],[3]]
[[[[3,6,7,0],[9,8,8,3,0],5],[10],6]]
[[[4,[6,3,10,5],5,9,4]]]
[[[[7,0,8,3],10],[[1,4]]],[4,4,[[5,2,6],[3,1,6],[10],[]],[7,3,[],[5],[7,1]],[7,[],1,9,[7]]],[7,[]]]
[[0,[6,[3,3,6,7,5],[6,5]]],[[9],[]],[[4,[7,10,7],[7,5],8,[0,2,2,3,6]],0,1,5,2],[[8,8,[9,8,4],8,6],0,[[9,6,7,7,5],7]],[]]
[[4,5,4,[[3,2]],[7,5,[9],0]],[[],[],3],[[3,9,[7,3,8,6],[7,10,10]],0,[[0,5],[2],[]]],[]]
[[],[[[4],9,7],9,[[6,9,10],[8]]],[[1,[1,10,6,4],[4,9,6],[5,8,6,5,6],5],[0,[2],9],5,4,[7,2,10]],[9,4,2]]
[[2,[[1,0,0],4,2,[10,0,9,5,3]],[8,1,2,[6,4],1]]]
[[2,2],[[4,[1,7,7],[4,2]],[4,9,[10,5,10,1],[3]],[5,[],9,[7],3]],[[],[9]]]
[[[[7]],[2],[2,[3,2],[0],9],10,5],[4,3,2,[[7]],3],[[[7,2,4],0,0,[3,8]],[]],[[],0,[],[[],[5,0,0],[0,4,6],3,2]]]
[[],[[2,[0,1,1],10],[2,6,4,[0]]],[6,9,[[0,0,10,7,5],[],[10],[8,7,10,10]],7],[[2]]]
[[10,[[4,6,0,5]],9,[[3,1,0,9],5,[6,7],7],[[8,9,2,7],[4,6]]],[[8],1]]
[[[],[[10,3],5,[6,10,2,8]]]]
[[0,9,6]]
[[9,6,0],[[],5,10,10],[],[3,1,[[4,9,7,6,10],10],[[9,6,4,5,2]],6],[10,8,5]]
[[2,8],[[],[]]]
[[6],[0,[4,[9,9,0,0,7],[9,10],[7]],6,1],[[6],9,[0,8,[3,5]]],[4],[[[0,9,2,4,1],3,5],3,[3],[7],[[6,0,1],[2],[7,1,7,5,5]]]]
[[9,7],[7,5,[[],[2,0,9,0,0],9,[8,1,3,10]],2]]
[[],[[5],[1,[1,2,6,10,1]],[]],[[],1,8,[[8,7],[7],[4,4,7],[4,9,8]],[[2,6,4],4]]]
[[6,[10],1],[[9,8,[]],[1,[7,7,1,1,2]],5,[[5,8,9],[10,6,10,6],0,3,9],[7,2,[1,5]]],[4],[3,[2,[8,6,7,2],7]]]
[[9],[8,[[3,0,1,5,5],9],0,6],[1,[],1],[8,3,6,[[8,9],[10,9,6,8,4],[]]],[[],[3,5,1],2,6]]
[[4,[]],[5],[[],[]]]
[[5],[[[],[2,2]],4],[5,[[],[9,3,0,1,4],[0,2,1]],[[3],[8,4,10],[]]],[]]
[[10,[6,10,3,7],[0],3,4]]
[[1,[[5]],[4,1,[]],10,[4,[2,6,5,4,2]]]]
[[[],5,[],5],[8,3,4,6,7],[1,[]]]

146
2022/inputs/day14.txt Normal file
View File

@ -0,0 +1,146 @@
477,140 -> 481,140
468,149 -> 472,149
482,30 -> 482,23 -> 482,30 -> 484,30 -> 484,20 -> 484,30 -> 486,30 -> 486,26 -> 486,30 -> 488,30 -> 488,23 -> 488,30 -> 490,30 -> 490,20 -> 490,30 -> 492,30 -> 492,25 -> 492,30 -> 494,30 -> 494,29 -> 494,30 -> 496,30 -> 496,24 -> 496,30
465,152 -> 469,152
482,30 -> 482,23 -> 482,30 -> 484,30 -> 484,20 -> 484,30 -> 486,30 -> 486,26 -> 486,30 -> 488,30 -> 488,23 -> 488,30 -> 490,30 -> 490,20 -> 490,30 -> 492,30 -> 492,25 -> 492,30 -> 494,30 -> 494,29 -> 494,30 -> 496,30 -> 496,24 -> 496,30
501,140 -> 505,140
490,43 -> 490,42 -> 490,43 -> 492,43 -> 492,35 -> 492,43 -> 494,43 -> 494,38 -> 494,43 -> 496,43 -> 496,36 -> 496,43 -> 498,43 -> 498,39 -> 498,43 -> 500,43 -> 500,35 -> 500,43 -> 502,43 -> 502,36 -> 502,43
498,17 -> 503,17
504,68 -> 504,59 -> 504,68 -> 506,68 -> 506,60 -> 506,68 -> 508,68 -> 508,63 -> 508,68 -> 510,68 -> 510,67 -> 510,68
492,131 -> 496,131
490,43 -> 490,42 -> 490,43 -> 492,43 -> 492,35 -> 492,43 -> 494,43 -> 494,38 -> 494,43 -> 496,43 -> 496,36 -> 496,43 -> 498,43 -> 498,39 -> 498,43 -> 500,43 -> 500,35 -> 500,43 -> 502,43 -> 502,36 -> 502,43
482,30 -> 482,23 -> 482,30 -> 484,30 -> 484,20 -> 484,30 -> 486,30 -> 486,26 -> 486,30 -> 488,30 -> 488,23 -> 488,30 -> 490,30 -> 490,20 -> 490,30 -> 492,30 -> 492,25 -> 492,30 -> 494,30 -> 494,29 -> 494,30 -> 496,30 -> 496,24 -> 496,30
501,116 -> 505,116
495,122 -> 499,122
486,131 -> 490,131
462,155 -> 462,157 -> 457,157 -> 457,162 -> 471,162 -> 471,157 -> 465,157 -> 465,155
514,84 -> 514,79 -> 514,84 -> 516,84 -> 516,78 -> 516,84 -> 518,84 -> 518,77 -> 518,84 -> 520,84 -> 520,82 -> 520,84 -> 522,84 -> 522,79 -> 522,84
504,104 -> 504,105 -> 521,105 -> 521,104
503,70 -> 503,71 -> 518,71
501,15 -> 506,15
514,84 -> 514,79 -> 514,84 -> 516,84 -> 516,78 -> 516,84 -> 518,84 -> 518,77 -> 518,84 -> 520,84 -> 520,82 -> 520,84 -> 522,84 -> 522,79 -> 522,84
504,119 -> 508,119
529,93 -> 529,95 -> 526,95 -> 526,100 -> 541,100 -> 541,95 -> 533,95 -> 533,93
482,30 -> 482,23 -> 482,30 -> 484,30 -> 484,20 -> 484,30 -> 486,30 -> 486,26 -> 486,30 -> 488,30 -> 488,23 -> 488,30 -> 490,30 -> 490,20 -> 490,30 -> 492,30 -> 492,25 -> 492,30 -> 494,30 -> 494,29 -> 494,30 -> 496,30 -> 496,24 -> 496,30
514,84 -> 514,79 -> 514,84 -> 516,84 -> 516,78 -> 516,84 -> 518,84 -> 518,77 -> 518,84 -> 520,84 -> 520,82 -> 520,84 -> 522,84 -> 522,79 -> 522,84
462,155 -> 462,157 -> 457,157 -> 457,162 -> 471,162 -> 471,157 -> 465,157 -> 465,155
471,146 -> 475,146
502,46 -> 502,48 -> 494,48 -> 494,55 -> 507,55 -> 507,48 -> 506,48 -> 506,46
514,84 -> 514,79 -> 514,84 -> 516,84 -> 516,78 -> 516,84 -> 518,84 -> 518,77 -> 518,84 -> 520,84 -> 520,82 -> 520,84 -> 522,84 -> 522,79 -> 522,84
502,46 -> 502,48 -> 494,48 -> 494,55 -> 507,55 -> 507,48 -> 506,48 -> 506,46
495,134 -> 499,134
482,30 -> 482,23 -> 482,30 -> 484,30 -> 484,20 -> 484,30 -> 486,30 -> 486,26 -> 486,30 -> 488,30 -> 488,23 -> 488,30 -> 490,30 -> 490,20 -> 490,30 -> 492,30 -> 492,25 -> 492,30 -> 494,30 -> 494,29 -> 494,30 -> 496,30 -> 496,24 -> 496,30
490,43 -> 490,42 -> 490,43 -> 492,43 -> 492,35 -> 492,43 -> 494,43 -> 494,38 -> 494,43 -> 496,43 -> 496,36 -> 496,43 -> 498,43 -> 498,39 -> 498,43 -> 500,43 -> 500,35 -> 500,43 -> 502,43 -> 502,36 -> 502,43
482,30 -> 482,23 -> 482,30 -> 484,30 -> 484,20 -> 484,30 -> 486,30 -> 486,26 -> 486,30 -> 488,30 -> 488,23 -> 488,30 -> 490,30 -> 490,20 -> 490,30 -> 492,30 -> 492,25 -> 492,30 -> 494,30 -> 494,29 -> 494,30 -> 496,30 -> 496,24 -> 496,30
498,125 -> 502,125
490,43 -> 490,42 -> 490,43 -> 492,43 -> 492,35 -> 492,43 -> 494,43 -> 494,38 -> 494,43 -> 496,43 -> 496,36 -> 496,43 -> 498,43 -> 498,39 -> 498,43 -> 500,43 -> 500,35 -> 500,43 -> 502,43 -> 502,36 -> 502,43
501,122 -> 505,122
495,140 -> 499,140
520,108 -> 520,110 -> 516,110 -> 516,113 -> 529,113 -> 529,110 -> 525,110 -> 525,108
490,43 -> 490,42 -> 490,43 -> 492,43 -> 492,35 -> 492,43 -> 494,43 -> 494,38 -> 494,43 -> 496,43 -> 496,36 -> 496,43 -> 498,43 -> 498,39 -> 498,43 -> 500,43 -> 500,35 -> 500,43 -> 502,43 -> 502,36 -> 502,43
502,46 -> 502,48 -> 494,48 -> 494,55 -> 507,55 -> 507,48 -> 506,48 -> 506,46
498,119 -> 502,119
482,30 -> 482,23 -> 482,30 -> 484,30 -> 484,20 -> 484,30 -> 486,30 -> 486,26 -> 486,30 -> 488,30 -> 488,23 -> 488,30 -> 490,30 -> 490,20 -> 490,30 -> 492,30 -> 492,25 -> 492,30 -> 494,30 -> 494,29 -> 494,30 -> 496,30 -> 496,24 -> 496,30
482,30 -> 482,23 -> 482,30 -> 484,30 -> 484,20 -> 484,30 -> 486,30 -> 486,26 -> 486,30 -> 488,30 -> 488,23 -> 488,30 -> 490,30 -> 490,20 -> 490,30 -> 492,30 -> 492,25 -> 492,30 -> 494,30 -> 494,29 -> 494,30 -> 496,30 -> 496,24 -> 496,30
490,43 -> 490,42 -> 490,43 -> 492,43 -> 492,35 -> 492,43 -> 494,43 -> 494,38 -> 494,43 -> 496,43 -> 496,36 -> 496,43 -> 498,43 -> 498,39 -> 498,43 -> 500,43 -> 500,35 -> 500,43 -> 502,43 -> 502,36 -> 502,43
482,30 -> 482,23 -> 482,30 -> 484,30 -> 484,20 -> 484,30 -> 486,30 -> 486,26 -> 486,30 -> 488,30 -> 488,23 -> 488,30 -> 490,30 -> 490,20 -> 490,30 -> 492,30 -> 492,25 -> 492,30 -> 494,30 -> 494,29 -> 494,30 -> 496,30 -> 496,24 -> 496,30
490,43 -> 490,42 -> 490,43 -> 492,43 -> 492,35 -> 492,43 -> 494,43 -> 494,38 -> 494,43 -> 496,43 -> 496,36 -> 496,43 -> 498,43 -> 498,39 -> 498,43 -> 500,43 -> 500,35 -> 500,43 -> 502,43 -> 502,36 -> 502,43
514,84 -> 514,79 -> 514,84 -> 516,84 -> 516,78 -> 516,84 -> 518,84 -> 518,77 -> 518,84 -> 520,84 -> 520,82 -> 520,84 -> 522,84 -> 522,79 -> 522,84
482,30 -> 482,23 -> 482,30 -> 484,30 -> 484,20 -> 484,30 -> 486,30 -> 486,26 -> 486,30 -> 488,30 -> 488,23 -> 488,30 -> 490,30 -> 490,20 -> 490,30 -> 492,30 -> 492,25 -> 492,30 -> 494,30 -> 494,29 -> 494,30 -> 496,30 -> 496,24 -> 496,30
498,137 -> 502,137
474,149 -> 478,149
514,84 -> 514,79 -> 514,84 -> 516,84 -> 516,78 -> 516,84 -> 518,84 -> 518,77 -> 518,84 -> 520,84 -> 520,82 -> 520,84 -> 522,84 -> 522,79 -> 522,84
517,90 -> 531,90
504,68 -> 504,59 -> 504,68 -> 506,68 -> 506,60 -> 506,68 -> 508,68 -> 508,63 -> 508,68 -> 510,68 -> 510,67 -> 510,68
504,68 -> 504,59 -> 504,68 -> 506,68 -> 506,60 -> 506,68 -> 508,68 -> 508,63 -> 508,68 -> 510,68 -> 510,67 -> 510,68
504,68 -> 504,59 -> 504,68 -> 506,68 -> 506,60 -> 506,68 -> 508,68 -> 508,63 -> 508,68 -> 510,68 -> 510,67 -> 510,68
514,84 -> 514,79 -> 514,84 -> 516,84 -> 516,78 -> 516,84 -> 518,84 -> 518,77 -> 518,84 -> 520,84 -> 520,82 -> 520,84 -> 522,84 -> 522,79 -> 522,84
483,152 -> 487,152
490,43 -> 490,42 -> 490,43 -> 492,43 -> 492,35 -> 492,43 -> 494,43 -> 494,38 -> 494,43 -> 496,43 -> 496,36 -> 496,43 -> 498,43 -> 498,39 -> 498,43 -> 500,43 -> 500,35 -> 500,43 -> 502,43 -> 502,36 -> 502,43
483,134 -> 487,134
490,43 -> 490,42 -> 490,43 -> 492,43 -> 492,35 -> 492,43 -> 494,43 -> 494,38 -> 494,43 -> 496,43 -> 496,36 -> 496,43 -> 498,43 -> 498,39 -> 498,43 -> 500,43 -> 500,35 -> 500,43 -> 502,43 -> 502,36 -> 502,43
489,134 -> 493,134
482,30 -> 482,23 -> 482,30 -> 484,30 -> 484,20 -> 484,30 -> 486,30 -> 486,26 -> 486,30 -> 488,30 -> 488,23 -> 488,30 -> 490,30 -> 490,20 -> 490,30 -> 492,30 -> 492,25 -> 492,30 -> 494,30 -> 494,29 -> 494,30 -> 496,30 -> 496,24 -> 496,30
477,146 -> 481,146
462,155 -> 462,157 -> 457,157 -> 457,162 -> 471,162 -> 471,157 -> 465,157 -> 465,155
514,84 -> 514,79 -> 514,84 -> 516,84 -> 516,78 -> 516,84 -> 518,84 -> 518,77 -> 518,84 -> 520,84 -> 520,82 -> 520,84 -> 522,84 -> 522,79 -> 522,84
462,167 -> 462,168 -> 474,168 -> 474,167
490,43 -> 490,42 -> 490,43 -> 492,43 -> 492,35 -> 492,43 -> 494,43 -> 494,38 -> 494,43 -> 496,43 -> 496,36 -> 496,43 -> 498,43 -> 498,39 -> 498,43 -> 500,43 -> 500,35 -> 500,43 -> 502,43 -> 502,36 -> 502,43
520,108 -> 520,110 -> 516,110 -> 516,113 -> 529,113 -> 529,110 -> 525,110 -> 525,108
490,43 -> 490,42 -> 490,43 -> 492,43 -> 492,35 -> 492,43 -> 494,43 -> 494,38 -> 494,43 -> 496,43 -> 496,36 -> 496,43 -> 498,43 -> 498,39 -> 498,43 -> 500,43 -> 500,35 -> 500,43 -> 502,43 -> 502,36 -> 502,43
504,68 -> 504,59 -> 504,68 -> 506,68 -> 506,60 -> 506,68 -> 508,68 -> 508,63 -> 508,68 -> 510,68 -> 510,67 -> 510,68
504,68 -> 504,59 -> 504,68 -> 506,68 -> 506,60 -> 506,68 -> 508,68 -> 508,63 -> 508,68 -> 510,68 -> 510,67 -> 510,68
520,108 -> 520,110 -> 516,110 -> 516,113 -> 529,113 -> 529,110 -> 525,110 -> 525,108
514,84 -> 514,79 -> 514,84 -> 516,84 -> 516,78 -> 516,84 -> 518,84 -> 518,77 -> 518,84 -> 520,84 -> 520,82 -> 520,84 -> 522,84 -> 522,79 -> 522,84
482,30 -> 482,23 -> 482,30 -> 484,30 -> 484,20 -> 484,30 -> 486,30 -> 486,26 -> 486,30 -> 488,30 -> 488,23 -> 488,30 -> 490,30 -> 490,20 -> 490,30 -> 492,30 -> 492,25 -> 492,30 -> 494,30 -> 494,29 -> 494,30 -> 496,30 -> 496,24 -> 496,30
482,30 -> 482,23 -> 482,30 -> 484,30 -> 484,20 -> 484,30 -> 486,30 -> 486,26 -> 486,30 -> 488,30 -> 488,23 -> 488,30 -> 490,30 -> 490,20 -> 490,30 -> 492,30 -> 492,25 -> 492,30 -> 494,30 -> 494,29 -> 494,30 -> 496,30 -> 496,24 -> 496,30
482,30 -> 482,23 -> 482,30 -> 484,30 -> 484,20 -> 484,30 -> 486,30 -> 486,26 -> 486,30 -> 488,30 -> 488,23 -> 488,30 -> 490,30 -> 490,20 -> 490,30 -> 492,30 -> 492,25 -> 492,30 -> 494,30 -> 494,29 -> 494,30 -> 496,30 -> 496,24 -> 496,30
529,93 -> 529,95 -> 526,95 -> 526,100 -> 541,100 -> 541,95 -> 533,95 -> 533,93
474,143 -> 478,143
497,13 -> 502,13
529,93 -> 529,95 -> 526,95 -> 526,100 -> 541,100 -> 541,95 -> 533,95 -> 533,93
482,30 -> 482,23 -> 482,30 -> 484,30 -> 484,20 -> 484,30 -> 486,30 -> 486,26 -> 486,30 -> 488,30 -> 488,23 -> 488,30 -> 490,30 -> 490,20 -> 490,30 -> 492,30 -> 492,25 -> 492,30 -> 494,30 -> 494,29 -> 494,30 -> 496,30 -> 496,24 -> 496,30
482,30 -> 482,23 -> 482,30 -> 484,30 -> 484,20 -> 484,30 -> 486,30 -> 486,26 -> 486,30 -> 488,30 -> 488,23 -> 488,30 -> 490,30 -> 490,20 -> 490,30 -> 492,30 -> 492,25 -> 492,30 -> 494,30 -> 494,29 -> 494,30 -> 496,30 -> 496,24 -> 496,30
505,17 -> 510,17
529,93 -> 529,95 -> 526,95 -> 526,100 -> 541,100 -> 541,95 -> 533,95 -> 533,93
462,155 -> 462,157 -> 457,157 -> 457,162 -> 471,162 -> 471,157 -> 465,157 -> 465,155
477,152 -> 481,152
462,167 -> 462,168 -> 474,168 -> 474,167
504,104 -> 504,105 -> 521,105 -> 521,104
489,128 -> 493,128
520,108 -> 520,110 -> 516,110 -> 516,113 -> 529,113 -> 529,110 -> 525,110 -> 525,108
482,30 -> 482,23 -> 482,30 -> 484,30 -> 484,20 -> 484,30 -> 486,30 -> 486,26 -> 486,30 -> 488,30 -> 488,23 -> 488,30 -> 490,30 -> 490,20 -> 490,30 -> 492,30 -> 492,25 -> 492,30 -> 494,30 -> 494,29 -> 494,30 -> 496,30 -> 496,24 -> 496,30
502,46 -> 502,48 -> 494,48 -> 494,55 -> 507,55 -> 507,48 -> 506,48 -> 506,46
529,93 -> 529,95 -> 526,95 -> 526,100 -> 541,100 -> 541,95 -> 533,95 -> 533,93
490,43 -> 490,42 -> 490,43 -> 492,43 -> 492,35 -> 492,43 -> 494,43 -> 494,38 -> 494,43 -> 496,43 -> 496,36 -> 496,43 -> 498,43 -> 498,39 -> 498,43 -> 500,43 -> 500,35 -> 500,43 -> 502,43 -> 502,36 -> 502,43
482,30 -> 482,23 -> 482,30 -> 484,30 -> 484,20 -> 484,30 -> 486,30 -> 486,26 -> 486,30 -> 488,30 -> 488,23 -> 488,30 -> 490,30 -> 490,20 -> 490,30 -> 492,30 -> 492,25 -> 492,30 -> 494,30 -> 494,29 -> 494,30 -> 496,30 -> 496,24 -> 496,30
514,84 -> 514,79 -> 514,84 -> 516,84 -> 516,78 -> 516,84 -> 518,84 -> 518,77 -> 518,84 -> 520,84 -> 520,82 -> 520,84 -> 522,84 -> 522,79 -> 522,84
504,68 -> 504,59 -> 504,68 -> 506,68 -> 506,60 -> 506,68 -> 508,68 -> 508,63 -> 508,68 -> 510,68 -> 510,67 -> 510,68
483,140 -> 487,140
529,93 -> 529,95 -> 526,95 -> 526,100 -> 541,100 -> 541,95 -> 533,95 -> 533,93
482,30 -> 482,23 -> 482,30 -> 484,30 -> 484,20 -> 484,30 -> 486,30 -> 486,26 -> 486,30 -> 488,30 -> 488,23 -> 488,30 -> 490,30 -> 490,20 -> 490,30 -> 492,30 -> 492,25 -> 492,30 -> 494,30 -> 494,29 -> 494,30 -> 496,30 -> 496,24 -> 496,30
514,84 -> 514,79 -> 514,84 -> 516,84 -> 516,78 -> 516,84 -> 518,84 -> 518,77 -> 518,84 -> 520,84 -> 520,82 -> 520,84 -> 522,84 -> 522,79 -> 522,84
507,122 -> 511,122
489,140 -> 493,140
510,125 -> 514,125
490,43 -> 490,42 -> 490,43 -> 492,43 -> 492,35 -> 492,43 -> 494,43 -> 494,38 -> 494,43 -> 496,43 -> 496,36 -> 496,43 -> 498,43 -> 498,39 -> 498,43 -> 500,43 -> 500,35 -> 500,43 -> 502,43 -> 502,36 -> 502,43
480,149 -> 484,149
482,30 -> 482,23 -> 482,30 -> 484,30 -> 484,20 -> 484,30 -> 486,30 -> 486,26 -> 486,30 -> 488,30 -> 488,23 -> 488,30 -> 490,30 -> 490,20 -> 490,30 -> 492,30 -> 492,25 -> 492,30 -> 494,30 -> 494,29 -> 494,30 -> 496,30 -> 496,24 -> 496,30
492,125 -> 496,125
503,70 -> 503,71 -> 518,71
520,108 -> 520,110 -> 516,110 -> 516,113 -> 529,113 -> 529,110 -> 525,110 -> 525,108
462,155 -> 462,157 -> 457,157 -> 457,162 -> 471,162 -> 471,157 -> 465,157 -> 465,155
490,43 -> 490,42 -> 490,43 -> 492,43 -> 492,35 -> 492,43 -> 494,43 -> 494,38 -> 494,43 -> 496,43 -> 496,36 -> 496,43 -> 498,43 -> 498,39 -> 498,43 -> 500,43 -> 500,35 -> 500,43 -> 502,43 -> 502,36 -> 502,43
462,167 -> 462,168 -> 474,168 -> 474,167
490,43 -> 490,42 -> 490,43 -> 492,43 -> 492,35 -> 492,43 -> 494,43 -> 494,38 -> 494,43 -> 496,43 -> 496,36 -> 496,43 -> 498,43 -> 498,39 -> 498,43 -> 500,43 -> 500,35 -> 500,43 -> 502,43 -> 502,36 -> 502,43
514,84 -> 514,79 -> 514,84 -> 516,84 -> 516,78 -> 516,84 -> 518,84 -> 518,77 -> 518,84 -> 520,84 -> 520,82 -> 520,84 -> 522,84 -> 522,79 -> 522,84
491,17 -> 496,17
504,68 -> 504,59 -> 504,68 -> 506,68 -> 506,60 -> 506,68 -> 508,68 -> 508,63 -> 508,68 -> 510,68 -> 510,67 -> 510,68
502,46 -> 502,48 -> 494,48 -> 494,55 -> 507,55 -> 507,48 -> 506,48 -> 506,46
504,68 -> 504,59 -> 504,68 -> 506,68 -> 506,60 -> 506,68 -> 508,68 -> 508,63 -> 508,68 -> 510,68 -> 510,67 -> 510,68
504,68 -> 504,59 -> 504,68 -> 506,68 -> 506,60 -> 506,68 -> 508,68 -> 508,63 -> 508,68 -> 510,68 -> 510,67 -> 510,68
490,43 -> 490,42 -> 490,43 -> 492,43 -> 492,35 -> 492,43 -> 494,43 -> 494,38 -> 494,43 -> 496,43 -> 496,36 -> 496,43 -> 498,43 -> 498,39 -> 498,43 -> 500,43 -> 500,35 -> 500,43 -> 502,43 -> 502,36 -> 502,43
482,30 -> 482,23 -> 482,30 -> 484,30 -> 484,20 -> 484,30 -> 486,30 -> 486,26 -> 486,30 -> 488,30 -> 488,23 -> 488,30 -> 490,30 -> 490,20 -> 490,30 -> 492,30 -> 492,25 -> 492,30 -> 494,30 -> 494,29 -> 494,30 -> 496,30 -> 496,24 -> 496,30
504,125 -> 508,125
462,155 -> 462,157 -> 457,157 -> 457,162 -> 471,162 -> 471,157 -> 465,157 -> 465,155
490,43 -> 490,42 -> 490,43 -> 492,43 -> 492,35 -> 492,43 -> 494,43 -> 494,38 -> 494,43 -> 496,43 -> 496,36 -> 496,43 -> 498,43 -> 498,39 -> 498,43 -> 500,43 -> 500,35 -> 500,43 -> 502,43 -> 502,36 -> 502,43
490,43 -> 490,42 -> 490,43 -> 492,43 -> 492,35 -> 492,43 -> 494,43 -> 494,38 -> 494,43 -> 496,43 -> 496,36 -> 496,43 -> 498,43 -> 498,39 -> 498,43 -> 500,43 -> 500,35 -> 500,43 -> 502,43 -> 502,36 -> 502,43
502,46 -> 502,48 -> 494,48 -> 494,55 -> 507,55 -> 507,48 -> 506,48 -> 506,46
504,68 -> 504,59 -> 504,68 -> 506,68 -> 506,60 -> 506,68 -> 508,68 -> 508,63 -> 508,68 -> 510,68 -> 510,67 -> 510,68
486,137 -> 490,137
502,46 -> 502,48 -> 494,48 -> 494,55 -> 507,55 -> 507,48 -> 506,48 -> 506,46
462,155 -> 462,157 -> 457,157 -> 457,162 -> 471,162 -> 471,157 -> 465,157 -> 465,155
529,93 -> 529,95 -> 526,95 -> 526,100 -> 541,100 -> 541,95 -> 533,95 -> 533,93
504,104 -> 504,105 -> 521,105 -> 521,104
490,43 -> 490,42 -> 490,43 -> 492,43 -> 492,35 -> 492,43 -> 494,43 -> 494,38 -> 494,43 -> 496,43 -> 496,36 -> 496,43 -> 498,43 -> 498,39 -> 498,43 -> 500,43 -> 500,35 -> 500,43 -> 502,43 -> 502,36 -> 502,43
471,152 -> 475,152
520,108 -> 520,110 -> 516,110 -> 516,113 -> 529,113 -> 529,110 -> 525,110 -> 525,108
514,84 -> 514,79 -> 514,84 -> 516,84 -> 516,78 -> 516,84 -> 518,84 -> 518,77 -> 518,84 -> 520,84 -> 520,82 -> 520,84 -> 522,84 -> 522,79 -> 522,84
494,15 -> 499,15
490,43 -> 490,42 -> 490,43 -> 492,43 -> 492,35 -> 492,43 -> 494,43 -> 494,38 -> 494,43 -> 496,43 -> 496,36 -> 496,43 -> 498,43 -> 498,39 -> 498,43 -> 500,43 -> 500,35 -> 500,43 -> 502,43 -> 502,36 -> 502,43
514,84 -> 514,79 -> 514,84 -> 516,84 -> 516,78 -> 516,84 -> 518,84 -> 518,77 -> 518,84 -> 520,84 -> 520,82 -> 520,84 -> 522,84 -> 522,79 -> 522,84
492,137 -> 496,137
480,137 -> 484,137
520,108 -> 520,110 -> 516,110 -> 516,113 -> 529,113 -> 529,110 -> 525,110 -> 525,108
482,30 -> 482,23 -> 482,30 -> 484,30 -> 484,20 -> 484,30 -> 486,30 -> 486,26 -> 486,30 -> 488,30 -> 488,23 -> 488,30 -> 490,30 -> 490,20 -> 490,30 -> 492,30 -> 492,25 -> 492,30 -> 494,30 -> 494,29 -> 494,30 -> 496,30 -> 496,24 -> 496,30
482,30 -> 482,23 -> 482,30 -> 484,30 -> 484,20 -> 484,30 -> 486,30 -> 486,26 -> 486,30 -> 488,30 -> 488,23 -> 488,30 -> 490,30 -> 490,20 -> 490,30 -> 492,30 -> 492,25 -> 492,30 -> 494,30 -> 494,29 -> 494,30 -> 496,30 -> 496,24 -> 496,30

30
2022/inputs/day15.txt Normal file
View File

@ -0,0 +1,30 @@
Sensor at x=2332081, y=2640840: closest beacon is at x=2094728, y=2887414
Sensor at x=3048293, y=3598671: closest beacon is at x=3872908, y=3598272
Sensor at x=2574256, y=3973583: closest beacon is at x=2520711, y=4005929
Sensor at x=3011471, y=2514567: closest beacon is at x=2999559, y=2558817
Sensor at x=3718881, y=2593817: closest beacon is at x=2999559, y=2558817
Sensor at x=2388052, y=2201955: closest beacon is at x=2163809, y=1961540
Sensor at x=3783125, y=3897169: closest beacon is at x=3872908, y=3598272
Sensor at x=1864613, y=3918152: closest beacon is at x=2520711, y=4005929
Sensor at x=2850099, y=689863: closest beacon is at x=3231146, y=2000000
Sensor at x=3431652, y=2328669: closest beacon is at x=3231146, y=2000000
Sensor at x=3480248, y=3999492: closest beacon is at x=3872908, y=3598272
Sensor at x=455409, y=3347614: closest beacon is at x=-399822, y=4026621
Sensor at x=2451938, y=2950107: closest beacon is at x=2094728, y=2887414
Sensor at x=1917790, y=3194437: closest beacon is at x=2094728, y=2887414
Sensor at x=3947393, y=3625984: closest beacon is at x=3872908, y=3598272
Sensor at x=1615064, y=2655330: closest beacon is at x=2094728, y=2887414
Sensor at x=3630338, y=1977851: closest beacon is at x=3231146, y=2000000
Sensor at x=3878266, y=3019867: closest beacon is at x=3872908, y=3598272
Sensor at x=2837803, y=2395749: closest beacon is at x=2999559, y=2558817
Sensor at x=3979396, y=3697962: closest beacon is at x=3872908, y=3598272
Sensor at x=109399, y=250528: closest beacon is at x=929496, y=-688981
Sensor at x=2401381, y=3518884: closest beacon is at x=2520711, y=4005929
Sensor at x=3962391, y=71053: closest beacon is at x=5368730, y=-488735
Sensor at x=1751119, y=97658: closest beacon is at x=929496, y=-688981
Sensor at x=2932155, y=2967347: closest beacon is at x=2999559, y=2558817
Sensor at x=3326630, y=2845463: closest beacon is at x=2999559, y=2558817
Sensor at x=3959042, y=1734156: closest beacon is at x=3231146, y=2000000
Sensor at x=675279, y=1463916: closest beacon is at x=2163809, y=1961540
Sensor at x=3989603, y=3500749: closest beacon is at x=3872908, y=3598272
Sensor at x=1963470, y=2288355: closest beacon is at x=2163809, y=1961540

64
2022/inputs/day16.txt Normal file
View File

@ -0,0 +1,64 @@
Valve AA has flow rate=0; tunnels lead to valves AM, AN, BN, LA, RJ
Valve AM has flow rate=0; tunnels lead to valves OJ, AA
Valve AN has flow rate=0; tunnels lead to valves AA, IX
Valve BB has flow rate=0; tunnels lead to valves NS, HR
Valve BN has flow rate=0; tunnels lead to valves AA, YH
Valve CN has flow rate=7; tunnels lead to valves YH, EO, WX, NR, OM
Valve CV has flow rate=0; tunnels lead to valves KV, NS
Valve DT has flow rate=16; tunnels lead to valves UU, HU, KA, VH
Valve EE has flow rate=0; tunnels lead to valves LY, RI
Valve EO has flow rate=0; tunnels lead to valves IK, CN
Valve FM has flow rate=0; tunnels lead to valves VT, RP
Valve GG has flow rate=12; tunnels lead to valves ML, IL, MH, OL, KA
Valve GQ has flow rate=0; tunnels lead to valves YA, KO
Valve HF has flow rate=0; tunnels lead to valves NR, SU
Valve HG has flow rate=0; tunnels lead to valves MH, RP
Valve HN has flow rate=0; tunnels lead to valves KV, LR
Valve HR has flow rate=11; tunnels lead to valves BB, KO, LR
Valve HU has flow rate=0; tunnels lead to valves TQ, DT
Valve IK has flow rate=0; tunnels lead to valves EO, RP
Valve IL has flow rate=0; tunnels lead to valves GG, XD
Valve IP has flow rate=0; tunnels lead to valves WX, VT
Valve IX has flow rate=0; tunnels lead to valves AN, JQ
Valve JC has flow rate=0; tunnels lead to valves JQ, NJ
Valve JQ has flow rate=6; tunnels lead to valves IX, JC, PX, YN, OM
Valve KA has flow rate=0; tunnels lead to valves GG, DT
Valve KO has flow rate=0; tunnels lead to valves GQ, HR
Valve KV has flow rate=13; tunnels lead to valves HN, CV, PE, XD, TA
Valve LA has flow rate=0; tunnels lead to valves AA, MU
Valve LI has flow rate=15; tunnel leads to valve XG
Valve LR has flow rate=0; tunnels lead to valves HR, HN
Valve LY has flow rate=0; tunnels lead to valves EE, RP
Valve MH has flow rate=0; tunnels lead to valves GG, HG
Valve ML has flow rate=0; tunnels lead to valves RI, GG
Valve MU has flow rate=0; tunnels lead to valves VT, LA
Valve NJ has flow rate=0; tunnels lead to valves QF, JC
Valve NR has flow rate=0; tunnels lead to valves HF, CN
Valve NS has flow rate=23; tunnels lead to valves CV, BB, UJ
Valve OJ has flow rate=0; tunnels lead to valves RP, AM
Valve OL has flow rate=0; tunnels lead to valves GG, SU
Valve OM has flow rate=0; tunnels lead to valves CN, JQ
Valve PE has flow rate=0; tunnels lead to valves KV, RI
Valve PX has flow rate=0; tunnels lead to valves XZ, JQ
Valve QF has flow rate=17; tunnels lead to valves YI, NJ
Valve RI has flow rate=4; tunnels lead to valves ML, EE, TZ, RJ, PE
Valve RJ has flow rate=0; tunnels lead to valves AA, RI
Valve RP has flow rate=3; tunnels lead to valves HG, FM, OJ, IK, LY
Valve SF has flow rate=0; tunnels lead to valves YN, SU
Valve SU has flow rate=19; tunnels lead to valves TQ, HF, OL, SF
Valve TA has flow rate=0; tunnels lead to valves KV, VH
Valve TQ has flow rate=0; tunnels lead to valves HU, SU
Valve TZ has flow rate=0; tunnels lead to valves VT, RI
Valve UH has flow rate=25; tunnel leads to valve YI
Valve UJ has flow rate=0; tunnels lead to valves YA, NS
Valve UU has flow rate=0; tunnels lead to valves DT, XG
Valve VH has flow rate=0; tunnels lead to valves DT, TA
Valve VT has flow rate=5; tunnels lead to valves IP, XZ, TZ, FM, MU
Valve WX has flow rate=0; tunnels lead to valves CN, IP
Valve XD has flow rate=0; tunnels lead to valves IL, KV
Valve XG has flow rate=0; tunnels lead to valves LI, UU
Valve XZ has flow rate=0; tunnels lead to valves PX, VT
Valve YA has flow rate=21; tunnels lead to valves UJ, GQ
Valve YH has flow rate=0; tunnels lead to valves CN, BN
Valve YI has flow rate=0; tunnels lead to valves QF, UH
Valve YN has flow rate=0; tunnels lead to valves SF, JQ

1
2022/inputs/day17.txt Normal file

File diff suppressed because one or more lines are too long

2150
2022/inputs/day18.txt Normal file

File diff suppressed because it is too large Load Diff

30
2022/inputs/day19.txt Normal file
View File

@ -0,0 +1,30 @@
Blueprint 1: Each ore robot costs 4 ore. Each clay robot costs 4 ore. Each obsidian robot costs 4 ore and 12 clay. Each geode robot costs 4 ore and 19 obsidian.
Blueprint 2: Each ore robot costs 4 ore. Each clay robot costs 4 ore. Each obsidian robot costs 2 ore and 11 clay. Each geode robot costs 2 ore and 7 obsidian.
Blueprint 3: Each ore robot costs 3 ore. Each clay robot costs 3 ore. Each obsidian robot costs 2 ore and 13 clay. Each geode robot costs 3 ore and 12 obsidian.
Blueprint 4: Each ore robot costs 2 ore. Each clay robot costs 3 ore. Each obsidian robot costs 3 ore and 18 clay. Each geode robot costs 2 ore and 19 obsidian.
Blueprint 5: Each ore robot costs 2 ore. Each clay robot costs 4 ore. Each obsidian robot costs 3 ore and 19 clay. Each geode robot costs 4 ore and 13 obsidian.
Blueprint 6: Each ore robot costs 4 ore. Each clay robot costs 4 ore. Each obsidian robot costs 3 ore and 7 clay. Each geode robot costs 4 ore and 11 obsidian.
Blueprint 7: Each ore robot costs 4 ore. Each clay robot costs 4 ore. Each obsidian robot costs 4 ore and 15 clay. Each geode robot costs 4 ore and 17 obsidian.
Blueprint 8: Each ore robot costs 3 ore. Each clay robot costs 4 ore. Each obsidian robot costs 4 ore and 13 clay. Each geode robot costs 3 ore and 7 obsidian.
Blueprint 9: Each ore robot costs 4 ore. Each clay robot costs 4 ore. Each obsidian robot costs 2 ore and 12 clay. Each geode robot costs 3 ore and 15 obsidian.
Blueprint 10: Each ore robot costs 4 ore. Each clay robot costs 3 ore. Each obsidian robot costs 4 ore and 18 clay. Each geode robot costs 4 ore and 11 obsidian.
Blueprint 11: Each ore robot costs 4 ore. Each clay robot costs 4 ore. Each obsidian robot costs 4 ore and 8 clay. Each geode robot costs 2 ore and 15 obsidian.
Blueprint 12: Each ore robot costs 4 ore. Each clay robot costs 3 ore. Each obsidian robot costs 4 ore and 8 clay. Each geode robot costs 3 ore and 7 obsidian.
Blueprint 13: Each ore robot costs 4 ore. Each clay robot costs 3 ore. Each obsidian robot costs 3 ore and 10 clay. Each geode robot costs 2 ore and 10 obsidian.
Blueprint 14: Each ore robot costs 2 ore. Each clay robot costs 3 ore. Each obsidian robot costs 3 ore and 13 clay. Each geode robot costs 2 ore and 20 obsidian.
Blueprint 15: Each ore robot costs 3 ore. Each clay robot costs 4 ore. Each obsidian robot costs 3 ore and 19 clay. Each geode robot costs 3 ore and 8 obsidian.
Blueprint 16: Each ore robot costs 3 ore. Each clay robot costs 3 ore. Each obsidian robot costs 2 ore and 16 clay. Each geode robot costs 2 ore and 18 obsidian.
Blueprint 17: Each ore robot costs 4 ore. Each clay robot costs 4 ore. Each obsidian robot costs 2 ore and 9 clay. Each geode robot costs 3 ore and 19 obsidian.
Blueprint 18: Each ore robot costs 4 ore. Each clay robot costs 4 ore. Each obsidian robot costs 2 ore and 11 clay. Each geode robot costs 4 ore and 8 obsidian.
Blueprint 19: Each ore robot costs 3 ore. Each clay robot costs 4 ore. Each obsidian robot costs 3 ore and 12 clay. Each geode robot costs 3 ore and 17 obsidian.
Blueprint 20: Each ore robot costs 3 ore. Each clay robot costs 3 ore. Each obsidian robot costs 2 ore and 14 clay. Each geode robot costs 3 ore and 17 obsidian.
Blueprint 21: Each ore robot costs 4 ore. Each clay robot costs 4 ore. Each obsidian robot costs 2 ore and 15 clay. Each geode robot costs 3 ore and 16 obsidian.
Blueprint 22: Each ore robot costs 4 ore. Each clay robot costs 4 ore. Each obsidian robot costs 2 ore and 16 clay. Each geode robot costs 4 ore and 16 obsidian.
Blueprint 23: Each ore robot costs 3 ore. Each clay robot costs 4 ore. Each obsidian robot costs 4 ore and 19 clay. Each geode robot costs 4 ore and 11 obsidian.
Blueprint 24: Each ore robot costs 4 ore. Each clay robot costs 4 ore. Each obsidian robot costs 4 ore and 18 clay. Each geode robot costs 4 ore and 9 obsidian.
Blueprint 25: Each ore robot costs 4 ore. Each clay robot costs 3 ore. Each obsidian robot costs 2 ore and 17 clay. Each geode robot costs 3 ore and 16 obsidian.
Blueprint 26: Each ore robot costs 3 ore. Each clay robot costs 4 ore. Each obsidian robot costs 2 ore and 20 clay. Each geode robot costs 4 ore and 7 obsidian.
Blueprint 27: Each ore robot costs 2 ore. Each clay robot costs 2 ore. Each obsidian robot costs 2 ore and 8 clay. Each geode robot costs 2 ore and 14 obsidian.
Blueprint 28: Each ore robot costs 3 ore. Each clay robot costs 4 ore. Each obsidian robot costs 3 ore and 20 clay. Each geode robot costs 3 ore and 14 obsidian.
Blueprint 29: Each ore robot costs 4 ore. Each clay robot costs 3 ore. Each obsidian robot costs 4 ore and 20 clay. Each geode robot costs 4 ore and 8 obsidian.
Blueprint 30: Each ore robot costs 3 ore. Each clay robot costs 4 ore. Each obsidian robot costs 4 ore and 18 clay. Each geode robot costs 3 ore and 13 obsidian.

2500
2022/inputs/day2.txt Normal file

File diff suppressed because it is too large Load Diff

5000
2022/inputs/day20.txt Normal file

File diff suppressed because it is too large Load Diff

1835
2022/inputs/day21.txt Normal file

File diff suppressed because it is too large Load Diff

202
2022/inputs/day22.txt Normal file

File diff suppressed because one or more lines are too long

70
2022/inputs/day23.txt Normal file
View File

@ -0,0 +1,70 @@
#...#.####.......###.#..##.#####.#...##.##.##.#.#.#...#.#...##...#..#.
#.#.####.#.#.###...#####.##..####..#.###...#.#...........#..#.#..##...
#.#####....#..###.#.###..##.#.#.#..#...###...####.#.##.#.#..#.###.#..#
.#..##.....##.##.#.#...##.#.##..#..##.#.#...#####...####..###...##..#.
##...###..##....##.#.#...#...#...##...#..#.#..##..###..##......####.#.
#..##.#.#...####.....###.#...#####.....##.##.#....#.#.......####..#.#.
..#.###....###..##.....#...#...#####....#.###.....###..###.#####..#...
#..###..##...##.#.#...##.#.#.#.###.#######.#.###...#..#.######....##.#
#.....###.....####.#..#...##..#.#.#...##....##.###.#.#...#.#.#..#.###.
.#...#......#......##..##.#....#.......##....##...#####...###..#.#.###
.#.####...#.###.##..##.#.#.##.##.####..####.###.#######..##...#..###..
.....##......#.#.##.######....#.#.#.#####.##.#.##...#.#..###.#.#.###..
.#.##.#.#.##..###.#..#...#####..##..#.#####...#....#..#.#...#.##.#....
.####...#....#.#.##.#.##.####......#......###....####.....#######....#
.###...########.##.#..#.#...#.##..####.##.#####.#..#.#....##...#...##.
#..###..####.#....#.#..#####.##.#.##...#.#.###.###.#.#....###...#.##.#
###..#.###.#.#####.###....###..#...##.###.#..##.####.#.#.#.###...##.#.
.#####.#..##..#...#.##.#..##.#.#.#...##.##..####..#.##.........#..##.#
.#.###...#....#.##.######..#...##.#...###.##...###...########..#.#.###
.######.#...##.####.##..#..#...#.#..##.##.#.##.#.#.#.##.#.###..##.##.#
#...####.#.#..##.#...##.#.#...##.#......####...#..#....##.##..#.###.#.
#....##..#.##....#######.#...#..#.####.##.....###.####.#.###..#..####.
..##..##.#....########..#.##.......#...#.#.........##.#.#..#....####..
.#..##.#.#.##...#.....##...##.#.#...#....#..#####.#..#..#.###..#.#.###
#.##.##............##.##.....##.#...#.#..##..#.#..###.....#..#..#..#.#
..#.....#..#..#.#.....#...###.#.#..#....##.##...#...##.##....#..##...#
..##...##.##......#...#..#####....#..#......###.#..#####...####.#....#
#..###.##..####.#....#..##.#..##.##.#.#..######.........#.##....######
..#.######.#.##...#..####..##....##..###.#.###.#.#..#.##.##.###.#..#.#
..#.####.###.#.#..###..#######.#..##.#....#.#####.###....#.#..###...##
....#....#..###.#...#......#..##...##..##.#.###...###.#.#.#.#..#...#.#
#....#..##..##.###.####.#######.###.###...#...#..###...#...#.#..#.##.#
#...###.##..#.#..#.#..#.#.#..###..####.##.##.#...###.#.###########...#
##...#...#...#..##....#...#...#....###.#######.....#.#.##...##..#.#..#
.....##.##.#.#.#..#..###....##.#....####.#.##.####..#.##.#..##.##.###.
....##.#....#####.#.##.........##.######.#..###..###..#.#.##.###.....#
...##..#####....##..####....##..###.##.##..##...#.#.###.#.#.##.#.##...
..#..####.#..#.##.##.#..####..#.#...##.....#...#....###..#.#.##..#.##.
#####.#..#.#.###..#.#.###.#######.#.#...#........##..#...#.##..#.##.#.
.#..###.###.#..##.####.##.###...#..#.#.....#.#.#...#....#.###..##.#.#.
.#.#.....##.##.#.####..##.#.#...#.#..#.....#..#....#......#.######.##.
...##.##..#....###...#..#.#..#.#.#.##..##.#..#.####..####.#.#.........
#.###.#...#....#...#.###.....#..#...##.#.#.####..#...#.#.#..####......
##.###.#.#####.#.##....#..#..##..##..#..##..##...#.#.##.##....#...##..
.###..###....#...##..###..#....###.....#..##...###.###.###..##.#..####
#.###........#..##.#.....#.....#...##.#####.#.##..##....####.#...##.#.
#.#.#..###.##.###..###..##..######..##.#####......#.##....##.#..###.#.
###...##.#.#.#.#.#.######...#..##.....#.#######.#..#..###.#.###.#...#.
###..######......#.###..#.....#########....#####.##..#...#.#...###..##
##.#..######..#.###..#.###.###.#.#####.####.....#...#.#...#####.#..##.
...####.#.#####.##...##..#.######.###....#.###.#.##.#####...#.#.#.####
#..###.########.#.###.#.####.###.###.#..#.##.#.#####..####.#.###...###
#..#.....#.###.#.##.###.#.....#..#....#####.#.#...##.###.######.###.##
##.#.#...###.#.#..#.#.###....###..#.##.#..#..###.#..#######.##.###.###
.##..##.#..#.#####.###.#.#.#......#.#.##.#...#.######.##...#.###.#####
#####....#.##....##.###..#.###..###.##...####.###.###..##.####.#.##.##
#......#.##.##.##.#....#.##.##..########.#....#..#..###.#####.#.#..##.
.#..#...#..##.#..###...#......##.##.###.....#.#.#.#..#.#####.##..#.###
.##.##.#.##.###..#..##.####.#.#..####.#.#.......##.......##.....#####.
####...##...#.#.#..###.#####.#.#.#.##.#..##......#.###.##..#...#...#.#
...........##.#.####.#.#########..###....#...#.......#..####..#####.#.
.#.###.##.#..####..#.###.#.#####..##.#......#.#..#####.##.#.###.#.##.#
###..#...#.##.####.#.##...#..#.......######...#....##....#.....#...#..
####.#.#...#.#.#######.##...#..#.#..#####...#..#.#..##.##.....##.##.#.
###..##..#..#.#.##.##..#..##..##..#####.#.##..##.####.##.##...#.####.#
#.##.#.#..##..####.....#.###..#....###.#.##.###.#.#.#.######.##....#..
.#.#..##..#.###.#.....##.##..##....####..#.#..#..##########.#...#...#.
###.####.#.#.##.#......#.###......##.###..##.##.#..#....#.##.#..#.....
.....##.......###.#..####.#.#.#.###..##...##...####.#.##.#.#.#..#.#.##
..##.##.#..#.##.....#...##.#...#.###..##.#.##...#..#.....###.#.#####..

22
2022/inputs/day24.txt Normal file
View File

@ -0,0 +1,22 @@
#.######################################################################################################################################################
#.v><><<>^^^<><<>.^v<>v^>v^v^^<..^v>^>^vv.>v^<<>^.v<vvv<.>><v>><^>><>^<><v<>>>><v>v<^<>^.v..v^vv<v<<vv.v>>v<>v.<..^<vv<^v^v.v>>v>><^v>^<.vv^^<<><<>v>><#
#.vv<vv<>.v<<<<<>>vv<>^v^^<^<>><.<^>^<^>^<v<<<<v>v>><.><.^><>vv<^^><<<<>^<.<v^.vv^vv>v>^.<<<><v<.v.<><<v^^v>^^<^>>^.<v^v.v><<v^vv<<v>^v>><^^<^<v>^>><v<#
#<v^>v^vv<><v><<^<>^<^vv>v>>^^><<<vv><v.v.^><<^><>v>^<^v<<^>v<vv><v<<^.vv^>>>.^v>v.><v>v<^<^^<><<>><<^^^>v<^>>^v>>vv.<>^<><<^v>><^.>v^v><<^^^^<v<>^v<v.#
#<<^<vv^<^><>^><>^vv.v^v>><^^<>^<>>^><^.^^<.v...>^^.^<<v<vvv>>>v^..^v.v<^><>.>v^.vv<^^vv>vv^.^.vv<v>>^>v.^^^<v<>><vv^>>^^.v>.v^^<^>vvv^<<v^<v<^><^>v<>>#
#<.<^>>^<v><^>^^.>>v^<v^vvv>>vv.v^<>^^>v<<vv^<>^v.<<<^>>>.^>vvv.^^^<^><<^><v>><^.^>vv^^vv.><<v<^<v^^^.>v>^>v.^^<<^^^>^><><<vv<.<>v>vv>><^^v>>vvv^<...<<#
#><v.v>vv>^^^>>><v>^^v>^>>><vv^<^<^<<<>.<<.<.<..><><v.v^^.v..v^>>>^v><.^^><<>v^<^<>^>>.v^v.v.>v>^>>>v>>^>><^<.v.v<^<<<<<^^>^^^^>^^<v^>>v><>.<>v><>.>><>#
#<><<.>^<>^^v<v>^><^>v^.>><vv^vv^<v<<>.>.>>.vv.v<.^<^<>>^><><^.v>>v^^v><>><<<vv<<>v><>^.>>^>v^^><^<v<<><vv^>>.<^<.^<^>vvv>^<.v<^<>.><.>>v<^>^v<<.^<v>^<#
#<>.<v^>.^<<^v^.<<^>v^^vv<^><^<^>><v^^vvv<<vvvv>>^v><<>^>vvvvv^<<v^.>^<.<^>.^>^><v^<>>.<<^^vv>>>^>vv><vvv^v.>^vv><<<<>^v^^^.>.^>>^^v^v>v>vv^<<^vv^<>v<>#
#<<>v>v>>v^^v><^<.vv<^>^^>.v^<.^^vv>.<>^<>v>^>vvv<vv^>v^><<<v>vv<..^v^v>v.v><^.<^>.v<v><v>v^>^<<<<<>^.v<^.<v.<<^>v^^^<^<<>v.<<^<<<<.<^><<<^<v<v>>v>.><>#
#>>.>vvv<<..>^^vv^>.<.v..v^^>^v<<>>>vv.<v>vv^<vv^v><v^^.<<.><..><^><<>^<<><v<.<v.<^<^.^<^<<><><<^v^>.<<v^^>.^<...v.^<^^<><><>v^<><^>^>^v^.>^^>^.vv.<v^>#
#>.<><v>v<v>v>^v^^v>.v^.v>v>.<>>>^vv<<v>>^>^.^<^vv.vvvv<<>v<^^.>v<^v<<^><^.^^v<>.v<vv><v<v>vvv>^^>v>..<<<v..>v..<^^^<v>^^<<vv<>>^^v^.vv<><^>>.^<<^>>v.>#
#><v..vv^<v^<>>v<>..<^>v^^><.>vv^vv^<^^v<>vv<.vv^^<>^>>^v<^^<<>^vv>v><>v<^vvv^<>><>^^^v^<v.v^<<^^>>>>><^^>><^v>>vv^v><^>^<<^.v>vv>^.v^<vv^v>>>vv>v^v<^>#
#...>><v.<v<>^.v.v..^>^<><vv^><<<vv^<vv.><^.vv>>><v^v^>^v>>v<.^<^^<v^<>v<^<><<<.^<<vv.<>>^v^^.v>.<v>^.^>v^.v><^<<>>>^.<<<^v<<<><^>.^.^v><>^>><vv<v.<.^>#
#<^vv>>v>v<^><^^^<^>vv<>vv>^^^.><><^>v>><v.<>vv^^<^<<<v^<><v>v^v>^<><><><><>^^>><>..^^>v<...vv<^>><.vv<^<v><v<vv^.><>v^<>v.^>>>v<<^<<^vv.>^<.^<>^<v^^^>#
#>>^vv^.<<.<.<>>vvv<<<..<v><^<>^><<>^.<<^^^<v^<<v.<vv<^<>>vv^>.v^v<^<>>vv<<^>>.v>.v>^^^vvv^v<^><v^><>><^<.>v^^^<vv^>^v<v^<vv><>..^><.>^^<^>>..^.v^<^<v>#
#<<><^^><v^v<^^<vv>><v..>>>^><>>>v>v>v>v><>>^vv><>>v>>vvvv<<^><>v^>vv>^.>>v.^<v<^.>>>^^v>>><vvv>><.<v<^<v<^v<v<<vvv..^^<<^<.<><<<<^<>v<<<^^>.^v>^^v<^^<#
#>v^^^<v>^^<v<<<vv><^v.v<v^^^vvv<<><><^^><^^>>>>>><^>^^.>vv>^><<<v<<<^vv.^^^<v>v<^^^^>.^^vv<^<.<v^<vv^^^>><..><^>v><<v>v>^v^>>^^>vv.v^^^>^^vv.<<v.^><<.#
#<^v<<^^vvv.>v>v>.v><v<^^>^>^>^^v>v^vv^<.^.>>>>>v<>.<<.<^<<vvv..<^>^><^>^<^<<>><^>v<v^v>^v^^^>>>>v>^>>^<v..><.>>^^><^<^.<v^>^.v>^^vv^v.<>>>>.v.<<>^^vv>#
#<v^v.>.>^v>^<v.<^<^>v^>^^.>.>v<>>>^>vv<>v<>^>v^<<^<.<<^>v^<><>><^^<^^v<>>vv<<.<>v>.>^^^>><^^<^vv.><v<.<<^^>^>><>v><^vv.>v^v^v..<vvv..<<v<v^<<v>^<^>><<#
#<^v<v^^v^>^<>v^<^<>>..>><>v<.^<.>v.>^v.>>^^<^v>>v^.v>^><>>vv.<<<>v>^.>v>..<<<v.<v^<>^>^<>v<^<v<><^>^v><.<<^^^<^.<<<^.^v^^.>^.<<vv>^v><<>^<^v^^>^v><<^>#
######################################################################################################################################################.#

124
2022/inputs/day25.txt Normal file
View File

@ -0,0 +1,124 @@
21-0==1=-0
102211-220011-----
1=2=111=10=-
12-2=022=2
1=--=11
12-2211000=0011-0-
1=1-
2=0-10-=21-2
1210-
2=1-=
1=0=12=2112--11=
2--211=200
20-02-20
12=12=0=0=1
22===21=-0102-012=
1--=-121
1=02=2-=
12-0-20
2=---=0102--00=22
1=2==0=2=
11-1112
2--012
12=12=--212-0-==-02
1=220
20===1
2210-02=12-022-=1-
22--1-==1
211-1=1=0-==1
10
1-1-02
1=-2==-0=21
1=102
20121021
1=2=22=001200-==1020
10211-1-20--10-1=
1222==1--=1--11-=
11211211
1=101-20=
1=1-11=0=000
1=-=101
2
1000-2
1==0=210=1=21222-=2
1=1==2-
2--020=2=2===-
2-
2=0
222101=22=-21=11
2=
121201-0-20-2-=11=
10=
1212=20=2=-=-1--1
2-20-=212=01
1=1--00--0=12=-00
22--
22
22===1=-0-22-
111-=
2-111=0021=2
200=22-=12-2=
1==-=1=0
1--=02-0002=
1=-=2-2=2-
2=2222220=2==001
1=00==11=-20-=2-2
1---0=-=
1-0==10-=22001
1=02=02-1=0111
1-=010-21-=21==02
10200-2=-=20120-2
1=-
10=122-
210-1=-=2011-0--1
2==-1=20
1=-=101-20=221-1
210
1-=-==-0-=02=---
1-=1=-=12=0
1-=0---12-0=
210-==1021=010=1
1=-212
11=1=-=2211=101222-
2=-==--=2
1=11-200--=
1120-
11=-0=221=0101=
11-1=-
1-12-2=0
1012-22=1-
20-122=-1=
1-100=0=101-0
20-1=1=0
1102=
21
10=20=11
1-=2001
1-20=12-0221102-==
1-1--010100=-1=
221002==2102-2=1
2012=121-22
110222002=01
212102-1=1=-211
210-=12
1=-1-0101=1-12
12--21=1
10=-12
100-122211=--2=
101102001
11011=-
211-0=-=0
1-2=01-1=
1-022-=00000
2==-0==2=--00=
10=--2000==
1---=--1-110-02
11-012
2==-2210-0
212
22-=-12111
2--=
2=2=12-100
10-12===0-
1==0=0=22012201
211-1--22

300
2022/inputs/day3.txt Normal file
View File

@ -0,0 +1,300 @@
LLBPGtltrGPBMMsLcLMMVMpVRhhfCDTwRwRdTfwDllRRRDhC
gNFJHJFgtZFJjZJHNNFWZWZwwDjCwSDhfCDbdwjfwDTTDT
gmQNZnZNHWnqmQpLtVLMBsPpBqrL
HlHldQtHlctzppdQtjdczHhJRnnhGNVmVRJmVjCVFCNh
LgWNgggZJZGFhCZr
DbqPswwMvDPqzlBNHtzfHdwd
tJgtJwwCtNvPHHPtHzDsdRTsBRDDWgWTgT
QhLQjLGjZQFlFZmnmGLDrzWfRldrTrzTBRWTzs
bFFmFZjhSFHvBCvCvJpb
MSGcvnvMGMJgWJDpdndZwBnppfCp
VPVfQQVbshZNZwdNDwNs
LtLbjmQRLmVhQtTbfgWjJgFFcrqqrGSqWg
fHfCNCwwHfGhcntntrrgHrQnrn
FVqpSpbPpjSVMjqvVmVvMzlzwJnbtnnlzQQlrWzJgt
PTqqRRPSRSmqSpPpSpRZwGCLGscCNLZZZTNdNZ
pQQQslVSVzzCQnZSlplzbLcHZHcrrrbZqFbZjbFm
gWtvPgdMDDtFDHHjJJbbccbrLW
MhNvwwDfDfdtvRQnpFNNTlSRSn
ZTnSnTTzqvFmVzvWWm
ClpCgltHNrtgsHdpLCHtDCNLVvQvVwVmwcsWQGMMQvcGcFcv
JmrgCHCNJtlmHmNhnJjnnnjJhPfhSJ
BgRRZTgHHvRTRmRNLNNhQWlmGFfJlWlhsQshpF
qPqSSttwnnzqqqwtVrPwMthFsJllJJlGhpJhWJQlhVQd
MjMwScnDPzcwjtqDtztnctrvgNZTTvCvLgvQbLbvjTBvBg
SWQSbbqTTbPcfMZSwZZwwn
dghjghmNDmGsGgdnfmtMRCLCCRncfc
pJDJNdsNMMhpssgdprBTBzWlpBWlllWb
TwNLNZTwWCWLwWCSTZSLzWHGrDHHPmGdDHvndGdNfvMm
BgpjtpgjBjVbRjQRhVsDnvgGgPnGdrmvnMDfrf
rhRjRssQJplRtVbpthblbbLSLzFCJZFqLLFWCzqcqzLL
PBrdPMtBPvCQBVBjCfWPqSHbszhGGnsfSG
JpmDwJgWJgNzmShhmfSGzh
pRwNcNpFZNZRWgcNplpjVCMVjdvdMQtCMLZjMZ
lDrcnnlLqLRcDDZRLjFVTHzGCLGVPzGPVWGB
pNwHpdmsNJsbpwsbzJTCPWTVFzzQTWCQ
vbhswdtdwfdsmtNSssHwvllvMcZjnjcnZqlgMDZglM
GVVtJGtzVFsVsDTH
mQRgcBRmRLnBjrtFjCCrHmFF
gqpBnlRpgZcvdSdlMdSvMt
tMSCNGSflffNhnnGqlPPsrzWPrTrVpWr
bZHbmDBQmbDZQdbDcRFZZBTTWWWwqVzszWjrFPVwrzqq
HQBLHmQVQLDdCggMfgMNLvNG
HHNDzNJPJPmdPcNGGGhnhwnVhCQBwBjQ
bsSbLfrLtRSLRSRRRsBwhCpfpCzlwCBVjlCV
zvvsvqLtZqLtzRsqTrggRMHJNWJgHHHNJcgWNPdHcH
qgbNvqbgmmZgZLvZqgnZzlpzpzHtVPzttGPrrnnl
jwswGjQDMsQMjdBwdcjCHVtcPVpCVCrPlVSrpc
GsFWBfhGBfDFDFWqNbLNqbgvqbbvfN
HgwWqtcqHNWgnHcNNCfvJCCJJfJGvnPfrR
sbDhZSmdBbsSdmSDdrjjffRvdjPrprCd
vvZbSFFlFHtqFqqWNc
ZRjnbRsHlncZGjTRTfFVSQBQppQvvFBHpF
zrLwMdhDhqJJttDQSldQVPQSlSfPlV
hCWWCzqWnmcZlRRW
HfgfQflHjWgRQRdRBWVsnbvvscbbbwvmbHncSc
tJGLtPPGZPwVvSSPhw
CLGTLZqJtMGqLDFFDZZJFZJpWjRpVNRWpllDpjlBfgVjlp
rhhGZZhLNhPmfJqvfLlq
dHRTHRHQQWcTCRTHmmjJgfqqlGmgWgql
CCwRzTRRdCCRSQwzRcppprZtrMhGBMZMnDSt
WfffvnSnfSBshwsjhlvGlh
ZHpFNTmppVmNzVVmmFMZzbwwjHGrGlPhCGrljbgHsg
pLZMmqVsZVMMVVscDfdtSSStqcRRdn
RhRbLzRLHLCPmzznHLbzCRTJhdTVSJJVSjdFFNFFNTJv
MGgMfpMsBgpnMtGfnfwBtDBjFVdNSSSFdvJSQSpTJdJjNv
lMsBgDMsblmRblnz
ClNcJZttLfLvvRQzQWwRQN
hrpMdqMspsrGDdMphhdMMMMHBmRWmSVrRVzVTzQBQvSmzVWV
ppHDMGhMMDbGMdDMGbgFbgbMlJJnjjZtZfLPcfcngZfPPfCR
ZRslLRgCclZLZzQghQhfrbfGbJ
pVSHpBBBBDVDqDBldVzfrMzQbfSTSJrzzJrJ
DqqHnBDlpNDVVnpnjtDtNjCvFLcsFFPZRcPsNNmPcFcP
LmLWSmSRNdcpcRHFHrWzWHbMbwZlZlPSbTjlwPbTPJTf
DttBsvhnhqvGGBhGtBVNBVqJlPwslMMPJwTjZbbZPTfbPs
CDthQvVNVFCHHWCFdr
RRtCWSzQZdRMrtRWrSztMggcGDfQTcfFTGqTLgGDLc
bnVhnvPHhhdJJBTLDGcDTcBvvD
pmbnhmPPmHwdCjmdrRtCdj
lTPzwhzmHpTvrDCDHJnsNN
tdgtbMMBbWdFbtqJCnsrqnMMDsrq
FjWdtgLSWttWtLSWtDWBjGGmwGlzTRwPTQGhlQQm
wcbnTtTppNLrntznTBBccCGrVldRrZqdqRCZdFZCVZ
JfHDgjgPPfRRgRlLRddR
jhDhhLMfmJjMjDbNSTzbbbtmttmN
CfGlvzpvpTjzzCWjvDlfvbbJbCRSdSRhsSQCMhdbhR
wqrSmrLHHNcLqrrLBNsndssnnhPshnsQwbnJ
NtcmBLcNVDWzjSvWtv
vZPCSCvCJffvVvmCmPqCSlDSscczHDRcwcHzRlRHHs
LFGFNnGrdQttNMFpzpMRRDslsJwsJH
gjtLnFBJrLvhZvCbZhqB
DBcjVFjDhQMSJVZbHZbl
nfmsqppnLfTnfmMmzppwgllSrbSHHtllqbtSwZ
TRzTnfRWnfdzWssfnRfRpncQPBhdDjjDCPcMQcCBGPPj
NSjWCHjNHjpPWPpSFWdtqBMBBFVBvqvJGJwqBt
gQllgDrnhQQDGRshRsZfVtVMRqwMtccVJcBtvRqw
DQrzrDzhQgrsZLrZjWSSHNTWCjjNGTLH
CgdcCFcbTbBzPgmNRmpptP
rsZtsvVvHZZzPmqVNPzNmV
HZjrwrjnjtHSHwDGdFhCdhWWJnWchCFJ
RMTqQMRJqPtBtGBPtWjN
ssHfSfShCwwbhsbHhhsmSfhSGNpCpNCjBBBLptcGtpzBBBWW
HnwrSFwffHsFwrSSjfHglJJlTgZdFdgZRZTDDM
pDLDWlDSlJDmzSJnDScRPLGGvqFqLPccGLgv
CZHfwNMVNjsHNNqPgcbcBbRQGQ
dCffZCjVCdCHHTmnlSgTlTSrlStp
bFtlLCvLlVjpCGPJndrrMMCDDCnrMg
hRsTwcZcBjZRJrfMDnsHrJnH
mNZqcTSSBTScNzVQFtGtjpFtjmGG
bjHdLrHjRWpDCtLzhzps
lZcGfTvQcQfvlqqcNCcBvVwtGzmzthmwmpthMDmswgMt
NcqflNQTBTTvvQSvqSVvQJbHPHbHCRJdndJPSHjWHb
CVmRncrRVrhcmsBgfmtfdJsJmt
bZHvZZDJwpWtdZgtGNGd
vSbwHDMFMJqPQqQvvSPQqpSwjRcTVTLjLRhVCLFLjLFnFzCC
mtffsmBwfwBDBmmsLsHqtpftGrMVMPSMPsVvhNvFrGPMvjNV
TQTQCRWjJcdcQQSPrhhPSvVGPF
cTRJCnldWJZlTgbWgbdbpqfqmppjmtljpqzmjpLw
NNPmrmPWmrSSNNPmnglghmCvLCCflh
LFbsDQMQFtQFHbQHqhvnngCftpcllptJgJ
bDjsGqLLdRVjPZPP
tgrbBQlbtRblwtRGrbCNswDDCsvFszpssCss
SJVMhSZfHvpdhphN
SMLpWZSSZMjfgGBgRtbQgljQ
HsHHNDDHzHDDjsVBBZqtWBrSNcPwQvccvvdhPclSrQSc
fGCFCgpgTfnTmgTFLFgccclhwQhwrzSwSwrCrr
pmLJGfMRpFmfFMzmgGmRpgmVqWJDqZqqHtjBBVDBBqqssJ
mBTfcfCCmpBCCSzNQScQSTfddhdtwgttjghNwGtGdgwGtd
HvvqbvMLnFZVVPjJGRGzGRjZtwgw
VFHFbsFHHSmzQBmsmT
ZNmZCmNHHzzmPPzlbplvhbQh
GDSwldfdvggPfLvQ
ddqrtlnJDJlnjScRmMRCFHTHtFZF
FPvglHSPcpNcFNSHFHNvZjdmbwdbzZtzsHDzbsbj
MMnBLCCWBJCnrCVWCBstTZdZmdTtbDLswTtZ
BMDnRCrnGhPPSgcgpG
nsbgpbdrjMdGqnNRRWWRww
tZZhPzCJhsJBtJPllJBCtCvwwcwwWLvWvwWRThcGcqLq
mlBmZQPZmlppbgMmfssg
RFdZTHFCdvjhgGnFqj
zQLtNQpzNNtNpDtDPWLNMmGfBcjgjlgjhBnvcfnBvfjp
PtmLsPzQVWzWDswCSwHbRZsGZw
nPsfnPsFhTGjqGnmQppG
RZhBbNwbBRZHZSCCHQqSpCpqqm
VMbgNWRWMDfhtFJT
RWhRPDhBHZWgZghRZwZgGJPGdncFdLcdLCjscFcjCjNLLj
mQfSrlfTVqmSVTTTrprfFLqcdLHsLHFnvsFFqnNd
TtQmVHmMrbMWRggRPJZP
TTlCTVTdcpBlcchF
ZLhwSMZhqhtqwqLjFcBvFmvvssGBmmjj
LwSMRtqMHnqhhRZRRtJSVTgggVPdTdrVbQDJgTPW
CGFFWFFVgjfzgVfcJCcgTCcBBWqSqMMBMBShhwMLMwSSMq
fmQnflldltBZqlwqNZpB
dvtnvmtRtsPbzCfTHjHcPzGf
hzshzfshVhthgMmRsFRvFqmm
PDDcZWlWBbplvmRRGtlvqQ
ncjnDjbScnBWZjDVfwjfrrVtwLjzhr
QRWvffVVGfDhNNjzGZLLcGGZ
rgtpSSHpPrHSspvNLFlzTgNLlFglcc
SSpbMHpvmwMQhMBR
dHLtBqPCtPBHNsbRNdNNsZVN
nQwntMwJWhwWjvcjDMlntRsNpgSbNNpglFpVggbSVF
QDhJWwhzJtTqLzCmtT
PSLqTqrCrRvCSJWLdLwdVWdQWL
zNjHQnnHjHznnbDMnMMMdVZcpZZJpZWcdJFZ
BntfgNbzfBtHzgnbbbPPSstlQSSGGrlGsrTT
QpBNsBzztgqVtdmp
jvrhGljRhSTlGGvjwjSwGjRvHVdqLttrMgMbtMMMVmdqqHfV
ChTvTvljmCsQQQnNsQ
CQCNSQHHgCtNHCNHHNDJcBJwLPtJBGhMPPPJwM
zRTqmsdRRzrmdzVRpzPwcjdwwhLjMBMGBBLw
hprmzRmblTzTVTVrlbrmVHNWNnCZFWNNFZlnDFSWgQ
hGGqwwdwMqsRDGRBzlvDzB
LTNTfcCFFFCcNHFFBzRSZRBlzHPSZdvD
nLVTFNfVVLLWnwnwdrdbhnrhrr
hlTpcDTpHmHwDmMbbdMMMGTPdGPR
ZzFqNSQqHvBvzzqjFHtvSGRRMPQsJGJWRGWPMRdRsM
BZjLNqNqzVVHgLVgll
ZHHBzSZPVqghJgSnBhqJRQLRRMvQpwZvfNQRMMMp
ctFCDmdDWmDGNRFMpRlwwQPP
PrsmDmCGjtcmdjGtVqBSjJhnSbHnnghH
QmZHTjmmHRmmdPRvHdVlPdrNNLqWzffbRtqpzfWtWsWNNW
gwMcgnMGFGCjJLqfbtNtzzssCW
DwMFGBwcBFjhBBhcDSJQQVQTPldTvPlVVZQSdQ
NRTGfNffLghStLRR
QlnWsdJWmnbWnVqWbWqHPSpmjgCjtSwhPjgtptLS
JWchnllHqQJzGTZfTcFNDN
VtdtcTVVCRctVdJclCVtpphpPhNGDwNPmThwWmgG
ZjZMFnfBqqMjHZHMzBnzgPGwDmhmhDPfQNGPQGfD
BbgsnFgMgMlVdJtlcVSs
tlBMdBnClhLJnTbgph
PhDDczqDGPqsHGrRGPWHGPzcFJNLTTJZLNbNLfFZgTbffL
sHsmzzrGmPrRDRHqhHwmjBVtllwtdMdBSBtl
QscfZsGsVjVtqGmlzvRMvl
ThJNCHPTDDhHHJTJPHmlSMTtTTlBvlnMSzqn
HhCdrHrCcpmmdVmb
WPPBPvRWzvhWhWzGWtBqBSTLDZhgFSTCDgSgZZDCZs
flbJmMJnjdMqNdfZZrFZZNFZgrrsTZ
nQnqJlJdlQMMbVnVmdMplVnnBwcBPGttzQcvtHcWwWtHRHvB
LLsmpJTWCJmJppCmgHCCLjbFtRFghzjfjcjcZttbRg
SZlMPBdBtQfFSbSF
nPqldlDwlBVnvdLWJVsmVNZCCVmJ
HWvNVtHWJjHJsSgHsHzsDsmf
RwZGPFGMQgzpTGSD
PZMlwwqhFPPZqwFhPwnFbMjWJNNBtWNVJlCJJWJjWWzj
frBSzJDtztfNVGwRzVgGhqsV
MPMmjPWGMMmPCQCcbmRwVhTgVwTTqjvRTLww
cFpcMGFplDHfBHFS
gtjhjLffmgjgmbgVfbNdqFJMJMNbbwrwqq
sWHHPSJsHzTZzTGsCdrqCNNddGdGFGRC
ZpzHHTZWzsSSnBBPsTBnLVcpQfcJcQVQDQfcDfQt
qMPqChqjQPRCMqlBrmGmLbPSsTbSvz
nWNHZFVZZttWpfHsGSbBGTbWBSGmSm
nZfpVfdZdtFHnwVHZtNwZhCJRJhcCdDcQhCqDSSCQc
LlwSlZrftFSMpfLCdltTmmmSDmJqmssDVJBmJB
cRcGGhpvDTmTDgsG
nNPcjpWbNzjRRcWhbzWjvnLMddMLCwtdtMttddtrCdMz
NszSsDCMSDzdZpCMCSMpNszfTvJhlvmlmrTfrhlhHPrmhD
FRWBgRjWwqFWQFBBWjVncjRTvJfvvJvVrHhmVrHhmrdJTh
wnwnqwRGFqdbNNtCGpCp
zgsBvPVVDDrDtDgt
nTHldmJQNTTfflcJNrQlHWpmDDFDFhWpWCLtFbphCm
nTTNMlNfHQZTQPGSzVVZSVPSwr
bPLbtPpwsJhlpnhnnLNNZDWhRNzWQrWWffNr
SczqFdFHSTFjmMSMFVqFGCWWNRrWQQQRZCVWgQQgrZ
dFdzFGHvjmqGMFwwLLsPnvBspnsn
lwJwwmblVdvjbbbJvVnlmjGTTNTLqffpqDJffqGLqDLD
ZtWgPtRMtQRQnTGDQNTTqL
gCztMgWgchHhvwlllbnl
cCwSSCVbqwCCWSbZMmGdtBllWBfdlvdt
jzRsJjhPjnLthJNNpmpvmvvMfGvjQpGv
nPHPFgRHLtCHZrqTcq
dVJwCJGCVrQQGTNtLtGm
hWWgDHBzWWWpZlhWBssLDTDsQTLLtswswL
gPhBHpjwHcljpggwwWqvbFvdCVRqPPnnqVRb
zRRRRNqzpQZNNRRmRcZscQcCDmCTTTDGfTbfGhrTCTrbFF
HMvMtjgtLHVlLVfhCGfrfhJhhrvh
LBgStjnHBjLVgggBgHndnSNNQdNWcQQNGZccwsccdQpw
jLRqmZNGtZtvZvHzPfCvSSzhCP
QbwDVHFrVbDVrDFbzPwSThSfddhWPWzS
rpnFDccHFHtZNmMmRntj
RFVdzzlNtrwSTltb
hHGcqqBcGLQZffHhMwSswSWGrnnbMStC
cgqLBgQgpgbbPbPz
lfcgglhfTvmlBvclbgztnSRtSmttwRJwptWR
FMjDjsdNDjNMQLFFLCMQdtwGGzRwzpGwzdWzzJpGhn
ZQVNsVZMPsVhCQsFCFsHHlqlcBZrHHfBflbHBB
vGGQQdwNCTJfQJHJbM
FFqmzghlzhgqjlFqzZhmhPlRgBDLLRTTcHMbRcJHBLcgRH
qFrPjnhZmqnhZZjhhmpPzZmtvbpwtdvsSCCsGwdNwvwNCp
nrFdSHScdRwvdvRm
NNpPLJJbNbppCvmzbHTbmsTw
fWLHPlPtpMNBgGQgqggQSMGc
BcHtrBcnjflfHslsrnltbTgvMwpWnnWpwwwCwCCRRW
dzGhLSSGDdPNgLLdPWTqWWRMqwRWpvzMMv
VPZZNhhNSSDhLNSLdFZBVgBbjHcgsgfrbBJbfs
VMnWjjWTnNNCzzhblbbjlj
FmHwfFHqpDrJzPQLPLbCDs
GrdFfHqqSmmwHSqHfpdMNTtTtZCMMZtTRggGZR
QRlnlTphqNfqdjZNmd
rDtPmGctFrcgDjJcNjvNJNCcNw
bgGDtgDbBWBSBVlblmVmsRMmLM
CcQTQTrrmfQQhZZBpZpSSZ
JFqSvLlLbWggDvDDFHjsdnshBZpjHBBhBW
FgJqNvLRMlMMDDblrtfrTCStmCVtNttz
MRRbbddqtHbMZbqMHHTFTFgwZglWPfgsZWgW
LCcLjzCNGNcvpvLTFPmzlFsfTgFlgs
NhNGcrCGrsrvcDpvVcSbtHQJQbnQbSdHMtJV
bfMfBFcWFsWZHBWRPQpRqdwmMpmddm
rSShvvVTNVhvVCCvThDlSvCwpGCmRmGQmPwmpLRLRdpq
DhRzzVNVVgSzTFcgtnbHnHbfBB
HsTGHHvlvvGTGlHBvlbZstrVrwNjrjVStwVVZR
PPmgcFJPFcFWmWMgdNtVtQZtDVDVdZZjjR
LLqWnMnmNvlBLCTzCT
qTttLqLvGCQqCDlhml
FJjzrRBrpjRWrCwrBrrwpRbbDzgghSmmNhPQhgNshmDSzSNm
bJBrbFRjBVnWBrRBnHLfHGfdVtvHttcCdT
mTzjGPmPPmPNjNBTvlJRlNJzZqrzrSZZSpcZqpgcgcggFr
QWCwwMwWWhVZFbpQDSpSJS
stMMsWwMwVWtwJTNNPvvRmTsNPsl
gGFFNWMMNFTBlLpGpSll
qvccssdDwDbhMhzwHLppTSHLrdBpBVLV
PhJhzhMJzwDJwhZZtZQJCjgWtFjZ
pGqWfqqGcspGqWqppHprpTrzhCzttMBCtbtJmtJbSBvWBt
QDnVPgVPgDCJBMhmBJgv
NlZwFlnnPLLlFwDlDlnPPFFHTMTdMZjTTcjsqqcsdfGdcp
HLzZfHWWQwpgVHjVHr
JlMlMGGDMtJGdtJhqtlccDgVCSTFFSCSDTggpvFTjSgS
JcGRMlthtlVNMJRfzWsPnQsnnZNZns
zVfvMpsbtQmtBlFWBZ
lLSrlNTNRSFRFhhHRmPR
dnSJjjwJJGwwnzVlvpszvccM
SmlcCrpnrnznGzSBBSfzNbtsQsWZQcFbWctcbbZb
JHgwJPjvdghbbWdDZGNLZb
JjghvvhRwhwJVhHTzmfRfzGSMrzBfnGC
JbCmrbnzmntnVJjbCHJJFQFvqgJgQgqLDQ
NGhhhhPMGhWsSSchWlNsCLBBlLFQCgqvgCFFgQBg
PdcNWWcdGdPssPPNTSNNtzbTwjntzbbVwtZpCVnb
tGNgtsNQHsJmwwzddmQw
hMhhDBwMhDDfCRRBjFDDTTWjdWmrmdWqjlmmmjJz
RSpSSBhppDhRncRLswZLGvtGvNcNtL

1000
2022/inputs/day4.txt Normal file

File diff suppressed because it is too large Load Diff

512
2022/inputs/day5.txt Normal file
View File

@ -0,0 +1,512 @@
[Q] [B] [H]
[F] [W] [D] [Q] [S]
[D] [C] [N] [S] [G] [F]
[R] [D] [L] [C] [N] [Q] [R]
[V] [W] [L] [M] [P] [S] [M] [M]
[J] [B] [F] [P] [B] [B] [P] [F] [F]
[B] [V] [G] [J] [N] [D] [B] [L] [V]
[D] [P] [R] [W] [H] [R] [Z] [W] [S]
1 2 3 4 5 6 7 8 9
move 1 from 4 to 1
move 2 from 4 to 8
move 5 from 9 to 6
move 1 from 1 to 3
move 5 from 8 to 3
move 1 from 1 to 5
move 4 from 3 to 6
move 14 from 6 to 2
move 5 from 4 to 5
move 7 from 7 to 2
move 24 from 2 to 3
move 13 from 3 to 2
move 1 from 7 to 9
move 1 from 9 to 5
move 7 from 2 to 6
move 3 from 1 to 7
move 3 from 6 to 3
move 2 from 7 to 1
move 1 from 7 to 5
move 2 from 2 to 6
move 2 from 1 to 4
move 9 from 5 to 1
move 1 from 6 to 3
move 4 from 5 to 4
move 1 from 2 to 7
move 4 from 6 to 2
move 7 from 2 to 3
move 2 from 2 to 6
move 2 from 2 to 3
move 2 from 5 to 4
move 1 from 7 to 3
move 4 from 6 to 7
move 19 from 3 to 6
move 3 from 7 to 4
move 1 from 7 to 8
move 1 from 8 to 1
move 2 from 1 to 3
move 10 from 3 to 2
move 3 from 3 to 8
move 1 from 3 to 9
move 1 from 9 to 6
move 11 from 6 to 8
move 2 from 3 to 8
move 6 from 4 to 3
move 3 from 4 to 1
move 7 from 2 to 8
move 1 from 3 to 6
move 6 from 8 to 5
move 1 from 4 to 6
move 9 from 6 to 9
move 6 from 3 to 8
move 1 from 3 to 5
move 10 from 1 to 3
move 11 from 8 to 7
move 1 from 3 to 5
move 1 from 1 to 8
move 5 from 9 to 2
move 1 from 6 to 3
move 5 from 3 to 6
move 1 from 3 to 5
move 4 from 6 to 4
move 1 from 5 to 9
move 6 from 2 to 4
move 2 from 2 to 9
move 5 from 5 to 1
move 2 from 1 to 7
move 10 from 8 to 3
move 1 from 8 to 6
move 3 from 6 to 3
move 6 from 4 to 2
move 8 from 3 to 8
move 3 from 4 to 8
move 4 from 2 to 1
move 3 from 5 to 3
move 4 from 7 to 6
move 2 from 9 to 3
move 1 from 2 to 9
move 1 from 2 to 3
move 2 from 4 to 8
move 1 from 7 to 9
move 5 from 7 to 8
move 2 from 7 to 3
move 14 from 3 to 2
move 3 from 9 to 5
move 1 from 3 to 1
move 1 from 7 to 4
move 3 from 9 to 8
move 7 from 8 to 9
move 7 from 2 to 5
move 2 from 3 to 7
move 2 from 7 to 6
move 16 from 8 to 9
move 4 from 6 to 5
move 1 from 2 to 5
move 21 from 9 to 5
move 3 from 9 to 3
move 6 from 1 to 4
move 1 from 1 to 9
move 1 from 1 to 4
move 2 from 6 to 3
move 3 from 4 to 6
move 3 from 4 to 8
move 1 from 9 to 4
move 2 from 4 to 6
move 4 from 3 to 6
move 1 from 3 to 4
move 1 from 4 to 9
move 1 from 9 to 8
move 1 from 8 to 6
move 6 from 2 to 1
move 2 from 8 to 4
move 6 from 1 to 8
move 23 from 5 to 9
move 1 from 4 to 7
move 1 from 7 to 1
move 22 from 9 to 7
move 4 from 8 to 7
move 1 from 5 to 2
move 1 from 1 to 9
move 2 from 8 to 4
move 6 from 6 to 3
move 2 from 9 to 5
move 18 from 7 to 4
move 18 from 4 to 5
move 1 from 2 to 7
move 1 from 8 to 4
move 6 from 7 to 2
move 5 from 4 to 5
move 1 from 3 to 1
move 1 from 7 to 2
move 4 from 3 to 4
move 1 from 3 to 4
move 1 from 1 to 7
move 1 from 5 to 8
move 3 from 4 to 3
move 3 from 3 to 8
move 2 from 8 to 3
move 2 from 4 to 8
move 2 from 7 to 5
move 1 from 7 to 9
move 2 from 3 to 1
move 1 from 9 to 7
move 4 from 2 to 3
move 1 from 8 to 9
move 2 from 1 to 8
move 2 from 2 to 4
move 1 from 9 to 1
move 4 from 6 to 8
move 1 from 2 to 7
move 1 from 4 to 7
move 4 from 8 to 2
move 1 from 4 to 3
move 1 from 1 to 9
move 4 from 8 to 1
move 2 from 2 to 1
move 3 from 3 to 9
move 2 from 7 to 1
move 32 from 5 to 1
move 1 from 8 to 7
move 6 from 5 to 1
move 2 from 7 to 6
move 1 from 9 to 5
move 1 from 3 to 2
move 1 from 5 to 9
move 2 from 6 to 1
move 1 from 3 to 7
move 1 from 9 to 8
move 36 from 1 to 4
move 1 from 8 to 9
move 5 from 4 to 9
move 6 from 9 to 3
move 2 from 2 to 9
move 3 from 1 to 9
move 1 from 3 to 2
move 30 from 4 to 8
move 1 from 7 to 5
move 1 from 3 to 5
move 3 from 3 to 4
move 2 from 8 to 5
move 3 from 9 to 8
move 3 from 9 to 3
move 19 from 8 to 6
move 2 from 3 to 5
move 3 from 4 to 3
move 1 from 4 to 7
move 8 from 1 to 8
move 1 from 3 to 2
move 1 from 7 to 6
move 4 from 5 to 3
move 1 from 1 to 7
move 2 from 5 to 4
move 1 from 9 to 4
move 12 from 6 to 2
move 1 from 7 to 8
move 6 from 2 to 9
move 3 from 6 to 7
move 2 from 7 to 5
move 6 from 2 to 3
move 8 from 3 to 5
move 5 from 6 to 8
move 5 from 3 to 6
move 1 from 9 to 4
move 1 from 9 to 8
move 5 from 5 to 9
move 3 from 4 to 6
move 1 from 4 to 9
move 1 from 7 to 5
move 1 from 3 to 5
move 8 from 9 to 2
move 3 from 9 to 6
move 27 from 8 to 2
move 10 from 6 to 9
move 1 from 6 to 4
move 1 from 4 to 9
move 2 from 5 to 6
move 5 from 5 to 3
move 2 from 6 to 9
move 5 from 3 to 2
move 12 from 9 to 3
move 5 from 3 to 1
move 3 from 1 to 5
move 1 from 9 to 8
move 1 from 5 to 2
move 1 from 2 to 1
move 1 from 1 to 6
move 1 from 5 to 3
move 34 from 2 to 4
move 8 from 3 to 9
move 1 from 6 to 1
move 1 from 8 to 5
move 4 from 2 to 8
move 3 from 8 to 7
move 1 from 7 to 2
move 7 from 9 to 8
move 1 from 9 to 6
move 2 from 5 to 1
move 1 from 6 to 9
move 1 from 9 to 5
move 2 from 2 to 5
move 5 from 8 to 6
move 2 from 8 to 5
move 1 from 1 to 3
move 12 from 4 to 6
move 2 from 7 to 1
move 4 from 1 to 6
move 3 from 2 to 3
move 1 from 8 to 5
move 1 from 2 to 6
move 1 from 1 to 9
move 1 from 9 to 5
move 16 from 4 to 1
move 4 from 3 to 1
move 8 from 1 to 8
move 1 from 4 to 1
move 6 from 5 to 8
move 1 from 5 to 7
move 12 from 6 to 9
move 7 from 1 to 5
move 2 from 1 to 7
move 1 from 7 to 1
move 9 from 9 to 6
move 15 from 6 to 2
move 2 from 9 to 7
move 4 from 4 to 5
move 2 from 2 to 9
move 3 from 7 to 5
move 2 from 1 to 3
move 1 from 7 to 1
move 10 from 2 to 3
move 6 from 8 to 6
move 3 from 9 to 2
move 14 from 5 to 6
move 1 from 8 to 4
move 5 from 8 to 2
move 2 from 2 to 3
move 24 from 6 to 1
move 3 from 1 to 2
move 9 from 2 to 9
move 1 from 4 to 3
move 1 from 4 to 2
move 1 from 8 to 4
move 23 from 1 to 4
move 3 from 2 to 4
move 2 from 1 to 2
move 1 from 8 to 4
move 3 from 3 to 5
move 3 from 3 to 4
move 3 from 5 to 8
move 3 from 2 to 7
move 2 from 3 to 8
move 15 from 4 to 3
move 2 from 4 to 1
move 19 from 3 to 9
move 1 from 7 to 2
move 1 from 2 to 5
move 1 from 5 to 4
move 1 from 7 to 6
move 1 from 7 to 4
move 3 from 8 to 3
move 1 from 8 to 4
move 5 from 3 to 8
move 1 from 3 to 6
move 22 from 9 to 2
move 17 from 2 to 6
move 3 from 9 to 3
move 9 from 4 to 9
move 6 from 4 to 9
move 5 from 2 to 6
move 1 from 4 to 2
move 1 from 4 to 9
move 1 from 1 to 6
move 19 from 9 to 2
move 4 from 8 to 7
move 1 from 1 to 5
move 1 from 5 to 3
move 1 from 8 to 1
move 1 from 8 to 2
move 4 from 3 to 7
move 12 from 6 to 1
move 3 from 7 to 3
move 7 from 2 to 7
move 9 from 2 to 6
move 4 from 2 to 6
move 13 from 1 to 4
move 8 from 6 to 4
move 16 from 4 to 8
move 12 from 7 to 6
move 3 from 8 to 3
move 1 from 1 to 2
move 4 from 3 to 8
move 5 from 8 to 9
move 27 from 6 to 8
move 2 from 3 to 7
move 2 from 2 to 8
move 2 from 7 to 5
move 1 from 5 to 9
move 1 from 5 to 1
move 1 from 6 to 9
move 2 from 6 to 2
move 2 from 2 to 6
move 2 from 9 to 2
move 3 from 4 to 3
move 1 from 1 to 9
move 5 from 9 to 8
move 1 from 9 to 5
move 2 from 2 to 6
move 2 from 4 to 6
move 1 from 3 to 7
move 1 from 5 to 6
move 1 from 6 to 7
move 6 from 6 to 8
move 2 from 7 to 5
move 2 from 3 to 2
move 34 from 8 to 1
move 1 from 5 to 6
move 1 from 5 to 3
move 1 from 6 to 1
move 32 from 1 to 8
move 23 from 8 to 4
move 1 from 2 to 1
move 24 from 8 to 4
move 1 from 3 to 6
move 47 from 4 to 6
move 2 from 6 to 1
move 3 from 1 to 5
move 1 from 2 to 1
move 3 from 5 to 7
move 21 from 6 to 2
move 3 from 7 to 8
move 2 from 1 to 6
move 8 from 6 to 4
move 4 from 8 to 9
move 3 from 2 to 8
move 4 from 4 to 2
move 2 from 2 to 5
move 4 from 9 to 8
move 2 from 1 to 5
move 11 from 6 to 1
move 14 from 2 to 6
move 2 from 4 to 3
move 1 from 2 to 9
move 3 from 2 to 9
move 20 from 6 to 5
move 2 from 4 to 2
move 4 from 9 to 1
move 8 from 8 to 9
move 1 from 6 to 9
move 14 from 5 to 2
move 10 from 2 to 7
move 7 from 9 to 6
move 1 from 6 to 8
move 6 from 2 to 6
move 1 from 2 to 5
move 1 from 3 to 5
move 9 from 6 to 3
move 1 from 5 to 2
move 9 from 7 to 3
move 12 from 3 to 2
move 9 from 5 to 9
move 1 from 8 to 6
move 3 from 3 to 5
move 1 from 7 to 6
move 14 from 2 to 6
move 3 from 9 to 7
move 6 from 1 to 2
move 5 from 1 to 8
move 10 from 6 to 9
move 4 from 5 to 6
move 3 from 2 to 4
move 9 from 9 to 7
move 1 from 8 to 7
move 3 from 9 to 6
move 3 from 3 to 7
move 1 from 5 to 1
move 15 from 7 to 1
move 2 from 8 to 5
move 2 from 5 to 4
move 1 from 7 to 4
move 1 from 3 to 1
move 15 from 6 to 7
move 2 from 4 to 9
move 3 from 4 to 7
move 18 from 1 to 6
move 1 from 8 to 9
move 6 from 9 to 7
move 3 from 6 to 8
move 1 from 1 to 2
move 2 from 9 to 5
move 2 from 2 to 9
move 16 from 6 to 3
move 15 from 3 to 7
move 2 from 8 to 4
move 1 from 3 to 7
move 3 from 4 to 9
move 2 from 1 to 9
move 26 from 7 to 4
move 1 from 2 to 1
move 7 from 9 to 8
move 1 from 2 to 5
move 2 from 5 to 2
move 8 from 7 to 5
move 1 from 7 to 3
move 1 from 3 to 9
move 2 from 2 to 7
move 1 from 6 to 4
move 4 from 8 to 9
move 1 from 1 to 3
move 1 from 5 to 6
move 2 from 5 to 7
move 17 from 4 to 9
move 6 from 4 to 9
move 1 from 3 to 4
move 6 from 7 to 9
move 3 from 5 to 6
move 2 from 7 to 9
move 4 from 8 to 9
move 4 from 6 to 4
move 8 from 4 to 6
move 1 from 8 to 4
move 3 from 5 to 2
move 2 from 4 to 3
move 1 from 7 to 9
move 2 from 3 to 5
move 4 from 6 to 9
move 1 from 6 to 1
move 36 from 9 to 4
move 2 from 5 to 3
move 3 from 2 to 1
move 3 from 1 to 4
move 14 from 4 to 1
move 1 from 8 to 5
move 4 from 1 to 3
move 5 from 9 to 5
move 2 from 5 to 8
move 1 from 8 to 9
move 4 from 9 to 6
move 3 from 5 to 8
move 1 from 5 to 6
move 2 from 1 to 6
move 2 from 9 to 7
move 6 from 6 to 4
move 1 from 1 to 3
move 29 from 4 to 6
move 7 from 3 to 4
move 1 from 8 to 9
move 3 from 1 to 6
move 4 from 1 to 4
move 1 from 8 to 4
move 4 from 4 to 3
move 15 from 6 to 8
move 9 from 4 to 9
move 1 from 7 to 9
move 8 from 8 to 3
move 3 from 6 to 7
move 1 from 1 to 2
move 4 from 7 to 6
move 7 from 8 to 5
move 1 from 8 to 4
move 2 from 5 to 7
move 1 from 2 to 4
move 5 from 6 to 1
move 4 from 3 to 2

1
2022/inputs/day6.txt Normal file
View File

@ -0,0 +1 @@
qfmfhmhjmjggwbbvdvwvlvrrtsrsccwsslvlffjrrtprprjjvmmclmmghhddpvddclctcqtccgbgdbgdgsdgghqhtqtvvptvppwrwprpvrrrhpphththvhhrnnhnlnslnlhnhnhgnhnpnqqsmsgsllprlprrlzzqzffmzztctbtnbtthlttqvqcqmcmpcpbbczzbqbgghcghchhvwvllfrfnnbssfzsszpsplpglpprnpnfnbnhbnbtbzzvbvpbbhjjlzzbtbvbppczppbwppqwwnwlwccglgvgrgmmdwmwrmrppnfnhhhhqthqthqqrhrshhhqbhqqjgjvjllzvzbzhbbpttjsszvzqqtzzmbmddpldpdcdnccrmcrmmpwprplrrqssvddmpdmmwfwwlrljrrdsssmhsspnpffjggqllnzlnlhnnmddfrfpfbbvssjsrrznngcghgchcmhmrrrtzztjzzhchssslsmlmvvpwpqpjqjdddmsdmmtgtmgtglttfbbgrrcprrqffmmjnjttcmczzgbzggthhsttpggrmmgwwnpnqnqvnqvqppmlpmlpmpjpljljmmtpptfppfrppfdpfdppddmdttgzgzzdbzdzhzhnnsqssvmvbbpjjzwwvnwvvzmvzmzpmpttvrvccqddpgdppgmmthmthtggsfsbbvfbvfvhfvhvvpwpddqrqgqhghnnfmfbbwrbrgbgbvgbbdttffrddqbqpqzzmttlhhsqhsqhsqhhlplttpnpsstpthhpfhpfplprrgfrgffjppghgppghgdggjmmcgmccjvvsrvsrrwgrgmrrngrgttvbtbltthrthrttmfffjpfpssncnrngrrltrltlggjgcgllrzzllhwwjwrwgrgsrgrhrphrhhqwqsqmqlmqlmqmqrmrnnwnhwnhwhzwzjwwgbghhsjspszsznzfztfzfpzzlczztctsstctqtfqfqcfqqjrjccttmqqfpfdfnfwnffqbfbblpbpfpcfcwfccblbwwmqwqrrgprpccngnhghpppwmpplcppfrfjjgmmbzbhbcbzzgdgsdsvvqllzlppnfnlnlslsljlppcscqqfjjjwzwppfgfjjsvvsggjbjljpjpzjzrzjrzzfnfpnfpnfpnfnsnggmpggdllpmmrhhdqqppttgqqcsqsjsbjsjrsrqrbqqmbmcbmcbmbfmfvfqqdbdppmrprnrggmjjhnhbhdhbbfcbbcjjdhhwjwmjmssjswscswcwzccbgbqqmqgmmsdsjsbsdbsddvttjpppcqpcqcgqqslqsssczszrzvvrtvvjppswwhnnwlwtwhhwwzfwwpfpddlvvnvnnvlnntjtqjqjzzjttvvbqbhqbhbbbwnwhnwnppdbpdpvddrqdqjjlvlqqdfdhdjhdjdcjcrcjjggfmfvvfllvfvgglzllmhmzmdddfwddqjjqjfqfcfrrstrssptsstllrflfwwgswslwlbwbwjjvhvfvhfhffhsslwsllbnbblccbwwjqwqqdllrdrnrnffcbbqqpnqqdmdndtntvvrjvvsvmvgvnnmjlwgnjcwljgwnrwpqlztwrpmpgqtwlhrcwsrrhqhjhznrtpqfdnzbfqrzwslptdbdcnqvcllpjsfdvmzqwvzbpnmfcfcjnbmhtwhttjgtnczwctpdthhwmzvzrrgsnmbflgmszgsbvghbzgcmcmszgsbfmlmpbdspqlftmqrcjtmvgcrzznlfwjcbmddplsqrfflqnqfsldwhnncczdmfrrrsbjjqsdzrsgbdbwjbslfcqglsqfddhdsrcdrgqfqthgmfjvnfdfgdncfzpvqcpscnpmfgvqbfwszwzgmqvmcrdrwplfshdgqrchmccpqfznbmfvlhdpctlqgjslrwhjfjlmqfblgjrdlnzdtwlpwhnrhrcrpfwqpmjlgrdbgpbljntmbqlblqqqpgrnjtmjqvjpzvsqdpgtchmmwbhtmgcjqdplrtptqcvdjjpqdzsrcjhcwvdcghlwrdhtdfctmqfcjcqhcvvbzgsvlggcrdgqbtznwwmnbgsfrjprqgcmlswftlwpqqqvshdprldrsghmhrqvmqmvglbvzpvtrjbhcvhqmvdtcvsllznqzjmhpnlbhmlzthbwwhhvdtcdfdcdzhnbsrnqqjvzzsvfjhbsdlsbdlqjnlpnhfcjtdppzmphghltztzcdvzwbftbvwhvgmrllqfzrpbltptdtjjqtfwjfmczzgdvclqbsbftgtlhnhrrvbpvdltstdnhqvpvtjhmghptvsfnlspslmfsftzdrwljrgblgmcbmlszmhnlfdtmsrnjqwrfmsnfgpcqgzmlwppffrmbvhnlstfpgzwwmwffrqpdfvrspbczbrclwljgzfhpsrwwpdndfgjwbjtftnjrqvmtmzvjmtlmjhhptmgjvfrlzncmhnmpfcwpjbcpftqfzvmtldqhjpwvzrdnvnwnscgzslvfgjjpcvjshctmmpjbgdwtdjtlmztsbmwrjtmltnlsmwmjnpcgpprnfwcqdldbbqbfmdnvprzqwvntgzdbrsgdpgdjbcblmqpdphmwgvbgwlpblflphvjgjsjfshbjdftcqmsdnrzbgngcvddddjvrndhdcscqqswrnvslfrlvvncqjhzlbhdqhtrlvdsvjsbglhfzfphmzfmzqdvjqdwhjgfdwmzsdmbjzstjddfmfqjhmbdgdbvvhbqgstrzpvhpthhbwljczzrmvgsmbqvzdrmhvvjlmphzjfbmfqvwhtnrlfnfmqnnjvnwjswzshwgljmfjhrwbwgtpdqnqgqdzbssbjfbsgwmfzpfjdrtrnmsdffhnbgnrdlbjzfjrvtjgjgcvvzgllljrcrshczvpfqgnwnjjnhbwgvzwrptrgrdgtczjfzzndsqhqpmtqsvmcncfszsjllzzsjjmwgplpjwlhnhgbhctrttgzqbbcflzqvqgmhgdtlvfpbtncbwsjgnzpmbspcqzzwfplfprqlnbctwwrzpjtpfrmnpvnjrjppqrzjrcmggfmhrstzhmsjllcgjhwrbhcrvdvgmvjqqgmczlmhstmthzphlvrrvqmhjzzfzbhphstflhfjdlwqvzlsszctrdchwjssdfjjfzszlqdtwwthfjdqprpfftgdrpdhhcsdcpjbhdrgzwbgjspmffcmgcjnpmwsqwsvpfwzddlcpvlgpvctrssghndhvdmmmgndcjvhdjwttqphsjpgfbsdczmplfpwpzzjlbhrjptmsshfttnmhzdzmjctbltqjmfnpndqgwjzwdwrgdjdmcbtvjqwjngrtbfrwcttpdvcqtwqndznbchjqcqttrhjpjgwdbwzvwgmdsdfmpdwctvntvnsdmfnznfrsdcllpgpnstrrfrwrfrwnhbclnqhltrcdwqwzzldgbbtzmcvnbzmwcmntqpbscqrpzcjnbgbrzpcrcmdmdfsfgdpmgvwccqjrltrgfvjdgbhjndnmtnjjhzvghscdhnhflwplrqdzrnlnsvrtrdnphgqwjwqcjvtfdfshqdwbsvgrqbdlncjmhdmrlsvdnrhztznczzllsvpqlvwgqjvgvvwgrjcvtjvhrsgbdgvlmmtjbwrnftzphnqslcpggztgsdbjsbdtzwprsbcljpbwjhcrffnvtplcdlgmbtcgbllbdmwhwcllbqstnqqvdbcjrglwbmcfqvlvtpqncbspbphflvvrrsprlhqspfmqrsdtdlftsfzrqwdfffbhccvpfdtlptqzllfsbbrfnhjgwhlfcwmmjgjndcwfhdzvvvrzmwllthwsdmbbsrfrzmqnlnqnjnfpgfvrhsbzhjftmvzrzpqpmlcbnwmbssmvssmmqpvwnsjppdhmnhpntlvqmjnbmtvjnmtbpbzrcfhjfhvztnwrmthbswwthjddjmsdnjmzhhpjdllgscdrgmhfpljfzsmszqsqqgrznddhfmstzdcqpgztgwwqpvrghtmqlgdddlqqwwwtnpldbqtf

934
2022/inputs/day7.txt Normal file
View File

@ -0,0 +1,934 @@
$ cd /
$ ls
dir bgmjrlz
dir bhp
dir cbcwz
169838 fddw.bgw
dir fvhmzqc
dir hqmlnpn
248637 jtwpn.lnr
319470 lnmrrht.zbn
99548 pqpslbtn
dir rbztmqjn
102720 rqpt
dir vfrtt
$ cd bgmjrlz
$ ls
dir dhqzgdl
dir djtchhmw
dir tvq
$ cd dhqzgdl
$ ls
dir jjshzrhd
dir jlfz
dir vqvvwgt
dir zcqbt
$ cd jjshzrhd
$ ls
dir jjshzrhd
$ cd jjshzrhd
$ ls
81645 gfhfplmm
$ cd ..
$ cd ..
$ cd jlfz
$ ls
dir hgzg
189290 wgdffcr
$ cd hgzg
$ ls
121740 vmmcdr
$ cd ..
$ cd ..
$ cd vqvvwgt
$ ls
142209 djtchhmw.tgr
$ cd ..
$ cd zcqbt
$ ls
204760 mlsfnt
$ cd ..
$ cd ..
$ cd djtchhmw
$ ls
287664 cgjmd.vrb
307590 ghrntg.zsw
$ cd ..
$ cd tvq
$ ls
270869 jjshzrhd.lzb
$ cd ..
$ cd ..
$ cd bhp
$ ls
231648 gmj.srn
260008 hrtbfww.gts
287048 jgqjszsr
dir mps
dir sjt
dir zvbwsw
$ cd mps
$ ls
dir djtchhmw
153066 dnpv.vff
185096 slpz.phm
$ cd djtchhmw
$ ls
310736 ddhfvv.lzl
234532 hghrcqfd.hpn
276144 hrtbfww.gts
$ cd ..
$ cd ..
$ cd sjt
$ ls
dir btgrv
dir csn
dir ddhfvv
dir dfbjz
dir djtchhmw
dir qdms
45629 qgj.jjs
dir rdqbdtdh
235189 wcrsz.ccc
$ cd btgrv
$ ls
dir rnhq
$ cd rnhq
$ ls
205285 vmmcdr
$ cd ..
$ cd ..
$ cd csn
$ ls
234221 nhw.rml
$ cd ..
$ cd ddhfvv
$ ls
dir glbf
56038 gvbzwds.cff
dir qtc
308363 rdzj.sqr
dir vlrs
dir vzhm
dir wwghpsds
287177 zznmdh.nhn
$ cd glbf
$ ls
128210 btgrv.zqp
205284 dnt.jrd
135774 pmnbbb
$ cd ..
$ cd qtc
$ ls
292185 zsqz
$ cd ..
$ cd vlrs
$ ls
dir btgrv
dir jlbjlzzs
dir lnqcr
$ cd btgrv
$ ls
277089 bcpdvwqs.dmw
262922 hghrcqfd.hpn
$ cd ..
$ cd jlbjlzzs
$ ls
95245 vmmcdr
$ cd ..
$ cd lnqcr
$ ls
172326 qsrcb.fpd
$ cd ..
$ cd ..
$ cd vzhm
$ ls
203623 fvhmzqc.dmm
$ cd ..
$ cd wwghpsds
$ ls
60280 vmmcdr
$ cd ..
$ cd ..
$ cd dfbjz
$ ls
262505 blc.lhp
24423 ddhfvv
296606 fvhmzqc.ptz
98808 hghrcqfd.hpn
$ cd ..
$ cd djtchhmw
$ ls
278654 hghrcqfd.hpn
$ cd ..
$ cd qdms
$ ls
dir djtchhmw
154536 jjshzrhd.stf
dir sgh
$ cd djtchhmw
$ ls
246903 hghrcqfd.hpn
$ cd ..
$ cd sgh
$ ls
265535 btgrv.frs
299957 hffpl.qzw
$ cd ..
$ cd ..
$ cd rdqbdtdh
$ ls
dir btgrv
dir djtchhmw
182591 jjshzrhd
22987 jjshzrhd.qwp
dir jmc
185957 mthrpb.qmm
$ cd btgrv
$ ls
dir btgrv
9328 ddhfvv
7652 hghrcqfd.hpn
53498 wgdffcr
$ cd btgrv
$ ls
dir czgrcv
171099 hrtbfww.gts
22232 lqwvnz
dir mfhbd
193089 scld.jpg
75876 vmmcdr
226425 wgdffcr
$ cd czgrcv
$ ls
276374 lfctmv.dbp
268014 mpvb.rfg
180548 wgdffcr
$ cd ..
$ cd mfhbd
$ ls
67713 fvhmzqc.llz
$ cd ..
$ cd ..
$ cd ..
$ cd djtchhmw
$ ls
3290 ddhfvv.vsl
dir fvhmzqc
168684 hghrcqfd.hpn
dir jmqwll
80802 qmfhm.gtf
282318 rzn.chg
148018 wgdffcr
$ cd fvhmzqc
$ ls
dir bjpvn
87780 hghrcqfd.hpn
209282 vtv.wbt
$ cd bjpvn
$ ls
126911 rcq
$ cd ..
$ cd ..
$ cd jmqwll
$ ls
240811 vmmcdr
$ cd ..
$ cd ..
$ cd jmc
$ ls
320199 btgrv.ntz
11100 jwcvvfnb.grd
145758 wgdffcr
$ cd ..
$ cd ..
$ cd ..
$ cd zvbwsw
$ ls
dir fvhmzqc
$ cd fvhmzqc
$ ls
169680 rlnvr.bwd
$ cd ..
$ cd ..
$ cd ..
$ cd cbcwz
$ ls
82379 hrtbfww.gts
$ cd ..
$ cd fvhmzqc
$ ls
140571 hrtbfww.gts
dir hvnt
dir jbc
dir mzzfssn
dir npdccs
dir wrzzq
$ cd hvnt
$ ls
102394 hrtbfww.gts
29683 hsgstppl
dir rmrc
134244 rsjrj.gbr
231284 wqhndr.hlr
207733 wtjz
$ cd rmrc
$ ls
dir btgrv
259148 hrjqjdqq.tvm
$ cd btgrv
$ ls
240410 tqv
$ cd ..
$ cd ..
$ cd ..
$ cd jbc
$ ls
140479 fvhmzqc.pvm
$ cd ..
$ cd mzzfssn
$ ls
78226 brtbv.gtp
61906 btgrv
168944 nqll
111153 qmrsgwh
$ cd ..
$ cd npdccs
$ ls
65889 wfpvp.wsg
$ cd ..
$ cd wrzzq
$ ls
dir btgrv
82867 djtchhmw
dir dzzv
dir lpz
dir mqqlhnvh
$ cd btgrv
$ ls
dir dppvz
dir glmtpswv
dir qfgqfzm
dir qhb
$ cd dppvz
$ ls
296857 hrtbfww.gts
11272 jjshzrhd
$ cd ..
$ cd glmtpswv
$ ls
268244 cgntm.tcf
dir jjshzrhd
dir lqnb
128070 tzctcnq.gwr
110659 wnrblpbs.wqf
$ cd jjshzrhd
$ ls
dir cwdwh
173945 fzstdt.pdn
224834 nnvnqrh.zld
dir tfzp
$ cd cwdwh
$ ls
dir btgrv
315172 ddhfvv.vdc
109603 dsqjgv
dir hnp
284882 mnsb.cdh
247067 qtntt.jhn
200809 tvtbfn
$ cd btgrv
$ ls
74389 ndfzlfzf.lth
$ cd ..
$ cd hnp
$ ls
242535 ddhfvv
256542 nslg.qcc
143475 wbzjdrhd.gbr
$ cd ..
$ cd ..
$ cd tfzp
$ ls
46652 djtchhmw
167857 rtqcpsd
$ cd ..
$ cd ..
$ cd lqnb
$ ls
186160 ddhfvv
287136 wgdffcr
$ cd ..
$ cd ..
$ cd qfgqfzm
$ ls
212359 btgrv.hjj
$ cd ..
$ cd qhb
$ ls
15584 djtchhmw
$ cd ..
$ cd ..
$ cd dzzv
$ ls
141830 hrtbfww.gts
$ cd ..
$ cd lpz
$ ls
dir djtchhmw
14679 jjshzrhd
dir pbcrz
$ cd djtchhmw
$ ls
dir fvhmzqc
250329 hnhzlwrm.bqp
dir jjshzrhd
262196 jjshzrhd.gnz
dir qpc
dir svmmjlr
dir tddmdzd
236002 vmmcdr
101814 vwpnztc
$ cd fvhmzqc
$ ls
44990 fvhmzqc.ngb
235856 hlbhsz
219184 hrtbfww.gts
$ cd ..
$ cd jjshzrhd
$ ls
190311 clbzz
$ cd ..
$ cd qpc
$ ls
217404 jjshzrhd.nwv
142286 pgjgsh.sdd
$ cd ..
$ cd svmmjlr
$ ls
82636 cvbhsch
287045 fvhmzqc.rjh
48607 vmmcdr
$ cd ..
$ cd tddmdzd
$ ls
dir cjfjmjnh
dir fjwwn
7777 hghrcqfd.hpn
220410 tgfqgcc.ngd
$ cd cjfjmjnh
$ ls
dir gcs
$ cd gcs
$ ls
210998 nzzjl
79843 zltwtmnv
$ cd ..
$ cd ..
$ cd fjwwn
$ ls
17068 rht.hhw
$ cd ..
$ cd ..
$ cd ..
$ cd pbcrz
$ ls
41401 tzqjl.bhn
144639 zqght
$ cd ..
$ cd ..
$ cd mqqlhnvh
$ ls
dir bmcqbq
dir cqh
dir jjshzrhd
dir lbvrm
dir lwmbvsjj
dir rrcnhbn
67325 tfcl.npl
$ cd bmcqbq
$ ls
dir bwjhtvcm
dir wzmg
$ cd bwjhtvcm
$ ls
156583 qdjmmdq
$ cd ..
$ cd wzmg
$ ls
dir ddhfvv
dir tlhc
$ cd ddhfvv
$ ls
dir jjshzrhd
$ cd jjshzrhd
$ ls
202499 ddhfvv
$ cd ..
$ cd ..
$ cd tlhc
$ ls
dir lbpmtft
$ cd lbpmtft
$ ls
43196 lthlvv
$ cd ..
$ cd ..
$ cd ..
$ cd ..
$ cd cqh
$ ls
dir btgrv
35483 djtchhmw
318895 sfqdbd
62778 twdpcn.rzg
dir vwdqmtwf
$ cd btgrv
$ ls
dir hrbjmbf
dir npffrswd
$ cd hrbjmbf
$ ls
196766 crw.dht
$ cd ..
$ cd npffrswd
$ ls
dir jjshzrhd
$ cd jjshzrhd
$ ls
161401 dsqqh.pqg
$ cd ..
$ cd ..
$ cd ..
$ cd vwdqmtwf
$ ls
299604 qrdcnbt.wmh
$ cd ..
$ cd ..
$ cd jjshzrhd
$ ls
62584 dzfvzrf.tmc
255105 hwfh.tfd
$ cd ..
$ cd lbvrm
$ ls
dir btgrv
dir pvnbdwjj
21599 tjfd.jzf
315782 wgdffcr
dir znz
$ cd btgrv
$ ls
dir qjbhvdm
$ cd qjbhvdm
$ ls
115711 mjhcwn
$ cd ..
$ cd ..
$ cd pvnbdwjj
$ ls
156828 hrtbfww.gts
dir jjshzrhd
208415 vmmcdr
$ cd jjshzrhd
$ ls
131751 hwfh.tfd
$ cd ..
$ cd ..
$ cd znz
$ ls
dir ddhfvv
150828 gpcpnwj.fzv
119331 hrtbfww.gts
263285 nntqssp.hqg
dir pwtbr
236806 vmmcdr
$ cd ddhfvv
$ ls
265355 ddhfvv.bpb
$ cd ..
$ cd pwtbr
$ ls
212361 jjshzrhd.nmh
$ cd ..
$ cd ..
$ cd ..
$ cd lwmbvsjj
$ ls
275264 bvbq.rdf
dir ddhfvv
257257 fsql
210469 jmvchpn
57627 lrnhn
270278 vmmcdr
dir vrqmtl
$ cd ddhfvv
$ ls
244640 nhdztzsg
$ cd ..
$ cd vrqmtl
$ ls
123207 btgrv.qsg
152242 qsqt
259711 scvzvns.vvh
$ cd ..
$ cd ..
$ cd rrcnhbn
$ ls
dir jjshzrhd
$ cd jjshzrhd
$ ls
63581 btgrv.pbj
$ cd ..
$ cd ..
$ cd ..
$ cd ..
$ cd ..
$ cd hqmlnpn
$ ls
dir djtchhmw
dir dlqjbqbr
240226 fdmchrth
dir fvhmzqc
39519 hvtvcdv
140559 hwfh.tfd
243880 lvcwjnzb.ptf
dir nppp
162576 rmqmd.wdt
dir rscgvrdt
dir sdcbr
$ cd djtchhmw
$ ls
33004 ddhfvv.ghw
$ cd ..
$ cd dlqjbqbr
$ ls
dir fvhmzqc
dir jjshzrhd
dir ncwldt
dir wfw
$ cd fvhmzqc
$ ls
dir brfl
dir ccnlzrb
dir cjtl
dir dfvt
123279 fvhmzqc.qfp
dir ppshjv
dir smprwhmg
$ cd brfl
$ ls
291222 djtchhmw.grj
102020 hghrcqfd.hpn
197538 hwfh.tfd
82351 qqq.cqf
254314 ztthgs
$ cd ..
$ cd ccnlzrb
$ ls
dir rzmdmq
$ cd rzmdmq
$ ls
265088 rqtm.zmv
$ cd ..
$ cd ..
$ cd cjtl
$ ls
107485 djtchhmw.phc
$ cd ..
$ cd dfvt
$ ls
114165 dts.rlc
201057 frljlqzr.clp
$ cd ..
$ cd ppshjv
$ ls
305733 djtchhmw.ntn
$ cd ..
$ cd smprwhmg
$ ls
76792 ddhfvv
$ cd ..
$ cd ..
$ cd jjshzrhd
$ ls
19740 fvhmzqc
dir lqgsw
dir lsmccpj
17490 mlzznrc.mst
$ cd lqgsw
$ ls
297439 crqjmhrb.grs
$ cd ..
$ cd lsmccpj
$ ls
89758 btgrv.cpt
49280 ddhfvv.drt
dir gclrgz
dir gnrztgj
275064 jjshzrhd.jzv
98597 nbscl.wvs
225844 vmmcdr
$ cd gclrgz
$ ls
63611 djtchhmw.vfn
156340 gbhsz
$ cd ..
$ cd gnrztgj
$ ls
23195 btgrv
287815 fhthsd
$ cd ..
$ cd ..
$ cd ..
$ cd ncwldt
$ ls
70881 vmwllc.fbf
$ cd ..
$ cd wfw
$ ls
309325 ddhfvv.pqm
201372 fvhmzqc.rfl
143184 hghrcqfd.hpn
51325 vlq.wgr
$ cd ..
$ cd ..
$ cd fvhmzqc
$ ls
234497 ddhfvv.wlg
dir fvhmzqc
197961 fzbsr
dir jsfbvwb
$ cd fvhmzqc
$ ls
208299 bgpncvh.jhl
$ cd ..
$ cd jsfbvwb
$ ls
175184 ddhfvv.tpq
85214 djtchhmw.btf
2012 ttbpmsg.mlb
$ cd ..
$ cd ..
$ cd nppp
$ ls
223933 wgdffcr
$ cd ..
$ cd rscgvrdt
$ ls
207388 glgbngv.lcd
$ cd ..
$ cd sdcbr
$ ls
277288 btgrv.phv
49684 ddhfvv
195222 dntzwh
dir frcj
206408 gfttdcnq
147023 hrtbfww.gts
dir tcwpvrr
$ cd frcj
$ ls
37309 ctpjbmh
54747 hwfh.tfd
151065 phvllpq.gvh
$ cd ..
$ cd tcwpvrr
$ ls
63500 chsgcw.frm
dir ltwvvrv
113779 mgdqjg
177222 vzgpfpq.qln
$ cd ltwvvrv
$ ls
102472 vmmcdr
$ cd ..
$ cd ..
$ cd ..
$ cd ..
$ cd rbztmqjn
$ ls
216106 fnzwzdb.wrc
$ cd ..
$ cd vfrtt
$ ls
dir ddhfvv
dir ftrqt
dir fvhmzqc
186081 hwfh.tfd
dir jjshzrhd
dir mzfq
dir nhzz
dir zblsznh
$ cd ddhfvv
$ ls
28659 glfpm.hnp
274896 hrtbfww.gts
dir lwblgr
dir qmc
dir thwccb
dir tmlwvtmc
228636 zrn.ftn
$ cd lwblgr
$ ls
237410 djtchhmw.fjz
209100 hghrcqfd.hpn
317411 nsgtmddt.jvj
30033 pbhc.blz
8818 pwf.vjv
$ cd ..
$ cd qmc
$ ls
249328 cwftvdws
41124 pwmzz
99884 qbvpslt
$ cd ..
$ cd thwccb
$ ls
dir ddhfvv
$ cd ddhfvv
$ ls
49107 fvhmzqc.slp
$ cd ..
$ cd ..
$ cd tmlwvtmc
$ ls
dir djtchhmw
115288 gfdzqrb
248419 hrtbfww.gts
$ cd djtchhmw
$ ls
14211 qffwlmvm.fhp
dir tzbd
67495 wwttgflg.rcl
$ cd tzbd
$ ls
278463 btgrv.ldc
$ cd ..
$ cd ..
$ cd ..
$ cd ..
$ cd ftrqt
$ ls
95545 ddhfvv
180375 hwfh.tfd
$ cd ..
$ cd fvhmzqc
$ ls
161318 gtwj
$ cd ..
$ cd jjshzrhd
$ ls
91626 prmznc.gwp
dir wltvrv
$ cd wltvrv
$ ls
299813 hrtbfww.gts
$ cd ..
$ cd ..
$ cd mzfq
$ ls
101218 jjshzrhd.nwz
200289 njwfbc.bhb
$ cd ..
$ cd nhzz
$ ls
225881 hwfh.tfd
210133 mlb.wrt
$ cd ..
$ cd zblsznh
$ ls
dir fvhmzqc
214252 hrtbfww.gts
250855 qbjphgwn.vvj
dir tdpv
173807 wgdffcr
$ cd fvhmzqc
$ ls
dir djtchhmw
dir fsqdcwr
dir jjshzrhd
dir zljhz
$ cd djtchhmw
$ ls
dir sdrjlqqm
$ cd sdrjlqqm
$ ls
91244 fvhmzqc
$ cd ..
$ cd ..
$ cd fsqdcwr
$ ls
dir ddhfvv
dir nhmhgzt
dir pdhbd
$ cd ddhfvv
$ ls
199548 qwc
$ cd ..
$ cd nhmhgzt
$ ls
106393 ddhfvv.sjg
$ cd ..
$ cd pdhbd
$ ls
207023 hngmj.qls
$ cd ..
$ cd ..
$ cd jjshzrhd
$ ls
84955 vmmcdr
$ cd ..
$ cd zljhz
$ ls
dir dmqmc
dir jnlgsgn
dir mhtmt
dir mqtmpht
$ cd dmqmc
$ ls
dir djtchhmw
$ cd djtchhmw
$ ls
166369 hrtbfww.gts
$ cd ..
$ cd ..
$ cd jnlgsgn
$ ls
289581 vrbqvt.bgn
$ cd ..
$ cd mhtmt
$ ls
182104 hrtbfww.gts
285446 spgtjm.lhj
$ cd ..
$ cd mqtmpht
$ ls
179017 bgfgtqr.snr
dir czqj
dir gdc
104624 jjshzrhd
314246 mhvzncnt.vjd
$ cd czqj
$ ls
69494 hft.fsp
$ cd ..
$ cd gdc
$ ls
84423 bhqnfj.cts
$ cd ..
$ cd ..
$ cd ..
$ cd ..
$ cd tdpv
$ ls
dir frgfgd
dir sggm
274423 zzfsmdf
$ cd frgfgd
$ ls
205662 vmmcdr
$ cd ..
$ cd sggm
$ ls
260269 wzpjsjnq.nvt

99
2022/inputs/day8.txt Normal file
View File

@ -0,0 +1,99 @@
020110220332333020110144320304042020444223003535441353331002333431100300241023221210123003331021020
002120010112022233203323334422340102033151553341235324543343233301202102130210343113312320222102020
000000000301021002423224442341031145215244543444223314545524515335404222310244314423023331200102012
011200302010212334422213334343335452314532352111122533515334412241512412033340322004232020212310011
110111200102310120411101020333232255345143342245212323552344535253214434143032323213200301101020121
122001020113011314043121413025543341512335111452355331355351515421515411500421204113413212021112302
011210211003201420103123304513544114145311452334355144111521441452154223512022101102111221311323311
011030200312240341224434214241313322323544154242345656634321531531424124544551344224331443202111303
031023120224010220144244342511241334331166432443322363352643453525244443222142533014331212133113031
331033331100013013431114214253543323143222523423236646456363626622312534521454454123324132323233200
313320023430241044213221132131122135436564345625426422255326234363243521151144414344130023210131130
002203011410101343345413454143416333665335233566235623536644652644522345535525153521230411343303211
022030323311323124542521154345356626352343324652424464566645425223224521453553252234321033403323130
331222243010032043452454232565665256426536435254566436633323343652534544214412242551144312310221231
231133233004211422411531255443363333555345434532475762623642433466363266634413551244254134333243030
020231113200002214145443133533534653326664654474363645366343345466265644554325342415122332200024311
311032340032414323451542554464466352256347635357637447736577667463426532442564245132242343241314212
210342413212232542421452232234546643373633347344743377376553465333423522425436534352355150302110320
012302042023135125251364365232626547463576733637455663764376436734352545425434331543241124042312202
304042410233125532432523224245663443763753734647533535565636563665334542556665554245524241400402122
100324144335411111343624365526556753335435457754653754663647544353454443256623466532421524442220212
004310002315421423634565264237567445665436743333467647547754434765353667542365233361541321530411122
340100133133254351662534562377644656735477678648447854646765556636735646456562322345353223545130204
223422234555541234336653556365464346366386775667444744567758637737757667635354324626442355153142402
301202352352311332364654446567354376644665887886878854847858588356564773766244445222614543212440041
121010254322255546522625235356663453785775455846758588786788567566653645763532436352663334521520342
223123122512444365553626454767563488464886467858877655766685458675437556363673526236645213411512224
003314511142456453664565476333555654845565878476575468776548666885476777366354622652365442341232330
100434351354142623236353735657745766665557455465675844665578767675874476556574642555262344222545124
310035122251134332246455666547787878577677667587668567788744875844888844364453536232254344234442004
332355524421462334544344655646458867688886798865795569865997666688465755335745555656646243433122421
212252432545222565265377376368574784887787696558698987968675547855656555445333366624445325141553342
113535121253534442546646364347455675758878676575695576785998796454646647555637657565266546254424513
023531155256556443573534665476784478579889966685965558767695667786588646763565366352565623135242132
332235311465633455637577656876574774599858977857599877979855878694546488485435736564352255345534352
423312331346353345545646578646466549968669789766955768696578957665488458568376747735452426221223133
042131555255526335474354376567744577697576655686887997959968659596857774864465577464334245541411144
314335533542324633457667677854784879668896688676989899996875778858675674784535777333543532331142411
342431321343652634443346854886679789759856968779866777899677797959996774647753365556465426225312415
443122331352464374355445874586585857875568898788666678776787986756859447544446666763365552244452322
434332122456323647344556476668759666569568769987679766689798887678765548587477474536465533643451422
012515214225433447464677777487776597697976998888987789798887796967785955887765466437333665342324523
151212435544622335634548655777875966867886867777679699887698988956977857868655457465635544364542154
425332155643342656676678888575989888788767888899689899798688796666757955465858667777362363434424542
531532414223243445466348848575895777968779899997887798776667989655588765447757447347342252524115215
155245334655555376575664568856876978978787888977789987998877778796686666588544843473375333466131323
442223263655353573545578848875879796997899897789887987979686977788898887848487563664644353624212355
532342436423523433743374566649565796978689677778887988977986779775985585775684847364464225436344143
144131162643455446377457566657777998676869667898877798979888978868889578745676553337663625625354412
212531125562654464546354657756555595879978788779777999979988869895856856488587466676673534564554215
515521136425625643733788668547967896969879989899779977888986996776697776777887634766746536654352314
533115456346557773554457648785576555967877979777897997977979879979889786544548474557775226255314122
432554142445363766476368787846679896977899887779797978979969889696765986666844737665565256236231155
125253442625345476646468778468579567787976888987879797899978977695756855477657433457362446432521533
451335344244435635354545558745856999567779868887799878899867977959975677866558447464563253543641554
412221312464362643575387865576575778679997969899879799897898997777656968646646747476434353234412443
132123436534443354553586484485777568678779897878779989966877968659558598445764456573762542646254544
024143156436353736354736885476858987768978898698789976987668878886568974574565737457544455543452243
413135313643263775675578866878568599957868689889887898688888897699957964455656556464353643525222353
151155234625524455454576866886566769799886776697778986968676996687578554546778475347663665445441542
225335432336665664467554464786765996688599897886876679899878795577796866847588643664352344525425543
231314414363454365656445447648785668665699968677877867679686575989979554888874435546345632362455211
215225154624264466667536475884866766856799777898688869799678789658958655666655664763723652345235254
035354151466424636347656474544888889966575676978876877797665689589954588444647355553546242434541533
001253252266442433343367457848868577696576876956987767987878766766685545864636355333223636351531525
432114153244234344474473336455665467595685659677769775776598955788485844764764774633253355345153344
440231335123622442356777766866685464699576999777998779679677676798556674878735743562224245652132511
321533313113424533355576556587855784598797699998756887876998858868457756543476743664332364153212141
003415211213442534357575744467674686668987887956977567898997789587764784753377657636326255155213240
224445525333436434526743474634674544887785577959758998579798555487687877644644777665225554533252422
114025431113445462556535777346657775747764689775588768859877487468477864653336547436625221413353402
444431445545324552322733365535555774656466544687955795855665775645668663457547655566226341423452434
410445115125126462226236353755455888548674587788447578688475766447586446763443644432535242233435244
124340412535436432636663557555763744747854587474866557668648548584743443577534342355356535325312231
200313132541126432532542747437536486654767558545587875558487658465577773437664544545354413212211212
101333454545223643623655465756576356785656755457885765456674785763465474656725224222541315314114031
131233142323341366245232435554365765545574774767785475776848668453355554474332533326544433554514201
321411402434455156645353526473756763444567846554465464446465455445745336435566265254512531525210112
030131034355454454644464565464475577344753366858566476585577545346763733342656446563454444451042420
123233024345514531322525463344645673755773347575544437475656346736346777342352464432215452454013411
014322323421235432556233655455544546633674634474456664346664375533773475562242423541545331424443423
103044012005453352356343445634325645434337637364655565435774676736733553262634342435541343244030000
320224321434222311444445623462256346445463567453434633465443337646352226626622452524224345304403330
212420324020443535541356556336654222753455556557453353546474577342535554563532343321131244211234443
122201202000423112251512562424625443344753367744337643545467743645523543344535431154212330403302410
302200224224202341324112146243633653523426575646533673677763345633345645554351214352331400423031333
123001320330302415435532414224224226352235334353577574436324344226425624263133551342153034141032032
213131040401103044255424155325562642646633364323565455323646566426224245451451423431324433130343033
231211142003310021532152553311226325626362465244625533422332633634454451545253314415220400420413203
312320130422410131322514243524545532465435666446335525623552365342455442353243151122403024303312021
133332233112042420435241253424143243654366264342464546256332442465235435334432132240241304411322221
333302213333240222002452421142454145262355663455246362444253326353144344554554324413300122011222021
202310030210410440001115535553444131333333663342464256255352255253344353414423520402213424030101331
020120023231001430421410113431542415212332151336254445313532121145524443121220343020012020230032230
210023323121322121303302233233245321224455333332343322323215223451525532222223304043001030230132022
002222021003231011234340303045243412535411232132142332533521354111141433134004443142111110122121100
022122131333022231003311233440122445251415343142141523345254553214425533033042143220401300010213100
122110132221332212341431023220242412121544355542132225542445544553234342030402442141111321103231211
122021200131211021314010312001241211235253115315252213451111223452204220130001212341202130012001221

2000
2022/inputs/day9.txt Normal file

File diff suppressed because it is too large Load Diff

14
2022/tests/day1.txt Normal file
View File

@ -0,0 +1,14 @@
1000
2000
3000
4000
5000
6000
7000
8000
9000
10000

146
2022/tests/day10.txt Normal file
View File

@ -0,0 +1,146 @@
addx 15
addx -11
addx 6
addx -3
addx 5
addx -1
addx -8
addx 13
addx 4
noop
addx -1
addx 5
addx -1
addx 5
addx -1
addx 5
addx -1
addx 5
addx -1
addx -35
addx 1
addx 24
addx -19
addx 1
addx 16
addx -11
noop
noop
addx 21
addx -15
noop
noop
addx -3
addx 9
addx 1
addx -3
addx 8
addx 1
addx 5
noop
noop
noop
noop
noop
addx -36
noop
addx 1
addx 7
noop
noop
noop
addx 2
addx 6
noop
noop
noop
noop
noop
addx 1
noop
noop
addx 7
addx 1
noop
addx -13
addx 13
addx 7
noop
addx 1
addx -33
noop
noop
noop
addx 2
noop
noop
noop
addx 8
noop
addx -1
addx 2
addx 1
noop
addx 17
addx -9
addx 1
addx 1
addx -3
addx 11
noop
noop
addx 1
noop
addx 1
noop
noop
addx -13
addx -19
addx 1
addx 3
addx 26
addx -30
addx 12
addx -1
addx 3
addx 1
noop
noop
noop
addx -9
addx 18
addx 1
addx 2
noop
noop
addx 9
noop
noop
noop
addx -1
addx 2
addx -37
addx 1
addx 3
noop
addx 15
addx -21
addx 22
addx -6
addx 1
noop
addx 2
addx 1
noop
addx -10
noop
noop
addx 20
addx 1
addx 2
addx 2
addx -6
addx -11
noop
noop
noop

27
2022/tests/day11.txt Normal file
View File

@ -0,0 +1,27 @@
Monkey 0:
Starting items: 79, 98
Operation: new = old * 19
Test: divisible by 23
If true: throw to monkey 2
If false: throw to monkey 3
Monkey 1:
Starting items: 54, 65, 75, 74
Operation: new = old + 6
Test: divisible by 19
If true: throw to monkey 2
If false: throw to monkey 0
Monkey 2:
Starting items: 79, 60, 97
Operation: new = old * old
Test: divisible by 13
If true: throw to monkey 1
If false: throw to monkey 3
Monkey 3:
Starting items: 74
Operation: new = old + 3
Test: divisible by 17
If true: throw to monkey 0
If false: throw to monkey 1

5
2022/tests/day12.txt Normal file
View File

@ -0,0 +1,5 @@
Sabqponm
abcryxxl
accszExk
acctuvwj
abdefghi

23
2022/tests/day13.txt Normal file
View File

@ -0,0 +1,23 @@
[1,1,3,1,1]
[1,1,5,1,1]
[[1],[2,3,4]]
[[1],4]
[9]
[[8,7,6]]
[[4,4],4,4]
[[4,4],4,4,4]
[7,7,7,7]
[7,7,7]
[]
[3]
[[[]]]
[[]]
[1,[2,[3,[4,[5,6,7]]]],8,9]
[1,[2,[3,[4,[5,6,0]]]],8,9]

2
2022/tests/day14.txt Normal file
View File

@ -0,0 +1,2 @@
498,4 -> 498,6 -> 496,6
503,4 -> 502,4 -> 502,9 -> 494,9

14
2022/tests/day15.txt Normal file
View File

@ -0,0 +1,14 @@
Sensor at x=2, y=18: closest beacon is at x=-2, y=15
Sensor at x=9, y=16: closest beacon is at x=10, y=16
Sensor at x=13, y=2: closest beacon is at x=15, y=3
Sensor at x=12, y=14: closest beacon is at x=10, y=16
Sensor at x=10, y=20: closest beacon is at x=10, y=16
Sensor at x=14, y=17: closest beacon is at x=10, y=16
Sensor at x=8, y=7: closest beacon is at x=2, y=10
Sensor at x=2, y=0: closest beacon is at x=2, y=10
Sensor at x=0, y=11: closest beacon is at x=2, y=10
Sensor at x=20, y=14: closest beacon is at x=25, y=17
Sensor at x=17, y=20: closest beacon is at x=21, y=22
Sensor at x=16, y=7: closest beacon is at x=15, y=3
Sensor at x=14, y=3: closest beacon is at x=15, y=3
Sensor at x=20, y=1: closest beacon is at x=15, y=3

10
2022/tests/day16.txt Normal file
View File

@ -0,0 +1,10 @@
Valve AA has flow rate=0; tunnels lead to valves DD, II, BB
Valve BB has flow rate=13; tunnels lead to valves CC, AA
Valve CC has flow rate=2; tunnels lead to valves DD, BB
Valve DD has flow rate=20; tunnels lead to valves CC, AA, EE
Valve EE has flow rate=3; tunnels lead to valves FF, DD
Valve FF has flow rate=0; tunnels lead to valves EE, GG
Valve GG has flow rate=0; tunnels lead to valves FF, HH
Valve HH has flow rate=22; tunnel leads to valve GG
Valve II has flow rate=0; tunnels lead to valves AA, JJ
Valve JJ has flow rate=21; tunnel leads to valve II

1
2022/tests/day17.txt Normal file
View File

@ -0,0 +1 @@
>>><<><>><<<>><>>><<<>>><<<><<<>><>><<>>

13
2022/tests/day18.txt Normal file
View File

@ -0,0 +1,13 @@
2,2,2
1,2,2
3,2,2
2,1,2
2,3,2
2,2,1
2,2,3
2,2,4
2,2,6
1,2,5
3,2,5
2,1,5
2,3,5

2
2022/tests/day19.txt Normal file
View File

@ -0,0 +1,2 @@
Blueprint 1: Each ore robot costs 4 ore. Each clay robot costs 2 ore. Each obsidian robot costs 3 ore and 14 clay. Each geode robot costs 2 ore and 7 obsidian.
Blueprint 2: Each ore robot costs 2 ore. Each clay robot costs 3 ore. Each obsidian robot costs 3 ore and 8 clay. Each geode robot costs 3 ore and 12 obsidian.

3
2022/tests/day2.txt Normal file
View File

@ -0,0 +1,3 @@
A Y
B X
C Z

7
2022/tests/day20.txt Normal file
View File

@ -0,0 +1,7 @@
1
2
-3
3
-2
0
4

15
2022/tests/day21.txt Normal file
View File

@ -0,0 +1,15 @@
root: pppw + sjmn
dbpl: 5
cczh: sllz + lgvd
zczc: 2
ptdq: humn - dvpt
dvpt: 3
lfqf: 4
humn: 5
ljgn: 2
sjmn: drzm * dbpl
sllz: 4
pppw: cczh / lfqf
lgvd: ljgn * ptdq
drzm: hmdt - zczc
hmdt: 32

14
2022/tests/day22.txt Normal file
View File

@ -0,0 +1,14 @@
...#
.#..
#...
....
...#.......#
........#...
..#....#....
..........#.
...#....
.....#..
.#......
......#.
10R5L5R10L4R5L5

7
2022/tests/day23.txt Normal file
View File

@ -0,0 +1,7 @@
....#..
..###.#
#...#.#
.#...##
#.###..
##.#.##
.#..#..

6
2022/tests/day24.txt Normal file
View File

@ -0,0 +1,6 @@
#.######
#>>.<^<#
#.<..<<#
#>v.><>#
#<^v^^>#
######.#

13
2022/tests/day25.txt Normal file
View File

@ -0,0 +1,13 @@
1=-0-2
12111
2=0=
21
2=01
111
20012
112
1=-1=
1-12
12
1=
122

6
2022/tests/day3.txt Normal file
View File

@ -0,0 +1,6 @@
vJrwpWtwJgWrhcsFMMfFFhFp
jqHRNqRjqzjGDLGLrsFMfFZSrLrFZsSL
PmmdzqPrVvPwwTWBwg
wMqvLMZHhHMvwLHjbvcjnnSBnvTQFn
ttgJtRGJQctTZtZT
CrZsJsPPZsGzwwsLwLmpwMDw

6
2022/tests/day4.txt Normal file
View File

@ -0,0 +1,6 @@
2-4,6-8
2-3,4-5
5-7,7-9
2-8,3-7
6-6,4-6
2-6,4-8

9
2022/tests/day5.txt Normal file
View File

@ -0,0 +1,9 @@
[D]
[N] [C]
[Z] [M] [P]
1 2 3
move 1 from 2 to 1
move 3 from 1 to 3
move 2 from 2 to 1
move 1 from 1 to 2

1
2022/tests/day6.txt Normal file
View File

@ -0,0 +1 @@
mjqjpqmgbljsphdztnvjfqwrcgsmlb

23
2022/tests/day7.txt Normal file
View File

@ -0,0 +1,23 @@
$ cd /
$ ls
dir a
14848514 b.txt
8504156 c.dat
dir d
$ cd a
$ ls
dir e
29116 f
2557 g
62596 h.lst
$ cd e
$ ls
584 i
$ cd ..
$ cd ..
$ cd d
$ ls
4060174 j
8033020 d.log
5626152 d.ext
7214296 k

5
2022/tests/day8.txt Normal file
View File

@ -0,0 +1,5 @@
30373
25512
65332
33549
35390

8
2022/tests/day9.txt Normal file
View File

@ -0,0 +1,8 @@
R 4
U 4
L 3
D 1
R 4
D 1
L 5
R 2

45
2023/day1.py Normal file
View File

@ -0,0 +1,45 @@
import sys
lines = sys.stdin.read().splitlines()
lookups_1 = {str(d): d for d in range(1, 10)}
lookups_2 = lookups_1 | {
d: i + 1
for i, d in enumerate(
(
"one",
"two",
"three",
"four",
"five",
"six",
"seven",
"eight",
"nine",
)
)
}
def find_values(lookups: dict[str, int]) -> list[int]:
values: list[int] = []
for line in filter(bool, lines):
first_digit = min(
lookups,
key=lambda lookup: index
if (index := line.find(lookup)) >= 0
else len(line),
)
last_digit = max(
lookups,
key=lambda lookup: index if (index := line.rfind(lookup)) >= 0 else -1,
)
values.append(10 * lookups[first_digit] + lookups[last_digit])
return values
print(f"answer 1 is {sum(find_values(lookups_1))}")
print(f"answer 2 is {sum(find_values(lookups_2))}")

13
2023/day10.py Normal file
View File

@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

13
2023/day11.py Normal file
View File

@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

13
2023/day12.py Normal file
View File

@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

13
2023/day13.py Normal file
View File

@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

13
2023/day14.py Normal file
View File

@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

13
2023/day15.py Normal file
View File

@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

13
2023/day16.py Normal file
View File

@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

13
2023/day17.py Normal file
View File

@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

13
2023/day18.py Normal file
View File

@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

13
2023/day19.py Normal file
View File

@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

45
2023/day2.py Normal file
View File

@ -0,0 +1,45 @@
import operator
import sys
from functools import reduce
from typing import Literal, TypeAlias, cast
CubeType: TypeAlias = Literal["red", "blue", "green"]
MAX_CUBES: dict[CubeType, int] = {"red": 12, "green": 13, "blue": 14}
# parse games
lines = sys.stdin.read().splitlines()
games: dict[int, list[dict[CubeType, int]]] = {}
for line in filter(bool, lines):
id_part, sets_part = line.split(":")
games[int(id_part.split(" ")[-1])] = [
{
cast(CubeType, s[1]): int(s[0])
for cube_draw in cube_set_s.strip().split(", ")
if (s := cube_draw.split(" "))
}
for cube_set_s in sets_part.strip().split(";")
]
# part 1
answer_1 = sum(
id
for id, set_of_cubes in games.items()
if all(
n_cubes <= MAX_CUBES[cube]
for cube_set in set_of_cubes
for cube, n_cubes in cube_set.items()
)
)
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = sum(
reduce(
operator.mul,
(max(cube_set.get(cube, 0) for cube_set in set_of_cubes) for cube in MAX_CUBES),
)
for set_of_cubes in games.values()
)
print(f"answer 2 is {answer_2}")

13
2023/day20.py Normal file
View File

@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

13
2023/day21.py Normal file
View File

@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

13
2023/day22.py Normal file
View File

@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

13
2023/day23.py Normal file
View File

@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

13
2023/day24.py Normal file
View File

@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

13
2023/day25.py Normal file
View File

@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

53
2023/day3.py Normal file
View File

@ -0,0 +1,53 @@
import string
import sys
from collections import defaultdict
NOT_A_SYMBOL = "." + string.digits
lines = sys.stdin.read().splitlines()
values: list[int] = []
gears: dict[tuple[int, int], list[int]] = defaultdict(list)
for i, line in enumerate(lines):
j = 0
while j < len(line):
# skip everything until a digit is found (start of a number)
if line[j] not in string.digits:
j += 1
continue
# extract the range of the number and its value
k = j + 1
while k < len(line) and line[k] in string.digits:
k += 1
value = int(line[j:k])
# lookup around the number if there is a symbol - we go through the number
# itself but that should not matter since it only contains digits
found = False
for i2 in range(max(0, i - 1), min(i + 1, len(lines) - 1) + 1):
for j2 in range(max(0, j - 1), min(k, len(line) - 1) + 1):
assert i2 >= 0 and i2 < len(lines)
assert j2 >= 0 and j2 < len(line)
if lines[i2][j2] not in NOT_A_SYMBOL:
found = True
if lines[i2][j2] == "*":
gears[i2, j2].append(value)
if found:
values.append(value)
# continue starting from the end of the number
j = k
# part 1
answer_1 = sum(values)
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = sum(v1 * v2 for v1, v2 in filter(lambda vs: len(vs) == 2, gears.values()))
print(f"answer 2 is {answer_2}")

41
2023/day4.py Normal file
View File

@ -0,0 +1,41 @@
import sys
from dataclasses import dataclass
@dataclass(frozen=True)
class Card:
id: int
numbers: list[int]
values: list[int]
lines = sys.stdin.read().splitlines()
cards: list[Card] = []
for line in lines:
id_part, e_part = line.split(":")
numbers_s, values_s = e_part.split("|")
cards.append(
Card(
id=int(id_part.split()[1]),
numbers=[int(v.strip()) for v in numbers_s.strip().split()],
values=[int(v.strip()) for v in values_s.strip().split()],
)
)
winnings = [sum(1 for n in card.values if n in card.numbers) for card in cards]
# part 1
answer_1 = sum(2 ** (winning - 1) for winning in winnings if winning > 0)
print(f"answer 1 is {answer_1}")
# part 2
card2cards = {i: list(range(i + 1, i + w + 1)) for i, w in enumerate(winnings)}
card2values = {i: 0 for i in range(len(cards))}
for i in range(len(cards)):
card2values[i] += 1
for j in card2cards[i]:
card2values[j] += card2values[i]
print(f"answer 2 is {sum(card2values.values())}")

129
2023/day5.py Normal file
View File

@ -0,0 +1,129 @@
import sys
from typing import Sequence
MAP_ORDER = [
"seed",
"soil",
"fertilizer",
"water",
"light",
"temperature",
"humidity",
"location",
]
lines = sys.stdin.read().splitlines()
# mappings from one category to another, each list contains
# ranges stored as (source, target, length), ordered by start and
# completed to have no "hole"
maps: dict[tuple[str, str], list[tuple[int, int, int]]] = {}
# parsing
index = 2
while index < len(lines):
p1, _, p2 = lines[index].split()[0].split("-")
# extract the existing ranges from the file - we store as (source, target, length)
# whereas the file is in order (target, source, length)
index += 1
values: list[tuple[int, int, int]] = []
while index < len(lines) and lines[index]:
n1, n2, n3 = lines[index].split()
values.append((int(n2), int(n1), int(n3)))
index += 1
# sort by source value
values.sort()
# add a 'fake' interval starting at 0 if missing
if values[0][0] != 0:
values.insert(0, (0, 0, values[0][0]))
# fill gaps between intervals
for i in range(len(values) - 1):
next_start = values[i + 1][0]
end = values[i][0] + values[i][2]
if next_start != end:
values.insert(
i + 1,
(end, end, next_start - end),
)
# add an interval covering values up to at least 2**32 at the end
last_start, _, last_length = values[-1]
values.append((last_start + last_length, last_start + last_length, 2**32))
assert all(v1[0] + v1[2] == v2[0] for v1, v2 in zip(values[:-1], values[1:]))
assert values[0][0] == 0
assert values[-1][0] + values[-1][-1] >= 2**32
maps[p1, p2] = values
index += 1
def find_range(
values: tuple[int, int], map: list[tuple[int, int, int]]
) -> list[tuple[int, int]]:
"""
Given an input range, use the given mapping to find the corresponding list of
ranges in the target domain.
"""
r_start, r_length = values
ranges: list[tuple[int, int]] = []
# find index of the first and last intervals in map that overlaps the input
# interval
index_start, index_end = -1, -1
for index_start, (start, _, length) in enumerate(map):
if start <= r_start and start + length > r_start:
break
for index_end, (start, _, length) in enumerate(
map[index_start:], start=index_start
):
if r_start + r_length >= start and r_start + r_length < start + length:
break
assert index_start >= 0 and index_end >= 0
# special case if one interval contains everything
if index_start == index_end:
start, target, length = map[index_start]
ranges.append((target + r_start - start, r_length))
else:
# add the start interval part
start, target, length = map[index_start]
ranges.append((target + r_start - start, start + length - r_start))
# add all intervals between the first and last (excluding both)
index = index_start + 1
while index < index_end:
start, target, length = map[index]
ranges.append((target, length))
index += 1
# add the last interval
start, target, length = map[index_end]
ranges.append((target, r_start + r_length - start))
return ranges
def find_location_ranges(seeds: Sequence[tuple[int, int]]) -> Sequence[tuple[int, int]]:
for map1, map2 in zip(MAP_ORDER[:-1], MAP_ORDER[1:]):
seeds = [s2 for s1 in seeds for s2 in find_range(s1, maps[map1, map2])]
return seeds
# part 1 - use find_range() with range of length 1
seeds_p1 = [(int(s), 1) for s in lines[0].split(":")[1].strip().split()]
answer_1 = min(start for start, _ in find_location_ranges(seeds_p1))
print(f"answer 1 is {answer_1}")
# # part 2
parts = lines[0].split(":")[1].strip().split()
seeds_p2 = [(int(s), int(e)) for s, e in zip(parts[::2], parts[1::2])]
answer_2 = min(start for start, _ in find_location_ranges(seeds_p2))
print(f"answer 2 is {answer_2}")

13
2023/day6.py Normal file
View File

@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

13
2023/day7.py Normal file
View File

@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

13
2023/day8.py Normal file
View File

@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

Some files were not shown because too many files have changed in this diff Show More