func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     long long A, B;     int N;     long long l, r, t, tt, M;     cin >> A >> B >> N;     for (int i = 0; i < N; i++) {       scanf( %I64d%I64d%I64d , &l, &t, &M);       long long st = l, ed = l + 1000000;       long long H = A + (l - 1) * B;       long long D = B, C = t / B;       if (t < H) {         puts( -1 );         continue;       }       while (ed - st > 1) {         long long md = (st + ed) >> 1;         long long E = A + (md - 1) * B;         long long L = md - l + 1;         long long tot = (H + E) * L / 2;         long long tt = max(E, (tot - 1 + M) / M);         if (t >= tt)           st = md;         else           ed = md;       }       long long E = A + (ed - 1) * B;       long long L = ed - l + 1;       long long tot = (H + E) * L / 2;       long long tt = max(E, (tot - 1 + M) / M);       if (t >= tt) st++;       cout << st << endl;     }   }   