import os
from shutil import copyfile
from typing import Any, Dict, List, Optional, Tuple

import sentencepiece as spm

from ...tokenization_utils import AddedToken, PreTrainedTokenizer
from ...utils import logging


_lowerCamelCase					:   Optional[Any]							=		logging.get_logger(__name__)

_lowerCamelCase					:   List[str]							=		'''▁'''

_lowerCamelCase					:   Dict							=		{'''vocab_file''': '''sentencepiece.bpe.model'''}

_lowerCamelCase					:   Optional[Any]							=		{
    '''vocab_file''': {
        '''xlm-roberta-base''': '''https://huggingface.co/xlm-roberta-base/resolve/main/sentencepiece.bpe.model''',
        '''xlm-roberta-large''': '''https://huggingface.co/xlm-roberta-large/resolve/main/sentencepiece.bpe.model''',
        '''xlm-roberta-large-finetuned-conll02-dutch''': (
            '''https://huggingface.co/xlm-roberta-large-finetuned-conll02-dutch/resolve/main/sentencepiece.bpe.model'''
        ),
        '''xlm-roberta-large-finetuned-conll02-spanish''': (
            '''https://huggingface.co/xlm-roberta-large-finetuned-conll02-spanish/resolve/main/sentencepiece.bpe.model'''
        ),
        '''xlm-roberta-large-finetuned-conll03-english''': (
            '''https://huggingface.co/xlm-roberta-large-finetuned-conll03-english/resolve/main/sentencepiece.bpe.model'''
        ),
        '''xlm-roberta-large-finetuned-conll03-german''': (
            '''https://huggingface.co/xlm-roberta-large-finetuned-conll03-german/resolve/main/sentencepiece.bpe.model'''
        ),
    }
}

_lowerCamelCase					:   Tuple							=		{
    '''xlm-roberta-base''': 5_12,
    '''xlm-roberta-large''': 5_12,
    '''xlm-roberta-large-finetuned-conll02-dutch''': 5_12,
    '''xlm-roberta-large-finetuned-conll02-spanish''': 5_12,
    '''xlm-roberta-large-finetuned-conll03-english''': 5_12,
    '''xlm-roberta-large-finetuned-conll03-german''': 5_12,
}


