Compare commits

...

4 Commits

12 changed files with 795 additions and 1 deletions

94
functions/src/Grid.ts Normal file
View File

@@ -0,0 +1,94 @@
import Vector2 from "./vector2";
class Grid<T> {
data: T[];
outOfBoundsResult?: T;
maxX: number;
maxY: number;
constructor(data: T[], maxX: number, outOfBoundsResult: T | undefined = undefined) {
if (data.length % maxX !== 0) throw Error("Invalid grid data length, must be a multiple of the width");
this.data = data;
this.outOfBoundsResult = outOfBoundsResult;
this.maxX = maxX;
this.maxY = this.data.length / maxX;
}
at(x: number, y: number): T {
if (!this.isInBounds(x, y)) {
if (this.outOfBoundsResult) {
return this.outOfBoundsResult
} else {
throw Error(`Invalid coordinate: (${x}, ${y})`);
}
}
return this.data[this.index(x, y)];
}
setAt(x: number, y: number, value: T): void {
if (!this.isInBounds(x, y)) {
throw Error(`Invalid coordinate: (${x}, ${y})`);
}
this.data[this.index(x, y)] = value;
}
allPositions(): Vector2[] {
const res =[];
for (let y = 0; y < this.maxY; y++) {
for (let x = 0; x < this.maxX; x++) {
res.push(new Vector2(x, y));
}
}
return res;
}
isInBounds(x: number, y: number): boolean {
return x >= 0 && x < this.maxX && y >= 0 && y < this.maxY;
}
inBoundsNeighbors(x: number, y: number, includeDiagonal = false): Vector2[] {
const res = [
new Vector2(x + 1, y),
new Vector2(x - 1, y),
new Vector2(x, y + 1),
new Vector2(x, y - 1)
];
if (includeDiagonal) {
res.push(
new Vector2(x + 1, y + 1),
new Vector2(x + 1, y - 1),
new Vector2(x - 1, y + 1),
new Vector2(x - 1, y - 1)
);
}
return res.filter(v => this.isInBounds(v.x, v.y));
}
/**
* Pastes the given grid into this grid, with it's top left position at the given coordinate
*/
paste(grid: Grid<T>, posX: number, posY: number): void {
if (posX + grid.maxX > this.maxX || posY + grid.maxY > this.maxY) throw Error(`Can't paste grid at (${posX}, ${posY}), this grid is not big enough`);
for (let y = 0; y < grid.maxY; y++) {
for (let x = 0; x < grid.maxX; x++) {
this.setAt(posX + x, posY + y, grid.at(x, y));
}
}
}
index(x: number, y: number): number {
return x + y * this.maxX;
}
}
export default Grid;

151
functions/src/day14.ts Normal file
View File

