func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     for (int ti = 0; ti < t; ti++) {       int n, k;       cin >> n >> k;       vector<int> arr(n);       for (int i = 0; i < n; i++) cin >> arr[i];       sort(arr.begin(), arr.end());       vector<int> weights(k);       for (int i = 0; i < k; i++) cin >> weights[i];       sort(weights.begin(), weights.end());       long long total = 0;       for (int i = n - 1; i >= n - k; i--) {         total += arr[i];       }       int w = 0;       for (int i = k - 1; i >= 0; i--) {         if (weights[i] <= 1) break;         total += arr[w];         w += weights[i] - 1;       }       for (int i = 0; i < k; i++) {         if (weights[i] > 1) break;         total += arr[n - 1 - i];       }       cout << total << endl;     }     return 0;   }   