input: Write a python function to find the maximum rectangle area of 1s in a given binary matrix.
  assert max_rect_area([[1, 1, 0, 0], [1, 1, 1, 1], [1, 1, 1, 1], [0, 1, 1, 0]]) == 8
  assert max_rect_area([[0, 1, 1], [1, 1, 1], [1, 1, 0]]) == 6
  assert max_rect_area([[0, 0, 0], [0, 0, 0], [0, 0, 0]]) == 0
output: def max_rect_area(matrix):
      if not matrix:
          return 0
  
      n = len(matrix)
      m = len(matrix[0])
      heights = [0] * (m + 1)
      max_area = 0
  
      for row in matrix:
          for i in range(m):
              if row[i] == 1:
                  heights[i] += 1
              else:
                  heights[i] = 0
          
          stack = [-1]
          for i in range(m + 1):
              while heights[i] < heights[stack[-1]]:
                  h = heights[stack.pop()]
                  w = i - stack[-1] - 1
                  max_area = max(max_area, h * w)
              stack.append(i)
  
      return max_area