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

#include <iostream>
#include <vector>
using namespace std;
vector<vector<int>> adjlist;
int time=1;
vector<int> d;
vector<int> f;
void input(int n){
	vector<int> f={0,0};
	adjlist.push_back(f);
  for(int i=0;i<n;i++){
    vector<int> list;
    int ln;
    cin>>ln;
    list.push_back(ln);
    cin>>ln;
    list.push_back(ln);
    for(int j=0;j<ln;j++){
      int an;
      cin>>an;
      list.push_back(an);
    }
    adjlist.push_back(list);
  }
}

void depth_search(int id){
	vector<int> list=adjlist[id];
	for(int j=0;j<list[1];j++){
		if(d[list[2+j]]<0){
			d[list[2+j]]=++time;
			depth_search(list[2+j]);
		}
	}
	f[id]=++time;
}
 
void print(int n){
  for(int i=1;i<n+1;i++){
    cout<<i<<' '<<d[i]<<' '<<f[i]<<endl;
  }
}
int main(){
  int n;
  cin>>n;
	d=vector<int> (n+1,-1);
	f=vector<int> (n+1,-1);
	d[1]=1;
	f[1]=1;
  input(n);
  depth_search(1);
  print(n);
  return 0;
}


Compiler output:
a.cc:5:5: error: 'int time' redeclared as different kind of entity
    5 | int time=1;
      |     ^~~~
In file included from /usr/include/pthread.h:23,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
                 from /usr/include/c++/14/ext/atomicity.h:35,
                 from /usr/include/c++/14/bits/ios_base.h:39,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
   76 | extern time_t time (time_t *__timer) __THROW;
      |               ^~~~
a.cc: In function 'void depth_search(int)':
a.cc:31:40: warning: ISO C++ forbids incrementing a pointer of type 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} [-Wpointer-arith]
   31 |                         d[list[2+j]]=++time;
      |                                        ^~~~
a.cc:31:40: error: lvalue required as increment operand
a.cc:35:17: warning: ISO C++ forbids incrementing a pointer of type 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} [-Wpointer-arith]
   35 |         f[id]=++time;
      |                 ^~~~
a.cc:35:17: error: lvalue required as increment operand
Language: C++

#include <iostream>
#include <vector>
#include <cstring>

using namespace std;

int n, u, k, v, d[110], f[110], time=0;
bool vis[110];
vector<int> adj[110];

void dfs (int p)
{
    time++;
    vis[p]=true;
    d[p]=time;
    for (auto u : adj[p])
    {
        if (!vis[u]) dfs(u);
    }
    time++;
    f[p]=time;
}

int main()
{
    memset(vis, false, sizeof(vis));
    cin>>n;
    for (int i=0; i<n; i++)
    {
        cin>>u>>k;
        for (int j=0; j<k; j++)
        {
            cin>>v;
            adj[u].push_back(v);
        }
    }
    dfs(1);
    for (int i=1; i<=n; i++)
    {
        cout<<i<<' '<<d[i]<<' '<<f[i]<<'\n';
    }
    return 0;
}



Compiler output:
a.cc:7:33: error: 'int time' redeclared as different kind of entity
    7 | int n, u, k, v, d[110], f[110], time=0;
      |                                 ^~~~
In file included from /usr/include/pthread.h:23,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
                 from /usr/include/c++/14/ext/atomicity.h:35,
                 from /usr/include/c++/14/bits/ios_base.h:39,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
   76 | extern time_t time (time_t *__timer) __THROW;
      |               ^~~~
a.cc: In function 'void dfs(int)':
a.cc:13:5: warning: ISO C++ forbids incrementing a pointer of type 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} [-Wpointer-arith]
   13 |     time++;
      |     ^~~~
a.cc:13:9: error: lvalue required as increment operand
   13 |     time++;
      |         ^~
a.cc:15:10: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
   15 |     d[p]=time;
      |          ^~~~
      |          |
      |          time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:20:5: warning: ISO C++ forbids incrementing a pointer of type 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} [-Wpointer-arith]
   20 |     time++;
      |     ^~~~
a.cc:20:9: error: lvalue required as increment operand
   20 |     time++;
      |         ^~
a.cc:21:10: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
   21 |     f[p]=time;
      |          ^~~~
      |          |
      |          time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
Language: C++

#include <iostream>
#include <vector>
#include <cstring>

using namespace std;

int n, u, k, v, d[110], f[110], time=0;
bool vis[110];
vector<int> adj[110];

void dfs (int p)
{
    time++;
    vis[p]=true;
    d[p]=time;
    for (auto u : adj[p])
    {
        if (!vis[u]) dfs(u);
    }
    time++;
    f[p]=time;
}

int main()
{
    memset(vis, false, sizeof(vis));
    cin>>n;
    for (int i=0; i<n; i++)
    {
        cin>>u>>k;
        for (int j=0; j<k; j++)
        {
            cin>>v;
            adj[u].push_back(v);
        }
    }
    for (int i=1; i<=n; i++)
    {
        if (!vis[i]) dfs(i);
    }
    for (int i=1; i<=n; i++)
    {
        cout<<i<<' '<<d[i]<<' '<<f[i]<<'\n';
    }
    return 0;
}



Compiler output:
a.cc:7:33: error: 'int time' redeclared as different kind of entity
    7 | int n, u, k, v, d[110], f[110], time=0;
      |                                 ^~~~
In file included from /usr/include/pthread.h:23,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
                 from /usr/include/c++/14/ext/atomicity.h:35,
                 from /usr/include/c++/14/bits/ios_base.h:39,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
   76 | extern time_t time (time_t *__timer) __THROW;
      |               ^~~~
a.cc: In function 'void dfs(int)':
a.cc:13:5: warning: ISO C++ forbids incrementing a pointer of type 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} [-Wpointer-arith]
   13 |     time++;
      |     ^~~~
a.cc:13:9: error: lvalue required as increment operand
   13 |     time++;
      |         ^~
a.cc:15:10: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
   15 |     d[p]=time;
      |          ^~~~
      |          |
      |          time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:20:5: warning: ISO C++ forbids incrementing a pointer of type 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} [-Wpointer-arith]
   20 |     time++;
      |     ^~~~
a.cc:20:9: error: lvalue required as increment operand
   20 |     time++;
      |         ^~
a.cc:21:10: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
   21 |     f[p]=time;
      |          ^~~~
      |          |
      |          time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
Language: C++

