



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


def 		_UpperCAmelCase    (				snake_case = np.pi / 2     ,						snake_case = np.pi / 2     ,						snake_case = np.pi / 2      ):





					"""simple docstring"""

					_lowerCAmelCase      =   QuantumRegister(3     ,						"""qr"""      )  # Define the number of quantum bits
					_lowerCAmelCase      =   ClassicalRegister(1     ,						"""cr"""      )  # Define the number of classical bits

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

					# Build the circuit
					quantum_circuit.u(snake_case     ,						snake_case     ,						snake_case     ,						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(snake_case     ,						snake_case     ,						shots=10_00      )

					return job.result().get_counts(snake_case      )


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








# Lint as: python3

import hashlib
from typing import Union


def 		_UpperCAmelCase    (				snake_case      ):





					"""simple docstring"""

					if isinstance(snake_case     ,						snake_case      ):
										# Data already in bytes, returns as it as
										return hash_data
					elif isinstance(snake_case     ,						snake_case      ):
										# We keep the data as it as for it ot be later encoded to UTF-8
										# However replace `\\` with `/` for Windows compatibility
										_lowerCAmelCase      =   hash_data.replace("""\\"""     ,						"""/"""      )
					elif isinstance(snake_case     ,						snake_case      ):
										_lowerCAmelCase      =   str(snake_case      )
					else:
										# If data is not of the required type, raise error
										raise InvalidKeyError(snake_case      )

					return hash_data.encode("""utf-8"""      )





class  __lowerCAmelCase			(					lowerCamelCase__	):




				def __init__(							self						,    _snake_case		):



									"""simple docstring"""





									_lowerCAmelCase      =   """\nFAILURE TO GENERATE DATASET: Invalid key type detected"""
									_lowerCAmelCase      =   F'\nFound Key {hash_data} of type {type(_snake_case		)}'
									_lowerCAmelCase      =   """\nKeys should be either str, int or bytes type"""
									super().__init__(F'{self.prefix}{self.err_msg}{self.suffix}'		)





class  __lowerCAmelCase			(					lowerCamelCase__	):




				def __init__(							self						,    _snake_case						,    _snake_case						,    _snake_case=""		):



									"""simple docstring"""





									_lowerCAmelCase      =   key
									_lowerCAmelCase      =   duplicate_key_indices
									_lowerCAmelCase      =   fix_msg
									_lowerCAmelCase      =   """Found multiple examples generated with the same key"""
									if len(_snake_case		) <= 20:
														_lowerCAmelCase      =   F'\nThe examples at index {", ".join(_snake_case		)} have the key {key}'
									else:
														_lowerCAmelCase      =   F'\nThe examples at index {", ".join(duplicate_key_indices[:20]		)}... ({len(_snake_case		) - 20} more) have the key {key}'
									_lowerCAmelCase      =   """\n""" + fix_msg if fix_msg else """"""
									super().__init__(F'{self.prefix}{self.err_msg}{self.suffix}'		)





class  __lowerCAmelCase			:




				def __init__(							self						,    _snake_case		):



									"""simple docstring"""





									_lowerCAmelCase      =   hashlib.mda(_as_bytes(_snake_case		)		)




				def 							snake_case       (							self						,    _snake_case		):



									"""simple docstring"""





									_lowerCAmelCase      =   self._split_mda.copy()
									_lowerCAmelCase      =   _as_bytes(_snake_case		)
									mda.update(_snake_case		)
									# Convert to integer with hexadecimal conversion
									return int(mda.hexdigest()						,    16		)



