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

import java.util.Scanner;

public static class QuickUnionUF {

    private int[] id;
    private int[] sz;

    QuickUnionUF(int N) {
        id = new int[N];
        sz = new int[N];
        for (int i = 0; i < N; i++) {
            id[i] = i;
            sz[i] = 0;
        }
    }

    private int root(int i) {
        while (i != id[i]){
            id[i] = id[id[i]]; // Path Compression: node points to grandparent
            i = id[i];
        }
        return i;
    }

    void union(int p, int q) {
        int i = root(p);
        int j = root(q);

        if (i == j) return;
        if (sz[i] < sz[j]){
            id[i] = j;
            sz[j] += sz[i];
        }
        else {
            id[j] = i;
            sz[i] += sz[j];
        }
    }

    boolean connected(int p, int q) {
        return root(p) == root(q);
    }
}


public class Main {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        int N = scanner.nextInt();
        int M = scanner.nextInt();
//        QuickFindUF uf = new QuickFindUF(N);
        QuickUnionUF uf = new QuickUnionUF(N);

        // input
        for (int i = 0; i < M; i++) {
            int p = scanner.nextInt();
            int q = scanner.nextInt();
            uf.union(p, q);
        }

        // Query
        int Q = scanner.nextInt();
        for (int i = 0; i < Q; i++) {
            int p = scanner.nextInt();
            int q = scanner.nextInt();
            if (uf.connected(p,q))
                System.out.print("yes\n");
            else
                System.out.print("no\n");
        }
    }
}

Compiler output:
Main.java:3: error: class QuickUnionUF is public, should be declared in a file named QuickUnionUF.java
public static class QuickUnionUF {
              ^
1 error
Language: Java

import java.util.Scanner;

public static class QuickUnionUF {

    private int[] id;
    private int[] sz;

    public QuickUnionUF(int N) {
        id = new int[N];
        sz = new int[N];
        for (int i = 0; i < N; i++) {
            id[i] = i;
            sz[i] = 0;
        }
    }

    private int root(int i) {
        while (i != id[i]){
            id[i] = id[id[i]]; // Path Compression: node points to grandparent
            i = id[i];
        }
        return i;
    }

    public void union(int p, int q) {
        int i = root(p);
        int j = root(q);

        if (i == j) return;
        if (sz[i] < sz[j]){
            id[i] = j;
            sz[j] += sz[i];
        }
        else {
            id[j] = i;
            sz[i] += sz[j];
        }
    }

    public boolean connected(int p, int q) {
        return root(p) == root(q);
    }
}


public class Main {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        int N = scanner.nextInt();
        int M = scanner.nextInt();
//        QuickFindUF uf = new QuickFindUF(N);
        QuickUnionUF uf = new QuickUnionUF(N);

        // input
        for (int i = 0; i < M; i++) {
            int p = scanner.nextInt();
            int q = scanner.nextInt();
            uf.union(p, q);
        }

        // Query
        int Q = scanner.nextInt();
        for (int i = 0; i < Q; i++) {
            int p = scanner.nextInt();
            int q = scanner.nextInt();
            if (uf.connected(p,q))
                System.out.print("yes\n");
            else
                System.out.print("no\n");
        }
    }
}

Compiler output:
Main.java:3: error: class QuickUnionUF is public, should be declared in a file named QuickUnionUF.java
public static class QuickUnionUF {
              ^
1 error
Language: Java

import java.util.Scanner;

public static class Main {

    private int[] id;
    private int[] sz;

    QuickUnionUF(int N) {
        id = new int[N];
        sz = new int[N];
        for (int i = 0; i < N; i++) {
            id[i] = i;
            sz[i] = 0;
        }
    }

    private int root(int i) {
        while (i != id[i]){
            id[i] = id[id[i]]; // Path Compression: node points to grandparent
            i = id[i];
        }
        return i;
    }

    void union(int p, int q) {
        int i = root(p);
        int j = root(q);

        if (i == j) return;
        if (sz[i] < sz[j]){
            id[i] = j;
            sz[j] += sz[i];
        }
        else {
            id[j] = i;
            sz[i] += sz[j];
        }
    }

    boolean connected(int p, int q) {
        return root(p) == root(q);
    }
}


public class Main {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        int N = scanner.nextInt();
        int M = scanner.nextInt();
//        QuickFindUF uf = new QuickFindUF(N);
        QuickUnionUF uf = new QuickUnionUF(N);

        // input
        for (int i = 0; i < M; i++) {
            int p = scanner.nextInt();
            int q = scanner.nextInt();
            uf.union(p, q);
        }

        // Query
        int Q = scanner.nextInt();
        for (int i = 0; i < Q; i++) {
            int p = scanner.nextInt();
            int q = scanner.nextInt();
            if (uf.connected(p,q))
                System.out.print("yes\n");
            else
                System.out.print("no\n");
        }
    }
}

