Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
from numpy import*
f=lambda:map(int,input().split())
N,W=f()
T=zeros(W+1,int)
exec('w,v=f();T[w:]=maximum(T[w:],T[:-w]+v);'*N)
print(T[-1])

Fixed submission:
import numpy as np
N,W=map(int,input().split())
dp=np.full(10**5+1,W+1)
dp[0]=0
for i in range(N):
    w,v=map(int,input().split())
    dp[v:]=np.minimum(dp[:-v]+w,dp[v:])
print(np.max(np.where(dp<=W)))

Buggy python submission (verdict: Runtime Error):
from numpy import *
N,W=map(int,input().split())
dp=zeros(W+1,int)
for i in range(N):
    w,v=map(int,input().split())
    dp[w:]=maximum(dp[:-w]+v,dp[w:])
print(dp[-1])

Fixed submission:
import numpy as np
N,W=map(int,input().split())
dp=np.full(10**5+1,W+1)
dp[0]=0
for i in range(N):
    w,v=map(int,input().split())
    dp[v:]=np.minimum(dp[:-v]+w,dp[v:])
print(np.max(np.where(dp<=W)))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
ans=0
for i in range(n+1):
    if set(str(i))=={"3","5","7"}:
        ans+=1
print(ans)

Fixed submission:
n=int(input())
d=["3","5","7"]
ans=[]
ans+=d
while d:
    a=d.pop(0)
    if len(a)<9:
        for i in "357":
            d+=[i+a]
            ans+=[i+a]
ans=list(map(int,ans))
ans.sort()
print(sum(i<=n for i in ans if len(set(str(i)))==3))
Buggy python submission (verdict: Runtime Error):
(n,m),*a=[[*map(int,i.split())]for i in open(0)]
c=[0]*-~n
id={}
for p,y in sorted(a,key=lambda x:x[1]):
    c[p]+=1
    id[y]=format(p,"06")+format(c[p],"06")
for _,y in a:
    print(id[y])

Fixed submission:
n,m=map(int, input().split())
a=[list(map(int, input().split())) for _ in range(m)]
c=[0]*-~n
id={}
for p,y in sorted(a,key=lambda x:x[1]):
    c[p]+=1
    id[y]=format(p,"06")+format(c[p],"06")
for _,y in a:
    print(id[y])

Buggy python submission (verdict: Runtime Error):
(n,m),*a=[[*map(int,i.split())]for i in open(0)]
c=[0]*-~n
id={}
for p,y in sorted(a,key=lambda x:x[1]):
    c[p]+=1
    id[y]=str(p).zfill(6)+str(c[p]).zfill(6)
for _,y in a:
    print(id[y])

Fixed submission:
n,m=map(int, input().split())
a=[list(map(int, input().split())) for _ in range(m)]
c=[0]*-~n
id={}
for p,y in sorted(a,key=lambda x:x[1]):
    c[p]+=1
    id[y]=format(p,"06")+format(c[p],"06")
for _,y in a:
    print(id[y])
