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 math

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

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

cnt = 0

if H==1 or W==1:
    cnt = 1
else:
    if H%2:
        cnt = even*math.ceil(H/2) + odd*math.floor(H/2)
    else:
        cnt = even*math.floor(H/2) + odd*math.ceil(H/2)
    
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#def main(S, b):
if __name__ == '__main__':
    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
import sys
H,W = map(int,input().split())
#print(H,W)
if(H == 1 or W == 1):
    print(1)
    sys.exit()

set_num = int(H/2)
#print(set_num)
number = int(set_num * W)
#print(number ,set_num)
amari = H - int(set_num) * 2
#print(number,amari)
number += amari * math.ceil(W/2)
print(int(number))

Submission status: Accepted

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

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

if W % 2 == 0:
    f, n = W // 2, W // 2
else:
    f = math.ceil(W / 2)
    n = f - 1

if H % 2 == 0:
    kakeru = H // 2
    print(f * kakeru + n * kakeru)
    exit()
else:
    kakeru = H // 2
    n_kakeru = H - kakeru
    print((f * n_kakeru) + (n * kakeru))
    exit()

Submission status: Accepted

Solution code:
string = input().split(' ')

H = int(string[0])
W = int(string[1])

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
H, W = map(int, input().split())
 
if H == 1 or W == 1:
  print(1) 
