Language: C++

c++.h"

using namespace std;

#define ll long long
#define vi  vector<int>
#define vvi vector<vi>
#define pi  pair<int,int>
#define mp  make_pair
#define pb  push_back
#define MOD 1e9 + 7
#define PAI  3.1415
#define all(x) (x).begin(),(x).end()
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
#define pr(x) cout << x << endl
#define Endl endl
#define rep(i,n) for(int i = 0 ; i < n; i++)

const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const int ddx[8] = {-1,0,1,-1,1,-1,0,1};
const int ddy[8] = {-1,-1,-1,0,0,1,1,1};
const int inf = 99999999;
const ll linf = 1LL << 62;

ll gcd(ll a,ll b){
  if(a < b)swap(a , b);
  if(a % b == 0) return b;
  else gcd(b, a%b);
}

ll lcm(ll a,ll b){
  if(a < b)swap(a , b);
  return (a/gcd(a , b))*b;
}

int main(){

  int n,m;
  cin >> n >> m;

  int a[1000],b[1000],c[1000],dist[100][100] = {0};

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

  rep(i,n){
    rep(j,n){
       if(i != j)dist[i][j] = inf;
    }
  }

  rep(i,m){
    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]);
  }

  rep(k,n){
    rep(i,n){
      rep(j,n){
        dist[i][j] = min(dist[i][j],dist[i][k] + dist[k][j]);
      }
    }
  }

  int ans = m;
  rep(i,m){
    bool flag = false;
    rep(j,n) if(dist[j][a[i]]+c[i] == dist[j][b[i]])flag = true;
    if(flag) ans--;
  }

  pr(ans);

  return 0;

}


Compiler output:
a.cc:1:6: warning: missing terminating " character
    1 | c++.h"
      |      ^
a.cc:1:6: error: missing terminating " character
a.cc:1:1: error: 'c' does not name a type
    1 | c++.h"
      | ^
a.cc: In function 'long long int gcd(long long int, long long int)':
a.cc:28:12: error: 'swap' was not declared in this scope
   28 |   if(a < b)swap(a , b);
      |            ^~~~
a.cc: In function 'long long int lcm(long long int, long long int)':
a.cc:34:12: error: 'swap' was not declared in this scope
   34 |   if(a < b)swap(a , b);
      |            ^~~~
a.cc: In function 'int main()':
a.cc:41:3: error: 'cin' was not declared in this scope
   41 |   cin >> n >> m;
      |   ^~~
a.cc:57:24: error: 'min' was not declared in this scope; did you mean 'main'?
   57 |     dist[a[i]][b[i]] = min(dist[a[i]][b[i]] , c[i]);
      |                        ^~~
      |                        main
a.cc:64:22: error: 'min' was not declared in this scope; did you mean 'main'?
   64 |         dist[i][j] = min(dist[i][j],dist[i][k] + dist[k][j]);
      |                      ^~~
      |                      main
a.cc:16:15: error: 'cout' was not declared in this scope
   16 | #define pr(x) cout << x << endl
      |               ^~~~
a.cc:76:3: note: in expansion of macro 'pr'
   76 |   pr(ans);
      |   ^~
a.cc:16:28: error: 'endl' was not declared in this scope; did you mean 'Endl'?
   16 | #define pr(x) cout << x << endl
      |                            ^~~~
a.cc:76:3: note: in expansion of macro 'pr'
   76 |   pr(ans);
      |   ^~
a.cc: In function 'long long int gcd(long long int, long long int)':
a.cc:30:11: warning: control reaches end of non-void function [-Wreturn-type]
   30 |   else gcd(b, a%b);
      |        ~~~^~~~~~~~