@@ -0,0 +1,151 @@
import Day from "./day";
import Utils from "./utils";
type CharCounts = {[key: string]: bigint};
class Day14 implements Day {
part1(input: string[]): number | string {
const { orig, mapping } = Day14.parseInput(input);
let current = orig;
for (let step = 0; step < 10; step++) {
current = this.executeStep(current, mapping);
}
const counts: {[key: string]: number} = {};
for (const c of current) {
if (c in counts) {
counts[c]++;
} else {
counts[c] = 1;
}
}
return Math.max(...Object.values(counts)) - Math.min(...Object.values(counts));
}
private static parseInput(input: string[]): { orig: string, mapping: Map<string, Map<string, string>>} {
const orig = input[0];
const mapping = new Map<string, Map<string, string>>();
for (const line of input.slice(2)) {
const splitIndex = line.indexOf("->");
const from = line.substr(0, splitIndex).trim();
const firstChar = from[0];
const secondChar = from[1];
const to = line.substr(splitIndex + 2).trim();
const existingMapping = mapping.get(firstChar);
if (existingMapping) {
existingMapping.set(secondChar, to);
} else {
mapping.set(firstChar, new Map<string, string>([[secondChar, to]]));
}
}
return { orig, mapping };
}
private executeStep(orig: string, mapping: Map<string, Map<string, string>>): string {
let res = "";
for (let i = 0; i < orig.length - 1; i++) {
const char = orig[i];
res += char;
const firstCharMatch = mapping.get(char);
if (firstCharMatch) {
const secondChar = orig[i + 1];
const toAdd = firstCharMatch.get(secondChar);
if (toAdd) {
res += toAdd;
}
}
}
// Add the last character as it's not included in the result
res += orig[orig.length - 1];
return res;
}
part2(input: string[]): number | string {
const { orig, mapping } = Day14.parseInput(input);
const counts: CharCounts = {};
const cache = new Map<string, CharCounts>();
for (let i = 0; i < orig.length - 1; i++) {
const firstChar = orig[i];
const secondChar = orig[i + 1];
this.addOne(firstChar, counts);
this.mergeIntoLeft(counts, this.calculateRecursive(firstChar, secondChar, mapping, 40, cache));
}
this.addOne(orig[orig.length - 1], counts);
return (Utils.bigMax(Object.values(counts)) - Utils.bigMin(Object.values(counts))).toString();
}
/**
* Returns the amount of added element of each type
*/
calculateRecursive(firstChar: string, secondChar: string, mappings: Map<string, Map<string, string>>, stepsLeft: number, cache: Map<string, CharCounts>): CharCounts {
if (stepsLeft === 0) return {};
const cacheKey = firstChar + secondChar + stepsLeft;
const cachedResult = cache.get(cacheKey);
if (cachedResult) return cachedResult;
const res = {};
const firstCharMatch = mappings.get(firstChar);
if (firstCharMatch) {
const toAdd = firstCharMatch.get(secondChar);
if (toAdd) {
this.addOne(toAdd, res);
this.mergeIntoLeft(res, this.calculateRecursive(firstChar, toAdd, mappings, stepsLeft - 1, cache));
this.mergeIntoLeft(res, this.calculateRecursive(toAdd, secondChar, mappings, stepsLeft - 1, cache));
}
}
cache.set(cacheKey, res);
return res;
}
mergeIntoLeft(left: CharCounts, right: CharCounts): void {
for (const rightKey in right) {
if (rightKey in left) {
left[rightKey] += right[rightKey];
} else {
left[rightKey] = right[rightKey];
}
}
}
addOne(char: string, counts: CharCounts): void {
if (char in counts) {
counts[char]++;
} else {
counts[char] = 1n;
}
}
// calculateCounts(pair: string, mappings: Map<string, Map<string, string>>, cache: Map<string, Map<number, {[key: string]: bigint}>>): {[key: string]: bigint} {
//
//
//
// }
}
export default Day14;

80
functions/src/day15.ts Normal file
View File

@@ -0,0 +1,80 @@
import Day from "./day";
import Grid from "./Grid";
import Vector2 from "./vector2";
class Day15 implements Day {
part1(input: string[]): number | string {
return this.findLowestRiskScore(Day15.parseInput(input));
}
part2(input: string[]): number | string {
const grid = Day15.parseInput(input);
const bigGrid = new Grid(Array((grid.maxX * 5) * (grid.maxY * 5)).fill(0), grid.maxX * 5, Number.MAX_SAFE_INTEGER);
for (let y = 0; y < 5; y++) {
for (let x = 0; x < 5; x++) {
const subGrid = new Grid(grid.data.map(c => c + x + y).map(c => c > 9 ? c % 9 : c), grid.maxX);
bigGrid.paste(subGrid, x * grid.maxX, y * grid.maxY);
}
}
return this.findLowestRiskScore(bigGrid);
}
private findLowestRiskScore(grid: Grid<number>): number {
const start = new Vector2(0, 0);
const destination = new Vector2(grid.maxX - 1, grid.maxY - 1);
const distances = new Grid(new Array(grid.data.length).fill(Number.MAX_SAFE_INTEGER), grid.maxX);
distances.setAt(start.x, start.y, 0);
const searchStack = [start];
while (searchStack.length > 0) {
// Simulate a priority queue on distance:
searchStack.sort((a, b) => distances.at(b.x, b.y) - distances.at(a.x, a.y));
const cur = searchStack.pop();
if (!cur) throw Error("???");
if (cur.x === destination.x && cur.y === destination.y) {
break;
}
const curDist = distances.at(cur.x, cur.y);
const neighbors = grid.inBoundsNeighbors(cur.x, cur.y);
for (const neighbor of neighbors) {
const newDist = curDist + grid.at(neighbor.x, neighbor.y);
if (newDist < distances.at(neighbor.x, neighbor.y)) {
distances.setAt(neighbor.x, neighbor.y, newDist);
searchStack.push(neighbor);
}
}
}
return distances.at(destination.x, destination.y);
}
private static parseInput(input: string[]): Grid<number> {
return new Grid<number>(
input.flatMap(l => l.split("").map(n => parseInt(n))),
input[0].length, Number.MAX_SAFE_INTEGER);
}
}
export default Day15;

