



"""simple docstring"""

def __lowercase			(							_a		,			_a		,			_a		,			_a    ):
    # Return True if there is node that has not iterated.
    snake_case_ :     str				=	[False] * len(_a    )
    snake_case_ :     Tuple				=	[]
    queue.append(_a    )
    snake_case_ :     Optional[Any]				=	True

    while queue:
        snake_case_ :     Tuple				=	queue.pop(0    )
        for ind in range(len(graph[u]    )    ):
            if visited[ind] is False and graph[u][ind] > 0:
                queue.append(_a    )
                snake_case_ :     Union[str, Any]				=	True
                snake_case_ :     List[str]				=	u

    return visited[t]




def __lowercase			(							_a		,			_a		,			_a    ):
    # This array is filled by BFS and to store path
    snake_case_ :     List[Any]				=	[-1] * (len(_a    ))
    snake_case_ :     Dict				=	0
    while bfs(_a		,			_a		,			_a		,			_a    ):
        snake_case_ :     Tuple				=	float('''Inf'''    )
        snake_case_ :     Optional[int]				=	sink

        while s != source:
            # Find the minimum value in select path
            snake_case_ :     Optional[Any]				=	min(_a		,			graph[parent[s]][s]    )
            snake_case_ :     str				=	parent[s]

        max_flow += path_flow
        snake_case_ :     Tuple				=	sink

        while v != source:
            snake_case_ :     List[Any]				=	parent[v]
            graph[u][v] -= path_flow
            graph[v][u] += path_flow
            snake_case_ :     Optional[int]				=	parent[v]
    return max_flow


lowercase__    :  Dict							    =	[
    [0, 16, 13, 0, 0, 0],
    [0, 0, 10, 12, 0, 0],
    [0, 4, 0, 0, 14, 0],
    [0, 0, 9, 0, 0, 20],
    [0, 0, 0, 7, 0, 4],
    [0, 0, 0, 0, 0, 0],
]

lowercase__    ,lowercase__    :  Any							    =	0, 5






print(ford_fulkerson(graph, source, sink))










"""simple docstring"""

from functools import lru_cache




@lru_cache
def __lowercase			(							_a    ):
    if num < 0:
        raise ValueError('''Number should not be negative.'''    )

    return 1 if num in (0, 1) else num * factorial(num - 1    )


if __name__ == "__main__":
     import doctest

     doctest.testmod()





