




import importlib.metadata
import subprocess
import sys




def       SCREAMING_SNAKE_CASE			( __UpperCamelCase    :		bool = False   )						->							Optional[Any]:
    UpperCAmelCase_											=  False
    if "IPython" in sys.modules:
        UpperCAmelCase_											=  '''google.colab''' in str(sys.modules['''IPython'''].get_ipython()   )

    if in_colab:
        if upgrade:
            UpperCAmelCase_											=  ['''pip''', '''install''', '''-U''', '''torch''']
            subprocess.run(__UpperCamelCase ,  check=__UpperCamelCase   )
        # get the current version of torch
        UpperCAmelCase_											=  importlib.metadata.version('''torch'''   )
        UpperCAmelCase_											=  torch_version[: torch_version.rindex('''.'''   )]
        UpperCAmelCase_											=  f'https://storage.googleapis.com/tpu-pytorch/wheels/colab/torch_xla-{torch_version_trunc}-cp37-cp37m-linux_x86_64.whl'
        UpperCAmelCase_											=  ['''pip''', '''install''', xla_wheel]
        subprocess.run(__UpperCamelCase ,  check=__UpperCamelCase   )
    else:
        raise RuntimeError('''`install_xla` utility works only on google colab.'''   )











_lowerCamelCase    				=		[
    [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       SCREAMING_SNAKE_CASE			( __UpperCamelCase    :		int ,  __UpperCamelCase    :		int ,  __UpperCamelCase    :		int ,  __UpperCamelCase    :		int   )						->							bool:
    return 0 <= row < rows and 0 <= col < cols




def       SCREAMING_SNAKE_CASE			( __UpperCamelCase    :		int ,  __UpperCamelCase    :		int ,  __UpperCamelCase    :		set ,  __UpperCamelCase    :		list[list[int]]   )						->							int:
    UpperCAmelCase_											=  len(__UpperCamelCase   )
    UpperCAmelCase_											=  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       SCREAMING_SNAKE_CASE			( __UpperCamelCase    :		list[list[int]]   )						->							int:
    UpperCAmelCase_											=  set()

    UpperCAmelCase_											=  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
                UpperCAmelCase_											=  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()





