Compare commits

...

9 Commits

Author SHA1 Message Date
7499a58aeb day07 part 1 done 2025-12-11 20:29:38 +00:00
42a0c66398 finally solve day 6 2025-12-09 20:44:57 +00:00
1572d6f168 work on day6 2025-12-07 21:17:52 +00:00
365c33eddd more work on part 2 2025-12-07 08:29:46 +00:00
2eeb9e23a8 overcomplicating day 5 🔥 2025-12-06 22:37:38 +00:00
4797aa1b17 solve day 4 2025-12-06 08:06:01 +00:00
46eb66c761 work on day4 2025-12-06 06:57:10 +00:00
eba6bf594d remove print 2025-12-03 22:01:09 +04:00
ccd8b3556c day 3 (help) 2025-12-03 21:59:41 +04:00
21 changed files with 2604 additions and 0 deletions

200
inputs/day03.txt Normal file
View File

@@ -0,0 +1,200 @@
1343251421412233322221222224237236234142233242142412222262125322222244227223331122212244641224223322
3223332522337322697321323321321232535332335333122243112134542742123423233372332533333254233333253332
3532223222135223233234322462333222223322125732132322533238322123323123123233334236333322222332122223
5533335234525221354355632253135553254342433355224242563524275432251344855622253454235215232252522213
3263226122225241231222445121522324622221313223624213512523224221123221112562424142522822243232242126
5667855745636442648354433464455646564647535345656596752641676646465665566441656464546666482549568656
3445167313443112747364626436144842447422343255343454853442445272364323282433444445444447662364244465
2152533342332533222326343635322159323472334924532223363138225733362535232311333433257331134333223413
4446423224133975322433533514337522333335553332428542275543345132333344355523232431243459845443433883
1638443288937575332623652774753666225617276523584326435233644435435475136747557213637428364562364222
5232321212225222321232312422322232223112215212222132222222263113225223223166122222222332212112334122
5376545665241227627263367246275257253564357242335236366386223561464565226568665166611362644352354524
5242352416463236827524437326343242422276173246532331222437722544616616562132625263332176624384432466
3955227534233224583432338356663336478344724273696644334433374723264333533356332435445373232377437257
2241213221432712242323222122544232352344223223231433322416731152222121222425315232122422623633244223
4134353332323323323524533323453233523632346232343333463557221323222352332111423233231274124332433363
6648726625235765358643683845547422656672536631782581558247553464517123724138463655427425263461872239
2231424535245445324343443352233653533433434544444252157335444344331423255548443444432445423244454723
5363513424433242233557471445323433347963644563434221256766436512245443464443334453522332352343263263
2333443433144323444243439433466465444534345243429964473424424462324636346434442233424444632441344432
3221222221124322241222212324122521231222232212352233321222222292212232512212232223223222223211222162
7323473394445554444995334444253446245444533464343434444434444146644666454534444435544364443463644545
5433243254222433254293255432345544131274534324313332324533424135433542432433322533413244232331572582
1222223322362222222223223424432123222244342213232221124221222222312231222222221222241222232221222124
6587774685744867458576557632767785675473567635457755325375667336746577854755436653573665555554476775
2443316455432436537444533344333328765474452154632447437444454855653657424457555233295256434143445454
2222123222231225212314262312221231122422331223221222332222122222222122241322214223121322211141221321
3322363544442373243213322124444247422222443432374322416236542552323333434242333333311532233434234432
2122434233618123422223223322123139612432223383132223332263412432222223322222323922245421331322223425
6529543133625537447235963597858545344462635599576556933475192377471375993228785333493797265385524452
3233343233332822333342324314233132333322353433333443233424334333233443333235322433234332334232234333
1433223451863623451432523245452453342222336844241444443423134336344619972341244424544423134513324245
7742523254233523486433335466445372254437547645455543545546345763725358639746667643557543356332555476
7441252444442424334452422233144454252124335254332443334434433243442324242354145442445446431433424244
2223221322263623232222223122222222112222232113123223323227522426222222384331223122631122122422942221
1368241426724272554422633147266666634324925855456444315392243295365453524423244222491412133387622252
5245756634452264695826358866465467497663634268467467645534986532463543543886426345397856536656324543
2232622223337233227117213222235551225323521426372915322282351822632238722352255351331237292122322212
3443343543555226636525455354537423265134254456525565642533545365635346423544643166265535326232525133
3355356352255252525462243526262252212343293753355542432136425255522532344233252242223534332452453122
4422343334323334232133332324423219323234324223225332332332331332333323234231231331432323332431233232
2363222222333333222222227222123232452213335292311323544513332323923526433324223222432223332216225443
2234312433344344332354333322432454244454325233234244434442424344234442444442344443454444244334452544
4344446444454645544344524574442446674543464457415854544531648444434437364345434365564354344347514165
5346355343633344333374565364234533423345323335332433234343433436535234354336351232353326361853342544
7833665376677662358686657576476755935456448765667445585646487776666862468566677665656876457875666766
2221222222212232322222222112222222212222221322122222223223222121222222412212722222212221231222211222
2363222422222642162324441324264842727285221552731242722831732226241292223231843121422264614239344493
2113214222323223222322333121232313223422322533222223225133222221223333233322423133313222233222213732
5346422436364394676355755984466754632595667644613756568447866858589585439636966411485693688464536296
3222312321222222252352547322374352337333232272262263642372345233376223291623423363564127324322653223
2221424834272451533854174844725235625375524336743434926242325347352144538144357125469144545295223416
4336432573234533323212822443533875734333427434338533753336732234681273432542523685277222423253585823
6754454336444257444448446574437732244444672643543443554254136574424847251553474464375544657574654735
2113312324441223222323232222321222231323223232223432223223222223232222223321221212223132211222231322
6564746366566668575266834365282236673665465854675475433577762655453669665567576276452488737626763663
3623265477643434231234833553365236546334846333236245635436733363483643454344433552343436333234633457
2122433312933333222223239234423325331232313322351224132325233232331232223213331216712231333354223243
2333332522321313182222232432222244222223312622333223242382431313234142332233242231216222622216231222
6262221136652242231325124252422332322253232422223322121222222213342253223544222231447521432223321314
3245355131225321425124122442562435222125236532344452424822541554253226545415432432352232465432354659
2453322335653353343333424933333446254234553625345413325532643223435536433343665454237563734434653444
4924557499297833768797448787556645662676547479525725652773752426525537549988673856875259634857662335
5464471356265862234138713325324441243367442225353235265232154353853542465555554646294536245257331632
5864696779398674946433735989987799774786565972975486657825457257779552469997657765676867664556458596
5524322556623422426434543545535244445546224213433634431435355413352571423423534343454432454145152425
2226342222132142222222222222622411251212221222222117293152412222183124422222222212272222232352564221
4343353353453344443432533363434332245345443516344344444445333144254333533433444524414435423645554243
6542452454521221537223522262245122533224212224456653973572123142253144132752253412253381555522962413
5547665444534996247985587715453265455849866554335334273535666634526658357593644876686757978583443645
3332732235243333542333467432373333136437438338333542363313333343333435333132213333333332333338335633
2343222322322211133232242213243322324254422223423213412342422222322414341122222142222331233232213212
3322232232233223225133212222222231141236233232223233325222222312222223231322222323223241334426312323
5569587599969965989845755857997999789999568666453885679673575858945948969998488686589725854957748858
1235442343253345623453355534344447463534535333545465325432552434422425434484445242535423444434342333
2723425422125353422235353234212422325625221253442324334252235214221135323432332322247352313232221233
5244162632454632323221222232141342745222522514122222241215252313271362223261322426212243222232242423
4336225123533531333331531233343324333317336334522233333435433323111432246833264233373343474332633343
5535352345352663342533323254442233275554632433525437243635234331434543553514655325246354523444344233
4322233525335434333753255331223344361432356542348333523353331333643314245423535351222334123325534312
5644732293366326994435342872544784385554378664553368697224362553444247433364683558484974349452376433
4442564443853714237527535455525555343543313456546233555657313466542445452245353345925324532543535522
5476756126416224216377563557732365447467447772526672111571636241522117542373415527663435611565331189
2222225221312222232222122172322222221223272224223112421222213222122222322222221222223131122221231292
2111412323431211323121222131314323442334112431412442142243321412411344122324113144314243332142456789
5225694323453223322346335252223314212154332223341222631129333235223433333332233243333233322232325343
2224222222223132222617331546222232222222222615212731222112128111123221225312123322332242222213222332
2212225423261442631215472232322255132223492322532335322534422234712256333223332473842354223212351312
1322121231422222112221221121221622211223242213233222213311222222423123222222332222322322223312322233
3634436423293444434234334444443244444533344462452445444344458444444323344444466339435344353844464324
5456552634611255336233251425513444632242324561513462236531425233333354532411223312613546451116542789
2222322233545544223214452453325442223253414243341154532511326444262234212121281115522422222222425231
4313444553322361533222439334433533335533365332324534543333624334553332534712346216333613222352222342
4255133347353345512454324353264545334535324425356343231642445635433533533323335335463333435233333533
3332224322312121143223222321153233243212323221253232222322134232325322122222433222432522741352245453
3232272333334323238143243352624542333323233233232333333343316223233232333422333343443522241333242333
5332353333233333243322433213343322922513225344222323323353553314323532525232333423423533243333323343
2225232162325213321232452163223322622852234223123322357612221712112212222423225232352225222142252224
7355542835533152535552545246435465424559426355554245444537564352494475555525343533335223233645595424
4333232321322239352222212321233213223313632423123322322222533333523321322173293235133232222313322233
4351723233232222244214222245222224233522329221532321362225213243723222245438322532352453344123343153
4624344323423733284333835211337545633224833243433334733351353333331532233333434235324332234643262325
2222212222212322222222222112222222221221222222312222222221222212322122222222122222322121123222322322
2353255443835832881725349167627152812116235222685372466935473827626242289828222241244286122848668236
5224412416444542662442323252627222622624574564426432524261266234142222453324314414442265453116422223
3233432224537342235363333243333432434147273443437266334523452496142368541231324332241133325523337234
2523116223222541114323232222225522122122132221242222452122242223242211222112222442322222222122438222
4223223334433324322323332223423123133333234233333423323333435233333133333133324323344323423423333323
4235233315242243232244522442332252142212221253244233145134232232324223344222354254225221122242243444
4232424436434224142124223122443444353212231424412233342422354424422232111122132343222324442243344312
5512245422532523334632422243333223142232252124243214342133422238262551434223425237223234222232125322
2221221332223122432223232121323322322432322322233222321322122231131222322331232222223212222221222121
4433141433634422553254221344233453335363332443834452227434214744441223825354233535423484323324153322
2512213222222212523852322132222611222222221331322262232551322232321252322221232322733232223121122242
4443335622433343334454253443355544334454345335343533433231313453543335342454323434334443433333624451
6612527333222432222262232442162431357224322224222232232342223342613331431233324522194124243251421321
2222322332323424222112211122262363221212213222131325223223131322423222312232232334322222452242222323
3333433635424416434423365365434223452485434694334336743333935563633334633734462436336433333434465344
1223232212362313843232245225223222222362421163253133132222244444343421146243724122426222322238322232
2244533334324344225243432221324254325343652352323443443323413322532145422325323433323533214425222644
2454232224342421227232322121343435274262122564232326252327195222222134323431431223223242231547324224
5424447523263523435334234253352325332243743375238435522411232493354233323333292133444332722353643293
6576556666636466665565666646465665555456565566566663464445566643655655668355664963666665556635564566
5252522432223584671362222222412235342231224343623426132324138331443231317222221517322443226224127322
3423241323224232213353323233214435491734333424447131242353422422342432231334354353444332435432441124
3232255522233535254366133553233343352523332511213333332323333234644322733122223233344132331531423431
2323225222227122221222152232324412222232224324231253225232242342223221222522241222223132432222222223
2122322222222231134132222222422221217222322212221122226122412221222212122233222242352123232232232322
2512152812553245223216244212221282246223522322222222222111343653314222226322322222142132221524122322
2241322222112262113352231712252212324212332242222152325412152222212422413332122224322241312222132222
4452444315554264544942356336324436755445255543465424334584254224236444345464435662455145474242545742
5123122222524141512222122211212222524422211112112122222121223242552742542125522112725124231352243322
2222322221222221422322231121322242222213332322242321322321422322223222222123223432222232222334131124
2225232221222212222221222221522122222222222222222211222222112212212222222423113221222122222231222222
3344363565255482456652535625496427326425293222234471736261256246655446222263956662661334915322216522
5532454665522564246431163544523355551654559447424434375424458156326555332954315457554533586344535655
8244633722282267221272762223722438571243242714237532225186275335721262222522612428251222622279227249
2553215343322541245543322324312442645533342243455372243421244424355353441561479145524542227175273463
5525353754854561228366357544546246334643334453525664431553354424544439355625535523322437584313533953
2422421222222412232423222221222232133121212222314142223221212432431232222321212222422322222222222122
7633392234328353325343362266335225443444324727333555375233323243575565333333886632233346317374158223
1233223123231738421212125223342522122542222221422212323352522321436243425222432233222235232344622222
2222132222112524222224223212232121222722212294241314432222312421222229211624421322152226162234321522
2423322144211324522222243212225533255425245252421524332332542221242344322213432315422254123232444335
3536632342531653343525262674433646333265513453325653514332512343226644344553456341333363242541437234
5374432145241346392463464234244545452426141621544423342442321431236546543457433656343434233424412434
4323235133233283436324223134331343153223333413343435233221343235534355424533343334525332412335543333
5845764587864775375845474847487743585754664888547269643498628745473584886456257864545565484748568725
3652353332235222312654422632323222352336234432232537434232233323339225325363122653543323432221132825
2433321232213223222213222132231122232233332222323133226188326232432651312125322223273213733212323222
4332354432273422343422332331243136333334242443247333331324221343424342232332472313133342332331433334
4712233223121222222211422222212436264233632922222332122221222222312322312222112224222224222232225223
2422523118257435244337422263333716274522523277656423247471548225334645772774553154573283233242772557
3332532323224221123133335525254233222235242232225252353424623322142535433334333432333242322224332333
3447243262944422232454545414488343243434245344426246353571374432434473978339337868534343584177422464
3234323323423223321223222323335123232221232325323222423233341522332335123222221222232421224822212223
2323211221122224392291225221222221228222223342211224324312372173222221822422392142152922242222122222
2213536132444425442222292355733553423522347434234383211173326311211252247422532233444244223341375527
4457886845756396846348646235735747454255497866785755358833885595386575564626553634535576955938862335
2221147322211252323331222232232325312242217232223224222222223223112113325424531332222221221233131212
2163222222321221424393322212722222222223231423222625422272522221123422224472251222122172422445122214
2526244252526232414415326223623243232223114432443314631242224422632366232332662526324244342333242227
2345128551252446542262243132112244223231222135233652341285363221222221222322643112122212332222332426
4145555434693544345536552352243324523364835235234563463554533445235344854235451234435535526535343354
8424455544426762341976646666562557354325522686125448495936788566656743753673422949296297876573734649
4241342412232457244242225423222646422224634233522534332451232343544155417334224452523522454343125433
3434544369346412363644484244226423132233334553335646551223137332634354563343324631361344446633643323
1122231212322212222216212523843272323232222322322232232233222321322222213223223223512222322122322222
4628535352425544375333486865546264569351434734354345423368564543343433637542732356223836763322163543
5585373522243344433355332633257224634292532642544434253331123483213443433344214343524243422245253232
3333243434425433343334293326323433233373433333853533533333332332422335633352738245332324223326943533
3425352433617436228226343257342373383323233639332734496744773334333664333333243734533143383327297543
2342426184342412532432212254242222443444321225124144222534448242244222231342443253421147416522332234
2323249346576131328263285753133226232571343552535234623311331453359252484632575226842364522637534623
2614653226633266345421416142422226222466462625524225227222613262242435455236232712622123424361326415
2232222632233233323123122222383132521323281334132232333233222122352221333342332132423323313123121322
3263323232853464253259533322983457525662265556314236553333323465237751725664426872123722165232624222
2232222323221222211112222122212221222121151124253221122222222232112221223222112222322222124122122122
3262523232323323323251272221125327222222522322343322323343333232333312234321332233222232322254222433
1552411255513152253431234224134151352324143534424141252224444335314432332541121343552354541113426789
5444435355345455643442354444532413455232252433445633535373652353154522544465944353642544444535453264
3321623215212542214212421123222426522222433132242242252262222722328142222222123226422221223222155389
2322525221222222321122422212433223121122222422222222122114342211252253332212222232124414322214222622
4353243344453921334383253573432653246453435253562633492643575594533343524333858337333893256353433559
2433442814522234731361323322433733323332344332244542414423249974722243324342332343233143763322655422
2123222321112224222223213243222221222226212222223221212221223222222221311222222222212121222331212222
2134122323222342625222256282325212522425222222112218224352635421774152272212622283436321328126422262
4422432328453342423324344435234343423344244446354444742444434424444323425241244434431345245413134454
5464375344433556546534755434445462844464334445343345464413465422341434495634538447455434554327654442
2222342222244112322342432425182232132223222222324342422242122166232421424222426241242243423524212542
2222221221222222322323242221122211122222222223232221222233212212232222221212221322222222221222212222
2232353331322232222332323213322223332121342343323221523232232122323832323322213324312333333272433253
7633549449955888463345642227755388884445435544523449555964342644837535858545483475568965248346854743
3562321221212322324141261213323222221222235262232242222322322231223523233212323224618332124231313223
5642644754554565874545355635963536635563651844676545262648635551263475593637325844458266446754366665
2183121222232223182321222232212222222321321322222323122233222232322513322622332143213136122223529222
1836352222322224222331552121121233343533834223532423235327257341244232323449453443434332733231224612
7373333346334121233443345222163353333934437433234642334414342235123134466333325439244443344432633734
3342443514563442355484324122444341345392224344633474321244455322442443424544684443263434143434334423
3233335236243344373353153424245344446623346533333334336343332412352323425333572335343651325253653253

