criyle/codenet-compile-errors huggingface dataset:
Language: C++

//#define _GRIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;

#define int long long

struct edge {
    int to;
    int cost;
};

// <最短距離, 頂点の番号>
using P = pair<int, int>;

int V;
vector<edge> G[100000];
int d[100000][100000];

int memo[100000];

void dijkstra(int s) {
    if(memo[s]!=0) return;
    memo[s]++;
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d[s], d[s]+V, LONG_MAX);
    d[s][s] = 0;
    que.push(P(0, s));

    while (!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p.second;
        if (d[s][v] < p.first) continue;

        for (int i=0; i<G[v].size(); ++i) {
            edge e = G[v][i];
            if (d[s][e.to] > d[s][v] + e.cost) {
                d[s][e.to] = d[s][v] + e.cost;
                que.push(P(d[s][e.to], e.to));
            }
        }
    }
}

signed main() {
    cin >> V;
    for(int i=0; i<V-1; ++i) {
        int a, b, c;
        cin >> a >> b >> c;
        a--;
        b--;
        edge e = {b, c};
        G[a].push_back(e);
        e = {a, c};
        G[b].push_back(e);
    }

    int q, k;
    cin >> q >> k;
    k--;
    dijkstra(k);
    int x, y;
    for(int j=0; j<q; ++j) {
        cin >> x >> y;
        x--;
        y--;
        dijkstra(x);
        cout << d[x][k] + d[k][y] << endl;
    }
    return 0;
}



Compiler output:
/tmp/cc6XUtxD.o: in function `dijkstra(long long)':
a.cc:(.text+0x25): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/cc6XUtxD.o
a.cc:(.text+0x48): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/cc6XUtxD.o
a.cc:(.text+0x5f): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/cc6XUtxD.o
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
typedef long long ll;
using namespace std;
 int n, q, k;
vector<pair<int, int> > g[100010];
ll ans[100010];
bool vis[100010];
int main(){
  	scanf("%d", &n);
  	for(int i=0; i<n-1; i++){
    	int a, b, c;
      	scanf("%d%d%d", &a, &b, &c);
      	g[a].pb(make_pair(b,c));
      	g[b].pb(make_pair(a,c));
    }
  vis[k] = true;
  ans[k] = 0;
  queue<int> bfs;
  bfs.push_back(k);
  while(bfs.size()){
  		int x = bfs.front(); bfs.pop();
    	vis[x] = true;
    	for(auto pp : g[x]){
        	if(!vis[pp.first]){
              	ans[pp.first] = ans[x] + pp.second;
            	bfs.push(pp.first);
            }
        }
  }
  
  scanf("%d%d", &q, &k);
  for(int i=0; i<q; i++){
  	int x, y;
    scanf("%d%d", &x, &y);
    printf("%lld\n", ans[x] + ans[y]);
  }
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:14: error: 'class std::vector<std::pair<int, int> >' has no member named 'pb'
   16 |         g[a].pb(make_pair(b,c));
      |              ^~
a.cc:17:14: error: 'class std::vector<std::pair<int, int> >' has no member named 'pb'
   17 |         g[b].pb(make_pair(a,c));
      |              ^~
a.cc:22:7: error: 'class std::queue<int>' has no member named 'push_back'
   22 |   bfs.push_back(k);
      |       ^~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
const ll INF = 2e15;
const int maxn = 1e5+5;
const int maxm = 1e5+5;

struct Edge {
    int from, to, dist;
    Edge(int u, int v, int w) : from(u), to(v), dist(w) {}
};

vector <Edge> edge;
vector <int> G[maxn];
ll d[maxn][maxn];
bool done[maxn];

int N,M;

void Init() {
    rep(i,1,N+1) G[i].clear();
    edge.clear();

}

void AddEdge(int from, int to, int dist) {
    int e;
    edge.pb(Edge(from, to, dist));
    e = sz(edge);
    G[from].pb(e - 1);
}

void dij(int s) {
    priority_queue <pii,vector<pii>,greater<pii> > Q;
    rep(i,1,N+1) {
        d[s][i] = INF;
    }
    d[s][s] = 0;
    memset(done,0,sizeof(done));
    Q.push(mp(0,s));
    while (!Q.empty()) {
        pii t = Q.top(); Q.pop();
        int u = t.se;
        if (done[u]) continue;
        done[u] = true;
        rep(i,0,sz(G[u])) {
            Edge e = edge[G[u][i]];
            if (d[s][e.to] > d[s][u] + e.dist) {
                d[s][e.to] = d[s][u] + e.dist;
                Q.push(mp(d[s][e.to],e.to));
            }
        }

    }
}

int main ()
{
    scanf("%d", &N);
    Init();
    rep(i,1,N) {
        int from, to, w;
        scanf("%d%d%d", &from, &to, &w);
        AddEdge(from, to, w);
        AddEdge(to, from, w);
    }
    rep(i,1,N+1) dij(i);
    int Q,K;
    scanf("%d%d",&Q,&K);
    rep(i,0,Q) {
        int S,T;
        scanf("%d%d",&S,&T);
        ll ans = d[S][K] + d[K][T];
        //de(K); de(S); de(T);
        //de(d[S][K]); de(d[K][T]);
        cout<<ans<<endl;
    }

    return 0;
}

Compiler output:
/tmp/cctZ7Mgk.o: in function `Init()':
a.cc:(.text+0x3c): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/cctZ7Mgk.o
/tmp/cctZ7Mgk.o: in function `dij(int)':
a.cc:(.text+0x13f): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/cctZ7Mgk.o
a.cc:(.text+0x187): relocation truncated to fit: R_X86_64_PC32 against symbol `done' defined in .bss section in /tmp/cctZ7Mgk.o
a.cc:(.text+0x1f9): relocation truncated to fit: R_X86_64_PC32 against symbol `done' defined in .bss section in /tmp/cctZ7Mgk.o
a.cc:(.text+0x211): relocation truncated to fit: R_X86_64_PC32 against symbol `done' defined in .bss section in /tmp/cctZ7Mgk.o
/tmp/cctZ7Mgk.o: in function `main':
a.cc:(.text+0x436): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/cctZ7Mgk.o
a.cc:(.text+0x4ac): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/cctZ7Mgk.o
a.cc:(.text+0x4ce): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/cctZ7Mgk.o
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<vector>
#include<memory.h>
using namespace std;
//vector<int >qqq[100001];
long long int dis[100001][100001];
int n;
long  long int dist[100001];
void dijestra(int v){
	bool s[100001];
	memset(s,0,sizeof(s));
	memset(dist,-1,sizeof(dist));
	for(int i=1;i<=n;i++){
		if(dis[v][i]!=-1)
		dist[i]=dis[v][i];
	}
	dist[v]=0;
	s[v]=1;
	 for(int i=2; i<=n; i++){
        long long  int mindist = 100000000000000;
		 int u = v;
         for(int j=1; j<=n; ++j)
         if((!s[j]) &&dist[j]!=-1&&dist[j]<mindist)
        {u = j; 
        mindist = dist[j];
       }
       s[u] = true; 
          for(int j=1;j<=n; j++)
         if((!s[j]) && dis[u][j]!=-1)
         {
                 if(dist[u] + dis[u][j]<dist[j]||dist[j]==-1)     //在通过新加入的u点路径找到离v0点更短的路径  
                {
                       dist[j] = dist[u] + dis[u][j];    
                 }
            }
    }
    return ;
}
int main(){
	while(cin>>n){
		memset(dis,-1,sizeof(dis));
//		for(int i=1;i<=n;i++){
//		    qqq[i].clear(); 
//		} 
		for(int k=0;k<n-1;k++){
			int i,j,kk;
			cin>>i>>j>>kk;
//			qqq[i].push_back(j);
//			qqq[j].push_back(i);
			dis[i][j]=dis[j][i]=kk;
		}
		int mm,nn;
		cin>>mm>>nn;
		dijestra(nn);
	//	cout<<"	OK"<<endl;
		for(int i=0;i<mm;i++){
			int a,b;
			cin>>a>>b;
			cout<<dist[a]+dist[b]<<endl;
		}
	}
}

Compiler output:
/tmp/ccOBy4uG.o: in function `dijestra(int)':
a.cc:(.text+0x37): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccOBy4uG.o
a.cc:(.text+0xb9): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccOBy4uG.o
a.cc:(.text+0xc7): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccOBy4uG.o
a.cc:(.text+0xe7): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccOBy4uG.o
a.cc:(.text+0x153): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccOBy4uG.o
a.cc:(.text+0x171): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccOBy4uG.o
a.cc:(.text+0x195): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccOBy4uG.o
a.cc:(.text+0x1a7): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccOBy4uG.o
a.cc:(.text+0x227): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccOBy4uG.o
a.cc:(.text+0x26b): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccOBy4uG.o
a.cc:(.text+0x288): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
using namespace std;


