Simple solution without heap!
Simple solution, just read it!\n# Code\ncpp []\nclass Solution {\npublic:\n    vector<long long> unmarkedSumArray(vector<int>& arr, vector<vector<int>>& q) {\n 
Simple solution, just read it!\n# Code\n```cpp []\nclass Solution {\npublic:\n    vector<long long> unmarkedSumArray(vector<int>& arr, vector<vector<int>>& q) {\n        vector<pair<long long, long long>> a(arr.size());\n        vector<long long> ans(q.size(), 0);\n        vector<bool> vis(arr.size(), 0);\n        for(long long i=0; i<arr.size(); i++) a[i] = { arr[i], i };\n        sort(a.begin(), a.end());\n        long long sum = accumulate(arr.begin(), arr.end(), 0LL);\n        long long pt = 0;\n        for(long long i=0; i<q.size(); i++) {\n            long long x = q[i][0], y = q[i][1];\n            if(!vis[x]) sum -= arr[x], vis[x] = 1;\n            while(y) {\n                if(pt == arr.size()) break;\n                if(vis[a[pt].second]) pt++;\n                else {\n                    vis[a[pt].second] = 1;\n                    sum -= a[pt].first;\n                    y--;\n                }\n            }\n            ans[i] = sum;\n        }\n        return ans;\n    }\n};\n```
['C++']