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

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
num1 = (a//2)*(b//2)

if a == 1 or b==1:
    print(1)
else:
    
    # print(num1)
    p = b//2
    q = a//2
    num2 = (b - p )*(a - q)
    ans = num1+num2
    print(num1+num2)

Submission status: Accepted

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

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 glob


# 問題ごとのディレクトリのトップからの相対パス
REL_PATH = 'ABC\\159\\B'

# テスト用ファイル置き場のトップ
TOP_PATH = 'C:\\AtCoder'

class Common:

    problem = []
    index = 0

    def __init__(self, rel_path):
        self.rel_path = rel_path

    def initialize(self, path):
        file = open(path)
        self.problem = file.readlines()
        self.index = 0
        return

    def input_data(self):
        try:
            IS_TEST
            self.index += 1
            return self.problem[self.index-1]

        except NameError:
            return input()

    def resolve(self):
        pass

    def exec_resolve(self):
        try:
            IS_TEST
            for path in glob.glob(TOP_PATH + '\\' + self.rel_path + '/*.txt'):
                print("Test: " + path)
                self.initialize(path)
                self.resolve()
                print("\n\n")
        except NameError:
            self.resolve()


class Solver(Common):

    def resolve(self):

        tmp = [int(i) for i in self.input_data().split()]
        H = tmp[0]
        W = tmp[1]

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

            if H % 2 == 1 and W % 2 == 1:
                count += 1

            print(str(count))


solver = Solver(REL_PATH)
solver.exec_resolve()

Submission status: Accepted

Solution code:
arr = input().split()
h=int(arr[0])
w=int(arr[1])
 
if w*h%2!=0 and h!=1 and w!=1:
    ans=(w*h+1)//2
elif h==1 or w==1:
    ans=1
else:
    ans=w*h//2
print(ans)

Submission status: Accepted

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

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:
    ans = math.ceil(h*w/2)
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

if n==1 or m==1:
  ans = 1
elif m%2==1:
  d = (m+1)/2
  if n%2==0:
    ans = (d+d-1)*n/2
  else:
    ans = (d+d-1)*(n-1)/2 + d
else: # even
  ans = n * m/2
print(int(ans))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
	H, W = map(int, input().split())

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

	print(int(ans))

Submission status: Accepted

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

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

Submission status: Accepted

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

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

else:
    row1 = w//2 + w%2
    row2 = w//2

    total = (row1 * (h//2+h%2)) + (row2 * (h//2))

    print(total)

Submission status: Accepted

Solution code:
## coding: UTF-8
from decimal import *
s = input().split()
t = [int(p) for p in s]


#print(t)
if(t[0] == 1 or t[1] == 1):
    answer = 1
elif( Decimal(Decimal(t[0]) % 2 )== 1 and Decimal(Decimal(t[1]) % 2) == 1):
    n = Decimal( Decimal(Decimal(t[0]) - 1) // 2  )
    #print(n)
    m = Decimal( Decimal(Decimal(t[1]) - 1) // 2  )
    answer = Decimal(    Decimal(  Decimal(Decimal(m) + 1)     *    Decimal(Decimal(n) + 1)  )   + Decimal( Decimal(m) * Decimal(n) )       )
else:
    answer = Decimal(   Decimal(Decimal(t[0]) * Decimal(t[1])) // 2  )

print(int(answer))

'''
H = t[0]
W = t[1]
ans = 0
if( W % 2 == 0):
    for i in range(H):
        ans += W / 2
else:
    for i in range(H):
        if(i % 2 == 0):
            ans += W / 2.0 + 0.5
        else:
            ans += W / 2.0 - 0.5
print(int(ans))
'''

Submission status: Accepted

Solution code:
n, m = (int(x) for x in input().split())

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

Submission status: Accepted

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

if a==1 or b==1:
	print(1)
elif a*b%2 == 0:
	print(int(a*b/2))
elif a*b%2 == 1:
	print(int(math.floor(a*b/2+1)))

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

    count = H * W
    ans = count // 2

    if count % 2 != 0:
        ans += 1

    print(ans)

resolve()

Submission status: Accepted

Solution code:
a, b = map(int,input().split(' '))
ans = a*b//2

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

Submission status: Accepted

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

if h == 1:
    print(1)
elif w == 1:
    print(1)
else:

    if w%2 == 0:
        a = w//2
        b = w//2
    else:
        a = w//2 + 1
        b = w//2

    if h%2 == 0:
        c = h//2
        d = h//2
    else:
        c = h//2 + 1
        d = h//2

    print(a*c + b*d)

Submission status: Accepted

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

    dd= W*(H//2)

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


if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def Main(H, W):
    if H == 1 or W == 1:
        return 1
    else:    
        if W%2:
            if H%2:
                return W*(H//2)+(W//2+1)
            else:
                return W*(H//2)
        else:
            if H%2:
                return W*(H//2)+W//2
            else:
                return W*(H//2)
                

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
import math
from decimal import *
input = sys.stdin.readline
sys.setrecursionlimit(10**6)


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

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


main()

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

Submission status: Accepted

Solution code:
def resolve():
    h, w = map(int, input().split())
    dy = h // 2 if h != 1 else 1
    if h == 1 or w == 1:
        count = 1
    elif h % 2 == 1:
        count = w * dy + (w - (w // 2))
    else:
        count = w * dy

    print(count)


if __name__ == '__main__':
    resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

    print(int(-(-(H*W)//2)))
elif H==2:

    print(W)
elif W==2:
    print(H)
elif H%2==0 and W%2==0:

    print(int(W*H/2))
elif H%2==1 and W%2==1:
    mas=-(-W//2)
    nextmas=mas-1
    Sset=int(H/2)
    amari=H%2


    num=(mas+nextmas)*Sset

    num+=mas*amari

    print(int(num))


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)

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

Submission status: Accepted

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


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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
h,w = map(int,input().split())
h_a = h % 2
w_a = w % 2
h_b = h // 2 
w_b = w // 2 
if(h == 1 or w == 1):
  print(1)

elif((h_a == 0) & (w_a == 0)):
  print(h_b * w)
elif((h_a == 1) & (w_a == 0)):
  print(w_b * h)
elif((h_a == 0) & (w_a == 1)):
  print(h_b * w)
elif((h_a == 1) & (w_a == 1)):
  print((h_b + 1) * (w_b + 1) + h_b * w_b)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from decimal import Decimal
import sys
n = list(map(int, input().split()))

if n[0] == 1 or n[1] == 1:
    print(1)
    sys.exit()

if n[0] % 2 == 0:
    print(Decimal(int((n[0]/2)*n[1])))
    sys.exit()
else:
    if n[1] % 2 == 0:
        print(Decimal(int(n[0]*(n[1]/2))))
        sys.exit()
    else:
        a = ((n[0]-1)*n[1])/2
        b = n[1] - int(n[1]/2)
        print(Decimal(int(a+b)))
        sys.exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
h, w = [int(s) for s in input().split()]
if h == 1 or w == 1:
    print(1)
    exit()
rh, rw = h%2, w%2
eh, ew = h - rh, w- rw

result = int( eh * ew //2)
if rh == 1:
    result += ew //2
if rw == 1:
    result += eh //2
if rh == rw == 1:
    result += 1

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

else:
    if H%2 == 0:
        ans = H//2 * W

    else:
        ans = ((H//2)+1)*W - (W//2)

print(ans)

Submission status: Accepted

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

output = H * W

if output % 2 != 0:
    output += 1
output /= 2

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    w, h = map(int, input().split())
    f = w%2==0
    g = h%2==0
    a = w*h//2
    if w==1 or h==1:
        print(1)
        exit()
    if not f and not g:
        print(a+1)
    else:
        print(a)

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

Submission status: Accepted

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


def solve(H: int, W: int):
    if H == 1 or W == 1:
        print(1)
        return
        
    first = W//2 if W%2 == 0 else (W//2)+1
    second = W//2

    if H%2 == 0:
        print(first*(H//2)+second*(H//2))
    else:
        print(first*(H//2+1)+second*(H//2))
    return


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:
i = input().split()
h = int(i[0])
w = int(i[1])

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

Submission status: Accepted

Solution code:
import math

inp = input()
hw = inp.split(' ')
hi = int(hw[0])
wi = int(hw[1])

gusu_p = math.ceil(wi/2)
kisu_p = math.floor(wi/2)

gusu_num = math.ceil(hi/2)
kisu_num = math.floor(hi/2)

ret = (gusu_p*gusu_num) + (kisu_p * kisu_num)

if hi == 1:
    print('1')
elif	wi == 1:
    print('1')
else:
    print('{}'.format(ret))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from math import floor, ceil

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


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

Submission status: Accepted

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

a = H * W
b = 0


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
i = list(map(int, input().split()))
H = i[0]
W = i[1]

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

Submission status: Accepted

Solution code:
# Author: cr4zjh0bp
# Created: Sat Mar 14 13:11:12 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

from math import ceil

h, w = na()

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

# num = H * W


if H == 0 or W == 0:
    print(int(0))

elif H == 1 or W == 1:
    print(int(1))

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

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

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

elif H % 2 != 0 and W % 2 != 0:
    key = W // 2
    ans = H * key
    print(int(ans + (H-H//2)))
    # else:
    #     num = H // 2
    #     ans = num * W
    #     print(int(ans + (H-(num))))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
import math

h,w = [int(x) for x in stdin.readline().rstrip().split()]
if (h==1)|(w==1):
    ans = 1
else:
    ans = int(w/2)*h + (w%2)*math.ceil(h/2)
print(ans)

Submission status: Accepted

Solution code:
from collections import deque, defaultdict, Counter
from math import ceil, floor
import sys
def input():
    return sys.stdin.readline().strip()

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

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

if H > W:
    H, W = W, H

# print(H, W)
ans = W * (H // 2)
# print(ans)
if H % 2 == 1:
    # print(ans)
    # print(W // 2 + 1)
    ans += ceil(W / 2)  # W // 2 + 1
print(ans)

Submission status: Accepted

Solution code:
from decimal import Decimal, getcontext
a, b = map(int, input().split())
getcontext().prec = 50
c = Decimal(a) * Decimal(b)
if a == 1 or b == 1:
    print(1)
else:  
    if c % 2 == 1:
        print(int(c/2)+1)
    else:
        print(int(c/2))

Submission status: Accepted

Solution code:
# coding: utf-8
import math
H,W = list(map(float,input().split()))
if H==1 or W==1:
  print("1")
else:
  ans = H*W/2
  print(math.ceil(ans))

Submission status: Accepted

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

if h == 1 or w == 1:
  a = 1

elif h % 2 == 1 and w % 2 == 1:
	a = int((h * w + 1) / 2) 
else:
	a = int(h * w / 2)
    
print(a)

Submission status: Accepted

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

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

if w % 2 == 1:
    idle = int((w - 1) / 2)
    can = w - idle
    second = can - 1
    num = can + second
elif w % 2 == 1 and h == 1:
    idle = int((w - 1) / 2)
    can = w - idle
    print(can)
    exit()
elif w % 2 == 0 and h == 1:
    print(1)
    exit()
else:
    idle = int(w / 2)
    num = idle * 2

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

if h % 2 == 1:
    row = int(h // 2)
    print(num * row + can)
else:
    row = int(h / 2)
    print(num * row)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
HW=input().rstrip('\n').split()
H=int(HW[0])
W=int(HW[1])
if H==1 or W==1 :
    print (1)
elif H%2==1 and W%2==1 :
    print (int((H*W+1)/2))
else :
    print(int(H * W / 2))

Submission status: Accepted

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

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

print(k)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


if n == 1 or w == 1: 
    ans = 1
elif n % 2 == 0 or w % 2 == 0:
    ans = int((n * w) / 2.)

else:
    ans = int((n * w) / 2.) + 1

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

Submission status: Accepted

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

s = (h * w) // 2

if (h==1) or (w==1):
    t = 1
elif (h*w) % 2 == 0:
        t = s
elif (h*w) % 2 == 1:
        t = s+1

print (t)

Submission status: Accepted

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

Submission status: Accepted

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

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

main()

Submission status: Accepted

Solution code:
A,B=(int(x) for x in input().split())
a = int(A) % 2
b = int(B) % 2
if int(A) == 1 or int(B) == 1:
    print("1")

elif int(a) != 0 and int(b) != 0:
    mod = (int(A)*int(B)) % 2
    n = ((int(A) * int(B)) // 2) + int(mod)

    print(n)
else :
    n = (int(A) * int(B)) //2
    print(n)

Submission status: Accepted

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

ans = h*w;
if ans & 1:
    ans = (ans>>1)+1
else:
    ans = (ans>>1)
if h == 1 or w == 1:
    print(1)
else:
    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(0)
ans = H*W
if ans & 1:
    print(ceil(ans/2))
else:
    print(ans//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):
        i = H//2
    if(H%2 != 0):
        i = H//2 + 1
    
    j = H-i

    if(W%2 == 0):
        sum = i*(W//2) + j*(W//2)

    if(W%2 != 0):
        sum = i*(W//2 + 1) + j*(W//2)
    

    print(sum)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# b.py
import math
h, w = map(float, 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 and w > 1:
    print((h * w + 1) // 2)
else:
    print(1)

Submission status: Accepted

Solution code:
hw = input('')
h = int(hw.split(' ')[0])
w = int(hw.split(' ')[1])
if h == 1:
  # h=1の場合、移動できない
  result = 1
elif w == 1:
  # w=1の場合、移動できない
  result = 1
else:
  if h%2 == 0:
    if w%2 == 0:
      # 縦偶数ｘ横偶数
      result = w // 2  * h 
    else:
      # 縦偶数ｘ横奇数
      result = (w//2 + 1) * h//2 + (w//2 * h//2)
  else:
    if w%2 == 0:
      # 縦奇数ｘ横偶数
      result = (w//2) * h
    else:
      # 縦奇数ｘ横奇数
      result = (w//2 + 1) * (h//2+1) + ( (w//2) * (h//2))
print(result)

Submission status: Accepted

Solution code:
def ceildiv(a, b):
    return -(-a // b)

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

if (h==1 or w==1):
    print(1)
else:
    r0 = ceildiv(w,2)
    r1 = w//2
    r0s = ceildiv(h,2)
    r1s = h//2
    print(r0*r0s + r1*r1s)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
h, w = map(int,input().split())
if h == 1 or w == 1:
    print(1)
else: 
    m, a = divmod(h, 4)
    n, b = divmod(w, 4)
    print(8*m*n + 2*a*n + 2*m*b + int((a*b+1)/2))

Submission status: Accepted

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

Submission status: Accepted

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