150
functions/src/day16.ts Normal file
View File

@@ -0,0 +1,150 @@
import Day from "./day";
import Utils from "./utils";
class Day16 implements Day {
part1(input: string[]): number | string {
const packet = Packet.parse(input[0]);
return Day16.recursiveSumVersionNumbers(packet);
}
part2(input: string[]): number | string {
return Packet.parse(input[0]).calculateValue().toString();
}
static recursiveSumVersionNumbers(packet: Packet): number {
if (typeof packet.content === "bigint") {
return packet.version;
} else {
return packet.version + Utils.sum(packet.content.map(sp => Day16.recursiveSumVersionNumbers(sp)));
}
}
}
class Packet {
static readonly SUM_TYPE = 0
static readonly PROD_TYPE = 1;
static readonly MIN_TYPE = 2;
static readonly MAX_TYPE = 3;
static readonly LITERAL_TYPE = 4;
static readonly GT_TYPE = 5;
static readonly LT_TYPE = 6;
static readonly EQ_TYPE = 7;
static readonly VERSION_LENGTH = 3;
static readonly TYPE_LENGTH = 3;
static readonly LENGTH_TYPE_LENGTH = 1;
static readonly SUBPACKET_SIZE_LENGTH = 15;
static readonly SUBPACKET_COUNT_LENGTH = 11;
static readonly LITERAL_PART_LENGTH = 5;
version: number;
type: number;
content: Packet[] | bigint
binaryLength: number;
constructor(version: number, type: number, content: Packet[] | bigint, binaryLength: number) {
this.version = version;
this.type = type;
this.content = content;
this.binaryLength = binaryLength;
}
calculateValue(): bigint {
if (typeof this.content === "bigint") return this.content;
const subValues = this.content.map(c => c.calculateValue());
if (this.type === Packet.SUM_TYPE) {
return Utils.bigSum(subValues)
} else if (this.type === Packet.PROD_TYPE) {
return subValues.reduce((a, b) => a * b, 1n);
} else if (this.type === Packet.MIN_TYPE) {
return Utils.bigMin(subValues);
} else if (this.type === Packet.MAX_TYPE) {
return Utils.bigMax(subValues);
} else if (this.type === Packet.GT_TYPE) {
return subValues[0] > subValues[1] ? 1n : 0n;
} else if (this.type === Packet.LT_TYPE) {
return subValues[0] < subValues[1] ? 1n : 0n;
} else if (this.type === Packet.EQ_TYPE) {
return subValues[0] === subValues[1] ? 1n : 0n;
} else {
// Shouldn't happen
throw Error("Unsupported packet type: " + this.type);
}
}
static parse(input: string): Packet {
return this.parseBinaryInput(Packet.toBinary(input));
}
static toBinary(input: string): string {
return input.split("").map(s => parseInt(s, 16).toString(2).padStart(4, "0")).join("");
}
static parseBinaryInput(binaryInput: string, start = 0): Packet {
const version = parseInt(binaryInput.substr(start, Packet.VERSION_LENGTH), 2);
const type = parseInt(binaryInput.substr(start + Packet.VERSION_LENGTH, Packet.TYPE_LENGTH), 2);
const contentStart = start + Packet.VERSION_LENGTH + Packet.TYPE_LENGTH;
if (type === Packet.LITERAL_TYPE) {
// Literal value
let i = 0;
let binaryLiteral = "0b";
do {
binaryLiteral += binaryInput.substr(contentStart + (Packet.LITERAL_PART_LENGTH * i) + 1, Packet.LITERAL_PART_LENGTH - 1);
i++;
} while(binaryInput[contentStart + (Packet.LITERAL_PART_LENGTH * (i - 1))] === "1")
return new Packet(version, type, BigInt(binaryLiteral), Packet.VERSION_LENGTH + Packet.TYPE_LENGTH + (Packet.LITERAL_PART_LENGTH * i))
} else {
// Operator packets, so let's parse the subpackets:
const lengthType = binaryInput[contentStart];
if (lengthType === "0") {
const subpacketsLength = parseInt(binaryInput.substr(contentStart + Packet.LENGTH_TYPE_LENGTH, Packet.SUBPACKET_SIZE_LENGTH), 2);
const firstPacketStart = contentStart + Packet.LENGTH_TYPE_LENGTH + Packet.SUBPACKET_SIZE_LENGTH;
let curStart = firstPacketStart;
const subPackets = [];
while (curStart - firstPacketStart < subpacketsLength) {
const subPacket = this.parseBinaryInput(binaryInput, curStart);
curStart += subPacket.binaryLength;
subPackets.push(subPacket);
}
return new Packet(version, type, subPackets, curStart - start);
} else {
const subpacketCount = parseInt(binaryInput.substr(contentStart + Packet.LENGTH_TYPE_LENGTH, Packet.SUBPACKET_COUNT_LENGTH), 2);
let curStart = contentStart + Packet.LENGTH_TYPE_LENGTH + Packet.SUBPACKET_COUNT_LENGTH;
const subPackets = [];
for (let i = 0; i < subpacketCount; i++) {
const subPacket = this.parseBinaryInput(binaryInput, curStart);
curStart += subPacket.binaryLength;
subPackets.push(subPacket);
}
return new Packet(version, type, subPackets, curStart - start);
}
}
}
}
export default Day16;

