Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n=int(input())
arr=[int(x) for x in input().split(' ')]
arr2=sorted(arr)
for x in range(n):
  if x+1==arr[x]:
    continue
  else:
    swap(arr[x],arr[arr[x]-1])
    break
if arr==arr2:
  print("YES")
else:
  print("NO")

Fixed submission:
n=int(input())
arr=[int(x) for x in input().split(' ')]
arr2=sorted(arr)
for x in range(n):
	if x+1==arr[x]:
		continue
	else:
		t=arr[x]
		arr[x]=arr[t-1]
		arr[t-1]=t
		break
# print(arr,arr2)
if arr==arr2:
	print("YES")
else:
	print("NO")
Buggy python submission (verdict: Runtime Error):
import sys
N,X=[int(x) for x in input().split(' ')]
arr=[int(x) for x in input().split(' ')]
temp=0
for x in range(N):
  if arr[x]+temp>X:
    print(x+1)
    sys.exit(1)
  else:
    temp+=arr[x]
print(N+1)

Fixed submission:
x,a=[int(x) for x in input().split(' ')]
if x<a:
  print(0)
else:
  print(10)

Buggy python submission (verdict: Runtime Error):
x,a=[int(X) for x in input().split(' ')]
if x<a:
  print(0)
else:
  print(10)

Fixed submission:
x,a=[int(x) for x in input().split(' ')]
if x<a:
  print(0)
else:
  print(10)
Buggy python submission (verdict: Runtime Error):
n=int(input())
arr=[int(x) for x in input().split(' ')]
total=sum(arr)
temp=0
ans=1000
for item in arr:
  temp+=item
  a=total-temp
  ans=min(ans,abs(a-temp))
print(ans)

Fixed submission:
p,q,r=[int(x) for x in input().split(' ')]
print(min(p+q,q+r,p+r))
Buggy python submission (verdict: Time Limit Exceeded):
import itertools


max_num = 3000
num_list = [i for i in range(-max_num,  max_num+1)]
num_list_5 = [i ** 5 for i in num_list]
num_comb = list(itertools.combinations(num_list, 2))

x = int(input().strip())
for comb in num_comb:
    a = comb[0]
    b = comb[1]
    a5 = num_list_5[a]
    b5 = num_list_5[b]
    if a5 - b5 == x:
        print(num_list[a], num_list[b])
        break

Fixed submission:
import itertools


max_num = 200
num_list = [i for i in range(-max_num,  max_num+1)]
num_comb = list(itertools.permutations(num_list, 2))

x = int(input().strip())
for comb in num_comb:
    a = comb[0]
    b = comb[1]
    # print(a, b)
    a5 = a ** 5
    b5 = b ** 5
    if a5 - b5 == x:
        print(a, b)
        break

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


max_num = 5000
num_list = [i for i in range(-max_num,  max_num+1)]
num_list_5 = [i ** 5 for i in num_list]
num_comb = list(itertools.combinations(num_list, 2))

x = int(input().strip())
for comb in num_comb:
    a = comb[0]
    b = comb[1]
    a5 = num_list_5[a]
    b5 = num_list_5[b]
    if a5 - b5 == x:
        print(num_list[a], num_list[b])
        break

Fixed submission:
import itertools


max_num = 200
num_list = [i for i in range(-max_num,  max_num+1)]
num_comb = list(itertools.permutations(num_list, 2))

x = int(input().strip())
for comb in num_comb:
    a = comb[0]
    b = comb[1]
    # print(a, b)
    a5 = a ** 5
    b5 = b ** 5
    if a5 - b5 == x:
        print(a, b)
        break

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


max_num = 10000
num_list = [i for i in range(-max_num,  max_num+1)]
num_list_5 = [i ** 5 for i in num_list]
num_comb = list(itertools.combinations(num_list, 2))

x = int(input().strip())
for comb in num_comb:
    a = comb[0]
    b = comb[1]
    a5 = num_list_5[a]
    b5 = num_list_5[b]
    if a5 - b5 == x:
        print(num_list[a], num_list[b])
        break

Fixed submission:
import itertools


max_num = 200
num_list = [i for i in range(-max_num,  max_num+1)]
num_comb = list(itertools.permutations(num_list, 2))

x = int(input().strip())
for comb in num_comb:
    a = comb[0]
    b = comb[1]
    # print(a, b)
    a5 = a ** 5
    b5 = b ** 5
    if a5 - b5 == x:
        print(a, b)
        break
