Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
X,Y,Z,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

K=min(K,3000)

AB=[a+b for a in A for b in B]
AB.sort(reverse=True)

ABC=[ab+c for ab in AB[:K] for c in C]
ABC.sort(reverse=True)

for k in range(K):
	print(ABC[k])


Fixed submission:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())

list=[a,b,c,d,e]
list.sort(reverse=True)

if list[0]-list[4]<=k:
  print("Yay!")
  
else:
  print(":(")

Buggy python submission (verdict: Runtime Error):
X,Y,Z,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

K=min(K,3000)

AB=[a+b for a in A for b in B]
AB.sort(reverse=True)

ABC=[ab+c for ab in AB[:K] for c in C[:K]]
ABC.sort(reverse=True)

for k in range(K):
	print(ABC[k])


Fixed submission:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())

list=[a,b,c,d,e]
list.sort(reverse=True)

if list[0]-list[4]<=k:
  print("Yay!")
  
else:
  print(":(")
Buggy python submission (verdict: Runtime Error):
from collections import Counter

n=int(input())
v=list(map(int,input().split()))

v1=[]
v2=[]

for i in range(n):
  if i%2==0:
    v1.append(v[i])
  else:
    v2.append(v[i])

v1c = Counter(v1).most_common()
v2c = Counter(v2).most_common()
ans2=float("inf")
ans3=float("inf")


if v1c[0][0]!=v2c[0][0]:
  ans=len(v1)-v1c[0][1]+len(v2)-v2c[0][1]
  print(ans)

else:
  if len(v1c) !=1:
  	ans2=len(v1)-v1c[1][1]+len(v2)-v2c[0][1]
  elif len(v2c) !=1:
    ans3=len(v1)-v1c[0][1]+len(v2)-v2c[1][1]
  else:
    ans4=min(len(v1),len(v2))
  print(min(ans2,ans3,ans4))
 
  

Fixed submission:
from collections import Counter

n=int(input())
v=list(map(int,input().split()))

v1=[]
v2=[]

for i in range(n):
  if i%2==0:
    v1.append(v[i])
  else:
    v2.append(v[i])

v1c = Counter(v1).most_common()
v2c = Counter(v2).most_common()

ans2=float("inf")
ans3=float("inf")
ans4=float("inf")


if v1c[0][0]!=v2c[0][0]:
  ans=len(v1)-v1c[0][1]+len(v2)-v2c[0][1]
  print(ans)

else:
  if len(v1c) !=1:
    ans2=len(v1)-v1c[1][1]+len(v2)-v2c[0][1]
  if len(v2c) !=1:
    ans3=len(v1)-v1c[0][1]+len(v2)-v2c[1][1]
  else:
    ans4=min(len(v1),len(v2))
  print(min(ans2,ans3,ans4))
Buggy python submission (verdict: Time Limit Exceeded):
A,B,C,K = map(int, input().split())
now = K
sum = 0

for i in range(A):
  if now == 0:
    break
  sum += 1 
  now = now - 1

if now != 0:
  for i in range(B):
    if now == 0:
      break
    now = now - 1
    
if now != 0:    
  for i in range(C):
    if now == 0:
      break
    sum -= 1
    now = now - 1
    
print(sum)

Fixed submission:
A,B,C,K = map(int, input().split())
now = K
sum = 0

if A < K:
  now -= A
  sum += A
  if B < now:
    now -= B
    print(sum - now)
  else:
    print(sum)
else:
  print(K)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
h_array = list(map(int, input().split()))
ab = []
sum = 0

for i in range(m):
  ab.append(list(map(int, input().split())))

for i in range(1, n + 1):
  result = True
  for j in range(len(ab)):
    if ab[j][1] == i:
      if h_array[ab[j][0]- 1] >= h_array[i - 1]:
        result = False

    elif ab[j][0] == i:
      if h_array[ab[j][1]- 1] >= h_array[i - 1]:
        result = False  
  
  if result:
    sum += 1

print(sum)

Fixed submission:
n, m = map(int, input().split())
h_array = list(map(int, input().split()))
ab = []
sum = 0
answer = [True for i in range(n)]

for i in range(m):
  ab.append(list(map(int, input().split())))

