Language: C++

#include<iostream>
#define MAXN 32

using namespace std;

const int infty = 1<<24;

int dfs(int now, int n, int par[MAXN], bool vis[MAXN], bool leaf[MAXN], int W[MAXN][MAXN]){
ÃÂ ÃÂ int ret = 0;
ÃÂ ÃÂ int cnt = 0;
ÃÂ ÃÂ vis[now]=true;
ÃÂ ÃÂ for(int i = 0; i < n; ++i){
ÃÂ ÃÂ  ÃÂ if(W[now][i]>0 && !vis[i]){
ÃÂ ÃÂ  ÃÂ  ÃÂ ret += 2*W[now][i];
ÃÂ ÃÂ  ÃÂ  ÃÂ ++cnt;
ÃÂ ÃÂ  ÃÂ  ÃÂ par[i]=now;
ÃÂ ÃÂ  ÃÂ  ÃÂ ret += dfs(i,n,par,vis,leaf,W);
ÃÂ ÃÂ  ÃÂ  ÃÂ if(leaf[i])
	ret -= 2*W[now][i];
ÃÂ ÃÂ  ÃÂ }
ÃÂ ÃÂ }
ÃÂ ÃÂ if(cnt==0)leaf[now]=true;
ÃÂ ÃÂ return ret;
}

int solve(int n, int W[MAXN][MAXN]){
ÃÂ ÃÂ int ret = infty;
ÃÂ ÃÂ for(int i = 0; i < n; ++i){
ÃÂ ÃÂ  ÃÂ bool leaf[MAXN]={false,};
ÃÂ ÃÂ  ÃÂ bool vis[MAXN]={false,};
ÃÂ ÃÂ  ÃÂ int par[MAXN];
ÃÂ ÃÂ  ÃÂ int D = dfs(i,n,par,vis,leaf,W);
ÃÂ ÃÂ  ÃÂ int maxD = 0;
ÃÂ ÃÂ  ÃÂ for(int j = 0; j < n; ++j){
ÃÂ ÃÂ  ÃÂ  ÃÂ if( !leaf[j] && W[i][j] > 0 ){
	maxD = max( maxD, W[i][j] );
ÃÂ ÃÂ  ÃÂ  ÃÂ }
ÃÂ ÃÂ  ÃÂ }
ÃÂ ÃÂ  ÃÂ //cout << i << ' ' << D << ' ' << maxD << endl; ÃÂ ÃÂ 
ÃÂ ÃÂ  ÃÂ if(i!=0){
ÃÂ ÃÂ  ÃÂ  ÃÂ int c = 0;
ÃÂ ÃÂ  ÃÂ  ÃÂ int p = par[c];
ÃÂ ÃÂ  ÃÂ  ÃÂ while(p!=i){
	if(!leaf[c])
	 ÃÂ D -= W[c][p];
	c = p;
	p = par[c];
ÃÂ ÃÂ  ÃÂ  ÃÂ }
ÃÂ ÃÂ  ÃÂ  ÃÂ if(leaf[0]){
	D += W[par[0]][0];
ÃÂ ÃÂ  ÃÂ  ÃÂ }
ÃÂ ÃÂ  ÃÂ }
ÃÂ ÃÂ  ÃÂ //cout << D << endl;
ÃÂ ÃÂ  ÃÂ 
ÃÂ ÃÂ  ÃÂ ret = min( ret, D - maxD );
ÃÂ ÃÂ }
ÃÂ ÃÂ return ret;
}

int main()
{
ÃÂ ÃÂ while(true){
ÃÂ ÃÂ  ÃÂ int n;
ÃÂ ÃÂ  ÃÂ int W[MAXN][MAXN]={{0,},}; // 0 means unconnected
ÃÂ ÃÂ  ÃÂ cin >> n;
ÃÂ ÃÂ  ÃÂ //cout << n << endl;
ÃÂ ÃÂ  ÃÂ if( n == 0 ) break;
ÃÂ ÃÂ  ÃÂ for(int i = 0; i < n-1; ++i){
ÃÂ ÃÂ  ÃÂ  ÃÂ int a,b,t;
ÃÂ ÃÂ  ÃÂ  ÃÂ cin >> a >> b >> t;
ÃÂ ÃÂ  ÃÂ  ÃÂ --a;--b;
ÃÂ ÃÂ  ÃÂ  ÃÂ W[a][b] = W[b][a] = t;
ÃÂ ÃÂ  ÃÂ }
ÃÂ ÃÂ  ÃÂ cout << solve(n,W) << endl;
ÃÂ ÃÂ }
ÃÂ ÃÂ return 0;
}

Compiler output:
a.cc:9:1: error: extended character  is not valid in an identifier
    9 | ÃÂ ÃÂ int ret = 0;
      | ^
a.cc:9:1: error: extended character   is not valid in an identifier
a.cc:9:1: error: extended character  is not valid in an identifier
a.cc:9:1: error: extended character   is not valid in an identifier
a.cc:10:1: error: extended character  is not valid in an identifier
   10 | ÃÂ ÃÂ int cnt = 0;
      | ^
