


'''simple docstring'''




import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_funnel import FunnelTokenizer


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

_a   :   Optional[int]												=   {"vocab_file": "vocab.txt", "tokenizer_file": "tokenizer.json"}

_a   :   Optional[int]												=   [
    "small",
    "small-base",
    "medium",
    "medium-base",
    "intermediate",
    "intermediate-base",
    "large",
    "large-base",
    "xlarge",
    "xlarge-base",
]

_a   :   Union[str, Any]												=   {
    "vocab_file": {
        "funnel-transformer/small": "https://huggingface.co/funnel-transformer/small/resolve/main/vocab.txt",
        "funnel-transformer/small-base": "https://huggingface.co/funnel-transformer/small-base/resolve/main/vocab.txt",
        "funnel-transformer/medium": "https://huggingface.co/funnel-transformer/medium/resolve/main/vocab.txt",
        "funnel-transformer/medium-base": (
            "https://huggingface.co/funnel-transformer/medium-base/resolve/main/vocab.txt"
        ),
        "funnel-transformer/intermediate": (
            "https://huggingface.co/funnel-transformer/intermediate/resolve/main/vocab.txt"
        ),
        "funnel-transformer/intermediate-base": (
            "https://huggingface.co/funnel-transformer/intermediate-base/resolve/main/vocab.txt"
        ),
        "funnel-transformer/large": "https://huggingface.co/funnel-transformer/large/resolve/main/vocab.txt",
        "funnel-transformer/large-base": "https://huggingface.co/funnel-transformer/large-base/resolve/main/vocab.txt",
        "funnel-transformer/xlarge": "https://huggingface.co/funnel-transformer/xlarge/resolve/main/vocab.txt",
        "funnel-transformer/xlarge-base": (
            "https://huggingface.co/funnel-transformer/xlarge-base/resolve/main/vocab.txt"
        ),
    },
    "tokenizer_file": {
        "funnel-transformer/small": "https://huggingface.co/funnel-transformer/small/resolve/main/tokenizer.json",
        "funnel-transformer/small-base": (
            "https://huggingface.co/funnel-transformer/small-base/resolve/main/tokenizer.json"
        ),
        "funnel-transformer/medium": "https://huggingface.co/funnel-transformer/medium/resolve/main/tokenizer.json",
        "funnel-transformer/medium-base": (
            "https://huggingface.co/funnel-transformer/medium-base/resolve/main/tokenizer.json"
        ),
        "funnel-transformer/intermediate": (
            "https://huggingface.co/funnel-transformer/intermediate/resolve/main/tokenizer.json"
        ),
        "funnel-transformer/intermediate-base": (
            "https://huggingface.co/funnel-transformer/intermediate-base/resolve/main/tokenizer.json"
        ),
        "funnel-transformer/large": "https://huggingface.co/funnel-transformer/large/resolve/main/tokenizer.json",
        "funnel-transformer/large-base": (
            "https://huggingface.co/funnel-transformer/large-base/resolve/main/tokenizer.json"
        ),
        "funnel-transformer/xlarge": "https://huggingface.co/funnel-transformer/xlarge/resolve/main/tokenizer.json",
        "funnel-transformer/xlarge-base": (
            "https://huggingface.co/funnel-transformer/xlarge-base/resolve/main/tokenizer.json"
        ),
    },
}
_a   :   List[str]												=   {f'''funnel-transformer/{name}''': 512 for name in _model_names}
_a   :   Optional[int]												=   {f'''funnel-transformer/{name}''': {"do_lower_case": True} for name in _model_names}