for i in range(len(ab)):
  if h_array[ab[i][0]- 1] >= h_array[ab[i][1]- 1]:
    answer[ab[i][1] - 1] = False
  if h_array[ab[i][1]- 1] >= h_array[ab[i][0]- 1]:
      answer[ab[i][0] - 1] = False

print(answer.count(True))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
h_array = list(map(int, input().split()))
ab = []
sum = 0

for i in range(m):
  ab.append(list(map(int, input().split())))

for i in range(1, n + 1):
  array = [element for element in ab if element[0] == i or element[1] == i]
  array.sort()
  result = True
  for j in range(len(array)):
    if (i == array[j][1]):
      if h_array[array[j][0]- 1] >= h_array[i - 1]:
        result = False
    else:
      if h_array[array[j][1]- 1] >= h_array[i - 1]:
        result = False
  if result:
    sum += 1

print(sum)

Fixed submission:
n, m = map(int, input().split())
h_array = list(map(int, input().split()))
ab = []
sum = 0
answer = [True for i in range(n)]

for i in range(m):
  ab.append(list(map(int, input().split())))

for i in range(len(ab)):
  if h_array[ab[i][0]- 1] >= h_array[ab[i][1]- 1]:
    answer[ab[i][1] - 1] = False
  if h_array[ab[i][1]- 1] >= h_array[ab[i][0]- 1]:
      answer[ab[i][0] - 1] = False

print(answer.count(True))
Buggy python submission (verdict: Runtime Error):
k = int(input())
a, b = map(int, input().split())
flag = False

for i in range(a, b + 1):
  if (i % k == 0):
    falg = True

if falg:
  print('OK')
else:
  print('NG')

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

for i in range(a, b + 1):
  if i % k == 0:
    flag = True

if flag:
  print('OK')
else:
  print('NG')
Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
i = list(map(int, input().split()))
for num in range(a):
  sum = 0
  for num2 in range(len(i)):
    if i[num2] == num + 1:
      sum += 1
  print(sum)      

Fixed submission:
a = int(input())
i = list(map(int, input().split()))
dict = {}
for num in range(a):
  dict[num] = 0

for num2 in range(len(i)):
  dict[i[num2] - 1] += 1

for num in range(a):
  print(dict[num])
Buggy python submission (verdict: Runtime Error):
a = input()
b = list(a)
if b[2] == b[3] and b[4] == b[5]:
  print('Yes')
else:
  cofff
  print('No')

Fixed submission:
a = input()
b = list(a)
if b[2] == b[3] and b[4] == b[5]:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
l = map(int, input().split())
print(l ** 3 / 27)

Fixed submission:
L = int(input())
L /= 3
print(L**3)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

S = []
counter = 0
for i in range(N):
    temp = input()
    if not temp in S:
        counter += 1
    S.append(temp)

print(counter)


Fixed submission:
N = int(input())

S = []
counter = 0
for i in range(N):
    S.append(input())

S = sorted(S)
for i in range(N-1):
    if S[i] == S[i+1]:
        counter += 1
print(N - counter)

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

S = []
counter = 0
for i in range(N):
    S.append(input())
    temp = 0
    for j in range(i):
        if S[j] == S[i]:
            temp = 1
            break

    if temp == 0:
        counter += 1
print(counter)


Fixed submission:
N = int(input())

S = []
counter = 0
for i in range(N):
    S.append(input())

S = sorted(S)
for i in range(N-1):
    if S[i] == S[i+1]:
        counter += 1
print(N - counter)
Buggy python submission (verdict: Runtime Error):
N = int(input())
M = int(input())

A = 0

for i in range(M):
  A += int(input())

if M < A:
  print(N-A)

else:
  print(-1)

Fixed submission:
N, M = map(int, input().split())

A = [int(i) for i in input().split()]

B = sum(A)

if N >= B:
  print(N-B)

else:
  print('-1')

Buggy python submission (verdict: Runtime Error):
N = int(input())
M = int(input())

A = 0

for i in range(M):
  A += int(input())

if M < A:
  print(N-A)

else:
  print(-1)

Fixed submission:
N, M = map(int, input().split())

