initial add

This commit is contained in:
John Alanbrook 2024-03-06 19:02:56 -06:00
commit 38f6ea249c
52 changed files with 9686 additions and 0 deletions

43
1.js Normal file
View file

@ -0,0 +1,43 @@
import { loadFile } from "std";
var data = loadFile("1.txt");
var lines = data.split("\n");
var amt = 0;
for (var i = 0; i < lines.length; i++) {
var match = lines[i].match(/\d/g);
if (!match) continue;
var num = match[0].concat(match[match.length-1]);
amt += Number(num);
}
console.log("Part 1:");
console.log(amt);
var nums = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"];
function num2n(str)
{
for (var i = 0; i < nums.length; i++)
if (nums[i] === str) return i.toString();
return undefined;
}
var amt = 0;
var lines = data.split("\n");
for (var i = 0; i < lines.length; i++) {
var match = [...lines[i].matchAll(/(?=(\d|one|two|three|four|five|six|seven|eight|nine))/g)].flat();
if (!match) continue;
if (match.length === 0) continue;
match = match.flatMap(function(m) {
if (!m) return undefined;
if (m.match(/\d/))
return m;
else
return num2n(m);
}).filter(x => x);
amt += Number(match[0].concat(match[match.length-1]));
}
console.log("Part 2:");
console.log(amt);

1000
1.txt Normal file

File diff suppressed because it is too large Load diff

188
10.js Normal file
View file

@ -0,0 +1,188 @@
import { loadFile } from "std";
var datafile = "10.txt";
var data = loadFile(datafile);
data = data.split('\n');
var c = -1;
var l = -1;
while (c === -1)
c = data[++l].search('S');
var nodes = {};
var animal = undefined;
function get_node(x,y) {
if (x < 0 || x >= data[0].length || y < 0 || y >= data.length) return undefined;
if (nodes[`${x},${y}`]) return nodes[`${x},${y}`];
var newnode = Object.create(node);
newnode.x=x;
newnode.y=y;
newnode.symbol = data[y][x];
if (newnode.symbol === 'S') {
animal = newnode;
var d = [];
if (animal.above()?.symbol.match(/[|7F]/)) d.push('U');
if (animal.below()?.symbol.match(/[JL|]/)) d.push('D');
if (animal.right()?.symbol.match(/[-J7]/)) d.push('R');
if (animal.left()?.symbol.match(/[-FL]/)) d.push('L');
if (d.find(x=>x==='D')) {
if (d.find(x=>x==='U')) newnode.symbol = '|';
else if (d.find(x=>x==='L')) newnode.symbol = '7';
else if (d.find(x=>x==='R')) newnode.symbol = 'F';
} else if (d.find(x=>x==='U')) {
if (d.find(x=>x==='L')) newnode.symbol = 'J';
else if (d.find(x=>x==='R')) newnode.symbol = 'L';
} else
newnode.symbol = '-';
}
nodes[`${x},${y}`] = newnode;
return newnode;
}
var node = {
x:0,
y:0,
symbol: "",
connected(n) {
/* true if this node is connected to the node at x,y */
if (!n) return false;
return (this.connections().find(x=>x===n) && n.connections().find(x=>x===this));
},
dirs() {
var dirs = [];
if (this.above()?.connected(this)) dirs.push('U');
if (this.right()?.connected(this)) dirs.push('R');
if (this.left()?.connected(this)) dirs.push('L');
if (this.below()?.connected(this)) dirs.push('D');
return dirs;
},
connections() {
var c = [];
switch (this.symbol) {
case 'S': c = [this.above(), this.below(), this.right(), this.left()]; break;
case '|': c = [this.above(), this.below()]; break;
case '-': c = [this.right(), this.left()]; break;
case 'L': c = [this.above(), this.right()]; break;
case 'J': c = [this.above(), this.left()]; break;
case '7': c = [this.below(), this.left()]; break;
case 'F': c = [this.right(), this.below()]; break;
case '.': c = [];
}
return c.filter(x=>x).filter(x=>x.symbol !== '.');
},
above() { return get_node(this.x, this.y-1); },
below() { return get_node(this.x, this.y+1); },
right() { return get_node(this.x+1, this.y); },
left() { return get_node(this.x-1, this.y); },
next(from) {
var c = this.connections();
if (!from) return c;
c = c.filter(x => x!==from);
return c[0];
},
dir(to) {
if (to === this.above()) return 'U';
if (to === this.below()) return 'D';
if (to === this.right()) return 'R';
if (to === this.left()) return 'L';
return undefined;
},
};
var s = get_node(c,l);
var ns = animal.connections();
var last = animal;
var n = ns[0]
n.stat = "loop";
animal.stat = "loop";
var i = 0;
function fill(node,val)
{
if (!node) return;
if (node.stat) return
if (val === 'loop') return;
node.stat = val;
var next = [node.above(), node.below(), node.right(), node.left()];
next = next.filter(x=>x).filter(x=> typeof x.stat === 'undefined');
return next;
}
function flood(node, val)
{
var nodes = [node];
while (nodes.length !== 0) {
var n = nodes.pop();
var newnodes = fill(n,val);
if (newnodes) nodes.push(...newnodes);
}
}
while (n !== animal) {
n.dist = ++i;
var l = n;
n = n.next(last);
last = l;
n.stat = "loop";
}
last = animal;
n = ns[1];
i = 0;
while (n !== animal && i < n.dist) {
n.dist = ++i;
var l = n;
n = n.next(last);
last = l;
}
console.log("Part 1:");
console.log(i);
console.log("Part 2:");
last = animal;
n = ns[0];
while (n !== animal) {
var dir = last.dir(n);
switch(dir) {
case 'U':
flood(last.left(), 'in');
flood(last.right(), 'out');
if (last.symbol === 'L') flood(last.below(), 'in');
else if (last.symbol === 'J') flood(last.below(), 'out');
break;
case 'D':
flood(last.left(), 'out');
flood(last.right(), 'in');
if (last.symbol === 'F') flood(last.above(), 'out');
else if (last.symbol === '7') flood(last.above(), 'in');
break;
case 'R':
flood(last.above(), 'in');
flood(last.below(), 'out');
if (last.symbol === 'F') flood(last.left(), 'in');
else if (last.symbol === 'L') flood(last.left(), 'out');
break;
case 'L':
flood(last.above(), 'out');
flood(last.below(), 'in');
if (last.symbol === 'J') flood(last.right(), 'in');
else if (last.symbol === '7') flood(last.right(), 'out');
break;
};
var l = n;
n = n.next(last);
last = l;
}
var stats = {
in:0,
out:0,
loop:0,
};
Object.values(nodes).forEach(n => stats[n.stat]++);
console.log(JSON.stringify(stats));

5
10.test Normal file
View file

@ -0,0 +1,5 @@
7-F7-
.FJ|7
SJLL7
|F--J
LJ.LJ

140
10.txt Normal file
View file

@ -0,0 +1,140 @@
7-LJ7.F-F77FF-77FJ-J-F7FF|777F7--..JJ.F.7.|.F-J7-J777F7FF77F|.|7L-7.F-|7F7FF-J7LF|.7--7J-F.F--7-L--77.|F-J77F7F|-F-F7-J-FFF---F--77|FF7--L7.
L7.F--J.L7J7|---FJ-|JLF77L7J7F|-J7|J.FLLJ.FFF7|F7L7-J7LF7.-|L-77-LL7J.|.L-7JFJ7-7J7L-LFJF-7-|7|-|FL--J|L77L-J|7|F|-7J.|LLJJL|.|JF7-|-|||L|-F
F|--7.L-7|.-L-|.|7-LL-J|L-|.FJJ7F-..F|.L|FLJL7F7|F.L-|-7LJL|JL77-.|7|7.J.LF-7FJ7JF-J||J|FL77LJJ-7-77||F--7JL-7-LJJF--77LLF7F7-|.JJ|||JFF-|JF
FJ|L7-FL-L7J|FL-|LJFL7-F|LJ--J.F-7F-7L7--7.|F7J|F|7.L||F7J-J.FFJ.LLF-7F..-|--JLJF7J.LF.LJ|L-JJ.|.LJ-LFF7|L7-L|-LF7|F|7--7LJF77|7|LF|7FJ|L|F|
|LF7L-7J||LF-FJ.|7FF-F--J-J-L-|JJLL.J.||L7-FF7|L-L-7F77L77FJFFLJ7|JL7F-77-L-JL--LJJ7L-77LJJJ|.FF-FJLL|L--L7F|JFLF7FLJ7FJJJFL7JJ77-7|LJL|.J-F
|7LJ-|L--L7|FF7F.F7F--7|J|LF.-L-F.|77FLJ.7|FJ|77|||F7L77JFF.F|FJ7|.L-L---7|.||L-JJF--L-|-||L|7LJFJ.F77.|7FFLJ.7JLLJ|L-J.LLJLJJF-7JF7JFJJ.|.|
L|JLLL-|.|--LJ-J7LLLJ.-7.FJL7-|||.F7-7J|FF7|FJFJL7F|L7L|FJ7|J|-|L7JJ|7-|.-F7L-7.LJ7.L|J..7|JL7LF7JF7LJFLF777FF7FFJ|F-JLF--|LLFJF-7|L.7||7..L
.|.F||L.FL-FL7F-JL|7...L7|7FL7|F-FJF-JLLFJLJ|J|-F--JFJ7FFJLJ-|L|7|.FJ-7..||L7|F7|7L-FJJFF|7-F7J||FJ|7LLLJLLLFJ|-7L777.--L7L-77.J|F-JLJ-F7|77
F7F7L-.F7FF..-|FJ7LLF|JF7JFJ7|FF7|F|||-LL--7|F77L--7L7F77-|.||.J---|.|L-7FJFJF|F7-7|.|.|L|-F||.||L7L7LL|J7||L7|.L7LFF7JJJ-77|L-L7.|7J|F-JL-J
L-J|7.F7-7.77.|JFFFF.--LJ.J-LL.F-LF-7-F7F--JLJ|F7JLL7||L7.777-|JLL-J-7LLLL7L-7F|||L-J-F--7.F||FJL7|FJ.||LF7F7||FFJLL||J|FF77F-J.7JF|F-J..7|J
|L-F7-J|L|7L-.|LLF77-|FJ|.L.|J.||-L7L-J|L----7||||F7|LJFJF--7FL7||.F7JFLL-L-7|FJL77FJFL-7L7FJ|L-7||L777J7|LJ||L-77|FJ||FFJ|7||.7JF|LJ|J.-L7|
J-FL--FF.LL-FLJ7..|LJL7J|7.L-.--7..L--7L---7FJ|||FJLJF-J|L7FJ-J|7JFLF-F7FFLFJ||F-JF7L|F7|FJ|FJF7|LJFJF7F7L-7LJF-JFFL7L7FJFJ||77J7FJFF|-||.-J
LFJ7|L-77||F|FLLF-|L-.|F77J|LL7F|-FFF7L---7|L7||||F--JF77.|L7JFF7F7|F-7LFFFJFJ||F-JL7FJLJ|FJL-J|L-7|J|LJ|F7L-7L7F7F7|FJL7L77LJ|F-J---L.LLJJJ
.LJFJ7LF7--J|L7|L--7|FFJL7.-7LJ7|F-7|L7F--J|F|LJ|||F-7|L-7|FJF-J|F-7L7|-F7L7L-J||F--JL--7||F--7L7FJ|FJF-J|L7LL7LJ|||||F7|FJ7F-FJ77|.||7.|J|7
FJ.7-JLJ-JFL|.|7LF|FF7L7FJ.||FJF7L7|L7|L--7|FJF7||||FJL-7|||LL7FJ|FJFJ|FJ|FL--7|||F77F7FJ||L-7L-JL7|L7|F7L7|F7L-7LJLJLJLJL-7J|FJLF7.F-7F7.77
FJLF7.L7JF7F-7777LJF|L7||F7-F-7|L-JL-JL7F-J|L7|LJ|LJL--7|LJL-7|L-JL7L7LJFJF7F-J||||L7||L7||F-JF7F7|L7|LJ|FJ|||F-JF-----7F7FJ7LJ--|F7|L--J-F7
L-LJL.|LF|L---FJ-LFJL7|||||JL7|L----7F-JL-7|||L7FJF----JL-7F-JL-7F7L7L-7|-||L7FJ|||FJ||FJ||L7FJLJ|L7|L-7LJFJ|||F7L--7F7LJLJF|F-.L|LFF-|J-FLJ
.L||F-7.LL-L7F|7.F-F-JLJ||L7|||FF-7FJL7LF-JL-JFJL7L-7F7F--JL7F-7||L-JF-JL7||FJL-J||L-J|L7|L7|L--7|FJ|F7L-7L7||LJ|F--J|L---7JJ|.FJF7|7-77L7JJ
7F|LJFJ.|JF77LF7J7F|F7F7LJFJFJL7L7|L-7L7L7F7F7L-7|F7LJ||F7F-JL7||L7F7|F7FJ||L-7F-JL--7L7||J|L7F-J|L7|||F7L7||L7FJL---JF7F-J..|..FJFLJF|--J.|
|L7--F-7-F7--7L|LFLLJLJ|F7L7L7FJFJL-7L7|.LJLJL7FJ||L--JLJ|L7F-JLJFJ||LJ||FJL7FJL-7F-7|FJ|L7|FJL-7|FJ|||||7||L7LJF-7F7FJLJ7-|-|-F7JFL7J.F-J-7
|LFJ7|.F-7LFJ-J|.|||-F7LJL7L-J||L-7FJFJ|F7F7F7|L-JL7LF7|FJFJL--7FJ-|L77||L7FJ|F--JL7||||L7||L7-FJ||FJ||||FJ|||F-JFLJLJJ.F-77-|J||LF7J.F-7--|
|.|.7-LL7|JLJ7FJ.FF--J|7-|L--7L7F7|L-JFJ|||LJ||F--7|FJL7|FJF7F7||F7L7L7||FJL7||F--7|||L7FJLJFJFJFJ|L7||||L7|FJL--7F---7FJFJJJF-JL-7JJ|..||.J
FF77.FL.L7.FF|J7-LL7F7L7F---7|FJ||L7F7L7||L-7||L7|LJL7FJ||.|||||LJL7L7LJ||F7||||F-J|||FJL--7L7L7|FL7LJ||L-JLJF--7|L7F-J|FJ|F7|F7F7|7FL--J7F.
|.L77|7L-77J7J|JFLLLJL7|L--7|||FJ|FLJL7||L7-|LJFJF-7FJL-JL7|LJLJF--J|L-7|LJ||||||JFJ||||-F7|FJFJL-7L-7||F-7F7L-7LJL|L7FJL--JLJ|LJLJ7J.L7L|-L
L-7L7--F|L|.F7L--7FF--JL7F-JLJ|L7|F--7|||FJFJF-J.L7|L--7F-JL-7F-JF-7F7FJ|F7|||||L7L7LJL7FJLJLSL-7FJ|FJLJL7LJ|F-JJF7|FJL7F---7FJ7-||JF7L|.|LJ
.FFJJ.FF.-L7.F-|-LFL---7|L---7L-J||F7LJ||L7L7|F7FFJL-7FJ|F7F-J|F7L7|||L7||LJLJ|L7|FJF--J|F--7|F-JL--JF---JF7LJF--JLJ|F-JL--7LJ.|7FF-|7FLJL7.
FF|.FF77-L-L-|7L-JLLF7FJ|F--7L--7|LJL7FJ|FJFJLJL7L-7FJL7|||L-7LJ|FJ|||L|||F--7|FJ|L7|F7FJ|F7LJL-----7|F-7FJ|F7|F---7LJF-7F7L--7-77L|J.JJ|FLJ
7LL7J|JJ7L-7.-L-|LF-JLJFJL-7|7F-JL--7|L7|L7L7F--JF7||F-JLJ|F7L7FJL7LJL7||||F7LJL7|-|LJ|L7||L-7|F7F--J||FJ|FJ|||||F7|F7L7|||F7FJ7||F-..J--7-J
|7J|JLF7-7.|7LJJ||L-7F7|-F7|L7L----7|L7||FJFJL-7FJ|||L7F--J||FJL-7L-7FJ||||||F7FJL-JF7L-J||F-JFJ|L--7LJL7|L7|||L7||LJL-J||||LJ-7-JJ|..|7.|7|
|-7.|.F|-7-LJ.L|F7F7LJ|L-JLJFJFF7F7||-||||FJF--J|FJ|L-J|F-7|||F--JF7|L-J|||||||L7F--J|F--J|L7FJFJF7FL-7FJ|FJ|LJFJ|L----7LJLJ.F777|--.|LL-7-7
L7|F-JJ.||FL-J77||||F-JF--7FJF7|LJLJ|FJ||||FJF--J|JL--7||FJ||||F7FJ||F--J||||||-LJFF7|L-77L7LJFJFJ|F7FJL-JL7|F-JFJF----JJ-LF-JL7F77.L|7FL7-F
J7-F77.-77--FLFFJLJ|L--JFFJ|FJ|L--7FJL7LJ||L7L--7L7F7FJLJ|FJ||LJ|L7|||F7F||||||F-7FJLJF-JF7L-7|-L7|||L-7F-7LJ|F7|FJF7F--7F-JF--J77L7LF-77|F|
|7-7FJ--J-7FJJ.L--7L7F7F7L7|L7|F7FJL7L|F-J|FJ.F-JFJ||L-7FJ|FJ|F-JJ|LJLJL7|||||||FJL--7L--J|FFJL7FJLJL7FJ|FL--J|LJL-JLJF-JL-7|F7LL-.|J|7.LL--
L|--JJJF-L7.|7-|JLL7LJLJL-JL-J|||L-7L7|L-7|L7FJF-JFJ|F7|L7||FJL-7FJF----J|||||LJ|F7F-JF---JFJF-JL-7F-JL7L-----JF7F7F--J7F7FJLJL-7F|JFL|.|7F.
||.FJFF|77|7JF7JLF7L---------7LJ|F-JFJL7FJ|FJ|FJF7|FJ|||FJ|||F--JL7|.F7F7||||L-7|||L7FJF7F7|FJF7F7||F7||F---7F7||||L-7F-JLJF----J--7|F-7|F|.
-J.-FF-F-LF7-|L7F|L---------7L-7LJF7L-7||FJ|FJL7|LJL7||||FJ|||F--7||FJ||||||L-7|||L7||FJ|||||FJ|||||||FJL7F7LJ||LJL--J|F7F7L--7F-7.L-|-L|-77
.L7LLJ|.FL||LL7L7L-----7F7F7L--JF7|L7F||LJFJ|FFJL-7FJ|||||FJ|||F-J|LJ|||||||F7|||L7|||L7||LJ||FJ|||||||F7LJL-7|L--7F-7LJ||L--7LJFJ77.--7L7F7
|.|F|F||77|L--JFJF7JF-7LJLJL----JLJFJFJL-7L7|FJF-7|L7|||||L7||||F7L7F-J|||LJ|LJ||FJ||L-J|L7FJ|L7|||||LJ|L----J|F--JL7|.FJL7F7L--JJ-LF|FFL-FL
F-F77-LJF-JF--7|FJ|FJFJF-----------J-L7F-JJ|||FJ||L7|||||L7||||||L7|L7FJLJF7L7FJ|L7|L--7|FJL7|7LJ|||L-7|F7F-7FJL7F--JL-JF-J|L----7.L-F-L.L7|
|F|JJ|7-L7FJ|FJLJFJL7L7L-7F7F----7F--7|L-7FJ||L-7|FJ||LJ|FJ||||||FJL7|L---J|-||FJFJ|F7FJ||F-J|F-7LJ|F-JLJLJFJL--J|F----7L7||F----J-|.|FFJ7L7
L-L7-J7.LLJ7FJF-7L-7L7|F7LJLJF--7LJF7|L7FJ|FJL7FJLJ.|L7FJL7LJLJLJL7FJ|F7F--JFJ|L7|FJ||L7|||F7|L7L--JL7F----JF--77|L---7L7|FJL---7J-7--.|.--J
F|LJ.7||J7JFJFJFJF-JFJLJ||F-7L-7|F7|LJL|L7|L7FJL---7L-J|F-JF--7F7F|L7LJ|L7F7L7|FJ||FJL7|LJ||||FJF7F--JL--7F7|F-JFJF7F7L7|LJF7F--J-J.FFL-7.LJ
L7J.--777|7L-JLL7|F7L--7L7|FJF-JLJLJ7F7|FJL7|L7F7F7|F--JL--JF-J||FJFJF-JFJ|L-J|L-J||FFJL-7LJ||L7|LJJF7F77LJLJL--JFJLJL-JL--JLJJ.|7-F-|J.L|.L
LFF|-|LLL-F-----JLJL7F7L7|||FJF7F---7||LJJ-LJLLJLJLJL-7F-7F7L7FJLJFJ7|F7L7|F--J.F-JL7|F-7L-7||FJ|F--JLJL--7F7F--7L-----------7L-.LJF-|F7FJ-.
7.LLFJ.|.|L--------7LJ|FJLJ|L-JLJF--J|L--7F--7LF7F7F--JL7||L-JL--7L-7|||FJ||F---JF-7|||FJF-JLJL7|L--7F7F-7LJ|L-7L--7F7F7F7F7FJLLJLFL.LJ|7L7F
FJ.F|.7|-LJF7F7F7F7L-7LJF-7L----7L-7FJF--J|F7L-JLJ|L7F-7|||F-----JF-JLJ||FJ|L-7F7L7||||L7L--7F7LJF7|||LJ7L7.L-7L--7||LJLJLJLJF7J|.LJFJFJJ-|7
LJ|-|-F7.LFJLJLJLJL--JF-JLL----7L--J|FJF77||L7F---JJLJL||LJ|F--7F7|JF7JLJL7|F-J||FJ||||FJF7FJ|L--JL-J|F---JF7FL--7||L----7F--J|.-7J77.7FF7LJ
J||.7-7JL.L7F--7F----7L7F--7F-7L----JL-JL-JL7LJF-7JF7LFJL7FJ|F-J||L-JL---7||L-7|||FJ|||L7||L7L7F7F-7FJL7F--JL7F7FLJ|F7F--J|F--J7L|JFL..FJ||.
F7-.JFJJL7JLJF7LJF7|FJFJL-7|L7L7F---7F--7F--JF7L7L7|L7L7FJ|FJ|F7|L7F7F-7FJLJF-J|LJL-J|L7LJ|FJ7LJLJ|LJF7LJF--7LJ|F-7LJ|L---JL------7L|-7-F7-|
|LFFJL7F7F---JL--JL-JFJ.F-J|.|FJL--7|L7FJL---JL7|FJL7|LLJFJL7LJLJFJ||L7LJ-F-JF7L7F7F-JFJF-JL--7F-----JL--JF7L-7LJFJF7L-------7F---J|F-|-J.||
F7|J.LLJ-L---7F7F-7F-JF7L-7L-JL----JL-JL-7F7F-7LJL--JL7F-JF7L-7F-JFJL7|F-7L-7|L7LJ||F7L7L7F7F7||F------7F-JL-7L-7L-JL--7F---7|L7F7FF77L-J.||
LF|-L-J7FF7LFJ|LJFJ|F-J|F-JF---7F7F----7FJ|||FJF7F--7FJL7FJ|F7||F7|F-JLJFJF-JL7|F-J|||FJ.LJ||||LJF----7LJF---JF7L----7FJ|F--JL-J|L-J|77J--FJ
-7J-J.LF7|L-JFJF7L-JL-7LJF7L-7FJ|||F---JL7|LJL7||L7JLJF-J|FJ|LJLJLJL--7FJFJF7FJ|L-7|||L7F--J|LJ7FJF-7FJF7L----J|F---7|L-JL7JF--7|F--JFJ-FJFJ
FJF-.FL|LJF-7|FJL-----JF-JL7FJL-JLJL---7-|L-7FJ|L7L--7L7FJL7L7F-------JL7|FJ|L7|F-JLJL7|L-7FJLF7L-JFJL-JL-----7LJF-7||F7F7|FJF7LJL-7L|L7J.J7
J-L7L77L7FJ.||L7F------J.F7||F--------7L7|F-JL7L7L7F7L7LJF-JFJL--7F7F7F7|LJFJFJ||F7.F7LJFFJ||FJL7F7L---------7L7FJ.|||||||LJFJL-7F7|-|7LF7-F
|.F7J--FJ|F-J|7LJ-F-7F7F-JLJ|L-------7|FJ||F7JL-JJLJ|FJF7L7FJ|F--J||||||L-7L7|FJLJL7|L---JFJFJF7LJL----7FF---J7|L-7||LJLJ|F-JF-7LJLJ..FF-J7J
|FFJ|L-L-JL7FJ-JF7L7|||L--7FJF7F-----JLJ7LJ|L77F7F-7|L-JL7|L-7L7F7|LJ|||F-J7||L7F--JL----7|7L-JL----7F7L7L--7F7L-7||L---7||F7|FJ|||..FF.FFFF
-FF7F--JJLFJL7FFJL-JLJL---JL7||L----------7L7L7|LJFJL-7F7||F-J|LJ|L-7|||L--7|L7|L-7.FF--7LJF7F7F----J|L7|F7FJ|L-7|||F7F-JLJ|LJL-7JF--JF-LJJJ
LLJ-L-77|-L--JFJF---7F-7F---J||F----------J.|FJ|F-JF7FJ|LJ|L7JF7FJF7||||F7FJL7|L7FJ7-L-7|F7||||L-7F-7|||LJ|L-JF-JLJLJLJF-7FJF---JJJ7.||F|J-7
F|.F7|LFL7LL|7L-JF7FJ|JLJF---J|L------7F7F7FJ||||F7||L7L7FJFJFJLJFJ|||||||L7FJ|-LJJL|F-JLJLJLJL-7LJFJ|FJF7L---JF7-F---7L7||FJFF777FF7JJ-F7F|
7LL.|LL|F7.77F---JLJFJF--JF7F7L-------J|LJ|L7L-JLJLJL7L-JL7L7L7F7L7||||LJ|FJL7|7LF7F7L------7F-7L-7L-JL-JL-7F--JL7L7F-JFJLJL--J|F--J|7|F|L.|
L-|J.FFFFF-77L------J|L---JLJL---------JF7L7|F7F7F7F7L7F7JL7|FJ|L7|LJLJJL||JJLJF-JLJ|F7F7F7FJL7L-7L7F-----7LJF7F-JFJL7|L7F-7F--J|F--J-J7-J-F
LJFJ|-7.||FJF7.F--7F7F--------------7F--JL-J||LJ|||||FJ||F7|||FJFJL-7JJL|LJJJFFL---7LJLJLJ|L--JF7|FJL----7L--JLJF-JF7L--JL7|L---JL-7L|LJ||LJ
|FJF|J|F-JL7|L7L-7|||L-------------7LJ|F----JL77|||||L7|LJ|||LJL|F-7L77L-7L|.F---7LL--7F-7|F7FFJLJL-7F---JF7F---JF-JL7F-7FJL-7F7F7FJ.-7LJ7.|
-F--L.FL--7|L7|F-JLJL7F7F---7F-7F--JF--JF7F7F7L7LJLJL7LJF-JLJJJF||JL7L7-.JFF-L--7|F--7||L|LJL7|F---7|L----JLJF7F7L--7LJF|L--7LJLJ||.|7L77F.7
F77|L|JF--JL7||L----7|||L--7|L7|L---JF7FJ|||||FJF-7F7L-7L7J.LLFFJ|.F|FJ7FFFJFF77||L7FJLJFJF-7|LJ7F-J|F7F-----JLJ|F--JF-7L--7|F7F7LJF-7|.||F7
LL-77F-L---7||||F-7FJLJL---JL7||F-7F-JLJFJ|||LJFJFJ||F7L-J7FF-7L-J.FJ||FJF|FFJL-JL-J|F7|L-JFJL--7L-7|||L-------7|L--7|FJF-7LJ|LJ|F-JFJ77L7-J
|-LF7.FF---JLJL7L7||F7F-7F7F7LJLJFJL-7F7L-J|L-7|FJF|LJL-----JFJ7L|F|FJ7J-FL7L7F----7LJL----JF7F7L--JLJL--------JL-7FJ|L-JFJF7|F-JL-7|F-77.|.
L7.JJFFJF---7F7L-JLJ|||7LJ|||F--7L--7LJ|F7.L--J||F7|F--7F-7F-J|L-7-LJFJ|J|LJLLJLF--JF7F7F7F-J||L7F7F7F7F---------7LJFJF-7L-JLJL7F7J|LJFJ7F|7
F77-FJL-JLF7LJL----7|LJF--J|||F-JF-7|F7LJL-7F7FJLJLJL-7LJ7LJ7L|L|JJ.FJFFF77|JLJ7L7F7|||LJLJFFJL7||LJLJ|L7F-7F7F7FJF7|FJF|F7F7F7LJ|FJF7L--777
|JFF|.F7-FJL-------JL-7L7F7|||L7FJFJ|||F---J|||F-----7L-7F--7.L|||-FFJLJF-J.FL7|-||||||F----JF7|LJF---JFJ|JLJLJLJ-|LJL-7LJLJLJ|F7LJFJL---J.|
LFJFL7|L-JF-7F7F7F-7F-J-LJ|||L7||.L7LJLJF7-FJLJL--7F7L-7LJF-J..|LF-L.F..|.|7LLJJ7LJ||||L7F7F7|LJF7L----JFL--7F-7F-JF---JF7F77FJ|L7FJJF----77
||-LJ-L7F7L7LJLJLJFJL7F7F7LJL-JLJF7L7F7FJL7|F-----J||F7L--JJ7|7LF-7|7|.F-||L-7|FLF-J|LJFJ|LJ|L7FJL7F7F-7F---JL7LJF-JF7F7|LJL7L7|FJL--JF7F-J7
L77.|-LLJL-JF7F--7L--J||||F---7F-JL-J||L7FJ|||F7FF-JLJL7.F7-JLJLL-7FJ-7|.LLJ-FL|-L--JF-JFJF7L-JL-7LJ||FJL-7F-7|F-JF-JLJLJF-7|FJ|L7F--7||L7J|
FLF.||LLL||FJLJF7|F-7.||||L--7|L-----JL-JL-JL-JL-JF7F-7L7|||L..||.L7JLFFJ7FFF-7|L|L.|L-7|FJ|F7F-7L-7LJL77FJL7LJL-7L-7F---JF||L-JFJL-7|||FJ7|
||J||7.L||FJF7FJ||L7L-JLJ|F7.||F7F7F7F-7F--------7||L7L7LJ|7-LF77FF|LFF7.J-J|JLJ.7FFFF7LJL7LJ||FJF-JF-7L-JF7|F---JF7|L----7LJF--JF7FJLJ|L7L-
--.LFF--FFL-JLJFJL7|F---7||L-J||LJLJLJ||L-------7|||FJFJF7L77.JJLJ7J|FJ|-J||.FJ.FF7FFJL7F-JF7LJL7L--J|L---JLJL----JLJF-7F-JF7L--7|LJJ-L|FJ.|
|F--J|.LF------JF7LJ|F7FJ|L--7|L7F-7F-7|F-------JLJLJ-L-J|FJ7.F|LLL77L7|.||J7|F7FJL7|F7LJF-JL7F7L-----------7F-----7FJ.LJF7|L7F7LJF7.FFLJ|--
7F|F||.FL------7|L--J||L7L-7FJL7LJ-LJFJ|L-----7F7F7F77F7||L7J7|77FLF-FJL7-L---|||F7LJ|L7FJF--J||F----------7|L----7LJF7F7||L7LJL--JL7||FL-.|
LLLLF7J7F----7FJ|F---J|FL7FJL7FJF----J|L7F----J|LJ|||FJL7L-J7LJFJ|LF-JF-J.|7JF||LJL7FJJLJFJF-7|||F---7F7F--JL--7F7|F7|||LJL7L7F-7F-7L-7JLL-|
|JFF-JFFL---7|L-JL---7|F-J|F7||JL-----7FJL-----JF7LJLJF-J-J-|77F7J7L7FJJLLJ7.FJ|F77LJF--7L7L7LJLJL--7|||L----7FLJ|LJLJLJF--JFJL7|L7|F-JFF7F7
7-L|..FF----JL-7F----JLJF7LJLJ|F7F7F7FJL7F----7FJL7F--JF7|||F7FJ|JFFJL-77|JLFL7|||F7|L-7L7L-J7F---7FJLJL--7F7L--7L7F-7F7|F77|F-J|FJ|L-7F77.|
|FLF.F-L----7F-JL7F-7F7FJL7F-7LJLJLJLJF7LJF7F7LJFFJL---JL7F7||L7L7FJF--J-F7JF7|LJLJ|F--JFJ-F--JF-7|L7F---7LJL---J7LJ-LJLJ||FJL-7LJL|F7LJL7.L
|J-|-7J.F---J||F7LJFJ|LJF7LJFJF7F--7F7||F7|LJL7F7L7F7F---J|||L7L7|L7|F77.|L-J|L-7F-JL--7|F7L---JFJL-J||F7L------7F--7LF7FJLJF--JF-7|||F7FJ7|
--7-.LFLL7F-7L-J|F7L-JF-JL--JFJ||F-J|||||||F-7LJL7||||F-7FJLJFJFJL-JLJ|F7|F--J7FJL-7F7FJ||L7F7F7L----JFJL-------JL7FJFJLJF--J|F-JFJ||||||-J-
LFF7F-7LLLJ.L7F7LJL---JF7F7F7L7LJL--JLJLJLJL7L-7FJLJ||L7LJF--J.L----7FJ||||F7F7L7F-J|||FJL7||||L------JF------7F7FJL-JF--JF7F7L7FJ|LJLJLJF|.
F7LLF7F7.LF--J||F------JLJ||L7|F-------7F7F7L-7||F7JLJ7L-7L-7F----7FJL7|||||||L-JL--JLJ|LFJLJ|L-7F--7F7|F-----J|LJF7F7L--7|||L-JL-7J.||.L7.7
LL-LFJL--JL---JLJF7F------JL7LJL-----7JLJ||L7FJLJ|L7F7F--JF-JL---7|L-7LJLJLJ|L-7F-----7L7|F7FJF7LJF7LJLJL7F7F--JF-JLJL---J||L7F---JJF|-L.LFJ
FL7..J-|7|-LF----JLJF-------JF7.F7JF-JF-7|L7LJLF-JFJ||L7F-JF7-F--JL--JF-----JF7LJF-7F7|FJ|||L7|L7FJL--7F7LJLJF--JLF7F7F--7||.|L-7F777LJ.|JLJ
|FJJ7|7|-7-FJF-7F7F7|F7F7F7|FJ|FJL-JF-JFJL7L--7|F-JFJL-JL-7|L7L------7L---7F-J|F7L7||LJL7LJ|FJL7LJF7F7LJL----JF7F7|||||F-J|L-JF7LJL77LF77.F|
LJ|JFJJJF7|L-J|LJLJLJ|||LJL7|FJL---7|F-JF7L---J|L7|L7F----JL7|F7F7F-7L7F--JL-7LJL7||L--7L--JL7JL--JLJL--------JLJLJLJLJL-7|F--JL---JF7-J.FF|
7L--L.LL7LF--7F7FF---J||F-7LJL----7LJL--JL---7.|FJF-JL--7LF7||||||L7L-JL7F-7FL-7FJ||7F-JF--7FJF7|F7F---7F---7F7F-7F----7FJ|||F7LF7F7||77-FJ|
..L|-F7.|FL-7|||FJF7F7LJL7L7F7F--7L-7F7F7F---JFJL7|F7F--JFJ||LJ||L7L-7F-J|FJF7FJL7|L7L-7|F7LJJ|L-J|L--7|L--7||||FJL---7LJFJL-JL-JLJLJL-77LF|
FFJ|FLJ-L-F7||||L-JLJL7F7|FLJLJF7L-7|||||L---7L7FJLJ||F7|L7|L7FJ|FJF-JL7F||FJ|L-7LJFJF7|||||F7L-7FJF7FJL7F-JLJLJL-7F--JF7L7F7F7F7F7F-7FJ7-||
L|.L|JLF-L|LJLJL---7F-J|LJF----JL--JLJLJL-7F7|J||F7FJ||L7L|L-J|FJL7L--7L-J||FJF7|F-JFJ||LJL7|L7FJL7||L-7LJ|F-7F7F7LJF--JL-J|LJLJLJ|L7LJL-7J7
FFJL77-J|LL7F-7F--7LJF-JF7|F-7F----7|F7LF7LJLJFJLJ|L7LJFJFJF-7LJF-JF7|L7F-J|L-J|||F7L7LJF7FJL7LJF7LJ|F7L--7|FJ||||F7L7F----JF----7L-J-L..L7|
JJ7.||.LL.L|L7LJF7L--JF-J|LJ|LJF7F7L-JL7||F-7FJF7FJFJF-J.L-JFJF7|F7||F-JL-7L--7||LJL7L-7|LJF7L--JL7FJ||F7FJ||FJLJLJL-JL-7F7FJF7F7L---7.F7.|.
FLL7-J7J7|FL-J7FJL7F7FJF7L7F77FJLJL-7F7LJ||FJL7|LJJL7|F77|F7L7|LJ|||||F7F-JF--JLJF--JF-JL-7|L7LF7-|L7|LJLJ-|LJF7F------7LJLJFJLJL-7F7|7JFJ77
F7L|F-7LFF-7F7FJF7LJ|L-JL7|||FJF---7LJL--J|L--JL7.F7|||L7FJL-J|F7|LJ|||LJF7|F---7|F7JL---7LJFJFJL7L7LJF----JF-J|L-----7|F7F-JF--7LLJLJ.FJFL-
||F-7-.FJL7LJ|L-JL7FJF7F7||||L-JLF7L-----7L7F--7|FJ||LJFJL7F--J||L-7||L7FJ|LJF7FJLJL7F7F7|F-JFJF-JFJF7|F----JF7L-7F---JLJ|L--JF7L-7.JF-|FL77
L7F...FJF-JF7L----JL-JLJLJLJ|F7F-JL------JFJL-7LJL7||F-JF7|L--7|L7FJLJFJ|FJF7||L7F--J|LJLJL7.L7|F7L7|LJL---7FJL7FJL-----7|F-7FJ|F-JJ7|JL|FJ-
L||F----L7FJL----7F---7F-7F7LJLJF--7F7F-7|L7F-JF-7|LJ|F-J||F--JL7|L7F-J-|L7|LJL7|L--7|F7F--JF7||||7||F----7LJF-JL7F7F7F7||L7||F|L7JF-L-7-LJ.
-J||-F|-FJ|F-7.F7||F--J||LJL7F7FJF7LJ||FJF-J|F7|FJL7FJL-7LJL-7FFJ|FJ|F-7|FJL--7|L7F-JLJ|||F7|LJ||L7LJL---7L--JF7|LJ||LJ||L-J|L7L-JFJ||LLJF77
.-F7L-F7L7|L7L-JLJ|L7F7L7F--J|LJ.||F-J|L7L-7||LJ|F7|L7F-JF---JFJFJL7||FJ|L7F7FJ|FJL7F7FJ|FJ||F-JL7|F-7F--JF---JL--7|L-7LJF7LL-JF7FJFF-777|J7
.|J.|.|||LJ-L7F7F-JJLJL7||F--J|F-JLJF7|FJF7|||F-J|||FJL-7|F7F7L7|F7||||FL7|||L7||F-J||L7||FJ||JF7|||FJL---JF7F7F--JL-7L--JL----JL7LF-7LJ7JLF
FF7F--|L7F7F7LJLJF7F7F7LJ|L7F--JF7F-J|||FJLJ||L7FJ||L7F7|||||L7|||||||L7FJLJL7|LJL7FJL7|LJL7||FJ||LJL-7F-7FJLJ|L----7L-7F-7F-----JLJ|F7JJ-|J
FJ-J.FL7||LJL7F7FJLJLJL--JFJL7F7|LJF7||LJF-7|L7|L7LJ-||||||||FJ|||||LJ-|L7JF-JL7F-J|F7|L7F7|||L7||F7-FJL7|L--7|F7F-7L-7LJFJL7F--7J.L7|J|--7|
|.L-FF7||L--7LJLJF7F7F7F7FJF-J||L7FJLJL--JFJ|FJL7L-7FJ|||||||L7|LJ|L--7|FJFJF--JL-7LJ||FJ|LJ|L7||||L-JF-J|F-7|LJ|L7|F7L-7|F7LJF-J-7FFJ|L.|L-
|77JF|LJ|F-7L7F-7|||||LJLJ7|F7|L-JL--7F-7FJ-|L-7L7FJL7|||LJ|L7||F-JF-7|LJJL-J-F---JF-J|L7L-7L7LJ||L--7L-7LJ-|L-7L7|||L--JLJL7FJJJLLFL-7|.77|
||.FJL-7|L7||LJ.||LJ|L7F7F-J|LJF-----JL7LJF7L-7|FJ||FJ||L-7|FJ|||F7|FJL----7F-JF7F7|F7L-J7FJFJF-JL7F-JF-JF-7|F-JFJ||L7-F7F-7LJ-|JFFL|..FF77J
LLF-FF-JL-J|F7F-JL-7|FJ|LJF7L-7|F--7F-7L--JL-7LJL7|FJFJL7FJLJLLJ||||L-7F-7FJL-7||||LJL---7L7|F|F--JL-7L--JFJLJF7L7|L7L-JLJFJJ|FL--7FL7.L|JF7
.L|L-L----7|||L-7F-J|L7L7FJ|F-JLJJFJL7L-7F7F7L-7FJ|L7L7FJL-7F---J|||F-JL7LJF--J|LJL7F--7FJFJL7||F--7FJF7F-JF--JL7|L7|F----JJL-L-7|LLJL7-J-|F
F-|FLF----JLJL--J|F-JFJFJ|FJ|.F---JF-JF7LJ||L--JL7L7L-J|F7FJ|F--7|LJ|F7FJF-JF-7|F--JL-7|L7L7FJLJL-7LJFJ|L--JF---J|FJ|L---7F77||7.JFF|7.FJFJJ
FL||JL------7F-7FJ|F7|FJFJL7|FJF7F7|F-JL-7|L-7|F-JFJLF-J|||-LJF-J|F-J||L7L-7|FJ||F7F--JL7|J||LF---JF7|JL7F-7L---7||FJF7F7LJL7-LL.|F-||.L7J77
FJFJF-------JL7|L7LJLJL7|F7LJL7||||||F7F7LJF7L7|F7L-7L7FJ|L7F-JF7|L-7||FJF7||L-J|||L---7||FJL7L---7||L77||-|F-7FJLJL7|||L-7FJFJFF7J-|L7.LLJ7
..LFL-----7F7FJL7L--7F-JLJ|F--J|||||||LJL-7|L7|LJ|F7L7||J|FJL-7|||F-J||L7||LJF--J||F-7FJLJ|F7|F7LFJ|L7L7|L7|L7|L---7|||L-7|L777FL|JFL-FF-7.F
J7.F------J||||FJF7FJ|F7F7|L-7FJLJ||||F---JL7LJ7FJ||FJ|L7||F7FJ|||L7FJL7LJ|F7L--7||L7|L--7|||||L-JFJFJFJL7||FJ|F-7FJ||L7FJ|FJ7--|JF-7J|77L-7
|L-L-7F7F--J|L7|FJ||FJ|||LJF-J|F--J|||L7F-7FJ|F7L-J||FJFJ|||LJFJ|||LJ.|L--J||LF7||L7||F--J|||||F7FJLL7|-FJ|LJ-|L7|||LJJLJ-LJJJ7.|-F.|-7LJFLL
F7LF-J|||F--JFJ||FJ|L7|||FFJF7|L7F-J||FJ|FJL--JL--7||L-JFJ||F7|FJL-7F7F----JL-JLJL7LJ|L--7||LJ||LJF7FJL7L7L--7|FJ|L-7-7FJJLLJFLJ.|.F|.LFFJFJ
F--L-7||||F-7|||||FJFJ|LJFJFJ||.LJF7LJL7|L7F7F7F7FJLJFF-JFJLJLJ|F7FJ||L--7F----7F7L-7|F7FJ||F-JL--J||F7L7|F--J|L7|F7L-7JJF77JL7L-7-JFJ|L-LJ7
7|-J-LJLJLJFJL7LJLJ|L7L-7L7|FJ|F--JL---JL7|||||||L-7LFJF7L-77F-J|||F||JF-J|F--7|||F-J||||F||L7F7F-7||||FJ|L--7|FJ|||F-JLLJL|7-L-L7-7.L-J|-F|
LFJ|F|7F---JF7L--7F7L|F-JLLJL7|L-7F-7F7F7|||||LJ|F7L7|FJ|F7|FJF7||L-JL7L7FJL-7LJ||L-7LJ|L7||FJ||L7||LJ||FJF-7|||LLJLJJ..7J7.JLL7J.FL7.L7J7|J
.7.|FFFJF-7FJ|F7FJ||FLJJ.FL7|||F-J||LJ||||LJ|L7FJ|L7||||||LJ|FJ||L7F7FJJ||F--JF7||F7L-7|FJ|||FJ|FJ|L-7LJL7L7|||L-7JFJJF7J.|J.FL|---|.J-J7FJ7
FL.L--L-JFJ|||||L-JL77|F-JFFFLJL-7|F--J||L7L|FJ|FJFJ|LJFJL-7||J||FJ|||F-J||F7FJLJ||L7FJ|L7LJ||.||FJF7L7F7|FJ||L--JF|7.FF.F|J.LJJ.F|.-77F-LFJ
L--JL77F-JFJFJ||F7F7L7-F.FFF7F|F-J|L-7FJL-JFJL7||-L7|JFJF7FJLJFJ||FJ||L-7|LJLJF--JL7|L7L7L7FJL7LJL7|L7LJ||L7|L-7LL-J|--L-|-7FL7-7J-LJF|-JLJ|
|L7-F|FL-7|FJFJ||||L7L-7F7FJ|F7L-7|JFJL7JF-JF-J|L-7|L7L7||L7F7L7||L7||F-JL7F--JF7F7||FJ7L-JL-7|F77||FL7FJ|FJL-7L7F|LL7-FF7FL7JLJJJF||FJ..FFL
|-|FFL-LJLJ|FJL||LJFJF-J||L7LJL--J|FJF-JFJF7L7.|F7||FJ.|||FJ|L-J|L7|LJL--7|L--7|||LJ||-F7F77FJLJL7|L7FJ|FJL-7JL-J-|LLJ7LLJ|.||..LF7-J|FFF7LJ
J-L7J|L|J..||7-||7FL-JJFJL7L7F-7F-JL7|FFJFJ|FJFJ|LJLJF-J||L7L7F7|FJ|F7F--J|LF-J||L7FJL7|||L7L7F7FJ|FJL7|L7F-JF7L|F|J.|7-|-J-LL-|FLL--7-JFJ.7
..LJ|--7JFF|L7F||-J|7|.L-7L-JL7LJLF-J|FJFJFJ|FL7L--7JL7FJ|FJFLJ||L-J|LJF-7L7|F7|L7||F7LJLJFJ.||LJFJL7-LJFJL--J|.F7J|7L|.L7J.F7FF|L|.L7|FL|.|
F.|FF.-|-LL|FJ-LJJ--L7FLJL7F7FJ.J.L-7||FJLL7L7FJF7FJ7-||FJ|F---JL--7|F7L7L7|||LJFJ||||F-7FJF7|L-7L7FJ-LLL7F7F-J7L|LF--FJ--.FJ7.FF.||7.|J-|F7
.FJ|.F||7L.LJ7.LLJFLL-7-FFJ|LJJ-|7F7LJ|L-7-|FJ|FJ|L--7|||FJL-7F-7F-JLJL7|.LJ||F-JFJ||LJFJL-J|L-7|FJL777FL||||J-L-7.JLL||FJ-J.FF|J-J7.|7F-J-.
.LFF7JL-|F7|.L-FJ.|.L||FFL7L--7.-F|L--JF-JFJL7|L7L7F7|LJLJF--J|FJL-7JLFLJ-F7||L--JFJL-7L-7F7L7-LJL7FJLF7-LJLJ|7F|77F-..-JJ.L7L|||.FLL-77-|77
--7LF.||L|.J-|LL-JJ.F7LJJ.L-7FJ.|LL7F-7|F7L7FJ|FJ.||LJ.|.LL--7||F7FJ7LJ||FJLJL7F--JF-7L-7LJL7L--7FJL--J|FLFJ.L7|JLLJJ-FJ|FL-7||JJ--L7FLJJLL7
F7|J.LF|7.F|-F.L77.F--L|L-7LLJ-|-77LJFJLJL7|L7|L7-LJLJ--7L7LFLJLJLJFF7|FFJF7F7|L-7FJFJF7L7F7L--7|L7F7F-J7-J7F-|L7..|FLF--|.-J7|J||LJF-J--JF|
J77FFJ|.|FL7J.F7.FLJ||7F7LJFJFLL-J--FJF-7FJ|FJ|FJ7JFF7F-JL|-|F|J7JL-LJLFL-JLJLJF-JL7L7|L7LJL7F7LJFLJLJJ|LFL|.FJ.L|-L|-7JFF7|JF|.FJ7.7J.F.FLJ
FL7-7-LL-JF7.FF--|-F--LL-J|7.|.LF.|LL7L7||FLJL||JJ7FJ|F-JJ|7J7|L7.F-|-L|.L|7F--JF7FJFJ|FJF-7LJL--7||7-F-J|LLLLFJ.|.7-F-7LF-|77.|J7F|J.F|-7.F
7J.L|.L|FLLF-7|.L|-J7J.|F-FFJJ-F--7-L|FJ|L-7JJLJ.J7L-LFJJ-7JJF7LL|J7F-7F7-LLL---J|L7L7|L7L7|F--7FJ-F77FJ-FF7JF-J.|-.7|L|-|LJJ-L|77J-7FLJLJ.7
|7|.F7.FJFLLFJ7-||F-77F|J-F|J.FL|-FJ.LJ-L--J.FJ|.FJ77||.LF|F77F-LL-FF-JLL7..|F---JFJFJL7L7|||7L|L7J.|7..-|J|L|7.F|J-J7|||.LLLJ7|.-7LL-.L-J-J
77J|JJ7L.|JJ..J-7-F7|7F|-L||7F-7|.F-F|J.LJL|-77F-F-JF|7..F|7|7|FL|LLL7LJFJFF-|F7F7L7|F7L7|||L7.|FJJJLLL|.|7|.L7F-LJFF|F--7.||L||FJ||J|L-FJ7L
L--LJJ|L-L7.FLJ..|JL7-LL-L.FLJJ.--JLL7J.L|-JJJF-JL7JF|-..JJF|--7.|LL-JLL|J---LJLJL-JLJL-JLJL-J-LJJ.LJ.|J-L7--JL-|L7-LL|-J-|-JJL-J.L|LF|LLJL.

