Compare commits

11 Commits

Author SHA1 Message Date
Josh Creek 83519eb8ee Remove redundant files from duplicate repo 2026-07-12 19:59:40 +01:00
Josh Creek 7054a23d8c Import AdventOfCode2018 JavaScript solutions
git-subtree-dir: AdventOfCode JS/2018
git-subtree-mainline: b44957b275
git-subtree-split: 5e9be1b66b
2026-07-12 19:58:48 +01:00
Josh Creek b44957b275 feat(2025-06): Add day 6 2025-12-06 16:47:21 +00:00
Josh Creek b1b634ac69 feat(2025-05): Add day 5 2025-12-05 14:28:31 +00:00
Josh Creek af8d99e953 feat(2025-04): Add day 4 2025-12-04 12:49:03 +00:00
Josh Creek 4eaa778adb feat(2025-03): Add day 3 2025-12-04 12:42:06 +00:00
Josh Creek 7367b9848d feat(2025-02): Add day 2 2025-12-04 12:41:29 +00:00
Josh Creek 7351c79e1e feat(2025-01): Add day 1 2025-12-01 17:49:57 +00:00
Josh Creek 5e9be1b66b Day 2 2018-12-03 10:03:32 +00:00
Josh Creek 8d7d4f20ac Day 01 2018-12-01 12:34:05 +00:00
Josh Creek a7c732314b Initial commit 2018-12-01 12:33:32 +00:00
37 changed files with 9126 additions and 5 deletions
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
@@ -0,0 +1,131 @@
using System.Text;
namespace AOC.Helpers;
public static class TwoDimensionalArrays
{
public static char[,] Make2DArrayFromStringArray(string[] stringArray)
{
int rows = stringArray.Length;
int cols = stringArray[0].Length;
char[,] array = new char[rows, cols];
for (int r = 0; r < rows; r++)
{
for (int c = 0; c < cols; c++)
{
array[r, c] = stringArray[r][c];
}
}
return array;
}
public static string TwoDimensionalArrayToString(char[,] array)
{
int rows = array.GetLength(0);
int cols = array.GetLength(1);
StringBuilder sb = new(rows * (cols + 1)); // performance optimisation
for (int r = 0; r < rows; r++)
{
for (int c = 0; c < cols; c++)
{
sb.Append(array[r, c]);
}
sb.AppendLine(); // end of row
}
return sb.ToString();
}
/// <summary>
/// Enumerates all cells in a 2D array, returning each cell's row index,
/// column index, and value.
/// </summary>
/// <typeparam name="T">The element type of the 2D array.</typeparam>
/// <param name="grid">The 2D array to enumerate.</param>
/// <returns>
/// An <see cref="IEnumerable{T}" /> of tuples containing the row index,
/// column index, and value of each cell in the array, iterated in row-major order.
/// </returns>
/// <example>
/// The following example prints every cell in a character grid:
/// <code>
/// char[,] grid = {
/// { 'A', 'B', 'C' },
/// { 'D', 'E', 'F' }
/// };
///
/// foreach (var (row, column, value) in Cells(grid))
/// {
/// Console.WriteLine($"[{row}, {column}] = {value}");
/// }
/// </code>
/// This produces:
/// <code>
/// [0, 0] = A
/// [0, 1] = B
/// [0, 2] = C
/// [1, 0] = D
/// [1, 1] = E
/// [1, 2] = F
/// </code>
/// </example>
public static IEnumerable<(int row, int column, T value)> Cells<T>(T[,] grid)
{
int rows = grid.GetLength(0);
int cols = grid.GetLength(1);
for (int r = 0; r < rows; r++)
{
for (int c = 0; c < cols; c++)
{
yield return (r, c, grid[r, c]);
}
}
}
public static List<(int row, int column)> CheckAllSurroundingCellsForCharacter(
char[,] array,
int startRow,
int startColumn,
char characterToCheckFor)
{
int totalRows = array.GetLength(0);
int totalColumns = array.GetLength(1);
List<(int row, int column)> results = new();
for (int rowOffset = -1; rowOffset <= 1; rowOffset++)
{
for (int colOffset = -1; colOffset <= 1; colOffset++)
{
// Skip the centre cell
if (rowOffset == 0 && colOffset == 0)
{
continue;
}
int row = startRow + rowOffset;
int column = startColumn + colOffset;
// Bounds check
if (row < 0 || row >= totalRows || column < 0 || column >= totalColumns)
{
continue;
}
if (array[row, column] == characterToCheckFor)
{
results.Add((row, column));
}
}
}
return results;
}
}
+22 -4
View File
@@ -20,6 +20,13 @@
</Content> </Content>
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Remove="Y2016\Data\**"/>
<Content Include="Y2016\Data\**">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup> <ItemGroup>
<None Remove="Y2021\Data\**"/> <None Remove="Y2021\Data\**"/>
<Content Include="Y2021\Data\**"> <Content Include="Y2021\Data\**">
@@ -48,12 +55,19 @@
</Content> </Content>
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Remove="Y2025\Data\**"/>
<Content Include="Y2025\Data\**">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Creek.HelpfulExtensions" Version="1.4.3"/> <PackageReference Include="Creek.HelpfulExtensions" Version="1.4.3"/>
<PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.0" /> <PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.0"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0"/>
<PackageReference Include="NUnit" Version="4.2.2" /> <PackageReference Include="NUnit" Version="4.2.2"/>
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" /> <PackageReference Include="NUnit3TestAdapter" Version="4.6.0"/>
<PackageReference Include="NUnit.Analyzers" Version="4.4.0"> <PackageReference Include="NUnit.Analyzers" Version="4.4.0">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
@@ -64,4 +78,8 @@
</PackageReference> </PackageReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AOC.Helpers\AOC.Helpers.csproj"/>
</ItemGroup>
</Project> </Project>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1 @@
4487-9581,755745207-755766099,954895848-955063124,4358832-4497315,15-47,1-12,9198808-9258771,657981-762275,6256098346-6256303872,142-282,13092529-13179528,96201296-96341879,19767340-19916378,2809036-2830862,335850-499986,172437-315144,764434-793133,910543-1082670,2142179-2279203,6649545-6713098,6464587849-6464677024,858399-904491,1328-4021,72798-159206,89777719-90005812,91891792-91938279,314-963,48-130,527903-594370,24240-60212
@@ -0,0 +1,200 @@
4732321333332463233337712234322122322247222252423773321362313613333336333732233372323328332333322777
1222244327222414232233422425356322526513215232625252222344534141424312492321632634253122343124442433
5112454424222122431441522442342425334525244254332453524214472412223221252222352512235352425214223422
2222227321754726673633524322456382771445438343537513235332426476332523246251452543731252361447292252
5754818635363378216255676242211353265462243358231497363334444343516236326731322232642636742327379332
3122221222112312312232222262521312223131232212392237234221112213215321242221222223122722223242231132
3332221732222313632231112123312334132423312333223376521312228322222132232231322233613312223323133232
1562433324432523322122322243553245224632262522233262336333252143334323134333211324443413323134412552
4255434822454224334142213155342224334322213323412268213334131242152243542224222242475232221223422322
8678575554446875757776855398756854855887628657665566385684847784545935875964615788576788674444588668
2224132122282231232225222122213512115222212242223112232222423212262221252215213222224122242222522212
6526643435244533412553645532433133432515342223625213345252545334225321221733354423152716334415342425
2422232382217254223228342222122345525213271313333542273324232313233312223721222223231521342942232232
3353245432332434653526334135283437653612538722536244512718328332636432532363993842768352552662374632
4445544245563555645464242235261443573553343522346445663441531676424463555542134364566541335553566255
2121222322122122263322222225421233422333333332456223223233212322332322122141232523222223222321222232
2126212253329254635558385225472857739325164231817544393536578564312324625232214378474322225725423441
2123353122333123714232361322328123442363463333212313343334321323323112331331232312232221382323233232
3131368823833449735734334333323733877433354536323339223583363323933323933413574323326226433337332433
3213333245224323443312343553424939131335233338333333755853423243143431833423315351335433233333333238
7428582265464324456565545476566475834674654524656556444874577644353495333568424145575577567475756448
2222212314222522222251223222232223231532232324232434222222332325232212212522222223223443122222225231
3646777147644343726752461442575516626273263545145133652253626612146272256665626215251253757256421689
3233636544444446365835318437242149432664227534423332724245831254634541356541425386444238663343644568
2626131233311235224362232283232222232341542313121332222222222214464225312332223223227224222213241124
2342232222222214152232222224221223243422223222123232211252232222143232522222425222112324243212522241
5223523122235531212131255451225311211222322212222412225235245252253522222522323232222252222232221342
2434558564634395323523668542166352613356634145635539323652356243365573226645622655241255236423386645
3246323332432323362662243653345212136425361214333333443444355443412724214343632563343444613556623494
4314343313542133234424232223363444223434329532472445124323523421424424547434474243142423322334253224
3243322122223232193522322262412126226212232312422232492211222462622726224216232224122252225412422622
4692122337347366522743247423479136323627444322264583343323279223534151321891338439253232133233833433
4887744333634237235428432147323643363834343345343847584452833344342563333341843436334235334352243433
2422232226272222228223325222211211232122226222227223222228216222236221224222222222222222121222312332
2222233323342314431233322342441322836354133332734424341332333116333812233232322263333233124534333331
5222788637488468742821113311811282485343523432635171658865441165351581662877364375112314214723672789
2222222124312225212223432222112224222232152323212222221112141322252312522222222211342222122241242222
4243114451415313353435125545515144443433434442213544131515142455112345521545453533332354531111136789
5843467592274257353374456452155724325669576246377278276659622845624325436328348833527744563746754641
2222259123512522312214921231532232322232224127522222232242221223223141112183352252232127224125258241
2222422442222472563374132132322215814322223432253628874424241236321232222124112433321321524432322222
2245652224625327454433225415655544657345852466435224342224467632733474524164372452433553453942254444
4422324232524322233344223134262424322233222322134232223322224324232223434212428334124414821212231241
2222332535433222233124211253373332112333233323363323225433223623232322122743242232422123333222233221
3534462525244147242127486635122994794356565942441364344912324464425244344454185354331215423444321944
2326221221622225212222226222112262222244323211215722212231212222222122221231222452224322451242326282
3222222221421222225122242324237212222122323282422222132213323325412262247222312222121221241222255123
6445643428334434684595356662367623443653347433543625323442666484346838263633633336363438455435644646
2222322222322248135241223242122262521212422222142222133221212221234312112421222227122212121512222242
4222435622542233343136345356552656555383542243352546614156425226584625249254563392322415542535343336
8222352522155122244322533331223331222322123124352313342224312223421272542217836112271223642222223335
3333233341223352232324223332243332232223123121332332212362232333323333234341232511326333323224323221
2353835343546235595452382332557432422337443235445273463222355331472354233234423245335424133374533212
7223433159252522833142256916331255245293264212625428522253122924872432311134354342525242492252222242
5232232522252231125122226122233113232231252233223641541631215212343221221632222222231221227311226262
2334342443621356343554443433434444434324364432446252962453464534284533224232223424442464433312447441
2123123222232321231312122331133212323212333133422232213223226222321213214222234322232232333412322532
2282435442242712422433222324332554624422424343424232223241222224426423434434123224423221532323342324
2332833482433244234214424121232337245343323552363444735525331562321232324327435343231362943327532243
3312633453365222213463336413341133223832584333839433322242335242233232233134639236278233733322322413
4434354462644346726443434433444644844454443444434445344434344644377374744424444573442634444464244343
6546655458648617453767556565456556625656765554554553665466564566555665559665663554665656455762776355
4233233243423333353444434333623333332324243232224332332333323333333633326323335324311534223231333334
5555252624567454443851761565335647357555775646243272247675775433533574744267334443452473875513273365
2222322232123222222322222313222312112323331233222242222222223313333321222422222222123342131232312223
4657359479696267347988365896386968946577577344287676553884967398484935768547252598895578378534998364
3455553444441544244545433324444533454347344445545545133255344444534444444445464474444443545374454555
2412222252411424552422341634233532224542252223232322444813278521942123134334424242435333422144423428
2345373524424323423323433433621233344114454253313143343542343333234454312333324133342324223334333323
3566444345435276745556346362675666762452357334758645645334746536388533474337466654353675567764745447
6242668527333662342437226565464123631553211346522724536324734224535622328315462444362344574544275214
3123135233413373132544334333443223241344443343535433433436334233332425352324436333332343533253442343
7384341464429224343613224263436443655675643282324424342445336875233444354494159464431427427883244346
1222241413323777541221232413222528222232224422228126243524312123125221242222412123261232442225355133
6524462231447446648643632477656934236456263447246438663814323367374454583763444536425144324433435446
3675141354533345467429451444221372276463534725169652345373543554414355522329472258628514542752523331
3322113343342347334226333331233322233322223353223333342331332323312334253322331321323243363132432122
3427443236332532433343444434533322233433554264223331431543343343413433349354324333434423332434353135
4234244334238444545314542384544543453444433446544323274325426444445313333544434224523523346453444645
2222322125522322221231117522132222222226262112123152222225313421332316522222522222612711222231232322
4373244343324412211419323233317344233233287433214434133344424937434322143333333444452433343432432443
2243233123232552322232312223221352132412322221222211242232312222223221222332222225332222221222223215
2632939467352846351638133147257252182769228242786372413947911532451365719782232172782952317612327226
2423232448243543241134222422324213524125322212231432323322224333442233145222214331332211245442333234
1222232225272192223322212323242232292212233412232232422133322324222234223243222213122222522423223322
2343721275325233235266362122272322312261333217225252242693262211621233219345326221256917333338332226
3342324323433229332241632532233433412335243133633243433433334345343333332423225423233242332934832733
2142334223312215122122222422332322422225513344221232224214236222224352452225222222322223423265266255
3357423522323354343343443243233345232321243213352323355233244344221243234345455532423634354242523452
3562535624277486333766569865823654572645335888558422374966565756574679546679682782966673368665379376
5455261928432623556643633452545326345552231235554456325323263129263324336453237385244543625313253252
3924243834384546876134323432342635622268337652433544336344375234743636266633437452142822714382734333
3312323223322532233112233232232323212134132431322333323223222234356222121223212221253323422433322333
8652266576356673894668436444857865327564246444765556614249162223855244496683772353778573256418546378
5677577637466886474774758876877687777847786765777787865565568567857767694876656547978786667877768775
5234242233562342263222341622334215244624252125212122262342223423311612312222422232324332152553322232
1132222225431542224412222241224254332141224222222282222212222272224226224213122422221722212413226222
5454445535517545534865344234544656555743454352444454327345344445556245534413354163345475355455454354
5657376536525456473666445653735563237565577785686435474664667557673358634595676376766756355367565446
3123525231632826812432382692321232221161882287193231592316124222612257222422121612227622877312591242
2568786637651743665444476746616777665626777476695467277866858373833778676736555635755166827346364447
3332222221222221232322533221223331232223332123226432221232323222322334224211231322333222223332231323
2412212222242212122122222322222322242221213222222222122146212122422222212232221282223222242332112131
6235735426644856559652142347976635675933592344563394354674467588698523446243925555558754325665477633
3312132332234333222223222242332212223335133211321332233641432343322222223323232242221322113233232324
3444534253513472333445345473444953344514313442555254335355352356556754433364554223424442944534445237
3433644957372433543233332124344323247554341343632345342333523333512433214433345343533543543434734414
4793744343324444432444444443333445243545352443444725344235455443554334244443353543225444536434245545
3937239521428685444227339433953534233141473546642164452472124141322224422325453644542292342548242357
3343323333524333342432333353333313236425333333333333422324342433333333333433233312333433333233332342
3364634363522223545214343425245636536233733554535354544335453364444365354342373646534843536546453344
5675834444647557475535644645343657564564453655556222547734742535457335272566454362566624485654433645
5473331141524543453445534452353743553445436444445472995544544453455444434555465433347554446844474564
3329327624226333643333323439323323333323233133372317324243337333343333713122344753335232832242733233
3112222211232222212222223231212323223941142244211221222112221325232221522222222312222232212331322232
3442344313423435376433465242534624274343135233525322344442243323423345443244452442225443153432233422
4355426635443435534224643447454323742653544653433234445425644335434423333235432534434454352234333351
2422352426524322623552342243141313327452622332223326322553312522313124241326244322261334213453224322
1423242155262225227324262325421623532351233672453522435264264432133442226612233222322362152214824255
3367323434454344934754244344343432444424444444427445447244534545635534442444773444333443453434344742
2221234232222223132214232221123322224222322211323231512133121212222224222312322212522231222322243222
4335373647636343328328313583532423873243867252987923837998452568562352819846868642472346583831337534
3212216232222222233231225212322233234223312222222233222522231221211222122221221223232422252122222221
3343129344535341451549574555642459325862427474432233234448424844829447274255525924261655385214174332
2233322232333333222522324322323133233432122213222223233333432323222323242213243221322236371233424363
3322432123333443232453423343332344333132343333222434323442334341323233343254334533333332425323233332
2222332222123223222432212221921242233121322223213122232232222122221211222324323212223232334223223222
5476943144284333444463363642648385668255456383323343627647368546365463192887464237228341642316352668
3224222222322225221234252322237322222222221222222222222123121231422122312222222213222332222213222122
5252322245521725414445421322423253422153534356314626235163442232613424532253128342133515234123422433
4234323443446346432733442446336544343344335444344334445343444436494444443244442253444447373434333443
2141262224323265112441324216242252521222222225232311323244172424741324342151572122345212412225432121
3412242522323111214224312111332322422241221222522326322212322224122222232322122323212241251372322222
2223132433424343313712271322134426145243224474247562332242923722223222131456522344715232238292212344
4525355533883454455624474543533325545554235557555455444355555532642553333456633345533348564254353455
8336523253324433242262433332246348126252355463933744214343443457247241514444728542364342322384222539
5243328322334341352752235533332222235345533342432466753133413334242535522669342643534134336313346423
7324284323326322224732753123216433825532575393422722222123712553553434278344224226231174222344362359
4333334442342313455254823224422442342535242433247243447824433344222442443334544354244334232323443352
2226222342224223212242323252162241441244321237422342123637423222233223246121262232432323224232513343
2434345354473624553564254535254325353633554245724443572332444114434652534342132541542355331345231335
3323363133333324523321834423473333351332343373333332323339331333333333333352333223424333337332232433
2333241223227232322142231224233321142333333222233332231631324333232332225432313333337221333313343944
4864849444344444463544414454448714234464443442684644248134442464383321554474332445734333263344324453
4375477674324573444535944664444436332634698624458394543647444264433443344343454574816453635344447274
3665421144321123544141351554263654155434561423324244221452634443142146236362451561164554543363156789
2222235242221222124222212212591426323153242321553222255233212232322253317227233322448312522216438314
1632321713222319334425135242222272222112213226227256252242252227316226222516423247112234423232223642
6343265635425336234215526533274434542122553342434444436425442446434354443234368225343453322341544444
1342135221225262312237244341631224122122283223282364425333379422244237726727244323642276243977485216
3373423232555135132533323242373242222314233212283433624359364332234738234423333523435234453223325335
3433234223443634144443344533434452335423334334444423333332624515333333334343434563943244424414335354
3322222221232222334333333325323222343122232242542233223232241422313233433153333434237232322342132321
2222332223322232333224333223121132313221232422222222222212225222232232222243113222612223233332222223
2122142123132233423223312226122232221222422322332222224123244132414143233233122212131122225222222221
3491468222656522466464458427633546486345845858434546264336774542625434433455464868564585466667543447
2232223515136226132332363222122323123213222272233222223322223122173323432152322421231272222222412212
2124422373263172465527332322334272434722223324322423232443222522333514427232361566232214222363425423
4926212326223244133214322625522512234546132442322221132221222212292222122316228311282219224516337422
3172436133532523223323263343223333334343272363334523434632372533333233333334332432332333513452361431
2314333231433353224324233233343333333132355332233425422323323334332233353334332222451223322343322532
2238282342664335323323563343367933332121429282113433373232363254883626333232248323125331333273523263
3535333445243454525444632444543353383443447334413754374525641444244443744754454143453446443335444113
3286642252546522276312261291442323242572612322262622316446281235796361722543226724352667742222153142
3322222222322322232223222212332244122131222142112224221221222222221221122212224122223211112222122221
6536433935656547324435722744153896347628253332444764763653443337232536613957673783698176258557499798
4161243323324331454434436234334252234321534224452231243422424134334452322234342344233234454453244355
2352224822222142322426252252232352482292322213242534352242323332535212223172233222382217223233211222
2344223231232353662352322533442433673553364321354333667252432273344225442235283257253342122331326742
7342854144533266774375361646529354662171236587535533346665633533836753562179777333695275556427457133
1344421124131424224444322443141411414421321333134222212123142323421133234223343112411122223343356789
3223424335333332122221132325332126243326223422232231333313322232165232731335135322231223323232454252
3433355463225785636933551524433444435342353223445454172533484613433343232532334513253466335443322245
5536554877516385564536554167465658566633635644666763545656452444556539389635554556555855585166435565
3335333652134533436333214533343551326544534632345323453432352835543413665513232335565444352333522554
3422223723234342351343712222352622232723262737672627333324243255654333132223322533355434223327227774
3143332124223643541431423431323623433332243334323323324625233312432252423435643544233333343425333344
4221222332231337144225243156445333464313458434544433733333454361714222213543442527232323334122534421
5221222142122222412212214322422222221222411222222222232212222222122116122221212222122412222522222221
2245222247523533241252214434753542963322325363122213431342163161523223334612331423422533226225143443
5735554474649633451276355765346221734216262367474437725274736737384713648348447634743572248325689647
3752551534532564542324553435665753674752753667733343483753723547554345743547567752436345453542633326
1231323243432232173323355425232233652362223323122331255233241325213285322322223952521393335333322224
5671437515421453643424345633946652754634266452436645886533543663665456449717634643462879244371456483
3374374725466446443332533434434332623344443533233489372445343934734744345644733326374375354243834144
6335545576444644365644434663464334845557544546644336633464353535644455446555725444416575666564378445
5325315521327436223375453158334251743323243453636391363443334333343533334435234334524532332693731211
4456548447344384456273344734417544464442414355334565445457544498444243446563464343244244546436543466
2331333353221533423333123123833231313333124432323333323333332322235231164433933323325333333433332253
4334552334217274425228246245622644222346752335842415132523454546524623133246474425242253232424433564
2233344236323465473463223433434332373428433243323243323532333325833232433184222323413342554333363637
2223124225232434223535344324332243332624242142441222254444332234344252556322231244424423444344112242
3547445521453423449433237464344236444224266335375553336636432356753435435444374265744217644363545743
3335333425534633332363212642233557635225334523332656632433635375333523515353334353343132533332643413
2222223222322132324232242213223322223233323122422231433232233323112123242233333241122322222214323353
6999989789859986898999698988899978888978599996857879997869999878799989798999597847657999979799999899
2322122222223312322243223524212436422223222322524322213212222222332522122222222241222122532211223223
2433357222243333342331362234353922351434336324343532422433783335242533533523545423453425231332335273
2223221192222222232211122524435121222222333222432222225131522221211212222211122231221212621222212222
1134811242122424411334442222265224132222242222432232222224432122234121222133252243242322322344232212
@@ -0,0 +1,139 @@
..@..@..@..@..@@..@@@@@@.@.@@@@.@.@@@..@.@@@.@@@.@@@.@@@.@.@.@@..@@@@@@@@@@.@@@..@@.@@@@..@@.@.@@..@@@@@@@@...@.@@.@@.@@@@.@@.@@......@@.@@
@@@@@@@@@@@..@.@@@@.@...@@.@@@.@@@@@@@@.@.@@...@@..@@..@@..@.@..@.@.@@..@.@@@@@@@@@@@.@@@@@@.@@.....@@@@..@@.@..@@@@@@@@.@.@.@@@...@@@.@@@@
.@@@.@@..@@@@.@.@..@@.....@....@@@@.@@@.@...@.@@.@.@@@@@@@@@@@@@@..@@@@@.@@@.@.@@...@@.@@.@@@@@..@..@@@@@@..@@@@...@@@.@.@@..@.@@@@.@.@@.@@
@...@@@.@@.@@@.@@@@.@@@.@@.@@@@@@@@@@@@@@.@@@..@@@@.@@@..@@@.@.@@.@.@.@@@..@@@@@@.@.@.@.@.@@@@@@@@@@@.@@@@.@...@@@@@@@@@@@.@@...@@@@@@@@...
@@@@.@.@@@.@..@.@@@@@@@@@@@@@@.@..@@@..@@@.@.@.@@@...@@@@@..@.@.@.@@@..@.@@...@..@.@....@@@@@.@..@@@.@@@@@@@@.@@.@@@.@..@.@@@@@@@@.@@.@@@..
@.@@.@@@@@@@@@@.@..@...@@@.@@@@@@.@.@@@@@.@@@.@@@...@..@.@.@.@@@@.@@.@.@@@@@@@..@@...@@@@@@@.@.@@@@.@@.@@..@@.@..@@.@@@.@@@@@.@@@..@@.@..@@
@.@@@...@.@@@@@..@@@@@@..@.....@@.@.@@@@...@@@.@@@.@@@@.@@@@@@@@@..@@@@@@..@@@@@..@@@@.@@@@@..@@.@...@..@@@..@@@.@@@.@@@.@.@..@@@.@@@@@@@.@
@@@@...@@.@@.@@@@@@....@@@@.@@.@@@@.@@.@@..@@@@@@.@.@@@.@..@@@@@@.@@@..@@@@@.@@@@..@..@.@@@.@@@..@@@.@@@@.@@@.@.....@@..@@@@.@..@.@@@@@@.@@
.......@@@@@@.@@@.@@@@@..@@.@@.@@.@@.@@@@.@@@@@..@@.@@@.@@.@.@@@.@@@@@.@@@.@@@..@.@.@@@@@@@.@@@.@@@@@@@.@@@@@@@.@@..@@@.@@.@@@.@@@@.@@@.@@@
..@..@.@@.@.@@@.@..@...@@@.@@@@@@.@@@.@@..@.@@.@@.@@@@@.@@@...@@@@@@@@@..@@@@.@.@.@...@@@@@@@..@@@.@@@@@@@.@@@@.@@@@.@@@@..@..@@.@.@.@@.@..
.@@@.@@@@@@@@@@@...@.@..@@@@@.@@@@@@@@@@@@.@.@@@..@@@@.@@@@.@.@@.@....@@@.@@..@@.@@..@@@...@@@.@@..@@.@@.@@.@@@@.@.@@.@@@.@@.@@..@.@..@...@
@@.@@@@@@@@@.@..@@.@..@@@@.@@.@@.@@...@.@......@@@@@@.@.@.@@@@@@@@..@...@.@@@.@@.@...@@..@.@@..@@.@.@.@@@.@..@@.@@.@@...@@...@.@@.@@@.@@@@@
@@@.@.@@@@@@.@@@@@@.@@@@.@..@..@@.@.@@@@.@@..@...@@@@@.@@@@@.@.....@...@@@@@.@@@.@@@.....@...@@@@.@.@@.@@.@@..@@.@@..@.@.@.@@@@@@@@...@@@.@
@..@@@@@@.@@@@@@@.@@@@@.@...@@@.@@.@.@@.@.@@@.@@.@.@@.@.@@..@@@@.@.....@@@.@.@@.@@..@@@@.@@@@@@@@@@@@.@.@.@..@@.@@@@.@@.@..@@.@@@@.@@@@.@.@
.@@@.@....@@.@@...@@..@@.@@@@@@.@@.@..@.@.......@.@@@@@.@.@@@@.@@...@@..@@@..@.@@@.@..@.@@@@@@..@@.@@@@@@@@@.@@..@@@.@@@@@..@@.@@..@.@@@@..
@@@@@....@.@.@.@@@@..@@@..@.@@@@.@.@@@@@@@@@...@@..@...@@@@@@@@.@.@@.@@.@@@@@@@.@.@@@@@@@@@@@.@..@@@@@.@.@@@.@@@@..@@..@..@@@@@.@@@@@...@@.
@..@@@.@@.@...@.@.@@@@@.@@....@@.@@@@..@...@.@@.@@@..@@.@@.@@@.@@@.@.@.@@@@@.@@@@@@@@.@@@@@@.@@.@..@@@@@@...@@@.@@@.@@@@.@.@.@@..@@@@@@..@.
@@@@@@@@@@@..@@.@...@.@@@@@@@.@.@.@@....@@@@.@.@@..@@..@@.@@@..@.@@@.@@.@.@@@@@.@@.@@@.@.@@.@.@@@@@.@@@...@@...@@.@@@.@.@@@.@.@@.@@.@.@@@.@
@.@@@@@..@@@@@@@@.@..@.@.@@@.@..@@.@@.@@@.@....@...@@@..@.@.@.@.@@@..@@@@.@.@@@@@@.@@.@..@@.@@@..@@.@.@@.@.@@@@.@@@@@@.@@....@.@@.@@@@.@@.@
@..@.@.@@@@@@@.@@@@@@@..@@@@.@@....@..@...@...@@.@@..@@@.@@@@..@@@@@@.@@@..@@@@@@@@@.@@@..@@@@@@@@@@@@@@@.@@@.@@.@@@@@@@..@@.@@...@@.@@.@.@
.@@.@..@@@@...@@..@@@@@..@@@@@@@.@...@@@...@@@....@..@@.@@@@@@....@@@@..@@.@.@@..@@@.@@@.@@@.@..@@..@.@@.@.@@@@.@.@.@@@@.@@.@....@..@@@.@@.
.@@@@@@.@@..@...@.@@.@@@@@@@@@@..@@@.@..@.@..@@.@.@@.@@@@..@@@@@@@....@@.@@.@@.@@@@.@.@.@@@@@@@@..@@.@@@.@@.@@@@..@@.@@.......@@@@@@..@@.@.
.@.@@@.@.@@@@@@@.@@@@@@@@@@@@..@@@@@..@.@@@@@@..@@.@.@.@@.@.@.@.@@@...@@.@@@@.@@.@.@@..@.@@@..@@@.@..@.@.@.@@@.@.@@@..@@..@@..@@@..@@@..@..
@@@@@..@@@.@@@@@@@@.@....@.@@.@@@@..@..@.@.@@@..@.@@@@@.@..@.@@@..@.@@@.@@.@.@@@.@..@@...@@@@@...@@@@@@.@@@@@@@.@@@@@@.@@.@@@@.@...@@..@@.@
@@.@.@@...@@@@@@@....@.@.@@.@@.@.@@@..@.@@@.@@.@...@@@.@..@@@@@@@@@@...@.@.@.@@@@..@@.@@.@@@@@@@@@.....@.@@@..@@@@.@@..@@..@.@...@.@@@.@.@@
@@@@@.@@@@@@.@@...@@@@@.@@@@@.@@...@.@@@@@@@.@..@@@.@.@.@@@@@...@..@..@.@.@.@@@..@.@@@@@..@@.@@.@..@@.@.@..@.@@@@@@@@@.@.@@@@..@@@@@@@@@..@
.@@.@@@@@@@@@@@@@@@@...@.@@@@.@@@@@@@@...@@@@@.@.@.@@@@.@@.@.@@@@....@@@@@...@@@.@@@.@@.@@@.@@.@@@@@@.@@@@@.@@..@@@..@@@@@@@..@@@@.@..@...@
@@.@@@@@@@.@.@@@@@@@.@@.@...@.@.@@@..@.@@..@@@@@@@@....@.@...@.@@@@@@.@@@..@.@@.@@@.@@@.@@@.@@@@@@@@.@@.@@@@@@@@@..@...@@@.@@@@@@@@@@@@@@@@
@@.@@@.@@@.@@.@@.@..@.@.@@@.@..@.@@@@@@.@@@@@@..@@.@@@.@@@@@@@.@@@.@.@..@..@.@@....@@.@.@@@...@@..@@..@..@@@@@@@@.@.@@@@@....@...@.@@.@@@@@
.@..@.@@@@@@@@.@.@@@@..@@@@.@@.@@@.@@@@@..@@@.@@..@@@@...@..@@@@.@@.@..@..@@@.@.@...@.@@.@@@@@..@@@@@@.@@.@@.@.@@.@@@.....@...@...@@.@@@@.@
@...@@.@@.@@@@@@@@@@@@.@.@@@....@@@@..@...@@@@..@@.@@@@.@.@@@@@@.@.@.@..@.@.@.@@@...@.@@.@@@@@..@@@..@@.@.@@.@@@.@...@.@@.@@@@@@...@@..@@@@
@.@@.@..@...@..@@@@.@@@@@@@@@.@....@.@.@@.@@@@.@@@@@@.@@.....@@@@@@@@@...@@......@@@.@@@.@.@@.@@@@@..@@@@@.@@@@..@@.@.@.@...@@..@...@..@@@@
@@.@.@@.@@@@@.@@@.@@@@@.@@.@.@@..@..@.@@@@.@.@....@..@@..@@@@.@@@@.@@@@@.@.@@@@...@@@..@@@..@@@@@@..@@@.@@@.@.@@@.@.@@@@@@...@.@.@@@@@@..@.
.@.@@@.@.@.@@...@@@@@@@@@..@.@@.@@@..@@@@@.@.@@@.@...@..@...@..@@@.@..@@@@@@..@@.@@@.@@@@@@@@@.@@@@@@@@@..@@@@@...@@.@.@@.@@.@.@@@..@..@.@@
@@@@..@@.@.....@@@@@@.@@@@...@.@@@@@@...@@@.@@..@.@@...@@@@@@@@@@.@..@@.@@@@.@@.@@@.@@@@@@.@.@.@@..@@@.@.@@.@@@@@@@@.@@@..@@@@@@@.@@.@@.@@@
@@..@@@@..@@.@@@..@@.@@.@@@@@...@@.@..@@@@..@@.@@@.@..@@.@@.@..@@@.@@@@@.@@.@.@@@@@.@@.@@..@@@@..@@..@@@@@.@@@@@@@@@@.......@.@@@@@@..@@@@.
@.@@@@.@@@@@.@@@@.@@.@@@@..@.@..@@@@@@@@.@@.@@.@@@.@@@@@.@@@.@@@@..@.@.@@@@..@.@...@.@.@@@@@@@.@...@@.@@@..@@.@@..@.@@@@@@.@..@@@@@@.@@@@.@
.@@@..@@@@.@@.@...@...@.@@@....@...@.@@@@@@@@@.@@.....@@..@@@@@@..@@.@...@@.@@....@@@@.@@@.@.@.@@.@@@@@@@@.@.@@@@@.@@@.@@@.@@.@@@@..@@@@@.@
@.......@.@@@@@@..@@@@@@.@@@@.@.@@@@..@.@@@@@@@.@@@.@@@@@.@.@@@@@..@@@@.@.@@.@@.@@@@@.@@@.@.@.@.@.@@@.@.@.@@..@.@@@..@@@@..@@@@.@.@@@..@...
@.@@@@@@@..@@..@@@@@@.@.@@..@.@...@@...@.@...@@@..@..@@@.@..@@@@@.@@@@@@@..@@@@@@@..@@.@@@..@..@.@@@@@..@@@.@@@@@..@@@@@@@@.@@.@@....@@..@@
...@@@@@@@.@.@..@@@@@@..@@@@@.@.@@@.@@.@@@@@@@@@..@@@.@@@.@@...@@@@@@@@.@@@..@@.@.@.@@@..@@@.@.@.@@.@...@.@@@@@@@@..@@@..@@@@@@.@@@@@@...@@
@..@.@@@.@....@@@@..@@..@.@@.@@.@...@@..@@@@..@@@.@@..@..@.@@@@@@@.@.@@....@@...@@@.@.@@@.@@@@@@@@.@@@..@.@@@.@@@@.@@@@@.@@@@@..@@..@@@@@@@
.@@.@@@@@@@@@@.@@@.@@..@@@@@@@@@..@@@..@@@@...@@@.@@@@@@@..@@@@@@.@@@.@@@....@@@@.@@@@...@..@@.@@.@@@@@@@@..@.@@@@@@@@@@@@.....@.@@.@@@..@.
@@@@@@..@.@@.@.@.@.@...@..@@@@.@.@.@@@..@@@@@@@@@@@.@@@@@@@@@..@.@.@@@.@@.@@.....@@..@@@..@.@.@@..@@@@@.@@@..@@@@@@.@@....@@.@@.@@.@@.@...@
@.@@..@.@@@@@@@@@..@@@@.@@@@@.@@.@@@..@.@@...@...@@@@@@.@@@@@@@@@.@..@@@@.@@@@...@@@@@@@@.@.@@..@@@@.@@@@@@.@.@@@..@@..@.@@@@@.@@@@.@@@@@@@
@.@@.@..@.@..@@@.@..@@@..@.@@@@@.@@.@.@.@@@.@...@@@@.@@@@@@@...@@@.@...@.@@@@@@@@@.@.@@@@@@@.@..@@.@@@@.@.@@..@@@@@@@.@.@@@@@......@@@@@@@.
@@@@@..@.@@@.@@.@..@.@..@@.@@@.....@.@@..@@.@@@@@@@@@@@@.@......@@@@..@.@@@@.@..@.@..@@@@@@.@@.@@@@.@@.@.@@..@@@@..@@@@@@@.@@..@.@@@.@@@...
..@.@..@@@@.@..@.@@@@@..@@@@@@@@@@@@.@.@.@@.@@@...@@@..@@...@@@@@..@.@@@@@@@@..@.@..@@@@@@@.@@@.@@..@.@@@.@....@@@@@@@.@@@@@..@@..@@@@@.@@.
..@..@..@.@@@@.@..@@@@.@.@@.@.@@@@....@@.@@.@.@@.@@@.@@....@@@..@.@@.@@.@..@@@@.@@@@@@.@..@....@..@@@@@@@.@..@..@@@.@.@@..@@@@@..@..@.@...@
@@@.@@@@@@@@@@..@....@.@@..@@@.@..@@@.@@@@@.@.@@.@@@.@.@@@..@@.@@@@..@@@@..@@@.@@..@@@@@@@.@@.@@@@@.@@@@@@@@....@.@@.@.@.@@@....@@@@@@@.@@.
@@@.@@@@@@@@.@@@@@.@.@.@@.@@@@@@@@@@@@@...@@@.@@...@@..@..@@..@@.@@..@.@@@@@.@@@@@@.....@.@@.@........@@@@@.@.@@@@@@@@@@.@@@...@..@@...@..@
@@...@@@.@...@@..@.@.@@.@.@...@@.@@...@@@@.@@@@.@..@..@.@.@..@@.@@@@@.@@.@.@.@@..@.@@@@.@.@..@@@@@..@..@.@@.@@@@@@...@@@@@@...@@..@@@.@.@@.
@@@@@@@@@....@..@@@..@@..@@.@@.@@@.@.@.@@@@@@@@@.@..@@@@..@.@@....@.@@@.@@@.@..@@@@@..@@@.@@@@....@@.@@.@.@@@.@@.@@@@.@..@.@@..@@@@@@..@@@@
.@.@.@.@..@.@@...@@@.@@@.@@@@@@@@@@@..@@@@@.@@@@.@@@@.@.@..@@.@@@@.@.@.@....@..@@@.@..@@.@@.@@.@@.@@.@@@.@.@@.@@.@@..@@@....@@.@.@@@@.@.@@.
@..@..@..@@@@@..@@.@..@@...@.@@.@.@@.@@@@@.@@@@@.@.@.@@@..@@.@..@@@..@@@@.@@@.@@.@@@@.@...@@@@@@..@@@..@..@@@.@@..@@..@@@@@@@@@.@@.@@@@@@..
@@@@.@@.@@@@@@@...@@@@@@@.@.@@.@@@.@@@.@@.@@@@...@@@@@@@.@.@@.@.@.@@@@@@.@@@@.@..@@@@@@.@@.@@@@@...@.@@@.@@.@@@@@@.@.@@.@@.@@@@@@@.@@@@@.@@
@@@@@@@....@@.@@@@@.@@@.@@..@..@.@.@@..@.@@@@..@@@@...@.@@@.@.@.@.@@@..@..@.@@.@@@@@@..@@@@@@@@@@.@@.@@@..@@@.@@.@@@@@@@@@@@@@@.@@@.@@.@@@@
@@@@@@.@..@..@@@.@.@.@@@..@@@.@@@@@..@@@@.@..@.@@.@.@@@@@..@@@.........@..@..@@@..@@@.@@@.@@@.@.@@..@.@.@@@@@@.@..@@@.@.@....@@@..@...@..@@
@@@@..@.@@@@@@.@.@@@@@@.@@@@@@@.@@..@@.@.@@.@@....@@@@@..@@@@@@@.@.@@@@@.@@.@@@.@@@@.@@@.@@.@.@@@.@.@@.@@...@@@@.@..@.@@@.@.@...@@@@@..@@@@
@@.@@@@@@@..@@@@.@@@@@@.@@@.@@@@.@.@.@.@@..@@@@@.@@@@@@@.@@.@.@@@..@..@.@@@@@@@@@@.@..@.@.@@@@@@.@@@@.@@@.@..@@@@@..@@@.@@@@...@@.@..@.@.@@
@@.@@..@@.@.@@@@@@..@@.@.@@@.@@@@@@..@@@@..@@@@.@@@@@@.@@@@.@@......@@@@@.@@.@.@@.@.@@.@.@....@.@@@@@@@@@@@@@@@@@@@.@.@@.@@..@@@...@.@...@@
@.@@.@.@.@.@.@@....@@@@@@@@...@.@.@@@@..@.@@.@@@@@.@@@..@@@@@@@....@@.@@@@@@@.@@@.@@.@@.@@.@@@@@@@.@@@@.@@@.@@@@...@@@@@.@.@.@.@@.@@@.@@@..
..@@@...@@.@@@...@@.@@.@@.@@..@@.@@@@@@.@@@@@@@@.@@@@@@@.@@@@@@@@@@@@@@@@@@@.@@@.@..@..@@@.@@.@@@@@@.@..@@@@.@@@@@..@@@...@.@@@.@@.@.@.@..@
@.@@@....@@@@@@@.@@.@@.@.@@..@.@@@@.@@@@@@@@@@@@@@@.@@..@@.@@@@@.@....@@@@.@@@@@@@@@.@@@@@@@@@..@.@@..@.@.@.@..@@..@@@@@..@.@.@@@@@@.@@@@@.
@..@@.@@@@@@@..@@@.@@.@@@.@.@@@.@@@@@@@@@@@@...@...@@@@@@.@....@..@.@@@@@@.@..@@@@@@@@...@..@@.@@@..@@@.@.@.@@@@...@@@.@@@...@@..@...@.@@@@
.@@..@..@@.@@@.@.@.@.@@.@@@.@@.@@@..@..@@.@@@.@.@@@@@.@@.@@@@@@.@@.@.@@..@.@.@.@@...@@@.@@.@.@.@.@@@@.@@@@@@@..@@@@@@@.@@@@@@..@.@@..@@.@@@
...@..@@@@@@.@@@..@@@@.@@.@@@...@@@@@.@@@@...@@@@@@@@@@@.@..@@@@@.@@@@@@@@@@@@.@@.@@@..@@.@@@@@.@..@@.@.@@@@@@.@.@@@@@@@@.@@@@.@..@..@..@..
.@.@.@..@.@.@@@@@@@@@@@@.@@.@@@@...@@@.@.@@@..@@@.@@@@...@@@@@.@....@@@@..@@@.@.@@..@@...@@@@@.@@.@@.@@@@.@.@@@@.@@.@@...@@@.@@@@.@.@@@@.@@
@.@..@.@.@..@..@@@..@.@@@@.@@@.@@@.@@.@@.@@@.@.@@@@@..@@@@.@@@@.@@@@@@@.@@@@@@.@@@..@@.@..@.@@@.@@...@.@@@.@.@..@....@@@.@@@@.@@@@.@@@@.@@@
@@@@@.@.@@@@.@@@@@@@@@@@@@@@@@@..@.@@....@@....@@@@.@@.@@@@@.@.@@@@...@@@@@@.@@..@@.@.@.@@@...@@@@@@..@@.@@.@@.@@.@@@@@@@@@.@@@.@.@@.@@@@@@
@@@.@....@@@@....@@.@..@.@.@.@@@....@@@.@@@.@@@@@@@@.@@@.@@.@.@@@.@@@@.@@@.@.@.@.@.@@.@.@..@.@.@@@@@@...@.@.@..@.@.@@@@@@@.@.@.@@@@@....@.@
@@@@...@.@..@..@..@.@@..@.@.@@@.@.@.@@@@.@.@..@...@@..@@@@.@@@.@...@@@@.@@@@.@.@.@.@@@@.@@@@@.@@.@@@@@@.@...@@.@@.@@@@.@.@@@@@@.@.@@@@..@.@
@.@.@...@..@@.@@..@@.@@@@@.@@@@@@@@@@@.@...@.@@@@.@@@.@...@@@@.@@@@@..@@.@.@@@@@...@.@.@@@@@@@@@@@@@@@@.@@@@..@.@....@.@..@@@@@.@@@.@@.@.@@
.@@..@.@.@@@..@@@@@@.@..@@@@@.@.@..@.@@@..@@@@@@@@.@.@@@@@.@@@.@@@@@@@@@@.@@.@@@.@@@@@@@@.@...@@@@@.@.@...@@@@@@.@@@.@.@..@.@@@@@@.@@.@@.@.
@@..@@.@@@@@@@.@@@@.@@@@..@@@..@@.@..@@@.@...@@...@@.@@@@.@@@@.@@@@.@@.@@@.@.@.@@..@@@..@..@@@.@@.@.@@@.@..@@.@@.@@@@@@..@..@@@.@@.@@@....@
@.@.@....@.@...@@@@@@.@@.@@@@.@.@.@@@@...@@@@@@.@@.@@.@@@@.@@.@@@@@@@@@.@@..@.@.@.@@@.@@@@.....@@..@@@@@.@@@..@.@@@@@@@.@.@@@.@.@@@....@@@.
@@..@..@@.@@.@@@@@....@@.@@.@@@.@@@.@...@@.@.@@.@.@.@.@..@.@@@@@..@.@.@..@@@@@@@@.@.@@@@@.@@@@@@..@.@..@....@.@@@@.@@@.@.@@@@.@@.@@.@@@@@@.
.@@@@@@.@@.@.@@@@@..@@.@@@..@@@@@@..@.@...@.@.@@@@.@@@@.@@.@@@@@@@@@..@..@@@@@@@@.@@.@@@..@.@.@@@@@.@.@.@@@.@@..@@.@@@@@.@@@.@@@.@@@.@..@@@
@@.@.@@@.@.@...@@@@@@@@...@@@@@@@@@.@@@@@.@@@.@@@@@..@@@..@@@.@@..@@@.@.@@@.@.@.@.@@@@@@.@@@@@.@@@@..@.@@@@@.@..@.@.@@@.@.@@@@@@@.@@.@@@@.@
.@@.@.@@@.@@@@@@@@.@.@...@.@@@@@@@@@@@@@.@.@.@@@@@@@.@@@@.@@.@@@.@@@@@@@@@@@@@@.@.@@@@...@.@.@..@@.@..@...@.@@.@@@@@@@..@@@@.@@@@@.@@..@@@@
..@@@@@@..@@.@.@.@@@@@..@@@@@.@@@@@.@@@@.@.@@@.@@.@@.@@@.@.@.@..@.@@...........@@@@@@@@..@@@..@@@.@.@@.@.@.@.@@@@@@@@@.@@@.@.@@.@@@..@@@.@@
@@@...@@..@.@@@@@@@..@..@@.@.@@@@.@@@@.@@@...@..@@@@@@@.@@..@@@@@@..@...@@@@@@@.@@@@@@@@..@@.@@@@.@@..@.@.@@@@.@.@...@@.@@@..@@@@@@@..@.@@@
@@.@@@@@@@.....@....@.@.@..@@@@.@.@@@@@.@.@@@..@.@.@@.@@.@@@@@.@@.@@.@@.@.@@@.@@@@@.@@@@@.@@@@@@..@@.@@.@@@@@.@..@@@@@@@@.@@@..@.@@@.@..@@@
@.@...@.@.@..@@@.@@@@@.@@....@..@@@@@..@.@@.@.@@@@...@.@..@@@@@@@.@@@@.@@@.@@@@.@@@@@@@@.@..@.@@.@@.@@@@@..@@@@.@@@@@@..@.@.@@@@@.@.@.@@.@.
@@.@@..@@@@@.@@..@.@..@@..@@@@@@@.@@@@@@.....@@..@@.@@.@.@@.@@@.@@@@.@@@@@@..@@@@.@@.@@@@@..@@.@.@@@@@@@@.@@..@@@@..@@..@@@@@@.@@@.@@.@@@@@
@@..@@@@..@.@@@@..@...@@.@@@@@@@@..@.@.@@@@@..@@@@.@.@@@..@@@@@@@@@@@@@@..@.@.@@@@@.@.@@...@@@@@@.@@@@@.@@@@@.@@@.@@..@.@@@..@..@@.@@@@@@@@
..@@@.@@@.@@@.@@.@@@.@@@@.@@@@...@.@.@.@.@.@@@@.@.@@@@@@@@@..@@.@@@@@@@@.@@@@.@.@.@@@.@@.@@@..@@..@@@@@@@@@@@@.@@...@..@.@@...@.@@.@.@.@@@.
..@@..@@@.@@.@@@@.@@.@@@...@.@@@@@@@.@@.@@@@@@@..@..@@@@.@@.@@.@@..@@@..@@@@...@@@.@@.@@@@@@@@.@@..@..@@@@.@@@@@@.@@.@@@@@@@@@.@..@..@.@.@.
.@..@@@@@@@.@.@@.@...@@@@@@@.@.@@@@@..@@..@@@@..@@@@@@@@@@@@@@.@..@@.@@@@@@.@.@@@@@.@@@@@.@@@@..@..@.@.@@..@@.@.@@..@.@@.@.@@@.@@@@@.@@..@@
@.@@@@@.@.@@@.@..@..@@.@@@@@@@...@.@@@@@..@.@..@.@.@..@@@...@@.@...@@@@.@@@@.@@@...@..@@.@@@@@@@@@@@.@@..@@.@@@@@@.@@.@@@...@.@..@@@@.@.@@@
@@@@@@@.@@@...@@.@@.@@@@.@.@@@@@@@@@@@.@@.@@..@@.@@@@@@...@@.@@@@..@@@@@@.@..@@...@@.@@@@@.@@@.@..@@@...@@..@@@.@@...@@....@@@@@@.@@@@.@@@.
...@@...@@....@.@.@@..@.@@@@@@..@@@@@@@.@....@.@@..@@@@..@@..@@@@@.@@@.@@@.@@..@@@@.@@@....@..@@@.@.@..@@@.@@.@@@.....@.@@@..@@.@@@.@@...@@
@@@.@@@@@.@@@.@@@.@@@@@@@....@@@@.@@...@@.@@..@@@.@@@@@..@@@@.@.@@@@..@..@...@@@@@@@@.@@@.@@....@@..@@..@@@...@@.@...@@@..@.@.@@@@.@.@@@@.@
@.@..@@.@@.@@.@@@@.@@@@..@.@.@.@..@@@@.@.@@@@.@.@@..@.@....@@...@@@@@@.@@@@@@@@@.@@.@@@@.@@@..@.@@@@.@.@@@.@...@..@..@@@@@@.@@.@@@@.@@@@.@@
@..@@@@.@.@@.@..@.@..@@@@..@@.@.@@@@@@@@@@@@@.@@@.@@@@@...@@@@@@@@@@.@@..@@.@@...@.@.@@@@@@@@.@.@..@@..@@..@..@@@@@@@@....@@@@.@@.@@.@@@@@@
@@.@@@....@..@@@.@.@@@@@@@.@.@..@@@@.@@@@@@@.@@@...@@.....@.@@@@@@@@@..@.@@@..@@...@@@@.@@@..@..@@.@@@@.@@.....@..@@@@@.@@....@@@..@@@.@@.@
@@@@.@@@@@@.@@.@@.@@@.@@@.@@@.@@@@...@.@.@@@@@@.@.@@@@@@@@@@.@.@.@...@@@@.@.@@@...@@..@@@.@@@@@@@....@@@@.@.@@@@@@@@@@@.@@@..@@@@@.@.@@@...
@@@@@@@@@.@......@@@..@@@.@.@@@@..@@@.@@@.@@@.@@@@@@.@@@.@@@@.@.@@@@@..@@@....@.@@.@@@...@.@@.@@.@@@.@@@@@..@@@@@.@@@@.@@@@@@@@.@..@@...@.@
.@.@..@@@@.@@.@@.@@@..@@@@@@@@@@@.@@@.@@.@..@.@@@@@.@@@@...@@@.@@@@@@......@.@@@..@@@...@@..@.@@@.@@@.@@@@...@.@.@.@..@..@@@..@@@.@.@@.@@@@
@@@@.@@@.@@.@@.@@@.@.@.@@@.@...@@@.@.@@@@@..@@@@..@.@@....@@@@@@@@@..@@....@@@@.@@@@.@.@@@@@@@@.@@..@.@@...@.@@@.@..@@@@@@..@.@@@.@@@@@..@.
@@@..@@@@@@.@@.@@@.@..@@@@..@@@@.@.@@@@@.@@@@@@@@.@@@.@..@.@@@@.@@@@@@@@@@@@@.@@@@@.@.....@@@..@..@@..@@..@.@@@..@.@.@@@@@.@@@.@..@@....@@.
@@@@@...@....@@@@@.@@@@..@@@.@@@.@@.@@...@@.@@@@@@@@@@..@@@.@.@.@@@@@@@@@.@@.@@@@@.@@.@@.@.@@..@@@@@@@@..@@@@@..@@@@..@@@.@.@@.@@.@.@@.@@.@
@@@@.@@@@@@@@.@@..@.@@@@.@@@.@@@@.@.@.@.@@@@@..@.@@@@@@...@@@@@@@@.@.@.@@.@@@..@@..@..@@@@@@@@..@@@@@@@..@@@@@@@.@@@@@.@@@@@@.@.@.@.@@@..@@
@@.@@@@.@@@@.@..@@@@@@@@@@@@..@@@@@@@.@.@@..@..@.@@@@@@@@@@.@@@@..@.@@@@@@.@.@@.@@@@.@@@.@@..@@@...@.@@@.@@@@@.@@@@@@@@@@..@@.@@..@@..@@@@@
@@@..@.@@.@@@.@..@.@......@@@..@@@@@.@@@@@@.@@@.@@..@@.@.@@..@...@.@@@@@@@@@@@@@.@@@@@.@...@@@@@@@@.@@..@@@@.@.@@@@@..@.@..@@@.@@@@@@@..@.@
@@@.@@..@@@@@.@..@@@.@.@@@.@@@@@..@..@........@@@.@.@@@@@@@@@...@@@.@@@@.@.....@@@.@..@@.....@.@..@@@@@.@@@@@.@.@.@@@..@@@@.@@@@.@.@@@.@..@
.....@@.@.@..@@@@@@@.@@.@@@.@@.@@@.@.@@@@.......@.@@@.@..@@@.@.@@@@@@@@..@@@.@..@@@@@@@...@@.@@@@@@.@@@@@@@@.@@@@...@@@@@.@@@@@...@@@@.@.@@
.@@@@....@@.@.@@@.@.@@@.@@@.@@@.@@@.@@@@.@@@@@@@@@@@@@.@@@@@.@@@@@.@@@.@@@@@@@@.@..@..@.@...@@.@@@@@@@.@.@..@@@@..@..@@.@@@@@@@.@@@.@@@@.@.
@@@@.@@@@...@@..@@@@@@@@..@.@@@@..@@.@@..@@@.@.@.@..@@@@.@.@@@.@.@@@@@@.@.@@@@@@@@@.@.@.@@.@@@@@.@@@@@@.@@@@@@.@@..@@@@@@..@@@@@@@@@.@@@.@@
@.@@@@.@@@.@@@.@@..@@@@@.@.@@@@@.@@.@@...@@....@@@@.@@@@@@@...@.@@@@.@.@.@.@.@.@...@@.@@@@.@@..@.@...@@.@@@@@@@@@.@@@.@.@....@.@..@@@..@@..
.@@@@@@..@..@@@.@@@.@@...@@.@.@@@@.@@@@@..@.@.@@.@@@..@@@@@@@@@@@@..@@..@@.@@@@@.@@@..@@@@@@@@@.@@@.@...@.@@.@.@...@.@..@@@@.@.@@@.@@@.@.@.
@@@@..@@@.@.@.@.@@@.@@@..@@@....@@.@@..@..@@.@.@.@@.@@@@@.@@@@@@@@@@@@..@.@.@..@.@.@..@@.@@...@@.@@.@@...@..@@.@@.@@@.@@@@@@@@@@.@@@.@@@@@@
@@@@@..@@@..@@..@.@@..@..@.@.@@...@@.@..@@@@.@@@@....@@@@.@.@@..@@@@..@@.@@..@.@.@...@@@.@@@..@@@.@.@.@.@..@@@@.@@.@..@...@@@@@@@@@.@.@@.@.
@@@@@..@...@@@.@@@@.@.@.@@@.@@@...@@@.@.@@@@@.@@..@@.@@.@.@@@@@.@@.@@@@@@@@@@@@.@@@.@...@..@...@.@@@.@.@.@@@@@@@.@@@...@@@.@.@@@@@.@@..@.@.
.....@@@@@@@.@@@@.@@@@@..@@@.@.@.@@...@..@..@.@..@....@@@@@@@..@@..@..@.@@.@@@@.@.@@.@..@.....@@@@@@@..@.@@@@@@@@.@.@@@@...@@.@@.@@.@.@@..@
@..@@@.@@@@@.@@.@@@.@@@@.@@@@.....@@@...@.@@@@.@@@@@@.@@@@.@@.@@@@@@.@@.@.@..@@@@@.@@@.@@@@@...@.@@@@.....@@..@@@.@.@.@@@@@@@@@.@@..@.@..@@
.@@@..@..@..@@..@..@@@@@@@...@@@.@@.@@.@..@@@..@@@.@.@.@@@@@@@@@@...@@@.@.@@@@@.@..@@@@..@@.@@@@@@.@.@.@.@@@@@@@@@@@.@@@@@@@@@@@..@@.@@@...
@.@..@@.@@.@@.@@@@@@@@@@..@.@@@@@.@@..@..@.@@@@..@@@.@@@.@@@@@@.@.@...@@@@.@.@..@@@@@@@@.@@@@@.@@@@.@.@@@@@@@.@@.@@...@@@@@@@@....@@@@@@@@.
@@@@@..@.@@@.@@.@@@@@@@@.@.@...@@@@@.@@.@.@@@.@.@.@.@@@@@.@@.@.@@.@.@.@..@@.@@@@@@@@.@.@@@@@@@@....@...@@.@@@@@@..@@@@@.@@.@.@.@.@@.@.@@@..
..@.@@@.@...@@@.@@.@@@@@@@@.@...@@@.@@@.@@.@.@.@.@.@.@@.@@.@..@.@@@...@@@@@@@.@@@@@@@@..@.@.@@@.@.@@.@..@....@@@......@@.@@..@.@@.@@..@..@.
.@@@.@@@.@..@@@@@@.@..@.@.@.@@.@@@.@..@.@@.@@@.@.@@..@@@@@..@.@@@@.@.@@.@..@@.@@@..@@.....@..@@@..@.@.@.@..@.@.@.@..@.@@.@@.@@@..@..@@@@@.@
@@.@@.@@..@@@@@@.@@@@@@.@.@.@@.@.@@@...@...@@...@.@@@@@@.@.@@.@@@..@@.@.@@@@@.@..@@@@@@.@.@.@@@..@.@@.@.@.@@.@@@@.@@@@@.@..@@@@@@@@@.@..@.@
@@@@@@@@@..@.@..@@..@@@@@...@@@@@.@@.@@@@@@@...@...@..@.@@@.@....@@@@@.@@@@@@@@.@@.@@@@@@.@@.@...@.@@..@@...@@@@.@@@@@@@.@@@@@@..@.@@@...@@
@.@@..@@@...@.@@.@@@@@..@.@@@@@@@.@@@@@..@@.@@@.@..@@@@@@@.@@@@@@@..@.@.@.@..@@.@@@@.@@@@.@@@@@@@@@@.@@.@@@@@@@@.@@@@@@@@@.@@@@..@@@@@..@@@
@@@@@.@...@.@@@@.@@@.@@.@@@.@@.@.@...@@@@@@...@@@@...@..@@..@.@.@@@.@@@@@@@@...@@@@@@@..@@@@@@@@.@@@@@@@.@@@..@@@@@@@...@.@@@.@@@@@@@@.@@@@
.@@.@@..@.@@@@@.@..@@.@@@@...@@@@@.@@@.@.@.@.@@@@@.@@.@...@.@@@@.@.@@@@.@@@@@.@..@.@.@@@@@@@.@@.@.@@@...@.@@@@.@..@..@.@@@@.@..@@@@@@.@@@.@
@@@.@..@@.@@@@.@@@...@.@.@@@.@@@@@@@.@@.@@...@@@@@@@@.@@@@@..@@@..@@@..@@@.@..@@@@..@@.@@.@@@@@@@.@@@@.@@.@.@.@@@@@.@@@@.@@..@@@.@@@@@@@.@@
.@@.@@@...@.@@@.@@@..@..@..@@.@@@@...@..@@..@@..@.@@.@@@@.@.@@.@.@@@.@..@@@@@.@@@@@..@.@..@.@@..@.@..@..@.@@@@@@@@.@@.@@@@@@@.@@.@@...@@.@@
@@.@@@..@@@..@..@@.@.@..@@@.@@.@@@@.@@.@@@.@.@@@.@@.@.@@@@.@.@..@@@...@@@@@....@.@@.@@.@@@@@@@@@.@@@@.@@.@.@.@.@@@@@@@@@.@.@@@@@.@.@@@@@..@
.@@@@.@...@.@@@...@@.@.....@@.@@...@@@@@..@@@..@@.@..@@@@@@@.@.@@.@.@@@@.@.@@@@@.@@..@....@...@@..@@@...@@@@@@..@..@@@@@...@@@@@.....@@.@@@
@..@.@@.@@@....@@@@.@@@@@@@@@..@.@@@..@@@@.@@@@@@@@@@@.@..@@@.@.@.@..@@..@@....@@@..@..@.@@.@@@.@...@@..@@.@@@@@....@@.@@@@.@@.@@@@@@...@@.
.@@..@@..@@@@@@....@@.@..@@.@@@.@@@@@.@@@@...@....@@.@@@.@..@@.@.@.....@@@@@@.@@.@@@@@..@..@@@@.@@@.@..@@..@@@@..@.@@@..@@@@@.@.@@.@@.@@@@@
@@@@@@@@@..@.@..@@@.@@@.@.@@@@@..@@@..@@@@@@..@@@@....@@.@.@.@...@.@@.@@@@.@.@@.@@@.@.@@..@@@@.@@....@@@...@@..@@@@@@...@.@@@@.@@.@@@@....@
.@@.@.@@@.@.@@.@@..@..@@@@.@@.@.@.@..@@.@..@@@@@@@..@@@@@.@.@@.......@@@@@@..@.@@@.@.@@..@...@...@@@@@.@.@@@@@@@@.@@@@@.@.@@@@@@@@@@@@@@@@.
.@@@.@@@@.@@..@@@@@.@@.@@.@@@..@.@.@@.@@..@@@@@@.@@@@@@@@@..@@@@@.@@@.@@@@@..@@@@@@@@@@.@.@@.@@.@@@.@@@@@@@@...@......@...@@@@.@@.@@@@@..@@
.......@@@@@..@.@.@@@@@.@@..@@@@@@...@@@..@@.....@@@.@@.@@@@.@@.@@@@@@@@.@.@.@@@@.@@@.@@@@@@@@@.@@..@.@.@....@@@@@@@@@@@..@@.@@@.@@..@@..@@
.@@@@@@.@@@...@.@@@@.@..@@@@@@@.@.@@......@@@@@@@@.@...@@..@.....@@@@.@@..@@@@@......@.@.@.@.@@.@..@.@@@@@.@.@@@@@@@@@...@.@@..@@@..@..@...
@@.@@.@@@@@@@@.@@.@.@@.@@@@@@@@@@..@.@@@@.@@@@@@@@@@@..@.@.@@@@@@@@@@@@@@@@..@.@@.@.@@.@.@@@@.@@@@..@.@@.@@.@..@@@@.@@@@@..@@...@@@@@@.@@..
@@@...@@.@@@@@@@@.@@@.@@@..@@@@..@@..@@.@..@@@@@..@@.@.@@@.@@@..@@..@@.@@@...@@@@.@@@.@@@@@@.@@.@@.@..@@@@.@@...@@@..@@.@@..@.@@@@.@@@@.@@@
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,5 @@
593 3311 96 337 82 427 52 5 311 28 3 95 663 343 661 31 2265 968 78 9485 8 732 5 3321 885 744 11 45 94 31 431 795 44 26 757 164 3 13 78 59 15 73 97 57 937 97 88 59 95 9 875 6 362 25 11 955 52 9 8 3 14 551 176 997 43 8 489 7 6 9 93 85 291 84 869 662 5 35 78 42 411 444 2 36 6 264 5945 6 25 197 19 7 5 393 24 379 1 26 557 22 3696 93 38 37 343 43 95 6 845 3798 635 9 49 5 42 64 327 99 566 221 76 6977 58 92 98 1 566 88 5336 49 126 3 8 66 82 97 6 9 524 414 37 197 6 985 7 4 75 9339 6 9975 219 5 27 7 283 42 4 7 31 49 269 96 752 17 629 346 76 62 43 372 888 792 5 3 7 5 969 6 99 67 522 24 1 746 2 1467 75 17 57 8995 181 336 468 5 14 38 31 9913 22 38 727 28 331 12 37 267 594 12 21 27 2 7 94 821 9 414 43 346 38 21 838 468 9116 84 962 522 28 25 5 51 58 49 599 21 44 49 187 169 222 1 481 5456 85 1 4335 89 589 33 467 79 12 26 5 755 98 772 8 475 15 7 9 83 96 6 5636 974 4 66 15 94 99 334 3764 563 3934 1683 27 367 86 2 37 879 7 95 27 452 3 1 43 255 515 14 564 334 7 57 1238 33 3153 732 55 56 164 899 9419 1495 99 2 4 5 15 91 141 3 8 35 85 15 356 46 69 46 42 5 48 24 2 2 34 81 327 537 5137 3 15 89 18 71 32 16 2 2985 82 328 7 1 67 467 2245 75 96 641 69 4 867 2894 574 76 6 98 11 21 85 46 256 57 9 5 387 48 83 38 8993 52 2 3917 5 13 94 55 75 3 82 6 6915 11 8 4 3717 25 941 86 28 79 5 13 39 3 731 943 76 3 22 335 12 87 51 1 122 41 39 13 564 69 993 322 349 48 522 2 94 211 71 933 464 3 24 93 2239 36 233 45 658 81 31 828 4 39 42 53 58 3 23 27 42 65 549 452 56 71 437 5 44 69 6411 9 18 13 64 25 3173 844 4 88 83 13 283 2 29 28 41 214 21 1 28 165 779 5482 255 3779 368 411 18 6 5874 85 6179 7 7 45 727 1 95 8 5316 221 9 1 84 57 13 16 77 354 24 718 97 142 21 1 74 847 89 36 11 5 58 7625 41 241 8 7 45 637 97 81 936 8 74 168 145 19 31 2 6 175 771 928 1 7 8 49 63 8 1 42 64 57 121 19 35 613 67 48 86 588 27 72 54 7 21 45 7 6 39 139 212 779 7 645 4452 484 24 1 14 1999 874 593 6852 63 6 53 98 78 17 97 76 571 8 4 42 83 15 312 2 768 22 34 996 7282 6856 9 27 5 83 39 181 72 437 44 474 2 34 23 15 732 996 13 17 575 74 4474 96 278 8827 57 62 68 81 38 597 281 956 76 5215 412 83 58 2 89 66 8128 779 5667 82 679 42 1 9 43 431 35 35 3 96 54 755 885 7 31 7 76 33 3 158 382 35 35 98 5 327 61 4149 3568 2 7835 27 8 7 14 758 66 5235 194 59 68 99 42 1 363 79 22 516 9424 4495 7 524 7 977 919 462 22 48 95 158 9 3 74 1 522 5 65 99 92 421 9 733 2 399 14 13 91 32 37 347 41 54 7 23 32 555 62 54 64 43 5 8695 8 728 68 11 5413 762 96 95 49 6 131 4385 24 599 44 99 93 95 77 58 6531 3 94 69 41 8 46 3 348 12 359 3 955 21 445 32 51 44 9 2853 69 34 568 971 89 2 58 979 61 95 573 49 7659 61 77 44 351 72 816 7 89 6181 727 11 17 75 39 68 225 939 394 54 1 7 5166 6819 99 2 59 673 3 568 128 248 56 43 916 77 837 957 92 51 81 9262 411 7634 24 412 24 155 37 4 921 9 46 8733 52 7 816 4762 932 53 5265 892 12 1 46 55 814 19 4 17 825 81 4 8 93 92 3 69 52 69 9 17 844 4665 54 67 4 956 61 9 94 68 59 14 7 21 83 64 5 7 779 88 88 9 27 632 37 23 811 47 3156 85 54 66 33 6446 75 7 49 4 73 1483 34 39 53 82 8 81 77 84 8943 155 98 1864 6242 64 849 64 34 6 882 696 153 67 767 1 6 75 9549 52 9262 192 84 56 7 78 618 894 6 325 14 215 53 48 17 22 7 76 63 85 24 528 62 51 532 15 6 16 21 278 24 69 49 48 432 22 7 776 777 527 5 28 3 928 29 4 48 31 468 56 41 166 4 1876 122 755 6 372 8 9 6
939 9896 624 578 93 74 416 37 126 196 72 4 164 741 438 64 7686 928 85 847 1 288 34 7889 999 628 56 49 79 48 436 347 26 563 857 943 9 33 82 113 63 575 74 67 956 69 9 397 954 87 77 845 891 14 69 375 336 5 9 48 74 14 958 535 54 3 413 3 372 16 8 28 63 939 133 241 345 75 27 64 315 352 1 62 223 713 7665 96 59 127 37 282 3 698 97 467 54 76 544 82 7654 66 61 3 613 73 96 3765 863 4383 462 3 49 85 75 88 287 62 956 464 21 2435 85 357 37 1 14 35 6591 593 886 1 32 21 73 164 139 947 251 719 451 143 187 282 54 3 72 5297 2 3247 239 6 17 84 988 68 3 29 75 67 531 28 85 25 375 582 42 64 76 16 767 262 5 11 2 92 228 6 711 87 774 98 5 7765 3 4936 861 23 55 9821 282 378 285 4913 57 38 83 1717 69 98 517 56 792 28 61 836 872 24 17 18 62 42 86 778 4 846 34 315 24 42 535 418 542 371 184 333 76 65 7 94 492 7 256 54 87 769 542 584 745 43 5925 6925 72 64 7412 68 376 73 6246 19 96 9533 65 417 36 147 54 329 97 2 23 75 48 2 2764 883 5 99 42 65 44 12 3879 959 8733 483 94 298 37 72 54 875 69 183 461 681 75 15 15 79 555 75 836 223 295 36 667 24 947 17 71 34 723 98 6423 9374 33 64 1 2 51 22 442 72 77 38 74 89 461 45 52 71 45 69 9167 23 5 42 37 342 676 56 7544 65 92 72 17 87 55 14 44 9891 45 536 2 36 32 814 3636 637 79 611 45 75 683 8137 821 93 1 91 73 68 26 95 7641 34 4886 1 547 99 24 861 6955 73 16 3143 81 834 47 354 28 7 29 548 5298 485 5 63 4376 89 82 128 32 53 13 35 6146 68 662 724 31 57 44 933 19 514 78 52 763 41 88 36 45 79 981 75 74 334 674 9 9 832 57 959 889 7 72 39 5798 97 5416 28 556 63 717 922 65 75 48 35 5 6 17 74 29 15 574 155 97 23 641 8 32 73 9235 192 35 69 678 891 5754 953 6 28 43 9 975 592 84 73 86 419 3 98 53 713 966 2225 918 5473 636 724 13 358 998 47 1745 968 37 28 46 8 628 44 2218 423 84 26 28 54 31 327 13 628 98 219 69 183 89 66 37 552 9 136 96 5 21 2522 55 665 7 91 897 196 48 89 719 42 64 879 511 56 55 6 859 648 515 375 5 8 17 96 33 12 9 63 84 87 127 54 192 166 56 13 58 3333 356 88 26 8 36 83 795 59 76 778 913 794 5 591 7564 825 45 162 38 8995 554 675 2465 26 49 171 12 66 49 414 7113 1736 4 54 49 14 7264 815 2 178 94 97 957 3293 6952 35 75 56 153 657 65 512 399 74 531 794 86 696 14 449 693 14 669 416 55 6983 99 932 4938 72 92 719 9 92 98 6655 835 45 3912 336 61 11 41 63 14 5328 163 9152 34 344 68 471 7 76 779 71 13 54 28 953 383 517 8 24 69 36 21 6 781 632 32 24 56 341 26 81 5115 338 9 4866 44 3 98 46 798 94 337 428 946 82 44 135 46 825 53 47 851 3761 3913 83 343 9 682 366 685 95 293 71 74 47 476 6892 71 557 33 38 32 98 53 14 794 4 777 79 99 367 54 49 946 197 438 74 63 218 157 99 44 49 71 32 181 3 347 317 12 84 946 82 77 194 48 966 7175 34 112 87 11 81 18 58 47 7659 263 52 314 835 91 71 6 622 321 741 62 716 53 442 354 53 936 82 5297 227 225 745 291 227 9 72 69 58 73 557 434 1118 58 388 62 245 835 621 644 22 7798 97 775 74 98 55 4 665 668 23 33 96 682 5494 222 67 455 426 256 846 131 39 5336 2 872 111 51 681 363 39 47 676 9796 954 4336 61 74 7 296 38 53 461 65 19 9932 17 59 442 3912 565 53 2592 824 97 34 28 26 735 82 283 98 89 62 659 54 68 35 381 85 811 46 4 86 253 5242 47 33 7 922 61 1 61 67 34 29 79 33 48 56 11 87 937 86 57 63 33 189 97 276 717 24 191 696 97 3357 82 8624 13 41 394 14 29 9686 348 552 66 6255 75 59 45 58 87 259 13 7838 9153 75 979 32 346 23 521 369 2586 46 597 79 948 146 7796 823 3599 214 43 94 6 44 856 316 8 991 63 372 283 16 198 52 78 1379 82 368 858 551 238 665 732 23 41 36 14 644 74 64 76 235 98 72 84 641 74 173 4 863 8 425 54 99 68 33 866 82 19 825 2 1277 611 871 64 934 44 55 3
725 278 2564 666 77 9 598 29 179 389 58 8 859 756 97 63 6366 672 387 395 27 797 698 836 35 527 98 3 588 37 5 119 414 316 615 971 3 15 71 635 53 357 27 9723 176 8613 8 898 288 92 19 3612 899 54 56 785 253 25 152 452 76 96 548 76 6 8 278 39 422 41 7 54 12 879 8987 438 481 27 13 74 695 542 51 77 221 41 1577 69 97 722 3 4429 97 897 686 683 169 23 66 84 7194 33 76 7 6279 56 85 1229 411 641 991 15 65 66 37 41 178 27 32 462 92 4636 62 243 742 22 13 2982 9129 297 638 59 46 49 62 285 788 811 141 191 9126 123 371 627 538 58 32 2224 18 9221 85 9 57 31 82 19 72 957 11 86 195 284 16 7 598 758 488 52 78 67 166 579 72 37 71 18 537 14 8285 69 418 28 16 9781 58 9756 719 488 56 71 79 54 516 7544 335 437 61 7856 516 91 18 33 415 933 352 998 38 868 157 17 73 22 7 347 84 881 58 489 61 68 5141 39 434 833 114 289 5136 77 46 7 736 1 388 32 73 162 393 1 477 39 1843 4938 2 57 49 92 425 64 1244 98 43 7113 99 351 68 42 44 2 717 2 374 527 81 7 83 617 45 6 868 38 98 54 61 928 6337 65 1 391 66 81 6 158 389 9843 469 254 674 63 16 21 212 13 825 59 837 35 636 46 5 17 199 87 716 8 579 2554 76 422 92 89 39 8 157 798 73 74 9 67 13 61 534 42 45 48 9896 8 51 413 8114 4112 45 53 938 39 344 12 36 93 45 97 61 724 15 943 84 336 7612 147 361 889 88 841 84 61 86 773 644 38 74 76 89 74 762 23 9421 43 3583 34 231 84 25 629 4757 94 86 1616 74 9593 64 865 89 32 97 792 1733 629 69 488 4831 47 7 388 55 83 27 98 9777 88 638 828 5 46 74 296 523 973 1 384 354 96 14 98 79 94 13 4 4 452 256 3217 9 528 42 167 492 34 46 78 7978 82 6495 23 318 54 6118 4111 94 29 39 93 5 96 16 3 54 56 372 297 93 42 659 9 16 48 3655 6952 89 73 713 431 995 763 8 69 54 5 3 344 94 83 81 4 9 98 24 38 169 2535 525 9684 896 88 71 863 567 57 626 9244 34 33 67 49 339 92 843 198 952 783 61 48 618 2446 56 948 54 316 29 479 934 79 33 958 4 964 543 96 89 795 23 1 57 97 939 2 23 39 595 83 38 4 977 93 66 89 833 345 544 998 16 63 924 51 35 79 71 8 22 99 436 3 657 498 35 62 19 3978 353 36 628 71 94 47 945 71 153 812 324 381 7 911 91 17 969 311 429 429 8659 517 7677 61 716 318 94 92 22 155 7159 9869 76 45 73 61 5851 93 286 11 79 22 71 7491 577 72 9 25 572 371 97 7991 699 19 248 862 26 263 62 273 43 31 983 92 36 1189 99 516 5325 932 92 453 1 889 88 2417 152 45 5619 857 18 47 95 22 5 385 66 53 58 823 891 475 33 639 269 82 64 53 71 2122 26 972 91 31 26 17 55 79 378 887 64 31 88 747 4 8 5498 148 3 6438 66 82 36 57 124 81 335 755 398 21 11 242 819 874 85 57 3 5872 3752 671 78 33 412 937 118 53 663 83 75 23 154 4965 18 964 92 17 93 95 44 52 625 7 439 33 47 468 3695 63 469 781 924 92 42 3829 98 22 22 76 99 28 644 442 913 526 42 33 871 334 34 312 63 92 5244 42 212 12 95 97 484 47 38 3932 177 44 957 251 64 225 134 858 623 8281 21 344 13 799 556 87 324 62 1889 696 121 1 33 3875 57 35 71 36 893 877 1987 8 85 658 61 92 391 974 177 66 939 2 339 22 993 62 1 522 829 69 39 682 3625 559 728 888 897 171 394 749 523 17 1972 3 774 482 46 354 15 29 57 7562 6852 1 8673 37 4 3 5 75 95 67 56 4 565 8 263 399 563 46 54 23 27 1 64 36 32 834 3 812 33 12 37 597 18 8 2 787 39 723 79 5 73 951 929 76 388 361 377 17 356 59 71 73 37 63 68 82 1 879 364 827 67 8 28 46 156 66 363 14 85 148 813 99 7272 38 91 2665 828 884 17 76 671 149 438 14 2288 45 67 87 334 85 529 48 595 4929 75 71 93 311 31 118 977 2754 49 6 37 422 848 5715 653 4638 228 463 87 71 65 688 182 32 64 56 414 463 98 182 21 67 1545 8 465 144 755 619 924 815 21 51 36 75 6371 79 22 74 177 65 87 51 749 68 28 26 6812 1 81 88 481 94 834 461 25 87 413 14 8829 972 437 786 451 348 617 3
4 83 8916 56 81 8 996 35 458 733 86 2 415 28 24 3 5349 661 254 26 719 222 971 46 3 22 93 1 959 56 9 671 152 449 3 917 22 1 63 962 48 329 28 4926 283 5562 3 287 2162 415 4 6662 56 94 89 9 628 37 239 453 573 3 53 3 2 63 43 61 692 86 5 95 46 882 5534 21 445 54 2 6 627 68 57 48 635 46 1 63 2 424 3 3544 62 54 966 498 426 17 7 79 99 553 58 9 9198 1 51 1734 917 37 18 48 45 53 83 56 555 89 86 73 89 117 56 993 551 53 4 7628 294 323 916 56 81 24 82 629 797 838 466 61 1343 59 754 248 227 72 46 7 38 11 29 38 81 59 7 76 75 353 23 94 859 672 1 4 54 62 692 9 22 9 59 1 64 21 38 88 427 44 2763 56 115 75 62 7872 69 249 963 488 6 79 52 9 49 5216 384 297 65 4455 577 639 2 69 4 465 282 62 77 575 497 3 84 77 1 6 68 726 16 6 93 3 8694 96 413 822 751 3 1526 14 3712 7 546 6 433 79 16 213 494 3 358 34 7274 97 8 66 94 63 848 14 2954 62 3 1944 59 77 2 3 45 7 545 64 625 815 41 17 8 213 38 1 142 15 27 9 1 84 483 8 8 188 7 55 4 7 568 8912 878 89 956 99 9 89 723 67 895 5 379 82 42 36 9 89 887 79 6 1 91 185 11 7641 32 678 63 2 684 442 92 45 1 94 11 56 187 97 93 87 6385 9 96 414 8825 5928 6 4 36 71 949 13 72 272 77 26 98 949 48 547 285 514 2847 782 75 974 4 411 4 68 39 977 526 59 63 49 1 54 548 44 7829 62 7781 25 35 89 28 862 729 84 37 825 11 9445 21 726 46 716 27 896 594 868 72 218 5575 62 6 561 17 32 23 58 9378 84 484 536 7 83 5 894 842 656 3 747 623 58 42 66 72 46 6 3 7 271 113 6235 8 85 9 94 46 12 61 32 864 67 7463 83 443 44 1962 2188 999 93 75 6 6 64 8 8 39 21 616 45 62 85 7 76 62 86 82 4176 58 12 5179 259 74 15 81 6 2 7 1 748 78 5 5 7 9 88 92 32 22 118 112 11 4562 83 93 867 491 93 3 5411 77 4 1 8815 311 21 675 86 639 876 6 18 2289 4264 34 68 292 314 81 57 137 45 8 257 9 795 912 48 42 7 76 2 69 56 969 7 5 43 971 99 8 9 79 69 96 22 947 9 32 9 89 62 286 49 51 38 15 5 4 779 18 5 941 41 8 9 75 2588 634 49 974 864 8 53 768 59 971 61 779 93 25 4 54 8 463 661 478 78 1535 888 22 74 741 978 25 76 14 485 1558 5576 53 18 4 12 3654 89 299 1 75 1 8 6 88 94 6 52 2482 625 67 2769 851 28 269 796 13 834 47 76 9 15 152 25 75 236 47 8 654 879 22 735 3 241 78 4296 11 69 815 961 88 92 35 8 8 83 9 9 97 682 813 659 89 645 61 18 9 17 32 8982 4 188 68 18 23 65 2 49 577 954 99 9 79 354 6 7 9 47 69 524 36 773 48 74 226 18 654 129 674 1 5 792 154 999 66 85 1 748 6156 332 9 77 96 85 7 77 866 13 6 92 822 3775 81 23 553 66 5 9 69 47 821 38 135 83 8 567 8944 6 2 642 653 11 89 4756 6 16 98 4 6 51 76 857 676 335 72 52 227 138 75 866 67 3 2793 29 7465 74 51 33 671 17 28 1325 124 32 816 146 62 177 336 45 999 9193 61 447 59 773 317 57 625 11 966 454 379 4 41 2327 19 48 11 35 474 91 8411 5 39 399 94 4 244 752 431 9 86 9 276 57 412 37 9 282 743 91 21 472 3428 213 71 427 486 527 468 215 374 9 8689 4 9998 99 61 196 34 68 66 4745 875 7 57 6 4 8 2 73 31 2 63 4 364 4 142 7 97 9 127 7 1 1 93 71 11 991 1 727 56 39 75 575 44 2 7 152 2 381 8 86 6 562 635 43 233 774 34 56 218 84 8 22 19 454 5 114 8 555 953 85 39 6 84 24 214 34 776 54 9 1 497 17 5523 82 25 1967 733 744 142 63 692 453 957 46 6245 48 47 52 568 29 243 42 424 566 57 3 18 892 67 317 799 4243 79 7 18 147 463 35 219 36 935 872 9 972 37 398 26 52 7 35 53 626 47 729 36 97 7226 7 2271 218 15 676 916 571 96 66 93 19 9819 582 49 9 627 24 7 684 854 9 42 97 8731 18 7 86 364 8 675 449 6 97 857 46 1899 766 16 925 627 416 931 74
* + + + * + + + * + + * * + * * + + * + * * * + * + * * * * + * * * + * + + * * + + * + * + * * + + * + * * * * + * * + * + * + + * + * * * + * * * + + + * * * * * * + + + + * + + * + + * + + * * * * + + * * + * * + + + * + + * * + * * * * * + * * + + * + + + * * + * * + * * + + + + + * * * * + * + * * * + + * * + + + * + + + * * * * + * * * * + * + + + + * + * * + * + * * + + * * + + * * * + * * * + + + * * + + + * * + + * * + * * * * + * + * * + + * + * + * * * * + + + * + + + * + + * * + + * + + * * * * + * + * + + + * + + * * + + + * + * + + + * * + * + + + * + * * * * + * * * * * + * + * + + * * + + + + + * * + * + * * + * * * + * + * + + + + + + * + + + * * + + + * * + * * * * + * + * * + * + * + + * + * * + + * + + + * * * * * + * * + * + * * + * * + + + * + + + * * * + * + + + * + + * * * * + + + * + + * * + * * * * * + * + + + + * * * + + + + + + + + * * + * + * + * * * + * + + * + + * + + * * + * + + * * * + + + + + + + * * * + + + + + + * + + + * + + * * * + * * + + * * + * + + * * * * * * + + * * + * * * * + + + * * + * * + * * + + + + + * * + * * * + + * + * * * * * * * * + + * + + + + + * * * * * * * + + + * + * * * + + + * + + + * + + * * + + * * * * + * + * + * + + + * + * + + * + * * + * + + + * * * + + * + * * + * + + * + + + * * + + + * + * * + * + + + * * * + + + * + + + * * + + + + + * * * * + + + * * + + * + * * * + * + + * + * * * + * + * * + + * + * * * + * * * * + + + + * * * * * + * + * * * * + + * * + * * + + * * * * * + + * * * + + * * * + + + + + + + + * * * * + + + + * + * * * * + * * * + + + * * + * + * * + + + + * * + + + + * + + * + * + + * + * * + + * + * * * + + + * * + + * + * + * + * * * + * + + + * + * + + * * * * * * + * * * + + * + * * * * + * + + * + + * + + * + * + * * + * + * + * * + * + * * * + * * * + * * + + * * * + + + * + * * + * + + + + * * + * * + + * * * + + + * + + * * * * * + * + * * * * + + + + * + + + * * * * + + * * * + + + + * + * + + * * * + * * + + + * * + * + * + * + + * + * * * * + + + * * + + * + * * * *
+165
View File
@@ -0,0 +1,165 @@
namespace AOC.Tests.Y2025;
[TestFixture]
[Parallelizable(ParallelScope.All)]
public class Day01
{
[SetUp]
public void Setup()
{
realData = File.ReadAllLines(Path.Combine(TestContext.CurrentContext.TestDirectory, "Y2025", "Data",
$"{GetThisClassName()}.dat"));
}
protected string GetThisClassName() { return GetType().Name; }
private string[] realData;
private int TurnDial(int startNumber, char direction, int clicks)
{
int delta = direction switch
{
'R' => clicks,
'L' => -clicks,
_ => throw new ArgumentOutOfRangeException(nameof(direction), direction, null)
};
int finalNumber = (startNumber + delta) % 100;
if (finalNumber < 0)
{
finalNumber += 100;
}
return finalNumber;
}
private int CountZeroHits(int startNumber, char direction, int clicks)
{
if (clicks <= 0)
{
return 0;
}
int firstHit;
if (direction == 'R')
{
// Position after k clicks: (startNumber + k) mod 100 == 0
// => k ≡ -startNumber ≡ 100 - startNumber (mod 100)
firstHit = (100 - startNumber) % 100;
if (firstHit == 0)
{
firstHit = 100; // don't count "k = 0", we only care about actual clicks
}
}
else if (direction == 'L')
{
// Position after k clicks: (startNumber - k) mod 100 == 0
// => k ≡ startNumber (mod 100)
firstHit = startNumber % 100;
if (firstHit == 0)
{
firstHit = 100;
}
}
else
{
throw new ArgumentOutOfRangeException(nameof(direction), direction, null);
}
if (firstHit > clicks)
{
return 0; // we never reach 0 within this rotation
}
// After the first hit, every extra 100 clicks we hit 0 again
int remaining = clicks - firstHit;
return 1 + remaining / 100;
}
private int HandleRotations(string[] lines, bool isPart2 = false)
{
int startNumber = 50;
int zerosCount = 0;
foreach (string line in lines)
{
// L or R, then a number to EOL
char direction = line[0];
int clicks = int.Parse(line.Substring(1));
// The dial is a circle, turning the dial left from 0 one click makes it point at 99.
// Similarly, turning the dial right from 99 one click makes it point at 0.
if (isPart2)
{
// Count every click that lands on 0 (during + at end of rotation).
zerosCount += CountZeroHits(startNumber, direction, clicks);
}
// For the final dial position ignore full rotations.
int clicksLessFullRotations = clicks % 100;
int finalNumber = TurnDial(startNumber, direction, clicksLessFullRotations);
if (!isPart2 && finalNumber == 0)
{
zerosCount++;
}
startNumber = finalNumber;
}
return zerosCount;
}
[TestCase(@"L68
L30
R48
L5
R60
L55
L1
L99
R14
L82", 3)]
[TestCase(null, 1066)] // The actual answer
public void Part1(string? input, int? expected)
{
// string[] lines = input != null ? new[] { input } : realData;
string[] lines = input != null ? input.Split("\n") : realData;
int result = HandleRotations(lines);
if (expected != null)
{
Assert.That(result, Is.EqualTo(expected.Value));
}
Console.WriteLine($"Part 1: {result}");
}
[TestCase(@"L68
L30
R48
L5
R60
L55
L1
L99
R14
L82", 6)]
[TestCase(null, 6223)] // The actual answer
public void Part2(string? input, int? expected)
{
// string[] lines = input != null ? new[] { input } : realData;
string[] lines = input != null ? input.Split("\n") : realData;
int result = HandleRotations(lines, true);
if (expected != null)
{
Assert.That(result, Is.EqualTo(expected.Value));
}
Console.WriteLine($"Part 2: {result}");
}
}
+161
View File
@@ -0,0 +1,161 @@
using System.Text;
namespace AOC.Tests.Y2025;
[TestFixture]
[Parallelizable(ParallelScope.All)]
public class Day02
{
[SetUp]
public void Setup()
{
realData = File.ReadAllLines(Path.Combine(TestContext.CurrentContext.TestDirectory, "Y2025", "Data",
$"{GetThisClassName()}.dat"));
}
protected string GetThisClassName() { return GetType().Name; }
private string[] realData;
private List<long> FindInvalidIds(long firstId, long lastId)
{
List<long> invalidIds = new();
// Since the young Elf was just doing silly patterns, you can find the invalid IDs by looking for any ID which is
// made only of some sequence of digits repeated twice. So, 55 (5 twice), 6464 (64 twice), and 123123 (123 twice)
// would all be invalid IDs.
// None of the numbers have leading zeroes; 0101 isn't an ID at all. (101 is a valid ID that you would ignore.)
for (long i = firstId; i <= lastId; i++)
{
string numberString = i.ToString();
// split the string in the middle, and if the two halves are identical then add i to invalidIds
int middlePosition = numberString.Length / 2;
string leftString = numberString.Substring(0, middlePosition);
string rightString = numberString.Substring(middlePosition);
if (leftString == rightString)
{
invalidIds.Add(i);
}
}
return invalidIds;
}
private static long FindRepeatingPattern(string numberString)
{
int digitsCount = numberString.Length;
for (int k = 1; k <= digitsCount / 2; k++)
{
if (digitsCount % k != 0)
{
continue; // can't evenly repeat so escape early
}
string pattern = numberString.Substring(0, k);
long times = digitsCount / k;
StringBuilder repeated = new(digitsCount);
for (long i = 0; i < times; i++)
{
repeated.Append(pattern);
}
if (repeated.ToString() == numberString)
{
return times;
}
}
// No repeating pattern found
return 1;
}
private List<long> FindInvalidIdsPart2(long firstId, long lastId)
{
List<long> invalidIds = new();
// Now, an ID is invalid if it is made only of some sequence of digits repeated at least twice. So, 12341234 (1234 two times),
// 123123123 (123 three times), 1212121212 (12 five times), and 1111111 (1 seven times) are all invalid IDs.
for (long i = firstId; i <= lastId; i++)
{
string numberString = i.ToString();
long count = FindRepeatingPattern(numberString);
if (count > 1)
{
invalidIds.Add(i);
}
}
return invalidIds;
}
[TestCase(
"11-22,95-115,998-1012,1188511880-1188511890,222220-222224,1698522-1698528,446443-446449,38593856-38593862,565653-565659,824824821-824824827,2121212118-2121212124",
1227775554)]
[TestCase(null, 23534117921)] // The actual answer
public void Part1(string? input, long? expected)
{
string[] lines = input != null ? new[] { input } : realData;
// string[] lines = input != null ? input.Split("\n") : realData;
List<long> invalidIds = new();
// Split by comma to get each range
string[] ranges = lines[0].Split(',');
foreach (string range in ranges)
{
// Split by - to get the first and last ID in the range
long firstId = long.Parse(range.Split('-')[0]);
long lastId = long.Parse(range.Split('-')[1]);
List<long> invalidIdsInRange = FindInvalidIds(firstId, lastId);
invalidIds.AddRange(invalidIdsInRange);
}
long result = invalidIds.Sum();
if (expected != null)
{
Assert.That(result, Is.EqualTo(expected.Value));
}
Console.WriteLine($"Part 1: {result}");
}
[TestCase(
"11-22,95-115,998-1012,1188511880-1188511890,222220-222224,1698522-1698528,446443-446449,38593856-38593862,565653-565659,824824821-824824827,2121212118-2121212124",
(long)4174379265)]
[TestCase(null, 31755323497)] // The actual answer
public void Part2(string? input, long? expected)
{
string[] lines = input != null ? new[] { input } : realData;
// string[] lines = input != null ? input.Split("\n") : realData;
List<long> invalidIds = new();
// Split by comma to get each range
string[] ranges = lines[0].Split(',');
foreach (string range in ranges)
{
// Split by - to get the first and last ID in the range
long firstId = long.Parse(range.Split('-')[0]);
long lastId = long.Parse(range.Split('-')[1]);
List<long> invalidIdsInRange = FindInvalidIdsPart2(firstId, lastId);
invalidIds.AddRange(invalidIdsInRange);
}
long result = invalidIds.Sum();
if (expected != null)
{
Assert.That(result, Is.EqualTo(expected.Value));
}
Console.WriteLine($"Part 2: {result}");
}
}
+111
View File
@@ -0,0 +1,111 @@
using System.Text;
namespace AOC.Tests.Y2025;
[TestFixture]
[Parallelizable(ParallelScope.All)]
public class Day03
{
[SetUp]
public void Setup()
{
realData = File.ReadAllLines(Path.Combine(TestContext.CurrentContext.TestDirectory, "Y2025", "Data",
$"{GetThisClassName()}.dat"));
}
protected string GetThisClassName() { return GetType().Name; }
private string[] realData;
[TestCase(@"987654321111111
811111111111119
234234234234278
818181911112111", 357)]
[TestCase(null, 17383)] // The actual answer
public void Part1(string? input, int? expected)
{
// string[] lines = input != null ? new[] { input } : realData;
string[] lines = input != null ? input.Split("\n") : realData;
List<long> maxJoltages = new();
foreach (string line in lines)
{
int[] digits = line
.Select(c => (int)char.GetNumericValue(c))
.ToArray();
// Find the biggest number in the digits array (excluding the last digit), and its position
int biggestDigit = digits[..^1].Max();
int biggestDigitPosition = Array.IndexOf(digits, biggestDigit);
// Ignore any digits before and including the biggest digit, then find the next biggest
digits = digits.Skip(biggestDigitPosition + 1).ToArray();
int nextBiggestDigit = digits.Max();
int maxJoltage = biggestDigit * 10 + nextBiggestDigit;
maxJoltages.Add(maxJoltage);
}
long result = maxJoltages.Sum();
if (expected != null)
{
Assert.That(result, Is.EqualTo(expected.Value));
}
Console.WriteLine($"Part 1: {result}");
}
[TestCase(@"987654321111111
811111111111119
234234234234278
818181911112111", 3121910778619)]
[TestCase(null, 172601598658203)] // The actual answer
public void Part2(string? input, long? expected)
{
//string[] lines = input != null ? new[] { input } : realData;
string[] lines = input != null ? input.Split("\n") : realData;
List<long> maxJoltages = new();
foreach (string line in lines)
{
int[] digits = line
.Select(c => (int)char.GetNumericValue(c))
.ToArray();
List<int> biggestDigits = new();
// Get the 12 biggest digits
for (int i = 0; i < 12; i++)
{
// Find the biggest number in the digits array (excluding the remaining 11-0 digits), and its position
int biggestDigit = digits[..^(11 - i)].Max();
int biggestDigitPosition = Array.IndexOf(digits, biggestDigit);
// Ignore any digits before and including the biggest digit, then find the next biggest
digits = digits.Skip(biggestDigitPosition + 1).ToArray();
biggestDigits.Add(biggestDigit);
}
StringBuilder sb = new();
foreach (int digit in biggestDigits)
{
sb.Append(digit);
}
long maxJoltage = long.Parse(sb.ToString());
maxJoltages.Add(maxJoltage);
}
long result = maxJoltages.Sum();
if (expected != null)
{
Assert.That(result, Is.EqualTo(expected.Value));
}
Console.WriteLine($"Part 2: {result}");
}
}
+134
View File
@@ -0,0 +1,134 @@
using AOC.Helpers;
namespace AOC.Tests.Y2025;
[TestFixture]
[Parallelizable(ParallelScope.All)]
public class Day04
{
[SetUp]
public void Setup()
{
realData = File.ReadAllLines(Path.Combine(TestContext.CurrentContext.TestDirectory, "Y2025", "Data",
$"{GetThisClassName()}.dat"));
}
protected string GetThisClassName() { return GetType().Name; }
private string[] realData;
[TestCase(@"..@@.@@@@.
@@@.@.@.@@
@@@@@.@.@@
@.@@@@..@.
@@.@@@@.@@
.@@@@@@@.@
.@.@.@.@@@
@.@@@.@@@@
.@@@@@@@@.
@.@.@@@.@.", 13)]
[TestCase(null, 1451)] // The actual answer
public void Part1(string? input, int? expected)
{
// string[] lines = input != null ? new[] { input } : realData;
string[] lines = input != null ? input.Split("\n") : realData;
char[,] array = TwoDimensionalArrays.Make2DArrayFromStringArray(lines);
int rollsOfPaperThatCanBeAccessed = 0;
foreach ((int row, int column, char value) in TwoDimensionalArrays.Cells(array))
{
if (value != '@')
{
continue;
}
List<(int, int)> positionsWherePaperExists =
TwoDimensionalArrays.CheckAllSurroundingCellsForCharacter(array, row, column, '@');
if (positionsWherePaperExists.Count < 4)
{
rollsOfPaperThatCanBeAccessed++;
}
}
int result = rollsOfPaperThatCanBeAccessed;
if (expected != null)
{
Assert.That(result, Is.EqualTo(expected.Value));
}
Console.WriteLine($"Part 1: {result}");
}
[TestCase(@"..@@.@@@@.
@@@.@.@.@@
@@@@@.@.@@
@.@@@@..@.
@@.@@@@.@@
.@@@@@@@.@
.@.@.@.@@@
@.@@@.@@@@
.@@@@@@@@.
@.@.@@@.@.", 43)]
[TestCase(null, 8701)] // The actual answer
public void Part2(string? input, int? expected)
{
//string[] lines = input != null ? new[] { input } : realData;
string[] lines = input != null ? input.Split("\n") : realData;
char[,] array = TwoDimensionalArrays.Make2DArrayFromStringArray(lines);
int totalRollsOfPaperRemoved = 0;
int rollsOfPaperAccessed = 0;
bool continueLoop = true;
while (continueLoop)
{
List<(int, int)> positionsToRemovePaper = new();
foreach ((int row, int column, char value) in TwoDimensionalArrays.Cells(array))
{
if (value != '@')
{
continue;
}
List<(int, int)> positionsWherePaperExists =
TwoDimensionalArrays.CheckAllSurroundingCellsForCharacter(array, row, column, '@');
if (positionsWherePaperExists.Count < 4)
{
totalRollsOfPaperRemoved++;
rollsOfPaperAccessed++;
positionsToRemovePaper.Add((row, column));
}
}
if (rollsOfPaperAccessed == 0)
{
continueLoop = false;
}
rollsOfPaperAccessed = 0;
// Remove each roll
foreach ((int, int) position in positionsToRemovePaper)
{
array[position.Item1, position.Item2] = 'x';
}
positionsToRemovePaper.Clear();
}
int result = totalRollsOfPaperRemoved;
if (expected != null)
{
Assert.That(result, Is.EqualTo(expected.Value));
}
Console.WriteLine($"Part 2: {result}");
}
}
+149
View File
@@ -0,0 +1,149 @@
namespace AOC.Tests.Y2025;
[TestFixture]
[Parallelizable(ParallelScope.All)]
public class Day05
{
[SetUp]
public void Setup()
{
realData = File.ReadAllLines(Path.Combine(TestContext.CurrentContext.TestDirectory, "Y2025", "Data",
$"{GetThisClassName()}.dat"));
}
protected string GetThisClassName() { return GetType().Name; }
private string[] realData;
[TestCase(@"3-5
10-14
16-20
12-18
1
5
8
11
17
32", (long)3)]
[TestCase(null, (long)513)] // The actual answer
public void Part1(string? input, long? expected)
{
// string[] lines = input != null ? new[] { input } : realData;
string[] lines = input != null ? input.Split("\n") : realData;
bool isListOfValidIngredients = true;
List<(long Start, long End)> validRanges = new();
List<long> availableIngredients = new();
foreach (string line in lines)
{
if (string.IsNullOrEmpty(line))
{
isListOfValidIngredients = false;
continue;
}
if (isListOfValidIngredients)
{
string[] rangeNumbers = line.Split('-', 2);
long startNumber = long.Parse(rangeNumbers[0]);
long endNumber = long.Parse(rangeNumbers[1]);
validRanges.Add((startNumber, endNumber));
}
else
{
availableIngredients.Add(long.Parse(line));
}
}
// For each available ingredient, check if it falls in any valid range
long result = availableIngredients.Count(value =>
validRanges.Any(r => value >= r.Start && value <= r.End));
if (expected != null)
{
Assert.That(result, Is.EqualTo(expected.Value));
}
Console.WriteLine($"Part 1: {result}");
}
[TestCase(@"3-5
10-14
16-20
12-18
1
5
8
11
17
32", (long)14)]
[TestCase(null, (long)1783)] // The actual answer
public void Part2(string? input, long? expected)
{
//string[] lines = input != null ? new[] { input } : realData;
string[] lines = input != null ? input.Split("\n") : realData;
List<(long Start, long End)> validRanges = new();
foreach (string line in lines)
{
if (string.IsNullOrEmpty(line))
{
break;
}
string[] rangeNumbers = line.Split('-', 2);
long startNumber = long.Parse(rangeNumbers[0]);
long endNumber = long.Parse(rangeNumbers[1]);
validRanges.Add((startNumber, endNumber));
}
// Sort ranges by Start then End
validRanges.Sort((a, b) =>
{
int cmp = a.Start.CompareTo(b.Start);
return cmp != 0 ? cmp : a.End.CompareTo(b.End);
});
// Merge overlapping or adjacent ranges
List<(long Start, long End)> merged = new();
(long Start, long End) current = validRanges[0];
for (int i = 1; i < validRanges.Count; i++)
{
(long Start, long End) next = validRanges[i];
// overlapping or touching?
if (next.Start <= current.End + 1)
{
current = (current.Start, Math.Max(current.End, next.End));
}
else
{
merged.Add(current);
current = next;
}
}
merged.Add(current);
long result = 0;
foreach ((long start, long end) in merged)
{
// +1 because both ends are inclusive
result += end - start + 1;
}
if (expected != null)
{
Assert.That(result, Is.EqualTo(expected.Value));
}
Console.WriteLine($"Part 2: {result}");
}
}
+253
View File
@@ -0,0 +1,253 @@
using System.Diagnostics;
namespace AOC.Tests.Y2025;
[TestFixture]
[Parallelizable(ParallelScope.All)]
public class Day06
{
[SetUp]
public void Setup()
{
realData = File.ReadAllLines(Path.Combine(TestContext.CurrentContext.TestDirectory, "Y2025", "Data",
$"{GetThisClassName()}.dat"));
}
protected string GetThisClassName() { return GetType().Name; }
private string[] realData;
internal record Calculation(IReadOnlyList<long> Numbers, char Operation);
private List<Calculation> GetCalculations(string[] lines)
{
int numberRowCount = lines.Length - 1;
List<string[]> numberRows = new(numberRowCount);
// Split the number rows
for (int row = 0; row < numberRowCount; row++)
{
string[] parts = lines[row].Split(' ', StringSplitOptions.RemoveEmptyEntries);
numberRows.Add(parts);
}
// Split the operations row (last line)
string[] operations = lines[^1].Split(' ', StringSplitOptions.RemoveEmptyEntries);
int columnCount = numberRows[0].Length;
List<Calculation> calculations = new(columnCount);
for (int col = 0; col < columnCount; col++)
{
long[] numbers = new long[numberRowCount];
for (int row = 0; row < numberRowCount; row++)
{
numbers[row] = long.Parse(numberRows[row][col]);
}
char op = operations[col][0];
calculations.Add(new Calculation(numbers, op));
}
return calculations;
}
private List<Calculation> GetCalculationsVertically(string[] lines)
{
int rows = lines.Length;
if (rows == 0)
{
return new List<Calculation>();
}
// Make all lines the same width so indexing is safe
int columns = lines.Max(l => l.Length);
string[] grid = lines
.Select(l => l.PadRight(columns, ' '))
.ToArray();
int operatorRow = rows - 1;
List<Calculation> calculations = new();
int col = 0;
while (col < columns)
{
// Is this a separator column? (all spaces)
bool isSeparator = true;
for (int r = 0; r < rows; r++)
{
if (grid[r][col] != ' ')
{
isSeparator = false;
break;
}
}
if (isSeparator)
{
col++;
continue;
}
int startCol = col;
col++;
while (col < columns)
{
bool sep = true;
for (int r = 0; r < rows; r++)
{
if (grid[r][col] != ' ')
{
sep = false;
break;
}
}
if (sep)
{
break;
}
col++;
}
int endCol = col - 1;
// Operator is at the bottom of the leftmost column
char op = grid[operatorRow][startCol];
List<long> numbers = new();
// Read numbers right-to-left within the problem (endCol to startCol)
for (int c = endCol; c >= startCol; c--)
{
List<char> digits = new();
// Digits are from all rows above the operator row
for (int r = 0; r < operatorRow; r++)
{
char ch = grid[r][c];
if (char.IsDigit(ch))
{
digits.Add(ch);
}
}
long value = long.Parse(new string(digits.ToArray()));
numbers.Add(value);
}
calculations.Add(new Calculation(numbers, op));
}
return calculations;
}
[TestCase(@"123 328 51 64
45 64 387 23
6 98 215 314
* + * + ", (long)4277556)]
[TestCase(null, 5667835681547)] // The actual answer
public void Part1(string? input, long? expected)
{
// string[] lines = input != null ? new[] { input } : realData;
string[] lines = input != null ? input.Split("\n") : realData;
List<Calculation> calculations = GetCalculations(lines);
long runningTotal = 0;
foreach (Calculation c in calculations)
{
long answer = 0;
switch (c.Operation)
{
case '+':
answer = 0;
foreach (long n in c.Numbers)
{
answer += n;
}
break;
case '*':
answer = 1;
foreach (long n in c.Numbers)
{
answer *= n;
}
break;
}
runningTotal += answer;
}
long result = runningTotal;
if (expected != null)
{
Assert.That(result, Is.EqualTo(expected.Value));
}
Console.WriteLine($"Part 1: {result}");
}
[TestCase(@"123 328 51 64
45 64 387 23
6 98 215 314
* + * + ", (long)3263827)]
[TestCase(null, 9434900032651)] // The actual answer
public void Part2(string? input, long? expected)
{
//string[] lines = input != null ? new[] { input } : realData;
string[] lines = input != null ? input.Split("\n") : realData;
List<Calculation> calculations = GetCalculationsVertically(lines);
long runningTotal = 0;
foreach (Calculation c in calculations)
{
long answer = 0;
switch (c.Operation)
{
case '+':
answer = 0;
foreach (long n in c.Numbers)
{
answer += n;
}
break;
case '*':
answer = 1;
foreach (long n in c.Numbers)
{
answer *= n;
}
break;
}
runningTotal += answer;
Debug.WriteLine($"{c.Numbers} {c.Operation} {answer}");
}
long result = runningTotal;
if (expected != null)
{
Assert.That(result, Is.EqualTo(expected.Value));
}
Console.WriteLine($"Part 2: {result}");
}
}
@@ -0,0 +1,85 @@
--- Day 1: Secret Entrance ---
The Elves have good news and bad news.
The good news is that they've discovered project management! This has given them the tools they need to prevent their usual Christmas emergency. For example, they now know that the North Pole decorations need to be finished soon so that other critical tasks can start on time.
The bad news is that they've realized they have a different emergency: according to their resource planning, none of them have any time left to decorate the North Pole!
To save Christmas, the Elves need you to finish decorating the North Pole by December 12th.
Collect stars by solving puzzles. Two puzzles will be made available on each day; the second puzzle is unlocked when you complete the first. Each puzzle grants one star. Good luck!
You arrive at the secret entrance to the North Pole base ready to start decorating. Unfortunately, the password seems to have been changed, so you can't get in. A document taped to the wall helpfully explains:
"Due to new security protocols, the password is locked in the safe below. Please see the attached document for the new combination."
The safe has a dial with only an arrow on it; around the dial are the numbers 0 through 99 in order. As you turn the dial, it makes a small click noise as it reaches each number.
The attached document (your puzzle input) contains a sequence of rotations, one per line, which tell you how to open the safe. A rotation starts with an L or R which indicates whether the rotation should be to the left (toward lower numbers) or to the right (toward higher numbers). Then, the rotation has a distance value which indicates how many clicks the dial should be rotated in that direction.
So, if the dial were pointing at 11, a rotation of R8 would cause the dial to point at 19. After that, a rotation of L19 would cause it to point at 0.
Because the dial is a circle, turning the dial left from 0 one click makes it point at 99. Similarly, turning the dial right from 99 one click makes it point at 0.
So, if the dial were pointing at 5, a rotation of L10 would cause it to point at 95. After that, a rotation of R5 could cause it to point at 0.
The dial starts by pointing at 50.
You could follow the instructions, but your recent required official North Pole secret entrance security training seminar taught you that the safe is actually a decoy. The actual password is the number of times the dial is left pointing at 0 after any rotation in the sequence.
For example, suppose the attached document contained the following rotations:
L68
L30
R48
L5
R60
L55
L1
L99
R14
L82
Following these rotations would cause the dial to move as follows:
The dial starts by pointing at 50.
The dial is rotated L68 to point at 82.
The dial is rotated L30 to point at 52.
The dial is rotated R48 to point at 0.
The dial is rotated L5 to point at 95.
The dial is rotated R60 to point at 55.
The dial is rotated L55 to point at 0.
The dial is rotated L1 to point at 99.
The dial is rotated L99 to point at 0.
The dial is rotated R14 to point at 14.
The dial is rotated L82 to point at 32.
Because the dial points at 0 a total of three times during this process, the password in this example is 3.
Analyze the rotations in your attached document. What's the actual password to open the door?
--- Part Two ---
You're sure that's the right password, but the door won't open. You knock, but nobody answers. You build a snowman while you think.
As you're rolling the snowballs for your snowman, you find another security document that must have fallen into the snow:
"Due to newer security protocols, please use password method 0x434C49434B until further notice."
You remember from the training seminar that "method 0x434C49434B" means you're actually supposed to count the number of times any click causes the dial to point at 0, regardless of whether it happens during a rotation or at the end of one.
Following the same rotations as in the above example, the dial points at zero a few extra times during its rotations:
The dial starts by pointing at 50.
The dial is rotated L68 to point at 82; during this rotation, it points at 0 once.
The dial is rotated L30 to point at 52.
The dial is rotated R48 to point at 0.
The dial is rotated L5 to point at 95.
The dial is rotated R60 to point at 55; during this rotation, it points at 0 once.
The dial is rotated L55 to point at 0.
The dial is rotated L1 to point at 99.
The dial is rotated L99 to point at 0.
The dial is rotated R14 to point at 14.
The dial is rotated L82 to point at 32; during this rotation, it points at 0 once.
In this example, the dial points at 0 three times at the end of a rotation, plus three more times during a rotation. So, in this example, the new password would be 6.
Be careful: if the dial were pointing at 50, a single rotation like R1000 would cause the dial to point at 0 ten times before returning back to 50!
Using password method 0x434C49434B, what is the password to open the door?
@@ -0,0 +1,57 @@
--- Day 2: Gift Shop ---
You get inside and take the elevator to its only other stop: the gift shop. "Thank you for visiting the North Pole!" gleefully exclaims a nearby sign. You aren't sure who is even allowed to visit the North Pole, but you know you can access the lobby through here, and from there you can access the rest of the North Pole base.
As you make your way through the surprisingly extensive selection, one of the clerks recognizes you and asks for your help.
As it turns out, one of the younger Elves was playing on a gift shop computer and managed to add a whole bunch of invalid product IDs to their gift shop database! Surely, it would be no trouble for you to identify the invalid product IDs for them, right?
They've even checked most of the product ID ranges already; they only have a few product ID ranges (your puzzle input) that you'll need to check. For example:
11-22,95-115,998-1012,1188511880-1188511890,222220-222224,
1698522-1698528,446443-446449,38593856-38593862,565653-565659,
824824821-824824827,2121212118-2121212124
(The ID ranges are wrapped here for legibility; in your input, they appear on a single long line.)
The ranges are separated by commas (,); each range gives its first ID and last ID separated by a dash (-).
Since the young Elf was just doing silly patterns, you can find the invalid IDs by looking for any ID which is made only of some sequence of digits repeated twice. So, 55 (5 twice), 6464 (64 twice), and 123123 (123 twice) would all be invalid IDs.
None of the numbers have leading zeroes; 0101 isn't an ID at all. (101 is a valid ID that you would ignore.)
Your job is to find all of the invalid IDs that appear in the given ranges. In the above example:
11-22 has two invalid IDs, 11 and 22.
95-115 has one invalid ID, 99.
998-1012 has one invalid ID, 1010.
1188511880-1188511890 has one invalid ID, 1188511885.
222220-222224 has one invalid ID, 222222.
1698522-1698528 contains no invalid IDs.
446443-446449 has one invalid ID, 446446.
38593856-38593862 has one invalid ID, 38593859.
The rest of the ranges contain no invalid IDs.
Adding up all the invalid IDs in this example produces 1227775554.
What do you get if you add up all of the invalid IDs?
--- Part Two ---
The clerk quickly discovers that there are still invalid IDs in the ranges in your list. Maybe the young Elf was doing other silly patterns as well?
Now, an ID is invalid if it is made only of some sequence of digits repeated at least twice. So, 12341234 (1234 two times), 123123123 (123 three times), 1212121212 (12 five times), and 1111111 (1 seven times) are all invalid IDs.
From the same example as before:
11-22 still has two invalid IDs, 11 and 22.
95-115 now has two invalid IDs, 99 and 111.
998-1012 now has two invalid IDs, 999 and 1010.
1188511880-1188511890 still has one invalid ID, 1188511885.
222220-222224 still has one invalid ID, 222222.
1698522-1698528 still contains no invalid IDs.
446443-446449 still has one invalid ID, 446446.
38593856-38593862 still has one invalid ID, 38593859.
565653-565659 now has one invalid ID, 565656.
824824821-824824827 now has one invalid ID, 824824824.
2121212118-2121212124 now has one invalid ID, 2121212121.
Adding up all the invalid IDs in this example produces 4174379265.
What do you get if you add up all of the invalid IDs using these new rules?
@@ -0,0 +1,50 @@
--- Day 3: Lobby ---
You descend a short staircase, enter the surprisingly vast lobby, and are quickly cleared by the security checkpoint. When you get to the main elevators, however, you discover that each one has a red light above it: they're all offline.
"Sorry about that," an Elf apologizes as she tinkers with a nearby control panel. "Some kind of electrical surge seems to have fried them. I'll try to get them online soon."
You explain your need to get further underground. "Well, you could at least take the escalator down to the printing department, not that you'd get much further than that without the elevators working. That is, you could if the escalator weren't also offline."
"But, don't worry! It's not fried; it just needs power. Maybe you can get it running while I keep working on the elevators."
There are batteries nearby that can supply emergency power to the escalator for just such an occasion. The batteries are each labeled with their joltage rating, a value from 1 to 9. You make a note of their joltage ratings (your puzzle input). For example:
987654321111111
811111111111119
234234234234278
818181911112111
The batteries are arranged into banks; each line of digits in your input corresponds to a single bank of batteries. Within each bank, you need to turn on exactly two batteries; the joltage that the bank produces is equal to the number formed by the digits on the batteries you've turned on. For example, if you have a bank like 12345 and you turn on batteries 2 and 4, the bank would produce 24 jolts. (You cannot rearrange batteries.)
You'll need to find the largest possible joltage each bank can produce. In the above example:
In 987654321111111, you can make the largest joltage possible, 98, by turning on the first two batteries.
In 811111111111119, you can make the largest joltage possible by turning on the batteries labeled 8 and 9, producing 89 jolts.
In 234234234234278, you can make 78 by turning on the last two batteries (marked 7 and 8).
In 818181911112111, the largest joltage you can produce is 92.
The total output joltage is the sum of the maximum joltage from each bank, so in this example, the total output joltage is 98 + 89 + 78 + 92 = 357.
There are many batteries in front of you. Find the maximum joltage possible from each bank; what is the total output joltage?
--- Part Two ---
The escalator doesn't move. The Elf explains that it probably needs more joltage to overcome the static friction of the system and hits the big red "joltage limit safety override" button. You lose count of the number of times she needs to confirm "yes, I'm sure" and decorate the lobby a bit while you wait.
Now, you need to make the largest joltage by turning on exactly twelve batteries within each bank.
The joltage output for the bank is still the number formed by the digits of the batteries you've turned on; the only difference is that now there will be 12 digits in each bank's joltage output instead of two.
Consider again the example from before:
987654321111111
811111111111119
234234234234278
818181911112111
Now, the joltages are much larger:
In 987654321111111, the largest joltage can be found by turning on everything except some 1s at the end to produce 987654321111.
In the digit sequence 811111111111119, the largest joltage can be found by turning on everything except some 1s, producing 811111111119.
In 234234234234278, the largest joltage can be found by turning on everything except a 2 battery, a 3 battery, and another 2 battery near the start to produce 434234234278.
In 818181911112111, the joltage 888911112111 is produced by turning on everything except some 1s near the front.
The total output joltage is now much larger: 987654321111 + 811111111119 + 434234234278 + 888911112111 = 3121910778619.
What is the new total output joltage?
@@ -0,0 +1,168 @@
--- Day 4: Printing Department ---
You ride the escalator down to the printing department. They're clearly getting ready for Christmas; they have lots of large rolls of paper everywhere, and there's even a massive printer in the corner (to handle the really big print jobs).
Decorating here will be easy: they can make their own decorations. What you really need is a way to get further into the North Pole base while the elevators are offline.
"Actually, maybe we can help with that," one of the Elves replies when you ask for help. "We're pretty sure there's a cafeteria on the other side of the back wall. If we could break through the wall, you'd be able to keep moving. It's too bad all of our forklifts are so busy moving those big rolls of paper around."
If you can optimize the work the forklifts are doing, maybe they would have time to spare to break through the wall.
The rolls of paper (@) are arranged on a large grid; the Elves even have a helpful diagram (your puzzle input) indicating where everything is located.
For example:
..@@.@@@@.
@@@.@.@.@@
@@@@@.@.@@
@.@@@@..@.
@@.@@@@.@@
.@@@@@@@.@
.@.@.@.@@@
@.@@@.@@@@
.@@@@@@@@.
@.@.@@@.@.
The forklifts can only access a roll of paper if there are fewer than four rolls of paper in the eight adjacent positions. If you can figure out which rolls of paper the forklifts can access, they'll spend less time looking and more time breaking down the wall to the cafeteria.
In this example, there are 13 rolls of paper that can be accessed by a forklift (marked with x):
..xx.xx@x.
x@@.@.@.@@
@@@@@.x.@@
@.@@@@..@.
x@.@@@@.@x
.@@@@@@@.@
.@.@.@.@@@
x.@@@.@@@@
.@@@@@@@@.
x.x.@@@.x.
Consider your complete diagram of the paper roll locations. How many rolls of paper can be accessed by a forklift?
--- Part Two ---
Now, the Elves just need help accessing as much of the paper as they can.
Once a roll of paper can be accessed by a forklift, it can be removed. Once a roll of paper is removed, the forklifts might be able to access more rolls of paper, which they might also be able to remove. How many total rolls of paper could the Elves remove if they keep repeating this process?
Starting with the same example as above, here is one way you could remove as many rolls of paper as possible, using highlighted @ to indicate that a roll of paper is about to be removed, and using x to indicate that a roll of paper was just removed:
Initial state:
..@@.@@@@.
@@@.@.@.@@
@@@@@.@.@@
@.@@@@..@.
@@.@@@@.@@
.@@@@@@@.@
.@.@.@.@@@
@.@@@.@@@@
.@@@@@@@@.
@.@.@@@.@.
Remove 13 rolls of paper:
..xx.xx@x.
x@@.@.@.@@
@@@@@.x.@@
@.@@@@..@.
x@.@@@@.@x
.@@@@@@@.@
.@.@.@.@@@
x.@@@.@@@@
.@@@@@@@@.
x.x.@@@.x.
Remove 12 rolls of paper:
.......x..
.@@.x.x.@x
x@@@@...@@
x.@@@@..x.
.@.@@@@.x.
.x@@@@@@.x
.x.@.@.@@@
..@@@.@@@@
.x@@@@@@@.
....@@@...
Remove 7 rolls of paper:
..........
.x@.....x.
.@@@@...xx
..@@@@....
.x.@@@@...
..@@@@@@..
...@.@.@@x
..@@@.@@@@
..x@@@@@@.
....@@@...
Remove 5 rolls of paper:
..........
..x.......
.x@@@.....
..@@@@....
...@@@@...
..x@@@@@..
...@.@.@@.
..x@@.@@@x
...@@@@@@.
....@@@...
Remove 2 rolls of paper:
..........
..........
..x@@.....
..@@@@....
...@@@@...
...@@@@@..
...@.@.@@.
...@@.@@@.
...@@@@@x.
....@@@...
Remove 1 roll of paper:
..........
..........
...@@.....
..x@@@....
...@@@@...
...@@@@@..
...@.@.@@.
...@@.@@@.
...@@@@@..
....@@@...
Remove 1 roll of paper:
..........
..........
...x@.....
...@@@....
...@@@@...
...@@@@@..
...@.@.@@.
...@@.@@@.
...@@@@@..
....@@@...
Remove 1 roll of paper:
..........
..........
....x.....
...@@@....
...@@@@...
...@@@@@..
...@.@.@@.
...@@.@@@.
...@@@@@..
....@@@...
Remove 1 roll of paper:
..........
..........
..........
...x@@....
...@@@@...
...@@@@@..
...@.@.@@.
...@@.@@@.
...@@@@@..
....@@@...
Stop once no more rolls of paper are accessible by a forklift. In this example, a total of 43 rolls of paper can be removed.
Start with your original diagram. How many rolls of paper in total can be removed by the Elves and their forklifts?
@@ -0,0 +1,51 @@
--- Day 5: Cafeteria ---
As the forklifts break through the wall, the Elves are delighted to discover that there was a cafeteria on the other side after all.
You can hear a commotion coming from the kitchen. "At this rate, we won't have any time left to put the wreaths up in the dining hall!" Resolute in your quest, you investigate.
"If only we hadn't switched to the new inventory management system right before Christmas!" another Elf exclaims. You ask what's going on.
The Elves in the kitchen explain the situation: because of their complicated new inventory management system, they can't figure out which of their ingredients are fresh and which are spoiled. When you ask how it works, they give you a copy of their database (your puzzle input).
The database operates on ingredient IDs. It consists of a list of fresh ingredient ID ranges, a blank line, and a list of available ingredient IDs. For example:
3-5
10-14
16-20
12-18
1
5
8
11
17
32
The fresh ID ranges are inclusive: the range 3-5 means that ingredient IDs 3, 4, and 5 are all fresh. The ranges can also overlap; an ingredient ID is fresh if it is in any range.
The Elves are trying to determine which of the available ingredient IDs are fresh. In this example, this is done as follows:
Ingredient ID 1 is spoiled because it does not fall into any range.
Ingredient ID 5 is fresh because it falls into range 3-5.
Ingredient ID 8 is spoiled.
Ingredient ID 11 is fresh because it falls into range 10-14.
Ingredient ID 17 is fresh because it falls into range 16-20 as well as range 12-18.
Ingredient ID 32 is spoiled.
So, in this example, 3 of the available ingredient IDs are fresh.
Process the database file from the new inventory management system. How many of the available ingredient IDs are fresh?
--- Part Two ---
The Elves start bringing their spoiled inventory to the trash chute at the back of the kitchen.
So that they can stop bugging you when they get new inventory, the Elves would like to know all of the IDs that the fresh ingredient ID ranges consider to be fresh. An ingredient ID is still considered fresh if it is in any range.
Now, the second section of the database (the available ingredient IDs) is irrelevant. Here are the fresh ingredient ID ranges from the above example:
3-5
10-14
16-20
12-18
The ingredient IDs that these ranges consider to be fresh are 3, 4, 5, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, and 20. So, in this example, the fresh ingredient ID ranges consider a total of 14 ingredient IDs to be fresh.
Process the database file again. How many ingredient IDs are considered to be fresh according to the fresh ingredient ID ranges?
@@ -0,0 +1,49 @@
--- Day 6: Trash Compactor ---
After helping the Elves in the kitchen, you were taking a break and helping them re-enact a movie scene when you over-enthusiastically jumped into the garbage chute!
A brief fall later, you find yourself in a garbage smasher. Unfortunately, the door's been magnetically sealed.
As you try to find a way out, you are approached by a family of cephalopods! They're pretty sure they can get the door open, but it will take some time. While you wait, they're curious if you can help the youngest cephalopod with her math homework.
Cephalopod math doesn't look that different from normal math. The math worksheet (your puzzle input) consists of a list of problems; each problem has a group of numbers that need to be either added (+) or multiplied (*) together.
However, the problems are arranged a little strangely; they seem to be presented next to each other in a very long horizontal list. For example:
123 328 51 64
45 64 387 23
6 98 215 314
* + * +
Each problem's numbers are arranged vertically; at the bottom of the problem is the symbol for the operation that needs to be performed. Problems are separated by a full column of only spaces. The left/right alignment of numbers within each problem can be ignored.
So, this worksheet contains four problems:
123 * 45 * 6 = 33210
328 + 64 + 98 = 490
51 * 387 * 215 = 4243455
64 + 23 + 314 = 401
To check their work, cephalopod students are given the grand total of adding together all of the answers to the individual problems. In this worksheet, the grand total is 33210 + 490 + 4243455 + 401 = 4277556.
Of course, the actual worksheet is much wider. You'll need to make sure to unroll it completely so that you can read the problems clearly.
Solve the problems on the math worksheet. What is the grand total found by adding together all of the answers to the individual problems?
--- Part Two ---
The big cephalopods come back to check on how things are going. When they see that your grand total doesn't match the one expected by the worksheet, they realize they forgot to explain how to read cephalopod math.
Cephalopod math is written right-to-left in columns. Each number is given in its own column, with the most significant digit at the top and the least significant digit at the bottom. (Problems are still separated with a column consisting only of spaces, and the symbol at the bottom of the problem is still the operator to use.)
Here's the example worksheet again:
123 328 51 64
45 64 387 23
6 98 215 314
* + * +
Reading the problems right-to-left one column at a time, the problems are now quite different:
The rightmost problem is 4 + 431 + 623 = 1058
The second problem from the right is 175 * 581 * 32 = 3253600
The third problem from the right is 8 + 248 + 369 = 625
Finally, the leftmost problem is 356 * 24 * 1 = 8544
Now, the grand total is 1058 + 3253600 + 625 + 8544 = 3263827.
Solve the problems on the math worksheet again. What is the grand total found by adding together all of the answers to the individual problems?
+6
View File
@@ -7,6 +7,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AOC.Tests", "AOC.Tests\AOC.
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DayCreator", "DayCreator\DayCreator.csproj", "{BBA91797-9C84-4A8D-9C12-9AE4D3C3EF83}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DayCreator", "DayCreator\DayCreator.csproj", "{BBA91797-9C84-4A8D-9C12-9AE4D3C3EF83}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AOC.Helpers", "AOC.Helpers\AOC.Helpers.csproj", "{63782BBE-C14A-407A-9980-CD31088D4CD3}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@@ -21,6 +23,10 @@ Global
{BBA91797-9C84-4A8D-9C12-9AE4D3C3EF83}.Debug|Any CPU.Build.0 = Debug|Any CPU {BBA91797-9C84-4A8D-9C12-9AE4D3C3EF83}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BBA91797-9C84-4A8D-9C12-9AE4D3C3EF83}.Release|Any CPU.ActiveCfg = Release|Any CPU {BBA91797-9C84-4A8D-9C12-9AE4D3C3EF83}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BBA91797-9C84-4A8D-9C12-9AE4D3C3EF83}.Release|Any CPU.Build.0 = Release|Any CPU {BBA91797-9C84-4A8D-9C12-9AE4D3C3EF83}.Release|Any CPU.Build.0 = Release|Any CPU
{63782BBE-C14A-407A-9980-CD31088D4CD3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{63782BBE-C14A-407A-9980-CD31088D4CD3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{63782BBE-C14A-407A-9980-CD31088D4CD3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{63782BBE-C14A-407A-9980-CD31088D4CD3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@@ -1,6 +1,16 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> <wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAssert_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003FLibrary_003FApplication_0020Support_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003F98514e314f1feddb3082dbe8507ecec1a81b6491c0db7dc53c2e8c13949e4360_003FAssert_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=0c7a82d2_002D8845_002D443d_002Db134_002D726f0b837c61/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="Day06" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;
&lt;TestAncestor&gt;
&lt;TestId&gt;NUnit3x::2E0193E1-5DD3-40A6-A07B-C6E58341ACA0::net8.0::AOC.Tests.Y2025.Day06&lt;/TestId&gt;
&lt;/TestAncestor&gt;
&lt;/SessionState&gt;</s:String>
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=8ddce0d5_002Db323_002D41bb_002Da920_002D6cc320742199/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="All tests from Y2024" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt; <s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=8ddce0d5_002Db323_002D41bb_002Da920_002D6cc320742199/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="All tests from Y2024" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;
&lt;ProjectFolder&gt;2E0193E1-5DD3-40A6-A07B-C6E58341ACA0/d:Y2024&lt;/ProjectFolder&gt; &lt;ProjectFolder&gt;2E0193E1-5DD3-40A6-A07B-C6E58341ACA0/d:Y2024&lt;/ProjectFolder&gt;
&lt;/SessionState&gt;</s:String></wpf:ResourceDictionary> &lt;/SessionState&gt;</s:String>
</wpf:ResourceDictionary>
+16
View File
@@ -0,0 +1,16 @@
After feeling like you've been falling for a few minutes, you look at the device's tiny screen. "Error: Device must be calibrated before first use. Frequency drift detected. Cannot maintain destination lock." Below the message, the device shows a sequence of changes in frequency (your puzzle input). A value like +6 means the current frequency increases by 6; a value like -3 means the current frequency decreases by 3.
For example, if the device displays frequency changes of +1, -2, +3, +1, then starting from a frequency of zero, the following changes would occur:
Current frequency 0, change of +1; resulting frequency 1.
Current frequency 1, change of -2; resulting frequency -1.
Current frequency -1, change of +3; resulting frequency 2.
Current frequency 2, change of +1; resulting frequency 3.
In this example, the resulting frequency is 3.
Here are other example situations:
+1, +1, +1 results in 3
+1, +1, -2 results in 0
-1, -2, -3 results in -6
Starting with a frequency of zero, what is the resulting frequency after all of the changes in frequency have been applied?
+20
View File
@@ -0,0 +1,20 @@
You notice that the device repeats the same frequency change list over and over. To calibrate the device, you need to find the first frequency it reaches twice.
For example, using the same list of changes above, the device would loop as follows:
Current frequency 0, change of +1; resulting frequency 1.
Current frequency 1, change of -2; resulting frequency -1.
Current frequency -1, change of +3; resulting frequency 2.
Current frequency 2, change of +1; resulting frequency 3.
(At this point, the device continues from the start of the list.)
Current frequency 3, change of +1; resulting frequency 4.
Current frequency 4, change of -2; resulting frequency 2, which has already been seen.
In this example, the first frequency reached twice is 2. Note that your device might need to repeat its list of frequency changes many times before a duplicate frequency is found, and that duplicates might be found while in the middle of processing the list.
Here are other examples:
+1, -1 first reaches 0 twice.
+3, +3, +4, -2, -4 first reaches 10 twice.
-6, +3, +8, +5, -6 first reaches 5 twice.
+7, +7, -2, -7, -4 first reaches 14 twice.
What is the first frequency your device reaches twice?
+977
View File
@@ -0,0 +1,977 @@
-12
-6
-12
+1
+3
+3
-1
+10
-8
-9
-11
-2
-7
+15
+16
+14
-2
-5
+11
-8
-5
-1
-19
-14
+6
-16
-8
-13
-19
-11
+3
-19
+3
-19
+9
-15
-11
+18
-9
+13
-17
-16
-13
-16
+19
+17
-18
-8
-5
+6
+9
+8
-7
-8
+2
-9
+2
-9
-5
-3
+4
-13
-5
+11
+14
+5
+17
-1
+9
+6
+14
-9
+4
-3
-13
-5
+13
-2
-10
-18
-12
+4
+13
-10
-11
-10
-17
-13
+12
-19
-7
-13
+5
-8
-11
+5
+7
+17
-14
+22
+14
+7
-8
+7
-19
+14
-20
+16
+12
+3
+5
+1
-8
+1
+15
+3
-6
-8
+9
+3
-19
-19
-19
+1
-16
-13
+5
-13
+2
-15
-15
-4
+12
+1
-10
-5
-11
-9
-11
-7
+10
-18
+16
-12
-19
-17
-18
+2
+15
+11
+9
-17
+4
+9
-18
-6
-1
-1
-18
-15
-18
-7
+16
+18
+18
-2
-4
+1
+15
+16
+18
+7
-18
+6
+8
+15
-8
-16
-3
+11
+9
+1
+4
-18
+3
-16
-14
-18
-10
+6
-12
-12
-2
-8
+1
-3
-11
+1
-5
-4
-5
+8
+8
-4
-10
+16
-1
+3
+9
+6
+24
+12
-2
+11
-1
-9
+21
-15
+12
+19
-3
+21
+20
+16
-4
+15
+9
+13
-16
+13
-1
-16
+13
+19
+14
+19
+14
-17
+18
+1
+11
+18
+18
+22
-8
+18
-1
+19
-11
-20
+11
+8
-11
+25
+13
+3
-1
-3
+17
+15
+7
+19
-7
+19
-1
-12
-14
+17
-15
-1
-18
+9
+14
-19
+10
-9
-11
+7
+20
+20
-1
+19
+1
+7
-19
-15
+3
+1
+17
+11
-7
+15
-7
-10
+13
-24
-21
-4
-4
-14
+6
+3
-25
+9
-7
+15
+12
+14
+20
-11
-11
-15
-14
-9
-2
-2
-3
-1
-18
-2
+6
+17
+9
-1
+18
+20
+21
+27
-17
-11
-4
-18
+24
+33
+4
+12
+8
+8
-1
-17
+6
-18
+16
+4
+1
+6
-1
-11
+18
+15
+17
-4
+13
+1
-20
+18
+3
-16
-4
-12
-10
+8
-18
+22
+21
+12
+1
+6
-24
+7
+1
+11
+14
+20
-5
-2
+4
+9
-20
+60
+15
+18
+14
-19
+13
+3
+7
+8
+5
-14
-13
+20
+5
-1
-15
+29
+14
-19
+7
-10
+13
+3
-7
-2
-19
+8
-15
-13
-13
-1
-9
-14
+10
-9
+18
-3
-12
-7
+21
+2
+7
+7
+10
-15
-16
-6
-8
-18
+11
+13
+7
+10
-14
-14
+17
+22
+23
+15
-4
+32
+7
-5
-3
-10
-14
+9
+12
+10
-12
+17
+1
-19
+16
+14
-2
+1
-7
+17
+16
-8
-15
+18
+19
+14
+52
+8
-22
-2
-2
+13
+6
-4
+2
+20
-14
-73
+119
+20
+26
+4
+9
+14
-42
-18
+44
+18
-23
+77
-11
+15
+52
+29
-7
-11
+31
-29
+5
-20
+435
+15
-156
+71279
-19
-2
+11
-4
-1
-15
+8
+14
+19
-16
-13
+19
+3
-7
-1
-12
-15
-14
-2
+14
+8
-1
-1
-7
-2
-4
-8
-8
+7
+10
-14
-2
-13
-1
+8
-14
-9
+1
+17
-11
-13
+10
+9
+17
-18
-1
+10
-7
+11
-3
+10
+1
+8
-7
+26
+17
-16
-12
+22
-16
+9
-17
-7
+3
+13
-18
+8
+6
+15
+19
+7
+7
-18
+15
+14
+3
+10
-3
+2
+8
+9
-6
+10
+1
+15
-3
-11
+5
-8
-15
+11
-3
-19
-15
-10
+12
-8
+7
+2
+8
+3
-18
+3
-2
-5
-7
+21
+4
-6
+1
+3
+15
-16
+24
+15
-16
-2
-11
+10
-11
+17
+15
+8
+11
+21
+5
+12
+13
-15
-16
-14
+2
-11
+14
-13
+12
-17
+6
-13
+9
-1
+20
-18
-18
-21
-6
+21
+13
-12
-15
-5
+39
+20
+13
+6
-1
+12
+1
-3
+14
-5
-3
+17
+12
-13
+18
+16
-12
-16
-9
+5
-7
-1
-17
-4
-8
+5
-13
+9
-19
+15
+13
-19
-15
-2
+14
-2
-8
+2
+15
-5
-13
+19
+21
+3
+11
-17
+12
+17
+19
-16
+17
+5
-10
+13
+3
-8
+18
-8
-9
-11
+5
-11
-10
-19
+7
-3
-7
-11
+26
-10
+16
+13
-10
+5
+7
-16
+22
-9
-6
+40
-13
+7
-9
+20
+7
+8
-6
+3
-10
-14
+10
-2
+15
-3
+2
+17
+4
+3
+13
+15
-8
+16
+9
-10
+7
+4
+9
-4
+1
-13
-1
+10
-19
+20
-8
-9
-6
-15
-8
+11
+17
+9
-7
-17
-7
+9
+4
-7
+6
+9
-13
-5
-8
+6
-2
-16
+10
-15
+7
+4
+3
-2
+6
-14
-12
-10
+11
-10
+2
-15
-6
+8
-6
-4
+22
-6
+17
+8
+6
-8
-4
-21
-7
+2
+9
-26
-6
+5
-20
-38
-4
-45
-15
+14
-3
-12
+22
+12
-15
+29
-95
-15
-3
+1
-31
-22
-17
-7
-15
-5
+2
-3
+15
+12
-5
-10
+1
+7
-6
+17
+2
+2
-19
-7
+15
-6
-7
-1
+7
-12
-6
-18
-14
+6
-4
-16
-13
+5
-13
+4
+16
-8
+13
+11
-2
-7
-5
-8
+1
+9
+6
-2
+19
-4
+5
+10
+2
-9
+10
-15
+7
+11
+6
-14
-11
-6
+3
-16
-19
-6
-3
-3
-11
+19
+16
-10
+14
+15
+2
+15
+21
+15
+7
+19
+2
+52
+13
+24
-32
-126
-18
+1
-17
-14
-14
+3
-19
-17
+13
+17
-20
-1
+17
+2
+14
-7
-8
+12
-1
-14
+1
+26
-14
-17
+3
-17
+13
-3
+5
-7
+20
-2
+24
+20
-13
-19
-22
-19
+12
+35
+5
+34
+8
+2
+11
-2
-1
+13
-9
-7
-2
-28
-33
-71491
+9
View File
@@ -0,0 +1,9 @@
+3
+12
-6
-2
-4
-12
+4
+5
-7
+17
View File
@@ -0,0 +1,17 @@
// AdventOfCode2018-01
var fs = require('fs');
var frequency = 0;
var textFile = fs.readFileSync('./input.txt').toString();
var textArray = textFile.split(/\r?\n/);
textArray.forEach(line => {
if (line.substr(0,1) == '+') {
frequency += parseInt(line.substr(1));
}
else {
frequency -= parseInt(line.substr(1));
}
});
console.log('The resulting frequency is ' + frequency);
@@ -0,0 +1,50 @@
// AdventOfCode2018-01
var freqChanges = [];
function parseInput(inputFile) {
// for each line in text file parse the symbol (first character) and the number into an array of objects
var fs = require('fs'),
readline = require('readline'),
instream = fs.createReadStream(inputFile),
outstream = new (require('stream'))(),
rl = readline.createInterface(instream, outstream);
rl.on('line', function (line) {
var object = {
operation: line.substr(0,1),
value: parseInt(line.substr(1))
}
freqChanges.push(object);
});
rl.on('close', function (line) {
//console.log(line);
//console.log('done reading file.');
});
}
parseInput('./input1.txt');
// Starting from zero, loop through all the entries in the array and apply the operations
var frequency = 0;
console.log('length=' + freqChanges.length);
freqChanges.forEach( function (object) {
console.log('Object contains ' + object.toString());
if (object.operation == '+') {
frequency += object.value;
}
else {
frequency -= object.value;
}
});
// for (i in freqChanges) { //(var i = 0; i < freqChanges.length; i++) {
// console.log(freqChanges[i].toString());
// if (freqChanges[i].operation = '+') {
// frequency += freqChanges[i].value;
// }
// else {
// frequency -= freqChanges[i].value;
// }
// }
console.log('The resulting frequency is ' + frequency);
@@ -0,0 +1,29 @@
// AdventOfCode2018-01
var frequency = 0;
// for each line in text file parse the symbol (first character) and the number into an array of objects
var fs = require('fs'),
readline = require('readline'),
instream = fs.createReadStream('./input1.txt'),
outstream = new (require('stream'))(),
rl = readline.createInterface(instream, outstream);
rl.on('line', function (line) {
console.log(line.substr(0,1));
if (line.substr(0,1) = '+') {
console.log(parseInt(line.substr(1)));
frequency += parseInt(line.substr(1));
}
else {
console.log(parseInt(line.substr(1)));
frequency -= parseInt(line.substr(1));
}
});
rl.on('close', function (line) {
//console.log(line);
//console.log('done reading file.');
});
console.log('The resulting frequency is ' + frequency);
+33
View File
@@ -0,0 +1,33 @@
// AdventOfCode2018-01
var fs = require('fs');
var frequency = 0;
var frequencyHistory = [];
var loopCount = 0;
var textFile = fs.readFileSync('./input.txt').toString();
var textArray = textFile.split(/\r?\n/);
var foundDuplicate = false;
while (!foundDuplicate) {
for (var line of textArray) {
if (line.substr(0,1) == '+') {
frequency += parseInt(line.substr(1));
}
else {
frequency -= parseInt(line.substr(1));
}
//console.log(frequency.toString());
if (frequencyHistory.includes(frequency)) {
console.log('The first repeated frequency is ' + frequency);
firstRepeatedFrequency = frequency;
foundDuplicate = true;
break;
}
else {
frequencyHistory.push(frequency);
}
};
loopCount += 1;
}
console.log(loopCount);
+23
View File
@@ -0,0 +1,23 @@
--- Day 2: Inventory Management System ---
You stop falling through time, catch your breath, and check the screen on the device. "Destination reached. Current Year: 1518. Current Location: North Pole Utility Closet 83N10." You made it! Now, to find those anomalies.
Outside the utility closet, you hear footsteps and a voice. "...I'm not sure either. But now that so many people have chimneys, maybe he could sneak in that way?" Another voice responds, "Actually, we've been working on a new kind of suit that would let him fit through tight spaces like that. But, I heard that a few days ago, they lost the prototype fabric, the design plans, everything! Nobody on the team can even seem to remember important details of the project!"
"Wouldn't they have had enough fabric to fill several boxes in the warehouse? They'd be stored together, so the box IDs should be similar. Too bad it would take forever to search the warehouse for two similar box IDs..." They walk too far away to hear any more.
Late at night, you sneak to the warehouse - who knows what kinds of paradoxes you could cause if you were discovered - and use your fancy wrist device to quickly scan every box and produce a list of the likely candidates (your puzzle input).
To make sure you didn't miss any, you scan the likely candidate boxes again, counting the number that have an ID containing exactly two of any letter and then separately counting those with exactly three of any letter. You can multiply those two counts together to get a rudimentary checksum and compare it to what your device predicts.
For example, if you see the following box IDs:
abcdef contains no letters that appear exactly two or three times.
bababc contains two a and three b, so it counts for both.
abbcde contains two b, but no letter appears exactly three times.
abcccd contains three c, but no letter appears exactly two times.
aabcdd contains two a and two d, but it only counts once.
abcdee contains two e.
ababab contains three a and three b, but it only counts once.
Of these box IDs, four of them contain a letter which appears exactly twice, and three of them contain a letter which appears exactly three times. Multiplying these together produces a checksum of 4 * 3 = 12.
What is the checksum for your list of box IDs?
+15
View File
@@ -0,0 +1,15 @@
--- Part Two ---
Confident that your list of box IDs is complete, you're ready to find the boxes full of prototype fabric.
The boxes will have IDs which differ by exactly one character at the same position in both strings. For example, given the following box IDs:
abcde
fghij
klmno
pqrst
fguij
axcye
wvxyz
The IDs abcde and axcye are close, but they differ by two characters (the second and fourth). However, the IDs fghij and fguij differ by exactly one character, the third (h and u). Those must be the correct boxes.
What letters are common between the two correct box IDs? (In the example above, this is found by removing the differing character from either ID, producing fgij.)
+250
View File
@@ -0,0 +1,250 @@
mphcuiszrnjzxwkbgdzqeoyxfa
mihcuisgrnjzxwkbgdtqeoylia
mphauisvrnjgxwkbgdtqeiylfa
mphcuisnrnjzxwkbgdgqeoylua
mphcuisurnjzxwkbgdtqeoilfi
mkhcuisvrnjzowkbgdteeoylfa
mphcoicvrnjzxwksgdtqeoylfa
mxhcuisvrndzxwkbgdtqeeylfa
dphcuisijnjzxwkbgdtqeoylfa
mihvuisvrqjzxwkbgdtqeoylfa
mphcuisrrnvzxwkbgdtqeodlfa
mphtuisdrnjzxskbgdtqeoylfa
mphcutmvsnjzxwkbgdtqeoylfa
mphcunsvrnjzswkggdtqeoylfa
mphcuisvrwjzxwkbpdtqeoylfr
mphcujsdrnjzxwkbgdtqeovlfa
mpfcuisvrdjzxwkbgdtteoylfa
mppcuisvrpjzxwkbgdtqeoywfa
mphcuisvrnjzxwkbfptqroylfa
mphcuisvrnjzxwkbgstoeoysfa
mphcufsvrnjzcwkbgdeqeoylfa
mphcuissrnjzxwkbgdkquoylfa
sphcuxsvrnjzxwkbgdtqioylfa
mphcuiivrhjzxwkbgdtqevylfa
echcuisvrnjzxwkbgltqeoylfa
mphcuisvrljexwkbvdtqeoylfa
mpjcuisvrnjzxwkhidtqeoylfa
mphcuisvrfjzmwkbgdtqeoylfl
mwhcuisvrnjzxwkbgdtqeoytfm
mphcuisvrsjzxwkbgdaqeoylfh
mohcuisvrnjzxwkbgdtqtoymfa
maycuisvrnjzxwkbgdtqboylfa
pphcuisvqnjzxwkbgdtqeoylfd
mprcuisvrnjtxwmbgdtqeoylfa
mfhcuisgrnjzxckbgdtqeoylfa
mphiubsvrnjzxwkbgdtqeoyufa
dphctisvrnjzxwkbgdtqeoylfk
mphcuisvrnjznwksgdtqeoyzfa
mpwcuisvrnjziwkbgdtqaoylfa
mphduzsvrnjznwkbgdtqeoylfa
mphccisvrnjzxwebgdtqeoylqa
xphcuisvrnjzxwkfvdtqeoylfa
mphcupsvrnjzxwkbgdtfeoylpa
mphcuisvrtjzjwkbgdtqeoylfe
mpbcuisvrnjzxwkbgdmieoylfa
mphcuisvrnjzxwkbgjtqetylaa
mphcuisvrnjzxwpbgdtgdoylfa
ophcufsvrqjzxwkbgdtqeoylfa
iphcuhsvrnjzxwkbgetqeoylfa
mphcuisvunjzxwwbgdtqeoylqa
mphcpisvrnjzowkbgdtveoylfa
mphcuisvrnjzxhkbgdtqeotlla
mphcuisvrnjzxwkbodtgeoylha
mphcuisvrjjzxwkbwdtqtoylfa
mphcwisvrnjnxwkbgjtqeoylfa
mplcuicqrnjzxwkbgdtqeoylfa
mphcuisvrnjzxydbgdtqeoylfn
ophckisvrnjzxwkbgdtqeozlfa
mphcuisvrkjzxwkbgdtteoblfa
yphcuisvrnjcxwkbggtqeoylfa
mphcuisvrnazxwfbqdtqeoylfa
mphcuisvrmjzxwkbgdtlwoylfa
mphctksvrnjzxwibgdtqeoylfa
mphcuisprnjzxlebgdtqeoylfa
mphcuisnrnjzxakbgdtueoylfa
mphcuiavrnjoxwtbgdtqeoylfa
nphcuisvrnjzxwkbgdtqzoylfk
mphcuisrrnjmxwkbgdtqdoylfa
mphcuisvrujzxwkvgdtqehylfa
mphcuisvrnfzxwkogdtqebylfa
mphcuisvrnjwdwkbgdtqeoyxfa
mphcuisvrntzxwkrgxtqeoylfa
mpzcuisvrnjzxwebgdtqeoylsa
aphcuikvrnjzxwwbgdtqeoylfa
mphcqisvrnjzxwkpgdtqeoelfa
mphcuusvrnjzxwkbgdtjeodlfa
mphcuisvrnjzewkbgdtteoylza
mphcuisvanjzxwkbgdtheoylfc
mphcjishrnjzxwkbgltqeoylfa
mpxcuislrnjzxwkbgdtqeoynfa
mphcuisvrnjjxwkbgdtmeoxlfa
mphcimsvrnjzxwkbsdtqeoylfa
mphcxisvcnjzxwjbgdtqeoylfa
mphcuisbrvjzxwkbgdtqeoymfa
mplcuisvrnjzxwkbgdtaenylfa
mphcuihvrnjzxwkygytqeoylfa
mphcbisvrnjzxhkbgdtqezylfa
mphcuisarnjzxwkbgatqeoylfv
mphcumsvrnjzxwkbgdrqebylfa
mlhcuisvrnwzxwkbgdtqeoylfx
mpkcuisvrkjzxwkbgdtqeoylfo
mphcuissrnjzxwkbgdtqmoylfc
mphcuiwvrnjuxwkfgdtqeoylfa
mphcuicvlnjzxwkbgdvqeoylfa
mphcuisvrvvzxwkbfdtqeoylfa
myhcuisvrnjpxwkbgntqeoylfa
mpocuisvrnjzxwtbgitqeoylfa
mphcuisvrnjzxwkbgdtwewyqfa
mphcuisvtnjzxwwbgdtqeoolfa
mphcuisvrnjzxgkbgdyqeoyyfa
mphcuisvrdjzxwkbgpyqeoylfa
bphcuisvrnjzxwkbgxtqefylfa
sphcuisvrdjzxwktgdtqeoylfa
mphcuvsvrnjmxwobgdtqeoylfa
mphcuisvrnjzxwkbsdtqeuylfb
mnhcmisvynjzxwkbgdtqeoylfa
mphckisvrnjzxwkhgdkqeoylfa
mpacuisvrnjzxwkbgdtqeoolaa
mpgcuisvrnjzxwkbzdtqeoynfa
mphcuisvrojzxwkbzdtqeoylga
mphcuisvknjfxwkbydtqeoylfa
mphcuistrnjzxwkbgdqqeuylfa
bpvcuiszrnjzxwkbgdtqeoylfa
mphcuxsvrnjzswkbgdtqeoelfa
mphcuisvbnjzxwlbgdtqeoylla
mphcuisvonczxwkbgktqeoylfa
mphcuisvrnkzxwvbgdtquoylfa
mphcuisvrnjzxokfgdtqeoylia
tphcuisvrnjzxwkbjdwqeoylfa
mihcuisvrnjzpwibgdtqeoylfa
mphcuisvrejzxwkbgdtqjuylfa
mprcuisvrnjixwkxgdtqeoylfa
mpqcuiszrnjzxwkbgdtqeodlfa
mphcuasvrnjzzakbgdtqeoylva
mphcuisvrnjzmwkbtdtqeoycfa
mphcuisvrnjzxwkbcdtqioylxa
mphckisvrnjzxwkbcdtqeoylfm
mphcuisvrnjuxwbogdtqeoylfa
mphcuisdrnjzxwkbldtqeoylfx
mphcuisvrnjoxwkbgdtqeyyyfa
mphcuicvqnjzxwkbgdtqeoylna
mpmcuisvrnjzxwkbgdtqktylfa
mphcuisvrnqzxwkggdtqeoykfa
mphcuisvryjzxwkbydtqejylfa
mphcugsvrnjzxwkbghtqeeylfa
rphcuusvrnjzxwkwgdtqeoylfa
zphwuiyvrnjzxwkbgdtqeoylfa
cphcuivvrnjzxwkbgdtqenylfa
mphcuisvrnjzxwkagotqevylfa
mprcuisvrcjzxwkbgdtqeoytfa
mphjugsvrnezxwkbgdtqeoylfa
mphcuisvryjzxwkbgltqeoylaa
mphcursvrnjzxfkbgdtqeoydfa
mphcuisvrcuzxwkbgdtqeoylfw
mphcuisvrijzxwkbgdtqeoelfh
xphcuisvenjzxjkbgdtqeoylfa
mphcuisvrnazxwkbgdeqeoylaa
mphcuisbrsjzxwkbgdtqeoygfa
mlhvuisvrnjzxwkbgdtqeoylfh
mphcuisvrnjzxukbgdtqeoyhfy
mpzcuilvrnjzawkbgdtqeoylfa
hphcuisjfnjzxwkbgdtqeoylfa
mahcuisvrnjzxwkegdtqeoylfi
mphcuixvrnjzcwkbgdtqetylfa
mphcuisvrnjzxwkdgdtqeoklfj
mlhcuisvrnjzxwkbgdteeoylka
mphcuifvrnjbxwkrgdtqeoylfa
mphcuasvrnjzzwkbgdtqeoylva
mphcuisvrnjzxwkboutqeoylba
mbhcuisvcnjzxwklgdtqeoylfa
mpbcuisvrnjzxgkbgdtqesylfa
mphcuisvrnjfswkbgdtqeoylfd
mphcuisvrnjzxwkbgdoweoysfa
uphcuisvrnjzrwkbgdtqelylfa
mphcuisvrnjzxwkbgdtqyoylsi
mpqcuiqvxnjzxwkbgdtqeoylfa
mphcuisorfjzxwkbgatqeoylfa
mphcuisvrntfxwkbzdtqeoylfa
mphcuisvrnrzxwkbgdtueoylfl
mphcuisvrnjzewkagdtyeoylfa
mpocuisdrnjzxwkbgdtqeozlfa
mphcuisvrnjjxwkbgdtoeoylfm
mphcuisvenjzxwkbgdtqwoylza
mpmcuisvrnjzxwkbgdtqeoxlfr
mphcuisvgnjhxwkbgdtqeoplfa
mphcuisvrnjzowkdgdtqeoyyfa
mphcuisqynjzxwkbgdtqeoylda
hphcuisvgnjzxwkbgdtbeoylfa
iphcuipvrnuzxwkbgdtqeoylfa
mphcuisvrnjzsikbpdtqeoylfa
mpwcuhsvrnjzxbkbgdtqeoylfa
mnhjuisvcnjzxwkbgdtqeoylfa
mphcudsvrnjzxwkbgdtqloilfa
mpncuiwvrwjzxwkbgdtqeoylfa
mphcuisvrnjgawkbgdtqeoylya
mphcuisvrnjzxwkbggtteoslfa
mphcuisvrnjzxwkbgdvqeoylpe
mphcuisvrnczxfkbgktqeoylfa
mphcuifvrnjzxwkbgdbmeoylfa
mphcuisvrnjytwkbgdtqeoylla
mphcuisvrnjzxwkbgdtjeoxlfn
mphjuisvrnjzxwkbghtqeoyffa
mphcuisvrnjzxkrbgdtqeoylaa
mphcbisvrnjzxwkbgttqeoylfs
mphkuksvbnjzxwkbgdtqeoylfa
nphcuidvrnjzxwhbgdtqeoylfa
mphguzsvrnjzxwkbgdaqeoylfa
mihcuisfrnjzxwkbgdtqhoylfa
mphcuisvrnrzxwpbgdtqesylfa
zphcuisvrnjzxwkbddtqeoylaa
mphcuigvmnjzxwkbgdtqeoylba
mjhcuisvrnjzxjkbgdtqeoylha
mphnuisvrnjznwkbgdtqnoylfa
mkhcuisvrnjcxwkbgdqqeoylfa
mphcuisvenjzxwbbqdtqeoylfa
qphcuisnrnjzawkbgdtqeoylfa
mphcuisvrdjzxwkbgdtqeoywca
mphcuzsvvnjzxwfbgdtqeoylfa
pphcuxsvrnjzxwkbgdtmeoylfa
mphiuvsvrnjzxlkbgdtqeoylfa
mphlqisvrnjzxkkbgdtqeoylfa
mmhcuisvrnjzxwkbgatqeoylea
mphduisrrnjoxwkbgdtqeoylfa
mphcuisvrnjnxwkvgdyqeoylfa
mphcuvsvrnjzxgkbgdtqeoylfz
mphcuisvryjzxwkbggtqkoylfa
iphcuisvrdjzxwkbgotqeoylfa
mphcuisvrnjzxwhbgdtqwoyofa
mphcorbvrnjzxwkbgdtqeoylfa
mghcuisvrnpzxykbgdtqeoylfa
mphauisvrnjnxwkbzdtqeoylfa
mphcgisvrnjzxwkwgdtqeoygfa
mphcuisvrnjzxwkggotqeoylba
mphcuesvrnjzxwkbgdwqebylfa
yphcuisvrnjzxwkbgdxqeoylja
ephyuisvrnjzywkbgdtqeoylfa
mfhcuisqrnjzxwkbgdlqeoylfa
mphkuisvrnjzxwkbertqeoylfa
mphcuusgrnjzxwkbggtqeoylfa
mphcuildrnjvxwkbgdtqeoylfa
mphcuiuvrnjzlwkbgwtqeoylfa
mppcuisvrljzxwkbgdtqeoylfw
mphcwiwvrnjzxwsbgdtqeoylfa
mphcubivrnjzxwkqgdtqeoylfa
mphcuisvrnjpxwkngdtqeoylpa
pchcuisvrgjzxwkbgdtqeoylfa
mphcuisvlnjzxwkbgdtmeoylfw
mphcuisvrnjzywkbgdvqeoylfj
mpzcuisvrnezxwktgdtqeoylfa
mphcuisvrnjbxwkbgzrqeoylfa
mphcuisvrnjzxwktgdtqeodtfa
jphcuiavrnjzxwkbgdtqeoylfv
mphcuisvrnjzxwkbddppeoylfa
mphcuissrkjzxwkbgxtqeoylfa
mphcuisvrhjzxwxbgdtqeoylxa
mphcvisvgnjjxwkbgdtqeoylfa
mphcuisprnjwxwtbgdtqeoylfa
mphcuissrnjzxqkbgdtqeoymfa
mphcuiabrnjzxokbgdtqeoylfa
mphcuisvrnczxwkbgmtpeoylfa
+4
View File
@@ -0,0 +1,4 @@
aabcdefghijklmnopqrstuvwxy
abcdefgbhijklmnopbqrstuvwx
abcdeygbhijklmnopbqrstuvwx
abcdeygbhijhfdsnopbqrstuvw
+48
View File
@@ -0,0 +1,48 @@
// AdventOfCode2018-02
var twiceCounter = 0;
var thriceCounter = 0;
// Import the input file
var fs = require('fs');
var frequency = 0;
var textFile = fs.readFileSync('./input.txt').toString();
var textArray = textFile.split(/\r?\n/);
// For each line of the input file
textArray.forEach(line => {
var searchCharHistory = [];
var lineTwiceCounter = 0;
var lineThriceCounter = 0;
for (i = 0; i < line.length; i++) {
searchChar = line.charAt(i);
if (!searchCharHistory.indexOf(searchChar) >= 0) {
// If we haven't already counted this letter
//console.log('Searching for ' + searchChar + ' in line ' + line);
var re = new RegExp(searchChar, 'g');
var matchCharCount = (line.match(re) || []).length;
//console.log(matchCharCount);
// Check if a letter appears twice (and increment the counter)
if (matchCharCount == 2) {
lineTwiceCounter += 1;
}
// Check if a letter appears three times (and increment the counter)
else if (matchCharCount == 3) {
lineThriceCounter += 1;
}
}
searchCharHistory.push(searchChar);
}
if (lineTwiceCounter > 0) {
twiceCounter += 1;
}
if (lineThriceCounter > 0) {
thriceCounter += 1;
}
});
console.log(twiceCounter);
console.log(thriceCounter);
// multiply the two counters together
console.log('The checksum is ' + (twiceCounter * thriceCounter));
+63
View File
@@ -0,0 +1,63 @@
// AdventOfCode2018-02
var twiceCounter = 0;
var thriceCounter = 0;
// Import the input file
var fs = require('fs');
var frequency = 0;
var textFile = fs.readFileSync('./input.txt').toString();
var textArray = textFile.split(/\r?\n/);
function compareStrings (string1, string2) {
if (string1 == string2) {
// Do nothing, it's the same string
}
// Split the characters of both strings into arrays
var arr1 = [];
var arr2 = [];
for (ii = 0; ii < string1.length; ii++) {
arr1.push(string1.charAt(ii));
}
for (jj = 0; jj < string2.length; jj++) {
arr2.push(string2.charAt(jj));
}
var wrongCharCounter = 0;
var sameChars = [];
// For each letter in the first array, check if it corresponds to the appropriate letter in the second array
for (kk = 0; kk < arr1.length; kk++) {
if (arr1[kk] != arr2[kk]) {
wrongCharCounter += 1;
}
else {
sameChars.push(arr1[kk]);
}
}
if (wrongCharCounter == 1) {
var re = new RegExp(',', 'g');
console.log('Common letters are: ' + sameChars.toString().replace(re, ''));
return true;
}
else {
return false;
}
}
var endLoop = false;
// For each line of the input file
for (i = 0; i < textArray.length; i++) {
// Compare this line with each other line in the array
for (j = 0; j < textArray.length; j++) {
if (compareStrings(textArray[i],textArray[j])) {
// If it finds a string with just one letter wrong
endLoop = true;
break;
}
}
if (endLoop) {
break;
}
};