Compiler output:
Main.java:8: error: invalid method declaration; return type required
    QuickUnionUF(int N) {
    ^
1 error
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

import static java.lang.Integer.parseInt;

/**
 * Graph I - Connected Components
 */
public class Main {

	static final int NIL = -1;

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;

		D main = new D();

		line = br.readLine();

		int n, m;
		n = parseInt(line.substring(0, line.indexOf(' ')));
		m = parseInt(line.substring(line.indexOf(' ') + 1));

		Vertex[] G = new Vertex[n];
		int color = 0;

		for (int i = 0; i < n; i++) {
			G[i] = main.new Vertex();
		}

		for (int i = 0; i < m; i++) {
			line = br.readLine();
			int s, t;
			s = parseInt(line.substring(0, line.indexOf(' ')));
			t = parseInt(line.substring(line.indexOf(' ') + 1));
			G[s].es.add(G[t]);
			G[t].es.add(G[s]);
		}

		for (int i = 0; i < n; i++) {
			if (G[i].color == NIL) {
				G[i].color = color++;
				Deque<Vertex> stack = new ArrayDeque<>();
				stack.push(G[i]);
				while (!stack.isEmpty()) {
					Vertex s = stack.pop();
					for (Vertex t : s.es) {
						if (t.color == NIL) {
							t.color = G[i].color;
							stack.push(t);
						}
					}
				}
			}
		}


		int q = parseInt(br.readLine());

		for (int i = 0; i < q; i++) {
			line = br.readLine();
			int s, t;
			s = parseInt(line.substring(0, line.indexOf(' ')));
			t = parseInt(line.substring(line.indexOf(' ') + 1));
			if (G[s].color == G[t].color) {
				System.out.println("yes");
			} else {
				System.out.println("no");
			}
		}
	}

	class Vertex {
		int color = NIL;
		List<Vertex> es = new ArrayList<>();
	}
}

Compiler output:
Main.java:19: error: cannot find symbol
		D main = new D();
		^
  symbol:   class D
  location: class Main
Main.java:19: error: cannot find symbol
		D main = new D();
		             ^
  symbol:   class D
  location: class Main
2 errors
Language: Java


import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.Stack;

public class Sample {

	public static void main(String[] args) throws IOException {

		Scanner in = new Scanner(System.in);

		int n = in.nextInt();
		int m = in.nextInt();
		int[] d = new int[n+1];

		List<List<Integer>> con = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			con.add(new ArrayList<Integer>());
		}
		for (int i = 0; i < m; i++) {
			int v1 = in.nextInt();
			int v2 = in.nextInt();

			con.get(v1).add(v2);
			con.get(v2).add(v1);
		}

		int q = in.nextInt();
		for (int i = 0; i < q; i++) {
			Arrays.fill(d, -1);
			int from = in.nextInt();
			int to = in.nextInt();
			if (dfs2(con, d, from, to)) {
				System.out.println("yes");
			} else {
				System.out.println("no");
			}
		}


	}

	public static boolean dfs2(List<List<Integer>> list, int[] d, int index, int target) {
		boolean flg = false;
		Stack<Integer> stack = new Stack<Integer>();
		stack.push(index);

		while (!stack.isEmpty()) {
			int from = stack.pop();
			d[from] = 1;
			List<Integer> l = list.get(from);
			for (int i = 0; i < l.size(); i++) {
				int num = l.get(i);
				if (num == target) {
					flg = true;
					break;
				}
				if (d[num] == -1) {
					stack.push(num);
					break;
				}
			}
		}

		return flg;
	}

}




Compiler output:
Main.java:10: error: class Sample is public, should be declared in a file named Sample.java
public class Sample {
       ^
1 error
Language: Java

import java.io.File;
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Deque;
import java.util.List;
import java.util.Scanner;
import java.util.Stack;

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner in = new Scanner(System.in);

		int n = in.nextInt();
		int m = in.nextInt();

		List<List<Integer>> g = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			g.add(new ArrayList<Integer>());
		}
		for (int i = 0; i < m; i++) {
			int v1 = in.nextInt();
			int v2 = in.nextInt();

			g.get(v1).add(v2);
			g.get(v2).add(v1);
		}

		for (int i = 0; i < g.size(); i++) {
			System.out.println(i + " " + g.get(i));
		}
		int q = in.nextInt();
		for (int i = 0; i < q; i++) {
			int from = in.nextInt();
			int to = in.nextInt();
			if (bfs(g, from, to)) {
				System.out.println("yes");
			} else {
				System.out.println("no");
			}
		}
	}
	public static boolean bfs(List<List<Integer>> list, int from, int target) {
		boolean isFound = false;
		int[] d = new int[list.size()];
		Arrays.fill(d, -1);

		Deque<Integer> q = new ArrayDeque<Integer>();
		q.push(from);

		while (!q.isEmpty()) {
			int index = q.pop();
			d[index] = 1;
			for (int num : list.get(index)) {
				if (num == target) {
					isFound = true;
					return isFound;
				}
				if (d[num] == -1) {
					q.push(num);
				}
			}
		}
		return isFound;
	}


Compiler output:
Main.java:68: error: reached end of file while parsing
	}
	 ^
1 error
Language: Java

import java.util.*;
public class ConnectedComponents{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int m=sc.nextInt();
		int[] A=new int[n];
		for(int i=0;i<n;i++){
			A[i]=i;
		}
		for(int i=0;i<m;i++){
			int a=sc.nextInt();
			int b=sc.nextInt();
			A[b]=A[a];
		}
		int num=sc.nextInt();
		for(int i=0;i<num;i++){
			int x=sc.nextInt();
			int y=sc.nextInt();
			if(A[x]==A[y]){
				System.out.println("yes");
			}else{
				System.out.println("no");
			}
		}
	}
}


