Expand the pond

Here’s my code
I am getting 3/6 test cases right. Can anyone please point out the mistake due to which I am not getting right the other 3 cases.