Problem:


Score : 200 points

Problem Statement

We have a board with H horizontal rows and W vertical columns of squares.
There is a bishop at the top-left square on this board.
How many squares can this bishop reach by zero or more movements?

Here the bishop can only move diagonally.
More formally, the bishop can move from the square at the r_1-th row (from the top) and the c_1-th column (from the left) to the square at the r_2-th row and the c_2-th column if and only if exactly one of the following holds:

r_1 + c_1 = r_2 + c_2

r_1 - c_1 = r_2 - c_2

For example, in the following figure, the bishop can move to any of the red squares in one move:

Constraints

1 \leq H, W \leq 10^9

All values in input are integers.

Input

Input is given from Standard Input in the following format:

H \ W

Output

Print the number of squares the bishop can reach.

Sample Input 1

4 5

Sample Output 1

10

The bishop can reach the cyan squares in the following figure:

Sample Input 2

7 3

Sample Output 2

11

The bishop can reach the cyan squares in the following figure:

Sample Input 3

1000000000 1000000000

Sample Output 3

500000000000000000



Sample input:
4 5


Sample output:
10

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B=map(int, input().split())
C=A*B//2
D=A*B%2
if A==1 or B==1:
  E=1
else:
  E=C+D
print(E)

Submission status: Accepted

Solution code:
import math
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(math.ceil(H*W/2))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))


def main():
    h,w = mi()

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

Submission status: Accepted

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

Submission status: Accepted

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

    b=H//2

    N=a*b*2+W%2*b+H%2*a

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
import math

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

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

