Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N, M, L = map(int,input().split())
MAX=999999999
A=[]
B=[]
C=[]
D=[[MAX for _ in range(N)] for _ in range(N)]
F=[[MAX for _ in range(N)] for _ in range(N)]
s=[]
t=[]
 
for i in range(M):
    l=list(map(int,input().split()))
    A.append(l[0]-1)
    B.append(l[1]-1)
    C.append(l[2])
 
 
 
Q=int(input())
 
for i in range(Q):
    m=list(map(int,input().split()))
    s.append(m[0]-1)
    t.append(m[1]-1)
 
 
for i in range(M):
    if C[i]>L : continue
    D[A[i]][B[i]]=C[i]
    D[B[i]][A[i]]=C[i]
 
for i in range(N):  D[i][i]=0
 
for k in range(N):
    for i in range(N):
        for j in range(N):
            if (D[i][k]+D[k][j])<D[i][j] :
                D[i][j]=D[i][k]+D[k][j]
 
for i in range(N):
    for j in range(N):
        if i==j : continue
        if D[i][j]<=L: F[i][j]=1
 
 
for i in range(N):  F[i][i]=0
 
for k in range(N):
    for i in range(N):
        for j in range(N):
            if (F[i][k]+F[k][j])<F[i][j] :
                F[i][j]=F[i][k]+F[k][j]
 
 
for p in range(Q) :
    if F[s[p]][t[p]] < MAX :
        print(F[s[p]][t[p]]-1)
    else :
        print(-1)

Fixed submission:
A,B=map(int,input().split())
if A>=2*B:
    Ans = A-(2*B)
else:
    Ans=0
print(Ans)
Buggy python submission (verdict: Runtime Error):
N=int(input())
d=[0]*N
d=map(int,input().sort())
res=0

for i in range(N-1):
    for j in range(N-i):
        res+=d[i]*d[j]

print(res)

Fixed submission:
N=int(input())
d=list(map(int,input().split()))
res=0

for i in range(N-1):
    for j in range(N-i-1):
        #d[i+1]~d[N-1]
        res+=d[i]*d[i+j+1]


print(res)
Buggy python submission (verdict: Runtime Error):
N=int(input())
S=input()
S_list=[]
for i in S:
    S_list.append(i)
set(S_list)
print(lens(S_list))


Fixed submission:
N=int(input())
S=input()
S_list=[]
count = 0
j=''

for i in S:
    count +=1
    if (count>=2) & (i==j): continue
    else:
        S_list.append(i)
        j=i

print(len(S_list))
Buggy python submission (verdict: Time Limit Exceeded):
N, M, L = map(int,input().split())
MAX=999999999
A=[]
B=[]
C=[]
D=[[MAX for _ in range(N)] for _ in range(N)]
F=[[MAX for _ in range(N)] for _ in range(N)]
s=[]
t=[]

for i in range(M):
    l=list(map(int,input().split()))
    A.append(l[0]-1)
    B.append(l[1]-1)
    C.append(l[2])



Q=int(input())

for i in range(Q):
    m=list(map(int,input().split()))
    s.append(m[0]-1)
    t.append(m[1]-1)


for i in range(M):
    if C[i]>L : continue
    D[A[i]][B[i]]=C[i]
    D[B[i]][A[i]]=C[i]

for i in range(N):  D[i][i]=0

for k in range(N):
    for i in range(N):
        for j in range(N):
            if (D[i][k]+D[k][j])<D[i][j] :
                D[i][j]=D[i][k]+D[k][j]

for i in range(N):
    for j in range(N):
        if i==j : continue
        if D[i][j]<=L: F[i][j]=1


for i in range(N):  F[i][i]=0

for k in range(N):
    for i in range(N):
        for j in range(N):
            if (F[i][k]+F[k][j])<F[i][j] :
                F[i][j]=F[i][k]+F[k][j]


for p in range(Q) :
    if F[s[p]][t[p]] < MAX :
        print(F[s[p]][t[p]]-1)
    else :
        print(-1)

