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

#include<stdio.h>
#define MAX 100000

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

Tree A[MAX];

int Dep(int);

main(){
int i,j,n;
int num,deg,c,k=0;

scanf("%d",&n);
for(i=0;i<n;i++){
A[i].p=-1;
A[i].l=-1;
A[i].r=-1;
}
for(i=0;i<n;i++){
scanf("%d%d",&num,&deg);
for(j=0;j<deg;j++){
scanf("%d",&c);
if(j==0)A[num].l=c;
else A[k].r=c;
k=c;
A[c].p=num;
}
}
for(i=0;i<n:i++){
printf("node %d: parent-%d,depth=%d+,i,A[i].p,Dep(i));
if(Dep(i)==0){
printf(", root, [");
}
else if(A[i].l==-1){
printf(", leaf, [");
else{
printf(", internal node, [");
}
j=A[i].l;

while(j!=-1){
printf("%d",j);
j=A[j].r;
if(j!--1){
printf(", ");
}
}
printf("]\n");
}
return 0;
}

int Dep(int num){
int dep=0;
while(A[num].p!=-1){
num=A[num].p;
dep++;
}
return dep;
}

Compiler output:
main.c:13:1: error: return type defaults to 'int' [-Wimplicit-int]
   13 | main(){
      | ^~~~
main.c: In function 'main':
main.c:33:12: error: expected ';' before ':' token
   33 | for(i=0;i<n:i++){
      |            ^
      |            ;
main.c:34:8: warning: missing terminating " character
   34 | printf("node %d: parent-%d,depth=%d+,i,A[i].p,Dep(i));
      |        ^
main.c:34:8: error: missing terminating " character
   34 | printf("node %d: parent-%d,depth=%d+,i,A[i].p,Dep(i));
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:35:1: error: expected expression before 'if'
   35 | if(Dep(i)==0){
      | ^~
main.c:54:10: error: expected ';' before '}' token
   54 | return 0;
      |          ^
      |          ;
   55 | }
      | ~         
main.c:64:1: error: expected declaration or statement at end of input
   64 | }
      | ^
Language: C

#include<stdio.h>
#define MAX 100000

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

Tree A[MAX];

int Dep(int);

main(){
int i,j,n;
int num,deg,c,k=0;

scanf("%d",&n);
for(i=0;i<n;i++){
A[i].p=-1;
A[i].l=-1;
A[i].r=-1;
}
for(i=0;i<n;i++){
scanf("%d%d",&num,&deg);
for(j=0;j<deg;j++){
scanf("%d",&c);
if(j==0)A[num].l=c;
else A[k].r=c;
k=c;
A[c].p=num;
}
}
for(i=0;i<n:i++){
printf("node %d: parent=%d,depth=%d",i,A[i].p,Dep(i));
if(Dep(i)==0){
printf(", root, [");
}
else if(A[i].l==-1){
printf(", leaf, [");
else{
printf(", internal node, [");
}
j=A[i].l;

while(j!=-1){
printf("%d",j);
j=A[j].r;
if(j!--1){
printf(", ");
}
}
printf("]\n");
}
return 0;
}

int Dep(int num){
int dep=0;
while(A[num].p!=-1){
num=A[num].p;
dep++;
}
return dep;
}

Compiler output:
main.c:13:1: error: return type defaults to 'int' [-Wimplicit-int]
   13 | main(){
      | ^~~~
main.c: In function 'main':
main.c:33:12: error: expected ';' before ':' token
   33 | for(i=0;i<n:i++){
      |            ^
      |            ;
main.c:40:1: error: expected '}' before 'else'
   40 | else{
      | ^~~~
main.c:48:5: error: expected ')' before '!' token
   48 | if(j!--1){
      |   ~ ^
      |     )
Language: C

#include<stdio.h>
#define MAX 100000

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

Tree A[MAX];

int Dep(int);

main(){
int i,j,n;
int num,deg,c,k=0;

scanf("%d",&n);
for(i=0;i<n;i++){
A[i].p=-1;
A[i].l=-1;
A[i].r=-1;
}
for(i=0;i<n;i++){
scanf("%d%d",&num,&deg);
for(j=0;j<deg;j++){
scanf("%d",&c);
if(j==0)A[num].l=c;
else A[k].r=c;
k=c;
A[c].p=num;
}
}
for(i=0;i<n:i++){
printf("node %d: parent=%d,depth=%d",i,A[i].p,Dep(i));
if(Dep(i)==0)printf(", root, [");
else if(A[i].l==-1)printf(", leaf, [");
else printf(", internal node, [");
j=A[i].l;

while(j!=-1){
printf("%d",j);
j=A[j].r;
if(j!--1){
printf(", ");
}
}
printf("]\n");
}
return 0;
}

int Dep(int num){
int dep=0;
while(A[num].p!=-1){
num=A[num].p;
dep++;
}
return dep;
}

Compiler output:
main.c:13:1: error: return type defaults to 'int' [-Wimplicit-int]
   13 | main(){
      | ^~~~
main.c: In function 'main':
main.c:33:12: error: expected ';' before ':' token
   33 | for(i=0;i<n:i++){
      |            ^
      |            ;
main.c:43:5: error: expected ')' before '!' token
   43 | if(j!--1){
      |   ~ ^
      |     )
Language: C

#include<stdio.h>
#define MAX 100000

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

Tree A[MAX];

int Dep(int);

main(){
int i,j,n;
int num,deg,c,k=0;

scanf("%d",&n);
for(i=0;i<n;i++){
A[i].p=-1;
A[i].l=-1;
A[i].r=-1;
}
for(i=0;i<n;i++){
scanf("%d%d",&num,&deg);
for(j=0;j<deg;j++){
scanf("%d",&c);
if(j==0)A[num].l=c;
else A[k].r=c;
k=c;
A[c].p=num;
}
}
for(i=0;i<n:i++){
printf("node %d: parent=%d,depth=%d",i,A[i].p,Dep(i));
if(Dep(i)==0)printf(", root, [");
else if(A[i].l==-1)printf(", leaf, [");
else printf(", internal node, [");
j=A[i].l;

while(j!=-1){
printf("%d",j);
j=A[j].r;
if(j!=-1){
printf(", ");
}
}
printf("]\n");
}
return 0;
}

int Dep(int num){
int dep=0;
while(A[num].p!=-1){
num=A[num].p;
dep++;
}
return dep;
}

Compiler output:
main.c:13:1: error: return type defaults to 'int' [-Wimplicit-int]
   13 | main(){
      | ^~~~
main.c: In function 'main':
main.c:33:12: error: expected ';' before ':' token
   33 | for(i=0;i<n:i++){
      |            ^
      |            ;
Language: C

#include<stdio.h>
#define MAX 100000

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

Tree A[MAX];

int Dep(int);

main(){
int i,j,n;
int num,deg,c,k=0;

scanf("%d",&n);
for(i=0;i<n;i++){
A[i].p=-1;
A[i].l=-1;
A[i].r=-1;
}
for(i=0;i<n;i++){
scanf("%d%d",&num,&deg);
for(j=0;j<deg;j++){
scanf("%d",&c);
if(j==0)A[num].l=c;
else A[k].r=c;
k=c;
A[c].p=num;
}
}
for(i=0;i<n;++){
printf("node %d: parent=%d,depth=%d",i,A[i].p,Dep(i));
if(Dep(i)==0)printf(", root, [");
else if(A[i].l==-1)printf(", leaf, [");
else printf(", internal node, [");
j=A[i].l;

while(j!=-1){
printf("%d",j);
j=A[j].r;
if(j!=-1){
printf(", ");
}
}
printf("]\n");
}
return 0;
}

int Dep(int num){
int dep=0;
while(A[num].p!=-1){
num=A[num].p;
dep++;
}
return dep;
}

Compiler output:
main.c:13:1: error: return type defaults to 'int' [-Wimplicit-int]
   13 | main(){
      | ^~~~
main.c: In function 'main':
main.c:33:15: error: expected expression before ')' token
   33 | for(i=0;i<n;++){
      |               ^
Language: C

#include<stdio.h>
#define N 100000

typedef struct {
  int parent;
  int child[1000;
  int m;
} Node;

Node Tree[N];

int getDepth(int x) {
  int depth = 1;
  if(Tree[x].parent == -1) return 0;
  depth += getDepth(Tree[x].parent);
  return depth;
}

int main() {
  int i, j, n;
  int number, depth; 

  scanf("%d", &n);
  for(i = 0; i < n; i++) Tree[i].parent = -1;
  for(i = 0; i < n; i++) {
    scanf("%d", &number);
    scanf("%d", &Tree[number].m);
    for(j = 0; j < Tree[number].m; j++) {
      scanf("%d", &Tree[number].child[j]);
      Tree[Tree[number].child[j]].parent = number;
    }
  }

  for(i = 0; i < n; i++) {
    depth = getDepth(i);
    printf("node %d: parent = %d, depth = %d, ", i, Tree[i].parent, depth);
    if(Tree[i].parent == -1) {
      printf("root, [");
      for(j = 0; j < Tree[i].m; j++) {
	if(j > 0) printf(", ");
	printf("%d",Tree[i].child[j]);
      }
      printf("]\n");
    }
    else if(Tree[i].m == 0) printf("leaf, []\n");
    else {
      printf("internal node, [");
      for(j = 0; j < Tree[i].m; j++) {
	if(j > 0) printf(", ");
	printf("%d",Tree[i].child[j]);
      }
      printf("]\n");
      }
    }
  return 0;
}

Compiler output:
main.c:6:17: error: expected ']' before ';' token
    6 |   int child[1000;
      |                 ^
      |                 ]
main.c:8:3: error: expected ';' before 'Node'
    8 | } Node;
      |   ^~~~
Language: C


    printf(" root, [");
  }
  else if(TREE[n].left == fr){
    printf(" leef, [");
  }
  else printf(" internal node,[");

  i=TREE[n].left;
  while(i!=fr){
    printf("%d",i);

    i = TREE[i].right;

    if(i!=fr){
      printf(", ");
    }
  }
  printf("]\n");
}

Compiler output:
main.c:2:12: error: expected declaration specifiers or '...' before string constant
    2 |     printf(" root, [");
      |            ^~~~~~~~~~
main.c:3:3: error: expected identifier or '(' before '}' token
    3 |   }
      |   ^
main.c:4:3: error: expected identifier or '(' before 'else'
    4 |   else if(TREE[n].left == fr){
      |   ^~~~
main.c:7:3: error: expected identifier or '(' before 'else'
    7 |   else printf(" internal node,[");
      |   ^~~~
main.c:9:3: warning: data definition has no type or storage class
    9 |   i=TREE[n].left;
      |   ^
main.c:9:3: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int]
main.c:9:5: error: 'TREE' undeclared here (not in a function)
    9 |   i=TREE[n].left;
      |     ^~~~
main.c:9:10: error: 'n' undeclared here (not in a function)
    9 |   i=TREE[n].left;
      |          ^
main.c:10:3: error: expected identifier or '(' before 'while'
   10 |   while(i!=fr){
      |   ^~~~~
main.c:19:10: error: expected declaration specifiers or '...' before string constant
   19 |   printf("]\n");
      |          ^~~~~
main.c:20:1: error: expected identifier or '(' before '}' token
   20 | }
      | ^
Language: C

#include <stdio.h>
#include <stdring.h>
typedef struct node {
  int id;
  int p;
  int d;
}Node;

int main(){
  int n,i,j,k;
  int c[100];
  int *trees;
  
  scanf("%d",&n);
  trees = malloc(sizeof(Node)*n);
  
  for(i=0;i<20;i++) {
    scanf("%d %d",&id,&k);
    for(j=0;j<k;j++) {
      scanf("%d",&c[j]);
    }
  }

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

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

struct Node{
  int parent,left,right;
};
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[c].r){
    if(i)printf(", ");
    printf("%d",c);
  }
  printf("]\n");
}

int rec(it 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++)print(i);
  
  return 0;
}

Compiler output:
main.c:8:1: error: unknown type name 'Node'; use 'struct' keyword to refer to the type
    8 | Node T[MAX];
      | ^~~~
      | struct 
main.c: In function 'print':
main.c:14:31: error: request for member 'p' in something not a structure or union
   14 |   printf("parent = %d , ",T[u].p);
      |                               ^
main.c:16:10: error: request for member 'p' in something not a structure or union
   16 |   if(T[u].p==NIL)printf("root, ");
      |          ^
main.c:17:16: error: request for member 'l' in something not a structure or union
   17 |   else if (T[u].l==NIL)printf("leaf, ");
      |                ^
main.c:20:17: error: request for member 'l' in something not a structure or union
   20 |   for(i=0,c=T[u].l;c!=NIL;i++,c=T[c].r){
      |                 ^
main.c:20:37: error: request for member 'r' in something not a structure or union
   20 |   for(i=0,c=T[u].l;c!=NIL;i++,c=T[c].r){
      |                                     ^
main.c: At top level:
main.c:27:9: error: unknown type name 'it'; did you mean 'int'?
   27 | int rec(it u,int p){
      |         ^~
      |         int
main.c: In function 'main':
main.c:36:23: error: request for member 'p' in something not a structure or union
   36 |   for(i=0;i<n;i++)T[i].p=T[i].l=T[i].r=NIL;
      |                       ^
main.c:36:30: error: request for member 'l' in something not a structure or union
   36 |   for(i=0;i<n;i++)T[i].p=T[i].l=T[i].r=NIL;
      |                              ^
main.c:36:37: error: request for member 'r' in something not a structure or union
   36 |   for(i=0;i<n;i++)T[i].p=T[i].l=T[i].r=NIL;
      |                                     ^
main.c:42:19: error: request for member 'l' in something not a structure or union
   42 |       if(j==0)T[v].l=c;
      |                   ^
main.c:43:16: error: request for member 'r' in something not a structure or union
   43 |       else T[l].r=c;
      |                ^
main.c:45:11: error: request for member 'p' in something not a structure or union
   45 |       T[c].p=v;
      |           ^
Language: C

#include<stdio.h>
#define MAX 100001
typedef struct{
  int parent, x, y;
}Node;
Node Tree[Max];
int u,a,de[MAX];
int get(int);
void p(int);
int main(){
  int i,j,l,d,v,z;
  scanf("%d" , &u);
  for(i = 0;i < u; i++){
    Tree[i].parent = -1;
    Tree[i].x = -1;
    Tree[i].y = -1;
  }
  for( i = 0; i < u; i++){
    scanf("%d %d", &v,&d);
    for(j = 0;j<d;j++){
      scanf("%d" , &z);
      if(j ==0)Tree[v].x = z;
      else{
	Tree[x].y = z;
      }
      x = z;
      Tree[z].parent = v;
    }
  }
  
    
  a = 0;
  for(i = 0;i < u; i++){
    de[i] = get(i);
    if(de[i] > a) a = de[i];
  }
  for(i=0;i<u;i++){
    p(i);
  }
  return 0;
}
int get(int n){
  int d = 0;
  while(1){
    n = Tree[n].parent;
    if(n == -1)break;
    d++;
  }
  return d;
}
void p(int n){
  int i , j;
  printf("node %d: " , n);
  printf("parent = %d, ", Tree[n].parent);
  printf("depth = %d, ", de[n]);
  if(tree[n].parent == -1)printf("root, ");
  else if(Tree[n].x == -1)printf("leaf, ");
  else{
    printf("internal node, ");
  }
  printf("[");
  for(i=0; ; i++){
    for(j = Tree[n].x; j != -1;j = Tree[j].y){
      if(i)printf(", ");
      printf("%d", j);
    }
  }
  printf("]\n");
}

Compiler output:
main.c:6:11: error: 'Max' undeclared here (not in a function); did you mean 'MAX'?
    6 | Node Tree[Max];
      |           ^~~
      |           MAX
main.c: In function 'main':
main.c:24:14: error: 'x' undeclared (first use in this function)
   24 |         Tree[x].y = z;
      |              ^
main.c:24:14: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'p':
main.c:56:6: error: 'tree' undeclared (first use in this function); did you mean 'Tree'?
   56 |   if(tree[n].parent == -1)printf("root, ");
      |      ^~~~
      |      Tree
Language: C

#include <stdio.h>
#include <string.h>
#define MAX 100005
#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("paren=%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[c].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;
  printf("%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",&v);
    scanf("%d",&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: In function 'print':
main.c:25:26: error: expected ')' before ';' token
   25 |   for(i=0;c=T[u].l;c!=NIL;i++,c=T[c].r){
      |      ~                   ^
Language: C

#include<stdio.h>
#define MAX 100001
#define N -1
typedef struct{
  int parent,x,y;
}Node;
Node Tree[MAX];
int u,a,de[MAX];
int get(int);
void pr(int);
int main(){
  int i,j,l,d,v,z;
  scanf("%d" , &u);
  for(i = 0;i < u; i++){
    Tree[i].parent = N;
    Tree[i].x = N;
    Tree[i].y = N;
  }
  for( i = 0; i < u; i++){
    scanf("%d %d", &v,&d);
    for(j = 0;j<d;j++){
      scanf("%d" , &z);
      if(j ==0)Tree[v].x = z;
      else if(j != 0) Tree[l].y = z;
      l = z;
      Tree[z].parent = v;
    }
  }
  
    
  a = 0;
  for(i = 0;i < u; i++){
    de[i] = get(i);
    if(de[i] > a) a = de[i];
  }
  for(i=0;i<u;i++){
    pr(i);
  }
  return 0;
}
int get(int n){
  int d = 0;
  while(1){
    n = Tree[n].parent;
    if(n == N)break;
    d++;
  }
  return d;
}
void pr(int n){
  int i , j;
  printf("node %d: " , n);
  printf("parent = %d, ", Tree[n].parent);
  printf("depth = %d, ", de[n]);
  if(Tree[n].parent == -1)printf("root, ");
  else if(Tree[n].x == -1)printf("leaf, ");
  else{
    printf("internal node, ");
  }
  printf("[");
  for(i=0, j = Tree[n].x;j != N ; i++,j = Tree[j].y){
    // for(j = Tree[n].x; j != -1;j = Tree[j].y){
      if(i)printf(", ");
      printf("%d", j);
    }
  }
  printf("]\n");
}
      

Compiler output:
main.c:67:10: error: expected declaration specifiers or '...' before string constant
   67 |   printf("]\n");
      |          ^~~~~
main.c:68:1: error: expected identifier or '(' before '}' token
   68 | }
      | ^
Language: C

#include<stdio.h>
#define MAX 100001
#define N -1
typedef struct{
  int parent,x,y;
}Node;
Node Tree[MAX];
int u,a,de[MAX];
int get(int);
void pr(int);
int main(){
  int i,j,l,d,v,z;
  scanf("%d" , &u);
  for(i = 0;i < u; i++){
    Tree[i].parent = N;
    Tree[i].x = N;
    Tree[i].y = N;
  }
  for( i = 0; i < u; i++){
    scanf("%d %d", &v,&d);
    for(j = 0;j<d;j++){
      scanf("%d" , &z);
      if(j ==0)Tree[v].x = z;
      else if(j != 0) Tree[l].y = z;
      l = z;
      Tree[z].parent = v;
    }
  }
  
    
  a = 0;
  for(i = 0;i < u; i++){
    de[i] = get(i);
    if(de[i] > a) a = de[i];
  }
  for(i=0;i<u;i++){
    pr(i);
  }
  return 0;
}
int get(int n){
  int d = 0;
  while(1){
    n = Tree[n].parent;
    if(n == N)break;
    d++;
  }
  return d;
}
void pr(int n){
  int i , j;
  printf("node %d: " , n);
  printf("parent = %d, ", Tree[n].parent);
  printf("depth = %d, ", de[n]);
  if(Tree[n].parent == -1)printf("root, ");
  else if(Tree[n].x == -1)printf("leaf, ");
  else{
    printf("internal node, ");
  }
  printf("[");
  for(i=0, j = Tree[n].x;j != N ; i++,j = Tree[j].y){
  
      if(i)printf(", ");
      printf("%d", j);
    }
  }
  printf("]\n");
}
      

Compiler output:
main.c:67:10: error: expected declaration specifiers or '...' before string constant
   67 |   printf("]\n");
      |          ^~~~~
main.c:68:1: error: expected identifier or '(' before '}' token
   68 | }
      | ^
Language: C

#include<stdio.h>
#define N 100001
int depth(int);
struct Node{
  int p;
  int l;
  int r;
};
struct Node Tree[N];
 
 
int main()
{
 
  int i,j,n,par,child,sib,k,x;
 
  scanf("%d",&n);
  for(i = 0; i < n; i++){
    Tree[i].p = -1;
    Tree[i].l = -1;
    Tree[i].r = -1;
  }
 
  for(i = 0; i < n; i++){
    scanf("%d %d",&par,&k);
    for(j = 0; j < k; j++){
      scanf("%d",&child);
      if(j == 0){
	Tree[par].l = child;
	Tree[child].p = par;
	x = child;
      }
      else {
	Tree[x].r = child;
	Tree[child].p= par;
	x = child;
      }
    }
  }
 
  for(i = 0; i < n; i++){
    printf("node %d: parent = %d, depth = %d, ",i , Tree[i].p,depth(i));
    if(Tree[i].l  == -1 && T[i].p != -1)printf("leaf, ");
    else if(Tree[i].p == -1)printf("root, ");
    else if(Tree[i].l != -1)printf("internal node, ");
    printf("[");
 
    if(Tree[i].l != -1){
      printf("%d",Tree[i].l);
 
      sib = Tree[i].l;
 
      while(1){
	if(Tree[sib].r == -1)break;
	printf(", %d",Tree[sib].r);
	sib = Tree[sib].r;
      }
    }
    printf("]\n");
  }
 
  return 0;
}
 
int depth(int k){
  int dep =0;
  for(dep = 0; Tree[k].p != -1; dep++){
    k = Tree[k].p;
  }
  return dep;
}

Compiler output:
main.c: In function 'main':
main.c:43:28: error: 'T' undeclared (first use in this function)
   43 |     if(Tree[i].l  == -1 && T[i].p != -1)printf("leaf, ");
      |                            ^
main.c:43:28: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
#define N 100000
typedef struct{ 
  int left;
  int right;
  int parent;
}id;
   
int main(){ 
  int n,i,j,k,d,t,x,c;
  id A[N];
 
  scanf("%d",&n);
  for(i=0;i<n;i++)
    A[i].parent = A[i].right = A[i].left = -1; 

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

    for(j=0;j<t;j++){
      scanf("%d",&c);
      A[c].parent = id;

      if(j == 0)A[id].left = c;
      else A[x].right = c;

      x = c;
    }
  }
  
  for(i=0;i<n;i++){  
    x = A[i].parent;
    d = 0;
    
    while(x != -1){
      x = A[x].parent;
      d++;
    }
    
    printf("node %d: parent = %d, depth = %d, ",i,A[i].parent,d);
    
    if(A[i].parent == -1)printf("root, [");
    else if(A[i].left == -1)printf("leaf, [");
    else printf("internal node, [");
    
    x = A[i].left;
    
    if(x != -1){
      printf("%d",A[i].left);
      
      while(A[x].right != -1){
	printf(", %d",A[x].right);
	x = A[x].right;
      }
    }
    printf("]\n");
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:22:21: error: expected expression before 'id'
   22 |       A[c].parent = id;
      |                     ^~
main.c:24:19: error: expected expression before 'id'
   24 |       if(j == 0)A[id].left = c;
      |                   ^~
Language: C

#include<stdio.h>
#define N 100000
typedef struct{ 
  int left;
  int right;
  int parent;
}id;
   
int main(){ 
  int n,i,j,k,d,t,x,c;
  id A[N];
 
  scanf("%d",&n);
  for(i=0;i<n;i++)
    A[i].parent = A[i].right = A[i].left = -1; 

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

    for(j=0;j<t;j++){
      scanf("%d",&c);
      A[c].parent = k;

      if(j == 0)A[id].left = c;
      else A[x].right = c;

      x = c;
    }
  }
  
  for(i=0;i<n;i++){  
    x = A[i].parent;
    d = 0;
    
    while(x != -1){
      x = A[x].parent;
      d++;
    }
    
    printf("node %d: parent = %d, depth = %d, ",i,A[i].parent,d);
    
    if(A[i].parent == -1)printf("root, [");
    else if(A[i].left == -1)printf("leaf, [");
    else printf("internal node, [");
    
    x = A[i].left;
    
    if(x != -1){
      printf("%d",A[i].left);
      
      while(A[x].right != -1){
	printf(", %d",A[x].right);
	x = A[x].right;
      }
    }
    printf("]\n");
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:24:19: error: expected expression before 'id'
   24 |       if(j == 0)A[id].left = c;
      |                   ^~
Language: C

#include <stdio.h>
??
#define N 100001
??
typedef struct{
????int parent;
????int left;
????int right;
}Node;
??
Node T[N];
??
int main(){
????int n, i, j, buf;
????int id, degree, depth[N];
??
????scanf("%d", &n);
??
????for(i = 0; i < n; i++){
????????T[i].parent = -1;
????????T[i].left = N;
????????T[i].right = N;
????????depth[i] = 0;
????}
??????
????for(i = 0; i < n; i++){
????????scanf("%d%d", &id, &degree);
??????????
????????if(degree == 1){
????????????scanf("%d",&T[id].left);
????????????buf = T[id].left;
????????????T[buf].parent = id;
????????}
????????else if(degree > 1){
????????????scanf("%d",&T[id].left);
????????????buf = T[id].left;
????????????for(j = 1; j < degree; j++){
????????scanf("%d", &T[buf].right);
????????T[buf].parent = id;
????????buf = T[buf].right;
????????????}
????????????T[buf].parent = id;
????????}
????}
??????
????for(i = 0; i < n; i++){
????????buf = T[i].parent;
????????????while(1){
????????if(buf == -1) break;
????????else {
????????????buf = T[buf].parent;
????????????depth[i]++;
????????}
????????????}
????????printf("node %d: parent = %d, depth = %d,", i, T[i].parent, depth[i]);
??????????
????????if(T[i].parent == -1){
????????????if(T[i].left == N) printf(" root, []\n");
????????????else{
????????????printf(" root, [%d", T[i].left);
????????????buf = T[i].left;
????????????while(T[buf].right != N){
????????printf(", %d", T[buf].right);
????????buf = T[buf].right;
????????????}
????????????printf("]\n");
????????????}
????????}
????????else if(T[i].left == N)
????????????printf(" leaf, []\n");
????????else{
????????????printf(" internal node, [%d", T[i].left);
????????????buf = T[i].left;
????????????while(T[buf].right != N){
????????printf(", %d", T[buf].right);
????????buf = T[buf].right;
????????????}
????????????printf("]\n");
????????}
????}
????return 0;
}

Compiler output:
main.c:2:1: error: expected identifier or '(' before '?' token
    2 | ??
      | ^
main.c:9:2: warning: data definition has no type or storage class
    9 | }Node;
      |  ^~~~
main.c:9:2: error: type defaults to 'int' in declaration of 'Node' [-Wimplicit-int]
main.c:10:1: error: expected identifier or '(' before '?' token
   10 | ??
      | ^
main.c:12:1: error: expected identifier or '(' before '?' token
   12 | ??
      | ^
Language: C

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

struct Node{int p,l,r;};
struct Node T[N];
int Depth(int);
void Print(int);
int n;

int main(){
  int i,j,d,v,c,l,a;
  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);
      T[c].p=v;
      if(j==0) T[v].l=c;
      else T[a].r=c;
      a=c;
    }
  }

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

int Depth(int u){
  int i,d=0;
  for(i=u;T[i].p!=NIL;i=T[i].p,d++);
  return d;
}

void Print(int u){
  int b=Depth(u),c=T[u].l;
  printf("node %d: parent = %d, depth = %d, ",u,T[u].p,b);
  if(b==0) printf("root, ");
  else if(T[u].l!=NIL) printf("internal node, ");
  else printf("leaf, ");
  printf("[");
  if(T[u]!=NIL){
    while(1){
      printf("%d",c);
      if(T[c].r==NIL){
	printf("]/n");
	break;
      }
      else{
	printf(", ");
	c=T[c].r;
      }
    }
  }
  else printf("]\n");
}

Compiler output:
main.c: In function 'Print':
main.c:45:10: error: invalid operands to binary != (have 'struct Node' and 'int')
   45 |   if(T[u]!=NIL){
      |      ~~~~^~
      |       |
      |       struct Node
Language: C

#include<stdio.h>
#define MAX 100000
 
typedef struct{
  int parent;
  int left;
  int right;
}id;
   
id A[MAX];
int n,B[MAX];
 
   
int rec(int x,int y){
  B[x] = y;
  if(A[x].r != -1) rec(A[x].r,y);
  if(A[x].l != -1) rec(A[x].l,y + 1);
}


int main(){
  int i,j,d,v,c,l,r,n,op;
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    A[i].p = A[i].l = A[i].r = -1;
  }
  
  for(i=0;i<n;i++){
    scanf("%d%d",&v,&d);
    for(j=0;j<d;j++){
      scanf("%d",&c);
      if(j==0) A[v].l=c;
      else A[l].r = c;
      l=c;
      A[c].p = v;
    }
  }
  for(i=0;i<n;i++){
    if(A[i].p == -1) r=i;
  }
 
  rec(r,0);
 
  for(i=0;i<n;i++){
    
    printf("node %d: parent = %d, depth = %d,",i,A[i].p,B[i]);
    if(A[i].p == -1) printf(" root,");
    else if(A[i].l == -1 ) printf(" leaf,");
    else printf(" internal node,");
    printf(" [");
    op=A[i].l;
    for(j=0;op!=-1;j++){
      if(j != 0) printf(", ");
      printf("%d",op);
      op = A[op].r;
    }
    printf("]\n");  
  }
 
  return 0;
}

Compiler output:
main.c: In function 'rec':
main.c:16:10: error: 'id' has no member named 'r'
   16 |   if(A[x].r != -1) rec(A[x].r,y);
      |          ^
main.c:16:28: error: 'id' has no member named 'r'
   16 |   if(A[x].r != -1) rec(A[x].r,y);
      |                            ^
main.c:17:10: error: 'id' has no member named 'l'
   17 |   if(A[x].l != -1) rec(A[x].l,y + 1);
      |          ^
main.c:17:28: error: 'id' has no member named 'l'
   17 |   if(A[x].l != -1) rec(A[x].l,y + 1);
      |                            ^
main.c: In function 'main':
main.c:26:9: error: 'id' has no member named 'p'
   26 |     A[i].p = A[i].l = A[i].r = -1;
      |         ^
main.c:26:18: error: 'id' has no member named 'l'
   26 |     A[i].p = A[i].l = A[i].r = -1;
      |                  ^
main.c:26:27: error: 'id' has no member named 'r'
   26 |     A[i].p = A[i].l = A[i].r = -1;
      |                           ^
main.c:33:20: error: 'id' has no member named 'l'
   33 |       if(j==0) A[v].l=c;
      |                    ^
main.c:34:16: error: 'id' has no member named 'r'
   34 |       else A[l].r = c;
      |                ^
main.c:36:11: error: 'id' has no member named 'p'
   36 |       A[c].p = v;
      |           ^
main.c:40:12: error: 'id' has no member named 'p'
   40 |     if(A[i].p == -1) r=i;
      |            ^
main.c:47:54: error: 'id' has no member named 'p'
   47 |     printf("node %d: parent = %d, depth = %d,",i,A[i].p,B[i]);
      |                                                      ^
main.c:48:12: error: 'id' has no member named 'p'
   48 |     if(A[i].p == -1) printf(" root,");
      |            ^
main.c:49:17: error: 'id' has no member named 'l'
   49 |     else if(A[i].l == -1 ) printf(" leaf,");
      |                 ^
main.c:52:12: error: 'id' has no member named 'l'
   52 |     op=A[i].l;
      |            ^
main.c:56:17: error: 'id' has no member named 'r'
   56 |       op = A[op].r;
      |                 ^
Language: C

#include <stdio.h>
#include <stdlib.h>
int main (){
  int n;
  int **c;
  int *id;
  int *p;
  int *d;
  int *deg;
  int i,j,k,l,maxdeg = 0;
  scanf("%d", &n);
  k = 2 * n;
  c = malloc(sizeof(int) * (n+1);
  for (i = 0; i < n; i++) {
    c[i] = malloc(sizeof(int) * k);
  }
  id = malloc(sizeof(int) * (n+1));
  p = malloc(sizeof(int) * (n+1));
  d = malloc(sizeof(int) * (n+1));
  deg = malloc(sizeof(int) * (n+1));
  
  for(i = 0; i < n; i++){
    scanf("%d",&id[i]);
    scanf("%d",&deg[id[i]]);
    for(j = 0; j < deg[id[i]]; j++){
      scanf("%d",&c[id[i]][j]);
    }
  }
 

   for(i = 0; i < n;i++){
    p[i] =-1;
  }

  for(i = 0; i < n; i++){
    for(j = 0; j < n; j++){
       for(k = 0; k < deg[id[j]]; k++){
	 if(id[i] == c[id[j]][k]){
	   p[id[i]] = id[j];
	   break;
	 }
       }
       if(p[id[i]] == id[j])break;
    }
  }

  for(i = 0; i < n; i++){
    if(p[id[i]] == -1){
      d[id[i]]=0;
      for(j = 0;j < deg[id[i]]; j++){
	d[c[id[i]][j]] = 1;
	  }
      break;
    }
  }

  for(i = 0;i < n; i++){
    for(k = 1; k<20; k++){
      if(d[id[i]] == k){
       for(j = 0;j < deg[id[i]]; j++){
	 d[c[id[i]][j]] = k+1;
       }
    }
    }
  }

  
  
  for(i = 0; i < n; i++){
    
    for(j = 0; j < n; j++){
      if(id[j] == i){
	printf("node %d: parent = %d, depth = %d, ",id[j],p[id[j]],d[id[j]]);
	if(p[id[j]] == -1){
	  printf("root, [");
	}
	else if(deg[id[j]] == 0){
	  printf("leaf, [");
	}
	else  {
	  printf("internal node, [");
	}
	if(deg[id[j]]>0){
	for(l = 0; l < deg[id[j]]-1; l++){
	  printf("%d, ",c[id[j]][l]);
	    }
	printf("%d",c[id[j]][l]);}
	printf("]\n");
	break;
      }
    }
  }
  
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:13:33: error: expected ')' before ';' token
   13 |   c = malloc(sizeof(int) * (n+1);
      |             ~                   ^
      |                                 )
main.c:94:18: error: expected ';' before '}' token
   94 |         return 0;
      |                  ^
      |                  ;
   95 | }
      | ~
Language: C


#include <stdio.h>
#include <stdlib.h>
int main (){
  int n;
   int **c;
   int *id;
  int *p;
  int *d;
  int *deg;
  int i,j,k,l,maxdeg = 0;
  scanf("%d", &n);
  k = 2 * n;
   c = malloc(sizeof(int) * (k);
  for (i = 0; i < n; i++) {
    c[i] = malloc(sizeof(int) * k);
    }
  id = malloc(sizeof(int) * k));
  p = malloc(sizeof(int) * k);
  d = malloc(sizeof(int) * k);
  deg = malloc(sizeof(int) * k);
  
  for(i = 0; i < n; i++){
    scanf("%d",&id[i]);
    scanf("%d",&deg[id[i]]);
    for(j = 0; j < deg[id[i]]; j++){
      scanf("%d",&c[id[i]][j]);
    }
  }
 

   for(i = 0; i < n;i++){
    p[i] = -1;
  }

  for(i = 0; i < n; i++){
    for(j = 0; j < n; j++){
       for(k = 0; k < deg[id[j]]; k++){
	 if(id[i] == c[id[j]][k]){
	   p[id[i]] = id[j];
	   break;
	 }
       }
        if(p[id[i]] == id[j])break;
    }
  }

  for(i = 0; i < n; i++){
    if(p[id[i]] == -1){
      d[id[i]]=0;
      for(j = 0;j < deg[id[i]]; j++){
	d[c[id[i]][j]] = 1;
	  }
      break;
    }
  }

  for(i = 0;i < n; i++){
    for(k = 1; k<20; k++){
      if(d[id[i]] == k){
       for(j = 0;j < deg[id[i]]; j++){
	 d[c[id[i]][j]] = k+1;
       }
    }
    }
  }

  
  
  for(i = 0; i < n; i++){
    
    for(j = 0; j < n; j++){
      if(id[j] == i){
	printf("node %d: parent = %d, depth = %d, ",id[j],p[id[j]],d[id[j]]);
	if(p[id[j]] == -1){
	  printf("root, [");
	}
	else if(deg[id[j]] == 0){
	  printf("leaf, [");
	}
	else  {
	  printf("internal node, [");
	}
	if(deg[id[j]]>0){
	for(l = 0; l < deg[id[j]]-1; l++){
	  printf("%d, ",c[id[j]][l]);
	    }
	printf("%d",c[id[j]][l]);}
	printf("]\n");
	break;
      }
    }
  }
  
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:14:32: error: expected ')' before ';' token
   14 |    c = malloc(sizeof(int) * (k);
      |              ~                 ^
      |                                )
Language: C

#include<iostream>
using namespace std;
#define NIL -1
int n,D[100005];
struct zs{int id;int l;int r;}a[100000+2];
void printfs(int u)
{
    cout<<"node "<< u <<": ";
    cout<<"parent = "<<a[u].id <<", ";
    cout<<"depth = "<<D[u] <<", ";
    if(a[u].id==NIL)cout<<"root, ";
    else if(a[u].l==NIL)cout<<"leaf, ";
    else cout<<"internal node, ";
    cout<<"[";
    for(int i=0,c=a[u].l;c!=NIL;i++,c=a[c].r)
    {
        if(i)cout<<", ";
        cout<<c;
    }
    cout<<"]"<<endl;
}
void sd(int p,int u)
{
    D[p]=u;
    if(a[p].r!=NIL)sd(a[p].r,u);
    if(a[p].l!=NIL)sd(a[p].l,u+1);
}
int main()
{
    int i,j,d,c,r,v,l;
   cin>>n;
   for(i=0;i<n;i++)a[i].id=a[i].l=a[i].r=NIL;
   for(i=0;i<n;i++)
   {
       cin>>v>>d;
       for(j=0;j<d;j++)
       {
           cin>>c;
           if(j==0)a[v].l=c;
           else a[l].r=c;
           l=c;
           a[c].id=v;
       }
   }
   for(i=0;i<n;i++)if(a[i].id==NIL)r=i;
   sd(r,0);
   for(i=0;i<n;i++)printfs(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>
#include <ctype.h>
????????
int par[100000];
????????
void init(int);
int dep(int);
int inp(void);
??????
char *p;
char in[1500000];
int tree[100000][15],idx[100000];
??????
int main(){
????int n,i,j,id,k,c;
??????
????fread(in,sizeof(in),1,stdin);?? 
????p = in;
??????
????n = inp(); init(n);
????for(i = 0 ; i < n ; i++){
????????id = inp();
????????k = inp();
????????for(j = 0 ; j < k ; j++){
????????????c = inp();
????????????par[c] = id;
????????????tree[id][idx[id]++] = c;
????????}
????}
????????
????for(i = 0 ; i < n ; i++){
????????printf("node %d: parent = %d, depth = %d, "
??????????????????????,i,par[i],dep(i));
??????????????
????????if(par[i] == -1){
????????????printf("root, [");
????????}else if(!idx[i]){
????????????printf("leaf, [");
????????}else{
????????????printf("internal node, [");
????????}
??????
????????for(j = 0 ; j < idx[i] ; j++){
????????????printf("%d",tree[i][j]);
????????????if(j < idx[i]-1) printf(", ");
????????}
????????puts("]");
????}
????return 0;
}
??????
void init(int n){
????int i;
????for(i = 0 ; i < n ; i++){
????????par[i] = -1;
????}
}
??????
int dep(int x){
????if(par[x] == -1) return 0;
????return dep(par[x]) + 1;
}
??????
int inp(){
????int v = 0;
????while(!isdigit(*p)) ++p;
????v = *p++&15;
????while(isdigit(*p)){
????????v = (v<<3)+(v<<1)+(*p++&15);
????}
????return v;
}

Compiler output:
main.c:3:1: error: expected identifier or '(' before '?' token
    3 | ????????
      | ^
main.c:5:1: error: expected identifier or '(' before '?' token
    5 | ????????
      | ^
main.c:9:1: error: expected identifier or '(' before '?' token
    9 | ??????
      | ^
main.c:13:1: error: expected identifier or '(' before '?' token
   13 | ??????
      | ^
main.c:51:1: error: expected identifier or '(' before '?' token
   51 | ??????
      | ^
main.c:58:1: error: expected identifier or '(' before '?' token
   58 | ??????
      | ^
main.c:63:1: error: expected identifier or '(' before '?' token
   63 | ??????
      | ^
Language: C

#include <iostream>
#define MAX 100005
#define NIL -1
??
struct Node{int p,l,r;};
??
Node T[MAX];
int n,D[MAX];
??
void print(int u){
????int c;
????std::cout << "node " << u << ": ";
????std::cout << "parent = " << T[u].p << ", ";
????std::cout << "depth = " << D[u] << ", " ;
??????
????if(T[u].p == NIL)std::cout << "root, ";
????else if(T[u].l == NIL) std::cout << "leaf, ";
????else std::cout << "internal node, ";
??????
????std::cout << "[";
??????
????for(int i = 0,c=T[u].l;c!=NIL;++i,c=T[c].r){
????????if(i)std::cout<<", ";
????????std::cout << c;
????}
??????
????std::cout?? << "]" <<std::endl;
}
??
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 v,d,c,l,r;
????std::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){
????????std::cin >> v >> d;
????????for(int j=0;j<d;++j){
????????????std::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:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include <iostream>
#define MAX 100005
#define NIL -1

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

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

void print(int u){
 int c;
 std::cout << "node " << u << ": ";
 std::cout << "parent = " << T[u].p << ", ";
 std::cout << "depth = " << D[u] << ", " ;

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

 std::cout << "[";

 for(int i = 0,c=T[u].l;c!=NIL;++i,c=T[c].r){
  if(i)std::cout<<", ";
  std::cout << c;
  }

 std::cout?? << "]" <<std::endl;
}

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 v,d,c,l,r;
 std::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){
  std::cin >> v >> d;
  for(int j=0;j<d;++j){
   std::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:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C


include <stdio.h>
#include <ctype.h>
    
int par[100000];
    
void init(int);
int dep(int);
int inp(void);
   
char *p;
char in[1500000];
int tree[100000][15],idx[100000];
   
int main(){
  int n,i,j,id,k,c;
   
  fread(in,sizeof(in),1,stdin);  
  p = in;
   
  n = inp(); init(n);
  for(i = 0 ; i < n ; i++){
    id = inp();
    k = inp();
    for(j = 0 ; j < k ; j++){
      c = inp();
      par[c] = id;
      tree[id][idx[id]++] = c;
    }
  }
    
  for(i = 0 ; i < n ; i++){
    printf("node %d: parent = %d, depth = %d, "
           ,i,par[i],dep(i));
       
    if(par[i] == -1){
      printf("root, [");
    }else if(!idx[i]){
      printf("leaf, [");
    }else{
      printf("internal node, [");
    }
   
    for(j = 0 ; j < idx[i] ; j++){
      printf("%d",tree[i][j]);
      if(j < idx[i]-1) printf(", ");
    }
    puts("]");
  }
  return 0;
}
   
void init(int n){
  int i;
  for(i = 0 ; i < n ; i++){
    par[i] = -1;
  }
}
   
int dep(int x){
  if(par[x] == -1) return 0;
  return dep(par[x]) + 1;
}
   
int inp(){
  int v = 0;
  while(!isdigit(*p)) ++p;
  v = *p++&15;
  while(isdigit(*p)){
    v = (v<<3)+(v<<1)+(*p++&15);
  }
  return v;
}

Compiler output:
main.c:2:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    2 | include <stdio.h>
      |         ^
main.c: In function 'main':
main.c:18:3: error: implicit declaration of function 'fread' [-Wimplicit-function-declaration]
   18 |   fread(in,sizeof(in),1,stdin);
      |   ^~~~~
main.c:18:25: error: 'stdin' undeclared (first use in this function)
   18 |   fread(in,sizeof(in),1,stdin);
      |                         ^~~~~
main.c:4:1: note: 'stdin' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'
    3 | #include <ctype.h>
  +++ |+#include <stdio.h>
    4 | 
main.c:18:25: note: each undeclared identifier is reported only once for each function it appears in
   18 |   fread(in,sizeof(in),1,stdin);
      |                         ^~~~~
main.c:33:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   33 |     printf("node %d: parent = %d, depth = %d, "
      |     ^~~~~~
main.c:33:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:33:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:33:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:48:5: error: implicit declaration of function 'puts' [-Wimplicit-function-declaration]
   48 |     puts("]");
      |     ^~~~
main.c:48:5: note: include '<stdio.h>' or provide a declaration of 'puts'
Language: C

include <stdio.h>
#include <ctype.h>
    
int par[100000];
    
void init(int);
int dep(int);
int inp(void);
   
char *p;
char in[1500000];
int tree[100000][15],idx[100000];
   
int main(){
  int n,i,j,id,k,c;
   
  fread(in,sizeof(in),1,stdin);  
  p = in;
   
  n = inp(); init(n);
  for(i = 0 ; i < n ; i++){
    id = inp();
    k = inp();
    for(j = 0 ; j < k ; j++){
      c = inp();
      par[c] = id;
      tree[id][idx[id]++] = c;
    }
  }
    
  for(i = 0 ; i < n ; i++){
    printf("node %d: parent = %d, depth = %d, "
           ,i,par[i],dep(i));
       
    if(par[i] == -1){
      printf("root, [");
    }else if(!idx[i]){
      printf("leaf, [");
    }else{
      printf("internal node, [");
    }
   
    for(j = 0 ; j < idx[i] ; j++){
      printf("%d",tree[i][j]);
      if(j < idx[i]-1) printf(", ");
    }
    puts("]");
  }
  return 0;
}
   
void init(int n){
  int i;
  for(i = 0 ; i < n ; i++){
    par[i] = -1;
  }
}
   
int dep(int x){
  if(par[x] == -1) return 0;
  return dep(par[x]) + 1;
}
   
int inp(){
  int v = 0;
  while(!isdigit(*p)) ++p;
  v = *p++&15;
  while(isdigit(*p)){
    v = (v<<3)+(v<<1)+(*p++&15);
  }
  return v;
}

Compiler output:
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include <stdio.h>
      |         ^
main.c: In function 'main':
main.c:17:3: error: implicit declaration of function 'fread' [-Wimplicit-function-declaration]
   17 |   fread(in,sizeof(in),1,stdin);
      |   ^~~~~
main.c:17:25: error: 'stdin' undeclared (first use in this function)
   17 |   fread(in,sizeof(in),1,stdin);
      |                         ^~~~~
main.c:3:1: note: 'stdin' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'
    2 | #include <ctype.h>
  +++ |+#include <stdio.h>
    3 | 
main.c:17:25: note: each undeclared identifier is reported only once for each function it appears in
   17 |   fread(in,sizeof(in),1,stdin);
      |                         ^~~~~
main.c:32:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   32 |     printf("node %d: parent = %d, depth = %d, "
      |     ^~~~~~
main.c:32:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:32:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:32:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:47:5: error: implicit declaration of function 'puts' [-Wimplicit-function-declaration]
   47 |     puts("]");
      |     ^~~~
main.c:47:5: note: include '<stdio.h>' or provide a declaration of 'puts'
Language: C

#include<stdio.h>
#define MAX 100000
#define NIL -1
  
typedef struct{
  int parent, left, right, depth;
} Node;
  
int set_depth(Node *tree, int id, int depth){
  tree[id].depth = depth;
  if(tree[id].right != NIL)
    set_depth(tree, tree[id].right, depth);
  if(tree[id].left != NIL)
    set_depth(tree, tree[id].left, depth+1);
  return 0;
}
  
int main(void){
  Node tree[MAX];
  int i, j, n, id, k, c, prev;
  char *kind[3] = {"root", "leaf", "internal node"};
  
  scanf("%d", &n);
  for(i=0; i<n; ++i)
    tree[i].parent = tree[i].left = tree[i].right = NIL;
  for(i=0; i<n; ++i){
    scanf("%d %d", &id, &k);
    for(j=0; j<k; ++j){
      scanf("%d", &c);
      tree[c].parent = id;
      if(j==0)
        tree[id].left = c;
      else
        tree[prev].right = c;
      prev = c;
    }
  }
  
  for(id=0; tree[id].parent!=NIL; id=tree[id].parent){}
  set_depth(tree, id, 0);
  
  for(i=0; i<n; ++i){
    printf("node %d: parent = %d, depth = %d, ", i, tree[i].parent, tree[i].depth);
    if(tree[i].parent == NIL)
      printf("%s, [", kind[0]);
    else if(tree[i].left == NIL)
      printf("%s, [", kind[1]);
    }else
      printf("%s, [", kind[2]);
    id = tree[i].left;
    if(id == NIL){
      printf("]\n");
      continue;
    }
    printf("%d", id);
    for(id=tree[id].right; id != NIL; id=tree[id].right)
      printf(", %d", id);
    printf("]\n");
  }
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:48:6: error: 'else' without a previous 'if'
   48 |     }else
      |      ^~~~
main.c:53:7: error: continue statement not within a loop
   53 |       continue;
      |       ^~~~~~~~
main.c: At top level:
main.c:61:3: error: expected identifier or '(' before 'return'
   61 |   return 0;
      |   ^~~~~~
main.c:62:1: error: expected identifier or '(' before '}' token
   62 | }
      | ^
Language: C

13
0 3 1 4 10
1 2 2 3
2 0
3 0
4 3 5 6 7
5 0
6 0
7 2 8 9
8 0
9 0
10 2 11 12
11 0
12 0

Compiler output:
main.c:1:1: error: expected identifier or '(' before numeric constant
    1 | 13
      | ^~
Language: C

#include <stdio.h>

#define MAX 100005
#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[c].r) {
    if(i) printf(", ");
    prinf("%d",c);
  }
  printf("]\n");
}

void 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(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: In function 'print':
main.c:25:5: error: implicit declaration of function 'prinf'; did you mean 'print'? [-Wimplicit-function-declaration]
   25 |     prinf("%d",c);
      |     ^~~~~
      |     print
Language: C

#include <stdio.h>

#define MAX 100005
#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[c].r) {
    if(i) printf(", ");
    printf("%d",c);
  }
  printf("]\n");
}

void 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(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: In function 'main':
main.c:58:3: error: expected declaration or statement at end of input
   58 |   return 0;
      |   ^~~~~~