Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03164 (python)

Fixed submission:
n,W=map(int,input().split())
wv=[[int(i) for i in input().split()]for _ in range(n)]
dp=[W+1]*(10**5+1)
dp[0]=0
for i in range(0,n):
    w,v = wv[i]
    for j in range(10**5,v-1,-1):
        dp[j]=min(dp[j],dp[j-v]+w)
for i in range(10**5,-1,-1):
    if dp[i]<=W:
        print(i)
        break

Buggy submission (verdict: Runtime Error):
n,w=map(int,input().split())
wv=[[int(i) for i in input().split()]for _ in range(n)]

dp=[0]*(w+1)
dp[wv[0][0]]=wv[0][1]
for i in range(1,n):
    ww = wv[i][0]
    v = wv[i][1]
    for j in range(w,ww-1,-1):
        dp[j]=max(dp[j],dp[j-ww]+v)
print(max(dp))
Problem p03166 (python)

Fixed submission:
n,m=map(int,input().split())
p=[[]for _ in range(n)]
c=[0]*n
import sys
sys.setrecursionlimit(10**6)
for i in range(m):
    x,y=map(int,input().split())
    p[x-1].append(y-1)
from functools import lru_cache
@lru_cache(maxsize=n)
def l(k):
    return max([l(i)for i in p[k]]+[0])+1
print(max([l(i)for i in range(n)])-1)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
p=[[]for _ in range(n)]
c=[0]*n
import sys
sys.setrecursionlimit(10**5)
for i in range(m):
    x,y=map(int,input().split())
    p[x-1].append(y-1)
from functools import lru_cache
@lru_cache(maxsize=n)
def l(k):
    return max([l(i)for i in p[k]]+[0])+1
print(max([l(i)for i in range(n)])-1)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
p=[[]for _ in range(n)]
c=[0]*n
import sys
sys.setrecursionlimit(n)
for i in range(m):
    x,y=map(int,input().split())
    p[x-1].append(y-1)
from functools import lru_cache
@lru_cache(maxsize=n)
def l(k):
    return max([l(i)for i in p[k]]+[0])+1
print(max([l(i)for i in range(n)])-1)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
p=[[]for _ in range(n)]
c=[0]*n
for i in range(m):
    x,y=map(int,input().split())
    p[x-1].append(y-1)
from functools import lru_cache
@lru_cache(maxsize=9*n)
def l(k):
    return max([l(i)for i in p[k]]+[0])+1
print(max([l(i)for i in range(n)])-1)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
p=[[]for _ in range(n)]
c=[0]*n
for i in range(m):
    x,y=map(int,input().split())
    p[x-1].append(y-1)
from functools import lru_cache
@lru_cache(maxsize=n)
def l(k):
    return max([l(i)for i in p[k]]+[0])+1
print(max([l(i)for i in range(n)])-1)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
p=[[]for _ in range(n)]
c=[0]*n
for i in range(m):
    x,y=map(int,input().split())
    p[x-1].append(y-1)
from functools import lru_cache
@lru_cache(maxsize = None)
def l(k):
    return max([l(i)for i in p[k]]+[0])+1
print(max([l(i)for i in range(n)])-1)
Problem p03176 (python)

Fixed submission:
def main():
    input()
    H=map(int,input().split())
    A=map(int,input().split())
    n=2*10**5+1

    def update_max(k,x):
        k += num_max-1
        seg_max[k] = x
        while k:
            k = (k-1)//2
            seg_max[k] = max(seg_max[k*2+1],seg_max[k*2+2])
    def query_max(p,q):
        if q<=p:
            return ide_ele_max
        p += num_max-1
        q += num_max-2
        res=ide_ele_max
        while q-p>1:
            if p&1 == 0:
                res = max(res,seg_max[p])
            if q&1 == 1:
                res = max(res,seg_max[q])
                q -= 1
            p = p//2
            q = (q-1)//2
        if p == q:
            res = max(res,seg_max[p])
        else:
            res = max(max(res,seg_max[p]),seg_max[q])
        return res
    ide_ele_max = 0
    num_max =2**(n-1).bit_length()
    seg_max=[ide_ele_max]*2*num_max

    for h,a in zip(H,A):
        update_max(h,query_max(0,h)+a)
    
    print(query_max(0,n))
