
import math

import numpy as np
import qiskit
from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute


def 						UpperCAmelCase			(	a_ = 3						)		->	qiskit.result.counts.Counts:







				"""simple docstring"""



				if isinstance(a_		,   a_						):
								raise TypeError("number of qubits must be a integer."						)
				if number_of_qubits <= 0:
								raise ValueError("number of qubits must be > 0."						)
				if math.floor(a_						) != number_of_qubits:
								raise ValueError("number of qubits must be exact integer."						)
				if number_of_qubits > 1_0:
								raise ValueError("number of qubits too large to simulate(>10)."						)

				__A   			= QuantumRegister(a_		,   "qr"						)
				__A   			= ClassicalRegister(a_		,   "cr"						)

				__A   			= QuantumCircuit(a_		,   a_						)

				__A   			= number_of_qubits

				for i in range(a_						):
								quantum_circuit.h(number_of_qubits - i - 1						)
								counter -= 1
								for j in range(a_						):
												quantum_circuit.cp(np.pi / 2 ** (counter - j)		,   a_		,   a_						)

				for k in range(number_of_qubits // 2						):
								quantum_circuit.swap(a_		,   number_of_qubits - k - 1						)

				# measure all the qubits
				quantum_circuit.measure(a_		,   a_						)
				# simulate with 10000 shots
				__A   			= Aer.get_backend("qasm_simulator"						)
				__A   			= execute(a_		,   a_		,   shots=1_0_0_0_0						)

				return job.result().get_counts(a_						)


if __name__ == "__main__":
					print(
					    f'''Total count for quantum fourier transform state is: \
    {quantum_fourier_transform(3)}'''
					)


def 						UpperCAmelCase			(	a_						)		->	Optional[int]:







				"""simple docstring"""



				__A   			= [0] * len(a_						)
				__A   			= []
				__A   			= [1] * len(a_						)

				for values in graph.values():
								for i in values:
												indegree[i] += 1

				for i in range(len(a_						)						):
								if indegree[i] == 0:
												queue.append(a_						)

				while queue:
								__A   			= queue.pop(0						)
								for x in graph[vertex]:
												indegree[x] -= 1

												if long_dist[vertex] + 1 > long_dist[x]:
																__A   			= long_dist[vertex] + 1

												if indegree[x] == 0:
																queue.append(a_						)

				print(max(a_						)						)


# Adjacency list of Graph
SCREAMING_SNAKE_CASE							:List[Any]							 =				{0: [2, 3, 4], 1: [2, 7], 2: [5], 3: [5, 7], 4: [7], 5: [6], 6: [7], 7: []}
longest_distance(graph)
