commit 18f9b31f566e703414cb134be40c59a4abc0168d parent 4bbd1dc7b9bce5f2ae2c35cb48ad91b5687e89fa Author: Lukas Henkel <lh@entf.net> Date: Fri, 1 Dec 2023 06:07:48 +0100 Day 1 task 1 Diffstat:
A | input/1.txt | | | 1000 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | src/day-1.lisp | | | 22 | ++++++++++++++++++++++ |
A | t/day-1.lisp | | | 11 | +++++++++++ |
3 files changed, 1033 insertions(+), 0 deletions(-)
diff --git a/input/1.txt b/input/1.txt @@ -0,0 +1,1000 @@ +6798seven +six8b32csscsdgjsevenfivedlhzhc +fcvvkvjjnhfivesixfiveninesxlvnhfckc54 +feightwo4twofivefour +cgpzm2sevenone68636 +498879 +fivetwo2plltvdfourhhgrfn +onertxzlzdnxn2seven +ninethree4v1five +5pnnss16lzbsmcckeightdseven +jthree249four2cjzqmmbrqnnine +foursixfourfbgvqm1rchdlmzhtzqqfjzpmln +twojtwoscbrtgmnqzvbfbzvrtkxhmf76nine +2fourtwo +svxz8bjvt5zzvjzhkmtmnnft92 +threetffnjvkfh81nineqqshzdf2vtjfqjtbdv +seven1drfivethreedpqflxgdshlzmmnrb +7sggjxkcxfourthreefourtwos3nine +39t6rvkbdnfpssj6djnfbqklkgfsqbf +3four2zcfvtplkrbeight274 +one7sixninesix +kkxmtmdthree6jrj6 +81sevenmnine1llbqrsprc +5nine9qgjceight +three1sdmq9sevenfournine +khnlbmzhvlsix3 +nineone6onesixvlnlxeightfive +schplznseveneightnlcxgr7four +6one1djcdmpdrgq3two +fourzhpnphmq52r813four +scsxjthreefoureight2fivepfmpfj8 +69xvbxfffmr7one8gmch8 +one8tfpgrdhm +2gxmhtfrbrkpdvlvsmdqrktxtrpssbrv933 +4vfrtkdqlbtwordlbppsssp +2cjmtvnzpbkdcq5twofourtwo +2three5onetwogpfqtszbjh +hgvnine9four996 +37142745 +four73 +8552ztclnd +onevmpd76eighth +threethree8 +bgtwonedrmc35 +23one +9lpxzhkck2five3qone9zgxzrzd +hs1 +92xhflsixltpqprpfggbzrvmfqone4 +eight9sevenpcxvl6two1 +rceightwo6jc1nvllxsstqgnlhtl4 +tlnhlsixfn3lbdlqztmkthreedllfourone +74five +dcfpstvxnd52kdqhlht +7onenine +2twothreehdzssrt1 +eightseveneight54xflfspthreefsfbtbslx +4ffsfsvkxslvp +939flgbmvzpvfsmtcsix3 +742 +qcfive72plvnd7 +5hhd8onejbsfklmpzcgffivenine +twodsmjkhdxjdgktlrteightseven2cttnpjsv +31kptdmtwojrgp +dnnmrflcft92 +7gtglplfkrnine85xm7 +voneightznktfvmxlhnine1seven4z +24sevenncdmcpkrvnxlbeightsixlrvns +38prmrxcm5 +4vhncsevenjgvjllppvcfmvrlsdtkqcldpq +81phvtb +5l7twoeightlr +8xfqbnone5 +62737sixfourdfqvdcone +seven1two +79qncxqcj1one3 +69four3two7six2six +six499 +gknlkqvntvmsjzlfb7one +honeightmjlmvmbxsmjzg77 +6seven15 +five59two91 +gmhhtq9368gtsdg +nlmbvxckjtwofourfjnine47threefive +93eightnpkjf26one4 +qcslmgkkgbsnrr6ninennr +8381three2threeone +7hnqndhs8 +qd65 +twogtlrqrlvfourfour5qsixdjhvqvdlljnvbtkq +6seven8ldvkz +gf14sevenrv +2fourpkzdklbvm2 +four26jsrbsrxdlmzntsxgg +tghcz8fourthree +threethree8hzlvpjzxcdfvcpjbmc942 +jktsix2cprnhkkktjcvkvtkdggvrscf +dzhh82 +nine8tsix +9fivernlsl6jvfrljzjg +52d +threethree556nine +g2twoblhhptzdqbbnnrpseven5 +jfive8 +eighttwotwofiveqdfr9 +kqxncc74sjttqklx3lxpffbdlthreetwooneightnb +1xpvjzvplfjdsjqrtmzbknine +five4r6five +72eight +1kzvxckdbjjpprrqn4eight6onebsdmrcxqznjtbnh +htwocglz3jggvkcbzvtconeeight7 +twozspgcxf5bhx +ntglpd1six1bv1 +5zxgrdlhkmzsix47t43 +kfrnghxgfzpjxmstwofourkzvcsksixfive1 +grnd423 +8f +1xcqchtnsix4tvtffone +bxlbtwotwoeight9twoseveneight +7ldngmndg96pjnfour +five4threexp +mtwonexp7nine3z9 +8kg95ninesixtwonem +sixpmvfoursevenz8m +vrszvbtvtr28pzcjxkztzhvmtqvhnqf3 +1gsbtwopjkrrqc1one +tbmsix93 +n4 +kffgtgcl866364 +one4qgkzthpmeight8eightfourkdcnpxv6 +cfhlmng21five +8lhcseven9vksfgpvlnfq3bglktc +twocc2rpflzhqseventhree +six1fourfivefive5onesnpz +1ffqfxh75flgjqcx +fourthree1twortvlvcsvs2 +8rxrpvxthreestbbpcszhnbrsfour +6qdkshgrsjxxsvpmnjxnzmcone71fckgjbrsnq +8568three2eight +1khdqskj +onebdfour6 +dpcpqnineqjnfzffsb5tj1ccm4four +nsrvffqhd67sixtwoseventwohdgh3 +nvsscfour973fsngxbm6 +93zzrgmsqtlckzrnbbk4seven +3seventhreexpfrrfpfiverv7 +threeeightfourfoureightnine1one8 +7onethreefour33cghone +sevenfivesixseven2 +jgbgmcx76qc +zxbpvj7 +21xlcgpshvth96fourtwokcvmhcdtxnm +foursix2 +6three9nine4sevennine +dqnhdnine3 +seven58vzcxqmffive7 +xdmeightwomncvnkdkpxtwoonenineseven1tclckshvptwo +gsdff22fivethreebn +one7gd +jcz8xxfdlphz5threepzmjqzfb39qllhvcqj +fivesvjdbqlvgnvkcklszeightcjhdjxdvchfive9 +9sfgxbtcgbk +six4zvfivelxfghffvq9bfkshrkmbn +sdtxjnnjjp3fivejsll5 +tpeightwozhzqxjstneightsixgbjlmsjfls6tlc +668ninenine +three7two +gtskqnine1seven862mm +487jsqqfkzfcs2lthng7five +gjks7 +lfnqzjphssevenone2qvfiveninexhr +fvfgnddffhjjfour9six9 +ttkmtncjc9five5eight3 +3seven24426four +two9jnd5eight +threeonevmzqdxvjlqxgzqone1hcpqsd43 +tfzzzjjbx7oneeightbqthree +68onerrpvsixvkmnrndq +jbjljljmtwoqgt3kpvdkdsixone +kxvbxzzxrfour2slfjkkgq555gxfsix +three9tsthree +eighttbtdg2sevenxsqsq +seven213jbqmvmvvhsixrfqhlfive +nsvcdhkbdmxqbkthree28ztjtlsqprcplmx +4lntqfk4tkmmgkvrcninenineonelpjtq +221eightqfp7eightzshhl +vppzgrsix1fmvpcpkvsvppspqcsixone +5lhcrxclclcsix4 +qhone2mhhxqqdl73seven5 +5three9hdnfrgfjsfive7 +grcfbvfkj4 +487mzcgxvxqgx +four8nine3four3lpqnclxzzbmjztbhdfdjfive +3six6kbrvjjsndlxvsz5qcfmtzsqlmqbrn +klcx6eightsix2onesixthree +8ztdfdglxhjxmmvktwolsrr5six7 +9two66three +6threesixtgnznd +ggglpldvkkhgmrgt3 +9kktwo3srdtpskbbx446 +7xmrfkbsr5nzqfgseveneightcbshpfour +six5eightseven5gzsjfthree21 +2897cgv +dffvs7zrlrvlkjcfourjxsndkzq4 +eight22blzxvvshgtqlqpqhsixctp +three8bgjhkvnbdvbttblp1fivenxslnseven +3one21x73twongdnb +kfzzhhctgrlznqcdvzshlfive56pdqx +cfsthhgvgfddmsjn83sjrrkxzl +four99tfvbtxgfqrlhcdktmp +3rfhfgcf8six2 +onexsbxqmqkj3hrblqnfrseven +hfgnvtdzzb51gtljm9eight +zprhsph3 +sixsevennine2four715nine +fzxzkcvcxl4 +lcnkqqsrtwogcbvxrtfp2five5three2 +7ninesix9jxhrdqrpr94 +lxpqxseven2three +mnsjjgdlltwodrcfltwo8vninemqlfqsgccl3 +sevennfkfvxsqr7twotwonedb +7twonpkjfjmgqxsxpdtninetpsfjlqvv +seventhree328sixscxmpqjlxftwo +3qpxvglmpcgxzrseven9 +6onemqrvdmckhmdrzxzkxbjthreeeighttwoql +sevenfdpqqzpbflflgph698eight9 +fivedbntvzzdq36two3 +8six3fivefivefivesevenpxqpxrjqseven +sixtwoqt4 +tmcfive4zkxhvlrvfzhkczpkvbxk1 +rbrnxxbfxmbqscltvsixone79three +88sixzqntjsfhqj6three43 +pmcfsrpknvbfhrzlvlcffjmfive32323 +97rtggjhvvdfive +vtdljvqht1fivefivetwo +88rqtpdz5nine +rtwone725 +sghfour2eightgrgpsmfxpchmmpndccgzfzz +kpgrhmtkxzzmdpcdzeighteight2 +5bfhbmffeight6 +8fqtr17czztqgfour4lx +9xnbmgqgvrtwonevs +1zqsvmcqsxjtp +twollzsslxc37sixoneightp +6bbgl76 +58zntvhvgdnh2 +three54 +fftdddqnninesevenone76 +6ddqzjoneeighttwothree +56threetcp46 +21six3m +214onethreesp6six +652three6 +lvc1onefiveone +6ddrgglstz +twothreerjpb2four55 +eight8eightwoh +fivefqckddnine7one61zlkjgxjtqq +gzneightwovlsdvcmvj3qhbfmkdnvqone99 +92sixgxsix +64eightxb2six +51fivepbxrzkdzjhsixoneightmt +ninem3nlpdtonefivethree6six +lvxf3nine1eight +vvbvfvtninefive5onezgtsjplxc +qltld5p9tgpmkzrf4 +71six +2threergjrcqsixhgjtdkjpqnglzgdpqntnqtzcfcbb3 +7xfj5btrml3two +979nzpjkcthcl13tnfour +one1jseven6three7five +tppnljghmhxplmnjgfmpfourtkffqcghxx9four9 +396 +onettfdjdd5msplxhlqvv12 +7mrqgcxbbtwo6seven5oneonesix +hjnq8vbshrbxeight9sixlxznhqgcc +sixzq9nnq4lxzhzmzjmnbtfbkf +vfjhmf3ksgnlzzhsdtwotg9eight +ddztjmr453qghvzrtsgf +55lzcrzseven39 +onecggvnjfpone27qrzcrxvp6 +286hfzchgcgtcqhr +ngeighteightfive5mbdn +l1five +712onekndmfive6ntrmsk8eightwop +hqgfive512fourhgrm +vpdvhpkngnntqptmsevenoneseven619 +ninesevenckpjpxszfv1jzxtptvrdkfourfour +tjlcs5onetxfkq6hzfklslthreeeight +mxjrssqxt7one7hnffgqcgsthree +onefsxjsnzxncsix1rr +four725deight +sgssrlckfourprpsix5rktmjhxksgmvdqmnkndjls +75eightr6three +6threesixx1sixsixcbxxcxvnhsgl +4fiveeightkj9fivemqzvcc +ncgqljseveneight61nbcv +three83pnineskc +fivehninesevensix5 +five617twosr6nine +ncjjfvzzmghgq8 +2n48twodpnpgq +qpgnxtvhq1jcvtxlfkfour6eighttwoztzddkmpbk +fivevhfxpjtmdj2ninesevennine9two +fivejtxmg4hbctmpnntlpbzfmxqgthreejbjdb +4xgrzszmhx +28four78tmrkfndeighteightwonq +zvnxmbtjqzblnine3five +slmt6onetwo5sixfour +bthreenine3five +3fxjfivevcdmmphtrccptz +8fourksxxsixsevenseventwofour +fpxvbdgqxzdzxone7threeptgzhhqmkxmseven +9six654 +foursix6559 +9fvsdcbmmghfive8one8oneone +dlxcsjmcjpmmjr64onegtkkqkmhkl1 +pxkqbgdfour89 +nn88 +6sixthree +1zxszmgmfg9drnjzd +eight8onetvgzfzfjqlqtwo2dfhtwo +kcgzq8cxdqphsglsixfivefourdbsjjmdtnxrzt +4threenine3dpflrrtmt +one83five +8sixthreetwonez +3fxnhqrrseven +seven4onetwo +fourbvnvbnineqggx5twovbdzztqccjhqqqnine +qzcdgvninejbrfoursixseven24 +vknqxgpgxnl2mrmbxprseven +kfggmlcht8sevenfourkbtdzstpsnine +kxzhchjh77sixmvtceight4seven +five17 +eightdgkcrphqsndn7fivevkstrsprktqdrdxqslmjtz +2njqktntzjtwo7 +four66 +975eightnczdclht +twofour1mlbpb6d +ddleightwo64 +2239gksfnlvtg1 +jqrmqdkv1mhsjbqhhhjrvftwofour6 +fjglfourone74nlxzmxfkbn3three +6pseven1 +1nscmsconek3 +r182nine23 +rqvstbf5seven1 +mmtrqgddjone2 +n23fivelvprvxstrct5 +loneightgmlqfl7nineqrtmzdbbjmnfivepqhgtmb +sixfivefourtwoone3 +five39hjjcjktlcsixfive7eight +sixeightthree5three +5threeninebnbgxvnmfknp2dhbdb7nine +5cpljvtxtpbvzbdrdvsdgc23sixtwo +4fiverlflt549 +two1onefoursixmzm +4eightjksktjdvxsckgllpzdvblssix +xsxkj81vkstvjjtm5sevenfive +8943qxpcfqpnqtwo +58qnrthreethree1eight5 +6gqcfk +49lxnllkqrdgcxdrfv +94nine7six8nine +55six6dgshxnn +sixthreeeightfourbgnhsnjone1 +nine3qmpnnzldoneddthreethree +14ljmrtmhmeight8 +onetwo4eight31loneighttc +jnkg8lbjjvclcvmbseven3tdvnmrp +7qxklg +7dtwosixthree6 +sevenfivesixsgltjpcnthree2 +15rzct +tfn4ninevt74nine +1fiveseven68hztpthreexlbbgbqffvthree +svqjgxnmxlpfjc95 +nine9bn3njvhp9eight2 +92six1threeeightwot +sixfour2nine +nine1bstseven45snndcpmtbq +onesix4rkrglcvmvb +tjccltxqljfourcfbtcqtjd1 +fourgqjb7sixeightseven6 +6four99nine8dfjp2dhzsfgt +7kfgzrxgm7 +3nn3 +eightfzqvgrr1skhnqntgvv +8fmghkjzmrkpthcrk6eight9two1 +qgvgggrmnine3rl9rnf +seven6jvjfkr +ninetwofourlsbdlmlnsixb9 +khqtjbkpdvrdnine6three +pzninebmxq1onefourqtztvzlxf +seven1sixcjcbfv3ninenine +ngtsvjgmcg5mssqdgtsdrqff +1vshninetwolfbfhckb1vfkxv +1six3five +93hsvjggzqcgjbqjvpnine6 +dtwo4onefpthree18 +4fourfive +nnplsdmt962 +five83rzgdpc322threesix +3hcqbfiveppvzvtcbjnvqjz +khh4one2sg +pdtltjqgqzfive8sixone9vhnzbvfnxz +xtrxkfive83three +three75kjjxsixfivefive5scjbbflf +ljfcdxktbnmvbspglnjfive483 +eightonespmnrznpptmjvh68eight8 +qznqkgvkhlssszmdlvjdjjtbgz2 +6sixfourfbxrxfbv9hldlseven +3qzjrffxdthreeoneightbc +three4tfseven2sb +nine87rvkdgmpt +84threetwobjfzvncrkfour +eightsix9plxkppkgpzkfive +2eight4526 +hdmqlgnphg1two11 +ninekxlrjmmkm34sfvrdlb76lkbzprhnchrz +9one26txfggnctgfive +7pzrqmfivev +ddqknbqxnrxlcrhcmhmr5 +eightsix121twohbtkjqljkprzdsmnv +7eight2twoqblcpqqfckfour1 +cbnpcjljfninenine9 +73eight3eightzfzjs +szfsgstdmtwo2sixjkgxrxbtpdbkt +one722 +76eightrvs +five6two7rcss5eightone +9ckcnzponebnpjlznbrfxnkvfpsevenonebz3 +sixninedbtpcrz148tzvbhxjk +5zlpdbxk72twotlp6qbkpvjx +3three4sjgfjzzone8xmeight +56tkmpbmsix5seven7 +nineeighttqrntnvxrrbkpftwovclttztwo7two +bsxdzgxkcx5five6twoqlbqgjzbc +five22hhlpfiveeight8vrkjcstx6 +2psmkkxflgfoursixhjmdxfccbxqb +25kljltwoneggk +3fhtjzffgfph8twozr +eightsevenfbzlr7rqfivefour +one3fourninerl49rlvgnmtlcp +vrzcnn79txgxf5five2cftclqsg8 +kbbptjpbvvzcxrsix45prvjcq +one3ninefour2vcpdfkbnineeight +lx1 +1oneqphkrtwojczlpmcjseven38oneightgm +xsnzjbzfmb685ninezmgzfkzvpzj5six +547six +21five6z9 +5nqcsix1seven9 +nine4fbfprrfivevdvjphcqkfourthree +9243five +84zmtwothree +5c +17three +5gvfxttjch74eight +ninegs7hxmgmrzsx +dzxzfknlk5ddgsbsh +475cbbqscvfive +twovjtkcxpxlvqhvgsqfzmthreecg1rctndlmm +nine7eight +eightoneninethreebccrmone9six +twohbjxlfxdd4462 +2fivesixdrcmbksthree +24sevenk7 +3sixsix28 +four66vvjvqhhbhr4 +seven4fourfourprhplxheightxkgvgghlseven4 +ninegtsqsnk7fourzlmnv9 +gpr3q5twoninebqnr6 +rxhkdtwo8three2 +jljtwonesevenkckbv9four +4scdjjmkpf33 +vjfourzrlthreeseventbbzrm8n +two1fourxqlfqbhszveightrqcsprdonenine +mmppkfd745ninexfour +fxeightwo5tftddm8onexpeight +xdbmf415cq92dhmmc +nine3onedcvqdvhtqninepczfhhgbmzeight2 +ffsix6seven5ninelg +xtzsnzlvvztq64zhkklcgjrfourlztxlbtgxn9qcx +six1nbqxmq2nxhtvrnrbsflzlztghfzjgfnhmeightone +558 +xnhsbblmlp9sevensix +jz8eightonemrbchzmhrjcv +3twoktr +6fourtwosixthree +sixfivefour7 +ljbx2nine63four +889g7sixtwoone7 +four4one7cztqmheightwompd +ctqnhkqzxgtxrgfzvone45eightfbvjlgkc +8eight35two5 +6pvzljrvseven5eight +7zhgjds1 +mxv7dtbsbzfive +4sqhcsjb6 +954threeoners +63three9zltqkmpbqqpd +6sjknine6phmcxrv1three +threeoneprqcmzrbjjvlvsf2 +gbgfr2fivehsplpdnccxkfz +ninefnpxtgzhzvdnr7rftghqrhpv +seven2fourfive2 +8sixeight +gcfjqqgbcdp33five42q +fourfourbkrj3fourfivevlpvqbkgvxcfnlnbs +tcgzqgqq77two +nvzgmddmhseven1zbdfjrt17 +seven8fiveninethree48 +7five8 +nine3twoeightfgdkbtph +dzlblf4ninetwoqqj4onetvpbbfdcbvtwo +mcmbfvszjltlzdg7zxzzlrrvfbthreeninethreefdtsvclt +8mzcseventwoeight9kjchpd +sgpddvmkntwo9two +sevencgqkbcsh5 +13nine723twofour +twodpdvppxntseventwooneseven1 +9jjpxjpxdxxkqjseven +4seven1five +2nineckczklc5h +threekplnxmcjffhpfdhhhvsvsx62zrmbcpgj +35 +8gthree +nineffourninethree6two8 +1vsmthree67fourchzmone +bxnrzblqnv9xprtmvnfivevkdvqmvfhgxconezvzjlxgjhp +xtqsevenfive7fourmclszsmnqz5 +vrxnrvfivegjlqrbdtkksz9 +ninefszbsfnhbzzqhbkvxjfive7sixfive5q +eight38nklfskv3sb +5six4three +onezhpqfxgsz3stfsldzdhh +qdtwone72 +fttvpkjsf8 +8twodxeightbltlrvjjbs +sixninesixfourxzvf5 +85twokqdh2skxgnnnnsevenzg +lsjqvnfive4eightjbjceight3 +5eightnineglvjmdgjvt4 +cfhxfnvnsixfour8twosixsixtwo +hmp27seveneightsix +5two6 +d37sixeighteight +9fdbkdm86two +4threefbsjzzkthree723 +dgzvfszqpkfpxmvqf7onethree +eight2fkskmljrg12kschgbrbtgmkbdzseven +5sbdhqrsftwoqlfqblrvgghbps6ln +2pkmljtwospqdnflmj +nine1eighthgccrfourseven9 +eightjbptmtmmvsevenseven6fourfive +6threeseven6eightdsbpjzc9jsmtxdfour +4ninextnv +threeqjrdnfjlpnine55 +1psdrj3g2msfsjktgkv61 +sevenfive9xhdcthreenine9jctjthree +636 +2threeseven +nnxzzcgrhcgtz4ttnfive +seven9sixone2fbbdfqtdfg +4jgdxjqtbqzprpjdbjc2fivethreeonexlgkxtsdmcrrh +4threepvzzhkmlmbhzhmtb +m5xgplrjqlztvg9 +59s68ninerrhkrkxnzm +hknsnsf6 +trgpkmkbtlslmpqtdxfourxjspnnmhdtg1nvfxpllcrrbzjrhrstn +92twoj7two4six +tseven377 +p49five2 +kpffiveeightcsbjz39 +8sdmbrxbk +1vxknsvdqnsixkfsevenzqlr9 +fiveznrsqthpbddfcpbvhhhjctp9 +plbcxgkd4tmprsxn84hdrninetwo2 +twoqzqxbkm23brhsppdnvksixtwok +8one5 +six45tdxfmcr6 +onesix4 +fxrl57561ktxfsg +89nine54fiveeight +three62three5one +6mjqxh4scvddlls +nflfourzrrgpvftoneseven43 +7sixtf +sixxhxkvgnbz3rbdnvgf +ckq745ninepqk +1snlkqn +ninetqvcllfvcfs62qtt6seven +59khlmz +eightdndsvdcqneight9twonenf +zgcnqqmlgsmfzqbkllvsknsevensix5 +8qqxshjnnsp +xfvttdnxhz4sixsjkqhpfszn212three +fivelssnmckseven4ftqt +2qsqpjmcbtvxjgqhhk +tztwone749ninelncrmvthfourpgcbxzxvs +4threecgnjpthnsgxhxbffour8eightsvmjkg5 +458sixseven6one1smkjk +seven4fourrgqffqthree7 +jhpxqpspbsevenhpfnrpdvfoureight5nsbsfscjlzfive9 +sldxjjnjt5dlhdtrmsixxlmgxhvpscqqthree74 +8pvfhtpghtwo6 +nfknjlfive8 +eight7sevenseven9pdvhsevendzpxpghzr +9fgdrgsgdhtwo7238 +8nfjgxpcbbmjrhh9765dnlbsfddhf +tkqfc7sixsixsixggqsevenzrjrxtrnh3 +fivesix9zmxpjk +four1kvhvnhjcgz +one6sixthreenh4 +onesixfourtzkjjlnine1kq8 +1xkl +8six5zbonevbtbmvtjvlfive +zmggmrj9eight +5sixeight23 +19twobshhmblpkp68 +7fivethree22four9tghbrr2 +gc3 +6qdkjxgpseveneight1seven +7sevenfivegpllcnbvf3khjsqtwoner +3fivefive417 +seventhreefthree96hbrjfxlkrninetwo +vhnlzrv4gbdldncbgqrfd5 +gfjzvfchlzrnf8fivesixthreeninesevenrsfptjcrb +6nineninelllzx +sevenckthree1 +8one77four8sixnsmbhbp +ltcfm386 +bcncpxhhgbdtxh19kqkpffqx6 +pr95 +eightsix7gbtwofourvclrmgfvph4 +four6bgzbcthree1kjhkvlh +lbffslczqninesevenr6z +three6lpjrgbfivexzfkprdf +31kmnnffourtwo7dkmmlrdsm +six7fivenbljxg6onesevenzmknhdfive +32five5sggfive +two4four +xlf4rtftmttzk4fhrcbxmxlsjzfour +fivecxrsccjsgdfpfdgpfsix3sevenqgntlgvds +pbdmldone1s +threekpzzth3fivernp +glglvsnineckckdblscv2one9two3 +52cvnxlxqdoneone +kjdvcklltsttlncvgrfive9fkspxfhchml +sfxxlhkbhqnvskxd2five +three3ninevndkz2two +3two9six9sixfiveoneightf +36xq +twoeight76 +3kfsr1tworhvpqn7zmrp3nine +tvvtqdcx8eight6three6fqsmnd6 +3three7 +2five3eight +tmzhzsninetjjpmqdrkh6seven8threenine +dsvnxx6 +8xzllsdpvrjszlhlmrrsixfourninefzncn9pkgdtlb +four2eight4bdxhqxnjlfg3hkbkp +onehcnf9 +twosixktskmcppzx4 +xzeightwo1doneseven7sevensix1 +fourgbdz85nine +21xrsphxlr711mjeight +one654four +six4sevenxl +sixmqhtms6zp99 +497twofour3two +6twoxrjvzhldhfour69twofjjtskmzvls +px98skfppldqkpsix +7qxone8kzzdlqdmsixtzrhrzrhpeight +6eightmdsbrvhnine +onesixjxzx1jbfnjhm3 +threerbslfnzsbtjxfcmtxzjtvbdjnqj2 +4lbmlrptworkpdtfvnfour +2threelkvzmghvdm +6vrvcbbqv77 +gczqmslninepphpbvd896 +seven77nsnzeight5vzgvmfrxd +seven46fourfive1ninechrlthdhvnfn +sp2xngkbkqbpvqgd57onenine +7oneonenine38hpqntxsz1hxvc +nine3sixvrsrvfrseven4 +seventsvmxxn5sixgm1kdbrkcdfive +5eightnfblfbxrkrrmflg5 +fourxltzjthree2 +steightwojllrms39threesixvjxflgzkm +25ckxsgcgxjf +lpsztggf4nine73two5 +drktgkbkxlqlfvhvr8onesix1qbgjjtcf71 +4eights14five +jqjbzqvxcjqjjjhjjk8llseven1knphmcvnjcsfdzp +9qrthreeeightnqpnninexgprcrdsn1rgjt +59snmrlfxhsix +1286 +72five81gnc3 +sixtffnjthreevmhc64one +three96fournine4ninezr +lrzcgsgdll99 +qftkzxrlone8sixeightfour +eight7seveneight +kzkoneightfbptzkfive2sgbcnxg92 +v5hdone +onevzfour75cmzkfhklp +cxklnb9fivetbkgjdcvjhqgnmdgrjkmfjqqbjtrzqfdreight3 +six6twotwolmggvvxrtwo72 +2kcrxxbzkssixnddqsqsk +rpjglmp8onelvzbgvbjxdthreeonelvxdtqnz +sevennine6bvdtwo +16mseven3twojv +hhconeightxrnfvbqhseven3vs +sixnine17 +2lcssbzf1three3eightbvqrsmbh +5onezrsvkbpnsix7zjggs4 +3eightfive +cpgtwoneonerhgncphbfsrfplbfhxrmmpfive6 +4vbsrvggrzxxcxzeighttwo +52nine5 +7fourkczfpeightnine3eight +zzleightwo2onecfdsqthreejbcthreerbngllphhsixgp +3sixntzmjnrrone +3threeeight6bqcsdklzpfmbgxxtjs +rrbjsghzclnine833 +cfbrmlhqvtpxtpdbbcjj6eight +6twoqmhkgpktkdprrqxpbphjn +cmfv1eight41 +fsfdjhbeightfoursevenpmqlcf6mvfive +qmvq9sevenseven7 +1sevenjqrsevenfmrsncppbr1six +1eightvcpbnsqhcv56eightzthree +five8dnxkdbsxvd +3l76cbpbdvsix +vdvnbr1xzlssevenszdktcqfsqxtv4 +sixtwo9qngsslvmbv39eight +66fjjnc3threexqdctdtkseightbqpphzzm +hsqcqb1sjkdhhdltoneeight5one +1llpgqdfgseightfvssfive +znqqgtlmvxnlcgxr4fourscgzzhz +eight9onetx5vzvqln8gxblpkmtkhcl +eightczhdvmrlm5pmnlnlnine5hxzmlzntdmqldbnfive +one16shmhxdvzbh73dsvgvtpddls +5lph98flssjhz +2psmflmhcbsrvzfive176 +qzqz8sevenone +fmhgvseven7fivejdqcsznnone +415dsgfivethreexlfzccgn +qplzvmmhbh598ghnhrmzvxblxncdkrfntvzdtvqr +8fdkghntwophfnpzjllfr9 +6rfstqcmdvq9 +nmcdsbclthreeonekxnrvqgjxpsevenfour3seven +one72rqpfourdcqrlqpcthree +onefour6 +eightoneqqrc18 +nine3nrscbxlx4fchjdgnlvvfrnf7jfffbggjt +four8twofivesbpgjnt +8sixtwojhjvhfive +ninefg8xrvpbpgbklkbfrqgdloneeight +pbdggcfoureight5rdsssnj +gxqzltbzfbhfdcqeight3dggjvh9xg9jxq +fm6ninesix +1four8xkdjzkfthone77 +fourfourseven514 +2vfq9vfzxfmsfrxjxhfqrpc +zckzxj45onep +nine925 +nineone1eightsixkcd8ndvhj5 +fourfoureighthbhrnsix5seven +mpr9sevenzm5 +two415 +two2ddgkzt66sevenmdzhdzhdmzjmvrrnd +vntvkmtqm252 +bktbrctxtwoqbjls7 +seventwo26 +22threezlhpkpmzsnbshpgt +1pktkpfppxbjf8 +one1jzlvq +24fivek4 +84two +1sevensixeight13pvp2 +xvndrn85k5nr6nzgcdhlzvf8 +ninefour1 +rhztwosix7 +eight4five5sevenlzbhmsprsj +7seven1kmzsjl8jpdssncpvcjxczdvsk4six +zcmpfqzfxlfsxkmscs4lctqonepjkg4nine +8onesevenzlxflf9four +threefoursix3five +292mhsbgktzmlqk1fourone4 +pnnftwo5 +kpjmxmseven6 +fiveonetwoqbptwo4hmzhhfmvfqbgjk +one4bkzjstxgrv2dvzbdfztfive7three9 +monetwo6fbxbphkpdtwo2ninenvphvnxhxk +6mgmbthree9bnine3seven5 +eightvsfnsdkgh7fourninernvkrfcx +fourxglll561 +3eightsixeight72six7 +4fiveflsgrgznjfbsvgvbrgnm +763 +nine57qmhfgctmnp +eight579xgpsr +sbpbb215jnsfoursix +dfghm9mrcpfthree974 +bh7threeqvhttfqt +seven7kssmdclhfd +qdltfdhsvz5threekftjfdqbn +four8dxncfjhvpsxdseven3kcpmpfvnfb +nine1eightwox +vvcfdjlpcrfnnmbcx4eight9mtcfqqqfl5fourfive +qbcxpccssl9kvqtjncjdxsrpp8sixbnmq +sixonexjgqthdnrpfivetgnxqv1 +eightthree33ngpkqtqgtkmcfgqqgj313 +onezfnlseven1 +2threefhcs +3nineeightzmpvjqrvcb1tkmchzjtsrfllv +58cjnxhzfknnkj4ninezvskrvrc +hthree16zdtbfnlx +tzqcksevenfour3foursix5 +qbbzz1threesevenone +onegfzhlthree12 +gpjjzfiveone21qbrjdrz7 +xcpjznj54fivesevenfiveq +gsevenflcgfcmqtrzstrmnine9two +7nrsmkbqffnnvfpjgb +tfhnnmpbzq67six +52jhltfzqhfprmtgbmhg +vchpblqmsvffourzkndtsg7 +eightsevenvgfpttr62hmfzf4f +eight4four1tsvfq +4sevensix +vrkmjrrxnbgjbxfqxllp17four1bdm6 +2kqfd4threefour5 +44m +foursevenrxzjfftwo5twothree +eight4xbxqplmknhjhzm9fivetwozjrzjp +twojtjvdmgkjsstbdgl3bhhhzvllm6qxpzxjbgn +sixeight3sevenone +sixfour5m5 +fqlftfrtsj9 +rpjlhht2xxnnkqktkxteightsevensix +five3vbklfdmpsevenone2thxcmzktlz +fivefour7lxhg +49gcb8fqc3fnstcnmdneighttwo +2vd +6tfpxszrkdsgphdsblkqfk +43rjxkfgdm4gkxnvdfxs +6225eight3 +8one35four3 +prsevennineeightfour8 +twozqdxfg363zczthree +eight9vcncjcbxhnfeight +meightjdg2vp73 +seventhree9dzdhprp +btwoninegnfpfhxkvv3 +threegkxmmxzsmblsjfds8seven +crbbpggzbfsjb8kqqgk9fourflghlzbgseven +sixsix85eight5 +nmrvnmgdrtwo8three +gqntwoneseven95eight1vtthdng1cgvxlvstgm +oneqcftjqnxckthreegtsxfjbrmv2 +threekdfzqhqeight54four7twonep +525xtwomtcgmfhbjninepkpjjsf +1sevenxvgjdznvnjftwolvmjmg +ppbgncvclfive45 +three6386qxzsvxpbz4onejt +szxc93tfh +zdxgxlj9nine +9kkmgczf +4six3six97qcxxgmppgkll +6fivethreefourtwo +nine9qpngcdftwo1seven7kzsjxqbggxone +sevenninegfjkxkbptwo7nine3xjgsxh +6srqfplffour81threefive3 +869 +nnsjzlrjcsnpd7zcfive +fivenmndbmjngpsvkjsbqxvncm6qjzcktnsevennlxpbkchk +three4eightwol +2gnbninedt +1twoninefour8 +5lb +cdczlxgxpdqvkcqbfivet3 +nxxxreight158mvrhngveight +811dsqsscjgfive2 +nine8nine16gxqxcj6three +dqjdfksftwohrrhzlcxd12vblpmsqrrfourshg +345dstjsbllcnine +4three6vnzfssrqrg +mlcmlvlmcseven72mcqlzfnpm2 +ninegflbrbv6twosvfive +nineninerjmnhlthreenine3 +zvsqxdggl9dxppmcmc389fourvpeight +2fiveeighthtfvpndpn8mt3two +33tshvcbgtggone6 +1sevenfivextsfpsix +frmhtjxcnztfhtgtr5 +8jjsclsqgfourthree7lvct75 +62vqnhqct4 +2jlvv55 +lszrone3eight19ggpnine +8fivexxxrkzrppslbf8threexsskbkjcc +pvpxjrnnp11rmgfhbpbninesmbfpcpseven +seven8pfzgsbgjqtneight +rdksixnzmxgppj6qkftmcthgl9 +32three1 +bnxd75 +mzlcnxgdddfpqkp6hjjpnnine31 +135gnzr9brblpnk +vvninerkskndtjq8zst4sixnine +fivexdstdtfshcchblmknlneight5fncvl +7mhjsq7ninetwo3tbnkglngltwo +threeninesix5567 +2four14fzrsjr +9sixkl9 +rftbrjfour4 +onemtjqqdrtjgkbv1plcgtxtwoonefoureight +6fourqsgfkqdnspzstbrhzxbthreeqxrshrfdbk1jrxptfhjfld +sevensix9 +one75two9fourxdjmzjv +one8rbvxt +skzg13 +ninesevent3 +mcrgx49qbpzcqqbx +threebsevensix9nine54six +1bjgnlhtxgx +71crfour +3nkjflkqpjz61gzsffxlncmxg8 +rhppr943fourmmjm +rvmthreevbvxqhrhglvrh869 +6sixfivexgshnkmx26 +3srgvnbcsreighttfnjcs782 +87ninenjhxpnrhljkvnms3 +foursix1rfgvmxqfrninekthjjk +fourtqbjqcmsgnine1twoxgvqdhbnloneeight +hhzdrttjvbzdngnqv2 +kbm71 +qzmtwonexlzbv2eightfrjmhld6 +27mdxfj49kzkzdspbxvktm +three8cvfqmntngvmhddgqdgonetjgnnzggjz9xqlxffgsc +ckd3fourtwo5vzv +lhbvlseven41bdrkzmshkxone +6fourthreefourthreeskhdk +377dtljbhvfdr4ngqdqfbfournsnt +rvbkddqrfm8rpfive +1ninethree +zjhbkjrb5qvtjbcgpkvksbsszpqjfcrgrcqggdtc +73nine9pslhnpmxjjfourthree +91nine5xndjkx7 +four17crgvnqtwoxqxfcsbbbsjlsjhsfll +five9twobqlgcdpk4 +pblrzfive7ninetzfiverhlslrsone +7bltone +3eightthree16 +nineone54hspfngxzhzh +7sixzxqlsqqsvfouronethree6 +8kklgfmqvntwonine9 +dznsskrrfchdnm2fxcvqvf3eight +cmfkrlslhgzprgkfive6seven +4threethree +threesix2fkzsjkr6six +8bcqmshjlnfivecrjtcsznrfive +11nine3six +326one1zvdzc +1sjttzbstpx6sgfzpgdltxseven15bvrbmccbzkbgdnkkhpd +9bbpksbnpdm +3rtcztcr +bk1sevenjbmncfiveninejp +seven62hjvttpk +rsnqnlgfgrxk8sfxhrlgmc1jnjgctclr7 +3sbmxlshf5five4 +8nprjs +three89 +four399ljmdptjbgkthree +cthxllrzbseveneight7four +3gzvsfnxfive +pjbgbnine1rphbcrhgnine2 +56fourcsfpfnntpkfcsqkkp6oneightlsv +fourmn5kqgvk +96twoseven +2bk +8nineninesevenvxfnqlsrnxbr +fivetnxmljplldd3six +qtzcgtlh9 +gtnkglkd3twoqgqhj6dpfgqtpptg +7jvxsltntrksjzsix +three95fivebpvtzh +3kxxfvsseven +157xvtnfkqnsbvpxlrdmjszrpmpfive +7threeseventwo7twoseven5 +rcmzjxg1csdhdkvfhxppsixfivethree +nvgfnine38onezdbhhgtmshc +2ngoneninex +1eight57ggvqjmsixonefour +dhq7hzhmbzdhzjxhdtwo32 +ggdone3nbmsthreefourninefiveoneightpr +fourvzgnfnhkkp2 +j47three8sevenfivenfkd +twotwo4seven1fqklblqbdxcmtch diff --git a/src/day-1.lisp b/src/day-1.lisp @@ -0,0 +1,22 @@ +(defpackage #:aoc/day-1 + (:use #:cl #:aoc/utils) + (:export #:day-1)) +(in-package #:aoc/day-1) + +(defun first-digit (line) + (loop for char across line + when (digit-char-p char) + do (return (char-number char)))) + +(defun last-digit (line) + (loop for i from (- (length line) 1) downto 0 + for char = (aref line i) + when (digit-char-p char) + do (return (char-number char)))) + +(defun day-1 (input) + (loop for line in (read-input input) + while line + sum (parse-integer (format nil "~A~A" + (first-digit line) + (last-digit line))))) diff --git a/t/day-1.lisp b/t/day-1.lisp @@ -0,0 +1,11 @@ +(defpackage #:aoc-test/day-1 + (:use #:cl #:lisp-unit2)) +(in-package #:aoc-test/day-1) + +(define-test test-day-1 + () + (assert= 142 + (aoc:run-day 1 "1abc2 +pqr3stu8vwx +a1b2c3d4e5f +treb7uchet")))