Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
lis = [int(input()) for _ in range(3)]

print(lis[1]*lis[2] + (lis[0]-lis[1])*lis[3])

Fixed submission:
#!/usr/bin/env python3

n = int(input())
k = int(input())
x = int(input())
y = int(input())

if n <= k:
    print(n*x)
else:
    print(k*x + (n-k)*y)
Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())

def gcd(a, b, c):
    min = a
    if b < a:
        min = b
    if c < a:
        min = c
    g = 1
    for i in range(min):
        j = min - i
        if a % j == 0 and b % j == 0 and c % j == 0:
            g = j
            break
    return g

sum = 0
for i in range(1, k+1):
    for j in range(1, k+1):
        for k in range(1, k+1):
            g = gcd(i, j, k)
            sum += g
print(sum)


Fixed submission:
k = int(input())

def gcd(a, b): # a<=b
    if b%a==0:
        return a
    else:
        c = b%a
        if a < c:
            return gcd(a, c)
        else:
            return gcd(c, a)

sum = 0
for i in range(1, k+1):
    sum += i
for i in range(1, k):
    for j in range(i+1, k+1):
        sum += gcd(i, j) * 6
for i in range(1, k-1):
    for j in range(i+1, k):
        for l in range(j+1, k+1):
            sum += gcd(gcd(i, j), l) * 6
