diff --git a/2024/day1.zig b/2024/day1.zig index 8f8fbad..2f6779b 100644 --- a/2024/day1.zig +++ b/2024/day1.zig @@ -1,16 +1,13 @@ const std = @import("std"); const print = std.debug.print; -pub fn main() !void { - const file = try std.fs.cwd().openFile("day1.txt", .{}); - defer file.close(); +const util = @import("util.zig"); +pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; - defer std.debug.assert(gpa.deinit() == .ok); const allocator = gpa.allocator(); - const stat = try file.stat(); - const input = try file.reader().readAllAlloc(allocator, stat.size); + const input = try util.readAllInput(1, allocator); defer allocator.free(input); var l1 = std.ArrayList(i32).init(allocator);