a.cc:10:1: error: extended character   is not valid in an identifier
a.cc:10:1: error: extended character  is not valid in an identifier
a.cc:10:1: error: extended character   is not valid in an identifier
a.cc:11:1: error: extended character  is not valid in an identifier
   11 | ÃÂ ÃÂ vis[now]=true;
      | ^
a.cc:11:1: error: extended character   is not valid in an identifier
a.cc:11:1: error: extended character  is not valid in an identifier
a.cc:11:1: error: extended character   is not valid in an identifier
a.cc:12:1: error: extended character  is not valid in an identifier
   12 | ÃÂ ÃÂ for(int i = 0; i < n; ++i){
      | ^
a.cc:12:1: error: extended character   is not valid in an identifier
a.cc:12:1: error: extended character  is not valid in an identifier
a.cc:12:1: error: extended character   is not valid in an identifier
a.cc:13:1: error: extended character  is not valid in an identifier
   13 | ÃÂ ÃÂ  ÃÂ if(W[now][i]>0 && !vis[i]){
      | ^
a.cc:13:1: error: extended character   is not valid in an identifier
a.cc:13:1: error: extended character  is not valid in an identifier
a.cc:13:1: error: extended character   is not valid in an identifier
a.cc:13:10: error: extended character  is not valid in an identifier
   13 | ÃÂ ÃÂ  ÃÂ if(W[now][i]>0 && !vis[i]){
      |          ^
a.cc:13:10: error: extended character   is not valid in an identifier
a.cc:14:1: error: extended character  is not valid in an identifier
   14 | ÃÂ ÃÂ  ÃÂ  ÃÂ ret += 2*W[now][i];
      | ^
a.cc:14:1: error: extended character   is not valid in an identifier
a.cc:14:1: error: extended character  is not valid in an identifier
a.cc:14:1: error: extended character   is not valid in an identifier
a.cc:14:10: error: extended character  is not valid in an identifier
   14 | ÃÂ ÃÂ  ÃÂ  ÃÂ ret += 2*W[now][i];
      |          ^
a.cc:14:10: error: extended character   is not valid in an identifier
a.cc:14:15: error: extended character  is not valid in an identifier
   14 | ÃÂ ÃÂ  ÃÂ  ÃÂ ret += 2*W[now][i];
      |               ^
a.cc:14:15: error: extended character   is not valid in an identifier
a.cc:15:1: error: extended character  is not valid in an identifier
   15 | ÃÂ ÃÂ  ÃÂ  ÃÂ ++cnt;
      | ^
a.cc:15:1: error: extended character   is not valid in an identifier
a.cc:15:1: error: extended character  is not valid in an identifier
a.cc:15:1: error: extended character   is not valid in an identifier
a.cc:15:10: error: extended character  is not valid in an identifier
   15 | ÃÂ ÃÂ  ÃÂ  ÃÂ ++cnt;
      |          ^
a.cc:15:10: error: extended character   is not valid in an identifier
a.cc:15:15: error: extended character  is not valid in an identifier
   15 | ÃÂ ÃÂ  ÃÂ  ÃÂ ++cnt;
      |               ^
a.cc:15:15: error: extended character   is not valid in an identifier
a.cc:16:1: error: extended character  is not valid in an identifier
   16 | ÃÂ ÃÂ  ÃÂ  ÃÂ par[i]=now;
      | ^
a.cc:16:1: error: extended character   is not valid in an identifier
a.cc:16:1: error: extended character  is not valid in an identifier
a.cc:16:1: error: extended character   is not valid in an identifier
a.cc:16:10: error: extended character  is not valid in an identifier
   16 | ÃÂ ÃÂ  ÃÂ  ÃÂ par[i]=now;
      |          ^
a.cc:16:10: error: extended character   is not valid in an identifier
a.cc:16:15: error: extended character  is not valid in an identifier
   16 | ÃÂ ÃÂ  ÃÂ  ÃÂ par[i]=now;
      |               ^
a.cc:16:15: error: extended character   is not valid in an identifier
a.cc:17:1: error: extended character  is not valid in an identifier
   17 | ÃÂ ÃÂ  ÃÂ  ÃÂ ret += dfs(i,n,par,vis,leaf,W);
      | ^
a.cc:17:1: error: extended character   is not valid in an identifier
a.cc:17:1: error: extended character  is not valid in an identifier
a.cc:17:1: error: extended character   is not valid in an identifier
a.cc:17:10: error: extended character  is not valid in an identifier
   17 | ÃÂ ÃÂ  ÃÂ  ÃÂ ret += dfs(i,n,par,vis,leaf,W);
      |          ^
a.cc:17:10: error: extended character   is not valid in an identifier
a.cc:17:15: error: extended character  is not valid in an identifier
   17 | ÃÂ ÃÂ  ÃÂ  ÃÂ ret += dfs(i,n,par,vis,leaf,W);
      |               ^
a.cc:17:15: error: extended character   is not valid in an identifier
a.cc:18:1: error: extended character  is not valid in an identifier
   18 | ÃÂ ÃÂ  ÃÂ  ÃÂ if(leaf[i])
      | ^
a.cc:18:1: error: extended character   is not valid in an identifier
a.cc:18:1: error: extended character  is not valid in an identifier
a.cc:18:1: error: extended character   is not valid in an identifier
a.cc:18:10: error: extended character  is not valid in an identifier
   18 | ÃÂ ÃÂ  ÃÂ  ÃÂ if(leaf[i])
      |          ^
a.cc:18:10: error: extended character   is not valid in an identifier
a.cc:18:15: error: extended character  is not valid in an identifier
   18 | ÃÂ ÃÂ  ÃÂ  ÃÂ if(leaf[i])
      |               ^
a.cc:18:15: error: extended character   is not valid in an identifier
a.cc:20:1: error: extended character  is not valid in an identifier
   20 | ÃÂ ÃÂ  ÃÂ }
      | ^
a.cc:20:1: error: extended character   is not valid in an identifier
a.cc:20:1: error: extended character  is not valid in an identifier
a.cc:20:1: error: extended character   is not valid in an identifier
a.cc:20:10: error: extended character  is not valid in an identifier
   20 | ÃÂ ÃÂ  ÃÂ }
      |          ^
a.cc:20:10: error: extended character   is not valid in an identifier
a.cc:21:1: error: extended character  is not valid in an identifier
   21 | ÃÂ ÃÂ }
      | ^
