func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 200009;   const long long MOD = 119 << 23 | 1;   class {    public:     bool g[1 << 22];     int a[1 << 22];     int N, M, n, m;     void solve() {       int _;       cin >> _;       while (_--) {         cin >> n >> m;         N = (1 << n) - 1;         M = (1 << m) - 1;         for (int i = 1; i <= N; ++i) cin >> a[i];         for (int i = M + 1; i <= N; ++i) g[i] = 1;         for (int i = M; i; --i) {           if (a[i << 1] < a[i << 1 | 1]) {             g[i] = g[i << 1 | 1];           } else {             g[i] = g[i << 1];           }         }         vector<int> ans;         int rt = 1;         for (int i = 0; i < N - M; ++i) {           while (!g[rt]) rt++;           ans.push_back(rt);           down(rt);         }         long long sum = 0;         for (int i = 1; i <= M; ++i) sum += a[i];         cout << sum <<   n ;         for (int i : ans) cout << i <<    ;         cout <<   n ;         for (int i = 1; i <= N; ++i) g[i] = a[i] = 0;       }     }     void down(int rt) {       int lson = rt << 1, rson = rt << 1 | 1;       if (a[lson] == 0 && a[rson] == 0) {         a[rt] = 0;         g[rt] = 0;         return;       }       if (a[lson] > a[rson]) {         a[rt] = a[lson];         down(lson);       } else {         a[rt] = a[rson];         down(rson);       }       if (rt <= M) {         if (a[lson] > a[rson])           g[rt] = g[lson];         else           g[rt] = g[rson];       }     }   } NSPACE;   int main() {     ;     ios_base::sync_with_stdio(false);     cout.tie(0);     cin.tie(0);     NSPACE.solve();   }   