#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <iomanip> 
#include <map>
#include <string>
#include <list>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <iterator>
#include <queue>
#include <set>


#define f(n) for (long long i = 0; i < n; i++)
#define f0(n) for (int j = 0; j < n; j++)
#define co(n) cout << n << "\n";

using namespace std;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

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

    vector<pair<double, double>> v(n);
    f(n)
    {
        double a, b;
        cin >> a >> b;
        v[i].first = (a + b) / 2;
        v[i].second = (b - a) / 2;
    }

    vector<tuple<int, int, int>> u(m);
    f(m)
    {
        int a0, a1, a2;
        cin >> a0 >> a1 >> a2;
        u[i] = make_tuple(a0 - 1, a1 - 1, a2);
    }

    f(m)
    {
        int l = get<0>(u[i]), d = get<1>(u[i]), t = get<2>(u[i]);
        int r = 0;
        for(int i0 = l; i0 <= d; i0++) if (abs(t - v[i0].first) <= v[i0].second) r++;
        co(r);
    }
}