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

import java.util.Scanner;
public class Ex3_2 {
	
	
	
	public static void main(String args[]){
		
		Scanner stdin = new Scanner(System.in);
		
		int count=1;
		int[] fs,es,before;
		int[][] next;
		int n=stdin.nextInt();
		fs=new int[n+1];es=new int[n+1];before=new int[n+1];
		next=new int[n+1][];
		IntStack stack=new IntStack(n);
		
		
		fs[0]=es[0]=before[0]=-1;
		
		for(int i=1;i<=n;i++){
			stdin.nextInt();
			int size=stdin.nextInt();
			
			if(size==0) next[i]=null;
			else{
				next[i] =new int[size];
				for(int j=0;j<size;j++){
					next[i][j]=stdin.nextInt();
				}
			}
			fs[i]=es[i]=before[i]=0;
		}
		
		
		function(1,fs,es,next,count,stack);
		System.out.println(es[3]);
		print(fs,es);
		
		
		
	}
	
	public static boolean isEmp(int id,int[] a,int[] es){
		if(a==null) return true;
		for(int i=0;i<a.length;i++){
			if(es[a[i]]==0) return false;
		}
		return true;
	}
	
	public static void function(int id,int[] fs,int[] es,int[][] next,int count,IntStack stack){
		
		System.out.println(id);
		if(id==1&&isEmp(1,next[1],es)){
			es[1]=++count;
		}else{
			if(fs[id]==0) fs[id]=count;
			if(isEmp(id,next[id],es)){
				count++;
				es[id]=count;
				function(stack.pop(),fs,es,next,count,stack);
			}else{
				int piv=0;
				for(int i=0;i<next[id].length;i++){
					if(es[next[id][i]]==0){
						piv=i; 
						break;
					}
					
				}
				
				stack.push(id);
				count++;
				function(next[id][piv],fs,es,next,count,stack);
				
				
			}
		}
	}
	
	public static void print(int[] fs,int[] es){
		for(int i=1;i<fs.length;i++){
			System.out.printf("%d %d %d\n",i,fs[i],es[i]);
		}
	}
}

