


"""simple docstring"""


import qiskit






def      a__ (				__lowercase     ,			__lowercase   )	->	qiskit.result.counts.Counts:
				_A					  =			qiskit.Aer.get_backend("aer_simulator"   )

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

				# 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
				_A					  =			qiskit.execute(__lowercase     ,			__lowercase     ,			shots=1000   )

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


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



"""simple docstring"""


class snake_case      :







		def __init__(					self      :       Optional[int]    ,   a__      :       List[Any]    ,   a__      :       List[str]    ,   a__      :       Tuple		)       ->						Optional[Any]:





						'''simple docstring'''







						_A					  =			None
						_A					  =			None
						_A					  =			graph

						self._normalize_graph(a__    ,   a__		)
						_A					  =			len(a__		)
						_A					  =			None







		def  a_ (					self      :       str    ,   a__      :       List[str]    ,   a__      :       List[Any]		)       ->						Dict:





						'''simple docstring'''







						if sources is int:
										_A					  =			[sources]
						if sinks is int:
										_A					  =			[sinks]

						if len(a__		) == 0 or len(a__		) == 0:
										return

						_A					  =			sources[0]
						_A					  =			sinks[0]

						# make fake vertex if there are more
						# than one source or sink
						if len(a__		) > 1 or len(a__		) > 1:
										_A					  =			0
										for i in sources:
														max_input_flow += sum(self.graph[i]		)

										_A					  =			len(self.graph		) + 1
										for room in self.graph:
														room.insert(0    ,   0		)
										self.graph.insert(0    ,   [0] * size		)
										for i in sources:
														_A					  =			max_input_flow
										_A					  =			0

										_A					  =			len(self.graph		) + 1
										for room in self.graph:
														room.append(0		)
										self.graph.append([0] * size		)
										for i in sinks:
														_A					  =			max_input_flow
										_A					  =			size - 1







		def  a_ (					self      :       Optional[int]		)       ->						List[Any]:





						'''simple docstring'''







						if self.maximum_flow_algorithm is None:
										raise Exception("You need to set maximum flow algorithm before."		)
						if self.source_index is None or self.sink_index is None:
										return 0

						self.maximum_flow_algorithm.execute()
						return self.maximum_flow_algorithm.getMaximumFlow()







		def  a_ (					self      :       List[Any]    ,   a__      :       Optional[Any]		)       ->						str:





						'''simple docstring'''







						_A					  =			algorithm(self		)





class snake_case      :







		def __init__(					self      :       List[str]    ,   a__      :       List[str]		)       ->						Union[str, Any]:





						'''simple docstring'''







						_A					  =			flow_network
						_A					  =			flow_network.verticesCount
						_A					  =			flow_network.sourceIndex
						_A					  =			flow_network.sinkIndex
						# it's just a reference, so you shouldn't change
						# it in your algorithms, use deep copy before doing that
						_A					  =			flow_network.graph
						_A					  =			False







		def  a_ (					self      :       Optional[Any]		)       ->						List[Any]:





						'''simple docstring'''







						if not self.executed:
										self._algorithm()
										_A					  =			True







		def  a_ (					self      :       Any		)       ->						int:





						'''simple docstring'''







						pass





class snake_case      (  _UpperCamelCase):







		def __init__(					self      :       Optional[Any]    ,   a__      :       Dict		)       ->						List[str]:





						'''simple docstring'''







						super().__init__(a__		)
						# use this to save your result
						_A					  =			-1







		def  a_ (					self      :       Any		)       ->						List[str]:





						'''simple docstring'''







						if not self.executed:
										raise Exception("You should execute algorithm before using its result!"		)

						return self.maximum_flow





class snake_case      (  _UpperCamelCase):







		def __init__(					self      :       Union[str, Any]    ,   a__      :       Union[str, Any]		)       ->						Dict:





						'''simple docstring'''







						super().__init__(a__		)

						_A					  =			[[0] * self.verticies_count for i in range(self.verticies_count		)]

						_A					  =			[0] * self.verticies_count
						_A					  =			[0] * self.verticies_count







		def  a_ (					self      :       Any		)       ->						Dict:





						'''simple docstring'''







						_A					  =			self.verticies_count

						# push some substance to graph
						for nextvertex_index, bandwidth in enumerate(self.graph[self.source_index]		):
										self.preflow[self.source_index][nextvertex_index] += bandwidth
										self.preflow[nextvertex_index][self.source_index] -= bandwidth
										self.excesses[nextvertex_index] += bandwidth

						# Relabel-to-front selection rule
						_A					  =			[
						    i
						    for i in range(self.verticies_count		)
						    if i != self.source_index and i != self.sink_index
						]

						# move through list
						_A					  =			0
						while i < len(a__		):
										_A					  =			vertices_list[i]
										_A					  =			self.heights[vertex_index]
										self.process_vertex(a__		)
										if self.heights[vertex_index] > previous_height:
														# if it was relabeled, swap elements
														# and start from 0 index
														vertices_list.insert(0    ,   vertices_list.pop(a__		)		)
														_A					  =			0
										else:
														i += 1

						_A					  =			sum(self.preflow[self.source_index]		)







		def  a_ (					self      :       Dict    ,   a__      :       Any		)       ->						Optional[int]:





						'''simple docstring'''







						while self.excesses[vertex_index] > 0:
										for neighbour_index in range(self.verticies_count		):
														# if it's neighbour and current vertex is higher
														if (
														    self.graph[vertex_index][neighbour_index]
														    - self.preflow[vertex_index][neighbour_index]
														    > 0
														    and self.heights[vertex_index] > self.heights[neighbour_index]
														):
																		self.push(a__    ,   a__		)

										self.relabel(a__		)







		def  a_ (					self      :       str    ,   a__      :       Optional[int]    ,   a__      :       List[Any]		)       ->						Optional[int]:





						'''simple docstring'''







						_A					  =			min(
						    self.excesses[from_index]    ,   self.graph[from_index][to_index] - self.preflow[from_index][to_index]    ,   )
						self.preflow[from_index][to_index] += preflow_delta
						self.preflow[to_index][from_index] -= preflow_delta
						self.excesses[from_index] -= preflow_delta
						self.excesses[to_index] += preflow_delta







		def  a_ (					self      :       Any    ,   a__      :       Dict		)       ->						Any:





						'''simple docstring'''







						_A					  =			None
						for to_index in range(self.verticies_count		):
										if (
										    self.graph[vertex_index][to_index]
										    - self.preflow[vertex_index][to_index]
										    > 0
										) and (min_height is None or self.heights[to_index] < min_height):
														_A					  =			self.heights[to_index]

						if min_height is not None:
										_A					  =			min_height + 1


if __name__ == "__main__":
		a_       							=    [0]
		a_       							=    [3]
		# graph = [
		#     [0, 0, 4, 6, 0, 0],
		#     [0, 0, 5, 2, 0, 0],
		#     [0, 0, 0, 0, 4, 4],
		#     [0, 0, 0, 0, 6, 6],
		#     [0, 0, 0, 0, 0, 0],
		#     [0, 0, 0, 0, 0, 0],
		# ]
		a_       							=    [[0, 7, 0, 0], [0, 0, 6, 0], [0, 0, 0, 8], [9, 0, 0, 0]]

		# prepare our network
		a_       							=    FlowNetwork(graph, entrances, exits)
		# set algorithm
		flow_network.set_maximum_flow_algorithm(PushRelabelExecutor)
		# and calculate
		a_       							=    flow_network.find_maximum_flow()

		print(f'''maximum flow is {maximum_flow}''')