C++
\nusing LL = long long;\nclass Solution {\npublic:\n    vector<long long> unmarkedSumArray(vector<int>& nums, vector<vector<int>>& queries) {\n        vector<LL
```\nusing LL = long long;\nclass Solution {\npublic:\n    vector<long long> unmarkedSumArray(vector<int>& nums, vector<vector<int>>& queries) {\n        vector<LL>ret;\n        vector<pair<int,int>>NewData;\n        vector<bool>mark(nums.size(), false);\n        LL sum = 0;\n        int p = 0;\n        for(int i = 0; i < nums.size(); ++i) {\n\n            sum += nums[i];\n            NewData.push_back({nums[i], i});\n        }\n        sort(NewData.begin(), NewData.end());\n        for(int i = 0; i < queries.size(); i++) {\n            int idx = queries[i][0];\n            int k = queries[i][1];\n            if(mark[idx] == false){\n                mark[idx] = true;\n                sum -= nums[idx];\n            }\n            for(int j = 0; j < k; j++){\n                while(p < nums.size()){\n                    int I = NewData[p].second;\n                    if(mark[I] == false){\n                        sum -= nums[I];\n                        mark[I] = true;\n                        p++;\n                        break;\n                    }\n                    p++;\n                }              \n            }    \n            ret.push_back(sum);\n        }\n        return ret;\n    }\n};\n```
[]