






"""simple docstring"""



import json
import os
import unittest

from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer

from ...test_tokenization_common import TokenizerTesterMixin





class 					_UpperCAmelCase       ( _A   ,						unittest.TestCase							):
					SCREAMING_SNAKE_CASE_		:				Optional[Any]							    =   CTRLTokenizer
					SCREAMING_SNAKE_CASE_		:				Optional[Any]							    =   False
					SCREAMING_SNAKE_CASE_		:				Optional[Any]							    =   False




					def   A  (				self     :						Tuple   )  ->  Dict:
							super().setUp()

							# Adapted from Sennrich et al. 2015 and https://github.com/rsennrich/subword-nmt
							lowercase_ : Dict							       =   ['''adapt''', '''re@@''', '''a@@''', '''apt''', '''c@@''', '''t''', '''<unk>''']
							lowercase_ : Any							       =   dict(zip(A    ,						range(len(A   )   )   )   )
							lowercase_ : Optional[Any]							       =   ['''#version: 0.2''', '''a p''', '''ap t</w>''', '''r e''', '''a d''', '''ad apt</w>''', '''''']
							lowercase_ : Tuple							       =   {'''unk_token''': '''<unk>'''}

							lowercase_ : Tuple							       =   os.path.join(self.tmpdirname    ,						VOCAB_FILES_NAMES['''vocab_file''']   )
							lowercase_ : List[Any]							       =   os.path.join(self.tmpdirname    ,						VOCAB_FILES_NAMES['''merges_file''']   )
							with open(self.vocab_file    ,						'''w'''    ,						encoding='''utf-8'''   ) as fp:
									fp.write(json.dumps(A   ) + '''\n'''   )
							with open(self.merges_file    ,						'''w'''    ,						encoding='''utf-8'''   ) as fp:
									fp.write('''\n'''.join(A   )   )




					def   A  (				self     :						int    ,						**A     :						Union[str, Any]   )  ->  Dict:
							kwargs.update(self.special_tokens_map   )
							return CTRLTokenizer.from_pretrained(self.tmpdirname    ,						**A   )




					def   A  (				self     :						Union[str, Any]    ,						A     :						Optional[Any]   )  ->  Any:
							lowercase_ : Dict							       =   '''adapt react readapt apt'''
							lowercase_ : Any							       =   '''adapt react readapt apt'''
							return input_text, output_text






					def   A  (				self     :						Dict   )  ->  Tuple:
							lowercase_ : Any							       =   CTRLTokenizer(self.vocab_file    ,						self.merges_file    ,						**self.special_tokens_map   )
							lowercase_ : str							       =   '''adapt react readapt apt'''
							lowercase_ : List[Any]							       =   '''adapt re@@ a@@ c@@ t re@@ adapt apt'''.split()
							lowercase_ : Tuple							       =   tokenizer.tokenize(A   )
							self.assertListEqual(A    ,						A   )

							lowercase_ : Any							       =   tokens + [tokenizer.unk_token]

							lowercase_ : List[str]							       =   [0, 1, 2, 4, 5, 1, 0, 3, 6]
							self.assertListEqual(tokenizer.convert_tokens_to_ids(A   )    ,						A   )











"""simple docstring"""



def 						lowercase    (				__snake_case				: int = 1_0_0	):
		lowercase_ : str							       =   0
		lowercase_ : List[Any]							       =   0
		for i in range(1		,					n + 1	):
				sum_of_squares += i**2
				sum_of_ints += i
		return sum_of_ints**2 - sum_of_squares


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



