'''simple docstring'''




from __future__ import annotations







def 			A_   ( _lowerCamelCase			:							list  ,  _lowerCamelCase			:							list    ):
      _lowerCAmelCase		   =   [None] * (len(_lowerCamelCase    ) + len(_lowerCamelCase    ))

      _lowerCAmelCase		   =   0  # pointer to current index for left Half
      _lowerCAmelCase		   =   0  # pointer to current index for the right Half
      _lowerCAmelCase		   =   0  # pointer to current index for the sorted array Half

      while pointera < len(_lowerCamelCase    ) and pointera < len(_lowerCamelCase    ):
            if left_half[pointera] < right_half[pointera]:
                  _lowerCAmelCase		   =   left_half[pointera]
                  pointera += 1
                  index += 1
            else:
                  _lowerCAmelCase		   =   right_half[pointera]
                  pointera += 1
                  index += 1
      while pointera < len(_lowerCamelCase    ):
            _lowerCAmelCase		   =   left_half[pointera]
            pointera += 1
            index += 1

      while pointera < len(_lowerCamelCase    ):
            _lowerCAmelCase		   =   right_half[pointera]
            pointera += 1
            index += 1

      return sorted_array







def 			A_   ( _lowerCamelCase			:							list    ):
      if len(_lowerCamelCase    ) <= 1:
            return array
      # the actual formula to calculate the middle element = left + (right - left) // 2
      # this avoids integer overflow in case of large N
      _lowerCAmelCase		   =   0 + (len(_lowerCamelCase    ) - 0) // 2

      # Split the array into halves till the array length becomes equal to One
      # merge the arrays of single length returned by mergeSort function and
      # pass them into the merge arrays function which merges the array
      _lowerCAmelCase		   =   array[:middle]
      _lowerCAmelCase		   =   array[middle:]

      return merge(merge_sort(_lowerCamelCase    )  ,  merge_sort(_lowerCamelCase    )    )


if __name__ == "__main__":
 import doctest

 doctest.testmod()






'''simple docstring'''




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







def 			A_   ( _lowerCamelCase			:							float = np.pi / 2  ,  _lowerCamelCase			:							float = np.pi / 2  ,  _lowerCamelCase			:							float = np.pi / 2    ):
      _lowerCAmelCase		   =   QuantumRegister(3  ,  'qr'    )  # Define the number of quantum bits
      _lowerCAmelCase		   =   ClassicalRegister(1  ,  'cr'    )  # Define the number of classical bits

      _lowerCAmelCase		   =   QuantumCircuit(_lowerCamelCase  ,  _lowerCamelCase    )  # Define the quantum circuit.

      # Build the circuit
      quantum_circuit.u(_lowerCamelCase  ,  _lowerCamelCase  ,  _lowerCamelCase  ,  0    )  # Quantum State to teleport
      quantum_circuit.h(1    )  # add hadamard gate
      quantum_circuit.cx(
          1  ,  2    )  # add control gate with qubit 1 as control and 2 as target.
      quantum_circuit.cx(0  ,  1    )
      quantum_circuit.h(0    )
      quantum_circuit.cz(0  ,  2    )  # add control z gate.
      quantum_circuit.cx(1  ,  2    )

      quantum_circuit.measure([2]  ,  [0]    )  # measure the qubit.

      # Simulate the circuit using qasm simulator
      _lowerCAmelCase		   =   Aer.get_backend('aer_simulator'    )
      _lowerCAmelCase		   =   execute(_lowerCamelCase  ,  _lowerCamelCase  ,  shots=1_000    )

      return job.result().get_counts(_lowerCamelCase    )


if __name__ == "__main__":
 print(
     '''Total count for teleported state is: '''
     f'''{quantum_teleportation(np.pi/2, np.pi/2, np.pi/2)}'''
 )