Buggy python submission (verdict: Runtime Error):
k = int(input().split())
num = list(map(int, input().split()))
a = int(num[0] / k)
b = int(num[1] / k)
if a == b:
    print('NG')
else:
    print('OK')


Fixed submission:
k = int(input().strip())
num = list(map(int, input().split()))
count = k
while 1:
    if num[0] <= k <= num[1]:
        print('OK')
        break
    elif num[1] < k:
        print('NG')
        break
    else:
        k += count
Buggy python submission (verdict: Time Limit Exceeded):
def f(a, b, x):
    return int(a * x / b) - a * int(x / b)


num = list(map(int, input().split()))
a = num[0]
b = num[1]
n = num[2]
x = (int(n/b) + 1) * b - 1
max_num = 0
while x % b != 0:
    if x > n:
        pass
    else:
        new_num = f(a, b, x)
        if max_num < new_num:
            max_num = new_num
            break
print(max_num)


Fixed submission:
def f(a, b, x):
    return int(a * x / b) - a * int(x / b)


num = list(map(int, input().split()))
a = num[0]
b = num[1]
n = num[2]
x = (int(n/b) + 1) * b - 1
max_num = f(a, b, min(b-1, n))
print(max_num)

Buggy python submission (verdict: Time Limit Exceeded):
def f(a, b, x):
    return int(a * x / b) - a * int(x / b)


num = list(map(int, input().split()))
a = num[0]
b = num[1]
n = num[2]
x = 1
max_num = 0
while x % b != 0 and x <= n:
    new_num = f(a, b, x)
    if max_num < new_num:
        max_num = new_num
    x += 1
print(max_num)


Fixed submission:
def f(a, b, x):
    return int(a * x / b) - a * int(x / b)


num = list(map(int, input().split()))
a = num[0]
b = num[1]
n = num[2]
x = (int(n/b) + 1) * b - 1
max_num = f(a, b, min(b-1, n))
print(max_num)
Buggy python submission (verdict: Time Limit Exceeded):
raw = input()
N, K = raw.split(' ')
N = int(N)
K = int(K)
str_li = input().split(' ')
num_li = list(map(int, str_li))
ans = 0
for index in range(N-K+1):
    s = (sum(num_li[index: index+K]) + K) / 2
    if s > ans:
        ans = s

print(ans)

Fixed submission:
raw = input()
N, K = raw.split(' ')
N = int(N)
K = int(K)
str_li = input().split(' ')
num_li = list(map(int, str_li))
sum_li = [0]
for i in num_li:
    sum_li.append(sum_li[-1] + i + 1)
ans = 0
for index in range(K, N+1):
    ans_tmp = sum_li[index] - sum_li[index - K]
    if ans_tmp > ans:
        ans = ans_tmp
print(ans/2)
Buggy python submission (verdict: Runtime Error):
PI = 3.141
r = int(input())
print(2*1PI*r)

Fixed submission:
PI = 3.141
r = int(input())
print(2*PI*r)
Buggy python submission (verdict: Runtime Error):
import sys                                                                      
 
if __name__ == '__main__':  
    x = sys.argv[1]
    a = sys.argv[2]
    if (x < a): 
        print('0')
    else:
        print('10')

Fixed submission:
import sys                                                                      
 
if __name__ == '__main__':
    s = input().strip().split(' ')
    x = int(s[0])
    a = int(s[1])
    if (x < a): 
        print('0')
    else:
        print('10')

Buggy python submission (verdict: Runtime Error):
import sys

if __name__ == '__main__':  
    x, a = sys.argv[1].split(' ')
    if (x < a):
        printf('0')
    else:
        printf('10')

Fixed submission:
import sys                                                                      
 
if __name__ == '__main__':
    s = input().strip().split(' ')
    x = int(s[0])
    a = int(s[1])
    if (x < a): 
        print('0')
    else:
        print('10')

Buggy python submission (verdict: Runtime Error):
import sys

if __name__ == '__main__':
  
  x, a = sys.argv[1].split(' ')
  if (x < a):
    printf('0')
  else:
    printf('10')

Fixed submission:
import sys                                                                      
 
if __name__ == '__main__':
    s = input().strip().split(' ')
    x = int(s[0])
    a = int(s[1])
    if (x < a): 
        print('0')
    else:
        print('10')
Buggy python submission (verdict: Runtime Error):
s = input().split()

