TnT/CodeNet4Repair huggingface dataset:
Problem:
E869120 found a chest which is likely to contain treasure.   However, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters.   He also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with `?`.  One more thing he found is a sheet of paper with the following facts written on it:    * Condition 1: The string S contains a string T as a contiguous substring.   * Condition 2: S is the lexicographically smallest string among the ones that satisfy Condition 1.  Print the string S.   If such a string does not exist, print `UNRESTORABLE`.

Incorrect submission (verdict: Wrong Answer):
S = input()
T = input()

len_s = len(S)
len_t = len(T)

match = -1

for i in range((len_s - len_t), 0, -1):
    print("i", i)
    for j in range(len_t):
        if T[j] != S[i+j] and S[i+j] != "?":
            break

        if j == len_t-1:
            match = i

    if match != -1:
        break

if match == -1:
    print("UNRESTORABLE")
    exit()

list_s = list(S)

for i in range(match, match+len_t):
    list_s[i] = T[i - match]

list_s = [x if x != "?" else "a" for x in list_s]

print("".join(list_s))


Fixed, accepted submission:
S = input()
T = input()

len_s = len(S)
len_t = len(T)

match = -1

for i in range((len_s - len_t), -1, -1):
    for j in range(len_t):
        if T[j] != S[i+j] and S[i+j] != "?":
            break

        if j == len_t-1:
            match = i

    if match != -1:
        break

if match == -1:
    print("UNRESTORABLE")
    exit()

list_s = list(S)

for i in range(match, match+len_t):
    list_s[i] = T[i - match]

list_s = [x if x != "?" else "a" for x in list_s]

print("".join(list_s))
Problem:
Niwango created a playlist of N songs. The title and the duration of the i-th song are s_i and t_i seconds, respectively. It is guaranteed that s_1,\ldots,s_N are all distinct.  Niwango was doing some work while playing this playlist. (That is, all the songs were played once, in the order they appear in the playlist, without any pause in between.) However, he fell asleep during his work, and he woke up after all the songs were played. According to his record, it turned out that he fell asleep at the very end of the song titled X.  Find the duration of time when some song was played while Niwango was asleep.

Incorrect submission (verdict: Wrong Answer):
N=int(input())
ls1=[]
for _ in range(N):
  title,time=input().split()
  ls1.append([title,float(time)])
X=input()
i=0
a=0
flag=False
while flag==False:
  if ls1[i][0]==X:
    i+=1
    break
  i+=1
while i<N:
  a+=ls1[i][1]
  i+=1
print(a)

Fixed, accepted submission:
N=int(input())
ls1=[]
for _ in range(N):
  title,time=input().split()
  ls1.append([title,int(time)])
X=input()
i=0
a=0
flag=False
while flag==False:
  if ls1[i][0]==X:
    i+=1
    break
  i+=1
while i<N:
  a+=ls1[i][1]
  i+=1
print(a)
Problem:
We say that a odd number N is _similar to 2017_ when both N and (N+1)/2 are prime.  You are given Q queries.  In the i-th query, given two odd numbers l_i and r_i, find the number of odd numbers x similar to 2017 such that l_i ≤ x ≤ r_i.

Incorrect submission (verdict: Time Limit Exceeded):
import numpy as np
def isP(x):
    for i in range(2,int(np.sqrt(x))+1):
        if x % i == 0:
            return False
    return True


