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:
"""
Author    : co_devil Chirag Garg
Institute : JIIT
"""
from math import log, ceil
from collections import defaultdict
from math import *
from sys import stdin, stdout
import itertools
import os
import sys
import threading
from collections import deque, Counter, OrderedDict, defaultdict
from heapq import *
# from math import ceil, floor, log, sqrt, factorial, pow, pi, gcd
# from bisect import bisect_left,bisect_right
# from decimal import *,threading
from fractions import Fraction
mod = int(pow(10, 9)+7)


def ii(): return int(input())


def si(): return str(input())


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


def li(): return list(mi())


def fii(): return int(stdin.readline())


def fsi(): return str(stdin.readline())


def fmi(): return map(int, stdin.readline().split())


def fli(): return list(fmi())


abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12,
       'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24,
       'z': 25}


def getKey(item): return item[0]


def sort2(l): return sorted(l, key=getKey)


def d2(n, m, num): return [[num for x in range(m)] for y in range(n)]


def isPowerOfTwo(x): return (x and (not (x & (x - 1))))


def decimalToBinary(n): return bin(n).replace("0b", "")


def ntl(n): return [int(i) for i in str(n)]


def powerMod(x, y, p):
    res = 1
    x %= p
    while y > 0:
        if y & 1:
            res = (res * x) % p
        y = y >> 1
        x = (x * x) % p
    return res


graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000


def bfs(d, v):
    q = []
    q.append(v)
    visited[v] = 1
    while len(q) != 0:
        x = q[0]
        q.pop(0)
        for i in d[x]:
            if visited[i] != 1:
                visited[i] = 1
                q.append(i)
        print(x)


def make_graph(e):
    d = {}
    for i in range(e):
        x, y = mi()
        if x not in d:
            d[x] = [y]
        else:
            d[x].append(y)
        if y not in d:
            d[y] = [x]
        else:
            d[y].append(x)
    return d


def gr2(n):
    d = defaultdict(list)
    for i in range(n):
        x, y = mi()
        d[x].append(y)
    return d


def connected_components(graph):
    seen = set()

    def dfs(v):
        vs = set([v])
        component = []
        while vs:
            v = vs.pop()
            seen.add(v)
            vs |= set(graph[v]) - seen
            component.append(v)
        return component

    ans = []
    for v in graph:
        if v not in seen:
            d = dfs(v)
            ans.append(d)
    return ans


def primeFactors(n):
    s = set()
    while n % 2 == 0:
        s.add(2)
        n = n // 2
    for i in range(3, int(sqrt(n)) + 1, 2):
        while n % i == 0:
            s.add(i)
            n = n // i
    if n > 2:
        s.add(n)
    return s


def find_all(a_str, sub):
    start = 0
    while True:
        start = a_str.find(sub, start)
        if start == -1:
            return
        yield start
        start += len(sub)


def SieveOfEratosthenes(n, isPrime):
    isPrime[0] = isPrime[1] = False
    for i in range(2, n):
        isPrime[i] = True
    p = 2
    while (p * p <= n):
        if (isPrime[p] == True):
            i = p * p
            while (i <= n):
                isPrime[i] = False
                i += p
        p += 1
    return isPrime


def dijkstra(edges, f, t):
    g = defaultdict(list)
    for l, r, c in edges:
        g[l].append((c, r))

    q, seen, mins = [(0, f, ())], set(), {f: 0}
    while q:
        (cost, v1, path) = heappop(q)
        if v1 not in seen:
            seen.add(v1)
            path = (v1, path)
            if v1 == t:
                return (cost, path)

            for c, v2 in g.get(v1, ()):
                if v2 in seen:
                    continue
                prev = mins.get(v2, None)
                next = cost + c
                if prev is None or next < prev:
                    mins[v2] = next
                    heappush(q, (next, v2, path))
    return float("inf")


def binsearch(a, l, r, x):
    while l <= r:
        mid = l + (r-1)//2
        if a[mid]:
            return mid
        elif a[mid] > x:
            l = mid-1
        else:
            r = mid+1
    return -1


def dfs(d, v):
    q = []
    q.insert(0, v)
    visited[v] = 1
    while len(q) != 0:
        x = q[0]
        q.pop(0)
        for i in d[x]:
            if visited[i] != 1:
                visited[i] = 1
                q.insert(0, i)
        print(x)


n, m = mi()

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

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
mid = a * b - a * b // 2 
if a == 1 or b == 1:
	print(1)
	exit()