10
10b.test Normal file
View file

@ -0,0 +1,10 @@
FF7FSF7F7F7F7F7F---7
L|LJ||||||||||||F--J
FL-7LJLJ||||||LJL-77
F--JF--7||LJLJ7F7FJ-
L---JF-JLJ.||-FJLJJ7
|F|F-JF---7F7-L7L|7|
|FFJF7L7F-JF7|JL---7
7-L-JL7||F7|L7F-7F7|
L.L7LFJ|||||FJL7||LJ
L7JLJL-JLJLJL--JLJ.L

61
11.js Normal file
View file

@ -0,0 +1,61 @@
import { loadFile } from "std";
var datafile = "11.txt";
var data = loadFile(datafile).trim().split('\n');
String.prototype.insert = function(index, string) {
if (index > 0) { return this.substring(0, index) + string + this.substring(index, this.length); }
return string + this;
};
var xb = [];
var yb = [];
for (var i = data.length-1; i >= 0; i--) {
if (!data[i].match('#'))
yb.push(i);
}
colm: for (var i = data[0].length-1; i >= 0; i--) {
for (var j = 0; j < data.length; j++)
if (data[j][i] === '#') continue colm;
xb.push(i);
}
var galaxies = [];
for (var i = 0; i < data.length; i++)
for (var j = 0; j < data[i].length; j++)
if (data[i][j] === '#') galaxies.push([i,j]);
var sum = 0;
var expansion = 2;
function galaxy_dist(a,b)
{
var x = a[0] <= b[0] ? a[0] : b[0];
var y = a[1] <= b[1] ? a[1] : b[1];
var dx = Math.abs(a[0]-b[0]);
var dy = Math.abs(a[1]-b[1]);
var xs = yb.filter(q => q > x && q < x+dx);
var ys = xb.filter(q => q > y && q < y+dy);
return dx+dy+(xs.length*(expansion-1))+(ys.length*(expansion-1));
}
for (var i = 0; i < galaxies.length; i++)
for (var j = i+1; j < galaxies.length; j++)
sum += galaxy_dist(galaxies[i], galaxies[j]);
console.log("Part 1:");
console.log(sum);
expansion = 1000000;
sum = 0;
for (var i = 0; i < galaxies.length; i++)
for (var j = i+1; j < galaxies.length; j++)
sum += galaxy_dist(galaxies[i], galaxies[j]);
console.log("Part 2:");
console.log(sum);

140
11.txt Normal file
View file

@ -0,0 +1,140 @@
.....................#......#...................#...............#........................................#..................................
...........................................................#.............................................................#..................
.....................................................................#.........#......#...........#.............#...........................
.....................................................#.......................................#..............................................
......#.................................#..........................................................................................#........
....................#.........#.............................................................................#...............................
..#.........................................................#.............................................................................#.
........................................................................................#...........#..................#....................
........#....................................#........................#.........................................................#...........
..............................................................................#................................#............................
..................................................#............#............................................................................
.........................#......#........#................................................#..........................................#......
......#..............................................................................#...............#......................................
...................................................................#........................................................................
....................#...........................#............................................................#..............#.....#.........
..................................#....................#.........................................#......#..............................#....
.#..........................................................................................................................................
........#.....#........................#...........#.............#.....................#....................................................
..........................#.................................#.....................#.........................................................
.............................................................................................................................#.............#
...................................#......................................................#....................#............................
.....................#...................#............#..................#.............................................#...........#........
..............................................................................................#.............................................
....#..........#...............#..........................................................................#.................................
.............................................#..............................................................................................
...................................................................#..............#.................................#.......................
..................#........................................................#................................................................
..#.................................#...................#..............................#.........................................#.......#..
...............................................................#...............#.....................#..........#.........#.................
.........#......................#.............................................................#.............................................
..............#...............................#.............................................................................................
........................................#.................................#............................................................#....
..............................................................................................................#......#......#...............
.........................#..........#.............................................#........#................................................
....................................................................#.....................................#.................................
....#...............#........#...............................#........................#........................................#............
........................................................#...................................................................................
............................................#...........................#......................#.....#......................................
.........................................................................................#.............................................#....
...........#....................#..................................#.................................................#...........#..........
.#..........................................................................................................................................
................#........................#..........#.......................................................................................
........................#........................................................................................#..........................
........................................................................#.........#...................#...................#.................
........................................................#......................................................................#............
.....#.....................................................................................#................................................
...............#...................................#.................#..............................................................#.......
.........#..................#..................................#..................................................#.........................
......................................#.......#....................................#......................................................#.
..........................................................................................................#......................#..........
...#..............#.......................#.....................................................#...........................................
................................#...............................................#..........#................................................
..........................#......................#......................#...................................................................
..................................................................#................................#........................................
......................................................#.................................#.........................#...................#.....
..............#..........................#..................................................................................#...............
......#......................#.................................................................#...........#................................
.............................................................................#..............................................................
.......................#..........................#......................................................................#..........#.......
.#.................................#................................................................#....................................#..
........#......#................................................#...............................................#...........................
..........................................................................#.....#.........................#...........#.....#...............
............................#..............#..........#....................................#................................................
............................................................................................................................................
............#..........#....................................................................................................................
............................................................#.......................#..............#........................................
.....................................#...............................#...................................#..................................
.........#.....................................................................#.....................................#...............#.....#
#.............#.............................................................................................................................
......................................................#....................................#....................................#...........
...................................................................#............................................#...........................
............................................................................................................................................
....................#............................#................................................#......................................#..
.............................#...................................................#..........................................................
.........................................................................#...............#.................#................................
.............#.........#.........#.....#......................#............................................................#................
............................................................................................................................................
.............................................#..........#.....................#..................................#..........................
............................................................................................................................................
...................................#.............#................#.....#.....................................................#.............
....#.....................#..................................#..............................................................................
............................................................................................................................................
#.....................................#...................................................................................#.................
...............................................#......................#.....#...................................#...........................
.........#...................#.....................................................#.................#......................................
.......................#...............................#........................................#..............................#............
...#.....................................#..................................................................#...............................
...................................................#......................................#...........................................#.....
.................#..........................................................................................................................
...................................................................................................................#......#.................
.................................#..............#.....#......................#.................#.........#..................................
#....................................................................#........................................#...........................#.
............................................................................................................................................
.........................#..................................................................................................................
...............................#.......................................................................................#....................
..........#...................................#..................#.....................#....................#...............................
............................................................................#.....#.........................................................
....#............#............................................................................#.......#..........#..........................
..................................................................................................................................#.........
...................................#...........................................#............................................................
.............................#..........................#.................................#........#........................................
..............#....................................................#........................................#.............#...........#.....
...............................................#.............#.......................................................#......................
........#..............................................................#....................................................................
.......................................................................................#........#...........................................
......................#........#.........................#..................#........................#......................#...............
.#.........#.....#..............................................#........................................................................#..
.....................................................#......................................................................................
.........................................#...........................#..............................................#.......................
.............................................................#................................................#................#............
......#.......................................#.......................................#...............#.....................................
....................#.......#............................#................#...........................................................#.....
...........#.....................................................................................................#..........................
..........................................................................................#..............#..................................
..................................................#..........................................................................#..............
...............#............................................#.....................................................................#.........
........................#...........................................#............................#..................#.......................
................................................................................#..............................#.......................#....
......................................#...................................#..............#..............#...................................
..#............................................#..............#...........................................................#.................
.........#........................#...................#.....................................................................................
.............................#..............................................................................................................
....................................................................................#.......................................................
.........................#.............#............................................................#......#......#.........#......#........
...................#...........................................................................#...........................................#
.......#...............................................#.....#........#..........#..........................................................
..............#....................#........................................................................................................
........................................................................................................#.................#...........#.....
..#...............................................................#.........#.......#.......................................................
.........#......................#..........................#.....................................#............#.............................
...................#.................................#.................................................................#....................
....................................#.......................................................................................................
...........................#......................................................................................................#.........
............................................#.................#............#...................#.......#...................#................
............#.....................................#.........................................................................................
...........................................................................................................#......#.........................
.....................................#..............................................#......#................................................
.........................................................................#..............................................#...................
#....................#........#...................................................................#.....................................#...
.....#........................................#.........#........................#..........................................................

110
12.js Normal file
View file

@ -0,0 +1,110 @@
import * as std from 'std';
var data = std.loadFile('12.txt');
//var data = await Deno.readTextFile('12.txt');
data = data.trim().split('\n').map(d => d.split(' '));
for (var i = 0; i < data.length; i++)
data[i][1] = data[i][1].split(',').map(d=>Number(d));
/* nfs to end of string */
var row_combos = function(s, c)
{
var pos = 0;
var cstates = [];
cstates.push({
e:"",
ci:0, /* c index */
cc:0, /* c count */
expdot:0, /* expecting dot */
num: 1,
});
var nstates = {};
function state2id(state) { return state.ci<<8 | state.cc<<16 | state.expdot | state.e.charCodeAt(0)<<24; }
function id2state(id) {
var state = {};
state.ci = (id >> 8) & 0xff;
state.cc = (id >> 16) & 0xff;
state.expdot = id & 0xff;
state.e = String.fromCharCode(id >> 24);
state.num = nstates[id];
return state;
}
function statecache(state, num, e) {
var id = state2id(state);
num ??= state.num;
e ??= state.e;
if (nstates[id])
nstates[id].num += num;
else {
nstates[id] = {...state};
nstates[id].num = num;
}
return nstates[id];
}
var dfa = {};
var si = 0;
while (cstates.length > 0) {
for (var state of cstates) {
state.e = s[si];
if (si === s.length) {
if (state.ci === c.length)
pos += state.num;
continue;
}
var id = state2id(state);
if (dfa[id]) {
dfa[id].forEach(d => statecache(d, state.num));
continue;
}
var dfa_c = [];
var cc = s[si];
switch(true) {
case ((cc === '#' || cc === '?') && state.ci < c.length && state.expdot === 0):
if (cc === '?' && state.cc === 0)
dfa_c.push(statecache(state,undefined,s[si+1]));
state.cc++;
if (state.cc === c[state.ci]) {
state.ci++;
state.cc = 0;
state.expdot = 1;
}
dfa_c.push(statecache(state,undefined,s[si+1]));
break;
case ((cc === '.' || cc === '?') && state.cc === 0):
state.expdot = 0;
dfa_c.push(statecache(state,undefined,s[si+1]));
break;
}
dfa[id] = dfa_c;
};
cstates = Object.values(nstates);
nstates = {};
si++;
}
return pos;
}
console.log(data.map(d => row_combos(d[0],d[1])).reduce((a,i)=>a+=i));
for (var i = 0; i < data.length; i++) {
var row = data[i][0];
var set = data[i][1];
data[i][0] = row+'?'+row+'?'+row+'?'+row+'?'+row;
data[i][1] = set.concat(set).concat(set).concat(set).concat(set);
}
console.log(data.map(d => row_combos(d[0],d[1])).reduce((a,i)=>a+=i));

6
12.test Normal file
View file

@ -0,0 +1,6 @@
???.### 1,1,3
.??..??...?##. 1,1,3
?#?#?#?#?#?#?#? 1,3,1,6
????.#...#... 4,1,1
????.######..#####. 1,6,5
?###???????? 3,2,1

1000
12.txt Normal file

File diff suppressed because it is too large Load diff

108
13.js Normal file
View file

@ -0,0 +1,108 @@
import * as std from 'std';
var data = std.loadFile('13.txt');
data = data.trim().split('\n\n');
for (var i = 0; i < data.length; i++)
data[i] = data[i].split('\n');
function reflect(coords, mirr) {
var ret = {};
ret.x = coords.x*-1;
ret.y = coords.y*-1;
return ret;
}
var height = 7;
var width = 9;
var sum = 0;
data.forEach(function(d) {
// d.forEach((p,i)=>console.log(`${(i+1).toString().padStart(2,'0')} ${p}`));
/* check verticals */
outer: for (var m = 0; m < d.length-1; m++) {
for (var i = 0; i <= m ; i++) {
for (var j = 0; j < d[i].length; j++) {
var s = d[i][j];
var mj = j;
var mi = 2*m-i+1;
if (!d[mi]) continue;
if (s !== d[mi][mj]) continue outer;
}
}
sum += 100*(m+1);
return;
}
/* horizontals */
outer: for (var m = 0; m < d[0].length-1; m++) {
for (var i = 0; i < d.length; i++) {
for (var j = 0; j <= m; j++) {
var s = d[i][j];
var mi = i;
var mj = 2*m-j+1;
if (!d[mi][mj]) continue;
if (s !== d[mi][mj]) continue outer;
}
}
sum += m+1;
return;
}
});
console.log(sum);
sum = 0;
data.forEach(function(d) {
/* check verticals */
outer: for (var m = 0; m < d.length-1; m++) {
var wrong = undefined;
var rfl = 0;
for (var i = 0; i <= m ; i++) {
for (var j = 0; j < d[i].length; j++) {
var s = d[i][j];
var mj = j;
var mi = 2*m-i+1;
if (!d[mi]) continue;
if (s !== d[mi][mj]) {
if (wrong) continue outer;
wrong = [i,j];
rfl = m;
}
}
}
if (wrong) {
var m = rfl;
sum += 100*(m+1);
return;
}
}
/* horizontals */
outer: for (var m = 0; m < d[0].length-1; m++) {
var wrong = undefined;
var rfl = 0;
for (var i = 0; i < d.length; i++) {
for (var j = 0; j <= m; j++) {
var s = d[i][j];
var mi = i;
var mj = 2*m-j+1;
if (!d[mi][mj]) continue;
if (s !== d[mi][mj]) {
if (wrong) continue outer;
wrong = [i,j];
rfl = m;
}
}
}
if (wrong) {
var m = rfl;
sum += m+1;
return;
}
}
});
console.log(sum);

15
13.test Normal file
View file

@ -0,0 +1,15 @@
#.##..##.
..#.##.#.
##......#
##......#
..#.##.#.
..##..##.
#.#.##.#.
#...##..#
#....#..#
..##..###
#####.##.
#####.##.
..##..###
#....#..#

1361
13.txt Normal file

File diff suppressed because it is too large Load diff

94
14.js Normal file
View file

@ -0,0 +1,94 @@
import * as std from 'std';
//var data = std.loadFile('14.txt');
//data = data.trim().split('\n').map(k=>k.split(''));
function roll(line,x,dir)
{
if (data[line][x] !== 'O') return;
var nline = line-dir[0];
var nx = x-dir[1];
if (nline < 0 || nx < 0 || nline === data.length || nx === data[0].length) return;
if (data[nline][nx] === '.') {
data[nline][nx] = 'O';
data[line][x] = '.';
roll(nline,nx,dir);
}
}
var cache = {};
cache.north = {};
cache.south = {};
cache.east = {};
cache.west = {};
function make_table() { return JSON.stringify(data); }
function print_table() { data.forEach(p=>console.log(p)); console.log("");}
var cdirs = {
north: [1,0],
south: [-1,0],
west: [0,1],
east: [0,-1]
};
var data = std.loadFile('14.test');
data = data.trim().split('\n').map(k=>k.split(''));
var h = data.length;
var len = data[0].length;
console.log(len);
function tilt(dir)
{
var idx = undefined;
var table = make_table();
if (cache[dir][table]) {
idx = cache[dir][table].idx;
data = JSON.parse(cache[dir][table].tb);
return idx;
}
var vdir = cdirs[dir];
var rev = (dir === 'south' || dir === 'east');
if (!rev)
for (var i = 0; i < data.length; i++)
for (var j = 0; j < data[0].length; j++)
roll(i,j,vdir);
else
for (var i = data.length-1; i >= 0; i--)
for (var j = data[i].length-1; j >= 0; j--)
roll(i,j,vdir);
var t = {};
t.idx = Object.keys(cache[dir]).length;
t.tb = JSON.stringify(data);
cache[dir][table] = t;
return t.idx;
}
function cycle() {
var rr = [];
rr.push(tilt('north'));
rr.push(tilt('west'));
rr.push(tilt('south'));
rr.push(tilt('east'));
if (!rr.every(r=>r)) return undefined;
return rr;
}
var lastcycle = undefined;
for (var i = 0; i < 1000000000; i++) {
var cc = cycle();
if (lastcycle && cc)
if (JSON.stringify(cc) === JSON.stringify(lastcycle))
break;
lastcycle = cc;
}
var sum = 0;
sum = data.reduce((acc,line,i) => acc += (line.filter(c => c === 'O').length*(h-i)), 0);
console.log(sum);

10
14.test Normal file
View file

@ -0,0 +1,10 @@
O....#....
O.OO#....#
.....##...
OO.#O....O
.O.....O#.
O.#..O.#.#
..O..#O..O
.......O..
#....###..
#OO..#....

100
14.txt Normal file
View file

@ -0,0 +1,100 @@
.O.....##O.O#..O#....##O#.#.#..##O#..O.....#.OO..O.O.O.O...O....#O...OO....##.O..OO.O......O..O.....
....O..#O....#...#OO..#..#..O.....#O......O.O.#..OO..O....#..#.OO....##O...O..##...#.O...O.#...#.O#.
.O.O#.O...O...O....O...O#....#.#O#...O...#.#..........O#...O#O..O..#.OOO..O.O.....O#.........#O...O.
.O....O.OO.#.....#.#O......##O..O.O.##.#..O##O.O.#OO....O.O..O#.OOO..O..#..##.#...#.O.#O.#.#.....O..
..O......O..O.O.#.OO.OO...#.O....#...#O..OO.#.O......O....O.O.....O.#.OO..O.OOO.......O.O...##O...O#
.O.O.........#.O#.#OO##..#OO..OOO#....#....O.O..#.O......#.OO..#..O.O..O.O..#....#.O#..OO###.....#..
.O..#.#.OO.#...........#..O#....O..O.O#.......#.OO.#OO....O.#O.#.....#.OO.#...#..O..O##.O.O##..#.#.O
..O..#...#..OO.#O.#.O.O#O...O.O..O..O#..#..#..O..........O.O#.....O...........O.###..#.#..O#.#.O...#
#..O...#.O..O.O......#O.O##...##...OOO....#.O.O#OO.##...OO.OOO..#.O..##.....O..O.O.#O.O..#.O#O...O.#
OO....#.#...O...O.#...##O..###O.......OO...#.#...O.#..#.O......O....#.O#..#O..O...OO...#..O#..O....O
O#..#O...##O.....#.O.#.O...##......#...#OO#...O.......#.#.OO#.#..#..O#OO...O.......O.#...#.##....O..
#............O#....##.O.O..#O.#.OO.O...OOOO#.......O#O..O.......O#OO#...O.O....#.....#O.#.#..#.OO.O#
#O.O.....O....#O..OO.#O.#....#.##O.O...........O.##.#O##O...O#..O.O.O#......O...O.#....#OO#.#..O..##
.O..#O.O.#....O.........#.....OOO.......O.#O.....#OOOO#.O##O.#.O...O..#OO...O.....O..#.#......OO.O.#
O..O...O......O.O...#..#...#.OO.#.OO.O..O...#...#...O.###....#O#.O..O..#O..#.O.##.......O#..#O......
#..O...#...#OOO.#.###.#....#..O.O.#.#......OO.#.#...#....#.OO.O..#.O...#.#.....O.#O.O.#O..O....O.O..
OOO.#...##.OO.O....#.O.###.#.....O.OO#..#....OO...O#.#.O..#O.#..#.O..O....#O.OO#...O..#.....#O...O.O
.#.#...........#.............O.#..##.#O.#.O......#..O..OO.##O.O##.....#..O.O..O.OO..OO.#O.O.##O.O...
..O......O..##O.O...##......##OO..#O.#..#..OO...#...O.O..O..O.O.O##.#O.O#.#.O#....##.O.....O..#.O...
.#...#O.#.#....O..O..O#.O.....O..O.#.O....O.O...#.O#......O..O.O...#.#...O..##O...#.#...O.##..#..O#.
.O#..O.#....#.OO.#.....#O....O#O.#..#.O.....#......#O....O.........#.#O.OOOO#O.OOOO.#.....O.#.O..#OO
#..#.....O.....#.....##.O....##.O.O#OOO..O....O...#....O.O.....#.O#.O....O.O....#..O....O###.#..O#O.
...O...#..#O.O.O.......O.....O#O....#.#OO#......#..OO.....#.#...#...OO.O#O#O.#.#O....#..O....O...OO.
..#.##.#.#..............#O...#O#..##O.#.....O.#.#......O.....O#..O.O.O.#OOO####O.....O..##.O.OO.#..#
O...O#.O....#.O...........#......##.O.O#.....#.O..OO#...O#.##O..##.....#.O.O.....O#.#O.O..O...OO#...
OO.........##....##.O.O.OO.....O...........O.....O..#..#.OO........#O...OO.....#.O.........#........
#..#.##O#.O#O..#..O...#.#.O.OO...##O..#..O.O........#.#O#..#..O..#.O.....O...O..O.O....#...O#....#..
O.#.......O..O#O...OOOO#OO..O..#....#O..#...OO..#....O......#..#....O.O#.#....O.OO..O....O....OO..#.
O.OO..........#..O.#O#.#.#O...##..#..O##..##O#.OO......O..#.O.O.O.OO....#.....OOO#.O.#.O.#O##.#OO.#O
#..O....##...#.O.OO.O.O......#.OO...#......O........OO.#O..#.......OO..O..O...#.O......O.#O#O#...#OO
#...#..#OOOO#.#O#O.O#.O.#.###...O..#.....O..............O.....O.#.O....O.O....#...........O...O#.O..
.#O.O.OOO.....O...O...#.........#..O..O.#..#.O#....O#O..OO.........OO#.........#..OO.O.......#...O..
..#...O...#O...O..#.....O..O.#.......O...O.O.O.....O......O...#.....##.O.O#..O.#.O..#.O..O..OO......
.O.O..O..#O..O#OO#OO.#....O...#.O#.O.#...###........O.....O..O.OOO.O...#....O.O....O..OO.###...O...O
.#.....O..OOOO..#...#.#.O......O..O..#.##.#...O#..O.#.#.O#.....##...##O.......##..O.O.O.......#..OO#
...O...O...O..O...#..O#....O....#......O..OO#...O...#.#O.##.#..O..#.##O..#.#...O.....#.#O.O..O.O##..
.#OO#.....#O...O.#.OO......OO...O..O..O...#............#.OO##..OO..O.O......O..O...O...O...O...O....
...O....O..#.O.O###..##.O..O.O.#...#.OO.O..O.O.O.O.#.O..#.O##.......O..#......O.O..O.OOO..##O....#..
O...O.#..........O..OO.O#...#OO.OO..#O#.......O..#....O.......O.#OO.O.O.O.O##.OO..##...O#..OO#..#.#.
.O....#.#O............OOO.......#.O..#.#...#O......#....#.##..O.#.##OO..OO.#.#......O.O.....#.OO...O
..O...O#...O..O..#..#O..O#..O#..O.OO..O#.#...O####..O...O#..##......O#....O....O..O...O........O..O.
O.O.#..#.#..##..#.#....#..#..#.###.O#.O....OO...#....O#.....#.........#.###..#.#OO..#O...O...O.#....
..OO.#.O.....O.O..#.......O...O..##.#.#O..#....#OO.O....O......#.OO#....O..#O.O...#.OO#O.#....O..O.#
#...O#.O...O..O..O.O#...O.O.......OO....OO..O#.O..............O..O#.#...O#....OO..OO..O....#.#O.O..#
O.O.##..O#...#O......O...O...OOO.....#....O#...O#.#.#........O..##..##.O..##O.O..O..#............O.#
.....#....O..O.O...####...#.O.#..#.#..#....#...#.OO.#..##...OOO.#..#......O.OOO.....#O#.......OO....
...#.O#.O...#.OOO#.......OO.#..O..O##.#OO.O.#.O.O.O#.....#.O.........O...O....#.O#....#.#O..O..#..#.
...#..O......O..#.O...#.....#....O.....OOO..O..O##O#...O...O.#...O....#OOO##..........O....#O.......
...O.O.#.#...O.O#O#.#O#O....#....O..O....#.O.O#.....#....O..O..............O...##O.O....O..#....#..O
O.....O..#O....O..O##O..#..#.O.OO..#...##........#.#.#.O..###...#O.##..##..#O..O.OOO...O.O.....O....
..##.......#...O.O.O#O.#...O..OO#OOO.#..O....#...O..#....#.....OO..OO.#....O.....#.##...O.#..O...#O#
O##....O.O..##OO.#.#.O#..##............OO.O.O.#.....#..OO...#...O..##O..........#.......O..OOO...O.#
#OO.......O.O..O...#...O#.#...O..O.....O..OO.O...#OO...O....O...O.O...O....O......#.#.O.OO.....#....
...#..#OO..#..O.OO.#..#.....O..#O..#....#..#...O...O...OO..O#..O...O.........#...OO.O.#OO#.#.O..OO.#
..O#.O.O.#.#.....#...O..O#O..#..#..#.#...O..O.#.O.OO..OOO.#..OO.#.#.....OO...OO#O#.#..........O.##O.
...O#..O..O..O..#OO.###..O.........O#...OO.....O..O#....#O.O.O..O#.#...O#OO.O..#..O.O.O...O.OO.....O
.....O.#.O..O...##..#.O#O.#.......#O.OO#...O...##.OO#...OOO....#..#..#O...O.O#O.O..O.#OO...#..#.O#.O
....#...#O.O...##.#...#...##.O....#.#.O.O..##.O...#O...O#OO#..#.O.....#O#O.O.O#O...#.#.O.O..#...O..O
.O...O....O.....#.#O.#.##.##..O#..OO#O..#..O.#..O..O#....O#..#..OOOO.#.O..OO.O.##......#...#......#O
O....O.O...O#.OOO.#..O.......#..#....O#O........###..O..#.O.O.O.......#....O.O.O.##.O..#..O....O..#.
..O..OO...................OO...#........#.#...O..#.O.......#...O.......O..O#...O.#.O#....O#.O...#...
.O..#......O#O#..#......OOO........OOO........O#....O#.OO.#.......O#.OO.......##.....OO.O......O.O..
.#O..#O#O#..###.............##....#..O...#.O#O..O###.O..##..#..#OOO#.#...O.#.O.....O.#...........#..
.....O..O..OO.O.......OO.O.....#..##.##OOO#.#O..O.#....OO#OO...#...##...#.O...O....OO.O.##..O#..###.
OOO#.....#..#.O......O...O...#O..#....O.OO.#...O..........O.....O..O.....OO...#..O..O.#OO.O..OO.#...
O.OO.#...#.#...#...OOO.......O#....O....#....O.#...O.#.##.#OO.O..##......O.##OO#.......#.O...O.OOO..
.....#.........#.............O##.##..O..OOOO....#....O..#..O..#...O...OO.#O....#O.....O#O#......#..#
.#.O#O#.O#OOO.......O.O......O.#.#....#O..O..#..#.......#O.O#.....###..O.#.O......#.#.O#......#O....
..#O#.#.O.#O.OO.#O.O####.#..##.O.....#...#O#..#O#O#....O....OO#....O#.O...O.........#O##.O.O....#...
.OO..#O..O#.....OO....#O.O.....OO#...O.....OO.......#..O#...OO.#.O..O.O.#O.OO#.#O.....O...O..O.O.O..
..##OOO.O.....##..O.#.#.##..#...##.O..O....OO...##O..#.OO....#.O#.......O..O..O.#.#.#....O.O.O#O..O.
O#.#..#.##.O..O.O.....OO#....OOO.O.O.OO.....O...###.......#O...#....#.OOO.#O..OO...O..#..O.O.O.....#
OO#.....OO.O.#OO...#O...O.....O..O.#....O............#O.O.O....#.......O.O..OOO...#...#...#.........
......#..O.#.....O....OO..##..##........O.#O..........#OOOO......O......O.O##..O#O#O.O..#.#O.....#..
..O..OOO.........#.O..O..#..O..O###..O..##...O..#.O.O..#.............O.....##O.OO..#.#..O.##O.##O.O.
..#...#..O........O.O.#..##.O.#O......O.O.#OO..O..#..#O.O.....#.##..##..#......OO..#.O...#..#.O.O#..
..#...#..O......#......#..O.##.#....OO..#...#.....O.O.O..#.##...##..OO......#.OO....O..O..O.O.#.O...
......O...#O......O.O..OO.O...#O..##..#...#..#....##........##O.O......O.O...#O....OO...............
.....O..#.##....OO.O...O..O..O.O...#....O.#.O....#.#..OO......OO#...#.###..#O...O....O..##O.#..OO.O.
...OO...#...##.##.#..#...#.O..#OOO.....#.#..O...O.##O.#.#..#O.#O.#......O#......OOO.O#.....#......O.
OOO.O.O...###...#...#.#...OOO.O...O..O...#....O.OO...O..##..O........#.O.#....#......##.#O..#.#O#O..
....OO#.#.....O..O..#......OO.........O....O.....O..O#.#..##O.....#.#.#....#..O#..#OO.O...#.OO##O.OO
O.O..#..O.......O.O....O..OO.O...OO.O.......O###OOO##.O...O...#O#OO......O..O..O...#....##...O..O...
O#.O#.....O...O.O...#.##.#.......###....O.O.##......O....O..#O..#O#.O..##OO..O.###..O.OO#...#....##O
O..O..O............OO.....O.O..O...#............#O..O..O#...O..O.O##........#.#.....#....O#O.......#
............O....O#.OO...##..OO#O...#.....#OO..O#.......##O.O#...OO....#..O.....#..O...O.OO#O.O...O.
.#...#...OO...###.OO.OO....#..O...#...O.O...O....#........O.#..O#.OO..#....#O..O##.......O...#..##..
#.O.O#.O..#....#...#O#...OO..#...O.O#.OO.##...............O.#......O.....#..O..#..O..#O..O..##.##.O.
O..##.....OO.O##.O..#.O........OOOO...#..##.........#.#..O.O.OO#..O##O#....O.O#.....O.....O#..#...##
O......#.O...#...O#.#...O#........O..#....#..#.O.......O.......#.....#..O......#..O#..O#...#.#O.O...
..........OO###.#.O.O..#...##..##.#.........O#O..O.#O.......O..O#...#..O.O..#.O....#..O..OO.O......O
.OOOO..O....O.....#.....#.#.O.#O.#.O....##...O.O#O.OO.....O.O#.#...#..#.#O.O.##...O...OO..O....OO#O.
O...###O...###O...#...#O...#....#..O#..#O#....O.##..#.....#.#OO#.O...O.##O#...O.....#.......#.O.....
O...#.OO.O##.O.....#.....O..O...#.O...O.#.....#.O....O.#...#OOOO..#.#O...O...##..##..........O....O#
..OOO..O..#...OO....##....O....O...O....#..O..##.O...O.O.....#.#.O.#.#..O#O.#.....#.O.#.#.....O.O#..
#....O.OO##OO....#...#.....#....###.#..O..O.O...#.....#..O.........#O#...#............OO....#.OO..O.
.O.O#.#O#.O..O........#..O#...O.#..##O....O#O..O#O...#.O...#.....#.#......#......O...#...#..O..#....
.#..O..O..#O..OO....OO#.#...O.....O....#....O..O#...OOOO#.#...#..##.O.....O.....#..O.O..#...OO#OO..#
....#O.##.O.....#..O..OOO.#.O..#.O.....#O.O.##..#OO.......O..##...O#.#.OO..O..#...#......#...O.O....
#......#.#.....#O...O..#..#..###..O...##.OOO.O...#.O..#..##.O...#..O..O....O.......#OO.....#....OO..