A = [int(i) for i in input().split()]

B = sum(A)

if N >= B:
  print(N-B)

else:
  print('-1')

Buggy python submission (verdict: Runtime Error):
N = int(input())
M = int(input())

A = 0

for i in range(M):
  A += int(input())

if M < A:
  print(N-A)

else:
  print(-1)

Fixed submission:
N, M = map(int, input().split())

A = [int(i) for i in input().split()]

B = sum(A)

if N >= B:
  print(N-B)

else:
  print('-1')

Buggy python submission (verdict: Runtime Error):
N = int(input())

A = []

for i in range(N-1):
  a = int(input())
  A.append(a)

B = []

for j in range(N-1):
  temp = 0
  for i in A:
    if i-2 == j:
      temp += 1
  B.append(temp)        
for j in range(N-1):
  print(B[j])

Fixed submission:
N, M = map(int, input().split())

A = [int(i) for i in input().split()]

B = sum(A)

if N >= B:
  print(N-B)

else:
  print('-1')

Buggy python submission (verdict: Runtime Error):
N = int(input())
M = int(input())

A = 0

for i in range(M):
  A += int(input())

if M < A:
  print(N-A)

else:
  print(-1)

Fixed submission:
N, M = map(int, input().split())

A = [int(i) for i in input().split()]

B = sum(A)

if N >= B:
  print(N-B)

else:
  print('-1')

Buggy python submission (verdict: Runtime Error):
N = int(input())
M = int(input())

A = 0

for i in range(M):
    A += int(input())

if M < A:
    print(N-A)

else:
    print(-1)

Fixed submission:
N, M = map(int, input().split())

A = [int(i) for i in input().split()]

B = sum(A)

if N >= B:
  print(N-B)

else:
  print('-1')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

A = [int(i) for i in input().split()]

for j in range(1, N+1):
    print(A.count(j))

Fixed submission:
import collections

N = int(input())

