/**
 *    author:  wxhtzdy
 *    created: 19.11.2022 12:41:25
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);  
  int n, m;
  cin >> n >> m;
  vector<int> d(n), u(n);
  for (int i = 0; i < n; i++) {
    cin >> d[i] >> u[i];
  }
  vector<int> l(m), r(m), x(m);
  for (int i = 0; i < m; i++) {
    cin >> l[i] >> r[i] >> x[i];
    --l[i]; --r[i];
  }
  vector<int> xs;
  for (int i = 0; i < n; i++) {
    xs.push_back(d[i]);
    xs.push_back(u[i]);
  }
  for (int i = 0; i < m; i++) {
    xs.push_back(x[i]);
  }               
  sort(xs.begin(), xs.end());
  xs.erase(unique(xs.begin(), xs.end()), xs.end());
  auto Get = [&](int x) {
    return lower_bound(xs.begin(), xs.end(), x) - xs.begin();
  };
  for (int i = 0; i < n; i++) {
    d[i] = Get(d[i]);
    u[i] = Get(u[i]);
  }
  for (int i = 0; i < m; i++) {
    x[i] = Get(x[i]);
  }
  vector<vector<pair<int, int>>> qs(n);
  for (int i = 0; i < m; i++) {
    if (l[i] > 0) {
      qs[l[i] - 1].emplace_back(i, -1);
    } 
    qs[r[i]].emplace_back(i, +1);
  }
  int k = (int) xs.size();
  vector<int> sum(2 * k);
  function<void(int, int, int, int, int)> Modify = [&](int x, int l, int r, int ll, int rr) {
    if (l > rr || r < ll || l > r) {
      return;
    }
    if (ll <= l && r <= rr) {
      sum[x] += 1;
      return;
    }
    int y = (l + r) >> 1;
    int z = x + 2 * (y - l + 1);
    Modify(x + 1, l, y, ll, rr);
    Modify(z, y + 1, r, ll, rr);
  };
  function<int(int, int, int, int)> Query = [&](int x, int l, int r, int i) {
    if (l == r) {
      return sum[x];
    }
    int y = (l + r) >> 1;
    int z = x + 2 * (y - l + 1);
    if (i <= y) {
      return sum[x] + Query(x + 1, l, y, i);
    } else {
      return sum[x] + Query(z, y + 1, r, i);
    }
  }; 
  vector<int> res(m);
  for (int i = 0; i < n; i++) {
    Modify(0, 0, k - 1, d[i], u[i]);
    for (auto& p : qs[i]) {
      res[p.first] += Query(0, 0, k - 1, x[p.first]) * p.second;
    }
  }
  for (int i = 0; i < m; i++) {
    cout << res[i] << '\n';
  }
  return 0;
}