


'''simple docstring'''
import itertools
from dataclasses import dataclass
from typing import Optional

import pandas as pd
import pyarrow as pa

import datasets
from datasets.table import table_cast






@dataclass
class        lowerCAmelCase_  (     datasets.BuilderConfig	):
       __UpperCAmelCase					=None






class        lowerCAmelCase_  (     datasets.ArrowBasedBuilder	):
       __UpperCAmelCase					=PandasConfig






       def   UpperCamelCase						( self   )->      Optional[int]:
            return datasets.DatasetInfo(features=self.config.features   )






       def   UpperCamelCase						( self			,     _UpperCamelCase   )->      Any:
            if not self.config.data_files:
                 raise ValueError(F'At least one data file must be specified, but got data_files={self.config.data_files}'   )
            _A				=							dl_manager.download_and_extract(self.config.data_files   )
            if isinstance(_UpperCamelCase			,     (str, list, tuple)   ):
                 _A				=							data_files
                 if isinstance(_UpperCamelCase			,     _UpperCamelCase   ):
                      _A				=							[files]
                 # Use `dl_manager.iter_files` to skip hidden files in an extracted archive
                 _A				=							[dl_manager.iter_files(_UpperCamelCase   ) for file in files]
                 return [datasets.SplitGenerator(name=datasets.Split.TRAIN			,     gen_kwargs={'files': files}   )]
            _A				=							[]
            for split_name, files in data_files.items():
                 if isinstance(_UpperCamelCase			,     _UpperCamelCase   ):
                      _A				=							[files]
                 # Use `dl_manager.iter_files` to skip hidden files in an extracted archive
                 _A				=							[dl_manager.iter_files(_UpperCamelCase   ) for file in files]
                 splits.append(datasets.SplitGenerator(name=_UpperCamelCase			,     gen_kwargs={'files': files}   )   )
            return splits






       def   UpperCamelCase						( self			,     _UpperCamelCase   )->      pa.Table:
            if self.config.features is not None:
                 # more expensive cast to support nested features with keys in a different order
                 # allows str <-> int/float or str to Audio for example
                 _A				=							table_cast(_UpperCamelCase			,     self.config.features.arrow_schema   )
            return pa_table






       def   UpperCamelCase						( self			,     _UpperCamelCase   )->      Optional[Any]:
            for i, file in enumerate(itertools.chain.from_iterable(_UpperCamelCase   )   ):
                 with open(_UpperCamelCase			,     'rb'   ) as f:
                      _A				=							pa.Table.from_pandas(pd.read_pickle(_UpperCamelCase   )   )
                      yield i, self._cast_table(_UpperCamelCase   )









'''simple docstring'''
import math

import qiskit

def 					lowerCamelCase_ ( __UpperCamelCase					:       int = 1							,    __UpperCamelCase					:       int = 1							,    __UpperCamelCase					:       int = 1		)					->	qiskit.result.counts.Counts:







     """simple docstring"""
     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
     _A				=							qiskit.QuantumRegister(4							,    'qr'		)
     _A				=							qiskit.ClassicalRegister(2							,    'cr'		)
     # list the entries
     _A				=							[input_a, input_a, carry_in]

     _A				=							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

     _A				=							qiskit.Aer.get_backend('aer_simulator'		)
     _A				=							qiskit.execute(__UpperCamelCase							,    __UpperCamelCase							,    shots=1_0_0_0		)

     return job.result().get_counts(__UpperCamelCase		)


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





