func_code_string: #include <bits/stdc++.h>   using namespace std;   class fenwick {     int n;     vector<long long> v;       public:     long long sum(int r) {       long long rval = 0;       for (; r >= 0; r = (r & (r + 1)) - 1) {         rval += v[r];       }       return rval;     }     void update(int in, int d) {       for (; in < n; in = (in | (in + 1))) {         v[in] += d;       }     }     fenwick(int N) : n(N) { v.resize(n, 0); }   };   class udalost {    public:     int typ, wh, i, t;   };   bool cmp(udalost& a, udalost& b) {     if (a.t == b.t) {       return a.typ < b.typ;     }     return a.t < b.t;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int n, m;     cin >> n >> m;     vector<int> p(n), s(n), b(n), inc(m), pref(m), ans(m, 0);     for (int i = 0; i < n; i++) {       cin >> p[i];     }     for (int i = 0; i < n; i++) {       cin >> s[i];     }     for (int i = 0; i < n; i++) {       cin >> b[i];     }     for (int i = 0; i < m; i++) {       cin >> inc[i];     }     for (int i = 0; i < m; i++) {       cin >> pref[i];     }     vector<udalost> u;     set<long long> x;     for (int i = 0; i < n; i++) {       u.push_back({0, p[i] + b[i], 1, p[i]});       u.push_back({1, b[i] + 1 - p[i], -1, p[i]});       u.push_back({0, p[i] + b[i], -1, s[i] + 1});       u.push_back({1, b[i] + 1 - p[i], 1, s[i] + 1});       x.insert(p[i] + b[i]);       x.insert(b[i] + 1 - p[i]);     }     for (int i = 0; i < m; i++) {       u.push_back({2, pref[i], i, inc[i]});       x.insert(pref[i] + inc[i]);       x.insert(pref[i] - inc[i]);     }     sort(u.begin(), u.end(), cmp);     map<int, int> xs;     while (!x.empty()) {       xs[*x.begin()] = xs.size();       x.erase(x.begin());     }     fenwick l(xs.size()), r(xs.size());     for (int i = 0; i < u.size(); i++) {       if (u[i].typ == 0) {         l.update(xs[u[i].wh], u[i].i);       } else if (u[i].typ == 1) {         r.update(xs[u[i].wh], u[i].i);       } else {         ans[u[i].i] = l.sum(xs[u[i].wh + u[i].t]) + r.sum(xs[u[i].wh - u[i].t]);       }     }     for (int i = 0; i < m; i++) {       cout << ans[i] <<    ;     }     cout <<   n ;     return 0;   }   