output_description: Print the area (the number of 0s) of the largest square.
input_description: H W
      c1,1 c1,2 ... c1,W
      c2,1 c2,2 ... c2,W
      :
      cH,1 cH,2 ... cH,W
      
  
  In the first line, two integers H and W separated by a space character are
  given. In the following H lines, ci,j, elements of the H × W matrix, are
  given.
attempt: h, w = map(int, input().split())
  mp = []
  for _ in range(h):
    lst = list(map(int, input().split()))
    cum = []
    acc = 0
    for i in lst:
      if i == 0:
        acc += 1
      else:
        acc = 0
      cum.append(acc)
    mp.append(cum)
  mp.append([-1] * w)
  
  ans = 0
  for x in range(w):
    score_stack = []
    ind_stack = []
    for y in range(h + 1):
  #    print(score_stack, ind_stack)
      score = mp[y][x]
      if score_stack == []:
        score_stack.append(score)
        ind_stack.append(y)
      else:
        last_score = score_stack[-1]
        if last_score < score:
          score_stack.append(score)
          ind_stack.append(y)
  
        elif last_score == score:
          continue
  
        else:
          while score_stack != [] and score_stack[-1] >= score:
            last_score = score_stack.pop()
            last_ind = ind_stack.pop()
  #          print(last_score, last_ind, ans)
            ans = max(ans, min(y - last_ind, last_score) ** 2)
          
          score_stack.append(score)
          ind_stack.append(last_ind)
  print(ans)
  
  
problem_description: Largest Square
  
  Given a matrix (H × W) which contains only 1 and 0, find the area of the
  largest square matrix which only contains 0s.
samples: [{"input": "5\n    0 0 1 0 0\n    1 0 0 0 0\n    0 0 0 1 0\n    0 0 0 1 0", "output": "4"}]