ans = (H // 2) * W

if H % 2 == 1:
    ans += math.ceil(W / 2)

print(ans)

Submission status: Accepted

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

Z = H * W % 2

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

Submission status: Accepted

Solution code:

H , W = input().split()
W = int(W)
H = int(H)
ans = int(0)

#Wが偶数なら(W//2)*H
#W.Hが奇数なら((W+1)//2)*((H+1)//2) + ((W - 1)//2*(H - 1)//2)
#Wが奇数Hが偶数(W+1)//2*(H//2) + ((W - 1)//2)*(H//2)

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

Submission status: Accepted

Solution code:
a = [int(x) for x in input().split(" ")]
if a[0] < 2 or a[1] < 2:
    print(1)
    exit()
kisu = a[0] // 2 if a[0] % 2 == 0 else a[0] // 2 + 1
gusu = a[0] // 2
yokokisu = a[1] // 2 if a[1] % 2 == 0 else a[1] // 2 + 1
yokogusu = a[1] // 2
ans = kisu * yokokisu + gusu * yokogusu
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3 ## -*- python -*-

t = input().split()
h = int(t[0])
w = int(t[1])

a = (h * w + 1) // 2

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

print(a)

Submission status: Accepted

Solution code:
Y, X = map(int, input().split()) 	

num = X * Y
if X == 1 or Y == 1:
  out =1
elif num % 2 == 0:
  out = int(num / 2)
elif num % 2 == 1:
  out = int((num -1)/2 + 1)
print(out)

Submission status: Accepted

Solution code:
import sys
import itertools
import math
from collections import deque
MAX_INT = int(10e15)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

H,W = IL()
if H == 1 or W == 1:
  print(1)
else:

  numb = W//2
  numa = W - numb

  numd = H//2
  numc = H - numd
  ans = numa * numc + numb * numd

  print(ans)

Submission status: Accepted

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

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

a=w*(h//2)

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

Submission status: Accepted

Solution code:
value = input().split()
rows = int(value[0])
colmuns = int(value[1])

#valid
if colmuns == 1:
  rows = 1
elif rows == 1:
  colmuns = 1

OddColNum = colmuns // 2 
EvenColNum = OddColNum
if (colmuns % 2) != 0:
  OddColNum = OddColNum + 1
if (colmuns == 1):
  OddColNum = 1

OddRowCount = 0
EvenRowCount = rows // 2
if (rows % 2) == 0:
  OddRowCount = rows // 2
else:
  OddRowCount = (rows // 2) + 1
if (rows == 1):
  OddRowCount = 1

counts = OddRowCount * OddColNum + EvenColNum * EvenRowCount
print(counts)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(1000000)
input = sys.stdin.readline
from bisect import *
from collections import *
from heapq import *
INF = 500000
mod = 10**9+7

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


# a, b, c = input(), input(), input()
# la, lb, lc = len(a), len(b), len(c)
# for i in range(1, min(la, lb)):
#     S = ''
#     for j in range(i):
#         if a[la-i+j] == b[j]:
#             S += b[j]
#             continue
#         elif a[la-i+j] == '?':
#             S += b[j]
#         elif b[j] == '?':
#             S += c[j]

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
from decimal import Decimal
H,W = map(int,input().split())
if H==1 or W == 1:
  print(1)
elif H%2==0 and W%2== 0:
  print(Decimal((H*W)/2))
elif H%2 == 1 and W%2==1:
  print(Decimal(H*math.floor(W/2)+math.ceil(H/2)))
elif H%2 == 1 and W%2==0:
  print(Decimal(H*math.floor(W/2)))
else:
  print(Decimal(W*math.floor(H/2)))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
h, w = (int(x) for x in input().split())
if h == 1 or w == 1:
    odd_row = 0
    even_row = 0
    total = 1
elif w%2 == 0:
    odd_row = w // 2
    even_row = odd_row
    total = (h//2)*even_row + (h-h//2)*odd_row
else:
    odd_row = w // 2 + 1
    even_row = odd_row - 1
    total = (h//2)*even_row + (h-h//2)*odd_row
print(total)

Submission status: Accepted

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

if hw[0] == 1 or hw[1] == 1:
    count = 1
elif hw[0] % 2 == 0 and hw[1] % 2 == 0:
    count = (hw[0] * hw[1]) // 2
elif hw[0] % 2 != 0 and hw[1] % 2 == 0:
    count = ((hw[0] + 1) * hw[1] // 2) - (hw[1] // 2)
elif hw[0] % 2 == 0 and hw[1] % 2 != 0:
    count = ((hw[1] + 1) * hw[0] // 2) - (hw[0] // 2)
else:
    count = ((hw[0] + 1) * (hw[1] + 1) // 2) - ((hw[0] // 2 + 1) + (hw[1] // 2 + 1) - 1)
print(count)

Submission status: Accepted

Solution code:
input_line = input()
Line = input_line.split()
Line = [int(s) for s in Line]
 
if Line[0] ==1 or Line[1] == 1:
  print("1")
else:
  print(-(-Line[0]*Line[1] // 2))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
rline = sys.stdin.readline


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


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:

def main():
    temp = list(map(int,input().split(' ')))
    H = temp[0]
    W = temp[1]

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

    # if H % 2 == 1:
    #     h = int(H/2) + 1
    #     h1 = int(H/2)
    # else:
    #     h = int(H/2)
    #     h1 = int(H/2)
    #
    # if W % 2 == 1:
    #     w = int(W/2) + 1
    #     w1 = int(W/2)
    # else:
    #     w = int(W/2)
    #     w1 = int(W/2)

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

    #print(w*h + w1*h1)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
H, W = map(int, input().split())
if H == 1 or W == 1:
  total = 1
else:
  Rodd = (W + 2 - 1) // 2
  Reven = W - Rodd
  odd = (H + 2 - 1) // 2
  even = H - odd
  total = Rodd * odd + Reven * even

print(total)

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
w, h = input().split()
w = float(w)
h = float(h)
n = (w // 2 + w % 2)*(h // 2 + h % 2)
m = w // 2 * (h //2)

if (n and m):
	print(int(n + m))
else:
  	print(1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
h, w= map(int,input().split())
tw = math.ceil(w / 2)
th = math.ceil(h / 2)

ans = th*tw + int(h/2)*int(w/2)
if h ==1 or w == 1:
    print(1)

else:
    print(ans)

Submission status: Accepted

Solution code:
import math
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
mod = 10**9 + 7 
sys.setrecursionlimit(1000010)

H,W = nm()
if H == 1: 
    print(1)
    exit(0)
if W == 1:
    print(1)
    exit(0)
    
print((H * W + 1)//2)

Submission status: Accepted

Solution code:
#!python3.4
# -*- coding: utf-8 -*-
# panasonic2020/panasonic2020_b
import sys, math

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    H, W = i2nn()
    if H == 1 or W == 1:
        print(1)
        return
    print(math.ceil(H * W / 2))
    return

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 + 1) * (W + 1) // 4 + (H - 1) * (W - 1) // 4)

Submission status: Accepted

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

print(res)

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

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
from math import ceil

H, W = map(int, input().split())
if H == 1 or W == 1:
    print(1)
    exit()
even = ceil(H/2)
odd = H-even
ans = H*(W//2) + even*(W%2)

print(max(ans, 1))

Submission status: Accepted

Solution code:
a,b = map(int, input().split())
m = (a+1) //2
n = a // 2
c = (b+1) // 2
d = b // 2
x = (m*c)+(n*d)
if a == 1:
  x = 1
elif b == 1:
  x = 1
print(x)

Submission status: Accepted

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

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

Submission status: Accepted

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

ws = -1
wss = -1

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

if (w % 2) == 0:
    ws = w//2
else:
    ws = (w + 1)//2

wss = w//2

hs = -1
hss = -1

if (h % 2) == 0:
    hs = h//2
else:
    hs = (h+1)//2

hss = h//2


# print(ws, wss, hs, hss)
print(ws*hs + wss*hss)

Submission status: Accepted

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

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
def solve():
    N, M = map(int, input().split())
    if N == 1:
        return 1
    if M == 1:
        return 1
    
    if N % 2 == 0:
        return M * N // 2
    else:
        a = N // 2 * M
        if M % 2 == 0:
            return a + M//2
        else:
            return a + (M//2 + 1)

print(solve())

Submission status: Accepted

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

Submission status: Accepted

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


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

        

    result = (H * W) // 2

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

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)

Submission status: Accepted

Solution code:
import math

height, width = [int(i) for i in input().split(' ')]

if height > 1 and width > 2:
    print(math.ceil(width/2) * math.ceil(height/2) + math.floor(width/2) * math.floor(height/2))
else:
    print(1)

Submission status: Accepted

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

Submission status: Accepted

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

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

if H % 2 != 0 and W % 2 == 0:
    H, W = W, H

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

Submission status: Accepted

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


def main():

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

    result = 0
    if h == 1 or w == 1:
        result = 1
    else:
        result = w * (h // 2)
        if h % 2 == 1:
            result += math.ceil(w / 2)

    print(int(result))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

ans = 1
if h != 1 and w != 1:
    ans = (h//2) * w
    if h%2 == 1:
        c = w - w//2
        ans += c

print(ans)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
datas = input().split(" ")

h = int(datas[0])
w = int(datas[1])


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# ANSHUL GAUTAM
# IIIT-D

from math import *
from copy import *
from string import *				# alpha = ascii_lowercase
from random import *				# l.sort(key=lambda l1:l1[0]-l1[1]) => ex: sort on the basis difference
from bisect import *				# bisect_left(arr,x,start,end)  => start and end parameters are temporary
from sys import stdin				# bisect_left return leftmost position where x should be inserted to keep sorted
from sys import maxsize
from operator import *				# d = sorted(d.items(), key=itemgetter(1))
from itertools import *
from collections import Counter		# d = dict(Counter(l))
from collections import defaultdict # d = defaultdict(list)

'''

'''

def solve(l):
	n = len(l)

h,w = list(map(int, stdin.readline().rstrip().split()))
if(h == 1 or w == 1):
	print(1)
else:
	print(ceil((h/2)*w))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math
import copy
from copy import deepcopy
import sys
import fractions
# import numpy as np
from functools import reduce
# import statistics
import heapq
import collections
import itertools
sys.setrecursionlimit(100001)

# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

# n, m = map(int, input().split())

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

ans = 0
ans += w * math.floor(h / 2)

if h % 2 == 1:
    ans += math.floor(w / 2) + math.floor(w % 2)

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

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

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect, bisect_left, bisect_right

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

H, W = MAP()
if H == 1 or W == 1:
    print(1)
    exit()
if H % 2 == 0 and W % 2 == 0:
    a = H * W // 2
if H % 2 == 0 and W % 2 != 0:
    a = H * W // 2
if H % 2 != 0 and W % 2 == 0:
    a = (H - 1) * W // 2 + (W // 2)
if H % 2 != 0 and W % 2 != 0:
    a = (H - 1) * W // 2 + (W // 2 + 1)
print(a)

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

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





# exit()
# if W % 2 == 0:
#     a = W // 2
#     b = W // 2
# else:
#     a = W // 2 + 1
#     b = W // 2
# # a = ceil(W / 2)
# # b = ceil((W-1) / 2)
# print(a)
# print(b)
# if H % 2 == 0:
#     ans = a * H // 2 + b * H // 2
#     print(H//2)
#     print(H//2)
# else:
#     ans = a * (H // 2+1) + b * H // 2
#     print(H//2+1)
#     print(H//2)
# print(ans)

Submission status: Accepted

Solution code:
H, W = map(int,input().split())
ans = int(H * W / 2)

if H * W %2 != 0:
    ans += 1

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

print(str(ans))

Submission status: Accepted

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

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

Submission status: Accepted

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

if (H==1 or W==1) :
    print(1)
else:
    m1=int((W+1)/2)
    m2=int(W/2)

    n1=int((H+1)/2)
    n2=int(H/2)

    print(m1*n1+m2*n2)

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:
x = input().split()
H = int(x[0])
W = int(x[1])

n = H % 2
m = W % 2

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
#n=int(input())
h,w=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
v1=h//2
v2=w//2
if h==1 or w==1:
    ans=1
elif h%2==0:
    ans=v1*w
else:
    if w%2==0:
        ans=(v1+1)*v2+(v1)*v2
    else:
        t=v1+1
        ans=v2*(v1)+(v2+1)*(v1+1)
print(ans)

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

H = int(H)
W = int(W)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():

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

    if H == 1: return 1
    if W == 1: return 1

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

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