Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

ans = []
if not n % 2:
    ans.append(a[0])
    a = a[1:]

while len(a) > 1:
    ans.insert(0, a[0])
    ans.append(a[1])
    a = a[2:]

if len(a):
    ans.insert(0, a[0])

print(*ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = []
if n % 2:
    ans += a[:1]
    a = a[1:]
ans += a[1::2]
ans.reverse()
ans += a[::2]
print(*ans)
Buggy python submission (verdict: Time Limit Exceeded):
lim = 10 ** 9 + 7
n = int(input())
result = 1
for q in range(n):
    result *= q + 1
print(result % lim)

Fixed submission:
lim = 1000000007
result = 1
n = int(input())

for q in range(n):
    result = result % lim
    result *= q + 1
print(result % lim)
Buggy python submission (verdict: Runtime Error):
a, b, c = sorted(list(map(int, input().split())))

count  = (b - a) // 2
count += 2 if (a + count * 2) != b else 0
count += c - b
print(count)


Fixed submission:
input()

print("NO" if sum(map(int, input().split())) % 2 else "YES")
Buggy python submission (verdict: Runtime Error):
w, h, n = map(int, input().split())
ll_x, ll_y, tr_x, tr_y = 0, 0, w, h
for q in range(n):
    x, y, a = map(int, input().split())
    if a == 1:
        ll_x = max(ll_x, x)
    elif a == 2:
        tr_x = min(tr_x, x)
    elif a == 3:
        ll_y = max(ll_y, y)
    elif a == 4:
        tr_y = min(tr_y, y)
print(f"({ll_x}, {ll_y}), ({tr_x}, {tr_y})")
ans = (tr_x - ll_x) * (tr_y - ll_y)
print(ans if ans > 0 else 0)

Fixed submission:
w, h, n = map(int, input().split())
ll_x, ll_y, tr_x, tr_y = 0, 0, w, h
for q in range(n):
    x, y, a = map(int, input().split())
    if a == 1:
        ll_x = max(ll_x, x)
    elif a == 2:
        tr_x = min(tr_x, x)
    elif a == 3:
        ll_y = max(ll_y, y)
    elif a == 4:
        tr_y = min(tr_y, y)
ans = (tr_x - ll_x) * (tr_y - ll_y)
if (ll_x > tr_x) or (ll_y > tr_y):
    ans = 0
print(ans if ans > 0 else 0)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
while "B" in s:
    s = s.replace("1B", "").replace("0B", "")
print(s.replace("B", ""))

Fixed submission:
s, s_back = input(), ""
while "B" in s:
    s = s.replace("1B", "").replace("0B", "")
    if s_back == s:
        break
    s_back = s
print(s.replace("B", ""))
Buggy python submission (verdict: Runtime Error):
X = input(int())
 
if 30 <= X  :
	print("Yes")
else :
    print("No")

Fixed submission:
print("Yes") if int(input()) >= 30 else print("No")

Buggy python submission (verdict: Runtime Error):
X = input()
 
if 30 =< X :
	print("Yes")
else :
    print("No")

Fixed submission:
print("Yes") if int(input()) >= 30 else print("No")

Buggy python submission (verdict: Runtime Error):
X = input()
 
if 30 <= X :
	print("Yes")
else :
    print("No")

Fixed submission:
print("Yes") if int(input()) >= 30 else print("No")

Buggy python submission (verdict: Runtime Error):
X=input(
if 30<=X :
	print("Yes")
else :
    print("No")

Fixed submission:
print("Yes") if int(input()) >= 30 else print("No")

Buggy python submission (verdict: Runtime Error):
X=input()
 
if 30<=X :
	print("Yes")
else :
    print("No")

Fixed submission:
print("Yes") if int(input()) >= 30 else print("No")

Buggy python submission (verdict: Runtime Error):
X=input()
 
if 30<=X :
  print("Yes")
else :
  print("No")

Fixed submission:
print("Yes") if int(input()) >= 30 else print("No")

Buggy python submission (verdict: Runtime Error):
X=input(int())
 
if X=>30 :
  print("Yes")
else :
  print("No")

Fixed submission:
print("Yes") if int(input()) >= 30 else print("No")

Buggy python submission (verdict: Runtime Error):
X=input()
 
if X=>30. :
  print("Yes")
else :
  print("No")

Fixed submission:
print("Yes") if int(input()) >= 30 else print("No")

Buggy python submission (verdict: Runtime Error):
X=input()

if X=>30 :
  print("Yes")
else :
  print("No")
  
  

Fixed submission:
print("Yes") if int(input()) >= 30 else print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
D = int(input())
an=0
for _ in range(N):
  X, Y= map(int, input().split())
  if X**2+Y**2<=D**2:
    an +=1
print(an)   



Fixed submission:
N, D = map(int, input().split())
an=0
for i in range(N):
  X, Y= map(int, input().split())
  if X**2+Y**2<=D**2:
    an +=1
print(an)

Buggy python submission (verdict: Runtime Error):
N = int(input())
D = int(input())
an=0
for i in range(N):
  X, Y= map(int, input().split())
  if X**2+Y**2<=D**2:
    an +=1
print(an)   


Fixed submission:
N, D = map(int, input().split())
an=0
for i in range(N):
  X, Y= map(int, input().split())
  if X**2+Y**2<=D**2:
    an +=1
print(an)
Buggy python submission (verdict: Runtime Error):
a,b,c,k = input().split(None, 4)
A = int(a)
B = int(b)
C = int(c)
K = int(k)
X = K - A - B
if K <= A:
    print(K)
elif A < K <= A + B:
    print(A)
else A + B < K:
    print(A - X)

Fixed submission:
a,b,c,k = input().split(None, 4)
A = int(a)
B = int(b)
C = int(c)
K = int(k)
X = K - A - B
if K <= A:
    print(K)
elif A < K <= A + B:
    print(A)
else:
    print(A - X)
Buggy python submission (verdict: Runtime Error):
n = len(s)
sa = s[:int((n-1)/2)]
sb = s[int((n+3)/2)-1:]
if s == s[::-1] and sa == sa[::-1] and sb == sb[::-1]:
    print("Yes")
else:
    print("No")


Fixed submission:
s = input()
n = len(s)
sa = s[:int((n-1)/2)]
sb = s[int((n+3)/2)-1:]
if s == s[::-1] and sa == sa[::-1] and sb == sb[::-1]:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
n = len(s)
sa = s[:(n-1)//2]
sb = s[(n+3)//2-1:n]
if s == s[::-1] and sa == sa[::-1] and sb == sb[::-1]:
    print("Yes")
else:
    print("No")

Fixed submission:
s = input()
n = len(s)
sa = s[:int((n-1)/2)]
sb = s[int((n+3)/2)-1:]
if s == s[::-1] and sa == sa[::-1] and sb == sb[::-1]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
a,b,k = input().split(None, 3)
A = int(a)
B = int(b)
K = int(k)
Ta = 0
Ao = 0

if A >= K:
  Ta = A-k
  Ao = B

elif A+B >= K > A :
  Ta = 0
  Ao = B - (K-A)

else:
  Ta = 0
  Ao = 0

print(Ta,Ao)

Fixed submission:
a,b,k = input().split(None, 3)
A = int(a)
B = int(b)
K = int(k)

if A >= K:
  print(A-K,B)

elif A+B >= K > A :
  print(0, B -K+A)

else:
  print(0,0)
Buggy python submission (verdict: Runtime Error):
N = int(input())
for i in range(1,9):
    for j in range(1,9):
       if i*j == N:
         break
　　　　　print("YES")
       else:
          print("NO")

Fixed submission:
N = int(input())
for i in range(1,10):
 for j in range(1,10):
  if i*j == N:
   print("Yes")
   exit()
print("No")
Buggy python submission (verdict: Runtime Error):
k = int(input())
a = [None]*1000001
a[1]=7%k
n=0

for i in range(2:k+1):
    a[i]=(a[i-1]*10+7)%k
    if a[i]==0 and n==0:
        print("{}".format(i))
        n=1
if n==0:
    print("-1")


Fixed submission:
k = int(input())
a = [None]*1000001
a[1]=7%k
n=0

if a[1]==0:
    print("1")
    n=1

for i in range(2,k+1):
    a[i]=(a[i-1]*10+7)%k
    if a[i]==0 and n==0:
        print("{}".format(i))
        n=1
if n==0:
    print("-1")
Buggy python submission (verdict: Runtime Error):
X = input()
if X>=30:
  print("Yes")
else:
  print("No")

Fixed submission:
X = int(input())
if X>=30:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())

N=7
NotFound = True

for i in range(K):
  if N%K == 0:
    NotFound = False
    print(i+1)
    break
  N=N*10+7

if (NotFound):
  print(-1)

Fixed submission:
K = int(input())

N=7%K
NotFound = True

for i in range(K):
  if N == 0:
    NotFound = False
    print(i+1)
    break
  N=(N*10+7)%K

if (NotFound):
  print(-1)
Buggy python submission (verdict: Runtime Error):
import sys

def cirCle(r: int):
 ans = r ** 2
 print(ans)
 return()


if __name__ == '__main__':
  args = sys.argv
  cirCle(int(args[1]))

Fixed submission:
import sys

def cirCle(r: int):
 ans = r ** 2
 print(ans)
 return()


if __name__ == '__main__':
  args = input()
  cirCle(int(args))
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
c = n/2
stt = s[:c]
end = s[c:]

if (n%2 == 1):
  print("No")

if (stt == end):
  print("Yes")
else:
  print("No")

Fixed submission:
n = int(input())
s = input()

if s[ :n//2 ] == s[ n//2: ]:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
c = n/2
stt = s[: c]
end = s[c :]

if c%2 == 1:
  print("No")

if stt == end :
  print("Yes")
else:
  print("No")

Fixed submission:
n = int(input())
s = input()

if s[ :n//2 ] == s[ n//2: ]:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
c = n/2
stt = s[: c]
end = s[c :]
if stt == end:
  print("Yes")
else:
  print("No")

Fixed submission:
n = int(input())
s = input()

if s[ :n//2 ] == s[ n//2: ]:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
import sys,pprint, math
from fractions import Fraction
from collections import defaultdict

MOD = 1000000007
N = int(input())
params =[]
hatemasks = []
tilts = defaultdict(lambda: [0,0])
zerozero = 0
zerodiv = 0
for i in range(N):
    (ai, bi) = map(int,input().split())
    if ai == 0 and bi == 0:
        zerozero += 1
        continue
    elif (ai <= 0) or (ai == 0 and bi < 0):
        ai *= -1
        bi *= -1
    g = math.gcd(ai,bi)
    ai = ai // g
    bi = bi // g
    if bi > 0:
        tilts[(ai,bi)][0] += 1
    else:
        tilts[(-bi,ai)][1] += 1
print(tilts,file=sys.stderr)

#sys.exit()
ans = 1
for(v1,v2) in tilts.values():
    ans *= 1 +pow(2,v1,MOD)-1 +pow(2,v2,MOD)-1
    ans %= MOD
ans = (ans+zerozero-1) % MOD
print(ans)

Fixed submission:
# coding: utf-8
import sys,pprint

N = int(input())
h = 'hon'
p = 'pon'
b = 'bon'
suffix = [p,p,h,b,h,h,p,h,p,h]

print(suffix[N%10])
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
import sys,pprint

(N,M) = map(int,input().split())
paths = []
for i in range(M):
    (a,b) = map(int,input().split())
    paths.append({a,b})

print(paths, file=sys.stderr)
result = [0]*N

searchroom = []
nextsearch = []
searchroom.append(1)
while len(searchroom) > 0:
    print(searchroom,paths,file=sys.stderr)
    for n in searchroom:
        j = 0
        while j < len(paths):
            s = paths[j]
            if n in s:
                print(s,"exist", file=sys.stderr)
                print(paths,s,file=sys.stderr)
                paths.remove(s)
                j -= 1
                print(paths,s,file=sys.stderr)
                s.remove(n)
                t = s.pop()
                if result[t-1] == 0:
                    result[t-1] = n
                    nextsearch.append(t)
            j += 1
    searchroom = nextsearch.copy()
    nextsearch.clear()

print(result,file=sys.stderr)

# no判定
for i in result[1:]:
    if i == 0:
        print("No")
        sys.exit()
print("Yes")    
for i in result[1:]:
    print(i)

Fixed submission:
# coding: utf-8
import sys,pprint

(N,M) = map(int,input().split())
paths = {}
for i in range(1,N+1):
    paths[i] = set()
for i in range(M):
    (a,b) = map(int,input().split())
    paths[a].add(b)
    paths[b].add(a)

result = [0]*N

searchroom = []
nextsearch = []
searchroom.append(1)
while len(searchroom) > 0:
    for n in searchroom:
        for s in paths[n]:
            if result[s-1] == 0:
                result[s-1] = n
                nextsearch.append(s)
    searchroom = nextsearch.copy()
    nextsearch.clear()

# no判定
for i in result[1:]:
    if i == 0:
        print("No")
        sys.exit()
print("Yes")    
for i in result[1:]:
    print(i)
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
import sys,pprint

av = {}
passed = set()

(N,K) = [int(x) for x in input().split(" ")]

arrivalary = input().split(" ")
i = 1
while len(arrivalary) > 0:
    a = int(arrivalary.pop(0))
    av[i] = a
    i += 1

i = 0
loopflg = 0
pos = 1
nextpos = 0
loopstartpos = 0
loopstartnum = 0
loopcount = 0
while i < K:
    passed.add(pos)
    nextpos = av[pos]
    # print(i,pos,nextpos,loopflg,loopstartpos,loopcount,file=sys.stderr)
    if loopflg == 0 and nextpos in passed:
        loopflg = 1
        loopstartpos = nextpos
        loopstartnum = i
    elif loopflg == 1 and nextpos == loopstartpos:
        left = (K-loopstartnum) % loopcount
        i = K-left
    elif loopflg == 1:
        loopcount += 1
    pos = nextpos
    i += 1

print(pos)

Fixed submission:
# coding: utf-8
import sys,pprint,readline

av = {}
passed = set()

(N,K) = [int(x) for x in input().split(" ")]

arrivalary = list(map(int,input().split(" ")))

'''
N =  200000
K = 12345678901234567
arrivalary = []
for i in range(1,N):
    arrivalary.append(i+1)
arrivalary.append(1)
'''

i = 0
loopflg = 0
pos = 1
nextpos = 0
loopstartpos = 0
loopstartnum = 0
loopcount = 0
while i < K:
    passed.add(pos)
    nextpos = arrivalary[pos-1]
    #print(i,pos,nextpos,loopflg,loopstartnum,loopstartpos,loopcount,file=sys.stderr)
    if loopflg == 0 and nextpos in passed:
        loopflg = 1
        loopstartpos = nextpos
        loopstartnum = i
        loopcount = 1
    elif loopflg == 1 and nextpos == loopstartpos:
        left = (K-loopstartnum) % loopcount
        #print("left=",left,file=sys.stderr)
        i = K-left
        if i == K:
            break
    elif loopflg == 1:
        loopcount += 1
    pos = nextpos
    i += 1

print(pos)
Buggy python submission (verdict: Time Limit Exceeded):
import sys

def ep(*params):
    print(*params,file=sys.stderr)

l = ''
r = ''

S = input().rstrip()

Q = int(input())
mode = 0
for _ in range(Q):
    ope = list(input().split())
    if ope[0] == '1':
        mode = (mode + 1)%2
    else:
        op = (int(ope[1]) + mode)%2
        if op == 1:
            l += ope[2]
        else:
            r += ope[2]
    print(mode,l[::-1],S,r,sep=":",file=sys.stderr)    

if mode == 0:
    print(l[::-1],S,r,sep="")    
else:
    print(r[::-1],S[::-1],l,sep="")    


Fixed submission:
import sys

def ep(*params):
    print(*params,file=sys.stderr)

l = ''
r = ''

S = input().rstrip()

Q = int(input())
mode = 0
for _ in range(Q):
    ope = list(input().split())
    if ope[0] == '1':
        mode = (mode + 1)%2
    else:
        op = (int(ope[1]) + mode)%2
        if op == 1:
            l += ope[2]
        else:
            r += ope[2]
    #print(mode,l[::-1],S,r,sep=":",file=sys.stderr)    

if mode == 0:
    print(l[::-1],S,r,sep="")    
else:
    print(r[::-1],S[::-1],l,sep="")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = []
b = []
for _ in range(N):
    ai,bi = list(map(int,input().split()))
    a.append(ai)
    b.append(bi)
ans = 0
for i in range(N-1,-1,-1):
    t = (b[i] - a[i] ) % b[i]
    a[:i] = map(lambda x:x+t,a[:i])
    ans += t
print(ans)

Fixed submission:
N = int(input())
a = []
b = []
for _ in range(N):
    ai,bi = list(map(int,input().split()))
    a.append(ai)
    b.append(bi)
ans = 0
for i in range(N-1,-1,-1):
    a[i] += ans
    t = (b[i] - a[i] ) % b[i]
    ans += t
print(ans)
Buggy python submission (verdict: Runtime Error):
#include<stdio.h>
#include<math.h>
int count;
int main(){
  char S[200005],T[200005];
  scanf("%c",S);
  scanf("%c",T);
  for (int i=0;S[i]!='\0';i++){
    if (S[i]!=T[i])
    count++;
  }
  printf("%d\n",count);
}


Fixed submission:
S=input()
T=input()
count=0
for i in range(len(S)):
  if S[i]!=T[i]:
    count +=1
print(count)

Buggy python submission (verdict: Runtime Error):
S=input()
T=input()
count=0
for i in range(len(S)):
  if S[i]!=T[i]:
    T[i]=S[i]
    count +=1
print(count)

Fixed submission:
S=input()
T=input()
count=0
for i in range(len(S)):
  if S[i]!=T[i]:
    count +=1
print(count)

Buggy python submission (verdict: Runtime Error):
S=input()
T=input()
count=0
for i in range(len(S)):
  if S[i]!=T[i]:
    T[i]=S[i]
    count +=1
    

Fixed submission:
S=input()
T=input()
count=0
for i in range(len(S)):
  if S[i]!=T[i]:
    count +=1
print(count)
Buggy python submission (verdict: Runtime Error):
a,b=map(int and float ,input().split())
b=100*b
c=a*b
print(int(c/100))

Fixed submission:
N=int(input())
A = list(map(int,input().split()))
A.sort()
x=1
y=True
for i in A:
    x= x*i
    if x > 10**18:
        print('-1')
        y=False
        break
if y:
    print(x)

Buggy python submission (verdict: Time Limit Exceeded):
from operator import mul
from functools import reduce
N=int(input())
A = list(map(int,input().split()))
c=reduce(mul, A)
if c > 10**18:
    print(-1)
else:
    print(c)


Fixed submission:
N=int(input())
A = list(map(int,input().split()))
A.sort()
x=1
y=True
for i in A:
    x= x*i
    if x > 10**18:
        print('-1')
        y=False
        break
if y:
    print(x)
Buggy python submission (verdict: Runtime Error):
import math

A,B,N=map(int,input().split())
list=[]
t=0
if B > N:
    print(math.floor(A*N/B))
else:
    for x in range(B+1,N):
        if t==0:
            y=math.floor(A*x/B)-A*math.floor(x/B)
        else:
            z=math.floor(A*x/B)-A*math.floor(x/B)
            if y - z>0:
                y = z
            else:
                break

    print(y)


Fixed submission:
import math

A,B,N=map(int,input().split())

if B==1:
    print(0)
else:
    if B > N:
        print(math.floor(A*N/B))

    else:
        print(math.floor(A*(B-1)/B))

Buggy python submission (verdict: Time Limit Exceeded):
import math

A,B,N=map(int,input().split())
list=[]
t=0
for x in range(N+1):
    y=math.floor(A*x/B)-A*math.floor(x/B)
    if t==0:
        list.append(y)
        t += 1
    else:
        if y  > list[0]:
            list.pop(0)
            list.append(y)
print(list[0])


Fixed submission:
import math

A,B,N=map(int,input().split())

if B==1:
    print(0)
else:
    if B > N:
        print(math.floor(A*N/B))

    else:
        print(math.floor(A*(B-1)/B))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
for i in range(1,N+1):
    print(A.count(i))

Fixed submission:
import collections
N=int(input())
A=list(map(int,input().split()))
c = collections.Counter(A)
for i in range(1,N+1):
    print(c[i])

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
for i in range(1,N+1):
    print(A.count(i))

Fixed submission:
import collections
N=int(input())
A=list(map(int,input().split()))
c = collections.Counter(A)
for i in range(1,N+1):
    print(c[i])
Buggy python submission (verdict: Time Limit Exceeded):
K=int(input())
def gcd(a,b,c):
    if a <b:
        a,b=b,a
    while a%b != 0:
        a,b= b,a%b
    if b < c:
        b,c=c,b
    while b % c != 0:
        b,c = c,b%c
    return c
x=0
for i in range(1,K+1):
    for j in range(1,K+1):
        for l in range(1,K+1):
            if (i==1) or (j==1) or (l==1):
                x+=1
            elif (j%i==i) or (l%j==j) or(l%i==i):
                x+=1
            else:
                x += gcd(i,j,l)
print(x)


Fixed submission:
K=int(input())
def gcd(a,b,c):
    if a <b:
        a,b=b,a
    while a%b != 0:
        a,b= b,a%b
    if b < c:
        b,c=c,b
    while b % c != 0:
        b,c = c,b%c
    return c
x=0
for i in range(1,K+1):
    for j in range(1,K+1):

            for l in range(1,K+1):
                
                    if (i==1) or (j==1) or (l==1):
                        x+=1
                    else:
                        x += gcd(i,j,l)
print(x)

Buggy python submission (verdict: Time Limit Exceeded):
K=int(input())
def gcd(a,b):
    if a <b:
        a,b=b,a
    while a%b != 0:
        a,b= b,a%b
    return b
x=0
for i in range(1,K+1):
    for j in range(1,K+1):
        for l in range(1,K+1):
            if (i==1) or (j==1) or (l==1):
                x+=1
            else:
                x += gcd(gcd(i,j),l)
print(x)

Fixed submission:
K=int(input())
def gcd(a,b,c):
    if a <b:
        a,b=b,a
    while a%b != 0:
        a,b= b,a%b
    if b < c:
        b,c=c,b
    while b % c != 0:
        b,c = c,b%c
    return c
x=0
for i in range(1,K+1):
    for j in range(1,K+1):

            for l in range(1,K+1):
                
                    if (i==1) or (j==1) or (l==1):
                        x+=1
                    else:
                        x += gcd(i,j,l)
print(x)

Buggy python submission (verdict: Time Limit Exceeded):
K=int(input())
def gcd(a,b):
    if a <b:
        a,b=b,a
    while a%b != 0:
        a,b= b,a%b
    return b
x=0
for i in range(1,K+1):
    for j in range(1,K+1):
        for l in range(1,K+1):
            x+=gcd(gcd(i,j),l)
print(x)


Fixed submission:
K=int(input())
def gcd(a,b,c):
    if a <b:
        a,b=b,a
    while a%b != 0:
        a,b= b,a%b
    if b < c:
        b,c=c,b
    while b % c != 0:
        b,c = c,b%c
    return c
x=0
for i in range(1,K+1):
    for j in range(1,K+1):

            for l in range(1,K+1):
                
                    if (i==1) or (j==1) or (l==1):
                        x+=1
                    else:
                        x += gcd(i,j,l)
print(x)
Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
result=0
if H==1 or W==1:
    result=1
elif W%2==0:
    result = (W/2)*H
else:
    if H%2==0:
        result=W*(H/2)
    else :
        result=W*(H-1)/2+(W+1)/2
print(str(round(result)))


Fixed submission:
list = [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(list[K-1])

Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
if H==1 or W==1:
    print("1")
elif W%2==0:
    result = (W/2)*H
else:
    if H%2==0:
        result=W*(H/2)
    else :
        result=W*(H-1)/2+(W+1)/2
print(str(round(result)))

Fixed submission:
list = [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(list[K-1])
Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
if H==1 or W==1:
    print("1")
elif W%2==0:
    result = (W/2)*H
elif W%2==1:
    if H%2==0:
        result=W*(H/2)
    elif H%2==1 :
        result=W*(H-1)/2+(W+1)/2
print(str(round(result)))


Fixed submission:
H, W = map(int, input().split())
result=0
if H==1 or W==1:
    result=1
elif W%2==0:
    result = (W/2)*H
else:
    if H%2==0:
        result=W*(H/2)
    else :
        result=W*(H-1)/2+(W+1)/2
print(str(round(result)))
Buggy python submission (verdict: Time Limit Exceeded):
A,B,M=map(int,input().split())
x=[0]*M
y=[0]*M
c=[0]*M
a=list(map(int,input().split()))
b=list(map(int,input().split()))
for i in range(M):
    x[i],y[i],c[i]=map(int,input().split())
min=a[0]+b[0]
min1=0
for i in range(A):
    for j in range(B):
        for t in range(M):
            if i+1==x[t] and j+1==y[t]:
                min1=a[i]+b[j]-c[t]

            else:
                min1=a[i]+b[j]
            if min >= min1:
                min = min1
print(min)


Fixed submission:
A,B,M=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

price=[0]*(M+1)
price[0]=min(a)+min(b)

for i in range(M):
    x,y,c=map(int,input().split())
    price[i+1]=a[x-1]+b[y-1]-c

print(min(price))