DEFKIN SPOJ Corner cases

Can you please help me with corner cases, I am getting WA.
I have checked for n=0, but I can’t figure out the case where my solution is getting WA.

hello @subhamjaiswal885

pls save ur code at cb ide and share its link with me

for n=0 , answer will depend on h and w.