if s[0] < s[1]:
  s1 = s[0]
  s2 = s[1]
else:
  s1 = s[1]
  s2 = s[0]
  
result = 0
if (s2-s1) > 2:
  result = s2*2 - 1
else (s2-s1) = 1:
  result = s2 + s1

print(result)

Fixed submission:
s = input().split()
 
if int(s[0]) < int(s[1]):
  s1 = int(s[0])
  s2 = int(s[1])
else:
  s1 = int(s[1])
  s2 = int(s[0])
  
result = 0
if (s2-s1) >= 2:
  result = s2*2 - 1
else:
  result = s2 + s1
 
print(result)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int, input().split(" ")))
a = 1
for i in range(n):
    a = a*l[i]
if a>10**18:
    print("-1")
else:
    print(a)

Fixed submission:
import sys
n = int(input())
l = list(map(int, input().split(" ")))
l.sort()
a = 1
for i in range(n):
    if a <= 10**18:
        a = a*l[i]
    elif a > 10**18:
        print("-1")
        sys.exit()
if a > 10**18:
    print("-1")
else:
    print(a)
Buggy python submission (verdict: Runtime Error):
# coding=utf-8
S = list(raw_input())
S.sort()

alpha = 'abcdefghijklmnopqrstuvwxyz'
c = 0
t = True
for s in S:
    if alpha[c] != s:
        if alpha[c - 1] != s:
            print alpha[c]
            t = False
            break
        else:
            continue
    else:
        c += 1
if t:
    print 'None'

Fixed submission:
# coding=utf-8
S = list(raw_input())

alpha = 'abcdefghijklmnopqrstuvwxyz'
t = True
for a in alpha:
    if a not in S:
        print a
        t = False
        break
if t:
    print None
Buggy python submission (verdict: Time Limit Exceeded):
# coding=utf-8
N = int(raw_input())
A = map(int, raw_input().split())

candidates = []
A.sort()
for i in xrange(1, len(A) + 1):
    if A.count(A[-i]) > 1:
        candidates.append(A[-i])
        if len(candidates) == 4:
            break
if len(candidates) < 4:
    print 0
else:
    print candidates[1] * candidates[3]


Fixed submission:
# coding=utf-8

def count(list, target, num):
    l = len(list)
    c = 0
    for i in xrange(-num, l + 1):
        if list[-i] == target:
            c += 1
            if c == 4:
                return c
        else:
            return c
    return c


N = int(raw_input())
A = map(int, raw_input().split())

candidates = []
A.sort()
t = -1
for i in xrange(0, N + 1):
    n = count(A, A[t], t)
    for m in range(n / 2):
        candidates.append(A[t])
        if len(candidates) == 4:
            break
    t -= n
    if t < -N:
        break
if len(candidates) < 2:
    print 0
else:
    print candidates[0] * candidates[1]

Buggy python submission (verdict: Time Limit Exceeded):
# coding=utf-8
N = int(raw_input())
A = map(int, raw_input().split())

candidates = []
for a in A:
    if A.count(a) > 1:
        candidates.append(a)
candidates.sort()
if len(candidates) < 4:
    print 0
else:
    print candidates[-1] * candidates[-4]


Fixed submission:
# coding=utf-8

def count(list, target, num):
    l = len(list)
    c = 0
    for i in xrange(-num, l + 1):
        if list[-i] == target:
            c += 1
            if c == 4:
                return c
        else:
            return c
    return c


N = int(raw_input())
A = map(int, raw_input().split())

candidates = []
A.sort()
t = -1
for i in xrange(0, N + 1):
    n = count(A, A[t], t)
    for m in range(n / 2):
        candidates.append(A[t])
        if len(candidates) == 4:
            break
    t -= n
    if t < -N:
        break
if len(candidates) < 2:
    print 0
else:
    print candidates[0] * candidates[1]
Buggy python submission (verdict: Time Limit Exceeded):
n = int(raw_input().rstrip())
a = map(int, raw_input().split())
b = []
for i in range(n):
    b.append(a[i])
    b.reverse()
ans = map(str, b)
print ' '.join(ans)


Fixed submission:
n = int(raw_input().rstrip())
a = map(int, raw_input().split())
a_odd = a[0::2]
a_even = a[1::2]
a_even.reverse()
a_even.extend(a_odd)
b = map(str, a_even)
if len(b) % 2 !=0:
    b.reverse()
