Please help me with my code for Cleaning Drive(Div 3)

solution link : CodeChef: Practical coding for everyone
I tried multiple test cases and it looks correct to me but gives WA for some subtasks on OJ.
Please help me to find what cases I left to look into.