

'''simple docstring'''




def    lowerCamelCase__		(    SCREAMING_SNAKE_CASE   : int    ):
  if upper_limit < 0:
    raise ValueError('Limit for the Catalan sequence must be ≥ 0'    )

  UpperCAmelCase    				=						[0] * (upper_limit + 1)

  # Base case: C(0) = C(1) = 1
  UpperCAmelCase    				=						1
  if upper_limit > 0:
    UpperCAmelCase    				=						1

  # Recurrence relation: C(i) = sum(C(j).C(i-j-1)), from j = 0 to i
  for i in range(2							, upper_limit + 1    ):
    for j in range(SCREAMING_SNAKE_CASE    ):
      catalan_list[i] += catalan_list[j] * catalan_list[i - j - 1]

  return catalan_list


if __name__ == "__main__":
  print('\n********* Catalan Numbers Using Dynamic Programming ************\n')
  print('\n*** Enter -1 at any time to quit ***')
  print('\nEnter the upper limit (≥ 0) for the Catalan number sequence: ', end='')
  try:
    while True:
      _a					:			Any							=    int(input().strip())
      if N < 0:
        print('\n********* Goodbye!! ************')
        break
      else:
        print(F'''The Catalan numbers from 0 through {N} are:''')
        print(catalan_numbers(N))
        print('Try another upper limit for the sequence: ', end='')
  except (NameError, ValueError):
    print('\n********* Invalid input, goodbye! ************\n')

  import doctest

  doctest.testmod()





'''simple docstring'''




import qiskit


def    lowerCamelCase__		(    SCREAMING_SNAKE_CASE   : int							, SCREAMING_SNAKE_CASE   : int    ):
  UpperCAmelCase    				=						qiskit.Aer.get_backend('aer_simulator'    )

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

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

  # Execute the circuit on the simulator
  UpperCAmelCase    				=						qiskit.execute(SCREAMING_SNAKE_CASE							, SCREAMING_SNAKE_CASE							, shots=1000    )

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


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


