



'''simple docstring'''





import functools
import operator

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


_lowerCAmelCase      						=	logging.get_logger(__name__)

_lowerCAmelCase      						=	{
    '''facebook/wav2vec2-base-960h''': '''https://huggingface.co/facebook/wav2vec2-base-960h/resolve/main/config.json''',
    # See all Wav2Vec2 models at https://huggingface.co/models?filter=wav2vec2
}






class        lowerCAmelCase_(				SCREAMING_SNAKE_CASE_     ):
  '''simple docstring'''




  __lowercase							:      List[str]				=      '''wav2vec2'''




  def __init__(    self  ,__UpperCAmelCase=32  ,__UpperCAmelCase=768  ,__UpperCAmelCase=12  ,__UpperCAmelCase=12  ,__UpperCAmelCase=3072  ,__UpperCAmelCase="gelu"  ,__UpperCAmelCase=0.1  ,__UpperCAmelCase=0.1  ,__UpperCAmelCase=0.1  ,__UpperCAmelCase=0.0  ,__UpperCAmelCase=0.0  ,__UpperCAmelCase=0.1  ,__UpperCAmelCase=0.1  ,__UpperCAmelCase=0.0_2  ,__UpperCAmelCase=1E-5  ,__UpperCAmelCase="group"  ,__UpperCAmelCase="gelu"  ,__UpperCAmelCase=(512, 512, 512, 512, 512, 512, 512)  ,__UpperCAmelCase=(5, 2, 2, 2, 2, 2, 2)  ,__UpperCAmelCase=(10, 3, 3, 3, 3, 2, 2)  ,__UpperCAmelCase=False  ,__UpperCAmelCase=128  ,__UpperCAmelCase=16  ,__UpperCAmelCase=False  ,__UpperCAmelCase=True  ,__UpperCAmelCase=0.0_5  ,__UpperCAmelCase=10  ,__UpperCAmelCase=2  ,__UpperCAmelCase=0.0  ,__UpperCAmelCase=10  ,__UpperCAmelCase=0  ,__UpperCAmelCase=320  ,__UpperCAmelCase=2  ,__UpperCAmelCase=0.1  ,__UpperCAmelCase=100  ,__UpperCAmelCase=256  ,__UpperCAmelCase=256  ,__UpperCAmelCase=0.1  ,__UpperCAmelCase="sum"  ,__UpperCAmelCase=False  ,__UpperCAmelCase=False  ,__UpperCAmelCase=256  ,__UpperCAmelCase=(512, 512, 512, 512, 1500)  ,__UpperCAmelCase=(5, 3, 3, 1, 1)  ,__UpperCAmelCase=(1, 2, 3, 1, 1)  ,__UpperCAmelCase=512  ,__UpperCAmelCase=0  ,__UpperCAmelCase=1  ,__UpperCAmelCase=2  ,__UpperCAmelCase=False  ,__UpperCAmelCase=3  ,__UpperCAmelCase=2  ,__UpperCAmelCase=3  ,__UpperCAmelCase=None  ,__UpperCAmelCase=None  ,**__UpperCAmelCase  ,)    ->		Any:
      super().__init__(**__UpperCAmelCase  ,pad_token_id=__UpperCAmelCase  ,bos_token_id=__UpperCAmelCase  ,eos_token_id=__UpperCAmelCase      )
      lowerCAmelCase__ :  Tuple							      =					hidden_size
      lowerCAmelCase__ :  Union[str, Any]							      =					feat_extract_norm
      lowerCAmelCase__ :  int							      =					feat_extract_activation
      lowerCAmelCase__ :  Union[str, Any]							      =					list(__UpperCAmelCase      )
      lowerCAmelCase__ :  Union[str, Any]							      =					list(__UpperCAmelCase      )
      lowerCAmelCase__ :  Union[str, Any]							      =					list(__UpperCAmelCase      )
      lowerCAmelCase__ :  Union[str, Any]							      =					conv_bias
      lowerCAmelCase__ :  int							      =					num_conv_pos_embeddings
      lowerCAmelCase__ :  List[Any]							      =					num_conv_pos_embedding_groups
      lowerCAmelCase__ :  Dict							      =					len(self.conv_dim      )
      lowerCAmelCase__ :  Optional[int]							      =					num_hidden_layers
      lowerCAmelCase__ :  Union[str, Any]							      =					intermediate_size
      lowerCAmelCase__ :  List[str]							      =					hidden_act
      lowerCAmelCase__ :  Optional[int]							      =					num_attention_heads
      lowerCAmelCase__ :  Dict							      =					hidden_dropout
      lowerCAmelCase__ :  Dict							      =					attention_dropout
      lowerCAmelCase__ :  Optional[Any]							      =					activation_dropout
      lowerCAmelCase__ :  Union[str, Any]							      =					feat_proj_dropout
      lowerCAmelCase__ :  str							      =					final_dropout
      lowerCAmelCase__ :  Union[str, Any]							      =					layerdrop
      lowerCAmelCase__ :  List[Any]							      =					layer_norm_eps
      lowerCAmelCase__ :  Optional[Any]							      =					initializer_range
      lowerCAmelCase__ :  int							      =					vocab_size
      lowerCAmelCase__ :  Dict							      =					do_stable_layer_norm
      lowerCAmelCase__ :  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
      lowerCAmelCase__ :  List[str]							      =					apply_spec_augment
      lowerCAmelCase__ :  Tuple							      =					mask_time_prob
      lowerCAmelCase__ :  Optional[Any]							      =					mask_time_length
      lowerCAmelCase__ :  str							      =					mask_time_min_masks
      lowerCAmelCase__ :  str							      =					mask_feature_prob
      lowerCAmelCase__ :  Union[str, Any]							      =					mask_feature_length
      lowerCAmelCase__ :  List[Any]							      =					mask_feature_min_masks

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

      # ctc loss
      lowerCAmelCase__ :  int							      =					ctc_loss_reduction
      lowerCAmelCase__ :  List[str]							      =					ctc_zero_infinity

      # adapter
      lowerCAmelCase__ :  List[Any]							      =					add_adapter
      lowerCAmelCase__ :  Any							      =					adapter_kernel_size
      lowerCAmelCase__ :  List[Any]							      =					adapter_stride
      lowerCAmelCase__ :  List[str]							      =					num_adapter_layers
      lowerCAmelCase__ :  Any							      =					output_hidden_size or hidden_size
      lowerCAmelCase__ :  Union[str, Any]							      =					adapter_attn_dim

      # SequenceClassification-specific parameter. Feel free to ignore for other classes.
      lowerCAmelCase__ :  List[str]							      =					classifier_proj_size

      # XVector-specific parameters. Feel free to ignore for other classes.
      lowerCAmelCase__ :  int							      =					list(__UpperCAmelCase      )
      lowerCAmelCase__ :  str							      =					list(__UpperCAmelCase      )
      lowerCAmelCase__ :  str							      =					list(__UpperCAmelCase      )
      lowerCAmelCase__ :  List[Any]							      =					xvector_output_dim






  @property
  def 							UpperCAmelCase_	(    self      )    ->		Any:
      return functools.reduce(operator.mul  ,self.conv_stride  ,1      )






