Expand the pond

My code is showing wrong answer in 3 testcases. Please help where am i making mistake?

@Ankit003

Increase the size of the โ€œcntโ€ array to 100K