class 			_lowercase (	__lowercase							):
   _SCREAMING_SNAKE_CASE  :  Optional[int]          =	VOCAB_FILES_NAMES
   _SCREAMING_SNAKE_CASE  :  Dict          =	PRETRAINED_VOCAB_FILES_MAP
   _SCREAMING_SNAKE_CASE  :  str          =	PRETRAINED_INIT_CONFIGURATION
   _SCREAMING_SNAKE_CASE  :  int          =	FunnelTokenizer
   _SCREAMING_SNAKE_CASE  :  Optional[Any]          =	PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
   _SCREAMING_SNAKE_CASE  :  int          =	2
   def __init__(						self       :      int       ,   SCREAMING_SNAKE_CASE_       :      Dict=None       ,   SCREAMING_SNAKE_CASE_       :      int=None       ,   SCREAMING_SNAKE_CASE_       :      List[Any]=True       ,   SCREAMING_SNAKE_CASE_       :      List[Any]="<unk>"       ,   SCREAMING_SNAKE_CASE_       :      Any="<sep>"       ,   SCREAMING_SNAKE_CASE_       :      List[Any]="<pad>"       ,   SCREAMING_SNAKE_CASE_       :      int="<cls>"       ,   SCREAMING_SNAKE_CASE_       :      List[str]="<mask>"       ,   SCREAMING_SNAKE_CASE_       :      List[str]="<s>"       ,   SCREAMING_SNAKE_CASE_       :      Tuple="</s>"       ,   SCREAMING_SNAKE_CASE_       :      int=True       ,   SCREAMING_SNAKE_CASE_       :      Any=True       ,   SCREAMING_SNAKE_CASE_       :      int=None       ,   SCREAMING_SNAKE_CASE_       :      int="##"       ,   **SCREAMING_SNAKE_CASE_       :      int       ,   ) ->							Optional[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_       ,   bos_token=SCREAMING_SNAKE_CASE_       ,   eos_token=SCREAMING_SNAKE_CASE_       ,   clean_text=SCREAMING_SNAKE_CASE_       ,   tokenize_chinese_chars=SCREAMING_SNAKE_CASE_       ,   strip_accents=SCREAMING_SNAKE_CASE_       ,   wordpieces_prefix=SCREAMING_SNAKE_CASE_       ,   **SCREAMING_SNAKE_CASE_       ,   )

        __snake_case           =						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
        ):
             __snake_case           =						getattr(SCREAMING_SNAKE_CASE_       ,   normalizer_state.pop('type'      )      )
             __snake_case           =						do_lower_case
             __snake_case           =						strip_accents
             __snake_case           =						tokenize_chinese_chars
             __snake_case           =						normalizer_class(**SCREAMING_SNAKE_CASE_      )

        __snake_case           =						do_lower_case
   def a  (						self       :      int       ,   SCREAMING_SNAKE_CASE_       :      Union[str, Any]       ,   SCREAMING_SNAKE_CASE_       :      List[str]=None      ) ->							str:
        __snake_case           =						[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 a  (						self       :      Dict       ,   SCREAMING_SNAKE_CASE_       :      List[int]       ,   SCREAMING_SNAKE_CASE_       :      Optional[List[int]] = None      ) ->							List[int]:
        __snake_case           =						[self.sep_token_id]
        __snake_case           =						[self.cls_token_id]
        if token_ids_a is None:
             return len(cls      ) * [self.cls_token_type_id] + len(token_ids_a + sep      ) * [0]
        return len(cls      ) * [self.cls_token_type_id] + len(token_ids_a + sep      ) * [0] + len(token_ids_a + sep      ) * [1]





   def a  (						self       :      Union[str, Any]       ,   SCREAMING_SNAKE_CASE_       :      str       ,   SCREAMING_SNAKE_CASE_       :      Optional[str] = None      ) ->							Tuple[str]:
        __snake_case           =						self._tokenizer.model.save(SCREAMING_SNAKE_CASE_       ,   name=SCREAMING_SNAKE_CASE_      )
        return tuple(SCREAMING_SNAKE_CASE_      )









from __future__ import annotations

from math import ceil, floor, sqrt





def 		a__      (		_UpperCamelCase      :			int = 2_00_00_00				):
   __lowerCamelCase    				=     [0]
   __lowerCamelCase    				=     42

   for idx in range(1			,ceil(sqrt(target * 2				) * 1.1				)				):
      triangle_numbers.append(triangle_numbers[-1] + idx				)

   # we want this to be as close as possible to target
   __lowerCamelCase    				=     0
   # the area corresponding to the grid that gives the product closest to target
   __lowerCamelCase    				=     0
   # an estimate of b, using the quadratic formula
   __lowerCamelCase    				=     42
   # the largest integer less than b_estimate
   __lowerCamelCase    				=     42
   # the largest integer less than b_estimate
   __lowerCamelCase    				=     42
   # the triangle number corresponding to b_floor
   __lowerCamelCase    				=     42
   # the triangle number corresponding to b_ceil
   __lowerCamelCase    				=     42

   for idx_a, triangle_a in enumerate(triangle_numbers[1:]			,1				):
      __lowerCamelCase    				=     (-1 + sqrt(1 + 8 * target / triangle_a				)) / 2
      __lowerCamelCase    				=     floor(_UpperCamelCase				)
      __lowerCamelCase    				=     ceil(_UpperCamelCase				)
      __lowerCamelCase    				=     triangle_numbers[b_floor]
      __lowerCamelCase    				=     triangle_numbers[b_ceil]

      if abs(target - triangle_b_first_guess * triangle_a				) < abs(
          target - best_product				):
         __lowerCamelCase    				=     triangle_b_first_guess * triangle_a
         __lowerCamelCase    				=     idx_a * b_floor

      if abs(target - triangle_b_second_guess * triangle_a				) < abs(
          target - best_product				):
         __lowerCamelCase    				=     triangle_b_second_guess * triangle_a
         __lowerCamelCase    				=     idx_a * b_ceil

   return area


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






