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

#include<stdio.h>
#include<stdlib.h>
#define MAX 100000
int matrix[MAX][MAX] = {0}, *visit, *queue;
int bfs(int, int, int);
main()
{
        int i, n, m, q, s, t;
        scanf("%d%d", &n, &m);
        visit = (int*)malloc(sizeof(int) * n);
    	queue = (int*)malloc(sizeof(int) * n);
        for (i = 0; i < m; i++) {
                scanf("%d%d", &s, &t);
            matrix[s][t] = matrix[t][s] = 1;
        }
        scanf("%d", &q);
        for (i = 0; i< q; i++) {
                scanf("%d%d", &s, &t);
                if (bfs(s, t, n)) {
                        printf("yes\n");
                } else {
                        printf("no\n");
                }
        }
        free(visit);
        free(queue);
}
int bfs(int s, int t,int size)
{
        int i, pos, head = 0, tail = 0;
        queue[tail++] = s;
        for (i = 0; i < size; i++) {
                visit[i] = 0;
        }
        visit[s] = 1;
        do {
                pos = queue[head++];
                for (i = 0; i < size; i++) {
                        if (matrix[pos][i] && !visit[i]) {
                                if (i == t) return 1;
                                visit[i] = 1;
                                queue[tail++] = i;
                        }
                }
        } while (head != tail);
        return 0;
}


Compiler output:
main.c:6:1: error: return type defaults to 'int' [-Wimplicit-int]
    6 | main()
      | ^~~~
Language: C

#include "stdio.h"

int JudgeYesNo(int s, int t);

int main()
{
    int i=0;
    int j=0;
    int input=0;
    int buff=0;
    int N=0;
    int M=0;
    int SwithT[2];
    int nFriend[100000];
    int Q=0;

    for(i = 0; i < 100000; i++)
    {
        nFriend[i]=i;
    }

    scanf("%d",&input);
    if(input < 2 || input > 100000)
    {
        return 0;
    }
    N = input;

    scanf("%d",&input);
    if(input < 0 || input > 100000)
    {
        return 0;
    }
    M = input;


    // ++++++++++
    // Mukade Janken
    for(i = 0; i < M; i++)
    {
        scanf("%d",&SwithT[0]);
        scanf("%d",&SwithT[1]);

        if(SwithT[0] > SwithT[1])
        {
            buff = SwithT[0];
            SwithT[0] = SwithT[1];
            SwithT[1] = buff;
        }
        nFriend[SwithT[1]] = &nFriend[SwithT[0]];
    }



    // ++++++++++
    // Judge
    scanf("%d",&input);
    if(input < 1 || input > 100000)
    {
        return 0;
    }
    Q = input;

    for(i = 0; i < Q; i++)
    {
        scanf("%d",&SwithT[0]);
        scanf("%d",&SwithT[1]);
        JudgeYesNo(SwithT[0], SwithT[1]);
    }

    return 0;
}

int JudgeYesNo(int s, int t)
{
    if(nFriend[s] == nFriend[t])
    {
        printf("yes\n");
    }
    else
    {
        printf("no\n");
    }
}


Compiler output:
main.c: In function 'main':
main.c:50:28: error: assignment to 'int' from 'int *' makes integer from pointer without a cast [-Wint-conversion]
   50 |         nFriend[SwithT[1]] = &nFriend[SwithT[0]];
      |                            ^
main.c: In function 'JudgeYesNo':
main.c:76:8: error: 'nFriend' undeclared (first use in this function)
   76 |     if(nFriend[s] == nFriend[t])
      |        ^~~~~~~
main.c:76:8: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include "stdio.h"

int JudgeYesNo(int s, int t);

int main()
{
    int i=0;
    int j=0;
    int input=0;
    int buff=0;
    int N=0;
    int M=0;
    int SwithT[2];
    int nFriend[100000];
    int Q=0;

    for(i = 0; i < 100000; i++)
    {
        nFriend[i]=i;
    }

    scanf("%d",&input);
    if(input < 2 || input > 100000)
    {
        return 0;
    }
    N = input;

    scanf("%d",&input);
    if(input < 0 || input > 100000)
    {
        return 0;
    }
    M = input;


    // ++++++++++
    // Mukade Janken
    for(i = 0; i < M; i++)
    {
        scanf("%d",&SwithT[0]);
        scanf("%d",&SwithT[1]);

        if(SwithT[0] > SwithT[1])
        {
            buff = SwithT[0];
            SwithT[0] = SwithT[1];
            SwithT[1] = buff;
        }
        &nFriend[SwithT[1]] = &nFriend[SwithT[0]];
    }



    // ++++++++++
    // Judge
    scanf("%d",&input);
    if(input < 1 || input > 100000)
    {
        return 0;
    }
    Q = input;

    for(i = 0; i < Q; i++)
    {
        scanf("%d",&SwithT[0]);
        scanf("%d",&SwithT[1]);
        JudgeYesNo(nFriend[SwithT[0]], nFriend[SwithT[1]]);
    }

    return 0;
}

int JudgeYesNo(int s, int t)
{
    if(s == t)
    {
        printf("yes\n");
    }
    else
    {
        printf("no\n");
    }
}


Compiler output:
main.c: In function 'main':
main.c:50:29: error: lvalue required as left operand of assignment
   50 |         &nFriend[SwithT[1]] = &nFriend[SwithT[0]];
      |                             ^
Language: C

#include<stdio.h>
#include<stdlib.h>
#define LARGE 100000


int V,E;
int color=0;
int C[LARGE];

typedef struct list{
	int id;
	struct list *next;
}list;


list * makelist(int x){
	list *new=malloc(sizeof(list));
	new->id=x;
	new->next=NULL;
	return new;
}

void list_insert(list* L[],int x,list *new){
	list **p=&L[x];
	
	while((*p)!=NULL){
		p=&((*p)->next);
	}
	(*p)=new;
	
	return;
}

int push(int stack[],int x,int top){
	stack[top++]=x;
	return top;
}

int pop(int stack[],int *top){
	(*top)--;
	return stack[*top];
}

void dfs(int C[],int x,list* L[]){
	int stack[LARGE];
	int top=0;
	int temp;
	list *p;
	
	color++;
	top=push(stack,x,top);
	while(top>0){
		temp=pop(stack,&top);
		if(C[temp]==0)C[temp]=color;
		p=L[temp];
		while(p!=NULL){
			if(C[p->id]==0){
				top=push(stack,p->id,top);
				C[p->id]=color;
			}
			p=p->next;
		}
	}
	
	return;
}

