


def   _lowerCAmelCase				(   UpperCamelCase__:     int						) ->   None:





 """simple docstring"""







 A								=				generate_pascal_triangle(UpperCamelCase__						)
 for row_idx in range(UpperCamelCase__						):
  # Print left spaces
  for _ in range(num_rows - row_idx - 1						):
   print(end=""" """						)
  # Print row values
  for col_idx in range(row_idx + 1						):
   if col_idx != row_idx:
    print(triangle[row_idx][col_idx]							,					end=""" """						)
   else:
    print(triangle[row_idx][col_idx]							,					end=""""""						)
  print()





def   _lowerCAmelCase				(   UpperCamelCase__:     int						) ->   list[list[int]]:





 """simple docstring"""







 if not isinstance(UpperCamelCase__							,					UpperCamelCase__						):
  raise TypeError("""The input value of 'num_rows' should be 'int'"""						)

 if num_rows == 0:
  return []
 elif num_rows < 0:
  raise ValueError(
      """The input value of 'num_rows' should be greater than or equal to 0"""						)

 A								=				[]
 for current_row_idx in range(UpperCamelCase__						):
  A								=				populate_current_row(UpperCamelCase__							,					UpperCamelCase__						)
  triangle.append(UpperCamelCase__						)
 return triangle





def   _lowerCAmelCase				(   UpperCamelCase__:     list[list[int]]							,					UpperCamelCase__:     int						) ->   list[int]:





 """simple docstring"""







 A								=				[-1] * (current_row_idx + 1)
 # first and last elements of current row are equal to 1
 A					,			A								=				1, 1
 for current_col_idx in range(1							,					UpperCamelCase__						):
  calculate_current_element(
      UpperCamelCase__							,					UpperCamelCase__							,					UpperCamelCase__							,					UpperCamelCase__						)
 return current_row





def   _lowerCAmelCase				(   UpperCamelCase__:     list[list[int]]							,					UpperCamelCase__:     list[int]							,					UpperCamelCase__:     int							,					UpperCamelCase__:     int							,					) ->   None:





 """simple docstring"""







 A								=				triangle[current_row_idx - 1][current_col_idx - 1]
 A								=				triangle[current_row_idx - 1][current_col_idx]
 A								=				above_to_left_elt + above_to_right_elt





def   _lowerCAmelCase				(   UpperCamelCase__:     int						) ->   list[list[int]]:





 """simple docstring"""







 if not isinstance(UpperCamelCase__							,					UpperCamelCase__						):
  raise TypeError("""The input value of 'num_rows' should be 'int'"""						)

 if num_rows == 0:
  return []
 elif num_rows < 0:
  raise ValueError(
      """The input value of 'num_rows' should be greater than or equal to 0"""						)

 A								=				[[1]]

 for row_index in range(1							,					UpperCamelCase__						):
  A								=				[0] + result[-1] + [0]
  A								=				row_index + 1
  # Calculate the number of distinct elements in a row
  A								=				sum(divmod(UpperCamelCase__							,					2						)						)
  A								=				[
      temp_row[i - 1] + temp_row[i] for i in range(1							,					distinct_elements + 1						)
  ]
  A								=				row_first_half[: (row_index + 1) // 2]
  row_second_half.reverse()
  A								=				row_first_half + row_second_half
  result.append(UpperCamelCase__						)

 return result





def   _lowerCAmelCase				(   ) ->   None:





 """simple docstring"""







 from collections.abc import Callable
 from timeit import timeit

 def benchmark_a_function(UpperCamelCase__:     Callable							,					UpperCamelCase__:     int						) -> None:
  A								=				f'{func.__name__}({value})'
  A								=				timeit(f'__main__.{call}'							,					setup="""import __main__"""						)
  # print(f"{call:38} = {func(value)} -- {timing:.4f} seconds")
  print(f'{call:38} -- {timing:.4f} seconds'						)

 for value in range(15						):  # (1, 7, 14):
  for func in (generate_pascal_triangle, generate_pascal_triangle_optimized):
   benchmark_a_function(UpperCamelCase__							,					UpperCamelCase__						)
  print()


if __name__ == "__main__":
    import doctest

    doctest.testmod()
    benchmark()







import qiskit





def   _lowerCAmelCase				(   UpperCamelCase__:     int = 2						) ->   qiskit.result.counts.Counts:





	"""simple docstring"""







	A								=				qubits

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

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

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

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

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

	# 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
	A								=				qiskit.execute(UpperCamelCase__							,					UpperCamelCase__							,					shots=10_00						)

	return job.result().get_counts(UpperCamelCase__						)


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



