Simple Python Solution | Beginner Friendly | Beats 95%
\n\n# Code\npython3 []\nclass Solution:\n    def unmarkedSumArray(self, nums: List[int], queries: List[List[int]]) -> List[int]:\n        s = sum(nums)\n       
\n\n# Code\n```python3 []\nclass Solution:\n    def unmarkedSumArray(self, nums: List[int], queries: List[List[int]]) -> List[int]:\n        s = sum(nums)\n        ans = []\n        marked = set()\n        q = []\n        for i in range(len(nums)):\n            q.append((nums[i], i))\n        q.sort()\n        q = deque(q)\n        for idx, count in queries:\n            if idx not in marked:\n                s -= nums[idx]\n                marked.add(idx)\n            while count and q:\n                n, i = q.popleft()\n                if i in marked:\n                    continue\n                s -= n\n                marked.add(i)\n                count -= 1\n            ans.append(s)\n        return ans\n```
['Hash Table', 'Queue', 'Sorting', 'Python3']