4
inputs/day03example.txt Normal file
View File

@@ -0,0 +1,4 @@
987654321111111
811111111111119
234234234234278
818181911112111

140
inputs/day04.txt Normal file
View File

@@ -0,0 +1,140 @@
@@.@@.@@.@.@@..@@@@@@@.@@.@@@.@.@@@.@@...@..@@..@@@@.@@@...@@@@@@.@..@...@@.@@@@@@@@@@@@.@@@.@@@.@.@@@@.@.@@..@@@.@..@.@@..@@.....@@.@@@.@@@
@@@@@@@.@@.@@.@@@@@..@@@@.@@.@@@@@.@.@..@.@@..@@.@@@@.@.@@@.@@@@@.@@@@@@@.@@@@...@@.@.@@@..@.@@@@@@@@@@@@.@@.@.@..@.@@@@@..@@@@.@.@@@.@..@@@
@@.@@@@.@.@.@@@.@@@@@@..@@@....@...@@@..@..@@@@@.....@@..@.@@.@@@@@@@@@.@@@.@@@@@...@@@@@@@@@.@@@@@..@.@.@@..@@..@@.@@.@.@@@@@@@..@@@@@@..@@
.@@..@..@@@@.@@@@@..@@...@@@@.@@.@@@@@..@@@@@@@@@@..@@.@@@@.@@.@@@.@@...@@..@@@@...@@@@@@@@@@.@....@@.@@@@@.@@.@..@..@.@@.@.@.@@...@@@@...@.
@@@.@.@@@@..@..@@@@@@...@@@@@.@.@.@@...@@@@..@@@@@@@@@.@.@@@@@.@@@.@@@.@.@.@@@.@@@@...@@@@.@@.@@.@@.@@..@@.@@@..@@.@.@@@..@@@@@@@@@.@@.@@..@
.@@@@.@.@@@..@@@..@@@@...@@.@@@@.@@.@@@@@@..@..@@@@@.@@@@..@@@@@@@@.@...@..@.@.@@..@.@.@@.@@.@.@@@@@@@@...@@@.@@@@@@.@@.@..@@@..@...@.@@@@@@
@@@@@.@@..@@@@@@@@@@@@@@@@@.@@..@@@..@@.@@.@...@@@@..@@@@.@..@.@.@..@.@.@@...@.@@@@@..@.@.@.@...@@..@@@@@...@@.@@@@@@.@@.@@......@@@@.@..@.@
.@..@@@@.@..@@@.@@.@@.@.....@.@@@@@.@@@@@@@..@@@@.@..@.@.@@.@...@@@@.@@.@@.@@@@@..@.@@@@.@..@..@@@@.@.@@@@.@@..@.@.@@@@.@@.@@..@.@@@@@@@@@@@
@@....@.....@@..@@@@@@@@..@@@@@@.@..@..@@.@@.@@@@@@.@@@@@@@.@@...@.@@@.@@.@@.@@@@@@@..@@@...@@@@@@@..@@@@@@@@@@.@@...@@@@.@@@...@@.@.@@@@.@@
@@@@@@@@.@.@@@..@@..@@...@@@@@@.@.@.@@@.@@@@@..@@@@.@@@.@..@@.@@.@.@@@@..@@@@.@@.@...@@.@@@@..@@.@@.@..@@@@..@.@@.@.@@@...@.@@@.@@@..@@@.@@@
@@@@@@@.@@@@@@@@@@@@.@@@..@.@@..@@@.@@.@.@@@.@.@@@@@.@@@@@@.@@@@@@@@@@....@.@@@@@.@@@@@.@@@...@@@..@@@...@@@@@..@@@.@@@@@@@@@@..@@..@.@..@..
.@@..@@.@@@@@@@.@.@..@..@.@@..@..@@.@@@@@@.@@@@@.@@..@@@@...@@.@..@@@@.@..@@@.@.@@@@...@@@@@.@..@@.@.@@@..@.@.@.@@@..@.@@@.@.@..@@@@@@.@@@@@
@@@@@@@.@.@@@@@.@@@@@@@@@@.@@..@@@.@@.@@@@@@@@.@...@.@@@@.@@@@..@.@@.@@..@...@@@.@..@@@.@@@..@@@.@@.@@..@@@@@@.@@@.@@@.@.@@...@.@....@@.@.@.
@@@@@@..@.@@@..@@..@@@@.@@@@@@@...@@@.@@@..@@@.@.@.@@.@@@@@.@@@.@@@.@@@@@@@...@@...@.@.@..@.@.@@@@@@@@@.@@@.@.@@@.@@..@@@@.@...@.@@@@@@@@@@@
@@@..@.@@.@@@.@@.@@.@.@@@@@@.@@@@...@@@@@@..@.@.@@@@.@@@@.@@@@.@@@..@@@@@.@@....@.@@..@@.@@@@@..@@..@@@.@@@@@.@@.@.@@..@@....@.@@@..@@@@@@..
..@..@.@@@@....@.@..@...@.@.@@@@@@@@..@@@@@@@..@@@@@.@..@@@@@@@......@..@@.@@@.@@..@@.@@@.@@.@.@.@@.@@@.@@.@@..@..@@.@@@@.@.@.@.@.@@@@@@.@@@
@@@@@.@@@....@@@@@.@@@..@@@@@.@@.@.@@@@@@.@@@@@.@@.@...@.@@@.@@@..@.@.@@@..@..@@.@@@@@@@@@@..@@@@@@@@@@@@@@...@@@.@@@.@.@@@@.@@.@@....@@@@.@
@.@@..@@@.@@@@@..@@@@@@@@@@.@@.@.@@.@@...@@.@@@@@..@@@@@@.@..@.@@.@@.@...@..@@.@@.@.@@..@@..@@.@@@.....@@@..@@...@@@...@@.@.@.@.@@@@@@@@@.@@
@.@...@..@@.@@.@@@@.@.@.@@.@@.@@....@.@@@...@@.@@@@@@@..@@@@.@@@@@.@.@@...@@@.@@@@@.@@@.....@.@@@@..@.@@@@@@@@..@..@.@.@@.@..@@@@.@.@@@.@..@
@.@@@@@@@@.@.....@@@@@@.@...@@@.@@@...@.@@..@@@@@@@@@@.@.@@.@@@@@.@.@@..@@.@.@@@@.@@.@@@.@@@@@.@.@@.@@@..@@@@.@.@..@@@.@..@@..@.@@.@@@@@@@@@
@@@..@@@@@@@@@.@.@.@@.@@@@...@@@@@@@@.@@.@@...@@@.@...@@..@@.@@@..@@..@@@.@@@@@@@@@@@@.@@.@.@@@@@@@.@..@@.@@..@@@@@...@...@@@@@@@@.@..@.@@.@
@@@@@..@@..@...@@@@@@@@.@...@@@@.@.@@.@@@.@@@.@@@.@@..@@@@@@.@.@@@@@@@@@@@@@.@.@@.@@@..@@@.@@@@@@.@@.@..@@..@@.@@@..@@@@@@.@@@@.@...@@@.@@@.
@@.@..@.@@@@@.@@@@.@...@@.@@@@.@.@@@@@...@@.@@@.@.@.@.@@.@@@@@..@@@@@@@..@@@@.@@.@@@@@.@@@@@.@@@...@@@@.@@@@@@.@@@..@...@.@@@@@.@.@@.@@.@@..
.@.@@@@.@@@@..@@@@@.@@@@@@@.@@@@@..@@...@.@.@@@@@.@.@@@@@.@@@@@@@@@.@@@@.@@@@@@..@@@@...@@@@@...@@...@@@@@@.@@@.@.@..@@@@@.@@@@..@@@..@@.@@@
@@@@@.@.@@@@.@@@@@@@.....@..@@.@@.@@@@@..@.@.@.@.@@.@@@@@@@@@.@.@@@@@@@@@@@....@.@@@@@.@@@.@@@@@.@@@@.@.@@@@.@@@@@@.@.@.@@..@..@.@@..@@@.@@@
@@@@@@@@@@@@..@@@@@@@@....@@.@@@.@@.@.@.@@@@...@...@@.@.@@.@@@.@@@@.@@@@....@...@..@...@.@.@@@@.@...@@@.@..@@@@@@@@...@@@@@.@.@@..@@..@@@..@
@...@@@@@.@.@.@@@@@@.@@.@..@@@@....@@@...@..@@@..@@@@.@@@..@@@@@@...@@@@@.@.@@@@.@.@@@@@.@@.@@@.@@..@@@@@@..@@@.@@.@.@..@@....@.@..@@.@..@.@
@@@@@@..@@.@.@.@...@..@@..@.@@@@..@@@@.@..@.@@@@....@@.@@@.....@.........@@@@.@.@@@@@@@.@@..@...@.@.@@@@.......@.@.@@...@.@@@@.@.@@@@.@.@@.@
@@@@@@.@@.@.@@..@.@.@@....@.@@.@@@@..@.@@@.@@@.@...@.@@.@.@@.@@@...@.@@.@.@@@.@...@@@.....@.@.@.@@.@@...@.@@@@@.@@@@.@.@.@@.@..@@@.@.@..@@@@
.@@.@@@@@....@.@@@....@@@..@.@..@..@@@@@@@@...@@@.@.@.@.@@@.@@.@....@@@@.@@@@@@@.@..@..@@@..@@@@@.@@@@@@..@....@..@.@@....@@@@.@.@@.@@@...@.
@@@@.@@@.@@@@@@..@.@@.@..@@..@@@.@@@@@@.@@..@@...@@@.@@@.@.@@..@@.@@@.@@@@@@@@@@@@@@..@.@@.@@.@@@@..@....@@@@@.@.@.@@@@.@.@@@@@@...@..@..@.@
@.@@.@@.@@@@@@...@@.@@.@@...@@.@@.@@@@@@@@..@.@@@..@@.@@..@@.@.@...@.@@.@@@.@@@@@.@@@@@.@@@@..@@.@@..@.@.@@.@@@@@....@.@.@@.@@@.@@@@@@@.@@.@
@@.@@@@@@.@.@@@@.@..@.@..@..@@.@@@...@@.@@@.@.@.@@..@@.@@.@@@.@.@@@@@...@@@@@.@.@@@@.@.@@.@@@..@..@@@..@@@..@@@..@@@@@.@.@.@@@@..@@@@@@@@@..
@@@@@@.@.@@@@@.@.@..@@@.@@@@.@...@.@@.@..@@@@@@@@.@@.@...@@.@@@@@.@@@@@@@@@.@.@..@.@@@@@.@@@@.@@..@.@.@...@@@@@@@@@@@.@.@@@@@@@.@@@@@@.@@@.@
@@@@.@@@@@@@.@@.@.@@.@@...@....@@@@@.@.@.@@@@@..@@.@.@@.@@@...@@@@.@@@@@@@...@@...@@@.@@@@@@@.@.@..@..@@@@@@@@...@.@@@.@@@@@@@@@..@.@@.@.@@@
.@@.@@@..@@.@@@@@.@@@..@@@.@@..@@@.@@@.@@.@@@.@@.@.....@@@.@@@.@....@@.@@.@...@@..@....@.@@.@.@.@@.@..@@..@@...@@.@@.@.@@..@@@@.@@@.@@.@@...
@@.@@.@@@@@@..@@@@@@.@@@@@@..@@.@..@@@@@..@@.@@..@.@@@@@@..@@@.@@@@@@.@@@@@@..@@....@@.@@@@@@.@.@@@.@@@@@.@@@.@..@.@@@.@.@@.@@.@.@@@@@@@.@@@
@@.@.@.@@@@@..@@..@@@...@@@@@@@.@@......@.@...@@@@.@@@@@@@@@@..@@@.@.@@@..@.@..@@.@@@..@...@.@@@@@@@.@@@..@..@@.@.@@@.@@.@@@@@@@@...@..@...@
@@@.@.@@@@..@@..@@@@.@.@@@@.@@.@.@...@@@@@@@@.@@@@@@@.@@..@..@@@@@@@@@..@@@@..@@@.@@.@...@@@@@@@.@@.@@@@@.@@@@@@@@@@.@@@.@...@@@@..@...@@@@@
.@@...@@@.@@.@..@@.@@.@.@@...@@@.@@@.@@..@@.@@..@...@.@@..@@@@.@.@@.@@@@@..@@@@..@..@.@@@.@@@@.@...@@.@@@@...@@@@@@@..@.@@@.@..@@@.@.@@@@@@.
.@@.@@.@@@@@@@@@@@.@@.@.@.@@@@.@@@@@@@@@@@...@@@@@@..@..@@...@@....@@@@@...@..@.@..@@@@@.@@@....@@@.@@..@.@@..@@@@@.@@@@@@@.@@.@@.@@.@..@@@@
@@@@@.@@@@@@@@.@..@@.@.@.@.@.@@@.@@@@.@@@@@@.@@..@.@..@.@.@.@.@@@@.@@..@@.@@.@@@..@@.@@.@@@@@@@.@.@.@@@..@.@@@@@@.@.@....@.@.@@@..@@@@@@@...
@@@...@@..@@.@@....@.@..@.@@@.@@@@..@@...@@@@@.@@.@...@@.@.@@@.@@@@.@@@.@.@..@@@@@@.@.@@.@@@.@@.@@@@.@@@@.@@@@@.@@.....@@.@...@@@@.@..@.@@@.
.@@.@@.@..@@@@@@@.@.@@.@.@...@.@.@@@@@.@@..@@@.@.@@@@@@...@.@..@...@.@@.@.@@@@.@@@..@@@@@@...@.@@@@@@@@.@.@..@..@.@@@@@@@@@@@@@@.@....@@@@@@
@@..@@@@.@@....@@.@@@.@@@@@@.@..@@@.@......@@@.@@@@.@@.@@@@.@@@@.@..@@..@@@.@.@.@@@@..@@..@@@@@@.@@@.....@....@@.@@.@.@@@@@@.@.@@@@...@@.@@.
@@@.@@@@@@.@@...@@..@@..@@@@@@@@@..@..@@@@@.@@.@@@...@@@.@@.@@@@.@@.@@@@@@@@@..@..@..@@.@@@@@.@.@..@@@.@..@@@@@@@.@@@@..@@@@@@@.@@..@@..@..@
......@@@.@@@@.@@...@.@@@@@@.@@.@..@.@.@.@.@..@@.@@.@@...@@@@@@..@@@@..@.@.@@@@@@@.@.@@@@..@@@@@@@@@.@@.@@@@@.@@..@@@@@@..@@.@..@@@.@@@@@.@.
@.@@@@@@@.@@@@@..@@@.@.@@@@..@@@@.@@...@.@.@@@@.@.@@@@@@@@@..@@..@..@@@.@@..@@@.@@@.@@@@.@@..@@@@.@@@@@@.@...@@.@@@.@.@@@.@..@.@@@...@.@.@@@
@..@@@..@..@@@@@@@@..@@@@@@@@@@..@@@@@@@@@@@@.@.@@@..@.@@@...@.@@.@@@@@.@@...@@@@@@.@.@.@@@@@@@@..@...@@.@@@..@@.@@@@@.@......@@@@@@..@@@..@
..@.@.@..@..@..@.@.@@@@@...@.@@@@@@@@@@..@..@...@@@@@@@...@@@@@@@@@@..@@@@..@.@..@@@@@@@.@@@.@.@@.@@.@@@@@.@.....@.@...@@......@@.@.@@@@.@.@
@@@@.@@@.@.@@.@@@@@...@@..@@@@.@.@@@..@@@.@.@@@.@@@@.@@@@@@.@@@@...@@@@..@.@..@.@@@@.@.@...@@@@.@@@@@@@..@..@@...@.@@@@@.@@@@.@@@@.@@@@.@@..
@.@@@@@@@@....@.@@@.@..@.@.@@@@@..@@@.@@...@.@.@@@.@@@@@.@@@......@@@.@@@.@.@@.@@@@@@.@@..@.@.@.@@..@@@.@@.@.@..@@...@..@@.@@.@@.@@.@.@.@@@@
......@@@@@..@@@@@@@@@@@...@..@@.@@@@@@.@@@@@..@@@@@@.@.@...@@@@@.@@@.@..@@@@@@.@@@@.@@@...@@.@@@@@....@@..@.@@@@.@@@@@@..@@..@@@@@.@.@..@@.
@@..@@@..@@.@@@@..@@@@.@@@@..@.@.@@@.....@.@@.@@@..@.@@...@..@...@.@@@.@.....@@.@@.@@.@@@@@@@@@@..@......@@@@.@@@.@.@.@@@@.@.@@@@@@...@..@@@
@@@.@.@@@@@.@.@@@..@.@@@.@@@@.@.@@@@@@@.@@@@@@@@@@.@@@@.@..@.@@@@@@@.@..@@..@@@@..@.@.@@@.@...@.@@.@@@@@.@@@@@.@@.@.@@@....@@@@@@@@@..@@.@.@
.@@@@.@@.@.@@..@@..@@@@.@@@.@.@@@.@@@.@@.@@.@....@.@.@@..@.@.@..@@@@.@....@@@@@..@@@.@.@@@@@@@..@.@..@@..@@..@@..@@..@@@..@.@@@.@@@.@.@@@@@.
@..@.@@@.@@...@@@@.@@.@..@@@@@...@@@@.@...@.@@@@.....@.@..@@.....@.@.@@.@@..@@.@@.@@@@@@..@@.@.@@@....@@..@.@@....@@@@@@@...@.@..@@.@..@@@.@
.@.@@.@.@@@@.@.@..@..@@@.@..@.@.@@.@.@@@.@@@.@@.@@@@@@@.@@@.@.@@.@.@..@..@@@@@..@@.@@@.@@@@@@.@@@@@.@..@@@..@@@@@.@@@@@@@@@@@@@@@@@@@.@.@@..
@.@@@@@@@@@@@@.@@@@@@...@@@@@@@.@@@.@.@@@@.@@.@.@@@@.@@.@.@...@@@..@.@@@@.@.@@.@@..@@@@@@@@..@@@@@..@@@@@@@@@@...@@..@@.@.@.@@@@@.@@@@.@@.@.
@@..@.@@.@@@.@...@@.@@.@..@@@.@@...@@..@@@@@.@..@.@.@@@@@@@..@@.@@.@@@..@@@@..@@@@@..@.@@.@@@..@@@..@.@@@.@.@@.@@@@@........@@..@@@.@@@@@@@@
@..@....@.....@.@.@@@.@.@...@@...@..@@@..@@@@.@.@@@.@@@..@@@@@@...@@.@@..@@.@.@@.@@@.@@@@@@@@@.@@..@.@.....@@.....@@@@.@@@@@.....@..@@..@@@@
@@@@.@@@@@@.@@@@@@@@@@.@@@@@@@..@@@@@@.@@.@@.@@.@@@@@@@@@@@@@@.@...@@.@.@@@@@@.@@...@@@@@@.@@@@.@.@@@@@.@@@@.@@@@@@@@@@@@@.@@@.@@.@@@@@@.@@@
@@@@@@@.@.@.@@.@@@@.@..@@.@..@@@@.@@.@@@@..@@@..@@.@.@@..@..@@@@@...@@.....@@@@@@@@@@@@@.@.@@@@..@@@.@@@..@.@...@@@@@@.@@@.@....@...@.@..@@@
@@@@@@.@.@@@@@@@.@@@.@@.@@.@.@...@.@@..@@@@@.@@..@..@@.@@@..@.@...@@@@..@.@@.@.@...@@@@.@.@@..@@.@.@@@@@@@@@@@@@@@.@.@..@.@.@@@@@..@@@@.@.@@
@@..@@...@@.@@...@@.@@.@@@@.@@@@..@@.@@@@@@..@@.@@....@@.@..@@..@.@@@@.@@@@@.@@.@@.@.@.@@@@@@@..@@.@@.@@@@@.@@@@...@.@@..@@@@@@@@@...@@..@.@
@.@@@@@@.@..@.@@@@@..@@.@..@@.@.@.@...@@.@.@@@..@@.@@@@...@@.@@@@@..@.@..@.@@@@@@@@@@@@.@@.@...@@@.@@@@.@@@@@.@..@@@@@@..@@@@.@.@@@@.@@..@@@
@@@@..@..@...@@@.@@..@..@@@@@@.@@@@@.@.@.@...@@.@@@.@@..@@@@@@.@.@..@.@@.@@@@.@@@@.@@@....@@.@.@.@.@@.@@@@@@@.@@@.@.@@.@.@@.@@@.@@@.@@.@..@@
@@.@@@..@@.....@@@@.@@@@@@@@@.@.@@@@..@@.@@@@@...@@@.@@@.@..@@@..@@@..@@@@...@.@.@.@.@@@@.@@@.@.@@@@..@.@@.@@...@.@.@@..@@@@@@.@.@..@@.@.@..
.@.@@@@@@.@@@@.@@@.@@..@@@@@@.@@@@@@...@@@@@@.@.@@@@...@.@@@@@.@@@.@@@@.@.@@.@@.@@.@@@@@@@..@@@..@@@..@@@..@@@@@.@.@@@@@@..@@@.@@@@.@..@.@@.
@...@@@@@.@.@@@..@@..@@@@@..@@@@@@@@.@@@.@.@@@@..@.@@@@@.@..@@@..@@@@@.@@..@@@..@@@@@@@@.@..@@.....@@.@@.@@@...@....@@....@....@..@@@@@@@@.@
@.@@@@@@@.@@@....@@..@@..@@..@@.@.@.@@@@@@.@...@.@@@...@@@..@@.@@@@@@.@@@@@@@.@@@@..@@..@@@@@..@..@@.@@@......@@@.@@@@.@@.@..@.@@..@.@@@@@@.
@@@..@@@@@@.@@...@.@@.@..@.@..@@@@@@@.@@@@@@@@@@@@@@.@@@@@.@@@.@...@.@..@.@.@@@@..@@@@.@@..@..@@@.@@@@@....@@@....@@.@@@@.@@@..@@@.@.@@@@@@@
@...@...@@@@@@.@@@@@@.@@@@@...@.@@@@@@@@@@..@@.@@@.@.@@@@.@.@.@.@...@@@.@@.@@..@@.@@@.@..@@@@.@@@@@...@.@@@.@@..@.@@@@.@@@@@..@@@@@@.@@.@@@.
@.@@.@@.@@..@.@@@.@..@@@@@@.@.@@@@@@@..@@@@@..@.@@@...@.@@.@@@.@.@.@@.@@@@@@@.@@.@.@@.@...@@.@@@@@@..@.@@@@@@@@.@@.@@@.@@@@@@@..@.@@@.@@...@
@@@@@.@..@@.@@.@.@.....@@@.@..@.@.@@@@@@.@@@@@...@@@@@...@.@@..@@@@@@@@.@@....@@@@@@@@@..@....@@@.@@..@.@@@@@.@.@@@@.@@@@@@.@@@@@.@.@@.@@.@@
@@@..@@@@@@@@@@....@@.@@.@@@.@...@.@@@@.@@@..@.@.@@@.@.@@@.@@@@@@.@@@.@....@@@@..@@@@@@@@@@@.@@@@.@.@@@@@...@@@.@@@@@@.@@@@@.@@@@@.@@@.@.@@@
..@.@@@.@@@@@@@.@...@@@@@.@@@@@....@@.@@@@@.@..@@@@.@@@@.@@@@@@@@..@@@@...@@.@@@@.@.@..@..@.@@@.@@@@@@.@.@...@@@@.@....@@@@@@@..@..@.@@@...@
@@..@@@.@@@@@@@.@@@@@@.@@.@.@.@.@@@@@@@...@@.@...@@@.@@.@@@.@.@@@@@..@.@.@@..@@..@.@@@@@.....@@.@@.@.@@@@@@@@@@@..@@.@.@@@@@@@@.@@@...@@@@@.
@.@@@@@.@..@@..@@@@.@@@@.@@@.@@.@@@@..@@.@@..@@@@@@.@@@@@@@@.@.@.@@..@.@.@..@@@@@@@@.@@.@@@.@@.@....@..@@@@.@.@@.@....@@.@@@.@@@@@@@@.@.@@@@
..@@....@.@@.@@..@..@.@.@.@...@..@@.@.@@@...@....@@.@@.......@..@@@@@@@@.@@..@...@...@@@@@@.@...@@@.@.@@..@.@@@.@@@@.@@@@@.@@@@.@@.@.@@@...@
.@.@@...@@@@..@@@@@..@@@...@@@@@@.@...@@@...@@@..@@..@.@@@@@.@.@.@@@@@...@@@.@@@.@@.@@@.@@.@@@@@@@@.@@@@.@@@@@@.@@.@.@.@@@@@@.@@@@@@@@@@@@@@
@@@.@@.@@@..@@.@@@...@@@@@..@.@.@@@@@..@@@@@@@@@..@@..@.@@@.@.@@.@....@@@@@@.@@@.@.@@@.@@@..@@@..@@.@..@@@.@@@.@@@@@@@@.@@@@@.@@.@..@.@@.@@@
@@@@@.@.@@@..@@@.@.@.@@@@@@@@@@@@@@.@.@.@..@@.@.....@...@.@..@@@@@@@@@.@.@.@@@@.@@@.@@@..@@.@...@..@@@@.@@.@@@@..@@.@.@@.@.@@@.@.@@@@@@@@@@.
.@@@@@@..@@@@@.@@.@@@@.@@.@..@.@.@..@......@.@@@@@@@.@@.@@@@...@@@@@@@@@@@.@@@@.@@.@.@@@.@@@@@.@..@.@@@@.@@.@@@@..@@@@@@@.@@.@.@.@.@@@@@....
.@.@@@@.@@@@@@@@.@@@@@@.@.@@@@.@..@@@@@@@@@.@@@..@..@@....@..@@..@@@@.@@.@@@@.@@@@@@@@@@.@.@@.@@.@.@@.@@@.@@.@@.@.@.@@@.@@@..@@@@.@.@@..@@@.
..@@..@@@.@@..@@@.@.@.@.@@@@..@@@@@@.@@..@..@@@@..@@.@@.......@.@@@.@..@...@....@@@@@@@.@@..@.@....@.@@.@@.@....@@...@@.@.@@.@@@@@..@@@@.@.@
.@.@@.@.@@@@..@@.@..@..@@@.@@@.@.......@@@@..@.@@@.@@@...@@@@@@@@...@@.@@@@@@..@.@...@..@.@@@@@@@@@@@@.@@@.@@@@@.@@..@@..@@.@@@.@@@@..@@..@.
@.@.@@@@@.@.@@..@@@@@@..@@.@.@@.@..@..@@.@@.@@@..@.@@...@@@.@@@....@@..@@@@@..@@@..@@@..@@@@@@...@@@@@@@..@@@@@..@@@..@.@@.@..@.@.@@..@@..@.
@@@@..@..@.@@.....@@.@.@@@.@@@.@@@@@@@@@@@@..@.@.@@.@@...@.@@@.@.@.@.@@.@@..@.@.@@..@.@..@.@@@@.@..@.@@@@@.@..@@@.@.@.@@@@@...@.@@@...@.@@.@
.@.@...@@.@.@@@@..@@@@@@@.@.@@.@....@.@@..@...@@@@@@@@..@.@@.@.@@@@.@@.@.@.@@@@@@@@@..@@@@@@@@...@.@..@@@@@@@@@@.@@@@@@@@.@@@@@.@@.@...@@@@@
@@@@@@.@@..@.@..@@@@.@@@@@.@@@@@@@@@@.@@@..@@@.@@@@.@@@@.@@@@@@@..@@@..@.@..@@@@@@@@.@.@@@@@...@@.@@@.@@@@@@@.@..@@@.@.@@@@@...@..@@@..@..@@
.@.@@@@@@@@.....@.@@@.@@.@@@@@..@@.@.@.@.@.@.@..@@.@@..@.@@.@.@..@@@@@@@.@.@.@.@@@.@@.@@@@..@.@@.@@@@@.@.@@@.@.@.@@.@@@@@@@.@@@@.@.@@@@.@@.@
@@@@@.@@.@@@@@@@@@@@@@.@@@@@@@..@@.@@@@@@.@....@..@.@.@@@@@..@..@@.@@@@@@@@.@.@.@...@@@@.@.@@..@@@@@.@@@@@..@@@@@@.@@@@@..@@..@@@@.@.@@@@@.@
..@@.@@@@@@...@@@.@.@.@@..@@@@@@@@@@@@@..@@@...@@@.@@@.@.@@@.@@.@@..@....@@@.@@@@@.@.......@@.@.@@@@@.@@@@@.@@@@..@@@.@@.@@@@@.@@..@@@@@.@..
@..@@.@@..@@@.@@@@.@@.@@...@@@@@@@@@@..@@@.@..@..@.@.@.@@@.@@@.@@@.@@.@@@@.@@@@@@.@@@@@@@...@@.@.@@@@@@.@@.@@@.@..@....@@@.@..@.@@@@@@@.@.@@
.@@.@.@.@@@@@@@@.@@.@@@@@.@@@.@.@@...@.@@@..@@@......@@@...@@...@@@....@@@...@@@@.@....@.@@.@@.@@@@@@@@.@@.@@.@@@@@@@@.@.@@.@@....@...@.@@@@
@@.@..@.@.@@@@@@.@...@@.@@@@@@@@.@@@@@.@@@.@.@@@@..@@@@@@.@.@@@.....@..@....@@@@.@@@.@@@.@@@.@.@@@.@@@@....@.@.@@@.@@.@@..@...@..@@.@@..@@@@
@@@@@@..@..@.@@.@@@@.@.@@.@@@@...@@@.@@@@@@@@...@@@@...@@.@@.@.@@@@.@@@@@@.@@@@..@@..@@@@@@.@.@@..@@@@@@@@@..@.@@..@....@@@....@.@@..@@.@@@.
..@@@...@@.@..@.@@@@@@@@@@@@.@@.@@@..@..@@@@@.@.@@@@@.@@@@@@..@.@@.....@...@@@.@@@.@@@@@@.@..@@@.@@.....@@.....@@@..@@.@@.@@@.@@@@@@..@@@..@
...@@@@..@@.@@..@@@@@@.@.@@@@@.@.@.@@.@..@@.@@@..@@@@@@.@@.@@@.@..@@@@@@@.@@@@.@..@..@@@...@@@@.@@.@@@@@@@@@..@@@@@@@@...@@@@.@@@.@@..@@.@@@
@@..@..@.@..@@...@@.@@@@@@@@@@@.@.@@.@.@@@@..@@@@@.@..@@..@@@@.@@@@@.@...@@...@@@.@@@@.@@@@@@@.@..@.@@@@@.@@@.@@@@.@@..@@.@.@..@.@@@@..@@@@.
@@.@.@@@@@@@@@.@@@@.@.@..@.....@@..@.@.@@.@.@@@.@@@@@@@@@.@@@@@.@@.@.@@.@.@..@.@@@@.@.@@..@@...@@@@..@.@..@....@@@@@.@@@@@.@@.@@@.@..@.@@...
@.@@@@.@@@@.@@@@...@@@@@@@@.@@@@.@@.@@@@.@@.@@.@..@.@@@.@@@@.@@@..@...@..@..@@@@@@.@..@.@@@..@@@@@@@@@..@@...@..@@@@@@.@@@@@.@@@@@@..@.@..@.
..@.@@.@..@@@@@@@..@@.@...@.@..@@@@..@.@@.@.@@...@@@@@.@@@..@@@@@@@.@.@@@..@.@@@@@.@@@@.@@@@.@@@@.@.@.@@@@...@..@@.@@.@@@...@..@@..@.@@@@@@@
.@@@@@....@.@@..@.@.@.@@@.@@@@@@@@@@...@@@@@@@.@@@.@@@@.@@@..@@@.@@..@@@..@.@@.@@@.@@.@@@@@.@....@@@@@@@@@..@..@.@@@@@@@..@@@@@@@@@.@@@.@.@@
@.@@@@...@.@@..@@@....@@@..@....@@@.@@..@..@.@@.@@..@@@@@@@@.@@.@..@.@@@@@@@..@@@.@.@@@..@@@.@.@.@@@@@.@..@@.@@.@.@@@@.@@..@@@.@.@@@..@@..@.
.@.@..@.@@@@@.@@.@@@@@.@@@..@.@@.@@@.@@..@@@@..@@...@.@@@.@..@@.@@...@@.@..@@@.@@@.@@@..@..@..@@.@@@@.@.@@.@@.@.@@@@@@.@.@..@@@@@@..@@.@@@..
@@@..@@@@...@@..@..@@@@.@@@@...@@@@.@@@@@@....@@.@@.@@@@@@....@@@...@@@@.@.@.@.@@@@@@@.@.@@...@.@@@.@@.@.@@....@..@.@.@@@.@@@@@@@@@.@@@@@...
.@.@@@@.@@.@@@@@@.@@@@@.@@@@.@.@@@@@@@.@@@@@@.@.@..@.@....@@@@.@.@...@..@@.@..@.@@@@@.@@@@@@@@@@@@..@.@@.@@.@.@@@@..@@@@@.....@..@.@.@.@....
@@@...@..@.@@@..@..@...@@@.@.@@@@@@.@@.@@..@@@@@@.@@@@.@.@.@@@.@.@.@@..@.@@@@@@@@.@@.@..@..@@.@@.@@@@@...@@.@.@@@@@@..@@@..@.@@@@@@@@@@@@@@@
@@.@.@..@@@@.@..@@@.@..@.@@@@..@@..@@@@@@@@@@@@@@@@.@@@@@...@.@@..@@.@..@@.@..@..@@.@@@@@.@@..@@@......@@.@@@.@..@.@@.@@@@@..@.@@@@..@@.@@@@
@@@@@@...@@@.@@.@@.@@@.@@@@@.@@@@.....@@..@..@@.@@.@...@@@@..@@.@@@.@.@@.@@@@...@@@@@@.@@@@@.@.@@.@@..@@.@@.@.@@@@..@@@..@.@.@@.@@.@.@..@@.@
@@.@@@.@.@..@@@@@@@.@@.@@@@@@@.@@.@.@.@@@.@@@@...@@@....@@@..@@@@@.@@@..@@@@@@.@@..@@@@@@@@@@.@@...@@@@@@@@@.@.@@@@@@@@.@@@..@.@..@@..@...@@
@@@@..@@.@@@@@@@@@...@.@@..@@@.@..@@@@@@..@@@@@.@@@@.@@.@@.@...@@...@..@.@.@@@@@@@.@@@@@@@@....@@@@@@...@@@@@@.@@...@@@.@...@@@@...@.@.....@
@@@@@@@@@@@.@.@@@@@@.@.@@@@@@@.@@@..@@@@@@.@.@......@..@@@.@@.@@@@@@.....@..@@.@..@@@@@@@.@..@.@@@@@@@@@@@@@.@@.@@@.@.@.@@@..@.@....@@@@..@.
@@@@...@@@..@@@@@@@@@..@@@@@@@@.@..@@@...@.@..@@@..@.@..@@@@@.@@@.@@@@..@.@@@.@@@@.@@@.@@@.@@.@.@.@.@@.@.@@@@@..@@..@.@@@@.@.@.@@.@.@@@@.@..
@@@.@.@@..@@.@..@@@.@@@@@.@@@.@@@@@..@@.@.@@.@..@.@.@..@...@..@@@@@@.@@..@@@..@@.@.@.@...@@@@@@...@@.@..@@...@@..@@@.@@.@..@.@@.@..@@@@@..@.
.@@@@@..@@.@.@@@@.@@@........@@@@@.@@@@...@.@@@@.@@.@.@@@.@..@@..@@@@@@.@..@@.@@@.@@@.@.@@@.@@@@@.@@....@@.@@@@@.@@@.@@@.@..@..@....@...@@@.
...@@.@.@@@.@.@@@.@@.@.@@...@@@@@@@.@@@.@@.@@@.@@@@.@.@.@@@@@@@@@@@@@@@@@.@@@@@@@@@.@@@@.@.@@@@..@.@@@@....@@.@@@.@..@@.@@@.@..@..@@@@@@@.@@
.@@@@...@@@@@@@@.@@@@@.@@..@..@@@@@@@@@@@.@@...@@@..@@.@@.@@.@@@@@.@@@@.@@@.@@@@.@..@.@.@.@@@@.@@@.@@...@..@.@@@@.@@.@..@.@.@@@@@@@@@@@..@..
...@.@@@@@.@@.@@@@@@@@@@@@@.@@....@@@.@@.@@.@@@@@..@..@.@@@@@@@@@@....@@@@@.@@@@.@.@.@@.@..@@@@@@@@.@.@.@.@.@@@@......@@..@..@@.@.@@@@.@@@@.
@@@@@.@@@@@@@.@.@..@@@@.@@@....@@@@.@.@@@@@@..@@@@@.@@@@@.@@..@..@.@.@.@..@@@@@@....@..@@@.@.@@@@@@@.@....@...@.@...@@....@@..@@.@@.@@.@@@..
@.@@@@@@@@.@@@.@.@@@@@@..@.@.@@@.@@@.@.@.@@.@@@.@...@@...@.@@@@...@.@.@.@@..@@@@@.@.@@@@..@..@...@@@@@@@@@@.@..@@..@@..@.@.@.@..@@@@@@...@@@
@.@@@@@@@@@..@@.@..@....@@@@.@..@@@.@@@@@@@@....@.@.@@@.@@..@..@@...@@@@..@.@@..@@.@@..@@@.@@@.@.@.@.@@@.@.@@@@..@@@@@.@.@@@@.@@@@@@.@..@@@@
@@.@..@@.@@.@.@.@.@@@..@...@..@@@.@@@@..@.@@@..@@..@@.@@.@@.@@@@@..@@...@@@@@.@@@@@@@@@@@@.@@...@@...@@@@@.@.@@.@..@...@@@@.@@@.@@...@@@@.@@
.@@.@@..@@@@.@@@@@@@@@@@..@.@@@@@@@..@.@..@@@@@@@.@@...@@@@@..@@@@@.@@.@.@@...@.@.@@@.@@@@@@..@@.@@@@.@@.@.@@...@@@@....@.@.@@@.@@.@@@..@@@@
@.@.@@.@@.@...@@....@@@@@@..@...@@@@@@.@@@.@@@@.@@@..@..@@.@@@.@.@@@@@@@@@..@@..@.@..@@.@@@@.@.@@@..@@@@@@@@@..@@.@...@.@@@.@@..@...@@.@@..@
@@@@@@@@..@@@@@.@@@@@@..@.@.@....@@@@.@@@@@@@..@@@@@@@@@..@.@@@@@@.@.@@@@@@@.....@@@@@.@@@@@@@..@..@@@.@@@@@..@@@.@@@..@@@@@@@.@.@@@@@.@@@@@
.@@@@@@.@...@@@@@@@..@@@@.@@@.@@@@@..@.@..@@@@@@@@@@.@.@@...@@.....@@@@@..@@@.@@.@@@@@..@@.@...@@@@@@@@@.@@.@...@@...@.@@@@@@@.@.@@@@@@@@..@
@..@@.@@@@@.@@@.@@@@@@@..@@@@@@@...@@@@..@@.@.@.@@@...@@@.@..@@..@@.@.@.@@@@..@.@.@.@.@@.@@.@@.@@@@.@@@@.@@@@@@....@@@....@@@@@..@.@..@..@@@
@@@@@@.@.@@.@@@@@@@..@.@...@.@@.@.@@@@.@@@@@@.@..@@.@@@.@@@@@...@@@@...@@@@@@@...@@.@@.@...@...@.@@..@@@@@..@@@@@@.@@@.@...@@..@.@.@@@@...@@
@@@@@@.@@.@@.@@@.@.@...@@@.@.@@@@@@.@.@@@@.@@@.@.@...@@@@.@@.@.@.@@@@.@@@@..@@@..@@@@.@.@@..@.@@@@@@...@@.@...@.@@@@@@.@.@.@@.@@.@@@@@@@@@.@
@@@@@@@@@.@@.@@@@@..@@@@@@..@@@..@@@@@@@@.@..@..@..@@@.@@@@@@@..@@.@@.@@@@@.@@..@@..@.@.@@@@@@@.@@@.@.@@@@..@..@@@@.@@.@@..@@.@..@.@@.@..@.@
@@..@@@..@.@@@.@.@@@.@.@@@..@..@.@@.@.@.@.@@@.@@..@@@@@@.@@@@@@@@.@@@.@@.@@.@@@...@..@..@@@@@.@..@@@.@@..@@@@.@@@@..@@.@@@@@@@.@@@@@....@@@@
@..@..@..@.@@.@@@@@.@@@.@@.@.@@..@@@@.@@@.@@@@@@.@@@@.@.@@@@.@@.@@@.@@.@.@.@@@.@.@@.@@.@..@@..@...@@..@@@@.@@.@..@.@@.@.@@@@@@@..@.@@.@@.@@.
@..@.....@@..@.@.@@.@@@.@@..@@@.@@@.@@@@..@..@..@.@@@@@@.@@@....@@.@.@.@@@@...@@@@@..@@@@@@@.@@@@@..@@..@...@@@.@@@@@@@@@@@@...@@@.@@.@.@@@@
@.@@@@@.@@..@@@@@@.@@@...@@.@.@.@.@@@.....@@..@.@@@@@...@.@..@.@.@@...@@@@@@@@.@@@..@@.@@.@..@@.@@@@.@@@.@@.@..@..@.@@@@@@@@@@@@.@.@@@@@@.@.
...@@@.@...@@..@@@@...@.@@@@.@.@.@@@@@@@.@..@@@@.@.@.@...@@.@@.@.@.@.@@@@@@.@@.@.@@@@@...@@@@.@@....@.@@@@.@@@..@@.@.@@@@.@@@@@@.@@@@@..@..@
.@..@...@..@@@@@..@@@@.@.@..@..@@.@.@.@@@@@@@@@@.@@@@.@.@@@@@@@.@@@.@@@@..@@@@@@.@@@.@.@.@@@@.@.@@@.....@@.@@..@@@@@@...@@@@@@@.@.@@.@@.@..@
@@@@..@@@@@@@@@@@@.@@.@..@@.@.@.@@@.@@@@@.@@.@..@..@@@@@.@@@..@...@@@@@@@@@@.@.@.@@@.@@.@.@..@.@.@..@@.@.@@@@@..@.@@.@.@@@@@@@@@@.@@@@.@.@@@

