Solution using C++,Java,Python
Beats 100% in Time and Space Complexity \n# Complexity\n- Time complexity: O(10^5+ n log(10^5) \n Add your time complexity here, e.g. O(n) \n\n- Space complexit
# Beats 100% in Time and Space Complexity \n# Complexity\n- Time complexity: $$O(10^5+ n log(10^5) $$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(10^5 + q)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n# Java\n``` java\nclass FenwickTree {\n  public FenwickTree(int n) {\n    vals = new int[n + 1];\n  }\n\n  public void update(int i, int val) {\n    while (i < vals.length) {\n      vals[i] = Math.max(vals[i], val);\n      i += lowbit(i);\n    }\n  }\n\n  public int get(int i) {\n    int res = 0;\n    while (i > 0) {\n      res = Math.max(res, vals[i]);\n      i -= lowbit(i);\n    }\n    return res;\n  }\n\n  private int[] vals;\n\n  private static int lowbit(int i) {\n    return i & -i;\n  }\n}\n\nclass Solution {\n  public List<Boolean> getResults(int[][] queries) {\n    final int n = Math.min(50000, queries.length * 3);\n    List<Boolean> ans = new ArrayList<>();\n    FenwickTree tree = new FenwickTree(n + 1);\n    TreeSet<Integer> obstacles = new TreeSet<>(Arrays.asList(0, n)); // sentinel values\n\n    for (int[] query : queries) {\n      final int type = query[0];\n      if (type == 1) {\n        final int x = query[1];\n        obstacles.add(x);\n      }\n    }\n\n    Iterator<Integer> it = obstacles.iterator();\n    int x1 = it.next();\n    while (it.hasNext()) {\n      final int x2 = it.next();\n      tree.update(x2, x2 - x1);\n      x1 = x2;\n    }\n\n    for (int i = queries.length - 1; i >= 0; --i) {\n      final int type = queries[i][0];\n      final int x = queries[i][1];\n      if (type == 1) {\n        final Integer next = obstacles.higher(x);\n        final Integer prev = obstacles.lower(x);\n        if (next != null)\n          tree.update(next, next - prev);\n        obstacles.remove(x);\n      } else {\n        final int sz = queries[i][2];\n        final int prev = obstacles.floor(x);\n        ans.add(tree.get(prev) >= sz || x - prev >= sz);\n      }\n    }\n\n    Collections.reverse(ans);\n    return ans;\n  }\n}\n```\n# C++\n``` cpp\nclass FenwickTree {\n public:\n  FenwickTree(int n) : vals(n + 1) {}\n\n  void update(int i, int val) {\n    while (i < vals.size()) {\n      vals[i] = max(vals[i], val);\n      i += lowbit(i);\n    }\n  }\n\n  int get(int i) const {\n    int res = 0;\n    while (i > 0) {\n      res = max(res, vals[i]);\n      i -= lowbit(i);\n    }\n    return res;\n  }\n\n private:\n  vector<int> vals;\n\n  static int lowbit(int i) {\n    return i & -i;\n  }\n};\n\nclass Solution {\n public:\n  vector<bool> getResults(vector<vector<int>>& queries) {\n    const int n = min(50000, static_cast<int>(queries.size()) * 3);\n    vector<bool> ans;\n    FenwickTree tree(n + 1);\n    set<int> obstacles{0, n};  // sentinel values\n\n    for (const vector<int>& query : queries) {\n      const int type = query[0];\n      if (type == 1) {\n        const int x = query[1];\n        obstacles.insert(x);\n      }\n    }\n\n    for (auto it = obstacles.begin(); std::next(it) != obstacles.end(); ++it) {\n      const int x1 = *it;\n      const int x2 = *std::next(it);\n      tree.update(x2, x2 - x1);\n    }\n\n    for (int i = queries.size() - 1; i >= 0; --i) {\n      const int type = queries[i][0];\n      const int x = queries[i][1];\n      if (type == 1) {\n        const auto it = obstacles.find(x);\n        if (next(it) != obstacles.end())  // x is not the last element.\n          tree.update(*next(it), *next(it) - *prev(it));\n        obstacles.erase(it);\n      } else {\n        const int sz = queries[i][2];\n        const auto it = obstacles.upper_bound(x);\n        const int prev = *std::prev(it);\n        ans.push_back(tree.get(prev) >= sz || x - prev >= sz);\n      }\n    }\n\n    return {ans.rbegin(), ans.rend()};\n  }\n};\n```\n# Python\n``` py\nfrom sortedcontainers import SortedList\n\n\nclass FenwickTree:\n  def __init__(self, n: int):\n    self.vals = [0] * (n + 1)\n\n  def update(self, i: int, val: int) -> None:\n    while i < len(self.vals):\n      self.vals[i] = max(self.vals[i], val)\n      i += FenwickTree.lowtree(i)\n\n  def get(self, i: int) -> int:\n    res = 0\n    while i > 0:\n      res = max(res, self.vals[i])\n      i -= FenwickTree.lowtree(i)\n    return res\n\n  @staticmethod\n  def lowtree(i: int) -> int:\n    return i & -i\n\n\nclass Solution:\n  def getResults(self, queries: List[List[int]]) -> List[bool]:\n    n = min(50000, len(queries) * 3)\n    ans = []\n    tree = FenwickTree(n + 1)\n    obstacles = SortedList([0, n])  # sentinel values\n\n    for query in queries:\n      type = query[0]\n      if type == 1:\n        x = query[1]\n        obstacles.add(x)\n\n    for x1, x2 in itertools.pairwise(obstacles):\n      tree.update(x2, x2 - x1)\n\n    for query in reversed(queries):\n      type = query[0]\n      x = query[1]\n      if type == 1:\n        i = obstacles.index(x)\n        next = obstacles[i + 1]\n        prev = obstacles[i - 1]\n        obstacles.remove(x)\n        tree.update(next, next - prev)\n      else:\n        sz = query[2]\n        i = obstacles.bisect_right(x)\n        prev = obstacles[i - 1]\n        ans.append(tree.get(prev) >= sz or x - prev >= sz)\n\n    return ans[::-1]\n```
['C++', 'Java', 'Python3']