#define here cerr<<"===========================================\n"
#define dbg(x) cerr<<#x<<": "<<x<<endl;
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define ld double
#define ll long long
#define llinf 100000000000000000LL // 10^17
#define pb push_back
#define popb pop_back
#define fi first
#define sc second
#define endl '\n'
#define pll pair<ll,ll>
#define pld pair<ld,ld>
#define sz(a) (ll)(a.size())
#define all(a) a.begin(),a.end()
#define ceri(a,l,r) {cerr<<#a<<": ";for(ll i_ = l;i_<=r;i_++) cerr<<a[i_]<< " ";cerr<<endl;}
#define cer(a) {cerr<<#a<<": ";for(ll x_ : a) cerr<<x_<< " ";cerr<<endl;}

#define daj_mi_malo_vremena ios_base::sync_with_stdio(false);cerr.tie(0);cout.tie(0);cin.tie(0);

using namespace std;
#define maxn 200005
struct upit{
    ll l,r,x,id;
};
bool cmp(upit a,upit b){return a.x<b.x;}
ll n,q;
pll a[maxn];
ll t[4*maxn],ans[maxn];
upit v[maxn];
void upd(ll v,ll tl,ll tr,ll i,ll x){
    if(tl==tr){t[v] = x;return;}
    ll mid = (tl+tr)/2;
    if(i<=mid) upd(2*v,tl,mid,i,x);
    else upd(2*v+1,mid+1,tr,i,x);
    t[v] = t[2*v] + t[2*v+1];
}
ll sum(ll v,ll tl,ll tr,ll l,ll r){
    if(l>r) return 0;
    if(tl==l&&tr==r) return t[v];
    ll mid = (tl+tr)/2;
    return sum(2*v,tl,mid,l,min(mid,r)) + sum(2*v+1,mid+1,tr,max(mid+1,l),r);
}
vector<pll> s;
int main(){
	daj_mi_malo_vremena;
    cin >> n >> q;
    for(ll i = 1;i<=n;i++) cin >> a[i].fi >> a[i].sc;
    for(ll i = 1;i<=q;i++) cin >> v[i].l >> v[i].r >> v[i].x;
    for(ll i = 1;i<=q;i++) v[i].id = i;
    sort(v+1,v+q+1,cmp);
    for(ll i = 1;i<=n;i++) s.pb({a[i].fi,i}),s.pb({a[i].sc+1,-i});
    sort(all(s));
    ll j = 0;
    for(ll i = 1;i<=q;i++){
        ll x = v[i].x;
        while(j<sz(s)&&s[j].fi<=x){
            ll k = s[j].sc;
            if(k>0) upd(1,1,n,k,1);
            else upd(1,1,n,-k,0);
            j++;
        }
        ans[v[i].id] = sum(1,1,n,v[i].l,v[i].r);
    }
    for(ll i = 1;i<=q;i++) cout<<ans[i]<<endl;
	return 0;
}