Language: C++

#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
using namespace std;
typedef pair<int, int> P;

int n, m;
int a[1010], b[1010], c[1010];
int d[110][110];
int prev[110][110];

const int INF = 1e7;

void init(int n){
    rep(i, 0, n){
        rep(j, 0, n){
            d[i][j] = INF;
            prev[i][j] = i;
            if(i == j) d[i][j] = 0;
        }
    }
}

void warshall_floyd(){
    rep(k, 0, n){
        rep(i, 0, n){
            rep(j, 0, n){
                if(d[i][k] + d[k][j] < d[i][j]){
                    d[i][j] = d[i][k] + d[k][j];
                    prev[i][j] = prev[k][j];
                }
            }
        }
    }
}

int f[110][110];

void path(int s, int g){
    vector<int> pt;
    for(int i = g; i != s; i = prev[s][i]){
        // st.insert(i);
        pt. push_back(i);
    }
    reverse(all(pt));
    int now = s;
    rep(i, 0, pt.size()){
        f[now][pt[i]] = true;
        now = pt[i];
    }
}

signed main(){
    cin >> n >> m;
    init(n);
    rep(i, 0, m){
        cin >> a[i] >> b[i] >> c[i];
        a[i]--;
        b[i]--;
        d[a[i]][b[i]] = c[i];
        d[b[i]][a[i]] = c[i];
    }
    warshall_floyd();
    rep(i, 0, n) rep(j, 0, n) f[i][j] = false; 
    rep(i, 0, n){
        rep(j, i + 1, n){
            path(i, j);
        }
    }
    int ans = 0;
    rep(i, 0, m){
        if(f[a[i]][b[i]] == false && f[b[i]][a[i]] == false) ans++;
    }
    o(ans);
}

Compiler output:
a.cc: In function 'void init(long long int)':
a.cc:21:13: error: reference to 'prev' is ambiguous
   21 |             prev[i][j] = i;
      |             ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:13:5: note:                 'long long int prev [110][110]'
   13 | int prev[110][110];
      |     ^~~~
a.cc: In function 'void warshall_floyd()':
a.cc:33:21: error: reference to 'prev' is ambiguous
   33 |                     prev[i][j] = prev[k][j];
      |                     ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:13:5: note:                 'long long int prev [110][110]'
   13 | int prev[110][110];
      |     ^~~~
a.cc:33:34: error: reference to 'prev' is ambiguous
   33 |                     prev[i][j] = prev[k][j];
      |                                  ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:13:5: note:                 'long long int prev [110][110]'
   13 | int prev[110][110];
      |     ^~~~
a.cc: In function 'void path(long long int, long long int)':
a.cc:44:32: error: reference to 'prev' is ambiguous
   44 |     for(int i = g; i != s; i = prev[s][i]){
      |                                ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:13:5: note:                 'long long int prev [110][110]'
   13 | int prev[110][110];
      |     ^~~~