Compiler output:
Main.java:2: error: class Ex3_2 is public, should be declared in a file named Ex3_2.java
public class Ex3_2 {
       ^
Main.java:52: error: cannot find symbol
	public static void function(int id,int[] fs,int[] es,int[][] next,int count,IntStack stack){
	                                                                            ^
  symbol:   class IntStack
  location: class Ex3_2
Main.java:16: error: cannot find symbol
		IntStack stack=new IntStack(n);
		^
  symbol:   class IntStack
  location: class Ex3_2
Main.java:16: error: cannot find symbol
		IntStack stack=new IntStack(n);
		                   ^
  symbol:   class IntStack
  location: class Ex3_2
4 errors
Language: Java

import java.util.Scanner;
public class Ex3_2 {
	
public class IntStack {
	private int max;
	private int ptr;
	private int[] stk;
	
	public class EmptyIntStackException extends RuntimeException{
		public EmptyIntStackException(){ }
	}
	public class OverflowIntStackException extends RuntimeException{
		public OverflowIntStackException(){ }
	}
	public IntStack(int capacity){
		ptr=0;
		max=capacity;
		try{
			stk=new int[max];
			
		}catch(OutOfMemoryError e){
			max=0;
		}
	}
	public int push(int x) throws OverflowIntStackException{
		if(ptr>=max){
			throw new OverflowIntStackException();
		}
		return stk[ptr++]=x;
	}
	
	public int pop() throws EmptyIntStackException{
		if(ptr<=0){
			throw new EmptyIntStackException();
		}
		return stk[--ptr];
	}
	
	public int peek() throws EmptyIntStackException{
		if(ptr<=0){
			throw new EmptyIntStackException();
		}
		return stk[ptr-1];
	}
	
	public int indexOf(int x){
		for(int i=ptr-1;i>=0;i--){
			if(stk[i]==x)
				return i;
			
		}
		return -1;
	}
	
	public void clear(){
		ptr=0;
	}
	
	public int capacity(){
		return max;
	}
	public int size(){
		return ptr;
	}
	
	public boolean isEmpty(){
		return ptr<=0;
	}
	
	public boolean isFull(){
		return ptr>=max;
	}
	
	public void dump(){
		if(ptr<=0)
			System.out.println("Stack is empty");
		else{
			for(int i=0;i<ptr;i++){
				System.out.print(stk[i]+" ");
			}
			System.out.println();
		}
		
	}
	


	
	
	public static void main(String args[]){
		
		Scanner stdin = new Scanner(System.in);
		
		int count=1;
		int[] fs,es,before;
		int[][] next;
		int n=stdin.nextInt();
		fs=new int[n+1];es=new int[n+1];before=new int[n+1];
		next=new int[n+1][];
		IntStack stack=new IntStack(n);
		
		
		fs[0]=es[0]=before[0]=-1;
		
		for(int i=1;i<=n;i++){
			stdin.nextInt();
			int size=stdin.nextInt();
			
			if(size==0) next[i]=null;
			else{
				next[i] =new int[size];
				for(int j=0;j<size;j++){
					next[i][j]=stdin.nextInt();
				}
			}
			fs[i]=es[i]=before[i]=0;
		}
		
		
		function(1,fs,es,next,count,stack);
		print(fs,es);
		
		
		
	}
	
	public static boolean isEmp(int id,int[] a,int[] es){
		if(a==null) return true;
		for(int i=0;i<a.length;i++){
			if(es[a[i]]==0) return false;
		}
		return true;
	}
	
	public static void function(int id,int[] fs,int[] es,int[][] next,int count,IntStack stack){
		
		
		if(id==1&&isEmp(1,next[1],es)){
			es[1]=++count;
		}else{
			if(fs[id]==0) fs[id]=count;
			if(isEmp(id,next[id],es)){
				count++;
				es[id]=count;
				function(stack.pop(),fs,es,next,count,stack);
			}else{
				int piv=0;
				for(int i=0;i<next[id].length;i++){
					if(es[next[id][i]]==0){
						piv=i; 
						break;
					}
					
				}
				
				stack.push(id);
				count++;
				function(next[id][piv],fs,es,next,count,stack);
				
				
			}
		}
	}
	
	public static void print(int[] fs,int[] es){
		for(int i=1;i<fs.length;i++){
			System.out.printf("%d %d %d\n",i,fs[i],es[i]);
		}
	}
}

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

import java.util.Scanner;


public class Ex3_2 {

public static class IntStack {
	private int max;
	private int ptr;
	private int[] stk;
	
	public class EmptyIntStackException extends RuntimeException{
		public EmptyIntStackException(){ }
	}
	public class OverflowIntStackException extends RuntimeException{
		public OverflowIntStackException(){ }
	}
	public IntStack(int capacity){
		ptr=0;
		max=capacity;
		try{
			stk=new int[max];
			
		}catch(OutOfMemoryError e){
			max=0;
		}
	}
	public int push(int x) throws OverflowIntStackException{
		if(ptr>=max){
			throw new OverflowIntStackException();
		}
		return stk[ptr++]=x;
	}
	
	public int pop() throws EmptyIntStackException{
		if(ptr<=0){
			throw new EmptyIntStackException();
		}
		return stk[--ptr];
	}
	
	public int peek() throws EmptyIntStackException{
		if(ptr<=0){
			throw new EmptyIntStackException();
		}
		return stk[ptr-1];
	}
	
	public int indexOf(int x){
		for(int i=ptr-1;i>=0;i--){
			if(stk[i]==x)
				return i;
			
		}
		return -1;
	}
	
	public void clear(){
		ptr=0;
	}
	
	public int capacity(){
		return max;
	}
	public int size(){
		return ptr;
	}
	
	public boolean isEmpty(){
		return ptr<=0;
	}
	
	public boolean isFull(){
		return ptr>=max;
	}
	
	public void dump(){
		if(ptr<=0)
			System.out.println("Stack is empty");
		else{
			for(int i=0;i<ptr;i++){
				System.out.print(stk[i]+" ");
			}
			System.out.println();
		}
		
	}
	
}
	
	
	public static void main(String args[]){
		
		Scanner stdin = new Scanner(System.in);
		
		int count=1;
		int[] fs,es,before;
		int[][] next;
		int n=stdin.nextInt();
		fs=new int[n+1];es=new int[n+1];before=new int[n+1];
		next=new int[n+1][];
		IntStack stack=new IntStack(n);
		
		
		fs[0]=es[0]=before[0]=-1;
		
		for(int i=1;i<=n;i++){
			stdin.nextInt();
			int size=stdin.nextInt();
			
			if(size==0) next[i]=null;
			else{
				next[i] =new int[size];
				for(int j=0;j<size;j++){
					next[i][j]=stdin.nextInt();
				}
			}
			fs[i]=es[i]=before[i]=0;
		}
		
		
		function(1,fs,es,next,count,stack);
		
		print(fs,es);
		
		
		
	}
	
	public static boolean isEmp(int id,int[] a,int[] es){
		if(a==null) return true;
		for(int i=0;i<a.length;i++){
			if(es[a[i]]==0) return false;
		}
		return true;
	}
	
	public static void function(int id,int[] fs,int[] es,int[][] next,int count,IntStack stack){
		
		
		if(id==1&&isEmp(1,next[1],es)){
			es[1]=++count;
		}else{
			if(fs[id]==0) fs[id]=count;
			if(isEmp(id,next[id],es)){
				count++;
				es[id]=count;
				function(stack.pop(),fs,es,next,count,stack);
			}else{
				int piv=0;
				for(int i=0;i<next[id].length;i++){
					if(es[next[id][i]]==0){
						piv=i; 
						break;
					}
					
				}
				
				stack.push(id);
				count++;
				function(next[id][piv],fs,es,next,count,stack);
				
				
			}
		}
	}
	
	public static void print(int[] fs,int[] es){
		for(int i=1;i<fs.length;i++){
			System.out.printf("%d %d %d\n",i,fs[i],es[i]);
		}
	}
}

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

#include <stdio.h>
#define WHITE 0
#define GRAY 1
#define BLACK 2
#define N 100
#define INF 10000000000
int n,M[N][N],Q[N];
int color[N],d[N],f[N],tt;
int num.head,tail;
void Enqueue;
int Empty();
int Dequeue();
void dfs_b(int u){
        int i,j,v;
        color[u]=GRAY;
        d[u]= ++tt;
        for(v=0; v<n; v++) {
                if(M[u][v]==0) {
                        continue;
                }
                if(color[v]==WHITE) {
                        dfs_b(v);
                }
        }
        color[u]=BLACK;
        f[u]=++tt;
}
void dfs_a(){
        int u;
        for(u=0; u<n; u++) {
                color[u]=WHITE;
        }
        tt=0;
        for(u=0; u<n; u++) {
                if(color[u]==WHITE) {
                        dfs_b(u);
                }
        }
        for(u=0;u<n;u++){
          printf("%d %d %d\n",u+1,d[u],f[u]);
        }

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


        scanf("%d",&n);
        for(i=0; i<n; i++) {
                for(j=0; j<n; j++) {
                        M[i][j]=0;
                }
        }
        for(i=0; i<n; i++) {
                scanf("%d%d",&u,&k);
                u--;
                for(j=0; j<k; j++) {
                        scanf("%d",&v);
                        v--;
                        M[u][v]=1;
                }
        }
        dfs_a();
        // for(i=0; i<n; i++) {
        //         for( j=0; j<n; j++) {
        //                 printf("%d",M[i][j]);
        //                 if(j==n-1)
        //                         printf("\n");
        //                 else
        //                         printf(" ");
        //         }
        //
        // }
        return 0;
}



Compiler output:
main.c:9:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    9 | int num.head,tail;
      |        ^
Language: C

#include<stdio.h>
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n,M[N][N];
int color[N],d[N],f[N],tt;

void dfs_visit(int u){
  int v;
  color[u] = GRAY;
  d[u] = ++tt;
  for(v=0;v<n;v++){
    if(M[u][v] == 0) continue;
    if(color[v] == WHITE){
      dfs_visit(v);
    }
  }
  color[u] = BLACK;
  f[u] = ++tt;
}

void dfs(){
  int u;

  for(u = 0; u < n; u++) color[u] = WHITE;
  tt = 0;

  for(u = 0; u < n; u++){
    if(color[u] == WHITE) dfs_visit(u);
  }
  for(u = 0; u < n; u++){
    printf("%d%d%d\n",u+1;d[u],f[u]);
  }
}

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

  scanf("%d",&n);
  for(i = 0; i<n; i++){
    for(j = 0; j<n;j++) M[i][j] = 0;
  }

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

  return 0;
}



Compiler output:
main.c: In function 'dfs':
main.c:34:26: error: expected ')' before ';' token
   34 |     printf("%d%d%d\n",u+1;d[u],f[u]);
      |           ~              ^
      |                          )
Language: C

nclude <stdio.h>

int u[101] = {0};
int d[101] = {0};
int f[101] = {0};
int next[101][101] = {0};

int cost = 1;

int top = 0;
int s[101];
 
void push(int x) {
  top++;
  s[top] = x;
}
 
int pop() {
  top--;
  return s[top + 1];
}

int next_look(int r) {
  int i = 0;
  int rr;
  for (i = 0; i < 101; i++) {
    if ((next[r][i] != 0) && (d[next[r][i]] == 0)) {
      return next[r][i];
    }
  }
  pop();
  f[r] = cost++;
  return 0;
}

void depth_first_search(int v) {
  int rr = v;
  int ll;
  push(rr);
  d[rr] = cost++;
    while (top >= 1) {
      ll = next_look(rr);
      if (ll == 0) {
	rr = s[top];
      }
      else {
	d[ll] = cost++;
	push(ll);
	rr = ll;
      }
    }
}

int main(void) {
  int n;
  int k;
  //int rr;
  //int ll;
  
  scanf("%d", &n);
  
  for (int i = 1; i <= n; i++) {
    scanf("%d", &u[i]);
    scanf("%d", &k);
    for (int j = 0; j < k; j++) {
      scanf("%d", &next[u[i]][j]);
    }
  }

  for (int i = 1; i <= n; i++) {
    if (f[i] == 0)
      depth_first_search(i);
  }

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

  return 0;
}


Compiler output:
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | nclude <stdio.h>
      |        ^
main.c: In function 'main':
main.c:60:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   60 |   scanf("%d", &n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | nclude <stdio.h>
main.c:60:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   60 |   scanf("%d", &n);
      |   ^~~~~
main.c:60:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:63:18: error: 'u' undeclared (first use in this function)
   63 |     scanf("%d", &u[i]);
      |                  ^
main.c:63:18: note: each undeclared identifier is reported only once for each function it appears in
main.c:76:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   76 |     printf("%d %d %d\n", u[i], d[i], f[i]);
      |     ^~~~~~
main.c:76:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:76:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:76:5: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

#include<stdio.h>
#define GRAY 2
#define N 101
 
int color[N],d[N],f[N],e[N],count,A[N][N],v[N],B[N][N];

void DFE=Visit(int);
void DFS(int);

main(){
  int n,i,j,v1;

  for(i=0;i<N;i++){ //行列を０で初期化
    for(j=0;j<N;j++){
      A[i][j]=0;
    }
  }
 
  scanf("%d",&n);
   
  for(i=1;i<=n;i++){
    scanf("%d%d",&v[i],&e[i]);
    for(j=1;j<=e[i];j++){
      scanf("%d",&v1);
      B[i][j]=v1; //Bのi行j列に値を容れる
      A[i][v1]=1; //Aにフラグを建てる
    }
  }
  DFS(n);
 
  return 0;
}


void DFS(int n){
  int i,u;
   
  for(i=1;i<=n;i++){ //実質的にcolorを０に初期化
    u=v[i];
    color[u]=0;
  }

    count=0;
   
  for(i=1;i<=n;i++){ //実質的にi回DFEを呼び出し、かつプリント
    u=v[i];
    if(color[u]==0)DFE_Visit(u);
    printf("%d %d %d\n",u,d[u],f[u]);
  }
}


void DFE_Visit(int u){
  int v,i;
   
  color[u]=GRAY; //未確定で初期化
  d[u]=++count;
 
  for(i=1;i<=e[u];i++){ //Bの値を順番に呼び出して再帰することによってd[u]の値を決定する
    v=B[u][i];
    if(color[v]==0)DFE_Visit(v);
  }
  color[u]=1;
  f[u]=++time; //再帰の特徴から、逆順に入る
}
 

Compiler output:
main.c:7:1: error: variable 'DFE' has initializer but incomplete type
    7 | void DFE=Visit(int);
      | ^~~~
main.c:7:10: error: implicit declaration of function 'Visit' [-Wimplicit-function-declaration]
    7 | void DFE=Visit(int);
      |          ^~~~~
main.c:7:16: error: expected expression before 'int'
    7 | void DFE=Visit(int);
      |                ^~~
main.c:10:1: error: return type defaults to 'int' [-Wimplicit-int]
   10 | main(){
      | ^~~~
main.c: In function 'DFS':
main.c:47:20: error: implicit declaration of function 'DFE_Visit' [-Wimplicit-function-declaration]
   47 |     if(color[u]==0)DFE_Visit(u);
      |                    ^~~~~~~~~
main.c: At top level:
main.c:53:6: warning: conflicting types for 'DFE_Visit'; have 'void(int)'
   53 | void DFE_Visit(int u){
      |      ^~~~~~~~~
main.c:47:20: note: previous implicit declaration of 'DFE_Visit' with type 'void(int)'
   47 |     if(color[u]==0)DFE_Visit(u);
      |                    ^~~~~~~~~
main.c: In function 'DFE_Visit':
main.c:64:10: error: 'time' undeclared (first use in this function)
   64 |   f[u]=++time; //再帰の特徴から、逆順に入る
      |          ^~~~
main.c:2:1: note: 'time' is defined in header '<time.h>'; this is probably fixable by adding '#include <time.h>'
    1 | #include<stdio.h>
  +++ |+#include <time.h>
    2 | #define GRAY 2
main.c:64:10: note: each undeclared identifier is reported only once for each function it appears in
   64 |   f[u]=++time; //再帰の特徴から、逆順に入る
      |          ^~~~
Language: C

#include<stdio.h>
#define GRAY 2
#define N 101
 
int color[N],d[N],f[N],e[N],count,A[N][N],v[N],B[N][N];

void DFE_Visit(int);
void DFS(int);

main(){
  int n,i,j,v1;

  for(i=0;i<N;i++){ //行列を０で初期化
    for(j=0;j<N;j++){
      A[i][j]=0;
    }
  }
 
  scanf("%d",&n);
   
  for(i=1;i<=n;i++){
    scanf("%d%d",&v[i],&e[i]);
    for(j=1;j<=e[i];j++){
      scanf("%d",&v1);
      B[i][j]=v1; //Bのi行j列に値を容れる
      A[i][v1]=1; //Aにフラグを建てる
    }
  }
  DFS(n);
 
  return 0;
}


void DFS(int n){
  int i,u;
   
  for(i=1;i<=n;i++){ //実質的にcolorを０に初期化
    u=v[i];
    color[u]=0;
  }

    count=0;
   
  for(i=1;i<=n;i++){ //実質的にi回DFEを呼び出し、かつプリント
    u=v[i];
    if(color[u]==0)DFE_Visit(u);
    printf("%d %d %d\n",u,d[u],f[u]);
  }
}


void DFE_Visit(int u){
  int v,i;
   
  color[u]=GRAY; //未確定で初期化
  d[u]=++count;
 
  for(i=1;i<=e[u];i++){ //Bの値を順番に呼び出して再帰することによってd[u]の値を決定する
    v=B[u][i];
    if(color[v]==0)DFE_Visit(v);
  }
  color[u]=1;
  f[u]=++time; //再帰の特徴から、逆順に入る
}
 

Compiler output:
main.c:10:1: error: return type defaults to 'int' [-Wimplicit-int]
   10 | main(){
      | ^~~~
main.c: In function 'DFE_Visit':
main.c:64:10: error: 'time' undeclared (first use in this function)
   64 |   f[u]=++time; //再帰の特徴から、逆順に入る
      |          ^~~~
main.c:2:1: note: 'time' is defined in header '<time.h>'; this is probably fixable by adding '#include <time.h>'
    1 | #include<stdio.h>
  +++ |+#include <time.h>
    2 | #define GRAY 2
main.c:64:10: note: each undeclared identifier is reported only once for each function it appears in
   64 |   f[u]=++time; //再帰の特徴から、逆順に入る
      |          ^~~~
Language: C

#include<stdio.h>

int V[150][150],d[150],f[150],color[150];
int time, n;

void DFSVisit(int u){
  int v;

  color[u] = 1;
  time++;
  d[u] = time;

  for(v = 1; v <= n; v++){
    if(V[u][v] == 1 && color[v] == 0){
      DFSVisit(v);
    }
  }
  color[u] = 2;
  time++;
  f[u] = time;
}

void DFS(){
  int i;

  time = 0;
  for(u = 1; u <= n; u++){
    if(color[u] == 0){
      DFSVisit(u);
    }
  }
}

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

  scanf("%d",&n);

  for(i = 1; i <= n; i++){
    scanf("%d%d",&v,&m);
    for(j = 1; j <= m; j++){
      scanf("%d",&k);
      V[v][k] = 1;
    }
  }

  DFS();

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

  return 0;
}

Compiler output:
main.c: In function 'DFS':
main.c:27:7: error: 'u' undeclared (first use in this function)
   27 |   for(u = 1; u <= n; u++){
      |       ^
main.c:27:7: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
#define M 150
int u[M][M],s[M],t,l=1,dps,flag[M];
int tim=-1,where[M];
int visit[M];


int end(int n){
  int a=1,i;

  for(i=1;i<=n;i++){
    if(visit[i]==0){
      visit[i]=1;
      return i;
    }
  }

  return 0;
} 



void push(int a){
  s[t++]=a;
  visit[a]=1;
}
int pop(){
  return s[t--];
}



int main(){
  int a,b,c,d,i,j,k,n,ans[M];

  scanf("%d",&n);

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


 



  i=1;
  j=1;
  push(i);
  ans[i][0]=tim;


  while(t>0){

    if(u[s[t-1]][j]==1&&visit[j]==0){
      push(j);
      where[s[t-2]]=j;
      if(flag[j]==0)flag[j]==1;
      j=1;
    }


    j++;


    if(j>n){
 
      pop();
      j=where[s[t-1]];
      while(l>0){
	l=end(n);
      } 
     
    }
  
  
  }











  flag[1]=1;
  ans[1]=0;
  for(i=1;i<=n;i++){

    for(j=1;j<=n;j++){

      if(u[i][j]==1&&flag[i]==1){
	flag[j]=1;
	if(ans[j]<0||ans[j]>ans[i]+1||i==1)ans[j]=ans[i]+1;


      }



    }
  }

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

  }


  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:55:9: error: subscripted value is neither array nor pointer nor vector
   55 |   ans[i][0]=tim;
      |         ^
Language: C

#include <stdio.h>

typedef struct ver{
  int e[101];
  int se;
  int color;
} ver;
   
int n,u;
int time;
int a[101];
int b[101];
ver c[101];
 
void visit(int u){

  int v,w;

  c[u].color=1;
  a[u] = ++time;

  for(v=1;v<=g[u].se;v++){
    w=c[u].e[v];
    if(g[w].color == 0){
      visit(w);
    }

  }

  c[u].color = 2;
  b[u] = ++time;

}
 
void dfs(){

  int u;

  for(u=1;u<=n;u++){
    c[u].color = 0;
  }

  time = 0;

  for(u=1;u<=n;u++){
    if(c[u].color==0){
      visit(u);
    }

  }
}
 
 
 
 
int main(){

  int i,j,k,v;
 
  scanf("%d",&n);
xsxs
  for(i=1;i<=n;i++){
    scanf("%d",&u);
    scanf("%d",&k);
    g[u].se=k;
    for(j=1;j<=k;j++){
      scanf("%d",&v);
      c[u].e[j]=v;
    }
  }
 
  dfs();
 
  for(i=1;i<=n;i++){
    printf("%d %d %d\n",i,a[i],b[i]);
  }
   
  return 0;
}

Compiler output:
main.c: In function 'visit':
main.c:22:14: error: 'g' undeclared (first use in this function)
   22 |   for(v=1;v<=g[u].se;v++){
      |              ^
main.c:22:14: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'main':
main.c:61:1: error: 'xsxs' undeclared (first use in this function)
   61 | xsxs
      | ^~~~
main.c:61:5: error: expected ';' before 'for'
   61 | xsxs
      |     ^
      |     ;
   62 |   for(i=1;i<=n;i++){
      |   ~~~
Language: C

#include <stdio.h>

typedef struct ver{
  int e[101];
  int se;
  int color;
} ver;
   
int n,u;
int time;
int a[101];
int b[101];
ver c[101];
 
void visit(int u){

  int v,w;

  c[u].color=1;
  a[u] = ++time;

  for(v=1;v<=g[u].se;v++){
    w=c[u].e[v];
    if(c[w].color == 0){
      visit(w);
    }

  }

  c[u].color = 2;
  b[u] = ++time;

}
 
void dfs(){

  int u;

  for(u=1;u<=n;u++){
    c[u].color = 0;
  }

  time = 0;

  for(u=1;u<=n;u++){
    if(c[u].color==0){
      visit(u);
    }

  }
}
 
 
 
 
int main(){

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

  for(i=1;i<=n;i++){
    scanf("%d",&u);
    scanf("%d",&k);
    g[u].se=k;
    for(j=1;j<=k;j++){
      scanf("%d",&v);
      c[u].e[j]=v;
    }
  }
 
  dfs();
 
  for(i=1;i<=n;i++){
    printf("%d %d %d\n",i,a[i],b[i]);
  }
   
  return 0;
}

Compiler output:
main.c: In function 'visit':
main.c:22:14: error: 'g' undeclared (first use in this function)
   22 |   for(v=1;v<=g[u].se;v++){
      |              ^
main.c:22:14: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'main':
main.c:65:5: error: 'g' undeclared (first use in this function)
   65 |     g[u].se=k;
      |     ^
Language: C

#include <stdio.h>
#define N 101
#define WHITE -1
#define BLACK 1
#define GRAY 0
int color[N], n, G[N][N];
int d[N], f[N];
int time = 0;

void DFSvisit(int u){
  int i;
  color[u] = GRAY;
  d[u] = ++time;
  for(i = 1; i <= n; i++){
      if(G[u][i] == 1){
        if(color[i] == WHITE) DFSvisit(i);
      }
  }
  color[u] = BRACK;
  f[u] = ++time;
}
 
void DFS(void){
  int i, j;
  for(i = 1; i <= n; i++){
        color[i] = WHITE;
        time = 0;
  }
  for(i = 1; i <= n; i++){
        if(color[i] == WHITE) DFSvisit(i);
  }
}
 

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

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

    DFS();

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

Compiler output:
main.c: In function 'DFSvisit':
main.c:19:14: error: 'BRACK' undeclared (first use in this function); did you mean 'BLACK'?
   19 |   color[u] = BRACK;
      |              ^~~~~
      |              BLACK
main.c:19:14: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'main':
main.c:51:35: error: 'ans' undeclared (first use in this function)
   51 |         printf("%d %d %d\n", i+1, ans[i][0], ans[i][1]);
      |                                   ^~~
Language: C

#include<stdio.h>
#define MAX 101
#define WH 0
#define GR 1
#define BL 2
void DFSV(int);
void DFS(void);
int G[MAX][MA];
int D[MAX];
int F[MAX];
int color[MAX];
int n;
int time;
main(){
  int i, j, a, b, v;
  scanf("%d",&n);

  for(i = 1; i <= n; i++){
    for(j = 1; j <= n; j++){

      G[i][j] = 0;

    }
  }

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

    scanf("%d %d", &b, &a);

    for(j = 1; j <= a; j++){

      scanf("%d",&v);

      G[i][v] = 1;
    }
  }
 
  DFS();

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

return 0;

}




void DFS(void){
  int i;

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

    color[i] = WHITE;

  }

  time = 0;

 for( i = 1; i <= n; i++ ){
   if( color[i] == WH )
     DFSV(i);

  }

}

void DFSV(int x){
  int j;

  color[x] = GR;

  time++;
 
  D[x] = time;

  for(j = 1; j <= n ; j++){

    if(G[x][j] == 1 && color[j] == WH)
      DFSV(j);
  }
  color[x] = BL;
  F[x] = ++time;
}

Compiler output:
main.c:8:12: error: 'MA' undeclared here (not in a function); did you mean 'MAX'?
    8 | int G[MAX][MA];
      |            ^~
      |            MAX
main.c:14:1: error: return type defaults to 'int' [-Wimplicit-int]
   14 | main(){
      | ^~~~
main.c: In function 'DFS':
main.c:57:16: error: 'WHITE' undeclared (first use in this function)
   57 |     color[i] = WHITE;
      |                ^~~~~
main.c:57:16: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
#define MAX 101
#define WH 0
#define GR 1
#define BL 2
void DFSV(int);
void DFS(void);
int G[MAX][MAX];
int D[MAX];
int F[MAX];
int color[MAX];
int n;
int time;
main(){
  int i, j, a, b, v;
  scanf("%d",&n);

  for(i = 1; i <= n; i++){
    for(j = 1; j <= n; j++){

      G[i][j] = 0;

    }
  }

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

    scanf("%d %d", &b, &a);

    for(j = 1; j <= a; j++){

      scanf("%d",&v);

      G[i][v] = 1;
    }
  }
 
  DFS();

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

 return 0;

}




void DFS(void){
  int i;

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

    color[i] = WHITE;

  }

  time = 0;

 for( i = 1; i <= n; i++ ){
   if( color[i] == WH )
     DFSV(i);

  }

}

void DFSV(int x){
  int j;

  color[x] = GR;

  time++;
 
  D[x] = time;

  for(j = 1; j <= n ; j++){

    if(G[x][j] == 1 && color[j] == WH)
      DFSV(j);
  }
  color[x] = BL;
  F[x] = ++time;
}

Compiler output:
main.c:14:1: error: return type defaults to 'int' [-Wimplicit-int]
   14 | main(){
      | ^~~~
main.c: In function 'DFS':
main.c:57:16: error: 'WHITE' undeclared (first use in this function)
   57 |     color[i] = WHITE;
      |                ^~~~~
main.c:57:16: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <iostream>
#include <stdio.h>
using namespace std;
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n,M[N][N];
int color[N],d[N],f[N],tt;

void dfs_visit(int u) {
  int v;
  color[u] = GRAY;
  d[u] = ++tt;
  for (v = 0; v < n; v++){
    if (M[u][v] == 0) continue;
	if (color[v] == WHITE) {
	  dfs_visit(v);
	  }
	 }
  color[u] = BLACK;
  f[u] = ++tt;
  }
  
  void dfs() {
    int u;
	for (u = 0; u < n; u++) {
	  color[u] = WHITE;
	  }
	tt = 0;
	
	for (u = 0; u < n; u++) {
	if (color[u] == WHITE) {
	  dfs_visit(u);
	  }
	}
	  for (u = 0; u < n; u++){
	    printf("%d %d %d\n", u + 1, d[u],f[u]);
		}
   }
  
  int main(){
    int u,v,k,i,j;
	
	scanf("%d",&n);
	for ( i = 0; i < n; i++) {
	   for (j = 0; j < n; j++) {
	     M[i][j] = 0;
		 }
		}
    
	for (i = 0; i < n; i++) {
	  scanf("%d, %d", &u,&k);
	  u--;
	  for ( j = 0; j < k; j++) {
	    scanf("%d", &v);
		v--;
		M[u][v] = 1;
		}
	}
	
	dfs();

	return 0;
	}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include<stdio.h>
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK

int n, M[N][N]
  int color[N], d[N], f[N], tt;

void dfs_visit(int u)
{
  int v;
  color[u] = GRAY;
  d[u] = ++tt;
  for ( v = 0; v < n; v++ )
    {
      if(M[u][v] == 0 ) continue;
      if(color[v] == WHITE)
	{
	  dfs_visit(v);
	}
    }
  color[u] = BLACK;
  f[u] = ++tt;
}

void dfs()
{
  int u;
  for (u = 0; u < n; u++ )color[u] = WHITE;
  tt = 0;

  for(u = 0; u < n; u++)
    {
      if(color[u] == WHITE)dfs_visit(u);
    }
  for(u = 0; u < n; u++)
    {
      printf("%d %d %d\n", u + 1, d[u], f[u]);
    }
}

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

  scanf("%d", &n);
  for(i = 0; i < n; i++)
    {
      for(j = 0; j < n; j++)M[i][j] = 0;
    }

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

  dfs();

  return 0;
}

Compiler output:
main.c:8:3: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
    8 |   int color[N], d[N], f[N], tt;
      |   ^~~
main.c: In function 'dfs_visit':
main.c:13:3: error: 'color' undeclared (first use in this function)
   13 |   color[u] = GRAY;
      |   ^~~~~
main.c:13:3: note: each undeclared identifier is reported only once for each function it appears in
main.c:14:3: error: 'd' undeclared (first use in this function)
   14 |   d[u] = ++tt;
      |   ^
main.c:14:12: error: 'tt' undeclared (first use in this function)
   14 |   d[u] = ++tt;
      |            ^~
main.c:17:10: error: 'M' undeclared (first use in this function)
   17 |       if(M[u][v] == 0 ) continue;
      |          ^
main.c:23:19: error: expected expression before ';' token
   23 |   color[u] = BLACK;
      |                   ^
main.c:24:3: error: 'f' undeclared (first use in this function)
   24 |   f[u] = ++tt;
      |   ^
main.c: In function 'dfs':
main.c:30:27: error: 'color' undeclared (first use in this function)
   30 |   for (u = 0; u < n; u++ )color[u] = WHITE;
      |                           ^~~~~
main.c:31:3: error: 'tt' undeclared (first use in this function)
   31 |   tt = 0;
      |   ^~
main.c:39:35: error: 'd' undeclared (first use in this function)
   39 |       printf("%d %d %d\n", u + 1, d[u], f[u]);
      |                                   ^
main.c:39:41: error: 'f' undeclared (first use in this function)
   39 |       printf("%d %d %d\n", u + 1, d[u], f[u]);
      |                                         ^
main.c: In function 'main':
main.c:50:29: error: 'M' undeclared (first use in this function)
   50 |       for(j = 0; j < n; j++)M[i][j] = 0;
      |                             ^
Language: C

#include<stdio.h>
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK

int n, M[N][N];
int color[N], d[N], f[N], tt;

void dfs_visit(int u)
{
  int v;
  color[u] = GRAY;
  d[u] = ++tt;
  for ( v = 0; v < n; v++ )
    {
      if(M[u][v] == 0 ) continue;
      if(color[v] == WHITE)
	{
	  dfs_visit(v);
	}
    }
  color[u] = BLACK;
  f[u] = ++tt;
}

void dfs()
{
  int u;
  for (u = 0; u < n; u++ )color[u] = WHITE;
  tt = 0;

  for(u = 0; u < n; u++)
    {
      if(color[u] == WHITE)dfs_visit(u);
    }
  for(u = 0; u < n; u++)
    {
      printf("%d %d %d\n", u + 1, d[u], f[u]);
    }
}

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

  scanf("%d", &n);
  for(i = 0; i < n; i++)
    {
      for(j = 0; j < n; j++)M[i][j] = 0;
    }

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

  dfs();

  return 0;
}

Compiler output:
main.c: In function 'dfs_visit':
main.c:23:19: error: expected expression before ';' token
   23 |   color[u] = BLACK;
      |                   ^
Language: C

#include<stdio.h>
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK

int n, M[N][N];
int color[N], d[N], f[N], tt;

void dfs_visit(int u)
{
  int v;
  color[u] = GRAY;
  d[u] = ++tt;
  for ( v = 0; v < n; v++ )
    {
      if(M[u][v] == 0 ) continue;
      if(color[v] == WHITE);
	{
	  dfs_visit(v);
	}
    }
  color[u] = BLACK;
  f[u] = ++tt;
}

void dfs()
{
  int u;
  for (u = 0; u < n; u++ )color[u] = WHITE;
  tt = 0;

  for(u = 0; u < n; u++)
    {
      if(color[u] == WHITE)dfs_visit(u);
    }
  for(u = 0; u < n; u++)
    {
      printf("%d %d %d\n", u + 1, d[u], f[u]);
    }
}

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

  scanf("%d", &n);
  for(i = 0; i < n; i++)
    {
      for(j = 0; j < n; j++)M[i][j] = 0;
    }

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

  dfs();

  return 0;
}

Compiler output:
main.c: In function 'dfs_visit':
main.c:23:19: error: expected expression before ';' token
   23 |   color[u] = BLACK;
      |                   ^
Language: C

#include<stdio.h>
 
void visit(int);
int map[101][101];
int f[101],d[101],color[101],time,n;

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

int main()
{
  int i,j,v,v2,m;
 
  scanf("%d",&n);
  for(i=0;i<n;i++){
    color[i]=0;
    for(j=0;j<n;j++){
      map[i][j]=0;
    }
  }
  time=0;
  for(i=0;i<n;i++){
    scanf("%d%d",&v,&m);
    for(j=0;j<m;j++){
      scanf("%d",&vv);
      map[v-1][v2-1]=1;
    }
  }
  for(i=0;i<n;i++){
    if(color[i]==0)visit(i);
  }
  for(i=0;i<n;i++){
    printf("%d %d %d\n",i+1,d[i],f[i]);
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:38:19: error: 'vv' undeclared (first use in this function); did you mean 'v2'?
   38 |       scanf("%d",&vv);
      |                   ^~
      |                   v2
main.c:38:19: note: each undeclared identifier is reported only once for each function it appears in
Language: C

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



int n;
int A[N][N],d[N],f[N],color[N],t=0;
 void DFSvisit(int u){
  int v;

  color[u]=GRAY;
  t++;
  d[u] = t;

  for(v=1;v<=n;v++){
    if((A[u][v]==1)&&(color[v]==WHITE)) DFSvisit(v);
  }
  color[u] = BLACK;
  f[u] = ++t;
}


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

 
  scanf("%d",&n);

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

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

  for(i=1;i<=n;i++){
    color[i]=WHITE;
  }

  for(i=1;i<=n;i++){
    if(color[i]==WHITE){
      DFSvisit(i);
    }
  }

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

  return 0;
}

Compiler output:
main.c:8:7: error: 'N' undeclared here (not in a function)
    8 | int A[N][N],d[N],f[N],color[N],t=0;
      |       ^
main.c: In function 'main':
main.c:28:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   28 |   scanf("%d",&n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | #define WHITE 0
main.c:28:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   28 |   scanf("%d",&n);
      |   ^~~~~
main.c:28:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:55:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   55 |     printf("%d ",i);
      |     ^~~~~~
main.c:55:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:55:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:55:5: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

#include <stdio.h>

#define N 100
#define WHITE 0
#define GRSY 1
#define BLACK 2

int n, M[N][N];
int color[N], d[N], f[N], tt;

void dfs_visit(int u){
  int v;
  color[u] = Gray;
  d[u] = ++tt;

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

  color[u] = BLACK;
  f[u] = ++tt;
}

void dft(){
  int u;

  for(u=0 ; u<n ; u++) color = WHITE;
  tt = 0;

  for(u=0 ; u<n ; u++){
    if(color[u] == WHITE) dfs_visit(u);
  }
  for(u=0 ; u<n ; u++){
    print("%d %d %d\n", u+1, d[u], f[u]);
  }
}

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

  scanf("%d", &n);
  for(i=0 ; i<n ; i++){
    for(j=0 ; j<n ; j++) M[i][j] = 0;
  }

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

  dfs();

  return 0;
}

Compiler output:
main.c: In function 'dfs_visit':
main.c:13:14: error: 'Gray' undeclared (first use in this function)
   13 |   color[u] = Gray;
      |              ^~~~
main.c:13:14: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'dft':
main.c:30:30: error: assignment to expression with array type
   30 |   for(u=0 ; u<n ; u++) color = WHITE;
      |                              ^
main.c:37:5: error: implicit declaration of function 'print'; did you mean 'printf'? [-Wimplicit-function-declaration]
   37 |     print("%d %d %d\n", u+1, d[u], f[u]);
      |     ^~~~~
      |     printf
main.c: In function 'main':
main.c:59:3: error: implicit declaration of function 'dfs'; did you mean 'dft'? [-Wimplicit-function-declaration]
   59 |   dfs();
      |   ^~~
      |   dft
Language: C

#include<stdio.h>
#define WHITE 1
#define BLACK 0
#define GLAY 3
#define N 102
int g[N][N],d[N],f[N],color[N],k[N];
int time,u,v,n;
 
void DFSVisit(int u){
  int i;
  color[u] = GLAY;
  d[u] = ++time;
  for(i = 0;i < k[u];i++){
    if(color[g[u][i]] ==  WHITE){
      DFSVisit(g[u][i]);
       }
       }
  color[u] = BLACK;
  f[u] = ++time;
}
 
void DFS(){
  int i;
  for(i = 1;i <=n; i++){
    color[i] = WHITE;
  }
    time = 0;
  for(i = 0; i < n;i++){
    if(color[i] == WHITE){
        DFSVisit(i);
    }
  }
  }
 
int main(){
  int i,j,l;
  scanf("%d",&n);
 
  for(i = 0;i < n; i++){
    scanf("%d",&u);
    scanf("%d",&l);
    k[u] = l;
    for(j = 0;j < k[u];j++){
      scanf("%d",&v);
      g[u][j] = v;
    }
  }

Compiler output:
main.c: In function 'main':
main.c:47:3: error: expected declaration or statement at end of input
   47 |   }
      |   ^
Language: C

#include<stdio.h>
#define MAX 105
#define WHITE 0
#define GRAY 1
#define BLACK 2
void DFS(void);
void DFSVisit(int);
 
int G[MAX][MAX];
int d[MAX];
int f[MAX];
int color[MAX];
int n;
int t;
 

void DFSVisit(int u){
 
    int v;
 
    color[u] = GRAY;
    d[u] = ++t;
    for(v = 1; v <= n; v++){
        if(G[u][v] == 1 && color[v] == WHITE)
            DFSVisit(v);
    }
    color[u] = BLACK;
    f[u] = ++t;
}
void DFS(void){
 
    int u;
 
    for(u = 1; u <= n; u++){
        color[u] = WHITE;
    }
    time = 0;
    for(u = 1; u <= n; u++){
        if(color[u] == WHITE)
            DFSVisit(u);
    }
}
 
int main(){
 
    int i,j,u,k,ne;
 
    scanf("%d",&n);
    for(i = 1; i <= n; i++){
        for(j = 1; j <= n; j++){
            G[i][j] = 0;
        }
    }
    for(i = 1; i <= n;i++){
        scanf("%d",&u);
scanf("%d",&k);
        for(j = 1; j <= k; j++){
            scanf("%d",&ne);
            G[i][next] = 1;
        }
    }
    DFS();
    for(i = 1; i <= n; i++){
        printf("%d %d %d\n",i,d[i],f[i]);
    }
 
    return 0;
}
 

Compiler output:
main.c: In function 'DFS':
main.c:37:5: error: 'time' undeclared (first use in this function)
   37 |     time = 0;
      |     ^~~~
main.c:2:1: note: 'time' is defined in header '<time.h>'; this is probably fixable by adding '#include <time.h>'
    1 | #include<stdio.h>
  +++ |+#include <time.h>
    2 | #define MAX 105
main.c:37:5: note: each undeclared identifier is reported only once for each function it appears in
   37 |     time = 0;
      |     ^~~~
main.c: In function 'main':
main.c:59:18: error: 'next' undeclared (first use in this function); did you mean 'ne'?
   59 |             G[i][next] = 1;
      |                  ^~~~
      |                  ne
Language: C

#include<stdio.h>
#define MAX 105
#define WHITE 0
#define GRAY 1
#define BLACK 2
void DFS(void);
void DFSVisit(int);
 
int G[MAX][MAX];
int d[MAX];
int f[MAX];
int color[MAX];
int n;
int t;
 

void DFSVisit(int u){
 
    int v;
 
    color[u] = GRAY;
    d[u] = ++t;
    for(v = 1; v <= n; v++){
        if(G[u][v] == 1 && color[v] == WHITE)
            DFSVisit(v);
    }
    color[u] = BLACK;
    f[u] = ++t;
}
void DFS(void){
 
    int u;
 
    for(u = 1; u <= n; u++){
        color[u] = WHITE;
    }
    time = 0;
    for(u = 1; u <= n; u++){
        if(color[u] == WHITE)
            DFSVisit(u);
    }
}
 
int main(){
 
    int i,j,u,k,ne;
 
    scanf("%d",&n);
    for(i = 1; i <= n; i++){
        for(j = 1; j <= n; j++){
            G[i][j] = 0;
        }
    }
    for(i = 1; i <= n;i++){
        scanf("%d",&u);
scanf("%d",&k);
        for(j = 1; j <= k; j++){
            scanf("%d",&ne);
            G[i][ne] = 1;
        }
    }
    DFS();
    for(i = 1; i <= n; i++){
        printf("%d %d %d\n",i,d[i],f[i]);
    }
 
    return 0;
}
 

Compiler output:
main.c: In function 'DFS':
main.c:37:5: error: 'time' undeclared (first use in this function)
   37 |     time = 0;
      |     ^~~~
main.c:2:1: note: 'time' is defined in header '<time.h>'; this is probably fixable by adding '#include <time.h>'
    1 | #include<stdio.h>
  +++ |+#include <time.h>
    2 | #define MAX 105
main.c:37:5: note: each undeclared identifier is reported only once for each function it appears in
   37 |     time = 0;
      |     ^~~~
Language: C

#include <iostream>
#include <queue>
using namespace std;
 
void dfs(int cur);
int df[100][2]={};
bool dc[100]={};
bool adj[100][100]={};//初期化を忘れない
int n,u,v,k;
int t = 1;
queue<int> q;
 
int main(){
  cin >> n;
  for (int i=0; i<n; i++){
    cin >> u >> k;
    for (int j=0; j<k; j++){
      cin >> v;
      adj[u-1][v-1] = true;
    }
  }
   
  //探索は一回で終わるとは限らない　グラフは非連結の場合もある？
  for (int i=0; i<n; i++){
    if (dc[i] != true)
      dfs(i);
  }
   
   
  for (int i=0; i<n; i++)
    cout << i+1 << " " << df[i][0] << " " << df[i][1] << endl;
 
}
 
void dfs(int cur){
  dc[cur] = true;
  df[cur][0] = t;
  t += 1;
  for (int i=0; i<n; i++){
    if (adj[cur][i] && !dc[i]){
      dfs(i);
    }
  }
  df[cur][1] = t;
  t += 1;
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include<stdio.h>
void Serch(int);
typedef struct{
  int a,m,dis,fin,count,A[101];
} Graph;

int way = 1;
Graph B[101];

 int main(void){
  int n, m, i, j;
 
  scanf("%d", &n);
 
  for(i = 1; i <= n; i++){
    scanf("%d%d", &B[i].a, &B[i].m);
    B[i].count = B[i].dis = G[i].fin = 0;
 
    for(j = 0; j < B[i].m; j++) scanf("%d", &B[i].A[j]);
  }
 
  for(i = 1; i <= n; i++) Search(B[i].a);
 
  for(i = 1; i <= n; i++) printf("%d %d %d\n", B[i].a, B[i].dis, B[i].fin);
 
  return 0;
}
void Search(int x){
  int i;
 
  if(B[x].count == 0){
    B[x].count++;
    B[x].dis = way;
    way++;
  }
 
  for(i = 0; i < B[x].m; i++){
    if(B[B[x].A[i]].count == 0)Search(B[x].A[i]);
  }
 
  if(B[x].fin == 0){
    B[x].fin = way;
    way++;
  }
}

Compiler output:
main.c: In function 'main':
main.c:17:29: error: 'G' undeclared (first use in this function)
   17 |     B[i].count = B[i].dis = G[i].fin = 0;
      |                             ^
main.c:17:29: note: each undeclared identifier is reported only once for each function it appears in
main.c:22:27: error: implicit declaration of function 'Search'; did you mean 'Serch'? [-Wimplicit-function-declaration]
   22 |   for(i = 1; i <= n; i++) Search(B[i].a);
      |                           ^~~~~~
      |                           Serch
main.c: At top level:
main.c:28:6: warning: conflicting types for 'Search'; have 'void(int)'
   28 | void Search(int x){
      |      ^~~~~~
main.c:22:27: note: previous implicit declaration of 'Search' with type 'void(int)'
   22 |   for(i = 1; i <= n; i++) Search(B[i].a);
      |                           ^~~~~~
Language: C

#include<stdio.h>
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n,M[N][N];
int color[N],d[N],f[N],tt;
 
void dfs_visit(int);
void dfs();

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

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

  dfs();
 
  return 0;
}
 
void dfs_visit(int u){
  int v;
  color[u]=GRAY;
  d[u]=++t;
  for(v=0;v<n;v++){
 if(M[u][v]==0){ 
   continue;
 }
if(color[v]==WHITE){
  dfs_visit(v);
 }
}
color[u]=BLACK;
 f[u]=++tt;
}

void dfs(){
  int u;

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

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

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

Compiler output:
main.c: In function 'dfs_visit':
main.c:42:10: error: 't' undeclared (first use in this function)
   42 |   d[u]=++t;
      |          ^
main.c:42:10: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'dfs':
main.c:70:1: error: expected declaration or statement at end of input
   70 | }
      | ^
main.c:70:1: error: expected declaration or statement at end of input
Language: C

#include<stdio.h>
#define WHITE 0
#define GRAY 1
#define BLACK 2
void visit(int u){
  int v;
  c[u] = GRAY;
  d[u] =++tt;
  for(v=0;v<n;v++){
    if(M[u][v]==0)continue;
    if(c[v]==WHITE){
      visit(v);
    }
  }
  c[u]=BLACK;
  f[u]=++tt;
}

int main(){
  int M[200][200];
  int n,u,k,v,i,j;
  int c[200],d[200],f[100],tt;

  scanf("%d",&n);
  for(i = 0;i <n;i++){
    for(j=0;j<n;j++)M[i][j]=0;
  }

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

  for(i = 1;i <=n  ;i++){
    for(j = 0;j<n;j++){
      if(j)printf(" ");
      printf("%d",M[i][j]);
    }
    printf("\n");
  }
  for (u=0;u<n;u++)c[u] = WHITE;
  tt=0;

  for(u=0;u<n;u++)if(c[u]==WHITE)visit(u);
  for(u=0;u<n;u++)printf("%d %d %d\n",u + 1,d[u],f[u]);

  return 0;
}

Compiler output:
main.c: In function 'visit':
main.c:7:3: error: 'c' undeclared (first use in this function)
    7 |   c[u] = GRAY;
      |   ^
main.c:7:3: note: each undeclared identifier is reported only once for each function it appears in
main.c:8:3: error: 'd' undeclared (first use in this function)
    8 |   d[u] =++tt;
      |   ^
main.c:8:11: error: 'tt' undeclared (first use in this function)
    8 |   d[u] =++tt;
      |           ^~
main.c:9:13: error: 'n' undeclared (first use in this function)
    9 |   for(v=0;v<n;v++){
      |             ^
main.c:10:8: error: 'M' undeclared (first use in this function)
   10 |     if(M[u][v]==0)continue;
      |        ^
main.c:16:3: error: 'f' undeclared (first use in this function)
   16 |   f[u]=++tt;
      |   ^
Language: C

#include<stdio.h>
#define 0
#define 1
#define 2
int n,u,k,v,i,j,tt,n;
int M[200][200],d[200],f[200],c[200];

void visit(int u){
  int v;
  c[u] = 1;
  d[u] =++tt;
  for(v=0;v<n;v++){
    if(M[u][v]==0)continue;
    if(c[v]==0){
      visit(v);
    }
  }
  c[u]=2;
  f[u]=++tt;
}

int main(){

  scanf("%d",&n);
  for(i = 0;i <n;i++){
    for(j=0;j<n;j++)M[i][j]=0;
  }

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


  for (u=0;u<n;u++)c[u] = 0;
  tt=0;

  for(u=0;u<n;u++)if(c[u]==0)visit(u);
  for(u=0;u<n;u++)printf("%d %d %d\n",u + 1,d[u],f[u]);

  return 0;
}

Compiler output:
main.c:2:9: error: macro names must be identifiers
    2 | #define 0
      |         ^
main.c:3:9: error: macro names must be identifiers
    3 | #define 1
      |         ^
main.c:4:9: error: macro names must be identifiers
    4 | #define 2
      |         ^