
'''simple docstring'''







from __future__ import annotations

import math





def    UpperCAmelCase_						(__a :       int					):






   """simple docstring"""

   if 1 < number < 4:
      # 2 and 3 are primes
      return True
   elif number < 2 or number % 2 == 0 or number % 3 == 0:
      # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes
      return False

   # All primes number are in format of 6k +/- 1
   for i in range(5					,      int(math.sqrt(_snake_case					) + 1					)					,      6					):
      if number % i == 0 or number % (i + 2) == 0:
         return False
   return True


__lowerCAmelCase   =       [num for num in range(3, 1_0_0_0_0_1, 2) if not is_prime(num)]





def    UpperCAmelCase_						(__a :       int					):






   """simple docstring"""

   if not isinstance(_snake_case					,      _snake_case					):
      raise ValueError('n must be an integer'					)
   if n <= 0:
      raise ValueError('n must be >= 0'					)

   _a							:      Dict     =  []
   for num in range(len(_snake_case					)					):
      _a							:      Any     =  0
      while 2 * i * i <= odd_composites[num]:
         _a							:      List[str]     =  odd_composites[num] - 2 * i * i
         if is_prime(_snake_case					):
            break
         i += 1
      else:
         list_nums.append(odd_composites[num]					)
         if len(_snake_case					) == n:
            return list_nums

   return []





def    UpperCAmelCase_						():






   """simple docstring"""

   return compute_nums(1					)[0]


if __name__ == "__main__":
  print(f'''{solution() = }''')








import json
import os
from typing import Dict, List, Optional, Tuple

from ...tokenization_utils import PreTrainedTokenizer
from ...utils import logging


UpperCAmelCase_		 =					logging.get_logger(__name__)


UpperCAmelCase_		 =					{
    """vocab_file""": """vocab.json""",
    """tokenizer_config_file""": """tokenizer_config.json""",
    """merges_file""": """merges.txt""",
}

UpperCAmelCase_		 =					{
    """vocab_file""": {
        """facebook/s2t-wav2vec2-large-en-de""": (
            """https://huggingface.co/facebook/s2t-wav2vec2-large-en-de/resolve/main/vocab.json"""
        ),
    },
    """tokenizer_config_file""": {
        """facebook/s2t-wav2vec2-large-en-de""": (
            """https://huggingface.co/facebook/s2t-wav2vec2-large-en-de/resolve/main/tokenizer_config.json"""
        ),
    },
    """merges_file""": {
        """facebook/s2t-wav2vec2-large-en-de""": (
            """https://huggingface.co/facebook/s2t-wav2vec2-large-en-de/resolve/main/merges.txt"""
        ),
    },
}

UpperCAmelCase_		 =					"""</w>"""
UpperCAmelCase_		 =					"""@@ """

def 	SCREAMING_SNAKE_CASE_							(	_snake_case	:Optional[Any]				)  ->     List[str]:
   _A      =       set()
   _A      =       word[0]
   for char in word[1:]:
      pairs.add((prev_char, char)				)
      _A      =       char
   return pairs


# Speech2Text2 has no max input length
UpperCAmelCase_		 =					{"""facebook/s2t-wav2vec2-large-en-de""": 1_0_2_4}