48
15.js Normal file
View file

@ -0,0 +1,48 @@
import * as std from 'std';
var data = std.loadFile("15.txt");
var codes = data.trim().split(',');
function hash(s)
{
var h = 0;
for (var i = 0; i < s.length; i++) {
h += s.charCodeAt(i);
h *= 17;
h %= 256;
}
return h;
}
var hashes = codes.map(c => hash(c));
console.log('silver:');
console.log(hashes.reduce((a,i)=>a+=i));
var reg = new RegExp(/([=-]\d*)/);
var lenses = codes.map(c=>c.split(reg));
lenses = lenses.map(l => { return {bin:l[0], cmd:l[1]} });
var boxes = [];
for (var i = 0; i < 256; i++) boxes[i] = {};
function rm_lens(lbl)
{
var box = hash(lbl);
delete boxes[box][lbl];
}
function add_lens(lbl, f)
{
var box = hash(lbl);
boxes[box][lbl] = f;
}
lenses.forEach(function(L) {
switch(L.cmd[0]) {
case '-': rm_lens(L.bin); break;
case '=': add_lens(L.bin, Number(L.cmd.slice(1))); break;
}
});
console.log("gold:");
var sum = 0;
boxes.forEach((box,i) => Object.values(box).forEach((v,j) => sum += (i+1)*(j+1)*v));
console.log(sum);

1
15.test Normal file
View file

@ -0,0 +1 @@
rn=1,cm-,qp=3,cm=2,qp-,pc=4,ot=9,ab=5,pc-,pc=6,ot=7

1
15.txt Normal file

File diff suppressed because one or more lines are too long

94
16.js Normal file
View file

@ -0,0 +1,94 @@
import * as std from 'std'
var data = std.loadFile("16.txt");
data = data.trim().split('\n');
console.log(`grid is ${data[0].length}x${data.length}, total of ${data[0].length*data.length}`);
var in_grid = function(c) {
if (c[0] >= 0 && c[0] < data[0].length && c[1] >= 0 && c[1] < data.length) return true;
return false;
}
function measure_power(start) {
var e = 0;
/* Energize the tile that beam b is on. If the tile has already seen thsis beam config, return false/ */
var energize = function(b)
{
if (!in_grid(b.pos)) return false;
var sc = JSON.stringify(b.pos);
var bs = JSON.stringify(b);
if (!energize.cache[sc]) energize.cache[sc] = {};
if (energize.cache[sc][bs]) return false;
energize.cache[sc][bs] = true;
return true;
}
energize.cache = {};
var energized = function() { return Object.keys(energize.cache).length; }
var beams = [{pos:start.pos.slice(), dir: start.dir.slice()}];
while(beams.length)
{
beams.forEach(function(beam) {
if (!energize(beam)) {
beam.kill = true;
return;
}
var c = data[beam.pos[1]][beam.pos[0]];
switch(c) {
case '\\':
beam.dir = [beam.dir[1],beam.dir[0]];
break;
case '/':
beam.dir = [-beam.dir[1],-beam.dir[0]];
break;
case '-':
if (beam.dir[1]) {
beam.dir = [1,0];
var m = {pos:beam.pos.slice(),dir:[-1,0]};
m.pos[0]--;
beams.push(m);
}
break;
case '|':
if (beam.dir[0]) {
beam.dir = [0,1];
var m = {pos:beam.pos.slice(),dir:[0,-1]};
m.pos[1]--;
beams.push(m);
}
break;
}
beam.pos[0] += beam.dir[0];
beam.pos[1] += beam.dir[1];
});
beams = beams.filter(b => typeof b.kill === 'undefined');
}
return energized();
}
var start = {pos:[0,0], dir: [1,0]};
console.log('silver:');
console.log(measure_power(start));
var starts = [];
for (var i = 0; i < data.length; i++) {
starts.push({pos:[0,i], dir:[1,0]});
starts.push({pos:[i,0], dir:[0,1]});
starts.push({pos:[data.length-1,i], dir:[-1,0]});
starts.push({pos:[i,data.length-1],dir:[0,-1]});
}
var high = 0;
starts.forEach(function(s) {
var e = measure_power(s);
if (e > high) high = e;
});
console.log("gold:");
console.log(high);

10
16.test Normal file
View file

@ -0,0 +1,10 @@
.|...\....
|.-.\.....
.....|-...
........|.
..........
.........\
..../.\\..
.-.-/..|..
.|....-|.\
..//.|....

110
16.txt Normal file
View file

@ -0,0 +1,110 @@
\.-/...-\......../.|......|.........../..-..................|....-.\............................../...........
..........-.............\...\.........|..\.......................-..........-.......\.../.......-/............
........|.............-.....|..|........................\.\.../../.....-........................\.............
....../\.....................|........|.....-...........-..\......./-.............................-........./.
.\..\.............-........|.......|...|..............................-..-......-......|......................
..........|/...\.............\............../-......\.../........................./............./.../......../
..............\......./..-...............|...........\...|............|...........-..-............|...........
..........-...............|..././...........................................|...........-.../.-.|.....|.......
.........-...|..................-...........\.-...................../.../........................|/......./...
.................................-.././...................|\..............|.........../.......................
.............../......-.................\....--.....-............................./.|./.................|.....
..../....|...|..................../....\...|............|...../.././../--......\.\....|.......-............\./
......\....-...|......\...........-......./..................../.....-..............\.............|......./...
............|.\...................|.........................|........\............................./.\.......|
............../...............................|.........../.................\-.................../........../.
.|....|...........|..................|......./|\\.|\.-...\..../.........//........|............../...........|
........................|.....--......|.............-..................\...../..../.......-....|...\..........
...............\........-........../...-|............\......./.\...........-|................/.-..............
..../....|.\.............|......|...............................................|.................\...........
.\...\......./.....|.\....|..................-../|-......................|.................-..|......\........
.../.........................................\.....././....................|.......-........-......\....|.....
.................\./\..-../......../...\................................-......-..\...........................
.......--..-........\/........./........../...............\..............\...-........-......-../.........|...
.|...............-........./..............\..\......................|......./..|..............-.......|.|.....
........./............\............|........\...|...\........-.......................|...................\....
..................-\......../.................\.......\.....|...........|..|-........\.............|.......\\.
...|.........../.......|...../...|...\........\\...................................-............-../...../....
......./....................|.........../...-................-....................\.......|...................
\....\.......................-.|.\...../..-...................|......................-..................../...
......|........-|...-/.|........................./.....|.....\.........-........-......-.............././.....
......|.............-.\...............................\..|....\..............|./..|./...\......./..........|\|
......././.\...................-...-............/...................|/..........-\./.................|........
.........|..........|\../.........\..............-.........\................../\./.............-..............
...\.......................\..................................\...........................................|...
...|........\..........|....|..../..|.........-\.................-...-..\.\.........\............|....|...//..
.././.....|.....-..........|.................\.........\........./......-...-.\.\.....................\.......
......./....\........\\..\...|...../.................|.......|.\.....\............................../\....\...
.........\......../.\............|...............................................................|/...........
.\.....-\-.........|.........|....|...........-....\.....|................\...............-............./.....
.....-..............................-.....-..........-..................../..../........................|.....
...........\...........-/....................-.....-............/........|........-/.........--./........-..\\
.|................................................|..................-.......|.............|\/................
.|.................-.-..........|.........................../..../....../.....\...../......./.................
........./..../..|..........\..................\....................................................../.......
.........\............|.../......../........|......................../..../...|.\...\......................|..
........./................\.............\........|....................\./......|.........-....../...../.......
..../.....|...../........-...................|............/.....||...............-....-.-.....................
\./...\.|...|.............|.......\....../|...\\/.|.../....-.........\\|..|....-........\............-.......|
......\-..............|.....\.....|...\..............................|.....................\......-.....|.....
......\.-..........-..|......................................-..../......................../........\.......|.
/...................-...\.........--.............................\...........\................|......./.......
.................-......-..../..\.............-./|......-....\...........-...................\.....|........-.
|........--.............\...-....|.......|.\............|...../\...........\/../............................-.
...|./-..\.|...........\........../..............................\......-.......-.....|..........-........./..
.......-|..................-..........|..-............................../.............|..|.||.................
....-......................\....\..................\......./............./..-........|..............-....|....
-..........-.........-.../|........--.............-................|..../|.................|..................
...\......./..\..\......./|.....|-.............-............................\..\......\...-..\...............\
./......................|..........\...........|.|.......\..........\......................................\..
................|...............-.../....\......./.\........-..............................|...-....-.........
..\.......................\..../..|.-.........-.............\.......|../.|.|..|........|..............-.......
...........\................\..........................\.....................\........|.......................
..........|....\.......\...........|...../......................................./...\.../........../.........
./...............\...........|..-....-./..\...\...\../...............-\............\....\............-........
././............|................|........../...\...../.............-....-.............\......................
....-.|..................../.............................-...............................|....................
..-......|....-.........-...\......\.........||....-.\............................-...|..............|........
........\...........\.-.......\.../.........\.../.....|.................../..|..|....\..../..-................
..........-..................\..|...|.|..\......................./...........-......./.............|..\...../.
.\......|\.|..\.......|\.-.......-........../........../..........\.........../.........|.....................
./..........|..................//.|......|........-...\...//............-.../..............|.......-....-.....
...............\......\........|.-................\......-...................|.............-............-.-...
...........................\/...........\../..\....................\...........|.............-..........-.....
.............../........\|.........\..........-......../............-..........|........|/....................
....\................-..................././........|.....|...........................-..|....................
\-............-.......\......\.................../.......-.../............/....-..\.......|................|..
.........................../....../.|...\/...\........-|.|.......\..-........-............................../.
.................\.....................|..........|.............|......|/.\..........................-........
....\../................................|.......-......|.................-......................|...-.../.....
....-.........|..../|..............................-|...............................-..-......\.....-.........
./\...............|.|..............-./..|........./...................................................\.......
..............-....\..|....../.....\.............\..............................-...-..../.....|..............
........-.........|..............................................-....\--...........|\...................../..
................/.|.................-....|......./............-...................../.-./\................|...
................|............................../..-./.....|..-........................./.....|..............-.
....../........../.......|...|.....\........./.............|..................................|.|.............
....................................................||.....|................/......-....../....../............
.........../.....\...................|...........\../....................................../.............../..
./.|............../.............................\..|....\-............./......................................
.........\................../-.....|...........\................|...../..................................|....
..|...../.....|...............\.....-.................................|/............-..|..-...|......-........
....|....-..............|.......|............./\-...........\//.........|...........\...../..............--...
.............-........\|...........................-....../....||............/......./....................../.
|..................-......\.........-.......|..............................\.|/..................\......\.-...
....../.......................|........|..|.\...........|.........\................\\..................\.../..
...........-....|...........||...-.......|.|....-.....\\-................|.........../..................\/....
................|.-.................|-./..-..|.........-..............-.........-../........................-.
.....................-.....................................|.........\......||./................|.............
............/...-............|......./......................................../..........................-....
..../.......\.-............|..........|....-...........\.-.................................\./...|............
...........|.-........|.|....-...........\......-...-..........|.\.|.|.....\....\............../..............
......\...\....../....\......\.|......................./.......................\.................../..../\....
...../.|...............|.../\.........................................-...........|./........................|
.........................-.-.......\./..........|.........|/.......-......................-...-..|\|........\.
..................|......-..................|..........\..-../........................-......\...\............
..|...............\.............../.........-./............../.../..../.|\......\..../-.....|....-.........|..
...-..-..............--...|...................................................|.-.../.../.....\.....\.........
.\./.../..............././.........\.........|..\..........\.................\..|.....-......-................
......-...................|../....................|...............|.............|/..\.......|........\......|.
......\/.....|................./..................................|.......|./........|.............-...-......

129
17.js Normal file
View file

@ -0,0 +1,129 @@
import * as std from 'std';
var data = std.loadFile("17.test");
data = data.trim().split('\n');
data = data.map(d => d.split(''));
var gheight = data.length;
var gwidth = data[0].length;
console.log(`${gwidth}x${gheight} graph; ${gheight*gwidth} nodes to search`);
var start = [0,0];
var end = [gwidth-1,gheight-1];
var gdist = {};
var gprev;
function vec_same(a,b)
{
return a[0] === b[0] && a[1] === b[1];
}
function in_graph(c)
{
if (c[0] < 0 || c[0] >= gwidth || c[1] < 0 || c[1] >= gheight) return false;
return true;
}
var graph = {};
function left(c) { return [c[1], -c[0]]; }
function right(c) { return [-c[1], c[0]]; }
function node_dir(c, dir) {
c = c.slice();
c[0] += dir[0];
c[1] += dir[1];
return {
c: c,
dir: dir.slice()
};
}
function dijkstra(source)
{
function get_node(n)
{
var nn = JSON.stringify(n);
if (!graph[nn]) graph[nn] = {
dist: 100000000,
considered: false,
previous: undefined,
streak: 0,
c: n.c,
dir: n.dir,
value: Number(data[n.c[1]][n.c[0]]),
};
return graph[nn];
}
graph = {};
var first = {
c: [0,0],
dir: [1,0]
};
get_node(first).dist = 0;
var leafs = [];
leafs.push(get_node(first));
var endnode = undefined;
while (leafs.length) {
var u = undefined;
if (leafs.length > 1) {
var i = 0;
i = leafs.reduce((low_idx,b,i,arr) => arr[low_idx].dist < b.dist ? low_idx : i, 0);
u = leafs[i];
leafs.splice(i,1);
} else
u = leafs.pop();
if (vec_same(u.c, end)) {
endnode = u;
break;
}
u.considered = true;
var adj = [];
if (u.streak < 3)
adj.push(node_dir(u.c, u.dir));
adj.push(node_dir(u.c, left(u.dir)));
adj.push(node_dir(u.c, right(u.dir)));
adj = adj.filter(n=>in_graph(n.c));
adj.forEach(function(x) {
var n = get_node(x);
var alt = u.dist + n.value;
if (alt < n.dist) {
n.dist = alt;
n.previous = u;
if (vec_same(u.dir, n.dir))
n.streak = u.streak + 1;
else
n.streak = 1;
}
if (!n.added) {
leafs.push(n);
n.added = true;
}
});
}
var p = endnode;
var path = [];
while (p) {
path.push(p);
p = p.previous;
}
return path.reverse();
}
var path = dijkstra(start);
console.log(`Least heat is ${path[path.length-1].dist}`);
//var d = path.reduce((a,v) => a += v.value,0);
//console.log(d);
if (data.length < 100) {
console.log(`heat path is ${JSON.stringify(path.map(p=>p.value))}`);
path.forEach(p=>data[p.c[1]][p.c[0]] = '@');
data.forEach(d=>console.log(d));
}

13
17.test Normal file
View file

@ -0,0 +1,13 @@
2413432311323
3215453535623
3255245654254
3446585845452
4546657867536
1438598798454
4457876987766
3637877979653
4654967986887
4564679986453
1224686865563
2546548887735
4322674655533

141
17.txt Normal file
View file

@ -0,0 +1,141 @@
222343122415245553243251316124223234134666332224124211645376775672443247264263475261513546522316162532215534453661231232515522214351143451211
422125443253354142511545636246664666565355152246453231651172747635424163415626462753445445312334225221624336126244661514234445544425223533122
131212112421423414125516356342555542626661163526211536677376523712262371162153644117776261645533664544366146314432523222515425314231311544521
131334344235153415214541223454455223563154114267331524774136127715554416125273543276346471735741663351266324144422511534542234341513351345352
314541545523112111131565114333211153312641614321771374726154434476767125613311254537363422511721275135434164664442151263234241114111121141334
435153335153513534132112326653656626231351436457153446433363235565156156723233715473535244413451723176561153261562445512312413413513135513241
235243535523134543445216214455445352435554624255171271225755313626173154112144673146273747537614771377613244145436355342536323123434425211113
132552152551514515631323412533333446136243376366556365574745474652757277632216317677316551253673465513776336664225626313216456312542531241352
311415311541314143614162642634556464574541744355655753776632763662153656721435137347422375344242225276244673434333351454464536453212424421425
453351344131342126143165264626543453632747531417235617257564537542611276314542732241535726557435722271523761452243145343543365433423153132344
424354321333252642533513531241416236636427325176724425161362563217173773414665312244155777552374513335344162564462411154332652126231133233331
433224533551436134314641523151361154615353522622137441214134673454347752343853221756746664765556521762762464233333523123643145626644231443435
243311313556533564523443331214721572253144611715156456321767676655457736255732864573164467712433421256325731135656541255561161224441152415141
511211214252345356344156642436611545463224342452742717585325436325574336455336582448256836717741726221177352616311422112513255165441212221131
244253443163544142511413446172632624762126756145146775348573476557644782564438437852836725866452746165474553473737534665123425113435563332453
232155346345514313654314235557517112176174776332136456448427547478426265844263882743533766568854547675464477171376662424251312612162632514355
424114441642564135264345176163444365144163124128832285838626688224834432458556377773645427653638562736676174576737574642156232566466636441124
543244331213246512421551417132132647763461226245235583478358556478588445828784366325778587856624776125647332126411416416253326543252561355453
513411632124243263566153173255453461117356682265475822242236525286334354628536868726586284535383867467645552277715213631624352612331534144225
234513324414264131211345613416736552211115685767773523645885727834464346536233245827443237753783724626566246761647646475456131431415434413214
132312323255146664114745115275443572754326543474673247542856435836784453584863735676475556838547655484787272216413226712176641452341133361621
324445311115236332563161165371142354332783687877726543524347444677384655338335874866474624655543543466338566764524432633543363631622335214314
452146561262254136627644671525514257523265444635773245326674352228844844533536247443486645863647324742823822411266212747246263222143515531123
323443456261326564347757145611113632534754323645837762327643383533554795688333775647234446628482555868382485343642524356327477353226234131236
323566623463524644662155345214734554448367587534458465333783778836737748873896436675564776876254472473382773351746477537426351164321556552155
411624314463555226413151162214157826642348553426375774773937688356445778864665387877397647688288645648488526683635462551221145364643422311353
632541423444624336526576464457777686224586376437338832948677343497666833369685846994446858346385546773453274862246234173462724342631561154224
353552612514333121215745416727247272652423544685753368594647394695658845883548858535734584333432476287445274435882257755366724515216151451335
532166314441574113623175262414284358754786632434337878589943898388748395969493754638344944356356855723827482463322173565111471477266643531656
116644351623354144151425116542234543365536844644456554366885339853375594997998864974865377578863643354482658652565456654732562467462642222633
425265565534525427323521564886284475834357765873953575557676864375449896735695696945686539933897587748627756658646775714547636543542445454453
535223341313647443711526456446656284686644344893747447894898636684595668686646634379736944587367734766868686525582828566224141647377452234555
363661154543263115262561162483434662346246798873478436638737549697754638834495375733735333645433574877375276735684662372751455123234415466135
233425541263155564422777566657463284532222644739657858356574964435535676435594635788954898867344838753677578547362236357265747553176223645334
516113313346251471245336736766463235445577574763999559496983357388779634999695985559489635746544658453383775634426265623615715313624324613363
325162436525537742416463226466422582452664444569687695737766869564846698477563438574369658749388443473974527623665566388541124766765465414216
246532424466452274271137247462733834328375758733755764656833968984956876697799766884997394499744585594587876625677723447244217267426213343664
164356325132241765153442235356485242287535595375398869579646888545895757975449659944533834737579865398575662388572336243423321763313272155166
563615555622724634724833866443433524894838958833799835363644977657658578544664475868679458747866349983337933858733558557637772576116524351364
415635136113175137578553536586564768643559866697595733497557879468449998976698759797676436636689587877974934738258785642847435574452213713115
611145153512463742256332755487858466583796497738685664885658748948569545664445888744947857868589779795933867483673776857358564657524755764663
235565633417713142257732254688636564985938796475899556649457697557496557466787887559566976984578789695478656638728764846466352277661663613361
621414363456434251274757622526573747939964946885796964745598945469487687577499977988878866574434454755956575894225366755752223145132155653231
345131227736331632753528624737877993467633874573544566489488585879587798745544677645759486797999989373758553748378762622865225676664655255241
211147374365347566347683538644229836375367399779966469889799674657475784657559849567645885568589949973844765649576234674566626355732735375222
123377577423217135757464227844458664877347575684876765589445958984848645558957589999985649678755757487567997496322362828232445742466637677526
664165716524474573468574845478963396633746335989586478477469677874488696466969855457589699479795777786993453995866655558838835473455711456363
645354217411347423778226725287476938984748595969986859957845897656645797969945967774756979786597495489759753559534884668577746471267563715146
641123731653617153523878786635997676839634584755798896844786989789997886975976877949768456676679545757849946967975863276534664727276625714772
115172313432542554343534322666684547383747359496846665858866986576677885977798965677465955688547658777937483437698822255673227856674321437423
412316124234335666538374784464654983653484498444688865778477997658875656978599866558669858496479969969883747883595375635748886535531163731666
126215534552633672772444476653659865338587448788645985679486758768567978966789759768556688875958549895757653789978826784367383554244325537527
252471722164728674273366346869733763887789597776444684764998985757556667899857586887855996664484555498483585754587755247628423684671244526734
616643241174113524686752733973994433637977478579974486858559967566675596878985789668957757945476696698659695977366876442282382768473657366141
433715625621658365787576378559966694694594565764577974766866977599956779776859687775695787565694987685963787977966448785772368444344613132341
542654365337336826434765643879738646353964647955974749776876686976656857777555965796959755779797949695874357763646457888473355582731254116326
461216754736354442526774233456439439344649448885449769679668978899596596779679669865776767595846454969558697477357393642534444663773547743151
242515737157657333842228548349875463457585648494866999577597668698587656558567788999587689857767876885764484449548964773473277753231345166735
654521345226446835568566235799768737539786475876888887965595966585598966967969975867759665599758868667576445864433979732538253832712175534524
115512724255847238822523769738898864344596868468594857859588665686578579798878998656799555798598889485694534558457599364226342568753677472213
111524524557584843753648338688446565566879945758747566968678858898688798787995576956865896565768766698768659698554344826255288878683415552615
775523534424885336584535598468769386864885649976596679699998877966986778776767559667869889767766556949956568378399476985828735885425764761532
617234235723887272453554398456849533986998847969886896697596899979688786876777696866697569685659688446949473894494359678374775655237573674227
731315731775542663287374348536374735499748575465485866966768699899697997797776666566989778755777686999847946948853933693544267753841326646546
722426246522232587267567746363433367778759685487558796666966958776698867986668698666876866775886659846776955633755765593638285378256357434712
174725351666826552875547497865663863549888789874668876958895676696978768897788786788566955869997548858768874638777786742243328886625132571731
611354237262464432722652894576534365759676599966965877965957687768769888968769696957679665987557457444944459839769348686383583662783465636276
435775645554577458385385799454458446877466964957585556758766679978876698869886969697899756896864788684659949467367797467452464686586746747527
326715157438852348356648795697795987947557758498877979757678677886679987996677668886868888557795864545877549896579885386328386465786533157726
453273273424255488663856445483976736667859995777897779896656697978997888787987898778776958957796758748894869487957534497554376546868722122324
224573216435873475783673336556553645879964994546857977556976898696968678989979687688777875655579994576659674597887987885384834758677414425113
356241135726344637684746374354974769468887978766569659956588999669799779786678667886579699675678884889486587434679643859352582448655434457222
466565323122567376356874397989745956794895966548765989989778688799697678896789997978696969665976575677558444868875986457762338452225134143337
362264215456463347238855743779549969969487765646768855768895876877976886666866799968989767688568764586578687569679978449782326532643416155546
671362724447463788282378857469553747694544454845755975585656699878677799678797776968799697957896898878765444867363549353272748888443452166364
632542654733754847425787585687488755596748847964799999775985798869786789699666867675565568797969676665954954838875438688564548862244145146171
333723417316447367476286584684499973896998895898557855668598997699996977697796768788767776689759949696664864687338847464274357245662617625121
732722335132788573566373398994377893654688989578766978658865988697879899789898877758688978567997675756877983739477395738266566365866553224517
147177514747474242267782783587784747967985778647866665897959877679967669667689876857669669767556998597597497483549887695587764775634662343617
152744472376652374322667687839455953897495766449899756875956679668789688868676978978876787578985556849965685833354883453248267842384616432657
217227543612352346346455856939488455758985798868598588765697888677977868879697796686766696678556576857569777547694747435272652536672167123712
744625215616674868776537785459394998859647888485449778786556769796876987889777989756758976977758496584958578978633843394583557326773745211217
353354332722486863626455784779737558677796677557648786868756998567779997999757769989968679778794444858495938377534839655447657354377534537617
351162251452745473452566496983484689397949849568679798775655588857855767769795678968695766898846549555848585493436735966444566758545364773274
546334341147183722785558798496869978864895677895756565879578585766957665575757696669676677769768545948765446463585354842584745473612425647573
235615763364478535767825263879546994497978874484569465769576969857869669765659777668868977865946966479776587987999955433355672374557554754214
162177325222163583735436483646438894396659587698644456886655596959879587966867768858997789444759867989565846639353845278562446263633245724416
324535255452483383635664425784958857579867676497445879975595969977679879855779697798889657664476857564676937793853344868547244368834643131142
121347276513238722442368557665693779499584456766988769868757758795788956896585869778678687556788794995887699638544336543625582864246234111541
357771157266317334828437783465549356369747964978875778866775965679685977988796799568586768676664767564576835757749675276226376757244531177246
336664616327762746632336856333359783983467896468668468658857596888666655696975568657694759566847599666396674475446532283582787232143364371132
644533212754142233635788744897443835653636699755644785889878558985567878858696858779788657475547995487649399794638387758824355331366214575725
222217676717612667687783367437478679946969645869469768494864887557985785659965856994457654994548995554598868743539788752855264561637271324324
356452154463414577848785374339498366535638544946846765677495769785557579699659788879447959897745467466459849543743454246822537753427335371562
343351256333451586862433643627656985753774749546555768998795848687576559887698545798748988498774696693748665338953758884323743215516455337651
511156433162323673647444877388393898578477588665844949845684789786485757669794987664595874795599974455755347864958728824643583546532455523751
156124537652656126446766564883685565845949468648655489495444579455874554846945778967786444756587898964737436487344256846452377111452125151424
515264356113762652852852632686537484556764597765774578755556886965448899978985694964457598494775673883444869546887836668355228143455736361562
263512646525146141226625365446528679473694599878945468469659775468694555669548954648468546665655847884688365888823562232347546127534712221733
631415241711525626678448673422265459959576695493999586674865475767744965494946497644686744965594334353963643655244478563353652375272512755651
233341711151632262167275682837682337594668593834657957999678754665457846558698875995554875885564465558544593484682334467458266753354353656363
222614621174264456548568855775763264556684446457483755666594465554896878549965797747587445795345639937745754468637877328233727712145444373316
551136576466563613374865837744634548656596546959875864946578986489646467467887584454698786369755639588797883757583882864432762672266561742114
311433545766254471655428367633528758869667674337353886355568568977559794557448545869856978986385835684993879575657778365536445625371464633155
223612464456771261577683747465843843667648368983574634838577897765496687876598844667977633334687854753563787465237347324763236171472235426346
411245121677351625555347323585443444334598696449339998397379788744556985684748696646376458494657966586849537253887746577841254462522431254352
344346233632636772414765673728476885836598589955558748979779588656646877576889768598337348786569379345443684386546372358847445714773517622512
155323536362462251246768675874228887274856495665585569666835536867574987794867838438565638693854398377677783434776265675564455312663443423541
331566446775752674417132753235465665833378447847639386878845593445734945386694688999635777683567968539426228468486664337643254264256612362121
243564654224225645722672382353864676463257496747548887493585987546678658735985743376384577953533946647357564447863573451724364472125432653566
342315614225414552353574355435638346877654437484463854837898965395385547754648364866393337683989446882326338262227448314144441743477561422165
513316635431624236671443348277886572254832458877847668477593794644585888563857755634797589885668862754772785358487877315135613177367144545513
463143244643262172563515774358878556748352525757567987986693359853994963575439443448643467386743366524235883462535432614464455735443452664134
365641135114444646623465131227245648484522527682468766639838853356859443957586854538395483886846572325432336737857272623363152162131551135414
416313341334271754356764361744638674522648825426627539586358437534848469663986377869797354638474474353788632454247175546246417444136416435644
224353155431264253763746646441542886447853826453463553364576374757797585985553484899859547773742768633328427884282476754133441524461616242643
141663652631255115673535171111246265842334873322667887864398959494389595436394448689564435578232373254536888873517235136312276614212451451513
124131511566566612435515461237554545678463532355284383577958338477334574565899548354995646534573786226335788675417311262514713363312364535154
423124641651141434731445642547213258886735546328578275442562699767675575457466479427885838355373878586875834224154546773247146645646322335264
412644326632526437735316412561445417468882886666655743427476665574794946797787288666754744722668682487625266217525212752446411411125122652443
533453646465125514654252753512273714342227373732733663723654553522224855828427587263828376724486786422622551345652174733731235533661345526462
431416626556561415256423726364711356216462533453778624228776264745488556248346558664685886255267664468734267241413666377354236365315112133322
115242144546551242654657115464153653733572255453735867582743877872748475375858445224247557346684865447435434415136572343667245436453541641214
211445545143351463615353774344215444543156828652686467572385233427763332873666832447256386848435536242337137777716372765516254142315334335233
345124663224645321264314114673647256557756426376735374628552375257437773764536467386624358238642865332573246663566211211655655563524242452555
314351264524343426135362454521352527263736457447533445374485277766767738682474542365754582457568722614424111744153725635141565436222616112315
525142531331665442641251651451342365334554162254374267466577736465886625773232626738363773743786773241666727445735231415436342625513255235151
543245142256442454155334231734217734761146755176638778856523266374354672783363252424683478557527343237227211135754547531342136551132351221533
241355115114515145351235241342577311663523713245571552423844478483444456674576776374774635321762611146175633416417526461446534624524525232351
413212231435125464562416642131514721163172662635774761555772466528432746222877628357558463622434577676277711461224526611415645224221334321153
424114552242412235261232556412366663124614547557116436567672766285253724382874567666431356536715216512355113511563132462412461555112225422135
322324544333135432235125224253374616723165212337472223432464246434784434268261665524555163346167575177573432151165141342526636661664333152245
533322454514225135644666511564116113743567665217446774461763723457213436114546254524754413534661176555531123216654634336153535555615455221351
345114245113253556125335351622625171466165175642167753751336711273734343723253343654164414153211641676412352766561245653215262351455523141451
142421541514212154334545211465656444644552463442357616615277117635256363621723512341776351424463622726131565431516465664346151153212233245553
444314343434312135211364665242441535527647475416223551347736416724264751235567161762631557147415445546211321423221136662344161541525343455425
513343214231252255165411335621632642146147645756642561211667322537371252122672641421372561555336143123644446534414131135624333443543522413531
151133414553422411155141354122545416221132657162133367556711163132611352466177573117122527412137673543111622364234433423115531533515415532534
344341433553215433332561124312211661162315615567541645475225431414323527474442612165214546553775576346352241352363416414626442233143123431324
312334123334252355135521123323245125516132154636463653576675247514555746177477533534522123547665145656414436131454466514531422525141331441324
221234522113214232242154165523542235561622643243233434644217742623556626525264626677654256257462621433131425222466152534235213545112335523443

83
18.js Normal file
View file

