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

bool done[100010][15];
void f(int v,int d,int c)
{
    if(done[v][d]) return;
    done[v][d]=true;

    if(colour[v]==0) colour[v]=c;
    if(d==0) return;
    for(int i=0;i<edge[v].size();i++)
    {
        int to=edge[v][i];
        f(to,d-1,c);
    }
}

Compiler output:
a.cc: In function 'void f(int, int, int)':
a.cc:7:8: error: 'colour' was not declared in this scope
    7 |     if(colour[v]==0) colour[v]=c;
      |        ^~~~~~
a.cc:9:19: error: 'edge' was not declared in this scope
    9 |     for(int i=0;i<edge[v].size();i++)
      |                   ^~~~
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

vector<int> G[100'010];
vector<bool> used(100'010, false);
vector<int> color(100'010, 0);

void dfs(int v, int d, int c){
  if(!used[v]){
    color[v] = c;
    used[v] = true;
  }
  if(d>0){
    dfs(v, d-1, c);
  }else{
    return;
  }
  for(int next_:G[v]){
    dfs(next_, d-1, c);
  }
  return;
}

int main(){
  
  int n,m;
  cin>>n>>m;
  int a,b;
  REP(i,m){
    cin>>a>>b;
    a--;b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  int q;
  cin>>q;
  int v[q],d[q],c[q];
  REP(i,q){
    cin>>v[i]>>d[i]>>c[i];
    v[i]--;
  }
  
  for(int i=q-1;i>=0;i--){
    dfs(v[i], q[i], c[i]);
  }
  
  REP(i,n){
    cout<<color[i]<<endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:129:16: error: invalid types 'int[int]' for array subscript
  129 |     dfs(v[i], q[i], c[i]);
      |                ^
Language: C++

14 10
1 4
5 7
7 11
4 10
14 7
14 3
6 14
8 11
5 13
8 3
8
8 6 2
9 7 85
6 9 3
6 7 5
10 3 1
12 9 4
9 6 6
8 2 3

Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 14 10
      | ^~
Language: C++

#include<iostream> #include<iomanip> #include<algorithm> #include<cstring> #include<string> #include<cmath> #include<vector> #include<queue> #include<stack> #include<map> #include<set> using namespace std; const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1}; const long long llinf=9223372036854775807ll; const int N=100005; int a[N][3],ma[N],ans[N],bfs[N]; vector<int> g[N]; void go(int in[]) { int x=in[0]-1,dd=in[1],v=in[2]; if(dd<ma[x]) return ; ma[x]=dd; bfs[0]=x; int rr=1; for(int i=0;i<rr;i++) { int x=bfs[i]; if(!ans[x]) ans[x]=v; if(!ma[x]) continue; for(int i=0;i<g[x].size();i++) { int y=g[x][i]; int nd=ma[x]-1; if(nd>ma[y]) { ma[y]=nd; bfs[rr++]=y; } } } } int n,m,q,x,y; int main(){ cin>>n>>m; for(int i=0;i<m;i++) { cin>>x>>y; x--,y--; g[x].push_back(y); g[y].push_back(x); } cin>>q; for(int i=0;i<q;i++) for(int j=0;j<3;j++) cin>>a[i][j]; for(int i=0;i<N;i++) ma[i]=-1; for(int i=q;i>=0;i--) go(a[i]); for(int i=0;i<n;i++) cout<<ans[i]<<'\n'; return 

Compiler output:
a.cc:1:20: warning: extra tokens at end of #include directive
    1 | #include<iostream> #include<iomanip> #include<algorithm> #include<cstring> #include<string> #include<cmath> #include<vector> #include<queue> #include<stack> #include<map> #include<set> using namespace std; const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1}; const long long llinf=9223372036854775807ll; const int N=100005; int a[N][3],ma[N],ans[N],bfs[N]; vector<int> g[N]; void go(int in[]) { int x=in[0]-1,dd=in[1],v=in[2]; if(dd<ma[x]) return ; ma[x]=dd; bfs[0]=x; int rr=1; for(int i=0;i<rr;i++) { int x=bfs[i]; if(!ans[x]) ans[x]=v; if(!ma[x]) continue; for(int i=0;i<g[x].size();i++) { int y=g[x][i]; int nd=ma[x]-1; if(nd>ma[y]) { ma[y]=nd; bfs[rr++]=y; } } } } int n,m,q,x,y; int main(){ cin>>n>>m; for(int i=0;i<m;i++) { cin>>x>>y; x--,y--; g[x].push_back(y); g[y].push_back(x); } cin>>q; for(int i=0;i<q;i++) for(int j=0;j<3;j++) cin>>a[i][j]; for(int i=0;i<N;i++) ma[i]=-1; for(int i=q;i>=0;i--) go(a[i]); for(int i=0;i<n;i++) cout<<ans[i]<<'\n'; return
      |                    ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
#include <map>
#include <set>
#include <iomanip>
#include <math.h>
#include <stdlib.h>
#include <list>
#include <utility>
#include <memory>
#include <cstring>
#include <fstream>
#include <numeric>
#include <assert.h>
#include <bits/stdc++.h>
using namespace std;
int cl[100004];
int lst[100004];
vector <int> eds[100004];
int n,m,q;
void dfs(int v,int d,int c){
	if (!cl[v]) cl[v]=c;
	if (lst[v]>=d) return;
	lst[v]=d;
	if (d==0) return;
	for (int u:eds[v])
		dfs(u,d-1,c);
}
vector <tuple<int,int,int> > vv;
int main(){
	cin>>n>>m;
	for (int i=0;i<m;i+++){
		int a,b;
		cin>>a>>b;
		--a,--b;
		eds[a].push_back(b);
		eds[b].push_back(a);  
	}
	cin>>q;
	for (int i=0;i<q;i++){
		int v,d,c;
		cin>>v>>d>>c;
		--v;
		vv.push_back(make_tuple(v,d,c)); 
	}
	reverse (vv.begin(),vv.end());
	for (int i=0;i<q;i++){
		int v,d,c;
		tie(v,d,c)=vv[i];
		dfs(v,d,c);
	}
	for (int i=0;i<n;i++) cout<<cl[i]<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:30: error: expected primary-expression before ')' token
   44 |         for (int i=0;i<m;i+++){
      |                              ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int n,m,q,i,j,vt[100005],d[100005],c[100005],dp[100005],col[100005]
vector <int> g[100005];
void dfs(int v,int d,int c)
{
	if (!col[v]) col[v]=c;
	if (dp[v]>=d || d==0) return;
	dp[v]=d;for (int i=0;i<g[v].size();++i)
		dfs(g[v][i],d-1,c);
}
int main()
{
	cin>>n>>m;
	for (i=0;i<m;++i)
	{
		int u,v;
		cin>>u>>v;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	cin>>q;
	for (i=0;i<q;++i) cin>>vt[i]>>d[i]>>c[i];
	for (i=q-1;i>=0;--i) dfs(vt[i],d[i],c[i]);
	for (i=1;i<=n;++i) cout<<col[i];
}

Compiler output:
a.cc:4:1: error: expected initializer before 'vector'
    4 | vector <int> g[100005];
      | ^~~~~~
a.cc: In function 'void dfs(int, int, int)':
a.cc:7:14: error: 'col' was not declared in this scope; did you mean 'cosl'?
    7 |         if (!col[v]) col[v]=c;
      |              ^~~
      |              cosl
a.cc:9:32: error: 'g' was not declared in this scope
    9 |         dp[v]=d;for (int i=0;i<g[v].size();++i)
      |                                ^
a.cc: In function 'int main()':
a.cc:19:17: error: 'g' was not declared in this scope
   19 |                 g[u].push_back(v);
      |                 ^
a.cc:25:34: error: 'col' was not declared in this scope; did you mean 'cosl'?
   25 |         for (i=1;i<=n;++i) cout<<col[i];
      |                                  ^~~
      |                                  cosl
Language: C++

#include <bits/stdc++.h>
using namespace std;
int n,m,q,i,j,vt[100005],d[100005],c[100005],dp[100005],col[100005]
vector <int> g[100005];
void dfs(int v,int d,int c)
{
	if (!col[v]) col[v]=c;
	if (dp[v]>=d || d==0) return;
	dp[v]=d;for (i=0;i<g[v].size();++i)
		dfs(g[v][i],d-1,c);
}
int main()
{
	cin>>n>>m;
	for (i=0;i<m;++i)
	{
		int u,v;
		cin>>u>>v;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	cin>>q;
	for (i=0;i<q;++i) cin>>vt[i]>>d[i]>>c[i];
	for (i=q-1;i>=0;--i) dfs(vt[i],d[i],c[i]);
	for (i=1;i<=n;++i) cout<<col[i];
}

Compiler output:
a.cc:4:1: error: expected initializer before 'vector'
    4 | vector <int> g[100005];
      | ^~~~~~
a.cc: In function 'void dfs(int, int, int)':
a.cc:7:14: error: 'col' was not declared in this scope; did you mean 'cosl'?
    7 |         if (!col[v]) col[v]=c;
      |              ^~~
      |              cosl
a.cc:9:28: error: 'g' was not declared in this scope
    9 |         dp[v]=d;for (i=0;i<g[v].size();++i)
      |                            ^
a.cc: In function 'int main()':
a.cc:19:17: error: 'g' was not declared in this scope
   19 |                 g[u].push_back(v);
      |                 ^
a.cc:25:34: error: 'col' was not declared in this scope; did you mean 'cosl'?
   25 |         for (i=1;i<=n;++i) cout<<col[i];
      |                                  ^~~
      |                                  cosl
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,m;
    cin>>n>>m;
    int a[10];
    for(int i=0;i<10;i++)
    {
        for(int j=0;j<10;j+10)
        {
            for(int k=0;k<10;k++)
            {
                cin>>a[k];
                cout<<a[k];
            }
        }
    }
    cout<<"defineansiloveccs"
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:30: error: expected ';' before 'return'
   19 |     cout<<"defineansiloveccs"
      |                              ^
      |                              ;
   20 |     return 0;
      |     ~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int v[100001],c[100001],d[100001];
int dis[100001];
int co[100001];
int now;
vector<int> g[100001];
void bfs(){
    queue<int> q;
    q.push(v[now]);
    dis[v[now]]=0;
    while(!q.empty()){
        int ths=q.front();
        q.pop();
        if(dis[ths]>d[now])
            break;
        if(!co[ths])
            co[ths]=c[now];
        if(dis[ths]==d[now])
            continue;
        for(int i=0;i<g[ths].size();i++)
            if(dis[g[ths][i]]==-1){
                if(co[g[ths][i]] && dis[ths]+2>n)
                    continue;
                dis[g[ths][i]]=dis[ths]+1;
                q.push(g[ths][i]);
            }
    }
}
int main(){
    int n,m,k;
    scanf("%d%d",&n,&m);
    for(int i=0;i<m;i++){
        int a,b;
        scanf("%d%d",&a,&b);
        g[a].push_back(b);
        g[b].push_back(a); 
    }
    cin>>k;
    for(int i=0;i<k;i++)
        scanf("%d%d%d",v+i,d+i,c+i);
    for(now=k-1;now>=0;now--){
        memset(dis,-1,sizeof(dis));
        bfs();
    }
    for(int i=1;i<=n;i++)
        printf("%d\n",co[i]);
    return 0;
} 

Compiler output:
a.cc: In function 'void bfs()':
a.cc:23:48: error: 'n' was not declared in this scope
   23 |                 if(co[g[ths][i]] && dis[ths]+2>n)
      |                                                ^
Language: C++

//**************************
//*** writer  :  Alex Hu **
//************************

#include<bits/stdc++.h>

using namespace std;

#define CLEAN(a,b) memset(a,b,sizeof(a))
#define mkp make_pair
#define pb push_back
#define rept(i,a,b) for(int i=(int)(a);i<(int)(b);i++)

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi; 

const int maxn=1e5+10;

vi graph[maxn];
int mx[maxn],n,q,m,color[maxn],d[maxn],c[maxn],p[maxn];

int GG()
{
    int x=0;
	char ch=getchar();
    while (!isdigit(ch))
    {
    	ch=getchar();
    	while (isdigit(ch))
		{
			ch=getchar();
			x=x*10+ch-'0';
		} 
	}
    return x;
}


void dfs(int x)
{
    if (!color[x]) color[x]=color[q];
    rept(i,0,g[x].size())
	{
		if (mx[x]-1>mx[i])
		{
			mx[i]=mx[x]-1;
			dfs(i);
		}
	}
}

void gg(int x)
{
	if (x>=10) gg(x/10);
	putchar(x%10+'0');
}

int main()
{
	CLEAN(mx,-1);
    n=GG();
	m=GG();
    rept(i,1,m+1)
	{
		int uu,vv;
		uu=GG();
		vv=GG();
		graph[uu].pb(vv);
		graph[vv].pb(uu);
	}
    q=GG();
    rept(i,1,q+1)
	{
		p[i]=GG();
		d[i]=GG();
		c[i]=GG();
	}
    while (q)
	{
		q--;
		if (d[q]>mx[p[q]]) mx[p[q]]=d[q];
		dfs(p[q]);
	}
    rept(i,1,n+1)
	{
		gg(col[i])
		cout<<endl;
	} 
    return 0;
}

Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:43:14: error: 'g' was not declared in this scope
   43 |     rept(i,0,g[x].size())
      |              ^
a.cc:12:48: note: in definition of macro 'rept'
   12 | #define rept(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
      |                                                ^
a.cc: In function 'int main()':
a.cc:87:20: error: 'col' was not declared in this scope; did you mean 'cosl'?
   87 |                 gg(col[i])
      |                    ^~~
      |                    cosl
Language: C++

#include <bits/stdc++.h>
 
#define pb push_back
#define mp make_pair
 
#define all(x) (x).begin(), (x).end()
 
#define fi first
#define se second
 
using namespace std;
 
typedef long long ll;
 
const int MAXN = (int)1e5 + 5;
 
struct que {
    int v, d, col;
 
    que() {
        v = d = col = 0;
    }
} req[MAXN];
 
vector<int> adj[MAXN];
 
int col[MAXN];
 
int lim[MAXN];
 
int u[MAXN];
 
int n, m, q;
 
int timer;
 
void solve() {
    scanf("%d %d", &n, &m);
 
    for (int i = 1; i <= n; ++i) {
        lim[i] = -1;
        col[i] = 0;
        u[i] = 0;
    }
 
    for (int i = 1, u, v; i <= m; ++i) {
        scanf("%d %d", &u, &v);
        adj[u].pb(v);
        adj[v].pb(u);
    }
 
    scanf("%d", &q);
 
    for (int i = 1; i <= q; ++i) {
        scanf("%d %d %d", &req[i].v, &req[i].d, &req[i].col);
    }
 
    queue<pair<int, int> > Q;
 
    for (int i = q; i > 0; --i) {
        Q.push(mp(req[i].v, req[i].d));
        ++timer;
 				
        while (!Q.empty()) {
            int v = Q.front().fi;
            int d = Q.front().se;
 
            Q.pop();
 
            u[v] = timer;
 
            if (d <= lim[v]) {
                continue;
            }
 
            if (!col[v]) {
                col[v] = req[i].col;
            }
 
            lim[v] = d;
 
            for (int to : adj[v]) {
                if (u[to] != timer) {
                    Q.push(mp(to, d - 1));
                }
            }
        }
    }
 
    for (int i = 1; i <= n; ++i) {
        printf("%d\n", col[i]);
    }
	return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:93:16: error: return-statement with a value, in function returning 'void' [-fpermissive]
   93 |         return 0;
      |                ^
Language: C++

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
#include <map>
#include <set>
#include <iomanip>
#include <math.h>
#include <stdlib.h>
#include <list>
#include <utility>
#include <memory>
#include <cstring>
#include <fstream>
#include <numeric>
#include <assert.h>
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
int N,M,Q;
vector <int> g[100004];
int col[100004];
int dist[100004];
void bfs(int v,int d,int c){
	fill (dist,dist+100004,1e7);
	queue <int> q;
	dist[v]=0;
	q.push(v);  
	while(!q.empty()){
		int x=q.front();
		q.pop();
		col[x]=c; 
		if (dist[x]==d) break;
		for (int i=0;i<g[x].size();i++){
			int n=g[x][i];
			if (dist[n]>dist[x]+1){
				dist[n]=dist[x]+1;
				if ()q.push(n);  
			}
		}
	}
}
int main(){
	memset (col,0,sizeof(col));
	cin>>N>>M;
	for (int i=0;i<M;i++){
		int x,y;
		cin>>x>>y;
		g[x].push_back(y);
		g[y].push_back(x);
	}
	cin>>Q;
	for (int i=0;i<Q;i++){
		int v,d,c;
		cin>>v>>d>>c;
		bfs(v,d,c);
	}
	for (int i=1;i<=N;i++)
		cout<<col[i]<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'void bfs(int, int, int)':
a.cc:48:37: error: expected primary-expression before ')' token
   48 |                                 if ()q.push(n);
      |                                     ^
Language: C++

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	int n,m,q;
	cin>>n>>m;
	vector<int> a(n),b(n),mx(n+1,-1),ans(n+1,0);
	vector<vector<int>> g=vector<vector<int>>(n+2,vector<int>());
	FOR(i,0,m){
		cin>>a[i]>>b[i];
		g[a[i]].PB(b[i]);
		g[b[i]].PB(a[i]);
	}
	cin>>q;
	vector<int> v(q),d(q),c(q),
	FOR(i,0,q)cin>>v[i]>>d[i]>>c[i];

	FORD(i,n,0){
		queue<pair<pair<int,int>,int>> q;
		q.push(MP(MP(v[i],d[i]),c[i]));
		while(q.size()){
			pair<pair<int,int>,int> tpl=q.front();
			q.pop();
			int vv=tpl.ST.ST,dd=tpl.ST.ND,cc=tpl.ND;
			if(mx[vv]>=dd)continue;
			mx[vv]=dd;
			if(ans[vv]==0)ans[vv]=cc;
			int l=g[vv].size();
			FOR(j,0,l){
				if(mx[g[vv][j]]<dd-1){
					q.push(MP(MP(g[vv][j],dd-1),cc));
				}
			}
		}
	}
	FORQ(i,1,n){
		cout<<ans[i]<<endl;
	}
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:20: error: expected unqualified-id before 'for'
   22 | #define FOR(i,b,e) for(int i=(b);i<(e);++i)
      |                    ^~~
a.cc:50:9: note: in expansion of macro 'FOR'
   50 |         FOR(i,0,q)cin>>v[i]>>d[i]>>c[i];
      |         ^~~
a.cc:50:13: error: 'i' was not declared in this scope
   50 |         FOR(i,0,q)cin>>v[i]>>d[i]>>c[i];
      |             ^
a.cc:22:34: note: in definition of macro 'FOR'
   22 | #define FOR(i,b,e) for(int i=(b);i<(e);++i)
      |                                  ^
Language: C++

//waz
#include <bits/stdc++.h>

using namespace std;

#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)((x).size()))

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef long long int64;
typedef unsigned int uint;
typedef unsigned long long uint64;

#define gi(x) ((x) = F())
#define gii(x, y) (gi(x), gi(y))
#define giii(x, y, z) (gii(x, y), gi(z))

int F()
{
	char ch;
	int x, a;
	while (ch = getchar(), (ch < '0' || ch > '9') && ch != '-');
	if (ch == '-') ch = getchar(), a = -1;
	else a = 1;
	x = ch - '0';
	while (ch = getchar(), ch >= '0' && ch <= '9')
		x = (x << 1) + (x << 3) + ch - '0';
	return a * x;
}

const int N = 1e5 + 10;

int n, m;

VI edge[N];

int mxd[N], co[N];

void dfs(int u, int d, int c)
{
	if (d <= mxd[u]) return;
	if (!co[u]) co[u] = c;
	mxd[u] = d;
	for (auto : edge[u])
		dfs(v, d - 1, c);
}

int v[N], d[N], c[N];

int main()
{
	gii(n, m);
	for (int i = 1; i <= n; ++i) mxd[i] = -1;
	for (int i = 1; i <= m; ++i)
	{
		int u, v;
		gii(u, v);
		edge[u].pb(v);
		edge[v].pb(u);
	}
	int q;
	gi(q);
	for (int i = 1; i <= q; ++i)
		giii(v[i], d[i], c[i]);
	for (int i = q; i; --i)
		dfs(v[i], d[i], c[i]);
	for (int i = 1; i <= n; ++i)
		printf("%d\n", co[i]);
}

Compiler output:
a.cc: In function 'void dfs(int, int, int)':
a.cc:49:19: error: expected unqualified-id before ':' token
   49 |         for (auto : edge[u])
      |                   ^
a.cc:50:21: error: 'v' was not declared in this scope
   50 |                 dfs(v, d - 1, c);
      |                     ^
Language: C++

14 10
1 4
5 7
7 11
4 10
14 7
14 3
6 14
8 11
5 13
8 3
8
8 6 2
9 7 85
6 9 3
6 7 5
10 3 1
12 9 4
9 6 6
8 2 3


Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 14 10
      | ^~
Language: C++

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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<int,P> PP;

struct edge {
	int to, cost;
	edge(int t,int c):to(t),cost(c) {}
};
int dx[]={1,-1,0,0},dy[]={0,0,1,-1};

//-----------------------------------------------------------------------------

int n,m,q;
vector<int> g[100000];
int c[100000];
int dp[11][100000];

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	REP(i,11) fill(dp[i],dp[i]+100000,-1);

	cin>>n>>m;
	REP(i,m) {
		int x,y;cin>>x>>y;x--,y--;
		g[x].pb(y),g[y].pb(x);
	}
	cin>>q;
	REP(i,q) {
		cin>>v>>d>>c[i];
		v--;
		dp[d][v]=i;
	}

	for(int i=10;i>0;i--) {
		REP(j,n) {
			if(dp[i][j]!=-1) {
				dp[i-1][j]=max(dp[i-1][j],dp[i][j]);
				for(auto u:g[j]) dp[i-1][u]=max(dp[i-1][u],dp[i][j]);
			}
		}
	}
	REP(i,n) cout<<(dp[0][i]==-1?0:c[dp[0][i]])<<endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:47:22: error: 'v' was not declared in this scope
   47 |                 cin>>v>>d>>c[i];
      |                      ^
a.cc:47:25: error: 'd' was not declared in this scope
   47 |                 cin>>v>>d>>c[i];
      |                         ^
Language: C++

#include<cstdio>
#include<algorithm>
#include<cstring>

#define maxn 200050
#define add(u,v)(to[++top]=head[u],head[u]=top,w[top]=v)
#define For(x) for (int h=head[x],o=w[h];h;o=w[h=to[h]])

using namespace std;

int n,m,to[maxn],head[maxn],w[maxn],u,v,top;
int a[maxn],b[maxn],c[maxn],co[maxn],r[maxn],q,i;

void dfs(int x,int rg,int col){
	if (rg<=r[x]||rg<=0) return;
	r[x]=rg;
	if (co[x]==0) co[x]=col;
	For(x) dfs(o,rg-1,col);
}

int main(){
	scanf("%d%d",&n,&m);
	while (m--){
		scanf("%d%d",&u,&v);
		add(u,v);add(v,u);
	}
	scanf("%d",&q);
	for (i=1;i<=q;i++) scanf("%d%d%d",&a[i],&b[i],&c[i]);
	memeset(co,0,sizeof(co));memset(r,0,sizeof(r));
	for (i=q;i>=1;i--) dfs(a[i],b[i]+1,c[i]);
	for (i=1;i<=n;i++) printf("%d\n",co[i]);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:9: error: 'memeset' was not declared in this scope; did you mean 'memset'?
   29 |         memeset(co,0,sizeof(co));memset(r,0,sizeof(r));
      |         ^~~~~~~
      |         memset
Language: C++

#include<cstdio>
using namespace std;

const int N=100000+5;

int n, m;
int d[N], v[N], c[N];

int cnt, first[N], to[2*N], next[2*N];
void add(int u, int v) {
	to[++cnt]=v; next[cnt]=first[u]; first[u]=cnt;
	to[++cnt]=u; next[cnt]=first[v]; first[v]=cnt;
}

int col[N], mark[N];
void work(int now, int len, int color) {
	if(len<0||(col[now]&&mark[now]>=len)) return;
	if(col[now]==0) col[now]=color, mark[now]=len;
	for(int p=first[now]; p; p=next[p])  work(to[p], len-1, color);
}

int main() {
	scanf("%d%d", &n, &m);
	for(int i=1, a, b; i<=m; i++) {
		scanf("%d%d", &a, &b);
		add(a, b);
	}
	int Q;
	scanf("%d", &Q);
	for(int i=1; i<=Q; i++) scanf("%d%d%d", &v[i], &d[i], &c[i]);
	for(int i=Q; i>=1; i--) work(v[i], 0, d[i], c[i]);
	for(int i=1; i<=n; i++) printf("%d\n", col[i]);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:37: error: too many arguments to function 'void work(int, int, int)'
   31 |         for(int i=Q; i>=1; i--) work(v[i], 0, d[i], c[i]);
      |                                 ~~~~^~~~~~~~~~~~~~~~~~~~~
a.cc:16:6: note: declared here
   16 | void work(int now, int len, int color) {
      |      ^~~~
Language: C++

/*
ID: 5ak0
PROG:
LANG: C++11
*/

#include <bits/stdc++.h>
#define fr first
#define sc second
#define pb push_back
#define mpr make_pair

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9 + 7, MAXN = 1e5 + 10, MAXD = 11;

int n, m, q;
int c[MAXN], v, d;
vector <int> g[MAXN];
int dp[MAXN][MAXD];

int main(){
    #ifndef SAKO
    //freopen(".in", "r", stdin);
    //freopen(".out", "w", stdout);
    #endif // SAKO
    ios_base::sync_with_stdio(0);
	cin >> n >> m;
	for (int i = 1; i <= m; ++i){
		cin >> v >> d;
		g[v].pb(d);
		g[d].pb(v);
	}
	cin >> q;
	for (int i = 1; i <= q; ++i){
		cin >> v >> d >> c[i];
		dp[v][d] = i;
	}
	for (int i = 9; i >= 0; --i){
		for (int j = 1; j <= n; ++j){
			dp[j][i] = max(dp[j][i], dp[j][i + 1]);
			for (auto to : e[j]){
				dp[j][i]=max(dp[j][i],dp[to][i+1]);
			}
		}
	}
	for (int i = 1; i <= n; ++i)
		cout << c[dp[i][0]] << "\n";

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:40: error: 'e' was not declared in this scope
   44 |                         for (auto to : e[j]){
      |                                        ^
Language: C++

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <algorithm>

using namespace std;

struct node {
    int color;
    int next[100001];
    int nextnum = 0;
};
int n, m, q;
struct node Node[100001];
int visit[100001];

void color (int v, int d, int c) {
    Node[v].color = c;
    int i = v;
        visit[i] = 1;
        for (int j = 0; j < Node[i].nextnum; j++) {
            //if (visit[Node[i].next[j]])
                //continue;
            if (d == 1) {
                Node[Node[i].next[j]].color = c;
                
            }
            else {
                Node[Node[i].next[j]].color = c;
                color (Node[i].next[j], d - 1, c);
            }
        }
        visit[i] = 0;
    
}

int main () {
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; i++) {
        Node[i].color = 0;
        Node[i].nextnum = 0;
    }
    for (int i = 0; i < m; i++) {
        int a, b;
        scanf("%d%d", &a, &b);
        Node[a].next[Node[a].nextnum++] = b;
        Node[b].next[Node[b].nextnum++] = a;
    }
    scanf("%d", &q);
    memset (visit, 0, sizeof(int) * n);
    for (int i = 0; i < q; i++) {
        int v, d, c;
        scanf("%d%d%d", &v, &d, &c);
        
        color (v, d, c);
    }
    
    for (int i = 1; i <= n; i++) {
        printf("%d\n", Node[i].color);
    }
    return 0;
}


Compiler output:
/tmp/cceP1Gjn.o: in function `color(int, int, int)':
a.cc:(.text+0x40): relocation truncated to fit: R_X86_64_PC32 against symbol `visit' defined in .bss section in /tmp/cceP1Gjn.o
a.cc:(.text+0x145): relocation truncated to fit: R_X86_64_PC32 against symbol `visit' defined in .bss section in /tmp/cceP1Gjn.o
/tmp/cceP1Gjn.o: in function `main':
a.cc:(.text+0x2ee): relocation truncated to fit: R_X86_64_PC32 against symbol `visit' defined in .bss section in /tmp/cceP1Gjn.o
collect2: error: ld returned 1 exit status
Language: C++

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <algorithm>

using namespace std;

struct node {
    int color;
    int next[100001];
    int nextnum = 0;
};
int n, m, q;
struct node Node[100001];
int visit[100001];

void color (int v, int d, int c) {
    Node[v].color = c;
    int i = v;
        visit[i] = 1;
        for (int j = 0; j < Node[i].nextnum; j++) {
            //if (visit[Node[i].next[j]])
                //continue;
            if (d == 1) {
                Node[Node[i].next[j]].color = c;
                
            }
            else {
                Node[Node[i].next[j]].color = c;
                color (Node[i].next[j], d - 1, c);
            }
        }
        visit[i] = 0;
    
}

int main () {
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; i++) {
        Node[i].color = 0;
        Node[i].nextnum = 0;
    }
    for (int i = 0; i < m; i++) {
        int a, b;
        scanf("%d%d", &a, &b);
        Node[a].next[Node[a].nextnum++] = b;
        Node[b].next[Node[b].nextnum++] = a;
    }
    scanf("%d", &q);
    memset (visit, 0, sizeof(int) * n);
    for (int i = 0; i < q; i++) {
        int v, d, c;
        scanf("%d%d%d", &v, &d, &c);
        
        color (v, d, c);
    }
    
    for (int i = 1; i <= n; i++) {
        printf("%d\n", Node[i].color);
    }
    return 0;
}


Compiler output:
/tmp/ccfzPHTA.o: in function `color(int, int, int)':
a.cc:(.text+0x40): relocation truncated to fit: R_X86_64_PC32 against symbol `visit' defined in .bss section in /tmp/ccfzPHTA.o
a.cc:(.text+0x145): relocation truncated to fit: R_X86_64_PC32 against symbol `visit' defined in .bss section in /tmp/ccfzPHTA.o
/tmp/ccfzPHTA.o: in function `main':
a.cc:(.text+0x2ee): relocation truncated to fit: R_X86_64_PC32 against symbol `visit' defined in .bss section in /tmp/ccfzPHTA.o
collect2: error: ld returned 1 exit status
Language: C++

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <algorithm>

using namespace std;

struct node {
    int color;
    int next[100001];
    int nextnum = 0;
};
int n, m, q;
struct node Node[100001];
int visit[100001];

void color (int v, int d, int c) {
    Node[v].color = c;
    int i = v;
        visit[i] = 1;
        for (int j = 0; j < Node[i].nextnum; j++) {
            //if (visit[Node[i].next[j]])
                //continue;
            if (d == 1) {
                Node[Node[i].next[j]].color = c;
                
            }
            else {
                Node[Node[i].next[j]].color = c;
                color (Node[i].next[j], d - 1, c);
            }
        }
        visit[i] = 0;
    
}

int main () {
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; i++) {
        Node[i].color = 0;
        Node[i].nextnum = 0;
    }
    for (int i = 0; i < m; i++) {
        int a, b;
        scanf("%d%d", &a, &b);
        Node[a].next[Node[a].nextnum++] = b;
        Node[b].next[Node[b].nextnum++] = a;
    }
    scanf("%d", &q);
    memset (visit, 0, sizeof(int) * n);
    for (int i = 0; i < q; i++) {
        int v, d, c;
        scanf("%d%d%d", &v, &d, &c);
        
        color (v, d, c);
    }
    
    for (int i = 1; i <= n; i++) {
        printf("%d\n", Node[i].color);
    }
}


Compiler output:
/tmp/ccmqBCjR.o: in function `color(int, int, int)':
a.cc:(.text+0x40): relocation truncated to fit: R_X86_64_PC32 against symbol `visit' defined in .bss section in /tmp/ccmqBCjR.o
a.cc:(.text+0x145): relocation truncated to fit: R_X86_64_PC32 against symbol `visit' defined in .bss section in /tmp/ccmqBCjR.o
/tmp/ccmqBCjR.o: in function `main':
a.cc:(.text+0x2ee): relocation truncated to fit: R_X86_64_PC32 against symbol `visit' defined in .bss section in /tmp/ccmqBCjR.o
collect2: error: ld returned 1 exit status
Language: C++

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <algorithm>

using namespace std;

struct node {
    int color;
    int next[100001];
    int nextnum = 0;
};
int n, m, q;
struct node Node[100001];
int visit[100001];

void color (int v, int d, int c) {
    Node[v].color = c;
    int i = v;
        visit[i] = 1;
        for (int j = 0; j < Node[i].nextnum; j++) {
            //if (visit[Node[i].next[j]])
                //continue;
            if (d == 1) {
                Node[Node[i].next[j]].color = c;
                
            }
            else {
                Node[Node[i].next[j]].color = c;
                color (Node[i].next[j], d - 1, c);
            }
        }
        visit[i] = 0;
    
}

int main () {
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; i++) {
        Node[i].color = 0;
        Node[i].nextnum = 0;
    }
    for (int i = 0; i < m; i++) {
        int a, b;
        scanf("%d%d", &a, &b);
        Node[a].next[Node[a].nextnum++] = b;
        Node[b].next[Node[b].nextnum++] = a;
    }
    scanf("%d", &q);
    memset (visit, 0, sizeof(int) * n);
    for (int i = 0; i < q; i++) {
        int v, d, c;
        scanf("%d%d%d", &v, &d, &c);
        
        color (v, d, c);
    }
    
    for (int i = 1; i <= n; i++) {
        printf("%d\n", Node[i].color);
    }
}


Compiler output:
/tmp/ccOtTc4T.o: in function `color(int, int, int)':
a.cc:(.text+0x40): relocation truncated to fit: R_X86_64_PC32 against symbol `visit' defined in .bss section in /tmp/ccOtTc4T.o
a.cc:(.text+0x145): relocation truncated to fit: R_X86_64_PC32 against symbol `visit' defined in .bss section in /tmp/ccOtTc4T.o
/tmp/ccOtTc4T.o: in function `main':
a.cc:(.text+0x2ee): relocation truncated to fit: R_X86_64_PC32 against symbol `visit' defined in .bss section in /tmp/ccOtTc4T.o
collect2: error: ld returned 1 exit status
Language: C++

#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
int n,m,q;
int dp[10][100001];
int d[100001],c[100001],v[100001];
vector<int> G[100001];

void f(int ver,int dist,int color){
  //printf("%d %d %d\n",ver,dist,color);
  if(dist<0)return ;
  if(dp[dist][ver]!=0)return ;
  
  dp[dist][ver]=color;
  
  f(ver,dist-1,color);
  for(int i=0;i<G[ver].size();i++){
    int u=G[ver][i];
    f(u,dist-1,color);
  }
}

int main(){
  cin >> n >> m;
  for(int i=0;i<m;i++){
    int a,b;
    cin >> a >> b;
    a--;b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  cin >> q;
  for(int i=0;i<q;i++){
    cin >> v[i] >> d[i] >> c[i];
    v[i]--;
  }
  for(int i=q-1;i>=0;i--){
    f(v[i],d[i],c[i]);
  }
  for(int i=0;i<n;i++)cout << dp[0][i] << endl;
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:3: error: 'cin' was not declared in this scope
   25 |   cin >> n >> m;
      |   ^~~
a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    3 | #include <queue>
  +++ |+#include <iostream>
    4 | using namespace std;
a.cc:41:23: error: 'cout' was not declared in this scope
   41 |   for(int i=0;i<n;i++)cout << dp[0][i] << endl;
      |                       ^~~~
a.cc:41:23: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:41:43: error: 'endl' was not declared in this scope
   41 |   for(int i=0;i<n;i++)cout << dp[0][i] << endl;
      |                                           ^~~~
a.cc:4:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    3 | #include <queue>
  +++ |+#include <ostream>
    4 | using namespace std;
Language: C++

#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <string>
#include <algorithm>
#include <climits>
#include <set>
#include <queue>
#include <unordered_set>
using namespace std;

#define ll long long

struct Question
{
	int v;
	int d;
	int c;	
};

class Solver
{
public:
	int n;
	int m;
	int q;
	vector<vector<int> > adj;
	vector<Question> qs;
	vector<vector<int> > dp;
	unordered_set<int> us;

	Solver();

	void set(int cur, int depth, int color);
	void exec();
};

Solver::Solver(){
	cin >> n >> m;
	adj.resize(n)
	for (int i = 0; i < m; ++i)
	{
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		adj[a].push_back(b);
		adj[b].push_back(a);
		us.insert(i);
	}
	cin >> q;
	for (int i = 0; i < q; ++i)
	{
		Question tmpQ;
		cin >> tmpQ.v >> tmpQ.d >> tmpQ.c;
		tmpQ.v--;
		qs.push_back(tmpQ);
	}
	dp = vector<vector<int> >(n, vector<int>(11, 0));
}


void Solver::set(int cur, int depth, int color){
	if(dp[cur][depth] != 0) return;
	dp[cur][depth] = color;
	if(depth == 0) return;
	set(cur, depth-1, color);
	for (int i = 0; i < adj[cur].size(); ++i)
	{
		set(adj[cur][i] , depth-1, color);
	}
}

void Solver::exec(){
	for (int i = q-1; i >= 0; --i)
	{
		set(qs[i].v, qs[i].d, qs[i].c);
	}

	for (int i = 0; i < n; ++i)
	{
		cout << dp[i][0] << endl;
	}
}

int main(){
	Solver solution = Solver();
	solution.exec();
}


Compiler output:
a.cc: In constructor 'Solver::Solver()':
a.cc:41:22: error: expected ';' before 'for'
   41 |         adj.resize(n)
      |                      ^
      |                      ;
   42 |         for (int i = 0; i < m; ++i)
      |         ~~~           
a.cc:42:25: error: 'i' was not declared in this scope
   42 |         for (int i = 0; i < m; ++i)
      |                         ^
Language: Java

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

	public Main() {
		// TODO Auto-generated constructor stub
	}

	public static void main(String[] args) {
		SplatterPainting sp = new SplatterPainting();
		sp.run();
	}

}

class SplatterPainting {
	
	class Vertex {
		
		int id;
		ArrayList<Vertex> neighbours;
		int color;
		
		public Vertex(int id) {
			neighbours = new ArrayList<>();
			color = 0;
			this.id = id;
		}
	}
	
	boolean[] isPainted; 
	Vertex[] vertices;
	
	public SplatterPainting() {
		
	}
	
	public void run() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		vertices = new Vertex[N + 1];
		int M = sc.nextInt();
		for(int i = 0; i < M; i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			if(vertices[a] == null)
				vertices[a] = new Vertex(a);
			if(vertices[b] == null)
				vertices[b] = new Vertex(b);
			vertices[a].neighbours.add(vertices[b]);
			vertices[b].neighbours.add(vertices[a]);
		}
		int Q = sc.nextInt();
		for(int i = 0; i < Q; i++) {
			int v = sc.nextInt();
			int d = sc.nextInt();
			int c = sc.nextInt();
			isPainted = new boolean[N + 1];
			paint(vertices[v], d, c);
		}
		sc.close();
		for(int i = 1; i < N + 1; i++)
			System.out.println(vertices[i].color);
	}
	
	public void paint(Vertex from, int distance, int color) {
		from.color = color;
		isPainted[from.id] = true;
		if(distance == 0)
			return;
		for(int i = 0; i < from.neighbours.size(); i++) {
			if(!isPainted[from.neighbours.get(i).id]) {
				paint(from.neighbours.get(i), distance - 1, color);
			}
		}
	}
}

}


Compiler output:
Main.java:84: error: class, interface, enum, or record expected
}
^
1 error
Language: C++

//It is made by ljh2000
//有志者，事竟成，破釜沉舟，百二秦关终属楚；苦心人，天不负，卧薪尝胆，三千越甲可吞吴。
#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
#include <cstdio>
#include <string>
#include <queue>
#include <cmath>
#include <ctime>
using namespace std;
typedef long long LL;
const int MAXN = 100011;
const int MAXM = 200011;
int n,m,Q,ecnt,first[MAXN],to[MAXM],next[MAXM],col[MAXN],maxd[MAXN];
struct ask{ int x,d,c; }q[MAXN];
inline void link(int x,int y){ next[++ecnt]=first[x]; first[x]=ecnt; to[ecnt]=y; }
inline int getint(){
    int w=0,q=0; char c=getchar(); while((c<'0'||c>'9') && c!='-') c=getchar();
    if(c=='-') q=1,c=getchar(); while (c>='0'&&c<='9') w=w*10+c-'0',c=getchar(); return q?-w:w;
}

inline void dfs(int x,int d,int c){
	if(d<0) return ; if(!col[x]) col[x]=c;
	if(maxd[x]>=d) return ;
	maxd[x]=d;
	for(int i=first[x];i;i=next[i]) {
		int v=to[i]; 
		dfs(v,d-1,c);
	}
}

inline void work(){
	n=getint(); m=getint(); int x,y;
	for(int i=1;i<=m;i++) { x=getint(); y=getint(); link(x,y); link(y,x); }
	Q=getint(); memset(maxd,-1,sizeof(maxd));
	for(int i=1;i<=Q;i++) { q[i].x=getint(); q[i].d=getint(); q[i].c=getint(); }
	for(int i=Q;i>=1;i--) dfs(q[i].x,q[i].d,q[i].c);
	for(int i=1;i<=n;i++) printf("%d\n",col[i]);
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("B.in","r",stdin);
	freopen("B.out","w",stdout);
#endif
    work();
    return 0;
}
//有志者，事竟成，破釜沉舟，百二秦关终属楚；苦心人，天不负，卧薪尝胆，三千越甲可吞吴。


Compiler output:
a.cc: In function 'void link(int, int)':
a.cc:18:32: error: reference to 'next' is ambiguous
   18 | inline void link(int x,int y){ next[++ecnt]=first[x]; first[x]=ecnt; to[ecnt]=y; }
      |                                ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66,
                 from /usr/include/c++/14/algorithm:60,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:16:37: note:                 'int next [200011]'
   16 | int n,m,Q,ecnt,first[MAXN],to[MAXM],next[MAXM],col[MAXN],maxd[MAXN];
      |                                     ^~~~
a.cc: In function 'void dfs(int, int, int)':
a.cc:28:32: error: reference to 'next' is ambiguous
   28 |         for(int i=first[x];i;i=next[i]) {
      |                                ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:16:37: note:                 'int next [200011]'
   16 | int n,m,Q,ecnt,first[MAXN],to[MAXM],next[MAXM],col[MAXN],maxd[MAXN];
      |                                     ^~~~
Language: C++

#include<iostream>
#include<stack>
using namespace std;
static const int N = 100001;
int n, m,q,color[N];

void dfs(int v,int d,int c) {
  color[v]=c;
  if(d==0) return;
  d--;

  for(int i=1;i<=n;i++){
    if(M[v][i]==1||M[i][v]==1){
      dfs(i,d,c);
    }
  }
  
  for(int i=1;i<=n;i++){
  //ぬる  
  }
}


int main()
{
  
	int a,b,v[N],d[N],c[N];
	cin >> n >>m;
  
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			M[i][j] = 0;
		}
	}
  
	for (int i = 0; i < m; i++) {
		cin >> a >> b;
    M[a][b]=M[b][a]=1;
  }

  cin>>q;
  
  for(int i=0;i<q;i++){
    cin>>v[i]>>d[i]>>c[i];
  }
  
  for (int i = 1; i <= n; i++) {
    color[i] = 0;
  }

  for(int i=q-1;i>0;i++){
    dfs(v[i],d[i],c[i]);
  }

  for(int i=1;i<=n;i++){
    cout<<color[i]<<endl;
  }
  
  return 0;
}

Compiler output:
a.cc: In function 'void dfs(int, int, int)':
a.cc:13:8: error: 'M' was not declared in this scope
   13 |     if(M[v][i]==1||M[i][v]==1){
      |        ^
a.cc: In function 'int main()':
a.cc:32:25: error: 'M' was not declared in this scope
   32 |                         M[i][j] = 0;
      |                         ^
a.cc:38:5: error: 'M' was not declared in this scope
   38 |     M[a][b]=M[b][a]=1;
      |     ^
Language: C++

#include<bits/stdc++.h>
#define INF 1e9+7
#define ll long long
#define F first
#define S second
#define N 100005
#define M 1000000009
#define mp make_pair
#define ull unsigned long long
#define sc(n) scanf("%d",&n)
#define gcd __gcd
#define pb push_back
using namespace std;

std::vector<int> v[N],jh;
stack<pair<int,pair<int,int> > > qu;
pair<int,pair<int,int> > pa;

int dis[N],col[N];
void line(int s,int d,int c){
	if(!col[s])
		col[s]=c;
	if(dis[s]>=d || d<1)
		return;
	dis[s]=max(d,dis[s]);
	for(int i: v[s]){
		if(dis[i]<d-1)
			line(i,d-1,c);
}
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n,m;
	cin>>n>>m;
	for (int i = 0; i < m; ++i)
	{
		int x,y;
		cin>>x>>y;
		v[x].push_back(y);
		v[y].push_back(x);
	}
	int u,d,c,q;
	cin>>q;
	for(int i=0;i<q;i++){
		cin>>u>>d>>c;
		qu.push(mp(u,mp(d,c)));
	}
	while(!qu.empty()){
		pa = qu.top();
		qu.pop();
		line(pa.F,pa.S.F,pa.S.S);
	}
	for(int i=1;i<=n;i++)
		cout<<col[i]<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'void line(int, int, int)':
a.cc:30:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   30 | int main(){
      |         ^~
a.cc:30:9: note: remove parentheses to default-initialize a variable
   30 | int main(){
      |         ^~
      |         --
a.cc:30:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:30:11: error: a function-definition is not allowed here before '{' token
   30 | int main(){
      |           ^
a.cc:56:2: error: expected '}' at end of input
   56 | }
      |  ^
a.cc:20:29: note: to match this '{'
   20 | void line(int s,int d,int c){
      |                             ^
Language: C++

//#pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = (int) 1e5 + 5;
const int mod = (int) 1e9 + 7;

vector<int> g[N];
int n, m, q, ans[N], ds[N], od[N];

void paint (int v, int d, int c, int ood) {
        if (ans[v] != 0 && ds[v] >= d) {
                return;
        }
        bool f = true;
        if (!ans[v]) {
                f = false;
                od[v] = ood;
                ans[v] = c;
                ds[v] = d;
        }
        if (d) {
                for (int to : g[v]) {
                        if (f && od[to] >= d && od[v] == od[to] && d[v] == d[to] - 1 && ans[v] == ans[to]) {
                                continue;
                        }
                        paint (to, d - 1, c, ood);
                }
        }
}

int v[N], d[N], c[N];

inline void solve () {
        scanf ("%d%d", &n, &m);
        for (int i = 1; i <= m; i++) {
                int x, y;
                scanf ("%d%d", &x, &y);
                g[x].emplace_back (y);
                g[y].emplace_back (x);
        }
        scanf ("%d", &q);
        for (int i = 1; i <= q; i++) {
                scanf ("%d%d%d", &v[i], &d[i], &c[i]);
        }
        for (int i = q; i >= 1; i--) {
                paint (v[i], d[i], c[i], d[i]);
        }
        for (int i = 1; i <= n; i++) {
                printf ("%d\n", ans[i]);
        }
}

int tests = 1;

int main () {
//        freopen (".in", "r", stdin);
//        freopen (".out", "w", stdout);
//        scanf ("%d", &tests);
        while (tests--) {
                solve ();
        }
        return 0;
}


Compiler output:
a.cc: In function 'void paint(int, int, int, int)':
a.cc:27:69: error: invalid types 'int[int]' for array subscript
   27 |                         if (f && od[to] >= d && od[v] == od[to] && d[v] == d[to] - 1 && ans[v] == ans[to]) {
      |                                                                     ^
a.cc:27:77: error: invalid types 'int[int]' for array subscript
   27 |                         if (f && od[to] >= d && od[v] == od[to] && d[v] == d[to] - 1 && ans[v] == ans[to]) {
      |                                                                             ^
Language: C++

#include <iostream>
#include <queue>
#include <vector>
#include <cstdio>
#include <cstring>
using namespace std;
vector<int> adj[100001];
bool dp[100001][11];
int color[100001];
void dfs(int v,int d,int c){
    
    if(color[v]==0) color[v]=c;
    dp[v][d]=true;
    
    for(int i=0;i<adj[v].size();i++){
        int next = adj[v][i];
        if(d>0 && !dp[next][d-1]){
            dfs(next,d-1,c);
        }
    }
}
int main(int argc, const char * argv[]) {
 
    
    int n,m;
    
    scanf("%d %d",&n,&m);
    
    for(int i=0,x,y;i<m;i++){
        scanf("%d %d",&x,&y);
        adj[x].push_back(y);
        adj[y].push_back(x);
    }
    
    
    int q;
    scanf("%d",&q);
    
    for(int i=0;i<q;i++){
        scanf("%d %d %d",&v[i],&d[i],&c[i]);
    }
    
    for(int i=q-1;i>=0;i--){
        dfs(v[i],d[i],c[i]);
    }
    for(int i=1;i<=n;i++){
        printf("%d\n",color[i]);
    }
    
    return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:40:27: error: 'v' was not declared in this scope
   40 |         scanf("%d %d %d",&v[i],&d[i],&c[i]);
      |                           ^
a.cc:40:33: error: 'd' was not declared in this scope
   40 |         scanf("%d %d %d",&v[i],&d[i],&c[i]);
      |                                 ^
a.cc:40:39: error: 'c' was not declared in this scope
   40 |         scanf("%d %d %d",&v[i],&d[i],&c[i]);
      |                                       ^
a.cc:44:13: error: 'v' was not declared in this scope
   44 |         dfs(v[i],d[i],c[i]);
      |             ^
a.cc:44:18: error: 'd' was not declared in this scope
   44 |         dfs(v[i],d[i],c[i]);
      |                  ^
a.cc:44:23: error: 'c' was not declared in this scope
   44 |         dfs(v[i],d[i],c[i]);
      |                       ^