

'''simple docstring'''


# Lint as: python3
import dataclasses
import re
from dataclasses import dataclass
from functools import total_ordering
from typing import Optional, Union


lowerCAmelCase__										= re.compile(r"^(?P<major>\d+)" r"\.(?P<minor>\d+)" r"\.(?P<patch>\d+)$")



@total_ordering
@dataclass
class 					lowercase						:
							_lowerCamelCase		:      str
							_lowerCamelCase		:      Optional[str]=   None
							_lowerCamelCase		:      Optional[Union[str, int]]=   None
							_lowerCamelCase		:      Optional[Union[str, int]]=   None
							_lowerCamelCase		:      Optional[Union[str, int]]=   None


							def 						_snake_case							(			self)							->				Optional[Any]:
								UpperCAmelCase_	,    UpperCAmelCase_	,    UpperCAmelCase_		:      List[Any]       	=					_str_to_version_tuple(self.version_str)


							def __repr__(			self)							->				Union[str, Any]:
								return F"""{self.tuple[0]}.{self.tuple[1]}.{self.tuple[2]}"""


							@property
							def 						_snake_case							(			self)							->				int:
								return self.major, self.minor, self.patch


							def 						_snake_case							(			self    ,			_snake_case)							->				List[str]:
								if isinstance(_snake_case    ,			_snake_case):
									return Version(_snake_case)
								elif isinstance(_snake_case    ,			_snake_case):
									return other
								raise TypeError(F"""{other} (type {type(_snake_case)}) cannot be compared to version.""")


							def __eq__(			self    ,			_snake_case)							->				Tuple:
								try:
									UpperCAmelCase_		:      Tuple       	=					self._validate_operand(_snake_case)
								except (TypeError, ValueError):
									return False
								else:
									return self.tuple == other.tuple


							def __lt__(			self    ,			_snake_case)							->				Optional[int]:
								UpperCAmelCase_		:      List[str]       	=					self._validate_operand(_snake_case)
								return self.tuple < other.tuple


							def __hash__(			self)							->				Optional[Any]:
								return hash(_version_tuple_to_str(self.tuple))


							@classmethod
							def 						_snake_case							(			cls    ,			_snake_case)							->				int:
								UpperCAmelCase_		:      Optional[int]       	=					{f.name for f in dataclasses.fields(cls)}
								return cls(**{k: v for k, v in dic.items() if k in field_names})





							def 						_snake_case							(			self)							->				str:
								return self.version_str







def 						SCREAMING_SNAKE_CASE(  UpperCamelCase  )    ->    Tuple:
	UpperCAmelCase_		:      List[Any]       	=					_VERSION_REG.match(UpperCamelCase  )
	if not res:
		raise ValueError(f"""Invalid version '{version_str}'. Format should be x.y.z with {{x,y,z}} being digits."""  )
	return tuple(int(UpperCamelCase  ) for v in [res.group('major'  ), res.group('minor'  ), res.group('patch'  )]  )







def 						SCREAMING_SNAKE_CASE(  UpperCamelCase  )    ->    Optional[int]:
	return ".".join(str(UpperCamelCase  ) for v in version_tuple  )









'''simple docstring'''


import qiskit







def 						SCREAMING_SNAKE_CASE(  UpperCamelCase   ,UpperCamelCase  )    ->    qiskit.result.counts.Counts:
	UpperCAmelCase_		:      Tuple       	=					qiskit.Aer.get_backend('aer_simulator'  )

	UpperCAmelCase_		:      List[str]       	=					qiskit.QuantumCircuit(4   ,2  )
	# encode inputs in qubits 0 and 1
	if bita == 1:
		qc_ha.x(0  )
	if bita == 1:
		qc_ha.x(1  )
	qc_ha.barrier()

	# use cnots to write XOR of the inputs on qubit2
	qc_ha.cx(0   ,2  )
	qc_ha.cx(1   ,2  )

	# use ccx / toffoli gate to write AND of the inputs on qubit3
	qc_ha.ccx(0   ,1   ,3  )
	qc_ha.barrier()

	# extract outputs
	qc_ha.measure(2   ,0  )  # extract XOR value
	qc_ha.measure(3   ,1  )  # extract AND value

	# Execute the circuit on the qasm simulator
	UpperCAmelCase_		:      List[str]       	=					qiskit.execute(UpperCamelCase   ,UpperCamelCase   ,shots=1_0_0_0  )

	# Return the histogram data of the results of the experiment
	return job.result().get_counts(UpperCamelCase  )


if __name__ == "__main__":
						lowerCAmelCase__										= half_adder(1, 1)
						print(F'Half Adder Output Qubit Counts: {counts}')






