c++ solution
\nclass Solution {\npublic:\n    vector<long long> minOperations(vector<int>& nums, vector<int>& q) \n    {\n        sort(nums.begin(),nums.end());\n        int
```\nclass Solution {\npublic:\n    vector<long long> minOperations(vector<int>& nums, vector<int>& q) \n    {\n        sort(nums.begin(),nums.end());\n        int n=nums.size();\n        vector<long long>ans;\n        long long total=accumulate(nums.begin(),nums.end(),0ll);\n        vector<long long>temp(n+1);\n        for(int i=0;i<n;i++)\n        {\n            temp[i+1]=temp[i]+nums[i];    \n        }\n        for(int i=0;i<q.size();i++)\n        {\n            int index=lower_bound(nums.begin(),nums.end(),q[i])-nums.begin();\n            long long left_sum=1ll*q[i]*(index)-temp[index];\n            long long right_sum=(total-temp[index])-1ll*q[i]*(n-index);\n            ans.push_back(left_sum+right_sum);\n        }\n        return ans;\n    }\n};\n```
['C', 'Binary Tree', 'C++']