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

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

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

if h % 2 == 0 and w % 2 == 1:
    tmp = (h * (w - 1) // 2)
    print(tmp + (h // 2))
    exit()

if h % 2 == 1 and w % 2 == 0:
    tmp = ((h - 1) * w // 2)
    print(tmp + (w // 2))
    exit()

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 14 21:02:27 2020

@author: morihiranaoki
"""

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

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

if H == 1 or W == 1:
    movable = 1

print(int(movable))

Submission status: Accepted

Solution code:
import math

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


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

Submission status: Accepted

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

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

ans = 0
if H == 1 or W == 1:
    ans = 1
else:
    q, mod = divmod(H, 2)
    if mod == 0:
        ans = W * q
    else:
        ans = W * q + math.ceil(W / 2)

print(ans)

Submission status: Accepted

Solution code:
import sys
import numpy as np


def main():
    h, w = map(int, input().split())
    if w == 1 or h == 1:
        print(1)
        sys.exit(0)

    if w % 2 == 0:
        a = w // 2
        b = a

    else:
        a = int(np.ceil(w / 2))
        b = a - 1

    if h % 2 == 0:
        ans = (h//2)*(a+b)
    else:
        ans = (h//2)*(a+b)+a

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

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

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



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

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

Submission status: Accepted

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

boad = H*W
ans = boad//2
if boad % 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)
    exit()
a = h*w
if a % 2 == 1:
    print(int((a+1)/2))
else:
    print(int(a/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:
        print((h-1)*w//2 - (-w//2))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
import bisect

def main():
    n, m = map(int, input().split())
    if n == 1 or m == 1:
        print(1)
    else:
        ans = ((m + 1) // 2) * ((n + 1) // 2)
        ans += (m // 2) * (n // 2)
        print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import ceil
from decimal import Decimal
h,w = map(int,input().split())
if (h == 1) or (w == 1):
  print(1)
elif (h*w)%2 == 0:
  print(Decimal((h*w)/2))
else:
  print(Decimal(ceil((h*w)/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:
import math
 
h, w = [int(x) for x in input().split()]
if h == 1 or w == 1:
	print(1)
else:
	print(math.ceil(h * w / 2.0))

Submission status: Accepted

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

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

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

main()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

h,w = list(map(int, input().split()))
h1 = h//2
h2 = h//2 + h%2
w1 = w//2
w2 = w//2 + w%2

ans = (h1*w1 + h2*w2)

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
j=n*k
if n!=1 and k!=1:
    if j%2==0:
        print(int(j/2))
    else:
        print(int((j+1)/2))   
else:
    print(1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

h, w = map(int, sys.stdin.readline().split())

def main():
    if w == 1 or h == 1:
        return 1
        
    res = h // 2 * w
    if h & 1:
        res += (w + 2 - 1) // 2
    return res

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

h,w = nm()
if h == 1 or w == 1:
    print(1); exit()
ans = w * (h // 2)
if h%2: ans += (w+1)//2
print(ans)

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
a = list(map(int,input().split( )))
H = a[0]
W = a[1]
b = H//2
c = H//2
if H%2 == 1:
  b = b+1

d = W//2
answer = (b+c)*d
if W%2 == 1:
  answer = answer + b

if H==1 or W==1:
  answer = 1

print(answer)

Submission status: Accepted

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

if __name__ == '__main__':
    resolve()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
a,b=map(int, input().split())

if a == 1 or b == 1:
    print(1)
elif a % 2 == 0:
    print(a*b//2)
elif a % 2 == 1:
    if b % 2 == 0:
        print(a*b//2)
    elif b % 2 == 1:
        print((a+1)*b//2 -(b//2))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:

import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    h,w=list(map(int, readline().strip().split()))

    if w==1:
        print(1)
        return

    if h==1:
        print(1)
        return

    ki=(w+1)//2
    gu=w//2

    amari=h%2
    half=h//2
    masu=(amari+half)*ki+half*gu
    #arr=list(map(int, readline().strip().split()))
    #n=int(readline().strip())
    print(masu)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

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

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)
    exit()

allmas = h*w

if allmas % 2 == 1:
    print(int((allmas/2) + 0.5))
else:
    print(int(allmas/2))

Submission status: Accepted

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


    print(c-(c//2))

Submission status: Accepted

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

h,w = LI()
H, W = math.ceil(h/2), math.ceil(w/2)
if h == 1 or w == 1:
    print(1)
    quit()
ans = H * W + (h//2) * (w//2)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

N=H*W

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

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

Submission status: Accepted

Solution code:
import math
h,w=map(int,input().split()) 
print(math.ceil(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)
    exit()

dep = h // 2
wid = w // 2

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

Submission status: Accepted

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

Submission status: Accepted

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

q, mod = divmod(H * W, 2)

if H == 1 or W == 1:
    ans = 1
elif mod == 0:
    ans = q
else:
    ans = q + mod

print(ans)

Submission status: Accepted

Solution code:
import sys
H, W = map(int, sys.stdin.readline().rstrip().split())

if W == 1 or H == 1:
    print(1)
else:
    h_syou, h_amari = divmod(H, 2)
    w_syou, w_amari = divmod(W, 2)
    if w_amari == 0:
        print(w_syou * H)
    else:
        print((w_syou * H) + h_syou + h_amari)

Submission status: Accepted

Solution code:
# coding: utf-8

# 標準入力 <int><int>
H, W = map(int, input().split())

ans = H * W // 2

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

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

print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
import math

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

m = (h * w)

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# B
import math
H,W = map(int,input().split())
ans = 0
if (H == 1 or W == 1):
    ans = 1
else:
    if (H % 2 == 0):
        ans = W * (H // 2)
    else:
        ans = W * (H // 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:
    a = H // 2 + H % 2
    if H % 2 == 0:
        b = a * W
        print(b)
    else:
        b = a * (W // 2 + W % 2) + (a - 1) * (W // 2)
        print(b)

Submission status: Accepted

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

if (h == 1) or (w == 1):
  print(1)
  
#共に偶数or偶奇
elif (h % 2 == 0) or (w % 2 == 0):
  print(int((h*w)/2))
#共に奇数
else:
  print(int(h*w/2 + 1))

Submission status: Accepted

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

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

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

Submission status: 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 * 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())

H_g = H//2
H_k = H - H_g

W_g = W//2
W_k = W - W_g
if H ==1 or W == 1:
    print(1)
else:
    print(H_g*W_g+H_k*W_k)

Submission status: Accepted

Solution code:
def solve():
    N, K = [int(_) for _ in raw_input().split()]
    if N == 1 or K == 1:
        ret = 1
    elif N % 2 == 0 or K % 2 == 0:
        ret = N * K /2
    else:
        ret = N * K /2 + 1
    print ret

if __name__ == '__main__':
    solve()

Submission status: Accepted

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

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

if L == 1 or S == 1:
    ans = 1

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

hw = input().split(' ')
h = int(hw[0])
w = int(hw[1])

if h == 1 or w == 1:
    print(1)
    exit(0)
print(math.ceil(h * w / 2.0))

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

Submission status: Accepted

Solution code:
import sys
import math
#sys.stdin=open("input.in","r")
#sys.stdout=open("output.out","w")
n,m=map(int,input().split())
if(n==1 or m==1):
    print(1)
else:
    print(math.ceil((n*m)/2))

Submission status: Accepted

Solution code:
from math import ceil
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

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

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

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



if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
import math

def solve(H: int, W: int):
    count = 0
    if H == 1 or W == 1:
        print(1)
        return
    if H % 2 == 0:
        count += (H / 2) * math.ceil(W/2) 
        count += (H / 2) * math.floor(W/2) 
    else:
        count += (1 + (H // 2)) * math.ceil(W/2)
        count += (H // 2) * math.floor(W/2) 

    count = int(count)
    assert type(count) == int
    print(count)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    solve(H, W)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

if 1 in [H, W]:
    print(1)

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

Submission status: Accepted

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

Submission status: Accepted

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

hq, hmod = divmod(h, 2)
wq, wmod = divmod(w, 2)

if(h == 1 or w == 1):
  ans = 1
else:
  ans = hq * w + hmod * (wq + wmod)
  
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
h,w = map(int,input().split())
if w == 1:
    print(int(1))
elif h == 1:
    print(int(1))
else:
    if h %2 == 0:
        print(int(h*w /2))
    else:
        tmp = (h+1)/2#多いほうの行けるマス数
        tmp1 = (h-1)/2#少ないほうの行けるマス数
        if w %2 == 0:
            print(int(h*w/2))
        else:
            print(int(h*(w-1)/2 +tmp))

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:
a,b = [int(x) for x in input().split()]
ans = int(a*b/2)+1
if a == 1 or b == 1:
  ans = 1
elif (a*b) % 2 == 0:
  ans = int(a*b/2)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#pana b
h,w=map(int,input().split())
if h==1 or w==1:
    print(1)
else:
    if 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:
    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())
if H==1 or W==1:
    print(1)
else:
    S=(H*W)/2
    print(math.ceil(S))

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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

if (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:
    print(1)
    exit()

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

Submission status: Accepted

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

Submission status: Accepted

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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from sys import stdin
H,W = [int(x) for x in stdin.readline().rstrip().split()]
ans = ((H+1)//2)*((W+1)//2) + (H//2)*(W//2)

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