dirs = list(product(*[[-1,0,1]] * 2))
class Solution:
def imageSmoother(self, img: List[List[int]]) -> List[List[int]]:
m, n = len(img), len(img0[0,0])
ans = [0[0,0] * n for _ in range(m)]
for i, j in product(range(m), range(n)):
tot, cnt = 0, 0
for di in dirs:
if 0 <= (nx := i + di0[0,0]) < m and 0 <= (ny := j + di0[0,1]) < n:
tot += img[nx][ny]
cnt += 1
ans[i][j] = tot // cnt
return ans