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:
#!/usr/bin/env python3

import sys
from typing import Any, Callable, Deque, Dict, List, Mapping, Optional, Sequence, Set, Tuple, TypeVar, Union
# import time
# import math
# import numpy as np
# import scipy.sparse.csgraph as cs            # csgraph_from_dense(ndarray, null_value=inf), bellman_ford(G, return_predecessors=True), dijkstra, floyd_warshall
# import random                                # random, uniform, randint, randrange, shuffle, sample
# import string                                # ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from datetime import date, datetime          # date.today(), date(year,month,day) => date obj; datetime.now(), datetime(year,month,day,hour,second,microsecond) => datetime obj; subtraction => timedelta obj
# from datetime.datetime import strptime       # strptime('2019/01/01 10:05:20', '%Y/%m/%d/ %H:%M:%S') returns datetime obj
# from datetime import timedelta               # td.days, td.seconds, td.microseconds, td.total_seconds(). abs function is also available.
# from copy import copy, deepcopy              # use deepcopy to copy multi-dimentional matrix without reference
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from fractions import Fraction               # Fraction(a, b) => a / b ∈ Q. note: Fraction(0.1) do not returns Fraciton(1, 10). Fraction('0.1') returns Fraction(1, 10)



def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79e+308
    # inf = 2 ** 63 - 1             # (for fast JIT compile in PyPy) 9.22e+18
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def isp():   return input().split()
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    h, w = mi()
    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 - 1) // 2 + (h + 1) // 2)


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 or w == 1:
    print(1)
else:
    print(math.ceil(h*w/2))

Submission status: Accepted

Solution code:
import math

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
h, w = [int(w) for w 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())

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

Submission status: Accepted

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

Submission status: Accepted

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

if H == 1 or W == 1:
    Ans=1
else:
    if H*W%2 == 0:#マス目の合計が偶数なら
        Ans=H*W/2
    else:#マス目の合計が奇数なら
        Ans=H*W//2+1

print(round(Ans))

Submission status: Accepted

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

A=[0,math.ceil(W/2)]
if (H-1)*(W-1)!=0:
  c=W*math.floor(H/2)+A[H%2]
else:
  c=1
print(c)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

def main(h,w):
    if (h==1 or w==1):
        return 1
    if w%2==0:
        yoko1=w//2
        yoko2=yoko1
    else:
        yoko1=w//2+1
        yoko2=yoko1-1
    if h%2==0:
        tate=h//2
        return (yoko1+yoko2)*tate
    else:
        tate=h//2
        return (yoko1+yoko2)*tate+yoko1

if __name__=='__main__':
    h,w=readinput()
    ans=main(h,w)
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

if min(H, 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)//2+1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
H,W = [int(x) for x in stdin.readline().rstrip().split()]
#print(H,W)

#1,3,5...行目で塗れるマス
n_odd = (1+W)//2
#2.4,6...行目で塗れるマス
n_even = W//2

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


if H%2 == 0:
  ans = int((n_odd + n_even) * (H/2))
else:
  ans = int((n_odd + n_even) * (H-1)/2 + n_odd)

print(ans)

Submission status: Accepted

Solution code:
import math

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

ans=h*(w//2)

if w%2==1:
  ans+=(h+2-1)//2


print(ans)

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

from math import ceil
H, W = mapint()
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)
    exit()

if H %2 == 0:
    tate = H/2
    ans = tate * W

