Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))
for j in range(N):
    if (A[j] != max(A)):
        print(max(A))
    elif(A.count(A[j]) != 1):
        print(A[j])
    else:
        print(sorted(A)[-2])

Fixed submission:
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))
maxA = max(A)
secondA = sorted(A)[-2]
for j in range(N):
    if (A[j] != maxA):
        print(maxA)
    else:
        print(secondA)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))
for j in range(N):
    if (A[j] != max(A)):
        print(max(A))
    elif(A.count(A[i]) > 1):
        print(A[i])
    else:
        print(sorted(A)[-2])

Fixed submission:
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))
maxA = max(A)
secondA = sorted(A)[-2]
for j in range(N):
    if (A[j] != maxA):
        print(maxA)
    else:
        print(secondA)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))
for j in range(N):
    if (A[j] != max(A)):
        print(max(A))
    elif(A.count(A[i]) > 1):
        print(A[i])
    else:
        print(sorted(A)[-2])

Fixed submission:
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))
maxA = max(A)
secondA = sorted(A)[-2]
for j in range(N):
    if (A[j] != maxA):
        print(maxA)
    else:
        print(secondA)

Buggy python submission (verdict: Time Limit Exceeded):
import copy
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))
for j in range(N):
    if (A[j] != max(A)):
        print(max(A))
    else:
        J = copy.deepcopy(A)
        del J[j]
        print(max(J))

Fixed submission:
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))
maxA = max(A)
secondA = sorted(A)[-2]
for j in range(N):
    if (A[j] != maxA):
        print(maxA)
    else:
        print(secondA)

Buggy python submission (verdict: Time Limit Exceeded):
import copy
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))
for j in range(N):
    I = copy.deepcopy(A)
    del I[j]
    print(max(I))

Fixed submission:
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))
maxA = max(A)
secondA = sorted(A)[-2]
for j in range(N):
    if (A[j] != maxA):
        print(maxA)
    else:
        print(secondA)