print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
r = s.count("R")
g = s.count("G")
b = s.count("B")
ans = r * g * b
for i in range(1, 1+n//2):
    for j in range(1, n-1):
        if j + i*2 <= n:
            if s[j-1] != s[j+i-1] and s[j-1] != s[j+i*2-1] and s[j+i-1] != s[j+i*2-1]:
                ans -= 1
print(ans)


Fixed submission:
n = int(input())
s = input()
r = s.count("R")
g = s.count("G")
b = s.count("B")
ans = r * g * b
for i in range(1, 1+n//2):
    for j in range(1, n-i*2+1):
        if s[j-1] != s[j+i-1] and s[j-1] != s[j+i*2-1] and s[j+i-1] != s[j+i*2-1]:
                ans -= 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
r = 0
g = 0
b = 0
for x in s:
    if x =="R":
        r += 1
    elif x == "G":
        g += 1
    else:
        b += 1
ans = r * g * b
for i in range(1, 1+n//2):
    for j in range(1, n-1):
        if j + i*2 <= n:
            if s[j-1] != s[j+i-1] and s[j-1] != s[j+i*2-1] and s[j+i-1] != s[j+i*2-1]:
                ans -= 1
print(ans)


Fixed submission:
n = int(input())
s = input()
r = s.count("R")
g = s.count("G")
b = s.count("B")
ans = r * g * b
for i in range(1, 1+n//2):
    for j in range(1, n-i*2+1):
        if s[j-1] != s[j+i-1] and s[j-1] != s[j+i*2-1] and s[j+i-1] != s[j+i*2-1]:
                ans -= 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
ans = 0
for i in range(1, n-1):
    for j in range(i+1, n):
        for k in range(j+1, n+1):
            if  j-i != k-j:
                if s[i-1] != s[j-1] and s[i-1] != s[k-1] and s[j-1] != s[k-1]:
                    ans += 1
print(ans)


Fixed submission:
n = int(input())
s = input()
r = s.count("R")
g = s.count("G")
b = s.count("B")
ans = r * g * b
for i in range(1, 1+n//2):
    for j in range(1, n-i*2+1):
        if s[j-1] != s[j+i-1] and s[j-1] != s[j+i*2-1] and s[j+i-1] != s[j+i*2-1]:
                ans -= 1
print(ans)
Buggy python submission (verdict: Runtime Error):
n, x, y = map(int, input().split())
ans = [0 for i in range(n-1)]
for i in range(n-1):
  k = i + 1
  for j in range(i+1, n):
    a = l - k
    b = abs(k - x) + abs(j+1 - y) + 1
    if b < a:
      ans[b-1] += 1
    else:
      ans[a-1] += 1
for i in range(n-1):
  print(ans[i])

Fixed submission:
n, x, y = map(int, input().split())
ans = [0 for i in range(n-1)]
for i in range(n-1):
  k = i + 1
  b_1 = k - x
  c_1 = k - y
  if b_1 < 0:
      b_1 = - b_1
  if c_1 < 0:
      c_1 = - c_1
  for j in range(i+1, n):
    l = j + 1
    a = l - k
    b_2 = l - y
    c_2 = l - x
    if b_2 < 0:
      b_2 = - b_2
    if c_2 < 0:
      c_2 = - c_2
    b = b_1 + b_2 + 1
    c = c_1 + c_2 + 1
    if b < a:
      a = b
    if c < a:
      a = c
    ans[a-1] += 1
for i in range(n-1):
  print(ans[i])

Buggy python submission (verdict: Time Limit Exceeded):
n, x, y = map(int, input().split())
ans = [0 for i in range(n-1)]
for i in range(n-1):
  for j in range(i+1, n):
    k = i + 1
    l = j + 1
    a = l - k
    b_1 = k - x
    b_2 = l - y
    c_1 = k - y
    c_2 = l - x
    if b_1 < 0:
      b_1 = - b_1
    if b_2 < 0:
      b_2 = - b_2
    if c_1 < 0:
      c_1 = - c_1
    if c_2 < 0:
      c_2 = - c_2
    b = b_1 + b_2 + 1
    c = c_1 + c_2 + 1
    if b < a:
      a = b
    if c < a:
      a = c
    ans[a-1] += 1
for i in ans:
  print(i)

Fixed submission:
n, x, y = map(int, input().split())
ans = [0 for i in range(n-1)]
for i in range(n-1):
  k = i + 1
  b_1 = k - x
  c_1 = k - y
  if b_1 < 0:
      b_1 = - b_1
  if c_1 < 0:
      c_1 = - c_1
  for j in range(i+1, n):
    l = j + 1
    a = l - k
    b_2 = l - y
    c_2 = l - x
    if b_2 < 0:
      b_2 = - b_2
    if c_2 < 0:
      c_2 = - c_2
    b = b_1 + b_2 + 1
    c = c_1 + c_2 + 1
    if b < a:
      a = b
    if c < a:
      a = c
    ans[a-1] += 1
for i in range(n-1):
  print(ans[i])

Buggy python submission (verdict: Time Limit Exceeded):
n, x, y = map(int, input().split())
ans = [0 for i in range(n-1)]
for i in range(n-1):
  for j in range(i+1, n):
    k = i + 1
    l = j + 1
    a = min(l-k, abs(k-x)+abs(l-y)+1, abs(k-y)+abs(l-x)+1)
    ans[a-1] += 1
for i in ans:
  print(i)

Fixed submission:
n, x, y = map(int, input().split())
ans = [0 for i in range(n-1)]
for i in range(n-1):
  k = i + 1
  b_1 = k - x
  c_1 = k - y
  if b_1 < 0:
      b_1 = - b_1
  if c_1 < 0:
      c_1 = - c_1
  for j in range(i+1, n):
    l = j + 1
    a = l - k
    b_2 = l - y
    c_2 = l - x
    if b_2 < 0:
      b_2 = - b_2
    if c_2 < 0:
      c_2 = - c_2
    b = b_1 + b_2 + 1
    c = c_1 + c_2 + 1
    if b < a:
      a = b
    if c < a:
      a = c
    ans[a-1] += 1
for i in range(n-1):
  print(ans[i])
Buggy python submission (verdict: Runtime Error):
s = input()
q = int(input())
t = 0
for i in range(q):
  Q = input()
  if Q == "1":
    t += 1
  else:
    a, f, c = Q.split()
    f = int(f)
    if (t + f) % 2 == 0:
      s = ''.join([s, c])
    else:
      s = ''.join([c, s])
if t % 2 == 1:
  print(s[::-1])
else:
  print(s)

Fixed submission:
a = input()
if not (a == "AAA" or a =="BBB"):
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
import math
a, b = map(int, input().split())
a_min = a / 0.08
a_max = (a + 1) / 0.08
b_min = b / 0.1
b_max = (b + 1) / 0.1
if a_min > b_min:
  min = a_min
else:
  min = b_min
if a_max < b_max:
  max = a_max
else:
  max = b_max
min = math.ceil(min)
if math.floor(max) == max:
  max = max - 1 
else:
  max = math.floor(max)
if min <= max:
  print(min)
else:
  print(-1)

Fixed submission:
a = input()
if not (a == "AAA" or a =="BBB"):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
a, b, k = map(int,input().split())

for i in range(k):
  if a > 0:
    a -= 1
  elif b > 0:
    b -= 1
print(a, b)

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

if a >= k:
  print(a-k, b)
elif a + b >= k:
  print(0, a+b-k)
else:
  print(0, 0)
Buggy python submission (verdict: Time Limit Exceeded):
n, w = map(int, input().split())
g = []
for i in range(n):
    g.append(list(map(int, input().split())))
m = [[0 for j in range(w+1)]for i in range(n+1)]
for i in range(n+1):
    for j in range(w+1):
        if j-g[i-1][0] < 0:
            m[i][j] = m[i-1][j]
        else:
            m[i][j] = max(m[i-1][j], m[i-1][j-g[i-1][0]]+g[i-1][1])
print(m[n][w])

Fixed submission:
n, w = map(int, input().split())
g = []
for i in range(n):
    g.append(list(map(int, input().split())))
m = [[0 for j in range(w+1)]for i in range(n+1)]
for i in range(n):
    for j in range(w+1):
        if j-g[i][0] < 0:
            m[i+1][j] = m[i][j]
        else:
            m[i+1][j] = max(m[i][j], m[i][j-g[i][0]]+g[i][1])
print(m[n][w])
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input())
a = sum([int(i) for i in input().split()])

print(n-a if n-a>=0 else '-1')

Fixed submission:
n, m = map(int, input().split())
a = sum([int(i) for i in input().split()])

print(n-a if n-a>=0 else '-1')
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())

while abs(n-k) < n:
    n = abs(n-k)

print(n)

Fixed submission:
n, k = map(int, input().split())

n = n % k

while abs(n-k) < n:
    n = abs(n-k)

print(n)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = list(input())

if n % 2 == 1:
    print('No')
    exit()

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

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

if n % 2 == 1:
    print('No')
    exit()

l = int(n/2)
print('Yes') if s[:l] == s[l:] else print('No')
Buggy python submission (verdict: Runtime Error):
s = sorted(input())

if s[0] == s[1] and s[2] == s[3] and s[0] != s[2]:
    print('Yes')
else:
    print('No')


Fixed submission:
n = int(input())
p = [int(i) for i in input().split()]

count = 0

for i in range(n-2):
    if p[i] <= p[i+1] < p[i+2] or p[i+2] <= p[i+1] < p[i] or (p[i] == p[i+2] and p[i+1] < p[i]):
        count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
s, w = int(input().split())
if w >= s:
    print("unsafe")
else:
    print("safe")

Fixed submission:
s, w = map(int,input().split())
if w >= s:
    print("unsafe")
else:
    print("safe")
Buggy python submission (verdict: Time Limit Exceeded):
import math


nums = [int(e) for e in input().split()]

a = nums[0]
b = nums[1]
n = nums[2]

max_score = -1
score = -1

for x in range(1, n+1):
    score = math.floor(a*x/b) - a* math.floor(x/b)
    if max_score < score:
        max_score = score
        x += 1
    elif x > b:
        break

print(max_score)


Fixed submission:
import math


nums = [int(e) for e in input().split()]

a = nums[0]
b = nums[1]
n = nums[2]

max_score = -1
score = -1

# for x in range(1, n+1):
#     score = math.floor(a*x/b) - a* math.floor(x/b)
#     if max_score < score:
#         max_score = score
#     elif x > b:
#         break

if b > n:
    max_score = math.floor(a*n/b)
else:
    max_score = math.floor(a*(b-1)/b)

print(max_score)

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


nums = [int(e) for e in input().split()]

a = nums[0]
b = nums[1]
n = nums[2]

max_score = -1
score = -1

while True:
    score = math.floor(a*x/b) - a* math.floor(x/b)
    if max_score < score:
        max_score = score
    elif x > n:
        break

print(max_score)

Fixed submission:
import math


nums = [int(e) for e in input().split()]

a = nums[0]
b = nums[1]
n = nums[2]

max_score = -1
score = -1

# for x in range(1, n+1):
#     score = math.floor(a*x/b) - a* math.floor(x/b)
#     if max_score < score:
#         max_score = score
#     elif x > b:
#         break

if b > n:
    max_score = math.floor(a*n/b)
else:
    max_score = math.floor(a*(b-1)/b)

print(max_score)

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


nums = [int(e) for e in input().split()]

a = nums[0]
b = nums[1]
n = nums[2]

max_score = -1
score = -1

for x in range(1, n+1):
    score = math.floor(a*x/b) - a* math.floor(x/b)
    if max_score < score:
        max_score = score

print(max_score)


Fixed submission:
import math


nums = [int(e) for e in input().split()]

a = nums[0]
b = nums[1]
n = nums[2]

max_score = -1
score = -1

# for x in range(1, n+1):
#     score = math.floor(a*x/b) - a* math.floor(x/b)
#     if max_score < score:
#         max_score = score
#     elif x > b:
#         break

if b > n:
    max_score = math.floor(a*n/b)
else:
    max_score = math.floor(a*(b-1)/b)

print(max_score)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
ans_list = list(range(1,N+1))
HList = list(map(int, input().split()))
rootList = []

for i in range(M):
  a, b = map(int, input().split())
  H_a = HList[a-1]
  H_b = HList[b-1]
  if(a in ans_list):
    if(H_b > H_a or H_b == H_a):
      ans_list.remove(a)
  if(b in ans_list):
    if(H_a > H_b or H_b == H_a):
      ans_list.remove(b)

print(len(ans_list))


Fixed submission:
N, M = map(int, input().split())
keyList = list(range(1,N+1))
values = [True] * N
dic = dict(zip(keyList, values))
HList = list(map(int, input().split()))
ans = []

for i in range(M):
  a, b = map(int, input().split())
  H_a = HList[a-1]
  H_b = HList[b-1]
  if(H_a == H_b):
    dic[a] = False
    dic[b] = False
  elif(H_b > H_a):
    dic[a] = False
  elif(H_a > H_b):
    dic[b] = False


for i in range(1, len(dic.values())+1):
  if(dic[i] == True):
    ans.append(dic[i])
print(len(ans))
Buggy python submission (verdict: Time Limit Exceeded):
import sys

N = int(input())
d = list(map(int, input().split(" ")))

for item in d:
  if d.count(item) > 1:
    print("NO")
    sys.exit()

print("YES")


Fixed submission:
import sys

N = int(input())
d = list(map(int, input().split(" ")))

newList = list(dict.fromkeys(d))

if len(d) == len(newList):
  print('YES')
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())
list = [500000,300000,200000,100000,0]
if(A>3):
    A = 4
elif(B>3):
    B = 4
elif(A==1 and B==1):
    A=B=0
money = list[A]+list[B]
print(money)


Fixed submission:
A, B = map(int, input().split())

list = [500000,300000,200000,100000,0]

if(A>3):
    A = 4
if(B>3):
    B = 4
elif(A==1 and B==1):
    A=B=0
money = list[A]+list[B]
print(money)

Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())
list = [300000,200000,100000,0]
if(A>3 or A<0):
    A = 4
elif(B>3 or B<0):
    B = 4
money = list[A-1]+list[B-1]
if(A==1 and B==1):
    money = 1000000
print(money)


Fixed submission:
A, B = map(int, input().split())

list = [500000,300000,200000,100000,0]

if(A>3):
    A = 4
if(B>3):
    B = 4
elif(A==1 and B==1):
    A=B=0
money = list[A]+list[B]
print(money)

Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())
list = [300000,200000,100000,0]
if(A>3):
    A = 4