@ -0,0 +1,83 @@
import * as std from 'std';
var test = std.loadFile('18.test');
var data = std.loadFile('18.txt').trim();
var points = [];
function shoelace(points)
{
var area = 0;
var p0 = points[points.length-1];
for (var i = 0; i < points.length; i++) {
area += p0[1]*points[i][0]-p0[0]*points[i][1];
p0 = points[i];
}
area *= 1/2;
return Math.abs(area);
}
function move(vec)
{
var last = points[points.length-1].slice();
last[0] += vec[0];
last[1] += vec[1];
points.push(last);
}
function run(data, hex) {
points = [];
points.push([0,0]);
var dirs = data.split('\n');
if (hex) {
dirs = dirs.map(d => d.split(' ')[2].slice(2,-1));
dirs = dirs.map(d => {
var dir = Number(d[5]);
switch(dir) {
case 0: dir = 'R'; break;
case 1: dir = 'D'; break;
case 2: dir = 'L'; break;
case 3: dir = 'U'; break;
}
var n = parseInt(d.slice(0,5), 16);
return [dir, n];
});
} else {
dirs = dirs.map(d => d.match(/(. \d+)/)[0]);
dirs = dirs.map(d => d.split(' '));
}
var perimeter = 0;
var r = 0; var l = 0; var u = 0; var d = 0;
dirs.forEach(x => {
var n = Number(x[1]);
perimeter += n;
switch(x[0]) {
case 'R':
move([n, 0]);
r += n;
break;
case 'U':
move([0, n]);
u += n;
break;
case 'L':
move([-n,0]);
l += n;
break;
case 'D':
move([0, -n]);
d += n;
break;
}
});
var area = shoelace(points);
area += (perimeter)*0.5;
area++;
console.log(area);
}
console.log('silver:');
run(data,0);
console.log('gold:');
run(data, 1);

14
18.test Normal file
View file