main()

Buggy submission (verdict: Runtime Error):
def main():
    input()
    H=map(int,input().split())
    A=map(int,input().split())
    n=10**5+1

    def update_max(k,x):
        k += num_max-1
        seg_max[k] = x
        while k:
            k = (k-1)//2
            seg_max[k] = max(seg_max[k*2+1],seg_max[k*2+2])
    def query_max(p,q):
        if q<=p:
            return ide_ele_max
        p += num_max-1
        q += num_max-2
        res=ide_ele_max
        while q-p>1:
            if p&1 == 0:
                res = max(res,seg_max[p])
            if q&1 == 1:
                res = max(res,seg_max[q])
                q -= 1
            p = p//2
            q = (q-1)//2
        if p == q:
            res = max(res,seg_max[p])
        else:
            res = max(max(res,seg_max[p]),seg_max[q])
        return res
    ide_ele_max = 0
    num_max =2**(n-1).bit_length()
    seg_max=[ide_ele_max]*2*num_max

    for h,a in zip(H,A):
        update_max(h,query_max(0,h)+a)
    
    print(query_max(0,n))
main()

Buggy submission (verdict: Runtime Error):
def main():
    input()
    H=map(int,input().split())
    A=map(int,input().split())
    n=10*5+1

    def update_max(k,x):
        k += num_max-1
        seg_max[k] = x
        while k:
            k = (k-1)//2
            seg_max[k] = max(seg_max[k*2+1],seg_max[k*2+2])
    def query_max(p,q):
        if q<=p:
            return ide_ele_max
        p += num_max-1
        q += num_max-2
        res=ide_ele_max
        while q-p>1:
            if p&1 == 0:
                res = max(res,seg_max[p])
            if q&1 == 1:
                res = max(res,seg_max[q])
                q -= 1
            p = p//2
            q = (q-1)//2
        if p == q:
            res = max(res,seg_max[p])
        else:
            res = max(max(res,seg_max[p]),seg_max[q])
        return res
    ide_ele_max = 0
    num_max =2**(n-1).bit_length()
    seg_max=[ide_ele_max]*2*num_max

    for h,a in zip(H,A):
        update_max(h,query_max(0,h)+a)
    
    print(query_max(0,n))
main()
Problem p03283 (python)

Fixed submission:
n,m,q = [int(i) for i in input().split()]
lr = [[int(x)-1 for x in input().split()] for i in range(m)]
pq = [[int(x)-1 for x in input().split()] for i in range(q)]
m = [[0]*501 for _ in range(501)]
for l,r in lr:
    m[0][r]+=1
    m[l+1][r]-=1
for i in range(500):
    for j in range(1,500):
        m[j][i]+=m[j-1][i]
for i in range(500):
    for j in range(1,500):
        m[i][j]+=m[i][j-1]
for p,q in pq:
    print(m[p][q])

Buggy submission (verdict: Runtime Error):
n,m,q = [int(i) for i in input().split()]
lr = [[int(x)-1 for x in input().split()] for i in range(m)]
pq = [[int(x)-1 for x in input().split()] for i in range(q)]
m = [[0]*500 for _ in range(500)]
for l,r in lr:
    m[0][r]+=1
    m[l+1][r]-=1
for i in range(500):
    for j in range(1,500):
        m[j][i]+=m[j-1][i]
for i in range(500):
    for j in range(1,500):
        m[i][j]+=m[i][j-1]
for p,q in pq:
    print(m[p][q])
Problem p03000 (python)

Fixed submission:
n,x=map(int,input().split())
L=list(map(int,input().split()))
d=0
count=1
for i in range(n):
    d += L[i]
 
    if d <= x:
        count += 1
    else:
        break

print(count)

Buggy submission (verdict: Runtime Error):
n,x=map(int,input().split())
L=list(map(int,input().split()))
d=0
count=1
for i in range(n+1):
    d += L[i]

    if d > x:
        print(count)
        break
    else:
        count += 1
