



from __future__ import annotations

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

a_								=       TypeVar("""T""")



class 			__lowerCAmelCase  (						Generic[T] ):
 lowerCAmelCase__							       =	42  # Cache store of keys
 lowerCAmelCase__							       =	42  # References of the keys in cache
 lowerCAmelCase__							       =	1_0  # Maximum capacity of cache




 def __init__(    self						,					__UpperCAmelCase					):



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




 def 							lowerCamelCase   (    self						,					__UpperCAmelCase					):



    '''simple docstring'''
    if x not in self.key_reference:
       if len(self.dq_store					) == LRUCache._MAX_CAPACITY:
          __lowerCamelCase    				=     self.dq_store.pop()
          self.key_reference.remove(__UpperCAmelCase					)
    else:
       self.dq_store.remove(__UpperCAmelCase					)

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




 def 							lowerCamelCase   (    self					):



    '''simple docstring'''
    for k in self.dq_store:
       print(__UpperCAmelCase					)




 def __repr__(    self					):



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


if __name__ == "__main__":
  import doctest

  doctest.testmod()

  a_								=       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 __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() = }")






