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:
def input_int():
    return map(int, input().split())

def one_int():
    return int(input())

def one_str():
    return input()

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

H,W = input_int()

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

Submission status: Accepted

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

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

    hguu = H if H % 2 == 0 else H - 1
    wguu = W if W % 2 == 0 else W - 1
    res = hguu * wguu // 2

    if H % 2 == 1:
        res += wguu // 2
    if W % 2 == 1:
        res += hguu // 2
    if H % 2 == 1 and W % 2 == 1:
        res += 1

    print(res)

    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:
#!/usr/bin/env python3
import sys
import decimal

def solve(H: int, W: int):
    decimal.getcontext().prec = 30
    if(H==1 or W==1):
        print(1)
        return
    if(H*W%2==0):
        print(decimal.Decimal(H*W/2))
    else:
        print(decimal.Decimal(H*W//2+1))
    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:


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

    if h == 1 or w == 1:
        print(1)
        return
    
    even_c = sum(divmod(w, 2))
    odd_c = w // 2
    even_row = sum(divmod(h, 2)) * even_c
    odd_row = (h // 2) * odd_c

    print(even_row + odd_row)


if __name__ == "__main__":
    submit()

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

import sys
from collections import Counter

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

H, W = MAP()

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

ans = ceil(H*W, 2)
print(ans)

Submission status: Accepted

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

big=math.ceil(W/2)
sml=math.floor(W/2)

ans=big*math.ceil(H/2)+sml*math.floor(H/2)

if H !=1 and W!=1:
    print(int(ans))
else:
    print(1)

Submission status: Accepted

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

c = (a + 1) // 2
d = a // 2

e = (c + d) * (b // 2)

if a == 1 or b == 1:
    print(1)
else:
    print(e if b % 2 == 0 else e + c)

Submission status: Accepted

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

x = h//2 if h%2==0 else h//2+1
y = w//2 if w%2==0 else w//2+1

print(1 if h==1 or w==1 else x*y+(h-x)*(w-y))

Submission status: Accepted

Solution code:
import sys; sys.setrecursionlimit(2147483647); input = sys.stdin.readline
from math import ceil
def I(): return int(input())
def MI(): return map(int, input().split())

def main():
    H, W = MI()
    if H==1 or W==1:
        print(1)
    else:
        print(ceil(H*W/2))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

if N == 1 or W == 1:
  ans = 1
else:
  ans = math.ceil((N * W) / 2)
  
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))
elif (H * W) % 2 == 1:
    print(int((H*W)//2+1))

Submission status: Accepted

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

Submission status: Accepted

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

import math

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#a, b, m = list(map(int, input().split()))
#a = list(map(int, input().split()))
#b = list(map(int, input().split()))
import math
H, W = list(map(int, input().split()))
 
ans = math.ceil(W/2) * (math.ceil(H/2))
ans += (W // 2) * (H//2)

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

Submission status: Accepted

Solution code:
import math

def main():
    H,K = map(int, input().split())
    if H==1 or K ==1:
        print(1)
        return
    elif H%2==0 or K%2==0:
        print(int(H*K/2))
        return
    else:
        print(int(math.ceil(H*K/2)))
        return
        

main()

Submission status: Accepted

Solution code:
import math
s = input().split(' ')
h = int(s[0])
w = int(s[1])
w1 = math.ceil(w/2)
w2 = math.trunc(w/2)
h1 = math.ceil(h/2)
#print(h, w)
if h == 1:
    print(1)
elif w == 1:
    print(1)
else:
    print(h1*w1 + (h-h1)*w2)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import math

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

odd = math.ceil(H/2)
even = math.floor(H/2)

X = odd * math.ceil(W/2) + even * math.floor(W/2)

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

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

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

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


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# Panasonic2020 B

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

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

a = (w+1)//2

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

Submission status: Accepted

Solution code:
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    H, W = iim()
    ha, hb = divmod(H, 2)

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

    ans = ha * W
    if hb:
        ans += W // 2
        if W & 1:
            ans += 1
    print(ans)

if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


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

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

    res = H * W

    if (H % 2 == 1) and (W % 2 == 1):
        res += 1

    res //= 2

    print(res)



main()

Submission status: Accepted

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

Submission status: Accepted

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

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


if __name__ == '__main__':
    main()

# import sys
#
# sys.setrecursionlimit(10 ** 7)
#
# input = sys.stdin.readline
# rstrip()
# int(input())
# map(int, input().split())

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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:
H, W = map(int, input().split())

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

ans = W * (H // 2) + (-1)*(-W // 2)*(H % 2)
print(ans)

Submission status: Accepted

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

if H == 1 or W == 1:
    print(1)
else:
    print(H * (W // 2) + (W % 2) * (H // 2 + H % 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:
# -*- coding: utf-8 -*-
import math

input_num = input().split(" ")
H = int(input_num[0])
W = int(input_num[1])

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

Submission status: Accepted

Solution code:
H,W = map(int,input().split())
if H == 1 or W ==1:
    print(1)
else:
    print(((H*W)//2)+((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:
H,W=list(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:
import math
def main():
    H, W = map(int, input().split())
    if H == 1 or W == 1:
        print(1)
    else:
        a = math.ceil(W/2) * math.ceil(H/2)
        b = math.floor(W/2) * math.floor(H/2)
        print(a+b)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from collections import *
from itertools import *
from bisect import *
from heapq import *
import copy
import math
from fractions import gcd
import sys
#input = sys.stdin.readline


#N=int(input())

#A=list(map(int,input().split()))
#XY=[list(map(int,input().split())) for i in range(N)]

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

Submission status: Accepted

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

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


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

Submission status: Accepted

Solution code:
import math

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

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

a1 = math.floor(h / 2)
a2 = math.ceil(h / 2)
b1 = math.floor(w / 2)
b2 = math.ceil(w / 2)


print((a1 * b1) + (a2 * b2))

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

Submission status: Accepted

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

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

Submission status: Accepted

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

if H == 1 or W == 1:
  print(1)
  exit()
  
n1 = math.ceil(W/2)
n2 = math.floor(W/2)
m1 = math.ceil(H/2)
m2 = math.floor(H/2)

ret = m1 * n1 + m2 * n2
print(ret)

Submission status: Accepted

Solution code:
(a, b) = list(map(int, input().split()))
i= a//2
p = i* b
j = 0
if a % 2 == 1:
  j = (b+1) // 2 

p += j
if a == 1 or b == 1:
  p = 1
print(p)

Submission status: Accepted

Solution code:
from sys import stdin

def main():

    input = stdin.readline

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

    ans = H * W

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

if __name__ == "__main__":
    main()

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:
import sys
h,w=map(int,input().split())
if h==1 or w==1:
    print(1)
    sys.exit()

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

Submission status: Accepted

Solution code:
H,W=map(int, raw_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:
# -*- coding: utf-8 -*-

import sys
import math


debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        # for line in sys.stdin:
        #     lines.append(line)
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    (h, w) = [int(e) for e in lines[0].split(" ")]

    return (h, w)


def solve(h, w):

    if h == 1 or w == 1:
        return 1

    cell = h * w
    tmp = cell // 2
    result = None
    if cell % 2 == 0:
        result = tmp
    else:
        result = tmp + 1
        

    return result
    


def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()

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

Submission status: Accepted

Solution code:
def main():
    h, w = [int(x) for x in input().split()]
    n1 = w//2 + (w&1)
    n2 = w//2

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

Submission status: Accepted

Solution code:
import math

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

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

print(result)

Submission status: Accepted

Solution code:
import numpy as np
import math as m

def main(**kwargs):
    if h == 1 or w == 1:
        res = 1
    elif h % 2 == 1 and w % 2 == 1:
        res = (h * w + 1) // 2
    else:
        res = h * w // 2

    return res

if __name__ == "__main__":
    cin = np.array(input().split(" ")).astype("int")
    h, w, *_ = cin

    cout = main(h=h, w=w)
    print(cout)

Submission status: Accepted

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

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

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

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

    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 = input().split(' ')
H = int(H)
W = int(W)
if H != 1 and W != 1:
    print(int(H*W/2 + 0.5))
else:
    print('1')

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
H, W = map(int, input().split())
w = W//2
h = H//2
lh = H - h
lw = W- w

if H < 2 or W < 2:
    print(1)
else:
    print(lh * lw + w * h)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
h,w = list(map(int,input().split()))

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

r_odd = w//2 + w%2
r_even = w//2

r_odd_cnt = h//2 + h%2
r_even_cnt = h//2

print(r_odd * r_odd_cnt + r_even * r_even_cnt)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
INF = 10 ** 9
MOD = 10 ** 9 + 7

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

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

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

Submission status: Accepted

Solution code:
import math

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    #import sys
    #input = sys.stdin.readline
    H,W = map(int,input().split())
    if W == 1:
        print(1)
        exit()
    elif W%2==0:
        W2 = W/2
        W3 = W/2
    elif W%2==1:
        W2 = W//2+1
        W3 = W//2
    if H == 1:
        print(1)
        exit()
    elif H%2==0:
        H2 = H/2
        H3 = H/2
    elif H%2==1:
        H2 = H//2+1
        H3 = H//2
    mas = W2*H2 + W3*H3

    print(int(mas))

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

ans = 0

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(4100000)

import math

import logging

logging.basicConfig(level=logging.DEBUG)

logger = logging.getLogger(__name__)


def resolve():
    # S = [x for x in sys.stdin.readline().split()][0]  # 文字列 一つ
    # N = [int(x) for x in sys.stdin.readline().split()][0]  # int 一つ
    H, W = [int(x) for x in sys.stdin.readline().split()]  # 複数int
    # h_list = [int(x) for x in sys.stdin.readline().split()]  # 複数int

    # grid = [list(sys.stdin.readline().split()[0]) for _ in range(N)]  # 文字列grid
    # v_list = [int(sys.stdin.readline().split()[0]) for _ in range(N)]
    # grid = [[int(x) for x in sys.stdin.readline().split()]
    #         for _ in range(N)]  # int grid

    logger.debug('{}'.format([]))
    if H == 1 or W == 1:
        print(1)
        return

    a = (H // 2) * (W // 2)
    b = math.ceil(H / 2) * math.ceil(W / 2)
    print(a + b)


if __name__ == "__main__":
    resolve()

# AtCoder Unit Test で自動生成できる, 最後のunittest.main は消す
# python -m unittest template/template.py で実行できる
# pypy3 -m unittest template/template.py で実行できる

import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """4 5"""
        output = """10"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """7 3"""
        output = """11"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """1000000000 1000000000"""
        output = """500000000000000000"""
        self.assertIO(input, output)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# import math
# a, b, c = map(int, input().split())
# # k = list(map(int, input().split(",")))

# if math.sqrt(a) + math.sqrt(b) < math.sqrt(c):
#     print("Yes")
# else:
#     print("No")

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

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

hw  = h*w

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
def ceil(x,y):
  return (x-1)//y+1
h,w = map(int,input().split())
if h == 1 or w == 1:
  print(1);exit()
yoko = ceil(w,2)
yokoteki = w-ceil(w,2)
ans += yoko * ceil(h,2)
ans += yokoteki * (h-ceil(h,2))
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))