View File

@@ -15,6 +15,9 @@ import Day10 from "./day10";
import Day11 from "./day11";
import Day12 from "./day12";
import Day13 from "./day13";
import Day14 from "./day14";
import Day15 from "./day15";
import Day16 from "./day16";
// // Start writing Firebase Functions
@@ -44,6 +47,9 @@ export const day = {
11: functions.region("europe-west1").https.onRequest((request, response) => { processDay(new Day11(), request, response) }),
12: functions.region("europe-west1").https.onRequest((request, response) => { processDay(new Day12(), request, response) }),
13: functions.region("europe-west1").https.onRequest((request, response) => { processDay(new Day13(), request, response) }),
14: functions.region("europe-west1").https.onRequest((request, response) => { processDay(new Day14(), request, response) }),
15: functions.region("europe-west1").https.onRequest((request, response) => { processDay(new Day15(), request, response) }),
16: functions.region("europe-west1").https.onRequest((request, response) => { processDay(new Day16(), request, response) }),
}

View File

@@ -21,6 +21,14 @@ class Utils {
return values.reduce((a, b) => a + b);
}
static bigMax(values: bigint[]): bigint {
return values.reduce((a, b) => a > b ? a : b);
}
static bigMin(values: bigint[]): bigint {
return values.reduce((a, b) => a < b ? a : b);
}
static zeroes(length: number): number[] {
const res = [];
@@ -31,4 +39,4 @@ class Utils {
}
}
export default Utils;
export default Utils;

23
input/day/14-example.http Normal file
View File

@@ -0,0 +1,23 @@
POST http://localhost:5001/advent-of-code-2021-911a8/europe-west1/day-14
Content-Type: text/plain
NNCB
CH -> B
HH -> N
CB -> H
NH -> C
HB -> C
HC -> B
HN -> C
NN -> C
BH -> H
NC -> B
NB -> B
BN -> B
BB -> N
BC -> B
CC -> N
CN -> C
###

107
input/day/14.http Normal file
View File

@@ -0,0 +1,107 @@
POST http://localhost:5001/advent-of-code-2021-911a8/europe-west1/day-14
Content-Type: text/plain
CNBPHFBOPCSPKOFNHVKV
CS -> S
FB -> F
VK -> V
HO -> F
SO -> K
FK -> B
VS -> C
PS -> H
HH -> P
KH -> V
PV -> V
CB -> N
BB -> N
HB -> B
HV -> O
NC -> H
NF -> B
HP -> B
HK -> S
SF -> O
ON -> K
VN -> V
SB -> H
SK -> H
VH -> N
KN -> C
CC -> N
BF -> H
SN -> N
KP -> B
FO -> N
KO -> V
BP -> O
OK -> F
HC -> B
NH -> O
SP -> O
OO -> S
VC -> O
PC -> F
VB -> O
FF -> S
BS -> F
KS -> F
OV -> P
NB -> O
CF -> F
SS -> V
KV -> K
FP -> F
KC -> C
PF -> C
OS -> C
PN -> B
OP -> C
FN -> F
OF -> C
NP -> C
CK -> N
BN -> K
BO -> K
OH -> S
BH -> O
SH -> N
CH -> K
PO -> V
CN -> N
BV -> F
FV -> B
VP -> V
FS -> O
NV -> P
PH -> C
HN -> P
VV -> C
NK -> K
CO -> N
NS -> P
VO -> P
CP -> V
OC -> S
PK -> V
NN -> F
SC -> P
BK -> F
BC -> P
FH -> B
OB -> O
FC -> N
PB -> N
VF -> N
PP -> S
HS -> O
HF -> N
KK -> C
KB -> N
SV -> N
KF -> K
CV -> N
NO -> P
###

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

