func_code_string: #include <bits/stdc++.h>   using namespace std;   template <class T>   inline T bigmod(T p, T e, T M) {     long long int ret = 1;     for (; e > 0; e >>= 1) {       if (e & 1) ret = (ret * p) % M;       p = (p * p) % M;     }     return (T)ret;   }   template <class T>   inline T modinverse(T a, T M) {     return bigmod(a, M - 2, M);   }   template <class T>   inline T gcd(T a, T b) {     if (b == 0) return a;     return gcd(b, a % b);   }   int arr[105], cnt;   int moveee(int n) {     for (int i = 3, j = 1; i <= 99; i += 2, j++)       if (n == i) return j;     return -1;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     ;     int n;     cin >> n;     for (int i = 1; i <= n; i++) cin >> arr[i];     int mov = moveee(n);     if (mov == -1) return cout << -1 << endl, 0;     for (int i = mov; i >= 1; i--) {       int a = i, b = i << 1, c = b + 1;       int maxi = max(arr[b], arr[c]);       arr[a] = max(0, arr[a] - maxi);       arr[b] = max(0, arr[b] - maxi);       arr[c] = max(0, arr[c] - maxi);       cnt += maxi;     }     if (arr[1] > 0) cnt += arr[1];     cout << cnt << endl;     return 0;   }   