10
inputs/day04example.txt Normal file
View File

@@ -0,0 +1,10 @@
..@@.@@@@.
@@@.@.@.@@
@@@@@.@.@@
@.@@@@..@.
@@.@@@@.@@
.@@@@@@@.@
.@.@.@.@@@
@.@@@.@@@@
.@@@@@@@@.
@.@.@@@.@.

1175
inputs/day05.txt Normal file

File diff suppressed because it is too large Load Diff

11
inputs/day05example.txt Normal file
View File

@@ -0,0 +1,11 @@
3-5
10-14
16-20
12-18
1
5
8
11
17
32

5
inputs/day06.txt Normal file
View File

@@ -0,0 +1,5 @@
4 82 68 85 74 6 56 14 2 8669 66 13 927 3 235 44 52 16 37 61 82 1774 96 15 775 789 91 374 6579 714 42 269 82 592 53 99 1 6 8 351 553 2122 9 85 8 4 9 98 562 7 8111 3 1958 133 44 458 84 5439 78 96 68 48 242 46 441 42 18 51 31 89 563 5541 964 4393 74 79 26 288 385 11 183 85 94 7439 444 85 587 56 73 9 43 285 242 32 15 247 77 52 75 6 71 75 85 96 143 51 36 1 58 7373 54 3572 5 64 763 76 34 79 43 651 2121 731 3 76 65 372 28 61 8 553 638 472 56 7 25 796 992 356 3 54 7 63 9 192 31 5 2 19 78 183 5868 2762 33 3 516 33 448 7737 99 72 426 96 21 4789 292 69 2 5 324 234 1 699 96 33 676 14 258 63 9342 856 8 994 23 48 4 66 4 6 35 522 74 37 62 831 87 282 139 99 1 55 5 917 5818 3 59 461 4773 78 58 2 98 4 981 468 658 973 6 898 9 165 45 69 85 7 2 69 44 218 21 77 6 989 7 66 7171 663 26 8 9797 85 2 239 92 54 14 7 9 6 116 8827 71 244 276 68 4 95 83 582 44 2 9 698 8236 768 45 197 41 341 62 68 7 56 433 8 88 94 5 74 28 14 28 8 934 22 43 4339 67 62 57 48 28 453 78 82 542 36 27 32 3826 137 532 88 498 4734 15 7 11 814 49 9 38 15 5 69 7 741 45 829 19 83 3 8 111 612 12 9 1 78 91 637 2 659 2 12 12 64 37 352 44 95 4 2916 2 842 3548 51 161 2 48 9 8 822 26 53 62 6 23 79 27 35 2 7 12 37 994 926 4 762 96 558 8586 81 2 81 34 41 51 5 7463 9366 13 95 6 71 2 845 26 414 975 2141 6 81 72 773 47 9589 374 42 81 98 3697 456 26 6855 65 1 54 9 764 97 819 726 7249 74 766 64 64 86 73 936 624 39 3 969 63 88 851 9447 7974 172 578 1 9 7 6431 6 448 487 1 6129 352 886 85 84 6 869 65 145 453 63 23 53 57 52 94 463 232 6 566 182 69 826 54 25 5 2 63 336 7338 597 99 11 955 811 51 9 77 4 246 9 43 31 84 196 61 32 512 4271 7134 1 553 5 35 68 52 65 3 31 179 4195 5 67 2 462 861 3 389 99 92 55 89 113 93 84 95 55 296 44 536 343 95 2 278 916 321 76 49 88 259 946 29 4 18 48 224 85 492 71 15 781 66 77 13 59 7727 24 66 363 57 1984 1 657 17 5 68 68 313 27 53 32 632 771 649 527 45 6 9868 7 98 62 92 34 799 5 76 5 8113 95 313 94 15 53 2593 363 376 221 46 2139 9 3 874 22 43 7 89 7736 9 74 9 84 213 932 6 16 6 3412 3 146 27 9 95 97 2 999 918 17 9461 44 4 158 85 25 144 8 877 921 885 85 187 858 994 29 4747 53 271 469 17 972 11 71 312 149 2 75 67 48 24 27 17 47 4731 9291 155 58 6 146 318 16 147 36 99 4 9172 979 13 7963 5 938 8376 95 6 256 488 17 5 874 8723 45 496 6 621 2 96 42 716 194 32 6 441 6176 86 2 75 4 58 56 574 916 65 2 44 17 954 93 9 91 1 266 81 5484 45 5 46 46 54 26 4 33 226 732 625 313 4 64 32 68 4 8 56 6 98 27 937 621 74 52 631 91 196 5 48 75 61 93 38 27 11 93 16 519 288 991 27 371 5 969 94 468 729 723 4 78 892 268 82 875 83 2 1 5 518 27 1 8 55 711 3 917 9 7 77 19 641 548 2833 42 657 713 72 4 2253 29 8332 7 28 14 288 547 926 86 36 6693 67 653 27 61 1293 7972 176 745 478 46 84 6 65 231 876 78 57 82 4 64 61 32 379 3 3 54 75 3 294 374 96 63 882 47 5 458 56 83 49 513 99 153 7753 74 48 46 36 193 23 997 8 6113 4 1256 1788 615 46 64 32 45 5634 32 773 31 862 9 9199 89 62 54 61 33 45 93 39 683 82 75 345 3 2 173 45 97 82 79 676 149 3 88 7 4439 412 999 51 47 33 67 942 18 18 4388 1 132 8 468 3 12 28 99 79 56 84 83 71 35 5 81 5 715 79 73 69 258 7 53 173 39 2 5 47 64 37 8258 62 4481 915 78 5 62 67 48 624 4978 593 7 8 1 187 729 157 68 2 93 3721 132 28 6794 43 4 15 59 994 274 88 6 727 753 1747 5 1 8 7 871 66 65 18 42 558 7 95 6 5866 4473 2 7 483 946 98 56 4777 2 4 556 388 2 84 84
6 87 39 72 56 12 69 79 58 4378 86 49 146 5 412 85 7751 577 69 813 55 9942 753 49 734 587 15 779 148 499 961 55 93 93 51 73 54 69 6 539 734 6659 23 88 39 7 894 52 69 11 6536 269 7963 227 63 871 76 7929 51 31 48 84 921 571 887 32 65 8 24 335 373 1259 216 6154 79 627 36 827 29 17 977 69 35 6987 822 41 421 43 79 7 222 569 994 196 51 472 869 511 174 9 71 477 64 38 265 64 69 348 14 346 493 1246 7 38 673 82 34 3337 41 863 2826 78 41 356 61 314 46 29 93 841 71 889 38 95 64 366 3633 228 18 84 5 88 752 292 93 58 31 17 181 174 1928 443 76 636 741 323 678 261 86 99 128 79 41 5499 81 241 48 278 326 4914 39 893 47 81 249 61 889 98 9428 472 68 34 99 135 43 56 112 3 99 984 64 32 54 342 96 957 467 6 5 28 33 631 383 3 785 757 688 4 99 9 46 2 486 51 923 657 36 698 318 721 67 878 52 8 8 42 415 325 15 77 8 243 89 23 3871 638 25 35 6859 165 51 53 96 49 19 6849 92 27 468 9576 75 299 51 63 15 41 68 7671 667 8 3 3555 4911 645 8521 669 13 473 62 44 82 17 1432 8 94 26 6 43 47 23 72 5 536 92 795 3884 56 232 31 34 72 717 24 46 99 46 34 74 5186 5964 13 442 896 5464 91 5 76 696 2 9 668 14 98 99 3 241 18 956 72 22 43 95 117 2577 53 17 4 12 3 499 9 883 57 13 87 96 75 75 22 69 3 8117 89 194 4372 943 337 5 76 39 549 989 99 42 1346 55 92 69 229 14 3 8 766 55 825 717 4 421 213 936 7324 11 63 81 31 845 5222 12 4762 9197 57 1132 21 41 17 116 59 6445 327 6249 47 31 81 159 24 6396 439 85 518 26 1854 425 79 1422 79 32 4 17 288 32 472 566 9696 13 152 48 329 84 86 84 744 559 5 974 92 93 146 588 1543 331 643 72 5 17 2722 1 147 983 2 3271 597 788 21 18 56 349 22 141 624 83 52 98 24 39 96 828 677 422 856 18 154 166 29 59 52 134 83 7468 6126 781 23 97 921 656 42 59 4 6 324 796 63 55 72 47 12 45 316 6694 7486 68 622 5 591 35 83 81 185 61 532 4278 8 97 52 347 975 89 631 98 41 36 44 661 92 45 29 663 695 31 876 685 52 22 375 116 965 41 63 87 7183 991 86 45 17 2 987 97 9842 21 52 899 71 72 52 51 2548 35 189 393 58 7517 7 986 86 56 252 25 186 16 26 892 187 692 34 445 991 868 6467 91 98 9313 314 657 877 99 25 78 5927 14 894 56 73 67 6148 579 115 334 69 293 98 6 315 484 16 97 562 4861 1 65 31 81 135 368 86 624 54 6126 44 497 97 46 66 11 9 461 178 48 1756 846 391 228 47 38 8212 39 949 443 321 43 958 838 952 145 9113 71 144 438 34 654 3 7 719 588 78 42 932 71 86 52 24 529 9649 2131 629 14 4 56 5289 12 214 76 1752 27 393 954 98 933 13 143 6962 72 5 813 832 15 86 677 8174 94 778 3 853 24 53 62 862 37 21 56 728 3828 37 56 67 239 57 5 753 993 95 1 47 81 683 46 73 59 97 193 651 7694 54 8 94 39 631 27 7 815 363 142 542 487 3 42 59 935 6 72 498 22 36 153 294 171 87 74 746 54 764 17 15 76 77 39 62 68 24 31 4247 535 659 691 76 985 7 552 21 418 297 398 46 16 525 8772 45 816 21 36 4 767 553 52 58 832 16 921 72 528 3 312 34 95 169 196 8917 75 428 174 76 25 1332 18 3336 75 87 176 693 127 174 76 62 9154 67 437 95 9 9627 1477 992 155 693 275 5 1519 49 863 3753 74 29 46 43 56 72 46 453 63 77 642 21 94 857 229 283 67 896 499 8 346 15 24 72 197 83 857 9616 78 7 37 37 636 453 937 65 3688 59 421 9591 7725 75 39 97 33 2451 29 559 34 328 32 6495 784 18 864 98 6 45 683 57 919 26 641 858 168 8 842 44 18 13 12 524 597 7 45 31 723 122 522 3 926 773 23 632 64 58 3548 9 292 458 398 58 96 64 24 68 75 89 64 62 66 2 67 156 211 9 34 88 673 12 52 817 886 36 9 36 36 21 158 18 9551 396 22 33 99 54 61 558 9476 648 8 54 2 853 789 394 197 9 4262 2485 488 43 1364 99 799 99 32 54 674 53 35 586 24 7623 97 34 7 2 62 15 57 27 789 439 53 84 4 7226 4115 8 96 398 89 484 83 6751 74 5 922 514 47 95 519
827 446 82 72 76 21 31 32 96 3257 21 21 171 2 31 17 9178 977 11 469 58 712 162 4 1 132 91 84 72 741 576 55 7822 7 53 37 14 63 284 386 524 2824 67 9 61 5 116 27 97 13 145 259 2786 921 78 5846 2 9264 82 95 5 43 365 2841 795 4 26 1 19 763 518 7755 29 7363 684 489 72 227 93 13 694 81 45 848 661 85 32 99 92 35 972 676 327 4387 21 39 339 794 911 2 639 6869 23 81 38 261 26 812 3 313 941 168 65 23 2966 11 37 8918 5 334 947 62 394 259 6416 11 232 39 15 73 53 751 25 51 658 525 8963 248 86 47 5 97 354 59 62 56 39 82 286 391 3347 669 47 382 818 749 896 666 15 78 955 96 87 4981 7 817 53 298 77 2238 29 52 16 8 191 48 292 23 3896 89 88 68 2 7254 181 87 896 27 128 44 97 641 97 646 12 94 631 4 27 21 52 671 15 18 374 191 886 8 75 51 65 64 812 4 841 215 487 164 313 575 51 329 978 339 14 73 6976 56 2 82 97 843 33 783 54 248 59 48 577 5766 39 41 91 3 34 5918 46 47 894 6959 88 32 68 62 96 86 53 6996 336 929 4 2236 9665 148 9481 395 26 632 22 56 34 75 8461 43 48 14 42 47 851 61 72 9 835 834 812 151 19 353 46 21 76 796 67 89 57 75 28 697 9918 4272 55 226 167 43 97 53 38 561 4 53 768 796 791 5 97 981 9 466 61 82 23 59 263 4475 11 75 65 18 5 559 6 927 664 54 29 25 66 1 55 94 11 4945 54 67 7998 253 41 737 86 82 257 59 35 39 2111 775 98 21 726 77 68 14 517 24 884 72 86 18 847 455 922 14 396 52 866 8682 2461 594 2826 87 78 5235 549 76 756 213 22 3512 9959 1651 881 12 75 32 86 718 88 24 998 94 117 797 95 1895 56 74 7 77 968 93 12 528 11 56 252 94 1635 21 638 96 54 238 1 576 54 19 866 994 79 513 175 12 52 771 5177 83 49 483 59 878 287 115 63 34 14 534 51 946 996 71 82 46 33 17 51 466 832 984 67 5 832 155 28 894 98 166 188 1848 4874 92 34 24 162 191 24 62 2 5 824 827 11 8 57 3 93 96 141 6579 419 89 652 5 5713 58 37 91 552 85 393 829 52 81 76 44 626 74 16 98 11 75 59 489 82 77 14 279 512 3 181 675 8 93 183 394 168 69 21 21 8185 951 83 51 68 4 29 97 4254 23 51 333 28 62 31 919 553 26 258 68 62 242 87 53 48 48 164 79 824 27 4 698 266 355 87 763 444 753 845 369 92 6998 931 291 241 17 59 53 3539 92 695 5 36 119 334 72 85 665 84 887 774 553 568 1527 14 39 4271 2619 746 651 792 68 611 167 91 6674 257 1771 55 787 81 73 264 684 44 4893 789 29 439 561 361 884 37 71 9261 38 673 784 426 46 9228 279 47 172 3178 82 446 217 83 334 9 4 49 7 82 85 7686 57 52 83 47 288 718 166 894 37 8 92 4278 32 761 15 8639 6326 872 535 6 48 93 9923 17 44 86 953 956 2936 71 375 3188 23 635 68 93 163 39 38 49 57 96 658 459 42 86 25 51 782 24 8 218 94 21 4534 8768 27 882 76 519 88 38 631 464 2465 243 6 74 57 773 4 36 152 877 463 665 211 19 5 23 153 53 83 137 37 84 662 582 751 91 29 18 76 974 75 75 86 32 49 9 44 62 55 5154 512 81 96 858 755 16 817 11 747 746 5796 54 16 366 3893 1 129 78 5667 282 729 47 71 27 646 33 853 455 34 72 592 59 168 237 392 153 39 186 729 78 288 25 76 687 61 2 317 72 55 228 21 17 779 17 58 41 4 4263 4786 466 81 563 955 3 6758 51 138 3429 99 72 44 885 3 47 66 24 636 9473 896 672 17 992 78 246 541 655 897 6 19 57 23 57 214 34 374 548 61 9 919 65 216 7841 973 22 13 116 456 862 4254 83 94 75 88 7532 2 393 56 756 952 1916 698 2 647 77 3 566 735 96 572 47 422 155 729 69 169 52 73 89 47 41 191 2 47 39 567 433 696 8 968 486 62 968 62 66 2783 2 187 861 91 85 4 32 95 314 35 81 89 2 22 9 99 297 682 2 36 66 5879 826 25 97 977 46 57 91 741 22 41 28 824 714 163 53 65 81 85 591 164 52 96 98 73 325 16 791 535 96 1297 1738 145 9 3686 89 295 49 43 86 19 15 472 233 4 3372 79 54 9 13 11 72 727 31 583 41 1299 97 51 6367 5137 273 52 333 78 4217 644 7587 17 99 5682 19 29 27 938
9472 154 36 76 5 89 37 5 28 6 95 49 82 66 7 44 8183 524 38 819 11 7 825 9 8 397 48 79 64 619 147 1 3246 6 16 11 95 77 439 62 463 668 42 9 67 75 314 42 3 39 12 435 83 458 8 1974 8 6 62 1 1 76 319 9586 295 2 27 8 73 722 9 6487 23 8667 416 853 68 82 65 8 127 81 8 53 565 22 93 97 8 11 9511 89 34 8237 3 52 312 389 715 52 444 4487 77 62 14 946 6 733 7 1 937 71 88 4 1185 33 6 7137 7 1 296 81 954 749 3223 6 712 56 32 5 77 4 7 91 144 429 3589 62 42 35 21 5 972 6 9 53 82 12 977 53 15 7 5 114 169 588 191 35 96 84 68 5 52 3611 9 682 35 424 93 2698 29 6 29 2 752 35 428 13 264 25 73 58 3 4646 614 58 413 29 368 3 695 961 17 545 837 21 54 3 76 22 12 293 57 41 262 766 592 3 92 98 43 7171 94 1 52 11 638 63 282 9 25 996 612 465 85 14 7415 96 9 9 87 585 13 919 51 6 53 76 682 3997 33 72 42 3 5 5112 54 37 2 3248 66 22 8 33 67 792 22 9236 939 555 49 8724 672 313 9386 533 38 63 2 23 886 75 2212 351 75 97 33 69 289 39 82 14 982 154 598 13 91 194 9 9 86 91 4 3387 82 7 52 522 8958 9942 2 643 574 36 3 96 13 97 9 77 143 783 686 4 87 779 9 762 976 51 53 43 6 4459 4 96 45 93 8 519 52 615 234 238 57 68 79 3 61 51 477 7717 76 6 3912 332 9 354 218 45 664 8 25 358 1372 818 33 93 375 37 51 86 696 39 93 26 51 38 823 276 988 95 976 55 216 5135 7337 814 41 54 7 9963 132 21 175 868 5 6725 1637 97 248 97 71 65 65 535 66 44 817 5 35 942 65 5414 73 76 8 82 733 96 9 534 2 3 8 7 7935 2 821 33 7 935 25 6 42 91 85 14 57 644 829 21 35 417 1839 672 33 69 87 44 62 23 77 3 622 71 6 5 997 98 3 31 52 87 9 92 47 964 2 1 654 97 17 797 22 662 496 3144 86 58 87 2 13 93 3 32 6 76 6 562 9 1 14 8 4 18 81 7765 66 61 53 87 8427 34 63 9 826 66 6 67 56 6 49 29 423 34 18 7 58 7 57 58 51 75 81 831 54 4 172 97 5 545 835 45 372 75 84 22 8734 7 18 98 73 2 6 78 8956 11 79 512 87 53 1 449 46 8 245 98 2 4 26 38 3 26 144 2 3 948 4 282 962 387 1 112 636 444 213 149 71 4365 635 541 878 32 42 29 75 81 647 2 27 919 2 35 69 25 46 62 566 747 513 6521 94 46 1911 4664 173 213 798 48 111 9 85 8692 422 8193 658 871 9 92 627 778 2837 8523 17 85 82 683 839 955 89 144 6742 185 546 9 848 7 1616 964 85 451 332 7 52 48 1 622 6 8 55 5 69 59 1548 41 58 23 63 672 99 799 17 51 21 26 8341 24 547 93 6633 8885 452 741 8 9 844 3218 9 9 11 94 844 3698 14 25 6952 82 92 775 6 189 544 65 1 17 76 819 23 5 2 46 44 372 6 8 4588 79 96 6373 1469 3 99 37 272 97 54 1998 971 21 417 54 88 43 922 4 49 915 3 334 722 13 48 9 9 329 75 96 925 81 38 112 293 1774 9 68 22 2 199 292 87 6 98 11 8 45 69 4 7866 88 2 9 356 778 21 17 15 36 61 4384 24 8 81 6931 9 911 21 5578 729 475 29 49 752 2867 13 527 221 43 48 548 85 862 933 816 16 45 4 14 1 665 29 13 434 63 9 453 7 8 56 1 89 27 8 2 27 3 872 2552 253 4 59 898 1 1678 71 77 6925 7 78 84 726 2 86 71 34 286 2752 933 655 57 32 1 422 264 698 383 47 76 18 67 53 668 5 25 78 29 4 769 99 663 8321 444 29 22 839 56 6 3487 7 28 69 27 11 5 639 88 59 963 739 833 1 343 69 1 794 447 24 76 52 849 13 843 44 161 29 51 22 9 97 5 72 79 76 22 772 848 8 872 379 5 652 7 81 925 21 98 823 3 2736 8 89 39 532 29 69 63 2 84 53 7 546 11 3 64 6 2196 613 3 14 536 31 48 77 148 81 65 65 58 466 858 24 25 19 858 852 299 84 57 47 89 447 88 41 672 51 2335 9395 234 5 753 78 872 44 73 28 64 83 777 77 6 954 22 24 33 82 83 4 468 96 647 9 5715 52 99 694 6722 734 92 6 76 4265 993 676 37 96 2159 54 94 13 354
+ + + * * * + * * + * + * * + + + + * + * + * + * * * * + * + + + + * + * * * * * + * + * + * * * + + * + * + + * + + + + * * + + * + + + + * + * + * * * + * * + + * + * * + * * + + * * + + * + + * * * + * + * + * + * + + + * + + + * + * + + + + * + * + * + + * * + + * * + * + + * + * * * * + * * * + + * * * + * + + * + * + + + + * * * + * + + + * * + + + * * + + + * * + + * * * + + * * + * + + + + * + * * + + + + + + + + * * * * + * * * * * * * * + + * * + * * * + + + * + + * * * * * + + * * + + * * + * * * + * + + + + * + * * * * * + + + + + * * + + + * * + * * + + * * * * + + + * + + + + + * * + + * * * + * * * * * + * * * * + + * + * + + * * * * * + + + + * + * + * + * + * * + + * * + * * * + * + + * * * * * * * + * * + * + * + * * * * + + + + + * + + * * * * + + + + + + * * + * * * * + * + + * + * + + + + * + + + * + + * + * + * * + * * + + * + + * + + * * * * + * + + * * * * + * * * * * * + + * * * * + * + * * + * + + * + * * * * + + * * + * * + * * + + + + * * * + + * * + * * + * * * + + + * + * * + + * + + * * + + * * * * + * * + + + * * + * * * + + + * * * * * * + * + + * + * * + * * * * * * * * + + * + * + * * + + + + * + + + * + + * * + + + * + + * * * + * * + + + + * * + * + + * + * * * * * * + + + + + * + * + * + + + * * * + * + + + + + * + * * * * + + * + * * * * * + + * + * * + * + * + + + * + + + + + * * * * + * + + * + * + + * + + * + * + + * * * * * * + + + + + * * * + * * + * + * + * + * * + * * * + + * * * * + * * + * + + + * * + + * + * + + * * * + * + * * * + + * * * * + + * + + + * * + + + * * * * + * * + + + * * * * * + * * + + * + + + * * * * + * + * + * * * * + + + + * + + + * + + + * + + * + + + * + + * * + * * * * * * * * + + + + * + * * * * * + + + + * + + + * + + * + + + * * * + + + * * * + * + + * * + * * * + * * * * * * + + + * * + * * * + * + + * * + * + * * * * + * * * + * * * + * + + + * + * * + * * + + + + + + + * + * + * + + + * * * + * + + + + * * + * + + + + * * * * + + * + * + * * + * * + + + * + + + * * * + * + * * + * * + +

