




"""simple docstring"""


from __future__ import annotations

from itertools import permutations
from random import randint
from timeit import repeat


def 					UpperCAmelCase__       ():
  """simple docstring"""

  _snake_case							:		Union[str, Any]								=  [randint(-10_00		,   10_00    ) for i in range(10    )]
  _snake_case							:		str								=  randint(-50_00		,   50_00    )
  return (arr, r)


A_						=				make_dataset()


def 					UpperCAmelCase__       (snake_case__							:					list[int]		,   snake_case__							:					int    ):
  """simple docstring"""

  for triplet in permutations(snake_case__		,   3    ):
    if sum(snake_case__    ) == target:
      return tuple(sorted(snake_case__    )    )
  return (0, 0, 0)


def 					UpperCAmelCase__       (snake_case__							:					list[int]		,   snake_case__							:					int    ):
  """simple docstring"""

  arr.sort()
  _snake_case							:		Any								=  len(snake_case__    )
  for i in range(n - 1    ):
    _snake_case		,					_snake_case							:		Optional[int]								=  i + 1, n - 1
    while left < right:
      if arr[i] + arr[left] + arr[right] == target:
        return (arr[i], arr[left], arr[right])
      elif arr[i] + arr[left] + arr[right] < target:
        left += 1
      elif arr[i] + arr[left] + arr[right] > target:
        right -= 1
  return (0, 0, 0)


def 					UpperCAmelCase__       ():
  """simple docstring"""

  _snake_case							:		Tuple								=  """
from __main__ import dataset, triplet_sum1, triplet_sum2
"""
  _snake_case							:		Optional[Any]								=  """
triplet_sum1(*dataset)
"""
  _snake_case							:		int								=  """
triplet_sum2(*dataset)
"""
  _snake_case							:		List[str]								=  repeat(setup=snake_case__		,   stmt=snake_case__		,   repeat=5		,   number=1_00_00    )
  _snake_case							:		Optional[Any]								=  repeat(setup=snake_case__		,   stmt=snake_case__		,   repeat=5		,   number=1_00_00    )
  return (min(snake_case__    ), min(snake_case__    ))


if __name__ == "__main__":
     from doctest import testmod

     testmod()
     A_						=				solution_times()
     print(F'''The time for naive implementation is {times[0]}.''')
     print(F'''The time for optimized implementation is {times[1]}.''')










"""simple docstring"""





import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from .tokenization_lxmert import LxmertTokenizer


_SCREAMING_SNAKE_CASE					:				Union[str, Any]					    =						{'''vocab_file''': '''vocab.txt''', '''tokenizer_file''': '''tokenizer.json'''}

_SCREAMING_SNAKE_CASE					:				Union[str, Any]					    =						{
    '''vocab_file''': {
        '''unc-nlp/lxmert-base-uncased''': '''https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/vocab.txt''',
    },
    '''tokenizer_file''': {
        '''unc-nlp/lxmert-base-uncased''': (
            '''https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/tokenizer.json'''
        ),
    },
}

_SCREAMING_SNAKE_CASE					:				Any					    =						{
    '''unc-nlp/lxmert-base-uncased''': 512,
}

_SCREAMING_SNAKE_CASE					:				int					    =						{
    '''unc-nlp/lxmert-base-uncased''': {'''do_lower_case''': True},
}