Compiler output:
Main.java:2: error: class ConnectedComponents is public, should be declared in a file named ConnectedComponents.java
public class ConnectedComponents{
       ^
1 error
Language: C

#include<stdio.h>
#include<string.h>

#define LANGE 100000
int V,E;
int color=0;

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, s, t, q, x, y, C[LARGE];
  list *L[LARGE], *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 'makelist':
main.c:15:15: error: implicit declaration of function 'malloc' [-Wimplicit-function-declaration]
   15 |   list *new = malloc(sizeof(list));
      |               ^~~~~~
main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'malloc'
    2 | #include<string.h>
  +++ |+#include <stdlib.h>
    3 | 
main.c:15:15: warning: incompatible implicit declaration of built-in function 'malloc' [-Wbuiltin-declaration-mismatch]
   15 |   list *new = malloc(sizeof(list));
      |               ^~~~~~
main.c:15:15: note: include '<stdlib.h>' or provide a declaration of 'malloc'
main.c: In function 'dfs':
main.c:43:13: error: 'LARGE' undeclared (first use in this function); did you mean 'LANGE'?
   43 |   int stack[LARGE];
      |             ^~~~~
      |             LANGE
main.c:43:13: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'main':
main.c:67:30: error: 'LARGE' undeclared (first use in this function); did you mean 'LANGE'?
   67 |   int i, j, s, t, q, x, y, C[LARGE];
      |                              ^~~~~
      |                              LANGE
Language: C

#include<stdio.h>

#define N 100000

#define WHITE 0
#define GRAY 1
#define BLACK 2

int n;
int time;
short int color[N];
int d[N],f[N];

void visit(int u,int G[n][n]){
  int i;
  
  color[u] = GRAY;
  d[u] = ++time;
  for(i=1;i<=n;i++){
    if(G[u][i]==1 && color[i]==WHITE) visit(i,G);
  }
  color[u] = BLACK;
  f[u] = ++time;
}


int rooting(int s,int t,int G[n][n]){
  int i;

  for(i=0;i<n;i++){
    color[i]=WHITE;
    d[i] = -1;
    f[i] = -1;
  }
  time = 0;
  
  visit(s,G);

  if(f[t]!=-1) return 1;
  else 0;
}



int main(){

  int m;
  int i,j;
  
  scanf("%d%d",&n,&m);

  int G[n][n];

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      G[i][j] = 0;
    }
  }

  int a,b;

  for(i=0;i<m;i++){
    scanf("%d%d",&a,&b);
    G[a][b] = 1;
  }

  int q;
  scanf("%d",&q);

  int s[q],t[q]
  for(i=0;i<q;i++){
    scanf("%d%d",&s[i],&t[i]);
  }

  for(i=0;i<q;i++){
    if(rooting(s[i],t[i],G)) printf("yes\n");
    else printf("no\n");
  }
  
  return 0;
}



Compiler output:
main.c: In function 'main':
main.c:71:3: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'for'
   71 |   for(i=0;i<q;i++){
      |   ^~~
main.c:71:18: error: expected ';' before ')' token
   71 |   for(i=0;i<q;i++){
      |                  ^
      |                  ;
main.c:71:18: error: expected statement before ')' token
main.c:72:25: error: 't' undeclared (first use in this function)
   72 |     scanf("%d%d",&s[i],&t[i]);
      |                         ^
main.c:72:25: note: each undeclared identifier is reported only once for each function it appears in
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();
    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:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAX_N 100000
#define MAX_M 100000

typedef struct EDGE {
	int to;
	struct EDGE *next;
} edge;

int buff_size;
edge buff[MAX_M + MAX_M];
edge *adj[MAX_N];

void init(int n, int m) {
	int i;
	for(i = 0; i < n; ++i) {
		adj[i] = NULL;
	}
	for(i = 0; i < m; ++i) {
		buff[i].next = NULL;
	}
	buff_size = 0;
}

edge *new_edge() {
	return buff + buff_size++;
}

void add_edge(int u, int v) {
	edge *e = new_edge();
	e->to = v;
	e->next = adj[u];
	adj[u] = e;
}

int head, tail;
int queue[MAX_N];

void enqueue(int data) {
	queue[tail++] = data;
}

int dequeue() {
	return queue[head++];
}

int empty() {
	return head == tail;
}

void clear() {
	head = tail = 0;
}

int next_label;
int label[MAX_N];

void bfs(int v) {
	edge *e;

	clear();
	enqueue(v);

	label[v] = next_label;
	while(!empty()) {
		const int v = dequeue();
		for(e = adj[v]; e != NULL; e = e->next) {
			if(label[e->to] == -1) {
				label[e->to] = next_label;
				enqueue(e->to);
			}
		}
	}
	++next_label;
}

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

	scanf("%d %d", &n, &m);
	init(n, m);

	for(i = 0; i < m; ++i) {
		scanf("%d %d", &u, &v);
		add_edge(u, v);
		add_edge(v, u);
	}

	memset(label, -1, sizeof(label));
	for(i = 0; i < n; ++i) {
		if(label[i] == -1) bfs(i);
	}

	scanf("%d", &q);
	while(q--) {
		scanf("%d %d", &s, &t);
_		puts(label[s] == label[t] ? "yes" : "no");
	}

	return EXIT_SUCCESS;
}

Compiler output:
main.c: In function 'main':
main.c:103:1: error: unknown type name '_'
  103 | _               puts(label[s] == label[t] ? "yes" : "no");
      | ^
main.c:103:22: error: expected declaration specifiers or '...' before 'label'
  103 | _               puts(label[s] == label[t] ? "yes" : "no");
      |                      ^~~~~
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
??
typedef struct Node {
????int val;
????struct Node *next;?? 
} node_t;
??
node_t *G[100000];
int connected[100000];
int color;
??
node_t* add_node(node_t *node, int val)
{
????????node_t *n = (node_t*)malloc(sizeof(node_t));
????????n->val = val;
????????n->next = node;
????????return n;???????? 
}
??
void add(int u, int v)
{
????????G[u] = add_node(G[u], v);
????????G[v] = add_node(G[v], u);
}
??
void dfs(int v)
{
????????node_t *p;
????????if (connected[v]) return;
????????connected[v] = color;
????????for (p = G[v]; p != NULL; p = p->next) {
????????????????dfs(p->val);
????????}
}
??
int main()
{
????????int i;?????? 
????????int n, m;
????????int s, t;
????????scanf("%d %d", &n, &m);
??????????
????????for (i = 0; i < m; i++) {
????????????????scanf("%d %d", &s, &t);
????????????????add(s, t);?????????????? 
????????}
??????????
????????for (i = 0; i < n; i++) {
????????????????color = i + 1;
????????????????dfs(i);
????????}
??????????
????????int q;
????????scanf("%d", &q);
????????for (i = 0; i < q; i++) {
????????????????scanf("%d %d", &s, &t);
????????????????if (connected[s] == connected[t]) puts("yes");
????????????????else puts("no");
????????}

??????????
????????return 0;
}

Compiler output:
main.c:4:1: error: expected identifier or '(' before '?' token
    4 | ??
      | ^
main.c:8:3: warning: data definition has no type or storage class
    8 | } node_t;
      |   ^~~~~~
