Help needed in CHFNSWPS

Problem:https://www.codechef.com/JULY20B/problems/CHFNSWPS/
My solution:
https://www.codechef.com/viewsolution/35217531
Can anybody explain why my solution is wrong or provide any testcase for which it is giving wrong answer ?