Language: C++

#include <iostream>
#include <string>

using namespace std;

int n;
vector<vector<int>> g; 
int time = 0;
int timeT = 0;
vector<int> d, f;
 
void dfs(int node){
    timeT++;

    if(d[node] == 0){
        d[node] = timeT;
    }

    for(auto next : g[node]){
        if(d[next] == 0){
            dfs(next);
        }
    }
    
    timeT++;
    if(f[node] == 0){
        f[node] = timeT;
    }
    return;
}
    
int main(){
    
    cin >> n;

    d.assign(n + 1, 0);
    f.assign(n + 1, 0);

    g.assign(n + 1, vector<int>());

    for(int i = 0; i < n; i++)
    {
        int nod, numOut;
        cin  >> nod >> numOut;
        for(int j = 0; j < numOut; j++)
        {
            int temp;
            cin >> temp;
            g[nod].push_back(temp);
        }
    }
    
    for(int i = 1; i <= n; i++)
    {
        if(d[i] == 0){
            dfs(i);
        }
    }

    for(int i = 1; i <= n; i++)
    {
        cout << i << " " << d[i] << " " << f[i] << endl;
    }
    

    return 0;
}

Compiler output:
a.cc:7:1: error: 'vector' does not name a type
    7 | vector<vector<int>> g;
      | ^~~~~~
a.cc:8:5: error: 'int time' redeclared as different kind of entity
    8 | int time = 0;
      |     ^~~~
In file included from /usr/include/pthread.h:23,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
                 from /usr/include/c++/14/ext/atomicity.h:35,
                 from /usr/include/c++/14/bits/ios_base.h:39,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
   76 | extern time_t time (time_t *__timer) __THROW;
      |               ^~~~
a.cc:10:1: error: 'vector' does not name a type
   10 | vector<int> d, f;
      | ^~~~~~
a.cc: In function 'void dfs(int)':
a.cc:15:8: error: 'd' was not declared in this scope
   15 |     if(d[node] == 0){
      |        ^
a.cc:19:21: error: 'g' was not declared in this scope
   19 |     for(auto next : g[node]){
      |                     ^
a.cc:20:12: error: 'd' was not declared in this scope
   20 |         if(d[next] == 0){
      |            ^
a.cc:26:8: error: 'f' was not declared in this scope
   26 |     if(f[node] == 0){
      |        ^
a.cc: In function 'int main()':
a.cc:36:5: error: 'd' was not declared in this scope
   36 |     d.assign(n + 1, 0);
      |     ^
a.cc:37:5: error: 'f' was not declared in this scope
   37 |     f.assign(n + 1, 0);
      |     ^
a.cc:39:5: error: 'g' was not declared in this scope
   39 |     g.assign(n + 1, vector<int>());
      |     ^
a.cc:39:21: error: 'vector' was not declared in this scope
   39 |     g.assign(n + 1, vector<int>());
      |                     ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | #include <string>
a.cc:39:28: error: expected primary-expression before 'int'
   39 |     g.assign(n + 1, vector<int>());
      |                            ^~~