Language: C++

#include<iostream>
#include<stack>
using namespace int N = 100;
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

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

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

void dfs_visit(int r) {
	for (int i = 0; i < n; i++) nt[i] = 0;
	stack<int> S;
	S.push(r);
	color[r] = GRAY;
	d[r] = ++tt;

	while (!S.empty())
	{
		int u = S.top();
		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;
			}
		}
	}
}

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

	for (int u = 0; u < n; u++) {
		if (color[u] == WHITE) dfs_visit(u);
	}
	for (int u = 0; i < n; u++) {
		cout << i + 1 << " " << d[i] << " " << f[i] << endl;
	}
}

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

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

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

	return 0;
}

Compiler output:
a.cc:3:17: error: expected identifier before 'int'
    3 | using namespace int N = 100;
      |                 ^~~
a.cc:3:16: error: expected ';' before 'int'
    3 | using namespace int N = 100;
      |                ^~~~
      |                ;
a.cc:8:13: error: size of array 'M' is not an integral constant-expression
    8 | int n, M[N][N];
      |             ^
a.cc:8:10: error: size of array 'M' is not an integral constant-expression
    8 | int n, M[N][N];
      |          ^
a.cc:9:11: error: size of array 'color' is not an integral constant-expression
    9 | int color[N], d[N], f[N], tt;
      |           ^
a.cc:9:17: error: size of array 'd' is not an integral constant-expression
    9 | int color[N], d[N], f[N], tt;
      |                 ^
a.cc:9:23: error: size of array 'f' is not an integral constant-expression
    9 | int color[N], d[N], f[N], tt;
      |                       ^
a.cc:10:4: error: structured binding declaration cannot have type 'int'
   10 | int[N];
      |    ^~~
a.cc:10:4: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:10:5: error: conflicting declaration 'auto N'
   10 | int[N];
      |     ^
a.cc:3:21: note: previous declaration as 'int N'
    3 | using namespace int N = 100;
      |                     ^
a.cc:10:7: error: expected initializer before ';' token
   10 | int[N];
      |       ^
a.cc: In function 'int next()':
a.cc:13:22: error: 'nt' was not declared in this scope; did you mean 'tt'?
   13 |         for (int v = nt[u]; v < n; v++) {
      |                      ^~
      |                      tt
a.cc:13:25: error: 'u' was not declared in this scope
   13 |         for (int v = nt[u]; v < n; v++) {
      |                         ^
a.cc:15:30: error: expected primary-expression before '=' token
   15 |                 if (M[u][v]) = return v;
      |                              ^
a.cc:15:32: error: expected primary-expression before 'return'
   15 |                 if (M[u][v]) = return v;
      |                                ^~~~~~
a.cc:17:18: error: expected ';' before '}' token
   17 |         return -1
      |                  ^
      |                  ;
   18 | }
      | ~                 
a.cc: In function 'void dfs_visit(int)':
a.cc:21:37: error: 'nt' was not declared in this scope; did you mean 'tt'?
   21 |         for (int i = 0; i < n; i++) nt[i] = 0;
      |                                     ^~
      |                                     tt
a.cc:22:9: error: 'stack' was not declared in this scope; did you mean 'std::stack'?
   22 |         stack<int> S;
      |         ^~~~~
      |         std::stack
In file included from /usr/include/c++/14/stack:63,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_stack.h:99:11: note: 'std::stack' declared here
   99 |     class stack
      |           ^~~~~
a.cc:22:15: error: expected primary-expression before 'int'
   22 |         stack<int> S;
      |               ^~~
a.cc:23:9: error: 'S' was not declared in this scope
   23 |         S.push(r);
      |         ^
a.cc:30:29: error: too many arguments to function 'int next()'
   30 |                 int v = next(u);
      |                         ~~~~^~~
a.cc:12:5: note: declared here
   12 | int next() {
      |     ^~~~
a.cc: In function 'void dfs()':
a.cc:50:17: error: 'nt' was not declared in this scope; did you mean 'tt'?
   50 |                 nt[i] = 0;
      |                 ^~
      |                 tt
a.cc:57:25: error: 'i' was not declared in this scope
   57 |         for (int u = 0; i < n; u++) {
      |                         ^
a.cc:58:17: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   58 |                 cout << i + 1 << " " << d[i] << " " << f[i] << endl;
      |                 ^~~~
      |                 std::cout
In file included from a.cc:1:
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:58:64: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   58 |                 cout << i + 1 << " " << d[i] << " " << f[i] << endl;
      |                                                                ^~~~
      |                                                                std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc: In function 'int main()':
a.cc:65:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   65 |         cin >> n;
      |         ^~~
      |         std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~