TnT/CodeNet4Repair huggingface dataset:
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())
A = list(map(int, input().split()))

l = {}
for a in A:
	k = a // 400
	k = min(k, 8)
	if k not in l:
		l[k] = 1
	else:
		l[k] += 1
#print(l)
print(max(1, len(l) - 1), max(1, len(l) - 1 + l[8] if 8 in l else 0))


Fixed, accepted submission:
N = int(input())
A = list(map(int, input().split()))

l = {}
for a in A:
	k = a // 400
	k = min(k, 8)
	if k not in l:
		l[k] = 1
	else:
		l[k] += 1
#print(l)
if 8 in l:
	print(max(1, len(l) - 1), max(1, len(l) - 1 + l[8]))
else:
	print(len(l), len(l))
Problem:
An integer X is called a Harshad number if X is divisible by f(X), where f(X) is the sum of the digits in X when written in base 10.  Given an integer N, determine whether it is a Harshad number.

Incorrect submission (verdict: Wrong Answer):
N = input()
n = 0
for a in N:
    n += int(ord(a) - ord('1') + 1)
if int(N) % n == 0:
    print('YES')
else:
    print('NO')


Fixed, accepted submission:
N = input()
n = 0
for a in N:
    n += int(ord(a) - ord('1') + 1)
if int(N) % n == 0:
    print('Yes')
else:
    print('No')
Problem:
Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order.  To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each of the phrases once, in some order.

Incorrect submission (verdict: Wrong Answer):
a, b, c = map(int, input().split())
at = 0
bt = 0
ct = 0

if a == 5 :
    at += 1
elif a == 7 :
    at += 10

if b == 5 :
    bt += 1
elif b == 7 :
    bt += 10

if c == 5 :
    ct += 1
elif c == 7 :
    ct += 10


if  at + bt + ct == 21 :
    print("YES")

else :
    print("NO")

Fixed, accepted submission:
a, b, c = map(int,input().split())
at = 0
bt = 0
ct = 0

if a == 5 :
    at += 1
elif a == 7 :
    at += 10

if b == 5 :
    bt += 1
elif b == 7 :
    bt += 10

if c == 5 :
    ct += 1
elif c == 7 :
    ct += 10


if  at + bt + ct == 12 :
    print("YES")

else :
    print("NO")
Problem:
There are N positive integers written on a blackboard: A_1, ..., A_N.  Snuke can perform the following operation when all integers on the blackboard are even:    * Replace each integer X on the blackboard by X divided by 2.  Find the maximum possible number of operations that Snuke can perform.

Incorrect submission (verdict: Wrong Answer):
input()
A = list(map(int,input().split()))
count=0
while all(i%2==0 for i in A):
  A = [i/2 for i in A]
  count+=1
  print(count)

Fixed, accepted submission:
input()
A = list(map(int,input().split()))
count=0
while all(i%2==0 for i in A):
    A = [i/2 for i in A]
    count+=1
