#include <bits/stdc++.h>

#define pb push_back
#define MAXN 200010

using namespace std;

int bit[MAXN];

int get(int x) {

    int ans = 0;
    for(int i = x; i > 0; i -= i & -i)
        ans += bit[i];
    return ans;
}

void upd(int x, int n, int diff) {

    for(int i = x; i <= n; i += i & -i)
        bit[i] += diff;
}

enum Type { down, val, up };

class Moment {
public:
    int i, l, r, index;
    Type t;

    Moment(int i, int l, int r, int index, Type t) {
        this->i = i;
        this->l = l;
        this->r = r;
        this->index = index;
        this->t = t;
    }
};

bool cmp(Moment a, Moment b) {

    if(a.i < b.i)
        return true;
    if(b.i < a.i)
        return false;
    return a.t < b.t;
}

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n, m;
    cin >> n >> m;

    vector<Moment> mom;
    for(int i = 0; i < n; i++) {
        int d, u;
        cin >> d >> u;

        mom.pb(Moment(d, i + 1, -1, -1, down));
        mom.pb(Moment(u, i + 1, -1, -1, up));
    }

    for(int i = 0; i < m; i++) {
        int l, r, x;
        cin >> l >> r >> x;

        mom.pb(Moment(x, l, r, i, val));
    }
    sort(mom.begin(), mom.end(), cmp);

    int ans[m];
    for(Moment k: mom) {
        if(k.t == down)
            upd(k.l, n, 1);
        else if(k.t == up)
            upd(k.l, n, -1);
        else
            ans[k.index] = get(k.r) - get(k.l - 1);
    }

    for(int k: ans)
        cout << k << endl;
    return 0;
}