[Help Needed] Police and Thieves problem

Can anybody help why I am getting WA for specific test cases for the following problem POLICE Problem - CodeChef?

My solution: CodeChef: Practical coding for everyone

Thanks.

@vijju123 Can you help what I am doing wrong?