func_code_string: #include <bits/stdc++.h>   using namespace std;   struct obj {     int id;     int f, t;     obj(int a, int b, int c) {       id = a;       f = b;       t = c;     }   };   bool cmpup(obj a, obj b) {     if (a.f == b.f) {       return a.id > b.id;     }     return a.f < b.f;   }   bool cmpdown(obj a, obj b) {     if (a.f == b.f) {       return a.id < b.id;     }     return a.f > b.f;   }   int n;   vector<obj> up;   vector<obj> down;   int a[105], d[105];   int now[105];   int main() {     scanf( %d , &n);     for (int i = 0; i < n; i++) {       scanf( %d%d , &a[i], &d[i]);       now[i] = a[i];       if (d[i] > 0)         up.push_back(obj(i, a[i], a[i] + d[i]));       else if (d[i] < 0)         down.push_back(obj(i, a[i], a[i] + d[i]));     }     sort(up.begin(), up.end(), cmpup);     sort(down.begin(), down.end(), cmpdown);     int ans = 0;     for (int i = 0; i < up.size(); i++) {       for (int j = 0; j < n; j++) {         if (j == up[i].id) continue;         if (now[j] < up[i].f || now[j] > up[i].t) continue;         if (now[j] == up[i].f) {           if (j < up[i].id) ans++;         } else if (now[j] == up[i].t) {           if (j > up[i].id) ans++;         } else {           ans++;         }       }       now[up[i].id] = up[i].t;     }     for (int i = 0; i < down.size(); i++) {       for (int j = 0; j < n; j++) {         if (j == down[i].id) continue;         if (now[j] < down[i].t || now[j] > down[i].f) continue;         if (now[j] == down[i].f) {           if (j > down[i].id) ans++;         } else if (now[j] == down[i].t) {           if (j < down[i].id) ans++;         } else {           ans++;         }       }       now[down[i].id] = down[i].t;     }     printf( %d n , ans);     return 0;   }   