Problem:


Score : 200 points

Problem Statement

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

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

r_1 + c_1 = r_2 + c_2

r_1 - c_1 = r_2 - c_2

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

Constraints

1 \leq H, W \leq 10^9

All values in input are integers.

Input

Input is given from Standard Input in the following format:

H \ W

Output

Print the number of squares the bishop can reach.

Sample Input 1

4 5

Sample Output 1

10

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

Sample Input 2

7 3

Sample Output 2

11

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

Sample Input 3

1000000000 1000000000

Sample Output 3

500000000000000000



Sample input:
4 5


Sample output:
10

Submission status: Accepted

Solution code:
def myAnswer(H:int,W:int) -> int:
   if(H == 1 or W == 1):
      return 1
   else:
      return (H * W) // 2 + (H * W) % 2


def modelAnswer():
   tmp=1
def main():
   H, W = map(int,input().split())
   print(myAnswer(H,W))

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 W % 2 == 0:
        r = W // 2
        print(r * H)
    else:
        r1 = W // 2 + 1
        r2 = W // 2 
        c = 0
        for i in range(H):
            if i % 2 == 0:
                c += r1
            else:
                c += r2
        print(c)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from fractions import gcd
from math import factorial, sqrt
from functools import lru_cache, reduce
INF = 1 << 60
mod = 1000000007
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

# UnionFind
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

# ダイクストラ
def dijkstra_heap(s, edge, n):
    #始点sから各頂点への最短距離
    d = [10**20] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

# 素因数分解
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

# 2数の最小公倍数
def lcm(x, y):
    return (x * y) // gcd(x, y)

# リストの要素の最小公倍数
def lcm_list(numbers):
    return reduce(lcm, numbers, 1)

# リストの要素の最大公約数
def gcd_list(numbers):
    return reduce(gcd, numbers)

# ここから書き始める
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))
else:
    print((h * w) // 2)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
printV = lambda x: print(*x, sep="\n")
printH = lambda x: print(" ".join(map(str,x)))
def IS(): return sys.stdin.readline()[:-1]
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LII(rows_number): return [II() for _ in range(rows_number)]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]