elif(B>3):
    B = 4
money = list[A-1]+list[B-1]
if(A==1 and B==1):
    money = 1000000
print(money)


Fixed submission:
A, B = map(int, input().split())

list = [500000,300000,200000,100000,0]

if(A>3):
    A = 4
if(B>3):
    B = 4
elif(A==1 and B==1):
    A=B=0
money = list[A]+list[B]
print(money)

Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())

list = [300000,200000,100000,0]

if(A>3):
    A = 4
elif(B>3):
    B = 4

money = list[A-1]+list[B-1]


if(A==1 and B==1):
    money = 1000000

print(money)


Fixed submission:
A, B = map(int, input().split())

list = [500000,300000,200000,100000,0]

if(A>3):
    A = 4
if(B>3):
    B = 4
elif(A==1 and B==1):
    A=B=0
money = list[A]+list[B]
print(money)
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())if(A-B*2>0):print(A-B*2)else:print(0)


Fixed submission:
A, B = map(int, input().split())

if(A-B*2>0):
    print(A-B*2)
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split(" ")))

i = 1
for a_s in a:
    print(a.index(i)+1)
    i += 1


Fixed submission:
n = int(input())
a = list(map(int, input().split(" ")))
dic = {}
i = 0
for a_s in a:
    dic.setdefault(i, a_s)
    i += 1
