

'''simple docstring'''





def 				_lowerCAmelCase			(   __magic_name__						:     int						)				->  None:
						lowercase :							int    		=generate_pascal_triangle(__magic_name__						)
						for row_idx in range(__magic_name__						):
												# Print left spaces
												for _ in range(num_rows - row_idx - 1						):
																		print(end=''' '''						)
												# Print row values
												for col_idx in range(row_idx + 1						):
																		if col_idx != row_idx:
																								print(triangle[row_idx][col_idx]   , end=''' '''						)
																		else:
																								print(triangle[row_idx][col_idx]   , end=''''''						)
												print()






def 				_lowerCAmelCase			(   __magic_name__						:     int						)				->  list[list[int]]:

						if not isinstance(__magic_name__   , __magic_name__						):
												raise TypeError('''The input value of \'num_rows\' should be \'int\''''						)

						if num_rows == 0:
												return []
						elif num_rows < 0:
												raise ValueError(
												    '''The input value of \'num_rows\' should be greater than or equal to 0'''						)

						lowercase :							list[list[int]]    		=[]
						for current_row_idx in range(__magic_name__						):
												lowercase :							List[str]    		=populate_current_row(__magic_name__   , __magic_name__						)
												triangle.append(__magic_name__						)
						return triangle






def 				_lowerCAmelCase			(   __magic_name__						:     list[list[int]]   , __magic_name__						:     int						)				->  list[int]:
						lowercase :							int    		=[-1] * (current_row_idx + 1)
						# first and last elements of current row are equal to 1
						lowercase		,	lowercase :							Any    		=1, 1
						for current_col_idx in range(1   , __magic_name__						):
												calculate_current_element(
												    __magic_name__   , __magic_name__   , __magic_name__   , __magic_name__						)
						return current_row






def 				_lowerCAmelCase			(   __magic_name__						:     list[list[int]]   , __magic_name__						:     list[int]   , __magic_name__						:     int   , __magic_name__						:     int   , )				->  None:
						lowercase :							Any    		=triangle[current_row_idx - 1][current_col_idx - 1]
						lowercase :							Union[str, Any]    		=triangle[current_row_idx - 1][current_col_idx]
						lowercase :							int    		=above_to_left_elt + above_to_right_elt






def 				_lowerCAmelCase			(   __magic_name__						:     int						)				->  list[list[int]]:

						if not isinstance(__magic_name__   , __magic_name__						):
												raise TypeError('''The input value of \'num_rows\' should be \'int\''''						)

						if num_rows == 0:
												return []
						elif num_rows < 0:
												raise ValueError(
												    '''The input value of \'num_rows\' should be greater than or equal to 0'''						)

						lowercase :							list[list[int]]    		=[[1]]

						for row_index in range(1   , __magic_name__						):
												lowercase :							List[str]    		=[0] + result[-1] + [0]
												lowercase :							Tuple    		=row_index + 1
												# Calculate the number of distinct elements in a row
												lowercase :							List[Any]    		=sum(divmod(__magic_name__   , 2						)						)
												lowercase :							int    		=[
												    temp_row[i - 1] + temp_row[i] for i in range(1   , distinct_elements + 1						)
												]
												lowercase :							Union[str, Any]    		=row_first_half[: (row_index + 1) // 2]
												row_second_half.reverse()
												lowercase :							str    		=row_first_half + row_second_half
												result.append(__magic_name__						)

						return result






def 				_lowerCAmelCase			(   )				->  None:
						from collections.abc import Callable
						from timeit import timeit

						def benchmark_a_function(__magic_name__						:     Callable   , __magic_name__						:     int						) -> None:
												lowercase :							str    		=f'''{func.__name__}({value})'''
												lowercase :							Optional[Any]    		=timeit(f'''__main__.{call}'''   , setup='''import __main__'''						)
												# print(f"{call:38} = {func(value)} -- {timing:.4f} seconds")
												print(f'''{call:38} -- {timing:.4f} seconds'''						)

						for value in range(15						):  # (1, 7, 14):
												for func in (generate_pascal_triangle, generate_pascal_triangle_optimized):
																		benchmark_a_function(__magic_name__   , __magic_name__						)
												print()


if __name__ == "__main__":
							import doctest

							doctest.testmod()
							benchmark()









def     lowercase	(    a     , a     , a     , a ):



		'''simple docstring'''




		SCREAMING_SNAKE_CASE_				:int				     =						[False] * len(a )
		SCREAMING_SNAKE_CASE_				:List[Any]				     =						[]
		queue.append(a )
		SCREAMING_SNAKE_CASE_				:int				     =						True

		while queue:
				SCREAMING_SNAKE_CASE_				:int				     =						queue.pop(0 )
				for ind in range(len(graph[u] ) ):
						if visited[ind] is False and graph[u][ind] > 0:
								queue.append(a )
								SCREAMING_SNAKE_CASE_				:Tuple				     =						True
								SCREAMING_SNAKE_CASE_				:Optional[int]				     =						u

		return visited[t]


def     lowercase	(    a     , a     , a ):



		'''simple docstring'''




		SCREAMING_SNAKE_CASE_				:Any				     =						[-1] * (len(a ))
		SCREAMING_SNAKE_CASE_				:Tuple				     =						0
		while bfs(a     , a     , a     , a ):
				SCREAMING_SNAKE_CASE_				:List[Any]				     =						float("Inf" )
				SCREAMING_SNAKE_CASE_				:str				     =						sink

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

				max_flow += path_flow
				SCREAMING_SNAKE_CASE_				:Dict				     =						sink

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


SCREAMING_SNAKE_CASE__     					=			[
    [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],
]

SCREAMING_SNAKE_CASE__					,    SCREAMING_SNAKE_CASE__     					=			0, 5
print(ford_fulkerson(graph, source, sink))






