python heap
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:\n    def unmarkedSumArray(self, nums: List[int], queries: List[List[int]]) -> List[int]:\n\n\n        mark = [False for i in range(len(nums))]\n        s = sum(nums)\n        arr = [(nums[i], i) for i in range(len(nums))]\n        heapq.heapify(arr)\n        ans = []\n        for i, k in queries:\n            if not mark[i]:\n                s -= nums[i]\n                mark[i] = True\n            while k and arr:\n                if not mark[arr[0][1]]:\n                    mark[arr[0][1]] = True\n                    s -= arr[0][0]\n                    k -=1\n                heapq.heappop(arr)\n            ans.append(s)\n        return ans \n\n        \n```
['Heap (Priority Queue)', 'Python3']