





"""simple docstring"""



def 						__lowercase	(  snake_case_    :    int							,snake_case_    :    int							,snake_case_    :    list[list[int]]		)  ->int:



    '''simple docstring'''







    def update_area_of_max_square(snake_case_    :    int							,snake_case_    :    int		) -> int:
        # BASE CASE
        if row >= rows or col >= cols:
            return 0

        __A       :		str							=	update_area_of_max_square(snake_case_							,col + 1		)
        __A       :		Dict							=	update_area_of_max_square(row + 1							,col + 1		)
        __A       :		Optional[int]							=	update_area_of_max_square(row + 1							,snake_case_		)

        if mat[row][col]:
            __A       :		List[str]							=	1 + min([right, diagonal, down]		)
            __A       :		List[Any]							=	max(largest_square_area[0]							,snake_case_		)
            return sub_problem_sol
        else:
            return 0

    __A       :		int							=	[0]
    update_area_of_max_square(0							,0		)
    return largest_square_area[0]







def 						__lowercase	(  snake_case_    :    int							,snake_case_    :    int							,snake_case_    :    list[list[int]]		)  ->int:



    '''simple docstring'''







    def update_area_of_max_square_using_dp_array(
        snake_case_    :    int							,snake_case_    :    int							,snake_case_    :    list[list[int]]		) -> int:
        if row >= rows or col >= cols:
            return 0
        if dp_array[row][col] != -1:
            return dp_array[row][col]

        __A       :		int							=	update_area_of_max_square_using_dp_array(snake_case_							,col + 1							,snake_case_		)
        __A       :		Dict							=	update_area_of_max_square_using_dp_array(row + 1							,col + 1							,snake_case_		)
        __A       :		int							=	update_area_of_max_square_using_dp_array(row + 1							,snake_case_							,snake_case_		)

        if mat[row][col]:
            __A       :		List[Any]							=	1 + min([right, diagonal, down]		)
            __A       :		Tuple							=	max(largest_square_area[0]							,snake_case_		)
            __A       :		int							=	sub_problem_sol
            return sub_problem_sol
        else:
            return 0

    __A       :		Union[str, Any]							=	[0]
    __A       :		List[str]							=	[[-1] * cols for _ in range(snake_case_		)]
    update_area_of_max_square_using_dp_array(0							,0							,snake_case_		)

    return largest_square_area[0]







def 						__lowercase	(  snake_case_    :    int							,snake_case_    :    int							,snake_case_    :    list[list[int]]		)  ->int:



    '''simple docstring'''







    __A       :		List[Any]							=	[[0] * (cols + 1) for _ in range(rows + 1		)]
    __A       :		Any							=	0
    for row in range(rows - 1							,-1							,-1		):
        for col in range(cols - 1							,-1							,-1		):
            __A       :		Optional[Any]							=	dp_array[row][col + 1]
            __A       :		Optional[Any]							=	dp_array[row + 1][col + 1]
            __A       :		List[Any]							=	dp_array[row + 1][col]

            if mat[row][col] == 1:
                __A       :		Tuple							=	1 + min(snake_case_							,snake_case_							,snake_case_		)
                __A       :		int							=	max(dp_array[row][col]							,snake_case_		)
            else:
                __A       :		Union[str, Any]							=	0

    return largest_square_area







def 						__lowercase	(  snake_case_    :    int							,snake_case_    :    int							,snake_case_    :    list[list[int]]		)  ->int:



    '''simple docstring'''







    __A       :		str							=	[0] * (cols + 1)
    __A       :		Optional[int]							=	[0] * (cols + 1)
    __A       :		Union[str, Any]							=	0
    for row in range(rows - 1							,-1							,-1		):
        for col in range(cols - 1							,-1							,-1		):
            __A       :		int							=	current_row[col + 1]
            __A       :		List[str]							=	next_row[col + 1]
            __A       :		Optional[int]							=	next_row[col]

            if mat[row][col] == 1:
                __A       :		Tuple							=	1 + min(snake_case_							,snake_case_							,snake_case_		)
                __A       :		str							=	max(current_row[col]							,snake_case_		)
            else:
                __A       :		Optional[Any]							=	0
        __A       :		List[Any]							=	current_row

    return largest_square_area


if __name__ == "__main__":
       import doctest

       doctest.testmod()
       print(largest_square_area_in_matrix_bottom_up(2, 2, [[1, 1], [1, 1]]))











"""simple docstring"""



def 						__lowercase	(  snake_case_    :    int							,snake_case_    :    int		)  ->int:



    '''simple docstring'''







    return int((input_a, input_a).count(0		) == 0		)







def 						__lowercase	(  )  ->None:



    '''simple docstring'''







    assert and_gate(0							,0		) == 0
    assert and_gate(0							,1		) == 0
    assert and_gate(1							,0		) == 0
    assert and_gate(1							,1		) == 1


if __name__ == "__main__":
       test_and_gate()
       print(and_gate(1, 0))
       print(and_gate(0, 0))
       print(and_gate(0, 1))
       print(and_gate(1, 1))