else:
    tate1 = H // 2 + 1
    tate2 = H // 2
    if W % 2 == 0:
        ans = (tate1 + tate2) * W/2
    else:
        ans = tate1*((W//2)+1) + tate2*(W//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 w%2==0: a = w//2
else: a = w//2+1

print(w*(h//2) if h%2==0 else w*(h//2)+a)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b=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:
H,W=map(int,input().split())
if (H==1)|(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:
h,w = map(int,input().split())


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

Submission status: Accepted

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

import math
from decimal import *

def main():
    h,w = map(int, input().split())
    if h == 1:
        print(1)
        exit()
    elif w ==1:
        print(1)
        exit()
    else:
        print(math.ceil(h*w/2))

if __name__ == '__main__':
    main()

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:
import sys
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(rs())
def rs_(): return [_ for _ in rs().split()]
def ri_(): return [int(_) for _ in rs().split()]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main(H, W):
    if H == 1 or W == 1:
        return 1
    return -(-H * W // 2)


if __name__ == "__main__":
    H, W = map(int, input().split())
    ans = main(H, W)
    print(ans)

Submission status: Accepted

Solution code:
def main(H, W):
    if H == 1 or W == 1:
        return 1
    od = -(-W // 2)
    ev = W // 2
    ans = (od + ev) * (H // 2)
    if H % 2 == 1:
        ans += od
    return ans


if __name__ == "__main__":
    H, W = map(int, input().split())
    ans = main(H, W)
    print(ans)

Submission status: Accepted

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

ansew = x * y

if x == 1 or y == 1:
    print(1)
elif ansew % 2 == 0:
    print(int(ansew / 2))
else:
    print(int(ansew / 2 + 1))

Submission status: Accepted

Solution code:
def main():
    H,W = map(int,input().split())
    N = H*W
    #print(N//2)

    if H == 1 or W == 1:
        return 1
    elif N%2 == 0:
        ans = int(N/2)
    else:
        ans = int((N//2) + 1)

    return ans

print(main())

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math
h,w = map(int,input().split())
w1 = int(w/2)
h1 = int(h/2)
w2 = int(w/2)
h2 = int(h/2)
if ( w % 2 != 0 ):
  w1 += 1
if ( h % 2 != 0 ):
  h1 += 1
res = h1 * w1 + h2 * w2
if (h == 1 or w == 1):
  print(1)
else:
  print(res)

Submission status: Accepted

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

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] = list(map(int,input().split(' ')))
K = int((H*W+1)*0.5)
if H==1 or W==1:print(1)
else:print(K)

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

Submission status: Accepted

Solution code:
# template by 3xC and starkizard.
# contributors: 

#####################################################################################
from __future__ import division, print_function 

import sys
import os
from collections import Counter, deque, defaultdict
import itertools
import math
import io


"""Uncomment modules according to your need"""


# from bisect import bisect_left, bisect_right, insort
# from heapq import heappop, heapify, heappush
# from random import randint as rn
# from Queue import Queue as Q
# from copy import deepcopy
# from decimal import *
# import re
# import operator

#####################################################################################
# this enables you to write python3 code with PyPy2 (Python 2)
if sys.version_info[0] < 3:
    input = raw_input
    range = xrange

    filter = itertools.ifilter
    map = itertools.imap
    zip = itertools.izip

#####################################################################################

"""value of mod"""
MOD = 998244353
mod = 10**9 + 7

"""Uncomment next 4 lines if doing huge recursion"""
# import threading
# threading.stack_size(1<<27)
# sys.setrecursionlimit(10000

def prepare_factorial(mod=mod):
    """ returns two lists, factorial and inverse factorial modulo argument by default 10**9 +7 """
    # Comment code out when you don't need inverse factorial or vice versa
    fact = [1]
    for i in range(1, 200005):
        fact.append((fact[-1] * i) % mod)

    ifact = [0] * 200005
    ifact[200004] = pow(fact[200004], mod - 2, mod)
    for i in range(200004, 0, -1):
        ifact[i - 1] = (i * ifact[i]) % mod
 
    return fact, ifact

def modinv(n, p):
    """ returns N inverse modulo p """
    return pow(n, p - 2, p)
 
def ncr(n, r,  fact, ifact):
    """ takes 4 arguments: n , r and factorial and inverse factorial lists"""
    t = (fact[n] * (ifact[r]*ifact[n-r]) % MOD)% MOD
    return t


def get_n(Sum):    
    """this function returns the maximum n for which Summation(n) <= Sum"""
    ans = (-1 + sqrt(1 + 8*Sum))//2
    return ans

def sieve(n):
    """ returns a list of prime numbers till n """
    if n < 2: return list()
    prime = [True for _ in range(n + 1)]
    p = 3
    while p * p <= n:
        if prime[p]:
            for i in range(p * 2, n + 1, p):
                prime[i] = False
        p += 2
    r = [2]
    for p in range(3, n + 1, 2):
        if prime[p]:
            r.append(p)
    return r



def divs(n, start=1):
    """ returns a list of all divisors till n """
    divisors = []
    for i in range(start, int(math.sqrt(n) + 1)):
        if n % i == 0:
            if n / i == i:
                divisors.append(i)
            else:
                divisors.extend([i, n // i])
    return divisors



def divn(n, primes):
    """ returns the number of divisors, two arguments n and the sieve till n """
    divs_number = 1
    for i in primes:
        if n == 1:
            return divs_number
        t = 1
        while n % i == 0:
            t += 1
            n //= i
        divs_number *= t



def lrfind(d, x, default=-1):
    """ Takes 2 arguments an iterable and an element. returns a tuple (firstoccurence,lastoccurence) -1 if not found """
    left = right = -1
    for i in range(len(d)):
        if d[i] == x:
            if left == -1: left = i
            right = i
    if left == -1:
        return default, default
    else:
        return left, right

def gcd(x, y): # math.gcd is slower
    """ returns greatest common divisor of x and y """
    while y:
        x, y = y, x % y
    return x

def ceil(n, k=1): return n // k + (n % k != 0) #returns math.ceil but protecting against floating inconsistencies
def input(): return sys.stdin.readline().strip()
def ii(): return int(input()) #inputs integer
def mi(): return map(int, input().split()) # inputting space seperated variables for example x,y,z
def li(): return list(map(int, input().split())) #inputting a space seperated list of integers
def lw(): return input().split() #inputting a space seperated list of strings
def lcm(a, b): return abs(a * b) // gcd(a, b) #returns LCM of two arguments
def prr(a, sep=' ', end='\n'): print(sep.join(map(str, a)), end=end) #For printing an iterable with seperator sep as optional second argument (default : " "), ending character (default: "\n") as optional third
def dd(): return defaultdict(int) #returns a dictionary with values defaulted to 0
def ddl(): return defaultdict(list) #returns a dictionary with values defaulted to []
def write(s): return sys.stdout.write(s)












###################################################################
def main():
    #CODE GOES HERE:
    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 + 1)//2)















































""" -------- Python 2 and 3 footer by Pajenegod and c1729 ---------"""
 
py2 = round(0.5)
if py2:
    from future_builtins import ascii, filter, hex, map, oct, zip
    range = xrange
 
import os, sys
from io import IOBase, BytesIO
 
BUFSIZE = 8192
 
class FastIO(BytesIO):
    newlines = 0
 
    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None
 
    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
        return s
 
    def read(self):
        while self._fill(): pass
        return super(FastIO, self).read()
 
    def readline(self):
        while self.newlines == 0:
            s = self._fill();
            self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()
 
    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)
 
 
class IOWrapper(IOBase):
 
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            self.write = lambda s: self.buffer.write(s.encode('ascii'))
            self.read = lambda: self.buffer.read().decode('ascii')
            self.readline = lambda: self.buffer.readline().decode('ascii')
 
 
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip('\r\n')
# sys.stdin = open('input.txt', 'r')
# sys.stdout = open('output.txt', 'w')
 
""" main function"""
 
if __name__ == '__main__':
    main()
    # threading.Thread(target=main).start()

Submission status: Accepted

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

Submission status: Accepted

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


resolve()

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

Submission status: Accepted

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

Submission status: Accepted

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


ans = (H // 2) * (W // 2) + (-(-H // 2)) * (-(-W // 2))

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

print(ans)

Submission status: Accepted

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

h = H // 2
w = W // 2

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

import sys
from collections import defaultdict, deque
from heapq import heappush, heappop
import math
import bisect
input = sys.stdin.readline

# 再起回数上限変更
# sys.setrecursionlimit(1000000)

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()
    h,w = map(int, input().split())
    n = h*w
    if h == 1 or w ==1:
        print(1)
    elif n%2 == 0:
        print(n//2)
    else:
        print(n//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:
  if 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())

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

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

Submission status: Accepted

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

if h==1 or w==1:
    print(1)
else:
    q,r = divmod(h*w, 2)
    print(q+r)

Submission status: Accepted

Solution code:
# B - Bishop

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:
# B - Bishop

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

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

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

Submission status: Accepted

Solution code:
h, w = map(int, input().split())
import math
if h == 1 or w == 1:
  print(1)
  
elif h%2 == 0 and w%2 == 0:
  print(h * w // 2)
  
elif h%2 == 0 or w%2 == 0:
  if h%2 == 0:
    we = w//2
    wo = math.ceil(w/2)
    print(we * h//2 + wo * h//2)
    
  else:
    he = h//2
    ho = math.ceil(h/2)
    print(ho * w//2 + he * w//2)

else:
  	# odd
	we = w//2
	wo = math.ceil(w/2)
	he = h//2
	ho = math.ceil(h/2)
	print(ho * wo + he * we)

Submission status: Accepted

Solution code:
def resolve():
    H, W = list(map(int, input().split()))
    ans = 0
    if (H == 1 or W == 1):
        print(1)
        return
    if H % 2 == 1:
        even = (H // 2) + 1
    else:
        even = (H // 2)

    odd = H - even

    if W % 2 == 1:
        ans += even * (W // 2 + 1)
    else:
        ans += even * (W // 2)

    ans += odd * (W // 2)

    print(ans)

    return
 
resolve()

Submission status: Accepted

Solution code:
def resolve():
    H, W = list(map(int, input().split()))
    if H == 1 or W == 1:
        print(1)
        return

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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