Simple Traversal with Priority Queue
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<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    private:\n    typedef long long ll;\npublic:\n    vector<long long> unmarkedSumArray(vector<int>& nums, vector<vector<int>>& queries) {\n        priority_queue<pair<ll,ll>,vector<pair<ll,ll>>,greater<pair<ll,ll>>> pq;\n        int n = nums.size();\n        ll sum = 0;\n        vector<ll> ans;\n        int m = queries.size();\n        vector<ll>vis(n,0);\n        for(int i=0;i<n;i++){\n            pq.push({nums[i],i});\n            sum+=nums[i];\n        }\n        for(auto & it: queries){\n            int idx = it[0];\n            int k = it[1];\n            if(!vis[idx]){\n                vis[idx]=1;\n                sum-=nums[idx];\n                \n            }\n            while(pq.size()>0 && k>0){\n              \n                ll v = pq.top().first;\n                ll id = pq.top().second;\n                pq.pop();\n                if(!vis[id]){\n                    vis[id]=1;\n                    sum-=v;\n                    k--;\n                }\n            }\n            ans.push_back(sum);\n        }\n        return ans;\n    }\n};\n```
['Heap (Priority Queue)', 'C++']