#include <stdio.h>

int time, n;
int d[100], f[100], color[100];

void dfs_init(){
    for (int i=0; i<100; i++) color[i] = 0;
    dfs();
}

void dfs(int u) {
    color[u] = 1
    d[u] = ++time;
    for (int i=0; i<n; i++) {
        if(M[u][i] && color[i] == 0) {
            dfs(i);
        }
    }
    color[u] = 2;
    f[u] = ++time;
}

int main() {
    int u, k, v;
    scanf("%d", &n);
    
    int M[n][n];
    for (int i=0; i<n; i++) {
        for (int j=0; j<n; j++) {
            M[i][j] = 0;
        }
    }
    
    for (int i=0; i<n; i++) {
        scanf("%d %d", &u, &k);
        for (int j=0; j<k; j++) {
            scanf("%d", &v);
            M[u-1][v-1] = 1;
        }
    }
    
    dfs_init();
    
    for (int i=0; i<n; i++) {
        printf("%d %d %d\n", i, d[i], f[i]);
    }
    return 0;
}


Compiler output:
a.cc: In function 'void dfs_init()':
a.cc:8:5: error: 'dfs' was not declared in this scope
    8 |     dfs();
      |     ^~~
a.cc: In function 'void dfs(int)':
a.cc:12:17: error: expected ';' before 'd'
   12 |     color[u] = 1
      |                 ^
      |                 ;
   13 |     d[u] = ++time;
      |     ~            
