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: Accepted

Solution code:
import bisect

def sRaw():
    return input().rstrip("\r")


def iRaw():
    return int(input())


def ssRaw():
    return input().split()


def isRaw():
    return list(map(int, ssRaw()))


INF = 1 << 29

DIV = (10**9) + 7


def mod_inv_prime(a, mod=DIV):
    return pow(a, mod-2, mod)


def ncr(n, r, mod=DIV):
	r = min(r, n-r)
	ret = 1
	for i in range(1, r+1):
		ret = ret * (n-i+1) % mod
		ret = ret * mod_inv(i, mod) % mod
	return ret


def mod_inv(a, b):
    r = a
    w = b
    u = 1
    v = 0
    while w != 0:
        t = r//w
        r -= t*w
        r, w = w, r
        u -= t*v
        u, v = v, u
    return (u % b+b) % b


def CONV_TBL(max, mod=DIV):
    fac, finv, inv = [0]*max, [0]*max, [0]*max
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, max):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod % i] * (mod//i) % mod
        finv[i] = finv[i-1]*inv[i] % mod

    class CONV:
        def __init__(self):
            pass

        def ncr(self, n, k):
            if(n < k):
                return 0
            if(n < 0 or k < 0):
                return 0
            return fac[n]*(finv[k]*finv[n-k] % mod) % mod
    return CONV()


def main():
    H,W = isRaw()
    if W==1 or H==1:
        return 1
    return (H*W+1)//2


if __name__ == "__main__":
    print(main())

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

if H == 1:
    print(1)
elif W == 1:
    print(1)
else:
    print((H * W + 1) // 2)

Submission status: Accepted

Solution code:
H,W = map(int,input().split())
if H == 1 or W == 1:
    print(1)
    exit()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

D = H * W

if H == 1 or W == 1:
    print(1)
    exit()

if D % 2:
    print(D//2+1)
else:
    print(D//2)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math
H, W = map(int, input().split())
if H < 2 or W < 2:
    ans = 1
else:
    ans = math.ceil((H * W) / 2)
print(ans)

Submission status: Accepted

Solution code:
H,W = map(int,input().split())
h,w = H//2, W//2
h1, w1 = h, w
if H & 1:
    h += 1

if W & 1:
    w += 1

if H == 1:
    print(1)
elif W == 1:
    print(1)
else:
    print(w * h + w1 * h1)

Submission status: Accepted

Solution code:
H, W = map(int, input().split())
if H == 1 or W == 1:
    print(1)
    exit()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])
 
def main():
    h,w = inpm()
    if h==1 or w==1:
        print(1)
        return
    if h*w %2 == 0:
        print(h*w//2)
    else:
        print(h*(w-1)//2+(h+1)//2)
 
if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if h == 1 or w == 1:
    print(1)
    exit()
else:
    if w%2 and h%2:
        print(h*w//2+1)
    else:
        print(h*w//2)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
H,W = map(int,input().split())
if H==1 or W == 1:
    ans = 1
else:
    ans = math.ceil(H*W/2)
print(ans)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    h,w=MI()
    if h==1 or w==1:print(1)
    else:print((h*w+1)//2)

main()

Submission status: Accepted

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

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

Submission status: Accepted

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

if w == 1:
    print(1)
elif h == 1:
    print(1)
else:
    a = (w+1)//2
    b = w//2

    print(h//2 * (a+b) + (h%2) * a)

Submission status: Accepted

Solution code:
import math

h, w = map(int, input().split())

if w == 1 or h == 1:
    print(1)
else:
    ans = h // 2 * w

    if h % 2 == 1:
        ans += math.ceil(w/2)

    print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

h, w = MAP()
ans = h * w // 2
if h % 2 == 1 and w % 2 == 1:
    ans += 1
if h == 1 or w == 1:
    ans = 1
print(ans)

Submission status: Accepted

Solution code:
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    H,W=MI()
    if H==1 or W==1:
        print(1)
    else:
        print((H*W+1)//2)

main()

Submission status: Accepted

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

if h == 1 or w == 1:
    print("1")
    exit(0)

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(1000000000)
import math
from fractions import gcd
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok

def get_inv(n, modp):
    return pow(n, modp-2, modp)

def factorials_list(n, modp):    # 10**6
    fs = [1]
    for i in range(1, n+1):
        fs.append(fs[-1] * i % modp)
    return fs

def invs_list(n, fs, modp):     # 10**6
    invs = [get_inv(fs[-1], modp)]
    for i in range(n, 1-1, -1):
        invs.append(invs[-1] * i % modp)
    invs.reverse()
    return invs

def comb(n, k, modp):
    num = 1
    for i in range(n, n-k, -1):
        num = num * i % modp
    den = 1
    for i in range(2, k+1):
        den = den * i % modp
    return num * get_inv(den, modp) % modp

def comb_from_list(n, k, modp, fs, invs):   
    return fs[n] * invs[n-k] * invs[k] % modp

#

class UnionFindEx:
    def __init__(self, size):
        #正なら根の番号、負ならグループサイズ
        self.roots = [-1] * size
    def getRootID(self, i):
        r = self.roots[i]
        if r < 0:   #負なら根
            return i
        else:
            r = self.getRootID(r)
            self.roots[i] = r
            return r
    def getGroupSize(self, i):
        return -self.roots[self.getRootID(i)]
    def connect(self, i, j):
        r1, r2 = self.getRootID(i), self.getRootID(j)
        if r1 == r2:
            return False
        if self.getGroupSize(r1) < self.getGroupSize(r2):
            r1, r2 = r2, r1
        self.roots[r1] += self.roots[r2]    #サイズ更新
        self.roots[r2] = r1
        return True

def main():
    H,W=mis()
    if H==1 or W==1:
        print(1)
        return
    od = math.ceil(W/2)
    ev = W//2
    ans = (od+ev) * (H//2)
    if H&1:
        ans += od
    print(ans)



main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

# S = input()
# N, M = map(int, input().split())
# nums = list(map(int, input().split()))
# nums_2d = [list(map(int, input().split())) for _ in range(N)]


def main():
    print(solve())


def solve():
    h, w = map(int, input().split())

    if h == 1 or w == 1:
        return 1

    return ((h * w) + 1) // 2


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
H,W= list(map(int,input().split(" ")))
mul = H * W
ans = mul//2
if H == 1 or W == 1:
    ans = 1
elif mul % 2 == 1:
    ans +=1
print(ans)

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    h, w = tuple([int(n) for n in input().split()])

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

Submission status: Accepted

Solution code:
def main():
    H,W = [int(i) for i in input().split()]
    if H == 1 or W == 1:
        print(1)
        return
    if H * W % 2 == 0:
        print(H*W//2)
    else:
        print(H*W//2+1)
main()

Submission status: Accepted

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

if h == 1 or w == 1:
    print(1)
    exit()

print((h*w)//2 + (h*w) %2)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

H,W = m()

if H == 1 or W == 1:
    print(1)
    exit()

po = W * (H // 2)
if H % 2 == 1:
    po += -(-W//2)
print(po)

Submission status: Accepted

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

if H == 1 or W == 1:
    print(1)
    sys.exit()

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin,setrecursionlimit
import math
setrecursionlimit(10**7)
h,w = map(int,stdin.readline().rstrip().split())
if h == 1 or w == 1:
    print(1)
    exit()
print(math.ceil(h*w/2))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
H, W = input().split()[0:2]
H = int(H)
W = int(W)

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

Submission status: Accepted

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

hw=h*w

if h==1 or w==1:
    print(1)
elif hw%2==0:
    print(hw//2)
else:
    print(1+hw//2)

Submission status: Accepted

Solution code:
# from heapq import heappush, heappop, heapify
# from fractions import gcd
# import itertools
# from operator import attrgetter, itemgetter
# import math

import sys

# import numpy as np

ipti = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    h, w = list(map(int, ipti().split()))
    ans = 0
    ans += ((w + 1) // 2) * ((h + 1) // 2)
    ans += (w // 2) * (h // 2)

    if h == 1 or w == 1:
        ans = 1

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

if H==1:
  print(1)
else:
  if W==1:
    print(1)
  else:
    print(math.ceil(H*W/2))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
R, C = map(int, input().split())

if R == 1 or C == 1:
  print(1)
  raise SystemExit

first = C // 2 if C % 2 == 0 else C // 2 + 1
second = C - first

if R % 2 == 0:
  print(C * (R // 2))
else:
  print(C * (R // 2) + first)

Submission status: Accepted

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

if min(H, W) == 1 :
    print(1)
    exit()

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
import math
H,W = map(int,input().split())
if H == 1 or W == 1:
    print(1)
else:
    print(math.ceil(H*W/2))

Submission status: Accepted

Solution code:
inpl = lambda: list(map(int,input().split()))
H, W = inpl()
if H == 1 or W == 1:
    print(1)
else:
    X = H * W
    print((X+1)//2)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if H == 1 or W == 1:
    print(1)
else:
    q,r = divmod(H*W, 2)
    print(q+r)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

al = H * W

if H == 1 or W == 1:
    ans = 1
elif al % 2 == 0:
    ans = al // 2
else:
    ans = (al + 1) // 2

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

if h == 1 or w == 1:
    print(1)
    exit()

q, r = divmod(h, 2)
q2, r2 = divmod(w, 2)

ans = (q + r) * (q2 + r2) + q * q2
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(H, W):
    if min(H, W) == 1:
        return 1
    return -(-(H*W)//2)


def main():
    H, W = read_int_n()
    print(slv(H, W))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

print(Ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
range = xrange
input = raw_input

h, w = [int(x) for x in input().split()]

if h == 1 or w == 1:
    print 1
else:
    hup = h + 1 >> 1
    hdown = h >> 1
    wup = w + 1 >> 1
    wdown = w >> 1
    print hup*wup + hdown*wdown

Submission status: Accepted

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

Submission status: Accepted

Solution code:
H, W = [int(i) for i in input().split()]
if H == 1 or W == 1:
    print(1)
else:
    if H%2 == 1 and W%2 == 1:
        print(H*W//2+1)
    else:
        print((H*W)//2)

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

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

Submission status: Accepted

Solution code:
#import sys
MOD = 10 ** 9 + 7
INFI = 10**10
#input = sys.stdin.readline
import math

import itertools

#import bisect

import copy
from functools import lru_cache

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

#    h,w,a,b = map(int, input().split())
#    c = [[0 for j in range(n)] for i in range(n)]



def main():
    h,w=map(int,input().split())
    ans=0
    if h==1 or w==1:
        ans=1
    elif h%2==0 or w%2==0:
        ans=h*w//2
    else:
        ans=h*w//2+1
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():
    import sys
    import math
    H,W=list(map(int,sys.stdin.readline().split()))
    
    if H==1 or W==1:
        return 1

    return math.ceil(H*W/2)

print(main())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
if 1 in [a, b]:
  print(1)
  exit()
print((a*b+1)//2)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
read = sys.stdin.read

#n,*a = [int(i) for i in read().split()]
h,w = [int(i) for i in readline().split()]


if h==1 or w==1:
    print(1)
    exit()


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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
h,w = map(int, input().split())
if(h==1)|(w==1):
    print(1)
    exit()

print((h*w + 1)//2)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    h,w = LI()
    if min(h,w) == 1:
        print(1)
        return 
    k = w>>1
    ans = (h>>1)*k+(h-(h>>1))*(k+(w&1))
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
from math import ceil

h, w = map(int, input().split())

if h == 1 or w == 1:
    print(1)
    exit(0)

print(int(ceil(h*w/2)))

Submission status: Accepted

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

Submission status: Accepted

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

if h ==1 or w == 1:
  print(1)
  exit()
  
import math

print(math.ceil(h*w/2))

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

import sys
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

a,b=MAP()
if a==1 or b==1:
    print(1)
    exit()
n=a*b
if n%2==0:
    print(n//2)
else:
    print(n//2+1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

if H == 1 or W == 1:
  print(1)
  exit()

t = (H * W) // 2
t += (H * W) % 2

print(t)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x,y = map(int,input().split())
if x==1 or y==1:
  print(1)
  exit(0)
print((x*y+1)//2)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
if A == 1 or B == 1:
  print(1)
elif (A*B) % 2 == 0:
  print(A*B//2)
else:
  print(A*B//2+1)

Submission status: Runtime Error

Solution code:
a = [int(c) for c in input().split()]
r = a[0]*a[1]
if a[0] == 1 or a[1] == 1:
    print(1)
else r % 2 == 0:
    print(int(r/2))
else:
    print(int(r/2+1))

Submission status: Runtime Error

Solution code:
import math

a,b = map(int,input().split())
c = math.ceil(a*b/2)
if a = b = 1:
    print(1)
else:
    print(c)

Submission status: Runtime Error

Solution code:
import math

a,b = map(int,input().split())

if a = b = 1:
    print(1)
else:
    print(math.ceil(a*b/2))