a.cc:21:1: error: extended character   is not valid in an identifier
a.cc:21:1: error: extended character  is not valid in an identifier
a.cc:21:1: error: extended character   is not valid in an identifier
a.cc:22:1: error: extended character  is not valid in an identifier
   22 | ÃÂ ÃÂ if(cnt==0)leaf[now]=true;
      | ^
a.cc:22:1: error: extended character   is not valid in an identifier
a.cc:22:1: error: extended character  is not valid in an identifier
a.cc:22:1: error: extended character   is not valid in an identifier
a.cc:23:1: error: extended character  is not valid in an identifier
   23 | ÃÂ ÃÂ return ret;
      | ^
a.cc:23:1: error: extended character   is not valid in an identifier
a.cc:23:1: error: extended character  is not valid in an identifier
a.cc:23:1: error: extended character   is not valid in an identifier
a.cc:27:1: error: extended character  is not valid in an identifier
   27 | ÃÂ ÃÂ int ret = infty;
      | ^
a.cc:27:1: error: extended character   is not valid in an identifier
a.cc:27:1: error: extended character  is not valid in an identifier
a.cc:27:1: error: extended character   is not valid in an identifier
a.cc:28:1: error: extended character  is not valid in an identifier
   28 | ÃÂ ÃÂ for(int i = 0; i < n; ++i){
      | ^
a.cc:28:1: error: extended character   is not valid in an identifier
a.cc:28:1: error: extended character  is not valid in an identifier
a.cc:28:1: error: extended character   is not valid in an identifier
a.cc:29:1: error: extended character  is not valid in an identifier
   29 | ÃÂ ÃÂ  ÃÂ bool leaf[MAXN]={false,};
      | ^
a.cc:29:1: error: extended character   is not valid in an identifier
a.cc:29:1: error: extended character  is not valid in an identifier
a.cc:29:1: error: extended character   is not valid in an identifier
a.cc:29:10: error: extended character  is not valid in an identifier
   29 | ÃÂ ÃÂ  ÃÂ bool leaf[MAXN]={false,};
      |          ^
a.cc:29:10: error: extended character   is not valid in an identifier
a.cc:30:1: error: extended character  is not valid in an identifier
   30 | ÃÂ ÃÂ  ÃÂ bool vis[MAXN]={false,};
      | ^
a.cc:30:1: error: extended character   is not valid in an identifier
a.cc:30:1: error: extended character  is not valid in an identifier
a.cc:30:1: error: extended character   is not valid in an identifier
a.cc:30:10: error: extended character  is not valid in an identifier
   30 | ÃÂ ÃÂ  ÃÂ bool vis[MAXN]={false,};
      |          ^
a.cc:30:10: error: extended character   is not valid in an identifier
a.cc:31:1: error: extended character  is not valid in an identifier
   31 | ÃÂ ÃÂ  ÃÂ int par[MAXN];
      | ^
a.cc:31:1: error: extended character   is not valid in an identifier
a.cc:31:1: error: extended character  is not valid in an identifier
a.cc:31:1: error: extended character   is not valid in an identifier
a.cc:31:10: error: extended character  is not valid in an identifier
   31 | ÃÂ ÃÂ  ÃÂ int par[MAXN];
      |          ^
a.cc:31:10: error: extended character   is not valid in an identifier
a.cc:32:1: error: extended character  is not valid in an identifier
   32 | ÃÂ ÃÂ  ÃÂ int D = dfs(i,n,par,vis,leaf,W);
      | ^
a.cc:32:1: error: extended character   is not valid in an identifier
a.cc:32:1: error: extended character  is not valid in an identifier
a.cc:32:1: error: extended character   is not valid in an identifier
a.cc:32:10: error: extended character  is not valid in an identifier
   32 | ÃÂ ÃÂ  ÃÂ int D = dfs(i,n,par,vis,leaf,W);
      |          ^
a.cc:32:10: