
"""simple docstring"""




import hashlib
import importlib.util
import json
import os
import pathlib
from types import ModuleType

import pytest
import requests

__lowerCAmelCase							:  str 				=		pathlib.Path.cwd().joinpath('''project_euler''')
__lowerCAmelCase							:  Optional[int] 				=		pathlib.Path.cwd().joinpath(
    '''scripts''', '''project_euler_answers.json'''
)

with open(PROJECT_EULER_ANSWERS_PATH) as file_handle:
					__lowerCAmelCase							:  Dict 				=		json.load(file_handle)

def __snake_case (      UpperCamelCase    )       ->    Union[str, Any]:


		"""simple docstring"""





		a__   		=     importlib.util.spec_from_file_location(file_path.name						,					str(SCREAMING_SNAKE_CASE_    )    )
		a__   		=     importlib.util.module_from_spec(SCREAMING_SNAKE_CASE_    )  # type: ignore
		spec.loader.exec_module(SCREAMING_SNAKE_CASE_    )  # type: ignore
		return module

def __snake_case (      )       ->    Any:


		"""simple docstring"""





		a__   		=     []
		for problem_dir_path in PROJECT_EULER_DIR_PATH.iterdir():
				if problem_dir_path.is_file() or problem_dir_path.name.startswith('''_'''    ):
						continue
				for file_path in problem_dir_path.iterdir():
						if file_path.suffix != ".py" or file_path.name.startswith(('''_''', '''test''')    ):
								continue
						solution_file_paths.append(SCREAMING_SNAKE_CASE_    )
		return solution_file_paths

def __snake_case (      )       ->    Optional[Any]:


		"""simple docstring"""





		with open(os.environ['''GITHUB_EVENT_PATH''']    ) as file:
				a__   		=     json.load(SCREAMING_SNAKE_CASE_    )
		return event["pull_request"]["url"] + "/files"

def __snake_case (      )       ->    int:


		"""simple docstring"""





		a__   		=     []
		a__   		=     {
		    '''Accept''': '''application/vnd.github.v3+json''',
		    '''Authorization''': '''token ''' + os.environ['''GITHUB_TOKEN'''],
		}
		a__   		=     requests.get(get_files_url()						,					headers=SCREAMING_SNAKE_CASE_    ).json()
		for file in files:
				a__   		=     pathlib.Path.cwd().joinpath(file['''filename''']    )
				if (
				    filepath.suffix != ".py"
				    or filepath.name.startswith(('''_''', '''test''')    )
				    or not filepath.name.startswith('''sol'''    )
				):
						continue
				solution_file_paths.append(SCREAMING_SNAKE_CASE_    )
		return solution_file_paths

def __snake_case (      )       ->    str:


		"""simple docstring"""





		if os.environ.get('''CI'''    ) and os.environ.get('''GITHUB_EVENT_NAME'''    ) == "pull_request":
				# Return only if there are any, otherwise default to all solutions
				if filepaths := added_solution_file_path():
						return filepaths
		return all_solution_file_paths()




@pytest.mark.parametrize(
    '''solution_path'''						,					collect_solution_file_paths()						,					ids=lambda UpperCamelCase    : f"{path.parent.name}/{path.name}"						,					)
def __snake_case (      UpperCamelCase    )       ->    Tuple:


		"""simple docstring"""





		a__   		=     solution_path.parent.name[8:].zfill(3    )
		a__   		=     PROBLEM_ANSWERS[problem_number]
		a__   		=     convert_path_to_module(SCREAMING_SNAKE_CASE_    )
		a__   		=     str(solution_module.solution()    )  # type: ignore
		a__   		=     hashlib.shaaaa(answer.encode()    ).hexdigest()
		assert (
		    answer == expected
		), f"Expected solution to {problem_number} to have hash {expected}, got {answer}"






"""simple docstring"""




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

def     UpperCamelCase_    (						SCREAMING_SNAKE_CASE_ = np.pi / 2,	SCREAMING_SNAKE_CASE_ = np.pi / 2,	SCREAMING_SNAKE_CASE_ = np.pi / 2     ):
					SCREAMING_SNAKE_CASE           =      QuantumRegister(3,	'qr'     )  # Define the number of quantum bits
					SCREAMING_SNAKE_CASE           =      ClassicalRegister(1,	'cr'     )  # Define the number of classical bits

					SCREAMING_SNAKE_CASE           =      QuantumCircuit(SCREAMING_SNAKE_CASE_,	SCREAMING_SNAKE_CASE_     )  # Define the quantum circuit.

					# Build the circuit
					quantum_circuit.u(SCREAMING_SNAKE_CASE_,	SCREAMING_SNAKE_CASE_,	SCREAMING_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
					SCREAMING_SNAKE_CASE           =      Aer.get_backend('aer_simulator'     )
					SCREAMING_SNAKE_CASE           =      execute(SCREAMING_SNAKE_CASE_,	SCREAMING_SNAKE_CASE_,	shots=1_0_0_0     )

					return job.result().get_counts(SCREAMING_SNAKE_CASE_     )


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