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

A = [0]*M

B = [0]*M

C = [0]*M

d = []

for i in range(N):

  d.append([1000000]*N)

  d[i][i]=0

for i in range(M):

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

  A[i] = a-1

  B[i] = b-1

  C[i] = c

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

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

for k in range(N):

  for i in range(N):

    for j in range(N):

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

      d[j][i] = d[i][j]

r = 0

for i in range(M):

  if d[A[i]][B[i]] < C[i]:

    r += 1

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

D = []

for i in range(N):

  D.append([1000000]*N)

  D[i][i] = 0

A = [0]*M

B = [0]*M

C = [0]*M

for i in range(M):

  a, b, C[i] = list(map(int, input().split()))

  A[i] = a-1

  B[i] = b-1

  D[A[i]][B[i]] = C[i]

  D[B[i]][A[i]] = C[i]

for k in range(N):

  for i in range(N):

    for j in range(N):

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

r = 0

for i in range(M):

  if D[A[i]][B[i]] < C[i]:

    r += 1

print(r)
N, M = list(map(int, input().split()))
A = [0] * M
B = [0] * M
C = [0] * M
d = []
for i in range(N):
    d.append([1000000] * N)
    d[i][i] = 0
for i in range(M):
    a, b, c = list(map(int, input().split()))
    A[i] = a - 1
    B[i] = b - 1
    C[i] = c
    d[a - 1][b - 1] = c
    d[b - 1][a - 1] = c
for k in range(N):
    for i in range(N):
        for j in range(N):
            d[i][j] = min(d[i][j], d[i][k] + d[k][j])
            d[j][i] = d[i][j]
r = 0
for i in range(M):
    if d[A[i]][B[i]] < C[i]:
        r += 1
print(r)

N, M = list(map(int, input().split()))
D = []
for i in range(N):
    D.append([1000000] * N)
    D[i][i] = 0
A = [0] * M
B = [0] * M
C = [0] * M
for i in range(M):
    a, b, C[i] = list(map(int, input().split()))
    A[i] = a - 1
    B[i] = b - 1
    D[A[i]][B[i]] = C[i]
    D[B[i]][A[i]] = C[i]
for k in range(N):
    for i in range(N):
        for j in range(N):
            D[i][j] = min(D[i][j], D[i][k] + D[k][j])
r = 0
for i in range(M):
    if D[A[i]][B[i]] < C[i]:
        r += 1
print(r)

+D = [] +for i in range(N): +    D.append([1000000] * N) +    D[i][i] = 0 -d = [] -for i in range(N): -    d.append([1000000] * N) -    d[i][i] = 0 -    a, b, c = list(map(int, input().split())) +    a, b, C[i] = list(map(int, input().split())) -    C[i] = c -    d[a - 1][b - 1] = c -    d[b - 1][a - 1] = c +    D[A[i]][B[i]] = C[i] +    D[B[i]][A[i]] = C[i] -            d[i][j] = min(d[i][j], d[i][k] + d[k][j]) -            d[j][i] = d[i][j] +            D[i][j] = min(D[i][j], D[i][k] + D[k][j]) -    if d[A[i]][B[i]] < C[i]: +    if D[A[i]][B[i]] < C[i]: