diff --git a/Cargo.lock b/Cargo.lock index 2423e93..38c1399 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -115,6 +115,15 @@ dependencies = [ "criterion 0.4.0", ] +[[package]] +name = "aoc2023" +version = "0.1.0" +dependencies = [ + "anyhow", + "aoc", + "criterion 0.4.0", +] + [[package]] name = "atty" version = "0.2.14" diff --git a/Cargo.toml b/Cargo.toml index a228d23..2896c26 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,9 @@ [workspace] members = ["aoc20*", "aoc20*/aoc20*_bench"] -default-members = ["aoc2022"] +default-members = ["aoc2023"] + +resolver = "2" [profile.release] debug = true diff --git a/aoc2023/Cargo.toml b/aoc2023/Cargo.toml new file mode 100644 index 0000000..30be3b6 --- /dev/null +++ b/aoc2023/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "aoc2023" +version = "0.1.0" +authors = ["Antoine Martin "] +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +aoc = { path = "../aoc" } +anyhow = "1.0" + +[dev-dependencies] +criterion = { version = "0.4", default-features = false, features = [ "rayon" ] } + +[lib] +path = "src/lib.rs" + +[[bin]] +name = "aoc2023" +path = "src/main.rs" diff --git a/aoc2023/input/day01.txt b/aoc2023/input/day01.txt new file mode 100644 index 0000000..25b1572 --- /dev/null +++ b/aoc2023/input/day01.txt @@ -0,0 +1,1000 @@ +zlmlk1 +vqjvxtc79mvdnktdsxcqc1sevenone +vsskdclbtmjmvrseven6 +8jkfncbeight7seven8 +six8dbfrsxp +2zpcbjdxcjfone68six +zqmzgfivethreefdnlhpeight8798 +fivenineone6 +6sixzvdsprdqlftwonine +lqztrmztwo8dg +four6onerv2pfhm +plvzrs5 +5282gdnc918 +pskjsrchjpxoneonenine96fivefour +fivefour2hhtprpjndm4 +6qbdcfdjsd1lmldklflteight +gctgdhpkkjninekj65rkqg8 +eight6gcjlsmzt5 +5chvmhmfgl7xkjfdpdbp +5tpzpnrgpftrnine +threeonehqbzktq1 +685fivetwofour4lvgxgdb +9jdxljkfqttstqxdzdsztsxrfjbkqmmsqzseven +twostcllbpndtwo15seven +8fivetwofivetjfvsxzs5kdkpxgxvsfhr7 +sevenlvrc2fivefivesixqkzdkrfour +45jjpmnscmmk +lhxgbfjtcknpvz6 +tndgnkcqtjbrzgbrfjr3fiveqxlktntzthree +vqb6threeeightbdt +1eighteight7fourone8 +bcmqn9onecnrzhsrsgzggzhtskjeightbz6khfhccktwonenrj +6qmgkbkmlxfourprhxrxrdseight +9three479 +9two6zhtjzfmjrteight +1fiverrxdmvfvxhs7jqzzqpcflzt75 +pnjmlpbbeightskgdf6one +6cpzqzfsjtpfq135 +484 +llfvhxglfivesixthreenseven36 +jhcpt9rq7fhzbnhk +tthree5lrgtbxxvonezfmdpseven2 +67jmrxfdmfbmzsixkzghng +sixthreefdbzhslqone2sevenfoursevennlnpjgsx +54zrkfbfq +six7rfpfbzbghxcnxlnfjkznine7 +8dfoursm338cz +sevenfiveeightone68 +dqmvcbdclx23653 +eight58qgjlcvflrggndskff +shmmk28 +93eightdtgcnhphv1 +gdtdjgggtj3dgrqsmvfh +one3pksbh32three +9kkpjrmhmmlzvqngnhftwoonexjqmnfive +rlsevenblrvrk7 +nine9hqmtshkjdhs +93fdbrbnnvxsktggqnjfjk7brsncmxkcfzhm34 +248twofbkfpxtheightwovng +28746threecbffiveseven +eight449 +4eightnine4ptmzvpfqxhrzvrpjhfsdsvlhbht +sevensevenfive6bjf +sqthreevhmvbgxvnk2one +ghpsix5seven31 +7llnsgdtzbxjbbqcmxfhgcdnptwothreeone +eight3fouroneplsrfvqf +4six6one +27twofvlssjbsk8j +njlllqnrvx8four +5onekcngbbmpnxseven9fourzcprjp +sevenfive2sevenknzpxtx +8eightljhtmnxpjhxhnqtwo1rjddcbj +mzsqh3sixfivethree +deightwoeighteight5 +nine42sevenscnjeight97 +2gcrkrfourfivenpzssevenseven4 +eightdtwosevenmj3two +9zkhqlcd3 +ctpncdkcmonehfive9 +sixrtwo7rqnine689 +sevenm16gshq4xqdxqbhcl +zxxnrpstkkmnhcc6 +three1sixninelsxrbkpneight +jzkfvrtmctjz5 +sdsfrh4nine +foureightfive7six +ninesixfivefive53seven +42threezpvxnrg5sfzctbtk +seven7pkfnqggvjthreextfksczdd +xsb6ntlfzxvlxrkx1sevenkmnqxhcdnqkdzt +6sbzfqfdm +lrfjxppqbdseven94ntnskpkdqeightsix5xskh +98czzcq +696cmcdpztwojk6tz +jbpfbqfdd64four2onezrfm +9jfklkpcffive5phpzqvhrtcqvmxvmgljn8 +329sixjglqzqzjnlsqbnqnzsb56 +59three +4863five +6txkcgtn7gtsxgtnine +lxdtnjvjbgxpnrft8eight2cjqfdtrk6dm +twothree53 +two1qf4 +6ltxhxcdfive +rlrdkzgnk6mnsbxfkhh +41z4nzcqzjqrnmsixtrrbgtwo +tbnsixsixtwomptdjtzkxfhlflpcdnbmrbctjscxq6qtmjmkpfk +1vqlkjtmjeightcjzxnzscczqmxcpvnprhtwo +lznhcphkdmrhpninesix344 +fggprsvtgmbbtlk14xkrnbcjrdbrsbdltfztmtwo +6rqlzs34cdlzmxone +two7zpbgsxl +lckblpljvv5two75fivegttgmvcpmlhltxz +bjfbxdpvnj581three +1seven4 +8ninezhzrgg6crlpggmtfour41lhjcqtblh +seveneight8sevenoneshvkcdhgfmxhn7dzccsdfkcx +7zljpgl2 +six1two +fourztcnpn8bsbzfhdhgkjjsthree +onepthfrh9vcs9sevenhljhmprhlsjrr +vlnpmqlpjfour5 +two3qfourlqsninethreefour +hshdseven7 +eightfive4five6four4flrzhrxzlreight +five187 +seven2xlbqkhtflqtsfhrf1vvnbt +onefiveninethree26 +2sck1n9eight6 +6sixsix7two9xznczchmx +27eight +7six3 +ztlbbncthreeseven54three +eight8r6mcrcgrz51 +eightnines6nine75 +nhx83fivetwofivefourrvxqhnpeightwoj +857sixzrnine6dlprzx +lteightwo2132seven7oneone +1516ldxxftfnineseven5 +6fourfivej3 +sjmjp99 +bprsznhxztpp51 +cmfivetwo1four +6mgcffzzspll15djsoneseven +9qjcvfourqdtmhlqzfxfg6 +six45fivetwo3zkpxmxsgxtmg4 +three12four72kvztxqdmfxhrxsp +threeninebnzthreedfqvm93kqmxpsnmb +8nzfbcmghfive92 +914six +sevenfive6 +3bxxccqzdjsfive78lhtpbl +5zdvjxsfvcptngh5 +vboneight4six17 +seven8eight9krfhll3lnine +stv4eightonesixcfveight +rnmjpszvx94fivefzsphkkftgxpsfhvthsbv +zmntmkcbgrtwonspdq7 +5ntxnjclc8six +8six58five +6ninesixeightqjnjfbbtlmcqvthree +hgjh9vhtdtcgkzpltnpxfqhsix7kq +64sevenc9 +96z62ninenine +sevenseven38 +ckk9zdnkjvskct +8flk7 +8eighthqntfrh +8cthrxbjlxbnqvqc496htsltqpqktqnz +31threetwo5 +twofour5 +rlggcjdthj3nine +18five4 +sevenhgncfjnseven1twoseven +kshqgsm3pcd518 +8qrpbpbbmzmbctsmvtddoneninefivetwofttd +fivetwoqvtscrs133two5seven +6ninedcsrftdtwofivexzmpxdccnine3 +threeseven73 +pppkjkgt3 +seven2six1ctmmjvdgj8h9 +xkpk3fivemgmrfph +pppgfivesixnineqxs6onebgsplgfhqp +cvjq15threesqqtpczr +three95 +twoldjbdxnqncntpphxshbthree767kfqbsqhlkg +9lfhbgmcqnhhlvvpvdtwo37 +v7gj +23fvgbbdjgst8 +six3frmpq +zrggqtwo6sqr8 +fiverdrxxtjlhzn97fxsqpxf +sevenlpb2sj3one312 +four6six9fourjbsix7fnr +lpbgnkhkkbninec8three +spvkzsthfour2 +ljbrlhtkxfkskvdbgxqmmjn3nineqmqtffkfive9 +h1jmxtlfivenine1djqrsnpqccvzmdhsmxnqrjlgdlnj +8threeseven +1onefive6one71five +qbjqnfsevenmls8gdnr66 +jgpzsix76pxldgpcvdcpzn +8nkdjhgrn +threeeighteight79 +9ninelzzrjqpkseven +75six +threebpfsn3three +4twonel +pjvmb14tzbz2tpfourfourseven +zslfour1pkklkrsixncvjtkn +honeight3 +six7stfffkjg +42fourktbdmzstcgmdtcgbhffthree +two27 +ghvrgzj6six1 +vxjqk3xhlr3 +threetgzkjslbdrdxgfzsd3lcheight8ninebxhzf +sixfive7one +f5 +qq6lkvlmrnseven9three +8fournine64rzdnnhgdsixseven +4vttbdfivesgdnjsvsxt6 +765 +6czbdlfcfkvplmcb +7one52 +eight6neightone +six5lttjtcbxmxnz +threetwo692eight +dhcztvmmlllg8four +btdjgnh9vjvlqfkznqr635hhcr +2jvbxcfournine +4sixonemp299sevenfour +1sixmdqkzqtgzeight7nine9 +4nnhfkrlmfpseven +blhvfourtwo5vrlqtqrlpxgd +kptg4eightvglvjdczfive +5599msgkplgqfnzseveneight6 +3tnfvgftsnbzksnrhtrtlbfxcfqfjgnndlmfvkqvhcmgdtwo +txvjfglxtbfive3zpx19 +six9four5 +5fourseven +fsevenmnfskhckvfszs73rnjqjhsseven +95knstccbfivepgpt +kmtjfxtztqnrngxxgcgh1kdxpdjzspz +two2rtcmvpbzsmfourchpqthree99 +fzteighteightlvnoneslhjmcrqrg8pzvszdxzbp +one49szrxcjvtt3eighteight +8nqbmcsthreeninexf7 +fvvzvpmsgrrnhjksf8l4 +7msxhtdk +jgtwonetwosixthreervlmxlnine869lbqzxpqqn +nvdn6bdg9ninesix +82rxtf +9tdqsdppseven7one +tlbbxvtwo8one671bhghlhdpfh +3onethhhlmgfhseven +n2six +53eight +one5five85 +three5375nine55 +fhvxvtjcnn3stcjhsdjtc1hhmk +six1jmgzrklbxrmzshpfgnv94hzfd +737six +25nine +fivevnpmlzvvp118lbv8xzplfttx8 +ninethreesevensevensix4three2 +xkgtqqlcdr51bgtx +sixpddqmbb5onehbmjfbpqx3threechgvdkghhjhnxl +7eight9sdcq1 +9ninejbcxzp +3two2sixone +seven8fiveonecrcqrglql141 +4nine3cllndctlninecrdxsevenbhbqsgtjnchkmknpdht +sevenzfbnvgfive3threesix +tvvjkskxgvfourxhccmmpxqx8mtxmfxmrcnine +ptnnhktxxn2qrjvmddszgcftlpdfvxcpkm +mboneight8lbjvvfzrl8qgqf +7twomjfhzl +sevendrdvmx2ninethree7seven2 +zoneight6eightnldnvhqpbd5 +29c +kzfkvqqs2ninesmlcrg573five +vxcgdz24ljhrhgsix6 +one3nine53xtr7seven +djdeightwoeightc2six6nine +eight2727seventhreeone +3gdtc7llsdlftdrx +581vjcbpmrzlp157jjcmlrzhr +7eightsix8fourgg69 +zsh38twocvklone +three6np +9tvxqtbpf77one7149 +7three3gqfpfqmhsfxqbqbnv +8rhflhmhtbm +217onethreelgfmpdscnine98 +three3stnst6xqqxvxzkfssevenbzktd7 +46ttbnzlfnsjbc +bsqxtvhgthree58four8seventhree +ccntwonedsjvftmftwoeightfourbxxt5eighteight3 +threeninembphrpfourone13hnjvn +bkm2onez6xxdjvnxvxjrtwoeight +jztoneight8gsmnjcfvk +six3fourninetwo62 +99dndgmkcctwoneftn +eight7pkzcxqhzfiveppvnineksjfhhqgm4 +2ngrttwozgdsrdsfq5ftgsq +fourdnmxjn5997eightkxkkpseven +rxnrnqvm98zjxxmkflone +three1dkmtwoone +6tttkrtnhgfzx8five4shlcvhr +nffggbxmhkpcppm8kjhktmdvlkkmrffdng254 +mbjm445 +6nfqxlhklrmfour7 +twosixsqtsfcleight8onefdsjxvbgt +9bkkrznine +fivedzpnp1 +cctxzzjbhgttmszdph1sixqseven2 +1qnfxpzfg2feight +5gdj3shgqvjdsix23gqp +xdgxsrshddmzmhkhznsdthree4one +gmtsixsixninexxsxone7three2 +1rttbtsccr +threeseven1fdzqvmbnsfive6 +nxqxvhsix41385none +sxgmkrzmbvn4sixfive5five6six +three6threepdjsseven3kgxtwo +8grzmhsmkthree +seven1htzbglcdfbcg +5nsjsnrscz1zhrvjmtg5onefive6 +two4one +dzl41four3threehbbqnkhn +onebsm86 +xh2 +eightqmdbfiveqv21sevenseven +5onefour3twolrtmmonetwo +32seven +vpcncrhjxgcs3sevenninenine5two +mponeight9glbvgrff +zgzzzpfffneighttdcplkbfr57 +7nineninemfneight +3ddrsxrmbzsmxkdfive8 +pnxtxmfrpmtwo3 +onerktgpv55 +79twosixhnnrqklz98 +5915vnrpsj +rfg7szlxneight +ninejhnzpnhkrlqceightfive5 +tzcgzzx6two3qfk5dffgnp +ceightwothreerqnfl5fourdfbrthreedntdchgnine +sixnfmdk3sixthreekgvmrzseven1 +mcdbsqnrzconetwo1dthreeeightjfjdblk +48threejtdnq +threerxnrgzd9 +vmzgfplpveightfnctwo4pptlb +ninesixqtbqgjvqv1three8 +cfnlshzvczgvm1onefive +gsskzxkgrbzx5pggzmsfhtwotrsvmttzdc8three1 +3sevenfrc7vzg +dcmxmg7d2jlbtfhkr8 +62nzzeight9txrzlm +9pjllhmfgkvssixsixthreeqmzthree +ctjksjbbdn28 +39fivefive5cnqjtr9vpvsix +jlbjfouronent7mlpqpcvqcmhfhvqjqcmtwo +2kpvxg6nine +seven4mlsbhzcmjfthree8 +1khfjhp3fourrh +ninesixpfrjvfm8kkjsrhttxsslhtwoeightwovvg +four2nine +fourlgcbfptfz45nineeight5eightkqtbt +5sixxqggppnl7 +51zvfive1v +fiveoneqqk5seven7four3five +kqlkrntrcfrhtwo9scczeight8dbqmfhstnzq +ghdjlnzmskmvjeightnzmpbjgone61 +three8jrhhmfnfive3four48eight +nine87ninekfzh8 +329nine +jgtwo3xvlkbvhrss27vltrghkljq1rkzkls +vrcfourtwoqlgcrxf274 +sxzkxpvnhsixsevensixtgptbrpnfthhnj15 +5rqqntzlq1one +1pnine762fhone +ttghtthree5eightbqm4two8 +2pmtldtwo6onedtsklbcbjhone +fourseventhtdcsmc5 +xqp75five99g4 +mrjpmm4crgk212seven3 +qjpdjb1 +two44sevenqtcdhxjp35xxx +sevenvtd7ttvmsninergrgdxbdqcthree +pgkqpltdzcthreemzrsrqjfourcrghhsfsjcqtmvxq4 +threeonexfrdvr1nblctsevendqmmzdr2 +8three2six8 +59twozjfour2 +qgtjgmrvfcffour29four5six2 +zzhnine3nineknzkvmbxvm54fivelrrgc +fonesix3three +seven6fivetlhhonetdzrkhjzqzseven +1ldxvjseven9eight5 +seven2bcbktzsjpp +2kxqxflk55two7cflfdfvsx5six +5lvhclqxtf +one768two +vfh8 +nineseven3xpc2jkvmgkqc6two +vvcvzfb947twortlnl96 +seven58nine4nine8tbtjqfpgp +7onefive4lbhslhdpsbtwo3vm +foursixsix3971fiveeight +nrqxrffqbp15 +mklsgg3oneseven6eight4bnbfxf +9five5klpzgrccnxvd96three +sgbqgrlqreight8 +jlvrfrskmlrdtdpr4foureight1xccgtcf +five5threek4hsmqjq +five6pxqlplmtvcvjgtbk +3sevenninefourone +nbrthreeone9gxeightlrkfvgtzhtwoqvnfb +teightwo972hrdrlgn5mpbjrxprpkjxgdkghgrgbthree +7nzgktdsvkjlqdlonergplcdqvv +kzxttx3fivesevenjdlqz9eight +9slfgkbdmq24nh595two +tkbnjhjrfivekqqxsjleight1 +seven23kh2tggrone +12four1xcvkxbcv1four5zs +j7ml +8eightone58dnxhddzstmfleight +mtd37fiveeight3fxcbcd7 +2fiveeight +zkmvsnsgnine321mtbzzg +4tgzhmf9 +threexjqtqzgzj4kvdtbpjv +twohmnpsqbdcrbl35three4seven +2twolpmdnxmcps8fourttfrhzzx +onegqsqrhx2twoeightcxmnxvzsfivethree +2eightseven92sixcjmkzjsl +9gncpkg +six51eightfourkmqbrrkkrjzmhgsevenfour +9bhxxzseventhreesglvvpjmc83eight9eightwomd +164cndtzcrdrxfzgnvqkvd1threefive +43sjlrhsrthqtwoqrxkqsixsix +twohfbqjxmc3four161three +4ngvsmdvm +xmhkgqdnfbdxcxm9 +lqgxmshjzgggj9jsqnv96one +vt2znbmqonesix1gjppfmsevenone +nvdjzzlspjthree8eight +qzvtwone1one3fivek +eightlfztsninepxfstsxtthreefourthree7 +k6 +zmeight2 +3cblxxxthreethree232 +two6sixcsgnzqbttjdzqs39oneightdr +bnjzfkmfh8ndfssix2pff8nctdvdqk +spxskgfmtgghlmklqzz6tdgxnbnnxfmgnfiveseven +cqrlmd62gsh +6rmrzkv4 +nineone6dbtzrtsp8sixzrhjhkrhvsxktbdkjcrone +5pvhbxqdvvqhlthreejqvs2 +lmeightwothreesjrsqgsv9 +seven8two92eight +five9sixeightonevzqtzq8tcgpbgthzvlcld +51ptkkdnzhgp +7jkrtwofourfour +xpzvfcdv1jvbd5mgvchdbnd9chlvqkc5 +27threectsxpfd12eight +prqbfh3foursevencgmhkmkd12 +one5seven8threegqcznrrxfheightfvkjkssbch6 +1vgsixeight3sztxzjkgldmqqbrm3 +jjcpponejtxkmnmggtfive3 +sixlsqgmqkjjzrpqj3dgsrpdzj3mjkdqhpq +slxstvfive7nfst +6fiventqxzhxkfivekcdbhrkx +sevenjqmfmbjfoursixcx7threexspc +kgqjjxfkmhqtf22htnvmpgxsztbb5 +nineqzgzsscrrfngnzksfour1 +9threerq4rhnbmhhsoneseven9 +6eighteightmjbthree5eight +threexhzqqs2kjdqvjr4 +z3ktworvbgbqzbpt +2onefive6 +c69492 +eightsixnine8tpjcxmpln +mxxfpjsplj3msxqdnnbcbbqxfzs5ninecmjpzq7 +cnineninesixfive3seventwo +six18eight3eightfourthreeone +6zdtsqkplv41jmrk7qkgjpkqgmmqsttvrhkzone +7threenvbjsvbshmd4sxffiveqvvctwo +two2two7lpmsjl4 +sixceighteight71psffhzjdjrm +seventhree2eight +qpmpfdlr7 +dxtzmkcrsix5 +65oneptbzdxcsqseven72five +7bdmgtzdmtwotwoseven8one +14sixckthree1n2 +twotwo5hpqhmnnjbsix35 +one5twothreeeightglqdbjlgkseven +one4twokzbdzv +8mcv71six58kkxdqx +bgbvdrfsixfqqvnlptzrqkhgmt8 +37oneightrmm +3onefbtvqchjthreebhxpvlqcdqh +gjcninercqpvvzdfkcdcfv2 +13fourbgntvtnxmr +8447zdxvzfkft +1foursix +threefivetwoseven4eighttsxflbcqtnfourthree +tseven1twolzjkfdttfklsdzrrflnfxfgvlq63 +four9fone9twobhppd +nzcvxgjqrsfqgkktggdlnine5 +57thz +3threeseven25 +zsbc6fivecqvlhtwolqone +nnsoneightdnine6rhckhj23fjj4 +cj1rbxlggxxgtxxbmtgfg6two +vhkgpz4 +nrmskeightone9six2clhcjkcl9jk +onejvdcrf96hbv +seven8three55 +1sixtwo79 +jcqknvjppbxsphlxrrcbzmkqnine29 +2fourvgzhnq +2six93rdrkfjkqlllx6nine +77onevkvqhvptbn +32szxlxdc5zlrtjdqpt5 +nine75hzkzvdseventhreelxt1six +vdbgshtjm8grgllht4qhpkhdfour +mrvdgqvseight3jtzfdspdtrkf +kcg2twoonelcpxlg +2xlcjcxzczt +1pszcvn12sxmcbdxznpeightxvdjjbgrjlpdv +fourbsbkvnineonesixthree8 +945five5one +nine71gzq79 +3threeeighteightldqcgtbd +two671four2r +bbfpvdsvffour5two +767l97hm +twofour5 +xxrs931ckbg34g +qhnht4 +nine723nine9 +93preight5f6seven +one8qncpgpl +fiveeightsix8jr2 +twocdv9lrtsbcdtvz62pkzm +dmhfljxqxeightxmbprh2 +rr5 +5twotwo +three8two5 +4rjqmbdtxv42twoeightseven5 +fourb349six +f31nineninetxtdtfivehc7 +1one3 +2eightxztclpbvkp +bkxvnhhn6nine211 +1twoseven3xmzg +lnzpnine54eightwoqpr +gnhdcgdmvthree9nine +vlxjmdc1fivesix +nineonefour69 +ktdkztzmmcgxslggh7dhptrkgfbqnine3two4 +qfczhgjnt6 +3fourrzmt +onethree2four3nztsmbqmtldgonenlc +29six9xlffbvfntz85 +five6trqbjkhjfmrlgpcxseven +threegz9chglg6 +9tq +1onefive8two84ngrh +hrqhreightfive1lp +onethree4 +two8psmqcbsixsix +sixseven3xxczmccll +fourmmlcgbkhktbmrp5three +27sztxgmqdvnfivelfcpzjsx7one +hdbhrqhhffbgjxvdpqk6sevenbn +93ninezmtrgjqbsp74 +gsljpvzxkq9 +zbjzzrnkbeightseven1four +fourfivetwothree2rh5 +155cqrh1 +1tjdeight +dvnlk78cbvdrccmmx3seven +8seveneightsix +ffjlhcgxp97plmttszkvj7jvtsgsevenznl +121four +threetkqnxtwobvbmzj4ppkdxqtblszmxqhqbv +5sevenxgcgqnlpkpnfmcnkbfbeighttwosevenhpht +gkgnfiveninelr5eight +six4nine73szmldmdd +9jfgcslbrcz +jrgrnmntmtwonptz8eightninesix6 +238eight1xtjdgb +2one66fourndjcxmmbhfcq1 +5bmfntsevensix +5832663v +7sixdzmhfrjonebdqlqh8threeonenine +92six +vqpg91hspvdgtwol +fivembzffnlcktwo18four7 +six99nbzrgd8 +onexqflrlvdmrsix9nbl1szkf +vqmlzjc1d3 +three7two4vbgzthree +twoninejbbxhdfnbqjddj26one2 +5nine296ninefourone +onevznthreedbtjtgxhh36sevenfour +zfkffkjsz7btqgtm1lqvsix74frjhrkbjj +sltlgnine6fiveninegglpc8ninenine +two7three +fourbrmdvfbtnnnhr1mnhbztwo98 +nine6slnine +cqkfp35hzrdlcpcsjhssdlnjv +six42seven32five +zkhjblqjlsfive9kbxzhjmnzrxbrrj6sevenjdvljbh +9ldrjmjpqeight4pnmcfvg3b +lone8 +two1sixfourgskrlfkxxdhbjspmhg +4hgceight2one52jmbmjkjb +six8zfbjxfckfivesixzrpn3 +vbrbvv6 +jfjkvxcrbjhztvtmjbp15two6one +3xvhtzgqpn4td +xthree44 +68973one7rmx5 +ptbndknk26two8cv7seven +57417four +ngeightwopgdtlxjgs3threefivefivesk92zgcmch +pmfjgxpg6ninefoursix +5hlgzgrxhxxqt8 +1nine3 +gvdhxthjxnxv7dtzninenine4 +jrtwonehzddmgcjsn6rzldcsfpqs8eight6six +5fourfive +jn6 +two2four +567ninefive5fivefourdrbh +36sevensixkbphcrstnine +76svmjhhkrt73 +thgzhsclsptfqfzpsnine4cxxpv +two1one8fninefdctxpmtk7 +seventpxmbxcl9 +cghxxdnnf7vmvqdfhhxznine6dgt +soneightsix7 +7ft3threeqdhxjmkgd6vgfmb +1threesix5lzjzrm +fiveonedknfvkphltcxnsvxpvxlxldxrqftcmqvvqx6 +sone1tnmqklzvbbctjvntddpm3 +nine9vb +eight52threeqnhhvn +87fhkjhseight485 +1onesixzczvlsmhbfour7 +3ztseven +7tjjbq2three +sevenv1eight9cpvmrn8oneightnxs +1threehlhxjj2eight +six87twofour3646 +eightzlmj2zreightbflxtmdbv +one2eightznone +seven2eightvlxkqnpjb7dlqrmnhtfive1seven +43eight3 +fivesixfiveeightsxrvgmpshvone7 +7dpmrqeightone1rdfdrx +dtmtpgjll136dbcjlrhzrdnm7svlrdrcngpnine +5dl9 +94ctwo4four +7ninegnssldmnmqc +nine1sevenzdvkpxxsfccmb +none5five1rsrsxpxnlt1lxtf +sixpl9nhgm +51brpphslhjtwo2stjrkphcgrfive +fivetdhlrcbtwozdsfgcdnhv67fivesdjlqnine +4fourfour7sevenfourfivenjdxvf +674one46 +6ninentdksjfkdvhkkxzrgftnbjmfsjgzd +4ninerpvfmfonetcnhk +1ksbmzccfreight5 +3vqr +ninegqbgveight7hggnxxgrq3 +sixfourfourseven1rfivekcflqd4 +mzvqrlp1sixnine +sevennine3gqjmqrq +6vhp8one251eight +5dnsxqrb3twokdzdbdcncm +srcmzlkrone9ninegbfnfmxjf +82lmhlhmtgfour6nbljxrgjb3ninesixtwoneqhc +6pctdhrmhrgsbm +sevenhgpfqvkh5three51jdkqz84 +hfzlmldpn9tjtlpb +phccmtthonesix6 +3fourbrzqzsbnthone +11pssjfqkfivebmprltbvm4 +gmtc2five +one2lj4fivetwo +ninexjrzfonehvntsmnzx2 +fourg746jpxvrbzdmseven +six76436 +89gddfltmdkkmleightqbzppmklxzgpnlg +sevenmtfmdrbcl9 +3cpgvjgzxsixnine5hvrxbdnclfgbvfsix5twonelv +eightklzkzxltzone5 +377bqrbsdk1eightthree6 +2sevenlfqhmfour +21oneonevg9rr +onenzjgjxlmtrgbt84onenlls +7rlgkgrsixfive +nmmpl6fc7ccg8lkvpvqplztwo +mzbxkmfcd89six +fbhzskjt4seven3jrvfjhqsbcone3 +five3sevensix +eightsix6 +n9 +threeninemzpjqpcpvnine424ninesix +8ninesfour7 +twopbsbvdpnine6fourfive7qbbckmhxgg2 +5ksvzfbdbgvnqonehsgtvgkbgjkzggsmpvkxpxtft +qeightwo2three68nine39lr +5gpz6283five +19fourjctnldrqlghx +gtwonetbqxnvxlz2three +jdvmph5fgztldhtwoxhzk +fourgmhflfpxmbqpt8jdxkntnchmtkgqhsgthree +527five +5sixfour +mdchltjjqmfive7 +kn6glgjlspeightfivej +3vsblvhkmt7 +17rmnoneqqgqmcvlseventwotwofive +eightjbmnzngtxsix3two +fourgdczfkvs3onekrcm +2prvszkhlnine +nine67mqtxbthtfxgtwof +lrcrninevgshzsrmj9threethree6 +bslrhlvpthree49fmlzb +3nzqmndm7hxzrlsxgmt +48jtjrmzvtct +pzpthxqxs9pjkhxc6gk5 +eightbdvrcsg2tgjkzzj +2oneeightonemlgpgtdg +8sevenrxksglxdfour3lhst +four88sevennine1 +fiveqszbfmdv8xfiveeight +sqqbhtk3nine5mqzkzbzlxlhdtwo +8eightone +63njcjnbhptone75fqhg +fourthreefivesix9pvfivehmbhmhtrplseven +5fourbfnzxfivenine8four +rzhqrxfhpf9seven69kcjhxv +nlh3fourfourlbppcjdx37 +hntmdckqhonejmcfphrrthreesix3two6 +eight7sevenonefourfour +nkhfgtknbjsixzrpppnqsone15threesixfive +nine5xlvfqmfourfive3 +sscctsdfourkppsrd6eight4 +eight92 +1oneightfs +2hmgrqgjznhh1xztfmthreev +jvpzlqbsrb3 +pszdpm3 +kccl2 +dzxmqpgfive6338seven +9nqfpv +prphfourninesix5six +57vbcbcvtbgtqmktjscjbzfkjgzzv7rspqlrdfsmbsvbmb +qxqlzmeightfourhzvctqsxczg4qggztsnrzz +79seven8rzgzhksz97tbrftfllmpone +twovdspsvmftgnfjdqgjpv92qdqzcgr2 +6ninesevenninecxzmvlczjf1eight +186 +fourtwo324five5eightv +six95five1tnpsqkr4twocgnbrtr +threesix2ksh +dpbbkpxvd457sixbncfnkbleight3 +bxrbglhfcz2five +8three3fivethreeqjg54nine +nineonepvhrzcdm9lbqqgrdmggzkqzvhnbczrhhvjz +3rgljppmcftqmqkqbl +9threeqjrjrgseven +4qtfn +five7fourfourhbspnlmgsmxnxt5 +fffctbhcpklfndj23twotwo39 +62sevenxnxthreefive6two +5772six9five +seven599rpztwo +onefiveonemsftxtqdcsix7jngtvr +12fttpqzzlk +zcndrqjsfourthreethree11seven +nineone8 +tdlbrszns4pdlptfvcnxqhx +5six2nine8hvktskx +5xvcnbsix9vnclxm +94ptv6mzgninesk96 +4lfvvczdgvh8rzgkmvnk +74nsvkm5nztmctpmngppzkphltpx +46two9four67nine +oneonefive5fchd3nksmgs +6vnstxdtlninezgdvpmjjcxlqvc +6five3 +7four76rklqgljhdzzhdcqrqzpxmfftbcfiveoneightjzg +43eight43955four +gsrrtkpqpseven1fourbfninereight +6rvdtwotwo4eighteight5 +foureight9 +468cgbctpkqninetsxskqbhmj +7twonine4 +8jnssjzcgpzrvbqzmv5three3jmhfjcbtwo +4qjrgrntbfzghfkzxvmj53pcrjrlls +twonnjv8 +97three9zgkhgmrcfour +9eight23 +qtsgznprvthreethree6 +63tworhdlrfstgxfmjjknfourqfvfjjz +sevenltdcgs8three +bjctzmmbhrqlfzqgxbcdgdgprv9twogjmrdclzt +63lslhrbmcznine6 +66gc8seventwo +zdrpnjjtwo62ph6 +ninerdxqgxtqrrgx3gz3three5lfc +lflcrscclg35oneeightpmhhm1bkftvxqbmx1 +74rgb +six8ninelvxdqphkd6 +5zsbfjsixseven1 +4rflxzvnn +mjbpr4qjjhvbgn +26four6drctrdmz +6mrzflsszvq +fcjbdqdnh1stglpmc6nmvggcvnrghcpcnz +one2four48fourcgkvvnlzlb +kc2461two +fivethree54dbvxmf +849psvj9six +hnxg5rbhbqzzeight4 +zzsix45glphncrrq5two4nqrdsk +seventhree5qpfour7nnbllpkgveight +bsh78mzxzhhseven8 +jllhfive7sevenninebcmninet +nineseven4pdkfpdzqpbzgt +sevenninetbthree5skjmeightfpjrq +nxkv6 +four59 +zrhcvb6qlctpeightbnphxmlk1cjzdbl +8mtgqjthreenine32 +6slj8zqbpqmr5 +rqkvxmqtkn8oneckdxtqvxcthreehngfdqqsseven +nine4nfqpgdpvx9fivethreefourfnhfjmfzqr +3gdxbh2gbm6 +72qmrrqbsflqpspdp9ff8two +xgbphtnjfrg5fourdfmsmqhfp597 +bkkpgrhj8hlbsqmjdjqxjtjkrgppjgszpmm +five71 +9rmmf1hqqsmdrrfour +7ninelflmvj6seventhree +172 +tfhqv1 +jfbtwoneninenine6dgxnqjgsteighttwo +4dnvfvx +37sj6three48nfjtclz +2two4fsbbmrtnlqljqdskqseven +1pnpzdr3sevenfive +fourrbktzvtslxjdz9 +47six +jgcrllvbsvnrnmqfppxjfournbmjgp36nineb3 +s6fgr4four4 +cmpvp8three7 +xjqmgdrvtlv5xmcpnkhvfhrbjzx +117eight +9snnxnrccnonepdbfhhqcnpsevendsffjsvknpvmkdxp +rgsix6rqzsix8nine +nine8two +2clfqtxkztwo4twobjscfzptgn +6s5dnfkpxts5five +five9cst +eight71dmbdqfgtpvj3 +vdf3fjfsczlvvnine3foureightfivennhqmcdbdb +two59eight9 +eightdkfmscfmzrk7ninespg9 +sixseven46seven +493djtvlhsixnhnts1sss +ninepczttwothreemtz3three +fivezlfjhqnknnhdfour8eightninetwo +4ngvsvfivemgthtlcczfbjq1ngxvsbmt9 +sixcgkmnd2 +12 +nkgbpqfvvb9threesixqgqvjgzdxm1rc +five7seven +2seven8151 +86eightfivethreebgbfvr4 +355 +hgldv8four2dzmtpdsmck4five +ninemb7gtqzrpbt31fourndtsjkhv +3fivefourghlmgfhninesbtcsqone32 +7krkptwo4qmzhvpsixthree +74ppbsmnpfthreefivefive +9four5zdkprcnbtl6 +four3seveneightbrmdbcxxrk +twothreerdvxmqsbtgtszmxr4eight9jzbxpfstc +73prc73six6three1 +9fivesix5fivepsg +two98two98 +oneseventhreethree4qvjtzksdsz +tnbsgjqdkl22 +rmlbp4seven45 +9dpzqbds2pffivefqrchvhpvjbtnl +79hdzstwofoureight5bjs +t2 +4pstpbdkxblnmv9nzfzsttfgfivefiverrtlmgj +zkkhkggtthree3eightseven +d11fourzfcnmzbxgbpf +66six53klhrdnbtp85 +onenineonelsfhzbkjgsfivedhzlfcvh8 +jdt4four +bgfzvxthreeonebhlqjbprf1 +sevenfourktsxkbbgt5 +mmqffp1 +vqghrsgxpsssix2jxzvdjdconeznlgpxbqdlsncrsix +5bnzrdptseven8nine +zqdklqmjjc2rl8jxtmsixxftvspzlhfive +vmn9 +7mhhcftwofour21sixvvhlmspeight +blvhpfour354sevendrllsfivexmt +six5fivetxrvnvftfvgcddshzktwo83 +3mdcpcj +zdtjmglv8rkgpfvninethreetfgmx6sksteight +48five8mnstwoone7nv +cbpvqbddlllczgfmninenine3zqvptoneightx +1two2 +jxfhzr35threesixlxghqbqtq +nftv7sevenninetwo2seventwonnkbvqnjjx +eightgjeight6f4 +2fivessrktznhjvxmghnlhbmfseven2two +onedhvdg82xdvgmhxzbqrpzlnfx4 +17nzhkkpchk9 +dzccfzphmz6sevensixeightmcvxsthree +onettfmvfhgsix1two +eightone37 +2onepdnbrbxk4foursevenzrmzmvqzgstppr +five536seventhj96 +nlhqljfzmb4khqtjh +j8l +2kpmrhmhonefour +2jblsixkbblgzbfprhbjnrtspcqs +6twothree +two19eight9 +fivexbrjpnhhlvdztthree9 +jzlmvxjn9oneoneone +2cnqphtdjgdnhbkseven2fiveninefive +threetwonine67tqpbdfhfbv +smgr56slfpdmfive6ninehmqrck +fqqnjqpccjqt6six75lpfczmnine +bq2mdxchhmbxfzzkqgsixrbcpklpqnxsvnbthree +eightthreefxxssg8cx +lhlc6 +nine6onexmvlbtbxznmrztnv +8fivedlxzgxxflbltteighttwochtxlfjx +seveneightfour1three4gbcnnk +8fivejtxbpvmpxoneninesixzdrjhtncbnkgpsxqs6 +1hxsxn84eight +sevenseven71phgltmtxq4 +8fivepcqthree3dn +f6bbrdqflknp +fiverpjbb9rjbrfrlrnine +zfqpjjktg5seveneightfiveltvvtxdfk +flhnczsbx6 +tsqlvphjmfourrcqsjj7four9six2rnz +fivedmznjqtwoqmone1 +eightfllck3spsfrgz92gmcgkgg +tcrrrztsevensixqthpdqgxv91vvhbsqgzkq +22pztfnhh554qdvzjxnnzzrj +tscrkt4 +fzmsgmzbz5 +rxzsnjhcnkthree8eight +9fourdhjpp2648 +4chvdrvtgqgbzhcxztwosixsixhnqknqmntzlltqncdxddnjlk +xbfk2cr +hrmbslbdgnine8nineeightseven8one3 +kmkdhbonesix79rbshvkkvjnzzq4 +9jrz26 +seven163nine +83sixgvhjttnhkq9frphcqrng +8five3seven +three16xqdzlkqjjtf +5fiveeightl8veight1pxfptklnhj +npllktfive45nhvqjcjgpxx +hbfr9mm +onerbfkf4threeone +7eightone +eight2kmjlsix8one61 +rvrnrdrninenine3zq6jqsr +lztlntnsevenpplkhkftq1 +tfrrjmcvtbmktnxtxkkrcctmc33four5gfqpcjreight +33rgcjxfsfqsvxxbxcnrjfndrrfmrtk +3627837xhhb8 +bmjhkkn4pgf +qkrsvjclp23 +5fourzllbmcgkxsevengkrzkpvcmvgtxlrv6 +fivetczxxvjrrqfive1sevennvj6one3 diff --git a/aoc2023/input/day01_provided.txt b/aoc2023/input/day01_provided.txt new file mode 100644 index 0000000..7bbc69a --- /dev/null +++ b/aoc2023/input/day01_provided.txt @@ -0,0 +1,4 @@ +1abc2 +pqr3stu8vwx +a1b2c3d4e5f +treb7uchet diff --git a/aoc2023/src/day01.rs b/aoc2023/src/day01.rs new file mode 100644 index 0000000..3152fb1 --- /dev/null +++ b/aoc2023/src/day01.rs @@ -0,0 +1,50 @@ +use std::fmt::Write; + +use anyhow::Result; + +const INPUT: &str = include_str!("../input/day01.txt"); + +pub fn run() -> Result { + let mut res = String::with_capacity(128); + + writeln!(res, "part 1: {}", part1(INPUT)?)?; + writeln!(res, "part 2: {}", part2(INPUT)?)?; + + Ok(res) +} + +fn part1(input: &str) -> Result { + let digit_list = input + .lines() + .map(|s| s.chars().filter(char::is_ascii_digit).collect::()); + + Ok(digit_list + .map(|digits| { + let first = digits.chars().next().unwrap().to_digit(10).unwrap() as u64; + let last = digits.chars().last().unwrap().to_digit(10).unwrap() as u64; + + first * 10 + last + }) + .sum()) +} + +fn part2(input: &str) -> Result { + todo!() +} + +#[cfg(test)] +mod tests { + use super::*; + + const PROVIDED: &str = include_str!("../input/day01_provided.txt"); + + #[test] + fn part1_provided() { + assert_eq!(part1(PROVIDED).unwrap(), 142); + } + + #[test] + fn part1_real() { + assert_eq!(part1(INPUT).unwrap(), 54697); + } +} diff --git a/aoc2023/src/lib.rs b/aoc2023/src/lib.rs new file mode 100644 index 0000000..12b8f18 --- /dev/null +++ b/aoc2023/src/lib.rs @@ -0,0 +1 @@ +pub mod day01; diff --git a/aoc2023/src/main.rs b/aoc2023/src/main.rs new file mode 100644 index 0000000..44ee634 --- /dev/null +++ b/aoc2023/src/main.rs @@ -0,0 +1,11 @@ +use anyhow::Result; + +use aoc::DayFunc; + +use aoc2023::day01; + +fn main() -> Result<()> { + let days: &[DayFunc] = &[day01::run]; + + aoc::run(days) +}