for k, v in sorted(dic.items(), key=lambda x: x[1]):
    print(k + 1)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split(" ")))
list = [a.index(x)+1 for x in range(1, n+1)]
print(*list)


Fixed submission:
n = int(input())
a = list(map(int, input().split(" ")))
dic = {}
i = 0
for a_s in a:
    dic.setdefault(i, a_s)
    i += 1
for k, v in sorted(dic.items(), key=lambda x: x[1]):
    print(k + 1)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split(" ")))

i = 0

list = [a.index(x)+1 for x in range(1, n+1)]

print(*list)


Fixed submission:
n = int(input())
a = list(map(int, input().split(" ")))
dic = {}
i = 0
for a_s in a:
    dic.setdefault(i, a_s)
    i += 1
for k, v in sorted(dic.items(), key=lambda x: x[1]):
    print(k + 1)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

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

i = 0
list = []

for a_s in a:
    list.insert(0, (a.index(n - i) + 1))
    i += 1

print(*list)


Fixed submission:
n = int(input())
a = list(map(int, input().split(" ")))
dic = {}
i = 0
for a_s in a:
    dic.setdefault(i, a_s)
    i += 1
for k, v in sorted(dic.items(), key=lambda x: x[1]):
    print(k + 1)

Buggy python submission (verdict: Runtime Error):
n = int(input())a = list(map(int, input().split(" ")))i = 0list = []for a_s in a:list.insert(0, (a.index(n - i) + 1))i += 1print(*list)


