Easy C++ Solution || Ordered set
\n\n# Code\n\nclass Solution {\npublic:\n    vector<long long> unmarkedSumArray(vector<int>& nums, vector<vector<int>>& q) {\n        vector<long long>ans;\n   
\n\n# Code\n```\nclass Solution {\npublic:\n    vector<long long> unmarkedSumArray(vector<int>& nums, vector<vector<int>>& q) {\n        vector<long long>ans;\n        long long sum=0;\n        vector<bool>mark(nums.size(),false);\n        set<pair<long long,long long>>st;\n        for(int i=0;i<nums.size();i++)\n        {\n            sum+=nums[i];\n            st.insert({nums[i],i});\n        }\n        for(int i=0;i<q.size();i++)\n        {\n            int idx=q[i][0];\n            int k=q[i][1];\n            if(mark[idx]!=true)\n            {\n                mark[idx]=true;\n                sum-=nums[idx];\n            }\n            while(k and !st.empty())\n            {\n                pair<long long,long long>p=*(st.begin());\n                st.erase(p);\n                if(mark[p.second]!=true)\n                {\n                    mark[p.second]=true;\n                    sum-=p.first;\n                    k--;\n                }\n            }\n            ans.push_back(sum);\n        }\n        return ans;\n    }\n};\n```
['Array', 'Ordered Set', 'C++']