


def 	__lowerCamelCase						(							lowerCamelCase__		:						int      ):





			'''simple docstring'''




			lowerCamelCase    		=  generate_pascal_triangle(lowerCamelCase__      )
			for row_idx in range(lowerCamelCase__      ):
						# 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						(							lowerCamelCase__		:						int      ):





			'''simple docstring'''




			if not isinstance(lowerCamelCase__  ,							lowerCamelCase__      ):
						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"""      )

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






def 	__lowerCamelCase						(							lowerCamelCase__		:						list[list[int]]  ,							lowerCamelCase__		:						int      ):





			'''simple docstring'''




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






def 	__lowerCamelCase						(							lowerCamelCase__		:						list[list[int]]  ,							lowerCamelCase__		:						list[int]  ,							lowerCamelCase__		:						int  ,							lowerCamelCase__		:						int  ,							):





			'''simple docstring'''




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






def 	__lowerCamelCase						(							lowerCamelCase__		:						int      ):





			'''simple docstring'''




			if not isinstance(lowerCamelCase__  ,							lowerCamelCase__      ):
						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"""      )

			lowerCamelCase    		=  [[1]]

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

			return result






def 	__lowerCamelCase						(							):





			'''simple docstring'''




			from collections.abc import Callable
			from timeit import timeit

			def benchmark_a_function(lowerCamelCase__		:						Callable  ,							lowerCamelCase__		:						int      ) -> None:
						lowerCamelCase    		=  f'{func.__name__}({value})'
						lowerCamelCase    		=  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(lowerCamelCase__  ,							lowerCamelCase__      )
						print()


if __name__ == "__main__":
		import doctest

		doctest.testmod()
		benchmark()





# Lint as: python3
import itertools
import os
import re


UpperCAmelCase   :    Any     =		re.compile(r"([A-Z]+)([A-Z][a-z])")
UpperCAmelCase   :    Optional[Any]     =		re.compile(r"([a-z\d])([A-Z])")

UpperCAmelCase   :    Optional[Any]     =		re.compile(r"(?<!_)_(?!_)")
UpperCAmelCase   :    Any     =		re.compile(r"(_{2,})")

UpperCAmelCase   :    List[Any]     =		r"^\w+(\.\w+)*$"

UpperCAmelCase   :    Any     =		r"<>:/\|?*"






def 	__lowerCamelCase						(							lowerCamelCase__		:						Tuple      ):





			'''simple docstring'''




			lowerCamelCase    		=  _uppercase_uppercase_re.sub(R"""\1_\2"""  ,							lowerCamelCase__      )
			lowerCamelCase    		=  _lowercase_uppercase_re.sub(R"""\1_\2"""  ,							lowerCamelCase__      )
			return name.lower()






def 	__lowerCamelCase						(							lowerCamelCase__		:						List[str]      ):





			'''simple docstring'''




			lowerCamelCase    		=  _single_underscore_re.split(lowerCamelCase__      )
			lowerCamelCase    		=  [_multiple_underscores_re.split(lowerCamelCase__      ) for n in name]
			return "".join(n.capitalize() for n in itertools.chain.from_iterable(lowerCamelCase__      ) if n != """"""      )






def 	__lowerCamelCase						(							lowerCamelCase__		:						Any      ):





			'''simple docstring'''




			if os.path.basename(lowerCamelCase__      ) != name:
						raise ValueError(f'Should be a dataset name, not a path: {name}'      )
			return camelcase_to_snakecase(lowerCamelCase__      )






def 	__lowerCamelCase						(							lowerCamelCase__		:						List[str]  ,							lowerCamelCase__		:						int      ):





			'''simple docstring'''




			if os.path.basename(lowerCamelCase__      ) != name:
						raise ValueError(f'Should be a dataset name, not a path: {name}'      )
			if not re.match(_split_re  ,							lowerCamelCase__      ):
						raise ValueError(f'Split name should match \'{_split_re}\'\' but got \'{split}\'.'      )
			return f'{filename_prefix_for_name(lowerCamelCase__      )}-{split}'






def 	__lowerCamelCase						(							lowerCamelCase__		:						List[Any]  ,							lowerCamelCase__		:						Optional[Any]  ,							lowerCamelCase__		:						List[Any]  ,							lowerCamelCase__		:						int=None      ):





			'''simple docstring'''




			lowerCamelCase    		=  filename_prefix_for_split(lowerCamelCase__  ,							lowerCamelCase__      )
			if filetype_suffix:
						prefix += f'.{filetype_suffix}'
			lowerCamelCase    		=  os.path.join(lowerCamelCase__  ,							lowerCamelCase__      )
			return f'{filepath}*'






def 	__lowerCamelCase						(							lowerCamelCase__		:						Dict  ,							lowerCamelCase__		:						List[Any]  ,							lowerCamelCase__		:						List[Any]  ,							lowerCamelCase__		:						int=None  ,							lowerCamelCase__		:						str=None      ):





			'''simple docstring'''




			lowerCamelCase    		=  filename_prefix_for_split(lowerCamelCase__  ,							lowerCamelCase__      )
			lowerCamelCase    		=  os.path.join(lowerCamelCase__  ,							lowerCamelCase__      )

			if shard_lengths:
						lowerCamelCase    		=  len(lowerCamelCase__      )
						lowerCamelCase    		=  [f'{prefix}-{shard_id:05d}-of-{num_shards:05d}' for shard_id in range(lowerCamelCase__      )]
						if filetype_suffix:
									lowerCamelCase    		=  [filename + f'.{filetype_suffix}' for filename in filenames]
						return filenames
			else:
						lowerCamelCase    		=  prefix
						if filetype_suffix:
									filename += f'.{filetype_suffix}'
						return [filename]