main.c:8:3: error: type defaults to 'int' in declaration of 'node_t' [-Wimplicit-int]
main.c:9:1: error: expected identifier or '(' before '?' token
    9 | ??
      | ^
main.c:13:1: error: expected identifier or '(' before '?' token
   13 | ??
      | ^
main.c:21:1: error: expected identifier or '(' before '?' token
   21 | ??
      | ^
main.c:27:1: error: expected identifier or '(' before '?' token
   27 | ??
      | ^
main.c:37:1: error: expected identifier or '(' before '?' token
   37 | ??
      | ^
Language: C

#include <stdio.h>
#include <stdlib.h>
??
typedef struct Node {
????int val;
????struct Node *next;?? 
} node_t;
??
node_t *G[100000];
int connected[100000];
int color;
??
node_t* add_node(node_t *node, int val)
{
????????node_t *n = (node_t*)malloc(sizeof(node_t));
????????n->val = val;
????????n->next = node;
????????return n;???????? 
}
??
void add(int u, int v)
{
????????G[u] = add_node(G[u], v);
????????G[v] = add_node(G[v], u);
}
??
void dfs(int v)
{
????????node_t *p;
????????if (connected[v]) return;
????????connected[v] = color;
????????for (p = G[v]; p != NULL; p = p->next) {
????????????????dfs(p->val);
????????}
}
??
int main()
{
????????int i;?????? 
????????int n, m;
????????int s, t;
????????scanf("%d %d", &n, &m);
??????????
????????for (i = 0; i < m; i++) {
????????????????scanf("%d %d", &s, &t);
????????????????add(s, t);?????????????? 
????????}
??????????
????????for (i = 0; i < n; i++) {
????????????????color = i + 1;
????????????????dfs(i);
????????}
??????????
????????int q;
????????scanf("%d", &q);
????????for (i = 0; i < q; i++) {
????????????????scanf("%d %d", &s, &t);
????????????????if (connected[s] == connected[t]) puts("yes");
????????????????else puts("no");
????????}

??????????
????????return 0;
}

Compiler output:
main.c:3:1: error: expected identifier or '(' before '?' token
    3 | ??
      | ^
main.c:7:3: warning: data definition has no type or storage class
    7 | } node_t;
      |   ^~~~~~
main.c:7:3: error: type defaults to 'int' in declaration of 'node_t' [-Wimplicit-int]
main.c:8:1: error: expected identifier or '(' before '?' token
    8 | ??
      | ^
main.c:12:1: error: expected identifier or '(' before '?' token
   12 | ??
      | ^
main.c:20:1: error: expected identifier or '(' before '?' token
   20 | ??
      | ^
main.c:26:1: error: expected identifier or '(' before '?' token
   26 | ??
      | ^
main.c:36:1: error: expected identifier or '(' before '?' token
   36 | ??
      | ^
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
??
typedef struct Node {
????int val;
????struct Node *next;?? 
} node_t;
??
node_t *G[100000];
int connected[100000];
int color;
??
node_t* add_node(node_t *node, int val)
{
????????node_t *n = (node_t*)malloc(sizeof(node_t));
????????n->val = val;
????????n->next = node;
????????return n;???????? 
}
??
void add(int u, int v)
{
????????G[u] = add_node(G[u], v);
????????G[v] = add_node(G[v], u);
}
??
void dfs(int v)
{
????????node_t *p;
????????if (connected[v]) return;
????????connected[v] = color;
????????for (p = G[v]; p != NULL; p = p->next) {
????????????????dfs(p->val);
????????}
}
??
int main()
{
????????int i;?????? 
????????int n, m;
????????int s, t;
????????scanf("%d %d", &n, &m);
??????????
????????for (i = 0; i < m; i++) {
????????????????scanf("%d %d", &s, &t);
????????????????add(s, t);?????????????? 
????????}
??????????
????????for (i = 0; i < n; i++) {
????????????????color = i + 1;
????????????????dfs(i);
????????}
??????????
????????int q;
????????scanf("%d", &q);
????????for (i = 0; i < q; i++) {
????????????????scanf("%d %d", &s, &t);
????????????????if (connected[s] == connected[t]) puts("yes");
????????????????else puts("no");
????????}

????????return 0;
}

Compiler output:
main.c:4:1: error: expected identifier or '(' before '?' token
    4 | ??
      | ^
main.c:8:3: warning: data definition has no type or storage class
    8 | } node_t;
      |   ^~~~~~
main.c:8:3: error: type defaults to 'int' in declaration of 'node_t' [-Wimplicit-int]
main.c:9:1: error: expected identifier or '(' before '?' token
    9 | ??
      | ^
