From c3f90123955539c5b1dbde1c1440d3d3fe8f62c5 Mon Sep 17 00:00:00 2001 From: Christopher Arndt Date: Sat, 2 Dec 2023 20:58:00 +0100 Subject: [PATCH] Initial commit (day 01) Signed-off-by: Christopher Arndt --- day_01/input_01.txt | 1000 +++++++++++++++++++++++++++++++++++++++ day_01/solution_01.nim | 12 + day_01/solution_01b.nim | 20 + 3 files changed, 1032 insertions(+) create mode 100644 day_01/input_01.txt create mode 100644 day_01/solution_01.nim create mode 100644 day_01/solution_01b.nim diff --git a/day_01/input_01.txt b/day_01/input_01.txt new file mode 100644 index 0000000..9569bb5 --- /dev/null +++ b/day_01/input_01.txt @@ -0,0 +1,1000 @@ +four9one +bbzhsmnmtf8kftwosevenxfkssgrcjthree +6pkkcddsixsixjgnjvdtjtwo +4four45seven7nine7two +rcssix4 +thfjtb56c +kkdhmmvvmthreezxqzqmb4khprbldcr +65bnhfgcgfxgqflblvjdhhtvzpfoureightfive +8eightvdj +h61gjgfhrgndb725 +7rzm2five +9167ddtxjpxb6 +4nine36knlfjmdgfourdmczsxv +ljnff279 +nineeightsixzsfiveseven1jqnxbhhd +jptwoeight6fourfrbpgsmkgl +znfqfjcspf8md +sixthree7qzj +39cfncbzj48two2 +52eight9fivefivesix +26nine +fsgpvxpqtk2eightlvb1ninebflbsskdbthztgvcl +twoone7ndjxttt +bpvbv5nzhsfg +onethree1kxcxzmvmkxjmtwosix +2prfceightdvcjnhzt3lmzfdnvxjgsix1 +ninefivegnsk5cz2sevenblfmtpqcfr +sixrninehnfggfbxrjm7five +qrlmkxckhfournfbfkgdzfqrztjs116 +3cf4kbkclqfourseven4 +ncqt3523two +fivevhbfndcqcbthreemg4six +7sixfb6 +sixfourmqqgmbxdgznkdbzdszc9 +3prcphmzcmt12 +fourznt9mk +twotwotdnbbbczxv8four +12fnqfsevensix +seven96 +6three6s5 +sixtqqszg6fourzbjhkvlkmnkdztq +two3bqnbxbvhspk +flcqsevenlgvtnvnctpfjvrlg65dkdbjn9 +threexnddmsxfmtwo31 +four498 +eight5one43nmkxdseight5 +1knmbd6 +8mxvjtthreelcfbhqfxjdvcpfiveonenine +641ppmssronechd +jzhhftmnnpgqcxjffourfnpssgmg6seveneightkvhnnmzv +5nddhls +fsc7kv41 +pqkmmdb96dcvrbtmtnfour4mcthkfvrf +fbnndk1twosix4 +sevennine7eightpmlxqprzvjone +lfftbhbtctplbpgn4 +31fivemlnrxfh6one3 +5fmrtkgj92pdvcgtxj +6pjfz9twofive1bfdseven +twotjrtlzflrhlgmmjssbcdtpkm3six5 +four69kdmtz3sixfive4 +twofrxqnljztltzvzzsp1575one +mhsrfclpqeightfive3grklzhlklxoneonetwo +3eightmjvfpstx64six +5fourmrmcn +ninelnqjlb1csjdnf +fmklqlxrh9vsbhpmbrd7621seven +twosevenone3six4tdltwo +9sevenfour +two6sevennine27three78 +mtjfmrjdcmsix9 +mpxksevenj4nrmjgc3 +xllmc4ld9 +jdrtnineeightthreexxklsbmseveneight9 +xmkfpfjhlpdbthreenfmcphvtjpseven28 +9fivenine +vqzlbthreezgjsp3kqlhsxjhmbztgn +pnm564v8seven +fltwone3twocdzlqmbqc7pjtxnine16 +gjcfsftcfivesix141 +cgxnbhk66eighttwofour +x1km2 +ldsxsvpnncxtwonine84sixrrrmvthree +mzrrlrjtqsixdgccvbxnpnspbccmhk6n +7t8fiverntkppnine +8dkbgh8 +73twodvndkl +8nnhbbrlh83ttxctrqd6 +5ninefive +eightnine496sdqcxrfms5pksrpq +6two6threeeightwott +2184threethree3four +3fourninefourjjtqrng +qhbjcm1seven +djpjfcjjkpcl15sixone85 +stptwoprjsix5sixseven +qpxbvxxnbeightsix9 +sevenktjmbtwo4 +vbpz46two3 +8five3foursix +47ztcbvfhrgnineseveneight67 +nineptnqrcjggnfour1 +16six38mrglvdmpnine2 +992fourtwo +zftdjcmh3fivembvs6eightthreesix6 +5gnlpfdqtlsccmtzbchjqbjjjsevensix +fiveseventhree4two +pkkrfhtwoztblseventjvqpg15 +s2 +98652cksvxdsbone5 +6dsnhqmkxmgrpp7nineeight4mnn +eightscjzjbzxrgxnldqlgqmdb7xnbxlnsevendcpvvf +threesthreefgkrtkvdl55chnmjbddlhddh +kdxgccsdrhone19947kbfvkqgccbkl +ninenlqcxpzdsf36three +422xpmfxjqrb +5796 +521seven9fourl1 +82four +ghnqeight75ninefive +twohqcrnd9two +prblcqjxmm3fouronevbrgslrxchgfvrxcd3 +8onesix9rmszglspgjthcntmmlqk +ffjqtrjtdftwosix5zc5six5 +fourthree4ks8 +6mblzskfhgcfn +fkp524 +gsix849jhtwo +fourfournnpgzleight6eightcnlgfcvvsevennine +p5 +jcmdcbqzsvzvkzgfrdnj65gpvdpxl72one +vhsnjtm9lxmdkhhkrlcssrdh63 +shoneightmnxnkgthree3 +2five8dgzqgrjzrh9eightfrqthree +jh2mmsdtzktkgoneeightonefive2nine +39eight34sgxvpgkmeight4 +sixlkr8threejfghvl2five9 +v5 +48sevenonesixglgteightsevenfive +two34 +37 +9fourtwo928jkdcsfdfivekfr +hfsfseven4 +nine3sevenqnkc6tqphlrmsnvsnt +hfpgk5bnjpnmfour6lpsmm2 +tmrx31fiveseven1bgvfnpr5 +two8sixfourfiveninetwo +fbpclsfivesixthree7 +l9seveneightgfive +jqnbtxj15 +qqdsff8467five +2fivetwooneczckldrdcmvlhxnqcxddzmthree +three39four3 +5sevensznnrkfldnppzgf +5fgrrmh1eightthreedpdfourfour +two9onengbsmhl +qeightrrj8 +fiveqvsrrxmjbxs2 +63354ninem +4pkhvqnzsix21xlxbks4fiverllxqjkcqg +ktrfour17nine92 +3sixsevensz +six5bqprcccgx68gflmfivegkkmqghp +twothreefivecnmlkzseven9xfqscvpc +five7csjkxtflf9ldbblfive5 +seven518sixnine4 +rgqbzngcvgfivesix257 +sjllqnfs5cjffivetcczglbqqxxncs +6tsghfivecjb +xgpkxl2six3fbxpzlj2sixfjqt +onexmdkzjqbthtbgtnnine6threelsixchlxmnc +ninenine2sevenkjxtrbk +nine531one4mpgznfsdl14 +9fourjlvdhvmlxtfknbpzbbcmgncqb +62mztmjgninesixeight +eight1oneqzqvsxvc3pkqr +529 +one1sixeighteight1npsevensix +twoninethree8two +lfoneight4 +one7jkqghfrssxninepfkhdzxqtsevenrbvscsffzkseven9 +lkcggvk26seveneight +1d11threeeight +3ninetwostmtwo +fourthreelhbgtvjst3lfmkrseven8three +72sixb5lvtmqrlss +threenvpxcsmxjqtqrbctvppfhrhgtvsv55 +cgsmqsixonevsvttj2rp8zfbkkfvsix +clsjmsbrvxcfkjf6threeeighttwofive +sevenxcjtsjslfrzxnkntfddninethreefour96 +3eight272ninemjssdblfour +4trbfmdbfqz +5five92437btbsqlzhjbml +9five3six +13six4mbjgchbpcchfivemgzpll +pslhgzgfzfzskdckpsxxftmljbxpxsix5fivethree1 +nzcdvfqzlbsdbkbkr2eightztgzm +three1seven41twosixpg +eightvjtvnzthreevdfourlgfq1 +dctbzcnllsdqxknvxnczpfjrx1eighteightjdksrpseven +4pgcmgd +2rqsix6 +eightonedgj9 +one6prgdcz9 +5vvlxrhtdtwoneq +vnxmtdtwo9threerhvrbfhllh +83qkvdggrltnine7gqmhlbonetf +sevenkk9two3 +seven3dvbl +6lklcq +one48dhgprcl5bsn +sixfour7gsmfive4mpslhbsg1seventwoneg +hmjkrrprr4eight2sixtwo +222 +nine1tscmztpxjbzjfm +nteightwosix5pnvnfxmn34onexhlcj +nine3rnsqrc +fivenmtbcpv3lfmddskrmh3 +qfour9ftxbsgl4zrcxjphpdtfivefive5 +drksixbkkgfjq3chnsc +5lrtmbnjone61 +xt2fiveeight63nsnpsix +63onerrpeightsevenfive87 +pccvdpml7sevensix4 +4vgsbfgsqfivebxhsscsjmseven9 +kxbdbz9gbkoneone +eightnine5616mkrfive +4two6dxbhbkfivesix +1fnlnm5 +1lvjskxjqthree +4vqchvclmxjfourseven1seven7 +nqkftljdnine6five7msjktkjpc2dqfkxffive +sixthreenineeighteight9ldbjkbtwohprspl +sevenptqrzckkc824 +8eightljnbhs +seven1plssbsfst53fnnine7two +4ninefivenrhbzr +2seven8dmblvb7 +cjhdnklghxkbln1lxpklfg +mqb9 +fourthree72zxbnvnmthreeeightsevennj +fourhqkjzbhxncj21sevenfhvj2 +6fivem1kxmlrsr25 +eight3xhcrzv2 +9tjfbrqcxlfivexljvhdclgeight +scnldbgone25 +1fiveqzgnkhbfjeight84nine2lqsfltq +gh9 +bgnqcpf7oneninezvtppnx +dzkbtnzhdf8cbkhvbmvctqmseven3 +7168d63ffgdbtq +vcpzgzgmpnone59 +threerkkljpxk2frn +6txtrc4gbsjctkvdzsixgfeighteight +five767dvjmrfgksx8threeseven +5xkqkjfjgksflfcqrgrhmfxflscsxsrdhxgpfivetxgpzzlfzj1 +pdhgxrprllptt4grbqthree +7jcfcggtqhmthfhbfflxpxvhfkzlmk9dmkkptt +onefvhpvsnvhc7eight38two3 +hhhklssktl7 +mmjtwo1qsnhklfmsj34qsix +qtnml3cvkxdzps2xlkkqr +3four84eightfr9 +fivetzr5cjphldseventhree7dlpfjgrzlxbsp +onemfbkvqjf9zjb +kdeightwonine67vpsrkskqzdrqzsnhtlg +cffrmzq4pqhmqszhrmfourthreeseven +onesixdzskhfk5fourf9vdnrthvsgj +lk297onesixrsqxfzbxkzlqzsh +7tdhclszrfiverncbkg6sixseventwoseven +fournine473 +79two +m33 +fiveseven3seven +8pjfjhczrhmjqeight1q +1eightfone73one1nine +one96nine +hxp1 +twohrxxsxn5sddmfiveeighttwo +5scfnine +lrtfjckqxbsixtcdlbpcvk9bzjpmxrtf +one24twofmtptbtkb8ninedgdkht +lkcmjplnmsgvppdj2hbld8five9eight +24twohrbmznkpjvsixeightsevenfour7 +hdmsddfzcpk2cxvssqszgnlnnzhnxfourrjmmsvvfhnbh +gbnvjxhnseven7mtxspmbzxfivefour +fivexgfk7gvtdhbxmlrmmlcfhkt +59one62ktbvcvh +tdsplthreeninelqgblffvvxxqbzt7z +kxsncninefive7vhjgzms +47sixztddvhdg9ndsix +59foursevenlhstfour6nfcmmtmnhf +7rxv1gbfmlkjgqqgnsixfournine +9threeqtthlzktpsp +stqsixthreejhhtgrthdxxvd5zmhxtczn +xjeightsixfxkqtmbkmg1trgbxkcfour +hcgzkblceighttwozmcpbmfpnck9bnineeightwoml +rksvnrz926 +qtvqdjfpllfourfiveoneeight6 +nineeight6six +sevenfournine4 +seven78569tbqsixtwonegs +mnphqplqcone9fivefour +4sevenzlonekfqjlznshbnone1 +cxncdtsbeightfour1tkfrqpffour +qbjdcg5fivefive5cljnlm +rqcvltskbd5tsftldxvsdtconekhpkkxmzt9 +bggdtwokdjnbvzlltpdsix94fb +1twocgqfzqxz +vn3 +scsprhdlngkldcvpndnxfour1sevenqpsvtpf +7tjngkcsgkdeightzld3 +szgtdtdntonefournine4 +5twovxmrnh615eight1six +4fourxmdcrxlzvfive +zsljdjhqhffour1tpzronefive9nvvpnvtd +sevenone2threethreekpkcmcx12 +qfgkxthreeccgbmkmhkrvqcfnine792 +l8 +nxxjzxtlqpvgvbrpdlgdx2cvm8twofiveeight +93jhshjrkqg4gxldkfour1nine +6three9four +2sevengqrndvxn79six +5pglrsbjeight3threeeight +fourhjrxhpt17threetwo +one8sevendbtgjj +8two23xmhjbmvqj +ftwonine32dlntmfive +fcmqrpxjjgpcr79vnj +tmckzseventdtgmtnnvztpvrone91five +sixone3 +6onegjmgqmhrszhplpvrv +eightcqkr869fivesix +seveneightnine7threethreeljmgsfl2tpqxgsx +63threeseven +onetmgjzjzb1rmnmssix +gcbhhttn8seven5pstttjhdbxnmjr5 +85mpmvntfk1sqzgxrjpfd7 +onethree3fourtfonefive7six +1two2ltnfive94one +fourfivefiveninenfzrrgh94 +two54mkstwo1ninezhrvsix +jdpnptxghs8 +xdbsdttwo4cjlkrzfkqsmmbpdfh +one1p1 +8jvxplsts2zmlmfczplv2 +pbgccdhchr6xdqljs +tqxnrsvthreenfsrgkqhpq995kdgjtxcdvf +q9xbzbjvtmkq1 +ttnpknthree9 +six18qhjd3sixhs12 +1lntlcrf68sfhzsix9onermrsvbmzpz +hhzjdhnsdb2 +nlgdm34five4fgqlpsfourqmdjqrklrrk +seven4splbgjscvrnsrslsixseven2pc +1dlx3eightsixeightseventhree +three2nine2chsvtghjfgjfn6 +8mpvxxkqlvsixqeightsddh +four26kjt +2fivejrnpfbfivefourgrhdcngfvkxqrl5 +3hp1 +mblqhptdfdfngmmdlfjhp3kdpsb1 +nine19seven95q +97one +lnbvtnvtnsevenfivefivethree2xjlsl +ctglrzjrcvkdjjcmxxkv5sevensixsnl +nineonetrpxnljthreefourninemrnzbbqjvbseven1 +fourseven49khbvhbxqvzhthree +961lsvnhdgb +seven284mpdlsnshvgbvxp36 +36ghthreefourc +four67six5bbdlzcg19 +1oneone +6sv94fourlrztncb8eight8 +twoggfmfjfbx54eight8five +fivejltzvxjgp1three1nzrgkrplssix8 +cdrbdxxdcfivekpnxplf5 +3fourlxnp +4hrkjqvfsch9szkfknmkkksevenrbsjcpph +fivetwo6xjtnvns3threejsx +9bdljbzvgbbhtnnqnzthree81 +9rdvjnqqkr44 +3twoonetwo +987bbxtq2seven +spvxkjpfive5gvqjfcsvd +7jvmqd +dvhtwone7csrxb +mqfrq3xsixhpsz36hxns +5glvgrrt +fivegtbfqqtsgmv2twoxpdvrph2 +8nine76xrvnnjzzlmqq53seven +dvv43eightsixsix +pshbmh8dpgdqnnb3jvc8dhstvf +sixsevenlscj84cnmk52 +five158hczhzrnfour +1fiverbh49ninenine +kfkrltljjthree9 +ts3seven +hbr2lqqkbdlsr +fourninehcvlfqqlmkfive876six +onechvhkvdtjsjd3threeqhgvgh1lpqrpzv +mlbvvlkhnl1twofvtlvccbf +fivexhnpqsixsix2onenine +sixhndnxt7fgjpljslsixthreehlxtqsgkrkthree +6vjp2one +glhmqdplqqmdgtnssevenseven77onesrpjqppkqfnine +qqmvfmpsv7two1nine +5lj +gndgkkcp5dzmczqmhsevensix3 +eightsix82sztzxlnfvnnkhpj +hppn8seven61 +five1oneightg +foureight7sixxrlscm +6threeszvsnprccb +8sevenlfttwo5two5 +jxmzrgjcqq8bl +one67mpktrzzvnhnine66 +cvgdvstltgpqg3tk6czjklgdfvsbxnthree +four4bphpmnineninervrpcsrbthree +rcsxjh93seventwosix9pnt4 +onekcfmt1lqkrsvzjtwogdrkrnpchg99 +phmhsxjvthree5four +39eightfiveonefive +ninehsvgkvtcgj1 +4eight18three +5tzgdpvkgq891knffnfourfour +3sevenqlrzktpzm8hcseven9 +onethree7eightszmllvone5xjxh +loneightnftmqbghjx397eightpmgndpgdldfoureight6 +jeighthpfrlthree3mvjqvnkmctwo +jqtwone1onefiveninezdzfq8nine +2mpbz +onesevenmftvrxrnrk779 +gjqqnggshhnjsgttgtpbt93zsixpnl3 +5584gqninegxseven +5qpqzztgrv9seven +three43vkfgqhn4 +56fivegkcnhtn11 +3eightghrgdqspgjtl1fzbmsneightzmzvbsl +sixnjrl2bshpmg +54fivedpxfmreight +3four5pnlnstthzfjtfv +onenine7 +fivethree5eight +2six4xmgxtml +one25eightfourthreefglftkh8 +rz6ninethree +qbrthree46eight +vldeight6nine +cshoneightthree9rdlh +fivehbplzxnhnineeightseven32 +l2lsmkone +bqlt6eight +xv3two88tspdtsh +fourxlcttfqhtp8 +eight8eightnlfbtmh +8sevenrmvdninefdeight6onedfmkhvklgg +six1ninebvgfbsjkstksbqlxsqxdqtsbmtseven5 +7fourgbpqm477threeonetwo +five18 +twotqkjneight516five +xbsixzvkjlzfx2 +qeightwolrqnbgqlbgseven3two6 +6mjsmmbdsninegkcd3jzpcrjlnm +7kzcnrfonetwoeightxc46mrtmb +55eightsevenfivejmjfour +l6two5 +mgbcclxkpdjdfivemsgkqpfpcbjjpxrs1sevenjzctftj +9tmvngsthreenrzplhrbdknine3seven6 +one2dhkmpctvhf +xfhqlkn6qdntslzkmgqhgststmzp +brbjvmjsix3ltktnldrjv +eight31cmmrrpvtr4n +3twofb +63g +cdgxslxkhxeight5one +7zxvlcsdpvsk6seven54nine +five95nbpthreemtqhgdbtdqhbkhpsdndjgvmcseven +fgh75 +five78sevenmvr1kgnzpfr +hkszszgkr414vknlf +nrxcmxjvftwoqrfvbtgktfclc69ninefx +sixseven6onethreefourzksnp7six +eightsevenjdpxmg4tvtonem17 +9twothreefour +kxmrfjpdhqxzqsf84 +46nbsxgphvptlsixcsixfkrlnh4 +4pn27gtt4eight1 +three26fqnine +2sixpnineshmsbxj6 +fr9gmmqhzdpcdjqklcjsqg1 +hheightwo6threesdnqvl87 +34fivedkjxqcqtvhfour2 +pgdzz39qmsvmfvhsevenlfgeightwop +7sevendjmzkksfourfive +nine7fourtwozlpvr1xgxddbfcqgcdh9 +2nzts1cgb5ninevnlj +four8twozvjnbmnbpssixsevenvbeightwovbj +four3one8rhbvtnbleightwokd +eightthreesix5 +7dggrvmlfourfive +gskldhhphjvgqnfgxdlthreemp27bjhgshzdb +ghxvcdveight1 +fourtpxlc6zcrgbhpdrzfrsmsqpkjmfgjd4two +fb79c19 +fivezskzmvbdfour4sixbnkbntrkjvnineeightfive +qbfxdktjq2rddsmgnz8pnpgmph7eight9 +664two +seven6bkdhbfmvsx1 +6szgdfhchfivefive +8thkcseven8threeeightbqtwo +3n97jvtxqbsks2bcrbkhzgh1 +fqxktzrczzlh8five +2mhrfx +pmtwonenine573fivetwo1sixfive +hzhzmrp69six +2bxxmszhfknonexgmfmsx24three +1four6zsbpgblxbh5six2 +7seven6six3 +sixhlqckdhkgkxmd9twoone4six +onecrgdchztlzqdljd28five +xrsp8sixpvrprcnzchnxthree9xjqsltz4 +gqtc91 +5twoone14eight6fsnshplkrh +jbhlnvgtqgjhzzh6kxjnn297qqqhxtgl +3fivellgjzxvg7bcsmvkdqtwosevenrkjbjxk +jcxjvsbpl863xvjszreightzjqtjlshg +twogdvrqfxplfour7 +lgzmnhtxdrc6fivefive6eightsix +seven6ntjgjjkcsninebkxgqmrpcs5 +fchnl7fournine9 +snzheight8fourfourfiveonefour +xpkoneight6qbh1sllfvsnkfzffhdfourfznkt +2tctninesevenfour4xt +two18bjtqjkjcjrcmlpjdlbdkfm +5ninesix484tbjzds9 +vmtffvjjhone5six983three4 +18nineonetvmkbgqgblhn18 +6five92eight6 +bvhgclm4mq1163one1 +hztxmgqt9three7hvmj +8jcsbhxlxfhld2jbrrqlsix +9nsgz +88three1xoneighth +htrnrgxvl84chsvpdf1eight +grxncx4 +fourrqp49fiveseven +65five +two3prvpvkz4xndcppzfournine +5srrpfjgztwo3lnvsgkm +five5bbcntvhmxmh +vfctcfrhvmdpldlklpcjkthree9threefour +9seven3 +fivedkqqqzl3rjtdsdkjpxm7three1 +twotwo59fivesix +sixthree9two36threehfrshhtnine +eight1bzthreethreefourgcvvjr +pqfzd5gqpvqtkrhzcsphnmtztwojmfpjsix +1qstrvgtqb393four +2eightoneightt +six4five9hzc +hvbjkkhnqg1sm5131eight +9sixtwo +2fivektvkhpfourtwoonedfrjqcpbx8psp +nineonetjfzrvx5xrhscvlzzonesixhdktzvjsr +2eight3rcjheight67bmktvnqltv +jkzpv4442ninelgxnrfxhfive +rnsblh8125 +zpmprktv3 +9four4vqzceight5eighttwo +rgknqkfsj6dh1m +7kdkxzqbltvhthree +lsdeightwod14three67 +5psxnsnr9nine +sixf2 +9six1fourxrnpqtbsix7seven +eightninespmlponejflmrndkm7fourbvhfour +spfkmffoureightzjvxnfjffthree7threem +twotwo4twoffqszvhkqlsxzllrghdhfgbdtxphs +314one4seven +fourninetgbjnphflcnpkdkxnine4fiveglkdq +four2lkd52 +456 +lfoneeightrkgq99kjhrclcgdnc +8qsqsl32 +qpnpmh1four21sixqqsix5 +jbrxttmncbtbkjpm7fbkkxc3gkjplp +5two62ppczhpjct +leightqmcmxzd45vztlfcvvv +vnntzgvjfl1ksixthreevxchkmckceightone7 +3two7sixeight +6hxgjm +4five8 +mbcbgvrgzxclvkkv1 +four3plnl +39ndbkdkddh5seven7kqtsg1 +threebmqbd87 +1fivenineninect9 +one4seven45 +gdh5stxjfzlgcbfivevgn5 +3qonexxzv275three +dphbjmbbeight6 +m13vffxq9 +four9threefoureight +qjkcczzgrnone9threetwodhhfzpssgone4 +htrsqgmmnk4 +jdrkr23 +vxeight6k1 +5rdhjgpkxsevenfour583 +8ninepfddonesixthreepcgdgkrk +bxtddhs31fivefourbpqfournrnqb +rmdpmsbtsdsrdxseven93foursix9 +8cn +bg4nh +foursevengkmvgqlncllqbklrntwo7 +4twotwo62 +bdsmrsone2sixonefsbsrkprbfthreethree8oneightpsv +4sevenfnbldqcp99 +9twoxvbqpktrqglhrfnine +sxztjcg3 +bgzslddbll5kzbkxgrld +7fivefxhggjvgcmqbppgffmfive +8three6nmsbsbzz +sixcrznp2threevqrszfivefxnfrcq +5mggpqlmlxmljvmktv1qpbllrfccgrzlone +fjktnlxgxjztzxc37 +8chhbninekmrbs +eightgdtsgqzqdthreeeight2xvdrckvnr7xdgjtdzsix +mq1lxdb2bsztdlfh814three +761eightkxrnjzhzfive +groneight3 +99cbcbgkjtgjsevenbzp4ninexbxgpb +1one23one2 +425five59jqxbmjjtwoneqp +eight44eightrggmgxgmr +g1 +9tbvsdgcz +jhfmgxmsix626oneeight +gzf9hjz7lfour2 +three8seventhree7threekgrpkrcxk +m2xpkpfour +2sbqj +177plqzcbj +qlsvnrqqbpcshmkj55 +fsszprone5 +9twokpxrxrjnbqhxbs +jc26 +eightczbvzdkb29dslztrgdm9eightbv +vtlgfh2kxtchmonebr986 +6two4eight +52seven +fourtvfqghltnrngbzbrkpshjhseven8foursixnkpbtf +zndgjjnctljjvfkz6 +7six3 +tqhgddbrrgjzh8ct231four7 +6pdjtvjqfzmrdqninefourdrtndvxtfour +twoflzcgtwojvnhkqpvd4374 +47sixthree +9threenine8 +sevenmmndnbnvstwo96sixlbddllbq5 +seventhreeone2fourrbzsixthree +gstzhlnvxrfour6seven4ncktrk8 +43jzhf3 +twosixfccseven63 +tlkksdsbgbqbzmjtx7fivetcvzbpggmtwotwonpknb +ninezq7xvsmlqvfourclznkcqnbmjone +kbns2kjpfdrp +7pntsfdpjq7rzlqvnine638 +seven7fourfour2xzxnfzhlmb +23sixsixbqzh +one4twofivehmonensf +fourfivefivejkdmbgfmdrnkqk6two7bnjv +784v1eightwog +3five859five729 +gshxpzrnr1gqrpcfourfive +29sixthreesmnd3sixpdsjfour +v4 +47xkjdlcnvxpfddz +nznnmq7jbfngrjzp +twofive1ldjf +nshmztnmgeightthree2two +95gffourthree +lcqfncp29hnx +4fourzpzcbtqkkr2jd9seventwo1 +ldqv2vpzjbsrqfdlngcgone5 +jhhkdvpzstx6 +fivegnbqtrxknine2gfcfnine5nine +hcdcffvmgkdgfxbvkfkjjzh3 +eight69eight +gmsqzqbrnvpsix5xjfchmsgsqmxm +one75six +4zt78gldjsmllkkdrpjbxllhm5 +onetwo8six +three3oneonenlvrxtwo +ninecldbktzkrkhxfknclmtvfhq8twofive8mrf +88kzkdjfjqpbgdthree4 +onefc4jljhhprfv8819 +two9ninefzxgj2three13 +xztwone33 +1fivevmppvshnsixmzxronesix +vd32 +323 +six8zhtrllzqbgjsixtxmxdpbfd6 +mone5mvzvxftqsbnktbdprllkjz7oneone +nine4one +threesixfjttrzrhr5five +eightnkzzmj4rzpzqseightsix1 +zf2 +geightldvlrdftnbtdrsv1qmcrrxtfp +zonetwol21j2 +8qmdfivejlrxmlvthree +seven395rtqnnbhd8chxjhp6 +21fourtprlhb5 +fourcmztvmjdf1threexsthreehrfkzk +jrndnvpxdrvcqdjdhhnlnr594rblf4three +5llzdsknms8518 +4feight4 +six5hdhtwo42351 +fvfxhkbthree16three3qh3n +46zsjfjjfd55 +sixoneonenrg5nine2 +3kxmmrzmsvtzqhpptwobzpqfbnjm +three4c9sevensevensix +bqfgzvpd198nmmkzttrpqjhzkd961 +two699txkcpfcnsm5 +2fivez6 +ldttwosrlhrczggq5 +ttjhfmxmseven1bgsevencqstcnjppknine +kphtgssvmxvf4 +4nine1bpdhrp86sfppzgbmtwonepbz +eight7957seven +fourhjlrlptlz1one9oneeight4 +2onefivefourcqvhgbrbbfvssjlv4 +thrjsvmgvlqfxjgfbfxxthree78xd +vrzfs9eightzsm6six +vjmdxth3 +4three1jmpnonesix3six6 +vmkfmshtr7lmcqpdtpxfnineeighteightpqnxntkzhrffhq9 +rzlpzxzlbshztwo3lrqkstvl +d8txxlfntwokdhhqfqj14 +1xttonexsqldqjrz +nrcsix698dgqhnnmvvxckg +59fzdrczj +52eightsix399 +htsxqlninesix498 +1fivedsxccqxpc6zkcnhxknhbtljthree +3fivetkff1 +3onegkl +one2sbtxp +53gxcnvtkc4m8 +2sevenonetwopmhvjhhbtfivejtdbthmtmlzv +jrpnktwo6pvcckm +fiveeight9 +9217fivefoursixdvctqz +1seven6five +5trztdklnh5pbxhjkrbsrbkblrjfive +v9gsnbfive5438 +619ltnxszkfcgztmfrxgrgcbjfthreevcrxxthree +2fourpcjshrql +hbmtblllp5fourfourjzkrvx +vngbbb79seven7 +92sixlzd4sevenfour +foursqmninenine2smplone +six4five +vjmztjchkc6four16two +2lvhfkgxfivefive9 +45two8dhkpk +84qfivexlclqpvtt9eight9eightoneightbk +6hl5fgcmlpphmzsvbk +4mtczfqfmk +threebkjb9 +sxthree1foursix7four +9one3lmthreetwo +7six83lzqz9skgcnbzzg4two +jj94sevenvxrxdfourqtmpmtlnninedkvc +prmlkbzrkvzg52 +lnxxmbsdgqgpjdzzsgxpjninengbgccmblv3 +nine6lkrsdfdbnsixfive9 +smphdfsixnceightktq36zs +zhmpseven9sixghjfpv +eightrmqmb5two +5four4five38twoxbmthcbnine +4vxvskjc83nsevenskgktml +three9three64five9 +four4four +sixthreesix8nx8bpkkjntxpsixrhbbc +6fiveeight28fourfour +2s52foureightfour7 +sevensix5vxfqr8pxncbhgd34 +2dssctwonec +rzcmjflfn8 +ninempft7sdlcjzmgtjqpxgv +eightfoursix3lbmg1twoneqh +xxnvsnmslcrql1lxvqfourqtfjcstgnineqcnkmthl +qnx3lsmlpone +49tvjptmdgvbftm +49psqsbvph1cxvzzeightxgfnjqqg +three2three21 +qhnfzrb4 +6gmxzdzfngpmxtnine +vnvqqbkmp5eightsixbreight +2j78znzkdrjpdnkctwoseven +three3nine +gpqbqjqhscmzhcsix4xvdqn8threenhvr +fivesix12tkljpqdhf3mcsix +1qvlrfcrmjvbr5threells +9skprmslsfourkfxbjjtflfour3 +jmvns4onek7gvmbs +nineone1qmdgdpfrqmvfrfj6three +ninexlmtdjmszjjjqdmpmn1two7 +9533nineone2hpnfdss +six3rgrmtgsninetwof +fivelvlnzlqj4zrljkprhsbt3zzzkzvfg5 +9nvmkt9six2sbzdkhqbg5 +four716grlbd4sqx2 +73fpdz5 +65five897b +threeone9rltsqbjl58zxxtktwoneh +bxfxd5five8 +4fzlpr4nzmfive37fivefive +vjptnknvlxhzvfpqxfive5four8 +9five1dr6eight5hpkx8 +eight7fourfourxlrztj64sixone +twofourqqprdrkmrbgtqj5oneightb +83three +threethreefourtnvddnmsixnjhrfmhmxz62one +8fivesevennine2skseven2nr +fourseveneight74hmslvqssdfdsltvcsd +38cxc +1njgbbprzf5fivethreeninezgllfmsxfq8pgntvq +mshrhzmgbfourthree8 +3oneqgqfgreightfourhsxlcb +7sixfivekronefbtrjszbfr +hgsqk4xfjzkkxdz +twoeightfq5rhdjcbg9 +drkclzltwovtblgppbtpzrcnlhhtwofivevcnlvxhbn8 +pksrcnqps5hzdvnbgkmgfoureight9fx +87ppqndvcmtzrttwothree5nine +fourfour1fivetwofive2v +fivermshbd75 +47mljfm9qjnbzjmq +1cqnrmpmknpzgxp8four8 +eightzgtjn1 +three2nfdnfivefourseven +zjbbj5mxqnnsxml5 +8847rtqjrctqczeight5hqmrbzkd3 +onev5seventkpvrtq +sevensevencfjbscdbvqlc12eightwok +2dpnxxlqthree3fourseven +3xfrnxtds9seven +eight7four +sixzkjrjf1s49xhk +foureight1bsxmfdgpgthree +crzjxgfldz9nine7 +dlrzoneeight3blfxhd6hxklgmzcb +six1cdlfcsshkh4eightgndfivefour4 +threethree2xcsixqfsgxjhgf7 +cnjkkfcnninezbvrthjrhg2two2qzbrchvxqsfqhk5 +ninefiveqmgnhrdndclldxtjmqmkseven1lcjlqddmbnn +zjqlxpn437fivemftgzsz8tsnnbgmm +xllzq6l6nineone1 +vqkjtjdnine4onefive97h +two1ltbdnine +ninefive62 +eight8ninetbmtxtmmnfllnj5 +four9three3ninefxttjkhtkgvpvcbd5 +43six3twoeight +fourfnctllc1twosixsix67hlgt +fourfive8gkblmrninesixgfkpqkleight +5ninermhkttx18three6five +51one2jvbxs6 +6pshzkvn87jz12three +62nineseven +bchls4fivelpdldjzmbtwofour28seven +274four +cjnjksf4cdpvbjfnine2rone +krxeight7mzdbbknqdxpzg4eight +1one3gx3eight2 +5nine19eighthvcmzbltkfive88 +11one2sixxgvmg +p51rzprxgldxcznjjonefdjgfqbndnjn +9jfpvqhpht6 +9threeseven5 +seven62 +threeonefivetwo91three6 +three3ksl +xhltjp6qt +9qtxtnlhgg8four5nine3cvptllv +267jlqgljqfltwo884oneightrb +141eightnlp +rxpxrbvgrcmhzone3one6ppnzmg2 +five5sixrpzjqgbtgdjlmmprh1 +onefivefivekglldg5six +threeseventhree2 +one1fgcxgjxrm4seven +mstfpfhf7seven3ninezvrxeighttwo +oneoneqpgdghxl7three3 +twodlbrctkhjtwothreefivetwo9 +fivenine19seven8two4 +vpjkmfsfrjhhbksevenfivervdm514 +fourjqtggglnfive32kzcx +lcrtvrfkzthree4eighttwo9 +eightnrvtxpqxjztttqvgmlqhxqj1 +2ninepqntclhbk5three +thfdxrnbbqc6 +seven8mjpmvbqxhfhxgjdlltnine2 +hqbthreezqbhlnthreenlfour8kgzzxjcsgz +6jksppsskp63threenshc +two8nine +bsixmstxhhfnm3bcckpjp +4fourtwo86tkdkxtwo +xc4eightsevenbdseight56 +fourrnntnp9ck +onesixflbfss8two2lxhhjdhxntpjpkds +threeone71fourcpcsxld +bczssjbdzbonemtbrz7five8ccnnj +42onedkxtrhhm1nkn +nf6ssm3 +eighthltsggc2six383 +srkppleightmxzmlk38 +336tdfthnj2fghhklkg +zhpsbbjzzk3mxzzsnvdbs +1nine6fiveninerdng37mfks +4ninefour2kznine3 +fhsjfivehs1 +one4qzbgrzlcfjbstfc +twohkrbh8zlhkgvfivetwormjq +ldfzzjzkxx9 +7f95stwo3 +xcppkmb5ntnrzrqndh1oneightxm +threebhvkdbbt26qdbcpgm3four +mvxd86sevenfjndplrd +585 +eightseven51xpxxzqnstzlp1 +one8eight57lvlbzgclktsix1four +255fourone72 +onexqrbpcmc1two7done6 +fournineqbxgklbpqqhs2six +dnptsevendbphglkqtwoxgsjckf4 +25pskrxeightfourjrtgxonetwofnkj +sevenfivesevenqtgqlpjkntdnkxqvf4 +1xklsljm8knrm3five5eight +sevenfiveseven9bnprxvjl +threevzmqxdmgc3 +fkzvone237lgqtxfcnvddqrdmj +5sixnsix6lqmsqdvvdj +287fdvgbtcq +sixsevenninelpzlclr4 +fivesix7 +73drvqt7nsixbzt8one +xksbgk6knc58oneninetwo +lknvtktz62pccjdnc6 +7zxskgs +nzdtwoneoneqvmt9pmvnthree8lksxhxv +3hzdrjckdsixthree2 +hbmbcrgmpkxzjthree8sixz +94979ntmkxbzlcone +bsb3threesix +jpmtgfcgjpkbx8 +3tqnctzbmfivebninetwo +9vrpgcbmdktdprzs +fourfivefourone9fourqnsjlbgkv9nine +5vlsbplrtonezqhhzt5bgxkspsf +one6dkckh6four2gqztm81 +dtoneighth871 +five3mzqgxnbmdbcmnteightsixtc +4three19qfourtzh5n +8threefourppvfbrfp4 +19five6nvtgsp8 +sixtwo9tqpqg1fourtwo +1tkzn +twofoursevenjp2zphqlzqmmbskkmxmj +one1vgvsgbhtwojmgr +nine2phxpfnptp +rqqxqslzqjlnfb1four +17gkhhffc3oneeight597 +jjhclx3 +2513 +3five91tnbkmxeightxonef +gpqnkzt2sevennflfrxdonevgkhjrgeight +1one5eightfour5hckvkpxsleight +41rbglbkmqr +one8eight +9threevdbtbrbrgrtcdv1 +58ninetwonine8three7 +nineznvtft63t +2nqhjtvds3ksfjkqxhvseven7 +41t279zsgmzmjk12 +eightthreethree12ninehrsbvftksstwo1 +fmgcfnxbs6vrmtxxvfdz27three +17qkrps1 +three4two4rnnslsvxmsbcpvnbpfseveneightwokcn +58ninehxcsnzfxbf6xvgcrfznrldqntsbsjmr5 +355knfjsdqjm8 +htsrn3qdbskfsd211 +969five +tdbjsvfxv67htbpmfx +6l +pdzseightjvjxlhgjhrnz9zzjbcrktjc99 +fourzqlhcjksixthreejrl9 diff --git a/day_01/solution_01.nim b/day_01/solution_01.nim new file mode 100644 index 0000000..8d35725 --- /dev/null +++ b/day_01/solution_01.nim @@ -0,0 +1,12 @@ +import std/[re, strutils] + +var res = 0 + +for line in readFile("input_01.txt").splitLines: + if line.strip.len > 0: + var digits = findAll(line, re"\d") + var number = parseInt(digits[0] & digits[^1]) + res += number + #echo $digits, $number + +echo "Result: ", $res diff --git a/day_01/solution_01b.nim b/day_01/solution_01b.nim new file mode 100644 index 0000000..67adf97 --- /dev/null +++ b/day_01/solution_01b.nim @@ -0,0 +1,20 @@ +import std/[re, strutils] + +var res = 0 +var valid_digits = "one,two,three,four,five,six,seven,eight,nine".split(",") +var digits_rx = re("\\d|" & valid_digits.join("|")) + +proc parseDigit(s: string): int = + try: + result = parseInt(s) + except ValueError: + result = valid_digits.find(s) + 1 + +for line in readFile("input_01.txt").splitLines: + if line.strip.len > 0: + var digits = findAll(line, digits_rx) + var number = parseDigit(digits[0]) * 10 + parseDigit(digits[^1]) + res += number + #echo $digits, $number + +echo "Result: ", $res