Fixed submission:
n = int(input())
a = list(map(int, input().split(" ")))
dic = {}
i = 0
for a_s in a:
    dic.setdefault(i, a_s)
    i += 1
for k, v in sorted(dic.items(), key=lambda x: x[1]):
    print(k + 1)

Buggy python submission (verdict: Runtime Error):
n = int(input())a = list(map(int, input().split(" ")))i = 0list = []for a_s in a:list.insert(0, x = a.index(n - i) + 1)i += 1print(*list)


Fixed submission:
n = int(input())
a = list(map(int, input().split(" ")))
dic = {}
i = 0
for a_s in a:
    dic.setdefault(i, a_s)
    i += 1
for k, v in sorted(dic.items(), key=lambda x: x[1]):
    print(k + 1)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

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

i=0
list = []

for a_s in a:
    length = len(a)
    x = a.index((length) - i) + 1
    list.insert(0, x)
    i += 1

print(*list)

Fixed submission:
n = int(input())
a = list(map(int, input().split(" ")))
dic = {}
i = 0
for a_s in a:
    dic.setdefault(i, a_s)
    i += 1
for k, v in sorted(dic.items(), key=lambda x: x[1]):
    print(k + 1)
Buggy python submission (verdict: Runtime Error):
import sys
S = sorted(set(input()))

