// #pragma GCC optimize("Ofast,unroll-loops")
// #pragma GCC target("avx2,popcnt,lzcnt,abm,bmi,bmi2,fma,tune=native")
// #pragma expected_value
// #pragma isolated_call
// #pragma disjoint
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using ordered_set = tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
#define ll long long
#define ull unsigned long long
#define ld long double
#define pb push_back
#define setpre(i) setprecision(i)<<fixed
#define foru(i, a, b) for(int i=a;i<=b;++i)
#define ford(i, a, b) for(int i=a;i>=b;--i)
#define mp make_pair
#define moo cout<<"moo "
#define fi first
#define se second
ll lmod = 1e9 + 7;
typedef vector<int> vi;
typedef vector< vector<int> > vvi;
typedef pair<int, int> ii;
typedef pair<double, double> dd;
int a[] = {0, 0, 1, 4};
int main(){
#ifdef LOCAL
freopen("input.inp", "r", stdin);
freopen("output.out", "w", stdout);
#endif
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n, m; cin >> n >> m;
if(n > m) swap(n, m);
if(n == 1){
cout << m << endl;
return 0;
}
if(n == 2){
cout << m / 4 * 4 + min((m % 4), 2) * 2 << endl;
return 0;
}
if(n == 3){
cout << max({(n / 2 + (n % 2)) * (m / 2 + (m % 2)), m * (1 + (n - 1) / 3), n * (1 + (m - 1) / 3), 4 + (m - 2) / 4 * 5 + a[(m - 2) % 4], (n * m) - (n * m) / 2}) << endl;
return 0;
}
cout << max({(n / 2 + (n % 2)) * (m / 2 + (m % 2)), m * (1 + (n - 1) / 3), n * (1 + (m - 1) / 3), n * m - (n * m) / 2}) << endl;
return 0;
}
70. Climbing Stairs | 53. Maximum Subarray |
1527A. And Then There Were K | 1689. Partitioning Into Minimum Number Of Deci-Binary Numbers |
318. Maximum Product of Word Lengths | 448. Find All Numbers Disappeared in an Array |
1155. Number of Dice Rolls With Target Sum | 415. Add Strings |
22. Generate Parentheses | 13. Roman to Integer |
2. Add Two Numbers | 515. Find Largest Value in Each Tree Row |
345. Reverse Vowels of a String | 628. Maximum Product of Three Numbers |
1526A - Mean Inequality | 1526B - I Hate 1111 |
1881. Maximum Value after Insertion | 237. Delete Node in a Linked List |
27. Remove Element | 39. Combination Sum |
378. Kth Smallest Element in a Sorted Matrix | 162. Find Peak Element |
1529A - Eshag Loves Big Arrays | 19. Remove Nth Node From End of List |
925. Long Pressed Name | 1051. Height Checker |
695. Max Area of Island | 402. Remove K Digits |
97. Interleaving String | 543. Diameter of Binary Tree |