prefixsum type problem
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\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;//will give the unmared idx \n        \n        for(int i=0;i<nums.size();i++){\n            sum+=nums[i];\n            pq.push({nums[i],i});\n        }\n        unordered_set<int>st;//will store marked idx\n        for(int i=0;i<queries.size();i++){\n            if(st.find(queries[i][0])==st.end()){//not marked\n            st.insert(queries[i][0]);\n            sum=sum-nums[queries[i][0]];\n\n\n            }\n            \n            int x=queries[i][1];\n            while(pq.size()!=0&&x>0){\n                int unmarked=pq.top().second;\n                \n                if(st.find(unmarked)!=st.end()){\n                    pq.pop();\n                    continue;\n                }\n                  st.insert(unmarked);\n                  pq.pop();\n                  sum=sum-nums[unmarked];\n\n\n                x--;\n            }\n            ans.push_back(sum);\n\n        }\n        \n        return ans;\n        \n\n\n        \n    }\n};\n```
['Heap (Priority Queue)', 'C++']