func_code_string: #include <bits/stdc++.h>   const long long INF = 1000 * 1000 * 1000 + 47;   const long long LINF = INF * (long long)INF;   using namespace std;   const int mod = 1000 * 1000 * 1000 + 9;   const int MAX = 100005;   pair<int, int> pts[MAX];   int n, k;   struct node {     int x, y, l, r;     int dp0, dp1;     node() { l = r = -1; }     node(pair<int, int> pt) {       l = r = -1;       x = pt.first, y = pt.second;       dp1 = 1;       dp0 = 0;     }   };   node treap[MAX];   int getDp0(int u) {     if (u == -1) return 0;     return treap[u].dp0;   }   int getDp1(int u) {     if (u == -1) return 0;     return treap[u].dp1;   }   void upd(int root) {     if (root == -1) return;     treap[root].dp1 = 1 + getDp0(treap[root].l) + getDp0(treap[root].r);     treap[root].dp0 = max(treap[root].dp1 - 1,                           max(getDp0(treap[root].l) + getDp1(treap[root].r),                               getDp1(treap[root].l) + getDp0(treap[root].r)));   }   int merge(int l, int r) {     if (l == -1) return r;     if (r == -1) return l;     int root;     if (treap[l].y > treap[r].y) {       root = l;       treap[l].r = merge(treap[l].r, r);     } else {       root = r;       treap[r].l = merge(l, treap[r].l);     }     upd(root);     return root;   }   pair<int, int> split(int root, int x) {     if (root == -1) return {-1, -1};     pair<int, int> res;     if (treap[root].x <= x) {       res = split(treap[root].r, x);       treap[root].r = res.first;       res = {root, res.second};     } else {       res = split(treap[root].l, x);       treap[root].l = res.second;       res = {res.first, root};     }     upd(res.first);     upd(res.second);     return res;   }   int main() {     ios_base::sync_with_stdio(0);     int root = -1;     cin >> n >> k;     for (int i = 0; i < k; i++) {       cin >> pts[i].first >> pts[i].second;     }     int a, b, c, d;     cin >> a >> b >> c >> d;     for (int i = k; i < n; i++) {       pts[i].first = ((a * (long long)pts[i - 1].first) + b) % mod;       pts[i].second = ((c * (long long)pts[i - 1].second) + d) % mod;     }     sort(pts, pts + n);     for (int i = 0; i < n; i++) {       treap[i] = node(pts[i]);       root = merge(root, i);     }     int q;     cin >> q;     while (q--) {       int l, r;       cin >> l >> r;       auto roots = split(root, l - 1);       auto roots2 = split(roots.second, r);       cout << ((roots2.first == -1) ? 0 : treap[roots2.first].dp0) << endl;       root = merge(roots.first, merge(roots2.first, roots2.second));     }   }   