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

Fixed submission:
N,K=map(int,input().split())
A=list(map(int,input().split()))
A=[a-1 for a in A]
Arrived=[-1 for i in range(N)]
Appeared=[]
k=0
location=0
T=0
T_List=[]
while k<=K:
    k+=1
    Arrived[location]=k-1
    Appeared.append(location)
    location=A[location]
    if Arrived[location]!=-1:
        T=k-Arrived[location]
        T_List=Appeared[k-T:k]
        break
if len(T_List)==0:
    print(Arrived.index(k-1)+1)
else:
    Destination=(K-(k-T-1))%T
    print(T_List[Destination-1]+1)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
A=list(map(int,input().split()))
A=[a-1 for a in A]
Arrived=[-1 for i in range(N)]
Appeared=[]
k=0
location=0
T=0
T_List=[]
while k<=K:
    k+=1
    Arrived[location]=k-1
    Appeared.append(location)
    location=A[location]
    if Arrived[location]!=-1:
        T=k-Arrived[location]
        T_List=Appeared[k-T:k]
        break
if len(T_List)==0:
    print(Arrived.index(k-1)+1)
else:
    Destination=(K-(k-T-1))%T
    print(T_List[Destination-1]+1)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
A=list(map(int,input().split()))
A=[a-1 for a in A]
Appeared=[]
k=0
location=0
T=0
T_List=[]
while k<=K:
    k+=1
    Appeared.append(location)
    location=A[location]
    if location in Appeared:
        T=k-Appeared.index(location)
        T_List=Appeared[k-T:k]
        break
if len(T_List)==0:
    print(Appeared[-1]+1)
else:
    Destination=(K-(k-T-1))%T
    print(T_List[Destination-1]+1)
Problem p02866 (python)

Fixed submission:
import bisect
N=int(input())
D=list(map(int,input().split()))
if D[0]==0 and D.count(0)==1:
    D.sort()
    m=max(D)
    counter=[]
    for i in range(m+1):
        counter.append(bisect.bisect_right(D,i)-bisect.bisect_left(D,i))
    ans=1
    for i in range(1,m+1):
        ans*=counter[i-1]**counter[i]
    print(ans%998244353)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
import bisect
N=int(input())
D=list(map(int,input().split()))
if D[0]==0:
    D.sort()
    m=max(D)
    counter=[]
    for i in range(1,m+1):
        counter.append(bisect.bisect_right(D,i)-bisect.bisect_left(D,i))
    ans=1
    for i in range(2,m+1):
        if counter[i-1]==0:
            counter[i-1]=1
        ans*=counter[i-1]**counter[i]
    print(ans%998244353)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
import bisect
N=int(input())
D=list(map(int,input().split()))
D.sort()
m=max(D)
counter=[]
if D[0]==0:
    for i in range(1,m+1):
        counter.append(bisect.bisect_right(D,i)-bisect.bisect_left(D,i))
    ans=1
    for i in range(2,m+1):
        if counter[i-1]==0:
            counter[i-1]=1
        ans*=counter[i-1]**counter[i]
    print(ans%998244353)
else:
    print(0)
Problem p02867 (python)

Fixed submission:
import numpy as np
N=int(input())
A=np.array(list(map(int,input().split())))
B=np.array(list(map(int,input().split())))

AB=np.array([(A[i],B[i]) for i in range(N)])
AB=AB[np.argsort(AB[:,1])]

AI=np.array([[i,AB[i,0]] for i in range(N)])
AI=AI[np.argsort(AI[:,1])]

sigma=AI[:,0]
ASort=AI[:,1]
BSort=AB[:,1]

g=0
f=0
for i in range(N):
    if ASort[i]>BSort[i]:
        g=1
        break

counter=1
start=0
now=sigma[start]
while start!=now:
    now=sigma[now]
    counter+=1
    
if N==counter:
    f=1
    for i in range(N-1):
        if BSort[i]>=ASort[i+1]:
            f=0
            break

if f==0 and g==0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import numpy as np
N=int(input())
A=np.array(list(map(int,input().split())))
B=np.array(list(map(int,input().split())))
AB=np.array([(a,b) for a,b in zip(A,B)])
AB=AB[np.argsort(AB[:,1])]
AI=np.array([[i,AB[i,0]] for i in range(N)])
AI=AI[np.argsort(AI[:,1])]
sigma=AI[:,0]
ASort=AI[:,1]
BSort=AB[:,1]
g=0
for i in range(N):
    if ASort[i]>BSort[i]:
        g=1
        break
