func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<long long> ydidicreate;   int dontknowy[100000];   int main() {     int tt;     cin >> tt;     while (tt--) {       int n, k;       cin >> n >> k;       int a[n];       for (int i = 0; i < n; i++) cin >> a[i];       ;       sort(a, a + n);       int f[k];       for (int i = 0; i < k; i++) cin >> f[i];       ;       sort(f, f + k);       long long ans = 0;       int l = n - 1, m = 0;       int pos;       for (int i = 0; i < k; i++) {         if (f[i] == 1) {           ans += (2 * a[l]);           l--;         } else {           pos = i;           break;         }       }       for (int i = k - 1; i >= 0; i--) {         if (f[i] == 1) break;         ans += a[l];         l--;         ans += a[m];         m++;         f[i] -= 2;         while (f[i]--) {           m++;         }       }       cout << ans <<   n ;     }   }   