Easy C++ Solution || (Using Priority_Queue) ✅✅
Code\n\nclass Solution {\npublic:\n    vector<long long> unmarkedSumArray(vector<int>& nums, vector<vector<int>>& queries) {\n        int n=nums.size();\n      
# Code\n```\nclass Solution {\npublic:\n    vector<long long> unmarkedSumArray(vector<int>& nums, vector<vector<int>>& queries) {\n        int n=nums.size();\n        int m=queries.size();\n        priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> pq;\n        long long sum=0;;\n        for(int i=0;i<n;i++){\n            sum+=nums[i];\n            pq.push({nums[i],i});\n        }\n        \n        vector<long long> ans(m,0);\n        unordered_set<int> mark;\n        \n        for(int i=0;i<m;i++){\n            if(mark.find(queries[i][0])==mark.end()){\n                sum-=nums[queries[i][0]];\n                mark.insert(queries[i][0]);\n            }\n            int j=queries[i][1];\n            while(j!=0 && !pq.empty()){\n                int a=pq.top().first;\n                int b=pq.top().second;\n                pq.pop();\n                if(mark.find(b)!=mark.end()){\n                    continue;\n                }\n                mark.insert(b);\n                sum-=a;\n                j--;\n            }\n            ans[i]=sum;\n        }\n        return ans;\n    }\n};\n```
['Heap (Priority Queue)', 'C++']