

from __future__ import annotations

from collections import Counter
def 					lowerCAmelCase  (   __UpperCamelCase ):
 '''simple docstring'''





 UpperCAmelCase__   :					Optional[int]   				=   [True] * n
 UpperCAmelCase__   :					Optional[int]   				=   False
 UpperCAmelCase__   :					str   				=   False
 UpperCAmelCase__   :					Optional[int]   				=   True

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

 UpperCAmelCase__   :					Any   				=   [2]

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

 return primes
def 					lowerCAmelCase  (   __UpperCamelCase ):
 '''simple docstring'''





 UpperCAmelCase__   :					Dict   				=   str(__UpperCamelCase )
 UpperCAmelCase__   :					Dict   				=   []
 UpperCAmelCase__   :					Any   				=   ["""0""", """1""", """2""", """3""", """4""", """5""", """6""", """7""", """8""", """9"""]

 for duplicate in Counter(__UpperCamelCase ) - Counter(set(__UpperCamelCase ) ):
  UpperCAmelCase__   :					Tuple   				=   [int(number_str.replace(__UpperCamelCase							,      __UpperCamelCase ) ) for digit in digits]
  replacements.append(__UpperCamelCase )

 return replacements
def 					lowerCAmelCase  (   __UpperCamelCase = 8 ):
 '''simple docstring'''





 UpperCAmelCase__   :					Union[str, Any]   				=   set()

 # Filter primes with less than 3 replaceable digits
 UpperCAmelCase__   :					Any   				=   {
     x for x in set(prime_sieve(1000000 ) ) if len(str(__UpperCamelCase ) ) - len(set(str(__UpperCamelCase ) ) ) >= 3
 }

 for prime in primes:
  if prime in numbers_checked:
   continue

  UpperCAmelCase__   :					Tuple   				=   digit_replacements(__UpperCamelCase )

  for family in replacements:
   numbers_checked.update(__UpperCamelCase )
   UpperCAmelCase__   :					Optional[Any]   				=   primes.intersection(__UpperCamelCase )

   if len(__UpperCamelCase ) != family_length:
    continue

   return min(__UpperCamelCase )

 return -1


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








"""simple docstring"""




import os
from shutil import copyfile
from typing import Optional, Tuple

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import is_sentencepiece_available, logging


if is_sentencepiece_available():
      from .tokenization_reformer import ReformerTokenizer
else:
      __UpperCAmelCase	=			None


__UpperCAmelCase	=			logging.get_logger(__name__)


__UpperCAmelCase	=			'▁'

__UpperCAmelCase	=			{'vocab_file': 'spiece.model', 'tokenizer_file': 'tokenizer.json'}

__UpperCAmelCase	=			{
    'vocab_file': {
        'google/reformer-crime-and-punishment': (
            'https://huggingface.co/google/reformer-crime-and-punishment/resolve/main/spiece.model'
        )
    },
    'tokenizer_file': {
        'google/reformer-crime-and-punishment': (
            'https://huggingface.co/google/reformer-crime-and-punishment/resolve/main/tokenizer.json'
        )
    },
}

__UpperCAmelCase	=			{
    'google/reformer-crime-and-punishment': 52_4288,
}







class        __lowercase     (      __lowerCamelCase   ):
  snake_case_			    =    VOCAB_FILES_NAMES
  snake_case_			    =    PRETRAINED_VOCAB_FILES_MAP
  snake_case_			    =    PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
  snake_case_			    =    ["""input_ids""", """attention_mask"""]
  snake_case_			    =    ReformerTokenizer

  def __init__(					self						:     List[Any]   ,A						:     Dict=None   ,A						:     List[str]=None   ,A						:     Union[str, Any]="</s>"   ,A						:     List[str]="<unk>"   ,A						:     Tuple=[]   ,**A						:     Optional[int]   ,):






   '''simple docstring'''
   super().__init__(
       A   ,tokenizer_file=A   ,eos_token=A   ,unk_token=A   ,additional_special_tokens=A   ,**A   ,)

   UpperCAmelCase__   :					Tuple   				=   vocab_file
   UpperCAmelCase__   :					Optional[Any]   				=   False if not self.vocab_file else True




  def 				__lowercase    (					self						:     Any   ,A						:     str   ,A						:     Optional[str] = None      ):






   '''simple docstring'''
   if not self.can_save_slow_tokenizer:
    raise ValueError(
        """Your fast tokenizer does not have the necessary information to save the vocabulary for a slow """
        """tokenizer."""      )

   if not os.path.isdir(A      ):
    logger.error(f"Vocabulary path ({save_directory}) should be a directory"      )
    return
   UpperCAmelCase__   :					Tuple   				=   os.path.join(
       A   ,(filename_prefix + """-""" if filename_prefix else """""") + VOCAB_FILES_NAMES["""vocab_file"""]      )

   if os.path.abspath(self.vocab_file      ) != os.path.abspath(A      ):
    copyfile(self.vocab_file   ,A      )

   return (out_vocab_file,)