Problem p03103 (python)

Fixed submission:
N,M=map(int,input().split())
L=[]
ans=0

for i in range(N):
    a,b=map(int,input().split())

    L.append([a,b])

L= sorted(L)

for i in range(N):

    if M < L[i][1]:
        ans=L[i][0]*M

        print(ans)
        exit()
        
    else:
        ans += L[i][0]*L[i][1]
        M -= L[i][1]

        if M==0:

            print(ans)
            exit()

        elif M <= L[i+1][1]:

            ans += M * L[i+1][0]
            print(ans)
            exit()

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
L=[]

ans=0

for i in range(N):
    a,b=map(int,input().split())

    L.append([a,b])

L= sorted(L)



for i in range(N):

    if M < L[i][1]
        ans=L[i][0]*M

        print(ans)
        exit()
        
    else:


        ans = L[i][0]*L[i][1]
        M -= L[i][1]


            if M==0:

                print(ans)
                exit()


            if M <= L[i+1][1]:

                ans += M * L[i+1][0]

                print(ans)

                exit()

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
L=[]

ans=0

for i in range(N):
    a,b=map(int,input().split())

    L.append([a,b])

L= sorted(L)



for i in range(N):

    ans = L[i][0]*L[i][1]
    M -= L[i][1]


    if M <= L[i+1][1]:

        ans += M * L[i+1][0]

        print(ans)

        exit()
Problem p03239 (python)

Fixed submission:
N,T=map(int,input().split())
a=[]
for i in range(N):
    c,t=map(int,input().split())
    a.append([c,t])

cost=10000
for i in range(N):
    if a[i][1] <= T:
        cost = min(cost,a[i][0])



if cost==10000:
    print('TLE')
else:
    print(cost)

Buggy submission (verdict: Runtime Error):
from operator import itemgetter

N,T=map(int,input().split())
a=[]
for i in range(N):
    c,t=map(int,input().split())
    a.append([c,t])

a=sorted(a,key=itemgetter(1))

key=0
ans=1001
while a[key][1]<=T:
    ans = min(ans,a[key][0])
    key += 1

if ans==1001:
    print('TLE')
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
from operator import itemgetter

N,T=map(int,input().split())
a=[]
for i in range(N):
    c,t=map(int,input().split())
    a.append([c,t])

a=sorted(a,key=itemgetter(1))

key=0
ans=1001
while a[key][1]<=T:
    ans = min(ans,a[key][0])
    key += 1

if key==0:
    print('TLE')
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
from operator import itemgetter

N,T=map(int,input().split())
a=[]
for i in range(N):
    c,t=map(int,input().split())
    a.append([c,t])

a=sorted(a,key=itemgetter(1))

key=0
ans=1001
while a[key][1]<=T:
    ans = min(ans,a[key][0])
    key += 1

if key==0:
    print('TLE')
else:
    print(ans)
Problem p03260 (python)

Fixed submission:
a,b=map(int,input().split())
if a*b % 2 ==0:
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
import fractions

n,x=map(int,input().split())
a=list(map(int,input().split()))

b=[]
for i in a:
    b.append(abs(x-i))

if n==1:
    print(abs(x-a[0]))

else:
    ans=fractions.gcd(b[0],b[1])

    for i in range(2,n):
        ans = fractions.gcd(ans ,b[i])

    print(ans)
Problem p03262 (python)

Fixed submission:
import fractions

n,x=map(int,input().split())
a=list(map(int,input().split()))

b=[]
for i in a:
    b.append(abs(x-i))

if n==1:
    print(abs(x-a[0]))

else:
    ans=fractions.gcd(b[0],b[1])

    for i in range(2,n):
        ans = fractions.gcd(ans ,b[i])

    print(ans)

Buggy submission (verdict: Runtime Error):
import fractions

n,x=map(int,input().split())
a=list(map(int,input().split()))

b=[]
for i in a:
    b.append(abs(x-i))

if n==1:
    print(abs(x-a[0]))

