

'''simple docstring'''



import math







def    a__       (  a__ = 1_00						):




     """simple docstring"""


     __SCREAMING_SNAKE_CASE     =      sum(i * i for i in range(1      ,    n + 1						)						)
     __SCREAMING_SNAKE_CASE     =      int(math.pow(sum(range(1      ,    n + 1						)						)      ,    2						)						)
     return square_of_sum - sum_of_squares


if __name__ == "__main__":
  print(f"""{solution() = }""")









'''simple docstring'''



def    a__       (  a__      ,    a__						):




     """simple docstring"""


     _enforce_args(a__      ,    a__						)
     if n == 0:
          return 0
     __SCREAMING_SNAKE_CASE     =      float("""-inf"""						)
     for i in range(1      ,    n + 1						):
          __SCREAMING_SNAKE_CASE     =      max(
              a__      ,    prices[i - 1] + naive_cut_rod_recursive(n - i      ,    a__						)						)

     return max_revue







def    a__       (  a__      ,    a__						):




     """simple docstring"""


     _enforce_args(a__      ,    a__						)
     __SCREAMING_SNAKE_CASE     =      [float("""-inf"""						) for _ in range(n + 1						)]
     return _top_down_cut_rod_recursive(a__      ,    a__      ,    a__						)







def    a__       (  a__      ,    a__      ,    a__						):




     """simple docstring"""


     if max_rev[n] >= 0:
          return max_rev[n]
     elif n == 0:
          return 0
     else:
          __SCREAMING_SNAKE_CASE     =      float("""-inf"""						)
          for i in range(1      ,    n + 1						):
               __SCREAMING_SNAKE_CASE     =      max(
                   a__      ,    prices[i - 1] + _top_down_cut_rod_recursive(n - i      ,    a__      ,    a__						)      ,    )

          __SCREAMING_SNAKE_CASE     =      max_revenue

     return max_rev[n]







def    a__       (  a__      ,    a__						):




     """simple docstring"""


     _enforce_args(a__      ,    a__						)

     # length(max_rev) = n + 1, to accommodate for the revenue obtainable from a rod of
     # length 0.
     __SCREAMING_SNAKE_CASE     =      [float("""-inf"""						) for _ in range(n + 1						)]
     __SCREAMING_SNAKE_CASE     =      0

     for i in range(1      ,    n + 1						):
          __SCREAMING_SNAKE_CASE     =      max_rev[i]
          for j in range(1      ,    i + 1						):
               __SCREAMING_SNAKE_CASE     =      max(a__      ,    prices[j - 1] + max_rev[i - j]						)

          __SCREAMING_SNAKE_CASE     =      max_revenue_i

     return max_rev[n]







def    a__       (  a__      ,    a__						):




     """simple docstring"""


     if n < 0:
          __SCREAMING_SNAKE_CASE     =      F'n must be greater than or equal to 0. Got n = {n}'
          raise ValueError(a__						)

     if n > len(a__						):
          __SCREAMING_SNAKE_CASE     =      (
              """Each integral piece of rod must have a corresponding price. """
              F'Got n = {n} but length of prices = {len(a__						)}'
          )
          raise ValueError(a__						)







def    a__       (  ):




     """simple docstring"""


     __SCREAMING_SNAKE_CASE     =      [6, 10, 12, 15, 20, 23]
     __SCREAMING_SNAKE_CASE     =      len(a__						)

     # the best revenue comes from cutting the rod into 6 pieces, each
     # of length 1 resulting in a revenue of 6 * 6 = 36.
     __SCREAMING_SNAKE_CASE     =      36

     __SCREAMING_SNAKE_CASE     =      top_down_cut_rod(a__      ,    a__						)
     __SCREAMING_SNAKE_CASE     =      bottom_up_cut_rod(a__      ,    a__						)
     __SCREAMING_SNAKE_CASE     =      naive_cut_rod_recursive(a__      ,    a__						)

     assert expected_max_revenue == max_rev_top_down
     assert max_rev_top_down == max_rev_bottom_up
     assert max_rev_bottom_up == max_rev_naive


if __name__ == "__main__":
  main()