alp = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

for i in range(len(alp)):
  if S[i] != alp[i]:
    print(alp[i])
    sys.exit()

print('None')


Fixed submission:
import sys
S = sorted(set(input()))

alp = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

for i in range(len(alp)):
  if (i>len(S)-1):
    print(alp[i])
    sys.exit()
  elif S[i] != alp[i]:
    print(alp[i])
    sys.exit()

print('None')
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline


N = int(input().rstrip())
a_dict = {}
for i in range(N):
  a_dict[i+1] = int(input().rstrip())

target = 1
next_target = a_dict[target]
cont = True
ans = 0

while cont:
  del a_dict[target]
  target = next_target
  next_target = a_dict[target]
  ans += 1
  if next_target not in a_dict:
    ans = -1
    cont = False
  elif next_target == 2:
    ans += 1
    cont = False

print(ans)


Fixed submission:
import sys
input = sys.stdin.readline


N = int(input().rstrip())
a_dict = {}
for i in range(N):
  a_dict[i+1] = int(input().rstrip())

target = 1
next_target = a_dict[target]
cont = True
ans = 0

if next_target == 2:
  cont = False
  ans += 1

while cont:
  target = next_target
  next_target = a_dict[target]
  ans += 1
  del a_dict[target]
  if next_target not in a_dict:
    ans = -1
    cont = False
  elif next_target == 2:
    ans += 1
    cont = False
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

power = 1
for i in range(1, N+1):
  power *= i

print(power % (10 ** 9 + 7))


Fixed submission:
N = int(input())

power = 1
for i in range(1, N+1):
  power = power * i % (10 ** 9 + 7)

print(power)
Buggy python submission (verdict: Runtime Error):
def dfs(i, f):
    if i == n - 1:
        return sum(list(map(int, f.split("+"))))
    return dfs(i + 1, f + s[i + 1]) + dfs(i + 1, f + "+" + s[i + 1])s
s = input()
n = len(s)

print(dfs(0, s[0]))


Fixed submission:
def dfs(i, f):
    if i == n - 1:
        return sum(list(map(int, f.split("+"))))

    # 式 f の末尾に "+" を追加するかしないかして次の数字を追加
    return dfs(i + 1, f + s[i + 1]) + \
           dfs(i + 1, f + "+" + s[i + 1])


s = input()
n = len(s)

print(dfs(0, s[0]))
Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,k = map(int, input().split())
ans = 0
for i in range(k):
    if a > 0:
        ans +=1
        a -=1
    elif b >0:
        b -=1
    else:
        ans -= 1
        c -=1

print(ans)


Fixed submission:
a,b,c,k = map(int, input().split())
ans = 0

if a >= k:
    ans += k
    print(ans)
    k -=a
else:
    ans += a
    k -= a

if k >0:
    if b >= k:
        print(ans)
        k -=b
    else:
        k -=b

if k > 0:
    if c >= k:
        ans -=k
        print(ans)
        k -=c
    else:
        k -=c
        print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
