#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long lond
#define lli long long int
using namespace std;
ll d[200005],u[200005],n,m,l,r,x;
void res(ll l,ll r,ll x){
    ll br=0;
    for (int i=l;i<=r;i++){
        if (d[i]>=x and u[i]<=x) br++;
    }
    cout << br << endl;
}
int main() {
    scanf("%lld",&n);
    scanf("%lld",&m);
    for (int i=1;i<=n;i++){
        cin >> d[i] >> u[i];
    }
    for (int i=1;i<=m;i++){
        cin >> l >> r >> x;
        res(l,r,x);
    }
    return 0;
}