func_code_string: #include <bits/stdc++.h>   using namespace std;   const int M = 19, N = (1 << M);   int a[N];   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int n;     cin >> n;     int id = -1;     for (int i = 0; i < n; i++) {       cin >> a[i];       if (a[i] == -1) id = i;     }     int rem = n - id - 1;     int t = 0;     long long ans = 0;     while (rem > 0) {       int mn = n - 1;       for (int i = n - 1; i >= n / (1 << t) - 1; i--)         if (a[mn] > a[i]) mn = i;       ans += a[mn];       a[mn] = 1e9 + 10;       rem -= n / (1 << (t + 1));       t++;       assert(t <= 20);       cerr << t <<   ****  n ;     }     cout << ans <<   n ;   }   