Buggy python submission (verdict: Runtime Error):
import math

#グラフの作成   
def make_list(V,E):
 
    edges = []
    path=[[0]*E for i in range(V) ]   #ルート作成に必要になる
    
    for i in range(V):
        a=[int(x) for x in str(input()).split()]
        for j in range(len(a)):
            #print("j",j)
            path[i][j]=i
            if j!= i and a[j]==0:
                a[j]=2000
                path[i][j]=-2000
	
        edges.append((a))    #  有効辺グラフ
	

   
     
    return edges ,path


def mainasu_sycle(dist):   #負のサイクルがあるか確認する    第一引数: 重みを含む配列  実装を確認していない
    
    for i in range (0,len(dist)):
       if dist[i][i] != 0:
        print ("Negative cycle at : ", i+1)




#最短経路をたどる
def ConstructPath(p, i, j):
    i,j = int(i), int(j)
    print("i,j:",i,j)
    if(i==j):
      print (i,)
    elif(p[i][j] == -30000):
      print (i,'-',j)
    else:
      ConstructPath(p, i, p[i][j]);
      print(j,)




#フロイド・ワーシャル
def warshall_floyd(glath,path):
	
	for k in range(len(glath)):
		for i in range(len(glath)):
			for j in range(len(glath[i])):
				if glath[i][j] > glath[i][k] + glath[k][j]:
                                   glath[i][j] = glath[i][k] + glath[k][j]
                                   path[i][j] = path[k][j]
				#glath[i][j]= min(int(glath[i][j]),int(glath[i][k])+int(glath[k][j]))
				
	return glath,path





H, W = [int(x) for x in str(input()).split()]  #グラフの大きさ 

cost_graph,graph=make_list(10,10)
wall ,wall_graph= make_list(H,W)
    #print(cost_graph)

un_label=[]
for i in wall:
   for j in i: 
            if j !=-1 and j!=1:
                 un_label.append(j)
cost=0
 
all_cost,all_graph=warshall_floyd(cost_graph,graph)
    
   

for i in un_label:
        cost+=all_cost[i][1]

print(cost)

Fixed submission:
import math

#グラフの作成   
def make_list(V,E):
 
    edges = []
    path=[[0]*E for i in range(V) ]   #ルート作成に必要になる
    
    for i in range(V):
        a=[int(x) for x in str(input()).split()]
        for j in range(len(a)):
            #print("j",j)
            path[i][j]=i
           # if j!= i and a[j]==0:
                #a[j]=2000
                #path[i][j]=-2000
	
        edges.append((a))    #  有効辺グラフ
	

   
     
    return edges ,path


#フロイド・ワーシャル
def warshall_floyd(glath,path):
	
	for k in range(len(glath)):
		for i in range(len(glath)):
			for j in range(len(glath[i])):
				if glath[i][j] > glath[i][k] + glath[k][j]:
                                   glath[i][j] = glath[i][k] + glath[k][j]
                                   path[i][j] = path[k][j]
				#glath[i][j]= min(int(glath[i][j]),int(glath[i][k])+int(glath[k][j]))
				
	return glath,path





H, W = [int(x) for x in str(input()).split()]  #グラフの大きさ 

cost_graph,graph=make_list(10,10)
wall ,wall_graph= make_list(H,W)
    #print(cost_graph)

un_label=[]
for i in wall:
   for j in i: 
            if j !=-1 and j!=1:
                 un_label.append(j)
cost=0
 
all_cost,all_graph=warshall_floyd(cost_graph,graph)
    
   

for i in un_label:
        cost+=all_cost[i][1]

print(cost)

Buggy python submission (verdict: Runtime Error):
import math

#グラフの作成   
def make_list(V,E):
 
    edges = []
    path=[[0]*E for i in range(V) ]   #ルート作成に必要になる
    
    for i in range(V):
        a=[int(x) for x in str(input()).split()]
        for j in range(len(a)):
            #print("j",j)
            path[i][j]=i
            if j!= i and a[j]==0:
                a[j]=30000
                path[i][j]=-3000
	
        edges.append((a))    #  有効辺グラフ
	

   
     
    return edges ,path


def mainasu_sycle(dist):   #負のサイクルがあるか確認する    第一引数: 重みを含む配列  実装を確認していない
    
    for i in range (0,len(dist)):
       if dist[i][i] != 0:
        print ("Negative cycle at : ", i+1)




#最短経路をたどる
def ConstructPath(p, i, j):
    i,j = int(i), int(j)
    print("i,j:",i,j)
    if(i==j):
      print (i,)
    elif(p[i][j] == -30000):
      print (i,'-',j)
    else:
      ConstructPath(p, i, p[i][j]);
      print(j,)




#フロイド・ワーシャル
def warshall_floyd(glath,path):
	
	for k in range(len(glath)):
		for i in range(len(glath)):
			for j in range(len(glath[i])):
				if glath[i][j] > glath[i][k] + glath[k][j]:
                                   glath[i][j] = glath[i][k] + glath[k][j]
                                   path[i][j] = path[k][j]
				#glath[i][j]= min(int(glath[i][j]),int(glath[i][k])+int(glath[k][j]))
				
	return glath,path






if __name__ == "__main__":
    H, W = [int(x) for x in str(input()).split()]  #グラフの大きさ 

    cost_graph,graph=make_list(10,10)
    wall ,wall_graph= make_list(H,W)
    #print(cost_graph)

    un_label=[]
    for i in wall:
       for j in i: 
            if j !=-1 and j!=1:
                 un_label.append(j)
    cost=0
 
    all_cost,all_graph=warshall_floyd(cost_graph,graph)
    
   

    for i in un_label:
        cost+=all_cost[i][1]

    print(cost)

Fixed submission:
import math

#グラフの作成   
def make_list(V,E):
 
    edges = []
    path=[[0]*E for i in range(V) ]   #ルート作成に必要になる
    
    for i in range(V):
        a=[int(x) for x in str(input()).split()]
        for j in range(len(a)):
            #print("j",j)
            path[i][j]=i
           # if j!= i and a[j]==0:
                #a[j]=2000
                #path[i][j]=-2000
	
        edges.append((a))    #  有効辺グラフ
	

   
     
    return edges ,path


#フロイド・ワーシャル
def warshall_floyd(glath,path):
	
	for k in range(len(glath)):
		for i in range(len(glath)):
			for j in range(len(glath[i])):
				if glath[i][j] > glath[i][k] + glath[k][j]:
                                   glath[i][j] = glath[i][k] + glath[k][j]
                                   path[i][j] = path[k][j]
				#glath[i][j]= min(int(glath[i][j]),int(glath[i][k])+int(glath[k][j]))
				
	return glath,path





H, W = [int(x) for x in str(input()).split()]  #グラフの大きさ 

cost_graph,graph=make_list(10,10)
wall ,wall_graph= make_list(H,W)
    #print(cost_graph)

un_label=[]
for i in wall:
   for j in i: 
            if j !=-1 and j!=1:
                 un_label.append(j)
cost=0
 
all_cost,all_graph=warshall_floyd(cost_graph,graph)
    
   

for i in un_label:
        cost+=all_cost[i][1]

print(cost)

Buggy python submission (verdict: Runtime Error):
import math

#グラフの作成   
def make_list(V,E):
 
    edges = []
    path=[[0]*E for i in range(V) ]   #ルート作成に必要になる
    
    for i in range(V):
        a = list(map(int, input().split()))
        for j in range(len(a)):
            #print("j",j)
            path[i][j]=i
            if j!= i and a[j]==0:
                a[j]=30000
                path[i][j]=-3000
	
        edges.append((a))    #  有効辺グラフ
	

   
     
    return edges ,path


def mainasu_sycle(dist):   #負のサイクルがあるか確認する    第一引数: 重みを含む配列  実装を確認していない
    
    for i in range (0,len(dist)):
       if dist[i][i] != 0:
        print ("Negative cycle at : ", i+1)




#最短経路をたどる
def ConstructPath(p, i, j):
    i,j = int(i), int(j)
    print("i,j:",i,j)
    if(i==j):
      print (i,)
    elif(p[i][j] == -30000):
      print (i,'-',j)
    else:
      ConstructPath(p, i, p[i][j]);
      print(j,)




#フロイド・ワーシャル
def warshall_floyd(glath,path):
	
	for k in range(len(glath)):
		for i in range(len(glath)):
			for j in range(len(glath[i])):
				if glath[i][j] > glath[i][k] + glath[k][j]:
                                   glath[i][j] = glath[i][k] + glath[k][j]
                                   path[i][j] = path[k][j]
				#glath[i][j]= min(int(glath[i][j]),int(glath[i][k])+int(glath[k][j]))
				
	return glath,path






if __name__ == "__main__":
    H, W = map(int, input().split())  #グラフの大きさ 

    cost_graph,graph=make_list(10,10)
    wall ,wall_graph= make_list(H,W)
   

    un_label=[]
    for i in wall:
       for j in i: 
            if j !=-1 and j!=1:
                 un_label.append(j)
    cost=0
 
    all_cost,all_graph=warshall_floyd(cost_graph,graph)
    
   

    for i in un_label:
        cost+=all_cost[i][1]

    print(cost)

Fixed submission:
import math

#グラフの作成   
def make_list(V,E):
 
    edges = []
    path=[[0]*E for i in range(V) ]   #ルート作成に必要になる
    
    for i in range(V):
        a=[int(x) for x in str(input()).split()]
        for j in range(len(a)):
            #print("j",j)
            path[i][j]=i
           # if j!= i and a[j]==0:
                #a[j]=2000
                #path[i][j]=-2000
	
        edges.append((a))    #  有効辺グラフ
	

   
     
    return edges ,path


#フロイド・ワーシャル
def warshall_floyd(glath,path):
	
	for k in range(len(glath)):
		for i in range(len(glath)):
			for j in range(len(glath[i])):
				if glath[i][j] > glath[i][k] + glath[k][j]:
                                   glath[i][j] = glath[i][k] + glath[k][j]
                                   path[i][j] = path[k][j]
				#glath[i][j]= min(int(glath[i][j]),int(glath[i][k])+int(glath[k][j]))
				
	return glath,path





H, W = [int(x) for x in str(input()).split()]  #グラフの大きさ 

cost_graph,graph=make_list(10,10)
wall ,wall_graph= make_list(H,W)
    #print(cost_graph)

un_label=[]
for i in wall:
   for j in i: 
            if j !=-1 and j!=1:
                 un_label.append(j)
cost=0
 
all_cost,all_graph=warshall_floyd(cost_graph,graph)
    
   

for i in un_label:
        cost+=all_cost[i][1]

print(cost)