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 math
H, W = map(int, input().split())
area = H * W
if(H == 1 or W == 1):
    print(1)
else:
    print(math.ceil(area / 2))

Submission status: Accepted

Solution code:
h,w=input().split(' ')
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())

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

Submission status: Accepted

Solution code:
a, b = (int(x) for x in input().split())
 
if a == 1 or b == 1:
    print("1")
elif a * b % 2 == 0:
    print(int(a * b / 2))
else:
    print(int((a * b - 1) / 2 + 1))

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:
#! /usr/bin/env python3
# -*- coding:utf-8 -*-

import math

def get_num_of_reachable(H, W):
    if H == 1 or W == 1: return 1
    else: return math.ceil((H*W)/2)

def main():
    H, W = map(int, input().split())
    print(get_num_of_reachable(H, W))

if __name__ == "__main__":
    try:
        assert get_num_of_reachable(4, 5) == 10
        assert get_num_of_reachable(7, 3) == 11
        assert get_num_of_reachable(1000000000, 1000000000) == 500000000000000000
    except:
        import traceback
        traceback.print_exc()
        exit()
    main()

Submission status: Accepted

Solution code:
H,W=[int(i) for i in input().split()]
if H==1 or W==1:
    print(1)
else:
    print(int(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: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)
elif n*m%2 == 0:
 print(n*m//2)
else:
 print(n*m//2+1)

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())
resp = h*w//2
if h == 1 or w == 1:
    print(1)
else:
    if (h * w) % 2 != 0:
        resp += 1
        print(resp)

    elif (h*w) % 2 == 0:
        print(resp)

Submission status: Accepted

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

sum = float(H*W)
if sum%2 == 0:
    if H == 1 or W == 1:
        print(1)
    else:
        print(H*W//2)
else:
    if H == 1 or W == 1:
        print(1)
    else:
        print(math.floor(H*W/2)+1)

Submission status: Accepted

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

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

tmp = H * W

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

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:
h,w=map(int,input().split())
if h ==1 or w == 1:
    print(1)
    exit()
ans = (w+1)//2*((h+1)//2) + (w//2) * (h//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:
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:
a,b = map(lambda x:int(x),input().split())
if a==1 or b==1:
  print(1)
else:
  print(int((a*b)/2+(a*b)%2))

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(move_count)

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
input = sys.stdin.readline


def read():
    H, W = map(int, input().strip().split())
    return H, W

def solve(H, W):
    if H == 1 or W == 1:
        return 1
    n = H * W
    return n // 2 + n % 2

if __name__ == '__main__':
    inputs = read()
    print("%d" % solve(*inputs))

Submission status: Accepted

Solution code:
H, W = [int(i) for i in input().split()]

masu_sum = H * W

if H == 1 or W == 1:
    ans = 1
elif masu_sum % 2 == 0:
    ans = masu_sum // 2
else:
    ans = masu_sum // 2 + 1

print(ans)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
N, M = map(int, input().split())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
line = input()
data = line.split()
 
height = int(data[0])
wei = int(data[1])

if height !=1 and wei !=1: 
  if height %2 ==0:
    if wei %2 ==0:
      print(int(wei/2)*height)
    else:
      print(int(wei/2)*height+int(height/2))
  else:
    if wei %2 ==0:
      print(int(height/2)* wei + int(wei/2))
    else:
      print(wei* int(height/2) + int(wei/2)+1)
else:
  print(1)

Submission status: Accepted

Solution code:
H, W = [int(n) for n in input().split()]
if H == 1 or W == 1:
    print(1)
elif H%2 == 0:
    print(H*W//2)
else:
    h = (H+1)//2
    h_ = h-1
    if W%2 == 0:
        print((h+h_)*W//2)
    else:
        print((h+h_)*(W//2) + h)

Submission status: Accepted

Solution code:
import sys
import math
input=sys.stdin.buffer.readline
h,w=map(int,input().split())
ans=math.ceil(h*w/2)
print(1 if min(h,w)==1 else ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict

con = 10 ** 9 + 7
#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	H, W = getlist()
	if H == 1 or W == 1:
		print(1)
		return

	if (H * W) % 2 == 0:
		print(int(H * W // 2))
		return

	print((H * W // 2) + 1)


if __name__ == '__main__':
	main()

Submission status: Accepted

Solution code:
import math
h,w = map(int,input().split())
ans = 0

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

else:
    #奇数行目+偶数行目
    ans += math.ceil(h/2)*math.ceil(w/2)+(h//2)*(w//2)
 
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x,y=list(map(int,raw_input().split()))
w=x
h=y
if x==1 or y==1:
  print("1")
  exit(0)
ans=x//2 * (h//2 + (h+1)//2)
if x%2==1:
     ans+=(h+1)//2
print(ans)

Submission status: Accepted

Solution code:
import math
data = input().split(' ')
h = int(data[0])
w = int(data[1])
if h == 1 or w == 1:
    print(1)
else:
    ans = math.ceil(h/2) * math.ceil(w/2) + math.floor(h/2) * math.floor(w/2)
    print(ans)

Submission status: Accepted

Solution code:
import math
h,w = map(int,input().split())
a = h*w/2

if h == 1 or w == 1:
    print(1)
else:
    print(math.ceil(a))

Submission status: Accepted

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

masu = h * w

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

Submission status: Accepted

Solution code:
def readInt():
    return list(map(int, input().split()))
    
h, w = readInt()
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 = map(int, input().split())
res = H * W
if H == 1 or W == 1:
    ans = 1
elif res % 2 == 0:
    ans = res // 2
else:
    ans = res//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 == 1:
    print(int((H*W+1)/2))
else:
    print(int(H*W/2))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
from fractions import gcd
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    # # 到達していないところはFalseにしとこう
    # h,w = readInts()
    # Field = [[0] * w for _ in range(h)]
    # d = deque()
    # # 最初左上にいるらしい
    # # 移動方向 diagonaaaaaaal!
    # dx = [-1,-1,1,1]
    # dy = [-1,1,-1,1]
    # # dfsしたい
    # d.append([0,0]) # 初期値を入れる
    # cnt = 0
    # while d:
    #     x,y = d.pop()
    #     Field[y][x] = 1
    #     #cnt += 1
    #     for i in range(4):
    #         nx = x + dx[i]
    #         ny = y + dy[i]
    #         if nx < 0 or w <= nx or ny < 0 or h <= ny:
    #             continue
    #         if Field[ny][nx] == 0:
    #             continue
    #         # 探索済みならいかない
    #         d.append([nx,ny])
    # for x in range(w):
    #     for y in range(h):
    #         if Field[y][x] == 1:
    #             cnt += 1
    # print(cnt)
    h,w = readInts()
    mul = h * w # multiplication
    if h == 1 or w == 1:
        print(1)
    elif mul % 2 == 0:
        print(mul // 2)
    else:
        print((mul+1)//2)
if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
H, W = 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())

all = H * W

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

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:
from math import ceil
H, W = map(int, input().split())
if 1 in [H, W]:
    print(1)
else:
    print(ceil(H * W / 2))

Submission status: Accepted

Solution code:
H,W = map(int,input().split())
K = 0
L = 0
#条件分岐
#H = 奇数 W = 奇数
if H == 1:
    K = 1
elif W == 1:
    K = 1
elif H == 2:
    K = W
elif W == 2:
    K = H
else:
    if H%2 == 1 and W%2 == 1:
        K = (H//2+1)*(W//2+1)
        L = (H//2)*(W//2)
    #H = 奇数 W = 偶数
    elif H%2 == 1 and W%2 == 0:
        K = (H//2+1)*(W//2)
        L = (H//2)*(W//2)
    #H = 偶数 W = 奇数
    elif H%2 == 0 and W%2 == 1:
        K = (H//2)*(W//2+1)
        L = (H//2)*(W//2)
    else:
        K = H*(W//2)
        L = 0
print(K+L)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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



if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

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

main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

if W == 1 or H == 1:
    print(1)
elif H % 2 == 0 or 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)
    exit()
if h%2+w%2==0:
    print((h//2)*w)
elif h%2==1 and w%2==0:
    print((w//2)*h)
elif w%2==1 and h%2==0:
    print((h//2)*w)
else:
    print((h//2+1)*(w-w//2)+(h//2)*(w//2))

Submission status: Accepted

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

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:
h,w=map(int,input().split())
print(-(-h*w//2) if h*w>=h+w else 1)

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 a==1 or b==1:
  print(1)
else:
  print(a*b//2+(a*b)%2)

Submission status: Accepted

Solution code:
import numpy as np
import sys

input = sys.stdin.readline

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:
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:
#coding:utf-8
h, w = map(int,input().split())

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

print("{}".format(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import ceil
r, c = map(int, input().split())
if r == 1 or c==1:
    print(1) # because 0 or 1 movements
else:
    print(ceil((r * c) / 2))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if H == 1 or 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)
    exit()
if h*w % 2 == 0:
    print(h*w//2)
else:
    print((h*w+1)//2)

Submission status: Accepted

Solution code:
h,w = map(int,raw_input().split())
if h ==1 or w == 1:
    print 1

else:

    print (w*h+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 or W==1:
  Answer =1

elif W%2 ==0:
  Answer = W/2*H
  
else:
  count = (W-1)/2 +1
  if H%2 ==0:
    Answer = count*H - H/2
  else:
    Answer = count*H - (H-1)/2

print(int(Answer))

Submission status: Accepted

Solution code:
H,W = map(int,input().split())
#N = int(input())
#B = list(map(int,input().split()))
c=0

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

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

Submission status: Accepted

Solution code:
H,W=map(int,input().split())
def ABC(a):
    if a%2==1:
        return (a//2)+1
    elif a%2==0:
        return a//2
if H>1 and W>1:
    ans=(H//2)*(W//2)+(ABC(H)*ABC(W))
    print(ans)
else:
    print(1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

import math

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

if h==1 or w==1:
    ans=1
elif h%2==0:
    ans=(int)(h/2*(math.ceil(w/2)+math.ceil((w-1)/2)))
else:
    ans=(int)((h-1)/2*(math.ceil(w/2)+math.ceil((w-1)/2))+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+(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:
      print(H*W//2)
    else:
      if W%2==0:
        print(H*W//2)
      else:
        print(H*(W-1)//2+(H+1)//2)

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/2*W))

Submission status: Accepted

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

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

else:
    ans = H//2 * W

if H == 1 or W == 1:
    ans = 1

print(ans)

Submission status: Accepted

Solution code:
import sys
h, w = map(int,sys.stdin.readline().split())
if w == 1 or h == 1:
  print(1)
else:
  if h % 2 != 0:
    if w % 2 != 0:
      print(h * w // 2 + 1)
    else:
      print(h * w // 2)
  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 % 2 == 0:
    print(int(H * W / 2))
else:
    if W % 2 == 0:
        print(int(H * W / 2))
    else:
        print(int(((H * W) + 1) / 2))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

N, M = list(map(int, input().split()))
if N == 1 and M != 1:
    ans = 1
elif N != 1 and M == 1:
    ans = 1
else:
    a = ((N + 1) // 2) * ((M + 1) // 2)
    b = (N // 2) * (M // 2)
    ans = a + b
print(ans)

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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


if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
import math

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

if H == 1 or W == 1:
    print(1)
else:
    o = math.ceil(W/2)
    e = W//2

    if H % 2 == 0:
        print((o+e)*(H//2))
    else:
        print((o+e)*(H//2) + o)

Submission status: Accepted

Solution code:
M, N = map(int,input().split())

if M == 1 or N == 1:
  print(1)
elif M * N % 2 == 1:
    print(M * N // 2 + 1)
elif M*  N % 2 == 0:
    print(M * N // 2)

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    h,w=map(int,input().split())
    if h==1 or w==1:
        print(1)
        sys.exit()
    if h*w%2==0:print(h*w//2)
    else:print((h*w+1)//2)

if __name__=='__main__':
    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(int((H*W+1)/2))
elif H ==0 or W == 0:
    print(0)
else:
    print(int((H*W)/2))

Submission status: Accepted

Solution code:
import math

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

if (h == 1 or w == 1):
    print(1)
    quit()
print(math.ceil(h * w /2))

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:
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:
import math
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 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 = 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:
    answer = 1
else:
    answer = 0
    answer += (((H+1)//2)*((W+1)//2) + ((H//2)*(W//2)))

print(answer)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
m, n = map(int, input().split())

ans = -1

mn = m*n

if m == 1 or n == 1:
    ans = 1
else:
    ans = int((m*n + 1)/2)
    
print(ans)

Submission status: Accepted

Solution code:
m, n = map(int, input().split())

ans = -1

mn = m*n

if m == 1 or n == 1:
    ans = 1
else:
    if mn%2 == 0:
        ans = int(mn/2)
    else:
        ans = int(mn/2) + 1
    
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)+1)//2)

Submission status: Accepted

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

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

else:
    a = (h+1) // 2 #奇数列の列数
    b = (w+1) // 2 #奇数列のマス目数
    c = h // 2 #偶数列の列数
    d = w // 2 #偶数列のマス目数
    
    print(a*b+c*d)

Submission status: Accepted

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

if H == 1 or W == 1:
    print(1)
else:
    a = (H + 1) // 2
    b = (W + 1) // 2
    c = H // 2
    d = W // 2

    print(a * b + c * d)

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:
    print(1)
else:
    print(((H*W)+1)//2)

Submission status: Accepted

Solution code:
# 4 5
import math
field = [int(i) for i in input().split(" ")]
field_num = field[0] * field[1]
if field[0] == 1 or field[1] == 1:
    print(1)
else:
    canFillBlock = 0
    canFillBlock += math.ceil(field[1]/2) * math.ceil(field[0]/2)
    canFillBlock += math.floor(field[1]/2) * math.floor(field[0]/2)
    print(canFillBlock)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
height,width = map(int,input().split())

if height%2==0:
  h1=height//2
  h2=height//2
else:
  h1 = height//2 +1
  h2 = height//2

if height==1 or width ==1:
  ans = 1
else:
  ans = (h1+h2)*(width//2) + h1*(width%2)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
h, w = map(int, input().strip().split())
pattern1 = (w + 1) // 2
pattern2 = w // 2

ans = pattern1 * ((h + 1) // 2) + pattern2 * (h // 2)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
input = sys.stdin.readline

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

Submission status: Accepted

Solution code:
#!/usr/bin python3
# -*- coding: utf-8 -*-

import sys
input = sys.stdin.readline

def main():
    H, W = map(int, input().split())
    if H==1 or W==1:
        print(1)
    else:
        x1 = H // 2
        x0 = H - x1
        y1 = W // 2
        y0 = W - y1
        print(x1*y1+x0*y0)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
h, w = list(map(int, input().split()))
print( (h*w) // 2 + (h*w) % 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:
    print(1)    
elif (H*W) % 2 == 0:
    print(int(H*W / 2))
else:
    print(int(H*W/2)+1)

Submission status: Accepted

Solution code:
n, w=map(int, input().split())
if n==1 or w==1:
    print(1)
elif n%2==1 and w%2==1:
    print(n*w//2 +1)
else:
    print(n*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))

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 a == 1 or b == 1:
    print("1")
else:
    print(a*b//2+a*b%2)

Submission status: Accepted

Solution code:
h, w = map(int, input().split())
if h == 1 or w == 1:
    ans = 1
elif (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:
    if H % 2 == 1 and W % 2 == 1:
        ans = H * (W // 2) + H // 2 + 1
    else:
        ans = W * H // 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+1) // 2)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

#%%
ho = H // 2 + H % 2
he = H // 2
wo = W - (W // 2)
we = W // 2
ans = ho * wo + he * we
if H == 1 or W == 1:
    print(1)
else:
    print(ans)

Submission status: Accepted

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

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:
import math
H,W=[int(s) for s in input().split(" ")]

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

Submission status: Accepted

Solution code:
import math
h,w = map(int,input().split())
if h == 1 or w == 1 :
    print(1)
elif h %2 == 0 or w %2 ==0:
    print(int(h*w//2))
else:
    print(int(math.ceil(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+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 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:
  odd = ((W + 1) // 2) * ((H + 1) // 2)
  even = (W // 2) * (H // 2)
  print(odd + even)

Submission status: Accepted

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

Submission status: Accepted

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

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

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