func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 2e5 + 5;   vector<int> g[N];   int a[N], b[N], last[N], indx[N], lvl[N], ans[N];   int n, m, q;   void dfs(int node, int sz) {     lvl[sz++] = node;     for (int i = 0; i < g[node].size(); i++) {       dfs(g[node][i], sz);     }     if (sz >= n)       ans[node] = lvl[sz - n];     else       ans[node] = N;     sz--;   }   int tree[N << 2];   void build(int i, int l, int r) {     if (l == r) return void(tree[i] = ans[l]);     int mid = (l + r) >> 1;     build(i << 1, l, mid);     build(i << 1 | 1, mid + 1, r);     tree[i] = min(tree[i << 1], tree[i << 1 | 1]);   }   int get(int i, int l, int r, int a, int b) {     if (l > b || r < a) return N;     if (l >= a && r <= b) return tree[i];     int mid = (l + r) >> 1;     return min(get(i << 1, l, mid, a, b), get(i << 1 | 1, mid + 1, r, a, b));   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cin >> n >> m >> q;     for (int i = 0; i < n; i++) cin >> a[i], indx[a[i]] = i;     for (int i = 0; i < m; i++) cin >> b[i];     memset(last, -1, sizeof last);     vector<int> roots;     for (int i = m - 1; i >= 0; i--) {       int x = a[(indx[b[i]] + 1) % n];       if (last[x] == -1)         roots.push_back(i);       else         g[last[x]].push_back(i);       last[b[i]] = i;     }     for (auto r : roots) dfs(r, 0);     build(1, 0, m - 1);     for (int i = 0, l, r; i < q; i++) {       cin >> l >> r;       l--, r--;       cout << (get(1, 0, m - 1, l, r) <= r);     }     return 0;   }   