diff options
author | jacopograndi <jacopo.grandi@outlook.it> | 2022-01-06 18:44:53 +0100 |
---|---|---|
committer | jacopograndi <jacopo.grandi@outlook.it> | 2022-01-06 18:44:53 +0100 |
commit | 6f96b2014b053a2e6e5a37464ca6fc578607fda7 (patch) | |
tree | cdb4686352eeadb2225b984ab56819c7de285af4 | |
parent | 9f7b0cd76272068588d0a7220408f91390c5b583 (diff) |
rm
39 files changed, 0 insertions, 5973 deletions
diff --git a/day01/day01 b/day01/day01 Binary files differdeleted file mode 100755 index 8fb500a..0000000 --- a/day01/day01 +++ /dev/null diff --git a/day01/day01.cpp b/day01/day01.cpp deleted file mode 100644 index 113f86d..0000000 --- a/day01/day01.cpp +++ /dev/null @@ -1,52 +0,0 @@ -#include <iostream> -#include <string> -#include <vector> -#include <algorithm> - -std::string read (char* name) { - FILE *f = fopen(name, "r"); - char c = fgetc(f); std::string txt; - while (c != EOF) { txt += c; c = fgetc(f); } - fclose(f); - return txt; -} - -std::vector<std::string> split (std::vector<std::string> vec, std::string name) { - auto token = name.find("\n"); - if (token != std::string::npos) { - vec.push_back(name.substr(0, token)); - return split(vec, name.substr(token+1)); - } else if (name.size() > 1) { - vec.push_back(name); - } - return vec; -} - -int main (int argc, char* argv[]) { - if (argc < 2 && argc > 3) return 1; - std::string txt = read(argv[1]); - - std::vector<std::string> vec; - vec = split(vec, txt); - std::vector<int> depths; - for (auto v : vec) { - depths.push_back(std::stoi(v)); - } - - int window = 1; - if (argc == 3) { window = atoi(argv[2]); } - - int inc = 0; - for (std::size_t i=0; i<depths.size(); i++) { - if (i >= window) { - int sum0 = 0, sum1 = 0; - for (int j=0; j<window; j++) sum0 += depths[i-j-1]; - for (int j=0; j<window; j++) sum1 += depths[i-j]; - if (sum1 > sum0) inc ++; - } - } - - std::cout << "The number of depth increases is " << inc << std::endl; - - return 0; -} diff --git a/day01/day01_input.txt b/day01/day01_input.txt deleted file mode 100644 index b3ee114..0000000 --- a/day01/day01_input.txt +++ /dev/null @@ -1,2000 +0,0 @@ -198 -208 -209 -212 -213 -217 -218 -223 -222 -224 -216 -233 -238 -239 -240 -250 -263 -264 -267 -274 -288 -316 -319 -330 -340 -347 -349 -354 -350 -349 -351 -352 -353 -371 -383 -385 -405 -413 -455 -451 -459 -458 -459 -461 -463 -475 -480 -486 -489 -497 -502 -512 -513 -516 -517 -528 -559 -560 -558 -565 -566 -567 -571 -573 -574 -582 -583 -585 -589 -597 -608 -607 -614 -619 -608 -624 -665 -666 -675 -695 -698 -703 -711 -733 -738 -739 -742 -743 -763 -775 -778 -804 -806 -810 -812 -818 -819 -828 -867 -866 -876 -878 -881 -875 -881 -858 -859 -868 -869 -860 -888 -890 -891 -893 -894 -919 -924 -925 -933 -937 -950 -955 -966 -984 -989 -993 -996 -997 -1015 -1031 -1035 -1039 -1055 -1057 -1058 -1059 -1060 -1061 -1067 -1069 -1070 -1059 -1060 -1077 -1079 -1078 -1080 -1087 -1088 -1090 -1097 -1082 -1102 -1105 -1106 -1120 -1125 -1130 -1132 -1154 -1141 -1135 -1131 -1133 -1134 -1137 -1138 -1141 -1142 -1143 -1166 -1175 -1193 -1201 -1236 -1238 -1234 -1240 -1242 -1243 -1271 -1276 -1277 -1272 -1286 -1288 -1290 -1292 -1317 -1341 -1361 -1363 -1375 -1376 -1377 -1383 -1387 -1390 -1402 -1404 -1412 -1418 -1426 -1429 -1466 -1480 -1483 -1478 -1484 -1486 -1488 -1491 -1486 -1489 -1492 -1517 -1520 -1523 -1539 -1546 -1551 -1521 -1517 -1518 -1522 -1525 -1526 -1539 -1540 -1544 -1545 -1561 -1571 -1572 -1574 -1575 -1568 -1573 -1587 -1588 -1600 -1603 -1627 -1629 -1633 -1645 -1670 -1671 -1685 -1690 -1696 -1698 -1703 -1698 -1699 -1702 -1714 -1716 -1709 -1738 -1753 -1761 -1766 -1769 -1772 -1761 -1763 -1774 -1781 -1782 -1799 -1802 -1816 -1818 -1819 -1805 -1810 -1817 -1819 -1831 -1834 -1835 -1852 -1855 -1858 -1859 -1856 -1857 -1868 -1885 -1891 -1893 -1890 -1891 -1892 -1893 -1896 -1911 -1912 -1914 -1916 -1914 -1918 -1930 -1932 -1958 -1966 -1976 -1982 -1985 -1986 -1987 -1992 -1997 -2031 -2041 -2042 -2044 -2058 -2060 -2075 -2073 -2084 -2087 -2090 -2125 -2128 -2129 -2130 -2131 -2136 -2137 -2145 -2150 -2152 -2155 -2161 -2162 -2165 -2167 -2189 -2197 -2199 -2214 -2226 -2233 -2234 -2241 -2242 -2256 -2259 -2263 -2257 -2267 -2270 -2269 -2272 -2273 -2275 -2279 -2284 -2285 -2266 -2271 -2287 -2291 -2310 -2313 -2314 -2317 -2311 -2312 -2311 -2312 -2326 -2331 -2332 -2338 -2340 -2352 -2355 -2360 -2361 -2357 -2371 -2384 -2380 -2392 -2393 -2396 -2397 -2400 -2417 -2420 -2421 -2422 -2444 -2457 -2458 -2464 -2467 -2494 -2495 -2498 -2510 -2514 -2521 -2526 -2525 -2533 -2536 -2547 -2544 -2547 -2556 -2557 -2558 -2561 -2570 -2571 -2573 -2575 -2583 -2584 -2585 -2572 -2574 -2575 -2587 -2589 -2590 -2602 -2603 -2604 -2605 -2589 -2603 -2608 -2611 -2616 -2613 -2617 -2618 -2619 -2628 -2629 -2630 -2631 -2639 -2645 -2649 -2657 -2665 -2673 -2680 -2679 -2680 -2702 -2703 -2709 -2711 -2714 -2715 -2716 -2715 -2721 -2720 -2739 -2745 -2748 -2752 -2749 -2748 -2749 -2751 -2752 -2750 -2760 -2777 -2778 -2779 -2780 -2787 -2800 -2805 -2810 -2812 -2820 -2821 -2843 -2846 -2853 -2862 -2861 -2867 -2880 -2890 -2891 -2892 -2885 -2887 -2890 -2894 -2897 -2925 -2926 -2931 -2933 -2940 -2943 -2941 -2959 -2971 -2982 -2984 -3002 -3006 -3008 -3012 -3013 -3034 -3043 -3059 -3063 -3064 -3060 -3075 -3090 -3091 -3104 -3108 -3114 -3117 -3106 -3104 -3110 -3113 -3114 -3126 -3119 -3138 -3140 -3141 -3143 -3139 -3145 -3147 -3153 -3161 -3170 -3168 -3180 -3181 -3177 -3196 -3210 -3216 -3232 -3233 -3234 -3235 -3239 -3240 -3242 -3243 -3244 -3243 -3248 -3249 -3275 -3276 -3278 -3280 -3286 -3291 -3293 -3294 -3301 -3310 -3319 -3326 -3338 -3339 -3348 -3366 -3376 -3371 -3372 -3404 -3407 -3408 -3425 -3444 -3451 -3457 -3452 -3459 -3468 -3491 -3475 -3476 -3481 -3505 -3516 -3519 -3542 -3543 -3541 -3542 -3541 -3551 -3553 -3552 -3533 -3542 -3543 -3561 -3562 -3563 -3566 -3571 -3572 -3596 -3600 -3603 -3607 -3608 -3609 -3613 -3654 -3665 -3672 -3661 -3662 -3663 -3670 -3676 -3683 -3707 -3709 -3714 -3717 -3709 -3710 -3713 -3714 -3715 -3716 -3735 -3749 -3763 -3770 -3784 -3782 -3786 -3790 -3792 -3794 -3803 -3805 -3819 -3823 -3826 -3828 -3838 -3839 -3843 -3870 -3877 -3888 -3889 -3891 -3892 -3893 -3894 -3880 -3860 -3878 -3880 -3888 -3893 -3898 -3904 -3906 -3907 -3910 -3918 -3927 -3946 -3973 -3982 -3979 -3980 -3993 -3984 -3988 -3986 -3987 -3988 -3989 -3997 -4000 -4001 -4025 -4030 -4034 -4038 -4040 -4044 -4046 -4048 -4057 -4067 -4079 -4092 -4094 -4122 -4124 -4128 -4127 -4128 -4132 -4136 -4141 -4146 -4151 -4153 -4163 -4167 -4168 -4170 -4172 -4176 -4177 -4178 -4194 -4198 -4199 -4201 -4203 -4204 -4205 -4204 -4209 -4211 -4213 -4224 -4240 -4242 -4255 -4266 -4280 -4284 -4295 -4310 -4323 -4343 -4351 -4359 -4383 -4387 -4388 -4397 -4401 -4403 -4404 -4405 -4425 -4431 -4435 -4439 -4444 -4452 -4461 -4470 -4466 -4467 -4469 -4481 -4482 -4498 -4496 -4504 -4505 -4512 -4518 -4520 -4521 -4523 -4534 -4516 -4527 -4525 -4534 -4535 -4551 -4565 -4570 -4571 -4578 -4584 -4595 -4609 -4610 -4618 -4628 -4629 -4630 -4634 -4636 -4637 -4640 -4659 -4664 -4669 -4665 -4673 -4687 -4688 -4693 -4694 -4697 -4667 -4678 -4679 -4702 -4707 -4706 -4709 -4711 -4718 -4725 -4716 -4718 -4723 -4724 -4726 -4727 -4729 -4735 -4736 -4738 -4739 -4758 -4763 -4773 -4774 -4776 -4777 -4778 -4777 -4785 -4786 -4771 -4773 -4774 -4777 -4781 -4783 -4788 -4791 -4794 -4807 -4816 -4818 -4825 -4828 -4838 -4822 -4831 -4837 -4841 -4851 -4854 -4870 -4876 -4888 -4889 -4900 -4906 -4909 -4910 -4917 -4919 -4920 -4926 -4928 -4934 -4941 -4943 -4945 -4948 -4950 -4956 -4951 -4948 -4954 -4958 -4960 -4959 -4962 -4969 -4982 -4986 -4994 -5000 -5009 -5027 -5025 -5029 -5033 -5037 -5036 -5037 -5040 -5032 -5033 -5034 -5039 -5045 -5050 -5045 -5076 -5077 -5082 -5083 -5106 -5107 -5114 -5117 -5137 -5138 -5143 -5147 -5153 -5156 -5171 -5182 -5183 -5184 -5185 -5189 -5182 -5189 -5194 -5201 -5205 -5213 -5218 -5221 -5223 -5230 -5231 -5243 -5255 -5230 -5228 -5237 -5245 -5248 -5259 -5260 -5272 -5278 -5281 -5287 -5286 -5287 -5298 -5328 -5329 -5333 -5335 -5337 -5339 -5341 -5346 -5349 -5350 -5351 -5358 -5359 -5360 -5374 -5376 -5359 -5360 -5388 -5401 -5406 -5410 -5412 -5413 -5414 -5415 -5435 -5436 -5441 -5443 -5448 -5446 -5448 -5449 -5464 -5465 -5466 -5469 -5470 -5492 -5493 -5494 -5509 -5520 -5528 -5530 -5537 -5541 -5542 -5559 -5562 -5563 -5588 -5595 -5596 -5601 -5618 -5626 -5627 -5641 -5667 -5679 -5685 -5693 -5695 -5717 -5733 -5734 -5754 -5755 -5757 -5758 -5759 -5760 -5761 -5771 -5774 -5780 -5784 -5785 -5787 -5788 -5790 -5800 -5811 -5814 -5810 -5811 -5794 -5792 -5803 -5804 -5812 -5814 -5815 -5836 -5852 -5853 -5855 -5878 -5879 -5880 -5883 -5889 -5897 -5911 -5932 -5934 -5935 -5936 -5938 -5939 -5941 -5951 -5955 -5950 -5951 -5954 -5970 -5971 -5974 -5977 -5978 -5985 -5986 -6013 -6024 -6031 -6037 -6043 -6052 -6051 -6053 -6076 -6096 -6101 -6106 -6108 -6115 -6125 -6106 -6107 -6104 -6114 -6142 -6143 -6162 -6169 -6170 -6171 -6181 -6198 -6199 -6202 -6206 -6207 -6244 -6246 -6249 -6250 -6254 -6264 -6271 -6276 -6277 -6268 -6271 -6288 -6293 -6308 -6309 -6326 -6341 -6345 -6344 -6341 -6364 -6365 -6366 -6370 -6371 -6373 -6376 -6377 -6378 -6377 -6379 -6386 -6396 -6397 -6420 -6422 -6429 -6433 -6463 -6472 -6473 -6490 -6491 -6492 -6497 -6522 -6523 -6524 -6519 -6520 -6521 -6525 -6530 -6531 -6534 -6535 -6543 -6552 -6558 -6584 -6586 -6587 -6588 -6606 -6614 -6618 -6646 -6650 -6651 -6654 -6677 -6663 -6665 -6676 -6655 -6653 -6655 -6665 -6667 -6682 -6692 -6703 -6704 -6707 -6715 -6719 -6730 -6731 -6733 -6743 -6747 -6748 -6750 -6759 -6771 -6772 -6776 -6775 -6776 -6782 -6785 -6812 -6841 -6858 -6860 -6859 -6877 -6886 -6895 -6914 -6919 -6922 -6924 -6933 -6935 -6936 -6937 -6938 -6952 -6962 -6965 -6984 -6987 -6986 -6985 -6977 -6967 -6968 -6966 -6980 -6997 -6994 -7002 -7008 -7000 -6975 -7009 -7014 -7015 -7026 -7027 -7034 -7036 -7041 -7040 -7041 -7045 -7048 -7065 -7074 -7075 -7082 -7087 -7092 -7098 -7097 -7111 -7127 -7124 -7135 -7136 -7137 -7140 -7153 -7156 -7158 -7174 -7176 -7177 -7163 -7166 -7159 -7157 -7158 -7164 -7165 -7172 -7190 -7194 -7199 -7200 -7205 -7208 -7207 -7222 -7227 -7244 -7249 -7271 -7272 -7273 -7274 -7281 -7286 -7288 -7314 -7315 -7317 -7318 -7319 -7304 -7307 -7308 -7309 -7312 -7319 -7322 -7337 -7338 -7345 -7346 -7350 -7360 -7361 -7362 -7360 -7395 -7400 -7404 -7405 -7407 -7406 -7411 -7420 -7435 -7440 -7442 -7446 -7453 -7446 -7448 -7467 -7471 -7469 -7470 -7482 -7485 -7492 -7488 -7489 -7492 -7493 -7494 -7497 -7504 -7520 -7525 -7547 -7554 -7543 -7553 -7560 -7561 -7577 -7589 -7591 -7593 -7587 -7596 -7597 -7584 -7590 -7591 -7599 -7626 -7627 -7628 -7630 -7645 -7639 -7645 -7652 -7657 -7662 -7664 -7674 -7680 -7681 -7694 -7698 -7716 -7704 -7705 -7706 -7708 -7712 -7716 -7715 -7717 -7722 -7723 -7728 -7721 -7722 -7724 -7727 -7735 -7737 -7725 -7746 -7747 -7750 -7761 -7762 -7765 -7777 -7780 -7776 -7777 -7778 -7759 -7769 -7770 -7787 -7797 -7798 -7804 -7803 -7804 -7805 -7811 -7825 -7824 -7826 -7827 -7828 -7851 -7867 -7887 -7889 -7890 -7900 -7904 -7917 -7918 -7935 -7941 -7942 -7946 -7947 -7948 -7949 -7976 -7979 -7981 -7983 -7988 -7999 -8000 -8009 -8011 -8012 -8019 -8021 -8025 -8027 -8006 -8011 -8034 -8036 -8037 -8038 -8013 -8024 -8029 -8032 -8033 -8034 -8032 -8034 -8036 -8059 -8060 -8063 -8064 -8081 -8090 -8097 -8122 -8135 -8147 -8149 -8150 -8151 -8162 -8174 -8154 -8158 -8162 -8170 -8171 -8188 -8189 -8190 -8191 -8196 -8205 -8216 -8217 -8222 -8233 -8239 -8240 -8242 -8257 -8249 -8262 -8264 -8274 -8309 -8311 -8328 -8333 -8335 -8338 -8344 -8350 -8349 -8350 -8363 -8366 -8370 -8371 -8395 -8398 -8401 -8410 -8425 -8429 -8430 -8441 -8443 -8445 -8451 -8452 -8455 -8458 -8431 -8443 -8453 -8459 -8477 -8474 -8479 -8476 -8487 -8488 -8489 -8500 -8501 -8503 -8504 -8538 -8523 -8529 -8530 -8556 -8573 -8576 -8589 -8595 -8624 -8632 -8634 -8628 -8636 -8635 -8636 -8644 -8659 -8661 -8641 -8652 -8659 -8650 -8664 -8667 -8674 -8676 -8678 -8686 -8696 -8697 -8735 -8740 -8749 -8767 -8769 -8747 -8751 -8760 -8755 -8766 -8768 -8777 -8782 -8788 -8796 -8799 -8801 -8809 -8807 -8816 -8827 -8831 -8835 -8836 -8843 -8844 -8845 -8851 -8858 -8860 -8862 -8863 -8889 -8891 -8912 -8913 -8924 -8928 -8929 -8939 -8955 -8957 -8958 -8963 -8988 -8989 -8997 -8995 -8999 -8968 -8990 -8991 -8992 -8994 -8996 -9013 -9024 -9026 -9035 -9046 -9047 -9083 -9084 -9089 -9096 -9108 -9107 -9116 -9123 -9122 -9128 -9132 -9151 -9155 -9163 -9174 -9178 -9183 -9199 -9209 -9217 -9219 -9232 -9233 -9232 -9237 -9241 -9244 -9245 -9247 -9251 -9252 -9266 -9285 -9284 -9291 -9294 -9295 -9296 -9300 -9322 -9328 -9333 -9337 -9345 -9346 -9347 -9371 -9375 -9394 -9397 -9404 -9406 -9422 -9425 -9438 -9440 -9435 -9442 -9455 -9473 -9475 -9496 -9499 -9500 -9511 -9512 -9513 -9539 -9540 -9543 -9547 -9550 -9557 -9571 -9577 -9593 -9600 -9609 -9615 -9620 -9621 -9616 -9625 -9626 -9637 -9638 -9642 -9648 -9656 -9654 -9661 -9665 -9696 -9705 -9710 -9719 -9720 -9717 -9718 -9717 -9719 -9724 -9725 -9738 -9741 -9743 -9744 -9745 -9765 -9778 -9779 -9789 -9791 -9773 -9778 -9780 -9782 -9783 -9782 -9797 -9799 -9800 -9801 -9823 -9824 -9834 -9836 -9841 -9845 -9847 -9865 -9868 -9883 -9884 -9887 -9890 -9892 -9899 -9908 -9910 -9911 -9915 -9918 -9922 -9926 -9923 -9944 -9947 -9948 -9949 -9958 -9959 -9961 -9973 -9954 -9976 -9978 -10001 -10000 -9992 -9997 -9985 -9995 -9996 -10005 -9999 -10001 -10002 -10009 -10041 -10045 -10051 -10070 -10071 -10073 -10100 -10099 -10100 -10101 -10102 -10105 -10082 -10083 -10082 -10086 -10112 -10113 -10114 -10122 -10124 -10127 -10140 -10156 -10157 -10158 -10159 -10162 -10163 -10166 -10177 -10178 -10180 -10178 -10179 -10191 -10186 -10198 -10201 -10204 -10227 -10229 -10232 -10234 -10246 -10247 -10248 -10249 -10250 -10269 -10277 -10278 -10279 -10289 -10291 -10294 -10292 -10304 -10324 -10339 -10342 -10343 -10349 -10354 -10371 -10370 -10374 -10376 -10379 -10405 -10406 -10405 -10403 -10411 -10412 -10411 -10419 -10422 -10435 -10437 -10438 -10437 -10440 -10427 -10421 -10432 -10434 -10439 -10449 -10442 -10469 -10471 -10476 -10480 -10481 -10485 -10507 -10508 -10511 -10512 -10513 -10523 -10524 -10529 -10536 -10552 -10563 -10569 -10573 -10575 -10576 -10578 -10596 -10602 -10630 -10647 -10657 -10659 -10684 -10687 -10692 -10693 -10700 -10702 -10703 -10709 -10714 -10716 -10727 -10746 -10744 -10754 -10753 -10754 -10755 -10759 -10763 -10764 -10765 -10769 -10770 -10771 -10777 -10796 -10807 -10813 -10818 -10825 -10830 -10835 -10836 -10849 -10858 -10873 -10882 -10879 -10882 -10886 -10902 -10903 -10931 -10930 diff --git a/day01/day01_input_ez.txt b/day01/day01_input_ez.txt deleted file mode 100644 index 167e291..0000000 --- a/day01/day01_input_ez.txt +++ /dev/null @@ -1,10 +0,0 @@ -199 -200 -208 -210 -200 -207 -240 -269 -260 -263 diff --git a/day01/makefile b/day01/makefile deleted file mode 100644 index 92fb064..0000000 --- a/day01/makefile +++ /dev/null @@ -1,2 +0,0 @@ -all day01.cpp: - g++ -std=c++20 -o day01 day01.cpp diff --git a/day02/day02 b/day02/day02 Binary files differdeleted file mode 100755 index 8755c57..0000000 --- a/day02/day02 +++ /dev/null diff --git a/day02/day02.cpp b/day02/day02.cpp deleted file mode 100644 index dccb44a..0000000 --- a/day02/day02.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include <iostream> - -int main (int argc, char *argv[]) { - if (argc != 2) return 1; - - int depth = 0; - int forward = 0; - - int aim = 0; - int aim_depth = 0; - - FILE *f = fopen(argv[1], "r"); - char c = fgetc(f); - std::string command; - while (c != EOF) { - if (c == '\n') { - auto token_space = command.find(" "); - if (token_space != std::string::npos) { - std::string op = command.substr(0, token_space); - int amt = std::stoi(command.substr(token_space+1)); - if (op == "forward") { - forward += amt; - aim_depth += aim * amt; - } - if (op == "down") { - depth += amt; - aim += amt; - } - if (op == "up") { - depth -= amt; - aim -= amt; - } - } - command = ""; - } - else command += c; - c = fgetc(f); - } - - std::cout << "depth " << depth << ", " - << "forward " << forward << ", " - << "product " << depth * forward << std::endl; - - std::cout << "using aim: depth " << aim_depth << ", " - << "forward " << forward << ", " - << "aim " << aim << ", " - << "product " << aim_depth * forward << std::endl; - - return 0; -} diff --git a/day02/day02_input.txt b/day02/day02_input.txt deleted file mode 100644 index 7834464..0000000 --- a/day02/day02_input.txt +++ /dev/null @@ -1,1000 +0,0 @@ -forward 8 -forward 9 -forward 9 -down 3 -forward 9 -down 1 -down 7 -down 7 -down 4 -down 2 -down 6 -down 6 -down 2 -forward 6 -forward 6 -forward 2 -forward 2 -forward 7 -forward 6 -up 6 -up 8 -forward 5 -forward 4 -down 6 -forward 7 -down 5 -forward 5 -down 8 -down 8 -down 7 -forward 4 -down 2 -forward 7 -up 8 -forward 3 -down 2 -forward 1 -up 3 -forward 3 -up 1 -down 3 -up 7 -up 2 -down 4 -down 2 -forward 9 -forward 3 -down 8 -forward 5 -up 9 -up 4 -forward 9 -down 1 -forward 6 -down 3 -forward 8 -up 2 -forward 3 -up 7 -down 4 -forward 2 -forward 7 -forward 3 -down 1 -down 3 -up 5 -forward 6 -down 5 -down 4 -down 8 -down 2 -up 5 -forward 7 -up 8 -forward 2 -down 5 -forward 3 -up 1 -up 5 -down 8 -down 3 -forward 4 -forward 4 -forward 1 -up 8 -down 9 -forward 7 -forward 9 -down 5 -up 3 -down 9 -up 6 -forward 1 -forward 3 -forward 5 -down 5 -forward 6 -down 3 -down 8 -forward 3 -forward 5 -forward 7 -forward 6 -down 9 -down 5 -down 6 -down 5 -down 1 -down 8 -forward 3 -down 9 -down 5 -down 5 -forward 9 -forward 2 -down 7 -forward 9 -forward 9 -up 1 -forward 3 -up 9 -forward 5 -forward 7 -down 7 -forward 2 -up 8 -up 6 -down 7 -down 3 -down 5 -down 2 -forward 6 -forward 6 -up 6 -up 2 -forward 4 -forward 7 -forward 1 -down 4 -up 8 -down 3 -up 1 -down 2 -forward 4 -forward 7 -up 1 -down 7 -forward 8 -up 2 -down 8 -up 4 -up 4 -up 2 -down 8 -up 4 -down 6 -up 8 -down 5 -up 5 -down 8 -forward 9 -down 1 -down 5 -forward 3 -forward 3 -up 9 -down 2 -forward 3 -down 6 -forward 1 -forward 9 -forward 3 -down 8 -up 4 -down 1 -down 8 -up 1 -forward 2 -down 7 -up 3 -up 8 -down 2 -up 6 -forward 6 -down 9 -forward 4 -forward 7 -up 9 -forward 3 -forward 2 -down 8 -down 2 -down 5 -down 5 -down 1 -up 7 -down 4 -forward 5 -down 9 -down 5 -down 1 -down 6 -forward 9 -down 6 -forward 3 -down 3 -up 6 -forward 2 -forward 6 -down 2 -down 9 -down 6 -down 1 -down 7 -down 6 -down 6 -up 1 -forward 8 -down 9 -down 6 -down 8 -down 8 -down 6 -down 3 -forward 9 -forward 6 -down 9 -forward 5 -down 6 -down 6 -down 9 -down 7 -down 3 -forward 1 -up 9 -forward 9 -down 7 -forward 4 -down 1 -forward 9 -up 9 -down 7 -forward 5 -down 3 -up 7 -forward 9 -forward 6 -forward 3 -forward 8 -down 4 -down 1 -down 7 -down 7 -up 4 -down 9 -forward 6 -forward 7 -down 8 -forward 2 -forward 2 -forward 9 -forward 6 -forward 9 -up 6 -up 8 -forward 2 -up 3 -forward 9 -forward 1 -down 4 -forward 8 -down 4 -forward 5 -forward 7 -up 2 -forward 5 -down 4 -forward 3 -down 5 -forward 9 -up 3 -forward 8 -down 7 -down 7 -down 9 -forward 2 -down 1 -down 6 -up 8 -down 2 -down 1 -up 3 -down 3 -forward 2 -forward 6 -up 6 -down 3 -up 9 -up 3 -down 8 -up 6 -down 2 -forward 4 -up 1 -down 5 -down 4 -up 9 -up 7 -forward 7 -down 9 -forward 9 -forward 5 -forward 3 -down 4 -up 6 -up 7 -down 7 -down 6 -up 9 -up 4 -down 7 -forward 7 -forward 8 -down 9 -forward 5 -forward 4 -down 5 -forward 8 -forward 5 -up 3 -down 9 -forward 1 -forward 2 -up 3 -down 2 -down 1 -forward 5 -forward 5 -forward 6 -up 2 -forward 3 -down 7 -down 6 -up 3 -down 4 -down 4 -forward 5 -down 3 -up 6 -forward 1 -up 8 -forward 7 -forward 1 -forward 9 -down 2 -up 8 -up 1 -up 4 -forward 9 -forward 3 -forward 5 -down 1 -up 9 -down 1 -forward 3 -down 6 -down 8 -up 4 -forward 6 -up 7 -down 8 -forward 9 -up 2 -down 7 -down 1 -forward 9 -up 7 -forward 3 -forward 9 -forward 1 -forward 1 -down 9 -forward 1 -up 4 -down 5 -forward 4 -down 1 -forward 4 -forward 9 -up 4 -down 3 -down 6 -up 2 -down 6 -down 5 -forward 5 -up 1 -up 9 -forward 8 -up 3 -down 1 -forward 3 -forward 7 -up 6 -up 3 -down 6 -forward 7 -up 6 -down 7 -forward 8 -up 4 -down 8 -up 9 -up 3 -down 3 -forward 8 -down 4 -down 9 -forward 2 -down 7 -up 1 -forward 9 -forward 5 -up 8 -forward 9 -forward 4 -forward 9 -forward 7 -down 4 -up 4 -down 7 -down 4 -down 4 -down 1 -forward 5 -forward 4 -down 1 -down 4 -down 8 -down 3 -forward 7 -forward 4 -down 1 -down 9 -up 3 -forward 2 -down 8 -down 9 -down 2 -down 5 -up 9 -down 9 -up 9 -forward 5 -forward 8 -forward 9 -down 5 -forward 6 -down 8 -down 9 -forward 8 -up 5 -up 9 -up 7 -up 8 -forward 9 -forward 1 -up 6 -down 8 -down 8 -forward 1 -up 1 -forward 8 -forward 6 -down 4 -forward 1 -down 7 -forward 8 -forward 3 -up 3 -down 4 -down 2 -forward 2 -forward 3 -up 4 -down 3 -forward 2 -down 8 -forward 7 -up 3 -down 2 -forward 2 -down 5 -up 6 -up 6 -forward 4 -up 4 -down 8 -forward 8 -down 9 -down 9 -down 6 -down 2 -forward 2 -up 6 -up 5 -forward 3 -forward 3 -up 9 -down 3 -forward 8 -down 5 -forward 5 -forward 7 -down 3 -down 4 -down 1 -down 8 -down 1 -down 1 -forward 9 -forward 3 -down 8 -down 6 -up 9 -forward 1 -forward 5 -up 9 -up 8 -forward 2 -up 8 -down 9 -up 2 -forward 5 -forward 1 -forward 8 -down 3 -forward 4 -down 5 -up 6 -forward 8 -forward 9 -forward 3 -down 1 -down 3 -down 3 -up 4 -forward 9 -down 3 -down 6 -forward 3 -forward 2 -down 6 -down 8 -forward 6 -up 8 -up 3 -up 4 -forward 2 -forward 4 -forward 4 -forward 7 -down 6 -up 8 -down 3 -forward 8 -forward 4 -down 7 -down 5 -forward 6 -forward 4 -forward 6 -down 3 -forward 3 -down 1 -down 7 -forward 3 -forward 2 -forward 7 -down 5 -up 4 -down 6 -down 9 -forward 3 -forward 5 -forward 3 -down 1 -forward 2 -up 5 -up 6 -forward 2 -down 4 -forward 3 -down 4 -down 1 -forward 8 -up 2 -down 3 -down 6 -up 5 -forward 3 -forward 6 -down 3 -forward 1 -down 7 -forward 2 -forward 1 -forward 6 -forward 5 -forward 3 -down 4 -down 8 -forward 1 -up 2 -up 8 -down 4 -forward 9 -up 6 -forward 5 -forward 7 -down 5 -forward 5 -down 1 -forward 4 -forward 5 -up 2 -forward 5 -up 8 -up 1 -forward 2 -down 4 -down 6 -forward 4 -down 2 -down 3 -forward 2 -up 3 -up 4 -forward 2 -down 6 -forward 1 -forward 4 -down 6 -forward 7 -up 2 -forward 7 -forward 6 -up 2 -forward 8 -forward 4 -forward 9 -down 1 -down 8 -forward 3 -forward 2 -down 8 -up 1 -forward 4 -down 8 -forward 2 -forward 8 -up 2 -down 1 -forward 4 -forward 2 -up 4 -up 2 -down 3 -up 8 -forward 3 -up 8 -forward 9 -up 1 -up 5 -down 5 -down 6 -forward 1 -up 5 -up 8 -forward 7 -down 5 -up 4 -forward 2 -up 4 -up 4 -down 2 -forward 6 -forward 2 -down 7 -down 5 -forward 1 -down 2 -down 5 -down 7 -up 8 -down 8 -up 5 -down 1 -forward 5 -down 2 -forward 5 -down 1 -up 7 -up 2 -forward 2 -forward 3 -forward 6 -forward 3 -down 8 -up 8 -forward 8 -forward 1 -forward 7 -up 2 -forward 9 -down 1 -forward 5 -up 9 -forward 3 -forward 7 -forward 8 -up 1 -down 3 -forward 5 -down 2 -forward 6 -forward 3 -down 9 -up 5 -forward 2 -down 4 -up 1 -forward 4 -up 4 -down 8 -down 8 -forward 3 -forward 8 -down 7 -up 3 -forward 1 -up 3 -forward 9 -forward 7 -forward 1 -down 6 -forward 3 -down 1 -down 8 -forward 5 -forward 3 -up 6 -forward 5 -forward 4 -forward 3 -forward 9 -forward 8 -down 6 -down 2 -forward 7 -forward 6 -up 6 -down 6 -down 4 -down 3 -forward 8 -down 9 -up 5 -forward 3 -forward 2 -down 5 -up 4 -down 6 -down 3 -forward 9 -down 2 -forward 9 -forward 8 -up 1 -down 2 -forward 7 -up 5 -up 6 -down 8 -up 9 -up 8 -forward 1 -forward 5 -down 9 -forward 8 -down 8 -up 1 -down 7 -forward 7 -up 3 -down 3 -down 1 -forward 2 -down 3 -forward 9 -forward 2 -down 8 -down 2 -forward 5 -down 9 -down 1 -down 5 -down 6 -up 4 -up 3 -down 1 -up 7 -forward 6 -down 3 -down 6 -up 5 -forward 8 -up 8 -down 1 -down 2 -up 8 -down 7 -forward 7 -forward 4 -down 8 -down 3 -forward 3 -down 4 -forward 3 -down 6 -forward 4 -forward 7 -forward 9 -up 7 -forward 1 -down 7 -down 8 -down 8 -up 6 -down 3 -forward 5 -forward 5 -forward 9 -forward 4 -down 4 -down 8 -down 7 -down 1 -forward 2 -forward 4 -down 3 -down 6 -down 7 -forward 5 -down 8 -down 1 -forward 4 -forward 3 -forward 1 -down 6 -down 7 -down 1 -forward 6 -down 4 -up 2 -forward 4 -down 2 -up 5 -down 2 -down 6 -up 7 -forward 4 -forward 7 -forward 9 -up 5 -down 9 -up 5 -forward 6 -down 2 -up 8 -up 9 -up 9 -forward 5 -down 2 -forward 2 -down 7 -forward 5 -forward 9 -up 8 -down 8 -forward 1 -down 2 -up 3 -forward 3 -down 5 -forward 4 -down 3 -forward 4 -forward 9 -forward 3 -down 5 -forward 4 -down 2 -forward 5 -forward 8 -up 6 -up 2 -down 3 -forward 6 -down 5 -down 4 -down 4 -down 4 -up 2 -up 2 -forward 6 -forward 2 -forward 9 -down 2 -down 9 -down 8 -forward 2 -down 3 -up 3 -forward 5 -down 4 -up 3 -forward 3 -down 1 -forward 7 -forward 5 -forward 6 -down 8 -down 5 -down 5 -down 9 -up 2 -forward 3 -down 4 -down 9 -forward 3 -forward 9 -forward 2 -forward 4 -up 6 -down 6 -up 9 -forward 8 -down 7 -forward 1 -forward 4 -up 1 -up 2 -down 9 -forward 6 -down 6 -down 1 -down 4 -down 7 -down 6 -forward 5 -up 1 -up 7 -down 2 -down 8 -down 2 -down 7 -down 3 -up 9 -down 7 -down 5 -down 6 -forward 9 -up 3 -forward 2 -down 8 -forward 4 -down 6 -forward 3 -up 3 -down 5 -up 4 -forward 6 -forward 7 -forward 9 -down 3 -forward 7 -forward 3 -down 4 -up 4 -down 8 -forward 6 -forward 7 -forward 9 -forward 4 -down 3 -up 5 -down 7 -down 7 -forward 9 diff --git a/day02/makefile b/day02/makefile deleted file mode 100644 index 61ca2f4..0000000 --- a/day02/makefile +++ /dev/null @@ -1,2 +0,0 @@ -all day02.cpp: - g++ -std=c++20 -o day02 day02.cpp diff --git a/day03/day03 b/day03/day03 Binary files differdeleted file mode 100755 index ccb1732..0000000 --- a/day03/day03 +++ /dev/null diff --git a/day03/day03.cpp b/day03/day03.cpp deleted file mode 100644 index 036cd07..0000000 --- a/day03/day03.cpp +++ /dev/null @@ -1,96 +0,0 @@ -#include <iostream> -#include <fstream> -#include <string> -#include <vector> - -int bin_to_dec (std::string bin) { - int dec = 0, pow = 1; - for (std::size_t i=bin.size(); i > 0; i--) { - dec += pow * (bin[i-1] == '0' ? 0 : 1); - pow *= 2; - } - return dec; -} - -std::vector<int> get_freq (std::vector<std::string> bits) { - std::vector<int> freq; - for (std::size_t i=0; i<bits[0].size(); i++) { - freq.push_back(0); - } - - for (auto b : bits) { - for (std::size_t i=0; i< b.size(); i++) { - freq[i] += (b[i] == '0' ? 0 : 1)*2-1; - } - } - return freq; -} - -std::vector<std::string> filter (std::vector<std::string> bits, int inv, int sel) { - std::vector<std::string> res; - auto freq = get_freq(bits); - - for (auto b : bits) { - int f = freq[sel] * inv; - if (f == 0) f += inv; - if ((f > 0 ? '0' : '1') == b[sel]) { - res.push_back(b); - } - } - - return res; -} - -int main (int argc, char *argv[]) { - if (argc != 2) return 1; - - std::string raw; - std::getline(std::ifstream(argv[1]), raw, '\0'); - - std::vector<std::string> bits; - - while (1) { - auto token = raw.find("\n"); - if (token != std::string::npos) { - bits.push_back(raw.substr(0, token)); - raw = raw.substr(token+1); - } else { - if (raw.size() > 0) bits.push_back(raw); - break; - } - } - - auto freq = get_freq(bits); - - std::string gamma = "", epsilon = ""; - for (std::size_t i=0; i<freq.size(); i++) { - gamma += freq[i] > 0 ? "1" : "0"; - epsilon += freq[i] > 0 ? "0" : "1"; - } - - int g = bin_to_dec(gamma); - int e = bin_to_dec(epsilon); - std::cout << "power level " << e*g << ", " - << "epsilon " << e << " (" << epsilon << "), " - << "gamma " << g << " (" << gamma << ")" << std::endl; - - std::vector<std::string> o2 = bits; - for (std::size_t i=0; i<freq.size(); i++) { - o2 = filter(o2, 1, i); - if (o2.size() == 1) break; - } - - std::vector<std::string> co2 = bits; - for (std::size_t i=0; i<freq.size(); i++) { - co2 = filter(co2, -1, i); - if (co2.size() == 1) break; - } - - int generator = bin_to_dec(o2[0]); - int scrubber = bin_to_dec(co2[0]); - std::cout << "oxigen generator rating " << scrubber*generator << ", " - << "epsilon " << generator << " (" << o2[0] << "), " - << "gamma " << scrubber << " (" << co2[0] << ")" << std::endl; - - return 0; -} diff --git a/day03/day03_input.txt b/day03/day03_input.txt deleted file mode 100644 index ac22a69..0000000 --- a/day03/day03_input.txt +++ /dev/null @@ -1,1000 +0,0 @@ -011001101000 -010101111100 -000000111101 -001001001010 -010011000001 -111111001110 -001011101111 -110011010110 -100011111110 -101110000111 -000011011100 -001111111011 -011101001111 -111001010110 -011100011110 -001011000010 -100010111011 -000101010011 -000001101100 -010001011110 -100010101000 -111101011101 -110000100001 -011011010101 -110101100110 -001101101010 -111010110011 -011111111000 -010001010001 -000001010101 -001001011011 -101111110011 -100011010001 -111010010111 -011010011010 -101111011011 -101010111100 -001111100110 -010100110111 -010110101100 -000111110101 -111110101110 -111010000000 -011111111010 -000101011100 -000001010110 -101000100101 -100001011001 -011101110010 -110111100100 -110011001011 -000010001111 -000100010101 -110111001100 -010001100000 -101111110101 -111000011011 -000100001001 -101101011101 -001001011110 -101100111010 -011011000010 -110010010111 -101001010101 -000000101110 -000011011111 -010001000011 -011011001010 -101101111011 -100010001010 -001001011100 -010011110001 -000001111101 -100001000101 -011101011010 -000010101110 -001010101010 -101010011011 -000111001011 -000011101000 -110100101001 -000111111010 -100111100101 -111010001111 -111100110001 -011111101010 -110101000011 -001111101100 -101000100110 -100101100011 -000011010011 -010101011111 -010000110111 -110011001001 -101011011101 -001011100001 -000001100101 -001001001101 -001101001111 -001110110001 -010110101110 -001100110110 -001000001111 -101101001001 -011111011010 -111111101110 -111001100000 -100101011001 -010101100101 -100000110100 -011001001000 -111100110011 -111011110001 -110011111010 -001101001010 -111110011111 -110101100000 -111001000101 -010001111110 -111011010100 -110011010111 -100100110111 -111111011010 -011110101111 -001011110010 -010111011010 -011101101101 -011010101110 -011000110001 -010110101010 -011110010000 -111111011100 -111011000101 -100110101110 -010101100010 -101100011110 -000010110101 -010010011110 -110000000110 -011111010101 -000110110011 -101011000010 -000011000111 -101011010000 -101101101001 -010000101010 -101001001001 -111010110110 -111000111101 -000001010111 -101110001100 -110010110001 -100000110001 -101100101011 -100000111001 -010110100111 -101011001111 -101010111001 -010010110000 -001110010011 -010101101110 -011000010100 -100111111000 -011110100011 -110100100111 -101110101000 -101010101111 -101001000000 -111010000110 -101001000100 -010001100111 -011011010001 -000101010101 -010110000011 -100000101110 -110010001000 -111000100001 -001001101001 -110010001001 -100001111011 -101010010100 -110011100101 -010101100001 -011101010100 -110100101111 -110100001111 -011000101101 -001011101100 -010010010101 -011011111010 -010101000001 -100101100000 -101001111101 -010000000100 -110000110100 -000000001101 -100100111101 -111100110010 -001011001111 -101100001011 -001111010001 -101100011001 -100110110001 -010111000011 -011010110101 -100111100011 -000111110011 -010101111101 -010010000000 -011000011011 -001100011001 -001011001001 -101110101101 -101111110111 -101011100100 -000100110100 -110000101111 -011001111101 -000000000111 -111001001010 -110100001100 -000001001110 -111001101011 -100011011111 -110000001000 -110101011011 -001010000101 -001011111001 -011011111100 -010100110101 -110101111001 -010110010101 -010010001000 -001001110111 -011111111111 -100011100010 -000110001101 -011111010000 -010111110010 -110010100011 -101011110101 -110011011110 -010000000101 -011101100100 -110010011100 -011101101100 -000010001001 -000011101101 -000101100011 -010111111000 -010111100111 -010101000101 -110111100010 -110001101011 -111010100000 -101010101011 -011101010101 -000100110111 -000111100111 -000100111111 -111100001001 -010000100001 -110101011111 -100010000100 -000011011000 -111011110000 -101000011100 -110001001010 -001000010101 -110110000101 -100000011110 -001101111010 -010111001100 -111011111100 -100101001000 -010111101001 -110010010000 -110011010000 -000010100111 -100101111101 -110101100010 -110100011110 -101111010110 -110001001111 -011101000111 -001011001101 -110001000010 -011110100110 -000101100110 -000110111110 -001010111010 -100110000111 -001000010110 -100001110100 -000111000110 -101100011100 -110100110110 -100011010111 -000101110001 -001010010110 -101000000101 -100101101000 -000111111110 -010010010111 -110010001010 -001100110111 -110110110101 -011111011101 -110101100111 -100100100111 -011011000000 -111101001100 -011101000011 -011101001010 -101101101101 -100100110010 -001000000010 -010010001010 -111110111001 -000111010001 -011100111111 -011111011001 -110101000000 -011110000010 -001111010110 -010011111111 -110101111011 -101110111111 -001001100001 -011100111100 -110111001110 -011000000111 -001100010111 -001011010010 -010010001011 -101110000011 -100000101000 -100010100100 -000111011101 -001000111011 -010010101010 -111011010011 -110100010001 -011110001110 -111010110001 -010000010111 -010110101101 -111101100001 -110011100110 -000101111110 -110010101010 -000001010000 -001101111101 -011011110100 -110001010101 -011001000001 -001101101100 -100011011011 -101011100010 -011011100101 -100110110101 -110111001011 -000100101011 -001101010100 -010000011100 -101100111011 -011001011100 -011011010100 -011100110001 -010010110011 -101000110011 -111101010001 -111000000100 -101101100111 -001011111000 -010100000111 -011110101101 -111011101100 -110101110001 -001110010000 -010010000111 -101001111011 -100100111100 -000101101101 -101111110100 -100000101111 -011001110000 -011110011001 -000101010110 -000000000101 -110010001100 -000111100100 -010010011010 -001111110100 -011010001010 -101100101111 -011001001011 -100011111101 -101100000001 -100100101010 -000000000100 -111001110101 -000010011110 -110110100100 -111010010001 -011101010010 -011100101111 -010110000010 -010000110101 -110101010011 -001110011110 -111010011010 -000110101000 -001111000001 -010110110000 -001100110001 -110011011111 -000100111011 -110001000111 -011010111101 -000010100110 -010100101001 -010001000010 -000101110101 -101100110100 -111000110010 -111011110010 -010111001111 -100000101101 -101100001010 -100100001001 -111111111101 -001010101001 -000011011010 -101011010010 -111001000110 -111100010011 -111010011100 -100000111100 -011100001101 -110001101000 -101111011001 -001100001000 -101110010111 -011111100000 -001011100000 -101011101010 -110010101111 -001110000101 -001111011011 -011110101000 -111000001000 -010100111010 -010010111001 -110000110001 -110011000101 -001110000100 -010100101101 -101010110100 -100001010100 -100011010011 -100000010010 -011101010111 -001000010111 -001100111100 -000110100011 -101111101010 -010001010000 -001100100110 -111001111110 -101000001001 -000010110010 -110111101011 -101011000011 -001000111111 -100011001101 -011010010101 -110011100011 -110010011010 -110001010100 -100010111101 -101110000110 -010111001011 -110011011100 -110001100011 -000100011010 -111011100010 -011110110011 -011111100010 -000100001101 -100010010000 -110000000011 -101001011000 -101100110101 -001010101011 -011001011010 -001010001001 -001111011100 -111100010001 -100011010110 -001000110111 -011011010011 -001100000000 -100001111100 -000011110101 -100010000111 -000010110011 -000010111110 -011110000101 -010000001011 -001111110010 -001110001001 -011101111111 -010110110001 -110000000111 -010101011101 -010111001001 -100100010010 -101001101110 -100001001010 -010001011101 -100111010101 -100000101011 -000100101001 -110111001001 -100100000001 -010111010010 -111101111011 -011010010010 -111101101000 -100110111101 -010010001001 -100111011000 -110101111111 -111010101110 -010011110010 -101001100100 -010000101111 -010011001111 -110010011111 -101110100111 -011010100101 -111111001001 -010101100110 -101001001101 -001000101010 -010001001100 -101001101000 -110110100000 -011101000101 -100101010101 -101110111011 -010010101001 -110100011000 -110101111010 -110000100000 -010011101101 -111011001101 -100100011101 -110100010111 -011100110100 -010111011001 -011101010001 -101000000010 -100111111001 -100100001000 -001000001000 -001000000100 -011110110010 -010101010011 -101101101100 -110111111001 -010000010011 -100010100001 -000110101111 -101010101101 -100101111100 -000111010110 -001101101111 -110010000011 -110100001110 -011111111101 -111011010101 -001010100010 -100010100110 -101101110111 -010110011011 -111001110110 -011110101001 -110011100111 -000100111101 -101100011000 -101101001010 -011111100111 -010000011000 -100001100110 -000000101101 -000111010010 -110000001100 -111111101010 -001000100010 -111111111011 -001011100111 -000101110010 -010111110011 -010000011001 -111001111101 -110100001101 -010001101000 -110000101011 -011011000110 -110010111011 -100111101010 -011001101011 -001101010011 -011000100101 -110111101111 -001000100001 -010010111101 -101101101011 -011111011100 -111111010110 -001110000000 -101011110010 -011101011111 -001001101101 -011101110000 -011100011101 -111101001101 -010111010101 -010111101010 -001000101101 -100000000011 -111110101111 -000111101111 -001110010101 -101111001101 -111100110000 -110010100000 -011101110100 -100011001111 -010110001001 -111100101100 -101001110100 -011010010111 -011000100100 -001100110100 -001001111000 -001000000111 -110100000111 -011000001011 -001011000000 -110110110111 -000010111011 -001001000011 -000011100111 -110011001111 -010000111101 -001110100010 -000011110001 -011001111011 -110111000001 -111111000001 -011001100110 -110010101100 -111101010100 -010010000101 -000011011011 -110110010001 -010111111010 -010000010101 -110000011010 -110001101110 -000110101011 -101111000111 -001101100000 -010100000001 -111110001001 -000011110000 -111100111001 -000001001011 -011000010110 -000001000100 -011100111000 -001011111110 -011100000000 -000101001011 -111111110110 -111010011000 -001000111101 -011001110010 -001101011100 -100110001111 -110110111010 -001110101100 -010000101100 -010011000011 -100101110010 -000000111010 -000001111001 -111101011000 -101000011001 -111110000101 -101111111011 -100110111110 -000110010110 -011011101110 -100000010111 -110111001000 -000010101010 -001010011011 -101010101010 -101100000000 -000101101011 -010110100110 -110010010100 -001010110101 -001110000001 -010001101010 -111111110100 -001101110110 -111101010111 -101011101100 -110001101010 -100111010100 -101101111001 -001011100110 -010010001111 -100101110110 -110011000010 -001111010100 -000101011011 -110000000001 -011011001001 -001001011111 -000111011111 -100001001100 -111011010010 -010101011001 -000001110100 -000010100101 -110110010010 -100010111110 -011110111110 -000001101000 -001011000110 -000010001010 -101101010100 -011011010000 -000011111000 -101000001110 -011110101011 -110100111000 -000011000010 -111111010001 -011101110001 -100000111101 -110100101101 -110000100101 -011001110110 -110001010010 -010010110110 -011110001000 -111010110100 -101111110010 -110000110111 -111101110100 -110111101110 -100110010111 -001001100011 -001110111000 -101110100100 -010000101101 -010111100101 -011001100010 -011100000101 -101001111001 -100011001010 -100010000010 -100101000010 -111111100101 -100001101110 -101001010110 -100000100011 -100000011000 -000110000001 -000000011011 -011000110101 -011010111011 -111110000001 -001001110100 -001011011110 -110111010110 -011101110101 -101111000101 -100001010010 -000001111000 -001110010100 -111111101100 -001011010001 -111001111001 -100101101010 -111000000010 -010101001010 -001010000010 -101011000110 -110011001010 -001000011000 -001010010011 -110000111101 -001001100000 -111101100111 -011001001100 -001100111011 -100001010101 -111010100011 -111000011111 -001000000000 -101110011001 -000000000011 -111011000111 -011010100011 -110000110000 -000011001001 -011000010001 -011110000011 -011101000000 -010100110011 -010110010001 -111001101111 -110111110100 -110111110110 -100111001011 -111100110110 -101010001110 -100110000010 -011011100001 -001101010010 -010001110011 -010011110000 -110010100111 -001101110100 -101010101100 -110000111000 -011101110110 -101011110001 -110011000000 -010000011011 -001011010000 -010111010001 -010100010101 -110101000100 -010011101011 -010110111001 -101111000011 -011011100000 -000010100010 -001100110000 -110000111001 -100100100000 -001101000010 -100000010011 -100010011110 -110101010000 -000100000101 -000111000001 -000001111011 -100111011101 -110111110111 -011101111000 -001001000110 -100110010011 -100011100111 -010011010000 -010011010111 -001101100101 -010000010110 -000101010001 -011111010100 -010010111100 -001010101110 -110000001011 -011001010101 -000001111110 -010111111011 -011110010010 -001001101100 -101100101000 -100000001110 -110001001110 -011110111011 -001000110011 -111100110111 -001101100111 -000110110000 -000010011011 -100110111010 -111110001100 -000000101100 -110000111100 -100110111100 -110111111100 -110000111010 -100001100100 -100010011010 -011011100110 -110100010110 -001001010101 -000110101110 -101001100000 -100010110011 -111000001101 -101110100110 -100010111100 -000101110110 -000011011001 -000001010100 -101100111001 -011101111101 -011110011000 -111010001011 -010101110101 -100001100101 -100110100010 -100110011000 -001010100110 -011001010111 -111111001010 -111111001000 -111110100101 -000101000011 -110101101111 -110100010010 -011100000010 -001000010100 -101100000111 -001010111111 -101001010011 -101011001000 -001100000011 -010010101000 -101101111101 -101001010010 -100101111011 -101110101110 -100000100100 -000000000010 -011101100011 -110000110110 -101000110000 -111011111010 -010111000110 -001111110110 -100111110110 -100110011101 -000000001000 -101110111010 -000101011000 -001011100011 -011101100111 -000011000011 -000101011001 -110101101101 -101000001111 -111000010101 -000011100010 -011010111001 -001100100101 -010111111101 -010101111011 -000101001100 -101010000111 -111100111111 -100000000111 -110111110011 -000110110111 -010011011111 -100110010100 -000100111110 -001000111001 -011111000001 -001010100101 -101010001100 -011100001011 -000101001111 -010010101111 -101000111011 -001101000001 -100100100001 -100010101111 -100111111110 -011011111001 -101000000001 -111001101101 -101011010101 -111111100110 -001010010100 -011101111001 -001100100000 -101001110110 diff --git a/day03/day03_input_ez.txt b/day03/day03_input_ez.txt deleted file mode 100644 index a6366a8..0000000 --- a/day03/day03_input_ez.txt +++ /dev/null @@ -1,12 +0,0 @@ -00100 -11110 -10110 -10111 -10101 -01111 -00111 -11100 -10000 -11001 -00010 -01010 diff --git a/day03/makefile b/day03/makefile deleted file mode 100644 index 7c21cf0..0000000 --- a/day03/makefile +++ /dev/null @@ -1,2 +0,0 @@ -all day03.cpp: - g++ -std=c++20 -o day03 day03.cpp diff --git a/day04/day04 b/day04/day04 Binary files differdeleted file mode 100755 index b28d295..0000000 --- a/day04/day04 +++ /dev/null diff --git a/day04/day04.cpp b/day04/day04.cpp deleted file mode 100644 index 7736eff..0000000 --- a/day04/day04.cpp +++ /dev/null @@ -1,134 +0,0 @@ -#include <iostream> -#include <fstream> -#include <vector> - -void split (std::vector<std::string> &vec, std::string str, std::string del) { - auto token = str.find(del); - if (token != std::string::npos) { - vec.push_back(str.substr(0, token)); - split(vec, str.substr(token+del.size()), del); - } else { vec.push_back(str); } -} - -class Board { - public: - Board(std::string repr) { - std::vector<std::string> lines; - split(lines, repr, "\n"); - for (auto line : lines) { - std::vector<std::string> strcells; - split(strcells, line, " "); - size = 0; - for (auto strcell : strcells) { - if (strcell.size() == 0) continue; - cells.push_back(std::stoi(strcell)); - state.push_back(0); - size++; - } - } - - } - - int size; - std::vector<int> cells; - std::vector<int> state; - - void mark (int ex) { - for (int y=0; y<size; y++) { - for (int x=0; x<size; x++) { - int i = x + y*size; - if (cells[i] == ex) { - state[i] = 1; - } - } - } - } - - bool win () { - for (int y=0; y<size; y++) { - int sum_row = 0; - for (int x=0; x<size; x++) { - int i = x + y*size; - sum_row += state[i]; - } - if (sum_row == size) return true; - } - for (int x=0; x<size; x++) { - int sum_col = 0; - for (int y=0; y<size; y++) { - int i = x + y*size; - sum_col += state[i]; - } - if (sum_col == size) return true; - } - return false; - } - - int score () { - int sum = 0; - for (int y=0; y<size; y++) { - for (int x=0; x<size; x++) { - int i = x + y*size; - if (state[i] == 0) { - sum += cells[i]; - } - } - } - return sum; - } -}; - -int main (int argc, char *argv[]) { - if (argc != 2) return 1; - std::string raw; - std::getline(std::ifstream(argv[1]), raw, '\0'); - - std::vector<int> extract; - auto token = raw.find("\n"); - if (token != std::string::npos) { - std::string ex = raw.substr(0, token); - std::vector<std::string> vec; - split(vec, ex, ","); - for (auto v : vec) { extract.push_back(std::stoi(v)); } - - raw = raw.substr(token+2); - if (raw[raw.size()-1] == '\n') raw = raw.substr(0, raw.size()-1); - } else return 1; - - std::vector<Board> boards; - - std::vector<std::string> str_boards; - split(str_boards, raw, "\n\n"); - for (auto s : str_boards) { - boards.emplace_back(s); - } - - bool flag = false; - std::vector<Board> filtered = boards; - for (int ex : extract) { - std::cout << ex << " " << filtered.size() << std::endl; - std::vector<Board> next; - int size = filtered.size(), seen = 0;; - for (auto& board : filtered) { - board.mark(ex); - if (board.win() && filtered.size() != 1) { - if (!flag) { - std::cout << "first winner product: " << ex * board.score() << ", " - << "ex: " << ex << ", score: " << board.score() << std::endl; - flag = true; - } - } else { - next.push_back(board); - } - } - if (next.size() == 1 && next[0].win()) { - int score = next[0].score(); - std::cout << "last winner product: " << ex * score << ", " - << "ex: " << ex << ", score: " << score << std::endl; - break; - } - filtered = next; - } - - return 0; -} diff --git a/day04/day04_input.txt b/day04/day04_input.txt deleted file mode 100644 index 033baa2..0000000 --- a/day04/day04_input.txt +++ /dev/null @@ -1,601 +0,0 @@ -38,54,68,93,72,12,33,8,98,88,21,91,53,61,26,36,18,80,73,47,3,5,55,92,67,52,25,40,56,95,9,62,30,31,85,65,14,2,78,75,15,39,87,27,58,42,60,32,41,83,51,77,10,66,70,4,37,6,89,23,16,49,48,63,94,97,86,64,74,82,7,0,11,71,44,43,50,69,45,81,20,28,46,79,90,34,35,96,99,59,1,76,22,24,17,57,13,19,84,29 - -57 7 8 38 31 -17 96 5 12 18 -58 45 81 89 4 -73 51 93 32 10 -74 50 26 0 24 - -79 67 21 84 71 -25 22 19 80 13 -10 63 90 78 33 -93 50 89 58 87 -91 7 45 6 41 - -66 85 4 91 41 -59 69 16 0 90 -35 13 64 61 93 -11 20 29 67 77 -92 75 58 3 34 - -19 1 34 50 76 -26 75 8 28 20 -96 64 49 77 2 -18 58 62 53 60 -82 99 38 10 83 - -89 69 97 16 48 -32 3 83 17 33 -82 53 15 50 94 -52 0 86 25 81 -42 38 84 73 76 - -68 18 44 61 66 -24 21 22 6 41 -48 29 4 64 78 -93 25 88 95 96 -72 49 51 2 5 - -35 41 59 23 21 - 0 66 34 12 85 -61 26 29 68 5 -28 69 90 2 96 - 1 16 32 24 44 - -98 73 33 82 18 -51 62 88 67 6 -99 44 53 39 36 -34 90 50 72 43 -64 40 11 26 5 - -88 8 81 57 99 -61 16 22 50 5 -26 84 85 7 15 -97 27 47 18 21 - 3 78 66 94 58 - -56 40 68 20 24 -26 98 6 76 89 -61 63 22 99 83 -31 5 32 54 82 -18 23 17 46 13 - -35 95 67 73 13 -86 33 7 9 43 -44 28 55 32 52 -54 91 84 97 98 -17 49 93 23 56 - -22 90 61 12 13 -87 4 46 25 88 -70 38 53 80 11 -75 56 96 49 32 - 3 55 43 19 67 - -40 17 70 76 61 -82 86 37 8 28 -60 48 24 83 53 -57 87 44 92 63 -10 49 88 15 55 - -36 80 47 46 84 -25 70 2 79 75 -55 5 13 99 45 -54 73 83 59 67 -57 0 69 33 68 - -51 52 21 44 36 -17 30 15 42 18 - 6 3 47 94 2 -57 77 45 70 90 -29 60 19 9 84 - -16 12 37 6 27 -86 87 21 70 71 -84 0 11 67 83 - 5 68 33 23 26 -51 43 28 79 49 - -22 5 53 12 42 -29 81 46 13 88 -80 65 8 62 33 -72 67 34 21 35 -38 77 90 52 44 - -63 57 52 82 96 -46 11 32 20 58 -35 15 83 1 55 -18 16 73 19 17 -22 88 45 95 47 - -43 15 7 97 88 -96 52 84 86 49 -80 13 21 28 29 -16 36 98 82 41 -32 10 62 68 24 - -46 69 8 55 50 -28 21 92 79 73 -19 71 74 53 44 -24 27 10 14 85 - 2 39 58 81 72 - -68 74 43 62 61 -82 73 37 40 93 -16 7 41 54 96 -10 3 85 70 65 -69 71 94 5 81 - -17 53 87 80 98 -76 41 30 25 58 -29 14 73 74 43 -20 91 24 70 39 -46 48 51 9 18 - -20 41 36 81 93 -46 75 33 73 78 -26 16 80 54 90 -87 17 12 67 1 -51 10 39 91 45 - -76 21 31 3 69 -27 42 97 32 87 -26 22 4 63 38 -46 77 67 80 43 -37 50 59 88 96 - -17 16 10 68 76 - 2 45 94 29 40 - 1 54 60 66 93 - 0 13 42 39 70 - 6 82 46 74 43 - -87 95 31 22 94 -86 30 39 56 18 -89 74 23 11 64 -63 48 85 20 49 -27 15 40 83 50 - -81 48 47 73 95 -40 65 89 69 5 -38 76 85 30 11 -31 61 8 67 62 -41 68 42 78 20 - -46 85 96 83 20 -94 52 7 97 31 -29 95 99 34 62 - 8 69 6 51 54 -38 59 5 56 55 - -18 15 10 35 96 -44 66 58 91 9 -12 2 45 98 80 -22 69 37 67 79 -46 36 23 51 75 - -11 58 64 85 26 -21 43 32 36 65 -94 61 40 68 67 -14 23 6 53 2 -93 9 74 3 90 - -73 82 46 37 20 -47 75 38 45 54 -76 34 65 44 58 -93 89 27 13 33 -85 67 40 42 17 - -13 66 2 65 10 -98 4 83 79 92 -22 48 93 6 23 -24 39 17 60 9 -77 49 16 19 35 - -96 37 88 4 32 -80 89 59 39 63 -67 19 35 10 40 -91 66 47 9 79 -45 21 86 92 30 - -76 85 37 32 29 -59 41 44 23 93 -86 24 83 81 57 -22 21 82 53 16 -38 99 79 49 30 - -54 29 64 65 62 -44 59 83 75 56 -11 13 34 12 24 -96 39 31 95 16 -41 38 21 25 60 - -49 8 3 67 2 -30 81 39 26 33 -83 73 47 32 65 -48 20 75 24 40 -74 28 11 19 96 - -87 25 49 81 7 -99 34 35 50 86 -18 24 68 4 78 -59 8 71 0 41 -92 54 64 75 46 - - 2 19 73 29 10 -55 6 43 48 22 -64 14 62 39 97 -99 26 68 25 12 -98 72 45 38 40 - -59 76 40 37 9 -42 23 1 12 54 -49 51 17 11 34 -74 95 26 78 67 -65 32 98 80 45 - -50 86 95 29 38 - 6 11 24 10 73 -63 28 30 46 68 -34 9 20 58 77 -88 52 79 89 98 - -32 20 93 39 80 -67 98 99 4 26 -22 89 97 13 73 -88 11 72 31 78 -76 95 64 43 75 - -75 23 81 89 90 -98 86 88 38 99 -51 7 65 2 3 -16 59 49 41 87 -57 20 58 72 83 - -21 81 24 43 12 -55 74 2 90 5 -13 89 59 42 3 -47 66 38 20 62 -61 56 72 84 41 - -83 68 73 77 66 -96 48 24 7 98 -57 4 86 10 34 -22 46 80 75 49 -89 35 60 79 37 - -27 50 90 37 28 -81 74 58 39 61 - 8 72 31 85 57 -52 43 9 5 91 -68 86 0 4 89 - -14 41 70 67 59 -13 94 31 69 65 -76 19 9 79 1 -33 20 53 91 36 -80 50 21 37 85 - -16 47 62 33 12 -11 74 44 63 60 - 2 23 84 80 42 -14 58 67 81 24 - 8 29 31 91 43 - -62 86 26 57 74 - 9 46 47 81 39 - 4 99 59 89 3 -20 76 51 70 84 -95 72 43 67 61 - -75 93 56 15 30 -11 49 97 16 45 -52 91 21 92 62 - 0 74 85 48 63 -28 76 59 79 60 - -36 18 0 69 10 -34 33 21 5 23 -73 42 50 14 11 -75 26 95 79 51 -76 93 1 43 22 - -86 64 25 9 54 -67 79 49 1 8 -63 47 60 4 46 -94 97 57 38 30 -91 87 0 68 15 - -94 46 6 69 9 -18 49 43 30 31 -79 35 76 45 92 -67 89 82 2 57 -65 21 24 81 52 - - 5 58 43 37 61 -65 67 54 15 50 -69 75 14 17 96 -23 95 71 33 9 -68 82 10 3 29 - -56 43 88 35 82 -44 14 64 60 23 -33 5 96 86 47 -70 74 27 4 1 -51 71 95 59 11 - -46 14 44 6 19 -54 81 59 31 28 - 7 67 73 23 86 -25 91 57 43 92 -65 76 80 47 77 - - 3 39 70 90 23 -64 77 33 83 22 - 6 36 81 80 68 -85 45 72 53 42 - 7 19 88 13 9 - -88 3 72 6 29 -33 13 1 85 68 -28 32 78 8 63 -15 99 35 80 41 -61 50 43 53 39 - -22 88 19 86 54 -78 3 70 65 85 -18 12 21 14 17 - 5 48 64 81 71 -89 91 55 30 87 - -35 82 37 42 25 -44 53 12 2 73 -18 24 0 75 51 -34 26 54 52 86 -56 64 31 57 80 - -45 97 83 15 5 -40 77 1 53 84 -67 44 52 37 20 -36 64 33 82 90 -49 22 6 65 99 - -18 69 23 78 55 -45 4 31 54 44 -16 97 13 81 86 -77 87 91 53 33 - 1 84 83 75 40 - -95 46 89 7 38 -83 32 99 44 20 - 6 57 37 34 48 -69 5 84 29 54 -62 27 13 80 53 - -45 92 59 71 83 -52 75 42 46 86 -76 33 50 80 69 -36 89 90 3 31 - 7 5 48 38 53 - -86 80 77 18 87 -79 93 52 17 20 -30 68 48 12 91 -25 98 13 9 47 -45 73 97 15 59 - -93 60 34 18 25 -38 80 81 91 40 -43 87 20 79 7 -70 68 6 24 23 -46 97 32 78 67 - - 9 6 28 17 42 - 2 86 84 90 13 -91 58 16 37 76 -15 3 45 51 4 -64 99 41 59 39 - -44 3 85 80 93 - 0 43 90 40 89 -82 91 55 79 75 -30 5 68 50 1 -37 24 59 62 66 - -38 55 21 45 1 -23 14 95 25 22 -84 10 39 9 0 -17 15 58 70 49 -62 44 77 65 88 - - 8 62 25 75 39 -20 95 65 11 32 - 5 92 15 86 66 -64 34 60 7 85 -10 76 6 53 61 - -71 61 62 25 35 -23 30 37 14 9 -99 98 52 51 19 -77 57 17 72 85 -33 91 31 43 67 - -76 66 39 36 44 -49 97 93 33 52 -13 70 21 17 32 -71 98 80 19 60 -73 15 99 74 9 - -41 8 33 29 87 -42 86 66 31 50 -45 60 83 81 21 -36 4 98 43 0 -49 76 18 90 16 - -83 53 34 39 58 -91 68 17 62 4 - 2 76 44 31 35 -14 61 49 84 92 -73 6 86 27 65 - -56 70 47 60 97 -35 89 26 99 59 -67 23 27 74 65 -61 62 15 18 45 -54 93 0 9 71 - -11 24 97 15 30 -46 74 17 48 43 -16 64 72 60 37 -63 90 41 91 66 -25 95 1 54 49 - -87 67 27 26 38 -63 44 65 25 81 - 1 66 96 62 17 -82 2 58 4 86 -61 64 54 24 90 - -72 94 69 85 43 -38 11 93 39 13 -86 92 12 42 75 - 6 89 58 88 52 -79 19 20 55 14 - -77 93 58 6 52 -27 48 29 60 71 -87 24 25 54 49 -53 38 90 51 80 -57 50 18 1 13 - -85 84 54 2 51 -33 41 0 38 80 - 5 62 1 28 96 -17 88 64 26 90 -78 91 56 34 74 - -83 14 82 6 55 -30 13 99 57 39 -93 73 37 19 8 -29 49 76 22 92 -69 66 9 60 53 - -51 78 52 72 79 -42 55 74 88 44 -90 75 65 87 69 -22 35 64 36 86 -63 41 19 59 49 - -49 86 81 23 12 -93 16 9 8 95 -68 33 4 82 61 -45 28 85 87 38 -35 70 63 18 52 - -63 93 38 34 61 -75 21 86 42 25 -52 85 99 24 36 -41 11 79 54 47 -44 84 65 28 89 - -91 37 30 39 59 - 7 94 90 38 40 -72 21 75 31 61 -68 42 34 20 8 - 3 16 76 44 57 - -32 55 36 81 42 -21 75 68 28 65 -46 70 29 54 64 -66 89 96 25 43 -79 76 41 77 71 - -41 29 60 74 34 -84 49 83 72 92 -22 6 21 17 94 -15 44 62 28 2 -25 93 64 1 42 - -68 76 23 62 10 -36 87 15 12 57 -79 46 18 83 11 -48 81 58 52 28 -72 40 64 55 21 - -25 51 42 63 41 - 0 72 92 23 13 -65 1 69 33 2 -78 27 95 61 55 -30 54 48 3 57 - -50 40 58 66 59 -84 79 64 75 44 -88 93 41 25 97 -19 86 37 91 81 -10 26 94 77 34 - -76 44 11 16 60 -19 92 91 58 50 -97 5 46 4 52 -87 42 65 75 15 -12 2 54 27 86 - -77 38 51 29 89 - 7 76 54 48 44 -88 50 2 5 53 -12 70 26 57 74 -31 19 18 34 47 - -35 99 86 96 62 -61 97 71 70 66 -49 55 36 76 3 -94 23 31 91 26 -80 8 20 95 15 - - 4 96 40 36 12 -87 75 38 30 11 -69 29 23 85 91 -49 5 14 57 24 -88 20 99 78 65 - -34 65 71 79 67 -28 1 33 47 11 -15 86 84 83 55 -35 10 19 63 23 -58 66 45 77 26 - -74 13 25 39 8 -46 47 77 37 0 -60 1 81 42 18 - 5 51 78 30 4 -36 12 10 32 82 - -51 83 58 10 56 -28 18 43 99 14 - 3 57 30 49 88 -20 68 76 73 82 - 1 85 77 22 47 - -50 12 11 97 83 -40 10 49 81 63 -43 15 91 3 2 -52 20 53 89 33 -42 94 59 78 46 - -19 63 86 82 9 -69 13 27 88 37 -45 51 79 11 8 - 2 29 41 84 73 -76 24 78 96 38 - -15 19 88 95 54 -28 94 96 27 26 - 8 82 68 6 71 -33 9 99 62 63 -38 83 41 14 79 - -67 57 2 21 19 -11 79 74 45 95 -42 90 68 47 62 -80 61 1 0 39 -43 76 40 27 66 diff --git a/day04/day04_input_ez.txt b/day04/day04_input_ez.txt deleted file mode 100644 index 669a51d..0000000 --- a/day04/day04_input_ez.txt +++ /dev/null @@ -1,19 +0,0 @@ -7,4,9,5,11,17,23,2,0,14,21,24,10,16,13,6,15,25,12,22,18,20,8,19,3,26,1 - -22 13 17 11 0 - 8 2 23 4 24 -21 9 14 16 7 - 6 10 3 18 5 - 1 12 20 15 19 - - 3 15 0 2 22 - 9 18 13 17 5 -19 8 7 25 23 -20 11 10 24 4 -14 21 16 12 6 - -14 21 17 24 4 -10 16 15 9 19 -18 8 23 26 20 -22 11 13 6 5 - 2 0 12 3 7 diff --git a/day04/makefile b/day04/makefile deleted file mode 100644 index ef809af..0000000 --- a/day04/makefile +++ /dev/null @@ -1,2 +0,0 @@ -all day04.cpp: - g++ -std=c++20 -o day04 day04.cpp diff --git a/day05/day05 b/day05/day05 Binary files differdeleted file mode 100755 index 78ac4fc..0000000 --- a/day05/day05 +++ /dev/null diff --git a/day05/day05.cpp b/day05/day05.cpp deleted file mode 100644 index 895dba0..0000000 --- a/day05/day05.cpp +++ /dev/null @@ -1,100 +0,0 @@ -#include <iostream> -#include <fstream> -#include <string> -#include <vector> -#include <map> - -#include "../utils.h" - -class Line { - public: - Line (int a, int b, int c, int d) : a(a), b(b), c(c), d(d) { } - Line (std::string line) { - std::vector<std::string> parts, start, end; - split(parts, line, "->"); - split(start, parts[0], ","); - split(end, parts[1], ","); - a = std::stoi(start[0]); - b = std::stoi(start[1]); - c = std::stoi(end[0]); - d = std::stoi(end[1]); - if (c-a == 0) xdir = 0; - else { xdir = (c-a) > 0 ? 1 : -1; } - if (d-b == 0) ydir = 0; - else { ydir = (d-b) > 0 ? 1 : -1; } - } - int a, b, c, d, xdir, ydir; - - int length () { return abs(a-c) + abs(b-d); } - - bool operator==(Line& oth) { - return a == oth.a && b == oth.b && c == oth.c && d == oth.d; - } -}; - -int main (int argc, char *argv[]) { - std::string raw; - std::getline(std::ifstream(argv[1]), raw, '\0'); - - std::vector<Line> lines; - std::vector<std::string> strlines; - split(strlines, raw, "\n"); - for (auto strline : strlines) { - if (strline.size() == 0) continue; - Line line { strline }; - if (line.xdir != 0 && line.ydir != 0 - && std::stoi(argv[2]) == 0) continue; - lines.push_back(line); - } - - int intersections = 0; - std::map<std::pair<int, int>, int> overlaps; - for (auto& line : lines) { - int dist = 0; - bool straight = true; - if (line.xdir != 0 && line.ydir != 0) straight = false; - for (int i=0; dist<line.length()+1; i++) { - std::pair pair { line.a + line.xdir*i, line.b + line.ydir*i }; - if (overlaps.count(pair) == 0) overlaps[pair] = 1; - else { - if (overlaps[pair] == 1) intersections += 1; - overlaps[pair] += 1; - } - if (straight) dist ++; - else dist += 2; - } - } - - - int minx = 200; - int maxx = -200; - int miny = 200; - int maxy = -200; - for (auto& line : lines) { - minx = std::min(minx, std::min(line.a, line.c)); - maxx = std::max(maxx, std::max(line.a, line.c)); - miny = std::min(miny, std::min(line.b, line.d)); - maxy = std::max(maxy, std::max(line.b, line.d)); - } - - std::cout << "bounds: " - << minx << " " << maxx << " " - << miny << " " << maxx << std::endl; - - /* visualizer - for (int y=miny; y<maxy+1; y++) { - for (int x=minx; x<maxx+1; x++) { - int amt = overlaps[std::make_pair(x, y)]; - if (amt > 9) amt = 9; - if (amt > 0) std::cout << amt; - else std::cout << "."; - - } - std::cout << std::endl; - } - */ - - std::cout << "intersections: " << intersections << std::endl; - - return 0; -} diff --git a/day05/day05_input.txt b/day05/day05_input.txt deleted file mode 100644 index 58fb409..0000000 --- a/day05/day05_input.txt +++ /dev/null @@ -1,500 +0,0 @@ -682,519 -> 682,729 -852,131 -> 25,958 -303,481 -> 206,481 -199,682 -> 183,666 -363,190 -> 571,190 -930,290 -> 221,290 -364,627 -> 952,39 -234,309 -> 234,821 -130,864 -> 130,886 -462,347 -> 699,110 -375,969 -> 481,969 -989,859 -> 275,145 -221,748 -> 212,748 -870,173 -> 106,937 -604,33 -> 604,142 -780,35 -> 780,206 -636,808 -> 721,808 -944,989 -> 334,989 -477,113 -> 192,113 -879,265 -> 879,358 -754,974 -> 17,974 -10,989 -> 989,10 -337,320 -> 674,657 -225,96 -> 557,428 -129,354 -> 299,354 -717,695 -> 695,695 -94,255 -> 317,478 -90,87 -> 90,187 -77,942 -> 952,67 -804,315 -> 989,315 -619,470 -> 491,342 -466,90 -> 466,755 -840,121 -> 840,469 -638,127 -> 638,77 -844,40 -> 151,40 -653,987 -> 653,631 -195,583 -> 195,623 -88,985 -> 570,503 -921,897 -> 165,141 -230,27 -> 171,27 -737,771 -> 832,771 -563,365 -> 665,467 -942,940 -> 776,774 -12,903 -> 644,903 -308,390 -> 308,971 -572,943 -> 572,15 -104,389 -> 104,73 -346,721 -> 974,93 -30,53 -> 562,53 -804,682 -> 804,120 -952,45 -> 15,982 -475,456 -> 475,348 -409,247 -> 664,247 -345,18 -> 816,489 -571,158 -> 505,158 -59,195 -> 27,195 -230,681 -> 23,681 -258,711 -> 921,711 -658,112 -> 366,404 -842,220 -> 842,825 -815,744 -> 540,744 -192,314 -> 703,825 -869,573 -> 869,888 -603,268 -> 603,301 -816,668 -> 816,189 -148,606 -> 948,606 -117,461 -> 506,461 -986,955 -> 986,315 -131,250 -> 192,189 -988,148 -> 518,618 -682,900 -> 31,900 -652,839 -> 652,236 -466,812 -> 466,611 -881,346 -> 401,346 -229,639 -> 731,639 -104,476 -> 840,476 -10,988 -> 988,10 -29,15 -> 987,973 -825,348 -> 825,240 -989,989 -> 10,10 -430,796 -> 926,796 -49,293 -> 610,854 -325,288 -> 918,288 -625,309 -> 439,495 -536,150 -> 356,150 -834,558 -> 822,558 -315,408 -> 315,635 -257,973 -> 813,973 -713,52 -> 122,52 -323,970 -> 578,970 -447,49 -> 829,49 -941,709 -> 941,390 -148,323 -> 391,80 -23,171 -> 23,49 -475,265 -> 322,112 -506,407 -> 69,844 -567,284 -> 483,368 -114,745 -> 114,765 -392,252 -> 109,535 -65,188 -> 455,188 -732,779 -> 732,52 -233,214 -> 759,214 -232,969 -> 957,244 -20,669 -> 20,308 -49,972 -> 285,972 -501,383 -> 433,383 -918,15 -> 32,901 -255,268 -> 935,948 -757,588 -> 757,919 -530,803 -> 284,557 -688,926 -> 48,286 -331,245 -> 331,777 -448,544 -> 209,544 -10,970 -> 951,29 -233,11 -> 897,11 -145,392 -> 628,392 -935,971 -> 935,280 -169,632 -> 54,632 -155,244 -> 155,334 -56,284 -> 205,284 -553,428 -> 553,520 -977,176 -> 497,656 -323,339 -> 971,987 -616,355 -> 616,248 -72,660 -> 72,334 -644,822 -> 510,956 -356,841 -> 587,841 -413,468 -> 605,468 -85,22 -> 645,582 -924,850 -> 522,850 -448,45 -> 345,148 -102,566 -> 551,566 -80,39 -> 847,806 -936,436 -> 934,436 -53,24 -> 495,466 -234,173 -> 282,173 -145,680 -> 456,680 -960,759 -> 960,282 -984,814 -> 308,138 -398,808 -> 716,808 -509,536 -> 25,52 -289,777 -> 803,263 -766,892 -> 257,892 -301,733 -> 688,733 -24,109 -> 887,972 -180,32 -> 577,429 -985,801 -> 687,503 -901,582 -> 586,582 -50,56 -> 50,267 -344,373 -> 437,373 -542,133 -> 905,496 -420,624 -> 420,716 -645,106 -> 645,574 -356,37 -> 114,37 -324,919 -> 357,919 -126,797 -> 120,797 -288,689 -> 435,836 -93,915 -> 639,369 -106,391 -> 478,19 -277,501 -> 714,64 -253,277 -> 643,277 -568,972 -> 350,972 -213,235 -> 213,406 -595,888 -> 595,233 -577,63 -> 37,603 -649,732 -> 931,732 -469,892 -> 549,892 -953,895 -> 953,457 -222,213 -> 290,213 -841,800 -> 841,336 -685,143 -> 25,143 -441,127 -> 441,146 -646,586 -> 56,586 -698,122 -> 465,122 -641,502 -> 641,240 -111,91 -> 185,91 -927,755 -> 874,808 -108,151 -> 108,567 -309,453 -> 309,210 -890,657 -> 491,657 -404,244 -> 404,123 -939,28 -> 26,941 -596,970 -> 596,870 -489,556 -> 489,589 -607,621 -> 903,325 -912,284 -> 571,284 -921,702 -> 743,524 -719,36 -> 719,394 -100,905 -> 798,207 -316,260 -> 316,887 -799,940 -> 885,940 -835,287 -> 199,923 -422,760 -> 64,760 -727,113 -> 727,679 -733,56 -> 59,730 -141,399 -> 485,743 -769,629 -> 769,797 -62,486 -> 62,205 -192,332 -> 800,332 -15,931 -> 727,931 -854,915 -> 988,915 -349,610 -> 886,610 -72,110 -> 72,903 -955,110 -> 78,987 -591,553 -> 591,428 -708,467 -> 516,467 -397,589 -> 353,589 -930,336 -> 930,532 -639,50 -> 228,50 -472,17 -> 472,244 -420,825 -> 420,562 -203,197 -> 203,35 -984,964 -> 223,203 -944,269 -> 935,260 -933,119 -> 87,965 -696,290 -> 696,580 -925,960 -> 52,87 -451,470 -> 235,254 -562,71 -> 562,149 -405,126 -> 405,67 -356,424 -> 356,673 -859,649 -> 859,291 -210,651 -> 210,544 -403,783 -> 403,122 -672,87 -> 586,87 -409,668 -> 984,668 -917,352 -> 511,758 -395,953 -> 141,953 -152,795 -> 152,313 -839,344 -> 811,372 -114,649 -> 650,649 -60,517 -> 60,27 -448,392 -> 845,392 -33,849 -> 719,163 -151,988 -> 876,988 -805,556 -> 124,556 -361,538 -> 706,193 -974,941 -> 141,108 -271,813 -> 968,116 -500,697 -> 80,277 -586,731 -> 586,480 -128,147 -> 174,101 -882,681 -> 882,745 -531,730 -> 677,730 -989,11 -> 11,989 -74,332 -> 234,492 -360,326 -> 932,898 -136,288 -> 113,311 -666,645 -> 916,895 -977,478 -> 561,62 -20,83 -> 566,83 -331,942 -> 331,646 -180,291 -> 405,291 -637,763 -> 637,941 -120,138 -> 120,820 -951,24 -> 14,961 -204,304 -> 204,51 -84,168 -> 880,168 -955,145 -> 955,903 -437,427 -> 437,354 -875,67 -> 189,753 -46,767 -> 802,11 -52,59 -> 889,896 -926,56 -> 102,880 -500,30 -> 964,30 -329,488 -> 329,972 -63,11 -> 889,837 -707,168 -> 707,584 -580,10 -> 735,10 -105,620 -> 105,110 -187,531 -> 323,531 -82,947 -> 82,941 -737,199 -> 737,851 -612,650 -> 217,650 -971,15 -> 82,904 -16,590 -> 506,100 -950,877 -> 832,759 -570,470 -> 570,276 -213,411 -> 213,195 -670,755 -> 89,755 -906,963 -> 906,984 -458,463 -> 442,463 -956,969 -> 10,23 -87,215 -> 195,107 -819,454 -> 819,467 -594,793 -> 686,793 -395,724 -> 787,332 -315,461 -> 644,461 -448,247 -> 249,48 -620,302 -> 247,675 -607,134 -> 932,134 -312,776 -> 312,289 -850,942 -> 54,146 -31,538 -> 851,538 -729,126 -> 640,126 -702,199 -> 702,706 -402,783 -> 254,783 -110,59 -> 203,59 -27,10 -> 965,948 -747,261 -> 47,261 -628,742 -> 972,742 -712,742 -> 657,797 -877,871 -> 877,758 -665,313 -> 449,529 -498,157 -> 498,68 -870,922 -> 27,79 -856,697 -> 856,429 -447,271 -> 963,787 -495,302 -> 495,520 -526,47 -> 721,47 -826,179 -> 826,741 -565,461 -> 893,461 -512,328 -> 127,328 -487,920 -> 522,920 -614,452 -> 614,146 -331,574 -> 331,840 -985,79 -> 285,779 -812,320 -> 985,320 -118,69 -> 429,69 -644,525 -> 644,878 -271,132 -> 156,132 -955,782 -> 565,392 -630,939 -> 630,372 -51,203 -> 840,203 -202,490 -> 202,479 -579,868 -> 579,92 -979,336 -> 979,623 -843,865 -> 260,282 -685,872 -> 685,503 -721,193 -> 721,510 -908,661 -> 908,955 -19,950 -> 715,254 -233,730 -> 233,101 -922,954 -> 27,954 -399,444 -> 399,403 -380,712 -> 380,718 -238,264 -> 849,875 -458,577 -> 458,139 -418,244 -> 469,295 -460,375 -> 964,879 -276,445 -> 815,445 -463,910 -> 648,725 -26,384 -> 968,384 -955,385 -> 955,143 -942,775 -> 733,566 -425,326 -> 531,326 -364,545 -> 364,873 -182,759 -> 182,819 -390,757 -> 390,475 -217,417 -> 217,157 -669,286 -> 65,890 -257,11 -> 257,858 -557,397 -> 557,20 -888,946 -> 32,90 -971,938 -> 971,578 -874,248 -> 874,485 -87,268 -> 87,135 -756,679 -> 103,26 -771,250 -> 771,107 -320,711 -> 967,711 -293,219 -> 293,706 -103,565 -> 103,538 -388,256 -> 388,261 -468,953 -> 503,953 -424,142 -> 287,142 -24,930 -> 850,930 -316,167 -> 316,161 -481,421 -> 208,148 -938,926 -> 938,933 -701,653 -> 701,780 -536,390 -> 536,559 -40,954 -> 829,165 -404,985 -> 247,985 -94,628 -> 94,500 -441,637 -> 441,271 -766,946 -> 97,277 -428,363 -> 428,37 -542,694 -> 542,347 -11,16 -> 979,984 -938,651 -> 632,957 -779,127 -> 243,663 -636,294 -> 636,787 -533,744 -> 636,641 -521,950 -> 458,950 -988,12 -> 18,982 -954,621 -> 954,271 -638,951 -> 813,951 -822,911 -> 632,911 -714,849 -> 512,849 -696,88 -> 385,88 -65,451 -> 65,687 -976,973 -> 976,907 -368,489 -> 368,571 -358,831 -> 690,499 -436,704 -> 178,704 -690,619 -> 606,535 -96,701 -> 358,701 -885,562 -> 420,562 -581,480 -> 613,512 -44,970 -> 970,44 -216,796 -> 892,120 -72,623 -> 72,72 -896,283 -> 896,326 -794,195 -> 22,967 -134,326 -> 134,889 -420,141 -> 944,665 -941,194 -> 941,421 -940,525 -> 298,525 -653,300 -> 769,300 -227,424 -> 406,603 -275,850 -> 113,850 -648,850 -> 92,850 -638,389 -> 638,10 -379,404 -> 584,609 -833,931 -> 833,520 -772,286 -> 500,558 -372,262 -> 333,262 -689,18 -> 131,576 -687,499 -> 687,188 -344,499 -> 37,806 -778,496 -> 134,496 -938,87 -> 344,681 -788,401 -> 479,401 -828,903 -> 756,903 -423,625 -> 285,763 -218,489 -> 218,819 -488,384 -> 891,787 -817,532 -> 788,532 -512,27 -> 512,149 -369,794 -> 54,794 -534,590 -> 827,883 -84,310 -> 39,265 -357,545 -> 665,545 -539,807 -> 539,781 -378,683 -> 22,327 -71,909 -> 943,37 -740,552 -> 348,552 -698,315 -> 45,968 -516,835 -> 360,835 -629,141 -> 629,385 -695,908 -> 303,908 -795,707 -> 386,707 -211,397 -> 291,397 -64,620 -> 236,620 -97,638 -> 97,445 -46,103 -> 893,950 -468,122 -> 979,122 -810,486 -> 433,486 -532,899 -> 461,970 -232,60 -> 235,60 -549,708 -> 549,90 -294,978 -> 294,124 -865,406 -> 640,406 -755,305 -> 664,305 -12,989 -> 987,14 -275,249 -> 260,234 -502,783 -> 67,783 -863,938 -> 297,372 -516,961 -> 516,272 -67,510 -> 611,510 -980,951 -> 312,283 -325,512 -> 325,169 -142,429 -> 542,29 -273,964 -> 822,964 -370,217 -> 508,217 -131,131 -> 331,331 -734,824 -> 734,817 -75,89 -> 687,701 -155,255 -> 702,802 -577,395 -> 130,395 -684,94 -> 555,94 -393,881 -> 173,881 -894,750 -> 773,750 -380,269 -> 380,338 -427,36 -> 427,77 -637,107 -> 637,846 -53,437 -> 53,221 -128,979 -> 960,147 -838,211 -> 838,645 -898,39 -> 849,39 -862,495 -> 951,495 -754,406 -> 76,406 -951,960 -> 113,122 -830,125 -> 15,940 -190,117 -> 190,973 -192,956 -> 718,430 -895,162 -> 88,969 -135,196 -> 70,131 -578,642 -> 578,789 -713,268 -> 625,268 -938,719 -> 938,604 -30,863 -> 99,863 -844,309 -> 287,309 -131,837 -> 459,509 -61,206 -> 722,867 -95,974 -> 283,974 -746,672 -> 558,672 -552,32 -> 352,32 -21,637 -> 21,781 -945,847 -> 945,303 diff --git a/day05/day05_input_ez.txt b/day05/day05_input_ez.txt deleted file mode 100644 index b258f68..0000000 --- a/day05/day05_input_ez.txt +++ /dev/null @@ -1,10 +0,0 @@ -0,9 -> 5,9 -8,0 -> 0,8 -9,4 -> 3,4 -2,2 -> 2,1 -7,0 -> 7,4 -6,4 -> 2,0 -0,9 -> 2,9 -3,4 -> 1,4 -0,0 -> 8,8 -5,5 -> 8,2 diff --git a/day05/makefile b/day05/makefile deleted file mode 100644 index a197e7d..0000000 --- a/day05/makefile +++ /dev/null @@ -1,2 +0,0 @@ -all day05.cpp: - g++ -std=c++20 -o day05 day05.cpp diff --git a/day06/day06 b/day06/day06 Binary files differdeleted file mode 100755 index ccf553a..0000000 --- a/day06/day06 +++ /dev/null diff --git a/day06/day06.cpp b/day06/day06.cpp deleted file mode 100644 index 38d602b..0000000 --- a/day06/day06.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include <iostream> -#include <fstream> -#include <string> -#include <vector> - -#include "../utils.h" - -long sum (std::vector<long> vec) { - long s = 0; for (long v : vec) s += v; return s; -} - -int main (int argc, char *argv[]) { - std::string raw; - std::getline(std::ifstream(argv[1]), raw, '\0'); - std::vector<std::string> strfish; - split(strfish, raw, ","); - - std::vector<long> fish; - for (int i=0; i<9; i++) { fish.push_back(0); } - for (std::string str : strfish) fish[std::stoi(str)] += 1; - - int days = 80; - if (argc > 2) days = std::stoi(std::string(argv[2])); - for (int i=0; i<days; i++) { - long born = fish[0]; - fish[0] = 0; - for (int j=1; j<9; j++) { - fish[j-1] += fish[j]; - fish[j] = 0; - } - fish[6] += born; - fish[8] = born; - - if (argc > 3 && std::string(argv[3]) == "-w") { - std::cout << "day " << i+1 << "/" << days - << " current fish: " << sum(fish) << std::endl; - } - if (argc > 3 && std::string(argv[3]) == "-v") { - std::cout << "day " << i+1 << ": "; - for (auto f : fish) std::cout << f << ","; - std::cout << std::endl; - } - } - - std::cout << "fish: " << sum(fish) << std::endl; - return 0; -} diff --git a/day06/day06_input.txt b/day06/day06_input.txt deleted file mode 100644 index 5b38bce..0000000 --- a/day06/day06_input.txt +++ /dev/null @@ -1 +0,0 @@ -4,1,1,4,1,1,1,1,1,1,1,1,3,4,1,1,1,3,1,3,1,1,1,1,1,1,1,1,1,3,1,3,1,1,1,5,1,2,1,1,5,3,4,2,1,1,4,1,1,5,1,1,5,5,1,1,5,2,1,4,1,2,1,4,5,4,1,1,1,1,3,1,1,1,4,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,1,1,2,1,1,1,1,1,1,1,2,4,4,1,1,3,1,3,2,4,3,1,1,1,1,1,2,1,1,1,1,2,5,1,1,1,1,2,1,1,1,1,1,1,1,2,1,1,4,1,5,1,3,1,1,1,1,1,5,1,1,1,3,1,2,1,2,1,3,4,5,1,1,1,1,1,1,5,1,1,1,1,1,1,1,1,3,1,1,3,1,1,4,1,1,1,1,1,2,1,1,1,1,3,2,1,1,1,4,2,1,1,1,4,1,1,2,3,1,4,1,5,1,1,1,2,1,5,3,3,3,1,5,3,1,1,1,1,1,1,1,1,4,5,3,1,1,5,1,1,1,4,1,1,5,1,2,3,4,2,1,5,2,1,2,5,1,1,1,1,4,1,2,1,1,1,2,5,1,1,5,1,1,1,3,2,4,1,3,1,1,2,1,5,1,3,4,4,2,2,1,1,1,1,5,1,5,2 diff --git a/day06/day06_input_ez.txt b/day06/day06_input_ez.txt deleted file mode 100644 index 55129f1..0000000 --- a/day06/day06_input_ez.txt +++ /dev/null @@ -1 +0,0 @@ -3,4,3,1,2 diff --git a/day06/makefile b/day06/makefile deleted file mode 100644 index 2bc132f..0000000 --- a/day06/makefile +++ /dev/null @@ -1,2 +0,0 @@ -all day06.cpp: - g++ -std=c++20 -o day06 day06.cpp diff --git a/day07/day07 b/day07/day07 Binary files differdeleted file mode 100755 index 4cbc735..0000000 --- a/day07/day07 +++ /dev/null diff --git a/day07/day07.cpp b/day07/day07.cpp deleted file mode 100644 index f9bbd1a..0000000 --- a/day07/day07.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include <iostream> -#include <fstream> -#include <string> -#include <vector> - -#include "../utils.h" - -long sumdist (std::vector<int> pos, int pole, int inc) { - long sd = 0; - for (auto p : pos) { - int n = abs(p-pole); - if (inc == 1) n = (n * (n+1)) / 2; - sd += n; - } - return sd; -} - -int main (int argc, char *argv[]) { - std::string raw; - std::getline(std::ifstream(argv[1]), raw, '\0'); - std::vector<std::string> vec; - split(vec, raw, ","); - std::vector<int> pos; - for (auto s : vec) pos.push_back(std::stoi(s)); - - int minp = 10000, maxp = -10000; - for (auto p : pos) { - minp = std::min(minp, p); - maxp = std::max(maxp, p); - } - int inc = argc > 2 ? atoi(argv[2]) : 0; - long fuel = 100000000000; - for (int i=minp; i<maxp; i++) { - fuel = std::min(fuel, sumdist(pos, i, inc)); - } - - std::cout << "fuel: " << fuel << std::endl; - - return 0; -} diff --git a/day07/day07_input.txt b/day07/day07_input.txt deleted file mode 100644 index 4ac01fd..0000000 --- a/day07/day07_input.txt +++ /dev/null @@ -1 +0,0 @@ -1101,1,29,67,1102,0,1,65,1008,65,35,66,1005,66,28,1,67,65,20,4,0,1001,65,1,65,1106,0,8,99,35,67,101,99,105,32,110,39,101,115,116,32,112,97,115,32,117,110,101,32,105,110,116,99,111,100,101,32,112,114,111,103,114,97,109,10,601,578,981,315,530,525,671,1501,616,214,724,1247,543,58,183,282,242,54,90,130,1788,360,1719,710,1165,1476,29,744,164,293,1360,274,47,119,16,387,134,547,72,48,77,416,863,39,65,144,500,678,430,160,1689,550,753,1478,480,56,583,85,206,93,335,990,174,276,1119,52,308,470,563,387,897,21,85,720,983,178,383,134,299,722,57,391,489,768,232,646,1312,1316,31,57,927,176,531,421,1162,369,934,7,172,237,340,169,261,1371,1351,1268,72,58,375,1570,1238,55,513,403,1462,141,263,419,1316,852,251,39,358,209,204,439,150,1667,344,205,1299,1226,992,967,536,1160,1503,1154,1323,486,1079,329,823,506,1252,387,28,69,649,296,233,62,219,344,464,1284,291,234,47,949,1126,935,1367,1450,1431,379,344,478,731,648,77,184,927,211,262,728,1093,381,140,239,332,1436,78,665,1486,601,1444,364,1057,753,488,127,1001,350,1016,357,638,309,40,333,136,655,779,821,414,275,140,149,185,445,1169,476,196,907,1570,193,161,43,204,1489,1125,1024,101,17,592,1378,338,1625,3,269,1568,254,803,25,776,109,52,291,1595,255,739,34,768,378,632,4,181,373,162,562,74,85,160,16,47,38,266,1610,9,7,1398,358,287,450,188,1390,37,98,80,685,1645,50,55,16,542,20,443,848,49,808,76,233,69,110,471,73,408,638,89,861,280,1062,75,314,808,237,96,401,57,48,1306,115,1164,1533,5,1032,1314,66,630,96,496,116,1558,438,13,182,1360,802,101,327,370,444,335,812,430,900,1259,1117,318,118,433,501,401,101,582,27,454,981,776,14,26,163,384,1652,87,788,474,588,155,845,207,33,200,622,840,1360,432,11,525,86,296,481,200,529,95,924,431,40,846,220,285,14,66,755,111,647,643,1201,81,483,555,125,426,1499,29,115,48,39,92,316,434,217,218,116,9,33,496,358,1106,736,1181,1153,117,20,1719,1113,1620,26,581,407,114,1559,6,1918,964,909,340,630,817,473,111,1485,434,262,1702,651,11,182,1043,1904,633,336,252,677,1238,637,1008,82,327,171,185,19,141,395,1209,53,798,836,1378,598,262,298,265,287,85,21,249,848,162,89,1050,108,34,41,25,291,918,28,1234,139,351,867,146,79,995,1173,635,24,31,81,214,1114,155,1256,159,206,586,426,452,650,1653,47,42,264,240,500,864,893,1308,1249,853,286,62,592,102,77,1082,91,120,625,211,978,319,655,200,152,86,396,52,308,1479,38,41,53,179,648,216,41,641,659,1556,226,1421,291,33,1461,1095,529,309,1100,314,1695,505,1200,150,946,53,124,139,1506,52,33,463,613,33,1264,386,678,563,564,318,273,912,60,31,150,1321,133,1333,302,1243,49,421,808,1399,555,195,611,268,39,1302,1154,92,664,117,92,124,332,561,1436,865,198,71,271,909,40,1185,664,251,422,306,122,814,158,1676,122,217,312,952,845,104,572,1796,392,651,176,714,44,757,111,56,489,333,738,369,304,1239,105,297,277,674,213,938,2,681,336,171,1252,166,88,489,273,260,565,231,319,1085,650,211,510,12,511,325,46,107,980,1136,16,95,308,935,514,469,20,44,209,345,467,1310,500,75,594,166,199,741,193,28,52,106,1437,366,575,1200,609,678,534,573,723,325,8,386,268,690,321,186,375,2,104,657,1341,601,175,0,745,146,508,180,426,811,7,215,300,86,25,372,233,900,276,1625,808,1941,510,234,813,131,334,58,783,992,236,244,174,609,1581,1767,204,187,208,1340,347,803,146,299,140,142,339,60,118,300,809,276,413,267,946,77,154,466,425,193,187,852,674,2,17,1006,1007,166,195,137,97,41,407,65,1072,20,789,311,1227,20,132,1536,995,194,506,635,115,1500,529,93,72,950,208,944,1177,476,207,1228,5,974,226,225,290,690,581,218,401,49,361,1408,242,254,24,313,441,635,126,513,994,299,1722,52,1123,44,1332,628,534,789,298,692,45,596,1583,77,15,38,1293,1181,1498,772,148,297,49,692,87,594,49,148,170,54,1079,7,468,847,336,421,34,1108,406,892,689,245,298,85,1187,1142,286,310,207,34,660,549,39,1172,97,1,750,47,0,77,1632,135,54,18,22,1292,230,1031,11,225,820,461,1208,108,1443,274,1134,41,287,166,274,1032,585,1491,75,549,1231,1314,443,212,395,386,698,58,644,395,81,905,366,233,716,656,799,643,1011,173,790,360,269,930,13,606,488,387,1206,51 diff --git a/day07/day07_input_ez.txt b/day07/day07_input_ez.txt deleted file mode 100644 index 18bd32a..0000000 --- a/day07/day07_input_ez.txt +++ /dev/null @@ -1 +0,0 @@ -16,1,2,0,4,2,7,1,2,14 diff --git a/day07/makefile b/day07/makefile deleted file mode 100644 index 2856268..0000000 --- a/day07/makefile +++ /dev/null @@ -1,2 +0,0 @@ -all day07.cpp: - g++ -std=c++20 -o day07 day07.cpp diff --git a/day08/day08 b/day08/day08 Binary files differdeleted file mode 100755 index 7f591be..0000000 --- a/day08/day08 +++ /dev/null diff --git a/day08/day08.cpp b/day08/day08.cpp deleted file mode 100644 index 30b818b..0000000 --- a/day08/day08.cpp +++ /dev/null @@ -1,72 +0,0 @@ -#include <iostream> -#include <fstream> -#include <vector> -#include <string> - -#include "../utils.h" - -int distance (std::string a, std::string b) { - int d = 0; - for (auto k : b) { - if (a.find(k) == std::string::npos) d++; - } return d; -} - -int map (std::vector<std::string> tries, std::string dig) { - if (dig.size() == 2) return 1; - if (dig.size() == 3) return 7; - if (dig.size() == 4) return 4; - if (dig.size() == 7) return 8; - if (dig.size() == 4) return 8; - - std::string one = *std::find_if(std::begin(tries), std::end(tries), - [](std::string &str){ return str.size() == 2; }); - std::string four = *std::find_if(std::begin(tries), std::end(tries), - [](std::string &str){ return str.size() == 4; }); - if (dig.size() == 5) { - if (distance(dig, one) == 0) return 3; - if (distance(dig, four) == 1) return 5; - return 2; - } - if (dig.size() == 6) { - if (distance(dig, one) == 1) return 6; - if (distance(dig, four) == 0) return 9; - } - return 0; -} - -int main (int argc, char *argv[]) { - std::string raw; - std::getline(std::ifstream(argv[1]), raw, '\0'); - std::vector<std::string> lines, parts; - split(lines, raw, "\n"); - - std::vector<int> count; - for (int i=0; i<8; i++) count.push_back(0); - - int sum = 0; - for (auto line : lines) { - if (line.size() == 0) continue; - parts.clear(); - split(parts, line, " | "); - - std::vector<std::string> tries, digits; - split(tries, parts[0], " "); - split(digits, parts[1], " "); - - int i = 1000; - int num = 0; - for (auto dig : digits) { - count[dig.size()]++; - num += i*map(tries, dig); - i/=10; - } - sum += num; - } - - std::cout << "digits: " << count[2] + count[3] + count[4] + count[7] - << std::endl; - std::cout << "sum: " << sum << std::endl; - - return 0; -} diff --git a/day08/day08_input.txt b/day08/day08_input.txt deleted file mode 100644 index cf25f77..0000000 --- a/day08/day08_input.txt +++ /dev/null @@ -1,200 +0,0 @@ -bfdcga cgdfe egfda cbfeda ec efc gcfbd ebcg gdfbec adcgfeb | bgdfc ec dfgae gefcd -cafgbd bc gfdbae eacfb cbf debaf cdgefba fecag fbcdae ecbd | cdfabg cb adgfcb bface -afg daecgf aefbgdc fbge fg dabfg efabgd cbadge abcfd gbaed | acbdf egbda adbge fg -cbeafg fadce cdeabfg gbdefc ged ebcgf bfgd dg ecdgf bgedac | fgdb afcbeg gcfeba edg -efd aegdb efgdcb bafcd acef dfaeb ef fgbadec cadfgb bfecda | fedgcb begcfd def gfdbac -badce gbcda gad fgdc acbgf cfbage gcfbad gd dbafeg afcbged | ebdfag dfcbag gd fdeagb -gdbcaf da dcbeg cad edcbfg gdea baedc afbec baegdc gbfaedc | gbdcaf dbgec da gaed -bedga agbefd dbgfca gcafdbe begcdf gdabf abegc deb ed adef | bgade gacbe ebd cbefdg -eg edfcab gfde abedf fbgdea bgcad gefcba agbed ebg eafbcgd | ge fbdeca bdcfega cgadb -dgbaecf fegbd de fbgade fde gecfb ebda dbgfa dfegca dfagbc | afcegd fgdabce de efgdac -dgafe deafbg gdecbfa fgcad beagd gfbcae efa dbfe ef dcgeba | gafedb debacg ef dfbe -gbadcf bcade efdgbac bcf acebf bf egcfa ebdf acbgde cdabfe | fbcea eafcg fcbea dcbafge -dcfbge ecdabg gfbdae afecb cbg cbgae gacedbf gadc cg bedag | bgdae becga bdcgfe ebcgda -bde eb cgbfade cdgbef beag gabdf dafeb cadfe agdfcb eadgfb | begfdc dfbcga abfdg edagbf -dcbgea fced cgeaf cfaged gdeac dgbfca fc badgfce cfg egbfa | fbcdag feagb cdef fcg -gfdbc adebcg cbg dfcaeb cg bcaefdg bdgfec bdagf dcfeb egcf | fbgda aedfcb cfgbde defgcb -daf cagfeb adeg dcbef cdgbaf da efcag fbdegca ecafd dcaegf | da bgeafc bgdfac ecgdaf -gfdaeb gfde agebf bgf fg bgcfad afbde fdaecb dbeacfg eabcg | gecab baedf eadfb gcbdfa -bagcfed eafb acfgd cebdfg ead agbdef baedcg egfbd agefd ea | gacfd bgfed fgdae bfdeg -cgfab adcfebg cgdef eabc feagbd ebcfg feb eb bdfcga gbcfae | defgc bdcafg fgdec cegbf -cdfab gdf cfebg decbaf gd dcgbaf gcbfd cgad egdbaf badcfeg | gfcbd gd cbgfe ecbafd -faebd ba efacgd baedcf adcef abf dcfbgae dbac gdbfe begcaf | dcab dafec fecadg ebdfa -dfceab egbadcf ba fdcbg feba cgdfae dbegac abdfc cba ecfad | defacg dgbcf gbdcf efcdbga -cadgb bedg fgaceb eacbgd egbac cefadg gd cafdb eabgdfc gad | afgdce adcgb gbacd adg -acb adcgf adcfeb baedg cb becagd bfcadge abcdg ebgc gfdeba | gdafc acfdeb cb aebgd -fabcgd fcdgae facde bcafeg da geda gcebadf befcd eagfc adf | cfage fgeac fgdbaec fgeac -bafeg fabcdg efdgabc fgdbea gdae ae dgafb bae ebgcf fcadbe | begcf abgfe aegbf efbadc -fdeca cadegbf gce bafdge abcdeg dcgb ebcfga cg deagb dagce | bdeag aebdgf gce dbage -fcgbde cdgaebf dgbaef fed bade ed adfgb efdag fdabcg agefc | gfdab adbcfg gcfae dfagb -ebdgfc febad adbfc fc bdfcea badfge cfb eafc acdgb egcfdba | acbgd bgfead dfabc fcea -eb ebaf cbdgef gaedb afgebdc febdag dgefac agbcd beg deagf | dgfcea efabdg egabd geafd -cedfba efgbd gfbdac gfaecd bfa gdfba bcag ab cgdfa begdafc | dfbace dfgeb eafcdbg dfcag -cfdbge gdbefac dabf dgbcfa gacdf gebca fb agefdc bcgaf fbc | afbd gbcafed acgeb ebgfdc -fgbec fbgcd fdbaceg gafedc bfacge fge eafb agbced cbgea fe | abgce fadegc ebacg fagecd -bdgec bgecfa fcbed debfcg acebfd gcb adbecgf gb aegcd gbdf | ebgfdc geacbfd gcb gb -fbea bdfcag dceabg egfcd edcfbga abdge af adf dfbage egfad | fa deacgb agfdbce ebdag -abdecfg gbacf fdbcge gfd dg gdafbc adgb acfde fadgc fbeagc | dcgebf dacgf agfbc cdagbf -agcefd ged bdfagc ed ebdgf fcdbge dgfbc abegf cdfegab debc | cagdfe ged cgdafb bafdcg -cebgad fdgea abgf fdbcae af baedg dgfeba dfbagce edgfc fea | dabegcf agdbe afe acfedb -agdfe fedbcga gfedbc agcbe edb db fdba edbgaf gedafc abdeg | cdgabfe afegbd fegbcd eafgd -dea abgdfe edgfbac egdab de cadbef adfbg gbcea gfde dabgfc | cdafeb ed bafgde ed -adgfb cdgefa ea fea bcdef cfagbd fgecabd febda agbe fgabed | cdefb gbea bdacfg dcbef -cadbg ea fdgeab afcedg dae ebcfdga cdfge afec dbfgce ceagd | fbeacdg dgcab bgdca dae -ecdbfg caebd fcgde fgda aefbcg afedc fcabegd aef gcdaef af | ecdfa bdecfg fea dgcfbea -dbcagf afgec fcadb ead daefc dbcgae edfb cagbdfe fcdbae de | egdabc fdagbc cgafbd afdec -dgfabe egdcbfa beacdg dbcfg aefc cdbaf fbadec fa aedbc fab | eacf bcdfg efca ecbad -defbgc gbdef cg edgc egbadfc cbgef gafdeb gcf eacbf gbfdca | fbedg decg cgf egfcb -cfdgae abdgf gbcd cfdaeb afebcgd cafgd bdf bcfgad db gefba | egfba decgfa abfeg eafdcg -dfagb gdbface adefbc gbfae gae begc acebgf fdgeca ge cefba | cgefab dfgace fecagd beadfc -fedacgb ed cabdfg bfgade dbaefc gdfba def gead bgcfe bdfeg | adcefb gdbaf egad caebdf -agfbed ecfbg cdge cgb fcgbde ebcaf adfbcg dcegabf cg efdgb | bdfcga bfeadg ecgfb cg -bec becfdag bgcaf eb debf adcef cefba fbcade acbged fcadge | edacfb fdeca fgabc cgafb -bfcae gabc fegcdb adefgbc bcgfae gfb fbgea fdabec adgfe bg | dfcgeb fgbae fgb bedgfc -afedcbg ed dfagc gefcd dec agbdec bfecg gfedca efad dfabcg | edaf dec begadc dfagbc -cgebd befcadg ecg ec fcde dbfgc fgdabc becfga aegbd bfcged | cbgafd bcgfd fedc gfdbec -dfabeg acfebd bgfcde begfd bcagd cdafgbe gabed aeb fgae ea | gbedf gdebfa bfegcd bgefd -gdf dagec gf cfdbega cfdba edbcga ceadfg fcdag aegf cdbfge | eafg fgd dfg bdegcf -bcfae fabge cdegabf cdae ebc dfcba ecbdfg ce dagcfb fbedca | fdagcb bcedfa fceabdg adce -cgbaf ad fgcadeb cbfdae fbgdac bgda egdfc cefbag adc fcadg | cfdgbae adc ecafgb dgabfc -bafdc cfb cf abcfged acdbge dbgca aefdb afcg afcdgb gbefdc | dabfc cagf efbcgd abecdgf -de abgefdc fbed adbcgf gaecf eda aebdgf adbecg fegda bfagd | feagbd dbgfac ade adgfe -gacefb faebcgd decfgb fa abdgfe afb fdbge dacbg adfgb edfa | dgbac abcgd gbadc adbgf -fbadg fgbde fagebd agbcf gad gfcbed abde da cbdfaeg afegdc | ecfbdg agd efdgcba aefbdg -cbdge gfecd cfe cafgd dbfe fe bgefdca gedfcb gebfac dgbcea | dgecb bagcfde gecbaf gacbef -dfgecb agbfe dbeacf ebcdf cbad cadfbeg ca cfa abcef edfcga | afgdbce cabd fcbdae becaf -abcd fbade befdcag da fecdag ecfdab bgfced bfedc dae gbaef | da ebfdc cabd cfedbg -ecdab cfaged cbfd cfebad begda agbfce fecba cd acd fedcbga | cfdage daecb febca ebacf -fcdageb beadf dag dacfbg bacge deabg dfcabe gdbaef degf gd | bafcdg dgafbc bdaef gd -febcg cefbagd fegdbc bfeac ab gcba bfa fdbega cedfa cgfeab | eagbcf cbgef afb fcgbae -egfac acbdge fadcbg bgcedfa bdcafe bf ecadb fdeb fecba bfc | fgdcabe dcbfga aegcf fbcadeg -gcfebd acdgb faedcb gcdfb fd gdfe fcgbe fgacdeb baefcg dbf | cgfdb bgdcf gabcd edcbgf -aced fbacg adbcf cd fbade cdb decfbg faegdcb gedabf ecdfba | bdfae fdgcbae fdbgec fdecgb -gdbeac dfcaeb afbgecd dbcgf af fbacg cegbfa fba cagbe geaf | fgbdcae eabcg caebg afeg -ebfda dgfbe ae fcbgead deafgc fdbac eaf gaeb ecdbgf ebfgad | baedf debgfca efcbdg ea -dgcfe acbef cgaef fbdgace ecafbd gcebfa ga age gdfeba bgac | adfbce ga cegfa abcg -abcgd facd fag eacfbg gafdb fa bgfacd dcgeba befgd efgacbd | bdcegfa gbdaf cbgda egabcfd -bdefcga aecbg cgde agbed ecabfg dgb befda gcadbe gdbcfa dg | acgdeb dgb bfaed adbeg -cefgb bde adgceb dafgebc aefd debgaf gfedb agfdb de cgdfba | defa edbgf afbdg bgfad -fa caefg egcab fca gdbcea abef bceagdf dcfge acgfdb afbgec | abfe faebcg acgef geacf -cbfed egacdb eabfgd gdbac deacgfb aeb eacdb gacfbd ea cage | dbegacf aecdbg cage dcgbae -efgad agedcbf bcea ba ebdcfg efbcag bgaef gfabcd bga gfbce | fgdae ba fedgbc egfba -dbcfa bcagd gdbfae cdfg fecab bcfadg dcbgae dfb fd bcadfeg | daegbc befca cbfae dbgcae -egfa bcgdafe dcfea dcfeba cafgbd gf edgbc gfd egfdc edcgaf | gf dgafce fdg efcbda -fgecd afgcde gfcadeb dbcg dcfbeg facbe gbf gfbec gdeafb gb | abdgfe cegdf bgf ecgfbad -gdcbafe gaf agcfe bafc gfdcbe gbfdea cfegb gaedc gfbace fa | bfeacg acgfe bcaf gcade -egbcf fgcea decbf dgabef gb fabedc fbecdag fgdbec bcdg beg | bgdfaec acgdbfe defbca fcdeb -bdeafc cabegd acdbe fdba cfb bf edcfagb fecag cbafe bcfgde | bfda fdgaebc dbaec fb -bc ebdcg agcfebd cadeg ecb fdbaec befgd cbdgfe gabfed bgfc | dagbef bcgdfe bgedaf gdace -eb ebf gaedfc fagdb cabe fabecg bagef bdgafce cgdefb efcga | beacfgd efgbca efbgca ebfgac -cagdf gdacef fcdbga cb gcadb bgc fcab dbfcage baged gbdecf | aefcdg cb agdfc bdgfec -dfbaec abegdf daf edbgcaf bgfd eafgc gafed fd bedag gebdca | ecfgbda beafdgc facebd bdeag -bfaegd dbecga fcadbg dcfg dabcg gf acbfe fgbca fga aegdfcb | cegbda ecabdgf egcafdb fgcd -dbgcea agc aegbc fgceda abdfce cbdg begaf adbcefg cbade gc | dfecba gbedac cdfeab abecg -cfdeab fgbec eadg bga ga dcebagf beadgc gaebc bgfdca bcead | bgaced bdeacg cbgea beacgdf -bagfce ebcdfg fa cgade cfa bfcgeda ecbdf adfb fecbad efadc | ecdbf cfa bfceag bdfeac -af egdaf aef eacdg fdgeca cafg cdgfabe baedgc edfbg acbdef | edfga decagb bdecfa dacfge -dab gfbed bfdage ebdcgf baecg da dfacbeg eagbd beacfd gadf | egbda cbdfae cfadeb egabfd -bcgfaed bfgade bd gfcda acgedb bacefg caebg cbed abdcg bdg | cebag fcebag dbcaeg gbd -dgcfb begdf def fbaegd fegab ed cebagf cefdgab cebdfa gade | ebgdacf aefbgd de gfdbae -ab abdf agbcde aegfb eafgc fgcdeb fbged bea bgafced efdbga | gbafe gbafed gaefdcb gdfbec -eafbg abgdf eg aceg gabfce fge fcbedg ecfabd bafdceg caebf | cedbfa gbface eg fagbe -face bfe adgfeb acebg cdbfg fe gacbdfe gcaedb cgebf cgaefb | aefc gdbcf gecab gfcbd -agfecd fa gbfa fbdce gdfeacb dabfe fbadeg bgdaec begad afd | fda bdefc egadbf fa -ab bfedcg gfdcb deacg abdfce gcabd adcgfb eabfcdg abc abgf | decga debfac fcbdg gecdbaf -gfadcb dcgab abfgde fdcega acd adbgf cgdeb ac acfb befdcag | dbagf ca gdcfab gaebcdf -efcagd dbcef bgda gbf dfaegb cfegab bfged bg agcfbde afegd | bfagce cefdb fgeda aegfcd -cedafgb cbfeda bcegf gdbe gb fcgbad cedbgf gcaef bgf cefdb | ceagf dbfcge afdcbe ebdfgc -cgfed acfge bdecaf fdag fecgad fedgbc bacge af efa afegcbd | cgadbef gbdecf fgced fa -abegf fagcde ceb feabc ecfda cb acdb efcgdab cbgdfe ecadbf | eafcb ceb cadb bdeafc -fbgae begd abcfegd bfeda efd eagfdb de fgaecb acgdef dacbf | dagfce adefb bdfac dfegab -fd fed fgad dfecag gaedbfc gecafb bdceg cbdafe efcgd fcega | agfd dgaf gdafce eafcdb -befagd dfeb bf caebdg ebgda egfcba bgf gcadf gafbd fabgdec | agdefb eagcfb edacbg badfg -eagcd bdacgf gfeb fdgba be deb cefagdb afcdbe bdgae aegbfd | cfbgad dbage eb bgeadf -eacbfg debgac dbfcage dc eagbc cda cabdfe dfgea bgdc adegc | becag efbacg caebg cdgae -fed fcbagd acdebf gaef ef fgdec fecbagd dcegaf cbdeg agcfd | bdeacfg ef cadgf dcbeg -efc becdag afedc edgaf fc badgcfe fcdbge adfcbe cafb eabdc | dfebca acbed fc efacd -abfed dc fdcegb cgbfe cagfeb fdecb gbcadfe bgadcf gcde cdf | gecafb fbegdc febcdg cegafb -feagc daecfbg gdca dg fgd fdgec cebdf eagcfb efcgda fbdeag | defagb aedbfg gfd faegbc -cagdf ce bcegdf dbafeg cbeadf gbdaefc caeb cfe feadb efadc | ecba dcfae ec ce -fgabd abgdc dbcae cfadge cag cbge cg ebcadg cgfdeba fcbeda | dgabce dacegf baecd cfabed -efagc fdcgea geb bfdgec cgba fdcbgae adbfe bg bfcaeg fgeba | afegb daebf ceagdf agbc -ecgfbad ceg deca gbfed bagfdc cegfba cabdg ec agcdbe bdegc | agbcd ecbdg bcadg dcagb -aedbg bedca efbdag dgcb bfeac efgadc abegdc bfdegca cd edc | cbdae edcgfba ecd fdagbe -cfeagbd cfab bgc fbgdae fgdce gfadb bc ecadgb bcdfga gdbcf | cbfa cbadgf bfcdg abcf -edacg cdfbag fbeagdc cdgaef fc bagfe fac edabgc defc gcefa | dagcfb aegcf fc fegac -gfdabc dbgaef agbe cegadfb bdgaf gedafc fbced ge gfe befdg | dfcbga adbfge bdfeg cfadge -bcafge gbcd bc bfgdea cafdb fabdg acfdbg acefdgb acfde bfc | bfdac cbf fdabc edfca -gdcab cegd ebdcfga egb eg afceb cdgbfa acbge gdebaf bgcdea | agbce fceab dagfbe acebg -bagc cgf bacfd begfdc afdge bcagdf bcedfa cg becgafd dgfac | bdacf cfedab abcefd cafbd -ca cag gbfdc cadfbg eafcdg afcb edgab dgcbef cbgad abfdgce | cdbga bacf fgdace dcfgb -dcebf aefcbd gdcf fcbgde cbgef beacg gfebda gf fcdbgae feg | bfcadge cfbeg fg becgf -dcabfeg fbc cfgba dfabgc becadg fc dgebcf cfad cbagd gbeaf | ecadbg degabc aecbgd cf -cba efabd ebdcga cgeafbd cdabf fbce dbfcae bc cgdfa egbafd | abedf facdg ebcf cb -db efdcag dabf cagfdbe caegb decba bfcdeg fcabed fedca bde | edfacb adefc dbe dbe -fdabg efca bac ca fdacb becafdg fcdbe bcegad begdfc afbdce | gecdbf faec fadcb dbcaf -eg egad egfbadc bdecf feg agfcbe decfag dfceg cfgda cfbadg | fcabdg gef eg fecadg -fgad bgfde afe acebd dgfcbe af beadf ecabgf fbcedga abefgd | cbdegf edfab fegacb fa -efcgb beacfg gbecfda bfac afg dbfgce bfgdea fagce caedg af | gcebf aedfbg eafcbg fabecgd -bfdecga gaedfc ecga begcfd cfdab gbfade efa caedf ae defcg | daecf egca afcdeg caefd -decab efa dagefbc dagbce fcadg abdegf fe eafdc ebcf dcfabe | ebcf fe ebcf fae -begfd agedfc dabfce eadgf adf eacgfb afecbdg da feacg dcag | abcdfe daf debgf dbfeac -gbdfca gbefca cba cb ebcfagd gbafd fdacb fdgeab bcdg cadef | afbdc efdgabc dbagf gfdab -efdagb dae fcabedg caedb fdaecb ad ebdfc cdgfeb dfca eacbg | bedfgc fecdb edgfba cedfab -cd afdc cdg cbdgaf eagbd gacfb befdcga bdacg cbeafg ecfbgd | bdgacf dcfbeg dacgbf dagcb -begdaf gedbcfa dafc fea dfgce dgacfe gbedfc cfeag cbgea af | gecba agfbedc cbage egfdc -dc fgcd baefcg afbgecd bgeda ced baedfc cdeag gdafec efgca | bacfge bgdae abegfc afgbced -fc afcbgd bcf afebcgd bgdcf acdf bdfeg ecbagf cbdega adcgb | ceagbf befdcga edfagcb acdf -dbcgf degc bfgad bcfed gcb fceabdg gbfcde gc fbdaec afgebc | fecbdag fadgecb afbdg dgecfb -abcfg cfb eafgb bc cgbfda adfcge afdcg cfbgde cadb efgbcda | acgfb cb dfcag gdecfb -cdefb cfga edcgbfa cab abfge acfbe ca bcgaed bcaefg bdegaf | dbfce gdfcaeb fedabg fbcea -fgcae gafd eacdfgb baceg cadebf cfbged daefcg fge fg fceda | gceadbf dcbfage cafed ebacdf -fabdceg abcgde acebdf cfaeb fa egfcb dbfa fac abecd agefcd | cfeab edcbag acf dcabefg -dgbecfa abdfe acegd fdgabc gadef gfce ecbagd edagcf fg dfg | gdf fcegbda agcde fgd -dagf bcdaef ad acd cbeag febagdc dgbfac dgcab fcdbge bdgcf | fdbeac gcbda bcfdg bfcgd -fgdc gc gefdcab bdgec dbcefa gce bfgdec gcefab degab cebfd | bdfce gbecfd gadbe ebcadgf -fagc bdcfag fdacb agbedf daf aedgbc dbcga ebdgcfa cbdfe fa | febdc cfag af cadbg -bcd bfec dagbcf egcbfd bc edfgc bdecg edabg dcgeabf gdefca | bedag dbc fgcdbe ebdfcg -gedafcb dbagcf bcadeg fc gfc cebf edgfc cgdbe bcfdge egdfa | fc dabgec bdcge ebfc -gafbd ef becga ebgcaf agbef gfe gebcda gbfdce afce dbcgefa | ef gfe cabfeg gabecf -deab fbedgc eb bdacg dagcfbe abecg cfdagb beg baedcg gacfe | gacdb dbfgace dbea cadbg -badceg ced fecba fbdc adfec ebfcgad gecafb faedcb gfeda cd | fcead fbcaged adebgc ceabgd -bd bdcg fgcab abd cfaebd baecgf fecbgad agdfb efdga gfdacb | afebcd bfadg egbfca cgbfea -da decbf afdec begcad dcgefb gcafe edbfca dca fdab begdfca | efadc abdf ebcdfa fegac -gcbeaf geadbc fdbeagc bfdec cdbae ea agfdcb dabcg eac adeg | gcdba cebdf abecd gedcab -bcdae abedg ebg bfadec eg dbgaf egafcb gcadeb egdc abedfcg | dagfb ebg gebcaf eg -afb abgfed caegfd cfbd becag dcbgfea bf decaf faecb bedfac | daegfb dbaefc gacedf bfa -bgecf becfad ea adebgc cfdbgea dabcg eca eagd acbeg adfcgb | agdbc bagcd bgcda aedg -bf fagcde cfdb acfgd gfdaeb acdfegb gfacb bfg bgeca bcgafd | gfb gfacd agfdeb abcge -aegfd efcd bedfagc bacdgf gecadf aed egbdac fcagd ed afbeg | daefg dagfc acdbfg gbacfd -decga efbcd badcgf cfgdbe agefcbd fa ebcdaf fcdea eafb fda | dcfea fad ebadgfc afedcb -bf gebfcd bagfed bdagcfe cegbd fgbdc gfb ecgbad gdafc befc | fadbeg bcgde gbf bfg -df cbfged fgbca fbd bcafge bdeac agbfecd adcbf gdaf dabgfc | bcdea cafbd afdg gacfb -ecdbfa fadgce aceb fgebd bfcgad cdfae afgbced dfebc cfb cb | cfead fcb bc bedcf -fdbega cfegd cdbgae cdfebga fecadb aeg cbag ag adceb dcage | ebcagd gcead egdfc dagecb -cdbfeag gfdeba edfgca cead geadf gac fcbdg afgcd cabegf ca | fecgad gefda dafcg fdgca -cfgbae cgefb egdbfc dcg dfcbg ecbgfda badcf gfed edcgba gd | gd cbefdg adbceg badcf -bf bgf debfg bgade egbfcd cebdafg agdfce fgced dcbfag fcbe | adcgfe fdgeac fb ebfc -gefdc fdagcb gfdac bdafce caf ac daegcbf febgda cbga dbafg | dagbf ac faedcgb dfagb -ecfgadb dbgacf abfegc gd cefad fcgde cefdgb fcbge gdeb dgf | efacd bcegdaf bdgacf gd -cdfgb bdf fdcag bd cdba gbecf dfecga cfgebda gdefab dcbagf | begfc bcgfd gfbce afbgcd -fbe facb decgaf afdce fb bcdeaf bagdfe ecdbg dfbce bgedcfa | abdgfe eafdc efdbca acfgde -bgdcf cbaegd eabfdcg ceg eg aedcb deabfc dgea gfcaeb gecdb | eacgdb ge daebcf eg -egbdcaf gd cefabg dfge bcfagd afdegc caedg baecd gad caefg | gcedaf efgabc dag deagc -cdabf bgcfde afedgc fcb gcba gfacd bdaef bdegfac cb bdfagc | bcf bcedfg gaecdf cdgeabf -gf dcbfeg fcgdbea fge gedacb aefbg bgead gfad dfegba aebfc | aedgfb gf egf dfag -gbeacfd gacbd dcgfbe fg fgd dbacge bdagcf dfcea gafb fgadc | deagcb gf degfbc edcgbaf -ce gdbcae debcf cfdabe eacfbdg acef fgdbc begadf ecd afdbe | dbefa abegdc cbdfg acfbed -begdfc gbdc gedaf dc edgfc cdf fgbec ecdafb ebgafc degcbfa | egdfa edgbfca cbefg fagcbe -efcab dgbfc ag agdc cfagbde fbgeda fag acgdfb fcbga gbefcd | gacd gdac dcag gdac -bdage bdaefg gbe eb edfb bgafec dgbecaf egadf fdaecg dbacg | geb afgdbe dfbegac efgcba -ecgfa bec be ebfgc dgbcea adefgc egafbc egbafcd bafe gbfdc | aefb bce befa gfecab -ebgdc cbe ecdgab gacb gfced dbgea edbcfa fagcdeb gabfde bc | dgfec aebdgf abcdfeg fbaedc -daegbf adef dgcabe cafdgbe adcgfb dbegf ebgcf dbf ebadg fd | fcbge bgcef acfgdb efbgd -cdbge cfe adbcef fedgcb gfebcda cedgf edagf gdbcae cf gcfb | cdbeg gcdfe fabgdce aecbfd -beacg dafge gbeadc fcba bgdeafc begfa bf eabcfg ebgcdf bfg | gaefb bcfged degcab egdaf -acgefbd feb bf cdaef beadf gbaed abgced gabdef abfg gbfedc | begfda efcda bfe dgacbe -eacfgd fbdgce abfcge bcfea cafeg cagdbfe ebf debca bf fgba | fb fb acdbe cfdage -bfec cedagf aef ef degba bagcef dgcfab fgeab fecdgba bacfg | cbgaef efacgd aegfb aef -dbacfe edfc ec caebd agfebc cbe cbdag gfcbead bgfead bafde | deabc dfagbe cgbfea ec -ed dfgbec dfabg fbaec feacbg edafb aedc eadfcgb ebdacf dbe | deac bgeafc cebfdg fcdegb diff --git a/day08/day08_input_ez.txt b/day08/day08_input_ez.txt deleted file mode 100644 index c9f629b..0000000 --- a/day08/day08_input_ez.txt +++ /dev/null @@ -1,10 +0,0 @@ -be cfbegad cbdgef fgaecd cgeb fdcge agebfd fecdb fabcd edb | fdgacbe cefdb cefbgd gcbe -edbfga begcd cbg gc gcadebf fbgde acbgfd abcde gfcbed gfec | fcgedb cgb dgebacf gc -fgaebd cg bdaec gdafb agbcfd gdcbef bgcad gfac gcb cdgabef | cg cg fdcagb cbg -fbegcd cbd adcefb dageb afcb bc aefdc ecdab fgdeca fcdbega | efabcd cedba gadfec cb -aecbfdg fbg gf bafeg dbefa fcge gcbea fcaegb dgceab fcbdga | gecf egdcabf bgf bfgea -fgeab ca afcebg bdacfeg cfaedg gcfdb baec bfadeg bafgc acf | gebdcfa ecba ca fadegcb -dbcfg fgd bdegcaf fgec aegbdf ecdfab fbedc dacgb gdcebf gf | cefg dcbef fcge gbcadfe -bdfegc cbegaf gecbf dfcage bdacg ed bedf ced adcbefg gebcd | ed bcgafe cdgba cbgef -egadfb cdbfeg cegd fecab cgb gbdefca cg fgcdab egfdb bfceg | gbdfcae bgc cg cgb -gcafb gcf dcaebfg ecagb gf abcdeg gaef cafbge fdbac fegbdc | fgae cfgab fg bagce diff --git a/day08/makefile b/day08/makefile deleted file mode 100644 index 5c81ee3..0000000 --- a/day08/makefile +++ /dev/null @@ -1,2 +0,0 @@ -all day08.cpp: - g++ -std=c++20 -o day08 day08.cpp |