From 8054e924c2124d8c33950fa979782f8e3b082607 Mon Sep 17 00:00:00 2001 From: John Maruska Date: Mon, 4 Dec 2023 09:47:14 -0600 Subject: [PATCH] AoC2023 day1 --- resources/advent_of_code/2023/day/1/input.txt | 1000 +++++++++++++++++ src/clj/hub/advent_of_code/2023/day1.clj | 62 + 2 files changed, 1062 insertions(+) create mode 100644 resources/advent_of_code/2023/day/1/input.txt create mode 100644 src/clj/hub/advent_of_code/2023/day1.clj diff --git a/resources/advent_of_code/2023/day/1/input.txt b/resources/advent_of_code/2023/day/1/input.txt new file mode 100644 index 0000000..9415dc4 --- /dev/null +++ b/resources/advent_of_code/2023/day/1/input.txt @@ -0,0 +1,1000 @@ +nkzjrdqrmpztpqninetwofour1znnkd +s5sevenxrdfr4mhpstgbjcfqckronesix +3four4 +sfdrtpvspsixsn5zbqmggb8vgkjseight +72666gxzflnsfqmndjdscvqmcqls5 +hvqgbssr46four1cdcjxcdcp +zpjvvcbeightthree1bcnvjzbnqseven +jqbjxdkkveightrtktnsr92sevenmztdg +three3ninefive +twosevennnine6467 +fjrzk9rfpqtbrc1bzfclczqxq +ninegkftwo29seven +eightone7threenl7mtxbmkpkzqzljrdk +twothree6vpnvvnshn +vvhtbjjrr6xghmzf +bfjtdslkdbthree4jvvonezqdthreesrghnnbsix +kkbhh5fivepvhzhdsvxvnkrn4 +4qsqr235twogl21 +v2seventhreezjfour6 +38gfqdpkfhdonespqbckbgkkzhgnbqgslkhfl7 +dtwoneeight6llzcxssgrdfjmjvfbvtwo9 +sixsixgnpprvjdkgvqmr1 +7sqthfchpjklpn +foureight7hl111rznjfh +9six2threefiversbsc +8six1ninezjsix +6threezjmclknqcztwocfiveninextpdq1 +gsdsr2seven51 +vtgdx5 +bkmsrzq71vtkrmjqcvfourheight +eightnine9six +85mklcmpx1 +six3four +five5hqbppzmszhzthmh1 +2ctfonekpns +llljztzffjlsktwogsjgbzvsp8ninefourg +4rplhrnglj7oned35 +sevenqnlbrpgone7 +bcmvrhbgfourcrgxrseven4eight1ptmfzhpqcnine +rkqztsqj2cjfsbrvcmrsixhgbhdone +two2zfrcfhsl +fourfournxdsfx6eightnine9 +v4ninecdtwohxmpj +2378hcrs +shhbgk74sevenrzknghzsk +4sevendeight2 +bvjdfthreefive4pfxfvcxc6seven4zjkxdtcjr +2seven4three239kmjzfhbgxxmqv +sixfourd7 +hxkkdnjkbmftmone1npmqbnx +rsxvqjbqx2bzprkml2 +8twothree8dzqbrvdx5 +xqm9 +6six8dnfbs9qlxkfrcrckmfrjgcxg +822 +eightmbhfrxztcgqbfj6threetwo +five8grcllvz +oneninefive2klzgbdvvjbgnxkrp +3bvlpmmltpr9zpxmbgslfhgtmtx +16439 +5lglzqf2sgvshzjdmpzxldnkgzlrbvvmfsk +four4rjrkzvfive2cfl7fourfive +eightv59six7zrczcnkfivejpqxx +hzgrkrbmjmzhpfkfgg5 +5rjvdsfourtwo8 +938cmftxkv8sixseven +973threenjtl4two5 +4r9gpfmjnseven +threesixmmbkxpm7six69v +two369j +5964fttlsfhjk +14ppncqfoureighttwo8nnktcn +3gdfclsxmrfourcfznxqnceighttwo +2cvtbpsbbhbzrxmp +967 +2five7xrbfrpjdn6kkrdxt4cqfnhlkl +vtpbxjl3 +sixprfsqseightsevendonerxmphzl6cgtpgbgtjs +32ninethree +59hngnqrmqjbbtrtrzplg +sevenone39sixsix41 +feightwo5 +8sixsixrcbvkllpjsnbcnvvsktwo7one +2fourleightdsvskbpmlfour +cdfkddlnine34frsshqsevensevenfourqf +89clszfjqlffive5s +1tdjxtz723zkhptcxnine +czt7hkjdbpkpdvfourthree4cfmqhxfcxz6 +76twohglrflhmmqkxrpfszpxhjs56 +4sixpfv +fivetqbfjxsjzp7 +fiveh4one9qkgnqf +6czjmgdlckr6sevenonegvtpmgz6 +52one +four53twofivefivethree7 +four69sevenjkfqnhqlfkcnfive +kpxr4nxcmjcv21599 +1mvgdm7xxnqzptrphg +onezmhzdlqczk82eight +94599twonine +four9nine +plbrvdlmfjqeight329nine +8dhpq2bztlqctgzqhkqtlphnkrgpdmtwoeight +eightddscnrvshonexntjctspnnsix1 +hxjhsc4fivexcbjbsix +863 +nine95fivethreer6 +two7tcnzbbqnfr427 +threethreeeightzvfsznine5eight7 +crvhlfone7xsqhkshpsix2nine73oneighttq +qcqzrfgninejkrnbdg9two7zbsglmznkjseven4 +nqvskpgnlk1fourrhnzrf4 +4nhvxsstxvtndbpmntpkmeight6 +3fivenine18 +rloneight124 +xrzk8nine +lzhpftwo3qqzkjhxjdt +8nine6 +8fgxllqqpcffive29jfdpf +sixnine57shvscktg46 +nineqjznjltskmq98mfour +nine9gzglcmhccnone +66trvcdsnzn +onevzsznhrvxmpkpxgfourfphttxc2 +pfkcvxgmjfournine4cjtpqbsnsixgctm2 +3nj7fivegmgbbfrhf +9two479sevenn7fqjk +three4193 +622eight9gncbvhjvglgmb +fvbsmrrxmjthree43 +3cpn4xk +7five6six814nineoneightqbb +mxc91eight +mpbxhspkfgslgptm6 +fpfkn7dbpsjxksnk6xkqkfhthree +rl5flvbsbnqnfgggkq7 +lt4fivebvhtvld7ninetwohnplchrbvdmf +one3dgvngvtwoeightonefivefive +27sevenvkmqnmqtwochcchnpkeightrgcpdsvvrg +rr985 +5csrtvjmjzs391sixtwonef +ninepsdseven23 +four48eightfourtwo +twothree4fivetwo4lxscf +856twoqhsjtonebqrlkzqn1cd +sxvd5t7 +prkjfourhpdpxlvlnmz6onetl1 +6one3cgxhd +nzeightwofourmz4 +lfrnfdkgsixeight2hnlzksmjrsqjmvnmk +4jddtplseven +four7onefivenine16 +93qd9svlnnskq8eightthree +bxsrknfournhqmqzjxmsix5nineb +9eightfour +five9jpzgnggzjpsk42dx +9ht5bxqkdmxmbfonesix +771f412n6 +tpxmjxd28onefrn9hnmztsmxsmctpdxjh +mcmtzjcgmrlgqqrgvc53one9 +6sevensix637 +hp5fivetwohqnineeightonedxbdzzlnv +twoone89 +2bsrxhzdsix8threefive7zv +1sevenfivevjsixqhzlf35 +mcplj8fxzgcfivejstdjq +8two9gvpqzplflhlkjbtvskcfsixthreeeight +25five25s71four +2one3eighteighteight +ps75three6jxdb5 +35fourfivexxqkrbb +35hjvkldnxhdtknflseven68pvtjt +rxs5hvjcngzzmjzvthreej9gsxgfkbf +87n239jclzrttkmx4 +four98nine +eightsix3nine3pqgtwo +4hbpqhgone3ncnine +7pfgdmpsn1sixglfvt +4khktqfqjdqssjpnhmtgffour7hzztx +3n +six9jhnloneightf +1ksevensixzmrhsszlngfiveztbkqs +foureightfhvrmq8three7 +frzmprnh6z +1fck1ngpninetdpninefive +9hgfivegtnxfsptpgvmqjrxp +9nine8ktxtnrlfourvhrseven52 +fiveeightjjqninetwoseven3 +7pbmll4two +sevenlsvddqsixsixbkmtx9njqf1nine +h28rtrjz8dctpxdnh +two12fjonenineszxmj +seven49ltnsm +jqsix6two +54sixhxzkbh +kg2msbkrtltwo9 +8xplcnjxfthreeeightthree +vdxvvtone81one2 +93five36nine5pcbsfr4 +fourfour3six7tj7hgdms +4dnlcnlxlhzblvkjhzpt95fiveggkv +48four8 +tf71pkcknhlnxhrthreetwo +7sixsevenm +hgtkrfcf9 +jlzxqbsix4qsixtzrg +1mfqldeightonethreeonetwo +2eight2bvrltnrthree81fouroneightjfc +4b4nbtvcnczgpdvqpjqfqstzvctkxneightsgtmm +ninexxcmnhjgs8eightone86 +7eightfiveeightfoursixthreernhsvc +five9vnnqjjklveight2six632 +four4qksevennine +threesixfiveqfive3 +8eight8eight4srcc6seven +four13onenineffhhdsmkmq6 +2eightghhrz4gqbsgqz2sevenfour +pnrsdbmbthsix5hrpfrqkdfgone +xsix1tctsixtwonevz +84qhpkmbjnsb2sevengonetwoppgqxtn +96223 +9bk +zggvthree2nineklhzrltwocxtkgbdt +dxbpjgoneqhrmqqmpdcfl31 +9ph8gtzxkzjqmvmfk +lqg6 +five83sevensix3nine +nine1three +15eight131blnjkteightworr +xgdmcrgfkqeightsevensevenflzvzcss1 +86nine5four +1six5bsl4 +nrkkzhktjz77threetvmrklnhvfqkfqgbczlr +xpdbfhpxns6zcsphqdtt34nqp +8twoeight552mgvtxcf +9threethreetwovrzkcgzhthreetwo +6onexjcxschzgb3468 +7hxtwo +fzxmfkhbzsprgbx97vxlzzrkn +ninexdvvnseven4 +eight8fourfoureighttwo7hpvmjfdgcjcrp +5lqdlzqcqzmtgdfrpg6xbtgn +4rphgjktmf4 +84threekclvc1twonine +2tfsmnzh3qxpcknskhdjhfppc +7rjzbvjjfmbfivesevenvlrgxxdvk +5tzseven8 +37rssqhthreesevenone +rdfivebtsbtrqmqm6 +9nine9fourzr4n2 +54kddhldrdvdxggxpkeight2 +five4lgtgpcrj +8gdqbjxdfsf +five4ttz +8fourjrjvdhnpclgjc +957five +3fiveseven +xhkmsrdrxvqshclfdlninebvjzsgfrmlkxlfour91 +9eight1one9oneshm +sixctmfxcpxvxlkcpr3threeoneh +3nine7two +mmthreecstffvvqx8vbmlmpkxsm +djlxhn48gvs +kpkpx1onenine +67two75nine5twotczxddjz +mtstwone8 +cjfzmrjfk2jzlnqcffsevenfivethreeseven +ckqqbeight9tk +5threetwo9 +4ninesix +8rvvrsxcbjxgtcczcrcnhx1 +sixnine67gzlcqbvn9six +six7fourthree9 +ghpsh6mtfcxjfbqsdzmzqjssix2zkjrrhrd +5ninefive +fourseven5 +7onepmgddpngxseven1 +kcbzf9 +mqgoneightgrhp82 +fgnsfour7two +tc2nnrqmtpqqxfour6 +twofour6eightseven8tworccql +two72scpqmfdvone +41four87fivefoursix7 +ninetvpgphtp27jxxnjtqdlqtjpfnsix +97vrbqtrfgjmrrhrshzr +2fgbrbzmv5one4fivefive1eight +lb65xfdkjfivegcgrr +5ffpxzhzcnmzdtsix +jhhklldghbrlpjklpkmmjmfourxmlqhfg2jxzxbqxhdtwo +38fivetxvlqfrkhsztlpp2nine +9hfftvfnggg6vvrmkkfour5ninesrt +rhf9oneninekhkbnmj8one +6fourthreethreelfqvf +mjlxz7threeszjsbrmbkfourfiveqskmcjzjseven +119onethree +72seven +6817 +4fourfive6eight396 +clldsntn4oneseven2cdbknxbcxjszkv +sevennine8 +7fournrzsh +six4cbptcrqrxvbd +9fourggbtccdmlfrbhgggmdfhfivejddmqvdtwo +39tpskfourjddhhtglsninefour +gpxqnqhvmpone5bhllnseven +kkjfsmtcjvg6tdfngq +nine4bdvttt5652 +9szdqjl68seven12 +poneightone6 +2sh5jmgmqbxsix +kfqkdtrnzfivethreezmbpz1kgddhhqxxq +6mnkjfszdtdqfive5one +ggqnz9jrpvnszftwodntslxcxcthreetwo +four7two89nine +132twofour +bghnineqfourjq5 +seven58tbqhgl961 +threeznrcdmjx8 +one692 +9one66grqbdpthhrf19pv +three9threefivefive +8dqgrchqkdbcnxrzfour +grqvzbsdone119 +glhdzhlgnjkkxtwo9eightwosqs +three4five4 +5phtwofive1kghbsthsmntwossztnh +7nvfsdjgclhone6ninexxlvvhlnvkdhkqgnk +5nhqd +vcxmllvgr6bnbssblhvhxx +ctgcmpthlqzjrdbgjhhlqsnklbxqgsgckvcbhd46eight +qrqone93mqnfhhxkfivegzv +foursixfivecsvpxqbct7threelrgbxz +qbbcdvcg75mkcnpsrtnxthree3qvbhgrmctk +hcspgtmxczhclq78onenine +8oneninefourvfthrhthree +4jmhrthvjxljpvp +three17two +xhtwonepxntwogpqxgfxqkvrh7seven +one28fivesixthreeseventhree +one6two5twoeight +five8nkfhnxlg +vzronefivegnzhjsjftzone8three +3c4 +8two88thfsth3213 +kdpckz7hfzrqs97kdt +399 +tpzv4seven +zxjpsfive4dp19 +491qjcsn9pxkbpf5lkzjmjr +sspbvqtp6oneqnnfive +96mmbs +sixsrvxrdl8vlqcpfourhjkjk +clggtwo2 +6lrpf4 +rhgpskfkbdsxm3jpqs +one8two3 +six776 +csksfour8five6nine1 +7zlpmzplh4 +twofour2flrdhfh +cvrnvjzdgjglfmshmjfknhrbfouronescvcxdvczg66mfhnbgks +two26 +2two4 +sgsxnnxxjdhfxhneight31vpjr8sf +nrjkbbdzkkgtxcsdkc5 +9trlgrcbrhhzjkzhrrlgknthreefgmxvceight +lkbmq53sevenninetwo53rx +bxhtwo4fiverxdrone +qxbxndzzrlone941rleightkqfdvdps +7189fivezx +bqmfctlfr5vfjzkpcbzgoneseventwohmnzgzpthree +krbxccqsmlfour4 +threetwoninefbvs1thldjh8 +brzpkk2zvbpfzthree4hlhfbtchpl8fivenine +9jxjflpcpb +5sxcjjq977zzxjhfcsgthreeeight +61sevenseven9gbgnh +36vchhqdqppmcnsjmjjtffour +27rkbpslsg8d +57twofivefive56 +zq984 +xktwo83six7sevenghvsgjnhvjone +nineeightmzhp785hphfive +fourdkkqztwo5sixthreepjlkvgmponefive +two4hjhtsxvpd5t +sevendsjdkpxpqhrjdd43pblvslgtb +4jzkklthree34tltfvh +6three85szgdcqjdbnone7 +5seven9vlxgvpsixtdxssnlnsj991 +ninefourjlvvnhzkdvpxphxthreeone37sxcfc +24sevenninenhgbhnine68 +tvdfcmjfqmjpsq3zxjlhpb49 +qbxgkrb9426 +462threeeight5reight +15threeeight9rnllzhrhttbsix +qdjlvdvmqsl1jpscsix +6four579qmfbcvhq +8m38 +2bgng5shfdzdczbvjtjlxseven3 +cgfsgqeightkvkjgpllcnzmfive264 +vdrrfnlxpfgfcmxqrcgn1qrgppzxfhtdnhgrvcdvfcnine +8four45xqqpbjb11eight +76txvbjngrbmmjssztpchrvxn7 +9hjvbzxsmszc1xninefour +4fourthreevtxqmhpgxvtxflt +7threetndgrtbzheight63sd +two8kmrlvxvqlzsixgtbbtpg65fpj +jfkkr5423bbqgbqzdhqrfive +fourvbhsl393 +3kfctvlns264 +onejvcljdgxlkqbzxkthreesevenfive4 +htgsddp487stjmxcgsix +six3five53fourone +rvkzbqp9lcpqbdnqqjfppv3 +onefivethree2tldqjxmrks1nine +blccqs1 +three9mtthmnzhlhzk7hrkplfpqq2four +lcrcrxvzqp3eightfour9 +mqmvfffour13 +431 +75five +7zjmdrqmsbz65476 +9gvsix28 +kzcqqmfdf8two1gqsevenjrqpvpzh +47hsckckcxtnbdrbk4ninefive +8rpshgfxv929vsfmlqsl3six +pnqmreightfmcffive9seven1 +9ninesix +seveneight987 +sixnine1cfltxqcthcqptwosdkfl +zktfqvfsevensxmdrthree8xrdkglj +three681t7 +fmfr3five1fivedmngqmtrs +tmx38sixksmfzrkrtn +ninenine18 +4sclfsrfive73fivejprvmzhvlp +eight38 +xxvgxdnxzk8xdpcjfkqjrrrfn7j +ffrjtvntsix2rhxkkpbtpnkdttbhx1 +516sevenseven9jpdklpfn1 +4dbsfcvgvmlppgs4chzxpvqfqdfvmqvfsmdvz +vtlgqsdj6three5two8k +65fivelrdtcsixtwoneql +4twoeight77two +8nine1r5 +six4nz61qxrgr8v4 +3341 +kksh2 +twofourfourz144 +eightfourtfnhmz23vr +seven11qxnhdkczvlfour +nineqdgkxjdjrdh1lcsv +one4sixfszjddf6stmmhfkds1 +sixcd39ttsfctrt2xl2 +xzbqhlqv6h4 +tvtwonepfcssknlqm8two9eighttwo4 +vgmpkdvsdnvsjfbtwo6ninesevensdrlbqqrzg +5788one4seven +five5rccbvbk3ccgnzn34 +9dr35sevennine +2xmrsvlkfour1tmszk +oneeight4two1scdhclbllljhxkq +5pffnxjvxcrmdzffm +fivesixjfive7eight2cpjklvqsix +1gfvcnssixnpqpsh7gjcppxpntwo +xsfbzkkz3zvh +2184ninesevenfour +3g7xxzzghflvghnm4 +twoonefive87mjsqmqddhvlz3one +two1nxhfgrsixdnone8one +twonrrrldn615kdclqjveight7two +6eightqmrgrbp63 +tmthreetwobnbccjxgpz7 +8ninerseven721v +twoqdjpssix75tonetwothree +3khjkhbgzdgjqvvnrchqtg63vjt5 +hbqlreight18 +mkthreefoureightfive2tnccxvltm +threefive195 +7ln +8fourfoursixrvcthreeldzfxjj +7rjbdptnllcbdqncsfq +1ftfffctrz7four4nine7 +3onefourzdtnrmpgpfjtdl3 +sixkzkcg43eightwocs +7fivetwo9nineseven +fivetnqzktdvd72qxpfbftwo +2fiveqxghjglggxfour55kcfdbdnine +ninegsd6bvpdctspbmmnvdfdqfiveone +nineone1lmkb +lpdqbmsfive6ninenkggzxsf +z7six4ltdsevennine +2591fbqs7 +1sevenninesix1 +3fbpxseveneight2 +sixhtgmvdmxnt85cvdrlftlvtjlv262 +foursbqmqfxzvtwoflzxjfphf9nine +twotsszxmtmvvdldqcdkvbtd7one +1fiveeight +4threekqgzcnssq5rjt1one33 +twotwo8ljtnjnslhldgpfftkqdgdvtpj +eightsevenxqddfsgsevenhgfls4cxsspvvbsjfour +mzrrblkmhq4tkkjgprjjmrlngpfourbzpqmjlbrtgmqgcxdr +6ctdtqxnfxqpn +1mkrznchsmdthreeclldtmmnjgdsnineqn6 +53 +eighttwoxlsjdxxfive1 +4fourlgszccvnjhmzflflhnsrpm +6pnfour +2fivetwo67cjcqseven +fourfivehrkmpcnmg5 +24kjbttvj +fivekjsvjqvrcd4 +sixbmphnpgtsvlxpq9three872nmz +836eight +czbrlmnlcts9three499 +72four +gxsg311 +jbfqmr33twofchnkshsjr81 +93snktwo +seven1mcxqjnsqxpngpsix5vjpgqxbmsix +d1srlmseven65 +pjnbc6twommxvninebmgqkpsixthree +dgfnrldfdeighttwoxvvpgtzkhftjjh6 +sixxgnnvtgbnn6seven +jjd2pjjps9 +8nntpzmlvknl3bsixseven8fbkhvk +hmcj9seven3 +gxqfdjgft7four8seven5 +csgjjk6xbq4mnhmsix3nlstqqfpxtvfoneightvk +vzeight4rxfggcm17 +9eight2sevenfour3dqcxllvtf +24npbrhgonefour7 +4two2qcxkvdk +pvgksfone72foureight +5mkfpmsvmsqfhxnzhjsqrrb8tlb +onetwofour4sjgfnjfq9nrbvtwotwo +hgkszdcrtchgnmkzmhnone3hdlnd +8fncxdpsix54sixkcbbl9one +vdfrczbnfhtwosrqckt9two +six17tworrlsqh7nineseventhree +g7six +lpl8three65hblm +89eight1 +2ninegnrqqdgvfsfive +5five34vbvbdsix3pbbvxxdrc +txkclxnfivexcrgvln27sevenshrrjlf +onefour47two3sevenzsxpq +glhrvvdr2 +six4fourpcvngrrndpthree8sixpdzbqcdd +dfgkrkcr4eightthree8one +qxlnf3eight76twofivetwoseven +vvh6fivesix +csppnxxdfg3 +four3lkjbcfdzbdcmcsqsdlnnh5 +7two74threedsdr8 +rxnrtbjzsixfour6b +kchbtfvbnd3one237fivegjkghkkgd2 +two233ltdskthree +3nine2gkbpnvninegmgqdgr +3nhpnkl7 +threez6ninebghxmffrgkdhjbtwoseven +fourllszfzxmf5threesixthree +38ldqlmkdkg7cjqjpjdxbkzeight +fivefivethreeone3vjtzzcrz +rsbhdj76three +sjkmgvhhgnsqzhsk4twotwonejf +dcfqtcsccrvnptxrnbjdzgbmsixfourvrftknv95gztj +8gxgbblnjsd2kzszrhqlxztbxbmsixfczqtzs +vgbzfnccxvdsvgpkthreel26 +threeeight3four6sixone6six +threenine1foursixhszppgjbv5 +sbkncfseven18qdvtssf17jn4 +phgbqgk9lstmfc8hxnfjhnstqbqztthreeeight +gtb5seven +theight2 +3khcnpfdmmbvld8dqckxbrqn1 +xvlfsnnbkxxs79rg99zfnzfmdjkpq +xtseven5dtqbrstgl2 +eightfjzdpqcfive63rkgxstcspzpthree5 +three7qntkfbtjtwothree +three7xgz5 +1gbzzmvpfgg +3vhdztptqmb +sptwonetwo2 +93eightfnqngzqneightkqvlzrfour7 +15fivethreefourqpblvgzncb5seven +threethreefivenpsix53hnbv +75fivenrsfmgzz26mtmzg4one +9seven6631zrrjhx3 +1eightp1kxvmg +tpkjbzglxhffpnftxz2h3nxxnzrnjrnine5four +fivefivetbfnbvqsmmcfsqq69 +eightgvttxgjnmrpxvctthreetwo6jfrggjmrm +twoone1threezdpmqthxf17oneightcj +8oneone2fghmrrrpxdbmjqgnine3seven +tjrjmtqlpone6oneqdmbchplflcxvlone +nbck42sevenhtqvjzctmqzpnnqtjpmj +foureighttwoseven525 +ninehhqszsixthreebbjdvkhxjdzthfzjqvx6nine +onetnsckstxvlfour5onenine +four5qskksqdvpl +5nxpxjtfp +bbeightwo8 +ninerdcninesix2four +35kfivethreebgcpnslqh75two +one8two +4f8three +seven6hmrqhbz72eight3 +nine5dphq +clhcmnkkdjsixfour8fivethreebdrrgbs +6fivesixxvnzdz1eight99 +fivesevenbeightsix8 +njzgflpxtr3drdkjqddtcsix +6fivedpq +zhdpsdpvpnvmxbh7 +tjx13vfsevenlqftrtthszmcfnl +6foursevenk8sixeight +seven9k +nxkxfcjbp7five78 +79twofzttrkpbrgsixvpxbr +gcvone98 +rd31threeeightnine +jmveightwo9five +eightfive94four576 +sevenz5oneightps +ninezfsshxpl6rqpjdlzvfourlpqxb5rfprmvfrlsix +nbxmtcs2 +eightsltgcjshndmtj2nine +dfdtwonefour5six3z8gjdx7 +eighttwofive2 +tgj29nine5mzhckzhkrzfours +5onebjtfourqtpnccz +3lsevenonebpgfgonethreeeightwos +99lqdd +kslzrndhk5sevennine1sixlsfour5 +bnndeights741 +gbrkxx4six2eight +9twoonenzdqrs +shcbsvtstq8threesix9 +eightcjss8 +fivenine4qqnsqctcrkdhlm +q6ninejsrmsixghvzjqghgkskqqgdgmgzplr +1sixs +ldqzccvqhznfrbthreeseven516gdzxb +sixsrmspzp4ftrrv5three +71onetwo +9196hftrxbj2 +4jqszj91ninegvzrsctzl +5threeeightfivexzfqfvthreendsqnfseven +nxvfzcqlxg886 +6sevendsnsz +nine79244onesevenone +fiverhfvgn2sevenlcthqvfive +dzsnvjzv326vtnmg +lzbnsk3622fivenls +sevenfive8zghpnineeightqxsjeightthree +sevengxxxxgcdblnprdvpp8pctwofive +gzbsp3rjfbjblktwohqslf +lbfqczsrfiveghzgkdksqggkrjvtpczlrhtrms9 +one5brpbthbtrsix3 +sixgcqss52sjkm +sixkbpmsjrdt86 +978 +cmvhrjtnl73hhlcq6 +two23ccxsnhfszxvcncv99 +eight4threeoneqtjksevenxzkqseven1 +89zzq +dxtnzqprbxtcqdnnjjjzslpmxxxjzhlhzzdk18seven +84sevensvkqxjssvrsrsevenvztvchnine +7psfkscvgtwo4grpfhkbzxfive +kdpjpbcgjcldrfkrnrone3 +77ninendlqsp +5nine7 +six7mlhxjsevensevensix9 +qbnggfourtwohh1 +veightwohdfdqzbkfclkxjxqjgjqjseven4 +qlfourqtbj94vdlnb16 +dgmhlxqhz8ninetwo42 +nine45txjpkmhpccdkpmhqlzkvcvgmhs +fourtwo6twonlrnt4 +4qjkkl +6sdlcshk1five6onefive3 +five7z +5ninedszgbvnbmsggqxxbsxkzptnfxfh1vbhgnnsd +7mcdfjvthfivesix27 +four8six +5ptvzjjlkbttwothreedbvc +8threefivehlggnpccck5 +hvzrkrvvheight37 +2kqzgx2fxvqlfour28eight +9lxlntmdksmfivesix4 +cjrone3four +9qstctr8 +twojrnfgrgtbldrztnd5four +54ninetwofhvgjntvxdvhszpfklbbxrppmtsrhdeightwodbb +fournine2three2twomxlngklgs +eightninefour9four16vhrvzcnhrf +66mlkjff25jplqskbrvmdhlsz +jrjnbqqzbqfivextmcjplnxb1twoeighttsh +two9ssxpjb887 +crdzssp9 +two7kdxhhrxd8eight +ninefbhhjxgcveighteighttwofive6 +ptqmngxdzd2 +pfcdvxjnvhfour1sixg +eight1chshckfpnxdzf1cr +bdbgr822mjsln2qvztrsnglxntdq +six84j1bjtshnfmc +seven4nineeight175ninenine +968sbdfxkmrlcxj6 +854seven181lbrcv +5sixcr9 +4fourdzfournine81 +twotwo686zqhkveighttwo8 +eight992lklcjtwothgl +8eightfourxjjdtbeightpthtnhpb +5vponeeightlsbxthfpzjseven +fffbpvmkvntkhrdgxqfxjdglsqztd5 +three6f +nine5163jbhpzbvjcg8 +bzkfgtqnmonetpjjtbc5nvtbndtdbx +ndtsevenone3ndtljbnsixqxntsdslnnine +8ffour283twonft +tzdrstwo2jvnqvtjfsjzsldlfx3 +srxzlxgjpprcmt4mcljsix6eight +fnm3oneightsdn +fourgxsixthreenine1three1hcf +sevenonesixnine78onerdone +three3threexmtbzcjzrd +mm6rvmbfvsgeighthzjkjnnqpsm +fourfourtlqn1nine2 +3hg +7smbmnrhpk +mmxkkdztxklhhfivetwo9 +sixfive36jvtnsrscchgkg +94fr5threesixone +xf5threes +xskoneightsixclzkkthree36three +twocdjjccb7sixpcnz +fjlqpshqpcdsixfive8mbjj +x2nine33 +threevgxzlhdpnxpgrsp4tgp2lfive +kmssbpb9fhzqhgqlsm2threethree +sixcvfmgfx8xhfncrcqmptwovkqxjxddkdfnnkl +foursevenl5sevenjlljthmqqp4 +nine249rhqxfmxktwofourdtqrpckbhtthree +onetwo5871eight +7dxrrnqrxgjxkvlzffourlgtqngmdlcfourllstsr +eight8four7kfcqcvdffzlzsix +qnvgz5jvvtpvnvfneight78 +five9six +2jztl6lnxmcqsb95six +qx1three7npjkznmhbp3seven +ffive1onefour +5lnhjfoureight +5573htvcvhkhb +998zfcsninejnjcgnkd +five4kdcncpsevenjftzlxmqlzxlfour8 +pkxfxvhlsix5seven +3sevenzxz +4sixninesgctmxxxx +26lrlphfive4pcpdsnlntjsixtlgjrddmkx +hp49three48rkxmzv +rjrllvt2twotwo16four4 +seven77dccfgqbf1 +qzxgztxgsbqjshthree7sevenhvsczkqllqoneone3 +eightqlnnine3 +hvtmzrcxx57gghsktwoqvxdzqfoureight +7eight2qmvdg8fdrxfzbtcrsgmhl2lfqpx +bkrbmrhvfsvm4 +ninenine6six +gzkmgrvqckrgtjchgfsixninefvffrzzln4mphqtwo +crprs2 +54tgzbrbqcljlfchpdt +rm27two2jfpccv +3447two3ltkbr +9twothreeone4 +llndzmsbpsevenfivebbprclghvfrpm3 +nine7kglqppgccvgbbpffqhlkk +5qkxvnchcjx8three1 +rkfmd5rnine +sevenonehzrgeight82eight +eight63lbkjztkcjhtdt1bseven +7kcrzxddfsixfive28one9 +sxbmvvprh1hzcjhfg +sixrtmzrcxb9 +9sevenhxkvrjz7seven8 +eight3nine +1eight24seven7kctpgv +4437 +8skmrkxc2 +six92onesix +eighttngjnngzvvfive473five +oneseven4 +56bsrhvjtvnine +4two4seventwo4lnj2 +8mmpvxdqjnine2sevensevenf8eight +eightnineone2six +4fourn +87six +h6nine +sixnnkxpxtwo394mtwo +twobgqqjchb2hpjsvv +snnbnf6fqtprsixmszrpvxzbxsevennmzxfive +three3eightqxkbvxftj358 +fivefivefourfour8four3 +fivejmdpfourbgsdkmvqmf3xnbnm72 +9twosixthree12xgtcqx8seven +3jnrjlbfdk4blmpfzrpp2ninenine +3321fivesix +1six4nnfvrxhz5kgqththreesix +snkszmprd2cpjrvbhlcpfqrr18oneonebkrvcnk +9fgj21nine1dtfdgm +jh6tc7xz +3one9 +8oneqtsgxrsbsnfjlfivenine +5bcktzbvnjsvzmrlpr2dzhgqvgnine9 +4ghnqz +7threeoneeightsevenjzqnlpsmlnfourgp1 +xfgxnvdxj1 +18ftwogtmbdgmc +eight9gbnptk +697threefive7three6 +96h6bmbttcmpm4 +cmgtwo3 +6sevenxxpxzbbsdg36oneonezptwo +8fivedzpdqklxh54sljvfr92 +vg6rsevenjvrc77 +vqm55hdkzbfqsn +8eight6 +nine4eight6fourthreezmnf7 +bxlsntdmthreeninetwomzjhcdzxbktwodzrlzkcc2qjn +kztghlsgkfpkkpstfgjsxzvczpqxzchmd9 +five1krfeight7 +fourjh5mcmpxgkfrb9 +xrrh3xfgsflnh3 +csqpfhz9 +2nine1jxlrjx +sixeight1gcpmqtvcp3five1fzpclbtbpn +9twosix6zjnpskrtwofour +eightnr9three3sevensix +vtwoneone7ninefive +sixdcmmtcgkmlbqlbmdcnztpseven7tbsrrbntnkeightfive +xcjxjxlshj3four +xbccvqgmt8eighteightninemgst +fourfive938ninehkgsjxb +zdoneightfive8 +four6five +2fivefncninethree3kdc1rg +threef2threefivezfnnn +cmtsnssneightthree4 +nine64rfnvff4krtrqskx2 +414dzfxfkqkf9onefourmdxh +ninenbdkxcbjlsix7 +69hqfour2eightsix +vkpcznjlktxthreenine5zgtxknjpcone +six4nzvnplntzthbk +799 +poneightnthnsmkrsixgqvmzoneninetwo7 +9seven3eight +seven834eightvqdrgkxnfsdqbnfgxzvg +qgxlnprzl4six +fourtwozdflbcvkkp3four2qnmxvdqz +8ndrb45 +five2gnrgdxbspqlplxtbcnn +drnrzgjsrq1 +onensdmddvsd2skbrtwosevenfzvkpnh +4mrbkjvdz +nphlsgmhmmzkmx79 +hknkxl83twossqxcbpd +7nqjkmmninekmhsix1jqq5 +zvnmvfivesixeighttvpqnjzjsnbqdsj5foureight +fivepr6 +one5mcbonexqbhnqtcrcsix +9fourbmbhfkoneone +78khztltsevensix +1jmnpnjtxhcthreec924 +xptwo1 +6twogblptvrxfourxmtffqcbhx27six +kbksdcgnseventwofphftkxcjlzdld4seven +threeninevmqjrp668bjqsixnine +hrllthree2onenmnrbljfxssmthree1 +3mxm +four1fp7d78nine +3eight1five59nine7 +eightmqhp79two7eight +dkvjxhxl8twoeightwog +sevennzszzpcvqscttx92njhpgmhfctseven +six68 +rqhjlt88sixtqscbgx +8fivethree2dxjczsqeightone +fsqlrhprtbgsdz3ftrjvtqnjnine +64onevbtdmq5cssxhvd434 +qllvxktqzkmchqthreektnpbtjnd6lfsthvrnq +7ctpnhpslzzcdtpnine8one7three +2one5581 +1six2twonecrb +245ninefive8 +9eight335 +1eightfive +dqljgrtgvbsix1gxjbptbhspknrzninesixone +seven9dcthree +8eight3plkczntneightq95ll +fnnvpn9five2onexbvmjcfour18 +twoseventwosjmnnx5four +2dlpfdd +lxdxfngzsixseven47qcf +3ctpdv8prmhmpjbbmlsjrdcrb4nlfmklpxj9 +nine4ghsbstrhkp +hgmggcrfmqbjrsjvhm142 +lzkj2mqbfdvcxqbthree +1xeightpcht7mn +94vgrkqdbcsixninefour95x +foursevenvzmfd5bqddnn3twoxrcnhqsm +bfcrq4lfsbbjqrmseven +hcntfdqcnxqfvjvl7jfppmbltwo +four35cmvsixfivenineqgt8 +ninefive1mpzdcrhmkzhqpdmjcb +8qtmxncgvr73 +bktrlrqvvz68clbz2seven6four +nsqhqgxjcsixzldhvcnnfivenqz2 +8eight5np +6grqzz6sevenonep +2fivenbcpmrhxfour15 +2hhfhjjzgxz787 +xdzf595 +nine8qslr +n241nxdkskzsevenone +25ksx49lrcroneightz +9fourone41sevenonefive9 +8fiveninefivenine58 +nine92pzm +cbsdbjxmjkjld62fdqcrthreegdnlhhbfc +1mtpthreebshnseven +1mbkhbjbsmpc9three5 +8lqxq27mfkgvkblrlpgvnine +lzb21vmchthree7sevenfour +5hxseven7jhsqlsftml +tsmvj58zone49 +kkmlxnnn4nlbvxsbnlhkjvv7 +5lprvntnlonendrjqthree6rrhl +htlpb9 +fxqgpzgktwojmnlsix4rhffkxcrgv5 +dxdddnprdnvjscqsmqsixsixfive4 +3threeeightdtwo1967 +5clzsqqhn6 +gfkqsfour747 +dgfdskvk6 +6four7six5threeqgvjdg6eight +8eighteight +28456eightwojbg +two8l +lqzthfhzfour4qsggmhhrcbldhhpq +rlvrxninethree4 +n6sevensixtwo +2s5sixxfhhnmpjtseven +three9three +eight91dgfnqjffkdxcmljvfrmh4 +twothree5 +6sevens7 +8six9mnksevenkm2fdhhqvfhscqs +twotwoeightsixone24 +rhqnssh2nine +dhdtxxcndninethree9 +hvvfzxfivemb3 +dgbgglhmtnkrpq4four51dlpcfivefour +4qcqhrshncqseven9kvq6hmghcbfl +x3qvkxmh3m7 +cqqlrjkjbrggmccctbjzcjqktfngmmkftddponemqj17 +fivesixfoursksxqmqrmseven5 +fivethreepxnxtgpgmrtwo1 +5threenine +9five4plblgvnfcfoursixmsgfive +cqjsfxvcfdseightfour9g857 +fourthree7onegpmlrrkmtj881 +gjdvx1fourseven +lcvhmlzplhgvmnhcgthree8xdtvrck9 +four26 +qnvrspvpvqsv3xfbzrrjjnsevenvvdzknkqcmbpdlg +22611zfive +ninegbsscnbtcnzhsevenfmfvmv3lrbthree3 +two76 +xhn19qninehqtbvrsdfour +fourk4cqtggvjseven +threecflx6xllnd +dknmdpcqfivelvppbtone3 +6dnzxninebdldgsphsppzjzpgbklbbf9gcdc +587cdbcb2mspbgbl +twojkblghsctseven8eight +2xmdmtgcjhd8eighttwo +nine6qpfzxhsdsfour9 +9rvqhjvmh7kcvnineccn9rzpzs +tbsxkhhv6twozrtczg6seven +ccpeightbcvknglvcv81gcjnlnfnine9 +4twoscpht +qdgdrtx9onefourdcvctldjnpcdjbc +cjxkxsgmql4xxgjtpdcbmsixeight +739 diff --git a/src/clj/hub/advent_of_code/2023/day1.clj b/src/clj/hub/advent_of_code/2023/day1.clj new file mode 100644 index 0000000..2d8ed77 --- /dev/null +++ b/src/clj/hub/advent_of_code/2023/day1.clj @@ -0,0 +1,62 @@ +(ns hub.advent-of-code.2023.day1 + (:require [hub.advent-of-code.util :as util] + [clojure.java.io :as io] + [clojure.string :as string])) + +(def real-inputs (util/read-file (comp parse slurp) (util/input 2023 1))) +(def sample-inputs-1 + (parse + "1abc2 +pqr3stu8vwx +a1b2c3d4e5f +treb7uchet")) + +(def sample-inputs-2 + (parse + "two1nine +eightwothree +abcone2threexyz +xtwone3four +4nineeightseven2 +zoneight234 +7pqrstsixteen")) + + +(defn parse-digit [s] + (case s + "one" "1" + "two" "2" + "three" "3" + "four" "4" + "five" "5" + "six" "6" + "seven" "7" + "eight" "8" + "nine" "9" + s)) + +(defn calibration-value [digits] + (Integer/parseInt + (str (parse-digit (first digits)) + (parse-digit (last digits))))) + +(defn parse [contents] + (string/split contents #"\n")) + +(defn part1 [inputs] + (let [digits (fn [s] (re-seq #"\d" s))] + (->> inputs + (map (comp calibration-value digits)) + (reduce +)))) + +(defn part2 [inputs] + (let [digits (fn [s] + (->> s + (re-seq #"(?=(one|two|three|four|five|six|seven|eight|nine|\d))") + (map second)))] + (->> inputs + (map (comp calibration-value digits)) + (reduce +)))) + +(part2 real-inputs) +(re-matches #"one|eight" "oneight")