#include using namespace std; const int MOD = 1e9+7; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); // Initial guess long long A = 2; // initial A guess long long B = 1000; // initial B guess // Output the initial A and B cout << A << " " << B << "\n" << flush; // Read the response K long long K; cin >> K; // Read the current guessed X' long long X_prime; cin >> X_prime; // Read the result code int ret; cin >> ret; // For demonstration: // A simple loop to adjust guesses based on previous K. // In a real scenario, you might implement a more intelligent method. for (int attempt = 0; attempt < 20; attempt++) { // Based on previous K, attempt to narrow down X. // For simplicity, keep A fixed and iterate B. B += 1000; // increase B for new attempt; in practice, choose adaptively cout << A << " " << B << "\n" << flush; cin >> K; cin >> X_prime; cin >> ret; if (ret == 1) { // Guess is correct, can terminate break; } // Otherwise, continue guessing... // Implement further logic here to refine guesses based on K // For example, if K divides some candidate values, narrow down. } // After guesses, output your final guess for X' // (or, in a real scenario, attempt to derive X from collected info) // Here, just output the last X' obtained cout << X_prime << "\n" << flush; }