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 __int64 LL;
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:13:9: error: '__int64' does not name a type; did you mean '__int64_t'?
   13 | typedef __int64 LL;
      |         ^~~~~~~
      |         __int64_t
a.cc:16:7: error: 'LL' does not name a type
   16 | const LL mod = 1000000007;
      |       ^~