const fs = require("fs"); const filename = "input"; async function main() { const file = await fs.promises.readFile(filename, "utf-8"); const expenses = file.split("\n").map((num) => parseInt(num)); console.log(expenses); for (let i = 0; i < expenses.length; i++) { const a = expenses[i]; const counterpart = 2020 - a; for (let j = 0; j < expenses.length; j++) { const b = expenses[j]; for (let k = 0; k < expenses.length; k++) { const c = expenses[k]; if (a + b + c === 2020) { console.log(a, b, c, a * b * c); } } } } } main();