main.c:13:1: error: expected identifier or '(' before '?' token
   13 | ??
      | ^
main.c:21:1: error: expected identifier or '(' before '?' token
   21 | ??
      | ^
main.c:27:1: error: expected identifier or '(' before '?' token
   27 | ??
      | ^
main.c:37:1: error: expected identifier or '(' before '?' token
   37 | ??
      | ^
Language: C

#include <stdio.h>
#include <stdlib.h>
#define MAX 100010
#define INFTY 10000000
#define NIL -1

struct Node {
	int value;
	struct Node *next;
};
typedef struct Node node_t;


int N;
int M;
node_t *G[MAX];
int color[MAX];

node_t* addNode(node_t *node, int value)
{
	node_t *new = (node_t*)malloc(sizeof(node_t));
	new->value = value;
	new->next = node;
	return new;
}

void dfs(int r)
{
	color[r] = id;
	node_t *n;
	for (n=G[r]; n!=NULL; n=n->next) {
		int v = n->value;
		if (color[v] == NIL) {
			color[v] = id;
			dfs(v);
		}
	}
}

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


int main()
{
	int i, n, u, v;	
	scanf("%d %d", &N, &M);	
	for (i = 0; i < M; i++) {
		scanf("%d %d", &n, &v);
		G[n] = addNode(G[n], v);
		G[v] = addNode(G[v], n);
	}
	
	assignColor();
	
	int Q;
	scanf("%d", &Q);
	for (i = 0; i < Q; i++) {
		scanf("%d %d", &u, &v);
		if (color[u] == color[v]) {
			puts("yes");			
		}
		else {
			puts("no");
		}
	}

	return 0;
}

Compiler output:
main.c: In function 'dfs':
main.c:29:20: error: 'id' undeclared (first use in this function)
   29 |         color[r] = id;
      |                    ^~
main.c:29:20: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'assignColor':
main.c:48:38: error: too many arguments to function 'dfs'
   48 |                 if (color[u] == NIL) dfs(u, id++);
      |                                      ^~~
main.c:27:6: note: declared here
   27 | void dfs(int r)
      |      ^~~
Language: C

#include <stdio.h>
#include <stdlib.h>
#define MAX 100010
#define INFTY 10000000
#define NIL -1

struct Node {
	int value;
	struct Node *next;
};
typedef struct Node node_t;


int N;
int M;
node_t *G[MAX];
int color[MAX];

node_t* addNode(node_t *node, int value)
{
	node_t *new = (node_t*)malloc(sizeof(node_t));
	new->value = value;
	new->next = node;
	return new;
}

void dfs(int r)
{
	color[r] = id;
	node_t *n;
	for (n=G[r]; n!=NULL; n=n->next) {
		int v = n->value;
		if (color[v] == NIL) {
			color[v] = id;
			dfs(v);
		}
	}
}

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


int main()
{
	int i, n, u, v;	
	scanf("%d %d", &N, &M);	
	for (i = 0; i < M; i++) {
		scanf("%d %d", &n, &v);
		G[n] = addNode(G[n], v);
		G[v] = addNode(G[v], n);
	}
	
	assignColor();
	
	int Q;
	scanf("%d", &Q);
	for (i = 0; i < Q; i++) {
		scanf("%d %d", &u, &v);
		if (color[u] == color[v]) {
			puts("yes");			
		}
		else {
			puts("no");
		}
	}

	return 0;
}

Compiler output:
main.c: In function 'dfs':
main.c:29:20: error: 'id' undeclared (first use in this function)
   29 |         color[r] = id;
      |                    ^~
main.c:29:20: note: each undeclared identifier is reported only once for each function it appears in
Language: C


#include <stdio.h>

#define WHITE 1
#define GRAY 0
#define BLACK -1

void dfs(int);
void visit(int);

int color[100002],n,vv[100002][10002],k[100002];

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

  /* n ユーザ数 */
  /* m 友達関係の数 */

  scanf("%d %d",&n,&m);

  for(i=0;i<n;i++){
    k[i]=0;
  }

  //友達関係をinput
  for(i=0;i<m;i++){
    scanf("%d%d",&s,&t);
    vv[t][k[t]]=s;
    vv[s][k[s]]=t;
    k[s]++;
    k[t]++;
  }

  //質問をinput
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d%d",&s,&t);

   dfs(s);

    if(color[t]==WHITE) printf("no\n");
    else printf("yes\n");
  }

  return 0;
}

void dfs(int a){
  int u;
  for(u=0;u<n;u++){
    color[u] = WHITE;
  }
  for(u=a;u<n;u++){
    if(color[u] == WHITE) visit(u);
  }
}

void visit(int u){
  int i,v;
  color[u] = GRAY;
  for(i=0;i<k[u];i++){
    v=vv[u][i];
    if(color[v] == WHITE) visit(v);
  }
  color[u] = BLACK; 
}
 

Compiler output:
/tmp/ccSPC7Zk.o: in function `main':
main.c:(.text+0x46): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/ccSPC7Zk.o
main.c:(.text+0x9e): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/ccSPC7Zk.o
main.c:(.text+0xdd): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/ccSPC7Zk.o
main.c:(.text+0x11a): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/ccSPC7Zk.o
main.c:(.text+0x131): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/ccSPC7Zk.o
main.c:(.text+0x149): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/ccSPC7Zk.o
main.c:(.text+0x160): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/ccSPC7Zk.o
/tmp/ccSPC7Zk.o: in function `visit':
main.c:(.text+0x325): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/ccSPC7Zk.o
collect2: error: ld returned 1 exit status
Language: C

