






import json
import os
import unittest

from transformers import OpenAIGPTTokenizer, OpenAIGPTTokenizerFast
from transformers.models.openai.tokenization_openai import VOCAB_FILES_NAMES
from transformers.testing_utils import require_ftfy, require_spacy, require_tokenizers

from ...test_tokenization_common import TokenizerTesterMixin


@require_tokenizers
class 			SCREAMING_SNAKE_CASE      (      a_   ,		unittest.TestCase       ):
     '''simple docstring'''


     UpperCamelCase_				:		Optional[Any]								=						OpenAIGPTTokenizer
     UpperCamelCase_				:		Tuple								=						OpenAIGPTTokenizerFast
     UpperCamelCase_				:		List[Any]								=						True
     UpperCamelCase_				:		Union[str, Any]								=						False


     def 					_A							(					self							:						Optional[int]   ):
       super().setUp()

       # Adapted from Sennrich et al. 2015 and https://github.com/rsennrich/subword-nmt
       SCREAMING_SNAKE_CASE							:   List[str]						    =     [
           "l",
           "o",
           "w",
           "e",
           "r",
           "s",
           "t",
           "i",
           "d",
           "n",
           "w</w>",
           "r</w>",
           "t</w>",
           "lo",
           "low",
           "er</w>",
           "low</w>",
           "lowest</w>",
           "newer</w>",
           "wider</w>",
           "<unk>",
       ]
       SCREAMING_SNAKE_CASE							:   Optional[int]						    =     dict(zip(UpperCAmelCase_       ,			range(len(UpperCAmelCase_   )   )   )   )
       SCREAMING_SNAKE_CASE							:   Tuple						    =     ["#version: 0.2", "l o", "lo w", "e r</w>", ""]

       SCREAMING_SNAKE_CASE							:   Tuple						    =     os.path.join(self.tmpdirname       ,			VOCAB_FILES_NAMES["vocab_file"]   )
       SCREAMING_SNAKE_CASE							:   Optional[Any]						    =     os.path.join(self.tmpdirname       ,			VOCAB_FILES_NAMES["merges_file"]   )
       with open(self.vocab_file       ,			"w"   ) as fp:
         fp.write(json.dumps(UpperCAmelCase_   )   )
       with open(self.merges_file       ,			"w"   ) as fp:
         fp.write("\n".join(UpperCAmelCase_   )   )


     def 					_A							(					self							:						Dict       ,			UpperCAmelCase_							:						List[str]   ):
       return "lower newer", "lower newer"


     def 					_A							(					self							:						int   ):
       SCREAMING_SNAKE_CASE							:   Dict						    =     OpenAIGPTTokenizer(self.vocab_file       ,			self.merges_file   )

       SCREAMING_SNAKE_CASE							:   List[str]						    =     "lower"
       SCREAMING_SNAKE_CASE							:   int						    =     ["low", "er</w>"]
       SCREAMING_SNAKE_CASE							:   Union[str, Any]						    =     tokenizer.tokenize(UpperCAmelCase_   )
       self.assertListEqual(UpperCAmelCase_       ,			UpperCAmelCase_   )

       SCREAMING_SNAKE_CASE							:   List[Any]						    =     tokens + ["<unk>"]
       SCREAMING_SNAKE_CASE							:   Optional[int]						    =     [14, 15, 20]
       self.assertListEqual(tokenizer.convert_tokens_to_ids(UpperCAmelCase_   )       ,			UpperCAmelCase_   )


     def 					_A							(					self							:						Any       ,			UpperCAmelCase_							:						int=15   ):







       for tokenizer, pretrained_name, kwargs in self.tokenizers_list:
         with self.subTest(f'''{tokenizer.__class__.__name__} ({pretrained_name})'''   ):
           SCREAMING_SNAKE_CASE							:   Optional[int]						    =     self.rust_tokenizer_class.from_pretrained(UpperCAmelCase_       ,			**UpperCAmelCase_   )

           # Simple input
           SCREAMING_SNAKE_CASE							:   Any						    =     "This is a simple input"
           SCREAMING_SNAKE_CASE							:   Optional[Any]						    =     ["This is a simple input 1", "This is a simple input 2"]
           SCREAMING_SNAKE_CASE							:   str						    =     ("This is a simple input", "This is a pair")
           SCREAMING_SNAKE_CASE							:   Optional[Any]						    =     [
               ("This is a simple input 1", "This is a simple input 2"),
               ("This is a simple pair 1", "This is a simple pair 2"),
           ]

           # Simple input tests
           self.assertRaises(UpperCAmelCase_       ,			tokenizer_r.encode       ,			UpperCAmelCase_       ,			max_length=UpperCAmelCase_       ,			padding="max_length"   )

           # Simple input
           self.assertRaises(UpperCAmelCase_       ,			tokenizer_r.encode_plus       ,			UpperCAmelCase_       ,			max_length=UpperCAmelCase_       ,			padding="max_length"   )

           # Simple input
           self.assertRaises(
               UpperCAmelCase_       ,			tokenizer_r.batch_encode_plus       ,			UpperCAmelCase_       ,			max_length=UpperCAmelCase_       ,			padding="max_length"       ,			)

           # Pair input
           self.assertRaises(UpperCAmelCase_       ,			tokenizer_r.encode       ,			UpperCAmelCase_       ,			max_length=UpperCAmelCase_       ,			padding="max_length"   )

           # Pair input
           self.assertRaises(UpperCAmelCase_       ,			tokenizer_r.encode_plus       ,			UpperCAmelCase_       ,			max_length=UpperCAmelCase_       ,			padding="max_length"   )

           # Pair input
           self.assertRaises(
               UpperCAmelCase_       ,			tokenizer_r.batch_encode_plus       ,			UpperCAmelCase_       ,			max_length=UpperCAmelCase_       ,			padding="max_length"       ,			)






     def 					_A							(					self							:						List[Any]   ):
       pass





@require_ftfy
@require_spacy
@require_tokenizers
class 			SCREAMING_SNAKE_CASE      (      a_       ):
     '''simple docstring'''


     pass










def 	__lowerCamelCase						(							lowerCamelCase__		:						int      ):





			'''simple docstring'''




			lowerCamelCase    		=  (1 + 24 * n) ** 0.5
			return ((1 + root) / 6) % 1 == 0






def 	__lowerCamelCase						(							lowerCamelCase__		:						int = 5000      ):





			'''simple docstring'''




			lowerCamelCase    		=  [(i * (3 * i - 1)) // 2 for i in range(1  ,							lowerCamelCase__      )]
			for i, pentagonal_i in enumerate(lowerCamelCase__      ):
						for j in range(lowerCamelCase__  ,							len(lowerCamelCase__      )      ):
									lowerCamelCase    		=  pentagonal_nums[j]
									lowerCamelCase    		=  pentagonal_i + pentagonal_j
									lowerCamelCase    		=  pentagonal_j - pentagonal_i
									if is_pentagonal(lowerCamelCase__      ) and is_pentagonal(lowerCamelCase__      ):
												return b

			return -1


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

