n, m = map(int, input().split()) arr = [] mat = [] dp = [[1 for _ in range(m)] for x in range(n)] for _ in range(n): arr = list(map(int, input().split())) mat.append(arr) moves = [[0, 1], [0, -1], [1, 0], [-1, 0]] def dfs(x, y, dp): for move in moves: ix, iy = x + move[0], y + move[1] if ix < 0 o...