#include <iostream>
#include <vector>
using namespace std;

int odgovor(int l, int r, int x, vector<vector<int>> vage) {
    int k=0;
    for (int i=l-1; i<r; i++) {
        if(x<=vage[i][1]){if(vage[i][1]-vage[i][0]>=vage[i][1]-x) k++;}
    }
    return k;
}

int main()
{
    int n,m;
    cin >> n >> m;
    vector<vector<int>> vage(n, vector<int>(2,0));
    vector<vector<int>> pitanja(m, vector<int>(3,0));
    for (int i=0; i<n; i++) {
        cin >> vage[i][0] >> vage[i][1];
    }
    for (int i=0; i<m; i++) {
        cin >> pitanja[i][0] >> pitanja[i][1] >> pitanja[i][2];
    }
    for (int i=0; i<m; i++) {
        cout << odgovor(pitanja[i][0],pitanja[i][1],pitanja[i][2],vage) << endl;
    }
    return 0;
}