From 324cbec05813f330136c57d05518158b04146e8e Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Thu, 1 Dec 2022 18:23:23 +0000 Subject: [PATCH 01/52] day 1 + init --- .gitignore | 2 + day1/day1.js | 27 + day1/input.txt | 2243 +++++++++++++++++++++++++++++++++++++++++++++ package-lock.json | 27 + package.json | 20 + 5 files changed, 2319 insertions(+) create mode 100644 .gitignore create mode 100644 day1/day1.js create mode 100644 day1/input.txt create mode 100644 package-lock.json create mode 100644 package.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..82d30cc --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ + +node_modules/ diff --git a/day1/day1.js b/day1/day1.js new file mode 100644 index 0000000..fa57602 --- /dev/null +++ b/day1/day1.js @@ -0,0 +1,27 @@ +import {readFileSync} from 'node:fs'; + +// Read Input file +const input = readFileSync('input.txt', { encoding: 'utf8', flag: 'r' }); + +let elves = []; +let i = 0; + + +// Find what each elf is carrying +for (let line of input.split('\n')) { + if (line.length <= 1) i++; + + if(!elves[i]) elves[i] = 0; + + elves[i] += parseInt(line); +} + + +// Find the biggest +let currentTop = 0; + +for(let elf of elves) { + if(elf > currentTop) currentTop = elf; +} + +console.log(currentTop); \ No newline at end of file diff --git a/day1/input.txt b/day1/input.txt new file mode 100644 index 0000000..d08757d --- /dev/null +++ b/day1/input.txt @@ -0,0 +1,2243 @@ +3427 +3273 +5615 +5943 +3125 +4245 +4194 +3243 +4283 +1790 +5355 +4239 +5541 + +3850 +5294 +5393 +2490 +3231 +2743 +2016 +2418 +2304 +5673 +3035 +5292 +2112 +2630 +2305 + +2325 +2002 +3402 +4756 +1662 +1133 +5273 +6397 +2977 +4011 +3594 +4441 +3907 +1503 + +7598 +6971 +6979 +3873 +1394 +8399 +1321 +2304 +2570 +6679 + +15324 +3365 +23808 + +5489 +3526 +3125 +8371 +1928 +8191 +7267 +10728 + +5243 +2203 +7331 +8049 +4951 +3743 +2255 +4112 +3077 +2441 +4678 + +12353 +2251 +12157 +13656 +10655 +7525 + +3383 +4183 +3293 +5473 +4898 +1441 +3786 +4002 +2179 +2439 +5530 +3966 +6273 +3150 + +3320 +2694 +2229 +1394 +4568 +3160 +4986 +2487 +3412 +1030 +3717 +1460 +1140 +1314 +5816 + +15303 +36095 + +14345 +5208 +2253 +19532 + +5082 +6544 +3563 +6050 +3750 +1155 +2090 +3661 +3600 +5528 +6506 +1795 +4901 + +1156 +1867 +2025 +5434 +1546 +6052 +4412 +7203 +4622 +7098 +4727 + +4423 +1829 +4761 +4779 +3234 +4869 +3567 +6928 +4181 +5390 +5938 + +3100 +6087 +9235 +10228 +2082 +5472 +11382 + +8389 +15131 +12057 +5034 +9419 + +2192 +1695 +3233 +2245 +4328 +6275 +1811 +4345 +2760 +3205 +1138 +2795 +3876 +1041 + +1302 +3509 +6074 +1793 +5808 +5364 +3802 +2048 +6042 +4913 +5983 +1189 +3134 +3763 +2573 + +1003 +8411 +2571 +2555 +7555 +8096 +1441 +5600 +5104 +6311 + +5345 +3329 +5616 +3250 +4321 +2068 +1978 +3719 +4512 +5099 +4694 +1566 +2621 +1613 + +11021 +6101 +9858 +3142 +9907 +1578 +8582 + +3182 +7695 +4419 +4036 +5846 +3899 +6104 +4495 +7382 +3471 + +6844 +3290 +10505 +7855 +1494 +5963 + +3609 +4755 +4063 +1480 +3201 +4576 +1627 +1255 +3699 +3929 +5533 +4807 +5890 +2270 + +3789 +7045 +8784 +8006 +4583 +7726 +3993 +1472 +1578 +2046 + +2474 +5953 +2050 +4758 +5265 +5075 +4338 +1340 +1301 +5996 +1225 +1794 +4778 +1354 +3819 + +9619 +10877 +8094 +8845 +11275 + +1986 +2142 +7561 +5350 +7605 +6766 +4713 +1016 +5697 +3179 +1696 + +3428 +5575 +5301 +4356 +5065 +2010 +1382 +3466 +3233 +1188 +1999 +3228 +6153 +4496 + +1354 +5681 +11066 +1211 +8399 +12040 +11181 + +3408 +1237 +2163 +5645 +4712 +1349 +4124 +2357 +5443 +4887 +5582 +3037 +3764 +3472 +5861 + +16746 +19715 + +18742 +18810 +6457 +8003 + +3720 +2473 +3156 +3758 +2095 +1872 +1767 +3754 +5011 +3188 +2691 +3555 +4826 +2148 +2012 + +8200 +5372 +6960 +5423 +2383 +2252 +6375 +3558 +1643 + +4653 +3017 +1840 +4479 +6043 +4533 +5374 +5708 +5026 +2557 +2984 +2175 +3797 +1367 +2809 + +1439 +2943 +2091 +6539 +5602 +8757 +2165 +2013 +8140 +4465 + +1216 +3681 +6650 +3628 +5812 +1127 +3023 +4629 +6060 +3294 +4414 +6013 +3311 + +5454 +10288 +4812 +7823 +10332 +2413 +1891 + +46279 + +9578 +8113 +19699 +10360 + +1604 +6410 +6017 +7080 +6023 +3892 +5152 +5250 +2799 +3333 +3451 +3430 + +9888 +6658 +4837 +9174 +9517 +1927 +4135 +4802 + +10514 +1492 +1142 +10574 +7578 +6753 +4250 +7526 + +4997 +6345 +5735 +2312 +5652 +6281 +1808 +5840 +6222 +4264 +6164 +3923 +2953 +4549 + +1751 +7956 +7499 +4659 +3770 +3266 +3921 +2854 + +1750 +6872 +3010 +7148 +1621 +3709 +3454 +5347 +7743 +1274 + +4212 +7252 +9341 +1973 +11385 +5895 +2077 + +6658 +1338 +4893 +2578 +9604 +2595 +3414 +1080 +6270 + +24007 +4451 + +12972 +11908 +9381 +1048 +7389 +8138 + +2266 +2599 +4165 +4784 +4626 +4361 +3710 +2182 +3845 +4487 +2023 +2986 +1893 +5845 +5497 + +6805 +5697 +1281 +6524 +2711 +2519 +2117 +4087 +5690 +4330 +1135 +4761 + +5844 +3385 +1138 +1569 +1517 +1556 +9548 +5483 +3219 + +4644 +2601 +5562 +3819 +1254 +5815 +5846 +5382 +3150 +4171 +5534 +6094 +4472 +2061 +4076 + +2878 +1410 +9640 +5071 +3324 +8293 +9940 +3408 + +17130 +10210 +10359 +4906 + +2544 +5660 +6090 +3828 +7403 +2801 +8923 +5277 +8099 + +3795 +1966 +4800 +3767 +4208 +3259 +8457 +4220 +8519 + +1605 +10471 + +5185 +4592 +4389 +3287 +2304 +1856 +4737 +2879 +6366 +6552 +3801 +4487 +3732 + +6012 +5767 +6959 +8554 +8079 +8259 +4657 +5856 + +14046 +3590 +12095 + +2973 +3878 +3645 +4276 +2320 +2886 +5517 +6727 +5742 +1098 +3216 +2442 +3818 + +1273 +4150 +3080 +3346 +2788 +1989 +3112 +4219 +3596 +3513 +4205 +6202 +4782 +2784 + +5051 +2764 +3741 +6410 +1016 +7444 +2184 +3062 +5225 +1274 +6015 +1728 + +2377 +8151 +5516 +5535 +4053 +5950 +10235 + +7837 +2220 +5837 +12251 +16188 + +4297 +16215 + +1978 +1710 +1777 +4212 +6858 +3883 +6775 +2192 +1175 +5995 +1271 +2740 +2628 + +4320 +4494 +5177 +1999 +5490 +1489 +4324 +5227 +1450 +5883 +2319 +4774 +4458 +2351 + +3448 +6913 +8451 +6462 +5866 +11217 +2186 + +4201 +4589 +7100 +4364 +7012 +2153 +7302 +5890 +1686 +6211 +3490 + +15256 +11330 +2576 +16295 +12696 + +3284 +8133 +4210 +9105 +7168 +6026 + +11776 +6637 + +4573 +6043 +1000 +6736 +4118 +5208 +2927 +7477 +5529 +4854 +3522 + +5080 +8530 +6703 +6196 +9315 +5603 +7705 +4264 +4226 + +2260 +9738 +5010 +1686 +1937 +8207 + +25668 +27349 + +2869 +4713 +4882 +2679 +7961 +3163 +5782 +6503 +4208 +2063 + +6247 +4463 +2240 +7150 +2727 +7441 +3721 +7962 +2128 +4317 +1091 + +4963 +1111 +5113 +3820 +3030 +2167 +2925 +1805 +1441 +6450 +1386 +2862 +1594 + +7176 +12022 +1849 +4085 +4515 +10053 +11249 + +18317 +1781 +18494 + +4370 +19502 +2229 +19624 + +3242 +16141 +5070 +19552 + +4082 +7003 +9394 +4500 +9162 +1991 +3555 +4769 + +3386 +5867 +8192 +6543 +1930 +10974 +1136 + +1004 +7929 +9658 +7020 +7231 +9331 +1749 +2973 +6859 + +6997 +1865 +4744 +5725 +8391 +8664 +1142 + +19299 +3449 +16386 +13658 + +1825 +1988 +5454 +6369 +7466 +4535 +5033 +2624 +4671 +1715 +1130 +2785 + +6349 +3298 +15373 +3765 +8607 + +1467 +1151 +5692 +5349 +5878 +2378 +1060 +3500 +3794 +5979 +2498 +5792 +1346 +3951 +3002 + +6298 +7169 +2292 +5334 +3964 +1367 +4002 +5096 +2232 +2396 +2399 +3622 + +4478 +13270 +6750 +14796 +2444 + +28084 +22563 + +10371 +10158 +8358 +8893 +2048 +10170 +1975 +5860 + +2826 +5313 +6768 +5757 +5251 +7693 +2295 +3278 +4889 +6677 +2869 + +4648 +4125 +5271 +2075 +5706 +6365 +2815 +6123 +3621 +2536 +5841 +2819 +3421 + +19400 +15923 +4719 +19889 + +15442 +24965 +20121 + +12765 +6225 +9594 +3324 +10745 + +9550 + +3573 +6393 +7665 +8995 +4214 +7717 +1278 + +8653 +5104 +3346 +4537 +1870 +8001 +2938 +4618 +6738 +2912 + +3315 +1537 +10677 +9986 +6898 +9306 +7037 +1489 + +6055 +5329 +1855 +2859 +6953 +2772 +5646 +4659 +1638 +4294 +2050 +5063 + +66765 + +3712 +3030 +8171 +2898 +8367 +10670 +4897 + +5012 +5099 +4827 +3947 +6708 +1704 +3714 +2225 +4425 +2528 +2396 +1261 + +5626 +2971 +12919 +16816 + +4547 +12905 +11292 +18931 + +3530 +9875 +4672 +3897 +8547 +3293 +4835 + +43142 + +24258 +9997 +21496 + +1208 +5598 +1340 +3351 +3856 +4368 +2935 +5296 +3972 +3060 +2599 +1795 +5210 +5403 +3473 + +4457 +3498 +3815 +1380 +2356 +3167 +5418 +5314 +1344 +1837 +4187 +2184 +5629 +4746 +1087 + +21757 +8610 +4689 + +11777 +5837 + +12118 +5293 +13465 +8537 +7762 +3782 + +6183 +15013 +7399 +14944 +6213 + +43907 + +8307 +5251 +3694 +4573 +2578 +3687 +3885 +1965 +6973 +6266 + +27104 + +1946 +3232 +2101 +9268 +9634 +4100 +1878 +9129 +4192 + +9175 +11691 +4274 +8684 +8889 +4557 +7587 + +4279 +8296 +4685 +2930 +8289 +6175 +4472 +2901 +2936 +7176 + +11323 +9385 +11725 +9793 +8426 +6393 +6004 + +3672 +4161 +3337 +1929 +3171 +2371 +3786 +7876 +4149 +4925 +4705 + +28965 +32051 + +2398 +1799 +5037 +4165 +2010 +1355 +1575 +5139 +6084 +4016 +5215 +6103 +3298 +4534 +4615 + +6660 +7961 +8168 +3330 +6912 +6116 +7870 +9037 +1571 + +6421 +3027 +5685 +3979 +2831 +5353 +2478 +1044 +6811 +7667 +2964 + +3919 +10974 +2860 +4617 +10693 + +5548 +5360 +1319 +5437 +1422 +3565 +4957 +4813 +1684 +3627 +3082 +3486 +6118 +1841 +4263 + +1874 +4344 +6124 +11147 + +6594 +6216 +7338 +3533 +6738 +3045 +1244 +6486 +3200 +2511 + +1139 +21415 +25857 + +16318 +1430 +3369 +9263 +9929 + +5928 +15789 +11887 +12028 +8417 + +6149 +1642 +2773 +4464 +2136 +3018 +3822 +3430 +1317 +7242 +3908 +4536 + +1425 +5550 +4635 +2039 +1290 +2618 +3862 +2107 +4921 +2991 +2703 +1932 +2568 +2266 +5553 + +5660 +8736 +4457 +5190 +1149 +9538 +8720 +6090 +3093 + +13268 +25486 +19311 + +2275 +5258 +6428 +2407 +3893 +1339 +6016 +5075 +3342 +1951 +3939 +5464 +2310 +2111 + +9213 +4141 +13988 + +20253 +20757 +12387 + +6720 +9453 +11786 +5246 +8519 +1807 +4846 + +11442 +6565 +3556 +4281 +13793 + +11152 +7384 +3135 +7831 +9622 +2549 + +1687 +3983 +4666 +5010 +7569 +8614 +3537 +5490 +5002 +5659 + +5692 +2560 +6875 +3031 +3324 +5731 +6464 +9583 +3505 + +1814 +1393 +3673 +5469 +6392 +1052 +2787 +5115 +2666 +2590 +6565 +1842 +2506 + +5592 +3509 +5060 +4589 +2619 +3283 +4145 +1590 +6079 +1312 +5693 +5182 +5071 +5476 +2187 + +5848 +11351 +8303 +11454 +7250 +9222 +9673 + +1348 +4372 +5362 +4031 +3730 +4094 +5193 +1949 +3386 +1840 +1414 +2665 +5000 +1427 +2756 + +5415 +4977 +4836 +5095 +4250 +4958 +5446 +1788 +3187 +2285 +5023 +4540 +6505 +6193 + +9926 +5929 +10070 +9154 +15694 + +5424 +2275 +2556 +7747 +8450 +2304 +8512 +5397 +3831 + +5193 +2733 +5044 +6255 +9617 +7568 +2363 +7297 +8281 + +3912 +8171 +5412 +6963 +2854 +5319 +5093 +3672 +7422 +8003 + +1986 +3826 +3202 +3431 +1361 +1949 +2237 +6455 +7354 +2587 +6648 +5011 + +26126 +35104 + +2811 +3929 +2049 +6213 +6242 +6074 +5336 +1684 +2556 +4831 +2963 +3482 +4728 +3548 + +5652 +5134 +5168 +3953 +7858 +2654 +6512 +2084 +4173 +5224 +3278 + +3599 +5356 +1114 +4191 +4473 +5066 +5490 +3564 +5826 +1516 +4392 +5289 +1281 +4404 +2274 + +58222 + +2493 +5894 +3528 +6543 +6011 +5090 +3001 +3783 +5710 +3351 +3936 + +4894 +2255 +1579 +3849 +1090 +4218 +4196 +3818 +3701 +6652 +6393 +5254 +3891 + +1041 +6701 +8442 +4691 +1054 +9791 + +63207 + +4085 +3685 +3858 +6123 +2192 +7228 +2276 +4588 +2134 +5990 + +1857 +18111 +17100 +12276 + +2353 +5464 +5442 +5230 +4412 +3189 +5513 +5813 +2459 +4570 +3493 +1753 +2059 +5804 +2150 + +9941 +13582 +3983 +5035 +7121 +8255 + +6637 +2409 +5469 +2433 +6675 +5290 +4965 +2161 +4358 +2845 +3302 + +3888 +1312 +7084 +4568 +14787 + +16704 +17915 +12348 +10556 + +3055 +2579 +3744 +3287 +5974 +4817 +2966 +5913 +3291 +2043 +4534 +1323 +5913 +2638 +4941 + +6305 +4244 +10277 +6254 +13667 +4572 + +1538 +13957 +13223 + +5856 +1394 +1329 +1395 +5874 +1899 +1884 +6484 +2784 +4268 +1631 +1822 +2463 +3880 + +14105 +14883 +18198 + +3032 +3784 +5643 +3773 +5888 +1178 +3793 +5230 +4118 +2181 +4977 +5507 +2111 +2718 + +2275 +5842 +1675 +6194 +5207 +1151 +3795 +1214 +1684 +2885 +4067 +3938 +4495 +4713 + +8752 +7608 +9819 +10438 +8672 +9792 +3246 +10448 + +1844 +14438 +13886 +14646 +2801 + +4032 +2553 +2327 +2321 +5334 +4677 +5466 +5474 +5194 +2828 +6113 +2979 +4755 +5295 + +3164 +4556 +7645 +2198 +2053 +1154 +1976 +1231 +4290 +4049 +5697 + +3635 +1307 +2316 +5508 +6603 +5483 +6365 +4073 +1325 +4043 +1807 +1871 +2056 + +6233 +5552 +8415 +2110 +8085 +9293 +6374 +6406 +5730 + +5077 +6068 +9548 +6279 +1000 +3764 +3649 +4720 +3278 + +5222 +1356 +4185 +2401 +1947 +4042 +5903 +4500 +3817 +6871 +4859 +5715 +4061 + +15888 +8533 +18355 + +65924 + +9638 +2232 +5209 + +14127 +21496 +6679 + +4269 +5055 +5129 +3308 +6977 +5175 +8822 +2381 + +57210 + +5510 +1878 +3933 +4081 +5101 +3974 +2211 +2310 +4652 +3113 +3414 +3844 +1637 +3225 +5057 + +12780 +11976 +6407 +3161 +11266 +7404 + +5178 +3541 +3449 +2443 +3099 +5232 +5838 +1724 +5830 +1147 +2092 +5034 +1235 +2502 +5532 + +12966 +12188 +2554 +13972 + +6587 +3279 +1462 +1804 +1398 +1172 +7309 +7422 +6432 +1024 +3065 +4228 + +2694 +7331 +14584 +9982 + +7038 +6957 +4701 +7704 +2598 +5320 +5967 +6921 +1647 + +3296 +2784 +5532 +5546 +5876 +5368 +1054 +5058 +4827 +1357 +6359 +6830 + +4292 +3508 +2337 +4779 +6114 +4836 +5981 +3416 +6699 +3472 +5791 +3957 +6943 + +3478 +4225 +3052 +4254 +3454 +4037 +1586 +5076 +2839 +1992 +4261 +3288 +1343 +2341 +1551 + +17502 +4858 +18898 +5672 + +8686 +2583 +1331 +3358 +6292 +2778 +5709 +1961 +6840 +4022 + +2762 +7622 +7131 +7486 +11995 +10403 +7014 + +3729 +7653 +2913 +4205 +5248 +6521 +5522 +2238 +6185 +6906 +6982 + +13279 +15590 +6519 +5881 +10256 + +11856 +7565 +1021 +2750 +4574 + +6775 +1059 +1006 +4734 +8301 +10502 +4313 + +1474 +3139 +3822 +5821 +3711 +3319 +5126 +3229 +2014 +3850 +2412 +2025 +5909 +1183 +1785 + +2726 +6526 +6606 +6153 +7205 +1503 +5204 +6244 +5856 +3962 +2148 +4222 + +4715 +1689 +4771 +2137 +3780 +1441 +5840 +1161 +5664 +4784 +2380 +1710 +1514 +1631 +1383 + +17682 +10199 + +11639 +6724 +3935 +2520 +2078 +1975 +8774 + +2252 +1541 +5525 +3020 +5282 +4457 +5951 +6672 +7622 +4374 +6671 + +5651 +2720 +1633 +2704 +5113 +1968 +2943 +1763 +4803 +3768 +2712 +1141 +6006 +4546 +4336 + +9165 +8307 +1687 +4532 +4194 +4442 +6385 +5555 + +3820 +4280 +1133 +3789 +5471 +1788 +1694 +5654 +4802 +4218 +2428 +2933 +2219 +3567 +1743 + +2881 +4847 +1363 +5396 +1564 +5633 +4521 +3209 +2555 +5482 +2613 +4118 +5167 +3873 +2554 + +7668 +5845 +11661 +6560 +2189 +5230 +1923 + +29880 +25227 + +4503 +2215 +4600 +8892 +3104 +1325 +2103 +8983 +4061 + +4784 +9543 +16484 +18339 + +1331 +1544 +1291 +3863 +1005 +2002 +2907 +3014 +5819 +1397 +5856 +2182 +6055 +4812 +4226 + +5402 +3893 +4333 +4381 +5053 +3248 +1537 +3147 +2459 +3383 +2214 +5900 +5862 +2002 +1870 \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..129af88 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,27 @@ +{ + "name": "advent-of-code-2022", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "fs": "^0.0.1-security" + } + }, + "node_modules/fs": { + "version": "0.0.1-security", + "resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz", + "integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w==" + } + }, + "dependencies": { + "fs": { + "version": "0.0.1-security", + "resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz", + "integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w==" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..510b389 --- /dev/null +++ b/package.json @@ -0,0 +1,20 @@ +{ + "name": "advent-of-code-2022", + "version": "1.0.0", + "description": "Advent of Code 2022 Solutions", + "type": "module", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/itsmeimtom/advent-of-code-2022.git" + }, + "bugs": { + "url": "https://github.com/itsmeimtom/advent-of-code-2022/issues" + }, + "homepage": "https://github.com/itsmeimtom/advent-of-code-2022#readme", + "dependencies": { + "fs": "^0.0.1-security" + } +} From 45331191767ca7f93829efd5d1321392956f140f Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Thu, 1 Dec 2022 18:32:14 +0000 Subject: [PATCH 02/52] day 1 pt 2 --- day1/day1.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/day1/day1.js b/day1/day1.js index fa57602..125a1a3 100644 --- a/day1/day1.js +++ b/day1/day1.js @@ -3,11 +3,11 @@ import {readFileSync} from 'node:fs'; // Read Input file const input = readFileSync('input.txt', { encoding: 'utf8', flag: 'r' }); + +// Find what each elf is carrying let elves = []; let i = 0; - -// Find what each elf is carrying for (let line of input.split('\n')) { if (line.length <= 1) i++; @@ -24,4 +24,11 @@ for(let elf of elves) { if(elf > currentTop) currentTop = elf; } -console.log(currentTop); \ No newline at end of file +console.log(currentTop); + + +// Part Two: Adding top three values +let elvesSorted = elves.sort((a, b) => b - a); // this feels like cheating + +let topThree = elvesSorted[0] + elvesSorted[1] + elvesSorted[2]; +console.log(topThree); \ No newline at end of file From 44205db73ec4c52e62c782d9d3f185518e24ad35 Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Thu, 1 Dec 2022 18:36:53 +0000 Subject: [PATCH 03/52] code formatting --- day1/day1.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/day1/day1.js b/day1/day1.js index 125a1a3..bb680fd 100644 --- a/day1/day1.js +++ b/day1/day1.js @@ -1,28 +1,27 @@ -import {readFileSync} from 'node:fs'; +import { readFileSync } from "node:fs"; // Read Input file -const input = readFileSync('input.txt', { encoding: 'utf8', flag: 'r' }); +const input = readFileSync("input.txt", { encoding: "utf8", flag: "r" }); // Find what each elf is carrying let elves = []; let i = 0; -for (let line of input.split('\n')) { - if (line.length <= 1) i++; +for (let line of input.split("\n")) { + if (line.length <= 1) i++; - if(!elves[i]) elves[i] = 0; + if (!elves[i]) elves[i] = 0; - elves[i] += parseInt(line); + elves[i] += parseInt(line); } - // Find the biggest let currentTop = 0; -for(let elf of elves) { - if(elf > currentTop) currentTop = elf; -} +elves.forEach(e => { + if (e>currentTop) currentTop = e +}); console.log(currentTop); @@ -30,5 +29,6 @@ console.log(currentTop); // Part Two: Adding top three values let elvesSorted = elves.sort((a, b) => b - a); // this feels like cheating -let topThree = elvesSorted[0] + elvesSorted[1] + elvesSorted[2]; +let topThree = elvesSorted[0] + elvesSorted[1] + elvesSorted[2]; // this is the best code i have ever written + console.log(topThree); \ No newline at end of file From 6ca9b8d04d6a679dcd7253cb57c96b75d99aba28 Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Thu, 1 Dec 2022 18:42:07 +0000 Subject: [PATCH 04/52] more lovely formatting --- day1/day1.js | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/day1/day1.js b/day1/day1.js index bb680fd..71fe73b 100644 --- a/day1/day1.js +++ b/day1/day1.js @@ -9,26 +9,18 @@ let elves = []; let i = 0; for (let line of input.split("\n")) { - if (line.length <= 1) i++; - - if (!elves[i]) elves[i] = 0; - - elves[i] += parseInt(line); + if (line.length <= 1) i++; // if the line is blank, move onto the next elf + if (!elves[i]) elves[i] = 0; // if the current elf hasnt been seen before, init with 0 + elves[i] += parseInt(line); // add cals to current elf } // Find the biggest let currentTop = 0; - -elves.forEach(e => { - if (e>currentTop) currentTop = e -}); - -console.log(currentTop); +elves.forEach(e => { if (e > currentTop) currentTop = e }); +console.log(currentTop); // Part One answer // Part Two: Adding top three values let elvesSorted = elves.sort((a, b) => b - a); // this feels like cheating - let topThree = elvesSorted[0] + elvesSorted[1] + elvesSorted[2]; // this is the best code i have ever written - -console.log(topThree); \ No newline at end of file +console.log(topThree); // Part Two answer \ No newline at end of file From a86266cb2011e5800814bdd815bd452b8b662ac3 Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Fri, 2 Dec 2022 17:41:37 +0000 Subject: [PATCH 05/52] day two! --- day2/day2.js | 59 ++ day2/input.txt | 2500 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 2559 insertions(+) create mode 100644 day2/day2.js create mode 100644 day2/input.txt diff --git a/day2/day2.js b/day2/day2.js new file mode 100644 index 0000000..103b8c8 --- /dev/null +++ b/day2/day2.js @@ -0,0 +1,59 @@ +import { readFileSync } from "node:fs"; + +// Read Input file +const input = readFileSync("input.txt", { encoding: "utf8", flag: "r" }); + + +let totalPoints = 0; + +for (let line of input.split("\n")) { + if (!line) continue; // ignore blank lines + + let pointsThisTime = 0; // points from this game + + let theirPlay = line.split(" ")[0].toLowerCase(); + let myPlay = line.split(" ")[1].toLowerCase(); + let state = null; + + // i'm sure there's a more mathemtical way of doing this + // perhaps by converting the rock/paper/scissors into numbers + // but this is less to think about and there's not too much to manually write + switch (myPlay) { + case "x": // rock + pointsThisTime += 1; // we get 1 point for chosing rock + if (theirPlay == "a") state = "draw"; // they chose rock + if (theirPlay == "b") state = "loss"; // they chose paper + if (theirPlay == "c") state = "win"; // they chose scissors + break; + case "y": // paper + pointsThisTime += 2; // we get 2 points for chosing paper + if (theirPlay == "a") state = "win"; // they chose rock + if (theirPlay == "b") state = "draw"; // they chose paper + if (theirPlay == "c") state = "loss"; // they chose scissors + break; + case "z": // scissors + pointsThisTime += 3; // we get 3 points for chosing scissors + if (theirPlay == "a") state = "loss"; // they chose rock + if (theirPlay == "b") state = "win"; // they chose paper + if (theirPlay == "c") state = "draw"; // they chose scissors + break; + } + + switch (state) { + case "win": + pointsThisTime += 6; + break; + case "draw": + pointsThisTime += 3; + break; + case "loss": + pointsThisTime += 0; + break; + } + + console.log(`a ${state} for us! ${pointsThisTime} from this game (${theirPlay} vs ${myPlay})`); + + totalPoints += pointsThisTime; +} + +console.log(totalPoints); \ No newline at end of file diff --git a/day2/input.txt b/day2/input.txt new file mode 100644 index 0000000..cc70403 --- /dev/null +++ b/day2/input.txt @@ -0,0 +1,2500 @@ +C Y +B Y +C Y +B X +B X +B X +C Y +B Z +A Z +A Z +A Z +A Y +A X +A Z +A X +A Z +C Y +A X +A Z +A Z +A Z +A Y +C Y +B Z +B Z +C Y +C Y +C Y +C Y +A X +B Z +C X +B X +A Y +C X +C Y +C Y +B X +C X +B Z +C Y +B X +C Y +B X +B X +C Y +A X +B X +B Z +B X +A Z +B Z +B X +B Y +C Y +A X +C Y +A Z +C Y +C Z +B Z +C Y +C Y +C Y +B Y +B X +B X +A X +B Z +B X +B X +B X +B X +B Y +B X +B X +B X +B X +B Z +B X +B X +B Y +B X +C Y +C Y +B Z +A Z +A X +B X +B X +A X +B X +A X +B X +A Z +B Y +A X +A Y +C Y +A X +A X +C Y +A Z +B X +B Y +C Z +C Y +B X +B X +A Z +B X +B X +C Y +A Z +A Z +B X +C X +B Z +C Y +B X +A Y +C Y +B Z +C Y +B Z +A X +C Y +C Z +B X +B X +C X +A X +B X +B Z +B Z +B Z +A Y +B Z +B X +C Y +B Z +A Z +C Y +C Y +A Z +C Y +B X +B X +C Y +B Z +B Z +C Y +A X +C Y +C Y +B X +B Y +C Y +C Y +A Z +B Z +B X +B X +C Z +C Y +A X +B Z +B Y +C Y +C Y +B X +B Z +C X +B X +C Y +B Z +A X +B X +B Z +A X +C Y +B X +B X +C Y +A X +B X +B Y +A X +A Y +C Y +C Y +B X +A Z +A X +B Y +A X +A X +C X +C Y +B Y +A Z +C X +A X +B Z +B X +B X +C Y +A X +C X +C Y +A X +C Y +B X +B X +C Y +C Y +B X +A X +B X +A X +C Y +B Y +B Z +B X +B X +C X +C Y +B Z +C Y +C Y +B X +A Z +B Z +A Z +A Z +C Y +B X +C Y +C Y +C X +B X +C X +C Z +C Y +B Z +C Z +C Y +A Z +B X +C X +B Y +B Z +C Y +B Z +B Z +B Z +A Z +C X +A Y +B Z +A Z +B Z +B Y +A Z +C Y +C Y +B X +A X +B X +C X +B Y +C Y +B Z +B X +C Y +A X +B Z +B Y +C X +C Y +B X +A Z +A Z +C Y +B Z +B Z +B X +B X +C X +B X +B X +B X +A Z +A X +C Z +B X +A Z +B X +C X +B X +C X +B Z +B X +B X +A X +B Z +B Y +A Z +A Z +C Y +C Y +A Z +A Z +B X +A X +B Z +C X +C Y +C Y +B Z +A X +B Y +B Z +A X +C Y +B Z +A X +B X +B X +C Y +C Z +A Y +A X +C Y +A Z +C X +A Z +A Z +C X +A X +A Z +B Z +A Y +A Z +C Y +B X +B X +B Z +B X +B X +B Y +B X +B X +C Y +B X +A Z +B X +C Y +A Z +B Z +C Y +C X +C Y +B X +C Y +B Y +B X +B Z +C Y +A X +A X +C X +B X +A X +C X +B Y +B Y +A Z +C Z +C Z +A X +C Y +A Y +A Z +B Z +A Z +A X +A Y +B X +B Y +C Y +A X +B Y +C X +C Y +B Z +C Y +A X +B Z +B Z +A X +C X +B X +A X +B Z +C Y +C Y +B Y +A Y +B X +B Z +B X +C Y +B X +C Y +C X +A Z +B Z +C Y +B X +B Z +B Z +B Z +C Y +C X +C X +B X +A X +C Y +C Y +B X +B Z +C Y +A X +B X +B Z +B Z +B Y +A Y +B X +B Z +B X +A X +A Z +A Z +C X +B Y +B Z +C Z +B X +C Y +B X +C Y +B Y +B Z +B Y +B X +A Z +C X +A X +A Z +C Y +B X +C Y +C Y +B X +C Z +B Z +B Z +C X +C Y +A Y +C Y +A Y +B X +B Y +A Z +B Z +B X +B X +A X +C Y +B Z +C Y +B X +A Z +B Z +C Y +B Z +A Z +C Y +B X +B X +C Y +C Y +C Y +B X +C Z +B Z +B X +C Y +C X +B X +C Y +B Y +B Z +B Z +B Y +B Z +B Y +A Z +B X +B X +A Z +C Z +A Z +B X +C Z +A X +B X +C Y +B Z +A Z +C Y +C Y +B Z +A X +C Y +A Z +B X +B Z +B Y +B X +B Z +B X +C Y +A X +B Z +C Y +B Z +B Z +C Y +B X +B X +A Y +C Y +B Z +B Z +B X +B Z +A X +A X +C Y +B X +C Y +A Z +A X +B X +C Y +B Z +A Z +B X +A X +B X +B Y +A X +C Z +A X +B Y +B X +A Y +C Y +A Z +B X +C Y +A X +B X +C Y +A Z +B Y +A Z +B Z +B X +A X +B Y +A X +A Z +B Z +B X +B Z +C Y +C Y +C Y +B X +B Y +A Z +A Z +B X +B X +B Y +A X +A Z +C Y +A Y +B Z +A X +C X +A Z +C X +C Y +C Y +B X +B X +B Z +A X +A Z +B Y +B Z +B X +B Z +B X +C Y +B X +C Y +C Y +B X +B X +C Z +C Y +A X +A Z +C Y +C Y +A X +A Z +A X +C Y +C Y +B X +A X +C Y +B X +B X +A Z +B X +A Z +A Z +C Y +C Y +B X +C Y +B X +A X +C Y +B Z +A X +C Y +B Z +A X +A Z +C Y +C Y +B X +A X +B X +B Z +A Z +C X +B Z +A X +B Z +C Y +B X +A Z +C X +B Z +A Z +A X +C Y +B X +C Y +B X +A Z +B Z +B X +C X +B Z +B Y +C Y +B Z +B Z +B Z +B Z +C Y +C Y +A Z +C Y +C Z +C Z +C Y +C Y +B Z +A Y +B X +A Y +B Z +A Z +C Z +B X +B X +C X +A Z +C Y +A Z +B X +B X +A X +B Z +B X +C X +A Z +B Y +A X +B X +A Z +A X +B Z +C Y +B X +B X +C Y +C Y +B X +A Y +C X +B X +C X +B Y +B X +C Y +C Y +B X +A Z +A Z +A Y +B Z +B Z +B Z +C Y +A X +B X +C Y +C Y +A X +C Y +A Z +B X +A X +A Y +B Z +B Y +B Y +C X +A Z +A Z +B Z +A Z +B Z +B X +A Z +B Z +B Y +B X +B X +B X +A Y +A X +B X +B X +A X +C Y +B Z +C Y +B Y +A X +B Z +A Z +C Y +A X +C Y +B X +B Z +B Z +C Y +B Z +C Y +B X +C Y +A Z +A X +B X +C Y +A X +A X +C Y +C X +C Y +A Z +B Z +A X +C X +C X +C Y +B X +C X +A X +C Y +B Y +A X +C Y +B X +A Z +C Y +C Y +A X +A X +B X +B Y +B Y +A Y +A X +C Y +A X +C X +B X +C Y +C Y +A X +A Z +B Z +B Z +C Y +B Z +B Y +A X +C X +C X +A X +C Y +B Z +A Z +B X +C Y +C Y +C X +C Y +C X +A X +C Y +B X +C X +B X +A Z +B Z +B Z +B Z +B X +B Z +B X +B Y +C Y +C X +A Y +B Z +B Y +C Y +B Z +A X +A X +A Z +C Y +A X +C X +C Y +B Y +B X +B X +A X +B Y +C Y +B X +C X +C X +A Z +A Z +C Y +B X +B Z +C Y +B Z +B Z +C Y +C X +A X +B Z +C Y +C Y +C Y +B Z +B X +C Y +B Z +A X +B X +C Y +A Z +C Y +A Z +A Z +B Z +C Y +A Z +C Y +B X +A X +A X +B Z +C Y +B Y +B X +A Z +B X +C Y +A Z +C Y +A X +A Z +B X +B X +B Y +B X +A Z +C Y +A X +C Y +C Y +C Y +C Z +C Y +A Z +A Y +B Z +C Y +B X +C Y +C Y +A Z +C Z +C Y +B X +C Y +A Z +B Z +B Y +B Z +A Z +B X +B X +C X +B X +B Z +A X +C Y +C Y +C Y +A Z +B X +B Y +A X +A Z +C Y +A Z +A Z +B X +C Y +B Z +B Z +B X +C X +A Z +C X +B Z +C Y +A Z +B X +C Y +B X +A X +C Z +C X +C Y +A Z +C Y +B X +B X +B X +B X +B X +A Y +C Y +B X +A X +A Z +A Z +A X +C Z +B Z +C Y +B X +B Z +A X +B X +B X +C Y +B X +C Y +A Z +A Z +C X +B Z +A X +C Y +B X +C Y +C Y +C Y +B X +B Y +A Z +C Y +C Y +A X +A X +C Y +B X +B Z +C Y +A X +C Z +B Z +B X +C Y +C Y +B Z +A X +A Z +B X +C Y +A Z +A X +A Y +C Y +B X +B Z +A X +B Z +B Z +C Y +C Y +C X +B Z +A X +C Y +B Y +A Z +B X +B Y +B X +C Y +A Z +B X +A Z +C Y +B X +B X +C Y +B Y +C Y +C Y +C Y +B X +A X +C Y +C Y +C Y +A Z +C Y +B X +B X +B X +B X +A X +B Y +C X +B X +C X +A X +C X +C Y +A X +A Z +C Y +B Z +B Y +A X +B Y +C Y +C Y +B X +A X +A X +C X +B Z +C Y +C Y +A Z +B Z +B Z +C X +C Y +B X +B X +B Z +A Z +C Y +C Y +A Z +A Z +B X +B X +B Y +B Z +B Z +A Y +B Z +A Z +B Z +B X +B Z +C Z +B Z +A Z +B Z +B X +B X +B X +A X +C Y +A Z +C Y +C Y +B X +A Z +C X +B Z +B Y +C Z +B X +C Y +A X +C Y +A Y +B Z +C Y +C Y +B X +B X +A Z +C X +A X +A Z +B Y +C Y +C Y +C Y +B X +C Y +C Y +A Z +B X +A Z +C X +C Y +B Z +B Z +B Z +A Z +C Y +C Z +B Z +C Y +C Y +C Y +B X +B X +C Y +C Y +B X +A X +A Z +B X +C Y +B X +A Z +C Y +C Y +B Y +A X +A X +A X +A X +B X +B Y +C Y +A Z +B Y +B Z +A X +B X +C Y +A Y +C Y +A Z +B X +B Z +B Z +A Y +B X +B X +C Y +A Z +A Z +A X +A X +B Z +C Y +B Z +C X +A Z +C Y +B Z +C Y +C Y +B Z +A Z +C Y +C X +A Z +C Y +B X +A Y +A X +B Z +A Y +A Z +B X +C X +B Z +C Y +C Y +B Y +B Z +A X +B X +A Z +C Y +C Y +A Z +A Z +B X +C Y +B Z +A X +A X +B X +B Y +C Y +B X +C X +C Y +B Z +A Z +A Y +B X +C Y +C Y +C X +A Z +C Z +B Z +B X +A Z +A X +A X +B Z +B X +A Z +B Z +C Y +A X +B Z +B Z +C Y +C Y +A X +B X +C Y +A X +B X +C Y +B X +A Z +A X +B Z +A Z +B Z +B Y +A X +B Z +A Z +A Z +A Z +A X +A X +B X +B X +A Z +B Y +A Y +C Y +B X +C Y +B Y +C Y +A Z +A Z +B X +B X +C Y +B Z +C Y +B Z +B X +B X +B X +B X +A X +B Y +B X +C X +A Z +A Z +B X +C Y +C Y +C Y +A X +C Y +C Y +C Y +A X +C Y +C X +B X +A Y +C Z +C Y +A Z +B X +A Z +A X +B X +A X +A X +C Y +A Y +A X +B X +A Z +B Z +B Y +C Z +B X +A Z +C Y +B Z +B X +C Y +C Y +C Y +B X +A X +A Z +B X +A X +C Y +B Z +A X +C Y +C Y +A X +A X +A X +A Y +C Y +C Y +C Y +C Z +C Y +A X +B X +C Y +C Y +C Y +C Y +A X +B Z +A X +B X +C Y +B Z +A Z +C Y +A Z +C Y +B X +B X +C Y +C Y +B Y +A X +C Y +C X +C Y +C X +A Z +A Z +B Y +A X +A X +B Z +A Z +A X +A Z +C Y +A X +B Z +C X +A X +A X +B X +A X +B Y +A X +B X +B X +C Y +C X +B X +B Y +C X +A Z +B Z +B X +C Y +B Y +B Z +C Y +A X +C Y +B X +B X +C Y +C Z +B X +B X +C X +B Y +B Y +B Z +C X +B X +C Y +B X +C Y +B X +A X +A Y +B X +B X +B X +B Y +C Y +B X +B X +B X +C Y +A Z +B Z +B X +A Z +B X +B Y +C X +A Z +C Y +C Y +B Z +B X +C Y +C Y +C Y +C Y +B Z +A X +C Y +C Y +A Z +B X +B Z +A Y +C Y +B X +C Z +A Z +B Y +A Y +A Z +A Z +B X +B X +C X +A Z +B Z +A X +B Z +A Z +B X +B X +C Y +B Z +C Y +A Z +B Z +B X +A Z +C Y +B X +B Y +B Z +C Y +B X +C Y +B X +A X +A X +C Y +B X +B X +A Y +A Z +A Z +B Z +A Z +C Y +C Y +A Z +A X +A Z +B X +C Y +C X +A Z +A X +B Z +B Z +A X +B X +C X +C Y +C Y +B Z +B X +C Y +C Z +B Y +C Y +A Z +B Z +B Z +B X +B X +C Y +B X +B X +C X +A X +B Z +C Y +B Y +B X +A Z +B Z +B X +A Z +B Z +B X +A Z +B X +C Y +C X +B Y +B Y +B Z +C Y +A X +B Z +B Y +C Y +A X +B Z +B Z +C X +B X +C Y +C Y +C Y +C Y +A Z +A Z +B X +B X +C Z +B X +B Z +B X +B Z +A Z +B X +C Y +B X +C Y +C Y +A X +B X +A X +C X +B X +B Y +A X +B Z +A Z +B Y +B Z +C Y +B Z +C Y +B X +B Z +B Y +B X +B X +A Z +B Z +B X +A Z +C Y +C Y +A Z +A X +C Z +A X +B Z +B Z +C Y +B X +B X +A Y +B Z +C X +C Y +C Y +C Y +A Y +A X +B X +B Z +A Z +B X +C X +C X +C Y +C Y +C Y +B X +B X +A Z +B Z +B X +A X +A Z +C Z +B Z +B Z +B X +A X +B X +C Y +B Z +A X +B Y +B Z +B Y +B X +A X +B Z +C Y +C X +C Y +A Z +B Z +B X +B Z +B X +A Y +B X +A Z +B X +C X +A X +C Y +B X +C Y +C Y +A Y +C Z +A Z +C X +B X +C Y +A Z +B X +B Z +B Z +C Y +A X +A Z +B X +B X +B Z +B X +C Y +B X +A X +A X +C Y +A Z +C Y +B Y +B Z +B Z +C Y +B Z +C Y +B X +B X +B Y +C Y +A X +A Z +A Z +A X +C Y +B X +B Y +B Y +B X +A X +A Y +B Y +B Y +C Y +A X +B Z +C Y +A Z +C Y +B Y +A X +B X +A X +B X +A Z +C Y +C Y +A X +B Y +B Y +B X +A Z +A Z +A Z +A Y +B Z +C X +B X +C Y +C Z +B Y +C Y +C X +B X +B Z +B Z +B Z +B Z +B Y +B Z +A Z +C X +B X +C Y +C Y +B Z +C Y +C Y +A X +C X +A X +B Z +C Y +B X +C Y +A X +A Z +C Z +A X +B Z +C Y +C Y +C Y +A X +C Y +C Y +B X +B X +B Y +C Y +B Z +B X +C Y +A Z +C X +A Z +C Y +A Z +A X +B Z +B X +C Z +B X +C Y +A Z +C Y +B X +B X +B X +B Z +C Y +B X +A Z +A Z +C Y +B Y +C Y +B Z +A Z +A X +B Z +B X +B X +A Y +B X +B X +C Y +B X +B X +B Z +C Y +B X +A X +A Z +A Z +C X +A X +A X +B X +B X +B Z +A X +C Y +B X +C Y +C Y +A X +B X +A X +A Z +A Z +C Y +B X +C Y +B Y +B X +B X +C X +B X +A X +C X +B Z +C Y +B Z +B X +C Y +C Y +A Z +C Y +B Z +B X +A Z +C Y +C Y +B X +B Z +A X +B X +C Y +C Y +C Y +A X +A X +A X +B Z +B Z +A X +A X +B X +B Z +C Y +C Y +B Z +A Z +C Y +C Y +A Z +B Z +C Y +B X +B X +B X +C Y +C Y +B Z +C Y +B Z +A X +A X +B X +C Y +A X +A X +C X +A Y +C X +B X +B X +B Z +B Z +B Z +B X +B Z +C Y +C Y +C X +A Z +B X +A X +B Z +B X +A Z +C Y +B X +B Y +B Z +A Z +B X +A Y +C X +B X +C Z +C Y +B Z +A X +B Z +B Z +A X +B Z +B X +C Y +B Z +C X +C Y +A Z +C Y +A Y +B Z +B X +B Y +A Z +A Y +A X +B Y +A Z +B Z +C Y +C Y +C X +C Y +C Y +B X +B Z +A Z +B Z +B Z +A Z +C Y +A Z +C X +C Y +C Y +C Y +A X +C Y +B Z +A X +C Y +C Y +C Y +B X +B Z +B Y +C Y +C Y +C Y +C Y +B Y +A Y +B Z +B X +A X +A Y +C Y +C X +B X +B Z +A Z +B Z +B X +A X +C Z +C X +B Z +C Y +A X +C X +B Z +B X +B X +A Z +B X +B Z +B Y +C Y +B X +A X +B X +B Z +A X +B Z +A Y +C Y +A X +C X +B X +B Y +B Z +B X +B X +C Y +B X +B X +C Y +B Y +B Z +B Y +B Z +C Y +A Z +C Y +A Z +B X +B X +A Z +B X +C Y +C X +C Y +B Y +C Y +C Y +C Z +C Y +A Y +C Y +B X +B Z +A Y +B Z +A Z +B Z +B Z +B X +B Y +C Y +B X +C Y +C Z +C Y +A X +B X +B X +C Z +A Z +B X +A Z +C Y +B Z +B Z +B Y +A Z +B Z +C Y +C Y +A Z +C Y +B Y +C Y +B Z +C X +B Z +B X +A Z +B Y +B Y +B Z +A Z +B Z +C X +C X +B Z +B X +C Y +B X +A X +B X +B X +B Z +C Y +A Z +A Y +B Z +C Y +A X +A X +A Y +B X +B Z +A X +B X +C X +B X +B Y +B X +A Z +C Y +A X +C Y +A X +C Y +C Y +B Y +C Y +B X +C Y +C Y +B X +B Z +A X +C Y +C X +C X +C Y +B Y +A Z +C Y +A X +A X +B X +B X +A X +B X +C X +B Z +B X +A X +A Z +B X +C Y +C Y +A X +C X +B Z +B Z +B X +C Y +C Y +A Z +C X +B Z +C Y +B Y +A Z +B Z +A Z +B X +C X +C Z +C Y +A Z +B Z +B X +C Y +C Y +C X +C Y +C Y +C Y +A X +A Z +C Y +B X +B X +B Z +A Z +C Y +B X +A Z +C Y +C Y +B Z +A X +B Z +B Z +B X +B Z +B X +B X +B Z +B Z +C Y +A X +A X +A Z +C Y +C Y +B X +B Z +C Z +B X +C Z +C Y +C X +C Y +B Y +A X +B Z +A Z +C X +B X +C X +A Z +A Y +B Z +A X +A X +A Z +A Z +B Y +B Z +C Y +B X +C Y +B Z +B X +C Y +C Y +A X +A Z +B X +C Y +B X +B X +A X +A Z +B X +B X +B Z +A X +A X +B Z +B X +B X +B X +A Z +C X +B X +B X +B X +B Z +B X +C X +C Y +A Z +C X +A Z +C Y +A X +C Y +A X +B X +A Z +B X +C Y +C Y +A Z +A Z +B Z +B Z +B X +C X +A X +B Y +B Z +C Y +B Z +A X +A X +B X +A X +A X +A X +A X +B Z +B Y +C Y +A Z +C Z +C Y +A X +B Y +C X +A Z +B X +B Z +A X +A X +C Y +B X +B X +A X +A Z +C Y +C Y +A Z +C Y +B X +B X +A Z +A Y +C Y +A Z +A X +C Y +B Z +B Z +C Y +B X +C Y +C Y +C Y +C Z +B X +C Y +C X +B Z +A Z +C Y +A Z +B Z +A Z +B X +A X +A Z +B Z +B Z +A X +B Z +A X +B X +A Z +B X +B X +A Z +C Y +B X +B Z +C Y +B Z +B Z +B X +B Z +B X +B X +C Y +B X +B Y +B X +B X +A Z +B X +C Y +B X +B X +B X +B Z +A Z +B Y +B X +B Z +C X +C Y +B X +B Y +C Y +B X +C X +B X +C X +B Z +A Y +A Z +B Z +B Z +A X +A Z +B Z +B X +A Z +B Z +C Y +C Z +C Y +A Z +C Z +A Z +C Z +C Y +A Z +A Y +C Y From 12ec7f8479b16827973260391452740937fdbca0 Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Fri, 2 Dec 2022 17:52:06 +0000 Subject: [PATCH 06/52] day two part 2!! --- day2/day2-pt2.js | 80 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 day2/day2-pt2.js diff --git a/day2/day2-pt2.js b/day2/day2-pt2.js new file mode 100644 index 0000000..1cdeb59 --- /dev/null +++ b/day2/day2-pt2.js @@ -0,0 +1,80 @@ +import { readFileSync } from "node:fs"; + +// Read Input file +const input = readFileSync("input.txt", { encoding: "utf8", flag: "r" }); + + +let totalPoints = 0; + +for (let line of input.split("\n")) { + if (!line) continue; // ignore blank lines + + let pointsThisTime = 0; // points from this game + let state = null; // win/loss/draw, for adding right # of points in each game + let needTo = null; // win/loss/draw, only for logging later + + let theirPlay = line.split(" ")[0].toLowerCase(); + let myPlay = line.split(" ")[1].toLowerCase(); + + // this will change our shape depending on the goal of this game + switch (myPlay) { + case "x": // we need to lose + needTo = "lose"; + if (theirPlay == "a") myPlay = "z"; // they chose rock - to lose we need to pick scissors + if (theirPlay == "b") myPlay = "x"; // they chose paper - to lose we need to pick rock + if (theirPlay == "c") myPlay = "y"; // they chose scissors - to lose we need to pick paper + break; + case "y": // we need to draw + needTo = "draw"; + if (theirPlay == "a") myPlay = "x"; // they chose rock - to draw we need to pick rock + if (theirPlay == "b") myPlay = "y"; // they chose paper - to draw we need to pick paper + if (theirPlay == "c") myPlay = "z"; // they chose scissors - to draw we need to pick scissors + break; + case "z": // we need to win + needTo = "win"; + if (theirPlay == "a") myPlay = "y"; // they chose rock - to win we need to pick paper + if (theirPlay == "b") myPlay = "z"; // they chose paper - to win we need to pick scissors + if (theirPlay == "c") myPlay = "x"; // they chose scissors - to win we need to pick rock + break; + } + + // do as part one now we've changed our shape + switch (myPlay) { + case "x": // rock + pointsThisTime += 1; // we get 1 point for chosing rock + if (theirPlay == "a") state = "draw"; // they chose rock + if (theirPlay == "b") state = "loss"; // they chose paper + if (theirPlay == "c") state = "win"; // they chose scissors + break; + case "y": // paper + pointsThisTime += 2; // we get 2 points for chosing paper + if (theirPlay == "a") state = "win"; // they chose rock + if (theirPlay == "b") state = "draw"; // they chose paper + if (theirPlay == "c") state = "loss"; // they chose scissors + break; + case "z": // scissors + pointsThisTime += 3; // we get 3 points for chosing scissors + if (theirPlay == "a") state = "loss"; // they chose rock + if (theirPlay == "b") state = "win"; // they chose paper + if (theirPlay == "c") state = "draw"; // they chose scissors + break; + } + + switch (state) { + case "win": + pointsThisTime += 6; + break; + case "draw": + pointsThisTime += 3; + break; + case "loss": + pointsThisTime += 0; + break; + } + + console.log(`a ${state} for us (we needed to ${needTo})! ${pointsThisTime} from this game (${theirPlay} vs ${myPlay})`); + + totalPoints += pointsThisTime; +} + +console.log(totalPoints); \ No newline at end of file From 3a027322b291c35beacd02d54ca22b07a7a61aa4 Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Fri, 2 Dec 2022 17:56:09 +0000 Subject: [PATCH 07/52] thank god i'm not doing an english degree --- day2/day2.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/day2/day2.js b/day2/day2.js index 103b8c8..1e1bca4 100644 --- a/day2/day2.js +++ b/day2/day2.js @@ -15,24 +15,24 @@ for (let line of input.split("\n")) { let myPlay = line.split(" ")[1].toLowerCase(); let state = null; - // i'm sure there's a more mathemtical way of doing this + // i'm sure there's a more mathematical way of doing this // perhaps by converting the rock/paper/scissors into numbers // but this is less to think about and there's not too much to manually write switch (myPlay) { case "x": // rock - pointsThisTime += 1; // we get 1 point for chosing rock + pointsThisTime += 1; // we get 1 point for choosing rock if (theirPlay == "a") state = "draw"; // they chose rock if (theirPlay == "b") state = "loss"; // they chose paper if (theirPlay == "c") state = "win"; // they chose scissors break; case "y": // paper - pointsThisTime += 2; // we get 2 points for chosing paper + pointsThisTime += 2; // we get 2 points for choosing paper if (theirPlay == "a") state = "win"; // they chose rock if (theirPlay == "b") state = "draw"; // they chose paper if (theirPlay == "c") state = "loss"; // they chose scissors break; case "z": // scissors - pointsThisTime += 3; // we get 3 points for chosing scissors + pointsThisTime += 3; // we get 3 points for choosing scissors if (theirPlay == "a") state = "loss"; // they chose rock if (theirPlay == "b") state = "win"; // they chose paper if (theirPlay == "c") state = "draw"; // they chose scissors From 422c80e5d3517c9a0c66e7667723334f43b418cf Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Fri, 2 Dec 2022 17:58:16 +0000 Subject: [PATCH 08/52] more spelling (i am a pro) --- day2/day2-pt2.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/day2/day2-pt2.js b/day2/day2-pt2.js index 1cdeb59..3d183eb 100644 --- a/day2/day2-pt2.js +++ b/day2/day2-pt2.js @@ -22,7 +22,7 @@ for (let line of input.split("\n")) { needTo = "lose"; if (theirPlay == "a") myPlay = "z"; // they chose rock - to lose we need to pick scissors if (theirPlay == "b") myPlay = "x"; // they chose paper - to lose we need to pick rock - if (theirPlay == "c") myPlay = "y"; // they chose scissors - to lose we need to pick paper + if (theirPlay == "c") myPlay = "y"; // they chose scissors - to lose we need to pick paper break; case "y": // we need to draw needTo = "draw"; @@ -41,19 +41,19 @@ for (let line of input.split("\n")) { // do as part one now we've changed our shape switch (myPlay) { case "x": // rock - pointsThisTime += 1; // we get 1 point for chosing rock + pointsThisTime += 1; // we get 1 point for choosing rock if (theirPlay == "a") state = "draw"; // they chose rock if (theirPlay == "b") state = "loss"; // they chose paper if (theirPlay == "c") state = "win"; // they chose scissors break; case "y": // paper - pointsThisTime += 2; // we get 2 points for chosing paper + pointsThisTime += 2; // we get 2 points for choosing paper if (theirPlay == "a") state = "win"; // they chose rock if (theirPlay == "b") state = "draw"; // they chose paper if (theirPlay == "c") state = "loss"; // they chose scissors break; case "z": // scissors - pointsThisTime += 3; // we get 3 points for chosing scissors + pointsThisTime += 3; // we get 3 points for choosing scissors if (theirPlay == "a") state = "loss"; // they chose rock if (theirPlay == "b") state = "win"; // they chose paper if (theirPlay == "c") state = "draw"; // they chose scissors From 98c348f479b0460ea0949e8ad339519737898f3e Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Sat, 3 Dec 2022 17:16:32 +0000 Subject: [PATCH 09/52] day three! --- day3/day3.js | 32 ++++++ day3/input.txt | 300 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 332 insertions(+) create mode 100644 day3/day3.js create mode 100644 day3/input.txt diff --git a/day3/day3.js b/day3/day3.js new file mode 100644 index 0000000..59e56e6 --- /dev/null +++ b/day3/day3.js @@ -0,0 +1,32 @@ +import { readFileSync } from "node:fs"; + +// Read Input file +const input = readFileSync("input.txt", { encoding: "utf8", flag: "r" }); + +let sum = 0; +for(let bag of input.split("\n")) { + if(!bag) continue; // blank lines + + let firstHalf = bag.slice(0, bag.length/2).split(''); // first compartment + let secondHalf = bag.slice(bag.length / 2, bag.length).split(''); // second compartment + + let matchingLetter = null; + firstHalf.forEach(letter => { + if(secondHalf.includes(letter)) { + matchingLetter = letter; + return; + } + }); + + let thisCharValue = matchingLetter.toLowerCase().charCodeAt() - 96; // use ascii codes to get pos in alphabet (1-26) + if(isCapital(matchingLetter)) thisCharValue += 26; // if it's a capital letter, we need to add 26 for 27-52 + + console.log(matchingLetter, thisCharValue); + sum += thisCharValue; +} +console.log(sum); + + +function isCapital(l) { + return (l.toUpperCase() == l) ? true : false; +} \ No newline at end of file diff --git a/day3/input.txt b/day3/input.txt new file mode 100644 index 0000000..d0ad78f --- /dev/null +++ b/day3/input.txt @@ -0,0 +1,300 @@ +PcPlnShmrLmBnmcwBhrmcmbHNGFGpwdFFwGNjNbGqNHH +tzQfRJfWZZztWzVtCTfRzFZjpFjNZjGLHbdHLDdjpb +CCQTzRLzvQVVfRzJfMPsnBlglgPmBgPmvSrl +RMfvbbszHTsssFPzDQPggpQJPQ +NSNcqVtLVGgDlpQBClVB +hmStGNNLhjNrpWLGSjWrZssbZTMMvTfMnThbRRTs +fTrTPGTbfftWBBmLjrJL +DqHwVMqVplDslmlZmpHVwNnShWZFdBBdjWBtWtdtWJSSLS +MNslpDvVHlwsmpQRgQgCfTTcvcRQ +pBBhRgDsMsswprBhvgRglZtFGFFRqZtZmRtNqtZPPN +TdmmzzmdZdqdGFtF +nmSccCVmSCpDCswMwl +NptqDsQtDTQzCvlzCpRlRp +jmZcndmjbZcjrmDvFMFFlwCvzFnF +jjgLVLrGcdDBNhWQTgHg +mLVhhfSMSTmMwClHGdpjDHjGdV +zPrZgJCgbsnrPtZzsCsbpRDjBRHnjGDRldRHppcG +JJrbsFrZqrgWbbqbrgWzJPNTwhTNCmmvfWCShhhmwwfm +ftgfljvgfgBTNvtggFDDGLGRDnMDzcQzncGt +VdbpbVdZwdwrsVVLRrMrDLDBGnBGcM +wmpWwWsHWBCCCPPvjvmSqlfTTmSNgN +jSqmzmmSSDRjLMLDwqjNcMMLTTflffWCCsRsTHnHVrfHWTsr +tdbgZpgBPdgGZGGFTHVpCsCVfVsJpnWl +FnPQFvbvhFFFbvBwScjhzcqSLLSzSN +bWdgrWwwFWbgzFWzrmNbdPqttChMSRnmqSPSnqtMRM +lcPJLDDPPfpMBCRJBtQtMh +lGDGjTGLLDHPPGjlPTsswsbHNFsNrFNFsrzr +VmtHfVhBLHVtlhphjZMdnQQZZqZmQDdzQQ +CPF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VWfSBRwTHLWHwsBWw +PGGjpCjQnJQGJcJnnQpjFWVSsZWVLRZLBcsWSZBRWS +FGQlpnJCbqqGGRCjjnlCqGMtdNmmmvdNmmmzvhbrmgMz +TstvBTdgBhqTsdTcPlfCSrNMrNnrCNNSNNgp +HwLQwQDZzDjnDbmMhNSnmm +FZLVzLLQHRRzwWHjdPlJctlJtlsllhRs +fBtPsMDDswHvBmmVdBlSBRcGGnhVhg +LWJbrpFqpTLTTjqqNWlhnRGGSnhrcSdlRlsh +JWNbbpjJzTbNNNJNJMvmvfZHvzDsHDCsZw +LPGnPNLtwGhFFnJPfsqpVVszzpsP +TcWdvlrcWddggrDBDDdDMmWzRJqfVQZqmsfZsRQzZfZzQJ +TldWrMrDdlDCDdMTcwSLVCSShLNSwHjhGF +JGsWWWQsJmPwQWbBPmccbcbqFfMMpFDVCDFVFVCDqqfFwD +ZtLnlvLnNtvLndnCmfMVSmVCClfpVp +zTzZtjnZNLNmZvdtznntHHZJbBRGBRQWcJGbGsbsJRPQWT +MLmlMTPtQtMNlhbqbbqhflBB +rcrvjpSvScbRbBvbDBPG +ZZJzSHpzPrJzHFmMVMFmHCLNtV From 496130f9d9d65a9b22d74ac8fb3deb2a11a086b8 Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Sat, 3 Dec 2022 17:17:46 +0000 Subject: [PATCH 10/52] remove function --- day3/day3.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/day3/day3.js b/day3/day3.js index 59e56e6..45fb99b 100644 --- a/day3/day3.js +++ b/day3/day3.js @@ -4,6 +4,7 @@ import { readFileSync } from "node:fs"; const input = readFileSync("input.txt", { encoding: "utf8", flag: "r" }); let sum = 0; + for(let bag of input.split("\n")) { if(!bag) continue; // blank lines @@ -19,14 +20,10 @@ for(let bag of input.split("\n")) { }); let thisCharValue = matchingLetter.toLowerCase().charCodeAt() - 96; // use ascii codes to get pos in alphabet (1-26) - if(isCapital(matchingLetter)) thisCharValue += 26; // if it's a capital letter, we need to add 26 for 27-52 + if (l.toUpperCase() == l) thisCharValue += 26; // if it's a capital letter, we need to add 26 for 27-52 console.log(matchingLetter, thisCharValue); sum += thisCharValue; } -console.log(sum); - -function isCapital(l) { - return (l.toUpperCase() == l) ? true : false; -} \ No newline at end of file +console.log(sum); \ No newline at end of file From 45169718cb91579d2a553aa03da04ffdbc2e8daf Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Sat, 3 Dec 2022 17:23:30 +0000 Subject: [PATCH 11/52] oops --- day3/day3.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/day3/day3.js b/day3/day3.js index 45fb99b..d513808 100644 --- a/day3/day3.js +++ b/day3/day3.js @@ -20,7 +20,7 @@ for(let bag of input.split("\n")) { }); let thisCharValue = matchingLetter.toLowerCase().charCodeAt() - 96; // use ascii codes to get pos in alphabet (1-26) - if (l.toUpperCase() == l) thisCharValue += 26; // if it's a capital letter, we need to add 26 for 27-52 + if (matchingLetter.toUpperCase() == matchingLetter) thisCharValue += 26; // if it's a capital letter, we need to add 26 for 27-52 console.log(matchingLetter, thisCharValue); sum += thisCharValue; From c63b16848af4f71543d3a072644c778e495f9fe7 Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Sat, 3 Dec 2022 17:52:00 +0000 Subject: [PATCH 12/52] all hail our new overlords --- day3/day3-pt2.js | 58 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 day3/day3-pt2.js diff --git a/day3/day3-pt2.js b/day3/day3-pt2.js new file mode 100644 index 0000000..d6b1163 --- /dev/null +++ b/day3/day3-pt2.js @@ -0,0 +1,58 @@ +import { readFileSync } from "node:fs"; + +// Read Input file +const input = readFileSync("input.txt", { encoding: "utf8", flag: "r" }); + +let sum = 0; // total sum +let i = 1; // loop index, starts at one for % +let thisThree = []; // each group of three bags + +for(let bag of input.split("\n")) { + if(!bag) continue; // blank lines + + thisThree.push(bag); // add this bag to the current group + + // every three we can work on the group + if (i % 3 == 0) { + let commonChar = getCommonCharacter(thisThree[0].split(''), thisThree[1].split(''), thisThree[2].split('')); + + let thisCharValue = commonChar.toLowerCase().charCodeAt() - 96; // use ascii codes to get pos in alphabet (1-26) + if (commonChar.toUpperCase() == commonChar) thisCharValue += 26; // if it's a capital letter, we need to add 26 for 27-52 + + console.log(thisThree, commonChar, thisCharValue); + + sum += thisCharValue; + + // wipe the group now we're done + thisThree = []; + } + + i++; +} + +console.log(sum); + + +// Out of curiosity, I got the new OpenAI chatbot to write this bit +// https://chat.openai.com/chat +// prompt: "in javascript, write a function to get the only common character across three arrays of single character strings" +// took a few attempts to get a working version, it got very confident that there were no problems with some obviously broken implementations + +// == BEGIN AI STUFF == +function getCommonCharacter(arr1, arr2, arr3) { + // Create a Set from each array to remove duplicates + const set1 = new Set(arr1); + const set2 = new Set(arr2); + const set3 = new Set(arr3); + + // Use the spread operator (...) to convert each Set to an array + // and then use the Array.filter() method to keep only the elements + // that are present in all three arrays + const common = [...set1, ...set2, ...set3].filter(c => set1.has(c) && set2.has(c) && set3.has(c)); + + // Return the first element in the common array, or null if the array is empty + return common.length > 0 ? common[0] : null; +} +// == END AI STUFF == + +// the future is terrifying but also this is SO COOL \ No newline at end of file From 99bfbd9ef55e67fa754ed8835a75d1af435d2cd8 Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Sun, 4 Dec 2022 06:00:54 +0000 Subject: [PATCH 13/52] use consts instead of lets --- day1/day1.js | 2 +- day2/day2-pt2.js | 4 ++-- day2/day2.js | 6 +++--- day3/day3-pt2.js | 4 ++-- day3/day3.js | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/day1/day1.js b/day1/day1.js index 71fe73b..3d58a28 100644 --- a/day1/day1.js +++ b/day1/day1.js @@ -8,7 +8,7 @@ const input = readFileSync("input.txt", { encoding: "utf8", flag: "r" }); let elves = []; let i = 0; -for (let line of input.split("\n")) { +for (const line of input.split("\n")) { if (line.length <= 1) i++; // if the line is blank, move onto the next elf if (!elves[i]) elves[i] = 0; // if the current elf hasnt been seen before, init with 0 elves[i] += parseInt(line); // add cals to current elf diff --git a/day2/day2-pt2.js b/day2/day2-pt2.js index 3d183eb..631e8cb 100644 --- a/day2/day2-pt2.js +++ b/day2/day2-pt2.js @@ -6,14 +6,14 @@ const input = readFileSync("input.txt", { encoding: "utf8", flag: "r" }); let totalPoints = 0; -for (let line of input.split("\n")) { +for (const line of input.split("\n")) { if (!line) continue; // ignore blank lines let pointsThisTime = 0; // points from this game let state = null; // win/loss/draw, for adding right # of points in each game let needTo = null; // win/loss/draw, only for logging later - let theirPlay = line.split(" ")[0].toLowerCase(); + const theirPlay = line.split(" ")[0].toLowerCase(); let myPlay = line.split(" ")[1].toLowerCase(); // this will change our shape depending on the goal of this game diff --git a/day2/day2.js b/day2/day2.js index 1e1bca4..4b682aa 100644 --- a/day2/day2.js +++ b/day2/day2.js @@ -6,13 +6,13 @@ const input = readFileSync("input.txt", { encoding: "utf8", flag: "r" }); let totalPoints = 0; -for (let line of input.split("\n")) { +for (const line of input.split("\n")) { if (!line) continue; // ignore blank lines let pointsThisTime = 0; // points from this game - let theirPlay = line.split(" ")[0].toLowerCase(); - let myPlay = line.split(" ")[1].toLowerCase(); + const theirPlay = line.split(" ")[0].toLowerCase(); + const myPlay = line.split(" ")[1].toLowerCase(); let state = null; // i'm sure there's a more mathematical way of doing this diff --git a/day3/day3-pt2.js b/day3/day3-pt2.js index d6b1163..60f6367 100644 --- a/day3/day3-pt2.js +++ b/day3/day3-pt2.js @@ -7,14 +7,14 @@ let sum = 0; // total sum let i = 1; // loop index, starts at one for % let thisThree = []; // each group of three bags -for(let bag of input.split("\n")) { +for(const bag of input.split("\n")) { if(!bag) continue; // blank lines thisThree.push(bag); // add this bag to the current group // every three we can work on the group if (i % 3 == 0) { - let commonChar = getCommonCharacter(thisThree[0].split(''), thisThree[1].split(''), thisThree[2].split('')); + const commonChar = getCommonCharacter(thisThree[0].split(''), thisThree[1].split(''), thisThree[2].split('')); let thisCharValue = commonChar.toLowerCase().charCodeAt() - 96; // use ascii codes to get pos in alphabet (1-26) if (commonChar.toUpperCase() == commonChar) thisCharValue += 26; // if it's a capital letter, we need to add 26 for 27-52 diff --git a/day3/day3.js b/day3/day3.js index d513808..2a92da4 100644 --- a/day3/day3.js +++ b/day3/day3.js @@ -5,11 +5,11 @@ const input = readFileSync("input.txt", { encoding: "utf8", flag: "r" }); let sum = 0; -for(let bag of input.split("\n")) { +for(const bag of input.split("\n")) { if(!bag) continue; // blank lines - let firstHalf = bag.slice(0, bag.length/2).split(''); // first compartment - let secondHalf = bag.slice(bag.length / 2, bag.length).split(''); // second compartment + const firstHalf = bag.slice(0, bag.length/2).split(''); // first compartment + const secondHalf = bag.slice(bag.length / 2, bag.length).split(''); // second compartment let matchingLetter = null; firstHalf.forEach(letter => { From 6b9d5cd686bdcae7ea2bb8f7fbeb695a39299cef Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Sun, 4 Dec 2022 06:08:07 +0000 Subject: [PATCH 14/52] day 4 broken solution i want to keep for posterity --- day4/day4.js | 47 +++ day4/input.txt | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1047 insertions(+) create mode 100644 day4/day4.js create mode 100644 day4/input.txt diff --git a/day4/day4.js b/day4/day4.js new file mode 100644 index 0000000..0fce916 --- /dev/null +++ b/day4/day4.js @@ -0,0 +1,47 @@ +import { readFileSync } from "node:fs"; + +// Read Input file +const input = readFileSync("input.txt", { encoding: "utf8", flag: "r" }); + +let count = 0; +for(const group of input.split("\n")) { + if(!group) continue; // empty group + + let contained = false; + + const firstElfRange = group.split(',')[0]; + const secondElfRange = group.split(',')[1]; + + const firstElfLowest = firstElfRange.split('-')[0]; + const firstElfHighest = firstElfRange.split('-')[1]; + + const secondElfLowest = secondElfRange.split('-')[0]; + const secondElfHighest = secondElfRange.split('-')[1]; + + if (secondElfLowest >= firstElfLowest && secondElfHighest <= firstElfHighest) contained = true; + if (firstElfLowest >= secondElfLowest && firstElfHighest <= secondElfHighest) contained = true; + + // console.log(group, contained); + if(contained) { + console.log(group, getBetweenRange(firstElfRange), getBetweenRange(secondElfRange)); + } + + if (contained) count++; +} + +console.log(count); + + +// turns out this wasnt required oops +function getBetweenRange(range) { + let nums = []; + + const from = parseInt(range.split('-')[0]); + const to = parseInt(range.split('-')[1]); + + for(let i = from; i <= to; i++) { + nums.push(i); + } + + return nums.sort((a, b) => { return a - b }); // sort from smallest to largest and return +} \ No newline at end of file diff --git a/day4/input.txt b/day4/input.txt new file mode 100644 index 0000000..4aead77 --- /dev/null +++ b/day4/input.txt @@ -0,0 +1,1000 @@ +20-45,13-44 +7-8,8-28 +3-39,14-97 +35-99,35-98 +18-49,17-19 +33-34,34-46 +46-58,58-75 +4-93,25-97 +92-99,7-91 +61-62,24-61 +35-62,34-63 +85-87,3-86 +9-49,7-48 +5-87,87-95 +3-3,3-82 +13-63,25-62 +4-99,1-98 +72-80,74-77 +9-96,95-97 +50-68,51-76 +34-80,33-33 +37-98,21-37 +9-71,10-72 +40-94,39-94 +1-88,88-92 +46-47,46-51 +14-59,14-60 +69-99,22-95 +9-66,9-65 +62-69,64-69 +6-40,16-70 +58-97,9-82 +12-56,12-46 +71-85,25-70 +70-86,86-97 +47-70,46-69 +11-65,65-66 +56-58,57-85 +33-66,33-65 +67-67,10-67 +21-55,20-22 +15-72,15-71 +19-92,45-93 +38-82,38-83 +23-90,90-90 +96-98,5-97 +33-38,32-33 +42-42,26-41 +31-92,30-93 +22-58,4-47 +3-49,49-59 +29-61,11-12 +5-81,4-81 +68-91,67-92 +6-87,5-86 +73-73,59-74 +16-70,26-31 +25-58,24-67 +2-47,47-54 +5-73,4-74 +58-98,1-99 +7-94,95-97 +11-63,11-12 +25-54,53-55 +90-94,93-95 +6-61,7-62 +47-63,27-62 +30-46,47-47 +67-94,94-95 +60-95,95-96 +35-83,83-84 +20-82,19-82 +28-29,28-88 +32-45,46-66 +55-78,79-79 +21-55,20-21 +8-10,11-98 +21-71,20-20 +18-19,19-21 +23-76,24-76 +22-96,23-95 +66-97,66-98 +89-91,25-90 +21-64,21-26 +77-80,77-86 +32-89,24-88 +37-93,36-36 +33-59,60-98 +7-91,6-7 +2-86,2-56 +85-97,86-96 +80-80,42-80 +16-87,27-86 +4-94,5-93 +34-37,36-38 +6-92,3-6 +22-85,21-21 +9-9,9-92 +31-87,31-86 +58-98,97-99 +1-98,1-87 +6-66,5-67 +27-54,28-55 +6-27,12-38 +22-29,4-28 +19-19,20-88 +64-98,64-85 +6-97,6-86 +13-72,72-73 +6-12,12-75 +11-34,10-16 +18-89,7-18 +9-67,3-9 +5-6,5-46 +45-53,53-56 +48-95,14-50 +93-99,4-93 +19-35,20-35 +22-77,21-78 +13-71,12-71 +24-39,23-39 +64-78,15-65 +11-41,10-11 +49-75,3-76 +40-87,87-99 +42-44,17-43 +37-94,28-93 +56-58,53-57 +98-98,3-98 +13-72,12-73 +39-86,40-86 +18-18,19-37 +24-89,25-64 +45-71,44-71 +7-69,8-69 +6-87,1-88 +45-88,44-45 +83-96,78-95 +7-65,64-73 +11-96,8-97 +32-52,14-31 +40-94,40-93 +12-17,8-18 +27-43,28-42 +37-95,10-95 +22-93,20-23 +37-84,36-85 +3-98,98-98 +25-92,1-81 +68-73,56-74 +75-78,72-89 +31-80,80-80 +33-85,56-86 +7-98,4-99 +25-52,51-66 +80-87,1-80 +7-99,2-8 +14-56,13-13 +32-52,33-98 +33-87,33-87 +33-98,34-75 +52-53,52-75 +1-6,5-20 +65-98,82-86 +9-99,4-98 +19-60,11-12 +3-77,4-82 +18-78,18-88 +3-7,7-99 +17-89,17-90 +61-94,26-87 +51-73,51-73 +30-87,30-30 +6-67,19-66 +2-86,2-98 +20-82,19-20 +39-82,38-88 +4-95,4-98 +5-46,33-46 +4-66,1-3 +5-97,6-98 +2-91,91-91 +7-93,8-92 +26-62,25-67 +35-37,36-36 +3-98,1-3 +31-69,32-68 +2-2,4-46 +94-96,1-95 +32-46,31-45 +2-55,1-54 +31-91,32-90 +25-62,26-61 +22-30,32-94 +57-96,55-95 +1-13,3-95 +18-70,18-78 +2-2,2-98 +8-50,49-62 +37-65,7-38 +18-47,32-48 +12-55,12-86 +2-6,2-94 +1-98,98-98 +1-23,5-72 +38-52,39-54 +40-40,41-96 +88-89,16-88 +22-32,21-33 +39-84,85-87 +18-19,18-92 +21-99,6-84 +54-56,29-55 +12-23,22-91 +38-43,36-42 +8-68,31-73 +5-82,5-92 +45-66,41-66 +61-70,60-83 +58-70,13-58 +47-57,48-56 +66-91,65-74 +69-69,30-69 +10-91,11-91 +76-90,76-99 +3-79,17-78 +2-99,2-99 +98-99,52-98 +19-26,25-71 +5-93,15-94 +70-72,19-71 +56-85,55-84 +57-91,57-93 +2-2,3-95 +3-4,6-98 +2-93,1-1 +6-87,7-88 +7-96,95-98 +39-96,9-96 +5-94,4-5 +40-96,39-96 +18-92,17-89 +26-74,11-11 +89-97,55-94 +4-92,2-93 +67-97,97-98 +64-85,63-84 +2-70,14-69 +3-43,3-6 +4-70,4-4 +11-12,12-80 +20-34,35-54 +30-47,9-46 +11-95,46-94 +32-94,33-93 +97-98,96-98 +4-11,3-13 +1-1,3-53 +6-90,90-91 +34-79,8-80 +57-92,57-93 +45-45,3-45 +35-53,35-52 +6-28,5-29 +9-81,81-81 +71-72,71-92 +20-50,18-72 +17-74,1-17 +38-73,14-73 +62-85,13-71 +47-68,47-68 +27-72,26-73 +7-89,88-90 +97-99,8-97 +37-92,36-36 +39-79,40-67 +1-89,1-88 +20-71,19-19 +11-83,10-83 +37-37,8-37 +88-95,13-87 +36-59,18-58 +52-84,64-85 +12-78,11-77 +42-82,47-83 +34-95,35-95 +63-88,11-64 +62-70,58-60 +45-92,45-86 +13-99,12-98 +6-7,8-8 +7-97,97-98 +48-48,1-48 +74-80,75-79 +98-98,7-97 +69-80,69-79 +18-59,18-59 +15-73,15-74 +55-79,55-78 +59-67,58-67 +7-95,8-95 +71-77,78-78 +3-52,3-53 +15-54,8-46 +21-39,21-50 +34-61,9-34 +69-69,70-70 +3-27,1-2 +19-65,19-64 +22-99,7-98 +21-50,51-86 +4-96,14-95 +6-83,83-84 +30-30,31-76 +21-49,48-50 +4-7,9-82 +20-89,13-20 +22-40,23-39 +94-95,6-93 +2-3,3-74 +54-81,37-82 +18-91,17-91 +29-77,78-92 +16-73,73-73 +25-78,43-54 +39-39,37-58 +52-94,52-53 +18-50,8-13 +3-3,3-99 +96-99,1-96 +36-37,35-36 +3-25,7-81 +29-48,14-49 +96-98,3-97 +25-95,96-97 +14-96,1-8 +72-80,80-80 +51-88,29-50 +24-64,19-63 +28-66,29-52 +14-97,13-14 +52-53,53-98 +11-63,12-64 +30-63,22-64 +18-25,16-18 +21-54,21-88 +87-88,32-88 +19-87,17-17 +55-65,20-66 +44-45,45-87 +55-61,54-55 +26-27,26-98 +50-64,32-75 +33-95,33-33 +7-98,98-99 +19-35,18-18 +78-99,12-79 +11-13,14-99 +5-98,4-5 +52-72,51-53 +49-97,17-96 +14-95,13-94 +20-84,5-19 +90-90,66-90 +19-57,30-52 +21-89,89-91 +59-60,24-59 +66-75,17-67 +53-53,54-97 +48-89,49-88 +57-63,1-64 +2-3,2-98 +15-98,1-97 +39-46,39-81 +71-72,60-71 +53-96,53-97 +3-74,4-73 +58-93,58-93 +3-64,1-1 +47-72,42-44 +32-82,82-83 +40-41,7-40 +7-22,8-23 +96-99,39-95 +89-90,3-89 +7-95,95-98 +23-60,24-59 +5-24,24-59 +5-45,4-44 +9-9,9-94 +18-42,41-91 +51-53,61-68 +14-79,7-78 +47-93,8-47 +5-97,5-97 +10-98,9-99 +6-81,7-80 +32-37,36-60 +9-77,9-78 +18-43,17-17 +91-96,2-68 +36-92,30-91 +16-36,2-11 +6-74,62-95 +6-97,7-98 +78-79,31-78 +56-90,90-91 +9-38,2-10 +9-56,28-45 +17-77,16-76 +18-18,18-93 +8-65,8-63 +78-82,28-83 +5-80,6-53 +24-32,23-68 +7-39,8-94 +41-86,86-94 +62-64,59-64 +45-93,45-86 +83-86,30-92 +32-80,11-33 +16-97,17-97 +4-84,85-85 +3-99,3-4 +83-83,16-83 +30-75,71-76 +17-82,81-89 +43-56,28-55 +1-49,48-49 +13-53,12-53 +3-13,27-76 +32-65,32-82 +17-92,92-92 +77-81,10-79 +36-85,96-97 +1-2,1-95 +66-90,66-89 +7-37,7-50 +13-92,13-80 +32-96,31-96 +13-52,10-53 +61-83,1-60 +29-55,12-30 +78-80,4-79 +1-1,6-66 +3-8,9-83 +2-81,1-94 +27-43,27-43 +16-17,17-98 +6-9,8-43 +38-78,39-78 +20-99,13-92 +36-93,52-92 +3-10,11-74 +69-74,8-69 +27-43,28-36 +20-77,19-76 +24-86,18-85 +13-44,45-78 +6-27,7-26 +7-42,2-6 +73-75,5-74 +19-24,23-37 +23-71,36-99 +3-99,15-98 +5-98,3-3 +4-62,3-62 +2-18,1-99 +3-95,7-96 +37-63,43-68 +60-71,54-59 +28-35,34-88 +68-80,67-81 +77-89,76-88 +22-48,23-48 +95-96,66-95 +17-64,18-48 +69-88,18-74 +96-98,39-97 +8-45,45-45 +7-18,19-89 +32-42,12-41 +76-80,52-76 +45-93,46-94 +1-97,3-97 +71-82,70-83 +46-47,28-46 +10-11,12-91 +23-24,24-99 +36-65,36-65 +96-98,11-95 +47-57,47-56 +5-11,10-99 +39-56,38-55 +62-97,61-61 +19-99,99-99 +93-93,13-92 +72-74,73-78 +87-92,80-91 +95-95,18-95 +87-88,12-87 +41-86,85-91 +1-1,3-42 +20-94,20-62 +1-68,1-1 +2-97,1-98 +25-63,63-64 +1-3,3-99 +28-29,29-38 +34-87,54-88 +69-69,64-69 +24-53,37-54 +9-79,8-79 +22-69,23-68 +44-51,44-81 +9-94,5-8 +11-93,93-94 +9-17,7-16 +63-63,6-62 +45-91,13-60 +13-97,12-12 +9-33,8-8 +25-26,26-39 +25-83,25-84 +9-73,73-89 +20-76,20-84 +69-78,2-68 +5-46,4-47 +25-32,29-35 +90-94,16-90 +74-80,77-80 +46-52,52-76 +45-48,12-48 +61-62,26-61 +8-99,2-9 +4-95,4-96 +60-92,59-93 +30-51,30-31 +21-88,16-18 +11-89,12-90 +46-46,2-45 +4-99,2-36 +39-47,40-48 +42-78,54-55 +7-86,7-87 +9-99,2-98 +21-94,22-60 +11-99,11-96 +13-57,43-56 +13-48,49-79 +93-95,3-94 +31-80,30-80 +16-75,74-76 +53-56,54-60 +5-53,53-54 +53-53,52-52 +8-91,9-92 +26-65,16-65 +65-67,59-74 +52-52,26-52 +15-43,14-44 +58-58,57-70 +77-99,78-98 +90-90,76-92 +36-50,35-77 +7-36,8-35 +36-91,37-93 +3-41,2-2 +94-95,59-94 +6-86,6-86 +3-83,2-3 +49-66,65-67 +43-71,71-97 +9-10,10-75 +4-80,80-80 +32-67,8-66 +46-47,34-47 +85-94,6-96 +33-35,18-34 +6-55,5-55 +2-74,74-74 +52-94,52-53 +20-93,3-31 +90-92,90-93 +20-52,51-53 +97-98,10-97 +4-84,2-85 +22-93,93-94 +53-88,54-89 +9-30,19-37 +5-39,38-39 +50-90,13-91 +81-94,80-93 +18-86,19-29 +1-81,18-80 +85-95,23-86 +77-78,77-95 +28-87,27-27 +24-25,25-94 +4-93,2-92 +1-92,2-93 +17-35,35-49 +2-3,2-52 +46-46,37-46 +10-94,9-95 +5-57,6-57 +14-89,34-90 +13-13,14-68 +37-67,36-92 +35-92,8-34 +7-49,7-50 +33-95,9-92 +28-29,27-78 +83-84,12-83 +6-34,6-93 +9-56,9-56 +2-29,2-10 +11-11,12-88 +24-58,16-25 +95-99,28-95 +90-92,31-91 +15-35,15-36 +31-84,19-63 +3-50,64-93 +31-94,30-93 +7-89,7-8 +27-62,8-49 +20-87,21-64 +56-70,56-93 +1-37,37-37 +19-85,84-86 +18-20,19-79 +23-74,20-63 +5-93,6-92 +6-73,4-74 +86-91,85-98 +13-21,21-36 +60-94,59-59 +33-50,49-51 +25-58,18-52 +94-94,34-94 +50-55,50-50 +1-96,1-29 +19-99,20-99 +61-62,61-85 +4-18,18-18 +78-78,45-78 +47-92,46-93 +87-94,18-87 +4-5,4-95 +57-92,7-76 +35-60,1-35 +2-89,41-90 +5-6,6-37 +21-68,16-69 +49-89,44-58 +3-60,60-62 +49-99,2-49 +20-67,13-44 +16-25,25-62 +4-94,4-99 +52-85,2-29 +9-17,19-89 +6-72,7-71 +5-82,17-82 +64-75,63-75 +26-60,29-93 +10-53,54-61 +81-83,5-80 +87-98,58-97 +11-33,12-34 +67-67,67-75 +40-60,16-40 +9-64,8-63 +27-95,27-95 +18-18,19-38 +27-98,28-97 +5-14,14-62 +83-84,84-88 +11-93,11-93 +2-5,6-94 +58-68,57-67 +23-25,24-70 +12-32,31-55 +31-35,20-34 +8-49,23-50 +58-85,58-87 +4-94,1-4 +40-41,41-71 +21-94,10-21 +29-95,28-94 +19-74,18-18 +1-49,1-2 +39-46,1-45 +65-66,22-65 +28-92,92-99 +9-80,8-8 +21-93,14-22 +11-94,93-98 +26-69,60-68 +8-44,14-45 +65-67,51-66 +34-94,93-95 +11-33,33-33 +32-97,98-98 +10-97,10-11 +47-72,46-86 +10-10,10-97 +4-79,4-80 +24-95,94-99 +12-79,66-80 +56-62,50-61 +27-94,26-95 +27-70,27-27 +26-77,76-78 +85-86,41-85 +24-83,24-84 +31-73,63-71 +6-75,6-30 +3-71,71-90 +32-56,31-76 +16-73,16-16 +55-73,56-72 +32-88,32-90 +17-17,18-65 +10-94,94-94 +47-85,47-59 +12-85,11-84 +3-90,89-91 +36-51,36-55 +5-57,5-56 +1-58,40-57 +46-65,46-50 +72-83,78-94 +98-98,7-97 +30-52,30-51 +11-98,10-98 +91-99,98-99 +66-94,64-94 +65-65,27-64 +37-37,30-37 +33-76,17-34 +26-28,20-27 +9-97,8-98 +2-82,3-83 +16-88,5-64 +11-26,42-48 +90-91,8-90 +44-96,45-67 +94-94,10-93 +59-94,59-94 +18-53,18-52 +2-48,2-48 +3-3,5-92 +95-96,3-95 +10-26,25-39 +12-12,13-47 +5-5,6-17 +39-51,50-52 +2-98,3-98 +7-19,18-76 +9-9,10-55 +5-10,26-99 +26-88,26-90 +1-37,1-2 +21-71,21-70 +71-82,72-82 +81-92,53-88 +3-96,2-96 +15-72,15-71 +6-43,7-9 +17-79,17-18 +19-53,18-69 +2-2,4-91 +99-99,1-99 +25-33,26-33 +75-78,32-77 +94-95,5-94 +53-89,45-52 +8-96,4-99 +7-76,6-6 +8-30,10-48 +9-71,9-41 +22-22,22-57 +5-21,20-22 +16-99,16-94 +2-50,1-96 +25-36,24-35 +16-90,52-84 +10-32,9-33 +76-78,35-77 +2-98,3-98 +56-58,8-62 +51-68,54-58 +57-76,76-87 +15-69,15-75 +64-83,83-90 +68-74,69-69 +7-8,8-36 +23-97,22-23 +23-81,2-23 +82-86,12-86 +4-73,4-32 +39-78,38-79 +46-82,38-68 +63-84,83-97 +42-90,42-91 +2-56,2-29 +14-96,13-81 +46-53,53-54 +46-52,31-94 +37-92,38-93 +96-97,36-96 +2-58,2-2 +51-94,50-93 +24-45,26-64 +51-80,52-79 +48-56,49-58 +64-97,97-97 +8-65,15-66 +3-8,7-19 +10-63,10-63 +74-74,74-74 +27-84,16-31 +45-62,10-63 +82-84,5-83 +4-8,5-6 +60-69,59-71 +4-95,8-94 +25-93,6-26 +9-68,8-83 +6-99,6-98 +63-64,9-63 +37-88,10-56 +1-56,1-97 +11-89,6-12 +16-98,6-16 +9-52,8-53 +45-95,44-45 +12-96,11-96 +1-4,3-95 +34-39,19-38 +14-90,13-89 +58-83,58-81 +25-91,13-92 +49-79,70-80 +14-92,91-93 +26-48,17-47 +24-96,25-96 +41-66,47-52 +26-37,26-38 +2-89,3-90 +12-56,12-55 +21-49,21-49 +29-68,28-67 +95-96,76-94 +20-65,19-19 +11-70,10-11 +21-92,22-93 +15-90,11-89 +1-92,1-1 +66-91,14-90 +64-73,1-98 +39-39,39-45 +62-86,61-86 +16-89,89-90 +19-95,7-89 +67-90,50-90 +63-96,4-62 +3-74,2-74 +72-80,71-81 +56-65,56-82 +93-93,79-92 +24-87,1-23 +31-35,40-64 +4-97,3-3 +45-45,45-72 +65-66,42-65 +42-95,41-94 +3-4,3-94 +14-88,88-89 +28-83,28-89 +51-79,27-64 +14-18,14-17 +7-97,5-6 +18-34,35-35 +1-99,9-99 +33-54,43-54 +11-42,32-43 +2-30,1-29 +6-88,7-88 +45-50,37-53 +39-84,37-83 +34-51,27-73 +21-52,16-53 +2-6,4-7 +15-46,4-47 +49-50,1-50 +39-80,10-38 +23-59,24-58 +21-72,22-72 +22-73,73-74 +25-47,26-48 +4-98,5-99 +3-3,3-91 +21-98,22-99 +14-33,32-32 +14-20,13-24 +19-92,5-88 +90-98,90-99 +29-60,60-61 +3-71,10-92 +7-22,7-92 +8-37,7-7 +16-88,17-88 +29-71,30-72 +44-85,84-86 +70-72,49-71 +41-80,41-55 +32-32,33-69 +2-55,3-55 +73-73,74-95 +16-71,6-72 +41-80,40-79 +33-40,27-34 +21-96,96-98 +22-22,23-38 +30-93,31-92 +16-20,19-71 +22-99,98-99 +5-82,5-71 +33-45,32-34 +65-77,76-84 +72-76,10-73 +2-4,4-16 +24-68,23-23 +43-59,42-58 +15-59,16-59 +8-85,2-8 +84-86,5-85 +9-82,8-82 +1-6,6-86 +65-76,65-75 +3-60,4-59 +76-85,51-84 +3-65,4-16 +2-97,1-96 +2-4,6-85 +18-91,91-92 +42-43,42-91 +25-96,24-26 +7-92,92-93 +29-61,6-28 +5-5,5-70 +22-70,21-69 +25-74,73-74 +45-52,49-54 +1-85,2-85 +5-94,10-80 +37-38,37-54 +15-73,15-72 +27-62,9-26 +8-93,5-8 +25-37,36-94 +3-95,4-96 +31-87,86-88 +62-63,63-90 +22-27,21-26 +93-93,34-80 +17-91,18-92 +75-86,15-75 +4-4,4-94 +10-65,9-66 +96-96,87-96 +4-29,2-5 +5-35,6-35 +8-75,8-85 +7-82,8-67 +15-90,15-16 +6-24,23-76 +62-96,98-98 +10-98,1-2 +3-51,23-95 +66-84,11-66 +24-77,23-95 +52-91,43-46 +10-96,11-96 +45-47,46-48 +10-83,2-10 +62-62,62-99 +34-71,70-91 +38-65,39-64 +33-68,34-69 +2-96,1-97 +24-51,52-82 +88-94,89-94 +23-23,24-87 +13-31,31-84 +63-65,2-64 +42-91,42-73 From 7e6346abae1083e500316d051376d56cdd7561c2 Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Sun, 4 Dec 2022 06:20:16 +0000 Subject: [PATCH 15/52] oh it wasn't broken i am just silly --- day4/day4.js | 53 ++++++++++++++++++++++------------------------------ 1 file changed, 22 insertions(+), 31 deletions(-) diff --git a/day4/day4.js b/day4/day4.js index 0fce916..854d192 100644 --- a/day4/day4.js +++ b/day4/day4.js @@ -4,44 +4,35 @@ import { readFileSync } from "node:fs"; const input = readFileSync("input.txt", { encoding: "utf8", flag: "r" }); let count = 0; + for(const group of input.split("\n")) { if(!group) continue; // empty group - - let contained = false; const firstElfRange = group.split(',')[0]; const secondElfRange = group.split(',')[1]; - const firstElfLowest = firstElfRange.split('-')[0]; - const firstElfHighest = firstElfRange.split('-')[1]; - - const secondElfLowest = secondElfRange.split('-')[0]; - const secondElfHighest = secondElfRange.split('-')[1]; - - if (secondElfLowest >= firstElfLowest && secondElfHighest <= firstElfHighest) contained = true; - if (firstElfLowest >= secondElfLowest && firstElfHighest <= secondElfHighest) contained = true; - - // console.log(group, contained); - if(contained) { - console.log(group, getBetweenRange(firstElfRange), getBetweenRange(secondElfRange)); + const firstElfLowest = parseInt(firstElfRange.split('-')[0]); + const firstElfHighest = parseInt(firstElfRange.split('-')[1]); + + const secondElfLowest = parseInt(secondElfRange.split('-')[0]); + const secondElfHighest = parseInt(secondElfRange.split('-')[1]); + + // if the second elf's sections are within the first elf's + // as in the example from aoc below: + // .2345678. 2 - 8 + // ..34567.. 3 - 7 + // second elf's lowest is greater than or eq to first elf's lowest + // second elf's highest is less than or eq to first elf's highest + if (secondElfLowest >= firstElfLowest && secondElfHighest <= firstElfHighest) { + count++; + continue; } - - if (contained) count++; -} - -console.log(count); - -// turns out this wasnt required oops -function getBetweenRange(range) { - let nums = []; - - const from = parseInt(range.split('-')[0]); - const to = parseInt(range.split('-')[1]); - - for(let i = from; i <= to; i++) { - nums.push(i); + // inverse of above; if first elf is within second elf + if (firstElfLowest >= secondElfLowest && firstElfHighest <= secondElfHighest) { + count++; + continue; } +} - return nums.sort((a, b) => { return a - b }); // sort from smallest to largest and return -} \ No newline at end of file +console.log(count); \ No newline at end of file From 527e3e8036388e1df42b3b152bb16213dd8da53a Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Sun, 4 Dec 2022 06:26:04 +0000 Subject: [PATCH 16/52] day 4 part 2 --- day4/day4-pt2.js | 54 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 day4/day4-pt2.js diff --git a/day4/day4-pt2.js b/day4/day4-pt2.js new file mode 100644 index 0000000..685e0cd --- /dev/null +++ b/day4/day4-pt2.js @@ -0,0 +1,54 @@ +import { readFileSync } from "node:fs"; + +// Read Input file +const input = readFileSync("input.txt", { encoding: "utf8", flag: "r" }); + +let count = 0; + +for(const group of input.split("\n")) { + if(!group) continue; // empty group + + const firstElfRange = getBetweenRange(group.split(',')[0]); + const secondElfRange = getBetweenRange(group.split(',')[1]); + + let overlap = false; + + // this could be made more efficient using one for loop + // taking into account the min/max of both arrays + // buuuuut that's effort and this works and got the answer + // so i am calling this a win + + // check if any of the first elf's sections are also in the second elf's + for(const section of firstElfRange) { + if(secondElfRange.includes(section)) { + overlap = true; + break; + } + } + + // likewise but for the second elf + for (const section of secondElfRange) { + if (firstElfRange.includes(section)) { + overlap = true; + break; + } + } + + if (overlap) count++; +} + +console.log(count); + +// turns out i did need this after all! +function getBetweenRange(range) { + let nums = []; + + const from = parseInt(range.split('-')[0]); + const to = parseInt(range.split('-')[1]); + + for (let i = from; i <= to; i++) { + nums.push(i); + } + + return nums.sort((a, b) => { return a - b }); // sort from smallest to largest and return +} \ No newline at end of file From 1e82c12ccdfccfc193852cabe275906060eb5ee2 Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Sun, 4 Dec 2022 06:42:55 +0000 Subject: [PATCH 17/52] switch to old require syntax for portability --- day1/day1.js | 2 +- day2/day2-pt2.js | 2 +- day2/day2.js | 2 +- day3/day3-pt2.js | 2 +- day3/day3.js | 2 +- day4/day4-pt2.js | 2 +- day4/day4.js | 2 +- package-lock.json | 27 --------------------------- package.json | 20 -------------------- 9 files changed, 7 insertions(+), 54 deletions(-) delete mode 100644 package-lock.json delete mode 100644 package.json diff --git a/day1/day1.js b/day1/day1.js index 3d58a28..16fd7d9 100644 --- a/day1/day1.js +++ b/day1/day1.js @@ -1,4 +1,4 @@ -import { readFileSync } from "node:fs"; +const readFileSync = require("fs").readFileSync; // Read Input file const input = readFileSync("input.txt", { encoding: "utf8", flag: "r" }); diff --git a/day2/day2-pt2.js b/day2/day2-pt2.js index 631e8cb..ff3f3f0 100644 --- a/day2/day2-pt2.js +++ b/day2/day2-pt2.js @@ -1,4 +1,4 @@ -import { readFileSync } from "node:fs"; +const readFileSync = require("fs").readFileSync; // Read Input file const input = readFileSync("input.txt", { encoding: "utf8", flag: "r" }); diff --git a/day2/day2.js b/day2/day2.js index 4b682aa..f892008 100644 --- a/day2/day2.js +++ b/day2/day2.js @@ -1,4 +1,4 @@ -import { readFileSync } from "node:fs"; +const readFileSync = require("fs").readFileSync; // Read Input file const input = readFileSync("input.txt", { encoding: "utf8", flag: "r" }); diff --git a/day3/day3-pt2.js b/day3/day3-pt2.js index 60f6367..a13a36c 100644 --- a/day3/day3-pt2.js +++ b/day3/day3-pt2.js @@ -1,4 +1,4 @@ -import { readFileSync } from "node:fs"; +const readFileSync = require("fs").readFileSync; // Read Input file const input = readFileSync("input.txt", { encoding: "utf8", flag: "r" }); diff --git a/day3/day3.js b/day3/day3.js index 2a92da4..ab2fc2c 100644 --- a/day3/day3.js +++ b/day3/day3.js @@ -1,4 +1,4 @@ -import { readFileSync } from "node:fs"; +const readFileSync = require("fs").readFileSync; // Read Input file const input = readFileSync("input.txt", { encoding: "utf8", flag: "r" }); diff --git a/day4/day4-pt2.js b/day4/day4-pt2.js index 685e0cd..70f8240 100644 --- a/day4/day4-pt2.js +++ b/day4/day4-pt2.js @@ -1,4 +1,4 @@ -import { readFileSync } from "node:fs"; +const readFileSync = require("fs").readFileSync; // Read Input file const input = readFileSync("input.txt", { encoding: "utf8", flag: "r" }); diff --git a/day4/day4.js b/day4/day4.js index 854d192..020358e 100644 --- a/day4/day4.js +++ b/day4/day4.js @@ -1,4 +1,4 @@ -import { readFileSync } from "node:fs"; +const readFileSync = require("fs").readFileSync; // Read Input file const input = readFileSync("input.txt", { encoding: "utf8", flag: "r" }); diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 129af88..0000000 --- a/package-lock.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "advent-of-code-2022", - "version": "1.0.0", - "lockfileVersion": 2, - "requires": true, - "packages": { - "": { - "version": "1.0.0", - "license": "ISC", - "dependencies": { - "fs": "^0.0.1-security" - } - }, - "node_modules/fs": { - "version": "0.0.1-security", - "resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz", - "integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w==" - } - }, - "dependencies": { - "fs": { - "version": "0.0.1-security", - "resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz", - "integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w==" - } - } -} diff --git a/package.json b/package.json deleted file mode 100644 index 510b389..0000000 --- a/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "advent-of-code-2022", - "version": "1.0.0", - "description": "Advent of Code 2022 Solutions", - "type": "module", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/itsmeimtom/advent-of-code-2022.git" - }, - "bugs": { - "url": "https://github.com/itsmeimtom/advent-of-code-2022/issues" - }, - "homepage": "https://github.com/itsmeimtom/advent-of-code-2022#readme", - "dependencies": { - "fs": "^0.0.1-security" - } -} From cecccbf7fd5c9eeb1d731d02ed1d96a38ce1ee2c Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Sun, 4 Dec 2022 06:47:31 +0000 Subject: [PATCH 18/52] format readme --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 90942c3..5a90fce 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ -# advent-of-code-2022 -Advent of Code 2022 Solutions +# Advent of Code 2022 Solutions + +Contains my solutions for the [Advent of Code 2022](https://adventofcode.com/2022) challenges. \ No newline at end of file From f77843a41c05d5edb01bf8e012c7a3e92183edab Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Sun, 4 Dec 2022 06:47:37 +0000 Subject: [PATCH 19/52] PACKAGES --- .gitignore | 4 ++-- day1/package.json | 5 +++++ day2/package.json | 5 +++++ day3/package.json | 5 +++++ day4/package.json | 5 +++++ 5 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 day1/package.json create mode 100644 day2/package.json create mode 100644 day3/package.json create mode 100644 day4/package.json diff --git a/.gitignore b/.gitignore index 82d30cc..a0da46f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ - -node_modules/ +*node_modules* +*package-lock.json diff --git a/day1/package.json b/day1/package.json new file mode 100644 index 0000000..7ea3a90 --- /dev/null +++ b/day1/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "fs": "^0.0.1-security" + } +} diff --git a/day2/package.json b/day2/package.json new file mode 100644 index 0000000..7ea3a90 --- /dev/null +++ b/day2/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "fs": "^0.0.1-security" + } +} diff --git a/day3/package.json b/day3/package.json new file mode 100644 index 0000000..7ea3a90 --- /dev/null +++ b/day3/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "fs": "^0.0.1-security" + } +} diff --git a/day4/package.json b/day4/package.json new file mode 100644 index 0000000..7ea3a90 --- /dev/null +++ b/day4/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "fs": "^0.0.1-security" + } +} From 06b513de9f70585a49cb7c0cef46ff23d82c73bc Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Mon, 5 Dec 2022 22:30:29 +0000 Subject: [PATCH 20/52] i didnt like this one (day 5) --- day5/day5.js | 59 +++++ day5/input-test.txt | 9 + day5/input.txt | 513 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 581 insertions(+) create mode 100644 day5/day5.js create mode 100644 day5/input-test.txt create mode 100644 day5/input.txt diff --git a/day5/day5.js b/day5/day5.js new file mode 100644 index 0000000..4433dcf --- /dev/null +++ b/day5/day5.js @@ -0,0 +1,59 @@ +const readFileSync = require("fs").readFileSync; + +// Read Input file +const input = readFileSync("input.txt", { encoding: "utf8", flag: "r" }); + + +let lookingAtStart = true; +let doneReverse = false; +let stacks = new Array(); + +for(const line of input.split("\n")) { + let blankLine = (line.length <= 1) ? true : false; + + if (blankLine) lookingAtStart = false; // whether we are looking at the input (the stacks from 1-9), we can use blank lines to determine this + + if (lookingAtStart === true) { // if we're looking at the start we need to process the input + const matched = line.match(/.{1,4}/g); + if(!matched) continue; + + let i = 0; + for (const crate of matched) { // split each line into groups of 4 chars + if (crate.match(/ [0-9] /g)) continue; // if the content is " X " we're at the bottom row so discard it + + let value = crate.replace(/\[|\]/g, "").replace(/ /g, "") // remove the square brackets and then spaces + + if (!stacks[i]) stacks[i] = new Array(); // init a new array if one doesn't exist for this stack + + if (value !== "") stacks[i].push(value); // add to the array if not a blank + + i++; + } + } else { // we can move on and work on the movements now + if (blankLine) continue; // skip over blank lines + + const commands = line.match(/[0-9]+/g); + const moveWhat = parseInt(commands[0]); // how many crates + const moveFrom = parseInt(commands[1] - 1); // from what stack (minus one since we are zero-indexed) + const moveTo = parseInt(commands[2] - 1); // to which stack (minus one since we are zero-indexed) + + console.log(`\n==new move command==\ngoing to move ${moveWhat} crates from stack ${moveFrom+1} (index ${moveFrom}) to stack ${moveTo+1} (index ${moveTo})`); + + for(let i = 1; i <= moveWhat; i++) { // repeat for how many crates we have to move + console.log(`moving crate #${i}/${moveWhat} with value ${stacks[moveFrom][0]}`); + + stacks[moveTo].unshift(stacks[moveFrom][0]); // add source crate to start of dest stack + stacks[moveFrom].shift(); // remove the first crate (the one we moved) from the source stack + } + } +} + + +stacks.forEach(s=>s.reverse()); // flip every stack so bottom is first element + +console.log(stacks); + +let bottomRows = ""; +stacks.forEach(s => bottomRows += s[s.length-1]); // append last crate of each stack + +console.log(bottomRows); diff --git a/day5/input-test.txt b/day5/input-test.txt new file mode 100644 index 0000000..84933bb --- /dev/null +++ b/day5/input-test.txt @@ -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 diff --git a/day5/input.txt b/day5/input.txt new file mode 100644 index 0000000..b401f42 --- /dev/null +++ b/day5/input.txt @@ -0,0 +1,513 @@ + [Q] [G] [M] + [B] [S] [V] [P] [R] + [T] [C] [F] [L] [V] [N] +[Q] [P] [H] [N] [S] [W] [C] +[F] [G] [B] [J] [B] [N] [Z] [L] +[L] [Q] [Q] [Z] [M] [Q] [F] [G] [D] +[S] [Z] [M] [G] [H] [C] [C] [H] [Z] +[R] [N] [S] [T] [P] [P] [W] [Q] [G] + 1 2 3 4 5 6 7 8 9 + +move 1 from 2 to 6 +move 3 from 7 to 9 +move 7 from 9 to 4 +move 2 from 5 to 3 +move 3 from 2 to 8 +move 14 from 4 to 5 +move 1 from 2 to 1 +move 1 from 2 to 3 +move 3 from 6 to 8 +move 3 from 6 to 9 +move 1 from 4 to 6 +move 5 from 9 to 8 +move 9 from 8 to 9 +move 3 from 3 to 8 +move 8 from 9 to 4 +move 2 from 1 to 7 +move 4 from 1 to 5 +move 2 from 7 to 1 +move 1 from 9 to 6 +move 7 from 4 to 7 +move 1 from 8 to 4 +move 1 from 9 to 8 +move 2 from 6 to 7 +move 7 from 7 to 3 +move 10 from 3 to 1 +move 1 from 3 to 2 +move 1 from 2 to 9 +move 1 from 9 to 8 +move 15 from 5 to 8 +move 1 from 6 to 9 +move 2 from 7 to 3 +move 11 from 1 to 8 +move 1 from 9 to 8 +move 1 from 1 to 5 +move 3 from 5 to 2 +move 2 from 6 to 9 +move 1 from 2 to 4 +move 2 from 4 to 5 +move 1 from 3 to 6 +move 5 from 8 to 3 +move 12 from 8 to 4 +move 2 from 2 to 5 +move 12 from 8 to 1 +move 1 from 6 to 9 +move 10 from 5 to 7 +move 3 from 3 to 9 +move 6 from 8 to 9 +move 2 from 3 to 5 +move 8 from 4 to 7 +move 1 from 3 to 2 +move 6 from 8 to 6 +move 8 from 9 to 3 +move 2 from 5 to 4 +move 1 from 2 to 3 +move 2 from 9 to 2 +move 1 from 9 to 2 +move 1 from 2 to 1 +move 2 from 2 to 4 +move 5 from 4 to 2 +move 3 from 2 to 3 +move 2 from 4 to 2 +move 18 from 7 to 3 +move 3 from 6 to 9 +move 1 from 6 to 3 +move 1 from 4 to 1 +move 1 from 6 to 3 +move 6 from 3 to 9 +move 2 from 2 to 6 +move 26 from 3 to 7 +move 2 from 2 to 3 +move 2 from 6 to 8 +move 3 from 1 to 5 +move 8 from 9 to 1 +move 1 from 8 to 5 +move 1 from 3 to 1 +move 2 from 9 to 3 +move 1 from 1 to 2 +move 12 from 1 to 7 +move 1 from 8 to 5 +move 2 from 3 to 5 +move 1 from 3 to 6 +move 2 from 6 to 2 +move 7 from 5 to 7 +move 1 from 4 to 2 +move 15 from 7 to 4 +move 1 from 4 to 9 +move 1 from 7 to 6 +move 14 from 4 to 2 +move 1 from 1 to 2 +move 5 from 1 to 5 +move 4 from 5 to 4 +move 1 from 6 to 3 +move 4 from 4 to 7 +move 1 from 9 to 2 +move 1 from 3 to 5 +move 2 from 5 to 1 +move 1 from 1 to 6 +move 2 from 1 to 5 +move 9 from 2 to 9 +move 1 from 6 to 1 +move 1 from 1 to 9 +move 1 from 5 to 4 +move 1 from 5 to 6 +move 4 from 7 to 2 +move 1 from 4 to 1 +move 18 from 7 to 1 +move 17 from 1 to 7 +move 4 from 9 to 5 +move 1 from 5 to 8 +move 1 from 1 to 4 +move 2 from 9 to 6 +move 3 from 9 to 7 +move 1 from 1 to 5 +move 1 from 7 to 5 +move 16 from 7 to 2 +move 1 from 4 to 2 +move 1 from 8 to 7 +move 1 from 9 to 8 +move 1 from 8 to 4 +move 3 from 5 to 3 +move 15 from 7 to 6 +move 7 from 6 to 4 +move 9 from 6 to 2 +move 2 from 5 to 7 +move 2 from 6 to 8 +move 4 from 4 to 7 +move 2 from 8 to 1 +move 11 from 2 to 7 +move 1 from 4 to 2 +move 2 from 3 to 6 +move 3 from 4 to 5 +move 12 from 7 to 1 +move 1 from 7 to 3 +move 31 from 2 to 4 +move 3 from 7 to 2 +move 1 from 6 to 3 +move 1 from 5 to 1 +move 1 from 5 to 2 +move 2 from 3 to 4 +move 1 from 6 to 1 +move 1 from 3 to 6 +move 1 from 5 to 6 +move 1 from 2 to 4 +move 11 from 1 to 4 +move 5 from 1 to 5 +move 1 from 7 to 3 +move 3 from 5 to 8 +move 1 from 8 to 7 +move 1 from 5 to 3 +move 2 from 8 to 5 +move 2 from 6 to 2 +move 2 from 5 to 1 +move 1 from 7 to 9 +move 1 from 3 to 9 +move 2 from 9 to 5 +move 1 from 1 to 6 +move 1 from 6 to 5 +move 1 from 3 to 5 +move 13 from 4 to 8 +move 5 from 2 to 3 +move 3 from 3 to 4 +move 1 from 8 to 6 +move 4 from 5 to 2 +move 1 from 1 to 5 +move 1 from 3 to 7 +move 2 from 5 to 4 +move 11 from 4 to 5 +move 1 from 3 to 7 +move 15 from 4 to 2 +move 1 from 6 to 4 +move 19 from 2 to 8 +move 8 from 8 to 3 +move 2 from 3 to 8 +move 7 from 5 to 4 +move 6 from 3 to 4 +move 8 from 4 to 5 +move 7 from 4 to 6 +move 2 from 7 to 5 +move 9 from 5 to 6 +move 13 from 8 to 3 +move 3 from 4 to 3 +move 6 from 3 to 4 +move 6 from 8 to 2 +move 4 from 5 to 9 +move 5 from 8 to 7 +move 4 from 6 to 2 +move 5 from 3 to 5 +move 1 from 6 to 9 +move 8 from 2 to 6 +move 1 from 8 to 7 +move 1 from 2 to 5 +move 1 from 4 to 1 +move 3 from 3 to 1 +move 1 from 7 to 3 +move 4 from 9 to 8 +move 6 from 6 to 2 +move 2 from 8 to 4 +move 1 from 7 to 6 +move 3 from 5 to 1 +move 4 from 5 to 3 +move 6 from 2 to 9 +move 4 from 7 to 4 +move 2 from 8 to 5 +move 2 from 9 to 5 +move 4 from 5 to 6 +move 1 from 2 to 5 +move 8 from 6 to 7 +move 18 from 4 to 2 +move 2 from 3 to 6 +move 6 from 1 to 8 +move 8 from 7 to 9 +move 9 from 6 to 4 +move 1 from 5 to 4 +move 5 from 8 to 4 +move 1 from 4 to 5 +move 1 from 8 to 1 +move 8 from 9 to 8 +move 3 from 3 to 9 +move 5 from 2 to 7 +move 1 from 5 to 2 +move 2 from 4 to 8 +move 11 from 2 to 8 +move 1 from 7 to 2 +move 2 from 6 to 5 +move 1 from 6 to 2 +move 4 from 2 to 3 +move 2 from 1 to 3 +move 5 from 9 to 7 +move 1 from 5 to 8 +move 6 from 7 to 8 +move 7 from 3 to 7 +move 1 from 5 to 9 +move 3 from 9 to 7 +move 1 from 4 to 1 +move 1 from 9 to 8 +move 8 from 7 to 3 +move 1 from 2 to 4 +move 1 from 1 to 7 +move 9 from 3 to 7 +move 7 from 4 to 7 +move 8 from 7 to 3 +move 1 from 7 to 9 +move 13 from 7 to 4 +move 1 from 4 to 6 +move 11 from 8 to 2 +move 5 from 3 to 7 +move 1 from 9 to 6 +move 7 from 2 to 9 +move 2 from 2 to 4 +move 4 from 9 to 2 +move 17 from 8 to 3 +move 3 from 3 to 4 +move 1 from 7 to 6 +move 5 from 2 to 3 +move 8 from 4 to 1 +move 2 from 6 to 4 +move 1 from 2 to 7 +move 1 from 1 to 4 +move 1 from 8 to 2 +move 2 from 7 to 4 +move 7 from 1 to 9 +move 16 from 4 to 2 +move 1 from 6 to 1 +move 2 from 2 to 9 +move 6 from 2 to 7 +move 1 from 1 to 6 +move 3 from 2 to 6 +move 10 from 3 to 6 +move 6 from 9 to 8 +move 3 from 4 to 3 +move 6 from 9 to 2 +move 4 from 3 to 7 +move 10 from 2 to 5 +move 2 from 2 to 6 +move 3 from 6 to 3 +move 1 from 8 to 2 +move 1 from 2 to 6 +move 5 from 6 to 1 +move 3 from 6 to 7 +move 5 from 8 to 4 +move 3 from 7 to 1 +move 2 from 6 to 1 +move 2 from 4 to 1 +move 2 from 5 to 8 +move 1 from 8 to 7 +move 1 from 8 to 9 +move 8 from 3 to 4 +move 11 from 1 to 7 +move 1 from 9 to 8 +move 1 from 8 to 3 +move 3 from 6 to 3 +move 1 from 6 to 8 +move 3 from 5 to 2 +move 1 from 8 to 6 +move 2 from 5 to 8 +move 3 from 5 to 6 +move 3 from 2 to 4 +move 2 from 8 to 4 +move 22 from 7 to 3 +move 12 from 3 to 2 +move 9 from 3 to 9 +move 1 from 1 to 2 +move 2 from 6 to 8 +move 2 from 8 to 4 +move 2 from 6 to 5 +move 11 from 3 to 1 +move 18 from 4 to 3 +move 3 from 7 to 3 +move 1 from 5 to 7 +move 3 from 2 to 4 +move 2 from 4 to 9 +move 6 from 1 to 4 +move 1 from 5 to 1 +move 10 from 9 to 3 +move 27 from 3 to 9 +move 6 from 2 to 8 +move 5 from 4 to 2 +move 3 from 3 to 8 +move 1 from 7 to 8 +move 10 from 8 to 2 +move 5 from 1 to 5 +move 1 from 3 to 5 +move 1 from 1 to 8 +move 14 from 9 to 4 +move 6 from 5 to 6 +move 11 from 9 to 4 +move 6 from 6 to 3 +move 1 from 8 to 6 +move 2 from 9 to 5 +move 1 from 2 to 5 +move 8 from 2 to 1 +move 12 from 4 to 7 +move 1 from 6 to 8 +move 14 from 4 to 1 +move 1 from 9 to 8 +move 1 from 5 to 1 +move 2 from 5 to 2 +move 11 from 1 to 6 +move 11 from 6 to 1 +move 1 from 8 to 7 +move 1 from 8 to 2 +move 12 from 1 to 7 +move 1 from 4 to 7 +move 5 from 1 to 5 +move 5 from 2 to 6 +move 1 from 5 to 6 +move 1 from 2 to 9 +move 6 from 1 to 3 +move 19 from 7 to 2 +move 1 from 9 to 6 +move 9 from 3 to 2 +move 9 from 2 to 7 +move 3 from 5 to 8 +move 1 from 5 to 1 +move 3 from 3 to 9 +move 7 from 2 to 9 +move 15 from 7 to 2 +move 10 from 9 to 4 +move 4 from 4 to 9 +move 1 from 6 to 4 +move 1 from 1 to 6 +move 26 from 2 to 5 +move 1 from 7 to 3 +move 6 from 4 to 8 +move 3 from 2 to 9 +move 6 from 8 to 3 +move 4 from 5 to 7 +move 1 from 4 to 5 +move 2 from 2 to 1 +move 6 from 9 to 1 +move 3 from 3 to 8 +move 3 from 2 to 8 +move 3 from 7 to 9 +move 6 from 1 to 7 +move 2 from 3 to 2 +move 2 from 2 to 5 +move 1 from 8 to 6 +move 4 from 7 to 3 +move 10 from 5 to 3 +move 4 from 9 to 1 +move 6 from 3 to 1 +move 1 from 7 to 4 +move 4 from 3 to 2 +move 1 from 3 to 1 +move 13 from 1 to 5 +move 1 from 3 to 7 +move 1 from 3 to 8 +move 4 from 6 to 3 +move 1 from 6 to 3 +move 7 from 8 to 2 +move 1 from 6 to 9 +move 2 from 7 to 2 +move 1 from 9 to 5 +move 2 from 8 to 6 +move 1 from 7 to 5 +move 1 from 3 to 1 +move 30 from 5 to 2 +move 1 from 3 to 4 +move 2 from 6 to 1 +move 5 from 3 to 4 +move 2 from 6 to 5 +move 5 from 4 to 3 +move 1 from 3 to 1 +move 4 from 1 to 6 +move 1 from 2 to 5 +move 2 from 4 to 9 +move 4 from 3 to 5 +move 1 from 3 to 5 +move 1 from 5 to 3 +move 6 from 5 to 1 +move 2 from 1 to 9 +move 4 from 6 to 2 +move 1 from 3 to 5 +move 1 from 5 to 2 +move 1 from 5 to 2 +move 8 from 2 to 5 +move 4 from 9 to 6 +move 3 from 1 to 4 +move 3 from 6 to 2 +move 2 from 4 to 2 +move 1 from 6 to 1 +move 1 from 4 to 6 +move 2 from 5 to 1 +move 1 from 6 to 8 +move 3 from 5 to 2 +move 2 from 5 to 6 +move 1 from 6 to 7 +move 1 from 5 to 9 +move 1 from 7 to 5 +move 3 from 1 to 9 +move 3 from 9 to 5 +move 31 from 2 to 6 +move 1 from 1 to 3 +move 1 from 8 to 9 +move 30 from 6 to 9 +move 2 from 9 to 8 +move 13 from 2 to 3 +move 4 from 5 to 2 +move 1 from 8 to 4 +move 1 from 4 to 1 +move 1 from 1 to 6 +move 5 from 2 to 8 +move 1 from 2 to 8 +move 26 from 9 to 3 +move 18 from 3 to 8 +move 1 from 2 to 1 +move 12 from 3 to 8 +move 1 from 2 to 3 +move 3 from 6 to 4 +move 1 from 1 to 9 +move 11 from 8 to 5 +move 1 from 4 to 7 +move 9 from 3 to 9 +move 1 from 7 to 8 +move 11 from 8 to 3 +move 11 from 3 to 2 +move 11 from 2 to 9 +move 19 from 9 to 8 +move 3 from 5 to 7 +move 2 from 4 to 2 +move 2 from 2 to 8 +move 29 from 8 to 2 +move 5 from 5 to 4 +move 1 from 9 to 6 +move 2 from 5 to 9 +move 1 from 6 to 9 +move 7 from 8 to 7 +move 1 from 9 to 7 +move 6 from 9 to 1 +move 1 from 9 to 4 +move 1 from 5 to 4 +move 15 from 2 to 5 +move 3 from 1 to 7 +move 5 from 5 to 2 +move 1 from 8 to 3 +move 1 from 5 to 8 +move 2 from 3 to 6 +move 1 from 3 to 8 +move 9 from 2 to 1 +move 1 from 8 to 7 +move 1 from 8 to 3 +move 10 from 7 to 8 +move 4 from 7 to 3 +move 1 from 7 to 2 +move 1 from 8 to 6 +move 3 from 6 to 5 +move 6 from 5 to 8 +move 3 from 1 to 3 +move 8 from 3 to 7 +move 3 from 1 to 3 +move 4 from 8 to 3 +move 1 from 4 to 5 +move 4 from 1 to 4 +move 1 from 4 to 5 +move 1 from 7 to 4 +move 4 from 4 to 1 +move 2 from 8 to 7 +move 6 from 5 to 2 +move 2 from 8 to 1 +move 6 from 4 to 7 +move 1 from 5 to 4 +move 5 from 8 to 6 +move 1 from 6 to 9 From 34c3d5968b0447ef0b329bd639c0f508d1534c6e Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Mon, 5 Dec 2022 22:42:24 +0000 Subject: [PATCH 21/52] this bit wasnt that bad --- day5/day5-pt2.js | 66 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 day5/day5-pt2.js diff --git a/day5/day5-pt2.js b/day5/day5-pt2.js new file mode 100644 index 0000000..04573eb --- /dev/null +++ b/day5/day5-pt2.js @@ -0,0 +1,66 @@ +const readFileSync = require("fs").readFileSync; + +// Read Input file +const input = readFileSync("input.txt", { encoding: "utf8", flag: "r" }); + + +let lookingAtStart = true; +let doneReverse = false; +let stacks = new Array(); + +for(const line of input.split("\n")) { + let blankLine = (line.length <= 1) ? true : false; + + if (blankLine) lookingAtStart = false; // whether we are looking at the input (the stacks from 1-9), we can use blank lines to determine this + + if (lookingAtStart === true) { // if we're looking at the start we need to process the input + const matched = line.match(/.{1,4}/g); + if(!matched) continue; + + let i = 0; + for (const crate of matched) { // split each line into groups of 4 chars + if (crate.match(/ [0-9] /g)) continue; // if the content is " X " we're at the bottom row so discard it + + let value = crate.replace(/\[|\]/g, "").replace(/ /g, "") // remove the square brackets and then spaces + + if (!stacks[i]) stacks[i] = new Array(); // init a new array if one doesn't exist for this stack + + if (value !== "") stacks[i].push(value); // add to the array if not a blank + + i++; + } + } else { // we can move on and work on the movements now + if (blankLine) continue; // skip over blank lines + + const commands = line.match(/[0-9]+/g); + const moveWhat = parseInt(commands[0]); // how many crates + const moveFrom = parseInt(commands[1] - 1); // from what stack (minus one since we are zero-indexed) + const moveTo = parseInt(commands[2] - 1); // to which stack (minus one since we are zero-indexed) + + console.log(`\n==new move command==\ngoing to move ${moveWhat} crates from stack ${moveFrom+1} (index ${moveFrom}) to stack ${moveTo+1} (index ${moveTo})`); + + let toMove = []; + + for(let i = 0; i < moveWhat; i++) { // repeat for how many crates we have to move + console.log(`moving crate #${i+1}/${moveWhat} with value ${stacks[moveFrom][0]}`); + + toMove.push(stacks[moveFrom][0]); // add to list of crates we're going to prepend + stacks[moveFrom].splice(0,1); // remove the crate (the one we just queued to be moved) from the source stack + } + + toMove.reverse(); + + toMove.forEach(crate => stacks[moveTo].unshift(crate)); // add source crates to start of dest stack + + } +} + + +stacks.forEach(s=>s.reverse()); // flip every stack so bottom is first element + +console.log(stacks); + +let bottomRows = ""; +stacks.forEach(s => bottomRows += s[s.length-1]); // append last crate of each stack + +console.log(bottomRows); From 09b8d819eb2cf93330186b4fc75e29fe5ee62e26 Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Mon, 5 Dec 2022 22:49:34 +0000 Subject: [PATCH 22/52] remove unnecessary reverse at the end --- day5/day5-pt2.js | 4 +--- day5/day5.js | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/day5/day5-pt2.js b/day5/day5-pt2.js index 04573eb..dfe5137 100644 --- a/day5/day5-pt2.js +++ b/day5/day5-pt2.js @@ -56,11 +56,9 @@ for(const line of input.split("\n")) { } -stacks.forEach(s=>s.reverse()); // flip every stack so bottom is first element - console.log(stacks); let bottomRows = ""; -stacks.forEach(s => bottomRows += s[s.length-1]); // append last crate of each stack +stacks.forEach(s => bottomRows += s[0]); // append last crate of each stack console.log(bottomRows); diff --git a/day5/day5.js b/day5/day5.js index 4433dcf..971fa31 100644 --- a/day5/day5.js +++ b/day5/day5.js @@ -49,11 +49,9 @@ for(const line of input.split("\n")) { } -stacks.forEach(s=>s.reverse()); // flip every stack so bottom is first element - console.log(stacks); let bottomRows = ""; -stacks.forEach(s => bottomRows += s[s.length-1]); // append last crate of each stack +stacks.forEach(s => bottomRows += s[0]); // append last crate of each stack console.log(bottomRows); From 0534e791f072bd548cea92c64d5c439310867aeb Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Mon, 5 Dec 2022 22:50:20 +0000 Subject: [PATCH 23/52] fix the comment --- day5/day5-pt2.js | 2 +- day5/day5.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/day5/day5-pt2.js b/day5/day5-pt2.js index dfe5137..f273d70 100644 --- a/day5/day5-pt2.js +++ b/day5/day5-pt2.js @@ -59,6 +59,6 @@ for(const line of input.split("\n")) { console.log(stacks); let bottomRows = ""; -stacks.forEach(s => bottomRows += s[0]); // append last crate of each stack +stacks.forEach(s => bottomRows += s[0]); // append first (top) crate of each stack console.log(bottomRows); diff --git a/day5/day5.js b/day5/day5.js index 971fa31..3e89d3a 100644 --- a/day5/day5.js +++ b/day5/day5.js @@ -52,6 +52,6 @@ for(const line of input.split("\n")) { console.log(stacks); let bottomRows = ""; -stacks.forEach(s => bottomRows += s[0]); // append last crate of each stack +stacks.forEach(s => bottomRows += s[0]); // append first (top) crate of each stack console.log(bottomRows); From c5b0e09ca429475f7132edd6febf4be99337873c Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Mon, 5 Dec 2022 22:50:42 +0000 Subject: [PATCH 24/52] we also dont need this --- day5/day5-pt2.js | 1 - day5/day5.js | 1 - 2 files changed, 2 deletions(-) diff --git a/day5/day5-pt2.js b/day5/day5-pt2.js index f273d70..37ab191 100644 --- a/day5/day5-pt2.js +++ b/day5/day5-pt2.js @@ -5,7 +5,6 @@ const input = readFileSync("input.txt", { encoding: "utf8", flag: "r" }); let lookingAtStart = true; -let doneReverse = false; let stacks = new Array(); for(const line of input.split("\n")) { diff --git a/day5/day5.js b/day5/day5.js index 3e89d3a..4de229b 100644 --- a/day5/day5.js +++ b/day5/day5.js @@ -5,7 +5,6 @@ const input = readFileSync("input.txt", { encoding: "utf8", flag: "r" }); let lookingAtStart = true; -let doneReverse = false; let stacks = new Array(); for(const line of input.split("\n")) { From 1d900c5d3fb269b23419d853da815a3a1dd75050 Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Mon, 5 Dec 2022 22:52:30 +0000 Subject: [PATCH 25/52] bit more simplification --- day5/day5-pt2.js | 6 +++--- day5/day5.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/day5/day5-pt2.js b/day5/day5-pt2.js index 37ab191..6d9f1c2 100644 --- a/day5/day5-pt2.js +++ b/day5/day5-pt2.js @@ -8,11 +8,11 @@ let lookingAtStart = true; let stacks = new Array(); for(const line of input.split("\n")) { - let blankLine = (line.length <= 1) ? true : false; + const blankLine = (line.length <= 1) ? true : false; - if (blankLine) lookingAtStart = false; // whether we are looking at the input (the stacks from 1-9), we can use blank lines to determine this + if (blankLine) lookingAtStart = false; // whether we are looking at the input (the stacks from 1-9), we can use the first blank line to determine this - if (lookingAtStart === true) { // if we're looking at the start we need to process the input + if (lookingAtStart) { // if we're looking at the start we need to process the input const matched = line.match(/.{1,4}/g); if(!matched) continue; diff --git a/day5/day5.js b/day5/day5.js index 4de229b..29ef497 100644 --- a/day5/day5.js +++ b/day5/day5.js @@ -8,11 +8,11 @@ let lookingAtStart = true; let stacks = new Array(); for(const line of input.split("\n")) { - let blankLine = (line.length <= 1) ? true : false; + const blankLine = (line.length <= 1) ? true : false; - if (blankLine) lookingAtStart = false; // whether we are looking at the input (the stacks from 1-9), we can use blank lines to determine this + if (blankLine) lookingAtStart = false; // whether we are looking at the input (the stacks from 1-9), we can use the first blank line to determine this - if (lookingAtStart === true) { // if we're looking at the start we need to process the input + if (lookingAtStart) { // if we're looking at the start we need to process the input const matched = line.match(/.{1,4}/g); if(!matched) continue; From 984be12db7c923d7636d1fb9b629cf9ad78c9b56 Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Mon, 5 Dec 2022 22:55:06 +0000 Subject: [PATCH 26/52] add disclaimer --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5a90fce..fe56433 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ # Advent of Code 2022 Solutions -Contains my solutions for the [Advent of Code 2022](https://adventofcode.com/2022) challenges. \ No newline at end of file +Contains my solutions for the [Advent of Code 2022](https://adventofcode.com/2022) challenges. + +They won't be efficient or beautiful but hopefully they will at least work :) \ No newline at end of file From be2cb603ea92b54ead198e751ddf07d3e6a816ca Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Mon, 5 Dec 2022 22:59:06 +0000 Subject: [PATCH 27/52] i am a pro javascript man. guess who didnt realise fs was built in --- .gitignore | 2 -- day1/package.json | 5 ----- day2/package.json | 5 ----- day3/package.json | 5 ----- day4/package.json | 5 ----- 5 files changed, 22 deletions(-) delete mode 100644 .gitignore delete mode 100644 day1/package.json delete mode 100644 day2/package.json delete mode 100644 day3/package.json delete mode 100644 day4/package.json diff --git a/.gitignore b/.gitignore deleted file mode 100644 index a0da46f..0000000 --- a/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*node_modules* -*package-lock.json diff --git a/day1/package.json b/day1/package.json deleted file mode 100644 index 7ea3a90..0000000 --- a/day1/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "fs": "^0.0.1-security" - } -} diff --git a/day2/package.json b/day2/package.json deleted file mode 100644 index 7ea3a90..0000000 --- a/day2/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "fs": "^0.0.1-security" - } -} diff --git a/day3/package.json b/day3/package.json deleted file mode 100644 index 7ea3a90..0000000 --- a/day3/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "fs": "^0.0.1-security" - } -} diff --git a/day4/package.json b/day4/package.json deleted file mode 100644 index 7ea3a90..0000000 --- a/day4/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "fs": "^0.0.1-security" - } -} From 2150c4da8e22582c568d330d43f2879f4900b986 Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Tue, 6 Dec 2022 10:29:16 +0000 Subject: [PATCH 28/52] day 6 complete! --- day6/day6.js | 27 +++++++++++++++++++++++++++ day6/input-test.txt | 1 + day6/input.txt | 1 + 3 files changed, 29 insertions(+) create mode 100644 day6/day6.js create mode 100644 day6/input-test.txt create mode 100644 day6/input.txt diff --git a/day6/day6.js b/day6/day6.js new file mode 100644 index 0000000..2cec34d --- /dev/null +++ b/day6/day6.js @@ -0,0 +1,27 @@ +const readFileSync = require("fs").readFileSync; + +// Read Input file +const input = readFileSync("input.txt", { encoding: "utf8", flag: "r" }); + + +let currentCheck = []; +let currentCharIndex = 0; +let uniqueChars = 14; // this is 4 for part one, 14 for part two + +for (const char of input.split("")) { + + currentCheck.push(char); // add current character to the current 4 we're checking + + // console.log(currentCheck); + + if (currentCheck.length === (uniqueChars+1)) { + currentCheck.shift(); // remove first element if we have unique+1 chars in the array + // then check whether any chars are unique + const currentCheckSet = new Set(currentCheck); // sets only contain unique elements + console.log(currentCheck, currentCheckSet.size); + if (currentCheckSet.size === uniqueChars) { console.log(currentCharIndex+1); break; } + + } + + currentCharIndex++; +} diff --git a/day6/input-test.txt b/day6/input-test.txt new file mode 100644 index 0000000..cca46f5 --- /dev/null +++ b/day6/input-test.txt @@ -0,0 +1 @@ +nppdvjthqldpwncqszvftbrmjlhg \ No newline at end of file diff --git a/day6/input.txt b/day6/input.txt new file mode 100644 index 0000000..13a015a --- /dev/null +++ b/day6/input.txt @@ -0,0 +1 @@ +stftmtvvtvqqczqqnjnwwlqqdzdnnsvnsswbbwsstvvssfjsjbjfjmjpjzpplpppjzjqqdzzhqqqqtcccbzzzwzrrrdqdldpdsppmqmmnwwjddnqqscclncllvhllqpllchhbccfcbcgbcgcfcncsnstsddldzldlmljjfbjbzbccmrmrppqmqsswbwqwdwwcnwwhrhppfsfvsvrrfllhglhlggjpggzjgzggnvvqfvvhffpwpmwpmmwvmvrmrbmbzmzbbvgbbcfbcfbfppnzpzrrszzqgzgjgddmdwmwrmwmzznqzqhqhvvsslppsrrljjfpfcpfpbbrjjwjmjpmpfmfzfvzfftptzzbmzmddpvdddqmmzjzbbhmmwqmmmbgmmttrhrqrvqvzvdvzdvvmsvmmqlmmtddvlvttrtvtvcttvssnwwbccqmmgbbqrqlqjllmslsmslltrtffzfpfzpffvwvffsllgvgtgwtwnttfzznzqzztfzfvzznnwzzcvcqvvdwwsnsvnnthhnphpssmjmfmhfmhmgmllmsmrsrrmmhsswjwqqdbbghhpsptsswvsvfvcffqcchlhfhvhjhdjhddvjjpmmsrsqrrngrrmvmsvsllrmlrlprpggqzqmmvlvvwrwnrwwzztrzrbrdbrdbbhlhchjchhtthpthphplhhlphpjjsddtppvbpbbmnmgnmmqbbrhhfrfpfjpjgjljcctwtmwtwvvvmsvmmnjmnjmnmqmvvggtzzctzttszsvvjwjqjmjbjvbbshbhghlghhpvpnvvqmmgjmmggqvqtvqtvqtvvmlljbbhdhshnnwqwbbrnnwswmwfmfttjztjzjsjzjdjbdjjzfzdzgzhghgpgqqdzdhhnwnjnnhrnrqqjsqsllbzzzcnzzmjmvmrvrgrfgrrqmrmpmpzmzqqfwqfwfjjhphgpptzzwmmfjjvbjvbbqsbsbcbppjzpjjzpjpvjjzdjjgcgppvrvjrjpjspjppntpnnjlnlrnrdndjnnsbnnppvspprbrddjrdrmrfmmtmtbtntftjjsscvcbvvcnccnbnrbbmlmddhpdptddmrmmjddnjjtztctqqhhttqctqtbbnfnwnmndnzzljlgltgltljtjllwjjbrjbrbpbgppmzpmpggdnnmznnhhmfhhssgtgvvlsljltlppdqqbtbvbsvsswbsbhsbsmmwswbbbbhvbvcbvvsvcsvvmfmlmgmjgmmbqbrbsrrgrsggldlmlttpbpmmtptctqcqvccnhnmnssmvsmmddlclpccfwfdfqfvqfvfqqwmmwrmmbzznpnllfttgcttnbtnnsswttfppnddpdpsphhpttnrtrlrsrmrnmmzhmhnmnwwddmhdhqqhbqqdcclnlfnnzfnzzqfqddczcqcrrjsrrswslltfltffjhhqqfcchqcqpplbltbblbcbncnpccdffcwwqzwqqlwwtjjpbbjvvljvjgvvrsszfsfcssqsvvwsvvdfvdfdpffztzrtzthzhhmwmzwzssjlsldsldsldlvvjdvvnbvnvmvmccvfcvcfcbchhzqqhgqqcbbhdbdpddwcdwwzszsfszzgbgdgzgvgsgnssfqsqjssrppsgppmmpzmppglgqlqqpzpqqfzzzrnzrnrqqzzfwzzffjfzzmnznpznpprhhvcvvvfddcrdrsscnnsznzszbznntwntnrnbnzzrnnlwlggnzzwppmbmrrncnlclzltlblhhlvhvphhsdhsdsqddgzgvvshvvzzbvbrrlplqpptplljcljlvjlvlqvvndnsdddmvddzhzjjgpjpddppzllwtwfwgfgpffmhhzllsttmqqhjhhpvpgpfjsgscnwjmwmtmptwlpfjljwgpgntrlpjfgbjqmcpzgfhrwmznqnsbpptbdrzmdtvvtdqjgrjzlphndhmlchvddglqnqsjqrfqslprsvlqjwqnsmsznptsstpvdntpttslpmqqbsdlqwpjqnzmpblgqmjrvqwsncnzdszgfsghddlnwhwzpgtddgstttvrjfjwwfrgsdjjngljqlqcrzlgsmwngbzvmjwtnqdqcgwmfhsztgrtvvfzbtstmdbqpntdpsszjthqvpbdwswfzvmrcpbgbgdmldfhvdpfsmdzfhwsrpcglsztdwqgbqszcqtqjhgntzvttldqsffftzmllptzhmhpmfsgcchfrnrchnsgcfjbgrqmvrmmhnmlnwtgwhznqfgwnlrqlpjrvfrgzcjwncvlwhpclfzngbgvmrmlzngmqlvvwhbpjzlclgrcnnvnlppqhvlrnpzvmtsbdpfbwgffgzfwvltcfvfdcnfhwvcvclwwbmshhmpgrzgltwjmqczpqzdwfjpqhmwqhvvgnpgtwrjrgwvhthtdrdpnwpbmwstgblwmbfvlwflqmfbcsgwstwvncwfcsmrpcfrrvmlbqhdtdswswfnzhgzlngwsrtlzfcgdppmjnghfrgbdqhqmslhcqddjvsslsjwqqznttqjzdlghnsvqqtwrpfbzjgwnrhhvlnbqmnvcpblzgbzltnrhzpdwvbqbtmctbzgsdjfzswrbqbzgvwjlwtmgcllnmnwcljbhbplpvtgpgjftfrbgpgmhghnjcgjfqmsbqhbgtzbfzgwmfdsgfgmgzsbgdrszfhjttbvcqjzjgbqfgswlmrrhnmnfrptvjtlnvplgznsljzfzmhghlsccnqzflfnmbhshfprhclmtfptcmtnhrjgnngnqnczvcgzzlntftjsbgpgwzbnrhzzfqmznqnzfrvjzsmtpjbswzjlbgpfftzrzbfgdblpwscbqjfrfmfnhhlhjprtlzzvwnwzsnqhnmgwsdprnrblgbclzhthftqzdljspwdzwmwhfmdzmlvqsngppdfsjdprbrhffcvcvzztjjqcffwbrvpzvzfzhjvsfvsnrmjvqmjtrjbmbqsdtjgvtbbzzfmnmrrflgcdtljpmpvqvdbzgbmhjgccgdtplllctzqpfqnsztbwdbmqgfzrcddtmwrgmwsghcfpgqssdjrtqhtjfbpjvjdnzgvpzrhbrhrhcmpbglbbrvdltdpsrwjbjzftccwgnqmnlqlpjwrfdvmlgvgqznlvsmpzsmgjstvqbqpprzlsdndpfbmqcrfgvcfvlfhmpfnnqlcqlnbbgcrrrhbtzwnwmfrnrzvgmqlmqnmnzbwflwzcmncphjqztlrzvpztqhptmfsrppvvlzcfnlrwptgccsjjjscjcwnzssmbcvtzhnscgsbrchbqbrtdzllfvmqfwznfzpzmbfwcdsfhdlddnfbdgqbqjqzdtppshwcvvcjqstdgtgbhmlqlrfrhbvfsszsmbldmwfnfgnjptdslnzwcjgmvbnqcfzjmrslrlllplbhpjcnvzmvrfzwqhmbnrvpqnvcfncgfwqlvcwpwwljssfmswctcmhgtphvjdpfnnzznfbdjcsndrczlgdjhrnrltsgbtqmqcbwlthwcgsbvqbnntcznczpmlmblwdrlmzqdztwsgjthjwtfcpgwbczmdmhttzcwvdzhdfldmwnbnfdcjgvjhrfltjnjhqhzmzrlbncwdnlgshmqhpgsdwbvmvjsfgvgqzqjqdzqzmfmrncfdgrqfrnstvpqwtltnhgrmhgmmnwvlnsfmmbjrdmrnlgfgpqncdpqgvjltpghbgffdppdcfhdqhtvrdnfvcttlrqppfnqtmzpfgsnmjqfrgtbbdzzrccsrzgfjndlrnzqmjjtgldglcpzcrhwfplvdndjtzbpfbbbpfljqnlvrdzbrvczzwdrvzlmslbjsqgqdrltmhwcdpldqldlpctcbjmsvdwlfspzlpgrhdrvjtprcwrmszvzwmmjgvsbfcztmrdgrgshgtggpzszgqhwmhdzjmzsgqsfmqvcgqqwgprgvvqlbfhpwsfbjdqtcfnfhsgzthzhbpwggbnscqbnvcdprsbgllsrdcclqggfgfdrpqlqljfwpmzdhthpczcsqrrm From e4396cb7f61488edfecdcc225b118bdd34f2a080 Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Wed, 7 Dec 2022 10:35:05 +0000 Subject: [PATCH 29/52] day 7 (this was the worst thing ever) --- day6/day6.js | 2 +- day7/day7.js | 88 +++++ day7/input-test.txt | 33 ++ day7/input.txt | 899 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 1021 insertions(+), 1 deletion(-) create mode 100644 day7/day7.js create mode 100644 day7/input-test.txt create mode 100644 day7/input.txt diff --git a/day6/day6.js b/day6/day6.js index 2cec34d..ebc37c1 100644 --- a/day6/day6.js +++ b/day6/day6.js @@ -24,4 +24,4 @@ for (const char of input.split("")) { } currentCharIndex++; -} +} \ No newline at end of file diff --git a/day7/day7.js b/day7/day7.js new file mode 100644 index 0000000..ce708ea --- /dev/null +++ b/day7/day7.js @@ -0,0 +1,88 @@ +const readFileSync = require("fs").readFileSync; + +// Read Input file +const input = readFileSync("input.txt", { encoding: "utf8", flag: "r" }); + +let fs = {}; +let workingDir = []; + +let listingFiles = false; +for (const line of input.split("\n")) { + if(!line) continue; + + + // set our current directory + if(line.startsWith("$ cd")) { + + // parse the command + const cmd = line.split(" ")[1]; // will be "cd" + const arg = line.split(" ")[2]; // will be the folder + + if(arg == "/") workingDir = []; + + if (arg == "..") { + workingDir.pop(); + } else { + workingDir.push(arg); + } + + // if the current dir doesnt exist we init its size + if (!fs[workingDir.join("/")]) fs[workingDir.join("/")] = 0; + continue; // done with this line + } + + + // deal with files + if(line.startsWith("$")) continue; // we don't care about the other commands + + const size = line.split(" ")[0]; // file size + const name = line.split(" ")[1]; // file name + + if (size === "dir") continue; // we don't care about it telling us there's a dir there + + // console.log(workingDir, size, name); + + fs[workingDir.join("/")] += parseInt(size); +} + +console.log(fs); + +// i stole this bit off george and i dont understand it really +// but maybe it works? +for (const dir in fs) { + const dirName = dir; + let dirSize = fs[dir]; + + for(const subDir in fs) { + const subDirName = subDir; + const subDirSize = fs[subDir]; + + if(dirName == subDirName) { + continue; + } + if(subDirName.startsWith(dirName)) { + dirSize += subDirSize; + } + } + + fs[dir] = dirSize; +} + +console.log(fs); + +let totalSize = 0; +for(const folder in fs) { + const folderName = folder; + const folderSize = fs[folder]; + + if(folderName == "/") continue; + + if (folderSize <= 100000) { + // console.log("adding this folder", folderName, folderSize); + + totalSize += folderSize; + } + +} + +console.log(totalSize); \ No newline at end of file diff --git a/day7/input-test.txt b/day7/input-test.txt new file mode 100644 index 0000000..e741293 --- /dev/null +++ b/day7/input-test.txt @@ -0,0 +1,33 @@ +$ 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 + +$ my own test + +$ cd / +$ cd test-one +101 file-one +$ cd test-two +101 file-two +$ cd test-three +101 file-three \ No newline at end of file diff --git a/day7/input.txt b/day7/input.txt new file mode 100644 index 0000000..f1d8ab1 --- /dev/null +++ b/day7/input.txt @@ -0,0 +1,899 @@ +$ cd / +$ ls +dir ctd +80649 mwcj.pmh +212527 nbb.ztq +dir pgqmwn +152170 scr.smr +17637 snqcgbs.nhv +dir tmw +dir vtm +$ cd ctd +$ ls +dir bblsqnwl +dir gzcjrs +dir pgqmwn +dir qzgjp +dir shmvmqv +$ cd bblsqnwl +$ ls +dir rng +$ cd rng +$ ls +dir jncpmzcs +dir pttvmghm +293353 qcjbfggw.tjj +dir sgm +$ cd jncpmzcs +$ ls +36126 tstwmrbr.bmr +$ cd .. +$ cd pttvmghm +$ ls +38802 ctttjn.nzr +$ cd .. +$ cd sgm +$ ls +dir djcbdbgr +dir gqrr +$ cd djcbdbgr +$ ls +254050 nbb.ztq +$ cd .. +$ cd gqrr +$ ls +168685 jgsqvf.tql +302004 shmvmqv +$ cd .. +$ cd .. +$ cd .. +$ cd .. +$ cd gzcjrs +$ ls +319972 bwnjnmmh.wwd +25495 fzthlhcp.nst +291270 ghjc.nvf +244664 jrlfb.fvz +$ cd .. +$ cd pgqmwn +$ ls +dir zpvthlgp +$ cd zpvthlgp +$ ls +128092 dqvcqs.zpb +140511 nvqsqtjw +$ cd .. +$ cd .. +$ cd qzgjp +$ ls +23062 jgsqvf.tql +254685 nbb.ztq +dir pgqmwn +320683 shmvmqv +105368 shmvmqv.hmg +60805 snqcgbs +$ cd pgqmwn +$ ls +47287 gffvwmr.pbd +$ cd .. +$ cd .. +$ cd shmvmqv +$ ls +80751 crtwwqb +dir dbfm +dir dhhghph +dir pgqmwn +195177 qnm +dir qpbn +dir rwmsqdw +dir shmvmqv +16133 shmvmqv.vwq +187938 tmw +$ cd dbfm +$ ls +dir gbpnjrt +265813 glzz.mjv +108147 nbb.ztq +229253 nvqsqtjw +85743 pgqmwn +261375 qnm +$ cd gbpnjrt +$ ls +179812 mtp.lnf +234550 shmvmqv.qvq +$ cd .. +$ cd .. +$ cd dhhghph +$ ls +dir ghmpb +70514 zqv.ssn +$ cd ghmpb +$ ls +132693 shmvmqv.csb +$ cd .. +$ cd .. +$ cd pgqmwn +$ ls +dir hcbtbr +200292 pgqmwn +67530 sgm +15442 snqcgbs +$ cd hcbtbr +$ ls +249252 dqvcqs.zpb +$ cd .. +$ cd .. +$ cd qpbn +$ ls +dir pmbw +261142 qnm +dir rsfh +239788 sgm +dir wfwl +$ cd pmbw +$ ls +dir gwwdtzp +dir jszzc +32725 rnggjs.cbv +dir sldv +dir tptrlz +$ cd gwwdtzp +$ ls +dir dlvbdn +63066 dslb.mrp +dir shmvmqv +dir tzssf +$ cd dlvbdn +$ ls +190731 nqv.csc +$ cd .. +$ cd shmvmqv +$ ls +223667 nbb.ztq +$ cd .. +$ cd tzssf +$ ls +27296 rlgswwzq.dgj +dir tfdq +206881 wrdqg.pfj +$ cd tfdq +$ ls +26512 wsgh +$ cd .. +$ cd .. +$ cd .. +$ cd jszzc +$ ls +218701 qpz.hdm +$ cd .. +$ cd sldv +$ ls +dir hsbzqtml +3895 jgsqvf.tql +181815 nbb.ztq +294048 shmvmqv.fcm +dir snqcgbs +dir tmw +203484 zfpjq.pvn +dir zlpwdp +$ cd hsbzqtml +$ ls +dir shmvmqv +$ cd shmvmqv +$ ls +103536 nbb.ztq +32635 wmc +$ cd .. +$ cd .. +$ cd snqcgbs +$ ls +95112 dch +$ cd .. +$ cd tmw +$ ls +dir dplm +275451 hsr.zhn +9766 qnm +177383 ztbmqjqb.hwj +$ cd dplm +$ ls +277671 dqvcqs.zpb +$ cd .. +$ cd .. +$ cd zlpwdp +$ ls +315030 snqcgbs.mlz +$ cd .. +$ cd .. +$ cd tptrlz +$ ls +dir jfflz +154685 qbbpstff.fcs +dir sjjgljg +dir zsssqcsb +$ cd jfflz +$ ls +1330 fvldwzn.dbb +227153 nbb.ztq +$ cd .. +$ cd sjjgljg +$ ls +295745 frjnfsgt.fmq +105131 jtbltpv.vhm +174279 pgqmwn +104317 sgm +$ cd .. +$ cd zsssqcsb +$ ls +246361 bnzsv.dqf +dir ggcvqf +dir htqpwzw +249833 jgsqvf.tql +dir lbtjth +dir lcfwb +306768 mmd.gjw +121112 pgqmwn +dir sgm +dir shmvmqv +dir snqcgbs +55055 tmw.rqm +$ cd ggcvqf +$ ls +46573 fcwznd +$ cd .. +$ cd htqpwzw +$ ls +dir bmzvdzsv +193713 fpp.vwd +39898 mfjcnl.szn +65370 msljctr +10685 ppgzbc.trg +94843 shmvmqv.hqn +dir thfdg +$ cd bmzvdzsv +$ ls +74898 pgqmwn.wwh +$ cd .. +$ cd thfdg +$ ls +dir cpsgcll +$ cd cpsgcll +$ ls +244683 gdfw +17203 tmw +$ cd .. +$ cd .. +$ cd .. +$ cd lbtjth +$ ls +dir snqcgbs +$ cd snqcgbs +$ ls +122394 grhbhpw.fsl +55324 jgsqvf.tql +$ cd .. +$ cd .. +$ cd lcfwb +$ ls +138053 nvqsqtjw +$ cd .. +$ cd sgm +$ ls +314313 dqvcqs.zpb +146274 fftqvs.ltt +225372 jtq.rzq +85697 rctzgq.rsr +dir sgm +262221 tqpng +$ cd sgm +$ ls +dir cmvvd +277366 mhs.tpn +77975 nbb.ztq +160966 qrwbvbd.ghf +55949 snqcgbs.qzc +$ cd cmvvd +$ ls +28054 lfsvfsl +165671 tmw.zwh +$ cd .. +$ cd .. +$ cd .. +$ cd shmvmqv +$ ls +51884 bsbwrjnz.dmt +231236 jfmsg.mts +dir qpb +256063 zhmw +65512 zrnhr +$ cd qpb +$ ls +228289 dqvcqs.zpb +$ cd .. +$ cd .. +$ cd snqcgbs +$ ls +dir mnwgf +$ cd mnwgf +$ ls +178834 qgnwvlfd.cps +255140 sls.mnw +9546 tvhbm +281615 vntrb +$ cd .. +$ cd .. +$ cd .. +$ cd .. +$ cd .. +$ cd rsfh +$ ls +310413 snqcgbs +$ cd .. +$ cd wfwl +$ ls +dir fmvg +129025 jgsqvf.tql +$ cd fmvg +$ ls +276100 nvqsqtjw +$ cd .. +$ cd .. +$ cd .. +$ cd rwmsqdw +$ ls +46554 qzdmgl +55785 shmvmqv +127982 tfffrg.sbz +$ cd .. +$ cd shmvmqv +$ ls +dir ntstz +dir vprlz +$ cd ntstz +$ ls +304801 nvqsqtjw +28969 wzfb.fjv +$ cd .. +$ cd vprlz +$ ls +dir cmmtnt +dir shmvmqv +$ cd cmmtnt +$ ls +270129 shmvmqv +$ cd .. +$ cd shmvmqv +$ ls +dir sgm +$ cd sgm +$ ls +287889 hghh.mwt +$ cd .. +$ cd .. +$ cd .. +$ cd .. +$ cd .. +$ cd .. +$ cd pgqmwn +$ ls +85368 qnm +$ cd .. +$ cd tmw +$ ls +dir fnpjwg +dir gdt +dir ggs +dir llh +69470 nvqsqtjw +dir sgm +$ cd fnpjwg +$ ls +161820 dndq.tfl +dir dwmcs +205155 tdccsw.qlq +165352 vvmnpj +$ cd dwmcs +$ ls +121466 dqvcqs.zpb +274171 qbbqmf.ltf +$ cd .. +$ cd .. +$ cd gdt +$ ls +dir cnvtrw +dir gdcvdsv +dir hcn +dir hsmhn +dir jnhqz +78446 pgqmwn.mwr +dir qwfl +dir snqcgbs +$ cd cnvtrw +$ ls +dir hfvzm +$ cd hfvzm +$ ls +305880 tmw.lvw +$ cd .. +$ cd .. +$ cd gdcvdsv +$ ls +69690 jhscd +$ cd .. +$ cd hcn +$ ls +166775 dqvcqs.zpb +294325 nvqsqtjw +$ cd .. +$ cd hsmhn +$ ls +172897 lrjf.dnw +dir npgr +225227 pbcmjg.rhf +234530 pgqmwn.cqb +dir qlz +dir snqcgbs +52808 tnntq.wjt +$ cd npgr +$ ls +141280 qnm +64422 rwv +$ cd .. +$ cd qlz +$ ls +258070 nbb.ztq +$ cd .. +$ cd snqcgbs +$ ls +3723 frcr.jmn +109486 sgm.nsw +114054 shmvmqv.frr +142024 snqcgbs +$ cd .. +$ cd .. +$ cd jnhqz +$ ls +dir gpztwnqm +dir nwpqbf +dir sgm +dir tmw +$ cd gpztwnqm +$ ls +303103 bjbpj +281422 hgp +284044 jgsqvf.tql +dir qzts +133248 sgm +$ cd qzts +$ ls +2428 dqvcqs.zpb +283206 hzs.smg +dir lmlw +$ cd lmlw +$ ls +dir sjrfmpc +$ cd sjrfmpc +$ ls +164708 nbb.ztq +$ cd .. +$ cd .. +$ cd .. +$ cd .. +$ cd nwpqbf +$ ls +192033 dqvcqs.zpb +298220 jqd.bfh +dir mhtsg +100921 snqcgbs +dir zbtb +$ cd mhtsg +$ ls +140813 cgcn.rjn +$ cd .. +$ cd zbtb +$ ls +201213 gjglrmf.dzv +dir grbl +81636 pgqmwn.zfm +265992 pwhbflzn.sch +dir twjrlzpj +$ cd grbl +$ ls +82894 jgsqvf.tql +$ cd .. +$ cd twjrlzpj +$ ls +304952 cwhtqv.zvh +$ cd .. +$ cd .. +$ cd .. +$ cd sgm +$ ls +56329 ftfvfpz.srv +3875 nbb.ztq +4766 shmvmqv.fdt +247272 vbw.hsv +$ cd .. +$ cd tmw +$ ls +dir ddbvd +$ cd ddbvd +$ ls +83200 tnrwdc.dzm +$ cd .. +$ cd .. +$ cd .. +$ cd qwfl +$ ls +dir bcfnz +23440 nvqsqtjw +dir pwb +206984 shmvmqv.fjb +35453 snqcgbs +297136 snqcgbs.fnr +dir tmw +181689 wcbdwwq +$ cd bcfnz +$ ls +dir fnrclwn +dir fslh +258656 gtbhdpt.pth +238261 psbsmvpf.lmt +dir sgm +$ cd fnrclwn +$ ls +30297 crhjfzlp.gtb +297557 gvvnbmt.spr +189301 nvqsqtjw +45159 sndmlvw.lsb +259295 sqd +$ cd .. +$ cd fslh +$ ls +246662 bpvcj.hnf +$ cd .. +$ cd sgm +$ ls +dir jpr +dir tmw +dir wscvtrd +$ cd jpr +$ ls +49005 dqvcqs.zpb +$ cd .. +$ cd tmw +$ ls +201387 sgm +$ cd .. +$ cd wscvtrd +$ ls +77175 blczlqf.pnv +207393 shmvmqv.qbs +$ cd .. +$ cd .. +$ cd .. +$ cd pwb +$ ls +89451 bqcmzzf +207548 gfwgnft.php +dir gsn +dir jtvpnvz +144792 nbb.ztq +dir nzzqj +214209 pgqmwn.sjv +236845 pzvjqqvz +dir sgm +dir snqcgbs +dir vfvttj +$ cd gsn +$ ls +93490 snqcgbs.fbv +$ cd .. +$ cd jtvpnvz +$ ls +dir fdnvff +208857 gpvwzhd +229559 rnc +225519 snqcgbs +162969 tmw +$ cd fdnvff +$ ls +286944 dztqqtf.nmp +dir rwc +181737 snqcgbs +$ cd rwc +$ ls +115290 nbb.ztq +$ cd .. +$ cd .. +$ cd .. +$ cd nzzqj +$ ls +154210 jgsqvf.tql +dir sgm +182438 snqcgbs.wpg +dir zpvghr +$ cd sgm +$ ls +123163 rjgc.ccm +dir rqn +291622 tflv.pqc +$ cd rqn +$ ls +220655 rtbrwmjn.clj +$ cd .. +$ cd .. +$ cd zpvghr +$ ls +288859 dqvcqs.zpb +218036 hfdcrjp +$ cd .. +$ cd .. +$ cd sgm +$ ls +107183 sgm.nsf +225832 sjwn +dir tgf +$ cd tgf +$ ls +258766 nvqsqtjw +$ cd .. +$ cd .. +$ cd snqcgbs +$ ls +56144 whjpg.ffz +$ cd .. +$ cd vfvttj +$ ls +dir ptmggmsl +$ cd ptmggmsl +$ ls +dir psd +dir wdzptvjc +$ cd psd +$ ls +121637 dqvcqs.zpb +$ cd .. +$ cd wdzptvjc +$ ls +dir shmvmqv +$ cd shmvmqv +$ ls +23754 dqmrj.fhh +$ cd .. +$ cd .. +$ cd .. +$ cd .. +$ cd .. +$ cd tmw +$ ls +17390 hqz +dir jnsb +31072 nvqsqtjw +dir tmw +144511 vvwjcqr.rtz +$ cd jnsb +$ ls +265907 snqcgbs.swh +$ cd .. +$ cd tmw +$ ls +dir gfncpvw +$ cd gfncpvw +$ ls +dir ctvwgtlh +$ cd ctvwgtlh +$ ls +29825 ccjvs.qqq +$ cd .. +$ cd .. +$ cd .. +$ cd .. +$ cd .. +$ cd snqcgbs +$ ls +230355 ccl.ddg +dir csfdmhmb +dir drpgbvzf +313060 hhcpw.nbs +dir pfpn +dir ptwnpdnc +273250 qfsnmbm +dir shmvmqv +244767 tmw.zjg +$ cd csfdmhmb +$ ls +50690 nbb.ztq +282078 vzrw +$ cd .. +$ cd drpgbvzf +$ ls +dir bhwvqf +803 dqvcqs.zpb +49859 hhw.gpd +180202 nbb.ztq +dir nfh +64808 pgqmwn +276746 qnm +dir shmvmqv +dir tmw +$ cd bhwvqf +$ ls +76667 qcgpdwm.sbs +$ cd .. +$ cd nfh +$ ls +23774 jgsqvf.tql +34652 pnp.lvp +120264 zvp +$ cd .. +$ cd shmvmqv +$ ls +47748 cswm.dsr +dir pgqmwn +$ cd pgqmwn +$ ls +109587 qnm +$ cd .. +$ cd .. +$ cd tmw +$ ls +105578 snqcgbs +$ cd .. +$ cd .. +$ cd pfpn +$ ls +194628 wgc +$ cd .. +$ cd ptwnpdnc +$ ls +142456 rvwtfvr.tsc +$ cd .. +$ cd shmvmqv +$ ls +118642 hgqlrt.btl +$ cd .. +$ cd .. +$ cd .. +$ cd ggs +$ ls +231223 hmtp.djc +$ cd .. +$ cd llh +$ ls +dir hbq +dir svt +$ cd hbq +$ ls +157243 fhpsb +36981 rdbqnbfr.cwz +282257 tmw.wwv +$ cd .. +$ cd svt +$ ls +161395 sgm.hdl +$ cd .. +$ cd .. +$ cd sgm +$ ls +247276 fss +dir pgqmwn +68084 pgqmwn.vfl +28475 sgm.swb +dir shmvmqv +223438 snqcgbs.bng +$ cd pgqmwn +$ ls +134640 dqvcqs.zpb +dir nrdd +25431 nvqsqtjw +149751 qhzqw +dir vfmcjhwz +dir zlfhr +$ cd nrdd +$ ls +dir pgqmwn +$ cd pgqmwn +$ ls +57090 nfbd +$ cd .. +$ cd .. +$ cd vfmcjhwz +$ ls +24256 fdzfwfh.rcv +$ cd .. +$ cd zlfhr +$ ls +20504 fgbpndj.wgm +181769 qnm +$ cd .. +$ cd .. +$ cd shmvmqv +$ ls +208988 nbb.ztq +$ cd .. +$ cd .. +$ cd .. +$ cd vtm +$ ls +dir lqvjm +dir msmtcnsj +dir qmtgdn +dir tmw +$ cd lqvjm +$ ls +239772 hnj.zqf +$ cd .. +$ cd msmtcnsj +$ ls +48711 clfl.fsl +245929 ddh.gdq +dir fvlb +241040 nvqsqtjw +dir shmvmqv +305567 vdzzqpz.jfs +$ cd fvlb +$ ls +25669 ddz.tbc +$ cd .. +$ cd shmvmqv +$ ls +283905 nvqsqtjw +$ cd .. +$ cd .. +$ cd qmtgdn +$ ls +246479 pgqmwn +35386 rtf.cdp +217551 sgm.mrz +$ cd .. +$ cd tmw +$ ls +dir qfggmdvd +dir tlv +dir tmw +$ cd qfggmdvd +$ ls +288091 djwfq.wzc +37383 pwnzdj +214119 shmvmqv.wlg +29747 tmw.ntw +146556 zgbd +$ cd .. +$ cd tlv +$ ls +142924 grj.qhw +210672 qhmn +209554 zbcqcb.mhn +141215 zjmrgw.wlc +$ cd .. +$ cd tmw +$ ls +dir fwsgn +dir tmw +$ cd fwsgn +$ ls +dir qbbhrst +306142 sgm +$ cd qbbhrst +$ ls +dir sgm +dir srbn +$ cd sgm +$ ls +80992 bbvqrcf.chp +$ cd .. +$ cd srbn +$ ls +161382 nvqsqtjw +$ cd .. +$ cd .. +$ cd .. +$ cd tmw +$ ls +219508 dqvcqs.zpb +dir tmw +134434 wbvvgqwn.bmh +$ cd tmw +$ ls +209116 pgqmwn From 9e28ce482a627414d25954f01b19d184a305602f Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Wed, 7 Dec 2022 10:49:35 +0000 Subject: [PATCH 30/52] part two! --- day7/day7.js | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/day7/day7.js b/day7/day7.js index ce708ea..699b1ec 100644 --- a/day7/day7.js +++ b/day7/day7.js @@ -45,7 +45,6 @@ for (const line of input.split("\n")) { fs[workingDir.join("/")] += parseInt(size); } -console.log(fs); // i stole this bit off george and i dont understand it really // but maybe it works? @@ -68,7 +67,6 @@ for (const dir in fs) { fs[dir] = dirSize; } -console.log(fs); let totalSize = 0; for(const folder in fs) { @@ -85,4 +83,27 @@ for(const folder in fs) { } -console.log(totalSize); \ No newline at end of file +console.log("part one, total size:", totalSize); + + +// PART TWO +const spaceTotal = 70000000; +const spaceRequired = 30000000; +const spaceUsed = fs["/"]; +const spaceFree = spaceTotal - spaceUsed; +const toFree = spaceRequired - spaceFree; + +console.log(spaceFree, "free"); +console.log(toFree, "needed to free"); + +let candidates = []; // for deletion +for (const dir in fs) { + const name = dir; + const size = fs[dir]; + + if (size > toFree) candidates.push({ name, size }); +} + +const sortedCandidates = candidates.sort((a, b) => { return a.size - b.size; }); + +console.log("part two, folder to delete:", sortedCandidates[0].size, sortedCandidates[0]); \ No newline at end of file From 62f786cf664b4d83d98cae91af447e3f390d0cb6 Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Wed, 7 Dec 2022 10:58:04 +0000 Subject: [PATCH 31/52] some qual improvements and comments --- day7/day7.js | 53 ++++++++++++++++++++-------------------------------- 1 file changed, 20 insertions(+), 33 deletions(-) diff --git a/day7/day7.js b/day7/day7.js index 699b1ec..6747543 100644 --- a/day7/day7.js +++ b/day7/day7.js @@ -6,9 +6,8 @@ const input = readFileSync("input.txt", { encoding: "utf8", flag: "r" }); let fs = {}; let workingDir = []; -let listingFiles = false; for (const line of input.split("\n")) { - if(!line) continue; + if(!line) continue; // skip blank lines // set our current directory @@ -18,12 +17,12 @@ for (const line of input.split("\n")) { const cmd = line.split(" ")[1]; // will be "cd" const arg = line.split(" ")[2]; // will be the folder - if(arg == "/") workingDir = []; + if(arg == "/") workingDir = []; // return to / properly if (arg == "..") { - workingDir.pop(); + workingDir.pop(); // go up a folder by removing the last in the working dir array } else { - workingDir.push(arg); + workingDir.push(arg); // else we can append the folder to the end } // if the current dir doesnt exist we init its size @@ -40,47 +39,35 @@ for (const line of input.split("\n")) { if (size === "dir") continue; // we don't care about it telling us there's a dir there - // console.log(workingDir, size, name); - - fs[workingDir.join("/")] += parseInt(size); + fs[workingDir.join("/")] += parseInt(size); // add the size of the file to the size of the current dir } // i stole this bit off george and i dont understand it really // but maybe it works? for (const dir in fs) { - const dirName = dir; - let dirSize = fs[dir]; + const name = dir; + let size = fs[dir]; for(const subDir in fs) { - const subDirName = subDir; - const subDirSize = fs[subDir]; - - if(dirName == subDirName) { - continue; - } - if(subDirName.startsWith(dirName)) { - dirSize += subDirSize; - } + const subName = subDir; + const subSize = fs[subDir]; + + if (name == subName) continue; + if (subName.startsWith(name)) size += subSize; } - fs[dir] = dirSize; + fs[dir] = size; } +// thanks again big g x +let totalSize = 0; // of all folders <= 100000 +for(const dir in fs) { + const name = dir; + const size = fs[dir]; -let totalSize = 0; -for(const folder in fs) { - const folderName = folder; - const folderSize = fs[folder]; - - if(folderName == "/") continue; - - if (folderSize <= 100000) { - // console.log("adding this folder", folderName, folderSize); - - totalSize += folderSize; - } - + if(name == "/") continue; // skip over root + if (size <= 100000) totalSize += size; // if we're under we can add to total size } console.log("part one, total size:", totalSize); From b3f2489cdb1f3825780077475331a8be791dd164 Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Wed, 7 Dec 2022 11:40:55 +0000 Subject: [PATCH 32/52] allow for other years --- {day1 => 2022/day1}/day1.js | 0 {day1 => 2022/day1}/input.txt | 0 {day2 => 2022/day2}/day2-pt2.js | 0 {day2 => 2022/day2}/day2.js | 0 {day2 => 2022/day2}/input.txt | 0 {day3 => 2022/day3}/day3-pt2.js | 0 {day3 => 2022/day3}/day3.js | 0 {day3 => 2022/day3}/input.txt | 0 {day4 => 2022/day4}/day4-pt2.js | 0 {day4 => 2022/day4}/day4.js | 0 {day4 => 2022/day4}/input.txt | 0 {day5 => 2022/day5}/day5-pt2.js | 0 {day5 => 2022/day5}/day5.js | 0 {day5 => 2022/day5}/input-test.txt | 0 {day5 => 2022/day5}/input.txt | 0 {day6 => 2022/day6}/day6.js | 0 {day6 => 2022/day6}/input-test.txt | 0 {day6 => 2022/day6}/input.txt | 0 {day7 => 2022/day7}/day7.js | 0 {day7 => 2022/day7}/input-test.txt | 0 {day7 => 2022/day7}/input.txt | 0 README.md | 4 ++-- 22 files changed, 2 insertions(+), 2 deletions(-) rename {day1 => 2022/day1}/day1.js (100%) rename {day1 => 2022/day1}/input.txt (100%) rename {day2 => 2022/day2}/day2-pt2.js (100%) rename {day2 => 2022/day2}/day2.js (100%) rename {day2 => 2022/day2}/input.txt (100%) rename {day3 => 2022/day3}/day3-pt2.js (100%) rename {day3 => 2022/day3}/day3.js (100%) rename {day3 => 2022/day3}/input.txt (100%) rename {day4 => 2022/day4}/day4-pt2.js (100%) rename {day4 => 2022/day4}/day4.js (100%) rename {day4 => 2022/day4}/input.txt (100%) rename {day5 => 2022/day5}/day5-pt2.js (100%) rename {day5 => 2022/day5}/day5.js (100%) rename {day5 => 2022/day5}/input-test.txt (100%) rename {day5 => 2022/day5}/input.txt (100%) rename {day6 => 2022/day6}/day6.js (100%) rename {day6 => 2022/day6}/input-test.txt (100%) rename {day6 => 2022/day6}/input.txt (100%) rename {day7 => 2022/day7}/day7.js (100%) rename {day7 => 2022/day7}/input-test.txt (100%) rename {day7 => 2022/day7}/input.txt (100%) diff --git a/day1/day1.js b/2022/day1/day1.js similarity index 100% rename from day1/day1.js rename to 2022/day1/day1.js diff --git a/day1/input.txt b/2022/day1/input.txt similarity index 100% rename from day1/input.txt rename to 2022/day1/input.txt diff --git a/day2/day2-pt2.js b/2022/day2/day2-pt2.js similarity index 100% rename from day2/day2-pt2.js rename to 2022/day2/day2-pt2.js diff --git a/day2/day2.js b/2022/day2/day2.js similarity index 100% rename from day2/day2.js rename to 2022/day2/day2.js diff --git a/day2/input.txt b/2022/day2/input.txt similarity index 100% rename from day2/input.txt rename to 2022/day2/input.txt diff --git a/day3/day3-pt2.js b/2022/day3/day3-pt2.js similarity index 100% rename from day3/day3-pt2.js rename to 2022/day3/day3-pt2.js diff --git a/day3/day3.js b/2022/day3/day3.js similarity index 100% rename from day3/day3.js rename to 2022/day3/day3.js diff --git a/day3/input.txt b/2022/day3/input.txt similarity index 100% rename from day3/input.txt rename to 2022/day3/input.txt diff --git a/day4/day4-pt2.js b/2022/day4/day4-pt2.js similarity index 100% rename from day4/day4-pt2.js rename to 2022/day4/day4-pt2.js diff --git a/day4/day4.js b/2022/day4/day4.js similarity index 100% rename from day4/day4.js rename to 2022/day4/day4.js diff --git a/day4/input.txt b/2022/day4/input.txt similarity index 100% rename from day4/input.txt rename to 2022/day4/input.txt diff --git a/day5/day5-pt2.js b/2022/day5/day5-pt2.js similarity index 100% rename from day5/day5-pt2.js rename to 2022/day5/day5-pt2.js diff --git a/day5/day5.js b/2022/day5/day5.js similarity index 100% rename from day5/day5.js rename to 2022/day5/day5.js diff --git a/day5/input-test.txt b/2022/day5/input-test.txt similarity index 100% rename from day5/input-test.txt rename to 2022/day5/input-test.txt diff --git a/day5/input.txt b/2022/day5/input.txt similarity index 100% rename from day5/input.txt rename to 2022/day5/input.txt diff --git a/day6/day6.js b/2022/day6/day6.js similarity index 100% rename from day6/day6.js rename to 2022/day6/day6.js diff --git a/day6/input-test.txt b/2022/day6/input-test.txt similarity index 100% rename from day6/input-test.txt rename to 2022/day6/input-test.txt diff --git a/day6/input.txt b/2022/day6/input.txt similarity index 100% rename from day6/input.txt rename to 2022/day6/input.txt diff --git a/day7/day7.js b/2022/day7/day7.js similarity index 100% rename from day7/day7.js rename to 2022/day7/day7.js diff --git a/day7/input-test.txt b/2022/day7/input-test.txt similarity index 100% rename from day7/input-test.txt rename to 2022/day7/input-test.txt diff --git a/day7/input.txt b/2022/day7/input.txt similarity index 100% rename from day7/input.txt rename to 2022/day7/input.txt diff --git a/README.md b/README.md index fe56433..f06bcec 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -# Advent of Code 2022 Solutions +# Advent of Code Solutions -Contains my solutions for the [Advent of Code 2022](https://adventofcode.com/2022) challenges. +Contains my solutions for the [Advent of Code](https://adventofcode.com) challenges. They won't be efficient or beautiful but hopefully they will at least work :) \ No newline at end of file From 7138fe760f5dfc107d0de9d6a3ca18adef51578f Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Thu, 8 Dec 2022 18:41:39 +0000 Subject: [PATCH 33/52] day 8 pt1 --- 2022/day8/day8.js | 83 +++++++++++++++++++++++++++++++++ 2022/day8/input-test.txt | 5 ++ 2022/day8/input.txt | 99 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 187 insertions(+) create mode 100644 2022/day8/day8.js create mode 100644 2022/day8/input-test.txt create mode 100644 2022/day8/input.txt diff --git a/2022/day8/day8.js b/2022/day8/day8.js new file mode 100644 index 0000000..25e3e37 --- /dev/null +++ b/2022/day8/day8.js @@ -0,0 +1,83 @@ +const readFileSync = require("fs").readFileSync; + +// Read Input file +const input = readFileSync("input.txt", { encoding: "utf8", flag: "r" }); + + +let grid = []; + +let i = 0; +for(const line of input.split("\n")) { + if(!line) continue; // skip blanks + + if(!grid[i]) grid[i] = []; // if there's no existing row then make one + + // build the rows by adding trees + for(const char of line.split("")) { + grid[i].push(char); + } + + i++; +} + +console.table(grid); + +let visible = 0; + +for(const row in grid) { + for(const col in grid) { + const tree = grid[row][col]; + console.log("checking tree", tree, "at", row, col); + + // Efficiency? what's that? + + // check visibility from above + let visibleFromAbove = true; + for(let i = 0; i < row; i++) { + const checkTree = grid[i][col]; + if (checkTree >= tree) { + visibleFromAbove = false; + break; + } + } + console.log(visibleFromAbove, "above"); + + // check visibility from below + let visibleFromBelow = true; + for (let i = grid.length - 1; i > row; i--) { + const checkTree = grid[i][col]; + if (checkTree >= tree) { + visibleFromBelow = false; + break; + } + } + console.log(visibleFromBelow, "below"); + + // check visibility from left + let visibleFromLeft = true; + for (let i = 0; i < col; i++) { + const checkTree = grid[row][i]; + if (checkTree >= tree) { + visibleFromLeft = false; + break; + } + } + console.log(visibleFromLeft, "left"); + + // check visibility from right + let visibleFromRight = true; + for (let i = grid[row].length - 1; i > col; i--) { + const checkTree = grid[row][i]; + if (checkTree >= tree) { + visibleFromRight = false; + break; + } + } + console.log(visibleFromRight, "right"); + + if(visibleFromAbove || visibleFromBelow || visibleFromLeft || visibleFromRight) visible++; + + } +} + +console.log(visible); \ No newline at end of file diff --git a/2022/day8/input-test.txt b/2022/day8/input-test.txt new file mode 100644 index 0000000..6557024 --- /dev/null +++ b/2022/day8/input-test.txt @@ -0,0 +1,5 @@ +30373 +25512 +65332 +33549 +35390 \ No newline at end of file diff --git a/2022/day8/input.txt b/2022/day8/input.txt new file mode 100644 index 0000000..3133adb --- /dev/null +++ b/2022/day8/input.txt @@ -0,0 +1,99 @@ +220102001303332210111144403232401113333122342344231242454143210203320302212443030013122003001101100 +002012111323310331302003042221132010432132445255133124455255223004414440440003301012203200022100210 +200201202011003110423331304200331011531224544245554512113213335525210302033141324322321031312102110 +100020212221032131124244103404003222433224521422334123232422124515312313433224100204010121132311000 +200113321032110240111004030043155443522233113242534443312241445211112450323031312112213000023232100 +000123222130133422212242344055134444215311551422533215421415442551425225432130430124043210211111310 +220013001310041302023441034332322423241253523413533421512551432233114553552003013120121302130121320 +103122021001324130041021443134551553414353255343356623553131221454542451225451442032131420112320101 +012123121220242033212021343121244143344324534625253522262464534215422121222134240012234133102111220 +330310331223230000003152443554413335326665536266322522652335566553114314142351411020403401413302112 +033203120011110011132251145135331144533354253453463224233644324632453434135523253300131220303213123 +320111230330142103134512313345346434643654336344264466663434525446644113511452351451422214014013322 +001132233321313303345535112443242622242446334234425332545346556362543355243332135453212444110331303 +112033313244310423153325243233225655536462366623456645652435535435325433454445524512423111021132122 +313313043314211444453212142362452645555543222645663664243443432442223333565131234141351344321344102 +131230133213133211232332525334634543566623665537334334547734623265434432455254451425235432443212211 +033344041000113254352455455346236225633465644343664557364344535543336532242444234311533433344140212 +213210413044552341333323656654354424366446744766744473434577534775255332236334522521333331002022121 +223112203001555435245233523555243667443447767433564533557556755677732432236462355155425414244240300 +031112340101154335334634566542526467535374465476634474475365364377737233444423444335143215320411041 +010203132113252122424352345322745777347553756767766736766655557657446763326426264545545441510322304 +321034434351253424555342636457546533636345766763737363536656637564757633453436366225532223151301123 +140333103113245552456543556436376775537436555564765867677377566536736367466446544545111231522432042 +344202325543255413523362252766476773354345756567775846446585764655346457333656245566142114252141442 +300442033331415536626644654454735373634646576484854768867856765345656633644236246242335514321313432 +422444251112412665556253554536437336675554766648744646768865576456545754676632532244262315154431312 +202304543452455552253665657746647784558765457564785778845788767784833536336745445354462312521531440 +443202253112536253525354345435633886668445868754667447674764886554756567546737654246334325241222041 +444423415155442365223265743454556684558776766888858567565767784775755635475565754224462452335222241 +344303321125225553466564654375755674684544768955877976656855558645744675543644552655335222244234041 +300235531322254555657355344757787845684787759755989576658884775746464854347454745445252251123331200 +202355355135453623555734775437867546864765789685787875887555685885564677653753475626332543431524440 +123112125155234436477477667347767767746589595765887578895688659457644647637353775542533353231324344 +410231223354354564265577744565557576558859695696978987776856795557766747576576743622336235154122541 +144345221145432366464547578854445477995896778965569886979678656986544557875776343376245336222211154 +041355524153432432536456778856655655586558689789676558987567866689878584574356765462664355555422315 +043213424536224446535754387584686658555998969679778967988975666897764557557733673744622262412325233 +101514245332544663477377677875765977975768579996797978899567698975768865784644537776543454651544223 +055515332353232236436447686544477656596959996666689896787797795969665874555543664764442344265232243 +222545542226664544634434558757485778565956766669899769668998978795896868888674777634532432531545351 +434314333334362377634654477865886799965779778887799678789966958767788684856666356767346645644343444 +052335546342344533746576644847456965678786776877897777697767787998596844688878543443425354265524523 +245321436235332754756734464668569895557967788998689969678678888859577664555777765333674636253522234 +222511135542326767344777655475586999669889777967697967976779776769789666884457455657536456246131555 +254433214252433545454764655656756765598866789679798998989699886966798756574757563674433652342254411 +252443455634345774563668584548569877777679776897897977978768868758769758655687433345452443435424512 +312151563634655557774676587765775678576967989777779888989698876657887877756744456665655635556644123 +255315424526333665355778666668586665799969869877998777889777988668875966868565465457776522236513141 +141324353246555364776377784867669969887687879788978777778977696768597689744655653757436644265454325 +354554356562633675467576477485995977969979699799889979879876989688558895876557644555777244452335314 +235324556262356365436555887646778779897999678779989989789867689977685966845857674434347554655643252 +413432246554227346473675665849975567696667989798798778788967877675576875667875866434546262246521543 +552324452542255347547654567456656665796776679978889979999797899897878689747764654756336634422352455 +132142446224635664776385465487598668797987978789877989998967699965559668558447437465553652345225512 +535121326642222474774354544766768756799778998798789898877898889965958696446887843476762526426515244 +345151122435326774546477755588766796667978679897798799788798667756596585444845757774352236466242124 +324135422245435777577646446776855665599676997689997887788889876766665986567668467764463526524522524 +325343515546653536653454765454579566578777977788879878787979966579696677474785343347473444324354355 +411221244324436736446567757755797766577698989699898679769679676797557885877546755664674522365314215 +011225512566433343766434774658485575577887896689896789789788897667989867646846655537445534555245154 +353122224246523453336574684477667558859686788676888887889677967668868867745484457553323245424151214 +025211533334552466553436874465855779555988968677869768998666855765958765844553645533522566662215435 +011144555564545656657564766665457958988879979779789696768889888785895588848586367454333255641115431 +312135513646235366335766645784546897755855986679986669787888667577687576776674647476324553225412153 +401131435555652456777737485558685475567889776796686996966887777867565457675674635564364663332115334 +111542111546535443776533554556858445867565786988765999858788986988467667765674337645225253433114412 +324152522543244453747533764587454556659676798855686758699569787576577568846344576564242526335344431 +123513525116652325364735577676854466795879775965858579978758766786788576585574533555234644544424444 +201422231514666656435556464744556487779676697575668797755696587875664885475643663462362633532152224 +443133412441244332664735557756557478667877999697777576977768645754645558333564346654626425334525344 +431015242443666335263335435575686474856864565688697865686896558787678553436564534565256645251434512 +010022255222133364253766673665475577467776484765858776654564844676776444447654375652434614143215022 +112002141144134663334274465647734767886457477454887888474577867446657475453544742245245225443332224 +331232153352336525225567445365565486747774487468877475878758554778586376763333443326544225345123013 +320123541455416433363426343365775545857885758565575848877877686547673556675754423464442514232324111 +042432343324232554524246554574474345666464658776446546567878767443577744556362465553665411142432422 +142111123322431534522545253754364545474457775847846786887674646573467346333352524442333115335223141 +344133332441235422454233333556736343777476764657687856476465776533456554442553426542432524345343333 +200031013552112555654336435633347655674473538755855765665344475745556736546535462654344221551230302 +304022204315531423544354645467655764773637456746376536645753764476654735362436623665431353330033320 +001214000225135351445433524663673656735567443667544556374445736766637732424362445435124235202421144 +133240444115255522316642262344554645657446334644647444534543345455733253453543223511253231133210321 +324313341004114352115254632235242543363566666546735757746734646346355536356645334223223155213043334 +322012103401425423541123244634634342577565467364645454366476547536536356344363313411143511003322321 +030233343013121433455142565364335554237444577544465747334546363663525346435245514412331312412441220 +210201421410133422542335534522343332455655473755663556635632662655563553445642432325453033042340112 +012224401212432145413124536446542562653225343456763356434464356455233544345355532151231212104022112 +312232323430402414252325451525553345425256326265324326656464322435443535213233315511433100124021321 +010230232102113031224241215434543254266544664634225463436365465636465234441113521431122331212121101 +212212302203143433332245352152333246623456656325435343642442543354454522241344343333411433411331230 +011102200023414304323524211214225553365332454633645434256444354263245252314454334421304444012133303 +120113010124021413002342554241434235565233233626345455655236425423152444344321441224210011210001020 +101033322321412021400115241224135351431466535533654236552223322311141154321444212340220200110122301 +011220031300131001424314223221135334414132553352224226351421342145342332444324224232200001102210233 +121312303322224212003013214154522352135431322413434142221234334123523122531033230010321012211132201 +012020110022314203102101331443513341244141113213442111455332441213534235144341443443042312110221221 +100013222332201123334301101412554224524144445454322353452424512151232340130231214403422202221333120 +211200011012011223124042241233103554151124335225451435512351451314113131210120200021021301331230211 +222211000301233212310103403144201411351211113145331241322345244155131304344032001313100223022021012 From cdc39f10c87f523144ad43157c9288c948351ef4 Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Thu, 8 Dec 2022 19:44:41 +0000 Subject: [PATCH 34/52] after a bit of a break here's part 2 --- 2022/day8/day8-pt2.js | 93 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 2022/day8/day8-pt2.js diff --git a/2022/day8/day8-pt2.js b/2022/day8/day8-pt2.js new file mode 100644 index 0000000..3a4b3f3 --- /dev/null +++ b/2022/day8/day8-pt2.js @@ -0,0 +1,93 @@ +const readFileSync = require("fs").readFileSync; + +// Read Input file +const input = readFileSync("input.txt", { encoding: "utf8", flag: "r" }); + + +let grid = []; + +let i = 0; +for(const line of input.split("\n")) { + if(!line) continue; // skip blanks + + if(!grid[i]) grid[i] = []; // if there's no existing row then make one + + // build the rows by adding trees + for(const char of line.split("")) { + grid[i].push(char); + } + + i++; +} + +console.table(grid); + +let scores = []; + +for(let row in grid) { + for(let col in grid) { + // i hate JS + row = parseInt(row); + col = parseInt(col); + + const tree = grid[row][col]; + console.log("checking tree", tree, "at", row, col); + + // Efficiency? what's that? + + // check above + let visibleFromAbove = 0; + for(let i = row-1; i >= 0; i--) { // start one row above and move up + const checkTree = grid[i][col]; + if(checkTree >= tree) { + visibleFromAbove++; + break; + } + visibleFromAbove++ + } + + // check below + let visibleFromBelow = 0; + for (let i = row + 1; i < grid.length; i++) { // work downwards + const checkTree = grid[i][col]; + if (checkTree >= tree) { + visibleFromBelow++; + break; + } + visibleFromBelow++ + } + + // check left + let visibleFromLeft = 0; + for (let i = col-1; i >= 0; i--) { // work leftwards + const checkTree = grid[row][i]; + if (checkTree >= tree) { + visibleFromLeft++; + break; + } + visibleFromLeft++ + } + + // check right + let visibleFromRight = 0; + for (let i = col + 1; i < grid[row].length; i++) { // work rightwards + const checkTree = grid[row][i]; + if (checkTree >= tree) { + visibleFromRight++; + break; + } + visibleFromRight++ + } + + + const score = visibleFromAbove * visibleFromLeft * visibleFromBelow * visibleFromRight; + + console.log(" above", visibleFromAbove, "below", visibleFromBelow, "left", visibleFromLeft, "right", visibleFromRight, "for a score of", score); + + scores.push(score); + } + +} + +const sortedScores = scores.sort((a, b) => a - b).reverse(); +console.log(sortedScores[0]); From 940441e89e9c3ef6f7f99c91d620eef4d3ca6730 Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Thu, 8 Dec 2022 23:27:59 +0000 Subject: [PATCH 35/52] use branches for years (thanks @davwheat) --- {2022/day1 => day1}/day1.js | 0 {2022/day1 => day1}/input.txt | 0 {2022/day2 => day2}/day2-pt2.js | 0 {2022/day2 => day2}/day2.js | 0 {2022/day2 => day2}/input.txt | 0 {2022/day3 => day3}/day3-pt2.js | 0 {2022/day3 => day3}/day3.js | 0 {2022/day3 => day3}/input.txt | 0 {2022/day4 => day4}/day4-pt2.js | 0 {2022/day4 => day4}/day4.js | 0 {2022/day4 => day4}/input.txt | 0 {2022/day5 => day5}/day5-pt2.js | 0 {2022/day5 => day5}/day5.js | 0 {2022/day5 => day5}/input-test.txt | 0 {2022/day5 => day5}/input.txt | 0 {2022/day6 => day6}/day6.js | 0 {2022/day6 => day6}/input-test.txt | 0 {2022/day6 => day6}/input.txt | 0 {2022/day7 => day7}/day7.js | 0 {2022/day7 => day7}/input-test.txt | 0 {2022/day7 => day7}/input.txt | 0 {2022/day8 => day8}/day8-pt2.js | 0 {2022/day8 => day8}/day8.js | 0 {2022/day8 => day8}/input-test.txt | 0 {2022/day8 => day8}/input.txt | 0 25 files changed, 0 insertions(+), 0 deletions(-) rename {2022/day1 => day1}/day1.js (100%) rename {2022/day1 => day1}/input.txt (100%) rename {2022/day2 => day2}/day2-pt2.js (100%) rename {2022/day2 => day2}/day2.js (100%) rename {2022/day2 => day2}/input.txt (100%) rename {2022/day3 => day3}/day3-pt2.js (100%) rename {2022/day3 => day3}/day3.js (100%) rename {2022/day3 => day3}/input.txt (100%) rename {2022/day4 => day4}/day4-pt2.js (100%) rename {2022/day4 => day4}/day4.js (100%) rename {2022/day4 => day4}/input.txt (100%) rename {2022/day5 => day5}/day5-pt2.js (100%) rename {2022/day5 => day5}/day5.js (100%) rename {2022/day5 => day5}/input-test.txt (100%) rename {2022/day5 => day5}/input.txt (100%) rename {2022/day6 => day6}/day6.js (100%) rename {2022/day6 => day6}/input-test.txt (100%) rename {2022/day6 => day6}/input.txt (100%) rename {2022/day7 => day7}/day7.js (100%) rename {2022/day7 => day7}/input-test.txt (100%) rename {2022/day7 => day7}/input.txt (100%) rename {2022/day8 => day8}/day8-pt2.js (100%) rename {2022/day8 => day8}/day8.js (100%) rename {2022/day8 => day8}/input-test.txt (100%) rename {2022/day8 => day8}/input.txt (100%) diff --git a/2022/day1/day1.js b/day1/day1.js similarity index 100% rename from 2022/day1/day1.js rename to day1/day1.js diff --git a/2022/day1/input.txt b/day1/input.txt similarity index 100% rename from 2022/day1/input.txt rename to day1/input.txt diff --git a/2022/day2/day2-pt2.js b/day2/day2-pt2.js similarity index 100% rename from 2022/day2/day2-pt2.js rename to day2/day2-pt2.js diff --git a/2022/day2/day2.js b/day2/day2.js similarity index 100% rename from 2022/day2/day2.js rename to day2/day2.js diff --git a/2022/day2/input.txt b/day2/input.txt similarity index 100% rename from 2022/day2/input.txt rename to day2/input.txt diff --git a/2022/day3/day3-pt2.js b/day3/day3-pt2.js similarity index 100% rename from 2022/day3/day3-pt2.js rename to day3/day3-pt2.js diff --git a/2022/day3/day3.js b/day3/day3.js similarity index 100% rename from 2022/day3/day3.js rename to day3/day3.js diff --git a/2022/day3/input.txt b/day3/input.txt similarity index 100% rename from 2022/day3/input.txt rename to day3/input.txt diff --git a/2022/day4/day4-pt2.js b/day4/day4-pt2.js similarity index 100% rename from 2022/day4/day4-pt2.js rename to day4/day4-pt2.js diff --git a/2022/day4/day4.js b/day4/day4.js similarity index 100% rename from 2022/day4/day4.js rename to day4/day4.js diff --git a/2022/day4/input.txt b/day4/input.txt similarity index 100% rename from 2022/day4/input.txt rename to day4/input.txt diff --git a/2022/day5/day5-pt2.js b/day5/day5-pt2.js similarity index 100% rename from 2022/day5/day5-pt2.js rename to day5/day5-pt2.js diff --git a/2022/day5/day5.js b/day5/day5.js similarity index 100% rename from 2022/day5/day5.js rename to day5/day5.js diff --git a/2022/day5/input-test.txt b/day5/input-test.txt similarity index 100% rename from 2022/day5/input-test.txt rename to day5/input-test.txt diff --git a/2022/day5/input.txt b/day5/input.txt similarity index 100% rename from 2022/day5/input.txt rename to day5/input.txt diff --git a/2022/day6/day6.js b/day6/day6.js similarity index 100% rename from 2022/day6/day6.js rename to day6/day6.js diff --git a/2022/day6/input-test.txt b/day6/input-test.txt similarity index 100% rename from 2022/day6/input-test.txt rename to day6/input-test.txt diff --git a/2022/day6/input.txt b/day6/input.txt similarity index 100% rename from 2022/day6/input.txt rename to day6/input.txt diff --git a/2022/day7/day7.js b/day7/day7.js similarity index 100% rename from 2022/day7/day7.js rename to day7/day7.js diff --git a/2022/day7/input-test.txt b/day7/input-test.txt similarity index 100% rename from 2022/day7/input-test.txt rename to day7/input-test.txt diff --git a/2022/day7/input.txt b/day7/input.txt similarity index 100% rename from 2022/day7/input.txt rename to day7/input.txt diff --git a/2022/day8/day8-pt2.js b/day8/day8-pt2.js similarity index 100% rename from 2022/day8/day8-pt2.js rename to day8/day8-pt2.js diff --git a/2022/day8/day8.js b/day8/day8.js similarity index 100% rename from 2022/day8/day8.js rename to day8/day8.js diff --git a/2022/day8/input-test.txt b/day8/input-test.txt similarity index 100% rename from 2022/day8/input-test.txt rename to day8/input-test.txt diff --git a/2022/day8/input.txt b/day8/input.txt similarity index 100% rename from 2022/day8/input.txt rename to day8/input.txt From 1c6c6f6c57e6701183955f915f32743158f3a7b1 Mon Sep 17 00:00:00 2001 From: Thomas R Date: Thu, 8 Dec 2022 23:30:46 +0000 Subject: [PATCH 36/52] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f06bcec..4557db0 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -# Advent of Code Solutions +# Advent of Code Solutions (2022 Branch) -Contains my solutions for the [Advent of Code](https://adventofcode.com) challenges. +Contains my solutions for the [Advent of Code](https://adventofcode.com/2022) challenges. -They won't be efficient or beautiful but hopefully they will at least work :) \ No newline at end of file +They won't be efficient or beautiful but hopefully they will at least work :) From 773cf2b003f042e14c7364f5dec1c2c6fa2838d7 Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Fri, 9 Dec 2022 06:45:22 +0000 Subject: [PATCH 37/52] day 9 pt1 --- day9/day9.js | 53 ++ day9/input-test.txt | 8 + day9/input.txt | 2000 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 2061 insertions(+) create mode 100644 day9/day9.js create mode 100644 day9/input-test.txt create mode 100644 day9/input.txt diff --git a/day9/day9.js b/day9/day9.js new file mode 100644 index 0000000..540a54a --- /dev/null +++ b/day9/day9.js @@ -0,0 +1,53 @@ +const readFileSync = require("fs").readFileSync; + +// Read Input file +const input = readFileSync("input.txt", { encoding: "utf8", flag: "r" }); + +let visited = new Set(); +let headX = 0; +let headY = 0; +let tailX = 0; +let tailY = 0; + +for(const instruction of input.split("\n")) { + if(!instruction) continue; + + const direction = instruction.split(" ")[0].toLowerCase(); + const amount = parseInt(instruction.split(" ")[1]); + + console.log(direction, amount); + + for(let i = 0; i < amount; i++) { + switch (direction) { + case "u": // up + headY--; + break; + case "d": // down + headY++; + break; + case "l": // left + headX--; + break; + case "r": // right + headX++; + break; + } + + // if tail is no longer adjacent to head, move tail + if(Math.abs(headX - tailX) > 1 || Math.abs(headY - tailY) > 1) { + if(headX > tailX) tailX++; + if(headX < tailX) tailX--; + if(headY > tailY) tailY++; + if(headY < tailY) tailY--; + } + + visited.add(`${tailX},${tailY}`); + } + + + + console.log("head", headX, headY, "tail", tailX, tailY); + +} + +console.log(visited.size); diff --git a/day9/input-test.txt b/day9/input-test.txt new file mode 100644 index 0000000..cbea2b3 --- /dev/null +++ b/day9/input-test.txt @@ -0,0 +1,8 @@ +R 4 +U 4 +L 3 +D 1 +R 4 +D 1 +L 5 +R 2 \ No newline at end of file diff --git a/day9/input.txt b/day9/input.txt new file mode 100644 index 0000000..fd3f0e8 --- /dev/null +++ b/day9/input.txt @@ -0,0 +1,2000 @@ +L 1 +R 1 +D 1 +R 2 +D 2 +L 1 +D 1 +L 2 +R 1 +L 1 +U 1 +D 2 +R 1 +D 2 +R 1 +L 2 +D 1 +U 1 +L 2 +U 1 +D 1 +U 1 +D 2 +L 2 +D 2 +L 1 +D 2 +R 2 +L 1 +D 2 +R 2 +D 2 +R 1 +L 2 +U 1 +R 2 +U 2 +D 1 +R 2 +U 1 +R 2 +L 2 +U 1 +L 2 +D 2 +L 1 +U 1 +R 2 +U 1 +R 2 +U 1 +R 2 +U 2 +L 1 +U 2 +L 2 +R 2 +L 2 +R 2 +L 1 +D 1 +L 1 +U 1 +R 2 +L 1 +R 2 +L 1 +R 1 +L 2 +R 2 +D 1 +L 2 +R 1 +L 2 +R 1 +D 2 +U 2 +D 1 +R 2 +L 2 +D 2 +U 1 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R 12 +U 1 +L 18 +R 7 +L 18 +D 19 +U 9 +L 5 +D 5 +L 14 +U 2 +R 8 +D 19 +R 17 +U 6 +D 4 +R 7 +U 6 +R 14 +U 3 +D 17 +U 14 +R 19 +U 1 +R 17 +L 11 +U 18 +L 13 +R 16 +D 9 +L 3 +U 9 +D 5 +L 2 +D 5 +L 10 +U 10 +R 10 +U 6 +D 4 +R 3 +U 1 +L 18 +U 15 +R 2 +L 2 +U 9 +R 2 +U 8 +R 18 +D 16 +R 3 +D 6 +R 14 +L 15 +D 18 +L 12 +R 7 +L 18 +D 15 +R 13 +D 8 +L 8 +R 9 +L 4 +U 11 +R 12 +L 13 +U 12 +D 5 +L 4 +D 19 +R 10 +L 9 +U 18 \ No newline at end of file From cfcfef097dec89213becb7f3d7aeee91fda28b14 Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Fri, 9 Dec 2022 06:45:51 +0000 Subject: [PATCH 38/52] rm blank lines --- day9/day9.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/day9/day9.js b/day9/day9.js index 540a54a..64aedbb 100644 --- a/day9/day9.js +++ b/day9/day9.js @@ -44,10 +44,8 @@ for(const instruction of input.split("\n")) { visited.add(`${tailX},${tailY}`); } - - console.log("head", headX, headY, "tail", tailX, tailY); } -console.log(visited.size); +console.log(visited.size); \ No newline at end of file From 21e934a1a848e9d3df4957b8626cb5102efdbaf7 Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Fri, 9 Dec 2022 07:07:35 +0000 Subject: [PATCH 39/52] day 9 part 2 i think as a whole i hate day 9 the most --- day9/day9-pt2.js | 71 ++++++++++++++++++++++++++++++++++++++ day9/input-test-larger.txt | 8 +++++ 2 files changed, 79 insertions(+) create mode 100644 day9/day9-pt2.js create mode 100644 day9/input-test-larger.txt diff --git a/day9/day9-pt2.js b/day9/day9-pt2.js new file mode 100644 index 0000000..e4195a5 --- /dev/null +++ b/day9/day9-pt2.js @@ -0,0 +1,71 @@ +const readFileSync = require("fs").readFileSync; + +// Read Input file +const input = readFileSync("input.txt", { encoding: "utf8", flag: "r" }); + +let visited = new Set(); +let headX = 0; +let headY = 0; + +let knots = [] +for(let i = 0; i < 9; i++) knots.push([0, 0]); +// for easier reference to the knots +const x = 0; +const y = 1; + +for(const instruction of input.split("\n")) { + if(!instruction) continue; + + const direction = instruction.split(" ")[0].toLowerCase(); + const amount = parseInt(instruction.split(" ")[1]); + + console.log(direction, amount); + + for(let i = 0; i < amount; i++) { + switch (direction) { + case "u": // up + headY--; + break; + case "d": // down + headY++; + break; + case "l": // left + headX--; + break; + case "r": // right + headX++; + break; + } + + // first knot follows old tail logic + if (Math.abs(headX - knots[0][x]) > 1 || Math.abs(headY - knots[0][y]) > 1) { + if (headX > knots[0][x]) knots[0][x]++; + if (headX < knots[0][x]) knots[0][x]--; + if (headY > knots[0][y]) knots[0][y]++; + if (headY < knots[0][y]) knots[0][y]--; + } + + for(let knot in knots) { + // we've already moved the first knot + if(knot == 0) continue; + let prevKnot = knots[knot - 1]; + let thisKnot = knots[knot]; + + // if knot is no longer adjacent to prev knot, move it + if (Math.abs(prevKnot[x] - thisKnot[x]) > 1 || Math.abs(prevKnot[y] - thisKnot[y]) > 1) { + if (prevKnot[x] > thisKnot[x]) thisKnot[x]++; + if (prevKnot[x] < thisKnot[x]) thisKnot[x]--; + if (prevKnot[y] > thisKnot[y]) thisKnot[y]++; + if (prevKnot[y] < thisKnot[y]) thisKnot[y]--; + } + } + + const lastKnot = knots[knots.length - 1]; + visited.add(`${lastKnot[x]},${lastKnot[y]}`); + } + + console.log("head", headX, headY, "visited", visited.size); + +} + +console.log(visited.size); \ No newline at end of file diff --git a/day9/input-test-larger.txt b/day9/input-test-larger.txt new file mode 100644 index 0000000..60bd43b --- /dev/null +++ b/day9/input-test-larger.txt @@ -0,0 +1,8 @@ +R 5 +U 8 +L 8 +D 3 +R 17 +D 10 +L 25 +U 20 From d6625269d62f70e1f36263cbab2236b9df3f3e6b Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Fri, 9 Dec 2022 07:36:54 +0000 Subject: [PATCH 40/52] zeropad filenames ready for day10 --- day1/day1.js => day01/day01.js | 0 {day1 => day01}/input.txt | 0 day2/day2-pt2.js => day02/day02-pt2.js | 0 day2/day2.js => day02/day02.js | 0 {day2 => day02}/input.txt | 0 day3/day3-pt2.js => day03/day03-pt2.js | 0 day3/day3.js => day03/day03.js | 0 {day3 => day03}/input.txt | 0 day4/day4-pt2.js => day04/day04-pt2.js | 0 day4/day4.js => day04/day04.js | 0 {day4 => day04}/input.txt | 0 day5/day5-pt2.js => day05/day05-pt2.js | 0 day5/day5.js => day05/day05.js | 0 {day5 => day05}/input-test.txt | 0 {day5 => day05}/input.txt | 0 day6/day6.js => day06/day06.js | 0 {day6 => day06}/input-test.txt | 0 {day6 => day06}/input.txt | 0 day7/day7.js => day07/day07.js | 0 {day7 => day07}/input-test.txt | 0 {day7 => day07}/input.txt | 0 day8/day8-pt2.js => day08/day08-pt2.js | 0 day8/day8.js => day08/day08.js | 0 {day8 => day08}/input-test.txt | 0 {day8 => day08}/input.txt | 0 day9/day9-pt2.js => day09/day09-pt2.js | 0 day9/day9.js => day09/day09.js | 0 {day9 => day09}/input-test-larger.txt | 0 {day9 => day09}/input-test.txt | 0 {day9 => day09}/input.txt | 0 30 files changed, 0 insertions(+), 0 deletions(-) rename day1/day1.js => day01/day01.js (100%) rename {day1 => day01}/input.txt (100%) rename day2/day2-pt2.js => day02/day02-pt2.js (100%) rename day2/day2.js => day02/day02.js (100%) rename {day2 => day02}/input.txt (100%) rename day3/day3-pt2.js => day03/day03-pt2.js (100%) rename day3/day3.js => day03/day03.js (100%) rename {day3 => day03}/input.txt (100%) rename day4/day4-pt2.js => day04/day04-pt2.js (100%) rename day4/day4.js => day04/day04.js (100%) rename {day4 => day04}/input.txt (100%) rename day5/day5-pt2.js => day05/day05-pt2.js (100%) rename day5/day5.js => day05/day05.js (100%) rename {day5 => day05}/input-test.txt (100%) rename {day5 => day05}/input.txt (100%) rename day6/day6.js => day06/day06.js (100%) rename {day6 => day06}/input-test.txt (100%) rename {day6 => day06}/input.txt (100%) rename day7/day7.js => day07/day07.js (100%) rename {day7 => day07}/input-test.txt (100%) rename {day7 => day07}/input.txt (100%) rename day8/day8-pt2.js => day08/day08-pt2.js (100%) rename day8/day8.js => day08/day08.js (100%) rename {day8 => day08}/input-test.txt (100%) rename {day8 => day08}/input.txt (100%) rename day9/day9-pt2.js => day09/day09-pt2.js (100%) rename day9/day9.js => day09/day09.js (100%) rename {day9 => day09}/input-test-larger.txt (100%) rename {day9 => day09}/input-test.txt (100%) rename {day9 => day09}/input.txt (100%) diff --git a/day1/day1.js b/day01/day01.js similarity index 100% rename from day1/day1.js rename to day01/day01.js diff --git a/day1/input.txt b/day01/input.txt similarity index 100% rename from day1/input.txt rename to day01/input.txt diff --git a/day2/day2-pt2.js b/day02/day02-pt2.js similarity index 100% rename from day2/day2-pt2.js rename to day02/day02-pt2.js diff --git a/day2/day2.js b/day02/day02.js similarity index 100% rename from day2/day2.js rename to day02/day02.js diff --git a/day2/input.txt b/day02/input.txt similarity index 100% rename from day2/input.txt rename to day02/input.txt diff --git a/day3/day3-pt2.js b/day03/day03-pt2.js similarity index 100% rename from day3/day3-pt2.js rename to day03/day03-pt2.js diff --git a/day3/day3.js b/day03/day03.js similarity index 100% rename from day3/day3.js rename to day03/day03.js diff --git a/day3/input.txt b/day03/input.txt similarity index 100% rename from day3/input.txt rename to day03/input.txt diff --git a/day4/day4-pt2.js b/day04/day04-pt2.js similarity index 100% rename from day4/day4-pt2.js rename to day04/day04-pt2.js diff --git a/day4/day4.js b/day04/day04.js similarity index 100% rename from day4/day4.js rename to day04/day04.js diff --git a/day4/input.txt b/day04/input.txt similarity index 100% rename from day4/input.txt rename to day04/input.txt diff --git a/day5/day5-pt2.js b/day05/day05-pt2.js similarity index 100% rename from day5/day5-pt2.js rename to day05/day05-pt2.js diff --git a/day5/day5.js b/day05/day05.js similarity index 100% rename from day5/day5.js rename to day05/day05.js diff --git a/day5/input-test.txt b/day05/input-test.txt similarity index 100% rename from day5/input-test.txt rename to day05/input-test.txt diff --git a/day5/input.txt b/day05/input.txt similarity index 100% rename from day5/input.txt rename to day05/input.txt diff --git a/day6/day6.js b/day06/day06.js similarity index 100% rename from day6/day6.js rename to day06/day06.js diff --git a/day6/input-test.txt b/day06/input-test.txt similarity index 100% rename from day6/input-test.txt rename to day06/input-test.txt diff --git a/day6/input.txt b/day06/input.txt similarity index 100% rename from day6/input.txt rename to day06/input.txt diff --git a/day7/day7.js b/day07/day07.js similarity index 100% rename from day7/day7.js rename to day07/day07.js diff --git a/day7/input-test.txt b/day07/input-test.txt similarity index 100% rename from day7/input-test.txt rename to day07/input-test.txt diff --git a/day7/input.txt b/day07/input.txt similarity index 100% rename from day7/input.txt rename to day07/input.txt diff --git a/day8/day8-pt2.js b/day08/day08-pt2.js similarity index 100% rename from day8/day8-pt2.js rename to day08/day08-pt2.js diff --git a/day8/day8.js b/day08/day08.js similarity index 100% rename from day8/day8.js rename to day08/day08.js diff --git a/day8/input-test.txt b/day08/input-test.txt similarity index 100% rename from day8/input-test.txt rename to day08/input-test.txt diff --git a/day8/input.txt b/day08/input.txt similarity index 100% rename from day8/input.txt rename to day08/input.txt diff --git a/day9/day9-pt2.js b/day09/day09-pt2.js similarity index 100% rename from day9/day9-pt2.js rename to day09/day09-pt2.js diff --git a/day9/day9.js b/day09/day09.js similarity index 100% rename from day9/day9.js rename to day09/day09.js diff --git a/day9/input-test-larger.txt b/day09/input-test-larger.txt similarity index 100% rename from day9/input-test-larger.txt rename to day09/input-test-larger.txt diff --git a/day9/input-test.txt b/day09/input-test.txt similarity index 100% rename from day9/input-test.txt rename to day09/input-test.txt diff --git a/day9/input.txt b/day09/input.txt similarity index 100% rename from day9/input.txt rename to day09/input.txt From 5c347271618567b8e47a432e1ed85dab115cca95 Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Sat, 10 Dec 2022 17:41:09 +0000 Subject: [PATCH 41/52] day 10 pt1 --- day10/day10.js | 47 ++++++++++++ day10/input-test-larger.txt | 146 ++++++++++++++++++++++++++++++++++++ day10/input-test.txt | 3 + day10/input.txt | 137 +++++++++++++++++++++++++++++++++ 4 files changed, 333 insertions(+) create mode 100644 day10/day10.js create mode 100644 day10/input-test-larger.txt create mode 100644 day10/input-test.txt create mode 100644 day10/input.txt diff --git a/day10/day10.js b/day10/day10.js new file mode 100644 index 0000000..21d43be --- /dev/null +++ b/day10/day10.js @@ -0,0 +1,47 @@ +const readFileSync = require("fs").readFileSync; + +// Read Input file +const input = readFileSync("input.txt", { encoding: "utf8", flag: "r" }); + +let cycle = 1; +let registerX = 1; +let valuesAtCycle = []; + +const cyclesToCheck = [20, 60, 100, 140, 180, 220]; + +for(const instruction of input.split("\n")) { + if(!instruction) continue; // ignore blank lines + + const opcode = instruction.split(" ")[0]; + const value = instruction.split(" ")[1]; + + switch (opcode) { + case "noop": + // "noop takes one cycle to complete. It has no other effect." + valuesAtCycle.push(registerX); + cycle++; + break; + case "addx": + // "addx V takes two cycles to complete. After two cycles, the X register is increased by the value V. (V can be negative.)" + cycle++; + valuesAtCycle.push(registerX); + + registerX += parseInt(value); + + cycle++; + valuesAtCycle.push(registerX); + break; + } + + // console.log(cycle, opcode, value, registerX); +} + + +let sum = 0; + +for(const c of cyclesToCheck) { + console.log(c, valuesAtCycle[c-1]); + sum+= (valuesAtCycle[c-2] * c); +} + +console.log(sum); \ No newline at end of file diff --git a/day10/input-test-larger.txt b/day10/input-test-larger.txt new file mode 100644 index 0000000..37ee8ee --- /dev/null +++ b/day10/input-test-larger.txt @@ -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 diff --git a/day10/input-test.txt b/day10/input-test.txt new file mode 100644 index 0000000..fd7eba8 --- /dev/null +++ b/day10/input-test.txt @@ -0,0 +1,3 @@ +noop +addx 3 +addx -5 \ No newline at end of file diff --git a/day10/input.txt b/day10/input.txt new file mode 100644 index 0000000..42295c4 --- /dev/null +++ b/day10/input.txt @@ -0,0 +1,137 @@ +noop +noop +noop +addx 4 +addx 1 +addx 5 +addx 1 +addx 5 +noop +addx -1 +addx -6 +addx 11 +noop +noop +noop +noop +addx 6 +addx 5 +noop +noop +noop +addx -30 +addx 34 +addx 2 +addx -39 +noop +addx 5 +addx 2 +addx 19 +addx -18 +addx 2 +addx 5 +addx 2 +addx 3 +noop +addx 2 +addx 3 +noop +addx 2 +addx 3 +noop +addx 2 +addx 3 +noop +addx 2 +addx -15 +addx -22 +noop +noop +addx 5 +addx 2 +noop +noop +addx 14 +addx -11 +addx 5 +addx 2 +addx 3 +noop +addx 2 +addx -16 +addx 17 +addx 2 +addx 5 +addx 2 +addx -6 +addx -25 +addx 35 +addx 1 +addx -36 +addx 1 +addx 22 +addx -19 +addx 5 +addx 2 +noop +noop +addx 5 +noop +noop +noop +addx 1 +addx 4 +noop +noop +noop +addx 5 +noop +addx 1 +addx 2 +addx 3 +addx 4 +addx -34 +addx 21 +addx -24 +addx 2 +addx 5 +addx 7 +addx -6 +addx 2 +addx 30 +addx -23 +addx 10 +addx -9 +addx 2 +addx 2 +addx 5 +addx -12 +addx 13 +addx 2 +addx 5 +addx 2 +addx -12 +addx -24 +addx -1 +noop +addx 3 +addx 3 +addx 1 +addx 5 +addx 21 +addx -16 +noop +addx 19 +addx -18 +addx 2 +addx 5 +addx 2 +addx 3 +noop +addx 3 +addx -1 +addx 1 +addx 2 +addx -18 +addx 1 +noop From 363e9a7f6734cb24a06b9aa4a97d3287006b26d4 Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Mon, 12 Dec 2022 17:03:06 +0000 Subject: [PATCH 42/52] having a life means i am a day late to day 11 :( --- day11/day11.js | 73 ++++++++++++++++++++++++++++++++++++++++++++ day11/input-test.txt | 27 ++++++++++++++++ day11/input.txt | 55 +++++++++++++++++++++++++++++++++ 3 files changed, 155 insertions(+) create mode 100644 day11/day11.js create mode 100644 day11/input-test.txt create mode 100644 day11/input.txt diff --git a/day11/day11.js b/day11/day11.js new file mode 100644 index 0000000..32703e3 --- /dev/null +++ b/day11/day11.js @@ -0,0 +1,73 @@ +const readFileSync = require("fs").readFileSync; + +// Read Input file +const input = readFileSync("input.txt", { encoding: "utf8", flag: "r" }); + +class Monkey { + constructor(num, startingItems, operation, operand, divisor, ifTrue, ifFalse) { + this.num = num; + this.items = startingItems; + this.operation = operation; + this.operand = operand; + this.divisor = divisor; + this.ifTrue = ifTrue; + this.ifFalse = ifFalse; + this.inspected = 0; + } + + giveItem(item) { + this.items.push(item); + } + + inspectItems() { + // inspect each item, working backwards from the end of the array + for (let i = this.items.length - 1; i >= 0; i--) { + const item = this.items[i]; + + const operand = parseInt((Number.isInteger(this.operand)) ? this.operand : item); // if the operand is "old" set it as the current worry level + const worryLevel = Math.floor(eval(`(${item} ${this.operation} ${operand}) / 3`)); + + if (worryLevel % parseInt(this.divisor) === 0) { + const recipient = monkeys.find(m => m.num === parseInt(this.ifTrue)); + recipient.giveItem(worryLevel); + + } else { + const recipient = monkeys.find(m => m.num === parseInt(this.ifFalse)); + recipient.giveItem(worryLevel); + } + + // remove this item from the array + this.items.splice(i, 1); + + this.inspected++; + } + } +} + +// FIGURE OUT THE SILLY INPUT + +let monkeys = []; + +for (const monkey of input.split("\n\n")) { + const splitMonkey = monkey.split("\n"); + const num = parseInt(splitMonkey[0].replace(/[^0-9]/g, "")); + const startingItems = splitMonkey[1].replace(/[^0-9,]/g, "").split(','); + const operation = splitMonkey[2].charAt(23); + const operand = parseInt(splitMonkey[2].replace(/[^0-9]/g, "")); + const divisor = parseInt(splitMonkey[3].replace(/[^0-9]/g, "")); + const ifTrue = parseInt(splitMonkey[4].replace(/[^0-9]/g, "")); + const ifFalse = parseInt(splitMonkey[5].replace(/[^0-9]/g, "")); + + monkeys.push(new Monkey(num, startingItems, operation, operand, divisor, ifTrue, ifFalse)); +} + +// do twenty rounds of inspecting items +for (let i = 0; i < 20; i++) { + monkeys.forEach(m => m.inspectItems()); +} + +// get top two monkeys based on items inspected (thank you copilot ily) +const topMonkeys = monkeys.sort((a, b) => b.inspected - a.inspected).slice(0, 2); + +const monkeyBusiness = topMonkeys[0].inspected * topMonkeys[1].inspected; +console.log("part one: ", monkeyBusiness); \ No newline at end of file diff --git a/day11/input-test.txt b/day11/input-test.txt new file mode 100644 index 0000000..30e09e5 --- /dev/null +++ b/day11/input-test.txt @@ -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 diff --git a/day11/input.txt b/day11/input.txt new file mode 100644 index 0000000..c104b9c --- /dev/null +++ b/day11/input.txt @@ -0,0 +1,55 @@ +Monkey 0: + Starting items: 54, 89, 94 + Operation: new = old * 7 + Test: divisible by 17 + If true: throw to monkey 5 + If false: throw to monkey 3 + +Monkey 1: + Starting items: 66, 71 + Operation: new = old + 4 + Test: divisible by 3 + If true: throw to monkey 0 + If false: throw to monkey 3 + +Monkey 2: + Starting items: 76, 55, 80, 55, 55, 96, 78 + Operation: new = old + 2 + Test: divisible by 5 + If true: throw to monkey 7 + If false: throw to monkey 4 + +Monkey 3: + Starting items: 93, 69, 76, 66, 89, 54, 59, 94 + Operation: new = old + 7 + Test: divisible by 7 + If true: throw to monkey 5 + If false: throw to monkey 2 + +Monkey 4: + Starting items: 80, 54, 58, 75, 99 + Operation: new = old * 17 + Test: divisible by 11 + If true: throw to monkey 1 + If false: throw to monkey 6 + +Monkey 5: + Starting items: 69, 70, 85, 83 + Operation: new = old + 8 + Test: divisible by 19 + If true: throw to monkey 2 + If false: throw to monkey 7 + +Monkey 6: + Starting items: 89 + Operation: new = old + 6 + Test: divisible by 2 + If true: throw to monkey 0 + If false: throw to monkey 1 + +Monkey 7: + Starting items: 62, 80, 58, 57, 93, 56 + Operation: new = old * old + Test: divisible by 13 + If true: throw to monkey 6 + If false: throw to monkey 4 \ No newline at end of file From 54ab6a7c2cefffa688fbfeaf5206a39a5b39c9ca Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Mon, 12 Dec 2022 17:33:49 +0000 Subject: [PATCH 43/52] day 11 part two (i have no idea) --- day11/day11.js | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/day11/day11.js b/day11/day11.js index 32703e3..8d3e3c7 100644 --- a/day11/day11.js +++ b/day11/day11.js @@ -1,8 +1,16 @@ const readFileSync = require("fs").readFileSync; - -// Read Input file const input = readFileSync("input.txt", { encoding: "utf8", flag: "r" }); +const ROUNDS = 10000; // 20 for part one, 10000 for part two + +// i found this on the subreddit and i have no idea what it means even after reading the theory +// thanks j122j: https://www.reddit.com/r/adventofcode/comments/zifqmh/2022_day_11_solutions/izuniw9/ +// and jake-gordon: https://github.com/jake-gordon/aoc/blob/main/2022/D11/Explanation.md +let thisIsBeyondMyMathsGrade = 1; + +// monkey cage +let monkeys = []; + class Monkey { constructor(num, startingItems, operation, operand, divisor, ifTrue, ifFalse) { this.num = num; @@ -25,29 +33,32 @@ class Monkey { const item = this.items[i]; const operand = parseInt((Number.isInteger(this.operand)) ? this.operand : item); // if the operand is "old" set it as the current worry level - const worryLevel = Math.floor(eval(`(${item} ${this.operation} ${operand}) / 3`)); + + const worryLevelA = Math.floor(eval(`(${item} ${this.operation} ${operand})`)); + const worryLevel = worryLevelA % thisIsBeyondMyMathsGrade; // thank you subreddit + + if (worryLevel === Infinity) throw new Error(`uh oh: ${item} ${this.operation} ${operand} = ${worryLevelA} (mod ${thisIsBeyondMyMathsGrade} = ${worryLevel})`); if (worryLevel % parseInt(this.divisor) === 0) { - const recipient = monkeys.find(m => m.num === parseInt(this.ifTrue)); + const recipient = monkeys[parseInt(this.ifTrue)]; recipient.giveItem(worryLevel); } else { - const recipient = monkeys.find(m => m.num === parseInt(this.ifFalse)); + const recipient = monkeys[parseInt(this.ifFalse)]; recipient.giveItem(worryLevel); } // remove this item from the array this.items.splice(i, 1); + this.inspected++; } } } -// FIGURE OUT THE SILLY INPUT - -let monkeys = []; +// FIGURE OUT THE SILLY INPUT for (const monkey of input.split("\n\n")) { const splitMonkey = monkey.split("\n"); const num = parseInt(splitMonkey[0].replace(/[^0-9]/g, "")); @@ -61,8 +72,10 @@ for (const monkey of input.split("\n\n")) { monkeys.push(new Monkey(num, startingItems, operation, operand, divisor, ifTrue, ifFalse)); } -// do twenty rounds of inspecting items -for (let i = 0; i < 20; i++) { +thisIsBeyondMyMathsGrade = monkeys.reduce((a, b) => a * b.divisor, 1); + +// do the rounds of inspecting items +for (let i = 0; i < ROUNDS; i++) { monkeys.forEach(m => m.inspectItems()); } @@ -70,4 +83,4 @@ for (let i = 0; i < 20; i++) { const topMonkeys = monkeys.sort((a, b) => b.inspected - a.inspected).slice(0, 2); const monkeyBusiness = topMonkeys[0].inspected * topMonkeys[1].inspected; -console.log("part one: ", monkeyBusiness); \ No newline at end of file +console.log(monkeyBusiness); \ No newline at end of file From 3cd3a645964eb740099e48b6815517ae39315588 Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Mon, 12 Dec 2022 20:08:12 +0000 Subject: [PATCH 44/52] brokey non-solution --- day12/day12.js | 120 +++++++++++++++++++++++++++++++++++++++++++ day12/input-test.txt | 5 ++ day12/input.txt | 41 +++++++++++++++ 3 files changed, 166 insertions(+) create mode 100644 day12/day12.js create mode 100644 day12/input-test.txt create mode 100644 day12/input.txt diff --git a/day12/day12.js b/day12/day12.js new file mode 100644 index 0000000..9a684cc --- /dev/null +++ b/day12/day12.js @@ -0,0 +1,120 @@ +const readFileSync = require("fs").readFileSync; +const input = readFileSync("input-test.txt", { encoding: "utf8", flag: "r" }); + +let grid = []; + +for (let y in input.split("\n")) { + y = parseInt(y); + + const line = input.split("\n")[y]; + + if(!grid[y]) grid[y] = []; // init missing rows + + for (let x in line.split("")) { + x = parseInt(x); + + const letter = line.split("")[x]; + + // set to height value of the letter (1-26) + grid[y][x] = {x, y, letter, height: letter.charCodeAt(0) - 96, visited: false, dist: Infinity}; + + // if it's the start, set to height zero + if(letter === "S") grid[y][x].height = 0; + + // if it's the end, set to height 27 and dist to 0 + if(letter === "E") grid[y][x].height = 27; + if(letter === "E") grid[y][x].dist = 0; + } +} + + +console.log(grid); + +// find the starting X and Y +let start = {}; + +for(const y in grid) { + for (const x in grid[y]) { + if(grid[y][x].letter == "E") start = grid[y][x]; + } +} + +let queue = []; + +// add the goal point to the queue +queue.push(start); + +// while there are still points in the queue +while (queue.length > 0) { + const currentSpot = queue[0]; + const x = parseInt(currentSpot.x); + const y = parseInt(currentSpot.y); + + // remove the current spot from the queue + queue.shift(); + + if(currentSpot.letter === "S") { console.log("FOUND THE START!"); break; } + + // if in visited, skip + if(currentSpot.visited === true) continue; + + currentSpot.visited = true; + + + // add the adjacent points to the queue if they exist + + const ourHeight = currentSpot.height; + const ourDist = currentSpot.dist; + + // square above + if (grid[y - 1]) { // check it exists + if (grid[y - 1][x].height <= ourHeight) { + grid[y - 1][x].dist = ourDist + 1; + queue.push(grid[y - 1][x]); // if it's not too high, add + } + } + + // square to the right + if (grid[y][x + 1]) { + if (grid[y][x + 1].height <= ourHeight) { + grid[y][x + 1].dist = ourDist + 1; + queue.push(grid[y][x + 1]); + } + } + + // square below + if (grid[y + 1]) { + if (grid[y + 1][x].height <= ourHeight) { + grid[y + 1][x].dist = ourDist + 1; + queue.push(grid[y + 1][x]); + } + } + + // square to the left + if (grid[y][x - 1]) { + if (grid[y][x - 1].height <= ourHeight) { + grid[y][x - 1].dist = ourDist + 1; + queue.push(grid[y][x - 1]); + } + } + + printGrid(); +} + + +function printGrid() { + let outGrid = ""; + for (let y in grid) { + for (let x in grid[y]) { + outGrid += grid[y][x].letter; + outGrid += (grid[y][x].visited === true) ? "y" : "n"; + outGrid += (grid[y][x].dist === Infinity) ? "∞" : grid[y][x].dist; + outGrid += " "; + } + outGrid += "\n"; + } + + console.log(outGrid); +} + + diff --git a/day12/input-test.txt b/day12/input-test.txt new file mode 100644 index 0000000..433e0d2 --- /dev/null +++ b/day12/input-test.txt @@ -0,0 +1,5 @@ +Sabqponm +abcryxxl +accszExk +acctuvwj +abdefghi \ No newline at end of file diff --git a/day12/input.txt b/day12/input.txt new file mode 100644 index 0000000..50f04d9 --- /dev/null +++ b/day12/input.txt @@ -0,0 +1,41 @@ +abccccaaaaaaacccaaaaaaaccccccccccccccccccccccccccccccccccaaaa +abcccccaaaaaacccaaaaaaaaaaccccccccccccccccccccccccccccccaaaaa +abccaaaaaaaaccaaaaaaaaaaaaaccccccccccccccccccccccccccccaaaaaa +abccaaaaaaaaaaaaaaaaaaaaaaacccccccccaaaccccacccccccccccaaacaa +abaccaaaaaaaaaaaaaaaaaacacacccccccccaaacccaaaccccccccccccccaa +abaccccaaaaaaaaaaaaaaaacccccccccccccaaaaaaaaaccccccccccccccaa +abaccccaacccccccccaaaaaacccccccccccccaaaaaaaacccccccccccccccc +abcccccaaaacccccccaaaaaaccccccccijjjjjjaaaaaccccccaaccaaccccc +abccccccaaaaacccccaaaacccccccciiijjjjjjjjjkkkkkkccaaaaaaccccc +abcccccaaaaacccccccccccccccccciiiirrrjjjjjkkkkkkkkaaaaaaccccc +abcccccaaaaaccccccccccccccccciiiirrrrrrjjjkkkkkkkkkaaaaaccccc +abaaccacaaaaacccccccccccccccciiiqrrrrrrrrrrssssskkkkaaaaacccc +abaaaaacaaccccccccccccccccccciiiqqrtuurrrrrsssssskklaaaaacccc +abaaaaacccccccccccaaccccccccciiqqqttuuuurrssusssslllaaccccccc +abaaaaaccccccccaaaaccccccccciiiqqqttuuuuuuuuuuusslllaaccccccc +abaaaaaacccccccaaaaaaccccccciiiqqqttxxxuuuuuuuusslllccccccccc +abaaaaaaccccaaccaaaaacccccchhiiqqtttxxxxuyyyyvvsslllccccccccc +abaaacacccccaacaaaaaccccccchhhqqqqttxxxxxyyyyvvsslllccccccccc +abaaacccccccaaaaaaaacccccchhhqqqqtttxxxxxyyyvvssqlllccccccccc +abacccccaaaaaaaaaaccaaacchhhpqqqtttxxxxxyyyyvvqqqlllccccccccc +SbaaacaaaaaaaaaaaacaaaaahhhhppttttxxEzzzzyyvvvqqqqlllcccccccc +abaaaaaaacaaaaaacccaaaaahhhppptttxxxxxyyyyyyyvvqqqlllcccccccc +abaaaaaaccaaaaaaaccaaaaahhhppptttxxxxywyyyyyyvvvqqqmmcccccccc +abaaaaaaacaaaaaaacccaaaahhhpppsssxxwwwyyyyyyvvvvqqqmmmccccccc +abaaaaaaaaaaaaaaacccaacahhhpppssssssswyyywwvvvvvqqqmmmccccccc +abaaaaaaaacacaaaacccccccgggppppsssssswwywwwwvvvqqqqmmmccccccc +abcaaacaaaccccaaaccccccccgggppppppssswwwwwrrrrrqqqmmmmccccccc +abcaaacccccccccccccccccccgggggpppoosswwwwwrrrrrqqmmmmddcccccc +abccaacccccccccccccccccccccgggggoooosswwwrrrnnnmmmmmddddccccc +abccccccccccccccccccccccccccgggggooossrrrrrnnnnnmmmddddaccccc +abaccccaacccccccccccccccccccccgggfoossrrrrnnnnndddddddaaacccc +abaccaaaaaaccccccccccccccccccccgffooorrrrnnnneeddddddaaaacccc +abaccaaaaaacccccccccccccccccccccfffooooonnnneeeddddaaaacccccc +abacccaaaaaccccccccaaccaaaccccccffffoooonnneeeeccaaaaaacccccc +abcccaaaaacccccccccaaccaaaaccccccffffoooneeeeeaccccccaacccccc +abaccaaaaaccccccccaaaacaaaaccccccafffffeeeeeaaacccccccccccccc +abacccccccccccccccaaaacaaacccccccccffffeeeecccccccccccccccaac +abaaaacccccccaaaaaaaaaaaaaacccccccccfffeeeccccccccccccccccaaa +abaaaacccccccaaaaaaaaaaaaaaccccccccccccaacccccccccccccccccaaa +abaacccccccccaaaaaaaaaaaaaaccccccccccccaacccccccccccccccaaaaa +abaaaccccccccccaaaaaaaaccccccccccccccccccccccccccccccccaaaaaa From 4969cb13b2bf171effad96dac85c75d53c768d7b Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Mon, 12 Dec 2022 20:36:59 +0000 Subject: [PATCH 45/52] day 12 but working! --- day12/day12.js | 113 ++++++++++++++++++++++++------------------------- 1 file changed, 56 insertions(+), 57 deletions(-) diff --git a/day12/day12.js b/day12/day12.js index 9a684cc..837c095 100644 --- a/day12/day12.js +++ b/day12/day12.js @@ -1,7 +1,9 @@ const readFileSync = require("fs").readFileSync; -const input = readFileSync("input-test.txt", { encoding: "utf8", flag: "r" }); +const input = readFileSync("input.txt", { encoding: "utf8", flag: "r" }); let grid = []; +let start; +let end; for (let y in input.split("\n")) { y = parseInt(y); @@ -19,97 +21,94 @@ for (let y in input.split("\n")) { grid[y][x] = {x, y, letter, height: letter.charCodeAt(0) - 96, visited: false, dist: Infinity}; // if it's the start, set to height zero - if(letter === "S") grid[y][x].height = 0; - - // if it's the end, set to height 27 and dist to 0 - if(letter === "E") grid[y][x].height = 27; - if(letter === "E") grid[y][x].dist = 0; - } -} - - -console.log(grid); - -// find the starting X and Y -let start = {}; + if(letter === "S") { + grid[y][x].height = 0; + grid[y][x].dist = 0; + start = grid[y][x]; + } -for(const y in grid) { - for (const x in grid[y]) { - if(grid[y][x].letter == "E") start = grid[y][x]; + // if it's the end, set to height 27 + if(letter === "E") { + grid[y][x].height = 27; + end = grid[y][x]; + } } } -let queue = []; -// add the goal point to the queue -queue.push(start); +let queue = [start]; // while there are still points in the queue while (queue.length > 0) { const currentSpot = queue[0]; - const x = parseInt(currentSpot.x); - const y = parseInt(currentSpot.y); + const x = currentSpot.x; + const y = currentSpot.y; - // remove the current spot from the queue + // remove the current point from the queue queue.shift(); - if(currentSpot.letter === "S") { console.log("FOUND THE START!"); break; } - - // if in visited, skip - if(currentSpot.visited === true) continue; - + // ignore visited spots + if(currentSpot.visited) continue; currentSpot.visited = true; - // add the adjacent points to the queue if they exist - - const ourHeight = currentSpot.height; - const ourDist = currentSpot.dist; + if(currentSpot.letter === end.letter) { + console.log("Found end!"); + console.log(currentSpot); + break; + } - // square above - if (grid[y - 1]) { // check it exists - if (grid[y - 1][x].height <= ourHeight) { - grid[y - 1][x].dist = ourDist + 1; - queue.push(grid[y - 1][x]); // if it's not too high, add + // check the 4 surrounding points + // if they are not visited, and are within the height limit, add them to the queue + + // above + const spotAbove = (grid[y-1]) ? grid[y-1][x] : false; + if(spotAbove) { // make sure the row exists + if(spotAbove.height <= currentSpot.height+1 && !spotAbove.visited) { + spotAbove.dist = currentSpot.dist + 1; // set its distance + queue.push(spotAbove); // add it to queue } } - // square to the right - if (grid[y][x + 1]) { - if (grid[y][x + 1].height <= ourHeight) { - grid[y][x + 1].dist = ourDist + 1; - queue.push(grid[y][x + 1]); + // below + const spotBelow = (grid[y+1]) ? grid[y+1][x] : false; + if(spotBelow) { // make sure the row exists + if(spotBelow.height <= currentSpot.height+1 && !spotBelow.visited) { + spotBelow.dist = currentSpot.dist + 1; // set its distance + queue.push(spotBelow); // add it to queue } } - // square below - if (grid[y + 1]) { - if (grid[y + 1][x].height <= ourHeight) { - grid[y + 1][x].dist = ourDist + 1; - queue.push(grid[y + 1][x]); + // left + const spotLeft = (grid[y][x-1]) ? grid[y][x-1] : false; + if(spotLeft) { // make sure the row exists + if(spotLeft.height <= currentSpot.height+1 && !spotLeft.visited) { + spotLeft.dist = currentSpot.dist + 1; // set its distance + queue.push(spotLeft); // add it to queue } } - // square to the left - if (grid[y][x - 1]) { - if (grid[y][x - 1].height <= ourHeight) { - grid[y][x - 1].dist = ourDist + 1; - queue.push(grid[y][x - 1]); + // right + const spotRight = (grid[y][x+1]) ? grid[y][x+1] : false; + if(spotRight) { // make sure the row exists + if(spotRight.height <= currentSpot.height+1 && !spotRight.visited) { + spotRight.dist = currentSpot.dist + 1; // set its distance + queue.push(spotRight); // add it to queue } } printGrid(); } - function printGrid() { let outGrid = ""; for (let y in grid) { for (let x in grid[y]) { - outGrid += grid[y][x].letter; - outGrid += (grid[y][x].visited === true) ? "y" : "n"; - outGrid += (grid[y][x].dist === Infinity) ? "∞" : grid[y][x].dist; - outGrid += " "; + outGrid += (grid[y][x].visited) ? "#" : grid[y][x].letter; + // outGrid += grid[y][x].letter; + // outGrid += (grid[y][x].visited === true) ? "y" : "n"; + // outGrid += (grid[y][x].dist === Infinity) ? "∞" : grid[y][x].dist; + // outGrid += " "; } outGrid += "\n"; } From b143619adf9c292f431db877fa39d096772b72da Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Mon, 12 Dec 2022 20:48:42 +0000 Subject: [PATCH 46/52] day 12 pt2 --- day12/day12-pt2.js | 127 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 day12/day12-pt2.js diff --git a/day12/day12-pt2.js b/day12/day12-pt2.js new file mode 100644 index 0000000..b12939c --- /dev/null +++ b/day12/day12-pt2.js @@ -0,0 +1,127 @@ +const readFileSync = require("fs").readFileSync; +const input = readFileSync("input.txt", { encoding: "utf8", flag: "r" }); + +let grid = []; +let starts = []; +let end; + +let bestDists = []; + +for (let y in input.split("\n")) { + y = parseInt(y); + + const line = input.split("\n")[y]; + + if(!grid[y]) grid[y] = []; // init missing rows + + for (let x in line.split("")) { + x = parseInt(x); + + const letter = line.split("")[x]; + + // set to height value of the letter (1-26) + grid[y][x] = {x, y, letter, height: letter.charCodeAt(0) - 96, visited: false, dist: Infinity}; + + // if it's a starting spot, add to array + if(letter === "a") starts.push(grid[y][x]); + + // if it's the end, set to height 27 + if(letter === "E") { + grid[y][x].height = 27; + end = grid[y][x]; + } + } +} + +for(const start of starts) { + let queue = [start]; + + // loop over every element in grid and reset + for (let y in grid) { + for (let x in grid[y]) { + grid[y][x].visited = false; + grid[y][x].dist = Infinity; + } + } + + start.dist = 0; + + // while there are still points in the queue + while (queue.length > 0) { + const currentSpot = queue[0]; + const x = currentSpot.x; + const y = currentSpot.y; + + // remove the current point from the queue + queue.shift(); + + // ignore visited spots + if (currentSpot.visited) continue; + currentSpot.visited = true; + + + if (currentSpot.letter === end.letter) { + bestDists.push(currentSpot.dist); + break; + } + + // check the 4 surrounding points + // if they are not visited, and are within the height limit, add them to the queue + + // above + const spotAbove = (grid[y - 1]) ? grid[y - 1][x] : false; + if (spotAbove) { // make sure the row exists + if (spotAbove.height <= currentSpot.height + 1 && !spotAbove.visited) { + spotAbove.dist = currentSpot.dist + 1; // set its distance + queue.push(spotAbove); // add it to queue + } + } + + // below + const spotBelow = (grid[y + 1]) ? grid[y + 1][x] : false; + if (spotBelow) { // make sure the row exists + if (spotBelow.height <= currentSpot.height + 1 && !spotBelow.visited) { + spotBelow.dist = currentSpot.dist + 1; // set its distance + queue.push(spotBelow); // add it to queue + } + } + + // left + const spotLeft = (grid[y][x - 1]) ? grid[y][x - 1] : false; + if (spotLeft) { // make sure the row exists + if (spotLeft.height <= currentSpot.height + 1 && !spotLeft.visited) { + spotLeft.dist = currentSpot.dist + 1; // set its distance + queue.push(spotLeft); // add it to queue + } + } + + // right + const spotRight = (grid[y][x + 1]) ? grid[y][x + 1] : false; + if (spotRight) { // make sure the row exists + if (spotRight.height <= currentSpot.height + 1 && !spotRight.visited) { + spotRight.dist = currentSpot.dist + 1; // set its distance + queue.push(spotRight); // add it to queue + } + } + } +} + +console.log(bestDists.sort((a, b) => a - b)[0]); + +function printGrid() { + let outGrid = ""; + for (let y in grid) { + for (let x in grid[y]) { + outGrid += (grid[y][x].visited) ? "#" : grid[y][x].letter; + // outGrid += grid[y][x].letter; + // outGrid += (grid[y][x].visited === true) ? "y" : "n"; + // outGrid += (grid[y][x].dist === Infinity) ? "∞" : grid[y][x].dist; + // outGrid += " "; + } + outGrid += "\n"; + } + + console.log(outGrid); +} + + From e8a2b260be865d9221d635f6f3a2907c82e7cc37 Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Mon, 12 Dec 2022 21:08:28 +0000 Subject: [PATCH 47/52] add disclaimer to 12pt2 (tut tut george i am not that silly) --- day12/day12-pt2.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/day12/day12-pt2.js b/day12/day12-pt2.js index b12939c..07f9fd5 100644 --- a/day12/day12-pt2.js +++ b/day12/day12-pt2.js @@ -2,6 +2,8 @@ const readFileSync = require("fs").readFileSync; const input = readFileSync("input.txt", { encoding: "utf8", flag: "r" }); let grid = []; +// yes i know i can just reverse the previous solution (start at E and look for the first "a") +// but this is funnier let starts = []; let end; From e91dd9f7c5c1d45e0deba9128f6867775886766d Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Mon, 12 Dec 2022 21:54:03 +0000 Subject: [PATCH 48/52] day 10 pt2 --- day10/day10.js | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/day10/day10.js b/day10/day10.js index 21d43be..81f6dc4 100644 --- a/day10/day10.js +++ b/day10/day10.js @@ -32,16 +32,38 @@ for(const instruction of input.split("\n")) { valuesAtCycle.push(registerX); break; } - - // console.log(cycle, opcode, value, registerX); } let sum = 0; +for(const c of cyclesToCheck) sum+= (valuesAtCycle[c-2] * c); +console.log("part one:", sum); + + +// PART TWO +// this is 100% not how you are meant to do this +// but it works and I'm not going to spend any more time on it + +let out = ""; + +for(let c in valuesAtCycle) { + const beamPos = c % 40; + const spritePos = valuesAtCycle[c-1]; + + if( + beamPos == spritePos || + beamPos == spritePos - 1 || + beamPos == spritePos + 1 + ) { + out += "#"; + } else { + out += " "; + } + + // console.log(beamPos); + -for(const c of cyclesToCheck) { - console.log(c, valuesAtCycle[c-1]); - sum+= (valuesAtCycle[c-2] * c); + if(beamPos === 39) out += "\n"; } -console.log(sum); \ No newline at end of file +console.log(out); From 5dd4a217f08a03afb965bc6dfdd52179baa699e2 Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Mon, 12 Dec 2022 22:03:09 +0000 Subject: [PATCH 49/52] code qual improvements --- day10/day10.js | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/day10/day10.js b/day10/day10.js index 81f6dc4..af9b940 100644 --- a/day10/day10.js +++ b/day10/day10.js @@ -22,7 +22,8 @@ for(const instruction of input.split("\n")) { cycle++; break; case "addx": - // "addx V takes two cycles to complete. After two cycles, the X register is increased by the value V. (V can be negative.)" + // "addx V takes two cycles to complete. + // After two cycles, the X register is increased by the value V. (V can be negative.)" cycle++; valuesAtCycle.push(registerX); @@ -32,11 +33,12 @@ for(const instruction of input.split("\n")) { valuesAtCycle.push(registerX); break; } -} + console.log(cycle, "(after)", registerX, opcode, value); +} let sum = 0; -for(const c of cyclesToCheck) sum+= (valuesAtCycle[c-2] * c); +cyclesToCheck.forEach(c => sum += valuesAtCycle[c-2] * c); console.log("part one:", sum); @@ -50,18 +52,7 @@ for(let c in valuesAtCycle) { const beamPos = c % 40; const spritePos = valuesAtCycle[c-1]; - if( - beamPos == spritePos || - beamPos == spritePos - 1 || - beamPos == spritePos + 1 - ) { - out += "#"; - } else { - out += " "; - } - - // console.log(beamPos); - + out += (beamPos == spritePos || beamPos == spritePos - 1 || beamPos == spritePos + 1) ? "#" : " "; if(beamPos === 39) out += "\n"; } From 0ab2a3642026d1c7003252221825b2b2e975eeb3 Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Mon, 12 Dec 2022 22:06:01 +0000 Subject: [PATCH 50/52] remove test inputs --- .gitignore | 1 + day05/input-test.txt | 9 --- day06/input-test.txt | 1 - day07/input-test.txt | 33 -------- day08/input-test.txt | 5 -- day09/input-test-larger.txt | 8 -- day09/input-test.txt | 8 -- day10/input-test-larger.txt | 146 ------------------------------------ day10/input-test.txt | 3 - day11/input-test.txt | 27 ------- day12/input-test.txt | 5 -- 11 files changed, 1 insertion(+), 245 deletions(-) create mode 100644 .gitignore delete mode 100644 day05/input-test.txt delete mode 100644 day06/input-test.txt delete mode 100644 day07/input-test.txt delete mode 100644 day08/input-test.txt delete mode 100644 day09/input-test-larger.txt delete mode 100644 day09/input-test.txt delete mode 100644 day10/input-test-larger.txt delete mode 100644 day10/input-test.txt delete mode 100644 day11/input-test.txt delete mode 100644 day12/input-test.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f3c9c18 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +input-test* \ No newline at end of file diff --git a/day05/input-test.txt b/day05/input-test.txt deleted file mode 100644 index 84933bb..0000000 --- a/day05/input-test.txt +++ /dev/null @@ -1,9 +0,0 @@ - [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 diff --git a/day06/input-test.txt b/day06/input-test.txt deleted file mode 100644 index cca46f5..0000000 --- a/day06/input-test.txt +++ /dev/null @@ -1 +0,0 @@ -nppdvjthqldpwncqszvftbrmjlhg \ No newline at end of file diff --git a/day07/input-test.txt b/day07/input-test.txt deleted file mode 100644 index e741293..0000000 --- a/day07/input-test.txt +++ /dev/null @@ -1,33 +0,0 @@ -$ 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 - -$ my own test - -$ cd / -$ cd test-one -101 file-one -$ cd test-two -101 file-two -$ cd test-three -101 file-three \ No newline at end of file diff --git a/day08/input-test.txt b/day08/input-test.txt deleted file mode 100644 index 6557024..0000000 --- a/day08/input-test.txt +++ /dev/null @@ -1,5 +0,0 @@ -30373 -25512 -65332 -33549 -35390 \ No newline at end of file diff --git a/day09/input-test-larger.txt b/day09/input-test-larger.txt deleted file mode 100644 index 60bd43b..0000000 --- a/day09/input-test-larger.txt +++ /dev/null @@ -1,8 +0,0 @@ -R 5 -U 8 -L 8 -D 3 -R 17 -D 10 -L 25 -U 20 diff --git a/day09/input-test.txt b/day09/input-test.txt deleted file mode 100644 index cbea2b3..0000000 --- a/day09/input-test.txt +++ /dev/null @@ -1,8 +0,0 @@ -R 4 -U 4 -L 3 -D 1 -R 4 -D 1 -L 5 -R 2 \ No newline at end of file diff --git a/day10/input-test-larger.txt b/day10/input-test-larger.txt deleted file mode 100644 index 37ee8ee..0000000 --- a/day10/input-test-larger.txt +++ /dev/null @@ -1,146 +0,0 @@ -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 diff --git a/day10/input-test.txt b/day10/input-test.txt deleted file mode 100644 index fd7eba8..0000000 --- a/day10/input-test.txt +++ /dev/null @@ -1,3 +0,0 @@ -noop -addx 3 -addx -5 \ No newline at end of file diff --git a/day11/input-test.txt b/day11/input-test.txt deleted file mode 100644 index 30e09e5..0000000 --- a/day11/input-test.txt +++ /dev/null @@ -1,27 +0,0 @@ -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 diff --git a/day12/input-test.txt b/day12/input-test.txt deleted file mode 100644 index 433e0d2..0000000 --- a/day12/input-test.txt +++ /dev/null @@ -1,5 +0,0 @@ -Sabqponm -abcryxxl -accszExk -acctuvwj -abdefghi \ No newline at end of file From 5b130d40682ec6ae656f894ecda7a56c10237948 Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Fri, 1 Dec 2023 00:55:28 +0000 Subject: [PATCH 51/52] idk if it works but here's day13 code from last year --- README.md | 12 +- day13/day13.js | 56 ++++++ day13/input.txt | 449 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 512 insertions(+), 5 deletions(-) create mode 100644 day13/day13.js create mode 100644 day13/input.txt diff --git a/README.md b/README.md index 4557db0..f745119 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ -# Advent of Code Solutions (2022 Branch) - -Contains my solutions for the [Advent of Code](https://adventofcode.com/2022) challenges. - -They won't be efficient or beautiful but hopefully they will at least work :) +# Advent of Code Solutions (2022 Branch) + +Contains my solutions for the [Advent of Code](https://adventofcode.com/2022) challenges. + +They won't be efficient or beautiful but hopefully they will at least work :) + +(2023 update: I think `day13` is broken? Found these uncomitted and unstaged new files so might as well commit+push them) \ No newline at end of file diff --git a/day13/day13.js b/day13/day13.js new file mode 100644 index 0000000..3dd3fe5 --- /dev/null +++ b/day13/day13.js @@ -0,0 +1,56 @@ +const readFileSync = require("fs").readFileSync; +const input = readFileSync("input-test.txt", { encoding: "utf8", flag: "r" }); + +let group = []; +let pairIndex = 1; +let inOrderIndexes = []; + +for(const line of input.split("\n")) { + if(!line) { + group = []; + continue; + } + + group.push(line); + + if(group.length == 2) { + if (!group[0].startsWith("[") || !group[1].startsWith("[")) continue; + + const left = eval(group[0]); + const right = eval(group[1]); + + if (checkOrder(left, right)) { + inOrderIndexes.push(pairIndex); + } + + pairIndex++; + } +} + +console.log(inOrderIndexes); + +function checkOrder(left, right) { + // console.log(left, right); + + const largest = Math.max(left.length, right.length); + + for (let i = 0; i < largest; i++) { + const firstItem = left[i]; + const secondItem = right[i]; + + + if (!firstItem) return true; + if (!secondItem) return false; + + if (typeof (firstItem) === 'number' && typeof (secondItem) === 'number') { + if (firstItem > secondItem) return false; + if (secondItem < firstItem) return true; + } + + if (!Array.isArray(firstItem)) return checkOrder([firstItem], secondItem); + if (!Array.isArray(secondItem)) return checkOrder(firstItem, [secondItem]); + + const knowsOrder = checkOrder(firstItem, secondItem); + if (knowsOrder !== undefined) return knowsOrder; + } +} \ No newline at end of file diff --git a/day13/input.txt b/day13/input.txt new file mode 100644 index 0000000..61bb5bb --- /dev/null +++ b/day13/input.txt @@ -0,0 +1,449 @@ +[[9,1],[[[8],2,5],10,5],[[],[[0,10,2,10,2],[6]],5],[[10,[]],[],[[5,1,3,10],5],[[],[],[10,0]]],[[4,3],[[],[],[2,8,0,6]],4,[[8,1,7,1],1,[2,9,0],4,4]]] +[[5],[10,[[4,9,6,5,0],1,5,[],[]],[9],7,[]],[0,[[4,3,7,8],[0,1,2,5]]],[[[],[8,7,8,4,1],4,9,1],[[0,8,1],6,[0,7,1,1]],6,7,9]] + +[[1,[[],3,[2,7,7,5]],[10,[7,7,7,1]],[[9],4,4,7],[[7],1]],[],[5,10,7],[[0,[],[]]],[]] +[[2,2],[[0,[9,5,0,6],10,[],[8,1,6,6,0]],0,[[],[],[7,3,1,8,1]],10,1]] + +[[[2,7,7,[9,0,0]]],[[[1,6,0,1]],[[9,0,3,9,9],10],1,10,9],[[[3],2,[0,3,4],[],[7,4]],10,[8],9,6],[[5,2,6,4,[10,8]],[[0,5,9,10],[9,5],[10,3,4,0],0]],[]] +[[[],10,3,1,[[]]],[9,10],[],[[],3,10,5],[[[],4,3,0],[[],8,9,5,3],[],6]] + +[[[8,[],8,3,8],7,[]],[8,0],[7,3]] +[[],[[0,10],[[5],[10,2,2]]],[[6,[6,5,0,7],[],[]],10,5],[[1,[10,4,4]],5,7,5,7]] + +[9,9,7,10] +[9,9,7,10,0] + +[[0,[3,0]],[0,7,4,10]] +[[[[],[],3,[2]]],[]] + +[[],[10,1,[7,8,[10,7,0,8]],[],[0,[1,5,7,6],8,[5]]],[10]] +[[],[],[[[],9,[],9,[2]],[[10,8,1,6],[7,8],[8,2,5,6,9],[]],[],[9,6,2],[[0,4,7],[],3,8,[10,1,0,6,4]]]] + +[[6,1],[[],[3,[8,7,5,4,1]],[[9,10,6],[2,1],[4,10,5]],[[2],[8,1,4],3]],[5],[1,[1,7]]] +[[2],[[4],5,9,10],[3,7,9],[]] + +[[2,8,[4,[10],3],[],[2]],[0,[[3,0],[5,10,10]],[[10,1],[10,6,5,9,3]]],[],[],[[]]] +[[[10],[[],6,1,7]],[],[[[7],[3,10,8,7]]]] + +[[[1,[],[0]],0,[[6,1,10],[4,4,6],3,[0,5,2],5],6]] +[[],[],[[[],4,[],0,[8,7]],7,5],[[8,[],1,1]],[3,7,[],[[6,2,0],9,[0,3],10,4]]] + +[[[[9,5,5,1,2],1],9],[[[],3,4],[6,8,[4,3,3,10],[]],4],[[],1],[4]] +[[[[8,10,9,1,9],[],8],[[4,9,10],3],4],[0,9,6,[[9]]],[[[],[3],[],4],9]] + +[[7,[[9,8,7,6,10]]],[[[7],[4,9,6,1],[7,2,1],3],8],[[9,[4,4,10,3,1]],[6,0,8,2]],[[[9,7,7,9,6],10,[1,4,0,4,9],[7,3,4],[9,9,8,3]]],[10,[[2],[4,2],[3],6,3]]] +[[[[0,6,6,9],[1],[8,3,5,3,7],[1,4,2,0]],[],[[10],[1],[7,5,5,10],[5,2,8],[0]],[6],[1,5,[],[5,2,7,6]]],[[[4,7,9,9,3],[7,4,5]],3,5],[[9,4,1,[5,1]]],[[4]],[10,[]]] + +[[],[[5,[4,7,9,5]],[6,4]]] +[[[[7,1,7,3,2]],2,0,[[6,10]],[3]],[[],[8,[],[3]],[6,[],0,8,[10,5]]],[],[6,9,[[8,3,2,1],6]],[[3],[5,[]],[[0,4,7,0],0],[[1,2,7],[0,3],[10,6,0,5,5],[],4]]] + +[[[],[0,[10,1,0]],[0,[5,5,3,5,4],8,[],[2,9,10,0]],[3,4,3],[[10,3],[7,6,5,3],[2]]],[10]] +[[4,[0,6,1,[],[7,8,7,5]],[9]]] + +[[3,8,10,7],[[6,7],[[2,7,9,4,9]],0,[],4],[[],[[2],0,4]]] +[[0,[[5,6,9,8],2],2,10,[2]]] + +[[3,9,[[],[3]],[[]],5],[],[[[3,5,1]],9,3]] +[[6,1,[]],[[9,9],8,6,[6]],[[],3,4,[2]],[],[3,[],[3,[5,9,8,5,9],5,[]]]] + +[[3,[10,[8,3],8,2],[10],[5,4,[5,2,0,6,5],[],[8,10]]],[5,6,6,[]],[]] +[[],[],[[10,1,7,6,3],[[7,1,10,10],7,5,[]],[[],10,[5,2,7],6,[0,0,1]],4,9],[[[6,10,8,4],8,[3,0,5],10,3]],[]] + +[[0,[],9,[3]]] +[[],[1,[],3],[[8,5],[1,[5,2,4],[4,9,4]],7,[9,[10,7,6,4,6],6,[9,2,1,3],3],5],[[8,[1,7]],6,8,[[4,3],8]]] + +[[],[7],[6,10,[]],[],[[[1,4,7,2],6]]] +[[[],4],[[6,[4,5,4,5,8]],[[3,4],9,7],6,6],[7]] + +[[[]],[[5,[]],2,[8,6],[3,[3,0,1,9,5]],[[9,9]]],[[8,[]],[5],[1],[[],[0,1,1],9,[8,2,7,6]]],[[[],9],[4,[7,5],[7,5]]]] +[[[[8,7,4,0],5,[]],[10,10],5,9]] + +[[[[10,1,5,7,10],10,[],[1,7]],8,10],[[10,[9,6,10,9]],8,4,[[2,1,0],0],[6,7,8,[6,8],10]],[[],[[],[1,2,1],8],7,[[3,0,2,7,9],9],[5]],[5,[1,1,[]]]] +[[[[8],0,8,[]]],[[7],[[6],6,[9,0,6],[1,2,1,0],2]],[[],2,5,4,[1,[3,8],[5],7]],[[[0,1]],[5,[9,9,7,2,8],4],9],[0,3]] + +[[[[0,9],8,[]],2],[],[[[1,2,5,1,4]]],[[[1,7,5,2],4]],[[],9,3]] +[[[],8,[]],[9,8],[3,6,[]],[10,0,4,5]] + +[[],[9],[4],[[1,7,2]]] +[[2,1],[[]]] + +[[],[],[[8,5,[1,7,2,5],[1,5,9,2],[2,6]],0,[],9,0],[5,[],[9,[0,2,6,0],[8,3,9,0],[2,4,7],[7,2,10]],6],[3,[[7,1,0,5,0],9,[9],[0,10,8]],[]]] +[[[0],[[4,9,5,2],[10,8],8],10,[[3,1],3,[8,10,3,2]],[4]],[]] + +[[[[],4,10,5]],[],[[[5,10],6],3,10],[7,0,8,9,[[2,9,6],9]],[10,7,[2,6,10,3]]] +[[[3,3,[2,7,0,10],[9,10,2,7,10],[5,2,7,7,0]],1,5,[[0,5,3,2,7],5,[3,3],[2],10]],[10,[[9,3,0],[1,9,7,4,3],[8,4],[]],8],[[7,8,8,[],2],10,[[0,9],9,5,[7,7,5,4]],1,6]] + +[[10,[4]]] +[[1,10],[[[5,5],[],2],2,[],1]] + +[[],[[]],[],[5],[0,[],[6,[9,10,2,8,7],[4,7,1]],7]] +[[8],[6,[[4],[7,0],0,10],5],[[[4,10,9],9]],[10,3,[[6,1,5,8,2]]],[[10,2,0],[[5,2,10,6],[],[8,9,6,6],[],[9]]]] + +[[9],[[10,[8,4,4,8,10],5],[6],[[5],8,6],4,[[0,6,4]]],[10,2,0],[[[2,5],[1,9,1,1,7],0,[3,4,0,7,7]],5,[],[],0]] +[[[[],[3,8,7,8]],10,9,3],[[],0,[[7,10,10],1,[0,2],2,[1,7,0]],[[2,0,7,4,8],10,[9,4,2,0],[]],8],[[7,[2,2,8]],[[10,4,7,3]],[[8],3,[3]]],[],[[10,[9,6],6,[8,0,10,5]],[[9,10],10]]] + +[[[[2]],6,[[2,4],[]],4],[[1,10],[[1,1,7,8],4,[1,4,4],[7,6,8,6],[9,10,7,2]],[2,6,[0,9,2]],[]],[[[1,9,9,3,5]],[],[[2,4],3],[[0,10],8,[9,6],[0,3,4]]],[[[8],[9,1,5,9],3,1,7],[2,[2,0,8],[3,4,9,5,5],[],7]]] +[[[0,[0],3,[8,8,7]],2,9,8,5],[],[[5,4],[3,[4,4,6,4,2],1],0],[[10,5,[2,9]],2]] + +[[5,1,5,8],[[5,9,4,0]]] +[[9,8,[5,2,6,[2,4,8,10,1]],10],[6],[[[7,8,2,2,9],9,7],[10,0,0,[],6],[[],3,8,[],[8]],[[3,6],4,3,[]]],[8,10,8,7],[[5],9]] + +[] +[[9,5],[5,5,[[3,7,1,6,10]]],[[2,9,[],10]],[3,[4,[3],[0,8]],2],[[1,[7,6,5]],10,[1,[8,0,2,6,7],[4,3],[9,7,10,3],7]]] + +[[[[4]]],[9,7],[]] +[[4,1,3,8,[5,[2,5,9,7,9]]],[[1,[0,7,4],[],[6,3,8,1,3]],[8,[8,3,5],9,[7,0,6,10]],7,[[8],10,[5,4,10]]]] + +[[[1,[]],9,8,0],[1,[[5,9,10]]],[[[4,6,2,2],[],2],10,4,[6,[],10]]] +[[[5,[9,4,3,0,3]],6],[[3,10,10,[0,5,6,6,9],7],[4,[],10,[1,9,6,7],[9,6,4,2,0]],[3],10,9],[[],[2,[6,7,8,5]]]] + +[[[],[[7,4,2],[10],[2,10,6],5],9],[],[[[1,10,2,9]],[],8,[[6,0,8],[10,0,2,9],0,9]],[[6,0,1,[0],8],[1,[10,3],[2,3,5,10],[5,4,4,6,8],[]],[[9,1,10,10],10,[8,3,9],2,5]],[]] +[[8,9,7,[[10,3,2],[8,0,7],9,3],5]] + +[[],[],[1,9,0,9,8]] +[[10]] + +[[[7,[9,9],8,10],[[],[9,9,7,8]]],[[4,[5,10,4,7]]],[]] +[[],[[3,4,[3,7,5],2,[0,8,5,8]],[6,[6,6]],[3,2,[],[1,7]]]] + +[[5,2],[2],[[[7,8],[],[3,5,8],[10]],5],[8,[9,9,3],7,3,[4]],[[],[5,[9],[5,10,10,4],[4,6,3],8],[[9,9,10,3],4,10,[0]]]] +[[0,3,5,[[7,5,3,6,10],3,2]],[],[[10,[5,8,4],8,8,1],[9,5],2,[],[[8,9,0,7],[3,6]]],[3,2,4],[4,5,[[4,0,2],[1],[3],[6,0]]]] + +[[6,9,0,3],[],[],[4,[[0,3,8,6,9]]],[2,7,[],[[4,6,9,4],[4,10,8,7,0],[3,5],[6,10,5]],[3,1,[]]]] +[[],[],[[[7,6,8],[6,8,1],[9],[3],8]]] + +[[8,[1,4,[5,1,4,8],3,6],[10,[8,2,5,1],10],[0,6,[9,10,6,3,4],[8,6]],7],[1],[]] +[[6,6],[0],[],[1,3,[[7,9],1,6],10,[[8,3,5],[10,7,5,8,10],[10],10,[]]],[5,[[]],6,0]] + +[[[10,8],[[2,9,4]]],[[4,2,[7,4,6,7,7],[0,6,7,7],10]],[[2,[7,9],[2,2,0]]]] +[[1]] + +[[[7,2],8,[[2],4,5,[0],8]],[]] +[[3,6],[[[2],[6,10,1,5,3],[3,3],9],1,9,0,5],[[8,[4,8,6,9],[9,7],[7,8],[3,7]],10,6],[],[[[5,0],[7,1],[5,4]],5,6,6,[5,3,[2],[10,8,5]]]] + +[[[[8,2,4,4]],[],[[8,10,9,3],6,8,[3,9,4,5]],[[],8],[7,[]]],[9,8]] +[[[],[[9,0]],6],[9,[[0,5],8,[6,7,3,6]],[],[[9,4,5,8,10],10,4,[10],5],8]] + +[[],[[[],4,[3,9,8],[4,10,7,1]],[],7,3,[2,[8,3],8,7,[6,4,0,6,2]]],[[9,[0,10,0,5,0]],[],[2]]] +[[10,[10,10,0,[0,8,7]],5,5,[[7,4,1,5],[4,2,8,1]]]] + +[[],[[[2,2,5],9,1],[2,[4,4],[],5],5,10,[]],[0],[[6,[5],[3],3]],[7,5,5,3]] +[[[9,[0,9,3],[7,1,9,8],7],[6,0,[1]],10],[3,1],[],[[],[],[],3,[[6,6,9,3,7],[6,4]]]] + +[[[[6,2],10,8]],[[[0,7,8,4],[],7,4],0,3,3,[2,1]],[[6,[5,2],[8,1,7,3]],2,[[9,4,8],[7,0],[],10],8]] +[[],[1,[],[[4,8],1,7,[0,1,3,4,8],4]]] + +[[[[5,7,9],0,[9,7,5]],6,7,[4,9],5],[[0,[7,7,4,0,0],1,5,9]]] +[[4,[7,[10,6],7,10,[]]],[],[[[8],7,[0],7],9,[[1,1,4],[2,10,7]]],[[[9,10,7,2],1,4,6,9],[8]]] + +[[3,5]] +[[],[[7],4,9],[[7,[2,10,9],6,8],3,9,[]]] + +[[[8,5],[[3,7,7,0],10]],[[],[[],[2,9,0,4]],[[8,3,10,7,1],[]],3]] +[[],[10,6,0,[],6],[[],[5,6,[1,2]],[9],10,[[9,7,6,4],6,6]],[]] + +[[10,[9,10,[],[3,5,4,9,5]],7,9,[4,[0,10]]],[[0,[6,2,4,4,2],9,[7,9,4]],[10,[],[8],8]]] +[[4,0,6,6],[1,6,[[2,5,7]],[]],[]] + +[[[[0,5,0,9,4]],6,[0],5,4],[[10,[3,10,4,8]],[0,7,1,10,[3,10,8,5]],7,10,4]] +[[9,[9],4,[5]],[],[9,[0],9,[[1,3,0,7,10],[3,0,6,2]]]] + +[[[2,[7,6,7,6,0]],[1,[7,2,1,4,9],[7,2],3,[5,6,2]]]] +[[],[[6,[0,8,1,6,0],[4]],0,2,[[0,1],10,[1],2]]] + +[[[[2,5,4]],[],4,0],[6,[9,[8,4,9,3],9,4,[2]],[4,[10]],[[5,2,2,1],9,7],[5,[8],[10,8,6,2]]],[8,4,[],[10,0,2],0],[10,5]] +[[],[3],[],[8,4,[[1,10],2,2,[7,4,9]],7]] + +[[[],10,10,5,[[7],6]],[[3,[4,6,9,3,2],[10]]],[9,7,[5,10,[2,3,7,3,0],[]],9,[2,2,[6,9,7,0]]],[[0],5,3,[[8,3,10,1]],[[9],[8,10,8,1,6],[9,5,1,10,2]]]] +[[9,[],9]] + +[[3],[[[0]]],[],[]] +[[],[],[3,[]],[[2],[8,[6,5],10],[[0,5,4],1],5]] + +[[[5,1,8],1,0],[[]],[[8,[2,5,9,3,5],[8,9,5,9,9]],8,[[4,6,5,9]],0]] +[[8,[5,6]],[5,10,1,[10,3,8,10,[0,2]],[1,0]]] + +[[[3,1,7,[3,2,2,9,1],4],0,3,[[],[],10,[],9]],[[[6,5,3,6,8],1],[[]],3],[6,4],[[9,7,[6,3],6],9],[[[4,2,2],8,[8,1,7],[6,6]],[10],[[4,10,9,10,1],0,[],[9]],4]] +[[4,7,6],[[[9,9,5],[2,4],10,2],[6,[0,9,0]],8,4,2]] + +[[[7],[[9,5],0,1],7],[[3,3,4,[],[3,2,10]]],[],[4,6,4,[],[[4,6,1],[4,7],[0,9,10,10],8,0]],[[],3,1,3,[6,[3],0,[5,1,5,3,0],5]]] +[[1,[[],[9,4,6,1]],[[],[10]]],[8,[1],[[7],6,[9,10,6,0,5],[1]],3]] + +[[0,[],10,[],[]],[[[4,4,1,8]],7,8],[5]] +[[1,[]]] + +[[[[10,8,8],9,8],[0,6],9,[[4,6,1,7],[4,3],[10],4],3]] +[[[2,[10,7,10,10,8]],5,3],[9,4],[[[2,1],2],[3,0,[7],0,[5]]]] + +[[[],[6,[]],[[4,2],[0,4]],5],[]] +[[[7,[0,2,0],6,5,[]],[[10],0,[5,4]],[9,5,[9,2,4],3]]] + +[[[8],7,4,2],[],[10],[4,[[6,7,4],2,3,[6,1,0]],4,[1]]] +[[[[7,4,5,5,1],[9,1],[0]],[6,[8,2,3,0]],[2]],[7,[5],[8],[]],[9,[6,[8,4,2,2],1],4],[8,[[],[0]]],[[],3,8,9]] + +[[8,0,[[0,7,9]],0,[7]]] +[[[[]],[]]] + +[[4]] +[[6,[1,0,10],1,[[10,3,1,2],[4,6,5,7],5],[1,1,[3,1,8],6]],[2,1],[5,10,[1,[3,0,8],6]],[[0,9,[9]],4,[[]],7,[1,[7,4]]],[]] + +[[[[8,6],[6,2],[8],1]],[10,10,[[2,5],6,[4],[1,7,2,9],10],1,7],[],[[[10,7,5],5],[2,8,9],[[1,4,9]]],[[[9,10,6,2,4],1,8,[9,7,2,0],[]],10,5,5]] +[[]] + +[[1,[[1],[],[8]],[[6,1,6,7,5],1,4],10],[[7],[],3,[10,7],0]] +[[[]],[[[9]],[0],10,6],[[7]]] + +[[1,[[1,6,10,1,4],3,2,[8,7,9],[6,5,0,4]],[[],2,[10,1]],[[],[9,2,7],[],0,5]],[[6,[9],[],6,[9,10,2]]],[4,3,[[2,1,3,7],4,3,[3],4],9,[3,9,[2,8],1]]] +[[0,[[6,2]],[2,2],[[]]],[],[],[[[3,4],5,7,10]],[5,3]] + +[[[[8,2,0,1],[10],6],2,7,10],[[[]],10,1],[8,7,1,0],[[[2,9,2,8],[3,3,0,6],[2,0,2],[],0],1,[9,[4],5,[1,6,1]]],[[7],[[8],[7,4],[2],4],3,[[10,6,5,3],9]]] +[[9,8,[[],[9,0]],1],[9,8,8,10,7],[10,[8,0,[10,6,3],[6,3,0,4,8]],10,0]] + +[[[],1,[],[[9,9],0,[0,2]],4],[5,0],[4,[],7,7,0],[],[[4]]] +[[[[]],4,8,6,8],[9,[[10]],[[2,8,6],[9,0,2,8,4]],10,[1,[3,10,8]]],[[[]]]] + +[[5,6,5,4,6]] +[[[9,8,5,3,7],2,[[0,4],[10,2,5,10,1]],0],[[]],[6,[7,[1,5,10],[3],[6,1],[3,10]]]] + +[[[[3,3]],[],[6,5,[0]],[[8,7,9],[2],[1,5,2,5],[6,7,4,4],9],[9,[5,7,4,7,1],7,[10],4]]] +[[[7,[5]],6,[[7,9]]],[[[8,2],[1,7,4,2],[8,8,8],[1,9,3,5,8]],7,3,9,[2,2,6]]] + +[[],[[],2,[[1],[3,9,0],2,8],[[8,9],[1,2,3,1],[]]],[[9,[],[],[9],[5,1,3,6]],3,[1,[],[],[4,7,9,10],[10,5,5,8]],[0,[]]],[[0,5,4,7,[10,4,10,6,4]],[[4,8],0,7,10]]] +[[[[],7,[],8],2,7],[10,2,[[10,8,0,7,3],8],0],[8,8],[8]] + +[[5,10]] +[[10,[[9,1,1],0],[[3,1],1],[2,4,[4,0]],4],[9,[[0],4,3],10],[[[6,3,7],4,[],9]],[6,[[]],[]]] + +[[[[10,9,7,10,4],6,0],5,[[5,3,5,1,9],0,[3,7,10,7,5]]],[],[],[1,10],[]] +[[[[7,8],5,[8]],[[0,0],[9,7,6,6],[6,9],2],0],[7,[4,9,[0,2,2],[10]],[],9,10],[[],[[]],[2,8,6,8,1],[4,9,[0],10,7],[4]]] + +[[[[]],[[0,0,2,5]],[],5],[],[10]] +[[[[7,7,6,6,3],3,4,6,[3,8,10]],4,[[9,1,9,4],9,[2,6,4,1,0],9,1]]] + +[[[],[8,6,8]],[9,[9,[4,8,3,4,7],9,10,10],[[3,10,5],[10,1]],[]],[],[[1,[1,3,0,6,10],[2,0,10,4,3]]]] +[[10,[3],10,[[2,3,6,7,6],2,4],5],[6,[]]] + +[[[]]] +[[9],[1,[[6,9,7,6,5],[6],[2,3,3,3],10]]] + +[[[2,2],2],[4],[9,1,4,[[3,9],10],0]] +[[],[[4]],[[5,[7,3,2],0,[5,5,1,8,1]],3],[4,[3,[6,3],[],[9,0],[0,4,2,10,6]]],[[9,0,[3,3,9,6]],[[2,3,3,1],[10],5,4],[2,[],1,5,3]]] + +[[[[7,1,3],[0],3,[5,6,6,8],6],4,2,7,[[],[3,3,4],[9,2],[7]]],[],[7,9,[9,[6,8,7]],[[7,2],[1],8,6,[7,9]]],[],[[1],7,4]] +[[],[[9,3,8],4,0,10],[[[3,3,5],[5,3,3,6],[5,3,7]],9,8,[9,4,[],2,[0,3,8,0]],[[6,9],[1,8],4,[2,3,9,2]]],[],[[10,[7,6,6,1],[],6],[1],[10,[4,8,3,1,2]],[[7,9],8],0]] + +[[9,[[2,10]],[[4,8],[],4,8,[0]]],[],[[[1,3,9],[7],[9,4,9]],7,5,8],[[[1,2,3],7],5]] +[[1],[[],[[8,8]]],[2,3,10,[[1,3,5,8],[0,5,5,7],4],4],[2,5,6]] + +[[3,0],[10,8,[10],[[4,7,3,2],[2]],7],[[[8],3],3],[2,[7,[10],6],[],8,[2]],[[8,8,6,9,[8,2]],3,[[6,2,7,4,1],[1,7],[4,0,1],[5,4]],6]] +[[5,3],[[],2,[2,[5,9],[3,4,5,0,10],[0,2,6,0,5],[5,1,5]],5]] + +[[3,1,[7,8,[7,3],6],[],[[10,0,6],3,[6,0,8,4,5]]],[],[[[],6,[6,5,4,8,2],[]],[],[6,[3],9,2]],[0,10,7,[[],5,[10,2,0,7,2],[]]],[4,[1,8,[2],[1]],8,1]] +[[],[[],[[3,7]],6,[[9,10]]],[[6,[0,2,9],8,[7,7,2,4],[]],10,6,0,[1,[],3,6,[6,1,2]]],[[[],[10,8,6,2,6]],[4,[],[5,5,5,9],7]]] + +[[[],6],[[[3,4,5,8],[9,3,3],8,[],[8,5,10,0]]],[[4,9,[7,2,0]],[1,[9]],[]]] +[[7,[[3,0,0,1],8,9,7,[3,9,8,5,1]]],[[[4],4,4,7,7],0]] + +[[8,[]],[4,[[1,5,6,10,10]]]] +[[2,4,[[],9],[[9],8,[9]],[6,[6,2,9,10,6],4,3]]] + +[[9,0,8],[[5,9],6,[[2,2,4,4],1,[0,3,1,10,5],[4,8,7,0,6],5],[],9],[5,[10],0,4],[[],1,8,9,[[],[0,8,2],[0,10,7],0,[4,3]]]] +[[8,[3,1],[],[[2],[10],8,8,[8,3,1,8,5]],[10,[3,3,6]]],[],[[8,[6],[3,3],4],9],[4,2,8,4],[[5,[9,4],[6,7,6,7,4]],0,[0,[],[9],10,[5,4,10,9]],[[],9,5]]] + +[[[[4,8],10,[8],[2,1]],[[8,3,0,6],[5,6,6,0],6,[1,1,2,6],[0]],10,8,6],[5,[7,[],[4,1]],4,[4]],[9,[3,[5,4,1],[0,1,9,10]],2,[[2,0,2],[]]]] +[[],[10,[10,[10,7,8,2,1],7,[9,6],6],8],[[6,0,1],[8,[0,4,0],[],[2],[9,9]]],[],[3]] + +[[],[[[]],8,7,[[10,3,2],2]],[1,[0,6,[1,4,1,4]],5,[6,[8,0],[4,4,2,5,5]],1],[2,[[8,7],3],0,3,[6,[],[]]],[6,[3,2,0,10,[7,1,8,3,10]],[],9,[4,9,[5,3],5]]] +[[2,5,9],[],[]] + +[[],[6]] +[[],[[4,8]],[1,6],[10,1,[[3,10,0]]],[]] + +[[5,3,[5],[9,[8,7,2]],[[10],[9,3,0,4,6]]],[[],9,9,9],[[[],8,1],7,[[],[1,7,1,3],10,8,[9,5,9,5,0]],3,4],[2],[[[6,4,10],4,7],4,9,[[3,9,1,1],[],[8,3,9],[3,9,1,10],[8,0,6,4]]]] +[[[[7,7,9,6],2,4]],[[[4,10,2,8],10,9,3],0],[1,[],3]] + +[[],[],[],[[[5,5],[],[]],[[9,6,10,4],7]]] +[[0,4,8,7,[5,[4,3,7],[7,1,9,5],10]],[],[[9]],[[1,[7],[10,1],[2,10,5,3],[6,6,7,8,3]],[7],[8,0,8,3],6],[2,[[7,6,4,10,2],[2],5],[9,[1,2,3,5],4,[]]]] + +[[],[[3],[6,6,[6,2,3,5],4],[6,0],1]] +[[[1],0],[],[[],[10,0],5],[2,3],[[6],4]] + +[[6,2,[9,4,1,[0,4,2]]],[8],[[6]],[6,[[2,3,7,0],[10],[]],[2,7],1,8]] +[[],[6,[[5,8,4,0,3],1,[9,1,4,3],0,[3,5,9,8]],[[],5,[10,0,4,7],[3,10,2,6],[7,4]],9,[]],[[[1]],10,[[4],[5,2,3,5]],[10,9]]] + +[[9,6,[]],[5,[[5,4],[10,2,2,6,10]],[10,[7,10,8,2],[2,6,0,2],7,[9,1,7]],[[5,9],7,[0,4,2,2],0]],[[0,[10,5,4,5,6],[6],[9]],[[5,1,8,8],[9,2,5,4,0],[]]],[[],[[8,8,8,9],7,[3,6,8,3,1],[8],7]]] +[[[[3,7],[9],7],6],[[6,[6],[9,1,0,3],[8,5,3,6],4],[8,0,7,2]],[[4,[]],7],[],[9,6]] + +[[[[7],[],4,[1,0,3,9]],[[1,9,3,8,5],[1,4,6],0]],[[],0],[[6,[10,1,4,10],3,0,0],10]] +[[1,3,9,[10,[10,10,1,3,7]],6],[[[7,4],8,8]],[[8,[10],[7,0,0,9],[0,3],3],[0,5,[2],1],[[3,8,1],10]],[[[3,1,2],6,5,[0,9,7,1,7],10],[[6,6,8,2,2],[10]],[],9,3]] + +[[4,4]] +[[9,[0,8]],[[0,[],0],[0,7],10],[]] + +[[2,[3,[9,8,10,7,3],6,[],[4,0,5]],0,5,9],[],[0,2],[[[10,5,7,7,10]],3],[4]] +[[5,4,9,1],[[[8,0,2,8,0],10,4,8,[3,6]],[],[[4,0,6]]],[1,[0,[6],[5,2,2,2,8],4,2]],[[6,[2,8,10,0],7,9,10],[[5,0],[]]]] + +[[],[],[6,4,[[6],7,[6],[9,1]],[[3,6,7,1],4,[],[8],8]],[[[5,8,6,7,9],10,[7,10,10]],3]] +[[],[10,3,[2,[8,0,7],3,[6,3,2,6,7],9]],[1,[[1,10],[],[],6]],[],[[8,[6],9,[]],[[3,10,4,2,4],3,[4,4,4,10,10],4,[]],[4,4,[0,10,6,3],1],9,[6]]] + +[[[],8],[[5,10,[10,1,9],9]]] +[[9,[[0,8,2]],[9,9,2,[],[8,3,5,9]]]] + +[[[1,[8]]]] +[[],[4]] + +[[8,5,6,[3],3],[8,0,[]],[[[2,9,4,3]],[[10,2,3,9,0],[3,2,1],4],10],[[10,[5,5,1],[3],0],0,[3,8]],[[3,6]]] +[[2,[[6,3,7,10,7],[4]],[[6,0],[5],3],8],[6,7,[[4,0,7],5,[10,2,8,8],[10,6,9,8]],[3,[5,7,9,1]],6],[3,[[4,6,10],1,[]],[10,[3,10,6,9,6]],[8,10,9],[4,[5,10,9]]],[[7]]] + +[3,2,1,2,7] +[3,2,1,2] + +[[[3,[],[],3],5,1,6]] +[[[0,4,0,[7,8,0],10],[[2],8],[[9],2,1]],[[[],[1,3,5,10],5,[6]],[1],[9,10],[[4,3,8],[0,4,5,8],[4],7],4],[7,[[5,2],[1,4,8]],5,[2]],[[[10,7,8],[],[]],0,4,[2,[1,5,10],9,[4,1],7]]] + +[[[10,[],9],[[]],[0,7,5,0,[]],3,1]] +[[[[9,7,3,7,8]],6,3,[]],[[[],6,[8,9,6,0,7],[],[2,4]],2,[5,3,[2],[8,9,8],5],4],[],[]] + +[[5,[]],[[[9]],5,4],[8,6,[5,[0],6,7]],[[[8,3,5],[3],9],0,[4,[3,7]],9],[[7,0],[[9,7,8],[2,8,6],2,[],[9,3,1]]]] +[[1,3,[3,4,[1,7,3,6],5],[8]],[[9,0],[]],[4,4,[3,[2,2,5],[5]],[10],[[3]]],[],[[[],[5],2,6,7],[[2,2],[8,4]],8,8]] + +[[],[2],[[[0,6,4,1],0],7],[5,[[2,8]]]] +[[5,3,[]],[6,9,[5],1,0],[0,0],[2],[9,0,[],0,3]] + +[[],[],[[[4,4,2,3,1],[7,1],[5,2,2,4,0]],5,[3],10],[[10,[9,6,5,2,7],10,[],[1,8,1]],8],[[[9,2,10],[4,5,7,8,10],[5,9,4,4],[3,2,8,4,7]],1,6,9,[[0,4,9,10],[9,3,3,8,10],10,[],5]]] +[[[[7],[6],4,5],[4],[[9,1,2],5,10,[9,9]],[1,9]]] + +[[[2,[],[],[9,3]],[3,3,0,0],[[2,10,2,4,1],[9,4,2,7,9]]],[[[7],10],[9,5],6,5],[[4],4],[],[4]] +[[9,[9],4,9,[2]],[[[3,5,8,5],[],[6,3,1,9]]],[[],7,[],7]] + +[[[7],7],[],[4,[[],5,4,3,9],6,[[5,0,8],1],[3,[4,6,0,1,10],7]],[]] +[[[7]]] + +[[[],7,[[8,9],5,[6,1,7,7,4],0,2]],[[3,8],[[5,9,2,0],[6,0,8,8,4],9],10,6,[[5,10]]]] +[[[],[],2,5,[]],[0,[[8]],[4,3,10,[6,0]],[],10],[[1,1,9,3,[7,6,4,2,8]]],[10,[[8,2]],[],3,[9,[]]]] + +[[],[],[[[10,7],6,[5,3,6,5]],4,[6,9,10],5]] +[[[[9,4,7],2,7,3]],[[[4,6,10,6,5]],0],[5],[6,[],0,1],[4]] + +[[9,6],[[[9,6,6,2],6],5,4,7],[2,[],[]],[[],7,7,[[3],[0,3,8]],0],[[[0,0,9],5],[6,[2,1],[],7,9],[[6,4,4,4],5,9],0]] +[[[10],5,7,1],[7],[7,7,9,4]] + +[[7,1,[8,2,[4],[]]],[[[10,3,8,4,2],0,[6,10,0,3],[9,8],[4,4,6,3]],[[],5,3,2]],[[[5,5]],2],[]] +[[[[8,2,1,6,5],7,6,0,2],[7],[[3,3,6,3,3],[7,10,5],5,[3,0,2,8],2],[[],1,9,[7,3],[2,1]]],[],[[5],[10,5,0,[]],[5,[6],[],1]],[]] + +[[[[4,1,1]],[0,1,4],5,[[3,1,10],[7,4,8,8],[]]],[],[]] +[[[[6,4,1,5,1],[2],3,7],5],[[6,3,2],[]]] + +[[7,2],[],[9,[[0,0],2,7],[3]],[3,[[8],9,4],[10,[],[9,3,8]],[]],[[]]] +[[[]],[0],[]] + +[[[]],[3],[],[[[7,5,3,0],[7,1,8],0,[3]],[10,[6,7],[5,9,8,1,1],6],[2,0,[10,7,10]]]] +[[10,8,[4,[3,1,9,9],1,[1]]]] + +[[[[]],7,3,[]]] +[[5,[6,1,0,0],[[1,4]],3,[[5],0]],[1],[[[7,10,1,10,1],1,10],4,3,5],[[[1],8,[5,1,9,0,4]],[[],[9],[0,1,2],[8,5,8,0,1]]]] + +[[[[5],[],[0,3,8,10]],[3],[],[[8,3,1],7,0],[]],[[3,2,6],[],8,[[3,4,4,5],[],[7],[],8]],[[1,5,[1]],7]] +[[1,[[0,7,4,7,5]],[],2,4],[[9,0,[0,9,6,6,10],[0,7,7]],5]] + +[[[7,10,1,2],[3,[5,1,8,10],[0],0]],[5,[0,6],[[2,5,5,1,1],[5,1,5,5,2],8],[4,[]],[[4,4,8,6,6],[8,9,0],[2]]],[3,[9,[10],[4,2],[10,1,2,6]]],[[7,[5,3],[10],2],[[5,9,10],[8,2],0,[7]],5,6,2]] +[[7,[7,2,1,[6,5],[10,0,3]],[[3,10,0,3]],0,[9]],[[]],[],[2,[[3,5,6,0]],0,3,[9,[9,0,5,1],[1,3,5,5],6,[5,9,1,6,1]]],[8,[[2,2],[2,4,8,0],[2],3],[7,2,2],[2,1,10,[3,0,9,8,3],2]]] + +[[3,1],[5,7,[4,[],8,9]]] +[[[[],4,5,3,[5,5,0,7,4]],[[5],1,[],1]],[2,2]] + +[[10,[[4,2,7,9],1,[0,4,9,7]],3,[[8,5]],2]] +[[1,0]] + +[[[[7]],7,6,6,9]] +[[[1,0,[8,5,6],9],4,10,8,[4,9]],[9,[[7,1,6,1,6],9,[9,2],[],10]],[[[9],0],7,4,[[4,1,3],[8],2,[6,0,5,8,0],[2,4]],[2,3,[]]]] + +[[[[3],[10,10,9,6,2]]],[[5,[5,4,8,8],[8,9],[4,3,6]],[],4,9,[[],[7,10],[6,9,1,4,9],[],[5,2,2]]],[5,[],[2,9,3,[9],10],7,[5,[2,2,1,8]]],[7,9,2],[[3,8,[],[9,0,1,7],7],[7],[],5]] +[[[],[],0,[[],3,[],4],[8,[6,10,7],1,5]],[[[8],10],5,[10]],[]] + +[[1,7,[4,[6,3,0,3],[3],[]]],[[[8,7,6,7,0],[2],0,[7,7,6,3,0]]],[10],[4,7,[10,[6,9]],2,3]] +[[[8,4,[0,4,1,9],7,8]],[],[[]]] + +[[[[9,8,3,0],4,9],1,[5,6],2],[8,[5]],[[[8,8,4,10],[0,8,3,4,5],[10],7,2],1],[9,[3,[2,8]],[[],[1,8,6,6,0],10,[8,10,3],8],1]] +[[[]],[[[6,1,0],9,[3]],0,0],[9,3,1,[2],[1,[0,3]]],[1,[[3,2,5,2]],5,[[],10,[6,6,7],0,[]]]] + +[[1,10,4],[5,4,8],[[[5,7,1,2,4],4,[8,4,10,2,10],[0,7,4,9,6]],[[3,5,4,0],[2,5],10,[4,8,9,9,1]],[2,[3]]]] +[[1,[[3,1,3],6,[2,8,10,8,2]],[6,[1,5,2,1,3],[],[0,4],4],[[0,7,4],[2,1,5,5,4]]]] + +[[[3,4],3,0,1],[2,[[4,1,5],2,[1,2,4],5,9],9,5,[[],3,[3,9,10],[],[5]]],[[8,[1,4,1,10,10],4,[1,9,1]],7,9],[8,1,8,[4,6],[[6,10,7,1,5],[8,9,4,5],[],[]]],[8,10,1]] +[[8,6,[2,[10,2,7,1,0]],[6,[7]],9]] + +[[3,[[8,7,2,5,6],1,7,4,[0,4,10]],[8],[[2,7,5,5,1],[6],0,8,8]],[[[],[1,0,3,10],7,[0,2,8,8,0],4],[1],5,[[7],[3,6,5]]]] +[[[6,[10,9,3,4],[6,10],9]],[[[6,6,2,2,3],7,4,7,[]],7,3],[[6],0],[[6,0],[[10,1,0],5,7,[5,8,2,1],4],[],[7]]] + +[[],[[10,10,6,6,10]],[9,[[5,2,9,2],2,8,[]],1,[10,0,10,4],[[3],2,4]],[[1,[3,10,8,4,7],[1,7,2,2,4],[2,4,6,5,5]],1,[[2,8,1,8,4]],[2,[10,3,7],[0,1,0],[6,10,2,10],0],[[],[4,10,0,10],2]],[]] +[[[[1,0],10,[],[1,2,10],[8,2,4,1]],8,2,[5,3,[10,0],[9,7,7,10],[]]],[0,10],[[6,9],[[5,8],0,[5,3,8],0],1]] + +[[9,[4,8,4,7],8,9,7],[[],1,9],[2,9],[],[[9]]] +[[[[10,7,5,0,2],8,[8,2],10],10,[6,0,[],8]],[]] + +[[[],0,3,8,[0,[7,2,6,7,8],2]],[2,2,5,[7,5],[]]] +[[[0,3]],[7],[4],[6,1,[9,[8,5,7,1]]],[[],[[1,8,3,0],[10,10,5,3],3,[3,7],[10,4,3]],8,[6]]] + +[[[3,5,[0,2],10],1,[[],6,[0,7],8],[10]],[[7,8,[6,6,6]],[0,[8,1],[],9],4],[[[7,9]],1,6,3],[[8,5,[10]],0,[[0],7,[6]],7]] +[[1,[[9,3,3]]]] + +[[],[],[[[7]],8,1,4],[[[6,0],4],1,2,[6],[[9,4,6,10,10],8,6,[6,4,4,3],4]]] +[[],[],[[[],[10,1,7],8,[]],4],[8,[[0,6],[]],1,[[0,10]]],[4,3,[],6]] + +[[[[5,0,7,8],[8,5,7],[1],5,[1,6,9,0,2]],10,3,1],[[],[5],5,5],[[],5,[[],3,[10,9],4],[[10]],[]]] +[[[[2,2,0,10,10],2,5,10,0],[],[[4,5,1,10],1,8,7,[1,6,10,8]]]] + +[[[7,[6,0,6],2],4,[[1,10,3],[3,5],[2,8,5,4,3],5,3],[],0],[2,3,6,4],[4,8,9,[0,8,[0,9,0,1]],[7]],[7,6,[8,[],3],[[5,6,0,6],[],[6,10,2,1]]],[8,5,10,7,8]] +[[2,[[9],[3],[10,5],8],9,3,[9,[7,6,7],[0,10,7]]],[[[3,0,9,0],[0,8],9,10],4,[[],8,[5,9,1,10,3],9,[8,5]]]] + +[[0],[[]],[[7,2,6],[[],[0,7,8,2,1]],[9,9],[[6,1,4,8],10,6],10],[8,2,[],4],[]] +[[[[1,10,10,8],[9,1],[]],[2,[7,10,2],[0,8,9,8,6],[],3],[[]]],[[],[1,0,[],[2,7,7,6,8]],[[0,0,4],[0,2],4]],[[[4],[1,9,6,9,3],1],[[5],2,5],1],[6],[[[],0],10,7]] + +[[[],[4,[],1],9,8],[[[10,3]]],[0],[7,[5,[4,10,1,5],4,[0]]]] +[[9,[],8,[]],[8,[],[4,2,[6],[],1],[6,[5,10]],0],[8,10,[[4,2],[10,7,9,3],6,[10,7,3,10,3]],[6,7,[6,3,2,6],[4,3,8,0,7],7]],[[],0,[7,[4,8,1,6],10,4],2,[10]]] + +[[],[[[0,2,6,5,9],4,[6,2]],[5,5,[4,6]],9],[3],[10,[[],[10,7,7,10],[5,0],4,[3,3,2]],0,9]] +[[[6,[],10,[4,4,1]],0,7,[4,[6,2,4],[8,8]],1],[[5,[],1],[[1,6,5],[7,5,6,2,3],5],7]] + +[[[9,[8,1,8,7,9]],9,3]] +[[],[[4,[9,10,2]],[4],10]] + +[[[],10,[]],[6,9],[7,2]] +[[],[[[5,5,1],7,10,8,2]],[],[1,[7,1,10,2,7],[[8,3,2,6,2],5],[[]],[5,0,7]],[[],[7,1,4,7],3,9]] + +[[[],0,7,[9,5,[9,9,5,10],5,4]],[[],[[9,4,3,2],8,6,[8],0]],[9]] +[[1,10,[],6,5],[8,2,0,3],[],[4,[2,6,[],[0,5]],[0],9]] + +[[],[[[5],[],[6,1],[4],[8,7]],[[6,2,7,1,8]]],[10,[0,[7,5,3,4],[],5,[6,3]]],[]] +[[1,4,[[6,4,0,1,9]],[1,[],6,[2,5,6,10],[0]]],[[],3,[],[],[[8,10,5],10]],[[1]]] + +[[6,[4,6],8,[9],[2,8,2,[5,6,10,8]]],[2,6,5,[8,10]],[]] +[[],[1,[],2,0],[7,9,[[0],[10,9],[3],0],4,[[3,7,2,8],[],[6,5,10],[2,3,4,4],7]],[4,2,[[2,6,10,7],8,6,9,3],1]] + +[[[7],9,[[2,1,9,10],4]],[],[[]],[[10,[2,2,8,5],0],[[4,10,2,10,7],0,[0,0,7],[3,3],[9,1]]],[1,[4,[8,4],[]]]] +[[1,[],10,2,0]] + +[[[4,10,[8,1],10],[[],[10,8],[6,7,2],6,3],3,[[],7,5]],[[[5,6],0,6,9,5],[[9,6,9],4,[8,2],0,7]]] +[[],[6,7],[8,[10,[0,6,4,0,9],[],[]],6,[[2,1,2,6],[10,10,7,3,4],6,[],[8]]]] + +[[[[5,3,7,3],7,[3],4,[5]],10,9,[1,2,6]],[9],[[2,10,[9,2],[10,1,7]],[9,0,[4,3,6,0,4],2,[4,4,9]]]] +[[[[],[3,4]],[]]] + +[[[[6,1,9],6,3],0,10,9,5],[]] +[[[[0,7,6,5],8,[],[2,6,6,1,10],[10,9]],5,5,4],[4,[[8],[7]],8,10],[]] + +[[1,3,2],[]] +[[[[10,3],9,[10,1]],[4,4,[0,1,6,1,4]]]] + +[[[],[3],[[7],5,7],[[4,2],6,[]]],[[[1,3,3,6],[1]]],[1,0,6,[[10,5,0,7]]],[]] +[[8,0],[3,3,[[9,10,6],[0,2,8],5],[4,9,[],1],[10,[8],8]],[4,5]] + +[[3,[[9,5,7,7],1,10,5],[[8,10,2,5,5],5,[2,7,6],[8,2,3,10]],[[],[10],2]],[8,1]] +[[[[9,5,8],[7]]],[7,[10,6,[1,9,3]],[[0,8,7,1],7,[0,6,8,1,8]],4],[[2,7],[[8,7,10]]]] + +[[[],[],[[4]],[[9,9,0,8]],4],[[[8,0,10,10,9],2,5],[[8,3,4,1,3],[9,7],2,3],[[7,4,1],[7,5,9]]],[],[10,6],[]] +[[2],[[8],[]],[]] + +[[2,[2,4]],[]] +[[[8,[1,0]],2,7],[3,[7,[6,8,10,8],3,[3,7,6,4],[5,4,6]],[5]],[1,[]],[],[[0,[1,3,6,8,8]],2,[[5,2,2,0],[9,5],0],[],[4]]] From 338b1e62b2e17cefa85c53462034db8ea2889983 Mon Sep 17 00:00:00 2001 From: Thomas Robinson Date: Mon, 4 Dec 2023 20:44:34 +0000 Subject: [PATCH 52/52] stop tracking inputs as-per dev's wishes --- .gitignore | 3 +- day01/input.txt | 2243 ------------------------------------------ day02/input.txt | 2500 ----------------------------------------------- day03/input.txt | 300 ------ day04/input.txt | 1000 ------------------- day05/input.txt | 513 ---------- day06/input.txt | 1 - day07/input.txt | 899 ----------------- day08/input.txt | 99 -- day09/input.txt | 2000 ------------------------------------- day10/input.txt | 137 --- day11/input.txt | 55 -- day12/input.txt | 41 - day13/input.txt | 449 --------- 14 files changed, 2 insertions(+), 10238 deletions(-) delete mode 100644 day01/input.txt delete mode 100644 day02/input.txt delete mode 100644 day03/input.txt delete mode 100644 day04/input.txt delete mode 100644 day05/input.txt delete mode 100644 day06/input.txt delete mode 100644 day07/input.txt delete mode 100644 day08/input.txt delete mode 100644 day09/input.txt delete mode 100644 day10/input.txt delete mode 100644 day11/input.txt delete mode 100644 day12/input.txt delete mode 100644 day13/input.txt diff --git a/.gitignore b/.gitignore index f3c9c18..696fc57 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -input-test* \ No newline at end of file +input-test* +*.txt \ No newline at end of file diff --git a/day01/input.txt b/day01/input.txt deleted file mode 100644 index d08757d..0000000 --- a/day01/input.txt +++ /dev/null @@ -1,2243 +0,0 @@ -3427 -3273 -5615 -5943 -3125 -4245 -4194 -3243 -4283 -1790 -5355 -4239 -5541 - -3850 -5294 -5393 -2490 -3231 -2743 -2016 -2418 -2304 -5673 -3035 -5292 -2112 -2630 -2305 - -2325 -2002 -3402 -4756 -1662 -1133 -5273 -6397 -2977 -4011 -3594 -4441 -3907 -1503 - -7598 -6971 -6979 -3873 -1394 -8399 -1321 -2304 -2570 -6679 - -15324 -3365 -23808 - -5489 -3526 -3125 -8371 -1928 -8191 -7267 -10728 - -5243 -2203 -7331 -8049 -4951 -3743 -2255 -4112 -3077 -2441 -4678 - -12353 -2251 -12157 -13656 -10655 -7525 - -3383 -4183 -3293 -5473 -4898 -1441 -3786 -4002 -2179 -2439 -5530 -3966 -6273 -3150 - -3320 -2694 -2229 -1394 -4568 -3160 -4986 -2487 -3412 -1030 -3717 -1460 -1140 -1314 -5816 - -15303 -36095 - -14345 -5208 -2253 -19532 - -5082 -6544 -3563 -6050 -3750 -1155 -2090 -3661 -3600 -5528 -6506 -1795 -4901 - -1156 -1867 -2025 -5434 -1546 -6052 -4412 -7203 -4622 -7098 -4727 - -4423 -1829 -4761 -4779 -3234 -4869 -3567 -6928 -4181 -5390 -5938 - -3100 -6087 -9235 -10228 -2082 -5472 -11382 - -8389 -15131 -12057 -5034 -9419 - -2192 -1695 -3233 -2245 -4328 -6275 -1811 -4345 -2760 -3205 -1138 -2795 -3876 -1041 - -1302 -3509 -6074 -1793 -5808 -5364 -3802 -2048 -6042 -4913 -5983 -1189 -3134 -3763 -2573 - -1003 -8411 -2571 -2555 -7555 -8096 -1441 -5600 -5104 -6311 - -5345 -3329 -5616 -3250 -4321 -2068 -1978 -3719 -4512 -5099 -4694 -1566 -2621 -1613 - -11021 -6101 -9858 -3142 -9907 -1578 -8582 - -3182 -7695 -4419 -4036 -5846 -3899 -6104 -4495 -7382 -3471 - -6844 -3290 -10505 -7855 -1494 -5963 - -3609 -4755 -4063 -1480 -3201 -4576 -1627 -1255 -3699 -3929 -5533 -4807 -5890 -2270 - -3789 -7045 -8784 -8006 -4583 -7726 -3993 -1472 -1578 -2046 - -2474 -5953 -2050 -4758 -5265 -5075 -4338 -1340 -1301 -5996 -1225 -1794 -4778 -1354 -3819 - -9619 -10877 -8094 -8845 -11275 - -1986 -2142 -7561 -5350 -7605 -6766 -4713 -1016 -5697 -3179 -1696 - -3428 -5575 -5301 -4356 -5065 -2010 -1382 -3466 -3233 -1188 -1999 -3228 -6153 -4496 - -1354 -5681 -11066 -1211 -8399 -12040 -11181 - -3408 -1237 -2163 -5645 -4712 -1349 -4124 -2357 -5443 -4887 -5582 -3037 -3764 -3472 -5861 - -16746 -19715 - -18742 -18810 -6457 -8003 - -3720 -2473 -3156 -3758 -2095 -1872 -1767 -3754 -5011 -3188 -2691 -3555 -4826 -2148 -2012 - -8200 -5372 -6960 -5423 -2383 -2252 -6375 -3558 -1643 - -4653 -3017 -1840 -4479 -6043 -4533 -5374 -5708 -5026 -2557 -2984 -2175 -3797 -1367 -2809 - -1439 -2943 -2091 -6539 -5602 -8757 -2165 -2013 -8140 -4465 - -1216 -3681 -6650 -3628 -5812 -1127 -3023 -4629 -6060 -3294 -4414 -6013 -3311 - -5454 -10288 -4812 -7823 -10332 -2413 -1891 - -46279 - -9578 -8113 -19699 -10360 - -1604 -6410 -6017 -7080 -6023 -3892 -5152 -5250 -2799 -3333 -3451 -3430 - -9888 -6658 -4837 -9174 -9517 -1927 -4135 -4802 - -10514 -1492 -1142 -10574 -7578 -6753 -4250 -7526 - -4997 -6345 -5735 -2312 -5652 -6281 -1808 -5840 -6222 -4264 -6164 -3923 -2953 -4549 - -1751 -7956 -7499 -4659 -3770 -3266 -3921 -2854 - -1750 -6872 -3010 -7148 -1621 -3709 -3454 -5347 -7743 -1274 - -4212 -7252 -9341 -1973 -11385 -5895 -2077 - -6658 -1338 -4893 -2578 -9604 -2595 -3414 -1080 -6270 - -24007 -4451 - -12972 -11908 -9381 -1048 -7389 -8138 - -2266 -2599 -4165 -4784 -4626 -4361 -3710 -2182 -3845 -4487 -2023 -2986 -1893 -5845 -5497 - -6805 -5697 -1281 -6524 -2711 -2519 -2117 -4087 -5690 -4330 -1135 -4761 - -5844 -3385 -1138 -1569 -1517 -1556 -9548 -5483 -3219 - -4644 -2601 -5562 -3819 -1254 -5815 -5846 -5382 -3150 -4171 -5534 -6094 -4472 -2061 -4076 - -2878 -1410 -9640 -5071 -3324 -8293 -9940 -3408 - -17130 -10210 -10359 -4906 - -2544 -5660 -6090 -3828 -7403 -2801 -8923 -5277 -8099 - -3795 -1966 -4800 -3767 -4208 -3259 -8457 -4220 -8519 - -1605 -10471 - -5185 -4592 -4389 -3287 -2304 -1856 -4737 -2879 -6366 -6552 -3801 -4487 -3732 - -6012 -5767 -6959 -8554 -8079 -8259 -4657 -5856 - -14046 -3590 -12095 - -2973 -3878 -3645 -4276 -2320 -2886 -5517 -6727 -5742 -1098 -3216 -2442 -3818 - -1273 -4150 -3080 -3346 -2788 -1989 -3112 -4219 -3596 -3513 -4205 -6202 -4782 -2784 - -5051 -2764 -3741 -6410 -1016 -7444 -2184 -3062 -5225 -1274 -6015 -1728 - -2377 -8151 -5516 -5535 -4053 -5950 -10235 - -7837 -2220 -5837 -12251 -16188 - -4297 -16215 - -1978 -1710 -1777 -4212 -6858 -3883 -6775 -2192 -1175 -5995 -1271 -2740 -2628 - -4320 -4494 -5177 -1999 -5490 -1489 -4324 -5227 -1450 -5883 -2319 -4774 -4458 -2351 - -3448 -6913 -8451 -6462 -5866 -11217 -2186 - -4201 -4589 -7100 -4364 -7012 -2153 -7302 -5890 -1686 -6211 -3490 - -15256 -11330 -2576 -16295 -12696 - -3284 -8133 -4210 -9105 -7168 -6026 - -11776 -6637 - -4573 -6043 -1000 -6736 -4118 -5208 -2927 -7477 -5529 -4854 -3522 - -5080 -8530 -6703 -6196 -9315 -5603 -7705 -4264 -4226 - -2260 -9738 -5010 -1686 -1937 -8207 - -25668 -27349 - -2869 -4713 -4882 -2679 -7961 -3163 -5782 -6503 -4208 -2063 - -6247 -4463 -2240 -7150 -2727 -7441 -3721 -7962 -2128 -4317 -1091 - -4963 -1111 -5113 -3820 -3030 -2167 -2925 -1805 -1441 -6450 -1386 -2862 -1594 - -7176 -12022 -1849 -4085 -4515 -10053 -11249 - -18317 -1781 -18494 - -4370 -19502 -2229 -19624 - -3242 -16141 -5070 -19552 - -4082 -7003 -9394 -4500 -9162 -1991 -3555 -4769 - -3386 -5867 -8192 -6543 -1930 -10974 -1136 - -1004 -7929 -9658 -7020 -7231 -9331 -1749 -2973 -6859 - -6997 -1865 -4744 -5725 -8391 -8664 -1142 - -19299 -3449 -16386 -13658 - -1825 -1988 -5454 -6369 -7466 -4535 -5033 -2624 -4671 -1715 -1130 -2785 - -6349 -3298 -15373 -3765 -8607 - -1467 -1151 -5692 -5349 -5878 -2378 -1060 -3500 -3794 -5979 -2498 -5792 -1346 -3951 -3002 - -6298 -7169 -2292 -5334 -3964 -1367 -4002 -5096 -2232 -2396 -2399 -3622 - -4478 -13270 -6750 -14796 -2444 - -28084 -22563 - -10371 -10158 -8358 -8893 -2048 -10170 -1975 -5860 - -2826 -5313 -6768 -5757 -5251 -7693 -2295 -3278 -4889 -6677 -2869 - -4648 -4125 -5271 -2075 -5706 -6365 -2815 -6123 -3621 -2536 -5841 -2819 -3421 - -19400 -15923 -4719 -19889 - -15442 -24965 -20121 - -12765 -6225 -9594 -3324 -10745 - -9550 - -3573 -6393 -7665 -8995 -4214 -7717 -1278 - -8653 -5104 -3346 -4537 -1870 -8001 -2938 -4618 -6738 -2912 - -3315 -1537 -10677 -9986 -6898 -9306 -7037 -1489 - -6055 -5329 -1855 -2859 -6953 -2772 -5646 -4659 -1638 -4294 -2050 -5063 - -66765 - -3712 -3030 -8171 -2898 -8367 -10670 -4897 - -5012 -5099 -4827 -3947 -6708 -1704 -3714 -2225 -4425 -2528 -2396 -1261 - -5626 -2971 -12919 -16816 - -4547 -12905 -11292 -18931 - -3530 -9875 -4672 -3897 -8547 -3293 -4835 - -43142 - -24258 -9997 -21496 - -1208 -5598 -1340 -3351 -3856 -4368 -2935 -5296 -3972 -3060 -2599 -1795 -5210 -5403 -3473 - -4457 -3498 -3815 -1380 -2356 -3167 -5418 -5314 -1344 -1837 -4187 -2184 -5629 -4746 -1087 - -21757 -8610 -4689 - -11777 -5837 - -12118 -5293 -13465 -8537 -7762 -3782 - -6183 -15013 -7399 -14944 -6213 - -43907 - -8307 -5251 -3694 -4573 -2578 -3687 -3885 -1965 -6973 -6266 - -27104 - -1946 -3232 -2101 -9268 -9634 -4100 -1878 -9129 -4192 - -9175 -11691 -4274 -8684 -8889 -4557 -7587 - -4279 -8296 -4685 -2930 -8289 -6175 -4472 -2901 -2936 -7176 - -11323 -9385 -11725 -9793 -8426 -6393 -6004 - -3672 -4161 -3337 -1929 -3171 -2371 -3786 -7876 -4149 -4925 -4705 - -28965 -32051 - -2398 -1799 -5037 -4165 -2010 -1355 -1575 -5139 -6084 -4016 -5215 -6103 -3298 -4534 -4615 - -6660 -7961 -8168 -3330 -6912 -6116 -7870 -9037 -1571 - -6421 -3027 -5685 -3979 -2831 -5353 -2478 -1044 -6811 -7667 -2964 - -3919 -10974 -2860 -4617 -10693 - -5548 -5360 -1319 -5437 -1422 -3565 -4957 -4813 -1684 -3627 -3082 -3486 -6118 -1841 -4263 - -1874 -4344 -6124 -11147 - -6594 -6216 -7338 -3533 -6738 -3045 -1244 -6486 -3200 -2511 - -1139 -21415 -25857 - -16318 -1430 -3369 -9263 -9929 - -5928 -15789 -11887 -12028 -8417 - -6149 -1642 -2773 -4464 -2136 -3018 -3822 -3430 -1317 -7242 -3908 -4536 - -1425 -5550 -4635 -2039 -1290 -2618 -3862 -2107 -4921 -2991 -2703 -1932 -2568 -2266 -5553 - -5660 -8736 -4457 -5190 -1149 -9538 -8720 -6090 -3093 - -13268 -25486 -19311 - -2275 -5258 -6428 -2407 -3893 -1339 -6016 -5075 -3342 -1951 -3939 -5464 -2310 -2111 - -9213 -4141 -13988 - -20253 -20757 -12387 - -6720 -9453 -11786 -5246 -8519 -1807 -4846 - -11442 -6565 -3556 -4281 -13793 - -11152 -7384 -3135 -7831 -9622 -2549 - -1687 -3983 -4666 -5010 -7569 -8614 -3537 -5490 -5002 -5659 - -5692 -2560 -6875 -3031 -3324 -5731 -6464 -9583 -3505 - -1814 -1393 -3673 -5469 -6392 -1052 -2787 -5115 -2666 -2590 -6565 -1842 -2506 - -5592 -3509 -5060 -4589 -2619 -3283 -4145 -1590 -6079 -1312 -5693 -5182 -5071 -5476 -2187 - -5848 -11351 -8303 -11454 -7250 -9222 -9673 - -1348 -4372 -5362 -4031 -3730 -4094 -5193 -1949 -3386 -1840 -1414 -2665 -5000 -1427 -2756 - -5415 -4977 -4836 -5095 -4250 -4958 -5446 -1788 -3187 -2285 -5023 -4540 -6505 -6193 - -9926 -5929 -10070 -9154 -15694 - -5424 -2275 -2556 -7747 -8450 -2304 -8512 -5397 -3831 - -5193 -2733 -5044 -6255 -9617 -7568 -2363 -7297 -8281 - -3912 -8171 -5412 -6963 -2854 -5319 -5093 -3672 -7422 -8003 - -1986 -3826 -3202 -3431 -1361 -1949 -2237 -6455 -7354 -2587 -6648 -5011 - -26126 -35104 - -2811 -3929 -2049 -6213 -6242 -6074 -5336 -1684 -2556 -4831 -2963 -3482 -4728 -3548 - -5652 -5134 -5168 -3953 -7858 -2654 -6512 -2084 -4173 -5224 -3278 - -3599 -5356 -1114 -4191 -4473 -5066 -5490 -3564 -5826 -1516 -4392 -5289 -1281 -4404 -2274 - -58222 - -2493 -5894 -3528 -6543 -6011 -5090 -3001 -3783 -5710 -3351 -3936 - -4894 -2255 -1579 -3849 -1090 -4218 -4196 -3818 -3701 -6652 -6393 -5254 -3891 - -1041 -6701 -8442 -4691 -1054 -9791 - -63207 - -4085 -3685 -3858 -6123 -2192 -7228 -2276 -4588 -2134 -5990 - -1857 -18111 -17100 -12276 - -2353 -5464 -5442 -5230 -4412 -3189 -5513 -5813 -2459 -4570 -3493 -1753 -2059 -5804 -2150 - -9941 -13582 -3983 -5035 -7121 -8255 - -6637 -2409 -5469 -2433 -6675 -5290 -4965 -2161 -4358 -2845 -3302 - -3888 -1312 -7084 -4568 -14787 - -16704 -17915 -12348 -10556 - -3055 -2579 -3744 -3287 -5974 -4817 -2966 -5913 -3291 -2043 -4534 -1323 -5913 -2638 -4941 - -6305 -4244 -10277 -6254 -13667 -4572 - -1538 -13957 -13223 - -5856 -1394 -1329 -1395 -5874 -1899 -1884 -6484 -2784 -4268 -1631 -1822 -2463 -3880 - -14105 -14883 -18198 - -3032 -3784 -5643 -3773 -5888 -1178 -3793 -5230 -4118 -2181 -4977 -5507 -2111 -2718 - -2275 -5842 -1675 -6194 -5207 -1151 -3795 -1214 -1684 -2885 -4067 -3938 -4495 -4713 - -8752 -7608 -9819 -10438 -8672 -9792 -3246 -10448 - -1844 -14438 -13886 -14646 -2801 - -4032 -2553 -2327 -2321 -5334 -4677 -5466 -5474 -5194 -2828 -6113 -2979 -4755 -5295 - -3164 -4556 -7645 -2198 -2053 -1154 -1976 -1231 -4290 -4049 -5697 - -3635 -1307 -2316 -5508 -6603 -5483 -6365 -4073 -1325 -4043 -1807 -1871 -2056 - -6233 -5552 -8415 -2110 -8085 -9293 -6374 -6406 -5730 - -5077 -6068 -9548 -6279 -1000 -3764 -3649 -4720 -3278 - -5222 -1356 -4185 -2401 -1947 -4042 -5903 -4500 -3817 -6871 -4859 -5715 -4061 - -15888 -8533 -18355 - -65924 - -9638 -2232 -5209 - -14127 -21496 -6679 - -4269 -5055 -5129 -3308 -6977 -5175 -8822 -2381 - -57210 - -5510 -1878 -3933 -4081 -5101 -3974 -2211 -2310 -4652 -3113 -3414 -3844 -1637 -3225 -5057 - -12780 -11976 -6407 -3161 -11266 -7404 - -5178 -3541 -3449 -2443 -3099 -5232 -5838 -1724 -5830 -1147 -2092 -5034 -1235 -2502 -5532 - -12966 -12188 -2554 -13972 - -6587 -3279 -1462 -1804 -1398 -1172 -7309 -7422 -6432 -1024 -3065 -4228 - -2694 -7331 -14584 -9982 - -7038 -6957 -4701 -7704 -2598 -5320 -5967 -6921 -1647 - -3296 -2784 -5532 -5546 -5876 -5368 -1054 -5058 -4827 -1357 -6359 -6830 - -4292 -3508 -2337 -4779 -6114 -4836 -5981 -3416 -6699 -3472 -5791 -3957 -6943 - -3478 -4225 -3052 -4254 -3454 -4037 -1586 -5076 -2839 -1992 -4261 -3288 -1343 -2341 -1551 - -17502 -4858 -18898 -5672 - -8686 -2583 -1331 -3358 -6292 -2778 -5709 -1961 -6840 -4022 - -2762 -7622 -7131 -7486 -11995 -10403 -7014 - -3729 -7653 -2913 -4205 -5248 -6521 -5522 -2238 -6185 -6906 -6982 - -13279 -15590 -6519 -5881 -10256 - -11856 -7565 -1021 -2750 -4574 - -6775 -1059 -1006 -4734 -8301 -10502 -4313 - -1474 -3139 -3822 -5821 -3711 -3319 -5126 -3229 -2014 -3850 -2412 -2025 -5909 -1183 -1785 - -2726 -6526 -6606 -6153 -7205 -1503 -5204 -6244 -5856 -3962 -2148 -4222 - -4715 -1689 -4771 -2137 -3780 -1441 -5840 -1161 -5664 -4784 -2380 -1710 -1514 -1631 -1383 - -17682 -10199 - -11639 -6724 -3935 -2520 -2078 -1975 -8774 - -2252 -1541 -5525 -3020 -5282 -4457 -5951 -6672 -7622 -4374 -6671 - -5651 -2720 -1633 -2704 -5113 -1968 -2943 -1763 -4803 -3768 -2712 -1141 -6006 -4546 -4336 - -9165 -8307 -1687 -4532 -4194 -4442 -6385 -5555 - -3820 -4280 -1133 -3789 -5471 -1788 -1694 -5654 -4802 -4218 -2428 -2933 -2219 -3567 -1743 - -2881 -4847 -1363 -5396 -1564 -5633 -4521 -3209 -2555 -5482 -2613 -4118 -5167 -3873 -2554 - -7668 -5845 -11661 -6560 -2189 -5230 -1923 - -29880 -25227 - -4503 -2215 -4600 -8892 -3104 -1325 -2103 -8983 -4061 - -4784 -9543 -16484 -18339 - -1331 -1544 -1291 -3863 -1005 -2002 -2907 -3014 -5819 -1397 -5856 -2182 -6055 -4812 -4226 - -5402 -3893 -4333 -4381 -5053 -3248 -1537 -3147 -2459 -3383 -2214 -5900 -5862 -2002 -1870 \ No newline at end of file diff --git a/day02/input.txt b/day02/input.txt deleted file mode 100644 index cc70403..0000000 --- a/day02/input.txt +++ /dev/null @@ -1,2500 +0,0 @@ -C Y -B Y -C Y -B X -B X -B X -C Y -B Z -A Z -A Z -A Z -A Y -A X -A Z -A X -A Z -C Y -A X -A Z -A Z -A Z -A Y -C Y -B Z -B Z -C Y -C Y -C Y -C Y -A X -B Z -C X -B X -A Y -C X -C Y -C Y -B X -C X -B Z -C Y -B X -C Y -B X -B X -C Y -A X -B X -B Z -B X -A Z -B Z -B X -B Y -C Y -A X -C Y -A Z -C Y -C Z -B Z -C Y -C Y -C Y -B Y -B X -B X -A X -B Z -B X -B X -B X -B X -B Y -B X -B X -B X -B X -B Z -B X -B X -B Y -B X -C Y -C Y -B Z -A Z -A X -B X -B X -A X -B X -A X -B X -A Z -B Y -A X -A Y -C Y -A X -A X -C Y -A Z -B X -B Y -C Z -C Y -B X -B X -A Z -B X -B X -C Y -A Z -A Z -B X -C X -B Z -C Y -B X -A Y -C Y -B Z -C Y -B Z -A X -C Y -C Z -B X -B X -C X -A X -B X -B Z -B Z -B Z -A Y -B Z -B X -C Y -B Z -A Z -C Y -C Y -A Z -C Y -B X -B X -C Y -B Z -B Z -C Y -A X -C Y -C Y -B X -B Y -C Y -C Y -A Z -B Z -B X -B X -C Z -C Y -A X -B Z -B Y -C Y -C Y -B X -B Z -C X -B X -C Y -B Z -A X -B X -B Z -A X -C Y -B X -B X -C Y -A X -B X -B Y -A X -A Y -C Y -C Y -B X -A Z -A X -B Y -A X -A X -C X -C Y -B Y -A Z -C X -A X -B Z -B X -B X -C Y -A X -C X -C Y -A X -C Y -B X -B X -C Y -C Y -B X -A X -B X -A X -C Y -B Y -B Z -B X -B X -C X -C Y -B Z -C Y -C Y -B X -A Z -B Z -A Z -A Z -C Y -B X -C Y -C Y -C X -B X -C X -C Z -C Y -B Z -C Z -C Y -A Z -B X -C X -B Y -B Z -C Y -B Z -B Z -B Z -A Z -C X -A Y -B Z -A Z -B Z -B Y -A Z -C Y -C Y -B X -A X -B X -C X -B Y -C Y -B Z -B X -C Y -A X -B Z -B Y -C X -C Y -B X -A Z -A Z -C Y -B Z -B Z -B X -B X -C X -B X -B X -B X -A Z -A X -C Z -B X -A Z -B X -C X -B X -C X -B Z -B X -B X -A X -B Z -B Y -A Z -A Z -C Y -C Y -A Z -A Z -B X -A X -B Z -C X -C Y -C Y -B Z -A X -B Y -B Z -A X -C Y -B Z -A X -B X -B X -C Y -C Z -A Y -A X -C Y -A Z -C X -A Z -A Z -C X -A X -A Z -B Z -A Y -A Z -C Y -B X -B X -B Z -B X -B X -B Y -B X -B X -C Y -B X -A Z -B X -C Y -A Z -B Z -C Y -C X -C Y -B X -C Y -B Y -B X -B Z -C Y -A X -A X -C X -B X -A X -C X -B Y -B Y -A Z -C Z -C Z -A X -C Y -A Y -A Z -B Z -A Z -A X -A Y -B X -B Y -C Y -A X -B Y -C X -C Y -B Z -C Y -A X -B Z -B Z -A X -C X -B X -A X -B Z -C Y -C Y -B Y -A Y -B X -B Z -B X -C Y -B X -C Y -C X -A Z -B Z -C Y -B X -B Z -B Z -B Z -C Y -C X -C X -B X -A X -C Y -C Y -B X -B Z -C Y -A X -B X -B Z -B Z -B Y -A Y -B X -B Z -B X -A X -A Z -A Z -C X -B Y -B Z -C Z -B X -C Y -B X -C Y -B Y -B Z -B Y -B X -A Z -C X -A X -A Z -C Y -B X -C Y -C Y -B X -C Z -B Z -B Z -C X -C Y -A Y -C Y -A Y -B X -B Y -A Z -B Z -B X -B X -A X -C Y -B Z -C Y -B X -A Z -B Z -C Y -B Z -A Z -C Y -B X -B X -C Y -C Y -C Y -B X -C Z -B Z -B X -C Y -C X -B X -C Y -B Y -B Z -B Z -B Y -B Z -B Y -A Z -B X -B X -A Z -C Z -A Z -B X -C Z -A X -B X -C Y -B Z -A Z -C Y -C Y -B Z -A X -C Y -A Z -B X -B Z -B Y -B X -B Z -B X -C Y -A X -B Z -C Y -B Z -B Z -C Y -B X -B X -A Y -C Y -B Z -B Z -B X -B Z -A X -A X -C Y -B X -C Y -A Z -A X -B X -C Y -B Z -A Z -B X -A X -B X -B Y -A X -C Z -A X -B Y -B X -A Y -C Y -A Z -B X -C Y -A X -B X -C Y -A Z -B Y -A Z -B Z -B X -A X -B Y -A X -A Z -B Z -B X -B Z -C Y -C Y -C Y -B X -B Y -A Z -A Z -B X -B X -B Y -A X -A Z -C Y -A Y -B Z -A X -C X -A Z -C X -C Y -C Y -B X -B X -B Z -A X -A Z -B Y -B Z -B X -B Z -B X -C Y -B X -C Y -C Y -B X -B X -C Z -C Y -A X -A Z -C Y -C Y -A X -A Z -A X -C Y -C Y -B X -A X -C Y -B X -B X -A Z -B X -A Z -A Z -C Y -C Y -B X -C Y -B X -A X -C Y -B Z -A X -C Y -B Z -A X -A Z -C Y -C Y -B X -A X -B X -B Z -A Z -C X -B Z -A X -B Z -C Y -B X -A Z -C X -B Z -A Z -A X -C Y -B X -C Y -B X -A Z -B Z -B X -C X -B Z -B Y -C Y -B Z -B Z -B Z -B Z -C Y -C Y -A Z -C Y -C Z -C Z -C Y -C Y -B Z -A Y -B X -A Y -B Z -A Z -C Z -B X -B X -C X -A Z -C Y -A Z -B X -B X -A X -B Z -B X -C X -A Z -B Y -A X -B X -A Z -A X -B Z -C Y -B X -B X -C Y -C Y -B X -A Y -C X -B X -C X -B Y -B X -C Y -C Y -B X -A Z -A Z -A Y -B Z -B Z -B Z -C Y -A X -B X -C Y -C Y -A X -C Y -A Z -B X -A X -A Y -B Z -B Y -B Y -C X -A Z -A Z -B Z -A Z -B Z -B X -A Z -B Z -B Y -B X -B X -B X -A Y -A X -B X -B X -A X -C Y -B Z -C Y -B Y -A X -B Z -A Z -C Y -A X -C Y -B X -B Z -B Z -C Y -B Z -C Y -B X -C Y -A Z -A X -B X -C Y -A X -A X -C Y -C X -C Y -A Z -B Z -A X -C X -C X -C Y -B X -C X -A X -C Y -B Y -A X -C Y -B X -A Z -C Y -C Y -A X -A X -B X -B Y -B Y -A Y -A X -C Y -A X -C X -B X -C Y -C Y -A X -A Z -B Z -B Z -C Y -B Z -B Y -A X -C X -C X -A X -C Y -B Z -A Z -B X -C Y -C Y -C X -C Y -C X -A X -C Y -B X -C X -B X -A Z -B Z -B Z -B Z -B X -B Z -B X -B Y -C Y -C X -A Y -B Z -B Y -C Y -B Z -A X -A X -A Z -C Y -A X -C X -C Y -B Y -B X -B X -A X -B Y -C Y -B X -C X -C X -A Z -A Z -C Y -B X -B Z -C Y -B Z -B Z -C Y -C X -A X -B Z -C Y -C Y -C Y -B Z -B X -C Y -B Z -A X -B X -C Y -A Z -C Y -A Z -A Z -B Z -C Y -A Z -C Y -B X -A X -A X -B Z -C Y -B Y -B X -A Z -B X -C Y -A Z -C Y -A X -A Z -B X -B X -B Y -B X -A Z -C Y -A X -C Y -C Y -C Y -C Z -C Y -A Z -A Y -B Z -C Y -B X -C Y -C Y -A Z -C Z -C Y -B X -C Y -A Z -B Z -B Y -B Z -A Z -B X -B X -C X -B X -B Z -A X -C Y -C Y -C Y -A Z -B X -B Y -A X -A Z -C Y -A Z -A Z -B X -C Y -B Z -B Z -B X -C X -A Z -C X -B Z -C Y -A Z -B X -C Y -B X -A X -C Z -C X -C Y -A Z -C Y -B X -B X -B X -B X -B X -A Y -C Y -B X -A X -A Z -A Z -A X -C Z -B Z -C Y -B X -B Z -A X -B X -B X -C Y -B X -C Y -A Z -A Z -C X -B Z -A X -C Y -B X -C Y -C Y -C Y -B X -B Y -A Z -C Y -C Y -A X -A X -C Y -B X -B Z -C Y -A X -C Z -B Z -B X -C Y -C Y -B Z -A X -A Z -B X -C Y -A Z -A X -A Y -C Y -B X -B Z -A X -B Z -B Z -C Y -C Y -C X -B Z -A X -C Y -B Y -A Z -B X -B Y -B X -C Y -A Z -B X -A Z -C Y -B X -B X -C Y -B Y -C Y -C Y -C Y -B X -A X -C Y -C Y -C Y -A Z -C Y -B X -B X -B X -B X -A X -B Y -C X -B X -C X -A X -C X -C Y -A X -A Z -C Y -B Z -B Y -A X -B Y -C Y -C Y -B X -A X -A X -C X -B Z -C Y -C Y -A Z -B Z -B Z -C X -C Y -B X -B X -B Z -A Z -C Y -C Y -A Z -A Z -B X -B X -B Y -B Z -B Z -A Y -B Z -A Z -B Z -B X -B Z -C Z -B Z -A Z -B Z -B X -B X -B X -A X -C Y -A Z -C Y -C Y -B X -A Z -C X -B Z -B Y -C Z -B X -C Y -A X -C Y -A Y -B Z -C Y -C Y -B X -B X -A Z -C X -A X -A Z -B Y -C Y -C Y -C Y -B X -C Y -C Y -A Z -B X -A Z -C X -C Y -B Z -B Z -B Z -A Z -C Y -C Z -B Z -C Y -C Y -C Y -B X -B X -C Y -C Y -B X -A X -A Z -B X -C Y -B X -A Z -C Y -C Y -B Y -A X -A X -A X -A X -B X -B Y -C Y -A Z -B Y -B Z -A X -B X -C Y -A Y -C Y -A Z -B X -B Z -B Z -A Y -B X -B X -C Y -A Z -A Z -A X -A X -B Z -C Y -B Z -C X -A Z -C Y -B Z -C Y -C Y -B Z -A Z -C Y -C X -A Z -C Y -B X -A Y -A X -B Z -A Y -A Z -B X -C X -B Z -C Y -C Y -B Y -B Z -A X -B X -A Z -C Y -C Y -A Z -A Z -B X -C Y -B Z -A X -A X -B X -B Y -C Y -B X -C X -C Y -B Z -A Z -A Y -B X -C Y -C Y -C X -A Z -C Z -B Z -B X -A Z -A X -A X -B Z -B X -A Z -B Z -C Y -A X -B Z -B Z -C Y -C Y -A X -B X -C Y -A X -B X -C Y -B X -A Z -A X -B Z -A Z -B Z -B Y -A X -B Z -A Z -A Z -A Z -A X -A X -B X -B X -A Z -B Y -A Y -C Y -B X -C Y -B Y -C Y -A Z -A Z -B X -B X -C Y -B Z -C Y -B Z -B X -B X -B X -B X -A X -B Y -B X -C X -A Z -A Z -B X -C Y -C Y -C Y -A X -C Y -C Y -C Y -A X -C Y -C X -B X -A Y -C Z -C Y -A Z -B X -A Z -A X -B X -A X -A X -C Y -A Y -A X -B X -A Z -B Z -B Y -C Z -B X -A Z -C Y -B Z -B X -C Y -C Y -C Y -B X -A X -A Z -B X -A X -C Y -B Z -A X -C Y -C Y -A X -A X -A X -A Y -C Y -C Y -C Y -C Z -C Y -A X -B X -C Y -C Y -C Y -C Y -A X -B Z -A X -B X -C Y -B Z -A Z -C Y -A Z -C Y -B X -B X -C Y -C Y -B Y -A X -C Y -C X -C Y -C X -A Z -A Z -B Y -A X -A X -B Z -A Z -A X -A Z -C Y -A X -B Z -C X -A X -A X -B X -A X -B Y -A X -B X -B X -C Y -C X -B X -B Y -C X -A Z -B Z -B X -C Y -B Y -B Z -C Y -A X -C Y -B X -B X -C Y -C Z -B X -B X -C X -B Y -B Y -B Z -C X -B X -C Y -B X -C Y -B X -A X -A Y -B X -B X -B X -B Y -C Y -B X -B X -B X -C Y -A Z -B Z -B X -A Z -B X -B Y -C X -A Z -C Y -C Y -B Z -B X -C Y -C Y -C Y -C Y -B Z -A X -C Y -C Y -A Z -B X -B Z -A Y -C Y -B X -C Z -A Z -B Y -A Y -A Z -A Z -B X -B X -C X -A Z -B Z -A X -B Z -A Z -B X -B X -C Y -B Z -C Y -A Z -B Z -B X -A Z -C Y -B X -B Y -B Z -C Y -B X -C Y -B X -A X -A X -C Y -B X -B X -A Y -A Z -A Z -B Z -A Z -C Y -C Y -A Z -A X -A Z -B X -C Y -C X -A Z -A X -B Z -B Z -A X -B X -C X -C Y -C Y -B Z -B X -C Y -C Z -B Y -C Y -A Z -B Z -B Z -B X -B X -C Y -B X -B X -C X -A X -B Z -C Y -B Y -B X -A Z -B Z -B X -A Z -B Z -B X -A Z -B X -C Y -C X -B Y -B Y -B Z -C Y -A X -B Z -B Y -C Y -A X -B Z -B Z -C X -B X -C Y -C Y -C Y -C Y -A Z -A Z -B X -B X -C Z -B X -B Z -B X -B Z -A Z -B X -C Y -B X -C Y -C Y -A X -B X -A X -C X -B X -B Y -A X -B Z -A Z -B Y -B Z -C Y -B Z -C Y -B X -B Z -B Y -B X -B X -A Z -B Z -B X -A Z -C Y -C Y -A Z -A X -C Z -A X -B Z -B Z -C Y -B X -B X -A Y -B Z -C X -C Y -C Y -C Y -A Y -A X -B X -B Z -A Z -B X -C X -C X -C Y -C Y -C Y -B X -B X -A Z -B Z -B X -A X -A Z -C Z -B Z -B Z -B X -A X -B X -C Y -B Z -A X -B Y -B Z -B Y -B X -A X -B Z -C Y -C X -C Y -A Z -B Z -B X -B Z -B X -A Y -B X -A Z -B X -C X -A X -C Y -B X -C Y -C Y -A Y -C Z -A Z -C X -B X -C Y -A Z -B X -B Z -B Z -C Y -A X -A Z -B X -B X -B Z -B X -C Y -B X -A X -A X -C Y -A Z -C Y -B Y -B Z -B Z -C Y -B Z -C Y -B X -B X -B Y -C Y -A X -A Z -A Z -A X -C Y -B X -B Y -B Y -B X -A X -A Y -B Y -B Y -C Y -A X -B Z -C Y -A Z -C Y -B Y -A X -B X -A X -B X -A Z -C Y -C Y -A X -B Y -B Y -B X -A Z -A Z -A Z -A Y -B Z -C X -B X -C Y -C Z -B Y -C Y -C X -B X -B Z -B Z -B Z -B Z -B Y -B Z -A Z -C X -B X -C Y -C Y -B Z -C Y -C Y -A X -C X -A X -B Z -C Y -B X -C Y -A X -A Z -C Z -A X -B Z -C Y -C Y -C Y -A X -C Y -C Y -B X -B X -B Y -C Y -B Z -B X -C Y -A Z -C X -A Z -C Y -A Z -A X -B Z -B X -C Z -B X -C Y -A Z -C Y -B X -B X -B X -B Z -C Y -B X -A Z -A Z -C Y -B Y -C Y -B Z -A Z -A X -B Z -B X -B X -A Y -B X -B X -C Y -B X -B X -B Z -C Y -B X -A X -A Z -A Z -C X -A X -A X -B X -B X -B Z -A X -C Y -B X -C Y -C Y -A X -B X -A X -A Z -A Z -C Y -B X -C Y -B Y -B X -B X -C X -B X -A X -C X -B Z -C Y -B Z -B X -C Y -C Y -A Z -C Y -B Z -B X -A Z -C Y -C Y -B X -B Z -A X -B X -C Y -C Y -C Y -A X -A X -A X -B Z -B Z -A X -A X -B X -B Z -C Y -C Y -B Z -A Z -C Y -C Y -A Z -B Z -C Y -B X -B X -B X -C Y -C Y -B Z -C Y -B Z -A X -A X -B X -C Y -A X -A X -C X -A Y -C X -B X -B X -B Z -B Z -B Z -B X -B Z -C Y -C Y -C X -A Z -B X -A X -B Z -B X -A Z -C Y -B X -B Y -B Z -A Z -B X -A Y -C X -B X -C Z -C Y -B Z -A X -B Z -B Z -A X -B Z -B X -C Y -B Z -C X -C Y -A Z -C Y -A Y -B Z -B X -B Y -A Z -A Y -A X -B Y -A Z -B Z -C Y -C Y -C X -C Y -C Y -B X -B Z -A Z -B Z -B Z -A Z -C Y -A Z -C X -C Y -C Y -C Y -A X -C Y -B Z -A X -C Y -C Y -C Y -B X -B Z -B Y -C Y -C Y -C Y -C Y -B Y -A Y -B Z -B X -A X -A Y -C Y -C X -B X -B Z -A Z -B Z -B X -A X -C Z -C X -B Z -C Y -A X -C X -B Z -B X -B X -A Z -B X -B Z -B Y -C Y -B X -A X -B X -B Z -A X -B Z -A Y -C Y -A X -C X -B X -B Y -B Z -B X -B X -C Y -B X -B X -C Y -B Y -B Z -B Y -B Z -C Y -A Z -C Y -A Z -B X -B X -A Z -B X -C Y -C X -C Y -B Y -C Y -C Y -C Z -C Y -A Y -C Y -B X -B Z -A Y -B Z -A Z -B Z -B Z -B X -B Y -C Y -B X -C Y -C Z -C Y -A X -B X -B X -C Z -A Z -B X -A Z -C Y -B Z -B Z -B Y -A Z -B Z -C Y -C Y -A Z -C Y -B Y -C Y -B Z -C X -B Z -B X -A Z -B Y -B Y -B Z -A Z -B Z -C X -C X -B Z -B X -C Y -B X -A X -B X -B X -B Z -C Y -A Z -A Y -B Z -C Y -A X -A X -A Y -B X -B Z -A X -B X -C X -B X -B Y -B X -A Z -C Y -A X -C Y -A X -C Y -C Y -B Y -C Y -B X -C Y -C Y -B X -B Z -A X -C Y -C X -C X -C Y -B Y -A Z -C Y -A X -A X -B X -B X -A X -B X -C X -B Z -B X -A X -A Z -B X -C Y -C Y -A X -C X -B Z -B Z -B X -C Y -C Y -A Z -C X -B Z -C Y -B Y -A Z -B Z -A Z -B X -C X -C Z -C Y -A Z -B Z -B X -C Y -C Y -C X -C Y -C Y -C Y -A X -A Z -C Y -B X -B X -B Z -A Z -C Y -B X -A Z -C Y -C Y -B Z -A X -B Z -B Z -B X -B Z -B X -B X -B Z -B Z -C Y -A X -A X -A Z -C Y -C Y -B X -B Z -C Z -B X -C Z -C Y -C X -C Y -B Y -A X -B Z -A Z -C X -B X -C X -A Z -A Y -B Z -A X -A X -A Z -A Z -B Y -B Z -C Y -B X -C Y -B Z -B X -C Y -C Y -A X -A Z -B X -C Y -B X -B X -A X -A Z -B X -B X -B Z -A X -A X -B Z -B X -B X -B X -A Z -C X -B X -B X -B X -B Z -B X -C X -C Y -A Z -C X -A Z -C Y -A X -C Y -A X -B X -A Z -B X -C Y -C Y -A Z -A Z -B Z -B Z -B X -C X -A X -B Y -B Z -C Y -B Z -A X -A X -B X -A X -A X -A X -A X -B Z -B Y -C Y -A Z -C Z -C Y -A X -B Y -C X -A Z -B X -B Z -A X -A X -C Y -B X -B X -A X -A Z -C Y -C Y -A Z -C Y -B X -B X -A Z -A Y -C Y -A Z -A X -C Y -B Z -B Z -C Y -B X -C Y -C Y -C Y -C Z -B X -C Y -C X -B Z -A Z -C Y -A Z -B Z -A Z -B X -A X -A Z -B Z -B Z -A X -B Z -A X -B X -A Z -B X -B X -A Z -C Y -B X -B Z -C Y -B Z -B Z -B X -B Z -B X -B X -C Y -B X -B Y -B X -B X -A Z -B X -C Y -B X -B X -B X -B Z -A Z -B Y -B X -B Z -C X -C Y -B X -B Y -C Y -B X -C X -B X -C X -B Z -A Y -A Z -B Z -B Z -A X -A Z -B Z -B X -A Z -B Z -C Y -C Z -C Y -A Z -C Z -A Z -C Z -C Y -A Z -A Y -C Y diff --git a/day03/input.txt b/day03/input.txt deleted file mode 100644 index d0ad78f..0000000 --- a/day03/input.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mgMz -TstvBTdgBhqTsdTcPlfCSrNMrNnrCNNSNNgp -HwLQwQDZzDjnDbmMhNSnmm -FZLVzLLQHRRzwWHjdPlJctlJtlsllhRs -fBtPsMDDswHvBmmVdBlSBRcGGnhVhg -LWJbrpFqpTLTTjqqNWlhnRGGSnhrcSdlRlsh -JWNbbpjJzTbNNNJNJMvmvfZHvzDsHDCsZw -LPGnPNLtwGhFFnJPfsqpVVszzpsP -TcWdvlrcWddggrDBDDdDMmWzRJqfVQZqmsfZsRQzZfZzQJ -TldWrMrDdlDCDdMTcwSLVCSShLNSwHjhGF -JGsWWWQsJmPwQWbBPmccbcbqFfMMpFDVCDFVFVCDqqfFwD -ZtLnlvLnNtvLndnCmfMVSmVCClfpVp -zTzZtjnZNLNmZvdtznntHHZJbBRGBRQWcJGbGsbsJRPQWT -MLmlMTPtQtMNlhbqbbqhflBB -rcrvjpSvScbRbBvbDBPG -ZZJzSHpzPrJzHFmMVMFmHCLNtV diff --git a/day04/input.txt b/day04/input.txt deleted file mode 100644 index 4aead77..0000000 --- a/day04/input.txt +++ /dev/null @@ -1,1000 +0,0 @@ -20-45,13-44 -7-8,8-28 -3-39,14-97 -35-99,35-98 -18-49,17-19 -33-34,34-46 -46-58,58-75 -4-93,25-97 -92-99,7-91 -61-62,24-61 -35-62,34-63 -85-87,3-86 -9-49,7-48 -5-87,87-95 -3-3,3-82 -13-63,25-62 -4-99,1-98 -72-80,74-77 -9-96,95-97 -50-68,51-76 -34-80,33-33 -37-98,21-37 -9-71,10-72 -40-94,39-94 -1-88,88-92 -46-47,46-51 -14-59,14-60 -69-99,22-95 -9-66,9-65 -62-69,64-69 -6-40,16-70 -58-97,9-82 -12-56,12-46 -71-85,25-70 -70-86,86-97 -47-70,46-69 -11-65,65-66 -56-58,57-85 -33-66,33-65 -67-67,10-67 -21-55,20-22 -15-72,15-71 -19-92,45-93 -38-82,38-83 -23-90,90-90 -96-98,5-97 -33-38,32-33 -42-42,26-41 -31-92,30-93 -22-58,4-47 -3-49,49-59 -29-61,11-12 -5-81,4-81 -68-91,67-92 -6-87,5-86 -73-73,59-74 -16-70,26-31 -25-58,24-67 -2-47,47-54 -5-73,4-74 -58-98,1-99 -7-94,95-97 -11-63,11-12 -25-54,53-55 -90-94,93-95 -6-61,7-62 -47-63,27-62 -30-46,47-47 -67-94,94-95 -60-95,95-96 -35-83,83-84 -20-82,19-82 -28-29,28-88 -32-45,46-66 -55-78,79-79 -21-55,20-21 -8-10,11-98 -21-71,20-20 -18-19,19-21 -23-76,24-76 -22-96,23-95 -66-97,66-98 -89-91,25-90 -21-64,21-26 -77-80,77-86 -32-89,24-88 -37-93,36-36 -33-59,60-98 -7-91,6-7 -2-86,2-56 -85-97,86-96 -80-80,42-80 -16-87,27-86 -4-94,5-93 -34-37,36-38 -6-92,3-6 -22-85,21-21 -9-9,9-92 -31-87,31-86 -58-98,97-99 -1-98,1-87 -6-66,5-67 -27-54,28-55 -6-27,12-38 -22-29,4-28 -19-19,20-88 -64-98,64-85 -6-97,6-86 -13-72,72-73 -6-12,12-75 -11-34,10-16 -18-89,7-18 -9-67,3-9 -5-6,5-46 -45-53,53-56 -48-95,14-50 -93-99,4-93 -19-35,20-35 -22-77,21-78 -13-71,12-71 -24-39,23-39 -64-78,15-65 -11-41,10-11 -49-75,3-76 -40-87,87-99 -42-44,17-43 -37-94,28-93 -56-58,53-57 -98-98,3-98 -13-72,12-73 -39-86,40-86 -18-18,19-37 -24-89,25-64 -45-71,44-71 -7-69,8-69 -6-87,1-88 -45-88,44-45 -83-96,78-95 -7-65,64-73 -11-96,8-97 -32-52,14-31 -40-94,40-93 -12-17,8-18 -27-43,28-42 -37-95,10-95 -22-93,20-23 -37-84,36-85 -3-98,98-98 -25-92,1-81 -68-73,56-74 -75-78,72-89 -31-80,80-80 -33-85,56-86 -7-98,4-99 -25-52,51-66 -80-87,1-80 -7-99,2-8 -14-56,13-13 -32-52,33-98 -33-87,33-87 -33-98,34-75 -52-53,52-75 -1-6,5-20 -65-98,82-86 -9-99,4-98 -19-60,11-12 -3-77,4-82 -18-78,18-88 -3-7,7-99 -17-89,17-90 -61-94,26-87 -51-73,51-73 -30-87,30-30 -6-67,19-66 -2-86,2-98 -20-82,19-20 -39-82,38-88 -4-95,4-98 -5-46,33-46 -4-66,1-3 -5-97,6-98 -2-91,91-91 -7-93,8-92 -26-62,25-67 -35-37,36-36 -3-98,1-3 -31-69,32-68 -2-2,4-46 -94-96,1-95 -32-46,31-45 -2-55,1-54 -31-91,32-90 -25-62,26-61 -22-30,32-94 -57-96,55-95 -1-13,3-95 -18-70,18-78 -2-2,2-98 -8-50,49-62 -37-65,7-38 -18-47,32-48 -12-55,12-86 -2-6,2-94 -1-98,98-98 -1-23,5-72 -38-52,39-54 -40-40,41-96 -88-89,16-88 -22-32,21-33 -39-84,85-87 -18-19,18-92 -21-99,6-84 -54-56,29-55 -12-23,22-91 -38-43,36-42 -8-68,31-73 -5-82,5-92 -45-66,41-66 -61-70,60-83 -58-70,13-58 -47-57,48-56 -66-91,65-74 -69-69,30-69 -10-91,11-91 -76-90,76-99 -3-79,17-78 -2-99,2-99 -98-99,52-98 -19-26,25-71 -5-93,15-94 -70-72,19-71 -56-85,55-84 -57-91,57-93 -2-2,3-95 -3-4,6-98 -2-93,1-1 -6-87,7-88 -7-96,95-98 -39-96,9-96 -5-94,4-5 -40-96,39-96 -18-92,17-89 -26-74,11-11 -89-97,55-94 -4-92,2-93 -67-97,97-98 -64-85,63-84 -2-70,14-69 -3-43,3-6 -4-70,4-4 -11-12,12-80 -20-34,35-54 -30-47,9-46 -11-95,46-94 -32-94,33-93 -97-98,96-98 -4-11,3-13 -1-1,3-53 -6-90,90-91 -34-79,8-80 -57-92,57-93 -45-45,3-45 -35-53,35-52 -6-28,5-29 -9-81,81-81 -71-72,71-92 -20-50,18-72 -17-74,1-17 -38-73,14-73 -62-85,13-71 -47-68,47-68 -27-72,26-73 -7-89,88-90 -97-99,8-97 -37-92,36-36 -39-79,40-67 -1-89,1-88 -20-71,19-19 -11-83,10-83 -37-37,8-37 -88-95,13-87 -36-59,18-58 -52-84,64-85 -12-78,11-77 -42-82,47-83 -34-95,35-95 -63-88,11-64 -62-70,58-60 -45-92,45-86 -13-99,12-98 -6-7,8-8 -7-97,97-98 -48-48,1-48 -74-80,75-79 -98-98,7-97 -69-80,69-79 -18-59,18-59 -15-73,15-74 -55-79,55-78 -59-67,58-67 -7-95,8-95 -71-77,78-78 -3-52,3-53 -15-54,8-46 -21-39,21-50 -34-61,9-34 -69-69,70-70 -3-27,1-2 -19-65,19-64 -22-99,7-98 -21-50,51-86 -4-96,14-95 -6-83,83-84 -30-30,31-76 -21-49,48-50 -4-7,9-82 -20-89,13-20 -22-40,23-39 -94-95,6-93 -2-3,3-74 -54-81,37-82 -18-91,17-91 -29-77,78-92 -16-73,73-73 -25-78,43-54 -39-39,37-58 -52-94,52-53 -18-50,8-13 -3-3,3-99 -96-99,1-96 -36-37,35-36 -3-25,7-81 -29-48,14-49 -96-98,3-97 -25-95,96-97 -14-96,1-8 -72-80,80-80 -51-88,29-50 -24-64,19-63 -28-66,29-52 -14-97,13-14 -52-53,53-98 -11-63,12-64 -30-63,22-64 -18-25,16-18 -21-54,21-88 -87-88,32-88 -19-87,17-17 -55-65,20-66 -44-45,45-87 -55-61,54-55 -26-27,26-98 -50-64,32-75 -33-95,33-33 -7-98,98-99 -19-35,18-18 -78-99,12-79 -11-13,14-99 -5-98,4-5 -52-72,51-53 -49-97,17-96 -14-95,13-94 -20-84,5-19 -90-90,66-90 -19-57,30-52 -21-89,89-91 -59-60,24-59 -66-75,17-67 -53-53,54-97 -48-89,49-88 -57-63,1-64 -2-3,2-98 -15-98,1-97 -39-46,39-81 -71-72,60-71 -53-96,53-97 -3-74,4-73 -58-93,58-93 -3-64,1-1 -47-72,42-44 -32-82,82-83 -40-41,7-40 -7-22,8-23 -96-99,39-95 -89-90,3-89 -7-95,95-98 -23-60,24-59 -5-24,24-59 -5-45,4-44 -9-9,9-94 -18-42,41-91 -51-53,61-68 -14-79,7-78 -47-93,8-47 -5-97,5-97 -10-98,9-99 -6-81,7-80 -32-37,36-60 -9-77,9-78 -18-43,17-17 -91-96,2-68 -36-92,30-91 -16-36,2-11 -6-74,62-95 -6-97,7-98 -78-79,31-78 -56-90,90-91 -9-38,2-10 -9-56,28-45 -17-77,16-76 -18-18,18-93 -8-65,8-63 -78-82,28-83 -5-80,6-53 -24-32,23-68 -7-39,8-94 -41-86,86-94 -62-64,59-64 -45-93,45-86 -83-86,30-92 -32-80,11-33 -16-97,17-97 -4-84,85-85 -3-99,3-4 -83-83,16-83 -30-75,71-76 -17-82,81-89 -43-56,28-55 -1-49,48-49 -13-53,12-53 -3-13,27-76 -32-65,32-82 -17-92,92-92 -77-81,10-79 -36-85,96-97 -1-2,1-95 -66-90,66-89 -7-37,7-50 -13-92,13-80 -32-96,31-96 -13-52,10-53 -61-83,1-60 -29-55,12-30 -78-80,4-79 -1-1,6-66 -3-8,9-83 -2-81,1-94 -27-43,27-43 -16-17,17-98 -6-9,8-43 -38-78,39-78 -20-99,13-92 -36-93,52-92 -3-10,11-74 -69-74,8-69 -27-43,28-36 -20-77,19-76 -24-86,18-85 -13-44,45-78 -6-27,7-26 -7-42,2-6 -73-75,5-74 -19-24,23-37 -23-71,36-99 -3-99,15-98 -5-98,3-3 -4-62,3-62 -2-18,1-99 -3-95,7-96 -37-63,43-68 -60-71,54-59 -28-35,34-88 -68-80,67-81 -77-89,76-88 -22-48,23-48 -95-96,66-95 -17-64,18-48 -69-88,18-74 -96-98,39-97 -8-45,45-45 -7-18,19-89 -32-42,12-41 -76-80,52-76 -45-93,46-94 -1-97,3-97 -71-82,70-83 -46-47,28-46 -10-11,12-91 -23-24,24-99 -36-65,36-65 -96-98,11-95 -47-57,47-56 -5-11,10-99 -39-56,38-55 -62-97,61-61 -19-99,99-99 -93-93,13-92 -72-74,73-78 -87-92,80-91 -95-95,18-95 -87-88,12-87 -41-86,85-91 -1-1,3-42 -20-94,20-62 -1-68,1-1 -2-97,1-98 -25-63,63-64 -1-3,3-99 -28-29,29-38 -34-87,54-88 -69-69,64-69 -24-53,37-54 -9-79,8-79 -22-69,23-68 -44-51,44-81 -9-94,5-8 -11-93,93-94 -9-17,7-16 -63-63,6-62 -45-91,13-60 -13-97,12-12 -9-33,8-8 -25-26,26-39 -25-83,25-84 -9-73,73-89 -20-76,20-84 -69-78,2-68 -5-46,4-47 -25-32,29-35 -90-94,16-90 -74-80,77-80 -46-52,52-76 -45-48,12-48 -61-62,26-61 -8-99,2-9 -4-95,4-96 -60-92,59-93 -30-51,30-31 -21-88,16-18 -11-89,12-90 -46-46,2-45 -4-99,2-36 -39-47,40-48 -42-78,54-55 -7-86,7-87 -9-99,2-98 -21-94,22-60 -11-99,11-96 -13-57,43-56 -13-48,49-79 -93-95,3-94 -31-80,30-80 -16-75,74-76 -53-56,54-60 -5-53,53-54 -53-53,52-52 -8-91,9-92 -26-65,16-65 -65-67,59-74 -52-52,26-52 -15-43,14-44 -58-58,57-70 -77-99,78-98 -90-90,76-92 -36-50,35-77 -7-36,8-35 -36-91,37-93 -3-41,2-2 -94-95,59-94 -6-86,6-86 -3-83,2-3 -49-66,65-67 -43-71,71-97 -9-10,10-75 -4-80,80-80 -32-67,8-66 -46-47,34-47 -85-94,6-96 -33-35,18-34 -6-55,5-55 -2-74,74-74 -52-94,52-53 -20-93,3-31 -90-92,90-93 -20-52,51-53 -97-98,10-97 -4-84,2-85 -22-93,93-94 -53-88,54-89 -9-30,19-37 -5-39,38-39 -50-90,13-91 -81-94,80-93 -18-86,19-29 -1-81,18-80 -85-95,23-86 -77-78,77-95 -28-87,27-27 -24-25,25-94 -4-93,2-92 -1-92,2-93 -17-35,35-49 -2-3,2-52 -46-46,37-46 -10-94,9-95 -5-57,6-57 -14-89,34-90 -13-13,14-68 -37-67,36-92 -35-92,8-34 -7-49,7-50 -33-95,9-92 -28-29,27-78 -83-84,12-83 -6-34,6-93 -9-56,9-56 -2-29,2-10 -11-11,12-88 -24-58,16-25 -95-99,28-95 -90-92,31-91 -15-35,15-36 -31-84,19-63 -3-50,64-93 -31-94,30-93 -7-89,7-8 -27-62,8-49 -20-87,21-64 -56-70,56-93 -1-37,37-37 -19-85,84-86 -18-20,19-79 -23-74,20-63 -5-93,6-92 -6-73,4-74 -86-91,85-98 -13-21,21-36 -60-94,59-59 -33-50,49-51 -25-58,18-52 -94-94,34-94 -50-55,50-50 -1-96,1-29 -19-99,20-99 -61-62,61-85 -4-18,18-18 -78-78,45-78 -47-92,46-93 -87-94,18-87 -4-5,4-95 -57-92,7-76 -35-60,1-35 -2-89,41-90 -5-6,6-37 -21-68,16-69 -49-89,44-58 -3-60,60-62 -49-99,2-49 -20-67,13-44 -16-25,25-62 -4-94,4-99 -52-85,2-29 -9-17,19-89 -6-72,7-71 -5-82,17-82 -64-75,63-75 -26-60,29-93 -10-53,54-61 -81-83,5-80 -87-98,58-97 -11-33,12-34 -67-67,67-75 -40-60,16-40 -9-64,8-63 -27-95,27-95 -18-18,19-38 -27-98,28-97 -5-14,14-62 -83-84,84-88 -11-93,11-93 -2-5,6-94 -58-68,57-67 -23-25,24-70 -12-32,31-55 -31-35,20-34 -8-49,23-50 -58-85,58-87 -4-94,1-4 -40-41,41-71 -21-94,10-21 -29-95,28-94 -19-74,18-18 -1-49,1-2 -39-46,1-45 -65-66,22-65 -28-92,92-99 -9-80,8-8 -21-93,14-22 -11-94,93-98 -26-69,60-68 -8-44,14-45 -65-67,51-66 -34-94,93-95 -11-33,33-33 -32-97,98-98 -10-97,10-11 -47-72,46-86 -10-10,10-97 -4-79,4-80 -24-95,94-99 -12-79,66-80 -56-62,50-61 -27-94,26-95 -27-70,27-27 -26-77,76-78 -85-86,41-85 -24-83,24-84 -31-73,63-71 -6-75,6-30 -3-71,71-90 -32-56,31-76 -16-73,16-16 -55-73,56-72 -32-88,32-90 -17-17,18-65 -10-94,94-94 -47-85,47-59 -12-85,11-84 -3-90,89-91 -36-51,36-55 -5-57,5-56 -1-58,40-57 -46-65,46-50 -72-83,78-94 -98-98,7-97 -30-52,30-51 -11-98,10-98 -91-99,98-99 -66-94,64-94 -65-65,27-64 -37-37,30-37 -33-76,17-34 -26-28,20-27 -9-97,8-98 -2-82,3-83 -16-88,5-64 -11-26,42-48 -90-91,8-90 -44-96,45-67 -94-94,10-93 -59-94,59-94 -18-53,18-52 -2-48,2-48 -3-3,5-92 -95-96,3-95 -10-26,25-39 -12-12,13-47 -5-5,6-17 -39-51,50-52 -2-98,3-98 -7-19,18-76 -9-9,10-55 -5-10,26-99 -26-88,26-90 -1-37,1-2 -21-71,21-70 -71-82,72-82 -81-92,53-88 -3-96,2-96 -15-72,15-71 -6-43,7-9 -17-79,17-18 -19-53,18-69 -2-2,4-91 -99-99,1-99 -25-33,26-33 -75-78,32-77 -94-95,5-94 -53-89,45-52 -8-96,4-99 -7-76,6-6 -8-30,10-48 -9-71,9-41 -22-22,22-57 -5-21,20-22 -16-99,16-94 -2-50,1-96 -25-36,24-35 -16-90,52-84 -10-32,9-33 -76-78,35-77 -2-98,3-98 -56-58,8-62 -51-68,54-58 -57-76,76-87 -15-69,15-75 -64-83,83-90 -68-74,69-69 -7-8,8-36 -23-97,22-23 -23-81,2-23 -82-86,12-86 -4-73,4-32 -39-78,38-79 -46-82,38-68 -63-84,83-97 -42-90,42-91 -2-56,2-29 -14-96,13-81 -46-53,53-54 -46-52,31-94 -37-92,38-93 -96-97,36-96 -2-58,2-2 -51-94,50-93 -24-45,26-64 -51-80,52-79 -48-56,49-58 -64-97,97-97 -8-65,15-66 -3-8,7-19 -10-63,10-63 -74-74,74-74 -27-84,16-31 -45-62,10-63 -82-84,5-83 -4-8,5-6 -60-69,59-71 -4-95,8-94 -25-93,6-26 -9-68,8-83 -6-99,6-98 -63-64,9-63 -37-88,10-56 -1-56,1-97 -11-89,6-12 -16-98,6-16 -9-52,8-53 -45-95,44-45 -12-96,11-96 -1-4,3-95 -34-39,19-38 -14-90,13-89 -58-83,58-81 -25-91,13-92 -49-79,70-80 -14-92,91-93 -26-48,17-47 -24-96,25-96 -41-66,47-52 -26-37,26-38 -2-89,3-90 -12-56,12-55 -21-49,21-49 -29-68,28-67 -95-96,76-94 -20-65,19-19 -11-70,10-11 -21-92,22-93 -15-90,11-89 -1-92,1-1 -66-91,14-90 -64-73,1-98 -39-39,39-45 -62-86,61-86 -16-89,89-90 -19-95,7-89 -67-90,50-90 -63-96,4-62 -3-74,2-74 -72-80,71-81 -56-65,56-82 -93-93,79-92 -24-87,1-23 -31-35,40-64 -4-97,3-3 -45-45,45-72 -65-66,42-65 -42-95,41-94 -3-4,3-94 -14-88,88-89 -28-83,28-89 -51-79,27-64 -14-18,14-17 -7-97,5-6 -18-34,35-35 -1-99,9-99 -33-54,43-54 -11-42,32-43 -2-30,1-29 -6-88,7-88 -45-50,37-53 -39-84,37-83 -34-51,27-73 -21-52,16-53 -2-6,4-7 -15-46,4-47 -49-50,1-50 -39-80,10-38 -23-59,24-58 -21-72,22-72 -22-73,73-74 -25-47,26-48 -4-98,5-99 -3-3,3-91 -21-98,22-99 -14-33,32-32 -14-20,13-24 -19-92,5-88 -90-98,90-99 -29-60,60-61 -3-71,10-92 -7-22,7-92 -8-37,7-7 -16-88,17-88 -29-71,30-72 -44-85,84-86 -70-72,49-71 -41-80,41-55 -32-32,33-69 -2-55,3-55 -73-73,74-95 -16-71,6-72 -41-80,40-79 -33-40,27-34 -21-96,96-98 -22-22,23-38 -30-93,31-92 -16-20,19-71 -22-99,98-99 -5-82,5-71 -33-45,32-34 -65-77,76-84 -72-76,10-73 -2-4,4-16 -24-68,23-23 -43-59,42-58 -15-59,16-59 -8-85,2-8 -84-86,5-85 -9-82,8-82 -1-6,6-86 -65-76,65-75 -3-60,4-59 -76-85,51-84 -3-65,4-16 -2-97,1-96 -2-4,6-85 -18-91,91-92 -42-43,42-91 -25-96,24-26 -7-92,92-93 -29-61,6-28 -5-5,5-70 -22-70,21-69 -25-74,73-74 -45-52,49-54 -1-85,2-85 -5-94,10-80 -37-38,37-54 -15-73,15-72 -27-62,9-26 -8-93,5-8 -25-37,36-94 -3-95,4-96 -31-87,86-88 -62-63,63-90 -22-27,21-26 -93-93,34-80 -17-91,18-92 -75-86,15-75 -4-4,4-94 -10-65,9-66 -96-96,87-96 -4-29,2-5 -5-35,6-35 -8-75,8-85 -7-82,8-67 -15-90,15-16 -6-24,23-76 -62-96,98-98 -10-98,1-2 -3-51,23-95 -66-84,11-66 -24-77,23-95 -52-91,43-46 -10-96,11-96 -45-47,46-48 -10-83,2-10 -62-62,62-99 -34-71,70-91 -38-65,39-64 -33-68,34-69 -2-96,1-97 -24-51,52-82 -88-94,89-94 -23-23,24-87 -13-31,31-84 -63-65,2-64 -42-91,42-73 diff --git a/day05/input.txt b/day05/input.txt deleted file mode 100644 index b401f42..0000000 --- a/day05/input.txt +++ /dev/null @@ -1,513 +0,0 @@ - [Q] [G] [M] - [B] [S] [V] [P] [R] - [T] [C] [F] [L] [V] [N] -[Q] [P] [H] [N] [S] [W] [C] -[F] [G] [B] [J] [B] [N] [Z] [L] -[L] [Q] [Q] [Z] [M] [Q] [F] [G] [D] -[S] [Z] [M] [G] [H] [C] [C] [H] [Z] -[R] [N] [S] [T] [P] [P] [W] [Q] [G] - 1 2 3 4 5 6 7 8 9 - -move 1 from 2 to 6 -move 3 from 7 to 9 -move 7 from 9 to 4 -move 2 from 5 to 3 -move 3 from 2 to 8 -move 14 from 4 to 5 -move 1 from 2 to 1 -move 1 from 2 to 3 -move 3 from 6 to 8 -move 3 from 6 to 9 -move 1 from 4 to 6 -move 5 from 9 to 8 -move 9 from 8 to 9 -move 3 from 3 to 8 -move 8 from 9 to 4 -move 2 from 1 to 7 -move 4 from 1 to 5 -move 2 from 7 to 1 -move 1 from 9 to 6 -move 7 from 4 to 7 -move 1 from 8 to 4 -move 1 from 9 to 8 -move 2 from 6 to 7 -move 7 from 7 to 3 -move 10 from 3 to 1 -move 1 from 3 to 2 -move 1 from 2 to 9 -move 1 from 9 to 8 -move 15 from 5 to 8 -move 1 from 6 to 9 -move 2 from 7 to 3 -move 11 from 1 to 8 -move 1 from 9 to 8 -move 1 from 1 to 5 -move 3 from 5 to 2 -move 2 from 6 to 9 -move 1 from 2 to 4 -move 2 from 4 to 5 -move 1 from 3 to 6 -move 5 from 8 to 3 -move 12 from 8 to 4 -move 2 from 2 to 5 -move 12 from 8 to 1 -move 1 from 6 to 9 -move 10 from 5 to 7 -move 3 from 3 to 9 -move 6 from 8 to 9 -move 2 from 3 to 5 -move 8 from 4 to 7 -move 1 from 3 to 2 -move 6 from 8 to 6 -move 8 from 9 to 3 -move 2 from 5 to 4 -move 1 from 2 to 3 -move 2 from 9 to 2 -move 1 from 9 to 2 -move 1 from 2 to 1 -move 2 from 2 to 4 -move 5 from 4 to 2 -move 3 from 2 to 3 -move 2 from 4 to 2 -move 18 from 7 to 3 -move 3 from 6 to 9 -move 1 from 6 to 3 -move 1 from 4 to 1 -move 1 from 6 to 3 -move 6 from 3 to 9 -move 2 from 2 to 6 -move 26 from 3 to 7 -move 2 from 2 to 3 -move 2 from 6 to 8 -move 3 from 1 to 5 -move 8 from 9 to 1 -move 1 from 8 to 5 -move 1 from 3 to 1 -move 2 from 9 to 3 -move 1 from 1 to 2 -move 12 from 1 to 7 -move 1 from 8 to 5 -move 2 from 3 to 5 -move 1 from 3 to 6 -move 2 from 6 to 2 -move 7 from 5 to 7 -move 1 from 4 to 2 -move 15 from 7 to 4 -move 1 from 4 to 9 -move 1 from 7 to 6 -move 14 from 4 to 2 -move 1 from 1 to 2 -move 5 from 1 to 5 -move 4 from 5 to 4 -move 1 from 6 to 3 -move 4 from 4 to 7 -move 1 from 9 to 2 -move 1 from 3 to 5 -move 2 from 5 to 1 -move 1 from 1 to 6 -move 2 from 1 to 5 -move 9 from 2 to 9 -move 1 from 6 to 1 -move 1 from 1 to 9 -move 1 from 5 to 4 -move 1 from 5 to 6 -move 4 from 7 to 2 -move 1 from 4 to 1 -move 18 from 7 to 1 -move 17 from 1 to 7 -move 4 from 9 to 5 -move 1 from 5 to 8 -move 1 from 1 to 4 -move 2 from 9 to 6 -move 3 from 9 to 7 -move 1 from 1 to 5 -move 1 from 7 to 5 -move 16 from 7 to 2 -move 1 from 4 to 2 -move 1 from 8 to 7 -move 1 from 9 to 8 -move 1 from 8 to 4 -move 3 from 5 to 3 -move 15 from 7 to 6 -move 7 from 6 to 4 -move 9 from 6 to 2 -move 2 from 5 to 7 -move 2 from 6 to 8 -move 4 from 4 to 7 -move 2 from 8 to 1 -move 11 from 2 to 7 -move 1 from 4 to 2 -move 2 from 3 to 6 -move 3 from 4 to 5 -move 12 from 7 to 1 -move 1 from 7 to 3 -move 31 from 2 to 4 -move 3 from 7 to 2 -move 1 from 6 to 3 -move 1 from 5 to 1 -move 1 from 5 to 2 -move 2 from 3 to 4 -move 1 from 6 to 1 -move 1 from 3 to 6 -move 1 from 5 to 6 -move 1 from 2 to 4 -move 11 from 1 to 4 -move 5 from 1 to 5 -move 1 from 7 to 3 -move 3 from 5 to 8 -move 1 from 8 to 7 -move 1 from 5 to 3 -move 2 from 8 to 5 -move 2 from 6 to 2 -move 2 from 5 to 1 -move 1 from 7 to 9 -move 1 from 3 to 9 -move 2 from 9 to 5 -move 1 from 1 to 6 -move 1 from 6 to 5 -move 1 from 3 to 5 -move 13 from 4 to 8 -move 5 from 2 to 3 -move 3 from 3 to 4 -move 1 from 8 to 6 -move 4 from 5 to 2 -move 1 from 1 to 5 -move 1 from 3 to 7 -move 2 from 5 to 4 -move 11 from 4 to 5 -move 1 from 3 to 7 -move 15 from 4 to 2 -move 1 from 6 to 4 -move 19 from 2 to 8 -move 8 from 8 to 3 -move 2 from 3 to 8 -move 7 from 5 to 4 -move 6 from 3 to 4 -move 8 from 4 to 5 -move 7 from 4 to 6 -move 2 from 7 to 5 -move 9 from 5 to 6 -move 13 from 8 to 3 -move 3 from 4 to 3 -move 6 from 3 to 4 -move 6 from 8 to 2 -move 4 from 5 to 9 -move 5 from 8 to 7 -move 4 from 6 to 2 -move 5 from 3 to 5 -move 1 from 6 to 9 -move 8 from 2 to 6 -move 1 from 8 to 7 -move 1 from 2 to 5 -move 1 from 4 to 1 -move 3 from 3 to 1 -move 1 from 7 to 3 -move 4 from 9 to 8 -move 6 from 6 to 2 -move 2 from 8 to 4 -move 1 from 7 to 6 -move 3 from 5 to 1 -move 4 from 5 to 3 -move 6 from 2 to 9 -move 4 from 7 to 4 -move 2 from 8 to 5 -move 2 from 9 to 5 -move 4 from 5 to 6 -move 1 from 2 to 5 -move 8 from 6 to 7 -move 18 from 4 to 2 -move 2 from 3 to 6 -move 6 from 1 to 8 -move 8 from 7 to 9 -move 9 from 6 to 4 -move 1 from 5 to 4 -move 5 from 8 to 4 -move 1 from 4 to 5 -move 1 from 8 to 1 -move 8 from 9 to 8 -move 3 from 3 to 9 -move 5 from 2 to 7 -move 1 from 5 to 2 -move 2 from 4 to 8 -move 11 from 2 to 8 -move 1 from 7 to 2 -move 2 from 6 to 5 -move 1 from 6 to 2 -move 4 from 2 to 3 -move 2 from 1 to 3 -move 5 from 9 to 7 -move 1 from 5 to 8 -move 6 from 7 to 8 -move 7 from 3 to 7 -move 1 from 5 to 9 -move 3 from 9 to 7 -move 1 from 4 to 1 -move 1 from 9 to 8 -move 8 from 7 to 3 -move 1 from 2 to 4 -move 1 from 1 to 7 -move 9 from 3 to 7 -move 7 from 4 to 7 -move 8 from 7 to 3 -move 1 from 7 to 9 -move 13 from 7 to 4 -move 1 from 4 to 6 -move 11 from 8 to 2 -move 5 from 3 to 7 -move 1 from 9 to 6 -move 7 from 2 to 9 -move 2 from 2 to 4 -move 4 from 9 to 2 -move 17 from 8 to 3 -move 3 from 3 to 4 -move 1 from 7 to 6 -move 5 from 2 to 3 -move 8 from 4 to 1 -move 2 from 6 to 4 -move 1 from 2 to 7 -move 1 from 1 to 4 -move 1 from 8 to 2 -move 2 from 7 to 4 -move 7 from 1 to 9 -move 16 from 4 to 2 -move 1 from 6 to 1 -move 2 from 2 to 9 -move 6 from 2 to 7 -move 1 from 1 to 6 -move 3 from 2 to 6 -move 10 from 3 to 6 -move 6 from 9 to 8 -move 3 from 4 to 3 -move 6 from 9 to 2 -move 4 from 3 to 7 -move 10 from 2 to 5 -move 2 from 2 to 6 -move 3 from 6 to 3 -move 1 from 8 to 2 -move 1 from 2 to 6 -move 5 from 6 to 1 -move 3 from 6 to 7 -move 5 from 8 to 4 -move 3 from 7 to 1 -move 2 from 6 to 1 -move 2 from 4 to 1 -move 2 from 5 to 8 -move 1 from 8 to 7 -move 1 from 8 to 9 -move 8 from 3 to 4 -move 11 from 1 to 7 -move 1 from 9 to 8 -move 1 from 8 to 3 -move 3 from 6 to 3 -move 1 from 6 to 8 -move 3 from 5 to 2 -move 1 from 8 to 6 -move 2 from 5 to 8 -move 3 from 5 to 6 -move 3 from 2 to 4 -move 2 from 8 to 4 -move 22 from 7 to 3 -move 12 from 3 to 2 -move 9 from 3 to 9 -move 1 from 1 to 2 -move 2 from 6 to 8 -move 2 from 8 to 4 -move 2 from 6 to 5 -move 11 from 3 to 1 -move 18 from 4 to 3 -move 3 from 7 to 3 -move 1 from 5 to 7 -move 3 from 2 to 4 -move 2 from 4 to 9 -move 6 from 1 to 4 -move 1 from 5 to 1 -move 10 from 9 to 3 -move 27 from 3 to 9 -move 6 from 2 to 8 -move 5 from 4 to 2 -move 3 from 3 to 8 -move 1 from 7 to 8 -move 10 from 8 to 2 -move 5 from 1 to 5 -move 1 from 3 to 5 -move 1 from 1 to 8 -move 14 from 9 to 4 -move 6 from 5 to 6 -move 11 from 9 to 4 -move 6 from 6 to 3 -move 1 from 8 to 6 -move 2 from 9 to 5 -move 1 from 2 to 5 -move 8 from 2 to 1 -move 12 from 4 to 7 -move 1 from 6 to 8 -move 14 from 4 to 1 -move 1 from 9 to 8 -move 1 from 5 to 1 -move 2 from 5 to 2 -move 11 from 1 to 6 -move 11 from 6 to 1 -move 1 from 8 to 7 -move 1 from 8 to 2 -move 12 from 1 to 7 -move 1 from 4 to 7 -move 5 from 1 to 5 -move 5 from 2 to 6 -move 1 from 5 to 6 -move 1 from 2 to 9 -move 6 from 1 to 3 -move 19 from 7 to 2 -move 1 from 9 to 6 -move 9 from 3 to 2 -move 9 from 2 to 7 -move 3 from 5 to 8 -move 1 from 5 to 1 -move 3 from 3 to 9 -move 7 from 2 to 9 -move 15 from 7 to 2 -move 10 from 9 to 4 -move 4 from 4 to 9 -move 1 from 6 to 4 -move 1 from 1 to 6 -move 26 from 2 to 5 -move 1 from 7 to 3 -move 6 from 4 to 8 -move 3 from 2 to 9 -move 6 from 8 to 3 -move 4 from 5 to 7 -move 1 from 4 to 5 -move 2 from 2 to 1 -move 6 from 9 to 1 -move 3 from 3 to 8 -move 3 from 2 to 8 -move 3 from 7 to 9 -move 6 from 1 to 7 -move 2 from 3 to 2 -move 2 from 2 to 5 -move 1 from 8 to 6 -move 4 from 7 to 3 -move 10 from 5 to 3 -move 4 from 9 to 1 -move 6 from 3 to 1 -move 1 from 7 to 4 -move 4 from 3 to 2 -move 1 from 3 to 1 -move 13 from 1 to 5 -move 1 from 3 to 7 -move 1 from 3 to 8 -move 4 from 6 to 3 -move 1 from 6 to 3 -move 7 from 8 to 2 -move 1 from 6 to 9 -move 2 from 7 to 2 -move 1 from 9 to 5 -move 2 from 8 to 6 -move 1 from 7 to 5 -move 1 from 3 to 1 -move 30 from 5 to 2 -move 1 from 3 to 4 -move 2 from 6 to 1 -move 5 from 3 to 4 -move 2 from 6 to 5 -move 5 from 4 to 3 -move 1 from 3 to 1 -move 4 from 1 to 6 -move 1 from 2 to 5 -move 2 from 4 to 9 -move 4 from 3 to 5 -move 1 from 3 to 5 -move 1 from 5 to 3 -move 6 from 5 to 1 -move 2 from 1 to 9 -move 4 from 6 to 2 -move 1 from 3 to 5 -move 1 from 5 to 2 -move 1 from 5 to 2 -move 8 from 2 to 5 -move 4 from 9 to 6 -move 3 from 1 to 4 -move 3 from 6 to 2 -move 2 from 4 to 2 -move 1 from 6 to 1 -move 1 from 4 to 6 -move 2 from 5 to 1 -move 1 from 6 to 8 -move 3 from 5 to 2 -move 2 from 5 to 6 -move 1 from 6 to 7 -move 1 from 5 to 9 -move 1 from 7 to 5 -move 3 from 1 to 9 -move 3 from 9 to 5 -move 31 from 2 to 6 -move 1 from 1 to 3 -move 1 from 8 to 9 -move 30 from 6 to 9 -move 2 from 9 to 8 -move 13 from 2 to 3 -move 4 from 5 to 2 -move 1 from 8 to 4 -move 1 from 4 to 1 -move 1 from 1 to 6 -move 5 from 2 to 8 -move 1 from 2 to 8 -move 26 from 9 to 3 -move 18 from 3 to 8 -move 1 from 2 to 1 -move 12 from 3 to 8 -move 1 from 2 to 3 -move 3 from 6 to 4 -move 1 from 1 to 9 -move 11 from 8 to 5 -move 1 from 4 to 7 -move 9 from 3 to 9 -move 1 from 7 to 8 -move 11 from 8 to 3 -move 11 from 3 to 2 -move 11 from 2 to 9 -move 19 from 9 to 8 -move 3 from 5 to 7 -move 2 from 4 to 2 -move 2 from 2 to 8 -move 29 from 8 to 2 -move 5 from 5 to 4 -move 1 from 9 to 6 -move 2 from 5 to 9 -move 1 from 6 to 9 -move 7 from 8 to 7 -move 1 from 9 to 7 -move 6 from 9 to 1 -move 1 from 9 to 4 -move 1 from 5 to 4 -move 15 from 2 to 5 -move 3 from 1 to 7 -move 5 from 5 to 2 -move 1 from 8 to 3 -move 1 from 5 to 8 -move 2 from 3 to 6 -move 1 from 3 to 8 -move 9 from 2 to 1 -move 1 from 8 to 7 -move 1 from 8 to 3 -move 10 from 7 to 8 -move 4 from 7 to 3 -move 1 from 7 to 2 -move 1 from 8 to 6 -move 3 from 6 to 5 -move 6 from 5 to 8 -move 3 from 1 to 3 -move 8 from 3 to 7 -move 3 from 1 to 3 -move 4 from 8 to 3 -move 1 from 4 to 5 -move 4 from 1 to 4 -move 1 from 4 to 5 -move 1 from 7 to 4 -move 4 from 4 to 1 -move 2 from 8 to 7 -move 6 from 5 to 2 -move 2 from 8 to 1 -move 6 from 4 to 7 -move 1 from 5 to 4 -move 5 from 8 to 6 -move 1 from 6 to 9 diff --git a/day06/input.txt b/day06/input.txt deleted file mode 100644 index 13a015a..0000000 --- a/day06/input.txt +++ /dev/null @@ -1 +0,0 @@ -stftmtvvtvqqczqqnjnwwlqqdzdnnsvnsswbbwsstvvssfjsjbjfjmjpjzpplpppjzjqqdzzhqqqqtcccbzzzwzrrrdqdldpdsppmqmmnwwjddnqqscclncllvhllqpllchhbccfcbcgbcgcfcncsnstsddldzldlmljjfbjbzbccmrmrppqmqsswbwqwdwwcnwwhrhppfsfvsvrrfllhglhlggjpggzjgzggnvvqfvvhffpwpmwpmmwvmvrmrbmbzmzbbvgbbcfbcfbfppnzpzrrszzqgzgjgddmdwmwrmwmzznqzqhqhvvsslppsrrljjfpfcpfpbbrjjwjmjpmpfmfzfvzfftptzzbmzmddpvdddqmmzjzbbhmmwqmmmbgmmttrhrqrvqvzvdvzdvvmsvmmqlmmtddvlvttrtvtvcttvssnwwbccqmmgbbqrqlqjllmslsmslltrtffzfpfzpffvwvffsllgvgtgwtwnttfzznzqzztfzfvzznnwzzcvcqvvdwwsnsvnnthhnphpssmjmfmhfmhmgmllmsmrsrrmmhsswjwqqdbbghhpsptsswvsvfvcffqcchlhfhvhjhdjhddvjjpmmsrsqrrngrrmvmsvsllrmlrlprpggqzqmmvlvvwrwnrwwzztrzrbrdbrdbbhlhchjchhtthpthphplhhlphpjjsddtppvbpbbmnmgnmmqbbrhhfrfpfjpjgjljcctwtmwtwvvvmsvmmnjmnjmnmqmvvggtzzctzttszsvvjwjqjmjbjvbbshbhghlghhpvpnvvqmmgjmmggqvqtvqtvqtvvmlljbbhdhshnnwqwbbrnnwswmwfmfttjztjzjsjzjdjbdjjzfzdzgzhghgpgqqdzdhhnwnjnnhrnrqqjsqsllbzzzcnzzmjmvmrvrgrfgrrqmrmpmpzmzqqfwqfwfjjhphgpptzzwmmfjjvbjvbbqsbsbcbppjzpjjzpjpvjjzdjjgcgppvrvjrjpjspjppntpnnjlnlrnrdndjnnsbnnppvspprbrddjrdrmrfmmtmtbtntftjjsscvcbvvcnccnbnrbbmlmddhpdptddmrmmjddnjjtztctqqhhttqctqtbbnfnwnmndnzzljlgltgltljtjllwjjbrjbrbpbgppmzpmpggdnnmznnhhmfhhssgtgvvlsljltlppdqqbtbvbsvsswbsbhsbsmmwswbbbbhvbvcbvvsvcsvvmfmlmgmjgmmbqbrbsrrgrsggldlmlttpbpmmtptctqcqvccnhnmnssmvsmmddlclpccfwfdfqfvqfvfqqwmmwrmmbzznpnllfttgcttnbtnnsswttfppnddpdpsphhpttnrtrlrsrmrnmmzhmhnmnwwddmhdhqqhbqqdcclnlfnnzfnzzqfqddczcqcrrjsrrswslltfltffjhhqqfcchqcqpplbltbblbcbncnpccdffcwwqzwqqlwwtjjpbbjvvljvjgvvrsszfsfcssqsvvwsvvdfvdfdpffztzrtzthzhhmwmzwzssjlsldsldsldlvvjdvvnbvnvmvmccvfcvcfcbchhzqqhgqqcbbhdbdpddwcdwwzszsfszzgbgdgzgvgsgnssfqsqjssrppsgppmmpzmppglgqlqqpzpqqfzzzrnzrnrqqzzfwzzffjfzzmnznpznpprhhvcvvvfddcrdrsscnnsznzszbznntwntnrnbnzzrnnlwlggnzzwppmbmrrncnlclzltlblhhlvhvphhsdhsdsqddgzgvvshvvzzbvbrrlplqpptplljcljlvjlvlqvvndnsdddmvddzhzjjgpjpddppzllwtwfwgfgpffmhhzllsttmqqhjhhpvpgpfjsgscnwjmwmtmptwlpfjljwgpgntrlpjfgbjqmcpzgfhrwmznqnsbpptbdrzmdtvvtdqjgrjzlphndhmlchvddglqnqsjqrfqslprsvlqjwqnsmsznptsstpvdntpttslpmqqbsdlqwpjqnzmpblgqmjrvqwsncnzdszgfsghddlnwhwzpgtddgstttvrjfjwwfrgsdjjngljqlqcrzlgsmwngbzvmjwtnqdqcgwmfhsztgrtvvfzbtstmdbqpntdpsszjthqvpbdwswfzvmrcpbgbgdmldfhvdpfsmdzfhwsrpcglsztdwqgbqszcqtqjhgntzvttldqsffftzmllptzhmhpmfsgcchfrnrchnsgcfjbgrqmvrmmhnmlnwtgwhznqfgwnlrqlpjrvfrgzcjwncvlwhpclfzngbgvmrmlzngmqlvvwhbpjzlclgrcnnvnlppqhvlrnpzvmtsbdpfbwgffgzfwvltcfvfdcnfhwvcvclwwbmshhmpgrzgltwjmqczpqzdwfjpqhmwqhvvgnpgtwrjrgwvhthtdrdpnwpbmwstgblwmbfvlwflqmfbcsgwstwvncwfcsmrpcfrrvmlbqhdtdswswfnzhgzlngwsrtlzfcgdppmjnghfrgbdqhqmslhcqddjvsslsjwqqznttqjzdlghnsvqqtwrpfbzjgwnrhhvlnbqmnvcpblzgbzltnrhzpdwvbqbtmctbzgsdjfzswrbqbzgvwjlwtmgcllnmnwcljbhbplpvtgpgjftfrbgpgmhghnjcgjfqmsbqhbgtzbfzgwmfdsgfgmgzsbgdrszfhjttbvcqjzjgbqfgswlmrrhnmnfrptvjtlnvplgznsljzfzmhghlsccnqzflfnmbhshfprhclmtfptcmtnhrjgnngnqnczvcgzzlntftjsbgpgwzbnrhzzfqmznqnzfrvjzsmtpjbswzjlbgpfftzrzbfgdblpwscbqjfrfmfnhhlhjprtlzzvwnwzsnqhnmgwsdprnrblgbclzhthftqzdljspwdzwmwhfmdzmlvqsngppdfsjdprbrhffcvcvzztjjqcffwbrvpzvzfzhjvsfvsnrmjvqmjtrjbmbqsdtjgvtbbzzfmnmrrflgcdtljpmpvqvdbzgbmhjgccgdtplllctzqpfqnsztbwdbmqgfzrcddtmwrgmwsghcfpgqssdjrtqhtjfbpjvjdnzgvpzrhbrhrhcmpbglbbrvdltdpsrwjbjzftccwgnqmnlqlpjwrfdvmlgvgqznlvsmpzsmgjstvqbqpprzlsdndpfbmqcrfgvcfvlfhmpfnnqlcqlnbbgcrrrhbtzwnwmfrnrzvgmqlmqnmnzbwflwzcmncphjqztlrzvpztqhptmfsrppvvlzcfnlrwptgccsjjjscjcwnzssmbcvtzhnscgsbrchbqbrtdzllfvmqfwznfzpzmbfwcdsfhdlddnfbdgqbqjqzdtppshwcvvcjqstdgtgbhmlqlrfrhbvfsszsmbldmwfnfgnjptdslnzwcjgmvbnqcfzjmrslrlllplbhpjcnvzmvrfzwqhmbnrvpqnvcfncgfwqlvcwpwwljssfmswctcmhgtphvjdpfnnzznfbdjcsndrczlgdjhrnrltsgbtqmqcbwlthwcgsbvqbnntcznczpmlmblwdrlmzqdztwsgjthjwtfcpgwbczmdmhttzcwvdzhdfldmwnbnfdcjgvjhrfltjnjhqhzmzrlbncwdnlgshmqhpgsdwbvmvjsfgvgqzqjqdzqzmfmrncfdgrqfrnstvpqwtltnhgrmhgmmnwvlnsfmmbjrdmrnlgfgpqncdpqgvjltpghbgffdppdcfhdqhtvrdnfvcttlrqppfnqtmzpfgsnmjqfrgtbbdzzrccsrzgfjndlrnzqmjjtgldglcpzcrhwfplvdndjtzbpfbbbpfljqnlvrdzbrvczzwdrvzlmslbjsqgqdrltmhwcdpldqldlpctcbjmsvdwlfspzlpgrhdrvjtprcwrmszvzwmmjgvsbfcztmrdgrgshgtggpzszgqhwmhdzjmzsgqsfmqvcgqqwgprgvvqlbfhpwsfbjdqtcfnfhsgzthzhbpwggbnscqbnvcdprsbgllsrdcclqggfgfdrpqlqljfwpmzdhthpczcsqrrm diff --git a/day07/input.txt b/day07/input.txt deleted file mode 100644 index f1d8ab1..0000000 --- a/day07/input.txt +++ /dev/null @@ -1,899 +0,0 @@ -$ cd / -$ ls -dir ctd -80649 mwcj.pmh -212527 nbb.ztq -dir pgqmwn -152170 scr.smr -17637 snqcgbs.nhv -dir tmw -dir vtm -$ cd ctd -$ ls -dir bblsqnwl -dir gzcjrs -dir pgqmwn -dir qzgjp -dir shmvmqv -$ cd bblsqnwl -$ ls -dir rng -$ cd rng -$ ls -dir jncpmzcs -dir pttvmghm -293353 qcjbfggw.tjj -dir sgm -$ cd jncpmzcs -$ ls -36126 tstwmrbr.bmr -$ cd .. -$ cd pttvmghm -$ ls -38802 ctttjn.nzr -$ cd .. -$ cd sgm -$ ls -dir djcbdbgr -dir gqrr -$ cd djcbdbgr -$ ls -254050 nbb.ztq -$ cd .. -$ cd gqrr -$ ls -168685 jgsqvf.tql -302004 shmvmqv -$ cd .. -$ cd .. -$ cd .. -$ cd .. -$ cd gzcjrs -$ ls -319972 bwnjnmmh.wwd -25495 fzthlhcp.nst -291270 ghjc.nvf -244664 jrlfb.fvz -$ cd .. -$ cd pgqmwn -$ ls -dir zpvthlgp -$ cd zpvthlgp -$ ls -128092 dqvcqs.zpb -140511 nvqsqtjw -$ cd .. -$ cd .. -$ cd qzgjp -$ ls -23062 jgsqvf.tql -254685 nbb.ztq -dir pgqmwn -320683 shmvmqv -105368 shmvmqv.hmg -60805 snqcgbs -$ cd pgqmwn -$ ls -47287 gffvwmr.pbd -$ cd .. -$ cd .. -$ cd shmvmqv -$ ls -80751 crtwwqb -dir dbfm -dir dhhghph -dir pgqmwn -195177 qnm -dir qpbn -dir rwmsqdw -dir shmvmqv -16133 shmvmqv.vwq -187938 tmw -$ cd dbfm -$ ls -dir gbpnjrt -265813 glzz.mjv -108147 nbb.ztq -229253 nvqsqtjw -85743 pgqmwn -261375 qnm -$ cd gbpnjrt -$ ls -179812 mtp.lnf -234550 shmvmqv.qvq -$ cd .. -$ cd .. -$ cd dhhghph -$ ls -dir ghmpb -70514 zqv.ssn -$ cd ghmpb -$ ls -132693 shmvmqv.csb -$ cd .. -$ cd .. -$ cd pgqmwn -$ ls -dir hcbtbr -200292 pgqmwn -67530 sgm -15442 snqcgbs -$ cd hcbtbr -$ ls -249252 dqvcqs.zpb -$ cd .. -$ cd .. -$ cd qpbn -$ ls -dir pmbw -261142 qnm -dir rsfh -239788 sgm -dir wfwl -$ cd pmbw -$ ls -dir gwwdtzp -dir jszzc -32725 rnggjs.cbv -dir sldv -dir tptrlz -$ cd gwwdtzp -$ ls -dir dlvbdn -63066 dslb.mrp -dir shmvmqv -dir tzssf -$ cd dlvbdn -$ ls -190731 nqv.csc -$ cd .. -$ cd shmvmqv -$ ls -223667 nbb.ztq -$ cd .. -$ cd tzssf -$ ls -27296 rlgswwzq.dgj -dir tfdq -206881 wrdqg.pfj -$ cd tfdq -$ ls -26512 wsgh -$ cd .. -$ cd .. -$ cd .. -$ cd jszzc -$ ls -218701 qpz.hdm -$ cd .. -$ cd sldv -$ ls -dir hsbzqtml -3895 jgsqvf.tql -181815 nbb.ztq -294048 shmvmqv.fcm -dir snqcgbs -dir tmw -203484 zfpjq.pvn -dir zlpwdp -$ cd hsbzqtml -$ ls -dir shmvmqv -$ cd shmvmqv -$ ls -103536 nbb.ztq -32635 wmc -$ cd .. -$ cd .. -$ cd snqcgbs -$ ls -95112 dch -$ cd .. -$ cd tmw -$ ls -dir dplm -275451 hsr.zhn -9766 qnm -177383 ztbmqjqb.hwj -$ cd dplm -$ ls -277671 dqvcqs.zpb -$ cd .. -$ cd .. -$ cd zlpwdp -$ ls -315030 snqcgbs.mlz -$ cd .. -$ cd .. -$ cd tptrlz -$ ls -dir jfflz -154685 qbbpstff.fcs -dir sjjgljg -dir zsssqcsb -$ cd jfflz -$ ls -1330 fvldwzn.dbb -227153 nbb.ztq -$ cd .. -$ cd sjjgljg -$ ls -295745 frjnfsgt.fmq -105131 jtbltpv.vhm -174279 pgqmwn -104317 sgm -$ cd .. -$ cd zsssqcsb -$ ls -246361 bnzsv.dqf -dir ggcvqf -dir htqpwzw -249833 jgsqvf.tql -dir lbtjth -dir lcfwb -306768 mmd.gjw -121112 pgqmwn -dir sgm -dir shmvmqv -dir snqcgbs -55055 tmw.rqm -$ cd ggcvqf -$ ls -46573 fcwznd -$ cd .. -$ cd htqpwzw -$ ls -dir bmzvdzsv -193713 fpp.vwd -39898 mfjcnl.szn -65370 msljctr -10685 ppgzbc.trg -94843 shmvmqv.hqn -dir thfdg -$ cd bmzvdzsv -$ ls -74898 pgqmwn.wwh -$ cd .. -$ cd thfdg -$ ls -dir cpsgcll -$ cd cpsgcll -$ ls -244683 gdfw -17203 tmw -$ cd .. -$ cd .. -$ cd .. -$ cd lbtjth -$ ls -dir snqcgbs -$ cd snqcgbs -$ ls -122394 grhbhpw.fsl -55324 jgsqvf.tql -$ cd .. -$ cd .. -$ cd lcfwb -$ ls -138053 nvqsqtjw -$ cd .. -$ cd sgm -$ ls -314313 dqvcqs.zpb -146274 fftqvs.ltt -225372 jtq.rzq -85697 rctzgq.rsr -dir sgm -262221 tqpng -$ cd sgm -$ ls -dir cmvvd -277366 mhs.tpn -77975 nbb.ztq -160966 qrwbvbd.ghf -55949 snqcgbs.qzc -$ cd cmvvd -$ ls -28054 lfsvfsl -165671 tmw.zwh -$ cd .. -$ cd .. -$ cd .. -$ cd shmvmqv -$ ls -51884 bsbwrjnz.dmt -231236 jfmsg.mts -dir qpb -256063 zhmw -65512 zrnhr -$ cd qpb -$ ls -228289 dqvcqs.zpb -$ cd .. -$ cd .. -$ cd snqcgbs -$ ls -dir mnwgf -$ cd mnwgf -$ ls -178834 qgnwvlfd.cps -255140 sls.mnw -9546 tvhbm -281615 vntrb -$ cd .. -$ cd .. -$ cd .. -$ cd .. -$ cd .. -$ cd rsfh -$ ls -310413 snqcgbs -$ cd .. -$ cd wfwl -$ ls -dir fmvg -129025 jgsqvf.tql -$ cd fmvg -$ ls -276100 nvqsqtjw -$ cd .. -$ cd .. -$ cd .. -$ cd rwmsqdw -$ ls -46554 qzdmgl -55785 shmvmqv -127982 tfffrg.sbz -$ cd .. -$ cd shmvmqv -$ ls -dir ntstz -dir vprlz -$ cd ntstz -$ ls -304801 nvqsqtjw -28969 wzfb.fjv -$ cd .. -$ cd vprlz -$ ls -dir cmmtnt -dir shmvmqv -$ cd cmmtnt -$ ls -270129 shmvmqv -$ cd .. -$ cd shmvmqv -$ ls -dir sgm -$ cd sgm -$ ls -287889 hghh.mwt -$ cd .. -$ cd .. -$ cd .. -$ cd .. -$ cd .. -$ cd .. -$ cd pgqmwn -$ ls -85368 qnm -$ cd .. -$ cd tmw -$ ls -dir fnpjwg -dir gdt -dir ggs -dir llh -69470 nvqsqtjw -dir sgm -$ cd fnpjwg -$ ls -161820 dndq.tfl -dir dwmcs -205155 tdccsw.qlq -165352 vvmnpj -$ cd dwmcs -$ ls -121466 dqvcqs.zpb -274171 qbbqmf.ltf -$ cd .. -$ cd .. -$ cd gdt -$ ls -dir cnvtrw -dir gdcvdsv -dir hcn -dir hsmhn -dir jnhqz -78446 pgqmwn.mwr -dir qwfl -dir snqcgbs -$ cd cnvtrw -$ ls -dir hfvzm -$ cd hfvzm -$ ls -305880 tmw.lvw -$ cd .. -$ cd .. -$ cd gdcvdsv -$ ls -69690 jhscd -$ cd .. -$ cd hcn -$ ls -166775 dqvcqs.zpb -294325 nvqsqtjw -$ cd .. -$ cd hsmhn -$ ls -172897 lrjf.dnw -dir npgr -225227 pbcmjg.rhf -234530 pgqmwn.cqb -dir qlz -dir snqcgbs -52808 tnntq.wjt -$ cd npgr -$ ls -141280 qnm -64422 rwv -$ cd .. -$ cd qlz -$ ls -258070 nbb.ztq -$ cd .. -$ cd snqcgbs -$ ls -3723 frcr.jmn -109486 sgm.nsw -114054 shmvmqv.frr -142024 snqcgbs -$ cd .. -$ cd .. -$ cd jnhqz -$ ls -dir gpztwnqm -dir nwpqbf -dir sgm -dir tmw -$ cd gpztwnqm -$ ls -303103 bjbpj -281422 hgp -284044 jgsqvf.tql -dir qzts -133248 sgm -$ cd qzts -$ ls -2428 dqvcqs.zpb -283206 hzs.smg -dir lmlw -$ cd lmlw -$ ls -dir sjrfmpc -$ cd sjrfmpc -$ ls -164708 nbb.ztq -$ cd .. -$ cd .. -$ cd .. -$ cd .. -$ cd nwpqbf -$ ls -192033 dqvcqs.zpb -298220 jqd.bfh -dir mhtsg -100921 snqcgbs -dir zbtb -$ cd mhtsg -$ ls -140813 cgcn.rjn -$ cd .. -$ cd zbtb -$ ls -201213 gjglrmf.dzv -dir grbl -81636 pgqmwn.zfm -265992 pwhbflzn.sch -dir twjrlzpj -$ cd grbl -$ ls -82894 jgsqvf.tql -$ cd .. -$ cd twjrlzpj -$ ls -304952 cwhtqv.zvh -$ cd .. -$ cd .. -$ cd .. -$ cd sgm -$ ls -56329 ftfvfpz.srv -3875 nbb.ztq -4766 shmvmqv.fdt -247272 vbw.hsv -$ cd .. -$ cd tmw -$ ls -dir ddbvd -$ cd ddbvd -$ ls -83200 tnrwdc.dzm -$ cd .. -$ cd .. -$ cd .. -$ cd qwfl -$ ls -dir bcfnz -23440 nvqsqtjw -dir pwb -206984 shmvmqv.fjb -35453 snqcgbs -297136 snqcgbs.fnr -dir tmw -181689 wcbdwwq -$ cd bcfnz -$ ls -dir fnrclwn -dir fslh -258656 gtbhdpt.pth -238261 psbsmvpf.lmt -dir sgm -$ cd fnrclwn -$ ls -30297 crhjfzlp.gtb -297557 gvvnbmt.spr -189301 nvqsqtjw -45159 sndmlvw.lsb -259295 sqd -$ cd .. -$ cd fslh -$ ls -246662 bpvcj.hnf -$ cd .. -$ cd sgm -$ ls -dir jpr -dir tmw -dir wscvtrd -$ cd jpr -$ ls -49005 dqvcqs.zpb -$ cd .. -$ cd tmw -$ ls -201387 sgm -$ cd .. -$ cd wscvtrd -$ ls -77175 blczlqf.pnv -207393 shmvmqv.qbs -$ cd .. -$ cd .. -$ cd .. -$ cd pwb -$ ls -89451 bqcmzzf -207548 gfwgnft.php -dir gsn -dir jtvpnvz -144792 nbb.ztq -dir nzzqj -214209 pgqmwn.sjv -236845 pzvjqqvz -dir sgm -dir snqcgbs -dir vfvttj -$ cd gsn -$ ls -93490 snqcgbs.fbv -$ cd .. -$ cd jtvpnvz -$ ls -dir fdnvff -208857 gpvwzhd -229559 rnc -225519 snqcgbs -162969 tmw -$ cd fdnvff -$ ls -286944 dztqqtf.nmp -dir rwc -181737 snqcgbs -$ cd rwc -$ ls -115290 nbb.ztq -$ cd .. -$ cd .. -$ cd .. -$ cd nzzqj -$ ls -154210 jgsqvf.tql -dir sgm -182438 snqcgbs.wpg -dir zpvghr -$ cd sgm -$ ls -123163 rjgc.ccm -dir rqn -291622 tflv.pqc -$ cd rqn -$ ls -220655 rtbrwmjn.clj -$ cd .. -$ cd .. -$ cd zpvghr -$ ls -288859 dqvcqs.zpb -218036 hfdcrjp -$ cd .. -$ cd .. -$ cd sgm -$ ls -107183 sgm.nsf -225832 sjwn -dir tgf -$ cd tgf -$ ls -258766 nvqsqtjw -$ cd .. -$ cd .. -$ cd snqcgbs -$ ls -56144 whjpg.ffz -$ cd .. -$ cd vfvttj -$ ls -dir ptmggmsl -$ cd ptmggmsl -$ ls -dir psd -dir wdzptvjc -$ cd psd -$ ls -121637 dqvcqs.zpb -$ cd .. -$ cd wdzptvjc -$ ls -dir shmvmqv -$ cd shmvmqv -$ ls -23754 dqmrj.fhh -$ cd .. -$ cd .. -$ cd .. -$ cd .. -$ cd .. -$ cd tmw -$ ls -17390 hqz -dir jnsb -31072 nvqsqtjw -dir tmw -144511 vvwjcqr.rtz -$ cd jnsb -$ ls -265907 snqcgbs.swh -$ cd .. -$ cd tmw -$ ls -dir gfncpvw -$ cd gfncpvw -$ ls -dir ctvwgtlh -$ cd ctvwgtlh -$ ls -29825 ccjvs.qqq -$ cd .. -$ cd .. -$ cd .. -$ cd .. -$ cd .. -$ cd snqcgbs -$ ls -230355 ccl.ddg -dir csfdmhmb -dir drpgbvzf -313060 hhcpw.nbs -dir pfpn -dir ptwnpdnc -273250 qfsnmbm -dir shmvmqv -244767 tmw.zjg -$ cd csfdmhmb -$ ls -50690 nbb.ztq -282078 vzrw -$ cd .. -$ cd drpgbvzf -$ ls -dir bhwvqf -803 dqvcqs.zpb -49859 hhw.gpd -180202 nbb.ztq -dir nfh -64808 pgqmwn -276746 qnm -dir shmvmqv -dir tmw -$ cd bhwvqf -$ ls -76667 qcgpdwm.sbs -$ cd .. -$ cd nfh -$ ls -23774 jgsqvf.tql -34652 pnp.lvp -120264 zvp -$ cd .. -$ cd shmvmqv -$ ls -47748 cswm.dsr -dir pgqmwn -$ cd pgqmwn -$ ls -109587 qnm -$ cd .. -$ cd .. -$ cd tmw -$ ls -105578 snqcgbs -$ cd .. -$ cd .. -$ cd pfpn -$ ls -194628 wgc -$ cd .. -$ cd ptwnpdnc -$ ls -142456 rvwtfvr.tsc -$ cd .. -$ cd shmvmqv -$ ls -118642 hgqlrt.btl -$ cd .. -$ cd .. -$ cd .. -$ cd ggs -$ ls -231223 hmtp.djc -$ cd .. -$ cd llh -$ ls -dir hbq -dir svt -$ cd hbq -$ ls -157243 fhpsb -36981 rdbqnbfr.cwz -282257 tmw.wwv -$ cd .. -$ cd svt -$ ls -161395 sgm.hdl -$ cd .. -$ cd .. -$ cd sgm -$ ls -247276 fss -dir pgqmwn -68084 pgqmwn.vfl -28475 sgm.swb -dir shmvmqv -223438 snqcgbs.bng -$ cd pgqmwn -$ ls -134640 dqvcqs.zpb -dir nrdd -25431 nvqsqtjw -149751 qhzqw -dir vfmcjhwz -dir zlfhr -$ cd nrdd -$ ls -dir pgqmwn -$ cd pgqmwn -$ ls -57090 nfbd -$ cd .. -$ cd .. -$ cd vfmcjhwz -$ ls -24256 fdzfwfh.rcv -$ cd .. -$ cd zlfhr -$ ls -20504 fgbpndj.wgm -181769 qnm -$ cd .. -$ cd .. -$ cd shmvmqv -$ ls -208988 nbb.ztq -$ cd .. -$ cd .. -$ cd .. -$ cd vtm -$ ls -dir lqvjm -dir msmtcnsj -dir qmtgdn -dir tmw -$ cd lqvjm -$ ls -239772 hnj.zqf -$ cd .. -$ cd msmtcnsj -$ ls -48711 clfl.fsl -245929 ddh.gdq -dir fvlb -241040 nvqsqtjw -dir shmvmqv -305567 vdzzqpz.jfs -$ cd fvlb -$ ls -25669 ddz.tbc -$ cd .. -$ cd shmvmqv -$ ls -283905 nvqsqtjw -$ cd .. -$ cd .. -$ cd qmtgdn -$ ls -246479 pgqmwn -35386 rtf.cdp -217551 sgm.mrz -$ cd .. -$ cd tmw -$ ls -dir qfggmdvd -dir tlv -dir tmw -$ cd qfggmdvd -$ ls -288091 djwfq.wzc -37383 pwnzdj -214119 shmvmqv.wlg -29747 tmw.ntw -146556 zgbd -$ cd .. -$ cd tlv -$ ls -142924 grj.qhw -210672 qhmn -209554 zbcqcb.mhn -141215 zjmrgw.wlc -$ cd .. -$ cd tmw -$ ls -dir fwsgn -dir tmw -$ cd fwsgn -$ ls -dir qbbhrst -306142 sgm -$ cd qbbhrst -$ ls -dir sgm -dir srbn -$ cd sgm -$ ls -80992 bbvqrcf.chp -$ cd .. -$ cd srbn -$ ls -161382 nvqsqtjw -$ cd .. -$ cd .. -$ cd .. -$ cd tmw -$ ls -219508 dqvcqs.zpb -dir tmw -134434 wbvvgqwn.bmh -$ cd tmw -$ ls -209116 pgqmwn diff --git a/day08/input.txt b/day08/input.txt deleted file mode 100644 index 3133adb..0000000 --- a/day08/input.txt +++ /dev/null @@ -1,99 +0,0 @@ -220102001303332210111144403232401113333122342344231242454143210203320302212443030013122003001101100 -002012111323310331302003042221132010432132445255133124455255223004414440440003301012203200022100210 -200201202011003110423331304200331011531224544245554512113213335525210302033141324322321031312102110 -100020212221032131124244103404003222433224521422334123232422124515312313433224100204010121132311000 -200113321032110240111004030043155443522233113242534443312241445211112450323031312112213000023232100 -000123222130133422212242344055134444215311551422533215421415442551425225432130430124043210211111310 -220013001310041302023441034332322423241253523413533421512551432233114553552003013120121302130121320 -103122021001324130041021443134551553414353255343356623553131221454542451225451442032131420112320101 -012123121220242033212021343121244143344324534625253522262464534215422121222134240012234133102111220 -330310331223230000003152443554413335326665536266322522652335566553114314142351411020403401413302112 -033203120011110011132251145135331144533354253453463224233644324632453434135523253300131220303213123 -320111230330142103134512313345346434643654336344264466663434525446644113511452351451422214014013322 -001132233321313303345535112443242622242446334234425332545346556362543355243332135453212444110331303 -112033313244310423153325243233225655536462366623456645652435535435325433454445524512423111021132122 -313313043314211444453212142362452645555543222645663664243443432442223333565131234141351344321344102 -131230133213133211232332525334634543566623665537334334547734623265434432455254451425235432443212211 -033344041000113254352455455346236225633465644343664557364344535543336532242444234311533433344140212 -213210413044552341333323656654354424366446744766744473434577534775255332236334522521333331002022121 -223112203001555435245233523555243667443447767433564533557556755677732432236462355155425414244240300 -031112340101154335334634566542526467535374465476634474475365364377737233444423444335143215320411041 -010203132113252122424352345322745777347553756767766736766655557657446763326426264545545441510322304 -321034434351253424555342636457546533636345766763737363536656637564757633453436366225532223151301123 -140333103113245552456543556436376775537436555564765867677377566536736367466446544545111231522432042 -344202325543255413523362252766476773354345756567775846446585764655346457333656245566142114252141442 -300442033331415536626644654454735373634646576484854768867856765345656633644236246242335514321313432 -422444251112412665556253554536437336675554766648744646768865576456545754676632532244262315154431312 -202304543452455552253665657746647784558765457564785778845788767784833536336745445354462312521531440 -443202253112536253525354345435633886668445868754667447674764886554756567546737654246334325241222041 -444423415155442365223265743454556684558776766888858567565767784775755635475565754224462452335222241 -344303321125225553466564654375755674684544768955877976656855558645744675543644552655335222244234041 -300235531322254555657355344757787845684787759755989576658884775746464854347454745445252251123331200 -202355355135453623555734775437867546864765789685787875887555685885564677653753475626332543431524440 -123112125155234436477477667347767767746589595765887578895688659457644647637353775542533353231324344 -410231223354354564265577744565557576558859695696978987776856795557766747576576743622336235154122541 -144345221145432366464547578854445477995896778965569886979678656986544557875776343376245336222211154 -041355524153432432536456778856655655586558689789676558987567866689878584574356765462664355555422315 -043213424536224446535754387584686658555998969679778967988975666897764557557733673744622262412325233 -101514245332544663477377677875765977975768579996797978899567698975768865784644537776543454651544223 -055515332353232236436447686544477656596959996666689896787797795969665874555543664764442344265232243 -222545542226664544634434558757485778565956766669899769668998978795896868888674777634532432531545351 -434314333334362377634654477865886799965779778887799678789966958767788684856666356767346645644343444 -052335546342344533746576644847456965678786776877897777697767787998596844688878543443425354265524523 -245321436235332754756734464668569895557967788998689969678678888859577664555777765333674636253522234 -222511135542326767344777655475586999669889777967697967976779776769789666884457455657536456246131555 -254433214252433545454764655656756765598866789679798998989699886966798756574757563674433652342254411 -252443455634345774563668584548569877777679776897897977978768868758769758655687433345452443435424512 -312151563634655557774676587765775678576967989777779888989698876657887877756744456665655635556644123 -255315424526333665355778666668586665799969869877998777889777988668875966868565465457776522236513141 -141324353246555364776377784867669969887687879788978777778977696768597689744655653757436644265454325 -354554356562633675467576477485995977969979699799889979879876989688558895876557644555777244452335314 -235324556262356365436555887646778779897999678779989989789867689977685966845857674434347554655643252 -413432246554227346473675665849975567696667989798798778788967877675576875667875866434546262246521543 -552324452542255347547654567456656665796776679978889979999797899897878689747764654756336634422352455 -132142446224635664776385465487598668797987978789877989998967699965559668558447437465553652345225512 -535121326642222474774354544766768756799778998798789898877898889965958696446887843476762526426515244 -345151122435326774546477755588766796667978679897798799788798667756596585444845757774352236466242124 -324135422245435777577646446776855665599676997689997887788889876766665986567668467764463526524522524 -325343515546653536653454765454579566578777977788879878787979966579696677474785343347473444324354355 -411221244324436736446567757755797766577698989699898679769679676797557885877546755664674522365314215 -011225512566433343766434774658485575577887896689896789789788897667989867646846655537445534555245154 -353122224246523453336574684477667558859686788676888887889677967668868867745484457553323245424151214 -025211533334552466553436874465855779555988968677869768998666855765958765844553645533522566662215435 -011144555564545656657564766665457958988879979779789696768889888785895588848586367454333255641115431 -312135513646235366335766645784546897755855986679986669787888667577687576776674647476324553225412153 -401131435555652456777737485558685475567889776796686996966887777867565457675674635564364663332115334 -111542111546535443776533554556858445867565786988765999858788986988467667765674337645225253433114412 -324152522543244453747533764587454556659676798855686758699569787576577568846344576564242526335344431 -123513525116652325364735577676854466795879775965858579978758766786788576585574533555234644544424444 -201422231514666656435556464744556487779676697575668797755696587875664885475643663462362633532152224 -443133412441244332664735557756557478667877999697777576977768645754645558333564346654626425334525344 -431015242443666335263335435575686474856864565688697865686896558787678553436564534565256645251434512 -010022255222133364253766673665475577467776484765858776654564844676776444447654375652434614143215022 -112002141144134663334274465647734767886457477454887888474577867446657475453544742245245225443332224 -331232153352336525225567445365565486747774487468877475878758554778586376763333443326544225345123013 -320123541455416433363426343365775545857885758565575848877877686547673556675754423464442514232324111 -042432343324232554524246554574474345666464658776446546567878767443577744556362465553665411142432422 -142111123322431534522545253754364545474457775847846786887674646573467346333352524442333115335223141 -344133332441235422454233333556736343777476764657687856476465776533456554442553426542432524345343333 -200031013552112555654336435633347655674473538755855765665344475745556736546535462654344221551230302 -304022204315531423544354645467655764773637456746376536645753764476654735362436623665431353330033320 -001214000225135351445433524663673656735567443667544556374445736766637732424362445435124235202421144 -133240444115255522316642262344554645657446334644647444534543345455733253453543223511253231133210321 -324313341004114352115254632235242543363566666546735757746734646346355536356645334223223155213043334 -322012103401425423541123244634634342577565467364645454366476547536536356344363313411143511003322321 -030233343013121433455142565364335554237444577544465747334546363663525346435245514412331312412441220 -210201421410133422542335534522343332455655473755663556635632662655563553445642432325453033042340112 -012224401212432145413124536446542562653225343456763356434464356455233544345355532151231212104022112 -312232323430402414252325451525553345425256326265324326656464322435443535213233315511433100124021321 -010230232102113031224241215434543254266544664634225463436365465636465234441113521431122331212121101 -212212302203143433332245352152333246623456656325435343642442543354454522241344343333411433411331230 -011102200023414304323524211214225553365332454633645434256444354263245252314454334421304444012133303 -120113010124021413002342554241434235565233233626345455655236425423152444344321441224210011210001020 -101033322321412021400115241224135351431466535533654236552223322311141154321444212340220200110122301 -011220031300131001424314223221135334414132553352224226351421342145342332444324224232200001102210233 -121312303322224212003013214154522352135431322413434142221234334123523122531033230010321012211132201 -012020110022314203102101331443513341244141113213442111455332441213534235144341443443042312110221221 -100013222332201123334301101412554224524144445454322353452424512151232340130231214403422202221333120 -211200011012011223124042241233103554151124335225451435512351451314113131210120200021021301331230211 -222211000301233212310103403144201411351211113145331241322345244155131304344032001313100223022021012 diff --git a/day09/input.txt b/day09/input.txt deleted file mode 100644 index fd3f0e8..0000000 --- a/day09/input.txt +++ /dev/null @@ -1,2000 +0,0 @@ -L 1 -R 1 -D 1 -R 2 -D 2 -L 1 -D 1 -L 2 -R 1 -L 1 -U 1 -D 2 -R 1 -D 2 -R 1 -L 2 -D 1 -U 1 -L 2 -U 1 -D 1 -U 1 -D 2 -L 2 -D 2 -L 1 -D 2 -R 2 -L 1 -D 2 -R 2 -D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5 -U 18 -D 5 -L 5 -R 7 -D 4 -R 8 -L 13 -D 15 -R 10 -U 5 -L 1 -D 8 -L 1 -U 6 -L 7 -D 4 -U 12 -R 4 -D 11 -R 5 -L 6 -R 3 -L 1 -D 14 -L 18 -D 5 -U 2 -R 8 -D 18 -R 11 -U 10 -R 4 -U 14 -D 15 -U 17 -R 16 -D 15 -R 8 -U 14 -R 18 -L 2 -R 3 -L 10 -R 9 -U 17 -R 2 -U 19 -L 7 -D 19 -L 8 -R 12 -U 1 -L 18 -R 7 -L 18 -D 19 -U 9 -L 5 -D 5 -L 14 -U 2 -R 8 -D 19 -R 17 -U 6 -D 4 -R 7 -U 6 -R 14 -U 3 -D 17 -U 14 -R 19 -U 1 -R 17 -L 11 -U 18 -L 13 -R 16 -D 9 -L 3 -U 9 -D 5 -L 2 -D 5 -L 10 -U 10 -R 10 -U 6 -D 4 -R 3 -U 1 -L 18 -U 15 -R 2 -L 2 -U 9 -R 2 -U 8 -R 18 -D 16 -R 3 -D 6 -R 14 -L 15 -D 18 -L 12 -R 7 -L 18 -D 15 -R 13 -D 8 -L 8 -R 9 -L 4 -U 11 -R 12 -L 13 -U 12 -D 5 -L 4 -D 19 -R 10 -L 9 -U 18 \ No newline at end of file diff --git a/day10/input.txt b/day10/input.txt deleted file mode 100644 index 42295c4..0000000 --- a/day10/input.txt +++ /dev/null @@ -1,137 +0,0 @@ -noop -noop -noop -addx 4 -addx 1 -addx 5 -addx 1 -addx 5 -noop -addx -1 -addx -6 -addx 11 -noop -noop -noop -noop -addx 6 -addx 5 -noop -noop -noop -addx -30 -addx 34 -addx 2 -addx -39 -noop -addx 5 -addx 2 -addx 19 -addx -18 -addx 2 -addx 5 -addx 2 -addx 3 -noop -addx 2 -addx 3 -noop -addx 2 -addx 3 -noop -addx 2 -addx 3 -noop -addx 2 -addx -15 -addx -22 -noop -noop -addx 5 -addx 2 -noop -noop -addx 14 -addx -11 -addx 5 -addx 2 -addx 3 -noop -addx 2 -addx -16 -addx 17 -addx 2 -addx 5 -addx 2 -addx -6 -addx -25 -addx 35 -addx 1 -addx -36 -addx 1 -addx 22 -addx -19 -addx 5 -addx 2 -noop -noop -addx 5 -noop -noop -noop -addx 1 -addx 4 -noop -noop -noop -addx 5 -noop -addx 1 -addx 2 -addx 3 -addx 4 -addx -34 -addx 21 -addx -24 -addx 2 -addx 5 -addx 7 -addx -6 -addx 2 -addx 30 -addx -23 -addx 10 -addx -9 -addx 2 -addx 2 -addx 5 -addx -12 -addx 13 -addx 2 -addx 5 -addx 2 -addx -12 -addx -24 -addx -1 -noop -addx 3 -addx 3 -addx 1 -addx 5 -addx 21 -addx -16 -noop -addx 19 -addx -18 -addx 2 -addx 5 -addx 2 -addx 3 -noop -addx 3 -addx -1 -addx 1 -addx 2 -addx -18 -addx 1 -noop diff --git a/day11/input.txt b/day11/input.txt deleted file mode 100644 index c104b9c..0000000 --- a/day11/input.txt +++ /dev/null @@ -1,55 +0,0 @@ -Monkey 0: - Starting items: 54, 89, 94 - Operation: new = old * 7 - Test: divisible by 17 - If true: throw to monkey 5 - If false: throw to monkey 3 - -Monkey 1: - Starting items: 66, 71 - Operation: new = old + 4 - Test: divisible by 3 - If true: throw to monkey 0 - If false: throw to monkey 3 - -Monkey 2: - Starting items: 76, 55, 80, 55, 55, 96, 78 - Operation: new = old + 2 - Test: divisible by 5 - If true: throw to monkey 7 - If false: throw to monkey 4 - -Monkey 3: - Starting items: 93, 69, 76, 66, 89, 54, 59, 94 - Operation: new = old + 7 - Test: divisible by 7 - If true: throw to monkey 5 - If false: throw to monkey 2 - -Monkey 4: - Starting items: 80, 54, 58, 75, 99 - Operation: new = old * 17 - Test: divisible by 11 - If true: throw to monkey 1 - If false: throw to monkey 6 - -Monkey 5: - Starting items: 69, 70, 85, 83 - Operation: new = old + 8 - Test: divisible by 19 - If true: throw to monkey 2 - If false: throw to monkey 7 - -Monkey 6: - Starting items: 89 - Operation: new = old + 6 - Test: divisible by 2 - If true: throw to monkey 0 - If false: throw to monkey 1 - -Monkey 7: - Starting items: 62, 80, 58, 57, 93, 56 - Operation: new = old * old - Test: divisible by 13 - If true: throw to monkey 6 - If false: throw to monkey 4 \ No newline at end of file diff --git a/day12/input.txt b/day12/input.txt deleted file mode 100644 index 50f04d9..0000000 --- a/day12/input.txt +++ /dev/null @@ -1,41 +0,0 @@ -abccccaaaaaaacccaaaaaaaccccccccccccccccccccccccccccccccccaaaa -abcccccaaaaaacccaaaaaaaaaaccccccccccccccccccccccccccccccaaaaa -abccaaaaaaaaccaaaaaaaaaaaaaccccccccccccccccccccccccccccaaaaaa -abccaaaaaaaaaaaaaaaaaaaaaaacccccccccaaaccccacccccccccccaaacaa -abaccaaaaaaaaaaaaaaaaaacacacccccccccaaacccaaaccccccccccccccaa -abaccccaaaaaaaaaaaaaaaacccccccccccccaaaaaaaaaccccccccccccccaa -abaccccaacccccccccaaaaaacccccccccccccaaaaaaaacccccccccccccccc -abcccccaaaacccccccaaaaaaccccccccijjjjjjaaaaaccccccaaccaaccccc -abccccccaaaaacccccaaaacccccccciiijjjjjjjjjkkkkkkccaaaaaaccccc -abcccccaaaaacccccccccccccccccciiiirrrjjjjjkkkkkkkkaaaaaaccccc -abcccccaaaaaccccccccccccccccciiiirrrrrrjjjkkkkkkkkkaaaaaccccc -abaaccacaaaaacccccccccccccccciiiqrrrrrrrrrrssssskkkkaaaaacccc -abaaaaacaaccccccccccccccccccciiiqqrtuurrrrrsssssskklaaaaacccc -abaaaaacccccccccccaaccccccccciiqqqttuuuurrssusssslllaaccccccc -abaaaaaccccccccaaaaccccccccciiiqqqttuuuuuuuuuuusslllaaccccccc -abaaaaaacccccccaaaaaaccccccciiiqqqttxxxuuuuuuuusslllccccccccc -abaaaaaaccccaaccaaaaacccccchhiiqqtttxxxxuyyyyvvsslllccccccccc -abaaacacccccaacaaaaaccccccchhhqqqqttxxxxxyyyyvvsslllccccccccc -abaaacccccccaaaaaaaacccccchhhqqqqtttxxxxxyyyvvssqlllccccccccc -abacccccaaaaaaaaaaccaaacchhhpqqqtttxxxxxyyyyvvqqqlllccccccccc -SbaaacaaaaaaaaaaaacaaaaahhhhppttttxxEzzzzyyvvvqqqqlllcccccccc -abaaaaaaacaaaaaacccaaaaahhhppptttxxxxxyyyyyyyvvqqqlllcccccccc -abaaaaaaccaaaaaaaccaaaaahhhppptttxxxxywyyyyyyvvvqqqmmcccccccc -abaaaaaaacaaaaaaacccaaaahhhpppsssxxwwwyyyyyyvvvvqqqmmmccccccc -abaaaaaaaaaaaaaaacccaacahhhpppssssssswyyywwvvvvvqqqmmmccccccc -abaaaaaaaacacaaaacccccccgggppppsssssswwywwwwvvvqqqqmmmccccccc -abcaaacaaaccccaaaccccccccgggppppppssswwwwwrrrrrqqqmmmmccccccc -abcaaacccccccccccccccccccgggggpppoosswwwwwrrrrrqqmmmmddcccccc -abccaacccccccccccccccccccccgggggoooosswwwrrrnnnmmmmmddddccccc -abccccccccccccccccccccccccccgggggooossrrrrrnnnnnmmmddddaccccc -abaccccaacccccccccccccccccccccgggfoossrrrrnnnnndddddddaaacccc -abaccaaaaaaccccccccccccccccccccgffooorrrrnnnneeddddddaaaacccc -abaccaaaaaacccccccccccccccccccccfffooooonnnneeeddddaaaacccccc -abacccaaaaaccccccccaaccaaaccccccffffoooonnneeeeccaaaaaacccccc -abcccaaaaacccccccccaaccaaaaccccccffffoooneeeeeaccccccaacccccc -abaccaaaaaccccccccaaaacaaaaccccccafffffeeeeeaaacccccccccccccc -abacccccccccccccccaaaacaaacccccccccffffeeeecccccccccccccccaac -abaaaacccccccaaaaaaaaaaaaaacccccccccfffeeeccccccccccccccccaaa -abaaaacccccccaaaaaaaaaaaaaaccccccccccccaacccccccccccccccccaaa -abaacccccccccaaaaaaaaaaaaaaccccccccccccaacccccccccccccccaaaaa -abaaaccccccccccaaaaaaaaccccccccccccccccccccccccccccccccaaaaaa diff --git a/day13/input.txt b/day13/input.txt deleted file mode 100644 index 61bb5bb..0000000 --- a/day13/input.txt +++ /dev/null @@ -1,449 +0,0 @@ -[[9,1],[[[8],2,5],10,5],[[],[[0,10,2,10,2],[6]],5],[[10,[]],[],[[5,1,3,10],5],[[],[],[10,0]]],[[4,3],[[],[],[2,8,0,6]],4,[[8,1,7,1],1,[2,9,0],4,4]]] -[[5],[10,[[4,9,6,5,0],1,5,[],[]],[9],7,[]],[0,[[4,3,7,8],[0,1,2,5]]],[[[],[8,7,8,4,1],4,9,1],[[0,8,1],6,[0,7,1,1]],6,7,9]] - -[[1,[[],3,[2,7,7,5]],[10,[7,7,7,1]],[[9],4,4,7],[[7],1]],[],[5,10,7],[[0,[],[]]],[]] -[[2,2],[[0,[9,5,0,6],10,[],[8,1,6,6,0]],0,[[],[],[7,3,1,8,1]],10,1]] - -[[[2,7,7,[9,0,0]]],[[[1,6,0,1]],[[9,0,3,9,9],10],1,10,9],[[[3],2,[0,3,4],[],[7,4]],10,[8],9,6],[[5,2,6,4,[10,8]],[[0,5,9,10],[9,5],[10,3,4,0],0]],[]] -[[[],10,3,1,[[]]],[9,10],[],[[],3,10,5],[[[],4,3,0],[[],8,9,5,3],[],6]] - -[[[8,[],8,3,8],7,[]],[8,0],[7,3]] -[[],[[0,10],[[5],[10,2,2]]],[[6,[6,5,0,7],[],[]],10,5],[[1,[10,4,4]],5,7,5,7]] - -[9,9,7,10] -[9,9,7,10,0] - -[[0,[3,0]],[0,7,4,10]] -[[[[],[],3,[2]]],[]] - -[[],[10,1,[7,8,[10,7,0,8]],[],[0,[1,5,7,6],8,[5]]],[10]] -[[],[],[[[],9,[],9,[2]],[[10,8,1,6],[7,8],[8,2,5,6,9],[]],[],[9,6,2],[[0,4,7],[],3,8,[10,1,0,6,4]]]] - -[[6,1],[[],[3,[8,7,5,4,1]],[[9,10,6],[2,1],[4,10,5]],[[2],[8,1,4],3]],[5],[1,[1,7]]] -[[2],[[4],5,9,10],[3,7,9],[]] - -[[2,8,[4,[10],3],[],[2]],[0,[[3,0],[5,10,10]],[[10,1],[10,6,5,9,3]]],[],[],[[]]] -[[[10],[[],6,1,7]],[],[[[7],[3,10,8,7]]]] - -[[[1,[],[0]],0,[[6,1,10],[4,4,6],3,[0,5,2],5],6]] -[[],[],[[[],4,[],0,[8,7]],7,5],[[8,[],1,1]],[3,7,[],[[6,2,0],9,[0,3],10,4]]] - -[[[[9,5,5,1,2],1],9],[[[],3,4],[6,8,[4,3,3,10],[]],4],[[],1],[4]] -[[[[8,10,9,1,9],[],8],[[4,9,10],3],4],[0,9,6,[[9]]],[[[],[3],[],4],9]] - -[[7,[[9,8,7,6,10]]],[[[7],[4,9,6,1],[7,2,1],3],8],[[9,[4,4,10,3,1]],[6,0,8,2]],[[[9,7,7,9,6],10,[1,4,0,4,9],[7,3,4],[9,9,8,3]]],[10,[[2],[4,2],[3],6,3]]] -[[[[0,6,6,9],[1],[8,3,5,3,7],[1,4,2,0]],[],[[10],[1],[7,5,5,10],[5,2,8],[0]],[6],[1,5,[],[5,2,7,6]]],[[[4,7,9,9,3],[7,4,5]],3,5],[[9,4,1,[5,1]]],[[4]],[10,[]]] - -[[],[[5,[4,7,9,5]],[6,4]]] -[[[[7,1,7,3,2]],2,0,[[6,10]],[3]],[[],[8,[],[3]],[6,[],0,8,[10,5]]],[],[6,9,[[8,3,2,1],6]],[[3],[5,[]],[[0,4,7,0],0],[[1,2,7],[0,3],[10,6,0,5,5],[],4]]] - -[[[],[0,[10,1,0]],[0,[5,5,3,5,4],8,[],[2,9,10,0]],[3,4,3],[[10,3],[7,6,5,3],[2]]],[10]] -[[4,[0,6,1,[],[7,8,7,5]],[9]]] - -[[3,8,10,7],[[6,7],[[2,7,9,4,9]],0,[],4],[[],[[2],0,4]]] -[[0,[[5,6,9,8],2],2,10,[2]]] - -[[3,9,[[],[3]],[[]],5],[],[[[3,5,1]],9,3]] -[[6,1,[]],[[9,9],8,6,[6]],[[],3,4,[2]],[],[3,[],[3,[5,9,8,5,9],5,[]]]] - -[[3,[10,[8,3],8,2],[10],[5,4,[5,2,0,6,5],[],[8,10]]],[5,6,6,[]],[]] -[[],[],[[10,1,7,6,3],[[7,1,10,10],7,5,[]],[[],10,[5,2,7],6,[0,0,1]],4,9],[[[6,10,8,4],8,[3,0,5],10,3]],[]] - -[[0,[],9,[3]]] -[[],[1,[],3],[[8,5],[1,[5,2,4],[4,9,4]],7,[9,[10,7,6,4,6],6,[9,2,1,3],3],5],[[8,[1,7]],6,8,[[4,3],8]]] - -[[],[7],[6,10,[]],[],[[[1,4,7,2],6]]] -[[[],4],[[6,[4,5,4,5,8]],[[3,4],9,7],6,6],[7]] - -[[[]],[[5,[]],2,[8,6],[3,[3,0,1,9,5]],[[9,9]]],[[8,[]],[5],[1],[[],[0,1,1],9,[8,2,7,6]]],[[[],9],[4,[7,5],[7,5]]]] -[[[[8,7,4,0],5,[]],[10,10],5,9]] - -[[[[10,1,5,7,10],10,[],[1,7]],8,10],[[10,[9,6,10,9]],8,4,[[2,1,0],0],[6,7,8,[6,8],10]],[[],[[],[1,2,1],8],7,[[3,0,2,7,9],9],[5]],[5,[1,1,[]]]] -[[[[8],0,8,[]]],[[7],[[6],6,[9,0,6],[1,2,1,0],2]],[[],2,5,4,[1,[3,8],[5],7]],[[[0,1]],[5,[9,9,7,2,8],4],9],[0,3]] - -[[[[0,9],8,[]],2],[],[[[1,2,5,1,4]]],[[[1,7,5,2],4]],[[],9,3]] -[[[],8,[]],[9,8],[3,6,[]],[10,0,4,5]] - -[[],[9],[4],[[1,7,2]]] -[[2,1],[[]]] - -[[],[],[[8,5,[1,7,2,5],[1,5,9,2],[2,6]],0,[],9,0],[5,[],[9,[0,2,6,0],[8,3,9,0],[2,4,7],[7,2,10]],6],[3,[[7,1,0,5,0],9,[9],[0,10,8]],[]]] -[[[0],[[4,9,5,2],[10,8],8],10,[[3,1],3,[8,10,3,2]],[4]],[]] - -[[[[],4,10,5]],[],[[[5,10],6],3,10],[7,0,8,9,[[2,9,6],9]],[10,7,[2,6,10,3]]] -[[[3,3,[2,7,0,10],[9,10,2,7,10],[5,2,7,7,0]],1,5,[[0,5,3,2,7],5,[3,3],[2],10]],[10,[[9,3,0],[1,9,7,4,3],[8,4],[]],8],[[7,8,8,[],2],10,[[0,9],9,5,[7,7,5,4]],1,6]] - -[[10,[4]]] -[[1,10],[[[5,5],[],2],2,[],1]] - -[[],[[]],[],[5],[0,[],[6,[9,10,2,8,7],[4,7,1]],7]] -[[8],[6,[[4],[7,0],0,10],5],[[[4,10,9],9]],[10,3,[[6,1,5,8,2]]],[[10,2,0],[[5,2,10,6],[],[8,9,6,6],[],[9]]]] - -[[9],[[10,[8,4,4,8,10],5],[6],[[5],8,6],4,[[0,6,4]]],[10,2,0],[[[2,5],[1,9,1,1,7],0,[3,4,0,7,7]],5,[],[],0]] -[[[[],[3,8,7,8]],10,9,3],[[],0,[[7,10,10],1,[0,2],2,[1,7,0]],[[2,0,7,4,8],10,[9,4,2,0],[]],8],[[7,[2,2,8]],[[10,4,7,3]],[[8],3,[3]]],[],[[10,[9,6],6,[8,0,10,5]],[[9,10],10]]] - -[[[[2]],6,[[2,4],[]],4],[[1,10],[[1,1,7,8],4,[1,4,4],[7,6,8,6],[9,10,7,2]],[2,6,[0,9,2]],[]],[[[1,9,9,3,5]],[],[[2,4],3],[[0,10],8,[9,6],[0,3,4]]],[[[8],[9,1,5,9],3,1,7],[2,[2,0,8],[3,4,9,5,5],[],7]]] -[[[0,[0],3,[8,8,7]],2,9,8,5],[],[[5,4],[3,[4,4,6,4,2],1],0],[[10,5,[2,9]],2]] - -[[5,1,5,8],[[5,9,4,0]]] -[[9,8,[5,2,6,[2,4,8,10,1]],10],[6],[[[7,8,2,2,9],9,7],[10,0,0,[],6],[[],3,8,[],[8]],[[3,6],4,3,[]]],[8,10,8,7],[[5],9]] - -[] -[[9,5],[5,5,[[3,7,1,6,10]]],[[2,9,[],10]],[3,[4,[3],[0,8]],2],[[1,[7,6,5]],10,[1,[8,0,2,6,7],[4,3],[9,7,10,3],7]]] - -[[[[4]]],[9,7],[]] -[[4,1,3,8,[5,[2,5,9,7,9]]],[[1,[0,7,4],[],[6,3,8,1,3]],[8,[8,3,5],9,[7,0,6,10]],7,[[8],10,[5,4,10]]]] - -[[[1,[]],9,8,0],[1,[[5,9,10]]],[[[4,6,2,2],[],2],10,4,[6,[],10]]] -[[[5,[9,4,3,0,3]],6],[[3,10,10,[0,5,6,6,9],7],[4,[],10,[1,9,6,7],[9,6,4,2,0]],[3],10,9],[[],[2,[6,7,8,5]]]] - -[[[],[[7,4,2],[10],[2,10,6],5],9],[],[[[1,10,2,9]],[],8,[[6,0,8],[10,0,2,9],0,9]],[[6,0,1,[0],8],[1,[10,3],[2,3,5,10],[5,4,4,6,8],[]],[[9,1,10,10],10,[8,3,9],2,5]],[]] -[[8,9,7,[[10,3,2],[8,0,7],9,3],5]] - -[[],[],[1,9,0,9,8]] -[[10]] - -[[[7,[9,9],8,10],[[],[9,9,7,8]]],[[4,[5,10,4,7]]],[]] -[[],[[3,4,[3,7,5],2,[0,8,5,8]],[6,[6,6]],[3,2,[],[1,7]]]] - -[[5,2],[2],[[[7,8],[],[3,5,8],[10]],5],[8,[9,9,3],7,3,[4]],[[],[5,[9],[5,10,10,4],[4,6,3],8],[[9,9,10,3],4,10,[0]]]] -[[0,3,5,[[7,5,3,6,10],3,2]],[],[[10,[5,8,4],8,8,1],[9,5],2,[],[[8,9,0,7],[3,6]]],[3,2,4],[4,5,[[4,0,2],[1],[3],[6,0]]]] - -[[6,9,0,3],[],[],[4,[[0,3,8,6,9]]],[2,7,[],[[4,6,9,4],[4,10,8,7,0],[3,5],[6,10,5]],[3,1,[]]]] -[[],[],[[[7,6,8],[6,8,1],[9],[3],8]]] - -[[8,[1,4,[5,1,4,8],3,6],[10,[8,2,5,1],10],[0,6,[9,10,6,3,4],[8,6]],7],[1],[]] -[[6,6],[0],[],[1,3,[[7,9],1,6],10,[[8,3,5],[10,7,5,8,10],[10],10,[]]],[5,[[]],6,0]] - -[[[10,8],[[2,9,4]]],[[4,2,[7,4,6,7,7],[0,6,7,7],10]],[[2,[7,9],[2,2,0]]]] -[[1]] - -[[[7,2],8,[[2],4,5,[0],8]],[]] -[[3,6],[[[2],[6,10,1,5,3],[3,3],9],1,9,0,5],[[8,[4,8,6,9],[9,7],[7,8],[3,7]],10,6],[],[[[5,0],[7,1],[5,4]],5,6,6,[5,3,[2],[10,8,5]]]] - -[[[[8,2,4,4]],[],[[8,10,9,3],6,8,[3,9,4,5]],[[],8],[7,[]]],[9,8]] -[[[],[[9,0]],6],[9,[[0,5],8,[6,7,3,6]],[],[[9,4,5,8,10],10,4,[10],5],8]] - -[[],[[[],4,[3,9,8],[4,10,7,1]],[],7,3,[2,[8,3],8,7,[6,4,0,6,2]]],[[9,[0,10,0,5,0]],[],[2]]] -[[10,[10,10,0,[0,8,7]],5,5,[[7,4,1,5],[4,2,8,1]]]] - -[[],[[[2,2,5],9,1],[2,[4,4],[],5],5,10,[]],[0],[[6,[5],[3],3]],[7,5,5,3]] -[[[9,[0,9,3],[7,1,9,8],7],[6,0,[1]],10],[3,1],[],[[],[],[],3,[[6,6,9,3,7],[6,4]]]] - -[[[[6,2],10,8]],[[[0,7,8,4],[],7,4],0,3,3,[2,1]],[[6,[5,2],[8,1,7,3]],2,[[9,4,8],[7,0],[],10],8]] -[[],[1,[],[[4,8],1,7,[0,1,3,4,8],4]]] - -[[[[5,7,9],0,[9,7,5]],6,7,[4,9],5],[[0,[7,7,4,0,0],1,5,9]]] -[[4,[7,[10,6],7,10,[]]],[],[[[8],7,[0],7],9,[[1,1,4],[2,10,7]]],[[[9,10,7,2],1,4,6,9],[8]]] - -[[3,5]] -[[],[[7],4,9],[[7,[2,10,9],6,8],3,9,[]]] - -[[[8,5],[[3,7,7,0],10]],[[],[[],[2,9,0,4]],[[8,3,10,7,1],[]],3]] -[[],[10,6,0,[],6],[[],[5,6,[1,2]],[9],10,[[9,7,6,4],6,6]],[]] - -[[10,[9,10,[],[3,5,4,9,5]],7,9,[4,[0,10]]],[[0,[6,2,4,4,2],9,[7,9,4]],[10,[],[8],8]]] -[[4,0,6,6],[1,6,[[2,5,7]],[]],[]] - -[[[[0,5,0,9,4]],6,[0],5,4],[[10,[3,10,4,8]],[0,7,1,10,[3,10,8,5]],7,10,4]] -[[9,[9],4,[5]],[],[9,[0],9,[[1,3,0,7,10],[3,0,6,2]]]] - -[[[2,[7,6,7,6,0]],[1,[7,2,1,4,9],[7,2],3,[5,6,2]]]] -[[],[[6,[0,8,1,6,0],[4]],0,2,[[0,1],10,[1],2]]] - -[[[[2,5,4]],[],4,0],[6,[9,[8,4,9,3],9,4,[2]],[4,[10]],[[5,2,2,1],9,7],[5,[8],[10,8,6,2]]],[8,4,[],[10,0,2],0],[10,5]] -[[],[3],[],[8,4,[[1,10],2,2,[7,4,9]],7]] - -[[[],10,10,5,[[7],6]],[[3,[4,6,9,3,2],[10]]],[9,7,[5,10,[2,3,7,3,0],[]],9,[2,2,[6,9,7,0]]],[[0],5,3,[[8,3,10,1]],[[9],[8,10,8,1,6],[9,5,1,10,2]]]] -[[9,[],9]] - -[[3],[[[0]]],[],[]] -[[],[],[3,[]],[[2],[8,[6,5],10],[[0,5,4],1],5]] - -[[[5,1,8],1,0],[[]],[[8,[2,5,9,3,5],[8,9,5,9,9]],8,[[4,6,5,9]],0]] -[[8,[5,6]],[5,10,1,[10,3,8,10,[0,2]],[1,0]]] - -[[[3,1,7,[3,2,2,9,1],4],0,3,[[],[],10,[],9]],[[[6,5,3,6,8],1],[[]],3],[6,4],[[9,7,[6,3],6],9],[[[4,2,2],8,[8,1,7],[6,6]],[10],[[4,10,9,10,1],0,[],[9]],4]] -[[4,7,6],[[[9,9,5],[2,4],10,2],[6,[0,9,0]],8,4,2]] - -[[[7],[[9,5],0,1],7],[[3,3,4,[],[3,2,10]]],[],[4,6,4,[],[[4,6,1],[4,7],[0,9,10,10],8,0]],[[],3,1,3,[6,[3],0,[5,1,5,3,0],5]]] -[[1,[[],[9,4,6,1]],[[],[10]]],[8,[1],[[7],6,[9,10,6,0,5],[1]],3]] - -[[0,[],10,[],[]],[[[4,4,1,8]],7,8],[5]] -[[1,[]]] - -[[[[10,8,8],9,8],[0,6],9,[[4,6,1,7],[4,3],[10],4],3]] -[[[2,[10,7,10,10,8]],5,3],[9,4],[[[2,1],2],[3,0,[7],0,[5]]]] - -[[[],[6,[]],[[4,2],[0,4]],5],[]] -[[[7,[0,2,0],6,5,[]],[[10],0,[5,4]],[9,5,[9,2,4],3]]] - -[[[8],7,4,2],[],[10],[4,[[6,7,4],2,3,[6,1,0]],4,[1]]] -[[[[7,4,5,5,1],[9,1],[0]],[6,[8,2,3,0]],[2]],[7,[5],[8],[]],[9,[6,[8,4,2,2],1],4],[8,[[],[0]]],[[],3,8,9]] - -[[8,0,[[0,7,9]],0,[7]]] -[[[[]],[]]] - -[[4]] -[[6,[1,0,10],1,[[10,3,1,2],[4,6,5,7],5],[1,1,[3,1,8],6]],[2,1],[5,10,[1,[3,0,8],6]],[[0,9,[9]],4,[[]],7,[1,[7,4]]],[]] - -[[[[8,6],[6,2],[8],1]],[10,10,[[2,5],6,[4],[1,7,2,9],10],1,7],[],[[[10,7,5],5],[2,8,9],[[1,4,9]]],[[[9,10,6,2,4],1,8,[9,7,2,0],[]],10,5,5]] -[[]] - -[[1,[[1],[],[8]],[[6,1,6,7,5],1,4],10],[[7],[],3,[10,7],0]] -[[[]],[[[9]],[0],10,6],[[7]]] - -[[1,[[1,6,10,1,4],3,2,[8,7,9],[6,5,0,4]],[[],2,[10,1]],[[],[9,2,7],[],0,5]],[[6,[9],[],6,[9,10,2]]],[4,3,[[2,1,3,7],4,3,[3],4],9,[3,9,[2,8],1]]] -[[0,[[6,2]],[2,2],[[]]],[],[],[[[3,4],5,7,10]],[5,3]] - -[[[[8,2,0,1],[10],6],2,7,10],[[[]],10,1],[8,7,1,0],[[[2,9,2,8],[3,3,0,6],[2,0,2],[],0],1,[9,[4],5,[1,6,1]]],[[7],[[8],[7,4],[2],4],3,[[10,6,5,3],9]]] -[[9,8,[[],[9,0]],1],[9,8,8,10,7],[10,[8,0,[10,6,3],[6,3,0,4,8]],10,0]] - -[[[],1,[],[[9,9],0,[0,2]],4],[5,0],[4,[],7,7,0],[],[[4]]] -[[[[]],4,8,6,8],[9,[[10]],[[2,8,6],[9,0,2,8,4]],10,[1,[3,10,8]]],[[[]]]] - -[[5,6,5,4,6]] -[[[9,8,5,3,7],2,[[0,4],[10,2,5,10,1]],0],[[]],[6,[7,[1,5,10],[3],[6,1],[3,10]]]] - -[[[[3,3]],[],[6,5,[0]],[[8,7,9],[2],[1,5,2,5],[6,7,4,4],9],[9,[5,7,4,7,1],7,[10],4]]] -[[[7,[5]],6,[[7,9]]],[[[8,2],[1,7,4,2],[8,8,8],[1,9,3,5,8]],7,3,9,[2,2,6]]] - -[[],[[],2,[[1],[3,9,0],2,8],[[8,9],[1,2,3,1],[]]],[[9,[],[],[9],[5,1,3,6]],3,[1,[],[],[4,7,9,10],[10,5,5,8]],[0,[]]],[[0,5,4,7,[10,4,10,6,4]],[[4,8],0,7,10]]] -[[[[],7,[],8],2,7],[10,2,[[10,8,0,7,3],8],0],[8,8],[8]] - -[[5,10]] -[[10,[[9,1,1],0],[[3,1],1],[2,4,[4,0]],4],[9,[[0],4,3],10],[[[6,3,7],4,[],9]],[6,[[]],[]]] - -[[[[10,9,7,10,4],6,0],5,[[5,3,5,1,9],0,[3,7,10,7,5]]],[],[],[1,10],[]] -[[[[7,8],5,[8]],[[0,0],[9,7,6,6],[6,9],2],0],[7,[4,9,[0,2,2],[10]],[],9,10],[[],[[]],[2,8,6,8,1],[4,9,[0],10,7],[4]]] - -[[[[]],[[0,0,2,5]],[],5],[],[10]] -[[[[7,7,6,6,3],3,4,6,[3,8,10]],4,[[9,1,9,4],9,[2,6,4,1,0],9,1]]] - -[[[],[8,6,8]],[9,[9,[4,8,3,4,7],9,10,10],[[3,10,5],[10,1]],[]],[],[[1,[1,3,0,6,10],[2,0,10,4,3]]]] -[[10,[3],10,[[2,3,6,7,6],2,4],5],[6,[]]] - -[[[]]] -[[9],[1,[[6,9,7,6,5],[6],[2,3,3,3],10]]] - -[[[2,2],2],[4],[9,1,4,[[3,9],10],0]] -[[],[[4]],[[5,[7,3,2],0,[5,5,1,8,1]],3],[4,[3,[6,3],[],[9,0],[0,4,2,10,6]]],[[9,0,[3,3,9,6]],[[2,3,3,1],[10],5,4],[2,[],1,5,3]]] - -[[[[7,1,3],[0],3,[5,6,6,8],6],4,2,7,[[],[3,3,4],[9,2],[7]]],[],[7,9,[9,[6,8,7]],[[7,2],[1],8,6,[7,9]]],[],[[1],7,4]] -[[],[[9,3,8],4,0,10],[[[3,3,5],[5,3,3,6],[5,3,7]],9,8,[9,4,[],2,[0,3,8,0]],[[6,9],[1,8],4,[2,3,9,2]]],[],[[10,[7,6,6,1],[],6],[1],[10,[4,8,3,1,2]],[[7,9],8],0]] - -[[9,[[2,10]],[[4,8],[],4,8,[0]]],[],[[[1,3,9],[7],[9,4,9]],7,5,8],[[[1,2,3],7],5]] -[[1],[[],[[8,8]]],[2,3,10,[[1,3,5,8],[0,5,5,7],4],4],[2,5,6]] - -[[3,0],[10,8,[10],[[4,7,3,2],[2]],7],[[[8],3],3],[2,[7,[10],6],[],8,[2]],[[8,8,6,9,[8,2]],3,[[6,2,7,4,1],[1,7],[4,0,1],[5,4]],6]] -[[5,3],[[],2,[2,[5,9],[3,4,5,0,10],[0,2,6,0,5],[5,1,5]],5]] - -[[3,1,[7,8,[7,3],6],[],[[10,0,6],3,[6,0,8,4,5]]],[],[[[],6,[6,5,4,8,2],[]],[],[6,[3],9,2]],[0,10,7,[[],5,[10,2,0,7,2],[]]],[4,[1,8,[2],[1]],8,1]] -[[],[[],[[3,7]],6,[[9,10]]],[[6,[0,2,9],8,[7,7,2,4],[]],10,6,0,[1,[],3,6,[6,1,2]]],[[[],[10,8,6,2,6]],[4,[],[5,5,5,9],7]]] - -[[[],6],[[[3,4,5,8],[9,3,3],8,[],[8,5,10,0]]],[[4,9,[7,2,0]],[1,[9]],[]]] -[[7,[[3,0,0,1],8,9,7,[3,9,8,5,1]]],[[[4],4,4,7,7],0]] - -[[8,[]],[4,[[1,5,6,10,10]]]] -[[2,4,[[],9],[[9],8,[9]],[6,[6,2,9,10,6],4,3]]] - -[[9,0,8],[[5,9],6,[[2,2,4,4],1,[0,3,1,10,5],[4,8,7,0,6],5],[],9],[5,[10],0,4],[[],1,8,9,[[],[0,8,2],[0,10,7],0,[4,3]]]] -[[8,[3,1],[],[[2],[10],8,8,[8,3,1,8,5]],[10,[3,3,6]]],[],[[8,[6],[3,3],4],9],[4,2,8,4],[[5,[9,4],[6,7,6,7,4]],0,[0,[],[9],10,[5,4,10,9]],[[],9,5]]] - -[[[[4,8],10,[8],[2,1]],[[8,3,0,6],[5,6,6,0],6,[1,1,2,6],[0]],10,8,6],[5,[7,[],[4,1]],4,[4]],[9,[3,[5,4,1],[0,1,9,10]],2,[[2,0,2],[]]]] -[[],[10,[10,[10,7,8,2,1],7,[9,6],6],8],[[6,0,1],[8,[0,4,0],[],[2],[9,9]]],[],[3]] - -[[],[[[]],8,7,[[10,3,2],2]],[1,[0,6,[1,4,1,4]],5,[6,[8,0],[4,4,2,5,5]],1],[2,[[8,7],3],0,3,[6,[],[]]],[6,[3,2,0,10,[7,1,8,3,10]],[],9,[4,9,[5,3],5]]] -[[2,5,9],[],[]] - -[[],[6]] -[[],[[4,8]],[1,6],[10,1,[[3,10,0]]],[]] - -[[5,3,[5],[9,[8,7,2]],[[10],[9,3,0,4,6]]],[[],9,9,9],[[[],8,1],7,[[],[1,7,1,3],10,8,[9,5,9,5,0]],3,4],[2],[[[6,4,10],4,7],4,9,[[3,9,1,1],[],[8,3,9],[3,9,1,10],[8,0,6,4]]]] -[[[[7,7,9,6],2,4]],[[[4,10,2,8],10,9,3],0],[1,[],3]] - -[[],[],[],[[[5,5],[],[]],[[9,6,10,4],7]]] -[[0,4,8,7,[5,[4,3,7],[7,1,9,5],10]],[],[[9]],[[1,[7],[10,1],[2,10,5,3],[6,6,7,8,3]],[7],[8,0,8,3],6],[2,[[7,6,4,10,2],[2],5],[9,[1,2,3,5],4,[]]]] - -[[],[[3],[6,6,[6,2,3,5],4],[6,0],1]] -[[[1],0],[],[[],[10,0],5],[2,3],[[6],4]] - -[[6,2,[9,4,1,[0,4,2]]],[8],[[6]],[6,[[2,3,7,0],[10],[]],[2,7],1,8]] -[[],[6,[[5,8,4,0,3],1,[9,1,4,3],0,[3,5,9,8]],[[],5,[10,0,4,7],[3,10,2,6],[7,4]],9,[]],[[[1]],10,[[4],[5,2,3,5]],[10,9]]] - -[[9,6,[]],[5,[[5,4],[10,2,2,6,10]],[10,[7,10,8,2],[2,6,0,2],7,[9,1,7]],[[5,9],7,[0,4,2,2],0]],[[0,[10,5,4,5,6],[6],[9]],[[5,1,8,8],[9,2,5,4,0],[]]],[[],[[8,8,8,9],7,[3,6,8,3,1],[8],7]]] -[[[[3,7],[9],7],6],[[6,[6],[9,1,0,3],[8,5,3,6],4],[8,0,7,2]],[[4,[]],7],[],[9,6]] - -[[[[7],[],4,[1,0,3,9]],[[1,9,3,8,5],[1,4,6],0]],[[],0],[[6,[10,1,4,10],3,0,0],10]] -[[1,3,9,[10,[10,10,1,3,7]],6],[[[7,4],8,8]],[[8,[10],[7,0,0,9],[0,3],3],[0,5,[2],1],[[3,8,1],10]],[[[3,1,2],6,5,[0,9,7,1,7],10],[[6,6,8,2,2],[10]],[],9,3]] - -[[4,4]] -[[9,[0,8]],[[0,[],0],[0,7],10],[]] - -[[2,[3,[9,8,10,7,3],6,[],[4,0,5]],0,5,9],[],[0,2],[[[10,5,7,7,10]],3],[4]] -[[5,4,9,1],[[[8,0,2,8,0],10,4,8,[3,6]],[],[[4,0,6]]],[1,[0,[6],[5,2,2,2,8],4,2]],[[6,[2,8,10,0],7,9,10],[[5,0],[]]]] - -[[],[],[6,4,[[6],7,[6],[9,1]],[[3,6,7,1],4,[],[8],8]],[[[5,8,6,7,9],10,[7,10,10]],3]] -[[],[10,3,[2,[8,0,7],3,[6,3,2,6,7],9]],[1,[[1,10],[],[],6]],[],[[8,[6],9,[]],[[3,10,4,2,4],3,[4,4,4,10,10],4,[]],[4,4,[0,10,6,3],1],9,[6]]] - -[[[],8],[[5,10,[10,1,9],9]]] -[[9,[[0,8,2]],[9,9,2,[],[8,3,5,9]]]] - -[[[1,[8]]]] -[[],[4]] - -[[8,5,6,[3],3],[8,0,[]],[[[2,9,4,3]],[[10,2,3,9,0],[3,2,1],4],10],[[10,[5,5,1],[3],0],0,[3,8]],[[3,6]]] -[[2,[[6,3,7,10,7],[4]],[[6,0],[5],3],8],[6,7,[[4,0,7],5,[10,2,8,8],[10,6,9,8]],[3,[5,7,9,1]],6],[3,[[4,6,10],1,[]],[10,[3,10,6,9,6]],[8,10,9],[4,[5,10,9]]],[[7]]] - -[3,2,1,2,7] -[3,2,1,2] - -[[[3,[],[],3],5,1,6]] -[[[0,4,0,[7,8,0],10],[[2],8],[[9],2,1]],[[[],[1,3,5,10],5,[6]],[1],[9,10],[[4,3,8],[0,4,5,8],[4],7],4],[7,[[5,2],[1,4,8]],5,[2]],[[[10,7,8],[],[]],0,4,[2,[1,5,10],9,[4,1],7]]] - -[[[10,[],9],[[]],[0,7,5,0,[]],3,1]] -[[[[9,7,3,7,8]],6,3,[]],[[[],6,[8,9,6,0,7],[],[2,4]],2,[5,3,[2],[8,9,8],5],4],[],[]] - -[[5,[]],[[[9]],5,4],[8,6,[5,[0],6,7]],[[[8,3,5],[3],9],0,[4,[3,7]],9],[[7,0],[[9,7,8],[2,8,6],2,[],[9,3,1]]]] -[[1,3,[3,4,[1,7,3,6],5],[8]],[[9,0],[]],[4,4,[3,[2,2,5],[5]],[10],[[3]]],[],[[[],[5],2,6,7],[[2,2],[8,4]],8,8]] - -[[],[2],[[[0,6,4,1],0],7],[5,[[2,8]]]] -[[5,3,[]],[6,9,[5],1,0],[0,0],[2],[9,0,[],0,3]] - -[[],[],[[[4,4,2,3,1],[7,1],[5,2,2,4,0]],5,[3],10],[[10,[9,6,5,2,7],10,[],[1,8,1]],8],[[[9,2,10],[4,5,7,8,10],[5,9,4,4],[3,2,8,4,7]],1,6,9,[[0,4,9,10],[9,3,3,8,10],10,[],5]]] -[[[[7],[6],4,5],[4],[[9,1,2],5,10,[9,9]],[1,9]]] - -[[[2,[],[],[9,3]],[3,3,0,0],[[2,10,2,4,1],[9,4,2,7,9]]],[[[7],10],[9,5],6,5],[[4],4],[],[4]] -[[9,[9],4,9,[2]],[[[3,5,8,5],[],[6,3,1,9]]],[[],7,[],7]] - -[[[7],7],[],[4,[[],5,4,3,9],6,[[5,0,8],1],[3,[4,6,0,1,10],7]],[]] -[[[7]]] - -[[[],7,[[8,9],5,[6,1,7,7,4],0,2]],[[3,8],[[5,9,2,0],[6,0,8,8,4],9],10,6,[[5,10]]]] -[[[],[],2,5,[]],[0,[[8]],[4,3,10,[6,0]],[],10],[[1,1,9,3,[7,6,4,2,8]]],[10,[[8,2]],[],3,[9,[]]]] - -[[],[],[[[10,7],6,[5,3,6,5]],4,[6,9,10],5]] -[[[[9,4,7],2,7,3]],[[[4,6,10,6,5]],0],[5],[6,[],0,1],[4]] - -[[9,6],[[[9,6,6,2],6],5,4,7],[2,[],[]],[[],7,7,[[3],[0,3,8]],0],[[[0,0,9],5],[6,[2,1],[],7,9],[[6,4,4,4],5,9],0]] -[[[10],5,7,1],[7],[7,7,9,4]] - -[[7,1,[8,2,[4],[]]],[[[10,3,8,4,2],0,[6,10,0,3],[9,8],[4,4,6,3]],[[],5,3,2]],[[[5,5]],2],[]] -[[[[8,2,1,6,5],7,6,0,2],[7],[[3,3,6,3,3],[7,10,5],5,[3,0,2,8],2],[[],1,9,[7,3],[2,1]]],[],[[5],[10,5,0,[]],[5,[6],[],1]],[]] - -[[[[4,1,1]],[0,1,4],5,[[3,1,10],[7,4,8,8],[]]],[],[]] -[[[[6,4,1,5,1],[2],3,7],5],[[6,3,2],[]]] - -[[7,2],[],[9,[[0,0],2,7],[3]],[3,[[8],9,4],[10,[],[9,3,8]],[]],[[]]] -[[[]],[0],[]] - -[[[]],[3],[],[[[7,5,3,0],[7,1,8],0,[3]],[10,[6,7],[5,9,8,1,1],6],[2,0,[10,7,10]]]] -[[10,8,[4,[3,1,9,9],1,[1]]]] - -[[[[]],7,3,[]]] -[[5,[6,1,0,0],[[1,4]],3,[[5],0]],[1],[[[7,10,1,10,1],1,10],4,3,5],[[[1],8,[5,1,9,0,4]],[[],[9],[0,1,2],[8,5,8,0,1]]]] - -[[[[5],[],[0,3,8,10]],[3],[],[[8,3,1],7,0],[]],[[3,2,6],[],8,[[3,4,4,5],[],[7],[],8]],[[1,5,[1]],7]] -[[1,[[0,7,4,7,5]],[],2,4],[[9,0,[0,9,6,6,10],[0,7,7]],5]] - -[[[7,10,1,2],[3,[5,1,8,10],[0],0]],[5,[0,6],[[2,5,5,1,1],[5,1,5,5,2],8],[4,[]],[[4,4,8,6,6],[8,9,0],[2]]],[3,[9,[10],[4,2],[10,1,2,6]]],[[7,[5,3],[10],2],[[5,9,10],[8,2],0,[7]],5,6,2]] -[[7,[7,2,1,[6,5],[10,0,3]],[[3,10,0,3]],0,[9]],[[]],[],[2,[[3,5,6,0]],0,3,[9,[9,0,5,1],[1,3,5,5],6,[5,9,1,6,1]]],[8,[[2,2],[2,4,8,0],[2],3],[7,2,2],[2,1,10,[3,0,9,8,3],2]]] - -[[3,1],[5,7,[4,[],8,9]]] -[[[[],4,5,3,[5,5,0,7,4]],[[5],1,[],1]],[2,2]] - -[[10,[[4,2,7,9],1,[0,4,9,7]],3,[[8,5]],2]] -[[1,0]] - -[[[[7]],7,6,6,9]] -[[[1,0,[8,5,6],9],4,10,8,[4,9]],[9,[[7,1,6,1,6],9,[9,2],[],10]],[[[9],0],7,4,[[4,1,3],[8],2,[6,0,5,8,0],[2,4]],[2,3,[]]]] - -[[[[3],[10,10,9,6,2]]],[[5,[5,4,8,8],[8,9],[4,3,6]],[],4,9,[[],[7,10],[6,9,1,4,9],[],[5,2,2]]],[5,[],[2,9,3,[9],10],7,[5,[2,2,1,8]]],[7,9,2],[[3,8,[],[9,0,1,7],7],[7],[],5]] -[[[],[],0,[[],3,[],4],[8,[6,10,7],1,5]],[[[8],10],5,[10]],[]] - -[[1,7,[4,[6,3,0,3],[3],[]]],[[[8,7,6,7,0],[2],0,[7,7,6,3,0]]],[10],[4,7,[10,[6,9]],2,3]] -[[[8,4,[0,4,1,9],7,8]],[],[[]]] - -[[[[9,8,3,0],4,9],1,[5,6],2],[8,[5]],[[[8,8,4,10],[0,8,3,4,5],[10],7,2],1],[9,[3,[2,8]],[[],[1,8,6,6,0],10,[8,10,3],8],1]] -[[[]],[[[6,1,0],9,[3]],0,0],[9,3,1,[2],[1,[0,3]]],[1,[[3,2,5,2]],5,[[],10,[6,6,7],0,[]]]] - -[[1,10,4],[5,4,8],[[[5,7,1,2,4],4,[8,4,10,2,10],[0,7,4,9,6]],[[3,5,4,0],[2,5],10,[4,8,9,9,1]],[2,[3]]]] -[[1,[[3,1,3],6,[2,8,10,8,2]],[6,[1,5,2,1,3],[],[0,4],4],[[0,7,4],[2,1,5,5,4]]]] - -[[[3,4],3,0,1],[2,[[4,1,5],2,[1,2,4],5,9],9,5,[[],3,[3,9,10],[],[5]]],[[8,[1,4,1,10,10],4,[1,9,1]],7,9],[8,1,8,[4,6],[[6,10,7,1,5],[8,9,4,5],[],[]]],[8,10,1]] -[[8,6,[2,[10,2,7,1,0]],[6,[7]],9]] - -[[3,[[8,7,2,5,6],1,7,4,[0,4,10]],[8],[[2,7,5,5,1],[6],0,8,8]],[[[],[1,0,3,10],7,[0,2,8,8,0],4],[1],5,[[7],[3,6,5]]]] -[[[6,[10,9,3,4],[6,10],9]],[[[6,6,2,2,3],7,4,7,[]],7,3],[[6],0],[[6,0],[[10,1,0],5,7,[5,8,2,1],4],[],[7]]] - -[[],[[10,10,6,6,10]],[9,[[5,2,9,2],2,8,[]],1,[10,0,10,4],[[3],2,4]],[[1,[3,10,8,4,7],[1,7,2,2,4],[2,4,6,5,5]],1,[[2,8,1,8,4]],[2,[10,3,7],[0,1,0],[6,10,2,10],0],[[],[4,10,0,10],2]],[]] -[[[[1,0],10,[],[1,2,10],[8,2,4,1]],8,2,[5,3,[10,0],[9,7,7,10],[]]],[0,10],[[6,9],[[5,8],0,[5,3,8],0],1]] - -[[9,[4,8,4,7],8,9,7],[[],1,9],[2,9],[],[[9]]] -[[[[10,7,5,0,2],8,[8,2],10],10,[6,0,[],8]],[]] - -[[[],0,3,8,[0,[7,2,6,7,8],2]],[2,2,5,[7,5],[]]] -[[[0,3]],[7],[4],[6,1,[9,[8,5,7,1]]],[[],[[1,8,3,0],[10,10,5,3],3,[3,7],[10,4,3]],8,[6]]] - -[[[3,5,[0,2],10],1,[[],6,[0,7],8],[10]],[[7,8,[6,6,6]],[0,[8,1],[],9],4],[[[7,9]],1,6,3],[[8,5,[10]],0,[[0],7,[6]],7]] -[[1,[[9,3,3]]]] - -[[],[],[[[7]],8,1,4],[[[6,0],4],1,2,[6],[[9,4,6,10,10],8,6,[6,4,4,3],4]]] -[[],[],[[[],[10,1,7],8,[]],4],[8,[[0,6],[]],1,[[0,10]]],[4,3,[],6]] - -[[[[5,0,7,8],[8,5,7],[1],5,[1,6,9,0,2]],10,3,1],[[],[5],5,5],[[],5,[[],3,[10,9],4],[[10]],[]]] -[[[[2,2,0,10,10],2,5,10,0],[],[[4,5,1,10],1,8,7,[1,6,10,8]]]] - -[[[7,[6,0,6],2],4,[[1,10,3],[3,5],[2,8,5,4,3],5,3],[],0],[2,3,6,4],[4,8,9,[0,8,[0,9,0,1]],[7]],[7,6,[8,[],3],[[5,6,0,6],[],[6,10,2,1]]],[8,5,10,7,8]] -[[2,[[9],[3],[10,5],8],9,3,[9,[7,6,7],[0,10,7]]],[[[3,0,9,0],[0,8],9,10],4,[[],8,[5,9,1,10,3],9,[8,5]]]] - -[[0],[[]],[[7,2,6],[[],[0,7,8,2,1]],[9,9],[[6,1,4,8],10,6],10],[8,2,[],4],[]] -[[[[1,10,10,8],[9,1],[]],[2,[7,10,2],[0,8,9,8,6],[],3],[[]]],[[],[1,0,[],[2,7,7,6,8]],[[0,0,4],[0,2],4]],[[[4],[1,9,6,9,3],1],[[5],2,5],1],[6],[[[],0],10,7]] - -[[[],[4,[],1],9,8],[[[10,3]]],[0],[7,[5,[4,10,1,5],4,[0]]]] -[[9,[],8,[]],[8,[],[4,2,[6],[],1],[6,[5,10]],0],[8,10,[[4,2],[10,7,9,3],6,[10,7,3,10,3]],[6,7,[6,3,2,6],[4,3,8,0,7],7]],[[],0,[7,[4,8,1,6],10,4],2,[10]]] - -[[],[[[0,2,6,5,9],4,[6,2]],[5,5,[4,6]],9],[3],[10,[[],[10,7,7,10],[5,0],4,[3,3,2]],0,9]] -[[[6,[],10,[4,4,1]],0,7,[4,[6,2,4],[8,8]],1],[[5,[],1],[[1,6,5],[7,5,6,2,3],5],7]] - -[[[9,[8,1,8,7,9]],9,3]] -[[],[[4,[9,10,2]],[4],10]] - -[[[],10,[]],[6,9],[7,2]] -[[],[[[5,5,1],7,10,8,2]],[],[1,[7,1,10,2,7],[[8,3,2,6,2],5],[[]],[5,0,7]],[[],[7,1,4,7],3,9]] - -[[[],0,7,[9,5,[9,9,5,10],5,4]],[[],[[9,4,3,2],8,6,[8],0]],[9]] -[[1,10,[],6,5],[8,2,0,3],[],[4,[2,6,[],[0,5]],[0],9]] - -[[],[[[5],[],[6,1],[4],[8,7]],[[6,2,7,1,8]]],[10,[0,[7,5,3,4],[],5,[6,3]]],[]] -[[1,4,[[6,4,0,1,9]],[1,[],6,[2,5,6,10],[0]]],[[],3,[],[],[[8,10,5],10]],[[1]]] - -[[6,[4,6],8,[9],[2,8,2,[5,6,10,8]]],[2,6,5,[8,10]],[]] -[[],[1,[],2,0],[7,9,[[0],[10,9],[3],0],4,[[3,7,2,8],[],[6,5,10],[2,3,4,4],7]],[4,2,[[2,6,10,7],8,6,9,3],1]] - -[[[7],9,[[2,1,9,10],4]],[],[[]],[[10,[2,2,8,5],0],[[4,10,2,10,7],0,[0,0,7],[3,3],[9,1]]],[1,[4,[8,4],[]]]] -[[1,[],10,2,0]] - -[[[4,10,[8,1],10],[[],[10,8],[6,7,2],6,3],3,[[],7,5]],[[[5,6],0,6,9,5],[[9,6,9],4,[8,2],0,7]]] -[[],[6,7],[8,[10,[0,6,4,0,9],[],[]],6,[[2,1,2,6],[10,10,7,3,4],6,[],[8]]]] - -[[[[5,3,7,3],7,[3],4,[5]],10,9,[1,2,6]],[9],[[2,10,[9,2],[10,1,7]],[9,0,[4,3,6,0,4],2,[4,4,9]]]] -[[[[],[3,4]],[]]] - -[[[[6,1,9],6,3],0,10,9,5],[]] -[[[[0,7,6,5],8,[],[2,6,6,1,10],[10,9]],5,5,4],[4,[[8],[7]],8,10],[]] - -[[1,3,2],[]] -[[[[10,3],9,[10,1]],[4,4,[0,1,6,1,4]]]] - -[[[],[3],[[7],5,7],[[4,2],6,[]]],[[[1,3,3,6],[1]]],[1,0,6,[[10,5,0,7]]],[]] -[[8,0],[3,3,[[9,10,6],[0,2,8],5],[4,9,[],1],[10,[8],8]],[4,5]] - -[[3,[[9,5,7,7],1,10,5],[[8,10,2,5,5],5,[2,7,6],[8,2,3,10]],[[],[10],2]],[8,1]] -[[[[9,5,8],[7]]],[7,[10,6,[1,9,3]],[[0,8,7,1],7,[0,6,8,1,8]],4],[[2,7],[[8,7,10]]]] - -[[[],[],[[4]],[[9,9,0,8]],4],[[[8,0,10,10,9],2,5],[[8,3,4,1,3],[9,7],2,3],[[7,4,1],[7,5,9]]],[],[10,6],[]] -[[2],[[8],[]],[]] - -[[2,[2,4]],[]] -[[[8,[1,0]],2,7],[3,[7,[6,8,10,8],3,[3,7,6,4],[5,4,6]],[5]],[1,[]],[],[[0,[1,3,6,8,8]],2,[[5,2,2,0],[9,5],0],[],[4]]]