JavaScript
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```\n/**\n * @param {number[]} nums\n * @param {number[][]} queries\n * @return {number[]}\n */\nvar unmarkedSumArray = function(nums, queries) {\n    const pq = new PriorityQueue({\n      compare: (e1, e2) => {\n        if (e1.value > e2.value) return 1;\n        if (e1.value < e2.value) return -1;\n\n        return e1.index < e2.index ? -1 : 1;\n      }\n    });\n    nums.forEach((e, i) => {\n         pq.enqueue({ index: i, value: e });\n    });\n    let sum = nums.reduce((a, c) => a + c);\n    const marked = new Set();\n    const ans = [];\n    for (let [i, k] of queries) {\n        if (!marked.has(i)) {\n            sum -= nums[i];\n            marked.add(i);\n        }\n        while (k && !pq.isEmpty()) {\n            const e = pq.dequeue();\n            if (!marked.has(e.index)) {\n                sum -= nums[e.index];\n                marked.add(e.index);\n                k--;\n            }\n        }\n        ans.push(sum);\n    }\n    return ans;\n};\n```
['JavaScript']