


"""simple docstring"""




def     lowercase			(SCREAMING_SNAKE_CASE_		:				Any ,			SCREAMING_SNAKE_CASE_		:				Optional[int] ,			SCREAMING_SNAKE_CASE_		:				List[str] ,			SCREAMING_SNAKE_CASE_		:				List[Any]  )   ->						Dict:
						# Return True if there is node that has not iterated.
						SCREAMING_SNAKE_CASE													=					[False] * len(SCREAMING_SNAKE_CASE_  )
						SCREAMING_SNAKE_CASE													=					[]
						queue.append(SCREAMING_SNAKE_CASE_  )
						SCREAMING_SNAKE_CASE													=					True

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

						return visited[t]


def     lowercase			(SCREAMING_SNAKE_CASE_		:				List[str] ,			SCREAMING_SNAKE_CASE_		:				str ,			SCREAMING_SNAKE_CASE_		:				str  )   ->						List[str]:
						# This array is filled by BFS and to store path
						SCREAMING_SNAKE_CASE													=					[-1] * (len(SCREAMING_SNAKE_CASE_  ))
						SCREAMING_SNAKE_CASE													=					0
						while bfs(SCREAMING_SNAKE_CASE_ ,			SCREAMING_SNAKE_CASE_ ,			SCREAMING_SNAKE_CASE_ ,			SCREAMING_SNAKE_CASE_  ):
												SCREAMING_SNAKE_CASE													=					float('Inf'  )
												SCREAMING_SNAKE_CASE													=					sink

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

												max_flow += path_flow
												SCREAMING_SNAKE_CASE													=					sink

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


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

__UpperCamelCase,__UpperCamelCase						=      0, 5


print(ford_fulkerson(graph, source, sink))






"""simple docstring"""




from math import isclose, sqrt


def     lowercase			(SCREAMING_SNAKE_CASE_		:				float ,			SCREAMING_SNAKE_CASE_		:				float ,			SCREAMING_SNAKE_CASE_		:				float  )   ->						tuple[float, float, float]:
						SCREAMING_SNAKE_CASE													=					point_y / 4 / point_x
						SCREAMING_SNAKE_CASE													=					2 * normal_gradient / (1 + normal_gradient * normal_gradient)
						SCREAMING_SNAKE_CASE													=					(1 - normal_gradient * normal_gradient) / (
						    1 + normal_gradient * normal_gradient
						)
						SCREAMING_SNAKE_CASE													=					(sa - ca * incoming_gradient) / (ca + sa * incoming_gradient)

						# to find the next point, solve the simultaeneous equations:
						# y^2 + 4x^2 = 100
						# y - b = m * (x - a)
						# ==> A x^2 + B x + C = 0
						SCREAMING_SNAKE_CASE													=					outgoing_gradient**2 + 4
						SCREAMING_SNAKE_CASE													=					2 * outgoing_gradient * (point_y - outgoing_gradient * point_x)
						SCREAMING_SNAKE_CASE													=					(point_y - outgoing_gradient * point_x) ** 2 - 1_00

						SCREAMING_SNAKE_CASE													=					(
						    -linear_term - sqrt(linear_term**2 - 4 * quadratic_term * constant_term  )
						) / (2 * quadratic_term)
						SCREAMING_SNAKE_CASE													=					(
						    -linear_term + sqrt(linear_term**2 - 4 * quadratic_term * constant_term  )
						) / (2 * quadratic_term)

						# two solutions, one of which is our input point
						SCREAMING_SNAKE_CASE													=					x_minus if isclose(SCREAMING_SNAKE_CASE_ ,			SCREAMING_SNAKE_CASE_  ) else x_plus
						SCREAMING_SNAKE_CASE													=					point_y + outgoing_gradient * (next_x - point_x)

						return next_x, next_y, outgoing_gradient


def     lowercase			(SCREAMING_SNAKE_CASE_		:				float = 1.4 ,			SCREAMING_SNAKE_CASE_		:				float = -9.6  )   ->						int:
						SCREAMING_SNAKE_CASE													=					0
						SCREAMING_SNAKE_CASE													=					first_x_coord
						SCREAMING_SNAKE_CASE													=					first_y_coord
						SCREAMING_SNAKE_CASE													=					(10.1 - point_y) / (0.0 - point_x)

						while not (-0.01 <= point_x <= 0.01 and point_y > 0):
												SCREAMING_SNAKE_CASE							,				SCREAMING_SNAKE_CASE							,				SCREAMING_SNAKE_CASE													=					next_point(SCREAMING_SNAKE_CASE_ ,			SCREAMING_SNAKE_CASE_ ,			SCREAMING_SNAKE_CASE_  )
												num_reflections += 1

						return num_reflections


if __name__ == "__main__":
	print(f'''{solution() = }''')


