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:
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
h, w = map(int, input().split())
def guki(n):
    if n%2 == 0:
        return "gu"
    else:
        return "ki"

def check(h, w):
    if h == 1 or w == 1:
        return 1
    else:
        if guki(w) == "gu":
            k = w//2
            g = w//2
            if guki(h) == "gu":
                return (k+g)*(h//2)
            else:
                return (k+g)*(h//2)+k
        else:
            k = w//2 + 1
            g = k-1
            if guki(h) == "gu":
                return (k+g)*(h//2)
            else:
                return (k+g)*(h//2)+k

print(check(h, w))

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

Submission status: Accepted

Solution code:
# 奇数と奇数の時だけ 積 // 2 に + 1 する

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)
    # print("a")

else:
    print(a * b // 2)
    # print("b")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A = [int(a) for a in input().split()]
masu=int((A[0]*A[1]/2)+0.5)
if A[0]==1 or A[1]==1:
    print(1)
else:
    print(masu)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
x,y=map(int,input().split())
if x==1 or y==1:
    print(1)
else:    
    a=math.ceil(x/2)
    b=math.floor(x/2)
    if(y%2==0):
        print((a+b)*y//2)
    else:
        print(a*(y//2+1)+b*(y//2))

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

if __name__=='__main__':
  main()

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

Submission status: Accepted

Solution code:
# coding: utf-8
H,W=map(int,input().split())

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

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

Submission status: Accepted

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

Submission status: Accepted

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

if h == 1 or w == 1:
    print(1)
    sys.exit()
count_1 = (h+1) // 2
count_2 = h // 2

loop_num = w // 2
add_num = w - (loop_num * 2)
print((count_1+count_2) * loop_num + (count_1 * add_num))

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

  print(count)

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

Submission status: Accepted

Solution code:
import sys
def LI():
	return [ int(s) for s in input().split() ]
 
H,W = LI()
 
if H == 1 or W == 1:
  print(1)
  sys.exit()
 
if H % 2 == 1 and W % 2 == 1:
  print(H*W//2+1)
else:
  print(H*W//2)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
s=input().rstrip().split()
h=int(s[0])
w=int(s[1])
res =0
if h == 1 or w == 1:
  res = 1
elif h%2==0:
    res = (h/2) * w
else:
    if w%2==0:
        res = int(h/2) * w +  w/2  
    else:
        res = int(h/2) * w + int(w/2) + 1
print(int(res))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
def i():return int(sys.stdin.readline().replace("\n",""))
def i2():return map(int,sys.stdin.readline().replace("\n","").split())
def s():return str(sys.stdin.readline().replace("\n",""))
def l():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def lx():return list(map(lambda x:int(x)*-1,sys.stdin.readline().replace("\n","").split()))
def t():return tuple(map(int,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":pass
h,w = i2()
if h == 1 or w == 1:
    print(1)
    exit()
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())

h_num, h_m = divmod(h, 2)
w_num, w_m = divmod(w, 2)

ans = 2 * h_num * w_num
if h_m == 1 and w_m == 1:
    ans += h_num + w_num + 1
elif h_m == 1:
    ans += w_num
elif w_m == 1:
    ans += h_num

if min(h, w) == 1:
    print(1)
else:
    print(ans)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
if 1 in [a,b]:
    print(1)
else:    
    print(((a+1)//2)*((b+1)//2)+(a//2)*(b//2))

Submission status: Accepted

Solution code:
HW = input().split()
HW = [int(n) for n in HW]

if HW[0] == 1 or HW[1] == 1:
    print(1)
else:
    m = HW[0]*HW[1]
    if HW[0]%2==1 and HW[1]%2==1:
        print(int(m/2)+1)
    else:
        print(int(m/2))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
 
H, W = [int(_) for _ in input().split()]
if H == 1 or W == 1:
    print(1)
elif H %2 == 0:
    print(int(H*W/2))
else:
    print(int((H-1)*W/2) + int(math.ceil(W/2)))

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    h,w = LI()
    if h < 2 or w < 2:
        return 1

    return (h*w+1) // 2


print(main())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

H, W = lr()
if H == 1 or W == 1:
    answer = 1
elif H % 2 == 0:
    answer = H//2 * W
elif W % 2 == 0:
    answer = W//2 * H
else:
    #どちらも奇数
    #下一段を別に数える
    answer = H//2 * W
    answer += (W+1) // 2
print(answer)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A=input().split()
H=int(A[0])
W=int(A[1])
if (W==1) or (H==1):
    R=1
elif (W%2==1) and (H%2==1):
    R=(W+1)*H/2-(H-1)/2
else:
    R=H*W/2
print(int(R))

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

import sys
sys.setrecursionlimit(300000)


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

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

Submission status: Accepted

Solution code:
from math import floor, ceil

H, W = map(int, input().split())
if H == 1 or W == 1:
    print(1)
else:
    even_col = ceil(H / 2)
    even_row = ceil(W / 2)
    odd_col = floor(H / 2)
    odd_row = floor(W / 2)
    print(even_col * even_row + odd_col * odd_row)

Submission status: Accepted

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

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

ans = H*W//2
carry = H*W % 2
ans += carry

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
h, w = map(int, raw_input().strip().split())
if min(h, w) == 1:
  print 1
else:
  print str((h * w + 1) / 2)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def A():
    seq = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
    K = int(input())
    print(seq[K-1])

import math
def B():
    H, W = map(int, input().split())
    if H==1 or W==1:
        print(1)
        return
    print(int(math.ceil(H*W/2.0)))
B()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    H, W = [int(x) for x in input().split()]
    ans = 0

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

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

    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:
    print ((-(-w//2))*(-(-h//2))+((w//2)*(h//2)))

Submission status: Accepted

Solution code:
h,w=map(int,input().split())
print([1,h*w+1>>1][h>1<w])

Submission status: Accepted

Solution code:
HW = [int(i) for i in input().split(' ')]
H = HW[0]
W = HW[1]

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

Submission status: Accepted

Solution code:
def main():
    h, w = [int(e) for e in 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)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import math
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+1)/2) + int(H*(W-1)/2))
else:
  print(int(H*W/2))

Submission status: Accepted

Solution code:
h,w=map(int,input().split());print([1,0--h*w//2][~-h*~-w>0])

Submission status: Accepted

Solution code:
H,W=map(int,input().split())
print([(H*W-1)//2+1,1][1 in[H,W]])

Submission status: Accepted

Solution code:
H, W = input().split()
H = int(H)
W = int(W)
if H == 1 or W == 1:
    result = 1
elif H % 2 == 0:
    pre_result = (W + 1) / 2
    even_row = H / 2
    odd_row = H - even_row
    result2 = (pre_result - 1) * even_row
    result1 = pre_result * odd_row
    result = result1+result2
else:
    pre_result = (W + 1) / 2
    even_row = (H-1)/2
    odd_row = H - even_row
    result2 = (pre_result - 1) * even_row
    result1 = pre_result * odd_row
    result = result1+result2
print(int(result))

Submission status: Accepted

Solution code:
A=list(map(int,input().split()))
print(1 if 1 in A else A[0]*A[1]//2+A[0]*A[1]%2)

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
c = [int(i) for i in input().split()]
a = c[0]
b = c[1]

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
h, w = input().split()
h, w = int(h), int(w)
if h is 1 or w is 1:
    print(1)
else:
    print(math.floor((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=-int(-(h*w)//2)
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
INF = float("inf")


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

# 答えの出力

def is_odd(num):
    return num % 2 ==1

if H == 1 or W == 1:
    ans = 1
elif is_odd(H) and is_odd(W):
    ans = ((H * W) + 1)/2
else:
    ans = (H*W) / 2

# 出力

print(int(ans))

Submission status: Accepted

Solution code:
# coding: utf-8

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

if H ==1 or W == 1:
    print(1)
else:
    h_even= H//2
    h_odd= H-h_even
    w_even= W//2
    w_odd= W-w_even


    # if H%2 == 1:
    #     r1=r+1
    #     print(r*W//2+r1*(W-W//2))
    # else:
    #     print(r*W//2+r*(W-W//2))

    # if H%2==1 or W%2==1:
    #     print(h_odd*w_odd+h_even*w_even-1)
    # else:
    #     print(h_odd*w_odd+h_even*w_even)
    print(h_odd*w_odd+h_even*w_even)

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

Submission status: Accepted

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

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:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

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

# 縦か横がどちらかの値が1の場合、角はどこにも行けないので常に１
if h == 1 or w == 1:
    print(1)
    exit()

# 総マス数が偶数になる場合、半数が答え
total = h * w
if total % 2 == 0:
    print(int(total / 2))
    exit()

# 問題は奇数の場合
# 高さが奇数の場合、奇数列はh//2+1 偶数列はh//2
odd_column = (h//2 + 1) * (w//2 + 1)
even_column = (h//2) * (w//2)
res = odd_column + even_column

print(int(res))

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())			# "5 7" -> ["5", "7"] -> 5, 7 => N=5,K=7

if min(h,w)==1:
	print(1)
	exit(0)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math

def main():
    H, W = [int(_) for _ in input().split()]
    if H == 1 or W == 1:
        m = 1
        print(int(m))
        sys.exit()
        
    elif H % 2 == 1 and W % 2 == 1:
        m = (H * W) // 2 + 1
    else:
        m = (H * W) // 2
    print(int(m))
main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

h = list(map(int, input().split()))
res = math.ceil(h[0] * h[1] / 2) if h[0] > 1 and h[1] > 1 else 1
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

from math import ceil, sqrt, floor


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

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

areas = [ceil(H / 2), H // 2]

ret = areas[0] * (ceil(W / 2)) + areas[1] * (W // 2)

print(ret)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
n,m = map(int, input().split())
if n == 1 or m == 1:
  print(1)
  exit(0)

print(math.ceil((n*m)-((n*m)/2)))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

def main():
    H, W = [int(_) for _ in input().split()]
    ans = (H // 2) * (W // 2) + (H // 2 + H % 2) * (W //2 + W % 2)
    if H > 1 and W > 1:
        print(ans)
    else:
        print(1)
main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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)