C++ easy solution using priority_queue and hashmap
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    vector<long long> unmarkedSumArray(vector<int>& nums, vector<vector<int>>& queries) {
        vector<long long>v;
        priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>>pq;
        map<int,int>m;
        long long sum=0;
        for(int i=0;i<nums.size();i++)
        {
            sum=sum+nums[i];
            pq.push({nums[i],i});
            m[i]=0;
        }
        for(int i=0;i<queries.size();i++)
        {
            int k=queries[i][1];
            if(m[queries[i][0]]==0)
            {
                sum=sum-nums[queries[i][0]];
                m[queries[i][0]]=1;
            }
            while(k>0&&!pq.empty())
            {
                int num=pq.top().first;
                int idx=pq.top().second;
                pq.pop();
                if(m[idx]==0)
                {
                    sum=sum-num;
                    m[idx]=1;
                    k--;
                }

            }
            v.push_back(sum);
        }
        return v;

        
    }
};
```
['C++']