func_code_string: #include <bits/stdc++.h>   using namespace std;   int p[6005], q[6005];   bool check(int a, int b, int x) { return x > a && x < b; }   bool check2(int a, int b, int x) { return x >= a && x <= b; }   bool isOK(int a, int b) { return a == b; }   int sx[1005], sy[1005];   int main() {     int n, t, i, j, a, x, k;     memset(p, 0, sizeof p);     memset(q, 0, sizeof q);     scanf( %d%d , &n, &t);     for (i = 0; i < n; ++i) {       scanf( %d%d , &x, &a);       x *= 2;       sx[i] = x - a;       sy[i] = x + a;       for (j = 6000; j > 0; --j) {         k = -j;         if (p[j] == -1) continue;         if (check2(x - a, x + a, k) || check(x - a, x + a, k - t) ||             check(x - a, x + a, k + t)) {           p[j] = -1;           continue;         }         if (p[j] == 0) {           if (isOK(x - a, k + t) || isOK(x + a, k - t)) {             p[j] = 1;           }         }       }       for (j = 0; j <= 6000; ++j) {         k = j;         if (q[j] == -1) continue;         if (check2(x - a, x + a, k) || check(x - a, x + a, k - t) ||             check(x - a, x + a, k + t)) {           q[j] = -1;           continue;         }         if (q[j] == 0) {           if (isOK(x - a, k + t) || isOK(x + a, k - t)) q[j] = 1;         }       }     }     for (j = 0, i = 1; i <= 6000; ++i)       if (p[i] == 1) {         for (k = 0; k < n; ++k) {           if (check(-i - t, -i + t, sx[k]) || check(-i - t, -i + t, sy[k])) break;         }         if (k == n) ++j;       }     for (i = 0; i <= 6000; ++i)       if (q[i] == 1) {         for (k = 0; k < n; ++k) {           if (check(i - t, i + t, sx[k]) || check(i - t, i + t, sy[k])) break;         }         if (k == n) ++j;       }     printf( %d n , j);     return 0;   }   