criyle/codenet-compile-errors huggingface dataset:
Language: C

#include<stdio.h>
#define MAX 1000
typedefstruct{
  int p,l,r;
}Rooted;
  struct Rooted N[MAX];
  int n,H,D[MAX];

int Depth(Rooted *N,int i){
  int d=0,x;
  while(N[i].p != -1){
    d++;
    x=N[i].p;
    i=x ;
  }
  return d;
}
void print(Rooted *N,int i){
  int c;
  printf("node %d: ",i);
  printf("parent = %d, ",N[i]);
  printf("depth = %d, ",Depth(N,i));
  if(N[i].p==-1)printf("root, ");
  if(N[i].p == -1 && N[i].l == -1)printf("leaf, ");
  if(N[i].p == -1 && N[i].l != -1)printf("internal node, ");
  printf("[");
  if(N[i].l != -1){
      printf("%d",N[i].l);
      c=N[i].l;
  while(N[c].r!=-1){ 
    printf(", %d",N[c].r);
     c=N[c].r;  
  }
  }
  printf("]\n");
}
    
int main(){
  int id,k,c;
  int i,j,l;
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    N[i].p=-1;
    N[i].l=-1;
    N[i].r=-1;
  }
  for(i=0;i<n;i++){
    scanf("%d%d",&id,&k);
    for(j=0;j<k;j++){
      scanf("%d",&c);
      if(j==0){
	N[id].l=c;
      }
      else N[l].r=c;
      l=c;
      N[c].p=id;
    }
  }
  for(i=0;i<n;i++)print(N,i);
  return 0;
}



Compiler output:
main.c:3:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    3 | typedefstruct{
      |              ^
main.c:5:2: warning: data definition has no type or storage class
    5 | }Rooted;
      |  ^~~~~~
main.c:5:2: error: type defaults to 'int' in declaration of 'Rooted' [-Wimplicit-int]
main.c:6:17: error: array type has incomplete element type 'struct Rooted'
    6 |   struct Rooted N[MAX];
      |                 ^
