diff --git a/2023/examples/day01-1.txt b/2023/examples/day01-1.txt new file mode 100644 index 0000000..7bbc69a --- /dev/null +++ b/2023/examples/day01-1.txt @@ -0,0 +1,4 @@ +1abc2 +pqr3stu8vwx +a1b2c3d4e5f +treb7uchet diff --git a/2023/examples/day01-2.txt b/2023/examples/day01-2.txt new file mode 100644 index 0000000..41aa89c --- /dev/null +++ b/2023/examples/day01-2.txt @@ -0,0 +1,7 @@ +two1nine +eightwothree +abcone2threexyz +xtwone3four +4nineeightseven2 +zoneight234 +7pqrstsixteen diff --git a/2023/inputs/day01.txt b/2023/inputs/day01.txt new file mode 100644 index 0000000..979a9c6 --- /dev/null +++ b/2023/inputs/day01.txt @@ -0,0 +1,1000 @@ +sq5fivetwothree1 +six5gc +txb3qfzsbzbxlzslfourone1vqxgfive +3onethreebrth +cseven7nqqxnkzngndtddfiverkxkxqjjsr +2lvpmzh4 +threeqxqndvjrz15 +threetwo1drtzsixtwofourppvg +zxhsndseven2vbnhdtfpr3bt86 +onethreelqqqqvj7eightnine5 +7sevenfour5gnine +1seven5 +vgxhqfrvr7vfsxqms3 +twokdkcbhtqxfc87rkgctwo +twosix9threernltgbffour +npvzzqfb5tbbn4cnt +jjxlckssjmdkm5szklnq1two +lblcscglvseven53251zzcj +threesevenzplpzlqb1 +threeeightxhrkflkbzp2 +honemkmbfbnlhtbq19twonekbp +vdttwoeight7eightoneone6vq +eightvszlvntpfourjqcgmjr3 +dslqnmd7k1twogbvhhnfmtsix +twocsnn7jslpsppxmjr36eightss +7eightrdcz74twolvd2cctg +4threerrqxpmmzhrqht4two2 +2seven9two +479 +threefour86 +5klxgb1 +dchrpzkfpgqzgjmpdcthreeeightsix82five +seven5tcls +six5three2six888zd +75nine274sbzd +seven7691dzflbg7seven +bjtrrvpx954lxr1qlqdvbldpt +zthree4 +sixfourfour68 +fourrjgvksixtwongbvkpff9 +3seventwo +bzqqjtqvfssevenonenqzctcgbch9three5 +4fourseventhreeck +mx5njh2 +1onebqkdcbmvrknghnn5frdjtrq +one1nineflfp957vkdgfrjtfive +7eight7fiveeight +zzxrsrp313 +1sixcksrxn4 +ggqvtwofrrfdhbsdfdpzpbjjckbrg5ninebqszf +pxjcgc2ggqscglhjpbpr6seven +sixsix7twofivexgdm +four4eightseventjsqlbhrzvsevenfivesix3 +twotwo8chjmb +dknnleightmmmmrmcrnr8 +twogzdgdqhrs3836 +ninebsztzhbqjvlbvhdktqjc6hpqcksfive6 +twofive1nqdxdvvtvf4oneone2two +1eight8nkmhcfvzn +dzmkzzx4lfljtzp95seven4qqnpjdtr +one7sevenninepsdgrjkxgdchjtxrx +fnltdcxqln314nine7n +three7sjgtnxgtllnpndfourfiveseven4 +64snine7 +ppjlpsnsbmthfivelffive59hsnmn2 +sevenqftktpnj6 +ninethreetbgprvchxlnmfs3fourhmcz +xhl1 +4qgf +1qbhrmfcffivedgtfour +eight86bcqskslkvlgone7gg +6pccldrtmsdbbrcbcq86 +ppzrxtsix94jplxff11 +786seventwoonezvnqrsix +7threeseventsjcdr +fivebfive3nineffcbzprh +4glxskdkjn +n8 +kzcvdtbq49 +7xvqxmhcfkkffnine93 +hhzmdnzktbtwojvlckvjsixeightone9rxqb +one3sqckgps8 +lscdfp8eightcgdvgssveightdldsreight +jhjsltwoeight1one +6trxnfcqdmlrmf3three +one1kdclsglmsjmczsksdfour +sevensevenshlhsvtl8three +four522sevenfourcrthhhvkj +197stxphm8 +8sixtwoseven6five +zjdhldjcqctkltggninesl6stplglmkn +6onesixrhmjvtcmbh +fivehnj8dninefourfive3 +4fourfncsrhf73 +nbcjqhlckonemdbcsvfsixvm3one +7seven6seven +fournfive6four9 +6brzhdxzmtxfoureightxg6onetwo +5sixmmddqgpdnq4 +6ndzzhlrdjxjqfxvss +gkvoneight29two +4threethree +eightsznbxf8fiveninetwo9vgfbv +8kzkmqncfhssjblmfd7hdmpkghsz9mmbsbjdxdlfmnxfour +four2threeeight19bx +1oneseven +fh5 +615zkzg +25six2mrtjthree +jvvmbfzr3seven7xjbhvvvhlz38ninejk +vzjthjkrcc5six3rrnrseven +rjthree3szfourbnvnbh7hgjzcrhfptmlghkk +tgjtdsnqrq39seven3hgqc9 +1vttzfour9 +6vbtcqmpk213sixzmjcnxn9qhdgr +3sffvspzmxjjfourjxjbbdfj5 +bdhj9lz1np7tvmfvptffhfdtbxld +kbkxldln99onetwoseven3 +rvsthree9seven4seventwo +32zbjmhr +eightfffkdgjqspgzmkvzxpls4one +three1kxqr21ninemhrmheightwoc +fqjvtsph8zpghgdbxrg4 +398seven +bnine1two5756 +7xkqkxjjvmd2n77 +9seven79foursxdqcvttwo +6d6zfxcmrzsixgmlqnfdn +kfhreightfnhcxpcrz9hqrqtmknpjxrt4hrk +seventhreeoneone4nngnlz37 +fphhxfs8jzkchp8twotjznmlxhht +474 +58eightnzxfgndgdvbvphzsqxqcffdqsvxtwo +3two5xvjjthreetmszrldjlknq +1nine7 +29kfrrdxvrmgjvfpqjcqlplfhrxpklzcrvndmdhjhninejhmph4 +fzbq39bs +85eight29fiveccsrvsixfive +sggksrnseven28ninesixnine +bggkmnrbjknxqfgttxsixnine4 +73nfive +fivefourgscsevencntfpzzrnineprdjqdbmq5 +6four2oneeightljstfshztx9 +sevenzkdqst6jncvcblb +dxrnzlsix5 +two1tmhmg4four +2mzfnc5threefourthreesixfivezq +jeightwo3jfzqdtjzschpzrj2 +5ccchkjzvqh7 +jdpnjqg3five48xmmptkzmvg +rgn146nineseven4six +eightonetwohsxms8six94 +eight4znfqgsftghtrhfkvj +btmk5834eight8mlcccnrzrb +15ninemhmhmqlb +85skmrvhl74 +dbvhkthj4 +one6keight +sixfourtwosevennine7tfrqgk8five +seven1kxcqbm1 +tmpl56rz27qfdfour +3eightggcjbnktmbqfivefdmczl +b2threethreemnxdhrzsxqhchzbnvhppdcqcffour +htpgc4blggnnzts3four7 +8sixbdntsg33njhtnsnsix +fourfour5seven3threesevensix +78eightsevenone +four5threefive +cjqbcfjnbf2six +five9ninesixonejdnsvcfive +rvrf9cjl3eightfvrzpjnxr +threeseven5 +vxvmpkffrtwo9twofivesix +67xnrcxsp9rk +mvzdgqgrv77 +one42qkfp +1vtq +225eightworbm +three9onefive +qxoneighteightzxlfksc3oneeight2 +mnqjhg6ffbhzcsixtrbfr744zlg +8nine7 +fivergqn2seven +44gpslt6nine6 +1six98fsgthctwoseven +ldrqsbjrtnlj6lqgptgplbsnhrhpsixzqgpzkxone +7knxhcfjvshqsxsqrponeightld +zsixsjbltfournzndqbqd2rone +qpnvkqmdthree3234ninefour4 +cdnhqqxxp2two6six +five9354xnbjjx +9eightsix4jjjeighttprrhqvqlt5 +lkcfmvtonexklgknxxsglcd5znseventwo +four31nine56pmh +eight96tb5t2nineoneightrlb +fourncvgmslx695twobdklqzfour +8fiveq75four +5six9fourfour59seven1 +eight2bqtqdjsvkkjfive81vpkvmbpxcp +nvxvgqhfouronefive4sixpqckgf +25onetwotwo +seventhreezkntcmjqeight493three9 +ptd58qrtfqj +2985lvlvlrfzrjmfqbrmgtonejxtgpspjnx2 +6qbzxqvx +three81btcngfkjj28seven +36six8 +5gzthcpffr2 +6kqtntqrzxsgksevengnzthree33 +87fmnvqpczzhone5seven +nine2cxpmrhp +vt46xflbjdkkb7seven +eightrgthreethree98fourhgcqjgzclc +5nfsbcvmfv484fxjtwothreefive +nhvcn4glfxtkfttthree +6five9qznggpkflhzht7zhjjone +ddzghtvmp78five4gzfnnkc +sflvnzkrjtonenplrbkzxmt9fhfdzxrfjrtwomctkrlkhghfpcmkn7 +sjxspdjhg96three112jz +xdbgzlfour2twosevenzfdtvxq6 +gdtnt2fivelscmsix +9threefkjkrskxrcjsbthree +ninepmqbdmlkrmfhpgsz3twothree +onebgtdg5mqrfxvnfkseven +6m949fivezthrbbkqfd +2five94threeone +eight8four42vb +2ninetwo +17two9nine +3pdmsixfouronethreesixfiveb +five1two5 +nine4four +three5lktjmlnbph +eight6onelrdlsevenj1zmmbtjrd +tkjhgvnpkvgsqzjrnine2hltwotwo +89xfpxgdlcpznxxfnpbzbzseven +293threej7four94 +v63 +pxccbml6sixhqnhmrfive +kddsix4fouronevtrgbvtxxxsix3one +5bxqjkdhthree +six4threezgg2 +fourtwoeightmftwo99 +t7ninenineeighteight8 +5xvvlnqkjs4 +seven7one +vqfhpk7hnthreeseven42 +7threef2two92 +2onefourckbrvqzq9 +tvvdxrvthree2 +seven1fourbvmfzftwortnjd16 +pmttpsggb134mlffcsnbftwox1 +2dzpvqtcxjfour5pgppvbk +9jfscbjzq +fiveninefivethreexdtgnbdfp5onefive +six1927 +one1xjjkvkkfk1zxxrjhkg3sixmhcgc +7fivetnncl5 +zbqzdkkthreekzdcbhpveightfourfivemrmpzv3 +twothree51three2phhmrnnhntnine +bfzzqmthtgthree4sjzkmtrnplbxeight2eighthj +nqsflrlmlthreemdzztlghgj5xcj +fdtflsqrxltwohcvsnrndmsixeight7 +fourbmlftwo2mzz8 +pjjqzmsx4ksix +six1219one6seven1 +gthznkpp31 +nine4four32 +xktzkqmmxct6fkhpkg +one5688sevenvjjthreefsvxt +36twonine +3fpdqtzrd3tslzgkjzxd5 +bsevendpvtmnzl9cqgjfjbzfv222 +lxbhkf2nseven79 +gqckmfeightnknineeightsix45four +n78 +42nggdthree4threefsxgjsixjdnqzkxdb +gbfbpjcjnzjrrqmm17473 +1eightzqxxnq +25twovmnltzx +seveneight9qtcvzvmone138v +msixjrqprlnqhdfourjdmsddzseven85 +eightninevvcp2 +mtvvjsck6hgkjml +121fthreethree +jncgfj3eightr6 +468four6xdlrgngbhcxbtf +3nqqgfone +1zmzjqscfournzbssixeighthmspdbhlpc4 +twoonejmkb8sevenfourseveneightsix +qxrznqone8z8sevenninesixsc +jrklnh6threeone +2xfnbrk6frzsvjhb5sixeight +ninethree8lbpmqhsppd9fht2ninefql +7bzcnthreejdh7oneightj +155twofourthreemfive +5ninerm +9lxrfoursixm +glvxvsbsg7 +jbrbhzrsftwofour1 +two4hkxztgbbgf4ptckpggkbvvj7 +vhqhqghjscvc3rcgttfv +ninetwo9threemhtsn +cnxzthgqz6pxfbsmkmm +45jgrr4ninetwo88 +dkhgscrthreeeightsevenhsxjhr6five +6nine7vpfbvlvdvzvj +goneg4threeeightslhlzkpqv2 +sjqgqz8oneglvzn +crj32neighttvv5 +blqptxbggl6three1two46cbdzt +vpxnvxkgdmggpnine61 +22kxn +5zvsmtzqjhhmfsvv4 +dkfknfnjxtzjrbfk1 +67sixzns61sdrpsmjsrftkdgjlb +6lnffcgtxfivesevenseven8 +px1one96slxflxdfxhninehkcszmdxzbbjmlq +3sixsevenseven7vlvdlcjhccvmlzcn +5frrqhseventftbln6 +three23seven7sixv +ninehscrb9 +fivepvsxqmnbmvgphsevencgkhsnqkz1rxvg8 +pbhsqvdxhf694six66 +four2nineczdtwobjxkfnkbg +nineml1jbnm6vhpsgmdq2 +three63vgbm +665 +htd7pvmrpptvtneightnzmngone7 +rfeightgrfffksdfmgclspbp7489 +4fdxcnbfjtbfg63ninefivegkmhgz +21eight7one39 +foursix8vrzhm +two8sevendneight +tncdggvfivekmbljttwo94fivetpstp7 +68seven +onenxh9eightone +twothree3threenine4oneightzkr +onetwosixeightkfxnfnssd5 +eightthree63five8 +6seven7one +mqkkhbrjjm8v4 +8six2 +threetvbonethreeqmpkxjqlqgghqrlh5sbf3 +blrnd9dkqgjf +41onervcmkgnpcbx52 +frmdcps8sixtwo4ninefbdjfour2 +8nineninenine +pkrln2dfrkkntwoonefjsfgx6 +xvrkcmfxpfourfourrxcxqmhfour29ftsfd +crkmrlrb4fourthreeeightcgk +7threemrss4eightsevenskjh +eightsixqppfhv3ztn +3threeeightseven5 +gkrfhthr12threeeightthree +8vthczh1 +seven6hfcfmrlkmqxpjq9eightlvlgqmf +fivednzg85eightseveneightfive +dz8ssixkbbtgv +rdmjrcgeight6r +five6nineonesixrlnhj +zh127four7two +six1sevenvmlnvkgcldsrrblfbrphrfsx +m584sixkgng7bzzpzjzbfzqpgdcn +2twozmvzzjbpdftm186eight +twoninekvspfvkbxtkc3 +fourrchgqkxfdzfccppqtpffhrtfive7seven7 +four483eight +threelqlc7 +xkgntdjninenine8brkjfsrttnineseven +9zkds +twostmdvsbflvqbdgfs55 +twobnzn1czdfpns +5onetwo5 +txsflrhgklnctfzrlgmplr8pdxl +93four882mgqmqnsnx +sevenfxschslsncjgqsctnineonenine1 +brb9 +7five9 +three425 +mkfone4ninefour +bkpdhbvq7 +dhrlbjvcgqdtqjlk4zxzjpvdfm +67threefive +nineninegvmlfthreevtndnb9 +ttmznl3fjdcbch +fqsxkm9nineoneh761 +sixfivesixnjrtqdkqpc2xdhlrrmp +eightsix793nvdvbtxxksix +5veighteightgscktfbtd513 +vfvrcknfls5q +7seven24rfpzpftrkgthree43 +qplqnt4threezldtjfdzv +three1ghfglcthreecnzjjphgrlmone +eightthree84 +xxtpxgonethree5 +3onengztdjljx +cjrtxxlcpfcqjmgqknineseven2 +sfxhqftcdht4eightthree +2plnnlkqjnfxv +ninenineeightone4brmgnngchf +fivexbtndsonesixlvtjvxhl4sixstn +dqcztwo8fourninexm +5532threeqmctrbnnhk +two4pqsjlcfone8jpt +onefour42jqs2 +4eightone3gvqfhmmrnprc +6sjlcfbs8fourfourfiveseven +nfdeightwo31threeoneeighthjnvcddclm +149two +8ckgmfsp32zsnzznine1 +sevenfourlfzztcbplszbninesix1 +htdtwoqxmhnbfxr23fiveone +qvvqnineqf1five +rchcjhvqxthv89pkqrffrvdthreesevennine +kzhtxmrzz3 +sevengnmtfxfthreeqd3fzkbvpgghpkvcgzhthreeeight +fsmnfc3one3five9mkqgnkkbpt +js9hbszkvngrnine9trbdkr +grdflnvhrnjcxgtshh95f35seven +xb9fxdbcbdninefive +9sevenmfvdbljjnkkh6shmnhzhvhczhtqhnztltc +tgkxpgkhdrhnpltgptdfj8 +4onesixfive +seven1rzpxlkmsbhfivexngj +plmhsjrgm414 +8twobllkqgllczsix6onexsrvq +4nine6 +vgfjtxhmqjtwopfrgbmr3 +jhoneight9tsgeight8fivejccrsblkfsndpcmbjm +dcdkbmkttwothree3six5six8seven +seven9fivepxlhhhxpmmmtrvvxgrzsxx62 +three59cksmfknhhdthreevpntxrnm3oneightpg +ninevcctklkbfdtlqv3five384 +f4999tcvvgpdn +78three23sixonecqbrrkthree +lcsrnr5rbbmone9 +eighthjjsxhvf7qdxnqsjpdlmzkv +86four +1four7one23threejvxh4 +seventwoone9two +ninejjdhg3fzkqp9 +nine14qjctcs1424vkc +two45 +gpzgdzcqone55nine +766fourrvhfrdcqvqn1 +cqfjjgbzhljcnjfnd1vhndrczpnhthreeeight +eightbzkgpvss7vpz16 +oneqcxqckg2dgnxtwo7lqjslxmeightwovs +tzvmvcjxk5nineltsb4three9nine +mkeightwooneseven2 +nrtkxhsevenzdfive3 +6kxrt +9gp838 +3sgtlcgvsix +dsqtwone42 +9sixonekjtpvfoursevenrhfqgvc +3gh +eightzdzhmjj9onermrzjdlq3sbgtqmkcchx +22fourthree7 +fxpeightccgmznphxghv2 +five8eight +seven7ftgqfour +7fvjtfxkmskseven3xdhrmdmjntsneight +vgqspdltzsevenbknftljmsk71fivechpjzsvlnm5three +2fournine6 +fchqnvjk51eightlfpmqtjtkv4bfpfour2 +1sixltcvfh7nngbcfbtvsftwonlncst4 +sevencp3sevenseven +lsqbbjsrthree5 +tfbbmtvmcnjbdm1dtwo2ghgthc +9lmdspfheightxrgnsffcdkztbvfsvfxkqtnddp +2gllnfivexgnsst +sixm4 +fourthree7twobcm5vxdtlcmcg +onenine873gszpxcsonep +2threenvxrbsxnjkonernsqrnqhzmsix5p2 +sllbrnpsjztwo779 +6dfive4zqmhpzcdqj8eight +5nineqdmbg +hbrffrnkvthreekjstcv7hvmngdfcn +21249 +ninekdgfqppzt972five +7ljrvzfrklgmtqrstxkrkbjbpzeightxfnvr9 +sevenfour9onesevensixlczmmlg +kcteightwo6752 +fivethree9eight +zzgmn5nnfndqeightbzbcsxqpzj5one +6fourvqfhs +fivexfqvmrpgpgxz3 +txqbhgcxjfive1seven44 +82jonehgntqmxjbs5two2 +4eightxmz53 +lnzvmqrsgsfiveeight9 +threefour7 +seven4ljsevenfive +1jfcvdvgmb7scmcfsbbnine3 +kpxpxsvvg4fcjxjcmltnineone4eightsix +zjdcddgtwogfbbmdvcczbcfjpcdtslckbtzqfive6nine +4tqghjdjnfour7six3 +lgdtjjktwothree89scfivethree +3xvvmzshronefour6sevenktdjmrmfqtnvhvl +9fivexcpvthree8njncvnnz4 +gcgx5sixdgqznrrstwo +1fivereightonefour +tfclzvrhb1five +xcq5 +five9four8fourtrdbmcjjjvnine +63rlxseven7bltsm +1bnzzkgm7seven5onezqjvzrnbnxkgffvt +sixone9 +7jzmnhjvzxfive8 +16mbrtmstrhhsevenxkhgkmhreight +ninetwosevenp2ndddnhlczfnzx5pt +bv83blnnpfrbsone2ninethreethree +zjjvslrqpvrhxsix5z1nine8six +cqqfxzzxrnmvdvssevenrdm1dckrhjbdxpgqshlnxvj +78sevenkrsvceight2eight +twogrflcthree5gvmqfkpjfjcnqdhfourfour +dcttz7sevengtgstlznlgcmbzs +four64fournpxmfkdmqn1 +gmgndczvqeight6sixhhfgdrzbl1three99 +twoseventhreefivecfsdlmnzvlqbrszjdz2 +onebh2 +5tcrkzggfdfzq77 +gjhfrt871hmgsix +qn589stxkhnlnhvzptzs6qlfvhz +qhtnjvdmtflxffour6sevenktgtr8 +7sevenhjjdvmsixpqzxkkzcqzd +849six1kt +trhhcsndhtwoeightfournineszdrmrqhsq4 +dfzrnine9 +roneightgqnxnd18frkjgvhpngpcs9 +3nine8lvkpzzqjkhxjjthree +2cmdmvnzb +dkxscqdrctgxzlflrlvtnkqlmrlgsrqseven8qlqrdz +4fivethree +2qtbhgfjcpchsjslm +gtvvdchll61gczsrlxhgf356 +6onegckf4seven4sbntwotwo +ccstwone1872hdv2 +515mhxpngvzqt +fourjhhfsbonexdzhgrseven3 +twoxklx6seven4ninethreertczhbsfour +rhtl4pg1four +6dlprbkclc4nxvfqkpt +5onelkmrhczkm +zqhxmhgkone5xpkvsntwo3 +2two461 +twolr6two4bzssevenfive +2oneone7ninetsgxlx332 +eight3hvlzpxtcs +25eight3tbpccjbx3sdcmt +krdzhfh2sixeightgrszdxt +tjxlhrgmqcdspzdb6ssgqnxcxlvbfivetwo +snninedqlbnhqzjthreebhfnfrf3pfcqzfnffhsix8 +8nine3 +9five1xlbvsix5sdcrlhgtffxb +seventrldtzv5ninetwofive7four7 +blbvthree1grdhltsevenfive +fkrhh4gd1 +1jncdsphsnjzkxphbdftksc5dtgsixone +fglnthreehgkx31 +threexnfour8threefive +zzjnmhvbltp1 +6vcjxszkfmkprpl32cfjsrhzmdfourjdflnfql +49tlsqspjjcmtjvpd4 +7sevenjfqpktqpdhonethreefpjqhbjcpfourdzzcbxp +xn7sixeight9dphpvscjlxdtwovjbnx +tzgrvrkgbs7cfzf2eight76eight +4xlnzqrxqk8two97vxjninelmhzhv +ninedqlbgpbmf7dhmshsbq2eighteightpgzq +fourthree825 +jcqftlf2threecbnine24lds +fourtxnine8zhlzcqjmvk +5two3 +zfkdgfourtwoc4 +7fivefch +fourqrvjmbninelcvjlgqxmvhf2hldvjzhl7seven +vkfeightwo8four5seven +79fxdpd +tdjspcsixdqrgkxvk1vjmggfpbrvfour +43tnmdpslnxfourtwovnzdzhvteightseven +threenine1zklgrlllhonekn6 +one2zhnthreez +bone11npzv +five44614jnzxvdjhm +277seven1 +6djmb65nglbkzrlpfgsqchbp18 +ninesix2four +four8nshkzhzvxlxxnngxvfive +2threejrxhhqkctsthreemdqzpxxrrglnine8nine +1xdm +kgnprzeight7nine +mssbnjdcjvvtpnsrnslmeightbzl3nr +9dppkrcf6oneoneeighteightklmtfvl +8ninebrzqx4kbhkcp6 +seven1hklsjbdqzp1zc +twofcbxntcskg1onezzqfrff +94xssjlkccfbljz +spfive47ssjssevenrz2two +98threelc676 +mxrgthreezzkhcmoneseven7three +crdvdtq5sixone97 +8eightbvbg +gvjscdfkdmseventhree2nbvbzmdmmtrfive +1threesevenhcxggpds4two12six +5onekxzkfour8 +2ddeight4 +645 +ninejjrlhdhjtzmrlvljfr98 +seven11ninebvbtnbzdmblbjvzsh +9nine59xmdktjsnseventhree +qdxgtk6126vxcgtxkkbqjrpfntvsprq +75cqkfddg5ninejkbvpsbcltssh1 +3onerfpqbsvone39one3nrxmbk +1612three1 +8hqrsksevenldcqrcfxhr +ninerfkxndfhhkfivefjntjzxhgpbbffvfour2sg1 +seven37kbxszsgpt +89435jpgsfiverhsztt +threeseven1sixsix21five6 +pzht15gxvjlvsfour6eight8two +lkvcseven771gcvrsvsshtppdgxnvclqhnjlvvthree +sevenmpghzvvrd6 +8vprrlcq9xzhmhnj4 +dxhsxknone1two4 +eight64d +8jqdlcsixzzhvnnfiveqbtlhrr +9eight5nine5fiverk +xhhxgf5bfsbthreesthreeltlvhvrjnslxhsrp +twoqccssix55twofour3vtsjxk +goneightpqgblvhpmp4sevenonethree9sixsixfour +onethree536xhznine7df +998 +hsix23three +chgtqonenvxtlrhxvxmbbl5 +2zkzg +1hgrpzshm5onebcgpfv9onecgtr +3sixonevldsdlxqtjsnlt5onehxdpfive +eighteight59phbd9ldnvdlsxninenine +zseven9 +xptwonekdrnv2 +5tsmnbhxhzrtfbknbqsevensnxbqrhs5 +694onebvmscclkbsfour1kxgfxdbfour +g2ninetwoned +gmlsjjttcngblmjhtgkz3fourdrzrrmsszfivefive +gtmzmkrktmrkfive8tq5 +eight1four +8eightthreevqgtlfxrm4three6mnrfzvpkbl +szrbvtwo3lqbxthreefivemshzfgjzlllrmr6 +kzczdbjcbnine8nnineninevfbt3vsvcplsnj +ninesevensmgfsix5fivedfpxvmtmcsgzpbppfjt +sevenctdzznone7three5kngbthreenine +44sixoneonesix +nine9fiverrbbrqtfive53 +onesix2oneseventhree3rmpjl +23htxtgxqkseven +fourlkbsix3twonndccsseightbs +eight8two5four3 +five8dvxpqfsixghrkg3fourninetfsdbxzp +bhtqtclbsix6jlvxtgmq +498three1 +2t +7five3bcjxsglnxqjxjqfb +6seveneightxvmqgbklgnbfgzlncvg +89nine74gbgbcone +8dtln6 +svtl5eight8 +jsxzlsix8bzrmcl659lrmgtnpv +64rklskvlndm6ninextbrs4 +voneight79two +sbzdmjbtwo7dnglczphb77fvhtwo +two3eightwoj +rtoneighttsgeight89nine4 +3six8vbdbthxxffgm +rxgoneight4mtqdpzbfndtsvsrzt +7one4lbqcfnffive8 +fivecd8two2eight +twofivefive6twotwoklvbdstxfcvsm9 +threemdrdnhl7sixseven46mctldxnn +5njljbxdrcbrrm3ninec +5jg6eight4 +ninethreetwo6dnldknsnn +xrpczvvfnpjfbpvxzjzpmrkpb8fivesixtwonetj +4five4vmone3td6 +77jbgjkgkfd1691lfp +fhxvlvct6 +scjeightwo6onedjz71jslzdfxp +7eightpblnnbvqtvtwoseven +btdgplkdvl5rlzjkthree2threefive +298 +7hhfxtfcvsqjvsxpbdjqzxngg832tdznpfhz8 +drhfzlnlcrsix2dbjqhrxzqrsixsevengrnine +sixninesixoneeighttwo96 +onekqzjft4zdspcvmbjtzbsixv +sixgkx74 +75eightqvblvm2gtjmcljphjvtwonesq +bcmqtltwoxsbkvhdv96df81 +eight3bk45sixninezdnntshfv +9threetwosix +2vrfzsvcprnjzngl2nine +fivekdhcgrpznvsix2nmhthl27 +195 +four8tspldsixzzqxrqqmsr +8bnvksmmlhnfive372jmxhj +nineseven6threeeightnine7vtzmpf +2twofivehbponevptflmzgxljzfour +85eight81two +2ctnhxfivethree148vjtzfdfkkfvvtgb +62sixpsfjzcxzlzsjbtxnjpbctgcjm9 +gmclvqfq1 +32csv9dgfxsjm +4fjcdrzmznhfive33345 +62eightrdplbxdhfq1eight +4four97skpvpphtbqmmsckxpdqnfour +913sevennmmbbnntrs +862twonec +three2four7foureighttwo6 +ninejnt721nine8 +eight1gpnrlklmxt +nine2mrzvhlzxgninesixkp +cklsqdf9nine3 +seventhreefivehdnkjqtd4tcjxpbcvpjsvbhdvx3frkc +one85sbrtsftwo6 +sixnine8nineone46six +dmtlrzkfdsdklbvzckjmnthkkmqh9 +ninetwojone8 +bfneighttwo5 +slqmsbnl4mmeight7 +55dnsb2485 +fivesixmzvmsmkkhd86twotwofour +gppnzsevenninemzbzzqqhzvgclndss16 +8two7r +8xsevenbfvhdqxtwoeight86 +fnnineeight1eightninenine8twonejgf +five7three51 +eightthreevsnn4seven +nhhjkxhtxp4csfeight +2nine9sixfour9 +fveighttvjxbhzfour7ninetwo +5eight6 +txnxcrx3 +chbmjvmlfqfgsg2hdg +56five29hrrjgxnrbnzjjktdfqssjqksxn +eighttwohszdlc7veight +5ltglgmlfkkbzkvh +eight336gbxmzjsbpgztprdv2eighttwo +five44 +kdfbgxpcqtdlksc4threefournineeightnshlmfvs +1c5six +nss7bccb +34eight9six92 +onetwofivedblgtrxzpvmrhhsj2jhrcbbsseven3 +vxkczjfhnine5drz +bfourqkmt1 +two2onedgxgmffcg1 +3threenine6vlstktnqdzfive +three8gsqdqpv +7ndgkns +4onerglbzsjrkqskljcgthree +zxkgzkvn7fssgdsblvksixn +788sjxcxmtxfivezzpgsbzbtl8fourtwo +9mhrlcsqqgzjrfnd +7kbmhmlghssix231 +7tcfv6jpkxnzmrtx2 +bcxvhcjbhsxbgbrj28fivenhk +jrm3447 +ljsix29mhrmrjpcfqone +xqdxkzls46 +bmhnfnd9qmbndfhqnv9bhdpqxthreefbptttwosix +six9three5blqp37seven +44ffvsnxttwo8seven +cmjccpp34threesix6jhthree +eight86 +3vqqjlgdj9zncvjhbpr2d +26sfzqpfgfivetwo56 +xljmtkjkzthree8 +ninesevenfourtsctjhvfive4dt +jzsxmmxmpllqpmszczxzghpxp4 +hcrtjnvghvnthree5one +5twoeightsktxhmkpcts +ltrkvbzlnccrmrsfmjrbfjrh75 +cbxfpfsix8lkbqh +9mseven7fivefivexdjxct5 +9sevenklrvhclkrfourtwo96four +2pkbthree +kqpbhjxzfn147 +nineqnjxrmq2gnineh +5sixcrtgqqlqflm +9fourzjzmhmnksxc +four86rdndxscqnjcxghnvgmzp3 +mqmfive98eightmbxrgddqbbqone +gtb66rbclkxdl4spzpgqmkdh3 +965two +96pskqjvckxffkone8four4 +three9xlf1 +spczeight9dvg +v6two +pgksdtnkbbninef5zttwo2seven +4gnvxkc +9four43sixtwofzf +3xsbfcsixsix4eighteight2one +3oneeighttwo +ptwonetwoskjsspjhmxrmvlzcqz572fourmpxx +threeonetwotwo2 +slcseven1xtxbpfb +peightwothree7pdmktbcfouroneninekrf6two +668 +lxshscpkv8fmhcpslhpp +tzrdone7onethreectwo +8pkkpdmzhfourcmjljfour73hhqqmfc +one71ninesix8oneighthlx +72pjpmfcgjhvsixksgrjthreegcspcdxchxkxflmh +4bzr98threeksb +9one6xdfcsvbbqfour +hr5eight33 +zgsvc9 +71hfourtch395pvnzsmhdf +zsvppvgzllgf22 +threebkkrcqzvnt4rjblsnsixninetrjgjjvlv2 +289 +krqdkcfbpp48fivefour +five7tgpt5flkone +eightfive31twoghnqffp6 +eightseven6oneckpsixtwo1 +4l4 +4sevenxzdnprlcjrfive +68vntztlbjqtqkstsp7lkhcgpbtdmzrndsix +onesix2 +sixhc4hhglhp7281h +3zvhhv +lmfsqtnzfk52qrdh +fourbvnsjfjfive87seven1 +twoonesixsix1twodxjdkdeight +nnine3 +ccclkfdb2lftfhnjcqd +1q +gtcdzjhfv8p9 +fivefqxrfourtwo62eighthdcsqrmxjv +one556mgtsdvkqfiveseventwo3 +mvkrxnj34psqtwojhrdjgthree5 +sevencndnndjfzp2eightqcbhvb +eighttbvvck2fiveone6vkljmslcrsghk +tqdhnzfrr6fourzf +ninecqxgkbsv7 +8nsl4sixnxrcdhtkeight3 +sevenxsczhz6dv4sc9brxnsms +5glknvqzlqvmzvnzrb1 +5oneqcshgqbfp1 +5two1sixsevenjpgnbvjpcgd1eightwoh +2qglrzsxz +fpdthreek2 +gplr51sevenfg34jhhp +six78tbzz +hntwonethreergcp7 +59fivefive5 +threezfjxxtqrvhjcdkjsevenhgp44fivetphhfbdtxs +njkd2dcddfzpvpfqp +3sixgnnl +6ninefdqzfpxspsnzs13gz4 +3four66one +fivesevenczmt22nfvnxhbvgjtvjmdzhfqhxtthree +sttx4gktnine5vlqjzddkr +4fivejpsscfqdtgjmtvrljdseveneight +xtfqvnpsfnfppx12rvcldvkhbb +62hj4oneqlp4seven +6hdnlgrfdccsqsxjqrv +331 +nine6eight +two6mbfdmgpfourng +fmnv3three3 +nine5hvzkrjtwo +6eight73 +fourfive79six7two1 +thzhjrfsfoureight53 +1lzfxgvtxgdxtsixffptldz1srgsnvtpnsevensix +seven8onertbqhthreefourctdbsrcvcsjlvcxneight +5eightfive3 +6phjbkvrjd +gssfoursevengvtfznklj97 +fivemgrddqslp3 +ninetwo6sixpv +lhdjm82tlnqrxqtvd +six7hpcjqnrszkfiveftvjnhjsevendqmmr +m2cjfjcb +thfive27fjnshtwo +vmzxlq7 +xlg3nine +schnfive33sevenninedhpjfrsixeightwoxr +bmnine3mgrttsevennvhtdszmtxoneone +zgkqdrvfjtg1sixbsqgdjfivelnrmpqqstv6seven +ljln11fourgjgvfmhmninekdlpjmrn +jffhrkpm22sbnsrpxg9three +fourtwo1sixjvv55ttflnvshb +xgndhkmdnxgrhqh4lm +87five6nineddnrzd +9pmmddvffivesix3one37 +2flddmzcjbfrbdxzhvhsrx16twonej +knzfrseven71fjzhmdznfthree +9five84dfj +sevenc1qhxqhgl +flkdskjjzmqtcmljkone49ljffjtxhs9eightwopq +qhhktqkdfjzth5eight6 +sevensixmvvrzhsixsixsix9 +2241 +1xzjfpjkkcltvznzzfrh +jrvcznlvfgntthree5fivejqrheightwoxkh +lqxtk1oneone3rkfive +hqjbpqjeight3588 +one96sixkbgcx6zhmnine +eight77six +four46nine31five3five +lhd8two7dhthqhbzvlknvtrlfthreeninethreetwonez +5cdgllrdsspnninerxdphcsstt +s9twosixonezcrfmcd +dtqfrnrtdn2threespcfh +113six +onefkznlfjpkfivethree47three +f4hlxdlndqp4blmbzxfvone +czsdseven22ht9threepmfhdpq +7mdvchlcpn +5ssxkrgvhthmleight +seven13four7fiveq +threetcstlhfcqdfhjgccckcvk1hjlpmmkjmr8six +sljoneightg8fourfrsfbgfktr +jfeightwolzcmztqeighttftr3oneonefour +four7tdkq8threeeightfcgpddp +drj3vlj5tcjsfbzffcmmqmgtt5 +82 +jsvzmkqrlkkvfmdxjrshhnsixseven53three +seven1twoninebdpb4 +bjhtgqbfnccspgzbhlqgdzfznxhsixgdfkg91two +fqzrrbchbmhrneightclvd1 +sixeightseven1rlnlqlm +pxxtd793frjfckbhstcdhsrx58mksktwoneqx +zccxxqcfglnnrxdonefivevxtxgzgkh51 +fivenzrmrjfpjhxhkxthtkdrqfthree2twoeight +kzjn9fourqmglnxmqfivenfg51 +cxeightwo8lzqcdlmbgt5 +fivekmfkjnqseven9jlts4 +724dtlznnqtthreeeight54one +7ninesevennine +dj5zhmxtgsdpzlkzcbvnldeight3kk5mmvs +19hczk +3sevenhlkttqsqllsbplone +fourtzlbxhvt7ht54dvtkdprljj9 +fourmvpzqjnb2hmhc3zjvlgrxsm +onekqjtd8five +82rbnsg48twoseven +four352 +2rlxcfoursixczbvb9 +5fourjxggrtg9bmrlnmmhsgtwo96 +8nd2foureight7qg5nine +8twozx +rpfmg3twoeight87 +13five5 +one39six55ninenhhdd +9eightnineone +321fivefour +531sevenhxznfmdxnxfptkbcfpn84xtjrbrmbxk +5tqkzdf6 +sevenlnmnzh35fivetwotrbnknfive +qjqbcbhlqfive8mfmxdssvtdhq +threesixlxmhgzxxjxrgmxzqprl7 +24nnjmxxkbxjmmdssdpb8twotwoone +9four7 +9sixtgj29eight8 +fivebvzrbftvvdzd5nctrmjmbx5eight3 +4threedfzlzxfprzqpkzmlnsix9four +qbqjfbqthxvhnine99five7kgqm +pdvcpcdvjninethreethreeseven5 +ninelrsshpxvb32trfrhnnbkseven5 +1zktcvtrknt +tbxt59dfqzxcdj +zclzlgcmkneightzskgbg62five +vlhtm4gsjtcvkkprsix1sixmdkxlgp76 +vxgmnjsixfivesix69threejlrrcc +onefive5sevenfhvsbfpcxbqn1one1 +rlxrbhtwobmhfcgnmtg6zlgz95sncg +6tgsl +mjsjpone9 +rsqfmseven5qqhrxhfxf6twohnxjgh66 +xbfqgxkxmninegmhcrcmxgllktllbqpsvrfthree9 +2one7kthlnfive3kq +sixfour8lztglpvfv5 +bjcrvvglvjn1 +3mlfdone42 +4one5twoxqfcflcbjqsixeightdlknnzdbzlrqfkhvm +cfpnhsgs956 +xsdm7lhcjzk3hstcf +9fourcsjph86shfqjrxlfourninev +bgcxqff8 +4eightv51 +six6two4lvtjt61 +44kmn +rbgfivefive3eightthree +three4nhvblteightfour +2six64rjmcvvxshxjlndj +3nine4fourjclspd152rpv diff --git a/2023/solutions/config.py b/2023/solutions/config.py new file mode 100644 index 0000000..9fbc86f --- /dev/null +++ b/2023/solutions/config.py @@ -0,0 +1,6 @@ +from pathlib import Path + +BASE_DIR = Path(__file__).parent.parent + +INPUTS_DIR = BASE_DIR / "inputs" +EXAMPLES_DIR = BASE_DIR / "examples" diff --git a/2023/solutions/day01.py b/2023/solutions/day01.py new file mode 100644 index 0000000..502459b --- /dev/null +++ b/2023/solutions/day01.py @@ -0,0 +1,39 @@ +import re + +def solution(input, skip_spelled=False): + number_mapping = { + "one": 1, + "two": 2, + "three": 3, + "four": 4, + "five": 5, + "six": 6, + "seven": 7, + "eight": 8, + "nine": 9 + } + total = 0 + for line in input.strip().splitlines(): + digit_indices = [(idx, c) for idx, c in enumerate(line) if c.isdigit()] + spelled_indices = [ + (match.start(), str(number_mapping[num])) + for num in number_mapping.keys() + for match in re.finditer(num, line) + ] if not skip_spelled else [] + + combined = sorted(digit_indices + spelled_indices) + result = int(combined[0][1] + combined[-1][1]) + total += result + return total + +def part_1(input): + return solution(input, skip_spelled=True) + +def example_1(input): + return solution(input, skip_spelled=True) + +def example_2(input): + return solution(input) + +def part_2(input): + return solution(input) diff --git a/2023/solutions/main.py b/2023/solutions/main.py new file mode 100644 index 0000000..fc9d417 --- /dev/null +++ b/2023/solutions/main.py @@ -0,0 +1,27 @@ +from config import INPUTS_DIR, EXAMPLES_DIR +from pathlib import Path +import importlib + +def main(): + days = sorted([p.stem for p in Path(__file__).parent.glob("day*.py")]) + + for didx, day in enumerate(days): + module = importlib.import_module(day) + parts = [p for p in dir(module) if p.startswith("part_")] + examples = [p for p in dir(module) if p.startswith("example_")] + message = f"Running {day}" + print(message) + print("=" * len(message)) + for idx, example in enumerate(examples): + result = getattr(module, example)(open(EXAMPLES_DIR / f"{day}-{idx+1}.txt").read()) + print(f" Example {idx+1}:", result) + + for idx, part in enumerate(parts): + result = getattr(module, part)(open(INPUTS_DIR / f"{day}.txt").read()) + print(f" Part {idx+1} :", result) + + if didx > 0: + print() + +if __name__ == "__main__": + main()