100% BEATS || C++ || HEAP
Code\n\nclass Solution {\npublic:\n    vector<long long> unmarkedSumArray(vector<int>& nums, vector<vector<int>>& queries) {\n        vector<long long> ans ;\n 
# Code\n```\nclass Solution {\npublic:\n    vector<long long> unmarkedSumArray(vector<int>& nums, vector<vector<int>>& queries) {\n        vector<long long> ans ;\n        long long sum = 0;\n        priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> pq;\n        for(int i = 0; i < nums.size(); i++){\n            pq.push({nums[i],i});\n            sum += nums[i];\n        }\n        int k;\n        for(auto &i: queries){\n            k = i[1];\n            if(nums[i[0]]>0){\n                sum -= nums[i[0]];\n                nums[i[0]] *= -1;\n            }\n            while(!pq.empty() && k){\n                if(pq.size()>0 && nums[pq.top().second] < 0){\n                    pq.pop();\n                    continue;\n                }\n                sum -= nums[pq.top().second];\n                nums[pq.top().second] *= -1;\n                pq.pop();\n                k--;\n            }\n            ans.push_back(sum);\n        }\n        return ans;\n    }\n};\n```
['Heap (Priority Queue)', 'C++']