
from __future__ import annotations

import sys
from collections import deque
from typing import Generic, TypeVar

lowerCamelCase__	=							TypeVar("T")







class        lowerCAmelCase__      (   Generic[T]	):
						UpperCamelCase_							: deque[T]  # Cache store of keys
						UpperCamelCase_							: set[T]  # References of the keys in cache
						UpperCamelCase_							: int	=		10  # Maximum capacity of cache

						def __init__(			self       ,							a				)					->      None:


								'''simple docstring'''

								_UpperCamelCase						    =	deque()
								_UpperCamelCase						    =	set()
								if not n:
										_UpperCamelCase						    =	sys.maxsize
								elif n < 0:
										raise ValueError("""n should be an integer greater than 0."""				)
								else:
										_UpperCamelCase						    =	n

						def  A_				(			self       ,							a				)					->      None:


								'''simple docstring'''

								if x not in self.key_reference:
										if len(self.dq_store				) == LRUCache._MAX_CAPACITY:
												_UpperCamelCase						    =	self.dq_store.pop()
												self.key_reference.remove(a				)
								else:
										self.dq_store.remove(a				)

								self.dq_store.appendleft(a				)
								self.key_reference.add(a				)

						def  A_				(			self				)					->      None:


								'''simple docstring'''

								for k in self.dq_store:
										print(a				)







						def __repr__(			self				)					->      str:


								'''simple docstring'''

								return F'LRUCache({self._MAX_CAPACITY}) => {list(self.dq_store				)}'


if __name__ == "__main__":
		import doctest

		doctest.testmod()

		lowerCamelCase__	=							LRUCache(4)
		lru_cache.refer("A")
		lru_cache.refer(2)
		lru_cache.refer(3)
		lru_cache.refer("A")
		lru_cache.refer(4)
		lru_cache.refer(5)
		lru_cache.display()

		print(lru_cache)
		assert str(lru_cache) == "LRUCache(4) => [5, 4, 'A', 3]"





from math import isclose, sqrt


def 							__A(lowerCAmelCase						,  lowerCAmelCase						,  lowerCAmelCase )		->				tuple[float, float, float]:

		"""simple docstring"""






		_UpperCamelCase						    =	point_y / 4 / point_x
		_UpperCamelCase						    =	2 * normal_gradient / (1 + normal_gradient * normal_gradient)
		_UpperCamelCase						    =	(1 - normal_gradient * normal_gradient) / (
		    1 + normal_gradient * normal_gradient
		)
		_UpperCamelCase						    =	(sa - ca * incoming_gradient) / (ca + sa * incoming_gradient)

		# to find the next point, solve the simultaeneous equations:
		# y^2 + 4x^2 = 100
		# y - b = m * (x - a)
		# ==> A x^2 + B x + C = 0
		_UpperCamelCase						    =	outgoing_gradient**2 + 4
		_UpperCamelCase						    =	2 * outgoing_gradient * (point_y - outgoing_gradient * point_x)
		_UpperCamelCase						    =	(point_y - outgoing_gradient * point_x) ** 2 - 1_0_0

		_UpperCamelCase						    =	(
		    -linear_term - sqrt(linear_term**2 - 4 * quadratic_term * constant_term )
		) / (2 * quadratic_term)
		_UpperCamelCase						    =	(
		    -linear_term + sqrt(linear_term**2 - 4 * quadratic_term * constant_term )
		) / (2 * quadratic_term)

		# two solutions, one of which is our input point
		_UpperCamelCase						    =	x_minus if isclose(lowerCAmelCase						,  lowerCAmelCase ) else x_plus
		_UpperCamelCase						    =	point_y + outgoing_gradient * (next_x - point_x)

		return next_x, next_y, outgoing_gradient


def 							__A(lowerCAmelCase = 1.4						,  lowerCAmelCase = -9.6 )		->				int:

		"""simple docstring"""






		_UpperCamelCase						    =	0
		_UpperCamelCase						    =	first_x_coord
		_UpperCamelCase						    =	first_y_coord
		_UpperCamelCase						    =	(10.1 - point_y) / (0.0 - point_x)

		while not (-0.01 <= point_x <= 0.01 and point_y > 0):
				_UpperCamelCase    ,	_UpperCamelCase    ,	_UpperCamelCase						    =	next_point(lowerCAmelCase						,  lowerCAmelCase						,  lowerCAmelCase )
				num_reflections += 1

		return num_reflections


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