long calcmini(long x,long K){
  long ans=0;
  if(path[x*N+K]!=0){
    return path[x*N+K];
  }
  for(int k=0;k<N;k++){
    if(path[x*N+k]!=0){
      ans = max(calcmini(k,K)+path[x*N+k],ans);
    }
  }
  return ans;
}

int main(){
  long N,path[20000000300],ans[20000000300]={},a,b,c,Q,K,x,y,ans;

  cin>>N;
  for(int i=0;i<N;i++){
    cin>>a;
    cin>>b;
    cin>>c;
    path[a*N+b] =c;
  }

  cin>>Q;
  cin>>K;
  for(int j=0;j<Q;j++){
    cin>>x;
    cin>>y;
    ans = calcmini(x,K);
    cout<<ans<<endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'long int calcmini(long int, long int)':
a.cc:7:6: error: 'path' was not declared in this scope
    7 |   if(path[x*N+K]!=0){
      |      ^~~~
a.cc:7:13: error: 'N' was not declared in this scope
    7 |   if(path[x*N+K]!=0){
      |             ^
a.cc:10:17: error: 'N' was not declared in this scope
   10 |   for(int k=0;k<N;k++){
      |                 ^
a.cc:11:8: error: 'path' was not declared in this scope
   11 |     if(path[x*N+k]!=0){
      |        ^~~~
a.cc: In function 'int main()':
a.cc:19:62: error: conflicting declaration 'long int ans'
   19 |   long N,path[20000000300],ans[20000000300]={},a,b,c,Q,K,x,y,ans;
      |                                                              ^~~
a.cc:19:28: note: previous declaration as 'long int ans [20000000300]'
   19 |   long N,path[20000000300],ans[20000000300]={},a,b,c,Q,K,x,y,ans;
      |                            ^~~
a.cc:34:9: error: incompatible types in assignment of 'long int' to 'long int [20000000300]'
   34 |     ans = calcmini(x,K);
      |     ~~~~^~~~~~~~~~~~~~~
Language: C++

#include<iostream>
#include<vector>
#include<memory.h>
using namespace std;
vector<int >qqq[100001];
long long int dis[100001][100001];
int n;
long  long int dist[100001];
void dijestra(int v){
	bool s[100001];
	memset(s,0,sizeof(s));
	memset(dist,-1,sizeof(dist));
	for(int i=0;i<qqq[v].size();i++){
		dist[qqq[v][i]]=dis[v][qqq[v][i]];
	}
	dist[v]=0;
	s[v]=1;
	 for(int i=2; i<=n; i++){
        long long  int mindist = 100000000000000;
		 int u = v;
         for(int j=1; j<=n; ++j)
         if((!s[j]) &&dist[j]!=-1&&dist[j]<mindist)
        {u = j; 
        mindist = dist[j];
       }
       s[u] = true; 
          for(int j=0;j<qqq[u].size(); j++)
         if((!s[qqq[u][j]]) && dis[u][qqq[u][j]]!=-1)
         {
                 if(dist[u] + dis[u][qqq[u][j]]<dist[qqq[u][j]]||dist[qqq[u][j]]==-1)     //在通过新加入的u点路径找到离v0点更短的路径  
                {
                       dist[qqq[u][j]] = dist[u] + dis[u][qqq[u][j]];    
                 }
            }
    }
    return ;
}
int main(){
	while(cin>>n){
		memset(dis,-1,sizeof(dis));
		for(int i=1;i<=n;i++){
		    qqq[i].clear(); 
		} 
		for(int k=0;k<n-1;k++){
			int i,j,kk;
			cin>>i>>j>>kk;
			qqq[i].push_back(j);
			qqq[j].push_back(i);
			dis[i][j]=dis[j][i]=kk;
		}
		int mm,nn;
		cin>>mm>>nn;
		dijestra(nn);
	//	cout<<"	OK"<<endl;
		for(int i=0;i<mm;i++){
			int a,b;
			cin>>a>>b;
			cout<<dist[a]+dist[b]<<endl;
		}
	}
}

Compiler output:
/tmp/cc43p7pj.o: in function `dijestra(int)':
a.cc:(.text+0x38): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cc43p7pj.o
a.cc:(.text+0xe9): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cc43p7pj.o
a.cc:(.text+0x144): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cc43p7pj.o
a.cc:(.text+0x1b0): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cc43p7pj.o
a.cc:(.text+0x1ce): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cc43p7pj.o
a.cc:(.text+0x1f2): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cc43p7pj.o
a.cc:(.text+0x204): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc43p7pj.o
a.cc:(.text+0x2e8): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cc43p7pj.o
a.cc:(.text+0x383): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cc43p7pj.o
a.cc:(.text+0x3cc): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cc43p7pj.o
a.cc:(.text+0x3fe): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<vector>
#include<memory.h>
using namespace std;
vector<int >qqq[100001];
long long int dis[100001][100001];
int n;
long  long int dist[100001];
void dijestra(int v){
	bool s[100001];
	memset(s,0,sizeof(s));
	memset(dist,-1,sizeof(dist));
	for(int i=0;i<qqq[v].size();i++){
		dist[qqq[v][i]]=dis[v][qqq[v][i]];
	}
	dist[v]=0;
	s[v]=1;
	 for(int i=2; i<=n; i++){
        long long  int mindist = 100000000000000;
		 int u = v;
         for(int j=1; j<=n; ++j)
         if((!s[j]) &&dist[j]!=-1&&dist[j]<mindist)
        {u = j; 
        mindist = dist[j];
       }
       s[u] = true; 
          for(int j=0;j<qqq[u].size(); j++)
         if((!s[qqq[u][j]]) && dis[u][qqq[u][j]]!=-1)
         {
                 if(dist[u] + dis[u][qqq[u][j]]<dist[qqq[u][j]]||dist[qqq[u][j]]==-1)     //在通过新加入的u点路径找到离v0点更短的路径  
                {
                       dist[qqq[u][j]] = dist[u] + dis[u][qqq[u][j]];    
                 }
            }
    }
    return ;
}
int main(){
	while(cin>>n){
		memset(dis,-1,sizeof(dis));
	//	for(int i=1;i<=n;i++){
	//	    q[i].clear(); 
	//	} 
		for(int k=0;k<n-1;k++){
			int i,j,kk;
			cin>>i>>j>>kk;
			qqq[i].push_back(j);
			qqq[j].push_back(i);
			dis[i][j]=dis[j][i]=kk;
		}
		int mm,nn;
		cin>>mm>>nn;
		dijestra(nn);
	//	cout<<"	OK"<<endl;
		for(int i=0;i<mm;i++){
			int a,b;
			cin>>a>>b;
			cout<<dist[a]+dist[b]<<endl;
		}
	}
}

Compiler output:
/tmp/cc9uRLh0.o: in function `dijestra(int)':
a.cc:(.text+0x38): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cc9uRLh0.o
a.cc:(.text+0xe9): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cc9uRLh0.o
a.cc:(.text+0x144): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cc9uRLh0.o
a.cc:(.text+0x1b0): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cc9uRLh0.o
a.cc:(.text+0x1ce): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cc9uRLh0.o
a.cc:(.text+0x1f2): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cc9uRLh0.o
a.cc:(.text+0x204): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc9uRLh0.o
a.cc:(.text+0x2e8): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cc9uRLh0.o
a.cc:(.text+0x383): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cc9uRLh0.o
a.cc:(.text+0x3cc): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cc9uRLh0.o
a.cc:(.text+0x3fe): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<vector>
#include<memory.h>
using namespace std;
vector<int >q[100001];
long long int dis[100001][100001];
int n;
long  long int dist[100001];
void dijestra(int v){
	bool s[100001];
	memset(s,0,sizeof(s));
	memset(dist,-1,sizeof(dist));
	for(int i=0;i<q[v].size();i++){
		dist[q[v][i]]=dis[v][q[v][i]];
	}
	dist[v]=0;
	s[v]=1;
	 for(int i=2; i<=n; i++){
        long long  int mindist = 100000000000000;
		 int u = v;
         for(int j=1; j<=n; ++j)
         if((!s[j]) &&dist[j]!=-1&&dist[j]<mindist)
        {u = j; 
        mindist = dist[j];
       }
       s[u] = true; 
          for(int j=0;j<q[u].size(); j++)
         if((!s[q[u][j]]) && dis[u][q[u][j]]!=-1)
         {
                 if(dist[u] + dis[u][q[u][j]]<dist[q[u][j]]||dist[q[u][j]]==-1)     //在通过新加入的u点路径找到离v0点更短的路径  
                {
                       dist[q[u][j]] = dist[u] + dis[u][q[u][j]];    
                 }
            }
    }
    return ;
}
int main(){
	while(cin>>n){
		memset(dis,-1,sizeof(dis));
	//	for(int i=1;i<=n;i++){
	//	    q[i].clear(); 
	//	} 
		for(int k=0;k<n-1;k++){
			int i,j,kk;
			cin>>i>>j>>kk;
			q[i].push_back(j);
			q[j].push_back(i);
			dis[i][j]=dis[j][i]=kk;
		}
		int mm,nn;
		cin>>mm>>nn;
		dijestra(nn);
	//	cout<<"	OK"<<endl;
		for(int i=0;i<mm;i++){
			int a,b;
			cin>>a>>b;
			cout<<dist[a]+dist[b]<<endl;
		}
	}
}

Compiler output:
/tmp/ccQudCat.o: in function `dijestra(int)':
a.cc:(.text+0x38): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccQudCat.o
a.cc:(.text+0xe9): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccQudCat.o
a.cc:(.text+0x144): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccQudCat.o
a.cc:(.text+0x1b0): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccQudCat.o
a.cc:(.text+0x1ce): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccQudCat.o
a.cc:(.text+0x1f2): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccQudCat.o
a.cc:(.text+0x204): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccQudCat.o
a.cc:(.text+0x2e8): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccQudCat.o
a.cc:(.text+0x383): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccQudCat.o
a.cc:(.text+0x3cc): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccQudCat.o
a.cc:(.text+0x3fe): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<iomanip>
#include<queue>
#include<string>
#include<stack>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cassert>
#include<ctime>
#include<algorithm>
#include<utility>
#include<map>
#include<set>
#include<vector>
#include<functional>

using namespace std;

#ifdef DEBUG
#define dprintf      printf
#define dout(x)      cout<<#x" = "<<(x)<<endl
#define darray(x,n)  {int i;rep(i,n)cout<<#x"["<<i<<"] = "<<*((x)+i)<<endl;}
#define dloop(i,s,g) for(int (i)=(s);(i)<(g);(i)++)
#define drep(i,n)    for(int (i)=0;(i)<(n);(i)++)
#define dstop()      scanf("%*c")
#else
#define dprintf      (1)?0:printf
#define dout(x)
#define darray(x,n)
#define dloop(i,s,g) if(1){}else
#define drep(i,n)    if(1){}else
#define dstop()      if(1){}else
#endif

#define F    first
#define S    second
#define pb   push_back
#define mp   make_pair

#define loop(i,s,g) for(int (i)=(s);(i)<(g);(i)++)
#define rep(i,n)    for(int (i)=0;(i)<(n);(i)++)
#define all(x)      (x.begin(),x.end())
#define in(T,...) T __VA_ARGS__; impl(__VA_ARGS__);
#define array(T,id,n) T id[n]; rep(i,n)cin>>id[i];

//#define int long long;
#ifndef int
#define INF (1e9)
#else
#define INF (0x7fffffffffffffff)
#endif
#define LINF (0x7fffffffffffffff)

typedef  long long           ll;
typedef  unsigned            ui;
typedef  unsigned long long  ull;
typedef  pair<int,int>       i_i;
typedef  pair<ll,int>        ll_i;
typedef  pair<ll,ll>         ll_ll;
typedef  pair<double,int>    d_i;
typedef  pair<double,double> d_d;

void impl(){};
template <typename T,typename... TS >
void impl(T &head,TS &... tail)
{
  cin>>head;
  impl(tail ...);
}

#define MAX_V 112345

struct edge
{
  int to;
  int cost;
};

int V;
vector<edge> G[MAX_V];
ll d[MAX_V];

void dijkstra(int s)
{
  priority_queue<i_i,vector<i_i>,greater<i_i> > que;
  fill(d,d+V,LINF);
  d[s]=0;
  que.push(i_i(0,s));

  while(!que.empty())
    {
      i_i p=que.top();
      que.pop();

      int v=p.second;
      if(d[v]<p.first) continue;
      int n=G[v].size();
      rep(i,n)
	{
	  edge e=G[v][i];
	  if(d[e.to]>d[v]+e.cost)
	    {
	      d[e.to]=d[v]+e.cost;
	      que.push(i_i(d[e.to],e.to));
	    }	  
	}
    }
}

signed main(void)
{
  in(int,n);

  rep(i,n-1)
    {
      in(int,a,b,c);
      edge temp;
      temp.to=b-1;
      temp.cost=c;
      G[a-1].pb(temp);
      temp.to=a-1;
      G[b-1].pb(temp);
    }
  dprintf("グラフ\n");
  drep(i,n-1)
    {
      drep(j,G[i].size())
	dprintf("%d %d %d\n",i,G[i][j].to,G[i][j].cost);
    }
  in(int,q,k);
  V=n;
  dijkstra(k-1);
  dprintf("ダイクストラ\n");
  darray(d,n);
  rep(i,q)
    {
      in(int,x,y);
      cout<<d[x-1]+d[y-1]<<endl;
    }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:130:30: error: 'i' was not declared in this scope
  130 |         dprintf("%d %d %d\n",i,G[i][j].to,G[i][j].cost);
      |                              ^
a.cc:130:37: error: 'j' was not declared in this scope
  130 |         dprintf("%d %d %d\n",i,G[i][j].to,G[i][j].cost);
      |                                     ^
Language: C++

#include<iostream>
#include<queue>
#include<memory.h>
using namespace std;
vector<int >q[100001];
long long int dis[100001][100001];
int n;
long  long int dist[100001];
int dijestra(int v){
	bool s[100001];
	memset(s,0,sizeof(s));
	memset(dist,-1,sizeof(dist));
	for(int i=0;i<q[v].size();i++){
		dist[q[v][i]]=dis[v][q[v][i]];
	}
	dist[v]=0;
	s[v]=1;
	 for(int i=2; i<=n; i++){
        long long  int mindist = 100000000000000;
		 int u = v;
         for(int j=1; j<=n; ++j)
         if((!s[j]) &&dist[j]!=-1&&dist[j]<mindist)
        {u = j; 
        mindist = dist[j];
       }
       s[u] = true; 
          for(int j=0;j<q[u].size(); j++)
         if((!s[q[u][j]]) && dis[u][q[u][j]]!=-1)
         {
                 if(dist[u] + dis[u][q[u][j]]<dist[q[u][j]]||dist[q[u][j]]==-1)     //在通过新加入的u点路径找到离v0点更短的路径  
                {
                       dist[q[u][j]] = dist[u] + dis[u][q[u][j]];    
                 }
            }
    }
}
int main(){
	while(cin>>n){
		memset(dis,-1,sizeof(dis));
	//	for(int i=1;i<=n;i++){
	//	    q[i].clear(); 
	//	} 
		for(int k=0;k<n-1;k++){
			int i,j,kk;
			cin>>i>>j>>kk;
			q[i].push_back(j);
			q[j].push_back(i);
			dis[i][j]=dis[j][i]=kk;
		}
		int mm,nn;
		cin>>mm>>nn;
		dijestra(nn);
	//	cout<<"	OK"<<endl;
		for(int i=0;i<mm;i++){
			int a,b;
			cin>>a>>b;
			cout<<dist[a]+dist[b]<<endl;
		}
	}
}

Compiler output:
a.cc: In function 'int dijestra(int)':
a.cc:36:1: warning: no return statement in function returning non-void [-Wreturn-type]
   36 | }
      | ^
/tmp/ccAk7uoW.o: in function `dijestra(int)':
a.cc:(.text+0x38): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccAk7uoW.o
a.cc:(.text+0xe9): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccAk7uoW.o
a.cc:(.text+0x144): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccAk7uoW.o
a.cc:(.text+0x1b0): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccAk7uoW.o
a.cc:(.text+0x1ce): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccAk7uoW.o
a.cc:(.text+0x1f2): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccAk7uoW.o
a.cc:(.text+0x204): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccAk7uoW.o
a.cc:(.text+0x2e8): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccAk7uoW.o
a.cc:(.text+0x383): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccAk7uoW.o
a.cc:(.text+0x3cc): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccAk7uoW.o
a.cc:(.text+0x3fe): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<queue>
#include<memory.h>
using namespace std;
vector<int >q[100001];
long long int dis[100001][100001];
int n;
long  long int dist[100001];
int dijestra(int v){
	bool s[100001];
	memset(s,0,sizeof(s));
	memset(dist,-1,sizeof(dist));
	for(int i=0;i<q[v].size();i++){
		dist[q[v][i]]=dis[v][q[v][i]];
	}
	dist[v]=0;
	s[v]=1;
	 for(int i=2; i<=n; i++){
        long long  int mindist = 100000000000000;
		 int u = v;
         for(int j=1; j<=n; ++j)
         if((!s[j]) &&dist[j]!=-1&&dist[j]<mindist)
        {u = j; 
        mindist = dist[j];
       }
       s[u] = true; 
          for(int j=0;j<q[u].size(); j++)
         if((!s[q[u][j]]) && dis[u][q[u][j]]!=-1)
         {
                 if(dist[u] + dis[u][q[u][j]]<dist[q[u][j]]||dist[q[u][j]]==-1)     //在通过新加入的u点路径找到离v0点更短的路径  
                {
                       dist[q[u][j]] = dist[u] + dis[u][q[u][j]];    
                 }
            }
    }
}
int main(){
	while(cin>>n){
		memset(dis,-1,sizeof(dis));
	//	for(int i=1;i<=n;i++){
	//	    q[i].clear(); 
	//	} 
		for(int k=0;k<n-1;k++){
			int i,j,kk;
			cin>>i>>j>>kk;
			q[i].push_back(j);
			q[j].push_back(i);
			dis[i][j]=dis[j][i]=kk;
		}
		int mm,nn;
		cin>>mm>>nn;
		dijestra(nn);
	//	cout<<"	OK"<<endl;
		for(int i=0;i<mm;i++){
			int a,b;
			cin>>a>>b;
			cout<<dist[a]+dist[b]<<endl;
		}
	}
}

Compiler output:
a.cc: In function 'int dijestra(int)':
a.cc:36:1: warning: no return statement in function returning non-void [-Wreturn-type]
   36 | }
      | ^
/tmp/ccTEuF25.o: in function `dijestra(int)':
a.cc:(.text+0x38): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccTEuF25.o
a.cc:(.text+0xe9): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccTEuF25.o
a.cc:(.text+0x144): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccTEuF25.o
a.cc:(.text+0x1b0): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccTEuF25.o
a.cc:(.text+0x1ce): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccTEuF25.o
a.cc:(.text+0x1f2): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccTEuF25.o
a.cc:(.text+0x204): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccTEuF25.o
a.cc:(.text+0x2e8): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccTEuF25.o
a.cc:(.text+0x383): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccTEuF25.o
a.cc:(.text+0x3cc): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccTEuF25.o
a.cc:(.text+0x3fe): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<queue>
#include<memory.h>
using namespace std;
vector<int >q[100001];
long long int dis[100001][100001];
int n;
long  long int dist[100001];
int dijestra(int v){
	bool s[100001];
	memset(s,0,sizeof(s));
	memset(dist,-1,sizeof(dist));
	for(int i=0;i<q[v].size();i++){
		dist[q[v][i]]=dis[v][q[v][i]];
	}
	dist[v]=0;
	s[v]=1;
	 for(int i=2; i<=n; i++){
        long long  int mindist = 100000000000000;
		 int u = v;
         for(int j=1; j<=n; ++j)
         if((!s[j]) &&dist[j]!=-1&&dist[j]<mindist)
        {u = j; 
        mindist = dist[j];
       }
       s[u] = true; 
          for(int j=0;j<q[u].size(); j++)
         if((!s[q[u][j]]) && dis[u][q[u][j]]!=-1)
         {
                 if(dist[u] + dis[u][q[u][j]]<dist[q[u][j]]||dist[q[u][j]]==-1)     //在通过新加入的u点路径找到离v0点更短的路径  
                {
                       dist[q[u][j]] = dist[u] + dis[u][q[u][j]];    
                 }
            }
    }
}
int main(){
	while(cin>>n){
		memset(dis,-1,sizeof(dis));
		for(int i=1;i<=n;i++){
		    q[i].clear(); 
		} 
		for(int k=0;k<n-1;k++){
			int i,j,kk;
			cin>>i>>j>>kk;
			q[i].push_back(j);
			q[j].push_back(i);
			dis[i][j]=dis[j][i]=kk;
		}
		int mm,nn;
		cin>>mm>>nn;
		dijestra(nn);
	//	cout<<"	OK"<<endl;
		for(int i=0;i<mm;i++){
			int a,b;
			cin>>a>>b;
			cout<<dist[a]+dist[b]<<endl;
		}
	}
}

Compiler output:
a.cc: In function 'int dijestra(int)':
a.cc:36:1: warning: no return statement in function returning non-void [-Wreturn-type]
   36 | }
      | ^
/tmp/cczOJ0QE.o: in function `dijestra(int)':
a.cc:(.text+0x38): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cczOJ0QE.o
a.cc:(.text+0xe9): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cczOJ0QE.o
a.cc:(.text+0x144): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cczOJ0QE.o
a.cc:(.text+0x1b0): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cczOJ0QE.o
a.cc:(.text+0x1ce): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cczOJ0QE.o
a.cc:(.text+0x1f2): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cczOJ0QE.o
a.cc:(.text+0x204): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cczOJ0QE.o
a.cc:(.text+0x2e8): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cczOJ0QE.o
a.cc:(.text+0x383): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cczOJ0QE.o
a.cc:(.text+0x3cc): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cczOJ0QE.o
a.cc:(.text+0x3fe): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<queue>
#include<memory.h>
using namespace std;
vector<int >q[100001];
long long int dis[100001][100001];
int n;
long  long int dist[100001];
int dijestra(int v){
	bool s[100001];
	memset(s,0,sizeof(s));
	memset(dist,-1,sizeof(dist));
	for(int i=0;i<q[v].size();i++){
		dist[q[v][i]]=dis[v][q[v][i]];
	}
	dist[v]=0;
	s[v]=1;
	 for(int i=2; i<=n; i++){
        long long  int mindist = 100000000000000;
		 int u = v;
         for(int j=1; j<=n; ++j)
         if((!s[j]) &&dist[j]!=-1&&dist[j]<mindist)
        {u = j; 
        mindist = dist[j];
       }
       s[u] = true; 
          for(int j=0;j<q[u].size(); j++)
         if((!s[q[u][j]]) && dis[u][q[u][j]]!=-1)
         {
                 if(dist[u] + dis[u][q[u][j]]<dist[q[u][j]]||dist[q[u][j]]==-1)     //在通过新加入的u点路径找到离v0点更短的路径  
                {
                       dist[q[u][j]] = dist[u] + dis[u][q[u][j]];    
                 }
            }
    }
}
int main(){
	while(cin>>n){
		memset(dis,-1,sizeof(dis));
		q.clear();
		for(int k=0;k<n-1;k++){
			int i,j,kk;
			cin>>i>>j>>kk;
			q[i].push_back(j);
			q[j].push_back(i);
			dis[i][j]=dis[j][i]=kk;
		}
		int mm,nn;
		cin>>mm>>nn;
		dijestra(nn);
	//	cout<<"	OK"<<endl;
		for(int i=0;i<mm;i++){
			int a,b;
			cin>>a>>b;
			cout<<dist[a]+dist[b]<<endl;
		}
	}
}

Compiler output:
a.cc: In function 'int dijestra(int)':
a.cc:36:1: warning: no return statement in function returning non-void [-Wreturn-type]
   36 | }
      | ^
a.cc: In function 'int main()':
a.cc:40:19: error: request for member 'clear' in 'q', which is of non-class type 'std::vector<int> [100001]'
   40 |                 q.clear();
      |                   ^~~~~
Language: C++

n = int(input())
g = []
d = [0] * (n + 1)
for i in range(n + 1):
    g.append([]);
for i in range(n - 1):
    u, v, w = map(int, input().split())
    g[u].append([v, w])
    g[v].append([u, w])
q, k = map(int, input().split())
def dfs(u, f, w):
    d[u] = w;
    for go in g[u]:
        if go[0] != f:
            dfs(go[0], u, go[1] + w)
dfs(k, k, 0)
while q > 0:
    u, v = map(int, input().split())
    print(d[u] + d[v])
    q -= 1


Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
a.cc:6:1: error: expected unqualified-id before 'for'
    6 | for i in range(n - 1):
      | ^~~
a.cc:13:5: error: expected unqualified-id before 'for'
   13 |     for go in g[u]:
      |     ^~~
Language: C++

//code by 27.
#include<stdio.h>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<queue>
#include<map>
#include<stack>
#include<fstream>
#include<stdlib.h>
#include<set>
#include<cassert>
#include<climits>
#include<cmath>
#include<memory.h>
#include<conio.h>
#include<windows.h>
#include<ctime>
using namespace std;
vector<pair<int,int> >vt[100001];
int k;
int ypa(int t,int p,int g)//g:rank?rake?rack?deepvalue
{
	if(t==k)
	{
		return g;
		cout<<"!"<<g<<endl;
	}
	else
	{
		int s=0;
		for(int i=0;i<vt[t].size();i++)
		{
			if(vt[t][i].first!=p)
			{
				s+=ypa(vt[t][i].first,t,g+vt[t][i].second);
			}
		}
		return s;
	}
}
int main()
{
	int n;
	cin>>n;
	int x,y,z;
	for(int i=2;i<=n;i++)
	{
		scanf("%d%d%d",&x,&y,&z);
		vt[x].push_back(make_pair(y,z));
		vt[y].push_back(make_pair(x,z));
	}
	int q;
	cin>>q>>k;
	for(int i=1;i<=q;i++)
	{
		scanf("%d%d",&x,&y);
		int s=0;
		s+=ypa(x,19260817,0);
		s+=ypa(y,19260817,0);
		cout<<s<<endl;
	}
    return 0;
}

Compiler output:
a.cc:19:9: fatal error: conio.h: No such file or directory
   19 | #include<conio.h>
      |         ^~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int maxn=100005,inf=1000000000;
using namespace std;
long long a[maxn][maxn], d[maxn], p[maxn];
int main(){
	int k,m,n,t;
	scanf("%d",&n); 
	for(int i=1; i<=n-1; i++){
		int x, y, z;
		scanf("%d %d %d",&x, &y, &z);
		a[x][y] = a[y][x] = z; 
	}
	scanf("%d%d", &m, &t);
	for(int i=1; i<=n; i++) d[i]=inf;
	d[t]=0;
	for(int i=1; i<=n; i++){
		int zx = inf;
		for(int j=1;j<=n;j++)
			if(!p[j] && d[j]<zx){
				zx=d[j];
				k=j;
			}
		p[k]=1;
		for(int j=1;j<=n;j++)
			if(!p[j] && a[k][j]!=0 && d[j]>d[k]+a[k][j])
				d[j]=d[k]+a[k][j];
	}
	for(int i=0; i<m; i++){
		int x, y;
		scanf("%d%d", &x, &y);
		cout << d[x]+d[y] << endl;
	}
	return 0;
}

Compiler output:
/tmp/ccs3FaMU.o: in function `main':
a.cc:(.text+0x114): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccs3FaMU.o
a.cc:(.text+0x13c): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccs3FaMU.o
a.cc:(.text+0x174): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccs3FaMU.o
a.cc:(.text+0x191): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccs3FaMU.o
a.cc:(.text+0x1b3): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccs3FaMU.o
a.cc:(.text+0x1e0): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccs3FaMU.o
a.cc:(.text+0x208): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccs3FaMU.o
a.cc:(.text+0x25a): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccs3FaMU.o
a.cc:(.text+0x272): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccs3FaMU.o
a.cc:(.text+0x2ba): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccs3FaMU.o
a.cc:(.text+0x2fe): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

//#define _GRIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;

#define int long

struct edge {
    signed to;
    signed cost;
};

// <最短距離, 頂点の番号>
using P = pair<signed, signed>;

int d[100000][100000];

int memo[100000];

void dijkstra(int s, signed V, vector<vector<edge> > G) {
    if(memo[s]!=0) return;
    memo[s]++;
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d[s], d[s]+V, LONG_MAX);
    d[s][s] = 0;
    que.push(P(0, s));

    while (!que.empty()) {
        P p = que.top();
        que.pop();
        signed v = p.second;
        if (d[s][v] < p.first) continue;

        for (int i=0; i<G[v].size(); ++i) {
            edge e = G[v][i];
            if (d[s][e.to] > d[s][v] + e.cost) {
                d[s][e.to] = d[s][v] + e.cost;
                que.push(P(d[s][e.to], e.to));
            }
        }
    }
}

signed main() {
    signed V;
    cin >> V;
    vector<vector<edge> > G(V);
    for(int i=0; i<V-1; ++i) {
        signed a, b, c;
        cin >> a >> b >> c;
        a--;
        b--;
        edge e = {b, c};
        G[a].push_back(e);
        e = {a, c};
        G[b].push_back(e);
    }

    int q, k;
    cin >> q >> k;
    k--;
    dijkstra(k, V, G);
    int x, y;
    for(int j=0; j<q; ++j) {
        cin >> x >> y;
        x--;
        y--;
        dijkstra(x, V, G);
        cout << d[x][k] + d[k][y] << endl;
    }
    return 0;
}



Compiler output:
/tmp/cc6b40kd.o: in function `dijkstra(long, int, std::vector<std::vector<edge, std::allocator<edge> >, std::allocator<std::vector<edge, std::allocator<edge> > > >)':
a.cc:(.text+0x29): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/cc6b40kd.o
a.cc:(.text+0x49): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/cc6b40kd.o
a.cc:(.text+0x60): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/cc6b40kd.o
collect2: error: ld returned 1 exit status
Language: C++

//#define _GRIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;

#define int long

struct edge {
    signed to;
    signed cost;
};

// <最短距離, 頂点の番号>
using P = pair<signed, signed>;

vector<vector<edge> > G(100000);
int d[100000][100000];

int memo[100000];

void dijkstra(int s, signed V) {
    if(memo[s]!=0) return;
    memo[s]++;
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d[s], d[s]+V, LONG_MAX);
    d[s][s] = 0;
    que.push(P(0, s));

    while (!que.empty()) {
        P p = que.top();
        que.pop();
        signed v = p.second;
        if (d[s][v] < p.first) continue;

        for (int i=0; i<G[v].size(); ++i) {
            edge e = G[v][i];
            if (d[s][e.to] > d[s][v] + e.cost) {
                d[s][e.to] = d[s][v] + e.cost;
                que.push(P(d[s][e.to], e.to));
            }
        }
    }
}

signed main() {
    signed V;
    cin >> V;
    for(int i=0; i<V-1; ++i) {
        signed a, b, c;
        cin >> a >> b >> c;
        a--;
        b--;
        edge e = {b, c};
        G[a].push_back(e);
        e = {a, c};
        G[b].push_back(e);
    }

    int q, k;
    cin >> q >> k;
    k--;
    dijkstra(k, V);
    int x, y;
    for(int j=0; j<q; ++j) {
        cin >> x >> y;
        x--;
        y--;
        dijkstra(x, V);
        cout << d[x][k] + d[k][y] << endl;
    }
    return 0;
}



Compiler output:
/tmp/ccvAQcC5.o: in function `dijkstra(long, int)':
a.cc:(.text+0x1f): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/ccvAQcC5.o
a.cc:(.text+0x3f): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/ccvAQcC5.o
a.cc:(.text+0x56): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/ccvAQcC5.o
collect2: error: ld returned 1 exit status
Language: C++

//#define _GRIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;

#define int long

struct edge {
    signed to;
    signed cost;
};

// <最短距離, 頂点の番号>
using P = pair<signed, signed>;

vector<edge> G[100000];
int d[100000][100000];

int memo[100000];

void dijkstra(int s, signed V) {
    if(memo[s]!=0) return;
    memo[s]++;
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d[s], d[s]+V, LONG_MAX);
    d[s][s] = 0;
    que.push(P(0, s));

    while (!que.empty()) {
        P p = que.top();
        que.pop();
        signed v = p.second;
        if (d[s][v] < p.first) continue;

        for (int i=0; i<G[v].size(); ++i) {
            edge e = G[v][i];
            if (d[s][e.to] > d[s][v] + e.cost) {
                d[s][e.to] = d[s][v] + e.cost;
                que.push(P(d[s][e.to], e.to));
            }
        }
    }
}

signed main() {
    signed V;
    cin >> V;
    for(int i=0; i<V-1; ++i) {
        signed a, b, c;
        cin >> a >> b >> c;
        a--;
        b--;
        edge e = {b, c};
        G[a].push_back(e);
        e = {a, c};
        G[b].push_back(e);
    }

    int q, k;
    cin >> q >> k;
    k--;
    dijkstra(k, V);
    int x, y;
    for(int j=0; j<q; ++j) {
        cin >> x >> y;
        x--;
        y--;
        dijkstra(x, V);
        cout << d[x][k] + d[k][y] << endl;
    }
    return 0;
}



Compiler output:
/tmp/ccnGldcd.o: in function `dijkstra(long, int)':
a.cc:(.text+0x1f): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/ccnGldcd.o
a.cc:(.text+0x3f): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/ccnGldcd.o
a.cc:(.text+0x56): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/ccnGldcd.o
collect2: error: ld returned 1 exit status
Language: C++

//#define _GRIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;

#define int long

struct edge {
    signed to;
    signed cost;
};

// <最短距離, 頂点の番号>
using P = pair<signed, signed>;

signed V;
vector<edge> G[100000];
int d[100000][100000];

int memo[100000];

void dijkstra(int s) {
    if(memo[s]!=0) return;
    memo[s]++;
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d[s], d[s]+V, LONG_MAX);
    d[s][s] = 0;
    que.push(P(0, s));

    while (!que.empty()) {
        P p = que.top();
        que.pop();
        signed v = p.second;
        if (d[s][v] < p.first) continue;

        for (int i=0; i<G[v].size(); ++i) {
            edge e = G[v][i];
            if (d[s][e.to] > d[s][v] + e.cost) {
                d[s][e.to] = d[s][v] + e.cost;
                que.push(P(d[s][e.to], e.to));
            }
        }
    }
}

signed main() {
    cin >> V;
    for(int i=0; i<V-1; ++i) {
        signed a, b, c;
        cin >> a >> b >> c;
        a--;
        b--;
        edge e = {b, c};
        G[a].push_back(e);
        e = {a, c};
        G[b].push_back(e);
    }

    int q, k;
    cin >> q >> k;
    k--;
    dijkstra(k);
    int x, y;
    for(int j=0; j<q; ++j) {
        cin >> x >> y;
        x--;
        y--;
        dijkstra(x);
        cout << d[x][k] + d[k][y] << endl;
    }
    return 0;
}



Compiler output:
/tmp/ccM7oae7.o: in function `dijkstra(long)':
a.cc:(.text+0x1c): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/ccM7oae7.o
a.cc:(.text+0x3c): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/ccM7oae7.o
a.cc:(.text+0x53): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/ccM7oae7.o
collect2: error: ld returned 1 exit status
Language: C++

//#define _GRIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;

#define int long

struct edge {
    int to;
    int cost;
};

// <最短距離, 頂点の番号>
using P = pair<int, int>;

int V;
vector<edge> G[100000];
int d[100000][100000];

int memo[100000];

void dijkstra(int s) {
    if(memo[s]!=0) return;
    memo[s]++;
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d[s], d[s]+V, LONG_MAX);
    d[s][s] = 0;
    que.push(P(0, s));

    while (!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p.second;
        if (d[s][v] < p.first) continue;

        for (int i=0; i<G[v].size(); ++i) {
            edge e = G[v][i];
            if (d[s][e.to] > d[s][v] + e.cost) {
                d[s][e.to] = d[s][v] + e.cost;
                que.push(P(d[s][e.to], e.to));
            }
        }
    }
}

signed main() {
    cin >> V;
    for(int i=0; i<V-1; ++i) {
        int a, b, c;
        cin >> a >> b >> c;
        a--;
        b--;
        edge e = {b, c};
        G[a].push_back(e);
        e = {a, c};
        G[b].push_back(e);
    }

    int q, k;
    cin >> q >> k;
    k--;
    dijkstra(k);
    int x, y;
    for(int j=0; j<q; ++j) {
        cin >> x >> y;
        x--;
        y--;
        dijkstra(x);
        cout << d[x][k] + d[k][y] << endl;
    }
    return 0;
}



Compiler output:
/tmp/ccJlpAcx.o: in function `dijkstra(long)':
a.cc:(.text+0x25): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/ccJlpAcx.o
a.cc:(.text+0x48): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/ccJlpAcx.o
a.cc:(.text+0x5f): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/ccJlpAcx.o
collect2: error: ld returned 1 exit status
Language: C++

//#define _GRIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;

#define int long long

struct edge {
    int to;
    int cost;
};

// <最短距離, 頂点の番号>
using P = pair<int, int>;

int V;
vector<edge> G[100000];
int d[100000][100000];

int memo[100000];

void dijkstra(int s) {
    if(memo[s]!=0) return;
    memo[s]++;
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d[s], d[s]+V, LONG_MAX);
    d[s][s] = 0;
    que.push(P(0, s));

    while (!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p.second;
        if (d[s][v] < p.first) continue;

        for (int i=0; i<G[v].size(); ++i) {
            edge e = G[v][i];
            if (d[s][e.to] > d[s][v] + e.cost) {
                d[s][e.to] = d[s][v] + e.cost;
                que.push(P(d[s][e.to], e.to));
            }
        }
    }
}

signed main() {
    cin >> V;
    for(int i=0; i<V-1; ++i) {
        int a, b, c;
        cin >> a >> b >> c;
        a--;
        b--;
        edge e = {b, c};
        G[a].push_back(e);
        e = {a, c};
        G[b].push_back(e);
    }

    int q, k;
    cin >> q >> k;
    k--;
    dijkstra(k);
    int x, y;
    for(int j=0; j<q; ++j) {
        cin >> x >> y;
        x--;
        y--;
        dijkstra(x);
        cout << d[x][k] + d[k][y] << endl;
    }
    return 0;
}



Compiler output:
/tmp/ccTn9dFa.o: in function `dijkstra(long long)':
a.cc:(.text+0x25): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/ccTn9dFa.o
a.cc:(.text+0x48): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/ccTn9dFa.o
a.cc:(.text+0x5f): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/ccTn9dFa.o
collect2: error: ld returned 1 exit status