A = [int(i) for i in 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 = [int(i) for i in input().split()]

B = []

for j in range(1, N+1):
    temp = 0
    for i in A:
        if i == j:
            temp += 1
    print(temp)      


Fixed submission:
import collections

N = int(input())

A = [int(i) for i in input().split()]

c = collections.Counter(A)

for i in range(1, N+1):
    print(c[i])

Buggy python submission (verdict: Runtime Error):
N = int(input())

A = []

for i in range(N-1):
    A.append(int(input()))

B = []

for j in range(N-1):
    temp = 0
    for i in A:
        if i-2 == j:
            temp += 1
    B.append(temp)        
for j in range(N-1):
    print(B[j])

Fixed submission:
import collections

N = int(input())

A = [int(i) for i in input().split()]

c = collections.Counter(A)

for i in range(1, N+1):
    print(c[i])

Buggy python submission (verdict: Runtime Error):
N = int(input())

A = []

for i in range(N-1):
    A.append(int(input()))

B = []

for j in range(N-1):
    temp = 0
    for i in A:
        if i-2 == j:
            temp += 1
    B.append(temp)        
for j in range(N-1):
    print(B[j])

Fixed submission:
import collections

N = int(input())

A = [int(i) for i in input().split()]

c = collections.Counter(A)

for i in range(1, N+1):
    print(c[i])

Buggy python submission (verdict: Runtime Error):
N = int(input())

A = []

for i in range(N-1):
    A.append(int(input()))

B = []

for j in range(N-1):
    temp = 0
    for i in A:
        if i-2 == j:
            temp += 1
    B.append(temp)        
for j in range(N-1):
    print(B[j])

Fixed submission:
import collections

N = int(input())

A = [int(i) for i in input().split()]

c = collections.Counter(A)

for i in range(1, N+1):
    print(c[i])
Buggy python submission (verdict: Runtime Error):
M = int(input())
K = int(input()) 

sum = 0

for j in range(K,M+2):
    temp = j*(M-j+1) + 1
    if temp > (10^9 + 7):
        temp = temp%(10^9 + 7)
    sum += temp

print(sum)

Fixed submission:
M, K = map(int, input().split())

sum = 0

for j in range(K,M+2):
    temp = j*(M-j+1) + 1
    if temp > (10**9 + 7):
        temp = temp%(10**9 + 7)
    sum += temp
if sum > 10**9+7:
    sum = sum%(10**9+7)

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

ans = [0] * n
for i in (range(n)):
    ans[i] = a.count(i+1)
    print(ans[i])

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

ans = [0] * n
for i in a:
    ans[i-1] += 1

for i in range(n):
    print(ans[i])
Buggy python submission (verdict: Runtime Error):
x = int(input())
y = int(input())
z = int(input())

a = z
b = x
c = y

print(a, b, c)

Fixed submission:
x, y, z = map(int, input().split())

print(z, x, y)

Buggy python submission (verdict: Runtime Error):
x = int(input())
y = int(input())
z = int(input())

print(z, x, y)

Fixed submission:
x, y, z = map(int, input().split())

print(z, x, y)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
l = n % k

if (n < k):
    print(k % n)
elif (n >= k):
    if (l == 0):
        print(0)
    else:
        print(abs(k - n))

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

print(min(l, abs(l - k)))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = list(map(int, input().split()))

c = [0] * n

for i in range(n):
    for j in range(i):
        if p[i] > p[j]:
            c[i] = 1
            break

print(c.count(0))

Fixed submission:
n = int(input())
p = [int(i) for i in input().split()]
x = p[0]
ans = 0
for i in p:
    if x >= i:
        ans += 1
        x = i
print(ans)

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

c = [0] * n

for i in range(n):
    for j in range(i):
        #print(p[i],p[j])
        if p[i] > p[j]:
            c[i] = 1

print(c.count(0))

Fixed submission:
n = int(input())
p = [int(i) for i in input().split()]
x = p[0]
ans = 0
for i in p:
    if x >= i:
        ans += 1
        x = i
print(ans)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
Q_n = [0] * N
C = [0] * N

Ans = 0
Pen = 0
for i in range(M):
    p, S = input().split()
    p = int(p)-1
    if (S == 'AC') and (Q_n[p] == 0):
        Q_n[p] = 1
        Ans += 1
        Pen += C[p]
    elif (S == 'WA'):
        C[p] += 1
        
print(Ans, Pen)
  


Fixed submission:
C = input()
print(chr(ord(C)+1))
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
Q_n = [0] * N
C = [0] * N

Ans = 0
Pen = 0
for i in range(M):
    p, S = input().split
    p = int(p)-1
    if (S == 'AC') and (Q_n[p] == 0):
        Q_n[p] = 1
        Ans += 1
        Pen += C[p]
    elif (S == 'WA'):
        C[p] += 1
        
print(Ans, Pen)
  


Fixed submission:
N, M = map(int, input().split())
Q_n = [0] * N
C = [0] * N

Ans = 0
Pen = 0
for i in range(M):
    p, S = input().split()
    p = int(p)-1
    if (S == 'AC') and (Q_n[p] == 0):
        Q_n[p] = 1
        Ans += 1
        Pen += C[p]
    elif (S == 'WA'):
        C[p] += 1
        
print(Ans, Pen)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
pS = [list(input().split()) for i in range(M)]

for x in range(M):
    pS[x][0] = int(pS[x][0])
    
Ans, Pen = 0, 0
for x in range(M):
    if (pS[x][0] != pS[x-1][0]):
        pS_temp = 0
        Ans_temp = 0
    if (pS[x][1] == 'AC') and (pS_temp == 0):
        Ans += 1
        Ans_temp += 1
        pS_temp += 1
    elif (pS[x][1] == 'WA') and (pS_temp == 0) and (Ans_temp == 0):
        Pen += 1
print(Ans, Pen)

Fixed submission:
N, M = map(int, input().split())
Q_n = [0] * N
C = [0] * N

Ans = 0
Pen = 0
for i in range(M):
    p, S = input().split()
    p = int(p)-1
    if (S == 'AC') and (Q_n[p] == 0):
        Q_n[p] = 1
        Ans += 1
        Pen += C[p]
    elif (S == 'WA'):
        C[p] += 1
        
print(Ans, Pen)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
pS = [list(input().split()) for i in range(M)]

for x in range(M):
    pS[x][0] = int(pS[x][0])
    
Ans, Pen = 0, 0
for x in range(M):
    if (pS[x][0] != pS[x-1][0]):
        pS_temp = 0
        Ans_temp = 0
    if (pS[x][1] == 'AC') and (pS_temp == 0):
        Ans += 1
        Ans_temp += 1
        pS_temp += 1
    elif (pS[y][1] == 'WA') and (pS_temp == 0) and (Ans_temp == 0):
        Pen += 1
print(Ans, Pen)

Fixed submission:
N, M = map(int, input().split())
Q_n = [0] * N
C = [0] * N

Ans = 0
Pen = 0
for i in range(M):
    p, S = input().split()
    p = int(p)-1
    if (S == 'AC') and (Q_n[p] == 0):
        Q_n[p] = 1
        Ans += 1
        Pen += C[p]
    elif (S == 'WA'):
        C[p] += 1
        
print(Ans, Pen)
Buggy python submission (verdict: Time Limit Exceeded):
A, B, K = map(int, input().split())

for x in range(0 , K):
    if (A >= 1):
        A = A - 1
        #print(A)
    elif (A == 0) and (B >= 1):
        B = B - 1
        #print(B)

print(A, B)

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

if (K > A + B):
    print(0, 0)
elif (K <= A):
    print(A - K, B)
elif (K > A):
    print(0, max(0, B - (K - A)))
Buggy python submission (verdict: Runtime Error):
import math

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

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(A, B))

