


'''simple docstring'''



from __future__ import annotations

from collections.abc import Iterable



class       a							:


     """simple docstring"""






     def __init__(							self	:						str				,					snake_case	:						Dict				,					snake_case	:						Optional[int]     )		->				List[Any]:
          __UpperCAmelCase				,  __UpperCAmelCase      :					str    				=     float(_SCREAMING_SNAKE_CASE     ), float(_SCREAMING_SNAKE_CASE     )

     def __eq__(							self	:						Any				,					snake_case	:						Dict     )		->				Dict:
          return self.x == other.x and self.y == other.y

     def __ne__(							self	:						str				,					snake_case	:						Union[str, Any]     )		->				int:
          return not self == other

     def __gt__(							self	:						Dict				,					snake_case	:						str     )		->				Optional[int]:
          if self.x > other.x:
               return True
          elif self.x == other.x:
               return self.y > other.y
          return False

     def __lt__(							self	:						List[Any]				,					snake_case	:						Optional[Any]     )		->				List[Any]:
          return not self > other

     def __ge__(							self	:						List[Any]				,					snake_case	:						List[Any]     )		->				List[Any]:
          if self.x > other.x:
               return True
          elif self.x == other.x:
               return self.y >= other.y
          return False

     def __le__(							self	:						Optional[Any]				,					snake_case	:						int     )		->				Tuple:
          if self.x < other.x:
               return True
          elif self.x == other.x:
               return self.y <= other.y
          return False

     def __repr__(							self	:						Union[str, Any]     )		->				int:
          return f'({self.x}, {self.y})'






     def __hash__(							self	:						Dict     )		->				Union[str, Any]:
          return hash(self.x     )




def       _a      (		_lowercase   :      list[Point] | list[list[float]] | Iterable[list[float]]     ,   ):





     '''simple docstring'''






     __UpperCAmelCase      :					str    				=     []
     if list_of_tuples:
          for p in list_of_tuples:
               if isinstance(_UpperCamelCase     ,   _UpperCamelCase    ):
                    points.append(_UpperCamelCase    )
               else:
                    try:
                         points.append(Point(p[0]     ,   p[1]    )    )
                    except (IndexError, TypeError):
                         print(
                             F'Ignoring deformed point {p}. All points'
                             ''' must have at least 2 coordinates.'''    )
     return points




def       _a      (		_lowercase   :      list[Point] | list[list[float]]    ):





     '''simple docstring'''






     if not hasattr(_UpperCamelCase     ,   '''__iter__'''    ):
          __UpperCAmelCase      :					List[str]    				=     F'Expecting an iterable object but got an non-iterable type {points}'
          raise ValueError(_UpperCamelCase    )

     if not points:
          __UpperCAmelCase      :					List[str]    				=     F'Expecting a list of points but got {points}'
          raise ValueError(_UpperCamelCase    )

     return _construct_points(_UpperCamelCase    )




def       _a      (		_lowercase   :      Point     ,   _lowercase   :      Point     ,   _lowercase   :      Point    ):





     '''simple docstring'''






     __UpperCAmelCase      :					Dict    				=     (a.x * b.y + b.x * c.y + c.x * a.y) - (a.y * b.x + b.y * c.x + c.y * a.x)
     return det




def       _a      (		_lowercase   :      list[Point]    ):





     '''simple docstring'''






     __UpperCAmelCase      :					Any    				=     sorted(_validate_input(_UpperCamelCase    )    )
     __UpperCAmelCase      :					List[str]    				=     len(_UpperCamelCase    )
     __UpperCAmelCase      :					List[str]    				=     set()

     for i in range(n - 1    ):
          for j in range(i + 1     ,   _UpperCamelCase    ):
               __UpperCAmelCase      :					Union[str, Any]    				=     False
               __UpperCAmelCase      :					int    				=     True
               for k in range(_UpperCamelCase    ):
                    if k != i and k != j:
                         __UpperCAmelCase      :					List[Any]    				=     _det(points[i]     ,   points[j]     ,   points[k]    )

                         if det_k > 0:
                              __UpperCAmelCase      :					Any    				=     True
                         elif det_k < 0:
                              __UpperCAmelCase      :					List[Any]    				=     True
                         else:
                              # point[i], point[j], point[k] all lie on a straight line
                              # if point[k] is to the left of point[i] or it's to the
                              # right of point[j], then point[i], point[j] cannot be
                              # part of the convex hull of A
                              if points[k] < points[i] or points[k] > points[j]:
                                   __UpperCAmelCase      :					List[str]    				=     False
                                   break

                    if points_left_of_ij and points_right_of_ij:
                         __UpperCAmelCase      :					Union[str, Any]    				=     False
                         break

               if ij_part_of_convex_hull:
                    convex_set.update([points[i], points[j]]    )

     return sorted(_UpperCamelCase    )




