




import math

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







def SCREAMING_SNAKE_CASE    (	lowercase_ = 3						)       ->	qiskit.result.counts.Counts:



       """simple docstring"""

       if isinstance(lowercase_			,      lowercase_						):
              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(lowercase_						) != number_of_qubits:
              raise ValueError('''number of qubits must be exact integer.'''						)
       if number_of_qubits > 10:
              raise ValueError('''number of qubits too large to simulate(>10).'''						)

       A__							=   QuantumRegister(lowercase_			,      '''qr'''						)
       A__							=   ClassicalRegister(lowercase_			,      '''cr'''						)

       A__							=   QuantumCircuit(lowercase_			,      lowercase_						)

       A__							=   number_of_qubits

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

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

       # measure all the qubits
       quantum_circuit.measure(lowercase_			,      lowercase_						)
       # simulate with 10000 shots
       A__							=   Aer.get_backend('''qasm_simulator'''						)
       A__							=   execute(lowercase_			,      lowercase_			,      shots=10_000						)

       return job.result().get_counts(lowercase_						)


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








class     UpperCamelCase_   :

    '''simple docstring'''






    def __init__(      self				:     List[str] ,			UpperCAmelCase__				:     int)						->Union[str, Any]:





           '''simple docstring'''

           A__							=   n
           A__							=   [None] * self.n
           A__							=   0  # index of the first element
           A__							=   0
           A__							=   0


    def __len__(      self				:     List[Any])						->int:





           '''simple docstring'''

           return self.size


    def 	SCREAMING_SNAKE_CASE							(      self				:     List[Any])						->bool:





           '''simple docstring'''

           return self.size == 0


    def 	SCREAMING_SNAKE_CASE							(      self				:     str)						->List[Any]:





           '''simple docstring'''

           return False if self.is_empty() else self.array[self.front]


    def 	SCREAMING_SNAKE_CASE							(      self				:     List[str] ,			UpperCAmelCase__				:     str)						->Any:





           '''simple docstring'''

           if self.size >= self.n:
                  raise Exception('''QUEUE IS FULL''')

           A__							=   data
           A__							=   (self.rear + 1) % self.n
           self.size += 1
           return self





    def 	SCREAMING_SNAKE_CASE							(      self				:     Union[str, Any])						->Any:





           '''simple docstring'''

           if self.size == 0:
                  raise Exception('''UNDERFLOW''')

           A__							=   self.array[self.front]
           A__							=   None
           A__							=   (self.front + 1) % self.n
           self.size -= 1
           return temp


