Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define REP(i, j, n) for (int i = j; i < (n); ++i)
#define SORT(a) sort(a.begin(), a.end())
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;

int n, m;
cin >> n >> m;
int a[1000], b[1000], c[1000], dist[100][100];
for (int i = 0; i < m; ++i)
{
    cin >> a[i] >> b[i] >> c[i];
    a[i]--, b[i]--;
}

for (int i = 0; i < n; ++i)
{
    for (int j = 0; j < n; ++j)
    {
        if (i == j)
            dist[i][j] = 0;
        else
            dist[i][j] = inf;
    }
}

for (int i = 0; i < m; ++i)
{
    dist[a[i]][b[i]] = min(dist[a[i]][b[i]], c[i]);
    dist[b[i]][a[i]] = min(dist[b[i]][a[i]], c[i]);
}

for (int k = 0; k < n; ++k)
{
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < n; ++j)
        {
            dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
        }
    }
}

int ans = m;
for (int i = 0; i < m; ++i)
{
    bool shortest = false;
    for (int j = 0; j < n; ++j)
        if (dist[j][a[i]] + c[i] == dist[j][b[i]])
            shortest = true;
    if (shortest == true)
    {
        ans = ans - 1;
    }
}

cout << ans << endl;
}

Compiler output:
a.cc:11:1: error: 'cin' does not name a type
   11 | cin >> n >> m;
      | ^~~
a.cc:13:1: error: expected unqualified-id before 'for'
   13 | for (int i = 0; i < m; ++i)
      | ^~~
a.cc:13:17: error: 'i' does not name a type; did you mean 'vi'?
   13 | for (int i = 0; i < m; ++i)
      |                 ^
      |                 vi
a.cc:13:24: error: expected unqualified-id before '++' token
   13 | for (int i = 0; i < m; ++i)
      |                        ^~
a.cc:19:1: error: expected unqualified-id before 'for'
   19 | for (int i = 0; i < n; ++i)
      | ^~~
a.cc:19:17: error: 'i' does not name a type; did you mean 'vi'?
   19 | for (int i = 0; i < n; ++i)
      |                 ^
      |                 vi
a.cc:19:24: error: expected unqualified-id before '++' token
   19 | for (int i = 0; i < n; ++i)
      |                        ^~
a.cc:30:1: error: expected unqualified-id before 'for'
   30 | for (int i = 0; i < m; ++i)
      | ^~~
a.cc:30:17: error: 'i' does not name a type; did you mean 'vi'?
   30 | for (int i = 0; i < m; ++i)
      |                 ^
      |                 vi
a.cc:30:24: error: expected unqualified-id before '++' token
   30 | for (int i = 0; i < m; ++i)
      |                        ^~
a.cc:36:1: error: expected unqualified-id before 'for'
   36 | for (int k = 0; k < n; ++k)
      | ^~~
a.cc:36:17: error: 'k' does not name a type
   36 | for (int k = 0; k < n; ++k)
      |                 ^
a.cc:36:24: error: expected unqualified-id before '++' token
   36 | for (int k = 0; k < n; ++k)
      |                        ^~
a.cc:48:1: error: expected unqualified-id before 'for'
   48 | for (int i = 0; i < m; ++i)
      | ^~~
a.cc:48:17: error: 'i' does not name a type; did you mean 'vi'?
   48 | for (int i = 0; i < m; ++i)
      |                 ^
      |                 vi
a.cc:48:24: error: expected unqualified-id before '++' token
   48 | for (int i = 0; i < m; ++i)
      |                        ^~
a.cc:60:1: error: 'cout' does not name a type
   60 | cout << ans << endl;
      | ^~~~
a.cc:61:1: error: expected declaration before '}' token
   61 | }
      | ^