counter=0
if g==0:
    used=np.array([])
    start=0
    now=sigma[start]
    np.append(used,now)
    while start!=now:
        now=sigma[now]
        np.append(used,now)
    
if N==len(used) or g==1:
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
import numpy as np
N=int(input())
A=np.array(list(map(int,input().split())))
B=np.array(list(map(int,input().split())))
AB=np.array([(a,b) for a,b in zip(A,B)])
AB=AB[np.argsort(AB[:, 1])]
AI=np.array([(i,AB[i,0]) for i in range(N)])
AI=AI[np.argsort(AI[:, 1])]
sigma=np.array([AI[i,0] for i in range(N)])
ASort=np.array([AI[i,1] for i in range(N)])
BSort=np.array([AB[i,1] for i in range(N)])
g=0
for i in range(N):
    if ASort[i]>BSort[i]:
        g=1
        break
counter=0
if g==0:
    used=np.array([])
    for i in range(N):
        if not(i in used):
            counter+=1
            if counter==2:
                break
            start=i
            np.append(used,i)
            now=sigma[start]
            np.append(used,now)
            while start!=now:
                now=sigma[now]
                np.append(used,now)
if counter!=2 or g==1:
    print("No")
else:
    print("Yes")
Problem p02889 (python)

Fixed submission:
INF=10**15
N,M,L=map(int,input().split())
d=[[INF for i in range(N)] for j in range(N)]
d1=[[INF for i in range(N)] for j in range(N)]
for i in range(N):
    d[i][i]=0
for m in range(M):
    A,B,C=map(int,input().split())
    d[A-1][B-1]=C
    d[B-1][A-1]=C

for k in range(N):
    for i in range(N):
        for j in range(N):
            d[i][j]=min(d[i][j],d[i][k]+d[k][j])
for i in range(N):
        for j in range(N):
            if i!=j and d[i][j]<=L:
                d1[i][j]=1
                d1[j][i]=1
for k in range(N):
    for i in range(N):
        for j in range(N):
            d1[i][j]=min(d1[i][j],d1[i][k]+d1[k][j])

Q=int(input())
for _ in range(Q):
    s,t=map(int,input().split())
    dis=d1[s-1][t-1]
    if dis==INF:
        print(-1)
    else:
        print(dis-1)

Buggy submission (verdict: Runtime Error):
INF=10**18
N,M,L=map(int,input().split())
d=[[INF for i in range(N)] for j in range(N)]
for i in range(N):
    d[i][i]=0
for m in range(M):
    A,B,C=map(int,input().split())
    d[A-1][B-1]=C
    d[B-1][A-1]=C

for k in range(N):
    for i in range(N):
        for j in range(N):
            d[i][j]=min(d[i][j],d[i][k]+d[k][j])
for i in range(N):
        for j in range(N):
            if d[i][j]<=L:
                d[i][j]=1
for k in range(N):
    for i in range(N):
        for j in range(N):
            d[i][j]=min(d[i][j],d[i][k]+d[k][j])
ans=[]
Q=int(input())
for i in range(Q):
    s,t=map(int,input().split())
    dis=d[s-1][t-1]
    if dis==INF:
        ans.append(-1)
    else:
        ans.append(dis-1)

for a in ans:
    print(int(a))

Buggy submission (verdict: Runtime Error):
import numpy as np
INF=10**18
N,M,L=map(int,input().split())
d=np.zeros((N,N))
d[:,:]=INF
for i in range(N):
    d[i,i]=0
for m in range(M):
    A,B,C=map(int,input().split())
    d[A-1,B-1]=C
    d[B-1,A-1]=C

for k in range(N):
    for i in range(N):
        for j in range(N):
            d[i,j]=min(d[i,j],d[i,k]+d[k,j])
for i in range(N):
        for j in range(N):
            if d[i,j]<=L:
                d[i,j]=1
for k in range(N):
    for i in range(N):
        for j in range(N):
            d[i,j]=min(d[i,j],d[i,k]+d[k,j])
