func_code_string: #include <bits/stdc++.h>   using namespace std;   const double eps = 1e-9;   const double pi = acos(-1.0);   const int inf = 0x3f3f3f3f;   const int N = 100010;   int n, q;   int a[N], b[N], c[N];   struct node {     int low, high;     vector<pair<int, int> > v;   } tree[N << 2];   void build(int p, int low, int high, int c[]) {     tree[p].low = low;     tree[p].high = high;     tree[p].v.clear();     for (int k = low; k <= high; ++k) {       int i = c[k];       vector<pair<int, int> >& v = tree[p].v;       while (!v.empty()) {         int j = v.back().second;         if (b[j] >= b[i]) break;         int t = (a[j] - a[i]) / (b[i] - b[j]) + 1;         if (v.back().first >= t)           v.pop_back();         else {           v.push_back(make_pair(t, i));           break;         }       }       if (v.empty()) v.push_back(make_pair(0, i));     }     if (low == high) return;     int mid = (low + high) >> 1;     stable_partition(c + low, c + high + 1, bind2nd(less<int>(), mid + 1));     build(p * 2 + 1, low, mid, c);     build(p * 2 + 2, mid + 1, high, c);   }   pair<long long, int> query(int p, int low, int high, int t) {     node& cur = tree[p];     if (low <= cur.low && cur.high <= high) {       int id = lower_bound(cur.v.begin(), cur.v.end(), make_pair(t, inf)) -                cur.v.begin();       id = cur.v[id - 1].second;       return make_pair(a[id] + (long long)t * b[id], id);     }     pair<long long, int> ans = make_pair(0, 0);     int mid = (cur.low + cur.high) >> 1;     if (low <= mid) ans = max(ans, query(p * 2 + 1, low, high, t));     if (mid < high) ans = max(ans, query(p * 2 + 2, low, high, t));     return ans;   }   bool cmp(int i, int j) {     if (a[i] != a[j]) return a[i] > a[j];     return b[i] < b[j];   }   void solve() {     for (int i = 0; i < (int)(n); ++i) scanf( %d%d , a + i, b + i);     for (int i = 0; i < (int)(n); ++i) c[i] = i;     sort(c, c + n, cmp);     build(0, 0, n - 1, c);     int l, r, t;     for (int i = 0; i < (int)(q); ++i) {       scanf( %d%d%d , &l, &r, &t);       printf( %d n , query(0, l - 1, r - 1, t).second + 1);     }   }   int main() {     while (scanf( %d%d , &n, &q) != EOF) {       solve();     }     return 0;   }   