Straight-forward Answer  || Read Comments, You Will Understand It💯💯
Code\n\nclass Solution {\npublic:\n    vector<long long> unmarkedSumArray(vector<int>& nums, vector<vector<int>>& queries) {\n        // if less than ki marked 
# Code\n```\nclass Solution {\npublic:\n    vector<long long> unmarkedSumArray(vector<int>& nums, vector<vector<int>>& queries) {\n        // if less than ki marked then marke all the elements\n        // first mark all the kith unmarked elemnets \n        // if more than kith elements are unmarked then mark elements with smallest indices\n        \n        \n        //Return an array answer of size m where answer[i] is the \n        //sum of unmarked elements in the array after the ith query.\n\n\n        // 1. create hashtable and priority queue\n        unordered_map<int,int> mp;\n        priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> pq;\n        long long sum = 0;\n\n        for(int i=0;i<nums.size();i++)\n        {\n            sum += nums[i];\n            mp[i] = nums[i];\n            // pq.push({ele,index})\n            pq.push({nums[i],i});\n        }\n        int m = queries.size();\n        vector<long long> res(m,0);\n        for(int i=0;i<m;i++)\n        {\n            int idx = queries[i][0];\n            int cnt = queries[i][1];\n            // subtract the element at idx\n            sum -= mp[idx];\n            // mark the element as 0 in map\n            mp[idx] = 0;\n\n            while(cnt>0 && pq.empty()==false)\n            {\n                // using priority queue for minimum element marking\n\n                int idx_pq = pq.top().second;\n                int ele = mp[idx_pq];\n                if(ele > 0)\n                {\n                    cout<<"ele: "<<ele<<endl;\n                    sum -= ele;\n                    mp[idx_pq] = 0;\n                    cnt--;\n                }\n                pq.pop();\n              \n            }\n            if(sum >= 0)\n            {\n                res[i] = sum;\n\n            }\n        }\n\n        return res;\n\n    }\n};\n```
['Array', 'Hash Table', 'Heap (Priority Queue)', 'C++']