print ' '.join(b)
Buggy python submission (verdict: Runtime Error):
H, W = map(int, raw_input().split())
best = H * W
for h in range(H):
    S[0] = h * W

    S[1] = (H - h) * (W / 2)
    S[2] = (H - h) * (W - W / 2)

    if best > max(S) - min(S):
        best = max(S) - min(S)

    S[1] = (H - h) / 2 * W
    S[2] = (H - h - (H - h) / 2) * W

    if best > max(S) - min(S):
        best = max(S) - min(S)
H, W = W, H
for h in range(H):
    S[0] = h * W

    S[1] = (H - h) * (W / 2)
    S[2] = (H - h) * (W - W / 2)

    if best > max(S) - min(S):
        best = max(S) - min(S)

    S[1] = (H - h) / 2 * W
    S[2] = (H - h - (H - h) / 2) * W

    if best > max(S) - min(S):
        best = max(S) - min(S)

print best

Fixed submission:
H, W = map(int, raw_input().split())
best = H * W
S = [0, 0, 0]
for h in range(H):
    S[0] = h * W

    S[1] = (H - h) * (W / 2)
    S[2] = (H - h) * (W - W / 2)

    if best > max(S) - min(S):
        best = max(S) - min(S)

    S[1] = (H - h) / 2 * W
    S[2] = (H - h - (H - h) / 2) * W

    if best > max(S) - min(S):
        best = max(S) - min(S)
H, W = W, H
for h in range(H):
    S[0] = h * W

    S[1] = (H - h) * (W / 2)
    S[2] = (H - h) * (W - W / 2)

    if best > max(S) - min(S):
        best = max(S) - min(S)

    S[1] = (H - h) / 2 * W
    S[2] = (H - h - (H - h) / 2) * W

    if best > max(S) - min(S):
        best = max(S) - min(S)

print best
Buggy python submission (verdict: Runtime Error):
import numpy as np

n, m = map(int, raw_input().split())
g = []
for i in range(m):
    g.append(map(int, raw_input().split()))

graph = {}
for i in g:
    if i[0] not in graph:
        graph[i[0]] = [[i[1], i[2]]]
    else:
        graph[i[0]].append([i[1], i[2]])

table = np.zeros(n + 1) + 0.5
table[1] = 0
fp = [1]
for i in range(n):
    for k in fp:
        if k in graph.keys():
            for j in graph[k]:
                if table[j[0]] < table[k] + j[1]:
                    table[j[0]] = table[k] + j[1]
                    if j[0] != n and fp not in [j[0]]:
                        fp.append(j[0])
                if table[j[0]] == 0.5:
                    table[j[0]] = table[k] + j[1]
                    if j[0] != n:
                        fp.append(j[0])
max = int(table[n])
fp.append(n)
flag = 0
for i in range(3):
    for k in fp:
        if k in graph.keys():
            for j in graph[k]:
                if table[j[0]] < table[k] + j[1]:
                    table[j[0]] = table[k] + j[1]
                    fp.append(j[0])
                if table[j[0]] == 0.5:
                    table[j[0]] = table[k] + j[1]
                    if j[0] != n:
                        fp.append(j[0])
                if max < int(table[n]):
                    print"inf"
                    flag = 1
                    break
        if flag == 1:
            break

    if flag == 1:
        break
if flag != 1:
    print int(table[n])


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

print "Yes" if c >= a and c <= b else "No"
Buggy python submission (verdict: Runtime Error):
import numpy as np

def generate():
    newGen = np.zeros(n)
    for p in range(pop):
        gen = np.random.rand(n)
        for i in range(n):
            if gen[i] > 0.5:
                gen[i] = 1
            else:
                gen[i] = 0
        newGen = np.vstack([newGen,gen])
    newGen = np.vsplit(newGen,[1])[1]
    return newGen

def evaluate(gen):
    sum = np.zeros(pop)
    for p in range(pop):
        for i in range(n):
            sum[p] += v[i][1] * gen[p][i]
    sum = sum.reshape(pop, 1)
    gen = np.hstack([gen, sum])
    return gen

def best(gen):
    best0 = gen[0]
    for p in range(1,pop):
        if best0[-1] < gen[p][-1]:
            best0 = gen[p]
    return best0

