Getting wa in 2 test cases in HMAPPY problem

I am getting wa in HMAPPY problem although I am using binary search
https://www.codechef.com/OCT18B/problems/HMAPPY/

//