int main(){
	int i,j;
	int s,t,q;
	int x,y;
	list *L[LARGE];
	list *new;
	
	scanf("%d %d",&V,&E);
	
	for(i=0;i<V;i++){
		L[i]=NULL;
		C[i]=0;
	}
	
	for(i=0;i<E;i++){
		scanf("%d %d",&s,&t);
		new=makelist(t);
		list_insert(L,s,new);
		new=makelist(s);
		list_insert(L,t,new);
	}
	
	scanf("%d",&q);
	for(i=0;i<q;i++){
		scanf("%d %d",&x,&y);
		if(C[x]==0)dfs(C,x,L);
		if(C[y]==0)dfs(C,y,L);
		if(C[x]==C[y]))printf("yes\n");
		else printf("no\n");
	}
		
	
	return 0;
	
}



Compiler output:
main.c: In function 'main':
main.c:95:31: error: expected statement before ')' token
   95 |                 if(C[x]==C[y]))printf("yes\n");
      |                               ^
main.c:96:17: error: 'else' without a previous 'if'
   96 |                 else printf("no\n");
      |                 ^~~~
Language: C++

#include<iostream>
#include<vector>
#include<stack>
using namespace std;
static const int MAX=100000;
static const int NIL=-1;

int n;
vector<int> g[MAX];
int color[MAX];

void dfs(int r,int c){
  stack<int> s;
  s.push(r);
  color[r]=c;
  while(!s.empty()){
    int u=s.top();
    s.pop();
    for(int i=0;i<g[u].size();i++){
      int v=g[u][i];
      if(color[v]==NIL){
	color[v]=c;
	s.push(v);
      }
    }
  }
}

void assignColor(){
  int id=1;
  for(int i=0;i<n;i++) color[i]=NIL;
  for(int u=0;u<n;u++){
    if(color[v]==NIL) dfs(u,id++);
  }
}

int main(){
  int s,t,m,q;

  cin>>n>>m;

  for(int i=0;i<m;i++){
    cin>>s>>t;
    g[s].push_back(t);
    g[t].push_back(s);
  }

  assignColor();

  cin>>q;

  for(int i=0;i<q;i++){
     cin>>s>>t;
     if(color[s]==color[t]){
       cout<<"yes"<<endl;
     }else{
       cout<<"no"<<endl;
     }
  }
  return 0;
}



Compiler output:
a.cc: In function 'void assignColor()':
a.cc:33:14: error: 'v' was not declared in this scope
   33 |     if(color[v]==NIL) dfs(u,id++);
      |              ^
Language: C++

#include<iostream>
#include<vector>
#include<stack>
using namespace std;
static const int MAX=100000;
static const int NIL=-1;

int n;
vector<int> g[MAX];
int color[MAX];

void dfs(int r,int c){
  stack<int> s;
  s.push(r);
  color[r]=c;
  while(!s.empty()){
    int u=s.top();
    s.pop();
    for(int i=0;i<g[u].size();i++){
      int v=g[u][i];
      if(color[v]==NIL){
	color[v]=c;
	s.push(v);
      }
    }
  }
}

void assignColor(){
  int id=1;
  for(int i=0;i<n;i++) color[i]=NIL;
  for(int u=0;u<n;u++){
    int v=g[u][i];
    if(color[v]==NIL) dfs(u,id++);
  }
}

int main(){
  int s,t,m,q;

  cin>>n>>m;

  for(int i=0;i<m;i++){
    cin>>s>>t;
    g[s].push_back(t);
    g[t].push_back(s);
  }

  assignColor();

  cin>>q;

  for(int i=0;i<q;i++){
     cin>>s>>t;
     if(color[s]==color[t]){
       cout<<"yes"<<endl;
     }else{
       cout<<"no"<<endl;
     }
  }
  return 0;
}



Compiler output:
a.cc: In function 'void assignColor()':
a.cc:33:16: error: 'i' was not declared in this scope
   33 |     int v=g[u][i];
      |                ^
Language: C++

#include<iostream>
#include<vector>
#include<stack>
using namespace std;
static const int MAX = 100000;
static const int NIL = -1;

int n;
vector<int> G[MAX];
int color[MAX];

void dfs(int r,int c){
  stack<int> S;
  S.push(r);
  color[r] = c;
  while(!S.empty()){
    int u = S.top();
    S.pop();
    for(int i = 0;i<G[u].size();i++){
      int v = G[u][i];
      if(color[v]==INL){
	color[v] = c;
	S.push(v);
      }
    }
  }
}

void assignColor(){
  int id = 1;
  for(int i = 0; i< n; i++) color[i] = NIL;
  for(int u = 0; u<n;u++){
    if(color[u] == NIL) dfs(u,id++);
  }
}