def select(b,p):
    parents = np.zeros(b.shape[1])
    for i in range(p):
        p1 = b[np.random.randint(0, b.shape[0] - 1)]
        p2 = b[np.random.randint(0, b.shape[0] - 1)]
        if p1[-1] < p2[-1]:
            parents = np.vstack([parents, p2])
        else:
            parents = np.vstack([parents, p1])
    return np.vsplit(parents,[1])[1]

def crossover(parents):
    parents = np.hsplit(parents, [-1])[0]
    newGen = np.zeros(parents.shape[1])
    for i in range(parents.shape[0] / 2):
        l = np.random.randint(1, parents.shape[1] - 1)
        p1_0, p1_1 = np.hsplit(parents[i * 2], [l])
        p2_0, p2_1 = np.hsplit(parents[i * 2 + 1], [l])
        c1 = np.hstack([p1_0, p2_1])
        c2 = np.hstack([p1_1, p2_0])
        newGen = np.vstack([newGen, c1])
        newGen = np.vstack([newGen, c2])
    return np.vsplit(newGen, [1])[1]

def mutation(newGen):
    for p in range(pop):
        w_sum = 0
        for i in range(n):
            w_sum += newGen[p][i] * v[i][0]
        if w_sum > w:
            ran = np.random.permutation(np.arange(n))
            while(w_sum > w):
                ran, q = np.hsplit(ran,[-1])
                if newGen[p][q] == 1:
                    w_sum -= newGen[p][q] * v[q][0]
                    newGen[p][q] = 0
    return newGen


pop = 10
n, w = map(int,raw_input().split())
v = []
N = 500
for i in range(n):
    v.append(map(int,raw_input().split()))

eval = evaluate(generate())
c = mutation(crossover(select(eval,pop)))
eval = evaluate(c)
be = best(eval)
for i in range(N):
    c = mutation(crossover(select(eval,pop)))
    eval = evaluate(c)
    if be[-1] < best(eval)[-1]:
        be = best(eval)
print int(be[-1])

Fixed submission:
a,b,c = raw_input().split()

if a[-1] == b[0] and b[-1] == c[0]:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
d=int(input())
if d=25:
  print('Christmas') 
elif d=24:
  print('Christmas Eve')
elif d=23:
  print('Christmas Eve Eve')
else :
  print('Christmas Eve Eve Eve')
 

Fixed submission:
d=int(input())
if d==25:
  print('Christmas') 
elif d==24:
  print('Christmas Eve')
elif d==23:
  print('Christmas Eve Eve')
else :
  print('Christmas Eve Eve Eve')

Buggy python submission (verdict: Runtime Error):
d=int(input())
if d=25:
  print('christmas')
    
elif d=24:
  print('Christmas Eve')

elif d=23:
  print('Christmas Eve Eve')
else :
  print('Christmas Eve Eve Eve')
 

Fixed submission:
d=int(input())
if d==25:
  print('Christmas') 
elif d==24:
  print('Christmas Eve')
elif d==23:
  print('Christmas Eve Eve')
else :
  print('Christmas Eve Eve Eve')

Buggy python submission (verdict: Runtime Error):
d=input()
if d=25:
  print('christmas')
    
elif d=24:
  print('Christmas Eve')

elif d=23:
  print('Christmas Eve Eve')
else :
  print('Christmas Eve Eve Eve')
 

Fixed submission:
d=int(input())
if d==25:
  print('Christmas') 
elif d==24:
  print('Christmas Eve')
elif d==23:
  print('Christmas Eve Eve')
else :
  print('Christmas Eve Eve Eve')
Buggy python submission (verdict: Runtime Error):
age=int(input())
if age==3,5,7:
  print('YES')
else :
  print('NO')

Fixed submission:
age=int(input())
if age==3:
  print ('YES')
elif age==5:
  print ('YES')
elif age==7:
  print ('YES')
else :
  print('NO')

Buggy python submission (verdict: Runtime Error):
age=int(input())
if age==3,5,7:
  print("YES")
else :
  print('NO')

Fixed submission:
age=int(input())
if age==3:
  print ('YES')
elif age==5:
  print ('YES')
elif age==7:
  print ('YES')
else :
  print('NO')

Buggy python submission (verdict: Runtime Error):
age=int(input())
if age==3,5,7:
  print"YES"
else :
  print('NO')

Fixed submission:
age=int(input())
if age==3:
  print ('YES')
elif age==5:
  print ('YES')
elif age==7:
  print ('YES')
else :
  print('NO')
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))
Alice=0
Bob=0
a.sort(reversed=True)
for i in range(N):
    if i % 2 == 0:
        Alice+=a[i]
    else:
        Bob+=a[i]
