Compare commits

..

23 commits

Author SHA1 Message Date
2af1c7e03f Merge branch 'day12' 2025-12-12 22:09:20 +00:00
b3f8ab19ff Add hyperfine to nix env 2025-12-12 22:08:19 +00:00
0633ee80a9 Finish day12, part 1
This feels like cheating
2025-12-12 22:07:05 +00:00
f088a5a21a WIP: implement part 1 2025-12-12 16:35:12 +00:00
bc89b177a2 Add README 2025-12-12 14:55:11 +00:00
393f80f314 WIP: implement part 1 2025-12-12 14:48:57 +00:00
b55a6d61da WIP: implement part 1 2025-12-12 11:02:47 +00:00
524b451399 Finish day11, part 2 2025-12-11 18:40:52 +00:00
76b70d3c6b WIP: implement part 2 2025-12-11 16:30:51 +00:00
f85eda4e87 WIP: implement part 2 2025-12-11 15:48:33 +00:00
37b740f07a Finish day11, part 1 2025-12-11 12:15:11 +00:00
5a8bf21386 Finish day09, part 2
This doesn't work on the example but it does work on the actual dataset.

TODO: Fix that
2025-12-09 21:09:38 +00:00
605b5ee85a WIP: implement part 2 2025-12-09 16:32:37 +00:00
1d6cdccaf8 Vectors! 2025-12-09 09:24:55 +00:00
d1e798bdbf Finish day09, part 1 2025-12-09 09:17:25 +00:00
862f25d6d8 Use DebugAllocator instead of ArenaAllocator 2025-12-07 20:29:18 +00:00
beca41e511 Finish day07, part 2 2025-12-07 20:26:53 +00:00
cc35a07724 Finish day07, part 1 2025-12-07 15:45:04 +00:00
fc3a53c68d Finish day06, part 2 2025-12-06 23:11:05 +00:00
5a0c313961 Finish day06, part 1 2025-12-06 20:39:56 +00:00
3da92e4f2b Finish day05, part 2 2025-12-05 20:09:09 +00:00
e82fb0a304 WIP: implement part 2 2025-12-05 16:33:15 +00:00
9dd5b41fe5 Finish day05, part 1 2025-12-05 08:52:11 +00:00
15 changed files with 4490 additions and 15 deletions

16
README.md Normal file
View 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 | [ ] | [ ] |

View file

@ -17,6 +17,7 @@
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
zig zig
zls zls
hyperfine
]; ];
buildInputs = with pkgs; []; buildInputs = with pkgs; [];

View file

@ -1,7 +1,182 @@
const std = @import("std"); const std = @import("std");
pub const title = "Day 05"; pub const title = "Day 05: Cafeteria";
pub fn run(_: std.mem.Allocator) !void { pub fn run(allocator: std.mem.Allocator) !void {
const input = @embedFile("./input/day05.txt");
//const input =
// \\3-5
// \\10-14
// \\16-20
// \\12-18
// \\
// \\1
// \\5
// \\8
// \\11
// \\17
// \\32
// ;
//const input =
// \\383043617664892-389277822354893
// \\387921155483286-389277822354893
// ;
var lines = std.mem.tokenizeScalar(u8, input, '\n');
var ranges: std.ArrayList(Range) = .empty;
defer ranges.deinit(allocator);
var accumulator: u64 = 0;
var i: usize = 0;
while (lines.next()) |line| {
var components = std.mem.tokenizeScalar(u8, line, '-');
const start_s = components.next() orelse continue;
const end_s = components.next() orelse break;
const range = Range{
.start = try std.fmt.parseUnsigned(u64, start_s, 10),
.end = try std.fmt.parseUnsigned(u64, end_s, 10),
};
std.debug.print("==> range {d}\n", .{i});
processRange(range, ranges.items, &accumulator, 0);
try ranges.append(allocator, range);
i += 1;
} }
var buffer: [64]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();
}
fn processRange(
range: Range,
ranges: []Range,
accumulator: *u64,
level: usize,
) void {
for (0..level) |_| std.debug.print("\t", .{});
std.debug.print("recursion level = {d}\n", .{level});
for (0..level) |_| std.debug.print("\t", .{});
std.debug.print("considering {f}\n", .{range});
var overlapped = false;
for (ranges) |other| {
const difference = range.symmetricDifference(other);
if (difference.overlapping) {
overlapped = true;
if (range.eql(other)) {
return;
}
for (0..level) |_| std.debug.print("\t", .{});
std.debug.print("- overlaps with {f}\n", .{other});
if (difference.left != null and difference.right != null) {
const left = difference.left.?;
const right = difference.right.?;
for (0..level) |_| std.debug.print("\t", .{});
std.debug.print("- left = {f}, right = {f}\n", .{left, right});
if (left.eql(right)) {
return;
}
if (left.start == range.start) {
processRange(left, ranges, accumulator, level + 1);
}
if (right.end == range.end) {
processRange(right, ranges, accumulator, level + 1);
}
} else if (difference.left) |left| {
for (0..level) |_| std.debug.print("\t", .{});
std.debug.print("- left = {f}\n", .{left});
if (left.start == range.start) {
processRange(left, ranges, accumulator, level + 1);
}
} else if (difference.right) |right| {
for (0..level) |_| std.debug.print("\t", .{});
std.debug.print("- right = {f}\n", .{right});
if (right.end == range.end) {
processRange(right, ranges, accumulator, level + 1);
}
}
return;
}
}
if (!overlapped) {
const n = (range.end + 1) - range.start;
std.debug.print("- no overlap with other range, adding {d}\n", .{n});
accumulator.* += n;
}
}
const Range = struct {
start: u64,
end: u64,
const Self = @This();
pub const SymmetricDifference = struct {
left: ?Self = null,
right: ?Self = null,
overlapping: bool,
};
pub fn format(self: Range, w: *std.io.Writer) std.io.Writer.Error!void {
try w.print("{d} to {d}", .{self.start, self.end});
}
pub fn eql(self: Self, other: Self) bool {
return self.start == other.start and self.end == other.end;
}
pub fn symmetricDifference(self: Self, other: Self) SymmetricDifference {
const overlapping = self.start <= other.end and self.end >= other.start;
if (!overlapping) {
const left, const right = if (self.end < other.start) .{ self, other } else .{ other, self };
return .{
.left = left,
.right = right,
.overlapping = overlapping,
};
}
var difference: SymmetricDifference = .{ .overlapping = overlapping };
if (self.start < other.start) {
difference.left = .{
.start = self.start,
.end = other.start - 1,
};
} else if (other.start < self.start) {
difference.left = .{
.start = other.start,
.end = self.start - 1,
};
}
if (self.end > other.end) {
difference.right = .{
.start = other.end + 1,
.end = self.end,
};
} else if (other.end > self.end) {
difference.right = .{
.start = self.end + 1,
.end = other.end,
};
}
return difference;
}
};