def main():
	h,w = MI()
	if h == 1 or w == 1:
		print(1)
	else:
		if h*w % 2 == 0:
			print(h*w//2)
		else:
			print(h*w//2+1)

if __name__ == '__main__':
	main()

Submission status: Accepted

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

if H == 1 or W == 1:
  print(1)
else:
	print(sum(divmod(H * W, 2)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
H,W = (int(x) for x in 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())
print(1 if H == 1 or W == 1 else (H*W+1)//2 )

Submission status: Accepted

Solution code:
h, w = [int(x) for x in input().split()]

if 1 in (h, w):
    print(1)
else:
    s = h * w
    print(sum(divmod(h * w, 2)))

Submission status: Accepted

Solution code:
x, y = map(int, input().split())

count = 0
if y == 1 or x == 1:
	count = 1
elif y % 2 == 0:
	count = x * (y // 2)
else:
	count = x * ((y + 1) // 2) - (x // 2)

print(count)

Submission status: Accepted

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

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

ans = (math.ceil(W / 2) * math.ceil(H / 2)) + ((W // 2) * (H // 2))

print(ans)

Submission status: Accepted

Solution code:
from math import floor, ceil
v, h = list(map(int, input().split()))
if v == 1 or h == 1:
    print(1)
else:
    vc = ceil(v/2)
    vf = floor(v/2)
    hc = ceil(h/2)
    hf = floor(h/2)
    print(vc*hc+vf*hf)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
tate, yoko = map(int, input().split())

if tate == 1:
	print(1)
elif yoko == 1:
	print(1)
elif (tate*yoko)%2==1:
	print(int((tate*yoko+1)/2))
else:
	print(int((tate*yoko)/2))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

if h > 1 and w > 1:
	print(ceil(w/2) * ceil(h/2) + floor(w/2) * floor(h/2) )
else:
  print(1)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
 
l = [int(x) for x in input().split()]

if l[0] == 1 or l[1] == 1:
  print(1)
else:
  print(math.ceil((l[0]*l[1])/2))

Submission status: Accepted

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

Submission status: Accepted

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

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:
HW = list(map(int,input().split()))
if all(x%2==1 for x in HW) and HW[0]>1 and HW[1]>1:
    print(int((HW[0]*HW[1]+1)/2))
elif HW[0] == 1 or HW[1] == 1:
    print(1)
else:
    print(int((HW[0]*HW[1])/2))

Submission status: Accepted

Solution code:
import sys
import math
input = sys.stdin.readline

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

Submission status: Accepted

Solution code:
def main(h, w):
    ans = 0

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


if __name__ == "__main__":
    h, w = map(int, input().split())

    main(h, w)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

if min(H,W) == 1:
    print(1)
else:
    print(-(-H*W//2))

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if h == 1 or w == 1:
    print(1)
else:
    hc = (w+1) // 2
    hc2 = w // 2
    d, m = divmod(h, 2)
    ans = d * (hc + hc2) + m * hc
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import 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:
H,W = map(int,input().split())
#print(H)
ans = 1


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

Submission status: Accepted

Solution code:
num = input().split(" ")
if "1" in num:
  print(1)
else:
	gu = int(num[1]) // 2
	ki = int(num[1]) - int(gu)
	gu2 = int(num[0]) // 2
	ki2 = int(num[0]) - int(gu2)
	print(gu * gu2 + ki * ki2)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math

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

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

print(bishop())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/python3
Height, Width = map(int,input().split())
masu = Height * Width 
if Height == 1 or Width == 1:
    print(1)
elif masu % 2 == 0:
    print(masu // 2)
else:
    print(masu // 2 + 1)

Submission status: Accepted

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

if (H!=1)and(W!=1):
    print(ceil((H*W)/2))
else:
    print("1")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
from sys import stdin
from operator import itemgetter

# stdin = open("sample.txt")

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():

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

    total = H * W

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

    else:
        if total % 2 == 0:
            print(int(total/2))

        else:
            print(int((total+1)/2))

    return

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

from sys import stdin, stderr

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

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

   print(res)

   return 0

if __name__ == '__main__': 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:
import math

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#import math
H,W=(int(x) for x in input().split())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
h, w = [int(i) for i in input().split()]
if h == 1 or w == 1:
    print(1)
else:
    n = h*w/2
    print(Decimal(n).quantize(Decimal('0'), rounding=ROUND_HALF_UP))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

# A = [list(map(int, input().split())) for _ in range(3)]
# k = int(input())
# B = [int(input()) for _ in range(n)]
# X = list(map(int, input().split()))
h, w = map(int, input().split())
print(1) if min(h, w) == 1 else print(math.ceil((h*w)/2))

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#B
HW = input().split(' ')
H = int(HW[0])
W = int(HW[1])
if H == 1 or W == 1:
    print(1)
elif H % 2 == 0 and W % 2 == 0:
    print(int((W / 2) * H))
elif H % 2 == 1 and W % 2 == 1:
    print(int(W * (H // 2) + W // 2 + 1))
elif H % 2 == 1 and W % 2 ==0:
    print(int((W / 2)* H))
else:
    print(int((H / 2)* W))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
h,w = map(int,input().split())
#h 縦
#w 横
if w == 1 or h == 1 :
    print("1")
elif (h * w ) % 2 == 0:
    result = h * w /2
    result = math.ceil(result)
    print(str(result))
elif (h * w )% 2 != 0:
    result = ((h * w) // 2 )+ 1
    result = math.ceil(result)
    print(str(result))

Submission status: Accepted

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

Submission status: Accepted

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

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


odd_count = (h + 1) // 2
even_count = h // 2

print(odd * odd_count + even * even_count if h > 1 and w > 1 else 1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
H,W = map(int,input().split())
def ceil(n): # ceiling関数
    if n > int(n):
        return(int(n)+1)
    else:
        return(int(n))
if H==1 or W==1:
    print(1)
else:
    print(ceil(H*W/2))

Submission status: Accepted

Solution code:
import sys
H,W=map(int,input().split())
area=H*W
if H==1 or W==1:
  print("1")
  sys.exit()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
H,W=map(int,input().split())
sum=0
# for i in range(H):
#     for j in range(W):
#         if (i-j)%2==0:
#             sum+=1
if H==1 or W==1:
    print(1)
else:
    sum=(H*W)/2
    print(math.ceil(sum))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
 
input = sys.stdin.readline
H, W = list(map(int,input().split()))
 
if H==1 or W==1:
    print(1)
    exit(0)

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

Submission status: Accepted

Solution code:
var = [int(s) for s in input().split()]

ans = int(var[0]*var[1] / 2 +0.6)

if var[0]==1 or var[1]==1:
    ans = 1

print(ans)

Submission status: Accepted

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

import math

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

Submission status: Accepted

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

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

print(a)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

HW = H * W
HW2 = HW // 2

if H == 1 or W == 1:
    ans = 1
else:
    if HW % 2 == 0:
        ans = HW2
    else:
        ans = HW2 + 1

print(ans)

Submission status: Accepted

Solution code:
import math as m

h, w = map(int, input().split())
print(1 if h == 1 or w == 1 else m.ceil(h * w / 2))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def scanf(scanstr,data_format):
    scanstr=scanstr.split(" ")
    if(type(data_format) is not list):
        print("data_format error")
    if(len(scanstr)!=len(data_format)):
        print("Error")
        return -1
    j=0
    for kata in data_format:
        if(kata=="str"):
            scanstr[j]=str(scanstr[j])
        if(kata=="int"):
            scanstr[j]=int(scanstr[j])
        j=j+1
    return scanstr
data=scanf(input(),["int","int"])
if data[0]==1 or data[1]==1:
    print(1)
elif (data[0]*data[0])%2==0:
    print(str(round((data[0]*data[1])/2)))
else:
    print(str(round((data[0]*data[1]+1)/2)))

Submission status: Accepted

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

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

Submission status: Accepted

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

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

temp=-(-H//2)

print(temp*(W%2)+H*(W//2))

Submission status: Accepted

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

if H%2==0:
    Ha="even"
else:
    Ha="odd"

if W%2==0:
    Wa="even"
else:
    Wa="odd"

if H==1 or W==1:
    print(1)
elif Ha=="even"or Wa=="even":
    print(math.floor(H*W/2))
else:
    print(math.floor(H*W/2+0.5))