func_code_string: #include <bits/stdc++.h>   using namespace std;   int A, B, q;   long long l, t, m;   bool check(long long len) {     long long ind_left = l;     long long ind_righ = ind_left + len - 1;     long long num_left = A + (ind_left - 1) * B;     long long num_righ = A + (ind_righ - 1) * B;     long long need_time;     if (len > m)       need_time = ((num_left + num_righ) * len / 2 + m - 1) / m;     else       need_time = num_righ;     return need_time <= t && num_righ <= t;   }   void work() {     scanf( %d %d %d , &A, &B, &q);     while (q--) {       scanf( %lld %lld %lld , &l, &t, &m);       long long lpt = 0, rpt = 1e6;       while (lpt < rpt) {         long long mid = (lpt + rpt + 1) >> 1;         if (check(mid)) {           lpt = mid;         } else {           rpt = mid - 1;         }       }       if (lpt == 0) {         puts( -1 );       } else {         printf( %lld n , l + rpt - 1);       }     }   }   int main() {     work();     return 0;   }   