The report uses three repair counts: 2, 5, and 7. Allocate room for exactly three integers and check the pointer before touching any element. malloc does not initialize those integers, so write all three before summing them. Free the storage after printing.
int elements with malloc, using sizeof *counts. If it returns NULL, return 1. Otherwise assign 2, 5, and 7 to indexes 0–2, print Repairs: 14 followed by a newline using those elements, and free the allocation before returning 0.Call malloc(n * sizeof *counts), check for NULL, assign each count, then free(counts).