├── src ├── utils.ts ├── 01 │ ├── example.txt │ ├── 01.test.ts │ ├── 01.ts │ └── input.txt ├── 03 │ ├── example.txt │ ├── example2.txt │ ├── 03.test.ts │ └── 03.ts ├── 02 │ ├── example.txt │ ├── 02.test.ts │ ├── 02.ts │ └── input.txt ├── 04 │ ├── example.txt │ ├── 04.test.ts │ └── 04.ts ├── 06 │ ├── example.txt │ ├── 06.test.ts │ └── 06.ts ├── 07 │ ├── example.txt │ ├── 07.test.ts │ └── 07.ts └── 05 │ ├── example.txt │ ├── 05.test.ts │ └── 05.ts ├── scripts ├── main.ts ├── api.ts ├── utils.ts ├── solve.ts └── scaffold.ts ├── .env.example ├── bun.lockb ├── global.d.ts ├── devbox.json ├── .envrc ├── package.json ├── tsconfig.json ├── LICENSE ├── README.md ├── devbox.lock └── .gitignore /src/utils.ts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /scripts/main.ts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | SESSION= 2 | YEAR=2023 3 | -------------------------------------------------------------------------------- /bun.lockb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hughevans/advent-2024/main/bun.lockb -------------------------------------------------------------------------------- /src/01/example.txt: -------------------------------------------------------------------------------- 1 | 3 4 2 | 4 3 3 | 2 5 4 | 1 3 5 | 3 9 6 | 3 3 7 | -------------------------------------------------------------------------------- /src/03/example.txt: -------------------------------------------------------------------------------- 1 | xmul(2,4)%&mul[3,7]!@^do_not_mul(5,5)+mul(32,64]then(mul(11,8)mul(8,5)) 2 | -------------------------------------------------------------------------------- /src/03/example2.txt: -------------------------------------------------------------------------------- 1 | xmul(2,4)&mul[3,7]!^don't()_mul(5,5)+mul(32,64](mul(11,8)undo()?mul(8,5)) 2 | -------------------------------------------------------------------------------- /src/02/example.txt: -------------------------------------------------------------------------------- 1 | 7 6 4 2 1 2 | 1 2 7 8 9 3 | 9 7 6 2 1 4 | 1 3 2 4 5 5 | 8 6 4 4 1 6 | 1 3 6 7 9 7 | -------------------------------------------------------------------------------- /global.d.ts: -------------------------------------------------------------------------------- 1 | declare module "bun" { 2 | interface Env { 3 | SESSION: string 4 | YEAR: string 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/04/example.txt: -------------------------------------------------------------------------------- 1 | MMMSXXMASM 2 | MSAMXMSMSA 3 | AMXSXMAAMM 4 | MSAMASMSMX 5 | XMASAMXAMM 6 | XXAMMXXAMA 7 | SMSMSASXSS 8 | SAXAMASAAA 9 | MAMMMXMMMM 10 | MXMXAXMASX 11 | -------------------------------------------------------------------------------- /src/06/example.txt: -------------------------------------------------------------------------------- 1 | ....#..... 2 | .........# 3 | .......... 4 | ..#....... 5 | .......#.. 6 | .......... 7 | .#..^..... 8 | ........#. 9 | #......... 10 | ......#... 11 | -------------------------------------------------------------------------------- /src/07/example.txt: -------------------------------------------------------------------------------- 1 | 190: 10 19 2 | 3267: 81 40 27 3 | 83: 17 5 4 | 156: 15 6 5 | 7290: 6 8 6 15 6 | 161011: 16 10 13 7 | 192: 17 8 14 8 | 21037: 9 7 18 13 9 | 292: 11 6 16 20 10 | -------------------------------------------------------------------------------- /devbox.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/jetpack-io/devbox/main/.schema/devbox.schema.json", 3 | "packages": ["bun@latest"], 4 | "env": {}, 5 | "shell": {} 6 | } 7 | -------------------------------------------------------------------------------- /.envrc: -------------------------------------------------------------------------------- 1 | # Automatically sets up your devbox environment whenever you cd into this 2 | # directory via our direnv integration: 3 | 4 | eval "$(devbox generate direnv --print-envrc)" 5 | 6 | # check out https://www.jetpack.io/devbox/docs/ide_configuration/direnv/ 7 | # for more details 8 | -------------------------------------------------------------------------------- /src/05/example.txt: -------------------------------------------------------------------------------- 1 | 47|53 2 | 97|13 3 | 97|61 4 | 97|47 5 | 75|29 6 | 61|13 7 | 75|53 8 | 29|13 9 | 97|29 10 | 53|29 11 | 61|53 12 | 97|53 13 | 61|29 14 | 47|13 15 | 75|47 16 | 97|75 17 | 47|61 18 | 75|61 19 | 47|29 20 | 75|13 21 | 53|13 22 | 23 | 75,47,61,53,29 24 | 97,61,53,29,13 25 | 75,29,13 26 | 75,97,47,61,53 27 | 61,13,29 28 | 97,13,75,29,47 29 | -------------------------------------------------------------------------------- /scripts/api.ts: -------------------------------------------------------------------------------- 1 | import { isOk } from './utils.ts' 2 | 3 | const headers = { 4 | Cookie: `session=${process.env.SESSION}` 5 | } 6 | 7 | export function fetchInput({ day, year }: { day: number; year: number }) { 8 | return fetch(`https://adventofcode.com/${year}/day/${day}/input`, { 9 | headers 10 | }) 11 | .then(isOk) 12 | .then(response => response.text()) 13 | } 14 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "advent-of-code-bun", 3 | "module": "scripts/main.ts", 4 | "type": "module", 5 | "scripts": { 6 | "solve": "bun --watch ./scripts/solve.ts" 7 | }, 8 | "devDependencies": { 9 | "bun-types": "latest", 10 | "chalk": "^5.3.0", 11 | "dedent": "^1.5.1", 12 | "prettier": "^3.1.0" 13 | }, 14 | "peerDependencies": { 15 | "typescript": "^5.0.0" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/02/02.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, expect, test } from "bun:test"; 2 | import { partOne, partTwo } from "./02"; 3 | 4 | describe("Day 2", async () => { 5 | test("partOne", async () => { 6 | const input = await Bun.file(`./src/02/example.txt`).text(); 7 | expect(partOne(input)).toEqual(2); 8 | }); 9 | 10 | test("partTwo", async () => { 11 | const input = await Bun.file(`./src/02/example.txt`).text(); 12 | expect(partTwo(input)).toEqual(4); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /src/04/04.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, expect, test } from "bun:test"; 2 | import { partOne, partTwo } from "./04"; 3 | 4 | describe("Day 4", async () => { 5 | test("partOne", async () => { 6 | const input = await Bun.file(`./src/04/example.txt`).text(); 7 | expect(partOne(input)).toEqual(18); 8 | }); 9 | 10 | test("partTwo", async () => { 11 | const input = await Bun.file(`./src/04/example.txt`).text(); 12 | expect(partTwo(input)).toEqual(9); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /src/06/06.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, expect, test } from "bun:test"; 2 | import { partOne, partTwo } from "./06"; 3 | 4 | describe("Day 6", async () => { 5 | test("partOne", async () => { 6 | const input = await Bun.file(`./src/06/example.txt`).text(); 7 | expect(partOne(input)).toEqual(41); 8 | }); 9 | 10 | test("partTwo", async () => { 11 | const input = await Bun.file(`./src/06/example.txt`).text(); 12 | expect(partTwo(input)).toEqual(6); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /src/01/01.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, expect, test } from "bun:test"; 2 | import { partOne, partTwo } from "./01"; 3 | 4 | describe("Day 1", async () => { 5 | test("partOne", async () => { 6 | const input = await Bun.file(`./src/01/example.txt`).text(); 7 | expect(partOne(input)).toEqual(11); 8 | }); 9 | 10 | test("partTwo", async () => { 11 | const input = await Bun.file(`./src/01/example.txt`).text(); 12 | expect(partTwo(input)).toEqual(31); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /src/03/03.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, expect, test } from "bun:test"; 2 | import { partOne, partTwo } from "./03"; 3 | 4 | describe("Day 3", async () => { 5 | test("partOne", async () => { 6 | const input = await Bun.file(`./src/03/example.txt`).text(); 7 | expect(partOne(input)).toEqual(161); 8 | }); 9 | 10 | test("partTwo", async () => { 11 | const input = await Bun.file(`./src/03/example2.txt`).text(); 12 | expect(partTwo(input)).toEqual(48); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /src/05/05.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, expect, test } from "bun:test"; 2 | import { partOne, partTwo } from "./05"; 3 | 4 | describe("Day 5", async () => { 5 | test("partOne", async () => { 6 | const input = await Bun.file(`./src/05/example.txt`).text(); 7 | expect(partOne(input)).toEqual(143); 8 | }); 9 | 10 | test("partTwo", async () => { 11 | const input = await Bun.file(`./src/05/example.txt`).text(); 12 | expect(partTwo(input)).toEqual(123); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /src/07/07.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, expect, test } from "bun:test"; 2 | import { partOne, partTwo } from "./07"; 3 | 4 | describe("Day 7", async () => { 5 | test("partOne", async () => { 6 | const input = await Bun.file(`./src/07/example.txt`).text(); 7 | expect(partOne(input)).toEqual(3749); 8 | }); 9 | 10 | test("partTwo", async () => { 11 | const input = await Bun.file(`./src/07/example.txt`).text(); 12 | expect(partTwo(input)).toEqual(11387); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "lib": ["ESNext"], 4 | "module": "esnext", 5 | "target": "esnext", 6 | "moduleResolution": "bundler", 7 | "moduleDetection": "force", 8 | "allowImportingTsExtensions": true, 9 | "noEmit": true, 10 | "composite": true, 11 | "strict": true, 12 | "noUncheckedIndexedAccess": false, 13 | "downlevelIteration": true, 14 | "skipLibCheck": true, 15 | "jsx": "preserve", 16 | "allowSyntheticDefaultImports": true, 17 | "forceConsistentCasingInFileNames": true, 18 | "allowJs": true, 19 | "checkJs": true, 20 | "types": [ 21 | "bun-types" 22 | ], 23 | "baseUrl": "./", 24 | "paths": { 25 | "@/*": ["./src/*"] 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /scripts/utils.ts: -------------------------------------------------------------------------------- 1 | export function withPerformance(handler: () => T) { 2 | const start = performance.now() 3 | const result = handler() 4 | const end = performance.now() 5 | 6 | return [result, end - start] as const 7 | } 8 | 9 | export function formatPerformance(time: number) { 10 | const round = (x: number) => Math.round((x + Number.EPSILON) * 100) / 100 11 | if (time < 1) return `${round(time * 1000)} µs` 12 | return `${round(time)} ms` 13 | } 14 | 15 | export function isBetween(x: number, [min, max]: [number, number]) { 16 | return x >= min && x <= max 17 | } 18 | 19 | export function isOk(response: Response): Promise { 20 | return new Promise((resolve, reject) => 21 | response.ok ? resolve(response) : reject(response) 22 | ) 23 | } 24 | -------------------------------------------------------------------------------- /src/03/03.ts: -------------------------------------------------------------------------------- 1 | export function extractPairs(input: string) { 2 | const reg = /mul\((\d+\,\d+)\)/g; 3 | const matches = [...input.matchAll(reg)]; 4 | 5 | return matches.map((match) => { 6 | return match[1].split(",").map((num) => parseInt(num)); 7 | }); 8 | } 9 | 10 | export function partOne(input: string) { 11 | const pairs = extractPairs(input); 12 | 13 | return pairs.reduce((sum, [a, b]) => sum + a * b, 0); 14 | } 15 | 16 | export function extractInstructions(input: string) { 17 | const matches = input.split("don't()"); 18 | let enabledInstructions = ""; 19 | 20 | matches.forEach((match, index) => { 21 | if (index === 0) { 22 | enabledInstructions += match; 23 | return; 24 | } 25 | 26 | const [, ...enabled] = match.split("do()"); 27 | enabledInstructions += enabled.join(""); 28 | }); 29 | 30 | return enabledInstructions; 31 | } 32 | 33 | export function partTwo(input: string) { 34 | return partOne(extractInstructions(input)); 35 | } 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Adrian Klimek 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/02/02.ts: -------------------------------------------------------------------------------- 1 | export function parse(input: string) { 2 | return input 3 | .trim() 4 | .split("\n") 5 | .map((line) => line.split(" ").map((num) => parseInt(num))); 6 | } 7 | 8 | function isReportSafe(levels: number[]) { 9 | let isSafe = true; 10 | const ascending = Math.sign(levels[0] - levels[1]); 11 | 12 | for (let j = 1; j < levels.length; j++) { 13 | const diff = levels[j - 1] - levels[j]; 14 | 15 | if ( 16 | Math.abs(diff) < 1 || 17 | Math.abs(diff) > 3 || 18 | Math.sign(diff) !== ascending 19 | ) { 20 | isSafe = false; 21 | break; 22 | } 23 | } 24 | 25 | return isSafe; 26 | } 27 | 28 | export function partOne(input: string) { 29 | return parse(input).reduce( 30 | (sum, levels) => sum + (isReportSafe(levels) ? 1 : 0), 31 | 0 32 | ); 33 | } 34 | 35 | export function partTwo(input: string) { 36 | return parse(input).reduce((sum, levels) => { 37 | for (let j = 0; j < levels.length; j++) { 38 | let newLevels = [...levels]; 39 | newLevels.splice(j, 1); 40 | 41 | if (isReportSafe(newLevels)) { 42 | sum++; 43 | break; 44 | } 45 | } 46 | 47 | return sum; 48 | }, 0); 49 | } 50 | -------------------------------------------------------------------------------- /scripts/solve.ts: -------------------------------------------------------------------------------- 1 | import { argv } from 'bun' 2 | import chalk from 'chalk' 3 | import { formatPerformance, withPerformance, isBetween } from './utils.ts' 4 | import { scaffold } from './scaffold.ts' 5 | 6 | const day = parseInt(argv[2] ?? '') 7 | const year = parseInt(process.env.YEAR ?? new Date().getFullYear()) 8 | 9 | if (!isBetween(day, [1, 25])) { 10 | console.log(`🎅 Pick a day between ${chalk.bold(1)} and ${chalk.bold(25)}.`) 11 | console.log(`🎅 To get started, try: ${chalk.cyan('bun solve 1')}`) 12 | process.exit(0) 13 | } 14 | 15 | await scaffold(day, year) 16 | 17 | const name = `${day}`.padStart(2, '0') 18 | 19 | const { default: input } = await import(`@/${name}/input.txt`) 20 | const { partOne, partTwo, parse } = await import(`@/${name}/${name}.ts`) 21 | 22 | const [one, onePerformance] = withPerformance(() => partOne?.(parse(input))) 23 | const [two, twoPerformance] = withPerformance(() => partTwo?.(parse(input))) 24 | 25 | console.log( 26 | '🌲', 27 | 'Part One:', 28 | chalk.green(one ?? '—'), 29 | one ? `(${formatPerformance(onePerformance)})` : '' 30 | ) 31 | console.log( 32 | '🎄', 33 | 'Part Two:', 34 | chalk.green(two ?? '—'), 35 | two ? `(${formatPerformance(twoPerformance)})` : '' 36 | ) 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Advent of Code with Bun 2 | 3 | A template repository for solving Advent of Code and experimenting with Bun runtime. 4 | 5 | ## Getting started 6 | 7 | 1. Generate your repository using [this template](https://github.com/adrianklimek/advent-of-code-bun/generate). 8 | 2. Make sure you have installed [Bun](https://bun.sh/docs/installation#installing). 9 | 3. Install dependencies: 10 | 11 | ```bash 12 | bun install 13 | ``` 14 | 15 | 4. Create `.env` file based on `.env.example`. 16 | 5. (Optional) Set your session token with environment variables to automatically fetch your input. You can obtain the session token from the AoC session cookie. 17 | 18 | ## Running the Code 19 | 20 | To run any solution you have to run the `solve` script. It will create all directories and files for a day, and also it can fetch your input file. Besides that, it watches all the changes you make and shows a result in a terminal. 21 | 22 | ### Example usage 23 | 24 | To run a solution for the first day: 25 | 26 | ```bash 27 | bun solve 1 28 | ``` 29 | 30 | To run tests in watch mode: 31 | 32 | ```bash 33 | bun test --watch 34 | ``` 35 | 36 | ## Structure 37 | 38 | For each day a directory in `src` is created with the following structure: 39 | 40 | ```bash 41 | 📂 01 42 | ├── 📜 01.ts 43 | ├── 📜 01.test.ts 44 | ├── 📜 example.txt 45 | └── 📜 input.txt 46 | ``` 47 | 48 | ## Closing words 49 | 50 | Happy coding! 🎄✨ 51 | -------------------------------------------------------------------------------- /src/01/01.ts: -------------------------------------------------------------------------------- 1 | interface Data { 2 | listOne: number[]; 3 | listTwo: number[]; 4 | } 5 | 6 | export function parse(input: string) { 7 | const lines = input.split("\n"); 8 | 9 | let data: Data = { 10 | listOne: [], 11 | listTwo: [], 12 | }; 13 | 14 | lines.forEach((line) => { 15 | let a, b; 16 | [a, b] = line.split(" "); 17 | 18 | if (a && b) { 19 | data.listOne.push(parseInt(a)); 20 | data.listTwo.push(parseInt(b)); 21 | } 22 | }); 23 | 24 | return data; 25 | } 26 | 27 | export function sortArray(arr: number[]) { 28 | return arr.sort((a, b) => a - b); 29 | } 30 | 31 | export function partOne(input: string) { 32 | let { listOne, listTwo } = parse(input); 33 | listOne = sortArray(listOne); 34 | listTwo = sortArray(listTwo); 35 | 36 | let sum = 0; 37 | 38 | listOne.forEach((a, index) => { 39 | if (listTwo[index]) { 40 | sum += Math.abs(a - listTwo[index]); 41 | } 42 | }); 43 | 44 | return sum; 45 | } 46 | 47 | export function partTwo(input: string) { 48 | let { listOne, listTwo } = parse(input); 49 | 50 | const score = listOne.reduce((runningSum, a) => { 51 | const rowCount = listTwo.reduce((instanceCount, b) => { 52 | if (a === b) { 53 | return (instanceCount += 1); 54 | } 55 | return instanceCount; 56 | }, 0); 57 | return runningSum + rowCount * a; 58 | }, 0); 59 | 60 | return score; 61 | } 62 | -------------------------------------------------------------------------------- /scripts/scaffold.ts: -------------------------------------------------------------------------------- 1 | import chalk from 'chalk' 2 | import dedent from 'dedent' 3 | import { existsSync } from 'node:fs' 4 | import { mkdir } from 'node:fs/promises' 5 | 6 | import { fetchInput } from './api.ts' 7 | 8 | export async function scaffold(day: number, year: number) { 9 | const name = `${day}`.padStart(2, '0') 10 | 11 | const directory = new URL(`../src/${name}/`, import.meta.url) 12 | 13 | if (existsSync(directory)) return 14 | 15 | console.log(`📂 Setting up day ${day} of ${year}`) 16 | 17 | await mkdir(directory) 18 | 19 | const test = dedent` 20 | import { describe } from 'bun:test' 21 | 22 | describe(${`'Day ${day}'`}, () => { 23 | describe('Part One', () => {}) 24 | 25 | describe('Part Two', () => {}) 26 | }) 27 | ` 28 | 29 | const solution = dedent` 30 | export function parse(input: string) { 31 | return input 32 | } 33 | 34 | export function partOne(input: ReturnType) {} 35 | 36 | export function partTwo(input: ReturnType) {} 37 | ` 38 | 39 | console.log(`📂 Fetching your input`) 40 | 41 | const input = await fetchInput({ day, year }).catch(() => { 42 | console.log( 43 | chalk.red.bold( 44 | '📂 Fetching your input have failed, empty file will be created.' 45 | ) 46 | ) 47 | }) 48 | 49 | await Bun.write(new URL(`${name}.test.ts`, directory.href), test) 50 | await Bun.write(new URL(`${name}.ts`, directory.href), solution) 51 | await Bun.write(new URL(`input.txt`, directory.href), input ?? '') 52 | await Bun.write(new URL(`example.txt`, directory.href), '') 53 | 54 | console.log('📂 You all set up, have fun!') 55 | } 56 | -------------------------------------------------------------------------------- /devbox.lock: -------------------------------------------------------------------------------- 1 | { 2 | "lockfile_version": "1", 3 | "packages": { 4 | "bun@latest": { 5 | "last_modified": "2024-11-18T00:41:09Z", 6 | "resolved": "github:NixOS/nixpkgs/5083ec887760adfe12af64830a66807423a859a7#bun", 7 | "source": "devbox-search", 8 | "version": "1.1.34", 9 | "systems": { 10 | "aarch64-darwin": { 11 | "outputs": [ 12 | { 13 | "name": "out", 14 | "path": "/nix/store/xnj00gq1mfffvgyisghk4m9f38gc5c5c-bun-1.1.34", 15 | "default": true 16 | } 17 | ], 18 | "store_path": "/nix/store/xnj00gq1mfffvgyisghk4m9f38gc5c5c-bun-1.1.34" 19 | }, 20 | "aarch64-linux": { 21 | "outputs": [ 22 | { 23 | "name": "out", 24 | "path": "/nix/store/kccpzv8fb7swmmxbhv805qzq242rhy33-bun-1.1.34", 25 | "default": true 26 | } 27 | ], 28 | "store_path": "/nix/store/kccpzv8fb7swmmxbhv805qzq242rhy33-bun-1.1.34" 29 | }, 30 | "x86_64-darwin": { 31 | "outputs": [ 32 | { 33 | "name": "out", 34 | "path": "/nix/store/8h5k3l4fpgs3al2wvna7x9ybyyc8k36d-bun-1.1.34", 35 | "default": true 36 | } 37 | ], 38 | "store_path": "/nix/store/8h5k3l4fpgs3al2wvna7x9ybyyc8k36d-bun-1.1.34" 39 | }, 40 | "x86_64-linux": { 41 | "outputs": [ 42 | { 43 | "name": "out", 44 | "path": "/nix/store/x089g4srqw71w5jnc87vxbh7m12498i0-bun-1.1.34", 45 | "default": true 46 | } 47 | ], 48 | "store_path": "/nix/store/x089g4srqw71w5jnc87vxbh7m12498i0-bun-1.1.34" 49 | } 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/07/07.ts: -------------------------------------------------------------------------------- 1 | export function parse(input: string) { 2 | const rows: [number, number[]][] = input 3 | .trim() 4 | .split("\n") 5 | .map((line) => { 6 | const [total, rest] = line.split(": "); 7 | const numbers = rest.split(" ").map((n) => parseInt(n)); 8 | 9 | return [parseInt(total), numbers]; 10 | }); 11 | 12 | return rows; 13 | } 14 | 15 | export function partOne(input: string) { 16 | const rows = parse(input); 17 | 18 | const correctRows = rows.filter(([total, numbers]) => { 19 | return findMatch(total, numbers[0], numbers.slice(1)); 20 | }); 21 | 22 | return correctRows.reduce((acc, [total, numbers]) => { 23 | acc += total; 24 | return acc; 25 | }, 0); 26 | } 27 | 28 | function findMatch(total: number, acc: number, rest: number[]): boolean { 29 | if (rest.length === 1) { 30 | if (acc + rest[0] === total) { 31 | return true; 32 | } 33 | 34 | if (acc * rest[0] === total) { 35 | return true; 36 | } 37 | 38 | return false; 39 | } 40 | 41 | return ( 42 | findMatch(total, acc + rest[0], rest.slice(1)) || 43 | findMatch(total, acc * rest[0], rest.slice(1)) 44 | ); 45 | } 46 | 47 | export function partTwo(input: string) { 48 | const rows = parse(input); 49 | 50 | const correctRows = rows.filter(([total, numbers]) => { 51 | return findMatchTwo(total, numbers[0], numbers.slice(1)); 52 | }); 53 | 54 | return correctRows.reduce((acc, [total, numbers]) => { 55 | acc += total; 56 | return acc; 57 | }, 0); 58 | } 59 | 60 | function findMatchTwo(total: number, acc: number, rest: number[]): boolean { 61 | if (rest.length === 1) { 62 | if (acc + rest[0] === total) { 63 | return true; 64 | } 65 | 66 | if (acc * rest[0] === total) { 67 | return true; 68 | } 69 | 70 | if (parseInt(acc.toString() + rest[0].toString()) === total) { 71 | return true; 72 | } 73 | 74 | return false; 75 | } 76 | 77 | return ( 78 | findMatchTwo(total, acc + rest[0], rest.slice(1)) || 79 | findMatchTwo(total, acc * rest[0], rest.slice(1)) || 80 | findMatchTwo( 81 | total, 82 | parseInt(acc.toString() + rest[0].toString()), 83 | rest.slice(1) 84 | ) 85 | ); 86 | } 87 | -------------------------------------------------------------------------------- /src/05/05.ts: -------------------------------------------------------------------------------- 1 | export function parse(input: string) { 2 | const [rulesInput, pagesInput] = input.trim().split("\n\n"); 3 | 4 | const rules = rulesInput 5 | .split("\n") 6 | .map((line) => line.split("|").map((rule) => parseInt(rule))); 7 | 8 | const updates = pagesInput 9 | .split("\n") 10 | .map((line) => line.split(",").map((rule) => parseInt(rule))); 11 | 12 | return { rules, updates }; 13 | } 14 | 15 | export function partOne(input: string) { 16 | const { rules, updates } = parse(input); 17 | let validUpdates = []; 18 | 19 | for (let u = 0; u < updates.length; u++) { 20 | let applicableRules = []; 21 | 22 | for (let r = 0; r < rules.length; r++) { 23 | if (rules[r].every((rule) => updates[u].includes(rule))) { 24 | applicableRules.push(rules[r]); 25 | } 26 | } 27 | 28 | if ( 29 | applicableRules.every((rule) => { 30 | return updates[u].indexOf(rule[0]) < updates[u].indexOf(rule[1]); 31 | }) 32 | ) { 33 | validUpdates.push(updates[u]); 34 | } 35 | } 36 | 37 | const totalPages = validUpdates.reduce( 38 | (sum, update) => sum + update[Math.floor(update.length / 2)], 39 | 0 40 | ); 41 | 42 | return totalPages; 43 | } 44 | 45 | export function partTwo(input: string) { 46 | const { rules, updates } = parse(input); 47 | let invalidUpdates = []; 48 | 49 | for (let u = 0; u < updates.length; u++) { 50 | let applicableRules: number[][] = []; 51 | 52 | for (let r = 0; r < rules.length; r++) { 53 | if (rules[r].every((rule) => updates[u].includes(rule))) { 54 | applicableRules.push(rules[r]); 55 | } 56 | } 57 | 58 | if ( 59 | !applicableRules.every((rule) => { 60 | return updates[u].indexOf(rule[0]) < updates[u].indexOf(rule[1]); 61 | }) 62 | ) { 63 | let reorderedUpdate = [...updates[u]]; 64 | 65 | reorderedUpdate.sort(function (x, y) { 66 | if (applicableRules.some((rule) => rule[0] === x && rule[1] === y)) { 67 | return -1; 68 | } 69 | 70 | if (applicableRules.some((rule) => rule[1] === x && rule[0] === y)) { 71 | return 1; 72 | } 73 | 74 | return 0; 75 | }); 76 | 77 | invalidUpdates.push(reorderedUpdate); 78 | } 79 | } 80 | 81 | const totalPages = invalidUpdates.reduce( 82 | (sum, update) => sum + update[Math.floor(update.length / 2)], 83 | 0 84 | ); 85 | 86 | return totalPages; 87 | } 88 | -------------------------------------------------------------------------------- /src/04/04.ts: -------------------------------------------------------------------------------- 1 | export function parse(input: string) { 2 | const rows = input 3 | .trim() 4 | .split("\n") 5 | .map((line) => line.split("")); 6 | 7 | return { rows, numRows: rows.length, numColumns: rows[0].length }; 8 | } 9 | 10 | export function partOne(input: string) { 11 | const { rows, numRows, numColumns } = parse(input); 12 | let words = []; 13 | 14 | for (let r = 0; r < numRows; r++) { 15 | for (let c = 0; c < numColumns; c++) { 16 | if (r < numRows - 3) { 17 | words.push( 18 | rows[r][c] + rows[r + 1][c] + rows[r + 2][c] + rows[r + 3][c] 19 | ); 20 | 21 | if (c < numColumns - 3) { 22 | words.push( 23 | rows[r][c] + 24 | rows[r + 1][c + 1] + 25 | rows[r + 2][c + 2] + 26 | rows[r + 3][c + 3] 27 | ); 28 | } 29 | 30 | if (c >= 3) { 31 | words.push( 32 | rows[r][c] + 33 | rows[r + 1][c - 1] + 34 | rows[r + 2][c - 2] + 35 | rows[r + 3][c - 3] 36 | ); 37 | } 38 | } 39 | 40 | if (c < numColumns - 3) { 41 | words.push( 42 | rows[r][c] + rows[r][c + 1] + rows[r][c + 2] + rows[r][c + 3] 43 | ); 44 | } 45 | } 46 | } 47 | 48 | const count = words.reduce((sum, word) => { 49 | if (word === "XMAS" || word === "SAMX") { 50 | return sum + 1; 51 | } 52 | 53 | return sum; 54 | }, 0); 55 | 56 | return count; 57 | } 58 | 59 | export function partTwo(input: string) { 60 | const { rows, numRows, numColumns } = parse(input); 61 | 62 | let words: [string, number[]][] = []; 63 | 64 | for (let r = 0; r < numRows; r++) { 65 | for (let c = 0; c < numColumns; c++) { 66 | if (r < numRows - 2) { 67 | if (c < numColumns - 2) { 68 | words.push([ 69 | rows[r][c] + rows[r + 1][c + 1] + rows[r + 2][c + 2], 70 | [r + 1, c + 1], 71 | ]); 72 | } 73 | 74 | if (c >= 2) { 75 | words.push([ 76 | rows[r][c] + rows[r + 1][c - 1] + rows[r + 2][c - 2], 77 | [r + 1, c - 1], 78 | ]); 79 | } 80 | } 81 | } 82 | } 83 | 84 | let xMap: Record = {}; 85 | 86 | words.forEach((word) => { 87 | if (word[0] === "MAS" || word[0] === "SAM") { 88 | const xKey = word[1].join("-"); 89 | xMap[xKey] ? xMap[xKey]++ : (xMap[xKey] = 1); 90 | } 91 | }); 92 | 93 | const count = Object.values(xMap).reduce((sum, xCount) => { 94 | return xCount === 2 ? sum + 1 : sum; 95 | }, 0); 96 | 97 | return count; 98 | } 99 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore 2 | 3 | # Logs 4 | 5 | logs 6 | _.log 7 | npm-debug.log_ 8 | yarn-debug.log* 9 | yarn-error.log* 10 | lerna-debug.log* 11 | .pnpm-debug.log* 12 | 13 | # Diagnostic reports (https://nodejs.org/api/report.html) 14 | 15 | report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json 16 | 17 | # Runtime data 18 | 19 | pids 20 | _.pid 21 | _.seed 22 | \*.pid.lock 23 | 24 | # Directory for instrumented libs generated by jscoverage/JSCover 25 | 26 | lib-cov 27 | 28 | # Coverage directory used by tools like istanbul 29 | 30 | coverage 31 | \*.lcov 32 | 33 | # nyc test coverage 34 | 35 | .nyc_output 36 | 37 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 38 | 39 | .grunt 40 | 41 | # Bower dependency directory (https://bower.io/) 42 | 43 | bower_components 44 | 45 | # node-waf configuration 46 | 47 | .lock-wscript 48 | 49 | # Compiled binary addons (https://nodejs.org/api/addons.html) 50 | 51 | build/Release 52 | 53 | # Dependency directories 54 | 55 | node_modules/ 56 | jspm_packages/ 57 | 58 | # Snowpack dependency directory (https://snowpack.dev/) 59 | 60 | web_modules/ 61 | 62 | # TypeScript cache 63 | 64 | \*.tsbuildinfo 65 | 66 | # Optional npm cache directory 67 | 68 | .npm 69 | 70 | # Optional eslint cache 71 | 72 | .eslintcache 73 | 74 | # Optional stylelint cache 75 | 76 | .stylelintcache 77 | 78 | # Microbundle cache 79 | 80 | .rpt2_cache/ 81 | .rts2_cache_cjs/ 82 | .rts2_cache_es/ 83 | .rts2_cache_umd/ 84 | 85 | # Optional REPL history 86 | 87 | .node_repl_history 88 | 89 | # Output of 'npm pack' 90 | 91 | \*.tgz 92 | 93 | # Yarn Integrity file 94 | 95 | .yarn-integrity 96 | 97 | # dotenv environment variable files 98 | 99 | .env 100 | .env.development.local 101 | .env.test.local 102 | .env.production.local 103 | .env.local 104 | 105 | # parcel-bundler cache (https://parceljs.org/) 106 | 107 | .cache 108 | .parcel-cache 109 | 110 | # Next.js build output 111 | 112 | .next 113 | out 114 | 115 | # Nuxt.js build / generate output 116 | 117 | .nuxt 118 | dist 119 | 120 | # Gatsby files 121 | 122 | .cache/ 123 | 124 | # Comment in the public line in if your project uses Gatsby and not Next.js 125 | 126 | # https://nextjs.org/blog/next-9-1#public-directory-support 127 | 128 | # public 129 | 130 | # vuepress build output 131 | 132 | .vuepress/dist 133 | 134 | # vuepress v2.x temp and cache directory 135 | 136 | .temp 137 | .cache 138 | 139 | # Docusaurus cache and generated files 140 | 141 | .docusaurus 142 | 143 | # Serverless directories 144 | 145 | .serverless/ 146 | 147 | # FuseBox cache 148 | 149 | .fusebox/ 150 | 151 | # DynamoDB Local files 152 | 153 | .dynamodb/ 154 | 155 | # TernJS port file 156 | 157 | .tern-port 158 | 159 | # Stores VSCode versions used for testing VSCode extensions 160 | 161 | .vscode-test 162 | 163 | # yarn v2 164 | 165 | .yarn/cache 166 | .yarn/unplugged 167 | .yarn/build-state.yml 168 | .yarn/install-state.gz 169 | .pnp.\* 170 | 171 | .idea 172 | 173 | */**/input.txt 174 | -------------------------------------------------------------------------------- /src/06/06.ts: -------------------------------------------------------------------------------- 1 | export function parse(input: string) { 2 | let startPosition: [number, number] = [0, 0]; 3 | 4 | const obstructions = input 5 | .trim() 6 | .split("\n") 7 | .map((line, row) => 8 | line.split("").map((char, col) => { 9 | if (char === "^") { 10 | startPosition = [row, col]; 11 | } 12 | return char === "#"; 13 | }) 14 | ); 15 | 16 | return { obstructions, startPosition }; 17 | } 18 | 19 | export function partOne(input: string) { 20 | const { obstructions, startPosition } = parse(input); 21 | const patrol = extractPatrol(obstructions, startPosition); 22 | 23 | const uniquePoints = Array.from( 24 | new Map(patrol.map((p) => [[p[0], p[1]].join(), p])).values() 25 | ); 26 | 27 | return uniquePoints.length; 28 | } 29 | 30 | export function partTwo(input: string) { 31 | const { obstructions, startPosition } = parse(input); 32 | const patrol = extractPatrol(obstructions, startPosition); 33 | let loops: number[][] = []; 34 | 35 | for (let i = 0; i < patrol.length - 1; i++) { 36 | let modifiedObstructions = structuredClone(obstructions); 37 | modifiedObstructions[patrol[i + 1][0]][patrol[i + 1][1]] = true; 38 | let [row, column, direction] = patrol[i]; 39 | 40 | let modifiedPatrol = extractPatrol( 41 | modifiedObstructions, 42 | [row, column], 43 | direction 44 | ); 45 | 46 | const [firstRow, firstColumn] = modifiedPatrol[0]; 47 | const [lastRow, lastColumn] = modifiedPatrol[modifiedPatrol.length - 1]; 48 | 49 | if ( 50 | modifiedPatrol.length > 1 && 51 | firstRow === lastRow && 52 | firstColumn === lastColumn 53 | ) { 54 | console.log(patrol[i + 1]); 55 | loops.push([firstRow, firstColumn]); 56 | } 57 | } 58 | 59 | const uniquePoints = Array.from( 60 | new Map(loops.map((p) => [[p[0], p[1]].join(), p])).values() 61 | ); 62 | 63 | return uniquePoints.length; 64 | } 65 | 66 | function isObstructed(obstructions: boolean[][], position: number[]) { 67 | return obstructions[position[0]][position[1]]; 68 | } 69 | 70 | function isOffGrid(obstructions: boolean[][], position: number[]) { 71 | return ( 72 | position[0] < 0 || 73 | position[1] < 0 || 74 | position[0] >= obstructions[0].length || 75 | position[1] >= obstructions.length 76 | ); 77 | } 78 | 79 | function extractPatrol( 80 | obstructions: boolean[][], 81 | startPosition: [number, number], 82 | startDirection = "up" 83 | ) { 84 | let patrol: [number, number, string][] = [[...startPosition, startDirection]]; 85 | let direction = startDirection; 86 | let onGrid = true; 87 | let inLoop = false; 88 | 89 | while (onGrid && !inLoop) { 90 | let latestPosition = patrol[patrol.length - 1]; 91 | 92 | if (direction === "up") { 93 | let nextPosition: [number, number] = [ 94 | latestPosition[0] - 1, 95 | latestPosition[1], 96 | ]; 97 | 98 | if (isOffGrid(obstructions, nextPosition)) { 99 | onGrid = false; 100 | } else if (isObstructed(obstructions, nextPosition)) { 101 | direction = "right"; 102 | } else { 103 | patrol.push([...nextPosition, direction]); 104 | } 105 | } else if (direction === "right") { 106 | let nextPosition: [number, number] = [ 107 | latestPosition[0], 108 | latestPosition[1] + 1, 109 | ]; 110 | 111 | if (isOffGrid(obstructions, nextPosition)) { 112 | onGrid = false; 113 | } else if (isObstructed(obstructions, nextPosition)) { 114 | direction = "down"; 115 | } else { 116 | patrol.push([...nextPosition, direction]); 117 | } 118 | } else if (direction === "down") { 119 | let nextPosition: [number, number] = [ 120 | latestPosition[0] + 1, 121 | latestPosition[1], 122 | ]; 123 | 124 | if (isOffGrid(obstructions, nextPosition)) { 125 | onGrid = false; 126 | } else if (isObstructed(obstructions, nextPosition)) { 127 | direction = "left"; 128 | } else { 129 | patrol.push([...nextPosition, direction]); 130 | } 131 | } else if (direction === "left") { 132 | let nextPosition: [number, number] = [ 133 | latestPosition[0], 134 | latestPosition[1] - 1, 135 | ]; 136 | 137 | if (isOffGrid(obstructions, nextPosition)) { 138 | onGrid = false; 139 | } else if (isObstructed(obstructions, nextPosition)) { 140 | direction = "up"; 141 | } else { 142 | patrol.push([...nextPosition, direction]); 143 | } 144 | } 145 | 146 | latestPosition = patrol[patrol.length - 1]; 147 | 148 | if ( 149 | patrol.length > 1 && 150 | patrol 151 | .slice(0, patrol.length - 1) 152 | .some( 153 | (pos) => 154 | pos[0] === latestPosition[0] && 155 | pos[1] === latestPosition[1] && 156 | pos[2] === latestPosition[2] 157 | ) 158 | ) { 159 | inLoop = true; 160 | } 161 | } 162 | 163 | return patrol; 164 | } 165 | -------------------------------------------------------------------------------- /src/01/input.txt: -------------------------------------------------------------------------------- 1 | 27484 55634 2 | 67560 75018 3 | 43926 95501 4 | 86974 55714 5 | 71747 78366 6 | 28088 62509 7 | 34772 15990 8 | 29824 96324 9 | 29947 57910 10 | 98288 14717 11 | 65056 92495 12 | 51274 95004 13 | 77249 83538 14 | 47027 63476 15 | 38391 61559 16 | 70732 87324 17 | 48005 31948 18 | 78366 18349 19 | 61139 70973 20 | 73910 47466 21 | 20206 14717 22 | 22102 96393 23 | 88580 13914 24 | 54397 95954 25 | 49998 14239 26 | 61967 34634 27 | 12345 14607 28 | 41314 78200 29 | 21798 23855 30 | 98407 80316 31 | 86141 19452 32 | 73311 49491 33 | 81862 87593 34 | 95566 96160 35 | 87351 52582 36 | 15848 49491 37 | 51788 65164 38 | 35997 33641 39 | 47658 55714 40 | 81744 95501 41 | 47851 18884 42 | 43111 83702 43 | 11414 70973 44 | 40636 52220 45 | 27695 93149 46 | 81110 96694 47 | 44831 48192 48 | 58200 15065 49 | 88294 41889 50 | 16039 63631 51 | 59282 62165 52 | 69211 62894 53 | 52748 27053 54 | 52668 47769 55 | 43520 76755 56 | 28943 80470 57 | 24548 55714 58 | 67129 34601 59 | 53243 55790 60 | 65561 78366 61 | 82182 95501 62 | 49274 74658 63 | 15952 33194 64 | 60418 12345 65 | 27775 46593 66 | 73493 43900 67 | 52098 95501 68 | 27121 31096 69 | 81056 12550 70 | 28121 83702 71 | 30348 52220 72 | 56433 39771 73 | 25161 81388 74 | 83995 60545 75 | 57450 58448 76 | 52600 91287 77 | 77850 36836 78 | 37216 41677 79 | 98526 41677 80 | 90655 95125 81 | 45217 42384 82 | 69053 36037 83 | 13539 17117 84 | 89360 26136 85 | 84311 49087 86 | 87153 25849 87 | 24300 76566 88 | 23519 84695 89 | 28852 42384 90 | 53355 42384 91 | 42582 47375 92 | 26552 14607 93 | 75913 44442 94 | 53485 31831 95 | 34601 42384 96 | 76249 90670 97 | 94920 28575 98 | 72323 55714 99 | 69403 83702 100 | 95672 99168 101 | 26935 30972 102 | 87512 41677 103 | 61615 46189 104 | 74695 65158 105 | 20200 84691 106 | 19304 14239 107 | 68077 52722 108 | 10582 52930 109 | 27335 49491 110 | 37584 63132 111 | 73196 54501 112 | 16502 26753 113 | 91474 69512 114 | 54822 56271 115 | 71321 89918 116 | 41518 27775 117 | 87096 95501 118 | 21202 18798 119 | 93142 56489 120 | 38047 52220 121 | 24517 96289 122 | 44312 85343 123 | 33144 41677 124 | 77684 45037 125 | 80588 14717 126 | 67107 15065 127 | 54896 28328 128 | 51770 49491 129 | 45857 46189 130 | 46481 98951 131 | 47496 99168 132 | 28125 33812 133 | 14980 41468 134 | 51789 36618 135 | 12986 27053 136 | 25765 53516 137 | 74251 12345 138 | 78770 55714 139 | 55011 12550 140 | 29165 61671 141 | 17728 27121 142 | 33981 25499 143 | 36823 91585 144 | 39673 86789 145 | 91903 32719 146 | 19472 75443 147 | 26800 98823 148 | 37852 56489 149 | 14040 10534 150 | 55052 81862 151 | 65668 21798 152 | 89327 53241 153 | 76888 55541 154 | 70948 94956 155 | 12472 29025 156 | 14831 18426 157 | 22665 35540 158 | 22214 83730 159 | 89577 78366 160 | 81023 15782 161 | 84429 46189 162 | 75394 30972 163 | 42076 37915 164 | 68351 56261 165 | 62000 83702 166 | 17132 55865 167 | 41051 15065 168 | 76577 14898 169 | 72700 62031 170 | 21580 17436 171 | 20635 61587 172 | 62682 99808 173 | 96847 51695 174 | 79918 86863 175 | 80975 14717 176 | 72024 49491 177 | 29236 66208 178 | 82592 52603 179 | 40379 26136 180 | 22464 78366 181 | 53246 78366 182 | 92362 15065 183 | 67933 96790 184 | 83285 20525 185 | 32355 46189 186 | 72419 26136 187 | 54766 27053 188 | 44778 79069 189 | 97706 14239 190 | 14239 30166 191 | 61196 80805 192 | 49491 52600 193 | 14607 56489 194 | 54850 52600 195 | 71449 56271 196 | 27968 72844 197 | 33242 79185 198 | 44321 58952 199 | 97596 10417 200 | 82906 39771 201 | 14319 76755 202 | 46189 41677 203 | 49649 30451 204 | 24148 27053 205 | 34109 27542 206 | 81217 26136 207 | 25414 30869 208 | 75794 52220 209 | 15200 34601 210 | 95299 40426 211 | 39732 95501 212 | 87884 56489 213 | 15317 14607 214 | 21193 45220 215 | 15090 54970 216 | 21390 47973 217 | 21698 96819 218 | 56575 39771 219 | 84593 52529 220 | 83880 67718 221 | 36664 17626 222 | 42212 29641 223 | 27053 62894 224 | 84601 68684 225 | 77818 89330 226 | 44608 80231 227 | 56932 44013 228 | 93674 27002 229 | 79048 58758 230 | 88828 14239 231 | 11883 94737 232 | 36014 64083 233 | 12590 56489 234 | 76559 14717 235 | 39043 14308 236 | 82003 50086 237 | 20407 11695 238 | 10048 97014 239 | 31281 56489 240 | 28063 14607 241 | 45813 20651 242 | 18006 26237 243 | 95040 39721 244 | 62587 12345 245 | 28094 39855 246 | 29580 62165 247 | 72853 56271 248 | 39380 70973 249 | 50190 84946 250 | 86034 27121 251 | 26295 33303 252 | 22364 89399 253 | 73757 35446 254 | 45106 39771 255 | 91186 49491 256 | 30056 16061 257 | 91866 44972 258 | 89436 70973 259 | 73210 98851 260 | 62546 21798 261 | 40469 71876 262 | 55116 39771 263 | 11849 25343 264 | 77677 26646 265 | 61244 28328 266 | 26136 47460 267 | 81481 96095 268 | 72429 95501 269 | 76056 43102 270 | 35895 81862 271 | 68089 70973 272 | 18171 10254 273 | 63514 47079 274 | 97499 46286 275 | 75403 42053 276 | 36977 66988 277 | 96237 27121 278 | 29452 14239 279 | 98034 62087 280 | 42417 42384 281 | 57358 96303 282 | 60023 70973 283 | 72118 21798 284 | 85974 52179 285 | 80417 48291 286 | 13977 95222 287 | 71082 81166 288 | 44648 78723 289 | 72171 22884 290 | 70404 39721 291 | 54381 22466 292 | 72013 98147 293 | 51192 41677 294 | 14717 27121 295 | 23855 76432 296 | 48675 52568 297 | 83605 56271 298 | 31420 39046 299 | 83753 82417 300 | 10437 85385 301 | 58483 41819 302 | 69788 22488 303 | 81921 76901 304 | 56676 16456 305 | 42129 70973 306 | 21405 72092 307 | 54273 69258 308 | 63042 15363 309 | 11660 33440 310 | 64263 78366 311 | 11027 45210 312 | 47012 95501 313 | 94401 24684 314 | 27499 52220 315 | 70973 77153 316 | 47772 65651 317 | 35646 22660 318 | 16154 21798 319 | 91790 46189 320 | 50094 39771 321 | 80579 12550 322 | 49745 11236 323 | 18137 39771 324 | 79817 28328 325 | 18437 34601 326 | 46949 86449 327 | 60816 14607 328 | 35903 78067 329 | 17915 83702 330 | 57636 65003 331 | 97265 11452 332 | 54184 36155 333 | 72211 25782 334 | 50122 47994 335 | 98895 41013 336 | 83261 20279 337 | 61814 34534 338 | 41074 36291 339 | 25545 85422 340 | 69677 52406 341 | 32198 70431 342 | 90218 81862 343 | 32063 64251 344 | 26348 10652 345 | 23459 14607 346 | 19924 34601 347 | 12755 49937 348 | 75332 60524 349 | 20426 52220 350 | 33510 30972 351 | 32520 12550 352 | 50821 55735 353 | 45619 34202 354 | 30651 23203 355 | 23288 68443 356 | 26097 47344 357 | 35967 99640 358 | 13374 95501 359 | 35414 42860 360 | 67278 72844 361 | 34100 78366 362 | 26440 86108 363 | 55848 60623 364 | 60238 81862 365 | 11578 44985 366 | 53675 90447 367 | 95139 81862 368 | 53655 62281 369 | 75061 94900 370 | 25717 73969 371 | 96718 42384 372 | 60846 30964 373 | 31991 28328 374 | 41677 24873 375 | 81456 52220 376 | 62569 17266 377 | 14572 74256 378 | 47381 75269 379 | 84958 52000 380 | 85437 55316 381 | 12693 33934 382 | 56021 32349 383 | 55744 36104 384 | 68582 35349 385 | 15330 58662 386 | 94099 74304 387 | 89771 38629 388 | 52313 91593 389 | 56489 36751 390 | 50298 14607 391 | 74104 30972 392 | 29286 95154 393 | 24482 52890 394 | 82812 73820 395 | 13182 48739 396 | 15225 56489 397 | 78417 14559 398 | 83094 75319 399 | 26751 52220 400 | 92253 92873 401 | 34340 21675 402 | 73732 99240 403 | 91045 78366 404 | 52416 21810 405 | 13671 28234 406 | 33612 63254 407 | 56971 78620 408 | 40346 14469 409 | 72844 42239 410 | 94947 15446 411 | 86520 52600 412 | 75495 35748 413 | 87108 76509 414 | 61901 15436 415 | 85022 76755 416 | 51692 23336 417 | 97087 12550 418 | 17780 59480 419 | 78024 78380 420 | 82627 27053 421 | 86867 57333 422 | 14770 76094 423 | 99690 91971 424 | 37970 95357 425 | 38091 81688 426 | 93808 49007 427 | 19623 75999 428 | 62514 70973 429 | 39354 66691 430 | 18731 23385 431 | 20182 14768 432 | 96893 48182 433 | 93703 90234 434 | 32281 27775 435 | 44738 57322 436 | 34416 58353 437 | 99168 14717 438 | 60552 14239 439 | 62143 34601 440 | 34660 63426 441 | 11505 83250 442 | 24137 98026 443 | 69957 63990 444 | 32792 53572 445 | 55146 25974 446 | 24998 11925 447 | 45008 72844 448 | 55840 25161 449 | 56271 73804 450 | 51951 78366 451 | 23366 79173 452 | 94193 85825 453 | 67623 15313 454 | 35037 64946 455 | 13330 52600 456 | 31163 28328 457 | 87613 70973 458 | 40427 47478 459 | 90416 95501 460 | 81180 46847 461 | 82377 30972 462 | 64803 15065 463 | 62137 76755 464 | 28226 40028 465 | 12419 81544 466 | 14256 56271 467 | 74284 56489 468 | 63856 49491 469 | 12114 42384 470 | 23305 80995 471 | 99115 65077 472 | 38426 21798 473 | 87398 52600 474 | 92158 56086 475 | 39006 62303 476 | 17021 34601 477 | 11701 27121 478 | 31448 12345 479 | 78513 48079 480 | 85920 55714 481 | 93843 56271 482 | 30287 92370 483 | 78384 23855 484 | 41990 56271 485 | 11317 33003 486 | 30841 14239 487 | 10135 21798 488 | 85875 25747 489 | 65006 60774 490 | 19493 56489 491 | 29916 52220 492 | 12137 74754 493 | 13493 14239 494 | 36868 52600 495 | 19718 41677 496 | 73983 27775 497 | 79278 20613 498 | 70849 27053 499 | 43543 49191 500 | 69664 81862 501 | 36211 80089 502 | 69076 82040 503 | 50555 34022 504 | 16277 85672 505 | 86854 14607 506 | 18173 35936 507 | 15367 11444 508 | 87778 81574 509 | 85537 55714 510 | 29202 48397 511 | 65597 74632 512 | 94036 70973 513 | 40995 29041 514 | 57002 72844 515 | 31037 96364 516 | 62138 77922 517 | 23493 35039 518 | 32543 89711 519 | 13649 14616 520 | 45082 62165 521 | 39931 65090 522 | 54328 86139 523 | 90435 46008 524 | 98509 44592 525 | 40846 62165 526 | 12273 72080 527 | 70078 27412 528 | 69792 72844 529 | 71552 42384 530 | 43202 76147 531 | 23140 21798 532 | 26364 65427 533 | 34210 99168 534 | 47040 70973 535 | 29563 70973 536 | 35773 12443 537 | 52323 51861 538 | 37176 51073 539 | 97815 30972 540 | 43884 61678 541 | 94682 91679 542 | 82836 72844 543 | 89878 24424 544 | 39807 26674 545 | 42368 70973 546 | 13016 79932 547 | 89249 37967 548 | 65121 52600 549 | 20487 99240 550 | 24970 42384 551 | 30802 56489 552 | 65040 86672 553 | 28328 62894 554 | 52220 32030 555 | 26818 52770 556 | 65282 14717 557 | 78164 11443 558 | 46968 93881 559 | 78981 80725 560 | 18980 60551 561 | 30648 49335 562 | 51633 72639 563 | 31442 62165 564 | 63174 50347 565 | 44998 39721 566 | 60294 34601 567 | 33509 52600 568 | 28215 65043 569 | 76076 78196 570 | 64908 72844 571 | 17601 36315 572 | 33308 86175 573 | 79813 43976 574 | 89994 14239 575 | 35315 42384 576 | 67669 42384 577 | 73099 92031 578 | 25168 12345 579 | 71490 10167 580 | 58441 86468 581 | 28299 60466 582 | 64607 48514 583 | 34983 11600 584 | 96817 99168 585 | 13045 49648 586 | 71656 90046 587 | 26886 28328 588 | 60587 23855 589 | 75130 15065 590 | 86187 55320 591 | 85198 76755 592 | 33243 35621 593 | 43027 56271 594 | 38691 62908 595 | 49403 32551 596 | 45353 26068 597 | 18425 49491 598 | 18026 65599 599 | 39076 14316 600 | 28212 85487 601 | 18907 54021 602 | 71135 42384 603 | 13958 12513 604 | 53937 52594 605 | 12712 19297 606 | 63297 32234 607 | 50764 31236 608 | 95321 94041 609 | 97757 21838 610 | 72342 37352 611 | 62894 14717 612 | 71239 78366 613 | 77659 96018 614 | 63198 97837 615 | 84364 19753 616 | 61075 62165 617 | 51222 70973 618 | 24995 44001 619 | 16599 41677 620 | 86925 21798 621 | 99048 64924 622 | 13542 43682 623 | 12591 34601 624 | 25905 70973 625 | 32208 34954 626 | 22133 23030 627 | 41575 28240 628 | 59604 56374 629 | 16836 95558 630 | 31682 81033 631 | 69364 30518 632 | 82188 70973 633 | 41914 62165 634 | 45576 15065 635 | 25079 64408 636 | 81537 28328 637 | 46462 34601 638 | 66551 66708 639 | 26591 27053 640 | 77328 39771 641 | 33985 34601 642 | 33418 34601 643 | 91080 82492 644 | 61568 42887 645 | 57867 74914 646 | 84472 28817 647 | 12654 85938 648 | 70565 40779 649 | 42550 78366 650 | 51259 32921 651 | 13169 59335 652 | 65905 99168 653 | 15805 12345 654 | 90109 34718 655 | 76980 82815 656 | 57913 76636 657 | 72381 30945 658 | 70281 34601 659 | 78134 37240 660 | 37955 81295 661 | 93173 33484 662 | 74086 67805 663 | 58167 49073 664 | 40765 80068 665 | 23790 18371 666 | 33592 17145 667 | 78454 80589 668 | 15430 90417 669 | 67945 94168 670 | 64241 39721 671 | 83702 93602 672 | 46375 21798 673 | 26342 46958 674 | 34863 41677 675 | 19482 95501 676 | 34284 35957 677 | 38000 37717 678 | 98157 49491 679 | 15930 52600 680 | 64693 52600 681 | 12550 89557 682 | 51953 21798 683 | 77269 61755 684 | 13652 15065 685 | 86840 26806 686 | 52314 98399 687 | 98333 81977 688 | 40687 56489 689 | 35046 65010 690 | 59975 62507 691 | 72833 24038 692 | 14044 34601 693 | 71828 34601 694 | 40577 40279 695 | 51481 76591 696 | 80118 21709 697 | 55714 52220 698 | 24410 59302 699 | 99412 94355 700 | 35437 38777 701 | 48548 75281 702 | 84964 25359 703 | 75235 47933 704 | 21303 61504 705 | 83551 28328 706 | 52760 23895 707 | 85000 12345 708 | 56259 27053 709 | 42764 49491 710 | 11312 27053 711 | 24461 46255 712 | 27237 56271 713 | 58802 96584 714 | 55301 52220 715 | 74259 14607 716 | 56046 33277 717 | 19866 75075 718 | 73679 72844 719 | 33891 70345 720 | 45639 56271 721 | 54195 23454 722 | 95097 30972 723 | 57914 29726 724 | 59298 51050 725 | 89370 21638 726 | 76504 78721 727 | 56108 27053 728 | 29130 52600 729 | 33712 55714 730 | 25154 39018 731 | 96503 95501 732 | 98909 52220 733 | 40872 43009 734 | 82776 25161 735 | 63510 34743 736 | 26533 41677 737 | 56079 42554 738 | 39398 28328 739 | 47768 29475 740 | 20341 63539 741 | 99994 66314 742 | 10110 52220 743 | 57700 30972 744 | 30209 18563 745 | 94995 51083 746 | 44918 49491 747 | 66796 81231 748 | 51995 27053 749 | 77354 77076 750 | 93013 11025 751 | 54620 14607 752 | 92444 97003 753 | 93849 95582 754 | 49161 37280 755 | 28949 27053 756 | 37715 56489 757 | 23904 95501 758 | 73156 31922 759 | 42384 62165 760 | 17773 83547 761 | 58155 64695 762 | 54490 41677 763 | 56486 95501 764 | 97223 42384 765 | 32955 28233 766 | 25281 32491 767 | 15737 61928 768 | 35697 87569 769 | 18244 21823 770 | 42515 15065 771 | 40947 14886 772 | 93475 32452 773 | 14131 27775 774 | 67547 56489 775 | 95089 27728 776 | 43557 26309 777 | 11037 53226 778 | 34322 15776 779 | 22250 98902 780 | 71266 70973 781 | 89572 87812 782 | 90169 84461 783 | 17372 14607 784 | 65790 34601 785 | 27576 83702 786 | 37101 90585 787 | 73468 52600 788 | 39721 67883 789 | 65682 78366 790 | 47073 30972 791 | 90895 18187 792 | 43637 60451 793 | 78516 28328 794 | 21073 62894 795 | 92011 18396 796 | 46069 30730 797 | 26851 52072 798 | 47448 71619 799 | 65439 52600 800 | 29023 52220 801 | 51855 41677 802 | 65553 25161 803 | 80536 65615 804 | 16678 56489 805 | 90651 70973 806 | 19633 34601 807 | 93746 80330 808 | 70591 52600 809 | 94422 96655 810 | 33657 77648 811 | 52974 25161 812 | 13630 51573 813 | 69196 94233 814 | 79490 56271 815 | 32250 81862 816 | 66530 60802 817 | 32790 54374 818 | 17127 34741 819 | 92015 62894 820 | 28249 55714 821 | 65102 52600 822 | 91455 20887 823 | 64033 28328 824 | 24017 56271 825 | 45651 14607 826 | 60117 86054 827 | 96785 27053 828 | 50649 95501 829 | 15436 22503 830 | 65914 69007 831 | 36166 56271 832 | 78692 67504 833 | 91558 15065 834 | 49051 73240 835 | 66543 55714 836 | 95701 85539 837 | 38010 18771 838 | 45785 95501 839 | 64305 84004 840 | 47125 66585 841 | 66807 64152 842 | 53798 26097 843 | 39771 71764 844 | 31704 30702 845 | 62165 37200 846 | 65163 52600 847 | 29324 29029 848 | 60646 39771 849 | 91668 65672 850 | 70470 15065 851 | 49620 14247 852 | 73173 18620 853 | 50390 36512 854 | 89026 99202 855 | 81234 82629 856 | 45456 62894 857 | 39896 27600 858 | 56209 95501 859 | 48104 40539 860 | 62372 99003 861 | 39333 56271 862 | 79867 72035 863 | 95279 47366 864 | 52605 28328 865 | 75787 88930 866 | 84796 49491 867 | 38805 27053 868 | 45963 11986 869 | 27579 34906 870 | 90333 76755 871 | 32386 99055 872 | 14026 43550 873 | 19291 72844 874 | 77541 70973 875 | 99587 55340 876 | 31439 95942 877 | 42133 16863 878 | 44755 99168 879 | 85828 46189 880 | 42114 40119 881 | 59161 91883 882 | 43113 52600 883 | 19801 59337 884 | 99100 42384 885 | 65884 14239 886 | 54308 26731 887 | 65747 22856 888 | 29500 78366 889 | 41826 25161 890 | 85615 62894 891 | 70557 28328 892 | 95815 45495 893 | 87262 70230 894 | 83658 88861 895 | 81087 95501 896 | 90172 15065 897 | 89905 83702 898 | 76914 99725 899 | 97931 27736 900 | 33944 78366 901 | 12857 13437 902 | 31425 18052 903 | 47737 52600 904 | 54370 88914 905 | 30972 52220 906 | 95939 93458 907 | 65658 14144 908 | 56393 13271 909 | 19853 65648 910 | 88897 76222 911 | 82340 34601 912 | 84119 49301 913 | 56333 76755 914 | 63170 41677 915 | 46323 41823 916 | 25888 46298 917 | 93367 11280 918 | 63331 44705 919 | 16400 60268 920 | 54046 56271 921 | 47922 97212 922 | 32747 76755 923 | 29791 21741 924 | 71231 42384 925 | 57799 52220 926 | 89922 16019 927 | 58351 15436 928 | 49144 46189 929 | 44735 27121 930 | 48818 49491 931 | 73875 56271 932 | 88792 56489 933 | 95437 24568 934 | 16461 39771 935 | 47343 31753 936 | 12386 76932 937 | 91444 37078 938 | 89445 12345 939 | 24720 27053 940 | 76245 67447 941 | 53193 52600 942 | 81174 78366 943 | 62085 31757 944 | 63488 42384 945 | 25099 34473 946 | 45860 46189 947 | 59677 27053 948 | 85517 52654 949 | 38418 98942 950 | 95501 24726 951 | 21940 98584 952 | 88869 11941 953 | 15733 45484 954 | 28860 21798 955 | 65805 78366 956 | 92611 30972 957 | 73443 30972 958 | 68225 77281 959 | 59098 74187 960 | 94473 49491 961 | 45560 34601 962 | 14714 47592 963 | 72384 41677 964 | 16713 14239 965 | 59990 69119 966 | 10894 76150 967 | 32150 12345 968 | 91101 92795 969 | 87562 14607 970 | 86572 57058 971 | 15065 19835 972 | 83303 56887 973 | 96607 49491 974 | 36622 76755 975 | 52276 25566 976 | 99240 99330 977 | 46404 52220 978 | 62733 83417 979 | 67070 28328 980 | 36323 76755 981 | 14422 29889 982 | 76755 52600 983 | 76212 77863 984 | 68464 62165 985 | 69048 21798 986 | 78830 89470 987 | 92884 52220 988 | 73029 72758 989 | 73783 30562 990 | 20321 27053 991 | 23224 54765 992 | 16276 28328 993 | 10461 36193 994 | 17913 18463 995 | 28947 27143 996 | 23436 56489 997 | 18265 42384 998 | 72046 30416 999 | 61316 42384 1000 | 70861 52220 1001 | -------------------------------------------------------------------------------- /src/02/input.txt: -------------------------------------------------------------------------------- 1 | 19 21 24 27 24 2 | 85 87 89 92 93 96 98 98 3 | 2 5 6 7 8 12 4 | 63 66 69 72 75 82 5 | 18 21 23 26 28 26 27 28 6 | 16 19 21 19 20 22 23 22 7 | 37 39 37 38 41 42 44 44 8 | 18 20 17 20 24 9 | 50 51 54 53 58 10 | 73 76 77 80 83 83 84 85 11 | 30 31 33 33 36 39 40 37 12 | 50 52 52 53 54 55 55 13 | 49 52 54 56 59 59 63 14 | 42 44 46 46 49 52 53 59 15 | 40 43 45 49 52 54 16 | 87 89 93 96 95 17 | 66 69 70 71 73 77 78 78 18 | 30 32 33 36 39 43 47 19 | 8 9 12 16 18 21 22 28 20 | 80 83 84 85 91 92 21 | 75 76 77 84 87 89 88 22 | 8 10 12 17 18 21 22 22 23 | 14 15 20 23 26 29 33 24 | 13 15 18 23 26 33 25 | 43 41 43 44 45 47 49 26 | 77 74 77 78 79 82 79 27 | 55 53 54 55 55 28 | 73 70 72 75 78 79 81 85 29 | 46 44 46 49 50 51 57 30 | 72 70 69 72 73 75 78 31 | 57 55 53 54 57 59 60 57 32 | 21 19 20 22 21 23 23 33 | 11 9 10 13 10 12 13 17 34 | 36 33 34 33 34 35 42 35 | 39 38 38 41 44 36 | 75 72 75 75 78 75 37 | 56 53 56 56 56 38 | 36 33 36 38 38 40 44 39 | 55 54 54 55 57 58 65 40 | 27 25 28 31 35 37 39 41 | 81 79 83 85 83 42 | 19 16 19 23 26 26 43 | 27 25 26 29 33 37 44 | 72 71 74 75 79 81 88 45 | 34 31 32 35 41 44 45 48 46 | 69 67 70 71 72 77 74 47 | 44 43 48 51 51 48 | 57 54 57 63 66 70 49 | 16 14 16 22 23 30 50 | 6 6 9 10 11 13 51 | 7 7 8 10 11 12 13 11 52 | 81 81 84 85 88 88 53 | 53 53 54 55 59 54 | 28 28 31 34 36 37 40 45 55 | 60 60 63 61 62 56 | 63 63 65 63 66 67 65 57 | 36 36 34 37 37 58 | 79 79 76 79 83 59 | 27 27 29 28 31 32 37 60 | 91 91 91 93 96 97 61 | 44 44 46 49 52 52 55 54 62 | 72 72 73 76 76 77 77 63 | 5 5 5 7 11 64 | 4 4 5 7 9 9 15 65 | 51 51 53 56 60 63 66 66 | 2 2 3 7 10 11 10 67 | 61 61 65 66 66 68 | 5 5 8 12 16 69 | 53 53 57 58 59 62 64 69 70 | 18 18 20 21 26 28 30 32 71 | 71 71 72 73 80 81 82 79 72 | 82 82 85 87 92 92 73 | 61 61 63 65 72 74 78 74 | 54 54 60 61 64 71 75 | 58 62 65 67 68 71 76 | 47 51 53 56 57 60 63 60 77 | 12 16 18 20 23 23 78 | 80 84 87 89 90 93 97 79 | 25 29 31 32 34 37 43 80 | 38 42 45 43 44 81 | 72 76 77 74 77 76 82 | 56 60 59 60 60 83 | 64 68 71 70 74 84 | 2 6 9 10 7 12 85 | 17 21 21 23 24 25 27 30 86 | 15 19 19 21 18 87 | 49 53 56 57 57 59 59 88 | 5 9 9 10 12 14 18 89 | 82 86 87 87 93 90 | 50 54 56 58 62 63 66 69 91 | 88 92 96 97 94 92 | 24 28 32 34 37 38 41 41 93 | 15 19 22 26 27 30 34 94 | 59 63 67 68 73 95 | 71 75 80 81 83 84 96 | 8 12 14 20 17 97 | 67 71 77 80 80 98 | 35 39 42 49 51 55 99 | 51 55 62 64 65 71 100 | 40 45 48 50 52 101 | 46 51 54 56 55 102 | 84 89 90 93 96 96 103 | 50 57 60 62 66 104 | 23 28 31 33 34 40 105 | 59 65 63 66 68 106 | 89 94 95 96 93 91 107 | 75 82 81 82 82 108 | 75 82 85 84 86 90 109 | 48 55 57 55 60 110 | 74 81 82 83 84 84 85 111 | 35 42 42 44 46 45 112 | 15 22 25 25 25 113 | 44 50 51 52 52 56 114 | 31 38 38 39 42 47 115 | 50 55 58 60 64 66 68 69 116 | 11 18 19 20 24 21 117 | 4 10 12 16 19 19 118 | 16 23 24 28 29 33 119 | 18 23 27 29 36 120 | 51 58 64 66 68 71 73 121 | 35 42 44 46 51 52 53 51 122 | 15 22 28 29 30 30 123 | 66 73 80 82 83 87 124 | 21 26 32 35 36 42 125 | 50 48 47 46 43 40 43 126 | 92 89 87 85 84 83 80 80 127 | 49 46 45 44 43 40 36 128 | 88 86 84 82 79 73 129 | 16 14 13 12 11 13 12 9 130 | 47 46 48 46 44 47 131 | 17 16 17 14 13 10 10 132 | 60 59 61 60 56 133 | 68 65 62 65 60 134 | 22 21 18 18 15 12 135 | 28 25 24 22 21 21 19 20 136 | 76 74 74 71 71 137 | 73 72 69 68 68 65 61 138 | 85 84 84 83 81 74 139 | 46 44 40 37 35 140 | 91 90 86 84 82 83 141 | 65 62 59 55 54 52 50 50 142 | 55 53 52 48 46 43 40 36 143 | 39 36 34 30 28 22 144 | 22 20 17 12 10 8 145 | 33 30 24 22 21 20 22 146 | 96 94 88 86 86 147 | 97 94 92 91 84 83 81 77 148 | 31 29 24 23 17 149 | 11 12 10 8 6 5 150 | 25 28 27 25 22 21 22 151 | 24 25 23 21 20 18 18 152 | 65 68 66 65 62 59 58 54 153 | 67 68 67 65 62 60 55 154 | 53 54 55 53 50 49 155 | 72 74 75 73 71 74 156 | 76 78 81 78 77 77 157 | 91 92 91 93 90 89 85 158 | 70 73 72 74 73 66 159 | 91 93 93 92 89 88 85 160 | 18 21 21 19 16 19 161 | 30 32 29 29 29 162 | 92 93 93 91 87 163 | 14 17 15 12 10 10 3 164 | 61 62 58 55 54 51 50 48 165 | 15 17 15 11 12 166 | 71 73 71 69 68 64 61 61 167 | 33 35 31 29 26 24 20 168 | 90 91 87 86 79 169 | 32 34 29 26 24 170 | 91 92 91 85 86 171 | 51 53 52 45 43 43 172 | 27 30 27 22 19 17 13 173 | 94 97 90 87 85 80 174 | 11 11 10 9 7 4 2 175 | 67 67 64 63 62 64 176 | 83 83 80 77 75 75 177 | 79 79 76 74 71 69 65 178 | 14 14 11 10 3 179 | 33 33 30 27 29 26 180 | 70 70 67 69 66 65 64 65 181 | 75 75 73 75 75 182 | 89 89 87 84 81 82 78 183 | 72 72 69 71 69 66 60 184 | 25 25 25 22 21 185 | 55 55 52 52 50 53 186 | 29 29 27 26 26 25 25 187 | 53 53 53 51 50 49 46 42 188 | 27 27 27 26 23 17 189 | 85 85 83 79 77 76 190 | 76 76 74 72 68 71 191 | 55 55 52 49 47 46 42 42 192 | 76 76 74 70 67 65 64 60 193 | 58 58 56 53 49 47 44 37 194 | 13 13 7 5 2 1 195 | 73 73 71 68 62 65 196 | 44 44 42 37 35 33 30 30 197 | 85 85 82 76 75 71 198 | 94 94 91 84 83 80 77 72 199 | 74 70 68 65 63 61 200 | 81 77 74 72 69 72 201 | 86 82 80 79 76 73 72 72 202 | 98 94 92 91 88 85 84 80 203 | 29 25 23 21 18 16 15 8 204 | 96 92 91 89 90 88 87 85 205 | 73 69 66 64 61 60 61 63 206 | 89 85 82 84 81 78 77 77 207 | 70 66 63 61 63 59 208 | 92 88 85 84 86 85 78 209 | 92 88 86 86 85 84 83 210 | 55 51 51 48 47 45 42 43 211 | 92 88 88 87 85 85 212 | 98 94 92 90 87 84 84 80 213 | 44 40 40 38 35 34 28 214 | 19 15 11 10 9 7 215 | 78 74 70 67 66 63 66 216 | 67 63 59 58 58 217 | 57 53 50 48 44 42 38 218 | 21 17 15 11 10 8 7 2 219 | 74 70 69 63 61 220 | 19 15 10 8 5 4 6 221 | 73 69 66 61 61 222 | 53 49 43 42 39 35 223 | 78 74 73 68 66 60 224 | 30 24 23 20 19 17 14 13 225 | 48 43 42 41 43 226 | 56 51 48 46 45 43 42 42 227 | 55 50 48 45 42 41 37 228 | 56 49 48 47 44 41 35 229 | 35 30 27 28 27 26 24 23 230 | 88 83 82 80 79 81 84 231 | 82 77 80 77 75 75 232 | 85 80 77 80 76 233 | 75 69 72 70 63 234 | 26 19 18 18 16 235 | 77 72 72 71 73 236 | 97 92 90 90 87 86 86 237 | 30 23 22 21 21 18 14 238 | 76 71 70 69 68 68 63 239 | 68 61 57 56 54 53 51 48 240 | 26 20 18 14 12 10 12 241 | 57 52 48 46 44 44 242 | 91 85 82 78 75 73 71 67 243 | 72 66 62 59 54 244 | 37 31 29 24 22 245 | 90 83 76 73 74 246 | 63 58 56 53 48 48 247 | 71 66 60 57 54 51 47 248 | 42 37 34 31 25 18 249 | 18 21 23 24 26 27 26 250 | 17 20 23 24 26 29 32 32 251 | 82 83 85 86 88 90 94 252 | 26 27 28 29 32 39 253 | 38 39 40 39 40 42 45 254 | 58 61 64 66 69 68 70 67 255 | 22 24 25 22 23 23 256 | 57 60 61 59 61 64 65 69 257 | 5 7 8 6 7 10 12 18 258 | 43 46 49 49 52 55 57 59 259 | 43 46 46 49 48 260 | 78 80 82 85 85 85 261 | 34 36 39 39 43 262 | 20 23 23 26 31 263 | 61 63 67 68 70 264 | 17 19 21 25 26 25 265 | 43 45 49 52 54 56 56 266 | 48 49 51 52 55 56 60 64 267 | 15 17 18 22 24 27 34 268 | 69 72 77 80 83 84 86 88 269 | 45 47 49 56 57 59 58 270 | 56 58 64 65 68 68 271 | 3 6 7 8 13 14 16 20 272 | 78 81 82 89 90 96 273 | 24 23 26 28 31 33 35 274 | 88 86 88 89 87 275 | 26 23 25 28 30 31 31 276 | 30 29 32 34 38 277 | 64 62 65 68 69 75 278 | 77 76 75 77 80 81 279 | 55 54 55 54 56 54 280 | 87 84 86 84 86 88 88 281 | 7 5 3 4 7 9 12 16 282 | 64 61 64 63 69 283 | 41 38 41 41 42 284 | 12 10 12 12 14 15 12 285 | 50 49 50 50 51 51 286 | 79 78 79 81 81 84 88 287 | 52 50 51 51 56 288 | 5 3 5 7 11 14 16 289 | 85 83 87 88 90 93 90 290 | 82 80 84 87 88 91 91 291 | 15 12 16 18 22 292 | 82 79 80 83 87 89 96 293 | 14 13 15 20 22 294 | 49 47 48 49 52 57 58 55 295 | 26 23 28 31 31 296 | 10 8 11 13 18 19 23 297 | 79 76 77 79 84 91 298 | 47 47 50 53 55 58 61 64 299 | 85 85 86 88 91 89 300 | 35 35 38 39 41 44 44 301 | 42 42 44 46 49 53 302 | 83 83 86 87 89 92 98 303 | 21 21 22 19 21 304 | 36 36 37 40 41 38 35 305 | 58 58 60 62 60 60 306 | 11 11 14 15 13 15 19 307 | 47 47 46 49 54 308 | 23 23 24 26 26 28 31 32 309 | 79 79 81 82 82 81 310 | 44 44 44 46 47 49 50 50 311 | 35 35 38 41 41 43 47 312 | 52 52 52 54 56 59 65 313 | 2 2 4 7 8 10 14 15 314 | 75 75 77 81 83 86 87 86 315 | 19 19 23 24 27 28 31 31 316 | 79 79 83 85 87 91 317 | 23 23 27 29 35 318 | 60 60 61 62 69 72 75 319 | 12 12 19 22 24 22 320 | 45 45 52 55 55 321 | 60 60 61 68 71 73 74 78 322 | 40 40 46 47 49 51 54 59 323 | 17 21 23 25 26 28 30 324 | 22 26 27 30 33 34 36 35 325 | 77 81 83 84 86 88 90 90 326 | 7 11 14 15 18 22 327 | 6 10 13 16 22 328 | 65 69 71 74 75 76 75 78 329 | 69 73 71 73 76 75 330 | 75 79 77 78 80 83 84 84 331 | 36 40 43 46 49 47 51 332 | 52 56 58 60 58 59 64 333 | 28 32 33 35 35 36 39 334 | 23 27 28 28 27 335 | 33 37 38 38 39 39 336 | 77 81 83 83 86 90 337 | 34 38 40 41 42 44 44 49 338 | 86 90 94 97 98 339 | 48 52 55 59 57 340 | 28 32 36 37 40 43 45 45 341 | 13 17 21 23 26 30 342 | 40 44 48 51 57 343 | 12 16 23 26 27 30 344 | 14 18 21 24 26 29 35 34 345 | 31 35 42 43 44 44 346 | 18 22 24 26 32 36 347 | 31 35 37 39 45 51 348 | 69 76 79 82 85 87 89 91 349 | 79 86 89 91 89 350 | 68 75 77 78 79 82 82 351 | 28 34 35 38 41 43 45 49 352 | 65 71 74 75 76 82 353 | 66 71 74 72 75 354 | 22 27 25 27 30 28 355 | 82 88 87 88 91 93 94 94 356 | 21 28 30 29 32 34 38 357 | 85 90 92 91 96 358 | 7 14 14 16 18 21 22 23 359 | 19 25 25 27 29 32 33 32 360 | 47 54 57 57 59 60 60 361 | 44 51 51 52 55 59 362 | 63 70 70 71 73 78 363 | 12 17 19 23 25 26 364 | 23 28 32 35 37 34 365 | 50 56 59 60 63 67 70 70 366 | 53 59 63 66 70 367 | 69 76 78 82 89 368 | 60 65 66 67 70 76 77 369 | 37 44 46 51 48 370 | 34 41 47 48 48 371 | 69 76 77 84 86 90 372 | 42 49 50 55 62 373 | 49 47 46 44 43 44 374 | 83 81 78 75 75 375 | 13 11 8 6 5 1 376 | 75 72 69 68 67 65 59 377 | 34 32 30 31 28 25 22 378 | 75 73 72 74 76 379 | 82 79 78 77 75 73 76 76 380 | 72 71 72 71 67 381 | 63 61 59 56 57 50 382 | 19 17 17 16 14 383 | 34 33 33 30 31 384 | 98 96 95 95 93 93 385 | 28 25 25 23 21 18 14 386 | 18 15 13 12 10 10 3 387 | 62 60 59 57 54 52 48 47 388 | 98 96 95 91 92 389 | 20 18 15 12 11 9 5 5 390 | 27 25 24 20 17 15 11 391 | 96 93 91 89 85 83 81 74 392 | 77 74 68 66 65 62 393 | 74 72 71 65 67 394 | 26 23 20 18 13 10 10 395 | 68 65 58 55 53 51 47 396 | 61 60 57 56 53 51 46 40 397 | 32 34 31 30 28 398 | 37 39 36 35 34 35 399 | 86 88 86 84 83 80 80 400 | 39 41 38 37 36 33 29 401 | 38 39 37 35 34 31 24 402 | 84 86 83 80 82 79 403 | 57 58 55 54 51 48 49 51 404 | 78 81 82 81 80 79 78 78 405 | 40 41 39 41 40 39 35 406 | 41 43 40 39 38 37 39 34 407 | 72 74 72 72 69 66 408 | 16 18 18 15 14 11 12 409 | 27 30 29 27 24 22 22 22 410 | 52 54 53 53 51 48 44 411 | 58 59 58 57 56 56 50 412 | 34 36 33 31 30 27 23 22 413 | 38 41 38 34 37 414 | 85 88 85 81 81 415 | 64 67 64 61 60 56 53 49 416 | 23 24 20 19 14 417 | 28 30 25 24 22 418 | 70 73 68 65 64 63 60 62 419 | 52 54 51 44 42 42 420 | 96 97 92 91 87 421 | 52 53 46 43 40 37 35 29 422 | 68 68 66 64 63 61 60 59 423 | 51 51 48 46 44 42 40 41 424 | 82 82 79 76 74 74 425 | 23 23 20 17 16 13 11 7 426 | 72 72 69 67 64 61 60 53 427 | 27 27 24 23 24 23 21 18 428 | 29 29 27 25 28 29 429 | 59 59 62 60 57 56 55 55 430 | 98 98 95 93 91 94 90 431 | 70 70 68 67 66 65 66 60 432 | 80 80 79 76 76 74 72 71 433 | 69 69 68 65 62 61 61 64 434 | 21 21 18 16 14 14 12 12 435 | 36 36 34 34 30 436 | 16 16 15 12 10 10 3 437 | 70 70 66 63 61 60 58 438 | 44 44 40 38 35 38 439 | 54 54 51 50 46 43 43 440 | 29 29 26 22 18 441 | 21 21 18 16 12 6 442 | 59 59 57 51 49 47 46 43 443 | 46 46 45 44 38 40 444 | 90 90 88 83 83 445 | 29 29 28 25 23 17 13 446 | 99 99 94 93 91 89 86 79 447 | 68 64 62 60 58 56 55 448 | 98 94 91 89 90 449 | 56 52 50 47 45 45 450 | 78 74 71 70 68 65 61 451 | 27 23 20 19 18 15 9 452 | 92 88 86 89 86 453 | 52 48 45 48 50 454 | 75 71 68 70 70 455 | 23 19 18 15 13 15 13 9 456 | 96 92 94 93 87 457 | 76 72 72 70 68 458 | 80 76 74 74 73 76 459 | 65 61 59 59 58 58 460 | 91 87 85 84 82 80 80 76 461 | 74 70 67 66 66 65 58 462 | 62 58 54 52 50 49 463 | 88 84 80 79 77 74 72 74 464 | 14 10 9 7 3 3 465 | 65 61 58 56 52 48 466 | 20 16 12 10 8 1 467 | 63 59 58 55 54 48 46 45 468 | 57 53 51 46 49 469 | 93 89 82 79 76 76 470 | 52 48 47 45 43 36 32 471 | 98 94 92 87 85 82 81 76 472 | 23 18 15 14 11 9 473 | 82 77 75 72 71 70 72 474 | 61 55 54 53 50 49 47 47 475 | 37 32 29 27 24 21 17 476 | 82 75 74 71 70 65 477 | 12 7 9 7 5 3 478 | 62 57 59 56 57 479 | 68 62 59 57 54 57 57 480 | 73 66 65 66 64 62 58 481 | 37 32 30 27 26 29 22 482 | 98 93 93 91 88 86 85 84 483 | 27 21 21 19 17 14 11 13 484 | 69 64 63 63 63 485 | 82 77 75 72 69 69 67 63 486 | 71 64 61 61 58 53 487 | 15 9 5 4 3 488 | 53 47 44 43 41 37 39 489 | 18 12 11 7 5 4 2 2 490 | 75 69 66 63 59 56 55 51 491 | 97 91 87 86 84 81 78 73 492 | 66 59 57 55 50 49 47 44 493 | 73 66 63 60 57 51 48 49 494 | 58 52 47 46 43 43 495 | 31 25 24 17 16 12 496 | 46 40 38 37 32 31 26 497 | 68 70 73 72 70 498 | 28 29 28 28 25 19 499 | 21 26 23 25 26 30 500 | 82 76 73 71 64 64 501 | 78 75 82 83 89 502 | 88 89 89 87 85 85 503 | 51 54 52 54 53 55 504 | 51 53 54 61 64 68 505 | 60 61 62 63 67 70 72 75 506 | 23 16 15 12 13 11 8 5 507 | 6 8 10 12 13 18 508 | 48 41 39 38 35 34 31 31 509 | 74 70 64 62 61 57 510 | 30 27 29 34 37 41 511 | 24 24 23 22 18 17 14 10 512 | 67 64 63 62 61 59 55 513 | 98 94 93 91 94 514 | 11 12 9 12 15 18 25 515 | 86 82 81 76 74 77 516 | 26 20 19 17 16 11 9 7 517 | 69 69 65 64 62 59 58 52 518 | 90 88 90 94 91 519 | 74 75 73 71 72 72 520 | 40 35 32 26 25 22 18 521 | 4 3 9 11 13 16 19 18 522 | 34 34 35 37 37 523 | 69 73 76 78 79 80 79 524 | 64 64 61 59 57 60 525 | 30 26 23 21 17 15 526 | 44 48 50 54 54 527 | 16 16 15 15 8 528 | 30 30 28 25 21 24 529 | 96 96 92 91 90 89 530 | 50 46 43 41 39 40 33 531 | 30 29 30 31 32 32 33 33 532 | 44 50 51 52 52 533 | 21 19 20 23 23 27 534 | 48 48 49 46 49 51 49 535 | 67 62 60 57 56 53 50 536 | 78 82 84 86 89 94 96 96 537 | 22 22 25 23 20 18 14 538 | 23 20 22 19 22 23 26 539 | 40 40 39 37 37 34 32 34 540 | 39 43 46 49 53 56 53 541 | 65 58 58 55 54 54 542 | 90 92 89 87 86 543 | 17 15 16 19 22 25 23 544 | 41 41 36 33 32 30 26 545 | 6 9 8 8 7 4 6 546 | 46 46 47 49 51 53 59 64 547 | 71 67 64 61 59 56 58 55 548 | 58 60 60 62 62 549 | 61 57 54 50 47 47 550 | 8 13 20 21 24 551 | 47 47 50 53 54 57 55 552 | 35 35 32 31 28 27 25 22 553 | 90 92 90 88 87 83 554 | 52 55 52 47 47 555 | 45 49 51 54 58 556 | 40 35 34 34 28 557 | 51 50 49 48 47 44 44 558 | 91 84 81 81 79 78 75 78 559 | 55 51 50 50 49 46 40 560 | 67 74 77 79 82 85 92 561 | 26 26 28 29 33 562 | 68 72 74 77 81 84 86 563 | 81 77 76 74 67 62 564 | 24 17 15 13 10 6 2 565 | 36 39 38 35 32 30 28 21 566 | 25 28 29 27 29 32 567 | 80 74 73 72 74 68 568 | 13 14 14 15 18 20 21 27 569 | 55 52 49 47 45 41 43 570 | 74 76 75 72 71 70 63 56 571 | 18 17 13 12 11 7 572 | 33 33 35 34 31 26 573 | 45 49 47 49 52 52 574 | 49 54 55 55 57 60 57 575 | 79 79 83 85 90 576 | 50 50 50 51 54 57 577 | 43 47 48 48 50 52 53 52 578 | 86 84 83 85 83 80 80 579 | 41 40 41 44 44 43 580 | 36 30 26 25 22 21 19 22 581 | 9 12 15 18 24 24 582 | 20 27 32 34 36 34 583 | 51 51 53 59 61 61 584 | 57 55 58 59 59 61 66 585 | 6 10 10 13 14 15 18 586 | 39 43 46 49 51 51 587 | 92 89 87 84 83 80 79 80 588 | 45 43 40 35 33 27 589 | 21 24 25 28 32 590 | 31 28 29 32 36 37 40 42 591 | 77 77 79 80 79 80 592 | 88 90 88 87 84 79 75 593 | 16 18 16 16 12 594 | 74 72 70 68 66 63 595 | 72 74 77 79 80 596 | 23 26 27 29 31 32 34 597 | 65 67 70 72 74 75 598 | 74 76 77 79 82 85 599 | 73 71 70 69 67 65 63 600 | 65 64 63 60 57 601 | 29 32 35 36 38 41 44 47 602 | 6 8 11 13 15 17 18 603 | 25 24 22 20 19 16 13 604 | 23 24 25 27 28 30 605 | 42 44 45 47 48 49 606 | 78 80 83 86 89 90 607 | 65 68 69 72 74 75 78 81 608 | 28 29 32 33 34 35 36 39 609 | 63 64 66 69 71 73 74 610 | 15 14 13 11 9 6 611 | 62 65 67 68 71 73 74 76 612 | 92 91 90 89 86 84 83 613 | 70 72 75 77 78 79 614 | 77 74 73 70 67 66 65 615 | 44 42 40 38 36 616 | 89 87 86 83 82 80 77 617 | 58 61 62 65 67 69 618 | 70 68 66 63 60 619 | 42 43 46 49 50 51 52 55 620 | 23 22 19 18 15 14 621 | 42 39 38 37 36 34 622 | 54 51 50 49 46 623 | 21 18 16 15 14 12 11 624 | 31 28 25 23 20 19 18 625 | 15 13 10 8 7 6 4 1 626 | 36 38 39 40 42 45 46 48 627 | 46 44 41 39 37 36 628 | 30 28 27 24 21 19 629 | 23 20 17 16 15 12 630 | 71 74 76 78 80 81 84 85 631 | 82 84 87 88 90 93 95 96 632 | 52 54 55 58 60 62 64 633 | 23 26 28 29 31 634 | 87 84 83 80 79 76 75 73 635 | 26 29 31 32 34 36 636 | 73 72 69 67 66 65 62 637 | 97 94 92 90 87 85 82 638 | 25 24 23 20 18 16 13 639 | 68 66 65 63 61 640 | 32 30 27 25 23 21 18 15 641 | 35 37 38 39 42 642 | 81 84 87 88 91 94 95 643 | 43 41 40 39 38 644 | 53 51 48 45 43 645 | 79 77 74 72 71 68 65 646 | 17 19 21 22 24 647 | 55 58 60 62 65 648 | 69 67 66 63 61 649 | 26 29 30 31 34 37 650 | 3 5 6 8 9 12 651 | 65 68 71 72 75 78 80 83 652 | 94 92 90 89 87 653 | 35 34 31 30 27 654 | 67 65 62 61 58 55 54 655 | 13 14 16 18 20 23 24 656 | 66 65 62 61 58 657 | 83 84 85 87 90 91 94 97 658 | 71 70 69 68 66 65 62 659 | 18 16 13 11 10 9 8 7 660 | 95 92 91 90 87 84 661 | 46 45 43 40 39 38 662 | 42 44 45 48 49 52 663 | 58 61 64 65 66 68 71 664 | 80 79 77 76 74 665 | 59 60 62 63 66 67 69 71 666 | 29 32 33 34 35 38 41 43 667 | 74 71 70 68 67 668 | 79 77 74 71 70 669 | 46 44 42 40 38 36 670 | 61 63 66 69 71 671 | 63 61 58 57 55 53 672 | 11 12 14 15 17 19 673 | 87 89 90 92 94 97 674 | 18 21 24 27 29 675 | 92 90 88 87 85 82 676 | 16 15 14 12 10 9 7 5 677 | 69 68 67 65 63 61 58 56 678 | 61 59 56 54 51 48 679 | 53 56 58 60 61 64 67 680 | 83 82 79 77 74 71 70 681 | 29 31 34 36 39 42 682 | 78 80 83 84 86 89 90 93 683 | 65 63 62 61 60 58 684 | 27 24 22 19 17 15 685 | 38 41 44 47 50 686 | 72 70 67 65 63 60 59 687 | 57 60 63 64 66 688 | 48 49 51 53 55 57 689 | 95 92 90 89 88 690 | 85 88 91 92 94 691 | 16 15 12 10 8 5 4 2 692 | 82 81 80 77 75 73 70 693 | 31 34 35 38 39 41 44 694 | 75 78 79 81 83 86 695 | 84 83 81 78 77 74 696 | 24 21 18 16 15 12 697 | 34 32 31 29 26 23 698 | 94 92 91 89 87 84 82 699 | 17 19 21 23 25 26 700 | 52 50 49 48 47 46 44 41 701 | 44 43 41 40 39 36 34 702 | 68 70 73 76 79 82 703 | 52 50 48 45 43 42 40 38 704 | 40 41 44 45 47 48 51 52 705 | 66 68 69 72 75 77 79 706 | 38 35 34 31 30 29 26 707 | 31 28 27 24 21 708 | 18 19 22 23 26 29 32 33 709 | 85 82 81 79 78 77 710 | 54 52 49 47 46 43 40 37 711 | 60 63 65 68 70 72 74 77 712 | 47 49 52 55 58 61 713 | 26 28 30 33 34 36 37 40 714 | 36 37 40 42 45 48 50 51 715 | 25 24 22 20 17 14 11 716 | 82 81 80 78 77 717 | 69 68 66 63 60 57 54 52 718 | 67 69 70 73 75 719 | 99 98 95 94 93 90 88 720 | 82 85 87 88 91 94 721 | 84 86 89 91 92 93 94 722 | 34 31 29 27 26 23 723 | 76 78 79 80 81 82 83 85 724 | 42 43 46 47 49 52 55 725 | 62 63 66 68 70 726 | 82 79 76 74 71 727 | 4 7 8 9 11 12 13 728 | 6 8 9 10 11 729 | 82 80 77 74 71 69 67 730 | 59 61 64 67 69 731 | 21 19 16 14 13 10 732 | 14 17 18 21 23 25 26 733 | 27 24 22 21 20 19 734 | 77 75 74 73 72 69 735 | 7 8 9 10 12 14 15 17 736 | 76 78 79 82 83 84 86 89 737 | 66 68 69 71 72 74 738 | 69 68 66 64 61 739 | 64 62 60 57 56 740 | 59 61 62 65 68 741 | 19 17 16 14 12 742 | 52 53 54 55 58 61 63 743 | 3 6 9 12 14 744 | 80 83 84 86 89 745 | 97 95 93 91 90 88 87 746 | 52 53 55 58 60 61 62 65 747 | 35 32 30 27 24 22 748 | 52 55 58 59 62 64 749 | 83 81 78 77 75 73 71 68 750 | 91 89 87 84 83 80 78 751 | 7 8 11 12 15 752 | 60 62 65 67 69 70 71 74 753 | 50 52 53 54 56 57 754 | 22 19 17 16 13 10 755 | 46 43 40 39 37 756 | 57 60 63 66 68 70 73 76 757 | 73 74 75 77 80 81 758 | 69 70 72 75 78 759 | 27 26 24 21 19 16 760 | 68 70 72 74 75 77 761 | 73 74 75 76 77 80 82 84 762 | 65 68 69 72 73 75 763 | 50 47 44 41 38 37 764 | 93 90 87 85 83 82 79 765 | 13 16 17 19 22 24 27 766 | 97 95 94 92 91 88 767 | 40 37 35 33 32 768 | 68 70 71 72 73 74 75 769 | 14 17 18 20 23 770 | 43 41 38 37 34 33 31 30 771 | 17 20 23 26 29 31 33 34 772 | 13 15 16 17 19 21 22 773 | 94 92 91 88 86 774 | 82 81 79 78 77 76 74 73 775 | 39 41 44 46 48 50 776 | 82 79 78 76 73 71 777 | 98 97 95 92 91 89 87 85 778 | 81 78 76 74 71 779 | 67 70 72 73 76 79 80 780 | 22 23 25 28 30 31 34 781 | 49 48 46 43 41 782 | 87 86 85 84 83 783 | 84 87 88 90 91 94 784 | 29 26 24 23 20 785 | 22 20 19 18 17 786 | 48 50 53 55 57 60 63 64 787 | 51 49 48 46 43 41 39 37 788 | 21 22 24 26 28 31 34 789 | 55 56 57 59 60 62 63 790 | 38 39 42 45 46 49 791 | 73 71 70 68 67 792 | 54 51 50 47 46 43 42 41 793 | 25 24 23 21 18 794 | 70 72 75 78 81 82 795 | 53 52 50 49 47 796 | 56 55 53 52 49 48 797 | 80 79 78 75 74 71 68 67 798 | 70 71 74 76 78 81 83 799 | 34 33 30 28 26 24 21 800 | 62 64 65 66 67 68 801 | 51 53 55 58 61 64 65 802 | 37 35 32 31 30 28 26 25 803 | 47 49 51 53 54 55 804 | 31 28 25 22 21 19 805 | 21 22 25 26 29 30 31 806 | 53 50 48 45 43 40 38 37 807 | 83 80 79 78 75 808 | 20 21 23 26 29 30 809 | 30 33 34 37 39 810 | 18 20 23 24 25 811 | 24 26 28 31 33 36 37 812 | 81 78 76 75 73 71 68 65 813 | 70 73 75 77 78 81 82 85 814 | 23 24 26 29 31 34 36 39 815 | 26 28 29 32 34 37 38 40 816 | 5 6 7 9 12 817 | 27 25 22 19 16 13 11 818 | 20 23 24 25 26 29 31 33 819 | 29 28 26 24 22 20 18 15 820 | 72 73 76 77 79 80 81 83 821 | 17 18 20 22 25 822 | 85 83 82 80 78 75 72 823 | 7 8 9 11 13 824 | 70 71 72 73 75 77 825 | 58 61 62 63 64 66 68 826 | 23 20 19 16 13 10 8 827 | 8 11 14 17 19 22 828 | 89 88 85 84 81 79 78 829 | 60 63 64 65 68 71 72 75 830 | 47 49 50 51 52 53 55 56 831 | 32 29 27 24 21 19 17 14 832 | 78 81 84 85 86 88 90 93 833 | 69 67 65 64 63 62 834 | 23 24 25 28 30 33 35 835 | 35 36 39 41 43 46 836 | 81 80 78 77 75 837 | 37 39 41 43 44 46 838 | 70 73 76 79 81 839 | 99 96 94 92 89 86 85 82 840 | 31 30 28 26 25 24 21 841 | 73 75 77 80 81 84 85 86 842 | 27 28 31 33 35 38 40 42 843 | 49 51 53 54 57 844 | 28 27 24 23 20 19 18 845 | 54 55 58 60 62 846 | 34 33 32 31 29 847 | 17 20 22 23 24 25 28 31 848 | 57 58 60 61 64 65 68 849 | 89 88 86 84 81 79 77 850 | 20 23 26 29 30 33 36 39 851 | 82 85 86 87 90 91 94 852 | 66 64 62 59 57 55 53 853 | 46 43 40 39 36 35 33 31 854 | 43 41 40 38 35 32 855 | 55 53 52 51 48 856 | 10 12 14 15 17 19 857 | 29 26 25 22 20 18 16 858 | 34 33 31 29 28 26 25 22 859 | 83 86 89 90 92 860 | 81 80 79 77 74 73 70 861 | 90 87 85 84 83 862 | 34 35 38 41 42 863 | 46 45 42 41 38 36 864 | 77 76 73 72 71 865 | 66 63 60 58 56 55 866 | 43 44 47 48 49 51 53 56 867 | 20 22 25 26 29 30 31 868 | 83 86 88 91 92 95 96 869 | 85 82 79 76 73 72 69 870 | 59 57 54 53 50 49 48 45 871 | 90 89 86 83 82 79 872 | 21 23 24 26 29 32 34 873 | 87 84 83 81 79 76 73 71 874 | 48 47 45 43 41 40 37 36 875 | 7 8 9 11 14 15 18 19 876 | 55 52 49 48 47 45 44 877 | 75 76 78 80 83 878 | 62 64 65 68 70 73 76 79 879 | 51 53 54 57 59 62 65 68 880 | 60 61 62 64 67 70 71 72 881 | 87 88 89 90 93 94 882 | 67 70 73 74 77 883 | 37 40 42 44 45 47 48 884 | 27 24 22 19 16 14 885 | 24 23 22 20 17 15 13 10 886 | 19 21 24 27 29 30 887 | 31 29 27 25 23 888 | 73 72 69 67 65 63 61 889 | 88 87 84 81 80 79 890 | 67 69 72 74 75 78 81 891 | 80 79 76 74 72 71 892 | 22 20 18 15 13 12 893 | 42 40 37 35 32 30 29 27 894 | 2 3 5 8 10 895 | 2 3 6 7 10 12 896 | 83 84 85 86 88 91 92 93 897 | 18 21 24 26 29 31 34 35 898 | 77 79 82 84 85 86 88 89 899 | 59 61 63 65 67 69 900 | 12 15 16 19 20 22 901 | 37 35 33 32 30 27 902 | 90 87 86 85 84 903 | 48 49 51 52 53 904 | 63 60 57 54 52 51 49 46 905 | 57 56 54 53 51 50 48 45 906 | 16 14 11 10 9 8 7 5 907 | 54 56 59 61 63 66 69 70 908 | 34 35 38 41 42 44 46 49 909 | 39 40 41 42 44 47 910 | 16 13 10 7 6 3 911 | 89 91 92 93 94 96 912 | 60 63 64 65 68 70 913 | 31 29 27 26 23 20 19 16 914 | 34 37 40 41 44 915 | 89 86 85 83 81 78 75 916 | 79 78 76 74 72 917 | 4 7 9 12 15 17 18 918 | 70 67 65 63 62 60 58 56 919 | 42 44 46 47 48 51 53 54 920 | 17 15 14 13 12 921 | 32 35 36 38 39 41 44 46 922 | 9 8 5 4 2 1 923 | 77 80 82 84 86 88 91 924 | 73 72 70 67 64 63 925 | 31 29 28 25 23 926 | 46 47 50 51 52 927 | 26 25 22 19 18 928 | 36 33 32 29 26 23 22 929 | 17 14 11 10 9 6 4 930 | 63 61 58 55 52 49 46 931 | 44 42 41 40 37 35 33 932 | 61 60 59 56 54 933 | 55 58 59 60 61 63 934 | 93 91 90 87 86 84 935 | 78 76 75 73 72 71 936 | 64 63 62 59 58 937 | 84 85 88 90 93 938 | 44 42 39 38 37 35 939 | 41 40 37 34 32 940 | 10 9 6 3 2 941 | 50 47 44 42 39 942 | 82 84 87 88 89 90 943 | 74 75 77 78 81 84 86 944 | 50 53 56 57 59 62 945 | 58 56 55 53 52 946 | 19 16 13 12 10 8 7 947 | 35 32 30 28 26 25 24 948 | 29 26 24 23 21 18 15 14 949 | 23 21 19 16 15 14 11 10 950 | 86 89 92 94 95 951 | 66 64 62 59 56 952 | 23 22 20 19 18 953 | 45 42 40 37 34 33 32 31 954 | 20 18 16 15 14 13 955 | 31 28 27 26 23 22 956 | 10 13 16 17 19 22 24 957 | 37 38 39 40 41 958 | 79 81 82 84 87 90 959 | 33 31 30 27 25 24 22 960 | 4 6 7 8 10 12 14 16 961 | 11 13 16 18 21 22 23 962 | 80 81 83 85 87 90 963 | 64 61 60 59 57 54 964 | 88 86 83 82 81 79 77 965 | 62 63 65 67 69 966 | 99 97 94 93 91 90 89 88 967 | 66 68 70 71 72 968 | 97 94 92 91 88 969 | 83 84 85 87 90 970 | 22 24 26 29 32 33 34 971 | 42 44 45 48 49 50 972 | 93 92 91 89 87 86 973 | 77 79 81 82 83 85 88 974 | 39 38 37 35 33 975 | 36 33 31 30 27 976 | 66 64 63 60 57 54 51 48 977 | 35 37 39 42 43 978 | 66 64 61 59 56 55 979 | 23 24 25 28 30 33 36 38 980 | 2 5 6 7 8 9 12 13 981 | 81 78 77 74 73 72 69 982 | 40 42 43 44 46 49 983 | 45 46 48 51 54 57 60 63 984 | 97 94 93 91 89 86 85 82 985 | 61 60 59 58 55 54 53 986 | 50 51 53 55 58 60 63 64 987 | 45 46 47 50 52 988 | 28 26 24 23 22 19 17 989 | 38 40 42 43 44 46 47 990 | 34 32 29 28 26 25 991 | 17 14 11 8 7 992 | 98 97 95 94 93 92 993 | 73 74 75 76 78 994 | 76 78 79 80 83 995 | 70 68 67 64 62 60 59 56 996 | 95 94 93 90 89 88 86 997 | 42 39 36 35 32 29 998 | 39 36 33 32 30 999 | 64 66 69 71 72 73 75 1000 | 39 37 35 32 29 27 24 1001 | --------------------------------------------------------------------------------