




"""simple docstring"""






from __future__ import annotations







def 	_snake_case     (							lowercase__				,       lowercase__						):
				print(f'''Vertex\tShortest Distance from vertex {src}'''						)
				for i, d in enumerate(lowercase__						):
								print(f'''{i}\t\t{d}'''						)







def 	_snake_case     (							lowercase__				,       lowercase__				,       lowercase__						):
				for j in range(lowercase__						):
								_lowerCamelCase,					_lowerCamelCase,					_lowerCamelCase	:     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 	_snake_case     (							lowercase__				,       lowercase__				,       lowercase__				,       lowercase__						):
				_lowerCamelCase	:     Dict       =       [float('inf'						)] * vertex_count
				_lowerCamelCase	:     Union[str, Any]       =       0.0

				for _ in range(vertex_count - 1						):
								for j in range(lowercase__						):
												_lowerCamelCase,					_lowerCamelCase,					_lowerCamelCase	:     str       =       (graph[j][k] for k in ['src', 'dst', 'weight'])

												if distance[u] != float('inf'						) and distance[u] + w < distance[v]:
																_lowerCamelCase	:     int       =       distance[u] + w

				_lowerCamelCase	:     Tuple       =       check_negative_cycle(lowercase__				,       lowercase__				,       lowercase__						)
				if negative_cycle_exists:
								raise Exception('Negative cycle found'						)

				return distance


if __name__ == "__main__":
			import doctest

			doctest.testmod()

			lowercase__			=		int(input("""Enter number of vertices: """).strip())
			lowercase__			=		int(input("""Enter number of edges: """).strip())

			lowercase__			=		[{} for _ in range(E)]

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

			lowercase__			=		int(input("""\nEnter shortest path source:""").strip())
			lowercase__			=		bellman_ford(graph, V, E, source)
			print_distance(shortest_distance, 0)





"""simple docstring"""






import qiskit







def 	_snake_case     (							lowercase__ = 2						):
				_lowerCamelCase	:     Optional[Any]       =       qubits

				# Using Aer's simulator
				_lowerCamelCase	:     Dict       =       qiskit.Aer.get_backend('aer_simulator'						)

				# Creating a Quantum Circuit acting on the q register
				_lowerCamelCase	:     Dict       =       qiskit.QuantumCircuit(lowercase__				,       lowercase__						)

				# Adding a H gate on qubit 0 (now q0 in superposition)
				circuit.h(0						)

				for i in range(1				,       lowercase__						):
								# Adding CX (CNOT) gate
								circuit.cx(i - 1				,       lowercase__						)

				# Mapping the quantum measurement to the classical bits
				circuit.measure(list(range(lowercase__						)						)				,       list(range(lowercase__						)						)						)

				# Now measuring any one qubit would affect other qubits to collapse
				# their super position and have same state as the measured one.

				# Executing the circuit on the simulator
				_lowerCamelCase	:     Optional[Any]       =       qiskit.execute(lowercase__				,       lowercase__				,       shots=1000						)

				return job.result().get_counts(lowercase__						)


if __name__ == "__main__":
			print(F"Total count for various states are: {quantum_entanglement(3)}")