class      a						(					__snake_case		):
    SCREAMING_SNAKE_CASE						:     int						= VOCAB_FILES_NAMES
    SCREAMING_SNAKE_CASE						:     Optional[Any]						= PRETRAINED_VOCAB_FILES_MAP
    SCREAMING_SNAKE_CASE						:     Any						= PRETRAINED_INIT_CONFIGURATION
    SCREAMING_SNAKE_CASE						:     Any						= PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
    SCREAMING_SNAKE_CASE						:     Optional[Any]						= LxmertTokenizer






    def __init__(       self     :							str       ,						__SCREAMING_SNAKE_CASE     :							Optional[Any]=None       ,						__SCREAMING_SNAKE_CASE     :							Optional[Any]=None       ,						__SCREAMING_SNAKE_CASE     :							str=True       ,						__SCREAMING_SNAKE_CASE     :							List[Any]="[UNK]"       ,						__SCREAMING_SNAKE_CASE     :							int="[SEP]"       ,						__SCREAMING_SNAKE_CASE     :							int="[PAD]"       ,						__SCREAMING_SNAKE_CASE     :							List[Any]="[CLS]"       ,						__SCREAMING_SNAKE_CASE     :							Any="[MASK]"       ,						__SCREAMING_SNAKE_CASE     :							List[str]=True       ,						__SCREAMING_SNAKE_CASE     :							List[str]=None       ,						**__SCREAMING_SNAKE_CASE     :							Any       ,						)     ->		Any:
      super().__init__(
          __SCREAMING_SNAKE_CASE       ,						tokenizer_file=__SCREAMING_SNAKE_CASE       ,						do_lower_case=__SCREAMING_SNAKE_CASE       ,						unk_token=__SCREAMING_SNAKE_CASE       ,						sep_token=__SCREAMING_SNAKE_CASE       ,						pad_token=__SCREAMING_SNAKE_CASE       ,						cls_token=__SCREAMING_SNAKE_CASE       ,						mask_token=__SCREAMING_SNAKE_CASE       ,						tokenize_chinese_chars=__SCREAMING_SNAKE_CASE       ,						strip_accents=__SCREAMING_SNAKE_CASE       ,						**__SCREAMING_SNAKE_CASE       ,						)

      lowerCamelCase_         =						json.loads(self.backend_tokenizer.normalizer.__getstate__()					)
      if (
          normalizer_state.get('lowercase'       ,						__SCREAMING_SNAKE_CASE					) != do_lower_case
          or normalizer_state.get('strip_accents'       ,						__SCREAMING_SNAKE_CASE					) != strip_accents
          or normalizer_state.get('handle_chinese_chars'       ,						__SCREAMING_SNAKE_CASE					) != tokenize_chinese_chars
      ):
        lowerCamelCase_         =						getattr(__SCREAMING_SNAKE_CASE       ,						normalizer_state.pop('type'					)					)
        lowerCamelCase_         =						do_lower_case
        lowerCamelCase_         =						strip_accents
        lowerCamelCase_         =						tokenize_chinese_chars
        lowerCamelCase_         =						normalizer_class(**__SCREAMING_SNAKE_CASE					)

      lowerCamelCase_         =						do_lower_case






    def    UpperCamelCase       (       self     :							Tuple       ,						__SCREAMING_SNAKE_CASE     :							Union[str, Any]       ,						__SCREAMING_SNAKE_CASE     :							Tuple=None					)     ->		Dict:
      lowerCamelCase_         =						[self.cls_token_id] + token_ids_a + [self.sep_token_id]

      if token_ids_a:
        output += token_ids_a + [self.sep_token_id]

      return output






    def    UpperCamelCase       (       self     :							str       ,						__SCREAMING_SNAKE_CASE     :							List[int]       ,						__SCREAMING_SNAKE_CASE     :							Optional[List[int]] = None					)     ->		List[int]:
      lowerCamelCase_         =						[self.sep_token_id]
      lowerCamelCase_         =						[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					) * [0] + len(token_ids_a + sep					) * [1]






    def    UpperCamelCase       (       self     :							List[str]       ,						__SCREAMING_SNAKE_CASE     :							str       ,						__SCREAMING_SNAKE_CASE     :							Optional[str] = None					)     ->		Tuple[str]:
      lowerCamelCase_         =						self._tokenizer.model.save(__SCREAMING_SNAKE_CASE       ,						name=__SCREAMING_SNAKE_CASE					)
      return tuple(__SCREAMING_SNAKE_CASE					)




