Very Easy Solution || Python-3
Time Complexity:- Overall Time Complexity of this code is O(m(n + mlog(n))) \n\nSpace Complexity:- Overall Space Complexity is O(n + m)\n\n\n\nimport heapq as h
**Time Complexity:-** *Overall Time Complexity of this code is O(m*(n + m*log(n)))* \n\n**Space Complexity:-** *Overall Space Complexity is O(n + m)*\n\n\n```\nimport heapq as hq\n\nclass Solution:\n    def unmarkedSumArray(self, nums: List[int], queries: List[List[int]]) -> List[int]:\n        # Initialize variables\n        m = len(nums)  # Length of nums list\n        mark = set()  # Set to keep track of marked indices\n        ans = []  # List to store final answers\n        heap = [(value, i) for i, value in enumerate(nums)]  # Create a heap with values and indices\n        hq.heapify(heap)  # Convert the list into a heap\n        Total = sum(nums)  # Calculate the initial sum of all elements in nums\n        \n        # Iterate through the queries\n        for index, k in queries:\n            if index not in mark:  # Check if index is already marked\n                mark.add(index)  # Mark the index\n                Total -= nums[index]  # Subtract the value at index from Total sum\n            \n            # Iterate while k is greater than 0 and there are elements in the heap\n            while k > 0 and heap:\n                value, idx = hq.heappop(heap)  # Pop the smallest element from the heap\n                if idx not in mark:  # Check if index is already marked\n                    mark.add(idx)  # Mark the index\n                    Total -= value  # Subtract the popped value from Total sum\n                    k -= 1  # Decrement the value of k by 1\n            \n            ans.append(Total)  # Append the current Total sum to the answer list\n        \n        return ans  # Return the list of final answers\n\n```
['Heap (Priority Queue)', 'Python3']