View file

@ -1,7 +1,113 @@
const std = @import("std"); const std = @import("std");
pub const title = "Day 06"; pub const title = "Day 06: Trash Compactor";
pub fn run(_: std.mem.Allocator) !void { pub fn run(allocator: std.mem.Allocator) !void {
const input = @embedFile("./input/day06.txt");
//const input =
// \\123 328 51 64
// \\ 45 64 387 23
// \\ 6 98 215 314
// \\* + * +
// ;
var lines = std.mem.tokenizeScalar(u8, input, '\n');
var numbers: std.ArrayList([]const u8) = .empty;
defer numbers.deinit(allocator);
var operators_s: []const u8 = undefined;
var line_len: usize = 0;
while (lines.next()) |line| {
if (line_len != 0) {
std.debug.assert(line_len == line.len);
}
line_len = line.len;
std.debug.print("{s}\n", .{line});
if (lines.peek() == null) {
operators_s = line;
break;
}
try numbers.append(allocator, line);
}
var operators: std.ArrayList(u8) = .empty;
defer operators.deinit(allocator);
var operators_i = std.mem.tokenizeScalar(u8, operators_s, ' ');
while (operators_i.next()) |operator| {
try operators.append(allocator, operator[0]);
}
var results = try allocator.alloc(u64, operators.items.len);
defer allocator.free(results);
@memset(results, 0);
var oi: usize = operators.items.len - 1;
var oni: usize = 0;
for (0..line_len) |i| {
const ri = line_len - 1 - i;
var number: u64 = 0;
var all_spaces = true;
var numbers_reverse_i = std.mem.reverseIterator(numbers.items);
var ni: usize = 0;
while (numbers_reverse_i.next()) |n| {
const c = n[ri];
if (c == ' ') {
continue;
} else {
defer ni += 1;
all_spaces = all_spaces and false;
const digit = try std.fmt.charToDigit(c, 10);
number += digit * std.math.pow(u64, 10, ni);
}
}
if (all_spaces) {
std.debug.print("all spaces\n", .{});
oi -= 1;
oni = 0;
} else {
defer oni += 1;
const operator = operators.items[oi];
std.debug.print("operator {d} = {c}\n", .{oi, operator});
std.debug.print("oni = {d}\n", .{oni});
if (oni == 0) {
results[oi] = number;
} else {
if (operator == '+') {
results[oi] += number;
} else if (operator == '*') {
results[oi] *= number;
} else {
unreachable;
}
}
std.debug.print("result = {d}\n", .{results[oi]});
}
}
var accumulator: u64 = 0;
for (results) |result| {
accumulator += result;
}
var buffer: [64]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();
} }

View file

@ -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}),
}
}
};

View file

@ -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);
}
};

View file

@ -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;
}
} }

View file

@ -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;
}
};

1188
src/days/input/day05.txt Executable file

File diff suppressed because it is too large Load diff

5
src/days/input/day06.txt Executable file
View file

