




UpperCamelCase__            =     [
    [0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0],
    [0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0],
    [0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0],
    [0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0],
]







def       _a (		SCREAMING_SNAKE_CASE_				:							Optional[Any] , SCREAMING_SNAKE_CASE_				:							Tuple , SCREAMING_SNAKE_CASE_				:							Dict , SCREAMING_SNAKE_CASE_				:							Union[str, Any]	):
					return 0 <= row < rows and 0 <= col < cols







def       _a (		SCREAMING_SNAKE_CASE_				:							Optional[int] , SCREAMING_SNAKE_CASE_				:							Optional[int] , SCREAMING_SNAKE_CASE_				:							int , SCREAMING_SNAKE_CASE_				:							Any	):
					__lowerCAmelCase							  =			len(lowerCamelCase__	)
					__lowerCAmelCase							  =			len(mat[0]	)
					if is_safe(lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__	) and (row, col) not in seen and mat[row][col] == 1:
										seen.add((row, col)	)
										return (
										    1
										    + depth_first_search(row + 1 , lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__	)
										    + depth_first_search(row - 1 , lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__	)
										    + depth_first_search(lowerCamelCase__ , col + 1 , lowerCamelCase__ , lowerCamelCase__	)
										    + depth_first_search(lowerCamelCase__ , col - 1 , lowerCamelCase__ , lowerCamelCase__	)
										)
					else:
										return 0







def       _a (		SCREAMING_SNAKE_CASE_				:							List[Any]	):
					__lowerCAmelCase							  =			set()

					__lowerCAmelCase							  =			0
					for row, line in enumerate(lowerCamelCase__	):
										for col, item in enumerate(lowerCamelCase__	):
															if item == 1 and (row, col) not in seen:
																				# Maximizing the area
																				__lowerCAmelCase							  =			max(lowerCamelCase__ , depth_first_search(lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__ , lowerCamelCase__	)	)
					return max_area


if __name__ == "__main__":
					import doctest

					print(find_max_area(matrix))  # Output -> 6
					doctest.testmod()












def       _a   (							lowerCamelCase__				)  ->      list[int]:
 if len(lowerCamelCase__				) > 1:
  lowerCamelCase_							:    Optional[Any]							=     len(lowerCamelCase__				) // 2  # Finds the middle of the array
  lowerCamelCase_							:    int							=     arr[
      :middle_length
  ]  # Creates an array of the elements in the first half.
  lowerCamelCase_							:    List[Any]							=     arr[
      middle_length:
  ]  # Creates an array of the elements in the second half.
  lowerCamelCase_							:    Optional[Any]							=     len(lowerCamelCase__				)
  lowerCamelCase_							:    Optional[Any]							=     len(lowerCamelCase__				)
  merge(lowerCamelCase__				)  # Starts sorting the left.
  merge(lowerCamelCase__				)  # Starts sorting the right
  lowerCamelCase_							:    Dict							=     0  # Left Counter
  lowerCamelCase_							:    str							=     0  # Right Counter
  lowerCamelCase_							:    Tuple							=     0  # Position Counter
  while (
      left_index < left_size and right_index < right_size
  ):  # Runs until the lowers size of the left and right are sorted.
   if left_array[left_index] < right_array[right_index]:
    lowerCamelCase_							:    Optional[int]							=     left_array[left_index]
    left_index += 1
   else:
    lowerCamelCase_							:    Union[str, Any]							=     right_array[right_index]
    right_index += 1
   index += 1
  while (
      left_index < left_size
  ):  # Adds the left over elements in the left half of the array
   lowerCamelCase_							:    Tuple							=     left_array[left_index]
   left_index += 1
   index += 1
  while (
      right_index < right_size
  ):  # Adds the left over elements in the right half of the array
   lowerCamelCase_							:    Optional[int]							=     right_array[right_index]
   right_index += 1
   index += 1
 return arr


if __name__ == "__main__":
       import doctest

       doctest.testmod()
