#include #include #include using namespace std; using ll = long long; #include map,ll> memo; ll ask(ll x,ll y){ if(memo.find({x,y})!=memo.end()) return memo[{x,y}]; cout<>d; if(d==0){ exit(0); } return memo[{x,y}] = d; } int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); ll left = 0; ll right = 100000; while(right-left>2){ ll m1 = (left+left+right) / 3; ll m2 = (right+right+left) / 3; ll d1 = ask(m1,0); ll d2 = ask(m2,0); if(d1<=d2) right = m2; else left = m1; } ll use; ll mn = 1e9; for(ll x = left;x<=right;x++){ ll d = ask(x,0); if(d2){ ll m1 = (left+left+right) / 3; ll m2 = (right+right+left) / 3; ll d1 = ask(x,m1); ll d2 = ask(x,m2); if(d1<=d2) right = m2; else left = m1; } for(ll x = left;x<=right;x++){ ll d = ask(x,0); } }