@ -0,0 +1,14 @@
R 6 (#70c710)
D 5 (#0dc571)
L 2 (#5713f0)
D 2 (#d2c081)
R 2 (#59c680)
D 2 (#411b91)
L 5 (#8ceee2)
U 2 (#caa173)
L 1 (#1b58a2)
U 2 (#caa171)
R 2 (#7807d2)
U 3 (#a77fa3)
L 2 (#015232)
U 2 (#7a21e3)

606
18.txt Normal file
View file

@ -0,0 +1,606 @@
R 3 (#6289d0)
U 2 (#6a5a63)
R 3 (#49a250)
U 9 (#290bb3)
R 6 (#8ec710)
D 8 (#838413)
R 4 (#387a10)
D 3 (#32f593)
R 4 (#3a8d10)
U 7 (#a252a3)
R 3 (#500100)
U 5 (#03c113)
R 4 (#28fc32)
U 6 (#6da763)
R 4 (#033882)
D 8 (#0aa563)
R 2 (#3c2ae2)
D 3 (#79df03)
R 5 (#7a1652)
D 8 (#79df01)
R 6 (#27e8a2)
U 7 (#65f7a3)
R 3 (#911302)
U 5 (#58f723)
R 8 (#6289d2)
U 4 (#93bed3)
L 11 (#5d5922)
U 3 (#5552d3)
R 9 (#7d6f62)
U 3 (#17eec3)
L 8 (#a06f82)
U 3 (#068273)
L 2 (#1aadb0)
U 4 (#7f20e3)
L 7 (#6895c0)
U 3 (#141553)
L 5 (#2ae520)
U 5 (#141551)
R 5 (#87e540)
U 6 (#1d5593)
L 6 (#2f8912)
U 2 (#43b2e3)
L 3 (#79f0f2)
D 8 (#43b2e1)
L 3 (#27a892)
D 3 (#274813)
L 3 (#64eb42)
D 3 (#77cf23)
L 3 (#9ac052)
D 3 (#5d6873)
L 5 (#1e96b2)
D 6 (#1b83b3)
L 5 (#981b40)
U 4 (#13e0e1)
L 11 (#367430)
D 4 (#8b4bc3)
L 5 (#4c6d40)
U 9 (#8b4bc1)
R 2 (#3eefd0)
U 3 (#13e0e3)
R 6 (#583170)
U 4 (#a413d3)
R 6 (#356a00)
U 6 (#a413d1)
R 8 (#4d0710)
U 4 (#151eb3)
R 3 (#838e10)
U 6 (#34b913)
R 4 (#2ef720)
U 5 (#4a8523)
R 7 (#34ca90)
D 5 (#077023)
R 4 (#747f00)
U 3 (#077021)
R 8 (#1a3150)
U 6 (#4096d3)
R 10 (#44a9e2)
U 6 (#2a7c03)
L 10 (#7ed102)
U 4 (#46ea63)
R 3 (#2acd60)
U 3 (#9799c3)
L 4 (#050c60)
U 6 (#44c4b3)
L 3 (#01e230)
U 5 (#50ee91)
L 3 (#3bfdd0)
U 3 (#1c9603)
L 7 (#2aa6d2)
U 4 (#71db13)
L 8 (#2aa6d0)
D 7 (#31c943)
L 9 (#4ccc60)
D 4 (#2ca231)
R 9 (#1402e0)
D 5 (#939821)
L 4 (#668400)
D 2 (#4d4fa1)
L 8 (#210230)
U 8 (#3e2041)
L 4 (#085470)
U 3 (#404733)
L 6 (#00c2b0)
U 4 (#5be0c3)
L 4 (#2b5df0)
U 9 (#5fde53)
R 4 (#83a0d0)
U 9 (#795c63)
R 3 (#814530)
U 4 (#7f37e3)
R 5 (#266850)
D 5 (#659c43)
R 7 (#266852)
U 5 (#6b5593)
R 9 (#a9e230)
D 7 (#4d39a1)
R 9 (#1a48b0)
D 6 (#4f83f1)
R 4 (#26ebe0)
D 5 (#742f43)
R 5 (#5443a0)
U 5 (#742f41)
R 6 (#3e64a0)
U 2 (#1f6681)
R 9 (#b99422)
U 5 (#520eb1)
L 6 (#27d510)
U 6 (#0bba61)
L 4 (#3ad3c0)
U 5 (#92bca1)
L 7 (#3ad3c2)
U 5 (#200a11)
L 6 (#4493c0)
U 3 (#25dc51)
L 5 (#6a5560)
U 6 (#772071)
L 4 (#264bf0)
D 3 (#2719e1)
L 5 (#90a152)
D 6 (#1cbb11)
L 4 (#4493c2)
D 3 (#452e71)
L 4 (#27d512)
D 2 (#5dd971)
L 8 (#1c4610)
U 6 (#096103)
R 5 (#8438f0)
U 6 (#7351f3)
R 4 (#057e10)
U 6 (#0164e3)
R 6 (#4f7390)
U 3 (#2721c3)
R 4 (#60ab50)
U 6 (#4fb023)
R 10 (#35dad0)
U 2 (#4fb021)
R 5 (#331620)
U 7 (#157f73)
R 9 (#618be0)
U 2 (#36ac23)
R 4 (#4c6400)
U 9 (#36ac21)
R 3 (#43b840)
U 3 (#7159c3)
L 7 (#44d610)
U 5 (#155933)
R 7 (#0991f2)
U 5 (#577cc3)
R 4 (#5c9bf2)
U 3 (#05f3e3)
R 7 (#4861f2)
U 4 (#6c7323)
R 7 (#6268b2)
D 6 (#1cb853)
R 2 (#23b182)
D 3 (#34c9c3)
L 7 (#01d432)
D 8 (#0f5423)
L 2 (#84c4f0)
D 3 (#3f1e13)
R 9 (#0cc5a0)
D 5 (#57adb3)
R 9 (#016840)
D 4 (#677883)
R 7 (#4b8150)
D 7 (#584523)
R 8 (#5bfe40)
D 3 (#11d461)
L 8 (#129982)
D 7 (#51ede1)
R 3 (#129980)
D 9 (#5bfb61)
R 3 (#20ef20)
D 3 (#4d9bc3)
R 6 (#3c2e70)
D 3 (#43eb41)
L 6 (#64a590)
D 2 (#19ee91)
L 4 (#17c8d0)
D 7 (#975651)
L 6 (#4d78f0)
D 2 (#5af991)
L 3 (#15f1b0)
D 4 (#581221)
R 6 (#254700)
D 6 (#26e793)
R 4 (#1b6f00)
D 4 (#681fc3)
L 4 (#364020)
D 8 (#511d31)
L 6 (#548950)
D 6 (#3dea21)
R 6 (#04fc90)
D 3 (#552a51)
R 4 (#0e1762)
D 10 (#2561b1)
R 5 (#597e80)
D 8 (#702b43)
R 3 (#16eb00)
D 4 (#702b41)
R 4 (#5ad290)
D 3 (#427b11)
R 8 (#1e5d32)
D 7 (#0416e1)
R 4 (#2daa92)
U 5 (#28bc11)
R 3 (#4019e2)
U 5 (#8e2311)
R 8 (#052a72)
U 3 (#528623)
L 8 (#1ea522)
U 5 (#0cbf83)
R 6 (#1ea520)
U 5 (#5bb063)
R 6 (#39f002)
U 6 (#64e7e1)
R 8 (#2f0402)
U 3 (#3d83d3)
R 6 (#70b5f2)
U 2 (#7f4ba3)
R 6 (#090b72)
U 5 (#366de1)
R 4 (#4b84c2)
U 5 (#6b7cb1)
R 3 (#763d12)
D 6 (#1ae4e1)
R 6 (#0e3542)
U 6 (#560411)
R 5 (#83a042)
U 3 (#3bc341)
R 3 (#4b7352)
U 8 (#577fc1)
R 7 (#626e42)
U 4 (#13f5c1)
R 5 (#a04f62)
U 6 (#13f5c3)
R 6 (#096972)
U 2 (#2d6be1)
R 4 (#0767e0)
U 7 (#5be161)
R 2 (#7d3600)
U 8 (#440821)
R 3 (#0fc190)
U 3 (#61c671)
L 3 (#07b370)
U 10 (#430571)
L 4 (#6f6970)
U 5 (#43a653)
L 8 (#1a5260)
U 3 (#43a651)
R 8 (#7107e0)
U 7 (#10b3d1)
L 8 (#024af2)
U 7 (#16ed01)
L 4 (#b255c2)
U 2 (#099513)
L 8 (#13d682)
U 4 (#099511)
R 3 (#b0f4a2)
U 4 (#16ed03)
R 3 (#1d6ac2)
U 4 (#3295c1)
R 8 (#1aa6b2)
U 4 (#125d83)
R 7 (#1dfb02)
D 4 (#1bf363)
R 3 (#2656e2)
D 8 (#7d7303)
R 7 (#2656e0)
D 8 (#211f43)
R 3 (#4592c2)
D 7 (#292ae3)
R 7 (#816e92)
U 7 (#3898b3)
R 5 (#4f4e62)
D 5 (#86c423)
R 3 (#7e59f2)
D 9 (#27b271)
R 3 (#1a02b2)
D 6 (#03ce41)
L 3 (#363970)
D 9 (#b91bb1)
L 2 (#363972)
D 3 (#16cfd1)
R 5 (#37ea82)
D 3 (#0a2cd1)
L 7 (#92d872)
D 7 (#4c1711)
L 4 (#01cbd2)
D 7 (#4bc171)
R 5 (#8efa50)
D 5 (#7b2d31)
R 6 (#0e9850)
D 5 (#74ef91)
R 7 (#7a37e0)
D 3 (#6154e1)
R 3 (#7baf00)
U 5 (#17a443)
R 8 (#532e00)
U 6 (#17a441)
R 10 (#8e0410)
U 4 (#6154e3)
R 5 (#6fca00)
U 8 (#4b1103)
L 6 (#833220)
U 5 (#1e3033)
L 3 (#54ef30)
U 8 (#1e3031)
L 2 (#9e7660)
U 4 (#4b1101)
L 3 (#064ae0)
D 9 (#2b6491)
L 2 (#83b470)
D 3 (#2b6493)
L 3 (#5a3a10)
D 5 (#6bbba1)
L 4 (#29afc0)
U 10 (#235101)
R 4 (#4a0f40)
U 12 (#617f71)
R 2 (#62e590)
U 5 (#4d3611)
R 7 (#4077e2)
U 3 (#4763f1)
L 5 (#81d5b2)
U 5 (#6e1fd1)
L 5 (#1107a2)
U 5 (#020fa1)
L 5 (#22b5f2)
U 3 (#1d3841)
R 6 (#13dff2)
U 6 (#9501a1)
R 6 (#4176b2)
D 6 (#24aeb1)
R 3 (#1d44c2)
U 3 (#a77e53)
R 5 (#00ad12)
D 4 (#3179e3)
R 3 (#42c9e2)
D 8 (#65dbb1)
R 2 (#9b6442)
D 7 (#5bbda1)
R 4 (#706b80)
U 12 (#6b1e41)
R 4 (#2c2250)
D 9 (#5ef081)
R 7 (#4d2c80)
D 6 (#7e52d3)
R 5 (#4004a0)
D 2 (#340173)
R 4 (#638190)
D 8 (#a0e873)
R 7 (#58e510)
D 4 (#3f5041)
L 11 (#14be32)
D 2 (#350111)
L 3 (#14be30)
D 3 (#5f9dd1)
L 3 (#1a6850)
D 4 (#7f4d91)
R 7 (#067bf0)
D 7 (#600cf1)
R 2 (#5ff142)
U 7 (#10c9f1)
R 8 (#63a502)
D 7 (#3e29c1)
R 6 (#58c402)
D 6 (#653be1)
R 4 (#66ee92)
D 8 (#62d4d3)
L 3 (#7532f2)
D 3 (#62d4d1)
L 4 (#0c8252)
D 7 (#438151)
L 6 (#63ce50)
D 4 (#53bee1)
L 3 (#274190)
D 5 (#540a93)
L 8 (#843930)
U 5 (#540a91)
L 6 (#38f5f0)
U 4 (#5d2bc1)
L 3 (#35e8d0)
D 4 (#571381)
L 2 (#22aed2)
D 4 (#51c4d1)
L 4 (#22aed0)
D 2 (#1a6ca1)
L 8 (#141aa0)
D 4 (#16f0c1)
L 5 (#69f5a0)
D 3 (#50b081)
L 11 (#4722c2)
D 3 (#4cae83)
L 2 (#864f82)
D 2 (#62b293)
L 10 (#083dd2)
U 5 (#9863e3)
L 6 (#3bfff2)
D 2 (#160693)
L 3 (#9b2bf2)
U 4 (#471371)
L 8 (#181952)
D 4 (#53e531)
L 3 (#292882)
D 5 (#190d41)
R 7 (#68fbb2)
D 4 (#190d43)
R 3 (#87a972)
U 4 (#53e533)
R 7 (#081782)
D 6 (#8adf41)
R 8 (#532c40)
D 4 (#92bed1)
R 4 (#5019e0)
U 9 (#92bed3)
R 5 (#782dc0)
D 9 (#68fdd1)
R 4 (#1e8a90)
D 3 (#22db01)
R 7 (#4f5c22)
D 7 (#5a9031)
R 7 (#4dc440)
D 8 (#1adad1)
R 2 (#1c5ed0)
D 4 (#296441)
R 8 (#7e80c0)
D 5 (#6ccdd1)
L 5 (#5ea2a2)
D 4 (#4f7151)
L 9 (#654fc2)
D 3 (#2d7751)
L 6 (#654fc0)
D 4 (#3d0d31)
L 5 (#3fc180)
D 4 (#687ed1)
R 5 (#5c6c60)
D 3 (#08e123)
R 5 (#369da0)
D 2 (#5b9343)
R 8 (#4a19d2)
D 5 (#2fa453)
L 6 (#4a19d0)
D 9 (#3124e3)
L 2 (#369da2)
U 9 (#126ea3)
L 5 (#47d330)
D 3 (#9a27c1)
L 5 (#65efc0)
D 6 (#3d8471)
L 5 (#105740)
U 11 (#458fb1)
L 3 (#160aa0)
U 3 (#1f5a11)
L 6 (#2eec42)
U 8 (#0936f1)
L 2 (#a2bc52)
U 12 (#0936f3)
L 3 (#197e52)
D 8 (#7cff41)
L 4 (#0b1b52)
D 6 (#38ab61)
L 4 (#7a1082)
D 5 (#4cc4e1)
L 4 (#098560)
D 5 (#4cefe1)
R 7 (#098562)
D 5 (#7e3c91)
R 9 (#8210d2)
D 3 (#1f5193)
L 7 (#4ddcc2)
D 6 (#331863)
L 2 (#256540)
U 6 (#478ea3)
L 7 (#064712)
D 3 (#61ebe3)
L 6 (#064710)
D 4 (#1ba8f3)
L 4 (#256542)
D 5 (#1abc53)
L 4 (#4ddcc0)
D 6 (#21e323)
L 6 (#5a96e2)
D 5 (#25a201)
L 7 (#376d92)
U 5 (#5cd0f1)
L 3 (#110232)
D 5 (#2c23e1)
L 5 (#110230)
D 4 (#3d4e61)
R 4 (#4f94a2)
D 5 (#4a2761)
L 4 (#3bf242)
D 6 (#1c13d1)
L 3 (#788182)
D 3 (#2e4db3)
L 9 (#152c12)
D 2 (#1d6453)
L 3 (#251a52)
D 3 (#9a5fc3)
R 3 (#251a50)
D 2 (#466ca3)
R 9 (#6be6a2)
D 5 (#25a203)
L 7 (#318bb2)
D 4 (#64d183)
L 7 (#78f622)
D 2 (#247fd3)
L 8 (#78f620)
D 3 (#75b6a3)
L 2 (#57f542)
D 5 (#277e03)
L 4 (#773422)
D 6 (#92c4a3)
R 4 (#773420)
D 7 (#3e42a3)
L 7 (#800962)
U 8 (#3be443)
L 3 (#2d3bf2)
U 13 (#2dc9b3)
L 4 (#8dce92)
D 9 (#69adf1)
L 2 (#57b742)
D 3 (#30bbf3)
L 7 (#30f722)
D 4 (#85ad43)
L 9 (#8246b0)
D 4 (#2181f3)
L 7 (#796432)
D 5 (#087563)
L 8 (#3c7b92)
D 4 (#8767e3)
R 5 (#04a3c0)
D 3 (#78ea63)
R 8 (#04a3c2)
D 3 (#4d8193)
L 6 (#b5dfc0)
D 2 (#0b8243)
L 7 (#804ef0)
D 4 (#471af1)
L 6 (#14a462)
D 8 (#64f7e1)
L 7 (#1d1290)
U 4 (#6788a1)
L 4 (#1d1292)
U 9 (#07ed81)
L 2 (#14a460)
U 3 (#25f601)
L 6 (#1f4cb0)
U 9 (#41ce71)
L 3 (#a1dff0)
U 8 (#137563)
L 2 (#362e22)
U 4 (#6eb543)
L 6 (#6cccc2)
U 5 (#3f5983)
L 6 (#249900)
U 4 (#3ef663)
L 3 (#0a8c50)
U 4 (#5decc3)
L 10 (#0a8c52)
U 2 (#452b53)
L 9 (#249902)
U 6 (#2a3c03)
R 4 (#89f592)
U 3 (#4ba633)
R 8 (#2cc4e2)
U 4 (#263133)
L 9 (#913952)
U 2 (#0fe923)
L 3 (#059172)
U 6 (#7c4313)
L 10 (#73f222)
U 4 (#5559d3)
L 2 (#3cb6b2)
U 8 (#2c70f1)
L 5 (#5ffb22)
D 9 (#0bf671)
L 6 (#4d3512)
U 9 (#ac5f51)
L 4 (#27dc72)
U 5 (#ac5f53)
L 3 (#490342)
U 8 (#0bf673)
L 3 (#6fad62)
U 8 (#6e2403)

156
19.js Normal file
View file

@ -0,0 +1,156 @@
import * as std from 'std';
var data = std.loadFile('19.test').trim().split('\n\n');
var rules = data[0].split('\n');
var parts = data[1].split('\n');
parts = parts.map(p=>p.replace(/=/g, ':'))
parts = parts.map(p=>eval('(' + p + ')'));
var rr = {};
rules.forEach(function(r) {
var rulename = r.match(/([a-z]+){/)[1];
var instr = r.match(/{(.*)}/)[1].split(',');
rr[rulename] = [];
instr.forEach(function(i) {
var newrule = {};
i = i.split(':');
if (i.length === 1)
newrule.send = i[0];
else {
newrule.cmd = i[0];
newrule.send = i[1];
}
rr[rulename].push(newrule);
});
});
var sum = 0;
parts.forEach(part => {
var name = 'in';
while (1) {
var workflow = rr[name];
for (var work of workflow) {
if (work.cmd) {
if (eval(`part.${work.cmd}`)) {
name = work.send;
break;
}
} else {
name = work.send;
break;
}
};
if (name === 'R') return;
else if (name === 'A') {
sum += Object.values(part).reduce((a,x) => a += x);
return;
}
}
});
console.log('silver:');
console.log(sum);
var part = {
x:[1,4000],
m:[1,4000],
a:[1,4000],
s:[1,4000]
};
var stack = [];
stack.push({
rule:"in",
part:part,
step: 0
});
var accepted = [];
var rejected = [];
while (stack.length)
{
var s = stack.shift();
// console.log(JSON.stringify(s));
if (s.rule === 'R') {
// console.log(`parts ${JSON.stringify(s.part)} rejected`);
rejected.push(s.part);
continue;
} else if (s.rule === 'A') {
// console.log(`parts ${JSON.stringify(s.part)} accepted`);
accepted.push(s.part);
continue;
}
var part = s.part;
var workflow = rr[s.rule];
var work = workflow[s.step];
if (work.cmd) {
var cmds = work.cmd.match(/([xmas])([<>])(\d+)/);
var news = {};
news.part = {};
news.part.x = part.x.slice();
news.part.m = part.m.slice();
news.part.a = part.a.slice();
news.part.s = part.s.slice();
if (cmds[2] === '<') {
if (part[cmds[1]][1] < Number(cmds[3])) {
s.rule = work.send;
s.step = 0;
stack.push(s);
continue;
} else if (part[cmds[1]][0] > Number(cmds[3])) {
s.step++;
stack.push(s);
continue;
} else {
news.part[cmds[1]][0] = Number(cmds[3]);
news.rule = s.rule;
news.step = s.step+1;
s.part[cmds[1]][1] = Number(cmds[3])-1;
s.rule = work.send;
s.step = 0;
stack.push(s);
stack.push(news);
continue;
}
} else {
if (part[cmds[1]][0] > Number(cmds[3])) {
s.rule = work.send;
s.step = 0;
stack.push(s);
} else if (part[cmds[1]][1] < Number(cmds[3])) {
s.step++;
stack.push(s);
continue;
} else{
news.part[cmds[1]][1] = Number(cmds[3])-1;
news.rule = s.rule;
news.step = s.step+1;
s.part[cmds[1]][0] = Number(cmds[3]);
s.rule = work.send;
s.step = 0;
stack.push(s);
stack.push(news);
continue;
}
}
} else {
s.rule = work.send;
s.step = 0;
stack.push(s);
continue;
}
}
var sum = 0;
accepted.forEach(function(a) {
console.log(JSON.stringify(a));
var accum = 1;
Object.values(a).forEach(rng => accum *= (rng[1]-rng[0]));
sum += accum;
});
console.log(sum)

17
19.test Normal file
View file

@ -0,0 +1,17 @@
px{a<2006:qkq,m>2090:A,rfg}
pv{a>1716:R,A}
lnx{m>1548:A,A}
rfg{s<537:gd,x>2440:R,A}
qs{s>3448:A,lnx}
qkq{x<1416:A,crn}
crn{x>2662:A,R}
in{s<1351:px,qqz}
qqz{s>2770:qs,m<1801:hdj,R}
gd{a>3333:R,R}
hdj{m>838:A,pv}
{x=787,m=2655,a=1222,s=2876}
{x=1679,m=44,a=2067,s=496}
{x=2036,m=264,a=79,s=2244}
{x=2461,m=1339,a=466,s=291}
{x=2127,m=1623,a=2188,s=1013}

777
19.txt Normal file
View file

@ -0,0 +1,777 @@
ft{m<1347:R,m<1967:A,A}
gbv{x<51:R,R}
lks{m<2978:kgl,a<680:ntb,x<577:hzp,mg}
db{a>2314:R,A}
rml{a<479:R,m>2803:A,R}
ncv{x<3567:R,a>3316:A,s>1415:R,R}
jsm{m>1434:brj,a>3142:vtk,x<2888:bpt,dl}
frt{s>210:R,a<1114:R,R}
zjq{m<195:A,R}
lv{m<1450:A,m<2105:xll,R}
kp{x>1194:A,x>1146:A,R}
nl{a>2317:A,A}
lrf{s<493:mpt,R}
cxf{x>2054:ktk,x<1860:qmg,lzk}
xb{s<1524:A,s>1602:A,R}
zz{x>3135:svb,x>2399:R,A}
ds{a>2495:R,x>924:R,pm}
zxf{m<2815:stp,a<2750:jpf,R}
fg{s>2319:A,A}
jb{a>3248:rm,s<3444:gdc,A}
trb{s<3836:A,x<1957:A,R}
nrk{x<995:bmc,R}
hk{m<968:btp,s<1545:nl,m>1092:npt,tlg}
ff{x<1733:R,s>2152:A,A}
msh{a>3446:R,A}
qt{m<1335:A,s<2757:tx,R}
ksm{a<3350:gr,R}
fsm{x>2098:R,a<360:R,R}
rff{m>312:R,A}
ddm{s<2671:R,trz}
bd{s<3121:A,R}
nr{s>2748:vmb,s<2491:xd,fbm}
fdn{a>659:cv,x>2325:xc,rt}
rcj{a<453:R,a<847:A,a>993:A,R}
brf{x<1485:A,R}
mzt{x>3019:A,m>306:R,A}
pc{x<2446:R,hc}
xf{a<3423:ln,x>1473:zjc,x>1440:R,cgx}
xn{s<3870:A,R}
qzn{m>1697:A,m>1501:A,R}
cdl{s<3605:A,s>3831:R,s<3743:dph,A}
mbq{x<3235:A,s<2567:A,s>2647:R,R}
sqt{x>2051:R,a>2036:A,s<1695:R,R}
tc{s<952:A,x>3099:R,m<3427:A,R}
kt{m<1388:jg,m>2013:mxm,xdr}
jxb{s>3521:R,x<851:A,x>1017:A,A}
qx{m>404:A,x<2423:R,a<2849:A,R}
ptj{m<3906:njh,R}
hd{s<566:R,m>1077:A,A}
bvh{s<1046:vd,x<2962:bz,m<1264:R,cqj}
zgs{m<388:A,x<1595:gqn,s<3635:R,khx}
pj{a<2319:R,a<2479:R,x<1521:llm,R}
kx{m>3616:kqd,x<1472:R,m>3298:kg,A}
mk{a<3610:R,m<2065:R,R}
jd{x<756:A,x>802:vcg,zgr}
qbq{x<1667:A,m>1173:R,x>1697:R,R}
cn{m>3371:nqj,m>3154:A,a>1170:R,sbx}
zrk{a<3201:A,m<1459:R,A}
qtz{m>517:nt,m>212:vpq,x<3049:pl,hb}
nhk{x>455:A,m<3081:A,s<3489:A,A}
rfd{m>1850:A,A}
nns{s<1799:A,A}
dm{s>95:A,R}
vz{m>3248:vb,nkr}
dcz{a>2149:km,R}
rrl{a<3198:ptk,s>3017:zgs,x>1554:hht,cht}
hs{m<673:A,R}
vf{s>1621:A,R}
qf{x>538:A,a<427:jc,lhf}
xbh{m>2071:jjb,s<582:xpc,a>3248:hpr,npd}
fz{m<1150:A,s<200:R,s<371:A,A}
gd{m>592:vt,a>1033:R,a>636:nlj,R}
znb{a<3808:A,x<3379:A,m<2068:A,A}
st{s<2677:R,a>1494:R,s>3382:A,R}
zf{m<3760:A,s<3288:A,R}
hh{s<2789:mz,jb}
tp{s<2498:R,A}
kz{a>2094:vqx,m>414:hzc,kzp}
xc{m>2388:nqp,a>432:A,x<3265:xch,A}
zgt{m<3336:A,s>2892:A,a>3062:R,A}
gtz{s>2688:tg,dp}
tf{m>3151:A,s<1440:A,R}
mxm{a<3193:A,x>816:R,a<3543:gqk,R}
fsp{a<3234:A,A}
tzf{s>2391:A,x>877:R,s>1154:A,R}
xgh{s>1188:mkk,a>2481:jm,kdc}
mjr{a>2688:zf,s>3239:gq,x<1313:R,fkc}
tvs{m<3240:gz,m<3630:clp,mjr}
zxp{a<2636:R,m<2968:R,a<2656:R,R}
kzp{a<2031:A,R}
rjl{s<592:frt,A}
vbz{a>2594:R,R}
klg{x>3362:A,s<1485:R,a>3704:R,A}
gr{m>1117:A,R}
nm{m>2633:R,A}
qkc{x>2875:R,R}
tsb{a<3865:A,x>2852:R,R}
lhm{s>3225:xs,a<2729:pj,m>3065:kx,xf}
blb{m<1562:A,R}
nsz{s<2211:jn,x<2387:nb,R}
tsj{x<3454:A,a<3740:R,x>3695:R,R}
bxk{x<487:A,m<3001:jzs,m>3535:R,zgt}
qq{a>2875:A,s<1314:A,m<982:A,R}
ksq{s<1649:R,x>2393:R,R}
hdz{x>3225:R,s>2321:A,R}
hp{m<1838:R,s<2302:A,x<588:R,A}
kf{a>748:A,A}
vb{m>3549:gvm,m>3403:R,A}
nx{s>486:R,A}
vtk{x<3172:tr,a>3353:nz,jr}
mlt{a>2987:A,s>286:A,A}
mv{s>2214:A,s<1986:A,s<2104:R,A}
fs{m<551:nll,hrj}
nh{s<3247:R,m>693:A,a>2956:A,R}
vpn{m<1447:R,gf}
bpd{a<3269:A,A}
mq{m<404:A,x>243:A,A}
jjx{x>3138:A,a>670:R,s>3088:R,A}
pn{s<1297:ds,m>1065:bj,bmf}
xp{x<1214:A,a<3436:R,m>866:R,A}
mpt{s>266:R,a>2276:A,A}
vk{m<1307:hd,tsj}
ql{a<1594:A,A}
bsb{m>2463:lks,x>626:tz,kk}
fn{a>1154:A,m<2652:R,s<1641:vtg,pzz}
knc{x<883:rfg,s<731:lv,s<1274:jkh,vdh}
kc{x<1160:jt,a>2721:qzg,m>1522:lrf,dg}
px{s<239:R,s>302:A,R}
bzf{m>3078:tln,s>575:gp,ml}
qfg{x>1167:R,x<1086:R,a>705:R,A}
ffn{a<1088:mbb,m<520:sb,vf}
jhg{m<3331:R,R}
llm{s>2346:R,a>2587:A,R}
xdr{s>3119:jxb,x>714:R,m<1724:zxl,hp}
cf{x<369:A,x<488:R,a<1340:A,A}
pvt{s>301:A,x<1488:A,a>3250:A,R}
dpm{x<3365:A,m>3696:A,R}
dhk{a>611:R,m>497:A,a<349:A,R}
dg{s>517:R,m<1250:fz,R}
ph{x<3427:R,a<2511:R,A}
hsx{x<1317:R,a<970:bzc,a<1412:cp,A}
mzb{m<2475:A,a<3151:R,s<101:A,A}
jtj{m<657:R,m<1047:R,s<1082:R,R}
xv{x>1004:A,s<1572:R,R}
cx{a<2527:A,A}
zn{m<2693:A,s>2559:R,m>3231:A,A}
nll{m<187:R,a>3715:A,R}
dh{x<1366:A,fq}
dr{a<3764:hf,a<3914:A,m<3290:A,R}
qz{s<257:R,fsp}
xfl{x>3188:A,x<2536:R,s<2342:A,A}
cz{m>3153:R,x<1136:R,x<1184:A,A}
qcf{s>2754:kmb,R}
fm{m<1085:R,a>2556:A,a>2420:R,R}
ld{s>737:A,s>489:R,a<88:A,R}
rfg{s<1129:ft,m>1514:mk,m>934:jpb,ggs}
lzh{m<1134:R,m<1308:R,A}
ckk{s>1464:lzh,s>1179:qq,R}
bvc{x>510:kt,m>1338:hh,pmm}
xtr{x>1686:A,R}
gxb{s<352:R,s<392:A,x>2751:A,R}
npd{a<3087:A,m>1379:vg,R}
hch{a>2219:R,A}
nj{m<2605:R,s<2930:R,R}
cvj{x<1520:R,qtm}
cgx{a<3678:R,s<2581:R,R}
tm{x>2596:A,A}
qtm{s>1379:A,a<2574:R,R}
ftt{s<2273:R,s>3405:A,m<609:R,A}
gqk{m<2274:R,a>3345:A,a<3279:A,R}
xqn{m<2098:R,a<1184:R,A}
qpm{x<2347:rff,x<2776:A,x>2977:A,ntz}
hvj{x<3486:R,A}
tpb{m<2448:lh,rjg}
shq{m>671:R,s>206:A,R}
htg{a>904:A,x>231:R,A}
jq{s<2890:dn,R}
gf{a<1251:A,A}
vl{m>913:ccb,a<1148:tb,s>2525:kbs,qtz}
xhl{s>399:R,a>2578:zxp,A}
ntz{m<273:A,R}
ntb{m<3543:qf,m<3783:lss,jj}
thm{a>1424:R,A}
km{m>3338:R,m>2932:A,x<3299:R,A}
fh{s>1157:xq,vk}
ljt{a>2529:R,m<1762:R,A}
hgv{s<1087:R,m<1627:A,x<1370:A,A}
brj{a>3113:gdz,a<2926:gkc,a<3040:zz,khd}
nz{x>3516:R,x<3380:A,A}
nvx{a>3182:R,x<3714:R,x>3816:A,R}
fx{a>3193:A,nhk}
spv{a>2824:vbl,m>2404:vtb,kqz}
zpn{s>2774:nj,m<2788:jmx,hvj}
cnx{s<1825:R,A}
jkl{a<2564:R,A}
lhf{s>1439:A,s<718:A,m<3252:A,A}
rm{x<225:A,A}
jxz{a<2321:A,a>2367:A,m>185:A,R}
hzq{a>651:R,x>2192:A,a>607:R,A}
jhv{a>3199:knc,s>776:pn,m>1007:kc,bx}
svj{a>3616:R,m>3421:R,m>2865:A,R}
vcg{s>2903:R,R}
vhm{m>1914:R,m<1754:R,x>1550:A,R}
ccb{s>1843:qt,bvh}
qr{x>2395:sv,A}
tlg{m<1031:A,x>2590:xfh,zp}
pt{s>435:A,a<2696:gg,s>170:mlt,xkz}
rj{x>1493:A,m<523:R,s>2867:A,R}
pr{a>2732:A,m<2650:A,A}
hzp{a>1120:kvf,m>3388:mf,hv}
btf{s<3748:xxc,A}
tr{m>717:R,A}
rv{a>672:R,R}
qg{s<2427:R,m<319:R,R}
lk{s<3170:A,A}
ksr{m>3137:gs,a<3314:hbg,s<1465:R,zk}
dbs{m>720:hk,a>2451:mvg,a<2212:kz,frl}
zdx{x<3645:R,s>849:A,A}
gvv{s>3441:R,A}
jlj{x>3003:cl,mcj}
vtb{s<2272:xgh,s>3350:ffz,vpj}
bdt{x<2027:px,x<2238:qh,R}
hbg{a<2847:R,A}
xd{x>2897:rd,a<3376:qr,nsz}
hb{m<77:R,a<1618:A,s>1205:nns,A}
lzj{m>2039:R,A}
ml{a>3118:R,s>304:R,zkv}
mt{s>2057:A,x>3358:npn,xzh}
htv{x>3422:A,a<1058:jjx,s>3318:R,mb}
lrm{x<2442:jxt,s>1388:hcm,R}
zjc{x>1530:A,a>3635:R,R}
kgl{x<688:fn,a<795:prh,dk}
pcz{m>3387:A,x<2362:A,A}
sf{a>690:A,mhf}
gqn{a<3554:A,A}
xfh{a>2277:A,s<2581:A,x<3067:R,A}
nlj{m<379:R,s<2220:A,R}
mcj{a>3825:ncb,x>2185:xjm,m>3112:R,R}
tln{s<565:pvt,a<3200:jlq,m>3598:lsx,A}
xns{m>2818:A,x>1648:R,m<2614:A,ht}
mx{s<940:R,s>1425:A,m>3518:tpn,A}
qgs{s>3234:rml,x>1876:pht,s<2763:R,tfv}
gt{s<3681:A,a<3251:R,R}
rcq{s>317:R,m<747:A,x>1403:R,R}
hzc{x<3241:A,s<1489:A,jbc}
fq{x>1398:A,s>2516:A,m>2301:R,R}
kvf{a<1562:cf,x>248:R,s>1776:qlm,A}
jfj{x<3469:A,a<2580:jz,s<2074:dbj,A}
vdh{s>1624:R,m>1500:rfd,zjn}
mg{s>1357:cn,rjl}
qnt{s<483:R,x>3442:R,A}
mp{s>3114:xqz,bq}
crp{a<3714:R,vj}
kq{m>3155:A,x>1456:R,R}
fhm{x>702:A,a<1104:rcj,zgp}
sl{x<1100:R,a<1423:A,A}
stp{s>2555:A,s>2383:A,s>2339:A,A}
pb{x<247:A,a>2834:fhp,a>2286:fm,R}
kbs{a>1536:zkr,xqb}
chf{s>2200:A,R}
bmc{x<968:A,x<982:A,A}
tjq{x<2908:btn,a<2595:dpm,mzg}
vfr{s>2143:pg,bsv}
bm{m<1791:R,m<1877:R,A}
kv{m>1866:jlj,m<870:fs,x<3127:vm,fh}
jpr{x<3038:R,a>3300:A,R}
gs{s>1177:R,R}
nhz{s>1928:R,s>1173:R,A}
hht{a<3615:msh,A}
mz{s>2285:R,s<2080:lzj,a>2672:gfp,gc}
kg{s>2590:R,R}
jr{a>3221:R,s<1664:nvx,ddv}
jpf{s<2652:A,a>2699:R,A}
cp{s>3057:A,x<1389:R,A}
tpn{m>3810:A,s<1214:A,x<2439:A,R}
vm{m>1226:tj,pc}
fr{m>557:A,a>3034:zjq,R}
gjj{m<3399:qzj,m<3784:cdl,a>2319:btf,ptj}
tjl{m<2439:A,m<3400:R,a<3075:A,R}
jkh{m<1257:jtj,qzn}
npt{s<2730:A,s>3447:R,a<2249:R,A}
xh{a<750:R,x<368:R,x>484:R,A}
sbx{s<2867:R,R}
zpj{s<1876:vpn,sf}
ln{a>3164:R,m<2847:R,m<2960:R,R}
cg{a<2409:R,s>3521:R,m>3415:R,A}
pg{x<2668:bjj,m>3516:htv,dvl}
lzk{m<3217:A,s>3712:trb,m>3591:qrz,A}
qkg{m<422:gx,x<3500:A,x<3738:zdx,R}
vkc{a>791:lnt,tzf}
ktk{s>3706:A,x>2390:R,cg}
dph{x>3090:R,a>2301:A,x<2908:R,R}
rq{x>327:R,x>164:A,R}
gl{s>487:A,a>1655:A,a<1331:R,A}
jmx{a<1052:A,s<2652:A,x>3318:R,A}
tk{s<3036:zpn,skp}
xkz{s<107:A,A}
ncb{s<760:R,s>1392:A,a>3927:R,A}
zv{s<859:R,A}
jzs{a<2665:A,s>2889:R,s>2655:A,A}
zbv{s<2370:npx,szq}
sxd{x<3268:R,a<3101:A,A}
kqd{s>2509:R,A}
fhp{m>943:R,s<3533:R,A}
jcg{a<2636:rgg,s>2865:xtr,a>3473:qbq,qtd}
fv{x>1586:sfh,s>1744:lhm,s<1005:bzf,ppd}
ppd{a>3253:prl,x<1484:zq,m>3222:cvj,mn}
zp{a<2416:A,m<1055:A,a<2598:A,A}
dl{s>1430:fr,ddt}
rvs{x<2743:jng,s<71:A,m>1651:mzb,dm}
lss{a>446:A,x>912:A,s>2317:tpj,dt}
cj{m<2996:A,m>3036:A,A}
vt{s>2338:R,a<1268:A,R}
zxl{x<637:A,R}
jng{m>2074:R,s<55:A,s<103:A,R}
gdc{s>3086:R,x>291:A,A}
jm{a<2685:xhl,rlq}
bst{m>1876:R,s>175:R,a>3154:A,A}
vtg{m>2801:A,s<673:A,m<2719:R,A}
gxs{a<2679:ljt,x>2149:A,s>2360:R,R}
tg{s>3232:gt,a>2631:xp,hfz}
xch{s<1053:R,s>1849:R,s<1395:R,R}
mvg{x<3100:qpm,s>2375:jkt,qkg}
cl{m>2802:cd,s<810:A,rfn}
ptk{s>2833:A,a>2436:sdx,s>2408:xfc,mv}
jj{x<576:A,R}
dvl{x>3429:A,a>954:R,a<621:lk,A}
jpb{m<1263:R,s>1379:A,x>568:A,A}
lsx{x>1481:R,m>3782:R,A}
nk{m>797:R,A}
qs{x<1815:A,a<208:ld,R}
jrr{x<2672:gxs,m<1958:hdz,jfj}
xs{s>3692:brf,x<1496:kq,mnl}
bh{a<1203:A,R}
gpm{m<414:A,x<3045:R,A}
xl{x>2732:kh,s<3328:jq,hzg}
lbr{s>2768:R,m>2649:mbq,jkl}
rpj{a<2149:A,x<2393:R,a<2171:A,A}
jbx{a>2843:bpd,s<571:cz,m<3351:cx,R}
gc{x>209:A,s<2192:A,R}
gp{m>2717:R,m>2542:xhq,A}
btp{m>880:A,x<2832:A,nk}
zx{a>374:R,m>2870:A,x<1136:R,A}
cqj{m<1430:A,x<3333:R,s<1454:A,R}
mzg{m<3447:A,m<3636:A,A}
pcg{a>746:mp,a<342:nsj,a<566:qgs,kck}
cjv{x>97:R,a>1081:ql,m<1933:gbv,nn}
lr{x>984:rcq,x<597:A,m<744:bpm,A}
mn{m<2758:R,R}
mbb{m>592:qfg,qg}
vqx{x<2718:rpj,m<417:fk,ftt}
zgr{m<1436:A,A}
gx{m>266:A,m<109:A,R}
zh{a>1474:A,x<1765:A,m>809:R,R}
rd{a<3284:sxd,a>3557:znb,s<2290:R,scc}
vpq{m<385:thm,s<850:gl,A}
sr{x>3148:R,s>2593:zrk,m>1611:zn,R}
btn{x>2233:A,s>2963:A,m<3546:R,R}
ddv{m<929:R,a<3189:R,R}
lj{s>720:hgv,s<311:A,m>1726:R,R}
dt{s>1007:A,m<3666:R,R}
jn{s>2145:A,A}
qtd{m<1205:A,a>3048:A,m<1281:R,A}
prl{m>3410:R,s<1367:hns,A}
mrg{x<2908:A,s<1375:R,x>3291:R,R}
pmm{s<3127:qlh,m>628:pb,xk}
sb{m>186:jbn,x>1199:R,s>1631:st,sl}
vj{x>3191:R,s<2638:A,A}
xq{x>3521:psx,klg}
trz{x>1532:R,R}
kck{m<2847:hzq,m>3005:R,m>2951:txt,dd}
jqg{x<1371:R,a<2887:R,A}
npn{x<3611:A,a>2239:R,a>2073:R,R}
xjm{s<752:R,a<3700:A,A}
bhj{s<2435:ndb,a>3069:nbp,x<1135:sjg,tvs}
mm{x<427:R,R}
vbb{s<129:rvs,x>2919:xg,x>2355:qz,bdt}
jlq{s<782:R,R}
gvm{s<2807:R,x>3086:A,a>2154:R,A}
vpj{a>2388:fbs,vz}
scc{s>2384:A,A}
bsv{a>993:tm,a>339:mx,x<2540:qs,nf}
fd{x>1200:rcv,x>1108:R,cnx}
tfv{s<2966:A,A}
qzj{s<3758:A,xn}
tz{x<939:ctb,m<1285:ffn,ch}
hv{a>827:A,s>1420:xh,R}
xpv{x<1644:R,R}
khd{x<2613:tjl,a<3080:A,A}
lz{a<2446:pz,jrr}
hfz{x<1227:R,x<1306:R,x>1351:A,A}
tj{x>2413:blb,A}
cd{a<3723:A,s>824:R,x>3620:A,A}
jkz{s<574:R,x<2957:R,s<839:A,A}
bpm{s<309:R,a<2751:R,R}
sjg{s>3133:dlk,qcf}
lnj{s>408:A,m<3185:A,s<382:R,A}
qlm{m>3399:A,m>3160:R,s<2770:A,R}
nqj{m>3601:A,s<2462:A,R}
qmk{a<218:A,m<2581:A,x<1964:R,A}
zkv{a<2439:A,a>2836:R,s>108:A,R}
dbj{a<2726:A,m>2173:A,A}
skp{a>1102:R,x<3363:ks,R}
pl{a>1567:lld,ss}
sdx{x>1582:A,a<2789:A,a>2991:R,R}
kpp{a<3749:R,a>3896:R,a>3815:R,A}
tjp{a>2329:R,R}
jsd{x<1697:R,a<2402:ff,m<3616:R,nhz}
rjg{x<955:zbv,x<1405:bhj,fv}
bpt{a>2950:lrm,m>712:ckk,kft}
rbf{s>3056:R,m>2843:A,A}
jqn{a>2437:A,x>2389:A,x<2155:R,R}
lld{a<1799:R,m>116:A,s>1201:A,R}
hm{x>1051:A,s>3482:A,x>1005:R,A}
bq{s<2735:R,a<1253:R,s>2952:A,A}
mc{m<103:A,s>2774:A,jxz}
mb{m>3733:A,a>1638:A,x<3043:R,A}
jkt{a<2628:ph,A}
xll{m>1829:A,x<1433:A,m<1592:A,R}
nnx{m<1438:gd,cjv}
nbp{x>1168:vx,x<1027:nrk,m<3404:xlh,jh}
jxt{a>3018:R,a>2989:R,x<2081:A,A}
qlh{s>2464:A,a>3258:fvc,R}
pkr{m>99:A,s<992:tjp,a>2330:R,R}
msc{m<1704:vl,m<3193:rbv,vfr}
ncx{x>3527:R,rv}
mnl{a<2870:R,s<3477:A,x>1527:A,A}
bzc{a>534:R,s>2369:R,R}
cv{m<2520:R,a>1382:A,R}
bjj{s<3237:sc,x>2020:R,A}
dxt{x>1973:R,x>1653:A,m<2147:R,A}
rbv{s<2474:fdn,m<2300:xl,x>2579:tk,pcg}
tb{x>3001:ncx,dhk}
hpr{s>740:R,A}
vg{m>1757:A,A}
zk{x>699:A,a>3640:A,A}
hns{x>1525:A,a<3550:R,a<3709:R,A}
in{a<1943:sg,x<1758:tpb,spv}
hpn{s<1880:jqn,A}
zjn{s<1412:R,A}
nhf{x<1660:A,x<1701:A,a>3374:A,R}
sc{x>1869:A,x<1591:R,R}
mkk{s<1676:tqm,x>2973:mt,hpn}
hz{a>2110:A,x>3216:R,a>2048:R,A}
ggs{s<1546:R,x>545:R,a>3613:A,R}
rgg{m>1130:A,R}
gdz{a<3255:A,a>3354:R,x<2961:ksq,ncv}
bmf{s>1655:R,a>2724:cgc,s>1420:xb,R}
khx{a>3552:R,x<1651:R,A}
qh{s>220:R,a<3157:R,R}
br{m<2805:pr,a>2750:cj,R}
jbc{a<2031:R,a<2059:A,m>600:R,R}
ddt{s>1226:A,A}
nqp{a<237:A,x<3128:A,s<1505:A,A}
nv{a<2139:rdn,s>247:gxb,m<2991:R,R}
pm{s<1106:A,A}
xhq{m>2657:R,s<856:R,A}
gkc{a<2864:A,s>1480:qkc,a>2894:R,R}
jh{x<1078:jls,A}
nf{a>157:R,R}
kft{a<2892:qx,m<461:R,R}
nkr{s<2913:A,x<2665:A,a<2197:R,R}
npx{x>520:ksr,ktf}
dn{x>2107:R,m<1969:A,a<693:A,A}
ss{a<1365:A,A}
kh{m>1995:xqn,A}
svb{m>2476:A,A}
gq{x>1247:A,x>1201:R,s<3631:A,R}
txt{s<3120:A,m>2972:R,R}
lh{s<1864:jhv,x<1112:bvc,lp}
prh{m>2745:zx,R}
sfh{a>3014:xkl,m>3147:jsd,xns}
xpc{x<2539:nx,m<990:qnt,a<3196:A,R}
ktf{a>3147:R,rq}
jls{a>3554:A,R}
bz{s>1380:R,A}
xlh{m>2973:A,a>3598:A,s<3449:R,vpb}
mf{s<2422:htg,A}
xxc{x<3193:A,s>3483:R,a>2650:A,A}
ks{x>3068:A,a>438:A,A}
kmb{a>2559:A,x>1045:A,R}
dlk{a<2513:hm,x>1045:jhg,A}
dj{s>354:xbh,vbb}
jc{m>3180:A,a>209:R,R}
pzz{m>2855:R,R}
fkc{s<2799:R,R}
rfn{x>3437:A,s<1636:A,R}
gz{x<1228:A,rbf}
rt{a<330:qmv,m>2632:A,x<2000:R,R}
clp{s<3277:R,s>3578:A,x<1236:R,A}
hrj{a>3673:tsb,s>1280:jbm,a>3584:A,R}
rcv{a<2713:A,m<3092:R,a>3295:A,R}
jg{x<847:A,nh}
rhz{m>1561:vhm,x<1609:ddm,m>1357:vnp,jcg}
gg{a<2326:R,m>232:R,R}
vbl{s>2050:nr,a>3485:kv,s>998:jsm,dj}
dk{m<2735:A,m<2834:A,R}
xzh{a<2518:A,a>2621:A,A}
jbn{a>1459:R,m>326:R,R}
szq{s<3344:bxk,s<3665:fx,a<3313:vbz,dr}
fbm{a>3537:crp,sr}
rlq{s>644:tc,R}
nrv{x>3604:A,s>180:R,m>3198:R,R}
lm{x<1301:A,x<1356:A,A}
ck{a>2781:R,s>2456:A,s>2295:R,A}
zq{x<1440:R,s<1354:A,m>3127:R,R}
pxq{x<1540:R,x<1654:R,A}
tpj{x<398:R,R}
qmg{x<1806:A,R}
qmv{s>915:A,A}
hc{s>1234:A,a<3777:A,s<543:A,R}
kdc{s<448:nv,x>2934:dcz,hch}
vmb{m>2094:gvv,s>3496:ksm,bd}
xqb{m<485:mzt,s>3300:A,hs}
hzg{a<746:fsm,m>1952:dxt,s>3756:bm,bh}
vnp{x<1675:xpv,A}
nb{x>1991:A,R}
xk{a<3000:mq,s<3447:vr,x<333:R,R}
ctb{x>831:vkc,s<1355:fhm,a<914:jd,tp}
xg{m<1340:shq,m<2708:R,s>261:A,nrv}
bj{a<2444:R,xv}
zkr{s<3365:R,A}
ndb{s>904:fd,x<1242:jbx,lm}
dd{a>665:R,R}
lnt{a<1177:A,x<901:A,x<919:R,R}
nn{m<2151:R,m>2257:A,R}
psx{x>3837:A,R}
zgp{m>1002:A,A}
rjt{s<1606:kf,R}
tqm{x<3109:pcz,tf}
xkl{m>3259:nhf,m<2733:nm,ltt}
fvc{s<2245:R,a>3610:R,a<3395:A,A}
vx{s>3405:A,s<2864:R,x<1291:svj,A}
fbs{m>3094:tjq,a<2671:lbr,s>2980:br,zxf}
sv{x<2686:A,A}
jt{s>307:mm,s>190:A,A}
ltt{m<2932:A,m>3097:R,R}
klj{a<190:R,R}
zj{a<3839:R,a<3898:R,a<3932:R,A}
qrz{a>2385:R,a<2103:A,a<2217:A,A}
dp{x>1276:fg,s>2212:ck,a>3255:kp,A}
qzg{a<2978:jqg,s>401:A,a<3083:pxq,bst}
fk{x<3153:R,R}
rdn{s<275:A,x>2619:A,s>365:A,R}
xdd{a>2338:xfl,db}
ht{s>1867:R,a<2561:R,a>2852:R,R}
ffz{x>2633:gjj,cxf}
xfc{a>2266:R,m>607:A,R}
gfp{m>1781:A,A}
ch{x<1246:rjt,m>2038:dh,s<1350:lj,hsx}
kqz{m>1171:lz,dbs}
njh{a>2157:A,m<3857:R,R}
nt{m<710:R,x>2315:mrg,s>1511:A,zh}
gv{a>2350:chf,m>516:A,gpm}
kk{x<285:nnx,zpj}
vpb{a<3293:R,a>3455:A,R}
pz{a>2276:xdd,fkl}
jbm{x<2951:A,s<1599:R,m<734:R,R}
tx{x>2805:R,R}
lp{x<1388:gtz,m>1008:rhz,rrl}
xqz{m>2687:A,s>3438:A,A}
hcm{s<1693:R,x<2623:A,R}
frl{m>274:gv,s<1923:pkr,mc}
fkl{x>2563:hz,a<2108:sqt,A}
nsj{m<2752:qmk,klj}
mhf{a>337:R,R}
cgc{s>1479:R,a>2929:R,R}
hf{a<3567:A,A}
jz{x<3661:R,R}
vr{x>269:A,x<163:A,s<3259:R,A}
jjb{a<3106:jkz,s>650:zv,s>457:jpr,lnj}
bx{m>437:lr,pt}
cht{a<3523:A,s>2630:rj,m>418:zj,kpp}
pht{x>2122:A,A}
vd{s>601:A,m>1408:A,A}
sg{x>1447:msc,bsb}
{x=238,m=232,a=127,s=30}
{x=489,m=234,a=187,s=941}
{x=2468,m=1586,a=611,s=1302}
{x=3030,m=825,a=221,s=748}
{x=1624,m=855,a=450,s=1328}
{x=2230,m=1545,a=397,s=179}
{x=115,m=98,a=233,s=353}
{x=1243,m=261,a=1160,s=301}
{x=1435,m=740,a=1442,s=16}
{x=2214,m=944,a=803,s=235}
{x=205,m=28,a=1261,s=591}
{x=1727,m=2967,a=1451,s=503}
{x=523,m=199,a=1088,s=1280}
{x=287,m=1673,a=558,s=2635}
{x=825,m=425,a=1999,s=1170}
{x=2442,m=1080,a=695,s=2139}
{x=450,m=2398,a=774,s=1790}
{x=460,m=1105,a=1617,s=2377}
{x=715,m=150,a=323,s=446}
{x=95,m=57,a=418,s=59}
{x=593,m=773,a=1205,s=1522}
{x=1305,m=365,a=2267,s=748}
{x=1882,m=698,a=649,s=1619}
{x=1438,m=58,a=366,s=317}
{x=105,m=457,a=351,s=409}
{x=2637,m=48,a=1364,s=120}
{x=546,m=1212,a=553,s=2020}
{x=289,m=1487,a=433,s=72}
{x=819,m=1468,a=1981,s=63}
{x=3224,m=304,a=2422,s=1500}
{x=1805,m=225,a=1755,s=138}
{x=1165,m=2002,a=337,s=1705}
{x=1140,m=2753,a=1535,s=491}
{x=1302,m=1637,a=228,s=1471}
{x=2472,m=293,a=1432,s=96}
{x=1950,m=298,a=573,s=492}
{x=92,m=869,a=1050,s=13}
{x=300,m=1946,a=539,s=8}
{x=2314,m=296,a=344,s=838}
{x=2344,m=261,a=809,s=3}
{x=355,m=1190,a=2970,s=74}
{x=1006,m=1092,a=825,s=2021}
{x=216,m=920,a=494,s=2965}
{x=392,m=816,a=863,s=175}
{x=2724,m=1041,a=1005,s=229}
{x=1371,m=269,a=627,s=1167}
{x=411,m=442,a=455,s=731}
{x=116,m=1840,a=2947,s=380}
{x=1958,m=383,a=960,s=897}
{x=379,m=1018,a=540,s=1312}
{x=180,m=1900,a=1999,s=437}
{x=1698,m=113,a=62,s=1213}
{x=6,m=295,a=24,s=2020}
{x=808,m=3042,a=920,s=1168}
{x=2905,m=93,a=2757,s=341}
{x=651,m=1805,a=435,s=3238}
{x=1763,m=384,a=1075,s=616}
{x=214,m=3035,a=536,s=844}
{x=775,m=43,a=353,s=413}
{x=1285,m=1315,a=429,s=1249}
{x=564,m=38,a=1534,s=268}
{x=665,m=1685,a=292,s=243}
{x=1047,m=875,a=2636,s=616}
{x=6,m=495,a=1926,s=2163}
{x=768,m=1896,a=458,s=22}
{x=163,m=741,a=451,s=796}
{x=106,m=794,a=1675,s=2563}
{x=824,m=2607,a=42,s=843}
{x=78,m=83,a=1718,s=2672}
{x=22,m=1108,a=197,s=307}
{x=160,m=190,a=3555,s=508}
{x=229,m=564,a=830,s=3129}
{x=594,m=1196,a=364,s=1703}
{x=2721,m=1009,a=872,s=3632}
{x=2893,m=564,a=282,s=536}
{x=1317,m=2746,a=427,s=602}
{x=1741,m=104,a=986,s=2976}
{x=637,m=1381,a=1037,s=255}
{x=1398,m=1991,a=682,s=1001}
{x=537,m=1433,a=148,s=773}
{x=143,m=2070,a=3859,s=358}
{x=2483,m=1234,a=779,s=361}
{x=277,m=462,a=585,s=1220}
{x=90,m=2449,a=2007,s=1234}
{x=192,m=1049,a=1542,s=1112}
{x=1907,m=13,a=105,s=3675}
{x=716,m=425,a=349,s=2780}
{x=841,m=2048,a=196,s=661}
{x=235,m=737,a=761,s=1338}
{x=337,m=29,a=2368,s=1528}
{x=346,m=2113,a=1210,s=31}
{x=325,m=1303,a=963,s=370}
{x=404,m=120,a=7,s=39}
{x=365,m=1286,a=846,s=8}
{x=985,m=338,a=724,s=731}
{x=132,m=127,a=257,s=349}
{x=752,m=5,a=1352,s=2079}
{x=923,m=513,a=861,s=1540}
{x=344,m=1492,a=432,s=2336}
{x=1598,m=13,a=848,s=1218}
{x=63,m=2897,a=825,s=781}
{x=928,m=786,a=315,s=1069}
{x=92,m=512,a=2113,s=1421}
{x=1624,m=763,a=1679,s=2171}
{x=207,m=668,a=85,s=1765}
{x=60,m=2722,a=69,s=3242}
{x=520,m=145,a=827,s=21}
{x=290,m=13,a=2511,s=1}
{x=736,m=831,a=1352,s=505}
{x=2405,m=272,a=1729,s=356}
{x=480,m=1087,a=298,s=178}
{x=764,m=56,a=637,s=484}
{x=2977,m=426,a=2928,s=261}
{x=2578,m=175,a=857,s=49}
{x=323,m=1228,a=1597,s=789}
{x=80,m=85,a=1637,s=1499}
{x=2443,m=1388,a=1084,s=105}
{x=152,m=1105,a=594,s=17}
{x=1,m=2959,a=1212,s=2164}
{x=93,m=570,a=2985,s=506}
{x=58,m=166,a=19,s=479}
{x=48,m=3218,a=534,s=927}
{x=2853,m=1521,a=628,s=38}
{x=963,m=285,a=460,s=2077}
{x=370,m=474,a=555,s=305}
{x=1440,m=8,a=751,s=856}
{x=1522,m=1839,a=3393,s=679}
{x=1501,m=850,a=117,s=1264}
{x=513,m=704,a=303,s=824}
{x=2778,m=769,a=786,s=2078}
{x=643,m=1653,a=1183,s=1101}
{x=599,m=34,a=81,s=1551}
{x=1927,m=1347,a=890,s=167}
{x=270,m=491,a=1367,s=2548}
{x=656,m=1953,a=1256,s=374}
{x=369,m=841,a=694,s=41}
{x=307,m=2036,a=5,s=210}
{x=588,m=148,a=422,s=622}
{x=1045,m=644,a=667,s=46}
{x=955,m=253,a=2044,s=1816}
{x=340,m=1166,a=70,s=1416}
{x=446,m=2736,a=185,s=1831}
{x=410,m=495,a=1996,s=1263}
{x=396,m=292,a=1697,s=178}
{x=104,m=976,a=2453,s=437}
{x=1018,m=1114,a=1377,s=89}
{x=1112,m=2070,a=611,s=389}
{x=965,m=239,a=2490,s=3543}
{x=629,m=494,a=1964,s=246}
{x=1509,m=292,a=2019,s=222}
{x=806,m=902,a=2764,s=757}
{x=452,m=2631,a=3531,s=61}
{x=976,m=959,a=247,s=771}
{x=1437,m=183,a=410,s=631}
{x=1984,m=792,a=1049,s=102}
{x=2670,m=583,a=146,s=2063}
{x=21,m=965,a=272,s=666}
{x=939,m=668,a=605,s=887}
{x=1956,m=1374,a=1251,s=1838}
{x=2159,m=1647,a=2537,s=1086}
{x=1366,m=1926,a=1117,s=385}
{x=426,m=387,a=1672,s=60}
{x=454,m=973,a=1007,s=1745}
{x=1230,m=1294,a=111,s=2851}
{x=947,m=1357,a=589,s=3}
{x=387,m=460,a=880,s=1002}
{x=409,m=886,a=1385,s=312}
{x=2082,m=219,a=3224,s=967}
{x=40,m=1073,a=2745,s=213}
{x=192,m=168,a=462,s=313}
{x=3387,m=782,a=937,s=272}
{x=2172,m=1671,a=890,s=1794}
{x=717,m=684,a=118,s=388}
{x=2392,m=26,a=108,s=1298}
{x=537,m=1924,a=241,s=2892}
{x=2531,m=1322,a=600,s=149}
{x=485,m=500,a=101,s=1}
{x=597,m=3017,a=397,s=1541}
{x=1234,m=172,a=225,s=383}
{x=337,m=3497,a=868,s=1029}
{x=1175,m=1917,a=226,s=3485}
{x=1627,m=2067,a=1210,s=2355}
{x=370,m=1609,a=3437,s=876}
{x=640,m=125,a=1038,s=216}
{x=327,m=6,a=189,s=29}
{x=3,m=1821,a=819,s=66}
{x=115,m=1831,a=662,s=970}
{x=2709,m=458,a=1189,s=1403}
{x=2202,m=731,a=858,s=913}
{x=209,m=94,a=2212,s=457}
{x=756,m=3382,a=1674,s=1311}
{x=624,m=738,a=233,s=137}
{x=1310,m=1252,a=314,s=2120}
{x=15,m=2772,a=182,s=84}
{x=549,m=785,a=69,s=923}
{x=1623,m=1888,a=457,s=24}
{x=619,m=828,a=336,s=762}
{x=573,m=101,a=217,s=2115}
{x=50,m=1103,a=230,s=1461}
{x=780,m=2290,a=339,s=3021}

55
2.js Normal file
View file

@ -0,0 +1,55 @@
var data = IO.slurp("2.txt");
var games = data.split("\n");
var allowed = {
red: 12,
green: 13,
blue: 14
}
var amt = 0;
for (var i = 0; i < games.length; i++) {
var sets = games[i].fromfirst(': ');
var rounds = sets.split(';');
if (rounds.every(function(r) {
var draws = r.split(', ');
return draws.every(function(draw) {
var y = draw.trim().split(' ');
var num = y[0];
var color = y[1];
return num <= allowed[color];
});
}))
amt += (i+1);
}
console.say("Part 1:")
console.say(amt);
var amt = 0;
for (var i = 0; i < games.length; i++) {
var sets = games[i].fromfirst(': ').split(';');
var colors = {
red:[],
blue:[],
green:[]
};
sets.forEach(function(set) {
set.split(', ').forEach(function(draw) {
if (!draw) return;
var y = draw.trim().split(' ');
colors[y[1]].push(y[0]);
});
});
var mred = colors.red.length === 0 ? 0 : Math.max(...colors.red);
var mblue = colors.blue.length === 0 ? 0 : Math.max(...colors.blue);
var mgreen = colors.green.length === 0 ? 0 : Math.max(...colors.green);
var power = mred*mblue*mgreen;
amt += power;
}
console.say("Part 2:");
console.say(amt);

100
2.txt Normal file
View file

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

97
3.js Normal file
View file

@ -0,0 +1,97 @@
import { loadFile } from "std";
var data = loadFile("3.txt");
var lines = data.split("\n");
var reg = /\d+/g;
function is_partnum(number, line, last)
{
var left = last-number.length-1;
left = left < 0 ? 0 : left;
var up = line-1;
var down = line+1;
last++;
if (last > lines[line].length-1) last = lines[line].length-1;
var checks = [];
if (up >= 0)
checks.push(lines[up].slice(left,last));
checks.push(lines[line].slice(left,last));
if (down < lines.length)
checks.push(lines[down].slice(left,last));
for (var i = 0; i < checks.length; i++)
if (checks[i].match(/[^\.\d]/))
return true;
return false;
}
var str;
var total = 0;
for (var i = 0; i < lines.length; i++)
while (str = reg.exec(lines[i]))
if (is_partnum(str[0], i, reg.lastIndex))
total += Number(str[0]);
console.log("Part 1:");
console.log(total);
var greg = /\*/g;
function get_number(line, p)
{
var l = p;
var r = p;
var str = lines[line];
while (l >= 0 && str[l].match(/\d/)) l--;
l++;
while (r < str.length && str[r].match(/\d/)) r++;
return Number(str.slice(l,r));
}
function gear_ratio(line, p)
{
var checks = [];
var left = p-1;
left = left < 0 ? 0 : left;
var right = p + 2;
right = right > lines[line].length-1 ? lines[line].length-1 : right;
var up = line-1;
var down = line+1;
checks.push(line);
if (up >= 0) checks.push(up);
if (down < lines.length) checks.push(down);
var reglet = /\d+/g;
var coords = [];
var n;
checks.forEach(function(c) {
while (n = reglet.exec(lines[c].slice(left,right))) {
coords.push({
line: c,
idx:reglet.lastIndex-1+left
});
}
});
if (coords.length !== 2) return 0;
var n = 1;
coords.forEach(function(c) {
var x = get_number(c.line, c.idx);
n *= x;
});
return n;
}
total = 0;
for (var i = 0; i < lines.length; i++)
while(str = greg.exec(lines[i]))
total += gear_ratio(i, greg.lastIndex-1);
console.log("Part 2:");
console.log(total);

140
3.txt Normal file
View file

@ -0,0 +1,140 @@
416.........................559...............417...............785.......900.......284...........503...796....992..........................
.........702*....772............378..569.........&.49..606...14*..............$.453*.........307....*......$.....-.................995......
.....................458...856......+.........+....&..............680.......104.............%....516.................................*......
...........822..174..*.....&...........711.746.......&............$....../.............656....#...........265=......634.*.............430...
..827.137..*...*....39................*..............856..............767........522......$..773....619..............*...287....501.........
..........726...511.............*.....320........476...............................*................%...899....72..731...........%....$.....
.....861..............232....223.933...............*.@........424*618.858.......................................$.......338.205........535..
.......#.............-....................676...713...427.................-.......615.........126...................=..*.......*...&........
....40..........996..............520.974.*..........#......*.566........907......................&...214...996*911.115.363..960..897........
....+.............*....................$..172.....559...763.....*............554......*.............*.......................................
.......527...#.....90.+....66.................................890..............=...802.93.131..791...209......&........928......303....$....
950.....*....773......105..............725........................................................%............886.......*........$.384.....
........383......741..............@..=....#.....179.18..%974..........624.......64.266.................701...........%..671.721.........942.
..................*.............914..548..........+.*.................*...........*...................*.........834.394.....*...............
.......502*80..960........................25........464.........831.846........25.........329..985...458.+.....&................377..659....
..........................................*.....292...............*............/..................@......350........938............*....$...
...738..............428......+.......311...742.........236*631....816.&......+....86.........81.......................*.973*341.266.........
......*.....673......*......614.........*.......689.48.................450...816.....754...........258..@585.......154..............@.......
...231.....#.........681...........855...775..........*.....=..257...................................*.............................469..=682
........#...................807...&.............418.19.....259....*459..906...185.356.......778.......230....................556............
.......924.........459......*..............804.=.........................*...*...........&....*................=........836..+......618.....
.....=............#.......900........+...........702..383........%..*...250..503.......637.808.......97/....@...370.......&........#.....710
..988........685............../663.273...........*...@..........16.251...........$..............*..........964.......658.....537........*...
...............*......171*......................714.....543............737.....372.............941.............113..*....=.......853....733.
............470..161......508.....56...170.............$...................389.....544.....208.....98.........%.....617...884......-..@.....
.766.591............../.........-......*.......210.........618......*874....-.........#...*....129.=..194......../...................992....
....../....170@..140+..753....918....467.854....*................989..........979...............*.............-.907...276...931*618.........
..700............................................801....929..859.....#..........*.............594.493......981..........*...................
....+............173..............................................251........629..........970........*................136.........388...*...
......721.......$......911....766..................541.234....=...........47......614....@.....*217..885.680.742....................#..84...
.377*....*81.............*.......&...937...........+...*....155..@......*............*......648............&...*.....&401......493..........
.....1.................533............*..399...........861......951..709.331..126.....876.....................289.........@.....*.......*...
..........107....452-......594.888.431....*..+660...........79................................$......275*876.......978.....594..400...39....
.........+................*....*.........925..........$.......*........599.......228..........60....................+....#..................
...283...................177...708...........642....661........294........*............................288*793.867.....482.479.769....73....
...........617..855*...&.............605................783.91.........847................&...../...............*..#..........*.......+.....
.672..303+...*........967...............*453.....884@......*...208.949........*..........986.....249.....352..818.596.56....................
...*..........88...............569.....................975.....*.....*..638....619.......................+.............*.......*.......462..
....500.....=...................*.................*205..*..-...228.508....&........................395..............845.....683.365....*....
........197.672.841..............214.=...847...912.....24.349...................%....584.257............152.................................
.626....-..........*..447............714....&.....................463....287...360........*............*...............*.................717
..........53......334...*........................*167......................*.......................554..246...........295.396......./.......
.......24..............92...........897.......220...........................930..703...414.....711..*.........723.........*....117...146....
.......&...........548.....324.21......................622.........820.404...............*....../..139......&......*.......578...*..........
.....*......204......*..........*.............226...........663.......*......555.992.....502...........631..49.#....366........677..........
..958.350.....*......44...694...449..-39........*...........-...786.........*......*............................140.........................
...............477.........*...................815..............*..........815.................521....................&...273........103....
.........828............781....464..................276......646....665-............924..........*.......955........759.........934...#.....
........*..........*..........*..........15.193.......*.....................&.................808....347*......963........*....+............
.........810.....360........638...434.....*....*751....812.....573...........85.........+.........95.......892...*...153...220..........187.
....714*....................................................80*....162=.................214...........842...&...39..........................
........265.........................51.......285$.......................586.......=.................................*.....*..............948
..989..........22.=......374.......%....................142.......736..@.....507.636.797.....273.........872.....567.978..334.....382...*...
..........@.......68..=......................116.130.......%.250../......-...=........*.........*486.415..........................*....813..
.......505............61..140..........435..........*691......*........852..........571....408..............12......80.......228...109......
.........................*.........207...*..24................402.=...........................@....................../...162................
....285.................672.552........492....$./..................3..620.391...............................179............*................
...*..........159...428.......*.................390.111.........$.....*...*..................348.355.481.......&.210..99...41...............
...52......12..@..........808.810.897...................663..280....57..............476.............*............*.....*........208=........
..........*...............*.........@.286..................*...........................*..........................905.296..............148..
.......298......119.....172.................622$..637................#......342.......679.111......-968..104*478............#.......*.......
.../.............*........../......................*..............658..........*718..........*136.....................503.899....889.498....
....691........341.262..36.549...........386........437.............................662...........848............#......*...................
.......................*..........936...*...............................-...........*......516....%......358....707..535...........841......
......$..............639............*..798.../..67%............137...716.......313.247......................-............@.....371..........
....433.677..605.267................1.......930........478........*........565*................................869.......372..@....228......
...........@..*..$...794.........................74.......#./......833.348.......................................+................*.........
......865...............*.........................*..........839.....................=......................................916..84.@.......
.................-....451........541@......468..684....18............759.............499................124.....426*.........*......882.....
...68*...........614........509...............*.........&...956*308.%........&....36...........480+....../..........917....32....#..........
......363..377.............*..........441.....418..........................279.....*.................139..........................944.......
........................412............*..........%....920*585....526*............931.346&.807..840.....*.626-...#....................923...
.....283.....924...+..................628.......33....................908..766..............*........336..........446...........191.........
...............*.249........@264..35...................502.791.#...........*......=............126....................957....71....*.768....
.........144&.36.....216.........*...........................&.730..........201..581.704.........$......715.............=......*.......%....
...349..............*....598...949.........189....981.....#.............524...................*............=................440...847.......
.................967....#..........999*6..%.........-......604............&.189.626...#774.159.647....................168.........../...329.
..............................................481.....*........................*.................................747..%.................#...
..........245...878.......495....57....841.........351.517..........-297........................343.599/........&.......360..........-......
430........&..............&.....*...&.....*885...........................9....392.......93..336*...........................*321.....86......
....469......#.................999..796..................899.........250*........$.......*........247............................+.......328
......*...696...615..300..603..............................*....232...................402...501......*.......77.271.....@.........146.......
......170......%....$.........*..991..........782.49.......128.............................*........161........*.....648......123...........
..........646................901..*.............*......134...........517..2..287........513...............................644...*...........
...................999*620.........541.379.....488..18*.......................*...............208....931.338..%143...........*...19.........
...+.......938...........................*...%.............&........626......268.418......841*..........*...............820.395..........913
.723...834*..........+............162.667.....84............803.804...*............*................399........172..530*....................
.....................596............*............................./.287............852....623....@.*..............@........168...965..*17...
.....=488...................758....607.....&......53%......................105.683......-...*.860..244.....&....$....232....................
.............................*..........333....................197........+....*......334.954.............686...464...............544.......
.139=..............754...993.677..../.......933..........391....*....357*.....952......................@..........................*.........
..........831............../.........94.600................+.121.........183........18..686.....665*..823...........575...........68........
141...800....*....692...........254@.....*...819-.....................................*..@...................17.......*...815...........686.
........%.602........%.................186..........562.93....774.....................11....948....912.........*328..243.*..................
.......................................................*..........607....280..................&....+.....................548.&897.100@...955
......504.....605...........889@.............975..664....$.....#............*....141.................378%.........812.......................
.....=...........*.....730...............%...............899..480.....*....375.....-.444.........47*.........@63...........828.....468..462.
.......607.../...23....=......=........383.............................522............*.............433..360..................*372...*......
........*...975.............428...................592*......@258...114......%......431...................*......+........658.......560.163..
........16........................329.......315.......973............*...333....@.......$....782..18...58....533........*...............*...
..327.............563...889.......*...........*..595...............913........671..354..937...%..*...&...........&.787...975.......676...247
.....+..&...401..*..............713........=.757...#.873*47...#465..................................440..588/..859.%..................*.....
.665....133...%..196....907..............348..................................162........305...................................163.-........
....*....................*...........170.........222.804....784..............*...................................................=.742......
..239..338.....27-.437..543.........*....609......*..*......-...............582..-...........343*560....852.../....636..263.................
..........*900.......*............17...........948.....597.....=....922...........682./255................@..35.......*.......211-..#.......
.......*...........686........984..........78......896*......13........+....................985...&....................278.........876.835..
....630.82....$851.....905.......*..281...*...............................352..........*746........215.877....845..........471.852.....*....
.........................*.....757.*......625...........924......878..........912...............-.........*../.....538%......+.........871..
..954*712..977.....-..762..........236.........527*674.*.........*........811*.....228....&.....5........739...483..........................
..........*.......470..................................707....363.................*......525.......303..........*........463....537.........
...460...947...............130.....757./96........*.................=...529....+..466........527................65..%648....=.....*.........
.....*......................$....../..............968..............479.&....630............................598.................952..........
.......&..........793...................................514...............-...................311..........=....83......#.............124...
.975....399.......*...-.......*814...663..................*....*...........381../...............*.............@.........284............*....
...*............367....198..........@.....992.....716*529....96.................729.329.688...%.322.-......67.79......-.......335....997....
488............................632........*...../......................387.............*....225......491.............391..750...%...........
.......861.527......778.165.......*........187..916.......845....-....*.......873.................................@.........................
..545.....*.....$.....*..*......627............................736.376..845...*....594........+.......171.........292...........*750..-.....
.................407.403............+...342.................+..........*.......897..........400.......$......................910.......350..
...........................40..284.66...*......494..........255.......653..............866.................942=..................*52........
....&........827.......296...*........$.401......*..............892*...................$.............1.164.......343..........485...........
.930............*.........*..944...308...........763....../.........62.....113....=...........421........*..........................580+....
........50*.....934......705............................999..................*....541...............847-.950..............*131..............
...........209....................................&404...............276..242.............723.652................873...313..............24..
......*........606....550#.....2./........@..................899.......*.....................*..........235..112...........704.....337......
.......837....*...............*...83...993.....*416.........-....580%..535......../.....-204...............#..*.....93+....*...723./........
..............168.....753..593..............504......./........................488..............=.............458.......872...*.............
...#85...................&......911/...................880........315..872..........=....494..349....466..428..................40...........
........939........648......................*................227...*......*.......924...*...........*.....*.................................
918*......&.@........*...902..269..834....87.826.........../...*...919.118...817......109..........933..643...........&..............-......
....949......883...111..%......*...%..................710.464.943.........../...................................842....305.....469..289.....
..........................%...974......*407..168.647...*..............617.......498/.....848...........@99........*...........+.............
..........176...........120.........469........&...#....997......464.......274.............*......./............477.417../.......738........
.........*.......964.........291..........................................-.............2..29...272..465...............-..819........718*265
....298...747.......#.......*.....+745...........460...741*762.275...491.......+.735*34.*............-....*841......+............*..........
...*........................593..............298...#............%....$......225.........943........................23.....702.601.616.......
..889................695........654..750.....*.............637........./...............................780....*726....233...*...............
..................../.................*.....453.....642....*.........828......@...94...........152/...*....790.......*.....445......../.....
...........................51.......681........................271..........719.......................964......399..426...............456...

43
4.js Normal file
View file

@ -0,0 +1,43 @@
import { loadFile } from "std";
var data = loadFile("4.txt");
var lines = data.split("\n");
lines = lines.filter(x => x);
var scratch = [];
var total = 0;
lines.forEach(function(x,i) {
var win = x.match(/([ \d]+)\|/);
var lose = x.match(/\|([ \d]+)/);
win = win[1].trim().split(" ").filter(x => x !== "");
lose = lose[1].trim().split(" ").filter(x => x !== "");
var winners = {};
win.forEach(w => winners[w] = true);
var matches = 0;
lose.forEach(function(l) {
if (typeof winners[l] !== 'undefined') matches++;
});
var amt = 0;
if (matches > 0)
amt = Math.pow(2, matches-1);
total += amt;
scratch[i] = {
n: matches,
score: amt
};
});
console.log("Part 1:");
console.log(total);
total = 0;
var cards = [];
for (var i = 0; i < scratch.length; i++) { cards[i] = 1; }
for (var i = 0; i < scratch.length; i++) {
for (var j = 1; j < scratch[i].n+1; j++)
cards[i+j] += cards[i];
total += cards[i];
}
console.log("Part 2:");
console.log(total);

6
4.test Normal file
View file

@ -0,0 +1,6 @@
Card 1: 41 48 83 86 17 | 83 86 6 31 17 9 48 53
Card 2: 13 32 20 16 61 | 61 30 68 82 17 32 24 19
Card 3: 1 21 53 59 44 | 69 82 63 72 16 21 14 1
Card 4: 41 92 73 84 69 | 59 84 76 51 58 5 54 83
Card 5: 87 83 26 28 32 | 88 30 70 12 93 22 82 36
Card 6: 31 18 13 56 72 | 74 77 10 23 35 67 36 11

202
4.txt Normal file
View file

@ -0,0 +1,202 @@
Card 1: 73 92 13 35 18 96 37 72 76 39 | 82 14 66 57 25 98 49 28 3 95 81 85 31 30 16 79 7 12 55 19 97 45 9 58 2
Card 2: 41 93 82 81 96 56 46 13 44 79 | 13 28 47 49 46 94 84 87 96 45 41 79 35 43 31 34 81 82 64 93 8 56 9 44 55
Card 3: 22 26 55 46 94 88 3 17 91 95 | 95 97 44 25 46 91 17 20 43 94 22 34 62 73 31 55 60 79 88 90 3 80 33 89 26
Card 4: 78 32 27 65 64 28 43 81 50 93 | 95 37 77 46 29 55 98 88 94 72 53 80 43 41 7 63 92 33 32 66 2 35 31 24 65
Card 5: 74 21 96 20 45 88 18 10 53 73 | 80 87 86 81 28 11 77 16 70 44 8 22 72 85 27 35 42 36 84 37 59 9 41 56 3
Card 6: 70 48 93 10 63 97 20 77 72 42 | 19 7 12 1 47 31 72 88 36 82 69 17 29 62 22 8 32 86 52 76 96 41 51 55 44
Card 7: 79 43 87 42 8 74 51 69 3 44 | 30 27 19 42 99 28 68 43 5 36 54 24 92 97 34 44 96 2 50 82 35 69 25 45 18
Card 8: 11 39 32 62 93 41 75 94 23 29 | 40 31 95 41 17 21 81 90 34 13 4 5 48 24 20 80 50 26 27 43 54 61 8 73 89
Card 9: 75 99 39 45 32 35 55 87 76 21 | 34 14 80 3 93 46 71 78 23 22 87 82 42 49 76 94 10 51 44 58 11 4 91 26 43
Card 10: 34 53 9 36 52 30 70 60 65 96 | 85 31 29 41 4 88 63 93 9 52 11 37 23 61 51 71 97 26 70 15 38 72 94 64 95
Card 11: 41 92 42 94 63 89 85 25 86 98 | 3 20 70 74 93 34 21 82 37 55 9 79 85 41 14 99 2 92 90 26 40 57 67 89 31
Card 12: 50 37 85 46 56 44 2 42 60 66 | 69 78 30 59 71 87 6 51 9 81 75 45 24 16 31 61 44 96 41 86 23 17 42 27 40
Card 13: 24 46 50 29 89 77 49 25 53 65 | 63 66 43 86 11 9 40 70 38 79 78 27 12 20 84 42 67 73 22 8 68 35 6 4 69
Card 14: 72 68 9 78 90 40 55 37 16 52 | 27 98 76 63 58 70 8 44 48 90 6 92 3 20 96 88 59 31 95 15 45 47 30 65 64
Card 15: 15 28 38 87 24 61 26 13 18 94 | 63 56 51 29 17 47 21 62 19 14 69 32 60 41 11 10 54 89 7 35 71 16 96 20 27
Card 16: 11 24 42 76 99 12 45 94 33 10 | 36 94 72 31 12 28 24 18 11 99 61 33 79 10 53 35 76 42 43 22 78 27 62 59 45
Card 17: 72 40 35 28 16 51 2 89 83 39 | 68 79 67 15 77 35 12 34 57 16 10 75 72 39 89 60 27 29 19 17 32 45 37 38 14
Card 18: 13 68 25 92 79 95 67 87 50 7 | 29 23 1 59 91 51 17 80 12 84 27 66 69 61 39 16 34 44 54 37 4 11 9 45 14
Card 19: 62 14 80 15 40 69 26 65 83 32 | 72 18 66 83 59 48 65 50 37 93 80 14 67 60 40 68 32 69 27 85 30 31 62 15 26
Card 20: 4 20 48 56 11 13 8 83 98 96 | 87 25 5 99 19 3 51 79 36 35 39 43 45 63 80 40 20 75 24 64 54 98 95 68 72
Card 21: 13 67 19 78 79 47 49 69 8 9 | 44 9 47 62 50 78 19 76 8 57 77 13 39 11 43 67 49 18 79 94 69 55 58 7 70
Card 22: 21 39 6 99 81 57 22 53 95 90 | 80 46 74 15 69 72 14 16 87 10 99 20 45 81 6 27 51 21 40 89 90 95 65 57 50
Card 23: 27 36 95 10 68 52 30 43 51 70 | 62 52 51 95 68 25 11 30 65 10 55 49 27 81 34 37 63 43 9 56 96 70 1 36 58
Card 24: 31 57 94 2 78 82 63 27 97 70 | 97 58 46 37 70 2 98 57 11 29 36 94 51 90 56 27 13 31 39 28 60 71 96 78 26
Card 25: 96 13 61 89 70 80 93 57 9 28 | 13 27 29 50 9 94 59 80 16 7 40 89 91 3 60 75 17 18 36 86 15 28 26 61 57
Card 26: 53 96 15 97 36 13 31 22 19 35 | 61 55 1 92 93 65 19 41 52 3 85 24 22 78 13 70 66 54 31 95 71 96 58 97 35
Card 27: 56 75 28 85 82 52 58 59 13 33 | 2 31 12 10 81 94 9 80 5 95 43 55 83 60 66 79 61 58 49 34 29 57 99 92 88
Card 28: 4 21 19 94 95 47 92 52 78 73 | 72 96 85 7 26 44 56 86 49 6 63 35 1 66 4 70 13 40 71 17 62 8 69 76 32
Card 29: 44 13 92 57 70 83 96 63 6 76 | 51 30 71 38 42 76 77 99 10 64 26 81 21 50 89 59 31 8 79 83 85 2 5 75 44
Card 30: 59 26 61 78 20 5 11 32 87 23 | 97 41 35 31 27 80 83 51 42 2 17 48 69 6 37 62 43 29 18 73 8 95 82 79 45
Card 31: 80 30 36 54 1 81 95 16 45 62 | 99 73 91 43 93 23 4 51 71 30 84 28 80 63 46 53 49 55 74 31 25 2 52 3 21
Card 32: 10 9 5 18 68 47 81 1 93 65 | 55 80 77 33 50 94 56 9 58 22 86 31 51 2 88 44 98 99 26 21 3 30 20 52 93
Card 33: 16 48 32 5 1 96 11 2 14 46 | 80 10 79 87 19 5 71 72 30 29 93 13 39 67 8 49 22 48 76 28 52 23 58 38 81
Card 34: 70 24 23 27 67 55 95 96 80 92 | 54 5 42 37 93 49 10 7 74 80 50 34 78 40 2 28 39 52 3 83 62 21 91 71 73
Card 35: 70 96 75 73 29 58 88 16 77 71 | 68 42 64 11 65 63 5 79 38 52 34 41 86 35 25 44 48 93 20 60 78 4 90 80 21
Card 36: 17 59 71 39 41 83 86 51 4 23 | 88 96 35 17 91 16 34 26 27 92 75 97 46 78 39 80 32 60 70 9 81 28 50 95 18
Card 37: 52 75 8 64 39 42 10 34 71 73 | 62 34 29 80 46 64 2 42 81 45 55 44 17 33 66 26 12 50 52 8 94 4 43 85 48
Card 38: 61 74 68 26 97 31 86 96 41 98 | 95 56 70 49 3 86 21 8 90 39 96 26 30 16 46 31 97 89 61 68 53 41 98 54 74
Card 39: 3 18 75 56 73 41 43 82 34 33 | 70 26 42 78 6 56 90 41 17 75 18 47 82 32 13 60 81 39 5 52 54 55 12 48 98
Card 40: 96 25 22 84 95 72 50 40 90 69 | 48 91 77 78 16 17 55 26 1 28 14 31 23 79 51 24 82 97 62 47 13 93 12 4 20
Card 41: 71 54 24 39 7 51 95 46 90 17 | 96 44 64 69 8 62 97 39 48 2 76 71 37 84 90 54 95 81 46 63 7 51 50 24 47
Card 42: 48 94 44 43 57 58 55 7 17 11 | 2 12 84 40 96 57 73 17 55 94 43 87 90 95 35 21 11 42 34 26 25 10 74 60 41
Card 43: 75 8 12 87 36 35 33 62 11 39 | 25 73 71 64 46 99 60 57 15 24 80 10 74 67 12 23 63 69 56 55 20 53 1 52 81
Card 44: 66 71 25 56 8 65 96 38 68 41 | 41 33 18 60 66 72 37 87 59 94 56 96 5 7 17 21 14 25 93 39 74 79 46 71 11
Card 45: 27 8 93 49 24 48 23 78 98 51 | 71 37 96 47 74 21 9 40 12 45 49 70 84 76 58 53 50 91 34 85 13 7 5 29 55
Card 46: 84 42 44 27 98 64 19 28 93 74 | 17 15 4 47 75 52 73 90 89 57 55 36 80 81 54 71 88 53 1 56 21 32 66 91 38
Card 47: 53 21 4 28 65 58 49 98 10 23 | 25 20 19 64 10 67 15 78 80 7 83 13 35 38 75 86 33 28 98 27 73 70 59 79 14
Card 48: 37 12 5 10 95 45 70 11 72 97 | 16 89 35 32 24 78 71 91 14 52 9 63 53 36 17 8 82 97 69 27 26 12 81 67 43
Card 49: 54 4 71 83 72 50 95 78 35 36 | 46 87 98 18 36 72 74 75 66 70 69 16 21 58 90 33 93 68 41 59 7 23 92 5 11
Card 50: 70 93 33 38 27 36 61 55 74 94 | 40 20 58 70 78 12 14 31 95 29 19 65 81 17 90 16 45 51 13 97 72 63 53 41 88
Card 51: 27 14 41 6 24 48 96 66 43 18 | 11 1 81 92 8 29 26 13 35 73 3 78 93 52 98 77 60 99 62 79 22 54 9 21 30
Card 52: 1 28 54 70 24 22 50 37 63 87 | 22 11 71 87 50 25 24 70 37 14 95 28 40 80 3 54 63 58 82 1 34 41 13 10 75
Card 53: 33 96 53 80 60 6 35 77 32 83 | 35 5 43 67 32 80 18 79 58 91 28 96 23 53 6 83 77 86 71 50 21 33 60 30 24
Card 54: 45 76 84 5 12 3 44 2 81 59 | 6 76 63 81 16 2 12 3 87 44 21 24 45 19 59 84 5 17 68 80 66 36 15 99 31
Card 55: 5 67 46 50 68 64 14 94 11 4 | 45 34 62 53 97 65 37 27 68 36 22 44 20 60 75 77 89 55 33 9 13 28 63 31 47
Card 56: 51 96 40 33 39 81 74 60 62 65 | 70 90 69 76 32 62 40 65 56 80 28 33 74 81 82 94 60 12 49 7 39 96 8 63 51
Card 57: 24 71 51 97 23 89 41 46 6 56 | 62 52 20 4 67 24 38 5 92 50 11 63 59 17 55 83 98 21 48 87 97 32 23 53 66
Card 58: 63 72 78 10 64 46 65 54 95 9 | 8 77 4 58 32 82 42 49 97 47 40 2 87 24 9 94 63 61 17 27 56 55 12 75 39
Card 59: 62 67 17 58 45 46 91 94 81 93 | 46 40 52 26 74 81 17 41 82 61 12 50 35 97 62 94 28 58 38 45 92 63 67 93 91
Card 60: 81 21 13 88 69 2 49 17 59 51 | 64 4 59 28 95 21 2 17 49 88 48 13 82 51 18 65 54 81 42 10 22 69 32 85 60
Card 61: 50 51 58 20 22 31 61 89 84 7 | 1 68 27 88 52 39 13 23 2 3 42 5 55 29 77 38 44 95 63 34 46 75 4 60 16
Card 62: 62 84 76 41 71 86 25 15 55 42 | 71 32 35 76 42 41 84 15 1 43 30 88 48 86 25 70 98 62 93 3 13 46 77 97 50
Card 63: 34 20 1 29 7 61 31 97 81 85 | 26 8 78 2 29 61 23 59 60 7 10 86 12 64 1 87 24 56 58 30 19 53 36 81 34
Card 64: 3 82 28 70 49 95 9 52 45 38 | 27 28 65 81 57 15 29 71 32 60 48 52 4 73 38 72 67 10 88 7 3 5 78 91 18
Card 65: 85 74 52 87 60 24 82 72 67 93 | 72 4 87 52 86 48 39 67 18 15 99 41 78 38 60 84 36 75 79 23 2 42 54 16 69
Card 66: 33 54 78 76 24 29 62 20 2 98 | 76 98 51 99 75 2 30 83 33 72 28 3 29 62 20 84 54 61 59 94 1 16 63 24 78
Card 67: 59 78 56 63 44 35 10 94 13 4 | 46 63 56 1 94 86 55 80 20 28 50 67 4 53 6 59 13 58 93 10 22 19 84 12 8
Card 68: 87 12 41 7 75 43 62 68 63 81 | 4 95 20 24 91 37 70 56 67 49 90 82 6 21 59 30 71 64 41 65 58 96 8 25 13
Card 69: 89 39 8 86 62 97 53 84 72 74 | 11 48 25 89 72 59 7 85 15 19 65 80 54 1 21 38 29 30 40 58 56 49 3 83 52
Card 70: 75 49 73 78 29 12 47 36 24 88 | 92 84 50 75 12 34 73 28 97 86 29 56 78 8 69 47 17 44 32 68 81 15 16 26 37
Card 71: 44 41 24 40 59 85 74 36 4 92 | 33 48 32 49 78 34 35 29 45 93 36 37 18 98 16 17 58 69 40 61 66 94 60 59 75
Card 72: 9 21 83 27 2 23 99 7 6 59 | 73 74 81 25 65 33 29 14 27 44 24 63 49 43 12 37 69 79 36 54 52 82 55 78 94
Card 73: 71 70 3 47 31 76 78 72 86 98 | 95 20 70 33 45 89 85 29 52 88 42 90 6 80 25 58 79 13 48 67 41 49 24 27 39
Card 74: 22 39 58 70 56 59 3 98 61 97 | 13 84 72 47 11 52 4 35 46 49 5 24 62 43 9 40 63 16 99 93 33 83 30 91 14
Card 75: 29 48 85 95 64 61 35 99 15 46 | 98 97 9 76 5 14 74 87 38 75 82 54 4 63 20 53 79 40 62 96 2 85 31 36 80
Card 76: 70 94 3 1 46 48 87 5 16 74 | 52 14 22 6 24 65 4 8 42 36 66 43 9 45 93 69 51 57 19 44 81 98 77 35 79
Card 77: 77 8 29 21 11 31 93 74 72 71 | 67 8 43 72 62 40 11 77 71 29 61 92 74 12 52 37 78 93 56 31 14 21 63 39 35
Card 78: 66 48 5 4 63 54 91 74 76 77 | 48 54 36 95 11 61 76 52 46 65 18 67 66 63 62 19 5 74 77 64 4 42 9 91 55
Card 79: 57 19 65 23 69 74 28 97 89 41 | 89 15 41 99 58 53 8 17 23 81 28 94 43 57 1 46 71 38 87 6 49 59 80 85 75
Card 80: 64 39 19 41 14 6 91 8 61 46 | 66 94 39 82 43 92 33 8 30 1 40 55 18 95 6 86 7 80 91 65 97 9 12 61 2
Card 81: 26 28 44 29 78 30 14 68 22 40 | 38 8 25 72 51 31 16 71 45 37 87 23 85 64 7 6 34 44 90 9 13 15 82 49 32
Card 82: 47 26 6 33 32 1 37 42 96 29 | 68 20 10 56 6 27 13 22 83 15 41 37 24 79 52 93 80 94 45 92 50 46 2 78 42
Card 83: 33 32 63 1 19 69 29 3 64 10 | 69 43 8 32 9 67 40 23 64 20 96 27 1 42 11 19 3 10 63 33 22 29 55 6 49
Card 84: 25 47 44 53 22 60 77 89 37 67 | 99 48 44 53 60 6 9 8 22 70 37 96 50 47 25 89 11 49 67 90 29 32 77 40 66
Card 85: 30 60 57 86 93 88 18 27 48 82 | 94 10 57 86 59 88 48 52 78 29 20 41 82 77 90 87 64 6 60 81 44 51 2 68 45
Card 86: 8 29 97 92 91 69 48 82 51 67 | 40 81 10 97 57 94 7 65 84 17 96 38 5 76 98 55 39 34 88 27 12 18 3 26 9
Card 87: 29 21 65 98 26 23 40 94 90 51 | 42 53 95 94 62 75 86 55 29 49 92 21 87 37 56 40 13 68 65 23 26 98 38 31 69
Card 88: 30 79 14 43 73 41 36 83 19 17 | 3 73 70 55 99 34 90 38 26 5 85 22 81 97 66 16 24 88 2 33 21 63 96 58 41
Card 89: 81 41 29 97 76 57 30 79 25 52 | 76 37 89 90 38 17 87 46 7 93 99 54 41 62 79 43 82 95 70 61 29 58 48 12 60
Card 90: 26 94 39 29 48 22 16 98 66 64 | 52 66 61 50 45 64 80 27 5 14 68 13 58 37 7 26 39 82 16 72 33 8 48 99 88
Card 91: 87 17 19 24 64 7 45 28 36 23 | 54 16 64 83 48 49 61 31 95 66 92 15 85 41 3 82 63 67 55 57 9 68 18 32 43
Card 92: 48 41 8 81 26 60 65 73 1 88 | 39 65 51 63 69 88 25 41 3 13 66 98 18 31 73 71 86 12 10 96 6 93 20 9 82
Card 93: 79 2 21 93 97 59 62 43 83 73 | 26 9 28 84 47 46 44 2 83 5 13 95 7 4 36 35 11 10 72 82 90 65 73 98 87
Card 94: 74 86 50 28 11 2 94 47 54 77 | 1 69 35 40 22 19 16 61 66 68 28 56 29 85 10 51 83 7 50 59 92 71 9 86 67
Card 95: 96 12 56 26 91 15 64 61 82 40 | 52 14 50 70 93 83 54 42 84 19 43 80 82 25 73 3 44 45 81 5 87 41 8 16 78
Card 96: 80 38 2 91 44 92 19 43 10 64 | 11 45 21 28 31 71 23 88 93 62 17 27 7 78 33 32 54 84 5 72 15 52 63 68 91
Card 97: 32 54 71 38 5 89 28 47 75 42 | 98 34 57 25 9 80 37 71 61 62 94 6 65 13 92 84 11 2 72 90 17 67 4 1 46
Card 98: 39 57 6 68 64 91 90 51 78 10 | 56 30 1 12 62 44 21 69 53 65 84 32 96 25 94 92 38 60 14 47 77 13 71 93 20
Card 99: 6 89 48 77 90 57 21 72 87 73 | 39 48 45 73 87 79 14 25 57 72 66 89 31 30 77 50 74 6 34 36 21 23 90 10 49
Card 100: 33 40 16 54 58 60 30 47 22 6 | 31 47 30 76 48 67 33 68 22 57 54 5 16 6 58 43 3 64 55 15 40 60 77 13 4
Card 101: 19 52 71 42 34 73 35 89 62 46 | 9 73 26 49 72 14 19 46 99 32 4 88 84 10 87 17 27 89 30 98 40 7 75 78 90
Card 102: 2 79 8 73 25 16 82 47 20 52 | 71 88 82 79 2 51 52 3 54 20 56 19 69 10 97 66 45 28 36 39 47 61 40 13 42
Card 103: 77 28 11 32 36 23 39 88 76 51 | 26 36 99 55 25 19 31 42 18 66 39 11 59 46 4 74 23 71 77 16 84 58 28 32 53
Card 104: 22 90 17 19 96 62 98 55 41 49 | 90 91 74 23 98 84 77 31 81 16 41 67 49 55 56 86 22 24 73 52 99 62 93 32 34
Card 105: 41 91 2 4 18 81 52 93 89 87 | 3 47 6 77 60 24 97 26 70 19 37 36 51 82 48 21 31 99 73 88 59 15 46 35 32
Card 106: 48 54 60 39 80 50 13 61 43 51 | 24 66 90 38 10 74 28 29 89 16 5 25 2 54 15 34 70 7 44 47 14 48 69 78 13
Card 107: 10 20 81 62 85 75 4 49 58 1 | 32 89 48 79 90 96 15 59 36 14 49 55 38 34 30 11 62 28 53 72 17 77 41 80 66
Card 108: 79 94 49 89 78 71 20 7 48 56 | 11 53 35 90 22 29 4 71 48 94 70 8 72 78 27 45 7 21 49 16 55 56 73 42 81
Card 109: 32 73 98 31 4 46 57 11 40 88 | 36 40 89 47 18 87 98 48 45 84 21 1 80 33 67 32 64 28 61 3 51 10 86 97 62
Card 110: 45 51 97 87 23 48 19 50 63 55 | 19 20 15 22 27 24 38 93 55 54 98 23 28 97 82 59 73 11 8 1 18 64 50 63 48
Card 111: 38 1 49 22 26 96 3 88 24 70 | 79 58 20 74 70 80 55 68 35 77 88 3 24 40 87 53 50 47 38 54 82 26 49 7 2
Card 112: 79 90 9 20 94 36 88 31 48 42 | 25 68 69 52 24 98 76 63 97 41 67 94 61 90 32 87 18 13 75 38 84 60 64 86 89
Card 113: 7 32 6 52 76 72 39 24 46 79 | 67 19 31 94 50 26 66 11 45 80 86 68 88 22 65 3 99 12 90 79 38 14 4 73 54
Card 114: 80 54 9 2 58 26 44 63 15 21 | 5 60 76 47 87 33 89 23 4 55 17 42 62 46 97 48 90 91 95 82 34 64 30 19 31
Card 115: 51 34 88 42 20 98 75 79 39 48 | 76 94 13 58 12 66 50 72 2 89 68 21 96 25 10 45 30 7 99 15 46 59 90 9 53
Card 116: 43 32 82 89 9 63 78 57 55 77 | 19 47 23 27 70 22 18 52 28 93 36 76 80 65 21 8 67 20 84 9 12 90 92 97 5
Card 117: 71 50 45 29 32 75 10 96 82 43 | 96 46 83 47 10 11 16 39 36 3 89 9 67 5 72 53 2 27 19 7 8 24 61 37 4
Card 118: 37 44 20 31 43 47 13 46 51 39 | 8 70 7 66 48 50 18 82 84 96 73 12 6 97 62 75 17 49 26 22 4 24 54 94 61
Card 119: 36 75 46 25 47 69 95 8 94 81 | 48 91 62 11 99 10 9 7 26 15 1 79 54 45 49 27 53 78 64 65 33 31 59 17 5
Card 120: 37 96 65 31 64 95 9 55 92 29 | 71 62 77 18 86 52 33 19 8 93 30 74 17 84 59 11 69 4 41 67 76 10 66 43 38
Card 121: 39 99 21 22 11 13 61 72 49 29 | 98 79 29 42 27 73 12 40 96 13 88 45 14 18 4 36 99 80 11 22 49 23 67 21 72
Card 122: 74 88 60 36 94 18 99 55 70 16 | 91 77 18 6 93 84 97 68 45 13 63 94 14 21 31 10 65 16 61 54 70 51 30 46 36
Card 123: 67 91 97 35 11 3 8 69 81 15 | 14 45 66 15 8 29 69 24 68 67 10 59 35 18 17 53 11 3 91 12 43 72 97 81 89
Card 124: 64 61 94 18 21 17 42 80 86 43 | 25 83 69 59 57 51 87 38 91 54 56 46 4 75 99 90 73 37 20 86 49 98 21 58 81
Card 125: 51 79 20 71 43 42 46 36 77 7 | 55 46 22 24 76 86 34 95 73 36 98 63 49 43 54 28 58 10 26 62 79 97 39 60 32
Card 126: 44 51 42 27 1 84 56 38 18 91 | 27 67 1 51 42 44 19 18 73 84 16 12 56 24 91 21 97 47 99 88 90 25 6 38 65
Card 127: 85 92 63 8 17 51 43 61 52 78 | 37 81 65 43 88 97 17 79 46 51 39 23 44 78 95 2 28 49 32 85 63 84 61 8 92
Card 128: 36 40 7 30 79 76 4 37 97 27 | 97 29 30 58 84 71 4 98 78 27 6 76 43 22 37 40 36 32 7 23 70 92 53 79 48
Card 129: 98 81 33 49 20 93 32 82 39 48 | 39 65 7 78 52 87 79 53 33 60 63 81 71 93 55 92 12 30 82 32 38 27 90 95 84
Card 130: 29 59 99 28 65 42 80 87 19 85 | 87 65 59 82 28 29 64 99 79 33 9 31 19 75 53 1 20 42 97 39 72 80 8 85 63
Card 131: 88 58 37 3 66 87 67 60 84 5 | 84 86 40 82 37 16 34 55 54 70 80 65 22 77 31 48 78 11 68 18 12 52 69 17 32
Card 132: 50 23 57 31 27 1 25 2 38 21 | 52 61 75 38 15 71 90 50 76 66 22 39 99 68 13 37 78 18 87 43 63 40 53 84 2
Card 133: 3 59 60 91 93 68 65 45 86 20 | 13 32 74 8 90 68 58 94 67 38 93 97 75 2 71 20 31 37 59 30 39 44 28 34 64
Card 134: 42 6 64 28 96 55 43 58 24 40 | 36 99 10 79 2 9 42 61 84 58 35 7 77 38 85 21 64 32 78 6 96 74 89 40 55
Card 135: 38 15 49 59 73 40 13 60 41 25 | 46 80 2 60 42 59 51 57 56 27 40 62 76 37 84 16 89 18 25 73 5 22 45 70 81
Card 136: 18 17 68 43 77 76 91 13 4 79 | 11 67 10 73 23 71 8 46 87 79 5 51 58 47 62 66 24 29 55 82 93 20 80 32 42
Card 137: 60 51 99 79 67 59 66 40 25 87 | 44 53 76 5 77 75 65 90 9 41 55 22 60 23 71 30 1 86 88 15 54 66 59 13 68
Card 138: 78 65 89 48 62 88 3 12 87 99 | 11 19 39 38 69 81 12 75 17 52 26 56 29 77 91 23 93 53 50 66 15 16 85 80 71
Card 139: 34 12 48 47 25 98 32 37 21 54 | 13 62 79 43 90 72 47 11 20 82 38 29 69 10 66 35 1 84 7 52 27 42 46 91 58
Card 140: 61 27 68 51 7 58 43 89 26 59 | 2 17 44 87 36 15 6 35 57 29 62 13 56 81 40 19 53 9 85 5 10 46 64 86 88
Card 141: 40 28 9 81 37 43 18 77 83 23 | 13 59 2 31 52 30 47 6 42 89 70 69 86 92 19 93 58 49 36 8 29 99 60 63 67
Card 142: 25 6 69 2 14 44 13 93 89 95 | 13 33 76 2 14 68 95 25 18 23 44 43 89 6 93 11 4 24 9 45 38 69 36 15 17
Card 143: 3 87 14 59 7 5 69 35 20 17 | 5 16 21 69 38 50 64 97 72 30 53 77 73 13 33 55 79 70 4 10 95 59 3 41 42
Card 144: 94 63 13 51 62 72 33 9 64 22 | 11 90 13 28 47 56 10 4 93 30 7 70 33 69 62 36 72 96 24 22 71 63 52 86 73
Card 145: 76 1 41 88 97 18 10 11 52 20 | 18 11 41 1 71 52 12 94 74 44 58 70 69 73 79 97 20 45 59 76 78 88 4 10 64
Card 146: 93 1 18 44 21 66 28 60 98 9 | 13 42 18 46 28 23 96 16 12 55 70 53 98 56 64 50 15 61 25 72 24 35 8 43 97
Card 147: 67 27 79 43 7 74 11 15 64 75 | 17 57 90 7 41 36 93 29 62 14 77 5 38 33 68 70 32 13 23 6 25 30 55 45 9
Card 148: 59 62 37 5 52 53 43 29 98 2 | 33 62 93 52 29 68 43 23 11 35 87 14 76 53 59 77 4 89 48 13 2 15 49 72 99
Card 149: 38 74 24 93 50 21 19 65 95 5 | 93 82 57 95 67 11 9 55 5 74 46 2 96 19 21 92 56 14 38 33 77 58 32 43 37
Card 150: 8 99 26 38 47 48 96 20 82 92 | 80 46 13 97 66 22 40 36 85 73 63 32 1 70 49 60 90 88 43 2 48 5 76 34 50
Card 151: 41 69 32 12 5 72 3 29 2 79 | 28 41 11 64 69 71 3 87 45 40 5 15 50 95 90 53 19 55 26 98 82 12 6 77 14
Card 152: 96 20 94 19 7 68 24 56 88 97 | 54 70 63 84 26 73 35 24 39 99 6 79 44 20 64 12 38 87 1 43 46 42 11 60 8
Card 153: 60 9 99 62 93 22 16 11 34 28 | 57 43 38 98 82 89 20 58 71 40 79 53 86 1 69 4 27 19 36 85 83 33 59 90 96
Card 154: 45 75 27 11 76 24 1 4 21 99 | 96 51 54 55 78 69 24 31 77 18 92 17 89 86 3 11 19 15 88 64 49 47 68 36 14
Card 155: 97 56 99 89 82 6 17 15 52 29 | 23 26 85 70 13 47 72 1 51 64 90 44 53 45 42 77 88 32 74 25 58 68 37 21 79
Card 156: 28 78 54 72 36 25 84 47 87 30 | 75 49 44 5 83 48 16 17 82 33 60 15 12 94 41 66 23 51 43 39 6 55 34 77 32
Card 157: 44 74 36 93 15 96 25 12 19 40 | 84 44 54 96 80 48 59 79 78 55 42 27 11 69 76 19 93 2 35 83 77 43 40 85 99
Card 158: 74 73 99 41 17 45 92 80 21 85 | 85 51 97 91 69 81 74 73 88 80 28 14 6 95 99 92 50 29 17 5 77 89 76 21 41
Card 159: 7 2 83 33 51 95 96 18 75 52 | 52 96 21 27 47 98 51 83 29 77 75 53 2 64 7 33 57 82 50 14 95 34 79 44 18
Card 160: 46 54 7 84 37 42 60 9 47 10 | 84 34 9 85 24 29 80 8 88 10 1 46 43 59 47 76 81 26 68 60 30 42 7 56 37
Card 161: 18 88 61 65 90 29 1 20 22 25 | 25 84 28 2 45 61 39 71 35 32 16 18 65 1 29 23 49 5 22 83 78 24 20 88 90
Card 162: 78 93 50 17 75 29 69 31 65 85 | 31 18 45 12 28 85 65 69 81 15 32 64 22 40 33 23 50 17 29 97 7 37 63 93 78
Card 163: 66 47 30 99 34 45 60 82 72 43 | 73 98 29 36 35 54 49 61 17 1 52 95 81 56 31 27 15 96 24 20 32 33 65 55 82
Card 164: 45 23 93 75 49 1 3 12 36 67 | 77 79 15 82 12 93 49 23 45 31 8 62 66 75 32 48 6 30 78 67 64 3 36 1 94
Card 165: 75 62 57 30 69 52 35 84 17 32 | 9 17 46 33 69 29 35 34 84 55 57 83 56 70 10 7 30 75 27 99 52 62 32 47 77
Card 166: 2 79 15 96 51 77 38 98 36 74 | 1 54 12 73 39 75 87 24 49 74 43 53 56 16 34 99 26 30 50 40 86 94 35 66 65
Card 167: 41 77 3 17 78 56 92 33 87 52 | 98 37 44 68 43 53 76 13 74 59 49 71 66 90 54 82 46 5 95 16 15 62 96 58 25
Card 168: 23 61 30 69 41 58 21 49 97 16 | 26 74 24 40 58 30 20 38 34 87 72 46 15 77 50 2 57 1 75 81 84 70 23 69 11
Card 169: 9 17 32 25 1 65 22 46 8 99 | 84 19 66 27 28 15 34 90 42 2 43 87 78 6 81 46 24 13 63 3 48 20 86 70 73
Card 170: 32 86 96 77 56 40 66 46 89 2 | 87 1 50 91 59 96 29 70 92 93 33 10 20 45 12 60 63 21 14 54 36 80 56 19 75
Card 171: 70 36 51 80 5 24 40 87 72 30 | 30 52 71 81 84 97 22 95 72 53 46 55 44 51 24 19 98 63 73 56 6 80 90 59 77
Card 172: 97 74 79 52 85 56 40 2 30 54 | 66 40 49 94 16 47 57 85 24 45 53 63 51 74 69 38 46 90 50 91 75 97 28 31 62
Card 173: 72 49 45 75 23 20 90 50 48 94 | 38 34 28 33 91 65 87 19 37 30 9 18 64 14 53 70 49 39 90 79 88 51 12 57 48
Card 174: 48 39 78 41 80 49 43 87 61 22 | 68 39 65 84 67 79 10 29 78 81 36 73 62 6 44 72 27 1 19 66 93 4 16 46 50
Card 175: 96 91 10 82 43 98 30 65 3 83 | 49 77 40 78 70 23 52 34 16 2 64 72 69 61 15 33 79 32 39 74 7 92 24 46 36
Card 176: 29 21 33 68 60 35 11 99 82 61 | 81 13 97 71 32 40 23 36 59 53 66 54 62 47 89 93 44 33 87 55 26 18 31 64 67
Card 177: 97 45 62 55 76 34 66 54 14 68 | 94 42 28 30 32 58 33 48 46 80 7 15 92 98 95 81 90 17 71 24 26 16 39 13 93
Card 178: 99 45 47 89 4 17 36 14 86 96 | 40 33 56 89 17 93 94 45 75 4 5 99 37 36 47 98 70 44 86 65 14 73 96 8 22
Card 179: 30 63 6 25 4 85 41 17 83 11 | 44 92 25 71 95 61 50 11 27 4 6 30 9 85 63 67 87 13 17 83 18 53 41 10 52
Card 180: 70 89 32 66 15 30 76 8 42 36 | 36 16 89 13 45 42 31 77 76 30 71 27 8 95 98 32 35 14 66 70 26 85 72 33 15
Card 181: 74 81 12 28 22 21 14 54 3 5 | 32 59 69 67 15 35 42 12 34 11 5 71 79 2 73 14 55 87 56 65 28 17 30 99 9
Card 182: 79 41 90 19 21 15 66 2 55 59 | 2 93 34 65 67 63 72 79 15 5 59 14 55 95 70 83 90 21 68 66 19 7 41 92 3
Card 183: 6 8 44 39 74 78 10 2 61 59 | 6 61 75 44 62 92 77 29 8 39 78 20 73 18 68 4 60 66 74 59 49 3 2 5 10
Card 184: 68 32 10 82 15 95 56 89 28 42 | 25 56 28 73 6 11 43 37 95 2 70 18 19 90 45 89 26 42 10 32 7 98 82 15 68
Card 185: 66 74 17 3 71 21 51 28 14 48 | 80 34 77 37 45 74 84 20 44 14 31 66 51 48 17 86 12 43 71 56 35 13 4 93 27
Card 186: 79 33 25 28 86 18 57 7 76 40 | 26 16 59 99 31 62 77 21 23 70 7 25 35 49 81 18 72 45 65 58 86 51 88 80 76
Card 187: 1 2 73 43 13 64 69 21 3 46 | 65 37 53 92 82 13 12 28 3 58 71 46 64 1 56 19 98 21 73 43 60 2 57 29 69
Card 188: 85 77 35 15 22 67 79 18 66 99 | 42 46 93 19 28 4 89 32 95 75 11 57 6 40 39 30 22 43 41 24 8 78 58 69 48
Card 189: 13 48 6 61 55 38 75 96 76 42 | 42 32 61 81 55 13 26 41 9 77 70 68 56 35 58 89 20 75 6 72 91 38 90 93 96
Card 190: 19 78 50 35 32 14 45 70 16 77 | 32 92 71 86 75 77 9 8 19 68 16 6 67 33 15 78 43 57 55 85 69 35 73 50 14
Card 191: 71 62 7 72 70 4 89 95 94 59 | 36 94 40 6 71 59 45 28 90 12 89 95 16 85 83 88 4 48 72 62 76 7 13 70 11
Card 192: 52 15 61 83 18 67 29 75 34 36 | 8 65 43 93 67 53 88 83 52 75 81 37 49 29 6 39 76 91 92 36 19 98 50 41 33
Card 193: 78 94 7 48 25 16 91 38 13 5 | 22 77 76 84 17 40 41 36 93 56 50 35 64 59 23 95 89 49 61 30 42 85 37 92 44
Card 194: 66 92 16 37 42 62 86 76 98 36 | 46 60 34 31 79 40 11 19 16 74 75 36 71 43 13 2 90 76 50 29 85 55 54 10 35
Card 195: 66 23 45 62 30 95 38 5 97 39 | 96 65 37 89 95 73 69 75 25 45 51 22 62 7 33 13 94 78 34 35 36 56 55 70 24
Card 196: 15 45 70 41 97 27 80 64 25 28 | 88 93 65 83 36 16 35 92 6 71 82 24 17 64 66 33 37 69 78 60 56 49 91 19 61
Card 197: 46 35 2 60 75 99 6 42 47 21 | 91 93 70 8 46 6 35 50 55 72 71 64 47 82 39 94 25 67 41 60 86 83 87 90 7
Card 198: 71 62 73 96 79 63 41 17 56 68 | 95 77 16 70 29 68 66 63 98 80 20 18 31 34 52 5 42 22 49 6 25 38 51 75 50
Card 199: 70 84 46 98 44 45 16 36 29 99 | 78 21 92 77 32 91 22 90 76 74 42 55 51 69 94 64 26 65 41 97 10 34 15 35 9
Card 200: 96 60 87 21 80 48 44 69 3 49 | 2 65 66 94 55 62 72 52 86 15 30 71 45 82 49 47 81 33 14 42 4 1 51 75 34
Card 201: 55 53 33 19 1 70 17 61 2 72 | 62 6 30 86 45 71 46 33 15 90 73 37 18 12 68 87 89 49 8 60 52 22 51 25 74
Card 202: 5 47 96 53 54 14 77 29 12 3 | 26 71 91 86 59 70 78 8 83 92 35 64 9 79 84 34 36 93 90 40 16 44 51 6 4

51
5.js Normal file
View file

@ -0,0 +1,51 @@
//import { loadFile } from "std";
//var data = loadFile("5.txt").trim();
var data = await Deno.readTextFile("5.txt");
data = data.trim();
var getnums = function(w) { return w.match(/\d+/g).map(x => Number(x)); }
var seeds = getnums(data.split('\n')[0]);
var maps = data.split('\n\n').slice(1).map(g => g.split('\n').slice(1).map(x => getnums(x)));
maps = maps.map(m => m.sort(function(a,b) {
if (a[0] > b[0]) return 1;
if (a[0] < b[0]) return -1;
return 0;
}));
console.log(maps);
var loc = 0;
seeds.forEach(function(d) {
maps.forEach(function(map) {
var r = map.find(x => d >= x[1] && d <= x[1]+x[2]);
if (r) d += (r[0]-r[1]);
});
loc = Math.min(loc,d) || d;
});
console.log(loc);
var seedpairs = [];
for (var i = 0; i < 10; i++)
seedpairs.push([seeds[i*2], seeds[i*2+1]]);
function in_seed(d)
{
return seedpairs.some(function(x) {
return (d >= x[0] && d <= x[0]+x[1]);
});
}
maps.reverse();
for (var i = 0; i >= 0; i++) {
var d = i;
maps.forEach(function(m) {
var r = m.find(r => d >= r[0] && d <= r[0] + r[2]);
if (r) d += (r[1]-r[0]);
});
if (in_seed(d)) {
console.log(`location ${i}`);
break;
}
}

33
5.test Normal file
View file

@ -0,0 +1,33 @@
seeds: 79 14 55 13
seed-to-soil map:
50 98 2
52 50 48
soil-to-fertilizer map:
0 15 37
37 52 2
39 0 15
fertilizer-to-water map:
49 53 8
0 11 42
42 0 7
57 7 4
water-to-light map:
88 18 7
18 25 70
light-to-temperature map:
45 77 23
81 45 19
68 64 13
temperature-to-humidity map:
0 69 1
1 0 69
humidity-to-location map:
60 56 37
56 93 4

193
5.txt Normal file
View file

@ -0,0 +1,193 @@
seeds: 2276375722 160148132 3424292843 82110297 1692203766 342813967 3289792522 103516087 2590548294 590357761 1365412380 80084180 3574751516 584781136 4207087048 36194356 1515742281 174009980 6434225 291842774
seed-to-soil map:
4170452318 3837406401 124514978
2212408060 1593776674 105988696
3837406401 4016132523 278834773
1475766470 1699765370 492158296
3698488336 1475766470 118010204
2318396756 2191923666 46351359
4116241174 3961921379 54211144
2193579298 3791037069 18828762
2364748115 2578360543 354997036
3085506703 3439828590 106510622
1967924766 3546339212 219021823
2719745151 3765361035 25676034
2745421185 2238275025 340085518
2186946589 3809865831 6632709
3192017325 2933357579 506471011
soil-to-fertilizer map:
2067774073 3521970321 52706909
3338663639 285713733 377282283
4175452431 2125409520 119514865
3950920796 1900877885 224531635
285713733 3604616580 690350716
976064449 3368036703 153933618
2120480982 662996016 210956413
2763248642 1355402238 545475647
3715945922 873952429 49638562
3765584484 3182700391 185336312
2331437395 923590991 431811247
1129998067 2244924385 937776006
3308724289 3574677230 29939350
fertilizer-to-water map:
1898912715 0 159034880
0 781591504 125461131
4234890433 2427770485 8749678
176481534 1845116986 384152450
822014814 539693831 241897673
125461131 907052635 47763268
1476125220 244008638 19613711
3828547378 4170474998 124492298
2643114268 2457193301 126243103
173224399 2229269436 3257135
2916187764 3376015556 236473226
764735505 186729329 57279309
2427770485 3802085897 160735547
2895514626 2436520163 20673138
3152660990 2671736916 584987016
1495738931 1131222975 403173784
1339983969 1534396759 136141251
2588506032 3612488782 54608236
3737648006 2583436404 88300512
737041056 159034880 27694449
2057947595 1677521625 167595361
1063912487 263622349 276071482
3953039676 4041226796 129248202
2225542956 1670538010 6983615
560633984 954815903 176407072
2847762723 3328263653 47751903
2769357371 3962821444 78405352
3825948518 3256723932 2598860
4082287878 3667097018 134988879
4243640111 3276936468 51327185
4217276757 3259322792 17613676
water-to-light map:
527906959 2908176499 284796856
1306013866 0 139756297
500839409 1466481782 27067550
1269694476 139756297 36319390
0 778456518 2402633
4218077327 4154765934 76889969
812703815 4004150799 56130996
153843304 3657154694 8975056
2402633 905946004 132694584
3795108796 2776082693 132093806
3927202602 1422228955 44252827
1445770163 1493549332 1282533361
3794865694 780859151 243102
2728303524 176075687 602380831
162818360 3666129750 338021049
3330684355 3319846298 337308396
4154765934 4231655903 63311393
135097217 887199917 18746087
3667992751 3192973355 126872943
3971455429 781102253 88826366
1252423178 869928619 17271298
868834811 1038640588 383588367
light-to-temperature map:
2621973104 3678827401 230150807
1333642604 1531317439 615453278
3364444750 2854318675 314483239
2978187907 3908978208 107198609
1117308885 1110453605 216333719
1951157390 4016176817 152726483
4168382203 2717095112 26843204
0 312822387 5553076
287414983 245463475 67358912
1949095882 2597527252 2061508
3836867339 1522015715 9301724
648138229 2599588760 117506352
4132690450 1486323962 35691753
2852123911 4168903300 126063996
2468610361 3525464658 153362743
526108840 988424216 122029389
5553076 0 148736111
3265904462 1326787324 98540288
4195225407 716774234 17303853
181751976 318375463 105663007
843084177 3275513023 249951635
2214264232 734078087 254346129
154289187 218000686 27462789
3146382866 684048190 32726044
765644581 2433292104 77439596
3179108910 2510731700 86795552
3846169063 2146770717 286521387
2103883873 2743938316 110380359
3085386516 1425327612 60996350
3678927989 526108840 157939350
4212529260 3193074987 82438036
354773895 148736111 69264575
1093035812 3168801914 24273073
temperature-to-humidity map:
1008510114 1939290935 27755995
2205283444 4197517502 16218189
1119061522 3123774174 108864966
1566495924 221087407 33939034
3089618547 3728555042 25452278
2341294643 3455988869 16076350
2286651827 3754007320 54642816
704748216 2542375745 76754089
445299830 3938069116 259448386
1036266109 1300576315 82795413
178337856 1565003866 40230920
2122934367 1605234786 81339593
1484902828 980285858 81593096
2823460240 1967046930 266158307
3827446421 1526750766 38253100
984919715 1161567987 23590399
218568776 1061878954 99689033
4049237602 3232639140 223349729
953670836 2233205237 3881060
318257809 3472065219 89705062
1727156113 3113814046 9960128
3733360236 444372828 94086185
4272587331 3688491436 22379965
910921285 178337856 42749551
781502305 3808650136 129418980
957551896 2798966448 27367819
1870217811 1686574379 252716556
407962871 2998327877 37336959
2508087592 2826334267 171993610
1600434958 3561770281 126721155
3865699521 812829188 167456670
1737116241 1185158386 115417929
1852534170 3710871401 17683641
3420360273 255026441 38629788
1227926488 2620139318 178827130
4033156191 4250190027 16081411
2204273960 2619129834 1009484
2250197491 4213735691 36454336
2680081202 1383371728 143379038
3458990061 538459013 274370175
3115070825 2237086297 305289448
2357370993 293656229 150716599
1406753618 3035664836 78149210
2221501633 4266271438 28695858
humidity-to-location map:
2849843584 4147982382 56632112
3849085050 3618212322 355529444
1632881348 407047779 65646492
3056274757 2246063521 686771203
2729873863 4028012661 26534599
3779070915 1543896540 70014135
2571854216 2932834724 91402738
2192942437 1028113266 378911779
2960746591 932585100 95528166
765942740 0 407047779
2663256954 1441254676 66616909
2756408462 4054547260 93435122
1698527840 1407025045 34229631
0 3024237462 156854744
3743045960 1507871585 36024955
156854744 3181092206 437120116
1172990519 472694271 459890829
2906475696 3973741766 54270895
593974860 2074095641 171967880
1732757471 1613910675 460184966

32
6.js Normal file
View file

@ -0,0 +1,32 @@
import { loadFile } from "std";
var data = loadFile("6.txt").split('\n');
/* d = xt-x^2 */
var times = data[0].match(/\d+/g);
var dist = data[1].match(/\d+/g);
var count = [0,0,0,0];
for (var i = 0; i < 4; i++) {
for (var x = 0; x < times[i]; x++) {
var d = x*times[i] - (x*x);
if (d > dist[i]) count[i]++;
}
}
console.log("Part 1:");
console.log(count.reduce((a,x) => a*x));
times = times.map(t => String(t));
dist = dist.map(d => String(d));
var bigtime = Number(times.reduce((a,t) => a+t));
var bigdist = Number(dist.reduce((a,d) => a+d));
/* 212206012011044 = x(35937366)-x^2; */
function solve(a,b,c) {
var r1 = (-1*b + Math.sqrt(Math.pow(b,2) - (4*a*c)))/(2*a);
var r2 = (-1*b - Math.sqrt(Math.pow(b,2) - (4*a*c)))/(2*a);
return [r1,r2];
}
var roots = solve(-1,bigtime, -bigdist).map(x => Math.ceil(x));
console.log("Part 2:");
console.log(roots[1]-roots[0]);

2
6.txt Normal file
View file

@ -0,0 +1,2 @@
Time: 35 93 73 66
Distance: 212 2060 1201 1044

62
7.js Normal file
View file

@ -0,0 +1,62 @@
import { loadFile } from "std";
var datafile = "7.txt";
var rawdata = loadFile(datafile).trim().split('\n');
var findindex = function(array, fn) {
for (var i = 0; i < array.length; i++)
if (fn(array[i])) return i;
}
var matchval = [0,0,1,2.2,3.5,4];
function hand_strn(hand, jokers)
{
var vals = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
var match = [0,0,0,0,0,0];
hand.forEach(x => vals[x]++);
if (!jokers)
vals.forEach(x => match[x]++);
else {
var j_applied = false;
for (var i = match.length; i > 0; i--)
if (match[i]) {
match[i]--;
match[i+vals[0]]++;
j_applied = true;
break;
}
if (!j_applied) match[vals[0]]++;
}
var type = 0;
match.forEach((x,i) => type += matchval[i]*x);
return type;
}
function handsort(a,b) {
if (a[2] > b[2]) return 1;
if (a[2] < b[2]) return -1;
for (var i = 0; i < a[0].length; i++) {
if (a[0][i] > b[0][i]) return 1;
if (a[0][i] < b[0][i]) return -1;
}
}
var vals = ['2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K', 'A'];
var data = rawdata.map(d => d.split(' ')).map(d => [d[0].split("").map(l => findindex(vals, v=>v===l)), d[1]]);
data.forEach(d => d.push(hand_strn(d[0],false)));
data.sort((a,b) => handsort(a,b));
var total = data.reduce((a,c,i) => a + c[1]*(i+1));
console.log("Part 1:");
console.log(total);
vals = ['J', '2', '3', '4', '5', '6', '7', '8', '9', 'T', 'Q', 'K', 'A'];
data = rawdata.map(d => d.split(' ')).map(d => [d[0].split("").map(l => findindex(vals, v=>v===l)), d[1]]);
data.forEach(d => d.push(hand_strn(d[0], true)));
data.sort((a,b) => handsort(a,b));
var total = data.reduce((a,c,i) => a + c[1]*(i+1));
console.log("Part 2:");
console.log(total);

5
7.test Normal file
View file

@ -0,0 +1,5 @@
32T3K 765
T55J5 684
KK677 28
KTJJT 220
QQQJA 483

1000
7.txt Normal file

File diff suppressed because it is too large Load diff

56
8.js Normal file
View file

@ -0,0 +1,56 @@
import { loadFile } from "std";
var datafile = "8.txt";
var rawdata = loadFile(datafile).trim().split('\n').filter(x=>x);
var dirs = rawdata[0];
var nodes = {};
for (var i = 1; i < rawdata.length; i++) {
var e = rawdata[i].match(/[A-Z]+/g);
nodes[e[0]] = {
L: e[1],
R: e[2]
}
}
var n = 'AAA';
var i = 0;
var c = 0;
while (n !== 'ZZZ') {
n = nodes[n][dirs[i++]];
c++;
if (i === dirs.length) i = 0;
}
console.log("Part 1");
console.log(c);
var As = Object.keys(nodes).filter(x => x[2] === 'A').map(a => { return { node: a }; });
var i = 0;
var c = 0;
while (!As.every(a => a.period)) {
c++;
As.forEach(a => a.node = nodes[a.node][dirs[i]]);
As.forEach(a => {
if (a.node[2] === 'Z') a.period = c;
});
i++;
if (i === dirs.length) i = 0;
}
console.log("Part 2:");
console.log(JSON.stringify(As));
var gcd = function(a,b) { return b === 0 ? a : gcd(b, a%b); }
var lcm = function(a,b) { return (a*b) / gcd(a,b) }
var l = As[0].period;
for (var i = 1; i < As.length; i++)
l = lcm(l,As[i].period);
console.log(l);

788
8.txt Normal file
View file

@ -0,0 +1,788 @@
LRRLRRRLRLRLLRRLRLRLLRLRLRLLLLRRRLLRRRLRRRLRRRLLRLLRLRRLRLRLRRRLLLLRRLRLRRLRRLLRRRLRRLRLRRLRRLRRLRRLRLLRRLRRLLLLRLRLRRLLRRLLRRLRLLRLRRLRRLRRLRRRLRRLLLRRLRRRLRLRRRLLRLRRLRRRLRRLLRRRLRRLRLLRRLLRRLRRLRRRLRRLLRRLRRRLRLRLRLRLRLRRLRRLLRRRLRLRRLRRRLRLRLRLRLRLRRRLRRLRRRLLRRLRLLRRRLRRLRLLLLRRRLRRLRRRR
DRM = (DLQ, BGR)
PKD = (TNC, DKH)
FSM = (LKS, KPG)
NDS = (KGD, HNX)
KQQ = (DPF, GKD)
SBX = (DDL, MGH)
GCV = (KMG, GLP)
PCT = (JXN, XDR)
KHR = (QPK, FPQ)
FCK = (GLS, GGP)
MKR = (XPQ, TJX)
PFP = (RPR, LPS)
XPC = (SSS, FRX)
PTJ = (LSC, CND)
GVJ = (NRL, SHV)
QNF = (MBQ, GSR)
TMK = (DVM, BJM)
KTG = (QVG, LLX)
JMK = (BKF, XDK)
JQV = (DCM, RLT)
VFH = (FDD, GML)
XPN = (FKG, CXG)
GDX = (GRV, BPP)
GVP = (JLP, XNJ)
TCB = (RVR, QXQ)
DLP = (XDK, BKF)
FQG = (RMH, QHR)
XDD = (SMK, HMN)
TLL = (TVV, FXX)
NPT = (NGC, FQM)
XQK = (PQG, QTK)
DMQ = (RVS, KNQ)
QKR = (SJD, PLH)
XNV = (SJB, GCV)
SRP = (CDK, JFK)
FRP = (FFD, XPC)
PVC = (XVD, MGD)
DPP = (BFQ, XDD)
CNV = (LQC, JJH)
LLH = (CFP, BGF)
XCK = (VDX, GFC)
KGD = (LSF, FNK)
MJA = (FXB, QVX)
QLH = (KRM, KVD)
QCR = (TKN, RNB)
PSR = (FBL, HKJ)
MGK = (BVC, HVL)
PVK = (JRN, SMV)
JTD = (VNS, FGJ)
PMD = (HGN, NBM)
DRF = (CPR, RTX)
HJL = (CBR, VDR)
PPB = (GDX, DXB)
DVR = (LLT, GVJ)
JRN = (RLD, RSL)
NXM = (RBN, NVD)
RLV = (FRM, FJB)
SJB = (KMG, GLP)
KJM = (XJH, LQX)
GRB = (HHL, RGD)
LQC = (BMC, XSH)
NRB = (NQD, RFT)
SQH = (QJT, JXX)
JLX = (RJL, HHH)
HVR = (XPN, JFM)
FVD = (RXS, RHH)
KSX = (TCB, GDK)
GKJ = (TQF, HQJ)
HQL = (BMR, PBX)
QFP = (NJM, FSB)
TPH = (NXT, RKN)
SRL = (LSP, LFV)
SDL = (MGL, PSK)
MFX = (FSM, LQF)
RFT = (FLV, GMS)
BTG = (DRS, PVC)
HLR = (DSB, DPP)
DXB = (BPP, GRV)
NHS = (HQG, GVP)
GKK = (DCM, RLT)
MJT = (JNR, PGC)
KDS = (FFD, XPC)
TSS = (BGX, QQX)
FKC = (NBN, SJP)
HHQ = (GVP, HQG)
JKF = (QRR, GFD)
CXG = (SDD, TMN)
GCG = (TCC, TDT)
NQX = (DMQ, DPM)
GHX = (BJQ, CHJ)
JQC = (HNQ, RJF)
QBB = (GNH, XSC)
BJG = (VMH, FCN)
VMS = (KRX, VLQ)
GSF = (NQM, KBH)
JQQ = (PKD, GNB)
KFG = (BGX, QQX)
TTV = (SNB, JQF)
CXJ = (CND, LSC)
GGP = (PBH, XNG)
FCV = (NLP, QJK)
NSB = (KSX, SLL)
JBH = (RGK, NSS)
CQH = (HJL, FKR)
VRX = (HKJ, FBL)
HJZ = (QVX, FXB)
RLD = (BJP, RLV)
HHH = (PNJ, HPJ)
LSC = (NRP, DCF)
BVM = (RCG, QLL)
KGN = (PRB, MLT)
NTV = (MRQ, NHQ)
VXT = (VFH, MBX)
RLG = (MJQ, RNL)
JVX = (HJQ, FNV)
XGH = (HHK, JXT)
NHC = (HPX, LGG)
VPC = (XCL, HPQ)
HKJ = (RQC, TMK)
PGQ = (FTX, MNP)
MPF = (KNM, BJG)
MFT = (DRS, PVC)
XNG = (RCS, JNH)
RMH = (GHD, MPF)
PFM = (PGQ, XHJ)
TRN = (TCP, TCP)
NHP = (JMG, VGP)
JSK = (JBG, PVM)
FSB = (MGK, HTD)
BPR = (VFH, MBX)
RHM = (LHD, PTF)
PRV = (RJL, HHH)
GNC = (HVR, PSV)
PSV = (JFM, XPN)
KMG = (KDR, RTV)
RKL = (DPP, DSB)
GLN = (QJT, JXX)
FNK = (XXP, QDR)
JDP = (HVR, PSV)
HHD = (VPC, MDS)
XHJ = (MNP, FTX)
XVJ = (RGG, BCB)
DRH = (CDK, JFK)
BMC = (TTQ, KHR)
TCT = (JQD, QBB)
BCS = (HLV, MKR)
LFV = (GTL, NSX)
JCS = (JQC, NDG)
SBJ = (PHS, QMN)
HPZ = (DQD, PFP)
BFM = (PMD, JGB)
QBL = (KVC, TXK)
RGD = (NXH, KQQ)
PBX = (LBP, FPK)
FDD = (TCX, CSN)
RJT = (CQG, JSQ)
BMR = (FPK, LBP)
RBN = (DRF, VJB)
PHB = (NXR, LPM)
BPN = (PPX, PPX)
KVC = (NSF, TQK)
PXB = (GJH, JHM)
BCB = (NTR, KKB)
KXM = (NHS, HHQ)
VTT = (NCB, HCR)
SHP = (LQX, XJH)
RCG = (CLL, TCT)
LHG = (GSF, PRJ)
XCL = (JLX, PRV)
LXB = (RHH, RXS)
FKZ = (TJS, BJB)
NNH = (CFD, XMX)
NTD = (NCX, PVK)
DCF = (JHJ, VMN)
GJH = (JTD, CJD)
VBS = (CDQ, LFQ)
MGL = (GGB, QNN)
TXK = (NSF, TQK)
HRX = (QFP, BJR)
GMS = (GKJ, TNF)
RGA = (PFP, DQD)
KTS = (GSF, PRJ)
TPP = (VPC, MDS)
JNV = (BHV, XQK)
DXL = (HDP, KTG)
MBR = (GRS, GTG)
KVJ = (LPH, NGG)
HRG = (RNL, MJQ)
XHL = (JXF, FVH)
MMC = (FHM, HNF)
HGC = (SHT, HBF)
LPS = (NTV, CGR)
FKR = (CBR, VDR)
BHV = (PQG, QTK)
BKF = (SRP, DRH)
JMA = (BJB, TJS)
MPT = (HRX, VSD)
QHL = (NRB, HJG)
PDG = (KJM, SHP)
HFT = (HHQ, NHS)
SJD = (GPM, PPB)
NSF = (NRX, SRL)
MXG = (JVJ, BMF)
PHD = (BQK, VKV)
VBH = (TXK, KVC)
NJM = (HTD, MGK)
TVV = (LLH, HFB)
RPS = (GGQ, SNK)
HPR = (LJS, DJR)
FDR = (QKT, GRX)
LLT = (SHV, NRL)
VQC = (DPM, DMQ)
MJQ = (CLD, FCV)
BFG = (GJH, JHM)
GFS = (PMP, VXL)
LBP = (HRF, GRB)
BXC = (MFS, NRM)
CFD = (QMQ, HPR)
HPN = (JQC, NDG)
BBJ = (JTL, QQK)
VVL = (CDN, STB)
HFB = (CFP, BGF)
NNG = (XVP, CQH)
QKM = (KDS, FRP)
VJB = (CPR, RTX)
KQB = (XCK, BSF)
LKS = (LDJ, MXG)
GTL = (FVD, LXB)
PJS = (BGV, MLM)
KNM = (FCN, VMH)
FCN = (VGR, KHV)
RPJ = (XKD, BPM)
GLP = (KDR, RTV)
NXL = (VTS, SDL)
XDX = (MPT, FXH)
KRX = (DCD, DHH)
CTP = (CRQ, DPL)
SRG = (SKH, SLF)
QVX = (NDC, NPL)
XVK = (SNB, JQF)
RBT = (NSD, SBJ)
RXS = (FKC, JSS)
SFX = (PRB, MLT)
SRS = (FVH, JXF)
NRL = (RLG, HRG)
QKK = (PBX, BMR)
DPL = (PTQ, DBH)
PFD = (JQV, GKK)
VGR = (KMX, DVR)
FQX = (LHD, PTF)
LXT = (RHM, FQX)
JHV = (MBR, PHJ)
JNN = (VKG, SLT)
XDK = (DRH, SRP)
JBR = (BDR, GFS)
BNM = (VKG, SLT)
CJD = (VNS, FGJ)
FPK = (HRF, GRB)
PBH = (JNH, RCS)
FGV = (FDR, TMD)
LSF = (XXP, QDR)
RBM = (VHG, BDL)
TNF = (HQJ, TQF)
TRM = (JHT, BCG)
GBH = (XMJ, JFF)
DBH = (DSS, RQL)
PGB = (BXR, DXL)
QFR = (TDT, TCC)
HHL = (NXH, KQQ)
HGN = (BFG, PXB)
PXC = (BPN, BPN)
NDF = (VQC, NQX)
GSK = (BVV, SBX)
TCM = (VBS, HCN)
HTD = (BVC, HVL)
SHD = (MHG, HNG)
LQX = (QVF, LBV)
MSF = (FDF, VLP)
NRP = (VMN, JHJ)
TQF = (BXC, JCR)
MBX = (GML, FDD)
JCR = (MFS, NRM)
NTR = (PCN, RNT)
JHJ = (XMT, NPT)
SQX = (CDN, STB)
CSN = (GBJ, PGB)
GDJ = (GBM, GCJ)
XGL = (HJQ, FNV)
PLD = (BFL, BFL)
NRX = (LFV, LSP)
TFF = (HGQ, MJT)
JVJ = (TMS, HPK)
BSF = (VDX, GFC)
GML = (CSN, TCX)
BFJ = (GFD, QRR)
FGJ = (PGF, VMS)
TQK = (SRL, NRX)
GQD = (MDD, HLQ)
TJX = (XCG, DJH)
GRR = (LPM, NXR)
PTQ = (DSS, DSS)
HHK = (KLD, NNG)
FBR = (KXM, HFT)
RLT = (JMK, DLP)
PHL = (QHR, RMH)
DVM = (JTP, KDM)
MNF = (RPJ, RMF)
RMF = (BPM, XKD)
GGQ = (MFT, BTG)
CLD = (NLP, QJK)
NMR = (FNL, LXT)
CLX = (TRP, GMD)
QMQ = (DJR, LJS)
KDR = (PKC, NRF)
KKG = (VHG, BDL)
FBQ = (TPP, HHD)
QVV = (LNR, GSK)
VKV = (MFX, FDL)
HJG = (NQD, RFT)
XVD = (VXT, BPR)
NCX = (SMV, JRN)
QLN = (CDJ, TDK)
GFC = (CKR, LNC)
HGQ = (JNR, PGC)
NDG = (RJF, HNQ)
CBC = (NSD, SBJ)
BQK = (FDL, MFX)
VGV = (HGC, TQG)
VGP = (RJT, KPK)
VMN = (XMT, NPT)
PSH = (NSS, RGK)
PPL = (FXH, MPT)
DCD = (SBR, DTS)
MDD = (MQX, FQT)
XCG = (XVK, TTV)
LFQ = (SNS, VBL)
JHT = (FMN, HMC)
KNQ = (QKM, DPS)
PVM = (CHL, GLT)
JMG = (KPK, RJT)
XKD = (GQJ, NXL)
DGG = (CCB, CQX)
HNF = (MNC, FKZ)
QTL = (PSH, JBH)
RNL = (CLD, FCV)
BDR = (PMP, VXL)
GKH = (KXM, HFT)
RQC = (DVM, BJM)
GSR = (PPL, XDX)
JQD = (GNH, XSC)
GRS = (RTN, MPH)
BPP = (GBH, KQX)
XVP = (HJL, FKR)
PKZ = (NMR, KJK)
SLT = (BVM, KMJ)
XHA = (KJK, NMR)
BQQ = (FDR, TMD)
GGC = (CXJ, PTJ)
NBM = (PXB, BFG)
RQL = (BBH, NLT)
KJK = (FNL, LXT)
PSK = (GGB, QNN)
FQT = (DRL, NDS)
SJT = (VQC, NQX)
QHT = (GFS, BDR)
QJT = (PJS, DNG)
SVT = (PDG, GSS)
MBQ = (PPL, XDX)
VHL = (PVM, JBG)
QCJ = (JKK, JSR)
NQH = (LKQ, FBG)
XNJ = (QNF, LPL)
PQV = (CKJ, JHV)
FHM = (MNC, MNC)
FPN = (DLQ, BGR)
BJR = (NJM, FSB)
HPQ = (PRV, JLX)
KMJ = (QLL, RCG)
FTX = (TSM, PDR)
JXT = (KLD, NNG)
DPS = (KDS, FRP)
KKB = (RNT, PCN)
XCB = (TDM, HXC)
TCP = (PFP, DQD)
CDK = (NDF, SJT)
HCR = (HSP, PFD)
SNK = (BTG, MFT)
TKN = (QTL, HPL)
GSS = (KJM, SHP)
NRF = (SVT, RGV)
FLV = (GKJ, TNF)
QPK = (FPN, DRM)
RNB = (QTL, HPL)
HPJ = (XGL, JVX)
NSD = (QMN, PHS)
JXF = (DQV, XPX)
PRJ = (KBH, NQM)
XMT = (NGC, FQM)
JLP = (QNF, LPL)
RND = (HLV, MKR)
QRR = (GPQ, GLL)
LNR = (BVV, SBX)
PQG = (TXR, NTD)
JXX = (PJS, DNG)
QQX = (VTT, XKV)
RRJ = (GLS, GGP)
MLM = (VCD, BTQ)
QVG = (TMM, CTP)
KRM = (MSF, HVT)
XKV = (HCR, NCB)
LJX = (RNB, TKN)
CCB = (NXM, QSG)
RJF = (FQP, VDH)
XBN = (BJQ, CHJ)
JHM = (JTD, CJD)
SMV = (RSL, RLD)
PDR = (GHX, XBN)
JFK = (NDF, SJT)
HCN = (LFQ, CDQ)
SLL = (TCB, GDK)
VBL = (JBR, QHT)
SMK = (RBM, KKG)
GDK = (QXQ, RVR)
KQX = (XMJ, JFF)
LKQ = (HLN, VTD)
JSQ = (QXG, CLX)
FFD = (FRX, SSS)
NRM = (XBP, NQH)
SBR = (PQQ, SRG)
BKR = (MHG, HNG)
QQK = (GQK, STS)
HVL = (DLF, QLH)
NHT = (PTJ, CXJ)
GLL = (TLL, LRR)
GLS = (PBH, XNG)
NHB = (QQK, JTL)
PFS = (KFG, TSS)
PCN = (PFS, QFB)
CJV = (BFL, PKZ)
JFM = (FKG, CXG)
GFD = (GLL, GPQ)
MDS = (XCL, HPQ)
FXH = (VSD, HRX)
DQD = (RPR, LPS)
HPX = (RRJ, FCK)
JNR = (SQQ, SQQ)
BGR = (PQV, DKS)
BRN = (BSF, XCK)
RVS = (QKM, DPS)
PLH = (GPM, PPB)
XSM = (QFS, GQD)
TTH = (TQG, HGC)
KBJ = (KTS, LHG)
RKN = (PCX, NSB)
TPK = (PFM, RFN)
MNC = (BJB, TJS)
PMM = (GRR, PHB)
QKT = (BNK, QKR)
HQG = (JLP, XNJ)
RRD = (JGB, PMD)
CPR = (TGM, VXS)
GGM = (GCJ, GBM)
HBF = (FQG, PHL)
NXH = (DPF, GKD)
TMD = (GRX, QKT)
FBL = (RQC, TMK)
GNB = (DKH, TNC)
LQF = (LKS, KPG)
BKN = (TRN, TRN)
QJK = (BLT, XVJ)
HLV = (TJX, XPQ)
XPX = (TPK, HQN)
BJP = (FJB, FRM)
GHD = (KNM, BJG)
XMX = (HPR, QMQ)
FNV = (NHT, GGC)
JGB = (HGN, NBM)
PKH = (HHK, JXT)
JXN = (VRR, VRR)
CHJ = (TLF, QSN)
XBP = (LKQ, FBG)
QTK = (TXR, NTD)
PKC = (SVT, RGV)
JNH = (MGV, MPJ)
FXB = (NDC, NPL)
XHQ = (KTS, LHG)
MFS = (NQH, XBP)
FQM = (XJB, TXN)
QNN = (JQQ, GBG)
GBG = (PKD, GNB)
TMN = (GRC, BCV)
HMN = (KKG, RBM)
DHH = (SBR, DTS)
KPG = (LDJ, MXG)
FDL = (LQF, FSM)
FXX = (LLH, HFB)
VSD = (BJR, QFP)
HVT = (FDF, VLP)
FRM = (CBB, GMX)
GQK = (QVV, QBV)
CKJ = (PHJ, MBR)
JJH = (XSH, BMC)
SQQ = (PLD, PLD)
KPK = (JSQ, CQG)
VLP = (HHT, MMC)
NLP = (XVJ, BLT)
VTS = (MGL, PSK)
DTS = (SRG, PQQ)
VCD = (GDJ, GGM)
VRR = (HLR, RKL)
VXS = (BKN, SRB)
GMD = (PSR, VRX)
PFK = (HXC, TDM)
SJP = (VSM, NNH)
TDK = (SRS, XHL)
KRS = (GCV, SJB)
MRQ = (CJK, PQD)
XJB = (JRK, RPS)
BGF = (QCR, LJX)
MLT = (MMF, DGG)
TCC = (MNF, KKL)
QMN = (GLN, SQH)
GQJ = (VTS, SDL)
BFQ = (SMK, HMN)
NSS = (JPQ, HXV)
MHG = (VGV, TTH)
KBH = (GPL, XCV)
DRL = (KGD, HNX)
HMC = (QDF, RGR)
QSN = (FBR, GKH)
SDD = (GRC, BCV)
TGH = (BPN, SSQ)
HNG = (TTH, VGV)
RHH = (FKC, JSS)
DQA = (MVV, LQJ)
QFB = (KFG, TSS)
TQG = (SHT, HBF)
KDM = (QKK, HQL)
XHV = (PLD, CJV)
PQD = (TPH, PTN)
SSS = (SQX, VVL)
GPM = (DXB, GDX)
KLD = (CQH, XVP)
LRR = (FXX, TVV)
HPL = (JBH, PSH)
TMS = (BQQ, FGV)
MMF = (CCB, CQX)
DLQ = (PQV, DKS)
PHJ = (GTG, GRS)
TLF = (GKH, FBR)
FJB = (CBB, GMX)
PTF = (PSF, PHD)
NPL = (RTG, QHL)
XMJ = (XHQ, KBJ)
PMP = (TRM, PJK)
JPQ = (KLM, TCM)
BCG = (FMN, HMC)
DRS = (MGD, XVD)
RGT = (PKH, XGH)
TGM = (BKN, BKN)
BPM = (GQJ, NXL)
VDX = (CKR, LNC)
XJH = (QVF, LBV)
MGD = (BPR, VXT)
RGR = (JSK, VHL)
SNS = (QHT, JBR)
SRB = (TRN, DVK)
NRQ = (LQC, JJH)
PSF = (BQK, VKV)
BMF = (TMS, HPK)
LGG = (FCK, RRJ)
HPK = (FGV, BQQ)
QBV = (GSK, LNR)
FNF = (PHB, GRR)
GLT = (JDP, GNC)
DKS = (JHV, CKJ)
RGV = (GSS, PDG)
HQN = (PFM, RFN)
GKD = (BFJ, JKF)
HXC = (HPN, JCS)
MGH = (BVB, FBQ)
LBV = (XCB, PFK)
LHD = (PHD, PSF)
CDQ = (SNS, VBL)
BTQ = (GGM, GDJ)
HMS = (CBC, RBT)
VTD = (CNV, NRQ)
JBG = (GLT, CHL)
LCB = (NGG, LPH)
FKG = (SDD, TMN)
BVV = (DDL, MGH)
RGG = (KKB, NTR)
FBG = (HLN, VTD)
KMX = (GVJ, LLT)
HRF = (HHL, RGD)
DGM = (QFS, GQD)
LPM = (QFR, GCG)
QXQ = (BCS, RND)
BGV = (BTQ, VCD)
BGX = (XKV, VTT)
XDR = (VRR, ZZZ)
BJM = (JTP, KDM)
RFN = (PGQ, XHJ)
DDL = (FBQ, BVB)
XCV = (JNN, BNM)
TCX = (GBJ, PGB)
QXG = (TRP, GMD)
VKG = (BVM, KMJ)
RSL = (RLV, BJP)
CDN = (QLN, CNM)
RVR = (BCS, RND)
BBH = (BXJ, BXJ)
BXR = (KTG, HDP)
DJH = (XVK, TTV)
DVK = (TCP, HPZ)
SLF = (TFF, KQV)
DJR = (SFX, KGN)
HHT = (FHM, FHM)
JSR = (JXM, JNV)
DSB = (BFQ, XDD)
DPM = (RVS, KNQ)
HJQ = (NHT, GGC)
ZZZ = (RKL, HLR)
RJL = (HPJ, PNJ)
BJQ = (TLF, QSN)
HQJ = (BXC, JCR)
FQP = (HMS, SRH)
PGF = (VLQ, KRX)
LQJ = (FNF, PMM)
JXM = (BHV, XQK)
PNJ = (JVX, XGL)
STB = (CNM, QLN)
BBS = (JXN, JXN)
KKL = (RMF, RPJ)
SHV = (HRG, RLG)
FPQ = (FPN, DRM)
GBJ = (DXL, BXR)
QHR = (GHD, MPF)
MDG = (JKK, JSR)
CRQ = (PTQ, DBH)
BVB = (TPP, HHD)
GRC = (RGT, VDD)
SKH = (TFF, KQV)
DHZ = (LQJ, MVV)
LSP = (NSX, GTL)
MPJ = (QBL, VBH)
TDT = (KKL, MNF)
TXN = (JRK, RPS)
HSP = (GKK, JQV)
JTL = (STS, GQK)
GBM = (QCJ, MDG)
HDP = (LLX, QVG)
GMX = (KQB, BRN)
PJK = (JHT, BCG)
NDC = (RTG, QHL)
LPL = (GSR, MBQ)
VLQ = (DCD, DHH)
QLL = (CLL, TCT)
RTV = (NRF, PKC)
DKH = (BBJ, NHB)
NGC = (XJB, TXN)
CNM = (CDJ, TDK)
XXP = (BSP, NHC)
FNL = (RHM, FQX)
NBN = (VSM, NNH)
XSC = (BFM, RRD)
VXL = (PJK, TRM)
VSM = (XMX, CFD)
NQM = (GPL, XCV)
HLN = (CNV, NRQ)
GCJ = (QCJ, MDG)
FDF = (HHT, HHT)
PQQ = (SKH, SLF)
KVD = (MSF, HVT)
QSG = (NVD, RBN)
RGK = (HXV, JPQ)
NXR = (GCG, QFR)
QDR = (BSP, NHC)
TDM = (HPN, JCS)
MQX = (NDS, DRL)
JRK = (GGQ, SNK)
VMH = (VGR, KHV)
RPR = (NTV, CGR)
CFP = (LJX, QCR)
CLL = (JQD, QBB)
LLX = (CTP, TMM)
PRB = (DGG, MMF)
FVH = (XPX, DQV)
JKK = (JNV, JXM)
KLM = (VBS, HCN)
NHQ = (CJK, PQD)
BJB = (BKR, SHD)
CQX = (NXM, QSG)
KHV = (DVR, KMX)
SRH = (CBC, RBT)
DQV = (TPK, HQN)
NQD = (GMS, FLV)
PHS = (GLN, SQH)
GPL = (JNN, BNM)
JSS = (SJP, NBN)
CGR = (MRQ, NHQ)
PGC = (SQQ, XHV)
GPQ = (LRR, TLL)
HXV = (TCM, KLM)
BFL = (KJK, NMR)
PPX = (FXB, QVX)
AAA = (HLR, RKL)
DSS = (BBH, BBH)
VDD = (PKH, XGH)
NCB = (PFD, HSP)
SSQ = (PPX, HJZ)
DNG = (MLM, BGV)
CDJ = (XHL, SRS)
TNC = (NHB, BBJ)
QDF = (VHL, JSK)
GTG = (MPH, RTN)
FRX = (SQX, VVL)
MVV = (FNF, PMM)
QFS = (HLQ, MDD)
MNP = (PDR, TSM)
LDJ = (BMF, JVJ)
NSX = (FVD, LXB)
RNT = (PFS, QFB)
TJS = (SHD, BKR)
HNQ = (VDH, FQP)
BLT = (BCB, RGG)
KQV = (HGQ, MJT)
PTN = (NXT, RKN)
VDR = (BBS, PCT)
RCS = (MPJ, MGV)
GRX = (BNK, QKR)
JFF = (XHQ, KBJ)
RTG = (NRB, HJG)
CND = (DCF, NRP)
DCM = (JMK, DLP)
XPQ = (XCG, DJH)
RTX = (TGM, VXS)
DPF = (BFJ, JKF)
LNC = (PXC, TGH)
PCX = (SLL, KSX)
BSP = (HPX, LGG)
VHG = (LCH, NHP)
GRV = (KQX, GBH)
NGG = (DGM, XSM)
XSH = (TTQ, KHR)
MRH = (KVJ, LCB)
TXR = (NCX, PVK)
NVD = (VJB, DRF)
TTQ = (FPQ, QPK)
CKR = (PXC, PXC)
BVC = (DLF, QLH)
VDH = (SRH, HMS)
JQF = (SKC, MRH)
CBB = (BRN, KQB)
FMN = (RGR, QDF)
SHT = (FQG, PHL)
NLT = (BXJ, DHZ)
MPH = (KRS, XNV)
BXJ = (MVV, LQJ)
CHL = (JDP, GNC)
TSM = (XBN, GHX)
DLF = (KRM, KVD)
BCV = (RGT, VDD)
HNX = (FNK, LSF)
LJS = (SFX, KGN)
STS = (QBV, QVV)
SKC = (KVJ, LCB)
BNK = (SJD, PLH)
RTN = (KRS, XNV)
JTP = (QKK, HQL)
LCH = (VGP, JMG)
CBR = (BBS, BBS)
VNS = (VMS, PGF)
CQG = (CLX, QXG)
HLQ = (MQX, FQT)
TMM = (CRQ, DPL)
BDL = (NHP, LCH)
TRP = (VRX, PSR)
MGV = (VBH, QBL)
GNH = (BFM, RRD)
NXT = (NSB, PCX)
SNB = (SKC, MRH)
LPH = (XSM, DGM)
GGB = (GBG, JQQ)
CJK = (PTN, TPH)
QVF = (PFK, XCB)

27
9.js Normal file
View file

@ -0,0 +1,27 @@
import { loadFile } from "std";
var datafile = "9.txt";
var data = loadFile(datafile).trim().split('\n').filter(x=>x);
data = data.map(d => [d.split(' ').map(n=>Number(n))]);
Object.defineProperty(Array.prototype, 'last', { get: function() { return this[this.length-1]; }, });
data.forEach(function(d) {
while (!d.last.every(x => x === 0)) {
var diff = [];
for (var i = 1; i < d.last.length; i++)
diff.push(d.last[i]-d.last[i-1]);
d.push(diff);
}
d.reverse();
for (var i = 1; i < d.length; i++) {
d[i].push(d[i].last + d[i-1].last);
d[i].unshift(d[i][0]-d[i-1][0]);
}
d.reverse();
});
console.log("Part 1: " + data.reduce((a,d) => a += d[0].last, 0));
console.log("Part 2: " + data.reduce((a,d) => a += d[0][0], 0));

3
9.test Normal file
View file

@ -0,0 +1,3 @@
0 3 6 9 12 15
1 3 6 10 15 21
10 13 16 21 30 45

200
9.txt Normal file
View file

@ -0,0 +1,200 @@
18 38 67 109 184 355 767 1698 3622 7284 13787 24691 42124 68905 108679 166064 246810 357970 508083 707369 967936
7 1 -5 0 28 99 260 616 1373 2893 5761 10864 19482 33391 54978 87368 134563 201593 294679 421408 590920
10 9 2 -15 -46 -95 -166 -263 -390 -551 -750 -991 -1278 -1615 -2006 -2455 -2966 -3543 -4190 -4911 -5710
20 32 46 66 96 140 202 286 396 536 710 922 1176 1476 1826 2230 2692 3216 3806 4466 5200
-1 -2 -2 15 92 314 825 1846 3693 6794 11704 19117 29874 44966 65531 92844 128299 173382 229634 298603 381784
12 13 27 74 186 417 862 1691 3222 6087 11587 22386 43760 85695 166218 316447 587960 1063209 1869843 3199954 5335422
2 13 39 92 189 343 563 876 1398 2507 5206 11812 27200 61078 132444 279062 578616 1196207 2488643 5225686 11042357
17 21 25 29 33 37 41 45 49 53 57 61 65 69 73 77 81 85 89 93 97
0 15 52 126 256 465 780 1232 1856 2691 3780 5170 6912 9061 11676 14820 18560 22967 28116 34086 40960
-1 -1 -2 7 44 143 374 876 1921 4051 8362 17058 34491 69099 137060 269273 524754 1016242 1958841 3762132 7204913
9 18 34 74 169 375 807 1705 3534 7119 13832 25892 46927 83119 145614 255675 455820 834043 1576527 3081961 6207774
-1 3 11 23 39 59 83 111 143 179 219 263 311 363 419 479 543 611 683 759 839
24 48 86 149 273 527 1011 1848 3179 5180 8146 12741 20620 35852 68051 139121 297498 647452 1407478 3022601 6372667
-9 -2 12 38 88 190 415 924 2029 4259 8439 15848 28648 51003 91674 169428 323387 631524 1241950 2423498 4644472
14 14 10 -1 -22 -56 -106 -175 -266 -382 -526 -701 -910 -1156 -1442 -1771 -2146 -2570 -3046 -3577 -4166
-3 -3 -8 -15 -9 51 270 897 2475 6120 14066 30770 65140 134867 274479 549784 1083364 2100078 4011315 7579078 14250852
20 37 66 107 160 225 302 391 492 605 730 867 1016 1177 1350 1535 1732 1941 2162 2395 2640
18 23 25 32 71 211 611 1609 3867 8581 17752 34488 63270 110102 182588 290504 448913 689368 1092188 1867509 3540350
10 37 79 134 192 227 200 85 -73 -63 632 3059 9239 23188 53297 117585 254504 543721 1143797 2357112 4736946
19 28 51 105 218 434 822 1505 2737 5066 9643 18802 37193 74068 147894 295427 588889 1167081 2289039 4421338 8369642
14 25 49 99 191 340 567 926 1552 2715 4845 8476 14059 21651 30674 40420 53152 84499 192726 554776 1654431
2 5 8 7 4 17 107 444 1446 4054 10267 24182 54016 116022 242018 493737 989930 1957059 3823050 7388361 14133212
-3 -7 0 45 171 447 988 1987 3768 6891 12398 22425 41702 81076 165390 350270 756279 1635465 3495924 7326473 14988333
19 42 75 134 246 458 856 1597 2971 5541 10469 20255 40367 82787 173686 369952 794398 1709403 3667214 7808107 16434187
16 33 65 112 174 251 343 450 572 709 861 1028 1210 1407 1619 1846 2088 2345 2617 2904 3206
9 21 29 35 42 55 91 200 494 1174 2535 4926 8680 14189 22752 39904 85251 217439 591485 1580961 4023442
5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 105
5 -2 -10 -19 -31 -42 -12 215 1087 3685 10326 25558 57715 121243 240056 452234 816433 1420440 2392374 3915107 6244557
10 32 66 114 186 322 640 1418 3225 7145 15199 31173 62215 121781 234799 446291 835156 1535382 2767632 4884948 8437248
2 11 34 77 150 275 506 980 2030 4406 9668 20836 43406 86868 166892 308381 549626 947837 1586366 2583983 4106614
10 30 57 88 123 171 256 423 744 1324 2307 3882 6289 9825 14850 21793 31158 43530 59581 80076 105879
10 9 16 55 161 380 772 1417 2424 3943 6180 9415 14023 20498 29480 41785 58438 80709 110152 148647 198445
16 27 47 72 100 147 283 711 1930 5044 12307 28041 60151 122626 239736 453276 835496 1512897 2710915 4838366 8646034
14 28 38 46 71 162 413 980 2100 4112 7480 12818 20917 32774 49623 72968 104618 146724 201818 272854 363251
10 26 44 63 81 95 101 94 68 16 -70 -199 -381 -627 -949 -1360 -1874 -2506 -3272 -4189 -5275
8 30 59 92 126 158 185 204 212 206 183 140 74 -18 -139 -292 -480 -706 -973 -1284 -1642
11 20 40 86 182 362 671 1166 1917 3008 4538 6622 9392 12998 17609 23414 30623 39468 50204 63110 78490
16 20 22 33 75 181 395 772 1378 2290 3596 5395 7797 10923 14905 19886 26020 33472 42418 53045 65551
12 26 40 54 68 82 96 110 124 138 152 166 180 194 208 222 236 250 264 278 292
10 9 3 -11 -27 -15 115 586 1895 5094 12359 28118 61207 128858 263914 527717 1032948 1983791 3745823 6965923 12774469
3 11 24 51 108 231 509 1147 2583 5710 12302 25834 53061 107036 212755 417332 807452 1537611 2873008 5250748 9363097
-7 -12 -5 28 101 228 423 700 1073 1556 2163 2908 3805 4868 6111 7548 9193 11060 13163 15516 18133
10 14 17 33 88 220 479 927 1638 2698 4205 6269 9012 12568 17083 22715 29634 38022 48073 59993 74000
12 26 55 106 195 356 650 1184 2168 4059 7868 15745 32032 65152 131121 260369 511320 997436 1940253 3771284 7324165
7 11 30 75 159 301 541 987 1925 4035 8770 18971 39809 80165 154581 285939 509051 875371 1459070 2364747 3737083
-4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
6 20 48 90 146 216 300 398 510 636 776 930 1098 1280 1476 1686 1910 2148 2400 2666 2946
-4 -7 -12 -17 -18 -9 18 73 168 317 536 843 1258 1803 2502 3381 4468 5793 7388 9287 11526
9 26 47 74 119 213 420 864 1781 3621 7272 14602 29797 62571 135536 300376 671857 1496536 3286449 7070194 14849115
8 13 37 104 247 508 938 1597 2554 3887 5683 8038 11057 14854 19552 25283 32188 40417 50129 61492 74683
-2 3 25 79 199 454 972 1974 3825 7118 12826 22613 39559 69973 127900 245775 498018 1050003 2253897 4827005 10170057
16 21 33 67 147 311 620 1184 2226 4213 8091 15669 30205 57255 105854 190106 331268 560421 921829 1477095 2310231
-7 -2 16 46 81 113 153 274 685 1844 4618 10498 21877 42399 77387 134358 223633 359050 558788 846310 1251433
10 30 62 113 197 341 591 1018 1724 2848 4572 7127 10799 15935 22949 32328 44638 60530 80746 106125 137609
2 15 46 114 249 492 898 1553 2634 4581 8529 17293 37464 83665 186932 410909 882860 1853053 3809290 7700094 15373333
16 19 35 88 215 466 904 1605 2658 4165 6241 9014 12625 17228 22990 30091 38724 49095 61423 75940 92891
-6 -10 -14 -18 -22 -26 -30 -34 -38 -42 -46 -50 -54 -58 -62 -66 -70 -74 -78 -82 -86
12 38 88 174 308 502 768 1118 1564 2118 2792 3598 4548 5654 6928 8382 10028 11878 13944 16238 18772
13 26 44 76 139 273 576 1274 2861 6373 13907 29594 61466 125205 252005 505428 1017433 2063728 4216366 8641688 17660849
9 9 7 3 -3 -11 -21 -33 -47 -63 -81 -101 -123 -147 -173 -201 -231 -263 -297 -333 -371
27 53 105 198 364 681 1315 2575 4995 9482 17611 32236 58798 108206 203230 392479 780188 1588126 3281998 6827145 14203997
9 22 56 126 255 489 921 1719 3163 5720 10236 18433 34138 66174 134853 285979 620071 1351903 2929923 6273448 13240457
16 33 71 144 284 565 1135 2257 4374 8242 15234 28028 52077 98556 189977 370574 725367 1415470 2744428 5284011 10112441
12 36 72 116 170 254 421 775 1492 2844 5226 9186 15458 24998 39023 59053 86956 124996 175884 242832 329610
-3 5 27 78 200 482 1083 2269 4490 8538 15842 28971 52431 93857 165716 287652 489619 815963 1330629 2123684 3319362
11 21 46 111 257 552 1113 2144 3995 7247 12828 22165 37377 61514 98847 155214 238427 358745 529418 767307 1093585
26 48 86 153 281 534 1020 1902 3408 5840 9582 15107 22983 33878 48564 67920 92934 124704 164438 213453 273173
17 23 36 64 106 150 176 164 108 40 75 502 1975 5932 15588 38482 93251 227409 562026 1397980 3454736
6 2 -3 -13 -31 -45 1 261 1094 3285 8489 20070 44585 94256 190881 371758 698334 1268444 2233173 3819557 6360537
26 55 97 162 268 440 722 1207 2097 3834 7404 15019 31537 67197 142535 296718 600996 1179537 2240587 4121696 7353682
6 12 30 67 133 241 407 650 992 1458 2076 2877 3895 5167 6733 8636 10922 13640 16842 20583 24921
11 32 64 121 243 512 1070 2137 4035 7237 12471 20920 34594 57076 95221 163387 294246 566017 1168977 2562142 5829004
6 10 27 67 145 288 540 963 1631 2609 3898 5307 6187 4961 -1485 -17952 -48504 -85702 -77763 156357 1125665
-8 -7 14 84 254 600 1221 2231 3744 5851 8588 11894 15558 19154 21963 22881 20312 12045 -4886 -34360 -81346
-2 4 29 96 251 570 1172 2257 4195 7703 14168 26211 48646 90075 165481 300342 536996 944246 1631511 2769210 4617517
-1 5 16 41 108 282 700 1627 3537 7223 13940 25585 44918 75828 123648 195523 300835 451689 663464 955433 1351456
14 33 72 141 250 409 628 917 1286 1745 2304 2973 3762 4681 5740 6949 8318 9857 11576 13485 15594
16 14 21 60 166 399 867 1759 3388 6244 11057 18870 31122 49741 77247 116865 172648 249610 353869 492800 675198
-9 -8 11 60 145 259 378 477 596 1002 2519 7151 19249 47791 111139 247539 538929 1164780 2521143 5475354 11891237
8 2 2 19 64 148 282 477 744 1094 1538 2087 2752 3544 4474 5553 6792 8202 9794 11579 13568
11 38 88 172 318 584 1075 1984 3696 7032 13792 27923 57948 121831 256376 534886 1099813 2222846 4415788 8635986 16667142
5 16 34 58 103 223 539 1281 2879 6174 12869 26420 53717 108187 215448 423453 820289 1564532 2935372 5412630 9800235
15 37 72 120 181 255 342 442 555 681 820 972 1137 1315 1506 1710 1927 2157 2400 2656 2925
20 37 78 155 292 540 1001 1866 3477 6450 11969 22525 43716 88399 185742 399929 866926 1863473 3931132 8090733 16199912
11 33 72 146 288 546 983 1677 2721 4223 6306 9108 12782 17496 23433 30791 39783 50637 63596 78918 96876
2 9 28 65 126 219 355 560 939 1875 4504 11689 29846 72215 164652 355992 736916 1474701 2877208 5509337 10400818
8 21 46 101 231 519 1091 2125 3884 6807 11713 20196 35303 62597 111793 199583 355660 637525 1167496 2220671 4420067
24 44 73 123 224 432 845 1631 3072 5628 10025 17371 29304 48176 77277 121103 185672 278892 410985 594971 847216
18 39 80 160 309 570 995 1631 2506 3662 5364 8778 17715 42573 108530 271640 649338 1477097 3212716 6727728 13658113
3 1 -4 -6 2 34 132 420 1218 3249 7972 18061 38013 74792 138282 241107 397053 616865 899556 1216516 1484604
11 30 70 160 341 679 1289 2364 4199 7204 11927 19176 30468 49305 84307 156250 312951 659322 1415688 3026920 6359843
10 25 53 107 213 420 813 1537 2865 5376 10353 20583 41884 85987 176034 357241 717879 1431084 2839328 5627696 11184166
20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 210 220
-2 1 16 61 158 327 581 929 1397 2080 3241 5476 9967 18848 35712 66290 119336 207755 350014 571879 908524
29 56 92 133 175 214 246 267 273 260 224 161 67 -62 -230 -441 -699 -1008 -1372 -1795 -2281
14 33 60 109 216 447 902 1715 3050 5093 8040 12081 17380 24051 32130 41543 52070 63305 74612 85077 93456
-1 3 22 68 158 325 645 1289 2610 5286 10577 20840 40609 78811 153054 297327 574704 1096313 2046073 3706006 6466767
25 46 86 159 276 446 687 1058 1727 3106 6133 12897 28036 61773 136243 298209 644000 1367849 2855463 5865990 11887947
-6 -11 -16 -21 -26 -31 -36 -41 -46 -51 -56 -61 -66 -71 -76 -81 -86 -91 -96 -101 -106
3 -2 -6 12 95 318 801 1725 3351 6042 10288 16734 26211 39770 58719 84663 119547 165702 225894 303376 401943
20 38 74 142 269 501 903 1552 2522 3860 5552 7478 9355 10667 10581 7848 688 -13342 -37498 -76018 -134311
11 22 36 68 154 364 823 1747 3518 6849 13121 25010 47583 90179 169698 316547 585653 1076944 1972906 3605736 6573832
1 7 13 19 25 31 37 43 49 55 61 67 73 79 85 91 97 103 109 115 121
2 10 33 83 182 374 742 1428 2654 4742 8131 13389 21218 32450 48032 68998 96426 131378 174821 227527 289950
20 39 74 137 250 445 764 1259 1992 3035 4470 6389 8894 12097 16120 21095 27164 34479 43202 53505 65570
2 9 25 50 84 127 179 240 310 389 477 574 680 795 919 1052 1194 1345 1505 1674 1852
-5 1 16 54 155 404 969 2172 4608 9338 18217 34497 63994 117359 214384 391849 717225 1311647 2387022 4304008 7659965
17 25 33 38 45 80 201 514 1218 2729 5971 12975 27998 59466 123161 247215 479647 899385 1631957 2871316 4909587
18 30 42 54 66 78 90 102 114 126 138 150 162 174 186 198 210 222 234 246 258
16 41 85 155 258 401 591 835 1140 1513 1961 2491 3110 3825 4643 5571 6616 7785 9085 10523 12106
26 37 54 85 141 241 429 813 1633 3363 6856 13556 25832 47541 85005 148696 256068 436161 736834 1235767 2056711
14 20 21 17 8 -6 -25 -49 -78 -112 -151 -195 -244 -298 -357 -421 -490 -564 -643 -727 -816
14 25 40 53 53 36 40 221 1002 3345 9218 22355 49437 101856 198262 368135 656670 1131313 1890340 3073929 4878237
10 7 8 29 94 237 511 1007 1893 3502 6533 12494 24653 50072 103979 219129 465456 990022 2095254 4386920 9046876
21 42 86 165 291 476 732 1071 1505 2046 2706 3497 4431 5520 6776 8211 9837 11666 13710 15981 18491
21 46 87 143 222 360 649 1274 2551 4955 9133 15920 26449 42661 69084 118068 223478 473442 1083274 2548681 5952613
16 36 70 117 182 288 489 894 1723 3427 6915 13942 27723 53849 101592 185697 328770 564382 941020 1527027 2416684
18 31 56 103 182 303 476 711 1018 1407 1888 2471 3166 3983 4932 6023 7266 8671 10248 12007 13958
18 34 60 108 200 381 746 1485 2950 5746 10858 19881 35576 63315 114616 215054 420554 848658 1735088 3531130 7064424
7 1 0 14 51 129 303 705 1602 3504 7409 15361 31624 64939 132516 266576 524338 1002342 1856195 3328275 5791334
-5 -7 -8 -8 -7 -5 -2 2 7 13 20 28 37 47 58 70 83 97 112 128 145
13 34 63 100 145 198 259 328 405 490 583 684 793 910 1035 1168 1309 1458 1615 1780 1953
23 36 63 118 215 381 687 1307 2631 5482 11517 23923 48543 95591 182210 336521 605039 1068456 1877703 3336024 6078383
4 15 38 76 142 275 579 1307 3032 6979 15642 33892 70916 143541 281849 538633 1005571 1841886 3327493 5965491 10683981
20 40 65 101 179 368 792 1662 3342 6492 12394 23715 46283 93106 193109 409298 874864 1861928 3907303 8034265 16130755
-6 -6 -10 -23 -50 -96 -166 -265 -398 -570 -786 -1051 -1370 -1748 -2190 -2701 -3286 -3950 -4698 -5535 -6466
16 36 61 105 205 433 913 1853 3608 6798 12521 22728 40872 73043 130082 231956 417692 768824 1464161 2903083 5970539
-2 8 32 90 213 452 902 1744 3305 6131 11074 19434 33299 56414 96191 167819 301764 556102 1034832 1912158 3460117
13 24 46 100 209 394 670 1057 1635 2695 5084 10936 25167 58477 133332 295892 639929 1355066 2824234 5819656 11892637
-2 6 33 102 258 578 1179 2224 3926 6550 10413 15882 23370 33330 46247 62628 82990 107846 137689 172974 214098
7 10 30 84 193 377 663 1132 2043 4084 8812 19356 41469 85027 166085 309612 553039 950766 1579786 2546596 3995577
3 10 29 80 193 421 883 1852 3903 8136 16489 32156 60125 107851 186079 309832 499579 782598 1194549 1781272 2600825
1 -3 -2 20 91 259 617 1369 2976 6443 13846 29261 60344 120896 234759 441187 801179 1402773 2360430 3798614 5801457
8 6 7 24 79 203 436 827 1434 2324 3573 5266 7497 10369 13994 18493 23996 30642 38579 47964 58963
10 22 57 125 236 400 627 927 1310 1786 2365 3057 3872 4820 5911 7155 8562 10142 11905 13861 16020
20 42 82 146 248 420 731 1337 2608 5410 11671 25455 54947 116078 239103 480508 944627 1823254 3469238 6535165 12237391
11 11 16 36 102 293 792 1985 4623 10094 20911 41619 80456 152254 283218 518404 933138 1650942 2874449 4946091 8479901
13 18 33 70 136 240 405 695 1295 2738 6472 16133 40214 97471 227748 513630 1123720 2398645 5020050 10337495 20989375
-5 4 24 52 96 184 369 727 1346 2320 3808 6308 11442 23777 54606 129413 302463 685622 1506034 3222034 6754390
5 20 47 86 137 200 275 362 461 572 695 830 977 1136 1307 1490 1685 1892 2111 2342 2585
24 49 99 195 369 664 1134 1844 2870 4299 6229 8769 12039 16170 21304 27594 35204 44309 55095 67759 82509
12 19 37 64 106 189 374 791 1731 3878 8835 20208 45669 100632 214454 440425 871246 1662221 3065017 5475584 9500684
9 34 79 160 314 623 1248 2467 4703 8517 14530 23241 34763 48680 64652 85220 123673 222012 487101 1157014 2714108
15 30 45 60 75 90 105 120 135 150 165 180 195 210 225 240 255 270 285 300 315
5 15 44 110 253 552 1147 2265 4251 7613 13116 22026 36757 62516 111301 211254 427809 909947 1988012 4373634 9554773
13 9 2 -4 12 111 431 1250 3091 6887 14224 27678 51258 90961 155437 256752 411225 640301 971406 1438712 2083720
27 40 57 79 119 223 500 1176 2699 5934 12499 25305 49375 93029 169534 299330 512955 854804 1387869 2199619 3409191
13 23 34 53 103 232 526 1142 2383 4853 9780 19721 40132 82797 173001 363787 762893 1581319 3217290 6396097 12395433
8 4 7 32 106 267 563 1050 1796 2917 4714 8074 15487 33383 77111 180919 416972 930078 1998813 4139728 8280052
15 20 25 29 49 148 483 1380 3451 7786 16293 32338 61983 116402 216650 403270 756055 1435104 2765597 5409391 10702549
-6 6 27 57 109 227 522 1238 2866 6328 13266 26519 51009 95602 177298 330776 629642 1231950 2473625 5052189 10373797
-3 -2 -3 3 38 149 436 1098 2510 5374 11038 22151 43924 86403 168329 323352 609601 1124088 2024885 3568501 6182104
13 24 56 132 290 586 1104 1980 3439 5829 9621 15346 23486 34463 49125 70568 108825 190974 380654 812928 1753002
17 28 43 62 83 102 113 108 77 8 -113 -302 -577 -958 -1467 -2128 -2967 -4012 -5293 -6842 -8693
11 31 55 86 148 303 674 1487 3155 6432 12675 24305 45734 85460 160932 309442 611099 1234381 2521471 5140328 10344144
-6 0 12 26 38 44 40 22 -14 -72 -156 -270 -418 -604 -832 -1106 -1430 -1808 -2244 -2742 -3306
4 4 7 29 103 294 732 1683 3691 7837 16174 32410 62924 118213 214881 378294 646038 1072330 1733545 2735035 4219429
14 35 83 185 385 747 1355 2318 3803 6137 10040 17075 30428 56161 105114 195668 357620 637463 1105409 1864541 3062531
18 32 46 60 74 88 102 116 130 144 158 172 186 200 214 228 242 256 270 284 298
-7 -13 -23 -38 -59 -87 -123 -168 -223 -289 -367 -458 -563 -683 -819 -972 -1143 -1333 -1543 -1774 -2027
9 8 7 10 30 97 288 794 2051 4998 11604 25959 56499 120402 251948 517810 1044001 2061752 3983193 7522660 13886120
26 43 61 73 67 29 -52 -182 -372 -679 -1312 -2851 -6621 -15194 -32772 -64653 -113732 -169311 -178015 24099 859185
-6 -11 -12 -4 10 9 -46 -190 -394 -442 297 3292 11700 32245 79586 186469 426693 965345 2165463 4809616 10553881
22 48 100 197 374 707 1357 2637 5106 9694 17862 31801 54674 90905 146519 229537 350430 522636 763144 1093149 1538782
19 39 84 176 361 736 1500 3055 6200 12481 24783 48276 91856 170254 307021 538635 920017 1531787 2489638 3956256 6156267
7 16 25 34 43 52 61 70 79 88 97 106 115 124 133 142 151 160 169 178 187
9 21 36 55 77 99 116 121 105 57 -36 -189 -419 -745 -1188 -1771 -2519 -3459 -4620 -6033 -7731
19 44 96 184 318 512 791 1220 1986 3584 7204 15535 34482 76883 170466 374420 812761 1739272 3659940 7557174 15289610
15 19 27 55 129 284 563 1016 1699 2673 4003 5757 8005 10818 14267 18422 23351 29119 35787 43411 52041
13 36 87 189 385 748 1403 2571 4643 8290 14613 25335 43035 71422 115645 182633 281457 423704 623851 899625 1272333
16 42 91 173 311 555 1000 1810 3250 5728 9849 16483 26849 42617 66030 100048 148516 216358 309799 436617 606427
11 16 30 75 197 478 1051 2115 3951 6951 11690 19096 30805 49827 81695 136322 230851 393850 671278 1134729 1892549
14 28 53 105 223 481 1011 2053 4061 7929 15471 30411 60336 120375 239879 474323 926592 1785966 3401881 6427277 12100501
3 15 49 119 238 421 688 1062 1567 2248 3261 5129 9361 19849 45921 108883 255792 587924 1318562 2888478 6193977
26 36 56 114 249 511 969 1745 3109 5695 10949 22042 45762 96502 204688 434398 919503 1936098 4043952 8355067 17028216
15 28 46 85 178 385 822 1732 3642 7689 16261 34203 71025 144900 289889 568978 1097441 2084130 3903024 7214353 13164596
6 -2 -1 34 151 432 1004 2050 3820 6642 10933 17210 26101 38356 54858 76634 104866 140902 186267 242674 312035
11 9 20 54 130 292 634 1333 2693 5215 9728 17644 31436 55482 97470 170619 297039 512629 873996 1467970 2424390
12 16 24 48 116 281 651 1451 3132 6568 13451 27129 54360 108826 217884 435197 864140 1701236 3317090 6407154 12270444
27 38 44 53 88 200 493 1162 2557 5313 10628 20828 40430 78001 149213 281611 521743 945448 1672260 2885063 4856324
24 37 50 63 76 89 102 115 128 141 154 167 180 193 206 219 232 245 258 271 284
15 28 53 93 152 239 372 582 917 1446 2263 3491 5286 7841 11390 16212 22635 31040 41865 55609 72836
19 34 57 91 143 243 475 1020 2211 4600 9037 16761 29503 49601 80127 125026 189267 279006 401761 566599 784335
11 29 69 146 278 486 794 1229 1821 2603 3611 4884 6464 8396 10728 13511 16799 20649 25121 30278 36186
13 26 38 49 53 36 -22 -126 -197 88 1604 6305 18055 43862 95628 192542 364257 655006 1128826 1876073 3021425
5 14 24 39 80 211 577 1460 3366 7173 14404 27743 51988 95755 174504 316109 571807 1039028 1910236 3576603 6841876
10 25 52 107 228 484 979 1862 3378 6028 10953 20728 40862 82469 166828 332917 649522 1234227 2282530 4111553 7224376
7 16 33 66 122 204 311 444 612 824 1049 1135 730 -575 -2159 1661 33636 165397 595608 1831797 5095949
14 34 56 74 79 59 -1 -119 -316 -616 -1046 -1636 -2419 -3431 -4711 -6301 -8246 -10594 -13396 -16706 -20581
6 15 44 114 269 586 1185 2239 3984 6729 10866 16880 25359 37004 52639 73221 99850 133779 176424 229374 294401
3 13 44 125 312 700 1435 2726 4857 8199 13222 20507 30758 44814 63661 88444 120479 161265 212496 276073 354116
17 36 71 136 253 447 742 1159 1717 2438 3357 4538 6097 8233 11268 15697 22249 31960 46259 67068 96917
17 33 63 124 252 522 1085 2229 4485 8840 17195 33331 64851 126910 249126 488031 948981 1823879 3454739 6438490 11796050
14 32 73 141 236 354 487 623 746 836 869 817 648 326 -189 -941 -1978 -3352 -5119 -7339 -10076
-6 -11 -14 2 76 286 788 1892 4190 8757 17464 33477 62074 112002 197732 343173 587706 995837 1672398 2786116 4605608
17 28 44 70 120 222 426 832 1668 3464 7392 15876 33621 69283 138176 266899 502094 928936 1713089 3198344 6132145
13 11 10 15 37 98 241 553 1220 2657 5804 12765 28111 61413 132021 278002 573032 1159057 2311077 4568183 9000938
9 16 20 21 19 14 6 -5 -19 -36 -56 -79 -105 -134 -166 -201 -239 -280 -324 -371 -421
15 31 68 146 305 628 1282 2591 5163 10101 19336 36128 65789 116690 201622 339589 558119 896187 1407852 2166718 3271337
11 19 50 116 228 410 740 1441 3058 6779 15003 32355 67561 137062 272240 534180 1044012 2045045 4029096 7991715 15945731