#include #include #include using namespace std; using ll = long long; #include #include int c; map,ll> memo; ll ask(ll x,ll y){ if(memo.find({x,y})!=memo.end()) return memo[{x,y}]; c++; if(c>100){ assert(false); } 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; int cnt = 0; ll n1,n2; while(right-left>2){ ll m1 = (21*left+13*right) / 34; ll m2 = (21*right+13*left) / 34; if(cnt==1) m1 = n1; if(cnt==2) m2 = n2; n1 = m1; n2 = m2; ll d1 = ask(m1,0); ll d2 = ask(m2,0); if(d1<=d2) { right = m2; cnt = 1; }else{ left = m1; cnt = 2; } } ll use; ll mn = 1e9; for(ll x = left;x<=right;x++){ ll d = ask(x,0); if(d2){ ll m1 = (21*left+13*right) / 34; ll m2 = (21*right+13*left) / 34; if(cnt==1) m1 = n1; if(cnt==2) m2 = n2; n1 = m1; n2 = m2; ll d1 = ask(x,m1); ll d2 = ask(x,m2); if(d1<=d2) { right = m2; cnt = 1; }else{ left = m1; cnt = 2; } } for(ll x = left;x<=right;x++){ ll d = ask(x,0); } }