func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long maxn = 2e5 + 5;   struct Node {     long long ls, rs, val, key, cnt, tag, add;   };   Node t[maxn];   long long pol;   void newnode(long long vv) {     t[++pol].val = vv;     t[pol].cnt = 0;     t[pol].key = rand();     t[pol].ls = t[pol].rs = 0;     t[pol].tag = t[pol].add = 0;     return;   }   void lazy1(long long p, long long k) {     t[p].val += k;     return;   }   void lazy2(long long p, long long k) {     t[p].cnt += k;     return;   }   void pushdown(long long p) {     t[t[p].ls].tag += t[p].tag;     t[t[p].rs].tag += t[p].tag;     lazy1(t[p].ls, t[p].tag);     lazy1(t[p].rs, t[p].tag);     t[p].tag = 0;     t[t[p].ls].add += t[p].add;     t[t[p].rs].add += t[p].add;     lazy2(t[p].ls, t[p].add);     lazy2(t[p].rs, t[p].add);     t[p].add = 0;     return;   }   long long merge(long long x, long long y) {     if (!x || !y) return x + y;     if (t[x].key < t[y].key) {       pushdown(x);       t[x].rs = merge(t[x].rs, y);       return x;     } else {       pushdown(y);       t[y].ls = merge(x, t[y].ls);       return y;     }     return 0;   }   void split(long long now, long long &rx, long long &ry, long long k) {     if (!now) {       rx = ry = 0;       return;     }     pushdown(now);     if (t[now].val <= k) {       rx = now;       split(t[now].rs, t[rx].rs, ry, k);     } else {       ry = now;       split(t[now].ls, rx, t[ry].ls, k);     }     return;   }   long long rt, rx, ry, rz;   void ins(long long nd) {     split(rt, rx, rz, t[nd].val);     rt = merge(merge(rx, nd), rz);     return;   }   void dfs(long long now, long long cc) {     if (!now) return;     pushdown(now);     t[now].val -= cc;     t[now].cnt++;     dfs(t[now].ls, cc);     dfs(t[now].rs, cc);     t[now].ls = t[now].rs = 0;     ins(now);     return;   }   void out(long long now) {     if (!now) return;     pushdown(now);     out(t[now].ls);     cout << t[now].val <<    ;     out(t[now].rs);     return;   }   void costv(long long cc) {     split(rt, rx, ry, cc - 1);     split(ry, ry, rz, 2 * cc);     t[rz].tag -= cc;     lazy1(rz, -cc);     t[rz].add++;     lazy2(rz, 1);     rt = merge(rx, rz);     dfs(ry, cc);     return;   }   struct tshirts {     long long c, q;     bool friend operator<(tshirts t1, tshirts t2) {       return t1.q == t2.q ? t1.c < t2.c : t1.q > t2.q;     }   };   tshirts st[maxn];   long long n, k;   long long v[maxn];   void dfsans(long long now) {     if (!now) return;     pushdown(now);     dfsans(t[now].ls);     dfsans(t[now].rs);     return;   }   int main() {     scanf( %lld , &n);     for (int i = 1; i <= n; i++) {       scanf( %lld %lld , &st[i].c, &st[i].q);     }     sort(st + 1, st + n + 1);     scanf( %lld , &k);     for (int i = 1; i <= k; i++) {       scanf( %lld , &v[i]);       newnode(v[i]);       ins(i);     }     for (int i = 1; i <= n; i++) {       costv(st[i].c);     }     dfsans(rt);     for (int i = 1; i <= k; i++) {       printf( %lld  , t[i].cnt);     }     puts(  );     return 0;   }   