#include using namespace std; using ll = long long; #ifdef LOCAL #include #else #define debug(...) #endif int main() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); auto check = [&](int x) -> bool { cout << x << endl; int r; cin >> r; if (r == -1) exit(0); return r == 1; }; constexpr int M = 30; int ok = 0, ng = 1e9 + 1; for (int iter = 0; iter < M - 1; iter++) { int mid = midpoint(ok, ng); (check(mid) ? ok : ng) = mid; } check(ok); }