Java Solution
Code\n\n// class Solution {\n//     public List<Boolean> getResults(int[][] queries) {\n//         // boolean[] results = new boolean[queries.length];\n//      
# Code\n```\n// class Solution {\n//     public List<Boolean> getResults(int[][] queries) {\n//         // boolean[] results = new boolean[queries.length];\n//         List<Boolean> res = new ArrayList<>();\n//         boolean[] obstacles = new boolean[50001]; // assuming max x is 50000\n\n//         for (int i = 0; i < queries.length; i++) {\n//             if (queries[i][0] == 1) {\n//                 obstacles[queries[i][1]] = true; // build an obstacle at distance x\n//             } else {\n//                 int x = queries[i][1];\n//                 int sz = queries[i][2];\n//                 boolean canPlace = false;\n\n//                 for (int j = x; j >= 0; j--) {\n//                     if (!obstacles[j]) {\n//                         if (j + sz - 1 <= x) {\n//                             canPlace = true;\n//                             break;\n//                         }\n//                     } else {\n//                         break;\n//                     }\n//                 }\n\n//                 // results[i] = canPlace;\n//                 res.add(canPlace);\n//             }\n//         }\n\n//         return res;\n//     }\n// }\n```\n```\nimport java.util.*;\n\nclass Solution {\n    public List<Boolean> getResults(int[][] queries) {\n        NavigableMap<Integer, Integer> startEnd = new TreeMap<>();\n        startEnd.put(0, 50000);\n        NavigableMap<Integer, NavigableSet<Integer>> lenStart = new TreeMap<>();\n        NavigableSet<Integer> set = new TreeSet<>();\n        set.add(0);\n        lenStart.put(50000, set);\n        List<Boolean> result = new ArrayList<>();\n        for (int[] query : queries) {\n            if (query[0] == 1) {\n                int x = query[1];\n                int prev = startEnd.floorKey(x);\n                int end = startEnd.get(prev);\n                startEnd.put(prev, x);\n                startEnd.put(x, end);\n                NavigableSet<Integer> starts = lenStart.get(end - prev);\n                if (starts.size() == 1) {\n                    lenStart.remove(end - prev);\n                } else {\n                    starts.remove(prev);\n                }\n                lenStart.computeIfAbsent(x - prev, a -> new TreeSet<>()).add(prev);\n                lenStart.computeIfAbsent(end - x, a -> new TreeSet<>()).add(x);\n            } else {\n                int x = query[1];\n                int sz = query[2];\n                Integer size = lenStart.ceilingKey(sz);\n                boolean found = false;\n                while (size != null) {\n                    int firstStart = lenStart.get(size).first();\n                    if (x - firstStart >= sz) {\n                        found = true;\n                        result.add(true);\n                        break;\n                    }\n                    size = lenStart.higherKey(size);\n                }\n                if (!found) {\n                    result.add(false);\n                }\n            }\n        }\n        return result;\n    }\n}\n```
['Java']