criyle/codenet-compile-errors huggingface dataset:
Language: C

#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<queue>
#include<vector>
#include<stack>
#define ls k<<1
#define rs k<<1|1
#define RG register
#define MAXN 50010
#define LL long long int
using namespace std;
const int INF=0x7fffffff;
struct node{
	int next;
	int to;
	int w;
	int c;
}t[MAXN];
int head[MAXN];
int num;
int dis[MAXN],vis[MAXN],cost[MAXN];
int n,m;
void add(int from,int to,int w,int c)
{
	t[++num].next=head[from];
	t[num].to=to;
	t[num].w=w;
	t[num].c=c;
	head[from]=num;
}
void spfa()
{
	for(int i=1;i<=n;i++)
		{
			dis[i]=INF;vis[i]=0;cost[i]=INF;
		}
	cost[1]=dis[1]=0;vis[1]=1;
	queue<int>q;q.push(1);
	while(!q.empty())
		{
			int u=q.front();q.pop();vis[u]=0;
			for(int i=head[u];i;i=t[i].next)
				{
					int v=t[i].to;
					if(dis[v]>dis[u]+t[i].w||(dis[v]==dis[u]+t[i].w&&cost[v]>t[i].c))
						{
							dis[v]=dis[u]+t[i].w;
							cost[v]=t[i].c;
							if(!vis[v])
								{
									vis[v]=1;q.push(v);
								}
						}
				}
		}
}
int main()
{
	//freopen("1.in","r" ,stdin);
	//freopen("1.out","w",stdout);
	while(1)
		{
			scanf("%d%d",&n,&m);if(n==0&&m==0) break;
			int x,y,z,k;
			memset(head,0,sizeof(head));num=0;
			for(int i=1;i<=m;i++)
				{
					scanf("%d%d%d%d",&x,&y,&z,&k);
					add(x,y,z,k);add(y,x,z,k);
				}
			spfa();
			int ans=0;
			for(int i=1;i<=n;i++) ans+=cost[i];
			cout<<ans<<endl;
		}
	return 0;
}

Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#define ll long long
using namespace std;

const int N = 10010;
const int M = 20010;

int n,m,e_num,ans,k;
int nxt[M*2],to[M*2],w[M*2],h[N],dis[N],fa[N],pre[N],bl[M*2],val[M*2];
bool in[N];

struct Node {
  int x,y,z,c,f;
  bool operator < (const Node &a) const {
    return f==a.f?c<a.c:f>a.f;
  }
}e[M];

queue<int> q;

int gi() {
  int x=0,o=1; char ch=getchar();
  while(ch!='-' && (ch<'0' || ch>'9')) ch=getchar();
  if(ch=='-') o=-1,ch=getchar();
  while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
  return o*x;
}

void add(int x, int y, int z, int c, int id) {
  nxt[++e_num]=h[x],to[e_num]=y,w[e_num]=z,bl[e_num]=id,val[e_num]=c,h[x]=e_num;
}

void spfa() {
  memset(dis,63,sizeof(dis));
  dis[1]=0,in[1]=1,q.push(1);
  while(!q.empty()) {
    int u=q.front();
    in[u]=0,q.pop();
    for(int i=h[u]; i; i=nxt[i]) {
      int v=to[i];
      if(dis[u]+w[i]<dis[v]) {
	pre[v]=i;
	dis[v]=dis[u]+w[i];
	if(!in[v]) in[v]=1,q.push(v);
      }
      else if(dis[u]+w[i]==dis[v]) {
	if(val[i]<val[pre[v]]) pre[v]=i;
      }
    }
  }
}

int find(int x) {
  return x==fa[x]?x:fa[x]=find(fa[x]);
}

void init() {
  e_num=ans=k=0;
  memset(h,0,sizeof(h));
  memset(pre,0,sizeof(pre));
}

int main() {
  while(scanf("%d%d", &n, &m) && n+m) {
    init();
    for(int i=1; i<=m; i++) {
      int x=gi(),y=gi(),z=gi(),c=gi();
      add(x,y,z,c,i),add(y,x,z,c,i);
      e[i]=(Node){x,y,z,c,0};
    }
    spfa();
    for(int i=2; i<=n; i++) {
      e[bl[pre[i]]].f=1;
    }
    sort(e+1,e+m+1);
    for(int i=1; i<=n; i++) fa[i]=i;
    for(int i=1; i<=m; i++) {
      int x=e[i].x,y=e[i].y;
      int xx=find(x),yy=find(y);
      if(xx==yy) continue;
      ans+=e[i].c,fa[yy]=xx,k++;
      if(k==n-1) break;
    }
    printf("%d\n", ans);
  }
  return 0;
}

Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C

#include<iostream>
#include<cstring>
#include<queue>
using namespace std;

struct qnode
{
    int v,c,d;
    qnode(int _v=0,int _c=0,int _d=0):v(_v),c(_c),d(_d){}
    bool operator <(const qnode &r)const
    {
        return c>r.c;
    }
};

struct qwer{
	int to,val,cost,nex;
} a[40010];

int head[10010],now,dis[10010],ans,vis[10010];

int main()
{
	int n,m;
	for (;;)
	{
		cin>>n>>m;
		if (n==0) break;

		memset(head,0,sizeof(head));
		memset(vis,0,sizeof(vis));
		memset(dis,0x3f,sizeof(dis));
		now=1;ans=0;

		for (int i=1;i<=m;i++)
		{
			int q,w,e,r;
			cin>>q>>w>>e>>r;
			a[now].to=w;
			a[now].val=e;
			a[now].cost=r;
			a[now].nex=head[q];
			head[q]=now++;

			a[now].to=q;
			a[now].val=e;
			a[now].cost=r;
			a[now].nex=head[w];
			head[w]=now++;
		}

		priority_queue<qnode> Q;
        while (!Q.empty())Q.pop();
        dis[1]=0;
		Q.push(qnode(1,0,0));
        qnode t;
        while (!Q.empty())
		{
            t=Q.top();
			Q.pop();
			int u=t.v;
			if (vis[u]) continue;
			vis[u]=1;
			ans+=t.d;
			for (int j=head[u];j!=0;j=a[j].nex)
			{
				if (vis[a[j].to]==0 && dis[a[j].to]>dis[u]+a[j].val)
				dis[a[j].to]=dis[u]+a[j].val,Q.push(qnode(a[j].to,dis[a[j].to],a[j].cost));
			}
		}

		cout<<ans<<endl;
	}
	return 0;
}



Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C

