Language: C

#define _CRT_SECURE_NO_WARNINGS
//#define _USE_MATH_DEFINES
#include<stdio.h>
#include<stdlib.h>
//#include<math.h>
#include<string.h>
//#include<time.h>
#define P(type,x) fprintf(stdout,"%"#type"\n",x)
typedef struct {
	int p,
		left,
		right;
}NODE;
NODE *node, tmp;

int main() {
	int n,i,id,k,j,c,r;
	int depth,t;
	fscanf(stdin, "%d", &n);
	node =(NODE*) malloc(sizeof(NODE)*n);
	for (i = 0; i < n; i++)
		node[i].p = node[i].left = node[i].right = -1;
	
	for (i = 0; i < n; i++) {
		fscanf(stdin, "%d%d", &id, &k);
		for (j = 0; j < k; j++) {
			fscanf(stdin, "%d", &c);
			if (j == 0)node[id].left = c;
			else node[r].right = c;
			node[c].p = id;
			r = c;
		}
	}
	for (i = 0; i < n; i++) {
		depth = 0;
		t = node[i].p;
		while (t != -1) {
			t = node[t].p;
			depth++;
		}
		if (node[i].p == -1)
			fprintf(stdout, "node %d: parent = %d, depth = %d, root, [", i, node[i].p, depth);
		else if( node[i].left==-1)
			fprintf(stdout,"node %d: parent = %d, depth = %d, leaf, [",i, node[i].p, depth);
		else 
			fprintf(stdout,"node %d: parent = %d, depth = %d, internal node, [",i, node[i].p, depth);
		t = node[i].left;
		if (t != -1) fprintf(stdout, "%d", t);
		while (t != -1) {
			t = node[t].right;
			if (t != -1)printf(", %d", t);
		}
		P(s, "]");
	}
	free(node);
	return 0;
}
#define _CRT_SECURE_NO_WARNINGS
//#define _USE_MATH_DEFINES
#include<stdio.h>
#include<stdlib.h>
//#include<math.h>
#include<string.h>
//#include<time.h>
#define P(type,x) fprintf(stdout,"%"#type"\n",x)
typedef struct {
	int p,
		left,
		right;
}NODE;
NODE *node, tmp;

int main() {
	int n,i,id,k,j,c,r;
	int depth,t;
	fscanf(stdin, "%d", &n);
	node =(NODE*) malloc(sizeof(NODE)*n);
	for (i = 0; i < n; i++)
		node[i].p = node[i].left = node[i].right = -1;
	
	for (i = 0; i < n; i++) {
		fscanf(stdin, "%d%d", &id, &k);
		for (j = 0; j < k; j++) {
			fscanf(stdin, "%d", &c);
			if (j == 0)node[id].left = c;
			else node[r].right = c;
			node[c].p = id;
			r = c;
		}
	}
	for (i = 0; i < n; i++) {
		depth = 0;
		t = node[i].p;
		while (t != -1) {
			t = node[t].p;
			depth++;
		}
		if (node[i].p == -1)
			fprintf(stdout, "node %d: parent = %d, depth = %d, root, [", i, node[i].p, depth);
		else if( node[i].left==-1)
			fprintf(stdout,"node %d: parent = %d, depth = %d, leaf, [",i, node[i].p, depth);
		else 
			fprintf(stdout,"node %d: parent = %d, depth = %d, internal node, [",i, node[i].p, depth);
		t = node[i].left;
		if (t != -1) fprintf(stdout, "%d", t);
		while (t != -1) {
			t = node[t].right;
			if (t != -1)printf(", %d", t);
		}
		P(s, "]");
	}
	free(node);
	return 0;
}
#define _CRT_SECURE_NO_WARNINGS
//#define _USE_MATH_DEFINES
#include<stdio.h>
#include<stdlib.h>
//#include<math.h>
#include<string.h>
//#include<time.h>
#define P(type,x) fprintf(stdout,"%"#type"\n",x)
typedef struct {
	int p,
		left,
		right;
}NODE;
NODE *node, tmp;

int main() {
	int n,i,id,k,j,c,r;
	int depth,t;
	fscanf(stdin, "%d", &n);
	node =(NODE*) malloc(sizeof(NODE)*n);
	for (i = 0; i < n; i++)
		node[i].p = node[i].left = node[i].right = -1;
	
	for (i = 0; i < n; i++) {
		fscanf(stdin, "%d%d", &id, &k);
		for (j = 0; j < k; j++) {
			fscanf(stdin, "%d", &c);
			if (j == 0)node[id].left = c;
			else node[r].right = c;
			node[c].p = id;
			r = c;
		}
	}
	for (i = 0; i < n; i++) {
		depth = 0;
		t = node[i].p;
		while (t != -1) {
			t = node[t].p;
			depth++;
		}
		if (node[i].p == -1)
			fprintf(stdout, "node %d: parent = %d, depth = %d, root, [", i, node[i].p, depth);
		else if( node[i].left==-1)
			fprintf(stdout,"node %d: parent = %d, depth = %d, leaf, [",i, node[i].p, depth);
		else 
			fprintf(stdout,"node %d: parent = %d, depth = %d, internal node, [",i, node[i].p, depth);
		t = node[i].left;
		if (t != -1) fprintf(stdout, "%d", t);
		while (t != -1) {
			t = node[t].right;
			if (t != -1)printf(", %d", t);
		}
		P(s, "]");
	}
	free(node);
	return 0;
}
#define _CRT_SECURE_NO_WARNINGS
//#define _USE_MATH_DEFINES
#include<stdio.h>
#include<stdlib.h>
//#include<math.h>
#include<string.h>
//#include<time.h>
#define P(type,x) fprintf(stdout,"%"#type"\n",x)
typedef struct {
	int p,
		left,
		right;
}NODE;
NODE *node, tmp;