else:
    ans=fractions.gcd(b[0],b[1])

    for i in range(2,n):
        ans = math.gcd(ans ,b[i])

    print(ans)
Problem p03282 (python)

Fixed submission:
S=str(input())
K=int(input())

for i in range(K):
    if S[i] != '1':
        print(S[i])
        exit()
        
print(S[K-1])

Buggy submission (verdict: Runtime Error):
S=str(input())
K=int(input())

for i in range(K):
    if S[i] != '1':
        print(S[i])
        exit()
elif len(S) > K:
    print(S[K])
else:
    print(S[K-1])

Buggy submission (verdict: Runtime Error):
S=str(input())
K=int(input())
if S[0]!= '1':
    print(S[0])
    exit()
    
else:
    count=0
    i=0
    while S[i] == '1':
        count += 1
        i += 1

if K <= count:
    print('1')
else:
    print(S[count])
Problem p03473 (python)

Fixed submission:
m=int(input())
print(48-m)

Buggy submission (verdict: Runtime Error):
m=input()
print(48-m)
Problem p03574 (python)

Fixed submission:
h,w=map(int,input().split())

a=[['.' for x in range(w+2)]]

for i in range(h):
    b=list(str(input()))
    b= ['.']+b+['.']
    a.append(b)

footer=['.' for x in range(w+2)]
a.append(footer)
    

for i in range(1,h+1):
    ans=''
    for j in range(1,w+1):
        count=0
        if a[i][j]=='#':
            ans += '#'
        else:
            if a[i-1][j-1]=='#':
                count += 1
            if a[i-1][j]=='#':
                count += 1
            if a[i-1][j+1]=='#':
                count += 1
            if a[i][j-1]=='#':
                count += 1
            if a[i][j+1]=='#':
                count += 1
            if a[i+1][j-1]=='#':
                count += 1
            if a[i+1][j]=='#':
                count += 1
            if a[i+1][j+1]=='#':
                count += 1

            ans += str(count)

    print(ans)

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())

a=[['.' for x in range(w+2)]]

for i in range(h):
    b=list(str(input()))
    b= ['.']+b+['.']
    a.append(b)

footer=['.' for x in range(w+2)]
a.append(footer)
    

for i in range(1,w+1):
    ans=''
    for j in range(1,h+1):
        count=0
        if a[i][j]=='#':
            ans += '#'
        else:
            if a[i-1][j-1]=='#':
                count += 1
            if a[i][j-1]=='#':
                count += 1
            if a[i+1][j-1]=='#':
                count += 1
            if a[i-1][j]=='#':
                count += 1
            if a[i+1][j]=='#':
                count += 1
            if a[i-1][j+1]=='#':
                count += 1
            if a[i][j+1]=='#':
                count += 1
            if a[i+1][j+1]=='#':
                count += 1

            ans += str(count)

    print(ans)
Problem p03607 (python)

Fixed submission:
n=int(input())
buff=[]
ans=1
for i in range(n):
    buff.append(input())

a=sorted(buff)

for i in range(1,n):
    if a[i] == a[i-1]:
        a[i-1]= -1
        a[i]= -1
        if ans>0:
            ans -= 1
    else:
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
    n=int(input())
    buff=set()
    for i in range(n):
        a=int(input())
        if a in buff:
            buff.remove(a)
        else:
            buff.add(a)
     
    print(len(buff))
Problem p03625 (python)

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


count=0
ans=[]
flag=0
for i in range(1,n):
    if a[i]==a[i-1] and flag==1:
        flag=0


    elif a[i]==a[i-1] and flag==0:
        count += 1
        ans.append(a[i])
        flag=1

    elif a[i] != a[i-1]:
        flag=0

    if count==2:
        print(ans[0]*ans[1])
        exit()


print(0)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
s=set(a)

sei=[]
cho=[]



for i in s:
    x= a.count(i)
    
    if x >= 4:
        sei.append(i)
    elif x >= 2:
        cho.append(i)

cho2=sorted(cho,reverse=True)


        
if sei==[] and len(cho)<2:        
    print(0)
    exit()
