






from collections.abc import Sequence
def      a_ (      _A      ,   _A = False  )			->			float:







				"""simple docstring"""
				if not arr:
								return 0

				snake_case__									=     0 if allow_empty_subarrays else float('-inf'  )
				snake_case__									=     0.0
				for num in arr:
								snake_case__									=     max(0 if allow_empty_subarrays else num      ,   curr_sum + num  )
								snake_case__									=     max(_A      ,   _A  )

				return max_sum


if __name__ == "__main__":
							from doctest import testmod

							testmod()

							__UpperCamelCase					:		Dict	  =						[-2, 1, -3, 4, -1, 2, 1, -5, 4]
							print(f'''{max_subarray_sum(nums) = }''')












import qiskit
def      a_ (      _A = 2  )			->			qiskit.result.counts.Counts:







				"""simple docstring"""
				snake_case__									=     qubits

				# Using Aer's simulator
				snake_case__									=     qiskit.Aer.get_backend('aer_simulator'  )

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

				# Adding a H gate on qubit 0 (now q0 in superposition)
				circuit.h(0  )

				for i in range(1      ,   _A  ):
								# Adding CX (CNOT) gate
								circuit.cx(i - 1      ,   _A  )

				# Mapping the quantum measurement to the classical bits
				circuit.measure(list(range(_A  )  )      ,   list(range(_A  )  )  )

				# Now measuring any one qubit would affect other qubits to collapse
				# their super position and have same state as the measured one.

				# Executing the circuit on the simulator
				snake_case__									=     qiskit.execute(_A      ,   _A      ,   shots=1000  )

				return job.result().get_counts(_A  )


if __name__ == "__main__":
							print(f'''Total count for various states are: {quantum_entanglement(3)}''')