int main() {
	int n,i,id,k,j,c,r;
	int depth,t;
	fscanf(stdin, "%d", &n);
	node =(NODE*) malloc(sizeof(NODE)*n);
	for (i = 0; i < n; i++)
		node[i].p = node[i].left = node[i].right = -1;
	
	for (i = 0; i < n; i++) {
		fscanf(stdin, "%d%d", &id, &k);
		for (j = 0; j < k; j++) {
			fscanf(stdin, "%d", &c);
			if (j == 0)node[id].left = c;
			else node[r].right = c;
			node[c].p = id;
			r = c;
		}
	}
	for (i = 0; i < n; i++) {
		depth = 0;
		t = node[i].p;
		while (t != -1) {
			t = node[t].p;
			depth++;
		}
		if (node[i].p == -1)
			fprintf(stdout, "node %d: parent = %d, depth = %d, root, [", i, node[i].p, depth);
		else if( node[i].left==-1)
			fprintf(stdout,"node %d: parent = %d, depth = %d, leaf, [",i, node[i].p, depth);
		else 
			fprintf(stdout,"node %d: parent = %d, depth = %d, internal node, [",i, node[i].p, depth);
		t = node[i].left;
		if (t != -1) fprintf(stdout, "%d", t);
		while (t != -1) {
			t = node[t].right;
			if (t != -1)printf(", %d", t);
		}
		P(s, "]");
	}
	free(node);
	return 0;
}



Compiler output:
main.c:70:2: error: conflicting types for 'NODE'; have 'struct <anonymous>'
   70 | }NODE;
      |  ^~~~
main.c:13:2: note: previous declaration of 'NODE' with type 'NODE'
   13 | }NODE;
      |  ^~~~
main.c:71:7: error: conflicting types for 'node'; have 'NODE *'
   71 | NODE *node, tmp;
      |       ^~~~
main.c:14:7: note: previous declaration of 'node' with type 'NODE *'
   14 | NODE *node, tmp;
      |       ^~~~
main.c:71:13: error: conflicting types for 'tmp'; have 'NODE'
   71 | NODE *node, tmp;
      |             ^~~
main.c:14:13: note: previous declaration of 'tmp' with type 'NODE'
   14 | NODE *node, tmp;
      |             ^~~
main.c:73:5: error: redefinition of 'main'
   73 | int main() {
      |     ^~~~
main.c:16:5: note: previous definition of 'main' with type 'int()'
   16 | int main() {
      |     ^~~~
main.c:127:2: error: conflicting types for 'NODE'; have 'struct <anonymous>'
  127 | }NODE;
      |  ^~~~
main.c:70:2: note: previous declaration of 'NODE' with type 'NODE'
   70 | }NODE;
      |  ^~~~
main.c:128:7: error: conflicting types for 'node'; have 'NODE *'
  128 | NODE *node, tmp;
      |       ^~~~
main.c:14:7: note: previous declaration of 'node' with type 'NODE *'
   14 | NODE *node, tmp;
      |       ^~~~
main.c:128:13: error: conflicting types for 'tmp'; have 'NODE'
  128 | NODE *node, tmp;
      |             ^~~
main.c:14:13: note: previous declaration of 'tmp' with type 'NODE'
   14 | NODE *node, tmp;
      |             ^~~
main.c:130:5: error: redefinition of 'main'
  130 | int main() {
      |     ^~~~
main.c:16:5: note: previous definition of 'main' with type 'int()'
   16 | int main() {
      |     ^~~~
main.c:184:2: error: conflicting types for 'NODE'; have 'struct <anonymous>'
  184 | }NODE;
      |  ^~~~
main.c:127:2: note: previous declaration of 'NODE' with type 'NODE'
  127 | }NODE;
      |  ^~~~
main.c:185:7: error: conflicting types for 'node'; have 'NODE *'
  185 | NODE *node, tmp;
      |       ^~~~
main.c:14:7: note: previous declaration of 'node' with type 'NODE *'
   14 | NODE *node, tmp;
      |       ^~~~
main.c:185:13: error: conflicting types for 'tmp'; have 'NODE'
  185 | NODE *node, tmp;
      |             ^~~
main.c:14:13: note: previous declaration of 'tmp' with type 'NODE'
   14 | NODE *node, tmp;
      |             ^~~
main.c:187:5: error: redefinition of 'main'
  187 | int main() {
      |     ^~~~
main.c:16:5: note: previous definition of 'main' with type 'int()'
   16 | int main() {
      |     ^~~~