4
inputs/day06example.txt Normal file
View File

@@ -0,0 +1,4 @@
123 328 51 64
45 64 387 23
6 98 215 314
* + * +

142
inputs/day07.txt Normal file
View File

@@ -0,0 +1,142 @@
......................................................................S......................................................................
.............................................................................................................................................
......................................................................^......................................................................
.............................................................................................................................................
.....................................................................^.^.....................................................................
.............................................................................................................................................
....................................................................^...^....................................................................
.............................................................................................................................................
...................................................................^.^...^...................................................................
.............................................................................................................................................
..................................................................^.....^.^..................................................................
.............................................................................................................................................
.................................................................^.^.^.^.^.^.................................................................
.............................................................................................................................................
................................................................^.^.^...^.^.^................................................................
.............................................................................................................................................
...............................................................^.^.^.^.^.^.^.^...............................................................
.............................................................................................................................................
..............................................................^.^.^.^.^.....^.^..............................................................
.............................................................................................................................................
.............................................................^.^.^.^.^.^.^.^.^.^.............................................................
.............................................................................................................................................
............................................................^.^.....^.^.^.^.^.^.^............................................................
.............................................................................................................................................
...........................................................^...^.^...^.^.^...^.^.^...........................................................
.............................................................................................................................................
..........................................................^.^.^.^.^.^...^.^.^...^.^..........................................................
.............................................................................................................................................
.........................................................^...^.....^.^...^.^.^.^.^.^.........................................................
.............................................................................................................................................
........................................................^.^...^.^...^.^.^.^.^.^...^.^........................................................
.............................................................................................................................................
.......................................................^...^.^...^.^...^.^...^.....^.^.......................................................
.............................................................................................................................................
......................................................^...^...^.^...^.^.^.^.^.^.^.^...^......................................................
.............................................................................................................................................
.....................................................^.^.^.^.^.^.^...^.^.^.^...^.^.^.^.^.....................................................
.............................................................................................................................................
....................................................^.^.^...^.^...^.^...^.^.^.^.^.^.^...^....................................................
.............................................................................................................................................
...................................................^.^.^.^.^.^.^...^.^.^.^.^.^.....^.^.^.^...................................................
.............................................................................................................................................
..................................................^.^...^.^.^.....^...^...^.^...^.^...^...^..................................................
.............................................................................................................................................
.................................................^.......^.^.^.....^.^.^.^.^.^.^.^...^...^.^.................................................
.............................................................................................................................................
................................................^...^.^.^...^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^................................................
.............................................................................................................................................
...............................................^.^.....^.^.^.^...^.^.^.^.^...^...^...^.^.....^...............................................
.............................................................................................................................................
..............................................^...^...^.^.^...^...^.....^.^.......^.....^.....^..............................................
.............................................................................................................................................
.............................................^.^.^.....^.^.....^.^.....^.......^.^.^.^.^.^.^.^.^.............................................
.............................................................................................................................................
............................................^.^.....^.^.^.........^.^...^.^...^...^.^.^.^...^...^............................................
.............................................................................................................................................
...........................................^.^.....^.......^.^.^...^.^.^.^.^.^.^.....^...^.^...^.^...........................................
.............................................................................................................................................
..........................................^.^.....^.^.^.^...^.^...^.^.^.^.^.^.^.....^.^.^...^...^.^..........................................
.............................................................................................................................................
.........................................^.^.....^.^.......^.........^.^.^.^...^.^.^.^...^.^.....^.^.........................................
.............................................................................................................................................
........................................^.^.^.^...^...^...^.^.^.^.^.^.^.^.^.^...^.....^.^.^.^.^.^...^........................................
.............................................................................................................................................
.......................................^.....^.^.^.......^.^...^.....^.^.^...^...^.^.^.^.^.^.^.^.^...^.......................................
.............................................................................................................................................
......................................^.^.....^...^.^.^.^.^...^.^.^.....^.^.....^.^.^.^.^...^.^.^.^...^......................................
.............................................................................................................................................
.....................................^.^...^.^.^.^.^.^.^.^.^.^.^.^.^.^...^.^.^.^.^.^...^.^.........^.^.^.....................................
.............................................................................................................................................
....................................^.^.^.^.^.^.^.^.^.....^.^.^...^...^...^.^.....^.^.^...^.^...^...^.^.^....................................
.............................................................................................................................................
...................................^.^.....^.^.^...^...^.^...^...^.......^.^.^.^.^.^.^...^.^.^.^.^.^.^.^.^...................................
.............................................................................................................................................
..................................^.^.^.^.^.^.^.^.^.^...^.^...^...^.^.^.^.^.^.^.^.....^.^.^...^.....^.^...^..................................
.............................................................................................................................................
.................................^.^.^.^.......^...^.^.^...^.^.^.....^.^...^.^.^.^...^.^.^.^...^.^.^.^...^.^.................................
.............................................................................................................................................
................................^.^.^.........^.^...^.^...^.^.^.^.^...^.^...^.^.....^...^.^.^...^...^.^...^.^................................
.............................................................................................................................................
...............................^.....^.^.....^.^.^.^.....^.^.^.^.^.^.^.^.^.....^.....^.^...^.....^.^.^.^.^.^.^...............................
.............................................................................................................................................
..............................^.^.^.^.^.^.....^.^.^.^.^.....^.^.^.^.^.^.....^...^.^...^.^.^.^.^.^.^...^.^.^...^..............................
.............................................................................................................................................
.............................^...^...^.^.^.^...^.^.......^.^...^...^.^...^.^.^.^...^...^.^.^.....^.^.^...^.^.^.^.............................
.............................................................................................................................................
............................^...^.^...^.^.^.^...^.^...^...........^.^.^.^.^.^.....^.^.^.^.^.^.^.^.^...^.....^.^.^............................
.............................................................................................................................................
...........................^.^...^.^.^...^.^.^.^.^.^.^.^.....^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^...^.^.^.^.^.^.^.^...........................
.............................................................................................................................................
..........................^.^.^...^.^...^.^.^...^...^.^.^.^.^...^.^.^.^.^.^.^...^.^.^.^.^.^.^.^.^...^.^.^.....^.^.^..........................
.............................................................................................................................................
.........................^...^...^.^.^.^.^...^...^.......^.^...^.^...^.^.^...^.^.^.^...^.^.^.^...^.^...^.^...^.^.^.^.........................
.............................................................................................................................................
........................^.^.^.^.^.^.^...^...^.^.^...^.^.^.^.^.^...^...^...^.^.^.....^.^...^.^...^.^.^.^.^.......^.^.^........................
.............................................................................................................................................
.......................^.^.^.^.^.^.^.^.........^.^.^.^...^.^...^...^.^.^.^.^...^.^...^.^.^...^...^.^.^.^...^.^.^.^...^.......................
.............................................................................................................................................
......................^.^.^.^.......^.^.^.^.^...^...^...^.^.^...^.....^.^.^...........^.^.^.^.^...^.^.^.^.^.^.^...^.^.^......................
.............................................................................................................................................
.....................^.^.^...^...^...^.........^...^.^...^.^.^...^.^.^.^...^.^.^...^.^...^...^...^...^.^.^.....^.^.^...^.....................
.............................................................................................................................................
....................^.^.^.....^.^.^...^...^.^.^.^.^.^.^.^.^.^.^.....^...........^...^.^.^.^.^.^.^...^.....^.^...^...^.^.^....................
.............................................................................................................................................
...................^.....^.....^.......^.^.^.^.^.^.^.^.^.^.....^.^.^.^.^.^.......^...^.^.^...^.^.^.^.^.^.^.^.^.....^.^...^...................
.............................................................................................................................................
..................^.^.^...^.^.^.^.^...^.^.^...^.^.^.^.^.^.^.^.^...^.^.^.^.^...^...^...^.^.^.^.^...^.^...^...^.^.^...^...^.^..................
.............................................................................................................................................
.................^.^.^.^.^.^...^.^.^.^.^.^...^.^.^.^.^...^.......^...^.^.^.^.^...^.^.^.^.^.^.^.^.^.^.^...^.^.^.^...^...^.^.^.................
.............................................................................................................................................
................^...^.^.^.^.^...^...^.^...^...^.^.^...^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^...^...^.^.^.^.^.....^.^.^.^.^.^................
.............................................................................................................................................
...............^.....^.^.^.^.^.......^.^.^...^.^.^.^.^.^...^.^.^.^.^.....^.^.^.....^.^.^.^...^.....^.^.^...^.^...^.^.^.^.^...^...............
.............................................................................................................................................
..............^.^.^.^.^.^.^...^.^.^.^.^.^.^.^.^.^.^...^.^...^.^.......^.^.^.^.....^...^.........^.....^...^.^.^.^.^...^.^.^.^.^..............
.............................................................................................................................................
.............^.^.^...^.....^.....^...^.^...^.^...^.^.^.^.^.^.^.^...^.^.^...^.^...^.....^.^.^.^.^.^...^.^...^.^...^.^.^.^.^.....^.............
.............................................................................................................................................
............^.^.^...^.^.^.^.^.^.^...^.^...^...^.^.^.^.^.^...^...^.^.^.^...^.^.^.^.....^.....^.^...^...^...^.^.^.^.^.^.......^.^.^............
.............................................................................................................................................
...........^...^.^...^.^.^.^.^.^...^.^.^.^.^.^.^.^.^.^.^.^...........^.^...^.^...^...^.^.^.^.^.^...^.....^.......^.^.^.^...^...^.^...........
.............................................................................................................................................
..........^.^.^.^...^...^...^.^.^.....^.^...^.^.^.^...^.^...^.^.^.^...^.^.....^.^...^.^.^.^...^.^.^.^.^...^...^.^.^.^.^.^...^.^.^.^..........
.............................................................................................................................................
.........^.....^...^.^...^.^.^.^.^.^.^...^.^...^.^.^.^.^...^...^.......^.^...^.^.^.^.^.^.^.....^...^.....^.^.^.^.^.^.^.^.^...^.^.^.^.........
.............................................................................................................................................
........^.^.^.^.^...^...^.^.^...^.^.^.^...^.^.^.^...^.^...^.^.^.^.....^.^.^.^.....^.^.^.....^.^.^.^...^.^...^.....^.^.^.^.^.^...^.^.^........
.............................................................................................................................................
.......^.^.......^.....^.^.^.^...^.^.^.^.^...^.....^.^.^.^.^.^.^.^.^.^...^.....^...^.^...^.^.^.^...^.^.^.......^.^...^.........^.^.^.^.......
.............................................................................................................................................
......^.^...^.....^.^.^.^...^.^.^.^.^.^...^.......^.....^.^.....^.^.^...^.^.^.^...^.^.^.^.^...^.^.^.^.^...^.^.^.^.....^.....^.^.^.^.^.^......
.............................................................................................................................................
.....^.^.^.^.....^...^.^.^.^.^.....^...^.^...^.^.^.^...^.^.^.....^.^...^...^.^.^.^.....^.^.......^...^...^.^.......^.....^.^...^.^.^.^.^.....
.............................................................................................................................................
....^.^.....^.^.^.^...^.^.....^.....^.^.^.^.^.^.^.^.^.^.....^.^.^.^.^...^.^.^.^...^.^.^.^.^.^...^...^...^.^.^...^.....^...^...^...^.....^....
.............................................................................................................................................
...^...^.^.^.^.^...^...^.^.^.^.^...^.^.^...^.^.^.^...^...^.^.^.^...^...^...^...^.^.^.^.^.........^.....^...^.^...^.........^.^.^...^...^.^...
.............................................................................................................................................
..^.^.....^.^.^.......^...^.^.^...^.^.....^.^...^.^...^.....^.^.....^.^.^...^...^.^.^...^.^.....^.....^...^...^.^.^...^.^.^.^.^...^.^.^.^.^..
.............................................................................................................................................
.^.^.^.^.^.^.^...^.^...^.^...^.^.....^.....^.^.^.^.^.^.^.^.^...^.^...^...^.....^.^.^.^.^...^.^.^.^...^.^.^.^.^.^.......^.^...^.^.^.^.^...^.^.
.............................................................................................................................................

