Preview:
int num_liars = 0, num_liars_left = 0;
        for (int i = 0; i < n; i++) {
            if (claims[i] > 0) {  
                num_liars++; 
                num_liars_left += claims[i] - 1;  
            }
        }

        if (num_liars == 0) { 
            printf("0\n");
        } else if (num_liars > num_liars_left) { 
            printf("-1\n");
        } else {
            int num_truth_tellers = n - num_liars;  
            int num_liars_total = num_liars_left + (num_liars - num_truth_tellers);  
            printf("%d\n", num_liars_total/7);
        }
    }

    return 0;
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter