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

for i in range(N-1):
    a,b=map(int,input().split())
    a-=1
    b-=1
    G[a].append(b)
    G[b].append(a)

c=list(map(int,input().split()))

cnt=[[0,i] for i in range(N)]

for i in range(N):
    cnt[i][0]=len(G[i])

cnt.sort(reverse=True)
c.sort(reverse=True)

l=[-1 for _ in range(N)]
for i in range(N):
    num=cnt[i][1]
    l[num]=c[i]
#print(l)
ans=0
chk=[[0 for i in range(N)] for _ in range(N)]

def bfs(v,p,chk):
    global ans
    if chk[v][p]==1:
        return
    chk[v][p]=1
    chk[p][v]=1
    ans+=min(l[v],l[p])
    for tmp in G[v]:
        bfs(tmp,v,chk)

for v in range(N):
    bfs(v,G[v][0],chk)

print(ans)
print(*l)

Fixed submission:
from collections import deque
N=int(input())
G=[[]for _ in range(N)]
cnt=[0]*N
for i in range(N-1):
    a,b=map(int,input().split())
    a-=1
    b-=1
    G[a].append(b)
    G[b].append(a)
    cnt[a]+=1
    cnt[b]+=1

C=list(map(int,input().split()))
C.sort(reverse=True)

root=0
v=0
for i in range(N):
    if v>cnt[i]:
        root=i
        v=cnt[i]

def bfs(s):
    que=deque()
    que.append(s)
    nodes=[-1]*N
    k=0
    ans=0
    while len(que)>0:
        q=que.pop()
        nodes[q]=C[k]
        k+=1

        for v in G[q]:
            if nodes[v]<0:
                que.append(v)
    print(sum(C[1:]))
    print(*nodes)

bfs(root)
Buggy python submission (verdict: Runtime Error):
N = int(input())
names = set()
citydict = dict()
for i in range(N):
    S,P = input().split()
    names.add(S)
    if S[i] in citydict:
        citydict[S].append((int(P),i))
    else:
        citydict[S] = [(int(P),i)]

for name in sorted(names):
    for point in sorted(citydict[name],reverse = True):
        print(point[1] + 1)

Fixed submission:
N = int(input())
names = set()
citydict = dict()
for i in range(N):
    S,P = input().split()
    names.add(S)
    if S in citydict:
        citydict[S].append((int(P),i))
    else:
        citydict[S] = [(int(P),i)]

for name in sorted(names):
    for point in sorted(citydict[name],reverse = True):
        print(point[1] + 1)

Buggy python submission (verdict: Runtime Error):
N = int(input())
names = set()
citydict = dict()
for i in range(N):
    S, P = input().split()
    names.append(S)
    if S[i] in citydict:
        citydict[S].append((int(P),i))
    else:
        citydict[S] = [(int(P),i)]

for name in sorted(names):
    for point in sorted(citydict[name],reverse = True)
        print(point[1] + 1)

Fixed submission:
N = int(input())
names = set()
citydict = dict()
for i in range(N):
    S,P = input().split()
    names.add(S)
    if S in citydict:
        citydict[S].append((int(P),i))
    else:
        citydict[S] = [(int(P),i)]

for name in sorted(names):
    for point in sorted(citydict[name],reverse = True):
        print(point[1] + 1)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int,input().split())
L = [0] * M
R = [0] * M
for i in range(M):
    L[i], R[i] = map(int,input().split())
ans = 0
A = [0] * N
for i in range(M):
    for j in range(L[i]-1,R[i]):
        A[j] += 1
        if A[j] == M:
            ans += 1
print(ans)

Fixed submission:
N, M = map(int,input().split())
L = [0] * M
R = [0] * M
for i in range(M):
    L[i], R[i] = map(int,input().split())
ans = 0
A = [0] * N
L_max = max(L)
R_min = min(R)
if R_min >= L_max:
    ans = R_min - L_max + 1
else:
    ans = 0
print(ans)

Buggy python submission (verdict: Runtime Error):
N, M = map(int,input().split())
L = [0] * M
R = [0] * M
for i in range(M):
    L[i], R[i] = map(int,input().split())
ans = 0
A = [0] * N
for i in range(M):
    A[L[i]:R[i]+1] += 1
for i in range(N):
    if A[i] == M:
        ans += 1
print(ans)

Fixed submission:
N, M = map(int,input().split())
L = [0] * M
R = [0] * M
for i in range(M):
    L[i], R[i] = map(int,input().split())