/*
 * main.cpp
 *
 *  Created on: 2013-7-28
 *      Author: whd
 */
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<queue>
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long big;
const int N=10200,M=40200;
const int inf=0x3f3f3f3f;
int n,m;
int next[M],v[M],head[N],t=1,d[N],c[N];
struct node
{
	int s,d;
	node(){}
	node(int _s,int _d):s(_s),d(_d){}
	bool operator<(const node &a)const
	{
		return d>a.d;
	}
};
struct E
{
	int a,b,w;
	E(){}
	E(int _a,int _b,int _w):a(_a),b(_b),w(_w){}
	bool operator<(const E &x)const
	{
		return w<x.w;
	}
};
int top=0;
E e[M];
int q[N];
priority_queue<node>heap;
int dis[N];
void add(int a,int b,int _c,int _d)
{
	next[++t]=head[a];v[t]=b;c[t]=_c;d[t]=_d;head[a]=t;
	next[++t]=head[b];v[t]=a;c[t]=_c;d[t]=_d;head[b]=t;
}
void dij()
{
	while(!heap.empty())heap.pop();
	int i;
	node s;
	memset(dis,inf,sizeof(dis));
	dis[1]=0;
	heap.push(node(1,0));
	while(!heap.empty())
	{
		s=heap.top();
		heap.pop();
		if(dis[s.s]!=s.d)continue;
		for(i=head[s.s];i;i=next[i])
			if(dis[v[i]]>dis[s.s]+d[i])
			{
				dis[v[i]]=dis[s.s]+d[i];
				heap.push(node(v[i],dis[v[i]]));
			}
	}
}
int fa[N],f[N],p[N];
int gf(int x)
{
	if(fa[x]!=x)fa[x]=gf(fa[x]);
	return fa[x];
}
bool cmp(const int &a,const int &b)
{
	return dis[a]<dis[b];
}
void sol()
{
	int i,j;
//	top=0;
//	for(i=1;i<=n;i++)
//		for(j=head[i];j;j=next[j])
//			if(dis[v[j]]==dis[i]+d[j])
//				e[++top]=E(i,v[j],c[j]);
//	sort(e+1,e+1+top);
//	big ans=0;
//	for(i=1;i<=n;i++)
//		fa[i]=i;
//	int a,b;
//	for(i=1;i<=top;i++)
//	{
//		a=gf(e[i].a);
//		b=gf(e[i].b);
//		if(a!=b)
//		{
//			fa[a]=b;
//			ans+=e[i].w;
//		}
//	}
	big ans=0;
	top=0;
	memset(f,inf,sizeof(f));
	f[1]=0;
	for(i=1;i<=n;i++)
		q[i]=i;
	sort(q+1,q+1+n,cmp);
	memset(p,inf,sizeof(p));
	for(i=1;i<=n;i++)
		for(j=head[i];j;j=next[j])
			if(dis[v[j]]==dis[i]+d[j])
			{
				if(p[v[j]]>c[j])
				{
					f[v[j]]=f[i]+c[j];
					p[v[j]]=c[j];
				}
			}
	for(i=2;i<=n;i++)
		ans+=p[i];
	printf("%lld\n",ans);
}
int main()
{
	int a,b,_c,_d;
	while(scanf("%d%d",&n,&m),n||m)
	{
		memset(head,0,sizeof(head));
		t=0;
		while(m--)
		{
			scanf("%d%d%d%d",&a,&b,&_d,&_c);
			add(a,b,_c,_d);
		}
		dij();
		sol();
	}
}

Compiler output:
main.c:7:9: fatal error: cstdio: No such file or directory
    7 | #include<cstdio>
      |         ^~~~~~~~
compilation terminated.
Language: C

#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <set>
#include <queue>
#include <stack>

using namespace std;
int N,M;
int head[11000];
struct Edge
{
	int from;
	int to;
	int len;
	int cost;
	int nex;
}edge[50000];
int cnt=0;
queue<int>q;
bool vis[10100];
int dis[10100];
int pre[10100];
int sum;
struct Node
{
	int x,y,val;
}node[30010];
int father[10100];
int cost[10100];
void ini()
{
	for(int i=0;i<=N;i++)
		father[i]=i;
}

int find(int x)
{
	return x==father[x]? x:father[x]=find(father[x]);
}

bool cmp(Node a,Node b)
{
	return a.val<b.val;
}
void add(int from,int to,int len,int cost)
{
	edge[cnt].from=from;
	edge[cnt].to=to;
	edge[cnt].len=len;
	edge[cnt].cost=cost;
	edge[cnt].nex=head[from];
	head[from]=cnt++;
		

	edge[cnt].from=to;
	edge[cnt].to=from;
	edge[cnt].len=len;
	edge[cnt].cost=cost;
	edge[cnt].nex=head[to];
	head[to]=cnt++;
}
void spfa1(int s)
{
	while(!q.empty())
		q.pop();
	memset(vis,0,sizeof(vis));
	memset(dis,0x7f,sizeof(dis));
	vis[s]=1;
	dis[s]=0;
	q.push(s);
	while(!q.empty())
		{
			int p=q.front();
			q.pop();
			for(int i=head[p];i!=-1;i=edge[i].nex)
				{
					int to=edge[i].to;
					int len=edge[i].len;
 					if(dis[to]>dis[p]+len)
						{
						dis[to]=dis[p]+len;
						if(!vis[to])
							{
							vis[to]=1;
							q.push(to);
							}
						}
				
				}
		vis[p]=0;
	}
}

void spfa(int s)
{
	while(!q.empty())
		{
		q.pop();
		}
	vis[s]=1;
	q.push(s);
	
	memset(cost,0x7f,sizeof(cost));
	cost[s]=0;
	while(!q.empty())
		{
			int p=q.front();
			q.pop();
			for(int i=head[p];i!=-1;i=edge[i].nex)
				{
					int to=edge[i].to;
					int len=edge[i].len;
					if(dis[to]==dis[p]+len)
						{
							cost[to]=min(edge[i].cost,cost[to]);
							q.push(to);
						}
				}
		}
return;
}
int main()
{
	while(scanf("%d%d",&N,&M)!=EOF)
		{
		if(N==0&&M==0)
			break;

		memset(head,0xffff,sizeof(head));
		for(int i=0;i<M;i++)
			{
			int from;
			int to;
			int len;
			int cost;
			scanf("%d%d%d%d",&from,&to,&len,&cost);
			add(from,to,len,cost);
			}
		spfa1(1);
		spfa(1);
		sum=0;
		for(int i=1;i<=N;i++)
			sum+=cost[i];
	
		printf("%d\n",sum);
		}

    return 0 ;
}

Compiler output:
main.c:1:10: fatal error: cstdlib: No such file or directory
    1 | #include <cstdlib>
      |          ^~~~~~~~~
compilation terminated.
Language: C

#include<stdio.h>
#include<utility>
#include<queue>
#include<vector>
#include<algorithm>
#define MAX_N 10000
#define INF 100000000
using namespace std;

typedef pair<int,int>P;

typedef struct edge
{
	int t,dist,cost;
} edge;

struct StructGreater {
	bool operator() (edge a, edge b) {
		return a.dist==b.dist?a.cost>b.cost:a.dist>b.dist;
	}
};

vector<edge>G[MAX_N];

int N,M,mincost[MAX_N],mindist[MAX_N];

int prim()
{
	int flg[MAX_N];
	priority_queue<edge,vector<edge>,StructGreater>que;
	for(int i=0;i<N;i++)
	{
		mindist[i]=INF;
		mincost[i]=INF;
		flg[i]=0;
	}
	mincost[0]=0;
	edge t1={0,0,0};
	que.push(t1);
	int res=0;
	while(!que.empty())
	{
		edge tmp=que.top();
		que.pop();
		if(!flg[tmp.t])
		{
			res+=tmp.cost;
			mindist[tmp.t]=tmp.dist;
			mincost[tmp.t]=tmp.cost;
			flg[tmp.t]=1;
			for(int u=0;u<G[tmp.t].size();u++)
				if(mindist[G[tmp.t][u].t]>G[tmp.t][u].dist&&mincost[G[tmp.t][u].t]>G[tmp.t][u].cost)
				{
					edge t2={G[tmp.t][u].t,mindist[tmp.t]+G[tmp.t][u].dist,G[tmp.t][u].cost};
					que.push(t2);
				}
		}
	}
	return res;
}

