




from __future__ import annotations

from collections import deque
from enum import Enum
from math import atana, degrees
from sys import maxsize
class 				__snake_case     (_a						):
				lowerCAmelCase__			=   1
				lowerCAmelCase__			=   2
				lowerCAmelCase__			=   3



				def __repr__(					self					:						int					)     ->			Dict:





								'''simple docstring'''




								return f"{self.__class__.__name__}.{self.name}"






def 							_UpperCAmelCase     (UpperCamelCase_       :       tuple[int, int]					,			UpperCamelCase_       :       int					,			UpperCamelCase_       :       int				):
				'''simple docstring'''
				_lowerCAmelCase    ,			_lowerCAmelCase			:			Optional[int]        =					point
				return degrees(atana(y - miny					,			x - minx				)				)




def 							_UpperCAmelCase     (UpperCamelCase_       :       tuple[int, int]					,			UpperCamelCase_       :       tuple[int, int]					,			UpperCamelCase_       :       tuple[int, int]				):
				'''simple docstring'''
				_lowerCAmelCase    ,			_lowerCAmelCase			:			Union[str, Any]        =					starting
				_lowerCAmelCase    ,			_lowerCAmelCase			:			List[str]        =					via
				_lowerCAmelCase    ,			_lowerCAmelCase			:			Union[str, Any]        =					target
				_lowerCAmelCase			:			Any        =					degrees(atana(ya - ya					,			xa - xa				)				)
				via_angle %= 360
				_lowerCAmelCase			:			Optional[int]        =					degrees(atana(ya - ya					,			xa - xa				)				)
				target_angle %= 360
				# t-
				#  \ \
				#   \ v
				#    \|
				#     s
				# via_angle is always lower than target_angle, if direction is left.
				# If they are same, it means they are on a same line of convex hull.
				if target_angle > via_angle:
								return Direction.left
				elif target_angle == via_angle:
								return Direction.straight
				else:
								return Direction.right





def 							_UpperCAmelCase     (UpperCamelCase_       :       list[tuple[int, int]]				):
				'''simple docstring'''

				if len(UpperCamelCase_				) <= 2:
								# There is no convex hull
								raise ValueError("""graham_scan: argument must contain more than 3 points."""				)
				if len(UpperCamelCase_				) == 3:
								return points
				# find the lowest and the most left point
				_lowerCAmelCase			:			Any        =					0
				_lowerCAmelCase    ,			_lowerCAmelCase			:			int        =					maxsize, maxsize
				for i, point in enumerate(UpperCamelCase_				):
								_lowerCAmelCase			:			str        =					point[0]
								_lowerCAmelCase			:			Dict        =					point[1]
								if y < miny:
												_lowerCAmelCase			:			Optional[int]        =					y
												_lowerCAmelCase			:			Optional[Any]        =					x
												_lowerCAmelCase			:			Optional[Any]        =					i
								if y == miny and x < minx:
												_lowerCAmelCase			:			Any        =					x
												_lowerCAmelCase			:			Optional[Any]        =					i

    # remove the lowest and the most left point from points for preparing for sort
				points.pop(UpperCamelCase_				)

				_lowerCAmelCase			:			Union[str, Any]        =					sorted(UpperCamelCase_					,			key=lambda UpperCamelCase_				: angle_comparer(UpperCamelCase_					,			UpperCamelCase_					,			UpperCamelCase_				)				)
				# This insert actually costs complexity,
				# and you should instead add (minx, miny) into stack later.
				# I'm using insert just for easy understanding.
				sorted_points.insert(0					,			(minx, miny)				)

				_lowerCAmelCase			:			deque[tuple[int, int]]        =					deque()
				stack.append(sorted_points[0]				)
				stack.append(sorted_points[1]				)
				stack.append(sorted_points[2]				)
				# In any ways, the first 3 points line are towards left.
				# Because we sort them the angle from minx, miny.
				_lowerCAmelCase			:			str        =					Direction.left

				for i in range(3					,			len(UpperCamelCase_				)				):
								while True:
												_lowerCAmelCase			:			Optional[Any]        =					stack[-2]
												_lowerCAmelCase			:			int        =					stack[-1]
												_lowerCAmelCase			:			Optional[Any]        =					sorted_points[i]
												_lowerCAmelCase			:			Tuple        =					check_direction(UpperCamelCase_					,			UpperCamelCase_					,			UpperCamelCase_				)

												if next_direction == Direction.left:
																_lowerCAmelCase			:			Optional[Any]        =					Direction.left
																break
												if next_direction == Direction.straight:
																if current_direction == Direction.left:
																				# We keep current_direction as left.
																				# Because if the straight line keeps as straight,
																				# we want to know if this straight line is towards left.
																				break
																elif current_direction == Direction.right:
																				# If the straight line is towards right,
																				# every previous points on those straigh line is not convex hull.
																				stack.pop()
												if next_direction == Direction.right:
																stack.pop()
								stack.append(sorted_points[i]				)
				return list(UpperCamelCase_				)









"""simple docstring"""



from transformers import PretrainedConfig




class        lowerCAmelCase__       (  __magic_name__					):
   SCREAMING_SNAKE_CASE_					      ='''custom'''
   def __init__(						self	:     Any				,       snake_case__	:     Any=1				,       **snake_case__	:     Optional[Any]				):


        '''simple docstring'''
        UpperCAmelCase__		:  List[str]				=				attribute
        super().__init__(**snake_case__				)




class        lowerCAmelCase__       (  __magic_name__					):
   SCREAMING_SNAKE_CASE_					      ='''custom'''
   def __init__(						self	:     List[str]				,       snake_case__	:     Tuple=1				,       **snake_case__	:     str				):


        '''simple docstring'''
        UpperCAmelCase__		:  List[str]				=				attribute


