Language: C++

#include<iostream>
 
using namespace std;
 
 
 
//long long fa[10005],w[10000];
 
struct edge{
	long long to;
	long long next;
	long long w;
	//edge():to(-1),next(-1),w(-1){	};
	 
}e[10005];
 
long long v[100005],tote=1;
long long fa[100005],depth[100005],s[100005];
long long addedge(long long from,long long to,long long weight){
	e[tote].next=v[from];
	e[tote].to=to;
	e[tote].w=weight;
	v[from]=tote;
	tote++;
	
}
long long init(long long root,long long dep){
	long long t=v[root];
	depth[root]=dep;
	while(e[t].to==fa[root]) t=e[t].next;
	while(t){
		if(e[t].to!=fa[root]){
			fa[e[t].to]=root;
			s[e[t].to]=s[root]+e[t].w;
			init(e[t].to,dep+1);	
		}
		t=e[t].next; 
	}
}
long long lca(long long a,long long b){
	long long p1=a,p2=b;
	long long j1,j2;
	if(depth[a]>depth[b]){
		j1=a;j2=b;
	}else j1=b,j2=a;
			
			//get to the same depth
			while(depth[j1]!=depth[j2]){
				j1=fa[j1];
			}
			while(j1!=j2){
				j1=fa[j1];
				j2=fa[j2];
			}
			long long lca=j1;
			return s[p1]-s[lca]+s[p2]-s[lca];
}
 
 
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	long long n;
	cin>>n;
	n--;
	while(n--){
		long long a,b,c;
		cin>>a>>b>>c;
		addedge(a,b,c); 
		addedge(b,a,c);
	}
 
	init(1,0);//root,depth
 
	
	long long k;
	cin>>n>>k;
	while(n--){
		long long a,b;
		cin>>a>>b;
		cout<<lca(a,k)+lca(b,k)<<endl;
	}
	
	return 0;
}

Compiler output:
a.cc:2:1: error: extended character   is not valid in an identifier
    2 |  
      | ^
a.cc:5:1: error: extended character   is not valid in an identifier
    5 |  
      | ^
a.cc:6:1: error: extended character   is not valid in an identifier
    6 |  
      | ^
a.cc:8:1: error: extended character   is not valid in an identifier
    8 |  
      | ^
a.cc:16:1: error: extended character   is not valid in an identifier
   16 |  
      | ^
a.cc:58:1: error: extended character   is not valid in an identifier
   58 |  
      | ^
a.cc:59:1: error: extended character   is not valid in an identifier
   59 |  
      | ^
a.cc:73:1: error: extended character   is not valid in an identifier
   73 |  
      | ^
a.cc:75:1: error: extended character   is not valid in an identifier
   75 |  
      | ^
a.cc:2:1: error: '\U000000a0' does not name a type
    2 |  
      | ^
a.cc:5:1: error: '\U000000a0' does not name a type
    5 |  
      | ^
a.cc:15:2: error: 'e' does not name a type
   15 | }e[10005];
      |  ^
a.cc:16:1: error: '\U000000a0' does not name a type
   16 |  
      | ^
a.cc: In function 'long long int addedge(long long int, long long int, long long int)':
a.cc:20:9: error: 'e' was not declared in this scope
   20 |         e[tote].next=v[from];
      |         ^
a.cc:20:11: error: 'tote' was not declared in this scope; did you mean 'to'?
   20 |         e[tote].next=v[from];
      |           ^~~~
      |           to
a.cc:20:22: error: 'v' was not declared in this scope
   20 |         e[tote].next=v[from];
      |                      ^
a.cc:26:1: warning: no return statement in function returning non-void [-Wreturn-type]
   26 | }
      | ^
a.cc: In function 'long long int init(long long int, long long int)':
a.cc:28:21: error: 'v' was not declared in this scope
   28 |         long long t=v[root];
      |                     ^
a.cc:30:15: error: 'e' was not declared in this scope
   30 |         while(e[t].to==fa[root]) t=e[t].next;
      |               ^
a.cc:32:20: error: 'e' was not declared in this scope
   32 |                 if(e[t].to!=fa[root]){
      |                    ^
a.cc:37:19: error: 'e' was not declared in this scope
   37 |                 t=e[t].next;
      |                   ^
a.cc:39:1: warning: no return statement in function returning non-void [-Wreturn-type]
   39 | }
      | ^
a.cc: At global scope:
a.cc:58:1: error: '\U000000a0' does not name a type
   58 |  
      | ^