int main()
{
	for(;scanf("%d%d",&N,&M);)
	{
		if(N==0&&M==0)
			break;
		for(int i=0;i<M;i++)
		{
			int a,b,c,d;
			scanf("%d%d%d%d",&a,&b,&c,&d);
			a--,b--;
			edge t1={b,c,d};
			edge t2={a,c,d};
			G[a].push_back(t1);
			G[b].push_back(t2);
		}
		printf("%d\n",prim());
		for(int i=0;i<N;i++)
			G[i].clear();
	}
	return 0;
}

Compiler output:
main.c:2:9: fatal error: utility: No such file or directory
    2 | #include<utility>
      |         ^~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<queue>
#include<string>
#include<cstdio>
#include<stack>
#include<memory.h>
#include<cmath>
#include<bitset>
#include<functional>
#include<memory>
#include<utility>
using namespace std;
#define FOR(i,m,n) for(i=m;i<n;i++)
#define MIN(x,y) (x>y?y:x)
#define ab(x,y) (x>y ?(x-y):(y-x))
#define CLR(a,b) memset(a,b,sizeof(a))
#define ROF(i,m,n) for(i=m;i>=n;i--)
#define BUG cout<<"debug"<<endl;
#define RT return
#define BK break
#define HEAP priority_queue
#define SP " "
#define lowf(a,b,c) lower_bound(a,b,c)
#define upf(a,b,c) upper_bound(a,b,c)
#define CP bool cmp(node A,node B)
#define maxn 100000
typedef long long LL;
typedef vector<int> VI;
const int INF = 214748347;
const int NEN = -INF - 1;
const LL LINF = 9223372036854775807;
bool vis[10005];
int dis[10005];
int fa[10005];
typedef struct edge
{
	int dest;
	int power;
	int cost;
	edge(int v,int d, int c)
	{
		dest = v;
		power = d;
		cost = c;
	}
	edge()
	{
		;
	}
}edge;
vector<vector<edge>>Map(10010);
int N, M;
queue<int>spfa;
int main()
{
	while (cin>>N>>M&&(M+N))
	{
		while (!spfa.empty())spfa.pop();
		CLR(vis, 0);
		int i, a, b,temp,u,v,d,c;
		FOR(i, 0, N + 2)dis[i]= INF;
		FOR(i, 0,N+2)Map[i].clear();
		FOR(i, 0, M)
		{
			scanf_s("%d %d %d %d", &u, &v, &d, &c);
			Map[u].push_back(edge(v,d,c));
			Map[v].push_back(edge(u,d,c));
		}
		spfa.push(1);
		vis[1] = 1;
		fa[1] = 0;
		dis[1] = 0;
		int targ, tdis,tc;
		while (!spfa.empty())
		{
			temp = spfa.front();
			spfa.pop();
			vis[temp] = 0;
			FOR(i, 0, Map[temp].size())
			{
				targ = Map[temp][i].dest;
				tdis = Map[temp][i].power;
				tc = Map[temp][i].cost;
				if (tdis + dis[temp] < dis[targ])
				{
					if (!vis[targ])
					{
						spfa.push(targ);
						vis[targ] = 1;
					}
					dis[targ] = dis[temp] + tdis;
					fa[targ] = tc;
				}
				else if ((tdis + dis[temp]) == dis[targ])
				{
					fa[targ] = min(fa[targ], tc);
				}
			}
		}
		int ans = 0;
		FOR(i, 1, N + 1)
		{
			ans += fa[i];
		}
		cout << ans << endl;
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:68:25: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   68 |                         scanf_s("%d %d %d %d", &u, &v, &d, &c);
      |                         ^~~~~~~
      |                         scanf
Language: C++

#include <iostream>
#include <string>
#include <queue>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <ctype.h>
#include <map>
#include <vector>
#include <algorithm>
#include <set>
#define ll long long
using namespace std;
const int INF = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const int N = 100000+5;
//  const int M = ;
int n,m;
struct Edge {
    int v,d,c;
    int next;
}edge[N];
int head[N], dis[N], tot;
int cost[N];
int vis[N];
void addedge(int u, int v, int d,int c) {
    edge[tot].v = v;
    edge[tot].d = d;
    edge[tot].c = c;
    edge[tot].next = head[u];
    head[u] = tot++;
}
void spfa(int s,int n)
    {
        queue<int>q;
        while(!q.empty())q.pop();
        for(int i=1;i<=n;i++)
            cost[i]=dis[i]=INF;
        memset(vis,false,sizeof(vis));
        dis[s]=0;
        cost[s]=0;
        vis[s]=true;
        q.push(s);
        while(!q.empty())
        {
            int u=q.front();
            q.pop();
            vis[u]=false;
            for(int i=head[u];i!=-1;i=edge[i].next)
            {
                int to=edge[i].v;
                int val=edge[i].d;
                if(dis[to]>dis[u]+val||(dis[to]==dis[u]+val&&cost[to]>edge[i].c))//有多条最短路时，取花费最小的
                {
                    dis[to]=dis[u]+val;
                    cost[to]=edge[i].c;
                    if(!vis[to])
                    {
                        q.push(to);
                        vis[to]=true;
                    }
                }
            }
        }
    }


int main()
{
   while(scanf("%d%d",&n,&m) && n && m)
   {
       memset(head,-1,sizeof(head));
       memset(cost,0,sizeof(cost));
       tot = 1;
       for(int i = 0; i < m; i++)
       {
           int u,v,d,c;
           scanf("%d%d%d%d",&u,&v,&d,&c);
           addedge(u,v,d,c);
           addedge(v,u,d,c);
       }
       spfa(1,n);
       int ans = 0;
       int ans=0;
            for(int i=1;i<=n;i++)
                ans+=cost[i];
            printf("%d\n",ans);
   }

}



Compiler output:
a.cc: In function 'int main()':
a.cc:84:12: error: redeclaration of 'int ans'
   84 |        int ans=0;
      |            ^~~
a.cc:83:12: note: 'int ans' previously declared here
   83 |        int ans = 0;
      |            ^~~
Language: C++

//
//  main.cpp
//  E - Road Construction
//
//  Created by dhl on 2018/7/18.
//  Copyright © 2018年 dhl. All rights reserved.
//

#include <iostream>
#include <vector>
using namespace std;
int n, m;
struct ac{
    int e, len, pic;
    ac() {}
    ac (int &_e, int &_len, int &_pic) {
        e = _e; len = _len; pic = _pic;
    }
};
const int INF = 0x3f3f3f3f;
vector<ac> vv[10005];
int dis[10005], vis[10005], pic[10005], flag[10005];
int dijkstra() {
    memset(dis, INF, sizeof(dis));
    memset(vis, 0, sizeof(vis));
    memset(flag, 0, sizeof(flag));
    memset(pic, INF, sizeof(pic));
    int ans = 0;
    dis[1] = 0;
    for (int i = 0; i < vv[1].size(); i ++) {
        ac t = vv[1][i];
        pic[t.e] = t.pic;
    }
    pic[1] = 0;
    for (int i = 1; i <= n; i ++) {
        int u = -1, min = INF;
        for (int j = 1; j <= n; j ++) {
            if (!vis[j] && min > dis[j]) {
                u = j; min = dis[j];
            }
        }
        vis[u] = 1;
        for (int j = 0; j < vv[u].size(); j ++) {
            ac t = vv[u][j];
            if (!vis[t.e]) {
                if (dis[u] + t.len < dis[t.e]) {
                    dis[t.e] = dis[u] + t.len;
                    pic[t.e] = t.pic;
                }else if (dis[u] + t.len == dis[t.e] ) {
                    if (pic[t.e] >= t.pic) {
                        pic[t.e] = t.pic;
                    }
                }
            }
        }
    }
    for (int i = 1; i <= n; i ++) {
        ans += pic[i];
    }
    return ans ;
}
int main(int argc, const char * argv[]) {
    while(cin >> n >> m, n, m) {
        for (int i = 0; i < 10005; i ++) {
            vv[i].clear();
        }
        for (int i = 0; i < m; i ++) {
            int s, e, len, pic;
            cin >> s >> e >> len >> pic;
            vv[s].push_back(ac(e, len, pic));
            vv[e].push_back(ac(s, len, pic));
        }
        cout << dijkstra() << endl;    }
    return 0;
}



Compiler output:
a.cc: In function 'int dijkstra()':
a.cc:24:5: error: 'memset' was not declared in this scope
   24 |     memset(dis, INF, sizeof(dis));
      |     ^~~~~~
a.cc:11:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   10 | #include <vector>
  +++ |+#include <cstring>
   11 | using namespace std;
Language: C++

#include<iostream>
#include<cstdio>
using namespace std;
typedef long long ll;
const int maxn=1e4+5,maxm=2e4+5;
const ll inf=1e18;
inline int fa(int u){ return u/2; }
inline int ls(int u){ return u*2; }
inline int rs(int u){ return u*2+1; }
struct heap{
	int hea[maxn],pos[maxn],siz;
	ll *dis;
	heap(ll a[],int n){
		dis=a; siz=n;
		int i;
		for (i=1;i<=n;i++){
			dis[i]=inf; hea[i]=i; pos[i]=i;
		}
	}
	void hswap(int u,int v){
		swap(hea[u],hea[v]);
		pos[hea[u]]=u; pos[hea[v]]=v;
	}
	void update(int u){
		if (u==1) return;
		if (dis[hea[fa(u)]]<=dis[hea[u]]) return;
		hswap(u,fa(u));
		update(fa(u));
	}
	void pushdown(int u){
		int v=u;
		if (ls(u)<=siz&&dis[hea[ls(u)]]<dis[hea[v]]) v=ls(u);
		if (rs(u)<=siz&&dis[hea[rs(u)]]<dis[hea[v]]) v=rs(u);
		if (u==v) return;
		hswap(u,v);
		pushdown(v);
	}
	void change(int u,ll val){
		dis[u]=val;
		update(pos[u]);
		pushdown(pos[u]);
	}
	int pop(){
		hswap(1,siz);
		siz--;
		pushdown(1);
		return hea[siz+1];
	}
};
struct gragh{
	int head[maxn],next[maxm],to[maxm],tot;
	ll wei[maxm],cost[maxn];
	gragh(){
		memset(head,-1,sizeof(head));
		tot=0;
	}
	void clear(){
		memset(head,-1,sizeof(head));
		tot=0;
	}
	void add(int u,int v,ll w,ll c){
		next[tot]=head[u];
		head[u]=tot;
		to[tot]=v;
		wei[tot]=w;
		cost[tot]=c;
		tot++;
	}
	void dijkstra(ll dis[],ll val[],int st,int n){
		heap hp(dis,n);
		hp.change(st,0);
		int i,u,v,ed;
		for (i=1;i<=n;i++) val[i]=inf;
		val[st]=0;
		while (hp.siz){
			u=hp.pop();
			for (ed=head[u];ed!=-1;ed=next[ed]){
				v=to[ed];
				if (dis[v]>dis[u]+wei[ed]){
					dis[v]=dis[u]+wei[ed];
					val[v]=cost[ed];
				}
				else if (dis[v]==dis[u]+wei[ed])
					val[v]=min(val[v],cost[ed]);
			}
		}
	}
};
gragh g;
ll dis[maxn],val[maxn];
int main(){
	int n,m,i,u,v;
	ll w,c,ans;
	while (scanf("%d%d",&n,&m)&&(n||m)){
		g.clear();
		for (i=0;i<m;i++){
			scanf("%d%d%lld%lld",&u,&v,&w,&c);
			g.add(u,v,w,c);
		}
		g.dijkstra(dis,val,1,n);
		ans=0;
		for (i=1;i<=n;i++) ans+=val[i];
		printf("%lld\n",ans);
	}
	return 0;
}


Compiler output:
a.cc: In constructor 'gragh::gragh()':
a.cc:54:17: error: 'memset' was not declared in this scope
   54 |                 memset(head,-1,sizeof(head));
      |                 ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<cstdio>
  +++ |+#include <cstring>
    3 | using namespace std;
a.cc: In member function 'void gragh::clear()':
a.cc:58:17: error: 'memset' was not declared in this scope
   58 |                 memset(head,-1,sizeof(head));
      |                 ^~~~~~
a.cc:58:17: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

// AOJ 2249 (http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2249)
#include<cstdio>
#include<cstring>
#include<limits>
#include<queue>
#include<set>
#include<vector>
#define rep(i,a) for(int i=0;i<(a);++i)
#define itr(it,a) for(auto it=(a).begin();it!=(a).end();++it)
#define clr(a,v) memset((a),(v),sizeof(a))

typedef std::pair<int, int> P;
typedef std::pair<P, int> PP;

const int MAX_N = 10000, INF = std::numeric_limits<int>::max()>>2;

int N, M;
std::vector<PP> G[MAX_N];
bool used[MAX_N];

int main()
{
	while( scanf( "%d%d", &N, &M ), N|M )
	{
		rep( i, N )
			G[i].clear();

		clr( used, 0 );

		rep( i, M )
		{
			int u, v, d, c;
			scanf( "%d%d%d%d", &u, &v, &d, &c );
			--u; --v;
			G[u].push_back( PP( P( d, c ), v ) );
			G[v].push_back( PP( P( d, c ), u ) );
			cost[u][v] = cost[v][u] = c;
		}

		std::priority_queue<PP> pque;
		std::vector<P> d( N, P( INF, INF ) );
		pque.push( PP( P( 0, 0 ), 0 ) );
		d[0] = P( 0, 0 );

		int ans = 0;

		while( !pque.empty() )
		{
			PP p = pque.top(); pque.pop();
			int dist = -p.first.first, cost = -p.first.second, v = p.second;

			if( used[v] )
				continue;

			used[v] = true;
			ans += cost;

			rep( i, G[v].size() )
			{
				PP &e = G[v][i];

				if( d[e.second] > P( dist+e.first.first, e.first.second ) )
				{
					d[e.second] = P( dist+e.first.first, e.first.second );
					pque.push( PP( P( -d[e.second].first, -e.first.second ), e.second ) );
				}
			}
		}

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

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:25: error: 'cost' was not declared in this scope; did you mean 'const'?
   37 |                         cost[u][v] = cost[v][u] = c;
      |                         ^~~~
      |                         const
Language: C++

#pragma  warning (disable:4996)
#include<iostream>
#include<cstdio>
#include<queue>
#include<vector>
using namespace std;
const int maxn = 10050;
const int maxe = 2005000;
const int INF = 1e9;
struct note
{
	int to;
	int w;
	int c;
	int next;//next表示下一条相同起点不同&#32456;点&#36793;的&#32534;号
};
note edge[maxe];
int head[maxn];//head[i]=k 表示以i&#20026;起点的&#36793;的&#32534;号，-1表示没有
int ip;
void init()
{
	memset(head, -1, sizeof(head));
	ip = 0;
}
void addedge(int u, int v, int w, int c)
{
	edge[ip].to = v;
	edge[ip].c = c;
	edge[ip].w = w;
	edge[ip].next = head[u];
	head[u] = ip++;
}
int cost[maxn];
int dis[maxn];
bool vis[maxn];
queue<int>q;
void spfa(int s, int n)
{
	while (!q.empty())q.pop();
	for (int i = 1; i <= n; i++)
		cost[i] = dis[i] = INF;
	memset(vis, false, sizeof(vis));
	dis[s] = 0;
	cost[s] = 0;
	vis[s] = true;
	q.push(s);
	while (!q.empty())
	{
		int u = q.front();
		q.pop();
		vis[u] = false;
		for (int i = head[u]; i != -1; i = edge[i].next)//遍&#21382;起点&#20026;u的所有&#36793;
		{
			int to = edge[i].to;
			int val = edge[i].w;
			if (dis[to]>dis[u] + val || (dis[to] == dis[u] + val&&cost[to]>edge[i].c))//有多条最短路&#26102;，取花&#36153;最小的  
			{
				dis[to] = dis[u] + val;
				cost[to] = edge[i].c;
				if (!vis[to])
				{
					q.push(to);
					vis[to] = true;
				}
			}
		}
	}
}
int main()
{
	int n, m;
	int u, v, w, c;
	while (~scanf("%d%d", &n, &m))
	{
		if (n == 0 && m == 0) break;
		init();
		for (int i = 0; i<m; i++)
		{
			scanf("%d%d%d%d", &u, &v, &c, &w);
			addedge(u, v, c, w);
			addedge(v, u, c, w);
		}
		spfa(1, n);
		int ans = 0;
		for (int i = 1; i <= n; i++)
			ans += cost[i];
		printf("%d\n", ans);
	}
	return 0;
}

Compiler output:
a.cc: In function 'void init()':
a.cc:22:9: error: 'memset' was not declared in this scope
   22 |         memset(head, -1, sizeof(head));
      |         ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include<queue>
  +++ |+#include <cstring>
    5 | #include<vector>
a.cc: In function 'void spfa(int, int)':
a.cc:42:9: error: 'memset' was not declared in this scope
   42 |         memset(vis, false, sizeof(vis));
      |         ^~~~~~
a.cc:42:9: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

#include <cstdio>
#include <iostream>
#include <vector>
#include <queue>
#include <functional>
using namespace std;

const int maxn = 10002;
const int maxm = 20002;

typedef pair<int, int> P;
struct Edge {
    int to, d, c;
    Edge() {}
    Edge(int t, int d, int c) : to(t), d(d), c(c) {}
};

vector<Edge> g[maxn];
int dis[maxn];
int cf[maxn];

int main() {
    //freopen("aoj2249.txt", "r", stdin);
    while (1) {
        int n, m;
        scanf("%d%d", &n, &m);
        if (!n) break;

        for (int i = 1; i <= n+1; i++) {
            g[i].clear();
        }
        for (int i = 0; i < m; i++) {
            int f, t, d, c;
            scanf("%d%d%d%d", &f, &t, &d, &c);
            g[f].push_back(Edge(t, d, c));
            g[t].push_back(Edge(f, d, c));
        }

        fill(dis, dis+n+1, INT_MAX);
        fill(cf, cf+n+1, -1);
        dis[1] = 0;
        cf[1] = 0;

        priority_queue<P, vector<P>, greater<P>> q;
        q.push(P(0, 1));
        while (!q.empty()) {
            P p = q.top();
            q.pop();
            int d = p.first;
            int idx = p.second;
            if (d > dis[idx]) continue;
            for (int i = 0; i < (int) g[idx].size(); i++) {
                Edge& e = g[idx][i];
                if (dis[idx] != INT_MAX && dis[idx] + e.d < dis[e.to]) {
                    dis[e.to] = dis[idx] + e.d;
                    cf[e.to] = e.c;
                    q.push(P(dis[e.to], e.to));
                } else if (dis[idx] != INT_MAX && dis[idx] + e.d == dis[e.to]) {
                    if (e.c < cf[e.to])
                        cf[e.to] = e.c;
                    //q.push(P(dis[e.to], e.to));
                }
            }
        }

        int res = 0;
        for (int i = 2; i <= n; i++) {
            res += cf[i];
        }
        printf("%d\n", res);
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:28: error: 'INT_MAX' was not declared in this scope
   39 |         fill(dis, dis+n+1, INT_MAX);
      |                            ^~~~~~~
a.cc:6:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    5 | #include <functional>
  +++ |+#include <climits>
    6 | using namespace std;
Language: C++

#include?<iostream>
#include?<queue>
#include?<functional>
#include?<cstring>
using?namespace?std;
#define?MAX_V?10240
?
//?从?点from指向?点to的???cost的?
typedef?struct?edge
{
int?to,?distance,?cost;
edge(){}
edge(int?to,?int?distance,?int?cost)?:?to(to),?distance(distance),?cost(cost){}
};
?
//?first?当前最短路径?度，second当前?点?号
typedef?pair<int,?int>?P;
?
//??
vector<edge>?G[MAX_V];
?
//?最短距?
int?d[MAX_V];
//?V是?点数
int?V;
?
//?求解从?点s出?到所有点的最短距?（并非最小花?）
void?dijkstra(int?s)
{
priority_queue<P,?vector<P>,?greater<P>?>?que;
memset(d,?0x3f,?sizeof(d));
d[s]?=?0;
que.push(P(0,?s));
?
while?(!que.empty())
{
P?p?=?que.top();?que.pop();
int?v?=?p.second;
if?(d[v]?<?p.first)?continue;
for?(int?i?=?0;?i?<?G[v].size();?++i)
{
edge?e?=?G[v][i];
if?(d[e.to]?>?d[v]?+?e.distance)
{
d[e.to]?=?d[v]?+?e.distance;
que.push(P(d[e.to],?e.to));
}
}
}
}
?
///////////////////////////SubMain//////////////////////////////////
int?main(int?argc,?char?*argv[])
{
?
int?/*N?=?V,*/?M;
while?(cin?>>?V?>>?M?&&?V)
{
for?(int?i?=?0;?i?<?V;?++i)
{
G[i].clear();
}
for?(int?i?=?0;?i?<?M;?++i)
{
int?u,?v,?d,?c;
cin?>>?u?>>?v?>>?d?>>?c;
--u,?--v;
G[u].push_back(edge(v,?d,?c));
G[v].push_back(edge(u,?d,?c));
}
//?首都是0号
??  dijkstra(0);
int?ans?=?0;
for?(int?i?=?1;?i?<?V;?++i)
{
int?min_cost?=?0x3f3f3f3f;
//?找??足?先距?最短，然后?用最低的那个最低?用
for?(int?j?=?0;?j?<?G[i].size();?++j)
{
if?(d[G[i][j].to]?+?G[i][j].distance?==?d[i]?&&?G[i][j].cost?<?min_cost)
{
min_cost?=?G[i][j].cost;
}
}
ans?+=?min_cost;
}
cout?<<?ans?<<?endl;
}
?
return?0;
}

Compiler output:
a.cc:1:9: error: #include expects "FILENAME" or <FILENAME>
    1 | #include?<iostream>
      |         ^
a.cc:2:9: error: #include expects "FILENAME" or <FILENAME>
    2 | #include?<queue>
      |         ^
a.cc:3:9: error: #include expects "FILENAME" or <FILENAME>
    3 | #include?<functional>
      |         ^
a.cc:4:9: error: #include expects "FILENAME" or <FILENAME>
    4 | #include?<cstring>
      |         ^
a.cc:6:8: error: macro names must be identifiers
    6 | #define?MAX_V?10240
      |        ^
a.cc:5:6: error: expected nested-name-specifier before '?' token
    5 | using?namespace?std;
      |      ^
a.cc:7:1: error: expected unqualified-id before '?' token
    7 | ?
      | ^
a.cc:15:1: error: expected unqualified-id before '?' token
   15 | ?
      | ^
a.cc:18:1: error: expected unqualified-id before '?' token
   18 | ?
      | ^
a.cc:21:1: error: expected unqualified-id before '?' token
   21 | ?
      | ^
a.cc:25:4: error: expected unqualified-id before '?' token
   25 | int?V;
      |    ^
a.cc:26:1: error: expected unqualified-id before '?' token
   26 | ?
      | ^
a.cc:51:1: error: expected unqualified-id before '?' token
   51 | ?
      | ^
Language: C++

#include <iostream>  
#include <stdio.h>  
#include <string.h>  
#include <queue>  
using namespace std;  
const int maxn=10050,maxm=20050,inf=0x3f3f3f3f;  
struct Edge  
{  
    int to,next,dis,cos ;  
}edge[maxm*2];  
struct Pair  
{  
    int D,V,C;  
    Pair(){;}  
    Pair(int d,int c,int v)  
    {  
        D=d,V=v,C=c;  
    }  
    friend bool operator <(const Pair a,const Pair b)  
    {  
        if(a.D!=b.D)  
        return a.D>b.D;  
        else return a.C>b.C;  
    }  
};  
int tot,head[maxn],dist[maxn],cost[maxn];  
bool vis[maxn];  
void init()  
{  
    tot=0;  
    memset(head,-1,sizeof(head));  
}  
void add_edge(int u,int v,int d,int c)  
{  
    edge[tot].to=v;  
    edge[tot].dis=d;  
    edge[tot].cos=c;  
    edge[tot].next=head[u];  
    head[u]=tot++;  
}  
int dijstra(int start)  
{  
    memset(vis,false,sizeof(vis));  
    memset(dist,inf,sizeof(dist));  
    int ans=0;  
    dist[start]=0;  
   // vis[start]=true;  
    priority_queue<Pair>que;  
    que.pus

Compiler output:
a.cc: In function 'int dijstra(int)':
a.cc:49:9: error: 'class std::priority_queue<Pair>' has no member named 'pus'; did you mean 'push'?
   49 |     que.pus
      |         ^~~
      |         push
a.cc:49:12: error: expected '}' at end of input
   49 |     que.pus
      |            ^
a.cc:42:1: note: to match this '{'
   42 | {
      | ^
a.cc:49:12: warning: no return statement in function returning non-void [-Wreturn-type]
   49 |     que.pus
      |            ^
Language: C++

#include <iostream>
#include <cstdio>
#include <queue>
using namespace std;

int n,m,head[10002],top,ans,vis[10002];

struct Edge{
	int v,next,cost,dist;
	Edge(){};
	Edge(int a,int b,int c,int d)
	{
		v=a;dist=b;cost=c;next=d;
	}
}edge[40002];

struct node
{
	int v,dist,cost;
	node(){}
	node(int a,int b,int c){v=a;
	dist=b;cost=c;}
};

bool operator<(node a,node b)
{
	return a.dist==b.dist?a.cost>b.dist:a.dist>b.dist;
}

void add(int a,int b,int c,int d)
{
	Edge tem(b,c,d,head[a]);
	edge[top]=tem;
	head[a]=top;
	top++;
}

void dijkstra()
{
	priority_queue<node>que;
	que.push(node(1,0,0));
	memset(vis,0,sizeof(vis));
	while(!que.empty())
	{
		node tem= que.top();
		que.pop();
		if(vis[tem.v])
			continue ;
		vis[tem.v]=1;
		ans+=tem.cost;
		for(int tem1=head[tem.v];tem1!=-1;tem1=edge[tem1].next)
		{
			que.push(node(edge[tem1].v,edge[tem1].dist+tem.dist,edge[tem1].cost));
		}
	}
}
int main()
{
	while(scanf("%d %d",&n,&m)!=EOF)
	{
		memset(head,-1,sizeof(head));
		top=1;
		ans=0;
		for(int i=1;i<=m;i++)
		{
			int a,b,c,d;
			scanf("%d %d %d %d",&a,&b,&c,&d);
			add(a,b,c,d);
			add(b,a,c,d);
		}
		dijkstra();
		printf("%d\n",ans);

	}
	return 0;
}

Compiler output:
a.cc: In function 'void dijkstra()':
a.cc:42:9: error: 'memset' was not declared in this scope
   42 |         memset(vis,0,sizeof(vis));
      |         ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <queue>
  +++ |+#include <cstring>
    4 | using namespace std;
a.cc: In function 'int main()':
a.cc:61:17: error: 'memset' was not declared in this scope
   61 |                 memset(head,-1,sizeof(head));
      |                 ^~~~~~
a.cc:61:17: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

#include <iostream>
#include <cstdio>
#include <queue>
#include <cstring>
using namespace std;

int n,m,head[10050],top,ans,vis[10050];

struct Edge{
	int v,next,cost,dist;
	Edge(){};
	Edge(int a,int b,int c,int d)
	{
		v=a;dist=b;cost=c;next=d;
	}
}edge[40100];

struct node
{
	int v,dist,cost;
	node(){}
	node(int a,int b,int c){v=a;
	dist=b;cost=c;}
};

bool operator<(node a,node b)
{
	return a.dist==b.dist?a.cost>b.dist:a.dist>b.dist;
}

void add(int a,int b,int c,int d)
{
	edge[top].v=b;
	edge[top].dist=c;
	edge[top].cost=d;
	edge[top]=tem;
	head[a]=top;
	top++;
}

void dijkstra()
{
	priority_queue<node>que;
	que.push(node(1,0,0));
	memset(vis,0,sizeof(vis));
	while(!que.empty())
	{
		node tem= que.top();
		que.pop();
		if(vis[tem.v])
			continue ;
		vis[tem.v]=1;
		ans+=tem.cost;
		for(int tem1=head[tem.v];tem1!=-1;tem1=edge[tem1].next)
		{
			que.push(node(edge[tem1].v,edge[tem1].dist+tem.dist,edge[tem1].cost));
		}
	}
}
int main()
{
	while(scanf("%d %d",&n,&m)!=EOF)
	{
		if(n==0&&m==0)break;
		memset(head,-1,sizeof(head));
		top=1;
		ans=0;
		for(int i=1;i<=m;i++)
		{
			int a,b,c,d;
			scanf("%d %d %d %d",&a,&b,&c,&d);
			add(a,b,c,d);
			add(b,a,c,d);
		}
		dijkstra();
		printf("%d\n",ans);

	}
	return 0;
}

Compiler output:
a.cc: In function 'void add(int, int, int, int)':
a.cc:36:19: error: 'tem' was not declared in this scope; did you mean 'tm'?
   36 |         edge[top]=tem;
      |                   ^~~
      |                   tm
Language: C++

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <vector>
#include <cmath>
#include <queue>

using namespace std;
#define Fill(a, b) memset(a, b, sizeof(a))
#define Debug(x) cout<<#x<<"="<<(x)<<endl;

typedef pair<int, int> P;
const int inf = 0x1f1f1f1f;
const LL mod = 1000000007;
const int max_n = 10010;
struct edge
{
    int from, to, cost, fee;
};
int n, ans;
int gflag[max_n][max_n], gfee[max_n][max_n];
int d[max_n], pre[max_n];
vector<edge> G[max_n];
void dijkstra(int s);
vector<int> get_path(int t);
int main()
{
    int i = 0, j = 0, k = 0;
    int m, a, b, p, q;
    edge ei;
    while(scanf("%d %d", &n, &m)!=EOF&&n&&m)
    {
        //Fill(gflag, 0);
        ans = 0;
        for(i = 1; i <= n; i++)
            G[i].clear();
        for(i = 0; i < m; i++)
        {
            scanf("%d %d %d %d", &a, &b, &p, &q);
            ei.from = a;
            ei.to = b;
            ei.cost = p;
            ei.fee = q;
            G[a].push_back(ei);
            ei.from = b;
            ei.to = a;
            G[a].push_back(ei);
            gfee[a][b] = q;
            gfee[b][a] = q;
        }
        dijkstra(1);
        /*
        vector<int> path;
        for(i = 2; i <= m; i++)
        {
            path = get_path(i);
            for(j = 0; j < path.size()-1; j++)
            {
                a = path[j];
                b = path[j+1];
                if(!gflag[a][b])
                {
                    ans += gfee[a][b];
                    gflag[a][b] = 1;
                    gflag[b][a] = 1;
                }
            }
        }
        */
        printf("%d\n", ans);
        /*
        for(i = 2; i <= n; i++)
            cout << pre[i] << " ";
        cout << endl;
        */
    }

    return 0;
}
void dijkstra(int s)
{
    int i, j, u, v;
    priority_queue<P, vector<P>, greater<P> > que;
    for(i = 1; i <= n; i++)
    {
        d[i] = inf;
        //min_fee[i] = inf;
    }
    Fill(pre, -1);
    //min_fee[s] = 0;
    d[s] = 0;
    que.push(P(0, s));
    while(!que.empty())
    {
        P pa = que.top();
        que.pop();
        v = pa.second;
        if(d[v] < pa.first)
            continue;
        edge es;
        for(i = 0; i < G[v].size(); i++)
        {
            es = G[v][i];
            if(d[es.to] > d[es.from]+es.cost)
            {
                if(d[es.to]!=inf)
                    ans -= gfee[es.to][pre[es.to]];
                d[es.to] = d[es.from]+es.cost;
                //min_fee[es.to] = //min_fee[es.from]+es.fee;
                ans += es.fee;
                pre[es.to] = es.from;
                que.push(P(d[es.to], es.to));
            }
            else if((d[es.to]==d[es.from]+es.cost)&&(gfee[es.to][pre[es.to]]>es.fee))
            {

                //min_fee[es.to] = //min_fee[es.from]+es.fee;
                ans = ans - gfee[es.to][pre[es.to]] + es.fee;
                pre[es.to] = es.from;
            }
        }
    }
}

Compiler output:
a.cc:16:7: error: 'LL' does not name a type
   16 | const LL mod = 1000000007;
      |       ^~
Language: C++

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string>

#define rp(i,a,b) for(int (i)=(int)(a);i<(int)(b);++i)



#define MAX_E 100000
#define MAX_V 1000
#define INF INT_MAX


using namespace std;
struct edge{int to,cost,dis;};
typedef tuple<int ,int > P;
int V;
vector<edge> G[MAX_V];
int d[MAX_V];
int d1[MAX_V];


int dijkstra(int s){
    int ans=0;
    priority_queue< P,vector<P>,greater<P> > que;
    fill(d,d + V,INF);
    fill(d1,d1 + V,INF);
    d[s] = 0;
    d1[s] = 0;
    que.push(P(0,s));


    while(!que.empty()){
        P p = que.top();que.pop();
        int v = get<1>(p);
        if (d[v] < get<0>(p)  or  v >= V) continue;
        for(int i = 0; i < G[v].size(); i++){
            
            edge e = G[v][i];
            if (d[e.to] >= d[v] + e.dis){
                d[e.to] = d[v] + e.dis;
                d1[e.to] = e.cost;
                que.push(P(d[e.to],e.to));
            }
        }
    }
    rp(i,0,V) {ans+=d1[i];}
    return ans;

}
int main(){
    while(1){
        int a,b;
        scanf("%d %d",&a,&b);
        if(a==0 and b==0) break;
        V=a;
        for(int i=0;i<a;i++) G[i].clear();
        for(int i=0;i<b;i++){
            
            int v,w,x,y;
            scanf("%d %d %d %d",&v,&w,&x,&y);
            v--;
            w--;
            edge e;
            e.to=w;
            e.cost=y;
            e.dis=x;
            G[v].push_back(e);
            e.to=v;
            G[w].push_back(e);
            
        }
        int ans=dijkstra(0);
        
        cout << ans << endl;
    }

    return 0;

}

Compiler output:
a.cc: In function 'int dijkstra(int)':
a.cc:28:13: error: 'INT_MAX' was not declared in this scope
   28 | #define INF INT_MAX
      |             ^~~~~~~
a.cc:43:18: note: in expansion of macro 'INF'
   43 |     fill(d,d + V,INF);
      |                  ^~~
a.cc:20:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   19 | #include <ctime>
  +++ |+#include <climits>
   20 | #include <string>
Language: C++

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string>

#define rp(i,a,b) for(int (i)=(int)(a);i<(int)(b);++i)



#define MAX_E 100000
#define MAX_V 1000
#define INF INT_MAX


using namespace std;
struct edge{int to,cost,dis;};
typedef pair<int ,int> P;
int V;
vector<edge> G[MAX_V];
int d[MAX_V];
int d1[MAX_V];


int dijkstra(int s){
    int ans=0;
    priority_queue< P,vector<P>,greater<P> > que;
    fill(d,d + V,INF);
    fill(d1,d1 + V,INF);
    d[s] = 0;
    d1[s] = 0;
    que.push(P(0,s));


    while(!que.empty()){
        P p = que.top();que.pop();
        int v = p.second;
        if (d[v] < p.first  or  v >= V) continue;
        for(int i = 0; i < G[v].size(); i++){
            
            edge e = G[v][i];
            if (d[e.to] >= d[v] + e.dis){
                d[e.to] = d[v] + e.dis;
                d1[e.to] = e.cost;
                que.push(P(d[e.to],e.to));
            }
        }
    }
    rp(i,0,V) {ans+=d1[i];}
    return ans;

}
int main(){
    while(1){
        int a,b;
        scanf("%d %d",&a,&b);
        if(a==0 and b==0) break;
        V=a;
        for(int i=0;i<a;i++) G[i].clear();
        for(int i=0;i<b;i++){
            
            int v,w,x,y;
            scanf("%d %d %d %d",&v,&w,&x,&y);
            v--;
            w--;
            edge e;
            e.to=w;
            e.cost=y;
            e.dis=x;
            G[v].push_back(e);
            e.to=v;
            G[w].push_back(e);
            
        }
        int ans=dijkstra(0);
        
        cout << ans << endl;
    }

    return 0;

}

Compiler output:
a.cc: In function 'int dijkstra(int)':
a.cc:28:13: error: 'INT_MAX' was not declared in this scope
   28 | #define INF INT_MAX
      |             ^~~~~~~
a.cc:43:18: note: in expansion of macro 'INF'
   43 |     fill(d,d + V,INF);
      |                  ^~~
a.cc:20:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   19 | #include <ctime>
  +++ |+#include <climits>
   20 | #include <string>
Language: C++

#include<iostream>
#include<tuple>
#include<vector>
#include<functional>
#include<queue>
using namespace std;
vector<tuple<int, int, int>>x[12000];
int n, m, a, b, c, d, dist[12000]; bool used[12000];
void dijkstra() {
	priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>>Q;
	for (int i = 0; i < 12000; i++)dist[i] = 999999999;
	Q.push(make_pair(0, 1)); dist[1] = 0;
	while (!Q.empty()) {
		int a1 = Q.top().first, a2 = Q.top().second; Q.pop();
		for (int i = 0; i < x[a2].size(); i++) {
			int to = get<0>(x[a2][i]), cost = get<1>(x[a2][i]);
			if (dist[to] > a1 + cost) {
				dist[to] = a1 + cost;
				Q.push(make_pair(dist[to], to));
			}
		}
	}
}
int main() {
	while (true) {
		cin >> n >> m; if (n == 0 && m == 0)break;
		for (int i = 0; i < 12000; i++) { x[i].clear(); used[i] = false; }
		for (int i = 0; i < m; i++) {
			cin >> a >> b >> c >> d;
			x[a].push_back(make_tuple(b, c, d));
			x[b].push_back(make_tuple(a, c, d));
		}
		dijkstra();
		vector<pair<int, int>>vec2;
		for (int i = 2; i <= n; i++)vec2.push_back(make_pair(dist[i], i));
		sort(vec2.begin(), vec2.end());
		int sum = 0; used[1] = true;
		for (int i = 0; i < vec2.size(); i++) {
			int a1 = vec2[i].second;
			vector<int>vec3;
			for (int j = 0; j < x[a1].size(); j++) {
				int to = get<0>(x[a1][j]), cost = get<1>(x[a1][j]), cost2 = get<2>(x[a1][j]);
				if (used[to] == false)continue;
				if (dist[to] + cost == dist[a1])vec3.push_back(cost2);
			}
			sort(vec3.begin(), vec3.end());
			sum += vec3[0]; used[a1] = true;
		}
		cout << sum << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:17: error: 'sort' was not declared in this scope; did you mean 'short'?
   36 |                 sort(vec2.begin(), vec2.end());
      |                 ^~~~
      |                 short
Language: C++

#include <iostream>
#include <cstring>
#include <queue>
#include <cstdio>
#define inf 0x3f3f3f3f
#define maxm 10005
#define maxn 20005*2

using namespace std;

int m,n;
int edgenum,head[maxm],dis[maxm],num[maxm],ans;
bool vis[maxm];

struct node
{
    int from,to,len,cost,next;
}edge[maxn];

void init()
{
    memset(head,-1,sizeof(head));
    memset(vis,0,sizeof(vis));
    memset(dis,inf,sizeof(dis));
    memset(num,inf,sizeof(num));
    edgenum=0;
}

void add(int u,int v,int len,int cost)
{
    node tp={u,v,len,cost,head[u]};
    edge[edgenum]=tp;
    head[u]=edgenum++;
}

int SPFA(int st)
{
     queue<int> q;
     q.push(st);
     vis[st]=1;
     dis[st]=0;
     num[st]=0;
     ans=0;
     while(!q.empty())
     {
          int tmp=q.front();
          q.pop();
          vis[tmp]=0;
          for(int i=head[tmp];i!=-1;i=edge[i].next)
          {
                if((dis[edge[i].to]==dis[tmp]+edge[i].len)&&(num[edge[i].to]>edge[i].cost))
                    num[edge[i].to]=edge[i].cost;
                if(dis[edge[i].to]>dis[tmp]+edge[i].len)
                {
                    dis[edge[i].to]=dis[tmp]+edge[i].len;
                    num[edge[i].to]=edge[i].cost;
                    if(!vis[edge[i].to])
                    {
                        q.push(edge[i].to);
                        vis[edge[i].to]=1;
                    }
                }
          }
     }
     for(int i=1;i<=m;i++)
        ans+=num[i];
     return ans;
}

int main()
{
    int u,v,len,cost;
    while(cin>>m>>n&&m)
    {
        init();
        for(int i=1;i<=n;i++)
        {
            scanf("%d%d%d%d",&from,&to,&len,&cost);
            add(u,v,len,cost);
            add(v,u,len,cost);
        }
        cout<<SPFA(1)<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:78:31: error: 'from' was not declared in this scope
   78 |             scanf("%d%d%d%d",&from,&to,&len,&cost);
      |                               ^~~~
a.cc:78:37: error: 'to' was not declared in this scope; did you mean 'tm'?
   78 |             scanf("%d%d%d%d",&from,&to,&len,&cost);
      |                                     ^~
      |                                     tm
Language: C++

/*************************************************************************
    > File Name: aoj2249.cpp
    > Author:    WArobot 
    > Blog:      http://www.cnblogs.com/WArobot/ 
    > Created Time: 2017??´06???20??\ ????????? 15??¶23???28?§?
 ************************************************************************/

#include<bits/stdc++.h>
using namespace std;

const int MAX_N = 12345;
const int MAX_M = 20010;
const int INF = 1e9;

struct edge{
	int to , cost , money;
	edge(int tt , int tc , int tm) : to(tt) , cost(tc) , money(tm) {} ;
};
typedef pair<int,int> P;

vector< edge > G[MAX_N];
int dis[MAX_N];
int n , m;

void Dijkstra(){
	fill(dis,dis+n+1,INF);
	dis[1] = 0;
	priority_queue< P , vector<P> , greater<P> >	que;
	que.push( P(0,1) );
	while(!que.empty()){
		P p = que.top();	que.pop();
		int v = p.second;
		if( dis[v] < p.first )	continue;
		for(int i = 0 ; i < G[v].size() ; i++){
			edge e = G[v][i];
			if( dis[e.to] > dis[v] + e.cost ){
				dis[e.to] = dis[v] + e.cost;
				que.push( P(dis[e.to] , e.to) );
			}
		}
	}
}
int main(){
	int u , v , cost , money;
	while(~scanf("%d%d",&n,&m)){
		if( n == 0 && m == 0 )	break;
		for(int i = 0 ; i <= n ; i++)	G[i].clear();
		for(int i = 0 ; i < m ; i++){
			scanf("%d%d%d%d",&u,&v,&cost,&money);
			G[u].push_back( edge(v,cost,money) );
			G[v].push_back( edge(u,cost,money) );
		}
		Dijkstra();
		int ans = 0;
		for(int i = 2 ; i <= n ; i++){
			int min_money = 0x3f3f3f3f;
			// ????????????????¶???????????????¶????´???¨???????????£??????????´???¨
			for(int j = 0 ; j < G[i].size() ; j++){
				edge e = G[i][j];
				if( dis[ e.to ] + e.cost == dis[i] && min_money > e.money ){
					min_money = e.money;
				}
			}
			if( min_money != 0x3f3f3f3f )
				ans += min_money;
		}
		printf("%d\n",ans);
	}
	return 0;
}v

Compiler output:
a.cc:70:2: error: 'v' does not name a type
   70 | }v
      |  ^