diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index e91778f..059149e 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -23,7 +23,7 @@ jobs: steps: - uses: actions/checkout@v4 - uses: denoland/setup-deno@v2 - - run: deno test --junit-path=./junit.xml + - run: deno test --allow-read --parallel --junit-path=./junit.xml - uses: EnricoMi/publish-unit-test-result-action@v2 if: always() with: diff --git a/cli.ts b/cli.ts index bd73d39..e25e6b3 100644 --- a/cli.ts +++ b/cli.ts @@ -2,7 +2,7 @@ import { colors } from "@cliffy/ansi/colors"; import { Command } from "@cliffy/command"; import { Input, Select } from "@cliffy/prompt"; import { readLinesFromFile } from "utils"; -import { days, getSolution } from "./days/mod.ts"; +import { days } from "./days/mod.ts"; import denoJson from "./deno.json" with { type: "json" }; import { readLinesFromStdin, @@ -13,7 +13,7 @@ const list = new Command() .description("List all available solutions") .action(() => { console.log("Available solutions:"); - for (const day of Object.keys(days)) { + for (const day of days.keys()) { console.log(`- ${day}`); } }); @@ -22,7 +22,7 @@ const main = new Command() .name("Advent of Code - 2024") .version(denoJson.version) .description("...") - .option("-d, --day ", "Day to run") + .option("-d, --day ", "Day to run") .option("-i, --input ", "Input file, local path or remote URL") .action(async (options) => { let input: Array | null = null; @@ -43,7 +43,7 @@ const main = new Command() Deno.exit(1); } const day = options.day ?? await selectDay(); - const solution = getSolution(day); + const solution = days.get(day); if (solution == null) { console.error(`Day ${day} not found`); Deno.exit(1); @@ -60,11 +60,11 @@ async function provideInput(): Promise { }); } -async function selectDay(): Promise { +async function selectDay(): Promise { return await Select.prompt({ message: "Select day", - options: Object.keys(days).map((day) => ({ - name: day.toString().padStart(2, "0"), + options: [...days.keys()].map((day) => ({ + name: day.toString(), value: day, })), }); diff --git a/days/01/main_test.ts b/days/01/main_test.ts deleted file mode 100644 index 8511e86..0000000 --- a/days/01/main_test.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { expect } from "@std/expect"; -import { part1, part2 } from "./main.ts"; - -const input = [ - "3 4", - "4 3", - "2 5", - "1 3", - "3 9", - "3 3", -]; - -Deno.test("part 1", () => { - expect(part1(input)).toBe(11); -}); - -Deno.test("part 2", () => { - expect(part2(input)).toBe(31); -}); diff --git a/days/02/main_test.ts b/days/02/main_test.ts deleted file mode 100644 index 37da173..0000000 --- a/days/02/main_test.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { expect } from "@std/expect"; -import { part1, part2 } from "./main.ts"; - -const input = [ - "7 6 4 2 1", - "1 2 7 8 9", - "9 7 6 2 1", - "1 3 2 4 5", - "8 6 4 4 1", - "1 3 6 7 9", -]; - -Deno.test("part 1", () => { - expect(part1(input)).toBe(2); -}); - -Deno.test("part 2", () => { - expect(part2(input)).toBe(4); -}); diff --git a/days/01/main.ts b/days/1/main.ts similarity index 100% rename from days/01/main.ts rename to days/1/main.ts diff --git a/days/1/main_test.ts b/days/1/main_test.ts new file mode 100644 index 0000000..1b596a0 --- /dev/null +++ b/days/1/main_test.ts @@ -0,0 +1,33 @@ +import { expect } from "@std/expect"; +import { describe, it } from "@std/testing/bdd"; +import { part1, part2 } from "./main.ts"; +import { loadInput } from "utils"; + +describe("day 1 example", () => { + const input = [ + "3 4", + "4 3", + "2 5", + "1 3", + "3 9", + "3 3", + ]; + + it("part 1", () => { + expect(part1(input)).toBe(11); + }); + + it("part 2", () => { + expect(part2(input)).toBe(31); + }); +}); + +describe("day 1 solution", () => { + it("part 1", async () => { + expect(part1(await loadInput(1))).toBe(2378066); + }); + + it("part 2", async () => { + expect(part2(await loadInput(1))).toBe(18934359); + }); +}); diff --git a/days/02/main.ts b/days/2/main.ts similarity index 100% rename from days/02/main.ts rename to days/2/main.ts diff --git a/days/2/main_test.ts b/days/2/main_test.ts new file mode 100644 index 0000000..c9ddba0 --- /dev/null +++ b/days/2/main_test.ts @@ -0,0 +1,33 @@ +import { expect } from "@std/expect"; +import { describe, it } from "@std/testing/bdd"; +import { part1, part2 } from "./main.ts"; +import { loadInput } from "utils"; + +describe("day 2 example", () => { + const input = [ + "7 6 4 2 1", + "1 2 7 8 9", + "9 7 6 2 1", + "1 3 2 4 5", + "8 6 4 4 1", + "1 3 6 7 9", + ]; + + it("part 1", () => { + expect(part1(input)).toBe(2); + }); + + it("part 2", () => { + expect(part2(input)).toBe(4); + }); +}); + +describe("day 2 solution", () => { + it("part 1", async () => { + expect(part1(await loadInput(2))).toBe(421); + }); + + it("part 2", async () => { + expect(part2(await loadInput(2))).toBe(476); + }); +}); diff --git a/days/3/main.ts b/days/3/main.ts new file mode 100644 index 0000000..2d87286 --- /dev/null +++ b/days/3/main.ts @@ -0,0 +1,59 @@ +import { loadInput } from "utils"; + +type Mul = readonly [number, number]; + +export function part1(input: Array) { + return [...getAllMuls(input.join("|"))].map(([a, b]) => a * b).reduce( + (acc, n) => acc + n, + 0, + ); +} + +export function part2(input: Array) { + return [...getAllConditionalMuls(input.join("|"))].map(([a, b]) => a * b) + .reduce( + (acc, n) => acc + n, + 0, + ); +} + +function matchMul(input: string): [Mul, string, number] | null { + const match = input.match(/mul\((\d{1,3}),(\d{1,3})\)/); + if (match == null) return null; + const remaining = input.slice(match.index! + match[0].length); + return [ + [parseInt(match[1], 10), parseInt(match[2], 10)], + remaining, + match.index!, + ]; +} + +function* getAllMuls(input: string) { + let remaining = input; + while (true) { + const match = matchMul(remaining); + if (match == null) { + break; + } + yield match[0]; + remaining = match[1]; + } +} + +function* getAllConditionalMuls(input: string) { + const doables = input.split("do()"); + for (let doable of doables) { + const indexOfDont = doable.indexOf("don't()"); + if (indexOfDont !== -1) { + doable = doable.slice(0, indexOfDont); + } + for (const mul of getAllMuls(doable)) { + yield mul; + } + } +} + +if (import.meta.main) { + console.log(part1(await loadInput(3))); + console.log(part2(await loadInput(3))); +} diff --git a/days/3/main_test.ts b/days/3/main_test.ts new file mode 100644 index 0000000..46ad594 --- /dev/null +++ b/days/3/main_test.ts @@ -0,0 +1,32 @@ +import { expect } from "@std/expect"; +import { describe, it } from "@std/testing/bdd"; +import { part1, part2 } from "./main.ts"; +import { loadInput } from "utils"; + +describe("day 3 example", () => { + it("part 1", () => { + expect( + part1([ + "xmul(2,4)%&mul[3,7]!@^do_not_mul(5,5)+mul(32,64]then(mul(11,8)mul(8,5))", + ]), + ).toBe(161); + }); + + it("part 2", () => { + expect( + part2([ + "xmul(2,4)&mul[3,7]!^don't()_mul(5,5)+mul(32,64](mul(11,8)undo()?mul(8,5))", + ]), + ).toBe(48); + }); +}); + +describe("day 3 solution", () => { + it("part 1", async () => { + expect(part1(await loadInput(3))).toBe(162813399); + }); + + it("part 2", async () => { + expect(part2(await loadInput(3))).toBe(53783319); + }); +}); diff --git a/days/mod.ts b/days/mod.ts index 7f29c0f..7d68aac 100644 --- a/days/mod.ts +++ b/days/mod.ts @@ -1,18 +1,10 @@ type PartFunction = (input: Array) => number; type Solution = { part1: PartFunction; part2: PartFunction }; -const days: Record = {}; +const days = new Map(); -for (const day of [1, 2]) { - days[pad(day)] = await import(`./${pad(day)}/main.ts`); -} - -export function getSolution(day: string | number): Solution | null { - return days[pad(day)]; +for (const day of [1, 2, 3]) { + days.set(day, await import(`./${day}/main.ts`)); } export { days }; - -function pad(day: string | number) { - return day.toString().padStart(2, "0"); -} diff --git a/deno.json b/deno.json index dab47a3..1533e37 100644 --- a/deno.json +++ b/deno.json @@ -14,6 +14,7 @@ "@std/collections": "jsr:@std/collections@1", "@std/path": "jsr:@std/path@1", "@std/streams": "jsr:@std/streams@^1.0.8", + "@std/testing": "jsr:@std/testing@^1.0.5", "utils": "./utils/mod.ts" } } diff --git a/deno.lock b/deno.lock index 4bb0668..c8d6ec7 100644 --- a/deno.lock +++ b/deno.lock @@ -14,14 +14,18 @@ "jsr:@std/bytes@^1.0.3": "1.0.4", "jsr:@std/cli@1.0.0-rc.2": "1.0.0-rc.2", "jsr:@std/collections@1": "1.0.9", + "jsr:@std/data-structures@^1.0.4": "1.0.4", "jsr:@std/encoding@1.0.0-rc.2": "1.0.0-rc.2", "jsr:@std/expect@1": "1.0.8", "jsr:@std/fmt@~0.225.4": "0.225.6", + "jsr:@std/fs@^1.0.5": "1.0.6", "jsr:@std/internal@^1.0.5": "1.0.5", "jsr:@std/io@~0.224.2": "0.224.9", "jsr:@std/path@1": "1.0.8", "jsr:@std/path@1.0.0-rc.2": "1.0.0-rc.2", + "jsr:@std/path@^1.0.8": "1.0.8", "jsr:@std/streams@^1.0.8": "1.0.8", + "jsr:@std/testing@^1.0.5": "1.0.5", "jsr:@std/text@1.0.0-rc.1": "1.0.0-rc.1", "npm:@types/node@*": "22.5.4" }, @@ -95,6 +99,9 @@ "@std/collections@1.0.9": { "integrity": "4f58104ead08a04a2199374247f07befe50ba01d9cca8cbb23ab9a0419921e71" }, + "@std/data-structures@1.0.4": { + "integrity": "fa0e20c11eb9ba673417450915c750a0001405a784e2a4e0c3725031681684a0" + }, "@std/encoding@1.0.0-rc.2": { "integrity": "160d7674a20ebfbccdf610b3801fee91cf6e42d1c106dd46bbaf46e395cd35ef" }, @@ -108,6 +115,12 @@ "@std/fmt@0.225.6": { "integrity": "aba6aea27f66813cecfd9484e074a9e9845782ab0685c030e453a8a70b37afc8" }, + "@std/fs@1.0.6": { + "integrity": "42b56e1e41b75583a21d5a37f6a6a27de9f510bcd36c0c85791d685ca0b85fa2", + "dependencies": [ + "jsr:@std/path@^1.0.8" + ] + }, "@std/internal@1.0.5": { "integrity": "54a546004f769c1ac9e025abd15a76b6671ddc9687e2313b67376125650dc7ba" }, @@ -126,6 +139,16 @@ "jsr:@std/bytes" ] }, + "@std/testing@1.0.5": { + "integrity": "6e693cbec94c81a1ad3df668685c7ba8e20742bb10305bc7137faa5cf16d2ec4", + "dependencies": [ + "jsr:@std/assert@^1.0.8", + "jsr:@std/data-structures", + "jsr:@std/fs", + "jsr:@std/internal", + "jsr:@std/path@^1.0.8" + ] + }, "@std/text@1.0.0-rc.1": { "integrity": "34c722203e87ee12792c8d4a0cd2ee0e001341cbce75b860fc21be19d62232b0" } @@ -149,7 +172,8 @@ "jsr:@std/collections@1", "jsr:@std/expect@1", "jsr:@std/path@1", - "jsr:@std/streams@^1.0.8" + "jsr:@std/streams@^1.0.8", + "jsr:@std/testing@^1.0.5" ] } } diff --git a/inputs/01.txt b/inputs/1.txt similarity index 100% rename from inputs/01.txt rename to inputs/1.txt diff --git a/inputs/02.txt b/inputs/2.txt similarity index 100% rename from inputs/02.txt rename to inputs/2.txt diff --git a/inputs/3.txt b/inputs/3.txt new file mode 100644 index 0000000..93c7e05 --- /dev/null +++ b/inputs/3.txt @@ -0,0 +1,6 @@ +what()who(){from(),'mul(28,510)?<,>where()why()mul(276,283):#>mul(181,314)from()$;]what()*mul(314,733)$who()mul(457,651)/!~select()-when()select(434,607)(,mul(279,135)]select()]<)'mul(579,740)}!when()](({,$mul(515,329)where(563,580)+>:),mul(508,45)+mul(299,897)mul(948,555)mul(137,832)^$who()why()')!do()[mul(243,401)'$/) :> mul(71,774)@mul(172,268)mul(758,223)mul(49,326)'how()where();@mul(786,646)what()@@why()how():when()mul(841,587)<-mul(981,592)#?@when()do()?{{%?what(958,799)why(293,181):~mul(296,234)select()!/(when()(&(select()mul(714,304)}?-][*select()mul(899,657)what(){*!from()select()who()(>[mul(965,550)~what()who()?(mul(16,267)mul(305,656)-^mul(795,461)from()&what() why()&from()}?mul(647,388)when(){'when()?mul(944,963)#[mul(927,423)]&'}mul(827,259)^mul(771,396)<:how()#,from()%:'}mul(31,548)$^who(){&>[$from()mul(186,978)$[;mul(893,833)from(),$mul(151,691):don't()mul(519,18):select()where()/+,mul(424,339)'mul(557,339)%select()$)/%mul(742,360)/$mul(793,965)+what()where()+({^*[mul(147,180){-?#!where()^!+mul(321,646)what()where(),/when()+don't() mul(365,934),{#mul(324,81)mul(932,108)from()what(),^<^select()@,mul(496,552)!who()@-]from()where()%mul(339,910)[~$who()do()$what()where()where()/?where()&$from()mul(254(>:+$](!why()&mul(605,574)mul(552,978)>where()?#-why()]/)+mul(297,553)why(),mul(376,496);$mul(802,270)]}{}@$select():?mul(74,384){}mul(432,177)*[where()what()where() [mul(874,804){^ mul(513from()mul(813,911)!]?^ why()?[@when(601,783)mul(556,508$'{from()]^[from(103,258) :mul(386,887)'from()where())[mul(725,452)how()>mul(543,116)!{;who()-how()mul(319,593)how()where()why()'do()select(),#>mul(148,463)select()>}{-mul(394,10):mul(692,431);%do()what()mul(123,456$;,who()^(how()mul(148,193)+how()$,,mul(467,891);+%)> ?%where()how()mul(694,600)$from(301,632)$!$ ^ mul(326,593)?+(*-%},why(565,27)[mul(485,524):&!/}%who()({%don't()*>:mul(111,647),mul(906,376)from()+! ']where(800,912)~from()%mul(503,859)>$where()how()>mul(264,7)):-]mul(503,199) +,]()don't()what()? )'mul(779,22)>,@^mul(462,626);why()select()how()why()mul(184,478$mul(585,629)[?mul(353,894);>[where()#mul(539,201)mul(767,323)who()];?where()do()?%mul(330,946) how()?}-?]&^[mul(377,867)mul(410,38)'?:@why()+??>mul(557,508)mul(296,240):::#mul(269,24)what()mul(444,457)){how())where(969,8),where()??-mul(42,768)!(mul(425,243) -*&how()mul(958,793);select(),who()}}$?,+mul(973,632)where()>%/(%(]mul(870,593)mul(745,223)%~>--mul(181,897)%*)%[[who();what(78,394)select()mul(673,429),#mul(102,654)]what(9,962)[%{ mul(536,134)mul(862,564)mul(573,681)when()!when():${mul(469,457)@^from()~~mulwhat()]$mul(305,833)what()'when()[mul(56,269)who()when(325,61)@*@mul(156,371)}why()}?&? #mul(538,775)':+([~what(989,179)?-who()mul(376,766)mul(605,700)why()%}when()mul(709,480)@!mul(56,9)*where()(from()()what()why()@where()mul(41,872)/when()#},;mul(533,809)#what(871,303)why()where()mul(473,210)who()where() [>who()+@mul(828,843)&don't()]+,how()' ^#when():mul(351,567)+>)@where()how()-mul(312,118)$)mul(371,16)what(374,198)')}@mul(987,14)?:}}^>mul(526,248)#select()how()/,@}when()]mulwhere(907,178)?from()when(632,373)what(){/$!>mul(765,913)[mul(681,758)select()<^}]mul(780,610)~-where();)&%^mul(880,694)#}from()when()>select()mul(877,703)?'+)?,?mul(61,42)(%+~%what()mul(711,20),;~,mul(467,353)how()select()why()%mul(27,818)-<($]}how(740,802);mul(672,30)'who()*+don't()}mul(759,758)'?];[/@+'how()mul(219,736){mul(835,869)mul(980,700)>:~?mul(258,59)'^#'?/mul(25,617)mul(122,300)]?)[ >when() mul(756,549)select()/how()what()how()&(}mul(903,219)@-%,mul(15,106)how()%select()(,*how(){ [mul(886,132)@mul(307,385))mul(225,698)mulselect(347,43)mul(44,530)@@select(){!?mul(66,204)/)mul(712,389)where()>when()!mul(983,178)why(){]why()&select()how()-~mul(193select()$)(why()*^ when()mul(135,631)]/mul(420,746)from()+{$%]why()~why()from()mul(880,917)!$+^who()%>^mul(91,172)^<<];mul(682,688)]:+)who()&do()~;mul(547,808)@;{~'mul(232,866)@mul(179,173)]]how()${[{ mul>%(what()why(),@&%,&mul(261,638)@%),)how(),])mul(238,80)select()from():/-$how()mul(620,723)*%,^[mul(192,63)when()when()+,:}what()from()select(209,416)mul(190,400){~${mul(837when()>/# select(734,442)how()* ]mul(243,292)&,&-who(){{;mul(497,592)@select()mul(890,938);]how()@>!>>}$mul(384,970)<~from()>@?]:mul(662,264)^mul(907,796)'{?* 'select()^why()>mul(819,58)#!'!~;mul(962,712),@^when()when()'%from()where()don't(){how()mul(142,759){select(),mul(588,670)>{>;mul(666,177)!}who()}%;^ mul(185,320) what()when(),;%&[)mul(955,648)*where()^}-mul(871,657))$why()}'mul(489,12)!mul(321,797)from()mul(222,754>@who()where()mul(199,482)mul(479,996)])!!from()?who()mul(183,994)[mul(650,139)mul(336,775)!where()from()@:,mul(616-mul(840,883)[/$where()select()mul(617,724)&do()+]{/!<why();mul(42,172){/mul(43,709)-@mul(792,355'what()#!where();} ~how(449,989)mul(96,171)*[%{%*[{mul(630,90)why()^){select()?don't()@&where()from()where()'/;mul(857,733)when():mul(696,649),who()^+~ $how())when()mul(237,252)(,%::],&mul(964,899'>+**mul(719,330)what()'how()when();~&'how(993,186);mul(297,511)when()'+)when():select() from()%mul(296,219)what()select()mul(684,974{where()where()how()~(,{who()mul(106,612)!why()select()select(533,857)who()/^%mul(465,917)?how()do()/?%why()mul(901): select(646,127)mul(395,446)/+,mul(883,551)@'&,?, ?mul(840,262)mul(593,805)from()<~{why(302,32)@do():what()!mul(458,211)how()$mul(804,650)-)mul(708,773)~~do(){',,^why())$why()/mul(987,695)^mul(130,150)mul(311,404)who()what()-do()~~where()why()[ :how()what()mul(382,827)how()where()?{/?mul(445,857)who()~(from(110,658)mul(835,804)!from()mul(259,67)what()+~*how()what()mul(278,456)>&mul(609,189)mul(594,207):;where()who(),when()select()mul(329,470);^select() +%$#!mul(5,828)):&#+how(803,290)['^+mul(97,709)mul(697,401)what()!-select()>/-$&mul(410,704)#)<-[why(852,715)why()&mul(236,590)mul(980,340)who()mul(739,332){*)'&mul(418,580)?}where()#>]where():when()mul(607,270)]>when(13,490):where()^why()mul(734,771)>&when()^{{?who()mul(114,409)*,mul(287,279)?select(127,269);/!mul(352,591)]why()mul(80,771))who();['select()(,&,don't()*select()#from()#~mul(730,246)&^$mul(737,598)mul(488,879)}why()@mul(132,483)'-?!]mul(290,835):<+(+}%/)@mul(399,896):why()mul(591~mul(602,533)!~$;;when()*mul(784,971)'from()/when()when()mul(473,91) @[mul(769,873select()where()mul(599,390)who(); mul(117what()#(;>+ !/where()mul(195,251),*^#{/mul(801,341)+'%#(mul(130,592) 'how()#where(){>mul(87,639)select()>when()[?mul(447,139)}'}]^){select()?mul(862,745)&when()what()select()mul(529,136)}>mul(203,54)}[#-#[when()>mul(560,419)']where()how()who()]mul(617,618)&mul(558,602)^#} mul(376,310)#;]$:why()^how()mul(28,566)what()[]{select()>-^mul(943,833)mul(45,58)when()from()select();}how()mul(651,251)mul(77,14)~:@][when()how()mul(526,702)<;@' select();mul(94,187)@'-'-mul(442,386)select()*mul(15,638)$!~!,+how(){(mul(46,848)select();mul(746,41)(^:)<+mul(185,512)mul(696,259)where()/[mul(723,454)#mul(666,327)+from()#%where()(where():-where()mul(464,555)]select() where()from(998,207)select()how()^when()what(994,325)mul(594,757)who()mul(150,180)%how(699,248)mul(862,130)'#mul(462,469)@/;select()%mul(444,312><~--mul(975,441)<#<]'where()$$select()$+mul(44,371)who()don't()why(270,731)why()[#{from()%~*mul(789,108)select()<-%}when()mul(962,293)what()!{){{&/@+mul(235,737)#^[mul(296,722))#mul(820,701):/>mul(87,546)where(916,667)}/ when()mul(333,813? who()who()mul(301,192) mul(494,214)!from()what()&!how(),)!mul(981+{,^@-from()!}&;mul(56,530)!!when()mul(712,266)mul(368,654)*)!when()what()from()?select()~mul(530,635);&<^<<&mul(842,959)where()how()>how()}@from()what()]@mul(656,546)~,^{mul(174,109){select()where()mul(884,560)mul(486,236)~?@#<;don't()how()when()when(330,525)-what()<+@#*mul(437:{{ +))[^mul(968,157),,*&<-;select()where()/mul(326,6)~when(43,428)select()]]select()+mul(888,954)(;mul(381,393),why()what()mul(516,776)select()~'}&@<{mul(787,629) +/>/?&#how(){{from()mul(350,247)^where()):;&(#mul(849,382)$*what(375,59)mul(393,781)$+ < )where()}[$mul(989,566)@ from()()what()mul(278,341)$~:< +]*from()mul(222,778)select()+]$?[how()#mul(803,159);-mul(691,904)how()!+select()#>$mul(581,426)*&<[&;<>why()mul(328,130)(what(400,945);!<^from()>~mul(110,46)what()@'>what(368,331){[ why()^mul(838,660)-';+?why()}[%'mul(665,204)from()'/? %:what(825,7)mul(214,201)[({&mul(691,782)>{&/mul(479,190)mul(322,468))>}]?^^mul(374,709)mul(306,137)%)[&how()][who()mul(273,163):who()when()?^% ,#[-select(208,463)mul)[[:%('(mul(221,543)@where()mul(857,223)*why()when()/^[@/mul(624,83)<&how(){'%:who()mul(300,364)[]:}%mul(444,866)-[!!>from()+(^mul(7,101)^;#%mul(777,568)why()~from()who()why()mul(381what(541,812)}!select() '@@~mul(424,26),^@[^mul(737,814)what()>;]!why()$mul(255,877)['how()%mul(39,878)}('mul(458,922)who()where()<-how()]where():^mul(142,694)-&}&&how()from()~)#mul(407,36)where(403,8))how(){>where()select()@<@mul(754,560)&*/++$'},mul(830,184~)[ &>where(),*mul(648,445)?;what()<'@[why()#mul(420,480)mul(621,94)&where())^/mul[<*-~{@&%where(987,293)do())$@ -from())'mul(180,357)#[:from())%where()how()from()/mul(855,209)@)!&%'mul(183,292)[how()$#who()from()'+*when()mul(124,303)[^+' select(723,455)$'+mul(200,399)#]mul(426,599 mul(201,772)~-(/where(){{who()mul(251,924),[what()mul(552,184)don't()why()when();mul(940,413)#/)who()@>%what()^'mul(478,154)[]who(50,356)how()%^mul(126,487)how()':}{mul(231,424)[~*,:select()+!mul>select()>what()#+;where()why()*,mul(421,910){:+why()+[ mul(571,861)[select()how()'*mul(13,20)/#do()&*mul(938,229)who()+/!who()mul(997,397))*who()+when()when(851,566)mul(775,374)]when()why()&){how()mul(32,605)>[<%>how()(mul(74,333)/~>from()select() +mul(179,40)<^)&;how()$who(){>mul(702,616^mul(68,331)where():who()!@where()how()why()where()mul(201,802)+(&%mul(578,390)who(){[why()mul}&?how()mul(175,690)-{-]when(101,830)][mul(381,285);},([how(),,+mul(19,146)select()who()mul(327,506) +who()from()^/mul(170,681)>-mul(422,557)%,!^#how()@@?*mul(389,988)$!mul(893,97)%?select()%%mul+^^#mul(352,901){*?!+select();(<&mul(888,683)%',mul(355,339)from()]>:;>/(:(mul(39,219)!*{[mul(737,401):mul(270,667)(/mul(227,88)mul(669,526){:'-mul(571,401)^mul(261,80)when()]mul(652,169)),#when()#/;^#mul(313,890)from()%what()'from()mul(879,799)^%$select()who()]@,/]don't();*mul(626,238)!@where(148,187)@^mul(519,346)mul(177,983)@,*)who(715,620)&}$mul(361,158){mul(324,188)-)where(){'?%(*mul(964,296)(who()select()#when()}what()[+*&%*mul(332,673)^-:/$% *!;mul(401,574)why(),/(select()where()*why()do()@+~what()-:mul(961,847):-when()'-#mul(188,129)mul(241,300)when()why()when() -mul(661,107)why()[,)'*#~mul(232,615)mul(372,322):[ select()~'@;mul(234,505)(mul(717,42)when()how()^&who(793,718)'^from()mul(883,914)<$when()from()what()/{@when()mul(443,81)?@mul(954,201)(~mul(448,507)when()) ('how()(>!why()mul(745,138)^/[*}+]^what()mul(631,868)%who()mul(285,681)why()](('~where()select()$mul(682,788)'select(){when(),where():]&>mul(994,408)#]$what()/'(mul(214,829)$**who();don't()?mul(340,580)where()*(>!mul(130,659))??&@how()do()@where()from(937,195)mul(214,73) ::+:when()how()]mul(964,116)why()*>how()when()select(40,445)don't()&+why(294,987)how()mul(904,24) %)/,)why()+mul(770,531)mul(539,562){why()!;)mul(239,254),$' ^&mul(489,900)%why();[who()]^+~mul(192,300)select()&$mul(924,577),how()~:mul(956,98) mul(954,868);from(842,382)mul(288,439)+select()<*mul(636,151)what()why()where(){mul(235,489)[?mul(718,994)why()$?+mul(359,893)when()select()*));from()from()&what(157,794)mul(277,807)['({#what())+;mul(727,217)select()#where()[mul(344,407)!'from()@what()what()mul(876,612)[%,+,mul(241,755)from()>'&+~@mul(593,943),~how(),&mul(219,895)how()how()[(}'mul(771,75)select()~ ;mul(903,219)+*mul(705,739)[][mul(692,511) when()'%mul(846,763)%>what()}when(782,647)}mul(941,842);*^where()<@mul(384,840)}mul(656,250)@& mul(892,589):>&mul(611,673)what()#how()@~ /mul(815,158)-@)when()}?-when()(mul(413,854)}^^mul(102,232){>[mul(232,717)mul(177,872)#${:select()?)don't(){##>when(){'%[mul(393,711)]when(42,485),how()*}#!~mul(909,998)what()@how():where()#*}[where()mul(177,274)when()><*@when():'where()[ \ No newline at end of file diff --git a/utils/loadInput.ts b/utils/loadInput.ts index 42e46dd..f1ce055 100644 --- a/utils/loadInput.ts +++ b/utils/loadInput.ts @@ -6,7 +6,7 @@ export function loadInput(day: number): Promise> { dirname(fromFileUrl(import.meta.url)), "..", "inputs", - `${day.toString().padStart(2, "0")}.txt`, + `${day}.txt`, ); return readLinesFromFile(path); }