else:
    print(max(max(sei)**2,cho2[0]*cho2[1],max(sei)*cho2[0]))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
s=set(a)

sei=[]
cho=[]



for i in s:
    x= a.count(i)
    
    if x >= 4:
        sei.append(i)
    elif x >= 2:
        cho.append(i)

cho2=sorted(cho,reverse=True)
        
if sei==[] and len(cho)<2:        
    print(0)
    exit()
else:
    print(max(max(sei)**2,cho2[0]*cho2[1],max(sei)*cho2[0]))
Problem p03665 (python)

Fixed submission:
n,p=map(int,input().split())
a=list(map(int,input().split()))
k=m=0
for i in a:
    if i%2==0:
        k +=1
m=n-k

ans_x=ans_y=0

def cbn(b,c):
    z=1
    for i in range(2,b+1):
        z *= i
    for i in range(2,c+1):
        z //= i
    for i in range(2,b-c+1):
        z //= i
    return(z)


if p==0:

    for i in range(k+1):
        ans_x += cbn(k,i)
    for i in range(0,m+1,2):
        ans_y += cbn(m,i)

    print(ans_x * ans_y)

else:

    for i in range(k+1):
        ans_x += cbn(k,i)
    for i in range(1,m+1,2):
        ans_y += cbn(m,i)

    print(ans_x * ans_y)

Buggy submission (verdict: Runtime Error):
for i in a:
    if i%2==0:
        k +=1
m=n-k

ans_x=ans_y=0

def cbn(b,c):
    z=1
    for i in range(2,b+1):
        z *= i
    for i in range(2,c+1):
        z //= i
    for i in range(2,b-c+1):
        z //= i
    return(z)


if p==0:

    for i in range(k+1):
        ans_x += cbn(k,i)
    for i in range(0,m+1,2):
        ans_y += cbn(m,i)

    print(ans_x * ans_y)

else:

    for i in range(k+1):
        ans_x += cbn(k,i)
    for i in range(1,m+1,2):
        ans_y += cbn(m,i)

    print(ans_x * ans_y)
Problem p03675 (python)

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

if n%2==0:

    for i in range(n):

        if n-i*2-1 > 0:
            b.append(a[n-i*2-1])
        else:
            k=abs(n-i*2)
            b.append(a[k])

else:
    
    for i in range(n):

        if n-i*2-1 >= 0:
            b.append(a[n-i*2-1])
        else:
            k=abs(n-i*2-1)
            b.append(a[k-1])

print(*b)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=[]

for i in range(n):

    if n-i*2-1 > 0:
        b.append(a[n-i*2-1])
    else:
        k=abs(n-i*2)
        b.append(a[k])


print(*b)
Problem p03730 (python)

Fixed submission:
import fractions
a,b,c=map(int,input().split())
g = fractions.gcd(a,b)
if c % g ==0 :
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
import math
a,b,c=map(int,input().split())
g = math.gcd(a,b)
if c % g ==0 :
    print('YES')
else:
    print('NO')
Problem p04047 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=sorted(a)
ans=0
for i in range(0,n*2,2):
    ans += min(b[i],b[i+1])
print(ans)

Buggy submission (verdict: Runtime Error):
import scipy.misc as scm
def combi(p,q):
    return scm.comb(p,q,1)

ans=0
n=int(input())
k=[]
for i in range(n):
    a,b=map(int,input().split())
    k.append([a,b])

for i in range(n-1):
    for j in range(i+1,n):
        p=k[i][0]+k[i][1]+k[j][0]+k[j][1]
        q=k[i][0]+k[j][0]
        ans += combi(p,q) % (10**9+7)


ans = ans % (10**9+7)
print(ans)
Problem p02536 (python)