Fixed submission:
N, M, L = map(int,input().split())
MAX=99999999999
A=[]
B=[]
C=[]
D=[[MAX for _ in range(N)] for _ in range(N)]
F=[[MAX for _ in range(N)] for _ in range(N)]
s=[]
t=[]
 
for i in range(M):
    l=list(map(int,input().split()))
    A.append(l[0]-1)
    B.append(l[1]-1)
    C.append(l[2])
 
 
 
Q=int(input())
 
for i in range(Q):
    m=list(map(int,input().split()))
    s.append(m[0]-1)
    t.append(m[1]-1)
 
 
for i in range(M):
    if C[i]>L : continue
    D[A[i]][B[i]]=C[i]
    D[B[i]][A[i]]=C[i]
 
for i in range(N):  D[i][i]=0
 
for k in range(N):
    for i in range(N):
        for j in range(N):
            if (D[i][k]+D[k][j])<D[i][j] :
                D[i][j]=D[i][k]+D[k][j]
 
for i in range(N):
    for j in range(N):
        if i==j : continue
        if D[i][j]<=L: F[i][j]=1
 
 
for i in range(N):  F[i][i]=0
 
for k in range(N):
    for i in range(N):
        for j in range(N):
            if (F[i][k]+F[k][j])<F[i][j] :
                F[i][j]=F[i][k]+F[k][j]
 
 
for p in range(Q) :
    if F[s[p]][t[p]] < MAX :
        print(F[s[p]][t[p]]-1)
    else :
        print(-1)
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
h=list(map(int, input().split()))
h.sort(reverse=True)

for i in range(N):
    if h[i]<K :
        Ans=i
        break

print(Ans)

Fixed submission:
N,K=map(int,input().split())
h=list(map(int, input().split()))
h.sort(reverse=True)
Ans=N
for i in range(N):
    if h[i]<K :
        Ans=i
        break

print(Ans)
Buggy python submission (verdict: Runtime Error):

r=input()
print(r**2)

Fixed submission:
r=int(input())
print(r**2)
Buggy python submission (verdict: Runtime Error):
s=input()
t=input()

x=list(s)
y=list(t)
import sys
if len(set(y)-set(x))!=0:
	print(-1)
	sys.exit()

a=[[] for _ in range(26)]
for i in range(len(s)):
	a[ord(x[i])-97].append(i)



import bisect
#t=bisect.bisect_right(res[p-1],y)

repeat=0
last=0
for i in range(len(t)):
	temp=a[ord(y[i])-97]
	if last>=temp[-1]:
		repeat+=1
		last=temp[0]
	else:
		last=temp[bisect.bisect_right(temp,last)]
	print(temp,repeat,last)
print(repeat*len(s)+last+1)

Fixed submission:
s=input()
t=input()
x=list(s)
y=list(t)
import sys
if len(set(y)-set(x))!=0:
	print(-1)
	sys.exit()
a=[[] for _ in range(26)]
for i in range(len(s)):
	a[ord(x[i])-97].append(i)
import bisect

repeat=0
last=-1
for i in range(len(t)):
	temp=a[ord(y[i])-97]
	if last>=temp[-1]:
		repeat+=1
		last=temp[0]
	else:
		last=temp[bisect.bisect_right(temp,last)]
	#print(temp,repeat,last)
print(repeat*len(s)+last+1)

Buggy python submission (verdict: Runtime Error):
s=input()
t=input()

x=list(s)
y=list(t)
import sys
if len(set(y)-set(x))!=0:
	print(-1)
	sys.exit()

a=[[] for _ in range(26)]
for i in range(len(s)):
	a[ord(x[i])-97].append(i)



import bisect
#t=bisect.bisect_right(res[p-1],y)

repeat=0
last=0
for i in range(len(t)):
	temp=a[ord(y[i])-97]
	if last>max(temp):
		repeat+=1
		last=min(temp)
	else:
		last=temp[bisect.bisect_right(temp,last)]
	#print(temp,repeat,last)
print(repeat*len(s)+last+1)