if Alice>Bob:
    print(Alice-Bob)
else:
    print(Bob-Alice)

Fixed submission:
N = int(input())
a = list(map(int,input().split()))
Alice=0
Bob=0
a.sort(reverse=True)
for i in range(N):
    if i % 2 == 0:
        Alice+=a[i]
    else:
        Bob+=a[i]
if Alice>Bob:
    print(Alice-Bob)
else:
    print(Bob-Alice)

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))
for i in range(N):
    if i % 2 ==0:
        Alice+=a[i]
    else:
        Bob+=a[i]
if Alice>Bob:
    print(Alice-Bob)
else:
    print(Bob-Alice)

Fixed submission:
N = int(input())
a = list(map(int,input().split()))
Alice=0
Bob=0
a.sort(reverse=True)
for i in range(N):
    if i % 2 == 0:
        Alice+=a[i]
    else:
        Bob+=a[i]
if Alice>Bob:
    print(Alice-Bob)
else:
    print(Bob-Alice)
Buggy python submission (verdict: Runtime Error):
N,Y=map(int,input().split())
x=-1
y=-1
z=-1
for i in range(N+1):
    for j in range(N+1):

        k=N-j-i
        sum = i*10000 + j*5000 + k*1000
        if Y==sum and i+j+k==N:
            x=i
            y=j
            z=k
            break

    else:
        continue
    break
print(str(x)+' '+str(y)+' '+str(z))

Fixed submission:
N=int(input())
d=[input() for i in range(N)]
sum=1
d.sort(reverse=True)
for i in range(1,N):
    if d[i-1]>d[i]:
        sum+=1
print(sum)

Buggy python submission (verdict: Runtime Error):
N=int(input().split())
d=[input() for i in range(N)]
d.sort(reverse=True)
for i in range(1,N):
    if d[i-1]>d[i]:
        sum+=1
print(sum)

Fixed submission:
N=int(input())
d=[input() for i in range(N)]
sum=1
d.sort(reverse=True)
for i in range(1,N):
    if d[i-1]>d[i]:
        sum+=1
print(sum)
Buggy python submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
sum=0
for i in range(n):
     if 2 <= i[-1] + i[-2] and i[-1] + i[-2] <=5:
         sum +=i[-1]+i[-2]
print(sum)

Fixed submission:
n,a,b=map(int,input().split())
sum=0
for i in range(n+1):
     wa = int((i / 10000) % 10)+int((i / 1000) % 10) + int((i / 100) % 10) + int((i / 10) % 10)  + int(i % 10)
     if a <= wa and wa<=b:
         sum += i
print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = (int(x) for x in input().split())

while True:
  d = n - k
  if d < 0:
    d *= -1
  if d >= n:
    break
  else:
    n = d
print(n)

Fixed submission:
n, k = (int(x) for x in input().split())

key = n % k


while True:
  d = key - k
  if d < 0:
    d *= -1
  if d >= key:
    break
  else:
    key = d
print(key)
Buggy python submission (verdict: Runtime Error):
money = int(input())
fh = n // 500
money -= 500 * fh
goen = money // 5

point = 1000 * fh + 5 * goen
print(point)

Fixed submission:
money = int(input())
fh = money // 500
money -= 500 * fh
goen = money // 5

point = 1000 * fh + 5 * goen
print(point)
Buggy python submission (verdict: Runtime Error):
s=input()
n=len(s)

def kaibun(string):
  index = 0
  ans = True
  while i < n-1-i:
    if s[i] != s[n-1-i]:
      ans = False
      return ans
      break
    index += 1
  return ans

ans_total = def(s)

zenhan = s[:n//2]
kouhan = s[n//2:]

ans_zen = def(zenhan)
ans_kou = def(kouhan)

if ans_total == True and ans_zen == True and ans_kou == True:
  print('Yes')
else:
  print('No')

Fixed submission:
s = input()
n = len(s)
zen = s[:n // 2]

kou= s[n // 2 + 1:]

s_rev = s[::-1]

zen_rev = zen[::-1]
kou_rev = kou[::-1]

if s == s_rev and zen == zen_rev and kou == kou_rev:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
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)


Fixed submission:
n, m = (int(x) for x in input().split())

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

Buggy python submission (verdict: Runtime Error):
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)

Fixed submission:
n, m = (int(x) for x in input().split())

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