ans = 0
A = [0] * N
L_max = max(L)
R_min = min(R)
if R_min >= L_max:
    ans = R_min - L_max + 1
else:
    ans = 0
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int,input().split())
L = [0] * M
R = [0] * M
for i in range(M):
    L[i], R[i] = map(int,input().split())
ans = 0
for i in range(N):
    count = 0
    for j in range(M):
        if L[j] <= (i+1) and (i+1) <= R[j]:
            count += 1
    if count == M:
        ans += 1
print(ans)

Fixed submission:
N, M = map(int,input().split())
L = [0] * M
R = [0] * M
for i in range(M):
    L[i], R[i] = map(int,input().split())
ans = 0
A = [0] * N
L_max = max(L)
R_min = min(R)
if R_min >= L_max:
    ans = R_min - L_max + 1
else:
    ans = 0
print(ans)
Buggy python submission (verdict: Runtime Error):
N, K = map(int,input().split())
S = input()
if S[K-1] == 'A':
    S[K-1] = 'a'
elif S[K-1] == 'B':
    S[K-1] = 'b'
else:
    S[K-1] = 'c'
print(S)

Fixed submission:
N, K = map(int,input().split())
S = input()
S1 = []
for i in range(N):
    if i == K-1:
        S1.append(S[i].lower())
    else:
        S1.append(S[i])
print(''.join(S1))
Buggy python submission (verdict: Runtime Error):
import math
N=int(input())
A=list(map(int,input().split()))
A.append(A[0])
ans=0
for i in range(N):
    val=math.gcd(A[i],A[i+1])
    ans=max(ans,val)
print(ans)

Fixed submission:
import fractions
N=int(input())
A=list(map(int,input().split()))

def gcd(x,y):
    if x==0:
        return y
    else:
        return gcd(y%x,x)

L=[0 for _ in range(N+1)]
L[0]=0
for i in range(N):
    L[i+1]=gcd(L[i],A[i])

R=[0 for i in range(N+1)]
R[N-1]=A[N-1]
for i in range(1,N)[::-1]:
    R[i-1]=gcd(R[i],A[i-1])

ans=0
for i in range(N):
    ans=max(ans,gcd(L[i],R[i+1]))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce
import copy
import fractions
N = int(input())
A = list(map(int,input().split()))

def gcd_list(numbers):
    return reduce(fractions.gcd,numbers)
ans = 0
count = 0
for i in range(N):
    B = copy.copy(A)
    a = B.pop(i)
    gcd_a = gcd_list(B)
    ans = max(ans,gcd_a)

print(ans)

Fixed submission:
import fractions
N=int(input())
A=list(map(int,input().split()))

def gcd(x,y):
    if x==0:
        return y
    else:
        return gcd(y%x,x)

L=[0 for _ in range(N+1)]
L[0]=0
for i in range(N):
    L[i+1]=gcd(L[i],A[i])

R=[0 for i in range(N+1)]
R[N-1]=A[N-1]
for i in range(1,N)[::-1]:
    R[i-1]=gcd(R[i],A[i-1])

ans=0
for i in range(N):
    ans=max(ans,gcd(L[i],R[i+1]))
print(ans)

Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce
import copy
N = int(input())
A = list(map(int,input().split()))

def gcd_list(numbers):
    return reduce(math.gcd,numbers)
ans = 0
count = 0
for i in range(N):
    B = copy.copy(A)
    a = B.pop(i)
    gcd = gcd_list(B)
    ans = max(ans,gcd)

print(ans)

Fixed submission:
import fractions
N=int(input())
A=list(map(int,input().split()))

def gcd(x,y):
    if x==0:
        return y
    else:
        return gcd(y%x,x)

L=[0 for _ in range(N+1)]
L[0]=0
for i in range(N):
    L[i+1]=gcd(L[i],A[i])

R=[0 for i in range(N+1)]
R[N-1]=A[N-1]
for i in range(1,N)[::-1]:
    R[i-1]=gcd(R[i],A[i-1])

ans=0
for i in range(N):
    ans=max(ans,gcd(L[i],R[i+1]))
print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import deque
N,K=map(int,input().split())
S=input()
C=[]
prv=1
cnt=0
for c in S:
    if prv != c:
        C.append(cnt)
        cnt=1
    else:
        cnt+=1
    prv=c
