Problem:


Score : 200 points

Problem Statement

We have a board with H horizontal rows and W vertical columns of squares.
There is a bishop at the top-left square on this board.
How many squares can this bishop reach by zero or more movements?

Here the bishop can only move diagonally.
More formally, the bishop can move from the square at the r_1-th row (from the top) and the c_1-th column (from the left) to the square at the r_2-th row and the c_2-th column if and only if exactly one of the following holds:

r_1 + c_1 = r_2 + c_2

r_1 - c_1 = r_2 - c_2

For example, in the following figure, the bishop can move to any of the red squares in one move:

Constraints

1 \leq H, W \leq 10^9

All values in input are integers.

Input

Input is given from Standard Input in the following format:

H \ W

Output

Print the number of squares the bishop can reach.

Sample Input 1

4 5

Sample Output 1

10

The bishop can reach the cyan squares in the following figure:

Sample Input 2

7 3

Sample Output 2

11

The bishop can reach the cyan squares in the following figure:

Sample Input 3

1000000000 1000000000

Sample Output 3

500000000000000000



Sample input:
4 5


Sample output:
10

Submission status: Runtime Error

Solution code:
#include"bits/stdc++.h"
using namespace std;
typedef unsigned long long ll;


using Graph=vector<vector<int>>;//グラフ型
void dfs(const Graph &G,int v/*根*/,vector<bool> &seen){
    seen[v]=true;  //vを訪問済にする
    for(auto next_v:G[v]){ //訪問済にしたvとつながっている場所を順番に探す
        if(seen[next_v]) continue; //もし探索済みならスルー
        dfs(G,next_v,seen); //再帰的に探索
    }
}

void bfs(const Graph &G,queue<int> &que/*発見したが訪問はしていない*/,vector<int> &dist/*開始地点からの距離*/,int s/*スタート地点*/){
    
    while(!que.empty()){
        int v=que.front();//queのうち先頭のものからスタート
        que.pop();//先頭を削除
        for(int nv :G[v]){//vとつながっている点を列挙
            if(dist[nv]!=-1) continue;//発見済(=距離が格納されている)であればスルー
            dist[nv]=dist[v]+1;//vとつながっている点に距離の情報を追加
            que.push(nv);//vとつながっている点を発見済にする
        }
    }
}

unsigned int to_int(char c){
    return c-48;
}

int main(void){
    ll h,w;
    cin>>h>>w;
    ll ans=0;
    for(int i=0;i<min(h,w);++i){
        if(i%2==0){
            ans+=(max(h,w)%2==0?max(h,w)/2:max(h,w)/2+1);
        }
        else{
            ans+=max(h,w)/2;
        }
    }
    cout<<ans;
}

Submission status: Runtime Error

Solution code:
arr = input().split()
h=int(arr[0])
w=int(arr[1])

if w%2!=0:
    if h%2!=0:
        ans=(w+1)//2*(h+1)//2+(w-1)//2*(h-1)//2
    else:
        ans=(w+1)//2*h//2+(w-1)//2*h//2
else:
    if h%2!=0:
        ans=w//2*h
print(ans)

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main() {
  ll h, w;
  cin >> h >> w;
  if (w==1 || h ==1){
    cout << 1 << endl;
    return 0;
  }
  cout << (h * w + 1) / 2 << endl;
  return 0;
}

Submission status: Runtime Error