16
inputs/day07example.txt Normal file
View File

@@ -0,0 +1,16 @@
.......S.......
...............
.......^.......
...............
......^.^......
...............
.....^.^.^.....
...............
....^.^...^....
...............
...^.^...^.^...
...............
..^...^.....^..
...............
.^.^.^.^.^...^.
...............

12
src/bin/day03.rs Normal file
View File

@@ -0,0 +1,12 @@
use aoc_2025::day03;
use color_eyre::Report;
fn main() -> Result<(), Report> {
color_eyre::install()?;
let data = day03::data("inputs/day03.txt")?;
let code1 = day03::part1(&data)?;
let code2 = day03::part2(&data)?;
println!("code1: {code1}");
println!("code2: {code2}");
Ok(())
}

12
src/bin/day04.rs Normal file
View File

@@ -0,0 +1,12 @@
use aoc_2025::day04;
use color_eyre::Report;
fn main() -> Result<(), Report> {
color_eyre::install()?;
let data = day04::data("inputs/day04.txt")?;
let code1 = day04::part1(&data)?;
let code2 = day04::part2(&data)?;
println!("code1: {code1}");
println!("code2: {code2}");
Ok(())
}

12
src/bin/day05.rs Normal file
View File

@@ -0,0 +1,12 @@
use aoc_2025::day05;
use color_eyre::Report;
fn main() -> Result<(), Report> {
color_eyre::install()?;
let data = day05::data("inputs/day05.txt")?;
let code1 = day05::part1(&data)?;
let code2 = day05::part2(&data)?;
println!("code1: {code1}");
println!("code2: {code2}");
Ok(())
}

