Python-3 Solution || O(NlogN)
Intution/Approach:- \nHere is the logic breakdown of the solution:\n-> A BIT class is defined with the following methods:\n-> init(self, num): Initializes the B
**Intution/Approach:-** \n*Here is the logic breakdown of the solution:\n-> A BIT class is defined with the following methods:\n-> __init__(self, num): Initializes the BIT with a given size num and creates an array arr of that size to store values.\n-> add(self, ind, val): Adds a value val at index ind in the BIT.\n-> query(self, ind): Performs a query operation up to the index ind in the BIT and returns the maximum value encountered during the query.\n-> The Solution class is defined which contains the method getResults(self, queries: List[List[int]]) -> List[bool]:\n-> The method takes a list of queries as input.\n-> A SortedList named unique_list is initialized to store unique values encountered during the queries.\n-> The size of the list is determined based on the length of the queries given.\n-> The first and last values (0 and size) are added to the unique_list.\n-> Iterates over each query in the given list:\n-> If the query operation is 1, a new value is added to the unique_list.\n-> A BIT named bit_tree is created with a size one more than size.\n-> Pairs of adjacent unique values from unique_list are used to update the BIT with the differences between these values.\n-> Reverses the list of queries and processes each query:\n-> If the query operation is 1:\n-> Updates the BIT by removing the value and adjusting the differences between adjacent values.\n-> If the query operation is 2:\n-> Determines if the given size can be accommodated between two values, and appends a boolean result to the answer list.\n-> The final answer list is reversed and returned.\n=> Overall, the code calculates the validity of the queries based on the given operations and value ranges stored in the BIT data structure. The logic efficiently handles the queries related to adding and removing values while checking if the specified conditions in the queries are met.*\n\n**Time complexity:-** *O(NlogN)*\n**Space complexity:-** *O(N)*\n\n```\nclass BIT:\n    def __init__(self, num):\n        self.num = num\n        self.arr = [0] * (num + 1)\n    def add(self, ind, val):\n        ind += 1\n        while ind <= self.num:\n            self.arr[ind] = max(val, self.arr[ind])\n            ind += ind & -ind\n    def query(self, ind):\n        ind += 1\n        ans = 0\n        while ind:\n            ans = max(ans, self.arr[ind])\n            ind -= ind & -ind\n        return ans\n\nfrom sortedcontainers import SortedList\n\nclass Solution:\n    def getResults(self, queries: List[List[int]) -> List[bool]:\n        unique_list = SortedList()\n        size = min(5 * 10 ** 4, len(queries) * 3)\n        unique_list.add(0)\n        unique_list.add(size)\n        \n        ans = []\n        for query in queries:\n            if query[0] == 1:\n                value = query[1]\n                unique_list.add(value)\n        \n        bit_tree = BIT(size + 1)\n        for value_1, value_2 in pairwise(unique_list):\n            bit_tree.add(value_2, value_2 - value_1)\n        \n        for query in reversed(queries):\n            if query[0] == 1:\n                value = query[1]\n                ind = unique_list.index(value)\n                after = unique_list[ind + 1]\n                before = unique_list[ind - 1]\n                unique_list.remove(value)\n                bit_tree.add(after, after - before)\n            else:\n                _, value, size = query\n                ind = unique_list.bisect_right(value)\n                before = unique_list[ind - 1]\n                ans.append(bit_tree.query(before) >= size or (value - before) >= size)\n            \n        ans.reverse()\n        return ans\n```
['Python3']