def       _a      (		_lowercase   :      list[Point]    ):





     '''simple docstring'''






     __UpperCAmelCase      :					Union[str, Any]    				=     sorted(_validate_input(_UpperCamelCase    )    )
     __UpperCAmelCase      :					Any    				=     len(_UpperCamelCase    )

     # divide all the points into an upper hull and a lower hull
     # the left most point and the right most point are definitely
     # members of the convex hull by definition.
     # use these two anchors to divide all the points into two hulls,
     # an upper hull and a lower hull.

     # all points to the left (above) the line joining the extreme points belong to the
     # upper hull
     # all points to the right (below) the line joining the extreme points below to the
     # lower hull
     # ignore all points on the line joining the extreme points since they cannot be
     # part of the convex hull

     __UpperCAmelCase      :					Optional[Any]    				=     points[0]
     __UpperCAmelCase      :					Dict    				=     points[n - 1]

     __UpperCAmelCase      :					Optional[Any]    				=     {left_most_point, right_most_point}
     __UpperCAmelCase      :					Dict    				=     []
     __UpperCAmelCase      :					int    				=     []

     for i in range(1     ,   n - 1    ):
          __UpperCAmelCase      :					int    				=     _det(_UpperCamelCase     ,   _UpperCamelCase     ,   points[i]    )

          if det > 0:
               upper_hull.append(points[i]    )
          elif det < 0:
               lower_hull.append(points[i]    )

     _construct_hull(_UpperCamelCase     ,   _UpperCamelCase     ,   _UpperCamelCase     ,   _UpperCamelCase    )
     _construct_hull(_UpperCamelCase     ,   _UpperCamelCase     ,   _UpperCamelCase     ,   _UpperCamelCase    )

     return sorted(_UpperCamelCase    )




def       _a      (		_lowercase   :      list[Point]     ,   _lowercase   :      Point     ,   _lowercase   :      Point     ,   _lowercase   :      set[Point]    ):





     '''simple docstring'''






     if points:
          __UpperCAmelCase      :					Optional[int]    				=     None
          __UpperCAmelCase      :					str    				=     float('''-inf'''    )
          __UpperCAmelCase      :					Optional[Any]    				=     []

          for p in points:
               __UpperCAmelCase      :					Dict    				=     _det(_UpperCamelCase     ,   _UpperCamelCase     ,   _UpperCamelCase    )

               if det > 0:
                    candidate_points.append(_UpperCamelCase    )

                    if det > extreme_point_distance:
                         __UpperCAmelCase      :					int    				=     det
                         __UpperCAmelCase      :					Union[str, Any]    				=     p

          if extreme_point:
               _construct_hull(_UpperCamelCase     ,   _UpperCamelCase     ,   _UpperCamelCase     ,   _UpperCamelCase    )
               convex_set.add(_UpperCamelCase    )
               _construct_hull(_UpperCamelCase     ,   _UpperCamelCase     ,   _UpperCamelCase     ,   _UpperCamelCase    )