class 	lowerCamelCase__	(       _A):



 """simple docstring"""

 a__					: Dict =  VOCAB_FILES_NAMES
 a__					: str =  PRETRAINED_VOCAB_FILES_MAP
 a__					: Optional[Any] =  PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
 a__					: List[Any] =  ["input_ids", "attention_mask"]

 def __init__(    self					:					Optional[Any]			,						__lowerCAmelCase					:					Optional[int]			,						__lowerCAmelCase					:					List[str]="<s>"			,						__lowerCAmelCase					:					Tuple="<pad>"			,						__lowerCAmelCase					:					Optional[Any]="</s>"			,						__lowerCAmelCase					:					Dict="<unk>"			,						__lowerCAmelCase					:					Union[str, Any]=False			,						__lowerCAmelCase					:					Optional[int]=None			,						**__lowerCAmelCase					:					str			,						)   ->	Dict:
    super().__init__(
        unk_token=__lowerCAmelCase			,						bos_token=__lowerCAmelCase			,						eos_token=__lowerCAmelCase			,						pad_token=__lowerCAmelCase			,						do_lower_case=__lowerCAmelCase			,						**__lowerCAmelCase			,						)

    _A      =       do_lower_case

    with open(__lowerCAmelCase			,						encoding='''utf-8'''      ) as vocab_handle:
       _A      =       json.load(__lowerCAmelCase      )
    _A      =       {v: k for k, v in self.encoder.items()}

    if merges_file is None:
       logger.info(f'''No merges files provided. {self.__class__.__name__} can only be used for decoding.'''      )

       _A      =       None
       _A      =       None
    else:
       with open(__lowerCAmelCase			,						encoding='''utf-8'''      ) as merges_handle:
          _A      =       merges_handle.read().split('''\n'''      )[:-1]

       _A      =       [tuple(merge.split()[:2]      ) for merge in merges]
       _A      =       dict(zip(__lowerCAmelCase			,						range(len(__lowerCAmelCase      )      )      )      )
       _A      =       {}

 @property
 def     snake_case_      (    self					:					List[str]      )   ->	int:
    return len(self.decoder      )

 def     snake_case_      (    self					:					Dict      )   ->	Dict:
    return dict(self.encoder			,						**self.added_tokens_encoder      )

 def     snake_case_      (    self					:					Union[str, Any]			,						__lowerCAmelCase					:					Any      )   ->	Union[str, Any]:
    _A      =       tuple(token[:-1]      ) + (token[-1] + BPE_TOKEN_MERGES,)
    if token in self.cache:
       return self.cache[token]
    _A      =       get_pairs(__lowerCAmelCase      )

    if not pairs:
       return token

    while True:
       _A      =       min(__lowerCAmelCase			,						key=lambda __lowerCAmelCase      : self.bpe_ranks.get(__lowerCAmelCase			,						float('''inf'''      )      )      )
       if bigram not in self.bpe_ranks:
          break
       _A  ,    _A      =       bigram
       _A      =       []
       _A      =       0
       while i < len(__lowerCAmelCase      ):
          try:
             _A      =       word.index(__lowerCAmelCase			,						__lowerCAmelCase      )
          except ValueError:
             new_word.extend(word[i:]      )
             break
          else:
             new_word.extend(word[i:j]      )
             _A      =       j

          if word[i] == first and i < len(__lowerCAmelCase      ) - 1 and word[i + 1] == second:
             new_word.append(first + second      )
             i += 2
          else:
             new_word.append(word[i]      )
             i += 1
       _A      =       tuple(__lowerCAmelCase      )
       _A      =       new_word
       if len(__lowerCAmelCase      ) == 1:
          break
       else:
          _A      =       get_pairs(__lowerCAmelCase      )
    _A      =       ''' '''.join(__lowerCAmelCase      )
    if word == "\n  " + BPE_TOKEN_MERGES:
       _A      =       '''\n''' + BPE_TOKEN_MERGES

    if word.endswith(__lowerCAmelCase      ):
       _A      =       word.replace(__lowerCAmelCase			,						''''''      )

    _A      =       word.replace(''' '''			,						__lowerCAmelCase      )
    _A      =       word
    return word

 def     snake_case_      (    self					:					Optional[Any]			,						__lowerCAmelCase					:					Tuple      )   ->	Optional[int]:

    if self.bpe_ranks is None:
       raise ValueError(
           '''This tokenizer was instantiated without a `merges.txt` file, so'''
           ''' that it can only be used for decoding, not for encoding.'''
           '''Make sure to provide `merges.txt` file at instantiation to enable '''
           '''encoding.'''      )

    if self.do_lower_case:
       _A      =       text.lower()

    _A      =       text.split()

    _A      =       []
    for token in text:
       if token:
          split_tokens.extend(list(self.bpe(__lowerCAmelCase      ).split(''' '''      )      )      )

    return split_tokens

 def     snake_case_      (    self					:					List[Any]			,						__lowerCAmelCase					:					str      )   ->	int:
    return self.encoder.get(__lowerCAmelCase			,						self.encoder.get(self.unk_token      )      )

 def     snake_case_      (    self					:					str			,						__lowerCAmelCase					:					int      )   ->	str:
    _A      =       self.decoder.get(__lowerCAmelCase			,						self.unk_token      )
    return result

 def     snake_case_      (    self					:					List[str]			,						__lowerCAmelCase					:					List[str]      )   ->	str:
    _A      =       ''' '''.join(__lowerCAmelCase      )

    # make sure @@ tokens are concatenated
    _A      =       ''''''.join(string.split(__lowerCAmelCase      )      )

    return string

 def     snake_case_      (    self					:					Tuple			,						__lowerCAmelCase					:					str			,						__lowerCAmelCase					:					Optional[str] = None      )   ->	Tuple[str]:
    if not os.path.isdir(__lowerCAmelCase      ):
       logger.error(f'''Vocabulary path ({save_directory}) should be a directory'''      )
       return
    _A      =       os.path.join(
        __lowerCAmelCase			,						(filename_prefix + '''-''' if filename_prefix else '''''') + VOCAB_FILES_NAMES['''vocab_file''']      )
    _A      =       os.path.join(
        __lowerCAmelCase			,						(filename_prefix + '''-''' if filename_prefix else '''''') + VOCAB_FILES_NAMES['''merges_file''']      )

    with open(__lowerCAmelCase			,						'''w'''			,						encoding='''utf-8'''      ) as f:
       f.write(json.dumps(self.encoder			,						indent=2			,						sort_keys=__lowerCAmelCase			,						ensure_ascii=__lowerCAmelCase      ) + '''\n'''      )

    _A      =       0
    if self.bpe_ranks is None:
       return (vocab_file,)

    with open(__lowerCAmelCase			,						'''w'''			,						encoding='''utf-8'''      ) as writer:
       for bpe_tokens, token_index in sorted(self.bpe_ranks.items()			,						key=lambda __lowerCAmelCase      : kv[1]      ):
          if index != token_index:
             logger.warning(
                 f'''Saving vocabulary to {merges_file}: BPE merge indices are not consecutive.'''
                 ''' Please check that the tokenizer is not corrupted!'''      )
             _A      =       token_index
          writer.write(''' '''.join(__lowerCAmelCase      ) + '''\n'''      )
          index += 1

    return (vocab_file, merges_file)



