'''simple docstring'''

import copy
from dataclasses import dataclass, field
from typing import ClassVar, Dict

from ..features import ClassLabel, Features, Value
from .base import TaskTemplate



@dataclass(frozen=a__					)
class 			UpperCAmelCase  (						a__					):





       '''simple docstring'''



       SCREAMING_SNAKE_CASE							=    field(default="text-classification"    ,						metadata={"include_in_asdict_even_if_is_default": True}					)
       SCREAMING_SNAKE_CASE							=    Features({"text": Value("string"					)}					)
       SCREAMING_SNAKE_CASE							=    Features({"labels": ClassLabel}					)
       SCREAMING_SNAKE_CASE							=    "text"
       SCREAMING_SNAKE_CASE							=    "labels"

       def _lowerCAmelCase(						self	,   __lowerCAmelCase )  ->  Tuple:
        if self.label_column not in features:
         raise ValueError(F"""Column {self.label_column} is not present in features.""" )
        if not isinstance(features[self.label_column]	,   __lowerCAmelCase ):
         raise ValueError(F"""Column {self.label_column} is not a ClassLabel.""" )
        lowercase__				:    Tuple  =					copy.deepcopy(self )
        lowercase__				:    Any  =					self.label_schema.copy()
        lowercase__				:    int  =					features[self.label_column]
        lowercase__				:    Optional[int]  =					label_schema
        return task_template


       @property
       def _lowerCAmelCase(						self )  ->  Dict[str, str]:
        return {
            self.text_column: "text",
            self.label_column: "labels",
        }


'''simple docstring'''

from math import pow
def 			__UpperCamelCase       (   UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase		,     ):
 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

 lowercase__				:    Optional[Any]  =					int(pow(UpperCAmelCase		,     UpperCAmelCase     )     )
 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
  lowercase__ ,							lowercase__				:    Dict  =					backtrack(
      UpperCAmelCase		,     UpperCAmelCase		,     current_number + 1		,     UpperCAmelCase		,     UpperCAmelCase     )
  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.
  lowercase__ ,							lowercase__				:    str  =					backtrack(
      UpperCAmelCase		,     UpperCAmelCase		,     current_number + 1		,     UpperCAmelCase		,     UpperCAmelCase     )
 return current_sum, solutions_count
def 			__UpperCamelCase       (   UpperCAmelCase		,     UpperCAmelCase     ):
 if not (1 <= needed_sum <= 1000 and 2 <= power <= 10):
  raise ValueError(
      '''Invalid input\n'''
      '''needed_sum must be between 1 and 1000, power between 2 and 10.'''     )

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


if __name__ == "__main__":
  import doctest

  doctest.testmod()