Fixed submission:
code = r"""
# distutils: language=c++
# distutils: include_dirs=/opt/ac-library
from libcpp cimport bool
from libcpp.vector cimport vector
cdef extern from "<atcoder/dsu>" namespace "atcoder":
    cdef cppclass dsu:
        dsu(int n)
        int merge(int a, int b)
        bool same(int a, int b)
        int leader(int a)
        int size(int a)
        vector[vector[int]] groups()
from libc.stdio cimport getchar, printf
cdef inline int read() nogil:
    cdef int b, c = 0
    while 1:
        b = getchar() - 48
        if b < 0: return c
        c = c * 10 + b
cdef int n = read(), i
cdef dsu *u = new dsu(n)
for i in range(read()): u.merge(read() - 1, read() - 1)
printf('%lu\n', u.groups().size() - 1)
"""
import os, sys
if sys.argv[-1] == 'ONLINE_JUDGE':
    open('solve.pyx', 'w').write(code)
    os.system('cythonize -i -3 -b solve.pyx')
import solve

Buggy submission (verdict: Runtime Error):
(n,m),*a=[map(int,t.split())for t in open(0)]
p=[-1]*-~n
for a in a:
 b,a=sorted(map(r:=lambda x:x*(p[x]<0)or r(p[x]),a),key=p.__getitem__)
 if a-b:p[a]+=p[b];p[b]=a
print(sum(i<0for i in p)-2)

Buggy submission (verdict: Runtime Error):
(n,m),*a=[map(int,t.split())for t in open(0)]
p=[-1]*-~n
for a in a:
 a,b=map(r:=lambda x:x*(p[x]<0)or r(p[x]),a)
 if a-b:p[a]+=p[b];p[b]=a
print(sum(i<0for i in p)-2)
Problem p02555 (python)

Fixed submission:
from functools import*
M=10**9+7
@lru_cache(None)
def f(s):
    if s<3:return 0
    c=1
    for i in range(s-2):
        c+=f(i)
    return(sum(map(f,range(s-2)))+1)%M
print(f(int(input())))

Buggy submission (verdict: Runtime Error):
a,b,c=1,0,0
exec('a,b,c=b,c,a+c;'*int(input()))
print(a%(1e9+7))
Problem p02556 (python)

Fixed submission:
n,*z=map(int,open(0).read().split())
a,b=[],[]
for x,y in zip(*[iter(z)]*2):
    a+=x+y,
    b+=x-y,
print(max(abs(max(a)-min(a)),abs(max(b)-min(b))))

Buggy submission (verdict: Runtime Error):
a,b=[],
for z in[*open(0)][1:]:x,y=map(int,z.split());a+=x+y,;b+=x-y,
print(max(abs(max(a)-min(a)),abs(max(b)-min(b))))
Problem p02558 (python)

Fixed submission:
p=[-1]*8**6
for q in[*open(0)][1:]:
 q,*x=map(int,q.split());a,b=sorted(map(f:=lambda x:f(p[x])if~p[x]<0else x,x))
 if q:print(+(a==b))
 elif a<b:p[b]=a

Buggy submission (verdict: Runtime Error):
code = r"""
# distutils: language=c++
# distutils: include_dirs=opt/atcoder-stl
from libcpp cimport bool
from libcpp.vector cimport vector
cdef extern from "<atcoder/dsu>" namespace "atcoder" nogil:
    cdef cppclass dsu:
        dsu(int n)
        int merge(int a, int b)
        bool same(int a, int b)
        int leader(int a)
        int size(int a)
        vector[vector[int]] groups()
from cython.parallel cimport prange
from libc.stdio cimport getchar, putchar
cdef inline int read() nogil:
    cdef int b, c = 0
    while 1:
        b = getchar() - 48
        if b < 0: break
        c = c * 10 + b
    return c
cdef int i
cdef dsu *d = new dsu(read())
for i in prange(read(), nogil=1):
    if read():
        if d.same(read(), read()): putchar(49)
        else: putchar(48)
        putchar(10)
    else: d.merge(read(), read())
"""
import os, sys
if sys.argv[-1] == 'ONLINE_JUDGE':
    open('solve.pyx', 'w').write(code)
    os.system('cythonize -i -3 -b solve.pyx')
import solve
Problem p02573 (python)

Fixed submission:
from networkx import*
print(max(*map(len,connected_components(Graph([*map(str.split,open(0))][1:]))),1,1))

