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: Wrong Answer

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

import sys  # {{{
import os
import time
import re
from pydoc import help
import string
import math
from operator import itemgetter
from collections import Counter
from collections import deque
from collections import defaultdict as dd
import fractions
from heapq import heappop, heappush, heapify
import array
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy as dcopy
import itertools
# }}}

# pre-defined{{{
sys.setrecursionlimit(10**7)
INF = 10**20
GOSA = 1.0 / 10**10
MOD = 10**9+7
ALPHABETS = [chr(i) for i in range(ord('a'), ord('z')+1)]  # can also use string module
def LI(): return [int(x) for x in sys.stdin.readline().split()]
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 DP(N, M, first): return [[first] * M for n in range(N)]
def DP3(N, M, L, first): return [[[first] * L for n in range(M)] for _ in range(N)]
from inspect import currentframe
# }}}

def solve():
    h, w = map(int, input().split())
    v1 = math.ceil(w/2);
    v2 = w//2;

    y1 = math.ceil(h/2);
    y2 = h//2;
    ans = y1*v1 + y2*v2;
    print(ans)

    return 0

if __name__ == "__main__":# {{{
    solve()

# vim: set foldmethod=marker: }}}

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

MOD = 1000000007

ans = (h % MOD) * (w % MOD) * 0.5