12
src/bin/day06.rs Normal file
View File

@@ -0,0 +1,12 @@
use aoc_2025::day06;
use color_eyre::Report;
fn main() -> Result<(), Report> {
color_eyre::install()?;
let data = day06::data("inputs/day06.txt")?;
let code1 = day06::part1(&data)?;
let code2 = day06::part2(&data)?;
println!("code1: {code1}");
println!("code2: {code2}");
Ok(())
}

12
src/bin/day07.rs Normal file
View File

@@ -0,0 +1,12 @@
use aoc_2025::day07;
use color_eyre::Report;
fn main() -> Result<(), Report> {
color_eyre::install()?;
let data = day07::data("inputs/day07.txt")?;
let code1 = day07::part1(&data)?;
let code2 = day07::part2(&data)?;
println!("code1: {code1}");
println!("code2: {code2}");
Ok(())
}

128
src/day03.rs Normal file
View File

@@ -0,0 +1,128 @@
use color_eyre::{Report, eyre::ContextCompat};
use std::{
fs::File,
io::{self, BufRead, BufReader},
};
const BATTERIES: usize = 12;
pub struct BatteryBank {
biggest_sorted: Vec<u8>,
batteries: Vec<u8>,
}
impl TryFrom<String> for BatteryBank {
type Error = Report;
fn try_from(value: String) -> Result<Self, Self::Error> {
let digits = value
.chars()
.map(|v| v.to_string().parse::<u8>())
.collect::<Result<Vec<u8>, std::num::ParseIntError>>()?;
let mut sorted_list = digits.clone();
sorted_list.sort();
sorted_list.reverse();
sorted_list.dedup();
Ok(Self {
batteries: digits,
biggest_sorted: sorted_list,
})
}
}
impl BatteryBank {
fn try_value_part1(&self, index: usize) -> Result<Option<u64>, Report> {
let value = self.biggest_sorted.get(index).context("out of bounds")?;
let index = self.batteries.iter().position(|x| x == value).unwrap();
let (_, split) = self.batteries.split_at(index + 1);
if split.is_empty() {
return Ok(None);
}
let mut split = split.to_vec();
split.sort();
let biggest = split.last().unwrap();
Ok(Some((value * 10) as u64 + *biggest as u64))
}
fn part1(&self) -> Result<u64, Report> {
let len = self.biggest_sorted.len();
for i in 0..len {
if let Some(v) = self.try_value_part1(i)? {
return Ok(v);
}
}
Ok(0)
}
fn part2(&self) -> Result<u64, Report> {
let mut progress = vec![];
let len = self.batteries.len();
for (i, value) in self.batteries.iter().enumerate() {
while let Some(last) = progress.last()
&& *last < value
&& progress.len() + (len - i) > BATTERIES
{
progress.pop();
}
if progress.len() < BATTERIES {
progress.push(value);
}
}
// println!("value: {progress:?} {}", progress.len());
let mut num = 0;
for (i, v) in progress.iter().enumerate() {
num += **v as u64 * 10_u64.pow(progress.len() as u32 - i as u32 - 1);
}
// println!("{num}");
Ok(num)
}
}
pub fn part1(data: &[BatteryBank]) -> Result<u64, Report> {
Ok(data
.iter()
.map(|v| v.part1())
.collect::<Result<Vec<u64>, Report>>()?
.iter()
.sum::<u64>())
}
pub fn part2(data: &[BatteryBank]) -> Result<u64, Report> {
// let first = BatteryBank::try_from(String::from("818181911112111"))?.part2()?;
Ok(data
.iter()
.map(|v| v.part2())
.collect::<Result<Vec<u64>, Report>>()?
.iter()
.sum::<u64>())
}
pub fn data(filepath: &str) -> Result<Vec<BatteryBank>, Report> {
let file = File::open(filepath)?;
let bufreader = BufReader::new(file);
let banks = bufreader
.lines()
.collect::<Result<Vec<String>, io::Error>>()?
.into_iter()
.map(BatteryBank::try_from)
.collect::<Result<Vec<BatteryBank>, Report>>()?;
Ok(banks)
}
#[cfg(test)]
mod tests {
use super::*;
use criterion::Criterion;
use criterion_macro::criterion;
#[criterion]
fn bench_part1(b: &mut Criterion) {
let data = data("inputs/day03.txt").unwrap();
b.bench_function("day03-part1", |b| b.iter(|| part1(&data).unwrap()));
}
#[criterion]
fn bench_part2(b: &mut Criterion) {
let data = data("inputs/day03.txt").unwrap();
b.bench_function("day03-part2", |b| b.iter(|| part2(&data).unwrap()));
}
}