def       _a      (		_lowercase   :      list[Point]    ):





     '''simple docstring'''






     __UpperCAmelCase      :					str    				=     sorted(_validate_input(_UpperCamelCase    )    )
     __UpperCAmelCase      :					Union[str, Any]    				=     len(_UpperCamelCase    )

     __UpperCAmelCase      :					Any    				=     points[:2]
     for i in range(2     ,   _UpperCamelCase    ):
          __UpperCAmelCase      :					List[Any]    				=     _det(convex_hull[1]     ,   convex_hull[0]     ,   points[i]    )
          if det > 0:
               convex_hull.insert(0     ,   points[i]    )
               break
          elif det < 0:
               convex_hull.append(points[i]    )
               break
          else:
               __UpperCAmelCase      :					Tuple    				=     points[i]
     i += 1

     for j in range(_UpperCamelCase     ,   _UpperCamelCase    ):
          if (
              _det(convex_hull[0]     ,   convex_hull[-1]     ,   points[j]    ) > 0
              and _det(convex_hull[-1]     ,   convex_hull[0]     ,   points[1]    ) < 0
          ):
               # The point lies within the convex hull
               continue

          convex_hull.insert(0     ,   points[j]    )
          convex_hull.append(points[j]    )
          while _det(convex_hull[0]     ,   convex_hull[1]     ,   convex_hull[2]    ) >= 0:
               del convex_hull[1]
          while _det(convex_hull[-1]     ,   convex_hull[-2]     ,   convex_hull[-3]    ) <= 0:
               del convex_hull[-2]

    # `convex_hull` is contains the convex hull in circular order
     return sorted(convex_hull[1:] if len(_UpperCamelCase    ) > 3 else convex_hull    )




def       _a      (		):





     '''simple docstring'''






     __UpperCAmelCase      :					Union[str, Any]    				=     [
         (0, 3),
         (2, 2),
         (1, 1),
         (2, 1),
         (3, 0),
         (0, 0),
         (3, 3),
         (2, -1),
         (2, -4),
         (1, -3),
     ]
     # the convex set of points is
     # [(0, 0), (0, 3), (1, -3), (2, -4), (3, 0), (3, 3)]
     __UpperCAmelCase      :					List[str]    				=     convex_hull_bf(_UpperCamelCase    )

     __UpperCAmelCase      :					Optional[Any]    				=     convex_hull_recursive(_UpperCamelCase    )
     assert results_bf == results_recursive

     __UpperCAmelCase      :					Dict    				=     convex_hull_melkman(_UpperCamelCase    )
     assert results_bf == results_melkman

     print(_UpperCamelCase    )


if __name__ == "__main__":
      main()
'''simple docstring'''




from typing import Optional, Tuple

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_openai import OpenAIGPTTokenizer


__snake_case  : Union[str, Any]		       =    logging.get_logger(__name__)

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

__snake_case  : List[str]		       =    {
    'vocab_file': {'openai-gpt': 'https://huggingface.co/openai-gpt/resolve/main/vocab.json'},
    'merges_file': {'openai-gpt': 'https://huggingface.co/openai-gpt/resolve/main/merges.txt'},
    'tokenizer_file': {'openai-gpt': 'https://huggingface.co/openai-gpt/resolve/main/tokenizer.json'},
}

__snake_case  : Optional[int]		       =    {
    'openai-gpt': 512,
}




class       __UpperCAmelCase							(							_UpperCamelCase	):





       '''simple docstring'''



       __lowercase   :   int  					=							VOCAB_FILES_NAMES
       __lowercase   :   int  					=							PRETRAINED_VOCAB_FILES_MAP
       __lowercase   :   str  					=							PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
       __lowercase   :   Optional[Any]  					=							['input_ids', 'attention_mask']
       __lowercase   :   List[Any]  					=							OpenAIGPTTokenizer

       def __init__( self       ,	_SCREAMING_SNAKE_CASE=None       ,	_SCREAMING_SNAKE_CASE=None       ,	_SCREAMING_SNAKE_CASE=None       ,	_SCREAMING_SNAKE_CASE="<unk>"       ,	**_SCREAMING_SNAKE_CASE					)						->	Optional[Any]:
           super().__init__(_SCREAMING_SNAKE_CASE       ,	_SCREAMING_SNAKE_CASE       ,	tokenizer_file=_SCREAMING_SNAKE_CASE       ,	unk_token=_SCREAMING_SNAKE_CASE       ,	**_SCREAMING_SNAKE_CASE					)

       @property
       def    __A			( self					)						->	Optional[Any]:
           return True

       def    __A			( self       ,	_SCREAMING_SNAKE_CASE       ,	_SCREAMING_SNAKE_CASE = None					)						->	Tuple[str]:
           A_      =  self._tokenizer.model.save(_SCREAMING_SNAKE_CASE       ,	name=_SCREAMING_SNAKE_CASE					)
           return tuple(_SCREAMING_SNAKE_CASE					)