ans =0
for i in range(1000000000000000000):
  ans += 1
print(ans)

Fixed submission:
n,k = map(int,input().split())
ans =[k]
mod = n%k 
ans.append(mod)

ans.append(k - mod) 
print(min(ans))
Buggy python submission (verdict: Runtime Error):
L = int(input())/3
print(L**3)

Fixed submission:
s = input()
if s == s[::-1]:
    flag = True
else:
    flag = False
N = len(s)
if flag:
    new = s[0:int((N-1)/2)]
    if new == new[::-1]:
        flag = True
    else: flag = False

if flag:
    new = s[int((N+2)/2):N]
    if new == new[::-1]:
        flag = True
    else:
        flag = False

if flag:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
num = int(input())
l = list(map(int,input().split()))
a = 0
for i in l:
    if l.count(i) > 1:
        a = a+1
print('YES') if a == 0 else print('NO')

Fixed submission:
num = int(input())
l = list(map(int,input().split()))
print('NO') if len(l) != len(set(l)) else print('YES')

Buggy python submission (verdict: Time Limit Exceeded):
def Count(n, lis):
    for i in lis:
        if lis.count(i) > 1:
            return 'NO'
    return 'YES'

num = int(input())
l = list(map(int,input().split()))
print(Count(num,l))
    

Fixed submission:
num = int(input())
l = list(map(int,input().split()))
print('NO') if len(l) != len(set(l)) else print('YES')
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
Hs = map(int,input().split())
print(sum(sorted(Hs, reverse=True)[K::]))

Fixed submission:
import math

H, A = [int(x) for x in input().split()]
print(math.ceil(H/A))

Buggy python submission (verdict: Runtime Error):
h = int(input())
result, i = 0, 1
while h > 0:
    h //= 2
    result += i
    i *= 2
    
print(result)

Fixed submission:
import math

H, A = [int(x) for x in input().split()]
print(math.ceil(H/A))
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
Hs = map(int,input().split())
print(sum(sorted(Hs, reverse=True)[K::])

Fixed submission:
N, K = map(int, input().split())
Hs = map(int,input().split())
print(sum(sorted(Hs, reverse=True)[K::]))
Buggy python submission (verdict: Runtime Error):

def blackjack(a, b, c):
    if (a+b+c) >= 22:
        return "bust"
    else:
        return "win"

A1 = int(input('Input A1:'))
A2 = int(input('Input A2:'))
A3 = int(input('Input A3:'))
print(blackjack(A1, A2, A3))


Fixed submission:
a = [int(x) for x in input().split(" ")]
print("bust") if sum(a) >= 22 else print("win")

Buggy python submission (verdict: Runtime Error):
def blackjack(A1, A2, A3):
    if (A1+A2+A3) >= 22:
        return "bust"
    else:
        return "win"

A1 = int(input('Input A1:'))
A2 = int(input('Input A2:'))
A3 = int(input('Input A3:'))
print(blackjack(A1, A2, A3))

Fixed submission:
a = [int(x) for x in input().split(" ")]
print("bust") if sum(a) >= 22 else print("win")

Buggy python submission (verdict: Runtime Error):
A1 = int(input('Input A1:'))
A2 = int(input('Input A2:'))
A3 = int(input('Input A3:'))
if (A1+A2+A3) >= 22:
    print('bust')
else:
    print('win')

Fixed submission:
a = [int(x) for x in input().split(" ")]
print("bust") if sum(a) >= 22 else print("win")

Buggy python submission (verdict: Runtime Error):
A1 = int(input('Input A1:'))
A2 = int(input('Input A2:'))
A3 = int(input('Input A3:'))
if (A1+A2+A3) >= 22:
    print('bust')
else:
    print('win')

Fixed submission:
a = [int(x) for x in input().split(" ")]
print("bust") if sum(a) >= 22 else print("win")