Spoj problem Books1

Can Someone please tell me where I am getting wrong answer to see my code… I have checked 20 handmade test case and every test case is working .

my approach: first I used binary search to find mid value then I run a loop from end to minimizes work

my code : 208mbi - Online C++ Compiler & Debugging Tool - Ideone.com