155
src/day04.rs Normal file
View File

@@ -0,0 +1,155 @@
use color_eyre::{
Report,
eyre::{ContextCompat, eyre},
};
use std::{
fs::File,
io::{self, BufRead, BufReader, Lines},
};
#[derive(Clone)]
pub struct Wall {
inner: Vec<bool>,
width: usize,
height: usize,
}
impl<R: BufRead> TryFrom<Lines<R>> for Wall {
type Error = Report;
fn try_from(value: Lines<R>) -> Result<Self, Self::Error> {
let mut width = None;
let mut height = 1;
let mut inner: Vec<bool> = Vec::new();
for line in value {
let line = line?;
let chars: Vec<char> = line.trim().chars().collect();
let new_width = chars.len();
if let Some(old_width) = width {
if old_width != new_width {
return Err(eyre!("width mismatch"));
}
} else {
width = Some(new_width);
}
for c in chars {
match c {
'@' => inner.push(true),
'.' => inner.push(false),
_ => return Err(Report::msg(format!("Invalid character in wall: {}", c))),
}
}
height += 1;
}
height -= 1;
Ok(Self {
inner,
width: width.unwrap(),
height,
})
}
}
impl Wall {
fn get_neibours(&self, pos: usize) -> Vec<usize> {
let mut neibours = Vec::new();
let x = pos % self.width;
let y = pos / self.width;
if x > 0 {
neibours.push(pos - 1);
}
if x < self.width - 1 {
neibours.push(pos + 1);
}
if y > 0 {
neibours.push(pos - self.width);
}
if y < self.height - 1 {
neibours.push(pos + self.width);
}
if x > 0 && y > 0 {
neibours.push(pos - self.width - 1);
}
if x < self.width - 1 && y > 0 {
neibours.push(pos - self.width + 1);
}
if x > 0 && y < self.height - 1 {
neibours.push(pos + self.width - 1);
}
if x < self.width - 1 && y < self.height - 1 {
neibours.push(pos + self.width + 1);
}
neibours
}
pub fn is_wall(&self, pos: usize) -> bool {
self.inner[pos]
}
pub fn set_wall(&mut self, pos: usize, wall: bool) {
self.inner[pos] = wall
}
}
pub fn part1(data: &Wall) -> Result<u64, Report> {
let mut total = 0;
for i in 0..data.inner.len() {
if data.is_wall(i) {
let test = data
.get_neibours(i)
.iter()
.map(|p| if data.is_wall(*p) { 1 } else { 0 })
.sum::<usize>();
if test < 4 {
total += 1;
}
}
}
Ok(total)
}
pub fn part2(data: &Wall) -> Result<u64, Report> {
let mut data = data.clone();
let mut total = 0;
let mut changed = true;
// this is really shit
while changed {
changed = false;
for i in 0..data.inner.len() {
if data.is_wall(i) {
let test = data
.get_neibours(i)
.iter()
.map(|p| if data.is_wall(*p) { 1 } else { 0 })
.sum::<usize>();
if test < 4 {
data.set_wall(i, false);
total += 1;
changed = true
}
}
}
}
Ok(total)
}
pub fn data(filepath: &str) -> Result<Wall, Report> {
let file = File::open(filepath)?;
let bufreader = BufReader::new(file);
let wall = Wall::try_from(bufreader.lines())?;
Ok(wall)
}
#[cfg(test)]
mod tests {
use super::*;
use criterion::Criterion;
use criterion_macro::criterion;
#[criterion]
fn bench_part1(b: &mut Criterion) {
let data = data("inputs/day04.txt").unwrap();
b.bench_function("day04-part1", |b| b.iter(|| part1(&data).unwrap()));
}
#[criterion]
fn bench_part2(b: &mut Criterion) {
let data = data("inputs/day04.txt").unwrap();
b.bench_function("day04-part2", |b| b.iter(|| part2(&data).unwrap()));
}
}

