eaasy 
Intuitionusing  priority_queue and  unordered_mapApproachfirst  i push arr  not all  arr  like sliding  arr length push push in map  and  i  find  all  frequenc
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
using  priority_queue and  unordered_map
# Approach
<!-- Describe your approach to solving the problem. -->
first  i push arr  not all  arr  like sliding  arr length push push in map  and  i  find  all  frequency and  make a  priority_queue push in queue this  queueu  top is maximum number  ic start a  loop  if  count<x then and  !queue empty stop  and return  sum 
# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
 O(n * k log k)
- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
O(K)
# Code
```cpp []
class Solution {
public:
int solve(vector<int>& arr, int x) {
        unordered_map<int, int> freq;
        for (auto it : arr) {
            freq[it]++;
        }

        priority_queue<pair<int, int>> maxHeap; 
        for (auto it : freq) {
            maxHeap.push({it.second, it.first});
        }

        int sum = 0;
        int count = 0;

       
        while (!maxHeap.empty() && count < x) {
            auto top = maxHeap.top();
            maxHeap.pop();
            sum += top.second * top.first;
            count++;
        }

        return sum;
    }
    vector<int> findXSum(vector<int>& arr, int k, int x) {
   vector<int> result;
        vector<int> add;

        for (int i = 0; i < arr.size(); i++) {
            add.push_back(arr[i]);

            if (add.size() == k) {
                result.push_back(solve(add, x));
                add.erase(add.begin());
            }
        }

        return result;
    }
};
```
['C++']