def 				__lowerCamelCase						( UpperCAmelCase_						:		list ,  UpperCAmelCase_						:		list ,  UpperCAmelCase_						:		int						):




      """simple docstring"""





      if len(UpperCAmelCase_						) != len(UpperCAmelCase_						):
            raise ValueError('''The length of profit and weight must be same.'''						)
      if max_weight <= 0:
            raise ValueError('''max_weight must greater than zero.'''						)
      if any(p < 0 for p in profit						):
            raise ValueError('''Profit can not be negative.'''						)
      if any(w < 0 for w in weight						):
            raise ValueError('''Weight can not be negative.'''						)

      # List created to store profit gained for the 1kg in case of each weight
      # respectively.  Calculate and append profit/weight for each element.
      a						:Optional[int] 							=       [p / w for p, w in zip(UpperCAmelCase_ ,  UpperCAmelCase_						)]

      # Creating a copy of the list and sorting profit/weight in ascending order
      a						:List[Any] 							=       sorted(UpperCAmelCase_						)

      # declaring useful variables
      a						:Dict 							=       len(UpperCAmelCase_						)
      a						:Tuple 							=       0
      a						:List[Any] 							=       0
      a						:str 							=       0

      # loop till the total weight do not reach max limit e.g. 15 kg and till i<length
      while limit <= max_weight and i < length:
            # flag value for encountered greatest element in sorted_profit_by_weight
            a						:List[Any] 							=       sorted_profit_by_weight[length - i - 1]
            a						:Optional[Any] 							=       profit_by_weight.index(UpperCAmelCase_						)
            a						:Optional[int] 							=       -1

            # check if the weight encountered is less than the total weight
            # encountered before.
            if max_weight - limit >= weight[index]:
                  limit += weight[index]
                  # Adding profit gained for the given weight 1 ===
                  # weight[index]/weight[index]
                  gain += 1 * profit[index]
            else:
                  # Since the weight encountered is greater than limit, therefore take the
                  # required number of remaining kgs and calculate profit for it.
                  # weight remaining / weight[index]
                  gain += (max_weight - limit) / weight[index] * profit[index]
                  break
            i += 1
      return gain


if __name__ == "__main__":
     print(
         '''Input profits, weights, and then max_weight (all positive ints) separated by '''
         '''spaces.'''
     )

     snake_case				:    Union[str, Any]       				=     [int(x) for x in input('''Input profits separated by spaces: ''').split()]
     snake_case				:    Tuple       				=     [int(x) for x in input('''Input weights separated by spaces: ''').split()]
     snake_case				:    str       				=     int(input('''Max weight allowed: '''))

     # Function Call
     calc_profit(profit, weight, max_weight)