Buggy submission (verdict: Runtime Error):
import sys
if sys.argv[-1] == 'ONLINE_JUDGE':
    import os, zlib, base64
    open('solve.pyx', 'wb').write(zlib.decompress(base64.b85decode("c${TYO>cuR480@qAH2g<Sknro9VRsPM>-Bp2oMbdN;6g4ub)FGU-bp-_x$|gq%wU6t>WT*wMOY0gzARgSm<PTl{O42M-acZ>GgR)gKaC@nKT&GwVX(kN~!u8ucZ|Y8b(B=Z50NhloinL<u!3pzz_z0QZz6)r3^d(FK|_Vvacc{$MMog(mIMk_qA%XFaU}f;tT}jkofYgQLTh@BDvrMPL85@DXWT*4|sdefE$V53*yuSSxFN(66Zu54;pEIj0Umt)k-X-adrW>{z!kgU_m32?B0nU8teJJ*Jbf$fUB%#Xa*evWbUMjfo0CYP1$BMPdnFcOFr$kY1JE0q&D4MM1o^;p2n+H;kN0%y<G_x??~H8ckBt`JBapy@RS2z&0Fv3lRmuIfi5g*;$zvl;E!eJz;4T<{4pQ(_Xsb%`n(^%9vv^Ycp5Is*%R6LGR8Cv{L_vO&*hgs(2dYZ{{h3n*31")))
    os.system('cythonize -i -3 -b solve.pyx')
import solve
Problem p02574 (python)

Fixed submission:
n,*a=map(int,open(0).read().split())
m=6**8
c=[0]*m
p=[1,1]+c[:]
for i in range(m):
  if p[i]<1:
    for j in range(i,m,i):p[j]=i
for a in a:
  s={a}
  while a!=p[a]:
    s|={p[a]}
    a//=p[a]
    s|={a}
  for i in s:c[i]+=1
print(('not','psaeitr'[max(c[2:])>1::2]+'wise')[max(c[2:])<n],'coprime')

Buggy submission (verdict: Runtime Error):
n=int(input())
1/(n>3)

Buggy submission (verdict: Runtime Error):
c=[m:=0]*6**8
n,a=open(0)
for a in a.split():c[int(a)]+=1
print(('not','psaeitr'[any((m:=max(m,sum(c[i::i])))>1for i in range(2,6**8))::2]+'wise')[m<int(n)],'coprime')

print(('not','psaeitr'[any(c:=[max(0,sum(c[i::i])-1)for i in range(2,6**8)])::2]+'wise')[max(c)+1<int(n)],'coprime')

1/(max(c)+1==m)

Buggy submission (verdict: Runtime Error):
n,*a=map(int,open(0).read().split())
m=6**8
c=[0]*m
p=[1,1]+c[:]
for i in range(m):
  if p[i]<1:
    for j in range(i,m,i):p[j]=i
for a in a:
  c[a]+=1
  while p[a]!=a:
    a//=p[a]
    c[a]+=1
1/(max(c[2:])<n)
print(('not','psaeitr'[max(c[2:])>1::2]+'wise')[max(c[2:])<n],'coprime')

Buggy submission (verdict: Runtime Error):
n,*a=map(int,open(0).read().split())
m=6**8
c=[0]*m
p=[1,1]+c[:]
for i in range(m):
  if p[i]<1:
    for j in range(i,m,i):p[j]=i
for a in a:
  c[a]+=1
  while p[a]!=a:
    a//=p[a]
    c[a]+=1
1/(max(c[2:])==n)
print(('not','psaeitr'[max(c[2:])>1::2]+'wise')[max(c[2:])<n],'coprime')

Buggy submission (verdict: Runtime Error):
n,*a=map(int,open(0).read().split())
m=max(a)+1
c=[0]*m
p=[1,1]+c[:]
for i in range(m):
  if p[i]<1:
    for j in range(i,m,i):p[j]=i
for a in a:
  c[a]+=1
  while p[a]!=a:
    a//=p[a]
    c[a]+=1
print(('not','psaeitr'[max(c[2:])>1::2]+'wise')[max(c)<n],'coprime')