main.c:9:11: error: expected declaration specifiers or '...' before 'Rooted'
    9 | int Depth(Rooted *N,int i){
      |           ^~~~~~
main.c:18:12: error: expected declaration specifiers or '...' before 'Rooted'
   18 | void print(Rooted *N,int i){
      |            ^~~~~~
main.c: In function 'main':
main.c:60:19: error: implicit declaration of function 'print'; did you mean 'printf'? [-Wimplicit-function-declaration]
   60 |   for(i=0;i<n;i++)print(N,i);
      |                   ^~~~~
      |                   printf
Language: C

#include<stdio.h>
#define MAX 1000
typedef struct{
  int p,l,r;
}Rooted;
  struct Rooted N[MAX];
  int n,H,D[MAX];

int Depth(Rooted *N,int i){
  int d=0,x;
  while(N[i].p != -1){
    d++;
    x=N[i].p;
    i=x ;
  }
  return d;
}
void print(Rooted *N,int i){
  int c;
  printf("node %d: ",i);
  printf("parent = %d, ",N[i]);
  printf("depth = %d, ",Depth(N,i));
  if(N[i].p==-1)printf("root, ");
  if(N[i].p == -1 && N[i].l == -1)printf("leaf, ");
  if(N[i].p == -1 && N[i].l != -1)printf("internal node, ");
  printf("[");
  if(N[i].l != -1){
      printf("%d",N[i].l);
      c=N[i].l;
  while(N[c].r!=-1){ 
    printf(", %d",N[c].r);
     c=N[c].r;  
  }
  }
  printf("]\n");
}
    
int main(){
  int id,k,c;
  int i,j,l;
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    N[i].p=-1;
    N[i].l=-1;
    N[i].r=-1;
  }
  for(i=0;i<n;i++){
    scanf("%d%d",&id,&k);
    for(j=0;j<k;j++){
      scanf("%d",&c);
      if(j==0){
	N[id].l=c;
      }
      else N[l].r=c;
      l=c;
      N[c].p=id;
    }
  }
  for(i=0;i<n;i++)print(N,i);
  return 0;
}



Compiler output:
main.c:6:17: error: array type has incomplete element type 'struct Rooted'
    6 |   struct Rooted N[MAX];
      |                 ^
Language: C

#include <stdio.h>

int main(){
  int n,i,k,j;
  scanf("%d",&n);
  int id[n],c[n][100000];

  for(i=0;i<n;i++){
    scanf("%d",&id[i]);
    scanf("%d",&k);
    for(j=0;j<k;j++){
      scanf("%d",&c[i][j]);
    }
  }


    for(i=0;i<n;i++){
      printf("node %d: parent = %d, depth = %d, ",id[i],,);
      if(){
	printf("root, [");
	printf("]\n");
      }
      if(){
	printf("internal node, [");
	printf("]\n");
      }
      if(){
	printf("leaf, [");
	printf("]\n");
      }
    }

      return 0;
}



Compiler output:
main.c: In function 'main':
main.c:18:57: error: expected expression before ',' token
   18 |       printf("node %d: parent = %d, depth = %d, ",id[i],,);
      |                                                         ^
main.c:19:10: error: expected expression before ')' token
   19 |       if(){
      |          ^
main.c:23:10: error: expected expression before ')' token
   23 |       if(){
      |          ^
main.c:27:10: error: expected expression before ')' token
   27 |       if(){
      |          ^
Language: C

#include <stdio.h>
#include <stdlib.h>

struct node{
  int key;
  struct node *parent;
  struct node *right;
  struct node *left;
};
typedef struct node *Node;
Node T;
#define NIL NULL;

void Insert(int);
void Preorder(Node);
void Inoder(Node);

int main(){

  int n,i,key;
  char S[7];

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%s",S);
    if(S[0]=='i'){
      scanf("%d",&key);
      Insert(key);
    }
    else{
      Inoder(T);
      printf("\n");
      Preorder(T);
      printf("\n");
    }
  }
  return 0;
}
void Insert(int key){
  Node x,y,z;
  y=NIL;
  x=T;
  z=malloc(sizeof(struct node));
  z->key=key;
  z->left=NIL;
  z->right=NIL;
  while(x!=NULL){
    y=x;
    if(z->key < x->key ){
      x=x->left;}
      else{
        x=x->right;
      }
    }
      z->parent=y;
      if(y==NULL){
        T=z;
      }
      else if(z->key<y->key){
        y->left=z;
      }
      else{
        y->right=z;
      }
    }
    void Inorder(Node T){
      if(T->left!=NULL && T->right!=NULL){
        Inorder(T->left);
        printf(" %d",T->key);
        Inorder(T->right);
      }
      if(T->left!=NULL && T->right==NULL){
        Inorder(T->left);
        printf(" %d",T->key);
      }
      if(T->left==NULL && T->right!=NULL){
        printf(" %d",T->key);
        Inorder(T->right);
      }
      if(T->left==NULL && T->right==NULL){

        printf(" %d",T->key);

      }





    }



Compiler output:
/usr/bin/ld: /tmp/ccXzI8oS.o: in function `main':
main.c:(.text+0x84): undefined reference to `Inoder'
/usr/bin/ld: main.c:(.text+0x9d): undefined reference to `Preorder'
collect2: error: ld returned 1 exit status
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <mem.h>

#define N 100010
#define NIL (-1)
typedef struct {
    int parent;
    int left;
    int right;
}re;
re T[N];
int n;
int getDepth(re t){
    if(t.parent == NIL){
        return 0;
    }
    else return getDepth(T[t.parent]) + 1;
}

void printChild(re t){
    int firstchild = t.left;
    int res[n];
    int k = 0;
    if(firstchild != NIL){
        res[k++] = firstchild;
        while(T[firstchild].right != NIL){
            res[k++] = T[firstchild].right;
            firstchild = T[firstchild].right;
        }
        printf("[");
        for(int i = 0; i < k; i++){
            if(i == k-1){
                printf("%d]\n", res[i]);
            }
            else printf("%d, ", res[i]);
        }
    }
    else{
        printf("[]\n");
    }
}
int main(){

    scanf("%d", &n);
    for(int i = 0; i < n; i++) T[i].parent = T[i].left = T[i].right = NIL;

    for(int p = 0; p < n; p++){
        int node, time;
        scanf("%d %d", &node, &time);
        int c;
        for(int k = 0; k < time; k++){
            int t;
            scanf("%d", &t);
            if(k == 0){
                T[node].left = t;
            }
            else{
                T[c].right = t;
            }
            c = t;
            T[c].parent = node;
        }
    }

    for(int i = 0; i < n; i++){
        int depth = getDepth(T[i]);
        char s[30];
        if(T[i].parent == NIL){
            strcpy(s, "root");
        }
        else{
            if(T[i].left == NIL){
                strcpy(s, "leaf");
            }
            else{
                strcpy(s, "internal node");
            }
        }

        printf("node %d: parent = %d, depth = %d, %s, ", i, T[i].parent, depth, s);
        printChild(T[i]);
    }
    return 0;
}


Compiler output:
main.c:3:10: fatal error: mem.h: No such file or directory
    3 | #include <mem.h>
      |          ^~~~~~~
compilation terminated.
Language: C

#include<iostream>
#include<stdio.h>
using namespace std;
#define MAX 1000005
#define NIL -1

struct Node { int p, l, r; };

Node T[MAX];
int n, D[MAX];

void print(int u) {
	int i, c;
	printf("node %d; ", u);
	printf("parent = %d ", T[u].p);
	printf(", ");
	printf("depth = %d ", D[u]);
	printf(", ");

	if (T[u].p == NIL) {
		printf("root,");
	}
	else if (T[u].l == NIL) {
		printf("leaf,");
	}
	else {
		printf("internal node,");
	}

	printf(" [");
	for (i = 0, c = T[u].l; c != NIL; i++, c = T[c].r) {
		if (i != 0) { printf(","); }
			printf("%d", c);
	}
	printf("]\n");
}

//再帰的に深さを求める
int rec(int u, int p) {
	D[u] = p;
	if (T[u].r != NIL) {
		rec(T[u].r, p);//右の兄弟にも同じ深さを設定する
	}
	if (T[u].l != NIL) {
		rec(T[u].l, p + 1);//左の子が存在する場合はその子に対して深さを一つ足して再帰呼び出しを行う
	}
	return D[u];
}


int main(void) {
	int i, j, d, v, c, l, r;
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		T[i].p = T[i].l = T[i].r = NIL;//節点の初期化。この場合、どの点も他の節点とつながっていない
	}

	for (i = 0; i < n; i++) {
		scanf("%d%d", &v, &d);
		for (j = 0; j < d; j++) {
			scanf("%d", &c);
			if (j == 0)T[v].l = c;
			else T[l].r = c;
			l = c;
			T[c].p = v;
		}
	}
	for (i = 0; i < n; i++) {
		if (T[i].p == NIL)r = i;
	}

	rec(r, 0);

	for (i = 0; i < n; i++) {
		print(i);
	}

	return 0;

	
}


Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C

#include<stdio.h>
#define null -1

 struct Node{
         int parent;
         int left;
         int right;
         };

 struct Node node[100001];
 D[100001];

 void print(int i){
         int j,c;
         printf("node %d: ",i);
         if(node[i].parent==null)printf("parent -1, ",i);
         else printf("parent %d, ",node[i].parent);
         printf("depth %d, ",D[i]);
         if(node[i].parent==null)printf("root, "); 
         else if(node[i].left==null)printf("leaf, ");
         else printf("internal node, ");

         c=node[i].left;
         printf("[");
         for(j=0;c!=null;j++){
                  if(j)printf(", ");
                  printf("%d",c);
                  c=node[c].right;
                 }
         printf("[");
         }
         
         


 void deep(root,u){
         D[root]=u;
         if(D[root].left!=null)deep(root,u+1);
         if(D[root].right!=null)deep(root,u);
         }

 int main(){
         int i,n,c,j,root,v,C,left;
         scanf("%d",&n);
         for(i=0;i<n;i++){node[i].right=node[i].left=node[i].parent=null;}
         for(i=0;i<n;i++){
                   scanf("%d%d",&v,&c);
                   for(j=0;j<c;j++){
                             scanf("%d",&C);
                             if(j==0)node[v].left=C;
                             else node[left].right=C;
                             left=C;
                             node[C].parent=v;
                             }
                   }

         for(i=0;i<n;i++){if(node[i].parent==null)root=i;}
         deep(root,0);
         for(i=0;i<n;i++){print(i);}
         return 0;
         }












Compiler output:
main.c:11:2: warning: data definition has no type or storage class
   11 |  D[100001];
      |  ^
main.c:11:2: error: type defaults to 'int' in declaration of 'D' [-Wimplicit-int]
main.c: In function 'deep':
main.c:36:7: error: type of 'root' defaults to 'int' [-Wimplicit-int]
   36 |  void deep(root,u){
      |       ^~~~
main.c:36:7: error: type of 'u' defaults to 'int' [-Wimplicit-int]
main.c:38:20: error: request for member 'left' in something not a structure or union
   38 |          if(D[root].left!=null)deep(root,u+1);
      |                    ^
main.c:39:20: error: request for member 'right' in something not a structure or union
   39 |          if(D[root].right!=null)deep(root,u);
      |                    ^
Language: C

#include<stdio.h>
#define null -1

 struct Node{
         int parent;
         int left;
         int right;
         };

 struct Node node[100001];
 D[100001];

 void print(int i){
         int j,c;
         printf("node %d: ",i);
         if(node[i].parent==null)printf("parent -1, ",i);
         else printf("parent %d, ",node[i].parent);
         printf("depth %d, ",deep(i));
         if(node[i].parent==null)printf("root, "); 
         else if(node[i].left==null)printf("leaf, ");
         else printf("internal node, ");

         c=node[i].left;
         printf("[");
         for(j=0;c!=null;j++){
                  if(j)printf(", ");
                  printf("%d",c);
                  c=node[c].right;
                 }
         printf("[");
         }
         
         


 void deep(u){
         int d=0;
         while(node[u].parent!=null){
                     u=T[u].parent;
                     d++;
                     }
         return d;
         }

 int main(){
         int i,n,c,j,root,v,C,left;
         scanf("%d",&n);
         for(i=0;i<n;i++){node[i].right=node[i].left=node[i].parent=null;}
         for(i=0;i<n;i++){
                   scanf("%d%d",&v,&c);
                   for(j=0;j<c;j++){
                             scanf("%d",&C);
                             if(j==0)node[v].left=C;
                             else node[left].right=C;
                             left=C;
                             node[C].parent=v;
                             }
                   }

         for(i=0;i<n;i++){if(node[i].parent==null)root=i;}
         
         for(i=0;i<n;i++){print(i);}
         return 0;
         }












Compiler output:
main.c:11:2: warning: data definition has no type or storage class
   11 |  D[100001];
      |  ^
main.c:11:2: error: type defaults to 'int' in declaration of 'D' [-Wimplicit-int]
main.c: In function 'print':
main.c:18:30: error: implicit declaration of function 'deep' [-Wimplicit-function-declaration]
   18 |          printf("depth %d, ",deep(i));
      |                              ^~~~
main.c: At top level:
main.c:36:7: warning: conflicting types for 'deep'; have 'void()'
   36 |  void deep(u){
      |       ^~~~
main.c:18:30: note: previous implicit declaration of 'deep' with type 'void()'
   18 |          printf("depth %d, ",deep(i));
      |                              ^~~~
main.c: In function 'deep':
main.c:36:7: error: type of 'u' defaults to 'int' [-Wimplicit-int]
   36 |  void deep(u){
      |       ^~~~
main.c:39:24: error: 'T' undeclared (first use in this function)
   39 |                      u=T[u].parent;
      |                        ^
main.c:39:24: note: each undeclared identifier is reported only once for each function it appears in
main.c:42:17: error: 'return' with a value, in function returning void [-Wreturn-mismatch]
   42 |          return d;
      |                 ^
main.c:36:7: note: declared here
   36 |  void deep(u){
      |       ^~~~
Language: C

#include<stdio.h>
#include<stdlib.h>
#define MAX 100000
#define NIL -1

typedef struct node {
    int p;
    int l;
    int r;
} Node;

Node no[MAX];
int D[MAX];



int setDepth(int u, int p){
    D[u] = p;
    if(no[u].l != NIL){
        setDepth(no[u].l, p + 1);
    } 
    if (no[u].r != NIL){
        setDepth(no[u].r, p);
    }
}

void print(int u){
    int i, c;
    printf("node ");
    printf("%d: ", u);

    printf("parent = %d, ", no[u].p);
    printf("depth = %d, ",  D[u]);
    if(no[u].p == NIL) printf("root, ");
    else if (no[u].l == NIL ) printf("leaf, ");
    else printf("internal node, ");

    printf("[");
    for(i = 0, c = no[u].l; c != NIL; i++, c = no[c].r){
        if(i) printf(", ");
        printf("%d", c);
    }
    printf("]");

    printf("\n");


}

int main(){
    int n, i, j, v, l = 0;
    int tmp;
    int a[10];

    scanf("%d", &n);
    /* initialize */
    for(i = 0; i < n; i++){
        no[i].p = no[i].l = no[i].r = NIL;
    }

    for(i = 0; i < n; i++){
        int id, k;
        scanf("%d%d", &id, &k);
    
        for(j = 0; j < k; j++){
            int c;
            tmp = scanf("%d", &c);
            if(j == 0) no[id].l = c;
            else no[l].r = c;
            l = c;
            no[t].p = id;
        }
    }

    int r;
    for(i = 0; i < n; i++){
        if(no[i].p == NIL) r = i;
    }
    setDepth(r, 0);
    for(i = 0; i < n; i++) print(i);
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:71:16: error: 't' undeclared (first use in this function)
   71 |             no[t].p = id;
      |                ^
main.c:71:16: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<iostream>
#include<stdio.h>
using namespace std;
const int MAX=100005;
const int NIL=-1;
struct Node{
	int p,l,r;
};
Node t[MAX];
int n,dep[MAX];
void rec(int u,int p){
	dep[u]=p;
	if(t[u].r!=NIL)	rec(t[u].r,p);
	if(t[u].l!=NIL)	rec(t[u].l,p+1);
}
void print(int u){
	int c;
	printf("node %d: parent = %d, depth = %d, ",u,t[u].p,dep[u]);
	if(t[u].p==NIL)	cout<<"root, ";
	else if(t[u].l==NIL)	cout<<"leaf, ";
	else cout<<"internal node, ";
	cout<<"[";
	for(int i=0,c=t[u].l;c!=NIL;i++,c=t[c].r){
		if(i)	cout<<", ";
		cout<<c;
	}
	cout<<"]"<<endl;
}
int main(){
	int d,v,c,l,r;
	cin>>n;
	for(int i=0;i<n;i++)
		t[i].p=t[i].l=t[i].r=NIL;
	for(int i=0;i<n;i++){
		cin>>v>>d;
		for(int j=0;j<d;j++){
			cin>>c;
			if(j==0)	t[v].l=c;
			else t[l].r=c;
			l=c;
			t[c].p=v;
		}
	}
	for(int i=0;i<n;i++)
		if(t[i].p==NIL)	r=i;
	rec(r,0);
	for(int i=0;i<n;i++)
		print(i);
	return 0;
}


Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C

#include<iostream>
using namespace std;
#define MAX 10000
#define NIL -1

typedef struct {
	int p, l, r;
} Node;

Node T[MAX];
int n, D[MAX];

void print(int u) {
	int i, c;

	printf("node %d: ", u);
	printf("parent = %d,", T[u].p);
	printf("depth = %d,", D[u]);

	if (T[u].p == NIL) printf("root, ");
	else if (T[u].l == NIL) printf("leaf, ");
	else printf("internal node, ");

	printf("[");
	for (i = 0, c = T[u].l; c != NIL; i++, c = T[u].r) {
		if (i) printf(", ");
		printf("%d", c);
	}
	printf("]\n");
}

int rec(int u, int p) {
	D[u] = p;
	if (T[u].r != NIL) rec(T[u].r, p);
	if (T[u].l != NIL) rec(T[u].l, p + 1);
}

int main() {
	int i, j, d, v, c, l, r;

	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		T[i].p = T[i].l = T[i].r = NIL;
	}

	for (i = 0; i < n; i++) {
		scanf("%d %d", &v, &d);
		for (j = 0; j < d; j++) {
			scanf("%d", &c);
			if (j == 0) T[v].l = c;
			else T[l].r = c;
			l = c;
			T[c].p = v;
		}
	}

	for (i = 0; i < n; i++) {
		if (T[i].p == NIL) r = i;
	}

	rec(r, 0);
	for (i = 0; i < n; i++) {
		print(i);
	}

	return 0;
}


Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C

#include<iostream>
using namespace std;
#define MAX 10000
#define NIL -1

typedef struct {
	int p, l, r;
} Node;

Node T[MAX];
int n, D[MAX];

void print(int u) {
	int i, c;

	printf("node %d: ", u);
	printf("parent = %d ,", T[u].p);
	printf("depth = %d ,", D[u]);

	if (T[u].p == NIL) printf("root, ");
	else if (T[u].l == NIL) printf("leaf, ");
	else printf("internal node, ");

	printf("[");
	for (i = 0, c = T[u].l; c != NIL; i++, c = T[u].r) {
		if (i) printf(", ");
		printf("%d", c);
	}
	printf("]\n");
}

int rec(int u, int p) {
	D[u] = p;
	if (T[u].r != NIL) rec(T[u].r, p);
	if (T[u].l != NIL) rec(T[u].l, p + 1);
	//if (T[u].p == NIL) return 0;
}

int main() {
	int i, j, d, v, c, l, r;

	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		T[i].p = T[i].l = T[i].r = NIL;
	}

	for (i = 0; i < n; i++) {
		scanf("%d %d", &v, &d);
		for (j = 0; j < d; j++) {
			scanf("%d", &c);
			if (j == 0) T[v].l = c;
			else T[l].r = c;
			l = c;
			T[c].p = v;
		}
	}

	for (i = 0; i < n; i++) {
		if (T[i].p == NIL) r = i;
	}

	rec(r, 0);
	for (i = 0; i < n; i++) {
		print(i);
	}

	return 0;
}


Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C

#include<stdio.h>
#define N 100001
#define NIL -1

typedef struct {
  int parent, left, right;
}Node;

Node Tree[N]; 
void print(int);
int Depth[N];



int main(VOID){
  int i, j, n, cc, child[N], node;
  scanf("%d", &n);
  
  for ( i = 0; i < n; i++ ) {
    Tree[i].parent = NIL;
    Tree[i].left = NIL;
    Tree[i].right = NIL;
  }
  
  

  for(i=0; i < n; i++ ){
    scanf("%d %d", &node, &cc);
    for(j=0; j < cc; j++){
      scanf("%d", &child[j]);
      
      Tree[child[j]].parent = node;
      if(j == 0) Tree[node].left = child[0];
      else Tree[child[j-1]].right = child[j]; 
    }
  }
  
  for(i=0; i<n;i++) Depth[i] = getDepth(i);
  for ( i = 0; i < n; i++ ) print(i);
  
  return 0;
}





int getDepth(int in){
  int d=0;
  
  while(Tree[in].parent >= 0){
    in = Tree[in].parent;  
    d++;
  }
  
  return d;
}


void print(int node){
  int i, count=0;
  
  printf("node %d: parent = %d, depth = %d ",node ,Tree[node].parent, Depth[node],);
  
  if(Tree[node].parent == NIL)
    printf("root, [");
  
  else if(Tree[node].left == NIL)
    printf("leaf, [");
  
  else
    printf("internal node, [");
  
  node = Tree[node].left;
  while(node != NIL){
    if(count==0) printf("%d", node);
    else printf(", %d", node);
    
    node = Tree[node].right;
    count++;
    
  }
  
  
  printf("]\n");
  
}

Compiler output:
main.c: In function 'main':
main.c:15:5: error: type of 'VOID' defaults to 'int' [-Wimplicit-int]
   15 | int main(VOID){
      |     ^~~~
main.c:38:32: error: implicit declaration of function 'getDepth' [-Wimplicit-function-declaration]
   38 |   for(i=0; i<n;i++) Depth[i] = getDepth(i);
      |                                ^~~~~~~~
main.c: In function 'print':
main.c:63:83: error: expected expression before ')' token
   63 |   printf("node %d: parent = %d, depth = %d ",node ,Tree[node].parent, Depth[node],);
      |                                                                                   ^
Language: C

#include<stdio.h>

typedef struct{
  int id;
  int degree;
  int c[100];
  int parent;
  int depth;
}Tree;

main(){
  int i,j,k,g,x,count;
  Tree node[100];
  scanf("%d",&g);
  for(i=0;i<g;i++){
    scanf("%d%d",&node[i].id,&node[i].degree);
    for(j=0;j<node[i].degree;j++)scanf("%d",&node[i].c[j]);
  }
  for(i=0;i<g;i++){
    for(j=0;j<g;j++){
      count=0;
      for(k=0;k<node[j].degree;k++){
	if(node[i].id==node[j].c[k]){
	  node[i].parent=node[j].id;
          count++;
	  break;
	}}
      if(count>0)break;
      else node[i].parent = -1;
      }
      
  }
  for(i=0;i<g;i++){
    node[i].depth=0;
    if(node[i].parent==-1)continue;
    if(node[i].parent>=0)node[i].depth++;
    x=node[i].parent;
    while(1){
      if(node[x].parent>=0){
	node[i].depth++;
	x = node[x].parent;
      }
      else  break;
    }
  }
  for(i=0;i<g;i++){
    printf("node %d: parent = %d, depth = %d, ",node[i].id,node[i].parent,node[i].depth);
    if(node[i].depth==0)printf("root,");
    else if(node[i].depth>=0 && node[i].degree>0)printf("internal node,");
    else if(node[i].degree==0){
      printf("leaf, []\n");
      continue;
    }
    printf(" [");
    for(j=0;j<node[i].degree;j++){
      printf("%d",node[i].c[j]);
      if(j>=0 && j<node[i].degree-1)printf(", ");
    }
    printf("]\n");
  }
  return o;
}

Compiler output:
main.c:11:1: error: return type defaults to 'int' [-Wimplicit-int]
   11 | main(){
      | ^~~~
main.c: In function 'main':
main.c:61:10: error: 'o' undeclared (first use in this function)
   61 |   return o;
      |          ^
main.c:61:10: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
#define N 100000
#define M -1


struct Node{
  int parent;
  int left;
  int right;
};
struct Node T[N];
int count=0;
 
int depth(int nodeid) {
  if(T[nodeid].parent == M) {
    return count;
  }
  else {
 count++;
 return depth(T[nodeid].parent);
  }
}
 
void degree(int nodeid) {
  if(nodeid != M) {
    if(count != 0){
      printf(", ");
    }
    printf("%d",nodeid);
    count++;
    degree(T[nodeid].right);
  }
}  

main(){

  int i,j,n,m,newnode,child,left,right;

  scanf("%d",&n);

  for(i=0;i<n;i++)
    T[i].parent = T[i].left = T[i].right = M;
 
  for(i=0;i<n;i++) {
    scanf("%d%d",&newnode,&m);
    for(j=0;j<m;j++) {
      scanf("%d",&child);
      T[child].parent = newnode;
      if(j != 0) {
	T[left].right = child;
      }
      else {
	T[newnode].left = child;
      }
      left = child;
    }
  }
  for(i=0;i<n;i++) {
    cnt = 0;
    printf("node %d: parent = %d, depth = %d, ",i,T[i].parent,depth(i));
    if(T[i].parent == NIL) {
      printf("root, [");
    }
    else if (T[i].left == NIL) {
      printf("leaf, [");
    } 
    else  {
      printf("internal node, [");
    }   
    cnt=0;
    degree(T[i].left);
    printf("]\n");
  }
  return 0;

}

Compiler output:
main.c:35:1: error: return type defaults to 'int' [-Wimplicit-int]
   35 | main(){
      | ^~~~
main.c: In function 'main':
main.c:59:5: error: 'cnt' undeclared (first use in this function); did you mean 'int'?
   59 |     cnt = 0;
      |     ^~~
      |     int
main.c:59:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:61:23: error: 'NIL' undeclared (first use in this function)
   61 |     if(T[i].parent == NIL) {
      |                       ^~~
Language: C

#include<stdio.h>
#define N 100005
#define NIL -1
struct Node{
int p,l,r;
};

struct Node T[N];

void print(int u){
  if(T[u].p == NIL)
    printf("node %d: parent = %d, depth = %d, root, ",u,T[u].p,D[u]);
  
  else if(T[u].l == NIL)
    printf("node %d: parent = %d, depth = %d, leaf, ",u,T[u].p,D[u]);
  
  
  else printf("node %d: parent = %d, depth = %d, internal node, ",u,T[u].p,D[u]);
  
  
  printf("[");
  int t; 
  t = u;
  if(T[t].l  != NIL){
    printf("%d",T[t].l);
    if(T[T[t].l].r == NIL)
      printf("]\n");
    else printf(",");
    t =T[t].l;
    while(T[t].r != NIL){
      printf(" %d",T[t].r);
      
      if(T[T[t].r].r == NIL)
	printf("]\n");
      else printf(",");
      t =T[t].r;
    }
  }
  else  printf("]\n");
}

int getDepth(int u){
  int d = 0;
  
  while(T[u].p >= 0){
    u = T[u].p; 
    d++;
  }
  
  return d;
}


int H,D[N];

main(){
  int i,j,n,id,k,c,r;
 
 scanf("%d",&n);
 
 for(i=0;i<n;i++){
  scanf("%d %d",&id,&k);
 for(j=0;j<k;k++){
  scanf("%d",&c);
 T[c].p = id;
 if(j==0)
  T[id].l= c;
 else if(j>=1)
	T[r].r= c;
 r=c;
 }
 }
 for ( i = 0; i < n; i++ ){
  D[i] = getDepth(i);
 }
 for ( i = 0; i < n; i++ ) print(i);
 return 0; 
}

Compiler output:
main.c: In function 'print':
main.c:12:64: error: 'D' undeclared (first use in this function)
   12 |     printf("node %d: parent = %d, depth = %d, root, ",u,T[u].p,D[u]);
      |                                                                ^
main.c:12:64: note: each undeclared identifier is reported only once for each function it appears in
main.c: At top level:
main.c:56:1: error: return type defaults to 'int' [-Wimplicit-int]
   56 | main(){
      | ^~~~
Language: C

#include <stdio.h>
#include <string.h>
#define MAX 100005
typedef struct {
  int parent;
  int id;
  int chc;
  int chil[150];
  
}Node;
  
Node tree[MAX];
int CH[MAX];
int n;
void createnode(int);
void printtree(int);
int s_dep(int,int,int);
int main(){

  int i,t,id,deg;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    tree[i].parent=-1;
    tree[i].id=-1;
    tree[i].chc=-1;

}

  for(i=0;i<n;i++){
    scanf("%d%d",&id,&deg);
    tree[id].chc=deg;
    for(t=0;t<deg;t++){
      scanf("%d",&CH[t]);
      tree[CH[t]].parent=id;
      tree[id].chil[t]=CH[t];
    }    
  }

  for(i=0;i<n;i++) printtree(i);
  
  return 0;
}

void printtree(int id){
  int i,chc;
  chc=tree[id].chc;
  printf("node %d: ",id);
  printf("parent = %d, ",tree[id].parent);
  printf("depth = %d, ",s_dep(id,0,id));
  if(tree[id].parent==-1) printf("root, [");
  else if(tree[id].chc>0) printf("internal node, [");
  else printf("leaf, [");
  for(i=0;i<chc;i++){
    printf("%d",tree[id].chil[i]);
    if(i<chc-1)printf(", ");
  }
  printf("]\n");
  





}

Compiler output:
/usr/bin/ld: /tmp/ccqyhead.o: in function `printtree':
main.c:(.text+0x247): undefined reference to `s_dep'
collect2: error: ld returned 1 exit status
Language: C

#include <stdio.h>
#include <stdlib.h>

#define N 100000

typedef struct{
  int id;
  int p;
  int c;
  int right_sibling;
  int child[N];
} Tree;

int n;
Tree T[N];

void print(){

  int i,j;

  for(i=0;i<n;i++){
    if(T[i].c == 0 && T[i].p != -1){
      printf("node %d: parent = %d, depth = %d, leaf, []\n",T[i].id,T[i].p,getdepth(i));
    }
    else if(T[i].c != 0 && T[i].p != -1){
      printf("node %d: parent = %d, depth = %d, internal node, [",T[i].id,T[i].p,getdepth(i));
      for(j=0;j<T[i].c;j++){
	if(j == T[i].c - 1){
	  printf("%d]\n",T[i].child[j]);
	}
	else{
	  printf("%d, ",T[i].child[j]);
	}  
      }
    }
    else{
      if(n == 1){
	printf("node %d: parent = %d, depth = %d, root, []\n",T[i].id,T[i].p,getdepth(i));
      }
      else{
	printf("node %d: parent = %d, depth = %d, root, [",T[i].id,T[i].p,getdepth(i));
	for(j=0;j<T[i].c;j++){
	  if(j == T[i].c - 1){
	    printf("%d]\n",T[i].child[j]);
	  }
	  else{
	    printf("%d, ",T[i].child[j]);
	  }
	}
      }
    }
  }
}

int getdepth(u){

  int i,d = 0;

  while(T[u].p >= 0){
    u = T[u].p;
    d++;
  }
  return d;
}


int main(void){

  int i,j,k=0,node,deg;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    T[i].id = 0;
    T[i].p = -1;
    T[i].c = 0;
    for(j=0;j<n;j++){
      T[i].child[j] = -1;
    }  
  }

  for(i=0;i<n;i++){
    scanf("%d %d",&node,&deg);
    T[node].id = node;
    T[node].c = deg;
    for(j=0;j<deg;j++){
      scanf("%d",&T[node].child[j]);
      T[T[node].child[j]].p = node;
      } 
    k = 0;
  }
  print();
  return 0; 
}

Compiler output:
main.c: In function 'print':
main.c:23:76: error: implicit declaration of function 'getdepth' [-Wimplicit-function-declaration]
   23 |       printf("node %d: parent = %d, depth = %d, leaf, []\n",T[i].id,T[i].p,getdepth(i));
      |                                                                            ^~~~~~~~
main.c: In function 'getdepth':
main.c:55:5: error: type of 'u' defaults to 'int' [-Wimplicit-int]
   55 | int getdepth(u){
      |     ^~~~~~~~
Language: C

#include <stdio.h>
#define N 100000

typedef struct{
  int id;
  int parent;
  int child;
  int right_sibling;
} Node;

main(){
  int n, i, j;
  int id, degree, depth, parent;
  int c[N];
  Node node[N];

  scanf("%d", &n);

  for( i = 0; i < n; i++){
    node[i].parent = -1;
    node[i].child = -1;
    node[i].right_sibling = -1;
  }

  for( i = 0; i < n; i++){
    c[0] = -1;
    scanf("%d%d", &id, &degree);

    for( j = 0; j < degree; j++){
      scanf("%d", &c[j]);
    }

    node[id].id = id;
    node[id].child = c[0];

    for( j = 0; j < degree; j++){
      node[c[j]].parent = id;
    }
    if( degree <= 1 ) node[c[0]].right_sibling = -1;
    else {
      for( j = 0; j < degree; j++){
        node[c[j]].right_sibling = c[j+1];
        if( j+1 == dgree-1 ) break;
      }
      for( j = 0; j <= degree; j++){
        c[j] = -1;
      }
    }
  }

  for( i = 0; i < n; i++){
    printf("node %d: parent = %d, ", node[i].id, node[i].parent);

    depth = 0;
    parent = node[i].parent;
    while(1){
      if( parent == -1 ) break;
      else {
        parent = node[parent].parent;
        depth++;
      }
    }

    printf("depth = %d, ", depth);
    printf("right_sibling = %d, ", node[i].right_sibling);

    if( node[i].parent == -1 ){
      printf("root, [");
    }
    else if( node[i].child == -1 ){
      printf("leaf, [");
    }
    else printf("internal node, [");

    if( node[i].child != -1 ){
      printf("%d", node[i].child);
      degree = node[i].child;
      while(1){
        if( node[degree].right_sibling == -1 ) break;
        else {
          printf(", %d", node[degree].right_sibling);
        degree = node[degree].right_sibling;
        }
      }
    }
    printf("]\n");
  }

  return 0;

}

Compiler output:
main.c:11:1: error: return type defaults to 'int' [-Wimplicit-int]
   11 | main(){
      | ^~~~
main.c: In function 'main':
main.c:43:20: error: 'dgree' undeclared (first use in this function); did you mean 'degree'?
   43 |         if( j+1 == dgree-1 ) break;
      |                    ^~~~~
      |                    degree
main.c:43:20: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
#define MAX 100000
#define NIL -1

struct Node{
  int p;
  int l;
  int r;
};

struct Node Three[MAX];

int getDepth(int K){
  int depth = 0;

  for(depth = 0; T[k].p != NIL; depth++){
    K = Three[K].p;
  }
return depth;
}

main(){
  int i,j,n;
  int num,deg,child,l = 0;

  scanf("%d",&n);

  for(i = 0; i < n; i++){
    Three[i].p = NIL;
    Three[i].l = NIL;
    Three[i].r = NIL;
  }

  for(i = 0; i < n; i++){
    scanf("%d%d",&num,&deg);

    for(j = 0; j < deg; j++){
      scanf("%d",&child);
      if(j == 0) Three[num].l = child;
      l = child;
      Three[child].p = num;
    }
  }

  for(i = 0; i < n; i++){
    printf("node %d: parent = %d, depth = %d", i, Three[i].p, getDepth(i));

    if(getDepth(i) == 0){
      printf(", root, [");
    }
    else if(Three[i].l == NIL){
      printf(", leaf, [");
    }
    else{
      printf(", internal node, [");
    }

    j = Three[i].l;

    while(j != NIL){
      printf("%d", j);
      j = Three[j].r;

      if(j != NIL){
	printf(", ");
      }
    }
    printf("]\n");
  }

  return 0;
}

Compiler output:
main.c: In function 'getDepth':
main.c:16:18: error: 'T' undeclared (first use in this function)
   16 |   for(depth = 0; T[k].p != NIL; depth++){
      |                  ^
main.c:16:18: note: each undeclared identifier is reported only once for each function it appears in
main.c:16:20: error: 'k' undeclared (first use in this function)
   16 |   for(depth = 0; T[k].p != NIL; depth++){
      |                    ^
main.c: At top level:
main.c:22:1: error: return type defaults to 'int' [-Wimplicit-int]
   22 | main(){
      | ^~~~
Language: C

#include<stdio.h>
#define MAX 100001
#define ZERO -1
 
typedef struct Node{
  int parent; 
  int left,right;
}Tree;
 
Tree tree[MAX];
 
void Treeprint(int);
 
int main(){
  int n,i,j,id,k,child,l;
 
  scanf("%d", &n);
 
  for(i = 0;i < n;i++){
    tree[i].parent = tree[i].left = tree[i].right = ZERO;
   
  for(i = 0;i < n;i++){
    scanf("%d%d",&id,&k);
     
    for(j = 0;j < k;j++){
      scanf("%d",&child); 
      tree[child].parent = id; 
 
      if(j == 0){
    tree[id].left = child;
      }
      else if(j > 0){
    tree[l].right = child;
      }
      l = child;
    }
  }
  for(i = 0;i < n;i++){
    Treeprint(i);
  }
  return 0;
}
 
void Treeprint(int n){ 
  int i = tree[n].parent;
  int depth = 0;
  while(i != ZERO){
    i = tree[i].parent;
    depth++;
  }
  if(depth == 0){
    printf("node %d: parent = %d, depth = %d, root, ",n,tree[n].parent,depth);
  }
  else if(tree[n].left == ZERO){
    printf("node %d: parent = %d, depth = %d, leaf, ",n,tree[n].parent,depth);
  }
  else{
    printf("node %d: parent = %d, depth = %d, internal node, ",n,tree[n].parent,depth);
  }
 
  i = tree[n].left;
  printf("[");
  if(i != ZERO){
    printf("%d",i);
  }
  while(i != ZERO){ 
    i = tree[i].right;
 
    if(i != ZERO){
      printf(", %d", i);
    }
  }
  printf("]\n");
}

Compiler output:
main.c: In function 'main':
main.c:74:1: error: expected declaration or statement at end of input
   74 | }
      | ^
Language: C

#include<stdio.h>
#define MAX 100001
#define ZERO -1
 
typedef struct Node{
  int parent; 
  int left,right;
}Tree;
 
Tree tree[MAX];
 
void Treeprint(int);
 
int main(){
  int n,i,j,id,k,child,l;
 
  scanf("%d", &n);
 
  for(i = 0;i < n;i++){
    tree[i].parent = tree[i].left = tree[i].right = ZERO;
   
  for(i = 0;i < n;i++){
    scanf("%d%d",&id,&k);
     
    for(j = 0;j < k;j++){
      scanf("%d",&child); 
      tree[child].parent = id; 
 
      if(j == 0){
    tree[id].left = child;
      }
      else if(j > 0){
    tree[l].right = child;
      }
      l = child;
    }
  }
  for(i = 0;i < n;i++){
    Treeprint(i);
  }
  return 0;
}
 
void Treeprint(int n){ 
  int i = tree[n].parent;
  int depth = 0;
  while(i != ZERO){
    i = tree[i].parent;
    depth++;
  }
  if(depth == 0){
    printf("node %d: parent = %d, depth = %d, root, ",n,tree[n].parent,depth);
  }
  else if(tree[n].left == ZERO){
    printf("node %d: parent = %d, depth = %d, leaf, ",n,tree[n].parent,depth);
  }
  else{
    printf("node %d: parent = %d, depth = %d, internal node, ",n,tree[n].parent,depth);
  }
 
  i = tree[n].left;
  printf("[");
  if(i != ZERO){
    printf("%d",i);
  }
  while(i != ZERO){ 
    i = tree[i].right;
 
    if(i != ZERO){
      printf(", %d", i);
    }
  }
  printf("]\n");
  return 0;
}

Compiler output:
main.c: In function 'Treeprint':
main.c:74:10: error: 'return' with a value, in function returning void [-Wreturn-mismatch]
   74 |   return 0;
      |          ^
main.c:44:6: note: declared here
   44 | void Treeprint(int n){
      |      ^~~~~~~~~
main.c: In function 'main':
main.c:75:1: error: expected declaration or statement at end of input
   75 | }
      | ^
Language: C

#include<stdio.h>
#define MAX 100001
#define ZERO -1
 
typedef struct Node{
  int parent; 
  int left,right;
}Tree;
 
Tree tree[MAX];
 
void Treeprint(int);
 
int main(){
  int n,i,j,id,k,child,l;
 
  scanf("%d", &n);
 
  for(i = 0;i < n;i++){
    tree[i].parent = tree[i].left = tree[i].right = ZERO;
   
  for(i = 0;i < n;i++){
    scanf("%d%d",&id,&k);
     
    for(j = 0;j < k;j++){
      scanf("%d",&child); 
      tree[child].parent = id; 
 
      if(j == 0){
    tree[id].left = child;
      }
      else if(j > 0){
    tree[l].right = child;
      }
      l = child;
    }
  }
  for(i = 0;i < n;i++){
    Treeprint(i);
  }
  return 0;
}
 
void Treeprint(int n){ 
  int i = tree[n].parent;
  int depth = 0;
  while(i != ZERO){
    i = tree[i].parent;
    depth++;
  }
  if(depth == 0){
    printf("node %d: parent = %d, depth = %d, root, ",n,tree[n].parent,depth);
  }
  else if(tree[n].left == ZERO){
    printf("node %d: parent = %d, depth = %d, leaf, ",n,tree[n].parent,depth);
  }
  else{
    printf("node %d: parent = %d, depth = %d, internal node, ",n,tree[n].parent,depth);
  }
 
  i = tree[n].left;
  printf("[");
  if(i != ZERO){
    printf("%d",i);
  }
  while(i != ZERO){ 
    i = tree[i].right;
 
    if(i != ZERO){
      printf(", %d", i);
    }
  }
  printf("]\n");
  return 0;
}
}

Compiler output:
main.c: In function 'Treeprint':
main.c:74:10: error: 'return' with a value, in function returning void [-Wreturn-mismatch]
   74 |   return 0;
      |          ^
main.c:44:6: note: declared here
   44 | void Treeprint(int n){
      |      ^~~~~~~~~
Language: C

#include<stdio.h>

#define MAX 100005
#define NIL -1

struct Node{
  int p;
  int l;
  int r;
};

struct Node N[MAX];

int n, H, D[MAX];

int getDepth(int u){
  int d = 0;
  
  while(N[u].p >= 0){
    u = N[u].p;
    d++;
  }
  
  return d;
}

void printTree(int u){
  int t;

  if(N[u].p == NIL) printf("node %d: parent = %d, depth = %d, root, ", u, T[u].p, D[u]);
  
  else if(T[u].l == NIL) printf("node %d: parent = %d, depth = %d, leaf, ", u, T[u].p, D[u]);
  
  else printf("node %d: parent = %d, depth = %d, internal node, ", u, N[u].p, D[u]);
    
  printf("[");

  t = u;

  if(N[t].l != NIL){
    printf("%d", N[t].l);

    if(N[N[t].l].r == NIL) printf("]\n");

    else printf(",");

    t = N[t].l;

    while(N[t].r != NIL){
      printf(" %d",N[t].r);
      
      if(N[N[t].r].r == NIL) printf("]\n");

      else printf(",");

      t = N[t].r;
    }
  }
  
  else printf("]\n");
}

int main(){
  int i, j, d, v, c, l, r;
  
  scanf("%d", &n);
  
  for(i = 0; i < n; i++){
    N[i].p = N[i].l = N[i].r = NIL;
  }
  
  for ( i = 0; i < n; i++ ){
    scanf("%d %d", &v, &d);

    for(j = 0; j < d; j++){
      scanf("%d", &c);

      N[c].p = v;
      
      if(j == 0) N[v].l = c;
      
      else if (j >= 1) N[r].r = c;
      r = c;
    }
  }
  
  for(i = 0; i < n; i++) D[i] = getDepth(i);
  
  for(i = 0; i < n; i++) printTree(i);
  return 0;
}

Compiler output:
main.c: In function 'printTree':
main.c:30:75: error: 'T' undeclared (first use in this function)
   30 |   if(N[u].p == NIL) printf("node %d: parent = %d, depth = %d, root, ", u, T[u].p, D[u]);
      |                                                                           ^
main.c:30:75: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
#define NIL -1
#define N 100005
 
 struct Node{
  int p;
  int l;
  int r;
};
struct Node T[N];

int depth(int);
int child(int);
 
main()
{
 
 
  int i,j;
  int n,id,d,c,k;
  scanf("%d",&n);
   
  for(i = 0; i < n; i++){
   A[i].p = NIL;
   A[i].l = NIL;
   A[i].r = NIL;
  }
  for(i = 0; i < n; i++){
    scanf("%d %d",&id,&d);
    for(j = 0; j < d; j++){
      scanf("%d",&c);
       
      A[c].p = id;
       
      if(j == 0){
    A[id].l = c;
      }
      
      else {
    A[k].r = c;
      }
      
      k = c;
    }
  }
 
  for(i = 0; i < n; i++){
 
    printf("node %d: parent = %d, depth = %d, ",i,A[i].p,depth(i));
     
    
    if(A[i].p == NIL){
      printf("root, [");
    }
    else if(A[i].l == NIL){
      printf("leaf, [");
    }
    
    else {
    printf("internal node, [");
    }
    child(A[i].l);
    printf("]\n");
  }
  return 0;
}
 
 
int depth(int x)
{
  int a;
   
  if(A[x].p == NIL){
    return 0;
  }
  else {
  	
    a = depth(A[x].p) + 1;
    return a;
  
}
 
int child(int x)
{
  if(x==NIL){
    return 0;
  }
  
  else {
    if(A[x].r == NIL){
      printf("%d",x);
    }
    else {
      printf("%d, ",x);
      child(A[x].r);
    }
  }
}

Compiler output:
main.c:15:1: error: return type defaults to 'int' [-Wimplicit-int]
   15 | main()
      | ^~~~
main.c: In function 'main':
main.c:24:4: error: 'A' undeclared (first use in this function)
   24 |    A[i].p = NIL;
      |    ^
main.c:24:4: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'depth':
main.c:73:6: error: 'A' undeclared (first use in this function)
   73 |   if(A[x].p == NIL){
      |      ^
main.c:98:1: error: expected declaration or statement at end of input
   98 | }
      | ^
Language: C

#include <stdio.h>
#define NIL -1
#define N 100005
 
 struct Node{
  int p;
  int l;
  int r;
};
struct Node T[N];

int depth(int);
int child(int);
 
main()
{
 
 
  int i,j;
  int n,id,d,c,k;
  scanf("%d",&n);
   
  for(i = 0; i < n; i++){
   A[i].p = NIL;
   A[i].l = NIL;
   A[i].r = NIL;
  }
  for(i = 0; i < n; i++){
    scanf("%d %d",&id,&d);
    for(j = 0; j < d; j++){
      scanf("%d",&c);
       
      A[c].p = id;
       
      if(j == 0){
    A[id].l = c;
      }
      
      else {
    A[k].r = c;
      }
      
      k = c;
    }
  }
 
  for(i = 0; i < n; i++){
 
    printf("node %d: parent = %d, depth = %d, ",i,A[i].p,depth(i));
     
    
    if(A[i].p == NIL){
      printf("root, [");
    }
    else if(A[i].l == NIL){
      printf("leaf, [");
    }
    
    else {
    printf("internal node, [");
    }
    child(A[i].l);
    printf("]\n");
  }
  return 0;
}
 
 
int depth(int x)
{
  int a;
   
  if(A[x].p == NIL){
    return 0;
  }
  else {
  	
    a = depth(A[x].p) + 1;
    return a;
  }
}
 
int child(int x)
{
  if(x==NIL){
    return 0;
  }
  
  else {
    if(A[x].r == NIL){
      printf("%d",x);
    }
    else {
      printf("%d, ",x);
      child(A[x].r);
    }
  }
}

Compiler output:
main.c:15:1: error: return type defaults to 'int' [-Wimplicit-int]
   15 | main()
      | ^~~~
main.c: In function 'main':
main.c:24:4: error: 'A' undeclared (first use in this function)
   24 |    A[i].p = NIL;
      |    ^
main.c:24:4: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'depth':
main.c:73:6: error: 'A' undeclared (first use in this function)
   73 |   if(A[x].p == NIL){
      |      ^
main.c: In function 'child':
main.c:90:8: error: 'A' undeclared (first use in this function)
   90 |     if(A[x].r == NIL){
      |        ^
Language: C

#include <stdio.h>
#define NIL -1
#define N 100005
 
 struct Node{
  int p;
  int l;
  int r;
};
struct Node T[N];

int depth(int);
int child(int);
 
main()
{
 
 
  int i,j;
  int n,id,d,c,k;
  scanf("%d",&n);
   
  for(i = 0; i < n; i++){
   A[i].p = NIL;
   A[i].l = NIL;
   A[i].r = NIL;
  }
  for(i = 0; i < n; i++){
    scanf("%d %d",&id,&d);
    for(j = 0; j < d; j++){
      scanf("%d",&c);
       
      A[c].p = id;
       
      if(j == 0){
    A[id].l = c;
      }
      
      else {
    A[k].r = c;
      }
      
      k = c;
    }
  }
 
  for(i = 0; i < n; i++){
 
    printf("node %d: parent = %d, depth = %d, ",i,A[i].p,depth(i));
     
    
    if(A[i].p == NIL){
      printf("root, [");
    }
    else if(A[i].l == NIL){
      printf("leaf, [");
    }
    
    else {
    printf("internal node, [");
    }
    child(A[i].l);
    printf("]\n");
  }
  return 0;
}
 
 
int depth(int x)
{
  int a;
   
  if(A[x].p == NIL){
    return 0;
  }
  else {
  	
    a = depth(A[x].p) + 1;
    return a;
  }
}
 
int child(int x)
{
  if(x==NIL){
    return 0;
  }
  
  else {
    if(A[x].r == NIL){
      printf("%d",x);
    }
    else {
      printf("%d, ",x);
      child(A[x].r);
    }
}

Compiler output:
main.c:15:1: error: return type defaults to 'int' [-Wimplicit-int]
   15 | main()
      | ^~~~
main.c: In function 'main':
main.c:24:4: error: 'A' undeclared (first use in this function)
   24 |    A[i].p = NIL;
      |    ^
main.c:24:4: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'depth':
main.c:73:6: error: 'A' undeclared (first use in this function)
   73 |   if(A[x].p == NIL){
      |      ^
main.c: In function 'child':
main.c:90:8: error: 'A' undeclared (first use in this function)
   90 |     if(A[x].r == NIL){
      |        ^
main.c:97:1: error: expected declaration or statement at end of input
   97 | }
      | ^
Language: C

#include<stdio.h>
 
#define MAX 100006
 
struct Node{
  int p;
  int l;
  int r;
};
 
struct Node C[MAX];
 
int n, H, D[MAX];
 
int getDepth(int u){
  int d = 0;
   
  while(N[u].p >= 0){
    u = N[u].p;
    d++;
  }
   
  return d;
}
 
void printTree(int u){
  int t;
 
  if(C[u].p == -1) printf("node %d: parent = %d, depth = %d, root, ", u, C[u].p, D[u]);
   
  else if(C[u].l == -1) printf("node %d: parent = %d, depth = %d, leaf, ", u, C[u].p, D[u]);
   
  else printf("node %d: parent = %d, depth = %d, internal node, ", u, C[u].p, D[u]);
     
  printf("[");
 
  t = u;
 
  if(C[t].l != -1){
    printf("%d", C[t].l);
 
    if(C[C[t].l].r == -1) printf("]\n");
 
    else printf(",");
 
    t = C[t].l;
 
    while(C[t].r != -1){
      printf(" %d",N[t].r);
       
      if(C[C[t].r].r == -1) printf("]\n");
 
      else printf(",");
 
      t = C[t].r;
    }
  }
   
  else printf("]\n");
}
 
main(){
  int i, j, d, v, c, l, r;
   
  scanf("%d", &n);
   
  for(i = 0; i < n; i++){
    C[i].p = C[i].l = C[i].r = -1;
  }
   
  for ( i = 0; i < n; i++ ){
    scanf("%d %d", &v, &d);
 
    for(j = 0; j < d; j++){
      scanf("%d", &c);
 
      C[c].p = v;
       
      if(j == 0) C[v].l = c;
       
      else if (j >= 1) C[r].r = c;
      r = c;
    }
  }
   
  for(i = 0; i < n; i++) D[i] = getDepth(i);
   
  for(i = 0; i < n; i++) printTree(i);
  return 0;
}

Compiler output:
main.c: In function 'getDepth':
main.c:18:9: error: 'N' undeclared (first use in this function)
   18 |   while(N[u].p >= 0){
      |         ^
main.c:18:9: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'printTree':
main.c:49:20: error: 'N' undeclared (first use in this function)
   49 |       printf(" %d",N[t].r);
      |                    ^
main.c: At top level:
main.c:62:1: error: return type defaults to 'int' [-Wimplicit-int]
   62 | main(){
      | ^~~~