






"""simple docstring"""
import math

import qiskit





def 				lowercase__		(					lowerCamelCase = 1,						lowerCamelCase = 1,						lowerCamelCase = 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
				_SCREAMING_SNAKE_CASE   :		Any       		=    qiskit.QuantumRegister(4,						'qr'       )
				_SCREAMING_SNAKE_CASE   :		Optional[Any]       		=    qiskit.ClassicalRegister(2,						'cr'       )
				# list the entries
				_SCREAMING_SNAKE_CASE   :		List[str]       		=    [input_a, input_a, carry_in]

				_SCREAMING_SNAKE_CASE   :		int       		=    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

				_SCREAMING_SNAKE_CASE   :		Optional[Any]       		=    qiskit.Aer.get_backend('aer_simulator'       )
				_SCREAMING_SNAKE_CASE   :		str       		=    qiskit.execute(UpperCAmelCase_,						UpperCAmelCase_,						shots=1_000       )

				return job.result().get_counts(UpperCAmelCase_       )


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





import datasets


snake_case							:       int										=	'''\
@InProceedings{conneau2018xnli,
  author = "Conneau, Alexis
                 and Rinott, Ruty
                 and Lample, Guillaume
                 and Williams, Adina
                 and Bowman, Samuel R.
                 and Schwenk, Holger
                 and Stoyanov, Veselin",
  title = "XNLI: Evaluating Cross-lingual Sentence Representations",
  booktitle = "Proceedings of the 2018 Conference on Empirical Methods
               in Natural Language Processing",
  year = "2018",
  publisher = "Association for Computational Linguistics",
  location = "Brussels, Belgium",
}
'''

snake_case							:       Tuple										=	'''\
XNLI is a subset of a few thousand examples from MNLI which has been translated
into a 14 different languages (some low-ish resource). As with MNLI, the goal is
to predict textual entailment (does sentence A imply/contradict/neither sentence
B) and is a classification task (given two sentences, predict one of three
labels).
'''

snake_case							:       Union[str, Any]										=	'''
Computes XNLI score which is just simple accuracy.
Args:
    predictions: Predicted labels.
    references: Ground truth labels.
Returns:
    \'accuracy\': accuracy
Examples:

    >>> predictions = [0, 1]
    >>> references = [0, 1]
    >>> xnli_metric = datasets.load_metric("xnli")
    >>> results = xnli_metric.compute(predictions=predictions, references=references)
    >>> print(results)
    {\'accuracy\': 1.0}
'''
def 							__lowerCamelCase		(					UpperCAmelCase_		:						List[Any]					,    UpperCAmelCase_		:						List[str]		):




      """simple docstring"""





      return (preds == labels).mean()







@datasets.utils.file_utils.add_start_docstrings(_DESCRIPTION		,       _KWARGS_DESCRIPTION				)
class 						_snake_case    ( datasets.Metric				):




 def 			SCREAMING_SNAKE_CASE__							(						self       ):
       return datasets.MetricInfo(
           description=_DESCRIPTION   ,    citation=_CITATION   ,    inputs_description=_KWARGS_DESCRIPTION   ,    features=datasets.Features(
               {
                   '''predictions''': datasets.Value('''int64''' if self.config_name != '''sts-b''' else '''float32'''       ),
                   '''references''': datasets.Value('''int64''' if self.config_name != '''sts-b''' else '''float32'''       ),
               }       )   ,    codebase_urls=[]   ,    reference_urls=[]   ,    format='''numpy'''   ,    )




 def 			SCREAMING_SNAKE_CASE__							(						self   ,    _lowerCamelCase   ,    _lowerCamelCase       ):
       return {"accuracy": simple_accuracy(_lowerCamelCase   ,    _lowerCamelCase       )}