#include <stdio.h>
#define MAX_N 100001
#define VISITED 1

struct vertex
{
	int N[MAX_N];
	int len_N;
} typedef vertex;

int n;
vertex V[MAX_N];

int flag[MAX_N];


void setDefault();
int CanReach(int, int);
void reTravel(int);

int main()
{
	int i;
	int m, q;
	int id1, id2;
	
	setDefault();
	
	scanf("%d %d", &n, &m);
	for(i = 0; i < m; i++)
	{
		scanf("%d %d", &id1, &id2);
		while(getchar() != '\n');
		
		V[id1].N[V[id1].len_N] = id2;
		V[id1].len_N++;
		
		V[id2].N[V[id2].len_N] = id1;
		V[id2].len_N++;
	}
	
	scanf("%d", &q);
	for(i = 0; i < q; i++)
	{
		scanf("%d %d", &id1, &id2);
		while(getchar() != '\n');
		
		if(CanReach(id1, id2))
		printf("yes\n");
		
		else
		printf("no\n");
	}
	
	return 0;
}

void setDefault()
{
	int i;
	
	for(i = 0; i < n; i++)
	{
		V[i].len_N = 0;
	}
}

int CanReach(int start, int goal)
{
	int i;
	
	for(i = 0; i < n; i++)
	{
		flag[i] = 0;
	}
	
	reTravel(start);
	
	if(flag[goal] == VISITED)
	return 1;
	
	return 0;
}

void reTravel(int t)
{
	int i;
	int next;
	
	flag[t] = VISITED;
	
	for(i = 0; i < V[t].len_N; i++)
	{
		next = V[t].N[i];
		
		if(flag[next] != VISITED)
		reTravel(next);
	}
}

Compiler output:
/tmp/ccFMk8oG.o: in function `CanReach':
main.c:(.text+0x248): relocation truncated to fit: R_X86_64_PC32 against symbol `flag' defined in .bss section in /tmp/ccFMk8oG.o
main.c:(.text+0x27c): relocation truncated to fit: R_X86_64_PC32 against symbol `flag' defined in .bss section in /tmp/ccFMk8oG.o
/tmp/ccFMk8oG.o: in function `reTravel':
main.c:(.text+0x2b1): relocation truncated to fit: R_X86_64_PC32 against symbol `flag' defined in .bss section in /tmp/ccFMk8oG.o
main.c:(.text+0x2ff): relocation truncated to fit: R_X86_64_PC32 against symbol `flag' defined in .bss section in /tmp/ccFMk8oG.o
collect2: error: ld returned 1 exit status
Language: C

#include <stdio.h>
#define MAX_N 100001
#define VISITED 1

struct vertex
{
	int N[MAX_N];
	int len_N;
} typedef vertex;

int n;
vertex V[MAX_N];

int flag[MAX_N];


void setDefault();
int CanReach(int, int);
void reTravel(int);

int main()
{
	int i;
	int m, q;
	int id1, id2;
	
	setDefault();
	
	scanf("%d %d", &n, &m);
	for(i = 0; i < m; i++)
	{
		scanf("%d %d", &id1, &id2);
		while(getchar() != '\n');
		
		V[id1].N[V[id1].len_N] = id2;
		V[id1].len_N++;
		
		V[id2].N[V[id2].len_N] = id1;
		V[id2].len_N++;
	}
	
	scanf("%d", &q);
	for(i = 0; i < q; i++)
	{
		scanf("%d %d", &id1, &id2);
		while(getchar() != '\n');
		
		if(CanReach(id1, id2))
		printf("yes\n");
		
		else
		printf("no\n");
	}
	
	return 0;
}

void setDefault()
{
	int i;
	
	for(i = 0; i < n; i++)
	{
		V[i].len_N = 0;
	}
}

int CanReach(int start, int goal)
{
	int i;
	
	for(i = 0; i < n; i++)
	{
		flag[i] = 0;
	}
	
	reTravel(start);
	
	if(flag[goal] == VISITED)
	return 1;
	
	return 0;
}

void reTravel(int t)
{
	int i;
	int next;
	
	flag[t] = VISITED;
	
	for(i = 0; i < V[t].len_N; i++)
	{
		next = V[t].N[i];
		
		if(flag[next] != VISITED)
		reTravel(next);
	}
}

Compiler output:
/tmp/ccdlAXiA.o: in function `CanReach':
main.c:(.text+0x248): relocation truncated to fit: R_X86_64_PC32 against symbol `flag' defined in .bss section in /tmp/ccdlAXiA.o
main.c:(.text+0x27c): relocation truncated to fit: R_X86_64_PC32 against symbol `flag' defined in .bss section in /tmp/ccdlAXiA.o
/tmp/ccdlAXiA.o: in function `reTravel':
main.c:(.text+0x2b1): relocation truncated to fit: R_X86_64_PC32 against symbol `flag' defined in .bss section in /tmp/ccdlAXiA.o
main.c:(.text+0x2ff): relocation truncated to fit: R_X86_64_PC32 against symbol `flag' defined in .bss section in /tmp/ccdlAXiA.o
collect2: error: ld returned 1 exit status
Language: C

#iclude <stdio.h>
int main() {

int n, m, i, k[1000000][2], s, si[100000][2];

scanf ("%d %d",&n, &m);

for (i = 0; i < m - 1; i++)
scanf ("%d %d", &k[i][0], &k[i][1]);

scanf ("%d", &s);

for (i = 0; i < s; i++)
scanf ("%d %d", &si[i][1], &si[i][2]);

return 0;
}

