



'''simple docstring'''

import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from .tokenization_lxmert import LxmertTokenizer


__lowerCAmelCase									=   {'''vocab_file''': '''vocab.txt''', '''tokenizer_file''': '''tokenizer.json'''}

__lowerCAmelCase									=   {
    '''vocab_file''': {
        '''unc-nlp/lxmert-base-uncased''': '''https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/vocab.txt''',
    },
    '''tokenizer_file''': {
        '''unc-nlp/lxmert-base-uncased''': (
            '''https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/tokenizer.json'''
        ),
    },
}

__lowerCAmelCase									=   {
    '''unc-nlp/lxmert-base-uncased''': 512,
}

__lowerCAmelCase									=   {
    '''unc-nlp/lxmert-base-uncased''': {'''do_lower_case''': True},
}

class 	__magic_name__						(    _UpperCamelCase   ):
							lowerCAmelCase       :    Optional[Any]   				=					VOCAB_FILES_NAMES
							lowerCAmelCase       :    Union[str, Any]   				=					PRETRAINED_VOCAB_FILES_MAP
							lowerCAmelCase       :    List[Any]   				=					PRETRAINED_INIT_CONFIGURATION
							lowerCAmelCase       :    Any   				=					PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
							lowerCAmelCase       :    Any   				=					LxmertTokenizer







							def __init__(							self					:       Tuple	,_UpperCAmelCase					:       List[Any]=None	,_UpperCAmelCase					:       Optional[Any]=None	,_UpperCAmelCase					:       List[Any]=True	,_UpperCAmelCase					:       Union[str, Any]="[UNK]"	,_UpperCAmelCase					:       Any="[SEP]"	,_UpperCAmelCase					:       Optional[Any]="[PAD]"	,_UpperCAmelCase					:       Tuple="[CLS]"	,_UpperCAmelCase					:       List[Any]="[MASK]"	,_UpperCAmelCase					:       str=True	,_UpperCAmelCase					:       str=None	,**_UpperCAmelCase					:       Tuple	,):
									super().__init__(
									    _UpperCAmelCase	,tokenizer_file=_UpperCAmelCase	,do_lower_case=_UpperCAmelCase	,unk_token=_UpperCAmelCase	,sep_token=_UpperCAmelCase	,pad_token=_UpperCAmelCase	,cls_token=_UpperCAmelCase	,mask_token=_UpperCAmelCase	,tokenize_chinese_chars=_UpperCAmelCase	,strip_accents=_UpperCAmelCase	,**_UpperCAmelCase	,)

									_a     :      Optional[Any]        =							json.loads(self.backend_tokenizer.normalizer.__getstate__()		)
									if (
									    normalizer_state.get('lowercase'	,_UpperCAmelCase		) != do_lower_case
									    or normalizer_state.get('strip_accents'	,_UpperCAmelCase		) != strip_accents
									    or normalizer_state.get('handle_chinese_chars'	,_UpperCAmelCase		) != tokenize_chinese_chars
									):
											_a     :      Optional[Any]        =							getattr(_UpperCAmelCase	,normalizer_state.pop('type'		)		)
											_a     :      Tuple        =							do_lower_case
											_a     :      Union[str, Any]        =							strip_accents
											_a     :      Union[str, Any]        =							tokenize_chinese_chars
											_a     :      Dict        =							normalizer_class(**_UpperCAmelCase		)

									_a     :      Tuple        =							do_lower_case







							def 							__lowercase			(							self					:       Any	,_UpperCAmelCase					:       Optional[int]	,_UpperCAmelCase					:       Union[str, Any]=None		):
									_a     :      List[Any]        =							[self.cls_token_id] + token_ids_a + [self.sep_token_id]

									if token_ids_a:
											output += token_ids_a + [self.sep_token_id]

									return output







							def 							__lowercase			(							self					:       Union[str, Any]	,_UpperCAmelCase					:       List[int]	,_UpperCAmelCase					:       Optional[List[int]] = None		):
									_a     :      List[str]        =							[self.sep_token_id]
									_a     :      List[Any]        =							[self.cls_token_id]
									if token_ids_a is None:
											return len(cls + token_ids_a + sep		) * [0]
									return len(cls + token_ids_a + sep		) * [0] + len(token_ids_a + sep		) * [1]







							def 							__lowercase			(							self					:       List[str]	,_UpperCAmelCase					:       str	,_UpperCAmelCase					:       Optional[str] = None		):
									_a     :      List[Any]        =							self._tokenizer.model.save(_UpperCAmelCase	,name=_UpperCAmelCase		)
									return tuple(_UpperCAmelCase		)









'''simple docstring'''




from math import pow



def 	a			( lowerCamelCase__						,      lowerCamelCase__						,      lowerCamelCase__						,      lowerCamelCase__						,      lowerCamelCase__						,      ):
			'''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_	:						Optional[int]	=     int(pow(lowerCamelCase__						,      lowerCamelCase__    )    )
			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_	:						int	=     backtrack(
						    lowerCamelCase__						,      lowerCamelCase__						,      current_number + 1						,      lowerCamelCase__						,      lowerCamelCase__    )
						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_	:						int	=     backtrack(
						    lowerCamelCase__						,      lowerCamelCase__						,      current_number + 1						,      lowerCamelCase__						,      lowerCamelCase__    )
			return current_sum, solutions_count



def 	a			( lowerCamelCase__						,      lowerCamelCase__    ):
			'''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(lowerCamelCase__						,      lowerCamelCase__						,      1						,      0						,      0    )[1]  # Return the solutions_count


if __name__ == "__main__":
						import doctest

						doctest.testmod()