EASY C++ SOLUTION USING PRIORITY QUEUE:)
Intuition\nAS WE HAVE TO MARK THE ELEMENTS AND ALSO THE SMALLEST ONES IT IS  GIVING A SENSE OF USING A PRIORITY QUEUE AND UNORDERED MAP FOR MARKING.\n\n# Approa
# Intuition\nAS WE HAVE TO MARK THE ELEMENTS AND ALSO THE SMALLEST ONES IT IS  GIVING A SENSE OF USING A PRIORITY QUEUE AND UNORDERED MAP FOR MARKING.\n\n# Approach\nTo solve the problem, use a min-heap to manage and extract the smallest unmarked elements efficiently. Initialize the heap with all array elements and track the sum of unmarked elements. For each query, mark the specified number of smallest elements, update the sum, and store the result.\n# Complexity\n-**** Time complexity:****\n- FOR MAKING QUEUE->NLOGN \n- FOR SUM->O(N)\n- FOR TRAVERSING IN WORST CASE TILL K ELEMENT->K==N(QNLOGN)\nO(nlogn)+O(n)+O(q\u22C5n\u22C5logn)=O(q\u22C5n\u22C5logn)\n- **Space complexity**:O(N+Q)\nPriority Queue:O(N)\nVECTOR STORE  Q QUERIES\n\n# Code\n```\nclass Solution {\npublic:\n    vector<long long> unmarkedSumArray(vector<int>& nums, vector<vector<int>>& queries) {\n        auto comp = [](const pair<int, int>& a, const pair<int, int>& b) {\n            if (a.second == b.second) {\n                return a.first > b.first;  // prefer smaller index if elements are the same\n            }\n            return a.second > b.second;  // prefer smaller element\n        };\n        \n        int n = nums.size();\n        priority_queue<pair<int, int>, vector<pair<int, int>>, decltype(comp)> pq(comp);\n        unordered_set<int> marked; // store marked indices\n\n        for (int i = 0; i < nums.size(); i++) {\n            pq.push(make_pair(i, nums[i]));\n        }\n\n        long long sum = 0;\n        for (int i = 0; i < nums.size(); i++) {\n            sum += nums[i];//total sum of  nums\n        }\n\n        vector<long long> ans;//contains final ans /ans of each query\n        pair<int, int> element;\n\n        for (int i = 0; i < queries.size(); i++) {\n            int index = queries[i][0];//u can just use them but it will be easy \n            int k = queries[i][1];\n\n       //IF INDEX NOT FOUND THEN PUT IN MAP AND MARK IT AND REDUCE THE SUM \n            if (marked.find(index) == marked.end()) {\n                marked.insert(index);\n                sum -=  nums[index];\n            }\n//NOW WE ALSO HAVE TO MARK K SMALLEST ELEMENT SO WE TRAVERSE IN A LOOP\n            while (k > 0 && !pq.empty()) {\n                element = pq.top();\n                pq.pop();\n//MARK THE SMALLEST VALUE AT TOP OF PQ\n                if (marked.find(element.first) == marked.end()) {\n                    marked.insert(element.first);\n                    sum -= element.second;//UPDATE SUM\n                    k--;\n                }\n            }\n//1 QUERY IS OVER PUSH ITS SUM IN ANS\n            ans.push_back(sum);\n        }\n\n        return ans;\n    }\n};\n\n\n```
['Hash Table', 'Heap (Priority Queue)', 'C++']