@@ -0,0 +1,15 @@
POST http://localhost:5001/advent-of-code-2021-911a8/europe-west1/day-15
Content-Type: text/plain
1163751742
1381373672
2136511328
3694931569
7463417111
1319128137
1359912421
3125421639
1293138521
2311944581
###

105
input/day/15.http Normal file
View File

@@ -0,0 +1,105 @@
POST http://localhost:5001/advent-of-code-2021-911a8/europe-west1/day-15
Content-Type: text/plain
6763679391685199321216293379889971448824578974299594779321588588854917594121939988499223486918759869
2316279872424397812389627435928425571522864993268981993135231281632931912219714272492398841364337743
2611672912699479934143747711184533124498991233998359921827688713818629591848267212751251782193999574
6912169338419564193119921496213581987492424159798957517399336988989137775762957929689971478512677295
3932311559122894111729688681511182241159886994773792138139838569578133999317372937113824879568115791
8589559297931592498862929729979441917281114429312571991515483885553657942311696693187113914917719999
8215113889897867537369472795288394514311281463548681147471413974111467312128797923211571493578216618
8353591188598582985969267941199579989219858339399879528759128156699712595424919231926423577793888319
7968158785991328349741182178823359987435932199259784623665394822298984991599994974239363919518451979
4719769796126416122596629937853975319746131691284132121869728172317997172141428897895794796191812167
3715796581651751161784761598687561271125699522733481968514817818771137272533379148686393358399562697
8962557499696333687128936247423429275688421766599283984442229598921259494162139235897485497997417698
2182921896724715397151528121721594929388481339121986131936359796235664119251178868889159217485672977
2828391155451888689511271529962927197658791494698163842856727412981821697293253119184773912119989595
9199386341352517771926352819889757985144519361117599547314166929999995972716284565918358465675673988
8722511734918316438427142154119225846521916542121666685543317729394927826333442319376948819282625186
1477775698392989993392219356859976719258173183628158123159842811277192868899697572971451899974811444
8335153624471899974521698617192979799279846783499194279818499779819993698148766775278931949849681136
2269391966932443996719216591454851181957749968945583939554283869612267695171361752994867961193376666
9861712325484181139982862631919269143595262461191729137191664394921995697291311623719788971894557112
3112924177579979863258192877919454273941796893715949583554934558911631754244367342151872134159993285
2979941956219158611766883428493219185525886883611119191938587953596273121943489333147616528786997189
6911351423565397282381124199883475198396389555252699348494149975992869258195112131399297298977795897
9119199355931828419162999986929799583691289619982317919828137147697551391791243988459169917431599811
3848535265995589835498483569499111894179811797988524139731991816798915115719188982418358989615316197
9986394864159675512549196699791852181845314977319988969899439522116944611392429241976152135959496687
1761296827993117963817612129952997912232911828816999868511211229529681228381151777711719891779972859
9849862226991147961391718387156998929941716949984572288291485879679697217224997668438772548619172679
2896199355897526963449291963999361199143143424688187155899714182931423911884487471881515515658192867
8882999928819749128875119614594191789229917398195439659381686259712273461799994165868781999354911927
6293896891611311711917811764936777917992419746299291928141929236699957831472193155131929614221383779
1728911221599715849995857841992339722725816297697995975879639548179113113959417185128498668951991497
6389814779572888297744659943499321785461891927895956813219966863392927311261947592959791194244193985
4712939391449918111131972657951783573919121925419474446716964951423691926889216751829199971929971132
6699393113173611979749359993737683829563992223191989431431991486229753888571121391169999878623437521
1198142461644317844741991158835235118423789877114199729435917618739231152683794599876297129118987729
7111721965894267271711241998912592181993889216116948256156274679111482128896321191168811482813644926
1171113376212775991947216339497719768861872218996599392728399271322997169438555172469628987211141167
4971813199829153127388192731965829199759623126139328216651191296739154191919321549673351715616929225
8119853972258311171879982114156481797449119753397856132264122489141398797971999829792199497347937184
1561927699676538752366853298261467719967474391978893889187186993911227929965998393176697961138881969
3959543274866211216958741199781999369818266285521119327231111949788966823231813299914822949693166178
6854334615997742391438812963442348142383912111514912819499189236198343918618996193813217929982888331
8591288815988159958617116297298498195754511127153431788392191923719497543218299627991945622899279289
1198181911718723715273338822929941917461229991426187431333885549983141594522995949791148288364399931
9892771631174419697317439985991838611951224884481231136571449581393892332789397968799983813949946771
9691923978185936311116748722117898552719939491217617698689477616899284218259911527919573958121194566
1843959822758422286269513881221514742239331123871961146817735961867178733293667759597321611856364687
6977982858241122656318958728139689829747681724996991567112142583112379441312489192619155735979429668
6864883774995893992121211469519696127454667681591441917467229798514197759483539991821689423396931376
3192522673899612494271981219195459514965899598392186194369342687247433627873639189288865189581796451
6193892956996137113415685193111676238918282975948726168585412815746185395326782967392782846445773697
1188865911911546793619591679249496642955219194954776936299621427191849498935988721841952878212961283
8694399699295137671549998897263823738366959893492139427998171551895683249779412599116969296375488479
7877598934985997851215297123318237642987983729213129426654775659332934214699911779979746936272991192
4175196464729659417156311852378196911437496911391319497971434617443518159949999724995188783613191262
3762316191918893118954134928121247287121688294319514979584434758992189222213767189269961981712572193
9981882951928288197367958981851556961646895153776691782279112427148955797179663174911297574899971912
9895926311251443254199633719115569998677994839525436526347578387872641421492919519516711971912127392
9723333996192974279158728199716934988493621698998331467858916957375227137984979938714344915111827182
1489298994798826597544143761492942354121188712292616383251311951685245147566949991744458552776489586
3211451591643914838596299339712994772187111828984686683882184719386899356485897381553187228879431569
3259651629398171558779297578391789196514939231918933422179195617371647233469447869642991783645897982
2189951822939529117192393161419994119171944662568828111311499919463717394995779991162414161719332911
6899749988259797792429961362715358939636711635174199885892389153199229186421823334294179228734911269
1895185897772972825953599619294129599869824625386123522999289881519328792475665963443599326534417127
1422838395994495358964648891923798731481939992848921648929946289995168912914361941528948493335781149
1317917384867191387219277529343126299981599689294419264273884458618911827925925837774616338553561629
8982434966658784238385743322589831393888399172871716379119313128392163811311519839188471992219378467
5395261691648469592639393691332481954629942491921281189152991281859952918822165534198758892953939121
6329251216799321932117288219179141299519462991931239519193384798587198173781939892827679183111344218
3812529999729156619987867616929265585873977681595939647814448735791934148324446952891313111995972677
5282338992996313613159211993928283819929873988655191555399565229817638959377739269398838668781572226
4378531984893973581486991728926841115919613871448996179956749642471991995965911222685526627192999981
5982889739797551811388582535136873719759679761139313976924211474849296399512823999129477342278145322
1218281999719267672993931254981112865424986972187191477949981863168351999531146991641381242421214511
8911997846692872463596818916972951916181657731917916963182871214914196812971788959961183392597197251
4915117978531879932257171943259639189397181298918962191166572986181981965998337591167599159129997195
5161697792393852322887583417693725518643111468281969197221126116117739823199999132753611955461991483
6748848121519929146139951181494977716178656879667787982537212682114283552983879198195439947113885979
8162766788818429134853376715291665789982415877811787277133682815985779596453652213379733961271558178
7126616955919123997999947924157132389218111416139312121275578993825788959911541852194817157964691211
8145196921476116692616113197789995261996944598741116866263325522282139715958136659697393892119667448
9763151993822121312993191662941511916997145299292999193935168979452131598797394513569918623184664781
2292147194129589895647189423118915917258999813964921785795452817643488469847272158199168247483795532
8559629983984149491384859997366788978721291219851118825772145961874767133913997798554453199924989818
1182466299236599621536199516511164491992491155296741794213949818647429481999868811793169519371262165
4738281697798982828461677528585949457922936232449965278919419114997399511378492966791946451772819131
1757396912274429287116228948911154651917537842154149919872599997971951639199787486133851179929798555
1719739825171841761948755899899216798392923289899987521533913487812899954886369899998971639512215499
8791281434118421465514992618674529217949339778941898165388344994151819153515931268975815718393699133
5931698111196917992731929569985187236913914645973813563987549997719875759193672475788621993978779973
1884255199381966237561622788671247184371139285597612245451393421737133245891898958424829971676219425
2583899597668762774732855241679313519878428388682177491132991946939823251369684298843866186992234148
5571952912139441554944189828841898317272294283772779929696126131222992624995317231851888338393316119
8975999266148778637445788139847923481453515261188263961114697957477262989851194731696756118191947696
4382229563773717134612151111919923747618491994839882891451393414319819915995472618861242184413895712
2111697733928869231956532219642919971371939921939182129518341429926954783299694818222137624318218193
7918331918611351816139112921322828652131814891298482791235912154914156276127996537498197874799924122
7836996594939159837193584991869184956399715111271353229592112889346822858939489744779468277719668577
###

