├── Day-01
├── .gitkeep
├── kotlin
│ ├── NyCodeGHG
│ │ ├── .gitignore
│ │ ├── README.md
│ │ └── solution.kt
│ └── warriorzz
│ │ └── solution.kt
├── python
│ ├── paul2708
│ │ └── solution.py
│ └── justentrix
│ │ └── solution.py
├── typescript
│ └── WeiiswurstDev
│ │ └── index.ts
├── c
│ └── JohnnyJayJay
│ │ └── Day01.c
└── java
│ ├── zFlxw
│ └── Solution.java
│ └── MCqwertz
│ └── Day1.java
├── shared
├── .gitkeep
├── NyCodeGHG
│ └── .gitignore
├── paul2708
│ ├── .gitignore
│ ├── input
│ │ ├── day05_test.txt
│ │ ├── day01_test.txt
│ │ ├── day02_test.txt
│ │ ├── day08_test.txt
│ │ ├── day06_test.txt
│ │ ├── day09_test.txt
│ │ ├── day03_test.txt
│ │ ├── day04_test.txt
│ │ ├── day07_test.txt
│ │ ├── day01.txt
│ │ ├── day08.txt
│ │ └── day03.txt
│ ├── assertions.py
│ ├── printer.py
│ └── input_reader.py
├── WeiiswurstDev
│ ├── .gitignore
│ ├── package.json
│ ├── README.md
│ ├── package-lock.json
│ └── tsconfig.json
├── JohnnyJayJay
│ ├── inputs
│ │ ├── test2.txt
│ │ ├── test.txt
│ │ ├── Day-10.txt
│ │ ├── Day-01.txt
│ │ ├── Day-08.txt
│ │ └── Day-11.txt
│ ├── aoc.h
│ ├── README.md
│ └── aoc.c
├── MCqwertz
│ ├── TextFileUtils.java
│ └── inputs
│ │ ├── Day1.txt
│ │ └── Day3.txt
├── justentrix
│ ├── file_reader.py
│ └── inputs
│ │ └── day01.txt
├── zFlxw
│ └── inputs
│ │ └── day1.txt
└── dlsf
│ └── inputs
│ └── Day-03.txt
├── .gitignore
├── Day-03
├── kotlin
│ └── NyCodeGHG
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── NyCodeGHG-Day-03.iml
│ │ └── solution.kt
├── python
│ ├── th3ph4nt0m
│ │ └── solution.py
│ ├── justentrix
│ │ └── solution.py
│ └── paul2708
│ │ └── solution.py
├── typescript
│ └── WeiiswurstDev
│ │ └── index.ts
├── java
│ ├── MCqwertz
│ │ └── Day3.java
│ └── dlsf
│ │ └── Solution.java
└── c
│ └── JohnnyJayJay
│ └── Day03.c
├── Day-04
├── kotlin
│ └── NyCodeGHG
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── NyCodeGHG-Day-04.iml
│ │ └── solution.kt
├── python
│ └── paul2708
│ │ └── solution.py
├── typescript
│ └── WeiiswurstDev
│ │ └── index.ts
├── java
│ └── MCqwertz
│ │ └── Day4.java
└── c
│ └── JohnnyJayJay
│ └── Day04.c
├── Day-05
├── kotlin
│ └── NyCodeGHG
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── NyCodeGHG-Day-05.iml
│ │ └── solution.kt
├── typescript
│ └── WeiiswurstDev
│ │ └── index.ts
├── c
│ └── JohnnyJayJay
│ │ └── Day05.c
├── python
│ └── paul2708
│ │ └── solution.py
└── java
│ ├── MCqwertz
│ └── Day5.java
│ └── zFlxw
│ └── Solution.java
├── Day-06
├── kotlin
│ └── NyCodeGHG
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── NyCodeGHG-Day-06.iml
│ │ └── solution.kt
├── python
│ ├── th3ph4nt0m
│ │ └── solution.py
│ └── paul2708
│ │ └── solution.py
├── typescript
│ └── WeiiswurstDev
│ │ └── index.ts
├── c
│ └── JohnnyJayJay
│ │ └── Day06.c
└── java
│ └── MCqwertz
│ └── Day06.java
├── Day-07
├── kotlin
│ └── NyCodeGHG
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── NyCodeGHG-Day-07.iml
│ │ └── solution.kt
├── typescript
│ └── WeiiswurstDev
│ │ └── index.ts
├── clojure
│ └── JohnnyJayJay
│ │ └── solution.clj
└── python
│ └── paul2708
│ └── solution.py
├── Day-08
├── kotlin
│ └── NyCodeGHG
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── NyCodeGHG-Day-08.iml
│ │ └── solution.kt
├── typescript
│ └── WeiiswurstDev
│ │ └── index.ts
├── python
│ └── paul2708
│ │ └── solution.py
└── c
│ └── JohnnyJayJay
│ └── Day08.c
├── Day-09
├── kotlin
│ └── NyCodeGHG
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── NyCodeGHG-Day-09.iml
│ │ └── solution.kt
├── typescript
│ └── WeiiswurstDev
│ │ └── index.ts
├── python
│ └── paul2708
│ │ └── solution.py
└── c
│ └── JohnnyJayJay
│ └── Day09.c
├── Day-10
├── kotlin
│ └── NyCodeGHG
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── NyCodeGHG-Day-11.iml
│ │ └── solution.kt
└── c
│ └── JohnnyJayJay
│ └── Day10.c
├── Day-11
├── kotlin
│ └── NyCodeGHG
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── NyCodeGHG-Day-11.iml
│ │ └── solution.kt
└── c
│ └── JohnnyJayJay
│ └── Day11.c
├── Day-02
├── kotlin
│ ├── NyCodeGHG
│ │ ├── .gitignore
│ │ ├── README.md
│ │ └── solution.kt
│ └── warriorzz
│ │ └── solution.kt
├── python
│ ├── th3ph4nt0m
│ │ └── solution.py
│ ├── paul2708
│ │ └── solution.py
│ └── justentrix
│ │ └── solution.py
├── typescript
│ └── WeiiswurstDev
│ │ └── index.ts
├── c
│ └── JohnnyJayJay
│ │ └── Day02.c
└── java
│ ├── MCqwertz
│ └── Day2.java
│ └── zFlxw
│ └── Solution.java
├── Day-15
└── python
│ └── th3ph4nt0m
│ └── solution.py
├── Day-13
└── python
│ └── th3ph4nt0m
│ └── solution.py
├── Day-12
└── python
│ └── th3ph4nt0m
│ └── solution.py
└── README.md
/Day-01/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/shared/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/shared/NyCodeGHG/.gitignore:
--------------------------------------------------------------------------------
1 | lib
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | __pycache__
3 | out
--------------------------------------------------------------------------------
/Day-03/kotlin/NyCodeGHG/.gitignore:
--------------------------------------------------------------------------------
1 | *.txt
2 |
--------------------------------------------------------------------------------
/Day-04/kotlin/NyCodeGHG/.gitignore:
--------------------------------------------------------------------------------
1 | *.txt
2 |
--------------------------------------------------------------------------------
/Day-05/kotlin/NyCodeGHG/.gitignore:
--------------------------------------------------------------------------------
1 | *.txt
2 |
--------------------------------------------------------------------------------
/Day-06/kotlin/NyCodeGHG/.gitignore:
--------------------------------------------------------------------------------
1 | *.txt
2 |
--------------------------------------------------------------------------------
/Day-07/kotlin/NyCodeGHG/.gitignore:
--------------------------------------------------------------------------------
1 | *.txt
2 |
--------------------------------------------------------------------------------
/Day-08/kotlin/NyCodeGHG/.gitignore:
--------------------------------------------------------------------------------
1 | *.txt
2 |
--------------------------------------------------------------------------------
/Day-09/kotlin/NyCodeGHG/.gitignore:
--------------------------------------------------------------------------------
1 | *.txt
2 |
--------------------------------------------------------------------------------
/Day-10/kotlin/NyCodeGHG/.gitignore:
--------------------------------------------------------------------------------
1 | *.txt
2 |
--------------------------------------------------------------------------------
/Day-11/kotlin/NyCodeGHG/.gitignore:
--------------------------------------------------------------------------------
1 | *.txt
2 |
--------------------------------------------------------------------------------
/Day-01/kotlin/NyCodeGHG/.gitignore:
--------------------------------------------------------------------------------
1 | *.txt
2 | *.iml
--------------------------------------------------------------------------------
/Day-02/kotlin/NyCodeGHG/.gitignore:
--------------------------------------------------------------------------------
1 | *.txt
2 | *.iml
--------------------------------------------------------------------------------
/shared/paul2708/.gitignore:
--------------------------------------------------------------------------------
1 | # Python
2 | __pycache__
3 |
--------------------------------------------------------------------------------
/shared/WeiiswurstDev/.gitignore:
--------------------------------------------------------------------------------
1 | input.txt
2 | node_modules
3 | *.js
4 | *.ts
--------------------------------------------------------------------------------
/shared/paul2708/input/day05_test.txt:
--------------------------------------------------------------------------------
1 | BFFFBBFRRR
2 | FFFBBBFRRR
3 | BBFFBBFRLL
4 |
--------------------------------------------------------------------------------
/shared/paul2708/input/day01_test.txt:
--------------------------------------------------------------------------------
1 | 1721
2 | 979
3 | 366
4 | 299
5 | 675
6 | 1456
7 |
--------------------------------------------------------------------------------
/shared/paul2708/input/day02_test.txt:
--------------------------------------------------------------------------------
1 | 1-3 a: abcde
2 | 1-3 b: cdefg
3 | 2-9 c: ccccccccc
4 |
--------------------------------------------------------------------------------
/shared/JohnnyJayJay/inputs/test2.txt:
--------------------------------------------------------------------------------
1 | 16
2 | 10
3 | 15
4 | 5
5 | 1
6 | 11
7 | 7
8 | 19
9 | 6
10 | 12
11 | 4
--------------------------------------------------------------------------------
/shared/paul2708/input/day08_test.txt:
--------------------------------------------------------------------------------
1 | nop +0
2 | acc +1
3 | jmp +4
4 | acc +3
5 | jmp -3
6 | acc -99
7 | acc +1
8 | jmp -4
9 | acc +6
--------------------------------------------------------------------------------
/shared/paul2708/input/day06_test.txt:
--------------------------------------------------------------------------------
1 | abc
2 |
3 | a
4 | b
5 | c
6 |
7 | ab
8 | ac
9 |
10 | a
11 | a
12 | a
13 | a
14 |
15 | b
--------------------------------------------------------------------------------
/Day-01/kotlin/NyCodeGHG/README.md:
--------------------------------------------------------------------------------
1 | # Kotlin Solution for Day 1
2 |
3 | Create a new file **input.txt** in this directory with your input.
4 |
--------------------------------------------------------------------------------
/Day-02/kotlin/NyCodeGHG/README.md:
--------------------------------------------------------------------------------
1 | # Kotlin Solution for Day 2
2 |
3 | Create a new file **input.txt** in this directory with your input.
4 |
--------------------------------------------------------------------------------
/Day-03/kotlin/NyCodeGHG/README.md:
--------------------------------------------------------------------------------
1 | # Kotlin Solution for Day 3
2 |
3 | Create a new file **input.txt** in this directory with your input.
4 |
--------------------------------------------------------------------------------
/Day-04/kotlin/NyCodeGHG/README.md:
--------------------------------------------------------------------------------
1 | # Kotlin Solution for Day 4
2 |
3 | Create a new file **input.txt** in this directory with your input.
4 |
--------------------------------------------------------------------------------
/Day-05/kotlin/NyCodeGHG/README.md:
--------------------------------------------------------------------------------
1 | # Kotlin Solution for Day 5
2 |
3 | Create a new file **input.txt** in this directory with your input.
4 |
--------------------------------------------------------------------------------
/Day-06/kotlin/NyCodeGHG/README.md:
--------------------------------------------------------------------------------
1 | # Kotlin Solution for Day 6
2 |
3 | Create a new file **input.txt** in this directory with your input.
4 |
--------------------------------------------------------------------------------
/Day-07/kotlin/NyCodeGHG/README.md:
--------------------------------------------------------------------------------
1 | # Kotlin Solution for Day 7
2 |
3 | Create a new file **input.txt** in this directory with your input.
4 |
--------------------------------------------------------------------------------
/Day-08/kotlin/NyCodeGHG/README.md:
--------------------------------------------------------------------------------
1 | # Kotlin Solution for Day 8
2 |
3 | Create a new file **input.txt** in this directory with your input.
4 |
--------------------------------------------------------------------------------
/Day-09/kotlin/NyCodeGHG/README.md:
--------------------------------------------------------------------------------
1 | # Kotlin Solution for Day 9
2 |
3 | Create a new file **input.txt** in this directory with your input.
4 |
--------------------------------------------------------------------------------
/Day-10/kotlin/NyCodeGHG/README.md:
--------------------------------------------------------------------------------
1 | # Kotlin Solution for Day 9
2 |
3 | Create a new file **input.txt** in this directory with your input.
4 |
--------------------------------------------------------------------------------
/Day-11/kotlin/NyCodeGHG/README.md:
--------------------------------------------------------------------------------
1 | # Kotlin Solution for Day 9
2 |
3 | Create a new file **input.txt** in this directory with your input.
4 |
--------------------------------------------------------------------------------
/shared/paul2708/assertions.py:
--------------------------------------------------------------------------------
1 | def assert_equals(expected, actual):
2 | if expected != actual:
3 | print(f"[Assert] Failed. Expected {expected} but got {actual}.")
4 |
--------------------------------------------------------------------------------
/shared/JohnnyJayJay/inputs/test.txt:
--------------------------------------------------------------------------------
1 | L.LL.LL.LL
2 | LLLLLLL.LL
3 | L.L.L..L..
4 | LLLL.LL.LL
5 | L.LL.LL.LL
6 | L.LLLLL.LL
7 | ..L.L.....
8 | LLLLLLLLLL
9 | L.LLLLLL.L
10 | L.LLLLL.LL
--------------------------------------------------------------------------------
/shared/paul2708/printer.py:
--------------------------------------------------------------------------------
1 | C_RED = '\033[91m'
2 | C_GREEN = '\33[32m'
3 | C_END = '\033[0m'
4 |
5 |
6 | def aoc_print(msg: str):
7 | print(f"{C_RED}[{C_GREEN}AoC{C_RED}]{C_END} {msg}")
8 |
--------------------------------------------------------------------------------
/shared/paul2708/input/day09_test.txt:
--------------------------------------------------------------------------------
1 | 35
2 | 20
3 | 15
4 | 25
5 | 47
6 | 40
7 | 62
8 | 55
9 | 65
10 | 95
11 | 102
12 | 117
13 | 150
14 | 182
15 | 127
16 | 219
17 | 299
18 | 277
19 | 309
20 | 576
--------------------------------------------------------------------------------
/shared/paul2708/input/day03_test.txt:
--------------------------------------------------------------------------------
1 | ..##.......
2 | #...#...#..
3 | .#....#..#.
4 | ..#.#...#.#
5 | .#...##..#.
6 | ..#.##.....
7 | .#.#.#....#
8 | .#........#
9 | #.##...#...
10 | #...##....#
11 | .#..#...#.#
12 |
--------------------------------------------------------------------------------
/shared/WeiiswurstDev/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "day-template",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "start": "tsc && node ."
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "@types/node": "^14.14.10"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/shared/MCqwertz/TextFileUtils.java:
--------------------------------------------------------------------------------
1 | //created by MCqwertz
2 |
3 | import java.io.File;
4 | import java.io.FileNotFoundException;
5 | import java.util.Scanner;
6 |
7 | public class TextFileUtils {
8 | public static Scanner getScanner(int day) throws FileNotFoundException {
9 | File file = new File("inputs/Day" + day + ".txt");
10 | return new Scanner(file);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/shared/paul2708/input/day04_test.txt:
--------------------------------------------------------------------------------
1 | eyr:1972 cid:100
2 | hcl:#18171d ecl:amb hgt:170 pid:186cm iyr:2018 byr:1926
3 |
4 | iyr:2019
5 | hcl:#602927 eyr:1967 hgt:170cm
6 | ecl:grn pid:012533040 byr:1946
7 |
8 | hcl:dab227 iyr:2012
9 | ecl:brn hgt:182cm pid:021572410 eyr:2020 byr:1992 cid:277
10 |
11 | hgt:59cm ecl:zzz
12 | eyr:2038 hcl:74454a iyr:2023
13 | pid:3556412378 byr:2007
14 |
--------------------------------------------------------------------------------
/shared/JohnnyJayJay/aoc.h:
--------------------------------------------------------------------------------
1 | int count_lines(FILE* file);
2 |
3 | int count_blank_lines(FILE* file);
4 |
5 | void read_ints(FILE* file, int* buf, int max);
6 |
7 | void read_longs(FILE* file, long* buf, int max);
8 |
9 | int chars_until(FILE* file, char term, int rewind);
10 |
11 | int charcount(char* str, char c, int from, int to);
12 |
13 | int intcmp(const void* one, const void* two);
14 |
--------------------------------------------------------------------------------
/shared/WeiiswurstDev/README.md:
--------------------------------------------------------------------------------
1 | # Wie nutze ich index.ts?
2 |
3 | ## Vor dem Testen
4 | 1. Installiere NodeJS und npm
5 | 2. Installiere mit `npm i -g tsc` TypeScript
6 | 3. Installiere mit `npm i` in diesem Ordner die nötigen dependencies
7 |
8 | ## Für jeden Tag
9 | 1. Kopiere die index.ts-Datei des entsprechenden Ordners in diesen Ordner
10 | 2. Platziere eine "input.txt"-Datei mit deinem input im Ordner
11 | 3. Führe die Lösung mit `npm run start` aus.
12 |
--------------------------------------------------------------------------------
/shared/WeiiswurstDev/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "day-template",
3 | "version": "1.0.0",
4 | "lockfileVersion": 1,
5 | "requires": true,
6 | "dependencies": {
7 | "@types/node": {
8 | "version": "14.14.10",
9 | "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.10.tgz",
10 | "integrity": "sha512-J32dgx2hw8vXrSbu4ZlVhn1Nm3GbeCFNw2FWL8S5QKucHGY0cyNwjdQdO+KMBZ4wpmC7KhLCiNsdk1RFRIYUQQ=="
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/shared/justentrix/file_reader.py:
--------------------------------------------------------------------------------
1 | from os.path import join, dirname
2 |
3 | inputs_dir = join(dirname(__file__), 'inputs')
4 |
5 | def open_file(file_name):
6 | return open(f'{inputs_dir}/{file_name}', 'r')
7 |
8 | def read_lines(file_name):
9 | file = open_file(file_name)
10 | lines = []
11 |
12 | for line in file:
13 | lines.append(line.strip())
14 |
15 | return lines
16 |
17 | def read_numbers(file_name):
18 | lines = read_lines(file_name)
19 | return list(map(int, lines))
20 |
--------------------------------------------------------------------------------
/Day-01/python/paul2708/solution.py:
--------------------------------------------------------------------------------
1 | from assertions import assert_equals
2 | from input_reader import read_ints
3 | from printer import aoc_print
4 |
5 | ints = read_ints("day01")
6 |
7 | # Part one
8 | res = [x * y for x in ints for y in ints if x + y == 2020]
9 | aoc_print(f"The first product is {res[0]}.")
10 |
11 | assert_equals(1003971, res[0])
12 |
13 | # Part two
14 | res = [x * y * z for x in ints for y in ints for z in ints if x + y + z == 2020]
15 | aoc_print(f"The second product is {res[0]}.")
16 |
17 | assert_equals(84035952, res[0])
18 |
--------------------------------------------------------------------------------
/Day-15/python/th3ph4nt0m/solution.py:
--------------------------------------------------------------------------------
1 | original = [5, 1, 9, 18, 13, 8, 0]
2 |
3 | data = dict()
4 |
5 | offset = 1
6 | for value in original:
7 | data[value] = offset
8 | offset += 1
9 | length = len(data)
10 |
11 | next = 0
12 |
13 | # part1: end = 2020
14 | #part2
15 | end = 30000000
16 |
17 | for i in range(len(data) + 1, end):
18 | if next in data.keys():
19 | offset = i - data[next]
20 | data[next] = i
21 | next = offset
22 | else:
23 | data[next] = i
24 | next = 0
25 |
26 | print(str(next))
--------------------------------------------------------------------------------
/shared/paul2708/input/day07_test.txt:
--------------------------------------------------------------------------------
1 | light red bags contain 1 bright white bag, 2 muted yellow bags.
2 | dark orange bags contain 3 bright white bags, 4 muted yellow bags.
3 | bright white bags contain 1 shiny gold bag.
4 | muted yellow bags contain 2 shiny gold bags, 9 faded blue bags.
5 | shiny gold bags contain 1 dark olive bag, 2 vibrant plum bags.
6 | dark olive bags contain 3 faded blue bags, 4 dotted black bags.
7 | vibrant plum bags contain 5 faded blue bags, 6 dotted black bags.
8 | faded blue bags contain no other bags.
9 | dotted black bags contain no other bags.
--------------------------------------------------------------------------------
/Day-03/kotlin/NyCodeGHG/NyCodeGHG-Day-03.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Day-04/kotlin/NyCodeGHG/NyCodeGHG-Day-04.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Day-05/kotlin/NyCodeGHG/NyCodeGHG-Day-05.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Day-06/kotlin/NyCodeGHG/NyCodeGHG-Day-06.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Day-07/kotlin/NyCodeGHG/NyCodeGHG-Day-07.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Day-08/kotlin/NyCodeGHG/NyCodeGHG-Day-08.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Day-09/kotlin/NyCodeGHG/NyCodeGHG-Day-09.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Day-10/kotlin/NyCodeGHG/NyCodeGHG-Day-11.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Day-11/kotlin/NyCodeGHG/NyCodeGHG-Day-11.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Day-06/python/th3ph4nt0m/solution.py:
--------------------------------------------------------------------------------
1 | with open("PATH") as f:
2 | string = ""
3 | all = 0
4 | total = 0
5 | totalAll = 0
6 | for line in f.read().split("\n"):
7 | if line != "":
8 | string += line
9 | all += 1
10 | else:
11 | letters = [0] * 26
12 | for char in string:
13 | letters[ord(char) - ord("a")] += 1
14 | for letter in letters:
15 | total += (letter > 0)
16 | totalAll += (all == letter)
17 | string = ""
18 | all = 0
19 |
20 | # part 1
21 | print(total)
22 | # part 2
23 | print(totalAll)
--------------------------------------------------------------------------------
/Day-01/typescript/WeiiswurstDev/index.ts:
--------------------------------------------------------------------------------
1 |
2 | // PLEASE READ THE README.md IN MY SHARED FOLDER!
3 |
4 | import fs from 'fs'
5 | import { EOL } from 'os'
6 |
7 | const input: number[] = fs.readFileSync("./input.txt").toString().split(EOL).map(num=>Number.parseInt(num))
8 |
9 | for(let i = 0; i < input.length; i++) {
10 | let x = input[i]
11 | for(let j = i; j < input.length; j++) {
12 | let y = input[j]
13 |
14 | if(x+y == 2020)
15 | console.log("Part 1: "+(x*y))
16 | for(let k = j; k < input.length; k++) {
17 | let z = input[k]
18 |
19 | if(x + y + z == 2020)
20 | console.log("Part 2: "+(x*y*z))
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/shared/JohnnyJayJay/README.md:
--------------------------------------------------------------------------------
1 | # JohnnyJayJay's solutions
2 |
3 |
4 |
5 | ## How to run them
6 |
7 | 1. Install a C compiler (preferably `cc`/`gcc`). For Windows users, I recommend using [WSL](https://docs.microsoft.com/en-us/windows/wsl/install-win10)
8 |
9 | 2. Compile from project root using `cc -Wall -g shared/JohnnyJayJay/aoc.c Day-XX/c/JohnnyJayJay/DayXX.c -o solution`
10 |
11 | 3. Run with a path to your input file as an argument, e.g. `./solution shared/JohnnyJayJay/inputs/Day-XX.txt`
12 |
13 | 4. **These input files need to have LF line endings. Many of my solutions do not work with CRLF!** You can use a tool like `dos2unix` to convert them if you're unsure.
14 |
--------------------------------------------------------------------------------
/Day-03/python/th3ph4nt0m/solution.py:
--------------------------------------------------------------------------------
1 | def part1(grid, right, down):
2 | i, j, count = 0, 0, 0
3 |
4 | # i as row, j as column
5 |
6 | while i < len(grid):
7 | if grid[i][j] == '#':
8 | count += 1
9 |
10 | j = (j + right) % len(grid[0])
11 | i = i + down
12 |
13 | return count
14 |
15 | def part2(grid):
16 | ans = 1
17 | for element in [(1, 1), (3, 1), (5, 1), (7, 1), (1, 2)]:
18 | ans *= part1(grid, element[0], element[1])
19 |
20 | return ans
21 | if __name__ == '__main__':
22 | with open('PATH') as f:
23 | grid = [line.strip('\n') for line in f]
24 |
25 | print(part1(grid, 3, 1))
26 | print(part2(grid))
--------------------------------------------------------------------------------
/Day-03/typescript/WeiiswurstDev/index.ts:
--------------------------------------------------------------------------------
1 | import fs from 'fs'
2 | import {EOL} from 'os'
3 |
4 | const input = fs.readFileSync("input.txt").toString().split(EOL);
5 | const columnLength = input[0].length;
6 |
7 | function solve(stepX: number, stepY:number) {
8 | let x=0, y=0;
9 | let treesEncountered = 0;
10 | while(y+1 < input.length) {
11 | x += stepX;
12 | y += stepY;
13 | if(getInputAt(x,y) == "#") treesEncountered++;
14 | }
15 | return treesEncountered;
16 | }
17 |
18 | function getInputAt(x: number, y: number) {
19 | return input[y][x%columnLength]
20 | }
21 |
22 | console.log("Teil 1:",solve(3, 1))
23 | console.log("Teil 2:",solve(1,1)*solve(3,1)*solve(5,1)*solve(7,1)*solve(1,2));
--------------------------------------------------------------------------------
/Day-03/python/justentrix/solution.py:
--------------------------------------------------------------------------------
1 | from file_reader import read_lines
2 |
3 | lines = read_lines('day03.txt')
4 | width = len(lines[0])
5 | height = len(lines)
6 |
7 | def count_trees(coords):
8 | trees_amount = 0
9 | x = 0
10 | y = 0
11 |
12 | while y < height:
13 | if lines[y][x] == '#':
14 | trees_amount += 1
15 |
16 | x += coords[0]
17 | y += coords[1]
18 |
19 | if x >= width:
20 | x %= width
21 |
22 | return trees_amount
23 |
24 | # Part one
25 | print(count_trees((3, 1)))
26 |
27 | # Part two
28 | coords_list = [(1, 1), (3, 1), (5, 1), (7, 1), (1, 2)]
29 | result = 1
30 |
31 | for coords in coords_list:
32 | result *= count_trees(coords)
33 |
34 | print(result)
35 |
--------------------------------------------------------------------------------
/Day-02/python/th3ph4nt0m/solution.py:
--------------------------------------------------------------------------------
1 | import re
2 | lines = []
3 | with open("PATH") as f:
4 | lines = f.readlines()
5 |
6 | valid_1 = 0
7 | valid_2 = 0
8 |
9 | pattern = '([0-9]+)-([0-9]+) ([a-z]): ([a-z]+)'
10 |
11 | for i in lines:
12 | match = re.search(pattern, i)
13 | min = int(match.group(1))
14 | max = int(match.group(2))
15 | char = match.group(3)
16 | pw = match.group(4)
17 |
18 | count = pw.count(char)
19 |
20 | if count >= min and count <= max:
21 | valid_1 += 1
22 |
23 | # part 2
24 |
25 | if pw[min - 1] == char and not pw[max - 1] == char:
26 | valid_2 += 1
27 | if pw[max - 1] == char and not pw[min - 1] == char:
28 | valid_2 += 1
29 |
30 | print(valid_1)
31 | print(valid_2)
--------------------------------------------------------------------------------
/Day-06/typescript/WeiiswurstDev/index.ts:
--------------------------------------------------------------------------------
1 | import fs from 'fs'
2 | import {EOL} from 'os'
3 |
4 | const input = fs.readFileSync("input.txt").toString().split(EOL)
5 |
6 | let atLeastOne = new Set();
7 | let everyone = new Set();
8 | let totalPart1 = 0, totalPart2 = 0;
9 | let newLine = true;
10 |
11 | for(let line of input) {
12 | if(line == "") {
13 | totalPart1 += atLeastOne.size;
14 | atLeastOne.clear();
15 | totalPart2 += everyone.size;
16 | everyone.clear();
17 | newLine = true;
18 | continue;
19 | }
20 | for(let char of line) atLeastOne.add(char)
21 |
22 | if(newLine) {
23 | for(let char of line) everyone.add(char);
24 | newLine = false;
25 | } else
26 | for(let char of everyone.values())
27 | if(!line.includes(char))
28 | everyone.delete(char)
29 | }
30 |
31 | console.log("Part 1",totalPart1)
32 | console.log("Part 2",totalPart2)
--------------------------------------------------------------------------------
/shared/JohnnyJayJay/inputs/Day-10.txt:
--------------------------------------------------------------------------------
1 | 99
2 | 151
3 | 61
4 | 134
5 | 112
6 | 70
7 | 75
8 | 41
9 | 119
10 | 137
11 | 158
12 | 50
13 | 167
14 | 60
15 | 116
16 | 117
17 | 62
18 | 82
19 | 31
20 | 3
21 | 72
22 | 88
23 | 165
24 | 34
25 | 8
26 | 14
27 | 27
28 | 108
29 | 166
30 | 71
31 | 51
32 | 42
33 | 135
34 | 122
35 | 140
36 | 109
37 | 1
38 | 101
39 | 2
40 | 77
41 | 85
42 | 76
43 | 143
44 | 100
45 | 127
46 | 7
47 | 107
48 | 13
49 | 148
50 | 118
51 | 56
52 | 159
53 | 133
54 | 21
55 | 154
56 | 152
57 | 130
58 | 78
59 | 54
60 | 104
61 | 160
62 | 153
63 | 95
64 | 49
65 | 19
66 | 69
67 | 142
68 | 63
69 | 11
70 | 12
71 | 29
72 | 98
73 | 84
74 | 28
75 | 17
76 | 146
77 | 161
78 | 115
79 | 4
80 | 94
81 | 24
82 | 126
83 | 136
84 | 91
85 | 57
86 | 30
87 | 155
88 | 79
89 | 66
90 | 141
91 | 48
92 | 125
93 | 162
94 | 37
95 | 40
96 | 147
97 | 18
98 | 20
99 | 45
100 | 55
101 | 83
102 |
--------------------------------------------------------------------------------
/Day-06/python/paul2708/solution.py:
--------------------------------------------------------------------------------
1 | from assertions import assert_equals
2 | from input_reader import read_split_lines
3 | from printer import aoc_print
4 |
5 | groups = read_split_lines("day06")
6 |
7 | # Part one
8 | total_sum = 0
9 | for group in groups:
10 | votes = set()
11 | for single_person in group:
12 | for question in single_person:
13 | votes.add(question)
14 |
15 | total_sum += len(votes)
16 |
17 | aoc_print(f"The count of 'yes' votes is {total_sum}.")
18 | assert_equals(6714, total_sum)
19 |
20 | # Part two
21 | total_sum = 0
22 | for group in groups:
23 | votes = list()
24 |
25 | for single_person in group:
26 | for question in single_person:
27 | votes.append(question)
28 |
29 | for vote in set(votes):
30 | if votes.count(vote) == len(group):
31 | total_sum += 1
32 |
33 | aoc_print(f"The count of 'yes' votes in every group is {total_sum}.")
34 | assert_equals(3435, total_sum)
35 |
--------------------------------------------------------------------------------
/shared/paul2708/input_reader.py:
--------------------------------------------------------------------------------
1 | from typing import List
2 |
3 |
4 | def read_split_lines(day: str) -> List[List[str]]:
5 | total_groups = []
6 | group = []
7 | for line in read_lines(day):
8 | if not line.strip():
9 | total_groups.append(group)
10 | group = []
11 | continue
12 |
13 | group.append(line)
14 |
15 | total_groups.append(group)
16 |
17 | return total_groups
18 |
19 |
20 | def read_ints(day: str) -> List[int]:
21 | file = open(f"../../../shared/paul2708/input/{day}.txt", "r")
22 |
23 | lines = file.read().splitlines()
24 | ints = []
25 |
26 | for i in range(len(lines) - 1):
27 | ints.append(int(lines[i]))
28 |
29 | file.close()
30 | return ints
31 |
32 |
33 | def read_lines(day: str) -> List[str]:
34 | file = open(f"../../../shared/paul2708/input/{day}.txt", "r")
35 |
36 | lines = file.read().splitlines()
37 |
38 | file.close()
39 | return lines
40 |
--------------------------------------------------------------------------------
/Day-01/kotlin/warriorzz/solution.kt:
--------------------------------------------------------------------------------
1 | import java.io.File
2 |
3 | fun main() {
4 | var partOne = false
5 | var partTwo = false
6 |
7 | val file = File("YOUR-PATH-TO-FILE-HERE") //Just copy the output of the website in this file
8 | val inputArray: Array = Array(file.bufferedReader().lines().count().toInt()) { i -> i * 1000 }
9 | val inputArray2: List = file.bufferedReader().readLines()
10 |
11 | for (i in inputArray.indices)
12 | inputArray[i] = inputArray2[i].toInt()
13 |
14 | for (i in inputArray)
15 | for (j in inputArray) {
16 | if (i + j == 2020 && !partOne) {
17 | println("" + i + " * " + j + " = " + i * j)
18 | partOne = true
19 | }
20 | for (k in inputArray)
21 | if (i + j + k == 2020 && !partTwo) {
22 | println("" + i + " * " + j + " * " + k + " = " + i * j * k)
23 | partTwo = true
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/Day-10/kotlin/NyCodeGHG/solution.kt:
--------------------------------------------------------------------------------
1 | package de.nycode.aoc2020.day10
2 |
3 | import java.nio.file.Files
4 | import java.nio.file.Paths
5 |
6 | fun main() {
7 | val adapters: List = Files.readAllLines(Paths.get("input.txt"))
8 | .map { it.toIntOrNull() ?: error("Invalid input $it") }
9 | .plus(0)
10 | .run {
11 | plus(maxOrNull()!! + 3)
12 | }.sorted()
13 |
14 | val partOneSolution = adapters
15 | .asSequence()
16 | .zipWithNext()
17 | .map { it.second - it.first }
18 | .groupingBy { it }
19 | .eachCount()
20 | .run {
21 | (this[1] ?: 1) * (this[3] ?: 1)
22 | }
23 | println(partOneSolution)
24 |
25 | val paths = mutableMapOf(0 to 1L)
26 | adapters.drop(1).forEach {
27 | paths[it] = (1..3)
28 | .map { last -> paths[it - last] ?: 0 }
29 | .sum()
30 | }
31 | println(paths[adapters.last()])
32 | }
33 |
--------------------------------------------------------------------------------
/Day-02/typescript/WeiiswurstDev/index.ts:
--------------------------------------------------------------------------------
1 |
2 | // Please read the README.md in my shared folder!
3 |
4 | import fs from 'fs'
5 | import { EOL } from 'os'
6 |
7 | const input = fs.readFileSync("input.txt").toString().split(EOL);
8 |
9 | let validEntries = 0;
10 | let part2validEntries = 0;
11 |
12 | for(let entry of input) {
13 | let split = entry.split(" ")
14 | let amounts = split[0].split("-").map(num=>Number.parseInt(num))
15 | let limitedChar = split[1].substring(0,1)
16 | let pass = split[2]
17 |
18 | let actualAmount = 0;
19 | for(let char of pass) {
20 | if(limitedChar == char) actualAmount++;
21 | }
22 | if(actualAmount >= amounts[0] && actualAmount <= amounts[1]) {
23 | validEntries++;
24 | }
25 |
26 | let correctIndexes = 0;
27 |
28 | for(let index of amounts) {
29 | let char = pass[index-1];
30 | if(char == limitedChar)
31 | correctIndexes++;
32 | }
33 | if(correctIndexes == 1) part2validEntries++;
34 | }
35 |
36 | console.log("Part 1",validEntries)
37 | console.log("Part 2",part2validEntries)
--------------------------------------------------------------------------------
/Day-13/python/th3ph4nt0m/solution.py:
--------------------------------------------------------------------------------
1 | from math import ceil
2 | from functools import reduce
3 |
4 | with open("PATH", 'r') as f:
5 | time = int(f.readline().strip())
6 | buses = f.readline().split(',')
7 |
8 | # part 1
9 | valid = [int(value) for value in buses if value != 'x']
10 |
11 | departues = ([(ceil(time/bus)*bus, bus) for bus in valid])
12 | bus = min(departues)
13 |
14 | print((bus[0]-time)*bus[1])
15 |
16 | # part 2
17 | def remainder(n, na):
18 | def mul_inv(a, b):
19 | b0 = b
20 | x0, x1 = 0, 1
21 | if b == 1: return 1
22 | while a > 1:
23 | q = a // b
24 | a, b = b, a%b
25 | x0, x1 = x1 - q * x0, x0
26 | if x1 < 0: x1 += b0
27 | return x1
28 |
29 | sum = 0
30 | prod = reduce(lambda a, b: a*b, n)
31 | for n_i, a_i in zip(n, a):
32 | p = prod // n_i
33 | sum += a_i * mul_inv(p, n_i) * p
34 | return sum % prod
35 |
36 | n = valid
37 | a = [-i for i in range(len(buses)) if buses[i] != 'x']
38 |
39 | print(remainder(n, a))
--------------------------------------------------------------------------------
/Day-08/typescript/WeiiswurstDev/index.ts:
--------------------------------------------------------------------------------
1 | import fs from 'fs'
2 | import {EOL} from 'os'
3 |
4 | const input = fs.readFileSync("input.txt").toString().split(EOL)
5 |
6 | const linesVisited = new Set();
7 |
8 | let part = 1;
9 |
10 | function exec(acc:number,line:number):any {
11 | if(line >= input.length) return false;
12 | if(linesVisited.has(line)) {
13 | if(part == 1) console.log("Part 1",acc)
14 | return true;
15 | }
16 | linesVisited.add(line)
17 | const split = input[line].split(" ");
18 | const exp = split[0]
19 | if(exp=="nop") {
20 | return exec(acc,line+1)
21 | }
22 | else if(exp=="jmp") return exec(acc,line+parseNumber(split[1]))
23 | else if(exp=="acc") {
24 | acc+=parseNumber(split[1])
25 | return exec(acc,line+1)
26 | }
27 | }
28 |
29 | function parseNumber(number:string):number {
30 | if(number[0]=="+") return Number.parseInt(number.substring(1,number.length))
31 | else return Number.parseInt(number)
32 | }
33 |
34 | exec(0,0)
35 |
36 | part = 2;
37 |
38 | console.log("No solution for Part 2 (yet). I might add one when I find time for it.")
--------------------------------------------------------------------------------
/Day-01/python/justentrix/solution.py:
--------------------------------------------------------------------------------
1 | from file_reader import read_numbers
2 |
3 | numbers = read_numbers('day01.txt')
4 |
5 | def get_first_numbers():
6 | max_index = len(numbers) - 1
7 |
8 | for i in range(max_index):
9 | curr = numbers[i]
10 |
11 | for j in range(i + 1, max_index):
12 | next = numbers[j]
13 | if (curr + next) == 2020:
14 | return curr, next
15 |
16 | def get_second_numbers():
17 | max_index = len(numbers) - 2
18 |
19 | for i in range(max_index):
20 | first = numbers[i]
21 |
22 | for j in range(i + 1, max_index):
23 | second = numbers[j]
24 |
25 | for k in range(i + 2, max_index):
26 | third = numbers[k]
27 |
28 | if (first + second + third) == 2020:
29 | return first, second, third
30 |
31 | # Part one
32 | nums = get_first_numbers()
33 | first = nums[0]
34 | second = nums[1]
35 |
36 | print(f'{first} + {second} = {first + second}')
37 | print(f'{first} x {second} = {first * second}')
38 |
39 | # Part two
40 | nums = get_second_numbers()
41 | first = nums[0]
42 | second = nums[1]
43 | third = nums[2]
44 |
45 | print(f'{first} + {second} + {third} = {first + second + third}')
46 | print(f'{first} x {second} x {third} = {first * second * third}')
47 |
--------------------------------------------------------------------------------
/Day-05/typescript/WeiiswurstDev/index.ts:
--------------------------------------------------------------------------------
1 | import fs from 'fs'
2 | import {EOL} from 'os'
3 |
4 | const input = fs.readFileSync("input.txt").toString().split(EOL).sort()
5 | console.log(input.length)
6 |
7 | function toBin(x:string,binaryOne:string) {
8 | let current = 0;
9 | for(let i = 0; i < x.length; i++)
10 | current += (x[i]==binaryOne?1:0)*(Math.pow(2,x.length-i) / 2)
11 | return current;
12 | }
13 |
14 |
15 | let maxSeatId = 0;
16 | let lastCol = 0;
17 | let ignoreRow = -1;
18 | for(let line of input) {
19 | let row = toBin(line.substring(0,7),"B")
20 | let col = toBin(line.substring(7,line.length),"R")
21 | //console.log(line,line.substring(0,7),row,line.substring(7,line.length),col)
22 | let seatId = row*8+col;
23 | if(seatId > maxSeatId) maxSeatId = seatId;
24 |
25 | if(col-lastCol == 0) ignoreRow = row-1;
26 | else if(row==ignoreRow) ignoreRow = -1;
27 | // My poor attempt at part 2, I fiddled with this if statement until it spat out numbers in "Part 2", then tried the sensible numbers.
28 | // Do not repeat.
29 | //else if(col-lastCol != 1 && col-lastCol != -7 && row > 2) console.log("Part 2",seatId)
30 | lastCol = col;
31 | }
32 |
33 | console.log("Part 1",maxSeatId)
34 | console.log("No solution for part 2. Please use another solution.")
--------------------------------------------------------------------------------
/Day-09/typescript/WeiiswurstDev/index.ts:
--------------------------------------------------------------------------------
1 | import {readFileSync} from 'fs'
2 | import {EOL} from 'os'
3 |
4 | const input = readFileSync("input.txt").toString().split(EOL).map(line=>Number.parseInt(line))
5 |
6 | const last25:number[] = []
7 | let counter = 0;
8 | const sums:number[] = [];
9 |
10 | let part1 = 0;
11 |
12 | for(let num of input) {
13 | if(last25.length != 25) {
14 | last25.push(num)
15 | if(last25.length == 25)
16 | for(let x of last25)
17 | for(let y of last25)
18 | sums.push(x+y)
19 | } else {
20 | if(!sums.includes(num)) {
21 | part1 = num;
22 | break;
23 | }
24 | last25[counter] = num;
25 | for(let i = 0; i < 25; i++) {
26 | sums[i+counter*25] = num+last25[i];
27 | }
28 | counter++;
29 | if(counter==25) counter=0;
30 | }
31 | }
32 |
33 | console.log("Part 1",part1)
34 |
35 | for(let i = 0; i < input.length; i++) {
36 | let sum = input[i];
37 | let j = i;
38 | let smallest = Number.MAX_VALUE;
39 | let largest = Number.MIN_VALUE;
40 | while(sum < part1) {
41 | j++
42 | sum += input[j]
43 | smallest = Math.min(smallest,input[j])
44 | largest = Math.max(largest,input[j])
45 | }
46 | if(sum == part1) {
47 | console.log("Part 2",smallest+largest)
48 | break;
49 | }
50 | }
--------------------------------------------------------------------------------
/Day-06/c/JohnnyJayJay/Day06.c:
--------------------------------------------------------------------------------
1 | // Read my README in shared/JohnnyJayJay
2 |
3 | #include
4 | #include
5 | #include "../../../shared/JohnnyJayJay/aoc.h"
6 |
7 | int popcount(uint32_t bits) {
8 | int count;
9 | for (count = 0; bits > 0; bits >>= 1) {
10 | count += bits & 1;
11 | }
12 | return count;
13 | }
14 |
15 | int main(int argc, char** argv) {
16 | FILE* file = fopen(argv[1], "r");
17 | int groups = count_blank_lines(file) + 1;
18 | int sum_1 = 0;
19 | int sum_2 = 0;
20 | for (int i = 0; i < groups; i++) {
21 | int next;
22 | uint32_t group_set_1 = 0;
23 | uint32_t group_set_2 = 0xffffffff;
24 | while ((next = fgetc(file)) != '\n' && next != EOF) {
25 | uint32_t person_set = 0;
26 | do {
27 | int pos = next - 'a';
28 | person_set |= 1 << pos;
29 | next = fgetc(file);
30 | } while (next != EOF && next != '\n');
31 | group_set_1 |= person_set;
32 | group_set_2 &= person_set;
33 | }
34 | sum_1 += popcount(group_set_1);
35 | sum_2 += popcount(group_set_2);
36 | }
37 | printf("Sum of the group answer counts (part 1): %d\n", sum_1);
38 | printf("Sum of the group answer counts (part 2): %d\n", sum_2);
39 | }
40 |
--------------------------------------------------------------------------------
/Day-02/python/paul2708/solution.py:
--------------------------------------------------------------------------------
1 | from assertions import assert_equals
2 | from input_reader import read_lines
3 | from printer import aoc_print
4 |
5 | lines = read_lines("day02")
6 |
7 | # Part one
8 | valid_passwords = 0
9 |
10 | for line in lines:
11 | parts = line.split(" ")
12 |
13 | lower_bound = int(parts[0].split("-")[0])
14 | upper_bound = int(parts[0].split("-")[1])
15 |
16 | letter = parts[1][:-1]
17 |
18 | password = parts[2]
19 |
20 | letter_count = len([x for x in password if x == letter])
21 |
22 | if lower_bound <= letter_count <= upper_bound:
23 | valid_passwords += 1
24 |
25 | aoc_print(f"{valid_passwords} passwords are valid. (old interpretation)")
26 | assert_equals(424, valid_passwords)
27 |
28 | # Part two
29 | valid_passwords = 0
30 |
31 | for line in lines:
32 | parts = line.split(" ")
33 |
34 | first_index = int(parts[0].split("-")[0]) - 1
35 | second_index = int(parts[0].split("-")[1]) - 1
36 |
37 | letter = parts[1][:-1]
38 |
39 | password = parts[2]
40 |
41 | if password[first_index] == letter and password[second_index] != letter\
42 | or password[first_index] != letter and password[second_index] == letter:
43 | valid_passwords += 1
44 |
45 | aoc_print(f"{valid_passwords} passwords are valid. (new interpretation)")
46 | assert_equals(747, valid_passwords)
47 |
--------------------------------------------------------------------------------
/Day-07/kotlin/NyCodeGHG/solution.kt:
--------------------------------------------------------------------------------
1 | package de.nycode.aoc2020.day07
2 |
3 | import java.nio.file.Files
4 | import java.nio.file.Paths
5 |
6 | fun main() {
7 | val bags = Files.readAllLines(Paths.get("input.txt"))
8 | .asSequence()
9 | .map { it.removeSuffix(".") }
10 | .filterNot { it.contains("no other") }
11 | .map { it.replace("bag[s]?".toRegex(), "").replace("contain", ",").split(",") }
12 | .map { it.map(String::trim) }
13 | .map { it[0] to Bag(it[0], toChildBags(it.subList(1, it.size))) }
14 | .toList().toMap()
15 |
16 | println(bags.filter { it.value.hasColor("shiny gold", bags) }.count())
17 | println(bags["shiny gold"]?.getChildBagNumber(bags))
18 | }
19 |
20 | data class Bag(val color: String, val childBags: Map)
21 |
22 | fun Bag.hasColor(color: String, bags: Map): Boolean =
23 | if (this.childBags.keys.contains(color)) true
24 | else this.childBags.keys.any { bags[it]?.hasColor(color, bags) == true }
25 |
26 | fun toChildBags(bags: List): Map {
27 | return bags.map { it.substring(2) to Integer.parseInt(it.substring(0, 1)) }.toMap()
28 | }
29 |
30 | fun Bag.getChildBagNumber(bags: Map): Int {
31 | return this.childBags.map { (bags[it.key]?.getChildBagNumber(bags) ?: 0) * it.value + it.value }.sum()
32 | }
--------------------------------------------------------------------------------
/Day-12/python/th3ph4nt0m/solution.py:
--------------------------------------------------------------------------------
1 | def read():
2 | with open("PATH", "r", newline=None) as f:
3 | f = f.read().splitlines()
4 | f = [(d[0], int(d[1:])) for d in f]
5 | return f
6 |
7 | def part1(data):
8 | di = {"W":(-1,0), "N":(0,1), "S":(0,-1), "E":(1,0)}
9 | ro = [0, 1, 0, -1]
10 | pos = [0,0]
11 | r = 1
12 | for d in data:
13 | if d[0] == "L":
14 | r -= d[1]//90
15 | elif d[0] == "R":
16 | r += d[1]//90
17 | elif d[0] == "F":
18 | pos[0] += ro[r%4]*d[1]
19 | pos[1] += ro[(r+1)%4]*d[1]
20 | else:
21 | pos[0] += di[d[0]][0]*d[1]
22 | pos[1] += di[d[0]][1]*d[1]
23 |
24 | return abs(pos[0]) + abs(pos[1])
25 |
26 |
27 | def part2(data):
28 | da = {"E":0, "S":1, "W":2, "N":3}
29 | ra = [10, 0, 0, 1]
30 | pos = [0,0]
31 | for d in data:
32 | if d[0] == "L":
33 | t = d[1]//90
34 | ra = ra[t:] + ra[:t]
35 | elif d[0] == "R":
36 | t = d[1]//90
37 | ra = ra[-t:] + ra[:-t]
38 | elif d[0] == "F":
39 | pos[0] += (ra[0]-ra[2])*d[1]
40 | pos[1] += (ra[3]-ra[1])*d[1]
41 | else:
42 | ra[da[d[0]]] += d[1]
43 |
44 | return abs(pos[0])+abs(pos[1])
45 |
46 |
47 | if __name__ == "__main__":
48 | data = read()
49 | print(part1(data))
50 | print(part2(data))
--------------------------------------------------------------------------------
/Day-09/python/paul2708/solution.py:
--------------------------------------------------------------------------------
1 | from assertions import assert_equals
2 | from input_reader import read_ints
3 | from printer import aoc_print
4 |
5 | numbers = read_ints("day09")
6 | preamble = 25 # has to be 5 if you run the test set
7 | start = 0
8 |
9 | # Part one
10 | while True:
11 | pairs = [(x, y) for x in numbers[start:preamble + start] for y in numbers[start:preamble + start] if
12 | x != y and x + y == numbers[preamble + start]]
13 |
14 | if len(pairs) == 0:
15 | aoc_print(f"The first number that does not have a pair is {numbers[preamble + start]}.")
16 | assert_equals(22406676, numbers[preamble + start])
17 | break
18 |
19 | start += 1
20 |
21 | # Part two
22 | invalid_number = numbers[preamble + start]
23 |
24 | set_start = -1
25 | set_end = -1
26 |
27 | for i in range(0, preamble + start):
28 | total_sum = 0
29 | for j in range(i, preamble + start):
30 | total_sum += numbers[j]
31 |
32 | if total_sum == invalid_number:
33 | set_start = i
34 | set_end = j
35 | break
36 | elif total_sum > invalid_number:
37 | break
38 |
39 | if set_start != -1:
40 | break
41 |
42 | min_set = min(numbers[set_start:set_end])
43 | max_set = max(numbers[set_start:set_end])
44 |
45 | aoc_print(f"The min value ({min_set}) and max value ({max_set}) sums up to {min_set + max_set}.")
46 | assert_equals(2942387, min_set + max_set)
47 |
--------------------------------------------------------------------------------
/Day-07/typescript/WeiiswurstDev/index.ts:
--------------------------------------------------------------------------------
1 | import fs from 'fs'
2 | import {EOL} from 'os'
3 |
4 | const input = fs.readFileSync("input.txt").toString().split(EOL)
5 |
6 | type BagContainList = {
7 | color:string,
8 | amount:number
9 | }[];
10 |
11 | type BagList = {
12 | [key: string]: BagContainList
13 | }
14 |
15 | const bags: BagList = {}
16 |
17 | for(let line of input) {
18 | const split = line.split(" ");
19 | const contains:BagContainList = [];
20 | if(split[4] != "no") for(let i = 4; i < split.length; i+=4)
21 | contains.push({
22 | color:split[i+1]+" "+split[i+2],
23 | amount:Number.parseInt(split[i])
24 | });
25 | bags[split[0]+" "+split[1]] = contains;
26 | }
27 |
28 | let part1total = 0;
29 |
30 | for(let bag in bags) {
31 | if(checkBag(bags[bag])) part1total++;
32 | }
33 |
34 | function checkBag(containList:BagContainList):boolean {
35 | let hasGoldenBag = false;
36 | for(let contains of containList) {
37 | if(contains.color == "shiny gold") return true;
38 | else if(checkBag(bags[contains.color])) {
39 | hasGoldenBag = true;
40 | break;
41 | }
42 | }
43 | return hasGoldenBag;
44 | }
45 |
46 | function countBagsInside(bagList:BagContainList):number {
47 | let count = 1;
48 | for(let bag of bagList) {
49 | count += countBagsInside(bags[bag.color])*bag.amount;
50 | }
51 | return count;
52 | }
53 |
54 | console.log("Part 1",part1total)
55 | console.log("Part 2",countBagsInside(bags["shiny gold"])-1)
--------------------------------------------------------------------------------
/Day-01/c/JohnnyJayJay/Day01.c:
--------------------------------------------------------------------------------
1 | // Read my README in shared/JohnnyJayJay
2 |
3 | #include
4 | #include
5 | #include "../../../shared/JohnnyJayJay/aoc.h"
6 |
7 | int main(int argc, char** argv) {
8 | puts("Reading file...");
9 | char* input_file = argv[1];
10 | FILE* file = fopen(input_file, "r");
11 | int lines = count_lines(file);
12 | printf("Read %d lines\n", lines);
13 | int* numbers = malloc(sizeof(int) * lines);
14 | read_ints(file, numbers, lines);
15 | puts("Solving...");
16 | int part1 = 0;
17 | int part2 = 0;
18 | for (int i = 0; i < lines; i++) {
19 | int first = numbers[i];
20 | for (int j = 0; j < lines; j++) {
21 | int second = numbers[j];
22 | if (first + second == 2020) {
23 | printf("Found numbers for part 1: %d %d - Result: %d\n", first, second, first * second);
24 | part1 = 1;
25 | }
26 | for (int k = 0; !part2 && k < lines; k++) {
27 | int third = numbers[k];
28 | if (first + second + third == 2020) {
29 | printf("Found numbers for part 2: %d %d %d - Result: %d\n", first, second, third, first * second * third);
30 | part2 = 1;
31 | break;
32 | }
33 | }
34 | if (part1 && part2) {
35 | i = lines;
36 | break;
37 | }
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/Day-03/python/paul2708/solution.py:
--------------------------------------------------------------------------------
1 | from assertions import assert_equals
2 | from input_reader import read_lines
3 | from printer import aoc_print
4 |
5 |
6 | class Map:
7 | TREE = "#"
8 | SQUARE = "."
9 |
10 | def __init__(self, tree_map: [str]):
11 | self.width = len(tree_map[0])
12 | self.height = len(tree_map)
13 | self.tree_map = tree_map
14 |
15 | def get(self, x, y) -> str:
16 | return self.tree_map[y][x % self.width]
17 |
18 | def is_tree(self, x, y) -> bool:
19 | return self.get(x, y) == self.TREE
20 |
21 | def get_height(self) -> int:
22 | return self.height
23 |
24 |
25 | # Part one
26 | tree_map = Map(read_lines("day03"))
27 | x_slope = 3
28 | y_slope = 1
29 |
30 | x = 0
31 | y = 0
32 |
33 | trees = 0
34 | while y < tree_map.get_height():
35 | if tree_map.is_tree(x, y):
36 | trees += 1
37 |
38 | x += x_slope
39 | y += y_slope
40 |
41 | aoc_print(f"You would hit {trees} trees. (ouch)")
42 | assert_equals(151, trees)
43 |
44 | # Part two
45 | slopes = [[1, 1], [3, 1], [5, 1], [7, 1], [1, 2]]
46 | result = 1
47 |
48 | for slope in slopes:
49 | x = 0
50 | y = 0
51 |
52 | trees = 0
53 | while y < tree_map.get_height():
54 | if tree_map.is_tree(x, y):
55 | trees += 1
56 |
57 | x += slope[0]
58 | y += slope[1]
59 |
60 | result *= trees
61 |
62 | aoc_print(f"The product of hit trees is {result}.")
63 | assert_equals(7540141059, result)
64 |
--------------------------------------------------------------------------------
/Day-02/c/JohnnyJayJay/Day02.c:
--------------------------------------------------------------------------------
1 | // Read my README in shared/JohnnyJayJay
2 |
3 | #include
4 | #include
5 | #include
6 | #include "../../../shared/JohnnyJayJay/aoc.h"
7 |
8 | typedef struct {
9 | int min;
10 | int max;
11 | char c;
12 | char* password;
13 | } db_entry;
14 |
15 |
16 | int main(int argc, char** argv) {
17 | FILE* file = fopen(argv[1], "r");
18 | int lines = count_lines(file);
19 |
20 | db_entry* entries = malloc(sizeof(db_entry) * lines);
21 | for (int i = 0; i < lines; i++) {
22 | int min, max;
23 | char c;
24 | char* password = malloc(chars_until(file, '\n', 1) + 1);
25 | fscanf(file, "%d-%d %c: %s", &min, &max, &c, password);
26 | db_entry entry = {.min = min, .max = max, .c = c, .password = password};
27 | entries[i] = entry;
28 | }
29 |
30 | int valid_passwords1 = 0;
31 | int valid_passwords2 = 0;
32 | for (int i = 0; i < lines; i++) {
33 | db_entry* entry = &entries[i];
34 | char* pw = entry->password;
35 | char c = entry->c;
36 | int min = entry->min;
37 | int max = entry->max;
38 | int count = charcount(pw, c, 0, strlen(pw));
39 | if (count >= min && count <= max) {
40 | valid_passwords1++;
41 | }
42 | if ((pw[min - 1] == c) ^ (pw[max - 1] == c)) {
43 | valid_passwords2++;
44 | }
45 | }
46 |
47 | printf("Valid passwords (part 1): %d\n", valid_passwords1);
48 | printf("Valid passwords (part 2): %d\n", valid_passwords2);
49 | }
50 |
--------------------------------------------------------------------------------
/Day-03/java/MCqwertz/Day3.java:
--------------------------------------------------------------------------------
1 | //created by MCqwertz
2 |
3 | import java.io.FileNotFoundException;
4 | import java.util.ArrayList;
5 | import java.util.Scanner;
6 |
7 | public class Day3 {
8 | public static void main(String[] args) throws FileNotFoundException {
9 | char[][] grid = getInput();
10 | System.out.println("Part 1: " + getTrees(grid, 3, 1));
11 | System.out.println("Part 2: " + getSecondResult(grid));
12 | }
13 |
14 |
15 | private static long getSecondResult(char[][] grid) {
16 | return getTrees(grid, 1, 1) * getTrees(grid, 3, 1) * getTrees(grid, 5, 1) *
17 | getTrees(grid, 7, 1) * getTrees(grid, 1, 2);
18 | }
19 |
20 | private static long getTrees(char[][] grid, int right, int down) {
21 | long trees = 0;
22 | int coulomb = 0;
23 | for (int i = down; i < grid.length; i += down) {
24 | coulomb = coulomb + right;
25 | if (grid[i][coulomb % grid[i].length] == '#') {
26 | trees++;
27 | }
28 | }
29 | return trees;
30 | }
31 |
32 | public static char[][] getInput() throws FileNotFoundException {
33 | Scanner scanner = TextFileUtils.getScanner(3);
34 | ArrayList arrayList = new ArrayList<>();
35 | while(scanner.hasNextLine()) {
36 | arrayList.add(scanner.nextLine());
37 | }
38 | int coulombs = arrayList.get(0).toCharArray().length;
39 | char[][] grid = new char[arrayList.size()][coulombs];
40 | int j = 0;
41 | for (int i = 0; i < arrayList.size(); i++){
42 | for (char c : arrayList.get(i).toCharArray()) {
43 | grid[i][j++] = c;
44 | }
45 | j = 0;
46 | }
47 | scanner.close();
48 | return grid;
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/Day-02/kotlin/warriorzz/solution.kt:
--------------------------------------------------------------------------------
1 | import java.io.File
2 |
3 | fun main() {
4 | val file = File("./src/main/kotlin/day-02-input")
5 |
6 | val inputArray: List = file.bufferedReader().readLines()
7 |
8 | var counter = 0
9 |
10 | for(i in inputArray.indices) {
11 | val split: List = inputArray[i].split(" ")
12 |
13 | val numbers = split[0]
14 | val letter = split[1].replace(":", "")
15 | val password = split[2]
16 |
17 | var charCounter = 0
18 | for(char in password.subSequence(password.indices)) {
19 | if(char == letter[0])
20 | charCounter++
21 | }
22 |
23 | if(charCounter <= numbers.split("-")[1].toInt() && charCounter >= numbers.split("-")[0].toInt())
24 | counter++
25 | }
26 |
27 | println("PartOne:")
28 | println(counter)
29 |
30 | counter = 0
31 | for(i in inputArray.indices) {
32 | val split: List = inputArray[i].split(" ")
33 |
34 | val numbers = split[0]
35 | val letter = split[1].replace(":", "")
36 | val password = split[2]
37 |
38 | val firstNumber = numbers.split("-")[0].toInt()
39 | val secondNumber = numbers.split("-")[1].toInt()
40 |
41 | if (password[firstNumber -1] == letter[0]) {
42 | if (password[secondNumber -1] != letter[0]) {
43 | counter++
44 | }
45 | } else {
46 | if (password[secondNumber -1] == letter[0]) {
47 | counter++
48 | }
49 | }
50 | }
51 | println("PartTwo:")
52 | println(counter)
53 | }
--------------------------------------------------------------------------------
/Day-03/c/JohnnyJayJay/Day03.c:
--------------------------------------------------------------------------------
1 | // Read my README in shared/JohnnyJayJay
2 |
3 | #include
4 | #include
5 | #include
6 | #include "../../../shared/JohnnyJayJay/aoc.h"
7 |
8 | int traverse(uint32_t* levels, int lines, int width, int x_step, int y_step) {
9 | int x_pos = 0;
10 | int tree_count = 0;
11 | for (int i = 0; i < lines; i += y_step) {
12 | uint32_t level = levels[i];
13 | if ((level >> (width - 1 - x_pos)) & 1) {
14 | tree_count++;
15 | }
16 | x_pos = (x_pos + x_step) % width;
17 | }
18 | return tree_count;
19 | }
20 |
21 | int main(int argc, char** argv) {
22 | FILE* file = fopen(argv[1], "r");
23 | int lines = count_lines(file);
24 | int width = chars_until(file, '\n', 1);
25 | uint32_t* levels = malloc(sizeof(uint32_t) * lines);
26 | for (int i = 0; i < lines; i++) {
27 | uint32_t level = 0;
28 | int spot;
29 | while ((spot = fgetc(file)) != '\n' && spot != EOF) {
30 | level <<= 1;
31 | level |= spot == '#';
32 | }
33 | levels[i] = level;
34 | }
35 |
36 | uint64_t first = traverse(levels, lines, width, 3, 1);
37 | printf("You encounter %lu trees the first slope.\n", first);
38 | uint64_t second = traverse(levels, lines, width, 1, 1);
39 | uint64_t third = traverse(levels, lines, width, 5, 1);
40 | uint64_t fourth = traverse(levels, lines, width, 7, 1);
41 | uint64_t fiveth = traverse(levels, lines, width, 1, 2);
42 | printf("The trees on all slopes multiplied together: %lu\n", first * second * third * fourth * fiveth);
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/Day-05/c/JohnnyJayJay/Day05.c:
--------------------------------------------------------------------------------
1 | // Read my README in shared/JohnnyJayJay
2 |
3 | #include
4 | #include
5 | #include "../../../shared/JohnnyJayJay/aoc.h"
6 |
7 | int find_value(char* desc, int length, char lower, char upper) {
8 | int min = 0;
9 | int delta = 1 << length;
10 | for (int i = 0; i < length; i++) {
11 | delta /= 2;
12 | if (desc[i] == upper) {
13 | min += delta;
14 | }
15 | }
16 | return min;
17 | }
18 |
19 | int intcmp(const void* one, const void* two) {
20 | int a = *((int*) one);
21 | int b = *((int*) two);
22 | return a - b;
23 | }
24 |
25 | int main(int argc, char** argv) {
26 | FILE* file = fopen(argv[1], "r");
27 | int lines = count_lines(file);
28 | char row_desc[8];
29 | char column_desc[4];
30 | int* passes = malloc(sizeof(int) * lines);
31 | for (int i = 0; i < lines; i++) {
32 | fscanf(file, "%7s%3s", row_desc, column_desc);
33 | int row = find_value(row_desc, 7, 'F', 'B');
34 | int column = find_value(column_desc, 3, 'L', 'R');
35 | passes[i] = row * 8 + column;
36 | }
37 | qsort(passes, lines, sizeof(int), &intcmp);
38 | int max_seat_id = passes[lines - 1];
39 | printf("Highest seat id: %d\n", max_seat_id);
40 | int own_seat_id = 0;
41 | for (int i = 0; i < lines - 1; i++) {
42 | int first = passes[i];
43 | int second = passes[i + 1];
44 | if (second - first == 2) {
45 | own_seat_id = first + 1;
46 | break;
47 | }
48 | }
49 | printf("Own seat id: %d\n", own_seat_id);
50 | }
51 |
52 |
53 |
--------------------------------------------------------------------------------
/Day-05/python/paul2708/solution.py:
--------------------------------------------------------------------------------
1 | from assertions import assert_equals
2 | from input_reader import read_lines
3 | from printer import aoc_print
4 | import math
5 |
6 |
7 | def binary_search(line: str, lower: int, upper: int, lower_char: str, upper_char: str) -> int:
8 | lower_bound = lower
9 | upper_bound = upper
10 |
11 | for letter in line:
12 | if letter == lower_char:
13 | upper_bound = math.floor((lower_bound + upper_bound) / 2)
14 | elif letter == upper_char:
15 | lower_bound = math.ceil((lower_bound + upper_bound) / 2)
16 |
17 | return lower_bound
18 |
19 |
20 | def calc_seat(line: str) -> (int, int):
21 | return binary_search(line[0:7], 0, 127, "F", "B"), binary_search(line[7:10], 0, 7, "L", "R")
22 |
23 |
24 | def calc_seat_id(seat: (int, int)) -> int:
25 | return seat[0] * 8 + seat[1]
26 |
27 |
28 | lines = read_lines("day05")
29 |
30 | # Calculate seats
31 | seats = list(map(calc_seat, lines))
32 |
33 | # Part one
34 | result = max([calc_seat_id(seat) for seat in seats])
35 |
36 | aoc_print(f"The highest seat ID on the boarding pass is {result}.")
37 | assert_equals(878, result)
38 |
39 | # Part two
40 | sorted_seats = sorted(seats, key=lambda tup: (tup[0], tup[1]))
41 | min_seat = min(sorted_seats)
42 | max_seat = max(sorted_seats)
43 |
44 | all_seats = [(row, column) for row in range(0, 128) for column in range(0, 8)]
45 |
46 | missing_seat = (0, 0)
47 | for seat in all_seats:
48 | if (min_seat <= seat <= max_seat) and (seat not in seats):
49 | missing_seat = seat
50 | break
51 |
52 | aoc_print(f"The seat id of your seat is {calc_seat_id(missing_seat)}.")
53 | assert_equals(504, calc_seat_id(missing_seat))
54 |
--------------------------------------------------------------------------------
/Day-06/java/MCqwertz/Day06.java:
--------------------------------------------------------------------------------
1 | //created by MCqwertz
2 |
3 | package MCqwertz;
4 |
5 | import java.io.FileNotFoundException;
6 | import java.util.*;
7 |
8 | public class Day06 {
9 | public static void main(String[] args) throws FileNotFoundException {
10 | System.out.println("Part 1: " + getFirstResult());
11 | System.out.println("Part 1: " + getSecondResult());
12 | }
13 |
14 | private static int getFirstResult() throws FileNotFoundException {
15 | TreeSet questions = new TreeSet<>();
16 | Scanner scanner = TextFileUtils.getScanner(6);
17 | int sum = 0;
18 | while(scanner.hasNextLine()) {
19 | char[] chars = scanner.nextLine().toCharArray();
20 | if(chars.length == 0) {
21 | sum += questions.size();
22 | questions.clear();
23 | } else {
24 | for (char c : chars) {
25 | questions.add(c);
26 | }
27 | }
28 | }
29 | sum += questions.size();
30 | return sum;
31 | }
32 |
33 | private static int getSecondResult() throws FileNotFoundException {
34 | ArrayList questions = new ArrayList<>();
35 | Scanner scanner = TextFileUtils.getScanner(6);
36 | boolean firstLine = true;
37 | int sum = 0;
38 | while (scanner.hasNextLine()) {
39 | String nextLine = scanner.nextLine();
40 | if(nextLine.equals("")) {
41 | sum += questions.size();
42 | questions.clear();
43 | firstLine = true;
44 | } else {
45 | if(firstLine) {
46 | for (char c : nextLine.toCharArray()) {
47 | questions.add(c);
48 | }
49 | firstLine = false;
50 | } else {
51 | questions.removeIf(c -> !nextLine.contains(String.valueOf(c)));
52 | }
53 | }
54 |
55 | }
56 | sum += questions.size();
57 | return sum;
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/Day-03/java/dlsf/Solution.java:
--------------------------------------------------------------------------------
1 | import java.io.IOException;
2 | import java.nio.file.Files;
3 | import java.nio.file.Path;
4 | import java.util.List;
5 | import java.util.stream.Collectors;
6 |
7 | public class Solution {
8 |
9 | public static void main(String[] args) {
10 | try {
11 | List lines = Files.lines(Path.of(args[0]))
12 | .collect(Collectors.toList());
13 | long n1 = findSlopeTreeAmount(lines, 1, 1);
14 | long n2 = findSlopeTreeAmount(lines, 3, 1);
15 | long n3 = findSlopeTreeAmount(lines, 5, 1);
16 | long n4 = findSlopeTreeAmount(lines, 7, 1);
17 | long n5 = findSlopeTreeAmount(lines, 1, 2);
18 | System.out.println("Solution for part 1: " + n2);
19 | System.out.println("Solution for part 2: " + (n1 * n2 * n3 * n4 * n5));
20 | } catch (IOException e) {
21 | e.printStackTrace();
22 | }
23 | }
24 |
25 | private static int findSlopeTreeAmount(List input, int step, int down) {
26 | int currentIndex = 0;
27 | int treeAmount = 0;
28 | for (int i = 0; i < input.size(); i += down) {
29 | char[] objects = input.get(i).toCharArray();
30 | if (objects[currentIndex] == '#') {
31 | treeAmount++;
32 | }
33 | currentIndex = getNextIndex(currentIndex, objects.length - 1, step);
34 | }
35 | return treeAmount;
36 | }
37 |
38 | private static int getNextIndex(int currentIndex, int maxIndex, int step) {
39 | if (currentIndex + step > maxIndex) {
40 | return ((currentIndex - maxIndex) + --step);
41 | }
42 | return currentIndex + step;
43 | }
44 |
45 | }
46 |
47 |
--------------------------------------------------------------------------------
/Day-07/clojure/JohnnyJayJay/solution.clj:
--------------------------------------------------------------------------------
1 | (ns solution
2 | (:require [clojure.set :as sets]))
3 |
4 | (def child-bag #"(\d+) (\w+ \w+) bags?(?:, )?")
5 |
6 | (def bag-format #"(?m)^(\w+ \w+) bags contain (?:(?:no other bags)|(.+))\.$")
7 |
8 | (defn parse-int [s]
9 | (Integer/parseInt s))
10 |
11 | (defn parse-children [[_ children-str :as v]]
12 | (assoc
13 | v 1
14 | (if children-str
15 | (->> (re-seq child-bag children-str)
16 | (map (comp vec rseq #(update % 0 parse-int) #(subvec % 1)))
17 | (into {}))
18 | {})))
19 |
20 | (defn parse-bag-rules [input]
21 | (->> (re-seq bag-format input)
22 | (map #(subvec % 1))
23 | (map parse-children)
24 | (into {})))
25 |
26 | (defn create-parent-map [bag-rule-map]
27 | (reduce-kv (fn [m k v] (reduce #(update %1 %2 conj k) m (keys v)))
28 | (zipmap (keys bag-rule-map) (repeat #{}))
29 | bag-rule-map))
30 |
31 | (defn parent-bags [bag-map bag-name]
32 | (let [parents (bag-map bag-name)]
33 | (if (seq parents)
34 | (reduce sets/union parents (map (partial parent-bags bag-map) parents))
35 | #{})))
36 |
37 | (defn contained-bag-count [bag-map bag-name]
38 | (if-let [children (seq (bag-map bag-name))]
39 | (reduce + 1 (map (fn [[name count]] (* count (contained-bag-count bag-map name))) children))
40 | 1))
41 |
42 | (defn solve [input]
43 | (let [child-map (parse-bag-rules input)
44 | parent-map (create-parent-map child-map)]
45 | (println "There are" (count (parent-bags parent-map "shiny gold")) "bags that contain a shiny gold bag.")
46 | (println "There are" (dec (contained-bag-count child-map "shiny gold")) "bags within a single shiny gold bag.")))
47 |
48 | (solve (slurp (first *command-line-args*)))
49 |
--------------------------------------------------------------------------------
/Day-02/python/justentrix/solution.py:
--------------------------------------------------------------------------------
1 | from file_reader import read_lines
2 | import re
3 |
4 | class Password:
5 | def __init__(self, letter, first_number, second_number, plain):
6 | self.letter = letter
7 | self.first_number = first_number
8 | self.second_number = second_number
9 | self.plain = plain
10 |
11 | def read_password_from_string(line):
12 | split = line.split(' ')
13 | amount = split[0].split('-')
14 |
15 | first_number = int(amount[0])
16 | second_number = int(amount[1])
17 |
18 | letter = split[1][0]
19 | password = split[2]
20 |
21 | return Password(letter, first_number, second_number, password)
22 |
23 | # Part one
24 | def is_password_valid(password):
25 | letters = re.sub(f'[^{password.letter}]', '', password.plain)
26 | length = len(letters)
27 | return length >= password.first_number and length <= password.second_number
28 |
29 | available_passwords = []
30 | for line in read_lines('day02.txt'):
31 | password = read_password_from_string(line)
32 | available_passwords.append(password)
33 |
34 | valid_passwords = []
35 |
36 | for password in available_passwords:
37 | if is_password_valid(password):
38 | valid_passwords.append(password)
39 |
40 | print(len(valid_passwords))
41 |
42 | # Part two
43 | def is_password_valid(password):
44 | first_letter = password.plain[password.first_number - 1]
45 | second_letter = password.plain[password.second_number - 1]
46 |
47 | return (first_letter == password.letter and not second_letter == password.letter
48 | or not first_letter == password.letter and second_letter == password.letter)
49 |
50 | valid_passwords = []
51 |
52 | for password in available_passwords:
53 | if is_password_valid(password):
54 | valid_passwords.append(password)
55 |
56 | print(len(valid_passwords))
57 |
--------------------------------------------------------------------------------
/Day-05/java/MCqwertz/Day5.java:
--------------------------------------------------------------------------------
1 | //created by MCqwertz
2 | package MCqwertz;
3 |
4 | import java.io.FileNotFoundException;
5 | import java.util.ArrayList;
6 | import java.util.Collections;
7 | import java.util.Scanner;
8 |
9 | public class Day5 {
10 | public static void main(String[] args) throws FileNotFoundException {
11 | ArrayList input = getIDs();
12 | System.out.println("Part 1: " + getHighestSeatID(input));
13 | System.out.println("Part 1: " + getSantasSeat(input));
14 | }
15 |
16 | public static int getHighestSeatID(ArrayList input) {
17 | int highest = 0;
18 | for (int i : input) {
19 | if(i > highest) {
20 | highest = i;
21 | }
22 | }
23 | return highest;
24 | }
25 |
26 | public static int getSantasSeat(ArrayList input) {
27 | Collections.sort(input);
28 | for (int i = 0 ; i < input.size() - 1; i++) {
29 | if(input.get(i + 1) - input.get(i) != 1) {
30 | return input.get(i) + 1;
31 | }
32 | }
33 | return -1;
34 | }
35 |
36 | public static ArrayList getIDs() throws FileNotFoundException {
37 | ArrayList seats = new ArrayList<>();
38 | Scanner scanner = TextFileUtils.getScanner(5);
39 | while(scanner.hasNextLine()) {
40 | char[] line = scanner.nextLine().toCharArray();
41 | int row = 127;
42 | int rangeRow = 127;
43 | int coulomb = 7;
44 | int rangeCoulomb = 7;
45 | for(char c : line) {
46 | switch (c) {
47 | case 'F':
48 | row -= rangeRow / 2 + 1;
49 | case 'B':
50 | rangeRow /= 2;
51 | break;
52 | case 'L':
53 | coulomb -= rangeCoulomb / 2 + 1;
54 | case 'R':
55 | rangeCoulomb /= 2;
56 | break;
57 | default:
58 | System.out.println("Error in reading the input!");
59 | }
60 | }
61 | seats.add(row * 8 + coulomb);
62 | }
63 | return seats;
64 | }
65 | }
66 |
67 |
--------------------------------------------------------------------------------
/Day-01/kotlin/NyCodeGHG/solution.kt:
--------------------------------------------------------------------------------
1 | package de.nycode.aoc2020.day01
2 | import java.lang.NumberFormatException
3 | import java.nio.charset.StandardCharsets
4 | import java.nio.file.Files
5 | import java.nio.file.Path
6 | import java.nio.file.Paths
7 |
8 | fun main() {
9 | println("Advent of Code Day 1")
10 |
11 | val input = parseInput(Paths.get("input.txt"))
12 |
13 | findFirst(input)
14 | findSecond(input)
15 | }
16 |
17 | fun parseInput(path: Path): List {
18 | try {
19 | return Files.readAllLines(path, StandardCharsets.UTF_8)
20 | .map { it.toInt() }
21 | } catch (exception: NumberFormatException) {
22 | error("Invalid input ${exception.message}")
23 | }
24 | }
25 |
26 | fun findFirst(input: List) {
27 | var found = false
28 |
29 | input.forEachIndexed { index, a ->
30 | input.forEachIndexed { secondIndex, b ->
31 | if (index == secondIndex || found)
32 | return@forEachIndexed
33 |
34 | val calculatedValue = a + b
35 | if (calculatedValue == 2020) {
36 | println("Found first solution: ${a * b}")
37 | found = true
38 | }
39 | }
40 | }
41 | }
42 |
43 | fun findSecond(input: List) {
44 | var found = false
45 |
46 | input.forEachIndexed { index, a ->
47 | input.forEachIndexed { secondIndex, b ->
48 | input.forEachIndexed { thirdIndex, c ->
49 | if (index == secondIndex || index == thirdIndex || secondIndex == thirdIndex || found)
50 | return@forEachIndexed
51 |
52 | val calculatedValue = a + b + c
53 | if (calculatedValue == 2020) {
54 | println("Found second solution: ${a * b * c}")
55 | found = true
56 | }
57 | }
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/Day-01/java/zFlxw/Solution.java:
--------------------------------------------------------------------------------
1 | import java.io.File;
2 | import java.io.FileNotFoundException;
3 | import java.util.*;
4 |
5 | public class Solution {
6 | public static void main(String[] args) {
7 | Scanner scanner = new Scanner(System.in);
8 | List values = getValues();
9 |
10 | // Problem 1
11 | for (int i = 0; i < values.size(); i++) {
12 | for (int j = i + 1; j < values.size(); j++) {
13 | int x = values.get(i), y = values.get(j);
14 | if (i != j && x + y == 2020) {
15 | System.out.println(x * y);
16 | }
17 | }
18 | }
19 |
20 | // Problem 2
21 | for (int i = 0; i < values.size(); i++) {
22 | for (int j = i + 1; j < values.size(); j++) {
23 | for (int k = j + 1; k < values.size(); k++) {
24 | int x = values.get(i), y = values.get(j), z = values.get(k);
25 | if ((i != j && i != k && j != k) && (x + y + z == 2020)) {
26 | System.out.println(x * y * z);
27 | }
28 | }
29 | }
30 | }
31 | }
32 |
33 | private static List getValues() {
34 | List values = new ArrayList<>();
35 | // Pfad könnte bei euch anders sein | Path might be different for you
36 | String path = new File("").getAbsolutePath();
37 | File file = new File(path.concat("/src/day1/input.txt"));
38 | try {
39 | Scanner scanner = new Scanner(file);
40 | while (scanner.hasNextLine()) {
41 | int val = Integer.valueOf(scanner.nextLine());
42 | values.add(val);
43 | }
44 | scanner.close();
45 | } catch (FileNotFoundException e) {
46 | e.printStackTrace();
47 | }
48 | return values;
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/Day-05/java/zFlxw/Solution.java:
--------------------------------------------------------------------------------
1 | public class Solution {
2 | public static void main(String[] args) throws IOException {
3 | new Solution();
4 | }
5 |
6 | public Solution() throws IOException {
7 | List input = Files.readAllLines(Paths.get("Your Path here"));
8 | List seatNumbers = new ArrayList<>();
9 |
10 | // Problem 1
11 | for (String pass : input) {
12 | int row = 0;
13 | int rowHalf = 64;
14 |
15 | int column = 0;
16 | int columnHalf = 4;
17 | for (int i = 0; i < pass.length(); i++) {
18 | if (pass.charAt(i) == 'B')
19 | row += rowHalf;
20 |
21 | rowHalf /= 2;
22 |
23 | if (pass.charAt(i) == 'R') {
24 | column += columnHalf;
25 | columnHalf /= 2;
26 | }
27 |
28 | if (pass.charAt(i) == 'L') {
29 | columnHalf /= 2;
30 | }
31 |
32 | seatNumbers.add((row * 8 + column));
33 | }
34 | }
35 |
36 | // Problem 2
37 | int santasId = 0;
38 | for (int i = 0; i < seatNumbers.size(); i++) {
39 | int seatIdOne = seatNumbers.get(i);
40 | for (int j = i + 1; j < seatNumbers.size(); j++) {
41 | int seatIdTwo = seatNumbers.get(j);
42 |
43 | if (seatIdOne - seatIdTwo == 2 && !seatNumbers.contains((seatIdOne + 1))) {
44 | santasId = seatIdOne + 1;
45 | }
46 |
47 | if (seatIdTwo - seatIdOne == 2 && !seatNumbers.contains((seatIdTwo + 1))) {
48 | santasId = seatIdTwo + 1;
49 | }
50 | }
51 | }
52 |
53 | System.out.println("Problem 1: " + Collections.max(seatNumbers));
54 | System.out.println("Problem 2: " + santasId);
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/Day-05/kotlin/NyCodeGHG/solution.kt:
--------------------------------------------------------------------------------
1 | package de.nycode.aoc2020.day05
2 |
3 | import java.nio.file.Files
4 | import java.nio.file.Paths
5 |
6 | const val BACK_KEY = 'B'
7 | const val RIGHT_KEY = 'R'
8 |
9 | fun main() {
10 | val ids = Files.readAllLines(Paths.get("input.txt"))
11 | .map { line ->
12 |
13 | val chars = line.toCharArray()
14 |
15 | var range = 0..127
16 |
17 | var index = 0
18 | while (index < 7) {
19 | val char = chars[index]
20 | range = calculate(range, char == BACK_KEY)
21 | index++
22 | }
23 |
24 | if (range.first != range.last) {
25 | error("Not the same number!")
26 | }
27 | val row = range.first
28 |
29 | range = 0..7
30 | while (index < 10) {
31 | val char = chars[index]
32 | range = calculate(range, char == RIGHT_KEY)
33 | index++
34 | }
35 | if (range.first != range.last) {
36 | error("Not the same number!")
37 | }
38 | val column = range.first
39 |
40 | row * 8 + column
41 | }
42 |
43 | val highest = ids.maxOrNull() ?: error("Cannot get highest seat id")
44 | val lowest = ids.minOrNull() ?: error("Cannot get lowest seat id")
45 | println("Highest seat id is $highest")
46 |
47 | val allIds = (lowest..highest).map { it }.toList()
48 | val missing = allIds.first { it !in ids }
49 | println("Your seat id is $missing")
50 | }
51 |
52 | fun calculate(range: IntRange, upper: Boolean): IntRange {
53 | val difference = range.last - range.first
54 |
55 | return if (upper) {
56 | (range.last - difference / 2)..range.last
57 | } else {
58 | range.first..(range.first + difference / 2)
59 | }
60 | }
--------------------------------------------------------------------------------
/Day-03/kotlin/NyCodeGHG/solution.kt:
--------------------------------------------------------------------------------
1 | package de.nycode.aoc2020.day03
2 |
3 | import java.nio.charset.StandardCharsets
4 | import java.nio.file.Files
5 | import java.nio.file.Path
6 | import java.nio.file.Paths
7 |
8 | fun main() {
9 | println("Advent of Code Day 3")
10 |
11 | val input = parseInput(Paths.get("input.txt"))
12 |
13 | val results: Array = arrayOf(
14 | getTreeCountForPath(input, 1, 1),
15 | getTreeCountForPath(input, 3, 1),
16 | getTreeCountForPath(input, 5, 1),
17 | getTreeCountForPath(input, 7, 1),
18 | getTreeCountForPath(input, 1, 2),
19 | )
20 |
21 | var result = 1L
22 |
23 | results.forEach {
24 | result *= it
25 | println(it)
26 | }
27 |
28 | println("Result: $result")
29 | }
30 |
31 | fun getTreeCountForPath(input: Array>, right: Int, down: Int): Int {
32 | var treeCounter = 0
33 |
34 | var x = 0
35 | var y = 0
36 |
37 | while (true) {
38 |
39 | x += right
40 | y += down
41 |
42 | if (y >= input.size) {
43 | break
44 | }
45 |
46 | if (x >= input[y].size) {
47 | x -= input[y].size
48 | }
49 |
50 | val position = input[y][x]
51 | if (position.isTree) {
52 | ++treeCounter
53 | }
54 | }
55 | return treeCounter
56 | }
57 |
58 | fun parseInput(path: Path): Array> {
59 | try {
60 | return Files.readAllLines(path, StandardCharsets.UTF_8)
61 | .map {
62 | it.toCharArray()
63 | .map {
64 | Position(it == '#')
65 | }
66 | .toTypedArray()
67 | }
68 | .toTypedArray()
69 | } catch (exception: NumberFormatException) {
70 | error("Invalid input ${exception.message}")
71 | }
72 | }
73 |
74 | class Position(val isTree: Boolean)
75 |
--------------------------------------------------------------------------------
/Day-07/python/paul2708/solution.py:
--------------------------------------------------------------------------------
1 | from assertions import assert_equals
2 | from input_reader import read_lines
3 | from printer import aoc_print
4 |
5 |
6 | def contains_bag(root: str, needle: str) -> bool:
7 | ignore_counts = map(lambda x: x[0], bag_rules[root])
8 |
9 | if needle in ignore_counts:
10 | return True
11 | else:
12 | for bag in bag_rules[root]:
13 | if contains_bag(bag[0], needle):
14 | return True
15 |
16 | return False
17 |
18 |
19 | def count_bags(root: str) -> int:
20 | total_sum = 0
21 | for rule in bag_rules[root]:
22 | total_sum += rule[1] + rule[1] * count_bags(rule[0])
23 |
24 | return total_sum
25 |
26 |
27 | # Parse input (plz forgive me python god and regex skiller)
28 | rule_list = read_lines("day07")
29 |
30 | # {str, [(int,str)]}
31 | bag_rules = {}
32 |
33 | for rule in rule_list:
34 | rule = rule[:-1].replace("bags", "").replace("bag", "")
35 |
36 | bag = rule.split(" contain ")[0].strip()
37 | container_bags = []
38 |
39 | container = rule.split(" contain ")[1].strip()
40 | if "," in container:
41 | for single_bag in container.split(", "):
42 | count = int(single_bag.split(" ")[0])
43 | bag_type = single_bag[len(single_bag.split(" ")[0]):].strip()
44 | container_bags.append((bag_type, count))
45 | elif "no " not in container:
46 | count = int(container.split(" ")[0])
47 | bag_type = container[len(rule.split(" contain ")[1].strip().split(" ")[0]):].strip()
48 | container_bags.append((bag_type, count))
49 |
50 | bag_rules[bag] = container_bags
51 |
52 | # Part one
53 | res = len([bag for bag in bag_rules.keys() if contains_bag(bag, "shiny gold")])
54 |
55 | aoc_print(f"{res} bag colors can contain at least one shiny gold.")
56 | assert_equals(302, res)
57 |
58 | # Part two
59 | res = count_bags("shiny gold")
60 |
61 | aoc_print(f"It requires {res} bags in my shiny gold bag.")
62 | assert_equals(4165, res)
63 |
--------------------------------------------------------------------------------
/Day-02/java/MCqwertz/Day2.java:
--------------------------------------------------------------------------------
1 | //created by MCqwertz
2 |
3 | import java.io.FileNotFoundException;
4 | import java.util.ArrayList;
5 | import java.util.Scanner;
6 | import java.util.function.IntPredicate;
7 |
8 | public class Day2 {
9 | public static void main(String[] args) throws FileNotFoundException {
10 | String[][] input = getInput();
11 | System.out.println("Part 1: " + getFirstPart(input));
12 | System.out.println("Part 2: " + getSecondPart(input));
13 | }
14 |
15 | private static int getFirstPart(String[][] input) {
16 | int i = 0;
17 | for (String[] strings : input) {
18 | IntPredicate isSearched = arg -> arg == strings[2].charAt(0);
19 | int int0 = Integer.parseInt(strings[0]);
20 | int int1 = Integer.parseInt(strings[1]);
21 | int appearances = strings[3].chars().filter(isSearched).toArray().length;
22 | if(appearances <= int1 && appearances >= int0) {
23 | i++;
24 | }
25 | }
26 | return i;
27 | }
28 |
29 | private static int getSecondPart(String[][] input) {
30 | int i = 0;
31 | for (String[] strings : input) {
32 | int int0 = Integer.parseInt(strings[0]) - 1;
33 | int int1 = Integer.parseInt(strings[1]) - 1;
34 | char c = strings[2].charAt(0);
35 | if ((strings[3].charAt(int0) == c && strings[3].charAt(int1) != c) ||
36 | (strings[3].charAt(int0) != c && strings[3].charAt(int1) == c)) {
37 | i++;
38 | }
39 | }
40 | return i;
41 | }
42 |
43 | public static String[][] getInput() throws FileNotFoundException {
44 | Scanner scanner = TextFileUtils.getScanner(2);
45 | ArrayList arrayList = new ArrayList<>();
46 | while(scanner.hasNextLine()) {
47 | arrayList.add(scanner.nextLine());
48 | }
49 | String[][] input = new String[arrayList.size()][4];
50 | for (int i = 0; i < arrayList.size(); i++) {
51 | String [] strings = arrayList.get(i).split("-")[1].replace(":", " ").split(" ");
52 | input[i] = new String[]{arrayList.get(i).split("-")[0], strings[0], strings[1], strings[3]};
53 | }
54 | scanner.close();
55 | return input;
56 | }
57 |
58 | }
59 |
60 |
--------------------------------------------------------------------------------
/shared/JohnnyJayJay/aoc.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include "aoc.h"
3 |
4 | int count_lines(FILE* file) {
5 | long pos = ftell(file);
6 | int lines = 0;
7 | int c;
8 | while ((c = fgetc(file)) != EOF) {
9 | if (c == '\n') {
10 | lines++;
11 | }
12 | }
13 | fseek(file, -1, SEEK_CUR);
14 | if (fgetc(file) != '\n') {
15 | lines++;
16 | }
17 | fseek(file, pos, SEEK_SET);
18 | return lines;
19 | }
20 |
21 | int count_blank_lines(FILE* file) {
22 | long pos = ftell(file);
23 | int blank_lines = 0;
24 | int c;
25 | while ((c = fgetc(file)) != EOF) {
26 | if (c == '\n') {
27 | blank_lines++;
28 | }
29 | chars_until(file, '\n', 0);
30 | }
31 | fseek(file, pos, SEEK_SET);
32 | return blank_lines;
33 | }
34 |
35 |
36 | void read_ints(FILE* file, int* buf, int max) {
37 | for (int i = 0; i < max; i++) {
38 | int num;
39 | if (EOF == fscanf(file, "%d", &num)) {
40 | return;
41 | }
42 | buf[i] = num;
43 | }
44 | }
45 |
46 | void read_longs(FILE* file, long* buf, int max) {
47 | for (int i = 0; i < max; i++) {
48 | long num;
49 | if (EOF == fscanf(file, "%ld", &num)) {
50 | return;
51 | }
52 | buf[i] = num;
53 | }
54 | }
55 |
56 | int chars_until(FILE* file, char term, int rewind) {
57 | long pos = ftell(file);
58 | int count = -1;
59 | int cur;
60 | do {
61 | cur = fgetc(file);
62 | count++;
63 | } while (cur != term && cur != EOF);
64 | if (rewind) {
65 | fseek(file, pos, SEEK_SET);
66 | }
67 | return count;
68 | }
69 |
70 | int charcount(char* str, char c, int from, int to) {
71 | int count = 0;
72 | for (int i = from; i < to; i++) {
73 | if (str[i] == c) {
74 | count++;
75 | }
76 | }
77 | return count;
78 | }
79 |
80 | int intcmp(const void* one, const void* two) {
81 | int a = *((int*) one);
82 | int b = *((int*) two);
83 | return a - b;
84 | }
85 |
86 |
--------------------------------------------------------------------------------
/shared/MCqwertz/inputs/Day1.txt:
--------------------------------------------------------------------------------
1 | 1891
2 | 1975
3 | 1987
4 | 1923
5 | 1928
6 | 1993
7 | 1946
8 | 1947
9 | 2005
10 | 1897
11 | 1971
12 | 1929
13 | 1875
14 | 1945
15 | 1680
16 | 811
17 | 1901
18 | 1396
19 | 1942
20 | 1282
21 | 1941
22 | 1978
23 | 1884
24 | 1879
25 | 1230
26 | 2010
27 | 1881
28 | 1979
29 | 1996
30 | 1904
31 | 1934
32 | 1865
33 | 2003
34 | 2006
35 | 1966
36 | 1860
37 | 1259
38 | 1959
39 | 1931
40 | 1963
41 | 1878
42 | 1880
43 | 151
44 | 1925
45 | 1663
46 | 1908
47 | 1863
48 | 1391
49 | 1922
50 | 1968
51 | 1998
52 | 1084
53 | 1982
54 | 1960
55 | 1938
56 | 1876
57 | 1937
58 | 1882
59 | 1873
60 | 1926
61 | 1986
62 | 1416
63 | 1864
64 | 1862
65 | 1969
66 | 1913
67 | 532
68 | 1866
69 | 1242
70 | 1933
71 | 1903
72 | 965
73 | 1927
74 | 1890
75 | 1991
76 | 1388
77 | 1992
78 | 1902
79 | 1907
80 | 1964
81 | 1394
82 | 2009
83 | 1920
84 | 630
85 | 1932
86 | 1854
87 | 1951
88 | 1852
89 | 1983
90 | 1314
91 | 1855
92 | 1954
93 | 1921
94 | 1989
95 | 1871
96 | 1995
97 | 1885
98 | 1974
99 | 1915
100 | 1872
101 | 1251
102 | 1899
103 | 1985
104 | 1889
105 | 1935
106 | 1912
107 | 946
108 | 1965
109 | 1739
110 | 1973
111 | 1911
112 | 1910
113 | 1917
114 | 1918
115 | 1900
116 | 1886
117 | 1477
118 | 2000
119 | 1916
120 | 1077
121 | 2004
122 | 1456
123 | 1867
124 | 1970
125 | 1999
126 | 1919
127 | 1726
128 | 706
129 | 1930
130 | 1994
131 | 1988
132 | 1997
133 | 1870
134 | 1953
135 | 652
136 | 1893
137 | 1898
138 | 1883
139 | 1957
140 | 1972
141 | 1874
142 | 1977
143 | 1955
144 | 2001
145 | 1906
146 | 1389
147 | 1848
148 | 1940
149 | 1877
150 | 1962
151 | 1948
152 | 1887
153 | 1924
154 | 1403
155 | 1408
156 | 1861
157 | 1892
158 | 1990
159 | 1222
160 | 677
161 | 1392
162 | 1113
163 | 1085
164 | 1894
165 | 1106
166 | 1939
167 | 1961
168 | 1944
169 | 1952
170 | 1643
171 | 1404
172 | 1895
173 | 1958
174 | 1976
175 | 1206
176 | 1905
177 | 1076
178 | 1888
179 | 1896
180 | 1943
181 | 1950
182 | 2008
183 | 1967
184 | 164
185 | 1981
186 | 1868
187 | 1914
188 | 1909
189 | 1956
190 | 341
191 | 1379
192 | 2007
193 | 1563
194 | 1980
195 | 1072
196 | 1949
197 | 1250
198 | 1258
199 | 1092
200 | 2002
--------------------------------------------------------------------------------
/shared/justentrix/inputs/day01.txt:
--------------------------------------------------------------------------------
1 | 2004
2 | 1671
3 | 1678
4 | 1304
5 | 1242
6 | 1882
7 | 1605
8 | 1034
9 | 1883
10 | 1589
11 | 1881
12 | 1546
13 | 1713
14 | 1218
15 | 1982
16 | 1395
17 | 1277
18 | 1417
19 | 1497
20 | 1499
21 | 1847
22 | 1989
23 | 1172
24 | 1684
25 | 1243
26 | 1843
27 | 1661
28 | 1662
29 | 1421
30 | 1790
31 | 1344
32 | 1458
33 | 1074
34 | 1809
35 | 1990
36 | 1369
37 | 1386
38 | 1736
39 | 1972
40 | 1634
41 | 1229
42 | 1123
43 | 1870
44 | 1595
45 | 1934
46 | 1399
47 | 1732
48 | 1545
49 | 1208
50 | 368
51 | 1907
52 | 1143
53 | 443
54 | 1929
55 | 1965
56 | 1872
57 | 1738
58 | 1967
59 | 997
60 | 1473
61 | 1041
62 | 1991
63 | 1868
64 | 1180
65 | 1409
66 | 1379
67 | 1568
68 | 1163
69 | 1869
70 | 1391
71 | 1956
72 | 1249
73 | 1505
74 | 351
75 | 2001
76 | 462
77 | 1219
78 | 1731
79 | 1802
80 | 1798
81 | 1626
82 | 1438
83 | 1099
84 | 1477
85 | 1980
86 | 1708
87 | 1666
88 | 1066
89 | 1121
90 | 1359
91 | 1426
92 | 1734
93 | 1768
94 | 1836
95 | 1453
96 | 923
97 | 1660
98 | 1878
99 | 1522
100 | 1024
101 | 1429
102 | 232
103 | 1952
104 | 1730
105 | 1763
106 | 1981
107 | 1388
108 | 1337
109 | 1317
110 | 1922
111 | 1044
112 | 1999
113 | 1341
114 | 1178
115 | 1524
116 | 1185
117 | 1257
118 | 1256
119 | 1061
120 | 1262
121 | 1022
122 | 1778
123 | 1917
124 | 1205
125 | 1272
126 | 1842
127 | 1533
128 | 1194
129 | 1746
130 | 1691
131 | 1617
132 | 1667
133 | 1940
134 | 1171
135 | 1792
136 | 1773
137 | 1411
138 | 1902
139 | 1859
140 | 1978
141 | 1764
142 | 1482
143 | 1276
144 | 735
145 | 1716
146 | 1915
147 | 1675
148 | 1126
149 | 1830
150 | 1227
151 | 1299
152 | 1535
153 | 1700
154 | 1658
155 | 1771
156 | 1823
157 | 1055
158 | 1602
159 | 1590
160 | 1983
161 | 1885
162 | 1735
163 | 103
164 | 1766
165 | 14
166 | 1486
167 | 1939
168 | 1525
169 | 1916
170 | 1279
171 | 544
172 | 1406
173 | 1674
174 | 1948
175 | 1971
176 | 1651
177 | 1715
178 | 1943
179 | 1784
180 | 2008
181 | 1800
182 | 1720
183 | 1557
184 | 1467
185 | 1371
186 | 1637
187 | 1345
188 | 1924
189 | 1565
190 | 1976
191 | 1827
192 | 1890
193 | 1848
194 | 1465
195 | 1573
196 | 1231
197 | 1310
198 | 1754
199 | 1569
200 | 1532
--------------------------------------------------------------------------------
/Day-02/kotlin/NyCodeGHG/solution.kt:
--------------------------------------------------------------------------------
1 | package de.nycode.aoc2020.day02
2 |
3 | import java.nio.charset.StandardCharsets
4 | import java.nio.file.Files
5 | import java.nio.file.Path
6 | import java.nio.file.Paths
7 |
8 | fun main() {
9 | println("Advent of Code Day 2")
10 |
11 | val input = parseInput(Paths.get("input.txt"))
12 | println("Checking ${input.size} cases")
13 |
14 | var validPasswords = 0
15 |
16 | input.forEach { pair ->
17 | val (rule, password) = pair
18 |
19 | val count = password.toCharArray()
20 | .filter { it == rule.character }
21 | .size
22 |
23 | if (count in rule.first..rule.second) {
24 | validPasswords++
25 | }
26 | }
27 |
28 | println("Found $validPasswords valid passwords for the old policy!")
29 |
30 | validPasswords = 0
31 | input.forEach { pair ->
32 | val (rule, password) = pair
33 |
34 | val count = password.toCharArray()
35 | val firstChar = count[rule.first - 1]
36 | val secondChar = count[rule.second - 1]
37 |
38 | if (firstChar == rule.character && secondChar != rule.character || firstChar != rule.character && secondChar == rule.character) {
39 | validPasswords++
40 | }
41 | }
42 |
43 | println("Found $validPasswords valid passwords for the Official Toboggan Corporate Policy!")
44 | }
45 |
46 | fun parseInput(path: Path): List> {
47 | return Files.readAllLines(path, StandardCharsets.UTF_8)
48 | .map {
49 | val parts = it.split(" ")
50 |
51 | val numbers = parts[0].split("-")
52 | val first = numbers[0].toInt()
53 | val second = numbers[1].toInt()
54 |
55 | val character = parts[1].substring(0, 1)
56 | .toCharArray()
57 | .first()
58 |
59 | val password = parts[2]
60 | PolicyRule(first, second, character) to password
61 | }
62 | .toList()
63 | }
64 |
65 | data class PolicyRule(val first: Int, val second: Int, val character: Char)
66 |
--------------------------------------------------------------------------------
/shared/paul2708/input/day01.txt:
--------------------------------------------------------------------------------
1 | 1993
2 | 1715
3 | 1997
4 | 1666
5 | 1676
6 | 1830
7 | 1203
8 | 1800
9 | 1125
10 | 1191
11 | 1902
12 | 1972
13 | 1471
14 | 1137
15 | 2003
16 | 1250
17 | 1548
18 | 1070
19 | 1152
20 | 2004
21 | 1127
22 | 1111
23 | 1898
24 | 1848
25 | 1934
26 | 1236
27 | 1704
28 | 1950
29 | 1387
30 | 1713
31 | 1214
32 | 1266
33 | 1114
34 | 1089
35 | 1677
36 | 1207
37 | 1341
38 | 1689
39 | 1772
40 | 1901
41 | 1932
42 | 1645
43 | 1285
44 | 1884
45 | 883
46 | 1291
47 | 1543
48 | 1455
49 | 1213
50 | 1088
51 | 1784
52 | 1506
53 | 1879
54 | 1811
55 | 1880
56 | 994
57 | 1021
58 | 1585
59 | 1662
60 | 1683
61 | 1071
62 | 1643
63 | 1754
64 | 1389
65 | 1124
66 | 1820
67 | 1168
68 | 1875
69 | 1017
70 | 1180
71 | 1375
72 | 1359
73 | 1311
74 | 1357
75 | 1501
76 | 1719
77 | 1584
78 | 1609
79 | 1977
80 | 1786
81 | 1232
82 | 1263
83 | 1748
84 | 1664
85 | 1693
86 | 1766
87 | 1598
88 | 1053
89 | 1277
90 | 1466
91 | 1877
92 | 1844
93 | 1829
94 | 1165
95 | 1606
96 | 1298
97 | 1963
98 | 1873
99 | 1911
100 | 1729
101 | 1418
102 | 1372
103 | 1777
104 | 1371
105 | 1588
106 | 1329
107 | 1029
108 | 1931
109 | 1115
110 | 1810
111 | 1595
112 | 1237
113 | 1282
114 | 1838
115 | 1642
116 | 1937
117 | 1343
118 | 1578
119 | 1425
120 | 1814
121 | 1690
122 | 1129
123 | 1321
124 | 1174
125 | 1863
126 | 1405
127 | 1066
128 | 1220
129 | 1780
130 | 1410
131 | 1156
132 | 1991
133 | 1568
134 | 1368
135 | 99
136 | 1750
137 | 1280
138 | 1400
139 | 1601
140 | 1804
141 | 1363
142 | 1613
143 | 1252
144 | 1434
145 | 1094
146 | 1867
147 | 1542
148 | 1093
149 | 1926
150 | 1251
151 | 1348
152 | 689
153 | 1441
154 | 1913
155 | 1969
156 | 1409
157 | 1201
158 | 1459
159 | 1110
160 | 1452
161 | 1051
162 | 1860
163 | 1346
164 | 1537
165 | 1060
166 | 1182
167 | 1386
168 | 1141
169 | 1184
170 | 1989
171 | 1852
172 | 1097
173 | 1135
174 | 1078
175 | 1587
176 | 1984
177 | 1970
178 | 1259
179 | 1281
180 | 1092
181 | 1294
182 | 1233
183 | 1186
184 | 1555
185 | 1755
186 | 1886
187 | 1030
188 | 1706
189 | 1313
190 | 1481
191 | 1998
192 | 1181
193 | 1244
194 | 1269
195 | 1684
196 | 1798
197 | 1023
198 | 1960
199 | 1050
200 | 1293
201 |
--------------------------------------------------------------------------------
/shared/zFlxw/inputs/day1.txt:
--------------------------------------------------------------------------------
1 | 2004
2 | 1823
3 | 1628
4 | 1867
5 | 1073
6 | 1951
7 | 1909
8 | 1761
9 | 1093
10 | 1992
11 | 1986
12 | 1106
13 | 1537
14 | 1905
15 | 1233
16 | 1961
17 | 1760
18 | 1562
19 | 1781
20 | 1329
21 | 1272
22 | 1660
23 | 1367
24 | 1248
25 | 1697
26 | 1515
27 | 1470
28 | 1980
29 | 1884
30 | 1784
31 | 1966
32 | 1778
33 | 1426
34 | 1255
35 | 1089
36 | 1748
37 | 1253
38 | 1870
39 | 1651
40 | 1131
41 | 1623
42 | 1595
43 | 1128
44 | 1014
45 | 1863
46 | 1855
47 | 1203
48 | 1395
49 | 1521
50 | 1365
51 | 1202
52 | 780
53 | 1560
54 | 1834
55 | 1494
56 | 1551
57 | 1398
58 | 1190
59 | 1975
60 | 1940
61 | 1217
62 | 1793
63 | 1310
64 | 1070
65 | 1865
66 | 1307
67 | 1735
68 | 1897
69 | 1410
70 | 1994
71 | 1541
72 | 1569
73 | 1731
74 | 1238
75 | 1193
76 | 1226
77 | 1435
78 | 1159
79 | 1642
80 | 1652
81 | 1908
82 | 1920
83 | 1930
84 | 1068
85 | 1914
86 | 1186
87 | 1795
88 | 1888
89 | 1634
90 | 1750
91 | 1950
92 | 1493
93 | 1353
94 | 1461
95 | 1658
96 | 1856
97 | 1301
98 | 1538
99 | 1948
100 | 1998
101 | 1847
102 | 1880
103 | 1657
104 | 1536
105 | 1457
106 | 1762
107 | 1706
108 | 1894
109 | 542
110 | 1991
111 | 1108
112 | 1072
113 | 1064
114 | 1511
115 | 1496
116 | 1480
117 | 1955
118 | 1604
119 | 1766
120 | 1983
121 | 1713
122 | 1234
123 | 1503
124 | 1583
125 | 1729
126 | 1140
127 | 1006
128 | 1600
129 | 1699
130 | 1280
131 | 1891
132 | 1996
133 | 1375
134 | 1167
135 | 1625
136 | 1129
137 | 1770
138 | 1497
139 | 1620
140 | 1267
141 | 1421
142 | 1399
143 | 1563
144 | 1636
145 | 1293
146 | 1506
147 | 1613
148 | 1958
149 | 1967
150 | 1182
151 | 1050
152 | 1947
153 | 1787
154 | 1774
155 | 1928
156 | 1896
157 | 1303
158 | 1826
159 | 1132
160 | 1254
161 | 1752
162 | 1510
163 | 1705
164 | 1229
165 | 1558
166 | 1989
167 | 1567
168 | 698
169 | 1738
170 | 1357
171 | 1587
172 | 1316
173 | 1838
174 | 1311
175 | 1057
176 | 1644
177 | 1135
178 | 1300
179 | 1134
180 | 1577
181 | 1381
182 | 1806
183 | 1176
184 | 1993
185 | 1769
186 | 1633
187 | 1450
188 | 1819
189 | 1973
190 | 1694
191 | 969
192 | 1987
193 | 1095
194 | 1717
195 | 1933
196 | 1593
197 | 1045
198 | 1355
199 | 1459
200 | 1619
201 |
--------------------------------------------------------------------------------
/Day-09/c/JohnnyJayJay/Day09.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include "../../../shared/JohnnyJayJay/aoc.h"
5 |
6 | int find_sum(long sum, long* numbers, int max) {
7 | for (int i = 0; i < max; i++) {
8 | for (int j = 0; j < max; j++) {
9 | if (numbers[i] + numbers[j] == sum) {
10 | return 1;
11 | }
12 | }
13 | }
14 | return 0;
15 | }
16 |
17 | long find_nonconforming_number(long* numbers, int length, int preamble_len) {
18 | for (int i = preamble_len; i < length; i++) {
19 | long num = numbers[i];
20 | if (!find_sum(num, (numbers + i - preamble_len), preamble_len)) {
21 | return num;
22 | }
23 | }
24 | return -1;
25 | }
26 |
27 | long find_contiguous_sum(long* numbers, int length, long sum) {
28 | int begin_pos = 0;
29 | int steps = 0;
30 | long partial_sum = 0;
31 |
32 | for (int i = 0; i < length && partial_sum != sum; i++) {
33 | long num = numbers[i];
34 | partial_sum += num;
35 | steps++;
36 | while (partial_sum > sum) {
37 | long first_summand = numbers[begin_pos];
38 | partial_sum -= first_summand;
39 | begin_pos++;
40 | steps--;
41 | }
42 | }
43 |
44 | long max = LONG_MIN;
45 | long min = LONG_MAX;
46 | for (int i = begin_pos; i < begin_pos + steps; i++) {
47 | long num = numbers[i];
48 | if (num > max) {
49 | max = num;
50 | }
51 | if (num < min) {
52 | min = num;
53 | }
54 | }
55 | return min + max;
56 | }
57 |
58 | int main(int argc, char** argv) {
59 | FILE* file = fopen(argv[1], "r");
60 | int lines = count_lines(file);
61 | long* encrypted = malloc(sizeof(long) * lines);
62 | read_longs(file, encrypted, lines);
63 | long number = find_nonconforming_number(encrypted, lines, 25);
64 | printf("The first nonconforming number is %ld\n", number);
65 | long cs = find_contiguous_sum(encrypted, lines, number);
66 | printf("Checksum of the contiguous sum (part 2): %ld\n", cs);
67 | }
68 |
--------------------------------------------------------------------------------
/shared/JohnnyJayJay/inputs/Day-01.txt:
--------------------------------------------------------------------------------
1 | 1918
2 | 1869
3 | 1821
4 | 1852
5 | 1981
6 | 1987
7 | 1989
8 | 1597
9 | 1634
10 | 1537
11 | 1991
12 | 1603
13 | 1543
14 | 1949
15 | 1879
16 | 1800
17 | 1761
18 | 2010
19 | 1810
20 | 1458
21 | 1755
22 | 1938
23 | 1500
24 | 2005
25 | 818
26 | 1493
27 | 1618
28 | 1923
29 | 1283
30 | 1952
31 | 1373
32 | 1605
33 | 1230
34 | 1321
35 | 1873
36 | 1853
37 | 1886
38 | 1372
39 | 1913
40 | 1871
41 | 159
42 | 733
43 | 1400
44 | 1880
45 | 1462
46 | 2007
47 | 1801
48 | 1982
49 | 1728
50 | 1640
51 | 1442
52 | 1525
53 | 1953
54 | 1791
55 | 1906
56 | 1946
57 | 1641
58 | 2009
59 | 1627
60 | 1935
61 | 1936
62 | 1908
63 | 1826
64 | 1291
65 | 1978
66 | 1884
67 | 1799
68 | 1464
69 | 1538
70 | 1365
71 | 1678
72 | 1872
73 | 1964
74 | 1863
75 | 1388
76 | 1912
77 | 1928
78 | 1471
79 | 1632
80 | 1336
81 | 1396
82 | 1948
83 | 1974
84 | 1331
85 | 1290
86 | 1992
87 | 1096
88 | 1889
89 | 1874
90 | 1341
91 | 757
92 | 1351
93 | 1876
94 | 1674
95 | 2002
96 | 1504
97 | 1865
98 | 1469
99 | 1792
100 | 1920
101 | 1925
102 | 1898
103 | 1899
104 | 1435
105 | 405
106 | 1488
107 | 1319
108 | 1322
109 | 1749
110 | 1867
111 | 1957
112 | 1944
113 | 1727
114 | 1293
115 | 1739
116 | 1285
117 | 1917
118 | 1897
119 | 1844
120 | 1966
121 | 1921
122 | 1905
123 | 1830
124 | 1484
125 | 1364
126 | 1782
127 | 1415
128 | 1412
129 | 1413
130 | 833
131 | 1857
132 | 1370
133 | 1890
134 | 1393
135 | 1262
136 | 1311
137 | 2008
138 | 1545
139 | 1896
140 | 1362
141 | 1862
142 | 1617
143 | 1864
144 | 608
145 | 1868
146 | 1689
147 | 1784
148 | 1806
149 | 1976
150 | 1870
151 | 1973
152 | 1993
153 | 1986
154 | 1998
155 | 1414
156 | 1858
157 | 1990
158 | 1841
159 | 1895
160 | 1779
161 | 1850
162 | 2001
163 | 1590
164 | 1902
165 | 1487
166 | 943
167 | 1808
168 | 782
169 | 1546
170 | 2004
171 | 1656
172 | 154
173 | 1661
174 | 1688
175 | 1731
176 | 1466
177 | 1927
178 | 1438
179 | 1387
180 | 1576
181 | 1793
182 | 1797
183 | 1979
184 | 1903
185 | 1638
186 | 1940
187 | 1911
188 | 1301
189 | 1669
190 | 1409
191 | 1578
192 | 1887
193 | 1860
194 | 1619
195 | 1939
196 | 1625
197 | 1941
198 | 1374
199 | 1766
200 | 1407
201 |
--------------------------------------------------------------------------------
/Day-09/kotlin/NyCodeGHG/solution.kt:
--------------------------------------------------------------------------------
1 | package de.nycode.aoc2020.day09
2 |
3 | import java.nio.file.Files
4 | import java.nio.file.Paths
5 | import kotlin.system.measureTimeMillis
6 |
7 | fun main() {
8 | val numbers = Files.readAllLines(Paths.get("input.txt"))
9 | .map { it.toLongOrNull() ?: error("Invalid input $it") }
10 |
11 | val time = measureTimeMillis {
12 | val invalidNumber = findInvalidNumber(numbers, 25) ?: error("Unknown error")
13 | println("Invalid Number: $invalidNumber")
14 |
15 | val weakness = findEncryptionWeakness(numbers, invalidNumber)
16 | println("Encryption weakness is: $weakness")
17 | }
18 | println("Took $time ms")
19 | }
20 |
21 | fun findInvalidNumber(numbers: List, preambleCount: Int): Long? {
22 | val data = numbers.subList(preambleCount, numbers.size)
23 | val preamble = numbers.take(preambleCount).toMutableList()
24 |
25 | var invalidNumber: Long? = null
26 |
27 | for (number in data) {
28 | if (!preamble.isCalculable(number)) {
29 | invalidNumber = number
30 | break
31 | }
32 | preamble.removeFirst()
33 | preamble.add(number)
34 | }
35 | return invalidNumber
36 | }
37 |
38 | fun MutableList.isCalculable(long: Long): Boolean {
39 | this.forEachIndexed { aIndex, a ->
40 | this.forEachIndexed { bIndex, b ->
41 | if (aIndex == bIndex) return@forEachIndexed
42 | if (a + b == long)
43 | return true
44 | }
45 | }
46 | return false
47 | }
48 |
49 | fun findEncryptionWeakness(numbers: List, invalidNumber: Long): Long? {
50 | numbers.forEachIndexed { index, number ->
51 | val contiguous = mutableListOf()
52 | numbers.subList(index, numbers.size).forEach {
53 | contiguous.add(it)
54 | val sum = contiguous.sum()
55 | if (sum > invalidNumber) {
56 | return@forEachIndexed
57 | } else if (sum == invalidNumber) {
58 | return contiguous.minOrNull()!! + contiguous.maxOrNull()!!
59 | }
60 | }
61 | }
62 | return null
63 | }
64 |
--------------------------------------------------------------------------------
/Day-01/java/MCqwertz/Day1.java:
--------------------------------------------------------------------------------
1 | //created by MCqwertz
2 |
3 | import java.io.FileNotFoundException;
4 | import java.util.ArrayList;
5 | import java.util.Scanner;
6 | import java.util.function.IntPredicate;
7 | import java.util.function.Supplier;
8 | import java.util.stream.IntStream;
9 |
10 |
11 | public class Day1 {
12 | public static void main(String[] args) throws FileNotFoundException {
13 | Supplier supplier = getInput();
14 | System.out.println("Task 1: " + getFirstPart(supplier));
15 | System.out.println("Task 2: " + getSecondPart(supplier));
16 | }
17 |
18 | /**
19 | * @param supplier supplier of the stream with all given numbers
20 | * @return the solution of the first problem
21 | */
22 | private static int getFirstPart(Supplier supplier) {
23 | IntPredicate isSearched = arg -> isContaining(supplier.get(), 2020 - arg);
24 | int result = 1;
25 | //check for each int whether there is suitable second int
26 | for (int i : supplier.get().filter(isSearched).toArray()) {
27 | result = result * i;
28 | }
29 | return result;
30 | }
31 | /**
32 | * @param supplier supplier of the stream with all given numbers
33 | * @return the solution of the second problem
34 | */
35 | private static int getSecondPart(Supplier supplier) {
36 | int[] array = supplier.get().toArray();
37 | //combine each number with every other number
38 | for (int i : array) {
39 | for (int j : array) {
40 | //check for a third suitable number
41 | if (isContaining(supplier.get(), 2020 - i - j)) {
42 | return i * j * (2020 - i - j);
43 | }
44 | }
45 | }
46 | return -1;
47 | }
48 |
49 | private static boolean isContaining(IntStream stream, int x) {
50 | for (int i : stream.toArray()) {
51 | if(i == x) {
52 | return true;
53 | }
54 | }
55 | return false;
56 | }
57 |
58 | public static Supplier getInput() throws FileNotFoundException {
59 | Scanner scanner = TextFileUtils.getScanner(1);
60 | ArrayList arrayList = new ArrayList<>();
61 | while(scanner.hasNextLine()) {
62 | arrayList.add(scanner.nextLine());
63 | }
64 | scanner.close();
65 | return () -> arrayList.stream().mapToInt(Integer::parseInt);
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/Day-06/kotlin/NyCodeGHG/solution.kt:
--------------------------------------------------------------------------------
1 | package de.nycode.aoc2020.day06
2 |
3 | import java.nio.file.Files
4 | import java.nio.file.Paths
5 |
6 | fun main() {
7 | val answers = ArrayList()
8 |
9 | var answer = Answer()
10 | val lines = Files.readAllLines(Paths.get("input.txt"))
11 |
12 | var index = 0
13 | var lastLineCount = 0
14 |
15 | while (index < lines.size) {
16 | val line = lines[index]
17 |
18 | if (line.isBlank()) {
19 | index++
20 | continue
21 | }
22 |
23 | answer.people = ++lastLineCount
24 | answer.questions.addAll(line.toCharArray().toMutableSet())
25 |
26 | if (++index < lines.size) {
27 | if (lines[index].isBlank()) {
28 | answers.add(answer)
29 | answer = Answer()
30 | lastLineCount = 0
31 | }
32 | } else {
33 | answers.add(answer)
34 | answer = Answer()
35 | lastLineCount = 0
36 | }
37 | }
38 |
39 | println(answers.map { it.questions.size }.sum())
40 |
41 | val groups = ArrayList()
42 | var group = Group()
43 | index = 0
44 | lastLineCount = 0
45 |
46 | while (index < lines.size) {
47 | val line = lines[index]
48 |
49 | if (line.isBlank()) {
50 | index++
51 | continue
52 | }
53 |
54 | group.answers[++lastLineCount] = Answer(line.toCharArray().toMutableSet(), lastLineCount)
55 |
56 | if (++index < lines.size) {
57 | if (lines[index].isBlank()) {
58 | groups.add(group)
59 | group = Group()
60 | lastLineCount = 0
61 | }
62 | } else {
63 | groups.add(group)
64 | group = Group()
65 | lastLineCount = 0
66 | }
67 | }
68 |
69 | println(groups.map { aGroup ->
70 | val questions = aGroup.answers.map { it.value.questions }.flatten().toMutableSet()
71 | questions.removeIf { char ->
72 | aGroup.answers.filter { !it.value.questions.contains(char) }.isNotEmpty()
73 | }
74 | questions.size
75 | }.sum())
76 | }
77 |
78 | data class Group(val answers: MutableMap = mutableMapOf())
79 |
80 | data class Answer(val questions: MutableSet = mutableSetOf(), var people: Int = 0)
81 |
--------------------------------------------------------------------------------
/Day-10/c/JohnnyJayJay/Day10.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include "../../../shared/JohnnyJayJay/aoc.h"
5 |
6 |
7 | int main(int argc, char** argv) {
8 | FILE* file = fopen(argv[1], "r");
9 | int lines = count_lines(file);
10 |
11 | int* jolt_ratings = malloc(sizeof(int) * (lines + 2));
12 | jolt_ratings[0] = 0;
13 | jolt_ratings[lines + 1] = INT_MAX;
14 | read_ints(file, jolt_ratings + 1, lines);
15 |
16 | qsort(jolt_ratings, lines + 1, sizeof(int), &intcmp);
17 | jolt_ratings[lines + 1] = jolt_ratings[lines] + 3;
18 |
19 | int* difference_map = malloc(sizeof(int) * lines);
20 | int one_jolt_differences = 0;
21 | int three_jolt_differences = 0;
22 | for (int i = 0; i < lines + 1; i++) {
23 | int first = jolt_ratings[i];
24 | int second = jolt_ratings[i + 1];
25 | int difference = second - first;
26 | difference_map[i] = difference;
27 | if (difference == 1) {
28 | one_jolt_differences++;
29 | } else if (difference == 3) {
30 | three_jolt_differences++;
31 | }
32 | }
33 |
34 | printf("%d one jolt and %d three jolt differences - Result: %d\n",
35 | one_jolt_differences, three_jolt_differences, one_jolt_differences * three_jolt_differences);
36 |
37 | // the number of permutations is equal to the product of all streaks in the sequence.
38 | // a streak is a consecutive subsequence of 1s in the difference map. Each streak's number of permutations
39 | // can be calculated with the formula pow(2, s - 1) - max(0, pow(2, s - 3) - 1), where s is the streak length
40 | // (number of 1s, in the code below exactly one lower)
41 | long permutations = 1;
42 | int streak_len = -1;
43 | for (int i = 0; i < lines + 1; i++) {
44 | int diff = difference_map[i];
45 | if (diff == 1) {
46 | streak_len++;
47 | } else {
48 | if (streak_len > 0) {
49 | long streak_combs = 1 << streak_len;
50 | int distance = streak_len + 1 - 3;
51 | if (distance > 0) {
52 | streak_combs -= (1 << distance) - 1;
53 | }
54 | permutations *= streak_combs;
55 | }
56 | streak_len = -1;
57 | }
58 | }
59 |
60 | printf("Possible permutations: %ld\n", permutations);
61 |
62 |
63 | }
--------------------------------------------------------------------------------
/Day-04/python/paul2708/solution.py:
--------------------------------------------------------------------------------
1 | from assertions import assert_equals
2 | from input_reader import read_lines
3 | from printer import aoc_print
4 |
5 | required_passport_keys = {
6 | "byr": lambda x: x.isdigit() and 1920 <= int(x) <= 2002,
7 | "iyr": lambda x: x.isdigit() and 2010 <= int(x) <= 2020,
8 | "eyr": lambda x: x.isdigit() and 2020 <= int(x) <= 2030,
9 | "hgt": lambda x: validate_height(x),
10 | "hcl": lambda x: validate_hair_color(x),
11 | "ecl": lambda x: x in {"amb", "blu", "brn", "gry", "grn", "hzl", "oth"},
12 | "pid": lambda x: len(x) == 9 and 0 <= int(x) <= 999999999,
13 | "cid": lambda x: True
14 | }
15 |
16 |
17 | def validate_hair_color(val: str) -> bool:
18 | if val[0] != "#" or len(val) != 7:
19 | return False
20 |
21 | for i in range(1, 7):
22 | if val[i] not in {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
23 | "a", "b", "c", "d", "e", "f"}:
24 | return False
25 |
26 | return True
27 |
28 |
29 | def validate_height(val: str) -> bool:
30 | if "cm" in val:
31 | return 150 <= int(val[:-2]) <= 193
32 | elif "in" in val:
33 | return 59 <= int(val[:-2]) <= 76
34 | else:
35 | return False
36 |
37 |
38 | def is_present(passport: dict) -> bool:
39 | keys = set(passport.keys())
40 | keys.add("cid")
41 |
42 | return keys == set(required_passport_keys)
43 |
44 |
45 | def is_valid(passport: dict) -> bool:
46 | for key in passport:
47 | if not required_passport_keys[key](passport[key]):
48 | return False
49 |
50 | return True
51 |
52 |
53 | passports = []
54 |
55 | # Parse passports
56 | passport = {}
57 | for line in read_lines("day04"):
58 | if not line.strip():
59 | passports.append(passport)
60 | passport = {}
61 | continue
62 |
63 | for pair in line.split(" "):
64 | passport[pair.split(":")[0]] = pair.split(":")[1]
65 |
66 | passports.append(passport)
67 |
68 | # Part one
69 | count_valid_passports = len([x for x in passports if is_present(x)])
70 |
71 | aoc_print(f"The passport list contains {count_valid_passports} valid passports.")
72 | assert_equals(239, count_valid_passports)
73 |
74 | # Part two
75 | count_valid_passports = len([x for x in passports if is_present(x) and is_valid(x)])
76 |
77 | aoc_print(f"The passport list contains {count_valid_passports} valid passports.")
78 | assert_equals(188, count_valid_passports)
79 |
--------------------------------------------------------------------------------
/Day-08/kotlin/NyCodeGHG/solution.kt:
--------------------------------------------------------------------------------
1 | package de.nycode.aoc2020.day08
2 |
3 | import java.nio.file.Files
4 | import java.nio.file.Paths
5 |
6 | val instructions = Files.readAllLines(Paths.get("input.txt"))
7 | .map { it.split(" ") }
8 | .mapIndexed { index, splitten -> Instruction(index, splitten[0], splitten[1].toInt()) }
9 | .toTypedArray()
10 |
11 | fun main() {
12 | val program = Program(instructions.createCopy())
13 | val result = program.execute()
14 | println("accumulator is at ${result.accumulator}")
15 |
16 | val alternativeProgramResult = instructions
17 | .filter { it.type in arrayOf("jmp", "nop") }
18 | .map {
19 | val copiedProgram = Program(instructions.createCopy())
20 | copiedProgram.instructions[it.index].flipType("jmp", "nop")
21 | copiedProgram.execute()
22 | }
23 | .firstOrNull { it.exitCode == 0 }
24 |
25 | println("accumulator with fixed program is ${alternativeProgramResult?.accumulator}")
26 | }
27 |
28 | fun Instruction.execute(program: Program): Int {
29 | this.executions++
30 | return when (type) {
31 | "acc" -> {
32 | program.accumulator += this.value
33 | 1
34 | }
35 | "jmp" -> {
36 | this.value
37 | }
38 | else -> {
39 | 1
40 | }
41 | }
42 | }
43 |
44 | fun Array.createCopy() = this.map { it.copy() }.toTypedArray()
45 |
46 | fun Program.execute(): ExecutionResult {
47 | var currentInstruction = 0
48 |
49 | while (currentInstruction < this.instructions.size) {
50 | val instruction = this.instructions[currentInstruction]
51 | if (instruction.executions > 0) {
52 | return ExecutionResult(accumulator, -1)
53 | }
54 | currentInstruction += instruction.execute(this)
55 | }
56 | return ExecutionResult(accumulator, 0)
57 | }
58 |
59 | fun Instruction.flipType(first: String, second: String) {
60 | when (this.type) {
61 | first -> {
62 | this.type = second
63 | }
64 | second -> {
65 | this.type = first
66 | }
67 | }
68 | }
69 |
70 | data class Program(val instructions: Array, var accumulator: Int = 0)
71 | data class ExecutionResult(val accumulator: Int, val exitCode: Int)
72 | data class Instruction(var index: Int, var type: String, val value: Int, var executions: Int = 0) : Cloneable
--------------------------------------------------------------------------------
/Day-02/java/zFlxw/Solution.java:
--------------------------------------------------------------------------------
1 | import java.io.File;
2 | import java.io.FileNotFoundException;
3 | import java.util.ArrayList;
4 | import java.util.List;
5 | import java.util.Scanner;
6 |
7 | public class Solution {
8 | public static void main(String[] args) {
9 | List input = readInput();
10 | int totalPasswords = 0;
11 | int totalPasswordsNewPolicy = 0;
12 |
13 | // Problem 1
14 | for (String str : input) {
15 | String amount = str.split(" ")[0];
16 | String character = str.split(" ")[1].split(":")[0];
17 | String password = str.split(" ")[2];
18 | int minAmount = Integer.parseInt(amount.split("-")[0]);
19 | int maxAmount = Integer.parseInt(amount.split("-")[1]);
20 | int count = 0;
21 |
22 | for (char c : password.toCharArray())
23 | if (c == character.charAt(0))
24 | count++;
25 |
26 | if (count >= minAmount && count <= maxAmount)
27 | totalPasswords++;
28 | }
29 |
30 | System.out.println("Problem 1: " + totalPasswords);
31 |
32 | // Problem 2
33 | for (String str : input) {
34 | String amount = str.split(" ")[0];
35 | String character = str.split(" ")[1].split(":")[0];
36 | String password = str.split(" ")[2];
37 | int firstIndex = Integer.parseInt(amount.split("-")[0]);
38 | int secondIndex = Integer.parseInt(amount.split("-")[1]);
39 |
40 | if (password.length() > firstIndex && password.length() >= secondIndex)
41 | if ((password.charAt(firstIndex - 1) == character.charAt(0) && password.charAt(secondIndex - 1) != character.charAt(0)) ||
42 | (password.charAt(firstIndex - 1) != character.charAt(0) && password.charAt(secondIndex - 1) == character.charAt(0)))
43 | totalPasswordsNewPolicy++;
44 |
45 | }
46 |
47 | System.out.println("Problem 2: " + totalPasswordsNewPolicy);
48 | }
49 |
50 | private static List readInput() {
51 | List values = new ArrayList<>();
52 | String path = new File("").getAbsolutePath();
53 | // Pfad könnte bei euch anders sein | Path might be different for you
54 | File file = new File(path.concat("/src/day2/input.txt"));
55 | try {
56 | Scanner scanner = new Scanner(file);
57 | while (scanner.hasNextLine()) {
58 | String val = scanner.nextLine();
59 | values.add(val);
60 | }
61 | scanner.close();
62 | } catch (FileNotFoundException e) {
63 | e.printStackTrace();
64 | }
65 | return values;
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/Day-04/typescript/WeiiswurstDev/index.ts:
--------------------------------------------------------------------------------
1 | //
2 | // PLEASE READ THE README.md IN MY SHARED FOLDER!
3 | //
4 |
5 | import fs from 'fs'
6 | import { EOL } from 'os'
7 |
8 | // Read input
9 | const input = fs
10 | .readFileSync('input.txt')
11 | .toString()
12 | .split(EOL);
13 |
14 | // All eye colors
15 | const eyeColors = ["amb","blu","brn","gry","grn","hzl","oth"]
16 |
17 | // Field logic
18 | type Field = {
19 | name:string,
20 | validate: (obj: string)=>boolean
21 | }
22 |
23 | const requiredFields: Field[] = [
24 | {name:"byr", validate: obj=>isValueBetween(obj,1920,2020)},
25 | {name:"iyr", validate: obj=>isValueBetween(obj,2010,2020)},
26 | {name:"eyr", validate: obj=>isValueBetween(obj,2020,2030)},
27 | {name:"hcl", validate: obj=>{
28 | if(obj.length != 7) return false;
29 | return obj.match(/#[0-9a-f]{6}/) != null;
30 | }},
31 | {name:"hgt", validate: obj=>{
32 | let len = obj.length;
33 | if(obj.endsWith("cm")) return isValueBetween(obj.substring(0,len-2),150,193)
34 | else if(obj.endsWith("in")) return isValueBetween(obj.substring(0,len-2),59,76)
35 | else return false;
36 | }},
37 | {name:"ecl", validate: obj=>eyeColors.includes(obj)},
38 | {name:"pid", validate: obj=>{
39 | if(obj.length != 9) return false;
40 | return !Number.isNaN(Number.parseInt(obj))
41 | }},
42 | ]
43 |
44 | function isValueBetween(value:string,min:number,max:number):boolean {
45 | let x = Number.parseInt(value);
46 | return x >= min && x <= max;
47 | }
48 |
49 | //
50 | // Using the fields/functions that are defined above
51 | //
52 |
53 | let current:any = {};
54 | const passports:any[] = [];
55 | let hasAllFieldsAmount = 0;
56 | let allFieldsValidAmount = 0;
57 |
58 | // Extracted logic from the for loop to also handle the last element
59 | function handlePassport() {
60 | passports.push(current);
61 | let hasAllFields = true;
62 | let allFieldsValid = true;
63 | for(let field of requiredFields) {
64 | // Part 1
65 | if(current[field.name] === undefined) hasAllFields = false;
66 | // Part 2
67 | else if(!field.validate(current[field.name])) allFieldsValid = false;
68 | }
69 | if(hasAllFields) hasAllFieldsAmount++
70 | if(hasAllFields && allFieldsValid) allFieldsValidAmount++;
71 | current = {};
72 | }
73 |
74 | // Handle all passports
75 | for (let line of input) {
76 | if (line == '') { // New passport begins, handle old one
77 | handlePassport();
78 | continue;
79 | }
80 | let pairs = line.split(' ');
81 | for (let pair of pairs) {
82 | let split = pair.split(':');
83 | let key = split[0];
84 | let val = split[1];
85 | current[key] = val;
86 | }
87 | }
88 |
89 | // Handle the last passport
90 | handlePassport();
91 |
92 | // Print solutions
93 | console.log("Part 1:",hasAllFieldsAmount)
94 | console.log("Part 2:",allFieldsValidAmount)
--------------------------------------------------------------------------------
/Day-08/python/paul2708/solution.py:
--------------------------------------------------------------------------------
1 | from assertions import assert_equals
2 | from input_reader import read_lines
3 | from printer import aoc_print
4 |
5 |
6 | class Program():
7 | def __init__(self, instructions: [str]):
8 | self.accumulator = 0
9 | self.instruction_pointer = 0
10 | self.instructions = list(instructions)
11 |
12 | def run(self):
13 | instruction = instructions[self.instruction_pointer]
14 | op_code = instruction.split(" ")[0]
15 |
16 | self.instruction_pointer += 1
17 |
18 | if op_code == "nop":
19 | pass
20 | elif op_code == "jmp":
21 | self.instruction_pointer += int(instruction.split(" ")[1]) - 1
22 | elif op_code == "acc":
23 | self.accumulator += int(instruction.split(" ")[1])
24 | else:
25 | print("invalid instruction")
26 |
27 | def run_all(self):
28 | while self.instruction_pointer < len(instructions):
29 | self.run()
30 |
31 | def terminates(self) -> bool:
32 | executed_lines = set()
33 |
34 | while self.instruction_pointer not in executed_lines:
35 | executed_lines.add(program.instruction_pointer)
36 |
37 | if self.instruction_pointer >= len(self.instructions):
38 | return True
39 |
40 | self.run()
41 |
42 | return False
43 |
44 |
45 | instructions = read_lines("day08")
46 | program = Program(instructions)
47 |
48 | # Part one
49 | program.terminates()
50 |
51 | aoc_print(f"The program gets interrupted with an accumulator of {program.accumulator}.")
52 | assert_equals(1801, program.accumulator)
53 |
54 |
55 | # Part two
56 | def replace_all(base_list: [str], old: str, new: str) -> [[str]]:
57 | total = list()
58 | index = 0
59 |
60 | while True:
61 | tup = replace(list(base_list), old, new, index)
62 | if tup[1] == -1:
63 | break
64 |
65 | total.append(tup[0])
66 | index = tup[1]
67 |
68 | return total
69 |
70 |
71 | def replace(replacement_list: [str], old: str, new: str, start: int) -> ([str], int):
72 | for i in range(start, len(replacement_list)):
73 | if old in replacement_list[i]:
74 | replacement_list[i] = replacement_list[i].replace(old, new)
75 | return replacement_list, i + 1
76 |
77 | return [], -1
78 |
79 |
80 | replaced_instructions_list = replace_all(instructions, "jmp", "nop") \
81 | + replace_all(instructions, "nop", "jmp")
82 |
83 | for instructions in replaced_instructions_list:
84 | program = Program(instructions)
85 | if program.terminates():
86 | program = Program(instructions)
87 | program.run_all()
88 |
89 | aoc_print(f"The program terminates with an accumulator of {program.accumulator}.")
90 | assert_equals(2060, program.accumulator)
91 |
--------------------------------------------------------------------------------
/Day-04/kotlin/NyCodeGHG/solution.kt:
--------------------------------------------------------------------------------
1 | package de.nycode.aoc2020.day04
2 |
3 | import java.nio.file.Files
4 | import java.nio.file.Paths
5 |
6 | typealias Document = HashMap
7 |
8 | fun main() {
9 | val documents = parseInput()
10 |
11 | var validCounter = 0
12 |
13 | documents.forEach { document ->
14 | if (document.areRequiredFieldsPresent()) {
15 | validCounter++
16 | }
17 | }
18 |
19 | println("Found $validCounter documents with required fields present")
20 |
21 | val rules = ValidationRule.values()
22 |
23 | validCounter = 0
24 |
25 | documents.forEach { document ->
26 |
27 | if (document.areRequiredFieldsPresent()) {
28 | val invalid = document.map { entry ->
29 | val (key, value) = entry
30 |
31 | val rule = rules.firstOrNull { it.key == key } ?: error("Unknown key $key")
32 |
33 | if (rule.regex == null) {
34 | true
35 | } else {
36 | rule.regex.matches(value)
37 | }
38 | }.any { !it }
39 |
40 | if (!invalid) {
41 | validCounter++
42 | }
43 | }
44 | }
45 |
46 | println("Found $validCounter valid documents!")
47 | }
48 |
49 | fun parseInput(): List {
50 | val lines = Files.readAllLines(Paths.get("./input.txt"))
51 |
52 | var lineCounter = 0
53 | val documents = ArrayList()
54 |
55 | var currentDocument = Document()
56 | documents.add(currentDocument)
57 |
58 | while (lineCounter < lines.size) {
59 |
60 | val line = lines[lineCounter]
61 |
62 | if (line.isNotBlank()) {
63 | line.split(" ")
64 | .forEach {
65 | val splitten = it.split(":")
66 | val key = splitten[0]
67 | val value = splitten[1]
68 | currentDocument[key] = value
69 | }
70 | } else {
71 | currentDocument = Document()
72 | documents.add(currentDocument)
73 | }
74 |
75 | lineCounter++
76 | }
77 |
78 | return documents
79 | }
80 |
81 | fun Document.areRequiredFieldsPresent(): Boolean {
82 | return this.containsKeys("byr", "iyr", "eyr", "hgt", "hcl", "ecl", "pid")
83 | }
84 |
85 | fun Document.containsKeys(vararg keys: String): Boolean {
86 | return !keys.map { containsKey(it) }.any { !it }
87 | }
88 |
89 | enum class ValidationRule(val key: String, val regex: Regex?) {
90 | BIRTH_YEAR("byr", "(19[2-8][0-9]|199[0-9]|200[0-2])".toRegex()),
91 | ISSUE_YEAR("iyr", "(201[0-9]|2020)".toRegex()),
92 | EXPIRATION_YEAR("eyr", "(202[0-9]|2030)".toRegex()),
93 | HEIGHT("hgt", "(59|6[0-9]|7[0-6])in|(1[5-8][0-9]|19[0-3])cm".toRegex()),
94 | HAIR_COLOR("hcl", "#[0-9a-f]{6}".toRegex()),
95 | EYE_COLOR("ecl", "amb|blu|brn|gry|grn|hzl|oth".toRegex()),
96 | PASSPORT_ID("pid", "[0-9]{9}".toRegex()),
97 | COUNTRY_ID("cid", null)
98 | }
99 |
--------------------------------------------------------------------------------
/Day-11/c/JohnnyJayJay/Day11.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #include "../../../shared/JohnnyJayJay/aoc.h"
6 |
7 | char ray_cast(char* map, int width, int height, int start_pos, int x_step, int y_step, int max) {
8 | int previous_pos = start_pos;
9 | for (int i = 0; i < max; i++) {
10 | int next_pos = previous_pos + (width * y_step) + x_step;
11 | if (next_pos < 0 || next_pos >= width * height || (next_pos / width) - (previous_pos / width) != y_step) {
12 | return '.';
13 | } else if (map[next_pos] != '.') {
14 | return map[next_pos];
15 | }
16 | previous_pos = next_pos;
17 | }
18 | return '.';
19 | }
20 |
21 | void next_state(char* map, char* buf, int width, int height, int seat_pos, int max_sight, int max_tolerance) {
22 | char cur_state = map[seat_pos];
23 | if (cur_state == '.') {
24 | return;
25 | }
26 |
27 | char adjacents[8];
28 | int i = 0;
29 | for (int x = -1; x < 2; x++) {
30 | for (int y = -1; y < 2; y++) {
31 | if (x || y) {
32 | adjacents[i] = ray_cast(map, width, height, seat_pos, x, y, max_sight);
33 | i++;
34 | }
35 | }
36 | }
37 |
38 | int adjacent_occupied = charcount(adjacents, '#', 0, 8);
39 | if (cur_state == 'L' && adjacent_occupied == 0) {
40 | buf[seat_pos] = '#';
41 | } else if (cur_state == '#' && adjacent_occupied > max_tolerance) {
42 | buf[seat_pos] = 'L';
43 | } else {
44 | buf[seat_pos] = cur_state;
45 | }
46 | }
47 |
48 | int predict_occupied_seats(const char* original_seats, int width, int height, int max_sight, int max_tolerance) {
49 | int seat_count = width * height;
50 | char* seats = malloc(seat_count + 1);
51 | memcpy(seats, original_seats, seat_count + 1);
52 | char* seat_buf = malloc(seat_count + 1);
53 | memcpy(seat_buf, original_seats, seat_count + 1);
54 |
55 | do {
56 | for (int i = 0; i < seat_count; i++) {
57 | next_state(seats, seat_buf, width, height, i, max_sight, max_tolerance);
58 | }
59 | char* tmp = seat_buf;
60 | seat_buf = seats;
61 | seats = tmp;
62 | } while (strcmp(seats, seat_buf) != 0);
63 |
64 | int count = charcount(seats, '#', 0, seat_count);
65 | free(seats);
66 | free(seat_buf);
67 | return count;
68 | }
69 |
70 | int main(int argc, char** argv) {
71 | FILE* file = fopen(argv[1], "r");
72 | int width = chars_until(file, '\n', 1);
73 | int height = count_lines(file);
74 | int seat_count = width * height;
75 | char* seats = malloc(seat_count + 1);
76 | for (int i = 0; i < seat_count; i++) {
77 | char c = fgetc(file);
78 | if (c == '\n') {
79 | i--;
80 | continue;
81 | }
82 | seats[i] = c;
83 | }
84 | seats[seat_count] = 0;
85 |
86 | printf("Seats occupied (part 1): %d\n", predict_occupied_seats(seats, width, height, 1, 3));
87 | printf("Seats occupied (part 2): %d\n", predict_occupied_seats(seats, width, height, seat_count, 4));
88 | }
89 |
--------------------------------------------------------------------------------
/Day-08/c/JohnnyJayJay/Day08.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include "../../../shared/JohnnyJayJay/aoc.h"
5 |
6 | typedef struct {
7 | char* opcode;
8 | int arg;
9 | } instruction;
10 |
11 | typedef struct {
12 | int* possible_corruption;
13 | int possible_corruption_len;
14 | int acc;
15 | int infinite_loop;
16 | } execution_result;
17 |
18 | execution_result* run_program(int length, instruction* insts) {
19 | int* visits = calloc(sizeof(int), length);
20 | int acc = 0;
21 | int* possible_corruption = malloc(sizeof(int) * length);
22 | int possible_corruption_len = 0;
23 | int infinite_loop = 0;
24 | for (int i = 0; i < length; i++) {
25 | if (visits[i]) {
26 | infinite_loop = 1;
27 | break;
28 | }
29 | visits[i] = 1;
30 | instruction* inst = &insts[i];
31 | char* opcode = inst->opcode;
32 | int arg = inst->arg;
33 | if (strcmp(opcode, "acc") == 0) {
34 | acc += arg;
35 | } else {
36 | possible_corruption[possible_corruption_len] = i;
37 | possible_corruption_len++;
38 | if (strcmp(opcode, "jmp") == 0) {
39 | i += arg - 1;
40 | }
41 | }
42 |
43 | }
44 | free(visits);
45 | execution_result* res = malloc(sizeof(execution_result));
46 | res->possible_corruption = possible_corruption;
47 | res->possible_corruption_len = possible_corruption_len;
48 | res->acc = acc;
49 | res->infinite_loop = infinite_loop;
50 | return res;
51 | }
52 |
53 | void free_execution_result(execution_result* result) {
54 | free(result->possible_corruption);
55 | free(result);
56 | }
57 |
58 | void fix_program(int length, instruction* insts, int* possible_corruption, int possible_corruption_len) {
59 | for (int i = 0; i < possible_corruption_len; i++) {
60 | int pos = possible_corruption[i];
61 | instruction old = insts[pos];
62 | instruction new = {strcmp(old.opcode, "jmp") == 0 ? "nop" : "jmp", old.arg};
63 | insts[pos] = new;
64 | execution_result* result = run_program(length, insts);
65 | int infinite_loop = result->infinite_loop;
66 | free_execution_result(result);
67 | if (infinite_loop) {
68 | insts[pos] = old;
69 | } else {
70 | return;
71 | }
72 | }
73 | }
74 |
75 |
76 | int main(int argc, char** argv) {
77 | FILE* file = fopen(argv[1], "r");
78 | int lines = count_lines(file);
79 | instruction* insts = malloc(sizeof(instruction) * lines);
80 | for (int i = 0; i < lines; i++) {
81 | char* opcode = malloc(4);
82 | int arg;
83 | fscanf(file, "%3s %d", opcode, &arg);
84 | instruction inst = {opcode, arg};
85 | insts[i] = inst;
86 | }
87 |
88 | execution_result* result = run_program(lines, insts);
89 | printf("The accumulator is %d\n", result->acc);
90 | fix_program(lines, insts, result->possible_corruption, result->possible_corruption_len);
91 | result = run_program(lines, insts);
92 | printf("The fixed accumulator is %d\n", result->acc);
93 | }
94 |
--------------------------------------------------------------------------------
/Day-04/java/MCqwertz/Day4.java:
--------------------------------------------------------------------------------
1 | //created by MCqwertz
2 |
3 | package MCqwertz;
4 |
5 | import java.io.FileNotFoundException;
6 | import java.util.ArrayList;
7 | import java.util.HashMap;
8 | import java.util.Scanner;
9 |
10 | public class Day4 {
11 | public static void main(String[] args) throws FileNotFoundException {
12 | ArrayList> input = getInput();
13 | System.out.println("Part 1: " + getFirstResult(input));
14 | System.out.println("Part 2: " + getSecondResult(input));
15 | }
16 |
17 | public static int getFirstResult(ArrayList> input) {
18 | int result = 0;
19 | for (HashMap map : input) {
20 | if(map.containsKey("byr") && map.containsKey("iyr") && map.containsKey("eyr") && map.containsKey("hgt")
21 | && map.containsKey("hcl") && map.containsKey("ecl") && map.containsKey("pid")) {
22 | result++;
23 | }
24 | }
25 | return result;
26 | }
27 |
28 | public static int getSecondResult(ArrayList> input) {
29 | int result = 0;
30 | for (HashMap map : input) {
31 | if(map.containsKey("byr") && map.containsKey("iyr") && map.containsKey("eyr") && map.containsKey("hgt")
32 | && map.containsKey("hcl") && map.containsKey("ecl") && map.containsKey("pid")
33 | && Integer.parseInt(map.get("byr")) >= 1920 && Integer.parseInt(map.get("byr")) <= 2002
34 | && Integer.parseInt(map.get("iyr")) >= 2010 && Integer.parseInt(map.get("iyr")) <= 2020
35 | && Integer.parseInt(map.get("eyr")) >= 2020 && Integer.parseInt(map.get("eyr")) <= 2030
36 | && (((String.valueOf(map.get("hgt").toCharArray()[map.get("hgt").toCharArray().length - 2]) +
37 | map.get("hgt").toCharArray()[map.get("hgt").toCharArray().length - 1]).equals("cm")
38 | && Integer.parseInt(map.get("hgt").substring(0 , map.get("hgt").length() - 2)) >= 150
39 | && Integer.parseInt(map.get("hgt").substring(0 , map.get("hgt").length() - 2)) <= 193)
40 | || ((String.valueOf(map.get("hgt").toCharArray()[map.get("hgt").toCharArray().length - 2]) +
41 | map.get("hgt").toCharArray()[map.get("hgt").toCharArray().length - 1]).equals("in")
42 | && Integer.parseInt(map.get("hgt").substring(0 , map.get("hgt").length() - 2)) >= 59
43 | && Integer.parseInt(map.get("hgt").substring(0 , map.get("hgt").length() - 2)) <= 76))
44 | && map.get("hcl").matches("#[a-f|0-9][a-f|0-9][a-f|0-9][a-f|0-9][a-f|0-9][a-f|0-9]")
45 | && (map.get("ecl").equals("amb") ||
46 | map.get("ecl").equals("blu") ||
47 | map.get("ecl").equals("brn") ||
48 | map.get("ecl").equals("gry") ||
49 | map.get("ecl").equals("grn") ||
50 | map.get("ecl").equals("hzl") ||
51 | map.get("ecl").equals("oth"))
52 | && map.get("pid").replaceAll("[^0-9]", "").length() == 9) {
53 | result++;
54 | }
55 | }
56 | return result;
57 | }
58 |
59 | private static ArrayList> getInput() throws FileNotFoundException {
60 | Scanner scanner = TextFileUtils.getScanner(4);
61 | ArrayList> input = new ArrayList<>();
62 | StringBuilder sb = new StringBuilder();
63 | while(scanner.hasNextLine()) {
64 | String line = scanner.nextLine();
65 | if(line.equals("")) {
66 | String[] strings = sb.toString().replace(':', ' ').split(" ");
67 | HashMap map = new HashMap<>();
68 | for (int i = 0; i < strings.length; i += 2) {
69 | map.put(strings[i], strings[i + 1]);
70 | }
71 | input.add(map);
72 | sb = new StringBuilder();
73 | } else {
74 | if(sb.length() != 0) {
75 | sb.append(' ');
76 | }
77 | sb.append(line);
78 | }
79 | }
80 | String[] strings = sb.toString().replace(':', ' ').split(" ");
81 | HashMap map = new HashMap<>();
82 | for (int i = 0; i < strings.length; i += 2) {
83 | map.put(strings[i], strings[i + 1]);
84 | }
85 | input.add(map);
86 | return input;
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/Day-11/kotlin/NyCodeGHG/solution.kt:
--------------------------------------------------------------------------------
1 | package de.nycode.aoc2020.day11
2 |
3 | import java.nio.file.Files
4 | import java.nio.file.Paths
5 |
6 | fun main() {
7 |
8 | var seats: Array> = readSeats()
9 |
10 | while (true) {
11 | if (seats.runSimulation().isEmpty())
12 | break
13 | }
14 |
15 | val occupiedSeats = seats.flatten().filter { it == '#' }.size
16 | println(occupiedSeats)
17 |
18 | seats = readSeats()
19 | while (true) {
20 | if (seats.runSimulation(true).isEmpty())
21 | break
22 | }
23 |
24 | val occupiedSeats2 = seats.flatten().filter { it == '#' }.size
25 | println(occupiedSeats2)
26 | }
27 |
28 | fun readSeats(): Array> {
29 | return Files.readAllLines(Paths.get("input.txt"))
30 | .map { it.toCharArray().toTypedArray() }
31 | .toTypedArray()
32 | }
33 |
34 | fun Array>.runSimulation(viewMode: Boolean = false): Map, Char> {
35 |
36 | val changes = mutableMapOf, Char>()
37 |
38 | this.forEachIndexed { x, array ->
39 | array.forEachIndexed { y, seat ->
40 | if (seat == '.')
41 | return@forEachIndexed
42 |
43 | val neighbors = if (!viewMode) this.getNeighbours(x, y) else this.getSeatsInView(x, y)
44 |
45 | if (seat == 'L' && neighbors.all { it == 'L' || it == '.' }) {
46 | changes[x to y] = '#'
47 | }
48 |
49 | if (seat == '#' && neighbors.filter { it == '#' }.size >= if (viewMode) 5 else 4) {
50 | changes[x to y] = 'L'
51 | }
52 | }
53 | }
54 | changes.forEach { (position, state) ->
55 | val (x, y) = position
56 | this[x][y] = state
57 | }
58 |
59 | return changes
60 | }
61 |
62 | fun Array>.getNeighbours(x: Int, y: Int): Array {
63 | return arrayOf(
64 | this.getOffsetSeat(x - 1, y - 1), // Top Left
65 | this.getOffsetSeat(x - 1, y), // Center Left
66 | this.getOffsetSeat(x - 1, y + 1), // Bottom Left
67 | this.getOffsetSeat(x, y + 1), // Bottom Center
68 | this.getOffsetSeat(x + 1, y + 1), // Bottom Right
69 | this.getOffsetSeat(x + 1, y), // Center Right
70 | this.getOffsetSeat(x + 1, y - 1), // Top Right
71 | this.getOffsetSeat(x, y - 1), // Top Center
72 | )
73 | }
74 |
75 | fun Array>.getOffsetSeat(offsetX: Int, offsetY: Int): Char {
76 | if (offsetX >= this.size || offsetX < 0)
77 | return '.' // Return floor
78 |
79 | val column = this[offsetX]
80 | if (offsetY >= column.size || offsetY < 0)
81 | return '.'
82 |
83 | return column[offsetY]
84 | }
85 |
86 | fun Array>.getSeatInView(x: Int, y: Int, direction: Direction): Char {
87 | var counter = 1
88 | val (offsetX, offsetY) = direction
89 |
90 | while (true) {
91 | val posX = x + offsetX * counter
92 | val posY = y + offsetY * counter
93 |
94 | if (posX >= this.size || posX < 0)
95 | return '.'
96 | if (posY >= this[posX].size || posY < 0)
97 | return '.'
98 |
99 | val seat = this[posX][posY]
100 | if (seat != '.')
101 | return seat
102 | counter++
103 | }
104 | }
105 |
106 | fun Array>.getSeatsInView(x: Int, y: Int): Array {
107 | return Direction.values().map { this.getSeatInView(x, y, it) }.toTypedArray()
108 | }
109 |
110 | enum class Direction(private val x: Int, private val y: Int) {
111 | TOP(0, 1),
112 | TOP_LEFT(-1, 1),
113 | TOP_RIGHT(1, 1),
114 | CENTER_LEFT(-1, 0),
115 | CENTER_RIGHT(1, 0),
116 | BOTTOM(0, -1),
117 | BOTTOM_LEFT(-1, -1),
118 | BOTTOM_RIGHT(1, -1);
119 |
120 | operator fun component1() = x
121 | operator fun component2() = y
122 | }
--------------------------------------------------------------------------------
/Day-04/c/JohnnyJayJay/Day04.c:
--------------------------------------------------------------------------------
1 | // Read my README in shared/JohnnyJayJay
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include "../../../shared/JohnnyJayJay/aoc.h"
8 |
9 | int skip_newline(FILE* file) {
10 | int next = fgetc(file);
11 | int ahead = next == '\n' || next == EOF;
12 | if (!ahead) {
13 | fseek(file, -1, SEEK_CUR);
14 | }
15 | return ahead;
16 | }
17 |
18 | int main(int argc, char** argv) {
19 | regex_t hcl_regex;
20 | regcomp(&hcl_regex, "^#[0-9a-f]\\{6\\}$", 0);
21 | regex_t pid_regex;
22 | regcomp(&pid_regex, "^[0-9]\\{9\\}$", 0);
23 | regex_t hgt_regex;
24 | regcomp(&hgt_regex, "^[0-9]\\{2,3\\}[a-z]\\{2\\}$", 0);
25 |
26 | FILE* file = fopen(argv[1], "r");
27 | int num_passports = count_blank_lines(file) + 1;
28 | int num_valid_1 = 0;
29 | int num_valid_2 = 0;
30 | for (int i = 0; i < num_passports; i++) {
31 | int invalid_part2 = 0;
32 | int field_count = 0;
33 | while (!skip_newline(file)) {
34 | char key[4];
35 | char value[10];
36 | fscanf(file, "%3s:%s", key, value);
37 | if (strstr(key, "yr")) {
38 | int year = atoi(value);
39 |
40 | if (year != 0) {
41 | char year_type = key[0];
42 | int valid = 0;
43 | switch (year_type) {
44 | case 'b':
45 | valid = year >= 1920 && year <= 2002;
46 | break;
47 | case 'i':
48 | valid = year >= 2010 && year <= 2020;
49 | break;
50 | case 'e':
51 | valid = year >= 2020 && year <= 2030;
52 | break;
53 | default:
54 | break;
55 | }
56 | if (!valid) {
57 | invalid_part2 = 1;
58 | }
59 | } else {
60 | invalid_part2 = 1;
61 | }
62 | } else if (strcmp(key, "hgt") == 0) {
63 | if (regexec(&hgt_regex, value, 0, NULL, 0) == 0) {
64 | int num;
65 | char unit[3];
66 | sscanf(value, "%d%s", &num, unit);
67 | int valid = 0;
68 | if (strcmp(unit, "cm") == 0) {
69 | valid = num >= 150 && num <= 193;
70 | } else if (strcmp(unit, "in") == 0) {
71 | valid = num >= 59 && num <= 76;
72 | }
73 |
74 | if (!valid) {
75 | invalid_part2 = 1;
76 | }
77 | } else {
78 | invalid_part2 = 1;
79 | }
80 |
81 | } else if (strcmp(key, "hcl") == 0) {
82 | if (regexec(&hcl_regex, value, 0, NULL, 0) != 0) {
83 | invalid_part2 = 1;
84 | }
85 | } else if (strcmp(key, "ecl") == 0) {
86 | if (strcmp(value, "amb") && strcmp(value, "blu") && strcmp(value, "brn")
87 | && strcmp(value, "gry") && strcmp(value, "grn") && strcmp(value, "hzl") && strcmp(value, "oth")) {
88 | invalid_part2 = 1;
89 | }
90 | } else if (strcmp(key, "pid") == 0) {
91 | if (regexec(&pid_regex, value, 0, NULL, 0) != 0) {
92 | invalid_part2 = 1;
93 | }
94 | }
95 |
96 | if (strcmp(key, "cid") != 0) {
97 | field_count++;
98 | }
99 | fgetc(file);
100 | }
101 |
102 | if (field_count == 7) {
103 | num_valid_1++;
104 | }
105 |
106 | if (field_count == 7 && !invalid_part2) {
107 | num_valid_2++;
108 | }
109 | }
110 |
111 | printf("Valid passports (part 1): %d\n", num_valid_1);
112 | printf("Valid passports (part 2): %d\n", num_valid_2);
113 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # adventofcode-20
2 |
3 | Ein Sammel-Repository für [Advent of Code](https://adventofcode.com) 2020-Lösungen der deutschen [DevCord](http://join.devcord.xyz)-Community.
4 |
5 | A repository collecting [Advent of Code](https://adventofcode.com) 2020 solutions made by the German [DevCord](http://join.devcord.xyz) community.
6 |
7 | ## Überblick/Overview
8 |
9 | Hier ist ein Überblick über die Vollständigkeit sowie die existierenden Lösungen und verwendeten Sprachen in diesem Repository:
10 |
11 | Here's an overview of the completeness as well as the existing solutions and languages used in this repository:
12 |
13 | | Day/Lang | Python | TypeScript | C | Kotlin | Java | Clojure |
14 | | -------- | ------ | ---------- | --- | ------ | ---- | ------- |
15 | | 01 | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ |
16 | | 02 | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ |
17 | | 03 | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ |
18 | | 04 | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ |
19 | | 05 | ✅ | (✅) | ✅ | ✅ | ✅ | ❌ |
20 | | 06 | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ |
21 | | 07 | ✅ | ✅ | ❌ | ✅ | ❌ | ✅ |
22 | | 08 | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ |
23 | | 09 | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ |
24 | | 10 | ❌ | ❌ | ✅ | ✅ | ❌ | ❌ |
25 | | 11 | ❌ | ❌ | ✅ | ✅ | ❌ | ❌ |
26 | | 12 | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
27 | | 13 | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
28 | | 14 | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
29 | | 15 | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
30 |
31 |
32 |
33 | ❌ = Keine Lösung/No solution,
34 | ✅ = Voll gelöst/Fully solved,
35 | (✅) = Erster Teil gelöst/First part solved
36 |
37 | ## Ordnerstruktur/Directory Structure
38 |
39 | Die Struktur dieses Repositorys ist wie folgt:
40 |
41 | The structure of this repository is as follows:
42 |
43 | - shared (1)
44 | - `user`
45 | - \*
46 | - Day-`XX` (2)
47 | - `lang` (3)
48 | - `user` (4)
49 |
50 | (1) Der *shared*-Order ist für zusätzliche Dateien, die neben der Lösungsdatei benötigt werden, etwa Hilfscode oder Bibliotheken. Jede\*r Beitragende darf dort einen eigenen, entsprechend benannten Ordner erstellen, über den frei verfügt werden darf.
51 |
52 | (2) Jeder neue Tag bekommt einen eigenen Ordner, der nach dem Schema *Day-`XX`* benannt ist, wobei `XX` die zwei Ziffern des Tages darstellen. Also z.B. steht *Day-01* für Tag 1 und *Day-15* für Tag 15.
53 |
54 | (3) Jeder Tag hat je einen Unterordner für die Programmiersprachen, in denen er gelöst wurde. Dabei ist für den Namen des Ordners der kleingeschriebene Name der Sprache zu verwenden, also z.B. *java*, *go* oder *javascript*.
55 |
56 | (4) Es können mehrere Lösungen von unterschiedlichen Beitragenden in der gleichen Programmiersprache abgegeben werden. Deshalb sollte sich pro Lösung ein Ordner in dem entsprechenden Sprachen-Ordner befinden, der den Namen des\*der Beitragenden trägt und den Quellcode der Lösung (für beide Teilaufgaben, falls vorhanden) enthält. Der Name dieses Ordners sollte identisch mit dem Namen des dazu passenden Ordner in *shared* sein, falls einer existiert.
57 |
58 | ----------------
59 |
60 | (1) The *shared* directory can be used for additional files and resources contributors might need besides their solution file, such as helper code or libraries. Every contributor may create an own directory in *shared* that corresponds to their name.
61 |
62 | (2) Every day of the challenge gets an own directory named with the scheme of *Day-`XX`*, where `XX` stands for the two digits of the day. E.g. *Day-01* is for day 1 and *Day-15* is for day 15.
63 |
64 | (3) Every day gets one sub directory for each language it has been solved in. The name of those directories must be the name of the programming language in lower case, e.g. *java*, *go* or *javascript*.
65 |
66 | (4) There can be more than one solution in each language for each day by different contributors. For this reason, for each solution, there should be one directory in the corresponding language directory for the day named after the contributor who created it containing the source code of that solution. This should be the same name that is also used for the personal directory in *shared*, should one exist.
67 |
68 | ## Lösungen ausführen/Run the solutions
69 |
70 | TODO
71 |
72 | ## Anleitung zum Beitragen (only for DevCord members)
73 |
74 | Wenn du zu den Lösungen beitragen möchtest, hast du zwei Optionen: **Selbst mit git arbeiten und Pull Requests erstellen** oder **deine Lösungen der Verwaltung dieses Repositories auf Discord schicken**. Wir empfehlen ersteres, wenn du schon mal git benutzt hast und zweiteres, wenn du von diesem System nur Bahnhof verstehst.
75 |
76 | ### Pull Requests erstellen
77 |
78 | 1. Forke dieses Repository in deinen GitHub-Account (oben rechts auf "Fork" klicken)
79 | 2. Klone das Repository bei dir lokal
80 | 3. Füge deine Lösungen hinzu und bearbeite sie - **beachte dabei die [Ordnerstruktur](#ordnerstrukturdirectory-structure)**
81 | 4. Bearbeite **nicht** die README! Die Tabelle wird von uns ergänzt.
82 | 5. Mache eine Pull Request wann immer du
83 | - neue funktionierende Lösung(en) hast
84 | - Lust drauf hast (du musst nicht jeden Tag eine Pull Request machen, kannst dir auch Zeit damit lassen)
85 |
86 | ### Lösungen an die Verwaltung geben
87 |
88 | 1. Löse die Aufgabe(n)
89 | 2. Schicke sie an einen der folgenden DevCord-User mit Informationen zu Sprache, Tag, evtl. benötigten zusätzlichen Dateien und Namen:
90 | - `das_#9677`
91 | - `Johnny#3826`
92 |
--------------------------------------------------------------------------------
/shared/WeiiswurstDev/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | /* Visit https://aka.ms/tsconfig.json to read more about this file */
4 | "watch": true,
5 | /* Basic Options */
6 | // "incremental": true, /* Enable incremental compilation */
7 | "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
8 | "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
9 | // "lib": [], /* Specify library files to be included in the compilation. */
10 | // "allowJs": true, /* Allow javascript files to be compiled. */
11 | // "checkJs": true, /* Report errors in .js files. */
12 | // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
13 | // "declaration": true, /* Generates corresponding '.d.ts' file. */
14 | // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
15 | // "sourceMap": true, /* Generates corresponding '.map' file. */
16 | // "outFile": "./", /* Concatenate and emit output to single file. */
17 | // "outDir": "./", /* Redirect output structure to the directory. */
18 | // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
19 | // "composite": true, /* Enable project compilation */
20 | // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
21 | // "removeComments": true, /* Do not emit comments to output. */
22 | // "noEmit": true, /* Do not emit outputs. */
23 | // "importHelpers": true, /* Import emit helpers from 'tslib'. */
24 | "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
25 | // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
26 |
27 | /* Strict Type-Checking Options */
28 | "strict": true, /* Enable all strict type-checking options. */
29 | // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
30 | // "strictNullChecks": true, /* Enable strict null checks. */
31 | // "strictFunctionTypes": true, /* Enable strict checking of function types. */
32 | // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
33 | // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
34 | // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
35 | // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
36 |
37 | /* Additional Checks */
38 | // "noUnusedLocals": true, /* Report errors on unused locals. */
39 | // "noUnusedParameters": true, /* Report errors on unused parameters. */
40 | // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
41 | // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
42 |
43 | /* Module Resolution Options */
44 | // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
45 | // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
46 | // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
47 | // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
48 | // "typeRoots": [], /* List of folders to include type definitions from. */
49 | // "types": [], /* Type declaration files to be included in compilation. */
50 | // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
51 | "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
52 | // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
53 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
54 |
55 | /* Source Map Options */
56 | // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
57 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
58 | // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
59 | // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
60 |
61 | /* Experimental Options */
62 | // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
63 | // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
64 |
65 | /* Advanced Options */
66 | "skipLibCheck": true, /* Skip type checking of declaration files. */
67 | "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/shared/paul2708/input/day08.txt:
--------------------------------------------------------------------------------
1 | acc +37
2 | acc -4
3 | nop +405
4 | jmp +276
5 | acc +39
6 | acc +40
7 | acc -3
8 | jmp +231
9 | acc +44
10 | acc +12
11 | jmp +505
12 | acc +35
13 | jmp +282
14 | acc +23
15 | jmp +598
16 | nop +392
17 | acc +18
18 | acc +44
19 | acc +18
20 | jmp +297
21 | nop +460
22 | jmp +152
23 | nop +541
24 | acc +33
25 | jmp -11
26 | acc -5
27 | acc +9
28 | jmp +327
29 | acc +30
30 | acc -1
31 | acc -3
32 | jmp +50
33 | acc +22
34 | acc +18
35 | acc +33
36 | acc +37
37 | jmp +57
38 | acc -17
39 | acc -6
40 | acc -2
41 | jmp +535
42 | acc -15
43 | jmp +279
44 | acc +34
45 | acc +44
46 | acc +41
47 | jmp +349
48 | acc +2
49 | acc +6
50 | nop +351
51 | nop +252
52 | jmp +505
53 | jmp +1
54 | jmp +1
55 | nop +61
56 | jmp +524
57 | nop +351
58 | jmp +399
59 | acc +1
60 | nop +397
61 | acc +39
62 | nop +141
63 | jmp +134
64 | acc +46
65 | acc +14
66 | acc +26
67 | jmp +236
68 | acc +7
69 | acc -6
70 | acc +35
71 | jmp +397
72 | acc +15
73 | jmp +140
74 | acc +3
75 | acc -4
76 | acc +37
77 | acc +12
78 | jmp +86
79 | jmp +416
80 | jmp +1
81 | jmp +55
82 | acc -19
83 | jmp +536
84 | jmp +1
85 | acc -11
86 | acc +15
87 | jmp -61
88 | acc +25
89 | jmp -25
90 | acc +50
91 | acc +43
92 | jmp +1
93 | jmp +140
94 | acc +46
95 | nop -53
96 | acc +1
97 | nop +440
98 | jmp +488
99 | jmp +396
100 | nop +443
101 | acc +41
102 | jmp +168
103 | acc +25
104 | nop +383
105 | acc +12
106 | acc -19
107 | jmp +21
108 | acc +29
109 | acc +30
110 | jmp +497
111 | jmp +502
112 | jmp +417
113 | nop +351
114 | acc -15
115 | jmp +243
116 | acc +21
117 | acc +16
118 | jmp +332
119 | acc +28
120 | acc +22
121 | acc +38
122 | jmp +476
123 | acc +8
124 | acc -11
125 | jmp +458
126 | acc +9
127 | jmp +246
128 | acc +40
129 | acc +31
130 | acc +26
131 | jmp +218
132 | acc +27
133 | acc +9
134 | nop +347
135 | jmp +478
136 | nop +28
137 | nop +106
138 | acc +25
139 | acc -15
140 | jmp +397
141 | acc +31
142 | jmp +231
143 | acc -4
144 | nop +136
145 | acc +14
146 | jmp +181
147 | jmp +361
148 | acc +16
149 | acc +11
150 | jmp -108
151 | nop +299
152 | acc +21
153 | acc -2
154 | jmp -106
155 | jmp +246
156 | acc +31
157 | jmp +407
158 | jmp +377
159 | acc +43
160 | acc -12
161 | nop +142
162 | acc +8
163 | jmp -91
164 | jmp +1
165 | acc +34
166 | acc +5
167 | acc +31
168 | jmp +12
169 | acc +34
170 | acc +7
171 | acc +34
172 | acc +20
173 | jmp -45
174 | acc -11
175 | acc +41
176 | acc +10
177 | jmp +310
178 | nop -106
179 | jmp -36
180 | acc +23
181 | acc +46
182 | acc +46
183 | jmp +112
184 | acc +41
185 | nop +179
186 | acc +17
187 | nop +356
188 | jmp +147
189 | acc +42
190 | nop +49
191 | jmp +119
192 | acc +0
193 | acc +7
194 | acc -18
195 | acc -8
196 | jmp +11
197 | acc +12
198 | acc +38
199 | acc +39
200 | jmp +281
201 | nop +186
202 | jmp +162
203 | acc +44
204 | acc +20
205 | jmp +153
206 | jmp +395
207 | acc +49
208 | jmp +1
209 | acc +2
210 | jmp +1
211 | jmp -31
212 | jmp +301
213 | nop +97
214 | jmp -102
215 | jmp +262
216 | acc +28
217 | acc -15
218 | acc +44
219 | acc -13
220 | jmp +191
221 | jmp +281
222 | acc +36
223 | acc +1
224 | nop +15
225 | jmp +211
226 | acc +6
227 | acc -4
228 | jmp +42
229 | acc +34
230 | acc +0
231 | jmp +104
232 | jmp +311
233 | jmp +84
234 | acc +43
235 | acc -8
236 | acc -10
237 | acc +38
238 | jmp -90
239 | acc +49
240 | jmp +303
241 | nop +132
242 | jmp +301
243 | nop +60
244 | acc +37
245 | nop +96
246 | jmp +182
247 | acc +16
248 | acc +18
249 | nop +152
250 | acc +19
251 | jmp +325
252 | jmp -63
253 | acc +28
254 | jmp +56
255 | acc +18
256 | acc +29
257 | acc +33
258 | jmp -115
259 | acc +47
260 | acc +19
261 | jmp +1
262 | nop +41
263 | jmp +1
264 | jmp -207
265 | nop -62
266 | acc -9
267 | acc +42
268 | acc -12
269 | jmp -56
270 | acc +28
271 | jmp -163
272 | acc +25
273 | acc +17
274 | jmp -217
275 | acc +7
276 | jmp +272
277 | acc +43
278 | acc +22
279 | jmp +70
280 | acc -17
281 | jmp -117
282 | acc +24
283 | acc +26
284 | nop -275
285 | jmp -46
286 | nop +87
287 | acc +19
288 | acc +28
289 | jmp -34
290 | acc +4
291 | acc +9
292 | acc +6
293 | jmp +1
294 | jmp +28
295 | acc -6
296 | nop -67
297 | acc -10
298 | jmp +271
299 | acc +40
300 | acc +25
301 | acc -4
302 | jmp -63
303 | acc +46
304 | jmp +78
305 | acc +41
306 | nop -126
307 | nop +70
308 | jmp +1
309 | jmp +172
310 | nop +270
311 | jmp +30
312 | jmp +1
313 | acc +38
314 | nop +68
315 | acc +29
316 | jmp +253
317 | acc -18
318 | jmp -89
319 | acc +18
320 | acc +30
321 | jmp +147
322 | acc +24
323 | acc +11
324 | acc +50
325 | jmp -225
326 | jmp -210
327 | acc -18
328 | acc +1
329 | acc +38
330 | jmp +1
331 | jmp -79
332 | acc +45
333 | acc +12
334 | jmp +209
335 | jmp -207
336 | acc +32
337 | acc +4
338 | acc +32
339 | acc +14
340 | jmp +83
341 | acc +13
342 | acc +1
343 | acc +46
344 | acc +38
345 | jmp +28
346 | nop +153
347 | acc -17
348 | jmp -73
349 | acc +11
350 | jmp +248
351 | acc +29
352 | acc +45
353 | acc +16
354 | jmp +96
355 | jmp -273
356 | acc +34
357 | jmp +87
358 | nop +99
359 | acc -3
360 | jmp -74
361 | acc +12
362 | nop -119
363 | jmp -141
364 | acc -18
365 | nop -79
366 | acc +1
367 | acc +6
368 | jmp +9
369 | acc +3
370 | acc +44
371 | acc +39
372 | jmp -165
373 | acc +6
374 | jmp +44
375 | acc +25
376 | jmp -133
377 | acc +0
378 | jmp +14
379 | jmp +1
380 | acc +1
381 | jmp -223
382 | jmp +71
383 | nop -1
384 | acc +22
385 | acc +11
386 | jmp -274
387 | jmp -330
388 | acc +45
389 | jmp +1
390 | acc +15
391 | jmp -158
392 | jmp -128
393 | acc +50
394 | acc +26
395 | jmp -73
396 | nop +99
397 | jmp +71
398 | acc +35
399 | acc +7
400 | jmp +192
401 | acc +13
402 | jmp +190
403 | acc +4
404 | acc -1
405 | acc +40
406 | acc -15
407 | jmp +50
408 | acc +29
409 | jmp -337
410 | jmp -75
411 | acc +41
412 | jmp +1
413 | jmp -387
414 | acc +28
415 | acc +18
416 | acc +19
417 | jmp -62
418 | nop -196
419 | jmp -410
420 | jmp +1
421 | acc -17
422 | jmp -267
423 | acc +22
424 | jmp -301
425 | nop -98
426 | acc -15
427 | jmp -124
428 | acc +45
429 | acc -18
430 | acc +15
431 | acc +42
432 | jmp -296
433 | nop -10
434 | acc +29
435 | jmp -371
436 | acc +3
437 | jmp +1
438 | nop +61
439 | acc +5
440 | jmp -361
441 | acc -5
442 | nop -326
443 | jmp -379
444 | acc -10
445 | jmp +1
446 | acc +44
447 | jmp -231
448 | acc +3
449 | jmp -94
450 | acc +1
451 | jmp +113
452 | jmp -336
453 | acc +4
454 | jmp -299
455 | acc -13
456 | jmp +1
457 | acc +13
458 | jmp +143
459 | acc -11
460 | acc -19
461 | acc +18
462 | nop -390
463 | jmp -27
464 | acc +42
465 | jmp -232
466 | acc +15
467 | jmp -228
468 | acc +21
469 | acc +39
470 | acc +47
471 | acc +6
472 | jmp +57
473 | acc +28
474 | acc +27
475 | acc +50
476 | jmp -397
477 | acc +12
478 | jmp -445
479 | acc +30
480 | jmp -352
481 | acc -4
482 | acc +26
483 | acc +48
484 | jmp +1
485 | jmp -205
486 | jmp +22
487 | nop -284
488 | acc -1
489 | nop -361
490 | acc +0
491 | jmp -368
492 | acc -17
493 | nop -223
494 | jmp -41
495 | acc +4
496 | acc +46
497 | jmp +79
498 | jmp -370
499 | jmp -260
500 | acc +42
501 | jmp -14
502 | acc +30
503 | acc +50
504 | acc +13
505 | jmp -61
506 | acc +46
507 | jmp -63
508 | nop -55
509 | nop -320
510 | jmp -11
511 | acc +10
512 | jmp -424
513 | jmp -11
514 | acc +3
515 | jmp -71
516 | acc +42
517 | acc -13
518 | jmp +4
519 | nop -155
520 | nop -138
521 | jmp +62
522 | acc +11
523 | acc +19
524 | acc +15
525 | acc +17
526 | jmp -73
527 | acc -11
528 | jmp -273
529 | acc +8
530 | acc +6
531 | acc -7
532 | acc +41
533 | jmp -311
534 | jmp -111
535 | jmp -260
536 | jmp +50
537 | jmp -60
538 | jmp +1
539 | nop -89
540 | acc +36
541 | acc +14
542 | jmp -220
543 | nop -415
544 | acc +28
545 | jmp -402
546 | acc +41
547 | jmp -165
548 | acc +9
549 | acc -13
550 | acc -18
551 | acc +18
552 | jmp -504
553 | acc -9
554 | acc +29
555 | acc +44
556 | jmp -444
557 | acc +5
558 | acc +47
559 | jmp -545
560 | acc +23
561 | acc +7
562 | nop -240
563 | jmp -320
564 | jmp -141
565 | jmp +1
566 | acc +28
567 | nop -287
568 | jmp -118
569 | acc +44
570 | acc -7
571 | jmp -550
572 | acc +10
573 | acc +20
574 | acc -3
575 | jmp -401
576 | acc +45
577 | acc +36
578 | jmp -375
579 | jmp -485
580 | acc +9
581 | jmp -338
582 | jmp -510
583 | jmp -196
584 | acc -16
585 | jmp -372
586 | acc +0
587 | jmp -380
588 | acc -3
589 | nop -473
590 | nop -361
591 | jmp -311
592 | acc +0
593 | nop +20
594 | jmp -436
595 | acc +9
596 | jmp +1
597 | jmp -215
598 | acc +19
599 | jmp -451
600 | jmp -43
601 | acc -13
602 | acc -10
603 | acc -5
604 | jmp -208
605 | acc -11
606 | jmp -156
607 | acc +11
608 | acc -2
609 | nop -357
610 | jmp -73
611 | acc +21
612 | jmp -159
613 | acc +28
614 | acc -16
615 | acc +12
616 | acc +1
617 | jmp -282
618 | jmp -131
619 | acc -11
620 | acc +45
621 | acc +0
622 | acc +28
623 | jmp +1
--------------------------------------------------------------------------------
/shared/JohnnyJayJay/inputs/Day-08.txt:
--------------------------------------------------------------------------------
1 | nop +116
2 | acc +12
3 | acc -8
4 | acc +34
5 | jmp +485
6 | acc +42
7 | jmp +388
8 | acc +36
9 | nop +605
10 | acc +17
11 | jmp +411
12 | acc +49
13 | jmp +1
14 | acc -9
15 | jmp +289
16 | jmp +288
17 | jmp +74
18 | acc +4
19 | acc +42
20 | jmp +258
21 | acc +14
22 | acc -13
23 | nop +106
24 | jmp +280
25 | jmp +534
26 | acc +41
27 | acc +40
28 | jmp +224
29 | acc +43
30 | acc +10
31 | nop +240
32 | jmp +211
33 | acc +7
34 | acc -3
35 | acc +7
36 | jmp +1
37 | jmp +559
38 | jmp +415
39 | jmp +528
40 | acc -16
41 | jmp +568
42 | jmp +442
43 | nop +113
44 | jmp +464
45 | acc +42
46 | jmp +336
47 | acc -2
48 | acc +39
49 | jmp +251
50 | acc -4
51 | acc +42
52 | jmp +528
53 | acc +5
54 | acc +30
55 | nop +429
56 | acc +49
57 | jmp +86
58 | acc +15
59 | nop +145
60 | acc -8
61 | jmp +1
62 | jmp +404
63 | acc +26
64 | acc +50
65 | jmp +251
66 | acc +47
67 | jmp +1
68 | acc +45
69 | acc -5
70 | jmp +357
71 | acc +31
72 | jmp +62
73 | acc +25
74 | nop +540
75 | acc -13
76 | acc +0
77 | jmp +72
78 | acc +28
79 | acc +36
80 | nop +475
81 | acc -17
82 | jmp +166
83 | acc +4
84 | acc +20
85 | acc +30
86 | acc +43
87 | jmp +464
88 | acc +4
89 | jmp +94
90 | jmp +44
91 | nop +446
92 | acc -16
93 | nop +267
94 | acc +30
95 | jmp +519
96 | acc +45
97 | acc +47
98 | jmp +62
99 | acc +28
100 | acc -13
101 | acc +45
102 | jmp +239
103 | acc +12
104 | jmp +1
105 | nop +153
106 | jmp +245
107 | jmp +244
108 | acc -12
109 | jmp +308
110 | jmp +190
111 | jmp -86
112 | acc +45
113 | acc +1
114 | acc +15
115 | acc +30
116 | jmp +350
117 | acc +30
118 | jmp +42
119 | jmp +214
120 | jmp +447
121 | acc +24
122 | jmp +453
123 | acc +29
124 | acc +42
125 | jmp +302
126 | acc -4
127 | acc +33
128 | jmp +447
129 | acc -18
130 | acc +15
131 | acc -2
132 | jmp -24
133 | jmp -4
134 | jmp +35
135 | acc +0
136 | jmp -83
137 | acc -13
138 | nop +437
139 | acc -15
140 | jmp +95
141 | nop +289
142 | jmp +348
143 | acc +17
144 | acc +23
145 | acc +45
146 | jmp +359
147 | acc +18
148 | jmp +352
149 | acc +0
150 | acc +13
151 | acc +25
152 | acc +11
153 | jmp +331
154 | acc -2
155 | jmp +19
156 | jmp -103
157 | acc +34
158 | acc +48
159 | jmp +141
160 | acc +44
161 | jmp +1
162 | acc +42
163 | jmp +374
164 | acc +45
165 | acc +35
166 | nop -37
167 | acc -2
168 | jmp +244
169 | jmp +151
170 | acc +36
171 | acc +4
172 | nop -64
173 | jmp +231
174 | nop +321
175 | nop +291
176 | acc +16
177 | jmp -161
178 | acc +17
179 | nop +412
180 | nop -89
181 | nop +179
182 | jmp -8
183 | nop -167
184 | acc +44
185 | acc +4
186 | jmp +42
187 | acc +22
188 | acc +28
189 | acc +22
190 | jmp +192
191 | acc -18
192 | acc -7
193 | jmp -70
194 | acc +27
195 | acc +25
196 | jmp +312
197 | acc +50
198 | acc -16
199 | jmp -121
200 | acc +14
201 | acc +43
202 | nop -111
203 | jmp -54
204 | nop +39
205 | acc -4
206 | acc +41
207 | jmp +236
208 | acc -11
209 | jmp -118
210 | jmp +150
211 | acc -15
212 | jmp -141
213 | acc +14
214 | jmp +1
215 | acc -8
216 | jmp -96
217 | acc +11
218 | nop -95
219 | jmp +1
220 | acc +47
221 | jmp -113
222 | nop +257
223 | jmp +35
224 | acc +45
225 | acc +25
226 | acc -6
227 | jmp +31
228 | jmp +1
229 | nop +153
230 | nop -39
231 | jmp +25
232 | acc +0
233 | acc +50
234 | jmp +362
235 | acc -15
236 | acc +0
237 | acc +31
238 | acc +22
239 | jmp +69
240 | acc -18
241 | acc +24
242 | jmp -38
243 | acc +39
244 | acc -10
245 | acc +40
246 | jmp +6
247 | jmp +143
248 | jmp -44
249 | acc +32
250 | acc -8
251 | jmp +358
252 | jmp +248
253 | nop +343
254 | nop -11
255 | jmp +116
256 | jmp +74
257 | jmp +120
258 | acc +37
259 | acc -19
260 | acc +36
261 | jmp +341
262 | acc +49
263 | jmp -164
264 | acc +14
265 | acc +13
266 | acc +0
267 | acc +50
268 | jmp +291
269 | jmp +1
270 | jmp -79
271 | acc +19
272 | jmp +243
273 | acc +25
274 | acc -13
275 | acc -12
276 | acc -7
277 | jmp +228
278 | jmp -81
279 | acc +18
280 | nop -163
281 | acc +0
282 | acc +8
283 | jmp +212
284 | acc +38
285 | acc -12
286 | jmp +6
287 | acc +24
288 | acc +42
289 | acc +21
290 | acc +12
291 | jmp +136
292 | acc -12
293 | acc -2
294 | acc +46
295 | acc +35
296 | jmp +290
297 | acc +6
298 | acc +36
299 | jmp -182
300 | acc +14
301 | acc +7
302 | jmp +228
303 | jmp -19
304 | acc +48
305 | acc +25
306 | jmp +106
307 | jmp +70
308 | acc +24
309 | jmp +1
310 | acc +24
311 | acc +29
312 | jmp -156
313 | nop +296
314 | acc +34
315 | jmp +115
316 | acc -12
317 | acc +41
318 | jmp +28
319 | jmp +165
320 | acc +0
321 | acc +24
322 | acc +42
323 | acc +27
324 | jmp +106
325 | acc +24
326 | acc -11
327 | acc +4
328 | acc -6
329 | jmp -180
330 | acc -2
331 | jmp +2
332 | jmp -314
333 | acc -9
334 | acc +1
335 | jmp -327
336 | acc -8
337 | acc +7
338 | acc -6
339 | acc +32
340 | jmp -157
341 | acc +10
342 | acc +10
343 | acc -16
344 | jmp +278
345 | jmp +6
346 | acc +0
347 | nop +178
348 | acc +26
349 | jmp +231
350 | jmp +175
351 | acc +29
352 | acc +36
353 | acc +7
354 | jmp -255
355 | acc +46
356 | acc +45
357 | acc +7
358 | nop -7
359 | jmp -101
360 | jmp +3
361 | acc -13
362 | jmp -140
363 | nop -115
364 | jmp +1
365 | jmp -336
366 | acc +9
367 | acc +9
368 | nop -68
369 | acc -3
370 | jmp -37
371 | acc -13
372 | nop +128
373 | jmp +1
374 | jmp -90
375 | acc +49
376 | jmp -124
377 | acc +16
378 | acc +9
379 | jmp +212
380 | acc -18
381 | jmp -303
382 | acc +33
383 | acc +23
384 | acc +26
385 | jmp +140
386 | acc +25
387 | nop -123
388 | acc +22
389 | jmp +148
390 | acc +1
391 | acc +44
392 | jmp -352
393 | acc -11
394 | jmp +33
395 | acc +16
396 | nop -199
397 | acc +15
398 | jmp -351
399 | jmp +5
400 | jmp -357
401 | nop -284
402 | acc +32
403 | jmp -43
404 | acc +5
405 | acc +23
406 | acc +3
407 | jmp +59
408 | acc -10
409 | nop -266
410 | nop +43
411 | jmp +79
412 | acc +21
413 | jmp -42
414 | acc +35
415 | acc +5
416 | jmp +68
417 | acc +24
418 | acc -4
419 | jmp -155
420 | acc +45
421 | jmp +154
422 | jmp -311
423 | acc +10
424 | acc +17
425 | acc +39
426 | jmp -297
427 | jmp -175
428 | acc +49
429 | jmp -151
430 | acc -4
431 | acc -9
432 | jmp -219
433 | acc +48
434 | acc -17
435 | acc +30
436 | jmp -9
437 | acc +10
438 | jmp -61
439 | nop -396
440 | acc +11
441 | acc +37
442 | jmp -331
443 | acc +14
444 | acc +22
445 | acc +30
446 | acc +2
447 | jmp -43
448 | nop -265
449 | acc +5
450 | acc +40
451 | acc -15
452 | jmp -35
453 | acc -3
454 | acc +24
455 | jmp -415
456 | acc +0
457 | jmp +98
458 | acc +17
459 | acc +25
460 | nop -48
461 | acc -17
462 | jmp -302
463 | acc +11
464 | acc +11
465 | jmp -181
466 | acc +46
467 | acc +19
468 | jmp -331
469 | nop +90
470 | acc +45
471 | acc +8
472 | jmp -237
473 | acc -11
474 | nop -421
475 | jmp -145
476 | acc -16
477 | acc +47
478 | jmp -387
479 | acc +50
480 | jmp -375
481 | acc +38
482 | jmp +1
483 | jmp -225
484 | acc +47
485 | acc +39
486 | jmp +69
487 | acc +46
488 | acc +41
489 | jmp -89
490 | acc +19
491 | jmp -453
492 | nop +63
493 | acc +18
494 | jmp -386
495 | nop -243
496 | acc +48
497 | jmp +70
498 | acc +25
499 | jmp -191
500 | acc +48
501 | acc +31
502 | jmp +40
503 | acc -10
504 | jmp -46
505 | acc +45
506 | jmp -48
507 | jmp -12
508 | acc +16
509 | acc -16
510 | jmp -120
511 | acc -10
512 | jmp +1
513 | acc -10
514 | jmp -124
515 | acc +48
516 | acc +15
517 | acc +8
518 | acc -15
519 | jmp -66
520 | nop -130
521 | acc +16
522 | acc +10
523 | acc +31
524 | jmp -375
525 | acc +9
526 | acc +20
527 | jmp -37
528 | acc +14
529 | jmp -134
530 | acc -9
531 | acc -6
532 | jmp -120
533 | acc +24
534 | acc +17
535 | acc +49
536 | jmp -332
537 | acc +7
538 | acc +35
539 | nop -149
540 | jmp -103
541 | jmp -277
542 | acc -1
543 | acc +28
544 | nop -211
545 | jmp -371
546 | nop -129
547 | acc -15
548 | acc +6
549 | acc +19
550 | jmp -120
551 | acc -6
552 | jmp -79
553 | acc +0
554 | jmp -64
555 | acc +33
556 | acc +33
557 | jmp -440
558 | jmp -85
559 | acc +37
560 | nop -183
561 | acc +24
562 | acc +42
563 | jmp -545
564 | acc +50
565 | acc +6
566 | jmp -7
567 | nop +8
568 | acc +1
569 | jmp -359
570 | acc -1
571 | nop -388
572 | acc -7
573 | acc +28
574 | jmp -211
575 | jmp -384
576 | acc +32
577 | acc +16
578 | acc +40
579 | jmp +17
580 | acc +0
581 | acc +43
582 | acc -14
583 | jmp -512
584 | nop -264
585 | jmp -474
586 | nop -543
587 | acc +17
588 | nop -288
589 | jmp -38
590 | jmp +24
591 | acc -4
592 | jmp -321
593 | acc +49
594 | acc -16
595 | jmp -532
596 | acc +0
597 | acc -11
598 | acc -16
599 | jmp -104
600 | acc -12
601 | jmp -301
602 | acc +6
603 | nop -498
604 | acc +0
605 | jmp -126
606 | nop -127
607 | acc +1
608 | jmp -6
609 | acc +40
610 | jmp -547
611 | acc +16
612 | acc +18
613 | jmp -123
614 | acc -5
615 | acc +27
616 | acc +44
617 | acc +15
618 | jmp -22
619 | acc +48
620 | acc -18
621 | jmp -350
622 | acc -7
623 | acc +30
624 | acc +26
625 | jmp +1
626 | jmp +1
627 |
--------------------------------------------------------------------------------
/shared/JohnnyJayJay/inputs/Day-11.txt:
--------------------------------------------------------------------------------
1 | LLLLLLL.LLLLLLLLLLLL.LL.L.LLLLLLLLLLLLLLLLLL.LLLLL.LLLLLLL.LLLLLLLLL.LLLL.LLLLL.LLLLLLLLLLLLL
2 | LLLLLLL.LLLLLLLLLLLL.LLL..LLLLLLLLLLLLLLLLLLLLLLL..LLLL.LLLLLLLLLLLLLLLLLLLLLLL.LLLLLLL.LLLLL
3 | LLLLLLLLLLLLLL.LLLLLLLLLL.LLLLLLLL.LLLLLLLLL.LLLLL.LLLLLLL.LLLLLLLLL.LLLL.LLLLLLLLLLLLLLLLLLL
4 | LLLLLLLLLLLLLL.LLLLL.LLLLLLLLLLLLLLLLLL.LLLL.LLLLLLLLLLL.LLLLLLLLLLLLLLLL.LLLLL.LLLLLLLL.LLLL
5 | LLLLLLL.LLLLLL.LLLLL.LLLLLLLLLLLLLLLLLLLLLLL.LLLLL.LLLLLLL.LLLLLLLLLLLLLL.LLLLL.LLLLLLL.LLLLL
6 | LLLLLLL.LLLLLL.L.LLLLLLLL.L.LLLLLL.LLLLLL.LL.LLLLL.LLLLLLLLLLLLLLLLL.LLLL.LLLLL.LLLLLLLLLLLLL
7 | .L.....L...L.....LL..L...LLL.L.LL..LLL..LL.LLL...LLLL..L......L..........L...L..LL..LLL.L...L
8 | LLLLLLLLLLLLLLLLLLLL.LLLLLLLLLLLLLLLLLLL.LLLLLLLLL.LLLLLLL.LLLLLLLLL.LLLL.LLLLL.LLLLLLL.LLLLL
9 | LLLLLLL.LLLLLL.LLLLL.L.LLLLLLLLLLL.LLLLLLLLL.LLLLLLLLLLLLL.LLLLLLLLL.LLLLLLL.LL.LLLLLLLLLLLLL
10 | LLLL.LL.LLLLLL.LLLL.LLLLL.LLLLL.LLLLLLLLLLLL.LLLLLLLLLLLLL.LLLLLLLLL.LL.LLLLL.LLLLLLLLL.LLLL.
11 | LLLLLLL.LLLLLL.LLLLL..LLL.LLLLLL.L.LLLLLLLLL.LLLL..LLLLLLL.L.L.LLLLL.LLLLLLLLLL.LLLLLLLLLLLLL
12 | LLL.LLL.LLLLLLLLLL.L.LLLL..LLLLLLLLLL.LL.LL.LLLLLL.LLLLL.LLLLLLLLLLL.LLLL.LLLLL.LLLLLLL.LLLLL
13 | LLLLLLL.LLLLLLLLLLLLLLLLLLLLLLL.LLLLLLLLLL.L.LLLLL.LLLLLLL.LL.LLLLLLLLLLL.LLLLL.LLLLLLLLLLLL.
14 | LLLLLLL.LLLLLLLLLLLLLLLLL.LLLLLLLLLLLLLLLLLL.LLLLL.LLLLLLLLLLLLLLLLLLLLLL.LLLLL.LLLLLLL.LLLLL
15 | L...L..LLL.....L.LL..L.LLLL....LLLL.....L.L.LLL..L.L...LL.LL....L..LLLL..L..L.LL...L.L.....L.
16 | LLLLLLL.LLLLLLLLLLLLLLLLL.LLLLLLLL.LLLLLLLLL.LLL.L.LLLLLLLLLLLLLLLLL.LLLL.LLLLL.LLLLLLL.LLLLL
17 | LLLLLLL.LLLLLL.LLLLL.LLLL.LLLLLLLL.LLLLLLLLL.LLLLLLLLLLLLLLLLLLL.LLL.LLLLLLL.LLLLLLLLLL.LLLLL
18 | LLLLLLL.LLLLLLLLLLLL.LLLL.LLLL.LLL.LLLLLLLLLLLLLLLLLLL.LLLLLLLLLLLLL.L.LL.LLLLL.LLLLLLLLLLLLL
19 | LLLLLLL..LLLLLLLLLLL.LLLLLLLLLLLLL.LLLLLLLLLLLLLLL.LLLLLLL.LLLLLLLLLLLLLL.LLLLL.LLLLLLLLLLLLL
20 | .........LL..LL..LL..LL.....L..L..LL.............L...L....LLLL...LL...LLL..L...LLL.....L....L
21 | LLLLLLLLLLLLLLLLLLLL.LLLLLLLLLLLLLLLLLLLLLLL.LLLLLLLLLLLLLLLLLLLLLLL.LLLL.LLLLL..LLLLLL.L.LLL
22 | LLLLLLLLLLLLLL.LLLLLLLLLL.LLLLLLLL.LLLLLLLLLLLLLLL.LLLLLLL.LLLLLLLLLLLLLLLLLLLL.LLLLLLLLLLLLL
23 | LLLLLLL.LL.LLL.LLLLL.LLLL.LLLLLLLL.LLLLLLLLLLLLLLL.LLLLLLL.LLLLLLLLL.LLLLLLLLL.LLL.LLLLLLLLLL
24 | LLLLLLL.LLLLLLLLLLL.LLLLLLLLLLLLLL.LLLLLLLLL.LLLLLLLLLLLLL.LLLLLLLLL.LLLL.LL.LL..LLLLLLLLLLLL
25 | LLLLLLL.LLLLLLLLLLLL.LLLL.LLLLLLLLLL.LLLLLLL.LLLLL.LLLLLLL.LLLLLLLLL.LLLL.LLLLL.LLLLLLL.LLLLL
26 | LLLLLLLLLLL.L.LLLLLL.LLLLLLLLLLLLLLLLLLLLLLL.LLLLLLLLLLLLL.LLLLLLLLL.LLLLLLLLLLLLLLLLLLLLLLLL
27 | ...L.L..L.L.L....L....L.LLL.L.L.L..L..L...L....L......L.......L..L.L.L..L..LL...L....L....LL.
28 | LLLLLLL.LLLLLL.LLLLLLLLLLLLLLLLLLLLLLLLLLLLL.LLLLLLLLLLLLL.LLLLLLLLL.L.LL.LL.LL.LLLLLLLLLLLLL
29 | LLLLLLL.LLLLLL.LLLLL.LLLL.LLLLLLLL.LLLLLLL.L.LLLLL.LLLLLLL.LLLLLLLLL.LLLL.LLLLL.LLLLLLL.LLLLL
30 | LLLLLLLLLLLLLL.LLLLL.LLLL.LLLLLLLLLLLLLLLLLLLLLLLL.LLLLLLL.LLLLLLLLL..LLL..LLLL.LLLL.LL.LLLLL
31 | LLLLLLLLLLLLLLLLLLLL.LLLLLLL.LLLLL.LLLLLLLLL.LLLLL.L.LLLL.LLLLLLLLLLLLLLLLLLLLLLLLLLLLL.LLLLL
32 | LLLLLLLLLLLLLL.LLLLLLLLLL.LLLLLLLLLLLLLLLLLL.LLLLL.LLLLLLL.LLLLLLLLL.LLLL.LLLLLLLLLLLLL..LLLL
33 | LLLLLLL.LLLLLLLLLLLL.LLLLLLLLLLLLL.LLLLLLLLL.LL.LLLLLLLLLL.LLLLLLLLL.LLLLLLLLLL.LLLLLLL.LLLLL
34 | ..LLLLL...LL...L..L.....L.LL.L....L.L..LL.L......L.L.L..L...L.L..L..L..L.LL..L.L.L..L.....L..
35 | LLLLLLL.LLLLLL.LLL.L.LLLL.LLLLLLLLLLLLLLLLLL.LLLLL.LLLLLLLLLLLLLLLLLLLLLL.LLLLL.LLLLLLL.LLLLL
36 | LLLLLLL.LLL.LL.LLLLL.LLLL.LLLLLLLL.LLLLLL.LL.LLLL..LLLLLL.LLLLLLLLLL.LLLL..LLLL.LLLLLLL.LLLLL
37 | LLLLLLLLLLLLLL.LLLLL.LLLL.LLLLLLLL.LLLLLLLLL.LLLLL.LLLLLLL.LLLLLLLLL.LLLLLLLLLL.LLLLLLL.LLLLL
38 | .LLLLLL.LLLLLL.LLLLL.LLLLLLLLL.LLL.LLLLLLL.L.LLLLLLLLLLLLLLLL.LLLLLL.LLLL.LLLLL.LLLLLLL.LLLLL
39 | LLLLLLL.LLLLLL.LLLLLLLLLL.LLLLLLLL.LLLLLLLLL.LLLL.LLLLLLLL.LLLLLLLLL.LLLL.LLLLL.LLLLLLLLLLLLL
40 | LLLLLLL.LLL.LL.LLLLLLLLLL.LLLLLLLL.LLLLLLLLL.LLLLL.LLLL.LL.LL.LLLLLLLLLLLLLL.LL.LLLL.LL.LLLL.
41 | LLLLLLL.LLLLLL.LLLLLLLLLL.L..LLLLLLLLLLLLLLL.LLLLLLLLLLLL.LLLLLLLLLLLLLLL.LLLLL.LLLLLLL.LLLLL
42 | LL......LLL...L.LL...LL..LLLL.L..L.........L..L.....L..L......L..L...LLL.....LL.......LL.....
43 | LLLLLLL.LLLLLL.LLLLL.L.LL.LLLLLLLL.LLLL.LLLLL.L.LLLLLLLLLL.LLLLLLLLL.LLLLLLLLL..LLLLLLLLLLLLL
44 | LLLLLLL.L.LLLL.LLLLL.LLLLLLLLLL.LLLLLLLLLLLLLLLLLLLLLLLLLL.LLLLLLLLL.LLLL.LL.LL.LLLLLLLLLLLLL
45 | LLLLLLL.LLLLLL.LLLLLLLLLL..LLLLLLLLLLLLLLLLLLLLLLL.L.LLLLL.LLLLLLLLL.LLLLLLLLLLLLLLLLLLLLLLLL
46 | LLLLLLL.LLLL.LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL.LLLLL.LLLLLLL.LLLLLLLLL.LLLL.LLLLL.L.LLLLLLLLLLL
47 | LLLLLLL.LLLLLL.LLLLL.LLLL.LLL.LLLLLLLLLLLLLL.LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL.LLLLLLLLLLLLL
48 | LLLLLLL.LLLLLL.LLLLL.LLLL.LLLLLLLLL.LLLLLLLLLLLLLL.LLLLLLL.LLLLLLLLL.LLL.LLLLLLLLLLLLLLLLLLLL
49 | LLLLLLL.LLLLLL.LLL.L.LLLL.LLLLLLLL.LLLLLLLLL.LLLLLLLLLLLLL.LLLLLLLLL.LLLL.LLLLL.LLLLLLLLLLLLL
50 | L....L.L..L.L....L..L.L...L.....L..LL...L.L.L.L.LL..L....LL..LL....L.L.......LLL..LLL...LL..L
51 | LLLLLLLLLLLLLLLLLLLLLLLLL.LLLLLLLL.LLLLLLL.LLLLLLLLLLLLLL..LLLLLLLLL.LLLL..LLLL.LLLLLLLLLLLLL
52 | LLLLLLLLLLLLLL.LLLLL.LLLL.LLLLLLLLLLLLLLLLLL.LLLLL.LLLLLLL.LLLLLLLLLL.LLLLLLLLL.LLLLLLL.LLLLL
53 | LLLLLLL.LLLLL..LLLLL.LLLLLLLLLLLLL.LLLLLL.LL..LLLLLLLLLLLLLLLLLLLLLL.LLLL.LLLLL.LLLLLLLLL.LLL
54 | L.L.LLLLLLLLLL.LLLLL.LLLL.LLLLL.LL.LLLLLLLLL.LLLLL.LLLLLLL.LLLLL.LLL.LLLL.LLLLLLLLLLLLLLLLLLL
55 | LLLLLLL.LLLLLL.LLLLLLLLLL.LLLLLLLLLLLLLLLLLLLLLLLLL.LLLLLL.LLLLLLLLLLLLLL.LLLLL.LLLLLLL.LLLLL
56 | LLLLLLL.LLLLLLLLLLLL.LLLL.LLLLLLLL.LLLLLLLLL.LLLLL.LLLLLLL.LLLLLLLLL.LLLL.LLLLLLLLLLLLL.LLLLL
57 | LLLLLLLLLLLLLL.LLLLL.LLLL.LLLLLLLL.LLLLLLLLL.LLLLL.LLLLLLL.LLLLLLLLL.LLLL.LLLLL.LLLLLLL.LLLLL
58 | LLLLLLL.L.LLLLLLLLLL.LLLLL.LLLLLLLLLLLLLLLLL.LLLLL.LLLLLLL.LLLL.LLLL.LLLL.LLLLLLLLLLLLLLLLLL.
59 | LL.L.LLLLLLLLL.LLLLLLLLLL.LLLLLLLLLLLLLLLLLL.LLLLL.LLLLLLL.LLLLLLLLL.LLLL.LLLLLLLLLLLLL.LLLLL
60 | ...L..L..L..L....LLL..L.LL....L........L.......L.L.LL.L........L...LLLL....LL.......L.LL..L.L
61 | LLLLLLLLLLLLLL.LLLLLLLLLL.LLLLLLLLLLLLLLLLLL.LLLLLLLLLLLLL.LLLLLLLLLLLLLLLLLLLL.LLLLLLLLLLLLL
62 | LLLLLLL.LLLLLL.LL.LL.LLLLLLLLLL.LL.LLLLLLLLL.LLLLL.LLL..LLLLLLLLLLLL.LLLL..LL.L.LLLLLLL.LLLLL
63 | LLLLLLL.LLLLLLLLLLLL.LLLL.LLLLLLLL.LLLLLLL.L.LL.LL.LLLLLLL.LLLLLLLLLL.LLL.LLLLL.LLLLLLL.LLLLL
64 | LLLLLLLLLLL.LL.L.LLL.LLLL.LLLLLLL..LLLLLLLLL.LLLLLL.LLLLLLLLLLLLLLLL.LLLL..LLLLLLLLLLLL.LLLLL
65 | LLLLLLLLLLLLLLLLLLLL.LLLLLLLLLLLLLLLLLLLLLLLLLLLLL.LLLLLLL.LLLLLLLLLLLLLLLLLLLL.LLLLL.L.LLLLL
66 | LLLLLLL.LLLLLL.LLLLLLLLLL.LLLLLLLL.L.LLLLLLL.LLLLLLLLLLLLL.LLLLLLLLL.LLLL.LLLLL.LLLLLLLLLLLLL
67 | LLLLLLLLLLLLLL.LLLLL.LLLL.LLLLLLLL.LLLLLLLLLLLLLLL.LLLLLLLLLLLLLLLLL.LLLL.L.LLL.LLLLLLL..LLLL
68 | LLLLLLL.LLLLLL.LLLLL.LLLL.LLLLLLLLLLLLLLLLLLLLLLLL.LLLLLLL.LLLLLLLLL.L.LL.L.LLL.LLLLLLL.LLLL.
69 | ....LLLL.L..L....LL..L.....LL..........LL.....L.L..LL.LL......L.L.L.L....L.LL.L.L..L......L..
70 | LLLLLLLLLLLLLL.LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL.LLLLLLLLLLLLLLLLLLLLLL.LLLLLLLLLLL.LLLLLLL
71 | LLLLLLLLLLL.LLLLLLLL.LLLL.LLLLLLLL.LLL.LLLLL.LLLL..LLLLLLLLLLLLLLLLL.LLLL.LLLLL..LLLLLL.LLLLL
72 | LLLLLLLLLLLLLL.LLLLL.LLLL.LLLLLLLLLLLLLLL.LL.LLLLL.LLLLLLLLLLLLLLLLLLLLLL.LLLLL.LLLLLLL.LL.LL
73 | LLLLLLL.LLLLLL.LLLLL.LLLL.LLLLLLLL.LLLLLLLLLLLLLLL.LLLLLLL.LLLLLLLLL.LLLL.LLLLLLL.LLLLLLLLLL.
74 | LLLLLLLLLLLLLL.LLLLLLLLLL.LLLLLLLL..LLLLLL.LLLLLLL.LL.LLLLLLLLLLLLLLLLLLLLLLLLL.L.LLLLL..LLLL
75 | LLL.LLLLLLLLLLLLLLLLLLLLL.LLLLLLLLLLLLLLLLLLLLL.LL.LLLLLLL.LLLLLLL.L.LLLL.LLLLL.LLLLLLL.LLLLL
76 | LLLLLLLLLLLLLL.LLLLL.LLLL.LLLLLLLL.LLLL.LLLL.LLLLL.LLLL.LLLLLLLLLLLL.LLLLLLLLLL.LLLLLLL.LLLLL
77 | LLLLLL..LLLLLLLLLL.L.LLLL.LLLLLLLLLLLLLLLLLLLLLLLL.LLLLLLL.LLLLLLLLL.LLLLLLLLLL.LLLLLLL.L.LLL
78 | LLLLLLLLLL.LLLLLLLLL.LL.L.LLLLLLLL.LLLLLLLLL.LLLLLLLLLLLLL.LLLLLLLLL.LLLL.LLLLL.LLL.LLL.LLLLL
79 | L.L...L....LL.L....LL..L...L...LL.L.............LLLLL..LL........LLL.L....L.L...L.L...LLL.LL.
80 | LLLLLLL.LLLLLL.LLLLLLLLLL.LLLLLLLL.LLLLLLLLL.LLLLL.LLLLLLL.LLLLLLLLL.LLLL.LLLLLL.LLLLLL.LLLLL
81 | LL.LLLL.LLLLLLLLLLLL.LLLLLLLLLLLLLLLLLL.LLLL.LLLLL.LLLLLLL.L.LLL.LLLLLLLLLLLLLLLLLLLLLLLLLLLL
82 | LLLLLLL.LLLLLL.LLLLL.LLLLLLLLLLLLL.LLLLLLLLL.LLLLL.LLLLLLLLLLLLLLLLL.LLLL.LLLLL.LLLLLLLLLLLLL
83 | LLLLLLL.LLLLLL.LLLLLLLLLL.LLLLLLLLLLLLLLLLLLLLLLLL.LLLLLLLLLLLLLLLLL.LLLL.LLL.LLLLLLLLLLL.LLL
84 | .LLL..LL.L.LL.L...L.L..L...L....L.L................L....L.......L..L.....L...LLL....L....LL..
85 | LLLLL.LLLLLLLL.LLLLL.L.LL.LLLLLLLL.LLLLLLLLL..LLLLLLLLLLLL.LLLLLLLLL.LLLL.LLLLL.LLLLLLL.LLLLL
86 | LLLLLLL.LLLLLL.LLLLLLLLLL.LL.L.LLL.LLLLLL.LL.LLLLL.LLLLLLL.LLLLLLLLL.LLLL.LLL.LLLLLLLLL.LLLLL
87 | LLLLLLL.LLLLLL.LLLLL.LLLL.LLLLLLLLLL.L.LLLLL.LLLLLLLLLLLLLLLLLLLLLLL.LLLLLLLLLLLLLLLLLL.LLLLL
88 | LLLLLL..LLLLLLLLLLLLLLLLL.LLLLLLLL.L.LLL.LLL.LLLLL.LLLLLLLLLLLLLLLLL.LLLLLLLLLL.LLLLLLLLLLLLL
89 | LLLLLLL.LLLL.L.LLL.LLLLLLLLLLLLLLL.LLLLLLLLL.LLLLL.LLLLLLL.LLLLLLLLL.LLLL.LLLLL.LLLL.LLLLLLLL
90 | LLLLLLL.LLLLLLLLLLLL..LLL.LLLLLLLL..LLLLLLLLLLLLLL.LLLLLLLLLLL.LLLLLLL.LLLLLLLL.LLLLLLL.LLLLL
91 |
--------------------------------------------------------------------------------
/shared/MCqwertz/inputs/Day3.txt:
--------------------------------------------------------------------------------
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 | .............#.......#.#.......
92 | ##....#.#........#....#..##....
93 | ....#...##.#....##..#.....#.#..
94 | ...##..#....##......#...#......
95 | .####.#..#..#.#...#.#.#....#...
96 | .#........#.##....#.#....#.....
97 | .........#....##..#..#.........
98 | ....##...#....##.............#.
99 | ....#..##.#....#.#..#...##.....
100 | .....##...#..#....#......#.#...
101 | ..........#.......#.##..#.##..#
102 | .......#.........#...#.##......
103 | ....##.#.......#...............
104 | ....#.......#..##.......##.#.##
105 | #.#..#.#....#.#.........###...#
106 | .#.##.....##..##...........#.#.
107 | ...#....##........##...#...#...
108 | .#.##....#.#...#.#..#..#...#...
109 | #....#.##...#.#..#....#.....#..
110 | #..#...#........#...........#..
111 | ...........#.......#......#..#.
112 | ....##...#......##.....#......#
113 | .#.##.#.#.............#....##..
114 | .#...#...##.#.#........#..##.#.
115 | .#.#........#.#...#..#........#
116 | .###.#.#...#..#..#.#....#..#...
117 | ..##..##....#.#............#...
118 | #..........#........#..#.#.#...
119 | .#...#..#..#.#.....#.....#....#
120 | #.....#.#.#.....####.......#...
121 | ...#.#........#.#.###...#.....#
122 | .....#.....##....#....#..##...#
123 | ..#....###.##.#..#..#....#...#.
124 | .....#.....#...........#.#.###.
125 | .....#......###...#.#...##.....
126 | ...........###..#...#....#.#..#
127 | ...#..###.....#....#.#...#.....
128 | .......#...#..#..##....#.#.#...
129 | ...#..####.###........#.....#..
130 | ..#......###..#..#.##..........
131 | ....#....##..##..##.......###..
132 | ...#.......#..#.#....##........
133 | .#.#.....#.#.#..........#..#..#
134 | .##....##....##...........##.##
135 | ........#......#.##....##...#.#
136 | ..#.#.....#..#....#..........#.
137 | ...........#...............#...
138 | .....####.....#.....###.#..#...
139 | ..........####..##.##.#....#...
140 | ...#.#.#......#....#..#.#......
141 | .#.#......###.....#....#.......
142 | ..#..#..#.......#..#...#.....#.
143 | ...#............#......##...###
144 | ......#.............#..#..###..
145 | .#.#......#..##.#..#..#.#...#.#
146 | .#.....#.......#..#...........#
147 | ..#.###.#..#...#.##..#.##......
148 | ....#.#........#..#.#...#.#.##.
149 | .#..##.#..#.#.#...##..#.#......
150 | .......#..#..#..#.....#.#.#..#.
151 | .##.###..##.....#.##..#........
152 | ...##..............#.#.##....#.
153 | ##....#...#...........#........
154 | ..#........#.#.##..#.#...#..#..
155 | .......#.......##.#..#....#.#..
156 | .......#....##..#.#.#..#....#..
157 | ..........#....#..#..#....#....
158 | ........#.....#.#.....##.......
159 | ........##.###.........#.#.#...
160 | ###......####...#.#........#...
161 | ......#........#......#.....#..
162 | ##..#.##..##.###..#........##..
163 | .#..#...#............##.##..#..
164 | ...........#..#.#..............
165 | .##.#.#....#...............#..#
166 | .........##.................#..
167 | #............##..##.........##.
168 | ##........#.........#..##.#...#
169 | ........#.....#..#.........#.##
170 | ....#......#.....##.##.........
171 | .#.#.....#.#..#..##....#....#..
172 | .###...#..##....##.....#.#..##.
173 | .#....#.#.......#..#..#...###..
174 | ..#.#......#.#..#.....###.....#
175 | #....#..#...#.....#.......#.##.
176 | .#.......##.#.#...#......#.....
177 | ###....#.#......#....#.#...##..
178 | ...#....####.......##.....#..#.
179 | .#.................#.......##.#
180 | ...#.###..........#..##......#.
181 | .....##.#..............##..#...
182 | #.....#..#..........#..#.......
183 | ..#...#.#.#.......##.#.....#...
184 | #........#.#........#.#.....#..
185 | #.....#...##....##..##........#
186 | .#.##..#...#....#........#..#..
187 | #..#.....#....#...##......#....
188 | ...#...#...#.#.#....##....#.#.#
189 | ......#...............#.....#..
190 | .......#.#..#..##.#.....#......
191 | ...........##......#...#.......
192 | ....##..##.....#.#...#.........
193 | ......##..###.......#....#.##..
194 | ......#..#.##....#..###..#.....
195 | .....#.........#........##.....
196 | .....####..................#...
197 | .#.#...##................#.....
198 | .#..#...#...#.....#.##..#..#...
199 | .#................#...###....#.
200 | ...#....#...........#...#....#.
201 | .......#....##...............#.
202 | .#.#.##..##.......#....#....###
203 | ......#.#....#...#..#..........
204 | ....#.##.#.#...##.#.#......#...
205 | ##....#...##.....#..#.###.#....
206 | .......#......#.........#.#...#
207 | .##.#...........##.........#.#.
208 | ##..##.....#...#..#.#...#....#.
209 | #..##......###........#...#....
210 | .....#.#.......#...#..##....##.
211 | .....#.#..#.....#.......#..##..
212 | ...#..#..............#.#.......
213 | .#.#...###......###............
214 | .....#.....#...#.###...........
215 | .......#..................#...#
216 | #....#...#...#....#....#.#....#
217 | ....#..#............#.#........
218 | #....#..........#.#.#..#..#....
219 | .......#....#......#....#......
220 | .##.#.#...#...#...##...........
221 | .........###.#..#..............
222 | ...#........##....#....#....###
223 | ....##..#.......#.#...#.#..#.#.
224 | .....##....#..##.........#.....
225 | ........##..#........#.........
226 | ...........#..#.##..##...#.....
227 | .........#.#..####..#...#.##.##
228 | ##..#.#.....##.....#.........#.
229 | ..#...#...#....#.#....#.....#.#
230 | .###.#....#.#......#....#......
231 | .##.....#....#.......#.#..#.##.
232 | #..#..##.....#....#...##.....#.
233 | ...#.........####.........##..#
234 | ..#.....#....###.#.#...#..#....
235 | .........#....#..#.#.........#.
236 | .....###.##..#...#.....#..#..#.
237 | ....#......#..#.#...#.....#....
238 | .......#...#..#....#.......#.#.
239 | .#....#............#....####...
240 | #..##..##....#.....#...#.....#.
241 | ...#...##...#.#....#...........
242 | .......#####.....#..###.#..#...
243 | .....#.....#.#....#.........#..
244 | .###.#..#...##.##.#.#..#..#....
245 | .#..#.##..#......#..........##.
246 | ##....#....#.........###..#....
247 | ..#.............#.......#.#....
248 | ..#.....#..##...#...###..#.##..
249 | ##...##...#.#....#..#..........
250 | ...............#.....#.......#.
251 | ....#.#......##.#......#...#.#.
252 | .........#.............#.#.....
253 | ...#.#.........................
254 | ..#..#....##..#...###.##.......
255 | ...##.#...##..#.#.##.#...#.##..
256 | .##....#....#.......#.....##..#
257 | .#...............#..#...#......
258 | ...##.....##.###....#.....#...#
259 | ...#.....#...####....##....#..#
260 | ..#.#.###..##.....#........#...
261 | .....##.##..#..#.........##....
262 | ........##.....#..........#.##.
263 | ..##.#....####..#...........#..
264 | ##....#..#..#.#.##.....#...##..
265 | ...#...#......#..#.#....#......
266 | ##.....##.......##.##....#.....
267 | .........#...##...........#....
268 | .###.#..#....##...#.....#.....#
269 | ...#..........#.###..##...#.##.
270 | ...#..#....#.#.#.......###.....
271 | ....#..#.#.....##...#.#.#.#....
272 | .......##..#...##..##.#....#...
273 | .##..........#.#.#.....#.....#.
274 | #....#......##...#..##.#..#..#.
275 | .#...#.....###..#......#.....#.
276 | .#..#.###.......#.##....###....
277 | #....#....#....#....#..#.##....
278 | ..#..#.....#.....#....###.....#
279 | ##.###..#...##.......#.#.......
280 | #...##......##....#.#...#....#.
281 | ..##.#.#....#...#.....##.......
282 | .#....#..#...#...##..##........
283 | ###......#.##....#.#..##.......
284 | ...#.....##.#.........#..#.....
285 | .......#.#....#.....##......#..
286 | #..#..............##.#........#
287 | ....#.#....#..#.#...##.........
288 | ..........#..........#.........
289 | .#.....#.....#.##....#.##..#..#
290 | .......#.......#.#.#.##....#...
291 | ..#...........#....#.......##..
292 | ..#.#.#.#...##..#.#.#..#...#.#.
293 | ..#..#..........#...##....#....
294 | ....##.#....#.............#....
295 | .##...##..........#.#..#...#...
296 | #..#..#.##..........##.........
297 | ............#.......#..#.....##
298 | ....#......#........#..#.##....
299 | #.#......#.#...#.....#.........
300 | ..#.....#..#..........#.....#..
301 | .#..#.#.#.##...#..#.#.........#
302 | #...##....#..##..#...#.#.##....
303 | #..##.##.#.##.......#.......#..
304 | #.#.......#........#.##....#.#.
305 | ....#..##....##..##......#..##.
306 | #.....#....#.#........####.....
307 | ......#...#...###..#...........
308 | .##.#.##...##................##
309 | ..##.#.....#.#..#......#.#.....
310 | ......#...#........#.....#.##..
311 | #..#.#..#.....#.#..#..##..#.#..
312 | ...#.........#.#.#.##...#......
313 | ...#..##....#..#.#....#.###.#..
314 | ........###................##.#
315 | ##...........#......##.##.....#
316 | .#.#.#....#....#....#..........
317 | #.....#........................
318 | ....#.....#...#......#.........
319 | ....#.#..#..............#......
320 | ##.........#..#....#.......#...
321 | .###....#..#.#.####.........#..
322 | ..#.#....#.....###..#..........
323 | ..........#................#.##
--------------------------------------------------------------------------------
/shared/dlsf/inputs/Day-03.txt:
--------------------------------------------------------------------------------
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 | ...#......#..#....#...#....#...
92 | ...............#....#..#.##...#
93 | ....#.......................#..
94 | #....##.#......#....#..........
95 | .......#.#......#........#..##.
96 | ..#.....#...#...........##..#..
97 | #........#.#....#............#.
98 | .........##..................#.
99 | ........#...#..#...#......#...#
100 | ...#.......#...####.#...#......
101 | ....#..###......###..#.........
102 | .....#...........#......#......
103 | .#.....#......#.....#.....##.##
104 | .#.#...##..........#........#.#
105 | ..#....#.....##...............#
106 | .....##.....#...##..#..........
107 | .#......##.......#..##.##.#...#
108 | .#..#...#.##.....#.#...........
109 | .........#....##...#.....##....
110 | #..........#.............#..#.#
111 | ...........#........#.#...#....
112 | ........#..###...#...........#.
113 | #.........#...#....#..##.##....
114 | ........#....##.......#.#....#.
115 | ..........#..............#.....
116 | ....##...#...##..........#.....
117 | ...#..##.#...###..#............
118 | ...##..#####....#.............#
119 | .#..#.......##.......#........#
120 | ....##..........#.......#.#....
121 | ......#.........####.......#...
122 | ...............#......#..#.....
123 | ...#...##...#.#.#.....##.#.#...
124 | ..#....#..#..............#....#
125 | #..............#............#..
126 | .#.#..#....#.....#.#.#...#.....
127 | ......#......#..#..#.....#.....
128 | .#.#..#.##.#........#..........
129 | ..##.#......#..#.......#.......
130 | .##...##....#..#.#.........#.##
131 | .........#........#.#..###....#
132 | .....#...............#.........
133 | ......##..........#.....#......
134 | .#.....#.#.#..#.#.....#..#.####
135 | .......###.##......#.....#.#..#
136 | ..#.....#....#.#.##......#....#
137 | .....##..#................#..##
138 | .#......#.....#..#.....#..#####
139 | .........#.#.......#..##...#...
140 | .#.#..#.......##.....#....#....
141 | .....#...###.#...#......#....#.
142 | .#....#....#...#..#.#........#.
143 | ......##........##.#...#..#..#.
144 | .##.##.###..#.....#........###.
145 | .....#..#.#.......#..#.#.......
146 | ##.#.#..............#..##......
147 | ....#.........#.......#.#......
148 | .....#..#.....#...#.#....#.#...
149 | ...#..#.#.#..................#.
150 | ........##.#.###...............
151 | ..#...#.#.......#......#.......
152 | .......#.##....#...#....#......
153 | ......#.#.............#........
154 | ........#......#........##.##..
155 | .....#...#......##.............
156 | ...#.#..#.....#.#...#..........
157 | .#.#..#.....#............#.....
158 | .#.#..#.#.##.#...#.##..##...#..
159 | .........##........#.##..#.....
160 | ##.#.#......###..#.##.#........
161 | .##...#..#...#.#..#....##.....#
162 | #......#..........#.#...#.....#
163 | ..........#......#...#.......#.
164 | .............#..........#......
165 | #.#....#.......##..#.....#.#...
166 | ##......#..#......#.#..#.#....#
167 | ..#.#..#.....#.#......#....#..#
168 | ...#......#......##.....#..#.#.
169 | ....#......#.....#....#.#.#..#.
170 | .....#..#..#.....#...........##
171 | ....#.....#...#........##.#.#.#
172 | ..#......#.......#........#....
173 | #.......##..##......#...####..#
174 | #..........#......#.#..#..#....
175 | .................##............
176 | ...#..#..#.#.....#.##.#.....#.#
177 | ...#....###....................
178 | ....#.......#..#.#.............
179 | #......#................#......
180 | ..........#........#..#........
181 | .....#......##..#......#..###..
182 | ...#....#.......#..............
183 | .#....#.#.#........#.....#...#.
184 | .......#.....##.#.....#....#...
185 | .........#.#.........##..#...#.
186 | ......#......#....#.....##.#.#.
187 | ####...#.........#.....#......#
188 | ...#.#..#..#.............#.....
189 | ......#.........#....#.#..##..#
190 | .........#.....#.#..##..##..#..
191 | .#......##.............#.......
192 | ....#...#......#...#.....#.#.##
193 | ......#..##....#..#.....#......
194 | ......#..............#....##...
195 | .........#.###..........#.##...
196 | #....#..........#..#.......#...
197 | ...........#...#.....#.......#.
198 | ..#..#........#................
199 | ...###.........#...............
200 | .....#.##...#.................#
201 | ..#.#..#...###......#........#.
202 | #......#......#.#.............#
203 | .........#.#.....#..#........#.
204 | ........#..#......#......##....
205 | .....#......#...#.....##...#.##
206 | .##...#..#....##..........###..
207 | .......#............#........##
208 | .##.....#.......#...#..........
209 | ..###..........#.............##
210 | #....#....#.#....#............#
211 | #...#......................#...
212 | ....#..#..#..#.......###....#..
213 | #..###.#..#.....#.............#
214 | ..........#.##.....#.........##
215 | ...#.............#....#....##..
216 | #........................#..#..
217 | ........#...#.....#.....#..##..
218 | #........#......#....#..#....#.
219 | .....#.#.#....#.#..#....#......
220 | .....#....#....................
221 | .........#..#..#....#......#...
222 | ..........#.#.#.......#........
223 | .......#.#.....#..#.....##.....
224 | .....#....#.#.....#.......#..#.
225 | .#..###.......#......#..#..#...
226 | ..##.#.....#.........##.#......
227 | .....#.......###.......##......
228 | #...#.......##.#.#......#.....#
229 | .##........##.#...#...#........
230 | ....#.......#....#..#.......#..
231 | .#..#.......#..####..##........
232 | ..#..#..#..#..#..#.............
233 | ...#......#...#...#.#......##.#
234 | ........#.#..#.#.#......#...#..
235 | #.......#..##.......##........#
236 | ..##...#...............#.#....#
237 | .####........##..........#..#..
238 | ..#........#...##...#........#.
239 | .#.#..........#...#...#........
240 | ....###..........#....#........
241 | .#.#.#.###.#.##..#.#........#..
242 | ..........#....##.#..##........
243 | .......#..#..##.......#........
244 | ..#........#....#..####.#..#...
245 | ....#.......#..##..#..........#
246 | .....#...........#....#....#...
247 | .#.##..#......##.........#.#...
248 | ...#......##..##......#.....#..
249 | #........#..........#.#...#....
250 | .#.#........###........#..#....
251 | ....#####.................##...
252 | .........##...#......#.........
253 | .......#....#....#.#....#...#..
254 | ......#................#...#.#.
255 | ....#.....#.....#.#.....#.....#
256 | #.........#..#........#.....#..
257 | ....#...........#.....#.#......
258 | ##..#....................#.#...
259 | #.#.##....#.....##....#.......#
260 | ..#..#....###.......#..##......
261 | ......##.....#.##...#....#..#..
262 | ........#..#.#..#..#.#.........
263 | #...#.....##..........##.......
264 | ....#.....#...#.###.......#....
265 | ..........#..#...#........##..#
266 | ##..#...#.#.####.#..#..#...#...
267 | ................#......#..#....
268 | .......#...###...#........#....
269 | ....#..##..#.#......#...#.#..##
270 | .##......#...........#.......##
271 | ....#.#...#..#.#.......##......
272 | ....#..##..#.....#........##...
273 | ...#...#..#.#.#....#.........#.
274 | #....##.#....#..##.............
275 | .#......##......#.#.##.......#.
276 | .......#...#....#.##......#....
277 | ..##..........#.....#.#......#.
278 | #..##.....#..........##..#.#...
279 | ....#.#.......#.#.....#.....#..
280 | ##.....#..#.....##...#.....#..#
281 | ...#.#..#...#..............#...
282 | ...............#..#............
283 | .#.......#......#........##....
284 | ..#......#..##..####.....#...#.
285 | .#.##.#.#..#..##..##...........
286 | ...##.............#.....#..#...
287 | .##.....#..#.#......##........#
288 | ##....#.............#...#......
289 | ......#.....###...........##...
290 | .#.#...#.............##..#..###
291 | ..#.##.##...#.....#...........#
292 | .....#.....##...#...#........#.
293 | ........#..##.......##.....#...
294 | .#........####.......#.#...#...
295 | ...#..........#......##........
296 | .......#......#..##..#...#.....
297 | ..#...........#.#.#..#.#.#.....
298 | #..........#....#....###.#.....
299 | ....#.................#...##...
300 | #....#.###......#..#.....#...##
301 | .#.......##.....###.....#...#..
302 | ....##............#...........#
303 | ...#.#.#.........#...#..#..#..#
304 | .....#..###.................#..
305 | .#.....#.....#....###.#..#...#.
306 | ................#...#..........
307 | ..#....#..##....#.##........#..
308 | ....##....#...........#..#.....
309 | ...##......###.......#...#.....
310 | .......##............#......#.#
311 | #####.....#..#.###..#.#........
312 | #.##.##..#.......#....#........
313 | ....###..#.#.#......###.#......
314 | ....#....#.....##.#..#....#...#
315 | ....#.....#.#...##.##.#.#....#.
316 | .........#.#.###.#.....#.......
317 | .#....#.......#..##...#....#...
318 | ...####...##.#.....#...........
319 | #.....#.....#..........##..#...
320 | ................#.#.#......#...
321 | .#...#.......#..#............#.
322 | .##.#.......#..#....#.....#....
323 | .#...#..#.....#..............#.
324 |
--------------------------------------------------------------------------------
/shared/paul2708/input/day03.txt:
--------------------------------------------------------------------------------
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 | .....#....#.###.##.........###.
92 | #.......#.####..#..#..##.......
93 | ##.#.......#..##..#....#..#.#..
94 | ..###...#.#...#.....##.##.####.
95 | ....#...#.#....#..#..#.....#.##
96 | #.....##.#.#..#.##..#..##......
97 | ................###..#....##...
98 | ..#.##.....#..........##.#...#.
99 | ..#.#..#.#....#.#.#..#..#..#.#.
100 | #...#..##.#.#...#..#...#..#....
101 | #..#.#.........#..###........#.
102 | .#...#.............#..###..#..#
103 | #.........#.#..#...#.#.....#..#
104 | ....#..#..#.#.#...#...#.....##.
105 | ##...###.#.####..#......#...#..
106 | ..#..##...#.#......#.#.......#.
107 | #......###....##.#.##..........
108 | #####....###..#...............#
109 | ##.#...####....#....#...#....#.
110 | .#.......#..#.....#...#.....###
111 | ...#..#.#.#....##......##...#..
112 | ...#.....#...#.##.#..#.#....#..
113 | #...###....#...#.#....#........
114 | .#.......#........#...##.##.##.
115 | .....#....#...##.....##...###.#
116 | ....#....#.#..#...##.##.##.....
117 | .......#............#...#.#..#.
118 | .#............#.....##.......#.
119 | ........#....#....##......##.##
120 | .......##..#.#..#.##..###..##.#
121 | #..##..##.........####.#.###...
122 | #....#..#...##...#.............
123 | #...#...###..........##..#..#..
124 | ....#...#..#.....##...#........
125 | #.....#......#.#.....#...#..#..
126 | ..#.....#.....#....#..#........
127 | ..#..#.....#.#.........#..###..
128 | ................###..#.#....#..
129 | #.....#.....#.#.#.#.#..#...#.#.
130 | #....#....#.#..........#.#....#
131 | ....#..#......#..##.#...##.....
132 | ..#.#...#.####....#.#..#.#..#..
133 | .........##......#.....##......
134 | ##.#.###.#.....#.....####.#..#.
135 | .....#.....#..#....#..###.#....
136 | ##..#.#...#.##....#....#.......
137 | .....#......#.#...##..#.#......
138 | ....##..#...#...##..##.#....#.#
139 | ............#..........##.#....
140 | ##..#..#.##..##..#.#....#.#.#..
141 | .......#.#...#...#.#...#..#....
142 | #....#.#...#...#........#..#...
143 | ...........#.......#...##..###.
144 | .#..##......#.##.........##..#.
145 | ...#...#...###.#.##....##.#..#.
146 | #...#..#.#.#.....##..#.......#.
147 | .##..#.###.##......#.#....#.#.#
148 | ..#....#.......#..#..#.#.#.##..
149 | #...#...###...###.........#....
150 | .#.#...#.....##.#.#..#....#.##.
151 | .........#.#.##.....#.#.###....
152 | ...#.#...#......#...####......#
153 | ...##..##....##......##...###..
154 | ###...#..#.......##.....#....#.
155 | ...#..#..#..###...##.##..#..#..
156 | ...#......#......##..#.#.##..#.
157 | ...#.........#....#.#....#.#...
158 | ##................#..#.#.....#.
159 | ....#.##...#..#.##...##.#.....#
160 | ......#..##.##..###.#..#.##.##.
161 | .#.#...###.....###.....##...###
162 | .##.....#.#.#..#..###..#..#..#.
163 | #.......#..#..#....##.....#....
164 | ...#.#.##..#..#......##.##...#.
165 | ....##.#......#...#..#..#......
166 | .####.#..#.....#..##.#...##..##
167 | ..#..#...#..........###..#....#
168 | .#.#.##.##...#............#....
169 | ........##..##......#.##..#.###
170 | ...#.#....###......##.......#..
171 | ..##...#...#.#..#.....#.....#..
172 | ##..#...###..#..#.#.#...#...#..
173 | .....#..#....##.....##.....###.
174 | ....##...###.#..#.#....##..#..#
175 | #......#...#....#......#...##..
176 | ....#.##...#.#......#.#.##...#.
177 | .......#.....#...#####...#.#...
178 | ...#.....##.#............#.....
179 | ...#.#........#.#.#..#.........
180 | ....###......#.#.#..#.####.#..#
181 | #.....#.#.#.....#.#.#.....#..#.
182 | ..##.##......#...#.#...........
183 | ###..###....#.#####......###...
184 | ..##..............##.#.#....#.#
185 | #..#...#..........#..#.#.#..###
186 | ##.###............#....#.#...#.
187 | #.#..#.#..##.#.#....#...#......
188 | #....#...#..##.....#..#.#..###.
189 | ..#.....#.#....#.#..#.##.#..##.
190 | ...##...#.#.##...#....###....#.
191 | ......###.####.......#..#.#.#.#
192 | .#..............##........#....
193 | ...##.##...##....#..#.......#..
194 | .....#.....#....###...#..#..#.#
195 | .#.....#..#.....#......#.....##
196 | #.#.##.#..#..#.....#.##..###...
197 | ..#......#...##.###..#.#...#..#
198 | ......#.....#...##......#......
199 | ##.#........#..........#.....#.
200 | #........##.#............##....
201 | ...#......##...#.#.....##......
202 | ...##.......#....#.#..#.#.###..
203 | ..#....##..##.##.....###....#..
204 | ..#...#.#...#.....#..........#.
205 | ......#...#...#.#.##.#...#.#.#.
206 | .#...#......#.##........#......
207 | .##.##..#....#...#.#...##......
208 | #..#......#.#...........#....#.
209 | ....##.#....#...#..#....#.#..##
210 | #....##.##....#.#..##.#........
211 | .##.##.#....##.....#..#....#..#
212 | ...#...#.....###.#.##..........
213 | ....#...#....##.......###......
214 | #.........#......#.#.......#...
215 | #..........#..##..#.#..........
216 | .....#.......#..##.##....##...#
217 | ........................#.#....
218 | #..#.........#.............#..#
219 | #..#.....#.......#....#....#.#.
220 | ..##..##.......##....#...#.....
221 | .##......#..##......#.###......
222 | ...#.#........#.......##..###..
223 | ..##...###.###......#...#....##
224 | #...#...#.....###.#.#.#..#.....
225 | #....#.........#..##...#...##..
226 | #..###..#.#.#.##.#..#.#....#.##
227 | #...#.#.....#.###.#.......#....
228 | ..##..#..#....#.#...........#.#
229 | #.........#.#......#...##......
230 | .######......#..#....#.#.#....#
231 | ##..#.#..####.###.........#....
232 | ###########.....##.##...#..#...
233 | #...##.#.#....#.#....#......#..
234 | ...#..##..#..##..#......#....#.
235 | .#....#...#....#.#..##....##...
236 | #..#.#............#....#.#...#.
237 | ...#...#..#.#.##......#..#.#...
238 | #.#...##.....#..#.##......####.
239 | .#.#..##..#.....#.#..#.##......
240 | #.#.##......##.....#..#.#..#...
241 | #..##...#.##.#.......#.##......
242 | ..#.......#.#.#...##..##...#...
243 | .#...#..#..#.#.........#..##...
244 | #..#.......#....#.#...#.###...#
245 | .......#..#.......##.#.#...#.#.
246 | .#.................###.#..###..
247 | ..........#.#.....##..#####...#
248 | #......#.#..##.#.#...#.##.#....
249 | #......#.#..##.##.#...#....#...
250 | ....#..#......#....#....#######
251 | .#...#......#....###......#.###
252 | #.#....#.#...#.###......#..#..#
253 | .###......#.#...#.####.#..####.
254 | ######.#.....###.#...#.#.....#.
255 | .#.###....#..#.#.....#.....####
256 | .......###.#.........#..#......
257 | #...#.....##.#......####.......
258 | ..#.#..##.#.#...#...#..##..##..
259 | .....#...##.....#...##......##.
260 | ##..#..#.##..#.#......#.....#..
261 | ##.........#.#.##.#..#.#....#.#
262 | .#........###...#.........#....
263 | ...#..#.#..#....####...........
264 | #.#....#..##..####.#...#.##....
265 | .#.....#.......#..........#..##
266 | ...#.......#...###..#.....#..##
267 | .........#.###.#..##...#.##...#
268 | .#..........##..####...#..#.#.#
269 | .#...##...#............##...#.#
270 | ...#....#.#..........#.#..#.#..
271 | .#.#...##....##.#.#.#....#.....
272 | ....#..#.....#.#..#.#..#.##.###
273 | .....#.#.....#..#......#.#.#...
274 | .....#.#.#..###..#.#..###...#..
275 | #.......####...#.#..#......##.#
276 | ....#..#..###......###.##....#.
277 | ##.....#.....#.............#..#
278 | #..#..#...##.....##..#..#.#....
279 | .....#.#.###...#...............
280 | #.#.#.....#.#..#.#...#.......#.
281 | ..##.##............#....#..##..
282 | #....##...#.....#.###...#.#....
283 | #...##.#.........#...#....#....
284 | ##.##.#...#.#...###..#....##..#
285 | ....#....##..#..#.......#...##.
286 | .#...#...#..#.....#..###.#..#.#
287 | ....#..###......#....##....#...
288 | #.#.....#....##.#..#.#...###...
289 | .......#............#......#...
290 | .##..#.###.#.............###...
291 | ..##...##.#.#.#.....#........##
292 | ....#.###....#..#..#...#...#..#
293 | .....#...#...#..#....#.....##..
294 | ###.#.#.....#......####.....#..
295 | #.#.###............#......#....
296 | ..#.....#..#..#..#....#......#.
297 | #...######...#....#.##...##.#.#
298 | ##.#.#.#..##......##.#..#.#...#
299 | ............#.#..#.##....#.....
300 | ......#............#.#...#..#.#
301 | .#..##...##..#.#.#..###.....##.
302 | #.###.#...........#...#....#...
303 | ....##.....#...##...#...###.#.#
304 | .####.#.#.....#.#..#.#.##......
305 | .#...##......###...#..##..#.#..
306 | .#......#...#....##.....##..#..
307 | ..........##.....###.##.#...#.#
308 | .#........##.#..............#..
309 | #...###..#...#.....#....#.....#
310 | ...#......#..#...#...#..###.#..
311 | .#...##..#........#.......#.#..
312 | .#.#.##.........##.##......#..#
313 | #...#.#.#...#.....#.#...#.#..#.
314 | #.#..#...#...#...##..........#.
315 | .#...........#....#..#.#..#.#..
316 | #.......#......#..#...#........
317 | .....#..#...##..###..##........
318 | ......#...#.....#..#.#.#....##.
319 | ....##..##..##....###.##.......
320 | .#........##.#.#...#..#........
321 | .....##...##...#......#..#...#.
322 | ..#.....#....###.#..##....#..#.
323 | ......#..#...####.#.....##.####
324 |
--------------------------------------------------------------------------------