func_code_string: #include <bits/stdc++.h>   const int N = 18;   const int INF = -1e9;   int dp[N][1 << N][2][2];   int a[1 << N];   void solve() {     int n, k;     scanf( %d %d , &n, &k);     for (int i = 0; i <= n; ++i) {       int groups = (1 << n) / (1 << i);       for (int j = 0; j < groups; ++j) {         for (int u = 0; u < 2; ++u) {           for (int d = 0; d < 2; ++d) {             dp[i][j][u][d] = INF;           }         }       }     }     for (int j = 0; j < (1 << n); ++j) {       dp[0][j][0][0] = 0;     }     for (int i = 0; i < k; ++i) {       scanf( %d , &a[i]);       dp[0][a[i] - 1][1][0] = 0;       dp[0][a[i] - 1][0][0] = INF;     }     for (int i = 1; i <= n; ++i) {       int groups = (1 << n) / (1 << i);       for (int j = 0; j < groups; ++j) {         if (i == 1) {           for (int u = 0; u < 2; ++u) {             for (int v = 0; v < 2; ++v) {               if (dp[i - 1][j * 2][u][0] >= 0 && dp[i - 1][j * 2 + 1][v][0] >= 0)                 dp[i][j][u][v] = std::max(                     dp[i][j][u][v], dp[i - 1][j * 2][u][0] +                                         dp[i - 1][j * 2 + 1][v][0] + (u || v));               if (dp[i - 1][j * 2][v][0] >= 0 && dp[i - 1][j * 2 + 1][u][0] >= 0)                 dp[i][j][u][v] = std::max(                     dp[i][j][u][v], dp[i - 1][j * 2][v][0] +                                         dp[i - 1][j * 2 + 1][u][0] + (u || v));             }           }         } else {           for (int u1 = 0; u1 < 2; ++u1) {             for (int d1 = 0; d1 < 2; ++d1) {               if (dp[i - 1][j * 2][u1][d1] == -1) continue;               for (int u2 = 0; u2 < 2; ++u2) {                 for (int d2 = 0; d2 < 2; ++d2) {                   if (dp[i - 1][j * 2 + 1][u2][d2] == -1) continue;                   int u_match = u1 == 1 || u2 == 1;                   int d_match = d1 == 1 || d2 == 1;                   {                     dp[i][j][u1][u2] = std::max(                         dp[i][j][u1][u2], dp[i - 1][j * 2][u1][d1] +                                               dp[i - 1][j * 2 + 1][u2][d2] +                                               u_match + d_match + (u2 || d1));                     dp[i][j][u1][d1] = std::max(                         dp[i][j][u1][d1], dp[i - 1][j * 2][u1][d1] +                                               dp[i - 1][j * 2 + 1][u2][d2] +                                               u_match + d_match + (u2 || d1));                   }                   {                     dp[i][j][u1][u2] = std::max(                         dp[i][j][u1][u2], dp[i - 1][j * 2][u1][d1] +                                               dp[i - 1][j * 2 + 1][u2][d2] +                                               u_match + d_match + (u2 || d2));                     dp[i][j][u1][d2] = std::max(                         dp[i][j][u1][d2], dp[i - 1][j * 2][u1][d1] +                                               dp[i - 1][j * 2 + 1][u2][d2] +                                               u_match + d_match + (u2 || d2));                   }                   {                     dp[i][j][u2][u1] = std::max(                         dp[i][j][u2][u1], dp[i - 1][j * 2][u1][d1] +                                               dp[i - 1][j * 2 + 1][u2][d2] +                                               u_match + d_match + (u1 || d1));                     dp[i][j][u2][d1] = std::max(                         dp[i][j][u2][d1], dp[i - 1][j * 2][u1][d1] +                                               dp[i - 1][j * 2 + 1][u2][d2] +                                               u_match + d_match + (u1 || d1));                   }                   {                     dp[i][j][u2][u1] = std::max(                         dp[i][j][u2][u1], dp[i - 1][j * 2][u1][d1] +                                               dp[i - 1][j * 2 + 1][u2][d2] +                                               u_match + d_match + (u1 || d2));                     dp[i][j][u2][d2] = std::max(                         dp[i][j][u2][d2], dp[i - 1][j * 2][u1][d1] +                                               dp[i - 1][j * 2 + 1][u2][d2] +                                               u_match + d_match + (u1 || d2));                   }                 }               }             }           }         }       }     }     int ans = 0;     for (int u = 0; u < 2; ++u) {       for (int d = 0; d < 2; ++d) {         if (dp[n][0][u][d] == -1) continue;         ans = std::max(ans, dp[n][0][u][d] + (u || d));       }     }     printf( %d n , ans);   }   int main() {     int t = 1;     while (t--) {       solve();     }   }   