# Here your code ! l = 1 h = 10 ** 9 100.times do |i| o = (l + h).div(2) puts "? #{o}" $stdout.flush if gets.to_i == 0 h = o - 1 else l = o end if l == h break end end puts "! #{Random.rand(l..h)}" $stdout.flush