
"""simple docstring"""







import math

import qiskit
def    __lowerCAmelCase    (_UpperCamelCase = 1	,  _UpperCamelCase = 1	,  _UpperCamelCase = 1		):
	if (
	    isinstance(_UpperCamelCase	,  _UpperCamelCase		)
	    or isinstance(_UpperCamelCase	,  _UpperCamelCase		)
	    or isinstance(_UpperCamelCase	,  _UpperCamelCase		)
	):
		raise TypeError('inputs must be integers.'		)

	if (input_a < 0) or (input_a < 0) or (carry_in < 0):
		raise ValueError('inputs must be positive.'		)

	if (
	    (math.floor(_UpperCamelCase		) != input_a)
	    or (math.floor(_UpperCamelCase		) != input_a)
	    or (math.floor(_UpperCamelCase		) != carry_in)
	):
		raise ValueError('inputs must be exact integers.'		)

	if (input_a > 2) or (input_a > 2) or (carry_in > 2):
		raise ValueError('inputs must be less or equal to 2.'		)

	# build registers
	__lowerCAmelCase      :						List[Any]						      =				qiskit.QuantumRegister(4	,  'qr'		)
	__lowerCAmelCase      :						List[Any]						      =				qiskit.ClassicalRegister(2	,  'cr'		)
	# list the entries
	__lowerCAmelCase      :						Tuple						      =				[input_a, input_a, carry_in]

	__lowerCAmelCase      :						Dict						      =				qiskit.QuantumCircuit(_UpperCamelCase	,  _UpperCamelCase		)

	for i in range(0	,  3		):
		if entry[i] == 2:
			quantum_circuit.h(_UpperCamelCase		)  # for hadamard entries
		elif entry[i] == 1:
			quantum_circuit.x(_UpperCamelCase		)  # for 1 entries
		elif entry[i] == 0:
			quantum_circuit.i(_UpperCamelCase		)  # for 0 entries

    # build the circuit
	quantum_circuit.ccx(0	,  1	,  3		)  # ccx = toffoli gate
	quantum_circuit.cx(0	,  1		)
	quantum_circuit.ccx(1	,  2	,  3		)
	quantum_circuit.cx(1	,  2		)
	quantum_circuit.cx(0	,  1		)

	quantum_circuit.measure([2, 3]	,  _UpperCamelCase		)  # measure the last two qbits

	__lowerCAmelCase      :						List[str]						      =				qiskit.Aer.get_backend('aer_simulator'		)
	__lowerCAmelCase      :						str						      =				qiskit.execute(_UpperCamelCase	,  _UpperCamelCase	,  shots=1000		)

	return job.result().get_counts(_UpperCamelCase		)


if __name__ == "__main__":
							print(f'Total sum count for state is: {quantum_full_adder(1, 1, 1)}')

"""simple docstring"""







import pytest

import datasets.config
from datasets.utils.info_utils import is_small_dataset
@pytest.mark.parametrize('dataset_size'	,  [None, 400 * 2**20, 600 * 2**20]		)
@pytest.mark.parametrize('input_in_memory_max_size'	,  ['default', 0, 100 * 2**20, 900 * 2**20]		)
def    __lowerCAmelCase    (_UpperCamelCase	,  _UpperCamelCase	,  _UpperCamelCase		):
	if input_in_memory_max_size != "default":
		monkeypatch.setattr(datasets.config	,  'IN_MEMORY_MAX_SIZE'	,  _UpperCamelCase		)
	__lowerCAmelCase      :						Union[str, Any]						      =				datasets.config.IN_MEMORY_MAX_SIZE
	if input_in_memory_max_size == "default":
		assert in_memory_max_size == 0
	else:
		assert in_memory_max_size == input_in_memory_max_size
	if dataset_size and in_memory_max_size:
		__lowerCAmelCase      :						Tuple						      =				dataset_size < in_memory_max_size
	else:
		__lowerCAmelCase      :						str						      =				False
	__lowerCAmelCase      :						Optional[int]						      =				is_small_dataset(_UpperCamelCase		)
	assert result == expected