



A__						:						Any          =      [
    [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     UpperCamelCase(						__UpperCamelCase							:	int  ,__UpperCamelCase							:	int  ,__UpperCamelCase							:	int  ,__UpperCamelCase							:	int				):
  return 0 <= row < rows and 0 <= col < cols


def     UpperCamelCase(						__UpperCamelCase							:	int  ,__UpperCamelCase							:	int  ,__UpperCamelCase							:	set  ,__UpperCamelCase							:	list[list[int]]				):
  lowerCAmelCase_    :  str             =				len(__UpperCamelCase				)
  lowerCAmelCase_    :  List[str]             =				len(mat[0]				)
  if is_safe(__UpperCamelCase  ,__UpperCamelCase  ,__UpperCamelCase  ,__UpperCamelCase				) and (row, col) not in seen and mat[row][col] == 1:
    seen.add((row, col)				)
    return (
        1
        + depth_first_search(row + 1  ,__UpperCamelCase  ,__UpperCamelCase  ,__UpperCamelCase				)
        + depth_first_search(row - 1  ,__UpperCamelCase  ,__UpperCamelCase  ,__UpperCamelCase				)
        + depth_first_search(__UpperCamelCase  ,col + 1  ,__UpperCamelCase  ,__UpperCamelCase				)
        + depth_first_search(__UpperCamelCase  ,col - 1  ,__UpperCamelCase  ,__UpperCamelCase				)
    )
  else:
    return 0


def     UpperCamelCase(						__UpperCamelCase							:	list[list[int]]				):
  lowerCAmelCase_    :  set             =				set()

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


if __name__ == "__main__":
      import doctest

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










from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_tf_available,
    is_torch_available,
    is_vision_available,
)


A__						:						List[str]          =      {
    '''configuration_segformer''': ['''SEGFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''SegformerConfig''', '''SegformerOnnxConfig''']
}

try:
						if not is_vision_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						A__						:						int          =      ['''SegformerFeatureExtractor''']
						A__						:						Dict          =      ['''SegformerImageProcessor''']

try:
						if not is_torch_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						A__						:						Any          =      [
						    '''SEGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST''',
						    '''SegformerDecodeHead''',
						    '''SegformerForImageClassification''',
						    '''SegformerForSemanticSegmentation''',
						    '''SegformerLayer''',
						    '''SegformerModel''',
						    '''SegformerPreTrainedModel''',
						]

try:
						if not is_tf_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						A__						:						List[Any]          =      [
						    '''TF_SEGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST''',
						    '''TFSegformerDecodeHead''',
						    '''TFSegformerForImageClassification''',
						    '''TFSegformerForSemanticSegmentation''',
						    '''TFSegformerModel''',
						    '''TFSegformerPreTrainedModel''',
						]


if TYPE_CHECKING:
						from .configuration_segformer import SEGFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, SegformerConfig, SegformerOnnxConfig

						try:
												if not is_vision_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .feature_extraction_segformer import SegformerFeatureExtractor
												from .image_processing_segformer import SegformerImageProcessor

						try:
												if not is_torch_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_segformer import (
												    SEGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
												    SegformerDecodeHead,
												    SegformerForImageClassification,
												    SegformerForSemanticSegmentation,
												    SegformerLayer,
												    SegformerModel,
												    SegformerPreTrainedModel,
												)
						try:
												if not is_tf_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_tf_segformer import (
												    TF_SEGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
												    TFSegformerDecodeHead,
												    TFSegformerForImageClassification,
												    TFSegformerForSemanticSegmentation,
												    TFSegformerModel,
												    TFSegformerPreTrainedModel,
												)

else:
						import sys

						A__						:						Dict          =      _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)





