diff --git a/.gitignore b/.gitignore index 5a3be1d..83d6995 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,6 @@ go.work.sum # Benchmarks benchmarks/ + +# inputs +input.txt diff --git a/day-0/input.txt b/day-0/input.txt deleted file mode 100644 index fd6e74f..0000000 --- a/day-0/input.txt +++ /dev/null @@ -1,1000 +0,0 @@ -two934seven1 -8825eightknfv -sevenoneqbfzntsix55 -foursqpqvv192rdrbtcccfourone -9jpzhpxqthreelmrnlhfqmn4 -onedpsckg3xdhmgtsixthreefivejlncszkxeight -4twofour -7eighttwo17fournsmrznntgjrdpkdjvx -573 -ninethree3 -3gngzkpkgrf -qeightwo2xjvfkfiveone -twoonej26 -sgoneightfoureight5sevenjzsqghg -bnrb36xtjd7four9 -threepprhsff3prbpfivesevenseven4 -38sevennineninemnfzklttkxnine3 -8mllzkfqklhonefivemv4 -onedcqlqcrzn66three -1fourjthreefc2gbtbdzsix -eight7two4258 -4hmfzdzf -26dsmdzznm7 -plckvxznnineh34eight2 -dhrvd4eightgxznhqmh -5fxhhkghvm3nineshpcxhtwo6fourhrktpbq -qklhmhmdlgeighttwoonetwo52five -86threemmpchhzdvsvxfzrj -9clvchpgrslnkhdmfkjmlrvgnf -8ncpdtspfivethree -gtbtkqcgvh8945 -sevencrkbt3btljpdpgstlf -8nine37bpkmtghhnc2hnreightwohvs -5qxmsrthreempcmpdcnnv41 -8threezrxhxgx4g -jhsb3onep1 -eight71rnz -7p16lrxktlr6 -8one5fivelvdbjzz -1nine2twodhnineonesixkqfcbgdlfg -four8sixfourfive -pjdmt4one8sdsdhhqxlqgzpk6qrtdvxm -sixzfourkdpmnn92qbjkjqfqpn -42threefiveh -5fhgzt8threemzhblb6 -bbc3kxhvbfrn8four6five -91fknhthreefour -six9fttmqpninethreevhgtrxklbvxbljsp1 -four5five1471mtfv -3bjkggcntwo3ptmjhmthree7 -four2eightone -threedrzktlgbz4five -dmpgttqfivekcdjbf49six -9bplkkgrxgjqjqb3seven -4861sx4six -hjzmxtxvxkkpbvgpvmgb4two8bqxlvponesq -lkxxtkctlphjfivepjlrg1 -xszdbbvxjrfxs2vrmmbfourpzcfmgppk33eightwors -966fourflbfsk3 -1bskshtjseven5qlbjhqgzhbzxvlxsvtcmmzseven -56two28cbhfsdcjsix2four -6s5qcmvjltqeightslhnzmvbfvcmxj -twosevenjxk6lhrkknnkq -kjkj2lkkldqbgzhglmthree9 -ftxhnpms1onetwoxg2 -three9sixsevenmrgggztckzgzv7 -stvgmjgnine2vvsnjhlzkstwo5szsbvzjdzb -v6 -threetwolscvhrlmm3r -two17kblkphfninefour6six1 -one6fiveeight9sixjzljjfknrhkzxr -dgpqm43xthreekxgspjzrzcsix -2two8fourpppb2 -fiveseven5four -5rttwofivefnmbkn8nine2eight -43threeninelgnpzrdtbc1lbkjkvqrdcd -1seventx -nctwonefourjzgskmxjmq2 -rpzpht2tdxczzfthreeseven -two1seven -6bjztkxhsixkgnkroneightht -9mqzkgmv4vxqrpf4 -49hlj -46gv -75sixfddn75 -eight87xzjkdpnnjjfqeight -9pfcdhxbcrnpsnmvkqnsqsninedgtlmmc5 -xmfbn34 -99lvrrndpqcnhznn -qsmxhxfph24three -lql25 -8five1dhrkm -twoninefourcxksqfmn1 -7eightdclrvn -one2seveneight3ninemcpnmonetwo -33fivefivenftbczsdstlxzbp -9r97five -5fivessskxvnt6qqbkkqrggxg9gsdtbptpn -threesjdpjdkczjgthree6 -twojqm86 -bttrx15qfznmdncnz5 -ppckphrtzhstd3xvthzrxxlrrjtk -qkm6ckeight7gnmqkltz6jsrgjhbck -zdjjjlpmjtphbjpm9threeskqrphxbfqqeightone -konesix1three -four24391rzxtffour -hsevenfive36fqrbjpfj7 -dxdcssixbcnp8two639 -hnvg2 -sixeighthmqkjjsix6tbvdhzone2vsn -dfzlxq7pjmq5 -5n3 -twovjcgxdsdngt2smfxfqxeight -ftpjlnvg5qshclfzqtc2eightninefivecsrgk -zzgsjsjffpvcgfmjtnpkrsqlmpzlt9four -4btrhpznzr8oneightg -pph2one -5seveneighteight -31sfrfrcgmseven -four7bdqgrhfive3 -nbrzbggpseven9prthjvknq -3sixonefourh -fourgkrpkzdmhtwoseven6txplz -four84ldbhnkxjph -6eightonesrb -gnmckftk62jgsjxzpk -bzctx9onetmcnzhxkrtchjgqxv66 -1three5 -27two -34eightwox -6ndgrbmfkfive2ksxfbnjbl7fkrm -kxpz4gjmgcgzzq63five -nfvmfrbc151one8nggsdqvm -4clnctseven5nsn5 -hcrpbvqmmdbstlxccthkththreebm6 -gdnmh6cslzhjhdl8nine -sevenninethreefive4bgknpbnine -2sevent6three1 -2jbrmdxgpnine7 -nshlgtbkmcmgkmqone3 -dklhc9sevenrxxzzxltsnlltqcjrbgprnx -gmrjhlvzppmklnl39 -kv86eight3dcdpp6pmdzcvsix -fiveseven2sevensix6952 -3xrtthnsevenjxsxpzvc -256nmzrlzbczv -4dp7onesixvpcf -25onesevenonexvnst4smvlfszcrv -lcxncproneseven37five -ninezjsrptfivenhsqxrdz7one -cscdmnfrcxfqdtkmhkldgjlxdjqsxslhdzvvt4 -sixfnjnfkqm67blkmnqtwo -fivethree7 -2five5ninegcmqbkpp61npkpml9 -3qktrxninefour -qdhmxstwo44two -21nine -rbnineone3xppvtbmv3sevenvxkkgmgklg -mcvzplmpvptwo38 -sv176threeone -5vksixqsccgdkrrfourcgnpsfxbvj -xxtwone6eight -threeonespkbnsj9onesevenpz5 -fivenncrfvhfdsevengxzkxbkrklgsfvllrkbx4 -69kp1seven8dqkrx -dmb9ccghdjjpjxfivehtwo4 -6nhgdkpdone -tfvqdqdqcszxbrdmmrninesct2 -8sevenfour2eight8rskc -cpmgffcvln9sjdsgfivesix5rppfsfmmqtffive -5two7 -7threecrkljthreetwo -6qgqzsdhprd -959zgjscgtm -fourtwoppfrdqgtseven9 -8bbchvoneeightr -gtddrb1rznsdjtonethree5four -8rrskfzlmlbrsninezdzpt3 -6njhmkpp4onefive8two -4cqpnkcxjtwoqzqmjnqccfs256hcnqpfm -nineeightseven62sixhlxlps -dtqplzzf87threecthree -mqptgzjxddxgxpjr5 -9194jbjjktwofive -five514foursevendzxlh2 -6nineeight85zvx -four8gsgrstfmdv99hpkfgptzqkhsmgsnlggrseven -9three298 -3fpttzk35 -rbtckzonexkqmfxrnsbsrkqbq66sixkcqfzjfour -sixkdcrrrppcsix399fccnsbhfxvfiveft -xfjxbfvmbxbf3twokkcfrbcfbmkmhghsbzf -9sixonesix3lqqf9 -eight3fourgcmp -xjccxkhkvgltzqslmseven5twoqhcmpsixeightnine -62eight8 -hzhccdkxb336 -gcsbmkdfmqvxtfj81 -two445nine -xhrkgql8six41nine1 -5dnlcsjb -jdqdg8gtgrctwo4fourthree -five4five -3threecggvthjv6 -sevenzrjzqhgtvtqvkp3three5sixhxdmfour -2249eight6 -drt5trhdjqf3fourfourkfour4 -5oneone1 -threeseven5six -45bclsgsqx -6ggfjqls -rhpmhfournrzg418onevlkcxxdrd -fcvgszpsixthreegqqctvdqnfrbnlbmknlvgfour1 -twoxvrhmxjbbn2eight -27eighteightsevensix6six -veightwosix54bcvvtcgbqfzprp7four2 -9kthreeqntgvbb34693 -zxcdmfg48ftlhk -1mhcctbmbzmfivefourtwo3 -two6vxsdfhgstslsix -threesixmzhvfqsix5xhrhrvsfh7kpcrsp -oneggkztrmsgrthree536three -7seveneight81ronesix -sixllrjlqtffqvtdjqhctt66four3twoone -2zxqpgmgz -7rfngpqkqgfivetwojf -vvbfnnine3ngv -59sixninelmhmqchlthkbpthree33 -1three6seven1seven5qntpbnsfour -7nfzfsdxzfive8fjvllc4 -56seven5seven -1fivegqbrdgths -four32vmhvnk -hvdjnmpqvqbnrcrclkgkrfseven6lgrvthv -28xngctrvmnc4ntvxhmxfsj13 -onep1onecjjmxxtd -9eightwof -hzgmtfdj8nine7seven -eightseven3 -fivepnhlninefive1lcftks -122ninelrgmdgmqzd -zjsix3 -7rffvg9hbjpx -3h76 -fouronessbhxlcclkzmnnbksixlcdqtf3 -4fivesix228five -sixrlthree1bzhddfbkrgxpgxfivef -dxgqnkqfgq8 -onemcfourbmkhh5px -fmtqjcbxznine3three -qzkcxvnffg1gmhplhlffgtwo3onevg7five -twokj7xv63six -four58 -fvjeightwosixrbrgnmrrmdtwomseven69seven -5fivefour -6pg8twomrqfzkxrthree9 -7xqtqfrpprlvhnthree -l35sevencreight4 -threechpctdgtq8fxspqtnvggkxtmeighteighthdgngnmc -one16twosix -threetwofour3eight1pvgcthree -229 -ngcnthreeone7hqbbntqxeightkgtc -qtgkz1ntone68 -nine2seven -two1jjccnlrqlsdfvtgjmmhh5prfpcc -onesixvtbjgdqmtg1eight -77qkvdszsp9ctqndxzrjc -rnldvcmks74355 -fourkljgznpqntwofoureightlc3zmljfnqnr -8threetbv6cdjjbtmmxcfour4qlqjql -jfkvbvjxjzk7 -7eight8vhsdrd -onezdgffrmz2 -eightseven8 -7gjdsevenjsdkljn2fv -kmst4 -3five8smctrhdhfninelzbrszmbdm -fiveseven4ninevdfive3 -8jg6nine4jmmsbpbnskoneqxgjrphhf -mgfourfour3hgmrzkntjm2hxrrfsghnone -ninecqmg72 -ldthtljblpl3fiveonervtxnxczfx2 -9sevencsevennscmbjgthree -7lnj9four -fgtwonexmkvkcgpq36sixsmfnxjs -qgmfmnh6twoeight -56sqrseven -183877 -ntt1seveneight513 -7three6dzdrs -8sixsevenfour -mzfhdnhseven4eightvjsdnxlonenfzlcxr -sixzdczsbtq29one4eight6 -jmxcbmktjzeight5fivenhtzfsdqbx -four2rvlppone258 -fivezvlqr236nine -262 -58six2nineone5 -twoeighttwo3ktzhmdvlx -64nsjgqsqkhfqmfk -foursx18 -gklzjvvv93zzmzgpn -onenmcvr6 -qsnmlbmlr6 -sbtwonesevenfourhgltwofzhzmbsrfm6two -8fdhxeighttpcjkkmgsgnpnvsix2eighttwo -5pvxnxxdfourfour75 -85vtsgkn1kfzkszmbld4cpgrqsfive -sdbzkzp1dq5lk -28161twodfznxckr -xfpgnrlfour61 -kzkkp65qtqfppc7f9 -twospplzdrdfvsixsnldtwotwo29six -9fpbm -3one83dlvdr -9rvbtwo25sixkzlxfkg9 -8jbmfbfsxrnxk7oneninesix -3798 -jhcqmfive9 -nine35 -596 -nvzztnine2vhhchqkzfjzmkgjbzlxhvtdhddnr -5bltnjlmt12threenh2 -eight5sevenninepgxvhflb4eightmxv -xtrct7fournfivefourfive -dhbpsnpxsglnt5vsnclxhnntt61two -twoonekntsmsd81fourfourfive -gpnceightdx5pklsp79x -four5fszlnphhxvhgbmfcdkdbgbc7 -xbxtjllpr9threeninesixbbtkn6 -p7 -nine644two5 -5zzzlmspbcx9vfdllvqtl8five -four2bxmrthree -7rhgfnzqbpgmpnfz -threejhfmbmxzp469 -74ninebmtpfkzbcg5nine -fflpg34two25lvnmxvqlv -jtqtnthxqflp2onesix39 -9sevenninefd8qpfiveseven -28mb5 -lflcphkxqqnzhd2five -3seven4fftnss -ninezxhxqxxpblm9 -4ninevgpmxxmqlf8 -sevenfiveonesevenfjccpmnnninesix3nine -qmkvt6pxbdcbrcsrgppzptzchkmone -2sixone -6dzskdbknpsix -twonpqfsvbmqgeight23ct -4sevensxdzsfbmmmdrdjtpbh -sxkpmmhsix9five7 -fnxtgfrltwo67threepvbsixzvj -54jmvmdbkltqsixtmccscsixeight -6fivefourrbshbc82jrfm2 -dhlpvhzhms6 -419bhbcdsvftxfvvkxcxprksjs4 -sqrq17nine -84rjcbktz8hrplcqsvhqqnnqnsevencjhone -gkmljdk2dgrlptkxdsix3four599 -cnjpf818sevennine -8cvg -3jqbbpfpxmpkrhfoursix -9zkrhbmzkbzlcnxlgdsixthree8 -nine9kvxeight2zqvzhgjzjz -fourbglmlqzgvzhjrmz2nzqxlqseven -seven4five8nine44eight -onegnine6 -qeightwosixfivesevenzmjfrqvnsbnqlt7four -eightvrshp9xnxlgqcnninegvbj -ninelpbvs9three8ltzvxnd4 -nmnlzone3grqbzcdnpxsbcbzxn4fjptnsrqsqgsdcv -18fourcqfive1gccxg -gfglone6bqsqjmlftcqpqmmqmglskzfourvkhd9 -5cxgkn1g -29seven9ppr -fiverkmhxvnbp3lvpeight1one -77four5dsdqzvt -gvvpbone23 -twolrjs56one -six2745six -kbxplzpsixsevenseven5one3 -threexzrcfgffkjsix9zgdseven56 -onetrqcfl6 -three23nine -four2mv -xzfnzkmeightthn6twotwoeightqmf -hxxxldcvj99three5qgmllbtrsq -6zcszjbrzjpgrvfivemnzkpbq2six -6zvtsixone73three -threeflxtwo5fivefhbjptgfjmgbhpmbjmsv -5nineeightfourd -five26five7sixthree1three -fzvsixsix3mxxhseven -twoccxdqqkdvc2two9ps6threefour -447lkkoneonefour6rx -8seveneightwox -sgjv21 -soneightkmtps8onesixvpsdcfbbz -8pzrtoneffhg -mmzeight631 -5fonefive -foursgx8fiveltczmccpzx -sevensdbhnpmjninetwovlv1three -64qrjdtpxbxdbcqmmlqtnine6sevenfxhcrjnine -1seventhree -ktmfour3 -fournine8skzxtftwo9h9 -bjq8 -mrshhhzsixcxsxxmbh1bone9fivelsplqv -7threezvgxdvrthree7227 -znnvfive5mctxdfive3j4 -five2three8 -gdtdqc9nine1 -three3eightgnsxrmbmxld9six -zsgmcpxxvseven7onetwoseven6 -8n3919hfiveoneightf -3rfrzmlfsjxthreefour -dnnshdvxdl6onendg27 -66lpbz -sevenlkjpxthree5 -8clqlplvljone5hfh81 -fourldvjsixfourfour5xrmcnf -9nine2 -4one1 -4vzjgncrztvstcf9one4 -four37 -4sixlqpnqxqtrhpc3 -8threejzg -znxccm8 -one8eighteightkcvnqjpsp6nine -fivesixgc74oneseventhreesix -5twohshtsdtqk2 -hzmchfourvzjgnt2threetwo5cgfld -one9three836one8nk -ssslsdftjfgkpzkln5 -xhsxxkzk1x2tzbjthsnsix -8nineeight3njq -ninethree5eightbfour2 -five56sixclxjqsjseven8eight -three3cninenz -lt3onevpkgsixsix -4pkbmgtwo6zmvn71eight7 -2eight6cdd83 -5kvp3zhzq -vtcmdkkcmnmf1two -nine2nponeoneseven -xm1twofoursevenfoureight -ggkvsljtddcmznlxlqb4one32oneightppn -onehdq785 -vzthreezjbdrlvhglbbcvlfk5 -eight9smt1sixsevenckqxlbvdzone -one7fdcbzjtfhbps9oneonetfftbneight -3sixfgqbsngnd1zmqbxfllbp -roneight28one8fpzmkhvdhbqlrfive -4five2four453ttlvfqxb -five2four413hhnts8six -xlfpxbzrbphb3one -eightone8nineeight -1zprfttxqmtbhzckcfoursix2threenine -7sixzqrjxn92pnbfxzbrnmvrnpjpdone -pvlfeight1xkgrvczlcfvvl8kzcktkjbj -four7phjzlzn3two3two9seven -1tkcdvdtj7nqfsrnmfzghmkrqeight -36fourxfdgrprrdgmjczxb -five5fivefdkgnkfgd5 -5seven5sxlkbldznz53three8tmkzlrt -8dkxkfvjkprxtjlh5tjvjm2glkpbmhjd -seventwo3 -bgssljzld2one5seventhree4 -sixfourrqzdbdhhhc7lkxqbtsseven55 -6threegtwo7fivesrbvfk -2mpxkrtjphdseven -14seven9dkk -85dmtjqkchp7two4 -hvqfbchqhpbggrqhf4ps -dzdknbdceight72fourcmfvsrzt -xmvgjjfourfourmjmkh5onefive8 -qdfreighteightninecdxrtdbd7 -mxlhxlbvbndqfzmseven34four -432three5vqhmjzgvghnhhg -ghczftpkttwo4sixoneone4brf -kbbzcpsqsl7qdlgff5fourfive6jk -v8nxzpjxntcbtwonrcgztsthree1eightpfdsp -7zjdzbnrpltfivemgcsjzrdjskhfmbgvlr5dl -9kpbzzr -8386six3mzh3 -41nineeightfive -twotwo5threebvgmmhqrlqltqmndhveightsix2 -58drxrgkklm -8two48six3sixthtwo -eight88msfnone87nine -four5lvxfhktrconexqzqvl -six8mrlccbeightonejnzbdkm4one -oneseveneight366xzqmnmfvvrph -joneight7nine7five -5fourtwo26onefivegsnbcjj -cpjnvhnzxsevendbnblfkpx44lzn88 -zfmdcsfkktwogxmrsbtwo2six78 -ninetwo59foursevenoneightsx -vjbbphb5dddvksevenpmnmtjvzdvxkkbcqxbb -9ccgtrznm4 -zplpfivesixkjfdvrv6rfmqk -hfxhpsxgxjfdbfmjb6one -threethree9 -six3seven -seven286 -bnkrghgbkzdz29two31 -gvlzrhntvseven3 -twosevengdkzgv6 -rddtz12five9znvtsljztbztprthreeszkfhh -nfivesevenhfpklnxqb4nineonermtfsk -zzz2onegpthree4fdnqxrtcnh8 -4xchnsevenxnkbrdpzsnine6 -hveightwofourfive8 -8one3 -7chfpsbh1two -two2eight5gchbxqvrmdfqvghtnjssix1 -zfbeightwo3 -qhjnfxpfoursix9five -8fourrbrrjqqph -five5threethreezfvskmsv76 -sixvtjnktt4 -5cndcht2fivebdnxcnzzmfninenineqzktj -qfzclldsvzvcdqfxhtqqtknine527 -onefjrmmfqvgnxnjdtkdmk25zghnp -hvddcjnoneeightnine9eight -9lxpszk -17fourfiverfnbmkrxlvone -qxvdlrxq89vf -qeightwotwo2 -rzmxzgnzljzssnxscvv9seven2kbnineseven -sevenseven8 -rkhkone8four -zn68 -5pvfjmjxthreeninevtj88 -51dtwo5ngvxnmjeightgbhzxbd -two6kxkvscbxcg34six3 -qbn1 -hgxgtwoqtmsqbv3 -threethreejmtjk18two -sixone4fourseven6zcgpdqps -fiveqptd8gtjfour1twothree -89fivefive4 -sixvnvmdmfeightcbbvbrkffqstwo7 -three4fivefive5klxvsbhslzsix29 -two9sixhncrcvxmf -rsp146 -eight2jtvps -7four6 -77p1znpskm -bbdvfhqmxddlsvdpmtvctnine135 -dlclxtkxk85bn -bxbjslnrfk6 -51zfrtvmcbkkrnd7 -27fivetwobbssnklg -twojxdksqkm9ninejninekcbdgnsq3 -nineninebsbd8 -sevensevenggddbfxqrmonethree744 -srtbzcbsmfivetwothreejvzjzxqm1tjnjldcxnine -nbsix32 -25144spnmfvvj1dxpqmhsldk -5two4mrqnpxzs7foursevensevenr -fourk9zszmnbvmkdrz -lpqseven2seven -hcjgtjcxh1dskx -ssrnf2ninenine6ngbhfhdqsnine -cz82jhmgn14cktblcl -kxjzflkkbx53nine62one -hbcnpbmfour1two -ckjksxthree346pjtr -ccslpmqnine27twodr -cptwo5twoggmrjvl15eight -4vlktln5kqfsnvrbjbszqzclmnkxseventhreefive -one2eightwopp -2sixsixone5 -klvsngvv38tcxvhpdhh5 -fivefllgljkdg9ndlkpbmgbrndqbpxqdk -7ppkvstbtnvseventhreessd1three9 -threepnrcmb3 -thrqrcmzpzt7nine1three -jvgrqgbcshhlnqrl2vrlppxbnjfrdtwofbsdvt -rnhninezxbrlmnlczqnneightsix9one -ghvqdxkqqfthree17 -dthreeseven2 -rkxfthree7nmfive6 -6vhnh -13brdgbrdsvthreethreerttfkr -ninelgfdc7 -88z9vzscqthkgnhmztjnhthreeseven -1nine3mtgrfive8nine1 -thh5fivezfmtlsnvtdkfour34 -26six6cbjdssevenq2tl -gxxnhsxqvjcvssrbrhbst6sixvcchxstbpb1ppqdbx -vninexhkjkmzvhfpvcd7ninezzldthree -2twozknrxvcsj -3193spfourxcbdnf -84six4vc1eightsix -zljb46four6six -sixfive2seven1 -1fbmq9fourmhbzzkhctp6ninenine -onefourtworckjqzhqseven5seven -five973knlxmtmdone8prtqlsltwo -2ncgbgpq -3eightthreepknbcs58three6 -6fivesrgqxhnzfouroneqpmgpmzgfoureight -mphrj33five -8sixfives26sdscdjtpchmh -four64mtlxmnsjbtdkpmf4 -onefivenine9nine81two -vfc9nqttbmbdkonegclxcgbxkx87t -sqnzdrcs8sevensix6sixdjcmk6 -7npppqmrmblzjqckk8fourbpxlbtwonine -nbkklkvpl2smlqbh -37eighttwo17fh77 -eight7ninekkbvtwo -eight18cmzzdpgl5 -sixdc17nine9ghzpdpnxcbxvztcrd -fourfivelrmch54 -jbqbpzxbbdfiveeight9jnzfdh5xfmhhrkrkds -146two6fourclmcllhl -222dqgtptqqn -gvhninesevenfiveonefcvnlmfcvjvf5 -9xgljlphcxeightfivehpdlfrmd1fmqhrnvbzboneightjd -8sf3five6eight -zrprbc8 -gqb6sixninerpsrpnlldteightgn -2jdlxzk -hfrbqn4zbpxqb81tlfxgxdvzz91 -qtdnxgmjjstlc1nndsnbbcdm6nine -z7twonezp -two17sevenljskthntjzxpkjrkc -fivelvfive948 -sninehxqlkmv7oneonedbdvztzgh8 -2fourxcrkrcvn -clh4four5htj -hdkx4eighteightsix1kgtbb -nlbsqhkltvmzs2njschfbmsl3fivensztjtwobxkfn -fnrg3837five -vxcldjmjxxcqntqcqnninefivestbbjvptfvkbr9onetwo -4six7two -8five5sevenslfqtblfiveone -26ninemhvqkjgcvflplncfsixtwo -7eight523 -9fiveplfdp1qhqhj15t -three3eightrzvccr4h -9vhmkkjfhtfjtwotwotkfvlhvs -vxoneightczdfl4 -3one2 -threeeightfive2four -gksfxtb4 -1jjgdldklznbktwo59 -761sxvprrzj2kxsmlmtpbqseven -681q -84ctsbf1six -fivetwomfgplcfgfive7one1vgbz -rfnqnnmsdcj6foureightfjfkphqpktwo -9vntpmfsevensevenfour -7zvchbn6two9five -fourseven7 -2lvtkkbhtjeightfour89 -5nine5threemgsd -933nxone5threeone -2dtbbmghgxvkmtvnlgsxjlgbc -1mcrlzhvzrc2 -ftwonegsndgxmbzn6one -916vfvzvh8twolvhvlc34 -dtk7eight6c6 -kbhjg6qkdgh8rqlmstq4 -eightseven8 -bhlhcphznb92two -q8d -375sevenvhrhkbtbvncmqqmpxdhqzzggvr -9onefour1nhmjb -hqckpzrvgmgqjmvsrjhqx8twodgxkbh -5grdsbtp6onezrkdvpdqt2 -tdgkr4 -foureight24 -ktds45zvjd -eighttwo58lldklbmxn91fvlqllnxl -threefive3bdmfbrhfklhxjvdgjxbp1 -hqpfgvk56oneone8 -two32fivetwo1nklfhjfffthree -77jggmjkbqone -6fckfqeight -fivetwo8 -7five7threethreeb -twosvbzfmv1fourtwoeightsixfive -ninehninebgjnknth5bhzqlvthree6 -onefrdv3one1 -five35 -four3three3six9four55 -xbssqpvjnine9six9threefivetwomjdvmpxrh -ctroneighttwofive3npxgbhfsix1rjnl -8ckbzlmsbfxdn -51gckxqqbnkntmvx1ltfmdvnlcjnine -eight7gkql5 -sixjghxscppnfive23284 -eight7pgqxvsix -46eightrjhgdmvf5 -four4bmjzzjqp1rv523twonevm -3sixseven81oneeightwocr -sixmmnqkrfplg7ztrpsixone4six -1sixfive5nhrq9 -six8threeoneckbvqc9mzhb6nine -33sixdfzmds12jcvfour6 -1cdlflvqhrkqpktdnnsx7six8eight7 -8four18 -tpfourvblonez8six -fourone2smjpvclnine -99zdtdpbbvhnninefourvzfmzbscdldhxtcjfh -fzjeightwoeightnineseven6 -twonine2 -fourseven1eight -2x3one -qbjc1jtnbpdbr2six3 -sglmt84five5nine -sixnljjqh4foursix -4nxjgs79six -lhkpzgzjr3z7 -onefourflllxbtkpvgfive2 -sixrdr1twoeight165 -1dxvjdhzb76915 -44pxzzttvdc185txvrpxq -4fourfgllhzfz -nxssptkdldkpchnseven9522nine -nine7fivefivefffvqpvsqzsvnvlzfvfs2seven -bzphzhgf2xrlqjgonefour3bclmhtlzbmddrq -vsxf7eightzzndgfourfour -rqbhb14eightthreethreevkjzhjlkcmfive -sbkrlm3nine -zkzlqfbzscndtlmn14four9bsscd -six33 -1gbcgnpfnseven7plppdqone3smljtjlkhj -9jsmdjshtzm92stx9onesd -51four4two3one1 -bxkpcpcntkflxccsixseven1threengtrrp -4dsdllkqnpxglbseight -7threetd3onefour -3vcnzndxfhfzvncfivefllrqvndtx964x -nineeight1eightgqnzfhqkzgvfvctwo1 -6fourthreeseveneight -eighteighttrhtplssvjnnkkreight4sixoneseven -43hqrtctwotwo -kcxfvhjksix3six2jbkrlmtwoseven -43sevenpvqh9eight7xcbvnckrkshdx -sixfive3745three -hmxfmzqdpfzjjzdxsix8472qcpbrsgx3 -threelnzgs96five1 -1dftdbtgjrpfive3cztvmxkcxh -pmrfive4jxfxq1 -eightclrzz981492 -mscl2eight3 -twovb8four7sevenfourkmzpdmpgxj -59onefourxnmptgtcone -6gsvxlbqspvzpsq -eightthreesixtworcmpjkfvnsevenseven1six -ghmflkhprkthsix9 -441fourfcvxonefourhg5 -four795seven -tone11 -22seven9two -5seventwo2 -fiveone6h -936sevensixnine1lkp -62kvhcg -six19 -td25 -9two2four4fourmeight -one6twosevencrthreeseven97 -1kttqbqkzvvr7265six -65rzmfpfqjtzb11m1eight -seven1rrhpxjqtp -plktlvxkpkndhx66fivefivexkh -tttwonefournine9oneonesplmp5d -gkbl1fbn3two97onetwo -1seventqngll -dqfiverscjjrk7 -4sixfour4onethreecvbj -24x6qhgtsxtrfh -h6 -fourfour3three -8hrdbnvxgndthhpmrgm -ggzjfour8pxdlpx -rnsixnine9fivensxfzzgzlseven -sqzseven7 -rcpkzht5 -jxhtrkzl7eight3eightn68eight -eightfive24 -kgxv7kclnsscsmqtnmv -foursix2chgckldprp3zqntzscxfc -sixsixfourone3tnbpxbmgqccncgxxnine -oneeightkgsbdthreefivepvrsktvhrnine5s -4vtpzghfsj -7four1lttzxpzcbtqqdthreek -five76 -vlqvvdhhnfzfssvthree3ccsdjhgc3seven -2nine8six -lddxjsczqkd26g5jpvdlfour -1twotwofcl -sltfz55knrfvhhbbeightsevenninesevenfour -27155bvv -dxjzmftwo2vnljlsthree3three -twoqdpzhjhbzksix49dhdfq -three2fivenineqbxkgfivefour -qnpsfq8twoonevsjffive9 -gqvvmhxgx6gdsqmgccrmzrzltwo81szbnbkxt -2one1czgjvtcgxfivenqsfourthreethree -ppcspzrnnssvnht9hdfoursix -mmqrzdkmt7sjqgsrq9rhxpgpsixgkjflnht -57foursixfive4fourfive -tjrfj3qldspjklvdtcb6ninefivejmbntcthree -cgjnhsixsixsixfive7 -eightqdqgjppcfive7fivexznfsmtk -fivefive864scrf -six95five17threeslktfgd -77mrrjzc1cbnkxfkxcdmxsmtwonet -sxmsjccjrseven45 -kjpsn1eightccctxthreevvffseveneighttwo -5twoneqr -3threemvlqpvhdqgtqseight -jqrxrqlz93ninesmppvdhtxk5five8 -threesixsntqreight593nine9 -fouroneznpfive6qmn8 -eightfive3sixxrrjgzlb -gds345twotwotnjrnhjxdz -27nprk7 -eight1three2onefourcfctvmhnqlfour -1fourvjgkpdrsj4kd2ncd -nine85ncsqbrmdtxbtrjxgztq -twonineeightonerdnkjkrbpsbzcpone5 -nine8lkkvxfvlsixseven -49three9 -jqmzthzjjseven5 -seventwo9z7four5twohstlzjx -bzvbvsix7 -2five4 -fourthreesevenfour2nine1fivezspphbmjv -7skjhonejhklktvzjflnineonemmgvnnine -pmgxshqpjhn9qptllp -2nine5 -fourqpzjrtttssthsxsq1jkrlnkk -eight53njhcfhbjfthree3ksgrrj -cgmvkqlcgzgfqxmgkfdzxxnxjgsd6eighttvggmfbdvztwo -onefour8txkkpvfourzbhpsnrzleightseveng -49z2six591one -768five -xgkfonethreexnlcptbgxhnine4fivetwosix -6ghccxxjponelmxeight4 -3ninedlkvcbfmd2ktmjxsgdgr -3threefourxcgnxhkqkjbdzb -49eight44rlhg83gktmtm -fnbnnpvcthrsjxnqdn9 -ldrfhknine3394lgvseightwoj -zmpsc3lzlkmqjc5eightthree -llpmmfsmt8llknhrn -onedvc3sixxx9four -148eightq6 -95one9sevenfourfour79 -one9eight78gnrthxbn -95xzzlpjzqdtonezfntwo6sixf -eight1sevenn8bgnmnxbmdk -1sixseventhree2 -twogjprzznd9sixsevencpfbh1 -gnbtwomtltppkxxtwonlfxsbzjtt4bjlfxlqhlx -three5oneoneqd3bcjgl -pzngtc2four4811 -nnlqscgg8nine7vst4three -fourcdqc7vvqhpgqlkjsevenfivefiveseven -5sixtwo9sixqmxxgjvjqjtworlzpv -6dkknsmfmnq -2two74five7 -four3vvfskp -qqvpdttrfiveseven6 -tbgeight8eightsix976 -sevenninetwo3jdone -three6seven7nine82 -fxffmkjn2sevensix -5xzbf4bjqfrfourpjhscxz -5eighttwoeight7fivex1bnfpr -1j3262 -two1fvxchkcdtqctph -vgnrqn4three -plzrk3tmqpxnhpkq6four -four5eightone6threedbnjkvjvzxl -bxcqcdnjjsz66gnxbhcct2nfhqlbs -twovvqb9pxrxkmflzqeight -86 -eight9eightsevenone2 -dclk16seven -lzs15four -265ninetzpnbxzllkq -ttldqsnineffpplcxmbvknkmtdbzlsix7sbkvqhn77 -eightgxzcjvgmtgzc9gndqxbxnsktvp -mpqxldjnfive1pzvxbqqtwonine -gzbczdrqkmtm3lzrhnf -mlbsfqvrrtcrvhjjbs5 -fiveljrcn27 -bvnxlsfmv6eightnine3rhsb -five5five -eight31zztkhrznmkbx2kvzl4eight -fvccqgfzsqfour453125frz -xxf5threefourtq58 -stvfjpj1ggnzgcfzldd2hbxmbgtftpskbtqmgv -11cbcps6 -dltxch6onenzsmqbfn4onezkdntjzpc4 -4eightthreej7lpqbvzz -sevenlgonexmrmtfhqpfourp7 -hjjdgtldrfivednsfdnmn24vtqgxk -41tnjbxk2gghb -2eightwotg -eightkvhkzfivesixtcnpsxssvveight2 -59dnmmpone6mzqlnf8dvnone -kfvqrgv87trlninedf -85bnxlhdrmjt -zvzxt4pzlnbb -jfour6lpvvvbdn76tbblfqtwo -lnqpscgkone1 -mcnfzmvzkxp1 -threeseven9onepvqhgdxcxmhtkxxvlhqrnine -sixrzrjcmbpppcvf1bvbhblrmz -6tzthree7sevenlm9 -four3gkqrmpgnjltwo -threetctttrh3 -ctcfljkgm7bcphzxzjj7sb43zdkvkddktwo -sixzjkxlfourhqtwonbslgpt9vljz1 -sgz5 -vrrfjbjpsevenzbqcnthreelhxjqmdd2 -sfmjnbnnpvthreedbsh7six5 -twovdjqdtrxg5 -nineeight7five -4xlpdvlvonekqmqvcqjsevennsd -fiveblbxxjcbhxvnkfd9one7twoninebj -xdxp54sixseventwo -onefive7 -ppgsqgjfourfourfivegtbrlkdvs1jl -twotwoeight6sqlmffdm2three -cvszcvq8eight -79three -44fivembtdfivetwones -zqkthreefoureightthreethree2five -74twotwo -six6fnjz1plxb19 -mkfj72nine -seven1nine5fourqsgrj -5fntdgbzkjfhxlqrzcq7 -six9lgddrhjc9 -1zfzp7 -2lmncxvxbbsix7jbjrjsnvx1nine -6eightseven3 -5vsqhnone -xoneight3j -1gxvbbhfdmsthxgrvnm -sixthreeone13 -2three8bzbbd -3dsix1 -24kmxnlpqxgpsevenfoursixfour -fqpzqphmczcvlf2mxqvxnfqxthreeone -eight789eightnhsh67 -zznxlmhgr3eight -beightwolgnb4997fgx35dt -four1dsgpfzltwo57threefivetwo -xnjjvmlkkgsht99 -1sixhhqkx9 -eightdhmgqjflthone44eight -9ftzbdsdkd9plrrtwo -vhbvd8h -txxonemsfshdrpc15onefive1four -qgbd4eightrqxlznbjqxmxgmbrnvh7jkd -eighteighttwofive5jsqkgm -89hn -3lzfjpcthreeonenine -hkpc2sixdfldx1 -3two72jbxttzfcv -mmkjmmlvcxxvtwo25nine2 -8751gphkmsvsjhvkzfc -one8kmcktvzgdninegkl -twokpxphkbjctqdcvf63one3prfive -twotsxhbppfjcpkdfourfiveseven8sixn -3fouronebnclssixfour6eight -cmdgcsix1 -2eighttdqsjdrtwolmvpxqgxhd5five -one7ninefivesevenqvpf5xmccsseven -2n7xbptnkxzcninedhhpdcsqkc -5n -1kfv4821 -pslpmthreethreeone29tlmgj -sixsevenlhn1 -nine9twoqrdgdxxfsevenmjseven -rkrdlnjknine62 -f3 -6zzrfxdxseventhree -265one -seven3lbcvjxqhhdpzkttqsixjzzjjbclfq1fiveeightwojx -seightwoone8qxcfgszninesvfcnxc68 -strqnb5eightbpnkcjdz6 -fiveninebtpbpjqbgx2bmjrgmprnd -sixgtxr2fourrdkjg -fivebxsevensixone872dlx diff --git a/day-0/main.go b/day-0/main.go index c5ea051..dfe261c 100644 --- a/day-0/main.go +++ b/day-0/main.go @@ -1,23 +1,25 @@ package main import ( - _ "embed" "flag" "fmt" "log" "strconv" "strings" + + file "github.com/shaunburdick/advent-of-code-2024/lib" ) -//go:embed input.txt var input string func init() { // do this in init (not main) so test file has same input - input = strings.TrimRight(input, "\n") - if len(input) == 0 { - panic("empty input.txt file") + inputFile, err := file.LoadRelativeFile("input.txt") + if err != nil { + log.Println(err) } + + input = strings.TrimRight(inputFile, "\n") } func main() { diff --git a/day-0/main_test.go b/day-0/main_test.go index 7f0c95c..01ae254 100644 --- a/day-0/main_test.go +++ b/day-0/main_test.go @@ -2,42 +2,51 @@ package main import ( "testing" + + file "github.com/shaunburdick/advent-of-code-2024/lib" ) +type TestDeclaration struct { + name string + input string + want int + run bool +} + var example1 = `1abc2 pqr3stu8vwx a1b2c3d4e5f treb7uchet` func Test_day0_part1(t *testing.T) { - tests := []struct { - name string - input string - want int - }{ + tests := []TestDeclaration{ { name: "example", input: example1, want: 142, + run: true, }, { name: "actual", input: input, want: 52974, + run: file.ExistsRelativeFile("input.txt"), }, } for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if got := part1(tt.input); got != tt.want { - t.Errorf("part1() = %v, want %v", got, tt.want) - } - }) + if tt.run { + t.Run(tt.name, func(t *testing.T) { + if got := part1(tt.input); got != tt.want { + t.Errorf("part1() = %v, want %v", got, tt.want) + } + }) + } } } func Benchmark_day0_part1(b *testing.B) { for i := 0; i < b.N; i++ { - part1(input) + part1(example1) } } @@ -50,28 +59,28 @@ zoneight234 7pqrstsixteen` func Test_day0_part2(t *testing.T) { - tests := []struct { - name string - input string - want int - }{ + tests := []TestDeclaration{ { name: "example", input: example2, want: 281, + run: true, }, { name: "actual", input: input, want: 53340, + run: file.ExistsRelativeFile("input.txt"), }, } for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if got := part2(tt.input); got != tt.want { - t.Errorf("part2() = %v, want %v", got, tt.want) - } - }) + if tt.run { + t.Run(tt.name, func(t *testing.T) { + if got := part2(tt.input); got != tt.want { + t.Errorf("part2() = %v, want %v", got, tt.want) + } + }) + } } } diff --git a/day-1/input.txt b/day-1/input.txt deleted file mode 100644 index 9739f09..0000000 --- a/day-1/input.txt +++ /dev/null @@ -1,1000 +0,0 @@ -15131 78158 -32438 35057 -12503 57702 -73808 43128 -57168 71761 -97870 29344 -18072 79079 -55097 92997 -36615 67927 -63626 85851 -19535 91599 -20386 53482 -32817 55364 -90111 84813 -81180 13958 -20278 82963 -71822 70030 -36650 74064 -96658 93643 -48953 12223 -87910 32104 -15586 46936 -59112 47057 -36552 32104 -54311 15545 -14521 35085 -46924 41818 -79287 17659 -91525 46171 -77523 63000 -14229 61327 -20514 77151 -30019 35029 -78834 57168 -96186 92129 -99772 60459 -62659 23209 -44811 97907 -41778 46924 -39724 54539 -56672 11103 -37872 44088 -67848 46924 -55337 58014 -48137 34267 -57761 47261 -90770 82701 -87830 32104 -14118 43916 -64511 97016 -67927 26386 -76032 55621 -46116 43948 -96284 26386 -51398 32104 -52363 45099 -84966 24105 -29725 47057 -92179 73851 -77151 57702 -31670 23131 -83560 34930 -62543 62129 -88635 55364 -14456 87507 -62848 35057 -31081 15535 -20287 11590 -58199 55876 -78634 63263 -21931 62559 -96294 23071 -18891 21157 -54875 35057 -40666 75460 -68475 71547 -93112 57702 -17780 50710 -89025 82701 -10487 77363 -14442 67828 -18287 10668 -73030 47436 -88998 81809 -47512 43866 -49438 52980 -62202 13958 -42062 33002 -35797 54746 -61308 74313 -98706 85679 -51049 29787 -96082 47057 -82102 77395 -91642 37908 -86709 16527 -11536 39339 -57804 77151 -58098 58014 -29840 37272 -68500 77570 -18840 17486 -42529 62129 -74868 62855 -48556 44088 -64424 35057 -87547 70030 -25349 55364 -24698 95115 -29610 37403 -10024 93643 -80179 44088 -86009 67277 -75396 28216 -18309 37500 -14754 67927 -98264 13958 -28294 77151 -50417 96240 -27171 12050 -79907 32187 -94597 73714 -36251 58014 -42293 43948 -22552 46924 -18765 85646 -65758 37771 -16028 74814 -15096 32104 -27990 62738 -91867 23131 -48177 62129 -43833 67927 -91992 96240 -25767 58014 -56422 35328 -39281 87024 -85701 70030 -40915 95206 -25378 23022 -17827 44745 -74880 31126 -51583 56967 -14996 82701 -24393 64040 -13557 31621 -87102 77151 -57922 50349 -18436 82701 -36961 68507 -33558 18947 -29752 24528 -88141 99508 -65521 66940 -98636 24754 -83809 23131 -13839 85851 -81470 35057 -93818 69550 -72210 82295 -10853 84284 -78121 55200 -28208 85199 -75892 13111 -62655 18720 -59696 86838 -18410 26693 -82521 30547 -68047 85199 -59444 62129 -73400 82753 -52751 25250 -94229 67927 -44728 45424 -84688 47457 -54885 53247 -66708 85987 -16610 19000 -52212 47057 -33467 90494 -11933 34797 -11426 23370 -98122 11318 -24974 98740 -89866 61735 -63042 84601 -97878 62129 -86324 88329 -93550 65587 -21893 32872 -32422 82701 -97593 95724 -79956 43017 -18574 66940 -69417 70030 -20527 62986 -32901 78479 -76892 14216 -80784 20119 -70030 46924 -45455 19210 -84089 55364 -51290 32104 -78084 35819 -19446 43664 -83281 82701 -88850 60032 -41737 26655 -28334 87060 -57007 63359 -35230 79052 -97142 62408 -71663 44088 -21967 56111 -73266 70030 -37751 73992 -71909 10908 -49256 76543 -87879 10005 -18958 99715 -33674 26386 -88578 16115 -38184 92129 -23162 94507 -94689 27138 -50188 23236 -73498 92740 -80946 14521 -20434 62129 -96199 54539 -97269 74914 -75164 56409 -63802 46857 -85851 39471 -13886 21128 -82608 43875 -47631 35057 -41955 83525 -41722 49739 -80210 73310 -72032 29229 -99588 19663 -75340 68873 -72016 64274 -87488 54539 -54539 89609 -92646 49227 -92493 92129 -51219 62129 -94294 66940 -35339 82701 -60625 25516 -71044 38554 -65428 57974 -47057 38596 -79756 64175 -25694 69619 -96457 13207 -13870 77151 -61984 33464 -14480 55364 -31924 14216 -33548 35819 -66463 52868 -36209 21830 -38146 62515 -43109 93643 -39326 73266 -67802 83861 -80246 93894 -32312 70030 -67288 20405 -11591 84936 -17019 49240 -45637 58014 -63060 82442 -96782 87050 -49139 57325 -13278 38425 -10622 58014 -70609 55364 -37494 57385 -50253 77151 -30770 88060 -48235 27041 -77045 46924 -36713 60284 -36647 73266 -21913 37190 -84907 76623 -83140 58014 -40049 38908 -96240 49588 -91375 20178 -44851 53224 -85957 77812 -31141 62129 -73469 75003 -54379 73141 -90253 26386 -37361 83861 -77965 86183 -44088 98740 -65748 44088 -92167 27474 -34050 39710 -53845 35057 -39439 70030 -56254 80666 -81736 35057 -22481 41619 -94515 47057 -40865 47438 -94090 94307 -25243 99699 -70472 44088 -92113 36000 -84122 44088 -75877 47057 -46967 98088 -89199 62129 -45284 61031 -25894 24258 -81546 49603 -18098 62129 -35845 58264 -30136 84643 -79351 85199 -91114 29608 -10796 73266 -80157 13958 -13776 34799 -32867 82701 -72659 83316 -70346 32104 -82707 26071 -93643 88453 -56487 73266 -17461 80601 -74189 35819 -89473 80231 -89648 29082 -21185 91451 -45756 24922 -13958 92570 -49766 46924 -71014 15764 -78218 47624 -36683 52276 -12805 18935 -89940 75569 -92619 62002 -26109 85199 -85199 47057 -74790 77094 -61077 44984 -21011 24325 -91299 35819 -13145 92130 -74616 25253 -68242 57168 -88099 29422 -98816 50970 -92627 32104 -60619 54539 -18592 99696 -97961 85199 -37971 86471 -76808 65290 -26960 44025 -21159 18065 -21820 51610 -87396 13958 -51739 69215 -36150 67927 -36428 77167 -81368 85546 -36684 74331 -87943 57127 -83934 39052 -93369 57168 -25759 23805 -90295 85638 -33748 35057 -23965 56026 -18136 47566 -97136 87779 -11751 98740 -77584 72651 -47535 14216 -35157 40935 -38666 20886 -49584 34431 -70553 57619 -41660 90498 -34861 70030 -97329 82739 -83411 32104 -74970 72228 -36340 26425 -40870 92129 -96019 35057 -35996 62535 -35750 17289 -44648 26386 -14216 68378 -41202 76995 -28670 44197 -12646 99599 -30412 91461 -18596 74757 -38836 73266 -63846 70555 -84175 23131 -36177 25567 -76440 41764 -89469 30895 -28950 43948 -93707 70030 -93976 73909 -15262 31486 -86652 23131 -65454 88787 -76119 46924 -44343 98685 -29424 46693 -97543 32104 -73497 76030 -87093 58014 -49551 16528 -45191 73266 -21283 34339 -27141 73266 -20255 57702 -48823 35838 -74136 57964 -18194 80112 -37794 96240 -46775 98740 -52309 42291 -12317 39213 -98269 96240 -82747 89172 -28972 54579 -40842 85851 -24862 46924 -90115 29514 -97189 85851 -60429 85233 -35563 99130 -42174 69145 -62129 12281 -87307 72432 -54431 47057 -32208 43948 -36159 92837 -92813 16218 -30956 87764 -81881 16847 -82389 14216 -81627 46027 -12133 59074 -83315 88230 -17677 82701 -11309 32104 -24911 35927 -77700 98147 -43948 53055 -82304 22718 -94870 55364 -67575 85199 -49305 93182 -15751 15044 -66060 26171 -30935 41610 -28356 32565 -18811 12256 -64019 23131 -34225 17638 -15964 13958 -21017 44088 -34116 81436 -52676 32857 -95338 16079 -78527 46924 -93795 85851 -12924 64525 -85065 79359 -45073 47356 -30072 43948 -98834 32104 -57372 73266 -83929 79432 -90423 82701 -22832 98740 -48430 59406 -73629 93643 -26263 94506 -94074 14216 -26414 98740 -56951 55364 -50559 43948 -63550 31546 -90368 63317 -32146 46924 -47438 57185 -58449 43948 -47368 85851 -32574 15690 -83798 92129 -14115 48770 -81573 66940 -51307 52219 -13174 47057 -36828 67828 -38526 44088 -44179 54539 -52115 89989 -78802 62495 -34661 14805 -32323 59466 -27132 30442 -79104 63409 -63502 46386 -97485 55364 -93125 45846 -22160 14216 -94150 21543 -16960 75856 -41717 62129 -16797 13241 -16286 31406 -81133 73266 -62615 36776 -38433 47057 -17558 77268 -31164 99409 -98740 37183 -16053 46924 -83861 14216 -89754 14216 -90249 14216 -45631 44427 -79425 67927 -41085 82701 -61288 93605 -66018 98413 -22664 49595 -48544 78826 -24552 57029 -13795 59246 -17199 69353 -33038 93573 -37670 50912 -22237 40613 -93548 92536 -71344 90698 -95400 97202 -16457 29422 -79172 12325 -87249 25678 -32398 57782 -42920 65021 -20491 17593 -29343 15560 -51134 56929 -87045 18964 -16859 67927 -50451 23131 -88013 99947 -79869 26386 -17158 13958 -47399 93686 -32349 20008 -88683 69537 -49926 93643 -86432 89768 -82719 35057 -56739 92864 -95877 43633 -69037 59576 -95747 72337 -15660 23131 -13684 67506 -87807 24977 -45695 44088 -14570 23131 -45507 96958 -79826 46189 -86233 96377 -57051 96244 -16227 70718 -66940 87229 -16621 77709 -67736 19049 -36049 43120 -27324 13585 -89099 46924 -80234 73266 -30105 82570 -42497 85199 -20275 47057 -84842 67828 -18545 31766 -22010 89576 -44172 33974 -11085 32612 -48341 28004 -94313 14216 -65788 46924 -27317 92981 -68318 70030 -56329 60704 -29327 91745 -53630 57702 -24518 82701 -96364 81945 -95503 47057 -41188 40000 -16708 20405 -31294 30878 -33264 98085 -64245 96240 -14497 26073 -77398 21420 -16427 72248 -26395 46924 -22620 93997 -17321 12686 -26035 72607 -58951 54463 -38225 30571 -89267 35057 -30825 66365 -98399 67169 -80743 46924 -80557 91342 -35024 72939 -53184 15700 -71001 47443 -97339 33591 -96913 78805 -42578 73266 -53465 82681 -74719 75723 -96923 58014 -92916 71872 -26229 14521 -42662 96240 -81620 47057 -46956 29400 -39197 98476 -30330 45605 -57702 20507 -82062 62129 -37754 10380 -97560 40495 -45988 54539 -42413 38989 -58786 26969 -41724 60576 -55364 69527 -64004 44088 -87772 31704 -65614 23131 -44781 53388 -78305 40217 -32629 36036 -78238 51508 -61460 14216 -46112 96240 -61748 90420 -41222 62129 -14622 23131 -12228 54539 -95242 60673 -46228 69114 -80525 75711 -45245 46098 -67491 58014 -52166 83687 -38396 67828 -31358 43948 -55034 37772 -56827 46924 -79835 93798 -89347 58014 -82227 18043 -63832 32104 -62004 10083 -26506 92531 -69651 29640 -72433 82716 -40513 63891 -18717 92129 -30405 23131 -74331 44088 -72157 67849 -74767 54539 -30847 35819 -18242 20586 -69756 67844 -72005 57702 -92985 86192 -35084 52372 -73020 92992 -48804 93643 -75034 57702 -67280 55364 -13826 44088 -58014 28935 -26965 41912 -32785 70621 -67828 88974 -24669 12565 -83563 46791 -24440 98740 -85814 99882 -96689 89250 -83424 99433 -86597 92129 -35057 19703 -90254 75605 -27503 45668 -80689 57779 -85142 43542 -47144 32104 -81029 55196 -88306 85851 -44736 91531 -44675 70030 -56611 75708 -99455 48355 -76675 46015 -58779 43948 -87090 93643 -28546 78920 -60401 31361 -25679 91728 -40839 57168 -36746 43948 -79132 82701 -66132 61087 -68819 36117 -36538 12235 -27205 76760 -24399 23139 -44240 45473 -35819 96240 -12508 99554 -76682 43948 -92401 85296 -86766 41706 -96643 27209 -53030 85851 -10426 29096 -47697 20405 -68686 82701 -55276 98740 -88787 14521 -68667 54484 -88551 82701 -86242 93860 -33643 17327 -19228 49220 -94076 63820 -66464 95977 -32020 57329 -39310 47057 -45805 82325 -62915 96018 -13011 60296 -88834 40986 -82701 44460 -79163 37444 -57767 47909 -21571 56724 -48453 66228 -92533 20251 -71231 43948 -26769 54336 -71828 96240 -14891 30317 -92462 74559 -57405 62129 -64689 45242 -14673 75437 -37392 12408 -88004 68886 -11897 85851 -35121 19747 -65978 46924 -59214 35819 -69160 82701 -86199 78031 -84182 79283 -46746 70030 -93280 31194 -78233 42061 -31751 44088 -92129 41105 -81082 44088 -69123 85851 -20505 66320 -41538 43948 -64819 28581 -20294 73266 -48547 31547 -47633 15882 -96892 58776 -22150 41774 -18701 93643 -61229 42035 -78415 32104 -66928 65236 -35556 79431 -33671 62129 -96468 87478 -50427 58131 -25039 99100 -80962 32104 -69045 62129 -32104 75645 -59924 23131 -18240 70030 -88763 58014 -60348 43980 -20717 51159 -81946 79855 -20510 68239 -37273 43948 -99008 54986 -13046 53592 -87961 14216 -16856 87339 -13289 29653 -81110 65830 -25077 66583 -53154 96594 -22799 77151 -44901 98740 -80985 40597 -39889 66837 -32167 67057 -46469 19487 -42664 77151 -28717 67927 -48319 23742 -20405 63271 -99160 68742 -37312 86445 -49441 84577 -42459 77403 -76352 25777 -42818 73266 -96351 89012 -55426 69362 -44989 93643 -68109 67066 -87896 81830 -73110 89259 -41918 35819 -46805 73266 -61826 43948 -32096 54757 -26386 22428 -70847 17131 -63265 63742 -66807 18158 -29422 36229 -56355 37525 -22577 46924 -99518 44088 -16441 66929 -26818 76171 -18649 85851 -76731 61187 -30590 91024 -90428 58160 -16076 67927 -13553 37915 -91615 32416 -36190 63670 -49749 49989 -62226 58313 -25075 46700 -30720 89560 -20085 28489 -95853 74174 -94343 35819 -18518 80833 -98111 86331 -63474 33979 -24642 67927 -76558 23131 -26475 58014 -80306 58014 -92346 48193 -20270 95402 -23131 43948 -23638 60254 -86655 57352 -58258 45523 -34945 61572 -33250 96240 -84692 11925 -74810 80726 -50681 52269 -79610 73266 -30424 17447 -14983 82701 -37491 93643 -36576 73266 -31400 92479 -74498 62129 -19311 85090 -78393 54666 -44638 35057 -71239 35819 -33836 77370 -87014 35057 -49752 31956 -89676 85199 -31538 14521 -54931 18949 -78700 85199 -57624 83620 -55476 42249 -36922 23131 -83133 96903 -33766 38715 -90922 92129 -84184 85199 -84873 98740 -30986 46301 -66208 66981 -76128 44088 -54499 46924 -11089 73266 -63966 66921 -24165 60756 -65766 13958 -98485 92129 -31557 32104 -62423 44088 -54888 52459 -61829 75842 -26964 63459 -63722 32104 -71060 45395 -60721 85952 -14154 56940 -71805 82701 -74964 80051 -23705 85348 -27306 30788 -57026 35057 -95790 30087 -47055 67481 -20026 75622 -92097 12792 -22924 38758 -30454 42427 -77910 99903 -20644 30998 -51589 39385 -83392 76104 -92902 93643 -44609 42484 -82287 20771 -88814 15393 -39082 73266 -37969 85199 -57693 96633 -43012 93643 -29944 78876 -68317 66940 -33738 58014 -17794 98740 -41165 47180 -14871 41373 -42771 43164 -82391 29055 -79484 53019 -58189 29804 -19422 82701 -48923 83734 -76839 85851 -71377 23080 -50558 44088 -25393 45650 -39296 84954 -84189 57168 -85258 22386 -30912 13039 -77881 48653 -67451 46924 -47082 89946 -91778 85851 -99760 37363 diff --git a/day-1/main.go b/day-1/main.go index 4edfbe1..b648f0a 100644 --- a/day-1/main.go +++ b/day-1/main.go @@ -1,24 +1,27 @@ package main import ( - _ "embed" "flag" "fmt" "log" "sort" "strconv" "strings" + + file "github.com/shaunburdick/advent-of-code-2024/lib" ) -//go:embed input.txt var input string func init() { // do this in init (not main) so test file has same input - input = strings.TrimRight(input, "\n") - if len(input) == 0 { - panic("empty input.txt file") + // do this in init (not main) so test file has same input + inputFile, err := file.LoadRelativeFile("input.txt") + if err != nil { + log.Println(err) } + + input = strings.TrimRight(inputFile, "\n") } func main() { diff --git a/day-1/main_test.go b/day-1/main_test.go index 9020ab0..f2628c4 100644 --- a/day-1/main_test.go +++ b/day-1/main_test.go @@ -2,8 +2,17 @@ package main import ( "testing" + + file "github.com/shaunburdick/advent-of-code-2024/lib" ) +type TestDeclaration struct { + name string + input string + want int + run bool +} + var example1 = `3 4 4 3 2 5 @@ -12,34 +21,34 @@ var example1 = `3 4 3 3` func Test_day1_part1(t *testing.T) { - tests := []struct { - name string - input string - want int - }{ + tests := []TestDeclaration{ { name: "example", input: example1, want: 11, + run: true, }, { name: "actual", input: input, want: 2367773, + run: file.ExistsRelativeFile("input.txt"), }, } for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if got := part1(tt.input); got != tt.want { - t.Errorf("part1() = %v, want %v", got, tt.want) - } - }) + if tt.run { + t.Run(tt.name, func(t *testing.T) { + if got := part1(tt.input); got != tt.want { + t.Errorf("part1() = %v, want %v", got, tt.want) + } + }) + } } } func Benchmark_day1_part1(b *testing.B) { for i := 0; i < b.N; i++ { - part1(input) + part1(example1) } } @@ -51,33 +60,33 @@ var example2 = `3 4 3 3` func Test_day1_part2(t *testing.T) { - tests := []struct { - name string - input string - want int - }{ + tests := []TestDeclaration{ { name: "example", input: example2, want: 31, + run: true, }, { name: "actual", input: input, want: 21271939, + run: file.ExistsRelativeFile("input.txt"), }, } for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if got := part2(tt.input); got != tt.want { - t.Errorf("part2() = %v, want %v", got, tt.want) - } - }) + if tt.run { + t.Run(tt.name, func(t *testing.T) { + if got := part2(tt.input); got != tt.want { + t.Errorf("part2() = %v, want %v", got, tt.want) + } + }) + } } } func Benchmark_day1_part2(b *testing.B) { for i := 0; i < b.N; i++ { - part2(input) + part2(example2) } } diff --git a/day-2/input.txt b/day-2/input.txt deleted file mode 100644 index 295874d..0000000 --- a/day-2/input.txt +++ /dev/null @@ -1,1000 +0,0 @@ -25 26 29 30 32 35 37 35 -15 16 17 20 22 24 26 26 -80 81 83 85 89 -76 77 79 82 84 87 89 95 -73 75 78 81 83 84 81 84 -9 10 11 12 11 8 -27 28 30 33 35 34 37 37 -67 70 69 72 74 78 -65 66 69 72 75 72 74 79 -22 25 25 26 27 28 -47 50 53 53 51 -67 70 70 71 74 75 77 77 -68 69 71 74 74 78 -54 56 58 58 65 -19 21 24 28 30 32 34 36 -75 78 79 80 84 81 -13 16 19 20 23 25 29 29 -66 67 69 73 75 78 79 83 -41 42 46 49 56 -86 87 90 96 97 98 99 -67 68 74 76 78 76 -64 65 66 67 69 74 75 75 -55 58 61 68 72 -44 45 48 50 53 54 60 65 -41 38 40 42 44 47 -50 48 49 52 54 56 54 -62 59 61 64 65 66 66 -29 27 29 30 31 35 -32 29 31 34 40 -27 25 27 29 28 31 33 34 -68 66 67 65 66 68 70 67 -41 38 39 40 43 42 44 44 -82 79 81 84 82 86 -78 75 74 77 78 85 -89 88 91 93 94 97 97 99 -63 61 61 62 64 63 -44 43 43 45 46 46 -86 84 85 85 89 -19 18 21 24 24 29 -18 17 20 24 25 27 28 -15 14 15 17 21 24 22 -85 83 86 90 90 -28 26 30 32 34 37 41 -78 77 78 82 85 92 -73 71 77 80 83 -12 11 12 14 20 22 24 22 -48 47 54 56 56 -37 36 41 43 47 -83 80 81 83 90 95 -53 53 55 57 60 -31 31 32 33 36 35 -86 86 87 88 91 94 94 -82 82 84 86 88 92 -17 17 18 19 21 27 -29 29 31 28 30 33 36 -70 70 71 68 65 -1 1 2 1 1 -27 27 29 27 31 -38 38 41 43 45 48 45 52 -40 40 41 43 43 46 49 -7 7 7 9 11 14 13 -3 3 6 9 10 10 10 -20 20 21 21 25 -51 51 51 53 60 -40 40 41 45 48 49 52 -73 73 74 76 79 81 85 83 -8 8 12 13 13 -40 40 41 43 45 46 50 54 -72 72 73 74 78 85 -42 42 43 50 51 53 -62 62 63 66 69 75 73 -28 28 31 32 38 40 40 -48 48 51 56 58 59 63 -39 39 41 47 50 56 -29 33 35 37 38 -20 24 27 29 31 32 35 33 -55 59 60 62 62 -38 42 43 45 47 48 50 54 -9 13 15 18 20 23 24 29 -72 76 77 80 78 80 83 -57 61 64 65 68 67 68 67 -72 76 78 79 81 82 79 79 -12 16 19 22 25 28 25 29 -33 37 38 41 42 39 45 -36 40 41 44 44 46 -65 69 70 72 75 75 72 -9 13 13 15 15 -33 37 39 42 45 45 46 50 -69 73 76 77 80 80 86 -7 11 12 16 18 19 -30 34 35 36 40 38 -34 38 39 43 45 47 47 -2 6 8 12 13 16 20 -36 40 43 46 50 55 -76 80 85 86 88 91 92 -46 50 51 52 59 60 61 60 -1 5 7 12 12 -61 65 70 71 74 75 79 -28 32 35 36 37 44 46 52 -24 30 33 35 37 -75 82 83 84 87 90 91 88 -52 59 60 61 63 65 65 -54 59 62 63 65 66 70 -17 24 25 27 29 34 -57 64 67 70 67 68 70 73 -69 76 78 81 83 82 80 -13 19 20 18 20 20 -20 27 29 28 29 33 -10 16 18 15 16 21 -66 72 74 77 77 80 -62 68 70 73 75 75 72 -84 89 89 91 92 95 96 96 -21 27 28 28 32 -32 37 39 40 43 43 50 -18 25 26 29 33 36 37 -9 15 16 20 23 25 26 25 -49 54 58 61 61 -46 52 54 55 57 61 65 -21 27 29 30 34 35 36 42 -78 83 84 90 92 95 -54 61 63 65 66 67 74 72 -1 7 9 10 11 17 20 20 -39 46 52 55 56 60 -7 12 14 16 18 20 26 32 -89 87 84 83 84 -37 36 35 32 31 29 27 27 -48 45 42 41 40 37 34 30 -23 21 20 18 17 14 12 7 -69 67 65 63 60 63 62 -93 91 88 86 89 92 -10 8 6 7 7 -28 26 24 27 26 24 23 19 -54 51 52 51 50 44 -65 64 61 60 60 59 -18 16 13 10 8 5 5 8 -80 78 76 76 76 -89 87 84 82 82 79 77 73 -27 24 24 21 19 18 11 -44 43 39 38 36 -15 14 13 10 6 3 2 3 -76 73 69 67 64 64 -53 51 50 48 44 43 39 -20 19 17 15 11 6 -50 47 40 37 36 -98 96 93 87 84 82 84 -43 42 37 34 33 31 28 28 -32 30 29 27 20 17 14 10 -66 64 62 61 59 53 52 46 -17 19 17 14 11 10 7 5 -73 76 73 72 71 73 -78 80 79 76 75 72 72 -16 18 15 13 10 6 -93 96 93 91 89 87 84 79 -53 55 52 50 48 46 47 44 -57 60 57 56 53 52 54 57 -59 60 57 58 56 56 -61 64 62 59 62 58 -36 39 38 41 39 38 33 -13 14 14 13 12 11 -76 77 74 74 77 -8 10 10 9 6 6 -55 57 57 55 53 49 -51 53 52 52 50 47 40 -18 21 19 15 12 -83 84 82 78 76 75 73 76 -35 38 34 31 31 -57 60 58 54 51 48 44 -27 30 29 25 23 21 16 -12 15 9 7 6 5 -20 23 20 15 13 10 9 11 -21 22 20 17 12 10 8 8 -59 60 57 51 49 46 42 -22 24 22 16 14 12 5 -71 71 69 68 67 66 64 -90 90 88 86 85 87 -77 77 76 73 71 71 -9 9 7 6 2 -91 91 90 88 86 84 83 77 -27 27 24 26 25 24 22 -55 55 56 54 53 54 -84 84 81 83 81 78 75 75 -60 60 58 55 56 53 50 46 -61 61 63 60 57 56 51 -59 59 58 57 57 54 -34 34 32 31 31 29 30 -33 33 30 30 30 -62 62 59 56 56 52 -24 24 24 23 16 -14 14 13 9 8 6 -20 20 19 16 15 11 10 11 -96 96 92 91 90 89 89 -93 93 89 87 84 82 81 77 -62 62 60 56 50 -72 72 69 62 60 -76 76 69 66 65 68 -96 96 89 87 87 -65 65 63 56 55 51 -76 76 75 68 61 -63 59 56 53 52 -75 71 70 68 66 67 -79 75 72 70 70 -99 95 93 90 86 -70 66 65 63 60 54 -6 2 1 4 1 -30 26 28 27 28 -64 60 57 55 57 56 56 -65 61 60 59 58 57 58 54 -67 63 62 61 59 56 57 52 -93 89 88 85 85 82 -39 35 32 29 27 27 28 -96 92 92 89 88 85 85 -71 67 67 65 63 61 58 54 -46 42 41 40 37 37 32 -68 64 63 59 58 55 -41 37 34 30 33 -71 67 63 62 60 58 58 -45 41 39 35 34 31 27 -78 74 72 69 66 62 56 -62 58 57 55 52 47 45 42 -89 85 82 76 75 72 71 74 -69 65 64 61 56 53 51 51 -73 69 64 62 58 -32 28 21 20 19 18 16 9 -94 89 87 85 83 82 79 78 -91 84 82 81 84 -41 36 33 31 30 27 27 -56 51 48 46 44 41 38 34 -85 78 77 75 72 70 68 62 -85 80 79 80 78 76 75 -30 25 27 26 29 -37 32 35 33 33 -79 74 72 73 69 -80 75 72 71 72 70 69 64 -62 57 55 55 53 51 48 45 -53 47 45 44 44 41 40 42 -40 33 31 28 28 28 -90 85 84 83 82 82 78 -95 88 85 85 84 83 82 76 -37 30 28 24 23 20 19 17 -24 19 15 14 16 -24 19 16 14 11 7 7 -62 55 52 51 49 45 44 40 -49 43 39 38 33 -88 81 78 73 71 -64 59 56 51 49 51 -19 14 11 6 6 -41 34 29 28 24 -44 39 36 33 30 23 17 -40 41 44 47 48 50 51 48 -57 59 61 64 64 -58 60 61 62 66 -79 82 84 86 92 -7 9 7 8 9 10 11 -30 32 35 38 41 38 40 38 -39 40 41 43 42 42 -76 77 79 77 79 83 -16 19 17 19 25 -79 82 83 83 84 86 87 90 -21 24 24 26 29 31 32 30 -28 31 32 35 37 37 39 39 -58 61 61 63 66 67 71 -9 10 13 13 19 -51 53 57 59 60 61 64 -80 82 84 88 90 88 -86 89 93 95 96 98 98 -72 74 76 80 81 85 -76 79 83 85 88 90 96 -76 79 85 88 91 94 97 -79 80 87 89 91 92 89 -86 87 90 95 95 -37 39 41 47 51 -29 30 32 37 40 46 -57 54 57 58 59 61 63 66 -63 60 61 64 63 -62 59 60 61 64 64 -47 45 46 49 53 -6 4 6 7 8 9 14 -35 32 33 36 38 35 38 -7 4 5 7 8 9 7 5 -51 49 52 54 55 52 53 53 -48 47 49 50 49 52 56 -17 16 19 17 18 21 26 -93 92 92 93 95 96 97 -14 12 15 15 18 16 -11 10 10 13 13 -91 90 90 93 94 95 99 -72 71 72 72 73 78 -35 34 37 40 44 47 48 -26 24 27 28 31 32 36 33 -31 29 33 34 34 -79 76 80 82 86 -54 53 57 60 63 66 69 76 -76 74 79 82 83 86 88 89 -42 41 46 47 50 49 -20 18 21 23 24 27 33 33 -51 50 52 54 59 63 -11 9 12 15 20 23 24 29 -57 57 58 61 62 63 -53 53 56 58 60 61 58 -25 25 27 29 31 33 34 34 -70 70 71 72 74 76 79 83 -70 70 73 76 79 82 83 90 -6 6 8 7 8 -24 24 26 29 28 30 33 31 -66 66 67 66 67 67 -91 91 92 90 94 -92 92 95 92 94 99 -58 58 60 62 64 67 67 68 -86 86 89 89 86 -16 16 17 17 18 21 22 22 -46 46 47 48 48 52 -87 87 89 92 92 99 -1 1 4 7 10 11 15 17 -73 73 74 75 79 81 80 -84 84 87 91 91 -74 74 76 80 84 -50 50 53 57 59 65 -74 74 80 81 84 -11 11 13 15 21 20 -47 47 54 55 55 -57 57 58 60 62 68 69 73 -41 41 48 51 56 -16 20 21 24 27 -14 18 19 22 25 23 -84 88 89 90 93 93 -59 63 65 68 69 72 75 79 -19 23 26 29 32 37 -24 28 31 30 33 35 -70 74 76 79 77 75 -66 70 73 74 72 75 75 -56 60 61 59 62 63 67 -21 25 26 24 31 -27 31 33 33 34 -2 6 6 7 6 -83 87 88 88 90 93 93 -75 79 82 82 83 84 88 -34 38 40 40 43 46 52 -64 68 72 75 76 -72 76 80 81 78 -79 83 87 89 89 -12 16 20 22 23 24 26 30 -36 40 42 46 53 -24 28 35 38 40 -7 11 13 19 21 22 21 -35 39 41 43 50 50 -63 67 70 77 81 -66 70 71 77 79 85 -61 66 69 72 75 -71 77 78 81 80 -70 76 77 78 80 81 81 -25 32 33 35 36 40 -32 39 41 44 45 50 -36 41 42 39 42 43 44 46 -8 14 17 14 12 -79 85 86 84 85 85 -20 27 29 27 31 -60 66 64 67 73 -31 37 37 38 40 43 -27 33 34 36 36 37 36 -17 22 24 24 24 -76 83 84 84 88 -72 78 79 81 82 82 87 -10 16 18 22 24 27 -77 82 84 88 90 91 93 90 -33 39 41 45 47 49 52 52 -67 74 78 81 85 -25 32 36 38 41 43 49 -44 50 52 54 59 61 -13 20 23 26 29 31 37 35 -45 50 57 60 60 -66 72 73 80 84 -18 24 27 30 32 37 42 -81 79 76 75 78 -7 5 3 2 1 1 -55 54 51 50 49 45 -45 44 41 38 35 30 -79 76 73 72 74 71 -94 92 94 91 90 93 -30 28 27 26 29 26 26 -97 94 95 92 89 86 83 79 -21 20 22 19 13 -96 94 94 91 90 -81 78 76 76 74 76 -38 35 33 33 33 -58 56 56 53 52 48 -57 55 53 51 51 49 48 43 -76 74 73 70 68 64 61 -25 22 18 16 19 -17 14 10 7 5 3 3 -41 40 38 34 33 30 26 -99 97 96 95 94 91 87 82 -95 92 85 82 81 78 77 76 -69 67 61 58 56 59 -57 54 53 48 45 44 43 43 -86 85 82 79 73 72 68 -88 85 78 76 74 67 -69 71 68 66 65 62 60 58 -48 50 49 47 44 41 42 -17 20 17 14 11 10 9 9 -79 80 77 75 72 70 66 -16 18 17 15 13 12 10 3 -67 69 67 66 68 65 62 60 -69 71 68 67 68 70 -20 22 23 20 19 19 -32 34 33 35 31 -85 88 87 86 85 86 85 80 -14 15 15 13 12 -29 31 30 30 27 24 27 -68 69 69 67 64 64 -92 93 93 90 86 -56 57 54 54 51 46 -21 22 18 15 14 -30 31 30 27 25 21 22 -60 61 58 56 55 51 51 -27 28 24 23 20 18 14 -95 97 95 92 90 86 83 77 -67 70 63 62 60 57 55 52 -32 34 28 25 28 -31 32 26 25 25 -28 31 29 22 20 16 -13 15 14 9 3 -68 68 65 64 61 59 56 -39 39 36 33 35 -29 29 26 23 23 -72 72 70 69 65 -15 15 12 11 8 7 6 1 -43 43 41 42 39 38 35 34 -52 52 49 46 47 45 47 -39 39 41 40 40 -28 28 26 27 23 -36 36 35 33 32 35 28 -19 19 19 16 15 -20 20 19 17 15 15 16 -51 51 49 49 49 -65 65 63 60 60 56 -90 90 88 86 86 81 -68 68 65 61 58 55 -34 34 32 28 25 22 25 -88 88 85 81 79 78 78 -26 26 24 23 20 16 13 9 -98 98 95 91 88 85 82 77 -29 29 26 19 16 15 14 -96 96 94 93 87 88 -62 62 57 54 54 -72 72 66 63 59 -45 45 44 41 36 35 32 25 -38 34 33 30 27 25 22 21 -74 70 67 64 62 61 60 62 -51 47 46 43 43 -62 58 55 52 48 -20 16 13 10 5 -57 53 51 53 52 51 -99 95 93 90 92 91 94 -23 19 18 15 14 15 15 -62 58 59 58 55 51 -59 55 54 55 54 51 44 -95 91 89 87 87 86 85 -31 27 26 24 24 22 25 -27 23 22 19 19 18 16 16 -96 92 92 89 85 -26 22 22 20 18 13 -27 23 19 17 16 14 -90 86 83 82 80 76 77 -86 82 80 79 77 74 70 70 -20 16 12 11 10 6 -97 93 92 88 82 -75 71 68 66 65 64 57 54 -88 84 77 76 73 72 75 -37 33 32 30 25 25 -61 57 54 47 43 -65 61 59 54 53 46 -54 47 44 42 40 38 -88 81 79 78 81 -60 55 52 50 49 48 48 -86 81 79 76 73 71 68 64 -38 32 31 29 27 25 18 -80 75 73 76 75 73 71 -34 27 29 28 27 24 23 25 -97 92 89 92 92 -57 51 52 50 49 48 44 -27 22 20 18 21 18 12 -85 80 77 77 74 71 69 66 -26 20 18 16 16 19 -82 76 74 73 71 70 70 70 -93 87 85 84 82 81 81 77 -96 89 87 85 85 84 79 -34 27 23 21 19 17 -30 25 23 19 18 20 -57 51 50 46 43 42 42 -31 26 25 21 18 17 14 10 -51 45 41 40 39 36 30 -45 39 37 35 29 28 27 -78 72 70 67 65 60 61 -78 73 68 67 65 62 62 -95 89 86 84 78 74 -75 68 65 60 58 52 -71 71 74 72 74 77 79 84 -22 19 21 22 22 24 25 30 -10 7 8 8 7 -78 76 77 76 78 81 -44 42 44 46 49 47 -2 2 3 6 8 12 14 14 -12 12 14 16 22 25 28 25 -29 34 35 38 40 41 41 44 -28 25 23 21 18 17 19 -66 60 59 56 55 57 57 -55 55 52 51 51 49 -32 28 27 26 22 -81 79 76 73 71 71 67 -94 92 91 88 84 83 80 83 -86 84 82 81 80 79 76 76 -66 60 58 55 51 49 49 -91 95 96 96 97 96 -37 33 28 26 22 -26 25 24 23 20 16 15 15 -41 41 43 45 47 49 49 -55 57 56 54 50 47 44 40 -34 32 31 29 26 20 18 12 -39 38 41 44 46 -51 47 46 44 43 43 -64 70 73 77 80 83 -46 48 54 56 59 61 64 67 -20 23 20 22 25 29 -46 52 53 54 58 59 62 68 -14 21 21 23 25 25 -57 57 57 56 53 53 -34 27 25 22 17 15 12 15 -22 26 28 29 30 31 36 -76 80 82 84 88 92 -49 50 54 57 56 -27 28 35 37 41 -70 72 71 64 63 -13 13 12 11 11 10 5 -91 87 83 81 82 -21 19 20 21 24 26 26 -78 73 76 73 70 -33 29 25 22 21 17 -1 5 7 10 12 13 10 -2 5 6 5 5 -16 18 17 16 13 13 -62 66 69 71 69 69 -43 36 34 31 29 26 20 20 -83 79 77 74 71 71 67 -58 62 66 69 72 74 -64 60 58 56 49 -56 57 54 55 55 -31 31 35 36 38 41 44 -42 36 35 33 30 30 26 -44 45 42 40 34 30 -99 96 93 90 88 86 81 83 -18 22 25 27 29 30 32 36 -79 79 78 75 71 70 67 62 -36 39 36 38 40 47 -92 89 91 94 91 92 95 92 -16 21 23 30 28 -85 86 83 80 79 76 75 70 -84 83 85 86 87 91 90 -7 9 11 14 16 20 24 -40 44 47 51 56 -60 63 66 68 71 71 75 -31 35 38 36 33 -24 24 27 31 33 31 -16 12 11 9 9 9 -24 24 23 21 18 13 -64 58 56 55 52 48 44 -50 48 51 53 55 55 57 61 -34 37 35 33 33 30 -97 97 98 98 98 -48 48 44 43 42 40 39 36 -96 95 95 96 96 -7 11 14 15 15 16 16 -82 88 91 92 92 -31 32 35 34 36 37 -33 33 31 30 27 26 19 13 -13 15 17 18 25 30 -86 88 86 83 82 78 76 76 -49 49 48 46 40 38 39 -89 82 81 78 77 70 -58 61 59 56 54 56 53 56 -38 35 42 43 44 -22 27 28 34 37 37 -47 44 44 43 41 38 39 -45 43 46 52 50 -44 40 38 36 32 25 -99 99 96 94 91 90 87 83 -61 54 51 54 51 50 46 -75 82 83 84 85 88 90 97 -20 26 28 28 32 -6 6 11 12 15 21 -88 82 82 81 78 -69 66 64 64 63 60 -2 5 7 6 4 -69 64 62 60 60 62 -19 23 23 25 30 -12 18 19 21 23 27 -67 63 65 64 66 -45 52 55 58 60 65 68 71 -54 49 48 45 41 -80 80 83 82 84 88 -91 90 90 89 86 86 -54 57 61 64 67 74 -50 53 54 56 59 60 66 -16 20 22 28 35 -82 84 84 87 88 -19 15 12 9 12 -3 9 11 12 13 15 -55 53 57 60 60 -55 52 55 52 54 55 56 62 -66 63 66 69 72 74 76 83 -68 70 73 76 79 79 -74 76 77 78 80 82 79 -93 89 86 84 81 81 80 83 -18 18 17 15 8 6 2 -42 49 50 51 51 53 50 -1 5 6 3 5 8 -46 46 45 41 37 -54 54 55 56 61 65 -57 57 55 56 53 -28 28 26 24 26 23 25 -87 87 90 89 89 -67 71 71 73 74 78 -37 33 30 29 26 23 20 -69 65 63 58 57 54 52 -28 25 24 22 24 21 20 17 -72 75 73 72 72 72 -66 66 64 66 64 63 59 -94 95 93 91 93 -42 40 42 43 44 41 44 48 -38 44 47 48 51 55 55 -50 47 46 39 36 35 32 31 -70 72 70 69 66 64 62 -12 10 7 8 4 -73 68 65 64 58 56 55 53 -10 7 4 5 5 -58 56 55 52 49 45 43 36 -37 39 41 44 46 46 44 -11 10 11 13 14 18 21 25 -88 84 81 74 68 -81 74 73 73 72 71 64 -28 28 29 30 30 31 30 -77 78 75 72 70 70 71 -37 34 35 37 41 43 49 -43 44 47 51 52 52 -71 64 61 60 57 59 -22 23 25 27 29 -64 67 69 72 75 77 80 82 -85 87 90 91 93 94 -28 26 23 22 21 18 16 -68 71 73 74 76 79 81 83 -24 25 26 28 29 -22 23 25 28 29 -29 30 31 32 35 36 39 -3 5 6 8 9 -39 36 34 33 30 28 25 -54 52 49 47 44 43 41 -82 85 87 89 90 93 96 97 -18 21 24 27 28 30 32 -8 9 10 12 14 -54 53 52 51 49 46 -67 66 65 64 61 58 -58 57 54 51 49 47 44 -25 28 29 31 33 -7 8 9 10 11 14 15 -88 87 86 85 84 -51 52 53 55 58 60 63 -38 35 32 29 27 24 22 -81 82 83 84 85 87 90 -78 77 75 72 69 -81 83 84 87 88 90 91 -31 34 35 38 39 -52 51 50 47 44 41 -79 76 73 70 69 66 64 -94 93 90 89 88 85 82 81 -34 36 38 40 43 45 -58 57 55 52 49 47 45 -24 23 21 20 19 -89 90 91 93 94 -58 59 61 64 67 69 70 71 -50 52 55 56 58 60 -63 61 59 56 53 50 -43 46 49 52 54 55 -42 40 37 36 33 30 27 24 -26 27 28 31 32 33 -66 63 62 60 58 55 -11 14 15 18 19 22 24 27 -50 49 48 46 45 -80 83 84 87 88 91 -74 75 77 79 80 82 -66 67 70 72 74 -68 69 72 75 78 81 83 84 -63 61 60 59 57 54 51 -37 38 40 41 43 -44 43 40 39 36 34 33 -84 85 87 90 92 94 95 -78 80 81 82 85 88 90 91 -38 37 35 33 30 29 27 -61 63 65 68 70 -47 49 50 52 53 -39 36 34 32 31 -70 71 72 73 74 77 80 -41 39 37 34 33 31 28 25 -30 31 33 36 37 40 42 -18 21 24 26 27 30 33 -37 38 41 44 45 -10 13 14 15 18 20 22 -96 95 94 91 90 89 -46 47 48 50 53 -83 82 79 76 75 -38 39 41 44 47 48 51 53 -73 75 76 79 80 -81 84 87 88 89 -28 27 26 25 22 19 17 15 -54 55 57 59 60 62 65 66 -69 71 73 75 76 78 -43 45 46 49 51 54 57 -56 55 52 50 47 44 41 40 -36 37 40 41 42 44 -63 66 69 71 73 74 -40 43 44 47 48 50 53 -76 77 78 81 84 85 -68 65 63 60 58 56 -59 62 64 66 67 68 -24 23 20 19 16 14 11 -27 25 23 20 18 17 14 11 -11 13 15 18 21 24 25 -17 18 19 20 22 -52 55 58 60 63 66 -55 57 59 62 63 65 68 -7 8 11 14 17 20 21 22 -84 83 81 78 77 -24 21 19 17 16 14 11 -41 38 37 35 33 30 27 -74 77 78 79 82 85 -63 61 60 57 56 55 53 -27 30 33 34 36 39 41 43 -62 65 67 69 70 73 74 77 -51 49 48 47 44 42 41 38 -22 23 24 27 28 -49 50 53 56 59 62 65 -36 33 32 31 30 -5 8 10 13 14 17 19 -38 37 36 33 31 30 27 24 -55 56 57 59 62 -43 46 48 51 53 55 57 -37 39 42 43 46 49 -45 47 50 53 56 -6 7 9 11 13 16 18 19 -57 58 61 62 63 64 67 69 -13 12 11 10 7 6 -82 79 78 76 74 71 70 67 -16 14 11 8 5 3 -13 16 19 22 25 27 29 31 -35 32 31 28 27 25 -22 25 27 29 31 33 35 -67 70 73 76 78 80 82 -20 21 22 25 27 30 31 32 -66 63 62 60 57 56 55 54 -32 31 28 27 24 21 20 18 -13 15 16 17 18 -80 81 82 84 85 86 88 89 -49 47 46 45 43 41 -69 66 65 63 60 59 56 -76 74 71 68 66 65 64 -25 22 21 19 16 13 11 8 -44 46 49 51 52 53 -33 36 37 38 40 -65 62 59 57 54 -87 84 83 82 81 -58 59 60 63 65 68 -55 58 60 62 63 64 65 67 -77 79 80 82 85 86 88 90 -26 29 30 33 35 36 -83 84 87 90 92 -42 44 47 50 52 55 -76 73 72 71 70 -38 36 34 33 30 27 25 24 -72 73 76 79 80 -83 80 79 77 74 73 -2 5 7 9 11 12 15 -33 31 28 25 24 23 21 -81 82 84 87 88 91 93 94 -80 77 74 72 71 69 66 -68 66 64 63 60 57 55 -31 30 28 26 23 -35 34 31 28 27 26 25 -76 78 80 82 84 -85 84 83 81 80 79 78 -78 80 81 82 84 -17 16 13 11 10 8 -84 85 88 91 92 93 -83 86 89 91 93 96 98 -46 43 41 40 39 37 -77 78 80 83 85 -46 47 48 51 52 55 -88 86 84 81 80 77 75 -12 13 15 18 21 22 25 -29 28 27 24 23 20 17 14 -8 7 6 5 2 -88 87 85 82 79 77 75 -47 50 52 54 57 -78 80 83 84 85 88 90 -67 70 72 74 75 78 -10 11 14 16 19 21 22 25 -41 44 46 47 48 -37 35 33 30 27 24 23 -29 28 26 23 22 21 -24 27 30 31 33 -16 18 19 21 22 25 26 27 -97 94 92 91 88 87 -4 7 10 12 14 15 18 21 -1 4 7 9 11 13 16 -80 78 76 73 70 69 -59 57 56 54 52 -53 56 57 59 62 65 -47 44 43 41 38 36 33 -10 11 12 14 16 17 18 -94 91 90 87 86 83 -96 95 94 93 90 87 86 -27 30 32 35 38 41 -35 37 38 39 40 41 -88 89 92 94 96 -59 61 64 67 68 71 72 73 -2 5 6 8 9 12 15 17 -71 74 75 76 79 81 82 -40 41 44 47 48 51 53 -60 63 64 66 67 -21 24 27 29 31 33 36 39 -11 13 14 16 18 -74 75 76 79 82 -24 26 28 31 33 -59 56 53 51 50 49 -60 61 63 65 67 70 72 73 -94 92 90 87 84 82 80 79 -67 66 63 60 58 -25 22 21 20 18 16 15 13 -1 3 4 6 9 12 13 16 -38 37 35 34 32 -30 31 32 34 35 38 40 -64 65 66 68 70 -3 4 5 6 7 9 -85 84 81 79 78 76 74 71 -39 36 34 33 31 30 29 27 -70 67 65 64 61 58 56 -81 78 76 73 71 68 67 -13 15 18 21 22 25 27 28 -82 81 79 76 75 74 72 -42 44 47 49 52 -40 41 44 47 49 52 53 -73 76 79 80 82 -83 84 86 89 91 -45 42 41 38 37 -62 60 57 56 53 52 -25 27 29 31 34 -32 34 36 39 40 42 43 -41 38 36 35 32 29 26 23 -28 30 33 35 36 38 41 42 -37 38 41 42 44 45 46 -28 25 22 19 17 14 11 -74 72 69 67 66 -65 66 67 69 70 -21 22 24 27 28 29 31 34 -51 50 47 46 43 40 39 -27 28 30 33 34 37 38 39 -82 83 86 89 92 94 97 99 -98 97 94 92 91 90 89 -85 83 82 81 80 78 -87 85 84 82 81 -70 72 74 75 78 80 83 85 -18 19 22 23 24 27 -11 13 15 16 19 22 24 25 -55 58 59 61 64 66 68 70 -29 26 24 23 21 18 17 15 -50 51 52 53 56 57 -88 87 86 83 81 79 -35 38 39 42 45 47 48 -67 70 71 74 75 -91 90 89 88 86 -21 18 17 15 13 -37 36 34 31 30 27 25 -67 66 65 63 61 60 58 -76 73 70 68 67 65 64 63 -37 39 42 44 45 -6 7 10 11 13 14 16 18 -25 24 21 20 18 15 14 11 -84 83 80 79 77 76 74 72 -19 17 15 12 10 -83 85 86 89 91 92 93 94 -13 14 15 16 17 19 -97 95 92 91 90 88 87 -62 65 67 70 71 74 75 78 -19 17 14 11 9 -2 5 6 7 9 11 12 15 -30 32 34 35 38 40 -30 33 34 37 40 -76 77 80 83 86 87 -15 12 10 8 7 -22 20 18 15 13 -16 15 13 12 10 8 5 4 -36 38 41 43 44 46 -55 52 49 46 45 43 -15 12 9 7 5 4 3 2 -54 55 57 60 63 66 -64 61 59 56 54 53 50 -37 40 43 46 47 48 51 -70 69 66 64 61 60 59 57 -21 18 15 14 13 12 10 -49 47 46 43 41 39 36 33 -33 36 37 39 41 44 -87 89 90 93 95 -99 96 94 92 90 -59 56 54 53 50 48 46 -92 90 89 87 84 83 80 -2 4 7 9 11 -28 25 24 22 19 17 -99 96 95 92 89 -76 73 71 69 67 64 -88 90 92 95 97 -25 26 27 28 29 30 33 -37 34 33 31 30 29 27 -1 2 5 6 7 9 11 13 -26 24 22 21 20 18 -33 31 30 27 25 24 22 20 -68 69 71 73 76 77 80 -42 40 39 37 34 32 29 27 -67 66 63 62 61 -24 21 18 15 14 -67 64 61 59 57 -80 83 85 87 88 89 91 92 -29 32 35 38 40 43 46 -42 41 40 37 36 -68 69 71 74 75 -45 44 41 38 37 34 31 30 -59 58 56 54 51 48 47 46 -39 41 42 44 46 49 52 -67 65 63 61 58 57 -71 73 75 76 79 82 85 -93 92 91 88 86 84 81 79 -32 29 28 26 25 23 -52 55 57 58 60 62 64 66 -51 53 55 57 58 59 60 -35 32 30 29 27 24 21 -69 71 73 75 76 -26 28 30 33 34 36 -26 24 21 18 17 16 14 12 -57 59 62 64 66 67 69 -23 20 18 17 15 -33 34 37 38 39 40 42 -85 86 87 88 90 93 96 97 -43 41 40 37 36 34 32 29 -23 26 27 28 29 31 34 35 -26 23 20 18 17 16 15 12 -54 57 59 62 64 65 67 68 -88 85 84 82 81 79 77 76 -88 86 84 83 81 80 78 -94 91 88 85 84 81 78 77 -62 61 58 57 55 53 50 -47 45 43 42 40 -23 22 21 19 17 16 15 -34 36 38 41 42 45 -15 13 11 9 7 -41 44 45 47 48 50 52 53 -82 79 77 76 75 72 70 67 -71 72 74 77 79 80 81 -56 53 50 47 44 -33 34 37 39 40 42 -60 58 55 52 51 48 -67 64 62 60 57 55 53 50 -27 26 23 21 18 16 13 11 -72 69 68 66 63 62 -61 64 66 69 70 72 74 -9 12 14 16 18 21 22 -42 39 38 36 34 31 29 -77 76 73 71 68 66 -10 7 6 4 2 -39 37 35 32 29 28 27 26 -68 71 74 76 79 80 81 -45 47 48 51 54 56 59 -91 90 89 87 86 85 83 82 -42 44 47 49 51 52 53 -24 23 22 20 18 16 13 -14 12 11 8 6 3 2 -45 42 40 39 36 -32 34 36 39 42 43 44 -89 87 86 85 82 81 80 -10 12 15 16 19 -62 59 57 55 53 51 48 -99 98 96 93 90 87 86 -56 58 59 60 61 64 66 69 -49 50 53 56 59 62 64 -79 76 74 71 70 67 -66 63 61 59 57 55 54 52 -32 31 30 29 28 25 23 -88 91 94 96 97 99 -72 74 76 79 82 -14 16 18 19 22 23 26 29 -51 49 48 46 45 43 41 -58 59 61 63 66 68 70 -13 10 9 6 3 2 -77 75 73 70 68 67 -62 60 59 57 54 53 50 diff --git a/day-2/main.go b/day-2/main.go index fc42d53..1f1ae8a 100644 --- a/day-2/main.go +++ b/day-2/main.go @@ -1,23 +1,25 @@ package main import ( - _ "embed" "flag" "fmt" "log" "strconv" "strings" + + file "github.com/shaunburdick/advent-of-code-2024/lib" ) -//go:embed input.txt var input string func init() { // do this in init (not main) so test file has same input - input = strings.TrimRight(input, "\n") - if len(input) == 0 { - panic("empty input.txt file") + inputFile, err := file.LoadRelativeFile("input.txt") + if err != nil { + log.Println(err) } + + input = strings.TrimRight(inputFile, "\n") } func main() { diff --git a/day-2/main_test.go b/day-2/main_test.go index 98dae7a..e89232b 100644 --- a/day-2/main_test.go +++ b/day-2/main_test.go @@ -2,8 +2,17 @@ package main import ( "testing" + + file "github.com/shaunburdick/advent-of-code-2024/lib" ) +type TestDeclaration struct { + name string + input string + want int + run bool +} + var example1 = `7 6 4 2 1 1 2 7 8 9 9 7 6 2 1 @@ -12,20 +21,18 @@ var example1 = `7 6 4 2 1 1 3 6 7 9` func Test_day2_part1(t *testing.T) { - tests := []struct { - name string - input string - want int - }{ + tests := []TestDeclaration{ { name: "example", input: example1, want: 2, + run: true, }, { name: "actual", input: input, want: 356, + run: file.ExistsRelativeFile("input.txt"), }, } for _, tt := range tests { @@ -39,7 +46,7 @@ func Test_day2_part1(t *testing.T) { func Benchmark_day2_part1(b *testing.B) { for i := 0; i < b.N; i++ { - part1(input) + part1(example1) } } @@ -51,20 +58,18 @@ var example2 = `7 6 4 2 1 1 3 6 7 9` func Test_day2_part2(t *testing.T) { - tests := []struct { - name string - input string - want int - }{ + tests := []TestDeclaration{ { name: "example", input: example2, want: 4, + run: true, }, { name: "actual", input: input, want: 413, + run: file.ExistsRelativeFile("input.txt"), }, } for _, tt := range tests { @@ -104,6 +109,6 @@ func Test_day2_outliers(t *testing.T) { func Benchmark_day2_part2(b *testing.B) { for i := 0; i < b.N; i++ { - part2(input) + part2(example2) } } diff --git a/day-3/input.txt b/day-3/input.txt deleted file mode 100644 index 2ea189e..0000000 --- a/day-3/input.txt +++ /dev/null @@ -1,6 +0,0 @@ -;(,)mul(858,702)-*(?from()/mul(35,359)who()mul(856,94){why(114,10)-}[how()]#mul(778,521)why()where()??^mul(990,780):(how()don't()^why()>^mul(352,9)~)when()-where()when()&why()$^mul(379,297)}*#]when()~from(116,753)'((mul(478,803))#where()''*mul(893,529)~@how()#mul(170,765)?what();mul(630,481)who()@]mul(576,452)!>+$mul(839,395))~&select()*mul(630,148)mul(637,733)from(),{select()$what()&don't()}mul(965,332)$;{*mul(563,908)from()?~why()how()mul(907,261)why()mul(683,576)from()when()}!]!mul(687,422)> [<*mul(811,962)^mul(717,674)~@{)who()when()]mul(402,513)%when()%$*mul(922,320)~!*%$^mul(536,772)-#>select()where()({'#mul(217,696)select()>{select()~select()%mul(41,999)&mul(615,164)/%[-#*&}mul(488,200)what()?$mul(235,838):@what():mul(428,894)<(#&#don't(),[*$ mul(502,555)>who()'~]'*}mul(397,619)mul(677,653)@from(443,650)where()*;-@)]mul(761,412)mul(434,521)/!/what()@,why(),mul(319,307)-[~/}from()-)mul(13,180):?~{&*,'mul(560,200))#$[;+/!]mul(269,735)mul(131,915)@* when()@:why(256,731)')#mul(455,277)<+{how():'@!#mul(721,65)from()?!(mul(387,564)!how(742,879)from()%select()-(^mul(854,744)<%: ^~}mul(176,188)[<>,;mul(914,199)>**mul(248,259);what()~?;}*{select()mul(559,588)*)do()~*{*what();[ mul(445,787)how()mul(833,324)'[ #how() why()$;~mul(929what()mul(687,390)select()when()what(499,700)!*when(158,490)mul(929,336)>mul(865,751)*:''mul(881,809)%from()<{what(),why())mul(467when()>from()-/mul(396,641):@/ what()how()*{$(do()from()}what()mul(210,926)what()#'@mul(437,84)how():why()where()'}!{where()mul(86,264)'/when()mul(344,101);%#%@'who()#}mul(274,657)what()'what()from()';mul(997,598),['?mul(534,554)mul(466,734){mul(910,968)&{why()~,;!:mul(308,302^~[}<:mul(745,927)>$~%mul(897,144)~who()#[{+what()what()*mul(408,883)?]when()where()when()>~?mul(319,561)>>mul%mul(423,423)where()why()('why()don't()#)&;where()]mul(478,184)select()]>]]''*do()}^{why()mul(928,991)*+!{from()*#-mul(113,915)}why()what()from(){(:?!mul(768,68)-%*^>&^&mul(799,399)where()/mul(451^@mul(476,439)[](>{!who()}mul(401,954) )when()!-%~mul(150,216)[select()<+who()^mul(76,864))select();:select()mul(576,9)when()]what()from()mul(228,354))^!^;-$%mul(623,265)(when(470,524)#select()where()-mul(113,681)when()mul(521,682)@/when()select()mul(651,598)$~-#how()mul(840,408)do()#where()/:select()how()mul(820,511)how()mul(727,13)mul(970,417)^~:}~^where()from()':do()<;when()[>mul(259,372)/,:%mul(255,971)/!)}where()select()-mul(460,320)!!mul(849,743)]when())*mul(180,806)when()>?!from()*mul(595select()mul(649,876):->-(what()when(180,454)]how(968,910)do()what()how()/*from()select()++),mul(482,581)>,#{mul(66,275)mul(647,525)&#'mul(377,626)+where()]mul(630,898)?mul(317,506)mul(903,888)],what()#mul(766,841)+}%-what(287,912)+/#why()don't()>where()from():mul(145,488}-[mul(712,25)/mul(797,334),from()who()}from():),mul(323,141):#}where()where()%from() }*mul(848,645)why()';?+;];from()mul(181,788)}{?when()from()<^mul(103,568)}&~(>how()#>when()+mul(343,438)%/?-!why()]^why()mul(349,623)?mul(614,519)where()who(608,465)+, mul(318,996)$)from(322,982)mul(929,651) @:(%mul(683,248)who()when()who()why(594,423)>]mul(717,522)$select()do()#select()mul(4,875)@]<$why()*do() )<']*[?mul(22,93)'who()what()#'/[;/mul(130,509)&(${mul(348 '@mul(984,787):-/[mul(454,365)]what()$mul(249,223)mul(503,598)>:mul(369,549)who()[what()?from()where()^&-do()mul(977,871)%what()mul(762,528))@^-^who()}/:-mul(917,277)#{?%mul(659,953)who()from():+<^}:<mul(896,392)]select()--(;!(mul(121,437)-~[[?%>mul(63,503)select(){{!]#who()mul(977,491)**:*%%don't()]where()/mul(292,954);]>~(from()<$%mul(683,74)where()where()<$[mul(204,861)from()@what()~ #-mul(455,989)$when(595,175)?}:]%)+mul(218,118)$from()*select())how(632,888)from()don't()/}why()select()+@?where(){mul(773how():mul(731,156)%']?when()mul(390,980))where()what()mul(698,483)mul(617,983)#,)[when()%;mul#*%don't()mul(446,527)@@*%who()where()#when()~mul(418,536*;why()when()mul(651,531)$mul(532,68),/~what()mul(12,180):mul(654,368' from()select(772,96)where()when()%}mul(32,581)from()*$?how();where()&mul(41,175)/[mul(36,825)do()/how()when()<*~#^;mul(413,399)]select()*'where(988,834)do()from()}mul(589,631)+{!-%[+~,{do()/who()&from()%$$*{%mul(87,334)&{}from()]mul(293,208)&&*'who()*mul(333,989)%[[ ]mul(516,15)~{#mul(888,937)when()%from()'$~mul(299,886)how(74,112)}+]mul(304,310) mul(222,429)!$}$who(),:@(mul(249,734)~what()?how(418,670)do()!what(),'&who()}];select()mul(499,633)?[?,who()^<-mul(593,430)^#why() [$where(50,106)who()mul(911,397)[) [)@-who()when()(mul(939,597)>where())~~-mul(53,794);<~/how()mul(297,882)do()how()++]select()-+mul(651,458)when()what()@^mul(773,576)$what()what()from()}:<&why()mul(699,864)from()!/$[where()mul(456,889)&)don't()!?@who()why(853,185)mul(303,720)what(358,684)]%where()!what()mul(14,909) -<][mul(520,164)@ %$;mul(118who())(mul(433,718)select()~: mul]*who()&mul(186,91)&#how()^from()where()from()!mul(872,843)where()+&@'?what()where(242,351)mulwhy()what()when())*(!^why()mul(285,779)!>>mul(912,530)}}from()mul(439,204'what();]/#-]mul(724,984)$:how()where()}mul(291,595))<*+&#mul(710,846{what()& how()!/~mul(719,20)%what()don't()from()%!/)%#-when()'mul(390,194)select()*%+who()mul(620,559)where()-+where():>what()%[don't()&*'{mul(487,458)from()@}<&':mul(284,240)'what()}from()) where()mul(140,943)>)'/(mul(379,292)!+[~&({:mul(184,248)?,where()from(668,581)}]%mul(476,864)'([><(<}mul(383,543)(mul(54,809)where()who()where()[:mul(732,830)$who()%when()what()#) -mul(156,846)}'$%<,'~mul(241,296)}'what(225,40)?how()%from()from()#mul(331,481):$how()-)](!mul(342,855)who()/~,from()#'$;~@)mul(858,699),@/do()~%how()when()<>/mul(894,669)&+mul(734,520);mul(690,168*)+/mul(84,758)>!select()from()<{mul(374,587){&$$@where()';when(402,673)mul(887,673)@'[[what()^from()mul(17,756)%%(<]mul(814,306)where()+who()mul(138,523)mul(961,961)>how(960,295) <^}why()where()mul(529,982)!;~mul(489,849)(*)?>%mul(570,381)who()*select()@ +mul(826,522)&+:^~$how()what()$select()do()~why()]why()what()mul(643,495)mul(34,439)mul(657,375)!(how()?mul(177,65)&>[what()mul(552,376)where(633,38){(:(*do()&)+mul(689,184)/{mul(711,957)+?what()-&~-,!/mul(106,102$mul(468,125);}-$mul(451,95)mul(792,372)}select()select()select():][!mul(207,775when(){+&; who()#mul(877,149);])'[+,&;mul(994,994)'}select()mul(503,637)'{#why(37,49)from())<#(mul(301,442)>,!when()] who()select():what()mul(727,66)what()~*[+where()[^mul(438,988)}how()~;*%~?-don't()'who()}!($:mul(581,545)&{how()?from(650,743)!:)#mul(11,800)?&??$>mul(816,96)$]where()%%^:select()select()mul(529,111)select()from()%?^*mul(360,694)select())* *@*<#&mul(30,413):^''@mul(319,911)!)-select()select()why(152,790)}mul(148,10)how()!]mul(247,811): ~&,$-mul(660,54);why()@mul(694,449)(what()+mul(615,285)<)>do()from()why()~mul(800,658)why()')select()who()mul(155,2)}')^select()from()'^[{mul(763,673):}:where()({how()mul(813,428)&?!-why() ,]]mul(865,165)do()when();:how(408,266)mul(328,267)}how(614,872) ^@^#mul(714,826) [mul(826,638)[ why()'(%}/(mul(500,76)'! ,#mul(10,267)' ;^mulwhen(16,622)~? select()',?}mul(541,994)-from()select()-~why()how()mul(47,669)(who()why()when()~mul(998,298))mul(937,507)^when()select()[}$],%mul(148,102)mul(39,980)+-+%;who()why()(mul(690,355)+!#^'-do())!-$,mul(59,509)],how()~?mul(57,388)how()( mul(442,904)[$from():&;^~mul(702,195)what(),why()^mul(244,471)(>select()^select(694,426): how()*mul(19,675)why()what()from(734,40)#where()mul(270,397[}*from()]/from()*+mul(855,233)~, @from():mul(935,285)mul(834,256)]mul(880select()mul(915,279))where(764,367)]$mul]who()how()mul(805,164)$}select()%@select()@,>#don't()]]why();select()%from(96,570){!}]mul(432,373)~)-mul(436,907)<$@what()why()who()$mul(236,42)from(758,332):*#who(),$how()mul(528,36){mul(514,585)}mul(263,66)-<:$?select()}*mul(665,667)+{{<+!]>([mul(430,685$~'mul(842,44)/%select()mul(759,831))$:!#!/usr/bin/perl~$mul(155,353),*select()^#}mul(570,117)from()*from(),:^select()!%-mul(643,646)-:)#()where()why(){^mul(840,147)from())mulwhere()< !;;+{ %'mul(365,934)mul(68,395)>}from()mul(271,627)*mul(701,973)~mul(781,778)@mul(815,159)when()}-#?'mul(746,396)mul(724,844)what()how()what()%mul(954,395)how()<+from()*?mul(27,969)select()]from()$##[mul(652,117)what()who()?$?who()mul(513,501)]]%what()mul(906,170)+!)[[~/^mul(341,349)mul(990,89)/ how(){^{what()mul(543,751)^/{:mul(161,830)>;$$&mul(60,852)mul(110,789)why() @select()!mul(232,23)-#where()[(}mul(113,909),)how(){) (;>mul(218,441)~,%(^select()[mul(383,714)-*<~+)when()~&mul(802,923 from()>what()select()mul(875,944)!select()<%+[mul(974,967);mul(359,518)who()%mul(725,236)$<'{mul(223,195)[!mulwho()@&:mul(965,312)>why())$mul(651,272)><&}mul(586,166)):<&[*;mul(973,90)<>where()-&when()when()-[&mul(522,382)where()&when()--where()mul(327,551)mulfrom()]{?why(126,484)<]mul(759,5)?what()who()';+:;mul(676,54)'from())how()#$where()++mul(108,594)mul(470,453)where()~:&,mul(540,6)/mul(34,148)from():%[#when()}mul(543,235)who()?how()why()!!' mul(293,694) ?do()^@mul(194,754)(+^{<(mul(695,979)from(190,23)where()])&[why()mul(347,45)[select()^mul(257,87))why(66,98)^mul(315,641)who())$how()mul(513 +)%*(:*who()how()]don't()why()#$mul(313,874)where() ^when()+*what()[mul(819,556)why(231,430):,mul(317,224)%!!)&how():don't()where()^mul(724,210)''how()how()what()where()+-)mul(653,313)how()/(mul(718,132){mul(304,399)+mul(813,580)why()select()from()*)[:do(),from()how()@why()when()mul(420,147)why()<;mul(286,778)/@?%-mul(843,55)?mul(708,572),)who()-mul(804,987):}/%?},where()?when()why(831,88)mul>^]'}(where() ]~where()mul(447,399)-&why(360,508):@{* mul(190,685)*,?how()mul(562,517)~mul(276,16)mul(804,20)]]what() from()){{mul(88,726)-where()/)-from()what()*mul(261,86); }who()why()what()[%%mul(845,611),+mul(579,992)%$why()don't()?&!(mul(159,448)!how() mul(13,152<'(;mul(418,959)%who()?from()mul(929,190) ~when()}'%&^mul(541,283)#>mul(998,260)-?where()who(403,852):)mul(505,488)mul(435,756)+;select()+[mul(483,501)+( ^how()>@(mul(614,830)what()mul(248,34)*when()*,@where(371,503)@#]mul(620,74)~who()select()why();#?mul(686,263!why(),;when()*/%mul(363,968)(*#what()#{~select(926,636)why(681,621)mul(551,129)+;,*>mul(543,78);mul(706,409)),who()$]>what(803,604)why()what()mul(673,839) -@}[->why()when()mul(736,440)'what()@>$}mul(747,892)?!]mul(49,971)who()?){;;![}?mul(383,914)}(who()-}how()mul(618,311)who()('{,from()where()mul(502,765)mul(436,416)select(){:who()[&<mul(828,942)@)/who()mul(806,221):{-from()what()/-!%select()mul(222,135)[,what())-+from()mul(789,51)how()>;^$')when()!where(449,459)mul(134,544)#mul(592,830)$what(),mul(450,952)from()(what()?what()%+mul(491,815)where()^{^+/mul(964,386)^why()%,'when()'mul(751,11)?mul(990,552)-who()$>/$)%(mul(847,756)#:where(891,107)^['from()why())from()mul(989,549))/mul(128,819)'?mul(315,133))+#select()()*select()[where(692,300)mul(658,119)mul(68,966):<-,:)}{@mul(542,35)]who(683,885),-how()]}mul(793,264)when()do()+where();why()when()mul(435,912)?+select()when()(:%mul,,*'when()<[,from()mul(319,351)'($(#[mul(983,596)$}])@),mul(958,131)@@!;!}}!select()}mul(703,609)!*#]#mul(757,8)>}}mul(417,359)mul(871,898)where()from(549,555)mul(48,800)[when())!mul(42,556)&from()+&#mul(917,10);>mul(332,621)}+['{mul(401,135)~%[;:$))do()what()+mul(779,9))()mul(901,432)!'(select()~mul(64,712) ,don't()]who()~+^#&what()/mul(900,5)select()-*mul(267,404)mul(136,977) #!@mul(465,853)what()select()/~~+where()mul(101,322) #/'why(135,719)do()select()}%%mul]}: /what()}mul(548,867)>'~-&-$;!mul(775,563)select()/:(^@]how()}%mul(593,707)#&mul(786,814)/)%]&}'*mul(653,744),what()#&mul(545,436){@%*@>who(183,90)/;what()mul(13,919)don't()@}&)?(mul(131,107)mul(233,301)mul(222,55)}who()-why()mul(828,783)$}how()select()mul !mul(378,347):}@mul(139,917)+]^):how()[[^mul(593,751)*'!select()$select()*mul(859,230)))>{;<#who()mul(37,617)%from()why()):':mul(207,241)^when()mul(982,474&from()mul(202,531)why()why()$where()!how()}mul(196,19)#when()>mul(600,831))&why()from()@~<mul(113,738)%}what()%when()-^*'[mul(659,665)'-<}where()who()from()<~mul(779,45)mul(964,79);-mul(454,704)%,[}^^mul(714,902)?how()&$$/>mul(678,277))select()@!}}mul(973,867)/how())/~+mul(961,737)~ don't()'< where()who()}mul(902$$when(),@select()mul(9,964);from()},'<{how(654,359)mul(788,711)[select();%);mul(618,648))mul(622,99)]why()(when()why()*>(mul(456,858)/$who()where()(mul(691,120)?&{#!$mul(841,857)mul(792,885)*mul(919,871)(/>^':%$mul(829,758)where();mul/what()~/;from())^^where()do()~?+/(who()'}mul(655,175)from();what()when()$!^mul(216,476)[}?'$}[how()from()$mul(611,263)where()>,@-mul(747*mul(351,765)[mul(469,471)from()how(){;/select()#mul(423,493)why()where()mul(66,973)why(132,717)):*{select()mul(612,848)}^?where()$when()]/}:mul(527,124)}how()/,&>?/mul(870,331)^* mul(130,565)>~]&}#where()#[[mul(626,163)?-how()mul(153,137)?what()>@:>)>mul(972,544)-@,$[who(342,586)/don't()$[$~who()?:[/;mul(930,217)&}{what()mul(241,121)+mul(850,9)where()from()why()^}(#don't(),#how()#mul(821,737){*mul(726,629)<$why():select()mul(556,762)%*$'^&when()mul(432,395)#$':*/&when()when()when()mul(466,888):'what()mul(967,260)]##;how(458,10)@-$who(),mul(693,120)+,select()^from()mul(281,907)(@]-[mul(807,218)select()how(){ select()mul(773,151)'$;(};+mul(962,731)}^/where()#from()[~-mul(944,522)(mul(253,853)(@from()where()--don't()mul(434,54)who()^-when()/?don't()->!what()when(){*?mul(140,314)who()[@mul(21,934)(when()mul(446,332)^^when(32,819)don't()select()what()^why()when()mul(353,42)&(*&*mul(515,560)]^select(13,885)mul(341,643)%mul(772,777)]how():-why(835,947):select()>mul(780,58){~@from(12,674))mul(24,327)why()!$when()why();from()from()mul(53,613)who()when(),$'who()%mul(130,984)}-}^mul(634,685)do()+mul(835,113)when();/how()'mul(516,246)@from()}do()):;;{why()how()-^mul(866,121)(/mul(289,117)select()}^who()*>@,/)mul(494,764)why()how()where();mul(263,332)%,%^{&@mul(470,641) {%mul(572,709)>#,/ from()[mul(189,623)$mul(359,331),how()>why(10,98)!do() where()*:mul(908,32) diff --git a/day-3/main.go b/day-3/main.go index b4780c0..8c3e170 100644 --- a/day-3/main.go +++ b/day-3/main.go @@ -1,23 +1,26 @@ package main import ( - _ "embed" "flag" "fmt" + "log" "regexp" "strconv" "strings" + + file "github.com/shaunburdick/advent-of-code-2024/lib" ) -//go:embed input.txt var input string func init() { // do this in init (not main) so test file has same input - input = strings.TrimRight(input, "\n") - if len(input) == 0 { - panic("empty input.txt file") + inputFile, err := file.LoadRelativeFile("input.txt") + if err != nil { + log.Println(err) } + + input = strings.TrimRight(inputFile, "\n") } func main() { diff --git a/day-3/main_test.go b/day-3/main_test.go index 8ab46b7..631db78 100644 --- a/day-3/main_test.go +++ b/day-3/main_test.go @@ -2,72 +2,81 @@ package main import ( "testing" + + file "github.com/shaunburdick/advent-of-code-2024/lib" ) +type TestDeclaration struct { + name string + input string + want int + run bool +} + var example1 = `xmul(2,4)%&mul[3,7]!@^do_not_mul(5,5)+mul(32,64]then(mul(11,8)mul(8,5))` func Test_day3_part1(t *testing.T) { - tests := []struct { - name string - input string - want int - }{ + tests := []TestDeclaration{ { name: "example", input: example1, want: 161, + run: true, }, { name: "actual", input: input, want: 182780583, + run: file.ExistsRelativeFile("input.txt"), }, } for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if got := part1(tt.input); got != tt.want { - t.Errorf("part1() = %v, want %v", got, tt.want) - } - }) + if tt.run { + t.Run(tt.name, func(t *testing.T) { + if got := part1(tt.input); got != tt.want { + t.Errorf("part1() = %v, want %v", got, tt.want) + } + }) + } } } func Benchmark_day3_part1(b *testing.B) { for i := 0; i < b.N; i++ { - part1(input) + part1(example1) } } var example2 = `xmul(2,4)&mul[3,7]!^don't()_mul(5,5)+mul(32,64](mul(11,8)undo()?mul(8,5))` func Test_day3_part2(t *testing.T) { - tests := []struct { - name string - input string - want int - }{ + tests := []TestDeclaration{ { name: "example", input: example2, want: 48, + run: true, }, { name: "actual", input: input, want: 90772405, + run: file.ExistsRelativeFile("input.txt"), }, } for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if got := part2(tt.input); got != tt.want { - t.Errorf("part2() = %v, want %v", got, tt.want) - } - }) + if tt.run { + t.Run(tt.name, func(t *testing.T) { + if got := part2(tt.input); got != tt.want { + t.Errorf("part2() = %v, want %v", got, tt.want) + } + }) + } } } func Benchmark_day3_part2(b *testing.B) { for i := 0; i < b.N; i++ { - part2(input) + part2(example2) } } diff --git a/lib/file.go b/lib/file.go new file mode 100644 index 0000000..62b1555 --- /dev/null +++ b/lib/file.go @@ -0,0 +1,51 @@ +package file + +import ( + "errors" + "os" + "path/filepath" + "runtime" +) + +func LoadRelativeFile(path string) (content string, err error) { + content = "" + + // get the current source filename + _, filename, _, ok := runtime.Caller(1) + if !ok { + err = errors.New("Unable to file caller") + } else { + absPath, pathErr := filepath.Abs(filename) + if pathErr != nil { + err = pathErr + } else { + file, fileErr := os.ReadFile(filepath.Join(filepath.Dir(absPath), path)) + if fileErr != nil { + err = fileErr + } else { + content = string(file) + } + } + } + + return content, err +} + +func ExistsRelativeFile(path string) bool { + _, filename, _, ok := runtime.Caller(1) + if !ok { + return false + } else { + absPath, pathErr := filepath.Abs(filename) + if pathErr != nil { + return false + } else { + _, fileErr := os.Stat(filepath.Join(filepath.Dir(absPath), path)) + if fileErr != nil { + return false + } else { + return true + } + } + } +} diff --git a/scripts/template/tmpls/main.go.tmpl b/scripts/template/tmpls/main.go.tmpl index b74d9be..7191226 100644 --- a/scripts/template/tmpls/main.go.tmpl +++ b/scripts/template/tmpls/main.go.tmpl @@ -4,18 +4,22 @@ import ( _ "embed" "flag" "fmt" + "log" "strings" + + file "github.com/shaunburdick/advent-of-code-2024/lib" ) -//go:embed input.txt var input string func init() { // do this in init (not main) so test file has same input - input = strings.TrimRight(input, "\n") - if len(input) == 0 { - panic("empty input.txt file") + inputFile, err := file.LoadRelativeFile("input.txt") + if err != nil { + log.Println(err) } + + input = strings.TrimRight(inputFile, "\n") } func main() { diff --git a/scripts/template/tmpls/main_test.go.tmpl b/scripts/template/tmpls/main_test.go.tmpl index f3a1e02..24bec4c 100644 --- a/scripts/template/tmpls/main_test.go.tmpl +++ b/scripts/template/tmpls/main_test.go.tmpl @@ -2,72 +2,81 @@ package main import ( "testing" + + file "github.com/shaunburdick/advent-of-code-2024/lib" ) +type TestDeclaration struct { + name string + input string + want int + run bool +} + var example1 = `` func Test_day{{ .Day }}_part1(t *testing.T) { - tests := []struct { - name string - input string - want int - }{ + tests := []TestDeclaration{ { name: "example", input: example1, want: 0, + run: true, }, { name: "actual", input: input, want: 0, + run: file.ExistsRelativeFile("input.txt"), }, } for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if got := part1(tt.input); got != tt.want { - t.Errorf("part1() = %v, want %v", got, tt.want) - } - }) + if tt.run { + t.Run(tt.name, func(t *testing.T) { + if got := part1(tt.input); got != tt.want { + t.Errorf("part1() = %v, want %v", got, tt.want) + } + }) + } } } func Benchmark_day{{ .Day }}_part1(b *testing.B) { for i := 0; i < b.N; i++ { - part1(input) + part1(example1) } } var example2 = `` func Test_day{{ .Day }}_part2(t *testing.T) { - tests := []struct { - name string - input string - want int - }{ + tests := []TestDeclaration{ { name: "example", input: example2, want: 0, + run: true, }, { name: "actual", input: input, want: 0, + run: file.ExistsRelativeFile("input.txt"), }, } for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if got := part2(tt.input); got != tt.want { - t.Errorf("part2() = %v, want %v", got, tt.want) - } - }) + if tt.run { + t.Run(tt.name, func(t *testing.T) { + if got := part2(tt.input); got != tt.want { + t.Errorf("part2() = %v, want %v", got, tt.want) + } + }) + } } } func Benchmark_day{{ .Day }}_part2(b *testing.B) { for i := 0; i < b.N; i++ { - part2(input) + part2(example2) } }