Language: C++

#include <cstdio>
#include <vector>
#define INT_MAX 100000000
#define N_MAX 10001

class road {
public:
  int to,dist,cost;
  road(int to,int dist,int cost){
    this->to = to;
    this->dist = dist;
    this->cost = cost;
  };
};

int n,m;
int before[N_MAX],ans;
vector<road> roads[N_MAX];

int main(){
  while(scanf("%d %d",&n,&m),n){
    int i,j;

    ans = 0;
    for(i=0; i<N_MAX; i++) {
      roads[i].clear();
      before[i] = 0;
    }

    for(i=0; i<m; i++){
      int u,v,d,c;
      scanf("%d %d %d %d",&u,&v,&d,&c);
      road[u].push_back(road(v,d,c));
      road[v].push_back(road(u,d,c));
    }

    bool visited[n+1];
    int d[n+1];
    for(i=1; i<=n; i++){
      d[i] = INT_MAX;
      visited[i] = false;
    }

    d[1] = 0;

    for(;;){
      int u;
      int mincost = INT_MAX;
      for(i=1; i<=n; i++)
	if(!visited[i] && d[i]<mincost){
	  mincost = d[i]; u = i;
	}

      if(mincost == INT_MAX) break;

      visited[u] = true;
      for(i=0; i<=roads[u].size(); i++)
	if(roads[u][i]==before[u])
	  ans += roads[u][i].cost;

      for(i=0; i<=roads[u].size(); i++){
	int v = roads[u][i].to, dist = roads[u][i].dist, cost = roads[u][i].cost;

	if(visited[v]) continue;

	int cost1;
	for(j=0; j<=roads[v].size(); j++)
	  if(roads[v][j]==before[v])
	    cost1 = roads[v][j].cost;

	if(d[v]>d[u]+dist || (d[v]==d[u]+dist && cost1 > cost)){
	  d[v] = d[u]+dist;
	  before[v] = u;
	}
      }
    }

    printf("%d\n",ans);
  }
  return 0;
}

Compiler output:
a.cc:18:1: error: 'vector' does not name a type
   18 | vector<road> roads[N_MAX];
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:26:7: error: 'roads' was not declared in this scope; did you mean 'road'?
   26 |       roads[i].clear();
      |       ^~~~~
      |       road
a.cc:33:11: error: structured binding declaration cannot have type 'road'
   33 |       road[u].push_back(road(v,d,c));
      |           ^~~
a.cc:33:11: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:33:12: error: conflicting declaration 'auto u'
   33 |       road[u].push_back(road(v,d,c));
      |            ^
a.cc:31:11: note: previous declaration as 'int u'
   31 |       int u,v,d,c;
      |           ^
a.cc:33:14: error: expected initializer before '.' token
   33 |       road[u].push_back(road(v,d,c));
      |              ^
a.cc:34:11: error: structured binding declaration cannot have type 'road'
   34 |       road[v].push_back(road(u,d,c));
      |           ^~~
a.cc:34:11: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:34:12: error: conflicting declaration 'auto v'
   34 |       road[v].push_back(road(u,d,c));
      |            ^
a.cc:31:13: note: previous declaration as 'int v'
   31 |       int u,v,d,c;
      |             ^
a.cc:34:14: error: expected initializer before '.' token
   34 |       road[v].push_back(road(u,d,c));
      |              ^
a.cc:57:19: error: 'roads' was not declared in this scope; did you mean 'road'?
   57 |       for(i=0; i<=roads[u].size(); i++)
      |                   ^~~~~
      |                   road
a.cc:61:19: error: 'roads' was not declared in this scope; did you mean 'road'?
   61 |       for(i=0; i<=roads[u].size(); i++){
      |                   ^~~~~
      |                   road
a.cc:71:22: error: 'dist' was not declared in this scope
   71 |         if(d[v]>d[u]+dist || (d[v]==d[u]+dist && cost1 > cost)){
      |                      ^~~~
a.cc:71:58: error: 'cost' was not declared in this scope; did you mean 'cost1'?
   71 |         if(d[v]>d[u]+dist || (d[v]==d[u]+dist && cost1 > cost)){
      |                                                          ^~~~
      |                                                          cost1