if cnt>0:
    C.append(cnt)
if prv==0:
    C.append(0)
M=len(C)//2
que=deque([C[0]])
res=ans=C[0]
for i in range(M):
    if len(que)==2*K+1:
        res-=que.popleft()+que.popleft()
    que.append(C[2*i+1])
    que.append(C[2*i+2])
    res+=C[2*i+1]+C[2*i+2]
    ans=max(res,ans)
print(ans)


Fixed submission:
N,K=map(int,input().split())
S=input()
C=[]
flag=False
count=0
prv=S[0]
if S[0]!="1":
    C.append(0)
"""
for i in range(N):
    if prv!=S[i]:
        C.append(count)
        count=1
    else:
        count+=1
    prv=S[i]
if count>0:
    C.append(count)
"""
tmp=0
for i in range(len(S)):
    if i<tmp:
        continue
    j=tmp
    while(S[j]==S[i]):
        j+=1
        if j==len(S):
            break
    C.append(j-i)
    tmp=j
if S[-1]=="0":
    C.append(0)
if len(C)==1:
    print(sum(C))
    exit()
ans=0
#print(C)
sums=[0]*(len(C))
sums.append(0)
for i in range(len(C)):
    sums[i+1]=sums[i]+C[i]
#print(sums)
for left in range(0,len(sums),2):
    right=left+2*K+1
    if right>=len(sums):
        right=int(len(sums))-1
    ans=max(ans,sums[right]-sums[left])
print(ans)
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

a = A % 10
b = B % 10
c = C % 10
d = D % 10
e = E % 10

if a == 0:
  a = 10
elif b == 0:
  b = 10
elif c == 0:
  c = 10
elif d == 0:
  d = 10
elif e = 10:
  e = 10
  
list1 = [a,b,c,d,e]
list1.sort(reverse = True)
key = {a:A,b:B,c:C,d:D,e:E}
i = 0
sum = 0
while i < 4:
  sum += key[list1[i]]
  while not sum % 10 == 0:
    sum += 1
  i += 1
  
sum += list1[4]
print(sum)
  

Fixed submission:
B = [int(input()) for _ in range(5)]
A = [10-int(str(B[i])[-1]) for i in range(5) if str(B[i])[-1] != "0"]
if len(A) != 0:
	A.remove(max(A))
