From 4779e181a2765b54c191aa25fdb4392ea183d2d1 Mon Sep 17 00:00:00 2001 From: ptrcnull Date: Wed, 1 Dec 2021 16:16:01 +0100 Subject: [PATCH] 01: part1 --- 1/input | 2000 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1/part1.go | 25 + 1/part2.go | 25 + 3 files changed, 2050 insertions(+) create mode 100644 1/input create mode 100644 1/part1.go create mode 100644 1/part2.go diff --git a/1/input b/1/input new file mode 100644 index 0000000..a12f387 --- /dev/null +++ b/1/input @@ -0,0 +1,2000 @@ +195 +197 +201 +204 +203 +216 +213 +215 +216 +185 +188 +190 +205 +218 +237 +243 +248 +278 +289 +292 +304 +313 +314 +317 +329 +328 +329 +328 +329 +330 +331 +329 +333 +337 +338 +345 +352 +354 +355 +359 +360 +363 +365 +364 +370 +371 +367 +387 +403 +407 +409 +411 +416 +425 +435 +444 +445 +446 +460 +449 +454 +458 +459 +463 +464 +445 +447 +448 +450 +452 +463 +464 +475 +459 +460 +465 +477 +484 +485 +486 +498 +500 +501 +502 +516 +515 +531 +534 +560 +576 +583 +586 +587 +575 +588 +587 +591 +595 +599 +607 +608 +609 +610 +616 +612 +601 +603 +621 +624 +623 +630 +639 +633 +628 +629 +630 +631 +632 +646 +650 +654 +650 +654 +659 +660 +663 +669 +670 +673 +702 +709 +715 +739 +734 +750 +756 +762 +775 +773 +784 +785 +784 +789 +790 +785 +784 +798 +814 +815 +816 +817 +818 +826 +827 +841 +835 +836 +839 +841 +843 +835 +839 +819 +838 +837 +831 +847 +845 +847 +848 +853 +854 +883 +884 +883 +884 +885 +887 +888 +889 +896 +902 +920 +922 +923 +924 +928 +930 +962 +958 +985 +979 +980 +979 +986 +1019 +1016 +1017 +1022 +1032 +1035 +1037 +1040 +1038 +1045 +1056 +1065 +1090 +1104 +1084 +1082 +1084 +1097 +1115 +1118 +1128 +1123 +1133 +1143 +1144 +1133 +1134 +1135 +1136 +1144 +1135 +1136 +1145 +1157 +1168 +1172 +1173 +1176 +1194 +1213 +1191 +1192 +1194 +1197 +1200 +1193 +1196 +1198 +1201 +1194 +1196 +1225 +1224 +1230 +1232 +1239 +1240 +1243 +1239 +1217 +1218 +1220 +1224 +1232 +1225 +1223 +1224 +1227 +1219 +1220 +1219 +1227 +1237 +1250 +1259 +1263 +1264 +1274 +1275 +1280 +1300 +1288 +1291 +1293 +1278 +1279 +1280 +1277 +1293 +1297 +1309 +1308 +1315 +1339 +1345 +1343 +1341 +1344 +1348 +1360 +1366 +1369 +1386 +1389 +1419 +1418 +1419 +1414 +1420 +1447 +1453 +1460 +1454 +1477 +1485 +1492 +1500 +1501 +1494 +1484 +1487 +1496 +1497 +1499 +1503 +1505 +1507 +1515 +1522 +1525 +1527 +1539 +1541 +1569 +1571 +1562 +1568 +1556 +1563 +1542 +1547 +1548 +1542 +1551 +1549 +1559 +1562 +1564 +1560 +1562 +1563 +1564 +1563 +1564 +1565 +1595 +1607 +1613 +1616 +1618 +1617 +1619 +1621 +1622 +1624 +1637 +1631 +1627 +1630 +1635 +1639 +1675 +1677 +1681 +1683 +1685 +1684 +1689 +1700 +1701 +1699 +1702 +1704 +1718 +1713 +1689 +1690 +1689 +1667 +1668 +1697 +1700 +1694 +1697 +1715 +1719 +1725 +1726 +1713 +1714 +1720 +1723 +1725 +1728 +1731 +1749 +1746 +1748 +1766 +1767 +1771 +1770 +1779 +1783 +1801 +1790 +1773 +1775 +1777 +1791 +1794 +1795 +1804 +1787 +1792 +1793 +1798 +1816 +1818 +1820 +1812 +1816 +1817 +1818 +1820 +1833 +1850 +1847 +1851 +1866 +1868 +1871 +1875 +1883 +1884 +1886 +1895 +1899 +1901 +1902 +1940 +1944 +1966 +1969 +1979 +1974 +1977 +1982 +1983 +2012 +2027 +2031 +2044 +2040 +2058 +2062 +2060 +2061 +2063 +2067 +2068 +2091 +2093 +2069 +2083 +2084 +2083 +2085 +2083 +2087 +2095 +2088 +2090 +2093 +2097 +2096 +2097 +2099 +2098 +2108 +2112 +2115 +2116 +2117 +2121 +2123 +2158 +2140 +2143 +2134 +2159 +2161 +2162 +2177 +2179 +2186 +2190 +2189 +2171 +2174 +2178 +2174 +2176 +2178 +2166 +2168 +2169 +2170 +2177 +2203 +2212 +2213 +2214 +2223 +2227 +2228 +2237 +2232 +2239 +2269 +2268 +2271 +2283 +2290 +2294 +2296 +2301 +2303 +2307 +2304 +2315 +2317 +2325 +2326 +2328 +2329 +2351 +2361 +2330 +2342 +2343 +2346 +2354 +2357 +2375 +2364 +2365 +2361 +2365 +2364 +2367 +2368 +2370 +2366 +2367 +2371 +2376 +2382 +2383 +2394 +2398 +2389 +2393 +2400 +2402 +2413 +2429 +2431 +2447 +2449 +2481 +2487 +2488 +2507 +2496 +2495 +2511 +2526 +2544 +2545 +2534 +2549 +2550 +2540 +2542 +2555 +2558 +2546 +2559 +2577 +2578 +2582 +2585 +2605 +2620 +2625 +2630 +2633 +2639 +2647 +2654 +2658 +2662 +2661 +2682 +2708 +2746 +2733 +2738 +2756 +2763 +2766 +2769 +2770 +2773 +2770 +2781 +2782 +2784 +2785 +2783 +2781 +2778 +2804 +2793 +2795 +2796 +2797 +2798 +2797 +2798 +2797 +2798 +2799 +2807 +2808 +2814 +2816 +2817 +2795 +2798 +2799 +2801 +2807 +2808 +2807 +2826 +2817 +2818 +2820 +2824 +2841 +2840 +2846 +2847 +2836 +2839 +2842 +2845 +2849 +2853 +2857 +2856 +2875 +2893 +2913 +2921 +2927 +2911 +2912 +2914 +2919 +2923 +2921 +2934 +2932 +2935 +2941 +2951 +2952 +2959 +2965 +2970 +2975 +2991 +2993 +2994 +3000 +3002 +3004 +3019 +3024 +3029 +3030 +3031 +3032 +3031 +3034 +3039 +3042 +3052 +3053 +3055 +3056 +3089 +3107 +3112 +3113 +3111 +3112 +3113 +3117 +3116 +3108 +3112 +3110 +3111 +3117 +3120 +3112 +3113 +3118 +3106 +3107 +3105 +3108 +3107 +3108 +3118 +3127 +3125 +3134 +3137 +3138 +3144 +3159 +3172 +3178 +3185 +3191 +3197 +3193 +3192 +3203 +3209 +3216 +3213 +3215 +3226 +3228 +3225 +3227 +3214 +3217 +3226 +3264 +3265 +3270 +3273 +3271 +3265 +3262 +3284 +3287 +3289 +3297 +3315 +3324 +3279 +3285 +3289 +3298 +3299 +3313 +3314 +3315 +3353 +3340 +3338 +3339 +3340 +3342 +3356 +3355 +3356 +3362 +3377 +3385 +3391 +3394 +3401 +3411 +3409 +3425 +3426 +3427 +3436 +3442 +3443 +3447 +3448 +3449 +3450 +3456 +3463 +3471 +3489 +3502 +3485 +3490 +3469 +3471 +3474 +3481 +3488 +3495 +3490 +3497 +3518 +3530 +3531 +3533 +3535 +3540 +3552 +3555 +3558 +3566 +3571 +3587 +3604 +3605 +3608 +3632 +3638 +3650 +3643 +3634 +3635 +3666 +3667 +3670 +3668 +3674 +3678 +3688 +3687 +3685 +3686 +3704 +3709 +3710 +3717 +3719 +3730 +3735 +3733 +3756 +3757 +3783 +3784 +3786 +3788 +3789 +3794 +3799 +3803 +3824 +3827 +3793 +3794 +3796 +3786 +3787 +3788 +3791 +3789 +3804 +3805 +3823 +3833 +3816 +3814 +3815 +3821 +3820 +3823 +3824 +3826 +3825 +3836 +3839 +3843 +3844 +3845 +3846 +3867 +3887 +3891 +3898 +3915 +3917 +3915 +3919 +3926 +3924 +3926 +3928 +3938 +3947 +3952 +3953 +3960 +3961 +3970 +3971 +3977 +4002 +4008 +4034 +4035 +4044 +4054 +4078 +4079 +4081 +4086 +4083 +4086 +4088 +4081 +4091 +4094 +4090 +4091 +4100 +4115 +4117 +4120 +4108 +4150 +4151 +4132 +4134 +4138 +4145 +4153 +4155 +4156 +4135 +4146 +4128 +4155 +4170 +4172 +4171 +4183 +4184 +4191 +4214 +4221 +4228 +4238 +4240 +4241 +4210 +4214 +4217 +4221 +4210 +4229 +4235 +4243 +4247 +4263 +4264 +4263 +4277 +4281 +4285 +4288 +4304 +4310 +4312 +4323 +4326 +4331 +4329 +4351 +4348 +4350 +4354 +4357 +4359 +4360 +4368 +4380 +4364 +4348 +4352 +4353 +4368 +4379 +4383 +4386 +4372 +4373 +4380 +4379 +4381 +4382 +4412 +4419 +4402 +4403 +4404 +4423 +4415 +4416 +4418 +4419 +4425 +4437 +4439 +4438 +4439 +4451 +4459 +4460 +4461 +4462 +4465 +4479 +4508 +4504 +4506 +4508 +4516 +4510 +4498 +4511 +4506 +4523 +4528 +4542 +4563 +4574 +4588 +4587 +4588 +4590 +4591 +4592 +4594 +4599 +4592 +4594 +4615 +4613 +4615 +4616 +4625 +4619 +4620 +4623 +4628 +4629 +4630 +4633 +4639 +4638 +4640 +4655 +4656 +4657 +4679 +4681 +4680 +4681 +4696 +4692 +4700 +4704 +4706 +4715 +4721 +4722 +4734 +4712 +4716 +4715 +4721 +4722 +4724 +4736 +4741 +4755 +4756 +4754 +4747 +4759 +4768 +4772 +4778 +4782 +4812 +4806 +4808 +4809 +4806 +4811 +4806 +4807 +4818 +4826 +4827 +4828 +4830 +4836 +4837 +4855 +4856 +4863 +4851 +4852 +4853 +4854 +4860 +4861 +4862 +4865 +4868 +4854 +4857 +4856 +4875 +4876 +4882 +4883 +4884 +4883 +4896 +4901 +4912 +4922 +4930 +4912 +4920 +4921 +4930 +4935 +4934 +4936 +4939 +4941 +4950 +4953 +4958 +4972 +4975 +4976 +4994 +4995 +4998 +5001 +5008 +5013 +5014 +5016 +5026 +5025 +5031 +5039 +5052 +5053 +5059 +5064 +5065 +5082 +5083 +5084 +5085 +5090 +5092 +5099 +5136 +5145 +5167 +5160 +5133 +5135 +5113 +5117 +5140 +5129 +5131 +5124 +5123 +5124 +5137 +5148 +5153 +5157 +5171 +5179 +5204 +5206 +5210 +5212 +5215 +5225 +5229 +5232 +5229 +5220 +5224 +5235 +5250 +5249 +5257 +5258 +5260 +5265 +5289 +5288 +5290 +5292 +5293 +5262 +5264 +5265 +5263 +5265 +5270 +5279 +5284 +5285 +5291 +5290 +5295 +5299 +5318 +5331 +5345 +5347 +5341 +5347 +5348 +5349 +5355 +5345 +5350 +5357 +5358 +5364 +5365 +5377 +5378 +5405 +5408 +5407 +5417 +5425 +5428 +5432 +5431 +5438 +5439 +5445 +5451 +5453 +5446 +5449 +5451 +5461 +5467 +5475 +5497 +5513 +5514 +5535 +5536 +5537 +5565 +5575 +5579 +5580 +5600 +5609 +5592 +5610 +5609 +5614 +5622 +5621 +5622 +5647 +5649 +5660 +5661 +5668 +5665 +5666 +5684 +5687 +5688 +5692 +5691 +5697 +5698 +5678 +5686 +5687 +5686 +5687 +5688 +5681 +5690 +5691 +5696 +5701 +5702 +5693 +5686 +5690 +5693 +5697 +5694 +5699 +5700 +5713 +5700 +5709 +5711 +5719 +5720 +5721 +5723 +5726 +5727 +5728 +5723 +5728 +5735 +5741 +5728 +5733 +5741 +5747 +5751 +5747 +5756 +5757 +5758 +5753 +5752 +5753 +5756 +5754 +5755 +5766 +5768 +5780 +5778 +5777 +5778 +5784 +5788 +5790 +5801 +5802 +5816 +5832 +5833 +5821 +5824 +5837 +5830 +5804 +5830 +5831 +5840 +5850 +5862 +5863 +5864 +5869 +5862 +5861 +5862 +5866 +5865 +5866 +5906 +5907 +5908 +5909 +5918 +5917 +5921 +5920 +5921 +5919 +5938 +5939 +5915 +5936 +5938 +5943 +5961 +5972 +5982 +5987 +5991 +5994 +6010 +6013 +6017 +6018 +6021 +6017 +6022 +6023 +6013 +6014 +6027 +6056 +6061 +6067 +6056 +6057 +6071 +6074 +6077 +6068 +6092 +6098 +6106 +6118 +6133 +6140 +6141 +6179 +6185 +6186 +6201 +6203 +6204 +6214 +6215 +6221 +6230 +6240 +6241 +6252 +6253 +6268 +6270 +6277 +6280 +6282 +6281 +6282 +6293 +6263 +6248 +6249 +6250 +6270 +6280 +6276 +6278 +6291 +6292 +6294 +6295 +6302 +6311 +6341 +6335 +6336 +6337 +6336 +6337 +6339 +6342 +6347 +6341 +6342 +6343 +6353 +6355 +6379 +6366 +6370 +6371 +6378 +6379 +6384 +6404 +6402 +6415 +6414 +6417 +6416 +6417 +6410 +6428 +6443 +6445 +6450 +6448 +6456 +6477 +6479 +6486 +6493 +6495 +6496 +6522 +6523 +6524 +6525 +6526 +6527 +6529 +6537 +6532 +6550 +6565 +6566 +6571 +6598 +6614 +6620 +6621 +6622 +6620 +6586 +6592 +6596 +6624 +6619 +6618 +6610 +6611 +6618 +6619 +6622 +6630 +6627 +6633 +6611 +6614 +6617 +6612 +6622 +6623 +6626 +6645 +6646 +6645 +6658 +6661 +6664 +6666 +6673 +6683 +6686 +6688 +6685 +6718 +6719 +6720 +6721 +6718 +6720 +6749 +6755 +6752 +6755 +6756 +6768 +6771 +6773 +6776 +6816 +6830 +6831 +6843 +6844 +6845 +6851 +6873 +6875 +6876 +6878 +6879 +6880 +6873 +6874 +6857 +6856 +6857 +6856 +6858 +6855 +6856 +6857 +6855 +6859 +6860 +6862 +6864 +6874 +6876 +6862 +6865 +6874 +6893 +6899 +6900 +6903 +6908 +6909 +6937 +6939 +6942 +6954 +6958 +6962 +6972 +6968 +6979 +6983 +6982 +6983 +6989 +6988 +6999 +6992 +6996 +7000 +6998 +6974 +6977 +6996 +6997 +6998 +6999 +7005 +6990 +6992 +6993 +7016 +7023 +7000 +7002 +7022 +7035 +7042 +7052 +7065 +7069 +7076 +7066 +7080 +7084 +7083 +7082 +7083 +7084 +7089 +7094 +7093 +7102 +7105 +7106 +7107 +7110 +7111 +7112 +7119 +7120 +7107 +7106 +7105 +7094 +7105 +7106 +7107 +7109 +7116 +7117 +7121 +7143 +7145 +7161 +7170 +7171 +7178 +7149 +7145 +7146 +7147 +7148 +7149 +7162 +7163 +7168 +7175 +7176 +7189 +7187 +7172 +7183 +7190 +7191 +7201 +7209 +7211 +7212 +7254 +7255 +7261 +7269 +7278 +7298 +7307 +7304 +7305 +7327 +7329 +7339 +7335 +7331 +7335 +7336 +7338 +7351 +7349 +7355 +7360 +7370 +7371 +7402 +7415 +7414 +7413 +7426 +7429 +7430 +7432 +7433 +7419 +7420 +7421 +7424 +7427 +7432 +7424 +7433 +7440 +7441 +7464 +7468 +7469 +7482 +7487 +7492 +7494 +7495 +7498 +7504 +7505 +7506 +7513 +7517 +7520 +7526 +7543 +7531 +7537 +7538 +7543 +7534 +7539 +7544 +7551 +7555 +7554 +7559 +7567 +7572 +7580 +7600 +7602 +7592 +7597 +7601 +7602 +7604 +7607 +7630 +7633 +7640 +7641 +7642 +7631 +7640 +7642 +7626 +7609 +7615 +7623 +7625 +7602 +7600 +7604 +7606 +7617 +7620 +7621 +7632 +7628 +7650 +7652 +7654 +7657 +7666 +7667 +7678 +7679 +7674 +7678 +7679 +7678 +7679 +7681 +7675 +7673 +7664 +7686 +7684 +7680 +7681 +7682 +7681 +7687 +7693 +7690 +7694 +7710 +7711 +7710 +7712 +7720 +7710 +7711 +7718 +7730 +7732 +7734 +7735 +7736 +7737 +7756 +7766 +7768 +7769 +7776 +7788 +7792 +7793 +7807 +7808 +7826 +7831 +7838 +7839 +7872 +7875 +7877 +7879 +7890 +7895 +7893 +7896 +7903 +7908 +7904 +7917 +7918 +7930 +7961 +7957 +7960 +7950 +7968 +7969 +7973 +7996 +7999 +7993 +8001 +8005 +8006 +8045 +8058 +8064 +8063 +8077 +8080 +8081 +8098 +8102 +8109 +8110 +8121 +8123 +8122 +8129 +8132 +8154 +8159 +8171 +8190 +8192 +8199 +8202 +8240 +8241 +8243 +8261 +8262 +8256 +8260 +8257 +8258 +8270 +8274 +8276 +8260 +8257 +8258 +8261 +8297 +8305 +8308 +8309 +8310 +8335 +8338 +8352 +8362 +8363 +8348 +8346 +8349 +8343 +8333 +8335 +8336 +8337 +8346 +8338 +8366 +8391 +8388 +8402 +8413 +8439 +8440 +8443 +8444 +8451 +8459 +8460 +8472 +8468 +8469 +8474 +8478 +8487 +8511 +8530 +8531 +8537 +8536 +8537 +8544 +8549 +8562 +8563 +8562 diff --git a/1/part1.go b/1/part1.go new file mode 100644 index 0000000..989a486 --- /dev/null +++ b/1/part1.go @@ -0,0 +1,25 @@ +package main + +import ( + "bufio" + "fmt" + "math" + "os" + "strconv" +) + +func main() { + count := 0 + lastValue := math.MaxInt64 + + s := bufio.NewScanner(os.Stdin) + for s.Scan() { + value, _ := strconv.Atoi(s.Text()) + if value > lastValue { + count++ + } + lastValue = value + } + + fmt.Println(count) +} diff --git a/1/part2.go b/1/part2.go new file mode 100644 index 0000000..989a486 --- /dev/null +++ b/1/part2.go @@ -0,0 +1,25 @@ +package main + +import ( + "bufio" + "fmt" + "math" + "os" + "strconv" +) + +func main() { + count := 0 + lastValue := math.MaxInt64 + + s := bufio.NewScanner(os.Stdin) + for s.Scan() { + value, _ := strconv.Atoi(s.Text()) + if value > lastValue { + count++ + } + lastValue = value + } + + fmt.Println(count) +}