diff options
Diffstat (limited to '')
-rw-r--r-- | inf/aoc/1.c | 45 | ||||
-rw-r--r-- | inf/aoc/1.txt | 2252 |
2 files changed, 2297 insertions, 0 deletions
diff --git a/inf/aoc/1.c b/inf/aoc/1.c new file mode 100644 index 0000000..2bb65b9 --- /dev/null +++ b/inf/aoc/1.c @@ -0,0 +1,45 @@ +#include <stdio.h> +#include <stdlib.h> +int main (void) { + char b[64]; + unsigned m = 0; + unsigned n = 0; + unsigned o = 0; + unsigned s = 0; + unsigned t; + while (!ferror(stdin) && !feof(stdin)) { + if (m < o) { + t = o; + o = m; + m = t; + } + if (n < o) { + t = o; + o = n; + n = t; + } + fgets(b, 64, stdin); + if (b[0] == '\n') { + if (s > m) { + o = n; + n = m; + m = s; + goto c; + } + if (s > n) { + o = n; + n = s; + goto c; + } + if (s > o) { + o = s; + goto c; + } + c: + s = 0; + } else { + s += atoi(b); + } + } + printf("%u %u %u sum %u\n", m, n, o, m+n+o); +} diff --git a/inf/aoc/1.txt b/inf/aoc/1.txt new file mode 100644 index 0000000..bf3b409 --- /dev/null +++ b/inf/aoc/1.txt @@ -0,0 +1,2252 @@ +7569 +1357 +10134 +4696 +4423 +8869 +3562 +6597 + +4038 +9038 +1352 +8005 +4811 +6281 +3961 +4023 + +7234 +3510 +7728 +1569 +4583 +7495 +3941 +6015 +6531 +2637 + +18211 +19347 +16113 +7314 + +3359 +7199 +4527 +5384 +1752 +2422 +6301 +1923 +5957 +3000 +6835 +1986 + +9837 +5600 +11944 +9188 +2356 +7054 +7549 + +19258 +32524 + +15237 +10665 +11603 +3047 +6430 + +3218 +3421 +5897 +4950 +6920 +3118 +5140 +2364 +4650 +3216 +5223 +2402 +6073 + +16733 +10846 +10699 +5704 + +16364 +7679 +5249 + +69625 + +2432 +3304 +1846 +11421 +9850 +7406 + +11788 +10569 +9105 +13946 +5825 +5780 + +5701 +3011 +4082 +3895 +9127 +8124 +7818 +1398 +5443 + +9172 +11176 +4400 +4126 +3226 +6516 + +4784 +3620 +1087 +2533 +6306 +6601 +2539 +2634 +8533 + +1765 +4859 +7129 +5595 +2936 +3340 +7565 +7752 +3834 +5943 +6931 + +3516 +1217 +5776 +2286 +2197 +3014 +4302 +2294 +5915 +1744 +1007 +2695 + +5728 +8002 +4340 +1468 +2743 +8017 +6742 +5924 +1490 +4792 + +32995 +20012 + +57974 + +12603 +10225 +6899 +9986 +1811 + +3991 +3427 +1641 +1997 +4577 +5141 +6317 +3869 +2086 +2394 +5451 +4061 +3912 +3968 + +13322 +7684 +17919 +14291 + +8875 +11474 +10009 +2836 +2999 +13462 + +3708 +7178 +2303 +6047 +3002 +4253 +2620 +6321 +6538 +1672 +5623 +4445 + +7594 +9506 +11613 +4382 +11164 +11772 + +4143 +4863 +6876 +5387 +3223 +4621 +5344 +6356 +6151 +2687 +5774 +3570 +5506 + +14826 +18705 +22216 + +2109 +10543 +9216 +2103 +4909 +11592 +11574 + +7076 +7210 +13392 +9010 +11206 +2430 + +5524 +5266 +3474 +5772 +4389 +2866 +5281 +3445 +5062 +5624 +1289 +5082 +4932 +3702 +4462 + +8903 +15889 +12929 +15606 +12521 + +3958 +2105 +6631 +5906 +5366 +5698 +6452 +7522 +5595 +7892 +2611 + +11540 +15585 +10410 +11433 +15924 + +13538 +7274 +25109 + +2027 +8353 +4550 +3143 +5959 +1361 +8119 +4990 +6639 +5914 + +4288 +3407 +4919 +5857 +1737 +1100 +2123 +4001 +6954 +3470 +4972 + +63284 + +22745 +25713 +6948 + +2671 +5918 +2996 +5049 +5552 +2862 +4148 +2699 +1267 +3203 +4101 +1669 +3841 +1645 + +12339 +13808 +5765 +9380 +5878 +11724 + +6944 +2942 +4488 +3205 +3266 +4343 +5902 +2415 +6376 +3563 +4262 +4253 + +24318 +8839 + +13143 +3079 +8421 +16182 +4310 + +3940 +1588 +4554 +7978 +3061 +5421 +1413 +3283 +3457 +2084 +4425 + +6041 +16098 +8298 + +6346 +3091 +4566 +2749 +2025 +4206 +4649 +1535 +5881 +6502 +2848 +2816 +3764 +2020 + +7370 +4174 +6795 +1962 +7711 +4206 +6495 +5526 +4480 +2180 + +12796 +3793 +13517 +12324 +1675 +12092 + +3519 +2768 +4696 +4921 +5713 +10465 +10032 +6721 + +8037 +6647 +6670 +3163 +6700 +2015 +4590 +2144 +2485 +3831 +3996 + +7363 +2114 +3645 +4102 +6663 +3757 +3043 +1488 +1566 +3300 + +20413 +24591 +24088 + +7261 +16967 +3491 + +14354 +11988 +5752 +1080 + +4160 +5598 +5430 +1042 +6909 +7422 +5222 +4580 +7077 +6009 +4473 +3132 + +38094 + +3052 +1814 +5217 +2138 +6224 +2081 +6237 +3829 +6332 +6364 +1612 +3923 +4533 +2415 + +1732 +1869 +5762 +4834 +3595 +3105 +4997 +3525 +6270 +5260 +4952 +5466 +3703 +3859 + +3781 +4919 +5489 +4348 +2027 +1542 +2328 +4875 +4317 +2274 +5421 +1528 +3963 +4940 + +1085 +1745 +5093 +7798 +3642 +7681 +5792 +3291 +7482 +5889 +5784 + +10489 +6344 +10829 +7847 +10808 +11986 +1223 + +15486 +12689 +6161 +13613 +15818 + +2208 +3272 +6446 +4202 +5845 +4708 +6976 +7997 +2047 + +2882 +7606 +6394 +4353 +6458 +4477 +6710 +8184 +1986 +3996 + +4096 +5903 +5149 +2970 +5896 +3044 +3801 +2703 +2063 +3652 +6083 +1325 +1921 + +7255 +6622 +4108 +3272 +8626 +6466 +5211 + +3189 +18089 +3687 +14113 + +3376 +1179 +6295 +4694 +5730 +4580 +4831 +4738 +6097 +2199 +5472 +5424 +2997 + +3656 +5742 +4953 +6405 +7948 +3400 +2571 +1898 +3720 +1919 +7725 + +8235 +7985 +6168 +2276 +1521 +8539 +2794 +6916 +3589 +7893 + +5274 +2480 +1861 +2970 +7096 +5896 +5236 +6596 +4901 +3928 +4092 +2193 + +5578 +6132 +1902 +4091 +7470 +2037 +3949 +6953 +5154 +6307 +4244 + +1454 +3537 +6539 +8978 +1877 +1454 +3516 +2550 +6548 + +8176 +10883 +1159 +5666 +10115 + +1909 +2160 +4754 +1500 +6248 +6766 +3776 +1757 +7563 +6897 +5468 + +5776 +1295 +14577 + +1467 +1628 +4841 +2712 +5274 +5645 +5030 +2980 +2148 +2494 +1391 +3978 +4273 + +5892 +5325 +6605 +4615 +5939 +1734 +4169 +2864 +6916 +3003 +5691 +6886 + +3207 +1313 +6940 +5545 +1307 +2515 +5310 +2719 +5037 +2852 +4270 +5482 +2629 + +3113 +3184 +3103 +3874 +2053 +4348 +2034 +5610 +5564 +1245 +2760 +4184 +4388 +4924 +5294 + +30280 +20633 + +7281 +4704 +7154 +4633 +4685 +6490 +2221 +4097 +2155 +5782 +2259 +2187 + +3375 + +2564 +2306 +7714 +1233 +6833 +1254 + +3714 +2329 +1168 +6477 +5418 +4491 +7480 +6478 +6092 +3240 +5209 + +4555 +7903 +4052 +6201 +7707 +2317 +6661 +2402 +2158 + +3752 +6799 +1474 +9554 +3071 +2588 +7440 +5000 +8195 + +3945 +8862 +9254 +1049 +6590 +9350 +9632 +6202 +2607 + +5825 +8152 +1095 +1176 +5725 +8096 +7452 +2804 + +4902 +4036 +4145 +2369 +4783 +5874 +6162 +2016 +5293 +3958 +7302 +1201 + +3421 +3339 +4445 +9464 +4824 +9299 +7335 + +6879 +12322 +7258 +2357 +6743 + +6630 +4201 +5648 +7472 +3316 +6413 +3651 +5112 +3704 +4059 +6615 +2342 + +7681 +4263 +1806 +2522 +6200 +1800 +1684 +4629 +5588 +7604 +5150 + +32417 + +11824 +4356 +6128 +13448 + +8280 +9281 +3856 +4534 +8755 +8085 +9197 + +6955 +7042 +6791 +2400 +6051 +5380 +4118 +4139 +5099 +1114 +3525 +3402 + +13183 +9082 +12948 +13297 +7114 +9971 + +63036 + +9084 +9962 +14352 +12961 + +3679 +5437 +2514 +2561 +6014 +2091 +2512 +2685 +2395 +3386 +3456 +5414 +1796 +3727 + +1846 +6054 +9570 +10656 +6468 +12149 + +4785 +7420 +8022 +6261 +5671 +2126 +6538 +6793 +4723 +5504 +2839 + +1152 +3372 +10954 +6464 +2765 + +3398 +4853 +5512 +2553 +8012 +2860 +4092 +5288 +4618 +4616 +3996 + +1918 +1632 +3795 +3530 +5571 +6305 +5669 +5444 +4991 +2367 +4511 +3484 +3936 +5420 + +10711 + +7735 +4055 +8903 +10180 +3356 +5725 +5101 + +31657 + +12997 +15132 +13791 +15184 + +13021 +2125 +7652 +4939 +14287 + +4244 +8543 +3071 +8029 +6778 +2814 +5218 +6955 +5265 +7921 + +46784 + +3526 +3133 +10593 +4638 +9539 +1227 +4904 +5965 + +7848 + +3178 +1014 +3628 +7149 +1430 +1663 +2236 +4653 +5188 +2240 + +6429 +5092 +2605 +1027 +1822 +7407 +2638 +4967 +4244 +3371 +4413 +4861 + +2470 +9469 +2051 +7278 +9351 +10480 +2860 +4206 + +9007 +3043 +1424 +9081 +2827 +2652 +5879 +6789 +7120 + +37743 + +6312 +5845 +3742 +5544 +3759 +3562 +7319 +2738 +2626 +1534 +2820 +6553 + +9864 +2966 +6757 +5962 +7093 +1905 + +4948 +9976 +7084 +8037 +7204 +11131 + +9115 + +5691 +3512 +4281 +5631 +2820 +3271 +6239 +2636 +7654 +7050 +3363 + +7004 +4165 +3989 +6436 +2973 +2194 +4570 +2609 +5751 +6194 +7048 +6261 + +5831 +1130 +7172 +12886 +8062 +13840 + +1823 +9111 +6212 +4168 +7883 +10579 +8924 +2743 + +7852 +5075 +5924 +7389 +3248 +9369 +1453 +9882 + +21170 +15061 + +10447 +5517 +10469 +13881 +13602 + +2267 +6183 +1055 +6806 +4409 +5327 +1873 +2598 +3547 +6547 +5317 +5075 +5351 + +2380 +3511 +8386 +7944 +8501 +1220 +6635 +9384 +6583 + +1650 +3461 +5357 +2618 +6668 +6831 +2428 +1581 +6028 +1982 +6315 +3992 +4223 + +4231 +7521 +7927 +7876 +5052 +5488 +3247 +2191 +1723 +5970 + +5328 +3471 +5900 +1596 +1013 +3057 +2245 +2850 +3026 +4661 +6302 +5058 +6246 + +1090 +18730 +17742 +16057 + +5408 +4499 +2145 +2659 +6971 +7444 +6004 +1196 +3617 +4493 +1812 +3386 + +1379 +7387 +14347 +12050 +1633 + +1614 +7776 +11559 +10026 +7185 + +10478 +1228 +9847 +12113 +12639 + +2392 +7476 +3785 +6363 +5557 +2393 +1509 +8462 +7233 +6604 + +1525 +9057 +3723 +12048 +8403 +1434 +7829 + +11321 +1931 +11036 +5443 +7082 +7616 +10227 + +5535 +4730 +6475 +4748 +2431 +3575 +3469 +6250 +3313 +5085 +3851 +1218 +3918 +1990 + +30221 +23041 + +2861 +5908 +4268 +1877 +1016 +4468 +4593 +1281 +3582 +1108 +2850 + +3786 +3112 +2359 +4122 +6426 +6756 +2602 +3666 +2640 +3074 +3129 +4290 +6741 + +11824 +6880 +9944 +1970 +3533 + +3108 +5050 + +1122 +3124 +6005 +3098 +4970 +4113 +4703 +5529 +3149 +6373 +5106 +3294 + +11319 +25294 +15963 + +1807 +5908 +6709 +5818 +4504 +10170 +6378 + +5606 +13402 +10945 +6909 +11245 +12279 + +1666 +6313 +7546 +5273 +4450 +4582 +6319 +7687 +2229 +7612 +2849 + +5483 +4903 +4321 +3371 +1117 +6806 +6352 +2281 +2598 +6433 +6849 +4444 +4318 + +7274 +1350 +6505 +6123 +1327 +3259 +2046 +4395 +2081 +3429 +6128 + +10392 +3224 +8237 +1788 +5544 +11058 + +13668 +12456 +4385 +13156 +13073 +10019 + +8544 +1540 +1472 +5529 +4076 +1141 +6039 +5256 +5524 +5986 + +3721 +5171 +4997 +5498 +6807 +1778 +5120 +2830 +2733 + +1629 +6387 +4685 +1162 +6393 +1118 +1628 +6786 +5507 +5745 +1914 +2043 +4954 + +11968 +5263 +6691 +11191 +10725 +2462 +7162 + +1911 +5528 +8016 +5798 +2448 +7299 +3742 +2756 +1710 +5342 + +1612 +5217 +2630 +4768 +5942 +2414 +6278 +2422 +3603 +5110 +4823 +3115 +3616 +3872 + +20562 + +21492 + +6167 +22813 +6117 + +1746 +1883 +5639 +2251 +4456 +1289 +2850 +5350 +6211 +1971 +1628 +4259 +5732 +1522 + +2427 +19825 +15898 +9510 + +10822 + +5729 +8357 +1089 +6622 +3631 + +9226 +4811 +4979 +4748 +4686 +10536 +8734 +10183 + +6483 +1553 +6871 +2817 +1964 +4610 +4267 +3258 +6700 +4836 +6902 +1354 +4994 + +5293 +1858 +1504 +2783 +6933 +6112 +3433 +5478 +4998 +5578 +4112 +4924 +5567 + +6550 +5932 +6154 +1424 +6667 +7476 +1573 +5597 +3271 +3732 +6926 +5812 + +9452 +4356 +6277 +3167 +3323 +6475 +2026 +8759 +6115 + +14299 + +63447 + +2635 +5931 +6323 +8330 +3177 +7588 +4316 +3837 +7060 +3915 + +48633 + +4750 +2846 +4007 +5026 +6205 +2760 +3031 +2748 +5059 +4779 +2110 +2238 +5475 + +5832 +3148 +3556 +1924 +5265 +5802 +3515 +1606 +1437 +1210 +2961 +2408 +2580 +5539 +1380 + +66449 + +2996 +3761 +4582 +5321 +1600 +5507 +1384 +3288 +2201 +3423 +4042 +1109 +5464 +3278 +5813 + +8499 +6999 +5484 +2524 +6885 +5701 +5513 +4086 +7943 +4973 + +1159 +7531 +1852 +15286 + +4539 +8693 +1014 +1828 +8482 +8082 +5404 +3261 +8635 +6019 + +3048 +6786 +5651 +1378 +2938 +3365 +5968 +3120 +3338 +6905 +2580 +6653 +3288 + +11131 +7146 +18154 + +3907 +4060 +5426 +3596 +5290 +1701 +5058 +5641 +5510 +3599 +4874 +4125 +4174 +4347 +1031 + +16519 + +2653 +3214 +8189 +6240 +2010 +9114 +2936 +5757 + +27107 + +4099 +1252 +4620 +5294 +6455 +1170 +5050 +4196 +2488 +4760 +7425 + +4275 +9064 +19197 +2605 + +4278 +8197 +3238 +3410 +5384 +2670 +5818 +4744 +7541 +6172 + +13214 +2791 +8165 +8198 +9405 +4916 + +15390 +7196 + +8611 +7289 +4196 +1729 +6994 +6587 +5544 +1110 +5397 +2882 + +2351 +4784 +3193 +6033 +2193 +1767 +5487 +3421 +1503 +3221 +2610 +5334 +3596 +5869 +2536 + +21247 +12819 +5427 + +10652 +4957 +2236 +9504 +9850 +11495 +8799 + +1295 +1117 +4578 +2757 +8310 +7539 +1563 +7445 +9248 + +1154 +7145 +2494 +1170 +5617 +7106 +1500 +7359 +7355 +7312 +6374 +6591 + +8635 +4722 +2581 +1321 +4876 +8887 +2091 +5882 +3667 + +2555 +2895 +5862 +4002 +1331 +2902 +4189 +5844 +4167 +3075 +3559 +3807 +4633 +2562 +2182 + +7326 +7752 +9975 +9509 +10360 +9290 +4799 +7985 + +2025 +3129 +10778 +4050 +15824 + +8875 +12920 +13121 +8778 +4115 +2725 + +2640 +7696 +9232 +4533 +3279 +3792 +3060 + +1928 +1954 +7144 +4484 +2340 +7079 +4401 +2149 +4172 +2331 +7733 + +10089 +1850 +10613 +10002 +7258 +10227 +1377 +4110 + +1993 +5191 +1557 +6222 +5479 +4984 +6453 +5099 +4422 +4870 +6401 +2377 +1590 +2023 + +11578 +12357 +5959 +6164 +2562 + +6504 +3906 +2703 +5974 +3143 +1620 +4910 +2133 +3240 +5300 +2309 +3464 +1256 + +10982 +7910 +7625 +11675 +10215 +1163 +9569 + +2915 +3767 +3745 +3972 +1852 +7935 +7429 +5175 +6558 +1430 +1602 + +3817 +3327 +1928 +4831 +3908 +2935 +1922 +4557 +2762 +4731 +4974 +3861 +2073 +3692 +4205 + +7336 +2964 +15357 +13398 +7906 + +3525 +4721 +4014 +3612 +2369 +2023 +2847 +4074 +1129 +2179 +3614 +4281 +3818 +5191 +5381 + +61042 + +3819 +4305 +6299 +2583 +1370 +1380 +3654 +2856 +2461 +1332 +1901 +2910 + +6827 +13660 +16816 +2018 + +3748 +7348 +8889 +8319 +2671 +7852 +5415 +3932 +8902 + +3614 +4741 +5864 +5082 +4251 +5216 +6408 +6951 +1828 +1279 +5092 +5998 +1599 + +2630 +3617 +4473 +5203 +4772 +7763 +3033 +7055 +7533 +3649 + +2201 +1324 +5999 +5250 +3899 +4327 +7485 +5573 +5759 +6442 +2955 + +4682 +4459 +6026 +6998 +1943 +4534 +4555 +5575 +5046 +7549 + +18939 +6157 +4911 + +3975 +4193 +4442 +4336 +1650 +4874 +4756 +6106 +2389 +2783 +3412 +3343 +3794 +1072 +3170 + +9191 +9214 +7209 +6637 +9086 +9123 +8213 +9269 +4298 + +6182 +7624 +3395 +5847 +1575 +6110 +2981 +5999 +5480 +5971 +3642 + +11213 +13891 +3627 +7688 +11077 +2119 + +20695 +17278 +14874 + +6613 +1752 +7179 +7575 +5803 +2655 +5733 +1441 +6247 +3254 + +3667 +1157 +3324 +1195 +5982 +3444 +5185 +4061 +4297 +4364 +3399 + +8517 +6424 +4847 +3985 +13460 +2559 + +4043 +2124 +3622 +5129 +4750 +3882 +6512 +2024 +2053 +4534 +5507 +3312 +5172 + +9086 +7581 +2686 +12674 +6833 +4967 + +2401 +12176 +6352 +4439 +8153 + +8222 +9993 +4988 +10170 +9853 +7487 +10533 +1892 + +2527 +4255 +4377 +4312 +2549 +2005 +4011 +4803 +5879 +6038 +2382 +3758 +1079 +1875 +2549 + +3962 +4758 +5211 +5023 +11911 +8809 +1896 + +6166 +12840 +7486 +9772 + +3481 +4655 +6998 +2009 +8754 +7585 +8723 +7766 +9118 + +3997 +6810 +6988 +9613 +7982 +8594 +1229 +7588 +3507 |