Language: C++

using System;
using System.IO;
using System.Linq;

namespace Tree
{
    class Rooted_Trees
    {
        struct Node
        {
            public int id;
            public int parent;
            public int depth;
            public int[] childlen;
            public int type;
            public string GetNodeType()
            {
                switch (type)
                {
                    case 0: return "root";
                    case 1: return "internal node";
                    case 2: return "leaf";
                    default: return null;
                }
            }
        }
        static void Main(string[] args)
        {
            int size = int.Parse(Console.ReadLine());
            var nodes = new Node[size];

            for (int i = 0; i < size; i++)
                nodes[i].parent = -1;

            for (int i = 0; i < size; i++)
            {
                var token = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
                var id = token[0];
                nodes[id].id = id;

                var k = token[1];
                if (k == 0) nodes[id].type = 2;
                else nodes[id].type = 1;
                nodes[id].childlen = new int[k];
                for (int j = 0; j < k; j++)
                {
                    nodes[id].childlen[j] = token[2 + j];
                    nodes[token[2 + j]].parent = id;
                    nodes[token[2 + j]].depth = nodes[id].depth + 1;
                }
            }

            for (int i = 0; i < size; i++)
                if (nodes[i].parent == -1)
                    nodes[i].type = 0;
                else nodes[i].depth = nodes[nodes[i].parent].depth + 1;

            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            for (int i = 0; i < size; i++)
            {
                Console.Write("node {0}: parent = {1}, depth = {2}, {3}, [", nodes[i].id, nodes[i].parent, nodes[i].depth, nodes[i].GetNodeType());
                Console.Write(string.Join(", ", Array.ConvertAll(nodes[i].childlen, n => n.ToString())));
                Console.WriteLine("]");
            }

            Console.Out.Flush();
        }
    }
}

Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
    2 | using System.IO;
      |       ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
    3 | using System.Linq;
      |       ^~~~~~
a.cc:11:19: error: expected ':' before 'int'
   11 |             public int id;
      |                   ^~~~
      |                   :
a.cc:12:19: error: expected ':' before 'int'
   12 |             public int parent;
      |                   ^~~~
      |                   :
a.cc:13:19: error: expected ':' before 'int'
   13 |             public int depth;
      |                   ^~~~
      |                   :
a.cc:14:19: error: expected ':' before 'int'
   14 |             public int[] childlen;
      |                   ^~~~
      |                   :
a.cc:14:23: error: expected unqualified-id before '[' token
   14 |             public int[] childlen;
      |                       ^
a.cc:15:19: error: expected ':' before 'int'
   15 |             public int type;
      |                   ^~~~
      |                   :
a.cc:16:19: error: expected ':' before 'string'
   16 |             public string GetNodeType()
      |                   ^~~~~~~
      |                   :
a.cc:16:20: error: 'string' does not name a type
   16 |             public string GetNodeType()
      |                    ^~~~~~
a.cc:26:10: error: expected ';' after struct definition
   26 |         }
      |          ^
      |          ;
a.cc:27:26: error: 'string' has not been declared
   27 |         static void Main(string[] args)
      |                          ^~~~~~
a.cc:27:35: error: expected ',' or '...' before 'args'
   27 |         static void Main(string[] args)
      |                                   ^~~~
a.cc:70:6: error: expected ';' after class definition
   70 |     }
      |      ^
      |      ;
a.cc: In static member function 'static void Tree::Rooted_Trees::Main(int*)':
a.cc:29:24: error: expected primary-expression before 'int'
   29 |             int size = int.Parse(Console.ReadLine());
      |                        ^~~
a.cc:30:13: error: 'var' was not declared in this scope
   30 |             var nodes = new Node[size];
      |             ^~~
a.cc:33:17: error: 'nodes' was not declared in this scope
   33 |                 nodes[i].parent = -1;
      |                 ^~~~~
a.cc:37:21: error: expected ';' before 'token'
   37 |                 var token = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
      |                     ^~~~~
a.cc:38:21: error: expected ';' before 'id'
   38 |                 var id = token[0];
      |                     ^~
a.cc:39:17: error: 'nodes' was not declared in this scope
   39 |                 nodes[id].id = id;
      |                 ^~~~~
a.cc:39:23: error: 'id' was not declared in this scope; did you mean 'i'?
   39 |                 nodes[id].id = id;
      |                       ^~
      |                       i
a.cc:41:21: error: expected ';' before 'k'
   41 |                 var k = token[1];
      |                     ^
a.cc:42:21: error: 'k' was not declared in this scope
   42 |                 if (k == 0) nodes[id].type = 2;
      |                     ^
a.cc:44:46: error: 'k' was not declared in this scope
   44 |                 nodes[id].childlen = new int[k];
      |                                              ^
a.cc:47:45: error: 'token' was not declared in this scope
   47 |                     nodes[id].childlen[j] = token[2 + j];
      |                                             ^~~~~
a.cc:54:21: error: 'nodes' was not declared in this scope
   54 |                 if (nodes[i].parent == -1)
      |                     ^~~~~
a.cc:58:17: error: expected ';' before 'sw'
   58 |             var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
      |                 ^~
a.cc:59:13: error: 'Console' was not declared in this scope
   59 |             Console.SetOut(sw);
      |             ^~~~~~~
a.cc:59:28: error: 'sw' was not declared in this scope
   59 |             Console.SetOut(sw);
      |                            ^~
a.cc:63:78: error: 'nodes' was not declared in this scope
   63 |                 Console.Write("node {0}: parent = {1}, depth = {2}, {3}, [", nodes[i].id, nodes[i].parent, nodes[i].depth, nodes[i].GetNodeType());
      |                                                                              ^~~~~
a.cc:64:31: error: 'string' was not declared in this scope
   64 |                 Console.Write(string.Join(", ", Array.ConvertAll(nodes[i].childlen, n => n.ToString())));
      |                               ^~~~~~
a.cc:64:49: error: 'Array' was not declared in this scope
   64 |                 Console.Write(string.Join(", ", Array.ConvertAll(nodes[i].childlen, n => n.ToString())));
      |                                                 ^~~~~
a.cc:64:85: error: 'n' was not declared in this scope
   64 |                 Console.Write(string.Join(", ", Array.ConvertAll(nodes[i].childlen, n => n.ToString())));
      |                                                                                     ^
a.cc:64:88: error: expected primary-expression before '>' token
   64 |                 Console.Write(string.Join(", ", Array.ConvertAll(nodes[i].childlen, n => n.ToString())));
      |                                                                                        ^