Easy 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<!-- 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 {\npublic:\n    vector<long long> unmarkedSumArray(vector<int>& nums, vector<vector<int>>& queries) {\n        set<pair<int,int>>s;\n        long long sum = 0;\n        for(int i=0;i<nums.size();i++) {\n            s.insert({nums[i], i});\n            sum+=nums[i];\n        }\n        vector<long long>ans;\n        for(int i=0;i<queries.size();i++) {\n            int idx = queries[i][0];\n            int k = queries[i][1];\n            if(s.find({nums[idx], idx}) != s.end()) {\n                s.erase({nums[idx], idx});\n                sum-=nums[idx];\n            }\n            for(int i=1; i<=k; i++) {\n                if(s.empty()) break;\n                auto it = s.begin();\n                sum-=it->first;\n                s.erase(it);\n            }\n            ans.push_back(sum);\n        }\n        return ans;\n    }\n};\n```
['C++']