Made Easy solution, simple to understand with comment
\nclass Solution {    \n\n    public long[] unmarkedSumArray(int[] arr, int[][] query) {\n        \n        Queue<pair> pq=new PriorityQueue<>((a,b) ->{\n      
```\nclass Solution {    \n\n    public long[] unmarkedSumArray(int[] arr, int[][] query) {\n        \n        Queue<pair> pq=new PriorityQueue<>((a,b) ->{\n            if(a.val==b.val)                 // if value is equal sort on basic of index\n                return a.idx-b.idx;\n            return a.val-b.val;        //else, sort on the basic of value(i.e smaller come first)\n        });\n        \n        long tsum=0l;     // stroing total sum.\n        for(int i=0;i<arr.length;i++){\n            pq.add(new pair(arr[i], i));\n            tsum+=arr[i];\n        }\n        \n        int [] visited=new int[arr.length];   // marking visited index\n        long[] ans=new long[query.length];\n        int i=0;\n        for(int a[] : query){\n            \n            int idx=a[0];      // geting index form query\n            int k=a[1];        // total number of element marked in array correspondece to index.\n            if(visited[idx]==0){//abhi tak visited nahi hua hai hence visited karo and tsum se substract karo\n                tsum -= arr[idx];\n                visited[idx]=1;     // marked visited index so that not take part it again .\n            }\n            while(!pq.isEmpty() && k!=0){    // yaha par k smallest ko remove karwa rahe hai.\n                \n                pair p=pq.poll();\n                if(visited[p.idx]==0){ // jo visited nahi hai usko bas pick karenge \n                    visited[p.idx]=1;\n                    tsum-=arr[p.idx];\n                    k--;\n                }\n            }\n            ans[i++]=tsum;\n        }\n        return ans;\n    }\n}\nclass pair{\n    \n    int val;  // storing value\n    int idx;  // storing index of that value.\n    pair(int val,int idx){\n        this.val=val;\n        this.idx=idx;\n    }\n}\n```
['Heap (Priority Queue)', 'Java']