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

#include<iostream>
using namespace std;
 
void main() {
	int Adj[100][100];
	int n, u, k, v;
	cin >> n;

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			Adj[i][j] = 0;
		}
	}
	for (int i = 0; i < n; i++) {
		cin >> u >> k;
		u--;
		for (int j = 0; j < k; j++) {
			cin >> v;
			v--;
			Adj[u][v] = 1;
		}
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (j != 0) cout << " ";
			cout << Adj[i][j];
		}
		cout << endl;
	}
return 0;
}
	

Compiler output:
a.cc:4:1: error: '::main' must return 'int'
    4 | void main() {
      | ^~~~
Language: C++

#include<iostream>

using namespace std;

int main () {

    int n, u, k, v, M[100][100], i, j;

    cin >> n;
    for (i = 0; i < n; i++) {
        for (j = 0; j < n, j++) {
            M[i][j] = 0;
        }
    }

    for (i = 0; i < n; i++) {
        cin >> u >> k;
        u--;
        for (j = 0; j < k; j++) {
            cin >> v;
            v--;
            M[u][v] = 1;
        }
    }

    for (i = 0; i < n; i++) {
        for (j = 0; j < n; j++) {
            if (j != 0) {
                cout << " ";
            }
            cout << M[i][j];
        }
        cout << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:31: error: expected ';' before ')' token
   11 |         for (j = 0; j < n, j++) {
      |                               ^
      |                               ;
Language: C++

#include<iostream>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REP(j, n) for(int j = 0;j < n;j++)
using namespace std;

int main()
{
	int i,n,u;
	int v[100][100];
	cin >> n;
	REP(i,n){
		cin >> u;
		cin >> k;
		REP(i,k){
			cin >>v[i][k];
		}
	}
	REP(i,n){
		REP(j,n){
			cout << v[i][j] << " ";
		}
		cout<<endl;
	}
}

Compiler output:
a.cc:3:9: warning: "REP" redefined
    3 | #define REP(j, n) for(int j = 0;j < n;j++)
      |         ^~~
a.cc:2:9: note: this is the location of the previous definition
    2 | #define REP(i, n) for(int i = 0;i < n;i++)
      |         ^~~
a.cc: In function 'int main()':
a.cc:13:24: error: 'k' was not declared in this scope
   13 |                 cin >> k;
      |                        ^
Language: C++

#include<iostream>
using namespace std;

int main()
{
	int i,n,u,k;
	int v[100][100];
	cin >> n;
	for(i=0;i<n;i++){
		cin >> u;
		for(j=0;j<u;j++){
			cin >> k;
			cin >>v[i][k];
		}
	}
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			cout << v[i][j] << " ";
		}
		cout<<endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:21: error: 'j' was not declared in this scope
   11 |                 for(j=0;j<u;j++){
      |                     ^
a.cc:17:21: error: 'j' was not declared in this scope
   17 |                 for(j=0;j<n;j++){
      |                     ^
Language: C++

#include<iostream>
using namespace std;

int main()
{
	int i,j,n,u,k;
	int v[100][100];
	cin >> n;
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			cin>>v[i][j]=0;
		}
	}
	for(i=0;i<n;i++){
		cin >> u;
		for(j=0;j<u;j++){
			cin >> k;
			v[i][k-1]=1;
		}
	}
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			cout << v[i][j] << " ";
		}
		cout<<endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:38: error: no match for 'operator=' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'int')
   11 |                         cin>>v[i][j]=0;
      |                                      ^
In file included from /usr/include/c++/14/iostream:42,
                 from a.cc:1:
/usr/include/c++/14/istream:718:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator=(std::basic_istream<_CharT, _Traits>&&) [with _CharT = char; _Traits = std::char_traits<char>]'
  718 |       operator=(basic_istream&& __rhs)
      |       ^~~~~~~~
/usr/include/c++/14/istream:718:33: note:   no known conversion for argument 1 from 'int' to 'std::basic_istream<char>&&'
  718 |       operator=(basic_istream&& __rhs)
      |                 ~~~~~~~~~~~~~~~~^~~~~
Language: C++

#include<iostream>
using namespace std;

int main()
{
	int i,j,n,u,k,a;
	int v[100][100];
	cin >> n;
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			v[i][j]=0;
		}
	}
	for(i=0;i<n;i++){
		cin >> u;
		cin >> k;
		for(j=0;j<k;j++){
			cin >>a;
			v[u-1][a-1]=1;
		}
	}
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			cout << v[i][j];
			if (i!==n-1) cout << " ";
		}
		cout<<endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:32: error: expected primary-expression before '=' token
   25 |                         if (i!==n-1) cout << " ";
      |                                ^
Language: C++

#include <iostream>

using namespace std;

const int N = 100 + 1;

int main() {
    int A[N][N] = {{0}};

    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        int u;
        cin >> u;

        int k;
        cin >> k;
        for (int j = 0; j < k; ++jrand48) {
            int x;
            cin >> x;
            A[u-1][x-1] = 1;
        }
    }

    for (int i = 0; i < n; ++i) {
        int j = 0;
        for (; j < n-1; ++j) {
            cout << A[i][j] << " ";
        }
        cout << A[i][j] << endl;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:34: warning: ISO C++ forbids incrementing a pointer of type 'long int (*)(short unsigned int*) noexcept' [-Wpointer-arith]
   18 |         for (int j = 0; j < k; ++jrand48) {
      |                                  ^~~~~~~
a.cc:18:34: error: lvalue required as increment operand
Language: C++

#include<stdio.h>
using namespace std;
static const int N = 100;
int main() {
    
    int n, u, k, v;
    int M[N][N];
    
    cin >> n;
    
    for ( i = 0; i < n; i++ ){
        for ( j = 0; j < n; j++ )
            M[i][j] = 0;
    }
    
    for ( i = 0; i < n; i++ ){
        cin >> u >> k;
        u--;
        for ( j = 0; j < k; j++ ){
            cin >> v;
            v--;
            M[i][j] = 1;
        }
    }
    
    for ( i = 0; i < n; i++ ){
        for ( j = 0; j < n; j++ ){
            if ( j )cout << " ";
            cout << M[i][j];
        }
        cout << endl;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: 'cin' was not declared in this scope
    9 |     cin >> n;
      |     ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<stdio.h>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:11:11: error: 'i' was not declared in this scope
   11 |     for ( i = 0; i < n; i++ ){
      |           ^
a.cc:12:15: error: 'j' was not declared in this scope
   12 |         for ( j = 0; j < n; j++ )
      |               ^
a.cc:16:11: error: 'i' was not declared in this scope
   16 |     for ( i = 0; i < n; i++ ){
      |           ^
a.cc:19:15: error: 'j' was not declared in this scope
   19 |         for ( j = 0; j < k; j++ ){
      |               ^
a.cc:26:11: error: 'i' was not declared in this scope
   26 |     for ( i = 0; i < n; i++ ){
      |           ^
a.cc:27:15: error: 'j' was not declared in this scope
   27 |         for ( j = 0; j < n; j++ ){
      |               ^
a.cc:28:21: error: 'cout' was not declared in this scope
   28 |             if ( j )cout << " ";
      |                     ^~~~
a.cc:28:21: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:29:13: error: 'cout' was not declared in this scope
   29 |             cout << M[i][j];
      |             ^~~~
a.cc:29:13: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:31:9: error: 'cout' was not declared in this scope
   31 |         cout << endl;
      |         ^~~~
a.cc:31:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:31:17: error: 'endl' was not declared in this scope
   31 |         cout << endl;
      |                 ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include<stdio.h>
  +++ |+#include <ostream>
    2 | using namespace std;
Language: C++

public class GraphAizu {
    //directed graph
    List<Integer> adg[];
    GraphAizu(int n){
        adg = new LinkedList[n+1];
        for(int i = 0; i<=n; i++){
            adg[i] = new LinkedList<>();
        }
    }
    void addEdge(int index, int vertex){
        adg[index].add(vertex);
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        GraphAizu graph = new GraphAizu(n);
        for(int i = 0; i<n; i++){
            int index = in.nextInt();
            int m = in.nextInt();
            for(int j = 0; j<m; j++){
                int temp = in.nextInt();
                graph.addEdge(index,temp);
            }
        }
        //change to matrix
        int[][] matrix = new int[n+1][n+1];
        for(int i = 1; i<=n; i++){
            if(graph.adg[i].size()!=0) {
                for (int c : graph.adg[i]) {
                    matrix[i][c] = 1;
                }
            }
        }
        for(int i = 1; i<=n; i++){
            for(int j = 1; j<=n; j++){
                if(j!=n) System.out.print(matrix[i][j]+ " ");
                else System.out.print(matrix[i][j]);
            }
            System.out.println();
        }

    }
}


Compiler output:
a.cc:1:1: error: expected unqualified-id before 'public'
    1 | public class GraphAizu {
      | ^~~~~~
Language: C++

public class Main{
    //directed graph
    List<Integer> adg[];
    Main(int n){
        adg = new LinkedList[n+1];
        for(int i = 0; i<=n; i++){
            adg[i] = new LinkedList<>();
        }
    }
    void addEdge(int index, int vertex){
        adg[index].add(vertex);
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        Maingraph = new Main(n);
        for(int i = 0; i<n; i++){
            int index = in.nextInt();
            int m = in.nextInt();
            for(int j = 0; j<m; j++){
                int temp = in.nextInt();
                graph.addEdge(index,temp);
            }
        }
        //change to matrix
        int[][] matrix = new int[n+1][n+1];
        for(int i = 1; i<=n; i++){
            if(graph.adg[i].size()!=0) {
                for (int c : graph.adg[i]) {
                    matrix[i][c] = 1;
                }
            }
        }
        for(int i = 1; i<=n; i++){
            for(int j = 1; j<=n; j++){
                if(j!=n) System.out.print(matrix[i][j]+ " ");
                else System.out.print(matrix[i][j]);
            }
            System.out.println();
        }

    }
}


Compiler output:
a.cc:1:1: error: expected unqualified-id before 'public'
    1 | public class Main{
      | ^~~~~~
Language: C++

import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;

public class Main{
    //directed graph
    LinkedList<Integer> adg[];
    Main(int n){
        adg = new LinkedList[n+1];
        for(int i = 0; i<=n; i++){
            adg[i] = new LinkedList<>();
        }
    }
    void addEdge(int index, int vertex){
        adg[index].add(vertex);
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        Maingraph = new Main(n);
        for(int i = 0; i<n; i++){
            int index = in.nextInt();
            int m = in.nextInt();
            for(int j = 0; j<m; j++){
                int temp = in.nextInt();
                graph.addEdge(index,temp);
            }
        }
        //change to matrix
        int[][] matrix = new int[n+1][n+1];
        for(int i = 1; i<=n; i++){
            if(graph.adg[i].size()!=0) {
                for (int c : graph.adg[i]) {
                    matrix[i][c] = 1;
                }
            }
        }
        for(int i = 1; i<=n; i++){
            for(int j = 1; j<=n; j++){
                if(j!=n) System.out.print(matrix[i][j]+ " ");
                else System.out.print(matrix[i][j]);
            }
            System.out.println();
        }

    }
}


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.LinkedList;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.List;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import java.util.Scanner;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: expected unqualified-id before 'public'
    5 | public class Main{
      | ^~~~~~
Language: C++

import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;

public class Main{
    //directed graph
    List<Integer> adg[];
    GraphAizu(int n){
        adg = new LinkedList[n+1];
        for(int i = 0; i<=n; i++){
            adg[i] = new LinkedList<>();
        }
    }
    void addEdge(int index, int vertex){
        adg[index].add(vertex);
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        Main graph = new Main(n);
        for(int i = 0; i<n; i++){
            int index = in.nextInt();
            int m = in.nextInt();
            for(int j = 0; j<m; j++){
                int temp = in.nextInt();
                graph.addEdge(index,temp);
            }
        }
        //change to matrix
        int[][] matrix = new int[n+1][n+1];
        for(int i = 1; i<=n; i++){
            if(graph.adg[i].size()!=0) {
                for (int c : graph.adg[i]) {
                    matrix[i][c] = 1;
                }
            }
        }
        for(int i = 1; i<=n; i++){
            for(int j = 1; j<=n; j++){
                if(j!=n) System.out.print(matrix[i][j]+ " ");
                else System.out.print(matrix[i][j]);
            }
            System.out.println();
        }

    }
}



Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.LinkedList;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.List;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import java.util.Scanner;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: expected unqualified-id before 'public'
    5 | public class Main{
      | ^~~~~~
Language: C++

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

class branch{
  int to;
  branch(int to){
    this->to = to;
  }
};

int main(){
  int n; cin >> n;
  vector<branch> graph[n+1];
  int g[n+1][n+1];
  memset(g, 0, sizeof(g));

  int v, k, to;
  for(int i=0; i<n; i++){
    cin >> v;
    cin >> k;
    for(int j=0; j<k; j++){
      cin >> to;
      g[v][to]=1;
    }
  }

  for(int i=1; i<=n; i++){
    for(int j=1; j<=n; j++){
      cout << g[i][j];
      if(j!=n) cout << " ";
    }
    cout << endl;
  }

  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:16:3: error: 'memset' was not declared in this scope
   16 |   memset(g, 0, sizeof(g));
      |   ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <vector>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

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

class branch{
  int to;
  branch(int to){
    this->to = to;
  }
};

int main(){
  int n; cin >> n;
  vector<branch> graph[n+1];
  int g[n+1][n+1];
  memset(g, 0, sizeof(g));

  int v, k, to;
  for(int i=0; i<n; i++){
    cin >> v;
    cin >> k;
    for(int j=0; j<k; j++){
      cin >> to;
      g[v][to]=1;
    }
  }

  for(int i=1; i<=n; i++){
    for(int j=1; j<=n; j++){
      cout << g[i][j];
      if(j!=n) cout << " ";
    }
    cout << endl;
  }

  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:17:3: error: 'memset' was not declared in this scope
   17 |   memset(g, 0, sizeof(g));
      |   ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <vector>
  +++ |+#include <cstring>
    4 | using namespace std;
Language: C++

#include<iostream>

using namespace std;

static const int N = 100;

int main() {
  int M[N][N]

  int n;
  cin >> n;

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

  int u, k, v;
  for (int i = 0; i < n; i++) {
    cin >> u >> k;
    for (int j = 0; j < k; j++) {
      cin >> v;
      v--; // to 0 origin
      M[u][v] = 1;
    }
  }

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (j) {
        cout << " ";
      }
      cout << M[i][j];
    }
    cout << endl;
  }

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: expected initializer before 'int'
   10 |   int n;
      |   ^~~
a.cc:11:10: error: 'n' was not declared in this scope
   11 |   cin >> n;
      |          ^
a.cc:15:7: error: 'M' was not declared in this scope
   15 |       M[i][j] = 0;
      |       ^
a.cc:25:7: error: 'M' was not declared in this scope
   25 |       M[u][v] = 1;
      |       ^
a.cc:34:15: error: 'M' was not declared in this scope
   34 |       cout << M[i][j];
      |               ^
Language: C++

#include <iostream>
#include <string>
#include <map>
#include <set>
#include <algorithm>
using namespace std;
#define MAX 100000

int main(){
  int n;
  cin >>n;
  int A[n+2][n+2]={0};
  int t,k,l,
  for(int i=1;i<=n;i++){
    cin >> t >> k;
    for(int j=1;j<=k;j++){
      cin >> l;
      A[i][l]=1;
    }
  }
  for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
      cout << A[i][j];
    }
    cout << endl;
  }
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:14:3: error: expected unqualified-id before 'for'
   14 |   for(int i=1;i<=n;i++){
      |   ^~~
a.cc:14:15: error: 'i' was not declared in this scope
   14 |   for(int i=1;i<=n;i++){
      |               ^
Language: C++

#include<iostream>
using namespace std;

const static int N = 100;

int main() {
  int n, G[N][N];
  
  cin >> n;

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

  for ( int i = 0; i < n; i++ ) {
    cin >> v >> m;
    for ( int j = 0; j < m; j++ ) {
      cin >> k;
      G[v][k] = 1
    }
  }

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

  return 0;    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:12: error: 'v' was not declared in this scope
   16 |     cin >> v >> m;
      |            ^
a.cc:16:17: error: 'm' was not declared in this scope
   16 |     cin >> v >> m;
      |                 ^
a.cc:18:14: error: 'k' was not declared in this scope
   18 |       cin >> k;
      |              ^
Language: C++

#include<iostream>
using namespace std;

const static int N = 100;

int main() {
  int n, G[N][N];
  int v, m, k;
  
  cin >> n;

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

  for ( int i = 0; i < n; i++ ) {
    cin >> v >> m;
    for ( int j = 0; j < m; j++ ) {
      cin >> k;
      G[v][k] = 1
    }
  }

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

  return 0;    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:18: error: expected ';' before '}' token
   20 |       G[v][k] = 1
      |                  ^
      |                  ;
   21 |     }
      |     ~
Language: C++

#include <iostream>
#include <queue>
#include <stack>
#include <cstdio>
#include <vector>
#include <sstream>

using namespace std;

const int N_MAX = 1000000;

int main(){
  int N;
  cin >> N;

  // table
  int** table = new int*[N];
  for(int i=0; i<N; i++){
    table[i] = new int[N];
    memset(&table[i][0], 0, N*sizeof(table[i][0]));
    // &table[i][0] can be table[i] because it only needs head address.
    
    //[..., [int, int,int], ...]
    // memset(start_addr, 0, delta_arr) fills
    // start_addr to (start_addr + delta_arr) by 0.
    // table[i] refers to the first addr of table[i],
    // for each integer to be filled by 0, size of the element
    // (not table[i]) should be given.
  }
  
  for(int i=0; i<N; i++){
    int row_num, k;
    cin >> row_num >> k;

    row_num--;
    
    for(int j=0; j<k; j++){
      int col_num;
      cin >> col_num;
      col_num--;
      table[row_num][col_num] = 1;
    }
  }

  //print table
  for(int i=0; i<N; i++){
    for(int j=0; j<N; j++){
      cout << table[i][j] << " ";
    }
    cout << endl;
  }
  
  for(int i=0; i<N; i++){
    delete[] table[i];
  }
  delete[] table;
  
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:20:5: error: 'memset' was not declared in this scope
   20 |     memset(&table[i][0], 0, N*sizeof(table[i][0]));
      |     ^~~~~~
a.cc:7:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    6 | #include <sstream>
  +++ |+#include <cstring>
    7 |
Language: C++

#include <iostream>
#include <queue>
#include <stack>
#include <cstdio>
#include <vector>
#include <sstream>
#include <stdio.h>

using namespace std;

const int N_MAX = 1000000;

int main(){
  int N;
  cin >> N;

  // table
  int** table = new int*[N];
  for(int i=0; i<N; i++){
    table[i] = new int[N];
    memset(&table[i][0], 0, N*sizeof(table[i][0]));
    // &table[i][0] can be table[i] because it only needs head address.
    
    //[..., [int, int,int], ...]
    // memset(start_addr, 0, delta_arr) fills
    // start_addr to (start_addr + delta_arr) by 0.
    // table[i] refers to the first addr of table[i],
    // for each integer to be filled by 0, size of the element
    // (not table[i]) should be given.
  }
  
  for(int i=0; i<N; i++){
    int row_num, k;
    cin >> row_num >> k;

    row_num--;
    
    for(int j=0; j<k; j++){
      int col_num;
      cin >> col_num;
      col_num--;
      table[row_num][col_num] = 1;
    }
  }

  //print table
  for(int i=0; i<N; i++){
    for(int j=0; j<N; j++){
      cout << table[i][j] << " ";
    }
    cout << endl;
  }
  
  for(int i=0; i<N; i++){
    delete[] table[i];
  }
  delete[] table;
  
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:21:5: error: 'memset' was not declared in this scope
   21 |     memset(&table[i][0], 0, N*sizeof(table[i][0]));
      |     ^~~~~~
a.cc:7:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    6 | #include <sstream>
  +++ |+#include <cstring>
    7 | #include <stdio.h>
Language: C++

#include <iostream>
#include <queue>
#include <stack>
#include <cstdio>
#include <vector>
#include <sstream>
#include <stdio.h>
#include<cstdio>

//#include<string>
//#include<cmath>
//#include<map>
//#include<cstdlib>
//#include<deque>
//#include<queue>
//#include<climits>
//#include<cstring>
using namespace std;

const int N_MAX = 1000000;

int main(){
  int N;
  cin >> N;

  // table
  int** table = new int*[N];
  for(int i=0; i<N; i++){
    table[i] = new int[N];
    memset(&table[i][0], 0, N*sizeof(table[i][0]));
    // &table[i][0] can be table[i] because it only needs head address.
    
    //[..., [int, int,int], ...]
    // memset(start_addr, 0, delta_arr) fills
    // start_addr to (start_addr + delta_arr) by 0.
    // table[i] refers to the first addr of table[i],
    // for each integer to be filled by 0, size of the element
    // (not table[i]) should be given.
  }
  
  for(int i=0; i<N; i++){
    int row_num, k;
    cin >> row_num >> k;

    row_num--;
    
    for(int j=0; j<k; j++){
      int col_num;
      cin >> col_num;
      col_num--;
      table[row_num][col_num] = 1;
    }
  }

  //print table
  for(int i=0; i<N; i++){
    for(int j=0; j<N; j++){
      cout << table[i][j];
      if(j!=N-1) cout << " ";
      else cout << endl;
    }
  }
  
  for(int i=0; i<N; i++){
    delete[] table[i];
  }
  delete[] table;
  
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:30:5: error: 'memset' was not declared in this scope
   30 |     memset(&table[i][0], 0, N*sizeof(table[i][0]));
      |     ^~~~~~
a.cc:9:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    8 | #include<cstdio>
  +++ |+#include <cstring>
    9 |
Language: C++

n=gets.to_i;
a=Array.new(n){Array.new(n,0)}
m=Array.new
n.times do |i|
  m.clear
  m=gets.split.map{|i|i.to_i}
  m[1].times do |j|
    a[m[0]-1][m[j+2]-1]=1
  end
end
n.times do |i|
  print a[i],"\n"
end


Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n=gets.to_i;
      | ^
a.cc:2:1: error: 'a' does not name a type
    2 | a=Array.new(n){Array.new(n,0)}
      | ^
a.cc:3:1: error: 'm' does not name a type
    3 | m=Array.new
      | ^
a.cc:7:3: error: 'm' does not name a type
    7 |   m[1].times do |j|
      |   ^
Language: C++

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

  int u[n],k;
  int a[n][n];
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      a[i][j]=0;
    }
  }
  for(int i=0;i<n;i++){
    cin>>u[i];
    cin>>k;
    for(int j=0;j<k;j++){
      int v;
      cin>>v;
      a[i][v-1]=1;
    }
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      cout<<a[i][j];
    }
    cout<<"\n";
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:3:3: error: 'cin' was not declared in this scope
    3 |   cin>>n;
      |   ^~~
a.cc:23:7: error: 'cout' was not declared in this scope
   23 |       cout<<a[i][j];
      |       ^~~~
a.cc:25:5: error: 'cout' was not declared in this scope
   25 |     cout<<"\n";
      |     ^~~~
Language: C++

#include <stdio.h>

int main() {
    int n, m, tmp;
    
    scanf("%d", &n);
    
    int M[100][100];
    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", &m);
        for (int j=0; j<,; j++) {
            scanf("%d", &tmp);
            M[i][tmp-1] = 1;
        }
    }
    
    for(int i=0; i<n; i++) {
        for(int j=0; j<n; j++) {
            if(j) printf(" ");
            printf("%d", M[i][j]);
        }
        printf("\n");
    }
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:25: error: expected primary-expression before ',' token
   17 |         for (int j=0; j<,; j++) {
      |                         ^
a.cc:17:26: error: expected primary-expression before ';' token
   17 |         for (int j=0; j<,; j++) {
      |                          ^
Language: C++

#include <iostream>
using namespace std;

int n;
int M[101][101];
int main() {
    cin >> n;

    for (int i = 0; i < n; ++i) {
        int v, k;
        cin >> v >> k;
        for (int j = 0; j < k; ++j) {
            int s;
            cin >> s;
            M[v][s] = 1;
        }
    }

    for (int l = 1; l <= n; ++l) {
        for (int i = 1; i <= n; ++i) {
            if(i) cout << " "
            cout << M[l][i];
        }
        cout << endl;
    }

    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:21:30: error: expected ';' before 'cout'
   21 |             if(i) cout << " "
      |                              ^
      |                              ;
   22 |             cout << M[l][i];
      |             ~~~~
Language: C++

include<iostream>
#include<cstdio>
#define N 101
using namespace std;

int main(){

  int n,n2,data,u;
  int g[N][N]; 
 //load n
  cin >>n;

  //initialize
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      g[i][j]=0;
    }
  }

  for(int i=0;i<n;i++){
    scanf("%d%d",&u,&n2);
    for(int j=0;j<n2;j++){
      scanf("%d",&data);
      g[u][data]=1;
    }
  }

  for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
      printf("%d",g[i][j]);
      if(j!=n)printf(" ");
    }
    printf("\n");
  }

  return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<iostream>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:11:3: error: 'cin' was not declared in this scope
   11 |   cin >>n;
      |   ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include<cstdio>
  +++ |+#include <iostream>
    3 | #define N 101
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

int main(void){

  int graph[100][100];
  fill( graph , graph + 100 , 0 );

  int n;
  cin >> n;
  for( int i = 0 ; i < n ; i++ ){
    int u, k;
    cin >> u >> k;
    u--;
    while( k-- ){
      int v;
      cin >> v;
      v--;
      graph[u][v] = 1;
    }
  }
  for( int i = 0 ; i < n ; i++ ){
    for( int j = 0 ; j < n ; j++ ){
      if( j == n - 1 ) cout << graph[i][j] << endl;
      else cout << graph[i][j] << " ";
    }
  }
  return 0;
}

Compiler output:
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 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/c++/14/bits/stl_algobase.h: In instantiation of 'typename __gnu_cxx::__enable_if<std::__is_scalar<_Tp>::__value, void>::__type std::__fill_a1(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = int (*)[100]; _Tp = int; typename __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, void>::__type = void]':
/usr/include/c++/14/bits/stl_algobase.h:998:21:   required from 'void std::__fill_a(_FIte, _FIte, const _Tp&) [with _FIte = int (*)[100]; _Tp = int]'
  998 |     { std::__fill_a1(__first, __last, __value); }
      |       ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1029:20:   required from 'void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = int (*)[100]; _Tp = int]'
 1029 |       std::__fill_a(__first, __last, __value);
      |       ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:9:7:   required from here
    9 |   fill( graph , graph + 100 , 0 );
      |   ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:952:18: error: incompatible types in assignment of 'const int' to 'int [100]'
  952 |         *__first = __tmp;
      |         ~~~~~~~~~^~~~~~~
Language: Java

n = int(input())
graph = [[] for _ in range(n)]
for i in range(n):
    in_list = list(map(int, input().split()))
    u = in_list[0]
    graph[u - 1] = in_list[2:]

d = [0 for _ in range(n)]
f = [0 for _ in range(n)]
time = 0

def dfs(now, prev, graph, d, f):
    if d[now] != 0:
        return d, f
    global time
    time += 1
    d[now] = time
    if not graph[now]:
        f[now] = time + 1
        time += 1
        return
    for k in graph[now]:
        if k - 1 == prev or d[k-1] !=0:
            continue
        dfs(k - 1, now, graph, d, f)
    else:
        time += 1
        f[now] = time
    return d, f



for i in range(n):
    d, f = dfs(i, 0, graph, d, f)
    print(i+1, d[i], f[i])



Compiler output:
Main.java:1: error: class, interface, enum, or record expected
n = int(input())
^
1 error
Language: Java

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;


public class ALDS1_11_B_DepthFirstSearch {

	static int[] first;
	static int [] end;
	static List[] arLs;

	static int dfs(int cur,int ts) {
		first[cur] = first[cur]==0 ? ts : first[cur];
		int now = ts+1;
		for(int i=0;i<arLs[cur].size();i++) {
			int a = (Integer)arLs[cur].get(i);
			if (first[a]==0){
				now = dfs(a, now);
			}
		}
		end[cur] = end[cur]==0 ? now : end[cur];
		return now+1;
	}
	
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		arLs = new List[n];
		first = new int[n];
		end = new int[n];
		for (int i=0;i<n;i++) {
			List<Integer> ls = new ArrayList<Integer>();
			scan.nextInt();
			int np = scan.nextInt();
			for (int j=0;j<np;j++) {
				ls.add(scan.nextInt()-1);
			}
			arLs[i] = ls;
		}
		dfs(0,1);
		for (int i=0;i<n;i++) {
			System.out.println(i+1+" "+first[i]+" "+end[i]);
		}
	}
}

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

import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner scr = new Scanner(System.in);
		int dotcount =Integer.parseInt(scr.nextLine());
		dots = new int[dotcount][];
		for(int i=0; i<dotcount; i++){
			String[] str = scr.nextLine().split(" ", 0);
			dots[i] = new int[Integer.parseInt(str[1])];
			for(int j=2; j<str.length; j++){
				dots[i][j-2] = Integer.parseInt(str[j])-1;
			}
		}
		step=1;
		//index=0;
		start = new int[dotcount];
		finish = new int[dotcount];
		visited = new boolean[dotcount];
		for(int i=0; i<dotcount; i++){
			visited[i] = false;
		}
		for(int i=0; i<dotcount; i++){
			Visit(i);
		}
		//Visit(0);
		for(int i=0; i<dotcount; i++){
			System.out.println(String.valueOf(i+1) +" "+ start[i] +" "+ finish[i]);
		}
		scr.close();
	}
	static int[][] dots;
	static int step;
	//static int index;
	static boolean[] visited;
	static int[] start;
	static int[] finish;
	static void Visit(int i){
		if(visited[i]) return;
		visited[i] = true;
		start[i] = step;
		step++;
		//System.out.println(step);
		for(int j=0; j < dots[i].length; j++){
			//if(!visited[dots[i][j]])
				Visit(dots[i][j]);
		}
		finish[i] = step;
		step++;
	}
}package week05;

import java.util.Scanner;

public class DFS {
	public static void main(String args[]) {
		Scanner scr = new Scanner(System.in);
		int dotcount =Integer.parseInt(scr.nextLine());
		dots = new int[dotcount][];
		for(int i=0; i<dotcount; i++){
			String[] str = scr.nextLine().split(" ", 0);
			dots[i] = new int[Integer.parseInt(str[1])];
			for(int j=2; j<str.length; j++){
				dots[i][j-2] = Integer.parseInt(str[j])-1;
			}
		}
		step=1;
		//index=0;
		start = new int[dotcount];
		finish = new int[dotcount];
		visited = new boolean[dotcount];
		for(int i=0; i<dotcount; i++){
			visited[i] = false;
		}
		for(int i=0; i<dotcount; i++){
			Visit(i);
		}
		//Visit(0);
		for(int i=0; i<dotcount; i++){
			System.out.println(String.valueOf(i+1) +" "+ start[i] +" "+ finish[i]);
		}
		scr.close();
	}
	static int[][] dots;
	static int step;
	//static int index;
	static boolean[] visited;
	static int[] start;
	static int[] finish;
	static void Visit(int i){
		if(visited[i]) return;
		visited[i] = true;
		start[i] = step;
		step++;
		//System.out.println(step);
		for(int j=0; j < dots[i].length; j++){
			//if(!visited[dots[i][j]])
				Visit(dots[i][j]);
		}
		finish[i] = step;
		step++;
	}
}

Compiler output:
Main.java:51: error: class, interface, enum, or record expected
}package week05;
 ^
Main.java:53: error: class, interface, enum, or record expected
import java.util.Scanner;
^
2 errors
Language: Java


import java.util.Scanner;

public class UsingRecursive {

    private static final int N = 100;
    private static Scanner scanner = new Scanner(System.in);
    private static int[][] Mat = new int[N][N];
    private static int[] Start = new int[N];
    private static int[] Finish = new int[N];

    private static int n;
    private static int time = 1;



    public static void main(String[] argss){

        graph_input();

        dfs_recursive(0);

        print_answer();
    }

    private static void dfs_recursive(int u) {

        Start[u] = time++;

        for (int v = 0; v < n; v++) {
            if (Mat[u][v] == 1 && Start[v] == 0){
                dfs_recursive(v);
            }
        }

        Finish[u] = time++;

    }

    private static void print_answer() {
        for (int i = 0; i < n; i++) {
            System.out.print((i+1) + " ");
            System.out.print(Start[i] + " ");
            System.out.print(Finish[i] + "\n");
        }
    }


    private static void graph_input() {

        n = scanner.nextInt();

        int u, k, v;
        for (int i = 0; i < n; i++) {
            u = scanner.nextInt();
            k = scanner.nextInt();
            for (int j = 0; j < k; j++) {
                v = scanner.nextInt();
                Mat[u-1][v-1] = 1;
            }
        }
    }
}

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

import java.util.Scanner;

public class UsingRecursive {

    private static final int N = 100;
    private static Scanner scanner = new Scanner(System.in);
    private static int[][] Mat = new int[N][N];
    private static int[] Start = new int[N];
    private static int[] Finish = new int[N];

    private static int n;
    private static int time = 1;



    public static void main(String[] argss){

        graph_input();

        dfs_recursive(0);

        print_answer();
    }

    private static void dfs_recursive(int u) {

        Start[u] = time++;

        for (int v = 0; v < n; v++) {
            if (Mat[u][v] == 1 && Start[v] == 0){
                dfs_recursive(v);
            }
        }

        Finish[u] = time++;

    }

    private static void print_answer() {
        for (int i = 0; i < n; i++) {
            System.out.print((i+1) + " ");
            System.out.print(Start[i] + " ");
            System.out.print(Finish[i] + "\n");
        }
    }


    private static void graph_input() {

        n = scanner.nextInt();

        int u, k, v;
        for (int i = 0; i < n; i++) {
            u = scanner.nextInt();
            k = scanner.nextInt();
            for (int j = 0; j < k; j++) {
                v = scanner.nextInt();
                Mat[u-1][v-1] = 1;
            }
        }
    }
}

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

import java.util.*;
 
public class Main {
    static int time = 0;
 
    public static void main(String[] args) throws IOException {
 
        Scanner scan = new Scanner(System.in);
 
        int n = scan.nextInt();
 
        int[][] v = new int[n + 1][n+1];
        int[] d = new int[n + 1];
        int[] f = new int[n + 1];
 
        for (int i = 1; i <= n; i++) {
            int u = scan.nextInt();
            int k = scan.nextInt();
            for (int j = 1; j <= k; j++)
                v[u][j] = scan.nextInt();
        }
 
        for (int i = 1; i <= n; i++) {
            if (d[i] == 0)
                Dsearch(v, d, f, i);
        }
 
        for (int i = 1; i <= n; i++) {
            System.out.println(i + " " + d[i] + " " + f[i]);
        }
 
        scan.close();
        System.exit(0);
    }
 
    private static void Dsearch(int[][] v, int[] d, int[] f, int u) {
        d[u] = ++time;
        for (int i = 1; i < v[u].length-1 && v[u][i] > 0; i++)
            if (d[v[u][i]] == 0)
                Dsearch(v, d, f, v[u][i]);
        f[u] = ++time;
    }
}

Compiler output:
Main.java:6: error: cannot find symbol
    public static void main(String[] args) throws IOException {
                                                  ^
  symbol:   class IOException
  location: class Main
1 error
Language: Java

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

public class BepthFirstSearch {

	public static final int N = 100;
	public static final int WHITE = 0;
	public static final int GRAY = 1;
	public static final int BLACK = 2;

	static int n;
	static int tt;

	// グラフを示す二次元行列
	static int[][] M = new int[N][N];
	static int[] color = new int[N], d = new int[N], f = new int[N], nt = new int[N];

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

		int u,k,v;
		Scanner sc = new Scanner(new File("/workspace/AOJ/src/section12/sample2.txt"));
		n = sc.nextInt();

		for (int i = 0; i < n; i++) {
			u = sc.nextInt();
			k = sc.nextInt();
			u--;
			for (int j = 0; j < k; j++) {
				v = sc.nextInt();
				v--;
				M[u][v] = 1;
			}
		}
		dfs();
	}

	// uに隣接するvを番号順に取得
	private static int next (int u) {
		for (int v = nt[u]; v < n; v++) {
			nt[u] = v + 1;
			if (M[u][v] == 1) {
				return v;
			}
		}
		return -1;
	}

	// スタックを用いた深さ優先探索
	private static void dfsVisit(int r) {

		Stack<Integer> S = new Stack<Integer>();
		S.push(r);
		color[r] = GRAY;
		d[r] = ++tt;

		while (!S.empty()) {
			int u = S.peek();
			int v = next(u);
			if (v != -1) {
				if (color[v] == WHITE) {
					color[v] = GRAY;
					d[v] = ++tt;
					S.push(v);
				}
			} else {
				S.pop();
				color[u] = BLACK;
				f[u] = ++tt;
			}
		}
	}

	private static void dfs() {
		Arrays.fill(color, WHITE);

		// 未訪問のuを始点として深さ優先探索
		for (int u = 0; u < n; u++) {
			if (color[u] == WHITE) dfsVisit(u);
		}
		for (int i = 0; i < n; i++) {
			System.out.println(i+1 +" "+ d[i] + " " + f[i]);
		}
	}


}


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

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

public class Main {

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

//		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int[][] mat = new int[n+1][n+1];

		// 初回訪問リスト
		int[] d = new int[n+1];
		Arrays.fill(d, -1);

		// 訪問完了リスト
		int[] f = new int[n+1];
		Arrays.fill(f, -1);

		for (int i = 0; i < n; i++) {
			int u = sc.nextInt();			// 番号
			int k = sc.nextInt();			// uの出次数
			for (int j = 0; j < k; j++) {
				int v = sc.nextInt();
				mat[u][v] = 1;
			}
		}

		Stack<Integer> stack = new Stack<Integer>();

		int count = 0;
		for (int index = 1; index <= n; index++) {
			if (d[index] == -1) {
				stack.add(index);
				d[index] = ++count;
			} else {
				continue;
			}

			while (!stack.isEmpty()) {
				int from = stack.peek();
				boolean isNext = false;
				for (int to = 1; to <= n; to++) {
					if (mat[from][to] == 1 && d[to] == -1) {
						stack.push(to);
						d[to] = ++count;
						isNext = true;
					}
				}
				if (!isNext) {
					from = stack.pop();
					f[from] = ++count;
				}
			}
		}



		// 幅優先探索
//		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();
//				mat[u][v] = 1;
//			}
//		}
//
//
//		ArrayDeque<Integer> q = new ArrayDeque<Integer>();
//		q.add(1);
//		v[1] = 0;
//
//		while (!q.isEmpty()) {
//			int f = q.poll();
//			for (int t = 1; t <= n; t++) {
//				if (mat[f][t] == 1) {
//					q.add(t);
//					if (v[t] == -1) {
//						v[t] = v[f] + 1;
//					}
//				}
//			}
//		}

		for (int i = 1; i <= n; i++) {
			System.out.println(i + " " + d[i] + " " + f[i]);
		}



	}

	public static void matPrint(int[][] mat) {
		for (int i = 1; i < mat.length; i++) {
			for (int j = 1; j < mat[i].length; j++) {
				System.out.print(mat[i][j] + " ");
			}
			System.out.print("\n");
		}
	}

}



Compiler output:
Main.java:13: error: cannot find symbol
		int n = sc.nextInt();
		        ^
  symbol:   variable sc
  location: class Main
Main.java:25: error: cannot find symbol
			int u = sc.nextInt();			// ??
			        ^
  symbol:   variable sc
  location: class Main
Main.java:26: error: cannot find symbol
			int k = sc.nextInt();			// u????
			        ^
  symbol:   variable sc
  location: class Main
Main.java:28: error: cannot find symbol
				int v = sc.nextInt();
				        ^
  symbol:   variable sc
  location: class Main
4 errors
Language: Java

public class Main {

    static int[][] graph;
    static int time;
    static int[] d, f;
    static boolean[] visited;
    
    static void visit(int node) {
        if(!visited[node]) {
            visited[node] = true;
            d[node] = time++;
            for(int i = 1; i < d.length; i++) {
                if(graph[node][i] == 1) {
                    visit(i);
                }
            }
            f[node] = time++;
        }
    }
    
    public final static void main(String[] args) {
        try(Scanner sc = new Scanner(System.in)) {
            int n = sc.nextInt();
            time = 1;
            graph = new int[n+1][n+1];
            d = new int[n+1];
            f = new int[n+1];
            visited = new boolean[n+1];
            for(int i = 0; i < n; i++) {
                int s = sc.nextInt();
                int k = sc.nextInt();
                for(int j = 0; j < k; j++) {
                    graph[s][sc.nextInt()] = 1;
                }
            }
            for(int i = 1; i <= n; i++) {
                visit(i);
            }
            for(int i = 1; i <= n; i++) {
                System.out.println(i + ” ” + d[i] + ” ” + f[i]);
            }
        }
    }
}


Compiler output:
Main.java:40: error: illegal character: '\u201d'
                System.out.println(i + ? ? + d[i] + ? ? + f[i]);
                                       ^
Main.java:40: error: illegal character: '\u201d'
                System.out.println(i + ? ? + d[i] + ? ? + f[i]);
                                         ^
Main.java:40: error: illegal character: '\u201d'
                System.out.println(i + ? ? + d[i] + ? ? + f[i]);
                                                    ^
Main.java:40: error: not a statement
                System.out.println(i + ? ? + d[i] + ? ? + f[i]);
                                                  ^
Main.java:40: error: illegal character: '\u201d'
                System.out.println(i + ? ? + d[i] + ? ? + f[i]);
                                                      ^
Main.java:40: error: not a statement
                System.out.println(i + ? ? + d[i] + ? ? + f[i]);
                                                           ^
Main.java:40: error: ';' expected
                System.out.println(i + ? ? + d[i] + ? ? + f[i]);
                                                              ^
7 errors
Language: Java

import java.util.*;
public class Main {
public static void main(String...args) {
final Scanner sc = new Scanner(System.in);
final int n = sc.nextInt();
final int[][] matrix = new int[n][n];
for(int i = 0; i < n; i++) {
final int u = sc.nextInt();
final int k = sc.nextInt();
for(int j = 0; j < k; j++)
matrix[u-1][sc.nextInt()-1] = 1;
}
final int[] begin = new int[n];
final int[] end = new int[n];
final Deque<Integer> deque = new ArrayDeque<Integer>();
deque.offerFirst(0);
for(int t = 1; !deque.isEmpty(); t++) {
final int id = deque.pollFirst();
if(begin[id] > 0) {
end[id] = t;
continue;
}
begin[id] = t;
deque.offerFirst(id);
for(int i = n - 1; i >= 0; i--)
if(matrix[id][i]) deque.offerFirst(i);
}
for(int i = 0; i < n; i++)
System.out.printf("%d %d %d\n", i + 1, begin[i], end[i]);
}
}

Compiler output:
Main.java:26: error: incompatible types: int cannot be converted to boolean
if(matrix[id][i]) deque.offerFirst(i);
             ^
1 error
Language: Java

import java.util.*;
public class Main {
public static void main(String...args) {
final Scanner sc = new Scanner(System.in);
final int n = sc.nextInt();
final boolean[][] matrix = new boolean[n][n];
for(int i = 0; i < n; i++) {
final int u = sc.nextInt();
final int k = sc.nextInt();
for(int j = 0; j < k; j++)
matrix[u-1][sc.nextInt()-1] = true;
}
final boolean[] visited = new boolean[n];
final int[] begin = new int[n];
final int[] end = new int[n];
final Deque<Integer> deque = new ArrayDeque<Integer>();
int t = 1;
for(int k = 0; k < n; k++) if(!visited[k]) {
deque.offerFirst(k);
visited[k] = true;
while(!deque.isEmpty()) {
final int id = deque.pollFirst();
if(begin[id] > 0) {
end[id] = t++;
continue;
}
if(visited[id]) continue;
visited = true;
begin[id] = t++;
deque.offerFirst(id);
for(int i = n - 1; i >= 0; i--)
if(matrix[id][i] && !visited[i]) deque.offerFirst(i);
}
}
for(int i = 0; i < n; i++)
System.out.printf("%d %d %d\n", i + 1, begin[i], end[i]);
}
}

Compiler output:
Main.java:28: error: cannot assign a value to final variable visited
visited = true;
^
Main.java:28: error: incompatible types: boolean cannot be converted to boolean[]
visited = true;
          ^
2 errors