Piyush and Magical Park

Can someone check my conditions in this problem, I’m a bit confused about it
https://ide.codingblocks.com/s/143224

@prashantverma.vn Your code is giving incorrect output even for sample test case.
https://ide.codingblocks.com/s/70457 Refer this explanation to see how to reach the desired output.

Can you check my code…it’s not compiling
https://ide.codingblocks.com/s/144197

There were some minor mistakes in Line 4 and 5. Check it now.

It’s giving incorrect answer…

@prashantverma.vn You are not properly imposing the conditions. Check this code:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

Can you explain me the marked portion in the code ??