14 int list
[100] = {0}; // cheat based on pre-inspecting input
16 while (scanf("%d: %d\n", &layer
, &depth
) == 2) {
21 printf ("read %d items, max layer %d\n", count
, max
);
26 for (i
= 0; i
<= max
; i
++) {
29 int cycle
= (list
[i
] - 1) * 2;
30 if (! ((i
+ delay
) % cycle
)) {
31 // printf (" delay %d, i %d, cycle %d\n", delay, i, cycle);
33 severity
+= i
* list
[i
];
41 printf ("with no delay, severity is %d\n", severity
);
42 printf ("delay %d to avoid collisions\n", delay
);