a.cc:15:12: error: 'M' was not declared in this scope
   15 |         if(M[u][i] && color[i] == 0) {
      |            ^
Language: C++

#include <stdio.h>

int time, n;
int d[100], f[100], color[100];

void dfs(int u) {
    color[u] = 1
    d[u] = ++time;
    for (int i=0; i<n; i++) {
        if(M[u][i] && color[i] == 0) {
            dfs(i);
        }
    }
    color[u] = 2;
    f[u] = ++time;
}

void dfs_init(){
    for (int i=0; i<100; i++) color[i] = 0;
    dfs();
}

int main() {
    int u, k, v;
    scanf("%d", &n);
    
    int M[n][n];
    for (int i=0; i<n; i++) {
        for (int j=0; j<n; j++) {
            M[i][j] = 0;
        }
    }
    
    for (int i=0; i<n; i++) {
        scanf("%d %d", &u, &k);
        for (int j=0; j<k; j++) {
            scanf("%d", &v);
            M[u-1][v-1] = 1;
        }
    }
    
    dfs_init();
    
    for (int i=0; i<n; i++) {
        printf("%d %d %d\n", i, d[i], f[i]);
    }
    return 0;
}


Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:7:17: error: expected ';' before 'd'
    7 |     color[u] = 1
      |                 ^
      |                 ;
    8 |     d[u] = ++time;
      |     ~            
a.cc:10:12: error: 'M' was not declared in this scope
   10 |         if(M[u][i] && color[i] == 0) {
      |            ^
a.cc: In function 'void dfs_init()':
a.cc:20:8: error: too few arguments to function 'void dfs(int)'
   20 |     dfs();
      |     ~~~^~
a.cc:6:6: note: declared here
    6 | void dfs(int u) {
      |      ^~~
Language: C++

#include<iostream>
using namespace std;

int main(){
 int n,k,v,u;
  cin>>n;

  int V[100][100]; //隣接リスト
  int cnt[100];　//各点においてどこまでみたかの把握
  int d[100];
  int f[100];
  int time=1;
  int l=0;
  int come[100]; //その点はどこからきたかの把握

  //初期化
  for(int i=0;i<100;i++){
    for(int j=0;j<100;j++){
      V[i][j]=0;
      cnt[j]=0;
      d[j]=0;
      f[j]=0;
      come[j]=0;
    }
  }
  //グラフ情報の読み込み
 int  m=0;
  for(int i=0;i<n;i++){
    cin>>u;
    cin>>k;
    for(int j=0;j<k;j++){
      cin>>v;
      V[u-1][m]=v;
      m++;
    }
    m=0;
  }


  //スタートは0
 d[0]=1;
 time++;
  while(1){

    if(time==2*n+1) break;
    //先がありかつそこは探索終了していない
    if(V[l][cnt[l]]!=0 && f[V[l][cnt[l]]-1]==0){ 
     
      if(d[V[l][cnt[l]]-1]==0) d[V[l][cnt[l]]-1]=time;

   come[V[l][cnt[l]]-1]=l;
      cnt[l]++;
      l=V[l][cnt[l]-1]-1; 

      time++;
      //先がないまたはさきが探索終了している
    }else{

      if(d[l]==0) d[l]=time;
       f[l]=time;
      l=come[l];
      time++;

    }

  }
  /*
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
    cout<<V[i][j]<<" ";
    if(j==n-1) cout<<endl;
  }
  }
  */
  //出力
  for(int i=0;i<n;i++){

    cout<<i+1<<" "<<d[i]<<" "<<f[i]<<endl;
    }


  return 0;
}


Compiler output:
a.cc:9:16: error: extended character 　 is not valid in an identifier
    9 |   int cnt[100];　//各点においてどこまでみたかの把握
      |                ^
a.cc: In function 'int main()':
a.cc:9:16: error: '\U00003000' was not declared in this scope
    9 |   int cnt[100];　//各点においてどこまでみたかの把握
      |                ^~
a.cc:21:7: error: 'd' was not declared in this scope
   21 |       d[j]=0;
      |       ^
a.cc:41:2: error: 'd' was not declared in this scope
   41 |  d[0]=1;
      |  ^
Language: C++

#include <iostream>
using namespace std;
int cnt = 1;
void DepthFirstSearch(int now,int n,int a[][],int b[],int c[],int d[]){
  b[now]=1;
  c[now]=cnt;
  cnt++;
    for(int i=0;i<n;i++){
        if(a[now][i] && b[i]!=1){
            DepthFirstSearch(i,n,a,b,c,d);
            cnt++;
        }
    }
  d[now]=cnt;
}
int main(){
  int a[100][100],b[100],c[100],d[100]
  int n,u,m,num;
  cin>>n;
  for(int i = 0;i < n;i++){
    cin>>u>>m;
    for(int j = 0;j < m;j++){
      cin >> num;
      a[u-1][num-1]=1;
    }
  }
    for(int i=0;i<n;i++){
       if(b[i]!=1){
         DepthFirstSearch(i,n,a,b,c,d);
         cnt++;
       }
    }
  
    for(int i=0;i<n;i++){
        cout<< i+1 << " " << c[i] << " " << d[i]<<endl;
    }
  return 0;
  
}


Compiler output:
a.cc:4:41: error: declaration of 'a' as multidimensional array must have bounds for all dimensions except the first
    4 | void DepthFirstSearch(int now,int n,int a[][],int b[],int c[],int d[]){
      |                                         ^
a.cc:4:46: error: expected ')' before ',' token
    4 | void DepthFirstSearch(int now,int n,int a[][],int b[],int c[],int d[]){
      |                      ~                       ^
      |                                              )
a.cc:4:47: error: expected unqualified-id before 'int'
    4 | void DepthFirstSearch(int now,int n,int a[][],int b[],int c[],int d[]){
      |                                               ^~~
a.cc: In function 'int main()':
a.cc:18:3: error: expected initializer before 'int'
   18 |   int n,u,m,num;
      |   ^~~
a.cc:19:8: error: 'n' was not declared in this scope
   19 |   cin>>n;
      |        ^
a.cc:21:10: error: 'u' was not declared in this scope
   21 |     cin>>u>>m;
      |          ^
a.cc:21:13: error: 'm' was not declared in this scope
   21 |     cin>>u>>m;
      |             ^
a.cc:23:14: error: 'num' was not declared in this scope; did you mean 'enum'?
   23 |       cin >> num;
      |              ^~~
      |              enum
a.cc:29:37: error: 'd' was not declared in this scope
   29 |          DepthFirstSearch(i,n,a,b,c,d);
      |                                     ^
a.cc:35:45: error: 'd' was not declared in this scope
   35 |         cout<< i+1 << " " << c[i] << " " << d[i]<<endl;
      |                                             ^
Language: Java


import java.util.*;

public class ALDS1_11_C2 {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int V = stdIn.nextInt();
		boolean[][] judg = new boolean[V+1][V+1];
		for(int i=0;i<V+1;i++){
			Arrays.fill(judg[i], false);
		}
		for(int i=1;i<V+1;i++){
			int id = stdIn.nextInt();
			int count = stdIn.nextInt();
			for(int j=0;j<count;j++){
				int d = stdIn.nextInt();
				judg[id][d] = true;
			}
		}
		int[] d = new int[V+1];
		for(int i=1;i<V+1;i++){
			for(int j=1;j<V+1;j++){
				if(judg[i][j] && d[j]==0){
					d[j] = d[i] + 1;
				}
			}
		}
		
		for(int i=1;i<V+1;i++){
			System.out.println(i+" "+d[i]);
		}
		
	}
}

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

import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;
 
public class Main_breadth_first_search_Bellman_Ford {

  public static class edge {
    int from;
    int to;
    int cost;
    edge (int _from, int _to, int _cost) {
      from = _from;
      to   = _to;
      cost = _cost;
    }
  }

  static final int INF = Integer.MAX_VALUE;
  static int n;
  static int d[];
  static edge es[][];

  public static void shortest_path_BF(int s) {
    int i, j;
    Arrays.fill(d, INF);

    d[s] = 0;
    while (true) {
      boolean update = false;
      for (i=0; i<n; i++)
        for (j=0; j<es[i].length; j++) {
          edge e = es[i][j]; 
          if (d[e.from] != INF && d[e.to] > d[e.from] + e.cost) {
            d[e.to] = d[e.from] + e.cost;
            update = true;
          }
        }
      if (!update) break;
    }
  }

  public static void main(String[] args) {
    int i, j;

    Scanner sc = new Scanner(System.in);
    n = Integer.parseInt(sc.next());
    es = new edge[n][];
    d = new int[n];

    for (i=0; i<n; i++) {
      int u = Integer.parseInt(sc.next());
      int k = Integer.parseInt(sc.next());
      es[i] = new edge[k];
      for (j=0; j<k; j++) {
        int v = Integer.parseInt(sc.next());
        es[i][j] = new edge(u-1, v-1, 1);
      }
    }

    shortest_path_BF(0);

    for (i=0; i<n; i++) {
      int v = (d[i] != INF) ? d[i] : -1;
      System.out.print(String.valueOf(i+1) + ' ');
      System.out.print(String.valueOf(v) + '\n');
    }
  }
}

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

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

public class Main {
    static Map<Integer, int[]> map = new HashMap<Integer, int[]>();
    static Map<Integer, Boolean> visited = new HashMap<Integer, Boolean>();
    static List<Integer> que = new ArrayList<Integer>();
    static List<Integer> tmpQue = new ArrayList<Integer>();
	static int[] d;

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
		
		//set map
        for (int i = 0; i < n; i++){
            String[] s = br.readLine().split(" ");
            int u = Integer.parseInt(s[0]);
            int k = Integer.parseInt(s[1]);
            int[] a = new int[k];
            for (int j = 0; j < k; j++){
                a[j] = Integer.parseInt(s[j+2]);
            }
            map.put(u, a);
            visited.put(u, false);
        }

        d = new int[n + 1];
        for (int i = 0; i < n + 1; i++){
            d[i] = -1;
        }
        int v = 1;
        que.add(v);
        visited.put(1, true);
        int step = 0;
        d[v] = step;
        step++;
        
        while (que.size() > 0){
            v = que.remove(0);
			
            //add the next Vertices to the que
            try{
				if (map.get(v) == null){
					;
                }else{ (map.get(v) != null){
                    int[] nextArr = map.get(v);
                    for (int j = 0; j < nextArr.length; j++){
                        if (visited.get(nextArr[j])){
                            ;
                        }else{
                            tmpQue.add(nextArr[j]);
                            visited.put(nextArr[j], true);
                            d[nextArr[j]] = step;
                        }
                    }
                }
				// 
				if (que.size() == 0){
					step++;
					for (int i = 0; i < tmpQue.size(); i++){
						que.add(tmpQue.get(i));
					}
					tmpQue.clear();
				}
            }catch (NullPointerException e){
                e.printStackTrace();
            }
        }
        //show the result
        for (int i = 1; i < n + 1; i++){
            System.out.println(i + " " + d[i]);
        }
    }    
}

Compiler output:
Main.java:48: error: not a statement
                }else{ (map.get(v) != null){
                       ^
Main.java:48: error: ';' expected
                }else{ (map.get(v) != null){
                                           ^
Main.java:68: error: 'catch' without 'try'
            }catch (NullPointerException e){
             ^
Main.java:45: error: 'try' without 'catch', 'finally' or resource declarations
            try{
            ^
Main.java:77: error: reached end of file while parsing
}
 ^
5 errors
Language: C

#include<stdio.h>
#define WHITE 0    //non-visited
#define GRAY 1     //visited
#define BLACK 2    //finished
#define N 101

typedef struct{
  int id;
  int k;
  int v[N];
  int color;
}V;

//void DFS_Visit(int);

int n=0, head=0, tail=0;
int d[N],Q[N];
V S[N];

void BFS(int s){
  int i,u;
  for(i=1 ; i<=n ; i++) {
    color[i] = WHITE;
    d[i] = NIL;
  }
  S[s].color = GRAY;
  d[s] = 0;
  
  Enqueue(s);
  
  while(head != tail){
    i = Dequeue();
    for(u=1 ; u<=S[i].k ; u++){
      if(S[S[i].v[j]].color == WHITE){
	S[S[i].v[j]].color == GRAY;
	d[S[i].v[j]] = d[i]+1;
	Enqueue(S[S[i].v[j]);
		}
      }

Compiler output:
main.c: In function 'BFS':
main.c:23:5: error: 'color' undeclared (first use in this function)
   23 |     color[i] = WHITE;
      |     ^~~~~
main.c:23:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:24:12: error: 'NIL' undeclared (first use in this function)
   24 |     d[i] = NIL;
      |            ^~~
main.c:29:3: error: implicit declaration of function 'Enqueue' [-Wimplicit-function-declaration]
   29 |   Enqueue(s);
      |   ^~~~~~~
main.c:32:9: error: implicit declaration of function 'Dequeue' [-Wimplicit-function-declaration]
   32 |     i = Dequeue();
      |         ^~~~~~~
main.c:34:19: error: 'j' undeclared (first use in this function)
   34 |       if(S[S[i].v[j]].color == WHITE){
      |                   ^
main.c:37:28: error: expected ']' before ')' token
   37 |         Enqueue(S[S[i].v[j]);
      |                            ^
      |                            ]
main.c:39:7: error: expected declaration or statement at end of input
   39 |       }
      |       ^
main.c:39:7: error: expected declaration or statement at end of input
Language: C

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

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

int n,time,head,tail;
int *queue;
int *dist;
int *color;
int* matrix[MAX_N];

void enqueue(int);
int dequeue(void);
void bfs(void);

int main(){
  int i,j,u,k,v;

  scanf("%d",&n);

  queue = malloc(n * sizeof(int));
  color = malloc(n * sizeof(int));
  dist = malloc(n * sizeof(int));

  for(i = 0 ; i < n ; i++){
    matrix[i] = malloc(n * sizeof(int));
  }
 for(i = 0 ; i < n ; i++){
   dist[i] = -1;
 }
 for(i = 0 ; i < n ; i++){
   for(j = 0 ; j < n ; j++){
     matrix[i][j] = 0;
   }
 }

 for(i = 0 ; i < n ; i++){
    scanf("%d",&u); u--;
    scanf("%d",&k);
    for(j = 0 ; j < k ; j++){
      scanf("%d",&v); v--;
      matrix[u][v] = 1;
    }
  }

  bfs();
  for(i = 0 ; i < n ; i++){
    printf("%d %d\n",i+1,dist[i]);
  }

  for(i = 0 ; i < n ; i++){
    free(matrix[i]);
  }
  free(queue);
  free(dist);
  free(color);
  return 0;
}

void bfs(){
  int u,i;

  head = tail = 0;
  color[0] = GRAY;
  dist[0] = 0;
  enqueue(0);

  while(head != tail){
    u = dequeue();
    for(i = 0 ; i < n ; i++){
      if(matrix[u][i] == 1 && color[i] == WHITE){
        color[i] = GRAY;
        dist[i] = dist[u] + 1;
        enqueue(i);
      }
    }
    color[u] = BLACK;
  }
}

void enqueue(int q){
  queue[tail] = q;
  if(++tail == n+1){ tail = 0; cout<<'a'<<endl;}
}

int dequeue(){
  int v = queue[head];
  if(++head == n+1) head = 0;
  return v;
}

Compiler output:
main.c: In function 'enqueue':
main.c:86:32: error: 'cout' undeclared (first use in this function)
   86 |   if(++tail == n+1){ tail = 0; cout<<'a'<<endl;}
      |                                ^~~~
main.c:86:32: note: each undeclared identifier is reported only once for each function it appears in
main.c:86:43: error: 'endl' undeclared (first use in this function)
   86 |   if(++tail == n+1){ tail = 0; cout<<'a'<<endl;}
      |                                           ^~~~
Language: C

#include <stdio.h>
#include <stdlib.h>
 
#define WHITE 0
#define GRAY 1
#define BLACK 2
#define MAX_N 100
 
int n,time,head,tail;
int *queue;
int *dist;
int *color;
int **matrix;
 
void enqueue(int);
int dequeue(void);
void bfs(void);
 
int main(){
  int i,j,u,k,v;
 
  scanf("%d",&n);
 
  queue = malloc(n * sizeof(int));
  color = malloc(n * sizeof(int));
  dist = malloc(n * sizeof(int));
 
  matrix = malloc(n * sizeof(int *));
  for(i = 0 ; i < n ; i++){
    matrix[i] = malloc(n * sizeof(int));
 }
 for(i = 0 ; i < n ; i++){
   dist[i] = -1;
 }
 for(i = 0 ; i < n ; i++){
   for(j = 0 ; j < n ; j++){
     matrix[i][j] = 0;
   }
 }
 
 for(i = 0 ; i < n ; i++){
    scanf("%d",&u); u--;
    scanf("%d",&k);
    for(j = 0 ; j < k ; j++){
      scanf("%d",&v); v--;
      matrix[u][v] = 1;
    }
  }
 
  bfs();
  for(i = 0 ; i < n ; i++){
    printf("%d %d\n",i+1,dist[i]);
  }
 
  for(i = 0 ; i < n ; i++){
    free(matrix[i]);
  }
  free(matrix);
  free(queue);
  free(dist);
  free(color);
  return 0;
}
 
void bfs(){
  int u,i;
 
  head = tail = 0;
  color[0] = GRAY;
  dist[0] = 0;
  enqueue(0);
 
  while(head != tail){
    u = dequeue();
    for(i = 0 ; i < n ; i++){
      if(matrix[u][i] == 1 && color[i] == WHITE){
        color[i] = GRAY;
        dist[i] = dist[u] + 1;
        enqueue(i);
      }
    }
    color[u] = BLACK;
  }
}
 
void enqueue(int q){
  queue[tail] = q;
  if(++tail == n+1) tail = 0,cout<<'a'<<endl;
}
 
int dequeue(){
  int v = queue[head];
  if(++head == n+1) head = 0;
  return v;
}

Compiler output:
main.c: In function 'enqueue':
main.c:88:30: error: 'cout' undeclared (first use in this function)
   88 |   if(++tail == n+1) tail = 0,cout<<'a'<<endl;
      |                              ^~~~
main.c:88:30: note: each undeclared identifier is reported only once for each function it appears in
main.c:88:41: error: 'endl' undeclared (first use in this function)
   88 |   if(++tail == n+1) tail = 0,cout<<'a'<<endl;
      |                                         ^~~~
Language: C

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

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

char a[100][100]; //??£??\??????
int n;            //??????????????????
short d[100];     //??????1??????????????¢
char color[100];  //??¢?´¢??¶???
short q[100];     //?????\???
short h, t;       //?????\??????????????¨????°?


void init() {
  short i;

  for( i=0; i<n; i++ ) {
      d[i] = -1;
  }

  return;
}

void enqueue( short e ) {

  if( (t+1) % 100 != h ) {
    q[t] = e;
    t = (t + 1) % 100;
  }

  return;
}

short dequeue() {
  short r = SHRT_MIN;
  
  if( (h + 1) % 100 != t ) {
    r = q[h];
    h = (h + 1) % 100;
  }

  return r;
}


void bfs() {
  short i, u;

  for( i=1; i<n; i++) {
    color[u] = WHITE;
    d[u] = LONG_MAX;
  }
  color[0] = GRAY;
  d[0] = 0;

  enqueue( 0 );

  while( h != t ) { //?????\???????????§??????
  	u = dequeue;
    for( i=0; i<n; i++ ) {
    	if( color[i] == WHITE ) {
    		color[i] = GRAY;
    		d[i] = d[u] + 1;
    		enqueue( i );
    	}
    }
    color[u] = BLACK;
    
    return;
}




main() {

  int i, j;
  int u, k, v;

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

  
  for( i=0; i<n; i++ ) {
    scanf( "%d%d", &u, &k );
    
    for( j=0; j<k; j++ ) {
      scanf( "%d", &v );
      a[u-1][v-1] = 1;
    }
    
  }

  bfs();
  
  //print();
  
  return 0;

} 
  

Compiler output:
main.c: In function 'bfs':
main.c:54:12: warning: overflow in conversion from 'long int' to 'short int' changes value from '9223372036854775807' to '-1' [-Woverflow]
   54 |     d[u] = LONG_MAX;
      |            ^~~~~~~~
main.c:62:11: error: assignment to 'short int' from 'short int (*)()' makes integer from pointer without a cast [-Wint-conversion]
   62 |         u = dequeue;
      |           ^
main.c:78:1: error: implicit declaration of function 'main' [-Wimplicit-function-declaration]
   78 | main() {
      | ^~~~
main.c:78:7: error: expected ';' before '{' token
   78 | main() {
      |       ^~
      |       ;
main.c:104:1: error: expected declaration or statement at end of input
  104 | }
      | ^
Language: C

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

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

void enqueue(short);
short dequeue();
void bfs();

char a[100][100]; //??£??\??????
int n;            //??????????????????
short d[100];     //??????1??????????????¢
char color[100];  //??¢?´¢??¶???
short q[100];     //?????\???
short h, t;       //?????\??????????????¨????°?


void init() {
  short i;

  for( i=0; i<n; i++ ) {
      d[i] = -1;
  }

  return;
}

void enqueue( short e ) {

  if( (t+1) % 100 != h ) {
    q[t] = e;
    t = (t + 1) % 100;
  }

  return;
}

short dequeue() {
  short r = SHRT_MIN;
  
  if( (h + 1) % 100 != t ) {
    r = q[h];
    h = (h + 1) % 100;
  }

  return r;
}


void bfs() {
  short i, u, v;

  for( i=1; i<n; i++) {
    color[u] = WHITE;
    d[u] = LONG_MAX;
  }
  color[0] = GRAY;
  d[0] = 0;

  enqueue( 0 );

  while( h != t ) { //?????\???????????§??????
  	u = dequeue();
    for( i=0; i<n; i++ ) {
    	if( a[u][i] == 1 ) {
    		v = a[u][i];
    		if( color[ v ] == WHITE ) {
    			color[ v ] = GRAY;
    			d[v] = d[u] + 1;
    			enqueue( v );
    		}
    	}
    }
    color[u] = BLACK;
    
    return;
}


void print();
	short i;
	
	for( i=0; i<n; i++ ) {
		printf( "%d %d\n", i+1, d[i] );
	}
	return;
}


int main() {

  int i, j;
  int u, k, v;

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

  
  for( i=0; i<n; i++ ) {
    scanf( "%d%d", &u, &k );
    
    for( j=0; j<k; j++ ) {
      scanf( "%d", &v );
      a[u-1][v-1] = 1;
    }
    
  }

  bfs();
  
  print();
  
  return 0;

} 
  

Compiler output:
main.c: In function 'bfs':
main.c:58:12: warning: overflow in conversion from 'long int' to 'short int' changes value from '9223372036854775807' to '-1' [-Woverflow]
   58 |     d[u] = LONG_MAX;
      |            ^~~~~~~~
main.c:84:15: error: redeclaration of 'i' with no linkage
   84 |         short i;
      |               ^
main.c:54:9: note: previous declaration of 'i' with type 'short int'
   54 |   short i, u, v;
      |         ^
main.c: In function 'main':
main.c:115:3: error: implicit declaration of function 'print' [-Wimplicit-function-declaration]
  115 |   print();
      |   ^~~~~
main.c:83:6: note: previous declaration of 'print' with type 'void()'
   83 | void print();
      |      ^~~~~
main.c:115:3: error: incompatible implicit declaration of function 'print'
  115 |   print();
      |   ^~~~~
main.c:83:6: note: previous implicit declaration of 'print' with type 'void()'
   83 | void print();
      |      ^~~~~
Language: C

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

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

void enqueue(short);
short dequeue();
void bfs();

char a[100][100]; //??£??\??????
int n;            //??????????????????
short d[100];     //??????1??????????????¢
char color[100];  //??¢?´¢??¶???
short q[100];     //?????\???
short h, t;       //?????\??????????????¨????°?


void init() {
  short i;

  for( i=0; i<n; i++ ) {
      d[i] = -1;
  }

  return;
}

void enqueue( short e ) {

  if( (t+1) % 100 != h ) {
    q[t] = e;
    t = (t + 1) % 100;
  }

  return;
}

short dequeue() {
  short r = SHRT_MIN;
  
  if( (h + 1) % 100 != t ) {
    r = q[h];
    h = (h + 1) % 100;
  }

  return r;
}


void bfs() {
  short i, u, v;

  for( i=1; i<n; i++) {
    color[u] = WHITE;
    d[u] = LONG_MAX;
  }
  color[0] = GRAY;
  d[0] = 0;

  enqueue( 0 );

  while( h != t ) { //?????\???????????§??????
  	u = dequeue();
    for( i=0; i<n; i++ ) {
    	if( a[u][i] == 1 ) {
    		v = a[u][i];
    		if( color[ v ] == WHITE ) {
    			color[ v ] = GRAY;
    			d[v] = d[u] + 1;
    			enqueue( v );
    		}
    	}
    }
    color[u] = BLACK;
    
    return;
}


void printDist();
	short i;
	
	for( i=0; i<n; i++ ) {
		printf( "%d %d\n", i+1, d[i] );
	}
	return;
}


int main() {

  short i, j;
  int u, k, v;

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

  
  for( i=0; i<n; i++ ) {
    scanf( "%d%d", &u, &k );
    
    for( j=0; j<k; j++ ) {
      scanf( "%d", &v );
      a[u-1][v-1] = 1;
    }
    
  }

  bfs();
  
  printDist();
  
  return 0;

} 
  

Compiler output:
main.c: In function 'bfs':
main.c:58:12: warning: overflow in conversion from 'long int' to 'short int' changes value from '9223372036854775807' to '-1' [-Woverflow]
   58 |     d[u] = LONG_MAX;
      |            ^~~~~~~~
main.c:84:15: error: redeclaration of 'i' with no linkage
   84 |         short i;
      |               ^
main.c:54:9: note: previous declaration of 'i' with type 'short int'
   54 |   short i, u, v;
      |         ^
main.c: In function 'main':
main.c:115:3: error: implicit declaration of function 'printDist' [-Wimplicit-function-declaration]
  115 |   printDist();
      |   ^~~~~~~~~
main.c:83:6: note: previous declaration of 'printDist' with type 'void()'
   83 | void printDist();
      |      ^~~~~~~~~
main.c:115:3: error: incompatible implicit declaration of function 'printDist'
  115 |   printDist();
      |   ^~~~~~~~~
main.c:83:6: note: previous implicit declaration of 'printDist' with type 'void()'
   83 | void printDist();
      |      ^~~~~~~~~
Language: C

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

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

char a[100][100]; //??£??\??????
int n;            //??????????????????
short d[100];     //??????1??????????????¢
char color[100];  //??¢?´¢??¶???
short q[100];     //?????\???
short h, t;       //?????\??????????????¨????°?


void init() {
  short i;

  for( i=0; i<n; i++ ) {
      d[i] = -1;
  }

  return;
}

void enqueue( short e ) {

  if( (t+1) % 100 != h ) {
    q[t] = e;
    t = (t + 1) % 100;
  }

  return;
}

short dequeue() {
  short r = SHRT_MIN;
  
  if( (h + 1) % 100 != t ) {
    r = q[h];
    h = (h + 1) % 100;
  }

  return r;
}


void bfs() {
  short i, u, v;

  for( i=1; i<n; i++) {
    color[u] = WHITE;
    d[u] = LONG_MAX;
  }
  color[0] = GRAY;
  d[0] = 0;

  enqueue( 0 );

  while( h != t ) { //?????\???????????§??????
  	u = dequeue();
    for( i=0; i<n; i++ ) {
    	if( a[u][i] == 1 ) {
    		v = a[u][i];
    		if( color[ v ] == WHITE ) {
    			color[ v ] = GRAY;
    			d[v] = d[u] + 1;
    			enqueue( v );
    		}
    	}
    }
    color[u] = BLACK;
    
    return;
}


void printDist();
	short i;
	
	for( i=0; i<n; i++ ) {
		printf( "%d %d\n", i+1, d[i] );
	}
	return;
}


int main() {

  short i, j;
  int u, k, v;

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

  
  for( i=0; i<n; i++ ) {
    scanf( "%d%d", &u, &k );
    
    for( j=0; j<k; j++ ) {
      scanf( "%d", &v );
      a[u-1][v-1] = 1;
    }
    
  }

  bfs();
  
  printDist();
  
  return 0;

} 
  

Compiler output:
main.c: In function 'bfs':
main.c:54:12: warning: overflow in conversion from 'long int' to 'short int' changes value from '9223372036854775807' to '-1' [-Woverflow]
   54 |     d[u] = LONG_MAX;
      |            ^~~~~~~~
main.c:80:15: error: redeclaration of 'i' with no linkage
   80 |         short i;
      |               ^
main.c:50:9: note: previous declaration of 'i' with type 'short int'
   50 |   short i, u, v;
      |         ^
main.c: In function 'main':
main.c:111:3: error: implicit declaration of function 'printDist' [-Wimplicit-function-declaration]
  111 |   printDist();
      |   ^~~~~~~~~
main.c:79:6: note: previous declaration of 'printDist' with type 'void()'
   79 | void printDist();
      |      ^~~~~~~~~
main.c:111:3: error: incompatible implicit declaration of function 'printDist'
  111 |   printDist();
      |   ^~~~~~~~~
main.c:79:6: note: previous implicit declaration of 'printDist' with type 'void()'
   79 | void printDist();
      |      ^~~~~~~~~
Language: C

import java.util.*;

public class Main {
	
    public static void main(String[] args){
    	
        final Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        boolean[][] ju = new boolean[n+1][n+1];
        
        for(int i=0;i<n+1;i++){
            Arrays.fill(ju[i],false);
        }
        
        ArrayList<ArrayList<Integer>> gr = new ArrayList<ArrayList<Integer>>();
        
        for(int i=0;i<2;i++){
            gr.add(new ArrayList<Integer>());
        }
        
        for(int i=0;i<n;i++){
            int u = sc.nextInt();
            int k = sc.nextInt();
            for(int j=0;j<k;j++){
                int v = sc.nextInt();
                ju[u][v] = true;
            }
        }
         
        int[] d = new int[n+1];
        Arrays.fill(d,-1);
        d[1] = 0;
         
        for(int i=0;i<n;i++){
            for(int k=1;k<=n;k++){
                if(d[k]==i){
                    for(int j=1;j<=n;j++){
                        if(ju[k][j] && d[j]==-1){
                            d[j] = d[k] + 1;
                        }
                    }
                }
            }
        }
         
        for(int i=1;i<=n;i++){
            System.out.println(i+" "+d[i]);
        }
    }
}

Compiler output:
main.c:1:1: error: unknown type name 'import'
    1 | import java.util.*;
      | ^~~~~~
main.c:1:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    1 | import java.util.*;
      |            ^
main.c:3:1: error: unknown type name 'public'
    3 | public class Main {
      | ^~~~~~
main.c:3:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Main'
    3 | public class Main {
      |              ^~~~
Language: C

#include<stdio.h>
 
 
int g[101][101];
int Q1[101];
int Q2[101];
int n
 
void f(int x, int y){
  int i;
  Q1[x] = y;
  for(i = 1; i <= Q2[x]; i++)if(b + 1 < g[x][i]]) f(g[x][i], y + 1);

}
 
int main(){
  int i, j, m;
 
  scanf("%d", &n);
 
  for(i = 1; i <= n; i++){
    A[i] = 100000000;
    scanf("%d", &m);
    scanf("%d", &Q2[m]);
 
    for(j = 1; j <= Q2[m]; j++) scanf("%d", &g[m][j]);
  }
 
  f(1, 0);
 
  for(i = 1; i <= n; i++)if(Q1[i] == 9999999999) Q1[i] = -1;
  for(i = 1; i <= n; i++) printf("%d %d\n", i, Q1[i]);
 
  return 0;
}

Compiler output:
main.c:7:6: error: expected ';' before 'void'
    7 | int n
      |      ^
      |      ;
    8 | 
    9 | void f(int x, int y){
      | ~~~~  
main.c: In function 'f':
main.c:12:33: error: 'b' undeclared (first use in this function)
   12 |   for(i = 1; i <= Q2[x]; i++)if(b + 1 < g[x][i]]) f(g[x][i], y + 1);
      |                                 ^
main.c:12:33: note: each undeclared identifier is reported only once for each function it appears in
main.c:12:48: error: expected ')' before ']' token
   12 |   for(i = 1; i <= Q2[x]; i++)if(b + 1 < g[x][i]]) f(g[x][i], y + 1);
      |                                ~               ^
      |                                                )
main.c:12:48: error: expected statement before ']' token
main.c:12:49: error: expected statement before ')' token
   12 |   for(i = 1; i <= Q2[x]; i++)if(b + 1 < g[x][i]]) f(g[x][i], y + 1);
      |                                                 ^
main.c: In function 'main':
main.c:19:16: error: 'n' undeclared (first use in this function)
   19 |   scanf("%d", &n);
      |                ^
main.c:22:5: error: 'A' undeclared (first use in this function)
   22 |     A[i] = 100000000;
      |     ^
Language: C

#include<stdio.h>
 
 
int g[101][101];
int Q1[101];
int Q2[101];
int n
 
void f(int x, int y){
  int i;
  Q1[x] = y;
  for(i = 1; i <= Q2[x]; i++)if(b + 1 < g[x][i]]) f(g[x][i], y + 1);

}
 
int main(){
  int i, j, m;
 
  scanf("%d", &n);
 
  for(i = 1; i <= n; i++){
    Q1[i] = 100000000;
    scanf("%d", &m);
    scanf("%d", &Q2[m]);
 
    for(j = 1; j <= Q2[m]; j++) scanf("%d", &g[m][j]);
  }
 
  f(1, 0);
 
  for(i = 1; i <= n; i++)if(Q1[i] == 9999999999) Q1[i] = -1;
  for(i = 1; i <= n; i++) printf("%d %d\n", i, Q1[i]);
 
  return 0;
}

Compiler output:
main.c:7:6: error: expected ';' before 'void'
    7 | int n
      |      ^
      |      ;
    8 | 
    9 | void f(int x, int y){
      | ~~~~  
main.c: In function 'f':
main.c:12:33: error: 'b' undeclared (first use in this function)
   12 |   for(i = 1; i <= Q2[x]; i++)if(b + 1 < g[x][i]]) f(g[x][i], y + 1);
      |                                 ^
main.c:12:33: note: each undeclared identifier is reported only once for each function it appears in
main.c:12:48: error: expected ')' before ']' token
   12 |   for(i = 1; i <= Q2[x]; i++)if(b + 1 < g[x][i]]) f(g[x][i], y + 1);
      |                                ~               ^
      |                                                )
main.c:12:48: error: expected statement before ']' token
main.c:12:49: error: expected statement before ')' token
   12 |   for(i = 1; i <= Q2[x]; i++)if(b + 1 < g[x][i]]) f(g[x][i], y + 1);
      |                                                 ^
main.c: In function 'main':
main.c:19:16: error: 'n' undeclared (first use in this function)
   19 |   scanf("%d", &n);
      |                ^
Language: C

#include<stdio.h>
 
 
int g[101][101];
int Q1[101];
int Q2[101];
int n
 
void f(int x, int y){
  int i;
  Q1[x] = y;
  for(i = 1; i <= Q2[x]; i++)if(y + 1 < g[x][i]]) f(g[x][i], y + 1);

}
 
int main(){
  int i, j, m;
 
  scanf("%d", &n);
 
  for(i = 1; i <= n; i++){
    Q1[i] = 100000000;
    scanf("%d", &m);
    scanf("%d", &Q2[m]);
 
    for(j = 1; j <= Q2[m]; j++) scanf("%d", &g[m][j]);
  }
 
  f(1, 0);
 
  for(i = 1; i <= n; i++)if(Q1[i] == 9999999999) Q1[i] = -1;
  for(i = 1; i <= n; i++) printf("%d %d\n", i, Q1[i]);
 
  return 0;
}

Compiler output:
main.c:7:6: error: expected ';' before 'void'
    7 | int n
      |      ^
      |      ;
    8 | 
    9 | void f(int x, int y){
      | ~~~~  
main.c: In function 'f':
main.c:12:48: error: expected ')' before ']' token
   12 |   for(i = 1; i <= Q2[x]; i++)if(y + 1 < g[x][i]]) f(g[x][i], y + 1);
      |                                ~               ^
      |                                                )
main.c:12:48: error: expected statement before ']' token
main.c:12:49: error: expected statement before ')' token
   12 |   for(i = 1; i <= Q2[x]; i++)if(y + 1 < g[x][i]]) f(g[x][i], y + 1);
      |                                                 ^
main.c: In function 'main':
main.c:19:16: error: 'n' undeclared (first use in this function)
   19 |   scanf("%d", &n);
      |                ^
main.c:19:16: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
 
 
int g[101][101];
int Q1[101];
int Q2[101];
int n
 
void f(int x, int y){
  int i;
  Q1[x] = y;
  for(i = 1; i <= Q2[x]; i++)if(y + 1 < g[x][i]]) f(g[x][i], y + 1);

}
 
int main(){
  int i, j, m;
 
  scanf("%d", &n);
 
  for(i = 1; i <= n; i++){
    Q1[i] = 100000000;
    scanf("%d", &m);
    scanf("%d", &Q2[m]);
 
    for(j = 1; j <= Q2[m]; j++) scanf("%d", &g[m][j]);
  }
 
  f(1, 0);
 
  for(i = 1; i <= n; i++)if(Q1[i] == 100000000) Q1[i] = -1;
  for(i = 1; i <= n; i++) printf("%d %d\n", i, Q1[i]);
 
  return 0;
}

Compiler output:
main.c:7:6: error: expected ';' before 'void'
    7 | int n
      |      ^
      |      ;
    8 | 
    9 | void f(int x, int y){
      | ~~~~  
main.c: In function 'f':
main.c:12:48: error: expected ')' before ']' token
   12 |   for(i = 1; i <= Q2[x]; i++)if(y + 1 < g[x][i]]) f(g[x][i], y + 1);
      |                                ~               ^
      |                                                )
