


'''simple docstring'''







def 			lowercase				(_A   ,						_A					):







       """simple docstring"""







       _enforce_args(_A   ,						_A					)
       if n == 0:
              return 0
       _lowerCAmelCase    :							int   			=       float('-inf'					)
       for i in range(1   ,						n + 1					):
              _lowerCAmelCase    :							Optional[Any]   			=       max(
                  _A   ,						prices[i - 1] + naive_cut_rod_recursive(n - i   ,						_A					)					)

       return max_revue






def 			lowercase				(_A   ,						_A					):







       """simple docstring"""







       _enforce_args(_A   ,						_A					)
       _lowerCAmelCase    :							int   			=       [float('-inf'					) for _ in range(n + 1					)]
       return _top_down_cut_rod_recursive(_A   ,						_A   ,						_A					)






def 			lowercase				(_A   ,						_A   ,						_A					):







       """simple docstring"""







       if max_rev[n] >= 0:
              return max_rev[n]
       elif n == 0:
              return 0
       else:
              _lowerCAmelCase    :							Union[str, Any]   			=       float('-inf'					)
              for i in range(1   ,						n + 1					):
                     _lowerCAmelCase    :							Any   			=       max(
                         _A   ,						prices[i - 1] + _top_down_cut_rod_recursive(n - i   ,						_A   ,						_A					)   ,						)

              _lowerCAmelCase    :							Optional[Any]   			=       max_revenue

       return max_rev[n]






def 			lowercase				(_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.
       _lowerCAmelCase    :							Union[str, Any]   			=       [float('-inf'					) for _ in range(n + 1					)]
       _lowerCAmelCase    :							Optional[Any]   			=       0

       for i in range(1   ,						n + 1					):
              _lowerCAmelCase    :							int   			=       max_rev[i]
              for j in range(1   ,						i + 1					):
                     _lowerCAmelCase    :							Tuple   			=       max(_A   ,						prices[j - 1] + max_rev[i - j]					)

              _lowerCAmelCase    :							Union[str, Any]   			=       max_revenue_i

       return max_rev[n]






def 			lowercase				(_A   ,						_A					):







       """simple docstring"""







       if n < 0:
              _lowerCAmelCase    :							Any   			=       f'n must be greater than or equal to 0. Got n = {n}'
              raise ValueError(_A					)

       if n > len(_A					):
              _lowerCAmelCase    :							Any   			=       (
                  'Each integral piece of rod must have a corresponding price. '
                  f'Got n = {n} but length of prices = {len(_A					)}'
              )
              raise ValueError(_A					)






def 			lowercase				():







       """simple docstring"""







       _lowerCAmelCase    :							Optional[Any]   			=       [6, 1_0, 1_2, 1_5, 2_0, 2_3]
       _lowerCAmelCase    :							List[Any]   			=       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.
       _lowerCAmelCase    :							int   			=       3_6

       _lowerCAmelCase    :							Union[str, Any]   			=       top_down_cut_rod(_A   ,						_A					)
       _lowerCAmelCase    :							Any   			=       bottom_up_cut_rod(_A   ,						_A					)
       _lowerCAmelCase    :							Optional[Any]   			=       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()





'''simple docstring'''







from typing import Any






def 			lowercase				(_A					):







       """simple docstring"""







       if not input_list:
              return []
       _lowerCAmelCase    :							Optional[int]   			=       [input_list.count(_A					) for value in input_list]
       _lowerCAmelCase    :							int   			=       max(_A					)  # Gets the maximum count in the input list.
       # Gets values of modes
       return sorted({input_list[i] for i, value in enumerate(_A					) if value == y}					)


if __name__ == "__main__":
       import doctest

       doctest.testmod()

