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

Submission status: Accepted

Solution code:
#たてよこ
N , M = (map(int , input().split()))
a = N*M
ans = -(-a//2)
if N == 1 or M == 1:
    print(1)
else:
    print(ans)

Submission status: Accepted

Solution code:
import sys
import numpy as np
import heapq


def input():
    return sys.stdin.readline()[:-1]


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


if __name__ == "__main__":
    solve()

Submission status: Accepted

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

ans = 0
if h == 1:
    print(1)
elif w == 1:
    print(1)
elif h % 2 == 0:
    ans = int(h/2 * w)
    print(ans)
elif (h % 2 != 0) and (w % 2 == 0):
    ans = int(h * w/2)
    print(ans)
elif (h % 2 != 0) and (w % 2 != 0):
    ans = int((h//2 +1) * (w//2 +1)) + (h//2 * (w - 1 - w//2))
    print(int(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 or w % 2 == 0:
    print(h*w//2)
else:
    if h <= w:
        a = (w-1)*h//2
        b = (h+1)//2
    else:
        a = (h-1)*w//2
        b = (w+1)//2
    print(a+b)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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//2+1)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math
input = input().split(" ")
h = int(input[0])
w = int(input[1])
if h != 1:
  if w != 1:
    mult = h*w
    res = math.ceil(mult / 2)
    print(res)
  else:
    print(1)
else:
  print(1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

h, w = input().split()

h, w = int(h), int(w)

if (h == 1) or (w == 1):
  print(1)
else:
  print(math.ceil(max([h, w]) / 2) * math.ceil(min([h, w]) / 2) + math.floor(max([h, w]) / 2) * math.floor(min([h, w]) / 2))

Submission status: Accepted

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

print(main())

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

H, W = map(int, input().split())
if H == 1 or W == 1:
  print("1")
  exit()
result = 0
yoko_1 = 0
yoko_2 = 0

if W%2 == 0:
  yoko_1 = int(W/2)
  yoko_2 = int(W/2)
else:
  yoko_1 = int(math.floor(W/2+0.5))
  yoko_2 = int(math.floor(W/2-0.5))
  
tate_1 = 0
tate_2 = 0

if H%2 == 0:
  tate_1 = int(H/2)
  tate_2 = int(H/2)
else:
  tate_1 = int(math.floor(H/2+0.5))
  tate_2 = int(math.floor(H/2-0.5))

result = yoko_1 * tate_1 + yoko_2 * tate_2

print(int(result))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if a == 1 or b == 1:
	print(1)
else:
	if a%2 == 1 and b%2 == 1:
		print( (a*b)//2 + 1 )
	else:
		print((a*b)//2)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

HW = input().split()

H = int(HW[0])
W = int(HW[1])


result = int(0)

y1 = 0
y2 = 0
if W%2 == 1:
    y1 = int(W/2) + 1
    y2 = int(W/2)
else:
    y1 = int(W/2)
    y2 = y1


if H%2 == 1:
    result += y1 * (int(H/2) + 1)
    result += y2 * int(H/2)
else:
    result += y1 * int(H/2)
    result += y2 * int(H/2)

if H == 1 or W == 1:
    result = 1

print(result)

Submission status: Accepted

Solution code:
import numpy as np
h_w_list = [int(i) for i in input().split()]

if h_w_list[0] == 1 or h_w_list[1] ==1:
    print(1)

elif h_w_list[0]*h_w_list[1] % 2 == 0:    
    print(int(h_w_list[0]*h_w_list[1]/2))

else:
    print(int(np.ceil(h_w_list[0]*h_w_list[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 or 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())
cnt1=math.ceil(h/2)
cnt2=math.ceil((h-1)/2)
ans=0
if h==1 or w==1:
  ans=1
else:
  if w%2==0:
    ans=int((cnt1+cnt2)*w/2)
  else:
    ans=int((cnt1+cnt2)*(w-1)/2+cnt1)
    
print(ans)

Submission status: Accepted

Solution code:
from sys import stdin
import math as m
input = stdin.readline

r,c = map(int,input().split())

if r==1 or c==1:
  print("1")
else:
  total = m.ceil(c/2) * m.ceil(r/2) + m.floor(c/2)* m.floor(r/2)

  print(total)

Submission status: Accepted

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

Submission status: Accepted

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

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 != 0:
        ans += 1
    
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 // 2))

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

Submission status: Accepted

Solution code:
import math

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

is_odd_h = False
is_odd_w = False

if h % 2 == 0:
     pass
else:
     is_odd_h = True

if w % 2 == 0:
     pass
else:
     is_odd_w = True

if is_odd_h and is_odd_w:
    ans = math.ceil(h * w / 2)
else:
    ans = h * w / 2

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

print(int(ans))

Submission status: Accepted

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

if(H%2 != 0):
    ha = H//2+1
    hb = H//2
else:
    ha = H//2
    hb = H//2
if(W%2 != 0):
    wa = W//2+1
    wb = W//2
else:
    wa = W//2
    wb = W//2
if(H != 1 and W != 1):
    print(ha*wa+hb*wb)
else:
    print(1)

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 + 1) // 2)

Submission status: Accepted

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

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

if H == 1 or W == 1:
  ans=1
    
ans=int(ans)
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//2)+1)

Submission status: Accepted

Solution code:
inp = list(map(int,input().split()))
 
a = inp[0]*inp[1]

if (inp[0]==1 or inp[1]==1):
    print("1")
else:
    if (a %2 == 1):
        b = int(a/2)+1
        print('{:.19g}'.format(b))
    else:
        b = a/2
        print('{:.19g}'.format(b))

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

Submission status: Accepted

Solution code:
from math import sqrt
a,b=map(int,input().split())
if(a==1 or b==1):
    print('1')
    exit()
if(a%2==0):
    a//=2
    print(a*b)
elif(b%2==0):
    b//=2
    print(a*b)
else:
    print((a*b)//2+(a*b)%2)

Submission status: Accepted

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

Submission status: Accepted

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

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

ans = 0

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

HW = H * W

if HW % 2 == 0:
    ans = int(HW / 2)
else:
    ans = int(HW / 2) + 1

print(ans)

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

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

Submission status: Accepted

Solution code:
s = input().split()
H = int(s[0])
W = int(s[1])
if H == 1 or W == 1:
  print(1)
else:
  ret = (H//2)  * W + (H%2) * ((W+1) // 2)
  print(ret)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def S(): return input()


def MI(): return map(int, input().split())


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


YNL = {False: 'No', True: 'Yes'}
YNU = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False
# show_flg = True


def main():
    H, W = MI()
    h = 0
    w = 0
    ans = 0

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

    ans += ((W + 1) // 2) * ((H + 1) // 2)
    ans += (W // 2) * (H // 2)

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
H, W = [int(x) for x in 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 sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    H,W=MI()
    if(1 in (H,W)):
        print(1)
        return
    print(ceil(H*W,2))
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

IN=lambda : map(int, input().split())
mod=1000000007

#+++++

def main():
	b , c = IN()
	if b==1 or c== 1:
		return 1
	e=((b+1)//2)
	o=b//2
	ret=0
	ret+=e*((c+1)//2)
	ret+=o*(c//2)
	print(ret)

	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Submission status: Accepted

Solution code:
H, W = map(int, input().split())
if H!=1 and W!=1:
	HW = H*W
	print(sum(divmod(HW, 2)))
else:
  print(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 min(h,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())

count = math.ceil(h/2)
# for i in range(0,h,2):
#     count += 1
#print(count)
if (h == 1 or w == 1) or (h == 1 and w == 1):
    print(1)
else:
    if h % 2 == 0:
        print(count * w)
    else:
        #a = math.ceil(w/2)
        a = math.floor(w/2)
        #print(a)
        print((w - a) * count + (count - 1) * a)

Submission status: Accepted

Solution code:
#
import math


def main():
    h, w = map(int, input().split(" "))
    if h == 1 or w == 1:
        print("1")
        return
    print(math.ceil((h * w) / 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 == 0:
    print((H//2)*W)
else:
    print((H//2)*W+(W+1)//2)

Submission status: Accepted

Solution code:
h , w = map(int, input().split())
if h == 1 or w == 1: exit(print(1))
a1 = h//2 + 1 if h % 2 != 0 else h//2
a2 = h - a1
a3 = w//2 + 1 if w%2!=0 else w//2
a4 = w - a3
#print(a1 , a2 , a3,a4)
ans = a1*a3 + a2*a4
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 14 21:11:42 2020

@author: Kanaru Sato
"""

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

H = int(i[0])
W = int(i[1])

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import sys

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

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

y1 = 1 + (H-1) // 2
y2 = H // 2

print((W//2)*(y1+y2) + (W%2)*y1)

Submission status: Accepted

Solution code:
import sys
h,w=map(int,input().split())
if w==1:
  print(1)
  sys.exit()
if h==1:
  print(1)
  sys.exit()
if w%2==0:
  l=w//2
  print(l*h)
else:
  l=(w+1)//2
  m=(h+1)//2
  n=h-m
  print(l*m+(l-1)*n)

Submission status: Accepted

Solution code:
import bisect,collections,itertools,math,numpy,string
def I(): return int(input())
def F(): return float(input())
def S(): return input()
def LI(): return list(map(int,input().split()))
##################################################
def main(H,W):
    if H==1 or W==1:
        return 1
    elif H%2==0 and W%2==0:
        return (H*W)//2
    elif H%2==0 and W%2==1:
        return (H//2)*(2*(W//2)+1)
    elif H%2==1 and W%2==0:
        return (2*(H//2)+1)*(W//2)
    else:
        return (H//2)*(2*(W//2)+1)+((W//2)+1)
    
H,W = LI()
print(main(H,W))

Submission status: Accepted

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

if h%2 == 0:
    print((h*w)//2)
else:
    print(((h-1)*w)//2+(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:
    w_odd = math.ceil(H/2)
    w_even = H // 2
    N_odd = math.ceil(W/2)
    N_even = W // 2
    print(w_odd * N_odd + w_even * N_even)

Submission status: Accepted

Solution code:
H,W=[int(x) for x in input().rstrip().split()]
if (H*W)%2==0 and (H!=1 and W!=1):
    print((H*W)//2)
elif H==1 or W==1:
    print(1)
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")
elif h%2==0:
    print((h*w)//2)
elif w%2==0:
    print((h*w)//2)
else:
    print((w*(h//2))+(w//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 ==1:
    print(int((h * w //2) + 1))
else:
    print(int(h * w //2))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    h,w = map(int,input().split())
    #奇数の段は1,3,5...の奇数列目に
    #偶数の段は2,4,6...の偶数列目に移動可能
    gusuu_dan = h//2
    kisuu_dan = h - gusuu_dan

    gusuu_retsu = w//2
    kisuu_retsu = w - gusuu_retsu
    answer = kisuu_dan * kisuu_retsu + gusuu_dan * gusuu_retsu

    #しまった！　１列だけのときは移動できない！

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






if __name__ == '__main__':
    main()

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

Submission status: Accepted

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

Submission status: Accepted

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

cell = nums[0] * nums[1]

if nums[0] == 1 or nums[1] == 1:
  print(1)
elif cell % 2 == 0:
  print(int(cell / 2))
else:
  print(int(math.ceil(cell / 2)))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

if H == 1 or W == 1: print 1
else:
    h, w = H + 1 >> 1, W + 1 >> 1
    hr, wr = H - h, W - w

    print h * w + hr * wr

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
from collections import deque, Counter
def getN():
    return int(input())
def getList():
    return list(map(int, input().split()))
import math
INF = 10 ** 20

def main():
    h,w = getList()
    if h == 1 or w == 1:
        print(1)
        return
    yoko1 = h // 2 + (h % 2)
    yoko2 = (h // 2)
    ans = (w // 2) * (yoko1 + yoko2)
    if w % 2 == 1:
        ans += yoko1

    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
import math
a = input().split()
#print(a)

H = int(a[0])
W = int(a[1])

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

c = H * W
if c % 2 == 1:
  c = math.floor(c / 2) + 1
else:
  c = math.floor(c / 2)

print(c)

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

Submission status: Accepted

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

if h == 1 or w == 1:
    c = 1
elif h & 1:
    if w & 1:
        c = ((h + 1) // 2) * ((w + 1) // 2) + (h // 2) * (w // 2)
    else:
        c = (((h + 1) // 2) + (h // 2)) * (w // 2)
else:
    c = (h // 2) * w

print(c)

Submission status: Accepted

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

Submission status: Accepted

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

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

x1 = ceil(W / 2)
x2 = W // 2

print(int(ceil(H / 2) * x1 + H // 2 * x2))

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

Submission status: Accepted

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

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 fractions import gcd
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 functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    H, W = MAP()
    print(ceil(H*W/2) if H != 1 and W != 1 else 1)


if __name__ == '__main__':
    main()