182
src/day05.rs Normal file
View File

@@ -0,0 +1,182 @@
use color_eyre::{
Report,
eyre::{ContextCompat, eyre},
};
use std::{
cell::RefCell,
collections::{BTreeMap, VecDeque},
fs::File,
io::{self, BufRead, BufReader, Lines},
iter::Enumerate,
rc::Rc,
};
#[derive(Debug)]
pub struct RangeList {
ranges: Vec<(usize, usize)>,
data: Vec<usize>,
}
impl<R: BufRead> TryFrom<Lines<R>> for RangeList {
type Error = Report;
fn try_from(value: Lines<R>) -> Result<Self, Self::Error> {
let mut step = 0;
let mut ranges = Vec::new();
let mut data = Vec::new();
for line in value {
let line = line?;
match step {
0 => {
let parts = line.split('-').collect::<Vec<&str>>();
if parts.len() != 2 {
step = 1;
continue;
}
let start: usize = parts[0].parse()?;
let end: usize = parts[1].parse()?;
ranges.push((start, end));
}
1 => {
let number: usize = line.parse()?;
data.push(number);
}
_ => {}
}
}
Ok(Self { ranges, data })
}
}
impl RangeList {
pub fn in_range2<'a>(ranges: &'a [(usize, usize)], v: &'a usize) -> Option<&'a (usize, usize)> {
ranges.iter().find(|(start, end)| v >= start && v <= end)
}
pub fn in_range_except2<'a>(
ranges: &'a [(usize, usize)],
v: &'a usize,
range: (&'a usize, &'a usize),
) -> Option<&'a (usize, usize)> {
ranges.iter().find(|(start, end)| {
// println!(
// "2: {start:02}-{end:02} {range:?} {} {}",
// !(start != range.0 && end != range.1),
// v >= start && v <= end
// );
(v >= start && v <= end) && !(start == range.0 && end == range.1)
})
}
pub fn in_range(&self, v: &usize) -> Option<&(usize, usize)> {
self.ranges
.iter()
.find(|(start, end)| v >= start && v <= end)
}
pub fn in_range_except(&self, v: &usize, range: (&usize, &usize)) -> Option<&(usize, usize)> {
self.ranges.iter().find(|(start, end)| {
// println!(
// "2: {start:02}-{end:02} {range:?} {} {}",
// !(start != range.0 && end != range.1),
// v >= start && v <= end
// );
(v >= start && v <= end) && !(start == range.0 && end == range.1)
})
}
pub fn dedup_ranges(&self) -> Vec<(usize, usize)> {
let mut ranges = self.ranges.clone();
let mut index = 0;
while index < ranges.len() {
let Some((start, end)) = ranges.get(index) else {
break;
};
let (start, end) = (*start, *end);
// println!("START -- {start}-{end}");
let has_start = Self::in_range_except2(&ranges, &start, (&start, &end)).copied();
let has_end = Self::in_range_except2(&ranges, &end, (&start, &end)).copied();
// println!("{has_start:?}-{has_end:?}");
let mut reset = false;
match (has_start, has_end) {
(Some(new_start), None) if new_start.0 != start => {
ranges.remove(index);
ranges.insert(0, (new_start.0, end));
reset = true;
}
(None, Some(new_end)) if new_end.1 != end => {
ranges.remove(index);
ranges.insert(0, (start, new_end.1));
reset = true;
}
(Some(new_start), Some(new_end)) if new_start != new_end => {
let new = (new_start.0, new_end.1);
if new != (start, end) {
ranges.remove(index);
ranges.insert(0, new);
reset = true;
}
}
(Some(new_start), Some(new_end)) if new_start == new_end => {
ranges.remove(index);
reset = true;
}
_ => {
// panic!("unhandled")
}
}
if reset {
index = 0;
} else {
index += 1;
}
// println!("END -- {start}-{end} -- {ranges:?}");
}
// println!("{ranges:?}");
ranges.sort();
ranges.dedup();
ranges
}
}
pub fn part1(data: &RangeList) -> Result<u64, Report> {
let mut total = 0;
for i in &data.data {
total += if data.in_range(i).is_some() { 1 } else { 0 };
}
Ok(total)
}
pub fn part2(data: &RangeList) -> Result<u64, Report> {
let ranges = data.dedup_ranges();
let mut total = 0;
for (start, end) in &ranges {
let v = end - start + 1;
// println!("{start}-{end} => {v}");
total += v;
}
Ok(total as u64)
}
pub fn data(filepath: &str) -> Result<RangeList, Report> {
let file = File::open(filepath)?;
let bufreader = BufReader::new(file);
let rangelist = RangeList::try_from(bufreader.lines())?;
Ok(rangelist)
}
#[cfg(test)]
mod tests {
use super::*;
use criterion::Criterion;
use criterion_macro::criterion;
#[criterion]
fn bench_part1(b: &mut Criterion) {
let data = data("inputs/day05.txt").unwrap();
b.bench_function("day05-part1", |b| b.iter(|| part1(&data).unwrap()));
}
#[criterion]
fn bench_part2(b: &mut Criterion) {
let data = data("inputs/day05.txt").unwrap();
b.bench_function("day05-part2", |b| b.iter(|| part2(&data).unwrap()));
}
}

193
src/day06.rs Normal file
View File

@@ -0,0 +1,193 @@
use color_eyre::{
Report,
eyre::{ContextCompat, eyre},
};
use std::{
fs::File,
io::{BufRead, BufReader, Lines},
};
#[derive(Debug)]
enum Symbol {
Add,
Mul,
}
#[derive(Debug)]
enum Either {
Num(usize),
Symbol(Symbol),
}
impl Either {
fn is_symbol(&self) -> bool {
matches!(self, Either::Symbol(_))
}
fn is_num(&self) -> bool {
matches!(self, Either::Num(_))
}
}
impl Symbol {
fn apply(&self, data: &Vec<usize>) -> usize {
let mut val = 0;
for (i, v) in data.iter().enumerate() {
match (self, i) {
(Symbol::Add, _) => val += v,
(Symbol::Mul, 0) => val = *v,
(Symbol::Mul, _) => val *= v,
}
}
val
}
}
#[derive(Debug)]
pub struct MultGrid {
data: Vec<Vec<usize>>,
symbols: Vec<Symbol>,
width: usize,
num_height: usize,
}
impl<R: BufRead> TryFrom<Lines<R>> for MultGrid {
type Error = Report;
fn try_from(value: Lines<R>) -> Result<Self, Self::Error> {
let lines = value.collect::<Result<Vec<String>, _>>()?;
let mut data = Vec::new();
let mut symbols = Vec::new();
let mut num_height = 0;
let mut widths = Vec::new();
let parts: Vec<char> = lines.last().unwrap().chars().collect();
let mut length = 0;
for c in parts {
if c.is_ascii_digit() || c.is_whitespace() {
length += 1;
} else {
symbols.push(match c {
'+' => Symbol::Add,
'*' => Symbol::Mul,
v => {
panic!("unexpected symbol: {v:?}")
}
});
widths.push(length);
length = 0;
}
}
widths.remove(0);
widths.push(length + 1);
for line in lines.iter().rev().skip(1).rev() {
let parts: Vec<char> = line.chars().collect();
num_height += 1;
let mut widths_index = 0;
for w in &widths {
let part = parts[widths_index..widths_index + *w]
.iter()
.map(|v| {
if v.is_ascii_digit() {
v.to_digit(10).unwrap() as usize
} else {
0
}
})
.collect::<Vec<usize>>();
data.push(part);
widths_index += w + 1;
}
}
Ok(Self {
width: widths.len(),
num_height,
data,
symbols,
})
}
}
impl MultGrid {
pub fn get_num_col(&self, index: usize) -> Vec<&Vec<usize>> {
(0..self.num_height)
.map(|x| (x * self.width) + index)
.map(|i| &self.data[i])
.collect()
}
}
pub fn part1(data: &MultGrid) -> Result<u64, Report> {
let mut total = 0;
for i in 0..data.width {
let col = data
.get_num_col(i)
.into_iter()
.map(|v| v.iter().filter(|v| v != &&0).collect::<Vec<&usize>>())
.collect::<Vec<Vec<&usize>>>();
let col = col
.iter()
.map(|val| {
val.iter()
.enumerate()
.map(|(i, v)| **v * 10_usize.pow(val.len() as u32 - i as u32 - 1))
.sum::<usize>()
})
.collect::<Vec<usize>>();
let sym = &data.symbols[i];
let val = sym.apply(&col);
total += val;
}
Ok(total as u64)
}
pub fn part2(data: &MultGrid) -> Result<u64, Report> {
let mut total = 0;
for i in 0..data.width {
let mut matrix = data.get_num_col(i);
let rows = matrix.len();
let cols = matrix[0].len();
let new = (0..cols)
.rev()
.map(|col| (0..rows).map(|row| matrix[row][col]).collect::<Vec<_>>())
.map(|v| v.into_iter().filter(|v| v != &0).collect::<Vec<usize>>())
.collect::<Vec<Vec<_>>>();
let new = new
.iter()
.map(|val| {
val.iter()
.enumerate()
.map(|(i, v)| *v * 10_usize.pow(val.len() as u32 - i as u32 - 1))
.sum::<usize>()
})
.collect::<Vec<usize>>();
let sym = &data.symbols[i];
let val = sym.apply(&new);
total += val;
}
Ok(total as u64)
}
pub fn data(filepath: &str) -> Result<MultGrid, Report> {
let file = File::open(filepath)?;
let bufreader = BufReader::new(file);
let rangelist = MultGrid::try_from(bufreader.lines())?;
Ok(rangelist)
}
#[cfg(test)]
mod tests {
use super::*;
use criterion::Criterion;
use criterion_macro::criterion;
#[criterion]
fn bench_part1(b: &mut Criterion) {
let data = data("inputs/day06.txt").unwrap();
b.bench_function("day06-part1", |b| b.iter(|| part1(&data).unwrap()));
}
#[criterion]
fn bench_part2(b: &mut Criterion) {
let data = data("inputs/day06.txt").unwrap();
b.bench_function("day06-part2", |b| b.iter(|| part2(&data).unwrap()));
}
}

174
src/day07.rs Normal file
View File

@@ -0,0 +1,174 @@
use color_eyre::{
Report,
eyre::{ContextCompat, eyre},
};
use std::{
fmt::Display,
fs::File,
io::Read,
ops::{Div, Rem},
};
#[derive(Debug, Clone)]
pub enum BoardBit {
Source,
Split,
Beam,
Empty,
}
impl From<char> for BoardBit {
fn from(value: char) -> Self {
match value {
'.' => BoardBit::Empty,
'S' => BoardBit::Source,
'|' | '-' => BoardBit::Beam,
'^' => BoardBit::Split,
_ => BoardBit::Empty,
}
}
}
impl Display for BoardBit {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let c = match self {
BoardBit::Empty => '.',
BoardBit::Source => 'S',
BoardBit::Beam => '|',
BoardBit::Split => '^',
};
write!(f, "{}", c)
}
}
#[derive(Debug)]
pub struct Board {
data: Vec<BoardBit>,
width: usize,
height: usize,
}
impl TryFrom<&str> for Board {
type Error = Report;
fn try_from(value: &str) -> Result<Self, Self::Error> {
let mut lines = value.lines();
let mut width = None;
let mut height = 0;
let mut data = Vec::new();
for line in lines.by_ref() {
height += 1;
if width.is_none() {
width = Some(line.len());
} else if width.unwrap() != line.len() {
return Err(eyre!("Inconsistent line lengths in board"));
}
for c in line.chars() {
let bit = BoardBit::from(c);
data.push(bit);
}
}
Ok(Self {
height,
width: width.unwrap_or(0),
data,
})
}
}
impl Board {
fn get_row(&self, row: usize) -> Option<&[BoardBit]> {
if row >= self.height {
return None;
}
let start = row * self.width;
let end = start + self.width;
Some(&self.data[start..end])
}
}
pub fn part1(data: &Board) -> Result<u64, Report> {
let mut splits = 0;
let mut cur = data.get_row(0).context("Invalid row")?.to_vec();
let mut newdata = Vec::new();
newdata.extend(cur.clone());
for row in 1..data.height {
let line = data.get_row(row).context("Invalid row")?;
println!("Row {row}: {:?}", line);
let mut new_row = vec![BoardBit::Empty; data.width];
for col in 0..data.width {
let new = &new_row[col];
let prev = &cur[col];
let next = &line[col];
match (prev, next, new) {
(BoardBit::Source, BoardBit::Empty, _) => {
new_row[col] = BoardBit::Beam;
}
(BoardBit::Beam, BoardBit::Empty, _) => {
new_row[col] = BoardBit::Beam;
}
(BoardBit::Beam, BoardBit::Split, _) => {
splits += 1;
new_row[col] = BoardBit::Split;
if col > 0 {
new_row[col - 1] = BoardBit::Beam;
}
if col < data.width - 1 {
new_row[col + 1] = BoardBit::Beam;
}
}
_ => {}
}
}
println!(
"cur : {:?}",
cur.iter().map(|v| v.to_string()).collect::<String>()
);
println!(
"next: {:?}",
line.iter().map(|v| v.to_string()).collect::<String>()
);
println!(
"new : {:?}",
new_row.iter().map(|v| v.to_string()).collect::<String>()
);
newdata.extend(new_row.clone());
cur = new_row;
}
// pretty print
for row in 0..data.height {
let line = newdata.chunks(data.width).nth(row).context("Invalid row")?;
let line_str: String = line.iter().map(|v| v.to_string()).collect();
println!("{}", line_str);
}
Ok(splits)
}
pub fn part2(data: &Board) -> Result<u64, Report> {
Ok(0)
}
pub fn data(filepath: &str) -> Result<Board, Report> {
let mut file = File::open(filepath)?;
let mut string = String::new();
let _ = file.read_to_string(&mut string);
let board = Board::try_from(string.as_str())?;
Ok(board)
}
#[cfg(test)]
mod tests {
use super::*;
use criterion::Criterion;
use criterion_macro::criterion;
#[criterion]
fn bench_part1(b: &mut Criterion) {
let data = data("inputs/day07.txt").unwrap();
b.bench_function("day07-part1", |b| b.iter(|| part1(&data).unwrap()));
}
#[criterion]
fn bench_part2(b: &mut Criterion) {
let data = data("inputs/day07.txt").unwrap();
b.bench_function("day07-part2", |b| b.iter(|| part2(&data).unwrap()));
}
}

View File

@@ -4,3 +4,8 @@
extern crate test; extern crate test;
pub mod day01; pub mod day01;
pub mod day02; pub mod day02;
pub mod day03;
pub mod day04;
pub mod day05;
pub mod day06;
pub mod day07;