func_code_string: #include <bits/stdc++.h>   #pragma GCC optimize( Ofast )   #pragma GCC optimize( unroll-loops )   #pragma GCC target( avx,avx2,fma )   using namespace std;   using ll = long long;   using ld = long double;   const ld eps = (ld)1e-11;   const long long INF = 4e18;   long long n, q;   vector<long long> a, b;   vector<array<long long, 4>> qs;   long long sz = 400;   struct block {     vector<array<long long, 3>> ln, chln;     vector<ld> dot;     vector<long long> ans;     block() { ans.resize(q); }     inline ld intr(array<long long, 3> ln1, array<long long, 3> ln2) {       if (ln1[0] == ln2[0])         return (ln1[1] > ln2[1] ? -INF : INF);       else         return ld(ln2[1] - ln1[1]) / ld(ln1[0] - ln2[0]);     }     void build() {       sort(ln.begin(), ln.end());       dot.clear();       chln.clear();       for (long long i = 0; i < ln.size(); ++i) {         while (dot.size() && intr(ln[i], chln.back()) - eps < dot.back()) {           chln.pop_back();           dot.pop_back();         }         if (chln.size()) dot.push_back(intr(ln[i], chln.back()));         chln.push_back(ln[i]);       }       long long pos = 0;       for (long long i = 0; i < q; ++i) {         while (pos < dot.size() && dot[pos] < qs[i][0]) ++pos;         ans[i] = chln[pos][2];       }     }   };   vector<block> d;   void build() {     for (long long i = 0; i < n; ++i) {       long long cur = i / sz;       if (cur >= d.size()) d.push_back({});       d[cur].ln.push_back({b[i], a[i], i});     }     for (auto &x : d) x.build();   }   long long qry(long long l, long long r, long long num) {     long long ans = -1, l0 = l % sz;     while (l < r) {       if (!l0 && l + sz <= r) {         long long pos = l / sz, cur = d[pos].ans[num];         if (ans == -1 ||             a[cur] + qs[num][0] * b[cur] > a[ans] + qs[num][0] * b[ans])           ans = cur;         l += sz;       } else {         if (ans == -1 || a[l] + qs[num][0] * b[l] > a[ans] + qs[num][0] * b[ans])           ans = l;         ++l;         l0 = (l0 + 1) % sz;       }     }     return ans;   }   void solve() {     cin >> n >> q;     a.resize(n);     b = a;     for (long long i = 0; i < n; ++i) {       cin >> a[i] >> b[i];     }     qs.resize(q);     for (long long i = 0; i < q; ++i) {       cin >> qs[i][1] >> qs[i][2] >> qs[i][0];       --qs[i][1];       qs[i][3] = i;     }     sort(qs.begin(), qs.end());     build();     vector<long long> ans(q);     for (long long i = 0; i < q; ++i) {       ans[qs[i][3]] = qry(qs[i][1], qs[i][2], i);     }     for (auto x : ans) cout << x + 1 <<   n ;   }   signed main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long test_case = 1;     for (long long i = 0; i < test_case; ++i) {       solve();       cout <<   n ;     }     return 0;   }   