Skip to content

Instantly share code, notes, and snippets.

Avatar

Matthew Savage bluepichu

View GitHub Profile
View aoc21-23.ts
import { Advent, GridDirectionsWithoutDiagonals } from "advent";
import { Set, Map } from "immutable";
import * as p from "ts-priority-queue";
const { compute, computeCheck } = await Advent({ day: 23 });
interface Entry {
grid: string[][];
cost: number;
}
View aoc21-24.py
from z3 import *
with open("input.txt") as f:
lines = f.readlines()
iters = []
for i in range(14):
base = i * 18
print(lines[base + 4], lines[base + 5], lines[base + 15])
View aoc21-22.ts
import { List, Map, Set } from "immutable";
import { Advent, int, arr } from "advent";
const { compute, computeCheck } = await Advent({ day: 22 });
interface Cube {
x1: number;
y1: number;
z1: number;
x2: number;
View aoc21-20.ts
import { List, Map, Set } from "immutable";
import { Advent, arr } from "advent";
const { compute, computeCheck } = await Advent({ day: 20 });
compute(async (input) => {
// const data = input.tokens(/,/).map(int);
const [alg, imageStr] = input.all().split("\n\n");
let image = imageStr.split("\n").map((c) => c.split(""));
for (let i = 0; i < 50; i++) {
View aoc21-19.ts
import { List, Map, Set } from "immutable";
import { Advent, int } from "advent";
const { compute, computeCheck } = await Advent({ day: 19 });
type Scanner = [number, number, number][];
let deltas: [number, number, number][] = [[0, 0, 0]];
let tfs = Set<List<number>>();
compute(async (input) => {
View aoc21-17.ts
import { Advent, int } from "advent";
const { compute, computeCheck } = await Advent({ day: 17 });
compute(async (input) => {
// const data = input.tokens(/,/).map(int);
// const data = input.ints();
const x1 = 32
const x2 = 65
const y1 = -225
View aoc21-14.ts
import { Map } from 'immutable';
import { Advent, arr, int } from "advent";
const { compute, computeCheck } = await Advent({ day: 14 });
compute(async (input) => {
// const data = input.tokens(/,/).map(int);
// const data = input.ints();
const [start, rules] = input.all().split("\n\n");
View aoc21-11.ts
import { List } from "immutable";
import { Advent, GridDirections, int } from "advent";
const { compute, computeCheck } = await Advent({ day: 11 });
compute(async (input) => {
// const data = input.tokens(/,/).map(int);
// const data = input.ints();
let ans = 0;
View aoc21-10.ts
import { Advent } from "advent";
const { compute, computeCheck } = await Advent({ day: 10 });
compute(async (input) => {
// const data = input.tokens(/,/).map(int);
// const data = input.ints();
const data = input.lines();
const left = ["(", "[", "{", "<"];
View aoc21-08.ts
import { List, Set } from "immutable";
import { Advent, int } from "advent";
const { compute, computeCheck } = await Advent({ day: 8 });
compute(async (input) => {
// const data = input.tokens(/,/).map(int);
// const data = input.ints();
const data = input.lines();
let ans = 0;