from collections import OrderedDict
from typing import Any, Mapping, Optional

from ... import PreTrainedTokenizer, TensorType, is_torch_available
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfigWithPast
from ...utils import logging


lowerCamelCase       :	Dict									=     logging.get_logger(__name__)

lowerCamelCase       :	Union[str, Any]									=     {
    "EleutherAI/gpt-neo-1.3B": "https://huggingface.co/EleutherAI/gpt-neo-1.3B/resolve/main/config.json",
    # See all GPTNeo models at https://huggingface.co/models?filter=gpt_neo
}







class 						A(		UpperCamelCase     ):



 '''simple docstring'''


 UpperCamelCase		     =		'''gpt_neo'''
 UpperCamelCase		     =		['''past_key_values''']
 UpperCamelCase		     =		{'''num_attention_heads''': '''num_heads''', '''num_hidden_layers''': '''num_layers'''}

 def __init__(       self      :						Optional[Any]		,							A_      :						List[str]=50257		,							A_      :						List[str]=2048		,							A_      :						Dict=2048		,							A_      :						str=24		,							A_      :						Tuple=[[["global", "local"], 12]]		,							A_      :						List[str]=16		,							A_      :						Tuple=None		,							A_      :						str=256		,							A_      :						int="gelu_new"		,							A_      :						List[Any]=0.0		,							A_      :						int=0.0		,							A_      :						Union[str, Any]=0.0		,							A_      :						int=0.1		,							A_      :						Optional[int]=1E-5		,							A_      :						List[Any]=0.02		,							A_      :						Any=True		,							A_      :						Tuple=50256		,							A_      :						Optional[Any]=50256		,							**A_      :						Dict		,							)     ->			Union[str, Any]:

       """simple docstring"""






       lowerCamelCase_	  =					vocab_size
       lowerCamelCase_	  =					max_position_embeddings
       lowerCamelCase_	  =					hidden_size
       lowerCamelCase_	  =					num_layers
       lowerCamelCase_	  =					num_heads
       lowerCamelCase_	  =					intermediate_size
       lowerCamelCase_	  =					window_size
       lowerCamelCase_	  =					activation_function
       lowerCamelCase_	  =					resid_dropout
       lowerCamelCase_	  =					embed_dropout
       lowerCamelCase_	  =					attention_dropout
       lowerCamelCase_	  =					classifier_dropout
       lowerCamelCase_	  =					layer_norm_epsilon
       lowerCamelCase_	  =					initializer_range
       lowerCamelCase_	  =					use_cache

       lowerCamelCase_	  =					bos_token_id
       lowerCamelCase_	  =					eos_token_id

       lowerCamelCase_	  =					attention_types
       lowerCamelCase_	  =					self.expand_attention_types_params(A_						)

       if len(self.attention_layers						) != self.num_layers:
             raise ValueError(
                 'Configuration for convolutional module is incorrect. '
                 'It is required that `len(config.attention_layers)` == `config.num_layers` '
                 f"""but is `len(config.attention_layers) = {len(self.attention_layers						)}`, """
                 f"""`config.num_layers = {self.num_layers}`. """
                 '`config.attention_layers` is prepared using `config.attention_types`. '
                 'Please verify the value of `config.attention_types` argument.'						)

       super().__init__(bos_token_id=A_		,							eos_token_id=A_		,							**A_						)





 @staticmethod
 def        a__				(       A_      :						int						)     ->			List[Any]:

       """simple docstring"""






       lowerCamelCase_	  =					[]
       for item in attention_types:
             for _ in range(item[1]						):
                   attentions.extend(item[0]						)
       return attentions

def     _SCREAMING_SNAKE_CASE    (							lowercase			: Any			,							lowercase			: Any			,							lowercase			: Dict			,							lowercase			: Union[str, Any]  ):


      '''simple docstring'''



      import torch

      lowerCamelCase_	  =					input.size()
      lowerCamelCase_	  =					len(lowercase  )
      lowerCamelCase_	  =					shape[dimension]

      lowerCamelCase_	  =					torch.arange(0			,							lowercase			,							lowercase  )
      lowerCamelCase_	  =					torch.div(sizedim - size			,							lowercase			,							rounding_mode='floor'  ) + 1
      lowerCamelCase_	  =					torch.arange(lowercase  ) + low_indices[:min_length][:, None]

      lowerCamelCase_	  =					[slice(lowercase  )] * rank
      lowerCamelCase_	  =					indices
      lowerCamelCase_	  =					input[s]

      lowerCamelCase_	  =					list(range(0			,							rank + 1  )  )
      perm.append(perm.pop(dimension + 1  )  )

      return sliced.permute(lowercase  )

