commit b53a8a48ee530ba5aba5289dc020842ed335450a Author: Andrew R. M Date: Tue Dec 6 16:09:51 2022 -0500 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c368d45 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.stack-work/ +*~ \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..49e6bc4 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,11 @@ +# Changelog for `aoc2022` + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to the +[Haskell Package Versioning Policy](https://pvp.haskell.org/). + +## Unreleased + +## 0.1.0.0 - YYYY-MM-DD diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..342c588 --- /dev/null +++ b/LICENSE @@ -0,0 +1,30 @@ +Copyright Author name here (c) 2022 + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of Author name here nor the names of other + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..b9a022c --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# aoc2022 diff --git a/Setup.hs b/Setup.hs new file mode 100644 index 0000000..9a994af --- /dev/null +++ b/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/aoc2022.cabal b/aoc2022.cabal new file mode 100644 index 0000000..c0cadb8 --- /dev/null +++ b/aoc2022.cabal @@ -0,0 +1,166 @@ +cabal-version: 1.12 + +-- This file has been generated from package.yaml by hpack version 0.35.0. +-- +-- see: https://github.com/sol/hpack + +name: aoc2022 +version: 0.1.0.0 +description: Please see the README on GitHub at +homepage: https://github.com/githubuser/aoc2022#readme +bug-reports: https://github.com/githubuser/aoc2022/issues +author: Author name here +maintainer: example@example.com +copyright: 2022 Author name here +license: BSD3 +license-file: LICENSE +build-type: Simple +extra-source-files: + README.md + CHANGELOG.md + +source-repository head + type: git + location: https://github.com/githubuser/aoc2022 + +library + exposed-modules: + Day1Lib + Day2Lib + Day3Lib + Day4Lib + Day5Lib + other-modules: + Paths_aoc2022 + hs-source-dirs: + src + ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints + build-depends: + base >=4.7 && <5 + , split + default-language: Haskell2010 + +executable Day1Part1 + main-is: Day1Part1.hs + hs-source-dirs: + day1 + ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N -main-is Day1Part1 + build-depends: + aoc2022 + , base >=4.7 && <5 + , split + default-language: Haskell2010 + +executable Day1Part2 + main-is: Day1Part2.hs + hs-source-dirs: + day1 + ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N -main-is Day1Part2 + build-depends: + aoc2022 + , base >=4.7 && <5 + , split + default-language: Haskell2010 + +executable Day2Part1 + main-is: Day2Part1.hs + hs-source-dirs: + day2 + ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N -main-is Day2Part1 + build-depends: + aoc2022 + , base >=4.7 && <5 + , split + default-language: Haskell2010 + +executable Day2Part2 + main-is: Day2Part2.hs + hs-source-dirs: + day2 + ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N -main-is Day2Part2 + build-depends: + aoc2022 + , base >=4.7 && <5 + , split + default-language: Haskell2010 + +executable Day3Part1 + main-is: Day3Part1.hs + hs-source-dirs: + day3 + ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N -main-is Day3Part1 + build-depends: + aoc2022 + , base >=4.7 && <5 + , split + default-language: Haskell2010 + +executable Day3Part2 + main-is: Day3Part2.hs + hs-source-dirs: + day3 + ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N -main-is Day3Part2 + build-depends: + aoc2022 + , base >=4.7 && <5 + , split + default-language: Haskell2010 + +executable Day4Part1 + main-is: Day4Part1.hs + hs-source-dirs: + day4 + ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N -main-is Day4Part1 + build-depends: + aoc2022 + , base >=4.7 && <5 + , split + default-language: Haskell2010 + +executable Day4Part2 + main-is: Day4Part2.hs + hs-source-dirs: + day4 + ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N -main-is Day4Part2 + build-depends: + aoc2022 + , base >=4.7 && <5 + , split + default-language: Haskell2010 + +executable Day5Part1 + main-is: Day5Part1.hs + hs-source-dirs: + day5 + ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N -main-is Day5Part1 + build-depends: + aoc2022 + , base >=4.7 && <5 + , split + default-language: Haskell2010 + +executable Day5Part2 + main-is: Day5Part2.hs + hs-source-dirs: + day5 + ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N -main-is Day5Part2 + build-depends: + aoc2022 + , base >=4.7 && <5 + , split + default-language: Haskell2010 + +test-suite Day1-test + type: exitcode-stdio-1.0 + main-is: Day1.hs + other-modules: + Spec + Paths_aoc2022 + hs-source-dirs: + test + ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N + build-depends: + aoc2022 + , base >=4.7 && <5 + , split + default-language: Haskell2010 diff --git a/app/Main.hs b/app/Main.hs new file mode 100644 index 0000000..4c6b30f --- /dev/null +++ b/app/Main.hs @@ -0,0 +1,6 @@ +module Main (main) where + +import Lib + +main :: IO () +main = someFunc diff --git a/day1/Day1Part1.hs b/day1/Day1Part1.hs new file mode 100644 index 0000000..9c6e045 --- /dev/null +++ b/day1/Day1Part1.hs @@ -0,0 +1,9 @@ +module Day1Part1 (main) where + +import Day1Lib + + +main :: IO () +main = do + input <- getContents + putStrLn $ convertToString $ day1 input diff --git a/day1/Day1Part2.hs b/day1/Day1Part2.hs new file mode 100644 index 0000000..d1861f6 --- /dev/null +++ b/day1/Day1Part2.hs @@ -0,0 +1,9 @@ +module Day1Part2 (main) where + +import Day1Lib + + +main :: IO () +main = do + input <- getContents + putStrLn $ convertToString $ day1Two input diff --git a/day1/input b/day1/input new file mode 100644 index 0000000..43f433f --- /dev/null +++ b/day1/input @@ -0,0 +1,2243 @@ +3427 +3273 +5615 +5943 +3125 +4245 +4194 +3243 +4283 +1790 +5355 +4239 +5541 + +3850 +5294 +5393 +2490 +3231 +2743 +2016 +2418 +2304 +5673 +3035 +5292 +2112 +2630 +2305 + +2325 +2002 +3402 +4756 +1662 +1133 +5273 +6397 +2977 +4011 +3594 +4441 +3907 +1503 + +7598 +6971 +6979 +3873 +1394 +8399 +1321 +2304 +2570 +6679 + +15324 +3365 +23808 + +5489 +3526 +3125 +8371 +1928 +8191 +7267 +10728 + +5243 +2203 +7331 +8049 +4951 +3743 +2255 +4112 +3077 +2441 +4678 + +12353 +2251 +12157 +13656 +10655 +7525 + +3383 +4183 +3293 +5473 +4898 +1441 +3786 +4002 +2179 +2439 +5530 +3966 +6273 +3150 + +3320 +2694 +2229 +1394 +4568 +3160 +4986 +2487 +3412 +1030 +3717 +1460 +1140 +1314 +5816 + +15303 +36095 + +14345 +5208 +2253 +19532 + +5082 +6544 +3563 +6050 +3750 +1155 +2090 +3661 +3600 +5528 +6506 +1795 +4901 + +1156 +1867 +2025 +5434 +1546 +6052 +4412 +7203 +4622 +7098 +4727 + +4423 +1829 +4761 +4779 +3234 +4869 +3567 +6928 +4181 +5390 +5938 + +3100 +6087 +9235 +10228 +2082 +5472 +11382 + +8389 +15131 +12057 +5034 +9419 + +2192 +1695 +3233 +2245 +4328 +6275 +1811 +4345 +2760 +3205 +1138 +2795 +3876 +1041 + +1302 +3509 +6074 +1793 +5808 +5364 +3802 +2048 +6042 +4913 +5983 +1189 +3134 +3763 +2573 + +1003 +8411 +2571 +2555 +7555 +8096 +1441 +5600 +5104 +6311 + +5345 +3329 +5616 +3250 +4321 +2068 +1978 +3719 +4512 +5099 +4694 +1566 +2621 +1613 + +11021 +6101 +9858 +3142 +9907 +1578 +8582 + +3182 +7695 +4419 +4036 +5846 +3899 +6104 +4495 +7382 +3471 + +6844 +3290 +10505 +7855 +1494 +5963 + +3609 +4755 +4063 +1480 +3201 +4576 +1627 +1255 +3699 +3929 +5533 +4807 +5890 +2270 + +3789 +7045 +8784 +8006 +4583 +7726 +3993 +1472 +1578 +2046 + +2474 +5953 +2050 +4758 +5265 +5075 +4338 +1340 +1301 +5996 +1225 +1794 +4778 +1354 +3819 + +9619 +10877 +8094 +8845 +11275 + +1986 +2142 +7561 +5350 +7605 +6766 +4713 +1016 +5697 +3179 +1696 + +3428 +5575 +5301 +4356 +5065 +2010 +1382 +3466 +3233 +1188 +1999 +3228 +6153 +4496 + +1354 +5681 +11066 +1211 +8399 +12040 +11181 + +3408 +1237 +2163 +5645 +4712 +1349 +4124 +2357 +5443 +4887 +5582 +3037 +3764 +3472 +5861 + +16746 +19715 + +18742 +18810 +6457 +8003 + +3720 +2473 +3156 +3758 +2095 +1872 +1767 +3754 +5011 +3188 +2691 +3555 +4826 +2148 +2012 + +8200 +5372 +6960 +5423 +2383 +2252 +6375 +3558 +1643 + +4653 +3017 +1840 +4479 +6043 +4533 +5374 +5708 +5026 +2557 +2984 +2175 +3797 +1367 +2809 + +1439 +2943 +2091 +6539 +5602 +8757 +2165 +2013 +8140 +4465 + +1216 +3681 +6650 +3628 +5812 +1127 +3023 +4629 +6060 +3294 +4414 +6013 +3311 + +5454 +10288 +4812 +7823 +10332 +2413 +1891 + +46279 + +9578 +8113 +19699 +10360 + +1604 +6410 +6017 +7080 +6023 +3892 +5152 +5250 +2799 +3333 +3451 +3430 + +9888 +6658 +4837 +9174 +9517 +1927 +4135 +4802 + +10514 +1492 +1142 +10574 +7578 +6753 +4250 +7526 + +4997 +6345 +5735 +2312 +5652 +6281 +1808 +5840 +6222 +4264 +6164 +3923 +2953 +4549 + +1751 +7956 +7499 +4659 +3770 +3266 +3921 +2854 + +1750 +6872 +3010 +7148 +1621 +3709 +3454 +5347 +7743 +1274 + +4212 +7252 +9341 +1973 +11385 +5895 +2077 + +6658 +1338 +4893 +2578 +9604 +2595 +3414 +1080 +6270 + +24007 +4451 + +12972 +11908 +9381 +1048 +7389 +8138 + +2266 +2599 +4165 +4784 +4626 +4361 +3710 +2182 +3845 +4487 +2023 +2986 +1893 +5845 +5497 + +6805 +5697 +1281 +6524 +2711 +2519 +2117 +4087 +5690 +4330 +1135 +4761 + +5844 +3385 +1138 +1569 +1517 +1556 +9548 +5483 +3219 + +4644 +2601 +5562 +3819 +1254 +5815 +5846 +5382 +3150 +4171 +5534 +6094 +4472 +2061 +4076 + +2878 +1410 +9640 +5071 +3324 +8293 +9940 +3408 + +17130 +10210 +10359 +4906 + +2544 +5660 +6090 +3828 +7403 +2801 +8923 +5277 +8099 + +3795 +1966 +4800 +3767 +4208 +3259 +8457 +4220 +8519 + +1605 +10471 + +5185 +4592 +4389 +3287 +2304 +1856 +4737 +2879 +6366 +6552 +3801 +4487 +3732 + +6012 +5767 +6959 +8554 +8079 +8259 +4657 +5856 + +14046 +3590 +12095 + +2973 +3878 +3645 +4276 +2320 +2886 +5517 +6727 +5742 +1098 +3216 +2442 +3818 + +1273 +4150 +3080 +3346 +2788 +1989 +3112 +4219 +3596 +3513 +4205 +6202 +4782 +2784 + +5051 +2764 +3741 +6410 +1016 +7444 +2184 +3062 +5225 +1274 +6015 +1728 + +2377 +8151 +5516 +5535 +4053 +5950 +10235 + +7837 +2220 +5837 +12251 +16188 + +4297 +16215 + +1978 +1710 +1777 +4212 +6858 +3883 +6775 +2192 +1175 +5995 +1271 +2740 +2628 + +4320 +4494 +5177 +1999 +5490 +1489 +4324 +5227 +1450 +5883 +2319 +4774 +4458 +2351 + +3448 +6913 +8451 +6462 +5866 +11217 +2186 + +4201 +4589 +7100 +4364 +7012 +2153 +7302 +5890 +1686 +6211 +3490 + +15256 +11330 +2576 +16295 +12696 + +3284 +8133 +4210 +9105 +7168 +6026 + +11776 +6637 + +4573 +6043 +1000 +6736 +4118 +5208 +2927 +7477 +5529 +4854 +3522 + +5080 +8530 +6703 +6196 +9315 +5603 +7705 +4264 +4226 + +2260 +9738 +5010 +1686 +1937 +8207 + +25668 +27349 + +2869 +4713 +4882 +2679 +7961 +3163 +5782 +6503 +4208 +2063 + +6247 +4463 +2240 +7150 +2727 +7441 +3721 +7962 +2128 +4317 +1091 + +4963 +1111 +5113 +3820 +3030 +2167 +2925 +1805 +1441 +6450 +1386 +2862 +1594 + +7176 +12022 +1849 +4085 +4515 +10053 +11249 + +18317 +1781 +18494 + +4370 +19502 +2229 +19624 + +3242 +16141 +5070 +19552 + +4082 +7003 +9394 +4500 +9162 +1991 +3555 +4769 + +3386 +5867 +8192 +6543 +1930 +10974 +1136 + +1004 +7929 +9658 +7020 +7231 +9331 +1749 +2973 +6859 + +6997 +1865 +4744 +5725 +8391 +8664 +1142 + +19299 +3449 +16386 +13658 + +1825 +1988 +5454 +6369 +7466 +4535 +5033 +2624 +4671 +1715 +1130 +2785 + +6349 +3298 +15373 +3765 +8607 + +1467 +1151 +5692 +5349 +5878 +2378 +1060 +3500 +3794 +5979 +2498 +5792 +1346 +3951 +3002 + +6298 +7169 +2292 +5334 +3964 +1367 +4002 +5096 +2232 +2396 +2399 +3622 + +4478 +13270 +6750 +14796 +2444 + +28084 +22563 + +10371 +10158 +8358 +8893 +2048 +10170 +1975 +5860 + +2826 +5313 +6768 +5757 +5251 +7693 +2295 +3278 +4889 +6677 +2869 + +4648 +4125 +5271 +2075 +5706 +6365 +2815 +6123 +3621 +2536 +5841 +2819 +3421 + +19400 +15923 +4719 +19889 + +15442 +24965 +20121 + +12765 +6225 +9594 +3324 +10745 + +9550 + +3573 +6393 +7665 +8995 +4214 +7717 +1278 + +8653 +5104 +3346 +4537 +1870 +8001 +2938 +4618 +6738 +2912 + +3315 +1537 +10677 +9986 +6898 +9306 +7037 +1489 + +6055 +5329 +1855 +2859 +6953 +2772 +5646 +4659 +1638 +4294 +2050 +5063 + +66765 + +3712 +3030 +8171 +2898 +8367 +10670 +4897 + +5012 +5099 +4827 +3947 +6708 +1704 +3714 +2225 +4425 +2528 +2396 +1261 + +5626 +2971 +12919 +16816 + +4547 +12905 +11292 +18931 + +3530 +9875 +4672 +3897 +8547 +3293 +4835 + +43142 + +24258 +9997 +21496 + +1208 +5598 +1340 +3351 +3856 +4368 +2935 +5296 +3972 +3060 +2599 +1795 +5210 +5403 +3473 + +4457 +3498 +3815 +1380 +2356 +3167 +5418 +5314 +1344 +1837 +4187 +2184 +5629 +4746 +1087 + +21757 +8610 +4689 + +11777 +5837 + +12118 +5293 +13465 +8537 +7762 +3782 + +6183 +15013 +7399 +14944 +6213 + +43907 + +8307 +5251 +3694 +4573 +2578 +3687 +3885 +1965 +6973 +6266 + +27104 + +1946 +3232 +2101 +9268 +9634 +4100 +1878 +9129 +4192 + +9175 +11691 +4274 +8684 +8889 +4557 +7587 + +4279 +8296 +4685 +2930 +8289 +6175 +4472 +2901 +2936 +7176 + +11323 +9385 +11725 +9793 +8426 +6393 +6004 + +3672 +4161 +3337 +1929 +3171 +2371 +3786 +7876 +4149 +4925 +4705 + +28965 +32051 + +2398 +1799 +5037 +4165 +2010 +1355 +1575 +5139 +6084 +4016 +5215 +6103 +3298 +4534 +4615 + +6660 +7961 +8168 +3330 +6912 +6116 +7870 +9037 +1571 + +6421 +3027 +5685 +3979 +2831 +5353 +2478 +1044 +6811 +7667 +2964 + +3919 +10974 +2860 +4617 +10693 + +5548 +5360 +1319 +5437 +1422 +3565 +4957 +4813 +1684 +3627 +3082 +3486 +6118 +1841 +4263 + +1874 +4344 +6124 +11147 + +6594 +6216 +7338 +3533 +6738 +3045 +1244 +6486 +3200 +2511 + +1139 +21415 +25857 + +16318 +1430 +3369 +9263 +9929 + +5928 +15789 +11887 +12028 +8417 + +6149 +1642 +2773 +4464 +2136 +3018 +3822 +3430 +1317 +7242 +3908 +4536 + +1425 +5550 +4635 +2039 +1290 +2618 +3862 +2107 +4921 +2991 +2703 +1932 +2568 +2266 +5553 + +5660 +8736 +4457 +5190 +1149 +9538 +8720 +6090 +3093 + +13268 +25486 +19311 + +2275 +5258 +6428 +2407 +3893 +1339 +6016 +5075 +3342 +1951 +3939 +5464 +2310 +2111 + +9213 +4141 +13988 + +20253 +20757 +12387 + +6720 +9453 +11786 +5246 +8519 +1807 +4846 + +11442 +6565 +3556 +4281 +13793 + +11152 +7384 +3135 +7831 +9622 +2549 + +1687 +3983 +4666 +5010 +7569 +8614 +3537 +5490 +5002 +5659 + +5692 +2560 +6875 +3031 +3324 +5731 +6464 +9583 +3505 + +1814 +1393 +3673 +5469 +6392 +1052 +2787 +5115 +2666 +2590 +6565 +1842 +2506 + +5592 +3509 +5060 +4589 +2619 +3283 +4145 +1590 +6079 +1312 +5693 +5182 +5071 +5476 +2187 + +5848 +11351 +8303 +11454 +7250 +9222 +9673 + +1348 +4372 +5362 +4031 +3730 +4094 +5193 +1949 +3386 +1840 +1414 +2665 +5000 +1427 +2756 + +5415 +4977 +4836 +5095 +4250 +4958 +5446 +1788 +3187 +2285 +5023 +4540 +6505 +6193 + +9926 +5929 +10070 +9154 +15694 + +5424 +2275 +2556 +7747 +8450 +2304 +8512 +5397 +3831 + +5193 +2733 +5044 +6255 +9617 +7568 +2363 +7297 +8281 + +3912 +8171 +5412 +6963 +2854 +5319 +5093 +3672 +7422 +8003 + +1986 +3826 +3202 +3431 +1361 +1949 +2237 +6455 +7354 +2587 +6648 +5011 + +26126 +35104 + +2811 +3929 +2049 +6213 +6242 +6074 +5336 +1684 +2556 +4831 +2963 +3482 +4728 +3548 + +5652 +5134 +5168 +3953 +7858 +2654 +6512 +2084 +4173 +5224 +3278 + +3599 +5356 +1114 +4191 +4473 +5066 +5490 +3564 +5826 +1516 +4392 +5289 +1281 +4404 +2274 + +58222 + +2493 +5894 +3528 +6543 +6011 +5090 +3001 +3783 +5710 +3351 +3936 + +4894 +2255 +1579 +3849 +1090 +4218 +4196 +3818 +3701 +6652 +6393 +5254 +3891 + +1041 +6701 +8442 +4691 +1054 +9791 + +63207 + +4085 +3685 +3858 +6123 +2192 +7228 +2276 +4588 +2134 +5990 + +1857 +18111 +17100 +12276 + +2353 +5464 +5442 +5230 +4412 +3189 +5513 +5813 +2459 +4570 +3493 +1753 +2059 +5804 +2150 + +9941 +13582 +3983 +5035 +7121 +8255 + +6637 +2409 +5469 +2433 +6675 +5290 +4965 +2161 +4358 +2845 +3302 + +3888 +1312 +7084 +4568 +14787 + +16704 +17915 +12348 +10556 + +3055 +2579 +3744 +3287 +5974 +4817 +2966 +5913 +3291 +2043 +4534 +1323 +5913 +2638 +4941 + +6305 +4244 +10277 +6254 +13667 +4572 + +1538 +13957 +13223 + +5856 +1394 +1329 +1395 +5874 +1899 +1884 +6484 +2784 +4268 +1631 +1822 +2463 +3880 + +14105 +14883 +18198 + +3032 +3784 +5643 +3773 +5888 +1178 +3793 +5230 +4118 +2181 +4977 +5507 +2111 +2718 + +2275 +5842 +1675 +6194 +5207 +1151 +3795 +1214 +1684 +2885 +4067 +3938 +4495 +4713 + +8752 +7608 +9819 +10438 +8672 +9792 +3246 +10448 + +1844 +14438 +13886 +14646 +2801 + +4032 +2553 +2327 +2321 +5334 +4677 +5466 +5474 +5194 +2828 +6113 +2979 +4755 +5295 + +3164 +4556 +7645 +2198 +2053 +1154 +1976 +1231 +4290 +4049 +5697 + +3635 +1307 +2316 +5508 +6603 +5483 +6365 +4073 +1325 +4043 +1807 +1871 +2056 + +6233 +5552 +8415 +2110 +8085 +9293 +6374 +6406 +5730 + +5077 +6068 +9548 +6279 +1000 +3764 +3649 +4720 +3278 + +5222 +1356 +4185 +2401 +1947 +4042 +5903 +4500 +3817 +6871 +4859 +5715 +4061 + +15888 +8533 +18355 + +65924 + +9638 +2232 +5209 + +14127 +21496 +6679 + +4269 +5055 +5129 +3308 +6977 +5175 +8822 +2381 + +57210 + +5510 +1878 +3933 +4081 +5101 +3974 +2211 +2310 +4652 +3113 +3414 +3844 +1637 +3225 +5057 + +12780 +11976 +6407 +3161 +11266 +7404 + +5178 +3541 +3449 +2443 +3099 +5232 +5838 +1724 +5830 +1147 +2092 +5034 +1235 +2502 +5532 + +12966 +12188 +2554 +13972 + +6587 +3279 +1462 +1804 +1398 +1172 +7309 +7422 +6432 +1024 +3065 +4228 + +2694 +7331 +14584 +9982 + +7038 +6957 +4701 +7704 +2598 +5320 +5967 +6921 +1647 + +3296 +2784 +5532 +5546 +5876 +5368 +1054 +5058 +4827 +1357 +6359 +6830 + +4292 +3508 +2337 +4779 +6114 +4836 +5981 +3416 +6699 +3472 +5791 +3957 +6943 + +3478 +4225 +3052 +4254 +3454 +4037 +1586 +5076 +2839 +1992 +4261 +3288 +1343 +2341 +1551 + +17502 +4858 +18898 +5672 + +8686 +2583 +1331 +3358 +6292 +2778 +5709 +1961 +6840 +4022 + +2762 +7622 +7131 +7486 +11995 +10403 +7014 + +3729 +7653 +2913 +4205 +5248 +6521 +5522 +2238 +6185 +6906 +6982 + +13279 +15590 +6519 +5881 +10256 + +11856 +7565 +1021 +2750 +4574 + +6775 +1059 +1006 +4734 +8301 +10502 +4313 + +1474 +3139 +3822 +5821 +3711 +3319 +5126 +3229 +2014 +3850 +2412 +2025 +5909 +1183 +1785 + +2726 +6526 +6606 +6153 +7205 +1503 +5204 +6244 +5856 +3962 +2148 +4222 + +4715 +1689 +4771 +2137 +3780 +1441 +5840 +1161 +5664 +4784 +2380 +1710 +1514 +1631 +1383 + +17682 +10199 + +11639 +6724 +3935 +2520 +2078 +1975 +8774 + +2252 +1541 +5525 +3020 +5282 +4457 +5951 +6672 +7622 +4374 +6671 + +5651 +2720 +1633 +2704 +5113 +1968 +2943 +1763 +4803 +3768 +2712 +1141 +6006 +4546 +4336 + +9165 +8307 +1687 +4532 +4194 +4442 +6385 +5555 + +3820 +4280 +1133 +3789 +5471 +1788 +1694 +5654 +4802 +4218 +2428 +2933 +2219 +3567 +1743 + +2881 +4847 +1363 +5396 +1564 +5633 +4521 +3209 +2555 +5482 +2613 +4118 +5167 +3873 +2554 + +7668 +5845 +11661 +6560 +2189 +5230 +1923 + +29880 +25227 + +4503 +2215 +4600 +8892 +3104 +1325 +2103 +8983 +4061 + +4784 +9543 +16484 +18339 + +1331 +1544 +1291 +3863 +1005 +2002 +2907 +3014 +5819 +1397 +5856 +2182 +6055 +4812 +4226 + +5402 +3893 +4333 +4381 +5053 +3248 +1537 +3147 +2459 +3383 +2214 +5900 +5862 +2002 +1870 diff --git a/day2/Day2Part1.hs b/day2/Day2Part1.hs new file mode 100644 index 0000000..0345c63 --- /dev/null +++ b/day2/Day2Part1.hs @@ -0,0 +1,11 @@ +module Day2Part1 (main) where + +import Day2Lib + +convertToString :: Int -> String +convertToString = show + +main :: IO () +main = do + input <- getContents + putStrLn $ convertToString $ day2 input diff --git a/day2/Day2Part2.hs b/day2/Day2Part2.hs new file mode 100644 index 0000000..b1f4d9f --- /dev/null +++ b/day2/Day2Part2.hs @@ -0,0 +1,11 @@ +module Day2Part2 (main) where + +import Day2Lib + +convertToString :: Int -> String +convertToString = show + +main :: IO () +main = do + input <- getContents + putStrLn $ convertToString $ day2Alternate input diff --git a/day2/input b/day2/input new file mode 100644 index 0000000..79dbbc9 --- /dev/null +++ b/day2/input @@ -0,0 +1,2500 @@ +C Y +C Z +B Z +A Z +A Z +A Y +A Z +C Y +C Z +A Y +A Y +B X +A Y +C Z +C Z +B X +C Z +A Z +B Y +C Z +A Y +C X +B Y +A Z +B Y +C Z +B Z +B Y +C Z +A Z +A Z +B Z +C Z +A X +B X +C Y +C Z +C Z +C Z +A Y +C Z +C Z +C Z +C X +A Z +A Z +C Y +A Z +C Z +C Z +C Z +A Z +B Y +C Z +A Z +B Z +A Z +A Y +B X +B X +C Z +C X +C Z +C Z +A Z +B Z +B X +B X +B Y +C X +C Y +A Y +C Z +A Y +C Z +A X +B X +B X +C X +B X +B X +A Y +B Y +C Y +A Z +C Y +B Y +B X +B X +B Z +B X +B Z +A Z +B Y +C Z +B Z +B Z +B Y +A Y +C Z +A Z +C Y +C Z +B Z +C Z +C Z +B Y +A Z +C Z +C Z +A Z +A Z +B X +C Y +A Y +C Z +B Y +C Z +A Y +C X +C X +B Y +C Z +C X +C Z +B Y +A Y +B Z +C Z +B Y +C Y +C Z +C Z +B Z +C Z +A Z +A Y +C Z +C Z +B Y +A Z +C Z +C Z +C Y +B Y +C Z +C Z +C Z +C Z +A X +B Y +C Z +B Y +C Z +B Y +C X +C Y +A X +C Z +B X +B X +A Z +A Z +A Z +B Y +C Z +B Z +A Z +B Y +C Y +C Z +C Z +C Z +C Y +C Z +B Y +C Z +C Z +B Z +A Y +B Z +C Z +C Y +A Z +C X +B Z +C Y +B Y +C Z +C Z +A Z +C Y +C Y +C Y +B Y +C Z +C X +B Y +C Z +C Y +B Z +A Y +C Z +A Y +B Z +A Y +A Y +B Z +A Z +C Z +C Z +B X +C Z +C Z +B X +B Y +C Z +C X +A X +C Z +C Z +C Z +B X +B X +A Z +C Z +C X +A Z +C Z +C Z +A Z +B Z +C Z +B Y +C Z +A Y +B Z +C Z +C Z +C Z +C X +A X +A Y +B Y +C Z +B Y +C X +A Y +C Z +C Z +B Y +B Z +C Z +B Y +B Y +B Y +A Y +C Z +B Z +A X +B Y +C Z +C Z +C X +A Y +C Z +A X +B Y +A X +A Z +B X +B X +C Z +C Z +A X +C Z +A Y +B Y +B Z +C X +C Y +B X +C Z +C Y +B Y +C Z +C X +B Z +C Z +C Z +C X +C Y +C Z +A Y +C Z +C Z +C Z +C Z +C Z +C Y +B Y +C Z +A X +A Z +C Y +B Z +B X +A Z +C Z +C Y +C Z +C X +A Y +C Z +A Z +B Y +B Z +C Z +B Z +A Y +C Z +B Y +C Z +C Y +C Z +C X +A Y +A Y +C Y +C Z +C Z +B Y +A Z +C Z +C Y +A Y +A Z +A Z +C X +C Z +B X +C Y +C Z +C Z +B Y +C Z +B X +C Z +B Z +B Y +C X +C X +A X +B Y +A Z +C X +B X +A Z +C Z +C Z +A X +A Y +B X +C Z +A X +C Z +B Y +C Z +A Y +B Y +C Z +B Z +B Y +A Z +C Z +A X +B Z +C Y +B Z +B Y +A Z +A Y +A Z +A X +C X +A X +C Y +C Z +A Y +C Y +B X +A X +A Y +C Y +B Y +C Z +C Z +B Z +C Z +C Z +C Z +C Z +C Z +C Z +C Z +B Y +C Z +A Y +B Y +C Y +C X +C Z +B Z +B Y +C Y +C Z +A Z +C Y +B Z +C Z +A Z +C X +B Y +B Y +B Y +C Z +B Y +A Y +C Z +C Z +A Z +A Z +C Z +B Z +B Y +C Z +B Y +B Z +C Z +A X +A X +C X +C Y +A Y +C Z +A Y +A Z +C Z +C Z +C Z +B Y +A Z +B Z +C X +B X +C X +B Y +C Z +A Z +C Z +A X +B Z +B Z +B Y +A Y +C Z +B X +C Z +B Z +C X +A X +C Z +C Z +B Z +B Y +C Z +C Z +A Z +C Y +C Z +B Y +A Y +B Y +A Y +C Z +C Y +B Z +A Y +C Z +B X +B X +B X +C Y +C Z +A Y +C Z +C Z +C Z +A Y +C Z +B X +A Z +C Z +C Z +A Y +C Z +C Z +B X +C Z +B Y +A Z +C X +C Y +C Y +C Z +C Y +A Y +B Z +C Z +C Z +C Z +B Y +C Z +C Z +A Y +A X +A Y +C Y +C Z +C Z +A X +B Z +C Z +C Z +B Z +B Y +C Z +A X +C X +A Z +B Z +C Z +A X +C X +C Z +B Y +A X +A X +C Z +C Z +B X +C Z +B Z +B Y +A X +C Y +C Z +C X +A Y +B Y +C Z +C Z +C Z +C Z +B Z +A Y +C Z +C Z +B Z +C Y +B Z +B X +B Y +A Z +C Z +A Z +B Y +C Y +C Z +C Z +C Z +B Z +C Z +C X +C Z +B X +C Y +B Y +C Z +C Z +C Z +C Z +B Y +B Y +C Z +B Y +C X +B Z +A X +C X +C Z +B X +C Z +C X +C Z +A X +A Z +B X +C Z +C Z +B Y +C Z +A Y +C Z +C Z +C Y +C Z +A Z +A X +C X +B Y +A Y +B Y +A X +C Z +B Y +B Y +C Z +C Z +B Y +B X +A Y +C Z +B Y +C Y +C Z +C Z +C X +B Y +A Z +C Z +A Z +A X +C X +A Z +C Z +C Z +A X +B Z +C Z +B Y +A Z +A Y +A X +A Y +A X +C Z +A X +B Y +A Y +B Z +C Y +C Z +B Z +C X +A Y +A Y +C Z +C Y +C Z +B Y +B Y +B Y +B X +C Z +C X +B Y +C Z +C Z +B Y +C Z +C Z +B Y +C Z +C Y +C Z +C Y +C Z +C Y +A Y +A Y +C Y +C Y +C Y +C Y +C Z +C X +B Z +B Z +C X +C Z +B Y +B Y +A Z +C Y +C Z +C Z +C X +C Z +C Z +A Z +B Y +C Z +A Y +C Z +C Z +C Z +A Z +C X +C Y +B Y +A Z +B Z +C Z +B Y +C Z +B Z +C X +A X +C Y +A Y +B Z +B Y +A X +C Z +B Z +C Z +C Z +C X +B Z +C X +A Z +B Z +C Z +C Z +C Z +B Y +A X +C Z +C Y +C Y +C Z +A Z +C Z +C Z +A X +C Y +B Y +A Y +A Z +A Z +B Z +C Z +A Z +B Y +B Y +A Y +A Z +A Z +C Z +C Z +C Z +A X +C Z +B Z +B X +C Y +A Z +B Y +C Z +B Y +A X +C Z +A Z +C Z +B Z +C Y +C Z +B Y +A Z +B Z +A Y +B X +C Z +B Y +C Z +C Z +C X +C Y +C Z +B X +C X +A Y +A Y +C Z +C Y +B Y +C Y +C Y +C Z +A Y +A Z +B Y +C Z +C Z +A X +C Z +C Y +C Z +B X +C Y +A Z +A Y +A Z +C X +C Z +C Z +C Z +B Z +C Y +B Z +C Z +B Y +C Z +B Y +A Y +B X +C Z +A Y +C Z +A Y +A Z +A Z +B Z +A Y +C Z +A X +B Y +C Z +B Z +C Z +A Y +A Y +B Z +B X +B X +C Y +C Z +C Z +C Y +A X +B Z +C X +B Y +C X +B X +C X +C X +C Z +A Y +C Y +C Z +B Z +A Z +A Z +C Z +A Z +C Z +A Z +A X +B Y +A X +A Y +C X +B Y +C Z +A X +B X +C Z +C Z +C X +B X +A Z +B X +C Z +B Y +C Z +C X +C Z +C X +C Z +B Z +B Y +C Z +B X +C X +C Z +C Y +A Z +B Z +A X +B X +B X +C Z +B Z +C X +A Y +C Z +C Z +B Y +C X +C Z +A X +B Y +C Z +C Z +C Z +C Z +C Z +A X +A Z +C X +A Z +C Z +A Z +C Z +B Y +B Z +A X +C X +C Z +B Z +A Z +C Z +C Y +C Z +C Z +C X +A Y +B Y +C Z +A Y +C Z +B Z +C X +B Z +B Z +B X +B Z +C Y +C Z +C Y +B Y +C Y +C Z +C X +C X +A Z +B Y +C Z +A Y +B X +C Y +A Y +A Z +B Y +B Y +A Y +B Y +B Z +A X +C Z +B Y +A X +C Z +C Z +C X +B Y +A Z +A X +B Y +A Z +C Z +B Z +B Z +B Y +B Y +A Z +A Z +A Y +C Z +C Z +A Z +C Z +C Z +C Z +A X +C Z +A Y +C Y +A Z +C Z +B Y +C X +B Y +C Z +C Z +C Z +A Z +B Z +B X +C Z +C Z +A Y +B Z +B X +C Z +C Y +A Y +C Y +C Y +C Z +C Y +C X +C Y +B Z +B Y +C Z +A Z +A Y +C Z +C Z +B Y +B Y +A Z +A Z +A X +C Z +C Z +A Y +B Y +C X +C Z +C Z +A Z +C Z +B X +B Y +A Y +C Z +A X +A Y +C Z +B X +C X +B Z +C Y +C X +B Y +B Y +C Z +C Z +C X +C Z +A Y +A Z +C Y +C Z +A Z +C Z +C Y +A X +C X +C Z +B X +C Z +B X +C Z +C Z +C Z +B X +B Y +B Y +B Y +C X +B Y +C Z +C Y +C Z +C Z +B X +C Y +B Z +C Z +C Y +C X +C Z +A X +A Z +C Z +C Y +C X +C Z +B Y +C X +C Y +C Z +C X +A Z +B Y +B X +C X +C Y +B Z +C Z +C Y +B Z +C X +A Z +A Y +C Z +C Z +C X +B Y +C Y +C Z +A Z +B Z +B Y +B Y +B Z +C Z +A X +B Y +A Z +A Y +C Z +C Z +B Y +C Y +C Z +B Z +A Z +B Z +C Z +C Z +B Y +B X +C Z +C Y +C Z +A Y +C Z +A X +C X +B Y +B X +C X +C Z +C X +B Z +C Z +A Z +B Z +C Z +A X +C Z +C Z +A Y +B Y +B Z +B X +B Z +C X +B Y +C Z +C Z +C Z +A Z +C Z +C X +C X +B Y +C X +C X +C Z +C Z +A Z +C Y +C Z +C Z +B Z +C Z +A Y +B Y +C Z +C Z +B Y +B Y +C X +C Z +B X +A Y +B Z +A Y +A Y +A Y +C Y +C Y +C Z +B X +B Z +C Z +C X +C X +B Z +A Z +A X +B Y +C Z +B Z +A Z +B X +C Z +A Y +C Z +A Z +A Z +C Z +C X +C Z +C Y +A X +B Y +C Z +C Z +C Z +C Z +C Z +A Y +C X +C Z +A Y +B X +C Z +A Y +C Z +C Z +C Y +B Z +B X +C Z +A X +B Y +C Z +C Z +A X +A Y +C Z +C Y +B Y +C Z +C Z +A Y +A Y +A Y +A Y +C Z +A X +A Z +B Y +B Z +A Z +C Y +C Z +C Z +C Z +A Z +C Z +A Z +C Z +C Z +A Z +C Z +C Z +A Z +B X +C Z +A Y +B Y +C Z +A X +C Z +A Y +C Z +C Z +C Y +C Z +A X +B Y +C Z +A Z +C Z +A Z +A Z +B Y +C X +B Y +C X +C X +C Z +A Y +B Z +A Y +C Z +C Z +B Z +A Y +C Z +B Y +C Z +A X +C Z +C Z +C Z +B Z +A X +B Y +C Z +A X +C Z +C X +B Y +C Z +A Y +C Y +B Y +A Y +C Z +A X +B Y +A Y +A Z +C Z +C Z +C X +A Z +C Z +C Z +B Y +B X +A Z +C Z +B X +C Z +C Y +C Z +C Z +C Z +C Y +A Y +C Z +C Y +C Z +C Z +B Y +B Y +B X +C Y +B Z +C Z +B Y +C Z +C Z +C Z +A Z +A Y +C Y +C Z +C Z +A Z +C Z +C Z +C Z +B Y +B X +B Y +A Y +C Z +B Z +C Z +B Y +B Z +A Y +C Z +C Z +C Y +A Y +C Z +C Z +B Y +A Z +A Y +C Z +C Z +B Y +C Z +B Y +B Z +C X +C Y +C Z +A Y +C Z +A Z +A X +B X +C Z +C Y +C Z +C X +B X +B Y +B Y +C Z +C Z +C Z +A X +B Z +C Z +A Z +A Z +C Z +B Y +B X +B Y +C Z +B Z +C Z +B X +B Z +C Z +B X +A X +C Z +C X +B Z +C Y +C X +C Z +C X +A X +A X +C Z +C Z +C Z +B X +B X +C Z +C Z +C X +C X +C Z +A Y +B Y +B Y +B Y +C Z +C Y +C Z +C Z +C Z +B Y +C Y +C Z +B X +C Z +A X +C Y +A Y +C X +A Y +A Z +C Z +B Y +B Y +A Z +C Y +B Z +B Z +A X +B Y +C Z +B X +A Z +A Z +C Z +B Z +A Z +C X +B Z +C Z +C Z +C Z +C Z +B X +B Y +C Z +C Z +C X +C Y +A Z +B X +B Y +B Z +C Z +B Z +C Z +C Z +C Z +C Z +A Y +C X +C Z +A Y +C Z +C Z +B Z +C Z +A Z +C Z +A Y +C X +C Z +A X +C X +C Z +C Z +B Y +C Z +A Z +C X +C Z +B Y +A Y +B Y +C Z +B X +A X +C Z +B Y +C Z +B Y +A Z +A Z +C Z +A Z +B Y +C Z +C Y +B X +C Z +A Z +B Z +C Z +C Y +C Z +B Z +A X +A X +A Z +C Z +C Z +C Y +C X +C X +A X +C X +B X +C X +A Y +C Y +C Z +C Z +C Z +C Z +C X +A Y +C Y +A Y +B X +C Y +C Z +A X +A Z +C Z +C Z +B Y +C Z +B Z +C Z +C Z +A Y +A Y +C Z +C Z +A Z +C Z +C Z +B X +C Y +C Z +C Z +C Z +C Z +A X +B Y +B X +B Z +C Z +A Z +A Z +B Z +A Z +B X +C Z +B Z +C Z +A Z +C Z +C Z +A Y +B Y +C Y +B X +A Z +C X +C Z +C X +B Y +B Z +C Z +C Z +C Z +C Y +C Z +A X +A X +A Y +C X +C X +A Y +B Y +C X +C Z +C Z +B X +B Z +B X +C X +B X +A Y +C Z +A Z +C Z +C Z +C Z +C Z +C X +A Z +B Y +C Z +C X +A Y +A Y +C Z +C Z +B Z +B X +C Z +A Z +B Y +C Z +C Z +B Y +A Y +C Z +B Z +B Z +A Z +C X +C Z +B Z +C Z +C Z +B Y +C X +B Y +A Z +C Z +A X +C Z +B Y +C Z +A Z +B Z +C Z +A Z +A Y +C Y +B X +C Z +A Y +C Y +A X +A Z +A Y +C X +C Z +C Z +B Z +A Z +C Z +C Z +C Y +C X +C Y +B Y +C Z +B Y +C Y +C Y +C Y +A X +C Z +C Z +B X +B Y +C Z +A Y +C Z +A Y +B Z +C Z +C Z +C Z +A Y +A X +B Z +B Y +A Y +A Y +B Y +B Z +C X +A Y +B Y +C X +C Z +C Z +B Y +C Z +C X +C Z +C X +C Z +A Y +A Y +B Y +C Z +A Z +C Y +C Z +A X +C Y +C Y +C Y +A Z +C X +C Z +C Z +A Z +C Z +B Y +C Y +C Z +C Z +C Z +B Z +C X +C Z +C Z +C X +C Z +C Z +C X +C Z +C X +B Z +B X +A X +C Z +A Y +C Z +B X +C Y +A X +C X +B Z +C Z +A Y +A X +C X +B Z +B Z +C X +A Y +C Y +A Y +C Z +C Y +A X +C Z +A Y +A Z +C Z +B Y +C X +A Y +A Y +C Y +B Y +A Z +B Y +C X +A Y +B Z +B Z +C Z +C Y +C Z +B Y +C X +C Z +C Z +A Y +C Z +C X +A Y +C Z +C Z +B X +C Z +A X +C Z +A Y +C Y +A Y +B X +C Y +C Y +A Y +C Z +A Z +C Z +C Y +C Z +A Z +A Z +C Z +C Z +C Z +C Z +C Z +A Y +A Z +B Y +C Z +A Y +C Y +C Z +A Y +C X +C Z +A Z +C Z +C Y +C X +C Z +C Y +A X +B Y +C Z +A Y +A Z +C X +C X +C Z +A Z +C Z +C Z +C Z +C Z +A X +C Z +C Z +C X +C Z +A Y +C Z +C Z +B X +B Y +C Y +B Z +C Y +C Z +B Y +A Y +A Y +B Y +A Z +B Z +B Y +A X +C Z +B X +A Y +C X +C Z +C X +C Z +C Z +C X +A Z +B Y +A X +C Z +C Z +B Z +C X +C X +B Z +A Y +A Y +A Y +A Z +C Y +C Z +A X +B Y +C Z +B Y +B Y +C Y +C Z +C Y +B Y +C Z +B Z +C X +C X +A X +C Z +C Z +B Z +A Y +A Z +B X +B Z +B Y +C Z +A Z +C X +A Z +B Y +C Z +B Y +A Y +C Z +A Y +B Z +C Z +A Z +B Z +B Y +B Y +A X +B Y +B Y +C Z +B Y +C Z +B Z +A Z +A Y +C Z +B Y +C Z +C Z +C X +C X +C Y +B Y +C Y +A Z +C Z +A Z +C Z +B Z +C Y +C Z +A X +B X +A Z +A Y +A Y +C Z +C Z +C Z +C Y +C Z +C Z +A Z +A X +B X +A Z +C Y +C Z +B Y +A Y +A Y +B X +B X +C Z +C Z +C Z +C X +C Z +C Y +C Z +A Y +C Z +C Z +C Y +A Z +B Y +A Y +B Y +B Y +A Y +A Y +B Z +C Z +C X +B Y +C Z +C Z +C X +A Z +B Y +A Z +C Z +C Z +B Y +C X +C Z +C Y +A Y +C Z +A Y +B Y +A Y +C X +C Y +C Y +B Y +B Z +A Z +C Z +C Y +B Z +B Y +A Y +A Z +A Y +A Y +B X +C Z +A X +B Y +B Y +C Z +B Y +B Y +B Z +C Z +A Y +C X +A X +A Y +C X +A Y +A Z +C Z +B Y +B Y +B Y +C Y +A Y +B Z +C Z +C Z +B Z +C Z +B X +C Y +B Y +A Z +C X +A Z +C Z +B X +C Z +C Z +B Z +C Z +A Z +A Z +B Y +C Z +A Z +C Y +B Y +B Z +C Z +C X +C Z +A Z +C Z +C Y +C X +A Y +B Y +B X +C X +C Z +A Z +C X +B Z +C Z +A Y +C Y +C Z +A Z +C Z +A Z +C Y +C X +C Y +B Z +B Y +A Z +A Y +B X +A Z +C X +C Y +C X +C Z +C X +A X +C Z +B Y +C Z +A Y +B Z +C X +B Y +C Z +A Z +C Z +C Z +C Y +A Y +A Z +A Y +C X +B Z +A Z +C Z +C Z +C Z +A X +C Z +A Z +A Y +C X +B X +C Z +C Z +A X +A Y +C Z +C X +C Z +A Z +C Y +C Z +B Z +C Y +C X +A Y +A X +A Z +C Z +C Z +C Z +C Z +A Y +C Z +A Z +A Y +C Z +B Z +B Y +C X +C Z +C X +C Z +B X +A Y +C Z +B Z +A Z +A Z +B Z +B Z +C Z +C Z +B Y +C Z +A Y +C X +A X +A X +C X +C X +B Y +B X +A Y +C Z +B X +B Y +A Z +B Z +A Z +A Z +C X +C Z +A X +A Y +C X +C Y +C Y +C X +A Z +C Z +C X +C X +A Y +A X +C Z +C Z +B Y +B Z +C X +C X +C Z +B Z +B Z +B Z +B Z +B Y +B X +C Z +C Z +C Z +C X +C Z +C Z +B Y +C Z +C X +B Y +C Z +C Y +B Z +C Y +C Z +C Z +C Z +C Z +C Z +C Z +C Z +A X +A Y +C Y +C Z +A Y +B X +C Z +B Y +C Y +C Z +C Z +C Z +C Y +C Z +A Z +B Y +A Z +C Z +B Z +C X +C X +A Z +C Z +C X +C Z +B Z +C Z +C Y +B X +C Z +A Z +C X +B Y +B Y +C Z +C Z +C Z +B Y +C Z +B Y +A Y +B Z +B Z +B Y +C Z +B Z +A X +C Z +C Z +C Z +B Y +B Y +C Z +C Y +C Z +B Y +C Z +B X +B Z +C X +B Y +C Y +B Y +C Z +A Y +B Z +C X +B Y +A Z +C Z +C X +A Z +B Z +A Y +C Z +C X +B Y +C Z +C Z +B Y +B Z +C X +C X +C Z +C Z +C X +B Z +A Y +C Z +C X +A Z +C Z +C Z +C Z +C Y +B Z +A X +B Z +B Z +C Z +C Z +B Z +C Z +B Z +A X +B Z +B Y +B Z +B Z +B Y +C X +A Y +B Y +B X +B X +A X +C Z +C Y +C Y +C Y +C Y +B Y +A X +C Y +A X +C Z +B Z +C Z +C Y +B Y +A Z +C Y +A Z +B Y +B X +C Z +A X +A Z +C Z +C Z +A X +C Z +C X +A Z +C Y +B Z +C Y +B Z +A Y +A Z +C Z +A Y +C Z +C Z +A X +C Z +C Z +C Z +B Y +C X +C Y +C Z +B X +A Z +C Z +C X +B Y +A Y +B Y +C Z +C Z +C Z +A Y +A X +C Z +C Z +C Z +C Z +B Y +A Z +C Z +A X +A Y +B Z diff --git a/day3/Day3Part1.hs b/day3/Day3Part1.hs new file mode 100644 index 0000000..e725909 --- /dev/null +++ b/day3/Day3Part1.hs @@ -0,0 +1,11 @@ +module Day3Part1 (main) where + +import Day3Lib + +convertToString :: Int -> String +convertToString = show + +main :: IO () +main = do + input <- getContents + putStrLn $ convertToString $ day3 input diff --git a/day3/Day3Part2.hs b/day3/Day3Part2.hs new file mode 100644 index 0000000..1294fc2 --- /dev/null +++ b/day3/Day3Part2.hs @@ -0,0 +1,11 @@ +module Day3Part2 (main) where + +import Day3Lib + +convertToString :: Int -> String +convertToString = show + +main :: IO () +main = do + input <- getContents + putStrLn $ convertToString $ day3Alternate input diff --git a/day3/input b/day3/input new file mode 100644 index 0000000..fec6c82 --- /dev/null +++ b/day3/input @@ -0,0 +1,300 @@ +DsPhSBQQQhqmBDhPDsFwjwsLjlRjlttvjvvtRb +rNJMNNbrHrtjHLHjvwtg +fNbNzZdrZnMnMPnQShFPDmnqFm +QWVCFfQffgQCVZzVVpHsHJBqtpspJFRHqq +mwDbmnnGNlNcwNDDNRbnNDlJTpBJBtJGtPTLsBGqTqqsqp +MlSdnScRnnmmDjSdNSdCzvggWzrgzjvfvrgVzW +gsMljbrjlZlWcWMJrWwTwbmwQbmmLDQQLhwL +CdgpzdgpgnfThHfFRwhfRf +SptgpSpnCNpVSGNPvPGSddcMWjMrjqBsJcWqMcBWcVlZ +JcJLQQFWhQJPJpWcwjHvMQvnnlMvzBHd +tCtG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NtqRsLBqLqQtL +ffRRfLVHZHfJHVJcMrMZZwwTzGBBzBTBjGTwrwdSCj +qmWbWQbqnbvWhbQPGnGNnpvwSzltpBldtSdzllptCSjTTt +vWsbnbWnNvQQQQvsRRLfJRRVGfDcfV +PpqrvswPvvvPsNqmDLDttCCcHHZVrCtW +hgSddBhghQMdbhbwhgSdQgCCctZcDtLntLttCVLtSLCc +dGzdQMFzQMdgGGlGJMzBgBwRqNNfmmTsvfRfJTpwjmpP +pcphpdrWDmTgHWMtRWqHRVVH +SbGcGGQnvNQGvsjBtVHBLjvqVPVB +lzbQCzbZllSzQslpCJpJJDggcggfDT +ffrTlhrVrfCsDVTsWzGBBZcBRBqRBWtGtZcq +QNFmFHrHNSSmSLJdJrNGZLbGjbcBjBGjqcbgjc +ddQvPnHddnQJHSHSFPdnFfDDTfDMMCrwMlPTwDCsrC +NBnrNHQHBscvhfBM +bbGtgWWWqZFmnZGZbmVCdMzvvShfzfGcdcfMSS +WqbjnmbnjWgmFFgtWVbWZwNTNLjNprNwQLDwrTrHQr +lwwlcjlzQRBcBccbdLCVnNVWJJzfLndd +pZDMtZpSDMZpMZMsPtHVNJVfRCRddVndnJLSJd +mDTZvTqtDDHttRPcqhQlwgGlghbqBh +DTspTqssqTbdmCMwVmnmlfCD +PLPWjjrSjvPzqZvjvRqjLtPwnnHCmWVcncMnnwmncHcHll +RFztFjjqjQFQTbdTbQ +hTFSVSdhMMVMFjjgbthcbzczcg +DvwCJVJWWJDRnfmbDmccfmmgfb +QrJvPGWWnpVMqdZsZpqM +gRLcHbgnfpgpJjlqqp +SFwrTHFBqlZtBPZq +HTzDwmSvCvCmsmmvTSwvFwcfRRNRLcQRWNssNNbRWLWL +PpMgDMDnsWSnjBQnrjbn +LFcVVGChCFdhdVFZVpVCdVbvQbRrbvBBbBjQSJZrrJrR +FNwGNCCFHcVTHcFdHHHTDzMzfsgzwpPWMmPflmtt diff --git a/day4/Day4Part1.hs b/day4/Day4Part1.hs new file mode 100644 index 0000000..53ad609 --- /dev/null +++ b/day4/Day4Part1.hs @@ -0,0 +1,11 @@ +module Day4Part1 (main) where + +import Day4Lib + +convertToString :: Int -> String +convertToString = show + +main :: IO () +main = do + input <- getContents + putStrLn $ convertToString $ day4 input diff --git a/day4/Day4Part2.hs b/day4/Day4Part2.hs new file mode 100644 index 0000000..a9980d8 --- /dev/null +++ b/day4/Day4Part2.hs @@ -0,0 +1,11 @@ +module Day4Part2 (main) where + +import Day4Lib + +convertToString :: Int -> String +convertToString = show + +main :: IO () +main = do + input <- getContents + putStrLn $ convertToString $ day4Alternate input diff --git a/day4/input b/day4/input new file mode 100644 index 0000000..bc205a6 --- /dev/null +++ b/day4/input @@ -0,0 +1,1000 @@ +71-89,66-70 +24-70,23-55 +19-85,18-86 +50-90,50-95 +55-55,56-72 +3-65,5-66 +98-99,66-99 +14-67,14-14 +4-79,78-79 +13-98,10-98 +27-78,77-78 +22-28,22-27 +84-99,98-99 +7-96,99-99 +33-54,34-54 +29-45,44-44 +18-48,57-78 +89-95,89-93 +39-53,63-99 +13-95,94-95 +7-43,7-42 +16-16,16-96 +41-68,68-87 +83-83,73-82 +65-95,64-71 +5-98,5-95 +51-54,50-99 +33-39,36-74 +9-73,10-86 +20-31,21-59 +12-27,11-12 +10-96,7-11 +55-71,70-77 +13-97,3-14 +5-99,5-5 +25-98,25-98 +81-94,81-94 +26-42,49-74 +77-98,31-77 +8-77,6-8 +48-61,60-61 +11-14,13-52 +97-97,1-96 +48-83,48-82 +44-76,75-93 +21-89,20-89 +10-68,9-91 +2-79,78-80 +10-97,96-97 +9-11,10-76 +44-45,45-97 +34-57,27-56 +12-88,12-87 +16-77,16-16 +74-84,14-75 +22-36,21-85 +15-70,9-70 +81-97,3-81 +24-97,23-79 +8-54,54-55 +18-73,17-74 +22-79,39-79 +2-3,2-73 +1-90,1-90 +59-96,19-96 +31-71,31-31 +62-63,63-64 +15-92,91-93 +73-74,18-78 +64-96,65-96 +5-7,6-64 +96-98,2-97 +62-81,51-62 +38-40,33-39 +26-96,21-95 +31-86,30-87 +11-94,2-11 +3-53,30-52 +28-77,27-98 +17-48,44-69 +9-89,1-89 +42-97,42-99 +1-3,2-93 +16-17,17-21 +95-99,14-96 +51-99,52-57 +28-35,28-35 +30-90,76-91 +4-97,4-4 +78-92,14-57 +74-97,75-97 +15-94,14-94 +29-68,29-69 +1-95,2-30 +6-84,98-99 +12-72,71-72 +5-6,5-30 +19-63,63-72 +4-99,3-99 +5-61,62-62 +35-55,34-56 +11-58,75-87 +4-98,3-98 +33-34,34-77 +56-94,55-95 +8-78,99-99 +19-20,19-90 +58-90,43-57 +87-94,22-84 +20-50,49-60 +14-15,16-90 +7-93,7-89 +7-97,7-7 +4-88,4-89 +35-49,48-56 +53-85,55-94 +5-66,4-6 +17-78,19-78 +6-28,28-66 +55-88,91-98 +21-22,21-94 +18-42,17-42 +4-98,6-98 +10-96,97-99 +25-89,89-93 +5-98,1-5 +62-77,63-73 +12-37,11-38 +17-29,17-29 +51-62,45-61 +86-87,44-86 +33-88,22-33 +89-89,14-88 +89-89,53-81 +61-63,59-64 +56-75,55-75 +21-93,20-90 +81-82,81-82 +8-86,87-96 +3-99,4-98 +30-30,30-33 +3-59,2-59 +58-72,7-70 +45-67,16-45 +14-37,13-13 +29-47,14-46 +2-85,1-3 +61-98,81-86 +16-35,17-80 +4-92,4-92 +10-38,11-97 +92-93,20-93 +40-53,41-53 +28-84,3-35 +11-96,6-36 +57-81,57-82 +77-86,6-77 +4-67,4-67 +55-57,56-76 +26-27,27-45 +44-47,44-46 +7-98,6-99 +10-51,9-87 +10-41,10-10 +7-37,7-90 +55-97,54-54 +21-97,20-64 +64-85,44-53 +31-47,46-59 +67-78,68-95 +27-95,26-66 +11-82,54-83 +52-75,24-67 +13-84,6-84 +37-48,33-41 +27-28,28-57 +23-95,86-95 +8-8,8-28 +27-74,26-28 +56-82,42-56 +9-59,14-59 +26-62,61-94 +1-2,1-88 +83-92,97-98 +13-91,13-30 +42-96,95-96 +43-97,34-97 +45-82,15-69 +90-90,65-91 +25-89,26-26 +16-36,15-15 +14-80,79-79 +49-72,49-50 +19-47,18-88 +7-46,7-23 +14-24,24-80 +2-2,3-98 +2-99,2-99 +14-44,14-14 +25-27,6-27 +28-96,27-97 +24-75,23-81 +10-74,13-75 +61-62,13-62 +94-95,96-98 +22-24,22-82 +10-10,10-81 +37-77,76-77 +10-32,18-32 +8-79,7-7 +45-46,45-77 +16-21,16-20 +8-45,44-57 +19-61,18-61 +9-67,9-66 +4-86,1-86 +49-63,48-63 +39-83,23-82 +3-67,18-67 +74-84,83-83 +32-77,33-77 +14-55,5-49 +59-73,26-73 +15-55,16-83 +19-19,20-43 +59-60,32-60 +30-58,33-39 +9-76,9-76 +67-81,21-68 +37-37,28-38 +64-75,63-84 +5-91,11-88 +41-95,37-96 +46-76,76-87 +39-82,40-82 +92-95,2-93 +92-93,1-93 +4-97,4-98 +31-75,30-75 +97-98,2-97 +78-78,40-77 +36-36,36-41 +5-93,4-94 +29-92,29-92 +41-88,42-92 +9-50,47-51 +16-87,16-16 +18-63,62-63 +89-92,90-95 +80-81,16-81 +3-34,4-34 +13-97,96-98 +1-93,92-94 +34-88,35-87 +97-98,43-97 +41-76,42-69 +28-33,27-46 +1-35,3-99 +9-95,10-94 +15-99,15-92 +93-94,1-94 +42-92,43-94 +91-98,71-90 +19-50,47-50 +24-91,94-99 +10-98,11-98 +42-87,86-86 +18-92,48-92 +52-52,5-51 +73-80,32-74 +43-46,39-50 +41-45,40-44 +48-86,49-68 +55-67,56-67 +34-94,34-34 +16-72,17-71 +27-75,33-75 +3-34,33-34 +27-70,70-71 +85-97,31-84 +46-46,21-47 +1-98,97-99 +15-90,5-90 +10-63,10-62 +3-4,5-77 +18-41,23-62 +32-80,33-79 +17-17,17-89 +63-83,15-83 +5-82,5-82 +51-60,51-82 +1-82,1-82 +9-14,13-97 +10-99,13-99 +70-89,88-97 +84-89,83-90 +80-86,25-85 +29-88,29-89 +5-68,10-68 +95-96,47-78 +26-95,26-96 +1-2,2-87 +32-57,21-58 +3-99,2-3 +93-93,50-94 +62-96,62-89 +52-82,52-81 +27-82,27-27 +39-79,38-39 +17-97,16-97 +2-90,1-91 +43-48,43-52 +5-25,9-25 +4-95,4-5 +14-59,13-59 +44-81,43-43 +95-96,20-96 +13-14,11-14 +26-91,20-91 +23-64,64-64 +20-95,21-21 +4-85,4-84 +17-60,15-60 +79-80,66-79 +78-95,78-90 +34-38,33-38 +41-49,48-49 +4-44,3-44 +68-68,10-69 +4-83,82-84 +86-88,12-87 +2-37,36-75 +7-57,58-81 +11-13,12-99 +6-93,5-90 +28-84,29-56 +6-93,3-3 +35-63,36-72 +7-7,7-55 +27-44,19-44 +41-86,30-80 +1-82,2-81 +1-3,3-92 +2-10,4-52 +12-98,8-11 +5-10,4-27 +47-79,46-46 +47-96,97-98 +74-82,74-75 +36-95,11-35 +10-18,17-24 +32-34,33-48 +9-83,9-83 +7-92,19-92 +12-92,12-86 +7-81,7-82 +24-74,38-73 +19-26,1-26 +5-11,4-11 +13-82,14-81 +33-98,32-33 +30-97,96-96 +28-79,79-81 +60-91,59-86 +50-94,50-94 +74-98,57-73 +5-85,4-37 +4-90,3-71 +22-76,22-76 +48-51,51-65 +4-56,5-55 +2-72,46-71 +18-99,17-93 +98-99,3-98 +14-66,14-79 +12-73,13-72 +16-19,2-17 +2-98,3-98 +65-97,65-96 +9-38,37-38 +9-55,10-95 +49-65,26-66 +7-85,7-86 +18-20,7-19 +33-73,33-73 +18-89,35-56 +1-81,1-71 +18-65,17-65 +84-97,59-94 +10-73,72-73 +2-90,3-66 +13-41,4-29 +1-99,86-99 +20-96,19-68 +84-85,83-85 +27-92,27-92 +20-70,19-19 +11-96,12-97 +35-86,34-36 +8-9,8-22 +9-72,8-72 +5-89,5-57 +46-58,57-59 +41-41,42-75 +32-84,31-88 +39-91,90-91 +6-39,5-60 +51-69,70-83 +5-78,32-75 +8-92,8-8 +2-3,4-81 +70-95,14-95 +10-15,16-72 +26-64,29-63 +26-83,27-82 +48-93,44-47 +76-90,76-91 +73-99,74-74 +9-71,8-41 +13-13,13-91 +32-81,32-80 +9-95,9-95 +97-99,84-96 +90-91,52-90 +2-96,2-97 +73-99,2-97 +6-33,7-27 +9-67,10-67 +47-48,47-59 +3-87,87-99 +35-53,49-64 +40-98,41-93 +52-86,33-85 +23-55,89-91 +29-90,91-96 +5-69,5-69 +27-29,28-68 +14-33,81-88 +2-79,79-98 +34-92,93-94 +1-66,2-66 +8-96,7-97 +12-96,97-98 +78-92,10-88 +86-86,2-87 +11-65,2-64 +19-42,20-41 +2-34,34-93 +36-42,36-43 +10-86,11-78 +2-22,2-71 +8-20,19-95 +5-99,6-89 +6-18,6-6 +3-6,10-81 +69-71,69-69 +52-62,52-62 +79-98,79-98 +49-93,49-70 +10-97,10-97 +23-32,12-24 +7-8,8-94 +37-98,97-97 +2-80,2-79 +33-82,18-98 +53-65,54-90 +68-95,68-96 +7-8,7-14 +24-92,24-91 +31-36,32-48 +13-83,13-82 +23-54,53-53 +43-52,10-43 +24-66,23-94 +19-51,49-68 +66-72,39-66 +23-67,66-67 +34-80,48-79 +83-96,33-82 +79-90,33-95 +10-96,9-78 +12-97,96-99 +10-44,13-96 +2-94,93-93 +5-94,5-94 +71-95,74-97 +60-95,59-96 +86-95,14-86 +4-99,4-54 +12-47,13-13 +23-34,22-34 +49-96,49-86 +37-59,37-59 +1-4,3-94 +9-91,9-91 +57-99,45-57 +8-13,11-13 +11-85,84-85 +47-92,48-92 +4-89,5-89 +4-30,29-31 +10-65,9-64 +60-63,62-92 +43-78,23-42 +16-46,45-47 +26-95,95-96 +63-63,12-64 +21-47,20-47 +14-97,20-98 +6-90,6-86 +71-83,13-72 +64-91,83-90 +5-8,5-7 +42-84,41-98 +30-59,29-60 +6-92,5-95 +5-39,4-40 +71-85,16-70 +2-92,2-91 +8-91,20-91 +72-99,3-71 +31-82,97-98 +78-89,77-90 +48-89,47-89 +63-64,64-64 +24-74,73-88 +1-97,98-99 +73-82,72-82 +13-29,30-98 +11-41,11-12 +36-53,33-52 +46-90,66-89 +4-7,8-87 +5-45,46-91 +11-39,12-78 +42-93,41-85 +40-91,40-91 +23-27,23-51 +3-20,3-21 +64-91,48-91 +57-62,86-91 +5-21,22-89 +45-86,43-86 +94-97,54-93 +13-61,60-60 +25-98,19-97 +34-37,36-37 +97-98,16-96 +4-96,24-95 +2-55,1-92 +62-65,61-73 +21-52,20-21 +43-85,85-86 +2-95,2-95 +10-92,9-92 +8-99,9-98 +23-76,77-90 +18-18,1-19 +47-59,46-60 +78-84,77-81 +23-98,24-96 +2-61,1-60 +37-57,37-56 +58-74,58-58 +28-68,27-67 +16-84,17-84 +1-36,1-36 +62-63,14-63 +22-99,23-98 +1-86,85-86 +47-98,46-82 +4-72,5-72 +41-82,41-79 +64-95,64-93 +14-98,13-95 +38-83,35-83 +69-70,26-69 +1-99,2-72 +18-20,19-82 +12-34,11-34 +68-94,95-95 +59-89,89-90 +71-73,73-75 +58-78,18-92 +32-73,21-33 +31-91,90-91 +28-90,89-90 +54-56,77-94 +15-15,16-79 +57-88,24-57 +8-96,7-82 +5-50,5-50 +34-53,54-54 +75-75,62-76 +1-99,2-49 +4-4,3-61 +16-51,17-52 +19-99,4-44 +20-75,19-20 +36-57,21-35 +9-99,9-96 +15-61,38-61 +98-98,99-99 +2-94,13-94 +15-52,16-51 +10-98,12-98 +1-44,1-89 +4-97,3-97 +20-36,21-36 +28-29,29-79 +1-76,1-74 +69-69,69-94 +47-47,47-59 +15-22,21-91 +57-57,57-80 +11-11,11-35 +6-59,58-64 +15-70,15-71 +52-79,51-64 +60-65,55-64 +20-55,21-54 +26-75,99-99 +82-82,48-83 +4-81,82-82 +12-45,44-45 +3-80,2-81 +11-98,1-12 +21-41,35-41 +41-93,40-40 +87-99,1-87 +11-82,11-82 +5-86,4-8 +93-93,5-77 +11-94,1-10 +38-58,39-58 +63-64,35-62 +2-98,3-56 +9-75,76-77 +52-85,52-85 +32-36,32-36 +44-87,43-84 +4-85,84-85 +85-96,12-95 +2-66,26-66 +23-33,8-22 +16-92,15-80 +72-86,72-86 +8-42,7-7 +14-53,15-53 +4-78,8-78 +41-98,27-99 +33-40,4-39 +12-78,13-89 +9-93,10-93 +91-98,92-98 +30-90,29-69 +33-50,2-34 +22-89,23-89 +28-93,93-99 +5-45,4-45 +12-85,86-91 +52-99,52-99 +14-81,82-92 +3-98,4-69 +64-92,8-99 +1-90,5-90 +38-77,26-91 +49-65,35-42 +3-94,4-74 +4-58,4-4 +2-96,95-97 +2-99,3-98 +21-94,20-95 +11-76,12-75 +2-96,92-95 +44-76,41-76 +5-93,6-92 +85-90,20-89 +5-13,12-28 +97-97,96-98 +34-87,34-88 +14-27,14-35 +79-80,17-79 +6-23,22-52 +5-78,72-83 +25-80,26-46 +51-79,90-97 +28-80,77-80 +87-90,24-89 +89-90,71-90 +16-96,16-23 +32-86,31-31 +9-83,9-10 +46-53,52-53 +28-93,92-93 +41-50,40-48 +48-64,47-71 +5-23,3-6 +44-85,7-85 +30-57,29-58 +5-95,8-90 +6-95,12-95 +29-95,29-99 +15-44,14-14 +28-94,28-97 +8-8,7-8 +35-35,36-67 +35-88,71-93 +89-90,27-90 +89-91,30-90 +57-82,56-57 +24-74,19-74 +2-95,2-95 +55-91,54-91 +86-89,87-91 +30-81,30-81 +52-77,53-66 +5-91,75-90 +41-77,50-77 +52-73,34-69 +33-37,32-37 +40-71,74-85 +9-34,33-33 +95-95,25-96 +12-50,51-95 +16-65,53-60 +15-75,16-27 +6-33,6-7 +10-30,36-57 +10-60,2-60 +28-58,57-94 +16-62,15-62 +96-98,10-97 +19-28,8-47 +4-94,93-93 +2-96,95-96 +58-60,36-59 +8-62,13-98 +21-96,21-34 +11-50,11-50 +49-93,95-97 +6-76,8-99 +65-99,65-92 +13-66,3-54 +13-95,94-94 +57-96,57-96 +42-85,57-84 +26-81,25-82 +54-98,54-86 +3-84,83-92 +7-72,8-51 +67-83,67-71 +6-34,14-39 +1-47,1-47 +97-97,12-94 +2-89,2-98 +12-16,15-87 +30-59,31-59 +78-82,80-83 +14-69,9-70 +9-97,9-99 +45-68,44-69 +24-51,47-48 +48-48,48-68 +75-77,47-53 +7-73,7-73 +9-72,8-66 +39-70,38-71 +39-69,68-98 +26-94,26-93 +14-63,15-62 +19-61,61-62 +7-15,11-99 +1-73,2-51 +44-90,90-91 +54-97,96-98 +1-93,11-20 +34-70,35-69 +11-11,11-87 +8-73,8-73 +15-23,24-85 +42-57,43-99 +23-29,13-67 +99-99,1-54 +65-66,21-65 +23-38,23-75 +84-94,18-94 +10-63,11-62 +33-35,34-38 +68-70,4-69 +4-8,7-94 +20-95,20-54 +11-99,4-44 +20-97,3-97 +7-85,85-96 +44-85,45-84 +9-17,5-10 +82-97,22-81 +4-98,3-98 +17-80,17-75 +22-49,22-49 +94-99,27-91 +49-91,17-50 +20-30,36-49 +8-84,83-84 +59-91,60-73 +76-93,2-97 +5-48,5-94 +22-67,21-21 +3-4,4-5 +20-95,21-99 +21-86,85-87 +38-44,36-43 +2-90,91-99 +60-67,3-60 +3-58,4-57 +46-84,46-82 +13-13,14-95 +30-74,73-74 +24-34,24-34 +4-98,5-98 +6-7,2-6 +41-98,42-98 +16-58,57-85 +86-90,61-86 +2-85,2-84 +7-90,90-93 +25-65,26-30 +41-69,12-70 +31-88,32-87 +10-87,10-87 +4-29,4-98 +8-40,30-40 +26-82,25-82 +89-90,88-89 +4-13,9-14 +10-65,6-7 +6-13,13-99 +75-79,45-79 +6-98,9-89 +6-55,54-58 +2-78,25-78 +3-98,3-98 +95-95,6-94 +9-78,77-77 +56-57,56-58 +49-87,24-66 +47-47,47-73 +33-35,6-34 +30-80,36-80 +30-30,31-81 +99-99,68-74 +2-99,3-98 +14-92,10-15 +16-31,18-51 +95-97,2-94 +31-31,15-32 +98-99,68-93 +14-71,14-15 +5-39,14-38 +47-54,53-55 +37-64,37-37 +58-78,10-58 +40-88,41-41 +68-99,16-94 +25-25,26-58 +84-87,1-99 +72-87,72-78 +49-81,48-49 +1-99,2-99 +24-91,25-93 +12-81,11-58 +1-16,15-50 +12-26,12-26 +17-80,17-79 +94-96,38-95 +1-84,83-84 +20-82,20-20 +3-86,2-95 +19-98,60-94 +9-45,45-50 +8-57,9-12 +15-18,18-83 +1-1,1-15 +85-96,84-95 +1-40,40-78 +57-58,30-58 +48-90,57-89 +26-51,27-86 +2-86,85-86 +25-78,26-77 +82-99,81-97 +1-14,13-97 +76-96,75-97 +66-94,64-97 +34-60,38-61 +80-95,22-81 +51-80,51-80 +2-78,1-78 +43-46,45-69 +75-85,76-76 +33-65,32-32 +15-96,14-96 +68-86,67-71 +12-26,12-16 +1-51,3-43 +87-88,27-88 +17-99,16-99 +9-36,20-24 +25-32,24-32 +32-32,32-76 +77-92,52-78 +4-79,4-82 +38-61,54-59 +38-99,38-99 +94-98,54-95 +80-96,2-95 +8-97,8-97 +7-28,8-22 +66-82,83-91 +33-48,49-83 +3-3,4-83 +76-90,77-90 +34-62,34-61 +40-87,16-27 +1-98,2-98 +55-96,95-98 +5-99,5-5 +36-97,10-98 +12-94,93-94 +72-78,71-78 +13-18,14-18 +47-76,75-76 +21-96,21-95 +69-96,68-87 +27-64,28-62 +19-40,25-39 +4-59,4-98 +10-66,10-67 +16-82,17-82 +7-99,3-99 +18-30,17-92 +86-99,24-52 +19-77,20-77 +97-97,93-94 +11-33,10-11 +84-96,53-95 +3-85,4-91 +15-52,16-53 +86-90,52-56 +33-76,33-76 +3-98,17-92 +79-79,4-80 +85-85,2-84 +13-94,94-96 +60-84,90-93 +93-97,15-98 +9-54,10-53 +28-59,27-98 +12-85,11-65 +59-67,58-67 +20-50,20-65 +63-65,16-64 +76-96,75-75 +23-91,24-91 +3-99,3-97 +25-48,26-48 +48-48,49-87 +15-96,1-16 +9-79,25-78 +52-61,62-84 +6-85,7-84 +54-77,53-78 +1-99,1-99 +59-96,60-96 +12-45,12-46 +22-87,3-87 +36-98,36-74 +56-56,22-57 +94-95,99-99 +7-92,8-83 +13-94,14-93 +22-90,89-89 +46-94,83-87 +11-76,75-78 +3-94,3-95 +4-14,5-52 +90-92,66-83 +46-61,46-47 +22-23,22-90 +47-47,48-53 +89-91,16-90 +42-93,93-94 +9-61,60-94 +1-1,1-67 +3-38,2-99 +46-98,47-97 +96-97,1-95 +8-54,55-92 +52-72,53-71 diff --git a/day5/Day5Part1.hs b/day5/Day5Part1.hs new file mode 100644 index 0000000..d3cb656 --- /dev/null +++ b/day5/Day5Part1.hs @@ -0,0 +1,11 @@ +module Day5Part1 (main) where + +import Day5Lib + +convertToString :: Int -> String +convertToString = show + +main :: IO () +main = do + input <- getContents + putStrLn $ day5 input diff --git a/day5/Day5Part2.hs b/day5/Day5Part2.hs new file mode 100644 index 0000000..1f5fcd9 --- /dev/null +++ b/day5/Day5Part2.hs @@ -0,0 +1,11 @@ +module Day5Part2 (main) where + +import Day5Lib + +convertToString :: Int -> String +convertToString = show + +main :: IO () +main = do + input <- getContents + putStrLn $ "'" ++ day5Alternate input ++ "'" diff --git a/day5/input b/day5/input new file mode 100644 index 0000000..988dbdd --- /dev/null +++ b/day5/input @@ -0,0 +1,512 @@ + [V] [C] [M] +[V] [J] [N] [H] [V] +[R] [F] [N] [W] [Z] [N] +[H] [R] [D] [Q] [M] [L] [B] +[B] [C] [H] [V] [R] [C] [G] [R] +[G] [G] [F] [S] [D] [H] [B] [R] [S] +[D] [N] [S] [D] [H] [G] [J] [J] [G] +[W] [J] [L] [J] [S] [P] [F] [S] [L] + 1 2 3 4 5 6 7 8 9 + +move 2 from 2 to 7 +move 8 from 5 to 6 +move 2 from 4 to 5 +move 1 from 4 to 5 +move 1 from 5 to 8 +move 5 from 9 to 2 +move 7 from 1 to 6 +move 7 from 3 to 8 +move 1 from 4 to 6 +move 2 from 5 to 6 +move 6 from 7 to 5 +move 2 from 2 to 4 +move 4 from 5 to 2 +move 10 from 8 to 1 +move 2 from 7 to 4 +move 4 from 2 to 8 +move 2 from 9 to 8 +move 1 from 8 to 4 +move 2 from 4 to 9 +move 5 from 8 to 2 +move 1 from 4 to 6 +move 1 from 8 to 9 +move 1 from 7 to 2 +move 2 from 4 to 2 +move 1 from 7 to 3 +move 13 from 2 to 1 +move 1 from 2 to 4 +move 1 from 2 to 3 +move 2 from 5 to 4 +move 17 from 6 to 4 +move 3 from 4 to 9 +move 14 from 1 to 4 +move 4 from 6 to 8 +move 1 from 9 to 8 +move 23 from 4 to 8 +move 6 from 1 to 7 +move 3 from 1 to 5 +move 1 from 3 to 8 +move 5 from 7 to 8 +move 1 from 3 to 4 +move 1 from 5 to 3 +move 1 from 5 to 1 +move 1 from 3 to 2 +move 1 from 9 to 4 +move 9 from 4 to 9 +move 1 from 1 to 2 +move 11 from 8 to 2 +move 1 from 4 to 5 +move 13 from 2 to 3 +move 7 from 9 to 6 +move 1 from 5 to 6 +move 1 from 5 to 2 +move 1 from 9 to 4 +move 1 from 4 to 9 +move 2 from 8 to 9 +move 1 from 7 to 8 +move 8 from 9 to 1 +move 8 from 1 to 4 +move 4 from 6 to 7 +move 1 from 9 to 4 +move 2 from 3 to 9 +move 1 from 9 to 1 +move 6 from 4 to 1 +move 2 from 1 to 3 +move 22 from 8 to 6 +move 1 from 2 to 5 +move 3 from 7 to 8 +move 15 from 6 to 4 +move 7 from 3 to 7 +move 4 from 6 to 9 +move 2 from 9 to 2 +move 6 from 3 to 5 +move 3 from 9 to 5 +move 5 from 5 to 8 +move 1 from 2 to 1 +move 6 from 8 to 2 +move 1 from 1 to 2 +move 3 from 5 to 3 +move 1 from 7 to 2 +move 4 from 7 to 8 +move 4 from 6 to 1 +move 1 from 5 to 1 +move 4 from 8 to 7 +move 2 from 3 to 2 +move 1 from 1 to 3 +move 15 from 4 to 2 +move 3 from 7 to 3 +move 4 from 7 to 2 +move 1 from 4 to 9 +move 5 from 3 to 8 +move 29 from 2 to 1 +move 1 from 9 to 5 +move 1 from 2 to 1 +move 11 from 1 to 5 +move 1 from 4 to 5 +move 2 from 6 to 3 +move 1 from 3 to 4 +move 16 from 1 to 9 +move 4 from 8 to 4 +move 3 from 6 to 9 +move 1 from 3 to 7 +move 1 from 7 to 3 +move 6 from 1 to 6 +move 3 from 4 to 3 +move 3 from 8 to 5 +move 3 from 1 to 8 +move 3 from 1 to 4 +move 2 from 4 to 9 +move 3 from 6 to 3 +move 15 from 5 to 2 +move 3 from 2 to 3 +move 4 from 2 to 7 +move 2 from 5 to 9 +move 10 from 3 to 6 +move 11 from 9 to 5 +move 2 from 4 to 9 +move 8 from 9 to 4 +move 1 from 9 to 6 +move 7 from 4 to 6 +move 3 from 5 to 8 +move 22 from 6 to 9 +move 4 from 7 to 8 +move 8 from 5 to 8 +move 2 from 4 to 3 +move 1 from 8 to 1 +move 17 from 8 to 3 +move 3 from 3 to 4 +move 13 from 3 to 9 +move 20 from 9 to 7 +move 2 from 2 to 9 +move 19 from 9 to 5 +move 1 from 1 to 4 +move 3 from 2 to 7 +move 4 from 4 to 3 +move 1 from 9 to 8 +move 18 from 5 to 1 +move 1 from 9 to 4 +move 1 from 9 to 7 +move 2 from 4 to 8 +move 1 from 5 to 4 +move 3 from 2 to 7 +move 3 from 3 to 1 +move 2 from 1 to 3 +move 3 from 3 to 8 +move 1 from 4 to 8 +move 6 from 8 to 2 +move 1 from 3 to 9 +move 1 from 3 to 9 +move 10 from 1 to 9 +move 7 from 1 to 7 +move 4 from 7 to 4 +move 29 from 7 to 3 +move 6 from 2 to 9 +move 25 from 3 to 6 +move 5 from 3 to 9 +move 13 from 6 to 9 +move 12 from 6 to 2 +move 1 from 8 to 9 +move 10 from 2 to 6 +move 7 from 6 to 5 +move 20 from 9 to 3 +move 11 from 3 to 6 +move 1 from 7 to 9 +move 2 from 2 to 9 +move 19 from 9 to 2 +move 14 from 6 to 8 +move 4 from 5 to 2 +move 2 from 4 to 6 +move 3 from 5 to 1 +move 13 from 8 to 5 +move 1 from 6 to 1 +move 2 from 4 to 2 +move 8 from 2 to 4 +move 6 from 4 to 7 +move 1 from 9 to 8 +move 2 from 4 to 7 +move 5 from 2 to 4 +move 4 from 4 to 2 +move 10 from 5 to 6 +move 1 from 1 to 7 +move 1 from 5 to 4 +move 1 from 4 to 9 +move 4 from 7 to 8 +move 5 from 1 to 7 +move 1 from 9 to 7 +move 7 from 3 to 2 +move 2 from 5 to 2 +move 8 from 6 to 9 +move 1 from 4 to 6 +move 3 from 7 to 4 +move 5 from 9 to 7 +move 2 from 4 to 3 +move 20 from 2 to 4 +move 2 from 4 to 8 +move 14 from 4 to 2 +move 12 from 7 to 4 +move 8 from 2 to 1 +move 10 from 2 to 4 +move 6 from 8 to 5 +move 1 from 7 to 8 +move 4 from 4 to 3 +move 1 from 3 to 9 +move 1 from 2 to 7 +move 1 from 6 to 8 +move 5 from 3 to 5 +move 1 from 3 to 2 +move 7 from 4 to 5 +move 6 from 1 to 7 +move 5 from 7 to 6 +move 1 from 6 to 5 +move 2 from 7 to 8 +move 1 from 2 to 6 +move 2 from 8 to 2 +move 5 from 5 to 7 +move 6 from 6 to 8 +move 16 from 4 to 9 +move 16 from 9 to 4 +move 11 from 5 to 4 +move 5 from 8 to 3 +move 2 from 5 to 2 +move 14 from 4 to 2 +move 1 from 6 to 3 +move 1 from 6 to 9 +move 1 from 5 to 3 +move 3 from 8 to 2 +move 10 from 4 to 7 +move 5 from 9 to 2 +move 3 from 4 to 7 +move 1 from 1 to 4 +move 3 from 2 to 5 +move 2 from 3 to 7 +move 1 from 4 to 2 +move 18 from 2 to 8 +move 3 from 8 to 4 +move 5 from 3 to 1 +move 1 from 3 to 9 +move 1 from 9 to 3 +move 8 from 8 to 7 +move 2 from 5 to 4 +move 1 from 5 to 6 +move 1 from 2 to 5 +move 1 from 5 to 8 +move 1 from 6 to 9 +move 3 from 2 to 7 +move 27 from 7 to 4 +move 2 from 2 to 4 +move 4 from 8 to 4 +move 1 from 9 to 8 +move 3 from 1 to 6 +move 1 from 3 to 5 +move 3 from 8 to 3 +move 1 from 1 to 4 +move 1 from 8 to 1 +move 3 from 1 to 4 +move 2 from 8 to 2 +move 2 from 6 to 2 +move 8 from 4 to 9 +move 1 from 7 to 1 +move 1 from 5 to 4 +move 1 from 7 to 3 +move 4 from 2 to 7 +move 1 from 8 to 6 +move 8 from 9 to 7 +move 1 from 6 to 3 +move 3 from 3 to 4 +move 37 from 4 to 1 +move 1 from 4 to 5 +move 13 from 7 to 8 +move 6 from 8 to 4 +move 5 from 8 to 3 +move 1 from 7 to 6 +move 4 from 1 to 5 +move 1 from 6 to 5 +move 2 from 8 to 4 +move 32 from 1 to 5 +move 1 from 1 to 4 +move 5 from 3 to 5 +move 1 from 3 to 2 +move 1 from 2 to 9 +move 19 from 5 to 2 +move 1 from 9 to 1 +move 16 from 5 to 1 +move 7 from 5 to 6 +move 1 from 3 to 1 +move 11 from 1 to 2 +move 18 from 2 to 4 +move 1 from 5 to 9 +move 8 from 6 to 1 +move 10 from 2 to 6 +move 7 from 4 to 9 +move 2 from 2 to 1 +move 7 from 4 to 2 +move 5 from 4 to 5 +move 2 from 9 to 6 +move 9 from 6 to 3 +move 5 from 5 to 3 +move 8 from 4 to 9 +move 7 from 9 to 8 +move 4 from 2 to 9 +move 10 from 3 to 1 +move 6 from 8 to 1 +move 2 from 6 to 3 +move 5 from 3 to 8 +move 3 from 2 to 7 +move 1 from 9 to 5 +move 1 from 3 to 5 +move 2 from 7 to 8 +move 1 from 8 to 9 +move 1 from 6 to 1 +move 23 from 1 to 4 +move 2 from 5 to 3 +move 1 from 8 to 2 +move 2 from 8 to 5 +move 2 from 5 to 6 +move 1 from 2 to 7 +move 1 from 7 to 5 +move 4 from 9 to 7 +move 1 from 7 to 5 +move 1 from 3 to 6 +move 3 from 7 to 4 +move 1 from 3 to 8 +move 1 from 4 to 6 +move 6 from 1 to 8 +move 4 from 6 to 4 +move 2 from 9 to 1 +move 1 from 5 to 1 +move 19 from 4 to 2 +move 2 from 9 to 3 +move 1 from 9 to 3 +move 9 from 1 to 8 +move 1 from 5 to 8 +move 1 from 9 to 3 +move 2 from 3 to 9 +move 3 from 8 to 4 +move 1 from 4 to 9 +move 1 from 9 to 5 +move 2 from 3 to 4 +move 6 from 4 to 7 +move 3 from 9 to 5 +move 4 from 4 to 7 +move 1 from 5 to 6 +move 18 from 2 to 7 +move 13 from 7 to 9 +move 3 from 5 to 1 +move 1 from 2 to 1 +move 1 from 6 to 5 +move 3 from 1 to 7 +move 1 from 1 to 5 +move 7 from 9 to 6 +move 8 from 7 to 4 +move 11 from 7 to 6 +move 5 from 9 to 2 +move 17 from 6 to 1 +move 2 from 5 to 1 +move 11 from 8 to 1 +move 20 from 1 to 2 +move 3 from 8 to 1 +move 1 from 9 to 8 +move 1 from 6 to 1 +move 11 from 1 to 7 +move 18 from 2 to 3 +move 12 from 4 to 8 +move 11 from 7 to 3 +move 7 from 2 to 3 +move 2 from 1 to 5 +move 1 from 1 to 3 +move 1 from 8 to 1 +move 1 from 5 to 9 +move 1 from 9 to 6 +move 1 from 8 to 7 +move 1 from 5 to 3 +move 1 from 6 to 7 +move 2 from 8 to 1 +move 8 from 3 to 2 +move 7 from 2 to 9 +move 6 from 8 to 6 +move 1 from 9 to 3 +move 2 from 6 to 4 +move 5 from 9 to 6 +move 7 from 6 to 2 +move 8 from 2 to 9 +move 2 from 1 to 9 +move 2 from 7 to 2 +move 2 from 4 to 8 +move 1 from 2 to 7 +move 25 from 3 to 7 +move 7 from 9 to 7 +move 1 from 2 to 5 +move 1 from 1 to 4 +move 3 from 8 to 1 +move 3 from 1 to 8 +move 3 from 7 to 8 +move 15 from 7 to 3 +move 10 from 8 to 3 +move 1 from 5 to 7 +move 1 from 8 to 5 +move 3 from 9 to 2 +move 1 from 6 to 4 +move 2 from 2 to 7 +move 1 from 2 to 5 +move 14 from 7 to 9 +move 1 from 6 to 2 +move 1 from 7 to 1 +move 1 from 5 to 4 +move 3 from 4 to 3 +move 1 from 7 to 6 +move 1 from 2 to 7 +move 1 from 1 to 2 +move 3 from 9 to 1 +move 1 from 6 to 2 +move 2 from 2 to 6 +move 17 from 3 to 6 +move 1 from 8 to 3 +move 1 from 5 to 4 +move 2 from 7 to 2 +move 9 from 9 to 8 +move 1 from 9 to 3 +move 16 from 3 to 2 +move 1 from 7 to 5 +move 5 from 6 to 5 +move 1 from 1 to 6 +move 1 from 4 to 1 +move 1 from 9 to 3 +move 9 from 8 to 6 +move 3 from 1 to 5 +move 1 from 9 to 1 +move 16 from 2 to 1 +move 2 from 2 to 7 +move 2 from 3 to 9 +move 2 from 7 to 4 +move 2 from 9 to 3 +move 3 from 3 to 5 +move 1 from 4 to 5 +move 1 from 4 to 2 +move 1 from 1 to 7 +move 1 from 7 to 1 +move 1 from 3 to 6 +move 2 from 5 to 1 +move 3 from 6 to 2 +move 2 from 5 to 8 +move 8 from 5 to 4 +move 1 from 5 to 3 +move 1 from 3 to 2 +move 1 from 8 to 3 +move 1 from 3 to 8 +move 4 from 1 to 7 +move 9 from 1 to 7 +move 6 from 1 to 8 +move 3 from 7 to 4 +move 7 from 6 to 7 +move 11 from 4 to 3 +move 2 from 3 to 8 +move 8 from 3 to 8 +move 4 from 6 to 1 +move 1 from 7 to 4 +move 2 from 1 to 2 +move 8 from 7 to 2 +move 1 from 4 to 8 +move 10 from 8 to 2 +move 2 from 6 to 1 +move 1 from 1 to 4 +move 1 from 4 to 8 +move 2 from 1 to 4 +move 6 from 6 to 5 +move 1 from 1 to 9 +move 2 from 6 to 8 +move 1 from 4 to 5 +move 1 from 6 to 9 +move 4 from 8 to 9 +move 1 from 7 to 1 +move 6 from 8 to 6 +move 1 from 6 to 1 +move 1 from 4 to 9 +move 2 from 9 to 5 +move 5 from 5 to 9 +move 8 from 9 to 5 +move 2 from 8 to 5 +move 3 from 6 to 9 +move 8 from 5 to 7 +move 5 from 5 to 6 +move 1 from 9 to 2 +move 1 from 3 to 1 +move 1 from 6 to 7 +move 1 from 5 to 6 +move 24 from 2 to 4 +move 3 from 9 to 7 +move 16 from 4 to 5 +move 2 from 1 to 3 +move 12 from 5 to 6 +move 1 from 9 to 5 +move 4 from 5 to 9 +move 1 from 1 to 6 +move 1 from 5 to 2 +move 2 from 9 to 8 +move 1 from 8 to 1 +move 5 from 4 to 5 +move 2 from 3 to 5 +move 1 from 8 to 3 +move 1 from 1 to 6 +move 3 from 5 to 7 +move 1 from 9 to 1 +move 1 from 2 to 8 diff --git a/example.txt b/example.txt new file mode 100644 index 0000000..84933bb --- /dev/null +++ b/example.txt @@ -0,0 +1,9 @@ + [D] +[N] [C] +[Z] [M] [P] + 1 2 3 + +move 1 from 2 to 1 +move 3 from 1 to 3 +move 2 from 2 to 1 +move 1 from 1 to 2 diff --git a/package.yaml b/package.yaml new file mode 100644 index 0000000..393d3b5 --- /dev/null +++ b/package.yaml @@ -0,0 +1,170 @@ +name: aoc2022 +version: 0.1.0.0 +github: "githubuser/aoc2022" +license: BSD3 +author: "Author name here" +maintainer: "example@example.com" +copyright: "2022 Author name here" + +extra-source-files: +- README.md +- CHANGELOG.md + +# Metadata used when publishing your package +# synopsis: Short description of your package +# category: Web + +# To avoid duplicated efforts in documentation and dealing with the +# complications of embedding Haddock markup inside cabal files, it is +# common to point users to the README.md file. +description: Please see the README on GitHub at + +dependencies: +- base >= 4.7 && < 5 +- split + +ghc-options: +- -Wall +- -Wcompat +- -Widentities +- -Wincomplete-record-updates +- -Wincomplete-uni-patterns +- -Wmissing-export-lists +- -Wmissing-home-modules +- -Wpartial-fields +- -Wredundant-constraints + +library: + source-dirs: src + +executables: + Day1Part1: + main: Day1Part1.hs + other-modules: [] + source-dirs: day1 + ghc-options: + - -threaded + - -rtsopts + - -with-rtsopts=-N + - -main-is Day1Part1 + dependencies: + - aoc2022 + + Day1Part2: + main: Day1Part2.hs + other-modules: [] + source-dirs: day1 + ghc-options: + - -threaded + - -rtsopts + - -with-rtsopts=-N + - -main-is Day1Part2 + dependencies: + - aoc2022 + + Day2Part1: + main: Day2Part1.hs + other-modules: [] + source-dirs: day2 + ghc-options: + - -threaded + - -rtsopts + - -with-rtsopts=-N + - -main-is Day2Part1 + dependencies: + - aoc2022 + + Day2Part2: + main: Day2Part2.hs + other-modules: [] + source-dirs: day2 + ghc-options: + - -threaded + - -rtsopts + - -with-rtsopts=-N + - -main-is Day2Part2 + dependencies: + - aoc2022 + + Day3Part1: + main: Day3Part1.hs + other-modules: [] + source-dirs: day3 + ghc-options: + - -threaded + - -rtsopts + - -with-rtsopts=-N + - -main-is Day3Part1 + dependencies: + - aoc2022 + + Day3Part2: + main: Day3Part2.hs + other-modules: [] + source-dirs: day3 + ghc-options: + - -threaded + - -rtsopts + - -with-rtsopts=-N + - -main-is Day3Part2 + dependencies: + - aoc2022 + + Day4Part1: + main: Day4Part1.hs + other-modules: [] + source-dirs: day4 + ghc-options: + - -threaded + - -rtsopts + - -with-rtsopts=-N + - -main-is Day4Part1 + dependencies: + - aoc2022 + + Day4Part2: + main: Day4Part2.hs + other-modules: [] + source-dirs: day4 + ghc-options: + - -threaded + - -rtsopts + - -with-rtsopts=-N + - -main-is Day4Part2 + dependencies: + - aoc2022 + + Day5Part1: + main: Day5Part1.hs + other-modules: [] + source-dirs: day5 + ghc-options: + - -threaded + - -rtsopts + - -with-rtsopts=-N + - -main-is Day5Part1 + dependencies: + - aoc2022 + + Day5Part2: + main: Day5Part2.hs + other-modules: [] + source-dirs: day5 + ghc-options: + - -threaded + - -rtsopts + - -with-rtsopts=-N + - -main-is Day5Part2 + dependencies: + - aoc2022 + +tests: + Day1-test: + main: Day1.hs + source-dirs: test + ghc-options: + - -threaded + - -rtsopts + - -with-rtsopts=-N + dependencies: + - aoc2022 diff --git a/src/Day1Lib.hs b/src/Day1Lib.hs new file mode 100644 index 0000000..ef604f9 --- /dev/null +++ b/src/Day1Lib.hs @@ -0,0 +1,28 @@ +module Day1Lib + ( day1, + day1Two, + convertToString + ) where + +import Data.List +import Data.List.Split + +convertToInt :: [String] -> [Int] +convertToInt = map read + +convertToString :: Int -> String +convertToString = show + +day1 :: String -> Int +day1 input = foldl max 0 summedList + where + summedList = map sum splitInputAsInt + splitInputAsInt = map (map read) splitInput :: [[Int]] + splitInput = map words $ splitOn "\n\n" input + +day1Two :: String -> Int +day1Two input = sum $ take 3 $ reverse $ sort summedList + where + summedList = map sum splitInputAsInt + splitInputAsInt = map (map read) splitInput :: [[Int]] + splitInput = map words $ splitOn "\n\n" input diff --git a/src/Day2Lib.hs b/src/Day2Lib.hs new file mode 100644 index 0000000..98b0f33 --- /dev/null +++ b/src/Day2Lib.hs @@ -0,0 +1,81 @@ +module Day2Lib + ( day2, + day2Alternate + ) where + +import Data.List.Split + +data RPSMove = Rock | Paper | Scissors deriving Eq +data WinState = Lose | Draw | Win +type RoundResult = (RPSMove, WinState) + +scoreMove :: RPSMove -> Int +scoreMove Rock = 1 +scoreMove Paper = 2 +scoreMove Scissors = 3 + +scoreWinState :: WinState -> Int +scoreWinState Lose = 0 +scoreWinState Draw = 3 +scoreWinState Win = 6 + +scoreRound :: RoundResult -> Int +scoreRound (move, winstate) = scoreMove move + scoreWinState winstate + +playRound :: (RPSMove, RPSMove) -> RoundResult +playRound (theirMove, myMove) + | theirMove == myMove = (myMove, Draw) + | theirMove == Paper && myMove == Scissors = (myMove, Win) + | theirMove == Rock && myMove == Paper = (myMove, Win) + | theirMove == Scissors && myMove == Rock = (myMove, Win) + | otherwise = (myMove, Lose) + +winRound :: (RPSMove, WinState) -> RoundResult +winRound (theirMove, Win) + | theirMove == Rock = (Paper, Win) + | theirMove == Paper = (Scissors, Win) + | theirMove == Scissors = (Rock, Win) +winRound (theirMove, Lose) + | theirMove == Rock = (Scissors, Lose) + | theirMove == Paper = (Rock, Lose) + | theirMove == Scissors = (Paper, Lose) +winRound (theirMove, Draw) = (theirMove, Draw) + +parseMoves :: (String, String) -> (RPSMove, RPSMove) +parseMoves (a, x) = (parseTheirMove a, parseMyMove x) + +parseTheirMove :: String -> RPSMove +parseTheirMove a + | a == "A" = Rock + | a == "B" = Paper + | a == "C" = Scissors + +parseMyMove :: String -> RPSMove +parseMyMove x + | x == "X" = Rock + | x == "Y" = Paper + | x == "Z" = Scissors + +parseMoveAndDesiredWinState :: (String, String) -> (RPSMove, WinState) +parseMoveAndDesiredWinState (a, x) = (parseTheirMove a, parseMyDesiredWinState x) + +parseMyDesiredWinState :: String -> WinState +parseMyDesiredWinState x + | x == "X" = Lose + | x == "Y" = Draw + | x == "Z" = Win + +tuplify2 :: [a] -> (a,a) +tuplify2 [x,y] = (x,y) + +parseInput :: String -> [(RPSMove, RPSMove)] +parseInput i = map (parseMoves) $ map tuplify2 $ map (splitOn " ") $ lines i + +parseInputAlternate :: String -> [(RPSMove, WinState)] +parseInputAlternate i = map (parseMoveAndDesiredWinState) $ map tuplify2 $ map (splitOn " ") $ lines i + +day2 :: String -> Int +day2 input = sum $ map scoreRound $ map playRound $ parseInput input + +day2Alternate :: String -> Int +day2Alternate input = sum $ map scoreRound $ map winRound $ parseInputAlternate input diff --git a/src/Day3Lib.hs b/src/Day3Lib.hs new file mode 100644 index 0000000..61e0c1d --- /dev/null +++ b/src/Day3Lib.hs @@ -0,0 +1,48 @@ +module Day3Lib + ( day3, + day3Alternate + ) where + +import Data.List (elemIndex, intersect, nub) +import Data.Maybe + +type RucksackItems = [Char] +type RucksackItem = Char +type ElfGroup = (RucksackItems, RucksackItems, RucksackItems) + +priority :: RucksackItem -> Int +priority i + | i `elem` lowercases = (fromJust $ elemIndex i lowercases) + 1 + | i `elem` uppercases = (fromJust $ elemIndex i uppercases) + 27 + | otherwise = 0 + where + lowercases = "abcdefghijklmnopqrstuvwxyz" + uppercases = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + +intersectingItems :: (RucksackItems, RucksackItems) -> RucksackItems +intersectingItems (r1, r2) = r1 `intersect` r2 + +parseLine :: String -> (RucksackItems, RucksackItems) +parseLine l = (take halfLength l, drop halfLength l) + where + halfLength = length l `div` 2 + +parseInput :: String -> [(RucksackItems, RucksackItems)] +parseInput i = map parseLine $ lines i + +day3 :: String -> Int +day3 input = sum $ map priority $ concat $ map nub $ map intersectingItems $ parseInput input + + +parseInputAlternate :: String -> [ElfGroup] +parseInputAlternate i = breakIntoGroups $ lines i + +breakIntoGroups :: [String] -> [ElfGroup] +breakIntoGroups [] = [] +breakIntoGroups (a:b:c:rest) = (a, b, c) : breakIntoGroups rest + +processCommonItems :: Eq a => ([a], [a], [a]) -> [a] +processCommonItems (a,b,c) = intersect c $ intersect a b + +day3Alternate :: String -> Int +day3Alternate input = sum $ map priority $ concat $ map nub $ map processCommonItems $ parseInputAlternate input diff --git a/src/Day4Lib.hs b/src/Day4Lib.hs new file mode 100644 index 0000000..68f5821 --- /dev/null +++ b/src/Day4Lib.hs @@ -0,0 +1,45 @@ +module Day4Lib + ( day4, + day4Alternate + ) where + +import Data.List (intersect, isSubsequenceOf) +import Data.List.Split (splitOn) + +type SectionId = Int +type Range = (SectionId, SectionId) +type RangePair = (Range, Range) + +checkRangePairForPartialOverlap :: RangePair -> Bool +checkRangePairForPartialOverlap (r1, r2) = intersection + where + processedR1 = processRange r1 + processedR2 = processRange r2 + -- Get the intersection, convert it into a bool based on if it's empty, then negate the bool + intersection = not $ null $ processedR1 `intersect` processedR2 + +checkRangePairForFullOverlap :: RangePair -> Bool +checkRangePairForFullOverlap (r1, r2) = processedR1 `isSubsequenceOf` processedR2 || processedR2 `isSubsequenceOf` processedR1 + where + processedR1 = processRange r1 + processedR2 = processRange r2 + +processRange :: Range -> [SectionId] +processRange (s, e) = [s..e] + +tuplify2 :: [a] -> (a,a) +tuplify2 [x,y] = (x, y) + +parseInput :: String -> [RangePair] +parseInput i = map tuplify2 $ map (map tuplify2) $ map (map (map readAsInt)) $ map (map splitOnDash) $ map splitOnComma $ lines i + where + inputAsLines = lines i + splitOnComma = splitOn "," + splitOnDash = splitOn "-" + readAsInt r = read r :: Int + +day4 :: String -> Int +day4 input = sum $ map fromEnum $ map checkRangePairForFullOverlap $ parseInput input + +day4Alternate :: String -> Int +day4Alternate input = sum $ map fromEnum $ map checkRangePairForPartialOverlap $ parseInput input diff --git a/src/Day5Lib.hs b/src/Day5Lib.hs new file mode 100644 index 0000000..3032f49 --- /dev/null +++ b/src/Day5Lib.hs @@ -0,0 +1,102 @@ +module Day5Lib where + +import Data.List (transpose) +import Data.List.Split +import Data.Char (isAlpha, isDigit) + +type Crate = Char +type CrateStack = [Char] + +type Quantity = Int +type CrateStackId = Int +type Instruction = (Quantity, CrateStackId, CrateStackId) + +type Problem = ([CrateStack], [Instruction]) + +applyInstruction :: [CrateStack] -> Instruction -> [CrateStack] +applyInstruction cs (0, csi1, csi2) = cs +applyInstruction cs (q, csi1, csi2) = applyInstruction finalList (q - 1, csi1, csi2) + where + prior1 = fst $ splitAt (csi1 - 1) cs + post1 = snd $ splitAt (csi1) cs + -- Decrement by one to account for zero indexing + newCsi1 = tail (cs !! (csi1 - 1)) + movedCrate = head (cs !! (csi1 - 1)) + removedList = prior1 ++ (newCsi1 : post1) + + prior2 = fst $ splitAt (csi2 - 1) removedList + post2 = snd $ splitAt (csi2) removedList + newCsi2 = movedCrate : (cs !! (csi2 - 1)) + finalList = prior2 ++ (newCsi2 : post2) + +applyInstructionAlternate :: [CrateStack] -> Instruction -> [CrateStack] +applyInstructionAlternate cs (q, csi1, csi2) = finalList + where + prior1 = fst $ splitAt (csi1 - 1) cs + post1 = snd $ splitAt (csi1) cs + -- Decrement by one to account for zero indexing + newCsi1 = drop q (cs !! (csi1 - 1)) + movedCrates = take q (cs !! (csi1 - 1)) + removedList = prior1 ++ (newCsi1 : post1) + + prior2 = fst $ splitAt (csi2 - 1) removedList + post2 = snd $ splitAt (csi2) removedList + newCsi2 = movedCrates ++ (removedList !! (csi2 - 1)) + finalList = prior2 ++ (newCsi2 : post2) + + +solveProblem :: Problem -> [CrateStack] +solveProblem (cs, []) = cs +solveProblem (cs, (ins:inss)) = solveProblem ((applyInstruction cs ins), inss) + +solveProblemAlternate :: Problem -> [CrateStack] +solveProblemAlternate (cs, []) = cs +solveProblemAlternate (cs, (ins:inss)) = solveProblemAlternate ((applyInstructionAlternate cs ins), inss) + +getTopCrates :: [CrateStack] -> String +getTopCrates cs = map myBespokeHead cs + +-- better head, because I'm better lmao +myBespokeHead :: [Char] -> Char +myBespokeHead [] = ' ' +myBespokeHead (x:_) = x + +processInstruction :: String -> Instruction +processInstruction i = tuplify3 $ map convertToInt filteredString + where + -- Filter the string to only numeric characters, which compose the instruction and appear in order + filteredString = filter (all isDigit) $ words i + +stringIsNumber :: String -> Bool +stringIsNumber s = all isDigit s + +convertToInt :: String -> Int +convertToInt s = read s :: Int + +tuplify3 :: [a] -> (a,a,a) +tuplify3 [x,y,z] = (x, y, z) + +processCrates :: String -> [CrateStack] +processCrates i = map (filter isAlpha) $ filter validLine $ transpose $ lines i + where + -- After transposing this function is used to filter for valid lines + validLine x = not $ null $ filter isDigit x + +parseInput :: String -> Problem +parseInput i = (processCrates crates, map processInstruction instructions) + where + splitInput = splitOn "\n\n" i + crates = head splitInput + instructions = concat $ map lines $ tail splitInput + +day5 :: String -> String +day5 input = getTopCrates solvedState + where + parsedInput = parseInput input + solvedState = solveProblem parsedInput + +day5Alternate :: String -> String +day5Alternate input = getTopCrates solvedState + where + parsedInput = parseInput input + solvedState = solveProblemAlternate parsedInput diff --git a/stack.yaml b/stack.yaml new file mode 100644 index 0000000..f4de7fb --- /dev/null +++ b/stack.yaml @@ -0,0 +1,67 @@ +# This file was automatically generated by 'stack init' +# +# Some commonly used options have been documented as comments in this file. +# For advanced use and comprehensive documentation of the format, please see: +# https://docs.haskellstack.org/en/stable/yaml_configuration/ + +# Resolver to choose a 'specific' stackage snapshot or a compiler version. +# A snapshot resolver dictates the compiler version and the set of packages +# to be used for project dependencies. For example: +# +# resolver: lts-3.5 +# resolver: nightly-2015-09-21 +# resolver: ghc-7.10.2 +# +# The location of a snapshot can be provided as a file or url. Stack assumes +# a snapshot provided as a file might change, whereas a url resource does not. +# +# resolver: ./custom-snapshot.yaml +# resolver: https://example.com/snapshots/2018-01-01.yaml +resolver: lts-19.33 + +# User packages to be built. +# Various formats can be used as shown in the example below. +# +# packages: +# - some-directory +# - https://example.com/foo/bar/baz-0.0.2.tar.gz +# subdirs: +# - auto-update +# - wai +packages: +- . +# Dependency packages to be pulled from upstream that are not in the resolver. +# These entries can reference officially published versions as well as +# forks / in-progress versions pinned to a git hash. For example: +# +# extra-deps: +# - acme-missiles-0.3 +# - git: https://github.com/commercialhaskell/stack.git +# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a +# +extra-deps: + - split-0.2.3.5 + +# Override default flag values for local packages and extra-deps +# flags: {} + +# Extra package databases containing global packages +# extra-package-dbs: [] + +# Control whether we use the GHC we find on the path +# system-ghc: true +# +# Require a specific version of stack, using version ranges +# require-stack-version: -any # Default +# require-stack-version: ">=2.7" +# +# Override the architecture used by stack, especially useful on Windows +# arch: i386 +# arch: x86_64 +# +# Extra directories used by stack for building +# extra-include-dirs: [/path/to/dir] +# extra-lib-dirs: [/path/to/dir] +# +# Allow a newer minor version of GHC than the snapshot specifies +# compiler-check: newer-minor diff --git a/stack.yaml.lock b/stack.yaml.lock new file mode 100644 index 0000000..481127e --- /dev/null +++ b/stack.yaml.lock @@ -0,0 +1,19 @@ +# This file was autogenerated by Stack. +# You should not edit this file by hand. +# For more information, please see the documentation at: +# https://docs.haskellstack.org/en/stable/lock_files + +packages: +- completed: + hackage: split-0.2.3.5@sha256:f472fa7019647cacac3267742a6f7ac0a5c816f9890e80e4b826cd937436de87,2646 + pantry-tree: + sha256: 516449cf535bbfc78cf1a5795d28dd1e0f19b65a07c33a78b45566101fecc534 + size: 439 + original: + hackage: split-0.2.3.5 +snapshots: +- completed: + sha256: 6d1532d40621957a25bad5195bfca7938e8a06d923c91bc52aa0f3c41181f2d4 + size: 619204 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/33.yaml + original: lts-19.33 diff --git a/test/Spec.hs b/test/Spec.hs new file mode 100644 index 0000000..cd4753f --- /dev/null +++ b/test/Spec.hs @@ -0,0 +1,2 @@ +main :: IO () +main = putStrLn "Test suite not yet implemented"