Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
a,b=map(int,input().split())
for s in range(b//10000+1):
    try:
        for t in range(b//5000+1):
            for r in range(b//1000+1):
                if 10000*s+5000*t+1000*r==b and s+t+r==a:
                    print(s,t,r)
                    exit()
    except ZeroDivisionError:
        continue
print(-1,-1,-1)

Fixed submission:
a,b=map(int,input().split())
for s in range(b//10000+1):
    try:
        for t in range(b//5000+1):
            r=a-s-t
            if r<0:
                break
            if 10000*s+5000*t+1000*r==b and s+t+r==a:
                print(s,t,r)
                exit()
    except ZeroDivisionError:
        continue
print(-1,-1,-1)
Buggy python submission (verdict: Runtime Error):
*s,=map(int,open(0));print(-~sum(s)//2)

Fixed submission:
import math
a,b=map(int,input().split())
print(math.ceil((a+b)/2))

Buggy python submission (verdict: Runtime Error):
input();a=list(map(int,input().split()))
print(sum([a.count(i) if (i-a.count(i))>(a.count(i)-i) else abs(i-a.count(i)) for i in set(a)]))

Fixed submission:
import math
a,b=map(int,input().split())
print(math.ceil((a+b)/2))

Buggy python submission (verdict: Runtime Error):
s=sorted;print("NYoe s"[s(input())<s(input())[::-1]::2])

Fixed submission:
import math
a,b=map(int,input().split())
print(math.ceil((a+b)/2))
Buggy python submission (verdict: Runtime Error):
from collections import*;print(sum(min(abs(v-k),v)for k,v in Counter(map(int,open(0).read().split())[1:]).items()))

Fixed submission:
from collections import Counter
input();a=Counter(list(map(int,input().split())))
print(sum([v if k>v else v-k for k,v in a.items()]))

Buggy python submission (verdict: Time Limit Exceeded):
input();a,s=list(map(int,input().split())),0
for i in set(a):
  b=a.count(i)
  if i>b:s+=b
  else:s+=abs(i-b)
print(s)

Fixed submission:
from collections import Counter
input();a=Counter(list(map(int,input().split())))
print(sum([v if k>v else v-k for k,v in a.items()]))

Buggy python submission (verdict: Time Limit Exceeded):
input();a=list(map(int,input().split()))
print(sum([a.count(i) if (i-a.count(i))>(a.count(i)-i) else abs(i-a.count(i)) for i in set(a)]))

Fixed submission:
from collections import Counter
input();a=Counter(list(map(int,input().split())))
print(sum([v if k>v else v-k for k,v in a.items()]))

Buggy python submission (verdict: Time Limit Exceeded):
input();a=list(map(int,input().split()))
print(sum([a.count(i) if (i-a.count(i))>(a.count(i)-i) else abs(i-a.count(i)) for i in set(a)]))

Fixed submission:
from collections import Counter
input();a=Counter(list(map(int,input().split())))
print(sum([v if k>v else v-k for k,v in a.items()]))

Buggy python submission (verdict: Time Limit Exceeded):
input();a,s=list(map(int,input().split())),0
for i in set(a):
  b=a.count(i)
  if (i-b)>(b-i):s+=b
  else:s+=abs(i-b)
print(s)

Fixed submission:
from collections import Counter
input();a=Counter(list(map(int,input().split())))
print(sum([v if k>v else v-k for k,v in a.items()]))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import*
n,c=map(int,input().split())
d=defaultdict(list)
for s,t,r in sorted([tuple(map(int,input().split()))for i in range(n)],key=lambda x:x[0]):
    if len(d[r])>0:
        if d[r][-1][-1]==s:
            d[r].append((d[r].pop()[0],t))
        else:
            d[r].append((s,t))
    else:
        d[r].append((s,t))
di=[]
for i in d.values():
    di+=i
x=sorted(di,key=lambda x:x[0])
ans=0
bannpei=0
#print(x)
while len(x)>0:
    for s,t in x.copy():
        if bannpei+1<=s:
            x.remove((s,t))
            bannpei=t
#        print(bannpei)
    ans+=1
    bannpei=0
#    print(x)
print(ans)


Fixed submission:
n,c=map(int,input().split())
table=[[0]*10**5for i in range(c)]
for i in range(n):
    s,t,c=map(int,input().split())
    table[c-1][s-1:t]=[1]*(t-s+1)
print(max(map(sum,zip(*table))))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import*
n,c=map(int,input().split())
d=defaultdict(list)
for s,t,r in sorted([tuple(map(int,input().split()))for i in range(n)],key=lambda x:x[0]):
    if len(d[r])>0:
        if d[r][-1][-1]==s:
            d[r].append((d[r].pop()[0],t))
        else:
            d[r].append((s,t))
    else:
        d[r].append((s,t))
di=[]
for i in d.values():
    di+=i
x=sorted(di,key=lambda x:x[0])
ans=0
bannpei=0
#print(x)
while len(x)>0:
    for s,t in x.copy():
        if bannpei+1<=s:
            x.remove((s,t))
            bannpei=t
#        print(bannpei)
    ans+=1
    bannpei=0
#    print(x)
print(ans)

Fixed submission:
n,c=map(int,input().split())
table=[[0]*10**5for i in range(c)]
for i in range(n):
    s,t,c=map(int,input().split())
    table[c-1][s-1:t]=[1]*(t-s+1)
print(max(map(sum,zip(*table))))
Buggy python submission (verdict: Runtime Error):
a=input();print('YNeos'[2<len({*a})or a[1]!=a[2]::2]) #バージョンが違うせい最短（？

Fixed submission:
n=list(input());print("YNeos"[1-(n[0]==n[1]==n[2] or n[1]==n[2]==n[3])::2])

Buggy python submission (verdict: Runtime Error):
a=input();print('YNeos'[2<len({*a})or a[1]!=a[2]::2])

Fixed submission:
n=list(input());print("YNeos"[1-(n[0]==n[1]==n[2] or n[1]==n[2]==n[3])::2])
Buggy python submission (verdict: Runtime Error):
a,b,c,d=list(input());print("YNeos"[1-(a==b==c or b==c==d)::2])

Fixed submission:
a,b=input().split();print([[">","="][ord(a)==ord(b)],"<"][ord(a)<ord(b)])

Buggy python submission (verdict: Runtime Error):
X,Y=input().split();print("=><"[X>Y | -(X<Y)])

Fixed submission:
a,b=input().split();print([[">","="][ord(a)==ord(b)],"<"][ord(a)<ord(b)])

Buggy python submission (verdict: Runtime Error):
X,Y=input().split();print("=><"[X>Y |-(X<Y)])

Fixed submission:
a,b=input().split();print([[">","="][ord(a)==ord(b)],"<"][ord(a)<ord(b)])
Buggy python submission (verdict: Runtime Error):
x,y=input().split();print("=><"[(x>y)-(x<y)])

Fixed submission:
s=input()
t=input()
print("YES"if s==t[::-1] else "NO")
Buggy python submission (verdict: Time Limit Exceeded):
from bisect import*
from numpy import*
n=int(input())
a=sorted(map(int,input().split()))
b=sorted(map(int,input().split()))
c=sorted(map(int,input().split()))
#print(a,b,c)
#print([bisect_right(b,t)for t in a])
#print(cumsum([n-bisect_right(c,s)for s in b][::-1])[::-1])
ans=0
for i in [bisect_right(b,t)for t in a]:
    if i<n:
        ans+=cumsum([n-bisect_right(c,s)for s in b][::-1])[::-1][i]
print(ans)

Fixed submission:
from bisect import*
from numpy import*
n=int(input())
a=sorted(map(int,input().split()))
b=sorted(map(int,input().split()))
c=sorted(map(int,input().split()))
#print(a,b,c)
#print([bisect_right(b,t)for t in a])
#print(cumsum([n-bisect_right(c,s)for s in b][::-1])[::-1])
ans=0
x=cumsum([n-bisect_right(c,s)for s in b][::-1])[::-1]
y=[bisect_right(b,t)for t in a]
for i in y:
    if i<n:
        ans+=x[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
print(3**int(input())-2**sum(~int(s)%2for s in input().split()))

Fixed submission:
if "AC"in input():
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
print(3**int(input())-2**sum(~int(s)%2 for s in input().split()))

Fixed submission:
if "AC"in input():
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby accumulate
import sys
#input=sys.stdin.readline  #危険！基本オフにしろ！
sys.setrecursionlimit(10**6)



def main():
    n,k=map(int,input().split())
    grid=[tuple(map(int,input().split()))for i in range(n)]
    x=set(s for s,t in grid)
    y=set(t for s,t in grid)
    ans=[]
    for i in combinations(x,2):
        for j in combinations(y,2):
            xx=max(i)
            xxx=min(i)
            yy=max(j)
            yyy=min(j)
            if sum(xxx<=s<=xx and yyy<=t<=yy for s,t in grid)>=k:
                ans.append(abs((yy-yyy)*(xx-xxx)))
    print(min(ans))
if __name__ == '__main__':
    main()


Fixed submission:
a,b,c=map(int,input().split())
print(c if a==b else b if a==c else a)

Buggy python submission (verdict: Runtime Error):
from numpy import*
a,b=map(int,input().split())
c=["0"]*(b+2)
x=[list("0"+input().replace(".","0").replace("#","1")+"0")for i in range(a)]
x.insert(0,c)
x.append(c)
x=array(x).astype(int)
for s in range(1,1+a):
    tmp=""
    for t in range(1,1+b):
        if x[s][t]==1:
            tmp+="#"
        else:
            tmp+=str(sum(x[s-1:s+2,t-1:t+2]))
    print(tmp)

Fixed submission:
a,b,c=map(int,input().split())
print(c if a==b else b if a==c else a)
Buggy python submission (verdict: Runtime Error):
from numpy import*
a,b=map(int,input().split())
c=["0"]*(b+2)
x=[list("0"+input().replace(".","0").replace("#","1")+"0")for i in range(a)]
x.insert(0,c)
x.append(c)
x=array(x).astype(int)
for s in range(1,1+a):
    tmp=""
    for t in range(1,1+b):
        if x[s][t]==1:
            tmp+="#"
        else:
            tmp+=str(sum(x[s-1:s+2,t-1:t+2]))
    print(tmp)

Fixed submission:
from numpy import*
a,b=map(int,input().split())
c=["0"]*(b+2)
x=[list("0"+input().replace(".","0").replace("#","1")+"0")for i in range(a)]
x.insert(0,c)
x.append(c)
y=zeros((a+2,b+2))
x=array(x).astype(int)
for s in range(1,1+a):
    tmp=""
    for t in range(1,1+b):
        if x[s][t]==1:
            tmp+="#"
        else:
            tmp+=str(sum(x[s-1:s+2,t-1:t+2]))
    print(tmp)
Buggy python submission (verdict: Time Limit Exceeded):
s=int(input());
for n in range(3501):
 for h in range(3501):
  x=4*h*n-s*n-s*h
  if x>0:
   if ((s*h*n)/x).is_integer():
    print(int((s*h*n)/x),h,n)
    exit()

Fixed submission:
s=int(input());
for n in range(1,3501):
    for h in range(1,3501):
        x=4*h*n-s*n-s*h
        if x>0:
            if ((s*h*n)/x).is_integer():
                print(int((s*h*n)/x),h,n)
                exit()

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
m=3500
for I in range(1,m**2):
    n=I//m
    h=I%m
    A=N*h*n
    B=4*h*n-N*n-N*h
    if B<=0:
        continue
    if A%B==0:
        print(h,n,A//B)
        exit()

Fixed submission:
s=int(input());
for n in range(1,3501):
    for h in range(1,3501):
        x=4*h*n-s*n-s*h
        if x>0:
            if ((s*h*n)/x).is_integer():
                print(int((s*h*n)/x),h,n)
                exit()

Buggy python submission (verdict: Time Limit Exceeded):
s=int(input());
for n in range(1,3501):
    for h in range(1,3501):
        x=4*h*n-s*n-s*h
        if x>0:
            if ((s*h*n)/x).is_integer():
                print(int((s*h*n)/x),h,n)
                exit()

Fixed submission:
s=int(input());
for n in range(1,3501):
    for h in range(1,3501):
        x=4*h*n-s*n-s*h
        if x>0:
            if ((s*h*n)/x).is_integer():
                print(int((s*h*n)/x),h,n)
                exit()
Buggy python submission (verdict: Runtime Error):
print(input().scount("1"))

Fixed submission:
print(input().count("1"))
Buggy python submission (verdict: Runtime Error):
#n,*a=map(int,open(0).read().split())
b=[a[i]for i in range(0,len(a),2)]
c=[a[i]for i in range(1,len(a),2)]
print(max(b)+c[b.index(max(b))])

Fixed submission:
n,*a=map(int,open(0).read().split())
b=[a[i]for i in range(0,len(a),2)]
c=[a[i]for i in range(1,len(a),2)]
print(max(b)+c[b.index(max(b))])

Buggy python submission (verdict: Runtime Error):
n,*a=map(int,open(0).read().split())
b=[a[i]for i in range(0,len(a),2)]
c=[a[i]for i in range(1,len(a),2)]
print(max(b)+c[c.index(max(b))*2+1])

Fixed submission:
n,*a=map(int,open(0).read().split())
b=[a[i]for i in range(0,len(a),2)]
c=[a[i]for i in range(1,len(a),2)]
print(max(b)+c[b.index(max(b))])

Buggy python submission (verdict: Runtime Error):
n,*a=map(int,read(0).split())
b=max([a[i]for i in range(0,len(a),2)])
print(b+a[a.index(b)+1])

Fixed submission:
n,*a=map(int,open(0).read().split())
b=[a[i]for i in range(0,len(a),2)]
c=[a[i]for i in range(1,len(a),2)]
print(max(b)+c[b.index(max(b))])
Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split());print("NYoe s"[1in[k==(b-t)*s+t*(a-s)for t in range(b+1)for s in range(a+1)]::2])

Fixed submission:
if input()[:4]=="YAKI":
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

typedef vector<vector<int> > Matrix;

const int INF = 100000000;
Matrix d; // グラフの距離を格納した2次元配列（隣接行列）
Matrix D; // d[u][v]は辺e=(u,v)のコスト（辺が存在しない場合はINF、ただしd[i][i]=0）

void warshall_floyd(int n) { // nは頂点数
  for (int i = 0; i < n; i++)      // 経由する頂点
    for (int j = 0; j < n; j++)    // 開始頂点
      for (int k = 0; k < n; k++)  // 終端
        d[j][k] = min(d[j][k], d[j][i] + d[i][k]);
}




int main() {
  int n;
  cin >> n;

  d = Matrix(n, vector<int>(n, INF));
  D = Matrix(n, vector<int>(n, INF));
  for (int i = 0; i < n; i++) d[i][i] = 0;
  
  int tmp;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin>>tmp;
      d[i][j] = tmp;
      d[j][i] = tmp;
      D[i][j] = tmp;
      D[j][i] = tmp;
    }
  }
  
  warshall_floyd(n);
  
  int ans=100000000;
  tmp=0;
  
  if (D!=d){ cout<< -1 <<endl;
  }else{
      cout<<"1"<<endl;
      
      
  }
}


Fixed submission:
n=int(input())
a=int(input())
print(n**2-a)
Buggy python submission (verdict: Time Limit Exceeded):
from scipy.sparse.csgraph import shortest_path #shortest_path(csgraph=graph)
#from scipy.sparse.csgraph import dijkstra
from scipy.sparse import csr_matrix

from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby accumulate
from operator import mul,itemgetter
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial,pi
from copy import deepcopy
import sys
#input=sys.stdin.readline  #危険！基本オフにしろ！
sys.setrecursionlimit(10**8)


def main():
    n=int(input())
    grid=[list(map(int,input().split()))for i in range(n)]
    p=shortest_path(csgraph=csr_matrix(grid))
    q=[list(i) for i in p]
    
    if q!=grid:
        print(-1)
    else:
        for i in range(n):
            p[i][i]=float("inf")
        ans=0
        #print(p)
        for i in range(n):
            for j in range(i):
                if p[i][j]<min(p[i])+min(p[j]):
                    ans+=p[i][j]
        print(int(ans))




if __name__ == '__main__':
    main()

Fixed submission:
import numpy as np
#from numpy import*
#from scipy.sparse.csgraph import shortest_path #shortest_path(csgraph=graph)
#from scipy.sparse.csgraph import dijkstra
from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse import csr_matrix

from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby accumulate
from operator import mul,itemgetter
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial,pi
from copy import deepcopy
import sys
#input=sys.stdin.readline  #危険！基本オフにしろ！
sys.setrecursionlimit(10**8)

def main():
    n=int(input())
    grid=[list(map(int,input().split()))for i in range(n)]
    p=floyd_warshall(csgraph=csr_matrix(grid))
    q=[list(i) for i in p]
    
    if q!=grid:
        print(-1)
    else:
        for i in range(n):
            p[i][i]=float("inf")
        ans=0
        for i in range(n):
            for j in range(i):
                if i==j:
                    continue
                if p[i][j]<min(np.array(p[i])+np.array(p[j])):
                    
                    ans+=p[i][j]
        print(int(ans))

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
a,b,c,d,e,f=map(int,input().split())
maxsugar=f*e/(100+e)
maxwater=f*100/(100+e)
#print(maxsugar,maxwater)
sugar=[]
for i in range(int(maxsugar)//min(c,d)+2):
    for j in range(int(maxsugar)//min(c,d)+2):
        x=i*c+j*d
        if x<=maxsugar:
            sugar.append(x)
#print(sugar)
water=[]
for i in range(int(maxwater//100+2)//min(a,b)+1):
    for j in range(int(maxwater//100+2)//min(a,b)+1):
        y=i*a+j*b
        water.append(y)
#print(water)
water.remove(0)
ansl=[]
for i in sugar:
    for j in water:
        z=i/(j*100+i)
        xyz=i+j*100
        if xyz<=f and z<=e/(100+e):
            ansl.append((i,j,z))
s,t,r=sorted(ansl,key=lambda x:x[-1])[-1]
print(s+t*100,s)

Fixed submission:
a,b,c,d,e,f=map(int,input().split())
maxsugar=f*e/(100+e)
maxwater=f*100/(100+e)
#print(maxsugar,maxwater)
sugar=[]
for i in range(int(maxsugar)//min(c,d)+2):
    for j in range(int(maxsugar)//min(c,d)+2):
        x=i*c+j*d
        if x<=maxsugar:
            sugar.append(x)
#print(sugar)
water=[]
for i in range(int(maxwater//100+2)//min(a,b)+5):
    for j in range(int(maxwater//100+2)//min(a,b)+5):
        y=i*a+j*b
        water.append(y)
#print(water)
water.remove(0)
ansl=[]
for i in sugar:
    for j in water:
        z=i/(j*100+i)
        xyz=i+j*100
        if xyz<=f and z<=e/(100+e):
            ansl.append((i,j,z))
s,t,r=sorted(ansl,key=lambda x:x[-1])[-1]
print(s+t*100,s)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,d,e,f=map(int,input().split())
maxsugar=f*e/(100+e)
maxwater=f*100/(100+e)
#print(maxsugar,maxwater)
sugar=[]
for i in range(int(maxsugar)//min(c,d)+2):
    for j in range(int(maxsugar)//min(c,d)+2):
        x=i*c+j*d
        if x<=maxsugar:
            sugar.append(x)
#print(sugar)
water=[]
for i in range(int(maxwater//100+2)//min(a,b)+5):
    for j in range(int(maxwater//100+2)//min(a,b)+5):
        y=i*a+j*b
        water.append(y)
#print(water)
water.remove(0)
ansl=[]
for i in sugar:
    for j in water:
        z=i/(j*100+i)
        xyz=i+j*100
        if xyz<=f and z<=e/(100+e):
            ansl.append((i,j,z))
s,t,r=sorted(ansl,key=lambda x:x[-1])[-1]
print(s+t*100,s)

Fixed submission:
a,b,c,d,e,f=map(int,input().split())
maxsugar=f*e/(100+e)
maxwater=f*100/(100+e)
#print(maxsugar,maxwater)
sugar=[]
for i in range(int(maxsugar)//min(c,d)+2):
    for j in range(int(maxsugar)//min(c,d)+2):
        x=i*c+j*d
        if x<=maxsugar:
            sugar.append(x)
#print(sugar)
water=[]
for i in range(int(maxwater//100+2)//min(a,b)+5):
    for j in range(int(maxwater//100+2)//min(a,b)+5):
        y=i*a+j*b
        water.append(y)
#print(water)
water.remove(0)
ansl=[]
for i in sugar:
    for j in water:
        z=i/(j*100+i)
        xyz=i+j*100
        if xyz<=f and z<=e/(100+e):
            ansl.append((i,j,z))
s,t,r=sorted(ansl,key=lambda x:x[-1])[-1]
print(s+t*100,s)
Buggy python submission (verdict: Runtime Error):
#じゅっぴーフロイド
from collections import*
from itertools import*
def warshall_floyd(d):
    #d[i][j]: iからjへの最短距離
    for k in range(1,n+1):
        for i in range(1,n+1):
            for j in range(1,n+1):
                d[(i,j)] = min(d[(i,j)],d[(i,k)] + d[(k,j)])
    return d

##############################
n,w,r = map(int,input().split()) #n:頂点数　w:辺の数
d = defaultdict(lambda:float("inf"))
*r,=map(int,input().split())
#d[u][v] : 辺uvのコスト(存在しないときはinf)

for i in range(w):
    x,y,z = map(int,input().split())
    d[(x,y)] = z
    d[(y,x)] = z
#print(d)
for i in range(n):
    d[(i,i)] = 0 #自身のところに行くコストは０
d=warshall_floyd(d)
#print(d)
#print([d[i] for i in permutations(r)])
print(min(sum(d[(s,t)]for s,t in zip(i,i[1:]))for i in permutations(r)))

Fixed submission:
print("Yes" if "9" in list(input()) else "No")
Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
a=[[0 if s=="." else "#" for s in list(input())] for i in range(h)]
for _ in range(h):
  for s in range(w):
    if a[_][s]=="#":
      try:
        a[_-1][s]+=1
      except:
        continue
      try:
        a[_+1][s]+=1
      except:
        continue
      try:
        a[_][s-1]+=1
      except:
        continue
      try:
        a[_][s+1]+=1
      except:
        continue
      try:
        a[_+1][s+1]+=1
      except:
        continue
      try:
        a[_+1][s-1]+=1
      except:
        continue
      try:
        a[_-1][s+1]+=1
      except:
        continue
      try:
        a[_-1][s-1]+=1
      except:
        continue
    print(a)
for s in range(h):
  print(a[s])

Fixed submission:
n=int(input())
ans=0
for s in range(n):
  a,b=map(int,input().split())
  ans+=b-a+1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
#じゅっぴーフロイド
from collections import*
from itertools import*
def warshall_floyd(d):
    #d[i][j]: iからjへの最短距離
    for k in range(1,n+1):
        for i in range(1,n+1):
            for j in range(1,n+1):
                d[(i,j)] = min(d[(i,j)],d[(i,k)] + d[(k,j)])
    return d

##############################
n,w,r = map(int,input().split()) #n:頂点数　w:辺の数
d = defaultdict(lambda:float("inf"))
*r,=map(int,input().split())
#d[u][v] : 辺uvのコスト(存在しないときはinf)

for i in range(w):
    x,y,z = map(int,input().split())
    d[(x,y)] = z
    d[(y,x)] = z
#print(d)
for i in range(n):
    d[(i,i)] = 0 #自身のところに行くコストは０
d=warshall_floyd(d)
#print(d)
#print([d[i] for i in permutations(r)])
print(min(sum(d[(s,t)]for s,t in zip(i,i[1:]))for i in permutations(r)))

Fixed submission:
from itertools import*
from scipy.sparse.csgraph import floyd_warshall
n,m,r=map(int,input().split())
*R,=map(int,input().split())

table=[[0]*n for i in range(n)]
for i in range(m):
    a,b,c=map(int,input().split())
    table[a-1][b-1]=c
    table[b-1][a-1]=c
d,p=floyd_warshall(csgraph=table, directed=False, return_predecessors=True)
cost=[sum(d[i[j]-1][i[j+1]-1]for j in range(r-1))for i in permutations(R)]
print(int(min(cost)))

Buggy python submission (verdict: Time Limit Exceeded):
#じゅっぴーフロイド
from collections import*
from itertools import*
def warshall_floyd(d):
    #d[i][j]: iからjへの最短距離
    for k in range(1,n+1):
        for i in range(1,n+1):
            for j in range(1,n+1):
                d[(i,j)] = min(d[(i,j)],d[(i,k)] + d[(k,j)])
    return d

##############################
n,w,r = map(int,input().split()) #n:頂点数　w:辺の数
d = defaultdict(lambda:float("inf"))
*r,=map(int,input().split())
#d[u][v] : 辺uvのコスト(存在しないときはinf)

for i in range(w):
    x,y,z = map(int,input().split())
    d[(x,y)] = z
    d[(y,x)] = z
#print(d)
for i in range(n):
    d[(i,i)] = 0 #自身のところに行くコストは０
d=warshall_floyd(d)
#print(d)
#print([d[i] for i in permutations(r)])
print(min(sum(d[(s,t)]for s,t in zip(i,i[1:]))for i in permutations(r)))

Fixed submission:
from itertools import*
from scipy.sparse.csgraph import floyd_warshall
n,m,r=map(int,input().split())
*R,=map(int,input().split())

table=[[0]*n for i in range(n)]
for i in range(m):
    a,b,c=map(int,input().split())
    table[a-1][b-1]=c
    table[b-1][a-1]=c
d,p=floyd_warshall(csgraph=table, directed=False, return_predecessors=True)
cost=[sum(d[i[j]-1][i[j+1]-1]for j in range(r-1))for i in permutations(R)]
print(int(min(cost)))
Buggy python submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
b=Counter(a)
t=[]
for _ in b.most_common(100):
  t.append(len([i for i in a if _[0]-1<i<_[0]+3]))
  t.append(len([i for i in a if _[0]-2<i<_[0]+2]))
  t.append(len([i for i in a if _[0]-3<i<_[0]+1]))
print(max(t))

Fixed submission:
x,t=map(int,input().split())
print(x-t if x-t>0 else 0)

Buggy python submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
b=Counter(a)
t=[]
for _ in b.most_common(10):
  t.append(len([i for i in a if _[0]-1<i<_[0]+3]))
  t.append(len([i for i in a if _[0]-2<i<_[0]+2]))
  t.append(len([i for i in a if _[0]-3<i<_[0]+1]))
print(max(t))

Fixed submission:
x,t=map(int,input().split())
print(x-t if x-t>0 else 0)