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

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

Submission status: Accepted

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

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

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

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

Submission status: Accepted

Solution code:
from math import ceil
h, w = [int(i) for i in input().split()]
print(ceil(h*w/2)) if h != 1 and w != 1 else print(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=h*w
if h==1 or w==1:
    print(1)
    exit(0)
if ans%2==0:
    print(ans//2)
else:
    print(1+(ans//2))

Submission status: Accepted

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

odd = W // 2 + 1
even = W // 2

answer = 0
if W % 2 != 0 and W != 1 and H != 1:
    if H % 2 == 0:
        answer = (odd + even) * (H // 2)
    else:
        answer = (odd + even) * (H // 2) + odd
else:
    answer = even * H

if W == 1 or H == 1:
    answer = 1

print(answer)

Submission status: Accepted

Solution code:
import sys
l = sys.stdin.readline().strip()

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#pypyは内包表記使わない, rstrip注意
#提出前に見返すこと！
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate
    #from itertools import product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# B - Bishop
def main():
    H, W = map(int, input().split())
    if min(H, W) == 1:
        print(1)
    else:
        ans = (H * W + 1) // 2
        print(ans)


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 = int(math.ceil(W / 2.0) * math.ceil(H / 2.0))
even = int(math.floor(W / 2) * math.floor(H / 2))

print(odd + even)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
# coding: utf-8
# Your code here!
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
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))

H, W = input_nums()

horizontal = 0
ans = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

h, w = [int(v) for v in input().split()]
if 1 in [h, w]:
    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 + H * W % 2)

Submission status: Accepted

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

Submission status: Accepted

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

if W == 1 or H == 1:
    print(1)
elif W % 2 == 0:
    w = W // 2
    print(H * w)
else:
    w1 = W // 2 + 1
    w2 = w1 - 1
    if H % 2 == 0:
        h = H // 2
        print(h * w1 + h * w2)
    else:
        h1 = H // 2 + 1
        h2 = h1 - 1
        print(h1 * w1 + h2 * w2)

Submission status: Accepted

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

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

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

print(ans)

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

if H==1:
    print(1)
    exit()
if 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:
import sys
a,b= list(map(int,input().strip().split()))
x=a*b
if(a==1 or b==1):
	print(1)
	sys.exit()
if(x%2!=0):
	x=x+1
print(x//2)

Submission status: Accepted

Solution code:
#A
if False:
    A=[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=int(input())
    print(A[K-1])

#B
H,W=map(int,input().split())
ans=0
if H==1 or W==1:
    ans+=1
else:
    ans+=(H//2)*W
    if H%2!=0:
        ans+=W//2
        ans+=W%2
print(ans)
#C
if False:
    A,B,C=map(int,input().split())
    if 4*A*B<(C-A-B)**2:
        if C-A-B>=0:
            print('Yes')
        else:
            print('No')
    else:
        print('No')

#D

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)
else: # 縦が奇数
    # １行目
    if W % 2 == 0:
        s = (W // 2)
    else:
        s = (W // 2) + 1
    
    print( ((H-1) // 2)*W + s )

Submission status: Accepted

Solution code:
import sys

H, W = map(int, sys.stdin.readline().strip().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 // 2 + 1)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**9)
from collections import defaultdict
 
IA = lambda: map(int,input().split())
IAS= lambda: map(str,input().split())
 
n,m=IA()
if n==1 or m==1:
  print(1)
else:
  print((n*m+1)//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(w*(h//2))
else:
    if w%2 == 0:
        print((w*(h//2)) + (w//2))
    else:
        print((w*(h//2)) + ((w//2)+1))

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

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

Submission status: Accepted

Solution code:
def solve():
    h, w = list(map(int, input().split()))
    
    if w == 1 or h == 1:
        print(1)
        return
    
    _odd = ((w + 1) // 2) * ((h + 1) // 2)
    _even = (w // 2) * (h // 2)

    print(_odd + _even)

if __name__ == "__main__":
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#Panasonic B
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:
    s = a * b
    print(s // 2 + s % 2)

Submission status: Accepted

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

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

Submission status: Accepted

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

T = H * W

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

Submission status: Accepted

Solution code:
from math import ceil
h, w = [int(i) for i in input().split()]

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

Submission status: Accepted

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

while True:
    if H==1 or W==1:
        print(1)
        break

    if S%2==0:
        print(int(S/2))
        break
    elif S%2==1:
        print(int(S//2+1))
        break

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    h, w = map(int, input().split())
    count = 0
    if h == 1 or w == 1:
        count = 1
    else:
        count =(h*w) //2

        if (h*w) % 2:
            count = count +1
    print(count)

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())
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:
from math import ceil

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from sys import stdin
import numpy as np
from operator import itemgetter

#N = int(stdin.readline().rstrip().split()[0])
H, W = [int(x) for x in stdin.readline().rstrip().split()]
#A = [int(x) for x in stdin.readline().rstrip().split()]

MOD = 10**9 + 7
H_2 = H//2
W_2 = W//2

ans = W*H_2
if H%2 != 0:
  ans += W_2
  if W%2 != 0:
    ans += 1

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

Submission status: Accepted

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

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

Submission status: Accepted

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

w1 = math.ceil(W/2)*math.ceil(H/2)
w2 = math.floor(W/2)*math.floor(H/2)

if H == 1:
    print(1)
elif W==1:
    print(1)
elif W != 1:
    print(w1+w2)

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:
hw = list(map(int, input().split()))
h = hw[0]
w = hw[1]

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

Submission status: Accepted

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

if h == 1 or w == 1:
    print(1)
else:
    import math
    h_odds = math.ceil(h / 2)
    h_evens = h // 2
    w_odds = math.ceil(w / 2)
    w_evens = w // 2
    print(h_odds * w_odds + h_evens * w_evens)

Submission status: Accepted

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

masu=masu+(w*(h//2))

if h%2==1:
    if w%2==1:
        masu=masu+(w//2)+1
    else:
        masu=masu+(w//2)

if h==1 or w==1:
    masu=1

print(masu)

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

Submission status: Accepted

Solution code:
H, W = list(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:
n,w = map(int,input().split())

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

Submission status: Accepted

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

    if H == 1 or W == 1:
        print("1")
        exit(0)
    
    if H % 2 == 0:
        print(H // 2 * W)
    else:
        ans = H * (W // 2)
        if W % 2 == 1:
            ans += H // 2 + 1
        print(ans)
if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
import math

h, w = (int(item) for item 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:
  print((h*w+1) // 2)

Submission status: Accepted

Solution code:
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

H, W = MAP()

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n, m = [int(s) for s in input().split()]
if n == 1 or m == 1:
    ans = 1
elif not n%2:
    ans = (n//2)*m
else:
    ans = (n//2)*m + m//2 + m%2
print(ans)

Submission status: Accepted

Solution code:
import sys

import math

input = sys.stdin.readline


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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  h,w=LI()
  a=(w+1)//2
  b=w//2

  if h==1:
    return 1

  if w==1:
    return 1

  if h%2==0:
    return h//2*a+h//2*b
  return (h+1)//2*a+h//2*b

# main()
print(main())

Submission status: Accepted

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

cnt = 0
if h > 1 and w > 1:
    cnt += ((w+1)//2)*(h//2)
    cnt += (w//2)*(h//2)
    if h&1 == 1:
        cnt += (w+1)//2
else:
    cnt = 1

print(cnt)

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) if H%2!=0 and W%2!=0 else int((H*W)/2))

Submission status: Accepted

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

if (num[0] == 1) or (num[1] == 1):
  ans = 1
else:
  w_1 = int((num[1]+1)/2)
  w_2 = int(num[1]/2)

  h_1 = int((num[0]+1)/2)
  h_2 = num[0] - h_1

  ans = h_1*w_1 + h_2*w_2

print(ans)

Submission status: Accepted

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

if(H==1):
  print("1")
elif(W==1):
  print("1")
else:
  r = H * W // 2
  s = H * W % 2
  print(r+s)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if w == 1 or h == 1:
  print('1')
  sys.exit()

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

Submission status: Accepted

Solution code:
import math
h,w = map(int,input().split())
if w == 1 or h == 1:
    print(1)
elif w%2 == 0:
    print(h*w//2)
else:
    a = w//2 + 1
    b = w//2
    na = math.ceil(h/2)
    nb = math.floor(h/2)
    print(a*na + b*nb)

Submission status: Accepted

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

    print(ans)



if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

H = int(H)
W = int(W)

t = H * W

mod = t % 2

if H != 1 and W != 1:
    if mod == 0:
        print(int(t/2))
    else:
        print(int(t/2) + 1)
else:
    print(1)

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 == 0:
  print(int(hw/2))
else:
  print(int(hw/2)+1)

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

ans = 0

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

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

print(ans)

Submission status: Accepted

Solution code:
nums =input().rstrip().split(" ")
tate=int(nums[0])
yoko=int(nums[1])
if tate==1 or yoko==1:
    masu=1
elif yoko%2==0:
    masu=int(yoko/2)*tate
elif yoko%2==1:
    masu=yoko*int(tate/2)+(tate%2)*int((yoko+1)/2)
print(masu)

Submission status: Accepted

Solution code:
import math

N,M = list(map(int,input().split()))
if N==1 or M == 1 :
    print(1)
else :
    print (math.ceil(N*M/2))

Submission status: Accepted

Solution code:
d = input().split(" ")
h = int(d[0])
w = int(d[1])
if h == 1 or w == 1:
	p = 1
elif h % 2 == 1 and w % 2 == 1:
	p = int(h * w / 2) + 1
else:
	p = int(h * w / 2)
print(p)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product

def resolve():
    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)

resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import ceil,floor
h,w=[int(i) for i in input().split()]
if h==1 or w==1:
    print(1)
else:
    print(ceil(h*w/4)+floor(h*w/4))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
from itertools import accumulate, groupby
mod = 10**9 + 7

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))


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

Submission status: Accepted

Solution code:
#coding:utf-8
import sys,os
from collections import defaultdict, deque
from fractions import gcd
from math import ceil, floor
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    XLMIIS = lambda x: [LMIIS() for _ in range(x)]
    YN = lambda c : print('Yes') if c else print('No')
    MOD = 10**9+7

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


    

if __name__ == '__main__':
    main()

Submission status: Accepted

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

h,w = mi()

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

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

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

Submission status: Accepted

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

mul = h * w

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

if mul % 2 == 0 :
    print(mul // 2)
else :
    print(mul // 2 + 1)

Submission status: Accepted

Solution code:
h, w = list(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(int(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())
l = (W+1)//2
m = W//2

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

Submission status: Accepted

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

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

    W_odd = int(W / 2)
    W_even = W - W_odd

    H_odd = int(H / 2)
    H_even = H - H_odd

    sum_number = (W_odd * H_odd + W_even * H_even)

    print(sum_number)

if __name__ == "__main__":
    resolve()

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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


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

if W % 2 == 0:
    kisu = W // 2
    gusu = W // 2
else:
    kisu = W // 2 + 1
    gusu = W // 2

if H % 2 == 0:
    ans = (kisu + gusu) * (H // 2)
else:
    ans = (kisu + gusu) * (H // 2) + kisu

print(ans)