Language: C++

#ifndef LOCAL
#define EVAL 1
#endif

#ifndef EVAL
#include <template.h>
#endif

int main(){
	int n, m, c;
	scanf("%d%d%d", &n, &m, &c);
	map<int, vector<pair<int, ll>>> road;
	ll sum = 0;
	REP(i, m){
		int a, b;
		ll d;
		scanf("%d%d%I64d", &a, &b, &d);
		a--; b--;
		road[a].PB(pil(b, d));
		road[b].PB(pil(a, d));
		sum+=d;
	}

	priority_queue<pli, vector<pli>, greater<pli>> q;
	q.push(pli(0, 0));
	set<int> reach;
	vector<pil> cand;
	while(q.size()){
		pli top = q.top(); q.pop();
		int i = top.second;
		if(EXIST(reach, i)) continue;
		reach.insert(i);
		cand.PB(pil(i, top.first));
		EACH(it, road[i]){
			if(!EXIST(reach, it->first)){
				q.push(pli(top.first+it->second, it->first));
			}
		}
	}

	ll mincost = LLONG_MAX;
	reach.clear();
	EACH(it, cand){
		int i = it->first;
		EACH(it2, road[i]){
			if(EXIST(reach, it2->first)){
				sum-=it2->second;
			}
		}
		reach.insert(i);
		ll cost = it->second * c + sum;
		if(mincost>cost) mincost=cost;
	//	printf("%d %I64d*%d+%I64d=%I64d\n", i, it->second, c, sum, cost);
	}
	printf("%I64d\n", mincost);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'scanf' was not declared in this scope
   11 |         scanf("%d%d%d", &n, &m, &c);
      |         ^~~~~
a.cc:12:9: error: 'map' was not declared in this scope
   12 |         map<int, vector<pair<int, ll>>> road;
      |         ^~~
a.cc:12:13: error: expected primary-expression before 'int'
   12 |         map<int, vector<pair<int, ll>>> road;
      |             ^~~
a.cc:13:9: error: 'll' was not declared in this scope
   13 |         ll sum = 0;
      |         ^~
a.cc:14:13: error: 'i' was not declared in this scope
   14 |         REP(i, m){
      |             ^
a.cc:14:9: error: 'REP' was not declared in this scope
   14 |         REP(i, m){
      |         ^~~
a.cc:24:9: error: 'priority_queue' was not declared in this scope
   24 |         priority_queue<pli, vector<pli>, greater<pli>> q;
      |         ^~~~~~~~~~~~~~
a.cc:24:24: error: 'pli' was not declared in this scope
   24 |         priority_queue<pli, vector<pli>, greater<pli>> q;
      |                        ^~~
a.cc:24:29: error: 'vector' was not declared in this scope
   24 |         priority_queue<pli, vector<pli>, greater<pli>> q;
      |                             ^~~~~~
a.cc:24:40: error: expected primary-expression before ',' token
   24 |         priority_queue<pli, vector<pli>, greater<pli>> q;
      |                                        ^
a.cc:24:42: error: 'greater' was not declared in this scope
   24 |         priority_queue<pli, vector<pli>, greater<pli>> q;
      |                                          ^~~~~~~
a.cc:24:56: error: 'q' was not declared in this scope
   24 |         priority_queue<pli, vector<pli>, greater<pli>> q;
      |                                                        ^
a.cc:26:9: error: 'set' was not declared in this scope
   26 |         set<int> reach;
      |         ^~~
a.cc:26:13: error: expected primary-expression before 'int'
   26 |         set<int> reach;
      |             ^~~
a.cc:27:16: error: 'pil' was not declared in this scope
   27 |         vector<pil> cand;
      |                ^~~
a.cc:27:21: error: 'cand' was not declared in this scope
   27 |         vector<pil> cand;
      |                     ^~~~
a.cc:29:20: error: expected ';' before 'top'
   29 |                 pli top = q.top(); q.pop();
      |                    ^~~~
      |                    ;
a.cc:30:25: error: 'top' was not declared in this scope
   30 |                 int i = top.second;
      |                         ^~~
a.cc:31:26: error: 'reach' was not declared in this scope
   31 |                 if(EXIST(reach, i)) continue;
      |                          ^~~~~
a.cc:31:20: error: 'EXIST' was not declared in this scope
   31 |                 if(EXIST(reach, i)) continue;
      |                    ^~~~~
a.cc:32:17: error: 'reach' was not declared in this scope
   32 |                 reach.insert(i);
      |                 ^~~~~
a.cc:34:22: error: 'it' was not declared in this scope; did you mean 'i'?
   34 |                 EACH(it, road[i]){
      |                      ^~
      |                      i
a.cc:34:26: error: 'road' was not declared in this scope
   34 |                 EACH(it, road[i]){
      |                          ^~~~
a.cc:34:17: error: 'EACH' was not declared in this scope
   34 |                 EACH(it, road[i]){
      |                 ^~~~
a.cc:41:11: error: expected ';' before 'mincost'
   41 |         ll mincost = LLONG_MAX;
      |           ^~~~~~~~
      |           ;
a.cc:42:9: error: 'reach' was not declared in this scope
   42 |         reach.clear();
      |         ^~~~~
a.cc:43:14: error: 'it' was not declared in this scope; did you mean 'int'?
   43 |         EACH(it, cand){
      |              ^~
      |              int
a.cc:43:9: error: 'EACH' was not declared in this scope
   43 |         EACH(it, cand){
      |         ^~~~
a.cc:55:27: error: 'mincost' was not declared in this scope
   55 |         printf("%I64d\n", mincost);
      |                           ^~~~~~~
a.cc:55:9: error: 'printf' was not declared in this scope
   55 |         printf("%I64d\n", mincost);
      |         ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | #ifndef LOCAL