



'''simple docstring'''




import functools
import operator

from ...configuration_utils import PretrainedConfig
from ...utils import logging


lowerCamelCase							:List[Any]				    =					logging.get_logger(__name__)

lowerCamelCase							:List[Any]				    =					{
    '''microsoft/unispeech-sat-base-100h-libri-ft''': (
        '''https://huggingface.co/microsoft/unispeech-sat-base-100h-libri-ft/resolve/main/config.json'''
    ),
    # See all UniSpeechSat models at https://huggingface.co/models?filter=unispeech_sat
}







class 	_lowerCAmelCase							(			__UpperCAmelCase ):
	__SCREAMING_SNAKE_CASE   :		List[Any]					=					'unispeech-sat'


	def __init__(self       ,      lowercase=32       ,      lowercase=768       ,      lowercase=12       ,      lowercase=12       ,      lowercase=3072       ,      lowercase="gelu"       ,      lowercase=0.1       ,      lowercase=0.1       ,      lowercase=0.1       ,      lowercase=0.0       ,      lowercase=0.0       ,      lowercase=0.1       ,      lowercase=0.1       ,      lowercase=0.02       ,      lowercase=1E-5       ,      lowercase="group"       ,      lowercase="gelu"       ,      lowercase=(512, 512, 512, 512, 512, 512, 512)       ,      lowercase=(5, 2, 2, 2, 2, 2, 2)       ,      lowercase=(10, 3, 3, 3, 3, 2, 2)       ,      lowercase=False       ,      lowercase=128       ,      lowercase=16       ,      lowercase=False       ,      lowercase=True       ,      lowercase=0.05       ,      lowercase=10       ,      lowercase=2       ,      lowercase=0.0       ,      lowercase=10       ,      lowercase=0       ,      lowercase=320       ,      lowercase=2       ,      lowercase=0.1       ,      lowercase=100       ,      lowercase=256       ,      lowercase=256       ,      lowercase=0.1       ,      lowercase="mean"       ,      lowercase=False       ,      lowercase=False       ,      lowercase=256       ,      lowercase=(512, 512, 512, 512, 1500)       ,      lowercase=(5, 3, 3, 1, 1)       ,      lowercase=(1, 2, 3, 1, 1)       ,      lowercase=512       ,      lowercase=0       ,      lowercase=1       ,      lowercase=2       ,      lowercase=504       ,      **lowercase       ,      ):
				super().__init__(**lowercase       ,      pad_token_id=lowercase       ,      bos_token_id=lowercase       ,      eos_token_id=lowercase							)
				A_	:						Union[str, Any]	=     hidden_size
				A_	:						Any	=     feat_extract_norm
				A_	:						Optional[Any]	=     feat_extract_activation
				A_	:						List[Any]	=     list(lowercase							)
				A_	:						Dict	=     list(lowercase							)
				A_	:						List[str]	=     list(lowercase							)
				A_	:						str	=     conv_bias
				A_	:						Tuple	=     num_conv_pos_embeddings
				A_	:						List[Any]	=     num_conv_pos_embedding_groups
				A_	:						Optional[Any]	=     len(self.conv_dim							)
				A_	:						List[Any]	=     num_hidden_layers
				A_	:						Tuple	=     intermediate_size
				A_	:						List[Any]	=     hidden_act
				A_	:						List[str]	=     num_attention_heads
				A_	:						Any	=     hidden_dropout
				A_	:						Tuple	=     attention_dropout
				A_	:						Optional[Any]	=     activation_dropout
				A_	:						Union[str, Any]	=     feat_proj_dropout
				A_	:						Any	=     final_dropout
				A_	:						List[Any]	=     layerdrop
				A_	:						Optional[int]	=     layer_norm_eps
				A_	:						Any	=     initializer_range
				A_	:						Union[str, Any]	=     vocab_size
				A_	:						List[str]	=     num_clusters
				A_	:						Optional[Any]	=     do_stable_layer_norm
				A_	:						Optional[int]	=     use_weighted_layer_sum

				if (
				    (len(self.conv_stride							) != self.num_feat_extract_layers)
				    or (len(self.conv_kernel							) != self.num_feat_extract_layers)
				    or (len(self.conv_dim							) != self.num_feat_extract_layers)
				):
							raise ValueError(
							    """Configuration for convolutional layers is incorrect. It is required that `len(config.conv_dim)` =="""
							    """ `len(config.conv_stride)` == `len(config.conv_kernel)`, but is `len(config.conv_dim) ="""
							    F' {len(self.conv_dim							)}`, `len(config.conv_stride) = {len(self.conv_stride							)}`,'
							    F' `len(config.conv_kernel) = {len(self.conv_kernel							)}`.'							)

				# fine-tuning config parameters for SpecAugment: https://arxiv.org/abs/1904.08779
				A_	:						List[Any]	=     apply_spec_augment
				A_	:						Dict	=     mask_time_prob
				A_	:						Tuple	=     mask_time_length
				A_	:						Tuple	=     mask_time_min_masks
				A_	:						Tuple	=     mask_feature_prob
				A_	:						List[Any]	=     mask_feature_length
				A_	:						Dict	=     mask_feature_min_masks

				# parameters for pretraining with codevector quantized representations
				A_	:						Tuple	=     num_codevectors_per_group
				A_	:						Dict	=     num_codevector_groups
				A_	:						List[Any]	=     contrastive_logits_temperature
				A_	:						Any	=     feat_quantizer_dropout
				A_	:						Optional[int]	=     num_negatives
				A_	:						Optional[int]	=     codevector_dim
				A_	:						List[Any]	=     proj_codevector_dim
				A_	:						str	=     diversity_loss_weight

				# ctc loss
				A_	:						Tuple	=     ctc_loss_reduction
				A_	:						List[Any]	=     ctc_zero_infinity

				# SequenceClassification-specific parameter. Feel free to ignore for other classes.
				A_	:						str	=     classifier_proj_size

				# XVector-specific parameters. Feel free to ignore for other classes.
				A_	:						List[Any]	=     list(lowercase							)
				A_	:						Tuple	=     list(lowercase							)
				A_	:						List[Any]	=     list(lowercase							)
				A_	:						Optional[Any]	=     xvector_output_dim


	@property
	def     _a	(self							):
				return functools.reduce(operator.mul       ,      self.conv_stride       ,      1							)




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