ans=[]
Q=int(input())
for i in range(Q):
    s,t=map(int,input().split())
    dis=d[s-1,t-1]
    if dis==INF:
        ans.append(-1)
    else:
        ans.append(dis-1)

for a in ans:
    print(int(a))

Buggy submission (verdict: Runtime Error):
import numpy as np
INF=10**18
N,M,L=map(int,input().split())
d=np.zeros((N,N))
d[:,:]=INF
for i in range(N):
    d[i,i]=0
for m in range(M):
    A,B,C=map(int,input().split())
    d[A-1,B-1]=C
    d[B-1,A-1]=C

for k in range(N):
    for i in range(N):
        for j in range(N):
            d[i,j]=min(d[i,j],d[i,k]+d[k,j])
for i in range(N):
        for j in range(N):
            if d[i,j]<=L:
                d[i,j]=1
for k in range(N):
    for i in range(N):
        for j in range(N):
            d[i,j]=min(d[i,j],d[i,k]+d[k,j])
ans=[]
Q=int(input())
for i in range(Q):
    s,t=map(int,input().split())
    dis=d[s-1,t-1]
    if dis==INF:
        ans.append(-1)
    else:
        ans.append(dis-1)

for a in ans:
    print(int(a))
Problem p02900 (python)

Fixed submission:
import math 
import fractions
import collections


