


"""simple docstring"""
def 				_snake_case      (   __snake_case							:      List[str]						, __snake_case							:      Union[str, Any]   ):




   """simple docstring"""







   _lowerCamelCase	:					Optional[Any]   =		0
   _lowerCamelCase	:					Union[str, Any]   =		len(a__   ) - 1

   while left <= right:
      # avoid divided by 0 during interpolation
      if sorted_collection[left] == sorted_collection[right]:
         if sorted_collection[left] == item:
            return left
         else:
            return None

      _lowerCamelCase	:					Optional[Any]   =		left + ((item - sorted_collection[left]) * (right - left)) // (
          sorted_collection[right] - sorted_collection[left]
      )

      # out of range check
      if point < 0 or point >= len(a__   ):
         return None

      _lowerCamelCase	:					Dict   =		sorted_collection[point]
      if current_item == item:
         return point
      else:
         if point < left:
            _lowerCamelCase	:					str   =		left
            _lowerCamelCase	:					int   =		point
         elif point > right:
            _lowerCamelCase	:					List[Any]   =		right
            _lowerCamelCase	:					str   =		point
         else:
            if item < current_item:
               _lowerCamelCase	:					Tuple   =		point - 1
            else:
               _lowerCamelCase	:					List[str]   =		point + 1
   return None

def 				_snake_case      (   __snake_case							:      Optional[int]						, __snake_case							:      List[Any]						, __snake_case							:      List[str]						, __snake_case							:      List[str]   ):




   """simple docstring"""







   if sorted_collection[left] == sorted_collection[right]:
      if sorted_collection[left] == item:
         return left
      else:
         return None

   _lowerCamelCase	:					str   =		left + ((item - sorted_collection[left]) * (right - left)) // (
       sorted_collection[right] - sorted_collection[left]
   )

   # out of range check
   if point < 0 or point >= len(a__   ):
      return None

   if sorted_collection[point] == item:
      return point
   elif point < left:
      return interpolation_search_by_recursion(a__						, a__						, a__						, a__   )
   elif point > right:
      return interpolation_search_by_recursion(a__						, a__						, a__						, a__   )
   else:
      if sorted_collection[point] > item:
         return interpolation_search_by_recursion(
             a__						, a__						, a__						, point - 1   )
      else:
         return interpolation_search_by_recursion(
             a__						, a__						, point + 1						, a__   )

def 				_snake_case      (   __snake_case							:      Tuple   ):




   """simple docstring"""







   if collection != sorted(a__   ):
      raise ValueError("""Collection must be ascending sorted"""   )
   return True


if __name__ == "__main__":
 import sys
 UpperCAmelCase				=						0
 if debug == 1:
  UpperCAmelCase				=						[10, 30, 40, 45, 50, 66, 77, 93]
  try:
   __assert_sorted(collection)
  except ValueError:
   sys.exit("""Sequence must be ascending sorted to apply interpolation search""")
  UpperCAmelCase				=						67

 UpperCAmelCase				=						interpolation_search(collection, target)
 if result is not None:
  print(f'''{target} found at positions: {result}''')
 else:
  print("""Not found""")









"""simple docstring"""


import qiskit


def        UpperCAmelCase      (					a__     ,      a__ ):





						'''simple docstring'''






						lowerCAmelCase   :List[Any]						=			qiskit.Aer.get_backend('aer_simulator' )

						# Create a Quantum Circuit acting on the q register
						lowerCAmelCase   :Optional[int]						=			qiskit.QuantumCircuit(a__     ,      a__ )

						# Apply X (NOT) Gate to Qubits 0 & 1
						circuit.x(0 )
						circuit.x(1 )

						# Map the quantum measurement to the classical bits
						circuit.measure([0, 1]     ,      [0, 1] )

						# Execute the circuit on the qasm simulator
						lowerCAmelCase   :Dict						=			qiskit.execute(a__     ,      a__     ,      shots=10_00 )

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


if __name__ == "__main__":
		__SCREAMING_SNAKE_CASE   =   single_qubit_measure(2, 2)
		print(F"""Total count for various states are: {counts}""")