diff options
author | Tom Smeding <tom.smeding@gmail.com> | 2020-12-02 09:27:30 +0100 |
---|---|---|
committer | Tom Smeding <tom.smeding@gmail.com> | 2020-12-02 09:27:30 +0100 |
commit | a9983e2f6ce4f444b5adeeb909ecc70bc568c3f4 (patch) | |
tree | 4ca52e897d6b323408c9bafaf38b7fa17dcbc235 /2020 | |
parent | ec5353f4018c7e1ad56d521e38ec06af8d938d97 (diff) |
Day 2
Diffstat (limited to '2020')
-rw-r--r-- | 2020/2.hs | 40 | ||||
-rw-r--r-- | 2020/2.in | 1000 | ||||
-rw-r--r-- | 2020/Makefile | 5 |
3 files changed, 1043 insertions, 2 deletions
diff --git a/2020/2.hs b/2020/2.hs new file mode 100644 index 0000000..7b83745 --- /dev/null +++ b/2020/2.hs @@ -0,0 +1,40 @@ +module Main where + +import Text.Parsec (parse, digit, char, string, anyChar, many, many1) + +import Input + + +data Policy = Policy Int Int Char + deriving (Show) + +parseLine :: String -> (Policy, String) +parseLine str = case parse pLine "" str of Right r -> r ; Left e -> error (show e) + where + pLine = do + n1 <- read <$> many1 digit + _ <- char '-' + n2 <- read <$> many1 digit + _ <- char ' ' + c <- anyChar + _ <- string ": " + s <- many anyChar + return (Policy n1 n2 c, s) + +valid1 :: Policy -> String -> Bool +valid1 (Policy l h c) pw = + let count = length (filter (== c) pw) + in l <= count && count <= h + +valid2 :: Policy -> String -> Bool +valid2 (Policy l h c) pw = + let c1 = pw !! (l - 1) ; c2 = pw !! (h - 1) in (c1 == c || c2 == c) && c1 /= c2 + +numValid :: (Policy -> String -> Bool) -> [(Policy, String)] -> Int +numValid f = sum . map (fromEnum . uncurry f) + +main :: IO () +main = do + input <- map parseLine <$> getInput 2 + print (numValid valid1 input) + print (numValid valid2 input) diff --git a/2020/2.in b/2020/2.in new file mode 100644 index 0000000..b553462 --- /dev/null +++ b/2020/2.in @@ -0,0 +1,1000 @@ +15-16 f: ffffffffffffffhf +6-8 b: bbbnvbbb +6-10 z: zhzzzzfzzzzzzzzzpzz +9-13 s: dmssskssqsssssf +5-6 v: hvvgvrm +1-8 s: sssssssssss +1-3 x: kxxx +2-5 c: cckgxcnswc +10-11 j: rjjpwdzkfjj +8-11 r: wkrtlrxcskjglb +3-6 l: mqrnhllxx +5-6 z: zzzzlg +12-13 x: qkrqxtrtsfxpnxg +3-7 k: tsbkkkk +4-11 j: jjjrjjjjjjjjjjj +2-4 c: ccccc +2-15 h: hhkhhhhhhhhhhhth +7-8 k: hgcjkxhkskk +3-10 s: ksxgrkcwfsxrqs +10-14 z: hblznxdzxzzzrz +5-8 z: mknrjhzzrjzl +2-4 v: vqvvjhl +3-5 q: fvzqrq +9-13 f: flfpkfvffdfcz +1-7 b: tbbbbbxbbbbbzbbb +6-8 c: ccchvccccccccvzt +4-5 w: wwwqww +1-7 f: ffffffqf +5-11 m: mmtmpmkrgrsm +8-13 j: wpggctlxlwqckcsjwsn +1-14 z: wzzzzzzzzzzzzzz +4-6 p: pqpppsfxchwk +10-11 d: ddddddddvkdddd +3-7 v: vfmhccvg +10-11 j: jjjjjcjjjfrzt +4-6 x: xkwzdxcvkr +1-3 k: kkkkkkkk +1-7 l: clllllzlllllll +4-6 n: nnnfnn +14-15 l: lfllllxllllllllllm +3-10 p: ppvppppppppppppppppp +7-8 l: blbllllf +2-6 p: pppphmpppp +7-10 j: ppmjczjvvj +1-9 t: dgtstttltttttvt +10-16 w: hkhwvvwztwwwwgdb +3-4 w: wwwn +6-7 x: xxxxxxt +9-10 q: gzqcbbjrbqdz +9-17 t: qtttttttttttttttwt +11-12 z: phtzzhqztpzz +7-18 g: sggggggggggggggggv +11-14 n: nnnnnnnnnnnnnsn +8-11 q: qbcqqqqqqqqq +1-6 t: ktwtttt +14-16 z: zzzzzzzzzzzzzmzzzz +5-6 m: mmmmhcm +8-10 z: dxcpbqzbxd +12-13 p: pppppppptpppppppppp +16-17 p: pgwplpwpbpnppwppdspp +8-11 s: xzsdbgvssdp +12-13 k: zknzkgjqhpxbk +3-5 c: ccccvc +2-3 f: vknsqwfcqgl +13-16 l: lllllnkllslwhsll +2-4 z: txcz +14-15 h: kdhhshhdhphxjshh +10-14 p: pxpvpkprpjppvpjw +5-8 s: slqssjszsssssl +11-12 w: wwwwwwwwwwdtw +2-3 r: xwrn +15-18 d: ddbdddddddddddzddxdd +15-16 t: ttttttktttttdvtvtt +3-5 l: kjwpll +13-14 w: wvwwwwwwwwwtpl +2-5 m: mmvmwbjmmmmmmmxmmmmm +3-4 x: qbcxpx +4-5 k: kkjwkkbjkkkpkffjpzk +14-16 r: drrlgrznrwmrhrnr +8-14 p: pppppppfpppppsp +15-19 h: hrplhhqkhhxjshhjcxl +11-13 z: cjjxxqzdcxwww +1-7 z: zzzzzzhxzz +9-10 m: mfnqtmjmfm +2-6 b: xbnnksjqdtdg +6-8 k: vwddsprkkptksckfzv +7-8 b: cwlmsbxs +1-3 h: hhkhh +8-12 j: jtgwjztfjmbj +6-7 v: vvvvblvhv +5-9 w: rbwkwqctpvfw +2-4 s: szss +6-8 m: rqmkrnhb +9-14 q: qqcqcnqbqkqqqfq +10-11 v: qvrbvbvvvslhvvxvp +7-8 k: kkkkkzfk +11-18 v: vvvvvvvvvvvvvvvvvvv +10-12 h: hsmzqgrzhvdhpvgnhh +3-4 t: jtdcct +3-15 k: glbccmxglvbvkzkh +4-5 m: gmmhm +1-7 s: zsssssssss +3-14 h: hhhhhhhhhhpjhhhhb +8-17 x: xxxxxxxxxxxxxmxxxxx +7-8 n: nnnpcrnzf +6-12 k: kkkktjkknqkk +5-8 r: sxrrrrrsrh +8-9 v: fcpvvvvvg +10-17 v: hvzvvmvvvvfvvvvbj +6-9 m: mbvnqwrlm +10-11 k: kkkkkkfkshk +4-6 w: nskwtwtwgw +1-4 t: twdtgbtjbv +11-13 b: bbbbbbbbbbbbtbbbb +3-6 j: jjfjjjr +9-10 w: wwnwwvwwvww +10-11 h: fflfhkdtqhh +3-6 p: jhzjdpbpjppx +16-18 x: xxxxxxxxxxxxxxxxxxx +10-15 p: ppppgpzhpppstpb +10-11 r: qrrrjrlkzrx +8-12 g: gggggggrgggjg +13-15 z: czzzzzfzzbzzqzzz +7-17 f: fffcffffffffffffjfff +4-7 j: mtjjhsq +4-14 x: mxsxmtggkwjhbc +10-11 c: cccccccccsv +9-10 h: hqkhwhhthb +7-8 j: mjvjjhhj +11-15 f: ffffffffffqffrvffff +6-11 c: ztjdccccchct +1-12 q: jqqgqqqnqqqqqqq +5-12 n: gttnvnbfnzznrmx +1-8 b: zbtxblcb +4-10 t: tttvttnttt +4-17 p: lzhpgxpfxgvsjnzxp +4-5 d: dfbdd +5-15 m: mmmmmmmmchmlpmpmmmmm +14-15 d: dcddddddddddhddldd +3-14 w: wwwsxwcwswwpgcmqnrws +2-9 n: nnnnnznnwtnsndhx +1-3 z: zzqzz +4-12 c: ccclccccccccc +2-4 r: rrpz +6-9 m: mmhgkqbcj +3-4 r: vgjqh +2-7 m: hmpfdktscc +11-16 x: xxpxxxjqxqxxxxxsx +6-8 h: hvdhjhdf +1-2 g: ngxgxhgc +1-2 b: bjmbbjnkwnt +9-10 g: qgqggggcgr +9-10 x: rhzwpwrkbxg +9-11 z: wzrmhmzzfskzqlbz +9-11 b: bbbbbbmbszbbbxbbw +4-7 g: njgcvvv +6-8 l: sxtlwntvrlllp +3-4 m: mrlvs +1-3 r: xrrr +9-10 v: vlvtxvvqvv +4-5 j: kskjvsn +3-4 s: sjjs +5-6 l: lgwlll +2-3 k: zqkhkq +5-10 x: lxxwggkzxxqxx +10-16 r: rrrrrrrrrrbrzrrr +13-14 b: bbbbbbbbbbbbcb +4-5 c: qbjbc +14-15 n: lsvqdmnhnbnkrnhm +2-4 c: lrjc +11-12 w: clwwwwwwwwwcwmw +7-8 z: vncgxkzbzgzbsxbzrz +5-7 w: gwmwfcw +5-6 c: wggkwccfwkcbn +5-6 b: gggdbpbcmhvb +3-5 t: nvtqtzttn +7-9 r: rrrrrrvrrrr +1-4 r: vnrrr +4-9 m: klmmqxmnt +3-5 n: rsnncnj +12-19 b: rqbbbbbtbbbtbbbkbbh +18-19 q: hqqzxqlkqfqqqqfbjsq +4-7 w: nvgwcjqc +4-6 r: trrpdv +10-14 g: gcggggggggggwn +2-8 g: hbgrdgglqqbj +4-5 q: qqqqmr +3-4 x: ntrxbcr +2-5 c: pjgxcfczcc +8-11 b: lgpwwptbtldb +9-12 s: sssmwlsssssrssss +5-12 z: rlwbzczmvrzzt +4-13 m: mmmkmphjgmlcqb +9-10 l: vqqglfpxll +5-8 w: wktwjvzwwmwj +4-5 l: hrfklcllpmhnpbcnl +6-10 m: svdjtmdccm +12-13 k: bbvdgcfsqtmgk +13-15 r: rrvrrrrqrrrthrr +3-14 h: grhzxvmhqhljwm +4-5 k: kgpkc +1-8 q: jqqqqqqqqqq +9-18 w: gxwxwcxswwvbtxwkfw +7-10 g: rgsnzzvcxg +4-14 l: ztgldqllvrrbrkm +3-5 n: tnrndnnn +3-9 j: jmjjhjjbmjjvjjl +9-10 s: sszbssmsssssfs +15-16 j: jmjjjkjjjjjjjjcpjjj +7-10 l: lljljlssls +2-3 n: ntnn +6-7 m: qmvmmjmrsm +13-20 b: bbbkbbbbbbdbbbbbbwbb +11-14 w: gwvzwwzwvxjzmw +13-15 k: vsckdjqnsknkkkvhk +5-9 r: drrprlfrn +10-11 x: xxxxxxxxxfxxxxx +10-11 l: lfnllfqxwzghblld +3-18 r: rrnrrrrrrrrrrrrrrpr +4-7 m: wmjtmgm +7-8 z: zzzmzzfz +1-15 j: djjjjjcjjjjqjjj +3-4 d: bvcd +8-9 r: rrrrxdrrrrrr +5-6 f: jqszdfbmpfdhdclg +4-9 l: lllmllllllll +12-16 t: ttttttttttttttttt +10-11 d: ddfddddddddfd +7-14 h: hhrnwhhhklcjhhmts +5-7 q: tqqqqqfqk +9-16 p: ppppppppbpppppppp +3-5 r: wqtgtpmmxffrqhmf +4-5 b: bbbfcbbxzd +9-11 q: bmqqcqnhqsq +1-8 j: jtkwjlzwhjjnjqjrj +3-6 x: xxkxxxjzxndxh +16-17 l: llllllllzllllnlvllll +4-5 p: bmsgphslr +4-6 b: bbbsbbbb +13-18 l: lllllllllllllllllvll +5-6 f: fbpfjb +4-5 c: cdczx +2-8 x: pxcxdvgrqgdjnrk +13-14 w: wwswwgwwwwwwwm +6-7 n: nnnbndnn +4-5 g: lsgghg +17-19 d: dzlwgqngbnktvhqzpbd +1-4 d: dtddd +6-9 d: dddddhddddd +5-6 w: wwwwwww +10-11 x: xlmxlxxmtrx +15-16 d: dgpkrcvddfbxdrvd +1-3 c: ccdcc +2-3 j: bjpjj +1-9 q: nqqqqqqqqqqqqq +10-17 d: ddddddddddddddddtd +7-11 g: mggglgsggggggsg +2-5 t: tztttdtmq +8-12 v: vvvvvvvlvvvvvvvvv +2-7 l: llqlllbll +6-7 g: ggggggm +3-9 k: kkktkknxwrkkkkmhn +8-9 b: brmbbbqbjbm +3-7 w: hwcjxlx +13-20 n: mptqtnvjfftfnvczjdvn +12-13 h: hhhhhhhhhhhhvwhthhhh +3-9 j: gjqjjjjjjj +3-5 p: wpppv +1-8 n: nnnnnnnlnnnn +6-7 h: hhwtthnth +4-7 h: vlnhkwvrtxhlbj +11-13 q: qqtpgqqqqqwqqq +6-7 g: gkhgggl +1-16 h: hghsthqhhchnjhvh +8-11 l: qllfltlzjlxllwh +5-6 b: bbbdtrb +2-7 m: mmdmfptmmmbmz +8-10 h: hhhhhxhhhshhhhhh +2-4 k: cklbktfdfpz +2-6 q: wqjlcfpdlmfjkgbjjb +1-3 g: zggggg +4-8 c: wqncxcqcwdqwcn +4-5 n: nnnnln +2-3 m: lmbdqjf +8-17 t: tttjttttttttttttkttt +7-10 l: lllwllpllllflpll +1-5 x: sxxxxx +8-9 r: dnxjktrqr +9-14 h: fdhghhhqhhhghh +5-10 x: gclxxxxfxntxjnthzrq +9-18 x: jvvlxnzmcwwcpxxtxx +15-16 l: lllllllllllllnvllll +5-11 q: fksqqwvrbfq +4-8 p: pppmbzspvwqbbppp +7-8 t: tftttttr +9-12 k: nfhkhpthkzzkljqhkznp +9-10 z: nxbnztvzrz +12-15 l: lllllllllllplllll +2-16 r: jrmlrfclhhqvfvnpb +1-3 p: zppgpppg +7-9 s: ssssssszxsl +3-4 l: wllh +12-13 r: swrsbwrwrrckr +1-4 m: mmmmmmmmm +3-12 r: rrhrlrgrrrrrrqrrrvcd +6-12 k: kcpvlkrlkkdkkk +7-19 n: nnnnnnnnnmnnnnnnnfzk +1-5 q: qqfbqkcsqqcx +2-5 s: nsxss +10-12 b: bcwbbdbbbbbjb +5-6 g: gggggtg +2-3 x: nxxrxvwkmjxnfqrztc +8-11 t: zhkjfttnxttt +3-9 n: nnnnnnnknnn +9-13 z: nzvpcztgrkzzfzs +14-16 d: jdddddmdldbddcdd +2-5 g: djwtgg +2-3 w: wgww +4-8 v: vvvxvvfvjvjv +6-7 d: hvvfdfd +1-5 j: jhknz +8-10 d: ddddddddddddd +10-11 p: ppppdpppppw +1-9 b: bbcbbwbtj +4-5 q: qqqqq +2-3 j: hhxjjj +16-18 g: gglgggggggggggghgggg +14-15 v: vvvvvvvvvvvvvvmvv +1-3 x: mxxxx +3-4 q: qsqq +4-10 m: xldvlcdmrmf +2-3 x: xxgx +3-4 t: tgvdtllftmnw +4-5 h: xrhkhphhq +7-10 j: srhslnjjjjjtn +4-5 v: vvvsv +9-14 g: wgggcgjgggvgjg +1-5 w: qwnwv +12-14 p: ppppzpsppzpjvzp +13-14 v: vxvtvvvcsrqgxp +1-6 k: kmskxk +2-4 h: hnjhpgl +3-7 t: ttttttrt +15-17 f: ffffffffffffffhfvf +5-7 n: nnnnnnnnn +10-11 w: wkgqggtxbwwkc +3-17 w: hwqvwqwwwwwzwwvww +6-8 q: qqqqqrqtq +1-3 n: nngfpgzcn +6-11 h: bmzlhhhrrhvjhklpk +6-10 b: bbbbbbbbbnb +5-10 h: hgfvlhfdnhwhq +2-4 g: ggzf +2-18 j: jjjjjjjjjjjjjjjjjrj +15-16 c: cckqchlckcnzjcct +4-8 w: wwskwhjw +9-12 n: nfnnnntnnkvnn +7-10 c: rthkcjcdcct +11-14 n: knnnnnnvnnnznrnxnnnn +3-17 x: xdxwtxlpwnmqlxvxzh +5-6 l: pwnflklxwgxlp +8-11 d: ddqvddxddqk +5-10 x: xxxxxxxxxxxxxx +3-8 r: cmtctvlr +4-7 d: ddcbdddddr +6-16 g: gggggsgggggggggggggg +1-5 l: llllzl +2-9 c: hsfgmxnbhxclv +2-9 h: hzhhhhchhhhhh +1-18 h: shhhhhhhhhhhhhhhhhh +6-8 w: fwzpwhwvqkzw +5-12 j: wljbgpjldpjjjsslks +7-8 h: hhhhfhhf +3-15 p: pppppppppppppppp +5-6 p: pzppbpvgpppppp +11-14 j: jfjjjjjjcjzjjjjjj +9-11 h: hhhhhhhhshh +1-6 v: hvvvlvvvvv +1-4 d: dddndd +5-6 r: crrrcrrr +1-6 m: tmmmmmm +13-15 n: bnnngnmnnnnnnntnbnz +2-8 x: mxxkhfwxhvtr +10-12 j: jjjmjnjjtxjd +3-11 h: hvnhhhhhhhhhwbhhqh +3-6 c: ccccscccrc +4-5 g: ggllg +2-4 v: vvvvv +6-7 n: jmpqnpn +1-2 f: fwfffnj +9-17 s: ssssssssbssssssssss +12-16 t: htxwknmtzlptqxztn +12-13 c: tlkcxmqhctnsc +4-5 f: ffffgffffwfffff +3-4 v: jlvb +5-6 h: klhdhhv +1-3 n: nnlnndlnn +8-9 h: hhhhhhhrthhhhhh +6-11 d: dddddwddddcdd +11-14 r: rbrrrrrrrrfrrnrr +3-10 k: jpkkvnbdmpf +6-10 h: zzhbhcfhhghhhz +5-6 t: ttsjtvt +14-18 d: dtddddmdldsddvghtd +7-9 q: qqqqqvfqlqqq +10-18 f: ffffffffffffffffftf +10-14 c: cckccchcrqccccjz +2-4 q: srmqqdctnhsrzqqqhscf +6-7 z: hwzbflz +11-14 d: dfdgdptdddnddd +2-3 x: xxzn +15-18 w: wvqmwhwbhwlkmwwhmqv +4-8 h: pvfhwhbhhqfqhzl +6-13 l: wlczflcmlgkjtfwqvl +11-12 k: rtdckkzzkskpx +2-4 f: fqfrjff +12-16 q: vqjjqxqqqmfqqqqx +3-4 n: mtnnnnnz +3-4 s: pmsttxst +13-15 x: xxxxxxxxxxxxxxgzx +6-12 p: tkcvpmgpzdppdsfv +3-4 j: jjjsjxj +6-9 h: hlhhhsqhnhmhhhh +3-6 m: mmmmmmwmmm +1-7 z: xkpkzzzgzwtfnzztw +2-6 g: gzggkggg +9-10 c: ccccbccccfcccccccccl +1-2 p: pppppppp +11-13 g: ggggggggggggzg +1-10 w: qwzwgwgxww +5-6 w: wwwwwg +4-7 j: bghfqzjjnj +1-4 q: qqqnq +4-13 w: hwrmnnblzwjpl +6-8 l: pllllnnll +6-8 h: nhhhhrwh +5-7 v: xrjbvkdvw +10-17 x: xgxxxxxvxxxxzxxwnxhx +1-2 b: bsbbsfkbhhbdbbcbt +1-4 n: bnnnnnnnnnnn +6-8 l: hdllxllj +7-12 t: tttktztttttgttt +3-5 m: qvmmnkjcwbjmmcmqccp +2-7 g: xggqtzqkfckcb +9-10 h: hwfzhqhhhwxctgpl +7-17 z: zzzzzzzzzzzzzzzzfz +9-12 z: zzzzzzzzzzzv +2-3 m: msmmmmmmmmmm +2-3 r: qrxkfmgncnrnpd +2-3 d: dddd +12-13 l: lllllllllllfx +5-10 b: vjtsfbkpkps +1-4 t: gtttttt +5-7 c: zcdvcjw +3-8 x: xxxxxnxxxxnx +4-12 j: jjxdzjrmkqjjzljkdrj +15-19 t: bprnhsbtpzkxrwwhrvth +2-6 w: wwwqww +5-11 k: mwkbmrcgmnkfdp +10-13 h: zhhhhhhhhhhghhhhh +1-5 b: bbbbp +9-10 t: tttvtttstkt +1-4 p: pwprpp +11-13 b: fmtddrthmvplhqjbjzjj +1-2 r: wrzrx +1-6 x: vxxqsxxrxx +7-15 h: hsscjphhrqdghhhssst +6-7 x: hxxzxxjxxxgx +2-3 v: vgbvv +5-8 b: bbtgmzcfb +4-6 l: dllqllbl +4-5 h: wdhbq +10-11 n: fnnvwnjklnb +11-13 w: wlwhdfrxjwgwnwwwtwwh +3-5 t: dtwwt +8-10 d: fddjtwqhbbddh +15-17 f: rfffmgfrtcpffrfjb +1-3 b: dtbbwbzjlqbb +6-7 f: kqpvdfr +1-3 g: kgqggggggggg +8-11 d: jwbzgqgqcdd +5-8 x: xxdfsvvxxxss +2-3 f: fpff +4-6 r: xrrvrrrrlxrpqrnffw +5-9 b: bzlrdtvbbltxkn +4-9 s: ssssssssssssgssssbs +2-5 z: zzjzdzzzzzbbz +5-14 n: fssvnkwnfccnsrmb +14-16 v: vvdkvvvvvnvvvgvvvv +15-16 l: llllzllllllwlllxll +4-7 f: ftwffffwvm +15-16 h: hhhhhhhhhhhfhhbhhh +3-5 d: ddddsr +2-4 x: lpvxhnrpxh +6-7 n: fnnndnc +4-9 f: fskvrfskf +8-11 m: mdmmmmcrmnmdlm +1-8 w: wwwqwwwl +4-12 k: drwpkvkrzglk +8-16 n: thjxnbvnsqmqhnjnp +13-17 k: kkkkkkkqvkkkkmjkkk +2-3 z: zlgzzzz +14-19 q: bqqlmqstzqqqfrqddqq +2-4 t: vttxrq +7-10 g: hrgsggggggqggg +7-8 p: pppppppbs +7-8 t: rtcmttbtttttnt +9-10 k: kkkkkkkkgkkk +13-15 z: zzzxkxqzknzqhdhzhrnc +3-5 v: vvjvvvvvv +9-12 f: fqfhvsxpfsxfjsvtkfjw +13-14 s: xswfjdstqrsdnrsn +1-7 z: zjzzzzw +4-5 q: dqqnq +2-4 n: mprnrs +16-17 s: spssssssssgssssxcsss +5-8 n: nnlntnnnnnn +11-17 g: ggggggggggqgnggggggg +8-12 s: ssssssshsssss +3-5 w: wwwrw +1-4 d: dddzdd +3-5 c: mfccd +3-4 f: sffxv +1-9 n: nnsnnnnnt +4-9 p: ppptpppwpgbppx +8-10 g: gggggjgggxg +10-11 r: xwrrrjwjxqr +2-3 d: xxbdm +4-5 g: ggggg +3-15 g: ggqggggggnggggggggc +10-13 c: scccmcccwcmcmcb +3-5 h: hhkhhh +8-18 h: gkfhhjmktrwsrthmhzh +3-8 x: hlxqbnmk +10-16 c: qjjjlwctqcbdzhmr +1-13 s: nbsfcwpxtsxpmqpv +11-15 x: xxxxxxxxxxxxxxzxx +6-7 w: wfqcwmw +3-10 f: wzfrmrfckp +3-8 x: hlxxxxmmmcvxxdxqb +7-18 d: dddddddddddddddddld +13-17 f: fkgfgnftffmfffffsqff +6-7 l: lllbqnl +8-10 w: snwpkpwwrcxw +1-3 z: mpzzkzzzrz +5-6 v: vmvtgv +4-5 n: nnngtn +6-9 f: gffffcfffffff +2-4 x: ckjxplxj +1-2 t: tntt +14-17 b: bbbbbbbzbbbmbbbtdbjb +3-6 r: rrjmtd +4-6 s: sssrsst +12-15 v: vvvvvvvvvvvtvvwv +2-3 g: wmtgzxfmhl +3-11 t: frtfxdjhdwx +9-12 w: gjkkwgcwkbmw +7-14 r: rrrrrrdsrrrrrrrrrr +3-4 c: fcck +10-11 f: lsfsfqflwhf +11-12 f: cjmfmfffpfhfjnbff +2-6 k: kskkkkkkk +2-9 s: qssmsnsshssts +1-7 z: nhzhzdn +2-4 g: gglfv +3-4 k: zkkk +10-13 v: vvvzvcvrpvvvbvvctvs +8-9 g: ggzggqggngg +2-3 w: wwrw +6-11 v: vvlvvvvvdvbpvvvxsz +6-9 n: qnnnnvcnnnnnnn +7-17 k: kkkkkklpkkkkkkkkkkkk +2-4 t: htxsw +4-6 l: vplzllvlt +1-4 x: jxxxx +2-3 l: llll +10-12 s: ssssssslstsg +8-13 m: pkcfwmnmppgwstz +1-4 l: lllh +14-15 s: ssssssssssssrcssrs +2-9 b: vbwpvzcqb +6-7 s: ssssssdss +16-17 p: wpvpbpmppvpmpmnlp +7-8 p: pppppppt +3-4 m: mmmmmmm +1-8 r: rrrrrrqbhrr +1-6 x: crrxbjgtpxxnspk +1-8 w: wjdmkrmmmhkmqwwcvw +6-13 v: vvvfvvrvjvvvhvvvvvvv +7-8 g: jqggxzcgwg +1-3 w: mwwwwww +3-4 f: bkff +8-10 f: ffffffzdff +5-7 b: vbbbpbbbb +6-9 h: hhhzhjhhzhh +17-19 r: rrprrrbrwrqrlrkrjjr +5-12 h: hbhlhrtjxrlqrhrkldm +3-4 f: fwdf +1-3 f: dfff +17-18 l: lllllllllllllllllll +2-10 w: wwwwwwwwwzww +3-8 h: hshthqbqf +4-5 j: jjxjgj +10-11 s: khjqtnsstsshhvhls +14-15 j: jjjjjjjjjjjjjgsjjjj +3-5 c: mrcjr +3-5 l: lllnnl +2-5 m: mttmmkmmm +4-20 l: mxplkdtwllxmnrzwhsxk +15-16 m: mnmmmmbmfmmmmmwmmms +19-20 w: wwwwpkdmwckqcwzhgzjw +10-17 t: jsvttntthstttztsb +7-11 w: wmvwwrwgcjh +2-3 r: lrlrmw +4-11 q: hpvqmqgdmxrv +10-11 h: hkhhghshhghhhh +3-4 b: bqhn +8-10 s: sssjssczsssss +3-7 c: pcdjjdccnshcgd +2-5 b: hbwbnxxct +7-9 n: ncnjlfntn +10-11 r: dzrprrrlxrhp +1-2 x: xlmmgxrxkb +4-9 b: bbbbbbbbbbbbb +2-5 v: qgbvvvrpjlvvvv +1-5 v: vmvvtvvvhv +4-8 w: wmwpwchvfmz +1-5 w: lwwwww +3-4 b: bcbzbt +4-5 r: frjqrxhvrrkklrx +1-4 j: hzbj +4-5 b: bxbdb +2-3 g: gsggg +4-8 k: kkmrkpbfl +3-4 r: rrdrrrr +2-4 v: zvzd +4-5 v: zqvvgvxvsvvv +17-20 g: nwvklgrmkwgjcflhgnbv +2-5 q: qqqqjqqqqqqqqqq +8-14 h: zhhldhswhhhlhhhb +2-3 c: ccbc +2-17 h: fhhghdhhhhhfgdhlvh +5-8 w: wmtwwwfwgwgw +4-5 b: gbbhk +15-17 f: mfqbdfzffffdtpffk +2-4 s: wgzg +16-19 n: nnnnnnnnnnnnnnnfnnmn +11-13 v: vccvmxmfhmvlrmw +9-13 p: pppppppplppppp +3-4 v: mvlvvv +1-9 t: tttttttcnttttxt +1-4 n: nngn +13-17 q: qqqgqqqqqqqqqqqqxq +10-16 z: zzzzzbztzvzzzzlzzzzz +5-10 r: rrrrjrrrrrr +4-10 w: mtrwzshzcz +10-14 z: zsfjzwgvbzmtzwb +1-6 b: hbbbbbbbb +11-13 h: hhhhhhhhhhhht +2-6 h: ghsfzhk +5-6 x: spncxdzsnx +5-9 j: jxwwdqxpj +1-3 n: nnndnn +1-13 p: tqppjpppppppsqppp +7-9 h: hhhhhhchqhs +3-4 f: bfftjfxfffmflmtn +11-12 m: mmmmmmmmmmhmmmmmm +1-2 r: rwvctzp +2-6 g: hvswzjtg +4-13 s: jhxsvwsrhhnmmqx +5-6 j: jfjjjjq +1-3 k: vkkk +3-7 c: ctcccckccjvcccccccc +12-14 w: wwwwwwwwwwpbwvww +14-15 b: bbbbbbbbbbbbbbpbb +5-10 g: gdfmfzfxggggkcvn +11-12 h: hhhhhshhhhdh +3-8 v: vvvvvvvzv +9-11 b: kbzbbfbbggshllgls +3-5 k: rwkkqkbkcvks +1-5 b: bbhbbbx +1-13 f: pfffffffffvflffff +2-4 q: qqqmh +6-8 b: vjfbdbblj +4-7 x: xxxxxxdxxxxxx +1-9 x: lxmvxxxxxxxxj +5-8 s: scczssdljc +3-5 v: qvvdw +5-10 m: mmmbcmzhzms +2-9 r: rbrrrrrrmrr +6-7 x: xxxxkpqqx +16-18 b: rvbbbbjcnpbbzbbbbpx +6-7 g: jpqdjjjrc +2-4 m: nzjm +2-10 v: vvvjsxvjvvvp +2-8 b: qxsbfjtbr +10-18 c: gbrdpfccpcgdktgxrtrr +1-8 m: mmmmmmmq +2-3 w: wktw +2-7 m: mmmmmmdm +1-8 g: ggggggghg +3-4 s: scpsqm +11-15 k: ppphhlmkgmkdqvfpkk +8-9 r: pcnrjwdxrcrtqh +6-8 n: lqnnnwnnbn +8-9 j: bmljwjjxz +3-7 p: wxpxpvr +5-14 n: knbnnnnhtnnzvnknn +2-7 l: lsmkfrhpsdnpf +2-3 s: ssmss +12-13 n: nnnnnmnnjnnngnn +1-5 v: vrvcvvvv +11-16 q: qqqqjjzqzqqqnqqd +8-10 v: xjjpcvfvltwllrvvbtd +1-17 q: qqqqzqqqqxqqqqqqp +6-15 k: wvrlqvvqdrkgkkk +2-4 s: sgrh +5-15 b: qxdmzmqmwhpbjjbhs +4-5 z: wzzdf +4-8 z: vzwmzwzqr +2-5 x: xsxxvx +14-18 t: tttttttttttttckttttt +9-10 r: rrrrrrrbbr +6-7 v: vtvnnhvvqx +12-13 g: swgggltgggjpggdkpc +9-16 f: xcpgjqrxfdldqzwj +2-11 d: dddddddbddddd +8-10 m: mmjmmmmmmdml +6-13 m: pqmbcnmmqsmjmm +5-6 d: wgdrsdd +10-13 r: hxrrcrbrrsqrrrrrrs +2-3 d: gddd +15-19 q: qqqqqqqqqqqqqqkqqqjq +16-17 p: pppqpppppppppppnbpp +1-6 p: rppngpnppppjpp +2-3 v: vvvvd +5-6 c: pccccxccc +3-14 d: ddfddddddddddddddddd +13-14 t: ttttjttdhwtqthq +7-8 d: sddddddvd +12-16 f: jgzfffhpzffffffr +4-6 j: jjmjjj +2-5 h: gxpvhhb +1-14 m: mmmmmzmmmmmrmpxz +5-6 g: gxctgm +4-6 b: wbbfbtgl +3-7 b: bbskxwqnkbbdbbbb +5-7 r: rrrrvmkrrrrrr +5-9 s: sssskssssss +10-15 w: pnrtwkwbwwgwkwrm +8-18 c: cjrxqxrllccfcsvccct +14-17 v: vgslbvvnvvvvspvtv +3-4 q: hkrq +11-15 r: rrrrrrrrrrrrrrl +1-17 z: czzzzzzzzzzzzzzzzz +3-4 p: pppfpp +8-11 w: hwswwwwwwwgwww +18-19 s: sssssbssfsssssstwsz +6-8 p: pfpppjppp +4-6 w: wjrkrt +3-5 t: tthtrctt +3-7 t: fxvpwwttvg +6-7 l: lllmlfl +9-10 c: hcxxccccjkccc +7-11 d: pdndddnkdqdqmzdb +7-15 w: wwwwlwcwwwwxbwww +2-3 f: ffgjfk +8-12 h: qjmwphbhbdbrz +2-3 s: ssxshs +6-7 d: dddddrjqtdd +4-9 s: sbhstssxqsscsssf +2-4 f: fgvfhnnlwlbdcbzcgrp +7-10 n: ghbnnnnbnngnsfnnbn +1-12 t: dttctttttttctqt +5-11 b: bfbbhbbbbbmtb +2-12 g: pbmtsjfftkmqqgdfr +16-17 m: mmmxmmmmhmdmhmsmd +1-15 c: ccccccccccccccccc +1-2 c: ctcc +1-15 m: lmmmmmmmmmmmmmmm +6-7 s: sdkksds +5-6 x: cnxjsx +3-5 t: tptntbnbqqc +18-19 r: fvfvrlvdlmrjfprbrxr +7-12 w: wwwwwwrwwwwwwwd +15-18 j: jjjjjjjjjjjjjjpjjjj +3-5 l: sldsllqd +13-14 c: ccccccccccxcch +6-10 m: mmmfmmcjsqmm +5-9 f: ffffffffxfff +9-13 l: llzllkgltfwlqvrllzz +7-9 h: vhzbhhhhw +8-11 b: bkbbbpqzjpbhbbbbx +13-14 r: rrrrrrrrrkrrrz +11-12 q: qdqqqqqqqqkq +1-3 t: jqhttpttlr +9-10 x: tnxtsfxwhx +3-4 k: kkkkkvhpxqbk +10-11 c: cclqkjkcchc +3-12 t: tttttttftttdtfttt +8-10 c: cfccvckxcm +2-18 t: tgtttttttttttttttttt +12-18 r: xrjjrmvgrgwwdrbjtq +11-12 m: mcmmmmmmmmmsmmmmm +3-5 j: jbwpjdwrppl +6-9 d: ddddbvqdsddd +1-2 z: pzzcz +4-6 b: xvqbtg +7-10 j: wsbngzzxrbwgj +1-5 d: pdddldvd +2-3 s: wpmqk +3-8 p: pwpppdpw +1-12 q: qrcqbjrpjtrxhdbq +5-6 b: bmptbn +16-18 m: mmmzmmmmmmlmmmmmqx +4-17 s: sssrssssssssssssss +8-13 x: xxxxxxxxxxxxqxxx +3-4 w: wsvw +4-6 x: bxtgvb +8-10 t: tttttnttth +1-4 m: xmmswnwvvsmm +2-7 m: mmmmmmmx +3-14 c: klpcktvzbvnjjcf +1-6 p: pppppk +3-4 d: ddjd +2-3 w: wwxwwdwbwwww +2-5 t: qtbht +4-6 h: ltlhhn +5-16 s: ssskmbbslssswsssx +2-8 v: lkvvvrvvvvvvvvvpvmvv +2-3 d: dzdd +7-10 g: gqgmgsggpggg +10-12 g: gjgggggggkhgggg +4-5 z: hqkvm +2-11 v: ntvvvpvvvvvvvvvvv +3-4 d: kbddd +3-4 q: qqqq +1-4 w: wwnw +4-5 p: thmmg +2-5 n: mpdstn +9-10 l: svhvlhqmls +5-6 x: qhxxxx +11-20 d: rgddnnddkjdnccrrxdsw +2-3 k: jkxk +5-7 z: lqlskzphbknwnzznwzj +13-14 p: ppcpkptppjkppdkppppp +14-17 k: kkkkkkkkkkkkkkkkw +2-3 l: lzlll +2-8 p: pppppppppppppppppppp +4-10 w: wwcwwjtwwnwbklc +10-11 r: mrrrrrrrrzrrrrr +4-11 t: gnvpjmztlftj +11-12 t: ttttttttttxt +3-6 x: ckdtgxxtz +2-3 l: lklq +1-11 c: lccgcccczcccccxbccc +7-8 n: nnnnnnmrn +3-6 w: nglpdw +7-14 l: llllllllllllllll +11-15 x: xxxxmxxbxnwrhxx +2-5 l: stwpllglbjg +4-5 c: nmhnb +4-6 l: lllglfll +6-10 b: lgjbjwqbrb +5-6 z: zzczzl +1-6 f: bfffftftfff +3-5 h: hhhhh +5-12 h: nhhshjwmhgsnw +14-15 w: wwwwwwwwwwwwwlw +2-4 j: xjwsjkgdr +16-18 j: dqjtzgdzjjvkppmjjb +5-6 q: wgkqztqw +1-5 m: fmmmmmm +10-19 d: ddvndsfgddbndlrddqd +9-14 v: jvvvvvvvwpvvvvgvvv +2-14 m: fmzmsbkfcjfqxj +3-12 j: jjjjjjjjjjjjjjjj +1-2 g: gqgg +15-19 n: pbngdnwnnnnnvnnnnjg +10-12 j: vjjjjjjjjfjjj +13-16 x: xxxxpxxxxxxxqtxxxx +3-7 k: wdsklkk +7-10 m: jmmmjmpmmmd +5-7 j: jjjskgj +10-16 c: qfccpzlccccdckdc +16-17 l: lllqlqhllcljqlwlll +9-12 j: flvjbtxnwjzj +4-18 v: vvvvvvvvvvvvvvvvvvv +5-9 x: tnnxxgxmvdqxxxzgxh +3-7 c: clmdbmc +7-14 s: ssqssssssssssnss +3-5 d: ddqddd +1-2 p: ptpp +4-10 g: gggggggggdggg +2-3 m: mqmcgmd +1-2 w: wwwwww +2-7 j: jjjjjkdmtbs +3-7 q: qxsqqfqqdnjdjq +2-11 c: cccmqccccckccccc +2-8 c: ccccccccvc +1-2 q: qqxjq +5-8 m: mtmmkmsmzjdckb +10-12 r: kthrphrfqqfr +3-8 k: gkkddfqwsffrp +9-10 p: kppppjcspkmpppppk +6-9 l: rghxzzlhx +3-4 m: wmvw +3-7 w: mmwwdrx +8-9 t: blhsztwft +4-9 n: rnnnnpnxn +8-18 v: vvvjvvvvbhvqdcfrtbxj +2-3 t: dtdfhw +6-15 m: mmmmmxmmmmmmmmmmm +11-17 c: bpchqrpzxhcbcqmvh +8-12 l: lqldlplmdjpldldfjn +5-6 v: vvvtlv +3-6 r: rnrgwqdbtrdc +3-6 t: fxqldttzq +4-5 n: nnzknnbcrbz +6-7 n: npwmnrs +4-7 r: rnrkqqbhrmrrrrtr +2-7 m: mbmmgmmmmmmmmmmm +3-8 w: wwrwwwwwwvww +1-2 t: ttqrttmptccxwkztjtsg +2-4 s: ssscs +1-5 c: bcncbccc +6-11 s: ssrvssrttsb +1-8 z: kczcvcwl +7-8 t: ttttttqt +1-4 d: wdddd +9-15 f: ffffffffffffffffff +6-7 v: vvvvvkdgvp +6-8 t: ttsttttp +1-3 s: qsjssns +3-5 r: xrrnrktrhjqlqlrhrlkr +3-8 n: nnnnnnbx +1-3 q: mqqqqqqv +4-6 t: tttldvtt +16-19 m: pmzzdmmnzrzhmfvmkms +2-4 t: sxmth +3-13 b: bbsbbbbxbbbbkbbbbb +5-7 n: kkjrnnn +1-3 b: bcbbb +6-8 w: wwwwwwwbwwkw +3-11 c: xccmsqcsvwv +7-10 n: clhtfgmnfnpvwvzv +6-7 v: vvvvvdvvzv +1-16 k: ssckbjfgcfwgppck +10-12 r: rrrrrrrrrfrrrr +17-19 r: rrrrrrrrrrrrrrrrbrlr +2-8 l: qlhgldtlbzzvt +11-12 h: mcbpvhmtfgsh +3-7 v: gvvvkkvkvvj +1-9 d: ddddddddq +4-5 v: vdlfll +8-9 z: xjzptzzzr +19-20 n: nlnnnnnznnnnnnnnsndk +7-9 r: rrrrrrrrsrrr +5-6 d: ddddwdd +18-19 j: fjjjfjljwhjjjbjjjgr +3-7 d: ddddtdddddddddd +2-4 p: pbmp +6-7 r: trrhwrb +6-12 l: zppllllmpfwkvnh +11-14 l: llcvllllllllsl +1-4 k: kkkjkk +2-6 m: mqmmmf +3-10 b: bxbbbbbbbntbdblb +12-13 h: nhplrlncpxzbh +17-19 s: ssssssssssssssssfss +3-4 x: kfxx +7-9 l: llllllrlqwl +2-4 q: zwrqqhrbx +7-11 g: qpqwgbgcgkzbgn +6-7 w: wwwwwglwwwww +5-6 b: dbbbfb +2-4 p: ckpp +2-14 x: bxtgfvzxcbrqkxjqk +2-4 x: gpfx +2-5 g: pbglg +7-11 w: wwrjjbjtpjwzhgsqj +1-3 x: xgmrxcqxbpfxxxbxxxf +7-8 r: qwrvqvqhs +4-8 t: dtjtlhgvrxjb +13-14 c: nvsmqzmclhwpdc +7-10 b: xbkspdlbbbbbnfnb +16-17 j: jjjfjjjjjjjjjjjjl +3-4 n: snnrp +11-15 r: rrrrrrrrrrrrrrrr +8-10 n: mcgnngfnrjpkxdmjnnx +9-16 x: xzxxxxxxxxxxxxxdxxxx +9-10 x: xxxxxxxdfx +1-11 x: gxxxxxxxxxmxxxx +9-11 s: ssjssssgksfs +5-6 r: pdrmrgrwrlxr +3-6 f: fwfdsfzddj +7-8 c: ccccccgc +3-8 t: wttlmpdkfkf +6-7 s: xsvmsds +6-7 n: jbncncnn diff --git a/2020/Makefile b/2020/Makefile index b48727b..b05b096 100644 --- a/2020/Makefile +++ b/2020/Makefile @@ -1,5 +1,6 @@ GHC = ghc -GHCFLAGS = -Wall -O2 -threaded +GHCBASEFLAGS = -package parsec +GHCFLAGS = $(GHCBASEFLAGS) -Wall -O2 -threaded CXX = g++ CXXFLAGS = -Wall -Wextra -std=c++17 -O2 @@ -34,7 +35,7 @@ $(OBJDIR)/%: .depend_hs: $(HASKELL_SRC) $(HASKELL_AUX) - ghc -dep-suffix '' -dep-makefile $@ -M $(HASKELL_SRC) + ghc -dep-suffix '' -dep-makefile $@ -M $(GHCBASEFLAGS) $(HASKELL_SRC) rm -f .depend_hs.bak sed 's/\.o *:/:/; s/\.hi$$/.hs/g; s/\.hi[ \t]/.hs/g' <$@ >$@.tmp mv $@.tmp $@ |