Fixed submission:
import fractions

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

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

print(lcm(A, B))

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

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

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(A, B))

Fixed submission:
import fractions

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

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

print(lcm(A, B))
Buggy python submission (verdict: Runtime Error):
A1, A2, A3 = map(int, input().split())
s = A1 + A2 + A3

if s >= 22:
    print(bust)
else:
    print(win)

Fixed submission:
A1, A2, A3 = map(int, input().split())
s = A1 + A2 + A3

if s >= 22:
    print('bust')
else:
    print('win')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int, input().split()))

ans = [0] * n

for i in range(n):
    ans[i] = A.index(min(A)) + 1
    A[A.index(min(A))] = n + 1
    
print(' '.join(map(str, ans)))

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

ans = [0] * n

for idx, i in enumerate(A):
    ans[i-1] = idx + 1
    
print(' '.join(map(str, ans)))

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

ans = [0] * n

for i in range(n):
    ans[i] = A.index(i+1) + 1
print(' '.join(map(str, ans)))

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

ans = [0] * n

for idx, i in enumerate(A):
    ans[i-1] = idx + 1
    
print(' '.join(map(str, ans)))
Buggy python submission (verdict: Runtime Error):
from sys import stdin
input = stdin.readline
def minus(n):
  return n-1
  
def main():
  num_list = list(map(int, input().split()))
  A = list(map(int, input().split()))
  N=num_list[0]
  K=num_list[1]
  A_i=0
  N_list=[0]*N
  A =list(map(minus, A))
  sFlag=True
  i=0
  while(sFlag):
    i=i+1
    pre=A_i
    N_list[A_i]+=1
    if(N_list[A_i]==3):
      sumA=N_list.count(int(2))
      K=(K-i)%sumA
      for j in range(K):
        pre=A_i
        te=A[A_i]
        A_i=te
      break
    te=A[A_i]
    A_i=te
    if(i>=K):
      sFlag=False
      break
  print(A_i+1)
  
if __name__ == '__main__':
    main()

Fixed submission:
from sys import stdin
input = stdin.readline
def minus(n):
  return n-1
  
def main():
  num_list = list(map(int, input().split()))
  A = list(map(int, input().split()))
  N=num_list[0]
  K=num_list[1]
  A_i=0
  N_list=[0]*N
  A =list(map(minus, A))
  sFlag=True
  i=0
  while(sFlag):
    i=i+1
    pre=A_i
    N_list[A_i]+=1
    if(N_list[A_i]==3):
      sumA=N_list.count(int(2))
      sumA=sumA+N_list.count(int(3))
      K=(K-i)%sumA+1
      for j in range(K):
        pre=A_i
        te=A[A_i]
        A_i=te
      sFlag=False
      break
    te=A[A_i]
    A_i=te
    if(i>=K):
      sFlag=False
      break
  print(A_i+1)
  
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
  sFlag=False
  X= int(input())
  X_table=prime_decomposition(X)
  X_table.append(1)
  for i in range(-1000,1000):
    A=i
    for j in range(-1000,1000):
      X_n=i**5-j**5
      if(X_n==X):
        print(A,B)
        sFlag=True
        break
    if(sFlag==True):
      break

