Hints Required for logic formation

Could u please provide me with some hints, so that I could
understand the question and would therefore be able to solve the question.

This problem can be done using “recursion/dfs and similar” fashion. once you visit a cell, then visit all the cells that can be visited from this cell and also visit the cells that can be further visited from the next reachable cells.

please provide necessary changes to the code, the link for the code is : https://ide.codingblocks.com/s/416443

please provide necessary changes to the code, the link for the code is : https://ide.codingblocks.com/s/416443

try to debug for this input
10
1 1 1 1 1 1 1 1 1 1
0 0 1 1 1 1 1 0 0 0
0 0 0 0 1 1 0 0 0 0
0 1 1 0 0 0 0 0 0 0
0 1 1 1 1 1 1 0 0 0
0 0 0 0 1 1 0 0 0 0
0 0 0 0 0 0 1 1 1 0
0 0 0 0 0 0 0 1 1 0
0 1 1 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 1
correct output 17
your code Gives : 7