#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "algos/debug.h"
#else
#define debug(...) 42;
#endif
#define all(x) (x).begin(), (x).end()
#define isz(x) (int)x.size()
#define int long long
const int sz = 2e5 + 1, inf = 1e9, mod = 1e9 + 7;
array<int, 2> a[sz];
int l[sz], r[sz];
struct MergeSortTree {};
void run(int tc) {
int n, q;
cin >> n >> q;
for (int i = 1; i <= n; i++) {
cin >> a[i][0] >> a[i][1];
}
sort(a + 1, a + 1 + n);
for (int i = 1; i <= n; i++) {
l[i] = a[i][0];
r[i] = a[i][1];
}
while (q--) {
int x, y, z;
cin >> x >> y >> z;
auto it = lower_bound(l + 1, l + 1 + n, x) - l;
int ans = 0;
for (int i = it; i <= n; i++) {
if (a[i][0] + a[i][1] >= z && a[i][1] >= y) {
ans++;
}
}
cout << ans << '\n';
}
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1;
// cin >> t;
for (int tc = 1; tc <= t; tc++)
run(tc);
}