if __name__=='__main__':
  main()

Fixed submission:
def main():
  sFlag=False
  X= int(input())
  for i in range(-1000,1000):
    for j in range(-1000,1000):
      X_n=i**5-j**5
      if(X_n==X):
        print(i,j)
        sFlag=True
        break
    if(sFlag==True):
      break
 
if __name__=='__main__':
  main()

Buggy python submission (verdict: Runtime Error):
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(int(n))
  return table
def main():
  sFlag=False
  X= int(input())
  X_table=prime_decomposition(X)
  X_table.append(1)
  for i in range(-1000.1000):
    A=i
    for j in range(len(X_table)):
      B=A-X_table[j]
      X_n=A**5-B**5
      if(X_n==X):
        print(A,B)
        sFlag=True
        break
    if(sFlag==True):
      break

if __name__=='__main__':
  main()

Fixed submission:
def main():
  sFlag=False
  X= int(input())
  for i in range(-1000,1000):
    for j in range(-1000,1000):
      X_n=i**5-j**5
      if(X_n==X):
        print(i,j)
        sFlag=True
        break
    if(sFlag==True):
      break
 
if __name__=='__main__':
  main()

Buggy python submission (verdict: Time Limit Exceeded):
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(int(n))
  return table
def main():
  sFlag=False
  X= int(input())
  X_table=prime_decomposition(X)
  X_table.append(1)
  for i in range(X):
    A=i
    for j in range(len(X_table)):
      B=A-X_table[j]
      X_n=A**5-B**5
      if(X_n==X):
        print(A,B)
        sFlag=True
        break
    if(sFlag==True):
      break

if __name__=='__main__':
  main()

Fixed submission:
def main():
  sFlag=False
  X= int(input())
  for i in range(-1000,1000):
    for j in range(-1000,1000):
      X_n=i**5-j**5
      if(X_n==X):
        print(i,j)
        sFlag=True
        break
    if(sFlag==True):
      break
 
if __name__=='__main__':
  main()
Buggy python submission (verdict: Runtime Error):
import math
from sys import stdin
input = stdin.readline
def main():
  A,B,N=map(int,input().split())
  sMax=0
  sCount=0
  sTgt_past=0
  if(N//B>=1):
    print(A-1)
  else:
    for i in range(1,B):
      sTgt=(A*i//B)-A*(i//B)
      if(i==1):
        sMax=sTgt
      else:
        sMax=max(sMax,sTgt)
      sTgt_past=sMax
    print(int(sMax))
  
if __name__=='__main__':
  main()

Fixed submission:
def main():
  K=int(input())
  A,B=map(int, input().split())
  for i in range(A,B+1):
    sTgt=i
    if(i%K==0):
      print('OK')
      break
    elif(i==B):
      print('NG')
  
if __name__=='__main__':
  main()
Buggy python submission (verdict: Time Limit Exceeded):
import collections
N=int(input())
A_list = list(map(int, input().split()))
Alist=[A_list.count(i+1) for i in range(N)]
for i in range(N):
  print(Alist[i])

Fixed submission:
import collections

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

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


Fixed submission:
import collections

N=int(input())
A_list = list(map(int, input().split()))
c = collections.Counter(A_list)
for i in range(N):
  print(c[i+1])
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=input()
sum=0
for k in range(n):
  for j in range(k):
    for i in range(j):
      if(((j-i)!=(k-j))&(s[i]!=s[j])&(s[j]!=s[k])&(s[k]!=s[i])):

        sum=sum+1
          
print(sum)

Fixed submission:
n = int(input())
for i in range(3):
  n_i=n//10**(2-i)
  if(n_i==7):
    print('Yes')
    break
  if(i==2):
    print('No')
  n=n-n_i*10**(2-i)