'''simple docstring'''





from __future__ import annotations
def 						__A							(     UpperCAmelCase     ,UpperCAmelCase					)     ->			List[str]:




						'''simple docstring'''
						print(f'''Vertex\tShortest Distance from vertex {src}'''					)
						for i, d in enumerate(UpperCAmelCase					):
												print(f'''{i}\t\t{d}'''					)
def 						__A							(     UpperCAmelCase     ,UpperCAmelCase     ,UpperCAmelCase					)     ->			Tuple:




						'''simple docstring'''
						for j in range(UpperCAmelCase					):
												_UpperCamelCase			,       _UpperCamelCase			,       _UpperCamelCase			:			str   			=						(graph[j][k] for k in ["src", "dst", "weight"])
												if distance[u] != float("inf"					) and distance[u] + w < distance[v]:
																		return True
						return False
def 						__A							(     UpperCAmelCase     ,UpperCAmelCase     ,UpperCAmelCase     ,UpperCAmelCase					)     ->			list[float]:




						'''simple docstring'''
						_UpperCamelCase			:			Tuple   			=						[float("inf"					)] * vertex_count
						_UpperCamelCase			:			Any   			=						0.0

						for _ in range(vertex_count - 1					):
												for j in range(UpperCAmelCase					):
																		_UpperCamelCase			,       _UpperCamelCase			,       _UpperCamelCase			:			List[Any]   			=						(graph[j][k] for k in ["src", "dst", "weight"])

																		if distance[u] != float("inf"					) and distance[u] + w < distance[v]:
																								_UpperCamelCase			:			Any   			=						distance[u] + w

						_UpperCamelCase			:			Dict   			=						check_negative_cycle(UpperCAmelCase     ,UpperCAmelCase     ,UpperCAmelCase					)
						if negative_cycle_exists:
												raise Exception("Negative cycle found"					)

						return distance


if __name__ == "__main__":
			import doctest

			doctest.testmod()

			lowerCAmelCase_	:		Optional[int]			=     int(input("""Enter number of vertices: """).strip())
			lowerCAmelCase_	:		int			=     int(input("""Enter number of edges: """).strip())

			lowerCAmelCase_	:		list[dict[str, int]]			=     [{} for _ in range(E)]

			for i in range(E):
						print("""Edge """, i + 1)
						lowerCAmelCase_	,	lowerCAmelCase_	,	lowerCAmelCase_	:		List[str]			=     (
						    int(x)
						    for x in input("""Enter source, destination, weight: """).strip().split(""" """)
						)
						lowerCAmelCase_	:		Tuple			=     {"""src""": src, """dst""": dest, """weight""": weight}

			lowerCAmelCase_	:		Union[str, Any]			=     int(input("""\nEnter shortest path source:""").strip())
			lowerCAmelCase_	:		List[str]			=     bellman_ford(graph, V, E, source)
			print_distance(shortest_distance, 0)



'''simple docstring'''





from __future__ import annotations

from cmath import sqrt
def 						__A							(     UpperCAmelCase     ,UpperCAmelCase     ,UpperCAmelCase					)     ->			tuple[complex, complex]:




						'''simple docstring'''

						if a == 0:
												raise ValueError("Coefficient 'a' must not be zero."					)
						_UpperCamelCase			:			List[str]   			=						b * b - 4 * a * c

						_UpperCamelCase			:			Dict   			=						(-b + sqrt(UpperCAmelCase					)) / (2 * a)
						_UpperCamelCase			:			Optional[int]   			=						(-b - sqrt(UpperCAmelCase					)) / (2 * a)

						return (
						    root_a.real if not root_a.imag else root_a,
						    root_a.real if not root_a.imag else root_a,
						)
def 						__A							(     )     ->			List[Any]:




						'''simple docstring'''
						_UpperCamelCase			,       _UpperCamelCase			:			Any   			=						quadratic_roots(a=5     ,b=6     ,c=1					)
						print(f'''The solutions are: {solutiona} and {solutiona}'''					)


if __name__ == "__main__":
			main()


