






def 		SCREAMING_SNAKE_CASE							( __lowerCAmelCase      )			->     None:
     UpperCamelCase__      :       Optional[int]	    =  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 		SCREAMING_SNAKE_CASE							( __lowerCAmelCase      )			->     list[list[int]]:

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

     UpperCamelCase__      :       list[list[int]]	    =  []
     for current_row_idx in range(__lowerCAmelCase      ):
          UpperCamelCase__      :       Union[str, Any]	    =  populate_current_row(__lowerCAmelCase ,   __lowerCAmelCase      )
          triangle.append(__lowerCAmelCase      )
     return triangle







def 		SCREAMING_SNAKE_CASE							( __lowerCAmelCase ,   __lowerCAmelCase      )			->     list[int]:
     UpperCamelCase__      :       Optional[Any]	    =  [-1] * (current_row_idx + 1)
     # first and last elements of current row are equal to 1
     UpperCamelCase__    ,					UpperCamelCase__      :       int	    =  1, 1
     for current_col_idx in range(1 ,   __lowerCAmelCase      ):
          calculate_current_element(
              __lowerCAmelCase ,   __lowerCAmelCase ,   __lowerCAmelCase ,   __lowerCAmelCase      )
     return current_row







def 		SCREAMING_SNAKE_CASE							( __lowerCAmelCase ,   __lowerCAmelCase ,   __lowerCAmelCase ,   __lowerCAmelCase ,   )			->     None:
     UpperCamelCase__      :       int	    =  triangle[current_row_idx - 1][current_col_idx - 1]
     UpperCamelCase__      :       Optional[int]	    =  triangle[current_row_idx - 1][current_col_idx]
     UpperCamelCase__      :       List[Any]	    =  above_to_left_elt + above_to_right_elt







def 		SCREAMING_SNAKE_CASE							( __lowerCAmelCase      )			->     list[list[int]]:

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

     UpperCamelCase__      :       list[list[int]]	    =  [[1]]

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

     return result







def 		SCREAMING_SNAKE_CASE							( )			->     None:
     from collections.abc import Callable
     from timeit import timeit

     def benchmark_a_function(__lowerCAmelCase ,   __lowerCAmelCase      ) -> None:
          UpperCamelCase__      :       Optional[Any]	    =  f'{func.__name__}({value})'
          UpperCamelCase__      :       Dict	    =  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()







def 		SCREAMING_SNAKE_CASE							( __lowerCAmelCase ,   __lowerCAmelCase      )			->     Any:
     # "extended trapezoidal rule"
     # int(f) = dx/2 * (f1 + 2f2 + ... + fn)
     UpperCamelCase__      :       int	    =  (boundary[1] - boundary[0]) / steps
     UpperCamelCase__      :       Optional[Any]	    =  boundary[0]
     UpperCamelCase__      :       List[Any]	    =  boundary[1]
     UpperCamelCase__      :       List[Any]	    =  make_points(__lowerCAmelCase ,   __lowerCAmelCase ,   __lowerCAmelCase      )
     UpperCamelCase__      :       int	    =  0.0
     y += (h / 2.0) * f(__lowerCAmelCase      )
     for i in x_i:
          # print(i)
          y += h * f(__lowerCAmelCase      )
     y += (h / 2.0) * f(__lowerCAmelCase      )
     return y







def 		SCREAMING_SNAKE_CASE							( __lowerCAmelCase ,   __lowerCAmelCase ,   __lowerCAmelCase      )			->     List[str]:
     UpperCamelCase__      :       Optional[int]	    =  a + h
     while x < (b - h):
          yield x
          UpperCamelCase__      :       Union[str, Any]	    =  x + h







def 		SCREAMING_SNAKE_CASE							( __lowerCAmelCase      )			->     Any:  # enter your function here
     UpperCamelCase__      :       Dict	    =  (x - 0) * (x - 0)
     return y







def 		SCREAMING_SNAKE_CASE							( )			->     Dict:
     UpperCamelCase__      :       List[Any]	    =  0.0  # Lower bound of integration
     UpperCamelCase__      :       Tuple	    =  1.0  # Upper bound of integration
     UpperCamelCase__      :       Any	    =  1_0.0  # define number of steps or resolution
     UpperCamelCase__      :       List[str]	    =  [a, b]  # define boundary of integration
     UpperCamelCase__      :       Any	    =  method_a(__lowerCAmelCase ,   __lowerCAmelCase      )
     print(f'y = {y}'      )


if __name__ == "__main__":
 main()