Solution code:
h, W = map(int,input().split())
if h % 2 != 0:
    if W % 2 != 0:
        ans = ((h-1)*W//2)+(W//2+1)
else:
    ans = (h*W)//2
print(ans)

Submission status: Runtime Error

Solution code:
import math
w, h = map(int, input().split(' '))
    if w % 2 == 1 and h % 2 == 1:
        t = math.floor(w * h / 2)
        n = t + 1
    else:
        n = (w * h) / 2
    print(int(n))

Submission status: Runtime Error

Solution code:
#include <iostream>
using namespace std;
using Int = int64_t;
int main() {
    Int H, W;
    cin >> H >> W;
    if (H % 2 == 0 || W % 2 == 0) cout << H * W / 2 << endl;
    else cout << (H * W + 1) / 2 << endl;
}

Submission status: Runtime Error

Solution code:
h,w = (int(x) for x in input().split())



if h != 1 and w != 1:
    num = ((w // 2) + (w % 2))*( (h // 2) + ( h% 2) ) + ((w // 2) + (w % 2)-(w%2))*( (h // 2) + (h%2) -(h%2)) 
print(num)

Submission status: Runtime Error

Solution code:
v, h = map(int,input().split())
ans = int(ceil(h/2)*ceil(v/2) + floor(h/2)*floor(v/2))
print(ans)

Submission status: Runtime Error

Solution code:
HW = input().split()
H = int(HW[0])
W = int(HW[1])
 
tmp = H // 2
tmp2 = H - tmp
wt = W // 2
wt2 = W - wt
ans = tmp * wt + tmp2 * wt2

if H % 2 == 0:
  h1 = H // 2
  h2 = H // 2
else:
  h1 = H//2 + 1
  h2 = H//2
if W % 2 == 0:
  w1 = W//2
  w2 = W//2
else:
  w1 = W//2+1
  w2 = w//2
  
ans = h1*w1+h2*w2  
print(ans)

Submission status: Runtime Error

Solution code:
h, w = int(input().split(" "))
n = h * w
a = n/2
if n%2==0:
  print(a)
  
else:
  print(a+0.5)

Submission status: Runtime Error

Solution code:
import sys

def solve():
    input = sys.stdin.readline
    H, W = map(int, input().split())
    if H == 1 or W == 1: print(1)
    else: Ans = (H // 2 + H % 2) * (W // 2 + W % 2) + (H // 2) *  (W // 2)
    print(Ans)

    return 0

if __name__ == "__main__":
    solve()

Submission status: Runtime Error

Solution code:
# Code for B - Bishop
# Use input() to fetch data from STDIN
from math import ceil
import sys
[H, W] = map(int, input().split())

if H <= 1:
    print(1)
    sys.exit(1)

if W <= 1:
    print(1)
    sys.exit(1)


print(ceil(H * W / 2))

Submission status: Runtime Error

Solution code:
H , W = map(int, input().split())
S = H * W

if S % 2 = 0:
    print(S//2)
else:
    print(S//2+1)

Submission status: Runtime Error

Solution code:
H,W = map(int,input().split())
l = [[0]*H]*W
ans = 0
if H%2 == 0 and W%2 == 0:
  ans = (W//2)*H
else:
  ans = (W//2)*(H//2) +(H-(H//2))*(W-(W//2))
print(ans)

Submission status: Runtime Error

Solution code:
w, h = map(int, input().split(' '))   
if w%2 == 1 and h%2 == 1:             
    t = math.floor((w)*(h)/2)         
    n = t + 1                         
else:                                 
    n = (w * h) / 2                   
print(int(n))

Submission status: Runtime Error

Solution code:
h,w = map(int, input().split())
k = h*w
if (h-1)(w-1)==0:
  print(1)
else:
  print(k-int(k/2))

Submission status: Runtime Error

Solution code:

H, W = map(int, input().split())

if (H = 1 or W = 1):
    print(1)
    
elif (H * W) % 2 == 0:
    print(int((H * W) / 2))

else:
    masu = int((H * W) / 2) + 1
    print(masu)

Submission status: Runtime Error

Solution code:
H , W = map(int,input().split())
S = H * W

if S % 2 = 0:
    print(S//2)
else:
    print(S//2+1)

Submission status: Runtime Error

Solution code:
import math
H,W = map(int,input().split())

if H==1 orW==1:
  print(1)
  exit()
  
x = H*W
if x % 2==0:
  print(x/2)
elif x% 2 ==1:
  print(int(math.ceil(x/2)+1))

Submission status: Runtime Error

Solution code:
h = input()
w = input()
h_a = h // 2
w_a = w // 2
if((h_a == 0) & (w_a == 0)):
  print(h_a * w_a)
elif((h_a == 1) & (w_a == 0)):
  print((h_a+1) * w_a)
elif((h_a == 0) & (w_a == 1)):
  print(h_a * (w_a + 1))
elif((h_a == 1) & (w_a == 1)):
  print((h_a + 1) * (w_a + 1))

Submission status: Runtime Error

Solution code:
a=input()
b=input()
print(a/2*b)

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())

c = a*b
if a = c:
  print(1)
elif b = c:
  print(1)
elif c % 2 == 0:
  print(int(c/2))
else:
  print(int(c/2)+1)

Submission status: Runtime Error

Solution code:
H, W = map(int, input().split())
if H==1 or W==1
    print(1)
else:
    print((H*W)//2) if (H*W)%2==0 else print((H*W)//2+1)

Submission status: Runtime Error

Solution code:
if h == 1 or w == 1:
    print(1)
elif h % 2 == 0:
    print(int(h*w/2))
elif h % 2 == 1 and w % 2 == 0:
    print(int(h*w/2))
else:
    print(int(h*(w//2)+h//2+1))

Submission status: Runtime Error

Solution code:
x,y=map(int,input().split())
print(math.ceil((x*y)/2))

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <string>
#include <vector>
#include <list>
using namespace std;

inline int num (const std::string& S, int idx){ return S.at(idx) - '0'; }
inline unsigned int bitMask(int i){ return (1 << i); }
inline bool isTrue(unsigned int bit, int i){ return bit & bitMask(i); }

int main(){
	unsigned long long h, w;
	cin >> h >> w;
	if(h==1 || w==1) {
		cout << 0 << endl;
		return 0;
	}
	cout << h/2*w << endl;
	return 0;
}

Submission status: Runtime Error

Solution code:
import math
h, w = map(int,input().split())
if h % 2 ==1 and w % 2 == 1:
    print((h*w+1)/2)
else:
# print(math.ceil(h*w/2))
print(h*w/2)

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <string>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
	ll h,w; cin>>h>>w;
	ll h1,h2; h1=(h+1)/2; h2 = h/2;
	ll w1,w2; w1=(w+1)/2; w2 = w/2;
	ll ans;
	if(h==1||w==1) ans = 1;
	else ans = w1*h1 + w2*h2;
	cout << ans;

  return 0;
}

Submission status: Runtime Error

Solution code:
h,w=map(int,input().split())
if((h*w)%2):
    print((h*w)//2+1)
else:
    print((h*w)/2)

Submission status: Runtime Error

Solution code:
H, W = map(int, input().split())

a = H * W

if(a % 2 == 0):
     print(a)
 else:
     print(a+1)

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
c = a*b
if c%2==0:
  print(C/2)
else:
  print((c+1)/2)

Submission status: Runtime Error

Solution code:
h, W = map(int,input().split())
if h % 2 != 0:
    if W % 2 != 0:
        ans = (h-1)*W//2+(W//2+1)
else:
    ans = (h*W)//2
print(ans)

Submission status: Runtime Error

Solution code:
    h, w = map(int, input().split())
    ki = int(h/2) + h%2
    gu = int(h/2)

    sum_ki = ki *(int(w/2) + w%2)
    sum_gu = gu * (int(w / 2) )
    print(sum_ki+sum_gu)

Submission status: Runtime Error

Solution code:
input_num = input()
split = input_num.split(' ')
h = int(split[0])
w = int(split[1])
odd_row = w // 2 +1
even_row = odd_row - 1
total = 0
for i in range(h, start=1):
    if i%2 = 0:
        total += even_row
    else:
        total += odd_row
print(total)

Submission status: Runtime Error

Solution code:
H, W = map(int, input().split())

if H == 1 or W == 1:
    print(1)
else:
    if (H * W) % 2 == 1:
        ans = H * W // 2 + 1
    else:
        ans = H * W // 2
print(ans)

Submission status: Runtime Error

Solution code:
# 2入力
H, W = map(int, input().split())

if H == 1 or W == 1:
    pirnt(1)
else:
    mass = 0
    if W % 2 != 0:
        if H % 2 != 0:
            mass += (int(H / 2) + 1) * (int(W / 2) + 1)
            mass += (int(H / 2)) * (int(W / 2))
            print(mass)
        else:
            mass += (int(H / 2)) * (int(W / 2) + 1)
            mass += (int(H / 2)) * (int(W / 2))
            print(mass)

    else:
        if H % 2 != 0:
            mass += (int(H / 2) + 1) * (int(W / 2))
            mass += (int(H / 2)) * (int(W / 2))
            print(mass)
        else:
            mass += (int(H / 2)) * (int(W / 2))
            mass += (int(H / 2)) * (int(W / 2))
            print(mass)

Submission status: Runtime Error

Solution code:
s = input()
lis = s.split()
h = int(s[0])
w = int(s[1])

if h % 2 == 0:
    print(h * w // 2)
else:
    ww = (w + 1) // 2
    print(h * w // 2 + ww)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
h, w = map(int,input().split())

if h % 2 == 0:
    tmp1 = h // 2
    ans = tmp1 * w
else:
    tmp1 = h // 2
    #print(tmp1 * w)
    #print(w % 2)
    if w % 2 == 0:
        ans = (tmp1 * wl) + (w // 2)
    else:
        ans = (tmp1 * w) + (w // 2 + 1)
print(ans)

Submission status: Runtime Error

Solution code:
def main():
    h, w = map(int, input().split())

    ans = 0
    if h == 1:
        print(1)
        return 0
    if w&1:
    ans += w * (h//2)
    if h % 2 == 1:
        ans += (w+1)//2
    else:
    ans += h*(w//2)

    print(ans)

main()

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
c = a*b
if c%2==0:
  print(C/2)
elif c%2==1:
  print((c+1)/2)

Submission status: Runtime Error

Solution code:
h, w = int(input().split())
n = h * w
a = n/2
if n%2==0:
  print(a)
  
else:
  print(a+0.5)

Submission status: Runtime Error

Solution code:
h, w = int(x) for x in input().split()
odd_row = w // 2 +1
even_row = odd_row - 1
total = 0
for i in range(h, start=1):
    if i%2 = 0:
        total += even_row
    else:
        total += odd_row
print(total)

Submission status: Runtime Error

Solution code:
a=int(input())
b=int(input())
print(a*b/2)

Submission status: Runtime Error

Solution code:
a , b = map(int,input().split())
S = a * b

if S % 2 = 0:
    print(S//2)
else:
    print(S//2 + 1)

Submission status: Runtime Error

Solution code:
    w =2
    h = 4
    if w%2 == 1 and h%2 == 1:
        t = (w-1)*(h-1)/2
        n = t - 1
    else:
        n = (w * h) / 2
    print(n)

Submission status: Runtime Error

Solution code:
#include <cstdint>
#include <iostream>

using namespace std;

int main()
{
    int64_t h, w;
    cin >> h >> w;

    auto res = h * w / 2;
    if (h % 2 == 1 && w % 2 == 1) {
        res = ((h + 1) / 2) * ((w + 1) / 2);
        res += (h / 2) * (w / 2);
    }
    cout << res << "\n";

    return 0;
}

Submission status: Runtime Error

Solution code:
    h, w = map(int, input().split())
    # h,w=1000000000, 1000000000
    ki = int(h/2) + h%2
    gu = int(h/2)

    sum_ki = ki *(int(w/2) + w%2)
    sum_gu = gu * (int(w / 2) )
    print(sum_ki+sum_gu)

Submission status: Runtime Error

Solution code:
import math
H, W = map(int, input().split())

w1 = math.ceil(W/2)*math.ceil(H/2)
w2 = math.floor(W/2)*math.floor(H/2)

if: H == 1:
    print(1)
elif W==1:
    print(1)
elif W != 1:
    print(w1+w2)

Submission status: Runtime Error

Solution code:
H,W = map(int,input().split())
if H == 1 or W == 1:
  print(I)
elif H*W % 2 == 0:
  print(H*W//2)
else:
  print(H*W//2+1)

Submission status: Runtime Error

Solution code:
x = list(map(int,input().split(" ")))
h = x[0]
w = x[1]

ans = 0
if h % 2 == 0:
    for i in range(w):
        ans += h/2
    print(int(ans))
elif w % 2 == 0:
    for i in range(w/2):
        ans += h
    print(int(ans))
else:
    for i in range(w//2):
        ans += h
    ans += h // 2 +1
    print(int(ans))

Submission status: Runtime Error

Solution code:
H,W=map(int,input().split())
if(H==1 or R==1):
  print(1)
else:
  if((H*W)%2==0):
    print(int(H*W/2))
  else:
    print(int(H*W/2)+1)

Submission status: Runtime Error

Solution code:
n = int(input())
m = int(input())
print((  ( (n+1) //2 )* ( (m+1)//2 ) ) + ((n//2)*(m//2)) )

Submission status: Runtime Error

Solution code:
H,W = map(int,input().split())
if (H*W) % 2 == 0:
    print(int(H*W/2)
if (H*W) % 2 == 1:
    print(int((H*W+1)/2))

Submission status: Runtime Error

Solution code:
h, w = map(int, input().split())

syou, amari = divmod(h, 2)
if w % 2 == 1:
    a = w // 2 + 1
ans = (a + a - 1)* syou + a * amari
print(ans)

Submission status: Runtime Error

Solution code:
    from math import ceil
    l = [int(j) for j in input().split()]
    print(ceil(l[0]*l[1]/2))

Submission status: Runtime Error

Solution code:
h,w = map(int,input().split())
tot = h*w
if h%2 == 0:
 	print(tot/2)
else: 
	if w%2 == 0:
  		print(tot/2)
    else:
      	print((tot//2)+1)

Submission status: Runtime Error

Solution code:
a,b=map(int, input().split())
if a = 1 or b = 1:
	print(1)
else:
	print(-(-1 * a * b // 2))

Submission status: Runtime Error

Solution code:
h,k=map(int,input().split())
if h==1 or w ==1:
    print(1)
if h*k%2==0:
    print((h*k)/2)
else:
    print((h*k)//2 + 1)

Submission status: Runtime Error

Solution code:
import math
N, W = map(int, input().split())

if N == 1 or W == 1:
  ans = 1
else
  ans = math.ceil((N * W) / 2)
  
print(ans)

Submission status: Runtime Error

Solution code:
L, S = map(int, input().split())

if L % 2 == 1:
    if S % 2 == 1:
        ans = int(L*(S-1)/2 + (L+1)/2)
else:
    ans = int(L*S/2)

print(ans)

Submission status: Runtime Error

Solution code:
ans = 0
if h % 2 == 0:
    for i in range(w):
        ans += h/2
    print(int(ans))
elif w % 2 == 0:
    for i in range(w/2):
        ans += h
    print(int(ans))
else:
    for i in range(w//2):
        ans += h
    ans += h // 2 +1
    print(int(ans))

Submission status: Runtime Error

Solution code:
H, W = map(int, input().split())
a = H*W
if a%2 == 1:
    print((a+1)//2)
else:
    print(a//2)
return

Submission status: Runtime Error

Solution code:
h, w = map(int, input().split())

a = h * w
if a % 2 == 0:
  print(int(a / 2))
else:
  print(int;((a + 1) / 2))

Submission status: Runtime Error

Solution code:
h,w=map(int,input().split())
if(w%2==1):
    w1=(w//2)+1
    w2=w//2
else:
    w1=(w//2)
    w2=(w//2)+1
if(h%2==1):
    h1=(h//2)+1
    h2=(h//2)
else:
    h1=(h//2)
    h2=(h//2)+1

if(w%2==1 and h%2==1):
    ans=w1*h1+w2*h2
elif(w%2==1 and h%2==0):
    ans=w1*h1+w2*h1
elif(w%2==0 and h%2==1):
    ans=w1*h1+w2*h2
else:
    ans=w1*h1+w1*h1                                                                                   print(ans)

Submission status: Runtime Error

Solution code:
import sys
from pprint import pprint

H, W = map(int, sys.stdin.readline().strip().split())

if H % 2 == 0 or W % 2 == 0:
    print(H * W // 2)
else:
    print((H * W // 2 + 1)

Submission status: Runtime Error

Solution code:
h,w=map(int,input().split())

if h != 1 and w != 1:
    if h*w % 2 == 1:
        print(str(int(h*w/2) + 1))
    else:
        print(str(int(h*w/2)))
elif:
    print(str(1))

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;
#define fast() ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define digit(N) cout << fixed << setprecision((N))
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")

int main()
{
	ll H, W;
	cin >> H >> W;

	if (H == 1 || W == 1)
	{
		cout << 1 << "\n";
	}
	else if (H % 2 == 1 && W % 2 == 1)
	{
		if (H > W)
			swap(H, W);
		cout << H * (W - 1) / 2 + (H + 1) / 2 << "\n";
	}
	else
	{
		cout << H * W / 2 << "\n";
	}
}

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;



typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;
typedef vector< vector< vector<ll> > > vvvint;
typedef vector<string> vstring;
typedef vector< vector<string> > vvstring;
typedef vector<char> vchar;
typedef vector< vector<char> > vvchar;
typedef vector<long double> vdouble;
typedef vector< vector<long double> > vvdouble;
typedef vector< vector< vector<long double> > > vvvdouble;
typedef pair<ll,ll> pint;
typedef vector<pint> vpint;
typedef vector<bool> vbool;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define ALL(obj) (obj).begin(), (obj).end()
// #define LLONG_MAX 9223372036854775806
#define vmax(vec) *max_element(vec.begin(), vec.end())
#define vmin(vec) *min_element(vec.begin(), vec.end())
#define vsort(vec) sort(vec.begin(), vec.end())
#define vsortgr(vec) sort(vec.begin(), vec.end(), greater<ll>())
#define MOD 1000000007
// #define MOD 998244353
// #define MOD LLONG_MAX
const double PI=3.14159265358979323846;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }




int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0,};

template< typename T >
struct edge {
  int src, to;
  T cost;

  edge(int to, T cost) : src(-1), to(to), cost(cost) {}

  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}

  edge &operator=(const int &x) {
    to = x;
    return *this;
  }

  operator int() const { return to; }
};

template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WeightedGraph = vector< Edges< T > >;
using UnWeightedGraph = vector< vector< int > >;
template< typename T >
using Matrix = vector< vector< T > >;






void printv(vint &V){
  for(auto e:V)cout<<e<<" ";
  cout<<endl;
}

vector< bool > prime_table(int n) {
  vector< bool > prime(n + 1, true);
  if(n >= 0) prime[0] = false;
  if(n >= 1) prime[1] = false;
  for(int i = 2; i * i <= n; i++) {
    if(!prime[i]) continue;
    for(int j = i + i; j <= n; j += i) {
      prime[j] = false;
    }
  }
  return prime;
}

vector< int > prime_numbers;






int main() {


  cout<<fixed<<setprecision(10);

  ll h,w; cin>>h>>w;

  ll ans=0;


  if(w%2==1){
    if(h%2==0){
      ans = (w)*(h/2);
    }else{
      ans = (w)*(h/2) + w/2 + 1;
    }
  }else{
    ans = (w/2)*h;
  }

  cout<<ans<<endl;


}

//

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
#include <sys/time.h>
using namespace std;

#define rep(i,n) for(long long i = 0; i < (long long)(n); i++)
#define repi(i,a,b) for(long long i = (long long)(a); i < (long long)(b); i++)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define mt make_tuple
#define mp make_pair
template<class T1, class T2> bool chmin(T1 &a, T2 b) { return b < a && (a = b, true); }
template<class T1, class T2> bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

using ll = long long; using vll = vector<ll>; using vvll = vector<vll>; using P = pair<ll, ll>;
ll ugauss(ll a, ll b) { if (!a) return 0; if (a>0^b>0) return a/b; else return (a+(a>0?-1:1))/b+1; }
ll lgauss(ll a, ll b) { if (!a) return 0; if (a>0^b>0) return (a+(a>0?-1:1))/b-1; else return a/b; }
template <typename T, typename U> ostream &operator<<(ostream &o, const pair<T, U> &v) {  o << "(" << v.first << ", " << v.second << ")"; return o; }
template<size_t...> struct seq{}; template<size_t N, size_t... Is> struct gen_seq : gen_seq<N-1, N-1, Is...>{}; template<size_t... Is> struct gen_seq<0, Is...> : seq<Is...>{};
template<class Ch, class Tr, class Tuple, size_t... Is>
void print_tuple(basic_ostream<Ch,Tr>& os, Tuple const& t, seq<Is...>){ using s = int[]; (void)s{0, (void(os << (Is == 0? "" : ", ") << get<Is>(t)), 0)...}; }
template<class Ch, class Tr, class... Args> 
auto operator<<(basic_ostream<Ch, Tr>& os, tuple<Args...> const& t) -> basic_ostream<Ch, Tr>& { os << "("; print_tuple(os, t, gen_seq<sizeof...(Args)>()); return os << ")"; }
ostream &operator<<(ostream &o, const vvll &v) { rep(i, v.size()) { rep(j, v[i].size()) o << v[i][j] << " "; o << endl; } return o; }
template <typename T> ostream &operator<<(ostream &o, const vector<T> &v) { o << '['; rep(i, v.size()) o << v[i] << (i != v.size()-1 ? ", " : ""); o << "]";  return o; }
template <typename T> ostream &operator<<(ostream &o, const deque<T> &v) { o << '['; rep(i, v.size()) o << v[i] << (i != v.size()-1 ? ", " : ""); o << "]";  return o; }
template <typename T>  ostream &operator<<(ostream &o, const set<T> &m) { o << '['; for (auto it = m.begin(); it != m.end(); it++) o << *it << (next(it) != m.end() ? ", " : ""); o << "]";  return o; }
template <typename T>  ostream &operator<<(ostream &o, const unordered_set<T> &m) { o << '['; for (auto it = m.begin(); it != m.end(); it++) o << *it << (next(it) != m.end() ? ", " : ""); o << "]";  return o; }
template <typename T, typename U>  ostream &operator<<(ostream &o, const map<T, U> &m) { o << '['; for (auto it = m.begin(); it != m.end(); it++) o << *it << (next(it) != m.end() ? ", " : ""); o << "]";  return o; }
template <typename T, typename U, typename V>  ostream &operator<<(ostream &o, const unordered_map<T, U, V> &m) { o << '['; for (auto it = m.begin(); it != m.end(); it++) o << *it; o << "]";  return o; }
vector<int> range(const int x, const int y) { vector<int> v(y - x + 1); iota(v.begin(), v.end(), x); return v; }
template <typename T> istream& operator>>(istream& i, vector<T>& o) { rep(j, o.size()) i >> o[j]; return i;}
template <typename T, typename S, typename U> ostream &operator<<(ostream &o, const priority_queue<T, S, U> &v) { auto tmp = v; while (tmp.size()) { auto x = tmp.top(); tmp.pop(); o << x << " ";} return o; }
template <typename T> ostream &operator<<(ostream &o, const queue<T> &v) { auto tmp = v; while (tmp.size()) { auto x = tmp.front(); tmp.pop(); o << x << " ";} return o; }
template <typename T> ostream &operator<<(ostream &o, const stack<T> &v) { auto tmp = v; while (tmp.size()) { auto x = tmp.top(); tmp.pop(); o << x << " ";} return o; }
template <typename T> unordered_map<T, ll> counter(vector<T> vec){unordered_map<T, ll> ret; for (auto&& x : vec) ret[x]++; return ret;};
void vizGraph(vvll& g, int mode = 0, string filename = "out.png") { ofstream ofs("./out.dot"); ofs << "digraph graph_name {" << endl; set<P> memo; rep(i, g.size())  rep(j, g[i].size()) { if (mode && (memo.count(P(i, g[i][j])) || memo.count(P(g[i][j], i)))) continue; memo.insert(P(i, g[i][j])); ofs << "    " << i << " -> " << g[i][j] << (mode ? " [arrowhead = none]" : "")<< endl;  } ofs << "}" << endl; ofs.close(); system(((string)"dot -T png out.dot >" + filename).c_str()); }
struct timeval start; double sec() { struct timeval tv; gettimeofday(&tv, NULL); return (tv.tv_sec - start.tv_sec) + (tv.tv_usec - start.tv_usec) * 1e-6; }
size_t random_seed; struct init_{init_(){ ios::sync_with_stdio(false); cin.tie(0); gettimeofday(&start, NULL); struct timeval myTime; struct tm *time_st; gettimeofday(&myTime, NULL); time_st = localtime(&myTime.tv_sec); srand(myTime.tv_usec); random_seed = RAND_MAX / 2 + rand() / 2; }} init__;
#define ldout fixed << setprecision(40) 

#define EPS (double)1e-10
#define INF (ll)1e18
#define mo  (ll)(1e9+7)

int main(void) {
    ll n, m; cin >> n >> m;
    if (n == 1 || m == 1) {
        cout << 1 << endl;
    } else {
        cout << n * m / 2ll + (n % 2 == 1 && m % 2 == 1)<< endl;
    }

    return 0;
}

Submission status: Runtime Error

Solution code:
k = input()

h, w = k.split(' ')x

r = int(h) * int(w)

if r % 2 == 0:
  print(r // 2)
else:
  print(r // 2 + 1)

Submission status: Runtime Error

Solution code:
mport math
h, w = map(int, input().split())
print(math.ceil(h * w / 2))

Submission status: Runtime Error

Solution code:
import math
H, W = [int(_) for _ in input().split(" ")]
if (H == 1 or W == 1):
  print(1)
else if (H % 2 == 0):
  print(int(H/2*W))
else:
  print(int(H/2)*W+math.ceil(W/2))

Submission status: Runtime Error

Solution code:
h, w = map(long, input().split())

a = h * w
if a % 2 == 0:
  print(long(a / 2))
else:
  print(long((a - 1) / 2))

Submission status: Runtime Error

Solution code:
import math
s = input().rstrip().split(' ')
height = int(s[0])
width = int(s[1])
area = height * width
if area % 2 == 0:
	mass = area / 2
    print(mass)
else:
	mass = math.ceil(area / 2)
    print(mass)

Submission status: Runtime Error

Solution code:
H = input()
W = input()
H = int(H)
W = int(W)
a = H*W
if a % 2 == 0:
    print(a/2)
else:
    print((a+1)/2)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
H, W = map(int, input().split())
if H > 1 and W > 1:
    print((H * W) // 2 + (H * W) % 2)
else
    print(1)

Submission status: Runtime Error

Solution code:
import math
s = input().rstrip().split(' ')
height = int(s[0])
width = int(s[1])
area = height * width
if area / 2 == 0:
	mass = area / 2
    print(mass)
else:
	mass = math.ceil(area / 2)
    print(mass)

Submission status: Runtime Error

Solution code:
a,b=map(int, input().split())
if a = 1 or b = 1:
  print(1)
else:
print(-(-1 * a * b // 2))

Submission status: Runtime Error

Solution code:
h,w = map(int, input().split())
if h * w 2% ==0:
    print(h*w/2)
else:
    print(h*w/2 +1)

Submission status: Runtime Error

Solution code:
def inpl():
    return list(map(int, input().split()))


HW = inpl()
HW.sort()
if HW[0] == 1:
    print(1)
    exit()
print(HW[0] * HW[1] // 2 + int(H[0] % 2 == 1 and H[1] % 2 == 1))

Submission status: Runtime Error

Solution code:
4 5

Submission status: Runtime Error

Solution code:
h, w = list(map(int, input()))

if w % 2 == 0:
  print(h * 2 // 2)
else:
  if h % 2 == 0:
    print((w // 2 + w // 2 + 1) * h // 2)
  else:
    print((w // 2 + w // 2 + 1) * h // 2 + w // 2)

Submission status: Runtime Error

Solution code:
HK=input().split(' ')
H=int(HK[0])
K=int(HK[1])
if K % 2==1 and H%2==1:
    print(round(HK/2)+1)
else:
    print(HK/2)

Submission status: Runtime Error

Solution code:
H,W = map(int,input().split()) 
if H%2 ==0:
    print(H//2*W)
else:
    if W%2 == 0:
        print((H//2+(H+1)//2)*(W//2)
    else:
        print((H//2+(H+1)//2)*(W//2)+(H+1)//2)

Submission status: Runtime Error

Solution code:
H = input()
W = input()
H = int(H)
W = int(W)
a = H*W
if a % 2 == 0:
    print(a/2)
else:
    print((a+1)/2)

Submission status: Runtime Error

Solution code:
import math
s = input().rstrip().split(' ')
height = int(s[0])
width = int(s[1])
area = height * width
if area / 2 == 0:
	print(area / 2)
else:
	mass = area / 2
    print(mass + 1)

Submission status: Runtime Error

Solution code:
,W=map(int,input().split())
S=H*W
if S%2==0:
    print(int(S/2))
else:
    print(int(S//2+1))

Submission status: Runtime Error

Solution code:
h, w = map(int, input().split())
if h == 1 or w == 1:
    print(a)
else:
    print(int(((h*w)+1) / 2))

Submission status: Runtime Error

Solution code:
i = list(map(int, input().split()))
H=i[0]
W=i[1]
x=H*W 
elif H==1 or W==1:
    print(1)
elif x%2==0:
    print(x//2)
else:
    print((x+1)//2)

Submission status: Runtime Error

Solution code:
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
    K = int(readline())

    print(A[K-1])



if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline

H, W = [int(x) for x in input().split()]

d = [[-1] * W for _ in range(H)]
def dfs(x, y):
    stack = [(x, y)]
    d[x][y] = 1
    while stack:
        x, y = stack.pop()
        next_ = [(x + 1, y + 1), (x + 1, y - 1), (x - 1, y + 1), (x - 1, y - 1)]
        for i in next_:
            nx, ny = i
            if 0 <= nx < H and 0 <= ny < W and d[nx][ny] < 0:
                stack.append((nx, ny))
                d[nx][ny] = 1
    return d

d = dfs(0, 0)
cnt = 0
for i in d:
    for j in i:
        if j == 1:
            cnt += 1

print(cnt)

Submission status: Runtime Error

Solution code:
h, 2 = map(int, input().split())
if (h * w) & 1:
  print(h * (w + 1) // 2 - h // 2)
else:
  print(h * w)

Submission status: Runtime Error

Solution code:
import sys
input=lambda: sys.stdin.readline().rstrip()
h,w=map(int,input().split())
ans=((h+1)//2+h//2)*(w//2)
if w%2==1:
  ans+=(h+1)//2
if h==1 or w==1:
  ans=1
peint(ans)