Language: C

// AOJ 0647 Stove
// 2018.3.28 bal4u
 
#include <stdio.h>
#include <stdlib.h>
 
//#define getchar_unlocked()  getchar()
int in()
{
    int n = 0, c = getchar_unlocked();
    do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0');
    return n;
}
 
int dt[100002];
 
int cmp(int *a, int *b) { return *b - *a; }
 
int main()
{
    int n, k, i, t0, t1, t2, s;
 
    n = in(), k = in();
    if (k >= n) { printf("%d\n", n); return 0; }
 
    n--, t0 = t1 = in();
    for (i = 0; i < n; i++)  t2 = in(), dt[i] = t2-t1-1, t1 = t2;
    if (k == 1) { printf("%d\n", t2-t0+1); return 0; }
 
    qsort(dt, n, sizeof(int), cmp);
 
    s = 0, k--;
    for (i = 0; k--; i++) s += dt[i];
    printf("%d\n", t2-t0+1-s);
    return 0;
}


Compiler output:
main.c:3:1: error: stray '\302' in program
    3 | <U+00A0>
      | ^~~~~~~~
main.c:6:1: error: stray '\302' in program
    6 | <U+00A0>
      | ^~~~~~~~
main.c: In function 'in':
main.c:10:1: error: stray '\302' in program
   10 | <U+00A0><U+00A0><U+00A0><U+00A0>int n = 0, c = getchar_unlocked();
      | ^~~~~~~~
main.c:10:2: error: stray '\302' in program
   10 | <U+00A0><U+00A0><U+00A0><U+00A0>int n = 0, c = getchar_unlocked();
      |         ^~~~~~~~
main.c:10:3: error: stray '\302' in program
   10 | <U+00A0><U+00A0><U+00A0><U+00A0>int n = 0, c = getchar_unlocked();
      |                 ^~~~~~~~
main.c:10:4: error: stray '\302' in program
   10 | <U+00A0><U+00A0><U+00A0><U+00A0>int n = 0, c = getchar_unlocked();
      |                         ^~~~~~~~
main.c:11:1: error: stray '\302' in program
   11 | <U+00A0><U+00A0><U+00A0><U+00A0>do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0');
      | ^~~~~~~~
main.c:11:2: error: stray '\302' in program
   11 | <U+00A0><U+00A0><U+00A0><U+00A0>do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0');
      |         ^~~~~~~~
main.c:11:3: error: stray '\302' in program
   11 | <U+00A0><U+00A0><U+00A0><U+00A0>do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0');
      |                 ^~~~~~~~
main.c:11:4: error: stray '\302' in program
   11 | <U+00A0><U+00A0><U+00A0><U+00A0>do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0');
      |                         ^~~~~~~~
main.c:12:1: error: stray '\302' in program
   12 | <U+00A0><U+00A0><U+00A0><U+00A0>return n;
      | ^~~~~~~~
main.c:12:2: error: stray '\302' in program
   12 | <U+00A0><U+00A0><U+00A0><U+00A0>return n;
      |         ^~~~~~~~
main.c:12:3: error: stray '\302' in program
   12 | <U+00A0><U+00A0><U+00A0><U+00A0>return n;
      |                 ^~~~~~~~
main.c:12:4: error: stray '\302' in program
   12 | <U+00A0><U+00A0><U+00A0><U+00A0>return n;
      |                         ^~~~~~~~
main.c: At top level:
main.c:14:1: error: stray '\302' in program
   14 | <U+00A0>
      | ^~~~~~~~
main.c:16:1: error: stray '\302' in program
   16 | <U+00A0>
      | ^~~~~~~~
main.c:18:1: error: stray '\302' in program
   18 | <U+00A0>
      | ^~~~~~~~
main.c: In function 'main':
main.c:21:1: error: stray '\302' in program
   21 | <U+00A0><U+00A0><U+00A0><U+00A0>int n, k, i, t0, t1, t2, s;
      | ^~~~~~~~
main.c:21:2: error: stray '\302' in program
   21 | <U+00A0><U+00A0><U+00A0><U+00A0>int n, k, i, t0, t1, t2, s;
      |         ^~~~~~~~
main.c:21:3: error: stray '\302' in program
   21 | <U+00A0><U+00A0><U+00A0><U+00A0>int n, k, i, t0, t1, t2, s;
      |                 ^~~~~~~~
main.c:21:4: error: stray '\302' in program
   21 | <U+00A0><U+00A0><U+00A0><U+00A0>int n, k, i, t0, t1, t2, s;
      |                         ^~~~~~~~
main.c:22:1: error: stray '\302' in program
   22 | <U+00A0>
      | ^~~~~~~~