def     _SCREAMING_SNAKE_CASE    (							lowercase			: List[str]			,							lowercase			: Dict  ):


      '''simple docstring'''



      import torch

      lowerCamelCase_	  =					torch.arange(1			,							lowercase  )
      lowerCamelCase_	  =					torch.remainder(lowercase			,							lowercase  )
      lowerCamelCase_	  =					remainders == 0
      lowerCamelCase_	  =					candidates[divisor_indices]
      lowerCamelCase_	  =					torch.max(lowercase  )
      return largest_divisor, torch.div(lowercase			,							lowercase			,							rounding_mode='floor'  )







class 						A(		UpperCamelCase     ):



 '''simple docstring'''


 @property
 def        a__				(       self      :						Any						)     ->			Mapping[str, Mapping[int, str]]:

       """simple docstring"""






       lowerCamelCase_	  =					OrderedDict({'input_ids': {0: 'batch', 1: 'sequence'}}						)
       if self.use_past:
             self.fill_with_past_key_values_(A_		,							direction='inputs'						)
             lowerCamelCase_	  =					{0: 'batch', 1: 'past_sequence + sequence'}
       else:
             lowerCamelCase_	  =					{0: 'batch', 1: 'sequence'}

       return common_inputs

 @property
 def        a__				(       self      :						int						)     ->			int:

       """simple docstring"""






       return self._config.num_heads

 def        a__				(       self      :						str		,							A_      :						PreTrainedTokenizer		,							A_      :						int = -1		,							A_      :						int = -1		,							A_      :						bool = False		,							A_      :						Optional[TensorType] = None		,							)     ->			Mapping[str, Any]:

       """simple docstring"""






       lowerCamelCase_	  =					super(A_		,							self						).generate_dummy_inputs(
           A_		,							batch_size=A_		,							seq_length=A_		,							is_pair=A_		,							framework=A_						)

       # We need to order the input in the way they appears in the forward()
       lowerCamelCase_	  =					OrderedDict({'input_ids': common_inputs['input_ids']}						)

       # Need to add the past_keys
       if self.use_past:
             if not is_torch_available():
                   raise ValueError('Cannot generate dummy past_keys inputs without PyTorch installed.'						)
             else:
                   import torch

                   lowerCamelCase_  ,       lowerCamelCase_	  =					common_inputs['input_ids'].shape
                   # Not using the same length for past_key_values
                   lowerCamelCase_	  =					seqlen + 2
                   lowerCamelCase_	  =					(
                       batch,
                       self.num_attention_heads,
                       past_key_values_length,
                       self._config.hidden_size // self.num_attention_heads,
                   )
                   lowerCamelCase_	  =					[
                       (torch.zeros(A_						), torch.zeros(A_						)) for _ in range(self.num_layers						)
                   ]

       lowerCamelCase_	  =					common_inputs['attention_mask']
       if self.use_past:
             lowerCamelCase_	  =					ordered_inputs['attention_mask'].dtype
             lowerCamelCase_	  =					torch.cat(
                 [ordered_inputs['attention_mask'], torch.ones(A_		,							A_		,							dtype=A_						)]		,							dim=1						)

       return ordered_inputs





 @property
 def        a__				(       self      :						Optional[int]						)     ->			int:

       """simple docstring"""






       return 13









from __future__ import annotations

from fractions import Fraction

def     _SCREAMING_SNAKE_CASE    (							lowercase			: int			,							lowercase			: int  ):


      '''simple docstring'''



      return (
          num != den and num % 10 == den // 10 and (num // 10) / (den % 10) == num / den
      )

def     _SCREAMING_SNAKE_CASE    (							lowercase			: int  ):


      '''simple docstring'''



      lowerCamelCase_	  =					[]
      lowerCamelCase_	  =					11
      lowerCamelCase_	  =					int('1' + '0' * digit_len  )
      for num in range(lowercase			,							lowercase  ):
            while den <= 99:
                  if (num != den) and (num % 10 == den // 10) and (den % 10 != 0):
                        if is_digit_cancelling(lowercase			,							lowercase  ):
                              solutions.append(f"""{num}/{den}"""  )
                  den += 1
            num += 1
            lowerCamelCase_	  =					10
      return solutions

def     _SCREAMING_SNAKE_CASE    (							lowercase			: int = 2  ):


      '''simple docstring'''



      lowerCamelCase_	  =					1.0
      for fraction in fraction_list(lowercase  ):
            lowerCamelCase_	  =					Fraction(lowercase  )
            result *= frac.denominator / frac.numerator
      return int(lowercase  )


if __name__ == "__main__":
 print(solution())



