Language: C++

#include<bits/stdc++.h>
#define x first
#define y second
#define ll long long
#define pii pair<int, int>
#define maxn 1005
#define INF 0x7FFFFFFF
#define dbg(n) cout << n << endl
#define mod 1000000007
using namespace std;

inline void read(int &x){
	int f = 1; x = 0; char s = getchar();
    while(s > '9' || s < '0'){
		if(s == '-') f = -1;
		s = getchar();
	}
    while(s <= '9' && s >= '0'){
		x = x * 10 + s - '0';
		s = getchar();
	}
    x = x * f;
}

struct E{
	int f, t, c;
	E(int f, int t, int c) : f(f), t(t), c(c){
	};
};

int G[1005];
vector<int> GG[1005];

int main(){
	int n, m, f, t, c;
	read(n), read(m);
	for(int i = 0; i <= n; ++i)
		for(int j = 0; j <= n; ++j)
			G[i][j] = INF;
	for(int i = 0; i < m; ++i){
		read(f); read(t); read(c);
		G[f][t] = c;
		GG[f].push_back(E(f, t, c));
	}
	for(int i = 0; i <= n; ++i)
		for(int j = 0; j <= n; ++j)
			for(int k = 0; k <= n; ++k)
				G[i][j] = min(G[i][j], G[i][k] + G[k][j]);
	int ans = 0;
	for(int i = 0; i <= n; ++i)
		for(int j = 0; j < GG[i].size(); ++j)
			if(GG[i][j].c > G[i][GG[i][j].t]) ans++;
	cout << ans << endl;
		
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:29: error: invalid types 'int[int]' for array subscript
   39 |                         G[i][j] = INF;
      |                             ^
a.cc:42:21: error: invalid types 'int[int]' for array subscript
   42 |                 G[f][t] = c;
      |                     ^
a.cc:43:32: error: no matching function for call to 'std::vector<int>::push_back(E)'
   43 |                 GG[f].push_back(E(f, t, c));
      |                 ~~~~~~~~~~~~~~~^~~~~~~~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from 'E' to 'const std::vector<int>::value_type&' {aka 'const int&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from 'E' to 'std::vector<int>::value_type&&' {aka 'int&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
a.cc:48:37: error: invalid types 'int[int]' for array subscript
   48 |                                 G[i][j] = min(G[i][j], G[i][k] + G[k][j]);
      |                                     ^
a.cc:48:51: error: invalid types 'int[int]' for array subscript
   48 |                                 G[i][j] = min(G[i][j], G[i][k] + G[k][j]);
      |                                                   ^
a.cc:48:60: error: invalid types 'int[int]' for array subscript
   48 |                                 G[i][j] = min(G[i][j], G[i][k] + G[k][j]);
      |                                                            ^
a.cc:48:70: error: invalid types 'int[int]' for array subscript
   48 |                                 G[i][j] = min(G[i][j], G[i][k] + G[k][j]);
      |                                                                      ^
a.cc:52:37: error: request for member 'c' in 'GG[i].std::vector<int>::operator[](((std::vector<int>::size_type)j))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   52 |                         if(GG[i][j].c > G[i][GG[i][j].t]) ans++;
      |                                     ^
a.cc:52:55: error: request for member 't' in 'GG[i].std::vector<int>::operator[](((std::vector<int>::size_type)j))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   52 |                         if(GG[i][j].c > G[i][GG[i][j].t]) ans++;
      |                                                       ^