├── .gitignore ├── day06sample ├── day07sample ├── day11samplesmall ├── day12sample ├── day02sample ├── day09sample ├── day08bug ├── day01sample ├── day08simple ├── day12sample2 ├── day03sample ├── day05sample ├── day11input ├── day11sample ├── day12input ├── day10sample ├── day04sample ├── package.json ├── day06input ├── day08sample ├── day01.js ├── day02.js ├── day07.ts ├── README.md ├── day09.ts ├── day07input ├── day03.js ├── day06.ts ├── day10.ts ├── day11.ts ├── day05.ts ├── yarn.lock ├── day12.ts ├── day08.ts ├── day10input ├── day04.js ├── day09input ├── day04input ├── day05input ├── day02input ├── day08input ├── day03input └── day01input /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /day06sample: -------------------------------------------------------------------------------- 1 | 3,4,3,1,2 2 | -------------------------------------------------------------------------------- /day07sample: -------------------------------------------------------------------------------- 1 | 16,1,2,0,4,2,7,1,2,14 -------------------------------------------------------------------------------- /day11samplesmall: -------------------------------------------------------------------------------- 1 | 11111 2 | 19991 3 | 19191 4 | 19991 5 | 11111 -------------------------------------------------------------------------------- /day12sample: -------------------------------------------------------------------------------- 1 | start-A 2 | start-b 3 | A-c 4 | A-b 5 | b-d 6 | A-end 7 | b-end -------------------------------------------------------------------------------- /day02sample: -------------------------------------------------------------------------------- 1 | forward 5 2 | down 5 3 | forward 8 4 | up 3 5 | down 8 6 | forward 2 -------------------------------------------------------------------------------- /day09sample: -------------------------------------------------------------------------------- 1 | 2199943210 2 | 3987894921 3 | 9856789892 4 | 8767896789 5 | 9899965678 -------------------------------------------------------------------------------- /day08bug: -------------------------------------------------------------------------------- 1 | fbegcd cbd adcefb dageb afcb bc aefdc ecdab fgdeca fcdbega | efabcd cedba gadfec cb -------------------------------------------------------------------------------- /day01sample: -------------------------------------------------------------------------------- 1 | 199 2 | 200 3 | 208 4 | 210 5 | 200 6 | 207 7 | 240 8 | 269 9 | 260 10 | 263 -------------------------------------------------------------------------------- /day08simple: -------------------------------------------------------------------------------- 1 | acedgfb cdfbe gcdfa fbcad dab cefabd cdfgeb eafb cagedb ab | cdfeb fcadb cdfeb cdbaf -------------------------------------------------------------------------------- /day12sample2: -------------------------------------------------------------------------------- 1 | dc-end 2 | HN-start 3 | start-kj 4 | dc-start 5 | dc-HN 6 | LN-dc 7 | HN-end 8 | kj-sa 9 | kj-HN 10 | kj-dc -------------------------------------------------------------------------------- /day03sample: -------------------------------------------------------------------------------- 1 | 00100 2 | 11110 3 | 10110 4 | 10111 5 | 10101 6 | 01111 7 | 00111 8 | 11100 9 | 10000 10 | 11001 11 | 00010 12 | 01010 13 | -------------------------------------------------------------------------------- /day05sample: -------------------------------------------------------------------------------- 1 | 0,9 -> 5,9 2 | 8,0 -> 0,8 3 | 9,4 -> 3,4 4 | 2,2 -> 2,1 5 | 7,0 -> 7,4 6 | 6,4 -> 2,0 7 | 0,9 -> 2,9 8 | 3,4 -> 1,4 9 | 0,0 -> 8,8 10 | 5,5 -> 8,2 -------------------------------------------------------------------------------- /day11input: -------------------------------------------------------------------------------- 1 | 1326253315 2 | 3427728113 3 | 5751612542 4 | 6543868322 5 | 4422526221 6 | 2234325647 7 | 1773174887 8 | 7281321674 9 | 6562513118 10 | 4824541522 -------------------------------------------------------------------------------- /day11sample: -------------------------------------------------------------------------------- 1 | 5483143223 2 | 2745854711 3 | 5264556173 4 | 6141336146 5 | 6357385478 6 | 4167524645 7 | 2176841721 8 | 6882881134 9 | 4846848554 10 | 5283751526 11 | -------------------------------------------------------------------------------- /day12input: -------------------------------------------------------------------------------- 1 | he-JK 2 | wy-KY 3 | pc-XC 4 | vt-wy 5 | LJ-vt 6 | wy-end 7 | wy-JK 8 | end-LJ 9 | start-he 10 | JK-end 11 | pc-wy 12 | LJ-pc 13 | at-pc 14 | xf-XC 15 | XC-he 16 | pc-JK 17 | vt-XC 18 | at-he 19 | pc-he 20 | start-at 21 | start-XC 22 | at-LJ 23 | vt-JK -------------------------------------------------------------------------------- /day10sample: -------------------------------------------------------------------------------- 1 | [({(<(())[]>[[{[]{<()<>> 2 | [(()[<>])]({[<{<<[]>>( 3 | {([(<{}[<>[]}>{[]{[(<()> 4 | (((({<>}<{<{<>}{[]{[]{} 5 | [[<[([]))<([[{}[[()]]] 6 | [{[{({}]{}}([{[{{{}}([] 7 | {<[[]]>}<{[{[{[]{()[[[] 8 | [<(<(<(<{}))><([]([]() 9 | <{([([[(<>()){}]>(<<{{ 10 | <{([{{}}[<[[[<>{}]]]>[]] 11 | -------------------------------------------------------------------------------- /day04sample: -------------------------------------------------------------------------------- 1 | 7,4,9,5,11,17,23,2,0,14,21,24,10,16,13,6,15,25,12,22,18,20,8,19,3,26,1 2 | 3 | 22 13 17 11 0 4 | 8 2 23 4 24 5 | 21 9 14 16 7 6 | 6 10 3 18 5 7 | 1 12 20 15 19 8 | 9 | 3 15 0 2 22 10 | 9 18 13 17 5 11 | 19 8 7 25 23 12 | 20 11 10 24 4 13 | 14 21 16 12 6 14 | 15 | 14 21 17 24 4 16 | 10 16 15 9 19 17 | 18 8 23 26 20 18 | 22 11 13 6 5 19 | 2 0 12 3 7 -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "advent-of-code-2021", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "@types/lodash": "^4.14.177", 13 | "@types/node": "^16.11.11", 14 | "lodash": "^4.17.21", 15 | "lodash-transpose": "^0.2.1", 16 | "ts-node": "^10.4.0", 17 | "typescript": "^4.5.2" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /day06input: -------------------------------------------------------------------------------- 1 | 4,5,3,2,3,3,2,4,2,1,2,4,5,2,2,2,4,1,1,1,5,1,1,2,5,2,1,1,4,4,5,5,1,2,1,1,5,3,5,2,4,3,2,4,5,3,2,1,4,1,3,1,2,4,1,1,4,1,4,2,5,1,4,3,5,2,4,5,4,2,2,5,1,1,2,4,1,4,4,1,1,3,1,2,3,2,5,5,1,1,5,2,4,2,2,4,1,1,1,4,2,2,3,1,2,4,5,4,5,4,2,3,1,4,1,3,1,2,3,3,2,4,3,3,3,1,4,2,3,4,2,1,5,4,2,4,4,3,2,1,5,3,1,4,1,1,5,4,2,4,2,2,4,4,4,1,4,2,4,1,1,3,5,1,5,5,1,3,2,2,3,5,3,1,1,4,4,1,3,3,3,5,1,1,2,5,5,5,2,4,1,5,1,2,1,1,1,4,3,1,5,2,3,1,3,1,4,1,3,5,4,5,1,3,4,2,1,5,1,3,4,5,5,2,1,2,1,1,1,4,3,1,4,2,3,1,3,5,1,4,5,3,1,3,3,2,2,1,5,5,4,3,2,1,5,1,3,1,3,5,1,1,2,1,1,1,5,2,1,1,3,2,1,5,5,5,1,1,5,1,4,1,5,4,2,4,5,2,4,3,2,5,4,1,1,2,4,3,2,1 2 | -------------------------------------------------------------------------------- /day08sample: -------------------------------------------------------------------------------- 1 | be cfbegad cbdgef fgaecd cgeb fdcge agebfd fecdb fabcd edb | fdgacbe cefdb cefbgd gcbe 2 | edbfga begcd cbg gc gcadebf fbgde acbgfd abcde gfcbed gfec | fcgedb cgb dgebacf gc 3 | fgaebd cg bdaec gdafb agbcfd gdcbef bgcad gfac gcb cdgabef | cg cg fdcagb cbg 4 | fbegcd cbd adcefb dageb afcb bc aefdc ecdab fgdeca fcdbega | efabcd cedba gadfec cb 5 | aecbfdg fbg gf bafeg dbefa fcge gcbea fcaegb dgceab fcbdga | gecf egdcabf bgf bfgea 6 | fgeab ca afcebg bdacfeg cfaedg gcfdb baec bfadeg bafgc acf | gebdcfa ecba ca fadegcb 7 | dbcfg fgd bdegcaf fgec aegbdf ecdfab fbedc dacgb gdcebf gf | cefg dcbef fcge gbcadfe 8 | bdfegc cbegaf gecbf dfcage bdacg ed bedf ced adcbefg gebcd | ed bcgafe cdgba cbgef 9 | egadfb cdbfeg cegd fecab cgb gbdefca cg fgcdab egfdb bfceg | gbdfcae bgc cg cgb 10 | gcafb gcf dcaebfg ecagb gf abcdeg gaef cafbge fdbac fegbdc | fgae cfgab fg bagce -------------------------------------------------------------------------------- /day01.js: -------------------------------------------------------------------------------- 1 | // import fs and lodash 2 | const fs = require("fs"); 3 | const _ = require("lodash"); 4 | 5 | function readFile(name) { 6 | // read file and return array of numbers 7 | let input = fs.readFileSync(name, "utf8"); 8 | input = input.split("\n"); 9 | input = input.map(Number); 10 | return input; 11 | } 12 | 13 | function part1() { 14 | input = readFile("day01input"); 15 | // loop over input and count the number of times a number is bigger than previous number in array 16 | let count = 0; 17 | for (let i = 0; i < input.length; i++) { 18 | if (input[i] > input[i - 1]) { 19 | count++; 20 | } 21 | } 22 | 23 | // output count 24 | console.log(count); 25 | } 26 | 27 | function part2() { 28 | input = readFile("day01input"); 29 | // loop over input 30 | let count = 0; 31 | for (let i = 0; i < input.length; i++) { 32 | // create two sliding windows of length 3 one starting at index i and one starting at index i+1 33 | let window1 = input.slice(i, i + 3); 34 | let window2 = input.slice(i + 1, i + 4); 35 | 36 | // exit loop if window2 has less than 3 elements 37 | if (window2.length < 3) { 38 | break; 39 | } 40 | 41 | // create sums for both windows 42 | let sum1 = window1.reduce((a, b) => a + b); 43 | let sum2 = window2.reduce((a, b) => a + b); 44 | 45 | // increase count if sum2 is bigger than sum1 46 | if (sum2 > sum1) { 47 | count++; 48 | } 49 | } 50 | 51 | // output count 52 | console.log(count); 53 | } 54 | 55 | // run function part2 56 | part2(); 57 | -------------------------------------------------------------------------------- /day02.js: -------------------------------------------------------------------------------- 1 | // import fs and lodash 2 | const fs = require("fs"); 3 | const _ = require("lodash"); 4 | 5 | function readFile(name) { 6 | // read file and split into lines 7 | let input = fs.readFileSync(name, "utf8").split("\n"); 8 | 9 | // each line is string, whitespace and number. split it into parts 10 | let inputArray = input.map((line) => line.split(" ")); 11 | 12 | // return result 13 | return inputArray; 14 | } 15 | 16 | function part1() { 17 | // read file day02input 18 | let input = readFile("day02input"); 19 | 20 | // initialize position and depth 21 | let position = 0; 22 | let depth = 0; 23 | 24 | // loop over input 25 | for (let i = 0; i < input.length; i++) { 26 | // command is first element 27 | let command = input[i][0]; 28 | 29 | // range is second element which is a number 30 | let range = parseInt(input[i][1]); 31 | 32 | // if command is forward add range to position. if command is up subtract range from depth, if down then add range to depth 33 | if (command === "forward") { 34 | position += range; 35 | } else if (command === "up") { 36 | depth -= range; 37 | } else if (command === "down") { 38 | depth += range; 39 | } 40 | } 41 | 42 | // multiply position and depth and output 43 | console.log(position * depth); 44 | } 45 | 46 | // function part2 47 | function part2() { 48 | // read file day02input 49 | let input = readFile("day02input"); 50 | 51 | // init position, depth and aim 52 | let position = 0; 53 | let aim = 0; 54 | let depth = 0; 55 | 56 | // loop over input 57 | for (let i = 0; i < input.length; i++) { 58 | // command is first element 59 | let command = input[i][0]; 60 | 61 | // range is second element which is a number 62 | let range = parseInt(input[i][1]); 63 | 64 | // down X increases your aim by X units. 65 | // up X decreases your aim by X units. 66 | // forward X does two things: 67 | // It increases your horizontal position by X units. 68 | // It increases your depth by your aim multiplied by X. 69 | if (command === "down") { 70 | aim += range; 71 | } else if (command === "up") { 72 | aim -= range; 73 | } else if (command === "forward") { 74 | position += range; 75 | depth += aim * range; 76 | } 77 | } 78 | 79 | // multiply position and depth and output 80 | console.log(position * depth); 81 | } 82 | 83 | part2(); 84 | -------------------------------------------------------------------------------- /day07.ts: -------------------------------------------------------------------------------- 1 | // import lodash and fs 2 | import * as _ from "lodash"; 3 | import * as fs from "fs"; 4 | 5 | // function to read input of comma separated numbers 6 | function readInput(fileName: string): number[] { 7 | // read the file 8 | const input = fs.readFileSync(fileName, "utf8"); 9 | // split the input by comma 10 | const inputArray = input.split(","); 11 | // return the input as an array of numbers 12 | return inputArray.map(Number); 13 | } 14 | 15 | function part1() { 16 | // read day07sample 17 | const input = readInput("day07input"); 18 | 19 | // input are horizontal crab positions. 20 | // increase a crab position by 1 costs 1 fuel 21 | // decrease a crab position by 1 costs 1 fuel 22 | // calculate cost for moving all crabs to position 2 23 | const cost = input.reduce((acc, curr) => acc + Math.abs(curr - 2), 0); 24 | 25 | // find min and max positions of input 26 | const min = _.min(input) ?? 0; 27 | const max = _.max(input) ?? 0; 28 | 29 | // find target position between min and max with lowest cost 30 | const target = _.range(min, max + 1).reduce( 31 | (acc: any, current) => { 32 | const cost = input.reduce( 33 | (acc, curr) => acc + Math.abs(curr - current), 34 | 0 35 | ); 36 | if (cost < acc.cost) { 37 | return { 38 | cost: cost, 39 | position: current, 40 | }; 41 | } 42 | return acc; 43 | }, 44 | { 45 | cost: Number.MAX_VALUE, 46 | position: 0, 47 | } 48 | ); 49 | 50 | // print target 51 | console.log(target); 52 | 53 | // output cost 54 | // console.log(`Part 1: ${cost}`); 55 | } 56 | 57 | // function calcCost, input number start, input number target 58 | // dist is the distance from start to target 59 | // cost is dist * (dist + 1) / 2 60 | function calcCost(start: number, target: number): number { 61 | const dist = Math.abs(start - target); 62 | return (dist * (dist + 1)) / 2; 63 | } 64 | 65 | function part2() { 66 | // read day07input 67 | const input = readInput("day07input"); 68 | 69 | // input are horizontal crab positions. 70 | // calculate cost for moving all crab to position 5 using calcCost 71 | const cost = input.reduce((acc, curr) => acc + calcCost(curr, 5), 0); 72 | 73 | // find min and max positions of input 74 | const min = _.min(input) ?? 0; 75 | const max = _.max(input) ?? 0; 76 | 77 | // find target position between min and max with lowest cost 78 | const target = _.range(min, max + 1).reduce( 79 | (acc: any, current) => { 80 | const cost = input.reduce( 81 | (acc, curr) => acc + calcCost(curr, current), 82 | 0 83 | ); 84 | if (cost < acc.cost) { 85 | return { 86 | cost: cost, 87 | position: current, 88 | }; 89 | } 90 | return acc; 91 | }, 92 | { 93 | cost: Number.MAX_VALUE, 94 | position: 0, 95 | } 96 | ); 97 | 98 | // print target 99 | console.log(target); 100 | 101 | // print cost 102 | // console.log(`Part 2: ${cost}`); 103 | } 104 | 105 | part2(); 106 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Advent of code 2021 github copilot edition 2 | 3 | None of the code was written by me. I only write comments and then use autocomplete. 4 | 5 | Exceptions: day6/pt2 and day8/pt2, where I gave up and implemented manually. 6 | 7 | ## Screencast of day 7 8 | 9 | https://youtu.be/XvoCyVFQOm8 10 | 11 | ## Lessons learned 12 | 13 | - Use types. Days 1-4 I used plain JS, but without type information copilot often didn't have enough information to use data structures in a correct way. I had to explicitely e.g. say "data is a 2d matrix of numbers" 14 | - Use natural language to describe your functions. This works better than describing in pseudo code. E.g. don't say "read a file of lines which contains vectors separated by -> where coordinates are comma separated". Instead say, read file with lines that look like this x,y -> x,y. 15 | - For example on day4 I used a pseudo code approach. This became very tedious, where writing the code myself would've been way faster and less error prone 16 | - On day5 I used types and natural language. The result was a lot better. 17 | - day7 part 2. Had to put the cost algorithm into a separate function, otherwise codepilot insisted on reusing the same cost function as for part 1. 18 | - In general already start off by separating your code into functions. It's easier for copilot to reference those steps later on. Also refactoring with copilot later on doesn't work and I'm **not allowed to touch the code** which is a problem. Sometimes I had the case where an algorithm was autocompleted correctly and as I wanted to describe the same thing as a separate function using the same wording, copilot refused to write it correctly again. I have the suspicion that copilot, if a code is once generated doesn't repeat itself thinking that the code before might have been wrong and thus tries to find a more correct solution if provided with the same comments. 19 | - Starting from day11 avoiding manual course correction get very tedious. I decided to allow minimal correctiony by hand, because the code is often 99% correct, but reformulating the comments to get it 100% correct takes too much time. Unfortunately 1% wrong e.g. with recursive functions often leads to a stack overflow :) 20 | 21 | ## Highlights so far 22 | 23 | - day2 I could copy and paste the instructions from AOC and it worked 24 | - day5 I could say `// function part2 is the same as part1 but also with diagonal lines`. **Thats pretty amazing!** 25 | - day9 Recursive flood fill algorithm without me needing to touch the code. Also whole day went very smooth with minimal rephrasing. 26 | 27 | ## Lowlights so far 28 | 29 | - day6 part 2. Copilot didn't understand what I want. Had to hand code it. 30 | - day8 part 2. I have no idea how I should've explained the solution to copilot, so again manual implementation. 31 | - day11. I was too dumb to read the instructions correctly (thoght the octopus flash at 9, not > 9). This lead to wrong autocompleted code, which I had to fix up manually. Also copilot refused to increase the neighbours after flashing for whatever reason. Had to +1 by adding a separate `// increase neighbour` comment. Also copilot used lodash fill for allocating the 2d flashed array which was wrong. Had to tell copilot to init the array not using lodash. 32 | -------------------------------------------------------------------------------- /day09.ts: -------------------------------------------------------------------------------- 1 | // import fs and lodash 2 | import * as _ from "lodash"; 3 | import * as fs from "fs"; 4 | 5 | // function reads file which is a 2d array of single digit numbers 6 | // returns a 2d array of single digit numbers 7 | function readFile(fileName: string): number[][] { 8 | const input = fs.readFileSync(fileName, "utf8"); 9 | const lines = input.split("\n"); 10 | const numbers = lines.map((line) => 11 | line.split("").map((char) => parseInt(char)) 12 | ); 13 | return numbers; 14 | } 15 | 16 | // algorithm to find list of local minima in numbers 17 | // local minima if smaller than left, right, top and bottom neighbours 18 | // returns a list of local minima and their coordinates 19 | function findLocalMinima(numbers: number[][]) { 20 | const localMinima: number[] = []; 21 | const localMinimaCoordinates: number[][] = []; 22 | for (let i = 0; i < numbers.length; i++) { 23 | for (let j = 0; j < numbers[i].length; j++) { 24 | if ( 25 | (i === 0 || numbers[i][j] < numbers[i - 1][j]) && 26 | (j === 0 || numbers[i][j] < numbers[i][j - 1]) && 27 | (i === numbers.length - 1 || numbers[i][j] < numbers[i + 1][j]) && 28 | (j === numbers[i].length - 1 || numbers[i][j] < numbers[i][j + 1]) 29 | ) { 30 | localMinima.push(numbers[i][j]); 31 | localMinimaCoordinates.push([i, j]); 32 | } 33 | } 34 | } 35 | 36 | return { 37 | localMinima, 38 | localMinimaCoordinates, 39 | }; 40 | } 41 | 42 | // function with height map input of single digit numbers as array, second parameter is the x and y coordinate of the starting point 43 | // flood fill outwards from starting point until digit 9 is reached 44 | // return the size of the filled area 45 | function floodFill(numbers: number[][], x: number, y: number): number { 46 | let size = 0; 47 | if (numbers[x][y] === 9) { 48 | return 1; 49 | } 50 | numbers[x][y] = 9; 51 | size = 1; 52 | if (x - 1 >= 0 && numbers[x - 1][y] !== 9) { 53 | size += floodFill(numbers, x - 1, y); 54 | } 55 | if (x + 1 < numbers.length && numbers[x + 1][y] !== 9) { 56 | size += floodFill(numbers, x + 1, y); 57 | } 58 | if (y - 1 >= 0 && numbers[x][y - 1] !== 9) { 59 | size += floodFill(numbers, x, y - 1); 60 | } 61 | if (y + 1 < numbers[x].length && numbers[x][y + 1] !== 9) { 62 | size += floodFill(numbers, x, y + 1); 63 | } 64 | return size; 65 | } 66 | 67 | function part1() { 68 | // read file day09input 69 | const numbers = readFile("day09input"); 70 | 71 | // find local minima 72 | const localMinima = findLocalMinima(numbers).localMinima; 73 | 74 | // sum up all local minima and add length of local minima 75 | const sum = _.sum(localMinima) + localMinima.length; 76 | 77 | // print result 78 | console.log(sum); 79 | } 80 | 81 | function part2() { 82 | // read file day09input 83 | const numbers = readFile("day09input"); 84 | 85 | // find local minima 86 | const localMinima = findLocalMinima(numbers).localMinimaCoordinates; 87 | 88 | // iterst over local minima and flood fill from each local minima, store the size of the filled area in array 89 | const sizes = localMinima.map(([i, j]) => floodFill(numbers, i, j)); 90 | 91 | // find largest 3 sizes and multiply them 92 | const largest3 = _.sortBy(sizes).slice(-3); 93 | const result = _.reduce(largest3, (a, b) => a * b); 94 | 95 | // print result 96 | console.log(result); 97 | } 98 | 99 | part2(); 100 | -------------------------------------------------------------------------------- /day07input: -------------------------------------------------------------------------------- 1 | 1101,1,29,67,1102,0,1,65,1008,65,35,66,1005,66,28,1,67,65,20,4,0,1001,65,1,65,1106,0,8,99,35,67,101,99,105,32,110,39,101,115,116,32,112,97,115,32,117,110,101,32,105,110,116,99,111,100,101,32,112,114,111,103,114,97,109,10,209,573,1277,704,518,276,196,62,1226,170,58,1450,101,65,99,435,986,1437,1570,35,354,247,110,105,139,1209,23,1074,339,69,483,21,33,323,1348,111,2,270,1239,316,529,1680,1056,1960,257,1009,1073,59,425,1181,198,31,299,771,53,817,728,931,72,517,39,279,304,401,1271,533,1551,133,297,162,902,370,985,643,1217,78,16,380,223,177,600,349,12,776,26,1738,526,85,1542,111,844,93,595,1545,873,836,422,180,1187,329,231,1521,54,162,212,471,1329,156,1299,160,541,676,67,200,22,24,76,242,178,1093,1173,818,1380,284,335,642,1047,112,271,541,927,52,983,238,116,135,871,400,436,1094,684,249,263,303,24,437,813,32,45,19,620,57,866,44,68,277,1112,110,77,1481,437,302,678,541,904,322,13,186,1474,836,43,1020,201,1586,1169,1149,470,535,55,879,133,1229,106,989,1023,256,103,56,401,667,557,98,288,694,286,237,1661,933,1063,20,227,80,815,289,1414,234,517,227,616,829,191,1211,92,591,279,22,139,67,214,60,145,468,10,521,807,1243,76,163,190,122,804,88,383,319,1127,399,376,423,304,126,10,297,377,1103,691,139,70,519,16,15,43,397,468,1183,90,28,1262,151,1448,62,64,1072,386,1330,1313,12,100,657,28,55,612,337,1865,704,263,565,249,564,565,1218,40,1146,150,718,1253,228,120,713,925,159,36,1087,1023,1490,316,540,1124,1127,781,417,656,0,174,1006,529,389,86,90,78,403,1500,253,35,655,650,933,815,108,168,321,345,147,251,258,25,173,243,740,48,476,1507,634,425,738,160,1415,395,448,156,636,1967,516,316,628,810,817,26,20,753,22,1133,352,204,211,47,22,874,43,12,18,1015,779,108,579,251,1398,33,1507,93,274,904,221,1062,868,3,363,42,14,435,62,1508,540,64,267,1690,418,205,502,152,142,414,178,50,344,780,81,635,128,355,239,1708,1814,29,251,624,22,38,789,948,186,529,895,76,150,416,502,975,1216,456,862,522,1149,131,10,121,1353,313,568,595,6,318,633,331,1652,656,214,21,35,289,80,860,229,244,1188,350,594,424,235,327,6,1083,40,134,839,279,172,1452,197,47,2,73,607,238,1151,844,533,110,1207,125,129,16,1000,965,236,228,497,589,111,1245,453,179,956,116,212,47,497,380,574,355,799,209,384,47,449,688,312,748,1531,1092,23,1001,69,155,924,1352,163,1561,743,609,1261,1231,32,1,739,513,300,370,36,568,89,487,201,11,146,274,163,1029,829,469,299,118,732,769,120,1093,776,610,1944,90,67,494,831,88,227,1257,344,662,401,310,664,56,94,183,935,179,643,4,1083,567,1525,208,204,899,123,36,438,1171,265,1406,177,202,1398,631,444,385,589,29,124,96,237,374,793,794,502,665,287,575,113,305,157,465,376,66,662,77,595,75,141,243,254,30,5,622,140,443,566,360,192,1531,1113,1299,598,147,469,732,1565,409,1380,550,173,232,361,131,99,37,547,132,1779,193,228,664,553,568,389,1069,58,71,610,738,624,261,491,158,105,416,131,198,35,823,9,313,6,429,1492,290,313,272,281,427,280,661,141,54,383,3,130,43,418,2,1040,1051,1006,38,151,1325,1357,117,1473,175,201,613,1458,1218,588,169,228,565,901,420,42,117,110,442,9,99,1685,979,84,35,129,248,1,21,360,123,203,1320,1200,209,510,362,106,148,313,292,63,842,93,88,134,720,565,156,118,983,119,1451,757,736,445,466,226,265,573,612,652,170,225,32,1049,1332,366,1375,692,270,388,321,1153,909,1266,93,5,495,377,212,429,90,199,278,631,693,63,816,395,281,315,0,737,575,121,865,1,485,262,49,804,518,109,600,358,221,14,370,450,947,448,67,576,22,1266,226,100,10,607,620,295,568,316,51,687,199,1478,45,489,1878,1035,298,219,363,85,664,1290,492,70,644,78,163,100,102,465,732,439,93,25,847,297,172,361,393,304,461,583,122,121,762,58,112,85,142,48,193,1617,386,685,1054,584,488,394,665,277,263,596,290,1231,171,1394,9,1218,77,54,487,182,528,695,662,413,345,51,690,1702,203,1500,461,1755,190,371,1122,1614,324,238,569,1482,15,711,1332,700,437,242,174,642,660,987,1232,121,620,17,389,22,105,847,36,251,285,1238,162,1227,1473,411,66,258,377,1135,438,117,664,281,1070,301,132,256,498,172,194,103,662,606,342,340,1501,802,549,380,58,179,361 -------------------------------------------------------------------------------- /day03.js: -------------------------------------------------------------------------------- 1 | // import fs 2 | const fs = require("fs"); 3 | 4 | // function to read file and split it into array 5 | function readFile(fileName) { 6 | return fs.readFileSync(fileName, "utf8").split("\n"); 7 | } 8 | 9 | function part1() { 10 | // read file day03input 11 | const input = readFile("day03input"); 12 | 13 | // len is the length of the first input element 14 | const len = input[0].length; 15 | 16 | // init commonBit as array of len 17 | let commonBit = new Array(len).fill(0); 18 | 19 | // loop through input and split each element into array 20 | // then loop through each element if 1 then increase commonBit at that index by 1 if 0 then decrease by 1 21 | for (let i = 0; i < input.length; i++) { 22 | const bit = input[i].split(""); 23 | for (let j = 0; j < len; j++) { 24 | if (bit[j] == 1) { 25 | commonBit[j]++; 26 | } else { 27 | commonBit[j]--; 28 | } 29 | } 30 | } 31 | 32 | // copy commonBit to common and inverted 33 | let common = commonBit.slice(); 34 | let inverted = commonBit.slice(); 35 | 36 | // loop over common and inverted 37 | // if entry > 0 then set common[j] to 1 else 0 38 | // inverted is the same as common but with 1 and 0 switched 39 | for (let i = 0; i < common.length; i++) { 40 | if (common[i] > 0) { 41 | common[i] = 1; 42 | } else { 43 | common[i] = 0; 44 | } 45 | if (inverted[i] > 0) { 46 | inverted[i] = 0; 47 | } else { 48 | inverted[i] = 1; 49 | } 50 | } 51 | 52 | // common and inverted are binary number strings, convert them to decimal 53 | const commonDecimal = parseInt(common.join(""), 2); 54 | const invertedDecimal = parseInt(inverted.join(""), 2); 55 | 56 | // multiply them and print 57 | const answer = commonDecimal * invertedDecimal; 58 | console.log(answer); 59 | } 60 | 61 | function commonBit(bitStrings, i) { 62 | // iterate over bitStrings and count number of 1s 63 | let count = 0; 64 | for (let j = 0; j < bitStrings.length; j++) { 65 | if (bitStrings[j][i] == 1) { 66 | count++; 67 | } 68 | } 69 | 70 | // return 1 if more 1 than 0, 0 if more 0 than 1, -1 if equal 71 | if (count > bitStrings.length / 2) { 72 | return 1; 73 | } 74 | if (count < bitStrings.length / 2) { 75 | return 0; 76 | } 77 | return -1; 78 | } 79 | 80 | function part2() { 81 | // read file day03input 82 | let input = readFile("day03input"); 83 | 84 | // len is the length of the first input element 85 | const len = input[0].length; 86 | 87 | // deep copy input to co2input 88 | let co2input = input.slice(); 89 | 90 | // iterate over len 91 | // if commonBit of input at i is 1 then filter input by all elements with bit at i as 1 92 | // if commonBit of input at i is 0 then filter input by all elements with bit at i as 0 93 | // if commonBit of input at i is -1 then filter input by all elements with bit at i as 1 94 | for (let i = 0; i < len; i++) { 95 | if (commonBit(input, i) == 1) { 96 | input = input.filter((element) => element[i] == 1); 97 | } else if (commonBit(input, i) == 0) { 98 | input = input.filter((element) => element[i] == 0); 99 | } else { 100 | input = input.filter((element) => element[i] == 1); 101 | } 102 | 103 | // stop if input contains only one element 104 | if (input.length == 1) { 105 | break; 106 | } 107 | } 108 | 109 | // do the same for co2input but inverted 110 | for (let i = 0; i < len; i++) { 111 | if (commonBit(co2input, i) == 1) { 112 | co2input = co2input.filter((element) => element[i] == 0); 113 | } else if (commonBit(co2input, i) == 0) { 114 | co2input = co2input.filter((element) => element[i] == 1); 115 | } else { 116 | co2input = co2input.filter((element) => element[i] == 0); 117 | } 118 | 119 | // stop if co2input contains only one element 120 | if (co2input.length == 1) { 121 | break; 122 | } 123 | } 124 | 125 | // the first elements of input and co2input are strings 126 | // convert them to decimal and multiply them, print answer 127 | const answer = parseInt(input[0], 2) * parseInt(co2input[0], 2); 128 | console.log(answer); 129 | } 130 | 131 | part2(); 132 | -------------------------------------------------------------------------------- /day06.ts: -------------------------------------------------------------------------------- 1 | // import fs and lodash 2 | import * as _ from "lodash"; 3 | import * as fs from "fs"; 4 | 5 | // data structure linked list of numbers 6 | class Node { 7 | public value: number; 8 | public next: Node | null; 9 | constructor(value: number) { 10 | this.value = value; 11 | this.next = null; 12 | } 13 | } 14 | 15 | // data structure named List holding a linked list of numbers and last node 16 | class List { 17 | public head: Node | null; 18 | public last: Node | null; 19 | constructor() { 20 | this.head = null; 21 | this.last = null; 22 | } 23 | // add a node to the end of the list 24 | add(value: number) { 25 | const node = new Node(value); 26 | if (this.head === null) { 27 | this.head = node; 28 | } else if (this.last) { 29 | this.last.next = node; 30 | } 31 | this.last = node; 32 | } 33 | // print the as comma separated values 34 | print() { 35 | let current = this.head; 36 | let result = ""; 37 | while (current) { 38 | result += current.value + ","; 39 | current = current.next; 40 | } 41 | console.log(result); 42 | } 43 | // return the number of nodes in the list 44 | length() { 45 | let current = this.head; 46 | let count = 0; 47 | while (current) { 48 | count++; 49 | current = current.next; 50 | } 51 | return count; 52 | } 53 | } 54 | 55 | // function to read input file which is comma separated list of numbers, returns List 56 | function readInput(fileName: string): List { 57 | const list = new List(); 58 | const input = fs.readFileSync(fileName, "utf8"); 59 | const numbers = input.split(","); 60 | for (const number of numbers) { 61 | list.add(parseInt(number, 10)); 62 | } 63 | return list; 64 | } 65 | 66 | // function process with input of type List 67 | // if value is > 0 then reduce by one 68 | // if value is 0 then set to 6 and append 9 at end of list 69 | // return list 70 | function process(input: List): List { 71 | let current = input.head; 72 | while (current) { 73 | if (current.value > 0) { 74 | current.value--; 75 | } else if (current.value === 0) { 76 | current.value = 6; 77 | input.add(9); 78 | } 79 | current = current.next; 80 | } 81 | return input; 82 | } 83 | 84 | function part1() { 85 | // read file day06input 86 | let input = readInput("day06input"); 87 | 88 | // process input 256 times 89 | for (let i = 0; i < 256; i++) { 90 | input = process(input); 91 | } 92 | 93 | // print length of list 94 | console.log(input.length()); 95 | } 96 | 97 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 98 | // Everything below here was hand coded and NOT using copilot which was wayyyy to dumb to understand what I want! 99 | 100 | const childCountCache = {} as { [key: string]: number }; 101 | 102 | function numChildren(cycle: number, numSteps: number): number { 103 | if (numSteps < cycle + 1) { 104 | return 0; 105 | } 106 | 107 | // subtract cycle+1 so we start at cycle count 6 which is birth date 108 | const steps = numSteps - cycle - 1; 109 | const directChildren = 1 + Math.floor(steps / 7); 110 | let sum = 0; 111 | for (let i = steps; i >= 7; i -= 7) { 112 | // if we have a cached value use that 113 | if (!!childCountCache[`8,${i}`]) { 114 | sum += childCountCache[`8,${i}`]; 115 | } else { 116 | // else calculate it and cache it 117 | const num = numChildren(8, i); 118 | childCountCache[`8,${i}`] = num; 119 | sum += num; 120 | } 121 | } 122 | return sum + directChildren; 123 | } 124 | 125 | // function to read comma separated list of numbers into number array 126 | function readInput2(fileName: string): number[] { 127 | const input = fs.readFileSync(fileName, "utf8"); 128 | const numbers = input.split(","); 129 | const result = []; 130 | for (const number of numbers) { 131 | result.push(parseInt(number, 10)); 132 | } 133 | return result; 134 | } 135 | 136 | function part2() { 137 | // read file day06input as comma separated list of numbers into array 138 | const input = readInput2("day06input"); 139 | 140 | // cache warmup by going from 0 to 256 which is fast, because higher values can use cached values from lower values 141 | for (let i = 0; i < 256; i++) { 142 | numChildren(8, i); 143 | } 144 | 145 | // for each number in input calculate number of children after 18 steps 146 | // sum them all up and add length of input 147 | let sum = 0; 148 | for (const number of input) { 149 | const children = numChildren(number, 256); 150 | sum += children; 151 | } 152 | sum += input.length; 153 | console.log(sum); 154 | } 155 | 156 | part2(); 157 | -------------------------------------------------------------------------------- /day10.ts: -------------------------------------------------------------------------------- 1 | // import lodash and fs 2 | import * as _ from "lodash"; 3 | import * as fs from "fs"; 4 | 5 | // create score map data structure 6 | // ) is worth 3 7 | // ] is worth 57 8 | // } is worth 1197 9 | // > is worth 25137 10 | const scoreMap: { [key: string]: number } = { 11 | ")": 3, 12 | "]": 57, 13 | "}": 1197, 14 | ">": 25137, 15 | }; 16 | 17 | function part1() { 18 | // read day10sample 19 | const input = fs.readFileSync("day10input", "utf8").split("\n"); 20 | 21 | // lines contain brackets (), [], {}, <> 22 | // parse each line push open brackets to stack 23 | // if close bracket is found, pop from stack if stack top is matching opening bracket 24 | // if close bracket does not match opening bracket abort and store closing bracket to result array 25 | // return result array 26 | const stack: string[] = []; 27 | const result: string[] = []; 28 | for (const line of input) { 29 | for (const char of line) { 30 | if (char === "(" || char === "[" || char === "{" || char === "<") { 31 | stack.push(char); 32 | } else if (char === ")" || char === "]" || char === "}" || char === ">") { 33 | if (stack.length === 0) { 34 | result.push(char); 35 | } else { 36 | const top = stack.pop(); 37 | if ( 38 | (top === "(" && char !== ")") || 39 | (top === "[" && char !== "]") || 40 | (top === "{" && char !== "}") || 41 | (top === "<" && char !== ">") 42 | ) { 43 | result.push(char); 44 | } 45 | } 46 | } 47 | } 48 | } 49 | 50 | // go over result and add up scores 51 | let score = 0; 52 | for (const char of result) { 53 | score += scoreMap[char]; 54 | } 55 | 56 | console.log(score); 57 | } 58 | 59 | function part2() { 60 | // read day10sample 61 | const input = fs.readFileSync("day10input", "utf8").split("\n"); 62 | 63 | // lines contain brackets (), [], {}, <> 64 | // parse each line push open brackets to stack 65 | // if close bracket is found, pop from stack if stack top is matching opening bracket 66 | // if close bracket does not match opening bracket stop parsing this line 67 | // after line is parsed, if stack is not empty store line in result array also store stack in stackResults 68 | // return result array 69 | const stack: string[] = []; 70 | const result: string[] = []; 71 | const stackResults: string[][] = []; 72 | for (const line of input) { 73 | for (const char of line) { 74 | if (char === "(" || char === "[" || char === "{" || char === "<") { 75 | stack.push(char); 76 | } else if (char === ")" || char === "]" || char === "}" || char === ">") { 77 | if (stack.length === 0) { 78 | // clear stack 79 | stack.length = 0; 80 | break; 81 | } else { 82 | const top = stack.pop(); 83 | if ( 84 | (top === "(" && char !== ")") || 85 | (top === "[" && char !== "]") || 86 | (top === "{" && char !== "}") || 87 | (top === "<" && char !== ">") 88 | ) { 89 | // clear stack 90 | stack.length = 0; 91 | break; 92 | } 93 | } 94 | } 95 | } 96 | if (stack.length > 0) { 97 | result.push(line); 98 | stackResults.push(stack.slice()); 99 | // reset stack 100 | stack.length = 0; 101 | } 102 | } 103 | 104 | // print stack results as strings 105 | for (const stackResult of stackResults) { 106 | console.log(stackResult.join("")); 107 | } 108 | 109 | // go over stackResults, reverse each stack 110 | // return 111 | for (let i = 0; i < stackResults.length; i++) { 112 | stackResults[i].reverse(); 113 | } 114 | 115 | // new scoring map 116 | // (: 1 point. 117 | // [: 2 points. 118 | // {: 3 points. 119 | // <: 4 points. 120 | const newScoreMap: { [key: string]: number } = { 121 | "(": 1, 122 | "[": 2, 123 | "{": 3, 124 | "<": 4, 125 | }; 126 | 127 | // go over stackResults and create score for each line 128 | // line score is done as follows: multiply existing line score by 5 and then add new score 129 | // store line score in lineScores 130 | const lineScores: number[] = []; 131 | for (let i = 0; i < stackResults.length; i++) { 132 | let lineScore = 0; 133 | for (const char of stackResults[i]) { 134 | lineScore *= 5; 135 | lineScore += newScoreMap[char]; 136 | } 137 | console.log("lineScore", lineScore); 138 | lineScores.push(lineScore); 139 | } 140 | 141 | // sort scores and print middle 142 | const sortedScores = lineScores.sort((a, b) => a - b); 143 | console.log(sortedScores[Math.floor(sortedScores.length / 2)]); 144 | } 145 | 146 | part2(); 147 | -------------------------------------------------------------------------------- /day11.ts: -------------------------------------------------------------------------------- 1 | // import fs and lodash 2 | import * as _ from "lodash"; 3 | import * as fs from "fs"; 4 | 5 | // function reads file into 2d array of single digits 6 | function readFile(fileName: string): number[][] { 7 | const file = fs.readFileSync(fileName, "utf8"); 8 | const lines = file.split("\n"); 9 | const digits = lines.map((line) => 10 | line.split("").map((digit) => parseInt(digit, 10)) 11 | ); 12 | return digits; 13 | } 14 | 15 | // function increase takes 2d array of single digits and returns 2d array of single digits 16 | // increases each digit by 1 17 | function increase(digits: number[][]): number[][] { 18 | return digits.map((row) => row.map((digit) => digit + 1)); 19 | } 20 | 21 | // create data structure for 2d vector 22 | interface Vector2 { 23 | x: number; 24 | y: number; 25 | } 26 | 27 | // create data structure holding 2d bool array flashed and array of 2d vectors toBeFlashed 28 | interface FlashData { 29 | flashed: boolean[][]; 30 | toBeFlashed: Vector2[]; 31 | } 32 | 33 | // function flash takes 2d array of numbers, the 2d coordinates of a number, and a 2d array of boolean values named flashed, and 2d array of vectors toBeFlashed 34 | // if digit is > 9 and not flashed, mark it as flashed and 35 | // flash it by increasing it by increasing every neighbor with value smaller than 10 (also diagonal) by 1. 36 | // if any of those neighbors reaches 10, store their coordinate in an array toBeFlashed. 37 | // return flashed and toBeFlashed as FlashData 38 | function flash( 39 | digits: number[][], 40 | coords: Vector2, 41 | flashed: boolean[][], 42 | toBeFlashed: Vector2[] = [] 43 | ): FlashData { 44 | const digit = digits[coords.y][coords.x]; 45 | if (digit > 9 && !flashed[coords.y][coords.x]) { 46 | flashed[coords.y][coords.x] = true; 47 | const neighbors: Vector2[] = [ 48 | { x: coords.x - 1, y: coords.y - 1 }, 49 | { x: coords.x, y: coords.y - 1 }, 50 | { x: coords.x + 1, y: coords.y - 1 }, 51 | { x: coords.x - 1, y: coords.y }, 52 | { x: coords.x + 1, y: coords.y }, 53 | { x: coords.x - 1, y: coords.y + 1 }, 54 | { x: coords.x, y: coords.y + 1 }, 55 | { x: coords.x + 1, y: coords.y + 1 }, 56 | ]; 57 | neighbors.forEach((neighbor) => { 58 | if ( 59 | neighbor.x >= 0 && 60 | neighbor.x < digits[0].length && 61 | neighbor.y >= 0 && 62 | neighbor.y < digits.length && 63 | digits[neighbor.y][neighbor.x] <= 9 64 | ) { 65 | // increase neighbor by 1 66 | digits[neighbor.y][neighbor.x]++; 67 | if (digits[neighbor.y][neighbor.x] === 10) { 68 | toBeFlashed.push(neighbor); 69 | } 70 | } 71 | }); 72 | } 73 | return { flashed, toBeFlashed }; 74 | } 75 | 76 | // function flashAll takes 2d array of single digits and returns 2d array of single digits 77 | // iterates through each digit and flashes it and not already flashed 78 | // afterward reset all > 9 digits to 0 79 | // return number of flashed digits 80 | function flashAll(digits: number[][]): number { 81 | // create 2d array flashed of boolean values without lodash 82 | let flashed: boolean[][] = []; 83 | for (let i = 0; i < digits.length; i++) { 84 | let row: boolean[] = []; 85 | for (let j = 0; j < digits[0].length; j++) { 86 | row.push(false); 87 | } 88 | flashed.push(row); 89 | } 90 | 91 | // init toBeFlashed with coords of all digits > 9 92 | let toBeFlashed: Vector2[] = []; 93 | // init toBeFlashed with coords of all digits > 9 94 | digits.forEach((row, y) => { 95 | row.forEach((digit, x) => { 96 | if (digit > 9 && !flashed[y][x]) { 97 | toBeFlashed.push({ x, y }); 98 | } 99 | }); 100 | }); 101 | 102 | // repeat until toBeFlashed is empty 103 | while (toBeFlashed.length > 0) { 104 | // deep copy toBeFlashed to temp 105 | const temp = [...toBeFlashed]; 106 | 107 | for (let y = 0; y < digits.length; y++) { 108 | for (let x = 0; x < digits[0].length; x++) { 109 | const coords = { x, y }; 110 | const res = flash(digits, coords, flashed, toBeFlashed); 111 | flashed = res.flashed; 112 | toBeFlashed = res.toBeFlashed; 113 | } 114 | } 115 | 116 | // remove temp from toBeFlashed 117 | toBeFlashed = toBeFlashed.filter((coord) => !temp.includes(coord)); 118 | } 119 | 120 | // reset all digits >= 9 to 0 121 | digits.forEach((row, y) => { 122 | row.forEach((digit, x) => { 123 | if (digit > 9) { 124 | digits[y][x] = 0; 125 | } 126 | }); 127 | }); 128 | 129 | // count number of flashed digits 130 | return _.flatten(flashed).filter((flashed) => flashed).length; 131 | } 132 | 133 | function part1() { 134 | // read "day11sample", use let, not const 135 | let digits = readFile("day11input"); 136 | 137 | // repeat 100 times, increase, count number of flashed digits, sum up total number of flashed digits 138 | let total = 0; 139 | for (let i = 0; i < 1000000; i++) { 140 | digits = increase(digits); 141 | total += flashAll(digits); 142 | // if all digits are 0 print "found it" and i+1, then break 143 | if (digits.every((row) => row.every((digit) => digit === 0))) { 144 | console.log("found it", i + 1); 145 | break; 146 | } 147 | } 148 | console.log(total); 149 | 150 | // pretty print digits as 2d array 151 | console.log(digits.map((row) => row.join("")).join("\n")); 152 | } 153 | 154 | part1(); 155 | -------------------------------------------------------------------------------- /day05.ts: -------------------------------------------------------------------------------- 1 | // import lodash and fs 2 | import * as _ from 'lodash'; 3 | import * as fs from 'fs'; 4 | 5 | // data structure for 2d vector 6 | interface Vector2 { 7 | x: number; 8 | y: number; 9 | } 10 | 11 | // data structure line holding start and end 12 | interface Line { 13 | start: Vector2; 14 | end: Vector2; 15 | } 16 | 17 | // function reads file of lines with this format: x,y -> x,y 18 | // and returns array of lines 19 | function readInput(fileName: string): Line[] { 20 | const input = fs.readFileSync(fileName, 'utf8'); 21 | const lines = input.split('\n'); 22 | const result: Line[] = []; 23 | for (const line of lines) { 24 | const [start, end] = line.split(' -> '); 25 | const [x1, y1] = start.split(',').map(Number); 26 | const [x2, y2] = end.split(',').map(Number); 27 | result.push({ start: { x: x1, y: y1 }, end: { x: x2, y: y2 } }); 28 | } 29 | return result; 30 | } 31 | 32 | function part1() { 33 | // read day05input 34 | const lines = readInput('day05input'); 35 | 36 | // for all lines take the start and end points. find max x and y 37 | let maxX = 0; 38 | let maxY = 0; 39 | for (const line of lines) { 40 | maxX = Math.max(maxX, Math.max(line.start.x, line.end.x)); 41 | maxY = Math.max(maxY, Math.max(line.start.y, line.end.y)); 42 | } 43 | 44 | // create 2d array of numbers with maxX and maxY, init with 0 45 | const grid: number[][] = _.range(maxX + 1).map(() => _.range(maxY + 1).map(() => 0)); 46 | 47 | // draw lines on grid for lines where x or y stays constant 48 | // increase grid value when line crosses 49 | // lines can go backwards 50 | for (const line of lines) { 51 | if (line.start.x === line.end.x) { 52 | for (let y = Math.min(line.start.y, line.end.y); y <= Math.max(line.start.y, line.end.y); y++) { 53 | grid[line.start.x][y]++; 54 | } 55 | } else if (line.start.y === line.end.y) { 56 | for (let x = Math.min(line.start.x, line.end.x); x <= Math.max(line.start.x, line.end.x); x++) { 57 | grid[x][line.start.y]++; 58 | } 59 | } 60 | } 61 | 62 | // count number of grid points >= 2 63 | let count = 0; 64 | for (const row of grid) { 65 | for (const value of row) { 66 | if (value >= 2) { 67 | count++; 68 | } 69 | } 70 | } 71 | 72 | // pretty print grid as 2d array in console with . if value is 0 otherwise print the number 73 | console.log('\n'); 74 | for (const row of grid) { 75 | console.log(row.map(value => value === 0 ? '.' : value).join(' ')); 76 | } 77 | 78 | // pretty print result 79 | console.log(`Part 1: ${count}`); 80 | 81 | } 82 | 83 | // function part2 is the same as part1 but also with diagonal lines 84 | function part2() { 85 | // read day05input 86 | const lines = readInput('day05input'); 87 | 88 | // for all lines take the start and end points. find max x and y 89 | let maxX = 0; 90 | let maxY = 0; 91 | for (const line of lines) { 92 | maxX = Math.max(maxX, Math.max(line.start.x, line.end.x)); 93 | maxY = Math.max(maxY, Math.max(line.start.y, line.end.y)); 94 | } 95 | 96 | // create 2d array of numbers with maxX and maxY, init with 0 97 | const grid: number[][] = _.range(maxX + 1).map(() => _.range(maxY + 1).map(() => 0)); 98 | 99 | // draw lines on grid for lines where x or y stays constant 100 | // increase grid value when line crosses 101 | // lines can go backwards 102 | for (const line of lines) { 103 | if (line.start.x === line.end.x) { 104 | for (let y = Math.min(line.start.y, line.end.y); y <= Math.max(line.start.y, line.end.y); y++) { 105 | grid[line.start.x][y]++; 106 | } 107 | } else if (line.start.y === line.end.y) { 108 | for (let x = Math.min(line.start.x, line.end.x); x <= Math.max(line.start.x, line.end.x); x++) { 109 | grid[x][line.start.y]++; 110 | } 111 | } else { 112 | // calculate slope 113 | const slope = (line.end.y - line.start.y) / (line.end.x - line.start.x); 114 | // calculate y intercept 115 | const yIntercept = line.start.y - slope * line.start.x; 116 | // calculate x intercept 117 | const xIntercept = -yIntercept / slope; 118 | // calculate x and y for all points on line 119 | const x = _.range(Math.min(line.start.x, line.end.x), Math.max(line.start.x, line.end.x) + 1); 120 | const y = x.map(x => slope * x + yIntercept); 121 | // increase grid value for all points on line 122 | for (let i = 0; i < x.length; i++) { 123 | grid[x[i]][y[i]]++; 124 | } 125 | } 126 | } 127 | 128 | // count number of grid points >= 2 129 | let count = 0; 130 | for (const row of grid) { 131 | for (const value of row) { 132 | if (value >= 2) { 133 | count++; 134 | } 135 | } 136 | } 137 | 138 | // pretty print grid as 2d array in console with . if value is 0 otherwise print the number 139 | console.log('\n'); 140 | for (const row of grid) { 141 | console.log(row.map(value => value === 0 ? '.' : value).join(' ')); 142 | } 143 | 144 | // pretty print result 145 | console.log(`Part 2: ${count}`); 146 | } 147 | 148 | part2(); 149 | 150 | -------------------------------------------------------------------------------- /yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | "@cspotcode/source-map-consumer@0.8.0": 6 | version "0.8.0" 7 | resolved "https://registry.yarnpkg.com/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz#33bf4b7b39c178821606f669bbc447a6a629786b" 8 | integrity sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg== 9 | 10 | "@cspotcode/source-map-support@0.7.0": 11 | version "0.7.0" 12 | resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz#4789840aa859e46d2f3173727ab707c66bf344f5" 13 | integrity sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA== 14 | dependencies: 15 | "@cspotcode/source-map-consumer" "0.8.0" 16 | 17 | "@tsconfig/node10@^1.0.7": 18 | version "1.0.8" 19 | resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.8.tgz#c1e4e80d6f964fbecb3359c43bd48b40f7cadad9" 20 | integrity sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg== 21 | 22 | "@tsconfig/node12@^1.0.7": 23 | version "1.0.9" 24 | resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.9.tgz#62c1f6dee2ebd9aead80dc3afa56810e58e1a04c" 25 | integrity sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw== 26 | 27 | "@tsconfig/node14@^1.0.0": 28 | version "1.0.1" 29 | resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.1.tgz#95f2d167ffb9b8d2068b0b235302fafd4df711f2" 30 | integrity sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg== 31 | 32 | "@tsconfig/node16@^1.0.2": 33 | version "1.0.2" 34 | resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.2.tgz#423c77877d0569db20e1fc80885ac4118314010e" 35 | integrity sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA== 36 | 37 | "@types/lodash@^4.14.177": 38 | version "4.14.177" 39 | resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.177.tgz#f70c0d19c30fab101cad46b52be60363c43c4578" 40 | integrity sha512-0fDwydE2clKe9MNfvXHBHF9WEahRuj+msTuQqOmAApNORFvhMYZKNGGJdCzuhheVjMps/ti0Ak/iJPACMaevvw== 41 | 42 | "@types/node@^16.11.11": 43 | version "16.11.11" 44 | resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.11.tgz#6ea7342dfb379ea1210835bada87b3c512120234" 45 | integrity sha512-KB0sixD67CeecHC33MYn+eYARkqTheIRNuu97y2XMjR7Wu3XibO1vaY6VBV6O/a89SPI81cEUIYT87UqUWlZNw== 46 | 47 | acorn-walk@^8.1.1: 48 | version "8.2.0" 49 | resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1" 50 | integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA== 51 | 52 | acorn@^8.4.1: 53 | version "8.6.0" 54 | resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.6.0.tgz#e3692ba0eb1a0c83eaa4f37f5fa7368dd7142895" 55 | integrity sha512-U1riIR+lBSNi3IbxtaHOIKdH8sLFv3NYfNv8sg7ZsNhcfl4HF2++BfqqrNAxoCLQW1iiylOj76ecnaUxz+z9yw== 56 | 57 | arg@^4.1.0: 58 | version "4.1.3" 59 | resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" 60 | integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== 61 | 62 | create-require@^1.1.0: 63 | version "1.1.1" 64 | resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" 65 | integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== 66 | 67 | diff@^4.0.1: 68 | version "4.0.2" 69 | resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" 70 | integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== 71 | 72 | lodash-transpose@^0.2.1: 73 | version "0.2.1" 74 | resolved "https://registry.yarnpkg.com/lodash-transpose/-/lodash-transpose-0.2.1.tgz#6cd5538aeb73bb3b0cbe101504b05f08e88c8349" 75 | integrity sha1-bNVTiutzuzsMvhAVBLBfCOiMg0k= 76 | dependencies: 77 | lodash "^4.12.0" 78 | 79 | lodash@^4.12.0, lodash@^4.17.21: 80 | version "4.17.21" 81 | resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" 82 | integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== 83 | 84 | make-error@^1.1.1: 85 | version "1.3.6" 86 | resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" 87 | integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== 88 | 89 | ts-node@^10.4.0: 90 | version "10.4.0" 91 | resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.4.0.tgz#680f88945885f4e6cf450e7f0d6223dd404895f7" 92 | integrity sha512-g0FlPvvCXSIO1JDF6S232P5jPYqBkRL9qly81ZgAOSU7rwI0stphCgd2kLiCrU9DjQCrJMWEqcNSjQL02s6d8A== 93 | dependencies: 94 | "@cspotcode/source-map-support" "0.7.0" 95 | "@tsconfig/node10" "^1.0.7" 96 | "@tsconfig/node12" "^1.0.7" 97 | "@tsconfig/node14" "^1.0.0" 98 | "@tsconfig/node16" "^1.0.2" 99 | acorn "^8.4.1" 100 | acorn-walk "^8.1.1" 101 | arg "^4.1.0" 102 | create-require "^1.1.0" 103 | diff "^4.0.1" 104 | make-error "^1.1.1" 105 | yn "3.1.1" 106 | 107 | typescript@^4.5.2: 108 | version "4.5.2" 109 | resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.2.tgz#8ac1fba9f52256fdb06fb89e4122fa6a346c2998" 110 | integrity sha512-5BlMof9H1yGt0P8/WF+wPNw6GfctgGjXp5hkblpyT+8rkASSmkUKMXrxR0Xg8ThVCi/JnHQiKXeBaEwCeQwMFw== 111 | 112 | yn@3.1.1: 113 | version "3.1.1" 114 | resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" 115 | integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== 116 | -------------------------------------------------------------------------------- /day12.ts: -------------------------------------------------------------------------------- 1 | // import fs and lodash 2 | import * as _ from "lodash"; 3 | import * as fs from "fs"; 4 | 5 | // define type Path as array of strings 6 | type Path = string[]; 7 | 8 | // class Node 9 | // a has a string value 10 | // a node has member isSmall 11 | // a node has a list of neighbors 12 | class Node { 13 | value: string; 14 | isSmall: boolean; 15 | neighbors: Node[]; 16 | 17 | constructor(value: string) { 18 | this.value = value; 19 | // isSmall is true if value is only lowercase and not "start" or "end" 20 | this.isSmall = value.toLowerCase() === value; 21 | this.neighbors = []; 22 | } 23 | 24 | // function getPaths with input 25 | // currentPath: Path 26 | // paths: array of all paths 27 | // function is recursive 28 | // append current node value to currentPath 29 | // if current node is "end", add currentPath to paths and exit 30 | // for each neighbor, call getPaths with a deep copy of currentPath and paths 31 | // don't do this for small neighbors that are already in currentPath 32 | // return paths 33 | getPaths(currentPath: Path, paths: Path[]): Path[] { 34 | // append current node value to currentPath 35 | currentPath.push(this.value); 36 | 37 | // if current node is "end", add currentPath to paths and exit 38 | if (this.value === "end") { 39 | paths.push(currentPath); 40 | return paths; 41 | } 42 | 43 | // for each neighbor, call getPaths with a deep copy of currentPath and paths 44 | // don't do this for small neighbors that are already in currentPath 45 | for (let neighbor of this.neighbors) { 46 | if (neighbor.isSmall && !currentPath.includes(neighbor.value)) { 47 | neighbor.getPaths(currentPath.slice(), paths); 48 | } 49 | // do the same for big neighbors 50 | else if (!neighbor.isSmall) { 51 | neighbor.getPaths(currentPath.slice(), paths); 52 | } 53 | } 54 | 55 | return paths; 56 | } 57 | 58 | // function getPathsDoubleVisit with input 59 | // currentPath: Path 60 | // paths: array of all paths 61 | // doubleVisit: value of node that is allowed to be visited twice 62 | // function is recursive 63 | // append current node value to currentPath 64 | // if current node is "end", add currentPath to paths and exit 65 | // for each big neighbor, call getPaths with a deep copy of currentPath and paths 66 | // for each small neighbor, that is not in currentPath (except for doubleVisit, which is allowed to be at most once in currentPath), call getPaths with a deep copy of currentPath and paths. 67 | // return paths 68 | getPathsDoubleVisit( 69 | currentPath: Path, 70 | paths: Path[], 71 | doubleVisit: string 72 | ): Path[] { 73 | // append current node value to currentPath 74 | currentPath.push(this.value); 75 | 76 | // if current node is "end", add currentPath to paths and exit 77 | if (this.value === "end") { 78 | paths.push(currentPath); 79 | return paths; 80 | } 81 | 82 | // for each big neighbor, call getPaths with a deep copy of currentPath and paths 83 | for (let neighbor of this.neighbors) { 84 | if (!neighbor.isSmall) { 85 | neighbor.getPathsDoubleVisit(currentPath.slice(), paths, doubleVisit); 86 | } 87 | } 88 | 89 | // for each small neighbor, that is not in currentPath (except for doubleVisit, which is allowed to be at most once in currentPath), call getPaths with a deep copy of currentPath and paths. 90 | for (let neighbor of this.neighbors) { 91 | if (neighbor.isSmall) { 92 | // if neighbor is not in currentPath, call getPaths with a deep copy of currentPath and paths 93 | if (!currentPath.includes(neighbor.value)) { 94 | neighbor.getPathsDoubleVisit(currentPath.slice(), paths, doubleVisit); 95 | } 96 | // if neighbor is in currentPath and doubleVisit call getPaths with a deep copy of currentPath and paths and set doubleVisit to "" 97 | else if (neighbor.value === doubleVisit) { 98 | neighbor.getPathsDoubleVisit(currentPath.slice(), paths, ""); 99 | } 100 | } 101 | } 102 | 103 | return paths; 104 | } 105 | } 106 | 107 | // class Graph 108 | // contains a list of nodes 109 | // contains a start and end node 110 | class Graph { 111 | nodes: Node[]; 112 | start: Node | null; 113 | end: Node | null; 114 | 115 | constructor() { 116 | this.nodes = []; 117 | this.start = null; 118 | this.end = null; 119 | } 120 | 121 | // addNode 122 | // add a node to the graph 123 | addNode(value: string): void { 124 | // Only add node if it doesn't already exist 125 | if (!this.getNode(value)) { 126 | // create new node 127 | let node = new Node(value); 128 | this.nodes.push(node); 129 | 130 | // store if start or end 131 | if (value === "start") { 132 | this.start = node; 133 | } else if (value === "end") { 134 | this.end = node; 135 | } 136 | } 137 | } 138 | 139 | // addEdge 140 | // add an edge to the graph 141 | addEdge(from: string, to: string): void { 142 | let fromNode = this.getNode(from); 143 | let toNode = this.getNode(to); 144 | if (fromNode && toNode) { 145 | fromNode.neighbors.push(toNode); 146 | toNode.neighbors.push(fromNode); 147 | } 148 | } 149 | 150 | // getNode 151 | // get a node from the graph 152 | getNode(value: string): Node | undefined { 153 | return _.find(this.nodes, { value: value }); 154 | } 155 | } 156 | 157 | // function reads file describing a graph 158 | // each line contains two nodes separated by a dash 159 | // there are small and big nodes 160 | // two nodes are special nodes "start" and "end" 161 | // parse the file into a graph 162 | function readFile(fileName: string): Graph { 163 | let graph = new Graph(); 164 | let lines = fs.readFileSync(fileName, "utf8").split("\n"); 165 | for (let line of lines) { 166 | let parts = line.split("-"); 167 | graph.addNode(parts[0]); 168 | graph.addNode(parts[1]); 169 | graph.addEdge(parts[0], parts[1]); 170 | } 171 | return graph; 172 | } 173 | 174 | function part1() { 175 | // read file day12sample 176 | let graph = readFile("day12input"); 177 | 178 | // find all paths from start if start exists 179 | let paths = graph.start ? graph.start.getPaths([], []) : []; 180 | 181 | // pretty print paths as dash separated strings and num paths 182 | console.log(_.map(paths, (path) => path.join("-"))); 183 | console.log(paths.length); 184 | } 185 | 186 | function part2() { 187 | // read file day12sample 188 | let graph = readFile("day12input"); 189 | 190 | // get list of all small nodes which are not start and end 191 | let smallNodes = _.filter(graph.nodes, (node) => node.isSmall); 192 | let smallNodesNotStartEnd = _.filter( 193 | smallNodes, 194 | (node) => !["start", "end"].includes(node.value) 195 | ); 196 | 197 | // for each small node, find all paths from start if start exists, use smallNode's value as doubleVisit 198 | // sum up all paths in totalPaths 199 | let totalPaths: any = []; 200 | for (let smallNode of smallNodesNotStartEnd) { 201 | let paths = graph.start 202 | ? graph.start.getPathsDoubleVisit([], [], smallNode.value) 203 | : []; 204 | 205 | totalPaths = totalPaths.concat(paths); 206 | } 207 | 208 | // convert paths to comma separated strings 209 | let paths = _.map(totalPaths, (path) => path.join(",")); 210 | 211 | // remove duplicates 212 | paths = _.uniq(paths); 213 | 214 | // pretty print sum 215 | console.log(paths.length); 216 | } 217 | 218 | part2(); 219 | -------------------------------------------------------------------------------- /day08.ts: -------------------------------------------------------------------------------- 1 | // import lodash and fs 2 | import * as _ from "lodash"; 3 | import * as fs from "fs"; 4 | 5 | // create interface IData with input = array of strings and output = array of strings 6 | interface IData { 7 | input: string[]; 8 | output: string[]; 9 | } 10 | 11 | // create function to read file where each line is like "asdf adg sdfsdfg | asdaf asdasdf asdasdf" 12 | // each line is split by " | " and each part is split by " ", then create an IData for each line, first part is input, second part is output 13 | function readFile(fileName: string): IData[] { 14 | let data: IData[] = []; 15 | let lines: string[] = fs.readFileSync(fileName).toString().split("\n"); 16 | for (let line of lines) { 17 | let parts: string[] = line.split(" | "); 18 | let input: string[] = parts[0].split(" "); 19 | let output: string[] = parts[1].split(" "); 20 | data.push({ 21 | input: input, 22 | output: output, 23 | }); 24 | } 25 | return data; 26 | } 27 | 28 | function part1() { 29 | // read day08input 30 | let data: IData[] = readFile("day08input"); 31 | 32 | // go over all data and count all strings in ouput that have length 2, 3, 4 or 8 33 | let count: number = 0; 34 | for (let d of data) { 35 | for (let s of d.output) { 36 | if ( 37 | s.length === 2 || 38 | s.length === 3 || 39 | s.length === 4 || 40 | s.length === 7 41 | ) { 42 | count++; 43 | } 44 | } 45 | } 46 | 47 | // print result 48 | console.log(count); 49 | } 50 | 51 | // type of letters a to g 52 | type Letters = "a" | "b" | "c" | "d" | "e" | "f" | "g"; 53 | 54 | // create class segments with members a to g, each member is an array of numbers 55 | class Segments { 56 | a: number[]; 57 | b: number[]; 58 | c: number[]; 59 | d: number[]; 60 | e: number[]; 61 | f: number[]; 62 | g: number[]; 63 | 64 | // constructor init all with [] 65 | constructor() { 66 | this.a = []; 67 | this.b = []; 68 | this.c = []; 69 | this.d = []; 70 | this.e = []; 71 | this.f = []; 72 | this.g = []; 73 | } 74 | 75 | // function storeValuesForSegment that pushes the values for the matching segment 76 | storeValuesForSegment(segment: string, values: number[]) { 77 | switch (segment) { 78 | case "a": 79 | this.a = values; 80 | break; 81 | case "b": 82 | this.b = values; 83 | break; 84 | case "c": 85 | this.c = values; 86 | break; 87 | case "d": 88 | this.d = values; 89 | break; 90 | case "e": 91 | this.e = values; 92 | break; 93 | case "f": 94 | this.f = values; 95 | break; 96 | case "g": 97 | this.g = values; 98 | break; 99 | } 100 | } 101 | 102 | replaceOther(values: number[], common: number) { 103 | // find member with values 104 | let member = _.findKey(this, (v) => _.isEqual(v, values)) as Letters; 105 | const other = _.without(this[member], common); 106 | this[member] = other; 107 | } 108 | 109 | deduce(a: Letters, b: Letters, common: number) { 110 | let values = this[a]; 111 | if (values.length > 0) { 112 | this[a] = [common]; 113 | this.replaceOther(values, common); 114 | return a; 115 | } else if (this[b].length > 0) { 116 | let values = this[b]; 117 | this[b] = [common]; 118 | this.replaceOther(values, common); 119 | return b; 120 | } 121 | } 122 | 123 | getKeys(values: number[]) { 124 | let keys = _.keys(this); 125 | let result = _.filter(keys, (k) => _.isEqual(this[k as Letters], values)); 126 | return result; 127 | } 128 | 129 | fillEmptySegment(values: number[]) { 130 | let keys = _.keys(this); 131 | let result = _.filter(keys, (k) => this[k as Letters].length === 0); 132 | for (let k of result) { 133 | this[k as Letters] = values; 134 | } 135 | } 136 | } 137 | 138 | // function that subtracts two strings. E.g. "abcde" - "cb" = "ade" 139 | function subtract(a: string, b: string): string { 140 | let result: string = ""; 141 | for (let i = 0; i < a.length; i++) { 142 | if (b.indexOf(a[i]) === -1) { 143 | result += a[i]; 144 | } 145 | } 146 | return result; 147 | } 148 | 149 | // function that checks if all letters of a string are in another string 150 | function allLettersInString(a: string, b: string): boolean { 151 | for (let i = 0; i < a.length; i++) { 152 | if (b.indexOf(a[i]) === -1) { 153 | return false; 154 | } 155 | } 156 | 157 | return true; 158 | } 159 | 160 | // function that takes an array of strings and returns Segments 161 | function createSegments(input: string[]): Segments { 162 | let segments: Segments = new Segments(); 163 | 164 | // find first string that has length 2 using lodash name it digitOne 165 | let digit1 = _.find(input, (s: string) => s.length === 2) as string; 166 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 167 | // at this point I gave up and coded manually with copilot helping out 168 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 169 | segments[digit1[0] as Letters] = [2, 5]; 170 | segments[digit1[1] as Letters] = [2, 5]; 171 | 172 | const digit7 = _.find(input, (s: string) => s.length === 3) as string; 173 | let diff = subtract(digit7, digit1); 174 | // let segment0 = diff; 175 | segments[diff as Letters] = [0]; 176 | 177 | // find first string that has length 4 using lodash name it digit4 178 | let digit4 = _.find(input, (s: string) => s.length === 4) as string; 179 | diff = subtract(digit4, digit1); 180 | 181 | segments[diff[0] as Letters] = [1, 3]; 182 | segments[diff[1] as Letters] = [1, 3]; 183 | 184 | // console.log("after digit 4", segments); 185 | 186 | // find first string that has length 5 containing all letters of digit7 using lodash name it digit3 187 | let digit3 = _.find(input, (s: string) => { 188 | return s.length === 5 && allLettersInString(digit7, s); 189 | }) as string; 190 | diff = subtract(digit3, digit7); // this gets us segments 3 or 6 191 | 192 | const match = segments.deduce(diff[0] as Letters, diff[1] as Letters, 3); 193 | if (match === diff[0]) { 194 | segments[diff[1] as Letters] = [6]; 195 | } else { 196 | segments[diff[0] as Letters] = [6]; 197 | } 198 | 199 | // console.log("after digit 3", segments); 200 | 201 | let keys0 = segments.getKeys([0]); 202 | let keys1 = segments.getKeys([1]); 203 | let keys3 = segments.getKeys([3]); 204 | let keys6 = segments.getKeys([6]); 205 | let keys25 = segments.getKeys([2, 5]); 206 | let digit5 = _.find(input, (s: string) => { 207 | return ( 208 | s.length === 5 && 209 | s.includes(keys0[0]) && 210 | s.includes(keys1[0]) && 211 | s.includes(keys3[0]) && 212 | s.includes(keys6[0]) && 213 | (s.includes(keys25[0]) || s.includes(keys25[1])) 214 | ); 215 | }) as string; 216 | 217 | // console.log("digit 5", digit5); 218 | 219 | if (digit5.includes(keys25[0])) { 220 | segments[keys25[0] as Letters] = [5]; 221 | segments.replaceOther([2, 5], 5); 222 | } else { 223 | segments[keys25[1] as Letters] = [5]; 224 | segments.replaceOther([2, 5], 5); 225 | } 226 | 227 | // console.log("after digit 5", segments); 228 | 229 | segments.fillEmptySegment([4]); 230 | 231 | // console.log(segments); 232 | 233 | return segments; 234 | } 235 | 236 | const mapping = [ 237 | [2, 5], 238 | [0, 2, 3, 4, 6], 239 | [0, 2, 3, 5, 6], 240 | [1, 2, 3, 5], 241 | [0, 1, 3, 5, 6], 242 | [0, 1, 3, 4, 5, 6], 243 | [0, 2, 5], 244 | [0, 1, 2, 3, 4, 5, 6], 245 | [0, 1, 2, 3, 5, 6], 246 | ]; 247 | 248 | function getDigitForInput(segments: Segments, input: string): number { 249 | //split input into array of strings 250 | let inputArray = input.split(""); 251 | // for each string in the array get matching segment and merge result into number array 252 | let result = inputArray.map((s) => { 253 | let segment = segments[s as Letters]; 254 | return segment; 255 | }); 256 | 257 | // flatten array of arrays 258 | let resultArray = _.flatten(result); 259 | 260 | // find index of entry in mapping that matches resultArray 261 | let index = _.findIndex(mapping, (m) => _.isEqual(m, resultArray.sort())); 262 | return index + 1; 263 | } 264 | 265 | function part2() { 266 | // read day08input 267 | let data: IData[] = readFile("day08input"); 268 | 269 | let total = 0; 270 | for (let d of data) { 271 | const segments = createSegments(d.input); 272 | // iterate over output and print digit for each string 273 | let num = 0; 274 | for (let i = 0; i < d.output.length; i++) { 275 | num = num * 10 + getDigitForInput(segments, d.output[i]); 276 | } 277 | // console.log(num); 278 | total += num; 279 | } 280 | 281 | console.log(total); 282 | } 283 | 284 | part2(); 285 | -------------------------------------------------------------------------------- /day10input: -------------------------------------------------------------------------------- 1 | ({[[{{({<<<<(<{}()><()[]>)[([]{}){<>[]}]><[{<>()}{<><>}]<(()[])([]<>)>>>){<([(())<()<>>][{{}{}}[(){ 2 | ({{<{<<(([({<[[]()]<()<>>>{(()())(<>())}}[{[(){}]}(<{}[]>[<>])])<[[[{}()](<>{})]]<<{{}()}[<>]>[({})[{}()]]>> 3 | <[<{{<<{[{{([(())<{}{}>][{<><>}(<><>)])}}]((<(<{[]<>}>(<()()>[[]()]))>))}([(<<({[]()})>(({[][]}([]{})){(()() 4 | ({<{{{{<<{([{[<>()][<>()]}[((){})([]())]])[[<[()()]<()<>>>[{<>()}{(){}}]][[{<>{}}[{}[]]][([]())[{}() 5 | [((<[[{<[<{[<[<>[]]<(){}>><(()[])(()())>]((<<>{}>[<><>]){[()<>]{{}<>}})}>]<<[<[<()()>](({}{})( 6 | [{{([([[<([[<[()()][()<>]>][<<{}{}>[<>{}]>(((){}){[][]})]][<[<()()><{}()>](<<><>><[]{}>)><<<<>()><{}<>>>(([]( 7 | <{[{(<{<[[{{{[[]{}]<{}<>>>{{{}()}<[]<>>}}([(()[])]{[{}<>][<>()]})}((<(<>{})<<>[]>>[[{}[]][{}{}]]) 8 | [<[<(<{[<([({(<>())[{}()]}[[<><>]])]){<{(((){})[{}<>])<<<>[]>(()[])>}(<([]{})<<>[]>><[{}<>][{}()]>)><<({( 9 | (([{[<[{{[<[{{{}{}}<[]{}>}[[{}{}]{(){}}]][(<{}()>([][])){<<><>>({}[])}]>[(<(<>{})<<>{}>><{(){}}[ 10 | <<[{[{[(<(<({{[]{}}[<>]])[{{[]{}}{[]()}}(<<>{}>[<>{}])]>{{(<{}[]>[{}[]])<{[]{}}<[]<>>>}{<{{}[]}([]( 11 | ({<<<[[({(<{{<{}()><()<>>}[{[]{}}<[]<>>]}>[<({<>{}}[[]<>])(<(){}>{[]<>})>[[(()()}(<>[])][(<><>)<{} 12 | [(<[{[[(<{({<[[]<>]><<()[]>[{}()]>}([{<>}<[]<>>]({{}()}<{}{}>])){({(()[])([][])}<<{}{}>({}{}) 13 | {(<<<(([[((<(<()<>>{(){}}){{{}[]}{{}()}}><(({}){<>()})<((){})({}())>>))][[{[<[<>[]]{(){}}>]( 14 | {[<((<[[[<<[[<{}<>>{[]()}]<[{}<>][[]{}]>]{<<{}>[()[]]>{[<><>][<>]}}>{{{{{}()}}[{[]<>}<<><>>]}}>]< 15 | ([(<[[<({{[([{[]()}{<>()}]{[()<>]<<>{}>})({{()()]([]<>)})]{<((<>())[[][]])[[()<>][<>[]]]>}}}{{[[(<<><>> 16 | <({{({<([[({<{[][]}[{}[]]>}([(<>[])((){})]([[]<>]([]{}))))}({{<<[][]>[()()]>[<()[]>{<>{}}]}[{[{}{}] 17 | <<<[<<(<(<{{[[()()]{[][]>]<<[]()><[]<>>>}[{(<>()){<><>}}[<()<>>[[]<>]]]}>{(<(<<>>[<><>])([ 18 | [[{({[<{(([<<[<>()](<><>)>{({}<>)(()[])}>{(({}<>){{}<>})}]([<[()[]]>><[(<>[])[<>()]]>)))[{{(({ 19 | [<[<[{{[{{(([{()[]}{<><>}]<[{}()]({}{})>)([{()<>}{[][]}]({<><>}([]<>))))<<{<{}{}]}<(<>())([] 20 | ([(<{<{([<[((<()<>>{[][]}))([<<><>><[]{}>]({()[]}(<>())))]([<[[]<>](())><[(){}]{()[]}>]{[[[] 21 | [{[{({{[[(([[<{}()]{{}{}}]]){([([][])([]<>)]<[()<>](<>())>){[<(){}>[<>()]]{[{}<>][{}<>]}}})(<[<{()()}([]<>) 22 | (({<[<[<{({[(<[]<>>{(){}})[<[][]>([]{})]]{<<<>{}>(()<>)>[[()[]]}}})}{<<<((()<>)[{}{}]){<<>{}>[<>()]}><< 23 | <[{[<[([[{{<{(<><>)[{}[]]}<<<>{}><{}()>>>}}{<<(({}[])([]{})}{(<>{}){[]<>}}>((([]<>)<{}()>){{{}<>}})><<<< 24 | [<[([[{({(<<<(<>())>(([]())[<>{}])><<<[]()>[()<>]><(<>){<>{}>>>><({[[]{}]<{}[]>}([<>{}][{}<> 25 | {(<[<<(<[({(({[]()}<[]{}>)({[]<>}{<><>})){<(()[]){[][]}>([()]<<>()>)}}{{((<>())[()]){[{}<>]<<> 26 | (<{{<(({{{<[[([]()>]<{<>()}[{}{}]>]>[([[()<>](<>())][{<>{}}<[][]>])<[<()[]>]({()[]}[[]()])>]}}}))>[[< 27 | ((({{<[{[((<(<[][]>([]())){[()<>][{}{}]}>){<{{<><>}<<><>>}<([]<>)>>{([{}()][()[]])}})<[<{{<>}[[][]]}[[()[]] 28 | ([<((<(<{<{{[<[]<>>{(){}}](<{}[]>(()[]))}}>}>)<{([{<<{()()}{()[]}>[{{}()}({}[])]><[[{}[]](<>())]{[()( 29 | <<[<<(({({((([[][]]<[]{}>)<({}<>){()()}>)[<[{}<>][[]()]>{<[]()><<>>}])})}{(([[[<[][]><[]{}>](<{}[]>{ 30 | <<[(<<(((<([[{()()}<(){}>]({()<>}[()<>])][{((){})(<><>)}{<<>[]>({}{})}]){(<{()[]}[<>()]>)<({<><>}){[ 31 | {(<[{([<(<[(({<>()})<[{}<>]{()<>}>)(([<>()]{[][]}))]{[<{[]{}}>[(()<>)])(<({}{})><[{}<>]{<><>}>) 32 | {((<{[<{{[[{(<<>[]>{{}[]})}{[({}<>)[<>[]]]}]]<[[[[()]{{}<>)]{({}()){[][]}}]<[{<><>}<[][]>]((<> 33 | {(<({[<<<(<<{[{}{}]}([[]()]({}[]))>(({<>()}<[]>)<{{}()}{{}{}}>}>)(<{{[()[]]{()}}(<<>()>{[]<>})}>)>[([[<{< 34 | (<<[<<[(([[{({()}[<>[]])}][<(<[][]>{(){}})>(<<{}{}>{{}[]}>[({}<>)<<>[]>])]]))]((({[{{<[]{}>{{}()}}[([][])({}< 35 | (({{<({<{{(<<{<>{}}{()[]}><[(){}][()[]]>><[<<>[]>{{}}](<()[]>{[]{}})>)}<{<([()<>]{<>{}})[([ 36 | (<<[<{<{{<(({({}())([]{})}<({}())>)[[({}{})[<>()]]]>{{<{{}{}}<{}()>>(({}{})[{}{}])}}>({({<< 37 | [[{([{<<<{<({[()[]][{}()]})>[{[({}{})[()()]](<<>()><<>[]>)}<(<<><>><[]{}>)<(<><>)<[]()>>>]}>>>}])}({(<<[[ 38 | (<{(<<({[[{({{{}{}}[<>()>}[[<><>]])}]<{(<{()<>}{[]()}>[([][])[{}[]]])<[[<>][(){}]]{<[][]>([]{})}>}[((<<><> 39 | <(({[(<<[<[[{{()()}(<>())}(<[][]><<><>>)]][[(<[]>[<>[]])([[]{}]{<>()})]{{[[]{}](<>[])}({()()}([]()))}]>]({({ 40 | <<([<(((<{{[(<<>()>(()[])){{[]<>}<[]{}>}]<{[<>()][(){}]}>}<<[<{}<>>]>{([<><>]{<><>}){{{}[] 41 | (([{[[[<{[{[[[()()]<()>]<[{}{}][(){}]>]}]}{[<{{[()<>][()[]]}}[{{()()}}[[<>[]][{}()]]])<<({<>()}<{}()>)>({([ 42 | {[(<{{({[{{[{([]>({}<>)}<<{}[]>>][[{(){}}[<><>]]{<(){}>({}())}]}}[{([({}()){()[]}]{({})<[]<>>})[[[[]<>]]([<> 43 | (([{[({{<([[([[]{}]<()[]>)(<<>>[<>[]])]{[{()()}<{}{}>](<{}()>([]{})>}])<[<{{<>{}}}<[<>[]]>>{[{[] 44 | {({<<({<<<<{(([]()))(<<>()>)}({<()<>>{{}{}}})>[{[(<>)]{<[][]>[{}()]}}]>({[[[{}[]]({}[])]]})>>{{ 45 | [(<[<((<[(([((<><>)([]{})){([][])[()()]}]<{{{}{}}{(){}}}>)<{{({}{})<()>}({()()}[[]{}])}<[[<>()]{()<>}>({<>} 46 | <{{[(({{<((<({[]{}}(()()))[[{}{}]{{}<>}]>[([<>[]>(()<>))]))[[([{<><>}<<>[]>][[()<>]([][])]){<((){}){{}[ 47 | ((<[({<<({{[<[(){}](<><>)>[{[][]}[{}[]]]]}<([(<><>){[]{}}])([[()()]<()[]>])>}(([[[[]()]{{}{}}]{[{}<>]{() 48 | (({{[<<<[[{<<[<><>]<{}<>>>[<<>()>(<>{})]>}<{(<()()><{}()>)<([]())[<>{}]>}>]]<<{([(<>{})[<>()]]{{[]()}{()( 49 | <[{{{<<<[{[{<[()[]]({}[])>}[{({}{}){<>[]}}{<<>[]>[{}[]]}]]<[<({}{})>(([]())<{}{}>)]{([{}[]]([]<>) 50 | {<<<[[(([{{[[(()<>)<()()>]][[{{}[]}[()()]]]}<<{[{}()]<{}[]>}[{()[]}<[]<>>]>>}]))][{(<[(<[<<><>>(()())]<({}{ 51 | (<<<{{(<{[[[[(()())<<>[]>]<[[][]]>]((<{}<>><[][]>)[([]())[()()]])]([(<{}>(()[]))<([]()){[]{}}>]))}>)}({ 52 | ({<(({{{<{{[{<()<>>[<>[]]}([[]()][()()])]{([()<>]({}())){{{}()>{[]<>}}}}}>}<[{[<[<{}()>[{}{}]]<<()()><()( 53 | <[{<<<([{<[{{<[][]><[]{}>}{[{}]{{}}}}<<{()[]}([]{})>([{}[])(()()))>][<[{[][]}{(){}}]{[()[] 54 | {<[{{[<([[[[<{()[]}[<>()]>{<<>[]>{{}()}}]<({[]{}}{()<>}){{()[]}(<>{})}>]({[<()[]]([]{})][<<>()>(<><>)]}<< 55 | ({{[(([<[<[[{(()[])}{(()[])[()()]}]{[(<><>){<>{}}]<<[]<>><<><>>>}]>]<[(([<<>[]>]))]<((<{{}{}}{(){}}> 56 | ({[[(({[[<(<({<>{}})[([]<>)([]{})]>[<([][])<{}{}>>(<()()>)]){<[[<>()]{[]{}}]({{}{}}([]()))>}>]]}<{<{ 57 | [[{([<({[[[<<<[]{}>({}())>([{}<>][<><>])>{<(()<>)<<><>>>{[<>{}]{[]{}}}}]{{((()[]))[({}[])<[]{}>]}[({<>{} 58 | ([[(([<[<([(<(<>()){{}{}>><<<>[]>[{}<>]>)<(<[]()>[()[]])>])>(<{([{[][]}<<>()>]<[<>[]]>)(<<{ 59 | ([{({<<<<[[({[[]<>]({}<>)}[({}[])(<>{})])][<{((){}){[]()}}<[{}[]]<[]{}>>>(<<()[]><{}<>>]{[<><>][{}<>]} 60 | <<<<{{({<{{[([<>()][[][]]){{[]{}}<{}()>}][(<[]{}>[{}<>]>[{<>[]}((){})]]}}(<<<{[]{}}{{}}><([]{})({}<>)>>({(( 61 | [[<<{<{<(<{({{{}[]}}((<>)(<>[]))){{{[]()}<()()>}[{<>()}<[]{}>]}}{[{({}{})<{}[]>}({<>[]}{[]<>})]{([{} 62 | {{{[{[([[{{[{<{}>({}<>)}[([][]){<><>}]]([{{}[]}])}[<[[[]()]]{[[]{}]}>{<{<>()}>}]}]{[{[[[<>{}]{[]}](( 63 | (<[[<<<({[[{{[<>[]]<(){}>}}<({<><>}{<>{}}){((){})([]<>)}>](<[[{}[]][[]]][{{}<>}[{}{}}]>((([][])[()()]){<() 64 | {([((<{{{[[<<{()()}<[])>[{<>()}<()()>]>]((<[{}<>]<{}()>>{{{}<>}(()())}){{<()[]>(<><>)}{[[]()](<>())}})]} 65 | {{<<<<({[<{<([{}<>]([][]))<<{}[]>([]{})>><[{<>()}{[]()}](<(){}><[]()>)>}<[<<[][]>({}())>(<[] 66 | {[<[[((<({<<[<{}<>><{}()>]><<<{}<>>{<>}>{{{}[]){()<>}}>>([[{[][]}(()[])](({}[]){{}{}})])}<<({(<> 67 | [[[<([[([<[{[{()[]}{{}[]}][(()()){[]{}}]}{{{<><>}{[][]}}{<{}<>]({}())}}]>[[<[{()<>}<{}{}>]<{[]()}({}<>)>>{<< 68 | ({[{<[[[([[((({}<>)((){})){({}{}){{}()}})[[(()())<{}[]>]]>[[[<{}()>]<[[]]<()[]>>][<(()<>){[]()} 69 | [[<[{[<<<<{{({[]<>}({}[]))[<<><>>([]{})]}[<{<><>}<[]{}>><([]())[()<>]>]}<([{<><>}<()()>]<[(){}]({})> 70 | [{(<<{{((({[<{<>[]}>](<[[]]({}[])>(<{}{}>{()()}))}<([({}<>)<{}()>]({[][]}({}())))>)<{{((<><> 71 | {{((<(<[[<<(<([]()){()<>}><[()()]{[]{}}>)[[({}{})({}{})]<<{}{}><[][]>>]>[(<(())[<>[]]>)<<[<>() 72 | [{([({<<{<<[{<[]>({}{})}((<>[])<<><>>)][<([])><{[]<>}<[]{}>>]><{({<>()}<<>[]>)}>>(([[({}{})[()[]]] 73 | <{([({{{{(([{<[]()>(<>())}{{{}{}}{{}()}}]<{<{}()>[()<>]}({()[]}{<><>})>)<((<<>()>{<>{}}))({([]<>)[{}{}]}<([] 74 | <{<[(<<({<(([(<><>)([]())]){{<<>()>}(<{}{}>{<>[]})})[{[{()<>}[<>[]]]([()()]{{}})}{([<>()]<[]()>)<[<>[]]{{}() 75 | <{<{[[({<[[([[{}<>][{}<>]][(<>[]){()[]}])<([()[]])[<()<>>[{}()]]>}{[{[{}[]]<[]<>>}[(<>[])<()()>]]([< 76 | [<{(<{<(([{[<<()()><()[]>>{({}{})<[][]>}]<(<(){}>)>}[<<<[]()>>[({}<>)([]())>><<((){}){<><> 77 | [[[(((<({[([[<<>()>]{(<><>)<[]<>>}]([<[]()>{()()}]{[{}()]{<>}}))[[([<><>](<>[]))({<>()})]]](<(([[] 78 | <{({(([{<[(<{{[]()}}>({[{}{}]{[]{}}}[{()}(<>{})>))]<(([[()][[][]]])<<<{}<>><(){}>>>)({<(<>{})>(([]())({}<>)) 79 | <([([[[<([(<(([]<>)){[[]()][()]}>{[{<>()}([]{})]{([]<>)({}[])>})]<[<({(){}}(()<>)){{{}()}<[]{}>}><[[<>{}] 80 | ([(<[({<<(<{{(()<>)<(){}>}{<{}{}>}}>[<<(<>())<{}[]>><[<>()][<><>]>><<([]{}){[]()}>>])<[<{<[]()>[[]{}]}{([])<( 81 | (<<{[<[(<(<<[<(){}>[[]{}]][({}())<[]{}>]>>{[<(<>())<{}()>>][<{{}<>}<[][]>><[<>()](()())>]}]>{({[<<[]() 82 | [([<<<([<<[{{<()()><{}()>}{<[]{}>}}]{[{[[]()]}]({<(){}>(()[])})}>(<{{<<>{}>{()()}}<(()[])[[]()]>}(<<(){}>{ 83 | <(<([((<((({(((){})]{{{}}<{}>}}<<(()())({}())>((<>[])([]()))>)){{[<((){})<<><>>>]}})><<[<[({[]{}}(<><>)){(< 84 | <{[<[[({<[<<{(<>[])[()[]]}{<<>>(()[])}><[{(){}}[<>()]][{[][]}(()<>)]>>{<<(<>[])[[]()]>{{<>()}<{} 85 | <<({[({{[([{[<[]><<>[]>]}<{{{}[]][()<>]}{{()[]}[{}<>]}>])]}<<{([{(<>[]){{}<>}}]([[<>()][()<>]]))({(<{ 86 | (<{{{[[([<[{{{[]<>}[()<>]}<<<>()>>}[((()[]){()[]})]]>{{([([][])])<([<><>]{()<>})(<<>{}><<>{}>)>}{<<<[] 87 | [[([<([[<[<{({()<>}{[]{}}){[{}[]][<>[]]}}>]>]{{({(([{}[]]({}{})){[<>{}]{{}<>}})<((<>()))[{[]{}}]>}(((( 88 | ({[<<[[[{{{[<<[]>([]<>)>(([]<>)<[]{}>)][<<{}[]>({}{})>]}([[<{}{}>[()[]]]((()<>)[<>[]])]{([()<>]{[][]}){{<>< 89 | {<[{({[<({({[{{}[]}[[]{}]]({{}{}}([]()))}[(<()<>>{[]{}}){<[]{}>[()]}])}<({<{[]()}({}[])>[(()){<>()}]} 90 | [([{{(([[{<[{(()())[{}[]]}<<<>><{}[]>>]{[{[]()}[[]<>]](<{}{}>[()()})}>}[([(<{}<>><{}<>>)(<<>{}>([]{}))]({([]{ 91 | -------------------------------------------------------------------------------- /day04.js: -------------------------------------------------------------------------------- 1 | // import lodash and lodash-transpose 2 | var _ = require("lodash"); 3 | var transpose = require("lodash-transpose"); 4 | 5 | // function that reads file 6 | // first line is a comma separated list of numbers 7 | // then follows a list of 5 x 5 matrices separated by a newline 8 | // between each matrix is ane empty line 9 | // each matrix element is separated by a space 10 | function readFile(fileName) { 11 | var fs = require("fs"); 12 | var file = fs.readFileSync(fileName, "utf8"); 13 | var lines = file.split("\n"); 14 | var numbers = lines[0].split(","); 15 | 16 | // convert numbers to numbers 17 | for (let i = 0; i < numbers.length; i++) { 18 | numbers[i] = Number(numbers[i]); 19 | } 20 | 21 | // remove first line from input, name result matrixInput 22 | var matrixInput = _.drop(lines); 23 | 24 | // remove empty strings from matrixInput 25 | matrixInput = _.filter(matrixInput, function (line) { 26 | return line !== ""; 27 | }); 28 | 29 | // split matrix input into array of 5 lines 30 | matrixInput = _.chunk(matrixInput, 5); 31 | 32 | // convert each line in a matrix to numbers separated by one or more spaces 33 | matrixInput = _.map(matrixInput, function (line) { 34 | return _.map(line, function (element) { 35 | let a = _.split(element, /\s+/); 36 | // remove empty strings from a 37 | a = _.filter(a, function (element) { 38 | return element !== ""; 39 | }); 40 | 41 | // convert each element in a to a number and return 42 | return _.map(a, function (element) { 43 | return parseInt(element); 44 | }); 45 | }); 46 | }); 47 | 48 | // return numbers and matrixInput, rename matrixInput to matrices 49 | return { 50 | numbers: numbers, 51 | matrices: matrixInput, 52 | }; 53 | } 54 | 55 | function calculateScore(matrix, sheet, winningNumber) { 56 | // sum is 0 57 | let sum = 0; 58 | 59 | // matrix is a two dimensional array 60 | // iterate over all elements of matrix 61 | for (let j = 0; j < matrix.length; j++) { 62 | for (let k = 0; k < matrix[j].length; k++) { 63 | // take element at index j in line k of sheet 64 | let element = sheet[j][k]; 65 | // if element is false then sum is incremented by entry at index j in line k of matrix 66 | if (element === false) { 67 | sum += matrix[j][k]; 68 | } 69 | } 70 | } 71 | 72 | // multiply sum by winningNumber and return 73 | return sum * winningNumber; 74 | } 75 | 76 | function part1() { 77 | // read file day04sample 78 | var data = readFile("day04input"); 79 | 80 | // copy matrices to new data structure names sheets where each element can be marked with a boolean 81 | let sheets = _.map(data.matrices, function (matrix) { 82 | return _.map(matrix, function (line) { 83 | return _.map(line, function (element) { 84 | return false; 85 | }); 86 | }); 87 | }); 88 | 89 | // variable winningMatrix is set to null 90 | let winningMatrix = null; 91 | 92 | // variable winningNumber and winningIndex are set to 0 93 | let winningNumber = 0; 94 | let winningIndex = 0; 95 | 96 | // iterate over data.numbers using a for loop, stop if winningMatrix is not null 97 | for (let i = 0; i < data.numbers.length && winningMatrix === null; i++) { 98 | // take number at index i from data.numbers 99 | let number = data.numbers[i]; 100 | 101 | // iterate over all data.matrices 102 | // for each matrix, iterate over all lines 103 | for (let j = 0; j < data.matrices.length; j++) { 104 | // for each line, iterate over all elements 105 | for (let k = 0; k < data.matrices[j].length; k++) { 106 | for (let l = 0; l < data.matrices[j][k].length; l++) { 107 | // if element at index l in line k in matrix j is equal to number 108 | if (data.matrices[j][k][l] === number) { 109 | // mark element at index l in line k in matrix j as true 110 | sheets[j][k][l] = true; 111 | } 112 | } 113 | } 114 | } 115 | 116 | // iterate over all sheets 117 | for (let j = 0; j < sheets.length; j++) { 118 | // take sheet 119 | let sheet = sheets[j]; 120 | 121 | // if any row of sheet is completely marked with true then winningMatrix is set to matrix from data.matrices at index j 122 | if ( 123 | _.some(sheet, function (line) { 124 | return _.every(line, function (element) { 125 | return element === true; 126 | }); 127 | }) 128 | ) { 129 | winningMatrix = data.matrices[j]; 130 | // store winning number and index 131 | winningNumber = number; 132 | winningIndex = j; 133 | } 134 | 135 | // sheet columns are transposed 136 | // if any column is compleetly marked with true then winningMatrix is set to matrix from data.matrices at index j 137 | if ( 138 | _.some(transpose.transpose(sheet), function (line) { 139 | return _.every(line, function (element) { 140 | return element === true; 141 | }); 142 | }) 143 | ) { 144 | winningMatrix = data.matrices[j]; 145 | // store winning number and index 146 | winningNumber = number; 147 | winningIndex = j; 148 | } 149 | } 150 | } 151 | 152 | // take winningSheet with winningIndex from sheets 153 | let winningSheet = sheets[winningIndex]; 154 | 155 | // calculate and print score for winningMatrix and winningSheet 156 | console.log(calculateScore(winningMatrix, winningSheet, winningNumber)); 157 | } 158 | 159 | function part2() { 160 | // read file day04sample 161 | var data = readFile("day04input"); 162 | 163 | // copy matrices to new data structure names sheets where each element can be marked with a boolean 164 | let sheets = _.map(data.matrices, function (matrix) { 165 | return _.map(matrix, function (line) { 166 | return _.map(line, function (element) { 167 | return false; 168 | }); 169 | }); 170 | }); 171 | 172 | // initialize winner array same length as data.matrices with false 173 | let winners = _.map(data.matrices, function () { 174 | return false; 175 | }); 176 | 177 | // init lastWinner as -1 178 | let lastWinner = -1; 179 | 180 | // init winningNumber 181 | let winningNumber = 0; 182 | 183 | // iterate over data.numbers using a for loop, stop if winningMatrix is not null 184 | for (let i = 0; i < data.numbers.length; i++) { 185 | // take number at index i from data.numbers 186 | let number = data.numbers[i]; 187 | 188 | // iterate over all data.matrices 189 | // for each matrix, iterate over all lines 190 | for (let j = 0; j < data.matrices.length; j++) { 191 | // for each line, iterate over all elements 192 | for (let k = 0; k < data.matrices[j].length; k++) { 193 | for (let l = 0; l < data.matrices[j][k].length; l++) { 194 | // if element at index l in line k in matrix j is equal to number 195 | if (data.matrices[j][k][l] === number) { 196 | // mark element at index l in line k in matrix j as true 197 | sheets[j][k][l] = true; 198 | } 199 | } 200 | } 201 | } 202 | 203 | // iterate over all sheets 204 | for (let j = 0; j < sheets.length; j++) { 205 | // take sheet 206 | let sheet = sheets[j]; 207 | 208 | // if any row of sheet is completely marked with true then winningMatrix is set to matrix from data.matrices at index j 209 | if ( 210 | _.some(sheet, function (line) { 211 | return _.every(line, function (element) { 212 | return element === true; 213 | }); 214 | }) 215 | ) { 216 | // if j not already a winner mark winner at index j as true and store as lastWinner, winingNumber 217 | if (winners[j] === false) { 218 | winners[j] = true; 219 | lastWinner = j; 220 | winningNumber = number; 221 | } 222 | } 223 | 224 | // sheet columns are transposed 225 | // if any column is compleetly marked with true then winningMatrix is set to matrix from data.matrices at index j 226 | if ( 227 | _.some(transpose.transpose(sheet), function (line) { 228 | return _.every(line, function (element) { 229 | return element === true; 230 | }); 231 | }) 232 | ) { 233 | // if j not already a winner mark winner at index j as true and store as lastWinner, winingNumber 234 | if (winners[j] === false) { 235 | winners[j] = true; 236 | lastWinner = j; 237 | winningNumber = number; 238 | } 239 | } 240 | } 241 | 242 | // count number of winners, if all have won, exit loop 243 | let count = _.countBy(winners, function (element) { 244 | return element; 245 | })["true"]; 246 | if (count === data.matrices.length) { 247 | break; 248 | } 249 | } 250 | 251 | // winningMatrix is matrix at index lastWinner from data.matrices, winningSheet is sheet at index lastWinner from sheets 252 | let winningMatrix = data.matrices[lastWinner]; 253 | let winningSheet = sheets[lastWinner]; 254 | 255 | // print lastWinner, winninMatrix, winningSheet, winningNumber 256 | console.log( 257 | lastWinner, 258 | winningMatrix, 259 | winningSheet, 260 | winningNumber, 261 | calculateScore(winningMatrix, winningSheet, winningNumber) 262 | ); 263 | 264 | // calculate and print score for winningMatrix and winningSheet 265 | console.log(calculateScore(winningMatrix, winningSheet, winningNumber)); 266 | } 267 | 268 | part2(); 269 | -------------------------------------------------------------------------------- /day09input: -------------------------------------------------------------------------------- 1 | 9656799999432123456997667932987634348988901234569972123973212398999898743234578999878965345989412345 2 | 8746789898543235689879457891396521236567892347698763299865101987898789652123459998767893239874323458 3 | 7657896797654348798968346799987430123456943458987654987654219876747688943435698967656789098765434567 4 | 8767945698967859987653235678976521234567894569998785698765345965434567894566987654345678999886548698 5 | 9878936989898967998842123799988432345678965679989976789876459876123998999879876543234567999998657789 6 | 9989759876789899987651012989999654676789896899877899893987898765017899997989977532123456789879767899 7 | 9899898765698789998763123467898765699998789998766568932998989854146789876598765431012345678969878989 8 | 9787987974545698999873234578989876987899678987653456949899876543235678995439876532123478989654989678 9 | 7656896653432367897654348989678989876996589978321239898787987665366789989321987543234569996543294569 10 | 6542985432101256789865457892569998765989439865430149764656798878457899878910197655345699965432123468 11 | 7699876543232345699978767893478998654879921996521398943245679987678978567891298876758789899543234589 12 | 9989989854345467789989898976569999743467892987432987852134789998789765456789469987899898798954387678 13 | 8978998765676778990195999989678987654568909876549896721012878979999879345899878998963934567895698789 14 | 7867999876789989321234989999889998987678912987898765432124568965345998976901989029652123458986789899 15 | 6756889987899995435345678901999989598789329898969976543234567891299987899893499198743239567899899989 16 | 5345678998969876568856789899539976439899498789458987654545678910988956789789598999874358678989999878 17 | 3245588999654987678767898788998765323978987672387898765677989899877545695679987898765456789679878567 18 | 2133457899865698789898987657897654312369876521256789898788996789765421234989996799976768994598765456 19 | 1012345678976789897979998546789762101459985432345698969899345678973210199898765689989879323987654345 20 | 2123456789998899976567899434998979299998976543456987654901236789894391985795454767898989212398943234 21 | 3234567896789999875478996524567898987897897654567898783212345898765989674889323656987898901999892123 22 | 4365788945678998983239987678978987645656789765799969999476556969879876563479312345896567899898789012 23 | 5458899656789987899945699899989996534345679879893459878987768956989995412458923456789456998787678923 24 | 6867898767999876767896789954399897621236989997992398768998878945999989325567894567992368987654589434 25 | 9878939878999765456789899876998765432347895456789987657899999656789878934678985688954979998543678945 26 | 8989921989998754345678912999879876749456954397990198845679998769898969895989876999769899876452345796 27 | 7797890999989643234678993987764989898987895989891987932348999878987658789999987894998789985321234589 28 | 6646789899878932123456789896653299987898939876799876541256896989876545678999898923987679876542345678 29 | 5437898768967893236589898765432129876999329865789987652367955798767534567898769219876565987643456789 30 | 6545698657657789345679989654321098765695409784679898783458944987654323456789954329765434598754767893 31 | 8656798743245678956799878979434998654989598643566799854769432198765412577899895498979123799865698912 32 | 9778999894657889767898767898749876543878969432345689965878945987654323989976789987898945678977899101 33 | 9889899985769999878987656797657998652569654321298999876989656798768734896565699876787896789988956912 34 | 3998769876778954989898545679769876543478998910187892987998969989899656789454598765576997895699349893 35 | 2987645987889643498765434568978997655599987651456891098987898778949767895323459874445689934569298789 36 | 1985432398995721239897655678989999876789299732345993129986889654339878944413569763234796545678997689 37 | 9876543569954310398989767899199896989892196545456789298765678943210989432102698752125689698789976567 38 | 0987654567899451987679878954398765496989987656769899987654567894321296563213987643014578999898965456 39 | 1398875698998969876556989995459654345678998767898999874323476989432987674345987532123567899987894345 40 | 2989976789997898765443293989598743233459899898997898765212345678943498789456896543234598909876743234 41 | 9878989899876739874321012378987654102398799989875689654323466789994989898967997654345689412985432123 42 | 8767899956965323965632323569876543212399678976554678995567587999989878987898998765467897329876741012 43 | 7656789345953219876745456789987656323987567895443456789878678999876567896999019876569976535987899124 44 | 2345698999894923987896567896798767434598978987321234998989789998765458345892123987698998976899998934 45 | 1235987986789894998987878965439898765989989876510127897699898999854341237789239998987899989998987895 46 | 0129876545656789879598989896910999879876599765431456789534967898765210125678998999876787899987656989 47 | 9234995434345678965439196789891299989987678976542345678923456789874321434567897998765476799876545678 48 | 8945986325234799654321015798789989996598789989753658789212369892986476545698956899656365689995434569 49 | 7897995410125679965432123987678678965439894198764767994349498943996589656789346798743234578989323478 50 | 6789894323234567897693939876584589896520943299875879765598967899898698767893234989654125689873212369 51 | 5556789654356789998989899965423456789699954987976989876987656987769789978932129876543236798764201256 52 | 4345679965678893459876799854312345678987899876598991987976549876549890989543234989654345899854342345 53 | 1234567896789902398765689763201456899876798765439790999885434985432991299954345698769656789996456976 54 | 0145698919893212398764568954342567979985459886545699898766323976421289989895456799898767996987567987 55 | 1256789323994323459873487895656878967894398987676789797652109876534569876789567989989878945698878998 56 | 2345678999689934598932456976789989656789997699887897679843212987675698765678979878878989234589989129 57 | 3476789987567896987541237897895798787999896543999989498765323498789988654568998765767896545678999099 58 | 4587899976434679876532698998954679898998798432365679339865454679899876543678999544254898656789998978 59 | 7698999874323567998643459999543569999987654321234890123976565678989987654567898432123789767999987867 60 | 8789998765213898989654589987656998798798943210126789234597698789678998775689987521035678978999976756 61 | 9899987654345799879867678999899899677679854322287898949989989893459789987793298643146789989998865545 62 | 7998998785956789769878789934987766543598765643398967898765678932545679999894389743287894393987654334 63 | 5387899899897893456989897823496543432349876754679456987654567891234567894976569654398993212398710123 64 | 4286789998789954567896945312987932101345989867989347898943498992345698943987698795456789101239853234 65 | 3045789987698995778965432109899893232346899978993212349874679989456789932198999987567893234345954345 66 | 2134569865567989899879844398786789345456789989654324498765899978987896891099998998678954545467977656 67 | 3245698654456778999997656979645678959867898998995455569876998767898945692989987998789765656579998797 68 | 9959987843345569998989869868734567893978987687789569699989998756789434989876576899890998767898989898 69 | 7898765432123498987879998759823678991989876545678978789990987645678959878789445778921239898997778999 70 | 6989887753012397976867897642102899989998765434567899999892998534589998764621234567899399999876567895 71 | 5878999864129986545456789543234999878999543212678959898789876523569987653210123456998989998765456894 72 | 4569459954298865434345897676349898767987654104588969765698765434678998767821234767897778999987567893 73 | 3679598765987654321237898765498789656898983223467899878789897645678959898532345678976569896598678912 74 | 2998999879876543210136789877897676545789765434689999989895998656789544999643658789785458789439789323 75 | 9887891989987984334545678989987543235678978585693298793934569877894323498754769897654345678929899654 76 | 5776790994098875455676789796798763124569987678789109652123488989994212349865878989643234589214978969 77 | 4665689873129986566788997654569653023678998789893298743456567895789109456976989878510145679323469998 78 | 3534999865434597679899679932398762124589209899984349654567789964899298967987898764321234578934678987 79 | 2329898986597698789934567891987643236799919959875498765689891095998987998998949865986465678958789976 80 | 1019767899989999892123458910399754568899898945986789898789999989987876989219439877896568789769899895 81 | 2398756798978899975234567891239865678938767996797899999891298777896865878901921998989679899878998794 82 | 4987645987659798764356789932445978789324456789898989899930987656985434767899890129878989999989987643 83 | 9865434596545679875678899945566989893212345999999876789321986549876323457895791298967899998799875432 84 | 8754322987634789986789999896678997932101969899898765895439997998765412568934942987856789897698764321 85 | 7652101298945678997998988789789236893399898789799654976998998987654324569929899876545476789539875210 86 | 8743212349896789999887875678990145994988789677678967899876799398767434567898789986434365689123986929 87 | 9854529498789899898766434567891956789876643534567898998765989219976565678987678954321234678934999898 88 | 8765698987678998789654323458999897899985432423458999989854978901987676789997569854210176789549898787 89 | 9876987976589989698767454567898789989894321012567899876543467892398787899986498769321289998798766656 90 | 3989876645459876569878765698923678976789463123478999965432456799459898979876359998434799999897655545 91 | 2198765432398965456989876789434569765699954354589789654321347988998959567965219876545678988976543234 92 | 1099876541987654367896987898765678954578895455696599796542459977796543459894323987957989477895432123 93 | 2989987650199763212345698929987789543456789566789678989763598765689921298765434599768995356789921012 94 | 9879998753298654523456999019898897652569899678899789979878689874577890349876545699879654247698892123 95 | 8768999865349767684567899998769976543478998789979899869989789843456789456987656789989543123456789434 96 | 7656899965459888785678999896658987654567899894567988758899899652345678987898767896798762012348996545 97 | 4645788987567999898789998765347998765678987943459876546789998761234569999979898945679843234459987676 98 | 3434567987678932949899987643246899876799986212345986323499869810123478934567999637789954345678998789 99 | 2123456798889431234989998432143456989897695401234595434987654321234599123456798548898765456789239892 100 | 3012348999995432345678999543012345699976543212345976545698975432346789245678987656789876797890123921 -------------------------------------------------------------------------------- /day04input: -------------------------------------------------------------------------------- 1 | 90,4,2,96,46,1,62,97,3,52,7,35,50,28,31,37,74,26,59,53,82,47,83,80,19,40,68,95,34,55,54,73,12,78,30,63,57,93,72,77,56,91,23,67,64,79,85,84,76,10,58,0,29,13,94,20,32,25,11,38,89,21,98,92,42,27,14,99,24,75,86,51,22,48,9,33,49,18,70,8,87,61,39,16,66,71,5,69,15,43,88,45,6,81,60,36,44,17,41,65 2 | 3 | 76 82 2 92 53 4 | 74 33 8 89 3 5 | 80 27 72 26 91 6 | 30 83 7 16 4 7 | 20 56 48 5 13 8 | 9 | 67 7 75 66 4 10 | 35 97 21 29 95 11 | 58 98 56 71 65 12 | 55 61 19 64 9 13 | 38 34 42 30 2 14 | 15 | 79 97 63 98 75 16 | 1 13 0 76 46 17 | 56 59 58 55 86 18 | 43 27 73 67 31 19 | 33 81 26 19 3 20 | 21 | 3 37 33 8 19 22 | 34 69 82 9 51 23 | 56 45 15 85 79 24 | 32 55 81 22 12 25 | 42 20 48 7 75 26 | 27 | 16 68 45 31 54 28 | 57 40 77 5 76 29 | 67 24 84 14 41 30 | 21 23 27 36 7 31 | 56 8 86 50 22 32 | 33 | 28 53 81 26 40 34 | 59 29 49 89 48 35 | 10 44 3 42 7 36 | 79 87 32 31 54 37 | 15 23 65 69 56 38 | 39 | 86 20 47 1 94 40 | 3 91 77 14 83 41 | 79 93 4 92 65 42 | 0 67 30 36 7 43 | 6 48 59 35 73 44 | 45 | 75 87 7 28 25 46 | 31 71 35 52 32 47 | 47 99 0 80 33 48 | 41 59 24 50 17 49 | 93 58 26 81 53 50 | 51 | 41 77 15 55 86 52 | 20 5 54 79 93 53 | 3 61 57 47 7 54 | 85 98 91 39 13 55 | 4 81 63 72 24 56 | 57 | 27 37 57 38 72 58 | 86 99 14 2 15 59 | 94 25 73 13 54 60 | 19 26 56 3 7 61 | 1 49 33 24 21 62 | 63 | 11 79 12 89 1 64 | 23 98 49 66 48 65 | 15 30 90 57 31 66 | 55 47 61 9 74 67 | 76 93 81 63 95 68 | 69 | 51 92 84 77 26 70 | 85 42 80 89 25 71 | 82 41 73 58 49 72 | 6 36 75 4 40 73 | 62 11 56 24 69 74 | 75 | 19 79 35 75 18 76 | 7 4 12 78 70 77 | 44 52 26 94 60 78 | 71 65 61 89 87 79 | 83 95 73 93 13 80 | 81 | 36 79 62 91 58 82 | 12 46 9 55 93 83 | 98 32 68 87 69 84 | 27 90 51 45 2 85 | 15 43 29 26 40 86 | 87 | 29 47 78 54 31 88 | 98 65 71 8 72 89 | 75 51 13 80 2 90 | 93 69 20 52 96 91 | 33 91 3 37 62 92 | 93 | 94 74 2 23 71 94 | 16 95 52 31 80 95 | 3 4 28 9 50 96 | 6 40 47 62 48 97 | 97 43 85 11 99 98 | 99 | 20 64 23 36 39 100 | 22 31 75 45 24 101 | 53 19 17 58 51 102 | 66 4 81 72 37 103 | 34 82 42 91 48 104 | 105 | 22 15 43 97 13 106 | 73 71 88 1 48 107 | 84 4 29 87 95 108 | 90 40 11 67 6 109 | 23 10 12 64 99 110 | 111 | 29 61 2 34 89 112 | 93 87 10 42 65 113 | 13 45 88 30 69 114 | 71 78 1 20 19 115 | 44 75 9 84 37 116 | 117 | 48 89 80 68 45 118 | 81 12 1 64 77 119 | 79 87 21 26 40 120 | 44 82 46 78 54 121 | 33 63 8 0 98 122 | 123 | 0 62 13 43 93 124 | 11 66 99 86 55 125 | 27 89 51 98 46 126 | 39 76 73 24 37 127 | 23 68 72 80 64 128 | 129 | 37 89 58 78 76 130 | 41 9 22 97 82 131 | 40 39 73 96 8 132 | 91 4 84 35 34 133 | 70 12 79 75 7 134 | 135 | 26 18 12 88 97 136 | 10 51 62 53 79 137 | 24 47 31 89 21 138 | 57 96 1 17 80 139 | 58 92 7 14 60 140 | 141 | 12 23 6 71 64 142 | 82 40 15 18 29 143 | 53 21 76 52 84 144 | 32 86 89 22 91 145 | 74 58 80 2 63 146 | 147 | 71 96 10 39 87 148 | 45 68 94 76 33 149 | 59 60 11 62 88 150 | 13 37 63 47 7 151 | 44 79 24 21 16 152 | 153 | 80 71 39 36 1 154 | 9 23 55 58 91 155 | 65 60 19 25 22 156 | 0 88 98 83 93 157 | 82 69 43 78 8 158 | 159 | 67 80 42 49 97 160 | 7 18 92 98 89 161 | 21 95 61 8 64 162 | 76 63 52 68 87 163 | 47 34 84 45 96 164 | 165 | 40 0 45 33 79 166 | 18 56 83 6 58 167 | 66 7 4 25 61 168 | 91 46 60 22 99 169 | 62 65 64 84 17 170 | 171 | 68 18 96 88 61 172 | 89 55 81 20 70 173 | 60 76 17 69 40 174 | 37 63 41 54 11 175 | 43 94 58 47 31 176 | 177 | 60 63 64 26 21 178 | 87 99 49 11 16 179 | 70 41 50 1 38 180 | 45 98 94 67 62 181 | 13 34 61 92 40 182 | 183 | 56 64 37 26 34 184 | 69 16 72 75 77 185 | 19 8 50 38 98 186 | 0 2 99 48 20 187 | 68 35 88 57 90 188 | 189 | 17 41 40 48 54 190 | 67 52 63 25 78 191 | 95 26 12 85 37 192 | 69 93 58 62 11 193 | 47 33 14 35 81 194 | 195 | 26 51 80 31 64 196 | 2 7 59 37 57 197 | 70 78 52 91 50 198 | 86 0 15 20 25 199 | 85 79 41 98 83 200 | 201 | 91 86 31 63 4 202 | 81 37 77 94 74 203 | 45 95 88 23 40 204 | 29 46 79 18 70 205 | 75 14 20 51 68 206 | 207 | 30 59 37 56 99 208 | 74 14 4 21 53 209 | 61 49 84 40 33 210 | 20 51 79 66 27 211 | 58 23 88 17 75 212 | 213 | 46 64 31 6 61 214 | 38 14 77 83 59 215 | 13 81 91 17 24 216 | 11 96 90 10 49 217 | 73 82 1 69 45 218 | 219 | 21 57 79 10 41 220 | 67 74 96 20 94 221 | 29 40 78 9 85 222 | 23 25 49 0 39 223 | 59 88 58 86 92 224 | 225 | 1 22 49 43 32 226 | 47 56 18 16 25 227 | 42 57 48 53 46 228 | 78 20 89 36 96 229 | 24 28 76 39 29 230 | 231 | 53 66 38 11 94 232 | 49 27 25 1 82 233 | 12 72 50 61 51 234 | 97 92 96 4 89 235 | 47 44 21 24 81 236 | 237 | 16 70 78 12 63 238 | 87 32 95 99 64 239 | 68 54 85 53 94 240 | 88 22 52 3 23 241 | 48 27 1 58 31 242 | 243 | 71 62 41 44 49 244 | 67 98 61 48 46 245 | 47 9 24 30 51 246 | 29 76 57 53 34 247 | 23 96 42 5 73 248 | 249 | 50 72 56 97 2 250 | 20 5 3 55 93 251 | 24 7 22 9 96 252 | 58 60 38 17 36 253 | 11 54 79 28 53 254 | 255 | 13 21 35 79 91 256 | 8 28 68 54 6 257 | 0 25 82 78 1 258 | 29 99 41 46 95 259 | 66 72 17 55 76 260 | 261 | 43 42 7 85 90 262 | 91 80 79 72 8 263 | 34 77 44 30 92 264 | 48 49 40 70 86 265 | 28 69 27 84 73 266 | 267 | 17 94 67 26 63 268 | 68 77 71 23 13 269 | 6 96 11 21 73 270 | 53 33 80 62 99 271 | 60 36 38 32 75 272 | 273 | 75 83 50 32 29 274 | 61 94 4 35 51 275 | 52 77 54 69 5 276 | 36 89 76 26 71 277 | 74 19 13 33 18 278 | 279 | 29 24 28 5 54 280 | 56 86 37 45 83 281 | 34 77 42 58 76 282 | 82 1 4 39 64 283 | 61 26 99 72 89 284 | 285 | 25 80 23 88 2 286 | 76 93 90 86 52 287 | 17 62 55 83 7 288 | 57 81 24 0 99 289 | 67 44 27 4 94 290 | 291 | 71 26 62 63 31 292 | 4 15 38 0 89 293 | 41 77 34 42 19 294 | 39 90 45 30 73 295 | 3 33 8 50 55 296 | 297 | 65 26 20 8 70 298 | 96 24 88 29 46 299 | 22 6 21 4 72 300 | 59 32 18 49 61 301 | 28 58 66 67 92 302 | 303 | 68 45 62 77 40 304 | 53 1 21 11 83 305 | 44 88 81 56 89 306 | 29 32 47 0 50 307 | 26 74 78 59 6 308 | 309 | 52 56 23 84 74 310 | 64 21 45 35 75 311 | 82 86 60 97 83 312 | 69 78 15 20 37 313 | 68 36 17 43 28 314 | 315 | 92 33 36 48 34 316 | 75 77 79 39 88 317 | 61 28 21 2 94 318 | 84 89 17 22 67 319 | 38 41 7 80 12 320 | 321 | 27 34 91 21 87 322 | 5 65 7 70 36 323 | 31 3 38 49 61 324 | 96 62 50 97 20 325 | 47 37 16 59 76 326 | 327 | 39 50 3 25 31 328 | 37 36 88 40 14 329 | 26 70 75 30 9 330 | 97 42 86 90 20 331 | 38 66 22 4 69 332 | 333 | 62 64 72 11 79 334 | 50 0 89 30 70 335 | 83 53 93 39 22 336 | 90 20 80 55 32 337 | 6 12 19 27 2 338 | 339 | 17 85 24 50 13 340 | 12 41 75 74 35 341 | 3 88 69 73 1 342 | 77 34 71 32 44 343 | 96 26 37 46 9 344 | 345 | 84 20 33 4 21 346 | 5 22 19 91 51 347 | 23 56 44 43 68 348 | 6 50 70 47 46 349 | 75 81 34 32 13 350 | 351 | 6 36 27 32 59 352 | 4 75 63 86 48 353 | 81 49 44 7 25 354 | 0 69 11 43 91 355 | 87 39 23 47 98 356 | 357 | 53 16 97 94 69 358 | 4 43 9 67 33 359 | 21 83 32 87 35 360 | 55 78 68 28 75 361 | 51 19 82 54 24 362 | 363 | 50 84 63 21 92 364 | 51 52 97 66 1 365 | 22 44 31 64 49 366 | 83 24 2 35 45 367 | 15 16 71 60 58 368 | 369 | 54 83 48 63 2 370 | 43 82 65 20 42 371 | 52 86 58 27 75 372 | 7 76 64 18 11 373 | 77 93 67 0 25 374 | 375 | 12 60 93 99 37 376 | 29 44 47 4 89 377 | 30 63 52 66 91 378 | 2 38 72 84 6 379 | 1 96 5 18 33 380 | 381 | 76 61 58 41 43 382 | 21 69 55 18 79 383 | 40 59 9 7 36 384 | 77 82 47 84 89 385 | 92 13 49 6 62 386 | 387 | 33 68 74 92 24 388 | 28 3 15 77 37 389 | 83 72 21 71 29 390 | 88 64 47 35 44 391 | 51 18 31 95 99 392 | 393 | 71 50 97 18 77 394 | 29 30 0 88 49 395 | 98 99 95 11 1 396 | 46 83 64 55 56 397 | 9 6 59 87 19 398 | 399 | 71 41 13 33 4 400 | 23 22 26 28 82 401 | 95 62 7 34 64 402 | 10 68 14 21 37 403 | 73 53 88 81 1 404 | 405 | 16 87 61 58 95 406 | 90 27 3 65 38 407 | 35 17 85 6 47 408 | 69 22 54 83 82 409 | 28 67 96 48 88 410 | 411 | 17 47 81 13 77 412 | 64 86 82 62 24 413 | 40 41 52 50 15 414 | 4 71 2 90 22 415 | 61 38 20 78 34 416 | 417 | 65 51 54 10 16 418 | 52 28 68 75 8 419 | 26 97 96 49 73 420 | 95 17 64 80 34 421 | 5 76 25 66 77 422 | 423 | 30 10 42 72 75 424 | 67 85 36 64 25 425 | 61 48 59 96 98 426 | 81 89 3 4 46 427 | 33 84 32 78 80 428 | 429 | 93 24 5 21 95 430 | 18 1 66 57 31 431 | 2 17 62 8 28 432 | 73 10 38 25 63 433 | 91 71 48 44 4 434 | 435 | 92 54 34 5 74 436 | 8 31 94 24 44 437 | 43 2 64 49 21 438 | 73 19 99 60 78 439 | 0 23 16 86 85 440 | 441 | 25 34 6 67 71 442 | 79 76 39 81 32 443 | 23 36 82 92 50 444 | 10 51 55 40 80 445 | 20 44 30 24 28 446 | 447 | 74 22 58 26 10 448 | 36 43 76 93 15 449 | 87 55 6 91 37 450 | 81 86 8 99 30 451 | 78 62 50 44 54 452 | 453 | 16 14 79 80 42 454 | 27 83 26 82 29 455 | 43 76 9 66 5 456 | 75 77 99 45 10 457 | 2 61 32 73 91 458 | 459 | 16 60 83 81 47 460 | 23 27 59 85 24 461 | 75 33 36 86 15 462 | 70 91 55 93 63 463 | 25 32 53 14 82 464 | 465 | 98 87 40 52 0 466 | 86 58 74 2 84 467 | 24 99 61 41 92 468 | 77 17 1 43 57 469 | 62 70 94 89 19 470 | 471 | 7 18 19 85 98 472 | 40 0 99 45 63 473 | 59 49 37 42 5 474 | 58 82 25 53 4 475 | 2 1 62 68 33 476 | 477 | 21 87 18 29 34 478 | 53 24 26 67 25 479 | 49 77 4 64 59 480 | 52 12 97 2 36 481 | 66 76 9 74 95 482 | 483 | 92 44 14 18 48 484 | 31 74 79 86 58 485 | 68 12 33 55 56 486 | 97 94 25 41 65 487 | 29 36 53 60 62 488 | 489 | 23 26 85 88 7 490 | 96 1 75 76 9 491 | 49 44 18 78 59 492 | 64 83 19 30 74 493 | 52 95 66 62 22 494 | 495 | 43 99 38 73 33 496 | 36 46 24 32 91 497 | 47 68 15 5 81 498 | 37 20 0 97 50 499 | 12 30 53 4 55 500 | 501 | 26 33 49 91 30 502 | 61 22 7 12 82 503 | 4 36 1 6 11 504 | 96 14 35 90 50 505 | 97 25 28 32 58 506 | 507 | 92 36 56 10 62 508 | 73 35 60 25 34 509 | 96 24 16 53 84 510 | 37 51 30 58 1 511 | 20 80 43 63 45 512 | 513 | 39 68 53 30 91 514 | 11 97 10 12 55 515 | 6 76 57 77 48 516 | 56 51 98 71 82 517 | 46 27 54 33 5 518 | 519 | 19 38 63 64 61 520 | 48 28 29 60 72 521 | 99 94 55 25 76 522 | 98 37 7 3 80 523 | 10 2 16 35 50 524 | 525 | 16 68 75 19 58 526 | 28 21 56 11 46 527 | 60 25 32 88 30 528 | 53 62 69 7 91 529 | 73 94 24 6 38 530 | 531 | 69 4 37 70 54 532 | 67 17 2 57 16 533 | 72 30 43 58 1 534 | 6 56 28 86 18 535 | 7 94 55 35 77 536 | 537 | 73 32 57 79 1 538 | 89 17 26 44 29 539 | 11 86 94 38 74 540 | 49 98 54 76 6 541 | 67 45 87 21 51 542 | 543 | 14 73 22 48 69 544 | 78 89 4 32 18 545 | 96 59 26 43 92 546 | 68 33 97 53 35 547 | 61 52 87 57 31 548 | 549 | 86 1 22 31 20 550 | 14 84 23 38 18 551 | 57 67 5 90 6 552 | 91 21 52 65 36 553 | 61 56 3 51 25 554 | 555 | 60 5 98 31 76 556 | 3 44 24 16 63 557 | 0 96 56 25 84 558 | 88 18 71 93 19 559 | 26 77 86 23 65 560 | 561 | 62 58 11 34 26 562 | 35 56 97 67 90 563 | 20 65 27 73 77 564 | 4 84 19 82 45 565 | 43 92 18 68 55 566 | 567 | 33 46 21 41 75 568 | 98 73 67 80 81 569 | 84 16 44 93 94 570 | 1 9 26 97 52 571 | 88 74 12 95 99 572 | 573 | 46 83 30 22 79 574 | 72 26 42 74 33 575 | 54 41 94 86 82 576 | 27 81 31 34 12 577 | 77 6 38 56 71 578 | 579 | 22 80 82 60 24 580 | 20 49 51 58 59 581 | 47 35 67 92 78 582 | 15 8 71 97 63 583 | 37 27 98 16 38 584 | 585 | 71 94 59 27 83 586 | 81 68 58 61 43 587 | 12 75 93 70 56 588 | 19 28 99 39 20 589 | 18 22 34 78 13 590 | 591 | 43 70 54 13 60 592 | 17 24 31 47 84 593 | 88 15 40 45 76 594 | 7 78 63 75 56 595 | 23 66 96 26 46 596 | 597 | 2 16 13 57 32 598 | 26 70 37 50 68 599 | 58 17 3 96 67 600 | 33 95 72 59 42 601 | 94 43 51 20 60 -------------------------------------------------------------------------------- /day05input: -------------------------------------------------------------------------------- 1 | 645,570 -> 517,570 2 | 100,409 -> 200,409 3 | 945,914 -> 98,67 4 | 22,934 -> 22,681 5 | 935,781 -> 524,370 6 | 750,304 -> 854,408 7 | 974,27 -> 26,975 8 | 529,58 -> 979,58 9 | 979,515 -> 550,944 10 | 925,119 -> 17,119 11 | 178,594 -> 45,461 12 | 252,366 -> 92,206 13 | 25,593 -> 250,593 14 | 956,34 -> 21,969 15 | 200,671 -> 200,369 16 | 628,614 -> 628,637 17 | 697,428 -> 237,428 18 | 554,40 -> 554,949 19 | 927,197 -> 469,197 20 | 504,779 -> 593,868 21 | 227,882 -> 227,982 22 | 56,905 -> 56,81 23 | 438,874 -> 566,746 24 | 989,73 -> 113,949 25 | 82,36 -> 616,570 26 | 670,423 -> 670,873 27 | 100,435 -> 291,435 28 | 242,81 -> 978,817 29 | 367,335 -> 367,332 30 | 890,584 -> 116,584 31 | 572,192 -> 572,561 32 | 391,516 -> 391,559 33 | 525,62 -> 525,540 34 | 787,540 -> 812,515 35 | 749,732 -> 423,406 36 | 745,911 -> 694,911 37 | 805,18 -> 972,18 38 | 701,565 -> 280,144 39 | 930,92 -> 129,893 40 | 15,989 -> 970,34 41 | 409,920 -> 409,345 42 | 192,743 -> 312,863 43 | 724,12 -> 29,707 44 | 323,664 -> 323,897 45 | 161,423 -> 391,653 46 | 59,363 -> 250,554 47 | 407,676 -> 19,288 48 | 449,585 -> 449,301 49 | 914,798 -> 914,806 50 | 917,401 -> 288,401 51 | 588,800 -> 647,800 52 | 897,883 -> 897,276 53 | 115,606 -> 41,532 54 | 692,482 -> 777,482 55 | 428,736 -> 69,736 56 | 405,44 -> 405,632 57 | 198,482 -> 198,620 58 | 988,816 -> 988,598 59 | 254,461 -> 186,393 60 | 560,783 -> 208,783 61 | 856,766 -> 215,125 62 | 182,30 -> 569,30 63 | 504,242 -> 656,242 64 | 393,929 -> 131,929 65 | 597,359 -> 26,930 66 | 502,690 -> 255,443 67 | 149,608 -> 149,748 68 | 293,662 -> 622,662 69 | 697,154 -> 697,228 70 | 587,804 -> 983,804 71 | 715,63 -> 715,709 72 | 496,831 -> 23,358 73 | 461,48 -> 68,441 74 | 927,565 -> 595,565 75 | 972,350 -> 689,350 76 | 728,438 -> 728,221 77 | 173,134 -> 173,804 78 | 720,368 -> 121,368 79 | 690,66 -> 201,66 80 | 218,680 -> 841,680 81 | 80,792 -> 80,467 82 | 624,319 -> 624,461 83 | 248,348 -> 532,64 84 | 357,260 -> 505,408 85 | 296,814 -> 13,531 86 | 819,216 -> 819,932 87 | 696,233 -> 696,840 88 | 219,93 -> 868,93 89 | 537,63 -> 905,63 90 | 777,940 -> 777,84 91 | 286,133 -> 286,735 92 | 969,967 -> 969,823 93 | 254,222 -> 859,827 94 | 426,728 -> 426,388 95 | 854,561 -> 854,363 96 | 755,861 -> 755,947 97 | 570,754 -> 439,754 98 | 333,351 -> 333,828 99 | 436,693 -> 436,262 100 | 982,987 -> 172,177 101 | 267,178 -> 267,270 102 | 218,201 -> 747,730 103 | 811,602 -> 829,584 104 | 602,659 -> 766,659 105 | 536,544 -> 483,597 106 | 280,881 -> 547,881 107 | 584,125 -> 129,125 108 | 386,210 -> 757,210 109 | 605,855 -> 605,668 110 | 19,985 -> 988,16 111 | 980,655 -> 836,655 112 | 73,189 -> 267,383 113 | 621,645 -> 533,645 114 | 36,12 -> 255,231 115 | 538,889 -> 130,481 116 | 921,217 -> 921,724 117 | 873,59 -> 873,311 118 | 76,918 -> 970,24 119 | 694,448 -> 694,983 120 | 573,891 -> 573,337 121 | 796,358 -> 403,358 122 | 532,928 -> 351,928 123 | 123,717 -> 123,446 124 | 874,714 -> 874,886 125 | 350,458 -> 728,458 126 | 798,140 -> 798,242 127 | 832,406 -> 864,406 128 | 188,55 -> 188,641 129 | 903,376 -> 509,376 130 | 50,954 -> 989,15 131 | 42,294 -> 25,294 132 | 544,273 -> 974,273 133 | 804,756 -> 103,55 134 | 398,184 -> 570,12 135 | 82,179 -> 902,179 136 | 461,728 -> 905,284 137 | 429,241 -> 26,241 138 | 128,715 -> 207,715 139 | 239,545 -> 934,545 140 | 978,769 -> 978,576 141 | 250,77 -> 515,77 142 | 521,533 -> 521,434 143 | 955,844 -> 314,203 144 | 144,601 -> 702,43 145 | 313,784 -> 339,784 146 | 388,692 -> 805,275 147 | 540,872 -> 540,72 148 | 971,19 -> 17,973 149 | 816,540 -> 386,540 150 | 933,246 -> 560,619 151 | 800,600 -> 387,187 152 | 272,791 -> 129,934 153 | 908,133 -> 110,931 154 | 759,191 -> 910,40 155 | 420,479 -> 749,150 156 | 604,946 -> 804,946 157 | 633,404 -> 771,266 158 | 948,974 -> 948,734 159 | 735,198 -> 105,828 160 | 889,653 -> 889,688 161 | 157,172 -> 822,837 162 | 206,670 -> 297,670 163 | 50,122 -> 792,864 164 | 656,664 -> 27,664 165 | 966,33 -> 523,33 166 | 985,40 -> 101,924 167 | 394,367 -> 574,547 168 | 440,573 -> 268,573 169 | 159,989 -> 159,130 170 | 867,123 -> 867,891 171 | 316,153 -> 316,249 172 | 680,59 -> 773,152 173 | 52,928 -> 52,182 174 | 128,595 -> 225,595 175 | 508,719 -> 591,719 176 | 595,447 -> 709,333 177 | 930,783 -> 283,136 178 | 366,236 -> 283,236 179 | 820,512 -> 381,951 180 | 135,450 -> 135,766 181 | 750,838 -> 534,838 182 | 259,304 -> 626,671 183 | 414,631 -> 916,129 184 | 193,862 -> 901,154 185 | 362,595 -> 362,209 186 | 377,215 -> 377,499 187 | 723,16 -> 577,16 188 | 335,238 -> 790,693 189 | 670,266 -> 871,65 190 | 288,313 -> 213,313 191 | 48,423 -> 592,967 192 | 960,323 -> 911,323 193 | 177,182 -> 177,235 194 | 773,918 -> 757,918 195 | 216,432 -> 147,432 196 | 808,500 -> 656,500 197 | 205,451 -> 776,451 198 | 598,985 -> 598,608 199 | 193,253 -> 241,205 200 | 912,384 -> 912,532 201 | 214,194 -> 214,738 202 | 508,356 -> 508,792 203 | 16,372 -> 30,372 204 | 384,854 -> 986,252 205 | 361,569 -> 851,569 206 | 923,550 -> 923,441 207 | 271,257 -> 318,304 208 | 651,345 -> 651,397 209 | 885,14 -> 929,14 210 | 199,547 -> 925,547 211 | 803,176 -> 104,875 212 | 840,302 -> 197,945 213 | 971,743 -> 355,127 214 | 684,951 -> 684,292 215 | 58,867 -> 58,953 216 | 351,187 -> 351,831 217 | 701,413 -> 701,728 218 | 482,159 -> 134,159 219 | 118,52 -> 950,884 220 | 115,968 -> 115,137 221 | 437,739 -> 627,929 222 | 653,153 -> 549,153 223 | 604,504 -> 560,460 224 | 538,865 -> 840,563 225 | 114,876 -> 114,124 226 | 152,899 -> 925,126 227 | 973,224 -> 973,387 228 | 492,360 -> 861,729 229 | 927,902 -> 108,83 230 | 754,678 -> 754,647 231 | 526,671 -> 423,671 232 | 675,608 -> 243,608 233 | 147,241 -> 147,242 234 | 456,770 -> 456,665 235 | 953,50 -> 102,901 236 | 415,869 -> 415,733 237 | 979,533 -> 169,533 238 | 336,385 -> 336,18 239 | 927,176 -> 927,587 240 | 370,317 -> 933,880 241 | 450,349 -> 450,103 242 | 755,235 -> 408,235 243 | 342,55 -> 931,55 244 | 417,707 -> 887,237 245 | 141,95 -> 131,85 246 | 776,209 -> 590,23 247 | 39,732 -> 469,302 248 | 743,602 -> 743,358 249 | 473,439 -> 473,545 250 | 270,290 -> 270,640 251 | 904,963 -> 949,963 252 | 71,91 -> 956,976 253 | 865,757 -> 276,757 254 | 59,72 -> 966,979 255 | 46,184 -> 788,926 256 | 360,833 -> 561,833 257 | 120,452 -> 528,452 258 | 704,927 -> 158,381 259 | 140,481 -> 140,350 260 | 929,920 -> 929,342 261 | 328,381 -> 328,866 262 | 897,389 -> 227,389 263 | 341,614 -> 29,614 264 | 609,327 -> 609,582 265 | 727,858 -> 727,941 266 | 349,536 -> 349,500 267 | 280,959 -> 259,959 268 | 973,637 -> 832,637 269 | 161,255 -> 979,255 270 | 512,826 -> 149,826 271 | 308,769 -> 22,769 272 | 60,692 -> 60,262 273 | 787,31 -> 753,31 274 | 932,166 -> 932,127 275 | 514,77 -> 514,646 276 | 535,434 -> 535,979 277 | 838,799 -> 838,332 278 | 565,956 -> 565,477 279 | 74,195 -> 274,195 280 | 916,715 -> 907,715 281 | 721,655 -> 721,542 282 | 180,784 -> 928,784 283 | 16,128 -> 313,128 284 | 23,330 -> 23,704 285 | 530,723 -> 530,88 286 | 869,272 -> 765,376 287 | 878,185 -> 353,185 288 | 72,800 -> 514,800 289 | 319,117 -> 307,117 290 | 436,405 -> 496,345 291 | 327,459 -> 641,145 292 | 358,309 -> 661,612 293 | 60,225 -> 811,976 294 | 113,130 -> 794,130 295 | 559,950 -> 32,423 296 | 626,110 -> 626,319 297 | 50,39 -> 989,978 298 | 257,627 -> 799,627 299 | 581,843 -> 581,493 300 | 869,18 -> 208,18 301 | 184,395 -> 184,263 302 | 454,888 -> 165,599 303 | 637,920 -> 637,544 304 | 170,982 -> 273,982 305 | 98,354 -> 668,924 306 | 32,409 -> 32,925 307 | 154,175 -> 273,294 308 | 425,896 -> 870,451 309 | 198,319 -> 615,736 310 | 170,582 -> 170,712 311 | 141,645 -> 141,639 312 | 482,768 -> 486,768 313 | 940,969 -> 24,53 314 | 680,360 -> 959,360 315 | 315,905 -> 315,96 316 | 22,666 -> 22,247 317 | 722,40 -> 722,714 318 | 585,31 -> 585,21 319 | 479,254 -> 307,254 320 | 291,182 -> 291,855 321 | 684,698 -> 402,698 322 | 20,984 -> 988,16 323 | 256,424 -> 17,663 324 | 825,380 -> 820,385 325 | 254,622 -> 254,315 326 | 98,855 -> 98,694 327 | 220,719 -> 220,117 328 | 615,653 -> 656,694 329 | 427,12 -> 427,745 330 | 20,64 -> 828,872 331 | 739,203 -> 434,203 332 | 546,576 -> 130,160 333 | 730,835 -> 299,835 334 | 927,512 -> 927,586 335 | 411,192 -> 868,192 336 | 917,630 -> 678,630 337 | 620,588 -> 620,26 338 | 786,488 -> 486,488 339 | 746,640 -> 251,145 340 | 585,556 -> 585,119 341 | 977,202 -> 762,202 342 | 587,244 -> 587,877 343 | 693,479 -> 693,859 344 | 59,816 -> 59,475 345 | 191,941 -> 878,254 346 | 150,920 -> 926,144 347 | 856,397 -> 856,739 348 | 380,965 -> 549,796 349 | 637,323 -> 909,595 350 | 848,219 -> 304,763 351 | 123,146 -> 589,146 352 | 546,122 -> 651,122 353 | 131,711 -> 814,28 354 | 727,274 -> 296,274 355 | 101,546 -> 479,168 356 | 508,517 -> 615,410 357 | 492,115 -> 492,250 358 | 212,65 -> 770,623 359 | 118,938 -> 857,199 360 | 623,843 -> 98,843 361 | 86,153 -> 701,768 362 | 81,98 -> 81,604 363 | 173,313 -> 173,533 364 | 792,396 -> 792,242 365 | 975,985 -> 10,20 366 | 762,661 -> 726,661 367 | 216,327 -> 216,122 368 | 446,658 -> 98,658 369 | 85,184 -> 314,184 370 | 165,750 -> 313,750 371 | 729,583 -> 729,640 372 | 382,36 -> 382,326 373 | 487,32 -> 225,32 374 | 389,722 -> 582,915 375 | 954,965 -> 86,965 376 | 747,376 -> 747,96 377 | 254,259 -> 254,482 378 | 149,256 -> 149,871 379 | 893,207 -> 708,22 380 | 195,907 -> 195,82 381 | 342,686 -> 457,571 382 | 647,469 -> 468,469 383 | 150,525 -> 832,525 384 | 90,907 -> 90,31 385 | 389,554 -> 389,318 386 | 138,327 -> 138,310 387 | 861,126 -> 861,549 388 | 355,583 -> 355,534 389 | 591,182 -> 181,592 390 | 73,84 -> 897,908 391 | 326,989 -> 425,989 392 | 835,688 -> 724,799 393 | 844,493 -> 844,974 394 | 172,436 -> 172,12 395 | 536,933 -> 48,445 396 | 192,531 -> 287,531 397 | 286,547 -> 80,547 398 | 929,795 -> 697,795 399 | 790,681 -> 433,681 400 | 692,229 -> 731,229 401 | 377,667 -> 14,304 402 | 535,226 -> 116,645 403 | 338,861 -> 338,343 404 | 668,160 -> 853,160 405 | 188,157 -> 667,636 406 | 62,934 -> 951,45 407 | 948,820 -> 978,820 408 | 860,884 -> 157,884 409 | 794,251 -> 783,251 410 | 317,381 -> 591,655 411 | 459,876 -> 459,307 412 | 146,822 -> 903,65 413 | 374,739 -> 891,739 414 | 619,575 -> 973,929 415 | 544,351 -> 544,124 416 | 300,335 -> 818,335 417 | 158,220 -> 418,480 418 | 107,953 -> 988,953 419 | 304,753 -> 543,753 420 | 948,95 -> 140,903 421 | 832,451 -> 526,145 422 | 966,34 -> 402,598 423 | 72,123 -> 716,123 424 | 336,294 -> 84,294 425 | 116,605 -> 116,889 426 | 700,742 -> 700,217 427 | 551,554 -> 973,554 428 | 684,181 -> 66,799 429 | 86,949 -> 86,173 430 | 834,361 -> 834,942 431 | 508,668 -> 627,549 432 | 213,695 -> 704,695 433 | 260,979 -> 868,371 434 | 825,435 -> 825,67 435 | 956,854 -> 66,854 436 | 390,444 -> 697,444 437 | 360,450 -> 720,810 438 | 153,514 -> 794,514 439 | 253,261 -> 253,298 440 | 925,679 -> 925,499 441 | 391,282 -> 441,282 442 | 86,366 -> 779,366 443 | 687,312 -> 687,629 444 | 304,172 -> 732,600 445 | 571,518 -> 263,518 446 | 814,252 -> 118,252 447 | 108,920 -> 108,162 448 | 154,965 -> 928,191 449 | 635,875 -> 635,947 450 | 986,31 -> 47,970 451 | 746,35 -> 746,636 452 | 735,849 -> 334,448 453 | 826,510 -> 906,590 454 | 834,745 -> 834,949 455 | 843,401 -> 564,122 456 | 179,212 -> 179,32 457 | 354,906 -> 233,906 458 | 593,439 -> 196,42 459 | 707,446 -> 242,446 460 | 511,84 -> 511,406 461 | 109,299 -> 100,290 462 | 410,79 -> 410,784 463 | 806,923 -> 54,171 464 | 592,83 -> 592,189 465 | 413,28 -> 413,469 466 | 17,844 -> 17,691 467 | 130,419 -> 205,344 468 | 374,247 -> 849,247 469 | 650,344 -> 653,344 470 | 563,942 -> 563,726 471 | 771,966 -> 450,966 472 | 499,693 -> 788,693 473 | 962,458 -> 962,356 474 | 28,683 -> 765,683 475 | 432,546 -> 432,708 476 | 519,974 -> 176,974 477 | 797,744 -> 280,227 478 | 505,228 -> 547,228 479 | 401,366 -> 401,754 480 | 356,470 -> 123,470 481 | 57,909 -> 229,909 482 | 343,880 -> 539,880 483 | 221,851 -> 221,297 484 | 520,677 -> 894,677 485 | 216,805 -> 688,805 486 | 158,901 -> 847,901 487 | 98,129 -> 98,969 488 | 793,203 -> 210,786 489 | 852,855 -> 135,138 490 | 944,90 -> 103,931 491 | 691,768 -> 583,768 492 | 784,617 -> 637,764 493 | 222,160 -> 819,757 494 | 145,982 -> 145,216 495 | 837,355 -> 99,355 496 | 324,121 -> 324,14 497 | 773,851 -> 773,413 498 | 778,550 -> 686,458 499 | 81,56 -> 338,313 500 | 356,512 -> 356,441 -------------------------------------------------------------------------------- /day02input: -------------------------------------------------------------------------------- 1 | forward 6 2 | forward 9 3 | down 9 4 | down 7 5 | forward 8 6 | down 4 7 | forward 7 8 | forward 3 9 | up 5 10 | down 7 11 | down 3 12 | down 2 13 | down 1 14 | down 2 15 | down 1 16 | forward 5 17 | down 9 18 | up 7 19 | forward 6 20 | forward 3 21 | down 2 22 | forward 2 23 | down 4 24 | down 3 25 | forward 9 26 | up 4 27 | down 7 28 | forward 5 29 | down 4 30 | down 4 31 | forward 8 32 | up 6 33 | forward 4 34 | forward 6 35 | down 8 36 | forward 6 37 | up 9 38 | down 6 39 | down 8 40 | forward 7 41 | down 8 42 | up 1 43 | forward 5 44 | up 8 45 | forward 9 46 | down 7 47 | down 9 48 | up 3 49 | forward 9 50 | forward 7 51 | down 1 52 | down 5 53 | forward 6 54 | up 3 55 | down 2 56 | forward 8 57 | forward 5 58 | forward 9 59 | down 5 60 | down 5 61 | forward 7 62 | forward 9 63 | forward 8 64 | forward 9 65 | up 4 66 | up 8 67 | forward 2 68 | up 6 69 | forward 2 70 | down 8 71 | forward 4 72 | forward 6 73 | down 1 74 | forward 3 75 | down 7 76 | down 8 77 | forward 9 78 | forward 5 79 | down 8 80 | forward 1 81 | forward 8 82 | down 8 83 | up 1 84 | down 9 85 | forward 6 86 | down 1 87 | down 8 88 | up 6 89 | up 8 90 | down 7 91 | forward 8 92 | down 3 93 | forward 2 94 | up 2 95 | forward 1 96 | forward 7 97 | down 5 98 | down 7 99 | forward 5 100 | down 7 101 | forward 5 102 | forward 4 103 | up 8 104 | down 5 105 | forward 8 106 | forward 6 107 | up 4 108 | up 1 109 | down 1 110 | down 8 111 | down 1 112 | up 1 113 | down 4 114 | down 4 115 | up 3 116 | down 6 117 | forward 7 118 | up 8 119 | up 1 120 | forward 7 121 | forward 6 122 | down 9 123 | forward 3 124 | down 9 125 | down 5 126 | forward 5 127 | forward 1 128 | forward 5 129 | down 4 130 | forward 4 131 | up 5 132 | down 8 133 | down 2 134 | forward 2 135 | down 8 136 | up 4 137 | down 3 138 | forward 6 139 | up 7 140 | forward 2 141 | up 5 142 | up 9 143 | forward 6 144 | down 1 145 | down 1 146 | up 4 147 | down 7 148 | up 2 149 | forward 1 150 | down 5 151 | down 4 152 | down 5 153 | forward 4 154 | down 3 155 | up 8 156 | forward 7 157 | down 2 158 | up 6 159 | forward 4 160 | forward 8 161 | forward 8 162 | up 7 163 | down 2 164 | down 7 165 | down 9 166 | forward 8 167 | down 9 168 | down 5 169 | forward 8 170 | forward 6 171 | up 4 172 | up 7 173 | down 7 174 | forward 1 175 | up 2 176 | forward 1 177 | down 6 178 | down 1 179 | forward 9 180 | forward 8 181 | up 4 182 | forward 9 183 | up 7 184 | forward 8 185 | forward 1 186 | down 6 187 | up 3 188 | forward 2 189 | down 6 190 | up 3 191 | up 5 192 | forward 6 193 | up 5 194 | down 9 195 | forward 4 196 | up 5 197 | down 3 198 | forward 5 199 | forward 2 200 | up 6 201 | up 1 202 | up 4 203 | forward 9 204 | down 5 205 | up 2 206 | forward 9 207 | up 5 208 | down 6 209 | up 9 210 | down 6 211 | down 7 212 | forward 6 213 | forward 3 214 | down 2 215 | forward 3 216 | down 1 217 | down 9 218 | down 2 219 | down 2 220 | forward 8 221 | up 9 222 | forward 4 223 | forward 6 224 | forward 5 225 | forward 9 226 | forward 4 227 | up 6 228 | down 8 229 | down 8 230 | down 3 231 | forward 1 232 | forward 7 233 | up 3 234 | forward 2 235 | down 9 236 | up 7 237 | forward 5 238 | down 1 239 | forward 9 240 | up 8 241 | forward 7 242 | forward 1 243 | down 7 244 | forward 8 245 | down 7 246 | down 6 247 | forward 5 248 | forward 7 249 | up 9 250 | up 4 251 | forward 2 252 | down 1 253 | forward 3 254 | down 5 255 | forward 2 256 | forward 2 257 | forward 6 258 | up 1 259 | up 9 260 | down 1 261 | down 7 262 | up 6 263 | down 6 264 | down 7 265 | forward 3 266 | forward 7 267 | forward 9 268 | forward 9 269 | down 6 270 | down 8 271 | forward 9 272 | up 5 273 | forward 5 274 | down 6 275 | down 4 276 | forward 1 277 | up 9 278 | forward 6 279 | up 4 280 | up 7 281 | forward 5 282 | down 7 283 | down 6 284 | forward 2 285 | down 4 286 | forward 2 287 | down 1 288 | forward 8 289 | down 3 290 | down 8 291 | down 7 292 | down 6 293 | forward 3 294 | forward 1 295 | down 8 296 | up 4 297 | down 8 298 | forward 7 299 | down 2 300 | forward 3 301 | forward 2 302 | forward 4 303 | forward 2 304 | forward 8 305 | forward 2 306 | up 1 307 | down 6 308 | down 9 309 | down 3 310 | forward 8 311 | down 3 312 | forward 8 313 | forward 3 314 | forward 5 315 | down 6 316 | forward 6 317 | forward 2 318 | down 7 319 | forward 8 320 | down 1 321 | forward 7 322 | forward 6 323 | up 9 324 | forward 2 325 | up 4 326 | up 6 327 | forward 4 328 | forward 5 329 | forward 6 330 | forward 7 331 | down 4 332 | forward 9 333 | forward 1 334 | down 8 335 | down 5 336 | down 9 337 | up 5 338 | forward 9 339 | forward 6 340 | forward 7 341 | down 5 342 | forward 9 343 | down 4 344 | down 8 345 | forward 9 346 | down 5 347 | down 5 348 | down 6 349 | forward 8 350 | forward 9 351 | down 5 352 | down 7 353 | forward 8 354 | forward 5 355 | forward 9 356 | up 4 357 | down 3 358 | down 3 359 | forward 5 360 | down 7 361 | down 3 362 | up 7 363 | forward 6 364 | up 7 365 | down 9 366 | forward 6 367 | forward 8 368 | up 8 369 | down 9 370 | down 6 371 | up 3 372 | forward 6 373 | up 3 374 | down 4 375 | down 6 376 | forward 5 377 | down 5 378 | forward 1 379 | down 5 380 | forward 2 381 | up 3 382 | up 9 383 | down 9 384 | up 1 385 | down 3 386 | down 4 387 | forward 5 388 | up 4 389 | down 2 390 | forward 1 391 | forward 7 392 | up 9 393 | up 9 394 | down 2 395 | down 8 396 | forward 5 397 | down 4 398 | up 2 399 | forward 9 400 | down 3 401 | up 6 402 | down 3 403 | forward 1 404 | down 7 405 | down 7 406 | down 7 407 | forward 1 408 | forward 6 409 | down 5 410 | up 7 411 | forward 2 412 | up 6 413 | down 5 414 | up 3 415 | down 5 416 | up 1 417 | down 9 418 | up 2 419 | down 7 420 | up 5 421 | down 6 422 | up 1 423 | forward 5 424 | down 2 425 | down 1 426 | up 2 427 | forward 5 428 | forward 8 429 | up 7 430 | up 5 431 | forward 9 432 | forward 9 433 | forward 5 434 | forward 8 435 | down 4 436 | forward 8 437 | down 1 438 | up 3 439 | down 1 440 | down 9 441 | up 5 442 | down 7 443 | down 8 444 | down 4 445 | down 3 446 | forward 6 447 | down 5 448 | down 7 449 | forward 6 450 | down 3 451 | down 1 452 | down 5 453 | forward 4 454 | up 8 455 | down 6 456 | forward 1 457 | forward 1 458 | down 4 459 | down 8 460 | forward 9 461 | forward 3 462 | forward 6 463 | down 5 464 | down 7 465 | down 4 466 | up 1 467 | forward 2 468 | forward 4 469 | forward 8 470 | up 2 471 | up 9 472 | up 3 473 | down 8 474 | forward 4 475 | down 7 476 | forward 7 477 | down 5 478 | up 3 479 | up 6 480 | down 5 481 | forward 2 482 | down 8 483 | up 1 484 | down 4 485 | down 4 486 | forward 1 487 | down 6 488 | down 1 489 | up 2 490 | forward 2 491 | down 8 492 | down 7 493 | forward 5 494 | forward 2 495 | up 4 496 | forward 6 497 | down 4 498 | down 6 499 | down 2 500 | up 5 501 | down 5 502 | forward 7 503 | forward 2 504 | down 2 505 | down 7 506 | forward 1 507 | forward 1 508 | forward 4 509 | down 3 510 | forward 3 511 | up 4 512 | up 6 513 | down 3 514 | forward 4 515 | down 5 516 | down 6 517 | down 1 518 | forward 3 519 | up 3 520 | down 5 521 | down 5 522 | down 5 523 | forward 5 524 | forward 5 525 | forward 2 526 | up 3 527 | down 6 528 | down 6 529 | down 2 530 | down 5 531 | forward 3 532 | forward 9 533 | down 9 534 | forward 6 535 | up 4 536 | down 8 537 | up 7 538 | forward 1 539 | forward 4 540 | forward 9 541 | down 6 542 | up 1 543 | up 1 544 | up 4 545 | up 6 546 | forward 7 547 | down 5 548 | forward 8 549 | forward 7 550 | up 1 551 | up 6 552 | down 7 553 | down 8 554 | down 4 555 | down 8 556 | up 8 557 | down 7 558 | up 1 559 | forward 9 560 | forward 6 561 | forward 2 562 | forward 7 563 | down 9 564 | down 9 565 | down 7 566 | forward 4 567 | forward 8 568 | forward 8 569 | up 3 570 | down 7 571 | down 7 572 | down 3 573 | forward 5 574 | forward 3 575 | down 3 576 | down 6 577 | forward 2 578 | down 6 579 | up 7 580 | forward 2 581 | up 5 582 | down 7 583 | forward 4 584 | down 7 585 | forward 6 586 | up 6 587 | up 6 588 | forward 6 589 | forward 3 590 | up 1 591 | forward 2 592 | forward 6 593 | up 1 594 | down 9 595 | forward 8 596 | forward 6 597 | down 8 598 | down 3 599 | up 5 600 | forward 7 601 | forward 2 602 | up 4 603 | up 3 604 | forward 4 605 | down 3 606 | down 5 607 | down 5 608 | down 2 609 | down 7 610 | up 2 611 | down 2 612 | up 7 613 | down 1 614 | forward 6 615 | forward 5 616 | forward 4 617 | down 6 618 | down 1 619 | down 5 620 | down 6 621 | down 3 622 | down 9 623 | down 2 624 | down 7 625 | forward 7 626 | up 7 627 | down 3 628 | down 3 629 | forward 7 630 | up 5 631 | down 9 632 | forward 9 633 | down 2 634 | up 4 635 | up 9 636 | up 9 637 | down 1 638 | up 6 639 | down 1 640 | forward 7 641 | down 6 642 | forward 9 643 | down 9 644 | down 4 645 | down 1 646 | forward 6 647 | down 2 648 | forward 6 649 | up 8 650 | forward 1 651 | up 1 652 | up 5 653 | down 6 654 | down 8 655 | down 8 656 | forward 5 657 | forward 4 658 | forward 3 659 | up 8 660 | up 9 661 | down 4 662 | forward 4 663 | forward 4 664 | down 9 665 | forward 9 666 | down 7 667 | forward 7 668 | up 4 669 | forward 2 670 | down 8 671 | forward 1 672 | down 7 673 | forward 5 674 | forward 1 675 | down 8 676 | up 1 677 | up 1 678 | down 2 679 | down 4 680 | down 7 681 | down 3 682 | forward 7 683 | down 3 684 | up 3 685 | forward 8 686 | up 6 687 | forward 7 688 | forward 6 689 | down 1 690 | down 8 691 | forward 7 692 | up 1 693 | forward 2 694 | down 6 695 | down 1 696 | forward 4 697 | forward 2 698 | down 9 699 | up 8 700 | down 9 701 | down 2 702 | down 3 703 | down 5 704 | down 3 705 | down 8 706 | down 1 707 | down 1 708 | up 5 709 | forward 5 710 | down 2 711 | down 5 712 | down 5 713 | up 4 714 | up 5 715 | up 6 716 | up 7 717 | down 5 718 | forward 4 719 | up 6 720 | up 3 721 | down 5 722 | forward 9 723 | down 5 724 | down 3 725 | down 8 726 | forward 6 727 | forward 4 728 | forward 4 729 | forward 4 730 | forward 9 731 | forward 3 732 | up 3 733 | forward 7 734 | down 6 735 | down 7 736 | down 9 737 | down 5 738 | up 3 739 | forward 9 740 | forward 7 741 | forward 2 742 | down 4 743 | up 4 744 | down 7 745 | down 9 746 | down 6 747 | down 8 748 | forward 4 749 | forward 9 750 | down 4 751 | forward 9 752 | forward 3 753 | forward 9 754 | down 8 755 | forward 6 756 | down 6 757 | up 8 758 | forward 9 759 | forward 5 760 | forward 6 761 | down 5 762 | up 1 763 | forward 2 764 | up 5 765 | up 8 766 | down 7 767 | down 9 768 | forward 6 769 | forward 7 770 | forward 2 771 | down 8 772 | down 5 773 | forward 5 774 | down 6 775 | forward 2 776 | forward 7 777 | down 6 778 | up 5 779 | down 4 780 | down 7 781 | up 9 782 | up 4 783 | down 1 784 | forward 4 785 | up 6 786 | forward 2 787 | forward 8 788 | forward 9 789 | down 5 790 | forward 1 791 | forward 1 792 | down 6 793 | up 9 794 | forward 7 795 | down 9 796 | forward 4 797 | forward 2 798 | forward 6 799 | forward 6 800 | forward 7 801 | up 6 802 | down 8 803 | up 8 804 | down 7 805 | forward 6 806 | up 2 807 | forward 6 808 | down 1 809 | down 5 810 | down 6 811 | up 8 812 | forward 5 813 | up 5 814 | forward 1 815 | down 9 816 | down 1 817 | up 4 818 | down 2 819 | up 8 820 | up 2 821 | down 3 822 | up 4 823 | down 3 824 | up 5 825 | down 4 826 | down 2 827 | up 9 828 | forward 2 829 | forward 8 830 | down 5 831 | down 3 832 | forward 4 833 | forward 3 834 | forward 3 835 | down 6 836 | down 8 837 | forward 6 838 | down 1 839 | forward 6 840 | down 8 841 | down 7 842 | down 7 843 | forward 6 844 | forward 5 845 | up 8 846 | forward 7 847 | up 6 848 | down 7 849 | forward 7 850 | down 8 851 | down 8 852 | forward 7 853 | up 4 854 | forward 4 855 | forward 1 856 | up 1 857 | down 5 858 | up 6 859 | up 6 860 | up 7 861 | down 1 862 | down 2 863 | up 3 864 | down 3 865 | forward 6 866 | down 7 867 | down 9 868 | down 1 869 | forward 2 870 | forward 6 871 | down 9 872 | up 2 873 | forward 6 874 | up 7 875 | forward 5 876 | down 6 877 | down 5 878 | forward 2 879 | down 9 880 | forward 8 881 | up 7 882 | down 9 883 | down 7 884 | forward 8 885 | forward 7 886 | down 6 887 | down 7 888 | forward 1 889 | down 9 890 | up 6 891 | up 8 892 | down 4 893 | down 2 894 | down 4 895 | down 2 896 | down 5 897 | forward 9 898 | down 3 899 | forward 3 900 | forward 1 901 | down 2 902 | down 4 903 | down 1 904 | up 3 905 | up 7 906 | down 5 907 | down 8 908 | forward 6 909 | up 6 910 | down 2 911 | down 3 912 | forward 3 913 | up 4 914 | up 3 915 | down 6 916 | down 3 917 | forward 4 918 | forward 7 919 | forward 3 920 | up 7 921 | forward 3 922 | down 8 923 | forward 7 924 | down 3 925 | forward 8 926 | forward 2 927 | forward 4 928 | down 5 929 | forward 3 930 | down 8 931 | up 2 932 | forward 5 933 | up 7 934 | forward 2 935 | down 2 936 | down 5 937 | up 1 938 | up 7 939 | down 4 940 | up 9 941 | down 4 942 | forward 3 943 | forward 1 944 | up 9 945 | forward 1 946 | forward 3 947 | forward 1 948 | forward 5 949 | forward 2 950 | forward 6 951 | up 6 952 | down 1 953 | forward 1 954 | forward 6 955 | forward 6 956 | forward 5 957 | down 6 958 | forward 8 959 | down 4 960 | forward 3 961 | forward 4 962 | forward 1 963 | forward 9 964 | down 4 965 | forward 5 966 | down 2 967 | down 3 968 | forward 7 969 | forward 2 970 | forward 1 971 | forward 5 972 | down 9 973 | up 3 974 | up 7 975 | forward 3 976 | forward 2 977 | down 2 978 | up 7 979 | forward 9 980 | up 4 981 | up 2 982 | up 1 983 | down 5 984 | down 4 985 | forward 2 986 | down 6 987 | down 5 988 | down 6 989 | forward 6 990 | down 9 991 | down 1 992 | forward 2 993 | forward 7 994 | forward 4 995 | down 5 996 | down 6 997 | down 2 998 | forward 7 999 | down 3 1000 | forward 5 -------------------------------------------------------------------------------- /day08input: -------------------------------------------------------------------------------- 1 | dbcfeag cgaed fe bfgad aefcdb efa efgda gcef dcaebg dfeagc | fae cfge fae baefdc 2 | ea bfecadg bgafcd deac ebcag eab debfag eabgdc bcgfe bagdc | cdbagf fagbcd bae fcegb 3 | fbgdec cbgeaf cbfag bd bgda cgbfda dbf fecda bfadc cbedagf | gecfdb cbfga bacgef dfb 4 | geabdf cfbge dcbeaf aebdf dgea acdgfbe fag gfbea ag cabdfg | dfeabc dbaefc fdaebc fga 5 | gcae cefdg abdcgfe cg fcg afcegd dbgfea agdfe dcafbg bcdef | gc caefdg gcf egdcf 6 | efgcb fbac dbefg bce efacg fbgcdae cb egfbca dgfaec dcgbea | fgecb bcfa bc efcag 7 | efcgdb da bdefg dfegba fbacg gbcdea dbafceg adb feda fadgb | da ad cgabde cebdga 8 | ca fcabegd facd agbed acg cfadeg acdeg agcefb cdfgeb efcdg | cdeafg cag efgadc gacbfe 9 | fdacgb cfa cfage gabce dfagce edagfb dcbfeag fc fced gfdae | gabdef fdegba gaedcf fac 10 | acgdbf faedcbg fa cbgdae fgbdae aedbg adf fbea cfdge fedga | fad egdcf feab bfcagd 11 | ged cadgf gcdafeb cabgfd cgedf aedc ebfcg faebgd ed fcadeg | dfgca gabefd dafgc ecfgd 12 | bcedga dceba gcadfbe dfec adcbfe fda fabge df fbdae bcfgda | adgcfbe fbgae dgebafc gacedb 13 | fgcabde edbcfg efcdga dfbcea dbaeg fea fa dbaef acfb dbfec | aecbfd aedcfb bdaef abfc 14 | cfbd gefad dce fdeac dc ecabfd dgabce gabdecf afbce fagceb | bdfc bcgaed bgdace afegd 15 | acfgde egdfb dcaf gecfd ecdbgfa gcdbae cefgba dcg gcefa cd | eadcbg cdfega fdgeac dgc 16 | cadfgb edcgbfa dc cgd fegcb dfabg cdaebg dafc fcbdg gbdeaf | afdc adcf befdag gfcdb 17 | deafg ebafdcg gcdfba bge eb fgcbd gbefac bdce fdebg gdcfeb | cbdagf bdce gdfeb fgead 18 | acbdef bg agebdf afbcg fgbeca edafcgb eacfb gba ebgc fgcad | begdaf gcbe ebdfag dabefg 19 | ga agc bdegcaf gefbc cfdea dafgec fagce dgebca aefbdc gdfa | acfedbg bfaecdg gca facedg 20 | abdg ad egcabf ebagf afd gdfceab dcebf dagbef cdgafe deabf | bfedc cbedf gdab afd 21 | efbadc cafbd eba fegda fcbe dbefa efcbdag adbcge badfcg be | be agdfe cedbag dcbeaf 22 | adegb cgafb badgcfe fged fgaebd eabgf bceafd eaf eacbdg fe | bdgeac adgbfe bdgae acfgbed 23 | dbfega befag gbfdec gacfed fcgdabe bgf deagf bf dafb bceag | bdfa cagbe gceba agbdfe 24 | fecagd cbfeagd fdecb fg fgbde ebgda cagdbe fge gfab agefdb | geabcd gdbea ebgafd egdab 25 | ab agdcfe dcfgb cba adefcb adfbc bdae ebacgf aegbdcf fcade | gfecda dfabc edab bfcad 26 | bcfae ebd gefdacb fdceg dbaegc gdbf gcefbd cedfb adfgce bd | gebdcf bd dgfb ebdcgf 27 | gbcafde cdaef dfe ecbf egcda fadgcb bfdac dacfbe bgefda ef | dcgafb dfaebg fbec agbdfc 28 | fe cfedab dcfgeb gdbef gadeb cegf fgcbd fbe abdcgf ebacgfd | debfg abecfd adbefc gdcbfe 29 | ad cbfeda acegfb gdcaeb adcgfbe bda abefc dcabf fgcdb afde | gdcbf cedbaf dbagec becfa 30 | acegb efcgab edcfgab aebdc gce ge fage egcdfb agfbc cbdfga | eg cafegb fcbeag acbgef 31 | bcaf agefdc bcegaf eaf bdgfe agfdecb efgab af abegc dgacbe | defbg dgaebc eaf cebga 32 | edabcf bdeg gd cadebg dgcab gfcaed febdgca cdg beacd cagbf | befadcg fbgca afdecg bgceda 33 | gadfeb ag gfda cbeda fbeacg bgdcaef dgfeb eag gbdea fegcbd | cabefg degbcf gdbef bcdgef 34 | efbcda cgfd dgefac dfcgbae degaf adg debacg aedcf gd aebgf | ecfad cgbade aegdcb gfbae 35 | bdc cdfgb cabgf gabd fdebagc eabgcf bd abdcef gfcabd fgedc | faecdb fgecd cbfdag bcfadg 36 | dfagbec ceg egfad fdeabg acedg afedcg gc bcgaef eacdb fdcg | gcfd eadbc dbegcfa eabcd 37 | gfb egfba eadcfb gf adfg dgebfa dacfegb eagcb cbedgf fadeb | edfba afgebd adbegf efcbda 38 | fec caegd efgb cgaedfb gfbdec gfdbc ef cfdgab fdcge fbaedc | abcdef gcfbd bfegdac gcead 39 | gefdba abcef ead gedcab ad bfdecg cbged ebcad cafbdeg cadg | defcgb ade bgecd ceabf 40 | cabg adgefbc cb ebafg febgc fbc gdcfe cafedb egfabc aebdgf | bcdafeg ecbafd adbecf fbcge 41 | acged febgd agdcfb bdceg gdbecf bc bgc cfeb cfgbaed bgefad | dceag efbc cbfdeg ebcdfg 42 | gab adgcbef cebfg abdce dcbefg bafdgc abefgc aegf ag cgbea | gaceb aegf fgcbe cgebf 43 | fa baf cadfbge dbgef ebacgd dfceba adbec fdeba cfae dacgfb | dabcef dafcbe acgdbe ecdfab 44 | fgeca gecadfb aecdfb fb gcbed dfgb cgdbea ecfgb gfbdec efb | abcedg bf bf agedcfb 45 | fg aefgd bafcde gcfe bdgae gfa fedca cagdfb cfaedg ebgacfd | dcfgab dgfea gf cafdgb 46 | afbcge debgc cafdbg ae eadf afdgb gbdeaf aeb cgfebad abgde | deaf cbafge cbegd aedbg 47 | fbc afcegb fadgc fbeda cbed ecdafb cfdab cb fegdcab bdaefg | cgfad ecbd edafb cgafd 48 | fegbcd abcf gfabedc bgcad gfacd gedab efdagc dfgcab cdb bc | fbca cdbag cdfgab cgedbfa 49 | gfca gbdef eadcfg ebdcag dcg afecd gc decafbg fcegd bcfade | gcefd bcdafge cdefg edfgc 50 | gdae ad gecfd dcfaeb dfegcb gdcaf fdacge adf agbcf cebfgad | dgebafc edfgc da cbgafed 51 | ceg febgdca bfgdea gc adcfge cefbag agdc edfcb dfgce gadef | ceg ebdagf agdfe afbgce 52 | dabegcf bcdfag gdecb gdbeca gaebd fbdce bdagef cg bgc ecag | dfcabg abfdge gadbe cg 53 | dacefb efc gfaebc gbfe egcda agfbdc beadfcg fe fbcga cgafe | ef fbaedc ef efc 54 | cbgae faedbg fegab agc ebdgc eacf bgeafc ca cgdbafe gadcbf | eagfb aebgf gcbfad gfeba 55 | dcf dacbg bdcaef dfeacg gacfe cdfag fgde faecgb daebcgf df | fcd fecadb egacf deabcf 56 | egdfa dfaec gdab ga agf dbefga dgebf afbgecd bgafec bgefcd | fegbd gdfbe begdfc efcbadg 57 | cfd edafbc afbd cadbeg fgecbad gcaef dacef df dbcae efcdgb | adbf cabde baegdc cgbeda 58 | cbag gc cdgbe defbg agebdfc becda dbgcae cdg efacbd fecgad | fcegabd abgc dacbe cdaebg 59 | bf dacgf dfb befc fbedcg gebdc dbacefg abdegf gcdfb bedacg | bfec feagcbd egdcb daegbf 60 | aebgfdc gadcf gcdfeb dagce agdeb acfe bgacdf dec gfecad ec | ceadg edcag fdcga cdbagef 61 | befdgca dgcbf fedagc be bfe dcefb ecfdba acfed ebca ebgfda | dfbcae bafgdce bgcdf egbdfa 62 | bfa bdagfc dbega bfgea eagfdb dbgace bcefg dcbgeaf fa defa | ebcgdaf aecgdbf fgcadb fa 63 | agcdeb cgf agbdcef bgdfe efac cgefb abefgc cagdbf fc gebca | fegbc acfe becga deagbc 64 | adbfce agebd eadcbfg ega abedf fgab dgebc dgfcea ag agdebf | gdfcabe ebadf ga bfag 65 | gcebfd feacdbg acegfb afgce gbac geb cdaefg daefb gb fgbae | agefb gb adfbe efabd 66 | gadbfc ebgad dgecba fgae eacgdbf af ebcfd afd bdeaf gadefb | fa bdgaef gdbacf af 67 | bfeacd edgcabf dg gcabd cdaeb acfgb bcgdae dgae cgd bgfdec | bedac acbed abcdfge dgc 68 | cdage dgabec cbadg ge acfde edg becfagd gbec adbcgf fbeadg | cdbgea cgdaeb cegad gdeac 69 | ab gbaf cdegba fceadbg gfbecd bca eadcf fgeabc becfa cebfg | cagfeb cefabg fcbeg eadcgb 70 | afdec bcaefg ca abcd efcdg aec aebdf cdafbe begdaf eadgbfc | cdfeg afdce edfac gdfabe 71 | faebd fed df bgdcaef cbdega gdbeaf fbecgd badge afebc fadg | dcebfg dgaf fd cdegfba 72 | abdgf efg fe gdeabf cdbge cfadeg gdbef cafgdeb fbea bgcadf | bgdfe fabe gbfadc gbfcda 73 | agdfe cfbd dgfca cd abgfc cdgbea gbecfa gbadcef cda dfgbac | cegfba fbcd bfdc dca 74 | acdb bdcega dbfcge aedfgb dec fcega dc adegc fgceabd gaedb | badeg bdecgf cd cdageb 75 | abe ab dbecfag adgec agbf eadbg cbeafd fbcegd gadbfe bfgde | ebgfd efdgb gceadbf ba 76 | dgfceba egbcaf fgc bfgdca cbgfe cg faebc agce gdfeb debcaf | bedfac edbfg aegc eabcdgf 77 | bdfac dcfeb dbcefa dbgcaef fbae egdcb fgaecd fec cdbafg ef | bdfagc dcfabg gdbfeca eabf 78 | gfca dbcaf bfcgd fcgdeab degcb abcedf cbagfd gfb fg fdgabe | gcaf bfg fbg gf 79 | efcagd dbag fgd defgacb aebfg dbgfe bdeafg edfbc gd fgecab | fbeag ecgfabd degacf debgfac 80 | efcbg bacfe gbdce fge acegbdf cgdf aebdfg dgbcae ebcdgf gf | caefb cbfdage ecfgb bgedc 81 | fgdeb dcbfg fgae fbeagd edbfa aegdbc egb gafecdb bfdeca eg | dgbcea bdaef gfbde dfgbea 82 | bdcaf gdafc cbf bdefa cb fgceda bdfagc fcbgde afcgedb cbga | gbca fbdca cegfdb fcagd 83 | cfebgd cedgfa dcfabge dbfgc dgeb ge fcegb gfe abfdcg fecab | fge fabec gfbadec bfceg 84 | aeb ab gebfd abcdef edcag cdegaf gaedbc bgfecda debag gbac | beacgd bdfeg afgecd gedbf 85 | ab gebfadc acfge edafbc abegc dcegab gbecfd gbda cab ebcdg | dagb cegfa bca bac 86 | gaedb ebcd fgcea cba dcgafb febadg egcab adcbge efgadcb cb | dfcagb cbed bagce dbce 87 | ca dgfceb bfeacd fcbgd bdgca cfag gaedb abc fcbagd fgecadb | cgdfab cfag bac cbfegad 88 | gade gafcb bfgecd bge ecbda gdcbea eg beacg fdaecb agfbecd | dgae bgfca abegc cfdebg 89 | eac cdbef ac gfdae dagc afcedgb dcfae dafcge dbfega caebfg | gafceb dbeacgf cdga fbcde 90 | dbagfc bgedca df afgec daf beagdfc aefcbd bedac acfed dbfe | bedca cdaef baecfd befcad 91 | fdacb baedc acedfb bacedg fd gfcab ecdf daf fedgba befgdac | egabcd cedab eabdfg adf 92 | efdgc dfecga adfbe ac cage adc gfbdec cagbfd efdabgc caefd | efdab efdgcab ca cedfg 93 | ca acgf cadbgfe egfcab gefab cea defbc fecab edbcga fbgdae | cfeba efdcbag dacebg agefcdb 94 | bcedfa agecd ebgf fcbdg fde cgfed acgbfd cagfdeb ef cgbdef | fgeb bcfdg def ef 95 | bfcdea ga fbdegac gecdf cfdab bcgadf facdg aegbcd gac afgb | cbadfg facdb afbg dfecba 96 | fdcae afeg fa bceda dfebcga afcgdb dgecf acf fgceda cbfdeg | fa bdfcga fcbegd efacd 97 | efgbcd cf bdgace fgbad dfc fceabd dbaegfc bdcgf becdg gfce | bcedaf adbegc badgec bgcfd 98 | efcba ebdfga fda gdefbc da facde dacg fgedc gfeabcd acdefg | da bgafde cegfd edafgb 99 | daegb cbge bgcaed afgced ge cdabe fdbcaeg fcbeda bgfda eag | gae egcb egbc egdafcb 100 | cefda fadg bfedac bedfacg dgecfa eag ga fegcb becagd gcefa | dcfea eag cedfa bgfcaed 101 | dcfe gbeafd df bdcaf ebfcag fcedagb cdbag dcfaeb eabcf fbd | dfce geacbf cefd ebdacf 102 | efgbc agbd gd eadgcf becdfa bdace dge debgc adecgb bfdgcae | bgcfe bedcg abgd gdba 103 | cdbf edbfgc feadg cd ced gaecdb degfc efcgb fcbgaed befcga | cfabgde fgdcbe efacgb abgcef 104 | ae caegfd eadgc fedgba fecgd gbacd efac aed afcbged cgdbef | ae eacf abdegcf eda 105 | fc afcge dbgecf adcgfe eafbg gdebacf eagcd gfc aecdgb afcd | cfg dgeac afbge edgcba 106 | aedcg gfd cafgebd fg eadbgc adfcb cefg gabefd dacfg efcgda | dgeca afgedb cfdga aefgcd 107 | bfgaed facedb fbec dbgca cagfbde egcfda efdac acbfd fbd fb | efbc agcdb fagdbe bacdf 108 | fac dcae fgbda fagbce bdfac cbdfe ca cadbfe aegcdfb cebdfg | cdea cfbdeg ac afdcb 109 | geabcfd gfcaeb gcbead eba facbg fdgcab ea bgafe fdgbe caef | bagef cafgb afbeg cbgaf 110 | gcfdeb ceg fabcge edbag fcabdg bcgaf ceaf ec agefbdc cbega | bgafc baecgdf bcfged gbdfeac 111 | cf adgef cfgbaed bfdc gfc egcdfb dcgaeb degbc fcedg ecagfb | fdbc cgdbe gdabce gfdce 112 | bc afgcb cfdga dfcb cbdgea bgc efcgdab cfedga beafg bagcfd | bc bc cbfadg adcbge 113 | egdfb fa agfbe eacf befagc fba fbedacg cadebg agcbe cfgbda | bagfec bcdgaf cbfgad dgcbfa 114 | acgbde acgdbef cba ca bcgfd cade egdafb aebgfc agbed adgcb | fdgbc gbadef gfcdbae edfgab 115 | egbac efacgd gfbd fbcdag fecbad dgc badcf gfcebda dbcag dg | bacdg facbegd cgd dfcgae 116 | adgcf fbgcda efcgda dcbea fedg cfebag fae ef acdef gecbfda | fcagd gcadf gcefdba gefabc 117 | fegdba ba cedgaf gbade bfad egfda gba cadbgef gbced fcaegb | gedaf bdega abgde bafd 118 | gbacef gdab defgc bagfdc dfb afgcb efdbac bd dfbcg befcgad | cdgef bd gbfac ecbgfad 119 | fgacd ef dagfce ecdfa fae adfbgc cegf febdga ceabd bgacedf | abcgfed gfce fae efacgdb 120 | fbgdc afedg gcbafd gfedbc cfdag acd fbdeacg acbfde cgab ac | gdcbf cedfbg dacgf dcafg 121 | becf feadb abfedc dfcageb gcbda bafedg aec daecfg acdbe ec | abdef fdeacg ace ecbf 122 | dc cbfegda bfeadg dbcg gabfd adc dbcfga bface fgcade fdabc | dacbgf dc cdfba dc 123 | bc bfgedc fbc adfbceg cegb degcf eabdf defcb cdfgae fcagbd | bcefd gceb fcagde cbfgad 124 | ge cabgd egca egd adgbecf bfdagc decbag agbde deafb ebdgfc | cagdfb bgecda cgedba fabdcg 125 | cg cfagbd gcedfa efdbc gcd gbefda fegad efdcg caegdbf agce | fgced dgfacb befdagc cefgda 126 | bfedgc bec ce fcaebd efabg gdec cgfdb aebdfcg bfgcda cgbfe | agebf bgdcfe ec agcbdf 127 | db dfcbge edgfca gabd dcb agfcd bafcd afbgcd ebafc edgfbca | acfdg cbdfa afceb gbda 128 | cadegbf egdfbc adc acbdg dgbcf adgfbc da cgfdae fbda ebcga | dgacb bagdc fgcbd aegbc 129 | geacf abc gfedba cbadfg dbcg gfdba cagfb cb bfdcae adfecbg | cb eadfgb bcfag dgcb 130 | abdfcge adbeg badcef egcf fg fgb fbdec gebfd abgfcd gfebdc | cbeadgf cfdbag gfdbe gf 131 | facdbe acgfbd dbc bd abgcd adceg bcegfa fdgb bfgca badcfeg | ceafdb bfcag dcgba bgdf 132 | gcda cadbe abcedf cabeg edbgcf begcda begaf cg acbdefg gbc | dbace gdbeac dacfgbe abdce 133 | cgf gf fadegbc afgcde abgced fecba ceagf dcagbf fgde cdaeg | gdebacf gf gdfe cfega 134 | abdef bc gecaf dbcgfae cbfg efcba bac acebfg degcba dcegfa | bcfadeg afceb edfgac gcabed 135 | bfcged bgdac becad fagc aegbdfc gacfdb dbgfc dafgbe ga bga | fgdecab abdcg cefabdg egdbfa 136 | abcfg baecf agec fcgaeb agedbf ag dacfbeg bag eafcdb fcgdb | bcdfea efdabg ga fdbgc 137 | ba baf dfbgce cgab cefgdab efcad efacbg cgfeb ebafgd cafeb | fdcegb abf baf ecabf 138 | cegafd egdcba gbedf cgfde cfad ecf fcegadb eagdc bgaefc cf | bfged defgb gbfed efc 139 | gedfa abdce fadbe ebfc fba badgce bf gabefcd fdbgac befcad | bcdgaf fdbgca bfa fgbdca 140 | bacef cg dgabec agfc edfgb cge agfdbec fcabeg cgebf abfdce | decfbga cagf adcgbe dgefb 141 | eafgd ce fbgaced ecfga eafdgc gdce cea cefdba cbfag bdgafe | eadfbg dgec efgca degfa 142 | decgabf fecd acd acbegf agdec gabed gacbfd faceg cd fgeadc | dc dcafge abecgf dc 143 | egd fdaebg gcbeadf fcdge ge adecf gbce dgfbac dcfgeb gdbcf | fdcae gfdbea bdfcg eg 144 | ad cbafe dabe dfa gbfcea ceafd dcbagf fabdce bfceadg dfgec | cebaf aecbgdf cgdbfa fbaec 145 | fc cdgbae gfcbad badcg fcdba feadb fac cgefad fdgbeac gfbc | cf cfabd caf gdfcea 146 | fdgace edac cdfag de dcfge facebgd cgebf dfebag def bafgdc | fdgac gacfbed edgacf dgcfa 147 | gedfac acedb fbcadge acgefb dbgf fdaeb dgafe fgaedb bf fba | fb bf bf agefcd 148 | gefbdca fagbed cgaeb gf ebdfa gdbf afebg feg feadcb geacfd | egf fedab gaefb eagbf 149 | efadgbc bfag edgcb cga cefab afbegc ga gaebc eafcdb daefgc | ga acg gcfbade dgecb 150 | efcgbd gebcf gcadbf agfce fcdeagb gfa ageb aefdc ga gacbef | gcebaf geba acfde fga 151 | ga adbg fdeac gfa fdgbcae dgfabc cfgdb fegbdc fcabge agcdf | adbcfg efadc agcdf cgdbf 152 | febdc dacfeb gbfce cfgae bge bgdf dgcfbea baecdg gb ecfgbd | gb fcedb becdf gb 153 | bgacfd cdfabeg adgce bcegd acdefg gb cgb bgae ecbadg bdfec | adcbfg gdfcea deafbcg ceadfg 154 | bc gdfeac fbaec egfcba dacbeg cab gacbfde eabfd faceg fgcb | afbegc cdgabe bagecf ebcdga 155 | fd dfe fdgae abegfd dbcaeg dfgb caedbf efcag dageb dbfeagc | dgfb gaedbf gfbd dgfcabe 156 | agefbc aefdb abdge cdef bfdcga dacbf fe gbdcefa eabcdf efb | cdbefa adfcbg fecagdb ebf 157 | gbade adecfg abegcdf dcbfa cgbafd cfeb dfaebc fe feabd efa | dbcfea bcfe fecb bafde 158 | dfba dfc efbac cgead ecfgab gdfecb edacbf df afced bgecfad | afdce bcfegd efgbac adgce 159 | abfcg egacf bceafg dabgc fgb fb fbecadg fbce gafcde gfdbea | abdgc defagb cbef egcaf 160 | caegb decgbfa cebf edacg cgfbae gbc gfbea baedgf bc bfcdag | agebc bgcae cbg gefba 161 | ad gadf feacg aed agbfce egcda fedcba abcdgef bcdge gecafd | gedfca ad febgac dcaebf 162 | cegbd bgcfda dbfeag acef gcead cagfde dcfga gae fagbced ae | defgab dacgf cebdg gecdfa 163 | fag edfcg cdfa fa ceagfd fdgabe gebac egbfcd egdcfab gcaef | acebg fag fgdec dfegcb 164 | abe bcdfa acdbgf befd eadbc acbfgde eb fgcaeb gacde fcdbea | eadbc afdgbc bgaefc cabfdeg 165 | afdgce dgabe dgfbe bdegfc dfg agcbdfe fd abegfc dcfb bfgce | debag bedgf ebdcfg cgebafd 166 | dgfcea eagcbd gfceb adgb cgdeb dg eacdbf bedcafg dge abedc | ecbgf dg dbfcgea ebcad 167 | dgecf badfce egcdfab efabd edfca ac badc gbcfae eagdfb caf | feadc febad dacef caf 168 | gfb bacgde acbdgf afbd bdgca bf bgfdcea ecfag dgfecb fbcag | fbgdcae gdfbca fbg fgaec 169 | bcdg dc gedabc dec cdeag cbedaf gfaebc dafge bcegdaf agceb | dfage bcefad cfbage fdgae 170 | gc cag agbec dacbe dcbg edcbgaf gdcfae dacebg eabfg febacd | gc cbdg gc fedcba 171 | gfdbace edbc ecfgab efcdbg ce fdcabg fedga egc cbdgf gedfc | ecdb edgfbc eagcfb cdafbg 172 | afceg bgdeaf daceg degacb fe dfec adfgec acdgefb gcbfa gfe | efg gcfea dcfe fcgea 173 | bdca gcfdbea dc acbedf gbfde cagefd cfebag dcf bdcfe ebafc | eafbc bcfage defcb agcbfe 174 | cabefg adgeb fd dacf afgcb bgefdca decbfg fbd dafgb dfagbc | gbfca cbeagf cfbgad fbd 175 | bacgef defcga afdgebc facebd afebc badc bdfeg dc dbfec dce | adbc eafdcb dabc fgedb 176 | cdf decb fagec dc dcgbaf bacfgde gdfeb efbadg efgbdc cfged | ecgfa efgbd fedgab dc 177 | faebgd egdfcb gecadb gdbce ag aeg cgeab gacd faecb debcafg | ag fdeabg decbg ag 178 | eagc bdegf ga gdaef adg cbgdaf cfaegd dabfce adcegbf dfeac | acedfg agd cega bgefd 179 | cfgbe ceadf ab cbefag cegfbd bega egdfcab fba gbfacd efcba | ceafbg abf ecfba ba 180 | fgdce ecgbaf gebd bfg fdbac dfacge fbegdc cgbdf dacbfeg gb | aebcgfd cdabf ebdg egdcaf 181 | febda edagf egf gdcf bcgafed fg agcbfe caged gcadeb dgaefc | cegbad gcdf gaedc ebdgca 182 | eabgf fbdcg dfecag acebgf bafdge fbgce ecf eacb begfacd ec | fbgea gcefb fegcad decfag 183 | fabgcd febdac acgdf beagc dgaec de eafcdg dcfbeag dae fdge | fcdgea ceadg fegd bdcaef 184 | bcafeg ecbad dcfe ecbgafd gdefab dfabce de cadgb ebd fcaeb | bed bgeafd fgeacb ecdfba 185 | afcgeb gcebf cdbfag cfea bdgfe cbgaf ec gfabecd bedgca egc | gce dacfbg cebfg afec 186 | ecdafb cfeag bdgaf febga egabfc eb gbec fcebdga eab dfegac | bea gbafd eab befdac 187 | fgbacd fbcedga fgc fg gdaf bcdgef cdfba fabced cgbfa gcabe | egcadfb adgf gbcefd gcf 188 | dfbcga caefbd ac gaedbfc afgc afgdb bdgce dgcab fdgaeb dca | afbgd cagf adc bfedga 189 | bdgce dbf cgeadfb fd gfbde dfbecg gaebf dacgfb cdebga dcef | fegbd fgbde bgfde fcegbd 190 | gbda egadbf bfegd acgfde bfgaec gabef cfbde aefdbcg dg ged | abgefd gdefba deg gfeba 191 | afebcd degcfb dce dcfgb degf bdcgafe bdcge gcabdf de cbaeg | de bagec gcdeb ebagc 192 | eadcfg dfc gcbfade cd edafb fbcge afdbec agdbef ecfbd bdac | efdab agefdc befad defabc 193 | agbedf degbfc begcd ceagdf cgabe ecd dcbf ebfdg abecgfd cd | fdebg fdgbe cdgeb bagdef 194 | aefdb degf fdbaeg egb agebd bcfage gcedfab bdagc ge febacd | bgfdae fdge acfdeb deafb 195 | cegfba dfcea gbea bac ebafc gdcebf gebcf ba gfdbac gacfdbe | febac aefcb cbfgda cafed 196 | ec ecfab feadbg ecb dabfc cbfegd dbafgec feabg caefgb ecag | acbefg afbeg fecgabd bcfad 197 | fd decag fagbe beafdg egdacbf gbfcde dbfa agfbec dgf geadf | bfda befgcda fgd adfb 198 | af eabfdg edabc dgfabc efga fdbae fcagbed abf gbcdfe efgdb | gefa gfabcd fba gcdfab 199 | dbfacg degcb gecdaf adcbg bafegcd dfbag gbdefa ac cabf agc | bcadg afbc bdgfa abcdg 200 | efab cbedg aedfbc bfcad geacfd ea fabdcg adbfgce ade ecabd | fdceba bfceda ecgdfa aefcdg -------------------------------------------------------------------------------- /day03input: -------------------------------------------------------------------------------- 1 | 011111111101 2 | 011000010111 3 | 000000000101 4 | 000111100001 5 | 011011010000 6 | 001011011100 7 | 111101100010 8 | 010001011011 9 | 010001101001 10 | 101001100011 11 | 111010100010 12 | 110110110110 13 | 110100011110 14 | 001101010010 15 | 110010000000 16 | 110000101111 17 | 111011011010 18 | 010111010010 19 | 011110100010 20 | 000011101001 21 | 001010100111 22 | 001100111100 23 | 101111110110 24 | 101111010101 25 | 110000010111 26 | 000111011000 27 | 110110100001 28 | 010110101010 29 | 100110111011 30 | 010100010111 31 | 010001100001 32 | 110000110111 33 | 111010000101 34 | 100001101110 35 | 111110001100 36 | 001111010100 37 | 100000101011 38 | 100110011110 39 | 111100000001 40 | 001111101100 41 | 000100110010 42 | 001001011010 43 | 010101101110 44 | 110010101010 45 | 001010100010 46 | 101010011011 47 | 001111101111 48 | 100101000001 49 | 010100110011 50 | 011110110000 51 | 001110011010 52 | 011101111111 53 | 111111000000 54 | 101010010101 55 | 101000010101 56 | 011100010110 57 | 111100001101 58 | 011100011001 59 | 010100010001 60 | 010011000000 61 | 000110010001 62 | 101101100100 63 | 011010100101 64 | 010111101100 65 | 111011001101 66 | 000100110011 67 | 101000000111 68 | 010011110011 69 | 000000110000 70 | 000001101000 71 | 010010000111 72 | 010010001101 73 | 110101010110 74 | 000100010110 75 | 101000101010 76 | 000010111111 77 | 110101010001 78 | 101000100010 79 | 001100001111 80 | 101111101011 81 | 110011110000 82 | 101111000000 83 | 111010100001 84 | 100111101101 85 | 000000011010 86 | 100110000111 87 | 000010011100 88 | 100111010001 89 | 111010111101 90 | 110111110100 91 | 010111001001 92 | 010101101100 93 | 111000110000 94 | 000110111111 95 | 011110011011 96 | 101001110000 97 | 000000100101 98 | 000000001000 99 | 000110110001 100 | 001110110011 101 | 111000110111 102 | 101110101010 103 | 101111110011 104 | 101010010111 105 | 101000011011 106 | 011100110100 107 | 000110111110 108 | 010000010110 109 | 010111011111 110 | 110110110100 111 | 110000001100 112 | 011101001001 113 | 101011101111 114 | 011000001110 115 | 111011011110 116 | 100111000110 117 | 001111101101 118 | 000001101101 119 | 001011111000 120 | 001101010110 121 | 011101101100 122 | 001100110011 123 | 100101011011 124 | 111101010011 125 | 100110111100 126 | 111111000010 127 | 100000000011 128 | 110000000100 129 | 011101111011 130 | 111011000000 131 | 111010010101 132 | 010110001101 133 | 110111100100 134 | 101101011101 135 | 011110011111 136 | 000011101010 137 | 001010001101 138 | 110101101110 139 | 111100101101 140 | 100101010101 141 | 001010001011 142 | 111011100010 143 | 010000101111 144 | 101111101111 145 | 101100000100 146 | 101101010001 147 | 010101011111 148 | 001110010111 149 | 010010000100 150 | 111110011011 151 | 011001100111 152 | 110110111100 153 | 110111111110 154 | 001001000010 155 | 000110010100 156 | 001011111011 157 | 111100111100 158 | 011100010111 159 | 010111001110 160 | 111111100101 161 | 001000000110 162 | 111101101100 163 | 000000010100 164 | 110000010100 165 | 011110111010 166 | 111100101011 167 | 111010101110 168 | 010111001101 169 | 011010111110 170 | 000011010111 171 | 011011000100 172 | 110101111100 173 | 000100110111 174 | 000100001001 175 | 111000011000 176 | 000101000101 177 | 100000110100 178 | 110101111011 179 | 011110011001 180 | 111101100000 181 | 010100110111 182 | 101001001101 183 | 100101110001 184 | 111010110111 185 | 010010011010 186 | 011101111000 187 | 101100101111 188 | 010011001000 189 | 011101011000 190 | 100001010101 191 | 001010011011 192 | 001110101010 193 | 000000000001 194 | 110100000010 195 | 111111010110 196 | 100001011110 197 | 011010101011 198 | 101010000000 199 | 101100100110 200 | 010110010101 201 | 001101010011 202 | 011100001001 203 | 000101111110 204 | 000001001011 205 | 111100101110 206 | 010100101010 207 | 001101001111 208 | 010000101100 209 | 110000100111 210 | 110110010111 211 | 011110011000 212 | 110010000001 213 | 101000000010 214 | 101011011101 215 | 010001111101 216 | 111011110111 217 | 101001101001 218 | 100101001110 219 | 101110010100 220 | 001111101000 221 | 101001011011 222 | 111111100011 223 | 110111000011 224 | 100110001110 225 | 111001100001 226 | 100000111000 227 | 011110000101 228 | 000010001000 229 | 011111111011 230 | 001101000000 231 | 101010001001 232 | 010001001001 233 | 001010111100 234 | 011010100110 235 | 011100000001 236 | 001010110101 237 | 110011011010 238 | 001100001010 239 | 000100110001 240 | 111111110111 241 | 111110111011 242 | 101010010001 243 | 010110110001 244 | 001011010100 245 | 100100100101 246 | 000111101000 247 | 111010100000 248 | 100101001111 249 | 010111100001 250 | 001001001011 251 | 111101001110 252 | 011010011111 253 | 100010111000 254 | 111000010111 255 | 100111000100 256 | 010010000000 257 | 010010111101 258 | 001011011110 259 | 110000000000 260 | 001111101010 261 | 010000000111 262 | 111010101100 263 | 000110101010 264 | 010100011000 265 | 101010000011 266 | 101110111100 267 | 110000100010 268 | 000011010011 269 | 000000011101 270 | 101100011001 271 | 000100010111 272 | 110110001001 273 | 101110101101 274 | 110001010100 275 | 001110111011 276 | 010111010101 277 | 111001110101 278 | 100101011111 279 | 011001001100 280 | 110011011111 281 | 100001000000 282 | 110000101000 283 | 100111011111 284 | 110011111011 285 | 101011110011 286 | 111101101010 287 | 100010000010 288 | 110011001001 289 | 110100001010 290 | 111100011001 291 | 100011101010 292 | 101110100010 293 | 110110011000 294 | 101001110011 295 | 000010010011 296 | 101011001001 297 | 010110011010 298 | 111001111110 299 | 101000010010 300 | 010011001101 301 | 010001001100 302 | 110001011000 303 | 000000101101 304 | 001000000101 305 | 001101001011 306 | 001010110000 307 | 100110010010 308 | 110001010110 309 | 010111110110 310 | 010110000101 311 | 000110001011 312 | 011101001100 313 | 001011011011 314 | 000011000110 315 | 010100111110 316 | 010111000110 317 | 101111011110 318 | 110001110111 319 | 001001111110 320 | 010101110000 321 | 011001110101 322 | 101001010101 323 | 111010110000 324 | 110100110110 325 | 001011000001 326 | 001001111101 327 | 110110101100 328 | 010011000001 329 | 110111000001 330 | 011111001000 331 | 100001110101 332 | 000111111110 333 | 111110111010 334 | 000110111000 335 | 100100011000 336 | 010101100111 337 | 101001001011 338 | 001011010111 339 | 100010101000 340 | 000110011001 341 | 101010000010 342 | 001110100110 343 | 000011000010 344 | 010101111100 345 | 101101001110 346 | 111001011001 347 | 110100110101 348 | 111111000101 349 | 100001011000 350 | 100110111000 351 | 101000110001 352 | 001111000100 353 | 110010111101 354 | 011110110011 355 | 111100010100 356 | 110111011001 357 | 011000111110 358 | 111110011100 359 | 101000000100 360 | 000100000010 361 | 100001101010 362 | 110001101010 363 | 100010011000 364 | 100000000111 365 | 011011111011 366 | 001100011101 367 | 101110100110 368 | 011110111011 369 | 001010001100 370 | 111110001010 371 | 110010100101 372 | 010110101100 373 | 001101110110 374 | 001000011010 375 | 100011111100 376 | 101101011100 377 | 001100001101 378 | 101000110000 379 | 000110011010 380 | 111001111010 381 | 011000111100 382 | 000101111100 383 | 001101110001 384 | 101111110010 385 | 101110100001 386 | 110010111111 387 | 000000010011 388 | 000001001101 389 | 010100010010 390 | 100011110001 391 | 101111010000 392 | 101111001101 393 | 011101010101 394 | 000100111111 395 | 110110100110 396 | 010111101001 397 | 001101011111 398 | 010000100010 399 | 110001110000 400 | 110100010101 401 | 001001011000 402 | 101101001100 403 | 011000101001 404 | 111101011100 405 | 100001101111 406 | 101000111000 407 | 110000100001 408 | 000011111101 409 | 101000111100 410 | 101101000001 411 | 010111100110 412 | 101111111001 413 | 011111101000 414 | 100000010111 415 | 100001000010 416 | 011100100000 417 | 110111000111 418 | 011101010001 419 | 111101000110 420 | 110101100011 421 | 000000011011 422 | 010100011100 423 | 010000101001 424 | 010101110001 425 | 001100011111 426 | 010010010000 427 | 011101010110 428 | 011111001101 429 | 011011110011 430 | 000111110111 431 | 110000110001 432 | 101010100101 433 | 100101011010 434 | 000100010011 435 | 100001100010 436 | 000011100101 437 | 110011101011 438 | 010000100100 439 | 010000010100 440 | 101010100001 441 | 101011111000 442 | 000101110101 443 | 010010100011 444 | 100001100011 445 | 100100000111 446 | 010110100101 447 | 100111000001 448 | 101000110101 449 | 110101011011 450 | 000000100111 451 | 000100011011 452 | 111001100110 453 | 001001011100 454 | 011000011010 455 | 010010111000 456 | 010111011001 457 | 011100101100 458 | 000100011101 459 | 010010110000 460 | 011011001001 461 | 010010101111 462 | 001001110101 463 | 101100011000 464 | 100111000010 465 | 011100100011 466 | 000010110001 467 | 111110010100 468 | 100110100110 469 | 101101010111 470 | 111010011010 471 | 101000111110 472 | 010001101110 473 | 001010110110 474 | 101010011010 475 | 001111100000 476 | 101000010000 477 | 100101110101 478 | 100010110100 479 | 111001110010 480 | 111000110001 481 | 000101011011 482 | 101110010000 483 | 011100110000 484 | 100101010110 485 | 111001010111 486 | 000100100110 487 | 000010101001 488 | 101010001011 489 | 000011101000 490 | 000010111011 491 | 111111100110 492 | 001110111111 493 | 111001001010 494 | 000101101000 495 | 110010011010 496 | 101010101011 497 | 011010011100 498 | 010111011010 499 | 000110101000 500 | 011010100000 501 | 111100000101 502 | 010100101100 503 | 001110000010 504 | 111010011111 505 | 100110111001 506 | 011111001010 507 | 001110101110 508 | 010011110010 509 | 001111001101 510 | 000001111000 511 | 011010110101 512 | 001101110111 513 | 110010000010 514 | 100111111101 515 | 000111000011 516 | 000101101101 517 | 010101001000 518 | 111011110000 519 | 000001111110 520 | 001001000011 521 | 100100011001 522 | 000011110001 523 | 001111110111 524 | 001011111111 525 | 011110010001 526 | 010000110000 527 | 111111111010 528 | 101001000001 529 | 000100000111 530 | 110100001100 531 | 111000110010 532 | 000000000110 533 | 111111100000 534 | 001111111000 535 | 110111111101 536 | 000110101111 537 | 111100001111 538 | 100010101001 539 | 000100101011 540 | 100011110101 541 | 111101100110 542 | 001111000010 543 | 010000000011 544 | 101001100010 545 | 100100101101 546 | 000111110000 547 | 010011100000 548 | 111001100100 549 | 100011011110 550 | 110111001111 551 | 010101001111 552 | 011011110110 553 | 100000010010 554 | 001101011010 555 | 001001101100 556 | 001010010000 557 | 001111110101 558 | 110011011110 559 | 001000101100 560 | 010001111010 561 | 010111000000 562 | 100110110101 563 | 110001001001 564 | 010001010011 565 | 100101000100 566 | 011000000000 567 | 100011110100 568 | 011101101010 569 | 010101000011 570 | 001101011100 571 | 001000011011 572 | 011001110010 573 | 000010000000 574 | 000101010000 575 | 001101111110 576 | 011010000101 577 | 110101001010 578 | 010001111000 579 | 111000110100 580 | 001110000000 581 | 010001001110 582 | 111001111100 583 | 010110100010 584 | 001100011000 585 | 101110111111 586 | 010011010100 587 | 100001101101 588 | 011011001101 589 | 111000101011 590 | 100111010110 591 | 101000000101 592 | 111110001110 593 | 010001001111 594 | 001000101101 595 | 000011111110 596 | 100100010011 597 | 011110111000 598 | 010000001110 599 | 111001011110 600 | 001101001010 601 | 010101000001 602 | 011000101111 603 | 101100010010 604 | 000000000000 605 | 010110110111 606 | 101011001010 607 | 101010110101 608 | 001000110001 609 | 100101100101 610 | 101000110100 611 | 110101111111 612 | 010000111111 613 | 111010010110 614 | 101010100111 615 | 001011001111 616 | 010101010101 617 | 110101010011 618 | 111101010111 619 | 001110110010 620 | 000010010010 621 | 011100001100 622 | 010111110100 623 | 011011100010 624 | 101111101110 625 | 111000000100 626 | 111001110100 627 | 110010111110 628 | 111011100000 629 | 001111010111 630 | 101100100001 631 | 110111011110 632 | 111111001101 633 | 100111001101 634 | 111110110100 635 | 101101000111 636 | 110001100101 637 | 110110000010 638 | 101101100011 639 | 110111110001 640 | 011011101100 641 | 011011101110 642 | 100001011100 643 | 001100111001 644 | 100110001100 645 | 011101100101 646 | 101110000001 647 | 001111111110 648 | 101110111010 649 | 111101011011 650 | 100000110000 651 | 110010110100 652 | 001110100010 653 | 011011001000 654 | 100101111011 655 | 010100111100 656 | 101110110000 657 | 001010101010 658 | 001011010010 659 | 111000111100 660 | 111010101111 661 | 010100001100 662 | 001100101111 663 | 001011010001 664 | 101100001110 665 | 010101110010 666 | 110001001010 667 | 000010101010 668 | 111000001000 669 | 100111011011 670 | 110000000101 671 | 011000011011 672 | 000101111111 673 | 010100011011 674 | 001110111101 675 | 100001000111 676 | 111010000011 677 | 001101111011 678 | 011100101111 679 | 010101010111 680 | 111001010011 681 | 011011111100 682 | 110001101100 683 | 010110010011 684 | 101000100000 685 | 010010011100 686 | 101000110010 687 | 101100011010 688 | 101011011001 689 | 111101011110 690 | 001111100111 691 | 101010101000 692 | 001110110111 693 | 000000111110 694 | 101101101010 695 | 010010001110 696 | 010010100001 697 | 110010011111 698 | 010000001001 699 | 011100001110 700 | 111000001111 701 | 010001111111 702 | 111101101111 703 | 010010110110 704 | 100101010111 705 | 110100000111 706 | 110100010000 707 | 101010010010 708 | 100111100100 709 | 000010000001 710 | 101110010010 711 | 101001010100 712 | 101101101011 713 | 010101011000 714 | 110101011010 715 | 111011010110 716 | 110100100001 717 | 011011011010 718 | 010101001101 719 | 110101000011 720 | 111010110101 721 | 110100111001 722 | 101011000110 723 | 010101110110 724 | 010110100000 725 | 101101101100 726 | 111101010100 727 | 010110010010 728 | 011000111101 729 | 011100100100 730 | 000000001111 731 | 011101011110 732 | 011111001100 733 | 111110100101 734 | 001100001001 735 | 000101100101 736 | 101101100111 737 | 010101010001 738 | 000111001000 739 | 011001110011 740 | 101101111110 741 | 110110111101 742 | 000010011110 743 | 001000110111 744 | 110001101000 745 | 111101010001 746 | 111001110011 747 | 100111101110 748 | 011100110011 749 | 011110001100 750 | 100001100000 751 | 100011100000 752 | 011100000111 753 | 001101000101 754 | 111001010101 755 | 001001010000 756 | 000010101011 757 | 011001101000 758 | 100000000000 759 | 100101011001 760 | 100000100110 761 | 100000111100 762 | 001110110001 763 | 111111111111 764 | 100111110011 765 | 110000011000 766 | 111010000110 767 | 000010001001 768 | 101111100001 769 | 110100100110 770 | 011001000001 771 | 101011100101 772 | 001110100100 773 | 000110011111 774 | 010110011000 775 | 110000100011 776 | 101101111001 777 | 100101101010 778 | 111110110001 779 | 100101000000 780 | 010001110111 781 | 011001010011 782 | 011010001011 783 | 001010101000 784 | 011100001000 785 | 001001110011 786 | 001110000001 787 | 010101011010 788 | 000100100101 789 | 100110110110 790 | 001011111101 791 | 011101001110 792 | 100100111110 793 | 110100111101 794 | 010100111001 795 | 011010001101 796 | 000111100101 797 | 010011001111 798 | 010011001011 799 | 111101010110 800 | 000100011001 801 | 100110101111 802 | 111000111101 803 | 110101000101 804 | 010110001001 805 | 001001100001 806 | 101010101010 807 | 011011101011 808 | 000001101111 809 | 111000011101 810 | 101001010011 811 | 011101001101 812 | 111011111100 813 | 010001010100 814 | 110000101010 815 | 111010000100 816 | 011001100110 817 | 011011011110 818 | 010111001100 819 | 111110010111 820 | 100100001000 821 | 110011110010 822 | 100101110110 823 | 101011111100 824 | 000010110100 825 | 001010110001 826 | 011111111100 827 | 010101100010 828 | 001101010101 829 | 000101001000 830 | 000101101100 831 | 110110100101 832 | 010111001111 833 | 100100001001 834 | 111000100110 835 | 011000110010 836 | 111100011111 837 | 100100110110 838 | 111100100110 839 | 111111010111 840 | 000111100110 841 | 111100010000 842 | 110101100010 843 | 001111100101 844 | 010001001000 845 | 000000001110 846 | 101001000110 847 | 011100000101 848 | 011101110101 849 | 010100101101 850 | 110110101011 851 | 001011110010 852 | 001010011100 853 | 100010111010 854 | 011011111111 855 | 011101101101 856 | 100010110010 857 | 111111001111 858 | 100110010100 859 | 010011000011 860 | 100101111110 861 | 101100101000 862 | 011010011011 863 | 100001000100 864 | 001000111101 865 | 101001111000 866 | 100001110011 867 | 100111101001 868 | 101110001010 869 | 010110011001 870 | 110010101111 871 | 011101000001 872 | 110000100100 873 | 100000111001 874 | 101010011000 875 | 101011000010 876 | 001100010110 877 | 011010111000 878 | 110010010000 879 | 100101110000 880 | 001111110010 881 | 110011010100 882 | 011110101101 883 | 010101011011 884 | 110111011111 885 | 000010100010 886 | 000101111010 887 | 010010010111 888 | 011010111101 889 | 010101111010 890 | 111001000100 891 | 100001100101 892 | 111010001010 893 | 110001111011 894 | 111100011110 895 | 100011111011 896 | 011111110111 897 | 010000101101 898 | 010100001001 899 | 001000110000 900 | 001011010110 901 | 010001100110 902 | 101000001000 903 | 101100110110 904 | 010011101000 905 | 000111111001 906 | 110101011101 907 | 010000100110 908 | 100011011000 909 | 110110000011 910 | 001001001010 911 | 001000101010 912 | 000001111101 913 | 111111011000 914 | 111000111011 915 | 110011110101 916 | 101111111100 917 | 110010111011 918 | 001011010011 919 | 001001011001 920 | 100101111111 921 | 010100110101 922 | 100100101011 923 | 011111100110 924 | 001011110111 925 | 111110101111 926 | 000101100100 927 | 111101001100 928 | 110011101000 929 | 101110001000 930 | 010011100001 931 | 110000111101 932 | 011010010110 933 | 000011101100 934 | 011111100000 935 | 110100000011 936 | 011110111101 937 | 010000011110 938 | 100000011011 939 | 001111011111 940 | 000111011111 941 | 111001111101 942 | 011101010000 943 | 011010101100 944 | 110100100100 945 | 000011011100 946 | 101011110110 947 | 011100111001 948 | 100101010010 949 | 111011110101 950 | 110011000000 951 | 101001100111 952 | 101110011110 953 | 000101000000 954 | 110101111010 955 | 111000010110 956 | 100010110110 957 | 100110000110 958 | 010000100011 959 | 100001111011 960 | 110111000110 961 | 010110101101 962 | 111100111000 963 | 010110000100 964 | 011110010011 965 | 001011011000 966 | 101000101000 967 | 100111110000 968 | 111101110101 969 | 101110011000 970 | 011001110110 971 | 111110010011 972 | 100001011010 973 | 011110111111 974 | 011101110111 975 | 100111110101 976 | 101110111110 977 | 010111000111 978 | 011001111011 979 | 001110101100 980 | 011011101101 981 | 000111000001 982 | 101001111001 983 | 110001010001 984 | 011001001011 985 | 001101011000 986 | 001010010010 987 | 011100111101 988 | 110111001100 989 | 010011011010 990 | 001001100100 991 | 100101111101 992 | 100110001010 993 | 110101011001 994 | 110011101010 995 | 001111111100 996 | 100011000000 997 | 000111001101 998 | 010010010101 999 | 010110000000 1000 | 100111111100 -------------------------------------------------------------------------------- /day01input: -------------------------------------------------------------------------------- 1 | 162 2 | 164 3 | 165 4 | 166 5 | 175 6 | 185 7 | 182 8 | 191 9 | 205 10 | 204 11 | 198 12 | 196 13 | 197 14 | 213 15 | 216 16 | 217 17 | 218 18 | 219 19 | 213 20 | 219 21 | 221 22 | 222 23 | 227 24 | 231 25 | 221 26 | 211 27 | 230 28 | 232 29 | 241 30 | 243 31 | 256 32 | 272 33 | 274 34 | 273 35 | 279 36 | 287 37 | 288 38 | 287 39 | 286 40 | 288 41 | 289 42 | 291 43 | 292 44 | 294 45 | 292 46 | 296 47 | 307 48 | 314 49 | 326 50 | 332 51 | 337 52 | 347 53 | 330 54 | 333 55 | 346 56 | 344 57 | 357 58 | 362 59 | 365 60 | 366 61 | 328 62 | 323 63 | 350 64 | 362 65 | 336 66 | 346 67 | 348 68 | 325 69 | 329 70 | 330 71 | 329 72 | 333 73 | 365 74 | 363 75 | 376 76 | 377 77 | 369 78 | 343 79 | 365 80 | 360 81 | 362 82 | 377 83 | 376 84 | 379 85 | 374 86 | 376 87 | 377 88 | 369 89 | 371 90 | 374 91 | 375 92 | 377 93 | 384 94 | 401 95 | 372 96 | 374 97 | 363 98 | 372 99 | 363 100 | 377 101 | 342 102 | 340 103 | 342 104 | 344 105 | 345 106 | 351 107 | 352 108 | 353 109 | 354 110 | 330 111 | 332 112 | 324 113 | 326 114 | 335 115 | 327 116 | 324 117 | 316 118 | 324 119 | 308 120 | 311 121 | 302 122 | 314 123 | 328 124 | 340 125 | 341 126 | 338 127 | 336 128 | 337 129 | 335 130 | 323 131 | 327 132 | 321 133 | 322 134 | 302 135 | 315 136 | 289 137 | 288 138 | 287 139 | 300 140 | 294 141 | 298 142 | 297 143 | 288 144 | 289 145 | 290 146 | 288 147 | 287 148 | 283 149 | 292 150 | 306 151 | 304 152 | 306 153 | 326 154 | 336 155 | 337 156 | 340 157 | 343 158 | 352 159 | 374 160 | 373 161 | 377 162 | 357 163 | 352 164 | 357 165 | 360 166 | 373 167 | 375 168 | 377 169 | 380 170 | 384 171 | 407 172 | 409 173 | 402 174 | 405 175 | 403 176 | 426 177 | 429 178 | 428 179 | 431 180 | 399 181 | 393 182 | 399 183 | 401 184 | 418 185 | 420 186 | 421 187 | 440 188 | 446 189 | 447 190 | 450 191 | 448 192 | 463 193 | 456 194 | 458 195 | 421 196 | 409 197 | 407 198 | 394 199 | 414 200 | 412 201 | 417 202 | 418 203 | 413 204 | 414 205 | 417 206 | 418 207 | 427 208 | 426 209 | 425 210 | 426 211 | 424 212 | 431 213 | 450 214 | 448 215 | 470 216 | 484 217 | 489 218 | 466 219 | 477 220 | 479 221 | 488 222 | 489 223 | 494 224 | 501 225 | 502 226 | 505 227 | 509 228 | 514 229 | 516 230 | 522 231 | 533 232 | 537 233 | 536 234 | 546 235 | 549 236 | 539 237 | 522 238 | 523 239 | 537 240 | 536 241 | 555 242 | 556 243 | 554 244 | 541 245 | 555 246 | 557 247 | 558 248 | 573 249 | 574 250 | 571 251 | 572 252 | 573 253 | 581 254 | 580 255 | 572 256 | 586 257 | 579 258 | 581 259 | 589 260 | 597 261 | 593 262 | 598 263 | 599 264 | 600 265 | 614 266 | 622 267 | 623 268 | 646 269 | 642 270 | 652 271 | 653 272 | 655 273 | 657 274 | 663 275 | 665 276 | 667 277 | 669 278 | 655 279 | 642 280 | 643 281 | 645 282 | 660 283 | 661 284 | 658 285 | 656 286 | 661 287 | 673 288 | 672 289 | 673 290 | 680 291 | 690 292 | 691 293 | 699 294 | 698 295 | 702 296 | 716 297 | 757 298 | 758 299 | 759 300 | 778 301 | 792 302 | 789 303 | 790 304 | 791 305 | 797 306 | 806 307 | 809 308 | 801 309 | 800 310 | 802 311 | 805 312 | 814 313 | 811 314 | 836 315 | 827 316 | 836 317 | 848 318 | 855 319 | 856 320 | 857 321 | 859 322 | 855 323 | 858 324 | 864 325 | 866 326 | 875 327 | 877 328 | 865 329 | 871 330 | 879 331 | 862 332 | 869 333 | 872 334 | 879 335 | 881 336 | 883 337 | 872 338 | 861 339 | 869 340 | 867 341 | 871 342 | 888 343 | 889 344 | 893 345 | 894 346 | 897 347 | 885 348 | 891 349 | 890 350 | 910 351 | 907 352 | 909 353 | 915 354 | 940 355 | 941 356 | 944 357 | 947 358 | 938 359 | 935 360 | 927 361 | 922 362 | 932 363 | 933 364 | 895 365 | 896 366 | 897 367 | 922 368 | 931 369 | 927 370 | 936 371 | 938 372 | 962 373 | 972 374 | 973 375 | 1010 376 | 1003 377 | 1004 378 | 1003 379 | 1004 380 | 1007 381 | 1000 382 | 1015 383 | 1017 384 | 1006 385 | 1008 386 | 1021 387 | 1019 388 | 1018 389 | 1003 390 | 1010 391 | 1011 392 | 1016 393 | 1017 394 | 1025 395 | 1008 396 | 1001 397 | 1007 398 | 1015 399 | 1001 400 | 1004 401 | 1010 402 | 993 403 | 994 404 | 992 405 | 994 406 | 997 407 | 990 408 | 991 409 | 1018 410 | 1033 411 | 1047 412 | 1038 413 | 1037 414 | 1043 415 | 1047 416 | 1056 417 | 1042 418 | 1048 419 | 1059 420 | 1063 421 | 1045 422 | 1053 423 | 1051 424 | 1071 425 | 1060 426 | 1069 427 | 1074 428 | 1076 429 | 1082 430 | 1085 431 | 1081 432 | 1084 433 | 1089 434 | 1091 435 | 1079 436 | 1101 437 | 1100 438 | 1109 439 | 1108 440 | 1109 441 | 1100 442 | 1098 443 | 1100 444 | 1098 445 | 1099 446 | 1095 447 | 1097 448 | 1119 449 | 1115 450 | 1116 451 | 1117 452 | 1121 453 | 1126 454 | 1167 455 | 1168 456 | 1178 457 | 1180 458 | 1169 459 | 1170 460 | 1168 461 | 1169 462 | 1176 463 | 1178 464 | 1167 465 | 1169 466 | 1163 467 | 1184 468 | 1174 469 | 1175 470 | 1202 471 | 1206 472 | 1212 473 | 1213 474 | 1222 475 | 1233 476 | 1234 477 | 1216 478 | 1218 479 | 1219 480 | 1223 481 | 1222 482 | 1205 483 | 1208 484 | 1206 485 | 1207 486 | 1208 487 | 1209 488 | 1222 489 | 1223 490 | 1219 491 | 1220 492 | 1223 493 | 1228 494 | 1260 495 | 1275 496 | 1278 497 | 1263 498 | 1281 499 | 1293 500 | 1292 501 | 1307 502 | 1299 503 | 1297 504 | 1298 505 | 1295 506 | 1297 507 | 1299 508 | 1300 509 | 1301 510 | 1299 511 | 1313 512 | 1314 513 | 1319 514 | 1316 515 | 1294 516 | 1299 517 | 1315 518 | 1316 519 | 1327 520 | 1331 521 | 1332 522 | 1333 523 | 1342 524 | 1340 525 | 1327 526 | 1332 527 | 1335 528 | 1333 529 | 1353 530 | 1357 531 | 1347 532 | 1350 533 | 1351 534 | 1352 535 | 1353 536 | 1360 537 | 1361 538 | 1372 539 | 1373 540 | 1389 541 | 1404 542 | 1409 543 | 1403 544 | 1407 545 | 1412 546 | 1409 547 | 1413 548 | 1414 549 | 1416 550 | 1422 551 | 1426 552 | 1418 553 | 1436 554 | 1441 555 | 1437 556 | 1431 557 | 1407 558 | 1437 559 | 1430 560 | 1447 561 | 1453 562 | 1456 563 | 1475 564 | 1484 565 | 1486 566 | 1507 567 | 1498 568 | 1500 569 | 1496 570 | 1513 571 | 1499 572 | 1505 573 | 1506 574 | 1500 575 | 1502 576 | 1504 577 | 1506 578 | 1513 579 | 1514 580 | 1516 581 | 1508 582 | 1514 583 | 1518 584 | 1514 585 | 1510 586 | 1501 587 | 1495 588 | 1512 589 | 1513 590 | 1510 591 | 1513 592 | 1521 593 | 1520 594 | 1527 595 | 1536 596 | 1525 597 | 1534 598 | 1535 599 | 1512 600 | 1514 601 | 1520 602 | 1521 603 | 1525 604 | 1526 605 | 1527 606 | 1546 607 | 1550 608 | 1560 609 | 1564 610 | 1572 611 | 1570 612 | 1576 613 | 1584 614 | 1586 615 | 1588 616 | 1592 617 | 1588 618 | 1602 619 | 1592 620 | 1615 621 | 1589 622 | 1592 623 | 1594 624 | 1591 625 | 1595 626 | 1601 627 | 1613 628 | 1618 629 | 1623 630 | 1630 631 | 1631 632 | 1645 633 | 1602 634 | 1606 635 | 1608 636 | 1609 637 | 1610 638 | 1604 639 | 1606 640 | 1605 641 | 1621 642 | 1630 643 | 1635 644 | 1646 645 | 1648 646 | 1646 647 | 1648 648 | 1657 649 | 1687 650 | 1676 651 | 1679 652 | 1680 653 | 1683 654 | 1681 655 | 1682 656 | 1681 657 | 1682 658 | 1680 659 | 1679 660 | 1680 661 | 1682 662 | 1695 663 | 1704 664 | 1711 665 | 1714 666 | 1720 667 | 1746 668 | 1750 669 | 1748 670 | 1753 671 | 1754 672 | 1763 673 | 1765 674 | 1783 675 | 1792 676 | 1793 677 | 1798 678 | 1801 679 | 1800 680 | 1803 681 | 1784 682 | 1785 683 | 1784 684 | 1787 685 | 1790 686 | 1784 687 | 1788 688 | 1783 689 | 1785 690 | 1787 691 | 1794 692 | 1795 693 | 1798 694 | 1799 695 | 1803 696 | 1805 697 | 1806 698 | 1786 699 | 1787 700 | 1816 701 | 1812 702 | 1813 703 | 1816 704 | 1818 705 | 1812 706 | 1838 707 | 1837 708 | 1839 709 | 1832 710 | 1834 711 | 1838 712 | 1840 713 | 1855 714 | 1856 715 | 1842 716 | 1841 717 | 1850 718 | 1852 719 | 1851 720 | 1853 721 | 1859 722 | 1853 723 | 1881 724 | 1882 725 | 1886 726 | 1899 727 | 1897 728 | 1910 729 | 1906 730 | 1907 731 | 1906 732 | 1901 733 | 1896 734 | 1897 735 | 1883 736 | 1889 737 | 1890 738 | 1896 739 | 1877 740 | 1888 741 | 1889 742 | 1895 743 | 1896 744 | 1893 745 | 1858 746 | 1855 747 | 1863 748 | 1871 749 | 1878 750 | 1879 751 | 1877 752 | 1878 753 | 1874 754 | 1906 755 | 1921 756 | 1927 757 | 1924 758 | 1925 759 | 1929 760 | 1928 761 | 1933 762 | 1923 763 | 1926 764 | 1904 765 | 1892 766 | 1889 767 | 1906 768 | 1908 769 | 1909 770 | 1924 771 | 1926 772 | 1948 773 | 1949 774 | 1951 775 | 1991 776 | 1990 777 | 1996 778 | 1997 779 | 2009 780 | 2007 781 | 2006 782 | 2012 783 | 2029 784 | 2036 785 | 2039 786 | 2040 787 | 2049 788 | 2051 789 | 2052 790 | 2065 791 | 2063 792 | 2065 793 | 2064 794 | 2065 795 | 2067 796 | 2072 797 | 2069 798 | 2051 799 | 2049 800 | 2046 801 | 2045 802 | 2047 803 | 2039 804 | 2037 805 | 2041 806 | 2044 807 | 2043 808 | 2033 809 | 2034 810 | 2024 811 | 2026 812 | 2023 813 | 2013 814 | 2014 815 | 2015 816 | 2017 817 | 2019 818 | 2018 819 | 2019 820 | 2018 821 | 2020 822 | 2021 823 | 2024 824 | 2029 825 | 2017 826 | 2048 827 | 2049 828 | 2027 829 | 2028 830 | 2023 831 | 2040 832 | 2033 833 | 2037 834 | 2056 835 | 2096 836 | 2097 837 | 2093 838 | 2110 839 | 2111 840 | 2110 841 | 2120 842 | 2122 843 | 2106 844 | 2122 845 | 2124 846 | 2118 847 | 2120 848 | 2128 849 | 2127 850 | 2134 851 | 2135 852 | 2149 853 | 2151 854 | 2178 855 | 2179 856 | 2180 857 | 2179 858 | 2188 859 | 2198 860 | 2196 861 | 2204 862 | 2214 863 | 2222 864 | 2223 865 | 2222 866 | 2221 867 | 2247 868 | 2249 869 | 2257 870 | 2267 871 | 2266 872 | 2265 873 | 2268 874 | 2261 875 | 2266 876 | 2268 877 | 2269 878 | 2275 879 | 2274 880 | 2275 881 | 2289 882 | 2283 883 | 2284 884 | 2276 885 | 2278 886 | 2274 887 | 2275 888 | 2279 889 | 2280 890 | 2264 891 | 2260 892 | 2270 893 | 2274 894 | 2282 895 | 2273 896 | 2274 897 | 2270 898 | 2269 899 | 2268 900 | 2274 901 | 2280 902 | 2300 903 | 2301 904 | 2303 905 | 2301 906 | 2306 907 | 2316 908 | 2337 909 | 2349 910 | 2363 911 | 2373 912 | 2377 913 | 2381 914 | 2380 915 | 2402 916 | 2408 917 | 2407 918 | 2406 919 | 2404 920 | 2405 921 | 2409 922 | 2411 923 | 2421 924 | 2420 925 | 2419 926 | 2422 927 | 2415 928 | 2418 929 | 2426 930 | 2396 931 | 2399 932 | 2398 933 | 2411 934 | 2413 935 | 2414 936 | 2393 937 | 2400 938 | 2393 939 | 2389 940 | 2400 941 | 2404 942 | 2405 943 | 2408 944 | 2405 945 | 2409 946 | 2411 947 | 2423 948 | 2427 949 | 2428 950 | 2429 951 | 2418 952 | 2419 953 | 2426 954 | 2428 955 | 2443 956 | 2451 957 | 2464 958 | 2465 959 | 2483 960 | 2476 961 | 2479 962 | 2480 963 | 2481 964 | 2482 965 | 2476 966 | 2464 967 | 2506 968 | 2499 969 | 2500 970 | 2490 971 | 2486 972 | 2480 973 | 2481 974 | 2482 975 | 2507 976 | 2515 977 | 2519 978 | 2526 979 | 2516 980 | 2523 981 | 2530 982 | 2536 983 | 2537 984 | 2538 985 | 2555 986 | 2564 987 | 2553 988 | 2565 989 | 2548 990 | 2537 991 | 2538 992 | 2533 993 | 2537 994 | 2550 995 | 2553 996 | 2541 997 | 2543 998 | 2546 999 | 2550 1000 | 2554 1001 | 2555 1002 | 2573 1003 | 2578 1004 | 2575 1005 | 2595 1006 | 2601 1007 | 2600 1008 | 2582 1009 | 2583 1010 | 2585 1011 | 2579 1012 | 2581 1013 | 2582 1014 | 2590 1015 | 2588 1016 | 2589 1017 | 2595 1018 | 2584 1019 | 2585 1020 | 2584 1021 | 2592 1022 | 2602 1023 | 2607 1024 | 2611 1025 | 2627 1026 | 2636 1027 | 2646 1028 | 2643 1029 | 2648 1030 | 2654 1031 | 2648 1032 | 2649 1033 | 2654 1034 | 2652 1035 | 2653 1036 | 2656 1037 | 2657 1038 | 2658 1039 | 2687 1040 | 2699 1041 | 2702 1042 | 2679 1043 | 2681 1044 | 2684 1045 | 2683 1046 | 2681 1047 | 2683 1048 | 2684 1049 | 2701 1050 | 2709 1051 | 2711 1052 | 2715 1053 | 2716 1054 | 2725 1055 | 2715 1056 | 2719 1057 | 2720 1058 | 2716 1059 | 2717 1060 | 2704 1061 | 2707 1062 | 2705 1063 | 2695 1064 | 2697 1065 | 2696 1066 | 2699 1067 | 2697 1068 | 2698 1069 | 2718 1070 | 2722 1071 | 2726 1072 | 2727 1073 | 2728 1074 | 2724 1075 | 2722 1076 | 2731 1077 | 2732 1078 | 2728 1079 | 2725 1080 | 2722 1081 | 2728 1082 | 2735 1083 | 2729 1084 | 2731 1085 | 2733 1086 | 2739 1087 | 2734 1088 | 2757 1089 | 2763 1090 | 2765 1091 | 2772 1092 | 2771 1093 | 2772 1094 | 2768 1095 | 2765 1096 | 2759 1097 | 2772 1098 | 2775 1099 | 2767 1100 | 2771 1101 | 2774 1102 | 2770 1103 | 2758 1104 | 2772 1105 | 2775 1106 | 2789 1107 | 2791 1108 | 2793 1109 | 2800 1110 | 2780 1111 | 2791 1112 | 2777 1113 | 2778 1114 | 2774 1115 | 2779 1116 | 2780 1117 | 2779 1118 | 2780 1119 | 2781 1120 | 2783 1121 | 2788 1122 | 2796 1123 | 2800 1124 | 2799 1125 | 2807 1126 | 2811 1127 | 2825 1128 | 2826 1129 | 2831 1130 | 2842 1131 | 2843 1132 | 2852 1133 | 2854 1134 | 2858 1135 | 2841 1136 | 2842 1137 | 2837 1138 | 2838 1139 | 2839 1140 | 2843 1141 | 2861 1142 | 2888 1143 | 2892 1144 | 2886 1145 | 2885 1146 | 2904 1147 | 2905 1148 | 2927 1149 | 2928 1150 | 2929 1151 | 2915 1152 | 2917 1153 | 2895 1154 | 2901 1155 | 2923 1156 | 2932 1157 | 2934 1158 | 2936 1159 | 2938 1160 | 2944 1161 | 2947 1162 | 2951 1163 | 2959 1164 | 2958 1165 | 2956 1166 | 2944 1167 | 2942 1168 | 2941 1169 | 2942 1170 | 2929 1171 | 2946 1172 | 2954 1173 | 2948 1174 | 2949 1175 | 2973 1176 | 2980 1177 | 2981 1178 | 2994 1179 | 2997 1180 | 3021 1181 | 3038 1182 | 3047 1183 | 3060 1184 | 3058 1185 | 3061 1186 | 3057 1187 | 3073 1188 | 3074 1189 | 3094 1190 | 3126 1191 | 3125 1192 | 3126 1193 | 3122 1194 | 3123 1195 | 3122 1196 | 3120 1197 | 3115 1198 | 3114 1199 | 3113 1200 | 3117 1201 | 3122 1202 | 3121 1203 | 3123 1204 | 3133 1205 | 3134 1206 | 3138 1207 | 3152 1208 | 3153 1209 | 3155 1210 | 3154 1211 | 3159 1212 | 3156 1213 | 3153 1214 | 3159 1215 | 3160 1216 | 3161 1217 | 3157 1218 | 3158 1219 | 3160 1220 | 3161 1221 | 3170 1222 | 3202 1223 | 3204 1224 | 3225 1225 | 3211 1226 | 3207 1227 | 3209 1228 | 3211 1229 | 3206 1230 | 3207 1231 | 3214 1232 | 3213 1233 | 3206 1234 | 3199 1235 | 3198 1236 | 3208 1237 | 3225 1238 | 3226 1239 | 3227 1240 | 3238 1241 | 3208 1242 | 3209 1243 | 3210 1244 | 3211 1245 | 3214 1246 | 3209 1247 | 3210 1248 | 3233 1249 | 3232 1250 | 3233 1251 | 3234 1252 | 3237 1253 | 3240 1254 | 3246 1255 | 3252 1256 | 3239 1257 | 3246 1258 | 3248 1259 | 3246 1260 | 3248 1261 | 3250 1262 | 3258 1263 | 3259 1264 | 3260 1265 | 3271 1266 | 3272 1267 | 3280 1268 | 3288 1269 | 3279 1270 | 3272 1271 | 3274 1272 | 3280 1273 | 3288 1274 | 3292 1275 | 3313 1276 | 3307 1277 | 3302 1278 | 3303 1279 | 3304 1280 | 3302 1281 | 3304 1282 | 3307 1283 | 3320 1284 | 3306 1285 | 3303 1286 | 3304 1287 | 3303 1288 | 3292 1289 | 3293 1290 | 3282 1291 | 3285 1292 | 3286 1293 | 3281 1294 | 3276 1295 | 3283 1296 | 3246 1297 | 3247 1298 | 3254 1299 | 3268 1300 | 3267 1301 | 3274 1302 | 3276 1303 | 3288 1304 | 3289 1305 | 3288 1306 | 3275 1307 | 3274 1308 | 3276 1309 | 3271 1310 | 3273 1311 | 3271 1312 | 3270 1313 | 3265 1314 | 3271 1315 | 3266 1316 | 3258 1317 | 3259 1318 | 3256 1319 | 3255 1320 | 3250 1321 | 3261 1322 | 3265 1323 | 3263 1324 | 3264 1325 | 3265 1326 | 3279 1327 | 3280 1328 | 3285 1329 | 3301 1330 | 3304 1331 | 3291 1332 | 3283 1333 | 3300 1334 | 3301 1335 | 3295 1336 | 3298 1337 | 3297 1338 | 3296 1339 | 3291 1340 | 3294 1341 | 3297 1342 | 3301 1343 | 3298 1344 | 3299 1345 | 3265 1346 | 3266 1347 | 3270 1348 | 3265 1349 | 3282 1350 | 3289 1351 | 3288 1352 | 3290 1353 | 3289 1354 | 3291 1355 | 3293 1356 | 3295 1357 | 3296 1358 | 3297 1359 | 3269 1360 | 3280 1361 | 3281 1362 | 3282 1363 | 3291 1364 | 3306 1365 | 3304 1366 | 3305 1367 | 3306 1368 | 3329 1369 | 3327 1370 | 3331 1371 | 3332 1372 | 3334 1373 | 3338 1374 | 3318 1375 | 3315 1376 | 3323 1377 | 3324 1378 | 3325 1379 | 3327 1380 | 3328 1381 | 3326 1382 | 3329 1383 | 3342 1384 | 3343 1385 | 3344 1386 | 3345 1387 | 3346 1388 | 3345 1389 | 3321 1390 | 3320 1391 | 3318 1392 | 3315 1393 | 3318 1394 | 3344 1395 | 3349 1396 | 3354 1397 | 3353 1398 | 3351 1399 | 3362 1400 | 3379 1401 | 3395 1402 | 3421 1403 | 3423 1404 | 3411 1405 | 3406 1406 | 3403 1407 | 3407 1408 | 3408 1409 | 3406 1410 | 3408 1411 | 3413 1412 | 3407 1413 | 3423 1414 | 3435 1415 | 3437 1416 | 3438 1417 | 3441 1418 | 3452 1419 | 3453 1420 | 3452 1421 | 3453 1422 | 3457 1423 | 3463 1424 | 3456 1425 | 3439 1426 | 3437 1427 | 3441 1428 | 3439 1429 | 3442 1430 | 3443 1431 | 3445 1432 | 3452 1433 | 3459 1434 | 3474 1435 | 3466 1436 | 3456 1437 | 3480 1438 | 3479 1439 | 3481 1440 | 3497 1441 | 3500 1442 | 3494 1443 | 3496 1444 | 3502 1445 | 3486 1446 | 3489 1447 | 3496 1448 | 3505 1449 | 3526 1450 | 3543 1451 | 3549 1452 | 3550 1453 | 3552 1454 | 3555 1455 | 3559 1456 | 3558 1457 | 3566 1458 | 3568 1459 | 3567 1460 | 3568 1461 | 3569 1462 | 3555 1463 | 3576 1464 | 3567 1465 | 3566 1466 | 3563 1467 | 3590 1468 | 3597 1469 | 3622 1470 | 3623 1471 | 3610 1472 | 3611 1473 | 3615 1474 | 3616 1475 | 3620 1476 | 3653 1477 | 3662 1478 | 3649 1479 | 3661 1480 | 3664 1481 | 3656 1482 | 3672 1483 | 3680 1484 | 3681 1485 | 3687 1486 | 3693 1487 | 3692 1488 | 3706 1489 | 3686 1490 | 3685 1491 | 3675 1492 | 3669 1493 | 3672 1494 | 3673 1495 | 3667 1496 | 3674 1497 | 3677 1498 | 3663 1499 | 3685 1500 | 3681 1501 | 3682 1502 | 3695 1503 | 3688 1504 | 3702 1505 | 3708 1506 | 3709 1507 | 3708 1508 | 3711 1509 | 3707 1510 | 3729 1511 | 3730 1512 | 3748 1513 | 3775 1514 | 3779 1515 | 3780 1516 | 3784 1517 | 3797 1518 | 3803 1519 | 3822 1520 | 3843 1521 | 3860 1522 | 3888 1523 | 3875 1524 | 3866 1525 | 3869 1526 | 3878 1527 | 3877 1528 | 3886 1529 | 3888 1530 | 3889 1531 | 3894 1532 | 3905 1533 | 3919 1534 | 3921 1535 | 3922 1536 | 3964 1537 | 3965 1538 | 3967 1539 | 3960 1540 | 3978 1541 | 3977 1542 | 3983 1543 | 3989 1544 | 3997 1545 | 3999 1546 | 4010 1547 | 3998 1548 | 3999 1549 | 4013 1550 | 4025 1551 | 4033 1552 | 4050 1553 | 4051 1554 | 4053 1555 | 4052 1556 | 4050 1557 | 4051 1558 | 4052 1559 | 4053 1560 | 4069 1561 | 4071 1562 | 4079 1563 | 4082 1564 | 4083 1565 | 4085 1566 | 4081 1567 | 4076 1568 | 4090 1569 | 4091 1570 | 4098 1571 | 4105 1572 | 4121 1573 | 4119 1574 | 4124 1575 | 4130 1576 | 4132 1577 | 4131 1578 | 4130 1579 | 4094 1580 | 4106 1581 | 4105 1582 | 4100 1583 | 4098 1584 | 4092 1585 | 4091 1586 | 4093 1587 | 4091 1588 | 4101 1589 | 4102 1590 | 4104 1591 | 4105 1592 | 4100 1593 | 4111 1594 | 4133 1595 | 4134 1596 | 4140 1597 | 4136 1598 | 4121 1599 | 4120 1600 | 4139 1601 | 4140 1602 | 4141 1603 | 4140 1604 | 4144 1605 | 4152 1606 | 4133 1607 | 4136 1608 | 4148 1609 | 4149 1610 | 4148 1611 | 4166 1612 | 4171 1613 | 4162 1614 | 4179 1615 | 4175 1616 | 4185 1617 | 4186 1618 | 4201 1619 | 4218 1620 | 4226 1621 | 4224 1622 | 4214 1623 | 4212 1624 | 4187 1625 | 4191 1626 | 4194 1627 | 4193 1628 | 4196 1629 | 4199 1630 | 4195 1631 | 4196 1632 | 4178 1633 | 4177 1634 | 4180 1635 | 4172 1636 | 4173 1637 | 4166 1638 | 4172 1639 | 4175 1640 | 4180 1641 | 4185 1642 | 4186 1643 | 4189 1644 | 4190 1645 | 4191 1646 | 4193 1647 | 4195 1648 | 4209 1649 | 4218 1650 | 4221 1651 | 4223 1652 | 4215 1653 | 4182 1654 | 4181 1655 | 4194 1656 | 4202 1657 | 4203 1658 | 4204 1659 | 4208 1660 | 4210 1661 | 4218 1662 | 4217 1663 | 4216 1664 | 4224 1665 | 4238 1666 | 4239 1667 | 4246 1668 | 4249 1669 | 4250 1670 | 4222 1671 | 4219 1672 | 4246 1673 | 4261 1674 | 4263 1675 | 4272 1676 | 4277 1677 | 4276 1678 | 4277 1679 | 4279 1680 | 4292 1681 | 4281 1682 | 4282 1683 | 4261 1684 | 4268 1685 | 4264 1686 | 4265 1687 | 4272 1688 | 4277 1689 | 4278 1690 | 4281 1691 | 4282 1692 | 4304 1693 | 4296 1694 | 4288 1695 | 4305 1696 | 4306 1697 | 4304 1698 | 4306 1699 | 4307 1700 | 4310 1701 | 4290 1702 | 4280 1703 | 4281 1704 | 4282 1705 | 4283 1706 | 4299 1707 | 4298 1708 | 4299 1709 | 4300 1710 | 4284 1711 | 4292 1712 | 4303 1713 | 4306 1714 | 4304 1715 | 4288 1716 | 4291 1717 | 4288 1718 | 4285 1719 | 4297 1720 | 4296 1721 | 4297 1722 | 4298 1723 | 4291 1724 | 4275 1725 | 4269 1726 | 4270 1727 | 4269 1728 | 4268 1729 | 4285 1730 | 4287 1731 | 4288 1732 | 4287 1733 | 4288 1734 | 4289 1735 | 4280 1736 | 4279 1737 | 4286 1738 | 4289 1739 | 4285 1740 | 4286 1741 | 4287 1742 | 4297 1743 | 4294 1744 | 4319 1745 | 4306 1746 | 4333 1747 | 4338 1748 | 4339 1749 | 4332 1750 | 4337 1751 | 4338 1752 | 4325 1753 | 4320 1754 | 4318 1755 | 4308 1756 | 4317 1757 | 4337 1758 | 4336 1759 | 4338 1760 | 4340 1761 | 4343 1762 | 4324 1763 | 4325 1764 | 4326 1765 | 4323 1766 | 4322 1767 | 4327 1768 | 4329 1769 | 4333 1770 | 4341 1771 | 4347 1772 | 4372 1773 | 4375 1774 | 4378 1775 | 4371 1776 | 4374 1777 | 4373 1778 | 4369 1779 | 4371 1780 | 4389 1781 | 4392 1782 | 4372 1783 | 4382 1784 | 4383 1785 | 4384 1786 | 4381 1787 | 4390 1788 | 4391 1789 | 4394 1790 | 4416 1791 | 4430 1792 | 4398 1793 | 4403 1794 | 4394 1795 | 4383 1796 | 4399 1797 | 4387 1798 | 4418 1799 | 4431 1800 | 4434 1801 | 4417 1802 | 4418 1803 | 4417 1804 | 4420 1805 | 4430 1806 | 4426 1807 | 4429 1808 | 4430 1809 | 4429 1810 | 4430 1811 | 4440 1812 | 4449 1813 | 4450 1814 | 4434 1815 | 4452 1816 | 4444 1817 | 4446 1818 | 4439 1819 | 4440 1820 | 4414 1821 | 4407 1822 | 4408 1823 | 4410 1824 | 4411 1825 | 4420 1826 | 4445 1827 | 4454 1828 | 4455 1829 | 4451 1830 | 4456 1831 | 4455 1832 | 4449 1833 | 4470 1834 | 4469 1835 | 4473 1836 | 4470 1837 | 4488 1838 | 4470 1839 | 4466 1840 | 4463 1841 | 4477 1842 | 4481 1843 | 4494 1844 | 4493 1845 | 4491 1846 | 4486 1847 | 4475 1848 | 4479 1849 | 4484 1850 | 4485 1851 | 4497 1852 | 4472 1853 | 4473 1854 | 4490 1855 | 4499 1856 | 4507 1857 | 4515 1858 | 4521 1859 | 4554 1860 | 4555 1861 | 4538 1862 | 4526 1863 | 4539 1864 | 4543 1865 | 4537 1866 | 4541 1867 | 4543 1868 | 4527 1869 | 4538 1870 | 4537 1871 | 4536 1872 | 4550 1873 | 4554 1874 | 4567 1875 | 4585 1876 | 4603 1877 | 4623 1878 | 4624 1879 | 4626 1880 | 4629 1881 | 4627 1882 | 4629 1883 | 4628 1884 | 4636 1885 | 4640 1886 | 4647 1887 | 4649 1888 | 4651 1889 | 4655 1890 | 4626 1891 | 4631 1892 | 4632 1893 | 4630 1894 | 4622 1895 | 4625 1896 | 4632 1897 | 4652 1898 | 4657 1899 | 4661 1900 | 4650 1901 | 4654 1902 | 4656 1903 | 4658 1904 | 4659 1905 | 4676 1906 | 4675 1907 | 4681 1908 | 4694 1909 | 4714 1910 | 4723 1911 | 4706 1912 | 4707 1913 | 4741 1914 | 4743 1915 | 4718 1916 | 4714 1917 | 4715 1918 | 4697 1919 | 4699 1920 | 4698 1921 | 4696 1922 | 4703 1923 | 4702 1924 | 4704 1925 | 4709 1926 | 4726 1927 | 4725 1928 | 4743 1929 | 4747 1930 | 4765 1931 | 4766 1932 | 4768 1933 | 4764 1934 | 4768 1935 | 4770 1936 | 4777 1937 | 4778 1938 | 4779 1939 | 4786 1940 | 4804 1941 | 4806 1942 | 4790 1943 | 4797 1944 | 4808 1945 | 4809 1946 | 4806 1947 | 4808 1948 | 4818 1949 | 4822 1950 | 4823 1951 | 4854 1952 | 4855 1953 | 4885 1954 | 4902 1955 | 4903 1956 | 4905 1957 | 4906 1958 | 4908 1959 | 4907 1960 | 4909 1961 | 4915 1962 | 4916 1963 | 4906 1964 | 4935 1965 | 4949 1966 | 4948 1967 | 4952 1968 | 4964 1969 | 4960 1970 | 4962 1971 | 4975 1972 | 4976 1973 | 4987 1974 | 4996 1975 | 4994 1976 | 4996 1977 | 4997 1978 | 5000 1979 | 5001 1980 | 4986 1981 | 4988 1982 | 4999 1983 | 4997 1984 | 4998 1985 | 4997 1986 | 5004 1987 | 5005 1988 | 5006 1989 | 5004 1990 | 5005 1991 | 5018 1992 | 5019 1993 | 5021 1994 | 5022 1995 | 5028 1996 | 5057 1997 | 5058 1998 | 5063 1999 | 5067 2000 | 5068 --------------------------------------------------------------------------------