func_code_string: #include <bits/stdc++.h>   using namespace std;   long long j, k, a, b, s, ss, l, m, n, t, d;   long long e, i, c[221];   vector<long long> p[111], q[111], r, v;   char w;   map<long long, long long> y, z;   long long too(long long i, long long j) {     long long l = 0, d = 0;     for (k = 0; k < q[i].size(); k++) {       l += q[i][k];       r.push_back(l);     }     l = 0;     for (k = 0; k < q[j].size(); k++) {       l += q[j][k];       r.push_back(l);     }     l = r.size();     sort(r.begin(), r.end());     for (k = 0; k < l; k++) c[k] = 0;     for (k = 0; k < l; k++) {       long long x, a = 0, b = 0, e = 0;       x = r[k];       while (x > q[i][e] && e < q[i].size()) {         a += p[i][e] * q[i][e];         x -= q[i][e];         e++;       }       if (e < q[i].size()) a += p[i][e] * x;       x = r[k];       e = 0;       while (x > q[j][e] && e < q[j].size()) {         b += p[j][e] * q[j][e];         x -= q[j][e];         e++;       }       if (e < q[j].size()) b += p[j][e] * x;       if (a > b) c[k] = 1;       if (a < b) c[k] = 2;     }     e = 0;     while (c[e] == 0) e++;     for (k = e + 1; k < l; k++) {       if (c[k] == 0) c[k] = c[k - 1];     }     for (k = e + 1; k < l; k++)       if (c[k] != c[k - 1]) d++;     return d;   }   int main() {     cin >> n >> s;     for (i = 0; i < n; i++) {       cin >> k;       for (j = 0; j < k; j++) {         cin >> a >> b;         p[i].push_back(a);         q[i].push_back(b);       }     }     for (i = 0; i < n; i++) {       for (j = i + 1; j < n; j++) {         ss += too(i, j);         r = v;       }     }     cout << ss;     return 0;   }   