Compare commits

...

4 Commits

14 changed files with 1456 additions and 40 deletions

7
functions/src/day.ts Normal file
View File

@@ -0,0 +1,7 @@
interface Day {
part1(input: string[]): number | string;
part2(input: string[]): number | string;
}
export default Day;

View File

@@ -1,6 +1,7 @@
import Day from "./day";
class Day1 {
static part1(input: string[]): number {
class Day1 implements Day {
part1(input: string[]): number {
const values = input.map(s => parseInt(s));
let res = 0;
@@ -10,7 +11,7 @@ class Day1 {
return res;
}
static part2(input: string[]): number {
part2(input: string[]): number {
const values = input.map(s => parseInt(s));
let res = 0;

View File

@@ -1,22 +1,23 @@
import Utils from "./utils";
import Day from "./day";
class Day2 {
static part1(input: string[]): number {
class Day2 implements Day {
part1(input: string[]): number {
const forwardMoves = input.filter(s => s.startsWith("forward"))
.map(s => this.readUnits(s));
.map(s => Day2.readUnits(s));
const finalForwardPosition = Utils.sum(forwardMoves);
const depthMovesUp = input.filter(s => s.startsWith("up"))
.map(s => this.readUnits(s));
.map(s => Day2.readUnits(s));
const depthMovesDown = input.filter(s => s.startsWith("down"))
.map(s => this.readUnits(s));
.map(s => Day2.readUnits(s));
const finalDepthPosition = Utils.sum(depthMovesDown) - Utils.sum(depthMovesUp);
return finalForwardPosition * finalDepthPosition;
}
static part2(input: string[]): number {
part2(input: string[]): number {
let depth = 0;
let aim = 0;
@@ -24,11 +25,11 @@ class Day2 {
for (const entry of input) {
if (entry.startsWith("up")) {
aim -= this.readUnits(entry);
aim -= Day2.readUnits(entry);
} else if (entry.startsWith("down")) {
aim += this.readUnits(entry);
aim += Day2.readUnits(entry);
} else if (entry.startsWith("forward")) {
const movement = this.readUnits(entry);
const movement = Day2.readUnits(entry);
depth += aim * movement;
x += movement;
}

View File

@@ -1,12 +1,13 @@
import Utils from "./utils";
import Day from "./day";
class Day3 {
class Day3 implements Day {
public static part1(input: string[]): number {
public part1(input: string[]): number {
let sums = Utils.zeroes(input[0].length);
const sums = Utils.zeroes(input[0].length);
for (let value of input) {
for (const value of input) {
for (let i = 0; i < value.length; i++) {
if (value[i] === "1") {
sums[i] += 1;
@@ -20,9 +21,9 @@ class Day3 {
return gamma * epsilon;
}
public static part2(input: string[]): number {
public part2(input: string[]): number {
return this.findLifeSupportRating(input, "oxygen") * this.findLifeSupportRating(input, "CO2");
return Day3.findLifeSupportRating(input, "oxygen") * Day3.findLifeSupportRating(input, "CO2");
}
static findLifeSupportRating(input: string[], type: "oxygen" | "CO2"): number {

129
functions/src/day4.ts Normal file
View File

@@ -0,0 +1,129 @@
import Day from "./day";
import Utils from "./utils";
class Day4 implements Day {
part1(input: string[]): number | string {
const { drawnNumbers, bingoCards } = this.parseInput(input);
// We are done as soon as we encounter the first bingo
return this.playBingo(drawnNumbers, bingoCards, () => ({ isDone: true }) ).score;
}
part2(input: string[]): number | string {
const { drawnNumbers, bingoCards } = this.parseInput(input);
// We are done when the first bingo is encountered before every card has had a bingo:
const bingo = this.playBingo(drawnNumbers, bingoCards, (b, bc, bcs) => ({ isDone: b.firstBingo && bcs.every(bc => bc.hadBingo) }));
return bingo.score;
}
playBingo(drawnNumbers: number[], bingoCards: BingoCard[], bingoHandler: (b: Bingo, bingoCard: BingoCard, allCards: BingoCard[]) => { isDone: boolean }): Bingo {
for (const draw of drawnNumbers) {
for (const bingoCard of bingoCards) {
const cardResult = bingoCard.cross(draw);
if (cardResult instanceof Bingo) {
const handleResult = bingoHandler(cardResult, bingoCard, bingoCards);
if (handleResult.isDone) return cardResult;
}
}
}
throw Error("We were never done...");
}
parseInput(input: string[]): { drawnNumbers: number[], bingoCards: BingoCard[] } {
const drawnNumbers = input[0].split(",").map(s => parseInt(s));
const bingoCards = [];
let currentCardNumbers: number[] = [];
let currentCardWidth = 0;
for (let i = 1; i < input.length; i++) {
// Empty line indicates a new bingo card
const line = input[i];
if (line === "") {
if (currentCardNumbers.length > 0) {
bingoCards.push(new BingoCard(currentCardNumbers, currentCardWidth));
}
currentCardNumbers = [];
currentCardWidth = 0;
} else {
const cardLine = line.split(/\s+/).filter(s => s != "").map(s => parseInt(s));
currentCardNumbers.push(...cardLine);
currentCardWidth = cardLine.length;
}
}
if (currentCardNumbers.length > 0) {
bingoCards.push(new BingoCard(currentCardNumbers, currentCardWidth));
}
return { drawnNumbers, bingoCards }
}
}
class BingoCard {
readonly numbers: number[];
readonly width: number;
crossed: boolean[];
hadBingo = false;
constructor(numbers: number[], width: number) {
this.numbers = numbers;
this.width = width;
this.crossed = new Array(numbers.length).fill(false);
}
/**
* Cross the given numbers of the bingo card. Returns Bingo if this card scored a bingo!
* @param nr
*/
cross(nr: number): null | Bingo {
const nrIndex = this.numbers.indexOf(nr);
if (nrIndex === -1) return null;
this.crossed[nrIndex] = true;
// Check for bingo
const rowStart = Math.floor(nrIndex / this.width) * this.width;
const rowComplete = this.crossed.slice(rowStart, rowStart + this.width).every(c => c);
const colStart = nrIndex % this.width;
const colComplete = this.crossed.filter((v, i) => i % this.width === colStart).every(c => c);
if (rowComplete || colComplete) {
const firstBingo = !this.hadBingo;
this.hadBingo = true;
return new Bingo(Utils.sum(this.numbers.filter((n, i) => !this.crossed[i])) * nr, nr, firstBingo);
} else {
return null;
}
}
}
class Bingo {
readonly score: number;
readonly winningNr: number;
readonly firstBingo: boolean;
constructor(score: number, winningNr: number, firstBingo: boolean) {
this.score = score;
this.winningNr = winningNr;
this.firstBingo = firstBingo;
}
}
export default Day4;

93
functions/src/day5.ts Normal file
View File

@@ -0,0 +1,93 @@
import Day from "./day";
import Vector2 from "./vector2";
class Day5 implements Day {
part1(input: string[]): number | string {
const vents = Day5.parseInput(input)
// For now, we should only consider purely horizontal or purely vertical vents:
.filter(v => v.start.x === v.end.x || v.start.y === v.end.y);
return Day5.countVentOverlaps(Day5.markVents(vents));
}
part2(input: string[]): number | string {
const vents = Day5.parseInput(input)
return Day5.countVentOverlaps(Day5.markVents(vents));
}
private static markVents(vents: Vent[]): Map<string, number> {
const grid = new Map<string, number>();
vents.forEach(v => Day5.markVent(v, grid));
return grid;
}
private static markVent(vent: Vent, grid: Map<string, number>) {
// Must be a diagonal line
const steps = Math.max(Math.abs(vent.end.x - vent.start.x), Math.abs(vent.end.y - vent.start.y));
const stepX = Day5.determineStep(vent.start.x, vent.end.x);
const stepY = Day5.determineStep(vent.start.y, vent.end.y);
for (let i = 0; i <= steps; i++) {
Day5.addVentPos(new Vector2(vent.start.x + stepX * i, vent.start.y + stepY * i), grid);
}
}
private static determineStep(start: number, end: number): number {
return start === end ? 0 : (start < end) ? 1 : -1;
}
private static countVentOverlaps(grid: Map<string, number>): number {
let count = 0;
for (const ventCount of grid.values()) {
if (ventCount >= 2) count++;
}
return count;
}
private static addVentPos(pos: Vector2, grid: Map<string, number>) {
const key = pos.key();
const existing = grid.get(key);
if (!existing) {
grid.set(key, 1);
} else {
grid.set(key, existing + 1);
}
}
private static parseInput(input: string[]): Vent[] {
const res: Vent[] = [];
for (const line of input) {
const startEnd = line.split(/\s*->\s*/);
res.push({
start: Vector2.parse(startEnd[0]),
end: Vector2.parse(startEnd[1])
});
}
return res;
}
}
class Vent {
readonly start: Vector2;
readonly end: Vector2;
constructor(start: Vector2, end: Vector2) {
this.start = start;
this.end = end;
}
}
export default Day5;

View File

@@ -0,0 +1,17 @@
import Day from "./day";
class DayX implements Day {
part1(input: string[]): number | string {
// TODO implement
return 0;
}
part2(input: string[]): number | string {
// TODO implement
return 0;
}
}
export default DayX;

View File

@@ -1,9 +1,12 @@
import * as functions from "firebase-functions";
import {Request, Response} from "firebase-functions";
import Utils from "./utils";
import Day from "./day";
import Day1 from "./day1";
import {Response} from "firebase-functions";
import Day2 from "./day2";
import Day3 from "./day3";
import Day4 from "./day4";
import Day5 from "./day5";
// // Start writing Firebase Functions
@@ -20,30 +23,21 @@ interface DayResult {
}
export const day = {
1: functions.region("europe-west1").https.onRequest((request, response) => {
1: functions.region("europe-west1").https.onRequest((request, response) => { processDay(new Day1(), request, response) }),
2: functions.region("europe-west1").https.onRequest((request, response) => { processDay(new Day2(), request, response) }),
3: functions.region("europe-west1").https.onRequest((request, response) => { processDay(new Day3(), request, response) }),
4: functions.region("europe-west1").https.onRequest((request, response) => { processDay(new Day4(), request, response) }),
5: functions.region("europe-west1").https.onRequest((request, response) => { processDay(new Day5(), request, response) }),
const input = Utils.parseInput(request);
const part1 = Day1.part1(input);
const part2 = Day1.part2(input);
sendResponse(response, part1, part2);
}
}),
2: functions.region("europe-west1").https.onRequest((request, response) => {
function processDay(day: Day, request: Request, response: Response) {
const input = Utils.parseInput(request);
const part1 = Day2.part1(input);
const part2 = Day2.part2(input);
sendResponse(response, part1, part2);
const input = Utils.parseInput(request);
const part1 = day.part1(input);
const part2 = day.part2(input);
sendResponse(response, part1, part2);
}),
3: functions.region("europe-west1").https.onRequest((request, response) => {
const input = Utils.parseInput(request);
const part1 = Day3.part1(input);
const part2 = Day3.part2(input);
sendResponse(response, part1, part2);
}),
}
function sendResponse(response: Response, part1: string | number, part2: string | number) {

View File

@@ -19,7 +19,7 @@ class Utils {
static zeroes(length: number): number[] {
let res = [];
const res = [];
for (let i = 0; i < length; i++) {
res.push(0);
}

23
functions/src/vector2.ts Normal file
View File

@@ -0,0 +1,23 @@
class Vector2 {
readonly x: number;
readonly y: number;
constructor(x: number, y: number) {
this.x = x;
this.y = y;
}
static parse(input: string): Vector2 {
const splitIndex = input.indexOf(",");
const xString = input.substr(0, splitIndex);
const yString = input.substr(splitIndex + 1);
return new Vector2(parseInt(xString), parseInt(yString));
}
key(): string {
return `${this.x},${this.y}`;
}
}
export default Vector2;

24
input/day/4-example.http Normal file
View File

@@ -0,0 +1,24 @@
POST http://localhost:5001/advent-of-code-2021-911a8/europe-west1/day-4
Content-Type: text/plain
7,4,9,5,11,17,23,2,0,14,21,24,10,16,13,6,15,25,12,22,18,20,8,19,3,26,1
22 13 17 11 0
8 2 23 4 24
21 9 14 16 7
6 10 3 18 5
1 12 20 15 19
3 15 0 2 22
9 18 13 17 5
19 8 7 25 23
20 11 10 24 4
14 21 16 12 6
14 21 17 24 4
10 16 15 9 19
18 8 23 26 20
22 11 13 6 5
2 0 12 3 7
###

606
input/day/4.http Normal file
View File

@@ -0,0 +1,606 @@
POST http://localhost:5001/advent-of-code-2021-911a8/europe-west1/day-4
Content-Type: text/plain
69,88,67,56,53,97,46,29,37,51,3,93,92,78,41,22,45,66,13,82,2,7,52,40,18,70,32,95,89,64,84,68,83,26,43,0,61,36,57,34,80,39,6,63,72,98,21,54,23,28,65,16,76,11,20,33,96,4,10,25,30,19,90,24,55,91,15,8,71,99,58,14,60,48,44,17,47,85,74,87,86,27,42,38,81,79,94,73,12,5,77,35,9,62,50,31,49,59,75,1
78 27 82 68 20
14 2 34 51 7
58 57 99 37 81
9 4 0 76 45
67 69 70 17 23
38 60 62 34 41
39 58 91 45 10
66 74 94 50 17
68 27 75 97 49
36 64 5 98 15
17 50 13 53 20
68 57 76 10 86
2 91 67 27 11
94 70 84 69 25
32 90 45 75 41
71 84 42 49 81
26 40 24 73 18
41 37 19 25 75
76 63 48 56 55
85 51 29 88 23
27 10 11 75 59
61 96 44 58 64
24 68 90 60 87
28 55 34 80 9
41 98 91 78 62
91 95 70 64 30
34 43 32 16 57
49 80 87 51 62
61 10 8 75 21
85 66 2 55 56
50 4 11 58 48
30 10 57 16 95
93 96 68 92 81
94 17 69 86 79
52 34 99 6 19
2 16 50 26 84
97 24 32 51 8
70 0 3 52 9
1 59 43 64 80
22 23 17 92 88
84 7 37 71 81
80 97 17 94 9
27 95 39 25 5
98 46 58 77 2
60 1 73 23 18
1 14 67 20 48
75 51 36 87 73
57 84 74 47 19
89 8 13 50 24
61 12 65 46 83
82 87 8 9 85
16 22 98 91 55
26 69 42 11 93
65 15 2 63 43
71 37 28 88 12
59 7 51 1 43
17 45 15 96 93
49 88 79 84 92
40 36 25 18 22
70 57 34 62 6
1 18 5 47 46
12 27 24 40 2
53 54 20 14 42
15 51 26 58 9
31 92 34 74 7
41 84 14 32 8
38 1 60 22 88
64 70 10 91 97
94 90 65 54 50
7 58 18 87 33
93 25 26 71 42
86 85 61 32 51
20 88 67 35 29
46 28 92 9 16
34 30 97 91 44
34 88 90 99 83
22 24 4 25 18
51 41 29 53 72
75 42 66 98 79
74 7 0 73 33
99 24 44 83 47
2 21 94 35 4
96 87 31 1 22
67 3 37 43 46
85 55 10 6 80
4 75 29 54 15
66 17 89 98 27
46 5 64 3 22
97 50 0 51 52
26 39 30 32 48
39 17 46 48 63
52 13 98 40 91
14 80 28 23 60
90 88 15 89 74
56 7 2 41 58
82 51 6 7 22
87 9 60 63 95
80 0 5 8 77
85 3 68 84 39
15 45 31 55 26
48 82 38 29 55
87 46 79 61 51
1 97 69 91 83
35 89 45 59 39
43 28 21 44 24
71 97 34 43 23
44 65 92 90 31
74 87 54 79 93
55 88 66 12 53
14 56 17 52 83
91 33 20 59 67
71 78 15 94 68
8 90 72 57 36
27 40 92 1 44
18 80 7 32 19
67 20 94 89 10
85 78 70 35 0
87 66 75 73 23
36 8 17 83 21
40 52 93 62 96
8 37 66 26 63
7 90 21 18 33
31 56 81 77 55
34 15 19 27 57
13 85 0 59 4
67 77 48 26 6
31 72 89 76 45
66 4 7 43 78
15 53 81 85 70
0 10 40 30 94
79 37 8 29 27
41 14 12 99 28
75 40 30 25 77
36 78 39 32 11
91 58 17 96 51
36 8 35 30 51
28 61 4 95 67
29 69 32 80 48
55 63 98 10 22
27 87 83 62 21
24 36 52 72 16
53 1 4 96 37
31 7 69 47 57
38 97 3 26 59
74 14 29 32 40
8 73 68 62 38
43 92 15 69 46
56 58 48 28 44
25 64 13 50 97
66 34 21 49 10
63 41 71 22 18
56 82 95 60 35
53 48 79 30 86
17 51 57 70 27
75 66 42 32 43
60 59 40 42 90
65 22 43 0 49
82 96 29 52 73
67 17 20 53 24
72 5 91 50 85
94 47 2 93 74
90 10 27 17 5
92 26 28 77 88
69 43 33 19 53
34 50 54 36 60
73 36 90 50 37
11 80 81 93 74
78 56 86 6 39
15 94 7 91 42
33 8 64 40 28
73 37 57 65 0
64 26 52 79 69
15 41 3 2 1
71 48 8 43 31
5 93 86 42 27
59 35 19 17 83
15 93 53 2 4
26 51 85 71 22
31 52 74 12 57
70 40 68 39 24
3 6 45 81 20
82 30 15 62 80
21 70 56 23 32
68 19 50 16 14
46 89 72 59 40
17 27 72 36 12
55 30 6 88 69
34 91 87 45 82
48 15 18 21 7
44 4 81 14 93
55 84 58 24 53
99 44 88 54 37
2 56 57 50 35
13 90 26 30 96
7 97 12 19 71
31 26 87 54 76
68 24 20 27 98
53 75 15 95 8
63 2 45 50 9
49 17 88 55 1
91 78 45 26 30
63 95 67 60 58
34 39 44 20 11
38 29 73 22 80
56 12 77 37 4
24 18 65 21 6
76 45 85 2 78
67 69 55 91 57
96 61 39 36 83
8 54 12 38 70
33 71 24 82 84
53 32 45 9 34
89 28 30 42 96
49 95 69 51 12
80 41 31 48 75
40 60 0 92 13
87 9 45 98 77
14 91 35 1 95
79 39 19 89 51
61 56 8 97 32
89 70 2 81 34
21 59 39 84 64
28 94 97 29 30
35 27 99 32 55
23 47 14 88 0
46 14 92 49 94
90 80 2 65 30
54 32 35 56 27
29 55 97 39 37
81 72 47 66 42
53 1 0 34 82
26 28 30 65 41
17 4 57 49 40
84 46 27 35 91
56 38 20 81 86
10 31 98 66 22
87 99 24 34 93
7 95 28 78 73
61 25 14 5 1
42 85 16 47 43
92 43 9 68 40
41 65 18 69 89
35 88 62 67 75
64 4 17 42 93
78 33 94 87 81
18 61 10 19 87
46 99 55 3 28
16 41 45 39 27
8 13 43 64 52
23 34 47 11 92
21 59 74 36 38
81 29 79 80 44
84 30 37 62 57
69 82 60 10 52
7 55 93 12 0
37 23 52 2 94
19 96 8 68 29
99 57 53 9 48
62 11 35 95 98
93 72 58 16 36
80 53 82 29 76
77 17 85 62 81
34 92 25 55 20
91 39 23 50 31
64 37 79 96 2
40 5 57 36 14
91 53 56 73 27
11 55 74 7 9
90 58 12 22 26
82 38 59 97 85
54 79 75 0 30
7 15 26 84 40
91 76 42 3 19
65 77 53 21 67
45 50 2 14 46
23 51 40 13 72
54 61 59 18 14
0 41 5 24 82
73 11 46 36 17
16 28 25 60 4
85 42 22 54 18
3 27 12 15 99
13 26 89 93 76
23 87 77 64 25
9 17 74 57 81
47 64 85 69 89
59 17 4 83 88
80 70 53 7 67
73 18 81 44 30
45 37 90 57 3
72 48 35 39 31
44 85 91 52 46
73 61 68 66 12
74 95 76 75 36
83 21 15 2 10
63 82 95 31 51
93 3 53 15 70
0 36 44 19 5
11 17 62 55 83
80 91 4 18 66
44 8 45 90 64
30 33 9 27 47
68 53 81 77 35
63 4 82 80 67
3 28 66 22 43
48 86 57 16 7
69 51 11 8 61
25 12 43 88 71
83 36 31 77 5
50 21 9 76 63
27 39 6 87 49
16 66 3 25 10
7 70 8 94 42
95 20 55 9 29
0 46 36 79 18
27 21 36 14 79
23 48 56 74 94
18 99 73 93 32
98 77 37 35 69
43 34 63 59 9
27 96 78 94 20
34 5 49 84 99
68 74 21 57 1
93 85 29 47 65
54 97 42 70 40
29 28 64 26 46
39 48 13 51 2
42 91 96 93 66
12 60 70 8 24
18 21 83 56 45
64 43 76 40 97
30 10 22 84 53
51 13 68 93 15
75 27 18 39 82
62 61 91 12 88
72 6 61 10 45
65 62 57 2 91
30 24 76 42 69
32 36 43 63 75
92 44 58 82 49
30 39 58 75 76
62 53 59 70 97
29 31 54 27 89
90 32 37 86 1
7 34 42 61 91
98 94 10 72 26
96 78 69 77 44
45 5 88 42 73
74 91 25 22 99
16 79 60 71 37
44 33 34 27 87
46 89 75 37 4
71 63 16 35 17
83 99 28 51 97
66 86 14 61 9
2 54 7 32 79
33 36 37 35 81
25 50 84 59 21
18 16 48 26 15
94 73 61 67 44
18 34 66 57 31
74 92 71 59 19
36 94 16 80 24
35 54 58 87 64
73 90 41 49 88
74 5 57 40 21
61 11 50 80 66
35 58 52 10 56
92 67 82 46 72
32 18 33 34 55
66 79 27 24 46
98 4 30 80 49
19 23 68 18 90
41 91 83 63 77
84 12 8 10 21
23 47 58 5 20
30 32 61 6 28
24 11 8 33 10
52 93 95 0 45
22 27 3 82 40
11 51 47 83 38
28 85 9 10 48
80 60 46 55 32
89 14 90 71 50
0 65 24 40 19
12 2 37 62 93
78 69 53 43 33
85 76 26 21 92
36 54 89 46 91
29 18 72 9 51
82 36 47 95 30
65 2 98 92 12
93 73 44 48 6
31 74 62 27 42
32 13 11 99 50
89 31 94 1 78
77 24 46 64 26
11 16 28 30 45
80 22 5 8 52
32 38 76 65 90
92 96 35 86 51
47 75 17 87 30
43 29 55 50 11
77 99 48 24 20
37 7 91 23 8
26 12 82 95 78
41 65 80 53 44
75 43 32 46 84
63 99 69 45 88
56 48 87 38 49
8 87 21 27 15
84 44 26 61 82
10 66 29 95 65
4 86 38 91 28
14 49 22 52 54
27 43 13 35 33
20 66 77 70 31
5 17 94 98 83
11 22 39 55 75
53 61 46 38 89
84 49 52 32 51
90 46 97 91 54
2 42 65 10 25
80 77 31 81 16
58 17 15 26 55
19 83 57 21 95
4 29 11 64 0
17 63 13 27 58
14 96 43 22 56
97 84 81 67 94
47 49 4 70 65
60 88 9 77 3
63 72 33 50 97
68 84 98 78 89
10 79 25 24 54
81 70 39 73 11
86 30 38 14 91
9 18 72 21 24
54 83 80 78 66
23 93 36 31 53
34 58 18 69 28
57 70 54 50 64
35 36 4 56 72
32 16 45 33 17
83 60 39 22 47
31 73 56 21 63
66 14 42 45 80
60 57 47 36 78
93 75 44 22 11
68 89 58 88 17
74 16 65 13 45
86 20 6 34 15
70 46 59 75 57
28 62 67 71 98
77 63 25 61 64
71 20 42 65 47
29 80 53 78 99
70 57 18 45 32
86 46 35 77 26
15 91 93 55 67
27 16 31 41 42
77 34 10 90 18
28 99 44 20 68
98 82 3 75 62
88 85 47 17 71
31 95 98 60 93
80 81 23 35 70
4 57 38 69 76
18 0 41 86 54
47 26 90 65 39
79 86 59 66 50
49 64 65 95 6
90 67 36 32 46
10 20 25 27 1
87 21 17 78 13
16 8 95 35 43
14 0 72 89 68
52 11 12 67 25
63 64 13 32 15
53 98 55 81 75
51 85 15 91 10
24 68 80 22 8
55 18 36 30 66
27 21 46 63 26
81 5 14 2 13
71 39 19 40 69
58 70 65 46 78
98 14 59 94 60
12 55 68 91 0
18 35 25 61 86
85 74 56 43 44
98 78 17 95 8
70 30 66 55 94
57 62 82 49 77
61 32 97 88 58
23 1 53 65 30
45 15 9 26 28
2 21 42 27 12
84 68 71 19 13
58 57 35 77 14
###

15
input/day/5-example.http Normal file
View File

@@ -0,0 +1,15 @@
POST http://localhost:5001/advent-of-code-2021-911a8/europe-west1/day-5
Content-Type: text/plain
0,9 -> 5,9
8,0 -> 0,8
9,4 -> 3,4
2,2 -> 2,1
7,0 -> 7,4
6,4 -> 2,0
0,9 -> 2,9
3,4 -> 1,4
0,0 -> 8,8
5,5 -> 8,2
###

505
input/day/5.http Normal file
View File

@@ -0,0 +1,505 @@
POST http://localhost:5001/advent-of-code-2021-911a8/europe-west1/day-5
Content-Type: text/plain
777,778 -> 777,676
500,510 -> 378,510
441,657 -> 441,638
724,480 -> 724,778
702,85 -> 44,85
973,961 -> 28,16
913,125 -> 483,125
714,895 -> 870,739
273,774 -> 273,795
623,450 -> 623,616
157,49 -> 987,879
430,775 -> 382,775
58,938 -> 718,278
290,366 -> 604,680
75,252 -> 760,937
46,947 -> 788,205
731,197 -> 28,197
25,15 -> 964,954
317,440 -> 66,691
166,427 -> 544,805
686,800 -> 50,164
858,569 -> 447,569
596,50 -> 596,327
739,218 -> 739,278
382,852 -> 382,960
11,984 -> 970,25
911,390 -> 790,511
739,299 -> 739,254
989,172 -> 989,567
36,335 -> 249,335
60,900 -> 121,900
299,380 -> 299,178
701,932 -> 701,224
626,282 -> 641,282
83,532 -> 83,91
246,125 -> 95,125
73,446 -> 308,446
902,907 -> 26,31
841,298 -> 841,547
264,737 -> 974,27
170,199 -> 170,120
135,428 -> 319,244
431,240 -> 431,691
406,935 -> 889,935
192,526 -> 192,82
236,54 -> 236,574
667,369 -> 667,559
501,42 -> 620,42
130,973 -> 208,973
213,639 -> 542,639
943,266 -> 247,962
545,864 -> 423,864
252,698 -> 359,698
314,501 -> 314,948
203,974 -> 472,974
947,125 -> 175,897
956,544 -> 512,544
862,264 -> 549,577
606,138 -> 606,862
239,123 -> 902,786
201,643 -> 201,473
916,375 -> 916,807
10,10 -> 988,988
490,659 -> 490,559
72,66 -> 967,961
215,225 -> 215,281
930,856 -> 203,856
172,481 -> 172,23
867,684 -> 349,166
843,45 -> 843,971
250,779 -> 884,779
973,464 -> 973,794
543,868 -> 39,364
968,424 -> 968,289
470,489 -> 936,489
411,573 -> 411,206
120,691 -> 120,401
134,649 -> 412,649
452,203 -> 452,597
155,604 -> 155,278
914,854 -> 685,854
38,972 -> 975,35
153,403 -> 418,403
731,152 -> 295,588
242,560 -> 513,289
930,619 -> 506,195
547,320 -> 899,320
237,368 -> 479,126
417,842 -> 26,842
213,581 -> 506,288
741,597 -> 742,596
79,440 -> 79,108
424,946 -> 985,946
535,833 -> 716,833
249,328 -> 772,328
616,905 -> 981,905
46,877 -> 227,877
841,770 -> 747,770
202,44 -> 633,475
556,354 -> 556,829
617,864 -> 129,376
318,310 -> 318,927
259,300 -> 259,485
167,482 -> 167,265
349,184 -> 885,184
616,199 -> 921,199
710,162 -> 710,373
499,87 -> 499,214
905,51 -> 258,51
134,739 -> 858,739
879,428 -> 496,45
208,599 -> 208,908
68,225 -> 268,225
581,456 -> 86,456
898,318 -> 278,318
84,910 -> 940,54
344,206 -> 798,660
51,75 -> 909,933
783,780 -> 94,91
907,935 -> 808,836
556,736 -> 556,592
39,611 -> 859,611
29,73 -> 29,438
898,390 -> 898,518
777,647 -> 163,33
144,962 -> 523,962
827,676 -> 469,318
267,647 -> 360,647
742,438 -> 660,438
214,76 -> 214,873
550,177 -> 923,550
182,191 -> 329,191
765,737 -> 765,118
387,322 -> 895,322
174,785 -> 714,245
733,453 -> 852,453
497,136 -> 131,502
574,931 -> 574,568
282,198 -> 282,412
971,324 -> 940,355
827,358 -> 130,358
954,726 -> 311,83
207,195 -> 936,195
42,935 -> 921,56
955,46 -> 35,966
627,361 -> 627,888
37,202 -> 91,202
697,599 -> 155,57
227,264 -> 285,264
50,790 -> 797,43
717,693 -> 88,64
145,234 -> 628,234
358,791 -> 835,791
765,739 -> 765,888
900,204 -> 581,204
544,789 -> 367,789
508,424 -> 689,424
23,964 -> 976,11
404,728 -> 404,949
327,891 -> 327,431
596,204 -> 596,95
686,201 -> 686,982
132,836 -> 132,11
574,434 -> 574,862
41,60 -> 936,955
283,246 -> 283,11
29,226 -> 962,226
483,916 -> 483,562
962,913 -> 131,82
455,316 -> 729,42
858,503 -> 165,503
795,68 -> 388,475
697,477 -> 986,477
932,633 -> 932,114
376,730 -> 270,730
598,672 -> 833,672
69,46 -> 935,46
178,95 -> 862,779
633,73 -> 34,672
488,690 -> 517,661
784,450 -> 784,986
955,560 -> 955,760
651,959 -> 172,480
406,330 -> 406,439
955,737 -> 987,737
194,272 -> 843,921
18,553 -> 93,553
422,387 -> 249,387
318,79 -> 494,79
181,814 -> 709,814
63,62 -> 987,986
636,357 -> 162,357
973,15 -> 27,961
444,415 -> 58,415
884,531 -> 447,968
320,928 -> 73,928
154,357 -> 426,357
200,482 -> 367,315
505,872 -> 505,861
314,432 -> 502,244
912,676 -> 912,618
683,590 -> 881,788
761,708 -> 761,758
40,941 -> 543,438
847,370 -> 801,370
701,297 -> 619,297
140,618 -> 725,618
72,24 -> 968,920
767,396 -> 434,63
710,918 -> 213,421
917,770 -> 92,770
20,979 -> 987,12
909,62 -> 152,62
932,987 -> 56,111
460,382 -> 797,719
518,388 -> 964,388
456,299 -> 456,15
84,783 -> 786,783
982,669 -> 58,669
140,156 -> 140,130
613,264 -> 613,582
267,636 -> 267,805
141,631 -> 762,631
575,26 -> 243,358
318,900 -> 704,514
118,914 -> 118,757
952,846 -> 99,846
673,353 -> 673,633
422,130 -> 228,130
738,52 -> 717,73
307,307 -> 126,307
484,161 -> 942,619
576,886 -> 52,362
375,297 -> 505,297
950,82 -> 243,789
411,57 -> 411,844
879,137 -> 879,334
483,703 -> 483,213
192,24 -> 74,142
561,286 -> 263,584
493,121 -> 493,604
715,576 -> 715,945
238,258 -> 461,258
331,470 -> 851,470
435,22 -> 435,273
315,377 -> 135,557
128,195 -> 794,861
391,143 -> 391,580
33,680 -> 814,680
611,50 -> 611,79
650,28 -> 650,57
196,538 -> 622,964
333,222 -> 333,457
313,254 -> 803,254
508,581 -> 41,581
40,411 -> 55,411
458,600 -> 775,283
105,678 -> 105,345
397,546 -> 814,963
915,669 -> 915,793
773,952 -> 395,574
884,198 -> 404,198
408,929 -> 408,623
123,158 -> 340,158
418,927 -> 757,588
304,338 -> 304,990
505,184 -> 505,28
938,869 -> 938,181
11,959 -> 949,21
232,949 -> 232,660
479,826 -> 479,69
323,427 -> 834,427
460,385 -> 460,94
199,529 -> 493,823
767,58 -> 134,691
901,320 -> 861,320
31,354 -> 28,354
335,165 -> 980,810
586,394 -> 277,394
106,807 -> 567,346
814,987 -> 79,987
166,766 -> 166,990
883,213 -> 676,420
458,454 -> 936,454
878,953 -> 878,682
868,340 -> 868,503
778,252 -> 778,159
237,611 -> 928,611
221,357 -> 643,779
793,775 -> 509,491
719,78 -> 719,878
764,722 -> 107,65
696,323 -> 696,816
49,726 -> 385,726
730,974 -> 386,974
973,310 -> 973,748
12,173 -> 200,173
164,482 -> 473,482
802,807 -> 648,807
104,843 -> 747,843
154,919 -> 802,271
919,837 -> 150,837
882,930 -> 882,752
717,468 -> 461,468
925,112 -> 925,329
714,688 -> 714,66
35,781 -> 737,79
644,139 -> 819,139
340,500 -> 340,195
10,909 -> 524,909
914,790 -> 82,790
962,271 -> 257,976
352,170 -> 352,239
666,39 -> 614,39
854,937 -> 818,901
88,865 -> 852,101
121,796 -> 907,10
836,572 -> 836,649
976,953 -> 976,54
566,584 -> 566,216
927,702 -> 927,703
896,441 -> 896,741
20,30 -> 958,968
934,804 -> 238,804
562,323 -> 12,323
789,550 -> 356,550
906,225 -> 906,886
513,819 -> 513,157
129,80 -> 977,928
37,815 -> 50,802
325,30 -> 899,604
183,614 -> 647,614
497,170 -> 662,170
598,134 -> 228,134
57,636 -> 57,390
11,938 -> 649,300
911,952 -> 850,952
35,950 -> 698,950
161,239 -> 536,239
359,569 -> 359,238
711,945 -> 599,945
866,756 -> 866,987
674,978 -> 96,400
254,653 -> 254,590
655,810 -> 256,810
942,892 -> 394,344
895,744 -> 895,408
549,478 -> 395,478
162,193 -> 162,527
347,242 -> 823,242
251,867 -> 251,77
167,233 -> 285,233
189,969 -> 866,292
847,118 -> 52,913
206,650 -> 131,725
34,790 -> 34,824
872,441 -> 475,838
242,538 -> 718,62
456,514 -> 233,514
384,761 -> 640,761
782,388 -> 782,949
928,809 -> 928,618
461,415 -> 869,823
240,487 -> 215,487
970,687 -> 737,920
63,749 -> 63,493
274,99 -> 462,99
941,989 -> 58,106
142,594 -> 788,594
120,705 -> 535,705
680,248 -> 631,248
544,807 -> 544,737
972,606 -> 972,706
846,800 -> 84,38
836,108 -> 35,909
691,290 -> 691,377
979,883 -> 293,197
766,851 -> 955,851
737,551 -> 713,551
247,70 -> 247,592
855,153 -> 715,13
432,263 -> 797,263
495,839 -> 184,839
544,923 -> 544,45
887,676 -> 875,676
922,230 -> 922,900
168,612 -> 31,749
505,446 -> 625,326
504,370 -> 504,511
943,538 -> 943,784
653,40 -> 653,712
613,973 -> 760,973
152,824 -> 550,426
335,35 -> 57,313
614,334 -> 614,938
399,205 -> 961,767
387,903 -> 583,903
218,395 -> 190,395
935,524 -> 935,402
821,111 -> 821,372
609,621 -> 220,621
503,288 -> 467,324
641,139 -> 641,369
420,924 -> 420,532
344,504 -> 344,698
340,96 -> 169,96
835,505 -> 640,700
464,344 -> 464,133
946,396 -> 946,10
295,313 -> 437,171
330,286 -> 291,286
608,653 -> 608,613
360,410 -> 749,410
115,288 -> 115,334
915,550 -> 915,858
902,16 -> 143,775
201,901 -> 170,932
37,968 -> 987,18
40,332 -> 586,878
271,407 -> 271,858
836,674 -> 624,674
308,715 -> 361,715
733,818 -> 449,818
23,36 -> 862,875
278,655 -> 685,655
924,764 -> 924,913
479,250 -> 850,621
312,116 -> 468,272
10,954 -> 891,73
554,313 -> 918,677
846,773 -> 846,476
681,948 -> 681,961
418,835 -> 263,835
352,222 -> 557,222
782,188 -> 782,11
609,845 -> 954,845
866,882 -> 310,882
479,180 -> 119,540
278,866 -> 140,866
874,617 -> 505,617
491,942 -> 280,942
584,574 -> 839,829
475,466 -> 620,466
652,215 -> 652,85
906,746 -> 906,824
381,317 -> 749,685
294,837 -> 294,165
450,893 -> 430,893
99,374 -> 99,864
919,313 -> 99,313
187,91 -> 187,304
654,982 -> 654,324
662,223 -> 471,223
848,554 -> 848,13
14,851 -> 14,855
438,287 -> 531,287
611,277 -> 309,277
630,379 -> 630,99
621,531 -> 787,531
12,292 -> 12,11
18,985 -> 162,985
49,919 -> 530,438
329,828 -> 369,868
725,976 -> 725,267
826,591 -> 826,562
249,651 -> 280,651
467,461 -> 759,461
720,968 -> 745,968
414,29 -> 54,389
204,740 -> 91,853
694,300 -> 694,393
517,748 -> 517,231
465,946 -> 718,946
252,322 -> 902,972
109,641 -> 692,641
973,969 -> 104,100
302,368 -> 302,914
385,19 -> 385,192
460,851 -> 387,851
310,221 -> 660,571
684,147 -> 642,147
371,711 -> 169,913
810,727 -> 810,559
428,576 -> 88,236
381,33 -> 655,307
37,428 -> 37,68
11,29 -> 962,980
880,698 -> 227,45
624,361 -> 624,351
487,917 -> 183,613
725,498 -> 725,889
880,71 -> 27,924
856,752 -> 274,752
541,419 -> 516,419
803,688 -> 152,37
835,304 -> 964,304
480,249 -> 74,655
742,883 -> 213,883
943,41 -> 378,41
869,924 -> 869,563
###