#include <bits/stdc++.h>   using namespace std;   clock_t __stt;   inline void TStart() { __stt = clock(); }   inline void TReport() {     cerr << fixed << setprecision(3) <<   nCurrent Case Taken Time :            << (double)(clock() - __stt) / CLOCKS_PER_SEC <<  sec n ;   }   template <typename T>   T MIN(T a, T b) {     return a < b ? a : b;   }   template <typename T>   T MAX(T a, T b) {     return a > b ? a : b;   }   template <typename T>   T ABS(T a) {     return a > 0 ? a : (-a);   }   template <typename T>   void UMIN(T &a, T b) {     if (b < a) a = b;   }   template <typename T>   void UMAX(T &a, T b) {     if (b > a) a = b;   }   int n, m, p[100005], s[100005], b[100005], inc[100005], pref[100005];   struct ele {     int A, B, C, id;     void set(int _A, int _B, int _C, int _id) {       A = _A;       B = _B;       C = _C;       id = _id;     }   } es[100005], et[100005];   struct qry {     int Al, Ar, B, C;     void set(int _Al, int _Ar, int _B, int _C) {       Al = _Al;       Ar = _Ar;       B = _B;       C = _C;     }   } qs[100005], qt[100005];   namespace BIT {   int arr[300005];   void add(int p, int v = 1) {     ++p;     while (p <= 300002) {       arr[p] += v;       p += (p & (-p));     }   }   void clr(int p) {     ++p;     while (p <= 300002) {       arr[p] = 0;       p += (p & (-p));     }   }   int sum(int p) {     int r = 0;     ++p;     while (p) {       r += arr[p];       p -= (p & (-p));     }     return r;   }   }  // namespace BIT   bool cmpB(ele a, ele b) { return a.B < b.B; }   bool cmpC(ele a, ele b) { return a.C < b.C; }   bool cmpBq(qry a, qry b) { return a.B < b.B; }   bool cmpCq(qry a, qry b) { return a.C < b.C; }   vector<int> vs;   int id(int v) { return lower_bound(vs.begin(), vs.end(), v) - vs.begin(); }   int res[100005];   void solve2d(ele *E, int ec, qry *Q, int qc) {     int i, j, k;     sort(E, E + ec, cmpB);     sort(Q, Q + qc, cmpBq);     reverse(Q, Q + qc);     reverse(E, E + ec);     j = 0;     for (i = 0; i < ec; ++i) {       int cB = E[i].B;       while (j < qc && Q[j].B >= cB) {         BIT::add(Q[j].Al, 1);         BIT::add(Q[j].Ar + 1, -1);         ++j;       }       res[E[i].id] += BIT::sum(E[i].A);     }     for (i = 0; i < qc; ++i) {       BIT::clr(Q[i].Al);       BIT::clr(Q[i].Ar + 1);     }   }   void solve(int cl, int cr, int ql, int qr, int el, int er) {     if (ql > qr || el > er) return;     int i, j, k;     if (cl == cr) {       solve2d(es + el, er - el + 1, qs + ql, qr - ql + 1);       return;     }     memcpy(et + el, es + el, sizeof(ele) * (er - el + 1));     memcpy(qt + ql, qs + ql, sizeof(qry) * (qr - ql + 1));     int cM = ((long long)cl + (long long)cr) / 2ll, qM, eM;     for (qM = ql; qM <= qr; ++qM) {       if (qt[qM].C <= cM && (qM == qr || qt[qM + 1].C > cM)) break;     }     if (qt[ql].C > cM) qM = ql - 1;     for (eM = el; eM <= er; ++eM) {       if (et[eM].C <= cM && (eM == er || et[eM + 1].C > cM)) break;     }     if (et[el].C > cM) eM = el - 1;     if (er > eM && qM >= ql) solve2d(et + eM + 1, er - eM, qt + ql, qM - ql + 1);     solve(cl, cM, ql, qM, el, eM);     solve(cM + 1, cr, qM + 1, qr, eM + 1, er);   }   int main() {     int i, j, k;     scanf( %d%d , &n, &m);     for (i = 0; i < n; ++i) scanf( %d , p + i);     for (i = 0; i < n; ++i) scanf( %d , s + i);     for (i = 0; i < n; ++i) scanf( %d , b + i);     for (i = 0; i < m; ++i) scanf( %d , inc + i);     for (i = 0; i < m; ++i) scanf( %d , pref + i);     for (i = 0; i < n; ++i) {       qs[i].Al = p[i];       qs[i].Ar = s[i];       vs.push_back(p[i]);       vs.push_back(s[i]);       qs[i].B = b[i] - p[i];       qs[i].C = b[i] + p[i];     }     for (j = 0; j < m; ++j) {       es[j].A = inc[j];       vs.push_back(inc[j]);       es[j].B = pref[j] - inc[j];       es[j].C = pref[j] + inc[j];       es[j].id = j;     }     sort(vs.begin(), vs.end());     vs.erase(unique(vs.begin(), vs.end()), vs.end());     for (i = 0; i < n; ++i) {       qs[i].Al = id(qs[i].Al);       qs[i].Ar = id(qs[i].Ar);     }     for (j = 0; j < m; ++j) {       es[j].A = id(es[j].A);     }     sort(es, es + m, cmpC);     sort(qs, qs + n, cmpCq);     solve(0, (int)2e9 + 5, 0, n - 1, 0, m - 1);     for (i = 0; i < m; ++i) {       printf( %d  , res[i]);     }     return 0;   }   