# 両方奇数の場合
elif H%2 == 1 and W%2 == 1:
  print((H*W)//2+1)
else:
  print((H*W)//2)

Submission status: Accepted

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

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

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()
e=w//2
o=w-e
E=h//2
O=h-E
c=e*E+o*O
print(c)

Submission status: Accepted

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

def can_move(H, W):
    if W == 0:
        return 0
    elif H == 1 or W == 1:
        return 1
    masu = H * W
    return int((masu / 2) + (masu % 2))

print(can_move(H, W))

Submission status: Accepted

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

even_rows = h // 2
odd_rows = (h+1) // 2

if w > 1 and h > 1:
    ans = 0
    ans += w // 2 * even_rows
    ans += (w+1) // 2 * odd_rows

    print(ans)
else:
    print(1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    h, w = LI()
    ans = 0
    if h == 1 or w == 1:
        print(1)
        return
    x = (h + 1) // 2
    y = h // 2
    ans += (w + 1) // 2 * x
    ans += w // 2 * y
    print(ans)
    return


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

x = list( map(int, input().split()) )
h = x[0]
w = x[1]

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


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

Submission status: Accepted

Solution code:



hi, wd = map(int, input().split())


# いずれかが１の場合
if hi==1 or wd ==1:
    print(1)
    exit()

# heightまたはwidthが偶数だった場合
if hi%2 == 0 or wd%2 == 0:
    print(hi*wd//2)
else:
    print(hi*wd//2 + 1)

Submission status: Accepted

Solution code:
H, W = map(int, input().split())
a = W // 2
b = W % 2

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
''' بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ '''
#codeforces
gi = lambda : list(map(int,input().split()))
n, m = gi()
l = m // 2 + m % 2
ans = l * (n // 2 + n % 2) + (m // 2) * (n // 2)
if n == 1 or m == 1:
	ans = 1
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

print(ans)

Submission status: Accepted

Solution code:

def calc(w, h):
    if w == 1 or h == 1:
        return 1

    result = w * h / 2

    if w * h % 2 != 0:
        result += 1

    return int(result)


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

result = calc(w, h)
print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
H, W = [int(x) for x in 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:
H,W=map(int,input().split())

if H!=1 and W!=1:
    
    if W%2==0:
        A_W=int(W/2)
        B_W=int(W/2)
    
        if H%2==0:
            A_H=int(H/2)
            B_H=int(H/2)
        else:
            A_H=int(H/2)+1
            B_H=int(H/2)
        
        ans=A_W*A_H+B_W*B_H
    
    else:
        A_W=int(W/2)+1
        B_W=int(W/2)
    
        if H%2==0:
            A_H=int(H/2)
            B_H=int(H/2)
        else:
            A_H=int(H/2)+1
            B_H=int(H/2)
        
        ans=A_W*A_H+B_W*B_H

else:
    ans=1
    
print(int(ans))

Submission status: Accepted

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

Submission status: Accepted

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

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

elif W % 2 !=0 and H %2 !=0:
    print(int(0.5*(W*H+1)))

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	B
# CreatedDate:  2020-03-14 21:09:03 +0900
# LastModified: 2020-03-14 21:29:51 +0900
#


import os


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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:

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

Submission status: Accepted

Solution code:
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    H, W = map(int, input().split())

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


main()

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


mm1 = (W+1)//2
mm2 = W//2

mm3 = (H+1)//2
mm4 = H//2

if H>=2 and W>=2:
    print(mm1*mm3+mm2*mm4)
else:
    print(1)

Submission status: Accepted

Solution code:
# ABCpana_B.py
from math import ceil
h,w=map(int,input().split())
# print(ceil(4/2))
if h==1:
    print(1)
    exit()
if w==1:
    print(1)
    exit()

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def inp():
    return input()
def iinp():
    return int(input())
def inps():
    return input().split()
def miinps():
    return map(int,input().split())
def linps():
    return list(input().split())
def lmiinps():
    return list(map(int,input().split()))
def lmiinpsf(n):
    return [list(map(int,input().split()))for _ in range(n)]

h,w = miinps()
ans = 0
k = w%2
l = w//2
p = h//2
q = h%2

if h == 1:
  print(1)
  exit()
if w == 1:
  print(1)
  exit()
if k == 1:
  ans += (h*l)
  if q == 1:
    ans += (p+1)
  else:
    ans += p
else:
  ans += (h*l)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=list(map(int,input().split()))
if s[0]!=1 and s[1]!=1:
  if s[0]%2==0:
    a=int(s[0]//2)
    a=a*s[1]
    print(a)
  else:
    if s[1]%2==0:
      a=int(s[1]//2)
      a=a*s[0]
      print(a)
    else:
      b=int(s[0]//2)
      c=int(s[1]//2)
      a=(b+1)*(c+1)
      a=a+b*c
      print(a)
else:
  print(1)

Submission status: Accepted

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

ans = 0

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

res = 0
res += W * (H // 2)

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

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

print(res)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
#import numpy as np
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#S = list(str(input()))
#N = int(input())
#S = str(input())

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

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

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

Submission status: Accepted

Solution code:
H,W = map(int,input().split())
h=0
w=0
if H==1 or W ==1:
    print(int(1))
else:
    h=H 
    w=W

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

Submission status: Accepted

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

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

print(s)

Submission status: Accepted

Solution code:
import math
a=input().split(' ')
if(int(a[0])==1):
    print(1)
else:
    if(int(a[1])==1):
        print(1)
    else:
        print(math.ceil(int(a[0])*int(a[1])/2))

Submission status: Accepted

Solution code:
base = input().split()
h = int(base[0])
w = int(base[1])
if h%2==1:
    ha = (h//2)+1
    hb = ha-1
else:
    ha = h/2
    hb = ha
g = w//2
if w%2==1:
    ans = ha*(g+1)+hb*g
else:
    ans = (ha+hb)*(w/2)
if h ==1:
    ans = 1
if w ==1:
    ans = 1
print(int(ans))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num = [int(i) for i in input().split(' ')]

if num[0] == 1 and num[1] == 1:
  print(1)
elif num[0] == 1 or num[1] == 1:
  print(1)
else:
  A = num[0] * num[1]
  if(A % 2 == 0):
    print(int(num[0] * num[1] / 2))
  else:
    print(int((A-1) / 2 + 1))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
H,W = map(int,input().split())
ans = 0
wx = W // 2
hx = H // 2
wy = W % 2
hy = H % 2

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

if wy == 0 and hy == 0:
  ans = (W * H) / 2
elif wy == 1 and hy == 0:
  ans = (((W-1)*H)/2) + (H / 2)
elif wy == 0 and hy == 1:
  ans = ((W*(H-1))/2) + (W / 2)
else:
  ans = (((W-1)*(H-1))/2) + ((W-1) / 2) + ((H-1) / 2) + 1
print(int(ans))

Submission status: Accepted

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

x = h*w

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

if x%2==0:
  print(int(x/2))
else:
  print(int(math.ceil(x/2)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
val = input().split(' ')
h = int(val[0])
w = int(val[1])

square_num = h * w
result = square_num / 2
if h == 1 or w == 1:
    result = 1
elif square_num % 2 == 1:
    result += 0.5
print(int(result))

Submission status: Accepted

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

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

if h%2 == 0 and w%2 == 1:
  ans = (h//2)*w

if h%2 == 1 and w%2 == 0:
  ans = h*(w//2)

if h%2 == 1 and w%2 == 1:
  ans = (h*w)//2+1
#

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
import re

l = sys.stdin.readline()
l = l.split(' ')
l = [int(str) for str in l]

h = l[0]
w = l[1]

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

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

print(out)
sys.stdout.flush()

Submission status: Accepted

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


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

if H == 1 or W == 1:
    print(1)
else:
    H2 = H // 2
    W2 = W // 2
    H3 = H - H2
    W3 = W - W2
    print(H2 * W2 + H3 * W3)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
hei,wid=map(int,input().split())
s=0
s+=hei*wid

if (hei==1 and wid>=1) or (hei>=1 and wid==1):
    print(1)
elif s%2!=0:
    print(s//2+1)
else:
    print(s//2)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# from math import factorial,sqrt
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter

# import numpy as np
# import scipy as scp

# 入力の受け取り
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:
    w1 = w//2
    w2 = w-w1
    ans = ((h//2)*w1) + (((h+1)//2)*(w2))
    
print(ans)
# print("{:.10f}".format(ans))

Submission status: Accepted

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

if h == 1 and w >= 1:
    ans = 1
elif h >= 1 and 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 sys
h, w = list(map(int, input().split()))

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

Submission status: Accepted

Solution code:
import math
hw=list(map(int, input().split())) 
h=hw[0]
w=hw[1]
answer=int(math.ceil((h/2)*w))
if(h==1 or w==1):
    answer=1
print(answer)

Submission status: Accepted

Solution code:
H,W = list(map(int , input().split()))
h = H % 2
w = W % 2
if H > 1 and W > 1:
    if h == 1:
        s = (H+1) /2
        t = s - 1
        if w == 1:
            m = (W+1) /2
            n = m - 1
            a = s * m
            b = t * n
            c = round(a + b)
        else:
            m = W / 2
            a = s * m
            b = t * m
            c = round(a + b)
    else:
        s = H / 2
        a = s * W
        c = round(a)
else:
    c = 1
    
    
print(c)

Submission status: Accepted

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

if H==1:
    ans=1
elif W==1:
    ans=1
elif H==2 and W==2:
    ans=2
print(ans)

Submission status: Accepted

Solution code:

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

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

a = ceil(w/2)
b = w - a

if h == 1 or w == 1:
    print(1)
    exit()
    
if h%2 == 0:
    ans = a*h//2 + b*h//2
    print(ans)

else:
    ans = a*(h//2) + b*(h//2) + a
    print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

if R == 1 or C == 1:
  print(1)
elif R % 2 == 0:
  n = R/2
  print(int(n * C))
else:
  n1 = (R+1) / 2
  n2 = n1 - 1
  c1 = int((C+1)/2)
  c2 = C -c1
  print(int(n1*c1 + n2*c2))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
i = input()
data = i.split(" ")
if int(data[0])*int(data[1]) == int(data[0]) or int(data[0])*int(data[1]) == int(data[1]):
    print(1)
elif (int(data[0])*int(data[1]))%2 == 0:
    print(int(data[0])*int(data[1])//2)
else:
    print(int(data[0])*int(data[1])//2+1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(result)

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

Submission status: Accepted

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

from math import ceil
h_odd_num = ceil(h / 2)
h_even_num = h // 2

w_odd_num = ceil(w / 2)
w_even_num = w // 2

if h > 1 and w > 1:
  print(h_odd_num * w_odd_num + h_even_num * w_even_num)
else:
  print(1)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

odd = ((h+1)//2) * ((w+1)//2)
even = (h//2) * (w//2)

print(odd+even)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
W, R = map(int,input().split())
 
seki = W*R

if(W==1 or R==1):
  print(1)
  sys.exit()
 
if seki%2 == 0:
  print(int(seki/2))
else:
  print(int((seki+1)/2))

Submission status: Accepted

Solution code:
h,w = map(int,input().split())
 
result = h*w // 2 + h*w % 2

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input():
    return sys.stdin.readline()[:-1]
H,W = map(int,input().split(' '))
A = -(-W//2)
if W==1 or H==1:
    print(1)
    exit()
if H%2==0:
    print(W*H//2)
else:
    print(W*(H-1)//2+A)