diff --git a/day5/p1.c b/day5/p1.c index cf788ba..b2f454b 100644 --- a/day5/p1.c +++ b/day5/p1.c @@ -3,7 +3,6 @@ #include #include #include -#include int64_t parse_number(char *end); diff --git a/day5/p2.c b/day5/p2.c index 71c0ed8..754d1c0 100644 --- a/day5/p2.c +++ b/day5/p2.c @@ -3,7 +3,6 @@ #include #include #include -#include uint64_t parse_number(char *end); @@ -63,8 +62,7 @@ int main(int argc, char **argv) { } else if (line[0]>>4 != 0x3) continue; - map_lengths[maps_cur]++; - maps[maps_cur] = (map_t *) realloc(maps[maps_cur], map_lengths[maps_cur] * sizeof(map_t)); + maps[maps_cur] = (map_t *) realloc(maps[maps_cur], ++map_lengths[maps_cur] * sizeof(map_t)); map_t new_range_map = {0}; sscanf(line, "%lu %lu %lu\n", &new_range_map.dst, &new_range_map.src, &new_range_map.rng);