func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 10004;   int v[MAXN];   int solve(int x, int y) {     if (x == y) return 0;     int mid = (x + y) >> 1;     int left = 0, right = 0;     for (int i = x; i < mid + 1; ++i) left = max(left, v[i]);     for (int i = mid + 1; i < y + 1; ++i) right = max(right, v[i]);     return abs(right - left) + solve(x, mid) + solve(mid + 1, y);   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int n;     while (cin >> n) {       memset(v, 0, sizeof v);       int m = (1 << (n + 1)) - 1;       for (int i = 0; i < m - 1; ++i) {         int x;         cin >> x;         int u = i + 2;         int p = (u) >> 1;         v[u] = v[p] + x;       }       cout << solve(1 << n, m) << endl;     }   }   