From cbd3a2929bb6751480650b0b0475a4d673f692b9 Mon Sep 17 00:00:00 2001 From: Baipyrus Date: Wed, 10 Jan 2024 20:02:15 +0100 Subject: [PATCH] clean up: formatting --- Day11/Part1.js | 76 ++++++------- Day11/Part2.js | 88 +++++++-------- Day11/input.txt | 280 ++++++++++++++++++++++++------------------------ Day12/Part1.js | 16 +-- Day13/Part1.js | 16 +-- Day14/Part1.js | 16 +-- Day15/Part1.js | 24 ++--- Day15/Part2.js | 24 ++--- README.md | 58 +++++----- package.json | 14 +-- template.js | 16 +-- 11 files changed, 314 insertions(+), 314 deletions(-) diff --git a/Day11/Part1.js b/Day11/Part1.js index 20076ae..6d593b6 100644 --- a/Day11/Part1.js +++ b/Day11/Part1.js @@ -1,38 +1,38 @@ -import { readFileSync } from "fs"; -const t0 = performance.now(); - -const input = readFileSync("input.txt") - .toString() - .split(/\r*\n/) - .filter((e) => e.length > 0) - .map((e) => e.split("")); - -const expand = (arr) => - arr.reduce( - (a, i) => [ - ...a, - ...(i.some((e) => e !== ".") ? [i] : [i, Array(i.length).fill(".")]), - ], - [] - ); -const flip = (current) => - Array.from({ length: current[0].length }, (_, x) => - Array.from({ length: current.length }, (_, y) => current[y][x]) - ); - -const universe = flip(expand(flip(expand(input)))); -const galaxies = universe - .map((a, y) => a.map((b, x) => ({ s: b, x, y })).filter((b) => b.s === "#")) - .filter((e) => e.length > 0) - .reduce((a, i) => [...a, ...i], []); -const distances = galaxies.map((c, i) => - galaxies.reduce( - (a, n, j) => a + (j > i ? Math.abs(c.x - n.x) + Math.abs(c.y - n.y) : 0), - 0 - ) -); -const sum = distances.reduce((a, i) => a + i); -console.log(sum); - -const t1 = performance.now(); -console.log(`Runtime: ${t1 - t0}ms`); +import { readFileSync } from "fs"; +const t0 = performance.now(); + +const input = readFileSync("input.txt") + .toString() + .split(/\r*\n/) + .filter((e) => e.length > 0) + .map((e) => e.split("")); + +const expand = (arr) => + arr.reduce( + (a, i) => [ + ...a, + ...(i.some((e) => e !== ".") ? [i] : [i, Array(i.length).fill(".")]), + ], + [] + ); +const flip = (current) => + Array.from({ length: current[0].length }, (_, x) => + Array.from({ length: current.length }, (_, y) => current[y][x]) + ); + +const universe = flip(expand(flip(expand(input)))); +const galaxies = universe + .map((a, y) => a.map((b, x) => ({ s: b, x, y })).filter((b) => b.s === "#")) + .filter((e) => e.length > 0) + .reduce((a, i) => [...a, ...i], []); +const distances = galaxies.map((c, i) => + galaxies.reduce( + (a, n, j) => a + (j > i ? Math.abs(c.x - n.x) + Math.abs(c.y - n.y) : 0), + 0 + ) +); +const sum = distances.reduce((a, i) => a + i); +console.log(sum); + +const t1 = performance.now(); +console.log(`Runtime: ${t1 - t0}ms`); diff --git a/Day11/Part2.js b/Day11/Part2.js index 4fc22d2..8ebdf9b 100644 --- a/Day11/Part2.js +++ b/Day11/Part2.js @@ -1,44 +1,44 @@ -import { readFileSync } from "fs"; -const t0 = performance.now(); - -const input = readFileSync("input.txt") - .toString() - .split(/\r*\n/) - .filter((e) => e.length > 0) - .map((a, j) => a.split("").map((b, i) => ({ s: b, x: i, y: j }))); - -const expand = (arr) => { - let expansion = 0; - return arr.map((a) => { - const c = !a.some((b) => b.s !== "."); - if (c) expansion += 999999; - return a.map((b) => { - const { s, x, y } = b; - return { s, x, y: y + expansion }; - }); - }); -}; -const flip = (current) => - Array.from({ length: current[0].length }, (_, cx) => - Array.from({ length: current.length }, (_, cy) => { - const { s, x, y } = current[cy][cx]; - return { s, x: y, y: x }; - }) - ); - -const universe = flip(expand(flip(expand(input)))); -const galaxies = universe - .map((a) => a.filter((b) => b.s === "#")) - .filter((e) => e.length > 0) - .reduce((a, i) => [...a, ...i], []); -const distances = galaxies.map((c, i) => - galaxies.reduce( - (a, n, j) => a + (j > i ? Math.abs(c.x - n.x) + Math.abs(c.y - n.y) : 0), - 0 - ) -); -const sum = distances.reduce((a, i) => a + i); -console.log(sum); - -const t1 = performance.now(); -console.log(`Runtime: ${t1 - t0}ms`); +import { readFileSync } from "fs"; +const t0 = performance.now(); + +const input = readFileSync("input.txt") + .toString() + .split(/\r*\n/) + .filter((e) => e.length > 0) + .map((a, j) => a.split("").map((b, i) => ({ s: b, x: i, y: j }))); + +const expand = (arr) => { + let expansion = 0; + return arr.map((a) => { + const c = !a.some((b) => b.s !== "."); + if (c) expansion += 999999; + return a.map((b) => { + const { s, x, y } = b; + return { s, x, y: y + expansion }; + }); + }); +}; +const flip = (current) => + Array.from({ length: current[0].length }, (_, cx) => + Array.from({ length: current.length }, (_, cy) => { + const { s, x, y } = current[cy][cx]; + return { s, x: y, y: x }; + }) + ); + +const universe = flip(expand(flip(expand(input)))); +const galaxies = universe + .map((a) => a.filter((b) => b.s === "#")) + .filter((e) => e.length > 0) + .reduce((a, i) => [...a, ...i], []); +const distances = galaxies.map((c, i) => + galaxies.reduce( + (a, n, j) => a + (j > i ? Math.abs(c.x - n.x) + Math.abs(c.y - n.y) : 0), + 0 + ) +); +const sum = distances.reduce((a, i) => a + i); +console.log(sum); + +const t1 = performance.now(); +console.log(`Runtime: ${t1 - t0}ms`); diff --git a/Day11/input.txt b/Day11/input.txt index 8fbd6cf..5955c29 100644 --- a/Day11/input.txt +++ b/Day11/input.txt @@ -1,140 +1,140 @@ -..#............................#....................................................................................#..........#........#... -..........#.........................................#....................................................................................... -...................#..........................................................................#............................................. -.....................................................................................#.............................................#........ -.......#.......#.............#..........#......#...................#.....#.................................................................. -................................................................................#..................#..............#......................... -....................................#....................................................................................................... -...........#...................................................................................#......................................#..... -.......................................................................................................................#.........#.......... -.....................#.................................................#...................#.................#..............#............... -....#...........................................#...............#........................................................................... -.........................#.......................................................................#.......................................... -...................................#......................#.......................................................#.......................#. -..................#...........................................................#.......................#.................#...........#....... -..........#........................................................#..........................................#............................. -.............................................#.........#.....#.............................................................................. -.......................#.....................................................................#..............................#..........#.... -.............................#.......................................................#...........................#.......................... -..#...........#.......................#.....................................#............................................................... -...........................................................#.............................................#.................................. -......#..........................................................#......#........................................................#.......... -................................#.........#...........#....................................#........#...................#..................# -...........................#..................................................#..............................#.............................. -..............................................#.................................................#........................................... -.#.................................................................................................................#........................ -.......................................................................#.................................................................... -...............#.............................................................................................................#..........#... -.................................#.............................#............................................#............................... -.....#.................#...................#................................................................................................ -....................................................#...................................................#............#...................... -...........#.....#...................................................................#............................................#......... -..............................................#...........................................................................#................. -...#.........................#.....................................................................#........................................ -.........................................................#...................................#........................................#..... -.........#....................................................#........#................#.....................#............................. -........................#..........................................................................................#........................ -..............#...................................#............................#.............................................#.....#........ -.................................#................................................................#......................................... -..................#........................#...............#................................#.............#.............................#... -..........#........................................................#............................................................#........... -..#.....................................................................................#.............................#..................... -..........................#..........#..................................#......................................#...........#................ -................................................................#........................................................................... -................#................................#..........................#............................................................... -...........................................#..................................................#.....#.......#............................... -..........#............................................#.....................................................................#.............. -.......................#....................................#...........................................................#..............#.... -.....#.........................#........#..............................................#.................#........................#......... -.................#....................................................#............................................#........................ -....................................#...............#................................................#...................................... -.........................#........................................#................#.......#...................#............................ -....................................................................................................................................#....... -...........#...................................#...........................#......................#.........................#..............# -..................................#......#.................................................................................................. -......#....................#.........................#..................................................#................................... -......................#...................................#......#.....#.................................................#.................. -..............#..............................................................................#.................#.....................#...... -............................................................................................................................................ -#.............................#................#....................................................................#....................#.. -............................................................................................................................................ -........#...........................................#....................................................................................... -...................................................................#..........#..................#.......................................... -.....................#............#........#.............................................#............#................#.................... -................#............................................................................................................#.............. -...............................................................................................................#...................#........ -........................#......#..........................#.....#......#................................................................#... -................................................#..........................................#.............#.................................. -......................................#..............................................................................#...................... -..#.................................................................#.........#............................................................. -..........#.....#...............................................................................................#...........#............... -.................................#....................................................................#..............................#...... -.....................................................#........................................#........................#.................... -..........................................#..................#............#................................................................. -......................#...............................................................#..................#.........#............#........... -......#........................................................................#............................................................ -...................................#...................................#..................................................#................. -...................................................#.........................................#.................#............................ -...........................#...................................#.....................................................................#...... -........................................#................................................................................................... -................#......................................#........................#.........#.....#........................................... -...........#......................#.....................................................................#................................... -....#....................#...................#...................#................................................#...........#...........#. -............................................................................................................................................ -............................................................................................................................................ -.....................................#....................................#................................................................. -.......................#..................#........#............................#................#.............#............................ -...............#...............................................#......................#..............................................#...... -............................................................................................................................................ -.................................#...........#.....................#....................................................#................... -............................................................................................................................................ -..#........#..........#...............#..................................................................#..........#......................# -............................................................#............................#.................................................. -.................................................................#..........#.................................#.................#........... -.............................#......................#....................................................................................... -....#..................................................................................................................................#.... -...................#...............#..................................................#....................#................................ -.........................................................#......................................#...................#..............#........ -.....................................................................#...................................................#.................. -........................#...................................................................#..................#............................ -...#.....#...............................#....................#............................................................................. -................#...............#........................................................................................................... -.....................#........................................................#.....................................................#....... -..............................................#.......#................#...............................................#...................# -.........................................................................................#...............#...................#.............. -.#...........................#.......#...................................................................................................... -.............................................................................................................#........................#..... -.................................#.......................................................................................................... -...........#........................................................................................#.............................#......... -................#...............................................#............................#...................#.......................... -...#............................................................................#........................................................... -....................................................#.......#.......#......#...........................................................#.... -.........................#.................................................................................................................. -....................#...............#.........................................................................................#............. -.........................................................#....................#......................#...................................... -....#........................#...............#........................#...............#..................................................... -..........#......#....................................................................................................................#..... -..............................................................................................#...................#......................... -.......................................................#...................................................#.................#.............. -..........................#....................#............................................................................................ -........................................#......................#.........#...............#.......#......................#.........#.....#... -...............................#....................................#....................................................................... -........#...........#.............................#......................................................................................... -...#...........#...................................................................#..................#............#........................ -...........................#..............................#...................................#............................................. -...................................#.............................#..........................................#............................... -..............................................#........................#........#..........................................#................ -.......................................................................................#.............................#..............#....... -.........................................#.................................................................................................. -.....#............#......................................#.....#............................#............................................... -............................#............................................................................................................... -.......................#.........#........................................#..............................#...............................#.. -..#...........#.......................................#.........................#........................................................... -.......................................#.........................#.......................................................................... -............................................................#............................................................................... -.......#......................#........................................#................................................#..............#.... -..............................................................................................................#............................. -...............................................#.....................................................#...................................... -......................#..................................................................#......#.................................#.......#. -..#.......#................#......#..................................#.......#.....................................#........................ -................#...............................................#..................#....................#..................#................ +..#............................#....................................................................................#..........#........#... +..........#.........................................#....................................................................................... +...................#..........................................................................#............................................. +.....................................................................................#.............................................#........ +.......#.......#.............#..........#......#...................#.....#.................................................................. +................................................................................#..................#..............#......................... +....................................#....................................................................................................... +...........#...................................................................................#......................................#..... +.......................................................................................................................#.........#.......... +.....................#.................................................#...................#.................#..............#............... +....#...........................................#...............#........................................................................... +.........................#.......................................................................#.......................................... +...................................#......................#.......................................................#.......................#. +..................#...........................................................#.......................#.................#...........#....... +..........#........................................................#..........................................#............................. +.............................................#.........#.....#.............................................................................. +.......................#.....................................................................#..............................#..........#.... +.............................#.......................................................#...........................#.......................... +..#...........#.......................#.....................................#............................................................... +...........................................................#.............................................#.................................. +......#..........................................................#......#........................................................#.......... +................................#.........#...........#....................................#........#...................#..................# +...........................#..................................................#..............................#.............................. +..............................................#.................................................#........................................... +.#.................................................................................................................#........................ +.......................................................................#.................................................................... +...............#.............................................................................................................#..........#... +.................................#.............................#............................................#............................... +.....#.................#...................#................................................................................................ +....................................................#...................................................#............#...................... +...........#.....#...................................................................#............................................#......... +..............................................#...........................................................................#................. +...#.........................#.....................................................................#........................................ +.........................................................#...................................#........................................#..... +.........#....................................................#........#................#.....................#............................. +........................#..........................................................................................#........................ +..............#...................................#............................#.............................................#.....#........ +.................................#................................................................#......................................... +..................#........................#...............#................................#.............#.............................#... +..........#........................................................#............................................................#........... +..#.....................................................................................#.............................#..................... +..........................#..........#..................................#......................................#...........#................ +................................................................#........................................................................... +................#................................#..........................#............................................................... +...........................................#..................................................#.....#.......#............................... +..........#............................................#.....................................................................#.............. +.......................#....................................#...........................................................#..............#.... +.....#.........................#........#..............................................#.................#........................#......... +.................#....................................................#............................................#........................ +....................................#...............#................................................#...................................... +.........................#........................................#................#.......#...................#............................ +....................................................................................................................................#....... +...........#...................................#...........................#......................#.........................#..............# +..................................#......#.................................................................................................. +......#....................#.........................#..................................................#................................... +......................#...................................#......#.....#.................................................#.................. +..............#..............................................................................#.................#.....................#...... +............................................................................................................................................ +#.............................#................#....................................................................#....................#.. +............................................................................................................................................ +........#...........................................#....................................................................................... +...................................................................#..........#..................#.......................................... +.....................#............#........#.............................................#............#................#.................... +................#............................................................................................................#.............. +...............................................................................................................#...................#........ +........................#......#..........................#.....#......#................................................................#... +................................................#..........................................#.............#.................................. +......................................#..............................................................................#...................... +..#.................................................................#.........#............................................................. +..........#.....#...............................................................................................#...........#............... +.................................#....................................................................#..............................#...... +.....................................................#........................................#........................#.................... +..........................................#..................#............#................................................................. +......................#...............................................................#..................#.........#............#........... +......#........................................................................#............................................................ +...................................#...................................#..................................................#................. +...................................................#.........................................#.................#............................ +...........................#...................................#.....................................................................#...... +........................................#................................................................................................... +................#......................................#........................#.........#.....#........................................... +...........#......................#.....................................................................#................................... +....#....................#...................#...................#................................................#...........#...........#. +............................................................................................................................................ +............................................................................................................................................ +.....................................#....................................#................................................................. +.......................#..................#........#............................#................#.............#............................ +...............#...............................................#......................#..............................................#...... +............................................................................................................................................ +.................................#...........#.....................#....................................................#................... +............................................................................................................................................ +..#........#..........#...............#..................................................................#..........#......................# +............................................................#............................#.................................................. +.................................................................#..........#.................................#.................#........... +.............................#......................#....................................................................................... +....#..................................................................................................................................#.... +...................#...............#..................................................#....................#................................ +.........................................................#......................................#...................#..............#........ +.....................................................................#...................................................#.................. +........................#...................................................................#..................#............................ +...#.....#...............................#....................#............................................................................. +................#...............#........................................................................................................... +.....................#........................................................#.....................................................#....... +..............................................#.......#................#...............................................#...................# +.........................................................................................#...............#...................#.............. +.#...........................#.......#...................................................................................................... +.............................................................................................................#........................#..... +.................................#.......................................................................................................... +...........#........................................................................................#.............................#......... +................#...............................................#............................#...................#.......................... +...#............................................................................#........................................................... +....................................................#.......#.......#......#...........................................................#.... +.........................#.................................................................................................................. +....................#...............#.........................................................................................#............. +.........................................................#....................#......................#...................................... +....#........................#...............#........................#...............#..................................................... +..........#......#....................................................................................................................#..... +..............................................................................................#...................#......................... +.......................................................#...................................................#.................#.............. +..........................#....................#............................................................................................ +........................................#......................#.........#...............#.......#......................#.........#.....#... +...............................#....................................#....................................................................... +........#...........#.............................#......................................................................................... +...#...........#...................................................................#..................#............#........................ +...........................#..............................#...................................#............................................. +...................................#.............................#..........................................#............................... +..............................................#........................#........#..........................................#................ +.......................................................................................#.............................#..............#....... +.........................................#.................................................................................................. +.....#............#......................................#.....#............................#............................................... +............................#............................................................................................................... +.......................#.........#........................................#..............................#...............................#.. +..#...........#.......................................#.........................#........................................................... +.......................................#.........................#.......................................................................... +............................................................#............................................................................... +.......#......................#........................................#................................................#..............#.... +..............................................................................................................#............................. +...............................................#.....................................................#...................................... +......................#..................................................................#......#.................................#.......#. +..#.......#................#......#..................................#.......#.....................................#........................ +................#...............................................#..................#....................#..................#................ diff --git a/Day12/Part1.js b/Day12/Part1.js index 3a620a8..c5dc523 100644 --- a/Day12/Part1.js +++ b/Day12/Part1.js @@ -1,8 +1,8 @@ -import { readFileSync } from "fs"; -const t0 = performance.now(); - -const input = readFileSync("input.txt").toString(); -console.log(input); - -const t1 = performance.now(); -console.log(`Runtime: ${t1 - t0}ms`); +import { readFileSync } from "fs"; +const t0 = performance.now(); + +const input = readFileSync("input.txt").toString(); +console.log(input); + +const t1 = performance.now(); +console.log(`Runtime: ${t1 - t0}ms`); diff --git a/Day13/Part1.js b/Day13/Part1.js index 3a620a8..c5dc523 100644 --- a/Day13/Part1.js +++ b/Day13/Part1.js @@ -1,8 +1,8 @@ -import { readFileSync } from "fs"; -const t0 = performance.now(); - -const input = readFileSync("input.txt").toString(); -console.log(input); - -const t1 = performance.now(); -console.log(`Runtime: ${t1 - t0}ms`); +import { readFileSync } from "fs"; +const t0 = performance.now(); + +const input = readFileSync("input.txt").toString(); +console.log(input); + +const t1 = performance.now(); +console.log(`Runtime: ${t1 - t0}ms`); diff --git a/Day14/Part1.js b/Day14/Part1.js index 3a620a8..c5dc523 100644 --- a/Day14/Part1.js +++ b/Day14/Part1.js @@ -1,8 +1,8 @@ -import { readFileSync } from "fs"; -const t0 = performance.now(); - -const input = readFileSync("input.txt").toString(); -console.log(input); - -const t1 = performance.now(); -console.log(`Runtime: ${t1 - t0}ms`); +import { readFileSync } from "fs"; +const t0 = performance.now(); + +const input = readFileSync("input.txt").toString(); +console.log(input); + +const t1 = performance.now(); +console.log(`Runtime: ${t1 - t0}ms`); diff --git a/Day15/Part1.js b/Day15/Part1.js index f02ceea..da6fcc5 100644 --- a/Day15/Part1.js +++ b/Day15/Part1.js @@ -1,12 +1,12 @@ -import { readFileSync } from "fs"; -const t0 = performance.now(); - -const input = readFileSync("input.txt").toString().split("\n")[0].split(","); -const hashes = input.map((e) => - e.split("").reduce((a, i) => ((a + i.charCodeAt(0)) * 17) % 256, 0) -); -const sum = hashes.reduce((a, i) => a + i); -console.log(sum); - -const t1 = performance.now(); -console.log(`Runtime: ${t1 - t0}ms`); +import { readFileSync } from "fs"; +const t0 = performance.now(); + +const input = readFileSync("input.txt").toString().split("\n")[0].split(","); +const hashes = input.map((e) => + e.split("").reduce((a, i) => ((a + i.charCodeAt(0)) * 17) % 256, 0) +); +const sum = hashes.reduce((a, i) => a + i); +console.log(sum); + +const t1 = performance.now(); +console.log(`Runtime: ${t1 - t0}ms`); diff --git a/Day15/Part2.js b/Day15/Part2.js index f02ceea..da6fcc5 100644 --- a/Day15/Part2.js +++ b/Day15/Part2.js @@ -1,12 +1,12 @@ -import { readFileSync } from "fs"; -const t0 = performance.now(); - -const input = readFileSync("input.txt").toString().split("\n")[0].split(","); -const hashes = input.map((e) => - e.split("").reduce((a, i) => ((a + i.charCodeAt(0)) * 17) % 256, 0) -); -const sum = hashes.reduce((a, i) => a + i); -console.log(sum); - -const t1 = performance.now(); -console.log(`Runtime: ${t1 - t0}ms`); +import { readFileSync } from "fs"; +const t0 = performance.now(); + +const input = readFileSync("input.txt").toString().split("\n")[0].split(","); +const hashes = input.map((e) => + e.split("").reduce((a, i) => ((a + i.charCodeAt(0)) * 17) % 256, 0) +); +const sum = hashes.reduce((a, i) => a + i); +console.log(sum); + +const t1 = performance.now(); +console.log(`Runtime: ${t1 - t0}ms`); diff --git a/README.md b/README.md index 59df422..195aac4 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,29 @@ -# Advent of Code 2023 - -## About - -This repository stores my solutions to the daily challenges of [Advent of Code Calendar 2023](https://adventofcode.com/2023/). - -## Execution - -Any of the scripts can be executed directly using [NodeJS](https://nodejs.org/en/download/). - -**Example:** - -```bash -cd Day01/ -node Part1.js -``` - -## File explanation - -A single challenge consists of 3 files: - -- `input.txt`: My input data, as provided by AoC. -- `Part1.js`: My solution to part 1 of the challenge. -- `Part2.js`: My solution to part 2 of the challenge. - -Other special files: - -- [`template.js`](template.js): A template file to use when initializing a new challenge. -- `sample.js`: Example or test code; Ignored by git (see [.gitignore](.gitignore)). +# Advent of Code 2023 + +## About + +This repository stores my solutions to the daily challenges of [Advent of Code Calendar 2023](https://adventofcode.com/2023/). + +## Execution + +Any of the scripts can be executed directly using [NodeJS](https://nodejs.org/en/download/). + +**Example:** + +```bash +cd Day01/ +node Part1.js +``` + +## File explanation + +A single challenge consists of 3 files: + +- `input.txt`: My input data, as provided by AoC. +- `Part1.js`: My solution to part 1 of the challenge. +- `Part2.js`: My solution to part 2 of the challenge. + +Other special files: + +- [`template.js`](template.js): A template file to use when initializing a new challenge. +- `sample.js`: Example or test code; Ignored by git (see [.gitignore](.gitignore)). diff --git a/package.json b/package.json index 2b1afa4..7fcad92 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ -{ - "name": "aoc23", - "version": "1.0.0", - "description": "Advent of Code", - "author": "Baipyrus", - "license": "ISC", - "type": "module" +{ + "name": "aoc23", + "version": "1.0.0", + "description": "Advent of Code", + "author": "Baipyrus", + "license": "ISC", + "type": "module" } \ No newline at end of file diff --git a/template.js b/template.js index 3a620a8..c5dc523 100644 --- a/template.js +++ b/template.js @@ -1,8 +1,8 @@ -import { readFileSync } from "fs"; -const t0 = performance.now(); - -const input = readFileSync("input.txt").toString(); -console.log(input); - -const t1 = performance.now(); -console.log(`Runtime: ${t1 - t0}ms`); +import { readFileSync } from "fs"; +const t0 = performance.now(); + +const input = readFileSync("input.txt").toString(); +console.log(input); + +const t1 = performance.now(); +console.log(`Runtime: ${t1 - t0}ms`);