Piyush and Magical Park https://ide.codingblocks.com/s/162975

I’m getting the wrong answer for 3 test cases, I cant determine whats wrong.