import time
class MyHashSet():
    def __init__(self,max_seconds):
        """
        Initialize your data structure here.
        """
        number = 1000001
        self.nums = [0 for i in range(number)]
        self.times=[0.0 for i in range(number)]
        self.max_seconds=max_seconds
    def add(self, key):
        """
        :type key: int
        :rtype: void
        """
        self.nums[key] = 1
        self.times[key]=time.clock()
    def remove(self, key):
        """
        :type key: int
        :rtype: void
        """
        self.nums[key] = 0
        self.times[key]=0.0
    def contains(self, key):
        """
        Returns true if this set contains the specified element
        :type key: int
        :rtype: bool
        """
        if self.nums[key] == 1:
            if time.clock()-self.times[key]<=self.max_seconds:
                return True
            else:
                self.nums[key] == 0
                self.times[key]=0.0
                return False
        else:
            return False
# Your MyHashSet object will be instantiated and called as such:
# obj = MyHashSet()
# obj.add(key)
# obj.remove(key)
# param_3 = obj.contains(key)

hash=MyHashSet(5)
hash.add(100)
hash.add(300)
hash.remove(300)
print(hash.contains(100))
time.sleep(15)
print(hash.contains(100))