Language: C++

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

int n;
vector<vector<int> > A;
vector<vector<int> > T;
int time = 0;

void dfs(int cur){ // cur????¨????
    // cur ????¨??????????????¨????
    time += 1;
    T[cur][0] = time;
    // ???????¢??????¨??¨???
    cerr << "visiting " << cur << " " << time << endl;

    for(int dst = 0; dst < n; ++dst){ // ??¨???????????? dst ????????????
        if(A[cur][dst] == 1 && T[dst][0] == -1){ // cur??????dst??????????????????,dst???????¨??????????
            dfs(dst);
        }
    }
    // cur ????¨????????????????????¨????
    time += 1;
    T[cur][1] = time;
    // ??¢??°?????????????????????????????? (?????¢??°)
    return; // ?????\???
}

int main(){
    cin >> n;
    vector<vector<int> > A(n, vector<int>(n, 0));
    vector<vector<int> > T(n, vector<int>(2, -1));
    for(int i=0; i<n; ++i){
        int k;
        cin >> k;
        // 1~n???index?????¨????????????????????????????????????1????????????0~n-1????????????
        k -= 1;
        int u;
        cin >> u;
        for(int j=0; j<u; ++j){
            int v;
            cin >> v;
            v -= 1;
            A[k][v] = 1;
        }
    }
    for(int i=0; i<n; ++i){
        if(T[i][0] == -1){
          dfs(i);
        }
    }
    for(int i=0; i<n; ++i){
        cout << i+1 << T[i][0] << T[i][1] << endl;
    }
}

Compiler output:
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: In function 'void dfs(int)':
a.cc:12:10: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   12 |     time += 1;
      |     ~~~~~^~~~
a.cc:12:10: error: assignment of read-only location 'time'
a.cc:13:17: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} [-fpermissive]
   13 |     T[cur][0] = time;
      |                 ^~~~
      |                 |
      |                 time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:23:10: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   23 |     time += 1;
      |     ~~~~~^~~~
a.cc:23:10: error: assignment of read-only location 'time'
a.cc:24:17: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} [-fpermissive]
   24 |     T[cur][1] = time;
      |                 ^~~~
      |                 |
      |                 time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}