lowerCAmelCase      :				List[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     A__	(       __A ,			__A ,			__A ,			__A						):







    '''simple docstring'''
    return 0 <= row < rows and 0 <= col < cols







def     A__	(       __A ,			__A ,			__A ,			__A						):







    '''simple docstring'''
    _lowerCamelCase  :		Union[str, Any]			    =    len(__A						)
    _lowerCamelCase  :		int			    =    len(mat[0]						)
    if is_safe(__A ,			__A ,			__A ,			__A						) and (row, col) not in seen and mat[row][col] == 1:
        seen.add((row, col)						)
        return (
            1
            + depth_first_search(row + 1 ,			__A ,			__A ,			__A						)
            + depth_first_search(row - 1 ,			__A ,			__A ,			__A						)
            + depth_first_search(__A ,			col + 1 ,			__A ,			__A						)
            + depth_first_search(__A ,			col - 1 ,			__A ,			__A						)
        )
    else:
        return 0







def     A__	(       __A						):







    '''simple docstring'''
    _lowerCamelCase  :		set			    =    set()

    _lowerCamelCase  :		Union[str, Any]			    =    0
    for row, line in enumerate(__A						):
        for col, item in enumerate(__A						):
            if item == 1 and (row, col) not in seen:
                # Maximizing the area
                _lowerCamelCase  :		int			    =    max(__A ,			depth_first_search(__A ,			__A ,			__A ,			__A						)						)
    return max_area


if __name__ == "__main__":
    import doctest

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





from __future__ import annotations







def     A__	(       __A ,			__A						):







    '''simple docstring'''
    _lowerCamelCase  :		List[str]			    =    [None] * (len(__A						) + len(__A						))

    _lowerCamelCase  :		Optional[int]			    =    0  # pointer to current index for left Half
    _lowerCamelCase  :		List[str]			    =    0  # pointer to current index for the right Half
    _lowerCamelCase  :		List[str]			    =    0  # pointer to current index for the sorted array Half

    while pointera < len(__A						) and pointera < len(__A						):
        if left_half[pointera] < right_half[pointera]:
            _lowerCamelCase  :		Optional[Any]			    =    left_half[pointera]
            pointera += 1
            index += 1
        else:
            _lowerCamelCase  :		List[Any]			    =    right_half[pointera]
            pointera += 1
            index += 1
    while pointera < len(__A						):
        _lowerCamelCase  :		int			    =    left_half[pointera]
        pointera += 1
        index += 1

    while pointera < len(__A						):
        _lowerCamelCase  :		Optional[Any]			    =    right_half[pointera]
        pointera += 1
        index += 1

    return sorted_array







def     A__	(       __A						):







    '''simple docstring'''
    if len(__A						) <= 1:
        return array
    # the actual formula to calculate the middle element = left + (right - left) // 2
    # this avoids integer overflow in case of large N
    _lowerCamelCase  :		int			    =    0 + (len(__A						) - 0) // 2

    # Split the array into halves till the array length becomes equal to One
    # merge the arrays of single length returned by mergeSort function and
    # pass them into the merge arrays function which merges the array
    _lowerCamelCase  :		List[str]			    =    array[:middle]
    _lowerCamelCase  :		Optional[int]			    =    array[middle:]

    return merge(merge_sort(__A						) ,			merge_sort(__A						)						)


if __name__ == "__main__":
    import doctest

    doctest.testmod()