class 						lowercase    (     a     ):
							lowercase__						:       int								=							VOCAB_FILES_NAMES
							lowercase__						:       str								=							PRETRAINED_VOCAB_FILES_MAP
							lowercase__						:       Optional[int]								=							PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
							lowercase__						:       List[Any]								=							["""input_ids""", """attention_mask"""]




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



												'''simple docstring'''

												SCREAMING_SNAKE_CASE    			=       AddedToken(_UpperCamelCase	,							lstrip=_UpperCamelCase	,							rstrip=_UpperCamelCase      ) if isinstance(_UpperCamelCase	,							_UpperCamelCase      ) else mask_token

												SCREAMING_SNAKE_CASE    			=       {} if sp_model_kwargs is None else sp_model_kwargs

												super().__init__(
												    bos_token=_UpperCamelCase	,							eos_token=_UpperCamelCase	,							unk_token=_UpperCamelCase	,							sep_token=_UpperCamelCase	,							cls_token=_UpperCamelCase	,							pad_token=_UpperCamelCase	,							mask_token=_UpperCamelCase	,							sp_model_kwargs=self.sp_model_kwargs	,							**_UpperCamelCase	,							)

												SCREAMING_SNAKE_CASE    			=       spm.SentencePieceProcessor(**self.sp_model_kwargs      )
												self.sp_model.Load(str(_UpperCamelCase      )      )
												SCREAMING_SNAKE_CASE    			=       vocab_file

												# Original fairseq vocab and spm vocab must be "aligned":
												# Vocab    |    0    |    1    |   2    |    3    |  4  |  5  |  6  |   7   |   8   |  9
												# -------- | ------- | ------- | ------ | ------- | --- | --- | --- | ----- | ----- | ----
												# fairseq  | '<s>'   | '<pad>' | '</s>' | '<unk>' | ',' | '.' | '▁' | 's'   | '▁de' | '-'
												# spm      | '<unk>' | '<s>'   | '</s>' | ','     | '.' | '▁' | 's' | '▁de' | '-'   | '▁a'

												# Mimic fairseq token-to-id alignment for the first 4 token
												SCREAMING_SNAKE_CASE    			=       {"<s>": 0, "<pad>": 1, "</s>": 2, "<unk>": 3}

												# The first "real" token "," has position 4 in the original fairseq vocab and position 3 in the spm vocab
												SCREAMING_SNAKE_CASE    			=       1

												SCREAMING_SNAKE_CASE    			=       len(self.sp_model      ) + self.fairseq_offset
												SCREAMING_SNAKE_CASE    			=       {v: k for k, v in self.fairseq_tokens_to_ids.items()}




							def __getstate__(						self   :					Tuple      )					->				Tuple:



												'''simple docstring'''

												SCREAMING_SNAKE_CASE    			=       self.__dict__.copy()
												SCREAMING_SNAKE_CASE    			=       None
												SCREAMING_SNAKE_CASE    			=       self.sp_model.serialized_model_proto()
												return state




							def __setstate__(						self   :					List[Any]	,							_UpperCamelCase   :					Optional[Any]      )					->				Optional[Any]:



												'''simple docstring'''

												SCREAMING_SNAKE_CASE    			=       d

												# for backward compatibility
												if not hasattr(self	,							"sp_model_kwargs"      ):
																	SCREAMING_SNAKE_CASE    			=       {}

												SCREAMING_SNAKE_CASE    			=       spm.SentencePieceProcessor(**self.sp_model_kwargs      )
												self.sp_model.LoadFromSerializedProto(self.sp_model_proto      )




							def 	__snake_case(						self   :					List[str]	,							_UpperCamelCase   :					List[int]	,							_UpperCamelCase   :					Optional[List[int]] = None      )					->				List[int]:



												'''simple docstring'''

												if token_ids_a is None:
																	return [self.cls_token_id] + token_ids_a + [self.sep_token_id]
												SCREAMING_SNAKE_CASE    			=       [self.cls_token_id]
												SCREAMING_SNAKE_CASE    			=       [self.sep_token_id]
												return cls + token_ids_a + sep + sep + token_ids_a + sep




							def 	__snake_case(						self   :					List[Any]	,							_UpperCamelCase   :					List[int]	,							_UpperCamelCase   :					Optional[List[int]] = None	,							_UpperCamelCase   :					bool = False      )					->				List[int]:



												'''simple docstring'''

												if already_has_special_tokens:
																	return super().get_special_tokens_mask(
																	    token_ids_a=_UpperCamelCase	,							token_ids_a=_UpperCamelCase	,							already_has_special_tokens=_UpperCamelCase      )

												if token_ids_a is None:
																	return [1] + ([0] * len(_UpperCamelCase      )) + [1]
												return [1] + ([0] * len(_UpperCamelCase      )) + [1, 1] + ([0] * len(_UpperCamelCase      )) + [1]




							def 	__snake_case(						self   :					Optional[Any]	,							_UpperCamelCase   :					List[int]	,							_UpperCamelCase   :					Optional[List[int]] = None      )					->				List[int]:



												'''simple docstring'''

												SCREAMING_SNAKE_CASE    			=       [self.sep_token_id]
												SCREAMING_SNAKE_CASE    			=       [self.cls_token_id]

												if token_ids_a is None:
																	return len(cls + token_ids_a + sep      ) * [0]
												return len(cls + token_ids_a + sep + sep + token_ids_a + sep      ) * [0]




							@property
							def 	__snake_case(						self   :					List[str]      )					->				int:



												'''simple docstring'''

												return len(self.sp_model      ) + self.fairseq_offset + 1  # Add the <mask> token




							def 	__snake_case(						self   :					Optional[Any]      )					->				Optional[int]:



												'''simple docstring'''

												SCREAMING_SNAKE_CASE    			=       {self.convert_ids_to_tokens(_UpperCamelCase      ): i for i in range(self.vocab_size      )}
												vocab.update(self.added_tokens_encoder      )
												return vocab




							def 	__snake_case(						self   :					Tuple	,							_UpperCamelCase   :					str      )					->				List[str]:



												'''simple docstring'''

												return self.sp_model.encode(_UpperCamelCase	,							out_type=_UpperCamelCase      )




							def 	__snake_case(						self   :					Optional[int]	,							_UpperCamelCase   :					Tuple      )					->				List[str]:



												'''simple docstring'''

												if token in self.fairseq_tokens_to_ids:
																	return self.fairseq_tokens_to_ids[token]
												SCREAMING_SNAKE_CASE    			=       self.sp_model.PieceToId(_UpperCamelCase      )

												# Need to return unknown token if the SP model returned 0
												return spm_id + self.fairseq_offset if spm_id else self.unk_token_id




							def 	__snake_case(						self   :					Dict	,							_UpperCamelCase   :					int      )					->				str:



												'''simple docstring'''

												if index in self.fairseq_ids_to_tokens:
																	return self.fairseq_ids_to_tokens[index]
												return self.sp_model.IdToPiece(index - self.fairseq_offset      )




							def 	__snake_case(						self   :					Dict	,							_UpperCamelCase   :					Any      )					->				int:



												'''simple docstring'''

												SCREAMING_SNAKE_CASE    			=       "".join(_UpperCamelCase      ).replace(_UpperCamelCase	,							" "      ).strip()
												return out_string





							def 	__snake_case(						self   :					str	,							_UpperCamelCase   :					str	,							_UpperCamelCase   :					Optional[str] = None      )					->				Tuple[str]:



												'''simple docstring'''

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

												if os.path.abspath(self.vocab_file      ) != os.path.abspath(_UpperCamelCase      ) and os.path.isfile(self.vocab_file      ):
																	copyfile(self.vocab_file	,							_UpperCamelCase      )
												elif not os.path.isfile(self.vocab_file      ):
																	with open(_UpperCamelCase	,							"wb"      ) as fi:
																						SCREAMING_SNAKE_CASE    			=       self.sp_model.serialized_model_proto()
																						fi.write(_UpperCamelCase      )

												return (out_vocab_file,)





