



'''simple docstring'''





import math

import qiskit




def lowerCAmelCase						(__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
     _a											=						qiskit.QuantumRegister(4						,			'''qr''')
     _a											=						qiskit.ClassicalRegister(2						,			'''cr''')
     # list the entries
     _a											=						[input_a, input_a, carry_in]

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

     _a											=						qiskit.Aer.get_backend('''aer_simulator''')
     _a											=						qiskit.execute(__A						,			__A						,			shots=1_000)

     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 PIL.Image
import PIL.ImageOps
from packaging import version
from PIL import Image


if version.parse(version.parse(PIL.__version__).base_version) >= version.parse("9.1.0"):
  lowercase_	 =						{
      "linear": PIL.Image.Resampling.BILINEAR,
      "bilinear": PIL.Image.Resampling.BILINEAR,
      "bicubic": PIL.Image.Resampling.BICUBIC,
      "lanczos": PIL.Image.Resampling.LANCZOS,
      "nearest": PIL.Image.Resampling.NEAREST,
  }
else:
  lowercase_	 =						{
      "linear": PIL.Image.LINEAR,
      "bilinear": PIL.Image.BILINEAR,
      "bicubic": PIL.Image.BICUBIC,
      "lanczos": PIL.Image.LANCZOS,
      "nearest": PIL.Image.NEAREST,
  }




def lowerCAmelCase						(__A):



     """simple docstring"""



     _a											=						(images / 2 + 0.5).clamp(0						,			1)
     _a											=						images.cpu().permute(0						,			2						,			3						,			1).float().numpy()
     _a											=						numpy_to_pil(__A)
     return images




def lowerCAmelCase						(__A):



     """simple docstring"""



     if images.ndim == 3:
          _a											=						images[None, ...]
     _a											=						(images * 255).round().astype('''uint8''')
     if images.shape[-1] == 1:
          # special case for grayscale (single channel) images
          _a											=						[Image.fromarray(image.squeeze()						,			mode='''L''') for image in images]
     else:
          _a											=						[Image.fromarray(__A) for image in images]

     return pil_images