48
input/day/16-example.http Normal file
View File

@@ -0,0 +1,48 @@
POST http://localhost:5001/advent-of-code-2021-911a8/europe-west1/day-16
Content-Type: text/plain
D2FE28
###
POST http://localhost:5001/advent-of-code-2021-911a8/europe-west1/day-16
Content-Type: text/plain
38006F45291200
###
POST http://localhost:5001/advent-of-code-2021-911a8/europe-west1/day-16
Content-Type: text/plain
EE00D40C823060
###
POST http://localhost:5001/advent-of-code-2021-911a8/europe-west1/day-16
Content-Type: text/plain
8A004A801A8002F478
###
POST http://localhost:5001/advent-of-code-2021-911a8/europe-west1/day-16
Content-Type: text/plain
620080001611562C8802118E34
###
POST http://localhost:5001/advent-of-code-2021-911a8/europe-west1/day-16
Content-Type: text/plain
C0015000016115A2E0802F182340
###
POST http://localhost:5001/advent-of-code-2021-911a8/europe-west1/day-16
Content-Type: text/plain
A0016C880162017C3686B18A3D4780
###

7
input/day/16.http Normal file
View File

@@ -0,0 +1,7 @@
POST http://localhost:5001/advent-of-code-2021-911a8/europe-west1/day-16
Content-Type: text/plain
4054460802532B12FEE8B180213B19FA5AA77601C010E4EC2571A9EDFE356C7008E7B141898C1F4E50DA7438C011D005E4F6E727B738FC40180CB3ED802323A8C3FED8C4E8844297D88C578C26008E004373BCA6B1C1C99945423798025800D0CFF7DC199C9094E35980253FB50A00D4C401B87104A0C8002171CE31C41201062C01393AE2F5BCF7B6E969F3C553F2F0A10091F2D719C00CD0401A8FB1C6340803308A0947B30056803361006615C468E4200E47E8411D26697FC3F91740094E164DFA0453F46899015002A6E39F3B9802B800D04A24CC763EDBB4AFF923A96ED4BDC01F87329FA491E08180253A4DE0084C5B7F5B978CC410012F9CFA84C93900A5135BD739835F00540010F8BF1D22A0803706E0A47B3009A587E7D5E4D3A59B4C00E9567300AE791E0DCA3C4A32CDBDC4830056639D57C00D4C401C8791162380021108E26C6D991D10082549218CDC671479A97233D43993D70056663FAC630CB44D2E380592FB93C4F40CA7D1A60FE64348039CE0069E5F565697D59424B92AF246AC065DB01812805AD901552004FDB801E200738016403CC000DD2E0053801E600700091A801ED20065E60071801A800AEB00151316450014388010B86105E13980350423F447200436164688A4001E0488AC90FCDF31074929452E7612B151803A200EC398670E8401B82D04E31880390463446520040A44AA71C25653B6F2FE80124C9FF18EDFCA109275A140289CDF7B3AEEB0C954F4B5FC7CD2623E859726FB6E57DA499EA77B6B68E0401D996D9C4292A881803926FB26232A133598A118023400FA4ADADD5A97CEEC0D37696FC0E6009D002A937B459BDA3CC7FFD65200F2E531581AD80230326E11F52DFAEAAA11DCC01091D8BE0039B296AB9CE5B576130053001529BE38CDF1D22C100509298B9950020B309B3098C002F419100226DC
###