Fixed submission:
s=input()
t=input()
x=list(s)
y=list(t)
import sys
if len(set(y)-set(x))!=0:
	print(-1)
	sys.exit()
a=[[] for _ in range(26)]
for i in range(len(s)):
	a[ord(x[i])-97].append(i)
import bisect

repeat=0
last=-1
for i in range(len(t)):
	temp=a[ord(y[i])-97]
	if last>=temp[-1]:
		repeat+=1
		last=temp[0]
	else:
		last=temp[bisect.bisect_right(temp,last)]
	#print(temp,repeat,last)
print(repeat*len(s)+last+1)
Buggy python submission (verdict: Time Limit Exceeded):
#57 ABC137E
#ベルマンフォード

n,m,p=map(int,input().split())

abc=[list(map(int,input().split())) for _ in range(m)]
abc=[[a,b,p-c] for a,b,c in abc]
def BF(edges,num_v,source):
    #グラフの初期化
    inf=float("inf")
    dist=[inf for i in range(num_v)]
    dist[source-1]=0
  
    #辺の緩和
    neg=[False for _ in range(num_v)]
    for i in range(num_v-1):
        for edge in edges:
            if edge[0] != inf and dist[edge[1]-1] > dist[edge[0]-1] + edge[2]:
                dist[edge[1]-1] = dist[edge[0]-1] + edge[2]
    for i in range(num_v):
        for edge in edges:
            if edge[0] != inf and dist[edge[1]-1] > dist[edge[0]-1] + edge[2]:
                dist[edge[1]-1] = dist[edge[0]-1] + edge[2]
                neg[edge[1]-1]=True
            if neg[edge[0]-1]==True:
                neg[edge[1]-1]=True
    return dist,neg
dis,neg=BF(abc,n,1)
print(-1 if neg[-1] else max(0,-dis[-1]))

Fixed submission:
#57 ABC137E
#ベルマンフォード

n,m,p=map(int,input().split())

abc=[list(map(int,input().split())) for _ in range(m)]
abc=[[a,b,p-c] for a,b,c in abc]
def BF(edges,num_v,source):
    #グラフの初期化
    inf=float("inf")
    dist=[inf for i in range(num_v)]
    dist[source-1]=0
  
    #辺の緩和
    neg=[False for _ in range(num_v)]
    for i in range(num_v-1):
        for edge in edges:
            if edge[0] != inf and dist[edge[1]-1] > dist[edge[0]-1] + edge[2]:
                dist[edge[1]-1] = dist[edge[0]-1] + edge[2]
    for i in range(num_v):
        for edge in edges:
            if edge[0] != inf and dist[edge[1]-1] > dist[edge[0]-1] + edge[2]:
                dist[edge[1]-1] = dist[edge[0]-1] + edge[2]
                neg[edge[1]-1]=True
            if neg[edge[0]-1]==True:
                neg[edge[1]-1]=True
    return dist,neg
dis,neg=BF(abc,n,1)
#print(dis,neg)
print(-1 if neg[-1] else max(0,-dis[-1]))
Buggy python submission (verdict: Runtime Error):
#56 ABC136E
n,k=map(int,input().split())
a=list(map(int,input().split()))
s=sum(a)

