func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 1 << 20;   const int inf = 2e9;   int n, q;   int h[maxn], v[maxn];   pair<pair<int, int>, int> b[maxn];   vector<int> hull[maxn];   long double inter(int id1, int id2) {     if (v[id1] == v[id2]) return -1;     return (long double)(h[id1] - h[id2]) / (v[id2] - v[id1]);   }   long double H(int idx, long double t) { return h[idx] + t * v[idx]; }   void update(int node, int x) {     while (hull[node].size() > 1) {       int sz = hull[node].size();       int id1 = hull[node][sz - 1];       int id2 = hull[node][sz - 2];       long double t = inter(id1, id2);       if (v[id1] == v[x] or H(x, t) >= H(id1, t))         hull[node].pop_back();       else         break;     }     if (hull[node].size() == 1 and h[*hull[node].begin()] < h[x])       hull[node].pop_back();     hull[node].push_back(x);   }   void add(int node, int l, int r, int idx) {     if (idx < l or r <= idx) return;     update(node, idx);     if (r - l < 2) return;     int mid = (l + r) / 2;     add((node + node + 0), l, mid, idx);     add((node + node + 1), mid, r, idx);   }   pair<long double, int> find(int node, int t) {     int l = 0, r = hull[node].size();     for (; r - l > 1;) {       int mid = (l + r) / 2;       if (inter(hull[node][mid], hull[node][mid - 1]) <= t)         l = mid;       else         r = mid;     }     return make_pair(H(hull[node][l], t), hull[node][l]);   }   pair<long double, int> ans(int node, int l, int r, int s, int e, int t) {     if (e <= l or r <= s) return make_pair(-inf, n);     if (s <= l and r <= e) return find(node, t);     int mid = (l + r) / 2;     return max(ans((node + node + 0), l, mid, s, e, t),                ans((node + node + 1), mid, r, s, e, t));   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cin >> n >> q;     for (int i = 0; i < n; i++) {       cin >> h[i] >> v[i];       b[i].first.second = h[i];       b[i].first.first = v[i];       b[i].second = i;     }     h[n] = -1;     v[n] = 0;     sort(b, b + n);     for (int i = 0; i < n; i++) add(1, 0, n, b[i].second);     for (int l, r, t; q--;) {       cin >> l >> r >> t;       l--, r--;       cout << ans(1, 0, n, l, r + 1, t).second + 1 << endl;     }     return 0;   }   