Buggy python submission (verdict: Runtime Error):
from math import *
a,b=map(int,input().split())
s=input()
t=input()
ans=a*b//gcd(a,b)
if a%b==0:
    if not all(s[i]==t[1+i*a//b] for i in range(b)):ans=-1
if b%a==0:
    if not all(t[i]==s[1+i*b//a] for i in range(a)):ans=-1
if s[0]!=t[0]:
    ans=-1
print(ans)

Fixed submission:
from math import *
a,b=map(int,input().split())
s=input()
t=input()
g=gcd(a,b)
for i in range(g):
    if s[a//g*i]!=t[b//g*i]:
        print(-1)
        exit()
print(a*b//g)

Buggy python submission (verdict: Runtime Error):
from math import *
a,b=map(int,input().split())
s=input()
t=input()
ans=a*b//gcd(a,b)
if a%b==0:
    if not all(s[i]==t[1+i*a//b] for i in range(b)):ans=-1
if b%a==0:
    if not all(t[i]==s[1+i*b//a] for i in range(a)):ans=-1
print(ans)

Fixed submission:
from math import *
a,b=map(int,input().split())
s=input()
t=input()
g=gcd(a,b)
for i in range(g):
    if s[a//g*i]!=t[b//g*i]:
        print(-1)
        exit()
print(a*b//g)
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
for i in range(m,0,-1):
    if m%i==0 and m/n>=i:print(i);break

Fixed submission:
from itertools import *
n,m=map(int,input().split())
M=m
a=[1]
for i in range(2,int(m**.5)+1):
    while m%i==0:
        m//=i
        a+=[i]
if m!=1:a+=[m]
ans=1
for i in range(len(a)):
    for b in combinations_with_replacement(set(a),i):
        c=1
        for j in b:c*=j
        if c>=n and M%c==0:ans=max(ans,M//c)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import *
n,m=map(int,input().split())
M=m
a=[1]
for i in range(2,int(m**.5)+1):
    while m%i==0:
        m//=i
        a+=[i]
if m!=1:a+=[m]
ans=1
for i in range(len(a)):
    for b in combinations(a,i):
        c=1
        for j in b:
            c*=j
        if c>=n:
            ans=max(ans,M//c)
print(ans)

Fixed submission:
from itertools import *
n,m=map(int,input().split())
M=m
a=[1]
for i in range(2,int(m**.5)+1):
    while m%i==0:
        m//=i
        a+=[i]
if m!=1:a+=[m]
ans=1
for i in range(len(a)):
    for b in combinations_with_replacement(set(a),i):
        c=1
        for j in b:c*=j
        if c>=n and M%c==0:ans=max(ans,M//c)
print(ans)
Buggy python submission (verdict: Runtime Error):
n,k,*a=map(int,open(0).read().split())
b,c=[],[0]
for i in a:
    if i<0:
        b+=[-i]
    elif i==0:
        k-=1
    else:
        c+=[i]
b=[0]+b[::-1]        
ans=10**9
B,C=len(b),len(c)
for i in range([0,abs(C-k-1)][C-k-1<0],B):
    ans=min(ans,b[i]+c[k-i]+min(b[i],c[k-i]))
print(ans)

Fixed submission:
n,k,*a=map(int,open(0).read().split())
ans=10**9
for i in range(n-k+1):
    b,c=a[i],a[i+k-1]
    ans=min(ans,min(abs(b),abs(c))+abs(b-c))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s=input()
k=int(input())
ans=0
for i in range(len(s)):
    ans+=int(s[i])**500000000000
    if ans>=k:
        print(s[i])
        break

Fixed submission:
s=input()
k=int(input())
for i in range(k):
    if s[i]!="1":
        print(s[i])
        break
    if i==k-1:
        print(1)
Buggy python submission (verdict: Runtime Error):
n=int(input())
dp=list(range(100000))
for i in range(n+1):
    pow6=1
    while pow6<=i:
        dp[i]=min(dp[i],dp[i-pow6]+1)
        pow6 *=6
    pow9=1
    while pow9<=i:
        dp[i]=min(dp[i],dp[i-pow9]+1)
        pow9 *=9    
print(dp[n])

Fixed submission:
n=int(input())
dp=list(range(110000))
for i in range(n+1):
    pow6=1
    while pow6<=i:
        dp[i]=min(dp[i],dp[i-pow6]+1)
        pow6 *=6
    pow9=1
    while pow9<=i:
        dp[i]=min(dp[i],dp[i-pow9]+1)
        pow9 *=9    
print(dp[n])
Buggy python submission (verdict: Time Limit Exceeded):
import collections
n,*a=map(int,open(0).read().split())
b=[0]*n
b[0]=a[0]
for i in range(1,n):
    b[i]=b[i-1]+a[i]
b.sort()    
c=set(b)
ans=b.count(0)
for i in c:
    j=b.count(i)
    ans+=j*(j-1)//2
print(ans)

Fixed submission:
import collections
n,*a=map(int,open(0).read().split())
b=[0]*n
b[0]=a[0]
for i in range(1,n):
    b[i]=b[i-1]+a[i]
b.sort()    
b=[0]+b
ans=0
l=collections.Counter(b)
for i in l.values():
    ans+=i*(i-1)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,*a=map(int,open(0).read().split())
b=[0]*n
b[0]=a[0]
for i in range(1,n):
    b[i]=b[i-1]+a[i]
c=set(b)
ans=b.count(0)
for i in c:
    j=b.count(i)
    ans+=j*(j-1)//2
print(ans)

Fixed submission:
import collections
n,*a=map(int,open(0).read().split())
b=[0]*n
b[0]=a[0]
for i in range(1,n):
    b[i]=b[i-1]+a[i]
b.sort()    
b=[0]+b
ans=0
l=collections.Counter(b)
for i in l.values():
    ans+=i*(i-1)//2
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
x=[int(i) for i in input().split()]
y=sorted(x)
for i in x:
    if y.index(i)+1>n/2:
        print(y[n//2-1])
    else:
        print(y[n//2])

Fixed submission:
n=int(input())
x=[int(i) for i in input().split()]
y=sorted(x)
for i in x:
    if i>y[n//2-1]:
        print(y[n//2-1])
    else:
        print(y[n//2])
Buggy python submission (verdict: Time Limit Exceeded):
n,*a=map(int,open(0).read().split())
a=a+[0]
for i in range(1,n+1):
    b=a[:i-1]+a[i:]
    print(sum(abs(x-y) for x,y in zip(b,b[1:]))+abs(b[0]))

Fixed submission:
n,*a=map(int,open(0).read().split())
a=[0]+a+[0]
b=sum(abs(i-j) for i,j in zip(a,a[1:]))
for i,j,k in zip(a,a[1:],a[2:]):
    if i<=j<=k or i>=j>=k:
        print(b)
    elif min(i,j,k)==j:
        print(b-2*(min(i,k)-j))
    else:
        print(b-2*(j-max(i,k)))
Buggy python submission (verdict: Runtime Error):
n,*a=map(int,open(0).read().split())
u=d=z=r=0
for i,j in zip(a[:n],a[n:]):
    if j-i>0:u+=(j-i)//2*2;r+=(j-i)%2
    elif j-i==0:z+=1
    else:d+=[j-i]
print("Yes" if u+2*d>=0 else "No")

Fixed submission:
n,*a=map(int,open(0).read().split())
u=d=z=r=0
for i,j in zip(a[:n],a[n:]):
    if j-i>0:u+=(j-i)//2*2;r+=(j-i)%2
    elif j-i==0:z+=1
    else:d+=j-i
print("Yes" if u+2*d>=0 else "No")
Buggy python submission (verdict: Runtime Error):
(n,),*a=[[*map(int,i.split())]for i in open(0)]
ans=[]
for i in range(n-1):
    now=a[i][0]+a[i][1]
    for j in range(i+1,n-1):
        c,s,f=a[j]
        if s==now:
            d=0
        elif s>now:
            d=s-now
        else:
            d=now%f
        now+=c+d
    ans+=[now]  
ans+=[0]    
print(*ans,sep="\n")

Fixed submission:
n=int(input())
a=[list(map(int,input().split())) for _ in range(n-1)]
ans=[]
for i in range(n):
    now=0
    for j in range(i,n-1):
        c,s,f=a[j]
        if s==now:
            k=0
        elif s>now:
            k=s-now
        else:
            if now%f!=0:
                k=f-now%f
            else:
                k=0
        now+=c+k
    print(now)
Buggy python submission (verdict: Runtime Error):
s=input()
j=0
for i in "AKIHABARA":
    if i==s[j]:
        j+=1
    elif i=="A":
        continue
    elif j==len(s):
        break
    else:
        print("NO")
        exit()
print("YES") 

Fixed submission:
a=["KIH","B","R",""]
ans=[]
aaa=[]
for i in range(16):
    b=""
    for j,k in enumerate(a):
        if ((i >> j) & 1):
            b+="A"
        b+=k
    ans.append(b)
print("YES" if input() in ans else "NO")

Buggy python submission (verdict: Runtime Error):
s=input()
j=0
for i in "AKIHABARA":
    if i==s[j] or i=="A":
        j+=1
    else:
        print("NO")
        exit()
print("YES") 

Fixed submission:
a=["KIH","B","R",""]
ans=[]
aaa=[]
for i in range(16):
    b=""
    for j,k in enumerate(a):
        if ((i >> j) & 1):
            b+="A"
        b+=k
    ans.append(b)
print("YES" if input() in ans else "NO")

Buggy python submission (verdict: Runtime Error):
s=input()
a="AKIHABARA"
j=0
for i in s:
    if i==a[j]:
        j+=1
    elif j<8:
        if i==a[j+1] and a[j]=="A":
            j+=2
    else:
        print("NO")
        exit()
print("YES") 

Fixed submission:
a=["KIH","B","R",""]
ans=[]
aaa=[]
for i in range(16):
    b=""
    for j,k in enumerate(a):
        if ((i >> j) & 1):
            b+="A"
        b+=k
    ans.append(b)
print("YES" if input() in ans else "NO")

Buggy python submission (verdict: Runtime Error):
s=input()
a="AKIHABARA"
j=0
for i in s:
    if i==a[j]:
        j+=1
    elif i==a[j+1] and a[j]=="A" and j<8:
        j+=2
    else:
        print("NO")
        exit()
print("YES")  

Fixed submission:
a=["KIH","B","R",""]
ans=[]
aaa=[]
for i in range(16):
    b=""
    for j,k in enumerate(a):
        if ((i >> j) & 1):
            b+="A"
        b+=k
    ans.append(b)
print("YES" if input() in ans else "NO")

Buggy python submission (verdict: Runtime Error):
s=input()
a="AKIHABARA"
j=0
for i in s:
    if j>8:
        print("NO")
        exit()
    if i==a[j]:
        j+=1
    elif i==a[j+1] and a[j]=="A":
        j+=2
    else:
        print("NO")
        exit()
print("YES")  

Fixed submission:
a=["KIH","B","R",""]
ans=[]
aaa=[]
for i in range(16):
    b=""
    for j,k in enumerate(a):
        if ((i >> j) & 1):
            b+="A"
        b+=k
    ans.append(b)
print("YES" if input() in ans else "NO")
Buggy python submission (verdict: Time Limit Exceeded):
def ryuka(n):
    if n==0:
        return 2
    if n==1:
        return 1
    return ryuka(n-1)+ryuka(n-2)    
print(ryuka(int(input())))   

Fixed submission:
n=int(input())
l=[2,1]
for i in range(3,n+2):
    l.append(l[i-2]+l[i-3])
print(l[-1])
Buggy python submission (verdict: Time Limit Exceeded):
from bisect import *
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
ans=0
for c in C:
    for b in B[:bisect_left(B,c)]:
        ans+=bisect_left(A,b)
print(ans)

Fixed submission:
from bisect import *
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
ans=0
for b in B:
    ans+=(n-bisect(C,b))*bisect_left(A,b)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import *
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
ans=0
for c in C:
    for b in B[:bisect_left(B,c)]:
        ans+=bisect_left(A,b)
print(ans)

Fixed submission:
from bisect import *
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
ans=0
for b in B:
    ans+=(n-bisect(C,b))*bisect_left(A,b)
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=set()
for i in range(n):
    b=int(input())
    if b in a:
        a.remove(b)
    else:
        a.append(b)
print(len(a))

Fixed submission:
import sys
input=sys.stdin.readline
n=int(input())
a=[int(input()) for _ in range(n)]
a.sort()
h=a[0]
ans=1
for i in a[1:]:
    if i!=h:
        ans+=1
        h=i
    else:
        ans-=1
        h=pow(10,10)    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input=sys.stdin.readline
n=int(input())
a=[]
for i in range(n):
    b=int(input())
    if b in a:
        a.remove(b)
    else:
        a.append(b)
print(len(a)) 

Fixed submission:
import sys
input=sys.stdin.readline
n=int(input())
a=[int(input()) for _ in range(n)]
a.sort()
h=a[0]
ans=1
for i in a[1:]:
    if i!=h:
        ans+=1
        h=i
    else:
        ans-=1
        h=pow(10,10)    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[]
for i in range(n):
    b=int(input())
    if b in a:
        a.remove(b)
    else:
        a.append(b)
print(len(a)) 

Fixed submission:
import sys
input=sys.stdin.readline
n=int(input())
a=[int(input()) for _ in range(n)]
a.sort()
h=a[0]
ans=1
for i in a[1:]:
    if i!=h:
        ans+=1
        h=i
    else:
        ans-=1
        h=pow(10,10)    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(input()) for i in range(n)]
b=[x for x in set(a) if a.count(x)%2!=0]
print(len(b))

"""
set型は重複した要素をもたないデータ型
set(a)の各要素につき，リストaに奇数個含まれていたらリストbに入れる
"""

Fixed submission:
import sys
input=sys.stdin.readline
n=int(input())
a=[int(input()) for _ in range(n)]
a.sort()
h=a[0]
ans=1
for i in a[1:]:
    if i!=h:
        ans+=1
        h=i
    else:
        ans-=1
        h=pow(10,10)    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[0]*n
for i in range(n):
    a[i]=int(input())
ans=0
for i in range(n):
    if a[i] not in a[:i] and a.count(a[i])%2!=0:
        ans +=1
print(ans)

Fixed submission:
import sys
input=sys.stdin.readline
n=int(input())
a=[int(input()) for _ in range(n)]
a.sort()
h=a[0]
ans=1
for i in a[1:]:
    if i!=h:
        ans+=1
        h=i
    else:
        ans-=1
        h=pow(10,10)    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[0]*n
for i in range(n):
    a[i]=int(input())
ans=0
for i in range(n):
    if a.count(a[i])%2!=0 and a[i] not in a[:i]:
        ans +=1
print(ans)

Fixed submission:
import sys
input=sys.stdin.readline
n=int(input())
a=[int(input()) for _ in range(n)]
a.sort()
h=a[0]
ans=1
for i in a[1:]:
    if i!=h:
        ans+=1
        h=i
    else:
        ans-=1
        h=pow(10,10)    
print(ans)
Buggy python submission (verdict: Runtime Error):
from math import factorial as f
n,p,*a=map(int,open(0).read().split())
x=len([i for i in a if i%2])
y=n-x

xx=0
for i in range(p,x,2):
    xx+=f(x)//f(i)//f(x-i)

yy=0
for i in range(0,y):
    yy+=f(y)//f(i)//f(y-i)

if x>0 and y>0:
    print(xx*yy+xx*(p^0)+yy*(p^1))
elif x==0:
    print(yy(p^1))
else:
    print(xx)

Fixed submission:
n,p,*a=map(int,open(0).read().split())
if len([i for i in a if i%2])==0:
    print(2**n*(p^1))
else:
    print(2**(n-1))
Buggy python submission (verdict: Time Limit Exceeded):
n,*a=map(int,open(0).read().split())
b=[]
for i,j in zip(a[::2],a[1::2]):
    b=[j]+b+[i]
if n%2:
    b=[a[-1]]+b[::-1]
print(*b)

Fixed submission:
n,*a=map(int,open(0).read().split())
b=a[1::2][::-1]+a[::2]
if n%2:
    b=[a.pop(-1)]+a[::2][::-1]+a[1::2]
print(*b)
Buggy python submission (verdict: Runtime Error):
n,*a=map(int,open(0).read().split())
b=0
if a[0]>a[1]:
    b=-1
elif a[0]==a[1]:
    b=0
else:b=1
c=[[a[0]]]
for i in range(1,n):
    if (a[i]-a[i-1])*b>0:
        c[-1]+=[a[i]]
    else:
        if len(c[-1])==1 or b==0:
            c[-1]+=[a[i]]
        else:c+=[[a[i]]]  
    if a[i-1]>a[i]:
        b=-1
    elif a[i-1]==a[i]:
        b=0
    else:b=1
print(len(c))

Fixed submission:
n,*a=map(int,open(0).read().split())
ans=1
vec=0
for i in range(n-1):
    now=a[i+1]-a[i]
    if vec*now<0:
        ans+=1
        vec=0
    elif vec==0:
        vec=now
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import *
def p(n):
    a=[]
    while n%2==0:
        a.append(2)
        n//=2
    f=3
    while f*f<=n:
        if n%f==0:
            a.append(f)
            n//=f
        else:
            f+=2
    if n!=1:
        a.append(n)
    return a
ans=10
a=p(int(input()))
a+=[1,1]   
c=1
for i in a:
    c*=i
for i in range(1,len(a)//2+1):
    for j in combinations(a,i):
        b=1
        for k in j:
            b*=k
        ans=min(ans,max(len(str(b)),len(str(c//b))))
print(ans)

Fixed submission:
n=int(input())
ans=10
for i in range(1,int(n**.5)+1):
    if n%i==0:
        ans=min(max(len(str(i)),len(str(n//i))),ans)
print(ans)
Buggy python submission (verdict: Runtime Error):
happy,newyear,enjoy

Fixed submission:
s=input()
print(s.replace(","," "))
Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int,input().split())
ans=0
for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x+y+z==s:
                ans+=1
print(ans) 

Fixed submission:
k,s=map(int,input().split())
ans=0
for i in range(k+1):
    for j in range(k+1):
        if 0<=s-i-j<=k:
            ans+=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,x=map(int, input().split())
count=0
for i in range(a,b+1):
    if i%x==0:
        count+=1
print(count)    

Fixed submission:
a,b,x=map(int, input().split())
a=(a-1)//x
b//=x
print(b-a)
Buggy python submission (verdict: Runtime Error):
from collections import deque
A=deque(input())
B=deque(input())
C=deque(input())
t="a"
for i in range(len(A+B+C)):
    if t=="a":
        if len(A)==0:
            print("A")
            exit()
        t=A.popleft()   
    if t=="b":
        if len(B)==0:
            print("B")
            exit()
        t=B.popleft()   
    if t=="c":
        if len(C)==0:
            print("C")
            exit()
        t=C.popleft() 

Fixed submission:
from collections import deque
A=deque(input())
B=deque(input())
C=deque(input())
t="a"
for i in range(300):
    if t=="a":
        if len(A)==0:
            print("A")
            exit()
        t=A.popleft()   
    if t=="b":
        if len(B)==0:
            print("B")
            exit()
        t=B.popleft()   
    if t=="c":
        if len(C)==0:
            print("C")
            exit()
        t=C.popleft()
Buggy python submission (verdict: Runtime Error):
n = input()
if(n % 9 == 0): print("Yes")
else : print("No")


Fixed submission:
n = int(input())
if n % 9 == 0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n = input()
c = 0
for i in range(1,n):
  c += i
print(c)

Fixed submission:
n = int(input())
c = 0
for i in range(1,n+1):
  c += i
print(c)

Buggy python submission (verdict: Runtime Error):
n = input()
c = 0
for i in range 1 to n:
    c += i
print(c)

Fixed submission:
n = int(input())
c = 0
for i in range(1,n+1):
  c += i
print(c)
Buggy python submission (verdict: Runtime Error):
s = input().split()
if s.count(“5”) == 2 and s.count(“7”) == 1 :
    print(“YES”)
else :
    print(“NO”)

Fixed submission:

s = input().split()
if s.count("5") == 2 and s.count("7") == 1:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(10**6)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def lr(xx):
    ll=[-1]*(n+1)
    rr=[-1]*(n+1)
    for i,x in enumerate(xx):
        if ll[x]==-1:ll[x]=i
        if i==n-1 or x!=xx[i+1]:rr[x]=i+1
    return ll,rr

n=II()
aa=LI()
bb=LI()
all,arr=lr(aa)
bll,brr=lr(bb)
# print(all,arr)
ca=[0]*(n+1)
cb=[0]*(n+1)
for a in aa:ca[a]+=1
for b in bb:cb[b]+=1
for i in range(n+1):
    if ca[i]+cb[i]>n:
        print("No")
        exit()
ng=[0]*n
for al,ar,bl,br in zip(all,arr,bll,brr):
    if al==-1 or bl==-1:continue
    if bl<ar:
        mn=max(0,al-br+1)
        mx=ar-bl
        ng[mn]+=1
        ng[mx]-=1
    else:
        mn=max(0,al+n-br+1)
        mx=ar+n-bl
        ng[mn]+=1
        ng[mx]-=1
# print(ng)
for i in range(n-1):ng[i+1]+=ng[i]
shift=-1
for i in range(n):
    if not ng[i]:
        shift=i
        break
ans=bb[shift:]+bb[:shift]
print("Yes")
print(*ans)


Fixed submission:
import sys

sys.setrecursionlimit(10**6)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def lr(xx):
    ll=[-1]*(n+1)
    rr=[-1]*(n+1)
    for i,x in enumerate(xx):
        if ll[x]==-1:ll[x]=i
        if i==n-1 or x!=xx[i+1]:rr[x]=i+1
    return ll,rr

n=II()
aa=LI()
bb=LI()
all,arr=lr(aa)
bll,brr=lr(bb)
# print(all,arr)
ca=[0]*(n+1)
cb=[0]*(n+1)
for a in aa:ca[a]+=1
for b in bb:cb[b]+=1
for i in range(n+1):
    if ca[i]+cb[i]>n:
        print("No")
        exit()
ng=[0]*(n+1)
for al,ar,bl,br in zip(all,arr,bll,brr):
    if al==-1 or bl==-1:continue
    if bl<ar:
        mn=max(0,al-br+1)
        mx=ar-bl
        ng[mn]+=1
        ng[mx]-=1
    else:
        mn=max(0,al+n-br+1)
        mx=min(n,ar+n-bl)
        ng[mn]+=1
        ng[mx]-=1
# print(ng)
for i in range(n):ng[i+1]+=ng[i]
shift=-1
for i in range(n):
    if ng[i]==0:
        shift=i
        break
ans=bb[-shift:]+bb[:-shift]
print("Yes")
print(*ans)