Simple one priority queue solution 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nCheck the code\n# Approach\n<!-- Describe your approach to solving the problem. -->\nCheck the code\n\n# Complexity\n- Time complexity:O(nlog(m))\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(n + m)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    int maxRemoval(vector<int>& nums, vector<vector<int>>& queries) {\n        sort(queries.begin(), queries.end());\n        int n = nums.size(), m = queries.size();\n        priority_queue<int> pq;\n        vector<int> reduction(n + 1, 0);\n        int k = 0, usedCnt = 0;\n        for(int i = 0; i < n; i++) {\n            if(i > 0)   reduction[i] += reduction[i - 1];\n            while(k < m && queries[k][0] <= i)\n                pq.push(queries[k++][1]);\n            while(nums[i] > reduction[i]) {\n                if(pq.empty() || pq.top() < i)\n                    return -1;\n                usedCnt++;\n                int top = pq.top();\n                pq.pop();\n                reduction[i]++;\n                reduction[top + 1]--;\n            }\n        }\n        return m - usedCnt;\n    }\n};\n```
['C++']