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: Runtime Error

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

if n[0] == 1 or n[1] == 1:
    print(0)

if n[0] % 2 == 0:
    print(int((n[0]/2)*n[1])
    sys.exit()
else:
    if n[1] % 2 == 0:
        print(int(n[0]*(n[1]/2)))
        sys.exit()
    else:
        a = ((n[0]-1)*n[1])/2
        b = n[1] - int(n[1]/2)
        print(int(a+b))
        sys.exit()

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n, m = (int(x) for x in input().split())
if n % 2 == 0:
  ans = n * m // 2
elif m % 2 == 0:
  m % 2==0:
  ans = n * m // 2
else:
  ans = (n * (m+1) // 2 )- n //2
print(ans)

Submission status: Runtime Error

Solution code:

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

if n % 2 == 0 or w % 2 == 0:
    ans = int((n * w) / 2.)

else : ans = int((n * w) / 2.) + 1

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:

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

Submission status: Runtime Error

Solution code:
h,w=input().split(' ')
print(h*w/2)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
h,w=input().split(' ')
print((h*w+1)/2)

Submission status: Runtime Error

Solution code:
a = input()
b = input()
a=int(a)
b=int(b)
c = a*(b//2)

if(b%2==1):
  if(a%2==0):
    c = c + (a/2)
  else:
    c = c + (a/2)+1

print(int(c))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
h, w = map(int, input().split(' '))
print(int(h * w / 2 + h * w % 2)

Submission status: Runtime Error

Solution code:
h, w = map(int, input().split())
for i in range(h):
    if i%2==0:
        a=a+1
for j in range(w):
    if j%2==1:
        b=b+1
c=a+b
print(c)

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <vector>
#include <cmath>
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    int h, w;
    cin >> h >> w;
    if(h == 1 || w == 1){
        cout << 1 << endl;
    }
    else if(h % 2 != 0 && w % 2 != 0){
        cout << (w * h + 1) / 2 << endl;
    }
    else{
        cout << w * h / 2 << endl;
    }
    return 0;
}

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i=0;i<(n);++i)
#define RANGE(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(n)-1;i>= 0;--i)

#define endl '\n'
#define pb push_back
#define eb emplace_back
#define pque priority_queue
#define umap unordered_map
#define uset unordered_set
#define BIG 2000000000
#define VERYBIG 1000000000000000ll
#define dcout cout<<fixed<<setprecision(20)
#define Accepted_MAGIC cin.tie(0);ios::sync_with_stdio(false)

// typedef long long ll;
using Real = long double;
#define int long long

const long long dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
const long long MOD = 1e9+7;
constexpr Real eps = 1e-9, pi = acos(-1);

template<typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}

typedef pair<int, int> INTP;
typedef vector<int> INTV;
struct edge2 {int to, cost;};
struct edge3 {int from, to, cost;};

signed main(void){
  Accepted_MAGIC;
  
  int H, W; cin >> H >> W;
  if(H == 1 or W == 1){
    cout << 1 << endl; return 0;
  }
  if((H*W) & 1){
    if(W & 1) cout << H*W/2 + 1 << endl;
    else cout << H*W/2 << endl;
  } else {
    cout << H*W/2 << endl;
  }
}

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math

height, width = [int(i) for i in input().split(' ')]

if height > 1 and width > 2:
    print(math.ceil(width/2) * math.ceil(height/2) + math.floor(width/2) * math.floor(height/2))
else print(1)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

if w % 2 == 1:
    idle = int((w - 1) / 2)
    can = w - idle
    second = can - 1
    num = can + second
elif w % 2 == 1 and h == 1:
    idle = int((w - 1) / 2)
    can = w - idle
    print(can)
    exit()
elif w % 2 == 0 and h == 1:
    print(1)
    exit()
else:
    idle = int(w / 2)
    num = idle * 2
    
if h % 2 == 1:
    row = int(h // 2)
    print(num * row + can)
else:
    row = int(h / 2)
    print(num * row)

Submission status: Runtime Error

Solution code:
H, W = (int(x) for x in input().split())
if H * W % 2 == 0:
    k = H * W / 2
else:
    if H == 1 or W == 1:
        a = list(filter(lambda x: x != 1, [H, W]))
        k = int(a[0] / 2) + 1
    else:
        k = int(H/2) + (int(W/2))*H + 1
print(k)

Submission status: Runtime Error

Solution code:
import math 
a, b, c = map(int, input().split())
if (a + b + 2 * math.sqrt(a * b)) < c:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	ll h,w;
	cin >> h >> w;

	cout << (h/2)*w + (h%2==1 ? (w+1)/2 : 0)<< '\n';
	return 0;
}

Submission status: Runtime Error

Solution code:

H , W = input().split()
W = (W)
H = int(H)
ans = int(0)

#Wが偶数なら(W//2)*H
#W.Hが奇数なら((W+1)//2)*((H+1)//2) + ((W - 1)//2*(H - 1)//2)
#Wが奇数Hが偶数(W+1)//2*(H//2) + ((W - 1)//2)*(H//2)

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

Submission status: Runtime Error

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

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

if w == 2 and h == 2:
    print(2)
    exit()

if w % 2 == 1:
    idle = int((w - 1) / 2)
    can = w - idle
    second = can - 1
    num = can + second
elif w % 2 == 1 and h == 1:
    idle = int((w - 1) / 2)
    can = w - idle
    print(can)
    exit()
elif w % 2 == 0 and h == 1:
    print(1)
    exit()
else:
    idle = int(w / 2)
    num = idle * 2
    
if h % 2 == 1:
    row = int(h // 2)
    print(num * row + can)
else:
    row = int(h / 2)
    print(num * row)

Submission status: Runtime Error

Solution code:
h,w = [int(x) for x in stdin.readline().rstrip().split()]
import math
def bishop(h,w):
    if h == 1:
        ans = 1
    else:
        ans = int(w/2)*h + (w%2)*math.ceil(h/2)
    return ans

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s = input()
H = s[0]
W = s[1]
h = int(H)
w = int(W)
if h%2 == 1 and w%2 == 1:
    a = (h*w)//2 +1
else :
    a = h*w/2 
A = int(a)
print(A)

Submission status: Runtime Error

Solution code:
H, W = (int(x) for x in input().split())
if H * W % 2 == 0:
    k = H * W / 2
else:
    if H == 1 or W == 1:
        a = map(lambda x: x != 1, [H, W])
        k = int(a / 2) + 1
    else:
        k = int(H/2) + (int(W/2))*H + 1
print(k)

Submission status: Runtime Error

Solution code:
h, w = map(int, raw_input().split())
x = h*w
print x/=2 if x % 2 != 0 x = (x/2)+1

Submission status: Runtime Error

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

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

if w == 2 and h == 2:
    print(2)
    exit()

if w % 2 == 1:
    idle = int((w - 1) / 2)
    can = w - idle
    second = can - 1
    num = can + second
elif w % 2 == 1 and h == 1:
    idle = int((w - 1) / 2)
    can = w - idle
    print(can)
    exit()
elif w % 2 == 0 and h == 1:
    idle = int(w / 2)
    print(idle)
    exit()
else:
    idle = int(w / 2)
    num = idle * 2
    
if h % 2 == 1:
    row = int(h // 2)
    print(num * row + can)
else:
    row = int(h / 2)
    print(num * row)

Submission status: Runtime Error

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

if W % 2 == 0:
    print((H * W) // 2)
else :
    odd_row = (W // 2) + 1 
    even_row = W // 2
    if H % 2 == 1:
        odd_row_num = (H // 2) + 1
        even_row_num = H // 2
        print((odd_row*odd_row_num) + (even_row*even_row_num))
    else :
        print(((odd_row+even_row) * (H // 2))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
HW = [int(i) for i in input().split()]
h = HW[0]
w = HW[1]
if h % 2 == 0:
    if w % 2 == 0:
        ans = h*w/2
    else:
        if w % 2 == 0:
            ans = h * w / 2
        elif h % 2 == 0:
            ans = h * w / 2
        else:
            if( w>h ):
                ans = (w * (h - 1) / 2) + ((w + 1) / 2)
            else:
                ans = (h * (w - 1) / 2) + ((h + 1) / 2)
ansint = int(ans)
print (ansint)

Submission status: Runtime Error

Solution code:
HW = [int(i) for i in input().split()]
h = HW[0]
w = HW[1]
if h % 2 == 0:
    if w % 2 == 0:
        ans = h*w/2
    else:
        if w % 2 == 0:
            ans = h * w / 2
        if h % 2 == 0:
            ans = h * w / 2
        else:
            if( w>h ):
                ans = (w * (h - 1) / 2) + ((w + 1) / 2)
            else:
                ans = (h * (w - 1) / 2) + ((h + 1) / 2)
ansint = int(ans)
print (ansint)

Submission status: Runtime Error

Solution code:
import fractions
from functools import reduce

a = list(map(int,input().split()))
h = a[0]
w = a[1]

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

Submission status: Runtime Error

Solution code:
a,b =map(int,input(),split())
ss = a*b
hf =ss//2
if a>1 and b>1:
	print(ss-hf)
else:
  print(1)

Submission status: Runtime Error

Solution code:
# import bisect
# import heapq
# from copy import deepcopy
# from collections import deque
# from collections import Counter
# from itertools import accumulate
# from itertools import permutations
# import numpy as np
import math
a,b,c = map(float, input().split())
# n = int(input())
# p = list(map(int, input().split()))


ans = 'Yes' if a + b + (2 * math.sqrt(a * b)) < c else 'No'

print(ans)

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
K=N*M
if N==1orM==1:
  print(1)
elif K%2==1:
  print(K//2+1)
else:
  print(K//2)

Submission status: Runtime Error

Solution code:
HW = [int(i) for i in input().split()]
h = HW[0]
w = HW[1]
if h % 2 == 0:
    if w % 2 == 0:
        ans = h*w/2
    else:
        if w % 2 == 0:
            ans = h * w / 2
        if h % 2 == 0:
            ans = h * w / 2
        else:
            if( w>h ):
                 ans = (w * (h - 1) / 2) + ((w + 1) / 2)
            else:
                ans = (h * (w - 1) / 2) + ((h + 1) / 2)
ansint = int(ans)
print (ansint)

Submission status: Runtime Error

Solution code:
n = int(input())
m = int(input())

x = (n - 1) / 2
y = (m - 1) / 2

res = x * y + (n - x) * (m - y)

print(res)

Submission status: Runtime Error

Solution code:
import math 
a, b, c = map(int, input().split())
if (math.sqrt(a) + math.sqrt(b)) < math.sqrt(c):
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
def main():
    H, W = map(int, input().split(" "))
    # r1 + c1 = r2 + c2
    # r1 - c1 = r2 - c2

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

    c = H * W
    if c % 2 == 0:
        print(c // w)
    else:
        MAX = max(H, W)
        MIN = min(H, W)

        out = MIN * (MIN - 1) + MAX % MIN
        


main()

Submission status: Runtime Error

Solution code:
a,b=map(int(input()).split())
c=a-1
d=b-1
e=0
while a*b:
  if a+b==c+d:
    e=e+1
  elif a-b==c-d:
    e=e+1
print(e)

Submission status: Runtime Error

Solution code:
# coding: utf-8
H,W = list(map(long,input().split()))
ans = H*W/2
if H*W%2==1:
    ans+=1
print("%d"%ans)

Submission status: Runtime Error

Solution code:
H=int(s[0])
W=int(s[1])
res =0
if H%2==0:
    res = int(H/2) * W
else:
    if W%2==0:
        #res = (int(H/2) + 1)* int(W/2) + (int(H/2))* int(W/2)  
        res = int(H/2) * W +  int(W/2)  
    else:
        res = int(H/2) * W + int(W/2)+1
print(res)

Submission status: Runtime Error

Solution code:
from math import ceil

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

a,b,c,d=0
if n&1:
    a = n//2+1
    c = n//2
else:
    a = n//2
    c = n//2
if m&1:
    b = m//2+1
    d = m//2
else:
    b = m//2
    d = m//2

print(a*b + c*d)

Submission status: Runtime Error

Solution code:
import math
a = int(input())
b = int(input())
print(math.ceil(a*b/2))

Submission status: Runtime Error

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

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

if w % 2 == 1:
    idle = int((w - 1) / 2)
    can = w - idle
    second = can - 1
    num = can + second
elif w % 2 == 1 and h == 1:
    idle = int((w - 1) / 2)
    can = w - idle
    print(can)
    exit()
else:
    idle = int(w / 2)
    num = idle * 2
    
if h % 2 == 1:
    row = int(h // 2)
    print(num * row + can)
else:
    row = int(h / 2)
    print(num * row)

Submission status: Runtime Error

Solution code:
HW = [int(i) for i in input().split()]
h = HW[0]
w = HW[1]
if h % 2 == 0:
    if w % 2 == 0:
        ans = h*w/2
else:
    if w % 2 == 0:
        ans = h * w / 2
    elif( w>h ):
         ans = (w * (h - 1) / 2) + ((w + 1) / 2)
    else:
        ans = (h * (w - 1) / 2) + ((h + 1) / 2)
ansint = int(ans)
print (ansint)

Submission status: Runtime Error

Solution code:
import math
a = eval(input())
b = eval(input())

print(math.ceil(a*b/2))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
h, w = map(int, input().split())
h_evan = h // 2
h_odd = h_even + (h % 2)
w_evan = w // 2
w_odd = w_even + (w % 2)
print(h_even * w_even + h_odd * w_odd)

Submission status: Runtime Error

Solution code:
#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
#define F first
#define S second
#define db double
#define pb push_back
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
using namespace std;

set<char> st={'a','e','i','o','u'};

// ll mod=1e9 +7;
ll mod=  998244353;

const int M=200006;
int f[M],inv[M];
int expo(int base,int exponent,int mod){
    int ans=1;
    while(exponent!=0){
        if(exponent&1) ans=(1LL*ans*base)%mod;
        base=(1LL*base*base)%mod;
        exponent>>=1;
    }
    return ans%mod;
}
void compute(){
    f[0]=1;
    rep(i,1,M-1){
        f[i]=(1LL*i*f[i-1])%mod;
    }
    inv[M-1]=expo(f[M-1],mod-2,mod);
    for(int i=M-2;i>=0;i--){
        inv[i]=(1LL*(i+1)*inv[i+1])%mod;
    }
}
int C(int n,int r){
    return (1LL*((1LL*f[n]*inv[r])%mod)*inv[n-r])%mod;
}

ll n,i;
ll dp[503][503];

vector<ll>a(503);
ll caldp(ll l,ll r)
{
    if(l+1==r)
    {
         dp[l][r]=a[l];
    }
    if(dp[l][r]!=0)
    return dp[l][r];
    
    dp[l][r]=-1;
    for(ll mid=l+1;mid<r;mid++)
    {
        ll lpart=caldp(l,mid);
        ll rpart=caldp(mid,r);
        if(lpart>0 && lpart==rpart)
         dp[l][r]=lpart+1;
    }
    return dp[l][r];
}

ll cal(ll tmp)
{
    ll ans=0;
     if(tmp%2==0)
            {
                ll terms=tmp/2;
                ans+=(tmp*(terms)) - ((terms*(terms-1))); 
            }
    else
            {
                ll terms=tmp/2 +1;
                ans+=(tmp*terms) - (terms*(terms-1));
            }
        return ans;
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //compute();
    
    ll tests=1;
   // cin>>tests;
    while(tests--)
    {
        ll h,w,i;
        cin>>h>>w;
        ll ans=0;
        ll t1,t2;
        if(w%2==0)
        {t1=w/2;t2=t1;}
        else{t1=w/2 +1;t2=w-t1;}
        if(h%2==0)
        {ans+=(h/2)*(t1+t2);}
        else
        {
            ans+=(h/2 +1)*t1;
            ans+=(h/2)*t2;
        }
        cout<<ans;
    }
    
    return 0;
}

Submission status: Runtime Error

Solution code:
h, w = int(input().split())
r1 = 0
c1 = 0
count = 0
r2 for r2 in range(0,h-1):
  c2 for c2 in range(0,w-1):
    if r1 + c1 == r2 + c2 or r1 - c1 == r2 - c2:
      r1 = r2
      c1 = c2
      count += 1
print(count)

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <cmath>
using namespace std;

int main() {
    long long h, w;
    cin >> h >> w;
    cout << ((h * w) + 1) / 2 << endl;
}

Submission status: Runtime Error

Solution code:
#n=int(input())
h,w=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
v1=h//2
v2=w//2
if h==1 or w==1:
    print(0)
elif h%2==0:
    
    ans=v1*w
else:
    if w%2==0:
        ans=v1*v2+(v1-1)*v2
    else:
        t=v1+1
        ans=v2*(t-1)+(v2+1)*t
print(ans)

Submission status: Runtime Error

Solution code:
h, w = int(input().split())
r1 = 1
c1 = 1
count = 0
r2 for r2 in range(0,h-1):
  c2 for c2 in range(0,w-1):
    if r1 + c1 == r2 + c2 or r1 - c1 == r2 - c2:
      r1 = r2
      c1 = c2
      count += 1
print(count)

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define rep3(i, s, n) for (int i = s; i > (int)(n); i--)
#define all(obj) obj.begin(), obj.end()
#define db(x) cerr << #x << ":" << x << " "
#define dbl(x) cerr << #x << ":" << x << "\n"
#define dbv(vec) cerr << #vec << ":"; for (auto e : vec) cerr << e << " "; cout << "\n"
#define dbvv(vv) cerr << #vv << ":\n"; for (auto vec : vv) { for (auto e : vec) cerr << e << " "; cerr << endl; }
#define YN(f) cout << (f ? "YES" : "NO") << endl
#define Yn(f) cout << (f ? "Yes" : "No") << endl
#define yn(f) cout << (f ? "yes" : "no") << endl
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;

int main() {
	ll H, W; cin >> H >> W;
	ll ans;
	if (H == 1 || W == 1) {
		ans = 1;
	} else if (H % 2 == 1 && W % 2 == 1) {
		ans = (H * W + 1) / 2;
	} else {
		ans = H * W / 2;
	}
	cout << ans << endl;
}

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
from functools import reduce
def multiply(a, b):
    a = list(map(lambda x : int(x), a.strip()))
    b = list(map(lambda x : int(x), b.strip()))
    c = list(map(lambda x : 0, ("0" + str(a) + str(b)).strip()))
    index = len(c) - 1;
    for i in range(len(a) - 1, -1, -1):
        pos = 0
        for j in range(len(b) - 1, -1, -1):
            temp = a[i] * b[j] + c[index - pos] #两个乘数相乘,并加上在此前一次的进位
            c[index - pos] = temp % 10 #保存运算求余结果
            c[index - pos - 1] += temp // 10 #处理进位,进位可以是0或者大于0的数
            pos += 1
        index -= 1
    return int(reduce(lambda x, y : str(x) + str(y), c)) #将list中的内容转换为字符串

a = input()
b = input()
print(multiply(a, b)/2)

Submission status: Runtime Error

Solution code:
n = int(input()),m = int(input())
if n % 2 == 0:
  ans = n * m / 2
else:
  if m % 2==0:
    ans = ((n / 2 + 1) + n / 2) * m / 2
  else:
    ans = ((n / 2 + 1) + n / 2) * (m-1) / 2 + n / 2 + 1
print(ans)

Submission status: Runtime Error

Solution code:
H, M = map(int,input().split())
l = [H, M]

max = max(l)
min = min(l)

if max == min:
  if max % 2 == 0:
    N = (H * M) / 2
  else:
    N = ((H * M) - 1)/2)+1

else:
  r = max - min
  r2 = max - r
  r3 = r * min
  if r2 % 2 == 0:
    n1 = (r2 * r2) / 2
  else:
    n1 = (((r2 * r2) - 1)/2)+1
 
  if r3 % 2 == 0:
    n2 = r3 / 2
  else:
    n2 = (r3 - 1) / 2

  N = n1 + n2

print(N)

Submission status: Runtime Error

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

if w % 2 == 1:
    idle = int((w - 1) / 2)
    can = w - idle
    second = can - 1
    num = can + second
else:
    idle = int(w / 2)
    num = idle * 2
    
if h % 2 == 1:
    row = int(h // 2)
    print(num * row + can)
else:
    row = int(h / 2)
    print(num * row)

Submission status: Runtime Error

Solution code:
1000000000 1000000000

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

if H < 10**9:
    if H % 2 == 0:
        sum = W * H / 2
    elif W % 2 == 0:
        sum = (W * (H-1) / 2) + (W / 2)
    else:
        sum = (W * (H-1) / 2) + ((W+1) / 2)
else:
    1+1

print(int(sum))

Submission status: Runtime Error

Solution code:
r,c = map(int,input().split())
if c%2 !=0:
  r1 = (c+1)/2
  r2 = r1 -1
  if r %2 == 0:
    ans = r*(r1+r2)/2
  else:
    ans = (r-1)(r1+r2)/2 +r1
else:
  r1 = c/2
  ans = r1*r
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
inp = list(map(int,input().split()))
 
a = inp[0]*inp[1]

if (inp[0]==1 or inp[1]==1):
    print("1")
else:
    if (a %2 == 1):
        b = int(a/2)+1
    else:
        b = a/2
 
print(b)

Submission status: Runtime Error

Solution code:
h = int(input())
w = int(input())

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

print(r)

Submission status: Runtime Error

Solution code:
a,b =map(int,input(),split())
ss = a*b
hf =ss//2
print(ss-hf)

Submission status: Runtime Error

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

if h == 1 or w == 1:
    c == 1
elif h & 1:
    if w & 1:
        c = ((h + 1) // 2) * ((w + 1) // 2) + (h // 2) * (w // 2)
    else:
        c = (((h + 1) // 2) + (h // 2)) * (w // 2)
else:
    c = (h // 2) * w

print(c)

Submission status: Runtime Error

Solution code:
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

typedef long long ll;
typedef long double ld;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);

  ll h, w;
  cin >> h >> w;

  cout << ceil((ld)h * w / 2);
}

Submission status: Runtime Error

Solution code:
a,b =map(int,input(),split())
ss = (a*b)//2
print(ss)

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;

int main() {
long long h;
long long w;

cin >> h >> w;


if((h*w)%2==0){
    cout<<h*w/2<<endl;
}
else{
    cout<<(h*w+1)/2<<endl;
}
  
}

Submission status: Runtime Error

Solution code:
import math
ABC=input().rstrip('\n').split()

A=math.sqrt(int(ABC[0]))
B=math.sqrt(int(ABC[1]))
C=math.sqrt(int(ABC[2]))
AB=math.sqrt(A*B)
if A+B<C :
    print ("Yes")
else :
    print ("No")

Submission status: Runtime Error

Solution code:
h,w=map(int,input().split())
mas=[[0]*w for _ in range(h)]
cnt=0
for i in range(h):
    if i%2==0:
        for j in range(w)[::2]:
            cnt += 1
    else:
        for j in range(1,w)[::2]:
            cnt += 1
print(cnt)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math

s = input().split()

a = int(s[0])
b = int(s[1])
c = int(s[2])

if (a + b + 2* math.sqrt(a*b) ) < c :
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
int main() {
	long long int a, b, ans;
	cin >> a >> b;
	if(a == 1 || b == 1) ans = 1;
	else ans = ((a * b) / 2) + ((a * b) % 2 ? 1 : 0);
	cout << ans << endl;
	return 0;
}

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>

using namespace std;

using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define Rep(i, n) for (long long i = 0; i< (long long)(n); i++)
#define RRep(i,n) for (long long i = ((long long)(n)-1); i>=0; i--)
#define all(v) (v).begin(),(v).end()

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    int weight;
    edge(int f,int t,int w) : from(f), to(t), weight(w){ }
};

using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

template <class T>
inline bool chmin(T &a, T b){
    if (a > b){
        a = b;
        return true;
    }
    return false;
}

template <class T>
inline bool chmax(T &a, T b){
    if (a < b){
        a = b;
        return true;
    }
    return false;
}

template <class T>
T gcd(T a, T b){
    if( b==0 ) return a;
    return gcd(b, a%b);
}

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

int INF = 1e9+7;

vector<int> dx = {-1,0,1,0};
vector<int> dy = {0,-1,0,1};

int main(){
    ll h,w;
    cin >> h >> w;
    if(h==1 || w==1){
        cout << 0 << endl;
        return 0;
    }
    ll a = (w+1)/2;
    ll b = w/2;
    ll ans = a*((h+1)/2) + b*(h/2);
    cout << ans << endl;
}

Submission status: Runtime Error

Solution code:
a,b =map(int,input(),split())
ss = a*b
print(ss-10)

Submission status: Runtime Error

Solution code:
a,b=map(int(input()).split())
c=a+b+1
print(c)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
l = input()
h, w = l.split(" ")
n = h * w
a = n/2
if n%2==0:
  print(a)
  

else:
  print(a+0.5)