






import doctest
from collections import deque

import numpy as np


class     _a							:






  """simple docstring"""





  def __init__(  self			)      ->			None:
     UpperCamelCase_						=  [2, 1, 2, -1]
     UpperCamelCase_						=  [1, 2, 3, 4]




  def  _UpperCAmelCase  (  self			)      ->			list[float]:
     UpperCamelCase_						=  len(self.first_signal			)
     UpperCamelCase_						=  len(self.second_signal			)

     UpperCamelCase_						=  max(_UpperCAmelCase		,		_UpperCAmelCase			)

     # create a zero matrix of max_length x max_length
     UpperCamelCase_						=  [[0] * max_length for i in range(_UpperCAmelCase			)]

     # fills the smaller signal with zeros to make both signals of same length
     if length_first_signal < length_second_signal:
        self.first_signal += [0] * (max_length - length_first_signal)
     elif length_first_signal > length_second_signal:
        self.second_signal += [0] * (max_length - length_second_signal)
     for i in range(_UpperCAmelCase			):
        UpperCamelCase_						=  deque(self.second_signal			)
        rotated_signal.rotate(_UpperCAmelCase			)
        for j, item in enumerate(_UpperCAmelCase			):
           matrix[i][j] += item

        # multiply the matrix with the first signal
     UpperCamelCase_						=  np.matmul(np.transpose(_UpperCAmelCase			)		,		np.transpose(self.first_signal			)			)

     # rounding-off to two decimal places
     return [round(_UpperCAmelCase		,		2			) for i in final_signal]


if __name__ == "__main__":
 doctest.testmod()













from __future__ import annotations

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

snake_case__   :						Dict													=   TypeVar("""T""")


class     _a							(	Generic[T]     ):






  """simple docstring"""





  A_						       = 42  # Cache store of keys
  A_						       = 42  # References of the keys in cache
  A_						       = 10  # Maximum capacity of cache




  def __init__(  self		,		_UpperCAmelCase			)      ->			None:
     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  _UpperCAmelCase  (  self		,		_UpperCAmelCase			)      ->			None:
     if x not in self.key_reference:
        if len(self.dq_store			) == LRUCache._MAX_CAPACITY:
           UpperCamelCase_						=  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  _UpperCAmelCase  (  self			)      ->			None:
     for k in self.dq_store:
        print(_UpperCAmelCase			)




  def __repr__(  self			)      ->			str:
     return f"""LRUCache({self._MAX_CAPACITY}) => {list(self.dq_store			)}"""


if __name__ == "__main__":
 import doctest

 doctest.testmod()

 snake_case__   :						LRUCache[str | int]													=   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]"





