
"""simple docstring"""






from typing import List

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


__SCREAMING_SNAKE_CASE							=     logging.get_logger(__name__)

__SCREAMING_SNAKE_CASE							=     {
    'snap-research/efficientformer-l1-300': (
        'https://huggingface.co/snap-research/efficientformer-l1-300/resolve/main/config.json'
    ),
}





class 				a__					(						A__       ):
     UpperCAmelCase__         =      '''efficientformer'''



     def __init__(							self :Dict      ,  _lowerCamelCase :List[int] = [3, 2, 6, 4]      ,  _lowerCamelCase :List[int] = [48, 96, 224, 448]      ,  _lowerCamelCase :List[bool] = [True, True, True, True]      ,  _lowerCamelCase :int = 448      ,  _lowerCamelCase :int = 32      ,  _lowerCamelCase :int = 4      ,  _lowerCamelCase :int = 7      ,  _lowerCamelCase :int = 5      ,  _lowerCamelCase :int = 8      ,  _lowerCamelCase :int = 4      ,  _lowerCamelCase :float = 0.0      ,  _lowerCamelCase :int = 16      ,  _lowerCamelCase :int = 3      ,  _lowerCamelCase :int = 3      ,  _lowerCamelCase :int = 3      ,  _lowerCamelCase :int = 2      ,  _lowerCamelCase :int = 1      ,  _lowerCamelCase :float = 0.0      ,  _lowerCamelCase :int = 1      ,  _lowerCamelCase :bool = True      ,  _lowerCamelCase :bool = True      ,  _lowerCamelCase :float = 1E-5      ,  _lowerCamelCase :str = "gelu"      ,  _lowerCamelCase :float = 0.02      ,  _lowerCamelCase :float = 1E-1_2      ,  _lowerCamelCase :int = 224      ,  _lowerCamelCase :float = 1E-0_5      ,  **_lowerCamelCase :int      ,  ):







      '''simple docstring'''



      super().__init__(**_lowerCamelCase   )

      UpperCamelCase_     :					int   	=hidden_act
      UpperCamelCase_     :					Dict   	=hidden_dropout_prob
      UpperCamelCase_     :					List[str]   	=hidden_sizes
      UpperCamelCase_     :					Tuple   	=num_hidden_layers
      UpperCamelCase_     :					Tuple   	=num_attention_heads
      UpperCamelCase_     :					List[Any]   	=initializer_range
      UpperCamelCase_     :					str   	=layer_norm_eps
      UpperCamelCase_     :					List[Any]   	=patch_size
      UpperCamelCase_     :					str   	=num_channels
      UpperCamelCase_     :					Optional[int]   	=depths
      UpperCamelCase_     :					Tuple   	=mlp_expansion_ratio
      UpperCamelCase_     :					Optional[int]   	=downsamples
      UpperCamelCase_     :					Union[str, Any]   	=dim
      UpperCamelCase_     :					List[Any]   	=key_dim
      UpperCamelCase_     :					Optional[Any]   	=attention_ratio
      UpperCamelCase_     :					int   	=resolution
      UpperCamelCase_     :					List[str]   	=pool_size
      UpperCamelCase_     :					Tuple   	=downsample_patch_size
      UpperCamelCase_     :					Optional[Any]   	=downsample_stride
      UpperCamelCase_     :					Tuple   	=downsample_pad
      UpperCamelCase_     :					Optional[Any]   	=drop_path_rate
      UpperCamelCase_     :					Tuple   	=num_metaad_blocks
      UpperCamelCase_     :					int   	=distillation
      UpperCamelCase_     :					str   	=use_layer_scale
      UpperCamelCase_     :					Optional[int]   	=layer_scale_init_value
      UpperCamelCase_     :					Any   	=image_size
      UpperCamelCase_     :					Tuple   	=batch_norm_eps


"""simple docstring"""






def       A_  (				__lowercase						,	__lowercase						,	__lowercase	):
 if len(__lowercase	) != len(__lowercase	):
  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.
 UpperCamelCase_     :					int   	=[p / w for p, w in zip(__lowercase						,	__lowercase	)]

 # Creating a copy of the list and sorting profit/weight in ascending order
 UpperCamelCase_     :					Optional[int]   	=sorted(__lowercase	)

 # declaring useful variables
 UpperCamelCase_     :					Optional[int]   	=len(__lowercase	)
 UpperCamelCase_     :					Optional[int]   	=0
 UpperCamelCase_     :					List[Any]   	=0
 UpperCamelCase_     :					Optional[int]   	=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
  UpperCamelCase_     :					List[str]   	=sorted_profit_by_weight[length - i - 1]
  UpperCamelCase_     :					Optional[Any]   	=profit_by_weight.index(__lowercase	)
  UpperCamelCase_     :					str   	=-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.'
 )

 __SCREAMING_SNAKE_CASE							=     [int(x) for x in input('Input profits separated by spaces: ').split()]
 __SCREAMING_SNAKE_CASE							=     [int(x) for x in input('Input weights separated by spaces: ').split()]
 __SCREAMING_SNAKE_CASE							=     int(input('Max weight allowed: '))

 # Function Call
 calc_profit(profit, weight, max_weight)
