{"size": 661, "ext": "js", "max_stars_repo_path": "src/day9/part1.js", "max_stars_repo_name": "amcolash/advent-of-code-2020", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/day9/part1.js", "max_issues_repo_name": "amcolash/advent-of-code-2020", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/day9/part1.js", "max_forks_repo_name": "amcolash/advent-of-code-2020", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 23.6071428571, "max_line_length": 83, "alphanum_fraction": 0.5763993949}
const fs = require('fs');
const path = require('path');
const input = fs.readFileSync(path.join(__dirname, 'input.txt')).toString().trim();

const numbers = input.split('\n').map((n) => Number.parseInt(n));

let valid = true;
const previous = 25;

numbers.forEach((n, i) => {
  if (i < previous || !valid) return;

  let currentValid = false;
  for (let j = i - 25; j < i; j++) {
    if (currentValid) continue;
    for (let k = i - 25; k < i; k++) {
      if (currentValid || j === k) continue;

      if (numbers[j] + numbers[k] === numbers[i]) currentValid = true;
    }
  }

  if (!currentValid) {
    valid = false;
    console.log(i, numbers[i]);
  }
});
