100% faster solution in c++
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n- O(nlog(n))\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n- O(n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    typedef pair<int,int> Pr;\n    struct  MaxHeap{\n        bool operator()(Pr p1, Pr p2){\n            return p1.second<p2.second;\n        }\n    };\n    \n    int maxRemoval(vector<int>& nums, vector<vector<int>>& queries) {\n        int n = nums.size();\n\n        sort(queries.begin(), queries.end());\n\n        int cnt =0;\n        int ind =0;\n        int ans=0;\n\n        priority_queue<Pr, vector<Pr>, MaxHeap> pq;\n        unordered_map<int,int> m;\n\n        for(int i=0;i<n;i++){\n            // pull all entries from q\n            while(ind<queries.size()&&queries[ind][0]==i){\n                pq.push({queries[ind][0],queries[ind][1]});\n                ind++;\n            }\n\n\n            while(nums[i]>cnt){\n                if(pq.empty()) return -1;\n                Pr p = pq.top();\n                pq.pop();\n\n                if(p.second<i) return -1;\n\n                cnt++;\n                m[p.second]++;\n            }\n            \n            // remove all close entry\n            cnt-=m[i];\n            ans+=m[i];\n        }\n\n        return queries.size()-ans;\n    }\n};\n```
['C++']