Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

vi link[1024];
string res[1024];

void dfs(int p,int d){
  cout<<string(d,'.')<<res[p]<<endl;
  REP(i,link[p].size()){
    dfs(link[p][i],d+1);
  }
}

int main(){
  int n;
  cin>>n;
  int root = 0;
  REP(i,n){
    int k;
    string m;
    cin>>k>>m;
    res[i] = m;
    --k;
    if(k==-1)root=i;
    else{
      link[k].push_back(i);
    }
  }
  dfs(root,0);
  return 0;
}

Compiler output:
a.cc:22:13: error: 'vi link [1024]' redeclared as different kind of entity
   22 | vi link[1024];
      |             ^
In file included from /usr/include/x86_64-linux-gnu/bits/sigstksz.h:24,
                 from /usr/include/signal.h:328,
                 from /usr/include/c++/14/csignal:42,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:116,
                 from a.cc:1:
/usr/include/unistd.h:819:12: note: previous declaration 'int link(const char*, const char*)'
  819 | extern int link (const char *__from, const char *__to)
      |            ^~~~
a.cc: In function 'void dfs(int, int)':
a.cc:27:15: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   27 |   REP(i,link[p].size()){
      |               ^
a.cc:10:31: note: in definition of macro 'REP'
   10 | #define REP(i,n) for(ll i=0;i<n;++i)
      |                               ^
a.cc:27:17: error: request for member 'size' in '*(link + ((sizetype)p))', which is of non-class type 'int(const char*, const char*) noexcept'
   27 |   REP(i,link[p].size()){
      |                 ^~~~
a.cc:10:31: note: in definition of macro 'REP'
   10 | #define REP(i,n) for(ll i=0;i<n;++i)
      |                               ^
a.cc:28:15: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   28 |     dfs(link[p][i],d+1);
      |               ^
a.cc:28:18: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   28 |     dfs(link[p][i],d+1);
      |                  ^
a.cc:28:18: error: invalid conversion from 'int (*)(const char*, const char*) noexcept' to 'int' [-fpermissive]
   28 |     dfs(link[p][i],d+1);
      |         ~~~~~~~~~^
      |                  |
      |                  int (*)(const char*, const char*) noexcept
a.cc:25:14: note:   initializing argument 1 of 'void dfs(int, int)'
   25 | void dfs(int p,int d){
      |          ~~~~^
a.cc: In function 'int main()':
a.cc:44:13: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   44 |       link[k].push_back(i);
      |             ^
a.cc:44:15: error: request for member 'push_back' in '*(link + ((sizetype)k))', which is of non-class type 'int(const char*, const char*) noexcept'
   44 |       link[k].push_back(i);
      |               ^~~~~~~~~