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

INF = 10 ** 20

edgeList = []

dist = [[INF] * n for _ in range(n)]

for _ in range(m):

    a, b, c = list(map(int, input().split()))

    a -= 1

    b -= 1

    dist[a][b] = dist[b][a] = c

    edgeList.append((a, b, c))



for k in range(n):

    for i in range(n):

        for j in range(n):

            dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])



print((sum([dist[a][b] < c for a, b, c in edgeList])))

N, M = list(map(int, input().split()))

inf = float("inf")

dp = [[inf]*N for _ in [0]*N]

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

d = [list(map(int, input().split())) for i in range(M)]

ans = 0

 

for a,b,c in d:

    dp[a-1][b-1] = c

    dp[b-1][a-1] = c

for k in range(N):

    for i in range(N):

        for j in range(N):

            dp[i][j] = min(dp[i][j],dp[i][k]+dp[k][j])

for a,b,c in d:

        if dp[a-1][b-1] != c:

            ans += 1

print(ans)

n, m = list(map(int, input().split()))
INF = 10**20
edgeList = []
dist = [[INF] * n for _ in range(n)]
for _ in range(m):
    a, b, c = list(map(int, input().split()))
    a -= 1
    b -= 1
    dist[a][b] = dist[b][a] = c
    edgeList.append((a, b, c))
for k in range(n):
    for i in range(n):
        for j in range(n):
            dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])
print((sum([dist[a][b] < c for a, b, c in edgeList])))

N, M = list(map(int, input().split()))
inf = float("inf")
dp = [[inf] * N for _ in [0] * N]
for i in range(N):
    dp[i][i] = 0
d = [list(map(int, input().split())) for i in range(M)]
ans = 0
for a, b, c in d:
    dp[a - 1][b - 1] = c
    dp[b - 1][a - 1] = c
for k in range(N):
    for i in range(N):
        for j in range(N):
            dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j])
for a, b, c in d:
    if dp[a - 1][b - 1] != c:
        ans += 1
print(ans)

-n, m = list(map(int, input().split())) -INF = 10**20 -edgeList = [] -dist = [[INF] * n for _ in range(n)] -for _ in range(m): -    a, b, c = list(map(int, input().split())) -    a -= 1 -    b -= 1 -    dist[a][b] = dist[b][a] = c -    edgeList.append((a, b, c)) -for k in range(n): -    for i in range(n): -        for j in range(n): -            dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]) -print((sum([dist[a][b] < c for a, b, c in edgeList]))) +N, M = list(map(int, input().split())) +inf = float("inf") +dp = [[inf] * N for _ in [0] * N] +for i in range(N): +    dp[i][i] = 0 +d = [list(map(int, input().split())) for i in range(M)] +ans = 0 +for a, b, c in d: +    dp[a - 1][b - 1] = c +    dp[b - 1][a - 1] = c +for k in range(N): +    for i in range(N): +        for j in range(N): +            dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]) +for a, b, c in d: +    if dp[a - 1][b - 1] != c: +        ans += 1 +print(ans)