import math
print(math.ceil(ans))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
a=input().split(' ')
a=[int(x) for x in a]
if (a[0]*a[1])%2==0:
    print(a[0]*a[1]//2)
else:
    print(a[0]*a[1]//2+1)

Submission status: Wrong Answer

Solution code:

n,m = map(int, input().split())
print(int((n*m+1)/2))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from math import ceil

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

a,b,c,d=0,0,0,0
if n&1:
    a = n//2+1
    c = n//2
else:
    a = n//2
    c = n//2
if m&1:
    b = m//2+1
    d = m//2
else:
    b = m//2
    d = m//2

print(a*b + c*d)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from decimal import *
import math
i = list(map(int, input().split()))
a = Decimal(i[0])
b = Decimal(i[1])
c = math.ceil(Decimal(a * b / 2))
print(c)

Submission status: Wrong Answer

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


def solve(H: int, W: int):
    # print(int((H/2)*W) if H%2==0 else int((H//2)*W+math.ceil(W/2)))
    print(int(math.ceil(H*W/2)))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    solve(H, W)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

if S % 2 == 0:
    print(s)
else:
    print(s+1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import stdin
import math

h, w = [int(x) for x in stdin.readline().rstrip().split()]


print(math.ceil(h * w / 2))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    (h, w) = tuple(map(int, input().split()))
    ans = h * (w - 1) // 2
    if h % 2 != 0 or w % 2 != 0:
        ans += (h // 2) + 1
    print(ans)

Submission status: Wrong Answer

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

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

    if w % 2 == 1:
        w1 = w - 1
    else:
        w1 = w

    if h % 2 == 1:
        h1 = h - 1
    else:
        h1 = h

    cnt = (w1 * h1) // 2
    if h1 != h and w1 != w:
        cnt += 1

    if h1 != h:
        cnt += w1 // 2

    if w1 != w:
        cnt += h1 // 2

    print(cnt)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

if h%2 == 0:
  if w%2 == 0:
	# 縦偶数ｘ横偶数
    result = w // 2  * h 
  else:
    # 縦偶数ｘ横奇数
    result = (w//2 + 1) * h//2 + (w//2 * h//2)
else:
  if w%2 == 0:
	# 縦奇数ｘ横偶数
    result = (w//2) * h
  else:
    # 縦奇数ｘ横奇数
    result = (w//2 + 1) * (h//2+1) + (w//2 * h//2)
print(result)

Submission status: Wrong Answer

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


def result():
    if ((ans % 2) == 1):
        print((ans // 2) + 1)
    elif((ans % 2) == 0):
        print(ans // 2)


result()

Submission status: Wrong Answer

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

print(int(-(-(H*W)//2)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

tmpH=0
tmpHamari = w%2
if tmpHamari==1:
    tmpH=int(h/2)+1
else:
    tmpH=int(h/2)

tmpWamari = w%2
bigW = int(w/2)
smallW = int(w/2)
if tmpWamari==1:
    bigW+=1

print((tmpH*bigW) + ((tmpH-1)*smallW))

Submission status: Wrong Answer

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

if H % 2 == 1 and W % 2 == 1:
  print(int(H * W / 2 + 1.000001))
else:
  print(int(H * W / 2 + 0.000001))

Submission status: Wrong Answer

Solution code:
def main():
    #from sys import stdin, setrecursionlimit
    #setrecursionlimit(10**9)
    #r = input()
    #n = int(input())
    #a, b = map(int, input().split())
    #s, y = input().split()
    #a = input().split()
    #a = list(map(int, input().split()))
    #a = [input().split() for i in range(n)]
    #a = [int(input()) for i in range(n)]
    #a = [list(map(int, input().split())) for i in range(n)]
    #a = [int(s) - 1 for s in input().split()]
    #l=[int(input()) for _ in range(int(input()))]
    #res = 0
    h,w=map(int,input().split())
    if h == 1 or w == 1:
        print(1)
    res = h*w//2
    if (h*w)%2 != 0:
        res += 1
    print(res)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# coding: utf-8
H,W = list(map(float,input().split()))
ans = H*W/2
if H*W%2==1:
    ans+=1
print("%d"%ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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:
    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: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from decimal import *
import math
i = list(map(int, input().split()))
a = Decimal(i[0])
b = Decimal(i[1])
c = Decimal(a * b / 2)
print(c)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
tate,yoko=map(int,input().split())
gyou=0
masu=0
h=int(tate/2)
if yoko%2==1:
  gyou=int(yoko/2)+1
  if tate%2==1:
    #h=int(tate/2)
    masu+=gyou*(h+1)
    masu+=(gyou-1)*h
  else:
    masu+=(2*gyou-1)*h
else:
  gyou=int(yoko/2)
  if tate%2==1:
    masu+=gyou*(h+1)
    masu+=(gyou)*h
  else:
    masu+=(2*gyou)*h
print(masu)

Submission status: Wrong Answer

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

for i in range(0,h):
	if i % 2 == 0:
		c += w//2 +1
	else:
		c += w // 2

print(c)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

a = H*W

if a%2==1:
    ans = (a+1)//2

else:
    ans = a//2

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if H == 1 and W == 1:
  c = 1
else:
  if H % 2 == 0:
    h_1 = H / 2
    h_2 = H / 2
  else:
    h_1 = math.ceil(H / 2)
    h_2 = h_1 - 1

  if W % 2 == 0:
    width = W / 2
    c = h_1 * width
    c += h_2 * width
  else:
    width = math.ceil(W / 2)
    c = h_1 * width
    c += h_2 * (width - 1)

print(int(c))

Submission status: Wrong Answer

Solution code:
import math

H,W = [int(i) for i in input().split()]
print(math.ceil(H*W/2))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8

H, W = map(int, input().split())
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))
print(h_odd*w_odd+h_even*w_even)

Submission status: Wrong Answer

Solution code:
# coding: utf-8

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

N = H * W / 2
print(int(N))

Submission status: Wrong Answer

Solution code:
# coding: utf-8
H,W = list(map(int,input().split()))
ans = H*W/2
if H*W%2==1:
    ans+=1
print("%d"%ans)

Submission status: Wrong Answer

Solution code:
import math

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

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

Submission status: Wrong Answer

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

if h % 2 == 1:
    ch1 = math.ceil(h/2)
    ch2 = math.floor(h/2)
else:
    ch1 = h//2
    ch2 = h//2
    
if w % 2 == 1:
    cw1 = math.ceil(w/2)
    cw2 = math.floor(w/2)
else:
    cw1 = w//2
    cw2 = w//2
    
ans = ch1 * cw1 + ch2 * cw2
print(int(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
H, W = map(int, input().split(' '))
print(int(math.ceil(H/2*W)))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

    print(count)

if __name__ == '__main__':
    resolve()

Submission status: Wrong Answer

Solution code:
value = input().split()
rows = int(value[0])
colmuns = int(value[1])
OddColNum = colmuns // 2 
EvenColNum = OddColNum
if (colmuns % 2) != 0:
  OddColNum = OddColNum + 1
if (colmuns == 1):
  OddColNum = 1

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

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

Submission status: Wrong Answer

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

import sys


def LI():
    return list(map(int, sys.stdin.buffer.readline().split()))


def I():
    return int(sys.stdin.buffer.readline())


def LS():
    return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()


def S():
    return sys.stdin.buffer.readline().rstrip().decode('utf-8')


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


def SRL(n):
    return [list(S()) for i in range(n)]


def MSRL(n):
    return [[int(j) for j in list(S())] for i in range(n)]

# ----------------------------------------------------------------


def main():
    h, w = LI()
    if h % 2 == 0 or w % 2 == 0:
        print('{:.0f}'.format(w * h / 2))
    else:
        print('{:.0f}'.format((h * w + 1) / 2))


main()

Submission status: Wrong Answer

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

if  int(a) != 0 and int(b) != 0:
    n = ((int(A) * int(B)) // 2) + 1
    print(n)
else :
    n = (int(A) * int(B)) //2
    print(n)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
from math import ceil, floor

data = input().split()
h, w = [int(i) for i in data]

print(ceil(h/2) * ceil(w/2) + floor(h/2) * floor(w/2))

Submission status: Wrong Answer

Solution code:
arg = input().split(' ')
H = int(arg[0])
W = int(arg[1])

w_odd = W // 2 if W % 2 == 0 else (W+1) // 2
w_even = W // 2

h_odd_line = (H+1) // 2
h_even_line = H // 2

reachable = (w_odd * h_odd_line + w_even * h_even_line)
print(reachable)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import re
import math
import itertools
from copy import deepcopy
import fractions
import random
#from functools import lru_cached
from heapq import heappop,heappush
import time
import os
import sys
import datetime
readline=readline = sys.stdin.readline
sys.setrecursionlimit(2000)
#import numpy as np
alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def fac_list(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="int"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def join(A,c=" "):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s
#main
H,W=map(int,input().split())
gu=((H+1)//2)*((W+1)//2)
ki=(H//2)*(W//2)
print(gu+ki)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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


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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
i = list(map(int, input().split()))
HH = i[0]
WW = i[1]
atai = HH*WW
ans = int(atai/2)
if ((HH % 2) * (WW % 2) == 1):
    ans = ans +1
#amari = divmod(atai,2)
#ans = int(atai/2) + amari[1]
#ans = int(atai/2) + (atai % 2)
#print (atai)
#print (int(atai/2))
print (ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

def main():
    
    h, w = [int(i) for i in input().split()]
    
    result = 0
    result += (h // 2) * (w // 2)
    result += (h - (h // 2)) * (w - (w // 2))
    print(result)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
h, v = input().split(' ')
h = int(h)
v = int(v)
hr = int((h-1)/2) + 1
# print(hr)
vrP = (int((v-1)/2) + 1) * hr
# print(vrP)
vpN = 0
if h % 2 == 0:
    vrN = (int((v) / 2)) * (hr)
else:
    # print("dddd" + ( int((v) / 2)))
    vrN = (int((v) / 2)) * (hr-1)

# print(vrN)
print(vrP + vrN)

Submission status: Wrong Answer

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*v2+(v1-1)*v2
    else:
        t=v1+1
        ans=v2*(t-1)+(v2+1)*t
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math

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

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

cnt = (odd + even) * (W // 2) + odd  * (W % 2) 
print(cnt)

Submission status: Wrong Answer

Solution code:
def main():
    #from sys import stdin, setrecursionlimit
    #setrecursionlimit(10**9)
    #r = input()
    #n = int(input())
    #a, b = map(int, input().split())
    #s, y = input().split()
    #a = input().split()
    #a = list(map(int, input().split()))
    #a = [input().split() for i in range(n)]
    #a = [int(input()) for i in range(n)]
    #a = [list(map(int, input().split())) for i in range(n)]
    #a = [int(s) - 1 for s in input().split()]
    #l=[int(input()) for _ in range(int(input()))]
    #res = 0
    h,w=map(int,input().split())

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

print(solve())

Submission status: Wrong Answer

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

def check(x):
    if x%2==0:
        return x//2
    return x//2 + 1

even_row = check(W)
odd_row = check(W-1)
cH = check(H)
total_even_row = even_row * cH
total_odd_ror = odd_row * (H - cH)

print(total_even_row + total_odd_ror)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if a % 2 == 0 or b % 2 == 0:
  print(a * b // 2)
  
elif a % 2 == 1 and b % 2 == 1:
  ans = a * (b //2) + (a + 1) //2
  print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if H == 1 and W == 1:
  c = 1
else:
  if H % 2 == 0:
    h_1 = H / 2
    h_2 = H / 2
  else:
    h_1 = math.ceil(H / 2)
    h_2 = h_1 - 1

  if W % 2 == 0:
    width = W / 2
    c = h_1 * width
    c += h_2 * width
  else:
    width = math.ceil(W / 2)
    c = h_1 * width
    c += h_2 * (width - 1)

print(c)

Submission status: Wrong Answer

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


#１,３,５...
s = math.ceil(w/2)

#2,4,6..
t = math.floor(w/2)

g = s+t


if(h%2 != 0):
    count =  (math.floor(h/2)) * g + s
elif(h%2 == 0):
    count = (h/2) * g

if(w == 1):
    count = 1



print(int(count))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
h,w=map(int,input().split())
count=0
if h%2==1 and w%2==1:
    print(round((w-1)*0.5)*h+round((h+1)*0.5))
else:
    if h%2==0:
        print(round(h*0.5)*w)
    else:
        print(round(w*0.5)*h)

Submission status: Wrong Answer

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


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

    if(h ==1 | w==1):
        print(h*w//2)
        return 0

    if h%2 ==0:
        hr = h
        hm = 0
    else:
        hr = h-1
        hm = 1

    if w%2 ==0:
        wr = w
        wm = 0
    else:
        wr = w-1
        wm = 1

    ans = hr * wr //2
    ans += hr * wm //2 + wr * hm //2 

    if(wm & hm):
        ans +=1

    print(ans)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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

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

print(a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#スペース区切りの整数の入力
H, W = map(int, input().split())

ans = 0

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

Submission status: Wrong Answer

Solution code:
print((sum(map(int,input().split()))+1)//2)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8

H, W = map(int, input().split())
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))
print(h_odd*w_odd+h_even*w_even-1)

Submission status: Wrong Answer

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