main.c:12:48: error: expected statement before ']' token
main.c:12:49: error: expected statement before ')' token
   12 |   for(i = 1; i <= Q2[x]; i++)if(y + 1 < g[x][i]]) f(g[x][i], y + 1);
      |                                                 ^
main.c: In function 'main':
main.c:19:16: error: 'n' undeclared (first use in this function)
   19 |   scanf("%d", &n);
      |                ^
main.c:19:16: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>

#define g -3
#define w -2
#define b -1


int temp[101];
int time;
int d[101];javascript:void(0)
int f[101];
int N;
int A[101][101];
int Q[101];


main (){

  int i,j,k,v,u;

  for(i=1;i<101;i++){
    for(j=1;j<101;j++){
      A[i][j] = 0;
    }
  }

  scanf("%d",&N);

  for(i=1;i<=N;i++){ 

    scanf("%d %d",&v,&k);
 
    for(j=1;j<=k;j++){
      scanf("%d",&u);
      A[v][u] = 1;
    }
  }

  BFS(1); //Breath first search

 for(i=1;i<=N;i++){
    printf("%d %d \n",i,d[i]);
  }

 return 0;
 }


void BFS(int s){
  int i,v;
  for(i=1;i<=N;i++){
    temp[i] = w;
    d[i] = 100000;
  }

  temp[s] = g;
  d[s] = 0;
  Q[s]=0;
  Enqueue(Q,s);

  while(Q[s]!=0){

    i =Deququq();

    for(v=1;v<=N;v++){

      if(A[s][v]==0){
	continue;
      }

      if(temp[v]==w){
	temp[v]=g;
	d[v] = d[s]+1;
	Enqueue(v);
      }
    }
    temp[s]=b;
  } 

}

