Compare commits
18 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2af1c7e03f | |||
| b3f8ab19ff | |||
| 0633ee80a9 | |||
| f088a5a21a | |||
| bc89b177a2 | |||
| 393f80f314 | |||
| b55a6d61da | |||
| 524b451399 | |||
| 76b70d3c6b | |||
| f85eda4e87 | |||
| 37b740f07a | |||
| 5a8bf21386 | |||
| 605b5ee85a | |||
| 1d6cdccaf8 | |||
| d1e798bdbf | |||
| 862f25d6d8 | |||
| beca41e511 | |||
| cc35a07724 |
11 changed files with 3012 additions and 11 deletions
16
README.md
Normal file
16
README.md
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
# Advent of Code 2025
|
||||||
|
|
||||||
|
| Day | Part 1 | Part 2 |
|
||||||
|
| --- | ------ | ------ |
|
||||||
|
| 1 | [x] | [x] |
|
||||||
|
| 2 | [x] | [x] |
|
||||||
|
| 3 | [x] | [x] |
|
||||||
|
| 4 | [x] | [x] |
|
||||||
|
| 5 | [x] | [x] |
|
||||||
|
| 6 | [x] | [x] |
|
||||||
|
| 7 | [x] | [x] |
|
||||||
|
| 8 | [ ] | [ ] |
|
||||||
|
| 9 | [x] | [x] |
|
||||||
|
| 10 | [x] | [ ] |
|
||||||
|
| 11 | [x] | [x] |
|
||||||
|
| 12 | [ ] | [ ] |
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
nativeBuildInputs = with pkgs; [
|
nativeBuildInputs = with pkgs; [
|
||||||
zig
|
zig
|
||||||
zls
|
zls
|
||||||
|
hyperfine
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = with pkgs; [];
|
buildInputs = with pkgs; [];
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,133 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
|
||||||
pub const title = "Day 07";
|
pub const title = "Day 07: Laboratories";
|
||||||
|
|
||||||
pub fn run(_: std.mem.Allocator) !void {
|
pub fn run(allocator: std.mem.Allocator) !void {
|
||||||
|
const input = @embedFile("./input/day07.txt");
|
||||||
|
//const input =
|
||||||
|
// \\.......S.......
|
||||||
|
// \\...............
|
||||||
|
// \\.......^.......
|
||||||
|
// \\...............
|
||||||
|
// \\......^.^......
|
||||||
|
// \\...............
|
||||||
|
// \\.....^.^.^.....
|
||||||
|
// \\...............
|
||||||
|
// \\....^.^...^....
|
||||||
|
// \\...............
|
||||||
|
// \\...^.^...^.^...
|
||||||
|
// \\...............
|
||||||
|
// \\..^...^.....^..
|
||||||
|
// \\...............
|
||||||
|
// \\.^.^.^.^.^...^.
|
||||||
|
// \\...............
|
||||||
|
// ;
|
||||||
|
|
||||||
|
var lines = std.mem.tokenizeScalar(u8, input, '\n');
|
||||||
|
|
||||||
|
const first_line = lines.next() orelse unreachable;
|
||||||
|
const starting_position = for (first_line, 0..) |c, i| {
|
||||||
|
if (c == 'S') break i;
|
||||||
|
} else unreachable;
|
||||||
|
const line_len = first_line.len;
|
||||||
|
|
||||||
|
std.debug.print("starting_position = {d}\n", .{starting_position});
|
||||||
|
|
||||||
|
std.debug.print("{s}\n", .{first_line});
|
||||||
|
|
||||||
|
const previous_line = try allocator.alloc(Cell, line_len);
|
||||||
|
defer allocator.free(previous_line);
|
||||||
|
|
||||||
|
var i: usize = 0;
|
||||||
|
while (lines.next()) |line| {
|
||||||
|
defer i += 1;
|
||||||
|
|
||||||
|
const current_line = try allocator.alloc(Cell, line_len);
|
||||||
|
defer allocator.free(current_line);
|
||||||
|
for (line, 0..) |c, ci| {
|
||||||
|
switch (c) {
|
||||||
|
'.' => current_line[ci] = .empty,
|
||||||
|
'^' => current_line[ci] = .splitter,
|
||||||
|
else => unreachable, // There shouldn't be beams on this line yet!
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
defer @memcpy(previous_line, current_line);
|
||||||
|
|
||||||
|
defer {
|
||||||
|
for (current_line) |cell| {
|
||||||
|
std.debug.print("{f}", .{cell});
|
||||||
|
}
|
||||||
|
std.debug.print("\n", .{});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i == 0) {
|
||||||
|
std.debug.assert(current_line[starting_position] == .empty);
|
||||||
|
current_line[starting_position] = .{ .beam = .{ .timelines = 1 } };
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (current_line, 0..) |cell, celli| {
|
||||||
|
const previous_cell = previous_line[celli];
|
||||||
|
if (previous_cell == .beam) {
|
||||||
|
if (cell == .empty) {
|
||||||
|
current_line[celli] = .{ .beam = .{ .timelines = previous_cell.beam.timelines } };
|
||||||
|
} else if (cell == .splitter) {
|
||||||
|
if (celli != 0) {
|
||||||
|
const left = current_line[celli - 1];
|
||||||
|
if (left == .empty) {
|
||||||
|
current_line[celli - 1] = .{ .beam = .{ .timelines = previous_cell.beam.timelines } };
|
||||||
|
} else if (left == .beam) {
|
||||||
|
current_line[celli - 1] = .{ .beam = .{ .timelines = left.beam.timelines + previous_cell.beam.timelines } };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (celli != line_len - 1) {
|
||||||
|
const right = current_line[celli + 1];
|
||||||
|
if (right == .empty) {
|
||||||
|
current_line[celli + 1] = .{ .beam = .{ .timelines = previous_cell.beam.timelines } };
|
||||||
|
} else if (right == .beam) {
|
||||||
|
current_line[celli + 1] = .{ .beam = .{ .timelines = right.beam.timelines + previous_cell.beam.timelines } };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (cell == .beam and previous_cell == .beam) {
|
||||||
|
current_line[celli] = .{ .beam = .{ .timelines = cell.beam.timelines + previous_cell.beam.timelines } };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var accumulator: usize = 0;
|
||||||
|
for (previous_line) |cell| {
|
||||||
|
accumulator += switch (cell) {
|
||||||
|
.empty, .splitter => 0,
|
||||||
|
.beam => |beam| beam.timelines,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
var buffer: [8]u8 = undefined;
|
||||||
|
var stdout_writer = std.fs.File.stdout().writer(&buffer);
|
||||||
|
const stdout = &stdout_writer.interface;
|
||||||
|
|
||||||
|
try stdout.print("{d}\n", .{accumulator});
|
||||||
|
|
||||||
|
try stdout.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Cell = union(enum) {
|
||||||
|
empty: void,
|
||||||
|
splitter: void,
|
||||||
|
beam: struct {
|
||||||
|
timelines: usize,
|
||||||
|
},
|
||||||
|
|
||||||
|
const Self = @This();
|
||||||
|
|
||||||
|
pub fn format(self: Cell, w: *std.io.Writer) std.io.Writer.Error!void {
|
||||||
|
switch (self) {
|
||||||
|
.empty => try w.print(".", .{}),
|
||||||
|
.splitter => try w.print("^", .{}),
|
||||||
|
.beam => |beam| try w.print("{d}", .{beam.timelines}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,242 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
|
||||||
pub const title = "Day 09";
|
pub const title = "Day 09: Movie Theater";
|
||||||
|
|
||||||
pub fn run(_: std.mem.Allocator) !void {
|
pub fn run(allocator: std.mem.Allocator) !void {
|
||||||
|
const input = @embedFile("./input/day09.txt");
|
||||||
|
//const input =
|
||||||
|
// \\7,1
|
||||||
|
// \\11,1
|
||||||
|
// \\11,7
|
||||||
|
// \\9,7
|
||||||
|
// \\9,5
|
||||||
|
// \\2,5
|
||||||
|
// \\2,3
|
||||||
|
// \\7,3
|
||||||
|
// ;
|
||||||
|
|
||||||
|
var lines = std.mem.tokenizeScalar(u8, input, '\n');
|
||||||
|
|
||||||
|
var tiles: std.ArrayList(Tile) = .empty;
|
||||||
|
defer tiles.deinit(allocator);
|
||||||
|
|
||||||
|
std.debug.print("parsing tiles...\n", .{});
|
||||||
|
var index: usize = 0;
|
||||||
|
while (lines.next()) |line| {
|
||||||
|
defer index += 1;
|
||||||
|
var coordinates = std.mem.tokenizeScalar(u8, line, ',');
|
||||||
|
const x = blk: {
|
||||||
|
const s = coordinates.next() orelse continue;
|
||||||
|
break :blk try std.fmt.parseUnsigned(u64, s, 10);
|
||||||
|
};
|
||||||
|
const y = blk: {
|
||||||
|
const s = coordinates.next() orelse continue;
|
||||||
|
break :blk try std.fmt.parseUnsigned(u64, s, 10);
|
||||||
|
};
|
||||||
|
try tiles.append(allocator, .{ .index = index, .pos = .{ x, y } });
|
||||||
|
}
|
||||||
|
|
||||||
|
std.debug.print("calculating edges...\n", .{});
|
||||||
|
var edges: std.ArrayList(Edge) = .empty;
|
||||||
|
defer edges.deinit(allocator);
|
||||||
|
for (tiles.items, 0..) |tile, i| {
|
||||||
|
const a = tile;
|
||||||
|
const b = if (i == tiles.items.len - 1) tiles.items[0] else tiles.items[i + 1];
|
||||||
|
try edges.append(allocator, Edge.fromTiles(a, b));
|
||||||
|
}
|
||||||
|
|
||||||
|
std.debug.print("finding largest rectangle...\n", .{});
|
||||||
|
var largest_area: usize = 0;
|
||||||
|
var largest_rectangle: Rectangle = undefined;
|
||||||
|
for (tiles.items, 0..) |first_tile, i| {
|
||||||
|
inner: for (tiles.items[i + 1..]) |second_tile| {
|
||||||
|
const rectangle = first_tile.rectangle(second_tile);
|
||||||
|
|
||||||
|
std.debug.print("checking rectangle {f}...\n", .{rectangle});
|
||||||
|
|
||||||
|
const has_inside = rectangle.width() >= 3 and rectangle.height() >= 3;
|
||||||
|
if (has_inside) {
|
||||||
|
const one: @Vector(2, u64) = @splat(1);
|
||||||
|
const top_left = rectangle.topLeft() + one;
|
||||||
|
const bottom_right = rectangle.bottomRight() - one;
|
||||||
|
edge_loop: for (edges.items) |edge| {
|
||||||
|
if (edge.direction == .horizontal) {
|
||||||
|
if (edge.a.pos[1] < top_left[1] or edge.a.pos[1] > bottom_right[1]) {
|
||||||
|
continue :edge_loop;
|
||||||
|
}
|
||||||
|
|
||||||
|
const start, const end = if (edge.a.pos[0] < edge.b.pos[0] + 1) .{ edge.a.pos[0], edge.b.pos[0] } else .{ edge.b.pos[0], edge.a.pos[0] + 1 };
|
||||||
|
for (start..end) |ex| {
|
||||||
|
const edge_tile: @Vector(2, u64) = .{ ex, edge.a.pos[1] };
|
||||||
|
if (top_left[0] <= edge_tile[0] and edge_tile[0] <= bottom_right[0]) {
|
||||||
|
std.debug.print("rectangle {f} hits edge {f}\n", .{rectangle, edge});
|
||||||
|
continue :inner;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (edge.a.pos[0] < top_left[0] or edge.a.pos[0] > bottom_right[0]) {
|
||||||
|
continue :edge_loop;
|
||||||
|
}
|
||||||
|
|
||||||
|
const start, const end = if (edge.a.pos[1] < edge.b.pos[1] + 1) .{ edge.a.pos[1], edge.b.pos[1] } else .{ edge.b.pos[1], edge.a.pos[1] + 1 };
|
||||||
|
for (start..end) |ey| {
|
||||||
|
const edge_tile: @Vector(2, u64) = .{ edge.a.pos[0], ey };
|
||||||
|
if (top_left[1] <= edge_tile[1] and edge_tile[1] <= bottom_right[1]) {
|
||||||
|
std.debug.print("rectangle {f} hits edge {f}\n", .{rectangle, edge});
|
||||||
|
continue :inner;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const area = rectangle.area();
|
||||||
|
if (area > largest_area) {
|
||||||
|
largest_area = area;
|
||||||
|
largest_rectangle = rectangle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std.debug.print("rectangle = {f}\n", .{largest_rectangle});
|
||||||
|
std.debug.print("top_left = {any}, bottom_right = {any}\n", .{largest_rectangle.topLeft(), largest_rectangle.bottomRight()});
|
||||||
|
|
||||||
|
var buffer: [64]u8 = undefined;
|
||||||
|
var stdout_writer = std.fs.File.stdout().writer(&buffer);
|
||||||
|
const stdout = &stdout_writer.interface;
|
||||||
|
|
||||||
|
try stdout.print("{d}\n", .{largest_area});
|
||||||
|
|
||||||
|
try stdout.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Tile = struct {
|
||||||
|
index: usize,
|
||||||
|
pos: @Vector(2, u64),
|
||||||
|
|
||||||
|
const Self = @This();
|
||||||
|
|
||||||
|
pub fn format(self: Self, w: *std.io.Writer) std.io.Writer.Error!void {
|
||||||
|
try w.print("{d},{d}", .{self.pos[0], self.pos[1]});
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn rectangle(self: Self, other_corner: Self) Rectangle {
|
||||||
|
return Rectangle.fromTiles(self, other_corner);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const Edge = struct {
|
||||||
|
a: Tile,
|
||||||
|
b: Tile,
|
||||||
|
|
||||||
|
direction: Direction,
|
||||||
|
|
||||||
|
const Self = @This();
|
||||||
|
|
||||||
|
const Direction = enum {
|
||||||
|
horizontal,
|
||||||
|
vertical,
|
||||||
|
};
|
||||||
|
|
||||||
|
pub fn fromTiles(a: Tile, b: Tile) Self {
|
||||||
|
const direction: Direction = if (a.pos[0] == b.pos[0])
|
||||||
|
.vertical
|
||||||
|
else if (a.pos[1] == b.pos[1])
|
||||||
|
.horizontal
|
||||||
|
else
|
||||||
|
unreachable;
|
||||||
|
|
||||||
|
return .{
|
||||||
|
.a = a,
|
||||||
|
.b = b,
|
||||||
|
.direction = direction,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn format(self: Self, w: *std.io.Writer) std.io.Writer.Error!void {
|
||||||
|
try w.print("{f} - {f}", .{self.a, self.b});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/// 0,0 1,0
|
||||||
|
/// a ---- c
|
||||||
|
/// | |
|
||||||
|
/// | |
|
||||||
|
/// d ---- b
|
||||||
|
/// 0,1 1,1
|
||||||
|
const Rectangle = struct {
|
||||||
|
a: Tile,
|
||||||
|
b: Tile,
|
||||||
|
|
||||||
|
c: @Vector(2, u64),
|
||||||
|
d: @Vector(2, u64),
|
||||||
|
|
||||||
|
const Self = @This();
|
||||||
|
|
||||||
|
pub fn fromTiles(a: Tile, b: Tile) Self {
|
||||||
|
const cx = if (a.pos[0] <= b.pos[0]) b.pos[0] else a.pos[0];
|
||||||
|
const cy = if (a.pos[1] >= b.pos[1]) a.pos[1] else b.pos[1];
|
||||||
|
const dx = if (a.pos[0] <= b.pos[0]) a.pos[0] else b.pos[0];
|
||||||
|
const dy = if (a.pos[1] >= b.pos[1]) b.pos[1] else a.pos[1];
|
||||||
|
return .{
|
||||||
|
.a = a,
|
||||||
|
.b = b,
|
||||||
|
.c = .{ cx, cy },
|
||||||
|
.d = .{ dx, dy },
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn format(self: Self, w: *std.io.Writer) std.io.Writer.Error!void {
|
||||||
|
try w.print("{d} to {d} ({f} - {d},{d} - {f} - {d},{d})", .{self.a.index, self.b.index, self.a, self.c[0], self.c[1], self.b, self.d[0], self.d[1]});
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn topLeft(self: Self) @Vector(2, u64) {
|
||||||
|
const verts = [_]@Vector(2, u64){ self.c, self.b.pos, self.d };
|
||||||
|
var top_left: @Vector(2, u64) = self.a.pos;
|
||||||
|
for (verts) |vert| {
|
||||||
|
const cond = vert <= top_left;
|
||||||
|
if (@reduce(.And, cond)) {
|
||||||
|
top_left = vert;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return top_left;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn bottomRight(self: Self) @Vector(2, u64) {
|
||||||
|
const verts = [_]@Vector(2, u64){ self.d, self.a.pos, self.c };
|
||||||
|
var bottom_right: @Vector(2, u64) = self.b.pos;
|
||||||
|
for (verts) |vert| {
|
||||||
|
const cond = vert >= bottom_right;
|
||||||
|
if (@reduce(.And, cond)) {
|
||||||
|
bottom_right = vert;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return bottom_right;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn width(self: Self) u64 {
|
||||||
|
const cond = self.a.pos > self.b.pos;
|
||||||
|
const high = @select(u64, cond, self.a.pos, self.b.pos);
|
||||||
|
const low = @select(u64, !cond, self.a.pos, self.b.pos);
|
||||||
|
const diff = high - low;
|
||||||
|
return diff[0] + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn height(self: Self) u64 {
|
||||||
|
const cond = self.a.pos > self.b.pos;
|
||||||
|
const high = @select(u64, cond, self.a.pos, self.b.pos);
|
||||||
|
const low = @select(u64, !cond, self.a.pos, self.b.pos);
|
||||||
|
const diff = high - low;
|
||||||
|
return diff[1] + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn area(self: Self) u64 {
|
||||||
|
const cond = self.a.pos > self.b.pos;
|
||||||
|
const high = @select(u64, cond, self.a.pos, self.b.pos);
|
||||||
|
const low = @select(u64, !cond, self.a.pos, self.b.pos);
|
||||||
|
const diff = high - low;
|
||||||
|
const one: @Vector(2, u64) = @splat(1);
|
||||||
|
return @reduce(.Mul, diff + one);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,120 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
|
||||||
pub const title = "Day 11";
|
pub const title = "Day 11: Reactor";
|
||||||
|
|
||||||
pub fn run(_: std.mem.Allocator) !void {
|
pub fn run(allocator: std.mem.Allocator) !void {
|
||||||
|
const input = @embedFile("./input/day11.txt");
|
||||||
|
//const input =
|
||||||
|
// \\aaa: you hhh
|
||||||
|
// \\you: bbb ccc
|
||||||
|
// \\bbb: ddd eee
|
||||||
|
// \\ccc: ddd eee fff
|
||||||
|
// \\ddd: ggg
|
||||||
|
// \\eee: out
|
||||||
|
// \\fff: out
|
||||||
|
// \\ggg: out
|
||||||
|
// \\hhh: ccc fff iii
|
||||||
|
// \\iii: out
|
||||||
|
// ;
|
||||||
|
//const input =
|
||||||
|
// \\svr: aaa bbb
|
||||||
|
// \\aaa: fft
|
||||||
|
// \\fft: ccc
|
||||||
|
// \\bbb: tty
|
||||||
|
// \\tty: ccc
|
||||||
|
// \\ccc: ddd eee
|
||||||
|
// \\ddd: hub
|
||||||
|
// \\hub: fff
|
||||||
|
// \\eee: dac
|
||||||
|
// \\dac: fff
|
||||||
|
// \\fff: ggg hhh
|
||||||
|
// \\ggg: out
|
||||||
|
// \\hhh: out
|
||||||
|
// ;
|
||||||
|
|
||||||
|
var lines = std.mem.tokenizeScalar(u8, input, '\n');
|
||||||
|
|
||||||
|
var devices: std.StringHashMap([][]const u8) = .init(allocator);
|
||||||
|
defer {
|
||||||
|
var outputs_iter = devices.valueIterator();
|
||||||
|
while (outputs_iter.next()) |value| {
|
||||||
|
allocator.free(value.*);
|
||||||
|
}
|
||||||
|
devices.deinit();
|
||||||
|
}
|
||||||
|
|
||||||
|
while (lines.next()) |line| {
|
||||||
|
const device = line[0..3];
|
||||||
|
std.debug.print("device = {s}\n", .{device});
|
||||||
|
|
||||||
|
var outputs: std.ArrayList([]const u8) = .empty;
|
||||||
|
defer outputs.deinit(allocator);
|
||||||
|
|
||||||
|
var outputs_iter = std.mem.tokenizeScalar(u8, line[5..], ' ');
|
||||||
|
while (outputs_iter.next()) |output| {
|
||||||
|
try outputs.append(allocator, output);
|
||||||
|
}
|
||||||
|
|
||||||
|
const outputs_slice = try outputs.toOwnedSlice(allocator);
|
||||||
|
errdefer allocator.free(outputs_slice);
|
||||||
|
|
||||||
|
try devices.put(device, outputs_slice);
|
||||||
|
}
|
||||||
|
|
||||||
|
var cache: std.StringHashMap(usize) = .init(allocator);
|
||||||
|
defer cache.deinit();
|
||||||
|
try cache.ensureTotalCapacity(devices.count());
|
||||||
|
|
||||||
|
const dac_to_fft = try visitOutputs("dac", "fft", devices, &cache);
|
||||||
|
const svr_to_fft = try visitOutputs("svr", "fft", devices, &cache);
|
||||||
|
cache.clearRetainingCapacity();
|
||||||
|
|
||||||
|
const to_fft = if (dac_to_fft == 0) svr_to_fft else dac_to_fft;
|
||||||
|
|
||||||
|
const dac_start = if (dac_to_fft == 0) "fft" else "svr";
|
||||||
|
const end_start = if (dac_to_fft == 0) "dac" else "fft";
|
||||||
|
|
||||||
|
const to_dac = try visitOutputs(dac_start, "dac", devices, &cache);
|
||||||
|
cache.clearRetainingCapacity();
|
||||||
|
|
||||||
|
const to_end = try visitOutputs(end_start, "out", devices, &cache);
|
||||||
|
|
||||||
|
const result = to_fft * to_dac * to_end;
|
||||||
|
|
||||||
|
var buffer: [8]u8 = undefined;
|
||||||
|
var stdout_writer = std.fs.File.stdout().writer(&buffer);
|
||||||
|
const stdout = &stdout_writer.interface;
|
||||||
|
|
||||||
|
try stdout.print("{d}\n", .{result});
|
||||||
|
|
||||||
|
try stdout.flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn visitOutputs(
|
||||||
|
start: []const u8,
|
||||||
|
end: []const u8,
|
||||||
|
devices: std.StringHashMap([][]const u8),
|
||||||
|
cache: *std.StringHashMap(usize),
|
||||||
|
) !usize {
|
||||||
|
if (cache.get(start)) |result| {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
var paths: usize = 0;
|
||||||
|
const device = devices.get(start);
|
||||||
|
if (device) |outputs| {
|
||||||
|
for (outputs) |output| {
|
||||||
|
if (std.mem.eql(u8, output, end)) {
|
||||||
|
paths += 1;
|
||||||
|
} else {
|
||||||
|
paths += try visitOutputs(output, end, devices, cache);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try cache.put(start, paths);
|
||||||
|
return paths;
|
||||||
|
} else {
|
||||||
|
std.debug.print("device {s} not found\n", .{start});
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,240 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
|
||||||
pub const title = "Day 12";
|
pub const title = "Day 12: Christmas Tree Farm";
|
||||||
|
|
||||||
pub fn run(_: std.mem.Allocator) !void {
|
pub fn run(allocator: std.mem.Allocator) !void {
|
||||||
|
const input = @embedFile("./input/day12.txt");
|
||||||
|
//const input =
|
||||||
|
// \\0:
|
||||||
|
// \\###
|
||||||
|
// \\##.
|
||||||
|
// \\##.
|
||||||
|
// \\
|
||||||
|
// \\1:
|
||||||
|
// \\###
|
||||||
|
// \\##.
|
||||||
|
// \\.##
|
||||||
|
// \\
|
||||||
|
// \\2:
|
||||||
|
// \\.##
|
||||||
|
// \\###
|
||||||
|
// \\##.
|
||||||
|
// \\
|
||||||
|
// \\3:
|
||||||
|
// \\##.
|
||||||
|
// \\###
|
||||||
|
// \\##.
|
||||||
|
// \\
|
||||||
|
// \\4:
|
||||||
|
// \\###
|
||||||
|
// \\#..
|
||||||
|
// \\###
|
||||||
|
// \\
|
||||||
|
// \\5:
|
||||||
|
// \\###
|
||||||
|
// \\.#.
|
||||||
|
// \\###
|
||||||
|
// \\
|
||||||
|
// \\4x4: 0 0 0 0 2 0
|
||||||
|
// \\12x5: 1 0 1 0 2 2
|
||||||
|
// \\12x5: 1 0 1 0 3 2
|
||||||
|
// ;
|
||||||
|
|
||||||
|
var lines = std.mem.tokenizeScalar(u8, input, '\n');
|
||||||
|
|
||||||
|
var presents: std.ArrayList(Present) = .empty;
|
||||||
|
defer presents.deinit(allocator);
|
||||||
|
|
||||||
|
var regions: std.ArrayList(Region) = .empty;
|
||||||
|
defer {
|
||||||
|
for (regions.items) |region| {
|
||||||
|
region.deinit(allocator);
|
||||||
|
}
|
||||||
|
regions.deinit(allocator);
|
||||||
|
}
|
||||||
|
|
||||||
|
while (lines.next()) |line| {
|
||||||
|
var semicolon_pos: usize = 0;
|
||||||
|
var x_pos: ?usize = null;
|
||||||
|
for (line, 0..) |c, i| {
|
||||||
|
switch (c) {
|
||||||
|
'x' => x_pos = i,
|
||||||
|
':' => {
|
||||||
|
semicolon_pos = i;
|
||||||
|
break;
|
||||||
|
},
|
||||||
|
else => {},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (semicolon_pos != 0) {
|
||||||
|
if (x_pos) |p| {
|
||||||
|
// region
|
||||||
|
const width = try std.fmt.parseUnsigned(usize, line[0..p], 10);
|
||||||
|
const height = try std.fmt.parseUnsigned(usize, line[p + 1..semicolon_pos], 10);
|
||||||
|
|
||||||
|
var required_presents: std.ArrayList(u8) = .empty;
|
||||||
|
defer required_presents.deinit(allocator);
|
||||||
|
if (presents.items.len > 0) {
|
||||||
|
try required_presents.ensureTotalCapacity(allocator, presents.items.len);
|
||||||
|
}
|
||||||
|
|
||||||
|
var presents_iter = std.mem.tokenizeScalar(u8, line[semicolon_pos + 2..], ' ');
|
||||||
|
while (presents_iter.next()) |present| {
|
||||||
|
const amount = try std.fmt.parseUnsigned(u8, present, 10);
|
||||||
|
try required_presents.append(allocator, amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
const required_presents_slice = try required_presents.toOwnedSlice(allocator);
|
||||||
|
errdefer allocator.free(required_presents_slice);
|
||||||
|
|
||||||
|
const region: Region = .{
|
||||||
|
.width = width,
|
||||||
|
.height = height,
|
||||||
|
.required_presents = required_presents_slice,
|
||||||
|
};
|
||||||
|
try regions.append(allocator, region);
|
||||||
|
} else {
|
||||||
|
// present
|
||||||
|
var present: Present = .{
|
||||||
|
.shape = .initEmpty(),
|
||||||
|
};
|
||||||
|
for (0..Present.Width) |y| {
|
||||||
|
const l = lines.next() orelse unreachable;
|
||||||
|
for (0..Present.Width) |x| {
|
||||||
|
if (l[x] == '#') {
|
||||||
|
present.set(x, y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try presents.append(allocator, present);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var accumulator: usize = 0;
|
||||||
|
|
||||||
|
for (regions.items) |region| {
|
||||||
|
std.debug.print("{f}\n", .{region});
|
||||||
|
var area_needed: usize = 0;
|
||||||
|
for (region.required_presents, 0..) |amount, i| {
|
||||||
|
area_needed += amount * presents.items[i].area();
|
||||||
|
}
|
||||||
|
if (area_needed < region.area()) {
|
||||||
|
std.debug.print("{f}\nfits\n", .{region});
|
||||||
|
accumulator += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var buffer: [8]u8 = undefined;
|
||||||
|
var stdout_writer = std.fs.File.stdout().writer(&buffer);
|
||||||
|
const stdout = &stdout_writer.interface;
|
||||||
|
|
||||||
|
try stdout.print("{d}\n", .{accumulator});
|
||||||
|
|
||||||
|
try stdout.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Present = struct {
|
||||||
|
shape: std.bit_set.IntegerBitSet(Width * Width),
|
||||||
|
|
||||||
|
const Width = 3;
|
||||||
|
|
||||||
|
const Self = @This();
|
||||||
|
|
||||||
|
pub fn format(self: Self, w: *std.Io.Writer) std.Io.Writer.Error!void {
|
||||||
|
for (0..Width) |y| {
|
||||||
|
for (0..Width) |x| {
|
||||||
|
try w.writeByte(if (self.isSet(x, y)) '#' else '.');
|
||||||
|
}
|
||||||
|
if (y < Width - 1) {
|
||||||
|
try w.writeByte('\n');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn set(self: *Self, x: usize, y: usize) void {
|
||||||
|
const index = (y * Width) + x;
|
||||||
|
self.shape.set(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn isSet(self: Self, x: usize, y: usize) bool {
|
||||||
|
const index = (y * Width) + x;
|
||||||
|
return self.shape.isSet(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn area(self: Self) usize {
|
||||||
|
return self.shape.count();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const Region = struct {
|
||||||
|
width: usize,
|
||||||
|
height: usize,
|
||||||
|
required_presents: []u8,
|
||||||
|
|
||||||
|
const Self = @This();
|
||||||
|
|
||||||
|
pub fn deinit(self: Self, allocator: std.mem.Allocator) void {
|
||||||
|
allocator.free(self.required_presents);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn format(self: Self, w: *std.Io.Writer) std.Io.Writer.Error!void {
|
||||||
|
try w.print("{d}x{d}: ", .{self.width, self.height});
|
||||||
|
for (self.required_presents, 0..) |present, i| {
|
||||||
|
try w.print("{d}", .{present});
|
||||||
|
if (i < self.required_presents.len - 1) {
|
||||||
|
try w.writeByte(' ');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn createEmpty(self: Self, allocator: std.mem.Allocator) !EmptyRegion {
|
||||||
|
return try .init(allocator, self.width, self.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn area(self: Self) usize {
|
||||||
|
return self.width * self.height;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const EmptyRegion = struct {
|
||||||
|
grid: [][]bool,
|
||||||
|
filled_spaces: usize,
|
||||||
|
|
||||||
|
allocator: std.mem.Allocator,
|
||||||
|
|
||||||
|
const Self = @This();
|
||||||
|
|
||||||
|
pub fn init(allocator: std.mem.Allocator, width: u8, height: u8) !Self {
|
||||||
|
const h = try allocator.alloc([]bool, height);
|
||||||
|
for (0..height) |i| {
|
||||||
|
const w = try allocator.alloc(u8, width);
|
||||||
|
@memset(w, false);
|
||||||
|
h[i] = w;
|
||||||
|
}
|
||||||
|
return .{
|
||||||
|
.grid = h,
|
||||||
|
.filled_spaces = 0,
|
||||||
|
.allocator = allocator,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn deinit(self: Self) void {
|
||||||
|
for (self.grid) |row| {
|
||||||
|
self.allocator.free(row);
|
||||||
|
}
|
||||||
|
self.allocator.free(self.grid);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn fits(self: Self, present: Present) bool {
|
||||||
|
std.debug.assert(self.grid.len > 0);
|
||||||
|
const size = self.grid.len * self.grid[0].len;
|
||||||
|
if ((size - self.filled_spaces) < present.shape.count()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Implementation
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
|
||||||
142
src/days/input/day07.txt
Executable file
142
src/days/input/day07.txt
Executable file
|
|
@ -0,0 +1,142 @@
|
||||||
|
......................................................................S......................................................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
......................................................................^......................................................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
.....................................................................^.^.....................................................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
....................................................................^.^.^....................................................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
...................................................................^...^.^...................................................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
..................................................................^.^...^.^..................................................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
.................................................................^...^.^.^.^.................................................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
................................................................^.^.........^................................................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
...............................................................^.^...^.^.^.^.^...............................................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
..............................................................^.^.^.^.^.^.....^..............................................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
.............................................................^.^.....^...^.^.^.^.............................................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
............................................................^...^.....^.^...^.^.^............................................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
...........................................................^.....^.^.^.^.^.^.^.^.^...........................................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
..........................................................^...^...^.....^.^...^.^.^..........................................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
.........................................................^.^.....^.^.....^.^.^.^.^.^.........................................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
........................................................^...^.^.^.^...^.^.....^.....^........................................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
.......................................................^.^.^.^.^.^.....^.....^.^.^.^.^.......................................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
......................................................^.^.....^.^.^.....^.^...^...^.^.^......................................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
.....................................................^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.....................................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
....................................................^.^.^...^.^.^.^.^.^.^.^...^...^.^.^.^....................................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
...................................................^.^...^.^.^.^.^.^...^.^.^.^.^...^...^.^...................................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
..................................................^.^.^.^...^.^.^.^.^.^.^...^.^...^.^...^.^..................................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
.................................................^.^.^.^...^.^.......^.^.^.^.....^.^.^.^.^.^.................................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
................................................^...^.^.^.^.^.^.^.^.^.^.....^.^.^...^.^.^...^................................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
...............................................^.....^...^.^.^.^.^...^...^.^.^.^.^.^.^.^...^.^...............................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
..............................................^...^.^...^.^...^.....^.^.^.^.^.^...^.^.^.......^..............................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
.............................................^.^.^.^.^...^.^.^.^.^.^...^.....^.^.....^.^.^...^.^.............................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
............................................^.^.^.^.^.^.^.^.^.^.^...^.^.....^...^.^...^.^.^.^...^............................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
...........................................^.^.....^.^.....^.^.^.^.^.^.^.^.^.^...^.^...^.^.^.....^...........................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
..........................................^.^.^...^.....^.^.^.^.^...^.^.....^.^.^.^...^...^.^...^.^..........................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
.........................................^.^...^.^.^.^.^.^.^.^.^.^.^.....^.....^.^.^.^.^.^.^.^.^.^.^.........................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
........................................^.....^.^...^.^.^.^.....^.^.^.^...^...^.^.^.^.^...^.^...^.^.^........................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
.......................................^.^.^.^.....^.^.^.......^.^.........^...^.^.^.^.....^.^.....^.^.......................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
......................................^.^.....^.^.^...^.^...^.^.......^.^...^.^.^.^.^.^...^.....^.^...^......................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
.....................................^.^.^...^.^.^.^.^.....^.^...^.....^.....^...^.^...^.......^.^.^.^.^.....................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
....................................^.^.^...^...^.^.^...^.^...^.^.^.^.......^.....^.....^.^.......^.^.^.^....................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
...................................^.^.^.^.^...^...^.^.^.^.^.^.^.^.^.^.......^.^...^.^...^.^.^.^.^...^.^.^...................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
..................................^...^.^.^.^...^.......^.^.^...^.^.......^.^.^.....^...^...^.^.^...^.^...^..................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
.................................^...^.......^.^.^.....^.^...^.^...^.^.^.^.^.^.....^.^...^...^.^.^...^...^.^.................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
................................^.^.^...^.^.^.^.^.^.^...^...^.^.......^.^...^.^.^...^.^...^.^.^.^.^...^...^.^................................
|
||||||
|
.............................................................................................................................................
|
||||||
|
...............................^.^.....^.^.^...^.^.^.^...^.........^.^.^.^.........^.^.^...........^.^.^.^...^...............................
|
||||||
|
.............................................................................................................................................
|
||||||
|
..............................^.^...^.^...^...^...^...^.^.^.^.^.^...^.^.^...^.^.^...^.....^.^.^...^...^.^.^...^..............................
|
||||||
|
.............................................................................................................................................
|
||||||
|
.............................^.^.^.^.^.^.^.....^.^.^.^.^.^.....^...^.^.^.......^.^.^.^.....^.........^.^.^.....^.............................
|
||||||
|
.............................................................................................................................................
|
||||||
|
............................^...^...^.^.^...^...^.^.^.^.^.^.^.^.^.^.......^.^.......^.^.....^.^.^.^...^.^...^...^............................
|
||||||
|
.............................................................................................................................................
|
||||||
|
...........................^.^.^...^.^.^.....^.....^.^.......^.^.^.....^.^.^...^.....^...^.^.^.^.....^.^.^.^.^.^.^...........................
|
||||||
|
.............................................................................................................................................
|
||||||
|
..........................^.....^.....^.^...^.^.^.^.^.^...^.^.^.^.^.^...^.^...^.^.^...^.^.^.....^.^.^...^.^...^...^..........................
|
||||||
|
.............................................................................................................................................
|
||||||
|
.........................^.^...^.^.^.^...^.^...^.^.........^.......^.^.^.^.^.^...^.^.^.^.^.^.^...^.^.^...^.^.^.^...^.........................
|
||||||
|
.............................................................................................................................................
|
||||||
|
........................^...^.^.^.^...^.^...^...^.^...^.^.^...^.^.^.^.^.^...^.^.^...^.......^.^.^.^.^...^.....^...^.^........................
|
||||||
|
.............................................................................................................................................
|
||||||
|
.......................^.^.^...^.^.^.....^.^...^.^.^...^...^.^.^...^.^.^...^.^.....^.^.^.^.^...^.^.........^.^.^.^.^.^.......................
|
||||||
|
.............................................................................................................................................
|
||||||
|
......................^.^.^.^...^.^.^.^.^.....^.^.^.....^.^.^.^.^...^.^.^.....^.^.....^...^.^.^.^.....^...........^.^.^......................
|
||||||
|
.............................................................................................................................................
|
||||||
|
.....................^.^.^.^.^.^...^.^.^.^.^.....^.^...^...^...^.^.^.^.^.....^.^.^.....^.^...^.......^.^.^.....^.^.^.^.^.....................
|
||||||
|
.............................................................................................................................................
|
||||||
|
....................^...^.^.......^.^.^.^.^.^.........^.^.^.^.......^.^...^.^.^.^.^.^.^.^.^...^.^.^.....^.^.^.^.^.^.^.^.^....................
|
||||||
|
.............................................................................................................................................
|
||||||
|
...................^.^.......^.^...^.^.^.^.^.^...^.^...^.^...^.....^.^.^...^.^...^.^.^.^.^...^...^.^.....^.^...^.^.^.^.^.^...................
|
||||||
|
.............................................................................................................................................
|
||||||
|
..................^.^.........^.^.^...^.^...^...^.^.^.^.^.^.^.^.^.^.^.^...^.^.^.^.^.^.^.^.^.^.^...^.^.^.^.^...^.....^...^.^..................
|
||||||
|
.............................................................................................................................................
|
||||||
|
.................^.^.^...^.^.^.^.^.......^.^.....^.^...^.^.^...^.^.^...^.^.^.^.^...^.......^.^...^.^.^.........^.^...^.^.^.^.................
|
||||||
|
.............................................................................................................................................
|
||||||
|
................^.....^.^.^...^.^.^.^.^...^.^.^.^.^.^.^.^...^.^.^.^.^.^.^...^...^.^...^.^.^.^...^.^.^.^.^.^.....^...^.....^.^................
|
||||||
|
.............................................................................................................................................
|
||||||
|
...............^.....^.^.^.^.^.^.^.^.^.^...^.^...^...^...^...^...^.^.^.^.........^.^.^.^.^...^.....^.^.......^...^...^.^.^.^.^...............
|
||||||
|
.............................................................................................................................................
|
||||||
|
..............^.^.^.^.^.^.^...^.^.^.^.^.^.^.^...^.^.^.^...^.^...^.^.^.^.^...^.^.^.^.^.^.^.^.....^.^...^.^.^.^.^...^.....^.....^..............
|
||||||
|
.............................................................................................................................................
|
||||||
|
.............^.^...^.^.....^.......^.....^.....^.^...^.^.^.^.....^.^.....^.....^.^...^.^.^.^.^...^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.............
|
||||||
|
.............................................................................................................................................
|
||||||
|
............^.^...^.^.....^.^.^.^.^.^.^.^...^...^.^.^.^.^.^.^.^.^.^.^...^.....^.^...^...^.........^.^...^.^...^.^.^.^.^.^.^.^...^............
|
||||||
|
.............................................................................................................................................
|
||||||
|
...........^...^.^.^...^.^...^...^.^...^...^.^.^.^...^.^.^...^.^.^.^.^...^.^.^.^.^.^.^.^.^.^.^.^.....^.^.^.^.^...^.^.^.....^.^.^.^...........
|
||||||
|
.............................................................................................................................................
|
||||||
|
..........^.^.........^.^...^.....^.^.^.^.^.^.^.^...^...^...^.^.^.^.^...^.^.^...^...^...^.^.^...^.^.^.^...^.^.^.^...^.....^...^...^..........
|
||||||
|
.............................................................................................................................................
|
||||||
|
.........^.^.^.^...^...^.^.^.^...^.^.^.^.^.^.....^...^.^.....^.^...^...^.^...^.^.^.^...^.^...^...^.^.^.^...^...^.....^.^.^...^...^.^.........
|
||||||
|
.............................................................................................................................................
|
||||||
|
........^...^.^.^.^...^.^.^.^.^.^.^...^.^.^.........^...^.^.^.^.....^.^...^.^.^.^.^.....^.^.^.^.^.^.^.^.^.^...^.^.^.....^.^.....^.^.^........
|
||||||
|
.............................................................................................................................................
|
||||||
|
.......^.......^.^.^.^...^.^...^.^...^.^.^.^.^.^.^.^.^...^.^.^...^...^...^.^.^...^.^.^...^.^.^.^.^.^.^...^.^.....^.^.^...^.^.^...^.^.^.......
|
||||||
|
.............................................................................................................................................
|
||||||
|
......^...^...^.^.....^.^.^.^.^.^.^...^.^.^.^...^.^.^...^.^.^.....^.^.^.....^.^.^.^.^...^.^.^.^.....^.^.^...^.^.^.....^.^.^.^.^.^...^.^......
|
||||||
|
.............................................................................................................................................
|
||||||
|
.....^.....^.^.^.^.^...^.........^.....^.......^.^.^...^.^.......^.^.^.^...^.^.^.^.^...^.^.^.^.^.^.^...^...^.^.^...^...^.^...^.^.....^.^.....
|
||||||
|
.............................................................................................................................................
|
||||||
|
....^.^.^.^...^.^.^.^.^.^.^...^.^.^.^.....^.^.^.....^.^.^.^...^.....^.^.....^...^.^...^.^.^.^.^.^.^.^.^.^.^.^.^.^...^.^.^...^.^.^...^...^....
|
||||||
|
.............................................................................................................................................
|
||||||
|
...^...^.^.^.^.^.^...^.^.^.^.^.^.^.^.....^...^.^.^.^.^.^.....^.^.^.^.^.^...^.......^.^...^...^.^.^.^...^.^.^...^.^.^.^.^.^.^.^...^.^.^...^...
|
||||||
|
.............................................................................................................................................
|
||||||
|
..^.^.^.^...^.^.^.^.^...^.....^...^.^.^...^...^.^.^.^...^...^.^.^...^...........^.^.^.^.......^...^...^.^.^.^.^.^.^.^.^.^.^...^.^.^.^.^.^.^..
|
||||||
|
.............................................................................................................................................
|
||||||
|
.^.^.^.^.^.^.^.^.^.^.^.......^.^.^.^.^.^.^.^...^.^...^.^.^.^.^.^.^...^.^.^.^.^.^.^.^.^.^.....^.^.......^.^.^.^.^...^...^.^.^.^.......^.....^.
|
||||||
|
.............................................................................................................................................
|
||||||
496
src/days/input/day09.txt
Executable file
496
src/days/input/day09.txt
Executable file
|
|
@ -0,0 +1,496 @@
|
||||||
|
98241,50245
|
||||||
|
98241,51464
|
||||||
|
98122,51464
|
||||||
|
98122,52660
|
||||||
|
97649,52660
|
||||||
|
97649,53867
|
||||||
|
97585,53867
|
||||||
|
97585,55104
|
||||||
|
97774,55104
|
||||||
|
97774,56255
|
||||||
|
97196,56255
|
||||||
|
97196,57546
|
||||||
|
97636,57546
|
||||||
|
97636,58780
|
||||||
|
97591,58780
|
||||||
|
97591,59958
|
||||||
|
97238,59958
|
||||||
|
97238,61063
|
||||||
|
96596,61063
|
||||||
|
96596,62184
|
||||||
|
96091,62184
|
||||||
|
96091,63423
|
||||||
|
96024,63423
|
||||||
|
96024,64739
|
||||||
|
96152,64739
|
||||||
|
96152,65592
|
||||||
|
94869,65592
|
||||||
|
94869,66846
|
||||||
|
94784,66846
|
||||||
|
94784,67925
|
||||||
|
94219,67925
|
||||||
|
94219,69237
|
||||||
|
94206,69237
|
||||||
|
94206,70195
|
||||||
|
93369,70195
|
||||||
|
93369,71228
|
||||||
|
92725,71228
|
||||||
|
92725,72421
|
||||||
|
92396,72421
|
||||||
|
92396,73353
|
||||||
|
91573,73353
|
||||||
|
91573,74531
|
||||||
|
91190,74531
|
||||||
|
91190,75402
|
||||||
|
90295,75402
|
||||||
|
90295,76446
|
||||||
|
89686,76446
|
||||||
|
89686,77385
|
||||||
|
88921,77385
|
||||||
|
88921,78413
|
||||||
|
88284,78413
|
||||||
|
88284,79671
|
||||||
|
87931,79671
|
||||||
|
87931,80568
|
||||||
|
87102,80568
|
||||||
|
87102,81220
|
||||||
|
85994,81220
|
||||||
|
85994,82478
|
||||||
|
85581,82478
|
||||||
|
85581,83480
|
||||||
|
84863,83480
|
||||||
|
84863,83949
|
||||||
|
83605,83949
|
||||||
|
83605,84603
|
||||||
|
82559,84603
|
||||||
|
82559,85593
|
||||||
|
81829,85593
|
||||||
|
81829,86686
|
||||||
|
81171,86686
|
||||||
|
81171,87253
|
||||||
|
80061,87253
|
||||||
|
80061,87969
|
||||||
|
79082,87969
|
||||||
|
79082,88669
|
||||||
|
78093,88669
|
||||||
|
78093,89502
|
||||||
|
77196,89502
|
||||||
|
77196,90250
|
||||||
|
76233,90250
|
||||||
|
76233,91130
|
||||||
|
75347,91130
|
||||||
|
75347,91250
|
||||||
|
74000,91250
|
||||||
|
74000,92327
|
||||||
|
73212,92327
|
||||||
|
73212,92894
|
||||||
|
72128,92894
|
||||||
|
72128,93270
|
||||||
|
70952,93270
|
||||||
|
70952,93370
|
||||||
|
69660,93370
|
||||||
|
69660,94478
|
||||||
|
68819,94478
|
||||||
|
68819,94708
|
||||||
|
67595,94708
|
||||||
|
67595,95183
|
||||||
|
66472,95183
|
||||||
|
66472,95207
|
||||||
|
65195,95207
|
||||||
|
65195,96147
|
||||||
|
64221,96147
|
||||||
|
64221,96615
|
||||||
|
63081,96615
|
||||||
|
63081,96461
|
||||||
|
61777,96461
|
||||||
|
61777,97201
|
||||||
|
60700,97201
|
||||||
|
60700,97015
|
||||||
|
59412,97015
|
||||||
|
59412,97740
|
||||||
|
58305,97740
|
||||||
|
58305,97562
|
||||||
|
57038,97562
|
||||||
|
57038,97176
|
||||||
|
55764,97176
|
||||||
|
55764,97302
|
||||||
|
54566,97302
|
||||||
|
54566,97656
|
||||||
|
53385,97656
|
||||||
|
53385,98146
|
||||||
|
52195,98146
|
||||||
|
52195,97889
|
||||||
|
50969,97889
|
||||||
|
50969,97871
|
||||||
|
49756,97871
|
||||||
|
49756,97859
|
||||||
|
48543,97859
|
||||||
|
48543,97449
|
||||||
|
47351,97449
|
||||||
|
47351,97738
|
||||||
|
46119,97738
|
||||||
|
46119,97642
|
||||||
|
44909,97642
|
||||||
|
44909,97226
|
||||||
|
43740,97226
|
||||||
|
43740,97219
|
||||||
|
42519,97219
|
||||||
|
42519,96788
|
||||||
|
41367,96788
|
||||||
|
41367,97309
|
||||||
|
40026,97309
|
||||||
|
40026,96882
|
||||||
|
38868,96882
|
||||||
|
38868,96221
|
||||||
|
37780,96221
|
||||||
|
37780,95804
|
||||||
|
36640,95804
|
||||||
|
36640,96136
|
||||||
|
35265,96136
|
||||||
|
35265,95792
|
||||||
|
34086,95792
|
||||||
|
34086,94892
|
||||||
|
33112,94892
|
||||||
|
33112,94733
|
||||||
|
31866,94733
|
||||||
|
31866,94172
|
||||||
|
30777,94172
|
||||||
|
30777,93317
|
||||||
|
29828,93317
|
||||||
|
29828,92857
|
||||||
|
28705,92857
|
||||||
|
28705,92156
|
||||||
|
27705,92156
|
||||||
|
27705,91484
|
||||||
|
26696,91484
|
||||||
|
26696,91543
|
||||||
|
25258,91543
|
||||||
|
25258,90924
|
||||||
|
24200,90924
|
||||||
|
24200,90213
|
||||||
|
23201,90213
|
||||||
|
23201,89043
|
||||||
|
22528,89043
|
||||||
|
22528,88927
|
||||||
|
21108,88927
|
||||||
|
21108,88089
|
||||||
|
20204,88089
|
||||||
|
20204,87315
|
||||||
|
19255,87315
|
||||||
|
19255,86250
|
||||||
|
18557,86250
|
||||||
|
18557,85773
|
||||||
|
17347,85773
|
||||||
|
17347,84679
|
||||||
|
16696,84679
|
||||||
|
16696,83809
|
||||||
|
15843,83809
|
||||||
|
15843,82679
|
||||||
|
15268,82679
|
||||||
|
15268,82055
|
||||||
|
14153,82055
|
||||||
|
14153,81303
|
||||||
|
13157,81303
|
||||||
|
13157,80213
|
||||||
|
12558,80213
|
||||||
|
12558,79102
|
||||||
|
12004,79102
|
||||||
|
12004,78475
|
||||||
|
10804,78475
|
||||||
|
10804,76971
|
||||||
|
10824,76971
|
||||||
|
10824,76102
|
||||||
|
9952,76102
|
||||||
|
9952,75038
|
||||||
|
9369,75038
|
||||||
|
9369,74238
|
||||||
|
8339,74238
|
||||||
|
8339,72905
|
||||||
|
8231,72905
|
||||||
|
8231,71987
|
||||||
|
7378,71987
|
||||||
|
7378,70721
|
||||||
|
7205,70721
|
||||||
|
7205,69997
|
||||||
|
5885,69997
|
||||||
|
5885,68793
|
||||||
|
5582,68793
|
||||||
|
5582,67760
|
||||||
|
4871,67760
|
||||||
|
4871,66522
|
||||||
|
4679,66522
|
||||||
|
4679,65214
|
||||||
|
4737,65214
|
||||||
|
4737,64207
|
||||||
|
3895,64207
|
||||||
|
3895,62932
|
||||||
|
3915,62932
|
||||||
|
3915,61848
|
||||||
|
3259,61848
|
||||||
|
3259,60571
|
||||||
|
3366,60571
|
||||||
|
3366,59436
|
||||||
|
2864,59436
|
||||||
|
2864,58155
|
||||||
|
3122,58155
|
||||||
|
3122,57084
|
||||||
|
2124,57084
|
||||||
|
2124,55838
|
||||||
|
2213,55838
|
||||||
|
2213,54652
|
||||||
|
1807,54652
|
||||||
|
1807,53424
|
||||||
|
1794,53424
|
||||||
|
1794,52197
|
||||||
|
1810,52197
|
||||||
|
1810,50973
|
||||||
|
1890,50973
|
||||||
|
1890,50228
|
||||||
|
94822,50228
|
||||||
|
94822,48525
|
||||||
|
1557,48525
|
||||||
|
1557,47341
|
||||||
|
2383,47341
|
||||||
|
2383,46107
|
||||||
|
2110,46107
|
||||||
|
2110,44867
|
||||||
|
1961,44867
|
||||||
|
1961,43734
|
||||||
|
2727,43734
|
||||||
|
2727,42467
|
||||||
|
2452,42467
|
||||||
|
2452,41283
|
||||||
|
2754,41283
|
||||||
|
2754,40077
|
||||||
|
2933,40077
|
||||||
|
2933,38872
|
||||||
|
3134,38872
|
||||||
|
3134,37713
|
||||||
|
3522,37713
|
||||||
|
3522,36439
|
||||||
|
3506,36439
|
||||||
|
3506,35262
|
||||||
|
3852,35262
|
||||||
|
3852,34252
|
||||||
|
4684,34252
|
||||||
|
4684,33262
|
||||||
|
5505,33262
|
||||||
|
5505,32101
|
||||||
|
5846,32101
|
||||||
|
5846,31022
|
||||||
|
6392,31022
|
||||||
|
6392,29688
|
||||||
|
6381,29688
|
||||||
|
6381,28480
|
||||||
|
6689,28480
|
||||||
|
6689,27621
|
||||||
|
7685,27621
|
||||||
|
7685,26247
|
||||||
|
7715,26247
|
||||||
|
7715,25643
|
||||||
|
9102,25643
|
||||||
|
9102,24398
|
||||||
|
9389,24398
|
||||||
|
9389,23514
|
||||||
|
10255,23514
|
||||||
|
10255,22573
|
||||||
|
11021,22573
|
||||||
|
11021,21166
|
||||||
|
11150,21166
|
||||||
|
11150,20538
|
||||||
|
12337,20538
|
||||||
|
12337,19792
|
||||||
|
13336,19792
|
||||||
|
13336,18451
|
||||||
|
13627,18451
|
||||||
|
13627,17941
|
||||||
|
14878,17941
|
||||||
|
14878,16560
|
||||||
|
15179,16560
|
||||||
|
15179,15977
|
||||||
|
16322,15977
|
||||||
|
16322,14917
|
||||||
|
16989,14917
|
||||||
|
16989,14500
|
||||||
|
18254,14500
|
||||||
|
18254,13050
|
||||||
|
18605,13050
|
||||||
|
18605,12768
|
||||||
|
19956,12768
|
||||||
|
19956,11585
|
||||||
|
20576,11585
|
||||||
|
20576,11164
|
||||||
|
21786,11164
|
||||||
|
21786,10359
|
||||||
|
22708,10359
|
||||||
|
22708,9858
|
||||||
|
23836,9858
|
||||||
|
23836,8777
|
||||||
|
24596,8777
|
||||||
|
24596,8258
|
||||||
|
25713,8258
|
||||||
|
25713,7978
|
||||||
|
26955,7978
|
||||||
|
26955,7540
|
||||||
|
28095,7540
|
||||||
|
28095,6507
|
||||||
|
28940,6507
|
||||||
|
28940,6682
|
||||||
|
30363,6682
|
||||||
|
30363,6251
|
||||||
|
31489,6251
|
||||||
|
31489,5782
|
||||||
|
32598,5782
|
||||||
|
32598,4548
|
||||||
|
33429,4548
|
||||||
|
33429,4750
|
||||||
|
34790,4750
|
||||||
|
34790,4015
|
||||||
|
35829,4015
|
||||||
|
35829,4049
|
||||||
|
37104,4049
|
||||||
|
37104,3690
|
||||||
|
38261,3690
|
||||||
|
38261,2708
|
||||||
|
39279,2708
|
||||||
|
39279,3314
|
||||||
|
40653,3314
|
||||||
|
40653,2568
|
||||||
|
41748,2568
|
||||||
|
41748,2300
|
||||||
|
42941,2300
|
||||||
|
42941,2002
|
||||||
|
44135,2002
|
||||||
|
44135,2479
|
||||||
|
45412,2479
|
||||||
|
45412,1845
|
||||||
|
46579,1845
|
||||||
|
46579,2346
|
||||||
|
47826,2346
|
||||||
|
47826,2049
|
||||||
|
49029,2049
|
||||||
|
49029,2462
|
||||||
|
50242,2462
|
||||||
|
50242,2326
|
||||||
|
51451,2326
|
||||||
|
51451,1711
|
||||||
|
52695,1711
|
||||||
|
52695,1956
|
||||||
|
53904,1956
|
||||||
|
53904,1808
|
||||||
|
55148,1808
|
||||||
|
55148,2309
|
||||||
|
56320,2309
|
||||||
|
56320,3006
|
||||||
|
57444,3006
|
||||||
|
57444,3165
|
||||||
|
58640,3165
|
||||||
|
58640,3456
|
||||||
|
59812,3456
|
||||||
|
59812,3478
|
||||||
|
61045,3478
|
||||||
|
61045,3412
|
||||||
|
62316,3412
|
||||||
|
62316,4049
|
||||||
|
63401,4049
|
||||||
|
63401,4368
|
||||||
|
64572,4368
|
||||||
|
64572,4266
|
||||||
|
65892,4266
|
||||||
|
65892,5403
|
||||||
|
66775,5403
|
||||||
|
66775,5880
|
||||||
|
67884,5880
|
||||||
|
67884,6132
|
||||||
|
69090,6132
|
||||||
|
69090,6792
|
||||||
|
70119,6792
|
||||||
|
70119,6784
|
||||||
|
71472,6784
|
||||||
|
71472,7784
|
||||||
|
72326,7784
|
||||||
|
72326,8026
|
||||||
|
73577,8026
|
||||||
|
73577,8876
|
||||||
|
74490,8876
|
||||||
|
74490,8978
|
||||||
|
75860,8978
|
||||||
|
75860,9930
|
||||||
|
76701,9930
|
||||||
|
76701,10352
|
||||||
|
77896,10352
|
||||||
|
77896,11232
|
||||||
|
78772,11232
|
||||||
|
78772,11817
|
||||||
|
79867,11817
|
||||||
|
79867,12626
|
||||||
|
80792,12626
|
||||||
|
80792,14062
|
||||||
|
81171,14062
|
||||||
|
81171,14424
|
||||||
|
82471,14424
|
||||||
|
82471,15055
|
||||||
|
83557,15055
|
||||||
|
83557,16158
|
||||||
|
84188,16158
|
||||||
|
84188,16772
|
||||||
|
85314,16772
|
||||||
|
85314,18188
|
||||||
|
85573,18188
|
||||||
|
85573,18598
|
||||||
|
86957,18598
|
||||||
|
86957,19899
|
||||||
|
87301,19899
|
||||||
|
87301,20942
|
||||||
|
87937,20942
|
||||||
|
87937,21902
|
||||||
|
88675,21902
|
||||||
|
88675,22692
|
||||||
|
89662,22692
|
||||||
|
89662,23972
|
||||||
|
89932,23972
|
||||||
|
89932,24741
|
||||||
|
90987,24741
|
||||||
|
90987,25832
|
||||||
|
91538,25832
|
||||||
|
91538,27127
|
||||||
|
91708,27127
|
||||||
|
91708,28094
|
||||||
|
92461,28094
|
||||||
|
92461,29086
|
||||||
|
93191,29086
|
||||||
|
93191,30203
|
||||||
|
93671,30203
|
||||||
|
93671,31293
|
||||||
|
94211,31293
|
||||||
|
94211,32525
|
||||||
|
94402,32525
|
||||||
|
94402,33715
|
||||||
|
94665,33715
|
||||||
|
94665,34739
|
||||||
|
95400,34739
|
||||||
|
95400,35775
|
||||||
|
96158,35775
|
||||||
|
96158,36914
|
||||||
|
96627,36914
|
||||||
|
96627,38153
|
||||||
|
96733,38153
|
||||||
|
96733,39465
|
||||||
|
96473,39465
|
||||||
|
96473,40509
|
||||||
|
97404,40509
|
||||||
|
97404,41858
|
||||||
|
96797,41858
|
||||||
|
96797,42955
|
||||||
|
97601,42955
|
||||||
|
97601,44214
|
||||||
|
97352,44214
|
||||||
|
97352,45389
|
||||||
|
97756,45389
|
||||||
|
97756,46601
|
||||||
|
97847,46601
|
||||||
|
97847,47809
|
||||||
|
98021,47809
|
||||||
|
98021,49037
|
||||||
|
97534,49037
|
||||||
|
97534,50245
|
||||||
609
src/days/input/day11.txt
Executable file
609
src/days/input/day11.txt
Executable file
|
|
@ -0,0 +1,609 @@
|
||||||
|
smx: otc
|
||||||
|
mmh: gvp
|
||||||
|
gbo: hyf alz
|
||||||
|
laa: vky qjq
|
||||||
|
vrn: tbs tsr jix
|
||||||
|
xyl: xel eur wdj
|
||||||
|
sxm: out
|
||||||
|
wsd: kua hpv jep
|
||||||
|
qsj: ulu xel eur wdj
|
||||||
|
xwa: mtd xxf hnw
|
||||||
|
kai: ehr kaj
|
||||||
|
uuj: you
|
||||||
|
owb: ixr bps pim eez ejn syt qrx hxw vsy ghl gfu cgh mpk kfj
|
||||||
|
vky: owb wlw qic
|
||||||
|
ysd: mkp jbf btz xgg gbk tvg iju amm dws ykz azc blh xld rpr uek rcl zzy jhu
|
||||||
|
rbc: ski xyl sdx wpw
|
||||||
|
zmc: pal lwb rns hex
|
||||||
|
cuu: vyo
|
||||||
|
bqf: kmy exx ish
|
||||||
|
jbv: ysa
|
||||||
|
aog: ayv kwq
|
||||||
|
fcq: qic xss owb
|
||||||
|
hyg: out
|
||||||
|
xoz: llx kra cqn bzn swe tdo vnz zos duw
|
||||||
|
gnq: eya
|
||||||
|
qmk: fcq lyd
|
||||||
|
ggp: brz eya
|
||||||
|
oit: yyy quh brz
|
||||||
|
hjl: dtj lnc jps fyr
|
||||||
|
sqg: xbz upq
|
||||||
|
nil: diq
|
||||||
|
xqa: jei ipw tkt
|
||||||
|
ond: fft jko dqj pxe
|
||||||
|
and: ahn izm esa
|
||||||
|
cqf: xss
|
||||||
|
rqa: ryb rwu ono fyb
|
||||||
|
jps: byj fmv shn
|
||||||
|
ccg: ond afk tbu
|
||||||
|
dta: ctq jbw whr smq
|
||||||
|
ztx: hlm ctr vgo maf fkj
|
||||||
|
sdx: xel eur
|
||||||
|
xwb: dds
|
||||||
|
clh: ktb
|
||||||
|
rtn: quh eya
|
||||||
|
dac: nxc vug eou
|
||||||
|
nvh: kmf yga wtv
|
||||||
|
xgw: kep unr lju mtm
|
||||||
|
mdx: qmk fwk fbd
|
||||||
|
tbu: fft dqj pxe
|
||||||
|
vil: lyz aek
|
||||||
|
ona: zjk ovx dmv laa
|
||||||
|
bld: zbs
|
||||||
|
rms: vjs znm
|
||||||
|
oku: brz yyy
|
||||||
|
bzn: dmc fwa ykh vrn axj
|
||||||
|
uzl: ayv fuz qhs kwq
|
||||||
|
bhz: ggv
|
||||||
|
kfj: xqa ucr akl
|
||||||
|
koi: szi
|
||||||
|
mvo: dqp kjr rbc
|
||||||
|
rof: vgo hlm
|
||||||
|
ixt: jws nxc vug
|
||||||
|
ycf: out
|
||||||
|
dmc: tsr
|
||||||
|
nam: mvo
|
||||||
|
rkj: quh yyy eya brz
|
||||||
|
qxk: uty
|
||||||
|
lwb: phc esx
|
||||||
|
fqf: isr dax
|
||||||
|
eou: lqz ysd
|
||||||
|
lbb: out
|
||||||
|
hyf: fgh wem yen taw
|
||||||
|
dfv: nzl
|
||||||
|
pnh: lai
|
||||||
|
jon: eya
|
||||||
|
guf: shn
|
||||||
|
lmw: hlu mhq
|
||||||
|
jff: ngn gye
|
||||||
|
xxj: guf dtj lnc
|
||||||
|
fbd: fcq lyd
|
||||||
|
idw: cmg phc
|
||||||
|
zbs: hjl
|
||||||
|
lqz: blh ttg ykz jhu zzy uek rcl bld xgg gbk mkp amm iju tvg
|
||||||
|
shn: goi
|
||||||
|
hdc: wap pvr
|
||||||
|
odf: yey ggp jtc
|
||||||
|
rkk: zyi ubs
|
||||||
|
fyr: fmv vtv
|
||||||
|
pxe: ztx mmi
|
||||||
|
ntf: dds cst aff
|
||||||
|
lyz: gwp
|
||||||
|
pyt: zpv ias oiz
|
||||||
|
cqx: rod jnp
|
||||||
|
dtj: shn vtv
|
||||||
|
gfu: kai ctq
|
||||||
|
ycw: ryl ixt uut dac
|
||||||
|
yvb: jbv rms fez
|
||||||
|
lvx: tvz vyo
|
||||||
|
pvr: yat
|
||||||
|
oiz: zjk ovx dmv
|
||||||
|
biy: tdg
|
||||||
|
xbz: cqf
|
||||||
|
obk: jje
|
||||||
|
jcc: ssq daa
|
||||||
|
elu: ihl kep lju unr
|
||||||
|
jgf: qfx bhz
|
||||||
|
wbp: xxj cap hjl
|
||||||
|
nne: out
|
||||||
|
llx: axj ykh
|
||||||
|
kso: kuk ams
|
||||||
|
eod: nzl aap
|
||||||
|
ryl: nxc
|
||||||
|
epd: eou jws ats nxc vug
|
||||||
|
wqg: uzn yyf
|
||||||
|
qhh: lqz
|
||||||
|
fhu: hex idw pal
|
||||||
|
ipt: ema
|
||||||
|
vpo: cap xxj
|
||||||
|
thl: azd otc
|
||||||
|
ttg: vpo
|
||||||
|
uty: owb qic
|
||||||
|
brz: mdl eiw gam aog nam wqg jcc kgs nac bsk zpk kul snr uzl
|
||||||
|
faw: out
|
||||||
|
lzw: wlw xss owb qic
|
||||||
|
wap: iel yat qhh paa
|
||||||
|
ffr: vnn fiv
|
||||||
|
nug: sqg eyp sws eai dsh icy zrp mas dmf ccg hoq qze qde cqt zvl jrq gep
|
||||||
|
ygk: jon oit
|
||||||
|
eya: ppx nac mdl dej
|
||||||
|
lnc: byj fmv shn
|
||||||
|
nhq: kjv
|
||||||
|
biq: lav xhe vcg
|
||||||
|
hfn: pvr ydj
|
||||||
|
leg: oii zad jje
|
||||||
|
fft: rof taz
|
||||||
|
maf: qic
|
||||||
|
aap: rkj hrs svl
|
||||||
|
axv: esa
|
||||||
|
zou: ulu eur xel
|
||||||
|
jtc: yyy
|
||||||
|
pxc: gvr dyo omt
|
||||||
|
byj: nqz goi faw
|
||||||
|
ykh: jix tbs tsr
|
||||||
|
fai: cst nug aff
|
||||||
|
oty: nhq
|
||||||
|
cek: vvv ubs zyi
|
||||||
|
ufu: zen
|
||||||
|
xtk: kpg tap qzv
|
||||||
|
kil: dds aff
|
||||||
|
ojk: lqz
|
||||||
|
aly: qak lqz
|
||||||
|
xxf: aff cst dds
|
||||||
|
yua: oit ktb rwv
|
||||||
|
vlf: ujz
|
||||||
|
lbw: zyi uuj
|
||||||
|
zpk: nhp urn ctg
|
||||||
|
kuk: you ysd qak
|
||||||
|
tmy: esa
|
||||||
|
sqi: quh lvi
|
||||||
|
jrq: obk leg
|
||||||
|
yat: lqz
|
||||||
|
atl: zpv ias oiz ona obm
|
||||||
|
xhe: asz jbv
|
||||||
|
gdx: oii jje
|
||||||
|
ssq: fqf tap kpg qzv
|
||||||
|
quh: snr kul zpk bsk nac ufu yor dej ppx aog nam wqg eiw mdl
|
||||||
|
bvn: luk
|
||||||
|
zny: jon ktb rwv
|
||||||
|
jzw: aap plm
|
||||||
|
jqp: dac
|
||||||
|
mpk: euv llh
|
||||||
|
fpr: gwp zmc ulq fhu
|
||||||
|
ahn: qtl rtn
|
||||||
|
zyi: lqz ysd
|
||||||
|
ypn: mtd xxf
|
||||||
|
fgh: rkk
|
||||||
|
vgo: xss owb wlw
|
||||||
|
axj: jix tsr
|
||||||
|
kgv: kpg
|
||||||
|
gfa: ona obm zpv ias
|
||||||
|
eur: eij vil oxs xip hsd hdc gbo laz rnq lnj nuk xck twd jqp ycw btu abg koi cey hfn
|
||||||
|
bsk: oqd hmt kew
|
||||||
|
wrx: tas
|
||||||
|
jix: aff nug cst dds qvv
|
||||||
|
blc: yan
|
||||||
|
rwv: yyy quh eya brz
|
||||||
|
exx: blc dks
|
||||||
|
ujz: mwp
|
||||||
|
yyf: xya xmb fee
|
||||||
|
icq: mtm
|
||||||
|
hxw: viq eod
|
||||||
|
xii: fyb
|
||||||
|
lyb: drx mlf pkl
|
||||||
|
puw: ona ias
|
||||||
|
ilj: qfx xph
|
||||||
|
wlw: gfu ghl vlf cgh mpk yfx pbj qrx hxw jsq eez syt dta ejn bps hnj pim
|
||||||
|
icy: xbz
|
||||||
|
wdr: gbm kil
|
||||||
|
svl: lvi
|
||||||
|
dax: wdj eur
|
||||||
|
fwa: jix tsr
|
||||||
|
fyb: you ysd qak
|
||||||
|
whr: ehr kaj ogx nvh
|
||||||
|
agb: mag yan
|
||||||
|
duw: luk yzp nil
|
||||||
|
plg: yen taw fks wem fgh
|
||||||
|
zrp: pyt puw qyk gfa atl
|
||||||
|
phc: you qak lqz
|
||||||
|
aff: qze hoq qde mdx zvl jrq sqg dsh eai zrp icy mas dmf
|
||||||
|
ulu: lnj xck twd jqp btu ycw abg koi gqf hfn eij vil oxs xip nhi hsd hdc kku laz rnq
|
||||||
|
ezt: nug cst qvv dds
|
||||||
|
ccu: yyy brz eya
|
||||||
|
nuk: zpf
|
||||||
|
ubs: ysd
|
||||||
|
qyk: ona oiz
|
||||||
|
kua: wlw xss qic
|
||||||
|
ssa: kua
|
||||||
|
uds: ier vnn fiv
|
||||||
|
cbw: gvr
|
||||||
|
pln: wdj ulu
|
||||||
|
zos: htz ilj
|
||||||
|
viq: aap nzl
|
||||||
|
azd: jff
|
||||||
|
esa: rtn oku
|
||||||
|
rzd: eya brz
|
||||||
|
syt: euv cbo
|
||||||
|
drx: tdg
|
||||||
|
qjq: xss owb
|
||||||
|
jru: aat eoy dqu
|
||||||
|
vms: bzf gkm ffr uds
|
||||||
|
zen: vms zuv vci
|
||||||
|
qfx: wdr
|
||||||
|
amm: wbp vpo evr jmb zbs
|
||||||
|
hnj: sxp viq jzw
|
||||||
|
vtv: goi
|
||||||
|
kep: xnp yoh evy
|
||||||
|
evr: cap
|
||||||
|
gvp: yyy brz lvi eya
|
||||||
|
kxs: rod jru uvb
|
||||||
|
daa: jlo
|
||||||
|
fks: lbw cek
|
||||||
|
omt: dds
|
||||||
|
gtx: out
|
||||||
|
jws: lqz qak
|
||||||
|
eoy: out
|
||||||
|
qvv: fes dmf icy zrp eai dsh iyb sqg eyp sws gep jrq mdx zvl qfd qde qze hoq ccg
|
||||||
|
smq: kaj
|
||||||
|
kmy: agb
|
||||||
|
qde: atl
|
||||||
|
fez: znm mvj vjs
|
||||||
|
cey: wrx ryw lbx
|
||||||
|
ema: brz eya lvi quh yyy
|
||||||
|
zfg: cst nug aff qvv
|
||||||
|
pim: yip pxl ujz
|
||||||
|
zge: lzw
|
||||||
|
ykz: yrg bss smx
|
||||||
|
yyy: snr zpk uzl ufu bsk dej yte kgs gam eiw wqg
|
||||||
|
yor: kew
|
||||||
|
cmg: lqz qak ysd
|
||||||
|
xya: zou pln uaz
|
||||||
|
zpv: laa
|
||||||
|
yen: cek rkk fce iwk
|
||||||
|
boc: eay hlu
|
||||||
|
ygu: xya ofj
|
||||||
|
xnp: oic zfg eft xwb
|
||||||
|
nlb: izm
|
||||||
|
fmv: nqz
|
||||||
|
mag: aem wtx qrc pyc ipu
|
||||||
|
tdo: jgf
|
||||||
|
znm: sxm lbb
|
||||||
|
mtm: xnp
|
||||||
|
khk: ipt qvi
|
||||||
|
vyo: eur wdj
|
||||||
|
kye: out
|
||||||
|
uvb: dqu aat yvz
|
||||||
|
xck: lyz fpr aek arq
|
||||||
|
acb: wtv gts
|
||||||
|
gep: qxk upq
|
||||||
|
ihl: xnp yoh
|
||||||
|
eyp: qyk
|
||||||
|
lai: qsj
|
||||||
|
ipu: out
|
||||||
|
isr: ulu
|
||||||
|
qrc: out
|
||||||
|
jhu: bqf
|
||||||
|
eij: uut dac ryl epd
|
||||||
|
tvg: yrg thl mvu bss
|
||||||
|
pbj: ucr
|
||||||
|
cst: ccg sws hoq qze dsh qde cqt
|
||||||
|
yzp: xwa diq cft ypn
|
||||||
|
uut: eou ats
|
||||||
|
fee: zou
|
||||||
|
dqj: mmi taz rof ztx
|
||||||
|
rnq: arq aek
|
||||||
|
yfk: yvb zzh
|
||||||
|
lvi: jcc dej mdl gam aog nam zpk kul uzl ufu bsk nac
|
||||||
|
tap: sxw
|
||||||
|
jsq: dfv sxp viq jzw
|
||||||
|
tdg: aff nug cst dds
|
||||||
|
cgh: tmy oze nlb and
|
||||||
|
qzv: dax
|
||||||
|
jtn: xhe
|
||||||
|
kjr: ski wpw sdx xyl
|
||||||
|
ski: wdj xel
|
||||||
|
oqd: zuv
|
||||||
|
ppx: zen hmt kew
|
||||||
|
vcg: jbv
|
||||||
|
jbw: nvh
|
||||||
|
ctg: dqp
|
||||||
|
dcv: owb wlw qic
|
||||||
|
kzs: rxd lai cuu lvx
|
||||||
|
dws: bss yrg thl mvu
|
||||||
|
ara: dds qvv cst nug aff
|
||||||
|
ctr: owb wlw
|
||||||
|
ctq: ehr kaj acb
|
||||||
|
zpf: fgh fks
|
||||||
|
pyc: out
|
||||||
|
ras: gvr omt
|
||||||
|
iby: xxb rqa vlx
|
||||||
|
gam: mah ygu uzn
|
||||||
|
ulq: idw lwb pal
|
||||||
|
gkm: ier
|
||||||
|
cqn: pdv elu
|
||||||
|
tvz: ulu
|
||||||
|
obm: laa
|
||||||
|
btu: alz
|
||||||
|
wtx: out
|
||||||
|
xel: oty oxs vil eij hsd nhi hdc gbo kku lnj ycw btu jqp xck gqf hfn cey koi abg
|
||||||
|
uxa: lwb hex rns
|
||||||
|
yga: gnq
|
||||||
|
ppv: lav xhe vcg
|
||||||
|
upq: hzh cqf lzw uty
|
||||||
|
mvu: otc exw
|
||||||
|
yrg: otc azd
|
||||||
|
kul: qsu xtk ssq daa kgv
|
||||||
|
pif: mbd bzn mzo xhj wee jdf
|
||||||
|
xhy: wus khk mwp
|
||||||
|
ehr: wtv gts yga
|
||||||
|
fes: zge
|
||||||
|
rwu: you qak ysd lqz
|
||||||
|
hnw: cst
|
||||||
|
goi: out
|
||||||
|
hsd: alz zpf amk
|
||||||
|
hzh: wlw xss qic
|
||||||
|
lbs: vlx rqa
|
||||||
|
dds: mdx zvl qde qfd qze jrq zrp icy iyb dsh eyp sqg fes dmf mas
|
||||||
|
tsh: hpv kua
|
||||||
|
svr: xoz lak pif ryf dyv
|
||||||
|
gua: hlu
|
||||||
|
jei: jtc ggp
|
||||||
|
wpw: xel eur wdj ulu
|
||||||
|
jbf: biq jtn hut ppv yfk
|
||||||
|
hoq: qmk fwk cxr fbd
|
||||||
|
blh: evr vpo zbs jmb
|
||||||
|
mas: gdx
|
||||||
|
afk: jko pxe
|
||||||
|
zzy: lmw boc
|
||||||
|
vsy: tmy oze axv and
|
||||||
|
htz: xph qfx bhz
|
||||||
|
yte: mah ygu uzn rcr
|
||||||
|
zuv: bzf gkm ffr uds
|
||||||
|
yvz: out
|
||||||
|
ejn: dok llh euv
|
||||||
|
jlo: dax isr
|
||||||
|
qvi: gvp ema rzd
|
||||||
|
mdl: mah
|
||||||
|
wdj: hfn gqf cey koi jqp twd lnj rnq gbo kku hdc hsd oty vil eij abg ycw btu xck nuk nhi oxs
|
||||||
|
ias: dmv zjk ovx
|
||||||
|
laz: nhq
|
||||||
|
ish: blc
|
||||||
|
pkl: ezt ara
|
||||||
|
xhj: elu
|
||||||
|
tlp: ais
|
||||||
|
mux: zrm uvb
|
||||||
|
vci: bzf gkm uds
|
||||||
|
nie: wtx aem qrc
|
||||||
|
ike: wdj xel ulu
|
||||||
|
abg: pvr wap
|
||||||
|
ono: lqz
|
||||||
|
yip: khk
|
||||||
|
oze: ahn izm
|
||||||
|
lak: bvn mbd llx xhj lyb pxo
|
||||||
|
dmf: obk leg
|
||||||
|
wus: ipt qvi
|
||||||
|
oic: nug cst qvv dds
|
||||||
|
rpr: ifc fjg mfu
|
||||||
|
vvv: qak
|
||||||
|
qtl: lvi brz quh yyy
|
||||||
|
rqt: pdv icq
|
||||||
|
yoh: eft ntf oic
|
||||||
|
aby: nug dds
|
||||||
|
yfx: axv tmy
|
||||||
|
xmb: uaz pln
|
||||||
|
hrs: brz quh yyy
|
||||||
|
eez: llh cbo
|
||||||
|
lyd: qic owb xss wlw
|
||||||
|
dyo: dds qvv aff cst nug
|
||||||
|
evy: xwb eft ntf
|
||||||
|
plv: esz ktb jon
|
||||||
|
luk: xwa ypn
|
||||||
|
nqz: out
|
||||||
|
ier: wdj eur ulu
|
||||||
|
yey: quh eya lvi brz
|
||||||
|
otc: svv tlp jff
|
||||||
|
qze: leg gdx obk
|
||||||
|
aek: gwp ulq
|
||||||
|
mah: xmb fee xya
|
||||||
|
pxl: khk xux wus
|
||||||
|
wem: iwk cek lbw rkk
|
||||||
|
nhi: uut ryl epd
|
||||||
|
cui: out
|
||||||
|
qak: ykz xmj jbf rpr xgg blh
|
||||||
|
qwm: eya lvi brz quh
|
||||||
|
dsh: zge qxk upq xbz
|
||||||
|
hmt: zuv
|
||||||
|
bss: azd otc
|
||||||
|
rxd: vyo qsj
|
||||||
|
eay: uhs mux kxs
|
||||||
|
vnn: ulu wdj eur xel
|
||||||
|
iju: ckk lmw gua
|
||||||
|
fiv: wdj eur xel ulu
|
||||||
|
izm: rtn oku
|
||||||
|
xld: fjg mfu ifc
|
||||||
|
xph: ggv nqb
|
||||||
|
ija: rxd cuu
|
||||||
|
tsr: nug cst aff dds qvv
|
||||||
|
uaz: ulu wdj eur
|
||||||
|
ats: lqz you qak ysd
|
||||||
|
cft: xxf aby
|
||||||
|
taw: iwk cek lbw rkk
|
||||||
|
rns: ojk phc
|
||||||
|
qic: vlf eez cgh yfx dta syt bps hnj jsq
|
||||||
|
gqf: zpf amk plg hyf
|
||||||
|
ryb: qak
|
||||||
|
tbs: nug aff qvv dds
|
||||||
|
gbk: yfk
|
||||||
|
eiw: mvo ctg urn abp
|
||||||
|
kpg: sxw isr
|
||||||
|
pal: phc ojk esx
|
||||||
|
ais: nne hyg kye ycf
|
||||||
|
fjg: kmy
|
||||||
|
uzn: fee xmb
|
||||||
|
hpv: owb xss wlw qic
|
||||||
|
hlu: mux cqx
|
||||||
|
azc: ckk lmw boc
|
||||||
|
dqp: xyl ike
|
||||||
|
aat: out
|
||||||
|
fuz: srk pnh ija
|
||||||
|
ypw: jgf
|
||||||
|
pdv: kep
|
||||||
|
dmv: qjq vky
|
||||||
|
fya: llv iby lbs
|
||||||
|
plm: rkj
|
||||||
|
xux: ipt qvi mmh
|
||||||
|
gye: kye gme
|
||||||
|
zzh: fez asz rms
|
||||||
|
snr: ayv fuz qhs
|
||||||
|
ydj: qhh akg paa
|
||||||
|
rcr: ofj fee xmb xya
|
||||||
|
kaj: wtv kmf yga
|
||||||
|
lju: yoh evy
|
||||||
|
ebo: sqi jtc yey
|
||||||
|
vlx: rwu ryb ono
|
||||||
|
tas: xxb xii
|
||||||
|
wee: pdv xgw
|
||||||
|
fkj: owb wlw
|
||||||
|
xro: ilj htz jgf
|
||||||
|
hum: lqz ysd
|
||||||
|
kku: bsy aek lyz
|
||||||
|
euv: clh plv yua ygk
|
||||||
|
akl: ebo jei tkt odf
|
||||||
|
lnj: fya lbx
|
||||||
|
lbx: iby lbs
|
||||||
|
mhq: cqx uhs
|
||||||
|
hut: vcg zzh
|
||||||
|
szi: mnj ams
|
||||||
|
ysa: sxm rni lbb
|
||||||
|
vug: you
|
||||||
|
llh: ygk yua zny plv clh
|
||||||
|
nzl: hrs
|
||||||
|
uek: mvu
|
||||||
|
mmi: maf vgo hlm
|
||||||
|
eft: dds cst
|
||||||
|
dok: zny yua clh plv
|
||||||
|
kmf: npf lef nsp
|
||||||
|
mnj: you qak ysd lqz
|
||||||
|
paa: qak you
|
||||||
|
ghl: xhy
|
||||||
|
ggv: kil gbm fai lvh
|
||||||
|
jje: ssa
|
||||||
|
jko: mmi
|
||||||
|
srk: rxd
|
||||||
|
yan: ipu
|
||||||
|
nxc: lqz you qak
|
||||||
|
gts: qwm npf lef gnq
|
||||||
|
qrx: kai smq whr
|
||||||
|
ovx: oiw
|
||||||
|
unr: evy xnp
|
||||||
|
kew: vms vci
|
||||||
|
sxp: aap
|
||||||
|
oii: tsh wsd
|
||||||
|
cbo: ygk clh
|
||||||
|
xip: wrx lbx
|
||||||
|
sws: ond tbu
|
||||||
|
abp: rbc
|
||||||
|
tkt: ccu ggp
|
||||||
|
diq: xxf mtd hnw
|
||||||
|
gvr: nug cst
|
||||||
|
ipw: jtc ccu
|
||||||
|
arq: uxa gwp ulq
|
||||||
|
iwk: vvv uuj aly zyi
|
||||||
|
mfu: exx kmy
|
||||||
|
dks: nie mag
|
||||||
|
twd: fpr lyz arq bsy
|
||||||
|
fwk: lyd
|
||||||
|
jnp: eoy aat
|
||||||
|
nsp: brz eya yyy
|
||||||
|
xss: vsy bps ixr hxw syt pbj kfj gfu
|
||||||
|
nac: kgv xtk qsu
|
||||||
|
oiw: qic xss owb wlw
|
||||||
|
svv: ais gye
|
||||||
|
mtd: cst dds qvv
|
||||||
|
ixr: and nlb axv
|
||||||
|
jdf: pxc cbw
|
||||||
|
dyv: dea wnr xro ypw xlu
|
||||||
|
qfd: afk ond
|
||||||
|
wtv: qwm nsp
|
||||||
|
xxb: rwu ryb fyb ono
|
||||||
|
wnr: xgw elu
|
||||||
|
uhs: uvb zrm jnp rod jru
|
||||||
|
asz: mvj vjs
|
||||||
|
eai: gfa puw
|
||||||
|
ofj: uaz
|
||||||
|
vnz: pkl
|
||||||
|
kgs: mvo urn abp ctg
|
||||||
|
fce: ubs uuj vvv
|
||||||
|
pxo: vrn fwa dmc ykh
|
||||||
|
cxr: lyd fcq dcv
|
||||||
|
xgg: ifc
|
||||||
|
mzo: biy pkl mlf
|
||||||
|
gwp: pal idw rns hex
|
||||||
|
you: dws amm iju tvg bld xgg jbf btz mkp jhu uek blh xld ykz ttg azc
|
||||||
|
jep: wlw xss
|
||||||
|
nqb: lvh
|
||||||
|
zrm: yvz eoy aat cui
|
||||||
|
zmm: odf ipw jei
|
||||||
|
kjv: qak ysd
|
||||||
|
akg: you ysd lqz
|
||||||
|
lvh: qvv dds aff cst
|
||||||
|
ogx: gts yga
|
||||||
|
urn: kjr rbc
|
||||||
|
bsy: uxa fhu zmc gwp ulq
|
||||||
|
lav: asz fez
|
||||||
|
exw: svv
|
||||||
|
esz: lvi
|
||||||
|
sxw: eur xel
|
||||||
|
ams: lqz
|
||||||
|
qsu: fqf kpg tap
|
||||||
|
bps: akl zmm xqa
|
||||||
|
ayv: srk pnh ija kzs
|
||||||
|
gme: out
|
||||||
|
oxs: szi nhq kso
|
||||||
|
hex: esx hum ojk cmg phc
|
||||||
|
xlu: luk
|
||||||
|
aem: out
|
||||||
|
mlf: ara
|
||||||
|
kwq: srk pnh kzs
|
||||||
|
jmb: xxj cap
|
||||||
|
dqu: out
|
||||||
|
iel: ysd
|
||||||
|
ucr: ipw
|
||||||
|
cqt: fbd qmk fwk
|
||||||
|
nhp: dqp kjr
|
||||||
|
ifc: ish
|
||||||
|
llv: rqa xii xxb
|
||||||
|
dea: luk yzp nil
|
||||||
|
ngn: nne gme ycf hyg
|
||||||
|
ryf: xlu rqt swe bvn lyb duw cqn bzn jdf wnr wee ypw pxo vnz xhj zos
|
||||||
|
lef: brz quh
|
||||||
|
mbd: pxc
|
||||||
|
cap: dtj guf
|
||||||
|
rcl: wbp evr vpo jmb
|
||||||
|
zvl: fbd cxr fwk
|
||||||
|
btz: lmw gua
|
||||||
|
ktb: brz yyy
|
||||||
|
taz: ctr hlm vgo fkj
|
||||||
|
mkp: jtn hut yfk ppv
|
||||||
|
iyb: afk tbu
|
||||||
|
gbm: nug dds
|
||||||
|
swe: ras
|
||||||
|
ckk: hlu eay
|
||||||
|
rni: out
|
||||||
|
bzf: fiv
|
||||||
|
qhs: ija
|
||||||
|
rod: yvz
|
||||||
|
amk: yen taw
|
||||||
|
vjs: rni sxm
|
||||||
|
hlm: owb xss
|
||||||
|
zjk: oiw
|
||||||
|
mvj: gtx rni
|
||||||
|
ryw: iby llv
|
||||||
|
npf: quh brz lvi
|
||||||
|
zad: ssa tsh
|
||||||
|
esx: lqz ysd
|
||||||
|
mwp: mmh
|
||||||
|
alz: wem yen
|
||||||
|
kra: luk nil
|
||||||
|
xmj: smx
|
||||||
|
dej: kew
|
||||||
1030
src/days/input/day12.txt
Executable file
1030
src/days/input/day12.txt
Executable file
File diff suppressed because it is too large
Load diff
|
|
@ -3,10 +3,10 @@ const std = @import("std");
|
||||||
const day = @import("day");
|
const day = @import("day");
|
||||||
|
|
||||||
pub fn main() !void {
|
pub fn main() !void {
|
||||||
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
|
var gpa: std.heap.DebugAllocator(.{}) = .init;
|
||||||
defer arena.deinit();
|
defer std.debug.assert(gpa.deinit() == .ok);
|
||||||
|
|
||||||
const allocator = arena.allocator();
|
const allocator = gpa.allocator();
|
||||||
|
|
||||||
std.debug.print("{s}\n", .{day.title});
|
std.debug.print("{s}\n", .{day.title});
|
||||||
try day.run(allocator);
|
try day.run(allocator);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue