Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())

a = [0]*M
b = [0]*M
c = [0]*M

for i in range(M):
    a[i],b[i],c[i] = map(int,input().split())

d = [[0]*N for i in range(N)]

for i in range(M):
    d[a[i]-1][b[i]-1] = c[i]
    d[b[i]-1][a[i]-1] = c[i]
    



for i in range(N):
    for j in range(N):
        for s in range(N):
            d[i][j] = min(d[i][j], d[i][s]+d[s][j])

count = 0
for i in range(M):
    d[i][i] = float("inf")
    if d[a[i]-1][b[i]-1] != c[i]:

        count += 1
print(count)

Fixed submission:
N,M = map(int,input().split())

a = [0]*M
b = [0]*M
c = [0]*M

for i in range(M):
    a[i],b[i],c[i] = map(int,input().split())
    a[i] -= 1
    b[i] -= 1
    

d = [[float("inf")]*N for i in range(N)]

for i in range(M):
    d[a[i]][b[i]] = c[i]
    d[b[i]][a[i]] = c[i]
    
for i in range(N):
    d[i][i] = 0

for s in range(N):
    for j in range(N):
        for i in range(N):
            d[i][j] = min(d[i][j], d[i][s]+d[s][j])

count = 0
for i in range(M):
    if d[a[i]][b[i]] < c[i]:
        count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())

a = [0]*M
b = [0]*M
c = [0]*M

for i in range(M):
    a[i],b[i],c[i] = map(int,input().split())

d = [[0]*N for i in range(N)]

for i in range(M):
    d[a[i]-1][b[i]-1] = c[i]
    d[b[i]-1][a[i]-1] = c[i]
    


for s in range(N):
    for i in range(N):
        for j in range(N):
            d[i][j] = min(d[i][j], d[i][s]+d[s][j])

count = 0
for i in range(N):
    d[i][i] = float("inf")
    if d[a[i]-1][b[i]-1] != c[i]:

        count += 1
print(count)

Fixed submission:
N,M = map(int,input().split())

a = [0]*M
b = [0]*M
c = [0]*M

for i in range(M):
    a[i],b[i],c[i] = map(int,input().split())
    a[i] -= 1
    b[i] -= 1
    

d = [[float("inf")]*N for i in range(N)]

for i in range(M):
    d[a[i]][b[i]] = c[i]
    d[b[i]][a[i]] = c[i]
    
for i in range(N):
    d[i][i] = 0

for s in range(N):
    for j in range(N):
        for i in range(N):
            d[i][j] = min(d[i][j], d[i][s]+d[s][j])

count = 0
for i in range(M):
    if d[a[i]][b[i]] < c[i]:
        count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())

a = [0]*M
b = [0]*M
c = [0]*M

for i in range(M):
    a[i],b[i],c[i] = map(int,input().split())

d = [[0]*N for i in range(N)]

for i in range(M):
    d[a[i]-1][b[i]-1] = c[i]
    d[b[i]-1][a[i]-1] = c[i]
    


for s in range(N):
    for i in range(N):
        for j in range(N):
            d[i][j] = min(d[i][j], d[i][s]+d[s][j])

count = 0
for i in range(N):
    d[i][i] = float("inf")
    for j in range(N):
        if c[i] > d[i][j]:
            count += 1
print(count//2)

Fixed submission:
N,M = map(int,input().split())

a = [0]*M
b = [0]*M
c = [0]*M

for i in range(M):
    a[i],b[i],c[i] = map(int,input().split())
    a[i] -= 1
    b[i] -= 1
    

d = [[float("inf")]*N for i in range(N)]

for i in range(M):
    d[a[i]][b[i]] = c[i]
    d[b[i]][a[i]] = c[i]
    
for i in range(N):
    d[i][i] = 0

for s in range(N):
    for j in range(N):
        for i in range(N):
            d[i][j] = min(d[i][j], d[i][s]+d[s][j])

count = 0
for i in range(M):
    if d[a[i]][b[i]] < c[i]:
        count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())

a = [0]*M
b = [0]*M
c = [0]*M

for i in range(M):
    a[i],b[i],c[i] = map(int,input().split())

d = [[0]*N for i in range(N)]

for i in range(M):
    d[a[i]-1][b[i]-1] = c[i]
    d[b[i]-1][a[i]-1] = c[i]
    


for s in range(N):
    for i in range(N):
        for j in range(N):
            d[i][j] = min(d[i][j], d[i][s]+d[s][j])

count = 0
for i in range(M):
    d[i][i] = float("inf")
    if c[i] > d[a[i]-1][b[i]-1]:
            count += 1
print(count)

Fixed submission:
N,M = map(int,input().split())

a = [0]*M
b = [0]*M
c = [0]*M

for i in range(M):
    a[i],b[i],c[i] = map(int,input().split())
    a[i] -= 1
    b[i] -= 1
    

d = [[float("inf")]*N for i in range(N)]

for i in range(M):
    d[a[i]][b[i]] = c[i]
    d[b[i]][a[i]] = c[i]
    
for i in range(N):
    d[i][i] = 0

for s in range(N):
    for j in range(N):
        for i in range(N):
            d[i][j] = min(d[i][j], d[i][s]+d[s][j])

count = 0
for i in range(M):
    if d[a[i]][b[i]] < c[i]:
        count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())

a = [0]*M
b = [0]*M
c = [0]*M

for i in range(M):
    a[i],b[i],c[i] = map(int,input().split())

d = [[0]*N for i in range(N)]

for i in range(M):
    d[a[i]-1][b[i]-1] = c[i]
    d[b[i]-1][a[i]-1] = c[i]
    


for s in range(M):
    for i in range(N):
        for j in range(N):
            d[i][j] = min(d[i][j], d[i][s]+d[s][j])

count = 0
for i in range(M):
    d[i][i] = float("inf")
    if c[i] > d[a[i]-1][b[i]-1]:
            count += 1
print(count)

Fixed submission:
N,M = map(int,input().split())

a = [0]*M
b = [0]*M
c = [0]*M

for i in range(M):
    a[i],b[i],c[i] = map(int,input().split())
    a[i] -= 1
    b[i] -= 1
    

d = [[float("inf")]*N for i in range(N)]

for i in range(M):
    d[a[i]][b[i]] = c[i]
    d[b[i]][a[i]] = c[i]
    
for i in range(N):
    d[i][i] = 0

for s in range(N):
    for j in range(N):
        for i in range(N):
            d[i][j] = min(d[i][j], d[i][s]+d[s][j])

count = 0
for i in range(M):
    if d[a[i]][b[i]] < c[i]:
        count += 1
print(count)