find x sum of all k long subarrays I
Code


# Code
```python3 []
class Solution:
    def findXSum(self, nums: List[int], k: int, x: int) -> List[int]:
        n=len(nums)
        def xsum(l,x):
            freq={}
            for i in l:
                if i not in freq:
                    freq[i]=1
                else:
                    freq[i]+=1
            sor=sorted(freq.items(),key= lambda item:(item[1],item[0]),reverse=True)
            return sum([item[0]*item[1] for item in sor[:x]])
        ans=[]
        for i in range(n-k+1):
            l=xsum(nums[i:i+k],x)
            ans.append(l)
        return ans
```
['Python3']