@ -0,0 +1,5 @@
49 9493 847 816 6 7131 86 51 323 87 9 71 1789 356 163 7 94 88 3751 314 916 1 42 57 1 234 6 734 762 92 74 18 1 17 417 16 53 733 691 735 141 2584 32 42 42 86 53 6657 812 64 261 583 39 44 325 36 413 77 6792 99 478 68 88 654 134 9 834 7516 2457 9 86 793 974 871 4 646 345 45 465 988 74 1 58 73 2 83 617 5144 66 71 37 85 53 44 2474 314 3 558 3 5636 32 93 86 68 3 3 79 8 1 49 3 22 171 76 56 45 12 9 858 27 494 816 98 71 289 98 244 9326 75 6 4 6 64 66 492 385 4 6219 6 19 6 25 4169 383 58 46 65 276 33 5839 569 79 74 6526 98 85 996 587 46 133 17 92 86 3737 473 455 552 5 953 11 93 84 873 342 72 693 69 5318 96 24 9173 4414 73 5 82 927 2 84 28 9 67 7 63 42 971 735 2 731 48 529 741 71 99 65 784 135 84 77 83 349 428 41 635 78 44 5 319 4 262 9 548 788 294 94 5966 6 366 1925 19 76 83 237 462 3275 2 35 1331 4 75 34 69 64 455 781 26 5439 68 65 379 14 56 87 79 32 55 353 813 9974 283 64 6 64 1876 47 9 17 14 17 86 9 927 6 53 534 277 7426 8534 2 176 57 52 41 39 66 465 7 56 55 9444 93 751 51 9931 253 792 698 49 98 35 17 129 45 2145 5 29 7 31 515 237 62 36 39 7 473 212 41 73 254 94 7151 64 93 29 5 868 3 5 62 8 913 16 8 13 9 86 49 5 78 57 98 7 35 9 45 34 5 41 49 18 64 347 439 9 72 99 83 922 37 945 6938 26 35 563 37 8 7243 819 2 181 77 51 7598 82 3 986 93 496 91 77 92 6757 32 21 868 6 21 9 15 2244 396 44 827 383 91 92 949 89 12 6 8765 624 4125 6995 85 5 59 76 211 29 25 96 85 8683 77 8 72 33 2789 368 265 8943 5394 7 8 136 19 9929 75 61 491 43 781 914 36 1284 32 3 18 235 589 386 4273 91 7 55 643 8 26 72 9 1 5 94 66 5 5 283 4 61 47 347 8 96 938 2926 2 47 8 64 648 215 28 5464 6 8 8 666 9 541 9315 47 5 45 782 61 141 124 571 99 33 26 8 625 5 8 57 5 844 14 93 5853 11 87 897 9367 82 17 143 5 84 2 24 93 929 21 18 3 379 78 2 464 3 871 815 46 297 91 9 1164 14 95 424 2 19 874 9695 11 715 512 281 58 598 3615 9 94 993 66 16 2 2 17 331 63 916 172 24 3 4423 78 8 48 252 835 21 4876 74 369 4 961 94 35 198 58 6 91 9498 13 4 748 89 448 192 548 589 85 38 8 45 85 612 65 21 55 626 45 251 347 2573 74 21 43 8 361 966 1391 81 18 29 61 1 2 46 59 898 3121 972 6257 484 15 926 37 7 697 7143 1 38 81 351 98 45 462 3193 822 49 82 6 331 52 84 674 51 1376 4 15 76 7 845 69 461 994 2568 643 7 916 691 3162 8 57 85 59 22 8 86 715 28 4 86 41 43 666 9 731 713 9452 27 98 858 434 3268 42 7 847 84 8 79 59 825 56 59 88 32 526 29 5 6749 9 945 82 9 95 7 61 66 2988 67 14 53 73 736 841 538 768 816 538 66 8 11 24 876 4 76 87 57 244 51 6 43 776 9 5 67 69 9 235 23 924 952 42 3273 1341 5 53 1599 46 53 64 86 73 459 146 363 466 4 9 777 1 17 958 885 123 93 8 84 64 46 8378 272 917 99 1 2355 1 978 11 16 9223 3 93 656 3234 26 89 3 1711 281 795 832 62 44 81 413 49 59 8 81 98 286 63 7 47 32 333 1 29 1543 81 465 18 582 7 2 33 398 7 632 6 75 8634 97 54 287 27 41 5 829 19 37 34 18 47 74 37 79 95 4 34 682 5357 48 818 166 41 1 122 58 982 2 75 25 776 446 1 97 91 57 294 79 49 49 14 35 28 58 57 1 15 96 268 5 8 16 97 24 62 84 6382 565 62 7 31 56 95 45 51 19 77 8 55 239 9 2 2 37 51 91 12 68 78 9437 78 3 33 22 3 9 92 2751 7462 6 5298 85 7495 796 8 76 36 921 2 45 195 44 288 42 784 17 24 8 894 619 2276 4 8849 572 19 33 4 165 27 67 519 3365 8 18 35 7 9342 4 74 25 15 6878 5 8 46 26 114 87 83 73 2 45 99 593 6 68 788 3464 815 5325 5 7279 98 47 24 97 92 7339 6 72 44 924 6 1 22 871 69 9 45 923 868 499 9 4 34 92 8 233 479 24 52
83 9643 262 113 91 3284 778 71 966 43 91 33 7759 156 265 25 54 79 4869 691 537 57 9341 35 25 242 2 269 956 118 27 23 1 82 698 15 15 652 1446 367 776 6562 54 19 98 89 25 8683 767 29 553 626 65 39 436 53 615 81 2956 44 546 547 55 4511 555 687 915 6713 6749 27 431 245 24 935 99 783 629 17 626 674 11 38 999 44 22 81 196 7938 51 55 54 46 84 83 7591 553 9 199 4 5294 75 68 93 15 61 28 582 78 95 81 5 46 91 67 71 87 96 67 383 88 731 471 33 59 766 38 927 5321 26 2 2 2 75 57 825 529 887 8711 66 73 8 85 1268 534 24 97 44 954 39 571 541 26 49 845 85 34 869 479 69 717 26 78 31 665 668 558 94 95 317 11 39 13 249 675 74 278 65 12 85 41 321 4787 91 2 34 611 42 71 24 892 38 5 36 69 579 872 19 288 88 874 113 79 87 78 831 568 27 21 58 621 435 39 534 55 16 91 112 5 984 346 182 642 877 155 7673 18 523 494 61 23 96 925 437 8675 655 7658 8946 57 77 934 21 26 882 331 98 3858 691 91 587 621 3591 445 69 45 77 871 882 6713 942 43 56 88 5784 21 82 5183 95 12 72 869 162 22 55 698 72 261 7696 38 155 1 74 34 88 53 63 5 99 937 1834 616 943 372 326 885 344 951 136 41 93 16 774 74 893 8 25 46 166 667 358 61 328 292 16 719 599 23 63 958 22 1136 652 28 36 6 941 88 1 87 52 785 51 14 76 2 324 46 21 98 12 312 75 28 2 696 47 4 53 77 62 56 569 354 6 81 11 62 276 5 125 7492 36 63 232 33 22 6868 446 41 19 74 3464 6226 723 9 2989 32 2561 98 96 835 5984 53 67 636 74 466 74 18 3835 997 65 122 74 66 8554 583 93 599 98 9284 871 4862 4159 43 44 25 31 796 98 35 191 21 9238 41 37 27 23 6245 132 933 7352 3527 5 727 89 15 2218 534 99 953 54 192 755 84 9455 34 55 68 744 984 473 285 26 7 83 664 44 71 1353 72 85 82 98 26 74 3 223 57 58 232 288 9 99 72 773 928 65 3 98 432 1121 24 6275 57 779 44 818 65 99 9413 66 9 47 568 19 386 654 796 86 57 58 27 364 642 2 59 416 496 47 61 1419 76 64 284 5426 27 23 547 25 488 72 97 2183 221 59 14 7 788 76 45 854 283 58 252 33 446 884 85 7287 18 85 886 3 93 79 9117 73 692 794 977 67 739 6671 784 657 899 4 32 63 757 47 911 48 329 634 77 12 6878 5868 58 483 719 17 31 2296 68 84 54 673 41 385 883 33 6 54 82 994 63 876 569 481 753 896 985 11 76 29 84 93 991 234 94 88 915 59 8889 298 5969 49 837 89 72 739 235 568 227 91 89 36 82 45 23 93 296 6225 143 885 446 946 238 81 6 215 8857 1 76 12 21 58 77 19 4193 782 81 74 48 342 6 46 661 85 3698 5 71 33 44 93 264 132 258 7798 451 5 757 881 2545 1 97 94 497 427 35 24 667 723 57 33 19 26 319 24 651 39 5255 9689 56 5239 789 5533 78 41 573 82 46 176 46 746 862 56 82 51 143 44 15 8641 9 635 66 68 235 4 47 19 5863 98 37 29 92 6863 953 293 481 312 639 97 8 95 75 881 35 82 52 842 582 42 52 94 231 32 7 47 12 99 12 79 256 614 2 5231 4367 8 225 5843 79 18 98 47 38 786 322 452 139 6 8 521 6 22 637 364 196 21 5 523 84 635 7486 316 197 72 865 8186 89 344 92 98 7982 87 96 622 7772 74 48 55 226 177 433 823 8679 16 774 328 29 354 7 67 261 899 5478 88 665 96 236 431 2 8555 139 629 31 787 7 44 54 775 4474 739 78 96 455 83 68 343 99 7 58 388 65 18 9 52 76 12 77 691 41 5 42 278 1391 85 343 233 29 22 531 134 779 19 4 18 161 259 676 64 271 42 544 741 52 61 632 28 154 65 325 18 41 75 414 31 8 519 79 42 957 27 5192 917 77 94 86 61 53 97 81 78 42 36 55 82 89 34 7542 57 34 62 65 44 47 1455 14 79 2 82 22 1 97 1432 515 2 8486 46 5644 556 67 71 962 674 67 58 231 13 794 27 439 69 25 4 456 415 297 69 4251 83 25 88 3 973 959 16 943 1289 39 66 39 93 777 768 511 847 6 3859 1 23 85 411 326 56 43 78 95 31 215 881 69 76 468 1663 424 642 14 177 64 46 78 42 29 9132 3 81 2 629 19 4 95 676 87 8 46 679 18 767 17 74 52 666 9 851 516 26 36
16 959 5389 422 48 7167 663 8 722 14 26 85 8579 924 6241 48 31 94 1794 54 693 67 5158 5 14 428 5 56 924 251 31 99 4 13 925 769 7 693 4785 993 73 279 25 28 189 962 56 7533 748 48 299 752 44 89 272 32 41 56 5597 48 89 753 67 7348 28 664 927 918 1 7578 1553 316 89 973 762 24 61 31 361 198 77 92 525 4 48 41 729 8579 72 95 2974 83 9 622 8773 62 54 925 28 4544 128 62 74 5 976 79 785 932 36 41 8 54 3 64 6 57 46 58 868 49 91 457 7 22 122 21 429 782 4796 55 87 37 79 779 673 331 841 2286 39 32 95 18 5696 46 5781 68 39 865 59 26 975 29 11 85 94 81 381 71 63 722 37 295 36 969 62 321 27 48 33 55 94 1 335 695 21 8 98 38 34 28 21 9987 86 748 38 825 27 22 86 166 9 39 36 14 531 596 71 23 23 21 894 91 77 83 398 172 8 21 435 87 481 46 25 85 5545 57 489 43 535 582 883 447 95 548 2325 43 763 129 67 36 2 132 369 175 267 7141 69 166 1 9526 85 55 536 94 19 9144 377 7 838 788 1552 818 67 52 23 52 12 3535 43 78 725 84 7563 2 276 8861 17 777 198 2817 545 79 19 9965 37 9 3746 36 975 2 4 2 28 61 96 6 17 915 98 392 88 314 647 289 65 41 232 7 18 81 112 69 81 49 88 545 842 657 11 76 612 321 17 29 249 18 468 912 96 4656 971 63 29 92 646 24 8 236 98 875 72 44 9 55 683 6 353 54 85 891 235 7938 3 542 68 67 18 98 85 92 432 54 137 41 48 29 24 1 122 7866 41 47 35 7 54 163 96 83 35 117 2365 8961 791 53 6847 68 2271 6 45 4872 9232 49 27 273 81 927 44 6448 541 561 369 441 18 4 1164 393 6 871 344 56 427 7185 8111 1 16 91 36 546 73 93 179 69 3567 84 66 96 93 1218 637 613 9426 796 97 2132 99 42 9764 786 21 65 52 764 9274 23 882 65 614 664 454 35 83 337 25 47 25 245 667 21 6687 48 615 349 83 99 6873 32 155 84 3 1191 44 2 66 71 866 849 67 67 53 692 9933 17 4371 47 482 94 77 68 12 421 41 27 16 93 5 79 772 16 46 618 14 37 728 342 6145 83 438 278 34 44 293 58 72 95 15 96 314 97 87 1542 82 36 9554 863 41 36 14 447 279 962 958 356 3 636 2 48 7865 558 55 77 87 452 13 66 75 825 37 797 644 9359 65 942 8986 783 298 666 2 17 24 194 986 994 5 588 24 13 95 619 8933 27 957 65 85 64 8746 58 14 16 726 81 541 597 69 9 6 64 8475 831 267 5191 94 866 69 32 52 97 789 92 86 351 697 54 71 124 46 3485 298 964 42 949 84 38 161 19 484 185 47 23 97 84 355 1 34 5773 62 49 393 77 728 38 11 42 648 471 6 99 52 86 76 883 64 446 751 82 77 947 379 8 68 235 36 1913 88 28 28 69 67 851 9527 21 4313 34 23 952 153 14 21 52 71 574 2343 19 51 88 631 97 97 45 74 139 9686 564 1 768 8916 24 3665 382 4416 82 136 382 17 899 928 38 437 5262 96 48 47 335 791 693 2182 2 331 23 91 353 97 1 97 1328 65 96 55 8 4687 983 354 621 14 813 35 17 41 897 949 74 25 56 687 213 6179 67 94 269 92 7 56 118 77 54 49 787 98 4 242 8479 19 122 319 39 41 78 87 231 592 568 363 615 62 17 25 6 74 885 594 148 9 13 313 76 191 277 892 96 89 196 176 494 618 278 67 66 226 1 174 271 18 8 42 89 53 33 446 3623 91 4656 873 33 826 12 39 254 622 5238 441 891 2 814 845 4 6697 256 469 92 53 25 87 86 569 9549 312 792 2 515 356 87 666 285 8 64 927 7 32 6 39 12 497 52 367 72 84 53 228 692 84 18 838 48 73 268 125 69 869 3 3 916 564 439 5 959 23 281 283 37 555 144 51 499 93 431 271 34 73 426 123 37 4365 26 14 167 58 9727 856 34 91 54 62 97 692 11 42 32 169 66 44 29 43 9583 486 15 88 6 38 938 537 1 83 2 69 943 4 55 948 646 72 324 769 2444 166 45 976 757 998 96 77 3 76 18 33 731 86 38 51 58 133 473 98 466 86 91 46 87 575 548 278 583 532 195 279 55 82 159 355 354 459 4 866 14 562 35 456 633 87 19 94 85 95 2836 686 21 32 886 693 714 655 68 855 6 66 593 95 61 654 4 84 2 96 82 91 94 531 26 4 327 79 96 741 33 581 14 279 68 543 632 79 57
83 5 2222 2 47 518 117 3 9 96 87 28 1732 92 4877 81 71 65 4 8 528 66 5889 8 57 793 56 4 5 821 183 25 35 34 996 451 7 3 8336 326 37 13 6 27 719 863 7 817 86 56 77 92 86 7 65 41 2 67 711 1 76 635 6 6363 4 469 847 83 7 4168 4219 485 9 736 919 93 12 5 517 773 34 72 533 6 34 52 85 76 7 73 9559 4 7 694 35 78 28 9213 38 23 554 44 6 4 376 68 372 118 35 98 13 638 8 51 8 54 34 86 915 15 25 373 4 8 359 91 8583 14 4463 16 79 54 36 314 29 842 8229 1 233 64 12 56 9494 9 8724 24 1 698 8 76 836 83 4 97 46 1 758 2 1 148 6 652 7 915 15 2 74 17 7 5 78 5 4 31 29 6 11 8 54 21 75 35 11 773 9 164 94 14 59 947 1 96 9 89 258 863 87 9 47 11 275 57 63 14 379 52 8 96 273 1 9 882 8 35 9624 26 485 68 889 486 464 823 5 687 87 41 374 88 67 467 7 892 87 76 298 6368 3 399 7 2815 65 42 8 42 71 989 266 1 34 125 3961 788 576 593 12 3 74 2684 7 34 642 97 94 3 686 8742 23 922 532 9954 6 751 68 8887 77 4 995 31 41 5 7 9 3 92 58 71 2 255 5 564 3 523 57 765 3 9 763 4 5 77 976 59 33 68 73 741 921 746 41 53 726 522 61 85 24 39 159 78 24 9871 533 38 51 76 9 36 68 651 82 78 99 84 2 99 137 3 769 88 4 988 668 6663 96 552 61 77 83 69 52 93 625 7 549 3 11 66 63 8 175 9 72 6 1 8 18 5 5 79 47 649 8416 661 622 53 1225 72 6986 3 24 8259 8585 6 4 19 82 827 36 4449 94 811 262 818 13 9 9759 57 7 444 947 32 94 146 192 3 776 54 85 7 91 43 729 26 81 68 25 389 52 2 66 331 944 34 47 3695 6 5 756 591 95 1 91 294 5551 47 46 18 277 891 334 4 28 332 53 18 83 4 353 78 1259 59 897 118 745 2 5824 48 9654 38 2 7523 13 91 17 47 89 198 31 27 38 123 4573 29 9331 276 8546 12 2 91 79 48 1 64 73 74 4 4 78 83 2112 458 76 32 847 285 1154 13 522 96 21 85 46 5 726 4 45 89 141 18 82 6148 63 2 1367 967 31 84 55 493 127 472 669 626 7 17 5 75 9283 577 7 42 52 1 22 75 1 727 66 62 353 4621 34 337 713 431 251 95 1 78 66 511 555 169 2 467 78 19 31 53 1664 28 447 66 43 6 33 2 54 19 983 66 7969 96 8 33 7 93 8465 831 912 4218 2 854 48 32 53 746 358 27 22 9842 563 11 42 86 1 1358 424 8 4 858 73 44 45 91 25 836 28 99 7 93 284 5 5 3725 87 15 63 55 474 1 29 91 69 4 56 35 79 92 79 233 5 49 36 81 27 129 19 2 15 944 78 782 19 4 3 38 8 4192 3997 7 927 8 13 539 19 78 19 88 65 218 6271 32 2 54 777 51 14 37 14 25 6275 23 1 9 7836 24 6159 91 5729 3 474 88 4 419 646 22 4 9738 3 1 28 628 858 5226 36 38 46 25 97 7529 42 4 5994 7767 9 84 71 8 1679 71 893 31 55 158 27 18 7 689 57 45 45 6 259 14 3141 19 5 9 83 49 98 346 79 27 55 84 8 7 41 6332 91 338 726 38 8 5 42 821 249 6 415 363 52 46 14 76 4 1 99 7435 4 63 3487 23 859 45 3376 8 92 781 541 993 571 492 4 89 279 9 9 715 3 3 94 2 98 23 383 4173 71 6897 622 8 511 31 55 781 113 7761 965 664 5 22 538 4 274 285 635 31 67 53 32 78 59 4319 936 258 9 45 676 99 641 258 7 97 949 8 52 1 41 2 751 1 866 5 96 857 22 12 15 3 845 46 43 698 862 9 869 9 3 141 49 975 6 422 56 557 834 94 9728 644 85 955 9 755 297 72 8 729 871 52 1861 58 17 639 61 284 22 83 52 71 3 14 136 65 26 4 568 8 8 92 52 7419 183 47 2 8 52 736 15 2 88 6 88 493 12 61 31 41 97 8 651 86 4 88 658 367 262 59 64 5 4 2 84 999 52 89 48 19 83 324 38 3 1 47 9 98 8 275 9763 914 662 915 5395 51 93 36 298 284 625 1 943 562 521 22 845 411 6 13 9 58 63 4555 35 644 99 225 12 113 18 94 88 1 7 251 52 98 448 55 59 6 48 53 456 52 493 79 75 857 33 75 68 61 358 17 8381 34 782 91 37 43
* + + * * + * * * * * * + * + + * * + * + * + * * + * + * * * * * * + * * * + + * + * + + * + + * * * * * * * * * * + + * + * + + * * + + + + * * + * + + + + + + + + + + + + + + * + * * * + * * + * + * + * + * * * + * * * + + * * + * + * * + * + + * * + + + + * * * * * * + + * * + * + + + + * * + + + + * + + * * * * * + * * + + * * * + * + * * * * * * + + * + + * + * + * + * * * * + + * * * * * * * * * * + * * + + + + * + + + + * * * + + + * + + + * + + * + + * + * + + + + + * * + * * + * + * * + + * + * * * + * + + * + + * + + + + + + * + + * + + + * + + * + * + * * + + + + * + + + * + + * + + + + * + * + * * * + + * + + + * * * + + + + * * * + * + * + + + * * * + * * * * + + + * + + * + + * + + * * * + * * + * * * + * + + + * * + + * * + * + + * + + + * * * * * + + + * * * * + + * * * + * + + + + * + * + + * * + + + * * + * + + + * + + * + * * * * * + + + * * + + * * + + + + + * * + + * * * * + * + + * + + * + * + * + * * * + + + * + + * + * + * * * + * * + * + + * * * + + + * * * * + * * + + * + + + + * * + + * + + * + + + * * + * * + * + * + * * + + + * + * + * * + * + + * + + + + * * * * * * + + + * * + + + * * * + + + * + * + + + + * + + * * + + + * * * + * * * + * + + + * + * + * + + + + * + + + * * + + * + * * + * + + + + + * * + * * + + + * * * + + + * + + + * * * + + + + * * * * + * + * * + + * + + + * * * * + + * + + * + + + + * * * * * + * + * + * * * + + * * * * + * * + + * * * * + * * + * * * * + * + + * + * * + + * + * + + + * * * * + * + + * * + * * * + + * + * + + * * * * + * + + + + * * + + * * * + * * * * + + * + + * * * + * + + + * + + * + + * + * + * * * + * + + * + + * * + * * + * * + + + * + + * * * + + * + * * + * * + + * + + * * * + * * * * * * + * * * * * + * * + * * * * * * + * * * * + * + * * + + * + * + + * * + * * + * * + + * * + * * + + + * * * * + * + + + + + + + + * * + * * + * + * + * + * * * + * + + * + * + * + * + * + * * + * + * + + * + * * + * + + * * + + + + * + + + + + * * + * + + * * * * + * + + * * * * + * * + + + * * * * +

