"""simple docstring"""


def 			__UpperCAmelCase    (	lowercase						):







  """simple docstring"""
  if not isinstance(lowercase      ,lowercase						):
    raise ValueError("""check_bouncy() accepts only integer arguments"""						)
  _UpperCAmelCase         =					str(lowercase						)
  _UpperCAmelCase         =					"""""".join(sorted(lowercase						)						)
  return sorted_str_n != str_n and sorted_str_n[::-1] != str_n






def 			__UpperCAmelCase    (	lowercase = 99						):







  """simple docstring"""
  if not 0 < percent < 1_00:
    raise ValueError("""solution() only accepts values from 0 to 100"""						)
  _UpperCAmelCase         =					0
  _UpperCAmelCase         =					1

  while True:
    if check_bouncy(lowercase						):
      bouncy_num += 1
    if (bouncy_num / num) * 1_00 >= percent:
      return num
    num += 1


if __name__ == "__main__":
    from doctest import testmod

    testmod()
    print(F'''{solution(9_9)}''')

"""simple docstring"""


from math import pow






def 			__UpperCAmelCase    (	lowercase      ,lowercase      ,lowercase      ,lowercase      ,lowercase      ,):







  """simple docstring"""
  if current_sum == needed_sum:
    # If the sum of the powers is equal to needed_sum, then we have a solution.
    solutions_count += 1
    return current_sum, solutions_count

  _UpperCAmelCase         =					int(pow(lowercase      ,lowercase						)						)
  if current_sum + i_to_n <= needed_sum:
    # If the sum of the powers is less than needed_sum, then continue adding powers.
    current_sum += i_to_n
    _UpperCAmelCase       , _UpperCAmelCase         =					backtrack(
        lowercase      ,lowercase      ,current_number + 1      ,lowercase      ,lowercase						)
    current_sum -= i_to_n
  if i_to_n < needed_sum:
    # If the power of i is less than needed_sum, then try with the next power.
    _UpperCAmelCase       , _UpperCAmelCase         =					backtrack(
        lowercase      ,lowercase      ,current_number + 1      ,lowercase      ,lowercase						)
  return current_sum, solutions_count






def 			__UpperCAmelCase    (	lowercase      ,lowercase						):







  """simple docstring"""
  if not (1 <= needed_sum <= 10_00 and 2 <= power <= 10):
    raise ValueError(
        """Invalid input\n"""
        """needed_sum must be between 1 and 1000, power between 2 and 10."""						)

  return backtrack(lowercase      ,lowercase      ,1      ,0      ,0						)[1]  # Return the solutions_count


if __name__ == "__main__":
    import doctest

    doctest.testmod()
