func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long mod = 1e9 + 7;   int n, k, m, res = 0, sm = 0, edge = -1, nb = 1;   int a[200055], b[200050], nxt[200505], dp[200005] = {0}, ans[500005];   multiset<int> st, st1, st2;   set<int> stres;   string s, s1, s2, s3, s4;   vector<int> v[200050], vnode, vans, v3;   vector<pair<int, int> > vv, vv1, adj, v1, v2;   vector<pair<int, pair<int, int> > > vvv;   priority_queue<int> q;   map<int, int> mp;   multiset<int>::iterator it, it1, it2;   int voyel(char c) {     if (c ==  a  || c ==  e  || c ==  i  || c ==  o  || c ==  u  || c ==  y )       return 1;     return 0;   }   int up[200005][20];   void solve() {     int i, j;     up[m + 1][0] = -1;     for (i = 1; i <= m; i++) {       int nxtt = nxt[b[i]];       int idx = lower_bound(v[nxtt].begin(), v[nxtt].end(), i) - v[nxtt].begin();       if (idx != v[nxtt].size()) {         int idxb = v[nxtt][idx];         up[i][0] = idxb;       } else         up[i][0] = -1;     }     for (int j = 1; j < 20; j++) {       for (i = 1; i <= m; i++)         if (up[i][j - 1] != -1) up[i][j] = up[up[i][j - 1]][j - 1];     }     for (i = 1; i <= m; i++) {       int bsup = i;       int x = n - 1;       for (j = 19; j >= 0; j--) {         if ((1 << j) <= x) {           x -= (1 << j);           if (bsup != -1) bsup = up[bsup][j];         }       }       if (bsup != -1) {         dp[i] = bsup;       }     }   }   int main() {     ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);     int i = 0, j = 0, x, y, z = 0, mx = 0, nb0 = 0, nb1 = 0, nbmax = 0, nbinf = 0,         mm = 5e9, idx = 0, ok = 0, l, r, negatif = 0, positif = 0, q, d, res1 = 0;     char c;     cin >> n >> m >> q;     for (i = 1; i <= n; i++) {       cin >> a[i];     }     for (i = 1; i <= n; i++) nxt[a[i]] = a[i + 1];     nxt[a[n]] = a[1];     for (i = 1; i <= m; i++) {       cin >> b[i];       v[b[i]].push_back(i);     }     for (i = 1; i <= n; i++) {       sort(v[i].begin(), v[i].end());     }     memset(up, -1, sizeof(up));     solve();     idx = m + 1;     mx = 5e9;     for (i = m; i >= 1; i--) {       if (dp[i]) mx = min(mx, dp[i]);       ans[i] = mx;     }     s =   ;     while (q--) {       cin >> x >> y;       res = (ans[x] <= y);       if (res != 0)         s +=  1 ;       else         s +=  0 ;     }     cout << s;     return 0;   }   