[Help Needed] Police and Thieves problem

Can anybody help why I am getting WA for specific test cases for the following problem https://www.codechef.com/problems/POLICE?

My solution: https://www.codechef.com/viewsolution/34640296

Thanks.

@vijju123 Can you help what I am doing wrong?