






def 					lowerCamelCase__					(_UpperCAmelCase):
			SCREAMING_SNAKE_CASE							=			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):

			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')

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






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






def 					lowerCamelCase__					(_UpperCAmelCase				,							_UpperCAmelCase				,							_UpperCAmelCase				,							_UpperCAmelCase				,							):
			SCREAMING_SNAKE_CASE							=			triangle[current_row_idx - 1][current_col_idx - 1]
			SCREAMING_SNAKE_CASE							=			triangle[current_row_idx - 1][current_col_idx]
			SCREAMING_SNAKE_CASE							=			above_to_left_elt + above_to_right_elt






def 					lowerCamelCase__					(_UpperCAmelCase):

			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')

			SCREAMING_SNAKE_CASE							=			[[1]]

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

			return result






def 					lowerCamelCase__					():
			from collections.abc import Callable
			from timeit import timeit

			def benchmark_a_function(_UpperCAmelCase				,							_UpperCAmelCase) -> None:
						SCREAMING_SNAKE_CASE							=			F'''{func.__name__}({value})'''
						SCREAMING_SNAKE_CASE							=			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      UpperCamelCase   (       __lowerCamelCase	:					int							,   __lowerCamelCase	:					int       ):
       snake_case			:  int     							= qiskit.Aer.get_backend("aer_simulator"       )

       # Create a Quantum Circuit acting on the q register
       snake_case			:  Dict     							= qiskit.QuantumCircuit(__lowerCamelCase							,   __lowerCamelCase       )

       # 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
       snake_case			:  Dict     							= qiskit.execute(__lowerCamelCase							,   __lowerCamelCase							,   shots=1000       )

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


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





