





"""simple docstring"""





from typing import Callable, Optional, Union

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


lowerCAmelCase__   	=	logging.get_logger(__name__)

lowerCAmelCase__   	=	{
    '''microsoft/xprophetnet-large-wiki100-cased''': (
        '''https://huggingface.co/microsoft/xprophetnet-large-wiki100-cased/resolve/main/config.json'''
    ),
}





class 				_lowerCamelCase					(				lowercase__       ):
						UpperCAmelCase_       =	"""xlm-prophetnet"""
						UpperCAmelCase_       =	["""past_key_values"""]
						UpperCAmelCase_       =	{
						    """num_attention_heads""": """num_encoder_attention_heads""",
						}


						def __init__(self      ,							__a = 0.1      ,							__a = "gelu"      ,							__a = 3_05_22      ,							__a = 10_24      ,							__a = 40_96      ,							__a = 12      ,							__a = 16      ,							__a = 40_96      ,							__a = 12      ,							__a = 16      ,							__a = 0.1      ,							__a = 0.1      ,							__a = 5_12      ,							__a = 0.02      ,							__a = True      ,							__a = True      ,							__a = 0      ,							__a = 2      ,							__a = 32      ,							__a = 1_28      ,							__a = False      ,							__a = 0.0      ,							__a = True      ,							__a = 0      ,							__a = 1      ,							__a = 2      ,							**__a      ,							)       ->      Any:
								UpperCamelCase      =		vocab_size
								UpperCamelCase      =		hidden_size
								UpperCamelCase      =		encoder_ffn_dim
								UpperCamelCase      =		num_encoder_layers
								UpperCamelCase      =		num_encoder_attention_heads
								UpperCamelCase      =		decoder_ffn_dim
								UpperCamelCase      =		num_decoder_layers
								UpperCamelCase      =		num_decoder_attention_heads
								UpperCamelCase      =		max_position_embeddings
								UpperCamelCase      =		init_std  # Normal(0, this parameter)
								UpperCamelCase      =		activation_function

								# parameters for xlmprophetnet
								UpperCamelCase      =		ngram
								UpperCamelCase      =		num_buckets
								UpperCamelCase      =		relative_max_distance
								UpperCamelCase      =		disable_ngram_loss
								UpperCamelCase      =		eps

								# 3 Types of Dropout
								UpperCamelCase      =		attention_dropout
								UpperCamelCase      =		activation_dropout
								UpperCamelCase      =		dropout

								UpperCamelCase      =		use_cache

								super().__init__(
								    pad_token_id=lowercase_      ,							bos_token_id=lowercase_      ,							eos_token_id=lowercase_      ,							is_encoder_decoder=lowercase_      ,							add_cross_attention=lowercase_      ,							decoder_start_token_id=lowercase_      ,							**lowercase_      ,							)


						@property
						def 			snake_case_      (self						)       ->      int:
								return self.num_encoder_layers + self.num_decoder_layers




						@num_hidden_layers.setter
						def 			snake_case_      (self      ,							__a						)       ->      List[str]:
								raise NotImplementedError(
								    "This model does not support the setting of `num_hidden_layers`. Please set `num_encoder_layers` and"
								    " `num_decoder_layers`."						)








"""simple docstring"""





def 	__a     (		__lowerCamelCase = 3,		__lowerCamelCase = 7,		__lowerCamelCase = 100_0000  ):
   UpperCAmelCase_					:					Dict			     =    0
   UpperCAmelCase_					:					List[Any]			     =    1

   for current_denominator in range(1,		limit + 1  ):
      UpperCAmelCase_					:					Dict			     =    current_denominator * numerator // denominator
      if current_denominator % denominator == 0:
         current_numerator -= 1
      if current_numerator * max_denominator > current_denominator * max_numerator:
         UpperCAmelCase_					:					List[Any]			     =    current_numerator
         UpperCAmelCase_					:					Optional[int]			     =    current_denominator
   return max_numerator


if __name__ == "__main__":
    print(solution(numerator=3, denominator=7, limit=1_000_000))