print(sum(B)+sum(A))
Buggy python submission (verdict: Runtime Error):
S = input()
N = len(S)
ans = 0
for i in range(N):
  for j in range(N):
    if all('ATGC'.count(c) == 1 for c in S[i:j + 1]:
           ans = max(ans,j-i+1)
           
print(ans)

Fixed submission:
S = input()
N = len(S)
ans = 0
for i in range(N):
  for j in range(i,N):
    if all('ATGC'.count(c) == 1 for c in S[i:j+1]):
      ans = max(ans,j - i + 1)

      

      

print(ans)
Buggy python submission (verdict: Runtime Error):
N=int(input())
S=input()
MOD=10**9+7
x=dict()
for s in S:
    x[s]=s.get(s,0)+1
retval=1
for c in x:
    retval*=(x[c]+1)
print((retval-1)%MOD)

Fixed submission:
N=int(input())
S=input()
MOD=10**9+7
x=dict()
for s in S:
    x[s]=x.get(s,0)+1
retval=1
for c in x:
    retval*=(x[c]+1)
print((retval-1)%MOD)
Buggy python submission (verdict: Runtime Error):
N, M, C = map(int,input().split())

B = list(map(int,input().split()))
A = []

for i in range(N):
    A.append(list(map(int,input().split())))

count = 0
for i in range(N):
    x = 0
    for j in range(M):
        x += A[i][j] * B[j]
    if (x+C) > 0:
        count += 1

print(count)

Fixed submission:
H,W = map(int,input().split())
h,w = map(int,input().split())
ans = (H-h)*(W-w)
print(ans)

Buggy python submission (verdict: Runtime Error):
N, M, C = map(int,input().split())

B = list(map(int,input().split()))
A = []

for i in range(N):
    A.append(list(map(int,input().split())))

count = 0
for i in range(N):
    x = 0
    for j in range(M):
        x += A[i][j] * B[j]
    if (x+C) > 0:
        count += 1

print(count)

Fixed submission:
H,W = map(int,input().split())
h,w = map(int,input().split())
ans = (H-h)*(W-w)
print(ans)

Buggy python submission (verdict: Runtime Error):
H,W = int(input()),int(input())
h,w = int(input()),int(input())

ans = (H - h) * (W - w)
print(ans)


Fixed submission:
H,W = map(int,input().split())
h,w = map(int,input().split())
ans = (H-h)*(W-w)
print(ans)

Buggy python submission (verdict: Runtime Error):
H,W = int(input()),int(input())
h,w = int(input()),int(input())

sum = H*W
ans = sum - h*W - w*H + (h*w)

print(ans)

Fixed submission:
H,W = map(int,input().split())
h,w = map(int,input().split())
ans = (H-h)*(W-w)
print(ans)
Buggy python submission (verdict: Runtime Error):
A,B=map(int,input().split())

def oddsolve(a):
    return ((a+1)/2)%2
def solve(a):
    if (a%2==1):
        return oddsolve(a)
    else:
        return int(oddsolve(a+1)) ^ (a+1)
#print(type(oddsolve(A)))
#print(oddsolve(A))
print(solve(B) ^ solve(A-1))


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

def oddsolve(a):
    return ((a+1)/2)%2
def solve(a):
    if (a%2==1):
        return oddsolve(a)
    else:
        return int(oddsolve(a+1)) ^ (a+1)
#print(type(oddsolve(A)))
#print(oddsolve(A))
print(int(solve(B)) ^ int(solve(A-1)))
Buggy python submission (verdict: Runtime Error):
A, B, K = map(int,input().split())
listAB = []
for i in range(min(A,B)):
    if A%(i+1) == 0 and B % (i+1) == 0:
        listAB.append(i+1)
listAB.sort(reverse = True)
if A == 1 or B == 1:
    print(1)
else:
    print(listAB[K-1])

Fixed submission:
import math

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

if B - A*C < 0:
    print(math.floor(B/A))
else:
    print(C)

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

a = A
b = b
count = 0
if a > b:
    print(0)

while b - a >= 0:
    if count == C:
        break
    b -= a
    count += 1

print(count)

Fixed submission:
import math

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

if B - A*C < 0:
    print(math.floor(B/A))
else:
    print(C)

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

a = A
b = b
count = 0
if a > b:
    print(0)

while b - a >= 0:
    if count <= C:
        break
    b -= a
    count += 1

print(count)

Fixed submission:
import math

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

if B - A*C < 0:
    print(math.floor(B/A))
else:
    print(C)
Buggy python submission (verdict: Runtime Error):
A, B, K = map(int,input().split())
listAB = []
for i in range(min(A,B)):
    if i == 0:
        continue
    if A%i == 0 and B % i == 0:
        listAB.append(i)

if A == 1 or B == 1:
    print(1)
else:
    print(listAB[K-1])

Fixed submission:
A, B, K = map(int,input().split())
listAB = []
for i in range(min(A,B)):
    if A%(i+1) == 0 and B % (i+1) == 0:
        listAB.append(i+1)
listAB.sort(reverse = True)
if A == 1 or B == 1:
    print(1)
else:
    print(listAB[K-1])
Buggy python submission (verdict: Runtime Error):
def solve(m_list):
    m_val = m_list[0]
    for i in m_list:
        m_val = min(m_val,gcd(min_val,m))
    return m_val

def gcd(a,b):
    while b:
        a,b = b,a%b
    return a

def main():
    n = int(input())
    m_list = list(map(int,input().split()))

    ans = solve(m_list)
    print(ans)

main()

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

if B % A == 0:
    print(A+B)
else:
    print(B-A)

Buggy python submission (verdict: Runtime Error):
def solve(m_list):
    m_val = m_list[0]
    for i in m_list:
        m_val = min(m_val,gcd(min_val,m))
    return min_val

def gcd(a,b):
    while b:
        a,b = b,a%b
    return a

def main():
    n = int(input())
    m_list = list(map(int,input().split()))

    ans = solve(m_list)
    print(ans)

if __name__ == '__main__':
    main()

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

if B % A == 0:
    print(A+B)
else:
    print(B-A)

Buggy python submission (verdict: Runtime Error):
def solve(m_list):
    m_val = m_list[0]
    for i in m_list:
        m_val = min(m_val,gcd(min_val,m))
    return min_val

def gcd(a,b):
    while b:
        a,b = b,a%b
    return a

def main():
    n = int(input())
    m_list = list(map(int,input().split()))

    ans = solve(m_list)
    print(ans)
main()

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

if B % A == 0:
    print(A+B)
else:
    print(B-A)
Buggy python submission (verdict: Runtime Error):
N, M = map(int,input().split())

like_count = [0 for _ in range(m+1)]

for _ in range(N):
    tmp = list(map(int,input().split()))
    like_list = tmp[1:]
    for like in like_list:
        like_count[like] += 1

count = 0
for value in like_count:
    if value == N:
        count += 1

print(count)

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


like_count = [0 for _ in range(M+1)]

for _ in range(N):
    tmp = list(map(int,input().split()))
    like_list = tmp[1:]
    for like in like_list:
        like_count[like] += 1

count = 0
for value in like_count:
    if value == N:
        count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
def solve(m_list):
    m_val = m_list[0]
    for i in m_list:
        m_val = min(m_val,gcd(m_val,m))
    return m_val

def gcd(a,b):
    while b:
        a,b = b,a%b
    return a

def main():
    n = int(input())
    m_list = list(map(int,input().split()))

    ans = solve(m_list)
    print(ans)

main()

Fixed submission:
def solve(m_list):
    m_val = m_list[0]
    for i in m_list:
        m_val = min(m_val,gcd(m_val,i))
    return m_val

def gcd(a,b):
    while b:
        a,b = b,a%b
    return a

def main():
    n = int(input())
    m_list = list(map(int,input().split()))

    ans = solve(m_list)
    print(ans)

main()

Buggy python submission (verdict: Runtime Error):
def solve(m_list):
    m_val = m_list[0]
    for i in m_list:
        m_val = min(m_val,gcd(min_val,m))
    return m_val

def gcd(a,b):
    while b:
        a,b = b,a%b
    return a

def main():
    n = int(input())
    m_list = list(map(int,input().split()))

    ans = solve(m_list)
    print(ans)

main()

Fixed submission:
def solve(m_list):
    m_val = m_list[0]
    for i in m_list:
        m_val = min(m_val,gcd(m_val,i))
    return m_val

def gcd(a,b):
    while b:
        a,b = b,a%b
    return a

def main():
    n = int(input())
    m_list = list(map(int,input().split()))

    ans = solve(m_list)
    print(ans)

main()

Buggy python submission (verdict: Runtime Error):
def solve(m_list):
    m_val = m_list[0]
    for i in m_list:
        m_val = min(m_val,gcd(min_val,m))
    return min_val

def gcd(a,b):
    while b:
        a,b = b,a%b
    return a

def main():
    n = int(input())
    m_list = list(map(int,input().split()))

    ans = solve(m_list)
    print(ans)

main()

Fixed submission:
def solve(m_list):
    m_val = m_list[0]
    for i in m_list:
        m_val = min(m_val,gcd(m_val,i))
    return m_val

def gcd(a,b):
    while b:
        a,b = b,a%b
    return a

def main():
    n = int(input())
    m_list = list(map(int,input().split()))

    ans = solve(m_list)
    print(ans)

main()

Buggy python submission (verdict: Runtime Error):
def solve(m_list):
    m_val = m_list[0]
    for i in m_list:
        m_val = min(m_val,gcd(min_val,m))
    return min_val

def gcd(a,b):
    while b:
        a,b = b,a%b
    return a

def main():
    n = int(input())
    m_list = list(map(int,input().split()))

    ans = solve(m_list)
    print(ans)

if __name__ == '__main__':
    main()

Fixed submission:
def solve(m_list):
    m_val = m_list[0]
    for i in m_list:
        m_val = min(m_val,gcd(m_val,i))
    return m_val

def gcd(a,b):
    while b:
        a,b = b,a%b
    return a

def main():
    n = int(input())
    m_list = list(map(int,input().split()))

    ans = solve(m_list)
    print(ans)

main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(200000)
H,W=map(int,input().split())
S=[]
for i in range(H):
    S.append(input())

ans=0
dx=[0,0,1,-1]
dy=[1,-1,0,0]

was=[[0 for i in range(W)] for j in range(H)]

def dfs(x,y):
    global cc
    global was
    was[x][y]=1
    if S[x][y]=="#":
        cc[1]+=1
    else:
        cc[0]+=1
    for i in range(4):
        nx=x+dx[i]
        ny=y+dy[i]
        if nx>=0 and ny>=0 and nx<H and ny<W and S[nx][ny]!=S[x][y] and not was[nx][ny]:
            dfs(nx,ny)

for i in range(H):
    for j in range(W):
        if not was[i][j]:
            cc=[0]*2
            dfs(i,j)
            ans+= cc[1]*cc[0]

print(ans)

Fixed submission:
import sys
sys.setrecursionlimit(200000)
H,W=map(int,input().split())
S=[]
for i in range(H):
    S.append(input())

ans=0
dx=[0,0,1,-1]
dy=[1,-1,0,0]

was=[[0 for i in range(W)] for j in range(H)]

def dfs(x,y):
    global cc
    global was
    was[x][y]=1
    if S[x][y]=="#":
        cc[1]+=1
    else:
        cc[0]+=1
    for i in range(4):
        nx=x+dx[i]
        ny=y+dy[i]
        if nx>=0 and ny>=0 and nx<H and ny<W and S[nx][ny]!=S[x][y] and not was[nx][ny]:
            dfs(nx,ny)

for i in range(H):
    for j in range(W):
        if not was[i][j]:
            cc=[0]*2
            dfs(i,j)
            ans+= cc[1]*cc[0]

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,P=map(int,input().split())
ans=1
def make_divisors(n):
    divisors = []
    for i in range(1,int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n//i:
                divisors.append(n//i)

    return divisors
l=make_divisors(P)
l.sort()
#print(l)
for i in range(len(l)):
    a=pow(l[i],N)
    if P//a==0:
        break
    else:
        if P%a==0:
            ans=l[i]
print(ans)

Fixed submission:
N,P=map(int,input().split())
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
p=factorization(P)
#print(p)
k=[]
ans=1
for i in range(len(p)):
    d=p[i][1]//N
    k.append(d)
for i in range(len(p)):
    ans*=pow(p[i][0],k[i])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,P=map(int,input().split())
ans=1
for i in range(1,P+1):
    a=pow(i,N)
    if P//a==0:
        break
    else:
        if P%a==0:
            ans=i
print(ans)

Fixed submission:
N,P=map(int,input().split())
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
p=factorization(P)
#print(p)
k=[]
ans=1
for i in range(len(p)):
    d=p[i][1]//N
    k.append(d)
for i in range(len(p)):
    ans*=pow(p[i][0],k[i])
print(ans)

Buggy python submission (verdict: Runtime Error):
N,P=map(int,input().split())
ans=1
for i in range(1,P+1):
    a=pow(i,N)
    if P//a==0:
        break
    else:
        if P%a==0:
            ans=i
print(ans)

Fixed submission:
N,P=map(int,input().split())
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
p=factorization(P)
#print(p)
k=[]
ans=1
for i in range(len(p)):
    d=p[i][1]//N
    k.append(d)
for i in range(len(p)):
    ans*=pow(p[i][0],k[i])
print(ans)
Buggy python submission (verdict: Runtime Error):
N, K = map(int,input().split())
h = []
for i in range(N):
    x = int(input())
    h.append(x)

h.sort()
m = []
for i in range(N):
    m.append(h[i+K-1] - h[i])

print(min(m))

Fixed submission:
N, K = map(int,input().split())
h = []
for i in range(N):
    x = int(input())
    h.append(x)

h.sort()
m = []
for i in range(N-K+1):
    m.append(h[i+K-1] - h[i])

print(min(m))
Buggy python submission (verdict: Runtime Error):
A, B = map(int,input())
ab = A*B
if ab % 2 == 0:
    print('No')
else:
    print('Yes')

Fixed submission:
A, B = map(int,input().split())
ab = A*B
if ab % 2 == 0:
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Runtime Error):
N = int(input())
W = []
w_dic = dict()
for i in range(N):
    W.append(input())

check = True
for i in range(N-1):
    if W[i][-1] == W[i+1][0]:
        continue
    else:
        check = False
        break
for i in range(N):
    if W[i] in w_dic:
        check = False
    else:
        w_dict[W[i]] = 1
if check:
    print('Yes')
else:
    print('No')

Fixed submission:
N = int(input())
W = []
w_dic = dict()
for i in range(N):
    a = input()
    W.append(a)

check = True
for i in range(N-1):
    s = W[i]
    s_1 = W[i+1]
    if s[-1] == s_1[0]:
        continue
    else:
        check = False
        break
for i in range(N):
    if W[i] in w_dic:
        check = False
        break
    else:
        w_dic[W[i]] = 1
if check:
    print('Yes')
else:
    print('No')