int main(){
  int s,t,m,q;

  cin>>n>>m;

  for(int i = 0;i<m;i++){
    cin>>s>>t;
    G[s].push_back(t);
    G[t].push_back(s);
  }
  assignColor();

  sin>>q;

  for(int i = 0;i<q;i++){
    cin>>s>>t;
    if(color[s] == color[t]){
      cout<<"yes"<<endl;
    }else{
      cout<<"no"<<endl;
    }
  }
  return 0;
}



Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:21:20: error: 'INL' was not declared in this scope; did you mean 'NIL'?
   21 |       if(color[v]==INL){
      |                    ^~~
      |                    NIL
a.cc: In function 'int main()':
a.cc:49:3: error: 'sin' was not declared in this scope
   49 |   sin>>q;
      |   ^~~
Language: C++

#include<iostream>
#include<vector>
#include<stack>
using namespace std;
static const int MAX = 100000;
static const int NIL = -1;

int n;
vector<int> G[MAX];
int color[MAX];

void dfs(int r,int c){
  stack<int> S;
  S.push(r);
  color[r] = c;
  while(!S.empty()){
    int u = S.top();
    S.pop();
    for(int i = 0;i<G[u].size();i++){
      int v = G[u][i];
      if(color[v]==NIL){
	color[v] = c;
	S.push(v);
      }
    }
  }
}

void assignColor(){
  int id = 1;
  for(int i = 0; i< n; i++) color[i] = NIL;
  for(int u = 0; u<n;u++){
    if(color[u] == NIL) dfs(u,id++);
  }
}

int main(){
  int s,t,m,q;

  cin>>n>>m;

  for(int i = 0;i<m;i++){
    cin>>s>>t;
    G[s].push_back(t);
    G[t].push_back(s);
  }
  assignColor();

  sin>>q;

  for(int i = 0;i<q;i++){
    cin>>s>>t;
    if(color[s] == color[t]){
      cout<<"yes"<<endl;
    }else{
      cout<<"no"<<endl;
    }
  }
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:49:3: error: 'sin' was not declared in this scope
   49 |   sin>>q;
      |   ^~~
Language: C++

def dfs(s):
    global t
    if s == t:
        return True
    DP[s]=1
    for i in F[s]:
        if not DP[i]:
            if dfs(i):
                return True
    return False
    
n,m = [int(i) for i in input().split()]
F = [{}]*n
for _ in range(m):
    i,j = [int(i) for i in input().split()]
    F[i][j] = 1
    F[j][i] = 1
q = int(input())
for i in range(q):
    DP = [0]*n
    s,t = [int(i) for i in input().split()]
    if dfs(s):
        print("yes")
    else:
        print("no")


Compiler output:
a.cc:1:1: error: 'def' does not name a type
    1 | def dfs(s):
      | ^~~
a.cc:13:8: error: expected unqualified-id before ']' token
   13 | F = [{}]*n
      |        ^
Language: C++

import sys
sys.setrecursionlimit(10000)
def dfs(s):
    global t
    if s == t:
        return True
    DP[s]=1
    for i in F[s]:
        if not DP[i]:
            if dfs(i):
                return True
    return False
    
n,m = [int(i) for i in input().split()]
F = [{} for i in range(n)]
for _ in range(m):
    i,j = [int(i) for i in input().split()]
    F[i][j] = 1
    F[j][i] = 1
q = int(input())
for i in range(q):
    DP = [0]*n
    s,t = [int(i) for i in input().split()]
    if dfs(s):
        print("yes")
    else:
        print("no")


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import sys
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:15:9: error: expected unqualified-id before 'for'
   15 | F = [{} for i in range(n)]
      |         ^~~
Language: C++

import sys
sys.setrecursionlimit(50000)
def dfs(s):
    global t
    if s == t:
        return True
    DP[s]=1
    for i in F[s]:
        if not DP[i]:
            if dfs(i):
                return True
    return False
    
n,m = [int(i) for i in input().split()]
F = [{} for i in range(n)]
for _ in range(m):
    i,j = [int(i) for i in input().split()]
    F[i][j] = 1
    F[j][i] = 1
q = int(input())
for i in range(q):
    DP = [0]*n
    s,t = [int(i) for i in input().split()]
    if dfs(s):
        print("yes")
    else:
        print("no")


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import sys
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:15:9: error: expected unqualified-id before 'for'
   15 | F = [{} for i in range(n)]
      |         ^~~
Language: C++

#include <iostream>
using namespace std;
 
int main() {
int d[100100];
int m,n,q;
cin>>n>>m;
for(int i=0;i<n;i++){
    d[i]=i;
}
for(int l=0;l<m;l++){
    int a,b;
    cin>>a>>b;
    int j ,h;
    j=a,h=b;
while(d[j]!=j )
    j=d[j];
}
while(d[h]!=h )
    h=d[h];
}
if(j!=h){
    d[j]=h;
    d[a]=h;
    d[b]=h;
}
}
cin>>q;
for(int y=0;y<q;y++){
    int a,b;
    cin>>a>>b;
        int j ,h;
    j=a,h=b;
while(d[j]!=j )
    j=d[j];
}
while(d[h]!=h )
    h=d[h];
}
    if(j==h){
        cout<<"yes"<<endl;
    }
    else{
        cout<<"no"<<endl;
    }
}
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:9: error: 'h' was not declared in this scope
   19 | while(d[h]!=h )
      |         ^
a.cc: At global scope:
a.cc:22:1: error: expected unqualified-id before 'if'
   22 | if(j!=h){
      | ^~
a.cc:27:1: error: expected declaration before '}' token
   27 | }
      | ^
a.cc:28:1: error: 'cin' does not name a type
   28 | cin>>q;
      | ^~~