Compiler output:
main.c:10:22: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token
   10 | int d[101];javascript:void(0)
      |                      ^
main.c:17:1: error: return type defaults to 'int' [-Wimplicit-int]
   17 | main (){
      | ^~~~
main.c: In function 'main':
main.c:39:3: error: implicit declaration of function 'BFS' [-Wimplicit-function-declaration]
   39 |   BFS(1); //Breath first search
      |   ^~~
main.c: At top level:
main.c:49:6: warning: conflicting types for 'BFS'; have 'void(int)'
   49 | void BFS(int s){
      |      ^~~
main.c:39:3: note: previous implicit declaration of 'BFS' with type 'void(int)'
   39 |   BFS(1); //Breath first search
      |   ^~~
main.c: In function 'BFS':
main.c:59:3: error: implicit declaration of function 'Enqueue' [-Wimplicit-function-declaration]
   59 |   Enqueue(Q,s);
      |   ^~~~~~~
main.c:63:8: error: implicit declaration of function 'Deququq' [-Wimplicit-function-declaration]
   63 |     i =Deququq();
      |        ^~~~~~~
Language: C

#define N 101
 
int G[N][N],way[N],chi[N],n;
 
void Fsearch(int x, int y){
  int i;
  way[x] = y;
  for(i = 1; i <= chi[x]; i++)
    if(y + 1 < way[G[x][i]]) find(G[x][i], y + 1);
}
 
int main(){
  int i,j,m;
 
  scanf("%d",&n);
 
  for(i=1;i<=n;i++){
    way[i]=N;
    scanf("%d",&m);
    scanf("%d",&chi[m]);
 
    for(j=1;j<=chi[m];j++){
	 scanf("%d",&G[m][j]);
    }
  }
 
  Fsearch(1,0);
 
  for(i=1;i<=n;i++)
    if(way[i]==N)way[i]=-1;
 
  for(i=1;i<=n;i++) printf("%d %d\n",i,way[i]);
 
  return 0;
}

Compiler output:
main.c: In function 'Fsearch':
main.c:9:30: error: implicit declaration of function 'find' [-Wimplicit-function-declaration]
    9 |     if(y + 1 < way[G[x][i]]) find(G[x][i], y + 1);
      |                              ^~~~
main.c: In function 'main':
main.c:15:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   15 |   scanf("%d",&n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | #define N 101
main.c:15:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   15 |   scanf("%d",&n);
      |   ^~~~~
main.c:15:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:32:21: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   32 |   for(i=1;i<=n;i++) printf("%d %d\n",i,way[i]);
      |                     ^~~~~~
main.c:32:21: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:32:21: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:32:21: note: include '<stdio.h>' or provide a declaration of 'printf'