Language: C++

//繝ゥ繧、繝悶Λ繝ェ繝?せ繝?#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 25;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };


int n, s, g, c;

VVI _map;
//繝ッ繝シ繧キ繝」繝ォ繝輔Ο繧、繝?void warshall_floyd( VVI &root ) {
	for ( int i = 0; i < root.size(); i++ ) {
		for ( int j = 0; j < root.size(); j++ ) {
			for ( int k = 0; k < root.size(); k++ ) {
				root[ j ][ k ] = root[ k ][ j ] = min( root[ j ][ k ], root[ j ][ i ] + root[ i ][ k ] );
			}
		}
	}
}

//繝ヲ繝シ繧ー繝ェ繝?ラ莠帝勁豕?int gcd( int n, int m ) {
	if ( m == 0 ) {
		return n;
	}
	return gcd( m, n % m );
}

//邏?焚縺ョ驟榊?繧剃ス懈?
void make_prime( VI &pm, int max ) {
	vector<bool> is_pm( max + 1, true );
	is_pm[ 0 ] = is_pm[ 1 ] = false;
	for ( int i = 2; i * i <= max; i += 2 ) {
		if ( is_pm[ i ] ) {
			for ( int j = i * i; j <= max; j += i ) {
				is_pm[ j ] = false;
				if ( i != 2 ) {
					j += i;
				}
			}
			if ( i == 2 ) {
				--i;
			}
		}
	}
	for ( int i = 2; i <= max; i += 2 ) {
		if ( is_pm[ i ] ) {
			pm.push_back( i );
			if ( i == 2 ) {
				--i;
			}
		}
	}
}


int main() {
	while ( ~scanf( "%d", &n ) && n ) {
		_map.resize( 100 );
		for ( int i = 0; i < 100; i++ ) {
			_map[ i ].resize( 100 );
			for ( int j = 0; j < 100; j++ ) {
				if ( i == j ) {
					_map[ i ][ j ] = 0;
				}
				else {
					_map[ i ][ j ] = INF;
				}
			}
		}
		int max_town = 0;
		for ( int i = 0; i < n; i++ ) {
			scanf( "%d %d %d", &s, &g, &c );
			_map[ s ][ g ] = _map[ g ][ s ] = c;
			max_town = max( max_town, max( g, s ) + 1 );
		}
		warshall_floyd( _map );
		int ans_cost = INF, ans_town;
		for ( int i = 0; i < max_town; i++ ) {
			int cost = 0;
			for ( int j = 0; j < max_town; j++ ) {
				cost += _map[ i ][ j ];
			}
			if ( ans_cost > cost ) {
				ans_cost = cost;
				ans_town = i;
			}
		}
		printf( "%d %d\n", ans_town, ans_cost );
	}
	return 0;
}

Compiler output:
a.cc:20:9: error: 'vector' does not name a type
   20 | typedef vector<int> VI;
      |         ^~~~~~
a.cc:21:9: error: 'vector' does not name a type
   21 | typedef vector<VI> VVI;
      |         ^~~~~~
a.cc:22:9: error: 'vector' does not name a type
   22 | typedef vector<string> VS;
      |         ^~~~~~
a.cc:23:9: error: 'pair' does not name a type
   23 | typedef pair<int, int> PII;
      |         ^~~~
a.cc:25:9: error: 'vector' does not name a type
   25 | typedef vector<LL> VLL;
      |         ^~~~~~
a.cc:26:9: error: 'vector' does not name a type
   26 | typedef vector<VLL> VVLL;
      |         ^~~~~~
a.cc:29:9: error: 'priority_queue' does not name a type
   29 | typedef priority_queue<int> maxpq;
      |         ^~~~~~~~~~~~~~
a.cc:30:9: error: 'priority_queue' does not name a type
   30 | typedef priority_queue< int, vector<int>, greater<int> > minpq;
      |         ^~~~~~~~~~~~~~
a.cc:32:26: error: 'acos' was not declared in this scope
   32 | static const double PI = acos( -1.0 );
      |                          ^~~~
a.cc:42:1: error: 'VVI' does not name a type
   42 | VVI _map;
      | ^~~
a.cc:44:9: error: expected unqualified-id before 'for'
   44 |         for ( int i = 0; i < root.size(); i++ ) {
      |         ^~~
a.cc:44:26: error: 'i' does not name a type
   44 |         for ( int i = 0; i < root.size(); i++ ) {
      |                          ^
a.cc:44:43: error: 'i' does not name a type
   44 |         for ( int i = 0; i < root.size(); i++ ) {
      |                                           ^
a.cc:51:1: error: expected declaration before '}' token
   51 | }
      | ^
a.cc:54:9: error: expected unqualified-id before 'if'
   54 |         if ( m == 0 ) {
      |         ^~
a.cc:57:9: error: expected unqualified-id before 'return'
   57 |         return gcd( m, n % m );
      |         ^~~~~~
a.cc:58:1: error: expected declaration before '}' token
   58 | }
      | ^
a.cc:61:6: error: variable or field 'make_prime' declared void
   61 | void make_prime( VI &pm, int max ) {
      |      ^~~~~~~~~~
a.cc:61:18: error: 'VI' was not declared in this scope; did you mean 'PI'?
   61 | void make_prime( VI &pm, int max ) {
      |                  ^~
      |                  PI
a.cc:61:22: error: 'pm' was not declared in this scope
   61 | void make_prime( VI &pm, int max ) {
      |                      ^~
a.cc:61:26: error: expected primary-expression before 'int'
   61 | void make_prime( VI &pm, int max ) {
      |                          ^~~
a.cc: In function 'int main()':
a.cc:89:18: error: 'scanf' was not declared in this scope
   89 |         while ( ~scanf( "%d", &n ) && n ) {
      |                  ^~~~~
a.cc:90:17: error: '_map' was not declared in this scope
   90 |                 _map.resize( 100 );
      |                 ^~~~
a.cc:106:51: error: 'max' was not declared in this scope
  106 |                         max_town = max( max_town, max( g, s ) + 1 );
      |                                                   ^~~
a.cc:106:36: error: 'max' was not declared in this scope
  106 |                         max_town = max( max_town, max( g, s ) + 1 );
      |                                    ^~~
a.cc:108:17: error: 'warshall_floyd' was not declared in this scope
  108 |                 warshall_floyd( _map );
      |                 ^~~~~~~~~~~~~~
a.cc:120:17: error: 'printf' was not declared in this scope
  120 |                 printf( "%d %d\n", ans_town, ans_cost );
      |                 ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | //繝ゥ繧、繝悶Λ繝ェ繝?せ繝?#include <bits/stdc++.h>