
from typing import Mapping

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxSeqaSeqConfigWithPast
from ...utils import logging


__lowerCAmelCase   :     Optional[int]      =						logging.get_logger(__name__)


class   __lowerCAmelCase		(		lowerCAmelCase_ ):



      """simple docstring"""







      A__		:     Dict       				=      '''mt5'''
      A__		:     List[Any]       				=      ['''past_key_values''']




      def __init__( self						:    Any			,    _snake_case						:    Any=25_0112			,    _snake_case						:    Tuple=512			,    _snake_case						:    List[str]=64			,    _snake_case						:    List[Any]=1024			,    _snake_case						:    Optional[Any]=8			,    _snake_case						:    List[str]=None			,    _snake_case						:    List[str]=6			,    _snake_case						:    str=32			,    _snake_case						:    Optional[int]=128			,    _snake_case						:    int=0.1			,    _snake_case						:    Union[str, Any]=1E-6			,    _snake_case						:    str=1.0			,    _snake_case						:    str="gated-gelu"			,    _snake_case						:    List[str]=True			,    _snake_case						:    List[str]=True			,    _snake_case						:    Optional[Any]="T5Tokenizer"			,    _snake_case						:    List[Any]=False			,    _snake_case						:    List[str]=0			,    _snake_case						:    Any=1			,    _snake_case						:    int=0			,    **_snake_case						:    List[str]			,    ):
          super().__init__(
              is_encoder_decoder=_snake_case			,    tokenizer_class=_snake_case			,    tie_word_embeddings=_snake_case			,    pad_token_id=_snake_case			,    eos_token_id=_snake_case			,    decoder_start_token_id=_snake_case			,    **_snake_case			,    )
          __lowercase						:     Dict		      =    vocab_size
          __lowercase						:     int		      =    d_model
          __lowercase						:     str		      =    d_kv
          __lowercase						:     Optional[Any]		      =    d_ff
          __lowercase						:     Union[str, Any]		      =    num_layers
          __lowercase						:     List[str]		      =    (
              num_decoder_layers if num_decoder_layers is not None else self.num_layers
          )  # default = symmetry
          __lowercase						:     Dict		      =    num_heads
          __lowercase						:     List[Any]		      =    relative_attention_num_buckets
          __lowercase						:     Union[str, Any]		      =    relative_attention_max_distance
          __lowercase						:     Tuple		      =    dropout_rate
          __lowercase						:     str		      =    layer_norm_epsilon
          __lowercase						:     Optional[Any]		      =    initializer_factor
          __lowercase						:     List[Any]		      =    feed_forward_proj
          __lowercase						:     Optional[Any]		      =    use_cache

          __lowercase						:     Optional[Any]		      =    self.feed_forward_proj.split('''-'''			)
          __lowercase						:     Tuple		      =    act_info[-1]
          __lowercase						:     Union[str, Any]		      =    act_info[0] == '''gated'''

          if len(_snake_case			) > 1 and act_info[0] != "gated" or len(_snake_case			) > 2:
              raise ValueError(
                  F'`feed_forward_proj`: {feed_forward_proj} is not a valid activation function of the dense layer.'
                  '''Please make sure `feed_forward_proj` is of the format `gated-{ACT_FN}` or `{ACT_FN}`, e.g. '''
                  '''\'gated-gelu\' or \'relu\''''			)

          # for backwards compatibility
          if feed_forward_proj == "gated-gelu":
              __lowercase						:     str		      =    '''gelu_new'''




      @property
      def 						snake_case_     ( self						:    str			):
          return self.d_model




      @property
      def 						snake_case_     ( self						:    str			):
          return self.num_heads




      @property
      def 						snake_case_     ( self						:    Union[str, Any]			):
          return self.num_layers






class   __lowerCAmelCase		(		lowerCAmelCase_ ):



      """simple docstring"""







      @property
      # Copied from transformers.models.t5.configuration_t5.T5OnnxConfig.inputs
      def 						snake_case_     ( self						:    Tuple			):
          __lowercase						:     Tuple		      =    {
              '''input_ids''': {0: '''batch''', 1: '''encoder_sequence'''},
              '''attention_mask''': {0: '''batch''', 1: '''encoder_sequence'''},
          }
          if self.use_past:
              __lowercase						:     Any		      =    '''past_encoder_sequence + sequence'''
              __lowercase						:     int		      =    {0: '''batch'''}
              __lowercase						:     Union[str, Any]		      =    {0: '''batch''', 1: '''past_decoder_sequence + sequence'''}
          else:
              __lowercase						:     Union[str, Any]		      =    {0: '''batch''', 1: '''decoder_sequence'''}
              __lowercase						:     Any		      =    {0: '''batch''', 1: '''decoder_sequence'''}

          if self.use_past:
              self.fill_with_past_key_values_(_snake_case			,    direction='''inputs'''			)

          return common_inputs




      @property
      # Copied from transformers.models.t5.configuration_t5.T5OnnxConfig.default_onnx_opset
      def 						snake_case_     ( self						:    List[str]			):
          return 13




      @property
      def 						snake_case_     ( self						:    List[str]			):
          return 5E-4




from __future__ import annotations

from collections import Counter


def       UpperCAmelCase_					(  __lowerCAmelCase		)	->  list[int]:
    __lowercase						:     Any		      =    [True] * n
    __lowercase						:     str		      =    False
    __lowercase						:     int		      =    False
    __lowercase						:     List[Any]		      =    True

    for i in range(3		,   int(n**0.5 + 1		)		,   2		):
        __lowercase						:     List[str]		      =    i * 2
        while index < n:
            __lowercase						:     List[Any]		      =    False
            __lowercase						:     Dict		      =    index + i

    __lowercase						:     Tuple		      =    [2]

    for i in range(3		,   __lowerCAmelCase		,   2		):
        if is_prime[i]:
            primes.append(__lowerCAmelCase		)

    return primes


def       UpperCAmelCase_					(  __lowerCAmelCase		)	->  list[list[int]]:
    __lowercase						:     Optional[int]		      =    str(__lowerCAmelCase		)
    __lowercase						:     List[str]		      =    []
    __lowercase						:     int		      =    ['''0''', '''1''', '''2''', '''3''', '''4''', '''5''', '''6''', '''7''', '''8''', '''9''']

    for duplicate in Counter(__lowerCAmelCase		) - Counter(set(__lowerCAmelCase		)		):
        __lowercase						:     Union[str, Any]		      =    [int(number_str.replace(__lowerCAmelCase		,   __lowerCAmelCase		)		) for digit in digits]
        replacements.append(__lowerCAmelCase		)

    return replacements


def       UpperCAmelCase_					(  __lowerCAmelCase = 8		)	->  int:
    __lowercase						:     Tuple		      =    set()

    # Filter primes with less than 3 replaceable digits
    __lowercase						:     int		      =    {
        x for x in set(prime_sieve(1_000_000		)		) if len(str(__lowerCAmelCase		)		) - len(set(str(__lowerCAmelCase		)		)		) >= 3
    }

    for prime in primes:
        if prime in numbers_checked:
            continue

        __lowercase						:     str		      =    digit_replacements(__lowerCAmelCase		)

        for family in replacements:
            numbers_checked.update(__lowerCAmelCase		)
            __lowercase						:     List[Any]		      =    primes.intersection(__lowerCAmelCase		)

            if len(__lowerCAmelCase		) != family_length:
                continue

            return min(__lowerCAmelCase		)

    return -1


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


