func_code_string: #include <bits/stdc++.h>   using namespace std;   int dp[1 << 6][1 << 6][41][41];   int h, w;   const int dy[] = {-1, 0, 0, 1, 0};   const int dx[] = {0, -1, 1, 0, 0};   int dfs(const int up, const int down, const int cx, const int cy) {     if (cy == h) {       int cnt = 0;       for (int i = 0; i < w; i++)         if (!((up >> i) & 1)) cnt++;       return cnt;     } else if (cx == w)       return dfs(up, down, 0, cy + 1);     if (dp[up][down][cy][cx] != -1) return dp[up][down][cy][cx];     int res = 0;     for (int i = 0; i < 5; i++) {       const int mx = cx + dx[i];       const int my = cy + dy[i];       if (!(my >= 0 && mx >= 0 && mx < w && my < h)) continue;       int nup = up;       int ndown = down;       if (dy[i] == -1) {         if ((down >> cx) & 1)           nup |= (1 << cx);         else           nup &= ~(1 << cx);         ndown &= ~(1 << cx);         int adNum = 0;         if (cy == 0) adNum = 0;         res = max(res, dfs(nup, ndown, cx + 1, cy) + adNum);       } else if (dy[i] == 1) {         if ((down >> cx) & 1)           nup |= (1 << cx);         else           nup &= ~(1 << cx);         ndown |= (1 << cx);         int adNum = !((up >> cx) & 1);         if (cy == 0) adNum = 0;         res = max(res, dfs(nup, ndown, cx + 1, cy) + adNum);       } else if (dx[i] == 1) {         ndown |= (1 << mx);         if ((down >> cx) & 1)           nup |= (1 << cx);         else           nup &= ~(1 << cx);         ndown &= ~(1 << cx);         int adNum = !((up >> cx) & 1);         if (cy == 0) adNum = 0;         res = max(res, dfs(nup, ndown, cx + 1, cy) + adNum);       } else if (dx[i] == -1) {         nup |= (1 << mx);         if ((down >> cx) & 1)           nup |= (1 << cx);         else           nup &= ~(1 << cx);         ndown &= ~(1 << cx);         int adNum = !((up >> cx) & 1);         if (cy == 0) adNum = 0;         res = max(res, dfs(nup, ndown, cx + 1, cy) + adNum);       } else {         ndown &= ~(1 << cx);         nup |= (1 << cx);         int adNum = !((up >> cx) & 1);         if (cy == 0) adNum = 0;         res = max(res, dfs(nup, ndown, cx + 1, cy) + adNum);       }     }     return dp[up][down][cy][cx] = res;   }   int main() {     int n, m;     cin >> n >> m;     if (n > m) swap(n, m);     w = n;     h = m;     memset(dp, -1, sizeof(dp));     int res = dfs(0, 0, 0, 0);     cout << res << endl;     return 0;   }   