

'''simple docstring'''






import math

import qiskit


def 		_A     (    A__ = 1     ,				A__ = 1     ,				A__ = 1      ):






 """simple docstring"""



 if (
     isinstance(A__     ,				A__      )
     or isinstance(A__     ,				A__      )
     or isinstance(A__     ,				A__      )
 ):
  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(A__      ) != input_a)
     or (math.floor(A__      ) != input_a)
     or (math.floor(A__      ) != 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
 __lowercase							  = qiskit.QuantumRegister(4     ,				'''qr'''      )
 __lowercase							  = qiskit.ClassicalRegister(2     ,				'''cr'''      )
 # list the entries
 __lowercase							  = [input_a, input_a, carry_in]

 __lowercase							  = qiskit.QuantumCircuit(A__     ,				A__      )

 for i in range(0     ,				3      ):
  if entry[i] == 2:
   quantum_circuit.h(A__      )  # for hadamard entries
  elif entry[i] == 1:
   quantum_circuit.x(A__      )  # for 1 entries
  elif entry[i] == 0:
   quantum_circuit.i(A__      )  # 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]     ,				A__      )  # measure the last two qbits

 __lowercase							  = qiskit.Aer.get_backend('''aer_simulator'''      )
 __lowercase							  = qiskit.execute(A__     ,				A__     ,				shots=1000      )

 return job.result().get_counts(A__      )


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




'''simple docstring'''






import unicodedata
from dataclasses import dataclass
from typing import Optional, Union

import numpy as np

from transformers.data.data_collator import DataCollatorMixin
from transformers.file_utils import PaddingStrategy
from transformers.tokenization_utils_base import PreTrainedTokenizerBase


def 		_A     (    A__     ,				A__     ,				A__     ,				A__      ):






 """simple docstring"""



 if isinstance(A__     ,				A__      ):
  __lowercase							  = np.full((len(A__      ), sequence_length, 2)     ,				A__      )
 else:
  __lowercase							  = np.full((len(A__      ), sequence_length)     ,				A__      )

 for i, tensor in enumerate(A__      ):
  if padding_side == "right":
   if isinstance(A__     ,				A__      ):
    __lowercase							  = tensor[:sequence_length]
   else:
    __lowercase							  = tensor[:sequence_length]
  else:
   if isinstance(A__     ,				A__      ):
    __lowercase							  = tensor[:sequence_length]
   else:
    __lowercase							  = tensor[:sequence_length]

 return out_tensor.tolist()


def 		_A     (    A__      ):






 """simple docstring"""



 __lowercase							  = ord(A__      )
 if (cp >= 33 and cp <= 47) or (cp >= 58 and cp <= 64) or (cp >= 91 and cp <= 96) or (cp >= 123 and cp <= 126):
  return True
 __lowercase							  = unicodedata.category(A__      )
 if cat.startswith('''P'''      ):
  return True
 return False






@dataclass
class 			lowercase_	(lowerCamelCase__      ):




  """simple docstring"""




  SCREAMING_SNAKE_CASE    :  PreTrainedTokenizerBase
  SCREAMING_SNAKE_CASE    :  Union[bool, str, PaddingStrategy]							=			True
  SCREAMING_SNAKE_CASE    :  Optional[int]							=			None
  SCREAMING_SNAKE_CASE    :  Optional[int]							=			None
  SCREAMING_SNAKE_CASE    :  int							=			-1_0_0
  SCREAMING_SNAKE_CASE    :  str							=			"pt"






  def 					SCREAMING_SNAKE_CASE      (      self   :     List[str]					,lowercase__   :     List[str]			):
   import torch

   __lowercase							  = '''label''' if '''label''' in features[0].keys() else '''labels'''
   __lowercase							  = [feature[label_name] for feature in features] if label_name in features[0].keys() else None
   __lowercase							  = self.tokenizer.pad(
       lowercase__					,padding=self.padding					,max_length=self.max_length					,pad_to_multiple_of=self.pad_to_multiple_of					,return_tensors='''pt''' if labels is None else None					,)

   if labels is None:
    return batch

   __lowercase							  = torch.tensor(batch['''entity_ids''']			).shape[1]
   __lowercase							  = self.tokenizer.padding_side
   if padding_side == "right":
    __lowercase							  = [
        list(lowercase__			) + [self.label_pad_token_id] * (sequence_length - len(lowercase__			)) for label in labels
    ]
   else:
    __lowercase							  = [
        [self.label_pad_token_id] * (sequence_length - len(lowercase__			)) + list(lowercase__			) for label in labels
    ]

   __lowercase							  = [feature['''ner_tags'''] for feature in features]
   __lowercase							  = padding_tensor(lowercase__					,-1					,lowercase__					,lowercase__			)
   __lowercase							  = [feature['''original_entity_spans'''] for feature in features]
   __lowercase							  = padding_tensor(lowercase__					,(-1, -1)					,lowercase__					,lowercase__			)
   __lowercase							  = {k: torch.tensor(lowercase__					,dtype=torch.intaa			) for k, v in batch.items()}

   return batch

