



def        a						(      _UpperCAmelCase							:					int						):







		'''simple docstring'''





		__UpperCAmelCase    :     List[str]													=	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        a						(      _UpperCAmelCase							:					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'''						)

		__UpperCAmelCase    :     list[list[int]]													=	[]
		for current_row_idx in range(_UpperCAmelCase						):
				__UpperCAmelCase    :     str													=	populate_current_row(_UpperCAmelCase ,   _UpperCAmelCase						)
				triangle.append(_UpperCAmelCase						)
		return triangle

def        a						(      _UpperCAmelCase							:					list[list[int]] ,   _UpperCAmelCase							:					int						):







		'''simple docstring'''





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

def        a						(      _UpperCAmelCase							:					list[list[int]] ,   _UpperCAmelCase							:					list[int] ,   _UpperCAmelCase							:					int ,   _UpperCAmelCase							:					int ,   ):







		'''simple docstring'''





		__UpperCAmelCase    :     Any													=	triangle[current_row_idx - 1][current_col_idx - 1]
		__UpperCAmelCase    :     List[Any]													=	triangle[current_row_idx - 1][current_col_idx]
		__UpperCAmelCase    :     Union[str, Any]													=	above_to_left_elt + above_to_right_elt

def        a						(      _UpperCAmelCase							:					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'''						)

		__UpperCAmelCase    :     list[list[int]]													=	[[1]]

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

		return result

def        a						(      ):







		'''simple docstring'''





		from collections.abc import Callable
		from timeit import timeit

		def benchmark_a_function(_UpperCAmelCase							:					Callable ,   _UpperCAmelCase							:					int						) -> None:
				__UpperCAmelCase    :     Optional[int]													=	f'{func.__name__}({value})'
				__UpperCAmelCase    :     str													=	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()






def       _snake_case	(   lowerCAmelCase							:   int   , lowerCAmelCase							:   int	):
		"""simple docstring"""







		while b:
				SCREAMING_SNAKE_CASE_      ,    SCREAMING_SNAKE_CASE_  :		int				      =    b, a % b
		return a




def       _snake_case	(   lowerCAmelCase							:   int   , lowerCAmelCase							:   int	):
		"""simple docstring"""







		return a if b == 0 else euclidean_gcd_recursive(lowerCAmelCase   , a % b	)




def       _snake_case	(   ):
		"""simple docstring"""







		print(f'euclidean_gcd(3, 5) = {euclidean_gcd(3   , 5	)}'	)
		print(f'euclidean_gcd(5, 3) = {euclidean_gcd(5   , 3	)}'	)
		print(f'euclidean_gcd(1, 3) = {euclidean_gcd(1   , 3	)}'	)
		print(f'euclidean_gcd(3, 6) = {euclidean_gcd(3   , 6	)}'	)
		print(f'euclidean_gcd(6, 3) = {euclidean_gcd(6   , 3	)}'	)

		print(f'euclidean_gcd_recursive(3, 5) = {euclidean_gcd_recursive(3   , 5	)}'	)
		print(f'euclidean_gcd_recursive(5, 3) = {euclidean_gcd_recursive(5   , 3	)}'	)
		print(f'euclidean_gcd_recursive(1, 3) = {euclidean_gcd_recursive(1   , 3	)}'	)
		print(f'euclidean_gcd_recursive(3, 6) = {euclidean_gcd_recursive(3   , 6	)}'	)
		print(f'euclidean_gcd_recursive(6, 3) = {euclidean_gcd_recursive(6   , 3	)}'	)


if __name__ == "__main__":
		main()