142
src/days/input/day07.txt Executable file
View file

@ -0,0 +1,142 @@
......................................................................S......................................................................
.............................................................................................................................................
......................................................................^......................................................................
.............................................................................................................................................
.....................................................................^.^.....................................................................
.............................................................................................................................................
....................................................................^.^.^....................................................................
.............................................................................................................................................
...................................................................^...^.^...................................................................
.............................................................................................................................................
..................................................................^.^...^.^..................................................................
.............................................................................................................................................
.................................................................^...^.^.^.^.................................................................
.............................................................................................................................................
................................................................^.^.........^................................................................
.............................................................................................................................................
...............................................................^.^...^.^.^.^.^...............................................................
.............................................................................................................................................
..............................................................^.^.^.^.^.^.....^..............................................................
.............................................................................................................................................
.............................................................^.^.....^...^.^.^.^.............................................................
.............................................................................................................................................
............................................................^...^.....^.^...^.^.^............................................................
.............................................................................................................................................
...........................................................^.....^.^.^.^.^.^.^.^.^...........................................................
.............................................................................................................................................
..........................................................^...^...^.....^.^...^.^.^..........................................................
.............................................................................................................................................
.........................................................^.^.....^.^.....^.^.^.^.^.^.........................................................
.............................................................................................................................................
........................................................^...^.^.^.^...^.^.....^.....^........................................................
.............................................................................................................................................
.......................................................^.^.^.^.^.^.....^.....^.^.^.^.^.......................................................
.............................................................................................................................................
......................................................^.^.....^.^.^.....^.^...^...^.^.^......................................................
.............................................................................................................................................
.....................................................^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.....................................................
.............................................................................................................................................
....................................................^.^.^...^.^.^.^.^.^.^.^...^...^.^.^.^....................................................
.............................................................................................................................................
...................................................^.^...^.^.^.^.^.^...^.^.^.^.^...^...^.^...................................................
.............................................................................................................................................
..................................................^.^.^.^...^.^.^.^.^.^.^...^.^...^.^...^.^..................................................
.............................................................................................................................................
.................................................^.^.^.^...^.^.......^.^.^.^.....^.^.^.^.^.^.................................................
.............................................................................................................................................
................................................^...^.^.^.^.^.^.^.^.^.^.....^.^.^...^.^.^...^................................................
.............................................................................................................................................
...............................................^.....^...^.^.^.^.^...^...^.^.^.^.^.^.^.^...^.^...............................................
.............................................................................................................................................
..............................................^...^.^...^.^...^.....^.^.^.^.^.^...^.^.^.......^..............................................
.............................................................................................................................................
.............................................^.^.^.^.^...^.^.^.^.^.^...^.....^.^.....^.^.^...^.^.............................................
.............................................................................................................................................
............................................^.^.^.^.^.^.^.^.^.^.^...^.^.....^...^.^...^.^.^.^...^............................................
.............................................................................................................................................
...........................................^.^.....^.^.....^.^.^.^.^.^.^.^.^.^...^.^...^.^.^.....^...........................................
.............................................................................................................................................
..........................................^.^.^...^.....^.^.^.^.^...^.^.....^.^.^.^...^...^.^...^.^..........................................
.............................................................................................................................................
.........................................^.^...^.^.^.^.^.^.^.^.^.^.^.....^.....^.^.^.^.^.^.^.^.^.^.^.........................................
.............................................................................................................................................
........................................^.....^.^...^.^.^.^.....^.^.^.^...^...^.^.^.^.^...^.^...^.^.^........................................
.............................................................................................................................................
.......................................^.^.^.^.....^.^.^.......^.^.........^...^.^.^.^.....^.^.....^.^.......................................
.............................................................................................................................................
......................................^.^.....^.^.^...^.^...^.^.......^.^...^.^.^.^.^.^...^.....^.^...^......................................
.............................................................................................................................................
.....................................^.^.^...^.^.^.^.^.....^.^...^.....^.....^...^.^...^.......^.^.^.^.^.....................................
.............................................................................................................................................
....................................^.^.^...^...^.^.^...^.^...^.^.^.^.......^.....^.....^.^.......^.^.^.^....................................
.............................................................................................................................................
...................................^.^.^.^.^...^...^.^.^.^.^.^.^.^.^.^.......^.^...^.^...^.^.^.^.^...^.^.^...................................
.............................................................................................................................................
..................................^...^.^.^.^...^.......^.^.^...^.^.......^.^.^.....^...^...^.^.^...^.^...^..................................
.............................................................................................................................................
.................................^...^.......^.^.^.....^.^...^.^...^.^.^.^.^.^.....^.^...^...^.^.^...^...^.^.................................
.............................................................................................................................................
................................^.^.^...^.^.^.^.^.^.^...^...^.^.......^.^...^.^.^...^.^...^.^.^.^.^...^...^.^................................
.............................................................................................................................................
...............................^.^.....^.^.^...^.^.^.^...^.........^.^.^.^.........^.^.^...........^.^.^.^...^...............................
.............................................................................................................................................
..............................^.^...^.^...^...^...^...^.^.^.^.^.^...^.^.^...^.^.^...^.....^.^.^...^...^.^.^...^..............................
.............................................................................................................................................
.............................^.^.^.^.^.^.^.....^.^.^.^.^.^.....^...^.^.^.......^.^.^.^.....^.........^.^.^.....^.............................
.............................................................................................................................................
............................^...^...^.^.^...^...^.^.^.^.^.^.^.^.^.^.......^.^.......^.^.....^.^.^.^...^.^...^...^............................
.............................................................................................................................................
...........................^.^.^...^.^.^.....^.....^.^.......^.^.^.....^.^.^...^.....^...^.^.^.^.....^.^.^.^.^.^.^...........................
.............................................................................................................................................
..........................^.....^.....^.^...^.^.^.^.^.^...^.^.^.^.^.^...^.^...^.^.^...^.^.^.....^.^.^...^.^...^...^..........................
.............................................................................................................................................
.........................^.^...^.^.^.^...^.^...^.^.........^.......^.^.^.^.^.^...^.^.^.^.^.^.^...^.^.^...^.^.^.^...^.........................
.............................................................................................................................................
........................^...^.^.^.^...^.^...^...^.^...^.^.^...^.^.^.^.^.^...^.^.^...^.......^.^.^.^.^...^.....^...^.^........................
.............................................................................................................................................
.......................^.^.^...^.^.^.....^.^...^.^.^...^...^.^.^...^.^.^...^.^.....^.^.^.^.^...^.^.........^.^.^.^.^.^.......................
.............................................................................................................................................
......................^.^.^.^...^.^.^.^.^.....^.^.^.....^.^.^.^.^...^.^.^.....^.^.....^...^.^.^.^.....^...........^.^.^......................
.............................................................................................................................................
.....................^.^.^.^.^.^...^.^.^.^.^.....^.^...^...^...^.^.^.^.^.....^.^.^.....^.^...^.......^.^.^.....^.^.^.^.^.....................
.............................................................................................................................................
....................^...^.^.......^.^.^.^.^.^.........^.^.^.^.......^.^...^.^.^.^.^.^.^.^.^...^.^.^.....^.^.^.^.^.^.^.^.^....................
.............................................................................................................................................
...................^.^.......^.^...^.^.^.^.^.^...^.^...^.^...^.....^.^.^...^.^...^.^.^.^.^...^...^.^.....^.^...^.^.^.^.^.^...................
.............................................................................................................................................
..................^.^.........^.^.^...^.^...^...^.^.^.^.^.^.^.^.^.^.^.^...^.^.^.^.^.^.^.^.^.^.^...^.^.^.^.^...^.....^...^.^..................
.............................................................................................................................................
.................^.^.^...^.^.^.^.^.......^.^.....^.^...^.^.^...^.^.^...^.^.^.^.^...^.......^.^...^.^.^.........^.^...^.^.^.^.................
.............................................................................................................................................
................^.....^.^.^...^.^.^.^.^...^.^.^.^.^.^.^.^...^.^.^.^.^.^.^...^...^.^...^.^.^.^...^.^.^.^.^.^.....^...^.....^.^................
.............................................................................................................................................
...............^.....^.^.^.^.^.^.^.^.^.^...^.^...^...^...^...^...^.^.^.^.........^.^.^.^.^...^.....^.^.......^...^...^.^.^.^.^...............
.............................................................................................................................................
..............^.^.^.^.^.^.^...^.^.^.^.^.^.^.^...^.^.^.^...^.^...^.^.^.^.^...^.^.^.^.^.^.^.^.....^.^...^.^.^.^.^...^.....^.....^..............
.............................................................................................................................................
.............^.^...^.^.....^.......^.....^.....^.^...^.^.^.^.....^.^.....^.....^.^...^.^.^.^.^...^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.............
.............................................................................................................................................
............^.^...^.^.....^.^.^.^.^.^.^.^...^...^.^.^.^.^.^.^.^.^.^.^...^.....^.^...^...^.........^.^...^.^...^.^.^.^.^.^.^.^...^............
.............................................................................................................................................
...........^...^.^.^...^.^...^...^.^...^...^.^.^.^...^.^.^...^.^.^.^.^...^.^.^.^.^.^.^.^.^.^.^.^.....^.^.^.^.^...^.^.^.....^.^.^.^...........
.............................................................................................................................................
..........^.^.........^.^...^.....^.^.^.^.^.^.^.^...^...^...^.^.^.^.^...^.^.^...^...^...^.^.^...^.^.^.^...^.^.^.^...^.....^...^...^..........
.............................................................................................................................................
.........^.^.^.^...^...^.^.^.^...^.^.^.^.^.^.....^...^.^.....^.^...^...^.^...^.^.^.^...^.^...^...^.^.^.^...^...^.....^.^.^...^...^.^.........
.............................................................................................................................................
........^...^.^.^.^...^.^.^.^.^.^.^...^.^.^.........^...^.^.^.^.....^.^...^.^.^.^.^.....^.^.^.^.^.^.^.^.^.^...^.^.^.....^.^.....^.^.^........
.............................................................................................................................................
.......^.......^.^.^.^...^.^...^.^...^.^.^.^.^.^.^.^.^...^.^.^...^...^...^.^.^...^.^.^...^.^.^.^.^.^.^...^.^.....^.^.^...^.^.^...^.^.^.......
.............................................................................................................................................
......^...^...^.^.....^.^.^.^.^.^.^...^.^.^.^...^.^.^...^.^.^.....^.^.^.....^.^.^.^.^...^.^.^.^.....^.^.^...^.^.^.....^.^.^.^.^.^...^.^......
.............................................................................................................................................
.....^.....^.^.^.^.^...^.........^.....^.......^.^.^...^.^.......^.^.^.^...^.^.^.^.^...^.^.^.^.^.^.^...^...^.^.^...^...^.^...^.^.....^.^.....
.............................................................................................................................................
....^.^.^.^...^.^.^.^.^.^.^...^.^.^.^.....^.^.^.....^.^.^.^...^.....^.^.....^...^.^...^.^.^.^.^.^.^.^.^.^.^.^.^.^...^.^.^...^.^.^...^...^....
.............................................................................................................................................
...^...^.^.^.^.^.^...^.^.^.^.^.^.^.^.....^...^.^.^.^.^.^.....^.^.^.^.^.^...^.......^.^...^...^.^.^.^...^.^.^...^.^.^.^.^.^.^.^...^.^.^...^...
.............................................................................................................................................
..^.^.^.^...^.^.^.^.^...^.....^...^.^.^...^...^.^.^.^...^...^.^.^...^...........^.^.^.^.......^...^...^.^.^.^.^.^.^.^.^.^.^...^.^.^.^.^.^.^..
.............................................................................................................................................
.^.^.^.^.^.^.^.^.^.^.^.......^.^.^.^.^.^.^.^...^.^...^.^.^.^.^.^.^...^.^.^.^.^.^.^.^.^.^.....^.^.......^.^.^.^.^...^...^.^.^.^.......^.....^.
.............................................................................................................................................

496
src/days/input/day09.txt Executable file
View 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
View 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

File diff suppressed because it is too large Load diff

View file

@ -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);