



def 		UpperCamelCase     (       snake_case__	:   int     )     ->					None:
   UpperCamelCase   :  Optional[int]						     =     generate_pascal_triangle(snake_case__     )
   for row_idx in range(snake_case__     ):
      # 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 		UpperCamelCase     (       snake_case__	:   int     )     ->					list[list[int]]:



   if not isinstance(snake_case__	,					snake_case__     ):
      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(snake_case__     ):
      UpperCamelCase   :  Optional[Any]						     =     populate_current_row(snake_case__	,					snake_case__     )
      triangle.append(snake_case__     )
   return triangle
def 		UpperCamelCase     (       snake_case__	:   list[list[int]]	,					snake_case__	:   int     )     ->					list[int]:
   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	,					snake_case__     ):
      calculate_current_element(
          snake_case__	,					snake_case__	,					snake_case__	,					snake_case__     )
   return current_row
def 		UpperCamelCase     (       snake_case__	:   list[list[int]]	,					snake_case__	:   list[int]	,					snake_case__	:   int	,					snake_case__	:   int	,					)     ->					None:
   UpperCamelCase   :  Dict						     =     triangle[current_row_idx - 1][current_col_idx - 1]
   UpperCamelCase   :  Tuple						     =     triangle[current_row_idx - 1][current_col_idx]
   UpperCamelCase   :  Optional[Any]						     =     above_to_left_elt + above_to_right_elt
def 		UpperCamelCase     (       snake_case__	:   int     )     ->					list[list[int]]:



   if not isinstance(snake_case__	,					snake_case__     ):
      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	,					snake_case__     ):
      UpperCamelCase   :  Union[str, Any]						     =     [0] + result[-1] + [0]
      UpperCamelCase   :  Any						     =     row_index + 1
      # Calculate the number of distinct elements in a row
      UpperCamelCase   :  Tuple						     =     sum(divmod(snake_case__	,					2     )     )
      UpperCamelCase   :  Optional[Any]						     =     [
          temp_row[i - 1] + temp_row[i] for i in range(1	,					distinct_elements + 1     )
      ]
      UpperCamelCase   :  str						     =     row_first_half[: (row_index + 1) // 2]
      row_second_half.reverse()
      UpperCamelCase   :  Dict						     =     row_first_half + row_second_half
      result.append(snake_case__     )

   return result
def 		UpperCamelCase     (       )     ->					None:
   from collections.abc import Callable
   from timeit import timeit

   def benchmark_a_function(snake_case__	:   Callable	,					snake_case__	:   int     ) -> None:
      UpperCamelCase   :  int						     =     F"""{func.__name__}({value})"""
      UpperCamelCase   :  Union[str, Any]						     =     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(snake_case__	,					snake_case__     )
      print()


if __name__ == "__main__":
    import doctest

    doctest.testmod()
    benchmark()









from abc import ABC, abstractmethod
from argparse import ArgumentParser



class     lowerCAmelCase_		(  a__							):
       @staticmethod
       @abstractmethod
       def  snake_case_	(      SCREAMING_SNAKE_CASE_	)					->		int:
          raise NotImplementedError()






       @abstractmethod
       def  snake_case_	(      self	)					->		str:
          raise NotImplementedError()



