





def   lowerCAmelCase_				( __a	):







  """simple docstring"""





  lowerCamelCase__:   Dict    						=generate_pascal_triangle(__a	)
  for row_idx in range(__a	):
    # 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_				( __a	):







  """simple docstring"""





  if not isinstance(__a			,					__a	):
    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__:   List[Any]    						=[]
  for current_row_idx in range(__a	):
    lowerCamelCase__:   List[str]    						=populate_current_row(__a			,					__a	)
    triangle.append(__a	)
  return triangle





def   lowerCAmelCase_				( __a			,					__a	):







  """simple docstring"""





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





def   lowerCAmelCase_				( __a			,					__a			,					__a			,					__a			,					):







  """simple docstring"""





  lowerCamelCase__:   List[Any]    						=triangle[current_row_idx - 1][current_col_idx - 1]
  lowerCamelCase__:   int    						=triangle[current_row_idx - 1][current_col_idx]
  lowerCamelCase__:   Tuple    						=above_to_left_elt + above_to_right_elt





def   lowerCAmelCase_				( __a	):







  """simple docstring"""





  if not isinstance(__a			,					__a	):
    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__:   Optional[Any]    						=[[1]]

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

  return result





def   lowerCAmelCase_				( ):







  """simple docstring"""





  from collections.abc import Callable
  from timeit import timeit

  def benchmark_a_function(__a			,					__a	) -> None:
    lowerCamelCase__:   str    						=F"""{func.__name__}({value})"""
    lowerCamelCase__:   List[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(__a			,					__a	)
    print()


if __name__ == "__main__":
     import doctest

     doctest.testmod()
     benchmark()








# Lint as: python3
import dataclasses
import re
from dataclasses import dataclass
from functools import total_ordering
from typing import Optional, Union


__A             =       re.compile(R"^(?P<major>\d+)" R"\.(?P<minor>\d+)" R"\.(?P<patch>\d+)$")



@total_ordering
@dataclass
class      _SCREAMING_SNAKE_CASE		:







 '''simple docstring'''
 lowercase_	=    42
 lowercase_	=    None
 lowercase_	=    None
 lowercase_	=    None
 lowercase_	=    None

 def 							SCREAMING_SNAKE_CASE_      (self       :     List[Any]) ->Tuple:



   '''simple docstring'''



   lowerCamelCase__						,      lowerCamelCase__						,      lowerCamelCase__:   List[str]    						=_str_to_version_tuple(self.version_str)

 def __repr__(self       :     Union[str, Any]) ->Union[str, Any]:



   '''simple docstring'''



   return F"""{self.tuple[0]}.{self.tuple[1]}.{self.tuple[2]}"""

 @property
 def 							SCREAMING_SNAKE_CASE_      (self       :     Optional[Any]) ->Optional[Any]:



   '''simple docstring'''



   return self.major, self.minor, self.patch

 def 							SCREAMING_SNAKE_CASE_      (self       :     Dict ,				UpperCAmelCase_       :     Tuple) ->Any:



   '''simple docstring'''



   if isinstance(UpperCAmelCase_ ,				UpperCAmelCase_):
     return Version(UpperCAmelCase_)
   elif isinstance(UpperCAmelCase_ ,				UpperCAmelCase_):
     return other
   raise TypeError(F"""{other} (type {type(UpperCAmelCase_)}) cannot be compared to version.""")

 def __eq__(self       :     Optional[Any] ,				UpperCAmelCase_       :     Tuple) ->List[str]:



   '''simple docstring'''



   try:
     lowerCamelCase__:   List[Any]    						=self._validate_operand(UpperCAmelCase_)
   except (TypeError, ValueError):
     return False
   else:
     return self.tuple == other.tuple

 def __lt__(self       :     Dict ,				UpperCAmelCase_       :     List[str]) ->Union[str, Any]:



   '''simple docstring'''



   lowerCamelCase__:   Tuple    						=self._validate_operand(UpperCAmelCase_)
   return self.tuple < other.tuple

 def __hash__(self       :     Any) ->Dict:



   '''simple docstring'''



   return hash(_version_tuple_to_str(self.tuple))

 @classmethod
 def 							SCREAMING_SNAKE_CASE_      (cls       :     Union[str, Any] ,				UpperCAmelCase_       :     Optional[Any]) ->Union[str, Any]:



   '''simple docstring'''



   lowerCamelCase__:   str    						={f.name for f in dataclasses.fields(cls)}
   return cls(**{k: v for k, v in dic.items() if k in field_names})







 def 							SCREAMING_SNAKE_CASE_      (self       :     Optional[int]) ->str:



   '''simple docstring'''



   return self.version_str





def   lowerCAmelCase_				( __a	)  ->	List[Any]:







  """simple docstring"""





  lowerCamelCase__:   Optional[int]    						=_VERSION_REG.match(__a	)
  if not res:
    raise ValueError(F"""Invalid version '{version_str}'. Format should be x.y.z with {{x,y,z}} being digits."""	)
  return tuple(int(__a	) for v in [res.group("major"	), res.group("minor"	), res.group("patch"	)]	)






def   lowerCAmelCase_				( __a	)  ->	Dict:







  """simple docstring"""





  return ".".join(str(__a	) for v in version_tuple	)

