

class 						__magic_name__			:

   '''simple docstring'''




   def __init__(				self,    lowercase_       )							->    List[str]:






     """simple docstring"""






     a__  =arr.split(''','''       )



   def  _UpperCAmelCase (				self       )							->    str:






     """simple docstring"""






     a__  =[int(self.array[0]       )] * len(self.array       )
     a__  =[int(self.array[0]       )] * len(self.array       )
     for i in range(1,    len(self.array       )       ):
       a__  =max(
           int(self.array[i]       ) + sum_value[i - 1],    int(self.array[i]       )       )
       a__  =max(sum_value[i],    rear[i - 1]       )
     return rear[len(self.array       ) - 1]


if __name__ == "__main__":
       lowerCamelCase           =					input('''please input some numbers:''')
       lowerCamelCase           =					SubArray(whole_array)
       lowerCamelCase           =					array.solve_sub_array()
       print(('''the results is:''', re))

'''simple docstring'''

import numpy as np
import qiskit







def      UpperCamelCase_						(					snake_case_       :       int = 8						,		snake_case_       :       int | None = None      )					->     str:






 '''simple docstring'''

 __lowerCAmelCase											=						np.random.default_rng(seed=snake_case_      )

 # Roughly 25% of the qubits will contribute to the key.
 # So we take more than we need.
 __lowerCAmelCase											=						6 * key_len
 # Measurement basis for Alice's qubits.
 __lowerCAmelCase											=						rng.integers(2						,		size=snake_case_      )
 # The set of states Alice will prepare.
 __lowerCAmelCase											=						rng.integers(2						,		size=snake_case_      )
 # Measurement basis for Bob's qubits.
 __lowerCAmelCase											=						rng.integers(2						,		size=snake_case_      )

 # Quantum Circuit to simulate BB84
 __lowerCAmelCase											=						qiskit.QuantumCircuit(snake_case_						,		name="""BB84"""      )

 # Alice prepares her qubits according to rules above.
 for index, _ in enumerate(snake_case_      ):
  if alice_state[index] == 1:
   bbaa_circ.x(snake_case_      )
  if alice_basis[index] == 1:
   bbaa_circ.h(snake_case_      )
 bbaa_circ.barrier()

 # Bob measures the received qubits according to rules above.
 for index, _ in enumerate(snake_case_      ):
  if bob_basis[index] == 1:
   bbaa_circ.h(snake_case_      )

 bbaa_circ.barrier()
 bbaa_circ.measure_all()

 # Simulate the quantum circuit.
 __lowerCAmelCase											=						qiskit.Aer.get_backend("""aer_simulator"""      )
 # We only need to run one shot because the key is unique.
 # Multiple shots will produce the same key.
 __lowerCAmelCase											=						qiskit.execute(snake_case_						,		snake_case_						,		shots=1						,		seed_simulator=snake_case_      )
 # Returns the result of measurement.
 __lowerCAmelCase											=						job.result().get_counts(snake_case_      ).most_frequent()

 # Extracting the generated key from the simulation results.
 # Only keep measurement results where Alice and Bob chose the same basis.
 __lowerCAmelCase											=						"""""".join(
     [
         result_bit
         for alice_basis_bit, bob_basis_bit, result_bit in zip(
             snake_case_						,		snake_case_						,		snake_case_      )
         if alice_basis_bit == bob_basis_bit
     ]      )

 # Get final key. Pad with 0 if too short, otherwise truncate.
 __lowerCAmelCase											=						gen_key[:key_len] if len(snake_case_      ) >= key_len else gen_key.ljust(snake_case_						,		"""0"""      )
 return key


if __name__ == "__main__":
 print(f'The generated key is : {bbaa(8, seed=0)}')
 from doctest import testmod

 testmod()






