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

mode = 'odd'
if w%2 == 0:
    mode = 'even'
    
    
v = 0
if mode == 'odd':
    v1 = (w-1) // 2 + 1
    
    if h%2 == 0:
        v = (2*v1 -1) * (h//2)
    else:
        v = v1 + ((2*v1 -1) * (h//2))
else:
    v1 = w // 2
    v = v1 * h

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import string


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


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

#N = int(input())
#s = [input() for i in range(N)]
#M = int(input())
#t = [input() for i in range(M)]
# print(s)
# print(t)

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

sum = 0

sum += (math.ceil(w/2))*(math.ceil(h/2))  # 切り上げ
sum += (math.floor(w/2))*(math.floor(h/2))  # 切り捨て

print(sum)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

res = 0

#odd : (W+1) // 2
#even : W // 2

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math
import string


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


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

#N = int(input())
#s = [input() for i in range(N)]
#M = int(input())
#t = [input() for i in range(M)]
# print(s)
# print(t)

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
H, W = map(int, input().split())
# 今いる列の到達可能店
if H == 1 or W == 1:
    print(1)
    exit()
if H % 2 == 0:
    can = H // 2
    ans = can * W
    print(ans)
elif H % 2 == 1:
    can = H
    ans = math.ceil(can * (W / 2))
    print(ans)

Submission status: Accepted

Solution code:
from math import ceil

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

n = H * W
ans = (n + 1) / 2
print(math.floor(ans))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

# 二列ごと見ると全体の半数に移動可能
if h ==1 or w == 1:
    movable = 1
else:
    movable = math.ceil((h * w)/2)

print(movable)

Submission status: Accepted

Solution code:
import sys

H, W = (int(x) for x in input().split())
if H == 1 or W == 1:
    print(1)
    sys.exit()

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

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)
  quit(0)

  
if(h*w % 2 == 0):
  print(int(h*w/2))
else:
  print(int((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:
  nos = math.ceil(w/2)*math.ceil(h/2) + math.floor(w/2)*math.floor(h/2)
  print(nos)

Submission status: Accepted

Solution code:
def bishop(H, W):
    if H==1 or W== 1:
        return 1
    result  = int((H-1)/2 + 1) * int((W-1)/2 + 1) + int(H/2) * int(W/2)
    return result
ans = input().split(" ")
H = int(ans[0])
W = int(ans[1])
print(bishop(H,W))

Submission status: Accepted

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


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

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

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

Submission status: Accepted

Solution code:
from math import floor, ceil


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

    h1 = float(h/2)
    w1 = float(w/2)

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

    if (h % 2 and w % 2 is 0) or (h % 2 and w % 2 is not 0):
        tot = ceil(h1) * ceil(w1) + floor(h1) * floor(w1)
    else:
        if h % 2 is 0:
            tot = h1 * w
        elif w % 2 is 0:
            tot = w1 * h

    print(int(tot))


if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
H, W = map(int, input().split())
 
if H == 1 or W == 1:
    print(1)
else:
    if H % 2 == 0:
        e_h = H // 2
        o_h = H // 2
    else:
        e_h = H // 2 + 1
        o_h = H // 2
    if W % 2 == 0:
        print(e_h * (W // 2) + o_h * (W // 2))
    else:
        print(e_h * (W // 2 + 1) + o_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:
        e_h = H // 2
        o_h = H // 2
    else:
        e_h = H // 2 + 1
        o_h = H // 2
    if W % 2 == 0:
        print(e_h * (W // 2) + o_h * (W // 2))
    else:
        print(e_h * (W // 2 + 1) + o_h * (W // 2))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
r,c = input().split()
r = int(r)
c = int(c)
if(r==1 or c==1):
    print(1)
else:    
    ans = r*c/2
    if r%2==1 and c%2==1:
        print(math.floor(ans)+1)
    else:
        print(math.floor(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#B - Bishop
import math

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

if(H%2 == 0 and W%2 == 0):
    ans = int(W/2)*int(H/2)+int(W/2)*int(H/2)
elif(H%2 == 0 and W%2 == 1):
    ans = math.ceil(W/2)*int(H/2)+int(W/2)*int(H/2)
elif(H%2 == 1 and W%2 == 0):
    ans = int(W/2)*math.ceil(H/2)+int(W/2)*int(H/2)
elif(H%2 == 1 and W%2 == 1):
    ans = math.ceil(W/2)*math.ceil(H/2)+int(W/2)*int(H/2)

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

print(int(ans))

Submission status: Accepted

Solution code:
# coding: utf-8
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())
masu=h*w
if h==1 or w==1:
  print(1)
elif masu%2==0:
  print(masu//2)
else:
  print((masu//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 and w % 2 != 0:
    print((h * w) // 2 + 1)
else:
    print((h * w) // 2)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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

    odd = W // 2 + 1
    even = W // 2

    ans = odd * (H // 2 + 1) + even * (H // 2)
    print(ans)

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def solve(h, w):
    if min(h, w) == 1:
        return 1
    return (h*w+1) // 2

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

Submission status: Accepted

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


def main():
    from math import ceil
    import sys
    input = sys.stdin.readline

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

    # 境界値
    if h == 1 or w == 1:
        print(1)
        exit()

    ans = h // 2 * w

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

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

q, r = divmod(H, 2)

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

Submission status: Accepted

Solution code:
#n=int(input())
h,w=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
m=h//2
n=w//2

if h==1 or w==1:
    ans=1
elif h%2==0:
    ans=m*w
else:
    md=w%2
    ans=n*(m+1+m)+md*(m+1)
print(ans)

Submission status: Accepted

Solution code:
import sys

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

def main():
	H,W = MI()
	W1 = (W+1)//2
	W2 = W//2
	H1 = (H+1)//2
	H2 = H//2
	if(H==1 or W==1):
		print(1)
	else:
		print(H1*W1+H2*W2)

if __name__ == '__main__':
	main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

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

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

Submission status: Accepted

Solution code:
from collections import deque
import sys
sys.setrecursion = 10000000


def solve(): 
  h,w = (int(i) for i in input().split())
  if h==1 or w == 1:
    print(1)
  else:
    print((h*w+1)//2)


solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
h,w = (int(num) for num in input().split())
if h != 1 and w != 1:
    print((h * w + 1) // 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)
    exit()

ans = W * (H // 2)

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import *
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())
import math

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
h, w = map(float, 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:
    ans = 1
else:
    ans = w * (h // 2)
    if h % 2:
        ans += (w + 1) // 2
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
h, x = map(int, input().split())
ho = h // 2
he = ho + (h % 2)
xo = x // 2
xe = xo + (x % 2)

if h == 1 or x == 1:
    print(1)
else:
    print(ho * xo + he * xe)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
a,b = list(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())
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:
    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)
elif(H * W ) % 2 == 0:
    print((H * W) // 2)

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
# B
# 解説みた
w, h = map(int, input().split())

import math
if w == 1:
    print(1)
elif h == 1:
    print(1)
else:
    print(math.ceil(w*h/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 . ceil(a * b / 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(a * b // 2)
else :
    print(a * b // 2 + 1 )

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

def f(h, w):
    if h == 1 or w == 1:
        return 1
    if h % 2 == 0 and w % 2 == 0:
        return (h // 2) * w
    elif h % 2 == 1 and w % 2 == 0:
        return f(h - 1, w) + w // 2
    elif h % 2 == 0 and w % 2 == 1:
        return f(h, w - 1) + h // 2
    else:
        return f(h - 1, w) + w // 2 + 1

print(f(H, W))

Submission status: Accepted

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

n = h * w
if min(h, w) == 1:
    print(1)
elif n % 2 == 0:
    print(int(n / 2))
else:
    print(int(-(-n // 2)))

Submission status: Accepted

Solution code:
#!python3

# import numpy as np


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


def main():
    if H == 1 or W == 1:
        print(1)
        return
    a = b = H // 2
    if H % 2 == 1:
        a += 1
    ans = (a + b) * (W // 2)
    if W % 2 == 1:
        ans += a
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

w1 = math.ceil(w/2)
w2 = math.floor(w/2)

h1 = math.ceil(h/2)
h2 = math.floor(h/2)

if h==1 or w==1:
    print(1)
    exit(0)
print((h1*w1) + (h2*w2))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
x,y=list(map(int,input().split()))
if x==1 or y ==1:
    print(1)
else:
    print(-(-x*y//2))

Submission status: Accepted

Solution code:
import unittest


class TestB(unittest.TestCase):
    def test_1(self):
        self.assertEqual(think(4, 5), 10)

    def test_2(self):
        self.assertEqual(think(7, 3), 11)


def solve():
    h, w = read()
    result = think(h, w)
    write(result)


def read():
    return read_int(2)


def read_int(n):
    return read_type(int, n, sep=' ')


def read_float(n):
    return read_type(float, n, sep=' ')


def read_type(t, n, sep):
    return list(map(lambda x: t(x), read_line().split(sep)))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(h, w):
    if h == 1 or w == 1:
        return 1
    if w % 2 == 0:
        return w // 2 * h
    else:
        if h % 2 == 0:
            return w * (h // 2)
        else:
            return w * (h // 2) + (w // 2) + 1


def write(result):
    print(result)


if __name__ == '__main__':
    # unittest.main()
    solve()

Submission status: Accepted

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


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

    print((H//2)*less + ((H+1)//2) * more)

Submission status: Accepted

Solution code:
H,W=map(int,input().split())
print(1) if H==1 or W==1 else print((H*W+1)//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:
n=list(map(int,input().strip().split()))

h=n[0]
w=n[1]

htw=h*w+1

if(h!=1 and w!=1):
    print(int(htw/2))
else:
    print(1)

Submission status: Accepted

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

# mod=10**9+7
# rstrip().decode('utf-8')
# map(int,input().split())
# import numpy as np


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



if __name__ == "__main__":
	main()

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

if H>1 and W>1:
    print(((H + 1) // 2) * ((W + 1) // 2) +
        (H - (H + 1) // 2) * (W - (W + 1) // 2))
else:
    print(1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b = (int(x) for x in input().split())

            
if a == 1 or b == 1:
    print(1)
elif a > b:#b対象
    anb1 = int(b * b) 
    anb2 = (int((a-b) * b))
    if (anb1 % 2) == 0:#偶数
            print(int(anb1/2) + int(anb2/2))
    else:#奇数
            print(int(anb1/2 + 1) + int(anb2/2))
elif a < b:#a対象            
    anb1 = int(a * a)
    anb2 = int((b-a) * a)
    if (anb1 % 2) == 0:#偶数
            print(int(anb1/2) + int(anb2/2))
    else:#奇数
            print(int(anb1/2 + 1) + int(anb2/2))
elif a == b:
    if a % 2 == 0:
        print(int(a / 2) * a)
    else:
        print(int((a * a) / 2) + 1)

Submission status: Accepted

Solution code:
a = input().split()

b = [int(s) for s in a]
c = b[0]*b[1]/2

if(b[0] == 1 or b[1] == 1):
  print(1)
elif(int(b[0]*b[1])%2 != 0):
  print(int(c+1))
else:
  print(int(c))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

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

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

Submission status: Accepted

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


main()

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if W == 1:
    N = 1

elif H == 1:
    N = 1

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

print(int(N))

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

Submission status: Accepted

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

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

Submission status: Accepted

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

ans=0
if w%2!=0:
    ans=tmp*(1+w//2)+tmg*(w//2)
else:
    ans=tmp*(w//2)+tmg*(w//2)
if h==1 or w==1:
    print(1)
    exit()
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

        sum_ki = ki * (int(w / 2) + w % 2)
        sum_gu = gu * (int(w / 2))
        print(sum_ki + sum_gu)


def c():
    a, b, c = map(int, input().split())
    ab = 4 * a * b
    a_b_c = c - (a + b)
    a_b_c_2 = a_b_c ** 2
    if a_b_c <= 0:
        print("No")
    else:
        if ab < a_b_c_2:
            print("Yes")
        else:
            print("No")


if __name__ == "__main__":
    b()

Submission status: Accepted

Solution code:
import math

a, b = map(int, input().split())
if a == 1 or b ==1:
    print(1)
else:
    x = a*b
    print(math.ceil(x/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//2+1)*(W//2+1)+(H//2)*(W//2))
elif H % 2 == 1 and W % 2 == 0:
    print((H//2+1)*W//2+(H//2)*(W//2))
elif H % 2 == 0 and W % 2== 1:
    print((H//2)*(W//2+1)+(H//2)*(W//2))    	 
else:
    print(2*(H//2)*(W//2))

Submission status: Accepted

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

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


main()