def prime_factorize(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
A,B=map(int,input().split())
counter=0
gcd=fractions.gcd(A,B)
c = collections.Counter(prime_factorize(gcd))
print(len(c)+1)

Buggy submission (verdict: Runtime Error):
import math 

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

A,B=map(int,input().split())
counter=0
gcd=math.gcd(A,B)
for i in range(2,gcd):
    if is_prime(i) and gcd%i==0:
        counter+=1
print(counter+1)
Problem p03029 (python)

Fixed submission:
A,P=map(int,input().split())
print((A*3+P)//2)

Buggy submission (verdict: Runtime Error):
import numpy as np
N=int(input())
a=[]
for i in range(N):
    s,p=input().split()
    p=int(p)
    a.append([s,p,i+1])
a.sort(key=lambda x:(x[0],x[1]))
i=0
while i<=N:
    last=a[i][0]
    i+=1
    if i<N and last==a[i][0]:
        s=i-1
        g=i
        while 1:
            if i>=N or last!=a[i][0]:
                g=i
                break
            i+=1
        for j in reversed(range(s,g)):
            print(a[j][2])
        if i==N-1:
            break
    else:
        print(a[i-1][2])
Problem p03076 (python)

Fixed submission:
a=[]
b=[]
for i in range(5):
    buf = int(input())
    a.append(buf)
    if buf%10 != 0:
        b.append(10-buf%10)
if b:
    print(sum(a)+sum(b)-max(b))
else:
    print(sum(a))

Buggy submission (verdict: Runtime Error):
a=[]
b=[]
for i in range(5):
    buf = int(input())
    a.append(buf)
    if buf%10 != 0:
        b.append(10-buf%10)
print(sum(a)+sum(b)-max(b))
Problem p03112 (python)

Fixed submission:
import bisect
INF=10**18
A,B,Q=map(int,input().split())
s=[int(input()) for i in range(A)]
t=[int(input()) for i in range(B)]
s=[-INF]+s+[INF]
t=[-INF]+t+[INF]
for q in range(Q):
    X=int(input())
    t1=bisect.bisect_right(t,X)
    s1=bisect.bisect_right(s,X)
    res=INF
    for T in [t[t1],t[t1-1]]:
        for S in [s[s1],s[s1-1]]:
            ans1=abs(X-T)+abs(S-T)
            ans2=abs(X-S)+abs(S-T)
            res=min(res,ans1,ans2)
    print(res)

Buggy submission (verdict: Runtime Error):
import bisect
import numpy as np
INF=10**18
A,B,Q=map(int,input().split())
s=[int(input()) for i in range(A)]
t=[int(input()) for i in range(B)]
s=[-INF]+s+[INF]
t=[-INF]+t+[INF]
s=np.array(s)
t=np.array(t)
for q in range(G):
    X=int(input())
    t1=bisect.bisect_right(t,X)
    l1=X-t[t1]
    if (t[t1]-X)>(X-t[t1-1]):
        l1=X-t[t1-1]
    s1=bisect.bisect_right(s,X)
    l2=X-s[s1]
    if (s[s1]-X)>(X-s[s1-1]):
        l2=X-s[s1-1]
    l3=bisect.bisect_right(s,X-l1)
    l4=bisect.bisect_right(t,X-l2)
    print(min(abs(l1)+min(s[l3]-X+l1,X-l1-s[l3-1]),abs(l2)+min(t[l4]-X+l2,X-l2-t[l4-1])))
Problem p03155 (python)

Fixed submission:
N=int(input())
H=int(input())
W=int(input())
print((N-H+1)*(N-W+1))

Buggy submission (verdict: Runtime Error):
N=int(input())
H=int(input())
W==int(input())
print((N-H+1)*(N-W+1))

Buggy submission (verdict: Runtime Error):
N=int(input())
H=int(input())
W==int(input())
print((N-H+1)*(N-W+1))
Problem p03160 (python)

Fixed submission:
import sys
INF=100000000
def frog(i,h,dp):
    global INF
    if dp[i]!=INF:
        return dp[i]
    else:
        if i==1:
            dp[i]=0
            return dp[i]
        elif i==2:
            dp[i]=abs(h[1]-h[0])
            return dp[i]
        else:
            dp[i]=min(frog(i-2,h,dp)+abs(h[i-1]-h[i-3]),frog(i-1,h,dp)+abs(h[i-1]-h[i-2]))
            return dp[i]
sys.setrecursionlimit(INF)
N=int(input())
h=list(map(int,input().split()))
dp=[INF for i in range(N+1)]
print(frog(N,h,dp))

Buggy submission (verdict: Runtime Error):
INF=100000000
def frog(i,h,dp):
    global INF
    if dp[i]!=INF:
        return dp[i]
    else:
        if i==1:
            dp[i]=0
            return dp[i]
        elif i==2:
            dp[i]=abs(h[1]-h[0])
            return dp[i]
        else:
            dp[i]=min(frog(i-2,h,dp)+abs(h[i-1]-h[i-3]),frog(i-1,h,dp)+abs(h[i-1]-h[i-2]))
            return dp[i]
sys.setrecursionlimit(INF)
N=int(input())
h=list(map(int,input().split()))
dp=[INF for i in range(N+1)]
print(frog(N,h,dp))

Buggy submission (verdict: Runtime Error):
INF=100000000
def flog(i,h,dp):
    global INF
    if dp[i]!=INF:
        return dp[i]
    else:
        if i==1:
            dp[i]=0
            return dp[i]
        elif i==2:
            dp[i]=abs(h[1]-h[0])
            return dp[i]
        else:
            dp[i]=min(flog(i-2,h,dp)+abs(h[i-1]-h[i-3]),flog(i-1,h,dp)+abs(h[i-1]-h[i-2]))
            return dp[i]
N=int(input())
h=list(map(int,input().split()))
dp=[INF for i in range(N+1)]
print(flog(N,h,dp))
Problem p03161 (python)

Fixed submission:
import numpy as np
N,K=map(int,input().split())
h=list(map(int,input().split()))
h=np.array(h)
cost=np.zeros(N+1)
cost[1]=0
cost[2]=abs(h[1]-h[0])
for i in range(3,N+1):
    x=1 if i-K<=1 else i-K
    cost[i]=(cost[x:i]+abs(h[i-1]-h[x-1:i-1])).min()
print(int(cost[N]))

Buggy submission (verdict: Runtime Error):
import sys
INF=10000000000
def frog(i,K,h,dp):
    global INF
    if dp[i]!=INF:
        return dp[i]
    else:
        cost=INF
        for k in range(1,K+1):
            if i-k-1>=0:
                x=frog(i-k,K,h,dp)+abs(h[i-1]-h[i-k-1])
                if cost>x:
                    cost=x
                continue
            break
        dp[i]=cost
        return dp[i]
sys.setrecursionlimit(INF)
N,K=map(int,input().split())
h=list(map(int,input().split()))
dp=[INF for i in range(N+1)]
dp[1]=0
dp[2]=abs(h[1]-h[0])
print(frog(N,K,h,dp))
Problem p03163 (python)

Fixed submission:
import numpy as np
N,W=map(int,input().split())
w=[0 for i in range(N)]
v=[0 for i in range(N)]
for i in range(N):
    w[i],v[i]=map(int,input().split())
dp=[0 for i in range(W+1)]
dp=np.array(dp)
for i in range(N):
    dp[w[i]:]=np.maximum(dp[w[i]:],dp[:W-w[i]+1]+v[i])
print(dp.max())

Buggy submission (verdict: Runtime Error):
#include<stdio.h>
int max(int a,int b){
    int h=a;
    if(b>a)h=b;
    return h;
}
int set(int n,int w[],int v[],int W){
    if(n==0){
        return 0;
    }else if(w[n-1]>W){
        return set(n-1,w,v,W);
    }else{
        return max(set(n-1,w,v,W),set(n-1,w,v,W-w[n-1])+v[n-1]);
    }
}
int main(void){
    int N,W;
    scanf("%d%d",&N,&W);
    int v[N],w[N];
    for(int i=0;i<N;i++){
        scanf("%d%d",&v[i],&w[i]);
    }
    printf("%d\n",set(N,w,v,W));
    return 0;
}
Problem p03164 (python)

Fixed submission:
import numpy as np
n,w = [int(x) for x in input().split()]
wv = np.array([[int(y) for y in input().split()] for z in range(n)],dtype=int)
sum_wv = np.sum(wv,axis=0)
sum_v = sum_wv[1]
sum_w = sum_wv[0]
dp = np.full(sum_v+1,sum_w,dtype="int")
dp[0] = 0
for wei,val in wv:
    dp[val:] = np.minimum(dp[val:],dp[:-val]+wei)
for p in range(sum_v,1,-1):
    if(dp[p] <= w):
        print(p)
        break

Buggy submission (verdict: Runtime Error):
import numpy as np
MaxW=int(1e5)
N,W=map(int,input().split())
WV=[]
for i in range(N):
    WV.append(list(map(int,input().split())))
dp=[1e30 for i in range(MaxW+1)]
dp[0]=0
dp=np.array(dp)
for i in range(N):
    dp[WV[i][1]:]=np.minimum(dp[WV[i][1]:],dp[:MaxW-WV[i][1]+1]+WV[i][0])
for i in reversed(range(MaxW+1)):
    if dp[i]<=W:
        print(i)
        break

Buggy submission (verdict: Runtime Error):
import numpy as np
N,W=map(int,input().split())
w=[0 for i in range(N)]
v=[0 for i in range(N)]
for i in range(N):
    w[i],v[i]=map(int,input().split())
total_v=sum(v)
INF=100000000
dp=[INF for i in range(total_v+1)]
dp[0]=0
dp=np.array(dp)
for i in range(N):
    dp[v[i]:]=np.minimum(dp[v[i]:],dp[:total_v-v[i]+1]+w[i])
for i inrange(sum(v)):
    if dp[i]<=W:
        print(i)
        break
Problem p03165 (python)

Fixed submission:
S=input()
T=input()
dp=[[0 for j in range(len(T)+1)] for i in range(len(S)+1)]
for i in range(len(S)):
    for j in range(len(T)):
        if S[i]==T[j]:
            dp[i+1][j+1]=dp[i][j]+1
        dp[i+1][j+1]=max(dp[i+1][j+1],dp[i+1][j])
        dp[i+1][j+1]=max(dp[i+1][j+1],dp[i][j+1])
i=len(S)
j=len(T)
ans=""
while i>0 and j>0:
    if dp[i][j]==dp[i-1][j]:
        i-=1
    elif dp[i][j]==dp[i][j-1]:
        j-=1
    else:
        ans=S[i-1]+ans
        i-=1
        j-=1
print(ans)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
d=[[] for i in range(N)]
for i in range(M):
    x,y=map(int,input().split())
    d[x-1].append(y-1)
scores=[]
def depth(now,score):
    global scores
    if d[now]:
        for i in d[now]:
            depth(i,score+1)
    else:
        scores.append(score)
Max=0
for i in range(N):
    depth(i,0)
    if scores and max(scores)>Max:
        Max=max(scores)
    scores.clear()
print(Max)

Buggy submission (verdict: Runtime Error):
s=str(input())
t=str(input())
Ns=len(s)
Nt=len(t)
dp=[["" for i in range(Nt+1)]for j in range(Ns+1)]
for i in range(1,Ns+1):
    for j in range(1,Nt+1):
        if s[i-1]==t[j-1]:
            dp[i][j]=dp[i-1][j-1]+s[i-1]
        else:
            if len(dp[i][j-1])>len(dp[i-1][j]):
                dp[i][j]=dp[i][j-1]
            else:
                dp[i][j]=dp[i-1][j]
print(dp[Ns][Nt])

Buggy submission (verdict: Runtime Error):
def lcs(s1, s2):
    dp = []
    for s2_k in s2:
        bgn_idx = 0
        for i, cur_idx in enumerate(dp):
            chr_idx = s1.find(s2_k, bgn_idx) + 1
            if not chr_idx:
                break
            dp[i] = min(cur_idx, chr_idx)
            bgn_idx = cur_idx
        else:
            chr_idx = s1.find(s2_k, bgn_idx) + 1
            if chr_idx:
                dp.append(chr_idx)
    return len(dp)

def solve():
    N = int(input())
    for _ in range(N):
        x = input()
        y = input()
        print(lcs(x, y))

if __name__ == '__main__':
    solve()

Buggy submission (verdict: Runtime Error):
S=input()
T=input()
s=len(S)
t=len(T)
dp=[['' for i in range(s+1)] for j in range(t+1)]
for i in range(s):
    for j in range(t):
        if S[i]==T[j]:
            dp[i+1][j+1]=dp[i][j]+S[i]
        else:
            dp[i+1][j+1]=dp[i+1][j]
            if len(dp[i][j+1])>len(dp[i+1][j]):
                dp[i+1][j+1]=dp[i][j+1]
print(dp[s][t])

Buggy submission (verdict: Runtime Error):
S=input()
T=input()
s=len(S)
t=len(T))
dp=[['' for i in range(T+1)] for j in range(T+1)]
for i in range(S):
    for j in range(T):
        if s[i]==t[j]:
            dp[i+1][j+1]=dp[i][j]+s[i]
        else:
            dp[i+1][j+1]=dp[i+1][j]
            if len(dp[i][j+1])>len(dp[i+1][j]):
                dp[i+1][j+1]=dp[i][j+1]
print(dp[S][T])
Problem p03238 (python)

Fixed submission:
N=int(input())
if N==1:
    print('Hello World')
else:
    A=int(input())
    B=int(input())
    print(A+B)

Buggy submission (verdict: Runtime Error):
N=int(input())
if N==1:
  print('Hello World')
else:
  A,B=map(int,input().split())
  print(A+B)
Problem p03239 (python)

Fixed submission:
N,T=map(int,input().split())
a=[]
for i in range(N):
    c,t=map(int,input().split())
    if t<=T:
        a.append(c)
if len(a)==0:
    print('TLE')
else:
    a.sort()
    print(a[0])

Buggy submission (verdict: Runtime Error):
N,T=map(int,input().split())
a=[]
for i in range(N):
    c,t=map(int,input().split())
    if t<=T:
        a.append(c)
if len(a)==0:
    print('TLE')
else:
    a.sort()
    print(a[0][0])
Problem p03241 (python)

Fixed submission:
N,M=map(int,input().split())
a=M//N
x=1
for i in range(1,a+1):
    if M%i==0:
        x=i
        if (M//i)>i and (M//i)<=a:
            x=M//i
            break
print(x)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
a=M//N
x=0
  for i in reversed(range(2,a+1)):
    if M%i==0:
      x=i
      break
print(x)
Problem p03251 (python)

Fixed submission:
N,M,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
x.sort(reverse=True)
y.sort()
a=0
for z in range(X+1,Y+1):
    if z>x[0] and z<=y[0]:
        a=1
        break
if a==1:
    print('No War')
else:
    print('War')

Buggy submission (verdict: Runtime Error):
N,M,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
x.sort(reverse=True)
y.sort()
a=0
for z in range(X+1,Y+1):
    if z>x[0] and z<=y[0]:
        a=1
        break
if a=1:
    print('No War')
else:
    print('War')
Problem p03292 (python)

Fixed submission:
A=list(map(int,input().split()))
A.sort()
print(A[2]-A[0])

Buggy submission (verdict: Runtime Error):
A=int(input())
A.sort()
print(A[2]-A[0])
Problem p02628 (python)

Fixed submission:
n, k = map(int, input().split())
p = list(map(int,input().split()))
p = sorted(p, key = int)
print(sum(p[:k]))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
p - list(map(int, input().split()))

p = sorted(p, key = int)
print(sum(p[:2]))
Problem p02606 (python)

Fixed submission:
L,R,d=list(map(int,(input().split())))
if (L==d):
  print(R//d-L//d+1)
elif L==R and L!=d:
  print(1)
else:
  print(R//d-L//d)

Buggy submission (verdict: Runtime Error):
L,R,d=list(map(int,(input().split())))
if ((R//d-L//d)==99):
  print(100)
elif(((R//d-L//d)==0))
  print(1)
else:
  print(R//d-L//d)
Problem p02618 (python)

Fixed submission:
D=int(input())
c=list(map(int,(input().split())))
s=[]
t=[]
last=[0]*26
sat=0
  
for i in range(D):
  s.append(list(map(int,(input().split()))))
  sat+=max(s[i])
  ans=s[i].index(max(s[i]))+1
  t.append(ans)
  print(ans)

Buggy submission (verdict: Runtime Error):
D=int(input())
c=list(map(int,(input().split())))
s=[]
t=[]
last=[0]*26
sat=0
for _ in range(D):
  s.append(list(map(int,(input().split()))))


for i in range(D):
  sat+=max(s[i])
  t.append(s[i].index(max(s[i]))+1)
  for j in range(26):
    sat-=c[i]*(1-last[j])
  
for ans in t:
  print(ans)

Buggy submission (verdict: Runtime Error):
D=int(input())
c=list(map(int,(input().split())))
s=[]
t=[]
last=[0]*26
sat=0
for _ in range(D):
  s.append(list(map(int,(input().split()))))
for _ in range(D):
  t.append(int(input()))

for i in range(D):
  sat+=max(s[i])
  for j in range(26):
    sat-=c[i]*(1-last[j])
  print(sat)
Problem p02690 (python)

Fixed submission:
X=int(input())
ans=[]
for i in range(1,1000):
  for j in range(-1000,1000):
    if((i**5)-(j**5)==X):
      ans.append((str(i)+" "+str(j)))
print(ans[0])

Buggy submission (verdict: Runtime Error):
X=int(input())
ans=[]
for i in range(-100,100):
  for j in range(-100,100):
    if((i**5)-(j**5)==X):
      ans.append((str(i)+" "+str(j)))
print(ans[0])
Problem p02705 (python)

Fixed submission:
R = int(input())
print(R*2*3.1415)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))
buka_num=[0 for _ in range(N+1)]

for i in a:
  buka_num[i]+=1
buka_num.pop(0)
for j in buka_num:
  print(j)
Problem p02730 (python)

Fixed submission:
S=input()
N=len(S)
T=S[:N//2]
U=S[N//2+1:]

flg=0

for i in range(int((N-1)/2)):
  if(S[i]!=S[-i-1]):
    flg=1
    break
  
for j in range(len(T)//2):
  if(T[j]!=T[-j-1]):
    flg=1
    break
  
for k in range(len(U)//2):
  if(U[k]!=U[-k-1]):
    flg=1
    break

if(flg==0):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
S=input()
T=S[:N//2]
U=S[N//2+1:]
N=len(S)
flg=0

for i in range(int((N-1)/2)):
  if(S[i]!=S[-i-1]):
    print(S[i],S[-i])
    flg=1
    break
  
for j in range(len(T)//2):
  if(T[j]!=T[-j-1]):
    flg=1
    break
  
for k in range(len(U)//2):
  if(U[k]!=U[-k-1]):
    flg=1
    break

if(flg==0):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
S=input()
T=S[:N//2]
U=S[N//2+1:]
N=len(S)
flg=0
for i in range(int((N-1)/2)):
  if(S[i]!=S[-i]):
    break
  flg+=1

for j in range(len(T)//2):
  if(T[j]!=T[-j]):
    break
  flg+=1

for k in range(len(U)//2):
  if(U[k]!=U[-k]):
    break
  flg+=1

if(flg==3):
  print("Yes")
else:
  print("No")