main.c:23:1: error: stray '\302' in program
   23 | <U+00A0><U+00A0><U+00A0><U+00A0>n = in(), k = in();
      | ^~~~~~~~
main.c:23:2: error: stray '\302' in program
   23 | <U+00A0><U+00A0><U+00A0><U+00A0>n = in(), k = in();
      |         ^~~~~~~~
main.c:23:3: error: stray '\302' in program
   23 | <U+00A0><U+00A0><U+00A0><U+00A0>n = in(), k = in();
      |                 ^~~~~~~~
main.c:23:4: error: stray '\302' in program
   23 | <U+00A0><U+00A0><U+00A0><U+00A0>n = in(), k = in();
      |                         ^~~~~~~~
main.c:24:1: error: stray '\302' in program
   24 | <U+00A0><U+00A0><U+00A0><U+00A0>if (k >= n) { printf("%d\n", n); return 0; }
      | ^~~~~~~~
main.c:24:2: error: stray '\302' in program
   24 | <U+00A0><U+00A0><U+00A0><U+00A0>if (k >= n) { printf("%d\n", n); return 0; }
      |         ^~~~~~~~
main.c:24:3: error: stray '\302' in program
   24 | <U+00A0><U+00A0><U+00A0><U+00A0>if (k >= n) { printf("%d\n", n); return 0; }
      |                 ^~~~~~~~
main.c:24:4: error: stray '\302' in program
   24 | <U+00A0><U+00A0><U+00A0><U+00A0>if (k >= n) { printf("%d\n", n); return 0; }
      |                         ^~~~~~~~
main.c:25:1: error: stray '\302' in program
   25 | <U+00A0>
      | ^~~~~~~~
main.c:26:1: error: stray '\302' in program
   26 | <U+00A0><U+00A0><U+00A0><U+00A0>n--, t0 = t1 = in();
      | ^~~~~~~~
main.c:26:2: error: stray '\302' in program
   26 | <U+00A0><U+00A0><U+00A0><U+00A0>n--, t0 = t1 = in();
      |         ^~~~~~~~
main.c:26:3: error: stray '\302' in program
   26 | <U+00A0><U+00A0><U+00A0><U+00A0>n--, t0 = t1 = in();
      |                 ^~~~~~~~
main.c:26:4: error: stray '\302' in program
   26 | <U+00A0><U+00A0><U+00A0><U+00A0>n--, t0 = t1 = in();
      |                         ^~~~~~~~
main.c:27:1: error: stray '\302' in program
   27 | <U+00A0><U+00A0><U+00A0><U+00A0>for (i = 0; i < n; i++)<U+00A0> t2 = in(), dt[i] = t2-t1-1, t1 = t2;
      | ^~~~~~~~
main.c:27:2: error: stray '\302' in program
   27 | <U+00A0><U+00A0><U+00A0><U+00A0>for (i = 0; i < n; i++)<U+00A0> t2 = in(), dt[i] = t2-t1-1, t1 = t2;
      |         ^~~~~~~~
main.c:27:3: error: stray '\302' in program
   27 | <U+00A0><U+00A0><U+00A0><U+00A0>for (i = 0; i < n; i++)<U+00A0> t2 = in(), dt[i] = t2-t1-1, t1 = t2;
      |                 ^~~~~~~~
main.c:27:4: error: stray '\302' in program
   27 | <U+00A0><U+00A0><U+00A0><U+00A0>for (i = 0; i < n; i++)<U+00A0> t2 = in(), dt[i] = t2-t1-1, t1 = t2;
      |                         ^~~~~~~~
main.c:27:28: error: stray '\302' in program
   27 | <U+00A0><U+00A0><U+00A0><U+00A0>for (i = 0; i < n; i++)<U+00A0> t2 = in(), dt[i] = t2-t1-1, t1 = t2;
      |                                                        ^~~~~~~~
main.c:28:1: error: stray '\302' in program
   28 | <U+00A0><U+00A0><U+00A0><U+00A0>if (k == 1) { printf("%d\n", t2-t0+1); return 0; }
      | ^~~~~~~~
main.c:28:2: error: stray '\302' in program
   28 | <U+00A0><U+00A0><U+00A0><U+00A0>if (k == 1) { printf("%d\n", t2-t0+1); return 0; }
      |         ^~~~~~~~
main.c:28:3: error: stray '\302' in program
   28 | <U+00A0><U+00A0><U+00A0><U+00A0>if (k == 1) { printf("%d\n", t2-t0+1); return 0; }
      |                 ^~~~~~~~
main.c:28:4: error: stray '\302' in program
   28 | <U+00A0><U+00A0><U+00A0><U+00A0>if (k == 1) { printf("%d\n", t2-t0+1); return 0; }
      |                         ^~~~~~~~
