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

Submission status: Accepted

Solution code:
H, W = [int(x) for x in 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(ans)

Submission status: Accepted

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

print('{:.18g}'.format(ans))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
arg = input().split(' ')
H = int(arg[0])
W = int(arg[1])

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

w_odd = (W+1) // 2
w_even = W // 2

h_odd_line = (H+1) // 2
h_even_line = H // 2

reachable = w_odd * h_odd_line + w_even * h_even_line
print(reachable)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    a, b= map(int, input().split())
    if a == 1 or b == 1:
        print('1')
    else:
        if (a*b)%2 == 0:
            print(round((a*b)/2))
        else:
            print(round(((a//2)+(a%2))*b)-(b//2))

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)
        quit()
        
    i = H*W
    if i%2==0:
        print(i//2)
    else:
        print(i//2+1)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
h,w = map(int,input().split())
# 奇数番目は(h+1)//2 個取れる　偶数番目はn//2
if h == 1 or w ==1:
    print(1)
else:
    print((h*w+1)//2)

Submission status: Accepted

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


print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

# コーナーケースに注意！1行 or 1列の時は動けないよ！
if H == 1 or W == 1:
    print(1)
    exit()

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

print(int(ans))

Submission status: Accepted

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

print(a)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

H,W = LI()

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

Submission status: Accepted

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

m = 0
h = a[0]
w = a[1]

'''
for hi in range(h):
    for wi in range(w):
        if (hi+1 + wi+1) % 2 == 0:
            m += 1
'''
if h == 1 or w == 1:
    print(1)
else:
    m = math.ceil(w/2) * math.ceil(h/2) + math.floor(w/2) * math.floor(h/2)
    print(m)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#python3
from math import ceil
def main():
    h, w = map(int, input().split())
    if (h == 1) or (w == 1):
        print(1)
        return

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

Submission status: Accepted

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

Submission status: Accepted

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

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:
def main():
    h, w = map(int, input().split())

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

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

Submission status: Accepted

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

if H == 1 or W ==1:
    print("1")
elif S % 2 == 0:
    print(s)
else:
    print(s+1)

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/2)*ceil(w/2) + int(h/2)*int(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/2)*ceil(w/2) + int(h/2)*int(w/2))

Submission status: Accepted

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

# (偶数、偶数) (奇数、偶数)の場合
if (h%2 == 0 and w%2 ==0) or (h%2 != 0 and w%2 == 0):
    ans = int(w/2) * h

# 奇数、奇数の場合
elif h%2 != 0 and w%2 !=0:
    f = int(w/2) + 1
    s = f-1
    ans = f * (int(h/2)+1) + s * int(h/2)

# 偶数、奇数の場合
elif h%2 == 0 and w%2 != 0:
    f = int(w/2) + 1
    s = int(w/2)
    ans = f * int(h/2) + s * int(h/2)

print(ans)

Submission status: Accepted

Solution code:
h,w = map(int,input().split())
if min(h,w) == 1:
	print(1)
else:
	print(h*w-(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:
import math
h,w = map(float,input().split())
if(min(h,w)==1):
    print(1)
    exit()
print(math.ceil(h*w/2.0))

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:
import math
a=list(map(int,input().split()))
if 1 in a:
  print(1)
else:
  print(math.ceil(a[0]*a[1]/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*0.5*w))
else:
    if w % 2 == 0:
        c = h * int(w * 0.5)
    else:
        c = 0.5 * (int(h * w) + 1)
    print(int(c))

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    input_line = 1
    for i in range(input_line):
        s = input().rstrip().split(' ')
        H = int(s[0])
        W = int(s[1])
        print(1 if H==1 or W==1 else int(H*W/2) if (H%2==0 or W%2 == 0) else int(H*W/2)+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==1:
    res = H*W//2+1
  else:
    res = H*W//2
  print(res)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
tate,yoko=map(int,input().split())
masu=0
h=int(tate/2)
if yoko%2==1:
  gyou=int(yoko/2)+1
  if tate%2==1:
    masu=(2*gyou*h+gyou-h)
  else:
    masu=(2*gyou-1)*h
else:
  gyou=int(yoko/2)
  masu=(gyou*tate)

if yoko==1 or tate==1:
  print(1)  
else:
  print(masu)

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:
import math


n= list(map(int, input().split()))

if n[0] == 1 or n[1] == 1:
  print('1')
  
else:
  print(math.floor((n[0] * n[1] + 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+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)*math.ceil(W/2) + math.floor(H/2)*math.floor(W/2))

Submission status: Accepted

Solution code:
from decimal import Decimal

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

if 1 in {H, W}:
    print(1)
else:
    a = Decimal(H * W + 1)
    print(a // Decimal(2))

Submission status: Accepted

Solution code:
H,W=map(int,input().split())
if min(H,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 W % 2 == 0:
  print(int(W/2*H))

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

Submission status: Accepted

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

print(number)

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)*math.ceil(w/2)+math.floor(h/2)*math.floor(w/2))

Submission status: Accepted

Solution code:
h,w=[int(i) for i in input().split()]
a=(h+1)//2
b=h//2

k=a*((w+1)//2)+b*(w//2)
if h==1 or w==1:
    k=1
print(k)

Submission status: Accepted

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

import math

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

# ポイント: コーナーケースを避けるため、制約の下限に注意する。
# 今回だと、H == 1 or W == 1のとき、必ず1になってしまう。

if H == 1 or W == 1:
    print(1)
elif H % 2 == 1 and W % 2 == 1:
    print(math.ceil(H * W / 2))
else:
    print(int(H * W / 2))

Submission status: Accepted

Solution code:
import sys
import math
args = sys.stdin.readline().split()
row = int(args[0])
column = int(args[1])

result = 0

if row == 1 or column == 1 :
    result = 1
else:
    result = math.ceil((row * column) / 2)

print(result)

Submission status: Accepted

Solution code:
#n = int(input())
#s = input()
h,w = map(int,input().split())
#da = list(map(int,input().split()))
#a = [int(input()) for i in range(n)]

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 = (h * w + 1) // 2
if h == 1 or w == 1:
    ans = 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import floor

N = [int(_) for _ in input().split()]

H, W = N[0], N[1]


def solve(H, W):
    acnt = floor(W / 2) + 1
    bcnt = W - acnt
    
    if H == 1 or W == 1:
        return 1
    else:
        return floor((H * W + 1) / 2)
    
    # if H % 2 == 0:
    #     cnt = acnt * floor(H/2) + bcnt * floor(H/2)
    # else:
    #     cnt = acnt * (floor(H/2) + 1) + bcnt * floor(H/2)
    # return cnt

print(solve(H, W))

Submission status: Accepted

Solution code:
import math

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

x = int(H/2)  #3
y = H%2  #1

z = int(W*x)  # 3

num = z + int((W+1)/2)*y   #

"""""""""
print('x: ' + str(x))
print('y: ' + str(y))
print('z: ' + str(z))
print('num: ' + str(num))

print()

#print(H)
#print(W)
"""""
if H == 1 or W == 1:
    print(1)
else:
    print(int(num))

Submission status: Accepted

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

a = h * w

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

print((a + 1) //2)

Submission status: Accepted

Solution code:
import sys

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

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

if w % 2 == 0:
	cx0 = int(w/2)
	cx1 = cx0
else:
	cx0 = int(w/2) + 1
	cx1 = int(w/2)

if h % 2 == 0:
	print(int(h / 2) * (cx0 + cx1))
else:
	print(int(h / 2) * (cx0 + cx1) + cx0)

Submission status: Accepted

Solution code:
h,w = (int(x) for x in 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)
    exit(0)
if h%2 == 0 or w%2 == 0:print(h*w//2)
else:print(h*w//2+1)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols
    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])
    return ret


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_map_as_int(H):
    '''
    #→1,.→0として読み込む
    '''
    ret = []
    for _ in range(H):
        ret.append([1 if s == '#' else 0 for s in read()[:-1]])
        # 内包表記はpypyでは若干遅いことに注意
        # #numpy使うだろうからこれを残しておくけど
    return ret


# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right
from fractions import gcd


def lcm(a, b):
    # 最小公約数
    g = gcd(a, b)
    return a * b // g


H, W = read_ints()

if H == 1 or W == 1:
    print(1)
    exit()
# 市松模様を分解してカンガル
# Hはそのまま詰める
print((H * (W // 2)) + (W % 2) * ((H + 1) // 2))

Submission status: Accepted

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


h = 0
w = 0
w1 = w2 = 0

if H == 1 or W ==1:
    print(1)
elif W % 2 == 1:#横が奇数
    w = int(W /2) + 1
    if H % 2 == 1:#縦が奇数
        h = int(H / 2) + 1
        w1 = h * w
        w2 = (w-1) * (h-1)
        print(w1 + w2)
    else:#縦が偶数
        h = int(H / 2)
        w1 = w * h
        w2 = (w-1) * h
        print(w1 + w2)
else:#横が偶数
    w = int(W / 2)
    print(w * H)

Submission status: Accepted

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


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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
H, W = [int(str) for str in input().strip().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:
    cnt = 1
else:
    if W % 2 == 0:
        cnt = H*(W//2)
    else:
        cnt = H*(W//2) -(-H//2)
        
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

else:
    if h%2==0:
        print((h//2)*w)
    else:
        print((h//2)*w+(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:
from math import ceil
h,w = map(int,input().split())
ans = h * (w // 2)
if w % 2 != 0 :
    ans += ceil(h/2)
if h == 1 or w == 1:
    ans = 1
print(ans)

Submission status: Accepted

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

mas = h*w

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

Submission status: Accepted

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

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

    h1 = (h + 1) // 2
    h2 = h // 2

    if (w % 2) == 1:
        print(h1 * ((w // 2) + 1) + (h2 * (w // 2)))
    else:
        print((h1 + h2) * (w // 2))


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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:
        ans = 1
    else:
        ans = (h*w+1)/2

    print(int(ans))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math

def main():
    H,W = list(map(int, input().split(' ')))
    if(H == 1 or W ==1):
        print(1)
    else:
        print(math.ceil((W*H)/2))
main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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

# type2
b = H // 2

# type1
a = H - b

ans += b * (W // 2)
ans += a * (W - (W // 2))

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

H = i[0]
W = i[1]


if(W == 1):
    print(1)
elif(H == 1):
    print(1)
#横が偶数の時は、縦の偶奇によらない
elif(W % 2 == 0):
    yoko = W // 2
    print(yoko*H)
#横が奇数の時は、縦の偶奇による
elif(W % 2 != 0):
    yoko = W // 2 + 1
    #縦が偶数の時
    if(H % 2 == 0):
        print(yoko*(H//2)+(yoko-1)*(H//2))
    #縦が奇数の時
    else:
        print(yoko*(H//2+1)+(yoko-1)*(H//2))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math
def main(h,w):
    if h==1 or w==1:
        return 1
    return math.ceil((w*h)/2)

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
from math import ceil, floor
from collections import deque, Counter, defaultdict
from fractions import gcd
input = lambda: sys.stdin.readline().rstrip()

def eprint(s):
    sys.stderr.write('DEBUG: {}'.format(s))
    return

def main():
    h,w = map(int, 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)
    return

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

w1 = -(-W//2)
w2 = W-w1
h1 = -(-H//2)
h2 = H - h1
print(w1*h1 + w2*h2)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math
H,W = input().split()
Hnum = int(H)
Wnum = int(W)
counter = 0
tmp = 0
if Hnum == 1 or Wnum == 1:
    counter =1
elif Hnum%2 == 0:
    counter = int(Hnum/2 * Wnum)
else:
    tmp = math.ceil(Wnum/2)
    Hnum -=1        
    counter = int((Hnum/2 * Wnum) +tmp)
print(counter)

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.0))

Submission status: Accepted

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

Submission status: Accepted

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

# process
if W == 1 or H == 1:
    print(1)

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

Submission status: Accepted

Solution code:
from decimal import Decimal
a,b = list(map(int,input().split()))
if a == 1 or b ==1:
    d =1
elif a*b%2==0 and a >1 and b >1:
    d = a*b/2
else:
    d = (a*b+1)/2
print(Decimal(d))

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

Submission status: Accepted

Solution code:
from decimal import *
H,W=map(int,input().split())
if H==1 or W==1:
	print(1)
	exit()
t = H//2 + H%2
t2 = t + H//2
x = Decimal((W//2*t2)) + Decimal((W%2*t))
print(x)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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 // 2) * w + math.ceil(w / 2)

print(ans)

Submission status: Accepted

Solution code:

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


h = 0
w = 0
w1 = w2 = 0

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


elif W % 2 == 1:#横が奇数
    w = int(W /2) + 1
    if H % 2 == 1:#縦が奇数
        h = int(H / 2) + 1
        w1 = h * w
        w2 = (w-1) * (h-1)
        print(w1 + w2)
    else:#縦が偶数
        h = int(H / 2)
        w1 = w * h
        w2 = (w-1) * h
        print(w1 + w2)
        
        
else:#横が偶数
    w = int(W / 2)
    print(w * H)

Submission status: Accepted

Solution code:
# coding: utf-8
# 自分の得意な言語で
# Let's チャレンジ！！
input_line = input()
lines = input_line.split()
x=int(lines[0])
y=int(lines[1])
input_num=x*y
if(x==1 or y==1):
  print(1)
else:
  if((x*y)%2==1):
    print(int(input_num/2)+1)
  else:
    print(int(input_num/2))