MAX = int(10e5+1)
P = [isP(x) for x in range(MAX)]
Ans = [0] * MAX
cnt = 0
for i in range(1,MAX):
    if P[i] and P[(i+1)//2]:
        cnt += 1
    Ans[i] = cnt

q = int(input())
for i in range(q):
    l, r = map(int, input().split())
    print(Ans[r]-Ans[l-1])

Fixed, accepted submission:
import numpy as np
from math import sqrt

def main():
    with open(0) as f:
        Q = int(f.readline())
        Query = [tuple(map(int, line.split())) for line in f.readlines()]
    
    p_table = makePtable(10**5)
    p_set = set(p_table)
    Like2017 = [p for p in p_table if (p+1)//2 in p_set]
    
    database = np.array([0] * (10**5+1))
    for i in Like2017:database[i] = 1
    database = database.cumsum(axis=0)
    
    for l,r in Query:
        print(database[r+1] - database[l-1])

def makePtable(N):
    table = list(range(2,N+1))
    result = []
    p = 2
    while p < sqrt(N):
        p = table[0]
        result.append(p)
        table = [x for x in table if x % p != 0]
    return result + table

main()
Problem:
There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs.  Determine if it is possible that there are exactly X cats among these A + B animals.

Incorrect submission (verdict: Wrong Answer):
A, B, X = map(int, input().split())
print('Yes' if (A + B) > X and X >= A else 'No')

Fixed, accepted submission:
A, B, X = map(int, input().split())
print('YES' if (A + B) > X and X >= A else 'NO')
Problem:
Takahashi loves numbers divisible by 2.  You are given a positive integer N. Among the integers between 1 and N (inclusive), find the one that can be divisible by 2 for the most number of times. The solution is always unique.  Here, the number of times an integer can be divisible by 2, is how many times the integer can be divided by 2 without remainder.  For example,    * 6 can be divided by 2 once: 6 -> 3.   * 8 can be divided by 2 three times: 8 -> 4 -> 2 -> 1.   * 3 can be divided by 2 zero times.

Incorrect submission (verdict: Wrong Answer):
n=int(input())
i=1
while i**2<=n:
    i+=1
print(i)

Fixed, accepted submission:
n=int(input())
i=0
while 2**i<=n:
    s=2**i
    i+=1
print(s)
Problem:
In Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands. For convenience, we will call them Island 1, Island 2, ..., Island N.  There are M kinds of regular boat services between these islands. Each service connects two islands. The i-th service connects Island a_i and Island b_i.  Cat Snuke is on Island 1 now, and wants to go to Island N. However, it turned out that there is no boat service from Island 1 to Island N, so he wants to know whether it is possible to go to Island N by using two boat services.  Help him.

Incorrect submission (verdict: Wrong Answer):

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

ok1 = [False] * n
ok2 = [False] * n

for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    if a > b:
        a, b = b, a
    if a == 0:
        ok1[b] = True
    if b == n - 1:
        ok2[b] = True

for m in range(n):
    if ok1[m] and ok2[m]:
        print("POSSIBLE")
        exit(0)
print("IMPOSSIBLE")


Fixed, accepted submission:

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

ok1 = [False] * n
ok2 = [False] * n

for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    if a == 0:
        ok1[b] = True
    if b == n - 1:
        ok2[a] = True

for m in range(n):
    if ok1[m] and ok2[m]:
        print("POSSIBLE")
        exit(0)
print("IMPOSSIBLE")
Problem:
Takahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A.  The problem has N test cases.  For each test case i (1\leq i \leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is `AC`, `WA`, `TLE`, and `RE`, respectively.  See the Output section for the output format.

Incorrect submission (verdict: Wrong Answer):

result = ["AC","WA","TLE","RE"]
result_num = [0,0,0,0]


case = input("")
case = int(case)

list = []
A = 0


while A < case:
  inp = input("")
  list.append(inp)
  A = A + 1

A = 0
while A < case:
  if list[A] == result[0]:
    result_num[0] = result_num[0] + 1
  elif list[A] == result[1]:
    result_num[1] = result_num[1] + 1
  elif list[A] == result[2]:
    result_num[2] = result_num[2] + 1
  elif list[A] == result[2]:
    result_num[3] = result_num[3] + 1
  A =A + 1

print("AC x " , result_num[0])
print("WA x " , result_num[1])
print("TLE x " , result_num[2])
print("RE x " , result_num[3])


Fixed, accepted submission:

result = ["AC","WA","TLE","RE"]
result_num = [0,0,0,0]


case = input("")
case = int(case)

list = []
A = 0

while A < case:
  inp = input("")
  if inp == result[0] or inp == result[1] or inp == result[2] or inp == result[3]:
    list.append(inp)
    A = A + 1

A = 0
while A < case:
  if list[A] == result[0]:
    result_num[0] = result_num[0] + 1
  elif list[A] == result[1]:
    result_num[1] = result_num[1] + 1
  elif list[A] == result[2]:
    result_num[2] = result_num[2] + 1
  elif list[A] == result[3]:
    result_num[3] = result_num[3] + 1
  A =A + 1

print("AC x" , result_num[0])
print("WA x" , result_num[1])
print("TLE x" , result_num[2])
print("RE x" , result_num[3])
Problem:
You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively.    An example of a trapezoid  Find the area of this trapezoid.

Incorrect submission (verdict: Wrong Answer):
a = int(input())
b = int(input())
h = int(input())
print((a + b)*h / 2)

Fixed, accepted submission:
a = int(input())
b = int(input())
h = int(input())
s = (a + b) * h // 2
print(s)
Problem:
Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier. He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though.  Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Otherwise, he does not find it delicious.  Takahashi bought some food A days before the "best-by" date, and ate it B days after he bought it.  Write a program that outputs `delicious` if he found it delicious, `safe` if he did not found it delicious but did not get a stomachache either, and `dangerous` if he got a stomachache.

Incorrect submission (verdict: Wrong Answer):
x, a, b = map(int, input().split())

if b <= a:
  print("delicious")
if b >= a and a+x <= b :
  print("safe")
if a+b < b :
  print("dangerous")

Fixed, accepted submission:
x, a, b = map(int, input().split())

if b <= a:
  print("delicious")
elif  b > a and a+x >= b :
  print("safe")
elif a+x < b :
  print("dangerous")
Problem:
A string is called a KEYENCE string when it can be changed to `keyence` by removing its contiguous substring (possibly empty) only once.  Given a string S consisting of lowercase English letters, determine if S is a KEYENCE string.

Incorrect submission (verdict: Wrong Answer):
s=input()
l=len(s)
flag=0
for i in range(7):
  if s[:i]+s[-(7-i):]=="keyence":
    flag=1
    break
if s[:7]=="keyence":
  flag=1
if flag==1:
  print("Yes")
else:
  print("No")

Fixed, accepted submission:
s=input()
flag=0
for i in range(7):
  if s[:i]+s[-(7-i):]=="keyence":
    flag=1
    break
if s[:7]=="keyence":
  flag=1
if flag==1:
  print("YES")
else:
  print("NO")
Problem:
AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.  If AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1). Note that **he cannot stay at his place**. Determine whether he can carry out his plan.

Incorrect submission (verdict: Wrong Answer):
n = int(input())
lists = [[0,0,0]]
for i in range(n):
  a = list(map(int,input().split()))
  lists.append(a)

diffs = []  
for i in range(1,n+1,1):
  diff = [ x - y for (x,y) in zip(lists[i], lists[i-1])]
  diffs.append(diff) 
  
for diff in diffs:
  if diff[0] < abs(diff[1]) + abs(diff[2]):
    print('No')
    exit()
  elif diff[0] % 2 != (abs(diff[1]) + abs(diff[2])) % 2:
    print('No')
    exit()
print('yes') 

Fixed, accepted submission:
n = int(input())
lists = [[0,0,0]]
for i in range(n):
  a = list(map(int,input().split()))
  lists.append(a)

diffs = []  
for i in range(1,n+1,1):
  diff = [ x - y for (x,y) in zip(lists[i], lists[i-1])]
  diffs.append(diff) 
  
for diff in diffs:
  if diff[0] < abs(diff[1]) + abs(diff[2]):
    print('No')
    exit()
  elif diff[0] % 2 != (abs(diff[1]) + abs(diff[2])) % 2:
    print('No')
    exit()
print('Yes')
Problem:
You are given nonnegative integers a and b (a ≤ b), and a positive integer x. Among the integers between a and b, inclusive, how many are divisible by x?

Incorrect submission (verdict: Wrong Answer):
a,b,c=map(int,input().split())
print((a-1)//c+b//c)

Fixed, accepted submission:
a,b,c=map(int,input().split())
print(b//c-(a-1)//c)
Problem:
There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total?

Incorrect submission (verdict: Wrong Answer):
n = int(input())
print(((1 + n) * n) / 2)


Fixed, accepted submission:
n = int(input())
print(int(((1 + n) * n) / 2))
Problem:
Three poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right. We will call the arrangement of the poles _beautiful_ if the tops of the poles lie on the same line, that is, b-a = c-b.  Determine whether the arrangement of the poles is beautiful.

Incorrect submission (verdict: Wrong Answer):
A=list(map(int, input().split()))
A.sort()
if A[0]+A[2]==A[1]:
  print('YES')
else:
  print('NO')

Fixed, accepted submission:
a, b, c = map(int, input().split())
print("YES" if b - a == c - b else "NO")
Problem:
We will buy a product for N yen (the currency of Japan) at a shop.  If we use only 1000-yen bills to pay the price, how much change will we receive?  Assume we use the minimum number of bills required.

Incorrect submission (verdict: Wrong Answer):
print(int(input())%1000)

Fixed, accepted submission:
print((1000-int(input())%1000)%1000)
Problem:
In the online judge system, a judge file may include multiple datasets to check whether the submitted program outputs a correct answer for each test case. This task is to practice solving a problem with multiple datasets.  Write a program which reads an integer x and print it as is. Note that multiple datasets are given for this problem.

Incorrect submission (verdict: Wrong Answer):
a = list(map(int,input().split()))
if a[-1] != 0:
    for i in range(len(a)):
        print("Case {}: {}".format(i, a[i]))
else:
    for i in range(len(a)-1):
        print("Case {}: {}".format(i, a[i]))

Fixed, accepted submission:
import sys
cnt = 1
while True:
    x = sys.stdin.readline().strip()
    if x == "0":
        break
    print("Case {}: {}".format(cnt,x))
    cnt += 1
Problem:
Two children are playing tag on a number line. (In the game of tag, the child called "it" tries to catch the other child.) The child who is "it" is now at coordinate A, and he can travel the distance of V per second. The other child is now at coordinate B, and she can travel the distance of W per second.  He can catch her when his coordinate is the same as hers. Determine whether he can catch her within T seconds (including exactly T seconds later). We assume that both children move optimally.

Incorrect submission (verdict: Wrong Answer):
a,v = map(int, input().split())
b,w = map(int, input().split())
t = int(input())

if(b > a):
    if(b + w*t < a + v*t):
        print('Yes')
    else:
        print('No')
if(b < a):
    if(b - w*t > a - v*t):
        print('Yes')
    else:
        print('No')


Fixed, accepted submission:
a,v = map(int, input().split())
b,w = map(int, input().split())
t = int(input())

if(b > a):
    if(b + w*t <= a + v*t):
        print('YES')
    else:
        print('NO')
if(b < a):
    if(b - w*t >= a - v*t):
        print('YES')
    else:
        print('NO')
Problem:
AtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.  If AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1). Note that **he cannot stay at his place**. Determine whether he can carry out his plan.

Incorrect submission (verdict: Wrong Answer):
n = int(input())
t = 0
for i in range(n):
    
    a, b, c = map(int, input().split())
    if abs(a) + abs(b) > c:
        t += 1
if t != 0:
    print('No')
else:
    print('Yes')

Fixed, accepted submission:
n = int(input())
f = True
for i in range(n):
    t, x, y = map(int, input().split())
    if t < x + y or t % 2 != (x+y) % 2:
        f = False
        break
if f == True:
    print('Yes')
else:
    print('No')
Problem:
The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`.  You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom.

Incorrect submission (verdict: Wrong Answer):

a,b = map(int,input().split())
s = list(input())
num = [0,1,2,3,4,5,6,7,8,9]
status = False

if s[a] != "-":
    print("No")
    exit()
else:
    for i in range(len(s)):
        if i == a:
            pass
        else:
            if s[i] not in num:
                print("No")
                exit()

print("Yes")


Fixed, accepted submission:

a,b = map(int,input().split())
s = list(input())
ans = 0

if s[a] == "-":
    s.pop(a)
    if s.count("-") == 0:
        print("Yes")
    else:
        print("No")

else:
    print("No")
Problem:
You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively.    An example of a trapezoid  Find the area of this trapezoid.

Incorrect submission (verdict: Wrong Answer):
a = int(input())
b = int(input())
h = int(input())
print(((a + b) * h) / 2)

Fixed, accepted submission:
a = int(input())
b = int(input())
h = int(input())
print(int(((a + b) * h) / 2))
Problem:
In AtCoder, a person who has participated in a contest receives a _color_ , which corresponds to the person's rating as follows:    * Rating 1-399 : gray   * Rating 400-799 : brown   * Rating 800-1199 : green   * Rating 1200-1599 : cyan   * Rating 1600-1999 : blue   * Rating 2000-2399 : yellow   * Rating 2400-2799 : orange   * Rating 2800-3199 : red  Other than the above, a person whose rating is 3200 or higher can freely pick his/her color, which can be one of the eight colors above or not.   Currently, there are N users who have participated in a contest in AtCoder, and the i-th user has a rating of a_i.   Find the minimum and maximum possible numbers of different colors of the users.

Incorrect submission (verdict: Wrong Answer):
n = int(input())
scorelist = list(map(int, input().split(" ")))
color1 = len(list([int(i/400) for i in scorelist if i < 3200]))
color2 = len([i for i in scorelist if i >= 3200])
ans_min = max(1, color1)
ans_max = color1 + color2
print("{} {}".format(ans_min, ans_max))

Fixed, accepted submission:
n = int(input())
scorelist = list(map(int, input().split(" ")))
color1 = len(set([int(i/400) for i in scorelist if i < 3200]))
color2 = len([i for i in scorelist if i >= 3200])
ans_min = max(1, color1)
ans_max = color1 + color2
print("{} {}".format(ans_min, ans_max))
Problem:
与えられた変換表にもとづき，データを変換するプログラムを作成しなさい．  データに使われている文字は英字か数字で，英字は大文字と小文字を区別する．変換表に現れる文字の順序に規則性はない．  変換表は空白をはさんで前と後ろの 2 つの文字がある(文字列ではない)．変換方法は，変換表のある行の前の文字がデータに現れたら，そのたびにその文字を後ろの文字に変換し出力する．変換は 1 度だけで，変換した文字がまた変換対象の文字になっても変換しない．変換表に現れない文字は変換せず，そのまま出力する．  入力ファイルには，変換表（最初の n + 1 行）に続き変換するデータ（n + 2 行目以降）が書いてある． 1 行目に変換表の行数 n，続く n 行の各行は，空白をはさんで 2 つの文字，さらに続けて， n + 2 行目に変換するデータの行数 m，続く m 行の各行は 1 文字である． m ≤ 105 とする．出力は，出力例のように途中に空白や改行は入れず 1 行とせよ．  入力例   ---   3   A a   0 5   5 4   10   A   B   C   0   1   4   5   a   b   A   出力例   aBC5144aba

Incorrect submission (verdict: Wrong Answer):
x = int(input())
i = 0
dcl = dict()
while True:
    inp = list(map(str, input().split()))
    dcl[inp[0]] = inp[1]
    i += 1
    if i == x:
        break

x = int(input())
i = 0
ans = ""
while True:
    y = str(input())
    if y in dcl:
        ans += dcl[y]
    else:
        ans += y

    i += 1
    if i == x:
        break
print(ans)

Fixed, accepted submission:
while True:
    n = int(input())
    if n == 0:
        break
    converter = {}
    for _ in range(n):
        k, v = input().split()
        converter[k] = v

    m = int(input())
    ans = []
    for _ in range(m):
        v = input().strip()
        try:
            ans.append(converter[v])
        except:
            ans.append(v)

    print("".join(ans))
Problem:
Snuke is making sugar water in a beaker. Initially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations.    * Operation 1: Pour 100A grams of water into the beaker.   * Operation 2: Pour 100B grams of water into the beaker.   * Operation 3: Put C grams of sugar into the beaker.   * Operation 4: Put D grams of sugar into the beaker.  In our experimental environment, E grams of sugar can dissolve into 100 grams of water.  Snuke will make sugar water with the highest possible density.  The beaker can contain at most F grams of substances (water and sugar combined), and there must not be any undissolved sugar in the beaker. Find the mass of the sugar water Snuke will make, and the mass of sugar dissolved in it. If there is more than one candidate, any of them will be accepted.  We remind you that the sugar water that contains a grams of water and b grams of sugar is \frac{100b}{a + b} percent. Also, in this problem, pure water that does not contain any sugar is regarded as 0 percent density sugar water.

Incorrect submission (verdict: Time Limit Exceeded):
A, B, C, D, E, F = map(int, input().split())
maxDensity = 0
ans_water = 0
ans_sugar = 0

for i in range(31):
    for j in range(31):
        for k in range(101):
            for l in range(101):
                water = (i * A + j * B) * 100
                sugar = k * C + l * D
                if water + sugar > F:
                    continue
                if sugar * 100 > water * E:
                    continue
                if sugar + water == 0:
                    density = 0
                else:
                    density = sugar / (sugar + water)
                if maxDensity < density:
                    ans_water = water
                    ans_sugar = sugar
                    maxDensity = density


print(ans_water + ans_sugar, ans_sugar)


Fixed, accepted submission:
A, B, C, D, E, F = map(int, input().split())
maxDensity = 0
ans_water = A * 100
ans_sugar = 0

for i in range(F // (100 * A) + 1):
    for j in range(F // (100 * B) + 1):
        water = (i * A + j * B) * 100
        rest = F - water
        if water > F:
            continue
        for k in range(rest // C + 1):
            for l in range(rest // D + 1):
                sugar = k * C + l * D
                if water + sugar > F:
                    continue
                if sugar * 100 > water * E:
                    continue
                if sugar + water == 0:
                    density = 0
                else:
                    density = sugar / (sugar + water)
                if maxDensity < density:
                    ans_water = water
                    ans_sugar = sugar
                    maxDensity = density


print(ans_water + ans_sugar, ans_sugar)
Problem:
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:  

Incorrect submission (verdict: Wrong Answer):
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

Fixed, accepted submission:
from sys import stdin
import math

h,w = [int(x) for x in stdin.readline().rstrip().split()]
if (h==1)|(w==1):
    ans = 1
else:
    ans = int(w/2)*h + (w%2)*math.ceil(h/2)
print(ans)