Compiler output:
main.c:1:2: error: invalid preprocessing directive #iclude; did you mean #include?
    1 | #iclude <stdio.h>
      |  ^~~~~~
      |  include
main.c: In function 'main':
main.c:6:1: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    6 | scanf ("%d %d",&n, &m);
      | ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | #iclude <stdio.h>
main.c:6:1: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    6 | scanf ("%d %d",&n, &m);
      | ^~~~~
main.c:6:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
Language: C

#include<stdio.h>
#define MAX 100000
#define NIL -1

int G[MAX][MAX];
int n, color[MAX], S[MAX], top=0;


void push(int x) {
  S[++top]=x;
}

int pop() {
  top--;
  return S[top+1];
}

int isEmpty() {
  return top==0;
}
void dfs(int r, int c) {
  int i, v, u;
  push(r);
  color[r]=c;
  while (! isEmpty()) {
    u=S[top];
    pop();
    for (i=0; i<n; i++) {
      if (G[u][i]==0) continue;
        v=i;
      if (color[v]==NIL) {
        color[v]=c;
        push(v);
      }
    }
  }
}



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

int main() {

  int  m, i, j, v, s, t, q;

  scanf("%d %d", &n, &m);

  for (i=0; i<n; i++)
    for (j=0; j<n; j++)
      G[i][j]=0;

  for (i=0; i<m; i++) {
    scanf("%d %d", &s, &t);
    G[s][t]=1;
    G[t][s]=1;
  }

  scanf("%d", &q);

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

  return 0;

}

Compiler output:
/tmp/ccddZfan.o: in function `push':
main.c:(.text+0x9): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccddZfan.o
main.c:(.text+0x12): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccddZfan.o
main.c:(.text+0x18): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccddZfan.o
main.c:(.text+0x29): relocation truncated to fit: R_X86_64_PC32 against symbol `S' defined in .bss section in /tmp/ccddZfan.o
/tmp/ccddZfan.o: in function `pop':
main.c:(.text+0x3c): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccddZfan.o
main.c:(.text+0x45): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccddZfan.o
main.c:(.text+0x4b): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccddZfan.o
main.c:(.text+0x5f): relocation truncated to fit: R_X86_64_PC32 against symbol `S' defined in .bss section in /tmp/ccddZfan.o
/tmp/ccddZfan.o: in function `isEmpty':
main.c:(.text+0x6e): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccddZfan.o
/tmp/ccddZfan.o: in function `dfs':
main.c:(.text+0xa4): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccddZfan.o
main.c:(.text+0xb5): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C

#include<stdio.h>
#define MAX 100000
#define NIL -1

int G[MAX][MAX];
int n, color[MAX], S[MAX], top=0;


void push(int x) {
  S[++top]=x;
}

int pop() {
  top--;
  return S[top+1];
}

int isEmpty() {
  return top==0;
}

void dfs(int r, int c) {
  int i, v, u;
  push(r);
  color[r]=c;
  while (! isEmpty()) {
    u=S[top];
    pop();
    for (i=0; i<n; i++) {
      if (G[u][i]==0) continue;
        v=i;
      if (color[v]==NIL) {
        color[v]=c;
        push(v);
      }
    }
  }
}



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

int main() {

  int  m, i, j, v, s, t, q;

  scanf("%d %d", &n, &m);

  for (i=0; i<n; i++)
    for (j=0; j<n; j++)
      G[i][j]=0;

  for (i=0; i<m; i++) {
    scanf("%d %d", &s, &t);
    G[s][t]=1;
    G[t][s]=1;
  }
  assignColor();
  
  scanf("%d", &q);

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

  return 0;

}

Compiler output:
/tmp/ccqxC1Na.o: in function `push':
main.c:(.text+0x9): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccqxC1Na.o
main.c:(.text+0x12): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccqxC1Na.o
main.c:(.text+0x18): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccqxC1Na.o
main.c:(.text+0x29): relocation truncated to fit: R_X86_64_PC32 against symbol `S' defined in .bss section in /tmp/ccqxC1Na.o
/tmp/ccqxC1Na.o: in function `pop':
main.c:(.text+0x3c): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccqxC1Na.o
main.c:(.text+0x45): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccqxC1Na.o
main.c:(.text+0x4b): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccqxC1Na.o
main.c:(.text+0x5f): relocation truncated to fit: R_X86_64_PC32 against symbol `S' defined in .bss section in /tmp/ccqxC1Na.o
/tmp/ccqxC1Na.o: in function `isEmpty':
main.c:(.text+0x6e): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccqxC1Na.o
/tmp/ccqxC1Na.o: in function `dfs':
main.c:(.text+0xa4): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccqxC1Na.o
main.c:(.text+0xb5): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C

#include<stdio.h>
#include<stdlib.h>
#define MAX 100000
#define NIL -1

int G[MAX][MAX];
int n, color[MAX], S[MAX], top=0;


void push(int x) {
  S[++top]=x;
}

int pop() {
  top--;
  return S[top+1];
}

int isEmpty() {
  return top==0;
}

void dfs(int r, int c) {
  int i, v, u;
  push(r);
  color[r]=c;
  while (! isEmpty()) {
    u=S[top];
    pop();
    for (i=0; i<n; i++) {
      if (G[u][i]==0) continue;
        v=i;
      if (color[v]==NIL) {
        color[v]=c;
        push(v);
      }
    }
  }
}



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

int main() {

  int  m, i, j, v, s, t, q;

  scanf("%d %d", &n, &m);

  for (i=0; i<n; i++)
    for (j=0; j<n; j++)
      G[i][j]=0;

  for (i=0; i<m; i++) {
    scanf("%d %d", &s, &t);
    G[s][t]=1;
    G[t][s]=1;
  }
  assignColor();

  scanf("%d", &q);

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

  return 0;

}

