func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long n;     cin >> n;     long long a[n];     for (int i = 0, ggdem = n; i < ggdem; ++i) cin >> a[i];     long long yo = -1;     for (int i = 0, ggdem = n; i < ggdem; ++i) {       if (a[i] == -1) {         yo = i;       }     }     for (int i = 0, ggdem = yo + 1; i < ggdem; ++i) {       a[i] = 0;     }     long long res = 0;     for (long long i = 20; i >= 0; i--) {       if ((1 << i) > n) continue;       long long mini = 1e18, minid = -1;       for (int j = (1 << i) - 1, ggdem = n; j < ggdem; ++j) {         if (a[j] <= mini) {           mini = a[j];           minid = j;         }       }       res += mini;       a[minid] = 1e18;     }     cout << res;     return 0;   }   