func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, q;   int A[600006];   int gcd(int a, int b) { return !b ? a : gcd(b, a % b); }   map<pair<int, int>, int> M;   int L[600006], R[600006], lst[600006], cn;   struct que {     int l, r, idx;   } Q[600006];   vector<int> bc[600006];   int T[600006];   void ad(int x, int c) {     while (x <= cn) T[x] += c, x += (x & -x);   }   int sum(int x) {     int ret = 0;     while (x > 0) ret += T[x], x -= (x & -x);     return ret;   }   int ans[600006];   void solve() {     cin >> n;     for (int i = (1), iend = (n); i <= iend; ++i) {       int k;       scanf( %d , &k);       L[i] = cn + 1;       int px, py, tx, ty, x, y, sx, sy;       scanf( %d%d , &px, &py);       sx = px, sy = py;       for (int j = (1), jend = (k); j <= jend; ++j) {         if (j != k)           scanf( %d%d , &x, &y);         else           x = sx, y = sy;         tx = x, ty = y;         x -= px, y -= py;         int g = gcd(abs(x), abs(y));         x /= g, y /= g;         ++cn;         lst[cn] = M[make_pair(x, y)];         bc[lst[cn]].push_back(cn);         M[make_pair(x, y)] = cn;         px = tx, py = ty;       }       R[i] = cn;     }     cin >> q;     for (int i = (1), iend = (q); i <= iend; ++i) {       int l, r;       scanf( %d%d , &l, &r);       l = L[l], r = R[r];       Q[i] = (que){l, r, i};     }     sort(Q + 1, Q + 1 + q, [](que a, que b) { return a.l < b.l; });     int cur = 1;     for (int i = (0), iend = (cn); i <= iend; ++i) {       while (cur <= q && Q[cur].l == i) {         ans[Q[cur].idx] = sum(Q[cur].r) - sum(Q[cur].l - 1);         ++cur;       }       for (int x : bc[i]) ad(x, 1);     }     for (int i = (1), iend = (q); i <= iend; ++i) printf( %d n , ans[i]);   }   signed main() { solve(); }   