a.cc:29:1: error: expected unqualified-id before 'for'
   29 | for(int y=0;y<q;y++){
      | ^~~
a.cc:29:13: error: 'y' does not name a type
   29 | for(int y=0;y<q;y++){
      |             ^
a.cc:29:17: error: 'y' does not name a type
   29 | for(int y=0;y<q;y++){
      |                 ^
a.cc:37:1: error: expected unqualified-id before 'while'
   37 | while(d[h]!=h )
      | ^~~~~
a.cc:39:1: error: expected declaration before '}' token
   39 | }
      | ^
a.cc:40:5: error: expected unqualified-id before 'if'
   40 |     if(j==h){
      |     ^~
a.cc:43:5: error: expected unqualified-id before 'else'
   43 |     else{
      |     ^~~~
a.cc:46:1: error: expected declaration before '}' token
   46 | }
      | ^
a.cc:47:5: error: expected unqualified-id before 'return'
   47 |     return 0;
      |     ^~~~~~
a.cc:48:1: error: expected declaration before '}' token
   48 | }
      | ^
Language: C++

#include <iostream>
using namespace std;
 
int main() {
int d[100100];
int m,n,q;
cin>>n>>m;
for(int i=0;i<n;i++){
    d[i]=i;
}
for(int l=0;l<m;l++){
    int a,b;
    cin>>a>>b;
    int j ,h;
    j=a,h=b;
while(d[j]!=j ||d[h]!=h){
    j=d[j];
    h=d[h];
}
d[j]=h;
while(a!=h){
 
    d[a]=h;
    d[b]=h;
a=d[a];
b=d[b]:
}
}

cin>>q;
for(int y=0;y<q;y++){
    int a,b;
    cin>>a>>b;
        int j ,h;
    j=a,h=b;
while(d[j]!=j ||d[h]!=h){
    j=d[j];
    h=d[h];
}
    if(j==h){
        cout<<"yes"<<endl;
    }
    else{
        cout<<"no"<<endl;
    }
}
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:7: error: expected ';' before ':' token
   26 | b=d[b]:
      |       ^
      |       ;
Language: C++

#include<iostream>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#include<ctime>

void dfs(std::vector<std::vector<int>> &n) {
	/*
	std::stack<int> s;
	std::vector<std::vector<int> > nn(n.size());
	std::vector<int> dd(n.size());
	int count = 0;

	for (size_t i = 0; i < n.size(); i++) {
		if (dd[i] == 1)continue;
		nn[count].push_back(i);
		std::vector<int> d;
		s.push(i);
		while (s.size() != 0) {
			int num = s.top(); s.pop();
			d.push_back(num);
			dd[num] = 1;
			for (std::vector<int>::iterator it = n[num].begin(); it != n[num].end(); it++) {
				if (std::find(d.begin(), d.end(), *it) == d.end()) {
					nn[count].push_back(*it);
					s.push(*it);
					d.push_back(*it);
				}
			}
		}
		count++;
	}
	*/
	int question;
	std::cin >> question;

	for (int i = 0; i < question; i++) {
		int from, to;
		std::cin >> from >> to;
		std::stac	std::vectork<int> s;
	<int> went;
		s.push(from);
		bool flag = false;
		while (s.size() != 0 && flag == false){
			int num = s.top(); s.pop();
			for (size_t j = 0; j < n[num].size(); j++) {
				if (n[num][j] == to) {
					flag = true;
					break;
				}
				if (std::find(went.begin(), went.end(), n[num][j]) == went.end()) {
					s.push(n[num][j]);
					went.push_back(n[num][j]);
				}
			}
		}
		if (flag) {
			std::cout << "yes" << std::endl;
		} else {
			std::cout << "no" << std::endl;
		}
	}
	/*
	for (int i = 0; i < question; i++) {
		int from, to;
		std::cin >> from >> to;
		for (int j = 0; j < count; j++) {
			if (std::find(nn[j].begin(), nn[j].end(), from) != nn[j].end() &&
				std::find(nn[j].begin(), nn[j].end(), to) != nn[j].end()) {
				std::cout << "yes" << std::endl;
				break;
			}
			if (j == count - 1) {
				std::cout << "no" << std::endl;
			}
		}
	}
	*/
}

int main() {
	int people, relation;

	std::cin >> people >> relation;

	std::vector<std::vector<int>> n(people);

	for (int i = 0; i < relation; i++) {
		int from, to;
		std::cin >> from >> to;
		n[from].push_back(to);
		n[to].push_back(from);
	}

	dfs(n);

	return 0;
}

Compiler output:
a.cc: In function 'void dfs(std::vector<std::vector<int> >&)':
a.cc:41:22: error: 'stac' is not a member of 'std'; did you mean 'stack'?
   41 |                 std::stac       std::vectork<int> s;
      |                      ^~~~
      |                      stack
a.cc:42:9: error: expected primary-expression before '<' token
   42 |         <int> went;
      |         ^
a.cc:42:10: error: expected primary-expression before 'int'
   42 |         <int> went;
      |          ^~~
a.cc:43:17: error: 's' was not declared in this scope
   43 |                 s.push(from);
      |                 ^
a.cc:52:47: error: 'went' was not declared in this scope
   52 |                                 if (std::find(went.begin(), went.end(), n[num][j]) == went.end()) {
      |                                               ^~~~
Language: C++

#include <iostream>
#include <vector>
#define eol '\n'
using namespace std;

vector<int> visit;

bool bfs(int s, int t, vector< vector<int> > list) {
  if (s == t) {
    return true;
  }
  
  // visit flag
  visit[s] = 1;
  
  for (int i = 0; i < list[s].size(); i++) {
    int next = list[s][i];
    if (visit[next] == 0) {
      if (bfs(next, t, list)) {
        return true;
      }
    }
  }
  return false;
}

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

  int n,m,s,t,q;
  cin >> n >> m;

  visit.resize(n,0);
  vector< vector<int> > list(n, {});
  
  for (int i = 0; i < m; i++) {
    cin >> s >> t;
    list[s].push_back(t);
    list[t].push_back(s);
  }

  cin >> q;
  for (int i = 0; i < q; i++) {
    cin >> s >> t;

    if (bfs(s,t,list)) {
      cout << "yes" << eol;
    } else {
      cout << "no" << eol;
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:35: error: call of overloaded 'vector(int&, <brace-enclosed initializer list>)' is ambiguous
   35 |   vector< vector<int> > list(n, {});
      |                                   ^
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const value_type&, const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; size_type = long unsigned int; value_type = std::vector<int>; allocator_type = std::allocator<std::vector<int> >]'
  569 |       vector(size_type __n, const value_type& __value,
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; size_type = long unsigned int; allocator_type = std::allocator<std::vector<int> >]'
  556 |       vector(size_type __n, const allocator_type& __a = allocator_type())
      |       ^~~~~~
Language: C++

#include <iostream>
#include <vector>
#define eol '\n'
using namespace std;

vector<int> visit;

bool bfs(int s, int t, vector<vector<int>> list) {
  if (s == t) {
    return true;
  }
  
  // visit flag
  visit[s] = 1;
  
  for (int i = 0; i < list[s].size(); i++) {
    int next = list[s][i];
    if (visit[next] == 0) {
      if (bfs(next, t, list)) {
        return true;
      }
    }
  }
  return false;
}

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

  int n,m,s,t,q;
  cin >> n >> m;

  visit.resize(n,0);
  vector<vector<int>> list(n, {});
  
  for (int i = 0; i < m; i++) {
    cin >> s >> t;
    list[s].push_back(t);
    list[t].push_back(s);
  }

  cin >> q;
  for (int i = 0; i < q; i++) {
    cin >> s >> t;

    if (bfs(s,t,list)) {
      cout << "yes" << eol;
    } else {
      cout << "no" << eol;
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:33: error: call of overloaded 'vector(int&, <brace-enclosed initializer list>)' is ambiguous
   35 |   vector<vector<int>> list(n, {});
      |                                 ^
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const value_type&, const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; size_type = long unsigned int; value_type = std::vector<int>; allocator_type = std::allocator<std::vector<int> >]'
  569 |       vector(size_type __n, const value_type& __value,
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; size_type = long unsigned int; allocator_type = std::allocator<std::vector<int> >]'
  556 |       vector(size_type __n, const allocator_type& __a = allocator_type())
      |       ^~~~~~
Language: C++

#include <iostream>
#include <queue>
#include <cstdio>
using namespace std;
#define MAX_N 100000
int g[MAX_N][MAX_N];
int n;

bool can_connect(int s,int t) {
  bool visited[n];
  queue<int> que;
  visited[s] = true;
  que.push(s);
  while(!que.empty()) {
    int v = que.front(); que.pop();
    for(int i=0;i<n;i++) {
      if(g[v][i] != 0 && !visited[i]) {
        if(i == t) return true;
        visited[i] = true;
        que.push(i);
      }
    }
  }
  return false;
}

int main() {
  int m,s,t,q;
  scanf("%d %d\n",&n,&m);
  for(int i=0;i<m;i++) {
    scanf("%d %d",&s,&t);
    g[s][t] = 1;
    g[t][s] = 1;
  }
  scanf("%d",&q);
  for(int i=0;i<q;i++) {
    scanf("%d %d",&s,&t);
    if(can_connect(s,t)){
      printf("yes\n");
    }
    else {
      printf("no\n");
    }
  }
}

Compiler output:
/tmp/ccvdt1WN.o: in function `can_connect(int, int)':
a.cc:(.text+0x22): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccvdt1WN.o
a.cc:(.text+0x155): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccvdt1WN.o
/tmp/ccvdt1WN.o: in function `main':
a.cc:(.text+0x1c7): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccvdt1WN.o
collect2: error: ld returned 1 exit status
Language: C++

#include <vector>
#include <iostream>
using namespace std;
int n, q, x, y; int group[100000]; vector<int> f[100000];
int main() {
	scanf("%d%d", &n, &m);
	for(int i = 0; i < n; i++) group[i] = i, f[i].push_back(i);
	for(int i = 0; i < m; i++) {
		scanf("%d%d", &x, &y);
		if(group[x] == group[y]) continue;
		x = group[x], y = group[y];
		if(f[y].size() > f[x].size()) swap(x, y);
		for(int j = f[y].size() - 1; j >= 0; j--) {
			group[f[y][j]] = group[x];
			f[x].push_back(f[y][j]);
			f[y].pop_back();
		}
	}
	scanf("%d", &q);
	for(int i = 0; i < q; i++) {
		scanf("%d%d", &x, &y);
		printf("%s\n", group[x] == group[y] ? "yes" : "no");
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:28: error: 'm' was not declared in this scope
    6 |         scanf("%d%d", &n, &m);
      |                            ^
Language: C++

#include <iostream>
#include <stack>
using namespace std;

const int N = 100000;
const int WHITE = 0;
const int GRAY = 1;
const int BLACK = 2;
const int NIL = -1;

int n, M[N][N];
int color[N], cc[N], cp = 0;
int nt[N];

int next(int u){
	for (int v = nt[u]; v <= n; v++){
		nt[u] = v + 1;
		if (M[u][v]) return v;
	}
	return NIL;
}

void dfs_visit(int r){
	for (int i = 0; i < n; i++) nt[i] = 0;

	stack<int> S;
	S.push(r);
	color[r] = GRAY;
	cc[r] = cp;

	while (!S.empty()){
		int u = S.top();
		int v = next(u);
		if (v != NIL){
			if (color[v] == WHITE){
				color[v] = GRAY;
				cc[v] = cp;
				S.push(v);
			}
		}
		else {
			S.pop();
			color[u] = BLACK;
		}
	}
	cp++;
}

void dfs(){
	for (int i = 0; i < n; i++){
		color[i] = WHITE;
		nt[i] = 0;
	}

	for (int u = 0; u < n; u++){
		if (color[u] == WHITE) dfs_visit(u);
	}

}

int main(){
	int m, q;
	cin >> n >> m;
	for (int i = 0; i < n; i++){
		for (int j = 0; j < n; j++) M[i][j] = 0;
	}
	for (int i = 0; i < m; i++){
		int s, t;
		cin >> s >> t;
		M[s][t] = M[t][s] = 1;
	}

	dfs();

	cin >> q;
	for (int i = 0; i < q; i++){
		int s, t;
		cin >> s >> t;
		if (cc[s] == cc[t]) cout << "yes" << endl;
		else cout << "no" << endl;
	}

	return 0;
}

Compiler output:
/tmp/ccD07Ny6.o: in function `next(int)':
a.cc:(.text+0x17): relocation truncated to fit: R_X86_64_PC32 against symbol `nt' defined in .bss section in /tmp/ccD07Ny6.o
a.cc:(.text+0x39): relocation truncated to fit: R_X86_64_PC32 against symbol `nt' defined in .bss section in /tmp/ccD07Ny6.o
/tmp/ccD07Ny6.o: in function `dfs_visit(int)':
a.cc:(.text+0xb1): relocation truncated to fit: R_X86_64_PC32 against symbol `nt' defined in .bss section in /tmp/ccD07Ny6.o
a.cc:(.text+0x100): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccD07Ny6.o
a.cc:(.text+0x113): relocation truncated to fit: R_X86_64_PC32 against symbol `cp' defined in .bss section in /tmp/ccD07Ny6.o
a.cc:(.text+0x125): relocation truncated to fit: R_X86_64_PC32 against symbol `cc' defined in .bss section in /tmp/ccD07Ny6.o
a.cc:(.text+0x167): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccD07Ny6.o
a.cc:(.text+0x182): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccD07Ny6.o
a.cc:(.text+0x192): relocation truncated to fit: R_X86_64_PC32 against symbol `cp' defined in .bss section in /tmp/ccD07Ny6.o
a.cc:(.text+0x1a4): relocation truncated to fit: R_X86_64_PC32 against symbol `cc' defined in .bss section in /tmp/ccD07Ny6.o
a.cc:(.text+0x1dc): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<vector>
#include<limits.h>
#include<stack>
#include<string>
using namespace std;

vector< vector<int> > L(100005);
int c[100005]={};

void dfs (int v, int marker){
	if(c[v]!=0){
		return;
	}
	c[v]=marker;
	for (int i=0;i<L[v].size();i++){
		dfs(L[v][i],marker);
	}
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n,m,a,b,q,s,t;
	cin >> n >> m;
	
	for (int i=0;i<m;i++){
		cin >> a >> b;
		L[a].push_back(b);
	}
	
	int marker=1;
	for (int i=0;i<n;i++){
		if (c[i]==0){
			dfs(i,marker);
			marker++;
		}
	}
	
	
	cin >> q;
	int d[2][q];
	for (int i=0;i<q;i++){
		cin >> d[i][0];
		cin >> d[i][1]; 
	}
	for (int i=0;i<q;i++){
		if(c[d[i][0]]==c[d[i][1]]){
			cout << "yes" << endl;
		}else{
			cout << "no" << endl;
		}
	}
	
	out(c)
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:56:9: error: 'out' was not declared in this scope
   56 |         out(c)
      |         ^~~
Language: C++

#include<iostream>
#include<vector>
#include<limits.h>
#include<stack>
#include<string>
using namespace std;

vector< vector<int> > L(100005);
int c[100005]={};

void dfs (int v, int marker){
	if(c[v]!=0){
		return;
	}
	c[v]=marker;
	for (int i=0;i<L[v].size();i++){
		dfs(L[v][i],marker);
	}
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n,m,a,b,q,s,t;
	cin >> n >> m;
	
	for (int i=0;i<m;i++){
		cin >> a >> b;
		L[a].push_back(b);
	}
	
	int marker=1;
	for (int i=0;i<n;i++){
		if (c[i]==0){
			dfs(i,marker);
			marker++;
		}
	}
	
	
	cin >> q;
	int d[2][q];
	for (int i=0;i<q;i++){
		cin >> d[i][0];
		cin >> d[i][1]; 
	}
	for (int i=0;i<q;i++){
		if(c[d[i][0]]==c[d[i][1]]){
			cout << "yes" << endl;
		}else{
			cout << "no" << endl;
		}
	}
	
	out(c);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:56:9: error: 'out' was not declared in this scope
   56 |         out(c);
      |         ^~~
Language: C++

#include <iostream>
#include <vector>
#include <stack>
using namespace std;

static const int MAX = 100000;
static const int NIL = -1;


int n;
vector<int> G[MAX];
int color[MAX];

void dfs(int r, int c){
    static<int> S;
    S.push(r);
    color[r] = c;
    while (!S.empty()){
        int u = S.top(); S.pop();
        for(int i = 0; i < G[u].size(); i++){
            int v = G[u][i];
            if (color[v] == NIL){
                color[v] = c;
                S.push(v);
            }
        }
    }
}

void assignColor(){
    int id = 1;
    for(int i = 0; i < n; i++) color[i] = NIL;
    for(int u = 0; u < n; u++){
        if(color[u] == NIL) dfs(u, id++);
    }
}

int main(){
    int s, t, m, q;

    cin >> n >> m;

    for(int i = 0; i < m; i++){
        cin >> s >> t;
        G[s].push_back(t);
        G[t].push_back(s);
    }

    assignColor();

    cin >> q;

    for(int i = 0; i < q; i++){
        cin >> s >> t;
        if(color[s] == color[t]){
            cout << "yes" << endl;
        }else{
            cout << "no" << endl;
        }
    }

    return 0;
}

Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:15:11: error: expected unqualified-id before '<' token
   15 |     static<int> S;
      |           ^
a.cc:16:5: error: 'S' was not declared in this scope
   16 |     S.push(r);
      |     ^
Language: C++

//#define scanf_s scanf
#include <string>
#include <stdio.h>
#include <math.h>
#include <stack>
#include <queue>
#include <list>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

#define MAX 100
#define _MAX 1000
struct Graph
{
	int id, k = 0;
	list<int> node;
	int d = -1;
};
Graph G[MAX];
list<int> co;
int bo = false;
void Connect(Graph *g,Graph *f)
{
	if (g->k >= 0) {
		int a = true;
		co.push_back(g -> id);
		printf("%d,", g->id);
		for (auto i = g->node.begin(); i != g->node.end(); ++i) {
			if (&G[*i] == f) { bo = true; return; }
			for (auto j = co.begin(); j != co.end(); ++j) {
				if (*j == *i) {
					a = false;
					break;
				}
			}
			if(a) return Connect(&G[*i], f);
			a = true;
		}
	}
}
int main(void)
{
	int n, m, q, a, b;
	int qq[_MAX] = { 0 };
	scanf_s("%d %d", &n, &m);
	for (int i = 0; i < m; ++i) {
		scanf_s("%d %d", &a, &b);
		G[a].id = a; G[b].id = b;
		++G[a].k; G[a].node.push_back(b);
		++G[b].k; G[b].node.push_back(a);
	}
	scanf_s("%d", &q);
	for (int i = 0; i < q; ++i) {
		scanf_s("%d %d", &a, &b);
		bo = 0;
		Connect(&G[a], &G[b]);
		qq[i] = bo;
		co.clear();
	}
	for (int i = 0; i < q; ++i) {
		if(qq[i]) printf("yes\n");
		else printf("no\n");
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   47 |         scanf_s("%d %d", &n, &m);
      |         ^~~~~~~
      |         scanf
Language: C++

//#define scanf_s scanf
#include <string>
#include <stdio.h>
#include <math.h>
#include <stack>
#include <queue>
#include <list>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

#define MAX 100000
#define _MAX 10000
struct Graph
{
	int id, k = 0;
	list<int> node;
	int d = -1;
};
Graph G[MAX];
list<int> co;
int bo = false;
void Connect(Graph *g,Graph *f)
{
	if (g->k >= 0) {
		int a = true;
		co.push_back(g -> id);
	//	printf("%d,", g->id);
		for (auto i = g->node.begin(); i != g->node.end(); ++i) {
			if (&G[*i] == f) { bo = true; return; }
			for (auto j = co.begin(); j != co.end(); ++j) {
				if (*j == *i) {
					a = false;
					break;
				}
			}
			if(a) Connect(&G[*i], f);
			a = true;
		}
	}
}
int main(void)
{
	int n, m, q, a, b;
	int qq[_MAX] = { 0 };
	scanf_s("%d %d", &n, &m);
	for (int i = 0; i < m; ++i) {
		scanf_s("%d %d", &a, &b);
		G[a].id = a; G[b].id = b;
		++G[a].k; G[a].node.push_back(b);
		++G[b].k; G[b].node.push_back(a);
	}
	scanf_s("%d", &q);
	for (int i = 0; i < q; ++i) {
		scanf_s("%d %d", &a, &b);
		bo = 0;
		Connect(&G[a], &G[b]);
		qq[i] = bo;
		co.clear();
	}
	for (int i = 0; i < q; ++i) {
		if(qq[i]) printf("yes\n");
		else printf("no\n");
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   47 |         scanf_s("%d %d", &n, &m);
      |         ^~~~~~~
      |         scanf
Language: C++

#include<stack>
#include<queue>
#include<conio.h>
#include<string>
#include<vector>
#include<iostream>
#include<algorithm>
using namespace std;
queue<int> Q;
vector<int> G[100000];
bool flag = false;
int s, t;
int color[100000];

void a(){
	while (!Q.empty()){
		Q.pop();
		for (int i = 0; i < G[s].size(); i++){
			//_getch();
			//cout << G[s][i] << endl;
			if (G[s][i] == t){
				flag = true;
				while (!Q.empty()) Q.pop();
				return;
			}
			else if (color[i] == 0){
				Q.push(G[s][i]);
				color[i] = 1;
			}
		}
		if (!Q.empty())s = Q.front();
	}
}

int main(){
	int n, m, q;
	cin >> n >> m;

	for (int i = 0; i < m; i++){
		cin >> s >> t;
		G[s].push_back(t); //??£???????????£?????????
		G[t].push_back(s);
	}
	cin >> q; fill(color, color + 100000, 0);
	for (int i = 0; i < q; i++){
		cin >> s >> t;
		Q.push(s);
		a();
		if (flag) cout << "yes" << endl;
		else cout << "no" << endl;
		flag = false;
		fill(color, color + 100000, 0);
	}

	return 0;
}

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

#include<stdio.h>
#include<vector>
#include<string>
using namespace std;

vector<vector<int> >g;
int n,m,q,s,t;

vector<bool>visited;
vector<int>color;
void dfs(int s){
    for(int i=0;i<g[s].size();i++){
        if(color[g[s][i]]==-1){
            color[g[s][i]]=color[s];
            dfs(g[s][i]);
        }
    }
}
bool dfs2(int s,int t){
    if(s==t)return true;
    visited[s]=true;
    for(int i=0;i<g[s].size();i++){
        if(!visited[g[s][i]]){
            if(dfs2(g[s][i],t)){
                return true;
            }
        }
    }
    return false;
}
int main() {
    scanf("%d %d",&n,&m);
    g.resize(n);
    color.resize(n,-1);
    for(int i=0;i<m;i++){
        scanf("%d %d",&s,&t);
        g[s].push_back(t);
        g[t].push_back(s);
    }
    for(int i=0;i<n;i++){
        if(color[i]==-1){
            color[i]=i;
            dfs(i);
        }
    }
    scanf("%d",&q);
    for(int i=0;i<q;i++){
        scanf("%d %d",&s,&t);
        visited.resize(n,false);
        string s1=(dfs2(s,t)?"yes":"no");
        string s2=(color[s]==color[t]?"yes":"no");
        if(s1!=s2&&s1=="yes")return 1;
        cout<<s1<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:9: error: 'cout' was not declared in this scope
   53 |         cout<<s1<<endl;
      |         ^~~~
a.cc:4:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    3 | #include<string>
  +++ |+#include <iostream>
    4 | using namespace std;
a.cc:53:19: error: 'endl' was not declared in this scope
   53 |         cout<<s1<<endl;
      |                   ^~~~
a.cc:4:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    3 | #include<string>
  +++ |+#include <ostream>
    4 | using namespace std;
Language: C++

#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <stack>
#define rep(i, n) for(int i=0;i<n;i++)
#define NOT_FOUND 0
#define ENQUEUED 1
using namespace std;

vector<int> graph[100001];
int memo[100001];

int dfs(int start, int end) {
    if (start == end) {
        return 1;
    }
    memset(memo, NOT_FOUND, sizeof(memo));
    stack<int> stack;
    stack.push(start);
    memo[start] = ENQUEUED;
    int counter = 0;

    while(!stack.empty() && counter != 10) {
        counter += 1;
        int v = stack.top();
        stack.pop();
        vector<int> edges = graph[v];

        for (int i = 0; i < edges.size(); i++) {
            int next = edges[i];
            if (next == end) {
                return 1;
            }
            if (memo[next] == NOT_FOUND) {
                memo[next] = ENQUEUED;
                stack.push(next);
            }
        }
    }
    return 0;
}

int main() {
    int n, m;
    cin >> n >> m;

    for (int i = 0; i < m; i++) {
        int v, e;
        cin >> v >> e;
        graph[v].push_back(e);
        graph[e].push_back(v);
    }

    int q;
    cin >> q;

    for (int i = 0; i < q; i++) {
        int s, d;
        cin >> s >> d;
        if (dfs(s, d)) {
            cout << "yes" << endl;
        } else {
            cout << "no" << endl;
        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'int dfs(int, int)':
a.cc:18:5: error: 'memset' was not declared in this scope
   18 |     memset(memo, NOT_FOUND, sizeof(memo));
      |     ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include <stack>
  +++ |+#include <cstring>
    6 | #define rep(i, n) for(int i=0;i<n;i++)
Language: C++

#include <stdio.h>
#include <stack>
#include <iostream>
using namespace std;
int G[100000][100000];
int vis[100000];
int n;

bool dfs(int s, int t)
{
    if (G[s][t] == 1 || G[t][s] == 1) return true;
    vis[s] = 1;
    for (int i = 0; i < n; i++)
    {
        if (G[s][i] == 1 && vis[i] == 0)
            {
                bool a = (dfs(i,t)||dfs(t,i)); 
                vis[s] = 0;
                return a;
            }

    } 
    vis[s] = 0;
    return false;
}

int main()
{
    //freopen("in3.txt","r",stdin);
    int m;
    scanf("%d %d",&n, &m);
    for (int i = 0; i < n; i++)
    {
        vis[i] = 0; 
    } 
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            G[i][j] = 0; 
        }  
    } 
    for (int i = 0; i < m; i++)
    {
        int s, t;
        scanf("%d %d",&s,&t); 
        G[s][t] = 1;
        G[t][s] = 1;
    } 
    int q,s,t;
    scanf("%d",&q);
    for (int i = 0; i < q; i++)
    {
        scanf("%d %d",&s,&t);
        if(dfs(s,t)||dfs(t,s)) printf("yes\n");
        else printf("no\n");
    } 
    return 0;
}

Compiler output:
/tmp/ccCk437T.o: in function `dfs(int, int)':
a.cc:(.text+0x80): relocation truncated to fit: R_X86_64_PC32 against symbol `vis' defined in .bss section in /tmp/ccCk437T.o
a.cc:(.text+0xd3): relocation truncated to fit: R_X86_64_PC32 against symbol `vis' defined in .bss section in /tmp/ccCk437T.o
a.cc:(.text+0x123): relocation truncated to fit: R_X86_64_PC32 against symbol `vis' defined in .bss section in /tmp/ccCk437T.o
a.cc:(.text+0x13a): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccCk437T.o
a.cc:(.text+0x157): relocation truncated to fit: R_X86_64_PC32 against symbol `vis' defined in .bss section in /tmp/ccCk437T.o
/tmp/ccCk437T.o: in function `main':
a.cc:(.text+0x17b): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccCk437T.o
a.cc:(.text+0x1af): relocation truncated to fit: R_X86_64_PC32 against symbol `vis' defined in .bss section in /tmp/ccCk437T.o
a.cc:(.text+0x1c0): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccCk437T.o
a.cc:(.text+0x20c): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccCk437T.o
a.cc:(.text+0x21b): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccCk437T.o
collect2: error: ld returned 1 exit status
Language: C++

#include <stdio.h>
#include <stack>
#include <iostream>
using namespace std;
int G[100000][100000];
int vis[100000];
int n;

bool dfs(int s, int t)
{
    if (G[s][t] == 1 || G[t][s] == 1) return true;
    vis[s] = 1;
    for (int i = 0; i < n; i++)
    {
        if (G[s][i] == 1 && vis[i] == 0)
            {
                bool a = (dfs(i,t)); 
                if(a) 
                {
                    vis[s] = 0;
                    return a;
                }
            }

    } 
    vis[s] = 0;
    return false;
}

int main()
{
    freopen("in3.txt","r",stdin);
    int m;
    scanf("%d %d",&n, &m);
    for (int i = 0; i < n; i++)
    {
        vis[i] = 0; 
    } 
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            G[i][j] = 0; 
        }  
    } 
    for (int i = 0; i < m; i++)
    {
        int s, t;
        scanf("%d %d",&s,&t); 
        G[s][t] = 1;
        G[t][s] = 1;
    } 
    int q,s,t;
    scanf("%d",&q);
    for (int i = 0; i < q; i++)
    {
        scanf("%d %d",&s,&t);
        if(dfs(s,t)||dfs(t,s)) printf("yes\n");
        else printf("no\n");
    } 
    return 0;
}

Compiler output:
/tmp/ccfkXa1a.o: in function `dfs(int, int)':
a.cc:(.text+0x80): relocation truncated to fit: R_X86_64_PC32 against symbol `vis' defined in .bss section in /tmp/ccfkXa1a.o
a.cc:(.text+0xd3): relocation truncated to fit: R_X86_64_PC32 against symbol `vis' defined in .bss section in /tmp/ccfkXa1a.o
a.cc:(.text+0x106): relocation truncated to fit: R_X86_64_PC32 against symbol `vis' defined in .bss section in /tmp/ccfkXa1a.o
a.cc:(.text+0x11d): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccfkXa1a.o
a.cc:(.text+0x13a): relocation truncated to fit: R_X86_64_PC32 against symbol `vis' defined in .bss section in /tmp/ccfkXa1a.o
/tmp/ccfkXa1a.o: in function `main':
a.cc:(.text+0x181): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccfkXa1a.o
a.cc:(.text+0x1b5): relocation truncated to fit: R_X86_64_PC32 against symbol `vis' defined in .bss section in /tmp/ccfkXa1a.o
a.cc:(.text+0x1c6): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccfkXa1a.o
a.cc:(.text+0x212): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccfkXa1a.o
a.cc:(.text+0x221): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccfkXa1a.o
collect2: error: ld returned 1 exit status
Language: C++

#include <stdio.h>
#include <stack>
#include <iostream>
using namespace std;
int G[100000][100000];
int vis[100000];
int n;

bool dfs(int s, int t)
{
    if (G[s][t] == 1 || G[t][s] == 1) return true;
    vis[s] = 1;
    for (int i = 0; i < n; i++)
    {
        if (G[s][i] == 1 && vis[i] == 0)
            {
                bool a = (dfs(i,t)); 
                if(a) 
                {
                    vis[s] = 0;
                    return a;
                }
            }

    } 
    vis[s] = 0;
    return false;
}

int main()
{
    //freopen("in3.txt","r",stdin);
    int m;
    scanf("%d %d",&n, &m);
    for (int i = 0; i < n; i++)
    {
        vis[i] = 0; 
    } 
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            G[i][j] = 0; 
        }  
    } 
    for (int i = 0; i < m; i++)
    {
        int s, t;
        scanf("%d %d",&s,&t); 
        G[s][t] = 1;
        G[t][s] = 1;
    } 
    int q,s,t;
    scanf("%d",&q);
    for (int i = 0; i < q; i++)
    {
        scanf("%d %d",&s,&t);
        if(dfs(s,t)||dfs(t,s)) printf("yes\n");
        else printf("no\n");
    } 
    return 0;
}

Compiler output:
/tmp/ccbjTLyc.o: in function `dfs(int, int)':
a.cc:(.text+0x80): relocation truncated to fit: R_X86_64_PC32 against symbol `vis' defined in .bss section in /tmp/ccbjTLyc.o
a.cc:(.text+0xd3): relocation truncated to fit: R_X86_64_PC32 against symbol `vis' defined in .bss section in /tmp/ccbjTLyc.o
a.cc:(.text+0x106): relocation truncated to fit: R_X86_64_PC32 against symbol `vis' defined in .bss section in /tmp/ccbjTLyc.o
a.cc:(.text+0x11d): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccbjTLyc.o
a.cc:(.text+0x13a): relocation truncated to fit: R_X86_64_PC32 against symbol `vis' defined in .bss section in /tmp/ccbjTLyc.o
/tmp/ccbjTLyc.o: in function `main':
a.cc:(.text+0x15e): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccbjTLyc.o
a.cc:(.text+0x192): relocation truncated to fit: R_X86_64_PC32 against symbol `vis' defined in .bss section in /tmp/ccbjTLyc.o
a.cc:(.text+0x1a3): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccbjTLyc.o
a.cc:(.text+0x1ef): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccbjTLyc.o
a.cc:(.text+0x1fe): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccbjTLyc.o
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<unordered_map>

Compiler output:
/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<iostream>
#include<vector>
#include<stack>
using namespace std;
static const int MAX = 100000;
static const int NIL = -1;

int n;
vector<int> G[MAX];
int color[MAX];

void dfs(int r, int c) {
	int i, u, v;
	stack<int> S;
	S.push(r);
	color[r] = c;
	while ( !S.empty() ) {
		u = S.top();
		S.pop();
		for ( i = 0; i < G[u].size(); i++ ) {
			v = G[u][i];
			if ( color[v] == FIL ) {
				color[v] = c;
				S.push(v);
			}
		}
	}
}

int main() {
	int s, t, m, q, i;

	cin >> n >> m;

	for ( i = 0; i < m; i++ ) {
		cin >> s >> t;
		G[s].push_back(t);
		G[t].push_back(s);
	}

	assignColor();

	cin >> q;

	for ( i = 0; i < q; i++ ) {
		cin >> s >> t;
		if ( color[s] == color[t] ) {
			cout << "yes" << endl;
		} else {
			cout << "no" << endl;
		}
	}

	return 0;
}

Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:22:42: error: 'FIL' was not declared in this scope; did you mean 'NIL'?
   22 |                         if ( color[v] == FIL ) {
      |                                          ^~~
      |                                          NIL
a.cc: In function 'int main()':
a.cc:41:9: error: 'assignColor' was not declared in this scope
   41 |         assignColor();
      |         ^~~~~~~~~~~
Language: C++

#include<iostream>
#include<vector>
#include<stack>
using namespace std;
static const int MAX = 100000;
static const int NIL = -1;

int n;
vector<int> G[MAX];
int color[MAX];

void dfs(int r, int c) {
	stack<int> S;
	S.push(r);
	color[r] = c;
	int i, u, v;
	while ( !S.empty() ) {
		u = S.top();
		S.pop();
		for ( i = 0; i < G[u].size(); i++ ) {
			v = G[u][i];
			if ( color[v] == NIL ) {
				color[v] = c;
				S.push(v);
			}
		}
	}
}

int main() {
	int s, t, m, q, i;

	cin >> n >> m;

	for ( i = 0; i < m; i++ ) {
		cin >> s >> t;
		G[s].push_back(t);
		G[t].push_back(s);
	}

	assignColor();

	cin >> q;

	for ( i = 0; i < q; i++ ) {
		cin >> s >> t;
		if ( color[s] == color[t] ) {
			cout << "yes" << endl;
		} else {
			cout << "no" << endl;
		}
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:9: error: 'assignColor' was not declared in this scope
   41 |         assignColor();
      |         ^~~~~~~~~~~