





"""simple docstring"""



from math import pow







def 						__lowercase	(  snake_case_    :    int							,snake_case_    :    int							,snake_case_    :    int							,snake_case_    :    int							,snake_case_    :    int							,)  ->tuple[int, int]:



    '''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

    __A       :		str							=	int(pow(snake_case_							,snake_case_		)		)
    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
        __A					,			__A       :		Optional[int]							=	backtrack(
            snake_case_							,snake_case_							,current_number + 1							,snake_case_							,snake_case_		)
        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.
        __A					,			__A       :		Optional[int]							=	backtrack(
            snake_case_							,snake_case_							,current_number + 1							,snake_case_							,snake_case_		)
    return current_sum, solutions_count







def 						__lowercase	(  snake_case_    :    int							,snake_case_    :    int		)  ->int:



    '''simple docstring'''







    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(snake_case_							,snake_case_							,1							,0							,0		)[1]  # Return the solutions_count


if __name__ == "__main__":
       import doctest

       doctest.testmod()











"""simple docstring"""



from collections import OrderedDict
from typing import Mapping

from packaging import version

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


a_					=     logging.get_logger(__name__)

a_					=     {
    """sail/poolformer_s12""": """https://huggingface.co/sail/poolformer_s12/resolve/main/config.json""",
    # See all PoolFormer models at https://huggingface.co/models?filter=poolformer
}






class 						__snake_case   (						SCREAMING_SNAKE_CASE__	):





 """simple docstring"""


 _lowerCamelCase								=	"""poolformer"""

 def __init__(       self   ,		__lowerCamelCase=3   ,		__lowerCamelCase=16   ,		__lowerCamelCase=16   ,		__lowerCamelCase=3   ,		__lowerCamelCase=4.0   ,		__lowerCamelCase=[2, 2, 6, 2]   ,		__lowerCamelCase=[64, 128, 320, 512]   ,		__lowerCamelCase=[7, 3, 3, 3]   ,		__lowerCamelCase=[4, 2, 2, 2]   ,		__lowerCamelCase=[2, 1, 1, 1]   ,		__lowerCamelCase=4   ,		__lowerCamelCase=0.0   ,		__lowerCamelCase="gelu"   ,		__lowerCamelCase=True   ,		__lowerCamelCase=1e-5   ,		__lowerCamelCase=0.0_2   ,		**__lowerCamelCase   ,		):



     '''simple docstring'''




     __A       :		str							=	num_channels
     __A       :		List[str]							=	patch_size
     __A       :		str							=	stride
     __A       :		Any							=	padding
     __A       :		Any							=	pool_size
     __A       :		Dict							=	hidden_sizes
     __A       :		Optional[Any]							=	mlp_ratio
     __A       :		Any							=	depths
     __A       :		List[str]							=	patch_sizes
     __A       :		Union[str, Any]							=	strides
     __A       :		List[str]							=	num_encoder_blocks
     __A       :		Optional[int]							=	drop_path_rate
     __A       :		Union[str, Any]							=	hidden_act
     __A       :		Optional[Any]							=	use_layer_scale
     __A       :		List[Any]							=	layer_scale_init_value
     __A       :		List[Any]							=	initializer_range
     super().__init__(**__lowerCamelCase    )






class 						__snake_case   (						SCREAMING_SNAKE_CASE__	):





 """simple docstring"""


 _lowerCamelCase								=	version.parse("""1.11"""	)

 @property
 def    UpperCamelCase__(       self    ):



     '''simple docstring'''




     return OrderedDict(
         [
             ('''pixel_values''', {0: '''batch''', 1: '''num_channels''', 2: '''height''', 3: '''width'''}),
         ]    )







 @property
 def    UpperCamelCase__(       self    ):



     '''simple docstring'''




     return 2e-3