Buggy python submission (verdict: Runtime Error):
from collections import*
n,*A=map(int,open(0).read().split());C=Counter(A).items();f=1;l=len(C)
if l==3:f=(len(set(c[1]for c in C))>1)+n%3>0
elif l==2:f=(abs(C[1][1]-C[0][1])!=n//3)+n%3>0
else:f=(l!=1)+A[0]>0
print('YNeos'[f::2])

Fixed submission:
from collections import*
n,*A=map(int,open(0).read().split());C=Counter(A).items();f=1;l=len(C)
if l==3:
  x=0
  for c in C:x^=c[0]
  f=(len(set(c[1]for c in C))>1)+n%3+x>0
elif l==2:f=(abs(sum(c[1]*(-1)**i for i,c in enumerate(C)))!=n//3)+n%3>0
else:f=(l!=1)+A[0]>0
print('YNeos'[f::2])

Buggy python submission (verdict: Runtime Error):
from collections import*
n,*A=map(int,open(0).read().split());C=Counter(A).items();f=1;l=len(C)
if l==3:f=(len(set(c[1]for c in C))>1)+n%3>0
elif l==2:f=(abs(C[1][1]-C[0][1])!=n//3)+n%3>0
else:f=(l!=1)*(A[0]>0)
print('YNeos'[f::2])

Fixed submission:
from collections import*
n,*A=map(int,open(0).read().split());C=Counter(A).items();f=1;l=len(C)
if l==3:
  x=0
  for c in C:x^=c[0]
  f=(len(set(c[1]for c in C))>1)+n%3+x>0
elif l==2:f=(abs(sum(c[1]*(-1)**i for i,c in enumerate(C)))!=n//3)+n%3>0
else:f=(l!=1)+A[0]>0
print('YNeos'[f::2])
Buggy python submission (verdict: Runtime Error):
N, A, B = (int(x) for x in input().split)
if(N * A > B):
  print(N * A)
else:
  print(B)

Fixed submission:
N, A, B = (int(x) for x in input().split())
if(N * A < B):
  print(N * A)
else:
  print(B)

Buggy python submission (verdict: Runtime Error):
N = int(input("N = "))
A = int(input("A = "))
B = int(input("B = "))
train = N * A
taxi = B
if train >= taxi:
    print(taxi)
else:
    print(train)

Fixed submission:
N, A, B = (int(x) for x in input().split())
if(N * A < B):
  print(N * A)
else:
  print(B)
Buggy python submission (verdict: Runtime Error):
N = R - L
A = []
A.append(10000)
if(L >= R):
    print(0)
elif(L == 0):
    print(0)
else:
    if(N = 1):
        print((L * R) % 2019)
    else:
        for i in range(L, R + 1):
            for j in range(i + 1, R + 1):
                A.append((i * j) % 2019)
        print(min(A))

Fixed submission:
L, R = map(int, input().split())
ans = 10000
 
for i in range(L, min(R + 1, L + 2020)):
  for j in range(i,  min(R + 1, L + 2020)):
    if i < j:
      ans = min(ans, (i * j)%2019)
 
print(ans)

Buggy python submission (verdict: Runtime Error):
L, R = (int(x) for x in input().split())
L = L % 2019
R = R % 2019
if(L > R):
    print(0)
elif(L == 0):
    print(0)
N = R - L
A = []
if(N == 1):
    print(L * R % 2019)
else:
    for i in range(N):
        for j in range(i):
            A.append((L + i) * (L + j) % 2019)
    print(min(A))

Fixed submission:
L, R = map(int, input().split())
ans = 10000
 
for i in range(L, min(R + 1, L + 2020)):
  for j in range(i,  min(R + 1, L + 2020)):
    if i < j:
      ans = min(ans, (i * j)%2019)
 
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
X = [0 for i in range(N)]
S = 0
A2n = 0
for i in range(N):
    S += A[i]
    if i % 2 == 1:
        A2n += A[i]
X[0] = S - 2 * A2n
print(X[0], end=" ")
for i in range(1, N):
    X[i] = 2 * (A[i - 1] - int(X[i - 1] / 2))
    if i = N:
        print(X[i], end="")
    else:
        print(X[i], end=" ")

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
X = [0 for i in range(N)]
S = 0
A2n = 0
for i in range(N):
    S += A[i]
    if i % 2 == 1:
        A2n += A[i]
X[0] = S - 2 * A2n
print(X[0], end=" ")
for i in range(1, N):
    X[i] = 2 * (A[i - 1] - int(X[i - 1] / 2))
    if i == N:
        print(X[i], end="")
    else:
        print(X[i], end=" ")

Buggy python submission (verdict: Runtime Error):
n, m, M = (int(_) for _ in input().split())
dp = [[0 for i in range(n + 1)] for j in range(m + 1)]
dp[0][0] = 1
for i in range(1, m + 1):
    for j in range(n + 1):
        if j - i >= 0:
            dp[i][j] = (dp[i - 1][j] + dp[i][j -i]) % M
        else:
            dp[i][j] = dp[i - 1][j]
    print(dp)
print(dp[m][n])

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
X = [0 for i in range(N)]
S = 0
A2n = 0
for i in range(N):
    S += A[i]
    if i % 2 == 1:
        A2n += A[i]
X[0] = S - 2 * A2n
print(X[0], end=" ")
for i in range(1, N):
    X[i] = 2 * (A[i - 1] - int(X[i - 1] / 2))
    if i == N:
        print(X[i], end="")
    else:
        print(X[i], end=" ")
Buggy python submission (verdict: Runtime Error):
#ABC132 A
S = list(input())
S.sort()
if S[0] == S[1] and S[2] == S[3] and S[0] != S[2]:
    print("Yes")
else:
    print("No")

Fixed submission:
#ABC132 B
n = int(input())
p = list(map(int, input().split()))
C = 0
for i in range(1, n - 1):
    L = [p[i - 1], p[i], p[i + 1]]
    L.sort()
    if p[i] == L[1]:
        C += 1
print(C)
Buggy python submission (verdict: Runtime Error):
#ABC132 D
import math
def cmb(n, r):
    s = math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
    return s
N, K = map(int, input().split())
for i in range(K):
    print((cmb(N - K + 1, i + 1) * cmb(K - 1, i)) % ((10 ** 9) + 7) )

Fixed submission:
#ABC132 D
import math
def cmb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N, K = map(int, input().split())
for i in range(K):
    try:
        print((cmb(N - K + 1, i + 1) * cmb(K - 1, i)) % ((10 ** 9) + 7))
    except:
        print(0)

Buggy python submission (verdict: Runtime Error):
#ABC132 D
import math
def cmb(n, r):
    s = math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
    return s
N, K = map(int, input().split())
for i in range(K):
    print(cmb(N - K + 1, i + 1) % ((10 ** 9) + 7) * cmb(K - 1, i))

Fixed submission:
#ABC132 D
import math
def cmb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N, K = map(int, input().split())
for i in range(K):
    try:
        print((cmb(N - K + 1, i + 1) * cmb(K - 1, i)) % ((10 ** 9) + 7))
    except:
        print(0)
Buggy python submission (verdict: Runtime Error):
#ABC131 C
import math

A, B, C, D = map(int, input().split())
def ad(X):
    XmodC = X // C
    XmodD = X // D
    CD_lcm = C * D / math.gcd(C, D)
    XmodCD = X // CD_lcm
    return X - int(XmodC + XmodD - XmodCD)
ans = int(ad(B) - ad(A - 1))
print(ans)

Fixed submission:
#ABC131 C
import fractions

A, B, C, D = map(int, input().split())
def ad(X):
    XmodC = int(X // C)
    XmodD = int(X // D)
    CD_lcm = int(C * D / fractions.gcd(C, D))
    XmodCD = int(X // CD_lcm)
    return X - (XmodC + XmodD - XmodCD)
ans = ad(B) - ad(A - 1)
print(ans)

Buggy python submission (verdict: Runtime Error):
#ABC131 C
import math

A, B, C, D = map(int, input().split())
def ad(X):
    XmodC = X // C
    XmodD = X // D
    CD_lcm = C * D / math.gcd(C, D)
    XmodCD = X // CD_lcm
    return X - int(XmodC + XmodD - XmodCD)
print(ad(B) - ad(A - 1))

Fixed submission:
#ABC131 C
import fractions

A, B, C, D = map(int, input().split())
def ad(X):
    XmodC = int(X // C)
    XmodD = int(X // D)
    CD_lcm = int(C * D / fractions.gcd(C, D))
    XmodCD = int(X // CD_lcm)
    return X - (XmodC + XmodD - XmodCD)
ans = ad(B) - ad(A - 1)
print(ans)

Buggy python submission (verdict: Runtime Error):
#ABC131 C
import math

A, B, C, D = (int(_) for _ in input().split())
def ad(X):
    XmodC = X // C
    XmodD = X // D
    CD_lcm = C * D / math.gcd(C, D)
    XmodCD = X // CD_lcm
    return X - int(XmodC + XmodD - XmodCD)
print(ad(B) - ad(A - 1))

Fixed submission:
#ABC131 C
import fractions

A, B, C, D = map(int, input().split())
def ad(X):
    XmodC = int(X // C)
    XmodD = int(X // D)
    CD_lcm = int(C * D / fractions.gcd(C, D))
    XmodCD = int(X // CD_lcm)
    return X - (XmodC + XmodD - XmodCD)
ans = ad(B) - ad(A - 1)
print(ans)

Buggy python submission (verdict: Runtime Error):
#ABC131 C
import math
A, B, C, D = (int(_) for _ in input().split())
def ad(X):
    XmodC = X // C
    XmodD = X // D
    CD_lcm = C * D / math.gcd(C, D)
    XmodCD = X // CD_lcm
    return X - (XmodC + XmodD - XmodCD)
print(int(ad(B) - ad(A - 1)))

Fixed submission:
#ABC131 C
import fractions

A, B, C, D = map(int, input().split())
def ad(X):
    XmodC = int(X // C)
    XmodD = int(X // D)
    CD_lcm = int(C * D / fractions.gcd(C, D))
    XmodCD = int(X // CD_lcm)
    return X - (XmodC + XmodD - XmodCD)
ans = ad(B) - ad(A - 1)
print(ans)

Buggy python submission (verdict: Runtime Error):
#ABC131 C
import math
A, B, C, D = (int(_) for _ in input().split())
ABmodC = B // C - A // C
ABmodD = B // D - A // D
CD_lcm = C * D / math.gcd(C, D)
ABmodCD = B // CD_lcm - A // CD_lcm
print(int(ABmodC + ABmodD - ABmodCD))


Fixed submission:
#ABC131 C
import fractions

A, B, C, D = map(int, input().split())
def ad(X):
    XmodC = int(X // C)
    XmodD = int(X // D)
    CD_lcm = int(C * D / fractions.gcd(C, D))
    XmodCD = int(X // CD_lcm)
    return X - (XmodC + XmodD - XmodCD)
ans = ad(B) - ad(A - 1)
print(ans)
Buggy python submission (verdict: Runtime Error):
X, A = (int(_) for _ in input().split())
if x >= A:
      print(10)
else:
      print(0)

Fixed submission:
X, A = (int(_) for _ in input().split())
if X >= A:
      print(10)
else:
      print(0)

Buggy python submission (verdict: Runtime Error):
X, A = (int(_) for _ in input().split())
if x >= A:
  print(10)
else:
  print(0)

Fixed submission:
X, A = (int(_) for _ in input().split())
if X >= A:
      print(10)
else:
      print(0)
Buggy python submission (verdict: Runtime Error):
N, X = (int(_) for _ in input().split())
L = list(map(int, input().split()))
D = 0
ans = 1
while (D < X or ans < N):
    D += L[ans - 1]
    ans += 1
if D == X:
    print(ans)
else:
    print(ans - 1)

Fixed submission:
N, X = (int(_) for _ in input().split())
L = list(map(int, input().split()))
D = [0 for i in range(N + 1)]
ans = 0
for i in range(N):
    D[i + 1]= D[i] + L[i]
for i in range(N + 1):
    if D[i] <= X:
        ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
N, X = (int(_) for _ in input().split())
L = list(map(int, input().split()))
D = 0
ans = 1
while (D < X or ans < N):
    D += L[ans - 1]
    ans += 1
    print(D, ans)
if D == X:
    print(ans)
else:
    print(ans - 1)

Fixed submission:
N, X = (int(_) for _ in input().split())
L = list(map(int, input().split()))
D = [0 for i in range(N + 1)]
ans = 0
for i in range(N):
    D[i + 1]= D[i] + L[i]
for i in range(N + 1):
    if D[i] <= X:
        ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
N, X = (int(_) for _ in input().split())
L = list(map(int, input().split()))
D = 0
ans = 0
while (D < X or ans < N):
    D = D + L[ans]
    ans += 1
if D == X:
    print(ans)
else:
    print(ans - 1)

Fixed submission:
N, X = (int(_) for _ in input().split())
L = list(map(int, input().split()))
D = [0 for i in range(N + 1)]
ans = 0
for i in range(N):
    D[i + 1]= D[i] + L[i]
for i in range(N + 1):
    if D[i] <= X:
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
N, M = (int(_) for _ in input().split())
a = [0 for i in range(M)]
MOD = 10 ** 9 + 7
for i in range(M):
    a[i] = int(input())
a.append(0)
dp = [0 for i in range(N + 1)]
j = 0
for i in range(N + 1):
    if i == a[j]:
        j += 1
    elif i == 0:
        dp[i] = 1
    elif i == 1:
        dp[i] = 1
    else:
        dp[i] = dp[i - 1] + dp[i - 2]
print(dp[N] % MOD)

Fixed submission:
#ABC129 C
N, M = (int(_) for _ in input().split())
a = [0 for i in range(M)]
MOD = 10 ** 9 + 7
for i in range(M):
    a[i] = int(input())
a.append(0)
dp = [0 for i in range(N + 1)]
j = 0
for i in range(N + 1):    
    if i == a[j] and M != 0:
        j += 1
    elif i == 0:
        dp[i] = 1
    elif i == 1:
        dp[i] = 1
    else:
        dp[i] = dp[i - 1] + dp[i - 2]
print(dp[N] % MOD)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = list(input())
S[K] = S[K].lower()
print(S[i] for i in range(N))

Fixed submission:
N, K = map(int, input().split())
S = list(input())
S[K -1] = S[K - 1].lower()
print(''.join(S))

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = input()
S[K] = S[K].lower():
print(S)

Fixed submission:
N, K = map(int, input().split())
S = list(input())
S[K -1] = S[K - 1].lower()
print(''.join(S))
Buggy python submission (verdict: Runtime Error):
n=int(input())
if n<2:
    print(1)
    exit()
A=[[] for _ in range(n)]
B=[0 for _ in range(n)]
for i in range(n-1):
    u,v,w=map(int,input().split())
    u-=1
    v-=1
    A[u].append([v,w,0])
    A[v].append([u,w,0])
def s(x):
    for i,a in enumerate(A[x]):
        if a[2]==0:
            if a[1]%2==0:B[a[0]]=B[x]
            else:B[a[0]]=B[x]^1
            A[x][i][2]=1
            for j,z in enumerate(A[a[0]]):
                if z[0]==x:A[a[0]][j][2]=1
            return s(a[0])
s(0)
for i in range(n):
    for a in A[i]:
        if a[2]==0:s(i)
for b in B:print(b)


Fixed submission:
import sys
sys.setrecursionlimit(9**9)
n=int(input())
C=[0 for _ in range(n)]
L=[[] for _ in range(n)]
for j in range(n-1):
  u,v,w=map(int,input().split())
  u-=1
  v-=1
  L[u].append([v,w])
  L[v].append([u,w])
def a(n,v,d):
  for i in L[n]:
    if d%2==1:C[n]=1
    if v!=i[0]:a(i[0],n,d+i[1])
a(0,0,0)
for c in C:print(c)

Buggy python submission (verdict: Runtime Error):
n=int(input())
if n<2:
    print(1)
    exit()
A=[[] for _ in range(n)]
B=[0 for _ in range(n)]
for i in range(n-1):
    u,v,w=map(int,input().split())
    u-=1
    v-=1
    A[u].append([v,w,0])
    A[v].append([u,w,0])
def s(x):
    for i,a in enumerate(A[x]):
        if a[2]<1:
            if a[1]%2<1:B[a[0]]=B[x]
            else:B[a[0]]=B[x]^1
            A[x][i][2]=1
            for j,z in enumerate(A[a[0]]):
                if z[0]==x:A[a[0]][j][2]=1
            return s(a[0])
s(0)
for b in B:print(b)


Fixed submission:
import sys
sys.setrecursionlimit(9**9)
n=int(input())
C=[0 for _ in range(n)]
L=[[] for _ in range(n)]
for j in range(n-1):
  u,v,w=map(int,input().split())
  u-=1
  v-=1
  L[u].append([v,w])
  L[v].append([u,w])
def a(n,v,d):
  for i in L[n]:
    if d%2==1:C[n]=1
    if v!=i[0]:a(i[0],n,d+i[1])
a(0,0,0)
for c in C:print(c)
Buggy python submission (verdict: Runtime Error):
b = input():
if b == "A":
  print("T")
elif b == "T":
  print("A")
elif b == "G":
  print("C")
elif b == "C":
  print("G")

Fixed submission:
b = input()
if b == "A":
  print("T")
elif b == "T":
  print("A")
elif b == "G":
  print("C")
elif b == "C":
  print("G")

Buggy python submission (verdict: Runtime Error):
b = input():
if b == "A":
  print("T")
elif b = "T":
  print("A")
elif b = "G":
  print("C")
elif v = "C":
  print("G")

Fixed submission:
b = input()
if b == "A":
  print("T")
elif b == "T":
  print("A")
elif b == "G":
  print("C")
elif b == "C":
  print("G")

Buggy python submission (verdict: Runtime Error):
b = input();
if b == "A":
  print("T")
elif b = "T":
  print("A")
elif b = "G":
  print("C")
elif v = "C":
  print("G")

Fixed submission:
b = input()
if b == "A":
  print("T")
elif b == "T":
  print("A")
elif b == "G":
  print("C")
elif b == "C":
  print("G")
Buggy python submission (verdict: Runtime Error):
n,q=map(int,input().split())
s=input()
count=[0]*n
for i in range(1,n):
    count[i]+=count[i-1]
    if s[i-1:i+1]=="AC":
        count[i]+=1
for i in range(n):
    l,r=map(int,input().split())
    print(count[r-1] - count[l-1])

Fixed submission:
n,q=map(int,input().split())
s=input()
count=[0]*n
for i in range(1,n):
    count[i]+=count[i-1]
    if s[i-1:i+1]=="AC":
        count[i]+=1
for i in range(q):
    l,r=map(int,input().split())
    print(count[r-1] - count[l-1])
Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
D = []
for i in range(max(A, B), 1, -1):
  if A % i == 0 and B % i == 0:
    D.append(i)
print(D[K - 1])

Fixed submission:
A, B, K = map(int, input().split())
D = []
for i in range(max(A, B), 0, -1):
  if A % i == 0 and B % i == 0:
    D.append(i)
print(D[K - 1])
Buggy python submission (verdict: Runtime Error):
N = int(input())
L = map(int, input().split())
if max(L) * 2 < Sum(L):
  print("Yes")
else:
  print("No")

Fixed submission:
N = int(input())
L = list(map(int, input().split()))
if max(L) * 2 < sum(L):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
s=int(input())
l=[]
while(s not in 1):
  l.append(s)
  if s%2==0:s//=2
  else:s=s*3+1
print(len(l)+1)

Fixed submission:
s=int(input())
l=[]
while(s not in l):
  l.append(s)
  if s%2==0:s//=2
  else:s=s*3+1
print(len(l)+1)

Buggy python submission (verdict: Runtime Error):
s=int(input())
l=[]
while(s not in 1):
  l.append(s)
  if s%2==0:s//=2
  else:s=s*3+1
print(len(l)+1)

Fixed submission:
s=int(input())
l=[]
while(s not in l):
  l.append(s)
  if s%2==0:s//=2
  else:s=s*3+1
print(len(l)+1)

Buggy python submission (verdict: Runtime Error):
s=int(input())
l=[]
while(S not in 1):
  l.append(s)
  if s%2==0:s//=2
  else: s=s*3+1
print(len(l)+1)

Fixed submission:
s=int(input())
l=[]
while(s not in l):
  l.append(s)
  if s%2==0:s//=2
  else:s=s*3+1
print(len(l)+1)

Buggy python submission (verdict: Runtime Error):
s=int(input())
l=[]
while(S not in 1):
  l.append(s)
  if s%2==0:s//=2
  else s=s*3+1
print(len(l)+1)

Fixed submission:
s=int(input())
l=[]
while(s not in l):
  l.append(s)
  if s%2==0:s//=2
  else:s=s*3+1
print(len(l)+1)
Buggy python submission (verdict: Time Limit Exceeded):
n,p=map(int,input().split())
for i in range(int(p**(1/n)+(p//n>1)),0,-1):
  if p%i**n==0:exit(print(i))

Fixed submission:
n,p=map(int,input().split())
for i in range(int(p**(1/n)+(p>n**2)),0,-1):
  if p%i**n==0:exit(print(i))

Buggy python submission (verdict: Runtime Error):
n,p=map(int,input().split())
for i in range(int(p**(1/n)+1)):
  if p%i**n==0:exit(print(i))

Fixed submission:
n,p=map(int,input().split())
for i in range(int(p**(1/n)+(p>n**2)),0,-1):
  if p%i**n==0:exit(print(i))

Buggy python submission (verdict: Time Limit Exceeded):
n,p=map(int,input().split())
for i in range(int(p**(1/n)+1),0,-1):
  if p%i**n==0:exit(print(i))

Fixed submission:
n,p=map(int,input().split())
for i in range(int(p**(1/n)+(p>n**2)),0,-1):
  if p%i**n==0:exit(print(i))
Buggy python submission (verdict: Runtime Error):
print("YES" if input() in 753 else "NO")

Fixed submission:
print("YES" if input() in "753" else "NO")
Buggy python submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
V=list(map(int,input().split()))
E=Counter(V[::2]).most_common()
O=Counter(V[1::2]).most_common()
E2=Counter(V[1::2]).most_common()[1][1] if len(E)>1 else 0
O2=Counter(V[::2]).most_common()[1][1] if len(O)>1 else 0 
print(n-E[0][1]-O[0][1] if E[0][0]!=O[0][0] else n-max(E[0][1]+E2,O[0][1]+O2))

Fixed submission:
from collections import Counter
n=int(input())
V=list(map(int,input().split()))
E=Counter(V[::2]).most_common()
O=Counter(V[1::2]).most_common()
if E[0][0]==O[0][0]:
	E2=Counter(V[1::2]).most_common()[1][1] if len(E)>1 else 0
	O2=Counter(V[::2]).most_common()[1][1] if len(O)>1 else 0 
print(n-E[0][1]-O[0][1] if E[0][0]!=O[0][0] else n-max(E[0][1]+E2,O[0][1]+O2))
Buggy python submission (verdict: Runtime Error):
s=input()
print("AC" if s[0]=="A" and C in s[2:-1] and s[1:0].replace("C","c",1).islower() else "WA")

Fixed submission:
s=input()
print("AC" if (s[0]=="A") and ("C" in s[2:-1]) and (s[1:].replace("C","",1).islower()) else "WA")
Buggy python submission (verdict: Runtime Error):
from statistics import median as m
n=int(input())
A=list(map(int,input().split()))
B=sorted([A[i]-i-1 for i in range(n)])
m(B)=mb
print(int(sum([abs(b-mb) for b in B])))

Fixed submission:
from statistics import median as m
n=int(input())
A=list(map(int,input().split()))
B=sorted([A[i]-i-1 for i in range(n)])
mb=m(B)
print(int(sum([abs(b-mb) for b in B])))

Buggy python submission (verdict: Time Limit Exceeded):
from statistics import median as m
n=int(input())
A=list(map(int,input().split()))
B=sorted([A[i]-i-1 for i in range(n)])
print(int(sum([abs(b-m(B)) for b in B])))

Fixed submission:
from statistics import median as m
n=int(input())
A=list(map(int,input().split()))
B=sorted([A[i]-i-1 for i in range(n)])
mb=m(B)
print(int(sum([abs(b-mb) for b in B])))
Buggy python submission (verdict: Runtime Error):
n=int(input())
s-list(input())
ans=0
for i in range(1,n-1):
  ans=max(ans,len(set(s[:i]|set(s[i:])))
print(ans)

Fixed submission:
n=int(input())
s=list(input())
ans=0
for i in range(1,n-1):
  ans=max(ans,len(set(s[:i])&set(s[i:])))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
S=input()
print(min([S[:i-1].count('W')+S[i:].count('E') for i in range(1,n)]))

Fixed submission:
n=int(input())
S=input()
W=[0]*n
E=[0]*n
for i in range(1,n):
  if S[i-1]=='W':
    W[i]=W[i-1]+1
  else:
    W[i]=W[i-1]
for i in range(n-1,0,-1):
  if S[i]=='E':
    E[i-1]=E[i]+1
  else:
    E[i-1]=E[i]
print(min([W[i]+E[i] for i in range(n)]))
Buggy python submission (verdict: Runtime Error):
x=int(input())
c=1
for i in range(1,x):
  for j in range(2,x):
    if b**j<=x:
      c=max(c,b**j)
    else:
      break
print(c)

Fixed submission:
x=int(input())
c=1
for i in range(1,x):
  for j in range(2,x):
    if i**j<=x:
      c=max(c,i**j)
    else:
      break
print(c)
Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
s=range(a+1,b+1)
for i in (sorted(s[:k]|s[k:]):print(i)

Fixed submission:
a,b,k=map(int,input().split())
s=range(a,b+1)
for i in sorted(set(s[:k])|set(s[-k:])):print(i)

Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
s=range(a+1,b+1)
for i in (sorted(s[:k]|s[k:]):print(i)

Fixed submission:
a,b,k=map(int,input().split())
s=range(a,b+1)
for i in sorted(set(s[:k])|set(s[-k:])):print(i)