print(mid)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
h,w = map(int,input().split())
ans = 0
a1 = -(-w//2)

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
h, w = map(int, input().split())

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
[h, w] = input().split()

h = int(h)
w = int(w)

if h == 1 or w == 1:
    print(1)
else:
    if(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())
ans = (H*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 1 in [h,w]:
    print(1)
else:
    print(-(-h//2)*(-(-w//2))+(h//2)*(w//2))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():
    H, W = list(map(int, input().split()))
    if min(H, W) == 1:
        return 1

    return (H * W + 1) // 2


print(main())

Submission status: Accepted

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

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:
from math import ceil
h, w = map(int, input().split())
if min(h,w) <= 1:
    print(1)
    exit()

print(ceil(h * w / 2))

Submission status: Accepted

Solution code:
h, w = list(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:
h,w=[int(j) for j in input().split()]
if h==1 or w==1:
    print(1)
elif h%2==0:
    print(h*w//2)
else:
    if w%2==0:
        print(h*w//2)
    else:
        print((h*w+1)//2)

Submission status: Accepted

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

Submission status: Accepted

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

if H==1 and W==1:
    print('1')
elif 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==1 and 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*w+1)//2)

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def examA():
    L = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
    K = I()

    ans = L[K-1]
    print(ans)
    return

def examB():
    H, W = LI()
    if H==1 or W==1:
        print(1)
        return
    ans = H*W//2 + (H*W)%2
    print(ans)
    return

def examC():
    a,b,c = LI()
    if c-(a+b)<=0:
        print("No")
        return
    judge = (c-a-b)**2-4*a*b
    if judge>0:
        print("Yes")
    else:
        print("No")
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**6)

if __name__ == '__main__':
    examB()

"""

"""

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
import queue
import copy
import bisect
import heapq


def dfs(s, prev, pre):
  val[s] += Ope[s] + prev
  for i in G[s]:
    if(i == pre):
      continue
    dfs(i, val[s], s)

def bfs(sx, sy, n):
  que = deque([[sy,sx]])
  while que:
    y,x = que.popleft()
    for i,j in D:
      if(x+i<0 or y+j<0 or x+i>W-1 or y+j>H-1):
        continue
      dist = G[y+j][x+i]
      if(G[y+j][x+i] != "X"):
        if(type(G[y+j][x+i]) is str):
          G[y+j][x+i] = G[y][x]+1
          que.append([y+j,x+i])
        elif(dist>G[y][x]+1):
          G[y+j][x+i] = G[y][x]+1
          que.append([y+j,x+i])
        

#X = str(input()).split()
#a = [int(x) for x in input().split()]
#sys.setrecursionlimit(10**7)
#N, Q = map(int, input().split())
#G = [list(input()) for i in range(H)]
#V, E, r = map(int, input().split())
#INF = V * 10001

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

ans = H*W

if(ans%2==0):
  ans = ans/2
else:
  ans = math.ceil(ans/2)

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

print(int(ans))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
import copy
import queue
input = sys.stdin.readline
def LI(): return [int(x) for x in input().split()]

H,W = LI()

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

Submission status: Accepted

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

if w * h % 2 == 1 : ans += 1

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

print(ans)

Submission status: Accepted

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


def main():
    H, W = map(int, input().split())
    if H == 1 or W == 1:
        print(1)
        exit(0)
    print(-(-H * W // 2))


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

ans = math.ceil(h*w/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)
    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=map(int,input().split())
if min(h,w)!=1:
    if (h * w) % 2 == 0:
        print((h * w) // 2)
    else:
        print((h * w + 1) // 2)
else:
    print(1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

m=h//2
ans=0

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

num=w//2
ans+=num*h
if w%2==1:
  ans+=h-m
'''
for i in range(w):
  if i%2==0:
    ans+=h-m
  else:
    ans+=m
'''
print(ans)

Submission status: Accepted

Solution code:
import math
H, W = [int(i) for i in input().split()]
print(math.ceil(H/2)*math.ceil(W/2)+(H//2)*(W//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:
    if (H*W)%2:
        print(int(H*W/2)+1)
    else:
        print(int(H*W/2))

Submission status: Accepted

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

Submission status: Accepted

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

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
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

if H > W:
    H,W = W,H

if H == 1:
    print(1)
else:
    N = H * W
    print((N+1)//2)

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
def main():
    H, W = (int(i) for i in input().split())
    if H == 1 or W == 1:
        return print(1)
    li = (W+1)//2
    ro = ((H+1)//2)
    print(li*ro + (W//2)*(H//2))


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

odd_c = int(math.ceil(W / 2))
even_c = W // 2

odd_r = int(math.ceil(H / 2))
even_r = H // 2

print(odd_c * odd_r + even_c * even_r)

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()

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:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(H: int, W: int):
    if H == 1 or W == 1:
        print(1)
        exit()

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



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

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

Submission status: Accepted

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

masu = h * w

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

Submission status: Accepted

Solution code:
h, w = (int(x) for x in input().split())
if h == 1:
    ans = 1
elif w == 1:
    ans = 1
else:
    ans = h*w >> 1
    if (h*w) % 2 == 1:
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
from collections import deque
def main():
    
    h,w = tuple([int(t)for t in input().split()])

    t = 1
    if h!=1 and w !=1:
        t = h*w//2+(h*w)%2
    print(t)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve(h, w):
    if h == 1 or w == 1:
        return 1
    return (h * w + 1) // 2


def main():
    h, w = map(int, input().split())
    res = solve(h, w)
    print(res)


def test():
    assert solve(4, 5) == 10
    assert solve(7, 3) == 11
    assert solve(1000000000, 1000000000) == 500000000000000000


if __name__ == "__main__":
    test()
    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 if (h*w)%2==0 else (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:
import numpy as np
import collections
import math

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


answer=0

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

answer = math.ceil(H*W/2)


print(answer)

Submission status: Accepted

Solution code:
import math
# map(int,input().split())
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)
    exit()
    
if w%2==0:
    print(w//2*h)
    exit()
if w%2==1:
    if h%2==0:
        print(w*h//2)
    elif h%2==1:
        ans=0
        ans+=w*(int(h/2))
        ans+=w//2+1
        print(ans)

Submission status: Accepted

Solution code:
(n, m) = map(int, raw_input().split())

res = 0

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

Submission status: Accepted

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

hw=h*w
if h==1 or w==1:
    print(1)

elif hw%2==1:
    print(hw//2+1)
else:
    print(hw//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:
def main():
    import sys
    input = sys.stdin.readline
    H, W = map(int, input().split())

    m = H*W // 2 + (H*W) % 2

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


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

Submission status: Accepted

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

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

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

result=(h-h//2)*(w-w//2)+(h//2)*(w//2)
print(result)

Submission status: Accepted

Solution code:
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

h,w = get_nums_l()

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

ans = 0

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

print(ans)

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:
    t = H // 2
    u = H // 2
else:
    t = H // 2 + 1
    u = H // 2

if W % 2 == 0:
    print ((t+u) * (W//2))
else:
    print (t * (W//2+1) + u * (W//2))

Submission status: Accepted

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


if h == 1 or w == 1:
    print(1)
    exit()
def ceil(a, b):
   return a // b + (a % b > 0)

ans = ceil(w,2) * ceil(h, 2) + ((h//2) * (w//2))

print(ans)

Submission status: Accepted

Solution code:
h,w = map(int, input().split())
if (h>1) and (w >1):
    print((h*w+1)//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:
# import sys
# import math
# import decimal
# import queue
# import bisect
# import heapq
# import time
# import itertools
# import collections # queue
# from fractions import Fraction

mod = int(1e9+7)
INF = 1<<29
lINF = 1<<35

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

if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
def div_ceil(x, y): return (x + y - 1) // y

H, W = map(int, input().split())
ans = div_ceil(W, 2) * div_ceil(H, 2) + (W // 2) * (H // 2)
print(ans if H != 1 and W != 1 else 1)

Submission status: Accepted

Solution code:
import bisect
import collections
import sys

sys.setrecursionlimit(100000)
input = sys.stdin.readline
ACMOD = 1000000007
INF = 1 << 32


def lmi():
    return list(map(int, input().split()))


def llmi(n):
    return [lmi() for _ in range(n)]


H, W = lmi()
if H == 1 or W==1:
    print(1)
    exit()
movable = (H*W+1)//2
print(movable)

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:
  print((H//2)*W)
else:
  print(((H-1)//2)*W+math.ceil(W/2))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline

##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# bisect_right(lists, 3)

##### プライオリティキュー #####
# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

##### タプルリストのソート #####
# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順
# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順
# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順
# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順

# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順
# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順

##### 累乗 #####
# pow(x, y, z) -> x**y % z

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	H,W = inputMap()

	ans = H*W

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


#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
# special thanks :
#  https://nagiss.hateblo.jp/entry/2019/07/01/185421
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
# nCr mod m
# rがn/2に近いと非常に重くなる
def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res

# mを法とするaの乗法的逆元
def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

def egcd(a, b):
    if a == 0:
        return b, 0, 1
    else:
        g, y, x = egcd(b % a, a)
        return g, x - (b // a) * y, y

# nHr mod m
# 問題によって、combination()を切り替えること
def H(n, r, mod=10**9+7):
	# comb = Combination(n+r-1, mod)
	# return comb(n+r-1, r)
    return combination(n+r-1, r, mod)

class Combination:
    """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
        return modinv

if __name__ == "__main__":
	main()