print(count)
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: Wrong Answer):
a,b,c,d,e,f=[int(i) for i in input().split(' ')]
a=a*100
b=b*100
am = f//a
bm = f//b
cm = int((f/((100+e)/e))//c)
dm = int((f/((100+e)/e))//d)
print(a,b,c,d,am,bm,cm,dm)

yl=0
yn=0
ys=0
for i_a in range(am):
  la=i_a*a
  for i_b in range(bm):
    lb=i_b*b
    if 0<la+lb<=f:
      for i_c in range(cm):
        lc=i_c*c
        if 0<la+lb+lc<=f:
          for i_d in range(dm):
            ld=i_d*d
            if 0<la+lb+lc+ld<=f:
              if (lc+ld)/(la+lb+lc+ld) <= e/(100+e):
                n=(lc+ld)/(la+lb+lc+ld)
                if n > yn:
                  yn=n
                  yl=la+lb+lc+ld
                  ys=lc+ld
print(yl,ys)

Fixed, accepted submission:
a,b,c,d,e,f=[int(i) for i in input().split(' ')]
a=a*100
b=b*100
am = f//a
bm = f//b
cm = int((f/((100+e)/e))//c)
dm = int((f/((100+e)/e))//d)

yl=0
yn=0
ys=0
for i_a in range(am+1):
  la=i_a*a
  for i_b in range(bm+1):
    lb=i_b*b
    if 0<la+lb<=f:
      for i_c in range(cm+1):
        lc=i_c*c
        if 0<la+lb+lc<=f:
          for i_d in range(dm+1):
            ld=i_d*d
            if 0<la+lb+lc+ld<=f:
              if (lc+ld)/(la+lb+lc+ld) <= e/(100+e):
                n=(lc+ld)/(la+lb+lc+ld)
                if n >= yn:
                  yn=n
                  yl=la+lb+lc+ld
                  ys=lc+ld
print(yl,ys)
Problem:
Write a program which reads three integers a, b and c, and prints the number of divisors of c between a and b.

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

k=0
for j in range(a,b):
     if c%j==0:
          k+=1
print(j)
     


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

k=0
for j in range(a,b+1):
     if c%j==0:
          k+=1

print(k)
Problem:
Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order.  To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each of the phrases once, in some order.

Incorrect submission (verdict: Wrong Answer):
from sys import stdin
input1=stdin.readline().rstrip().split()
N=int(input1[0])
L=int(input1[1])
input=[]
for n in range(N):
  input.append(stdin.readline().rstrip())

input.sort()
output=""
for i in range(len(input)):
  output+=input[i]

print(output)

Fixed, accepted submission:
from sys import stdin
input=stdin.readline().rstrip().split()
for i in range(len(input)):
  input[i]=int(input[i])

if input.count(5)==2:
  if input.count(7)==1:
    print("YES")
else:
  print("NO")
Problem:
You are given a string S of length N consisting of lowercase English letters. We will cut this string at one position into two strings X and Y. Here, we would like to maximize the number of different letters contained in both X and Y. Find the largest possible number of different letters contained in both X and Y when we cut the string at the optimal position.

Incorrect submission (verdict: Wrong Answer):
N=int(input())
S=input()
count_max=0
for i in range(1,N):
    X=S[:i]
    Y=S[i:]
    count=0
    for character in X:
        if character in Y:
            count+=1
    count_max=max(count, count_max)
print(count_max)

Fixed, accepted submission:
N=int(input())
S=input()
count_max=0
for i in range(1,N):
    X=S[:i]
    Y=S[i:]
    count=0
    character_in_X=[]
    for character in X:
        if character not in character_in_X:
            character_in_X.append(character)
    for character in character_in_X:
        if character in Y:
            count+=1
    count_max=max(count, count_max)
print(count_max)
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>=0:
  print("delicious")
elif -x<=b-a<0:
  print("safe")
else:
  print("dangerous")

Fixed, accepted submission:
x,a,b=map(int,input().split())
if a-b>=0:
  print("delicious")
elif -x<=a-b<0:
  print("safe")
else:
  print("dangerous")
Problem:
You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:    * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`.

Incorrect submission (verdict: Wrong Answer):
s = input()

s_rev = s[::-1]
T_list = ['maerd', 'remaerd', 'esare', 'resare']

def mojicut(s, r):
    n = s.replace(r, "", 1)
    return n

while len(s_rev) > 0:
    s_len = len(s_rev)
    for i in T_list:
        if s_rev.startswith(i):
            s_rev = mojicut(s_rev, i)
            break
    if len(s_rev) == s_len:
        break

if len(s_rev) > 0:
    print("No")
else:
    print("Yes")

Fixed, accepted submission:
s = input()
s_rev = s[::-1]
T_list = ['maerd', 'remaerd', 'esare', 'resare']
 
def mojicut(s, r):
    n = s.replace(r, "", 1)
    return n
 
 
while len(s_rev) > 0:
    s_len = len(s_rev)
    for i in T_list:
        if s_rev.startswith(i):
            s_rev = mojicut(s_rev, i)
            break
    if len(s_rev) == s_len:
        break
 
if len(s_rev) > 0:
    print("NO")
else:
    print("YES")
Problem:
Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7.  Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation:    * Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward.  For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure. If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward. Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back.    Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.

Incorrect submission (verdict: Wrong Answer):
N = int(input()) 
num = N // 11
res = 0
k = 0
k = res * 11
if N % 11 == 0:
  res = num * 2
else:
  res = num * 2 + 1
  k += 5
  if k < N:
    res = num * 2 + 1
    k += 6
print(res)

Fixed, accepted submission:
N = int(input()) 
num = N // 11
res = num * 2
k = num * 11
if 0< N % 11 <= 6:
  res +=  1
elif 7<= N % 11 <= 10:
  res +=  2
else:
  pass  
print(res)
Problem:
We conducted a survey on newspaper subscriptions. More specifically, we asked each of the N respondents the following two questions:    * Question 1: Are you subscribing to Newspaper X?   * Question 2: Are you subscribing to Newspaper Y?  As the result, A respondents answered "yes" to Question 1, and B respondents answered "yes" to Question 2.  What are the maximum possible number and the minimum possible number of respondents subscribing to both newspapers X and Y?  Write a program to answer this question.

Incorrect submission (verdict: Wrong Answer):
N,A,B = map(int,input().split())
print(max(A,B),min(A,B))

Fixed, accepted submission:
N,A,B = map(int,input().split())
print(min(A,B),0 if min(A,B)-N+max(A,B) < 0 else min(A,B)-N+max(A,B))
Problem:
The commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word "bill" refers to only these.  According to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.

Incorrect submission (verdict: Wrong Answer):
n, y = map(int, input().split())
d = y - 1000*n
a = d // 9000
ab = []
for i in range(a+1):
  d2 = d - 9000*i
  b = d2 // 4000
  for j in range(b+1):
    d3 = d2 - 4000*j
    if d3 == 0:
      ab.append(i)
      ab.append(j)
if len(ab) == 0:
  print(-1,-1,-1)
else:
  c = n - ab[0] - ab[1]
  if c >= 0:
    print(ab[0], ab[1], c)
  else:
    print(-1,-1,-1)

Fixed, accepted submission:
n, y = map(int, input().split())
for i in range(n+1):
  for j in range(n+1):
    if 10000*n - 5000*i - 9000*j == y and n-i-j>=0:
      print(n-i-j, i, j)
      quit()
print(-1,-1,-1)
Problem:
Snuke built an online judge to hold a programming contest.  When a program is submitted to the judge, the judge returns a verdict, which is a two-character string that appears in the string S as a contiguous substring. (The judge can return any two-character substring of S.)  Determine whether the judge can return the string `AC` as the verdict to a program.

Incorrect submission (verdict: Wrong Answer):
from collections import deque
s = deque(input())
print(s)
le = len(s)
cnt = 0
while le>1:
  if s[0] == s[-1]:
    s.pop()
    s.popleft()
    le -= 2
  elif s[0] == "x":
    s.popleft()
    cnt += 1
    le -= 1
  elif s[-1] == "x":
    s.pop()
    cnt += 1
    le -= 1
  else:
    print(-1)
    break
  print(s)
else:
  print(cnt)

Fixed, accepted submission:
s = input()
for i in range(len(s)-1):
  if s[i:i+2] == "AC":
    print("Yes")
    exit()
print("No")
Problem:
2008 年 4 月に、会津若松市は長さ20 m 85 cm のやきとり作りに挑戦して成功しました。このとき使われた鶏肉が、会津特産の会津地鶏です。会津地鶏はとてもおいしいのですが、飼育がむずかしいので生産量が少なく、値段が高いのが難点です。         今日は一郎君の家に、遠くから親戚が遊びに来ます。お母さんは鶏肉の水炊きを作って親戚をもてなすことにしました。近くのお肉屋さんでは会津地鶏とふつうの鶏肉の 2 種類の鶏肉を売っています。お母さんは、以下のような指示を一郎君に与えて、お肉屋さんに行って鶏肉を買ってくるように 頼みました。    * 鶏肉が足りなくなると困るので、決められた量以上の鶏肉を買う。   * 予算の許す範囲で会津地鶏をできるだけ多く買う(会津地鶏は必ず買うこと)。   * 会津地鶏を買った残りでふつうの鶏肉をできるだけ多く買う(予算が足りなければ買わない)。  一郎君がお肉屋さんに行くと、会津地鶏が品薄のため一人が買える量を制限していました。一郎君が、お母さんから与えられたすべての指示を守って買い物をするとき、一郎君が買う会津地鶏と普通の鶏肉の量はそれぞれ何グラムになるでしょう?  買うべき鶏肉の量の下限 q1、予算 b、このお肉屋さんでの会津地鶏 100 グラムの値段 c1、ふつうの鶏肉 100 グラムの値段 c2、会津地鶏を一人が買える量の上限 q2 を入力とし、一郎君が買う会津地鶏とふつうの鶏肉の量を 100 グラム単位で出力するプログラムを作成してください。ただし、このお肉屋さんではお母さんの指示通りに買えない場合には、「NA」と出力してください。

Incorrect submission (verdict: Wrong Answer):

#
import sys, math, os, bisect

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


def aizu_chicken(q1, b, c1, c2, q2):
    for i in range(q2, 0, -1):
        cj = i * c1
        normal = int((b - cj) / c2)
        if i + normal < q1:
            continue
        elif normal >= 0:
            print(i, normal)
            break
    else:
        print("NA")


while True:
    inp = [int(_) for _ in input().split()]
    if len(inp) == 1:
        break
    q1, b, c1, c2, q2 = inp[:]
    aizu_chicken(q1, b, c1, c2, q2)

Fixed, accepted submission:

#
import sys, math, os, bisect

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


def aizu_chicken(q1, b, c1, c2, q2):
    for i in range(q2, 0, -1):
        cj = i * c1
        normal = int((b - cj) // c2)
        if i + normal < q1:
            continue
        elif normal >= 0:
            print(i, normal)
            break
    else:
        print("NA")


while True:
    inp = [int(_) for _ in input().split()]
    if len(inp) == 1:
        break
    q1, b, c1, c2, q2 = inp[:]
    aizu_chicken(q1, b, c1, c2, q2)
Problem:
We have a tree with N vertices numbered 1 to N. The i-th edge in the tree connects Vertex u_i and Vertex v_i, and its length is w_i. Your objective is to paint each vertex in the tree white or black (it is fine to paint all vertices the same color) so that the following condition is satisfied:    * For any two vertices painted in the same color, the distance between them is an even number.  Find a coloring of the vertices that satisfies the condition and print it. It can be proved that at least one such coloring exists under the constraints of this problem.

Incorrect submission (verdict: Wrong Answer):
import math
import collections
import itertools
import sys
import bisect
from heapq import heappop,heappush,heapify
sys.setrecursionlimit(10**6)
def MAP(): return list(map(int,input().split()))
def INT(): return int(input())
def FLOAT(): return float(input())
MOD = 10**9+7


N = INT()
G = [dict() for _ in range(N)]
for i in range(N-1):
    u,v,w=map(int,input().split())
    G[u-1][v-1]=w
    G[v-1][u-1]=w
color=[-1 for _ in range(N)]
dist=[-1 for _ in range(N)]
dist[0]=0
q=[0]
while q:
    r=q.pop()
    for p in G[r]:
        print(p)
        if dist[p]!=-1:
            continue
        dist[p]=dist[r]+G[r][p]
        q.append(p)
for i in range(N):
    color[i]=dist[i]%2
for ans in color:
    print(ans)

Fixed, accepted submission:
import math
import collections
import itertools
import sys
import bisect
from heapq import heappop,heappush,heapify
sys.setrecursionlimit(10**6)
def MAP(): return list(map(int,input().split()))
def INT(): return int(input())
def FLOAT(): return float(input())
MOD = 10**9+7


N = INT()
G = [dict() for _ in range(N)]
for i in range(N-1):
    u,v,w=map(int,input().split())
    G[u-1][v-1]=w
    G[v-1][u-1]=w
color=[-1 for _ in range(N)]
dist=[-1 for _ in range(N)]
dist[0]=0
q=[0]
while q:
    r=q.pop()
    for p in G[r]:
        if dist[p]!=-1:
            continue
        dist[p]=dist[r]+G[r][p]
        q.append(p)
for i in range(N):
    color[i]=dist[i]%2
for ans in color:
    print(ans)
Problem:
Write a program which reads two integers a, b and an operator op, and then prints the value of a op b.  The operator op is '+', '-', '*' or '/' (sum, difference, product or quotient). The division should truncate any fractional part.

Incorrect submission (verdict: Wrong Answer):
def main():
    a, op, b = input().split()
    a,b = int(a), int(b)
    op_dict = {'+': (lambda x,y: x + y),
               '-': (lambda x,y: x - y),
               '*': (lambda x,y: x * y),
               '/': (lambda x,y: x / y),
               '?': '?'}
    func = op_dict[op]
    if func == '?': return 0
    print('%d' % int(func(a, b)))

main()

Fixed, accepted submission:
while True:
    a, op, b = input().split()
    a,b = int(a), int(b)
    op_dict = {'+': (lambda x,y: x + y),
               '-': (lambda x,y: x - y),
               '*': (lambda x,y: x * y),
               '/': (lambda x,y: x // y),
               '?': '?'}
    func = op_dict[op]
    if func == '?': break 
    print('%d' % int(func(a, b)))
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):
N = int(input())
S = []
count_AC = 0
count_WA = 0
count_TLE = 0
count_RE = 0
for _ in range(N):
  S.append(input())
for i in S:
  if i == "AC":
    count_AC += 1
  elif i == "WA":
    count_WA += 1
  elif i == "TLE":
    count_TLE += 1
  elif i == "RE":
    count_RE += 1
  else:
    pass
print("AC" + "x" + str(count_AC),
      "WA" + "x" + str(count_WA),
      "TLE" + "x" + str(count_TLE),
      "RE" + "x" + str(count_RE),
     )


Fixed, accepted submission:
N = int(input())
S = []
count_AC = 0
count_WA = 0
count_TLE = 0
count_RE = 0
for _ in range(N):
  S.append(input())
for i in S:
  if i == "AC":
    count_AC += 1  
  elif i == "WA":
    count_WA += 1    
  elif i == "TLE":
    count_TLE += 1
  elif i == "RE":
    count_RE += 1
  else:
    pass
a = "AC" + " " + "x" + " " + str(count_AC)
b = "WA" + " " + "x" + " " + str(count_WA)
c = "TLE" + " " + "x" + " " + str(count_TLE)
d = "RE" + " " + "x" + " " + str(count_RE)
print(a, b, c, d, sep="\n")
Problem:
You have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan). In how many ways can we select some of these coins so that they are X yen in total?  Coins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that coin are different.

Incorrect submission (verdict: Wrong Answer):
a=int(input())
b=int(input())
c=int(input())
x=int(input())

count=0
for i in range(a+1):
	for j in range(b+1):
		for k in range(c+1):
			sum = 500*i+100*j+50*k
			if(x%50==0 and sum == x):
				count+=1


Fixed, accepted submission:
a=int(input())
b=int(input())
c=int(input())
x=int(input())

count=0
for i in range(a+1):
	for j in range(b+1):
		for k in range(c+1):
			sum = 500*i+100*j+50*k
			if(x%50==0 and sum == x):
				count+=1

print(count)
Problem:
It is November 18 now in Japan. By the way, 11 and 18 are adjacent Lucas numbers.  You are given an integer N. Find the N-th Lucas number.  Here, the i-th Lucas number L_i is defined as follows:    * L_0=2   * L_1=1   * L_i=L_{i-1}+L_{i-2} (i≥2)

Incorrect submission (verdict: Wrong Answer):
l0,l1=2,1

for i in range(int(input())-1):
    l0,l1=l1,l0+l1

print(l0)

Fixed, accepted submission:
l0,l1=2,1

for i in range(int(input())):
    l0,l1=l1,l0+l1

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

Fixed, accepted submission:
H,W = map(int, input().split())



def is_odd(num):
    return num % 2 ==1

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



print(int(ans))