main.c:29:1: error: stray '\302' in program
   29 | <U+00A0>
      | ^~~~~~~~
main.c:30:1: error: stray '\302' in program
   30 | <U+00A0><U+00A0><U+00A0><U+00A0>qsort(dt, n, sizeof(int), cmp);
      | ^~~~~~~~
main.c:30:2: error: stray '\302' in program
   30 | <U+00A0><U+00A0><U+00A0><U+00A0>qsort(dt, n, sizeof(int), cmp);
      |         ^~~~~~~~
main.c:30:3: error: stray '\302' in program
   30 | <U+00A0><U+00A0><U+00A0><U+00A0>qsort(dt, n, sizeof(int), cmp);
      |                 ^~~~~~~~
main.c:30:4: error: stray '\302' in program
   30 | <U+00A0><U+00A0><U+00A0><U+00A0>qsort(dt, n, sizeof(int), cmp);
      |                         ^~~~~~~~
main.c:30:31: error: passing argument 4 of 'qsort' from incompatible pointer type [-Wincompatible-pointer-types]
   30 |     qsort(dt, n, sizeof(int), cmp);
      |                               ^~~
      |                               |
      |                               int (*)(int *, int *)
In file included from main.c:5:
/usr/include/stdlib.h:971:34: note: expected '__compar_fn_t' {aka 'int (*)(const void *, const void *)'} but argument is of type 'int (*)(int *, int *)'
  971 |                    __compar_fn_t __compar) __nonnull ((1, 4));
      |                    ~~~~~~~~~~~~~~^~~~~~~~
main.c:31:1: error: stray '\302' in program
   31 | <U+00A0>
      | ^~~~~~~~
main.c:32:1: error: stray '\302' in program
   32 | <U+00A0><U+00A0><U+00A0><U+00A0>s = 0, k--;
      | ^~~~~~~~
main.c:32:2: error: stray '\302' in program
   32 | <U+00A0><U+00A0><U+00A0><U+00A0>s = 0, k--;
      |         ^~~~~~~~
main.c:32:3: error: stray '\302' in program
   32 | <U+00A0><U+00A0><U+00A0><U+00A0>s = 0, k--;
      |                 ^~~~~~~~
main.c:32:4: error: stray '\302' in program
   32 | <U+00A0><U+00A0><U+00A0><U+00A0>s = 0, k--;
      |                         ^~~~~~~~
main.c:33:1: error: stray '\302' in program
   33 | <U+00A0><U+00A0><U+00A0><U+00A0>for (i = 0; k--; i++) s += dt[i];
      | ^~~~~~~~
main.c:33:2: error: stray '\302' in program
   33 | <U+00A0><U+00A0><U+00A0><U+00A0>for (i = 0; k--; i++) s += dt[i];
      |         ^~~~~~~~
main.c:33:3: error: stray '\302' in program
   33 | <U+00A0><U+00A0><U+00A0><U+00A0>for (i = 0; k--; i++) s += dt[i];
      |                 ^~~~~~~~
main.c:33:4: error: stray '\302' in program
   33 | <U+00A0><U+00A0><U+00A0><U+00A0>for (i = 0; k--; i++) s += dt[i];
      |                         ^~~~~~~~
main.c:34:1: error: stray '\302' in program
   34 | <U+00A0><U+00A0><U+00A0><U+00A0>printf("%d\n", t2-t0+1-s);
      | ^~~~~~~~
main.c:34:2: error: stray '\302' in program
   34 | <U+00A0><U+00A0><U+00A0><U+00A0>printf("%d\n", t2-t0+1-s);
      |         ^~~~~~~~
main.c:34:3: error: stray '\302' in program
   34 | <U+00A0><U+00A0><U+00A0><U+00A0>printf("%d\n", t2-t0+1-s);
      |                 ^~~~~~~~
main.c:34:4: error: stray '\302' in program
   34 | <U+00A0><U+00A0><U+00A0><U+00A0>printf("%d\n", t2-t0+1-s);
      |                         ^~~~~~~~
main.c:35:1: error: stray '\302' in program
   35 | <U+00A0><U+00A0><U+00A0><U+00A0>return 0;
      | ^~~~~~~~
main.c:35:2: error: stray '\302' in program
   35 | <U+00A0><U+00A0><U+00A0><U+00A0>return 0;
      |         ^~~~~~~~
main.c:35:3: error: stray '\302' in program
   35 | <U+00A0><U+00A0><U+00A0><U+00A0>return 0;
      |                 ^~~~~~~~
main.c:35:4: error: stray '\302' in program
   35 | <U+00A0><U+00A0><U+00A0><U+00A0>return 0;
      |                         ^~~~~~~~