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:
#gcdは3.4.3だとfractionsにある
from fractions import gcd
import math

from math import factorial as f

from math import ceil,floor,sqrt


import bisect
import re
import heapq


from copy import deepcopy
import itertools

from sys import exit

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

yes = "Yes"
no = "No"




def main():
    a,b,c = mi()
    if c-a-b<=0:
        print(no)
        exit()
    else:
        if (c-a-b)**2 > 4*a*b:
            print(yes)#gcdは3.4.3だとfractionsにある
from fractions import gcd
import math

from math import factorial as f

from math import ceil,floor,sqrt


import bisect
import re
import heapq


from copy import deepcopy
import itertools

from sys import exit

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

yes = "YES"
no = "NO"




def main():
    a,b = mi()
    if a == 1 or b == 1:
        print(1)
        exit()
    ans = 0
    ans+=((a+1)//2)*((b+1)//2)
    ans+=(a//2)*(b//2)
    print(ans)

        
    


main()

Submission status: Accepted

Solution code:
from math import ceil

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

Submission status: Accepted

Solution code:
from math import *

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:
A, B = 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 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:
a,b=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 = [int(i) for i in input().split()]
if H != 1 and W != 1:
    N = H*W
    if N % 2 == 1:
        N-=1
        print(N//2 + 1)
        exit()
    if N%2 ==0:
        print(N//2)
else:
    print(1)

Submission status: Accepted

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

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

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

a = h * w

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    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)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = (w // 2 + w % 2) * (h // 2 + h % 2) + (w // 2) * (h // 2)

if w == 1 or h == 1:
    print(1)
else:
    print(ans)

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:
import sys
sys.setrecursionlimit(100000)

def ins(): return input().split()
def ii(): return int(input())
def iil(): return list(map(int, ins()))
def lin(): return list(input())
def iin(): return map(int, ins())

h,w = iin()
if h==1 or w==1:
    res = 1
else:
    s1 = (h+1)//2
    s2 = h//2
    if w%2==0:
        res = s1 * (w//2) + s2 * (w//2)
    else:
        res = s1 * (w // 2 + 1) + s2 * (w // 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 and w%2:
    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:
    print("1")
    exit()

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

A = (H * W + 1) // 2

if H == 1 or W == 1:
    A = 1

print(A)

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

Submission status: Accepted

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

a=max(h)
b=min(h)
ans=0
if a%2==0:
    ans=a*b/2
else:
    ans+=(a-1)*b/2
    ans+=(b+1)//2

if b==1:ans=1
print(int(ans))

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

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

if n == 1 or m == 1:
    print(1)
else:
    print( - (-n*m//2)  )

Submission status: Accepted

Solution code:
import sys

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


A = H*W

print(-(-A//2))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, math
def input():
    return sys.stdin.readline()[:-1]
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial
from bisect import bisect_left #bisect_left(list, value)
#from fractions import gcd
enu = enumerate

sys.setrecursionlimit(10**7)
H, W = map(int, input().split())

al = H*W // 2

if H==1 or W==1:
    print(1)
elif H%2==1 and W%2==1:
    print(al+1)
else:
    print(al)

Submission status: Accepted

Solution code:
h, w = map(int, input().split())
if h == 1 or w == 1:
  print(1)
else:
  print(h // 2 * w + h % 2 * ((w + 1) // 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:
# from fractions import gcd
# from datetime import date, timedelta
# from heapq import *
# import heapq
# import math
# from collections import defaultdict, Counter, deque
# from bisect import *
# import itertools
# import fractions
# # import sys
# sys.setrecursionlimit(10 ** 7)
# MOD = 10 ** 9 + 7
# input = sys.stdin.readline


# def lcm(a, b):
#     return a * b / fractions.gcd(a, b)


# def make_divisors(n):
#     divisors = []
#     for i in range(1, int(n**0.5)+1):
#         if n % i == 0:
#             divisors.append(i)
#             if i != n // i:
#                 divisors.append(n//i)

#     # divisors.sort()
#     return divisors


# def factorize(n):
#     fct = []  # prime factor
#     b, e = 2, 0  # base, exponent
#     while b * b <= n:
#         while n % b == 0:
#             n = n // b
#             e = e + 1
#         if e > 0:
#             fct.append((b, e))
#         b, e = b + 1, 0
#     if n > 1:
#         fct.append((n, 1))
#     return fct


# def is_prime(n):
#     if n == 1:
#         return False

#     for k in range(2, int(math.sqrt(n)) + 1):
#         if n % k == 0:
#             return False

#     return True


# def primes(n):
#     is_prime = [True] * (n + 1)
#     is_prime[0] = False
#     is_prime[1] = False
#     for i in range(2, int(n**0.5) + 1):
#         if not is_prime[i]:
#             continue
#         for j in range(i * 2, n + 1, i):
#             is_prime[j] = False
#     return [i for i in range(n + 1) if is_prime[i]]

# def modpow(a, n, mod):
#     res = 1
#     while n > 0:
#         if n & 1:
#             res = res * a % mod
#         a = a * a % mod
#         n >>= 1
#     return res


# def modinv(a, mod):
#     return modpow(a, mod - 2, mod)


# def cnk(a, b):
#     MOD = 10**9+7
#     ret = 1
#     for i in range(b):
#         ret *= (a-i)
#         ret %= MOD
#         ret = ret * modinv(i+1, MOD) % MOD
#     return ret


# class UnionFind:
#     def __init__(self, n):
#         self.sz = [-1 for i in range(n)]

#     # 検索
#     def find(self, x):
#         if self.sz[x] < 0:
#             return x
#         else:
#             self.sz[x] = self.find(self.sz[x])
#             return self.sz[x]

#     # 併合
#     def union(self, x, y):
#         x = self.find(x)
#         y = self.find(y)
#         if x == y:
#             return False
#         if self.sz[x] > self.sz[y]:
#             x, y = y, x
#         self.sz[x] += self.sz[y]
#         self.sz[y] = x

#     # 同じ集合に属するか判定
#     def same(self, x, y):
#         return self.find(x) == self.find(y)

#     # xが含まれている集合のサイズを求める
#     def size(self, x):
#         return -self.sz[self.find(x)]

# class WeightedUnionFind:
#     def __init__(self, n):
#         self.par = [i for i in range(n+1)]
#         self.rank = [0] * (n+1)
#         # 根への距離を管理
#         self.weight = [0] * (n+1)

#     # 検索
#     def find(self, x):
#         if self.par[x] == x:
#             return x
#         else:
#             y = self.find(self.par[x])
#             # 親への重みを追加しながら根まで走査
#             self.weight[x] += self.weight[self.par[x]]
#             self.par[x] = y
#             return y

#     # 併合
#     def union(self, x, y, w):
#         rx = self.find(x)
#         ry = self.find(y)
#         # xの木の高さ < yの木の高さ
#         if self.rank[rx] < self.rank[ry]:
#             self.par[rx] = ry
#             self.weight[rx] = w - self.weight[x] + self.weight[y]
#         # xの木の高さ ≧ yの木の高さ
#         else:
#             self.par[ry] = rx
#             self.weight[ry] = -w - self.weight[y] + self.weight[x]
#             # 木の高さが同じだった場合の処理
#             if self.rank[rx] == self.rank[ry]:
#                 self.rank[rx] += 1

#     # 同じ集合に属するか
#     def same(self, x, y):
#         return self.find(x) == self.find(y)

#     # xからyへのコスト
#     def diff(self, x, y):
#         return self.weight[x] - self.weight[y]


class manacher:

    def __init__(self, l):
        self.n = len(l)
        self.m = 2*self.n+1
        self.d = ['&']*self.m
        self.r = [0]*self.m
        for i in range(self.n):
            self.d[2*i+1] = l[i]
        self.make_r()

    def make_r(self):
        i, j = 0, 0
        while i < self.m:
            while j <= i < self.m-j and self.d[i-j] == self.d[i+j]:
                j += 1
            self.r[i] = j
            k = 1
            while k <= i < self.m-k and k+self.r[i-k] < j:
                self.r[i+k] = self.r[i-k]
                k += 1
            i += k
            j -= k

    def judge(self, start, end):
        center = start+end
        return 2 * end - 1 < center + self.r[center]


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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input=lambda: sys.stdin.readline().rstrip()
h,w=map(int,input().split())
ans=((h+1)//2+h//2)*(w//2)
if w%2==1:
  ans+=(h+1)//2
if h==1 or w==1:
  ans=1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

H, W = LI()

ans = 0

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

#整数値龍力　複数の入力
def input_multiple_number():
    return map(int, input().split())

h,w = input_multiple_number()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
h,w = map(int,input().split())
if h == 1 or w == 1:
    print(1)
    exit()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

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

Submission status: Accepted

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

Submission status: Accepted

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

if w == 1 or h == 1:
    print(1)
else:
    print(math.ceil(w*h/2))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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


def solve(H: int, W: int):
    if H > 1 and W > 1:
        print(W // 2 * H + (H // 2 + H % 2) * (W % 2))
    else:
        print(1)


# 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: Accepted

Solution code:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**9)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

h,w = na()

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b = 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 or W == 1:
    print(1)
elif W % 2 == 0:
    W //= 2
    print(H * W)
else:
    W //= 2
    W += 1
    print((H + 1) // 2 * W + H // 2 * (W - 1))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

H, W = list(map(int, sys.stdin.buffer.readline().split()))

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

h1 = (H + 1) // 2
h2 = H // 2
w1 = (W + 1) // 2
w2 = W // 2
ans = h1 * w1 + h2 * w2
print(ans)

Submission status: Accepted

Solution code:
import sys
import math
h, w = map(int, sys.stdin.readline().split())

ans = math.ceil(h*w/2) if h != 1 and w != 1 else 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import os
import math


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    H, W = list(map(int, sys.stdin.readline().split()))

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

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 S(): return input()
     
def main():
    H, W = LI()
    if H == 1 or W == 1:
        print(1)
        return
    if H * W % 2 > 0:
        cnt = (H * W + 1) // 2
    else:
        cnt = H*W//2
    print(cnt)

main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import itertools
input = sys.stdin.readline
sys.setrecursionlimit(100000)


def read_values():
    return map(int, input().split())


def read_index():
    return map(lambda x: x - 1, map(int, input().split()))


def read_list():
    return list(read_values())


def read_lists(N):
    return [read_list() for n in range(N)]


def functional(N, mod):
    F = [1] * (N + 1)
    for i in range(N):
        F[i + 1] = (i + 1) * F[i] % mod
    return F


def main():
    H, W = read_values()
    if H == 1 or W == 1:
        print(1)
    else:
        print((H * W + 1) // 2)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

c1 = (h + 1) // 2
c2 = h - c1

w1 = (w + 1) // 2
w2 = w - w1
if h == 1 or w == 1:
  print(1)
else:
  print(c1 * w1 + c2 * w2)

Submission status: Accepted

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

if a == 1 or b == 1:
    print(1)
    exit()

res = b * (a // 2)
if a % 2 == 1:
    res += (b + 1) // 2
print(res)