res=[]
for d in range(1,int(s**0.5)+1):
	if s%d==0:
		res.append(d)
		res.append(s//d)
ans=[]
for d in res:
	r1=[t%d for t in a]
	r1.sort()
	r2=[d-t for t in r1]
	r2=r2[::-1]
	x=[r1[0]]
	_=[x.append(x[-1]+r1[i]) for i in range(1,n)]
	y=[r2[0]]
	_=[y.append(y[-1]+r2[i]) for i in range(1,n)]
	#print(r1,r2,d,x,y)
	for i in range(n-1):
		#print(x[i],y[-i-2])
		if x[i]==y[-i-2] and x[i]<k:
			ans.append(d)
print(max(ans))

Fixed submission:
#56 ABC136E
n,k=map(int,input().split())
a=list(map(int,input().split()))
s=sum(a)

res=[]
for d in range(1,int(s**0.5)+1):
	if s%d==0:
		res.append(d)
		res.append(s//d)
ans=[]
for d in res:
	r1=[t%d for t in a]
	r1.sort()
	r2=[(d-t)%d for t in r1]
	r2=r2[::-1]
	x=[r1[0]]
	_=[x.append(x[-1]+r1[i]) for i in range(1,n)]
	y=[r2[0]]
	_=[y.append(y[-1]+r2[i]) for i in range(1,n)]
	#print(r1,r2,d,x,y)
	for i in range(n-1):
		#print(x[i],y[-i-2])
		if x[i]==y[-i-2] and x[i]<=k:
			ans.append(d)
			break
print(max(ans))
Buggy python submission (verdict: Time Limit Exceeded):
#45 ABC135D 桁DP
s=input()
n=len(s)
dp=[[0 for _ in range(13)] for _ in range(n+1)]
dp[0][0]=1
for i in range(n):
	if s[i]=="?":
		c=-1
	else:
		c=int(s[i])
	for j in range(10):
		if c!=-1 and c!=j:
			continue
		for ki in range(13):
			dp[i+1][(ki*10+j)%13]+=dp[i][ki]
	#for j in range(13):
		#dp[i+1][j]%=(10**9+7)
print(dp[n][5]%(10**9+7))

Fixed submission:
#45 ABC135D 桁DP
s=input()
n=len(s)
dp=[[0 for _ in range(13)] for _ in range(n+1)]
dp[0][0]=1
for i in range(n):
	if s[i]=="?":
		c=-1
	else:
		c=int(s[i])
	for j in range(10):
		if c!=-1 and c!=j:
			continue
		for ki in range(13):
			dp[i+1][(ki*10+j)%13]+=dp[i][ki]
	for j in range(13):
		dp[i+1][j]%=(10**9+7)
print(dp[n][5]%(10**9+7))
Buggy python submission (verdict: Runtime Error):
#43 ABC134D
n=int(input())
a=list(map(int,input().split()))
x=[0 for _ in range(n)]
for i in range(n,0,-1):
	x[i-1]=sum([a[j] for j in range(i-1,n,i)])%2
j=True
for i in range(a):
	if a[i]!=sum([a[j] for j in range(i,n,i+1)])%2:
		j=False
if j:
	print(sum(x))
	if sum(x)!=0:
		res=[]
		for i,t in enumerate(x):
			if t==1:
				res.append(str(i+1))
		print(" ".join(res))
else:
	print(-1)

Fixed submission:
#43 ABC134D
n=int(input())
a=list(map(int,input().split()))
x=[0 for _ in range(n)]
for i in range(n,0,-1):
	x[i-1]=1 if a[i-1]!=sum([x[j] for j in range(i-1,n,i)])%2 else 0
#print(x)
j=True
for i in range(n):
	if a[i]!=sum([x[j] for j in range(i,n,i+1)])%2:
		j=False
if j:
	print(sum(x))
	if sum(x)!=0:
		res=[]
		for i,t in enumerate(x):
			if t==1:
				res.append(str(i+1))
		print(" ".join(res))
else:
	print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
#54 ABC134E

n=int(input())
a=[int(input()) for _ in range(n)]

import heapq
i=0
heap=[-a[0]]
res=[]
import bisect
for i in range(1,n):
	t=bisect.bisect_right(heap,-a[i])
	if t==0:
		heapq.heapreplace(heap,-a[i])
	elif t>=len(heap):
		heapq.heappush(heap,-a[i])
	else:
		heap[t]=-a[i]
		heapq.heapify(heap)

	#print(heap,t)
print(len(heap))

Fixed submission:
#54 ABC134E

n=int(input())
a=[int(input()) for _ in range(n)]

def LIS(L):
    from bisect import bisect
    seq=[]
    for i in L:
        pos=bisect(seq,-i)
        if len(seq)<=pos:
            seq.append(-i)
        else:
            seq[pos]=-i
    return len(seq)

print(LIS(a))
Buggy python submission (verdict: Runtime Error):
#41 ABC132D
n,k=map(int,input().split())

c=[[0 for i in range(j+1)] for j in range(n+1)]
c[0][0]=1
for i in range(1,n+1):
	for j in range(i+1):
		if j==0:
			c[i][j]=c[i-1][j]
		elif j==i:
			c[i][j]=c[i-1][j-1]
		else:
			c[i][j]=c[i-1][j]+c[i-1][j-1]
for i in range(1,k+1):
	print(c[n-k+1][i]*c[k-1][i-1]%(10**9+7))

Fixed submission:
#41 ABC132D
n,k=map(int,input().split())

c=[[0 for i in range(j+1)] for j in range(n+1)]
c[0][0]=1
for i in range(1,n+1):
	for j in range(i+1):
		if j==0:
			c[i][j]=c[i-1][j]
		elif j==i:
			c[i][j]=c[i-1][j-1]
		else:
			c[i][j]=c[i-1][j]+c[i-1][j-1]
for i in range(1,k+1):
	try:
		print(c[n-k+1][i]*c[k-1][i-1]%(10**9+7))
	except:
		print(0)
Buggy python submission (verdict: Runtime Error):
#36 ABC127D
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
bc=[list(map(int,input().split())) for _ in range(m)]
bc=sorted(bc, key=lambda x:-x[1])

i=0
for b,c in bc:
	while(a[i]<c and b>0 and i<n):
		a[i]=c
		b-=1
		i+=1
print(sum(a))

Fixed submission:
#36 ABC127D
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
bc=[list(map(int,input().split())) for _ in range(m)]
bc=sorted(bc, key=lambda x:-x[1])

i=0
for b,c in bc:
	while(i<n and a[i]<c and b>0):
		a[i]=c
		b-=1
		i+=1
print(sum(a))

Buggy python submission (verdict: Runtime Error):
#36 ABC127D
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
bc=[list(map(int,input().split())) for _ in range(m)]
bc=sorted(bc, key=lambda x:-x[1])

i=0
for b,c in bc:
	if i==n:
		break
	while(a[i]<c and b>0):
		a[i]=c
		b-=1
		i+=1
print(sum(a))

Fixed submission:
#36 ABC127D
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
bc=[list(map(int,input().split())) for _ in range(m)]
bc=sorted(bc, key=lambda x:-x[1])

i=0
for b,c in bc:
	while(i<n and a[i]<c and b>0):
		a[i]=c
		b-=1
		i+=1
print(sum(a))
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
a.sort()
a=a[::-1]
res=[a[0]]
for i in range(1,n):
    for t in res:
        x=gcd(t,a[i])
        if x!=t:
            res.append(x)
res.sort()
print(res[1])

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
a.sort()
x=[a[0]]
for i in range(1,n):
    x.append(gcd(x[-1],a[i]))
y=[a[-1]]
for i in range(2,n+1):
    y.append(gcd(y[-1],a[-i]))
y=y[::-1]
res=[x[-2],y[1]]
for i in range(n-2):
    res.append(gcd(x[i],y[i+2]))
print(max(res))
Buggy python submission (verdict: Runtime Error):
n=int(input())
c=[int(input()) for _ in range(n)]
x=[c[0]]
for i in range(1,n):
    if c[i]!=c[i-1]:
        x.append(c[i])
#print(x)

dp=[0 for _ in range(n)]
res=[[] for _ in range(max(x)+1)]
res[x[0]].append(0)
res2=[0 for _ in range(max(x)+1)]
for i in range(1,len(x)):
    if len(res[x[i]])>0:
        if res[x[i]][-1]==0:#左端スタートで１つ目の場合
            dp[i]=dp[i-1]+1
        else:
            dp[i]=dp[i-1]+len(res[x[i]])+res2[res[x[i]][-1]-1]
    else:
        dp[i]=dp[i-1]
    res[x[i]].append(i)
    res2[x[i-1]]+=dp[i-1]
    #print(dp,res2)
print((dp[len(x)-1]+1)%(10**9+7))
#print(res)

Fixed submission:
n=int(input())
c=[int(input()) for _ in range(n)]
x=[c[0]]
for i in range(1,n):
    if c[i]!=c[i-1]:
        x.append(c[i])
#print(x)

dp=[0 for _ in range(n)]
res=[[] for _ in range(max(x)+1)]
res[x[0]].append(0)
res2=[0 for _ in range(max(x)+1)]
for i in range(1,len(x)):
    if len(res[x[i]])>0:
        if res[x[i]][-1]==0:#左端スタートで１つ目の場合
            dp[i]=dp[i-1]+1
        else:
            dp[i]=dp[i-1]+len(res[x[i]])+res2[x[i]]
            #print(res2[x[i]])
    else:
        dp[i]=dp[i-1]
    res[x[i]].append(i)
    res2[x[i]]+=dp[i-1]
    #print(dp,res2)
print((dp[len(x)-1]+1)%(10**9+7))
#print(res)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
c=[int(input()) for _ in range(n)]
x=[c[0]]
for i in range(1,n):
    if c[i]!=c[i-1]:
        x.append(c[i])
#print(x)

dp=[0 for _ in range(n)]
res=[[] for _ in range(max(x)+1)]
res[x[0]].append(0)
for i in range(1,len(x)):
    if len(res[x[i]])>0:
        if res[x[i]][-1]==0:#左端スタートで１つ目の場合
            dp[i]=dp[i-1]+1
        else:
            dp[i]=dp[i-1]+len(res[x[i]])
            for t in res[x[i]]:
                if t>0:
                    dp[i]+=dp[t-1]
    else:
        dp[i]=dp[i-1]
    res[x[i]].append(i)
#print(dp)
print((dp[len(x)-1]+1)%(10**9+7))
#print(res)

Fixed submission:
n=int(input())
c=[int(input()) for _ in range(n)]
x=[c[0]]
for i in range(1,n):
    if c[i]!=c[i-1]:
        x.append(c[i])
#print(x)

dp=[0 for _ in range(n)]
res=[[] for _ in range(max(x)+1)]
res[x[0]].append(0)
res2=[0 for _ in range(max(x)+1)]
for i in range(1,len(x)):
    if len(res[x[i]])>0:
        if res[x[i]][-1]==0:#左端スタートで１つ目の場合
            dp[i]=dp[i-1]+1
        else:
            dp[i]=dp[i-1]+len(res[x[i]])+res2[x[i]]
            #print(res2[x[i]])
    else:
        dp[i]=dp[i-1]
    res[x[i]].append(i)
    res2[x[i]]+=dp[i-1]
    #print(dp,res2)
print((dp[len(x)-1]+1)%(10**9+7))
#print(res)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
x=list(map(int,input().split()))
x.sort()
y=[x[i+1]-x[i] for i in range(m-1)]
y.sort()
if n<m:
    print(sum(y[:m-n]))
else:
    print(0)

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
if max(l)<sum(l)-max(l):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n,t=map(int,input().split())
ct=[list(map(int,input().split())) for _ in range(n)]
mc=100000
for i in range(n):
    if ct[i][1]<=t:
        if ct[i][0]<mc:
            mc=ct[i][0]
if mi==-1:
    print("TLE")
else:
    print(mc)

Fixed submission:
n,t=map(int,input().split())
ct=[list(map(int,input().split())) for _ in range(n)]
mc=100000
for i in range(n):
    if ct[i][1]<=t:
        if ct[i][0]<mc:
            mc=ct[i][0]
if mc==100000:
    print("TLE")
else:
    print(mc)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
xyh=[list(map(int,input().split())) for _ in range(n)]
hs=[xyh[i][-1] for i in range(n)]
mh=min(hs)
if mh==0:
    mh=1
for cx in range(101):
    for cy in range(101):
        for h in range(mh,mh+201):
            j=True
            for i in range(n):
                if max(h-abs(xyh[i][0]-cx)-abs(xyh[i][1]-cy),0)!=xyh[i][2]:
                    j=False
            if j:
                print(cx,cy,h)
                break


Fixed submission:
n=int(input())
xyh=[list(map(int,input().split())) for _ in range(n)]
hs=[xyh[i][-1] for i in range(n)]
mh=max(hs)
if mh==0:
    mh=1
for cx in range(101):
    for cy in range(101):
        for h in range(mh,mh+101):
            j=True
            for i in range(n):
                if max(h-abs(xyh[i][0]-cx)-abs(xyh[i][1]-cy),0)!=xyh[i][2]:
                    j=False
            if j:
                print(cx,cy,h)
                break

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
xyh=[list(map(int,input().split())) for _ in range(n)]
hs=[xyh[i][-1] for i in range(n)]
mh=min(hs)
for cx in range(101):
    for cy in range(101):
        for h in range(mh,mh+101):
            j=True
            for i in range(n):
                if max(h-abs(xyh[i][0]-cx)-abs(xyh[i][1]-cy),0)!=xyh[i][2]:
                    j=False
            if j:
                print(cx,cy,h)
                break

Fixed submission:
n=int(input())
xyh=[list(map(int,input().split())) for _ in range(n)]
hs=[xyh[i][-1] for i in range(n)]
mh=max(hs)
if mh==0:
    mh=1
for cx in range(101):
    for cy in range(101):
        for h in range(mh,mh+101):
            j=True
            for i in range(n):
                if max(h-abs(xyh[i][0]-cx)-abs(xyh[i][1]-cy),0)!=xyh[i][2]:
                    j=False
            if j:
                print(cx,cy,h)
                break
Buggy python submission (verdict: Runtime Error):
import collections
def kaijo(x):
    a=1
    for i in range(1,x+1):
        a*=i
    return a
def perm(x,y):
    ans=1
    for i in range(x,x-y,-1):
        ans*=i
    return ans
def com(x,y):
    return perm(x,min(y,x-y))//kaijo(min(y,x-y))

nn,m=map(int,input().split())
x=primes(int(m**0.5+1))
y=[]
z=m
t=1
while(t**2<=m):
    t+=1
    while(z%t==0):
        y.append(t)
        z//=t
if len(y)==0 and m>1:
    y.append(m)
c=collections.Counter(y).values()
ans=1
mod=10**9+7
for t in c:
    ans*=com(t+nn-1,t)
    ans%=mod
print(ans)

Fixed submission:
import collections
def com(x,y):
    y=min(y,x-y)
    a=1
    for i in range(x,x-y,-1):
        a*=i
    b=1
    for i in range(1,y+1):
        b*=i
    return a//b
n,m=map(int,input().split())
y=[]
i=2
z=m
while(i*i<=m):
    if m%i:
        i+=1
    else:
        m//=i
        y.append(i)
if m>1:
    y.append(m)
c=collections.Counter(y).values()
ans=1
mod=10**9+7
for t in c:
    ans*=com(t+n-1,t)
    ans%=mod
print(ans)

Buggy python submission (verdict: Runtime Error):
import collections
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]
def kaijo(x):
    a=1
    for i in range(1,x+1):
        a*=i
    return a
def perm(x,y):
    ans=1
    for i in range(x,x-y,-1):
        ans*=i
    return ans
def com(x,y):
    return perm(x,min(y,x-y))//kaijo(min(y,x-y))

nn,m=map(int,input().split())
x=primes(int(m**0.5+1))
y=[]
z=m
for t in x:
    while(z%t==0):
        z//=t
        y.append(t)
c=list(collections.Counter(y).values())

ans=1
for t in c:
    ans*=com(t+nn-1,t)
    ans%=mod
print(ans)

Fixed submission:
import collections
def com(x,y):
    y=min(y,x-y)
    a=1
    for i in range(x,x-y,-1):
        a*=i
    b=1
    for i in range(1,y+1):
        b*=i
    return a//b
n,m=map(int,input().split())
y=[]
i=2
z=m
while(i*i<=m):
    if m%i:
        i+=1
    else:
        m//=i
        y.append(i)
if m>1:
    y.append(m)
c=collections.Counter(y).values()
ans=1
mod=10**9+7
for t in c:
    ans*=com(t+n-1,t)
    ans%=mod
print(ans)