From c1f11c1ebcd2c9aeed380f15c0d0f082a5a2b1cf Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Wed, 6 Dec 2023 05:26:19 +0400 Subject: [PATCH] Do not subtract 1 each time, just use < instead of <= in d5p1. --- day5/p1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/day5/p1.c b/day5/p1.c index e33ffc1..1c587fa 100644 --- a/day5/p1.c +++ b/day5/p1.c @@ -52,7 +52,7 @@ int main(int argc, char **argv) { sscanf(line, "%lu %lu %lu\n", &dst, &src, &rng); for (size_t i = 0; i < data_len; ++i) { - if (!data_v[i] && data[i] >= src && data[i] <= src+rng-1) { + if (!data_v[i] && data[i] >= src && data[i] < src+rng) { data[i] = dst + (data[i] - src); data_v[i] = true; }