Compiler output:
/tmp/cc433cUS.o: in function `push':
main.c:(.text+0x9): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/cc433cUS.o
main.c:(.text+0x12): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/cc433cUS.o
main.c:(.text+0x18): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/cc433cUS.o
main.c:(.text+0x29): relocation truncated to fit: R_X86_64_PC32 against symbol `S' defined in .bss section in /tmp/cc433cUS.o
/tmp/cc433cUS.o: in function `pop':
main.c:(.text+0x3c): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/cc433cUS.o
main.c:(.text+0x45): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/cc433cUS.o
main.c:(.text+0x4b): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/cc433cUS.o
main.c:(.text+0x5f): relocation truncated to fit: R_X86_64_PC32 against symbol `S' defined in .bss section in /tmp/cc433cUS.o
/tmp/cc433cUS.o: in function `isEmpty':
main.c:(.text+0x6e): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/cc433cUS.o
/tmp/cc433cUS.o: in function `dfs':
main.c:(.text+0xa4): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc433cUS.o
main.c:(.text+0xb5): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C

#include<stdio.h>
#include<stdlib.h>
#define MAX 100000
#define NIL -1

int G[MAX][MAX];
int n, color[MAX], S[100000], top=0;


void push(int x) {
  S[++top]=x;
}

int pop() {
  top--;
  return S[top+1];
}

int isEmpty() {
  return top==0;
}

void dfs(int r, int c) {
  int i, v, u;
  push(r);
  color[r]=c;
  while (! isEmpty()) {
    u=S[top];
    pop();
    for (i=0; i<n; i++) {
      if (G[u][i]==0) continue;
        v=i;
      if (color[v]==NIL) {
        color[v]=c;
        push(v);
      }
    }
  }
}



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

int main() {

  int  m, i, j, v, s, t, q;

  scanf("%d %d", &n, &m);

  for (i=0; i<n; i++)
    for (j=0; j<n; j++)
      G[i][j]=0;

  for (i=0; i<m; i++) {
    scanf("%d %d", &s, &t);
    G[s][t]=1;
    G[t][s]=1;
  }
  assignColor();

  scanf("%d", &q);

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

  return 0;

}

Compiler output:
/tmp/ccZCSxbQ.o: in function `push':
main.c:(.text+0x9): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccZCSxbQ.o
main.c:(.text+0x12): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccZCSxbQ.o
main.c:(.text+0x18): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccZCSxbQ.o
main.c:(.text+0x29): relocation truncated to fit: R_X86_64_PC32 against symbol `S' defined in .bss section in /tmp/ccZCSxbQ.o
/tmp/ccZCSxbQ.o: in function `pop':
main.c:(.text+0x3c): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccZCSxbQ.o
main.c:(.text+0x45): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccZCSxbQ.o
main.c:(.text+0x4b): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccZCSxbQ.o
main.c:(.text+0x5f): relocation truncated to fit: R_X86_64_PC32 against symbol `S' defined in .bss section in /tmp/ccZCSxbQ.o
/tmp/ccZCSxbQ.o: in function `isEmpty':
main.c:(.text+0x6e): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccZCSxbQ.o
/tmp/ccZCSxbQ.o: in function `dfs':
main.c:(.text+0xa4): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccZCSxbQ.o
main.c:(.text+0xb5): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C

#include<stdio.h>
#include<stdlib.h>
#define MAX 100000
#define NIL -1

int G[MAX][MAX];
int n, color[MAX], S[100000], top;


void push(int x) {
  S[++top]=x;
}

int pop() {
  top--;
  return S[top+1];
}

int isEmpty() {
  return top==0;
}

void dfs(int r, int c) {
  int i, v, u;
  push(r);
  color[r]=c;
  while (! isEmpty()) {
    u=S[top];
    pop();
    for (i=0; i<n; i++) {
      if (G[u][i]==0) continue;
        v=i;
      if (color[v]==NIL) {
        color[v]=c;
        push(v);
      }
    }
  }
}



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

int main() {

  int  m, i, j, v, s, t, q;

  scanf("%d %d", &n, &m);

  for (i=0; i<n; i++)
    for (j=0; j<n; j++)
      G[i][j]=0;

  for (i=0; i<m; i++) {
    scanf("%d %d", &s, &t);
    G[s][t]=1;
    G[t][s]=1;
  }
  assignColor();

  scanf("%d", &q);

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

  return 0;

}

Compiler output:
/tmp/ccjatu0w.o: in function `push':
main.c:(.text+0x9): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccjatu0w.o
main.c:(.text+0x12): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccjatu0w.o
main.c:(.text+0x18): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccjatu0w.o
main.c:(.text+0x29): relocation truncated to fit: R_X86_64_PC32 against symbol `S' defined in .bss section in /tmp/ccjatu0w.o
/tmp/ccjatu0w.o: in function `pop':
main.c:(.text+0x3c): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccjatu0w.o
main.c:(.text+0x45): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccjatu0w.o
main.c:(.text+0x4b): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccjatu0w.o
main.c:(.text+0x5f): relocation truncated to fit: R_X86_64_PC32 against symbol `S' defined in .bss section in /tmp/ccjatu0w.o
/tmp/ccjatu0w.o: in function `isEmpty':
main.c:(.text+0x6e): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccjatu0w.o
/tmp/ccjatu0w.o: in function `dfs':
main.c:(.text+0xa4): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccjatu0w.o
main.c:(.text+0xb5): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status