


from copy import deepcopy

class  __A       :


				def __init__(						self				,	UpperCAmelCase_ = None				,	UpperCAmelCase_ = None							):

								if arr is None and size is not None:
												lowerCamelCase			=size
												lowerCamelCase			=[0] * size
								elif arr is not None:
												self.init(UpperCAmelCase_							)
								else:
												raise ValueError("""Either arr or size must be specified"""							)


				def _snake_case    (						self				,	UpperCAmelCase_							):
								lowerCamelCase			=len(UpperCAmelCase_							)
								lowerCamelCase			=deepcopy(UpperCAmelCase_							)
								for i in range(1				,	self.size							):
												lowerCamelCase			=self.next_(UpperCAmelCase_							)
												if j < self.size:
																self.tree[j] += self.tree[i]


				def _snake_case    (						self							):
								lowerCamelCase			=self.tree[:]
								for i in range(self.size - 1				,	0				,	-1							):
												lowerCamelCase			=self.next_(UpperCAmelCase_							)
												if j < self.size:
																arr[j] -= arr[i]
								return arr


				@staticmethod
				def _snake_case    (						UpperCAmelCase_							):
								return index + (index & (-index))


				@staticmethod
				def _snake_case    (						UpperCAmelCase_							):
								return index - (index & (-index))


				def _snake_case    (						self				,	UpperCAmelCase_				,	UpperCAmelCase_							):
								if index == 0:
												self.tree[0] += value
												return
								while index < self.size:
												self.tree[index] += value
												lowerCamelCase			=self.next_(UpperCAmelCase_							)


				def _snake_case    (						self				,	UpperCAmelCase_				,	UpperCAmelCase_							):
								self.add(UpperCAmelCase_				,	value - self.get(UpperCAmelCase_							)							)


				def _snake_case    (						self				,	UpperCAmelCase_							):
								if right == 0:
												return 0
								lowerCamelCase			=self.tree[0]
								right -= 1  # make right inclusive
								while right > 0:
												result += self.tree[right]
												lowerCamelCase			=self.prev(UpperCAmelCase_							)
								return result


				def _snake_case    (						self				,	UpperCAmelCase_				,	UpperCAmelCase_							):
								return self.prefix(UpperCAmelCase_							) - self.prefix(UpperCAmelCase_							)


				def _snake_case    (						self				,	UpperCAmelCase_							):
								return self.query(UpperCAmelCase_				,	index + 1							)


				def _snake_case    (						self				,	UpperCAmelCase_							):
								value -= self.tree[0]
								if value < 0:
												return -1

								lowerCamelCase			=1  # Largest power of 2 <= size
								while j * 2 < self.size:
												j *= 2

								lowerCamelCase			=0

								while j > 0:
												if i + j < self.size and self.tree[i + j] <= value:
																value -= self.tree[i + j]
																i += j
												j //= 2
								return i


if __name__ == "__main__":
							import doctest

							doctest.testmod()












import qiskit





def        _lowercase   (  _UpperCAmelCase     , _UpperCAmelCase			)  ->					qiskit.result.counts.Counts:
				lowerCamelCase			=qiskit.Aer.get_backend("""aer_simulator"""			)

				# Create a Quantum Circuit acting on the q register
				lowerCamelCase			=qiskit.QuantumCircuit(_UpperCAmelCase     , _UpperCAmelCase			)

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

				# Execute the circuit on the simulator
				lowerCamelCase			=qiskit.execute(_UpperCAmelCase     , _UpperCAmelCase     , shots=10_00			)

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


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





