
"""simple docstring"""



from __future__ import annotations

from collections.abc import Callable
from typing import Generic, TypeVar

UpperCamelCase__          =	TypeVar('T')
UpperCamelCase__          =	TypeVar('U')





class 				a			(					Generic[T, U]      ):



      def __init__(   self     ,	UpperCamelCase_     ,	UpperCamelCase_      ):
          UpperCAmelCase__	:      List[Any]     							=					key
          UpperCAmelCase__	:      Union[str, Any]     							=					val
          UpperCAmelCase__	:      DoubleLinkedListNode[T, U] | None     							=					None
          UpperCAmelCase__	:      DoubleLinkedListNode[T, U] | None     							=					None



      def __repr__(   self      ):
          return (
              F'''Node: key: {self.key}, val: {self.val}, '''
              F'''has next: {bool(self.next      )}, has prev: {bool(self.prev      )}'''
          )





class 				a			(					Generic[T, U]      ):



      def __init__(   self      ):
          UpperCAmelCase__	:      DoubleLinkedListNode[T, U]     							=					DoubleLinkedListNode(UpperCamelCase_     ,	UpperCamelCase_      )
          UpperCAmelCase__	:      DoubleLinkedListNode[T, U]     							=					DoubleLinkedListNode(UpperCamelCase_     ,	UpperCamelCase_      )
          UpperCAmelCase__							,							UpperCAmelCase__	:      Optional[Any]     							=					self.rear, self.head



      def __repr__(   self      ):
          UpperCAmelCase__	:      str     							=					['DoubleLinkedList']
          UpperCAmelCase__	:      List[str]     							=					self.head
          while node.next is not None:
              rep.append(str(UpperCamelCase_      )      )
              UpperCAmelCase__	:      List[Any]     							=					node.next
          rep.append(str(self.rear      )      )
          return ",\n    ".join(UpperCamelCase_      )



      def  __snake_case							(   self     ,	UpperCamelCase_      ):
          UpperCAmelCase__	:      int     							=					self.rear.prev

          # All nodes other than self.head are guaranteed to have non-None previous
          assert previous is not None

          UpperCAmelCase__	:      List[str]     							=					node
          UpperCAmelCase__	:      int     							=					previous
          UpperCAmelCase__	:      List[str]     							=					node
          UpperCAmelCase__	:      List[Any]     							=					self.rear



      def  __snake_case							(   self     ,	UpperCamelCase_      ):

          if node.prev is None or node.next is None:
              return None

          UpperCAmelCase__	:      Any     							=					node.next
          UpperCAmelCase__	:      Dict     							=					node.prev
          UpperCAmelCase__	:      Optional[int]     							=					None
          UpperCAmelCase__	:      Optional[Any]     							=					None
          return node





class 				a			(					Generic[T, U]      ):
      UpperCamelCase							:   dict[Callable[[T], U], LRUCache[T, U]]           =     {}



      def __init__(   self     ,	UpperCamelCase_      ):
          UpperCAmelCase__	:      DoubleLinkedList[T, U]     							=					DoubleLinkedList()
          UpperCAmelCase__	:      int     							=					capacity
          UpperCAmelCase__	:      Optional[int]     							=					0
          UpperCAmelCase__	:      Union[str, Any]     							=					0
          UpperCAmelCase__	:      Optional[Any]     							=					0
          UpperCAmelCase__	:      dict[T, DoubleLinkedListNode[T, U]]     							=					{}



      def __repr__(   self      ):
          return (
              F'''CacheInfo(hits={self.hits}, misses={self.miss}, '''
              F'''capacity={self.capacity}, current size={self.num_keys})'''
          )



      def __contains__(   self     ,	UpperCamelCase_      ):
          return key in self.cache



      def  __snake_case							(   self     ,	UpperCamelCase_      ):
          # Note: pythonic interface would throw KeyError rather than return None

          if key in self.cache:
              self.hits += 1
              UpperCAmelCase__	:      DoubleLinkedListNode[T, U]     							=					self.cache[key]
              UpperCAmelCase__	:      Union[str, Any]     							=					self.list.remove(self.cache[key]      )
              assert node == value_node

              # node is guaranteed not None because it is in self.cache
              assert node is not None
              self.list.add(UpperCamelCase_      )
              return node.val
          self.miss += 1
          return None



      def  __snake_case							(   self     ,	UpperCamelCase_     ,	UpperCamelCase_      ):

          if key not in self.cache:
              if self.num_keys >= self.capacity:
                  # delete first node (oldest) when over capacity
                  UpperCAmelCase__	:      Tuple     							=					self.list.head.next

                  # guaranteed to have a non-None first node when num_keys > 0
                  # explain to type checker via assertions
                  assert first_node is not None
                  assert first_node.key is not None
                  assert (
                      self.list.remove(UpperCamelCase_      ) is not None
                  )  # node guaranteed to be in list assert node.key is not None

                  del self.cache[first_node.key]
                  self.num_keys -= 1
              UpperCAmelCase__	:      Tuple     							=					DoubleLinkedListNode(UpperCamelCase_     ,	UpperCamelCase_      )
              self.list.add(self.cache[key]      )
              self.num_keys += 1

          else:
              # bump node to the end of the list, update value
              UpperCAmelCase__	:      Optional[int]     							=					self.list.remove(self.cache[key]      )
              assert node is not None  # node guaranteed to be in list
              UpperCAmelCase__	:      Optional[int]     							=					value
              self.list.add(UpperCamelCase_      )



      @classmethod
      def  __snake_case							(   cls     ,	UpperCamelCase_ = 128      ):

          def cache_decorator_inner(UpperCamelCase_      ) -> Callable[..., U]:
              def cache_decorator_wrapper(*UpperCamelCase_      ) -> U:
                  if func not in cls.decorator_function_to_instance_map:
                      UpperCAmelCase__	:      List[str]     							=					LRUCache(UpperCamelCase_      )

                  UpperCAmelCase__	:      Any     							=					cls.decorator_function_to_instance_map[func].get(args[0]      )
                  if result is None:
                      UpperCAmelCase__	:      str     							=					func(*UpperCamelCase_      )
                      cls.decorator_function_to_instance_map[func].put(args[0]     ,	UpperCamelCase_      )
                  return result

              def cache_info() -> LRUCache[T, U]:
                  return cls.decorator_function_to_instance_map[func]

              setattr(UpperCamelCase_     ,	'cache_info'     ,	UpperCamelCase_      )  # noqa: B010

              return cache_decorator_wrapper

          return cache_decorator_inner


if __name__ == "__main__":
    import doctest

    doctest.testmod()



"""simple docstring"""



def 					lowerCamelCase   (     _snake_case    ,_snake_case ):
    return int((input_a, input_a).count(0 ) == 0 )
def 					lowerCamelCase   (     ):
    assert and_gate(0    ,0 ) == 0
    assert and_gate(0    ,1 ) == 0
    assert and_gate(1    ,0 ) == 0
    assert and_gate(1    ,1 ) == 1


if __name__ == "__main__":
    test_and_gate()
    print(and_gate(1, 0))
    print(and_gate(0, 0))
    print(and_gate(0, 1))
    print(and_gate(1, 1))