from __future__ import annotations

import math





def 	__lowerCamelCase							(UpperCAmelCase__     :							int  ):

					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(UpperCAmelCase__  ) + 1  )      , 6  ):
										if number % i == 0 or number % (i + 2) == 0:
															return False
					return True


_lowerCamelCase					:   Tuple							=		[num for num in range(3, 10_00_01, 2) if not is_prime(num)]





def 	__lowerCamelCase							(UpperCAmelCase__     :							int  ):
					if not isinstance(UpperCAmelCase__      , UpperCAmelCase__  ):
										raise ValueError("n must be an integer"  )
					if n <= 0:
										raise ValueError("n must be >= 0"  )

					SCREAMING_SNAKE_CASE    			=       []
					for num in range(len(UpperCAmelCase__  )  ):
										SCREAMING_SNAKE_CASE    			=       0
										while 2 * i * i <= odd_composites[num]:
															SCREAMING_SNAKE_CASE    			=       odd_composites[num] - 2 * i * i
															if is_prime(UpperCAmelCase__  ):
																				break
															i += 1
										else:
															list_nums.append(odd_composites[num]  )
															if len(UpperCAmelCase__  ) == n:
																				return list_nums

					return []





def 	__lowerCamelCase							():
					return compute_nums(1  )[0]


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




